diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java index 6dedf1d2c..cd4316a0e 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFinanceController.java @@ -487,6 +487,16 @@ public class WxFinanceController extends BaseController { cashierTypeMap.put("value",String.valueOf(receive.getType())); variablesList.add(cashierTypeMap); + Map userIdMap = new HashMap(); + userIdMap.put("key","userId"); + userIdMap.put("value",user.getId()); + variablesList.add(userIdMap); + + Map userNameMap = new HashMap(); + userNameMap.put("key","userName"); + userNameMap.put("value",user.getName()); + variablesList.add(userNameMap); + map.put("variables", variablesList); record.setFlowParams(map); wxFlowService.start(record.getFlowParams(), user.getId(), user.getName(), receive); diff --git a/mallinkService/src/main/java/com/iformall/service/WxFlowService.java b/mallinkService/src/main/java/com/iformall/service/WxFlowService.java index 9c6a3dd6f..7cc0a6827 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxFlowService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxFlowService.java @@ -63,7 +63,7 @@ public interface WxFlowService { * @param params * @return */ - ResultData apply(@RequestBody Map params,Long userId,String userName,TenantEntity tenantEntity); + ResultData apply(@RequestBody Map params,Long userId,String userName,MallUserInfo user); /** * 驳回 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java index 0b1efc1f3..d46044743 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -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 params,Long userId,String userName,TenantEntity tenantEntity) { + public ResultData apply(Map 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 mapInfo,String taskKey,String processInstanceId,TenantEntity tenantEntity,String userName){ + public boolean isEndAndSendMsg(Map mapInfo,String taskKey,String processInstanceId,MallUserInfo userInfo,String userName){ // 发送短信 Map msgReplaceMap; WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); - wxMsgValidationcode.updateTenantInfo(tenantEntity); + wxMsgValidationcode.updateTenantInfo(userInfo); Map userMap = (Map)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 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)){