mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-06-19 15:01:59 +08:00
[feat] 新增合同管理的流程管理 新增合同历史管理
This commit is contained in:
parent
4c2024a149
commit
48250cd100
@ -47,6 +47,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode EXT_CONTRACT_NOT_EXISTS = new ErrorCode(2_026_000_000, "外部合同不存在");
|
||||
|
||||
ErrorCode EXT_CONTRACT_EXISTS = new ErrorCode(2_026_001_000, "外部合同已经存在");
|
||||
ErrorCode EXT_CONTRACT_OCCUPIED = new ErrorCode(2_026_002_000, "外部合同已经被占用");
|
||||
|
||||
// ========== 历史外部合同信息 2_027_000_000 ==========
|
||||
ErrorCode EXT_CONTRACT_HISTORY_NOT_EXISTS = new ErrorCode(2_027_000_000, "历史外部合同不存在");
|
||||
|
@ -3,8 +3,10 @@ package cn.iocoder.yudao.module.cms.controller.admin.contract;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.file.FileUtils;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contract.vo.ContractPageReqVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contract.vo.ContractProcessInstanceRespVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contract.vo.ContractRespVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contract.vo.ContractSaveReqVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractProcessInstanceRespVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contract.ContractDetailDO;
|
||||
import cn.iocoder.yudao.module.cms.service.contract.ContractService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -100,5 +102,20 @@ public class ContractController {
|
||||
BeanUtils.toBean(list, ContractRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/create_process")
|
||||
@Operation(summary = "创建流程")
|
||||
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:create')")
|
||||
public CommonResult<String> createExtContractProcess(@RequestParam("id") Long id) {
|
||||
String processId = contractService.createProcess(getLoginUserId(), id);
|
||||
return success(processId);
|
||||
}
|
||||
|
||||
@PostMapping("/get_process")
|
||||
@Operation(summary = "查询流程")
|
||||
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:create')")
|
||||
public CommonResult<ContractProcessInstanceRespVO> getExtContractProcessInstance(@RequestParam("id") Long id) {
|
||||
ContractProcessInstanceRespVO process = contractService.getProcess(id);
|
||||
return success(process);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.contract.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 外部合同 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ContractProcessInstanceRespVO {
|
||||
|
||||
|
||||
@Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||
private String processName;
|
||||
|
||||
@Schema(description = "流程实例的状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer processStatus; // 参见 BpmProcessInstanceStatusEnum 枚举
|
||||
|
||||
@Schema(description = "发起时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime endTime;
|
||||
|
||||
@Schema(description = "持续时间", example = "1000")
|
||||
private Long durationInMillis;
|
||||
|
||||
/**
|
||||
* 发起流程的用户
|
||||
*/
|
||||
private User startUser;
|
||||
|
||||
/**
|
||||
* 当前审批中的任务
|
||||
*/
|
||||
private List<Task> tasks; // 仅在流程实例分页才返回
|
||||
|
||||
@Schema(description = "用户信息")
|
||||
@Data
|
||||
public static class User {
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long deptId;
|
||||
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "研发部")
|
||||
private String deptName;
|
||||
|
||||
}
|
||||
|
||||
@Schema(description = "流程任务")
|
||||
@Data
|
||||
public static class Task {
|
||||
|
||||
@Schema(description = "流程任务的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||
private String name;
|
||||
|
||||
}
|
||||
}
|
@ -29,31 +29,6 @@ public class ContractSaveReqVO {
|
||||
@ExcelProperty("合同id")
|
||||
private Long extContractId;
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
|
||||
@ExcelProperty("项目编号")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "主控部门", requiredMode = Schema.RequiredMode.REQUIRED, example = "生产一部")
|
||||
@ExcelProperty("主控部门")
|
||||
private String trackingDep;
|
||||
|
||||
@Schema(description = "项目负责人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("项目负责人")
|
||||
private String projectManager;
|
||||
|
||||
@Schema(description = "预计合同金额", requiredMode = Schema.RequiredMode.REQUIRED,example = "200.0000")
|
||||
@ExcelProperty("预计合同金额")
|
||||
private BigDecimal expectedContractAmount;
|
||||
|
||||
@Schema(description = "合同商议提示")
|
||||
@ExcelProperty("合同商议提示")
|
||||
private LocalDateTime reminderTime;
|
||||
|
||||
@Schema(description = "出图公司", requiredMode = Schema.RequiredMode.REQUIRED,example = "***设计院")
|
||||
@ExcelProperty("出图公司")
|
||||
private String drawingCompany;
|
||||
|
||||
|
||||
|
||||
|
||||
@Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
|
@ -1,45 +1,35 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.contractHistory.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.module.cms.enums.DictTypeConstants;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
@Schema(description = "管理后台 - 历史合同分页 Request VO")
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 合同历史管理分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ContractHistoryPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "合同编号")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "项目id", example = "12689")
|
||||
private Long projectId;
|
||||
|
||||
@Schema(description = "流程实体id", example = "12536")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "合同名称", example = "芋艿")
|
||||
@Schema(description = "合同名称", example = "王五")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "合同类型", example = "2")
|
||||
@DictFormat(DictTypeConstants.CONTRACT_TYPE)
|
||||
@Schema(description = "合同类型", example = "1")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "合同进展")
|
||||
private String progress;
|
||||
|
||||
@Schema(description = "合同状态", example = "1")
|
||||
@DictFormat(DictTypeConstants.CONTRACT_STATUS)
|
||||
@Schema(description = "合同状态", example = "2")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "计费方式")
|
||||
@DictFormat(DictTypeConstants.CONTRACT_TYPE)
|
||||
private String countType;
|
||||
|
||||
@Schema(description = "流程状态", example = "2")
|
||||
@DictFormat(DictTypeConstants.PROCESS_STATUS)
|
||||
private String processStatus;
|
||||
private Integer processStatus;
|
||||
|
||||
|
||||
}
|
@ -1,19 +1,32 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.contractHistory.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.module.cms.enums.DictTypeConstants;
|
||||
import cn.iocoder.yudao.framework.common.pojo.FileDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
|
||||
@Schema(description = "管理后台 - 历史合同 Response VO")
|
||||
@Schema(description = "管理后台 - 合同历史管理 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ContractHistoryRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "30774")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12689")
|
||||
@ExcelProperty("项目id")
|
||||
private Long projectId;
|
||||
|
||||
|
||||
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
|
||||
@ExcelProperty("项目编号")
|
||||
private String code;
|
||||
@ -22,39 +35,36 @@ public class ContractHistoryRespVO {
|
||||
@ExcelProperty("主控部门")
|
||||
private String trackingDep;
|
||||
|
||||
@Schema(description = "项目经理", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("项目经理")
|
||||
@Schema(description = "项目负责人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("项目负责人")
|
||||
private String projectManager;
|
||||
|
||||
@Schema(description = "分包合同提示时间")
|
||||
@ExcelProperty("分包合同提示时间")
|
||||
private LocalDateTime ReminderTime;
|
||||
|
||||
@Schema(description = "暂定结算数")
|
||||
@ExcelProperty("暂定结算数")
|
||||
private BigDecimal provisionalSettlement;
|
||||
|
||||
@Schema(description = "出图公司", requiredMode = Schema.RequiredMode.REQUIRED,example = "***设计院")
|
||||
@ExcelProperty("出图公司")
|
||||
private String drawingCompany;
|
||||
|
||||
@Schema(description = "预计合同金额", requiredMode = Schema.RequiredMode.REQUIRED,example = "200.0000")
|
||||
@ExcelProperty("预计合同金额")
|
||||
private BigDecimal expectedContractAmount;
|
||||
|
||||
@Schema(description = "合同商议提示")
|
||||
@ExcelProperty("合同商议提示")
|
||||
private LocalDateTime reminderTime;
|
||||
|
||||
@Schema(description = "出图公司", requiredMode = Schema.RequiredMode.REQUIRED,example = "***设计院")
|
||||
@ExcelProperty("出图公司")
|
||||
private String drawingCompany;
|
||||
|
||||
|
||||
@Schema(description = "流程实体id", example = "12536")
|
||||
|
||||
|
||||
@Schema(description = "流程实体id", example = "29652")
|
||||
@ExcelProperty("流程实体id")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
@Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@ExcelProperty("合同名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "合同类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("合同类型")
|
||||
@DictFormat(DictTypeConstants.CONTRACT_TYPE)
|
||||
@Schema(description = "合同类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty(value = "合同类型", converter = DictConvert.class)
|
||||
@DictFormat("contract_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String type;
|
||||
|
||||
@Schema(description = "合同进展", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ -77,37 +87,29 @@ public class ContractHistoryRespVO {
|
||||
@ExcelProperty("归档时间")
|
||||
private LocalDateTime archiveTime;
|
||||
|
||||
@Schema(description = "合同状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("合同状态")
|
||||
@DictFormat(DictTypeConstants.CONTRACT_STATUS)
|
||||
@Schema(description = "合同状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty(value = "合同状态", converter = DictConvert.class)
|
||||
@DictFormat("contract_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String status;
|
||||
|
||||
@Schema(description = "计费方式", example = "2")
|
||||
@ExcelProperty("计费方式")
|
||||
@DictFormat(DictTypeConstants.CONTRACT_TYPE)
|
||||
@ExcelProperty(value = "计费方式", converter = DictConvert.class)
|
||||
@DictFormat("contract_billing_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String countType;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "合同url", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("合同url")
|
||||
private String contractFileUrl;
|
||||
private List<FileDTO> contractFileUrl;
|
||||
|
||||
@Schema(description = "建安费")
|
||||
@ExcelProperty("建安费")
|
||||
private BigDecimal constructionCost;
|
||||
|
||||
@Schema(description = "资金来源")
|
||||
@ExcelProperty("资金来源")
|
||||
@DictFormat(DictTypeConstants.SOURCE)
|
||||
@ExcelProperty(value = "资金来源", converter = DictConvert.class)
|
||||
@DictFormat("funds_source") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String source;
|
||||
|
||||
@Schema(description = "优惠", example = "18154")
|
||||
@ExcelProperty("优惠")
|
||||
private String discount;
|
||||
|
||||
@Schema(description = "是否联合体")
|
||||
@ExcelProperty("是否联合体")
|
||||
private Boolean consortium;
|
||||
@ -116,54 +118,73 @@ public class ContractHistoryRespVO {
|
||||
@ExcelProperty("联合体单位")
|
||||
private String consortiumCompany;
|
||||
|
||||
@Schema(description = "占主合同比例")
|
||||
@ExcelProperty("占主合同比例")
|
||||
private String extProportion;
|
||||
|
||||
@Schema(description = "审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("审定金额")
|
||||
private BigDecimal approvedAmount;
|
||||
|
||||
@Schema(description = "审核文件url", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("审核文件url")
|
||||
private String reviewFileUrl;
|
||||
private List<FileDTO> reviewFileUrl;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "更新者")
|
||||
@ExcelProperty("更新者")
|
||||
private String updater;
|
||||
|
||||
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "是否删除", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("是否删除")
|
||||
private Boolean deleted;
|
||||
|
||||
@Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24897")
|
||||
@ExcelProperty("租户编号")
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(description = "签订合同总额")
|
||||
@ExcelProperty("签订合同总额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "前期费")
|
||||
@ExcelProperty("前期费")
|
||||
private BigDecimal preAmount;
|
||||
|
||||
@Schema(description = "设计费")
|
||||
@ExcelProperty("设计费")
|
||||
private BigDecimal designAmount;
|
||||
|
||||
@Schema(description = "勘测费")
|
||||
@ExcelProperty("勘测费")
|
||||
private BigDecimal surveyFees;
|
||||
|
||||
@Schema(description = "测量费")
|
||||
@ExcelProperty("测量费")
|
||||
private BigDecimal measurementFee;
|
||||
|
||||
@Schema(description = "其他费")
|
||||
@ExcelProperty("其他费")
|
||||
private BigDecimal otherFee;
|
||||
|
||||
@Schema(description = "合同", example = "20704")
|
||||
@ExcelProperty("合同")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "流程状态", example = "2")
|
||||
@ExcelProperty("流程状态")
|
||||
@DictFormat(DictTypeConstants.PROCESS_STATUS)
|
||||
private String processStatus;
|
||||
@ExcelProperty(value = "流程状态", converter = DictConvert.class)
|
||||
@DictFormat("bpm_process_instance_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private Integer processStatus;
|
||||
|
||||
@Schema(description = "版本")
|
||||
@ExcelProperty("版本")
|
||||
private String version;
|
||||
|
||||
@Schema(description = "暂定结算数")
|
||||
@ExcelProperty("暂定结算数")
|
||||
private BigDecimal provisionalSettlement;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "优惠", example = "27337")
|
||||
@ExcelProperty("优惠")
|
||||
private BigDecimal discount;
|
||||
|
||||
@Schema(description = "占主合同比例")
|
||||
@ExcelProperty("占主合同比例")
|
||||
private BigDecimal extProportion;
|
||||
|
||||
@Schema(description = "最后编辑人")
|
||||
@ExcelProperty("最后编辑人")
|
||||
private String finalEditor;
|
||||
|
||||
@Schema(description = "合同", requiredMode = Schema.RequiredMode.REQUIRED, example = "24519")
|
||||
@ExcelProperty("合同")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "外部合同id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13441")
|
||||
@ExcelProperty("外部合同id")
|
||||
private Long extContractId;
|
||||
|
||||
}
|
@ -1,31 +1,112 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.contractHistory.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.module.cms.enums.DictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import cn.iocoder.yudao.framework.common.pojo.FileDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 历史合同新增/修改 Request VO")
|
||||
@Schema(description = "管理后台 - 合同历史管理新增/修改 Request VO")
|
||||
@Data
|
||||
public class ContractHistorySaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "30774")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "流程实体id", example = "12536")
|
||||
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12689")
|
||||
@NotNull(message = "项目id不能为空")
|
||||
private Long projectId;
|
||||
|
||||
@Schema(description = "流程实体id", example = "29652")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "流程状态", example = "2")
|
||||
@DictFormat(DictTypeConstants.PROCESS_STATUS)
|
||||
private String processStatus;
|
||||
@Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "合同名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "合同", example = "20704")
|
||||
private Long contractId;
|
||||
@Schema(description = "合同类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotEmpty(message = "合同类型不能为空")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "合同进展", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "合同进展不能为空")
|
||||
private String progress;
|
||||
|
||||
@Schema(description = "合同拟定时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "合同拟定时间不能为空")
|
||||
private LocalDateTime expectedTime;
|
||||
|
||||
@Schema(description = "合同用印时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "合同用印时间不能为空")
|
||||
private LocalDateTime printingTime;
|
||||
|
||||
@Schema(description = "签订时间")
|
||||
private LocalDateTime signingTime;
|
||||
|
||||
@Schema(description = "归档时间")
|
||||
private LocalDateTime archiveTime;
|
||||
|
||||
@Schema(description = "合同状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "合同状态不能为空")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "计费方式", example = "2")
|
||||
private String countType;
|
||||
|
||||
@Schema(description = "合同url", example = "https://www.iocoder.cn")
|
||||
private List<FileDTO> contractFileUrl;
|
||||
|
||||
@Schema(description = "建安费")
|
||||
private BigDecimal constructionCost;
|
||||
|
||||
@Schema(description = "资金来源")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "是否联合体")
|
||||
private Boolean consortium;
|
||||
|
||||
@Schema(description = "联合体单位")
|
||||
private String consortiumCompany;
|
||||
|
||||
@Schema(description = "审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "审定金额不能为空")
|
||||
private BigDecimal approvedAmount;
|
||||
|
||||
@Schema(description = "审核文件url", example = "https://www.iocoder.cn")
|
||||
private List<FileDTO> reviewFileUrl;
|
||||
|
||||
@Schema(description = "签订合同总额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "流程状态", example = "2")
|
||||
private Integer processStatus;
|
||||
|
||||
@Schema(description = "版本")
|
||||
private String version;
|
||||
|
||||
@Schema(description = "暂定结算数")
|
||||
private BigDecimal provisionalSettlement;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "优惠", example = "27337")
|
||||
private BigDecimal discount;
|
||||
|
||||
@Schema(description = "占主合同比例")
|
||||
private BigDecimal extProportion;
|
||||
|
||||
@Schema(description = "最后编辑人")
|
||||
private String finalEditor;
|
||||
|
||||
@Schema(description = "合同", requiredMode = Schema.RequiredMode.REQUIRED, example = "24519")
|
||||
@NotNull(message = "合同不能为空")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "外部合同id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13441")
|
||||
@NotNull(message = "外部合同id不能为空")
|
||||
private Long extContractId;
|
||||
|
||||
}
|
@ -20,154 +20,6 @@ import java.util.Map;
|
||||
public class ExtContractProcessInstanceRespVO {
|
||||
|
||||
|
||||
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "964")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16261")
|
||||
@ExcelProperty("项目id")
|
||||
private Long projectId;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
|
||||
@ExcelProperty("项目编号")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "客户名称")
|
||||
@ExcelProperty("客户名称")
|
||||
private String constructionSide;
|
||||
|
||||
@Schema(description = "主控部门", requiredMode = Schema.RequiredMode.REQUIRED, example = "生产一部")
|
||||
@ExcelProperty("主控部门")
|
||||
private String trackingDep;
|
||||
|
||||
@Schema(description = "项目负责人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("项目负责人")
|
||||
private String projectManager;
|
||||
|
||||
@Schema(description = "外部合同商议提示时间")
|
||||
@ExcelProperty("外部合同商议提示时间")
|
||||
private LocalDateTime exReminderTime;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Schema(description = "合同名称", example = "赵六")
|
||||
@ExcelProperty("合同名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "合同类型", example = "2")
|
||||
@ExcelProperty(value = "合同类型", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.CONTRACT_TYPE)
|
||||
private String type;
|
||||
|
||||
@Schema(description = "合同进展")
|
||||
@ExcelProperty("合同进展")
|
||||
private String progress;
|
||||
|
||||
@Schema(description = "预计签订时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("预计签订时间")
|
||||
private LocalDateTime expectedTime;
|
||||
|
||||
@Schema(description = "签订时间")
|
||||
@ExcelProperty("签订时间")
|
||||
private LocalDateTime signingTime;
|
||||
|
||||
@Schema(description = "归档时间")
|
||||
@ExcelProperty("归档时间")
|
||||
private LocalDateTime archiveTime;
|
||||
|
||||
@Schema(description = "状态", example = "2")
|
||||
@ExcelProperty(value = "状态", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.CONTRACT_STATUS)
|
||||
private String status;
|
||||
|
||||
@Schema(description = "合同总金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("合同总金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "前期费用")
|
||||
@ExcelProperty("前期费用")
|
||||
private BigDecimal preAmount;
|
||||
|
||||
@Schema(description = "设计费")
|
||||
@ExcelProperty("设计费")
|
||||
private BigDecimal designFee;
|
||||
|
||||
@Schema(description = "勘测费")
|
||||
@ExcelProperty("勘测费")
|
||||
private BigDecimal surveyFees;
|
||||
|
||||
@Schema(description = "检测费")
|
||||
@ExcelProperty("检测费")
|
||||
private BigDecimal testingFee;
|
||||
|
||||
@Schema(description = "其他费")
|
||||
@ExcelProperty("其他费")
|
||||
private BigDecimal otherFee;
|
||||
|
||||
@Schema(description = "计费方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty(value = "计费方式", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.COUNT_TYPE)
|
||||
private String countType;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "合同附件url")
|
||||
@ExcelProperty("合同附件url")
|
||||
private List<FileDTO> contractFileUrl;
|
||||
|
||||
@Schema(description = "建安费")
|
||||
@ExcelProperty("建安费")
|
||||
private BigDecimal constructionCost;
|
||||
|
||||
@Schema(description = "资金来源")
|
||||
@ExcelProperty(value = "资金来源", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.SOURCE)
|
||||
private String source;
|
||||
|
||||
@Schema(description = "收费标准", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty(value = "收费标准", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.CHARGING_STANDARD)
|
||||
private String chargingStandard;
|
||||
|
||||
@Schema(description = "优惠", example = "123")
|
||||
@ExcelProperty("优惠")
|
||||
private BigDecimal discount;
|
||||
|
||||
@Schema(description = "是否联合体", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("是否联合体")
|
||||
private Boolean consortium;
|
||||
|
||||
@Schema(description = "联合体单位")
|
||||
@ExcelProperty("联合体单位")
|
||||
private String consortiumCompany;
|
||||
|
||||
@Schema(description = "合同商议提示")
|
||||
@ExcelProperty("合同商议提示")
|
||||
private LocalDateTime reminderTime;
|
||||
|
||||
@Schema(description = "审定金额")
|
||||
@ExcelProperty("审定金额")
|
||||
private BigDecimal approvedAmount;
|
||||
|
||||
@Schema(description = "审核文件url")
|
||||
@ExcelProperty("审核文件url")
|
||||
private List<FileDTO> reviewFileUrl;
|
||||
|
||||
@Schema(description = "最后编辑人")
|
||||
@ExcelProperty("最后编辑人")
|
||||
private String finalEditor;
|
||||
|
||||
|
||||
|
||||
|
||||
@Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||
private String processName;
|
||||
|
||||
|
@ -1,15 +1,24 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.dataobject.contractHistory;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 历史合同 DO
|
||||
* 合同历史管理 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@ -22,6 +31,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ContractHistoryDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ -31,30 +41,18 @@ public class ContractHistoryDO extends BaseDO {
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
private String processStatus;
|
||||
/**
|
||||
* 该合同的id
|
||||
*/
|
||||
private Long contractId;
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
private String version;
|
||||
/**
|
||||
* 流程实体id
|
||||
*/
|
||||
private String processInstanceId;
|
||||
|
||||
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 合同类型
|
||||
*
|
||||
* 枚举 {@link TODO contract_type 对应的类}
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
@ -79,26 +77,16 @@ public class ContractHistoryDO extends BaseDO {
|
||||
private LocalDateTime archiveTime;
|
||||
/**
|
||||
* 合同状态
|
||||
* 枚举 {@link cn.iocoder.yudao.module.cms.enums.DictTypeConstants}
|
||||
*
|
||||
* 枚举 {@link TODO contract_status 对应的类}
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 签订合同总额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 计费方式
|
||||
* 枚举 {@link cn.iocoder.yudao.module.cms.enums.DictTypeConstants}
|
||||
*
|
||||
* 枚举 {@link TODO contract_billing_type 对应的类}
|
||||
*/
|
||||
private String countType;
|
||||
/**
|
||||
* 暂定结算数
|
||||
*/
|
||||
private BigDecimal provisionalSettlement;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 合同url
|
||||
*/
|
||||
@ -109,12 +97,10 @@ public class ContractHistoryDO extends BaseDO {
|
||||
private BigDecimal constructionCost;
|
||||
/**
|
||||
* 资金来源
|
||||
*
|
||||
* 枚举 {@link TODO funds_source 对应的类}
|
||||
*/
|
||||
private String source;
|
||||
/**
|
||||
* 优惠
|
||||
*/
|
||||
private BigDecimal discount;
|
||||
/**
|
||||
* 是否联合体
|
||||
*/
|
||||
@ -123,10 +109,6 @@ public class ContractHistoryDO extends BaseDO {
|
||||
* 联合体单位
|
||||
*/
|
||||
private String consortiumCompany;
|
||||
/**
|
||||
* 占主合同比例
|
||||
*/
|
||||
private BigDecimal extProportion;
|
||||
/**
|
||||
* 审定金额
|
||||
*/
|
||||
@ -135,9 +117,47 @@ public class ContractHistoryDO extends BaseDO {
|
||||
* 审核文件url
|
||||
*/
|
||||
private String reviewFileUrl;
|
||||
/**
|
||||
* 签订合同总额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 流程状态
|
||||
*
|
||||
* 枚举 {@link TODO bpm_process_instance_status 对应的类}
|
||||
*/
|
||||
private Integer processStatus;
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
private String version;
|
||||
/**
|
||||
* 暂定结算数
|
||||
*/
|
||||
private BigDecimal provisionalSettlement;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 优惠
|
||||
*/
|
||||
private BigDecimal discount;
|
||||
/**
|
||||
* 占主合同比例
|
||||
*/
|
||||
private BigDecimal extProportion;
|
||||
/**
|
||||
* 最后编辑人
|
||||
*/
|
||||
private String finalEditor;
|
||||
/**
|
||||
* 合同
|
||||
*/
|
||||
private Long contractId;
|
||||
/**
|
||||
* 外部合同id
|
||||
*/
|
||||
private Long extContractId;
|
||||
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.mysql.contractHistory;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contractHistory.vo.ContractHistoryPageReqVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contractHistory.ContractHistoryDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contractHistory.vo.*;
|
||||
|
||||
/**
|
||||
* 历史合同 Mapper
|
||||
* 合同历史管理 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@ -17,15 +17,13 @@ public interface ContractHistoryMapper extends BaseMapperX<ContractHistoryDO> {
|
||||
|
||||
default PageResult<ContractHistoryDO> selectPage(ContractHistoryPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ContractHistoryDO>()
|
||||
.eqIfPresent(ContractHistoryDO::getProcessInstanceId, reqVO.getProcessInstanceId())
|
||||
.eqIfPresent(ContractHistoryDO::getProjectId, reqVO.getProjectId())
|
||||
.likeIfPresent(ContractHistoryDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ContractHistoryDO::getProjectId,reqVO.getProjectId())
|
||||
.eqIfPresent(ContractHistoryDO::getType, reqVO.getType())
|
||||
.eqIfPresent(ContractHistoryDO::getProgress, reqVO.getProgress())
|
||||
.eqIfPresent(ContractHistoryDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(ContractHistoryDO::getCountType, reqVO.getCountType())
|
||||
.eqIfPresent(ContractHistoryDO::getProcessStatus, reqVO.getProcessStatus())
|
||||
.eqIfPresent(ContractHistoryDO::getContractId, reqVO.getContractId()));
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -60,7 +60,19 @@ public interface ContractService {
|
||||
*/
|
||||
ContractDetailDO getContractDetail(Long id);
|
||||
|
||||
/**
|
||||
* 创建流程
|
||||
* @param id 合同id
|
||||
* @return
|
||||
*/
|
||||
String createProcess(Long loginUserId,Long id);
|
||||
|
||||
/**
|
||||
* 查询流程
|
||||
* @param id 合同id
|
||||
* @return
|
||||
*/
|
||||
ContractProcessInstanceRespVO getProcess(Long id);
|
||||
|
||||
|
||||
}
|
@ -2,8 +2,13 @@ package cn.iocoder.yudao.module.cms.service.contract;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.file.FileUtils;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceGetRespDTO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contract.ContractDetailDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contractHistory.ContractHistoryDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.contract.ContractMapper;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.contractHistory.ContractHistoryMapper;
|
||||
import cn.iocoder.yudao.module.cms.service.extContract.ExtContractService;
|
||||
import cn.iocoder.yudao.module.pms.api.projectschedule.ProjectScheduleApi;
|
||||
import cn.iocoder.yudao.module.pms.api.projectschedule.dto.ProjectScheduleDetailDTO;
|
||||
@ -23,6 +28,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.PROCESS_INSTANCE_NOT_END;
|
||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS;
|
||||
|
||||
@ -35,6 +41,11 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_E
|
||||
@Validated
|
||||
public class ContractServiceImpl implements ContractService {
|
||||
|
||||
/**
|
||||
* 合同审批流程定义
|
||||
*/
|
||||
public static final String PROCESS_KEY = "contract_init";
|
||||
|
||||
@Resource
|
||||
private ContractMapper contractMapper;
|
||||
|
||||
@ -50,31 +61,67 @@ public class ContractServiceImpl implements ContractService {
|
||||
@Resource
|
||||
private ExtContractService extContractService;
|
||||
|
||||
@Resource
|
||||
private ContractHistoryMapper contractHistoryMapper;
|
||||
|
||||
@Resource
|
||||
private BpmProcessInstanceApi processInstanceApi;
|
||||
|
||||
|
||||
@Override
|
||||
public Long createContract(Long loginUserId, ContractSaveReqVO createReqVO) {
|
||||
|
||||
//先有外部 后有合同
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
if (userName == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
//校验,项目是否存在
|
||||
Long extContractId = createReqVO.getExtContractId();
|
||||
Long projectId = createReqVO.getProjectId();
|
||||
projectTrackingApi.validateProjectExists(projectId);
|
||||
//校验对应的外部合同是否存在
|
||||
extContractService.validateExtContractExists(createReqVO.getExtContractId());
|
||||
String name = createReqVO.getName();
|
||||
String trimName = name.trim();
|
||||
List<ContractDO> projectList = contractMapper.selectList("project_id", projectId);
|
||||
for (ContractDO contractDO : projectList) {
|
||||
if (contractDO.getName().equals(trimName)){
|
||||
if (contractDO.getName().equals(trimName)) {
|
||||
throw exception(CONTRACT_ALREADY_EXISTS);
|
||||
}
|
||||
}
|
||||
Long count = contractMapper.selectCount("ext_contract_id", extContractId);
|
||||
if (count > 0) {
|
||||
throw exception(EXT_CONTRACT_OCCUPIED);
|
||||
}
|
||||
|
||||
ContractDO contract = BeanUtils.toBean(createReqVO, ContractDO.class);
|
||||
contract.setReviewFileUrl(FileUtils.covertFileToJSONString(createReqVO.getReviewFileUrl()));
|
||||
contract.setContractFileUrl(FileUtils.covertFileToJSONString(createReqVO.getContractFileUrl()));
|
||||
contract.setCreator(userName);
|
||||
contract.setUpdater(userName);
|
||||
//也要插入历史
|
||||
ContractHistoryDO contractHistoryDO = BeanUtils.toBean(contract, ContractHistoryDO.class);
|
||||
contractMapper.insert(contract);
|
||||
contractHistoryDO.setExtContractId(contract.getExtContractId());
|
||||
contractHistoryDO.setContractId(contract.getId());
|
||||
//版本
|
||||
if (contractMapper.selectCount("project_id", createReqVO.getProjectId()) < 1) {
|
||||
contractHistoryDO.setVersion("1");
|
||||
} else {
|
||||
contractHistoryDO.setVersion(String.valueOf(contractHistoryMapper.selectCount("project_id", createReqVO.getProjectId()) + 1));
|
||||
}
|
||||
//状态
|
||||
contractHistoryDO.setProcessStatus(1);
|
||||
contractHistoryMapper.insert(contractHistoryDO);
|
||||
|
||||
// 启动流程
|
||||
if (createReqVO.getId() == null) {
|
||||
String processInstanceId = processInstanceApi.createProcessInstance(loginUserId,
|
||||
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||
.setBusinessKey(String.valueOf(contract.getId())));
|
||||
// 写入工作流编号
|
||||
contractHistoryMapper.updateById(contractHistoryDO.setProcessInstanceId(processInstanceId));
|
||||
}
|
||||
//返回
|
||||
return contract.getId();
|
||||
}
|
||||
@ -120,7 +167,6 @@ public class ContractServiceImpl implements ContractService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ContractDetailDO getContractDetail(Long id) {
|
||||
ContractDetailDO contractDetailDO = new ContractDetailDO();
|
||||
@ -136,12 +182,47 @@ public class ContractServiceImpl implements ContractService {
|
||||
ProjectTrackingDetailDTO projectTracking = projectTrackingApi.getProjectTracking(projectId);
|
||||
contractDetailDO.setReminderTime(extContractService.getContractDetail(extContractId).getReminderTime());
|
||||
BeanUtil.copyProperties(contractDO, contractDetailDO);
|
||||
BeanUtil.copyProperties(projectTracking,contractDetailDO);
|
||||
BeanUtil.copyProperties(projectScheduleDetail,contractDetailDO);
|
||||
BeanUtil.copyProperties(projectTracking, contractDetailDO);
|
||||
BeanUtil.copyProperties(projectScheduleDetail, contractDetailDO);
|
||||
|
||||
return contractDetailDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createProcess(Long loginUserId, Long id) {
|
||||
//拿出该合同的当前流程
|
||||
ContractHistoryDO contractHistoryDO = contractHistoryMapper.selectOne("contract_id", id);
|
||||
String processInstanceId0 = contractHistoryDO.getProcessInstanceId();
|
||||
//流程引擎里的最新状态
|
||||
Integer status = processInstanceApi.getProcessInstance(processInstanceId0).getStatus();
|
||||
if (status == 1) {
|
||||
throw exception(PROCESS_INSTANCE_NOT_END);
|
||||
}
|
||||
|
||||
//创建新的流程
|
||||
String processInstanceId = processInstanceApi.createProcessInstance(loginUserId,
|
||||
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||
.setBusinessKey(String.valueOf(id)));
|
||||
// 更新工作流编号
|
||||
contractHistoryMapper.updateById(contractHistoryDO.setProcessInstanceId(processInstanceId).setProcessStatus(status));
|
||||
|
||||
return processInstanceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContractProcessInstanceRespVO getProcess(Long id) {
|
||||
ContractHistoryDO contractHistoryDO = contractHistoryMapper.selectOne("contract_id", id);
|
||||
String processInstanceId = contractHistoryDO.getProcessInstanceId();
|
||||
BpmProcessInstanceGetRespDTO processInstance = processInstanceApi.getProcessInstance(processInstanceId);
|
||||
ContractProcessInstanceRespVO contractProcessInstanceRespVO = new ContractProcessInstanceRespVO();
|
||||
BeanUtil.copyProperties(processInstance, contractProcessInstanceRespVO);
|
||||
contractHistoryDO.setProcessStatus(processInstance.getStatus());
|
||||
|
||||
//其他具体信息可以从bpm里面调用
|
||||
|
||||
return contractProcessInstanceRespVO;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void validateContractExists(Long id) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.yudao.module.cms.service.contractHistory;
|
||||
import cn.iocoder.yudao.module.cms.enums.ContractStatusEnum;
|
||||
import cn.iocoder.yudao.module.cms.enums.ContractTypeEnum;
|
||||
import cn.iocoder.yudao.module.cms.service.extContract.ExtContractService;
|
||||
import cn.iocoder.yudao.module.pms.api.projecttracking.ProjectTrackingApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -16,7 +16,6 @@ import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 历史合同 Service 实现类
|
||||
@ -33,18 +32,22 @@ public class ContractHistoryServiceImpl implements ContractHistoryService {
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private ExtContractService extContractService;
|
||||
|
||||
@Resource
|
||||
private ProjectTrackingApi projectTrackingApi;
|
||||
|
||||
|
||||
@Override
|
||||
public void updateContractHistory(Long loginUserId,ContractHistorySaveReqVO updateReqVO) {
|
||||
//校验
|
||||
if (loginUserId == null){
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
validateContractHistoryExists(updateReqVO.getId());
|
||||
extContractService.validateExtContractExists(updateReqVO.getExtContractId());
|
||||
projectTrackingApi.validateProjectExists(updateReqVO.getProjectId());
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
// 更新
|
||||
ContractHistoryDO updateObj = BeanUtils.toBean(updateReqVO, ContractHistoryDO.class);
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
updateObj.setUpdater(userName);
|
||||
contractHistoryMapper.updateById(updateObj);
|
||||
}
|
||||
@ -52,49 +55,7 @@ public class ContractHistoryServiceImpl implements ContractHistoryService {
|
||||
|
||||
@Override
|
||||
public ContractHistoryRespVO getContractHistory(Long id) {
|
||||
//校验
|
||||
if (id == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
ContractHistoryDO contractHistoryDO = contractHistoryMapper.selectById(id);
|
||||
if (contractHistoryDO == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long projectId = contractHistoryDO.getProjectId();
|
||||
|
||||
if (projectId == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
ContractHistoryRespVO contractHistoryRespVO = BeanUtils.toBean(contractHistoryDO, ContractHistoryRespVO.class);
|
||||
|
||||
// 需要联表查询
|
||||
// 1.项目编号 pms_project 直接 √
|
||||
// 2.主控部门(跟踪部门) pms_project找到的是id 需要联表 √
|
||||
// 3.项目经理 pms_project找到的是id 需要联表 √
|
||||
// 4.出图公司 pms_project 直接 √
|
||||
// 5.预计合同金额 pms_project 直接 √
|
||||
// 6.分包合同商议提示 √
|
||||
// 7.暂定结算数 √
|
||||
|
||||
|
||||
contractHistoryRespVO.setType(ContractTypeEnum.getNoByCode(contractHistoryRespVO.getType()));
|
||||
contractHistoryRespVO.setStatus(ContractStatusEnum.getNoByCode(contractHistoryRespVO.getStatus()));
|
||||
contractHistoryRespVO.setCountType(ContractStatusEnum.getNoByCode(contractHistoryRespVO.getCountType()));
|
||||
contractHistoryRespVO.setSource(ContractStatusEnum.getNoByCode(contractHistoryRespVO.getSource()));
|
||||
|
||||
//分包合同商议提示 TODO 待优化
|
||||
// ExtContractDO extContractDO = extContractMapper.selectOne("project_id", projectId);
|
||||
// LocalDateTime reminderTime = extContractDO.getReminderTime();
|
||||
contractHistoryRespVO.setReminderTime(null);
|
||||
|
||||
//暂定结算数
|
||||
|
||||
|
||||
|
||||
return contractHistoryRespVO;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,7 +72,8 @@ public interface ExtContractService {
|
||||
/**
|
||||
* 查询流程
|
||||
* @param id 外部合同id
|
||||
* @return
|
||||
* @return 流程信息部分
|
||||
*/
|
||||
ExtContractProcessInstanceRespVO getProcess(Long id);
|
||||
|
||||
}
|
@ -202,6 +202,7 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
BeanUtil.copyProperties(processInstance, extContractProcessInstanceRespVO);
|
||||
extContractHistoryDO.setProcessStatus(processInstance.getStatus());
|
||||
|
||||
//其他具体信息可以从bpm里面调用
|
||||
|
||||
return extContractProcessInstanceRespVO;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user