Browse Source

补录发起审批流,并走同一个事务

release_toaliyun_real
luozukai 7 years ago
parent
commit
cd48372303
3 changed files with 16 additions and 6 deletions
  1. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxFlowService.java
  2. +13
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java
  3. +2
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxFlowService.java View File

@@ -16,7 +16,7 @@ public interface WxFlowService {
* @param businessId * @param businessId
* @param flowType * @param flowType
*/ */
void updateBusinessStatus(Long businessId,Integer flowType,Integer contractType,Integer applyStatus);
void updateBusinessStatus(Long businessId,Integer flowType,Integer contractType,Integer applyStatus,Boolean supplement);


ResultData getTaskStatusList(Long businessId,String tenantId); ResultData getTaskStatusList(Long businessId,String tenantId);




+ 13
- 4
mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java View File

@@ -86,7 +86,7 @@ public class WxFlowServiceImpl implements WxFlowService {
* @param flowType * @param flowType
*/ */
@Override @Override
public void updateBusinessStatus(Long businessId,Integer flowType,Integer contractType,Integer applyStatus){
public void updateBusinessStatus(Long businessId,Integer flowType,Integer contractType,Integer applyStatus,Boolean supplement){
if(1 == flowType){ if(1 == flowType){
// 1租赁合同 2点位合同wx_rent_contract 3物业wx_property_contract 4点位物业合同 // 1租赁合同 2点位合同wx_rent_contract 3物业wx_property_contract 4点位物业合同
if(contractType.intValue() == 1 || contractType.intValue() == 2){ if(contractType.intValue() == 1 || contractType.intValue() == 2){
@@ -94,6 +94,11 @@ public class WxFlowServiceImpl implements WxFlowService {
rent.setId(businessId); rent.setId(businessId);
rent.setApplyStatus(applyStatus); rent.setApplyStatus(applyStatus);
wxRentContractService.updateApplyStatus(rent); wxRentContractService.updateApplyStatus(rent);

// 如果审批完成,而且是补录,修改状态
if(supplement!=null && supplement && EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) {
wxRentContractService.updateRentContractStatus(businessId);
}
}else if(contractType.intValue() == 3 || contractType.intValue() == 4){ }else if(contractType.intValue() == 3 || contractType.intValue() == 4){
WxPropertyContract wxPropertyContract = new WxPropertyContract(); WxPropertyContract wxPropertyContract = new WxPropertyContract();
wxPropertyContract.setId(businessId); wxPropertyContract.setId(businessId);
@@ -116,6 +121,7 @@ public class WxFlowServiceImpl implements WxFlowService {
Integer flowType = (Integer)params.get("businessType"); Integer flowType = (Integer)params.get("businessType");
List<Map<String,String>> taskAssignee = (List)params.get("taskAssignee"); List<Map<String,String>> taskAssignee = (List)params.get("taskAssignee");
List<Map<String,String>> variables = (List)params.get("variables"); List<Map<String,String>> variables = (List)params.get("variables");
Boolean supplement = (Boolean)params.get("supplement");


// 设置节点处理人 // 设置节点处理人
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
@@ -130,6 +136,7 @@ public class WxFlowServiceImpl implements WxFlowService {
map.put("flowType",flowType); map.put("flowType",flowType);
map.put("taskAssignee",taskAssignee); map.put("taskAssignee",taskAssignee);
map.put("variables",variables); map.put("variables",variables);
map.put("supplement",supplement);


ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(getFlowKeyByType(flowType), map); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(getFlowKeyByType(flowType), map);
logger.debug("流程启动,流程id:{}",processInstance.getId()); logger.debug("流程启动,流程id:{}",processInstance.getId());
@@ -140,7 +147,7 @@ public class WxFlowServiceImpl implements WxFlowService {
if(StringUtils.isNotBlank(str)){ if(StringUtils.isNotBlank(str)){
contractType = Integer.parseInt(str); contractType = Integer.parseInt(str);
} }
updateBusinessStatus(businessId,flowType,contractType,EnumRentContractAppStatus.APPLYING.getCode());
updateBusinessStatus(businessId,flowType,contractType,EnumRentContractAppStatus.APPLYING.getCode(),supplement);


// 保存wx_flow_record表审批记录 // 保存wx_flow_record表审批记录
WxFlowRecord wxFlowRecord = new WxFlowRecord(); WxFlowRecord wxFlowRecord = new WxFlowRecord();
@@ -359,6 +366,7 @@ public class WxFlowServiceImpl implements WxFlowService {
MallUserInfo starter = (MallUserInfo)mapInfo.get("starter"); MallUserInfo starter = (MallUserInfo)mapInfo.get("starter");
List<Map<String,String>> taskAssigneeList = (List)mapInfo.get("taskAssignee"); List<Map<String,String>> taskAssigneeList = (List)mapInfo.get("taskAssignee");
Long businessId = (Long)mapInfo.get("businessId"); Long businessId = (Long)mapInfo.get("businessId");
Boolean supplement = (Boolean)mapInfo.get("supplement");


// 判断下个节点是否有设置审批人,没有,直接通过,有,发短信通知 // 判断下个节点是否有设置审批人,没有,直接通过,有,发短信通知
if(!isEnded(processInstanceId)){ if(!isEnded(processInstanceId)){
@@ -405,7 +413,7 @@ public class WxFlowServiceImpl implements WxFlowService {
wxPropertyContractService.updatePropertyContractStatus(businessId); wxPropertyContractService.updatePropertyContractStatus(businessId);
} }
} }
updateBusinessStatus(businessId,flowType,contractType,EnumRentContractAppStatus.FINISH.getCode());
updateBusinessStatus(businessId,flowType,contractType,EnumRentContractAppStatus.FINISH.getCode(),supplement);


// 给发起人发送审批通过消息 // 给发起人发送审批通过消息
msgReplaceMap = new HashedMap(); msgReplaceMap = new HashedMap();
@@ -455,6 +463,7 @@ public class WxFlowServiceImpl implements WxFlowService {
Integer flowType = (Integer)mapInfo.get("flowType"); Integer flowType = (Integer)mapInfo.get("flowType");
MallUserInfo starter = (MallUserInfo)mapInfo.get("starter"); MallUserInfo starter = (MallUserInfo)mapInfo.get("starter");
List<Map<String,String>> variables = (List)mapInfo.get("variables"); List<Map<String,String>> variables = (List)mapInfo.get("variables");
Boolean supplement = (Boolean)mapInfo.get("supplement");


String taskName; String taskName;
String taskKey; String taskKey;
@@ -473,7 +482,7 @@ public class WxFlowServiceImpl implements WxFlowService {
if(StringUtils.isNotBlank(str)){ if(StringUtils.isNotBlank(str)){
contractType = Integer.parseInt(str); contractType = Integer.parseInt(str);
} }
updateBusinessStatus(businessId,flowType,contractType,EnumRentContractAppStatus.REJECT.getCode());
updateBusinessStatus(businessId,flowType,contractType,EnumRentContractAppStatus.REJECT.getCode(),supplement);


//保存wx_flow_record表审批记录 //保存wx_flow_record表审批记录
WxFlowRecord wxFlowRecord = new WxFlowRecord(); WxFlowRecord wxFlowRecord = new WxFlowRecord();


+ 2
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java View File

@@ -193,7 +193,8 @@ public class WxRentContractServiceImpl implements WxRentContractService {
try { try {
// 如果是补录,启动审批流 // 如果是补录,启动审批流
if(record.getMerchantId() != null && record.getFlowParams() != null){ if(record.getMerchantId() != null && record.getFlowParams() != null){
record.getFlowParams().put("businessId",record.getId());
record.getFlowParams().put("businessId",record.getId().toString());
record.getFlowParams().put("supplement",true);
wxFlowService.start(record.getFlowParams(),userId,userName,record.getTenantId()); wxFlowService.start(record.getFlowParams(),userId,userName,record.getTenantId());
} }
} catch (Exception e) { } catch (Exception e) {


Loading…
Cancel
Save