|
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.fjhx.common.enums.FlowStatusEnum;
|
|
|
+import com.fjhx.common.utils.Assert;
|
|
|
import com.fjhx.flow.core.FlowDelegate;
|
|
|
import com.fjhx.sale.entity.contract.dto.ContractDto;
|
|
|
import com.fjhx.sale.entity.contract.po.Contract;
|
|
@@ -19,6 +20,8 @@ import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.function.Function;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -59,6 +62,19 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
throw new ServiceException("原合同id不能为空");
|
|
|
}
|
|
|
|
|
|
+ //变更 用原来合同号加后缀
|
|
|
+ Contract oldContract = contractService.getById(contract.getOldContractId());
|
|
|
+ Assert.notEmpty(oldContract, "查询不到原合同信息");
|
|
|
+ String code = oldContract.getCode();
|
|
|
+ Matcher matcher = Pattern.compile(".*\\((.*?)\\)$").matcher(code);
|
|
|
+ int index = 2;
|
|
|
+ if (matcher.find()) {
|
|
|
+ index = (Integer.parseInt(matcher.group(1)) + 1);
|
|
|
+ code = code.substring(0, code.lastIndexOf("("));
|
|
|
+ }
|
|
|
+ contract.setCode(code + "(" + index + ")");
|
|
|
+
|
|
|
+
|
|
|
List<ContractProduct> list = contractProductService.list(q -> q.eq(ContractProduct::getContractId, oldContractId));
|
|
|
|
|
|
// 赋值待处理数量
|