3 Commits

Author SHA1 Message Date
shl
5a6c76f8cb [fix] 优化历史预算管理功能 2024-08-20 16:19:22 +08:00
shl
67dcab5a0f [fix] 优化预算管理功能 2024-08-19 15:55:38 +08:00
shl
98f295be74 [fix] 优化预算管理功能 2024-08-19 10:45:19 +08:00
60 changed files with 1415 additions and 704 deletions

View File

@@ -2,12 +2,9 @@ package cn.iocoder.yudao.module.bpm.api.task;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceRespDTO;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmTaskRespDTO;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceGetRespDTO;
import jakarta.validation.Valid;
import java.util.List;
/**
* 流程实例 Api 接口
*
@@ -24,20 +21,8 @@ public interface BpmProcessInstanceApi {
*/
String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqDTO reqDTO);
/**
* 查询流程
*
* @param id 流程id
* @return
* 获得流程实例
*/
BpmProcessInstanceRespDTO getProcessInstance(String id);
/**
* 查询指定流程的任务
* @param id 流程id
* @return
*/
List<BpmTaskRespDTO> getTask(String id);
BpmProcessInstanceGetRespDTO getProcessInstance(String processInstanceId);
}

View File

@@ -0,0 +1,86 @@
package cn.iocoder.yudao.module.bpm.api.task.dto;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* 流程实例的创建 Request DTO
*
* @author 芋道源码
*/
@Data
public class BpmProcessInstanceGetRespDTO {
/**
* 流程名
*/
private String name;
/**
* 发起流程的用户
*/
private User startUser;
@Data
public static class User {
/**
* 用户编号
*/
private Long id;
/**
* 用户昵称
*/
private String nickname;
/**
* 部门编号
*/
private Long deptId;
/**
* 部门名称
*/
private String deptName;
}
/**
* 流程实例状态
*/
private Integer status;
/**
* 当前审批中的任务
*/
private List<Task> tasks; // 仅在流程实例分页才返回
@Data
public static class Task {
/**
* 流程任务编号
*/
private String id;
/**
* 任务名称
*/
private String name;
}
/**
* 发起时间
*/
private LocalDateTime startTime;
/**
* 结束时间
*/
private LocalDateTime endTime;
/**
* 持续时间
*/
private Long durationInMillis;
}

View File

