mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 12:18:42 +08:00 
			
		
		
		
	[feat] 新增历史合同管理功能
This commit is contained in:
		@@ -28,7 +28,7 @@ public class ContractRespVO {
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "分包合同提示时间")
 | 
			
		||||
    @ExcelProperty("分包合同提示时间")
 | 
			
		||||
    private LocalDateTime subReminderTime;
 | 
			
		||||
    private LocalDateTime ReminderTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "暂定结算数")
 | 
			
		||||
    @ExcelProperty("暂定结算数")
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,95 @@
 | 
			
		||||
package cn.iocoder.yudao.module.cms.controller.admin.contracthistory;
 | 
			
		||||
 | 
			
		||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contracthistory.ContractHistoryDO;
 | 
			
		||||
import cn.iocoder.yudao.module.cms.service.contracthistory.ContractHistoryService;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import jakarta.annotation.Resource;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
import org.springframework.security.access.prepost.PreAuthorize;
 | 
			
		||||
import io.swagger.v3.oas.annotations.tags.Tag;
 | 
			
		||||
import io.swagger.v3.oas.annotations.Parameter;
 | 
			
		||||
import io.swagger.v3.oas.annotations.Operation;
 | 
			
		||||
 | 
			
		||||
import jakarta.validation.*;
 | 
			
		||||
import jakarta.servlet.http.*;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 | 
			
		||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 | 
			
		||||
 | 
			
		||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
 | 
			
		||||
 | 
			
		||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
 | 
			
		||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
 | 
			
		||||
 | 
			
		||||
import cn.iocoder.yudao.module.cms.controller.admin.contracthistory.vo.*;
 | 
			
		||||
 | 
			
		||||
@Tag(name = "管理后台 - 历史合同管理")
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping("/cms/contract-history")
 | 
			
		||||
@Validated
 | 
			
		||||
public class ContractHistoryController {
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private ContractHistoryService contractHistoryService;
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/create")
 | 
			
		||||
    @Operation(summary = "创建历史合同")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('cms:contract-history:create')")
 | 
			
		||||
    public CommonResult<Long> createContractHistory(@Valid @RequestBody ContractHistorySaveReqVO createReqVO) {
 | 
			
		||||
        return success(contractHistoryService.createContractHistory(createReqVO));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PutMapping("/update")
 | 
			
		||||
    @Operation(summary = "更新历史合同")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('cms:contract-history:update')")
 | 
			
		||||
    public CommonResult<Boolean> updateContractHistory(@Valid @RequestBody ContractHistorySaveReqVO updateReqVO) {
 | 
			
		||||
        contractHistoryService.updateContractHistory(updateReqVO);
 | 
			
		||||
        return success(true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @DeleteMapping("/delete")
 | 
			
		||||
    @Operation(summary = "删除历史合同")
 | 
			
		||||
    @Parameter(name = "id", description = "编号", required = true)
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('cms:contract-history:delete')")
 | 
			
		||||
    public CommonResult<Boolean> deleteContractHistory(@RequestParam("id") Long id) {
 | 
			
		||||
        contractHistoryService.deleteContractHistory(id);
 | 
			
		||||
        return success(true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/get")
 | 
			
		||||
    @Operation(summary = "获得历史合同")
 | 
			
		||||
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('cms:contract-history:query')")
 | 
			
		||||
    public CommonResult<ContractHistoryRespVO> getContractHistory(@RequestParam("id") Long id) {
 | 
			
		||||
        ContractHistoryDO contractHistory = contractHistoryService.getContractHistory(id);
 | 
			
		||||
        return success(BeanUtils.toBean(contractHistory, ContractHistoryRespVO.class));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/page")
 | 
			
		||||
    @Operation(summary = "获得历史合同分页")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('cms:contract-history:query')")
 | 
			
		||||
    public CommonResult<PageResult<ContractHistoryRespVO>> getContractHistoryPage(@Valid ContractHistoryPageReqVO pageReqVO) {
 | 
			
		||||
        PageResult<ContractHistoryDO> pageResult = contractHistoryService.getContractHistoryPage(pageReqVO);
 | 
			
		||||
        return success(BeanUtils.toBean(pageResult, ContractHistoryRespVO.class));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/export-excel")
 | 
			
		||||
    @Operation(summary = "导出历史合同 Excel")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('cms:contract-history:export')")
 | 
			
		||||
    @ApiAccessLog(operateType = EXPORT)
 | 
			
		||||
    public void exportContractHistoryExcel(@Valid ContractHistoryPageReqVO pageReqVO,
 | 
			
		||||
              HttpServletResponse response) throws IOException {
 | 
			
		||||
        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
 | 
			
		||||
        List<ContractHistoryDO> list = contractHistoryService.getContractHistoryPage(pageReqVO).getList();
 | 
			
		||||
        // 导出 Excel
 | 
			
		||||
        ExcelUtils.write(response, "历史合同.xls", "数据", ContractHistoryRespVO.class,
 | 
			
		||||
                        BeanUtils.toBean(list, ContractHistoryRespVO.class));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,129 @@
 | 
			
		||||
package cn.iocoder.yudao.module.cms.controller.admin.contracthistory.vo;
 | 
			
		||||
 | 
			
		||||
import lombok.*;
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
 | 
			
		||||
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 = "流程实体id", example = "12536")
 | 
			
		||||
    private String processInstanceId;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同名称", example = "芋艿")
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同类型", example = "2")
 | 
			
		||||
    private String type;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同进展")
 | 
			
		||||
    private String progress;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同拟定时间")
 | 
			
		||||
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
 | 
			
		||||
    private LocalDateTime[] expectedTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同用印时间")
 | 
			
		||||
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
 | 
			
		||||
    private LocalDateTime[] printingTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "签订时间")
 | 
			
		||||
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
 | 
			
		||||
    private LocalDateTime[] signingTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "归档时间")
 | 
			
		||||
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
 | 
			
		||||
    private LocalDateTime[] archiveTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同状态", example = "1")
 | 
			
		||||
    private String status;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "计费方式", example = "2")
 | 
			
		||||
    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 = "资金来源")
 | 
			
		||||
    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 = "审定金额")
 | 
			
		||||
    private BigDecimal approvedAmount;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "审核文件url", example = "https://www.iocoder.cn")
 | 
			
		||||
    private String reviewFileUrl;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "创建者")
 | 
			
