|
@@ -14,6 +14,7 @@ import cn.com.xwy.boot.web.dto.RestResponse;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -84,6 +85,7 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
|
|
|
project.setNum(contracts.getLiftNum());
|
|
|
project.setStartDate(contracts.getStarDate());
|
|
|
project.setEndDate(contracts.getEndDate());
|
|
|
+ project.setMtCompanyId(contracts.getMtCompanyId());
|
|
|
return projectService.saveProject(project);
|
|
|
}
|
|
|
|
|
@@ -96,13 +98,13 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public RestResponse add(ContractsExtend extend) {
|
|
|
Project project = new Project();
|
|
|
+ project.setId(IdWorker.getId());
|
|
|
Contracts contracts = extend.getContracts();
|
|
|
if (ObjectUtil.isEmpty(contracts.getCode())) {
|
|
|
//按当前日期时间戳自动生成合同编号
|
|
|
String contractId = DateUtils.generateCode();
|
|
|
- contracts.setNextId(contractId);
|
|
|
+ contracts.setCode(contractId);
|
|
|
}
|
|
|
- contracts.setNextId(contracts.getCode());
|
|
|
contracts.setProjectId(project.getId());
|
|
|
//插入合同信息
|
|
|
int result = contractsMapper.insert(contracts);
|
|
@@ -118,7 +120,7 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
|
|
|
return RestResponse.fail(MessageUtils.get("msg.add.fail"));
|
|
|
}
|
|
|
//批量插入收款信息
|
|
|
- boolean ret = paymentService.insertBatch(extend.getPaymentList(), contracts.getNextId());
|
|
|
+ boolean ret = paymentService.insertBatch(extend.getPaymentList(), contracts.getCode());
|
|
|
if (!ret) {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return RestResponse.fail(MessageUtils.get("msg.add.batch.fail"));
|