Просмотр исходного кода

[审批流][修改][添加根据业务类型查询模板]

release_toaliyun_real
luozukai 7 лет назад
Родитель
Сommit
a7396410b0
10 измененных файлов: 153 добавлений и 82 удалений
  1. +5
    -3
      mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java
  2. +5
    -3
      mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java
  3. +2
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxFlowModel.java
  4. +2
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/UserTaskVo.java
  5. +37
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumFromType.java
  6. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxFlowService.java
  7. +25
    -30
      mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java
  8. +14
    -9
      mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java
  9. +61
    -34
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  10. +1
    -1
      mallinkService/src/main/resources/mapper/WxBillAllMapper.xml

+ 5
- 3
mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java Просмотреть файл

@@ -7,6 +7,7 @@ import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.MallUserInfo;
import com.iformall.domain.po.WxBillProperty;
import com.iformall.domain.po.WxPropertyContract;
import com.iformall.enums.EnumFromType;
import com.iformall.enums.EnumRentStartType;
import com.iformall.mapper.WxPropertyContractMapper;
import com.iformall.service.WxBillPropertyService;
@@ -63,7 +64,7 @@ public class WxPropertyContractController extends BaseController {
if(wxPropertyContract.getRentStartType()!=null && wxPropertyContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){
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")
@@ -80,7 +81,8 @@ public class WxPropertyContractController extends BaseController {
MallUserInfo user = getUser();
propertyContract.setTenantId(user.getTenantId());
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();
wxPropertyContract.setTenantId(user.getTenantId());
wxPropertyContract.setAdjustPeriodHandle();
return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName(),0);
return wxPropertyContractService.saveOrUpdate(wxPropertyContract, user.getId(), user.getName(),EnumFromType.OTHER.getCode());
}

@GetMapping("/del")


+ 5
- 3
mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java Просмотреть файл

@@ -10,6 +10,7 @@ import com.iformall.domain.po.WxBillRent;
import com.iformall.domain.po.WxPayAccountBill;
import com.iformall.domain.po.WxRentContract;
import com.iformall.domain.po.WxShop;
import com.iformall.enums.EnumFromType;
import com.iformall.enums.EnumRentContractAdjustPeriod;
import com.iformall.enums.EnumRentShopType;
import com.iformall.enums.EnumRentStartType;
@@ -110,7 +111,8 @@ public class WxRentContractController extends BaseController {
rentContract.setTenantId(user.getTenantId());
rentContract.setAdjustPeriodHandle();
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")
@@ -125,7 +127,7 @@ public class WxRentContractController extends BaseController {
if(wxRentContract.getRentStartType()!=null && wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){
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())){
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")


+ 2
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxFlowModel.java Просмотреть файл

@@ -42,7 +42,8 @@ public class WxFlowModel extends BaseEntity {

@io.swagger.annotations.ApiModelProperty(value="流程id",name="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
private Integer flowType;



+ 2
- 0
mallinkService/src/main/java/com/iformall/domain/vo/UserTaskVo.java Просмотреть файл

@@ -19,4 +19,6 @@ public class UserTaskVo implements Serializable{
@io.swagger.annotations.ApiModelProperty(value="节点类型,1普通 2会签 3或签",name="type")
private Integer type;

private String key;

}

+ 37
- 0
mallinkService/src/main/java/com/iformall/enums/EnumFromType.java Просмотреть файл

@@ -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;
}
}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxFlowService.java Просмотреть файл

@@ -15,7 +15,7 @@ import java.util.Map;
* 流程审批服务
*/
public interface WxFlowService {
String getFlowKeyByType(int flowType,String tenantId);
WxFlowModel getModelByType(int flowType,String tenantId);

/**
* 更新业务数据状态


+ 25
- 30
mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java Просмотреть файл

@@ -27,7 +27,6 @@ import org.flowable.bpmn.model.*;
import org.flowable.bpmn.model.Process;
import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.engine.*;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.DeploymentBuilder;
import org.flowable.engine.runtime.Execution;
import org.flowable.engine.runtime.ProcessInstance;
@@ -107,13 +106,13 @@ public class WxFlowServiceImpl implements WxFlowService {
* @param flowType
* @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;
}
@@ -365,20 +364,16 @@ public class WxFlowServiceImpl implements WxFlowService {
String remark = (String)params.get("remark");
Long businessId = Long.parseLong(params.get("businessId").toString());
Integer flowType = (Integer)params.get("businessType");
List<Map<String,String>> taskAssignee = (List)params.get("taskAssignee");
List<Map<String,Object>> variables = (List)params.get("variables");
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, "您尚未设置审批模板,请先设置。");
}

// 设置节点处理人
HashMap<String, Object> map = new HashMap<>();
for (Map<String,String> taskAssigneeMap : taskAssignee) {
map.put(taskAssigneeMap.get("taskKey"), taskAssigneeMap.get("assignee"));
}
// map info,设置发起人等信息
Date startDate = new Date();
MallUserInfo starterInfo = this.mallUserInfoService.getById(userId);
@@ -387,11 +382,11 @@ public class WxFlowServiceImpl implements WxFlowService {
map.put("startDate", startDate);
map.put("businessId",businessId+"");
map.put("flowType",flowType);
map.put("taskAssignee",taskAssignee);
map.put("variables",variables);
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());

params.put("flowType",flowType);
@@ -532,7 +527,10 @@ public class WxFlowServiceImpl implements WxFlowService {
if(StringUtils.isNotBlank(flowType)) {
List<String> definitionKeyList = new ArrayList<>();
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)){
taskQuery.processDefinitionKeyIn(definitionKeyList);
@@ -624,17 +622,15 @@ public class WxFlowServiceImpl implements WxFlowService {
}
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
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++) {
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 = "";
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.setUserName(userName.trim());
@@ -645,14 +641,12 @@ public class WxFlowServiceImpl implements WxFlowService {
if(i != taskAssigneeList.size()-1){
assignee = taskAssigneeList.get(i+1);
// 下一个节点没设置代办人
if(StringUtils.isBlank(assignee.get("assignee"))){
if(CollectionUtils.isEmpty(assignee.getUserList())){
continue;
}
assigneeArray = assignee.get("assignee").split(",");
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();
@@ -1162,6 +1156,7 @@ public class WxFlowServiceImpl implements WxFlowService {

for (int i = 0; i < wxFlowModel.getLists().size(); i++) {
UserTaskVo taskVo = wxFlowModel.getLists().get(i);
taskVo.setKey("userTask" + (i + 1));
if (i == 0) {
StartEvent start = new StartEvent();
start.setId("start");
@@ -1213,7 +1208,7 @@ public class WxFlowServiceImpl implements WxFlowService {
bpmnModel.addProcess(process);
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().addBpmnModel(process.getId()+".bpmn20.xml", bpmnModel);
//部署
Deployment deploy = deploymentBuilder.deploy();
deploymentBuilder.deploy();

wxFlowModel.setFlowId(process.getId());
wxFlowModel.setFlow(JsonUtil.obj2Json(wxFlowModel));


+ 14
- 9
mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java Просмотреть файл

@@ -332,15 +332,20 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService

//启动审批流
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);
}


+ 61
- 34
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Просмотреть файл

@@ -356,18 +356,23 @@ public class WxRentContractServiceImpl implements WxRentContractService {

// 启动审批流
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){
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);
//结束审批流 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();
if (!CollectionUtils.isEmpty(tasks)) {
for (Task task : tasks) {
@@ -1280,18 +1301,24 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
// 启动审批流
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;
}


+ 1
- 1
mallinkService/src/main/resources/mapper/WxBillAllMapper.xml Просмотреть файл

@@ -118,7 +118,7 @@
</foreach>
</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>


Загрузка…
Отмена
Сохранить