		||||
    private String creator;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "创建时间")
 | 
			
		||||
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
 | 
			
		||||
    private LocalDateTime[] createTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "更新者")
 | 
			
		||||
    private String updater;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "更新时间")
 | 
			
		||||
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
 | 
			
		||||
    private LocalDateTime[] updateTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "是否删除")
 | 
			
		||||
    private Boolean deleted;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "租户编号", example = "23584")
 | 
			
		||||
    private Long tenantId;
 | 
			
		||||
 | 
			
		||||
    @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")
 | 
			
		||||
    private String processStatus;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同", example = "20704")
 | 
			
		||||
    private Long contractId;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "版本")
 | 
			
		||||
    private String version;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,186 @@
 | 
			
		||||
package cn.iocoder.yudao.module.cms.controller.admin.contracthistory.vo;
 | 
			
		||||
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import lombok.*;
 | 
			
		||||
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import com.alibaba.excel.annotation.*;
 | 
			
		||||
 | 
			
		||||
@Schema(description = "管理后台 - 历史合同 Response VO")
 | 
			
		||||
@Data
 | 
			
		||||
@ExcelIgnoreUnannotated
 | 
			
		||||
public class ContractHistoryRespVO {
 | 
			
		||||
 | 
			
		||||
    @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 = "流程实体id", example = "12536")
 | 
			
		||||
    @ExcelProperty("流程实体id")
 | 
			
		||||
    private String processInstanceId;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
 | 
			
		||||
    @ExcelProperty("合同名称")
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
 | 
			
		||||
    @ExcelProperty("合同类型")
 | 
			
		||||
    private String type;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同进展", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    @ExcelProperty("合同进展")
 | 
			
		||||
    private String progress;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同拟定时间", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    @ExcelProperty("合同拟定时间")
 | 
			
		||||
    private LocalDateTime expectedTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同用印时间", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    @ExcelProperty("合同用印时间")
 | 
			
		||||
    private LocalDateTime printingTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "签订时间")
 | 
			
		||||
    @ExcelProperty("签订时间")
 | 
			
		||||
    private LocalDateTime signingTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "归档时间")
 | 
			
		||||
    @ExcelProperty("归档时间")
 | 
			
		||||
    private LocalDateTime archiveTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
 | 
			
		||||
    @ExcelProperty("合同状态")
 | 
			
		||||
    private String status;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "计费方式", example = "2")
 | 
			
		||||
    @ExcelProperty("计费方式")
 | 
			
		||||
    private String countType;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "备注", example = "你猜")
 | 
			
		||||
    @ExcelProperty("备注")
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同url", example = "https://www.iocoder.cn")
 | 
			
		||||
    @ExcelProperty("合同url")
 | 
			
		||||
    private String contractFileUrl;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "建安费")
 | 
			
		||||
    @ExcelProperty("建安费")
 | 
			
		||||
    private BigDecimal constructionCost;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "资金来源")
 | 
			
		||||
    @ExcelProperty("资金来源")
 | 
			
		||||
    private String source;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "优惠", example = "18154")
 | 
			
		||||
    @ExcelProperty("优惠")
 | 
			
		||||
    private String discount;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "是否联合体")
 | 
			
		||||
    @ExcelProperty("是否联合体")
 | 
			
		||||
    private Boolean consortium;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "联合体单位")
 | 
			
		||||
    @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;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "创建者")
 | 
			
		||||
    @ExcelProperty("创建者")
 | 
			
		||||
    private String creator;
 | 
			
		||||
 | 
			
		||||
    @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 = "23584")
 | 
			
		||||
    @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 = "2")
 | 
			
		||||
    @ExcelProperty("流程状态")
 | 
			
		||||
    private String processStatus;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同", example = "20704")
 | 
			
		||||
    @ExcelProperty("合同")
 | 
			
		||||
    private Long contractId;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "版本")
 | 
			
		||||
    @ExcelProperty("版本")
 | 
			
		||||
    private String version;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,135 @@
 | 
			
		||||
