mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-02-01 19:24:57 +08:00
[feat] 新增外部合同历史管理
This commit is contained in:
parent
2e9937cad2
commit
6d4885c051
@ -30,76 +30,10 @@ public class ExtContractPageReqVO extends PageParam {
|
||||
@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[] signingTime;
|
||||
|
||||
@Schema(description = "归档时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] archiveTime;
|
||||
|
||||
@Schema(description = "状态", example = "2")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "合同金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "前期费用")
|
||||
private BigDecimal preAmount;
|
||||
|
||||
@Schema(description = "设计费")
|
||||
private BigDecimal designFee;
|
||||
|
||||
@Schema(description = "勘测费")
|
||||
private BigDecimal surveyFees;
|
||||
|
||||
@Schema(description = "检测费")
|
||||
private BigDecimal testingFee;
|
||||
|
||||
@Schema(description = "其他费")
|
||||
private String otherFee;
|
||||
|
||||
@Schema(description = "计费方式", example = "1")
|
||||
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 = "收费标准")
|
||||
private String chargingStandard;
|
||||
|
||||
@Schema(description = "优惠", example = "15529")
|
||||
private String discount;
|
||||
|
||||
@Schema(description = "是否联合体")
|
||||
private Boolean consortium;
|
||||
|
||||
@Schema(description = "联合体单位")
|
||||
private String consortiumCompany;
|
||||
|
||||
@Schema(description = "分包合同提示时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] reminderTime;
|
||||
|
||||
@Schema(description = "审定金额")
|
||||
private BigDecimal approvedAmount;
|
||||
|
||||
@Schema(description = "审核文件url", example = "https://www.iocoder.cn")
|
||||
private String reviewFileUrl;
|
||||
|
||||
@Schema(description = "合同id", example = "27460")
|
||||
private Long contractId;
|
||||
|
||||
|
@ -39,11 +39,10 @@ public class ExtContractSaveReqVO {
|
||||
@ExcelProperty("合同提示时间")
|
||||
private LocalDateTime exReminderTime;
|
||||
|
||||
|
||||
@Schema(description = "客户公司id", example = "25191")
|
||||
private Long customerCompanyId;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "合同名称", example = "芋艿")
|
||||
@ExcelProperty("合同名称")
|
||||
private String name;
|
||||
|
@ -0,0 +1,79 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory;
|
||||
|
||||
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.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
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 static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory.vo.*;
|
||||
import cn.iocoder.yudao.module.cms.service.extcontracthistory.ExtContractHistoryService;
|
||||
|
||||
@Tag(name = "管理后台 - 外部合同历史")
|
||||
@RestController
|
||||
@RequestMapping("/cms/ext-contract-history")
|
||||
@Validated
|
||||
public class ExtContractHistoryController {
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
private ExtContractHistoryService extContractHistoryService;
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新外部合同历史历史")
|
||||
@PreAuthorize("@ss.hasPermission('cms:ext-contract-history:update')")
|
||||
public CommonResult<Boolean> updateExtContractHistory(@Valid @RequestBody ExtContractHistorySaveReqVO updateReqVO) {
|
||||
extContractHistoryService.updateExtContractHistory(getLoginUserId(),updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得外部合同历史历史")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('cms:ext-contract-history:query')")
|
||||
public CommonResult<ExtContractHistoryRespVO> getExtContractHistory(@RequestParam("id") Long id) {
|
||||
ExtContractHistoryRespVO extContractHistory = extContractHistoryService.getExtContractHistory(id);
|
||||
return success(extContractHistory);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得外部合同历史历史分页")
|
||||
@PreAuthorize("@ss.hasPermission('cms:ext-contract-history:query')")
|
||||
public CommonResult<PageResult<ExtContractHistoryRespVO>> getExtContractHistoryPage(@Valid ExtContractHistoryPageReqVO pageReqVO) {
|
||||
PageResult<ExtContractHistoryRespVO> pageResult = extContractHistoryService.getExtContractHistoryPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出外部合同历史历史 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('cms:ext-contract-history:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportExtContractHistoryExcel(@Valid ExtContractHistoryPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ExtContractHistoryRespVO> list = extContractHistoryService.getExtContractHistoryPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "外部合同历史历史.xls", "数据", ExtContractHistoryRespVO.class,
|
||||
BeanUtils.toBean(list, ExtContractHistoryRespVO.class));
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
|
||||
@Schema(description = "管理后台 - 外部合同分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ExtContractHistoryPageReqVO extends PageParam {
|
||||
|
||||
|
||||
@Schema(description = "项目id", example = "6935")
|
||||
private Long projectId;
|
||||
|
||||
@Schema(description = "合同名称", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "合同类型", example = "1")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "客户公司id", example = "28989")
|
||||
private Long customerCompanyId;
|
||||
|
||||
@Schema(description = "状态", example = "1")
|
||||
private String status;
|
||||
|
||||
|
||||
@Schema(description = "流程实体id", example = "8911")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "流程状态", example = "2")
|
||||
private String processStatus;
|
||||
|
||||
@Schema(description = "合同id", example = "26795")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "外部合同id", example = "12093")
|
||||
private Long extContractId;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
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")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ExtContractHistoryRespVO {
|
||||
|
||||
|
||||
@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")
|
||||
@ExcelProperty("客户公司id")
|
||||
private Long customerCompanyId;
|
||||
|
||||
@Schema(description = "合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("合同金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
|
||||
@Schema(description = "合同名称", example = "张三")
|
||||
@ExcelProperty("合同名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "合同类型", example = "1")
|
||||
@ExcelProperty("合同类型")
|
||||
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 = "1")
|
||||
@ExcelProperty("状态")
|
||||
private String status;
|
||||
|
||||
|
||||
|
||||
@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 String otherFee;
|
||||
|
||||
@Schema(description = "计费方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@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;
|
||||
|
||||
@Schema(description = "建安费")
|
||||
@ExcelProperty("建安费")
|
||||
private BigDecimal constructionCost;
|
||||
|
||||
@Schema(description = "资金来源")
|
||||
@ExcelProperty(value = "资金来源", converter = DictConvert.class)
|
||||
@DictFormat("funds_source") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String source;
|
||||
|
||||
@Schema(description = "收费标准", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("收费标准")
|
||||
private String chargingStandard;
|
||||
|
||||
@Schema(description = "优惠", example = "7511")
|
||||
@ExcelProperty("优惠")
|
||||
private String 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", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("审核文件url")
|
||||
private String reviewFileUrl;
|
||||
|
||||
@Schema(description = "流程实体id", example = "8911")
|
||||
@ExcelProperty("流程实体id")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "流程状态", example = "2")
|
||||
@ExcelProperty(value = "流程状态", converter = DictConvert.class)
|
||||
@DictFormat("bpm_process_instance_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String processStatus;
|
||||
|
||||
@Schema(description = "合同id", example = "26795")
|
||||
@ExcelProperty("合同id")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "外部合同id", example = "12093")
|
||||
@ExcelProperty("外部合同id")
|
||||
private Long extContractId;
|
||||
|
||||
@Schema(description = "版本")
|
||||
@ExcelProperty("版本")
|
||||
private String version;
|
||||
|
||||
}
|
@ -0,0 +1,145 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 外部合同新增/修改 Request VO")
|
||||
@Data
|
||||
public class ExtContractHistorySaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "17790")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6935")
|
||||
@NotNull(message = "项目id不能为空")
|
||||
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 = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "合同类型", example = "1")
|
||||
private String type;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "合同进展")
|
||||
private String progress;
|
||||
|
||||
@Schema(description = "预计签订时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "预计签订时间不能为空")
|
||||
private LocalDateTime expectedTime;
|
||||
|
||||
@Schema(description = "签订时间")
|
||||
private LocalDateTime signingTime;
|
||||
|
||||
@Schema(description = "归档时间")
|
||||
private LocalDateTime archiveTime;
|
||||
|
||||
@Schema(description = "状态", example = "1")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "合同金额不能为空")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "前期费用")
|
||||
private BigDecimal preAmount;
|
||||
|
||||
@Schema(description = "设计费")
|
||||
private BigDecimal designFee;
|
||||
|
||||
@Schema(description = "勘测费")
|
||||
private BigDecimal surveyFees;
|
||||
|
||||
@Schema(description = "检测费")
|
||||
private BigDecimal testingFee;
|
||||
|
||||
@Schema(description = "其他费")
|
||||
private String otherFee;
|
||||
|
||||
@Schema(description = "计费方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "计费方式不能为空")
|
||||
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 = "收费标准", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "收费标准不能为空")
|
||||
private String chargingStandard;
|
||||
|
||||
@Schema(description = "优惠", example = "7511")
|
||||
private String discount;
|
||||
|
||||
@Schema(description = "是否联合体", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "是否联合体不能为空")
|
||||
private Boolean consortium;
|
||||
|
||||
@Schema(description = "联合体单位")
|
||||
private String consortiumCompany;
|
||||
|
||||
@Schema(description = "合同提示时间")
|
||||
private LocalDateTime reminderTime;
|
||||
|
||||
@Schema(description = "审定金额")
|
||||
private BigDecimal approvedAmount;
|
||||
|
||||
@Schema(description = "审核文件url", example = "https://www.iocoder.cn")
|
||||
private String reviewFileUrl;
|
||||
|
||||
|
||||
@Schema(description = "流程状态", example = "2")
|
||||
private String processStatus;
|
||||
|
||||
@Schema(description = "合同id", example = "26795")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "外部合同id", example = "12093")
|
||||
private Long extContractId;
|
||||
|
||||
@Schema(description = "版本")
|
||||
private String version;
|
||||
|
||||
}
|
@ -0,0 +1,166 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.dataobject.extcontracthistory;
|
||||
|
||||
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_ext_contract_history")
|
||||
@KeySequence("cms_ext_contract_history_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ExtContractHistoryDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 合同类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 客户公司id
|
||||
*/
|
||||
private Long customerCompanyId;
|
||||
/**
|
||||
* 合同进展
|
||||
*/
|
||||
private String progress;
|
||||
/**
|
||||
* 预计签订时间
|
||||
*/
|
||||
private LocalDateTime expectedTime;
|
||||
/**
|
||||
* 签订时间
|
||||
*/
|
||||
private LocalDateTime signingTime;
|
||||
/**
|
||||
* 归档时间
|
||||
*/
|
||||
private LocalDateTime archiveTime;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 合同金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 前期费用
|
||||
*/
|
||||
private BigDecimal preAmount;
|
||||
/**
|
||||
* 设计费
|
||||
*/
|
||||
private BigDecimal designFee;
|
||||
/**
|
||||
* 勘测费
|
||||
*/
|
||||
private BigDecimal surveyFees;
|
||||
/**
|
||||
* 检测费
|
||||
*/
|
||||
private BigDecimal testingFee;
|
||||
/**
|
||||
* 其他费
|
||||
*/
|
||||
private String otherFee;
|
||||
/**
|
||||
* 计费方式
|
||||
*
|
||||
* 枚举 {@link //TODO contract_billing_type 对应的类}
|
||||
*/
|
||||
private String countType;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 合同附件url
|
||||
*/
|
||||
private String contractFileUrl;
|
||||
/**
|
||||
* 建安费
|
||||
*/
|
||||
private BigDecimal constructionCost;
|
||||
/**
|
||||
* 资金来源
|
||||
*
|
||||
* 枚举 {@link //TODO funds_source 对应的类}
|
||||
*/
|
||||
private String source;
|
||||
/**
|
||||
* 收费标准
|
||||
*/
|
||||
private String chargingStandard;
|
||||
/**
|
||||
* 优惠
|
||||
*/
|
||||
private String discount;
|
||||
/**
|
||||
* 是否联合体
|
||||
*/
|
||||
private Boolean consortium;
|
||||
/**
|
||||
* 联合体单位
|
||||
*/
|
||||
private String consortiumCompany;
|
||||
/**
|
||||
* 合同提示时间
|
||||
*/
|
||||
private LocalDateTime reminderTime;
|
||||
/**
|
||||
* 审定金额
|
||||
*/
|
||||
private BigDecimal approvedAmount;
|
||||
/**
|
||||
* 审核文件url
|
||||
*/
|
||||
private String reviewFileUrl;
|
||||
/**
|
||||
* 流程实体id
|
||||
*/
|
||||
private String processInstanceId;
|
||||
/**
|
||||
* 流程状态
|
||||
*
|
||||
* 枚举 {@link //TODO bpm_process_instance_status 对应的类}
|
||||
*/
|
||||
private String processStatus;
|
||||
/**
|
||||
* 合同id
|
||||
*/
|
||||
private Long contractId;
|
||||
/**
|
||||
* 外部合同id
|
||||
*/
|
||||
private Long extContractId;
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
private String version;
|
||||
|
||||
}
|
@ -21,30 +21,8 @@ public interface ExtContractMapper extends BaseMapperX<ExtContractDO> {
|
||||
.eqIfPresent(ExtContractDO::getType, reqVO.getType())
|
||||
.eqIfPresent(ExtContractDO::getCustomerCompanyId, reqVO.getCustomerCompanyId())
|
||||
.eqIfPresent(ExtContractDO::getProgress, reqVO.getProgress())
|
||||
.betweenIfPresent(ExtContractDO::getExpectedTime, reqVO.getExpectedTime())
|
||||
.betweenIfPresent(ExtContractDO::getSigningTime, reqVO.getSigningTime())
|
||||
.betweenIfPresent(ExtContractDO::getArchiveTime, reqVO.getArchiveTime())
|
||||
.eqIfPresent(ExtContractDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(ExtContractDO::getAmount, reqVO.getAmount())
|
||||
.eqIfPresent(ExtContractDO::getPreAmount, reqVO.getPreAmount())
|
||||
.eqIfPresent(ExtContractDO::getDesignFee, reqVO.getDesignFee())
|
||||
.eqIfPresent(ExtContractDO::getSurveyFees, reqVO.getSurveyFees())
|
||||
.eqIfPresent(ExtContractDO::getTestingFee, reqVO.getTestingFee())
|
||||
.eqIfPresent(ExtContractDO::getOtherFee, reqVO.getOtherFee())
|
||||
.eqIfPresent(ExtContractDO::getCountType, reqVO.getCountType())
|
||||
.eqIfPresent(ExtContractDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(ExtContractDO::getContractFileUrl, reqVO.getContractFileUrl())
|
||||
.eqIfPresent(ExtContractDO::getConstructionCost, reqVO.getConstructionCost())
|
||||
.eqIfPresent(ExtContractDO::getSource, reqVO.getSource())
|
||||
.eqIfPresent(ExtContractDO::getChargingStandard, reqVO.getChargingStandard())
|
||||
.eqIfPresent(ExtContractDO::getDiscount, reqVO.getDiscount())
|
||||
.eqIfPresent(ExtContractDO::getConsortium, reqVO.getConsortium())
|
||||
.eqIfPresent(ExtContractDO::getConsortiumCompany, reqVO.getConsortiumCompany())
|
||||
.eqIfPresent(ExtContractDO::getApprovedAmount, reqVO.getApprovedAmount())
|
||||
.eqIfPresent(ExtContractDO::getReviewFileUrl, reqVO.getReviewFileUrl())
|
||||
.eqIfPresent(ExtContractDO::getContractId, reqVO.getContractId())
|
||||
|
||||
);
|
||||
.eqIfPresent(ExtContractDO::getContractId, reqVO.getContractId()));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.mysql.extcontracthistory;
|
||||
|
||||
|
||||
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.extcontracthistory.ExtContractHistoryDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory.vo.*;
|
||||
|
||||
/**
|
||||
* 外部合同 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExtContractHistoryMapper extends BaseMapperX<ExtContractHistoryDO> {
|
||||
|
||||
default PageResult<ExtContractHistoryDO> selectPage(ExtContractHistoryPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ExtContractHistoryDO>()
|
||||
.eqIfPresent(ExtContractHistoryDO::getProjectId, reqVO.getProjectId())
|
||||
.likeIfPresent(ExtContractHistoryDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ExtContractHistoryDO::getType, reqVO.getType())
|
||||
.eqIfPresent(ExtContractHistoryDO::getCustomerCompanyId, reqVO.getCustomerCompanyId())
|
||||
.eqIfPresent(ExtContractHistoryDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(ExtContractHistoryDO::getProcessInstanceId, reqVO.getProcessInstanceId())
|
||||
.eqIfPresent(ExtContractHistoryDO::getProcessStatus, reqVO.getProcessStatus())
|
||||
.eqIfPresent(ExtContractHistoryDO::getContractId, reqVO.getContractId())
|
||||
.eqIfPresent(ExtContractHistoryDO::getExtContractId, reqVO.getExtContractId()));
|
||||
}
|
||||
|
||||
}
|
@ -56,8 +56,14 @@ public interface ExtContractService {
|
||||
|
||||
/**
|
||||
* 合同总金额
|
||||
* @param id
|
||||
* @param id 通过id计算
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getContractAmount(Long id);
|
||||
BigDecimal getContractAmountById(Long id);
|
||||
/**
|
||||
* 合同总金额
|
||||
* @param createReqVO 通过对象计算
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getContractAmount(ExtContractSaveReqVO createReqVO);
|
||||
}
|
@ -1,12 +1,16 @@
|
||||
package cn.iocoder.yudao.module.cms.service.extContract;
|
||||
|
||||
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.ExtContractRespVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractSaveReqVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.customerCompany.CustomerCompanyDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.extContract.ExtContractDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.extcontracthistory.ExtContractHistoryDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.customerCompany.CustomerCompanyMapper;
|
||||
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.ProjectApi;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectDetailRespDTO;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO;
|
||||
@ -18,9 +22,9 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.*;
|
||||
@ -35,6 +39,16 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_E
|
||||
@Validated
|
||||
public class ExtContractServiceImpl implements ExtContractService {
|
||||
|
||||
/**
|
||||
* 外部合同立项审批流程定义
|
||||
*/
|
||||
public static final String PROCESS_KEY = "ext_contract_init";
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
public static String VERSION = "1";
|
||||
|
||||
@Resource
|
||||
private ExtContractMapper extContractMapper;
|
||||
|
||||
@ -47,38 +61,137 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private BpmProcessInstanceApi processInstanceApi;
|
||||
|
||||
@Resource
|
||||
private ExtContractHistoryMapper extContractHistoryMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Long createExtContract(Long loginUserId,ExtContractSaveReqVO createReqVO) {
|
||||
if (createReqVO == null){
|
||||
public Long createExtContract(Long loginUserId, ExtContractSaveReqVO createReqVO) {
|
||||
|
||||
|
||||
if (createReqVO == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
if (loginUserId == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
ExtContractDO extContract = BeanUtils.toBean(createReqVO, ExtContractDO.class);
|
||||
//校验
|
||||
projectApi.validProjectExist(extContract.getProjectId());
|
||||
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
if (userName == null){
|
||||
if (userName == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
extContract.setCreator(userName);
|
||||
extContract.setUpdater(userName);
|
||||
extContractMapper.insert(extContract);
|
||||
|
||||
ExtContractDO extContract = BeanUtils.toBean(createReqVO, ExtContractDO.class);
|
||||
//校验
|
||||
Long projectId = extContract.getProjectId();
|
||||
projectApi.validProjectExist(projectId);
|
||||
|
||||
|
||||
//校验联表的字段是否和所联系的表内容相同
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
ProjectDetailRespDTO projectDetail = projectApi.getProjectDetailById(projectId);
|
||||
|
||||
// 需要联表查询
|
||||
// 1.项目编号 pms_project 直接 √
|
||||
// 2.主控部门(跟踪部门) pms_project找到的是id 需要联表 √
|
||||
// 3.项目经理 pms_project找到的是id 需要联表 √
|
||||
// 4.客户公司名称 pms_project 联表 √
|
||||
// 5.合同总金额 √
|
||||
// 6.合同商议提示(和分包提示不一样)√
|
||||
|
||||
//todo 待提取
|
||||
String code = createReqVO.getCode();
|
||||
String trackingDep = createReqVO.getTrackingDep();
|
||||
String projectManager = createReqVO.getProjectManager();
|
||||
String customerCompanyName = createReqVO.getCustomerCompanyName();
|
||||
//LocalDateTime exReminderTime = createReqVO.getExReminderTime();
|
||||
BigDecimal amount = createReqVO.getAmount();
|
||||
|
||||
|
||||
if (!project.getCode().equals(code)){
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
if (!projectDetail.getTrackingDepName().equals(trackingDep)){
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
if (!projectDetail.getProjectManagerName().equals(projectManager)){
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
String name = customerCompanyMapper.selectById(createReqVO.getCustomerCompanyId()).getName();
|
||||
if (!name.equals(customerCompanyName)){
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
if (!Objects.equals(amount, getContractAmount(createReqVO))){
|
||||
throw exception(PARAM_ERROR);
|
||||
}
|
||||
|
||||
|
||||
ExtContractDO extContractDO = BeanUtils.toBean(createReqVO, ExtContractDO.class);
|
||||
ExtContractRespVO contractRespVO = BeanUtils.toBean(extContractDO, ExtContractRespVO.class);
|
||||
extContractDO.setCreator(userName);
|
||||
extContractDO.setUpdater(userName);
|
||||
|
||||
|
||||
|
||||
//判断该合同是否已经存在,比较各个字段值是否完全一样
|
||||
//得到所有的合同?逐个比较?
|
||||
|
||||
|
||||
List<ExtContractDO> extContractList = extContractMapper.selectList("project_id",projectId);
|
||||
List<ExtContractRespVO> respVOList = BeanUtils.toBean(extContractList, ExtContractRespVO.class);
|
||||
|
||||
for (ExtContractRespVO respVO : respVOList) {
|
||||
if (respVO.equals(contractRespVO)){
|
||||
throw exception(CONTRACT_ALREADY_EXISTS);
|
||||
}
|
||||
}
|
||||
extContractMapper.insert(extContractDO);
|
||||
|
||||
|
||||
Long extContractId = extContractDO.getId();
|
||||
ExtContractHistoryDO extContractHistory = BeanUtils.toBean(extContractDO, ExtContractHistoryDO.class);
|
||||
|
||||
|
||||
// 启动流程,同时写入历史合同
|
||||
if (createReqVO.getId() == null) {
|
||||
String processInstanceId = processInstanceApi.createProcessInstance(loginUserId,
|
||||
new BpmProcessInstanceCreateReqDTO()
|
||||
.setProcessDefinitionKey(PROCESS_KEY).setBusinessKey(String.valueOf(extContractId)));
|
||||
|
||||
// 写入工作流编号
|
||||
extContractHistory.setProcessInstanceId(processInstanceId);
|
||||
extContractHistory.setExtContractId(extContractId);
|
||||
|
||||
Long count = extContractHistoryMapper.selectCount("project_id", projectId);
|
||||
if (count < 1) {
|
||||
extContractHistory.setVersion(VERSION);
|
||||
} else {
|
||||
extContractHistory.setVersion(String.valueOf(count+1));
|
||||
}
|
||||
|
||||
extContractHistory.setProcessStatus("0");
|
||||
extContractHistoryMapper.insert(extContractHistory);
|
||||
}
|
||||
|
||||
|
||||
//返回
|
||||
return extContract.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExtContract(Long loginUserId,ExtContractSaveReqVO updateReqVO) {
|
||||
public void updateExtContract(Long loginUserId, ExtContractSaveReqVO updateReqVO) {
|
||||
//校验
|
||||
if (updateReqVO == null){
|
||||
if (updateReqVO == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
|
||||
validateExtContractExists(updateReqVO.getId());
|
||||
projectApi.validProjectExist(updateReqVO.getProjectId());
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
if (userName == null){
|
||||
if (userName == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
// 更新
|
||||
@ -139,18 +252,18 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
|
||||
//合同总金额
|
||||
|
||||
BigDecimal contractAmount = getContractAmount(id);
|
||||
BigDecimal contractAmount = getContractAmountById(id);
|
||||
extContractRespVO.setAmount(contractAmount);
|
||||
|
||||
//合同商议提示 // TODO 待优化
|
||||
extContractRespVO.setExReminderTime(LocalDateTime.now());
|
||||
extContractRespVO.setExReminderTime(null);
|
||||
|
||||
return extContractRespVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ExtContractRespVO> getExtContractPage(ExtContractPageReqVO pageReqVO) {
|
||||
if (pageReqVO == null){
|
||||
if (pageReqVO == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@ -170,7 +283,7 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getContractAmount(Long id) {
|
||||
public BigDecimal getContractAmountById(Long id) {
|
||||
//前期+设计+地勘+其他+检测
|
||||
ExtContractDO extContract = extContractMapper.selectById(id);
|
||||
BigDecimal preAmount = new BigDecimal(String.valueOf(extContract.getPreAmount()));
|
||||
@ -181,6 +294,17 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
return preAmount.add(designFee).add(surveyFees).add(testingFee).add(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getContractAmount(ExtContractSaveReqVO extContractSaveReqVO) {
|
||||
//前期+设计+地勘+其他+检测
|
||||
BigDecimal preAmount = new BigDecimal(String.valueOf(extContractSaveReqVO.getPreAmount()));
|
||||
BigDecimal designFee = new BigDecimal(String.valueOf(extContractSaveReqVO.getDesignFee()));
|
||||
BigDecimal surveyFees = new BigDecimal(String.valueOf(extContractSaveReqVO.getSurveyFees()));
|
||||
BigDecimal testingFee = new BigDecimal(String.valueOf(extContractSaveReqVO.getTestingFee()));
|
||||
BigDecimal other = new BigDecimal(extContractSaveReqVO.getOtherFee());
|
||||
return preAmount.add(designFee).add(surveyFees).add(testingFee).add(other);
|
||||
}
|
||||
|
||||
|
||||
private void validateExtContractExists(Long id) {
|
||||
if (extContractMapper.selectById(id) == null) {
|
||||
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.cms.service.extcontracthistory;
|
||||
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory.vo.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 外部合同历史历史 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface ExtContractHistoryService {
|
||||
/**
|
||||
* 更新外部合同历史历史
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateExtContractHistory(Long loginUserId,@Valid ExtContractHistorySaveReqVO updateReqVO);
|
||||
/**
|
||||
* 获得外部合同历史历史
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 外部合同历史历史
|
||||
*/
|
||||
ExtContractHistoryRespVO getExtContractHistory(Long id);
|
||||
|
||||
/**
|
||||
* 获得外部合同历史历史分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 外部合同历史历史分页
|
||||
*/
|
||||
PageResult<ExtContractHistoryRespVO> getExtContractHistoryPage(ExtContractHistoryPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,155 @@
|
||||
package cn.iocoder.yudao.module.cms.service.extcontracthistory;
|
||||
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.customerCompany.CustomerCompanyDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.customerCompany.CustomerCompanyMapper;
|
||||
import cn.iocoder.yudao.module.cms.service.extContract.ExtContractService;
|
||||
import cn.iocoder.yudao.module.pms.api.ProjectApi;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectDetailRespDTO;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory.vo.*;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.extcontracthistory.ExtContractHistoryDO;
|
||||
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.extcontracthistory.ExtContractHistoryMapper;
|
||||
|
||||
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 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ExtContractHistoryServiceImpl implements ExtContractHistoryService {
|
||||
|
||||
@Resource
|
||||
private ExtContractHistoryMapper extContractHistoryMapper;
|
||||
|
||||
@Resource
|
||||
private ProjectApi projectApi;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private CustomerCompanyMapper customerCompanyMapper;
|
||||
|
||||
@Resource
|
||||
private ExtContractService extContractService;
|
||||
|
||||
@Override
|
||||
public void updateExtContractHistory(Long loginUserId,ExtContractHistorySaveReqVO updateReqVO) {
|
||||
//校验
|
||||
if (updateReqVO == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
|
||||
validateExtContractHistoryExists(updateReqVO.getId());
|
||||
projectApi.validProjectExist(updateReqVO.getProjectId());
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
if (userName == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
//校验customer_id contract_id extract_id
|
||||
|
||||
|
||||
// 更新
|
||||
ExtContractHistoryDO updateObj = BeanUtils.toBean(updateReqVO, ExtContractHistoryDO.class);
|
||||
updateObj.setUpdater(userName);
|
||||
extContractHistoryMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtContractHistoryRespVO getExtContractHistory(Long id) {
|
||||
//校验
|
||||
if (id == null) {
|
||||
throw exception(EXT_CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
ExtContractHistoryDO extContractHistoryDO = extContractHistoryMapper.selectById(id);
|
||||
if (extContractHistoryDO == null) {
|
||||
throw exception(EXT_CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long projectId = extContractHistoryDO.getProjectId();
|
||||
if (projectApi.getProject(projectId) == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long customerCompanyId = extContractHistoryDO.getCustomerCompanyId();
|
||||
ExtContractHistoryRespVO HistoryResp = BeanUtils.toBean(extContractHistoryDO, ExtContractHistoryRespVO.class);
|
||||
|
||||
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
HistoryResp.setCode(project.getCode());
|
||||
|
||||
ProjectDetailRespDTO projectDetail = projectApi.getProjectDetailById(projectId);
|
||||
HistoryResp.setTrackingDep(projectDetail.getTrackingDepName());
|
||||
HistoryResp.setProjectManager(projectDetail.getProjectManagerName());
|
||||
|
||||
//用客户公司id查询
|
||||
CustomerCompanyDO customerCompanyDO = customerCompanyMapper.selectById(customerCompanyId);
|
||||
String name = customerCompanyDO.getName();
|
||||
HistoryResp.setCustomerCompanyName(name);
|
||||
|
||||
|
||||
//合同总金额
|
||||
|
||||
BigDecimal contractAmount = extContractService.getContractAmountById(id);
|
||||
HistoryResp.setAmount(contractAmount);
|
||||
|
||||
//合同商议提示 // TODO 待优化
|
||||
HistoryResp.setExReminderTime(null);
|
||||
|
||||
return HistoryResp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ExtContractHistoryRespVO> getExtContractHistoryPage(ExtContractHistoryPageReqVO pageReqVO) {
|
||||
//校验
|
||||
if (pageReqVO == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long projectId = pageReqVO.getProjectId();
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
if (project == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
PageResult<ExtContractHistoryDO> extContractHistoryPageResult = extContractHistoryMapper.selectPage(pageReqVO);
|
||||
List<ExtContractHistoryDO> pageResultList = extContractHistoryPageResult.getList();
|
||||
List<ExtContractHistoryRespVO> contractHistoryRespVOS = new ArrayList<>();
|
||||
|
||||
|
||||
for (ExtContractHistoryDO extContractHistoryDO : pageResultList) {
|
||||
Long id = extContractHistoryDO.getId();
|
||||
ExtContractHistoryRespVO extContractHistory = getExtContractHistory(id);
|
||||
contractHistoryRespVOS.add(extContractHistory);
|
||||
}
|
||||
|
||||
PageResult<ExtContractHistoryRespVO> pageResult = new PageResult<>();
|
||||
pageResult.setList(contractHistoryRespVOS);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
|
||||
private void validateExtContractHistoryExists(Long id) {
|
||||
if (extContractHistoryMapper.selectById(id) == null) {
|
||||
throw exception(EXT_CONTRACT_HISTORY_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user