|
|
|
@@ -513,7 +513,14 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
if (EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { |
|
|
|
String remark = (String)mapInfo.get("remark"); |
|
|
|
receive.setRemark(StringUtils.trimToEmpty(receive.getRemark())+";"+remark); |
|
|
|
wxFinanceService.redSetoffReceive(receive, starterInfo); |
|
|
|
|
|
|
|
Long userId = (Long)getVariableByKey(variables, "userId"); |
|
|
|
String userName = (String)getVariableByKey(variables, "userName"); |
|
|
|
MallUserInfo mu = new MallUserInfo(); |
|
|
|
mu.updateTenantInfo(tenantEntity); |
|
|
|
mu.setId(userId); |
|
|
|
mu.setName(userName); |
|
|
|
wxFinanceService.redSetoffReceive(receive, mu); |
|
|
|
}else if (EnumRentContractAppStatus.SETBACK.getCode().intValue() == applyStatus.intValue()) { |
|
|
|
}else if(EnumRentContractAppStatus.REJECT.getCode().intValue() == applyStatus.intValue()){ |
|
|
|
String remark = (String)mapInfo.get("remark"); |
|
|
|
@@ -1104,7 +1111,7 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class}) |
|
|
|
public ResultData apply(Map<String, String> params,Long userId,String userName,TenantEntity tenantEntity) { |
|
|
|
public ResultData apply(Map<String, String> params,Long userId,String userName,MallUserInfo userInfo) { |
|
|
|
String taskId = params.get("taskId"); |
|
|
|
String processInstanceId = params.get("processInstanceId"); |
|
|
|
String remark = params.get("remark"); |
|
|
|
@@ -1138,11 +1145,11 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
wxFlowRecord.setTaskKey(taskKey); |
|
|
|
wxFlowRecord.setVariables(variablesToJson(variables)); |
|
|
|
wxFlowRecord.setStartDate(startDate); |
|
|
|
wxFlowRecord.updateTenantInfo(tenantEntity);; |
|
|
|
wxFlowRecord.updateTenantInfo(userInfo);; |
|
|
|
wxFlowRecordService.saveOrUpdate(wxFlowRecord); |
|
|
|
|
|
|
|
// 判断流程是否结束,并发送短信通知 |
|
|
|
boolean end = isEndAndSendMsg(mapInfo,taskKey,processInstanceId,tenantEntity,userName); |
|
|
|
boolean end = isEndAndSendMsg(mapInfo,taskKey,processInstanceId,userInfo,userName); |
|
|
|
|
|
|
|
//修改记录表当前状态 |
|
|
|
if(end){ |
|
|
|
@@ -1159,11 +1166,11 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
* @param processInstanceId |
|
|
|
* @param tenantEntity |
|
|
|
*/ |
|
|
|
public boolean isEndAndSendMsg(Map<String,Object> mapInfo,String taskKey,String processInstanceId,TenantEntity tenantEntity,String userName){ |
|
|
|
public boolean isEndAndSendMsg(Map<String,Object> mapInfo,String taskKey,String processInstanceId,MallUserInfo userInfo,String userName){ |
|
|
|
// 发送短信 |
|
|
|
Map<String,String> msgReplaceMap; |
|
|
|
WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); |
|
|
|
wxMsgValidationcode.updateTenantInfo(tenantEntity); |
|
|
|
wxMsgValidationcode.updateTenantInfo(userInfo); |
|
|
|
Map<String,Object> userMap = (Map<String,Object>)mapInfo.get("starter"); |
|
|
|
String businessId = mapInfo.get("businessId").toString(); |
|
|
|
String email = (String)userMap.get("email"); |
|
|
|
@@ -1189,7 +1196,7 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
List<MallUserInfo> mallUserInfoList = getUserByProcessInstanceId(processInstanceId); |
|
|
|
for (int i = 0; i < mallUserInfoList.size(); i++) { |
|
|
|
MallUserInfo mallUserInfo = mallUserInfoList.get(i); |
|
|
|
sendAssigneeMsgAndEmail(tenantEntity, mallUserInfo.getPhone(), mallUserInfo.getEmail(), userName, businessId, flowType, variables); |
|
|
|
sendAssigneeMsgAndEmail(userInfo, mallUserInfo.getPhone(), mallUserInfo.getEmail(), userName, businessId, flowType, variables); |
|
|
|
if(i == mallUserInfoList.size()-1){ |
|
|
|
assignee += mallUserInfo.getName(); |
|
|
|
}else{ |
|
|
|
@@ -1207,7 +1214,7 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); |
|
|
|
wxMsgRecord.setModelType(EnumMsgModel.FLOW_APPLY_NODIFY.getCode()); |
|
|
|
wxMsgRecord.setReceiver(userMap!=null?(String)userMap.get("phone"):""); |
|
|
|
wxMsgRecord.updateTenantInfo(tenantEntity); |
|
|
|
wxMsgRecord.updateTenantInfo(userInfo); |
|
|
|
if(isContract(flowType)){ |
|
|
|
msgReplaceMap.put("bustype","合同"); |
|
|
|
}else if(isBill(flowType)){ |
|
|
|
@@ -1215,7 +1222,7 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
msgReplaceMap.put("contract", businessId.toString()); |
|
|
|
}else if(isCoupon(flowType)){ |
|
|
|
wxMsgRecord.setModelType(EnumMsgModel.FLOW_C_APPLY_NODIFY.getCode()); |
|
|
|
WxCoupon wxCoupon = this.wxCouponMapper.selectById(Long.parseLong(businessId),tenantEntity.getTenantId()); |
|
|
|
WxCoupon wxCoupon = this.wxCouponMapper.selectById(Long.parseLong(businessId),userInfo.getTenantId()); |
|
|
|
msgReplaceMap.put("type",EnumCouponType.getEnum(wxCoupon.getType()).getMessage()); |
|
|
|
msgReplaceMap.put("name",wxCoupon.getTitle()); |
|
|
|
}else if(isSettle(flowType)){ |
|
|
|
@@ -1234,7 +1241,7 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
mailMsg.setModelType(EnumMailMsgModel.MAIL_APPLY_NODIFY.getCode()); |
|
|
|
mailMsg.setModelId(EnumMsgModelId.MAIL_MSG_FLOW.getCode()); |
|
|
|
mailMsg.setTo(new String[]{email}); |
|
|
|
mailMsg.updateTenantInfo(tenantEntity); |
|
|
|
mailMsg.updateTenantInfo(userInfo); |
|
|
|
if(isContract(flowType)){ |
|
|
|
msgReplaceMap.put("bustype","合同"); |
|
|
|
}else if(isBill(flowType)){ |
|
|
|
@@ -1242,7 +1249,7 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
msgReplaceMap.put("contract", businessId.toString()); |
|
|
|
}else if(isCoupon(flowType)){ |
|
|
|
mailMsg.setModelType(EnumMailMsgModel.MAIL_C_APPLY_NODIFY.getCode()); |
|
|
|
WxCoupon wxCoupon = this.wxCouponMapper.selectById(Long.parseLong(businessId),tenantEntity.getTenantId()); |
|
|
|
WxCoupon wxCoupon = this.wxCouponMapper.selectById(Long.parseLong(businessId),userInfo.getTenantId()); |
|
|
|
msgReplaceMap.put("type",EnumCouponType.getEnum(wxCoupon.getType()).getMessage()); |
|
|
|
msgReplaceMap.put("name",wxCoupon.getTitle()); |
|
|
|
}else if(isSettle(flowType)){ |
|
|
|
@@ -1257,10 +1264,10 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
return false; |
|
|
|
}else{ |
|
|
|
//继续递归判断 |
|
|
|
return isEndAndSendMsg(mapInfo,taskKey,processInstanceId,tenantEntity,userName); |
|
|
|
return isEndAndSendMsg(mapInfo,taskKey,processInstanceId,userInfo,userName); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
updateBusinessStatus(tenantEntity,null,mapInfo,EnumRentContractAppStatus.FINISH.getCode()); |
|
|
|
updateBusinessStatus(userInfo,userInfo,mapInfo,EnumRentContractAppStatus.FINISH.getCode()); |
|
|
|
|
|
|
|
// 给发起人发送审批通过消息 |
|
|
|
msgReplaceMap = new HashedMap(); |
|
|
|
@@ -1271,7 +1278,7 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); |
|
|
|
wxMsgRecord.setModelType(EnumMsgModel.FLOW_PASS_NODIFY.getCode()); |
|
|
|
wxMsgRecord.setReceiver(userMap!=null?(String)userMap.get("phone"):""); |
|
|
|
wxMsgRecord.updateTenantInfo(tenantEntity); |
|
|
|
wxMsgRecord.updateTenantInfo(userInfo); |
|
|
|
if(isContract(flowType)){ |
|
|
|
msgReplaceMap.put("bustype","合同"); |
|
|
|
}else if(isBill(flowType)){ |
|
|
|
@@ -1279,7 +1286,7 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
msgReplaceMap.put("contract", businessId.toString()); |
|
|
|
}else if(isCoupon(flowType)){ |
|
|
|
wxMsgRecord.setModelType(EnumMsgModel.FLOW_C_PASS_NODIFY.getCode()); |
|
|
|
WxCoupon wxCoupon = this.wxCouponMapper.selectById(Long.parseLong(businessId),tenantEntity.getTenantId()); |
|
|
|
WxCoupon wxCoupon = this.wxCouponMapper.selectById(Long.parseLong(businessId),userInfo.getTenantId()); |
|
|
|
msgReplaceMap.put("type",EnumCouponType.getEnum(wxCoupon.getType()).getMessage()); |
|
|
|
msgReplaceMap.put("name",wxCoupon.getTitle()); |
|
|
|
}else if(isSettle(flowType)){ |
|
|
|
@@ -1298,7 +1305,7 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
mailMsg.setModelType(EnumMailMsgModel.MAIL_PASS_NODIFY.getCode()); |
|
|
|
mailMsg.setModelId(EnumMsgModelId.MAIL_MSG_FLOW.getCode()); |
|
|
|
mailMsg.setTo(new String[]{email}); |
|
|
|
mailMsg.updateTenantInfo(tenantEntity); |
|
|
|
mailMsg.updateTenantInfo(userInfo); |
|
|
|
if(isContract(flowType)){ |
|
|
|
msgReplaceMap.put("bustype","合同"); |
|
|
|
}else if(isBill(flowType)){ |
|
|
|
@@ -1306,7 +1313,7 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
msgReplaceMap.put("contract", businessId.toString()); |
|
|
|
}else if(isCoupon(flowType)){ |
|
|
|
mailMsg.setModelType(EnumMailMsgModel.MAIL_C_PASS_NODIFY.getCode()); |
|
|
|
WxCoupon wxCoupon = this.wxCouponMapper.selectById(Long.parseLong(businessId),tenantEntity.getTenantId()); |
|
|
|
WxCoupon wxCoupon = this.wxCouponMapper.selectById(Long.parseLong(businessId),userInfo.getTenantId()); |
|
|
|
msgReplaceMap.put("type",EnumCouponType.getEnum(wxCoupon.getType()).getMessage()); |
|
|
|
msgReplaceMap.put("name",wxCoupon.getTitle()); |
|
|
|
}else if(isSettle(flowType)){ |
|
|
|
|