[feat] 新增外部合同的流程管理

This commit is contained in:
wyw 2024-08-19 14:59:21 +08:00
parent 5091059610
commit b80f413c06
22 changed files with 231 additions and 343 deletions

View File

@ -11,17 +11,15 @@ import lombok.Getter;
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum ProcessStatusEnum { public enum ProcessStatusEnum {
//未执行 RUNNING(1, "审批中"),
NO_EXECUTION("0","no_execution"), APPROVE(2, "审批通过"),
//正在执行 REJECT(3, "审批不通过"),
EXECUTING("1","executing"), CANCEL(4, "已取消");
//执行完成
COMPLETED("2","completed");
/** /**
* 类型编号 * 类型编号
*/ */
private final String code; private final Integer code;
/** /**
* 类型编码 * 类型编码
*/ */
@ -32,7 +30,7 @@ public enum ProcessStatusEnum {
* @param code 字典编号 * @param code 字典编号
* @return 类型编码 * @return 类型编码
*/ */
public static String getNoByCode(String code) { public static String getNoByCode(Integer code) {
for (ProcessStatusEnum value : values()) { for (ProcessStatusEnum value : values()) {
if (value.getCode().equals(code)) { if (value.getCode().equals(code)) {
return value.getNo(); return value.getNo();

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.cms.controller.admin.contract.vo;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.module.cms.enums.DictTypeConstants; import cn.iocoder.yudao.module.cms.enums.DictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*; import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
@ -27,4 +28,8 @@ public class ContractPageReqVO extends PageParam {
@Schema(description = "计费方式", example = "1") @Schema(description = "计费方式", example = "1")
@DictFormat(DictTypeConstants.COUNT_TYPE) @DictFormat(DictTypeConstants.COUNT_TYPE)
private String countType; private String countType;
@Schema(description = "外部合同id", example = "13085")
@ExcelProperty("合同id")
private Long extContractId;
} }

View File

@ -29,7 +29,9 @@ public class ContractRespVO {
@ExcelProperty("项目id") @ExcelProperty("项目id")
private Long projectId; private Long projectId;
@Schema(description = "外部合同id", example = "13085")
@ExcelProperty("合同id")
private Long extContractId;
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001") @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")

View File

@ -25,7 +25,9 @@ public class ContractSaveReqVO {
@ExcelProperty("项目id") @ExcelProperty("项目id")
private Long projectId; private Long projectId;
@Schema(description = "外部合同id", example = "13085")
@ExcelProperty("合同id")
private Long extContractId;
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001") @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
@ExcelProperty("项目编号") @ExcelProperty("项目编号")

View File

@ -14,129 +14,10 @@ import java.time.LocalDateTime;
@Data @Data
public class ContractHistorySaveReqVO { public class ContractHistorySaveReqVO {
@Schema(description = "历史合同编号", requiredMode = Schema.RequiredMode.REQUIRED)
private Long id;
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
private Long projectId;
@Schema(description = "流程实体id", example = "12536") @Schema(description = "流程实体id", example = "12536")
private String processInstanceId; private String processInstanceId;
@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 = "分包合同提示时间")
@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 = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@NotEmpty(message = "合同名称不能为空")
private String name;
@Schema(description = "合同类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotEmpty(message = "合同类型不能为空")
@DictFormat(DictTypeConstants.CONTRACT_TYPE)
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 = "1")
@NotEmpty(message = "合同状态不能为空")
@DictFormat(DictTypeConstants.CONTRACT_STATUS)
private String status;
@Schema(description = "计费方式", example = "2")
@DictFormat(DictTypeConstants.CONTRACT_TYPE)
private String countType;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "合同url", example = "https://www.iocoder.cn")
private String contractFileUrl;
@Schema(description = "建安费")
private BigDecimal constructionCost;
@Schema(description = "资金来源")
@DictFormat(DictTypeConstants.SOURCE)
private String source;
@Schema(description = "优惠", example = "18154")
private String discount;
@Schema(description = "是否联合体")
private Boolean consortium;
@Schema(description = "联合体单位")
private String consortiumCompany;
@Schema(description = "占主合同比例")
private String extProportion;
@Schema(description = "审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "审定金额不能为空")
private BigDecimal approvedAmount;
@Schema(description = "审核文件url", example = "https://www.iocoder.cn")
private String reviewFileUrl;
@Schema(description = "签订合同总额")
private BigDecimal amount;
@Schema(description = "前期费")
private BigDecimal preAmount;
@Schema(description = "设计费")
private BigDecimal designAmount;
@Schema(description = "勘测费")
private BigDecimal surveyFees;
@Schema(description = "测量费")
private BigDecimal measurementFee;
@Schema(description = "其他费")
private BigDecimal otherFee;
@Schema(description = "流程状态", example = "2") @Schema(description = "流程状态", example = "2")
@DictFormat(DictTypeConstants.PROCESS_STATUS) @DictFormat(DictTypeConstants.PROCESS_STATUS)
private String processStatus; private String processStatus;

View File

@ -28,7 +28,4 @@ public class ExtContractPageReqVO extends PageParam {
@DictFormat(DictTypeConstants.CONTRACT_STATUS) @DictFormat(DictTypeConstants.CONTRACT_STATUS)
private String status; private String status;
@Schema(description = "合同id", example = "27460")
private Long contractId;
} }

View File

@ -21,10 +21,6 @@ public class ExtContractRespVO {
@ExcelProperty("主键") @ExcelProperty("主键")
private Long id; private Long id;
@Schema(description = "合同id", example = "13085")
@ExcelProperty("合同id")
private Long contractId;
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16261") @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16261")
@ExcelProperty("项目id") @ExcelProperty("项目id")
private Long projectId; private Long projectId;

View File

@ -20,10 +20,6 @@ public class ExtContractSaveReqVO {
@ExcelProperty("主键") @ExcelProperty("主键")
private Long id; private Long id;
@Schema(description = "合同id", example = "13085")
@ExcelProperty("合同id")
private Long contractId;
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16261") @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16261")
@ExcelProperty("项目id") @ExcelProperty("项目id")
private Long projectId; private Long projectId;

View File

@ -34,8 +34,6 @@ import cn.iocoder.yudao.module.cms.service.extcontracthistory.ExtContractHistory
@Validated @Validated
public class ExtContractHistoryController { public class ExtContractHistoryController {
@Resource @Resource
private ExtContractHistoryService extContractHistoryService; private ExtContractHistoryService extContractHistoryService;

View File

@ -24,20 +24,13 @@ public class ExtContractHistoryPageReqVO extends PageParam {
@DictFormat(DictTypeConstants.CONTRACT_TYPE) @DictFormat(DictTypeConstants.CONTRACT_TYPE)
private String type; private String type;
@Schema(description = "客户公司id", example = "28989")
private Long customerCompanyId;
@Schema(description = "状态", example = "1") @Schema(description = "状态", example = "1")
@DictFormat(DictTypeConstants.CONTRACT_STATUS) @DictFormat(DictTypeConstants.CONTRACT_STATUS)
private String status; private String status;
@Schema(description = "流程实体id", example = "8911")
private String processInstanceId;
@Schema(description = "流程状态", example = "2") @Schema(description = "流程状态", example = "2")
@DictFormat(DictTypeConstants.PROCESS_STATUS) @DictFormat(DictTypeConstants.PROCESS_STATUS)
private String processStatus; private Integer processStatus;
@Schema(description = "合同id", example = "26795") @Schema(description = "合同id", example = "26795")
private Long contractId; private Long contractId;

View File

@ -1,11 +1,14 @@
package cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory.vo; package cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory.vo;
import cn.iocoder.yudao.framework.common.pojo.FileDTO;
import cn.iocoder.yudao.module.cms.enums.DictTypeConstants; import cn.iocoder.yudao.module.cms.enums.DictTypeConstants;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import com.alibaba.excel.annotation.*; import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@ -16,46 +19,45 @@ import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
public class ExtContractHistoryRespVO { public class ExtContractHistoryRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "324")
@ExcelProperty("主键")
private Long id;
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "409")
@ExcelProperty("项目id")
private Long projectId;
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001") @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
@ExcelProperty("项目编号") @ExcelProperty("项目编号")
private String code; private String code;
@Schema(description = "客户名称") @Schema(description = "客户名称")
@ExcelProperty("客户名称") @ExcelProperty("客户名称")
private String customerCompanyName; private String constructionSide;
@Schema(description = "主控部门", requiredMode = Schema.RequiredMode.REQUIRED, example = "生产一部") @Schema(description = "主控部门", requiredMode = Schema.RequiredMode.REQUIRED, example = "生产一部")
@ExcelProperty("主控部门") @ExcelProperty("主控部门")
private String trackingDep; private String trackingDep;
@Schema(description = "项目经理", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "项目负责人", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("项目经理") @ExcelProperty("项目负责人")
private String projectManager; private String projectManager;
@Schema(description = "合同提示时间") @Schema(description = "外部合同商议提示时间")
@ExcelProperty("合同提示时间") @ExcelProperty("外部合同商议提示时间")
private LocalDateTime exReminderTime; private LocalDateTime exReminderTime;
@Schema(description = "客户公司id", example = "28989")
@ExcelProperty("客户公司id")
private Long customerCompanyId;
@Schema(description = "合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("合同金额")
private BigDecimal amount;
@Schema(description = "合同名称", example = "张三") @Schema(description = "合同名称", example = "张三")
@ExcelProperty("合同名称") @ExcelProperty("合同名称")
private String name; private String name;
@Schema(description = "合同类型", example = "1") @Schema(description = "合同类型", example = "2")
@ExcelProperty("合同类型") @ExcelProperty("合同类型")
@DictFormat(DictTypeConstants.CONTRACT_TYPE)
private String type; private String type;
@Schema(description = "合同进展") @Schema(description = "合同进展")
@ExcelProperty("合同进展") @ExcelProperty("合同进展")
private String progress; private String progress;
@ -72,12 +74,14 @@ public class ExtContractHistoryRespVO {
@ExcelProperty("归档时间") @ExcelProperty("归档时间")
private LocalDateTime archiveTime; private LocalDateTime archiveTime;
@Schema(description = "状态", example = "1") @Schema(description = "状态", example = "2")
@ExcelProperty("状态") @ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(DictTypeConstants.CONTRACT_STATUS) @DictFormat(DictTypeConstants.CONTRACT_STATUS)
private String status; private String status;
@Schema(description = "合同总金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("合同总金额")
private BigDecimal amount;
@Schema(description = "前期费用") @Schema(description = "前期费用")
@ExcelProperty("前期费用") @ExcelProperty("前期费用")
@ -97,20 +101,19 @@ public class ExtContractHistoryRespVO {
@Schema(description = "其他费") @Schema(description = "其他费")
@ExcelProperty("其他费") @ExcelProperty("其他费")
private String otherFee; private BigDecimal otherFee;
@Schema(description = "计费方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") @Schema(description = "计费方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "计费方式", converter = DictConvert.class) @ExcelProperty("计费方式")
@DictFormat(DictTypeConstants.COUNT_TYPE)
private String countType; private String countType;
@Schema(description = "备注", example = "你猜") @Schema(description = "备注", example = "随便")
@ExcelProperty("备注") @ExcelProperty("备注")
private String remark; private String remark;
@Schema(description = "合同附件url", example = "https://www.iocoder.cn") @Schema(description = "合同附件url", example = "https://www.iocoder.cn")
@ExcelProperty("合同附件url") @ExcelProperty("合同附件url")
private String contractFileUrl; private List<FileDTO> contractFileUrl;
@Schema(description = "建安费") @Schema(description = "建安费")
@ExcelProperty("建安费") @ExcelProperty("建安费")
@ -118,17 +121,17 @@ public class ExtContractHistoryRespVO {
@Schema(description = "资金来源") @Schema(description = "资金来源")
@ExcelProperty(value = "资金来源", converter = DictConvert.class) @ExcelProperty(value = "资金来源", converter = DictConvert.class)
@DictFormat(DictTypeConstants.COUNT_TYPE) @DictFormat(DictTypeConstants.SOURCE)
private String source; private String source;
@Schema(description = "收费标准", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "收费标准", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("收费标准") @ExcelProperty(value = "收费标准", converter = DictConvert.class)
@DictFormat(DictTypeConstants.CHARGING_STANDARD) @DictFormat(DictTypeConstants.CHARGING_STANDARD)
private String chargingStandard; private String chargingStandard;
@Schema(description = "优惠", example = "7511") @Schema(description = "优惠", example = "28322")
@ExcelProperty("优惠") @ExcelProperty("优惠")
private String discount; private BigDecimal discount;
@Schema(description = "是否联合体", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "是否联合体", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("是否联合体") @ExcelProperty("是否联合体")
@ -138,8 +141,8 @@ public class ExtContractHistoryRespVO {
@ExcelProperty("联合体单位") @ExcelProperty("联合体单位")
private String consortiumCompany; private String consortiumCompany;
@Schema(description = "合同提示时间") @Schema(description = "合同商议提示")
@ExcelProperty("合同提示时间") @ExcelProperty("合同商议提示")
private LocalDateTime reminderTime; private LocalDateTime reminderTime;
@Schema(description = "审定金额") @Schema(description = "审定金额")
@ -148,22 +151,22 @@ public class ExtContractHistoryRespVO {
@Schema(description = "审核文件url", example = "https://www.iocoder.cn") @Schema(description = "审核文件url", example = "https://www.iocoder.cn")
@ExcelProperty("审核文件url") @ExcelProperty("审核文件url")
private String reviewFileUrl; private List<FileDTO> reviewFileUrl;
@Schema(description = "流程实体id", example = "8911") @Schema(description = "最后编辑人")
@ExcelProperty("最后编辑人")
private String finalEditor;
@Schema(description = "流程实体id", example = "24870")
@ExcelProperty("流程实体id") @ExcelProperty("流程实体id")
private String processInstanceId; private String processInstanceId;
@Schema(description = "流程状态", example = "2") @Schema(description = "流程状态", example = "2")
@ExcelProperty(value = "流程状态", converter = DictConvert.class) @ExcelProperty(value = "流程状态", converter = DictConvert.class)
@DictFormat(DictTypeConstants.PROCESS_STATUS) @DictFormat(DictTypeConstants.PROCESS_STATUS)
private String processStatus; private Integer processStatus;
@Schema(description = "合同id", example = "26795") @Schema(description = "外部合同id", example = "1808")
@ExcelProperty("合同id")
private Long contractId;
@Schema(description = "外部合同id", example = "12093")
@ExcelProperty("外部合同id") @ExcelProperty("外部合同id")
private Long extContractId; private Long extContractId;

View File

@ -1,153 +1,149 @@
package cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory.vo; package cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory.vo;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.cms.enums.DictTypeConstants; import cn.iocoder.yudao.module.cms.enums.DictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Schema(description = "管理后台 - 外部合同新增/修改 Request VO") @Schema(description = "管理后台 - 外部合同新增/修改 Request VO")
@Data @Data
public class ExtContractHistorySaveReqVO { public class ExtContractHistorySaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "17790") @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "324")
@ExcelProperty("主键")
private Long id; private Long id;
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6935") @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "409")
@NotNull(message = "项目id不能为空") @ExcelProperty("项目id")
private Long projectId; private Long projectId;
@Schema(description = "流程实体id", example = "8911")
private String processInstanceId;
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
@ExcelProperty("项目编号")
private String code;
@Schema(description = "客户名称")
@ExcelProperty("客户名称")
private String customerCompanyName;
@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 = "客户公司id", example = "28989")
private Long customerCompanyId;
@Schema(description = "合同名称", example = "张三") @Schema(description = "合同名称", example = "张三")
@ExcelProperty("合同名称")
private String name; private String name;
@Schema(description = "合同类型", example = "1") @Schema(description = "合同类型", example = "2")
@DictFormat(DictTypeConstants.CONTRACT_TYPE) @ExcelProperty("合同类型")
private String type; private String type;
@Schema(description = "合同进展") @Schema(description = "合同进展")
@ExcelProperty("合同进展")
private String progress; private String progress;
@Schema(description = "预计签订时间", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "预计签订时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "预计签订时间不能为空") @ExcelProperty("预计签订时间")
private LocalDateTime expectedTime; private LocalDateTime expectedTime;
@Schema(description = "签订时间") @Schema(description = "签订时间")
@ExcelProperty("签订时间")
private LocalDateTime signingTime; private LocalDateTime signingTime;
@Schema(description = "归档时间") @Schema(description = "归档时间")
@ExcelProperty("归档时间")
private LocalDateTime archiveTime; private LocalDateTime archiveTime;
@Schema(description = "状态", example = "1") @Schema(description = "状态", example = "2")
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(DictTypeConstants.CONTRACT_STATUS) @DictFormat(DictTypeConstants.CONTRACT_STATUS)
private String status; private String status;
@Schema(description = "合同金额", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "合同金额不能为空") @ExcelProperty("合同总金额")
private BigDecimal amount; private BigDecimal amount;
@Schema(description = "前期费用") @Schema(description = "前期费用")
@ExcelProperty("前期费用")
private BigDecimal preAmount; private BigDecimal preAmount;
@Schema(description = "设计费") @Schema(description = "设计费")
@ExcelProperty("设计费")
private BigDecimal designFee; private BigDecimal designFee;
@Schema(description = "勘测费") @Schema(description = "勘测费")
@ExcelProperty("勘测费")
private BigDecimal surveyFees; private BigDecimal surveyFees;
@Schema(description = "检测费") @Schema(description = "检测费")
@ExcelProperty("检测费")
private BigDecimal testingFee; private BigDecimal testingFee;
@Schema(description = "其他费") @Schema(description = "其他费")
private String otherFee; @ExcelProperty("其他费")
private BigDecimal otherFee;
@Schema(description = "计费方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") @Schema(description = "计费方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotEmpty(message = "计费方式不能为空") @ExcelProperty("计费方式")
@DictFormat(DictTypeConstants.COUNT_TYPE)
private String countType; private String countType;
@Schema(description = "备注", example = "你猜") @Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark; private String remark;
@Schema(description = "合同附件url", example = "https://www.iocoder.cn") @Schema(description = "合同附件url", example = "https://www.iocoder.cn")
@ExcelProperty("合同附件url")
private String contractFileUrl; private String contractFileUrl;
@Schema(description = "建安费") @Schema(description = "建安费")
@ExcelProperty("建安费")
private BigDecimal constructionCost; private BigDecimal constructionCost;
@Schema(description = "资金来源") @Schema(description = "资金来源")
@ExcelProperty(value = "资金来源", converter = DictConvert.class)
@DictFormat(DictTypeConstants.SOURCE) @DictFormat(DictTypeConstants.SOURCE)
private String source; private String source;
@Schema(description = "收费标准", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "收费标准", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "收费标准不能为空") @ExcelProperty(value = "收费标准", converter = DictConvert.class)
@DictFormat(DictTypeConstants.CHARGING_STANDARD) @DictFormat(DictTypeConstants.CHARGING_STANDARD)
private String chargingStandard; private String chargingStandard;
@Schema(description = "优惠", example = "7511") @Schema(description = "优惠", example = "28322")
private String discount; @ExcelProperty("优惠")
private BigDecimal discount;
@Schema(description = "是否联合体", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "是否联合体", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "是否联合体不能为空") @ExcelProperty("是否联合体")
private Boolean consortium; private Boolean consortium;
@Schema(description = "联合体单位") @Schema(description = "联合体单位")
@ExcelProperty("联合体单位")
private String consortiumCompany; private String consortiumCompany;
@Schema(description = "合同提示时间") @Schema(description = "合同商议提示")
@ExcelProperty("合同商议提示")
private LocalDateTime reminderTime; private LocalDateTime reminderTime;
@Schema(description = "审定金额") @Schema(description = "审定金额")
@ExcelProperty("审定金额")
private BigDecimal approvedAmount; private BigDecimal approvedAmount;
@Schema(description = "审核文件url", example = "https://www.iocoder.cn") @Schema(description = "审核文件url", example = "https://www.iocoder.cn")
@ExcelProperty("审核文件url")
private String reviewFileUrl; private String reviewFileUrl;
@Schema(description = "最后编辑人")
@ExcelProperty("最后编辑人")
private String finalEditor;
@Schema(description = "流程实体id", example = "24870")
@ExcelProperty("流程实体id")
private String processInstanceId;
@Schema(description = "流程状态", example = "2") @Schema(description = "流程状态", example = "2")
@ExcelProperty(value = "流程状态", converter = DictConvert.class)
@DictFormat(DictTypeConstants.PROCESS_STATUS) @DictFormat(DictTypeConstants.PROCESS_STATUS)
private String processStatus; private Integer processStatus;
@Schema(description = "合同id", example = "26795") @Schema(description = "外部合同id", example = "1808")
private Long contractId; @ExcelProperty("外部合同id")
@Schema(description = "外部合同id", example = "12093")
private Long extContractId; private Long extContractId;
@Schema(description = "版本") @Schema(description = "版本")
@ExcelProperty("版本")
private String version; private String version;
} }

View File

@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.cms.dal.dataobject.contract; package cn.iocoder.yudao.module.cms.dal.dataobject.contract;
import cn.iocoder.yudao.framework.common.pojo.FileDTO; import cn.iocoder.yudao.framework.common.pojo.FileDTO;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -34,7 +36,10 @@ public class ContractDO extends BaseDO {
* 项目id * 项目id
*/ */
private Long projectId; private Long projectId;
/**
* 外部合同id
*/
private Long extContractId;
/** /**
* 合同名称 * 合同名称
*/ */

View File

@ -22,7 +22,6 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class ContractHistoryDO extends BaseDO { public class ContractHistoryDO extends BaseDO {
/** /**
* 主键 * 主键
*/ */
@ -32,10 +31,24 @@ public class ContractHistoryDO extends BaseDO {
* 项目id * 项目id
*/ */
private Long projectId; private Long projectId;
/**
* 流程状态
*/
private String processStatus;
/**
* 该合同的id
*/
private Long contractId;
/**
* 版本
*/
private String version;
/** /**
* 流程实体id * 流程实体id
*/ */
private String processInstanceId; private String processInstanceId;
/** /**
* 合同名称 * 合同名称
*/ */
@ -66,12 +79,22 @@ public class ContractHistoryDO extends BaseDO {
private LocalDateTime archiveTime; private LocalDateTime archiveTime;
/** /**
* 合同状态 * 合同状态
* 枚举 {@link cn.iocoder.yudao.module.cms.enums.DictTypeConstants}
*/ */
private String status; private String status;
/**
* 签订合同总额
*/
private BigDecimal amount;
/** /**
* 计费方式 * 计费方式
* 枚举 {@link cn.iocoder.yudao.module.cms.enums.DictTypeConstants}
*/ */
private String countType; private String countType;
/**
* 暂定结算数
*/
private BigDecimal provisionalSettlement;
/** /**
* 备注 * 备注
*/ */
@ -91,7 +114,7 @@ public class ContractHistoryDO extends BaseDO {
/** /**
* 优惠 * 优惠
*/ */
private String discount; private BigDecimal discount;
/** /**
* 是否联合体 * 是否联合体
*/ */
@ -103,7 +126,7 @@ public class ContractHistoryDO extends BaseDO {
/** /**
* 占主合同比例 * 占主合同比例
*/ */
private String extProportion; private BigDecimal extProportion;
/** /**
* 审定金额 * 审定金额
*/ */
@ -113,39 +136,8 @@ public class ContractHistoryDO extends BaseDO {
*/ */
private String reviewFileUrl; private String reviewFileUrl;
/** /**
* 签订合同总额 * 最后编辑人
*/ */
private BigDecimal amount; private String finalEditor;
/**
* 前期费
*/
private BigDecimal preAmount;
/**
* 设计费
*/
private BigDecimal designAmount;
/**
* 勘测费
*/
private BigDecimal surveyFees;
/**
* 测量费
*/
private BigDecimal measurementFee;
/**
* 其他费
*/
private BigDecimal otherFee;
/**
* 流程状态
*/
private String processStatus;
/**
* 合同
*/
private Long contractId;
/**
* 版本
*/
private String version;
} }

View File

@ -28,10 +28,6 @@ public class ExtContractDO extends BaseDO {
*/ */
@TableId @TableId
private Long id; private Long id;
/**
* 合同id
*/
private Long contractId;
/** /**
* 项目id * 项目id
*/ */

View File

@ -1,15 +1,28 @@
package cn.iocoder.yudao.module.cms.dal.dataobject.extcontracthistory; package cn.iocoder.yudao.module.cms.dal.dataobject.extcontracthistory;
import cn.hutool.core.lang.Dict;
import lombok.*; 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.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/** /**
* 外部合同 DO * 外部合同历史 DO
* *
* @author 管理员 * @author 管理员
*/ */
@ -40,10 +53,6 @@ public class ExtContractHistoryDO extends BaseDO {
* 合同类型 * 合同类型
*/ */
private String type; private String type;
/**
* 客户公司id
*/
private Long customerCompanyId;
/** /**
* 合同进展 * 合同进展
*/ */
@ -65,7 +74,7 @@ public class ExtContractHistoryDO extends BaseDO {
*/ */
private String status; private String status;
/** /**
* 合同金额 * 合同金额
*/ */
private BigDecimal amount; private BigDecimal amount;
/** /**
@ -87,11 +96,9 @@ public class ExtContractHistoryDO extends BaseDO {
/** /**
* 其他费 * 其他费
*/ */
private String otherFee; private BigDecimal otherFee;
/** /**
* 计费方式 * 计费方式
*
* 枚举 {@link //TODO contract_billing_type 对应的类}
*/ */
private String countType; private String countType;
/** /**
@ -108,18 +115,17 @@ public class ExtContractHistoryDO extends BaseDO {
private BigDecimal constructionCost; private BigDecimal constructionCost;
/** /**
* 资金来源 * 资金来源
*
* 枚举 {@link //TODO funds_source 对应的类}
*/ */
private String source; private String source;
/** /**
* 收费标准 * 收费标准
*
*/ */
private String chargingStandard; private String chargingStandard;
/** /**
* 优惠 * 优惠
*/ */
private String discount; private BigDecimal discount;
/** /**
* 是否联合体 * 是否联合体
*/ */
@ -129,7 +135,7 @@ public class ExtContractHistoryDO extends BaseDO {
*/ */
private String consortiumCompany; private String consortiumCompany;
/** /**
* 合同提示时间 * 合同商议提示
*/ */
private LocalDateTime reminderTime; private LocalDateTime reminderTime;
/** /**
@ -140,20 +146,18 @@ public class ExtContractHistoryDO extends BaseDO {
* 审核文件url * 审核文件url
*/ */
private String reviewFileUrl; private String reviewFileUrl;
/**
* 最后编辑人
*/
private String finalEditor;
/** /**
* 流程实体id * 流程实体id
*/ */
private String processInstanceId; private String processInstanceId;
/** /**
* 流程状态 * 流程状态
*
* 枚举 {@link //TODO bpm_process_instance_status 对应的类}
*/ */
private String processStatus; private Integer processStatus;
/**
* 合同id
*/
private Long contractId;
/** /**
* 外部合同id * 外部合同id
*/ */

View File

@ -22,13 +22,7 @@ public interface ExtContractMapper extends BaseMapperX<ExtContractDO> {
.eqIfPresent(ExtContractDO::getProjectId, reqVO.getProjectId()) .eqIfPresent(ExtContractDO::getProjectId, reqVO.getProjectId())
.eqIfPresent(ExtContractDO::getType, reqVO.getType()) .eqIfPresent(ExtContractDO::getType, reqVO.getType())
.eqIfPresent(ExtContractDO::getStatus, reqVO.getStatus()) .eqIfPresent(ExtContractDO::getStatus, reqVO.getStatus())
.eqIfPresent(ExtContractDO::getContractId, reqVO.getContractId())); );
}
default List<ExtContractDO> selectLocalDateTime(Long contractId) {
return selectList(new LambdaQueryWrapperX<ExtContractDO>()
.eqIfPresent(ExtContractDO::getContractId,contractId)
.orderByDesc(ExtContractDO::getReminderTime));
} }
} }

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.cms.dal.mysql.extcontracthistory; package cn.iocoder.yudao.module.cms.dal.mysql.extcontracthistory;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
@ -9,7 +10,7 @@ import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory.vo.*; import cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory.vo.*;
/** /**
* 外部合同 Mapper * 外部合同历史 Mapper
* *
* @author 管理员 * @author 管理员
*/ */
@ -21,12 +22,12 @@ public interface ExtContractHistoryMapper extends BaseMapperX<ExtContractHistory
.eqIfPresent(ExtContractHistoryDO::getProjectId, reqVO.getProjectId()) .eqIfPresent(ExtContractHistoryDO::getProjectId, reqVO.getProjectId())
.likeIfPresent(ExtContractHistoryDO::getName, reqVO.getName()) .likeIfPresent(ExtContractHistoryDO::getName, reqVO.getName())
.eqIfPresent(ExtContractHistoryDO::getType, reqVO.getType()) .eqIfPresent(ExtContractHistoryDO::getType, reqVO.getType())
.eqIfPresent(ExtContractHistoryDO::getCustomerCompanyId, reqVO.getCustomerCompanyId())
.eqIfPresent(ExtContractHistoryDO::getStatus, reqVO.getStatus()) .eqIfPresent(ExtContractHistoryDO::getStatus, reqVO.getStatus())
.eqIfPresent(ExtContractHistoryDO::getProcessInstanceId, reqVO.getProcessInstanceId())
.eqIfPresent(ExtContractHistoryDO::getProcessStatus, reqVO.getProcessStatus()) .eqIfPresent(ExtContractHistoryDO::getProcessStatus, reqVO.getProcessStatus())
.eqIfPresent(ExtContractHistoryDO::getContractId, reqVO.getContractId()) .eqIfPresent(ExtContractHistoryDO::getContractId, reqVO.getContractId())
.eqIfPresent(ExtContractHistoryDO::getExtContractId, reqVO.getExtContractId())); .eqIfPresent(ExtContractHistoryDO::getExtContractId, reqVO.getExtContractId())
);
} }
} }

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.cms.service.contract; package cn.iocoder.yudao.module.cms.service.contract;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.framework.common.util.file.FileUtils;
import cn.iocoder.yudao.module.cms.dal.dataobject.contract.ContractDetailDO; import cn.iocoder.yudao.module.cms.dal.dataobject.contract.ContractDetailDO;
import cn.iocoder.yudao.module.cms.dal.mysql.contract.ContractMapper; import cn.iocoder.yudao.module.cms.dal.mysql.contract.ContractMapper;
import cn.iocoder.yudao.module.cms.service.extContract.ExtContractService; import cn.iocoder.yudao.module.cms.service.extContract.ExtContractService;
@ -18,7 +19,6 @@ import cn.iocoder.yudao.module.cms.dal.dataobject.contract.ContractDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -60,6 +60,7 @@ public class ContractServiceImpl implements ContractService {
} }
//校验,项目是否存在 //校验,项目是否存在
Long projectId = createReqVO.getProjectId(); Long projectId = createReqVO.getProjectId();
projectTrackingApi.validateProjectExists(projectId);
String name = createReqVO.getName(); String name = createReqVO.getName();
String trimName = name.trim(); String trimName = name.trim();
List<ContractDO> projectList = contractMapper.selectList("project_id", projectId); List<ContractDO> projectList = contractMapper.selectList("project_id", projectId);
@ -69,6 +70,8 @@ public class ContractServiceImpl implements ContractService {
} }
} }
ContractDO contract = BeanUtils.toBean(createReqVO, ContractDO.class); ContractDO contract = BeanUtils.toBean(createReqVO, ContractDO.class);
contract.setReviewFileUrl(FileUtils.covertFileToJSONString(createReqVO.getReviewFileUrl()));
contract.setContractFileUrl(FileUtils.covertFileToJSONString(createReqVO.getContractFileUrl()));
contract.setCreator(userName); contract.setCreator(userName);
contract.setUpdater(userName); contract.setUpdater(userName);
contractMapper.insert(contract); contractMapper.insert(contract);
@ -126,12 +129,12 @@ public class ContractServiceImpl implements ContractService {
if (contractDO == null) { if (contractDO == null) {
throw exception(CONTRACT_NOT_EXISTS); throw exception(CONTRACT_NOT_EXISTS);
} }
Long extContractId = contractDO.getExtContractId();
Long projectId = contractDO.getProjectId(); Long projectId = contractDO.getProjectId();
projectTrackingApi.validateProjectExists(projectId); projectTrackingApi.validateProjectExists(projectId);
ProjectScheduleDetailDTO projectScheduleDetail = projectScheduleApi.getProjectScheduleDetail(projectId); ProjectScheduleDetailDTO projectScheduleDetail = projectScheduleApi.getProjectScheduleDetail(projectId);
ProjectTrackingDetailDTO projectTracking = projectTrackingApi.getProjectTracking(projectId); ProjectTrackingDetailDTO projectTracking = projectTrackingApi.getProjectTracking(projectId);
LocalDateTime localDateTime = extContractService.getLocalDateTime(id); contractDetailDO.setReminderTime(extContractService.getContractDetail(extContractId).getReminderTime());
contractDetailDO.setReminderTime(localDateTime);
BeanUtil.copyProperties(contractDO, contractDetailDO); BeanUtil.copyProperties(contractDO, contractDetailDO);
BeanUtil.copyProperties(projectTracking,contractDetailDO); BeanUtil.copyProperties(projectTracking,contractDetailDO);
BeanUtil.copyProperties(projectScheduleDetail,contractDetailDO); BeanUtil.copyProperties(projectScheduleDetail,contractDetailDO);

View File

@ -39,12 +39,9 @@ public class ContractHistoryServiceImpl implements ContractHistoryService {
@Override @Override
public void updateContractHistory(Long loginUserId,ContractHistorySaveReqVO updateReqVO) { public void updateContractHistory(Long loginUserId,ContractHistorySaveReqVO updateReqVO) {
//校验 //校验
Long id = updateReqVO.getId();
validateContractHistoryExists(id);
if (loginUserId == null){ if (loginUserId == null){
throw exception(USER_NOT_EXISTS); throw exception(USER_NOT_EXISTS);
} }
Long projectId = updateReqVO.getProjectId();
// 更新 // 更新
ContractHistoryDO updateObj = BeanUtils.toBean(updateReqVO, ContractHistoryDO.class); ContractHistoryDO updateObj = BeanUtils.toBean(updateReqVO, ContractHistoryDO.class);
String userName = adminUserApi.getUser(loginUserId).getNickname(); String userName = adminUserApi.getUser(loginUserId).getNickname();

View File

@ -56,11 +56,5 @@ public interface ExtContractService {
*/ */
PageResult<ExtContractRespVO> getExtContractPage(ExtContractPageReqVO pageReqVO); PageResult<ExtContractRespVO> getExtContractPage(ExtContractPageReqVO pageReqVO);
/**
* 得到合同商议时间
* @param contractId 合同id
* @return
*/
LocalDateTime getLocalDateTime(Long contractId);
} }

View File

@ -1,11 +1,16 @@
package cn.iocoder.yudao.module.cms.service.extContract; package cn.iocoder.yudao.module.cms.service.extContract;
import cn.hutool.core.bean.BeanUtil; 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.cms.controller.admin.extContract.vo.ExtContractPageReqVO; import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractPageReqVO;
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractRespVO; import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractRespVO;
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractSaveReqVO; import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractSaveReqVO;
import cn.iocoder.yudao.module.cms.dal.dataobject.extcontract.ExtContractDO; import cn.iocoder.yudao.module.cms.dal.dataobject.extcontract.ExtContractDO;
import cn.iocoder.yudao.module.cms.dal.dataobject.extcontract.ExtContractDetailDO; import cn.iocoder.yudao.module.cms.dal.dataobject.extcontract.ExtContractDetailDO;
import cn.iocoder.yudao.module.cms.dal.dataobject.extcontracthistory.ExtContractHistoryDO;
import cn.iocoder.yudao.module.cms.dal.mysql.extContract.ExtContractMapper; import cn.iocoder.yudao.module.cms.dal.mysql.extContract.ExtContractMapper;
import cn.iocoder.yudao.module.cms.dal.mysql.extcontracthistory.ExtContractHistoryMapper;
import cn.iocoder.yudao.module.pms.api.projectschedule.ProjectScheduleApi; import cn.iocoder.yudao.module.pms.api.projectschedule.ProjectScheduleApi;
import cn.iocoder.yudao.module.pms.api.projectschedule.dto.ProjectScheduleDetailDTO; import cn.iocoder.yudao.module.pms.api.projectschedule.dto.ProjectScheduleDetailDTO;
import cn.iocoder.yudao.module.pms.api.projecttracking.ProjectTrackingApi; import cn.iocoder.yudao.module.pms.api.projecttracking.ProjectTrackingApi;
@ -17,7 +22,6 @@ import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -33,6 +37,11 @@ import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.*;
@Validated @Validated
public class ExtContractServiceImpl implements ExtContractService { public class ExtContractServiceImpl implements ExtContractService {
/**
* 外部合同审批流程定义
*/
public static final String PROCESS_KEY = "ext_contract_init";
@Resource @Resource
private ExtContractMapper extContractMapper; private ExtContractMapper extContractMapper;
@ -46,26 +55,59 @@ public class ExtContractServiceImpl implements ExtContractService {
private ProjectScheduleApi projectScheduleApi; private ProjectScheduleApi projectScheduleApi;
@Resource
private BpmProcessInstanceApi processInstanceApi;
@Resource
private ExtContractHistoryMapper extContractHistoryMapper;
@Override @Override
public Long createExtContract(Long loginUserId, ExtContractSaveReqVO createReqVO) { public Long createExtContract(Long loginUserId, ExtContractSaveReqVO createReqVO) {
//插入外部合同表
String userName = adminUserApi.getUser(loginUserId).getNickname(); String userName = adminUserApi.getUser(loginUserId).getNickname();
//校验,项目是否存在 //校验,项目是否存在
Long contractId = createReqVO.getContractId();
String name = createReqVO.getName(); String name = createReqVO.getName();
String trimName = name.trim(); String trimName = name.trim();
List<ExtContractDO> extContractList = extContractMapper.selectList("contract_id", contractId); Long projectId = createReqVO.getProjectId();
projectTrackingApi.validateProjectExists(projectId);
List<ExtContractDO> extContractList = extContractMapper.selectList("project_id", projectId);
for (ExtContractDO extContractDO : extContractList) { for (ExtContractDO extContractDO : extContractList) {
if (extContractDO.getName().equals(trimName)){ if (extContractDO.getName().equals(trimName)){
throw exception(EXT_CONTRACT_EXISTS); throw exception(EXT_CONTRACT_EXISTS);
} }
} }
ExtContractDO extContract = BeanUtils.toBean(createReqVO, ExtContractDO.class); ExtContractDO extContract = BeanUtils.toBean(createReqVO, ExtContractDO.class);
extContract.setReviewFileUrl(FileUtils.covertFileToJSONString(createReqVO.getReviewFileUrl()));
extContract.setContractFileUrl(FileUtils.covertFileToJSONString(createReqVO.getContractFileUrl()));
extContract.setCreator(userName); extContract.setCreator(userName);
extContract.setUpdater(userName); extContract.setUpdater(userName);
//也要插入历史
ExtContractHistoryDO extContractHistoryDO = BeanUtils.toBean(extContract, ExtContractHistoryDO.class);
extContractMapper.insert(extContract); extContractMapper.insert(extContract);
extContractHistoryDO.setExtContractId(extContract.getId());
//版本
if (extContractHistoryMapper.selectCount("project_id", createReqVO.getProjectId()) < 1) {
extContractHistoryDO.setVersion("1");
}else{
extContractHistoryDO.setVersion(String.valueOf(extContractHistoryMapper.selectCount("project_id", createReqVO.getProjectId()) + 1));
}
//状态
extContractHistoryDO.setProcessStatus(1);
extContractHistoryMapper.insert(extContractHistoryDO);
// 启动流程
if (createReqVO.getId() == null) {
String processInstanceId = processInstanceApi.createProcessInstance(loginUserId,
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
.setBusinessKey(String.valueOf(extContract.getId())));
// 写入工作流编号
extContractHistoryMapper.updateById(extContractHistoryDO.setProcessInstanceId(processInstanceId));
}
//返回 //返回
return extContract.getId(); return extContract.getId();
} }
@ -126,13 +168,6 @@ public class ExtContractServiceImpl implements ExtContractService {
return pageResult; return pageResult;
} }
@Override
public LocalDateTime getLocalDateTime(Long contractId) {
List<ExtContractDO> extContractDOS = extContractMapper.selectLocalDateTime(contractId);
return extContractDOS.get(0).getReminderTime();
}
private void validateExtContractExists(Long id) { private void validateExtContractExists(Long id) {
if (extContractMapper.selectById(id) == null) { if (extContractMapper.selectById(id) == null) {
throw exception(EXT_CONTRACT_NOT_EXISTS); throw exception(EXT_CONTRACT_NOT_EXISTS);