| @@ -7,6 +7,7 @@ import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.WxBillProperty; | import com.iformall.domain.po.WxBillProperty; | ||||
| import com.iformall.domain.po.WxPropertyContract; | import com.iformall.domain.po.WxPropertyContract; | ||||
| import com.iformall.enums.EnumFromType; | |||||
| import com.iformall.enums.EnumRentStartType; | import com.iformall.enums.EnumRentStartType; | ||||
| import com.iformall.mapper.WxPropertyContractMapper; | import com.iformall.mapper.WxPropertyContractMapper; | ||||
| import com.iformall.service.WxBillPropertyService; | import com.iformall.service.WxBillPropertyService; | ||||
| @@ -63,7 +64,7 @@ public class WxPropertyContractController extends BaseController { | |||||
| if(wxPropertyContract.getRentStartType()!=null && wxPropertyContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | if(wxPropertyContract.getRentStartType()!=null && wxPropertyContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | ||||
| wxPropertyContract.setRentalStartDate(wxPropertyContract.getStartDate()); | wxPropertyContract.setRentalStartDate(wxPropertyContract.getStartDate()); | ||||
| } | } | ||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName(),0); | |||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName(), EnumFromType.OTHER.getCode()); | |||||
| } | } | ||||
| @PostMapping("updateRentStartTime") | @PostMapping("updateRentStartTime") | ||||
| @@ -80,7 +81,8 @@ public class WxPropertyContractController extends BaseController { | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| propertyContract.setTenantId(user.getTenantId()); | propertyContract.setTenantId(user.getTenantId()); | ||||
| propertyContract.setAdjustPeriodHandle(); | propertyContract.setAdjustPeriodHandle(); | ||||
| return wxPropertyContractService.saveOrUpdate(propertyContract, user.getId(), user.getName(),1); | |||||
| propertyContract.setRentStartType(wxPropertyContract.getRentStartType()); | |||||
| return wxPropertyContractService.saveOrUpdate(propertyContract, user.getId(), user.getName(),EnumFromType.SWITCH.getCode()); | |||||
| } | } | ||||
| @@ -91,7 +93,7 @@ public class WxPropertyContractController extends BaseController { | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxPropertyContract.setTenantId(user.getTenantId()); | wxPropertyContract.setTenantId(user.getTenantId()); | ||||
| wxPropertyContract.setAdjustPeriodHandle(); | wxPropertyContract.setAdjustPeriodHandle(); | ||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName(),0); | |||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName(),EnumFromType.OTHER.getCode()); | |||||
| } | } | ||||
| @GetMapping("/del") | @GetMapping("/del") | ||||
| @@ -10,6 +10,7 @@ import com.iformall.domain.po.WxBillRent; | |||||
| import com.iformall.domain.po.WxPayAccountBill; | import com.iformall.domain.po.WxPayAccountBill; | ||||
| import com.iformall.domain.po.WxRentContract; | import com.iformall.domain.po.WxRentContract; | ||||
| import com.iformall.domain.po.WxShop; | import com.iformall.domain.po.WxShop; | ||||
| import com.iformall.enums.EnumFromType; | |||||
| import com.iformall.enums.EnumRentContractAdjustPeriod; | import com.iformall.enums.EnumRentContractAdjustPeriod; | ||||
| import com.iformall.enums.EnumRentShopType; | import com.iformall.enums.EnumRentShopType; | ||||
| import com.iformall.enums.EnumRentStartType; | import com.iformall.enums.EnumRentStartType; | ||||
| @@ -110,7 +111,8 @@ public class WxRentContractController extends BaseController { | |||||
| rentContract.setTenantId(user.getTenantId()); | rentContract.setTenantId(user.getTenantId()); | ||||
| rentContract.setAdjustPeriodHandle(); | rentContract.setAdjustPeriodHandle(); | ||||
| rentContract.setRentPriceHandle(); | rentContract.setRentPriceHandle(); | ||||
| return wxRentContractService.update(rentContract, user.getId(),user.getName(),1,oldDate); | |||||
| rentContract.setRentStartType(wxRentContract.getRentStartType()); | |||||
| return wxRentContractService.update(rentContract, user.getId(),user.getName(), EnumFromType.SWITCH.getCode(),oldDate); | |||||
| } | } | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| @@ -125,7 +127,7 @@ public class WxRentContractController extends BaseController { | |||||
| if(wxRentContract.getRentStartType()!=null && wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | if(wxRentContract.getRentStartType()!=null && wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | ||||
| wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | ||||
| } | } | ||||
| return wxRentContractService.update(wxRentContract, user.getId(),user.getName(),0,oldDate); | |||||
| return wxRentContractService.update(wxRentContract, user.getId(),user.getName(),EnumFromType.OTHER.getCode(),oldDate); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -145,7 +147,7 @@ public class WxRentContractController extends BaseController { | |||||
| if(wxRentContract.getRentStartType()!=null &&wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | if(wxRentContract.getRentStartType()!=null &&wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | ||||
| wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | ||||
| } | } | ||||
| return wxRentContractService.update(wxRentContract, user.getId(),user.getName(),0,oldDate); | |||||
| return wxRentContractService.update(wxRentContract, user.getId(),user.getName(),EnumFromType.OTHER.getCode(),oldDate); | |||||
| } | } | ||||
| @PostMapping("updateFile") | @PostMapping("updateFile") | ||||
| @@ -42,7 +42,8 @@ public class WxFlowModel extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="流程id",name="flowId") | @io.swagger.annotations.ApiModelProperty(value="流程id",name="flowId") | ||||
| private String flowId; | private String flowId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="流程类型4商铺签约5多径签约6商铺终止7多径终止8账单变更9有价卷上架",name="flowId") | |||||
| @io.swagger.annotations.ApiModelProperty(value="流程类型4商铺签约5多径签约6商铺终止7多径终止8账单变更9有价卷上架",name="flowType") | |||||
| @Transient | @Transient | ||||
| private Integer flowType; | private Integer flowType; | ||||
| @@ -19,4 +19,6 @@ public class UserTaskVo implements Serializable{ | |||||
| @io.swagger.annotations.ApiModelProperty(value="节点类型,1普通 2会签 3或签",name="type") | @io.swagger.annotations.ApiModelProperty(value="节点类型,1普通 2会签 3或签",name="type") | ||||
| private Integer type; | private Integer type; | ||||
| private String key; | |||||
| } | } | ||||
| @@ -0,0 +1,37 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumFromType { | |||||
| SWITCH(1, "切换计租开始日期"), | |||||
| OTHER(0, "其他"), | |||||
| ; | |||||
| public static EnumFromType getEnum(Integer code) { | |||||
| for (EnumFromType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumFromType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -15,7 +15,7 @@ import java.util.Map; | |||||
| * 流程审批服务 | * 流程审批服务 | ||||
| */ | */ | ||||
| public interface WxFlowService { | public interface WxFlowService { | ||||
| String getFlowKeyByType(int flowType,String tenantId); | |||||
| WxFlowModel getModelByType(int flowType,String tenantId); | |||||
| /** | /** | ||||
| * 更新业务数据状态 | * 更新业务数据状态 | ||||
| @@ -27,7 +27,6 @@ import org.flowable.bpmn.model.*; | |||||
| import org.flowable.bpmn.model.Process; | import org.flowable.bpmn.model.Process; | ||||
| import org.flowable.common.engine.api.FlowableIllegalArgumentException; | import org.flowable.common.engine.api.FlowableIllegalArgumentException; | ||||
| import org.flowable.engine.*; | import org.flowable.engine.*; | ||||
| import org.flowable.engine.repository.Deployment; | |||||
| import org.flowable.engine.repository.DeploymentBuilder; | import org.flowable.engine.repository.DeploymentBuilder; | ||||
| import org.flowable.engine.runtime.Execution; | import org.flowable.engine.runtime.Execution; | ||||
| import org.flowable.engine.runtime.ProcessInstance; | import org.flowable.engine.runtime.ProcessInstance; | ||||
| @@ -107,13 +106,13 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| * @param flowType | * @param flowType | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| public String getFlowKeyByType(int flowType,String tenantId){ | |||||
| WxFlowConfig query = new WxFlowConfig(); | |||||
| query.setTenantId(tenantId); | |||||
| query.setType(flowType); | |||||
| List<WxFlowConfig> configList = wxFlowConfigMapper.findList(query); | |||||
| if(CollectionUtils.isNotEmpty(configList)){ | |||||
| return configList.get(0).getWxFlowModel().getFlowId(); | |||||
| public WxFlowModel getModelByType(int flowType,String tenantId){ | |||||
| WxFlowModel model = new WxFlowModel(); | |||||
| model.setTenantId(tenantId); | |||||
| model.setFlowType(flowType); | |||||
| List<WxFlowModel> list = getModelBybusiness(model); | |||||
| if(CollectionUtils.isNotEmpty(list)){ | |||||
| return list.get(0); | |||||
| } | } | ||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -365,20 +364,16 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| String remark = (String)params.get("remark"); | String remark = (String)params.get("remark"); | ||||
| Long businessId = Long.parseLong(params.get("businessId").toString()); | Long businessId = Long.parseLong(params.get("businessId").toString()); | ||||
| Integer flowType = (Integer)params.get("businessType"); | Integer flowType = (Integer)params.get("businessType"); | ||||
| List<Map<String,String>> taskAssignee = (List)params.get("taskAssignee"); | |||||
| List<Map<String,Object>> variables = (List)params.get("variables"); | List<Map<String,Object>> variables = (List)params.get("variables"); | ||||
| Boolean supplement = (Boolean)params.get("supplement"); | Boolean supplement = (Boolean)params.get("supplement"); | ||||
| String flowKey = getFlowKeyByType(flowType,tenantId); | |||||
| if(StringUtils.isBlank(flowKey)){ | |||||
| WxFlowModel flowModel = getModelByType(flowType,tenantId); | |||||
| if(StringUtils.isBlank(flowModel.getFlowId())){ | |||||
| return new ResultData(ResultData.ERROR, "您尚未设置审批模板,请先设置。"); | return new ResultData(ResultData.ERROR, "您尚未设置审批模板,请先设置。"); | ||||
| } | } | ||||
| // 设置节点处理人 | // 设置节点处理人 | ||||
| HashMap<String, Object> map = new HashMap<>(); | HashMap<String, Object> map = new HashMap<>(); | ||||
| for (Map<String,String> taskAssigneeMap : taskAssignee) { | |||||
| map.put(taskAssigneeMap.get("taskKey"), taskAssigneeMap.get("assignee")); | |||||
| } | |||||
| // map info,设置发起人等信息 | // map info,设置发起人等信息 | ||||
| Date startDate = new Date(); | Date startDate = new Date(); | ||||
| MallUserInfo starterInfo = this.mallUserInfoService.getById(userId); | MallUserInfo starterInfo = this.mallUserInfoService.getById(userId); | ||||
| @@ -387,11 +382,11 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| map.put("startDate", startDate); | map.put("startDate", startDate); | ||||
| map.put("businessId",businessId+""); | map.put("businessId",businessId+""); | ||||
| map.put("flowType",flowType); | map.put("flowType",flowType); | ||||
| map.put("taskAssignee",taskAssignee); | |||||
| map.put("variables",variables); | map.put("variables",variables); | ||||
| map.put("supplement",supplement); | map.put("supplement",supplement); | ||||
| map.put("taskAssignee",flowModel.getLists()); | |||||
| ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(flowKey, map); | |||||
| ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(flowModel.getFlowId(), map); | |||||
| logger.debug("流程启动,流程id:{}",processInstance.getId()); | logger.debug("流程启动,流程id:{}",processInstance.getId()); | ||||
| params.put("flowType",flowType); | params.put("flowType",flowType); | ||||
| @@ -532,7 +527,10 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| if(StringUtils.isNotBlank(flowType)) { | if(StringUtils.isNotBlank(flowType)) { | ||||
| List<String> definitionKeyList = new ArrayList<>(); | List<String> definitionKeyList = new ArrayList<>(); | ||||
| for (String ft : flowType.split(",")) { | for (String ft : flowType.split(",")) { | ||||
| definitionKeyList.add(getFlowKeyByType(Integer.parseInt(ft),tenantId)); | |||||
| WxFlowModel flowModel = getModelByType(Integer.parseInt(ft),tenantId); | |||||
| if(flowModel!=null) { | |||||
| definitionKeyList.add(flowModel.getFlowId()); | |||||
| } | |||||
| } | } | ||||
| if(CollectionUtils.isNotEmpty(definitionKeyList)){ | if(CollectionUtils.isNotEmpty(definitionKeyList)){ | ||||
| taskQuery.processDefinitionKeyIn(definitionKeyList); | taskQuery.processDefinitionKeyIn(definitionKeyList); | ||||
| @@ -624,17 +622,15 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| } | } | ||||
| Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); | Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); | ||||
| Map<String,Object> mapInfo = taskService.getVariables(task.getId()); | Map<String,Object> mapInfo = taskService.getVariables(task.getId()); | ||||
| List<Map<String,String>> taskAssigneeList = (List)mapInfo.get("taskAssignee"); | |||||
| List<UserTaskVo> taskAssigneeList = (List)mapInfo.get("taskAssignee"); | |||||
| for (int i = 0; i < taskAssigneeList.size(); i++) { | for (int i = 0; i < taskAssigneeList.size(); i++) { | ||||
| Map<String,String> assignee = taskAssigneeList.get(i); | |||||
| if(task.getTaskDefinitionKey().equals(assignee.get("taskKey"))){ | |||||
| UserTaskVo assignee = taskAssigneeList.get(i); | |||||
| if(task.getTaskDefinitionKey().equals(assignee.getKey())){ | |||||
| //设置当前节点代办人信息 | //设置当前节点代办人信息 | ||||
| String[] assigneeArray = assignee.get("assignee").split(","); | |||||
| String userName = ""; | String userName = ""; | ||||
| for (String userid:assigneeArray) { | |||||
| MallUserInfo mallUserInfo = this.mallUserInfoService.getById(Long.parseLong(userid)); | |||||
| userName += mallUserInfo.getName()+" "; | |||||
| for (FlowUserVo userVo:assignee.getUserList()) { | |||||
| userName += userVo.getName()+" "; | |||||
| } | } | ||||
| WxFlowRecord wxFlowRecord = new WxFlowRecord(); | WxFlowRecord wxFlowRecord = new WxFlowRecord(); | ||||
| wxFlowRecord.setUserName(userName.trim()); | wxFlowRecord.setUserName(userName.trim()); | ||||
| @@ -645,14 +641,12 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| if(i != taskAssigneeList.size()-1){ | if(i != taskAssigneeList.size()-1){ | ||||
| assignee = taskAssigneeList.get(i+1); | assignee = taskAssigneeList.get(i+1); | ||||
| // 下一个节点没设置代办人 | // 下一个节点没设置代办人 | ||||
| if(StringUtils.isBlank(assignee.get("assignee"))){ | |||||
| if(CollectionUtils.isEmpty(assignee.getUserList())){ | |||||
| continue; | continue; | ||||
| } | } | ||||
| assigneeArray = assignee.get("assignee").split(","); | |||||
| userName = ""; | userName = ""; | ||||
| for (String userid:assigneeArray) { | |||||
| MallUserInfo mallUserInfo = this.mallUserInfoService.getById(Long.parseLong(userid)); | |||||
| userName += mallUserInfo.getName()+" "; | |||||
| for (FlowUserVo userVo:assignee.getUserList()) { | |||||
| userName += userVo.getName()+" "; | |||||
| } | } | ||||
| wxFlowRecord = new WxFlowRecord(); | wxFlowRecord = new WxFlowRecord(); | ||||
| @@ -1162,6 +1156,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| for (int i = 0; i < wxFlowModel.getLists().size(); i++) { | for (int i = 0; i < wxFlowModel.getLists().size(); i++) { | ||||
| UserTaskVo taskVo = wxFlowModel.getLists().get(i); | UserTaskVo taskVo = wxFlowModel.getLists().get(i); | ||||
| taskVo.setKey("userTask" + (i + 1)); | |||||
| if (i == 0) { | if (i == 0) { | ||||
| StartEvent start = new StartEvent(); | StartEvent start = new StartEvent(); | ||||
| start.setId("start"); | start.setId("start"); | ||||
| @@ -1213,7 +1208,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| bpmnModel.addProcess(process); | bpmnModel.addProcess(process); | ||||
| DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().addBpmnModel(process.getId()+".bpmn20.xml", bpmnModel); | DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().addBpmnModel(process.getId()+".bpmn20.xml", bpmnModel); | ||||
| //部署 | //部署 | ||||
| Deployment deploy = deploymentBuilder.deploy(); | |||||
| deploymentBuilder.deploy(); | |||||
| wxFlowModel.setFlowId(process.getId()); | wxFlowModel.setFlowId(process.getId()); | ||||
| wxFlowModel.setFlow(JsonUtil.obj2Json(wxFlowModel)); | wxFlowModel.setFlow(JsonUtil.obj2Json(wxFlowModel)); | ||||
| @@ -332,15 +332,20 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| //启动审批流 | //启动审批流 | ||||
| if(!CollectionUtils.isEmpty(record.getFlowParams())) { | if(!CollectionUtils.isEmpty(record.getFlowParams())) { | ||||
| record.getFlowParams().put("businessId", record.getId().toString()); | |||||
| wxFlowService.start(record.getFlowParams(), userId, userName, record.getTenantId()); | |||||
| // 合同状态改成待签约 | |||||
| WxPropertyContract updateRentContract = new WxPropertyContract(); | |||||
| updateRentContract.setId(record.getId()); | |||||
| updateRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||||
| wxPropertyContractMapper.updateStatus(updateRentContract); | |||||
| logger.info("id:{},启动审批流成功",record.getId().toString()); | |||||
| Integer flowType = (Integer)record.getFlowParams().get("businessType"); | |||||
| if(wxFlowService.getModelByType(flowType.intValue(),record.getTenantId()) == null){ | |||||
| updatePropertyContractStatus(record.getId()); | |||||
| }else{ | |||||
| record.getFlowParams().put("businessId", record.getId().toString()); | |||||
| wxFlowService.start(record.getFlowParams(), userId, userName, record.getTenantId()); | |||||
| // 合同状态改成待签约 | |||||
| WxPropertyContract updateRentContract = new WxPropertyContract(); | |||||
| updateRentContract.setId(record.getId()); | |||||
| updateRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||||
| wxPropertyContractMapper.updateStatus(updateRentContract); | |||||
| logger.info("id:{},启动审批流成功",record.getId().toString()); | |||||
| } | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, message, record); | return new ResultData(Result.SUCCESS, message, record); | ||||
| } | } | ||||
| @@ -356,18 +356,23 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| // 启动审批流 | // 启动审批流 | ||||
| if(record.getFlowParams() != null){ | if(record.getFlowParams() != null){ | ||||
| record.getFlowParams().put("businessId",record.getId().toString()); | |||||
| if(record.getMerchantId() != null) { | |||||
| record.getFlowParams().put("supplement", true); //设置补录 | |||||
| Integer flowType = (Integer)record.getFlowParams().get("businessType"); | |||||
| if(wxFlowService.getModelByType(flowType.intValue(),record.getTenantId()) == null){ | |||||
| updateRentContractStatus(record.getId()); | |||||
| }else{ | |||||
| record.getFlowParams().put("businessId",record.getId().toString()); | |||||
| if(record.getMerchantId() != null) { | |||||
| record.getFlowParams().put("supplement", true); //设置补录 | |||||
| } | |||||
| wxFlowService.start(record.getFlowParams(),userId,userName,record.getTenantId()); | |||||
| // 合同状态改成待签约 | |||||
| WxRentContract updateRentContract = new WxRentContract(); | |||||
| updateRentContract.setId(record.getId()); | |||||
| updateRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||||
| wxRentContractMapper.updateStatus(updateRentContract); | |||||
| logger.info("id:{},启动审批流成功, 是否补录:{}",record.getId().toString(),record.getMerchantId() != null); | |||||
| } | } | ||||
| wxFlowService.start(record.getFlowParams(),userId,userName,record.getTenantId()); | |||||
| // 合同状态改成待签约 | |||||
| WxRentContract updateRentContract = new WxRentContract(); | |||||
| updateRentContract.setId(record.getId()); | |||||
| updateRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||||
| wxRentContractMapper.updateStatus(updateRentContract); | |||||
| logger.info("id:{},启动审批流成功, 是否补录:{}",record.getId().toString(),record.getMerchantId() != null); | |||||
| } | } | ||||
| //生成预览账单(补录第二步,第三步走编辑) | //生成预览账单(补录第二步,第三步走编辑) | ||||
| @@ -408,18 +413,23 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| //启动审批流 | //启动审批流 | ||||
| if(record.getFlowParams() != null){ | if(record.getFlowParams() != null){ | ||||
| record.getFlowParams().put("businessId",record.getId().toString()); | |||||
| if(record.getMerchantId() != null) { | |||||
| record.getFlowParams().put("supplement", true); //设置补录 | |||||
| Integer flowType = (Integer)record.getFlowParams().get("businessType"); | |||||
| if(wxFlowService.getModelByType(flowType.intValue(),record.getTenantId()) == null){ | |||||
| updateRentContractStatus(record.getId()); | |||||
| }else{ | |||||
| record.getFlowParams().put("businessId",record.getId().toString()); | |||||
| if(record.getMerchantId() != null) { | |||||
| record.getFlowParams().put("supplement", true); //设置补录 | |||||
| } | |||||
| wxFlowService.start(record.getFlowParams(),userId,userName,record.getTenantId()); | |||||
| //合同状态改成待签约 | |||||
| WxRentContract updateRentContract = new WxRentContract(); | |||||
| updateRentContract.setId(record.getId()); | |||||
| updateRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||||
| wxRentContractMapper.updateStatus(updateRentContract); | |||||
| logger.info("id:{},启动审批流成功 ,是否补录:{}",record.getId().toString(),record.getMerchantId() != null); | |||||
| } | } | ||||
| wxFlowService.start(record.getFlowParams(),userId,userName,record.getTenantId()); | |||||
| //合同状态改成待签约 | |||||
| WxRentContract updateRentContract = new WxRentContract(); | |||||
| updateRentContract.setId(record.getId()); | |||||
| updateRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||||
| wxRentContractMapper.updateStatus(updateRentContract); | |||||
| logger.info("id:{},启动审批流成功 ,是否补录:{}",record.getId().toString(),record.getMerchantId() != null); | |||||
| } | } | ||||
| // 保存调整金额(预账单调整) | // 保存调整金额(预账单调整) | ||||
| @@ -694,7 +704,18 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| logger.info("合同id:{},开始停止...", id); | logger.info("合同id:{},开始停止...", id); | ||||
| //结束审批流 by luozukai | //结束审批流 by luozukai | ||||
| List<Task> tasks = taskService.createTaskQuery().processDefinitionKey(wxFlowService.getFlowKeyByType(EnumFlowKey.CONTRACT.getCode().intValue(),record.getTenantId())) | |||||
| WxFlowModel flowModel = wxFlowService.getModelByType(EnumFlowKey.NEW_RENT_CONTRACT.getCode().intValue(),record.getTenantId()); | |||||
| WxFlowModel flowModelPoint = wxFlowService.getModelByType(EnumFlowKey.NEW_SHOP_CONTRACT.getCode().intValue(),record.getTenantId()); | |||||
| List<String> keyList = new ArrayList<>(); | |||||
| if(flowModel != null){ | |||||
| keyList.add(flowModel.getFlowId()); | |||||
| } | |||||
| if(flowModelPoint != null){ | |||||
| keyList.add(flowModelPoint.getFlowId()); | |||||
| } | |||||
| keyList.add(EnumFlowKey.CONTRACT.getMessage()); | |||||
| List<Task> tasks = taskService.createTaskQuery() | |||||
| .processDefinitionKeyIn(keyList) | |||||
| .processVariableValueEquals("businessId", id+"").list(); | .processVariableValueEquals("businessId", id+"").list(); | ||||
| if (!CollectionUtils.isEmpty(tasks)) { | if (!CollectionUtils.isEmpty(tasks)) { | ||||
| for (Task task : tasks) { | for (Task task : tasks) { | ||||
| @@ -1280,18 +1301,24 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| // 启动审批流 | // 启动审批流 | ||||
| if(record.getFlowParams() != null){ | if(record.getFlowParams() != null){ | ||||
| record.getFlowParams().put("businessId",record.getId().toString()); | |||||
| if(record.getMerchantId() != null) { | |||||
| record.getFlowParams().put("supplement", true); //设置补录 | |||||
| //判断是否配置模板 | |||||
| Integer flowType = (Integer)record.getFlowParams().get("businessType"); | |||||
| if(wxFlowService.getModelByType(flowType.intValue(),record.getTenantId())==null){ | |||||
| updateRentContractStatus(record.getId()); | |||||
| }else{ | |||||
| record.getFlowParams().put("businessId",record.getId().toString()); | |||||
| if(record.getMerchantId() != null) { | |||||
| record.getFlowParams().put("supplement", true); //设置补录 | |||||
| } | |||||
| wxFlowService.start(record.getFlowParams(),userId,userName,record.getTenantId()); | |||||
| // 合同状态改成待签约 | |||||
| WxRentContract updateRentContract = new WxRentContract(); | |||||
| updateRentContract.setId(record.getId()); | |||||
| updateRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||||
| wxRentContractMapper.updateStatus(updateRentContract); | |||||
| logger.info("id:{},启动审批流成功,是否补录:{}",record.getId().toString(),record.getMerchantId() != null); | |||||
| } | } | ||||
| wxFlowService.start(record.getFlowParams(),userId,userName,record.getTenantId()); | |||||
| // 合同状态改成待签约 | |||||
| WxRentContract updateRentContract = new WxRentContract(); | |||||
| updateRentContract.setId(record.getId()); | |||||
| updateRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); | |||||
| wxRentContractMapper.updateStatus(updateRentContract); | |||||
| logger.info("id:{},启动审批流成功,是否补录:{}",record.getId().toString(),record.getMerchantId() != null); | |||||
| } | } | ||||
| return resultData; | return resultData; | ||||
| } | } | ||||
| @@ -118,7 +118,7 @@ | |||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| <if test=" null == sortColumns"> order by bill.id desc,bill.merchant_id,bill.status,bill.receive_date desc </if> | |||||
| <if test=" null == sortColumns"> order by bill.receive_date,bill.id desc,bill.merchant_id,bill.status</if> | |||||
| </select> | </select> | ||||