提交代码

dev_xds
姜玉琦 2024-04-06 17:59:01 +08:00
parent d525dcd0a6
commit f8e82414ad
9 changed files with 74 additions and 46 deletions

View File

@ -13,7 +13,6 @@ public enum MessageTypeEnum {
JPYSSP("40", "举牌验收审批"),
CLFYSP("50", "材料封样审批"),
QYFSSP("60", "取样复试审批");
//工作流审批由ProcDefKey组成
private final String code;

View File

@ -7,7 +7,8 @@ package com.ruoyi.common.enums;
*/
public enum TemplateMessageEnum {
TROUBLE_DEFAULT("f3saBGJCnUAjXHw1KooxEUuRGv-a_8MG9dXfQvkRTBE", "隐患整改通知"),
TROUBLE_SUBMIT("f3saBGJCnUAjXHw1KooxEUuRGv-a_8MG9dXfQvkRTBE", "隐患整改通知"),
TROUBLE_HANDLE("6mGOWPXS3l5a5fzXd9GIV9_IkEfZmeJ_6G2P_SQkWnU", "隐患处理完成通知"),
APPLY_DEFAULT("KY7oAHgqFxUSaE3ByxFJfv_0U3LnSWfgUCwV-CZyEdo", "系统流程审批提醒");
private final String id;

View File

@ -10,7 +10,7 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.yanzhu.jh.project.domain.SurProjectAuditinfo;
import com.yanzhu.jh.project.mapper.SurProjectAuditinfoMapper;
import com.yanzhu.jh.wxsetting.service.impl.WxMessageImpl;
import com.yanzhu.jh.wxsetting.service.impl.WeChatMessageServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanzhu.jh.project.mapper.SurProjectCheckDetectionMapper;
@ -26,7 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
* @date 2023-08-31
*/
@Service
public class SurProjectCheckDetectionServiceImpl extends WxMessageImpl implements ISurProjectCheckDetectionService
public class SurProjectCheckDetectionServiceImpl extends WeChatMessageServiceImpl implements ISurProjectCheckDetectionService
{
@Autowired
private SurProjectAuditinfoMapper surProjectAuditinfoMapper;

View File

@ -11,7 +11,7 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.yanzhu.jh.project.domain.SurProjectAuditinfo;
import com.yanzhu.jh.project.mapper.SurProjectAuditinfoMapper;
import com.yanzhu.jh.wxsetting.service.impl.WxMessageImpl;
import com.yanzhu.jh.wxsetting.service.impl.WeChatMessageServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanzhu.jh.project.mapper.SurProjectCheckingMapper;
@ -27,7 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
* @date 2023-08-18
*/
@Service
public class SurProjectCheckingServiceImpl extends WxMessageImpl implements ISurProjectCheckingService
public class SurProjectCheckingServiceImpl extends WeChatMessageServiceImpl implements ISurProjectCheckingService
{
@Autowired
private SurProjectAuditinfoMapper surProjectAuditinfoMapper;

View File

@ -10,7 +10,7 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.yanzhu.jh.project.domain.SurProjectAuditinfo;
import com.yanzhu.jh.project.mapper.SurProjectAuditinfoMapper;
import com.yanzhu.jh.wxsetting.service.impl.WxMessageImpl;
import com.yanzhu.jh.wxsetting.service.impl.WeChatMessageServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanzhu.jh.project.mapper.SurProjectMaterialSealMapper;
@ -26,7 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
* @date 2023-08-22
*/
@Service
public class SurProjectMaterialSealServiceImpl extends WxMessageImpl implements ISurProjectMaterialSealService
public class SurProjectMaterialSealServiceImpl extends WeChatMessageServiceImpl implements ISurProjectMaterialSealService
{
@Autowired

View File

@ -10,7 +10,7 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.yanzhu.jh.project.domain.SurProjectAuditinfo;
import com.yanzhu.jh.project.mapper.SurProjectAuditinfoMapper;
import com.yanzhu.jh.wxsetting.service.impl.WxMessageImpl;
import com.yanzhu.jh.wxsetting.service.impl.WeChatMessageServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanzhu.jh.project.mapper.SurProjectMeasureMapper;
@ -26,7 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
* @date 2023-08-22
*/
@Service
public class SurProjectMeasureServiceImpl extends WxMessageImpl implements ISurProjectMeasureService
public class SurProjectMeasureServiceImpl extends WeChatMessageServiceImpl implements ISurProjectMeasureService
{
@Autowired
private SurProjectAuditinfoMapper surProjectAuditinfoMapper;

View File

@ -21,7 +21,7 @@ import com.yanzhu.jh.trouble.domain.SmzSspFileinfo;
import com.yanzhu.jh.trouble.domain.SmzSspProblemmodify;
import com.yanzhu.jh.trouble.mapper.SmzSspAuditinfoMapper;
import com.yanzhu.jh.trouble.mapper.SmzSspProblemmodifyMapper;
import com.yanzhu.jh.wxsetting.service.impl.WxMessageImpl;
import com.yanzhu.jh.wxsetting.service.impl.WeChatMessageServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanzhu.jh.trouble.mapper.SmzSspProblemmodifyDraftMapper;
@ -37,7 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
* @date 2023-10-15
*/
@Service
public class SmzSspProblemmodifyDraftServiceImpl extends WxMessageImpl implements ISmzSspProblemmodifyDraftService
public class SmzSspProblemmodifyDraftServiceImpl extends WeChatMessageServiceImpl implements ISmzSspProblemmodifyDraftService
{
@Autowired
private SysDeptMapper deptMapper;

View File

@ -17,7 +17,7 @@ import com.yanzhu.jh.trouble.domain.SmzSspAuditinfo;
import com.yanzhu.jh.trouble.domain.SmzSspFileinfo;
import com.yanzhu.jh.trouble.domain.where.SmzSspProblemmodifyWhere;
import com.yanzhu.jh.trouble.mapper.SmzSspAuditinfoMapper;
import com.yanzhu.jh.wxsetting.service.impl.WxMessageImpl;
import com.yanzhu.jh.wxsetting.service.impl.WeChatMessageServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanzhu.jh.trouble.mapper.SmzSspProblemmodifyMapper;
@ -32,7 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
* @date 2023-07-28
*/
@Service
public class SmzSspProblemmodifyServiceImpl extends WxMessageImpl implements ISmzSspProblemmodifyService
public class SmzSspProblemmodifyServiceImpl extends WeChatMessageServiceImpl implements ISmzSspProblemmodifyService
{
@Autowired
private SysDeptMapper deptMapper;

View File

@ -25,6 +25,8 @@ import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@ -38,7 +40,9 @@ import java.util.stream.Collectors;
* JiangYuQi
*/
@Slf4j
public class WxMessageImpl{
@Component
@EnableAsync
public class WeChatMessageServiceImpl {
@Autowired
private WxMpService wxMpService;
@ -58,16 +62,19 @@ public class WxMessageImpl{
@Async
public void send(SmzSspProblemmodify smzSspProblemmodify){
List<WxMpTemplateMessage> list = new ArrayList<>();
WxMpTemplateMessage mpTemplateMessage;
Long state = smzSspProblemmodify.getCheckState();
String handlePath = smzSspProblemmodify.getInfoType()==0?"security":"quality";
String infoTypeName = smzSspProblemmodify.getInfoType()==0?"安全隐患":"安全隐患";
String infoTypeDict = smzSspProblemmodify.getInfoType()==0?"ssp_aqyhlx":"ssp_zlyhlx";
/**
*
*/
if(state==0){
WxMpTemplateMessage mpTemplateMessage;
//通知整改人
mpTemplateMessage = new WxMpTemplateMessage();
mpTemplateMessage.setToUser(this.getMsgId(smzSspProblemmodify.getLordSentUser()));
mpTemplateMessage.setTemplateId(TemplateMessageEnum.TROUBLE_DEFAULT.getId());
mpTemplateMessage.setTemplateId(TemplateMessageEnum.TROUBLE_SUBMIT.getId());
//模板数据
List<WxMpTemplateData> datas = new ArrayList<>();
WxMpTemplateData data = new WxMpTemplateData();
@ -79,8 +86,8 @@ public class WxMessageImpl{
datas.add(data);
data.setValue(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,smzSspProblemmodify.getNickedTime()));
datas.add(data);
String typeName = smzSspProblemmodify.getInfoType()==0?"安全隐患":"安全隐患";
data.setValue(typeName+"-"+ DictUtils.getDictLabel(smzSspProblemmodify.getInfoType()==0?"ssp_aqyhlx":"ssp_zlyhlx",smzSspProblemmodify.getDangerType()));
data.setValue(infoTypeName+"-"+ DictUtils.getDictLabel(smzSspProblemmodify.getInfoType()==0?"ssp_aqyhlx":"ssp_zlyhlx",smzSspProblemmodify.getDangerType()));
datas.add(data);
//TODO:这里缺少小程序跳转连接...
mpTemplateMessage.setData(datas);
@ -89,7 +96,7 @@ public class WxMessageImpl{
//通知抄送人
mpTemplateMessage = new WxMpTemplateMessage();
mpTemplateMessage.setToUser(this.getMsgId(smzSspProblemmodify.getCopySendUser()));
mpTemplateMessage.setTemplateId(TemplateMessageEnum.TROUBLE_DEFAULT.getId());
mpTemplateMessage.setTemplateId(TemplateMessageEnum.TROUBLE_HANDLE.getId());
//模板数据
datas = new ArrayList<>();
data.setValue(this.getMsgProName(smzSspProblemmodify.getProjectId()));
@ -100,39 +107,61 @@ public class WxMessageImpl{
datas.add(data);
data.setValue(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,smzSspProblemmodify.getNickedTime()));
datas.add(data);
data.setValue(typeName+"-"+ DictUtils.getDictLabel(smzSspProblemmodify.getInfoType()==0?"ssp_aqyhlx":"ssp_zlyhlx",smzSspProblemmodify.getDangerType()));
data.setValue(infoTypeName+"-"+ DictUtils.getDictLabel(smzSspProblemmodify.getInfoType()==0?"ssp_aqyhlx":"ssp_zlyhlx",smzSspProblemmodify.getDangerType()));
datas.add(data);
mpTemplateMessage.setData(datas);
list.add(mpTemplateMessage);
} else if(state==1){
//通知复检人
mpTemplateMessage = new WxMpTemplateMessage();
mpTemplateMessage.setToUser(this.getMsgId(smzSspProblemmodify.getRecheckSendUser()));
mpTemplateMessage.setTemplateId(TemplateMessageEnum.TROUBLE_DEFAULT.getId());
//模板数据
List<WxMpTemplateData> datas = new ArrayList<>();
WxMpTemplateData data = new WxMpTemplateData();
data.setValue(this.getMsgProName(smzSspProblemmodify.getProjectId()));
datas.add(data);
data.setValue(DateUtils.getTime());
datas.add(data);
data.setValue(this.getMsgName(smzSspProblemmodify.getCreateUser()));
datas.add(data);
data.setValue(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,smzSspProblemmodify.getNickedTime()));
datas.add(data);
String typeName = smzSspProblemmodify.getInfoType()==0?"安全隐患":"安全隐患";
data.setValue(typeName+"-"+ DictUtils.getDictLabel(smzSspProblemmodify.getInfoType()==0?"ssp_aqyhlx":"ssp_zlyhlx",smzSspProblemmodify.getDangerType()));
datas.add(data);
//TODO:这里缺少小程序跳转连接...
mpTemplateMessage.setData(datas);
list.add(mpTemplateMessage);
/**
*
*
*/
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
.toUser(this.getMsgId(smzSspProblemmodify.getRecheckSendUser()))
.templateId(TemplateMessageEnum.TROUBLE_HANDLE.getId())
.miniProgram(new WxMpTemplateMessage.MiniProgram(WechatAccountConfig.getWxAppId(), "/pageage/project_problemmodify/"+handlePath+"/list/index?barProId="+smzSspProblemmodify.getProjectId()))
.build();
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing11", this.getMsgProName(smzSspProblemmodify.getProjectId())));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("const16", infoTypeName+"/"+ DictUtils.getDictLabel(infoTypeDict,smzSspProblemmodify.getDangerType())));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", smzSspProblemmodify.getLordSent()));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time3", DateUtils.getTime()));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("const10", "隐患整改提交复检"));
list.add(templateMessage);
} else if(state==3){
/**
*
*
*/
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
.toUser(this.getMsgId(smzSspProblemmodify.getLordSentUser()))
.templateId(TemplateMessageEnum.TROUBLE_HANDLE.getId())
.miniProgram(new WxMpTemplateMessage.MiniProgram(WechatAccountConfig.getWxAppId(), "/pageage/project_problemmodify/"+handlePath+"/list/index?barProId="+smzSspProblemmodify.getProjectId()))
.build();
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing11", this.getMsgProName(smzSspProblemmodify.getProjectId())));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("const16", infoTypeName+"/"+ DictUtils.getDictLabel(infoTypeDict,smzSspProblemmodify.getDangerType())));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", smzSspProblemmodify.getRecheckSend()));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time3", DateUtils.getTime()));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("const10", "隐患整改复检驳回,请重新提交整改。"));
list.add(templateMessage);
} else if(state==4){
//通知提交人
/**
*
*
*/
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
.toUser(this.getMsgId(smzSspProblemmodify.getLordSentUser()))
.templateId(TemplateMessageEnum.TROUBLE_HANDLE.getId())
.miniProgram(new WxMpTemplateMessage.MiniProgram(WechatAccountConfig.getWxAppId(), "/pageage/project_problemmodify/"+handlePath+"/list/index?barProId="+smzSspProblemmodify.getProjectId()))
.build();
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing11", this.getMsgProName(smzSspProblemmodify.getProjectId())));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("const16", infoTypeName+"/"+ DictUtils.getDictLabel(infoTypeDict,smzSspProblemmodify.getDangerType())));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", smzSspProblemmodify.getRecheckSend()));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time3", DateUtils.getTime()));
templateMessage.addWxMpTemplateData(new WxMpTemplateData("const10", "隐患整改复检通过"));
list.add(templateMessage);
}
this.send(list, MessageTypeEnum.getYHPCLX(smzSspProblemmodify.getInfoType()));
this.send(list, MessageTypeEnum.getYHPCLX(smzSspProblemmodify.getInfoType())+state);
}
/**
@ -148,7 +177,6 @@ public class WxMessageImpl{
*
*/
String supMsgId = this.getMsgId(surProjectChecking.getSuperviseUser());
//模板数据
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
.toUser(supMsgId)
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId())