删除无用接口
添加归档接口 提交审批接口调整 合同状态校验修改 更新接口修改
This commit is contained in:
@@ -108,10 +108,10 @@ public class ContractController implements BusinessControllerMarker {
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PostMapping("/preview")
|
||||
@Operation(summary = "预览文件 TODO")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:preview')")
|
||||
public void preview() {
|
||||
@PostMapping("/cancel")
|
||||
@Operation(summary = "作废 TODO")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:cancel')")
|
||||
public void cancel() {
|
||||
}
|
||||
|
||||
// TODO
|
||||
@@ -121,17 +121,17 @@ public class ContractController implements BusinessControllerMarker {
|
||||
public void complete() {
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PostMapping("/archive")
|
||||
@Operation(summary = "归档 TODO")
|
||||
@Operation(summary = "归档")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:archive')")
|
||||
public void archive() {
|
||||
public CommonResult<Boolean> archive(@RequestBody List<Long> ids) {
|
||||
return success(contractService.archive(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/submit/approval")
|
||||
@Operation(summary = "合同提交审批")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:approval')")
|
||||
public CommonResult<String> submitApproval(@RequestParam("id") Long id) {
|
||||
public CommonResult<Boolean> submitApproval(@RequestParam("id") Long id) {
|
||||
return success(contractService.submitApproval(id));
|
||||
}
|
||||
|
||||
@@ -143,13 +143,6 @@ public class ContractController implements BusinessControllerMarker {
|
||||
return success(contractService.approval(reqVO));
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PostMapping("/view/approval")
|
||||
@Operation(summary = "查看审批 TODO")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:approval')")
|
||||
public void viewApproval() {
|
||||
}
|
||||
|
||||
@PostMapping("/submit/erp")
|
||||
@Operation(summary = "提交ERP")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:erp')")
|
||||
|
||||
@@ -162,9 +162,6 @@ public class ContractSaveReqVO {
|
||||
@Schema(description = "备注;与ERP(BZXX)对应", example = "备注")
|
||||
private String remark;
|
||||
|
||||
// 物料信息
|
||||
private List<DetailSaveReqVO> detail;
|
||||
|
||||
// 扩展信息
|
||||
@Schema(description = "原币金额-变更后;与ERP(BGHHTYBZJE)对应,拓展信息")
|
||||
private BigDecimal changeCooAmount;
|
||||
@@ -216,6 +213,9 @@ public class ContractSaveReqVO {
|
||||
@Schema(description = "模板实例主键", example = "10196")
|
||||
private Long instanceId;
|
||||
|
||||
// 物料信息
|
||||
private List<DetailSaveReqVO> detail;
|
||||
|
||||
// 合同动态表单
|
||||
private List<TemplateInstanceDataSaveReqVO> dynamicsFields;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@@ -45,7 +46,7 @@ public class FormulaSaveReqVO {
|
||||
private String elementName;
|
||||
|
||||
@Schema(description = "结算类型,多条使用逗号分隔(字典:PRCH_STLM_TP)", example = "1")
|
||||
private String settlementType;
|
||||
private JSONArray settlementType;
|
||||
|
||||
// 基础系数配置
|
||||
private List<CoefficientSaveReqVO> coefficients;
|
||||
|
||||
@@ -56,7 +56,7 @@ public interface ContractService {
|
||||
* @param id 合同ID
|
||||
* @return 提交审批结果
|
||||
*/
|
||||
String submitApproval(Long id);
|
||||
Boolean submitApproval(Long id);
|
||||
|
||||
/**
|
||||
* 合同审批
|
||||
@@ -169,4 +169,12 @@ public interface ContractService {
|
||||
* @return 压缩文件流
|
||||
*/
|
||||
ResponseEntity<ByteArrayResource> download(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 归档
|
||||
*
|
||||
* @param ids 合同ID集合
|
||||
* @return 归档结果
|
||||
*/
|
||||
Boolean archive(List<Long> ids);
|
||||
}
|
||||
|
||||
@@ -687,6 +687,17 @@ public class ContractServiceImpl implements ContractService {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 合同状态校验
|
||||
if (!(DictEnum.BSE_CTRT_STS_DRAFT.getCode().equals(oldContractMainDO.getStatus())
|
||||
|| DictEnum.BSE_CTRT_STS_REJECTED.getCode().equals(oldContractMainDO.getStatus())
|
||||
|| DictEnum.BSE_CTRT_STS_WAIT_PUSH.getCode().equals(oldContractMainDO.getStatus())
|
||||
|| DictEnum.BSE_CTRT_STS_PUSH_ERROR.getCode().equals(oldContractMainDO.getStatus())
|
||||
|| DictEnum.BSE_CTRT_STS_IN_PROGRESS.getCode().equals(oldContractMainDO.getStatus()))) {
|
||||
|
||||
throw exception(CONTRACT_STATUS_NOT_UPDATE,
|
||||
DictEnum.getByCode(oldContractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
}
|
||||
|
||||
// 校验合同名称是否重复
|
||||
ContractMainDO contract = contractMainMapper.selectOne(new QueryWrapper<ContractMainDO>()
|
||||
.eq(TableFieldConstants.BSE_CTRT_MAIN_CTRT_NAME, reqVO.getContractName())
|
||||
@@ -705,17 +716,6 @@ public class ContractServiceImpl implements ContractService {
|
||||
}
|
||||
}
|
||||
|
||||
// 合同状态校验
|
||||
if (DictEnum.BSE_CTRT_STS_DELETED.getCode().equals(oldContractMainDO.getStatus())
|
||||
|| DictEnum.BSE_CTRT_STS_ARCHIVED.getCode().equals(oldContractMainDO.getStatus())
|
||||
|| DictEnum.BSE_CTRT_STS_TERMINATED.getCode().equals(oldContractMainDO.getStatus())
|
||||
|| DictEnum.BSE_CTRT_STS_IN_PROGRESS.getCode().equals(oldContractMainDO.getStatus())
|
||||
|| DictEnum.BSE_CTRT_STS_UNDER_REVIEW.getCode().equals(oldContractMainDO.getStatus())) {
|
||||
|
||||
throw exception(CONTRACT_STATUS_NOT_UPDATE,
|
||||
DictEnum.getByCode(oldContractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
}
|
||||
|
||||
// 请求更新的合同信息
|
||||
ContractMainDO newContractMainDO = BeanUtils.toBean(reqVO, ContractMainDO.class);
|
||||
|
||||
@@ -906,6 +906,15 @@ public class ContractServiceImpl implements ContractService {
|
||||
templateInstanceDataService.setTemplateInstanceData(templateInstanceDataDOS);
|
||||
}
|
||||
|
||||
// 合同状态更新
|
||||
if (DictEnum.BSE_CTRT_STS_PUSH_ERROR.getCode().equals(oldContractMainDO.getStatus())) {
|
||||
// “推送失败”的状态编辑后状态变为“待推送”
|
||||
newContractMainDO.setStatus(DictEnum.BSE_CTRT_STS_WAIT_PUSH.getCode());
|
||||
} else if (DictEnum.BSE_CTRT_STS_REJECTED.getCode().equals(oldContractMainDO.getStatus())
|
||||
|| DictEnum.BSE_CTRT_STS_IN_PROGRESS.getCode().equals(oldContractMainDO.getStatus())) {
|
||||
newContractMainDO.setStatus(DictEnum.BSE_CTRT_STS_WAIT_AUDIT.getCode());
|
||||
}
|
||||
|
||||
// 更新合同主信息
|
||||
int updateNum = contractMainMapper.updateById(newContractMainDO);
|
||||
|
||||
@@ -990,7 +999,7 @@ public class ContractServiceImpl implements ContractService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String submitApproval(Long id) {
|
||||
public Boolean submitApproval(Long id) {
|
||||
|
||||
// 判断主键
|
||||
if (ObjectUtils.isEmpty(id)) {
|
||||
@@ -1004,11 +1013,8 @@ public class ContractServiceImpl implements ContractService {
|
||||
}
|
||||
|
||||
// 合同状态校验
|
||||
if (DictEnum.BSE_CTRT_STS_UNDER_REVIEW.getCode().equals(contractMainDO.getStatus())
|
||||
|| DictEnum.BSE_CTRT_STS_IN_PROGRESS.getCode().equals(contractMainDO.getStatus())
|
||||
|| DictEnum.BSE_CTRT_STS_TERMINATED.getCode().equals(contractMainDO.getStatus())
|
||||
|| DictEnum.BSE_CTRT_STS_ARCHIVED.getCode().equals(contractMainDO.getStatus())
|
||||
|| DictEnum.BSE_CTRT_STS_DELETED.getCode().equals(contractMainDO.getStatus())) {
|
||||
if (!(DictEnum.BSE_CTRT_STS_DRAFT.getCode().equals(contractMainDO.getStatus())
|
||||
|| DictEnum.BSE_CTRT_STS_WAIT_AUDIT.getCode().equals(contractMainDO.getStatus()))) {
|
||||
|
||||
throw exception(CONTRACT_STATUS_NOT_SUBMIT_APPROVAL,
|
||||
DictEnum.getByCode(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
@@ -1023,7 +1029,7 @@ public class ContractServiceImpl implements ContractService {
|
||||
|
||||
if (StringUtils.isNotBlank(contractMainDO.getProcessInstanceId())) {
|
||||
|
||||
// TODO:驳回状态重新提交审批处理
|
||||
// TODO:待审核状态重新提交审批处理
|
||||
// 进入审批流程的合同,查询当前审批的任务节点
|
||||
List<BpmTaskRespDTO> taskList = bpmTaskApi.getTaskListByProcessInstanceId(contractMainDO.getProcessInstanceId()).getData();
|
||||
} else {
|
||||
@@ -1044,11 +1050,11 @@ public class ContractServiceImpl implements ContractService {
|
||||
}
|
||||
contractMainDO.setStatus(DictEnum.BSE_CTRT_STS_UNDER_REVIEW.getCode());
|
||||
contractMainMapper.updateById(contractMainDO);
|
||||
return "提交审批成功";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return "提交审批失败";
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1465,6 +1471,34 @@ public class ContractServiceImpl implements ContractService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean archive(List<Long> ids) {
|
||||
|
||||
// 遍历合同ID
|
||||
ids.forEach(id -> {
|
||||
|
||||
// 查询合同是否存在
|
||||
ContractMainDO contractMainDO = contractMainMapper.selectById(id);
|
||||
if (contractMainDO == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 合同状态校验
|
||||
if (!DictEnum.BSE_CTRT_STS_TERMINATED.getCode().equals(contractMainDO.getStatus())) {
|
||||
throw exception(CONTRACT_STATUS_NOT_ARCHIVE,
|
||||
DictEnum.getByCode(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
}
|
||||
|
||||
// 设置归档状态
|
||||
contractMainDO.setStatus(DictEnum.BSE_CTRT_STS_ARCHIVED.getCode());
|
||||
|
||||
// 更新合同
|
||||
contractMainMapper.updateById(contractMainDO);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验合同内容
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user