@@ -36,6 +36,7 @@ public interface ErrorCodeConstants {
ErrorCode PROCESS_INSTANCE_CANCEL_FAIL_NOT_SELF = new ErrorCode(1_009_004_002, "流程取消失败,该流程不是你发起的");
ErrorCode PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_CONFIG = new ErrorCode(1_009_004_003, "审批任务({})的审批人未配置");
ErrorCode PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_EXISTS = new ErrorCode(1_009_004_004, "审批任务({})的审批人({})不存在");
ErrorCode PROCESS_INSTANCE_NOT_END = new ErrorCode(1_009_004_005, "流程实例创建失败,该流程还未结束");
// ========== 流程任务 1-009-005-000 ==========
ErrorCode TASK_OPERATE_FAIL_ASSIGN_NOT_SELF = new ErrorCode(1_009_005_001, "操作失败,原因:该任务的审批人不是你");

View File

@@ -1,41 +1,28 @@
package cn.iocoder.yudao.module.bpm.api.task;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceRespDTO;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmTaskRespDTO;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceGetRespDTO;
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceRespVO;
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
import cn.iocoder.yudao.module.bpm.convert.task.BpmProcessInstanceConvert;
import cn.iocoder.yudao.module.bpm.convert.task.BpmTaskConvert;
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO;
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
import cn.iocoder.yudao.module.bpm.service.definition.BpmFormService;
import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService;
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Stream;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSetByFlatMap;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* Flowable 流程实例 Api 实现类
@@ -50,29 +37,22 @@ public class BpmProcessInstanceApiImpl implements BpmProcessInstanceApi {
@Resource
private BpmProcessInstanceService processInstanceService;
@Resource
private BpmProcessDefinitionService processDefinitionService;
@Resource
private AdminUserApi adminUserApi;
@Resource
private DeptApi deptApi;
@Resource
private BpmProcessDefinitionService processDefinitionService;
@Resource
private BpmTaskService taskService;
@Resource
private BpmFormService formService;
@Override
public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqDTO reqDTO) {
return processInstanceService.createProcessInstance(userId, reqDTO);
}
@Override
public BpmProcessInstanceRespDTO getProcessInstance(String id) {
public BpmProcessInstanceGetRespDTO getProcessInstance(String id) {
HistoricProcessInstance processInstance = processInstanceService.getHistoricProcessInstance(id);
if (processInstance == null) {
return null;
@@ -83,46 +63,17 @@ public class BpmProcessInstanceApiImpl implements BpmProcessInstanceApi {
processInstance.getProcessDefinitionId());
BpmProcessDefinitionInfoDO processDefinitionInfo = processDefinitionService.getProcessDefinitionInfo(
processInstance.getProcessDefinitionId());
String bpmnXml = BpmnModelUtils.getBpmnXml(
processDefinitionService.getProcessDefinitionBpmnModel(processInstance.getProcessDefinitionId()));
AdminUserRespDTO startUser = adminUserApi.getUser(NumberUtils.parseLong(processInstance.getStartUserId()));
DeptRespDTO dept = null;
if (startUser != null) {
dept = deptApi.getDept(startUser.getDeptId());
}
BpmProcessInstanceRespVO bpmProcessInstanceRespVO = BpmProcessInstanceConvert.INSTANCE.buildProcessInstance(processInstance,
processDefinition, processDefinitionInfo, bpmnXml, startUser, dept);
return BeanUtils.toBean(bpmProcessInstanceRespVO, BpmProcessInstanceRespDTO.class);
}
//List<BpmTaskRespVO>
@Override
public List<BpmTaskRespDTO> getTask(String id) {
List<HistoricTaskInstance> taskList = taskService.getTaskListByProcessInstanceId(id);
if (CollUtil.isEmpty(taskList)) {
return null;
}
// 拼接数据
HistoricProcessInstance processInstance = processInstanceService.getHistoricProcessInstance(id);
// 获得 User 和 Dept Map
Set<Long> userIds = convertSetByFlatMap(taskList, task ->
Stream.of(NumberUtils.parseLong(task.getAssignee()), NumberUtils.parseLong(task.getOwner())));
userIds.add(NumberUtils.parseLong(processInstance.getStartUserId()));
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(
convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
// 获得 Form Map
Map<Long, BpmFormDO> formMap = formService.getFormMap(
convertSet(taskList, task -> NumberUtils.parseLong(task.getFormKey())));
List<BpmTaskRespVO> bpmTaskRespVOS = BpmTaskConvert.INSTANCE.buildTaskListByProcessInstanceId(taskList, processInstance,
formMap, userMap, deptMap);
return BeanUtils.toBean(bpmTaskRespVOS, BpmTaskRespDTO.class);
return BeanUtils.toBean(bpmProcessInstanceRespVO, BpmProcessInstanceGetRespDTO.class);
}

View File

@@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.cms.api.contract;
import cn.iocoder.yudao.module.cms.api.contract.dto.ContractDTO;
public interface ContractApi {
ContractDTO getContractDTO(Long ContractId);
void validContractExists(Long Id);
}

View File

@@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.cms.api.contract.dto;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class ContractDTO {
/**
* 暂定结算数
*/
private BigDecimal provisionalSettlement;
/**
* 包干审定金额
*/
private BigDecimal approvedAmount;
}

View File

@@ -0,0 +1,9 @@
package cn.iocoder.yudao.module.cms.api.outscontract;
import java.math.BigDecimal;
public interface OutsContractApi {
BigDecimal getOutsContractAmount(Long contractId);
}

View File

@@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.cms.api.outscontract.dto;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class OutsContractDTO {
/**
* 外包合同金额
*/
private BigDecimal amount;
}

View File

@@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.cms.api.contract;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.cms.api.contract.dto.ContractDTO;
import cn.iocoder.yudao.module.cms.dal.dataobject.contract.ContractDetailDO;
import cn.iocoder.yudao.module.cms.service.contract.ContractService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@Service
@Validated
public class ContractImpl implements ContractApi{
@Resource
private ContractService contractService;
@Override
public ContractDTO getContractDTO(Long ContractId) {
ContractDetailDO contractDetail = contractService.getContractDetail(ContractId);
return BeanUtils.toBean(contractDetail, ContractDTO.class);
}
@Override
public void validContractExists(Long Id) {
contractService.validateContractExists(Id);
}
}

View File

@@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.cms.api.outscontract;
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontract.OutsContractDO;
import cn.iocoder.yudao.module.cms.dal.mysql.outscontract.OutsContractMapper;
import cn.iocoder.yudao.module.cms.service.outscontract.OutsContractService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.util.List;
@Service
@Validated
public class OutsContractImpl implements OutsContractApi{
@Resource
private OutsContractMapper outsContractMapper;
@Override
public BigDecimal getOutsContractAmount(Long contractId) {
List<OutsContractDO> outsContractDOList = outsContractMapper.selectList("contract_id", contractId);
BigDecimal res = BigDecimal.ZERO;
for (OutsContractDO outsContractDO : outsContractDOList) {
res = res.add(outsContractDO.getOutsAmount());
}
return res;
}
}

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

@@ -61,11 +61,11 @@ public class OutsContractDO extends BaseDO {
/**
* 外包合同金额
*/
private BigDecimal amount;
private BigDecimal outsAmount;
/**
* 外包合同编号
*/
private Integer code;
private Integer outsCode;
/**
* 最终外包金额
*/

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

@@ -20,8 +20,8 @@ public interface OutsContractMapper extends BaseMapperX<OutsContractDO> {
.eqIfPresent(OutsContractDO::getProjectId, reqVO.getProjectId())
.eqIfPresent(OutsContractDO::getContractId, reqVO.getContractId())
.eqIfPresent(OutsContractDO::getCountType, reqVO.getCountType())
.eqIfPresent(OutsContractDO::getAmount, reqVO.getAmount())
.eqIfPresent(OutsContractDO::getCode, reqVO.getCode())
.eqIfPresent(OutsContractDO::getOutsAmount, reqVO.getAmount())
.eqIfPresent(OutsContractDO::getOutsCode, reqVO.getCode())
.eqIfPresent(OutsContractDO::getMajor, reqVO.getMajor())
.betweenIfPresent(OutsContractDO::getSigningTime, reqVO.getSigningTime())
.eqIfPresent(OutsContractDO::getContractFileUrl, reqVO.getContractFileUrl())

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);
}
}
}
}

View File

@@ -22,6 +22,7 @@ public interface ErrorCodeConstants {
// ========== 应收款管理 1_024_000_000 ==========
ErrorCode RECEIVABLES_NOT_EXISTS = new ErrorCode(1_024_000_000, "应收款管理不存在");
// ========== 应收款管理历史记录 1_024_000_000 ==========
ErrorCode RECEIVABLES_HISTORY_NOT_EXISTS = new ErrorCode(1_024_000_000, "应收款管理历史记录不存在");
@@ -29,7 +30,9 @@ public interface ErrorCodeConstants {
ErrorCode PROJECT_SCHEDULE_NOT_EXISTS = new ErrorCode(1_025_000_000, "项目进度管理不存在");
// ========== 项目追踪信息不存在 1_026_000_000 ==========
ErrorCode PROJECT_TRACKING_NOT_EXISTS = new ErrorCode(1_026_000_000, "项目进度管理不存在");
ErrorCode PROJECT_TRACKING_NOT_EXISTS = new ErrorCode(1_026_000_000, "项目跟踪管理不存在");
// ========== 项目追踪信息不存在 1_027_000_000 ==========
ErrorCode BUDGET_ALREADY_EXISTS = new ErrorCode(1_027_000_000, "预算管理已存在");
}

View File

@@ -23,6 +23,13 @@
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-cms-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<!-- 流程相关 -->
<groupId>cn.iocoder.boot</groupId>

View File

@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.pms.controller.admin.budget;
import cn.iocoder.yudao.module.pms.dal.dataobject.budget.BudgetDetailDO;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@@ -8,7 +9,6 @@ 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.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
@@ -24,6 +24,7 @@ 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.pms.controller.admin.budget.vo.*;
import cn.iocoder.yudao.module.pms.dal.dataobject.budget.BudgetDO;
@@ -42,14 +43,14 @@ public class BudgetController {
@Operation(summary = "创建预算管理")
@PreAuthorize("@ss.hasPermission('pms:budget:create')")
public CommonResult<Long> createBudget(@Valid @RequestBody BudgetSaveReqVO createReqVO) {
return success(budgetService.createBudget(createReqVO));
return success(budgetService.createBudget(getLoginUserId(), createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新预算管理")
@PreAuthorize("@ss.hasPermission('pms:budget:update')")
public CommonResult<Boolean> updateBudget(@Valid @RequestBody BudgetSaveReqVO updateReqVO) {
budgetService.updateBudget(updateReqVO);
budgetService.updateBudget(getLoginUserId(), updateReqVO);
return success(true);
}
@@ -67,16 +68,19 @@ public class BudgetController {
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('pms:budget:query')")
public CommonResult<BudgetRespVO> getBudget(@RequestParam("id") Long id) {
BudgetDO budget = budgetService.getBudget(id);
return success(BeanUtils.toBean(budget, BudgetRespVO.class));
BudgetDetailDO budgetDetailDO = budgetService.getBudgetDetail(id);
BudgetRespVO budgetRespVO = new BudgetRespVO();
org.springframework.beans.BeanUtils.copyProperties(budgetDetailDO, budgetRespVO);
return success(budgetRespVO);
}
@GetMapping("/page")
@Operation(summary = "获得预算管理分页")
@PreAuthorize("@ss.hasPermission('pms:budget:query')")
public CommonResult<PageResult<BudgetRespVO>> getBudgetPage(@Valid BudgetPageReqVO pageReqVO) {
PageResult<BudgetDO> pageResult = budgetService.getBudgetPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, BudgetRespVO.class));
PageResult<BudgetRespVO> pageResult = budgetService.getBudgetPage(pageReqVO);
return success(pageResult);
}
@GetMapping("/export-excel")
@@ -86,7 +90,7 @@ public class BudgetController {
public void exportBudgetExcel(@Valid BudgetPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<BudgetDO> list = budgetService.getBudgetPage(pageReqVO).getList();
List<BudgetRespVO> list = budgetService.getBudgetPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "预算管理.xls", "数据", BudgetRespVO.class,
BeanUtils.toBean(list, BudgetRespVO.class));

View File

@@ -16,41 +16,11 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ToString(callSuper = true)
public class BudgetPageReqVO extends PageParam {
@Schema(description = "项目id", example = "13470")
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long projectId;
@Schema(description = "合同管理", example = "20248")
@Schema(description = "合同编号", example = "47")
private Long contractId;
@Schema(description = "预算文件url", example = "https://www.iocoder.cn")
private String budgetFileUrl;
@Schema(description = "预算外包成本")
private BigDecimal outsourcingCosts;
@Schema(description = "人力成本")
private BigDecimal laborCosts;
@Schema(description = "累计人力成本")
private BigDecimal accumulatedLaborCosts;
@Schema(description = "生产成本")
private BigDecimal productCosts;
@Schema(description = "累计生产成本")
private BigDecimal accumulatedProductCosts;
@Schema(description = "财务成本")
private BigDecimal financialCosts;
@Schema(description = "累计财务成本")
private BigDecimal accumulatedFinancialCosts;
@Schema(description = "回款情况")
private String collectionSituation;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -13,6 +13,39 @@ import com.alibaba.excel.annotation.*;
@ExcelIgnoreUnannotated
public class BudgetRespVO {
@Schema(description = "自动编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("自动编号")
private Long autoId;
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("项目编号")
private String code;
@Schema(description = "跟踪项目名称", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("跟踪项目名称")
private String name;
@Schema(description = "项目类型", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("项目类型")
private String type;
@Schema(description = "预计合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("预计合同金额")
private BigDecimal expectedContractAmount;
@Schema(description = "暂定结算数", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("暂定结算数")
private BigDecimal provisionalSettlement;
@Schema(description = "包干/审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("包干/审定金额")
private BigDecimal approvedAmount;
@Schema(description = "外包合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("外包合同金额")
private BigDecimal outsContractAmount;
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25375")
@ExcelProperty("主键")
private Long id;

View File

@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.pms.controller.admin.budget.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
@@ -10,6 +11,40 @@ import java.math.BigDecimal;
@Data
public class BudgetSaveReqVO {
@Schema(description = "自动编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("自动编号")
private String autoId;
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("项目编号")
private String code;
@Schema(description = "跟踪项目名称", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("跟踪项目名称")
private String name;
@Schema(description = "项目类型", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("项目类型")
private String type;
@Schema(description = "预计合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("预计合同金额")
private BigDecimal expectedContractAmount;
@Schema(description = "暂定结算数", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("暂定结算数")
private BigDecimal provisionalSettlement;
@Schema(description = "包干/审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("包干/审定金额")
private BigDecimal approvedAmount;
@Schema(description = "外包合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("外包合同金额")
private BigDecimal outsContractAmount;
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25375")
private Long id;

View File

@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.pms.controller.admin.budgethistory;
import cn.iocoder.yudao.module.pms.dal.dataobject.budgethistory.BudgetHistoryDetailDO;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@@ -24,6 +25,7 @@ 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.pms.controller.admin.budgethistory.vo.*;
import cn.iocoder.yudao.module.pms.dal.dataobject.budgethistory.BudgetHistoryDO;
@@ -38,27 +40,11 @@ public class BudgetHistoryController {
@Resource
private BudgetHistoryService budgetHistoryService;
@PostMapping("/create")
@Operation(summary = "创建历史预算管理")
@PreAuthorize("@ss.hasPermission('pms:budget-history:create')")
public CommonResult<Long> createBudgetHistory(@Valid @RequestBody BudgetHistorySaveReqVO createReqVO) {
return success(budgetHistoryService.createBudgetHistory(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新历史预算管理")
@PreAuthorize("@ss.hasPermission('pms:budget-history:update')")
public CommonResult<Boolean> updateBudgetHistory(@Valid @RequestBody BudgetHistorySaveReqVO updateReqVO) {
budgetHistoryService.updateBudgetHistory(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除历史预算管理")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('pms:budget-history:delete')")
public CommonResult<Boolean> deleteBudgetHistory(@RequestParam("id") Long id) {
budgetHistoryService.deleteBudgetHistory(id);
budgetHistoryService.updateBudgetHistory(getLoginUserId(), updateReqVO);
return success(true);
}
@@ -67,16 +53,18 @@ public class BudgetHistoryController {
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('pms:budget-history:query')")
public CommonResult<BudgetHistoryRespVO> getBudgetHistory(@RequestParam("id") Long id) {
BudgetHistoryDO budgetHistory = budgetHistoryService.getBudgetHistory(id);
return success(BeanUtils.toBean(budgetHistory, BudgetHistoryRespVO.class));
BudgetHistoryDetailDO budgetHistoryDetailDO = budgetHistoryService.getBudgetHistoryDetail(id);
BudgetHistoryRespVO budgetHistoryRespVO = new BudgetHistoryRespVO();
org.springframework.beans.BeanUtils.copyProperties(budgetHistoryDetailDO, budgetHistoryRespVO);
return success(budgetHistoryRespVO);
}
@GetMapping("/page")
@Operation(summary = "获得历史预算管理分页")
@PreAuthorize("@ss.hasPermission('pms:budget-history:query')")
public CommonResult<PageResult<BudgetHistoryRespVO>> getBudgetHistoryPage(@Valid BudgetHistoryPageReqVO pageReqVO) {
PageResult<BudgetHistoryDO> pageResult = budgetHistoryService.getBudgetHistoryPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, BudgetHistoryRespVO.class));
PageResult<BudgetHistoryRespVO> pageResult = budgetHistoryService.getBudgetHistoryPage(pageReqVO);
return success(pageResult);
}
@GetMapping("/export-excel")
@@ -86,7 +74,7 @@ public class BudgetHistoryController {
public void exportBudgetHistoryExcel(@Valid BudgetHistoryPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<BudgetHistoryDO> list = budgetHistoryService.getBudgetHistoryPage(pageReqVO).getList();
List<BudgetHistoryRespVO> list = budgetHistoryService.getBudgetHistoryPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "历史预算管理.xls", "数据", BudgetHistoryRespVO.class,
BeanUtils.toBean(list, BudgetHistoryRespVO.class));

View File

@@ -16,53 +16,10 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ToString(callSuper = true)
public class BudgetHistoryPageReqVO extends PageParam {
@Schema(description = "项目id", example = "15123")
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long projectId;
@Schema(description = "合同管理", example = "23971")
@Schema(description = "合同编号", example = "47")
private Long contractId;
@Schema(description = "预算文件url", example = "https://www.iocoder.cn")
private String budgetFileUrl;
@Schema(description = "预算外包成本")
private BigDecimal outsourcingCosts;
@Schema(description = "人力成本")
private BigDecimal laborCosts;
@Schema(description = "累计人力成本")
private BigDecimal accumulatedLaborCosts;
@Schema(description = "生产成本")
private BigDecimal productCosts;
@Schema(description = "累计生产成本")
private BigDecimal accumulatedProductCosts;
@Schema(description = "财务成本")
private BigDecimal financialCosts;
@Schema(description = "累计财务成本")
private BigDecimal accumulatedFinancialCosts;
@Schema(description = "回款情况")
private String collectionSituation;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "流程实体id", example = "30893")
private String processInstanceId;
@Schema(description = "流程状态", example = "2")
private String processStatus;
@Schema(description = "预算id", example = "24627")
private Long budgetId;
@Schema(description = "版本")
private String version;
}

View File

@@ -13,6 +13,40 @@ import com.alibaba.excel.annotation.*;
@ExcelIgnoreUnannotated
public class BudgetHistoryRespVO {
@Schema(description = "自动编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("自动编号")
private Long autoId;
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("项目编号")
private String code;
@Schema(description = "跟踪项目名称", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("跟踪项目名称")
private String name;
@Schema(description = "项目类型", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("项目类型")
private String type;
@Schema(description = "预计合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("预计合同金额")
private BigDecimal expectedContractAmount;
@Schema(description = "暂定结算数", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("暂定结算数")
private BigDecimal provisionalSettlement;
@Schema(description = "包干/审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("包干/审定金额")
private BigDecimal approvedAmount;
@Schema(description = "外包合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("外包合同金额")
private BigDecimal outsContractAmount;
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2972")
@ExcelProperty("主键")
private Long id;

View File

@@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.pms.controller.admin.budgethistory.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
@@ -10,6 +11,40 @@ import java.math.BigDecimal;
@Data
public class BudgetHistorySaveReqVO {
@Schema(description = "自动编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("自动编号")
private Long autoId;
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("项目编号")
private String code;
@Schema(description = "跟踪项目名称", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("跟踪项目名称")
private String name;
@Schema(description = "项目类型", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("项目类型")
private String type;
@Schema(description = "预计合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("预计合同金额")
private BigDecimal expectedContractAmount;
@Schema(description = "暂定结算数", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("暂定结算数")
private BigDecimal provisionalSettlement;
@Schema(description = "包干/审定金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("包干/审定金额")
private BigDecimal approvedAmount;
@Schema(description = "外包合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("外包合同金额")
private BigDecimal outsContractAmount;
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2972")
private Long id;

View File

@@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.pms.dal.dataobject.budget;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author shl
* @description
* @date 2024/8/16
*/
@Data
public class BudgetDetailDO extends BudgetDO {
/**
* 自动编号
*/
private Long autoId;
/**
* 项目编号
*/
private String code;
/**
* 跟踪项目名称
*/
private String name;
/**
* 项目类型
*/
private String type;
/**
* 预计合同金额
*/
private BigDecimal expectedContractAmount;
/**
* 暂定结算数
*/
private BigDecimal provisionalSettlement;
/**
* 包干/审定金额
*/
private BigDecimal approvedAmount;
/**
* 外包合同金额
*/
private BigDecimal outsContractAmount;
}

View File

@@ -0,0 +1,49 @@
package cn.iocoder.yudao.module.pms.dal.dataobject.budgethistory;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class BudgetHistoryDetailDO extends BudgetHistoryDO {
/**
* 自动编号
*/
private Long autoId;
/**
* 项目编号
*/
private String code;
/**
* 跟踪项目名称
*/
private String name;
/**
* 项目类型
*/
private String type;
/**
* 预计合同金额
*/
private BigDecimal expectedContractAmount;
/**
* 暂定结算数
*/
private BigDecimal provisionalSettlement;
/**
* 包干/审定金额
*/
private BigDecimal approvedAmount;
/**
* 外包合同金额
*/
private BigDecimal outsContractAmount;
}

View File

@@ -13,8 +13,6 @@ import java.math.BigDecimal;
@Data
public class ProjectTrackingDetailDO extends ProjectDO {
/**
* 项目编号
*/
@@ -25,7 +23,6 @@ public class ProjectTrackingDetailDO extends ProjectDO {
*/
private String trackingDep;
/**
* 出图公司
*/
@@ -41,4 +38,5 @@ public class ProjectTrackingDetailDO extends ProjectDO {
*/
private String constructionSide;
}

View File

@@ -21,16 +21,6 @@ public interface BudgetMapper extends BaseMapperX<BudgetDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<BudgetDO>()
.eqIfPresent(BudgetDO::getProjectId, reqVO.getProjectId())
.eqIfPresent(BudgetDO::getContractId, reqVO.getContractId())
.eqIfPresent(BudgetDO::getBudgetFileUrl, reqVO.getBudgetFileUrl())
.eqIfPresent(BudgetDO::getOutsourcingCosts, reqVO.getOutsourcingCosts())
.eqIfPresent(BudgetDO::getLaborCosts, reqVO.getLaborCosts())
.eqIfPresent(BudgetDO::getAccumulatedLaborCosts, reqVO.getAccumulatedLaborCosts())
.eqIfPresent(BudgetDO::getProductCosts, reqVO.getProductCosts())
.eqIfPresent(BudgetDO::getAccumulatedProductCosts, reqVO.getAccumulatedProductCosts())
.eqIfPresent(BudgetDO::getFinancialCosts, reqVO.getFinancialCosts())
.eqIfPresent(BudgetDO::getAccumulatedFinancialCosts, reqVO.getAccumulatedFinancialCosts())
.eqIfPresent(BudgetDO::getCollectionSituation, reqVO.getCollectionSituation())
.betweenIfPresent(BudgetDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(BudgetDO::getId));
}

View File

@@ -21,20 +21,20 @@ public interface BudgetHistoryMapper extends BaseMapperX<BudgetHistoryDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<BudgetHistoryDO>()
.eqIfPresent(BudgetHistoryDO::getProjectId, reqVO.getProjectId())
.eqIfPresent(BudgetHistoryDO::getContractId, reqVO.getContractId())
.eqIfPresent(BudgetHistoryDO::getBudgetFileUrl, reqVO.getBudgetFileUrl())
.eqIfPresent(BudgetHistoryDO::getOutsourcingCosts, reqVO.getOutsourcingCosts())
.eqIfPresent(BudgetHistoryDO::getLaborCosts, reqVO.getLaborCosts())
.eqIfPresent(BudgetHistoryDO::getAccumulatedLaborCosts, reqVO.getAccumulatedLaborCosts())
.eqIfPresent(BudgetHistoryDO::getProductCosts, reqVO.getProductCosts())
.eqIfPresent(BudgetHistoryDO::getAccumulatedProductCosts, reqVO.getAccumulatedProductCosts())
.eqIfPresent(BudgetHistoryDO::getFinancialCosts, reqVO.getFinancialCosts())
.eqIfPresent(BudgetHistoryDO::getAccumulatedFinancialCosts, reqVO.getAccumulatedFinancialCosts())
.eqIfPresent(BudgetHistoryDO::getCollectionSituation, reqVO.getCollectionSituation())
.betweenIfPresent(BudgetHistoryDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(BudgetHistoryDO::getProcessInstanceId, reqVO.getProcessInstanceId())
.eqIfPresent(BudgetHistoryDO::getProcessStatus, reqVO.getProcessStatus())
.eqIfPresent(BudgetHistoryDO::getBudgetId, reqVO.getBudgetId())
.eqIfPresent(BudgetHistoryDO::getVersion, reqVO.getVersion())
// .eqIfPresent(BudgetHistoryDO::getBudgetFileUrl, reqVO.getBudgetFileUrl())
// .eqIfPresent(BudgetHistoryDO::getOutsourcingCosts, reqVO.getOutsourcingCosts())
// .eqIfPresent(BudgetHistoryDO::getLaborCosts, reqVO.getLaborCosts())
// .eqIfPresent(BudgetHistoryDO::getAccumulatedLaborCosts, reqVO.getAccumulatedLaborCosts())
// .eqIfPresent(BudgetHistoryDO::getProductCosts, reqVO.getProductCosts())
// .eqIfPresent(BudgetHistoryDO::getAccumulatedProductCosts, reqVO.getAccumulatedProductCosts())
// .eqIfPresent(BudgetHistoryDO::getFinancialCosts, reqVO.getFinancialCosts())
// .eqIfPresent(BudgetHistoryDO::getAccumulatedFinancialCosts, reqVO.getAccumulatedFinancialCosts())
// .eqIfPresent(BudgetHistoryDO::getCollectionSituation, reqVO.getCollectionSituation())
// .betweenIfPresent(BudgetHistoryDO::getCreateTime, reqVO.getCreateTime())
// .eqIfPresent(BudgetHistoryDO::getProcessInstanceId, reqVO.getProcessInstanceId())
// .eqIfPresent(BudgetHistoryDO::getProcessStatus, reqVO.getProcessStatus())
// .eqIfPresent(BudgetHistoryDO::getBudgetId, reqVO.getBudgetId())
// .eqIfPresent(BudgetHistoryDO::getVersion, reqVO.getVersion())
.orderByDesc(BudgetHistoryDO::getId));
}

View File

@@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.pms.service.budget;
import java.util.*;
import cn.iocoder.yudao.module.pms.dal.dataobject.budget.BudgetDetailDO;
import jakarta.validation.*;
import cn.iocoder.yudao.module.pms.controller.admin.budget.vo.*;
import cn.iocoder.yudao.module.pms.dal.dataobject.budget.BudgetDO;
@@ -14,42 +16,15 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
*/
public interface BudgetService {
/**
* 创建预算管理
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createBudget(@Valid BudgetSaveReqVO createReqVO);
Long createBudget(Long loginUserId, @Valid BudgetSaveReqVO createReqVO);
/**
* 更新预算管理
*
* @param updateReqVO 更新信息
*/
void updateBudget(@Valid BudgetSaveReqVO updateReqVO);
void updateBudget(Long loginUserId, @Valid BudgetSaveReqVO updateReqVO);
/**
* 删除预算管理
*
* @param id 编号
*/
void deleteBudget(Long id);
/**
* 获得预算管理
*
* @param id 编号
* @return 预算管理
*/
BudgetDO getBudget(Long id);
PageResult<BudgetRespVO> getBudgetPage(BudgetPageReqVO pageReqVO);
/**
* 获得预算管理分页
*
* @param pageReqVO 分页查询
* @return 预算管理分页
*/
PageResult<BudgetDO> getBudgetPage(BudgetPageReqVO pageReqVO);
BudgetDetailDO getBudgetDetail(Long id);
void validateBudgetExists(Long id);
}

View File

@@ -1,10 +1,23 @@
package cn.iocoder.yudao.module.pms.service.budget;
import cn.hutool.core.bean.BeanUtil;
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.api.contract.ContractApi;
import cn.iocoder.yudao.module.cms.api.contract.dto.ContractDTO;
import cn.iocoder.yudao.module.cms.api.outscontract.OutsContractApi;
import cn.iocoder.yudao.module.pms.dal.dataobject.budget.BudgetDetailDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.budgethistory.BudgetHistoryDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.projecttracking.ProjectTrackingDO;
import cn.iocoder.yudao.module.pms.dal.mysql.budgethistory.BudgetHistoryMapper;
import cn.iocoder.yudao.module.pms.service.projecttracking.ProjectTrackingService;
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 org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import cn.iocoder.yudao.module.pms.controller.admin.budget.vo.*;
import cn.iocoder.yudao.module.pms.dal.dataobject.budget.BudgetDO;
@@ -16,6 +29,7 @@ import cn.iocoder.yudao.module.pms.dal.mysql.budget.BudgetMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS;
/**
* 预算管理 Service 实现类
@@ -26,24 +40,103 @@ import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.*;
@Validated
public class BudgetServiceImpl implements BudgetService {
/**
* 预算管理流程定义
*/
public static final String PROCESS_KEY = "budget_init";
/**
* 版本
*/
public static String VERSION = "1";
@Resource
private BudgetMapper budgetMapper;
@Resource
private AdminUserApi adminUserApi;
@Resource
private ContractApi contractApi;
@Resource
private OutsContractApi outsContractApi;
@Resource
private ProjectTrackingService projectTrackingService;
@Resource
private BpmProcessInstanceApi processInstanceApi;
@Resource
private BudgetHistoryMapper budgetHistoryMapper;
@Override
public Long createBudget(BudgetSaveReqVO createReqVO) {
public Long createBudget(Long loginUserId, BudgetSaveReqVO createReqVO) {
// 校验
String userName = adminUserApi.getUser(loginUserId).getNickname();
if (userName == null) {
throw exception(USER_NOT_EXISTS);
}
Long projectId = createReqVO.getProjectId();
Long contractId = createReqVO.getContractId();
projectTrackingService.validateProjectExists(projectId);
contractApi.validContractExists(contractId);
Long id = createReqVO.getId();
List<BudgetDO> projectList = budgetMapper.selectList("project_id", projectId);
for (BudgetDO budgetDO : projectList) {
if (Objects.equals(budgetDO.getId(), id)) {
throw exception(BUDGET_ALREADY_EXISTS);
}
}
// 插入
BudgetDO budget = BeanUtils.toBean(createReqVO, BudgetDO.class);
budget.setCreator(userName);
budget.setUpdater(userName);
budgetMapper.insert(budget);
Long budgetId = budget.getId();
BudgetHistoryDO budgetHistory = BeanUtils.toBean(budget, BudgetHistoryDO.class);
// 启动流程,写入历史预算 todo
if (createReqVO.getId() == null) {
String processInstanceId = processInstanceApi.createProcessInstance(loginUserId,
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
.setBusinessKey(String.valueOf(budgetId)));
// 写入工作流编号
budgetHistoryMapper.updateById(budgetHistory.setBudgetId(budgetId).setProcessInstanceId(processInstanceId));
Long count = budgetHistoryMapper.selectCount("project_id", projectId);
if (count < 1) {
budgetHistory.setVersion(VERSION);
} else {
budgetHistory.setVersion(String.valueOf(count + 1));
}
budgetHistory.setProcessStatus("0");
budgetHistoryMapper.insert(budgetHistory);
}
// 返回
return budget.getId();
}
@Override
public void updateBudget(BudgetSaveReqVO updateReqVO) {
public void updateBudget(Long loginUserId, BudgetSaveReqVO updateReqVO) {
// 校验存在
validateBudgetExists(updateReqVO.getId());
projectTrackingService.validateProjectExists(updateReqVO.getProjectId());
contractApi.validContractExists(updateReqVO.getContractId());
// 更新
BudgetDO updateObj = BeanUtils.toBean(updateReqVO, BudgetDO.class);
String userName = adminUserApi.getUser(loginUserId).getNickname();
if (userName == null) {
throw exception(USER_NOT_EXISTS);
}
updateObj.setUpdater(userName);
budgetMapper.updateById(updateObj);
}
@@ -55,20 +148,57 @@ public class BudgetServiceImpl implements BudgetService {
budgetMapper.deleteById(id);
}
private void validateBudgetExists(Long id) {
@Override
public void validateBudgetExists(Long id) {
if (budgetMapper.selectById(id) == null) {
throw exception(BUDGET_NOT_EXISTS);
}
}
@Override
public BudgetDO getBudget(Long id) {
return budgetMapper.selectById(id);
public PageResult<BudgetRespVO> getBudgetPage(BudgetPageReqVO pageReqVO) {
PageResult<BudgetDO> budgetDOPageResult = budgetMapper.selectPage(pageReqVO);
List<BudgetDO> budgetDOList = budgetDOPageResult.getList();
List<BudgetDetailDO> budgetRespVOList = new ArrayList<>();
for (BudgetDO budgetDO : budgetDOList) {
Long id = budgetDO.getId();
BudgetDetailDO budgetDetail = getBudgetDetail(id);
budgetRespVOList.add(budgetDetail);
}
List<BudgetRespVO> respVOList = BeanUtils.toBean(budgetRespVOList, BudgetRespVO.class);
PageResult<BudgetRespVO> pageResult = new PageResult<>();
pageResult.setList(respVOList);
return pageResult;
}
@Override
public PageResult<BudgetDO> getBudgetPage(BudgetPageReqVO pageReqVO) {
return budgetMapper.selectPage(pageReqVO);
public BudgetDetailDO getBudgetDetail(Long id) {
BudgetDetailDO budgetDetailDO = new BudgetDetailDO();
BudgetDO budgetDO = budgetMapper.selectById(id);
if (budgetDO == null) {
throw exception(BUDGET_NOT_EXISTS);
}
Long contractId = budgetDO.getContractId();
Long projectId = budgetDO.getProjectId();
contractApi.validContractExists(contractId);
projectTrackingService.validateProjectExists(projectId);
ProjectTrackingDO projectTracking = projectTrackingService.getProjectTracking(projectId);
ContractDTO contractDTO = contractApi.getContractDTO(contractId);
BigDecimal outsContractAmount = outsContractApi.getOutsContractAmount(contractId);
budgetDetailDO.setOutsContractAmount(outsContractAmount);
budgetDetailDO.setAutoId(projectTracking.getId());
BeanUtil.copyProperties(budgetDO, budgetDetailDO);
BeanUtil.copyProperties(projectTracking, budgetDetailDO);
BeanUtil.copyProperties(contractDTO, budgetDetailDO);
return budgetDetailDO;
}
}

View File

@@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.pms.service.budgethistory;
import java.util.*;
import cn.iocoder.yudao.module.pms.dal.dataobject.budgethistory.BudgetHistoryDetailDO;
import jakarta.validation.*;
import cn.iocoder.yudao.module.pms.controller.admin.budgethistory.vo.*;
import cn.iocoder.yudao.module.pms.dal.dataobject.budgethistory.BudgetHistoryDO;
@@ -14,27 +16,12 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
*/
public interface BudgetHistoryService {
/**
* 创建预算管理
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createBudgetHistory(@Valid BudgetHistorySaveReqVO createReqVO);
/**
* 更新预算管理
*
* @param updateReqVO 更新信息
*/
void updateBudgetHistory(@Valid BudgetHistorySaveReqVO updateReqVO);
/**
* 删除预算管理
*
* @param id 编号
*/
void deleteBudgetHistory(Long id);
void updateBudgetHistory(Long loginUserId, @Valid BudgetHistorySaveReqVO updateReqVO);
/**
* 获得预算管理
@@ -42,7 +29,7 @@ public interface BudgetHistoryService {
* @param id 编号
* @return 预算管理
*/
BudgetHistoryDO getBudgetHistory(Long id);
BudgetHistoryDetailDO getBudgetHistoryDetail(Long id);
/**
* 获得预算管理分页
@@ -50,6 +37,6 @@ public interface BudgetHistoryService {
* @param pageReqVO 分页查询
* @return 预算管理分页
*/
PageResult<BudgetHistoryDO> getBudgetHistoryPage(BudgetHistoryPageReqVO pageReqVO);
PageResult<BudgetHistoryRespVO> getBudgetHistoryPage(BudgetHistoryPageReqVO pageReqVO);
}

View File

@@ -1,10 +1,20 @@
package cn.iocoder.yudao.module.pms.service.budgethistory;
import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.module.cms.api.contract.ContractApi;
import cn.iocoder.yudao.module.cms.api.contract.dto.ContractDTO;
import cn.iocoder.yudao.module.cms.api.outscontract.OutsContractApi;
import cn.iocoder.yudao.module.pms.controller.admin.budget.vo.BudgetRespVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.budgethistory.BudgetHistoryDetailDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.projecttracking.ProjectTrackingDO;
import cn.iocoder.yudao.module.pms.service.projecttracking.ProjectTrackingService;
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 org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import cn.iocoder.yudao.module.pms.controller.admin.budgethistory.vo.*;
import cn.iocoder.yudao.module.pms.dal.dataobject.budgethistory.BudgetHistoryDO;
@@ -15,13 +25,16 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.pms.dal.mysql.budgethistory.BudgetHistoryMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.CONTRACT_NOT_EXISTS;
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.PARAM_NOT_EXISTS;
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS;
/**
* 预算管理 Service 实现类
*
* @author zqc
*/
@Service
@Validated
public class BudgetHistoryServiceImpl implements BudgetHistoryService {
@@ -29,32 +42,34 @@ public class BudgetHistoryServiceImpl implements BudgetHistoryService {
@Resource
private BudgetHistoryMapper budgetHistoryMapper;
@Override
public Long createBudgetHistory(BudgetHistorySaveReqVO createReqVO) {
// 插入
BudgetHistoryDO budgetHistory = BeanUtils.toBean(createReqVO, BudgetHistoryDO.class);
budgetHistoryMapper.insert(budgetHistory);
// 返回
return budgetHistory.getId();
}
@Resource
private AdminUserApi adminUserApi;
@Resource
private ProjectTrackingService projectTrackingService;
@Resource
private ContractApi contractApi;
@Resource
private OutsContractApi outsContractApi;
@Override
public void updateBudgetHistory(BudgetHistorySaveReqVO updateReqVO) {
public void updateBudgetHistory(Long loginUserId, BudgetHistorySaveReqVO updateReqVO) {
// 校验存在
validateBudgetHistoryExists(updateReqVO.getId());
projectTrackingService.validateProjectExists(updateReqVO.getProjectId());
contractApi.validContractExists(updateReqVO.getContractId());
// 更新
BudgetHistoryDO updateObj = BeanUtils.toBean(updateReqVO, BudgetHistoryDO.class);
String userName = adminUserApi.getUser(loginUserId).getNickname();
if (userName == null) {
throw exception(USER_NOT_EXISTS);
}
updateObj.setUpdater(userName);
budgetHistoryMapper.updateById(updateObj);
}
@Override
public void deleteBudgetHistory(Long id) {
// 校验存在
validateBudgetHistoryExists(id);
// 删除
budgetHistoryMapper.deleteById(id);
}
private void validateBudgetHistoryExists(Long id) {
if (budgetHistoryMapper.selectById(id) == null) {
throw exception(BUDGET_HISTORY_NOT_EXISTS);
@@ -62,13 +77,55 @@ public class BudgetHistoryServiceImpl implements BudgetHistoryService {
}
@Override
public BudgetHistoryDO getBudgetHistory(Long id) {
return budgetHistoryMapper.selectById(id);
public BudgetHistoryDetailDO getBudgetHistoryDetail(Long id) {
// 校验
if (id == null) {
throw exception(BUDGET_NOT_EXISTS);
}
BudgetHistoryDO budgetHistoryDO = budgetHistoryMapper.selectById(id);
if (budgetHistoryDO == null) {
throw exception(BUDGET_NOT_EXISTS);
}
Long projectId = budgetHistoryDO.getProjectId();
Long contractId = budgetHistoryDO.getContractId();
contractApi.validContractExists(contractId);
projectTrackingService.validateProjectExists(projectId);
BudgetHistoryDetailDO budgetHistoryDetailDO = new BudgetHistoryDetailDO();
ProjectTrackingDO projectTracking = projectTrackingService.getProjectTracking(projectId);
ContractDTO contractDTO = contractApi.getContractDTO(contractId);
BigDecimal outsContractAmount = outsContractApi.getOutsContractAmount(contractId);
budgetHistoryDetailDO.setOutsContractAmount(outsContractAmount);
budgetHistoryDetailDO.setAutoId(projectTracking.getId());
BeanUtil.copyProperties(budgetHistoryDO, budgetHistoryDetailDO);
BeanUtil.copyProperties(projectTracking, budgetHistoryDetailDO);
BeanUtil.copyProperties(contractDTO, budgetHistoryDetailDO);
return budgetHistoryDetailDO;
}
@Override
public PageResult<BudgetHistoryDO> getBudgetHistoryPage(BudgetHistoryPageReqVO pageReqVO) {
return budgetHistoryMapper.selectPage(pageReqVO);
public PageResult<BudgetHistoryRespVO> getBudgetHistoryPage(BudgetHistoryPageReqVO pageReqVO) {
// 校验
if (pageReqVO == null) {
throw exception(PARAM_NOT_EXISTS);
}
PageResult<BudgetHistoryDO> budgetHistoryDOPageResult = budgetHistoryMapper.selectPage(pageReqVO);
List<BudgetHistoryDO> budgetHistoryDOList = budgetHistoryDOPageResult.getList();
List<BudgetHistoryDetailDO> budgetHistoryDetailDOList = new ArrayList<>();
for (BudgetHistoryDO budgetHistoryDO : budgetHistoryDOList) {
Long id = budgetHistoryDO.getId();
BudgetHistoryDetailDO budgetHistoryDetailDO = getBudgetHistoryDetail(id);
budgetHistoryDetailDOList.add(budgetHistoryDetailDO);
}
List<BudgetHistoryRespVO> respVOList = BeanUtils.toBean(budgetHistoryDetailDOList, BudgetHistoryRespVO.class);
PageResult<BudgetHistoryRespVO> pageResult = new PageResult<>();
pageResult.setList(respVOList);
return pageResult;
}
}