|
@@ -78,8 +78,7 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
|
|
|
* @description 保存项目信息
|
|
|
* @date 2020/1/14 4:30 下午
|
|
|
*/
|
|
|
- public boolean saveProject(Contracts contracts, ContractsExtend extend) {
|
|
|
- Project project = new Project();
|
|
|
+ public boolean saveProject(Contracts contracts, ContractsExtend extend, Project project) {
|
|
|
project.setProjectName(extend.getProjectName());
|
|
|
project.setAddress(extend.getProjectAddress());
|
|
|
project.setNum(contracts.getLiftNum());
|
|
@@ -96,6 +95,7 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public RestResponse add(ContractsExtend extend) {
|
|
|
+ Project project = new Project();
|
|
|
Contracts contracts = extend.getContracts();
|
|
|
if (ObjectUtil.isEmpty(contracts.getCode())) {
|
|
|
//按当前日期时间戳自动生成合同编号
|
|
@@ -103,6 +103,7 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
|
|
|
contracts.setNextId(contractId);
|
|
|
}
|
|
|
contracts.setNextId(contracts.getCode());
|
|
|
+ contracts.setProjectId(project.getId());
|
|
|
//插入合同信息
|
|
|
int result = contractsMapper.insert(contracts);
|
|
|
if (result < 0) {
|
|
@@ -111,7 +112,7 @@ public class ContractService extends ServiceImpl<ContractsMapper, Contracts> {
|
|
|
return RestResponse.fail(MessageUtils.get("msg.add.fail"));
|
|
|
}
|
|
|
//插入项目信息
|
|
|
- boolean info = saveProject(contracts, extend);
|
|
|
+ boolean info = saveProject(contracts, extend, project);
|
|
|
if (!info) {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
return RestResponse.fail(MessageUtils.get("msg.add.fail"));
|