[fix] 优化历史预算管理功能

This commit is contained in:
shl
2024-08-20 16:19:22 +08:00
parent 67dcab5a0f
commit 5a6c76f8cb
43 changed files with 1007 additions and 619 deletions

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.module.cms.enums.DictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
@@ -27,4 +28,9 @@ public class ContractPageReqVO extends PageParam {
@Schema(description = "计费方式", example = "1")
@DictFormat(DictTypeConstants.COUNT_TYPE)
private String countType;
@Schema(description = "外部合同id", example = "28")
@ExcelProperty("合同id")
private Long extContractId;
}

View File

@@ -29,7 +29,9 @@ public class ContractRespVO {
@ExcelProperty("项目id")
private Long projectId;
@Schema(description = "外部合同id", example = "13085")
@ExcelProperty("合同id")
private Long extContractId;
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
@@ -150,4 +152,4 @@ public class ContractRespVO {
@ExcelProperty("最后编辑人")
private String finalEditor;
}
}

View File

@@ -25,7 +25,9 @@ public class ContractSaveReqVO {
@ExcelProperty("项目id")
private Long projectId;
@Schema(description = "外部合同id", example = "13085")
@ExcelProperty("合同id")
private Long extContractId;
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
@ExcelProperty("项目编号")
@@ -145,4 +147,4 @@ public class ContractSaveReqVO {
@ExcelProperty("最后编辑人")
private String finalEditor;
}
}

View File

@@ -14,129 +14,10 @@ import java.time.LocalDateTime;
@Data
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")
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")
@DictFormat(DictTypeConstants.PROCESS_STATUS)
private String processStatus;
@@ -147,4 +28,4 @@ public class ContractHistorySaveReqVO {
@Schema(description = "版本")
private String version;
}
}

View File