package cn.iocoder.yudao.module.cms.controller.admin.contracthistory.vo;
 | 
			
		||||
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import lombok.*;
 | 
			
		||||
import jakarta.validation.constraints.*;
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
 | 
			
		||||
@Schema(description = "管理后台 - 历史合同新增/修改 Request VO")
 | 
			
		||||
@Data
 | 
			
		||||
public class ContractHistorySaveReqVO {
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "历史合同编号", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
 | 
			
		||||
    private Long projectId;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "流程实体id", example = "12536")
 | 
			
		||||
    private String processInstanceId;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
 | 
			
		||||
    @NotEmpty(message = "合同名称不能为空")
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
 | 
			
		||||
    @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 = "1")
 | 
			
		||||
    @NotEmpty(message = "合同状态不能为空")
 | 
			
		||||
    private String status;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "计费方式", example = "2")
 | 
			
		||||
    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 = "资金来源")
 | 
			
		||||
    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 String creator;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    @NotNull(message = "创建时间不能为空")
 | 
			
		||||
    private LocalDateTime createTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "更新者")
 | 
			
		||||
    private String updater;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    @NotNull(message = "更新时间不能为空")
 | 
			
		||||
    private LocalDateTime updateTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "是否删除", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    @NotNull(message = "是否删除不能为空")
 | 
			
		||||
    private Boolean deleted;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23584")
 | 
			
		||||
    @NotNull(message = "租户编号不能为空")
 | 
			
		||||
    private Long tenantId;
 | 
			
		||||
 | 
			
		||||
    @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")
 | 
			
		||||
    private String processStatus;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "合同", example = "20704")
 | 
			
		||||
    private Long contractId;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "版本")
 | 
			
		||||
    private String version;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,152 @@
 | 
			
		||||
package cn.iocoder.yudao.module.cms.dal.dataobject.contracthistory;
 | 
			
		||||
 | 
			
		||||
import lombok.*;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.*;
 | 
			
		||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 历史合同 DO
 | 
			
		||||
 *
 | 
			
		||||
 * @author 管理员
 | 
			
		||||
 */
 | 
			
		||||
@TableName("cms_contract_history")
 | 
			
		||||
