|
|
|
@@ -1,5 +1,8 @@ |
|
|
|
package com.iformall.service.impl; |
|
|
|
|
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import com.alibaba.druid.support.json.JSONUtils; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
@@ -182,13 +185,20 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
} |
|
|
|
|
|
|
|
public Map<String,Object> mallUserInfoToMap(MallUserInfo userInfo){ |
|
|
|
Map<String,Object> map = new HashedMap(); |
|
|
|
if(userInfo != null){ |
|
|
|
map.put("name",userInfo.getName()); |
|
|
|
map.put("id",userInfo.getId()); |
|
|
|
map.put("phone",userInfo.getPhone()); |
|
|
|
try { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
Class<?> clazz = userInfo.getClass(); |
|
|
|
for (Field field : clazz.getDeclaredFields()) { |
|
|
|
field.setAccessible(true); |
|
|
|
String fieldName = field.getName(); |
|
|
|
Object value = field.get(userInfo); |
|
|
|
map.put(fieldName, value); |
|
|
|
} |
|
|
|
return map; |
|
|
|
}catch (IllegalAccessException e){ |
|
|
|
logger.error("mallUserInfoToMap error",e); |
|
|
|
} |
|
|
|
return map; |
|
|
|
return new HashMap<>(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@@ -257,73 +267,69 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); |
|
|
|
|
|
|
|
//发邮件 |
|
|
|
if(StringUtils.isNotBlank(email)){ |
|
|
|
Map msgReplaceMap = new HashedMap(); |
|
|
|
msgReplaceMap.put("page", Constant.adminPage); |
|
|
|
msgReplaceMap.put("applyTime", new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date())); |
|
|
|
msgReplaceMap.put("name",userName); |
|
|
|
msgReplaceMap.put("linkName",userName); |
|
|
|
msgReplaceMap.put("linkPhone",phone); |
|
|
|
ResultData resultData = getTaskStatusList(businessId, tenantId); |
|
|
|
List<WxFlowRecord> flowRecordList = (List<WxFlowRecord>) resultData.data; |
|
|
|
String taskListHtml = ""; |
|
|
|
for (int i = flowRecordList.size() -1; i>=0; i--) { |
|
|
|
WxFlowRecord record = flowRecordList.get(i); |
|
|
|
if (record.getStatus().equals(EnumFlowRecordStatus.NEW.getCode())) { |
|
|
|
taskListHtml += "<div style=\"overflow: hidden;\">"; |
|
|
|
taskListHtml += "<div style=\"overflow: hidden;\">"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: 40px;height: 30px;\"><img src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/emailduihao.png\" style=\"display: block; width: 20px;height: 20px;margin-top: 10px;\"></div>"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: auto;margin-right:10px;height: 30px;line-height: 18px;font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(51,51,51,1);margin-top: 11px;\">发起申请</div>"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: auto;margin-right:10px;height: 30px;margin-top:15px;line-height: 14px;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(51,51,51,1);\">"+record.getUserName()+"</div>"; |
|
|
|
taskListHtml += "</div>"; |
|
|
|
if(i == flowRecordList.size() - 1){ |
|
|
|
taskListHtml += "<div style=\"width: 80%; overflow: hidden;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;padding-left: 30px;margin-left: 10px;padding-bottom: 20px; line-height: 24px; color:rgba(153,153,153,1);\">"+record.getRemark() == null ? "" : record.getRemark()+"</div>"; |
|
|
|
}else{ |
|
|
|
taskListHtml += "<div style=\"width: 80%; overflow: hidden;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;padding-left: 30px;margin-left: 10px;padding-bottom: 20px; line-height: 24px; border-left: 2px dashed #DEDEDE; color:rgba(153,153,153,1);\">"+record.getRemark() == null ? "" : record.getRemark()+"</div>"; |
|
|
|
} |
|
|
|
taskListHtml += "</div>"; |
|
|
|
} else if (record.getStatus().equals(EnumFlowRecordStatus.ASSIGNEE.getCode())) { |
|
|
|
taskListHtml += "<div style=\"overflow: hidden;\">"; |
|
|
|
taskListHtml += "<div style=\"overflow: hidden;\">"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: 40px;height: 30px;\"><img src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/emailhong.png\" style=\"display: block; width: 20px;height: 20px;margin-top: 10px;\"></div>"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: auto;margin-right:10px;height: 30px;line-height: 18px;font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(200,89,98,1);margin-top: 11px;\">待审批</div>"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: auto;margin-right:10px;height: 30px;margin-top:15px;line-height: 14px;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(200,89,98,1);\">"+record.getUserName()+"</div>"; |
|
|
|
taskListHtml += "</div>"; |
|
|
|
if(i == flowRecordList.size() - 1){ |
|
|
|
taskListHtml += "<div style=\"width: 80%; overflow: hidden;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;padding-left: 30px;margin-left: 10px;padding-bottom: 20px; line-height: 24px; color:rgba(153,153,153,1);\">"+record.getRemark() == null ? "" : record.getRemark()+"</div>"; |
|
|
|
}else{ |
|
|
|
taskListHtml += "<div style=\"width: 80%; overflow: hidden;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;padding-left: 30px;margin-left: 10px;padding-bottom: 20px; line-height: 24px; border-left: 2px dashed #DEDEDE; color:rgba(153,153,153,1);\">"+record.getRemark() == null ? "" : record.getRemark()+"</div>"; |
|
|
|
} |
|
|
|
taskListHtml += "</div>"; |
|
|
|
} else { |
|
|
|
taskListHtml += "<div style=\"overflow: hidden;\">"; |
|
|
|
taskListHtml += "<div style=\"overflow: hidden;\">"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: 40px;height: 30px;\"><img src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/emailhui.png\" style=\"display: block; width: 20px;height: 20px;margin-top: 10px;\"></div>"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: auto;margin-right:10px;height: 30px;line-height: 18px;font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-top: 11px;\">同意并呈送</div>"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: auto;margin-right:10px;height: 30px;margin-top:15px;line-height: 14px;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);\">"+record.getUserName()+"</div>"; |
|
|
|
taskListHtml += "</div>"; |
|
|
|
if(i == flowRecordList.size() - 1){ |
|
|
|
taskListHtml += "<div style=\"width: 80%; overflow: hidden;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;padding-left: 30px;margin-left: 10px;padding-bottom: 20px; line-height: 24px; color:rgba(153,153,153,1);\">"+record.getRemark() == null ? "" : record.getRemark()+"</div>"; |
|
|
|
}else{ |
|
|
|
taskListHtml += "<div style=\"width: 80%; overflow: hidden;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;padding-left: 30px;margin-left: 10px;padding-bottom: 20px; line-height: 24px; border-left: 2px dashed #DEDEDE; color:rgba(153,153,153,1);\">"+record.getRemark() == null ? "" : record.getRemark()+"</div>"; |
|
|
|
} |
|
|
|
|
|
|
|
taskListHtml += "</div>"; |
|
|
|
Map msgReplaceMap = new HashedMap(); |
|
|
|
msgReplaceMap.put("page", Constant.adminPage); |
|
|
|
msgReplaceMap.put("applyTime", new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date())); |
|
|
|
msgReplaceMap.put("name",userName); |
|
|
|
msgReplaceMap.put("linkName",userName); |
|
|
|
msgReplaceMap.put("linkPhone",phone); |
|
|
|
ResultData resultData = getTaskStatusList(businessId, tenantId); |
|
|
|
List<WxFlowRecord> flowRecordList = (List<WxFlowRecord>) resultData.data; |
|
|
|
String taskListHtml = ""; |
|
|
|
for (int i = flowRecordList.size() -1; i>=0; i--) { |
|
|
|
WxFlowRecord record = flowRecordList.get(i); |
|
|
|
String remark = record.getRemark()==null?"":record.getRemark(); |
|
|
|
if (record.getStatus().equals(EnumFlowRecordStatus.NEW.getCode())) { |
|
|
|
taskListHtml += "<div style=\"overflow: hidden;\">"; |
|
|
|
taskListHtml += "<div style=\"overflow: hidden;\">"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: 40px;height: 30px;\"><img src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/emailduihao.png\" style=\"display: block; width: 20px;height: 20px;margin-top: 10px;\"></div>"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: auto;margin-right:10px;height: 30px;line-height: 18px;font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(51,51,51,1);margin-top: 11px;\">发起申请</div>"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: auto;margin-right:10px;height: 30px;margin-top:15px;line-height: 14px;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(51,51,51,1);\">"+record.getUserName()+"</div>"; |
|
|
|
taskListHtml += "</div>"; |
|
|
|
if(i == 0){ |
|
|
|
taskListHtml += "<div style=\"width: 80%; overflow: hidden;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;padding-left: 30px;margin-left: 10px;padding-bottom: 20px; line-height: 24px; color:rgba(153,153,153,1);\">"+remark+"</div>"; |
|
|
|
}else{ |
|
|
|
taskListHtml += "<div style=\"width: 80%; overflow: hidden;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;padding-left: 30px;margin-left: 10px;padding-bottom: 20px; line-height: 24px; border-left: 2px dashed #DEDEDE; color:rgba(153,153,153,1);\">"+remark+"</div>"; |
|
|
|
} |
|
|
|
taskListHtml += "</div>"; |
|
|
|
} else if (record.getStatus().equals(EnumFlowRecordStatus.ASSIGNEE.getCode())) { |
|
|
|
taskListHtml += "<div style=\"overflow: hidden;\">"; |
|
|
|
taskListHtml += "<div style=\"overflow: hidden;\">"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: 40px;height: 30px;\"><img src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/emailhong.png\" style=\"display: block; width: 20px;height: 20px;margin-top: 10px;\"></div>"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: auto;margin-right:10px;height: 30px;line-height: 18px;font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(200,89,98,1);margin-top: 11px;\">待审批</div>"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: auto;margin-right:10px;height: 30px;margin-top:15px;line-height: 14px;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(200,89,98,1);\">"+record.getUserName()+"</div>"; |
|
|
|
taskListHtml += "</div>"; |
|
|
|
if(i == 0){ |
|
|
|
taskListHtml += "<div style=\"width: 80%; overflow: hidden;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;padding-left: 30px;margin-left: 10px;padding-bottom: 20px; line-height: 24px; color:rgba(153,153,153,1);\">"+remark+"</div>"; |
|
|
|
}else{ |
|
|
|
taskListHtml += "<div style=\"width: 80%; overflow: hidden;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;padding-left: 30px;margin-left: 10px;padding-bottom: 20px; line-height: 24px; border-left: 2px dashed #DEDEDE; color:rgba(153,153,153,1);\">"+remark+"</div>"; |
|
|
|
} |
|
|
|
taskListHtml += "</div>"; |
|
|
|
} else { |
|
|
|
taskListHtml += "<div style=\"overflow: hidden;\">"; |
|
|
|
taskListHtml += "<div style=\"overflow: hidden;\">"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: 40px;height: 30px;\"><img src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/emailhui.png\" style=\"display: block; width: 20px;height: 20px;margin-top: 10px;\"></div>"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: auto;margin-right:10px;height: 30px;line-height: 18px;font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-top: 11px;\">同意并呈送</div>"; |
|
|
|
taskListHtml += "<div style=\"float: left; width: auto;margin-right:10px;height: 30px;margin-top:15px;line-height: 14px;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);\">"+record.getUserName()+"</div>"; |
|
|
|
taskListHtml += "</div>"; |
|
|
|
if(i == 0){ |
|
|
|
taskListHtml += "<div style=\"width: 80%; overflow: hidden;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;padding-left: 30px;margin-left: 10px;padding-bottom: 20px; line-height: 24px; color:rgba(153,153,153,1);\">"+remark+"</div>"; |
|
|
|
}else{ |
|
|
|
taskListHtml += "<div style=\"width: 80%; overflow: hidden;font-size:14px;font-family:MicrosoftYaHei;font-weight:400;padding-left: 30px;margin-left: 10px;padding-bottom: 20px; line-height: 24px; border-left: 2px dashed #DEDEDE; color:rgba(153,153,153,1);\">"+remark+"</div>"; |
|
|
|
} |
|
|
|
taskListHtml += "</div>"; |
|
|
|
} |
|
|
|
msgReplaceMap.put("taskList", taskListHtml); |
|
|
|
MailMsg mailMsg = new MailMsg(); |
|
|
|
mailMsg.setSubject("代办通知"); |
|
|
|
mailMsg.setHtml(true); |
|
|
|
mailMsg.setMsgType(EnumMsgRecordType.EMAIL.getCode()); |
|
|
|
mailMsg.setModelId(EnumMailMsgModel.MAIL_ASSIGNEE_NODIFY.getCode()); |
|
|
|
mailMsg.setTo(new String[]{email}); |
|
|
|
mailMsg.setTenantId(tenantId); |
|
|
|
mailMsg.setDynamicContentMap(msgReplaceMap); |
|
|
|
mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); |
|
|
|
}else{ |
|
|
|
logger.info("邮件地址为空,不发邮件,phone:{},userName:{}",phone,userName); |
|
|
|
} |
|
|
|
msgReplaceMap.put("taskList", taskListHtml); |
|
|
|
MailMsg mailMsg = new MailMsg(); |
|
|
|
mailMsg.setSubject("代办通知"); |
|
|
|
mailMsg.setHtml(true); |
|
|
|
mailMsg.setMsgType(EnumMsgRecordType.EMAIL.getCode()); |
|
|
|
mailMsg.setModelId(EnumMailMsgModel.MAIL_ASSIGNEE_NODIFY.getCode()); |
|
|
|
mailMsg.setTo(new String[]{email}); |
|
|
|
mailMsg.setTenantId(tenantId); |
|
|
|
mailMsg.setDynamicContentMap(msgReplaceMap); |
|
|
|
mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); |
|
|
|
} |
|
|
|
|
|
|
|
public String variablesToJson(List<Map<String,Object>> variables){ |
|
|
|
@@ -702,9 +708,9 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
msgReplaceMap.put("contract", businessId + ""); |
|
|
|
msgReplaceMap.put("page", Constant.adminPage); |
|
|
|
msgReplaceMap.put("name",userName); |
|
|
|
msgReplaceMap.put("remark",remark); |
|
|
|
msgReplaceMap.put("remark",remark==null?"":remark); |
|
|
|
msgReplaceMap.put("linkName",userName); |
|
|
|
msgReplaceMap.put("linkPhone",userPhone); |
|
|
|
msgReplaceMap.put("linkPhone",userPhone==null?"":userPhone); |
|
|
|
MailMsg mailMsg = new MailMsg(); |
|
|
|
mailMsg.setSubject("驳回通知"); |
|
|
|
mailMsg.setHtml(true); |
|
|
|
|