增加消息板块
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
|
||||
import com.ruoyi.wgz.domain.WgzMessage;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
|
@ -3,9 +3,9 @@ package com.ruoyi.bgt.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.injector.methods.DeleteById;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
|
||||
import com.ruoyi.bgt.bo.BgtProjectRecruitApplyQueryBo;
|
||||
import com.ruoyi.bgt.domain.BgtProjectRecruit;
|
||||
import com.ruoyi.bgt.domain.BgtProjectRecruitApply;
|
||||
@ -17,8 +17,7 @@ import com.ruoyi.bgt.domain.vo.BgtProjectRecruitApplyVO;
|
||||
import com.ruoyi.bgt.mapper.BgtProjectRecruitApplyMapper;
|
||||
import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService;
|
||||
import com.ruoyi.bgt.service.IBgtProjectRecruitService;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.constants.WgzAndBgtMessageConstant;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.RecruitApplyStatus;
|
||||
@ -26,12 +25,12 @@ import com.ruoyi.common.exception.BaseException;
|
||||
import com.ruoyi.common.service.IAnnexService;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppRegisteredProjectReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUnderwayReq;
|
||||
import com.ruoyi.wgz.bo.res.WgzAppUnderwayRes;
|
||||
import com.ruoyi.wgz.domain.WgzMessage;
|
||||
import com.ruoyi.wgz.domain.WgzScoreRecord;
|
||||
import com.ruoyi.wgz.domain.WgzUser;
|
||||
import com.ruoyi.wgz.service.IWgzMessageService;
|
||||
import com.ruoyi.wgz.service.IWgzScoreRecordService;
|
||||
import com.ruoyi.wgz.service.IWgzUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -42,6 +41,8 @@ import java.text.DecimalFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
||||
import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*;
|
||||
|
||||
/**
|
||||
* 包工头招工申请Service业务层处理
|
||||
*
|
||||
@ -51,7 +52,6 @@ import java.util.*;
|
||||
@Service
|
||||
public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjectRecruitApplyMapper, BgtProjectRecruitApply> implements IBgtProjectRecruitApplyService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IAnnexService annexService;
|
||||
@Autowired
|
||||
@ -62,6 +62,8 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
private IBgtProjectRecruitApplyService iBgtProjectRecruitApplyService;
|
||||
@Autowired
|
||||
private IBgtProjectRecruitService iBgtProjectRecruitService;
|
||||
@Autowired
|
||||
private IWgzMessageService iWgzMessageService;
|
||||
|
||||
@Override
|
||||
public BgtProjectRecruitApply queryById(Long id){
|
||||
@ -190,11 +192,43 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
if (!Objects.equals(appById.getTypeOfWork(), byId.getTypeOfWork())){
|
||||
throw new RuntimeException("工种不匹配!");
|
||||
}
|
||||
//2、插入数据
|
||||
//3、插入数据
|
||||
BgtProjectRecruitApply bgtProjectRecruitApply = new BgtProjectRecruitApply();
|
||||
bgtProjectRecruitApply.setRecruitId(id);
|
||||
bgtProjectRecruitApply.setUserId(appUserId);
|
||||
return baseMapper.insert(bgtProjectRecruitApply) >0;
|
||||
int insert = baseMapper.insert(bgtProjectRecruitApply);
|
||||
//4、发送消息
|
||||
if (insert>0){
|
||||
Map<String, String> mp = new HashMap<>();
|
||||
mp.put("projectName",appById.getRecruitName());
|
||||
//4-1、系统发送消息给当前用户
|
||||
WgzMessage wgzMessage = new WgzMessage().
|
||||
setSenderType(USERTYPE_SYSTEM).
|
||||
setRecipientType(USERTYPE_WGZ).
|
||||
setRecipientId(appUserId).
|
||||
setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"1")).
|
||||
setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"2")).
|
||||
setTableId(bgtProjectRecruitApply.getId()).
|
||||
setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
|
||||
setMessageLargeType(LARGE_OTHER).
|
||||
setMessageSmallType(SMALL_SYSTEM);
|
||||
if (!iWgzMessageService.sendAMessage(wgzMessage)){
|
||||
throw new RuntimeException("系统消息发送失败!");
|
||||
}
|
||||
//4-2、当前用户发送消息给包工头
|
||||
wgzMessage.
|
||||
setSenderType(USERTYPE_WGZ).
|
||||
setSenderId(appUserId).
|
||||
setRecipientType(USERTYPE_BGT).
|
||||
setRecipientId(appById.getUserId()).
|
||||
setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"3")).
|
||||
setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"4")).
|
||||
setMessageLargeType(LARGE_APPLY);
|
||||
if (!iWgzMessageService.sendAMessage(wgzMessage)){
|
||||
throw new RuntimeException("发送消息失败!");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<BgtProjectRecruitApplyVO> todayAttendanceList(BgtAttendanceDayDTO dto){
|
||||
|
@ -0,0 +1,70 @@
|
||||
package com.ruoyi.common.constants;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class WgzAndBgtMessageConstant {
|
||||
// 公共常量
|
||||
public static final String USERTYPE_SYSTEM = "0"; //系统
|
||||
public static final String USERTYPE_WGZ = "1"; //务工者
|
||||
public static final String USERTYPE_BGT = "2"; //包工头
|
||||
|
||||
public static final String LARGE_APPLY = "0"; //大类型-报名
|
||||
public static final String LARGE_SALARY = "1"; //大类型-工资
|
||||
public static final String LARGE_OTHER = "2"; //大类型-其它
|
||||
public static final String SMALL_CARD = "0"; //小类型-补卡
|
||||
public static final String SMALL_SYSTEM = "1"; //小类型-系统
|
||||
|
||||
|
||||
/**
|
||||
* =====================================================务工者=====================================================
|
||||
* =====================================================务工者=====================================================
|
||||
* =====================================================务工者=====================================================
|
||||
*/
|
||||
|
||||
//【报名】系统给务工者提示
|
||||
public static final String WGZ_SYSTEM_HEADLINE_APPLY = "您已申请【%s】项目!";
|
||||
public static final String WGZ_SYSTEM_SUBHEADING_APPLY = "您已成功申请到【%s】项目,请耐心等待回复!";
|
||||
//【报名】务工者给包工头提示
|
||||
public static final String WGZ_HEADLINE_APPLY = "务工者【%s】正在向你申请【%s】的工作岗位!";
|
||||
public static final String WGZ__SUBHEADING_APPLY = "务工者【%s】正在向你申请【%s】岗位,您可点击查看更多信息!";
|
||||
|
||||
//务工者消息返回
|
||||
public static String wgzMessage(Map<String, String> mp, String type) {
|
||||
switch (type){
|
||||
case "1":
|
||||
return String.format(WGZ_SYSTEM_HEADLINE_APPLY, mp.get("projectName"));
|
||||
case "2":
|
||||
return String.format(WGZ_SYSTEM_SUBHEADING_APPLY, mp.get("projectName"));
|
||||
case "3":
|
||||
return String.format(WGZ_HEADLINE_APPLY, mp.get("userName"), mp.get("post"));
|
||||
case "4":
|
||||
return String.format(WGZ__SUBHEADING_APPLY, mp.get("userName"),mp.get("post"));
|
||||
default:
|
||||
return "未知类型";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* =====================================================包工头=====================================================
|
||||
* =====================================================包工头=====================================================
|
||||
* =====================================================包工头=====================================================
|
||||
*/
|
||||
|
||||
public static final String BGT_HEADLINE_APPLY = "您申请的【%s】项目,已得到回复!";
|
||||
public static final String BGT_SUBHEADING_APPLY = "您申请的【%s】项目,已经过审核人【%s】同意!";
|
||||
|
||||
//包工头消息返回
|
||||
public static String bgtMessage(Map<String, String> mp, String type) {
|
||||
switch (type){
|
||||
case "1":
|
||||
return String.format(BGT_HEADLINE_APPLY, mp.get("projectName"));
|
||||
case "2":
|
||||
return String.format(BGT_SUBHEADING_APPLY, mp.get("projectName"),mp.get("auditor"));
|
||||
default:
|
||||
return "未知类型";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -34,7 +34,7 @@ public class WgzAttendance implements Serializable {
|
||||
|
||||
/** 自增ID */
|
||||
@ApiModelProperty("自增ID")
|
||||
@TableId(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 项目ID */
|
||||
|
@ -33,7 +33,7 @@ public class WgzDailyClock implements Serializable {
|
||||
|
||||
/** 自增ID */
|
||||
@ApiModelProperty("自增ID")
|
||||
@TableId(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 项目ID */
|
||||
|
@ -33,7 +33,7 @@ public class WgzLeave implements Serializable {
|
||||
|
||||
/** 主键自增ID */
|
||||
@ApiModelProperty("主键自增ID")
|
||||
@TableId(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 项目ID */
|
||||
|
@ -33,7 +33,7 @@ public class WgzMessage implements Serializable {
|
||||
|
||||
/** 主键自增ID */
|
||||
@ApiModelProperty("主键自增ID")
|
||||
@TableId(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 发送类型(0系统 1务工者 2包工头) */
|
||||
|
@ -1,9 +1,6 @@
|
||||
package com.ruoyi.wgz.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -33,7 +30,7 @@ public class WgzPayCalculation implements Serializable {
|
||||
|
||||
/** 主键自增ID */
|
||||
@ApiModelProperty("主键自增ID")
|
||||
@TableId(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 任务ID */
|
||||
|
@ -33,7 +33,7 @@ public class WgzPayCalculationFiles implements Serializable {
|
||||
|
||||
/** 主键自增ID */
|
||||
@ApiModelProperty("主键自增ID")
|
||||
@TableId(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 工资结算主键自增ID */
|
||||
|
@ -33,7 +33,7 @@ public class WgzQuestionBank implements Serializable {
|
||||
|
||||
/** 主键ID */
|
||||
@ApiModelProperty("主键ID")
|
||||
@TableId(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 题目类别(外键关联到类别表) */
|
||||
|
@ -33,7 +33,7 @@ public class WgzQuestionCategory implements Serializable {
|
||||
|
||||
/** 主键ID */
|
||||
@ApiModelProperty("主键ID")
|
||||
@TableId(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 题库类别 */
|
||||
|
@ -33,7 +33,7 @@ public class WgzQuestionSave implements Serializable {
|
||||
|
||||
/** 主键ID */
|
||||
@ApiModelProperty("主键ID")
|
||||
@TableId(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 务工者唯一标识 */
|
||||
|
@ -33,7 +33,7 @@ public class WgzQuestionsConfiguration implements Serializable {
|
||||
|
||||
/** 主键ID */
|
||||
@ApiModelProperty("主键ID")
|
||||
@TableId(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 单选题(单位/道) */
|
||||
|
@ -33,7 +33,7 @@ public class WgzReissueacard implements Serializable {
|
||||
|
||||
/** 主键自增ID */
|
||||
@ApiModelProperty("主键自增ID")
|
||||
@TableId(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 项目ID */
|
||||
|
@ -1,9 +1,6 @@
|
||||
package com.ruoyi.wgz.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -31,7 +28,7 @@ public class WgzScoreRecord implements Serializable {
|
||||
|
||||
/** 主键ID */
|
||||
@ApiModelProperty("主键ID")
|
||||
@TableId(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 招工ID */
|
||||
|
@ -28,7 +28,7 @@ public class WgzUser implements Serializable {
|
||||
|
||||
/** 主键ID */
|
||||
@ApiModelProperty("主键ID")
|
||||
@TableId(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private String id;
|
||||
|
||||
/** 唯一标识 */
|
||||
|
@ -52,4 +52,16 @@ public interface IWgzMessageService extends IServicePlus<WgzMessage> {
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* LC-APP相关
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*/
|
||||
Boolean sendAMessage(WgzMessage bo);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -28,6 +29,8 @@ import java.util.Collection;
|
||||
@Service
|
||||
public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, WgzMessage> implements IWgzMessageService {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public WgzMessage queryById(Long id){
|
||||
return getById(id);
|
||||
@ -91,4 +94,16 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
|
||||
}
|
||||
return removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* LC-APP相关
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Boolean sendAMessage(WgzMessage bo) {
|
||||
return save(bo);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user