@KeySequence("cms_contract_history_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = true)
 | 
			
		||||
@ToString(callSuper = true)
 | 
			
		||||
@Builder
 | 
			
		||||
@NoArgsConstructor
 | 
			
		||||
@AllArgsConstructor
 | 
			
		||||
public class ContractHistoryDO extends BaseDO {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 主键
 | 
			
		||||
     */
 | 
			
		||||
    @TableId
 | 
			
		||||
    private Long id;
 | 
			
		||||
    /**
 | 
			
		||||
     * 项目id
 | 
			
		||||
     */
 | 
			
		||||
    private Long projectId;
 | 
			
		||||
    /**
 | 
			
		||||
     * 流程实体id
 | 
			
		||||
     */
 | 
			
		||||
    private String processInstanceId;
 | 
			
		||||
    /**
 | 
			
		||||
     * 合同名称
 | 
			
		||||
     */
 | 
			
		||||
    private String name;
 | 
			
		||||
    /**
 | 
			
		||||
     * 合同类型
 | 
			
		||||
     */
 | 
			
		||||
    private String type;
 | 
			
		||||
    /**
 | 
			
		||||
     * 合同进展
 | 
			
		||||
     */
 | 
			
		||||
    private String progress;
 | 
			
		||||
    /**
 | 
			
		||||
     * 合同拟定时间
 | 
			
		||||
     */
 | 
			
		||||
    private LocalDateTime expectedTime;
 | 
			
		||||
    /**
 | 
			
		||||
     * 合同用印时间
 | 
			
		||||
     */
 | 
			
		||||
    private LocalDateTime printingTime;
 | 
			
		||||
    /**
 | 
			
		||||
     * 签订时间
 | 
			
		||||
     */
 | 
			
		||||
    private LocalDateTime signingTime;
 | 
			
		||||
    /**
 | 
			
		||||
     * 归档时间
 | 
			
		||||
     */
 | 
			
		||||
    private LocalDateTime archiveTime;
 | 
			
		||||
    /**
 | 
			
		||||
     * 合同状态
 | 
			
		||||
     */
 | 
			
		||||
    private String status;
 | 
			
		||||
    /**
 | 
			
		||||
     * 计费方式
 | 
			
		||||
     */
 | 
			
		||||
    private String countType;
 | 
			
		||||
    /**
 | 
			
		||||
     * 备注
 | 
			
		||||
     */
 | 
			
		||||
    private String remark;
 | 
			
		||||
    /**
 | 
			
		||||
     * 合同url
 | 
			
		||||
     */
 | 
			
		||||
    private String contractFileUrl;
 | 
			
		||||
    /**
 | 
			
		||||
     * 建安费
 | 
			
		||||
     */
 | 
			
		||||
    private BigDecimal constructionCost;
 | 
			
		||||
    /**
 | 
			
		||||
     * 资金来源
 | 
			
		||||
     */
 | 
			
		||||
    private String source;
 | 
			
		||||
    /**
 | 
			
		||||
     * 优惠
 | 
			
		||||
     */
 | 
			
		||||
    private String discount;
 | 
			
		||||
    /**
 | 
			
		||||
     * 是否联合体
 | 
			
		||||
     */
 | 
			
		||||
    private Boolean consortium;
 | 
			
		||||
    /**
 | 
			
		||||
     * 联合体单位
 | 
			
		||||
     */
 | 
			
		||||
    private String consortiumCompany;
 | 
			
		||||
    /**
 | 
			
		||||
     * 占主合同比例
 | 
			
		||||
     */
 | 
			
		||||
    private String extProportion;
 | 
			
		||||
    /**
 | 
			
		||||
     * 审定金额
 | 
			
		||||
     */
 | 
			
		||||
    private BigDecimal approvedAmount;
 | 
			
		||||
    /**
 | 
			
		||||
     * 审核文件url
 | 
			
		||||
     */
 | 
			
		||||
    private String reviewFileUrl;
 | 
			
		||||
    /**
 | 
			
		||||
     * 签订合同总额
 | 
			
		||||
     */
 | 
			
		||||
    private BigDecimal amount;
 | 
			
		||||
    /**
 | 
			
		||||
     * 前期费
 | 
			
		||||
     */
 | 
			
		||||
    private BigDecimal preAmount;
 | 
			
		||||
    /**
 | 
			
		||||
     * 设计费
 | 
			
		||||
     */
 | 
			
		||||
    private BigDecimal designAmount;
 | 
			
		||||
    /**
 | 
			
		||||
     * 勘测费
 | 
			
		||||
     */
 | 
			
		||||
    private BigDecimal surveyFees;
 | 
			
		||||
    /**
 | 
			
		||||
     * 测量费
 | 
			
		||||
     */
 | 
			
		||||
    private BigDecimal measurementFee;
 | 
			
		||||
    /**
 | 
			
		||||
     * 其他费
 | 
			
		||||
     */
 | 
			
		||||
    private BigDecimal otherFee;
 | 
			
		||||
    /**
 | 
			
		||||
     * 流程状态
 | 
			
		||||
     */
 | 
			
		||||
    private String processStatus;
 | 
			
		||||
    /**
 | 
			
		||||
     * 合同
 | 
			
		||||
     */
 | 
			
		||||
    private Long contractId;
 | 
			
		||||
    /**
 | 
			
		||||
     * 版本
 | 
			
		||||
     */
 | 
			
		||||
    private String version;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,57 @@
 | 
			
		||||
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.module.cms.dal.dataobject.contracthistory.ContractHistoryDO;
 | 
			
		||||
import org.apache.ibatis.annotations.Mapper;
 | 
			
		||||
import cn.iocoder.yudao.module.cms.controller.admin.contracthistory.vo.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 历史合同 Mapper
 | 
			
		||||
 *
 | 
			
		||||
 * @author 管理员
 | 
			
		||||
 */
 | 
			
		||||
@Mapper
 | 
			
		||||
public interface ContractHistoryMapper extends BaseMapperX<ContractHistoryDO> {
 | 
			
		||||
 | 
			
		||||
    default PageResult<ContractHistoryDO> selectPage(ContractHistoryPageReqVO reqVO) {
 | 
			
		||||
        return selectPage(reqVO, new LambdaQueryWrapperX<ContractHistoryDO>()
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getProcessInstanceId, reqVO.getProcessInstanceId())
 | 
			
		||||
                .likeIfPresent(ContractHistoryDO::getName, reqVO.getName())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getType, reqVO.getType())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getProgress, reqVO.getProgress())
 | 
			
		||||
                .betweenIfPresent(ContractHistoryDO::getExpectedTime, reqVO.getExpectedTime())
 | 
			
		||||
                .betweenIfPresent(ContractHistoryDO::getPrintingTime, reqVO.getPrintingTime())
 | 
			
		||||
                .betweenIfPresent(ContractHistoryDO::getSigningTime, reqVO.getSigningTime())
 | 
			
		||||
                .betweenIfPresent(ContractHistoryDO::getArchiveTime, reqVO.getArchiveTime())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getStatus, reqVO.getStatus())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getCountType, reqVO.getCountType())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getRemark, reqVO.getRemark())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getContractFileUrl, reqVO.getContractFileUrl())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getConstructionCost, reqVO.getConstructionCost())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getSource, reqVO.getSource())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getDiscount, reqVO.getDiscount())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getConsortium, reqVO.getConsortium())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getConsortiumCompany, reqVO.getConsortiumCompany())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getExtProportion, reqVO.getExtProportion())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getApprovedAmount, reqVO.getApprovedAmount())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getReviewFileUrl, reqVO.getReviewFileUrl())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getCreator, reqVO.getCreator())
 | 
			
		||||
                .betweenIfPresent(ContractHistoryDO::getCreateTime, reqVO.getCreateTime())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getUpdater, reqVO.getUpdater())
 | 
			
		||||
                .betweenIfPresent(ContractHistoryDO::getUpdateTime, reqVO.getUpdateTime())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getDeleted, reqVO.getDeleted())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getAmount, reqVO.getAmount())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getPreAmount, reqVO.getPreAmount())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getDesignAmount, reqVO.getDesignAmount())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getSurveyFees, reqVO.getSurveyFees())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getMeasurementFee, reqVO.getMeasurementFee())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getOtherFee, reqVO.getOtherFee())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getProcessStatus, reqVO.getProcessStatus())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getContractId, reqVO.getContractId())
 | 
			
		||||
                .eqIfPresent(ContractHistoryDO::getVersion, reqVO.getVersion())
 | 
			
		||||
                .orderByDesc(ContractHistoryDO::getId));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -132,7 +132,7 @@ public class ContractServiceImpl implements ContractService {
 | 
			
		||||
    @Override
 | 
			
		||||
    public BigDecimal getProvisionalSettlement(Long id) {
 | 
			
		||||
        ContractDO contractDO = contractMapper.selectById(id);
 | 
			
		||||
        String type = contractDO.getType();
 | 
			
		||||
        String type = contractDO.getCountType();
 | 
			
		||||
        BigDecimal amount = contractDO.getAmount();
 | 
			
		||||
        BigDecimal bigDecimal = new BigDecimal(String.valueOf(amount));
 | 
			
		||||
        BigDecimal mul = new BigDecimal("0.85");
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,53 @@
 | 
			
		||||
package cn.iocoder.yudao.module.cms.service.contracthistory;
 | 
			
		||||
 | 
			
		||||
import jakarta.validation.*;
 | 
			
		||||
import cn.iocoder.yudao.module.cms.controller.admin.contracthistory.vo.*;
 | 
			
		||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contracthistory.ContractHistoryDO;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 历史合同 Service 接口
 | 
			
		||||
 *
 | 
			
		||||
 * @author 管理员
 | 
			
		||||
 */
 | 
			
		||||
public interface ContractHistoryService {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 创建历史合同
 | 
			
		||||
     *
 | 
			
		||||
     * @param createReqVO 创建信息
 | 
			
		||||
     * @return 编号
 | 
			
		||||
     */
 | 
			
		||||
    Long createContractHistory(@Valid ContractHistorySaveReqVO createReqVO);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 更新历史合同
 | 
			
		||||
     *
 | 
			
		||||
     * @param updateReqVO 更新信息
 | 
			
		||||
     */
 | 
			
		||||
    void updateContractHistory(@Valid ContractHistorySaveReqVO updateReqVO);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除历史合同
 | 
			
		||||
     *
 | 
			
		||||
     * @param id 编号
 | 
			
		||||
     */
 | 
			
		||||
    void deleteContractHistory(Long id);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获得历史合同
 | 
			
		||||
     *
 | 
			
		||||
     * @param id 编号
 | 
			
		||||
     * @return 历史合同
 | 
			
		||||
     */
 | 
			
		||||
    ContractHistoryDO getContractHistory(Long id);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获得历史合同分页
 | 
			
		||||
     *
 | 
			
		||||
     * @param pageReqVO 分页查询
 | 
			
		||||
     * @return 历史合同分页
 | 
			
		||||
     */
 | 
			
		||||
    PageResult<ContractHistoryDO> getContractHistoryPage(ContractHistoryPageReqVO pageReqVO);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,69 @@
 | 
			
		||||
package cn.iocoder.yudao.module.cms.service.contracthistory;
 | 
			
		||||
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import jakarta.annotation.Resource;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
 | 
			
		||||
import cn.iocoder.yudao.module.cms.controller.admin.contracthistory.vo.*;
 | 
			
		||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contracthistory.ContractHistoryDO;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 | 
			
		||||
 | 
			
		||||
import cn.iocoder.yudao.module.cms.dal.mysql.contracthistory.ContractHistoryMapper;
 | 
			
		||||
 | 
			
		||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 | 
			
		||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 历史合同 Service 实现类
 | 
			
		||||
 *
 | 
			
		||||
 * @author 管理员
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
@Validated
 | 
			
		||||
public class ContractHistoryServiceImpl implements ContractHistoryService {
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private ContractHistoryMapper contractHistoryMapper;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Long createContractHistory(ContractHistorySaveReqVO createReqVO) {
 | 
			
		||||
        // 插入
 | 
			
		||||
        ContractHistoryDO contractHistory = BeanUtils.toBean(createReqVO, ContractHistoryDO.class);
 | 
			
		||||
        contractHistoryMapper.insert(contractHistory);
 | 
			
		||||
        // 返回
 | 
			
		||||
        return contractHistory.getId();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void updateContractHistory(ContractHistorySaveReqVO updateReqVO) {
 | 
			
		||||
        // 更新
 | 
			
		||||
        ContractHistoryDO updateObj = BeanUtils.toBean(updateReqVO, ContractHistoryDO.class);
 | 
			
		||||
        contractHistoryMapper.updateById(updateObj);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void deleteContractHistory(Long id) {
 | 
			
		||||
        // 校验存在
 | 
			
		||||
        validateContractHistoryExists(id);
 | 
			
		||||
        // 删除
 | 
			
		||||
        contractHistoryMapper.deleteById(id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void validateContractHistoryExists(Long id) {
 | 
			
		||||
        if (contractHistoryMapper.selectById(id) == null) {
 | 
			
		||||
            throw exception(CONTRACT_HISTORY_NOT_EXISTS);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public ContractHistoryDO getContractHistory(Long id) {
 | 
			
		||||
        return contractHistoryMapper.selectById(id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public PageResult<ContractHistoryDO> getContractHistoryPage(ContractHistoryPageReqVO pageReqVO) {
 | 
			
		||||
        return contractHistoryMapper.selectPage(pageReqVO);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user