@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.cms.controller.admin.extContract;
import cn.iocoder.yudao.framework.common.util.file.FileUtils;
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractPageReqVO;
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractProcessInstanceRespVO;
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.extcontract.ExtContractDetailDO;
@@ -16,6 +17,7 @@ import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
@@ -23,11 +25,13 @@ 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;
@@ -45,14 +49,14 @@ public class ExtContractController {
@Operation(summary = "创建外部合同")
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:create')")
public CommonResult<Long> createExtContract(@Valid @RequestBody ExtContractSaveReqVO createReqVO) {
return success(extContractService.createExtContract(getLoginUserId(),createReqVO));
return success(extContractService.createExtContract(getLoginUserId(), createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新外部合同")
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:update')")
public CommonResult<Boolean> updateExtContract(@Valid @RequestBody ExtContractSaveReqVO updateReqVO) {
extContractService.updateExtContract(getLoginUserId(),updateReqVO);
extContractService.updateExtContract(getLoginUserId(), updateReqVO);
return success(true);
}
@@ -92,12 +96,28 @@ public class ExtContractController {
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportExtContractExcel(@Valid ExtContractPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ExtContractRespVO> list = extContractService.getExtContractPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "外部合同.xls", "数据", ExtContractRespVO.class,
BeanUtils.toBean(list, ExtContractRespVO.class));
BeanUtils.toBean(list, ExtContractRespVO.class));
}
}
@PostMapping("/create_process")
@Operation(summary = "创建流程")
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:create')")
public CommonResult<String> createExtContractProcess(@RequestParam("id") Long id) {
String processId = extContractService.createProcess(getLoginUserId(), id);
return success(processId);
}
@PostMapping("/get_process")
@Operation(summary = "查询流程")
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:create')")
public CommonResult<ExtContractProcessInstanceRespVO> getExtContractProcessInstance(@RequestParam("id") Long id) {
ExtContractProcessInstanceRespVO process = extContractService.getProcess(id);
return success(process);
}
}

View File

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

View File

@@ -0,0 +1,223 @@
package cn.iocoder.yudao.module.cms.controller.admin.extContract.vo;
import cn.iocoder.yudao.framework.common.pojo.FileDTO;
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 com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@Schema(description = "管理后台 - 外部合同 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ExtContractProcessInstanceRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "964")
@ExcelProperty("主键")
private Long id;
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16261")
@ExcelProperty("项目id")
private Long projectId;
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
@ExcelProperty("项目编号")
private String code;
@Schema(description = "客户名称")
@ExcelProperty("客户名称")
private String constructionSide;
@Schema(description = "主控部门", requiredMode = Schema.RequiredMode.REQUIRED, example = "生产一部")
@ExcelProperty("主控部门")
private String trackingDep;
@Schema(description = "项目负责人", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("项目负责人")
private String projectManager;
@Schema(description = "外部合同商议提示时间")
@ExcelProperty("外部合同商议提示时间")
private LocalDateTime exReminderTime;
@Schema(description = "合同名称", example = "赵六")
@ExcelProperty("合同名称")
private String name;
@Schema(description = "合同类型", example = "2")
@ExcelProperty(value = "合同类型", converter = DictConvert.class)
@DictFormat(DictTypeConstants.CONTRACT_TYPE)
private String type;
@Schema(description = "合同进展")
@ExcelProperty("合同进展")
private String progress;
@Schema(description = "预计签订时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("预计签订时间")
private LocalDateTime expectedTime;
@Schema(description = "签订时间")
@ExcelProperty("签订时间")
private LocalDateTime signingTime;
@Schema(description = "归档时间")
@ExcelProperty("归档时间")
private LocalDateTime archiveTime;
@Schema(description = "状态", example = "2")
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(DictTypeConstants.CONTRACT_STATUS)
private String status;
@Schema(description = "合同总金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("合同总金额")
private BigDecimal amount;
@Schema(description = "前期费用")
@ExcelProperty("前期费用")
private BigDecimal preAmount;
@Schema(description = "设计费")
@ExcelProperty("设计费")
private BigDecimal designFee;
@Schema(description = "勘测费")
@ExcelProperty("勘测费")
private BigDecimal surveyFees;
@Schema(description = "检测费")
@ExcelProperty("检测费")
private BigDecimal testingFee;
@Schema(description = "其他费")
@ExcelProperty("其他费")
private BigDecimal otherFee;
@Schema(description = "计费方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "计费方式", converter = DictConvert.class)
@DictFormat(DictTypeConstants.COUNT_TYPE)
private String countType;
@Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark;
@Schema(description = "合同附件url")
@ExcelProperty("合同附件url")
private List<FileDTO> contractFileUrl;
@Schema(description = "建安费")
@ExcelProperty("建安费")
private BigDecimal constructionCost;
@Schema(description = "资金来源")
@ExcelProperty(value = "资金来源", converter = DictConvert.class)
@DictFormat(DictTypeConstants.SOURCE)
private String source;
@Schema(description = "收费标准", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty(value = "收费标准", converter = DictConvert.class)
@DictFormat(DictTypeConstants.CHARGING_STANDARD)
private String chargingStandard;
@Schema(description = "优惠", example = "123")
@ExcelProperty("优惠")
private BigDecimal discount;
@Schema(description = "是否联合体", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("是否联合体")
private Boolean consortium;
@Schema(description = "联合体单位")
@ExcelProperty("联合体单位")
private String consortiumCompany;
@Schema(description = "合同商议提示")
@ExcelProperty("合同商议提示")
private LocalDateTime reminderTime;
@Schema(description = "审定金额")
@ExcelProperty("审定金额")
private BigDecimal approvedAmount;
@Schema(description = "审核文件url")
@ExcelProperty("审核文件url")
private List<FileDTO> reviewFileUrl;
@Schema(description = "最后编辑人")
@ExcelProperty("最后编辑人")
private String finalEditor;
@Schema(description = "流程名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
private String processName;
@Schema(description = "流程实例的状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer processStatus; // 参见 BpmProcessInstanceStatusEnum 枚举
@Schema(description = "发起时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime startTime;
@Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime endTime;
@Schema(description = "持续时间", example = "1000")
private Long durationInMillis;
/**
* 发起流程的用户
*/
private User startUser;
/**
* 当前审批中的任务
*/
private List<Task> tasks; // 仅在流程实例分页才返回
@Schema(description = "用户信息")
@Data
public static class User {
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long id;
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
private String nickname;
@Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long deptId;
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "研发部")
private String deptName;
}
@Schema(description = "流程任务")
@Data
public static class Task {
@Schema(description = "流程任务的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private String id;
@Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
private String name;
}
}

View File

@@ -21,10 +21,6 @@ public class ExtContractRespVO {
@ExcelProperty("主键")
private Long id;
@Schema(description = "合同id", example = "13085")
@ExcelProperty("合同id")
private Long contractId;
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16261")
@ExcelProperty("项目id")
private Long projectId;
@@ -164,4 +160,4 @@ public class ExtContractRespVO {
@Schema(description = "最后编辑人")
@ExcelProperty("最后编辑人")
private String finalEditor;
}
}

View File

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

View File

@@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory;
import cn.iocoder.yudao.framework.common.util.file.FileUtils;
import cn.iocoder.yudao.module.cms.dal.dataobject.extcontracthistory.ExtContractHistoryDetailDO;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@@ -34,8 +36,6 @@ import cn.iocoder.yudao.module.cms.service.extcontracthistory.ExtContractHistory
@Validated
public class ExtContractHistoryController {
@Resource
private ExtContractHistoryService extContractHistoryService;
@@ -52,8 +52,13 @@ public class ExtContractHistoryController {
@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);
ExtContractHistoryDetailDO extContractHistoryDetail = extContractHistoryService.getContractDetail(id);
ExtContractHistoryRespVO contractHistoryRespVO = new ExtContractHistoryRespVO();
org.springframework.beans.BeanUtils.copyProperties(extContractHistoryDetail, contractHistoryRespVO, "contractFileUrl", "reviewFileUrl");
contractHistoryRespVO.setReviewFileUrl(FileUtils.covertJSONStringToFile(extContractHistoryDetail.getReviewFileUrl()));
contractHistoryRespVO.setContractFileUrl(FileUtils.covertJSONStringToFile(extContractHistoryDetail.getContractFileUrl()));
return success(contractHistoryRespVO);
}
@GetMapping("/page")
@@ -69,11 +74,13 @@ public class ExtContractHistoryController {
@PreAuthorize("@ss.hasPermission('cms:ext-contract-history:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportExtContractHistoryExcel(@Valid ExtContractHistoryPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
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));
BeanUtils.toBean(list, ExtContractHistoryRespVO.class));
}
}
}

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.cms.dal.dataobject.contract;
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 java.time.LocalDateTime;
@@ -34,7 +36,10 @@ public class ContractDO extends BaseDO {
* 项目id
*/
private Long projectId;
/**
* 外部合同id
*/
private Long extContractId;
/**
* 合同名称
*/
@@ -126,4 +131,4 @@ public class ContractDO extends BaseDO {
*/
private String finalEditor;
}
}

View File

@@ -22,7 +22,6 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
@NoArgsConstructor
@AllArgsConstructor
public class ContractHistoryDO extends BaseDO {
/**
* 主键
*/
@@ -32,10 +31,24 @@ public class ContractHistoryDO extends BaseDO {
* 项目id
*/
private Long projectId;
/**
* 流程状态
*/
private String processStatus;
/**
* 该合同的id
*/
private Long contractId;
/**
* 版本
*/
private String version;
/**
* 流程实体id
*/
private String processInstanceId;
/**
* 合同名称
*/
@@ -66,12 +79,22 @@ public class ContractHistoryDO extends BaseDO {
private LocalDateTime archiveTime;
/**
* 合同状态
* 枚举 {@link cn.iocoder.yudao.module.cms.enums.DictTypeConstants}
*/
private String status;
/**
* 签订合同总额
*/
private BigDecimal amount;
/**
* 计费方式
* 枚举 {@link cn.iocoder.yudao.module.cms.enums.DictTypeConstants}
*/
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 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;
}
private String finalEditor;
}

View File

@@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.cms.dal.dataobject.contractHistory;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class ContractHistoryDetailDO extends ContractHistoryDO {
/**
* 项目编号
*/
private String code;
/**
* 跟踪部门
*/
private String trackingDep;
/**
* 出图公司
*/
private String drawingCompany;
/**
* 预计公司合同总金额
*/
private BigDecimal expectedContractAmount;
/**
* 项目负责人
*/
private String projectManager;
/**
* 合同商议提示
*/
private LocalDateTime reminderTime;
}

View File

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

View File

@@ -4,11 +4,6 @@ import lombok.Data;
import java.time.LocalDateTime;
/**
* @author wyw
* @description
* @date 2024/8/14
*/
@Data
public class ExtContractDetailDO extends ExtContractDO {
/**

View File

@@ -1,15 +1,13 @@
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
* 外部合同历史 DO
*
* @author 管理员
*/
@@ -40,10 +38,6 @@ public class ExtContractHistoryDO extends BaseDO {
* 合同类型
*/
private String type;
/**
* 客户公司id
*/
private Long customerCompanyId;
/**
* 合同进展
*/
@@ -65,7 +59,7 @@ public class ExtContractHistoryDO extends BaseDO {
*/
private String status;
/**
* 合同金额
* 合同金额
*/
private BigDecimal amount;
/**
@@ -87,11 +81,9 @@ public class ExtContractHistoryDO extends BaseDO {
/**
* 其他费
*/
private String otherFee;
private BigDecimal otherFee;
/**
* 计费方式
*
* 枚举 {@link //TODO contract_billing_type 对应的类}
*/
private String countType;
/**
@@ -108,18 +100,17 @@ public class ExtContractHistoryDO extends BaseDO {
private BigDecimal constructionCost;
/**
* 资金来源
*
* 枚举 {@link //TODO funds_source 对应的类}
*/
private String source;
/**
* 收费标准
*
*/
private String chargingStandard;
/**
* 优惠
*/
private String discount;
private BigDecimal discount;
/**
* 是否联合体
*/
@@ -129,7 +120,7 @@ public class ExtContractHistoryDO extends BaseDO {
*/
private String consortiumCompany;
/**
* 合同提示时间
* 合同商议提示
*/
private LocalDateTime reminderTime;
/**
@@ -140,20 +131,18 @@ public class ExtContractHistoryDO extends BaseDO {
* 审核文件url
*/
private String reviewFileUrl;
/**
* 最后编辑人
*/
private String finalEditor;
/**
* 流程实体id
*/
private String processInstanceId;
/**
* 流程状态
*
* 枚举 {@link //TODO bpm_process_instance_status 对应的类}
*/
private String processStatus;
/**
* 合同id
*/
private Long contractId;
private Integer processStatus;
/**
* 外部合同id
*/
@@ -163,4 +152,5 @@ public class ExtContractHistoryDO extends BaseDO {
*/
private String version;
}
}

View File

@@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.cms.dal.dataobject.extcontracthistory;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class ExtContractHistoryDetailDO extends ExtContractHistoryDO {
/**
* 项目编号
*/
private String code;
/**
* 建设方
*/
private String constructionSide;
/**
* 主控部门
*/
private String trackingDep;
/**
* 项目负责人
*/
private String projectManager;
/**
* 外部合同商议提示
*/
private LocalDateTime exReminderTime;
}

View File

@@ -22,13 +22,7 @@ public interface ExtContractMapper extends BaseMapperX<ExtContractDO> {
.eqIfPresent(ExtContractDO::getProjectId, reqVO.getProjectId())
.eqIfPresent(ExtContractDO::getType, reqVO.getType())
.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;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
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.*;
/**
* 外部合同 Mapper
* 外部合同历史 Mapper
*
* @author 管理员
*/
@@ -21,12 +22,12 @@ public interface ExtContractHistoryMapper extends BaseMapperX<ExtContractHistory
.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()));
.eqIfPresent(ExtContractHistoryDO::getExtContractId, reqVO.getExtContractId())
);
}
}
}

View File

@@ -60,7 +60,4 @@ public interface ContractService {
*/
ContractDetailDO getContractDetail(Long id);
}

View File

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

View File

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

View File

@@ -2,15 +2,13 @@ package cn.iocoder.yudao.module.cms.service.extContract;
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractPageReqVO;
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractProcessInstanceRespVO;
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.extcontract.ExtContractDetailDO;
import jakarta.validation.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import java.time.LocalDateTime;
import java.util.List;
/**
* 外部合同 Service 接口
*
@@ -57,10 +55,24 @@ public interface ExtContractService {
PageResult<ExtContractRespVO> getExtContractPage(ExtContractPageReqVO pageReqVO);
/**
* 得到合同商议时间
* @param contractId 合同id
*
* @param loginUserId 当前登录的用户id
* @param id 外部合同id
* @return 流程id
*/
String createProcess(Long loginUserId,Long id);
/**
* 判断外部合同是否存在
* @param id 外部合同id
*/
void validateExtContractExists(Long id);
/**
* 查询流程
* @param id 外部合同id
* @return
*/
LocalDateTime getLocalDateTime(Long contractId);
}
ExtContractProcessInstanceRespVO getProcess(Long id);
}

View File

@@ -1,11 +1,19 @@
package cn.iocoder.yudao.module.cms.service.extContract;
import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.framework.common.util.file.FileUtils;
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceGetRespDTO;
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractPageReqVO;
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractProcessInstanceRespVO;
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.extcontract.ExtContractDO;
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.extcontracthistory.ExtContractHistoryMapper;
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.projecttracking.ProjectTrackingApi;
@@ -17,11 +25,11 @@ import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.PROCESS_INSTANCE_NOT_END;
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.*;
/**
@@ -33,6 +41,11 @@ import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.*;
@Validated
public class ExtContractServiceImpl implements ExtContractService {
/**
* 外部合同审批流程定义
*/
public static final String PROCESS_KEY = "ext_contract_init";
@Resource
private ExtContractMapper extContractMapper;
@@ -45,27 +58,58 @@ public class ExtContractServiceImpl implements ExtContractService {
@Resource
private ProjectScheduleApi projectScheduleApi;
@Resource
private BpmProcessInstanceApi processInstanceApi;
@Resource
private ExtContractHistoryMapper extContractHistoryMapper;
@Resource
private BpmProcessInstanceApi bpmProcessInstanceApi;
@Override
public Long createExtContract(Long loginUserId, ExtContractSaveReqVO createReqVO) {
//插入外部合同表
String userName = adminUserApi.getUser(loginUserId).getNickname();
//校验,项目是否存在
Long contractId = createReqVO.getContractId();
String name = createReqVO.getName();
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) {
if (extContractDO.getName().equals(trimName)){
if (extContractDO.getName().equals(trimName)) {
throw exception(EXT_CONTRACT_EXISTS);
}
}
ExtContractDO extContract = BeanUtils.toBean(createReqVO, ExtContractDO.class);
extContract.setReviewFileUrl(FileUtils.covertFileToJSONString(createReqVO.getReviewFileUrl()));
extContract.setContractFileUrl(FileUtils.covertFileToJSONString(createReqVO.getContractFileUrl()));
extContract.setCreator(userName);
extContract.setUpdater(userName);
//也要插入历史
ExtContractHistoryDO extContractHistoryDO = BeanUtils.toBean(extContract, ExtContractHistoryDO.class);
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();
}
@@ -103,8 +147,8 @@ public class ExtContractServiceImpl implements ExtContractService {
ProjectScheduleDetailDTO projectScheduleDetail = projectScheduleApi.getProjectScheduleDetail(projectId);
ProjectTrackingDetailDTO projectTracking = projectTrackingApi.getProjectTracking(projectId);
BeanUtil.copyProperties(extContractDO, extContractDetailDO);
BeanUtil.copyProperties(projectTracking,extContractDetailDO);
BeanUtil.copyProperties(projectScheduleDetail,extContractDetailDO);
BeanUtil.copyProperties(projectTracking, extContractDetailDO);
BeanUtil.copyProperties(projectScheduleDetail, extContractDetailDO);
return extContractDetailDO;
}
@@ -127,16 +171,42 @@ public class ExtContractServiceImpl implements ExtContractService {
}
@Override
public LocalDateTime getLocalDateTime(Long contractId) {
List<ExtContractDO> extContractDOS = extContractMapper.selectLocalDateTime(contractId);
return extContractDOS.get(0).getReminderTime();
public String createProcess(Long loginUserId, Long id) {
//拿出该合同的当前流程
ExtContractHistoryDO extContractHistoryDO = extContractHistoryMapper.selectOne("ext_contract_id", id);
String processInstanceId0 = extContractHistoryDO.getProcessInstanceId();
//流程引擎里的最新状态
Integer status = bpmProcessInstanceApi.getProcessInstance(processInstanceId0).getStatus();
if (status == 1) {
throw exception(PROCESS_INSTANCE_NOT_END);
}
//创建新的流程
String processInstanceId = processInstanceApi.createProcessInstance(loginUserId,
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
.setBusinessKey(String.valueOf(id)));
// 写入工作流编号
extContractHistoryMapper.updateById(extContractHistoryDO.setProcessInstanceId(processInstanceId).setProcessStatus(status));
return processInstanceId;
}
@Override
public ExtContractProcessInstanceRespVO getProcess(Long id) {
ExtContractHistoryDO extContractHistoryDO = extContractHistoryMapper.selectOne("ext_contract_id", id);
String processInstanceId = extContractHistoryDO.getProcessInstanceId();
BpmProcessInstanceGetRespDTO processInstance = processInstanceApi.getProcessInstance(processInstanceId);
ExtContractProcessInstanceRespVO extContractProcessInstanceRespVO = new ExtContractProcessInstanceRespVO();
BeanUtil.copyProperties(processInstance, extContractProcessInstanceRespVO);
extContractHistoryDO.setProcessStatus(processInstance.getStatus());
private void validateExtContractExists(Long id) {
return extContractProcessInstanceRespVO;
}
public void validateExtContractExists(Long id) {
if (extContractMapper.selectById(id) == null) {
throw exception(EXT_CONTRACT_NOT_EXISTS);
}
}
}
}

View File

@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.cms.service.extcontracthistory;
import cn.iocoder.yudao.module.cms.dal.dataobject.extcontracthistory.ExtContractHistoryDetailDO;
import jakarta.validation.*;
import cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory.vo.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
@@ -32,4 +33,12 @@ public interface ExtContractHistoryService {
*/
PageResult<ExtContractHistoryRespVO> getExtContractHistoryPage(ExtContractHistoryPageReqVO pageReqVO);
}
/**
* 获取外部合同历史基本信息
* @param id 外部合同历史id
* @return
*/
ExtContractHistoryDetailDO getContractDetail(Long id);
}

View File

@@ -1,6 +1,15 @@
package cn.iocoder.yudao.module.cms.service.extcontracthistory;
import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractRespVO;
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.extcontracthistory.ExtContractHistoryDetailDO;
import cn.iocoder.yudao.module.cms.service.extContract.ExtContractService;
import cn.iocoder.yudao.module.pms.api.projectschedule.ProjectScheduleApi;
import cn.iocoder.yudao.module.pms.api.projectschedule.dto.ProjectScheduleDetailDTO;
import cn.iocoder.yudao.module.pms.api.projecttracking.ProjectTrackingApi;
import cn.iocoder.yudao.module.pms.api.projecttracking.dto.ProjectTrackingDetailDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
@@ -35,26 +44,22 @@ public class ExtContractHistoryServiceImpl implements ExtContractHistoryService
@Resource
private AdminUserApi adminUserApi;
@Resource
private ExtContractService extContractService;
@Resource
private ProjectTrackingApi projectTrackingApi;
@Resource
private ProjectScheduleApi projectScheduleApi;
@Override
public void updateExtContractHistory(Long loginUserId,ExtContractHistorySaveReqVO updateReqVO) {
//校验
if (updateReqVO == null) {
throw exception(PARAM_NOT_EXISTS);
}
validateExtContractHistoryExists(updateReqVO.getId());
extContractService.validateExtContractExists(updateReqVO.getExtContractId());
projectTrackingApi.validateProjectExists(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);
@@ -82,25 +87,38 @@ public class ExtContractHistoryServiceImpl implements ExtContractHistoryService
@Override
public PageResult<ExtContractHistoryRespVO> getExtContractHistoryPage(ExtContractHistoryPageReqVO pageReqVO) {
//校验
if (pageReqVO == null) {
throw exception(PARAM_NOT_EXISTS);
}
PageResult<ExtContractHistoryDO> extContractHistoryPage = extContractHistoryMapper.selectPage(pageReqVO);
List<ExtContractHistoryDO> list = extContractHistoryPage.getList();
List<ExtContractHistoryDetailDO> extContractDetailDOList = new ArrayList<>();
PageResult<ExtContractHistoryDO> extContractHistoryPageResult = extContractHistoryMapper.selectPage(pageReqVO);
List<ExtContractHistoryDO> pageResultList = extContractHistoryPageResult.getList();
List<ExtContractHistoryRespVO> contractHistoryRespVOS = new ArrayList<>();
for (ExtContractHistoryDO extContractHistoryDO : pageResultList) {
for (ExtContractHistoryDO extContractHistoryDO : list) {
Long id = extContractHistoryDO.getId();
ExtContractHistoryRespVO extContractHistory = getExtContractHistory(id);
contractHistoryRespVOS.add(extContractHistory);
ExtContractHistoryDetailDO contractDetail = getContractDetail(id);
extContractDetailDOList.add(contractDetail);
}
List<ExtContractHistoryRespVO> respVOS = BeanUtils.toBean(extContractDetailDOList, ExtContractHistoryRespVO.class);
PageResult<ExtContractHistoryRespVO> pageResult = new PageResult<>();
pageResult.setList(respVOS);
return pageResult;
}
@Override
public ExtContractHistoryDetailDO getContractDetail(Long id) {
ExtContractHistoryDetailDO extContractDetailDO = new ExtContractHistoryDetailDO();
ExtContractHistoryDO extContractHistory = extContractHistoryMapper.selectById(id);
//校验
if (extContractHistory == null) {
throw exception(EXT_CONTRACT_HISTORY_NOT_EXISTS);
}
PageResult<ExtContractHistoryRespVO> pageResult = new PageResult<>();
pageResult.setList(contractHistoryRespVOS);
return pageResult;
Long projectId = extContractHistory.getProjectId();
ProjectScheduleDetailDTO projectScheduleDetail = projectScheduleApi.getProjectScheduleDetail(projectId);
ProjectTrackingDetailDTO projectTracking = projectTrackingApi.getProjectTracking(projectId);
BeanUtil.copyProperties(extContractHistory, extContractDetailDO);
BeanUtil.copyProperties(projectTracking, extContractDetailDO);
BeanUtil.copyProperties(projectScheduleDetail, extContractDetailDO);
return extContractDetailDO;
}
@@ -109,4 +127,4 @@ public class ExtContractHistoryServiceImpl implements ExtContractHistoryService
throw exception(EXT_CONTRACT_HISTORY_NOT_EXISTS);
}
}
}
}