mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-19 12:41:55 +08:00
Compare commits
6 Commits
feature-bu
...
feature-Ex
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4c2024a149 | ||
![]() |
ca81820971 | ||
![]() |
f12b055dfe | ||
![]() |
5f2cb54ab9 | ||
![]() |
b80f413c06 | ||
![]() |
5091059610 |
@@ -1,115 +0,0 @@
|
||||
package cn.iocoder.yudao.module.bpm.api.task.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程定义
|
||||
*/
|
||||
@Data
|
||||
public class BpmProcessDefinitionRespDTO {
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
private Integer version;
|
||||
|
||||
/**
|
||||
* 流程名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 流程标识
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* 流程图标
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 流程描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 流程分类
|
||||
*/
|
||||
private String category;
|
||||
/**
|
||||
* 流程分类名字
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 表单类型
|
||||
*/
|
||||
private Integer formType;
|
||||
|
||||
/**
|
||||
* 表单编号
|
||||
*/
|
||||
private Long formId;
|
||||
|
||||
/**
|
||||
* 表单名字
|
||||
*/
|
||||
private String formName;
|
||||
/**
|
||||
* 表单的配置
|
||||
*/
|
||||
private String formConf;
|
||||
|
||||
/**
|
||||
* 表单项的数组
|
||||
*/
|
||||
private List<String> formFields;
|
||||
|
||||
/**
|
||||
* 自定义表单的提交路径
|
||||
*/
|
||||
private String formCustomCreatePath;
|
||||
|
||||
/**
|
||||
* 自定义表单的查看路径
|
||||
*/
|
||||
private String formCustomViewPath;
|
||||
|
||||
/**
|
||||
* 中断状态-参见 SuspensionState 枚举
|
||||
*/
|
||||
private Integer suspensionState; // 参见 SuspensionState 枚举
|
||||
|
||||
/**
|
||||
* 部署时间
|
||||
*/
|
||||
private LocalDateTime deploymentTime; // 需要从对应的 Deployment 读取,非必须返回
|
||||
|
||||
/**
|
||||
* BPMN XML
|
||||
*/
|
||||
private String bpmnXml; // 需要从对应的 BpmnModel 读取,非必须返回
|
||||
|
||||
/**
|
||||
* 发起用户需要选择审批人的任务数组
|
||||
*/
|
||||
private List<UserTask> startUserSelectTasks; // 需要从对应的 BpmnModel 读取,非必须返回
|
||||
|
||||
@Data
|
||||
public static class UserTask {
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -1,118 +0,0 @@
|
||||
package cn.iocoder.yudao.module.bpm.api.task.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程实例的获得 Resp DTO
|
||||
*/
|
||||
@Data
|
||||
public class BpmProcessInstanceRespDTO {
|
||||
|
||||
/**
|
||||
* 流程实例编号
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 流程实例名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 流程分类
|
||||
*/
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 流程分类名称
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
/**
|
||||
* 流程实例状态
|
||||
*/
|
||||
private Integer status; // 参见 BpmProcessInstanceStatusEnum 枚举
|
||||
|
||||
/**
|
||||
* 发起时间
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
|
||||
/**
|
||||
* 持续时间
|
||||
*/
|
||||
private Long durationInMillis;
|
||||
|
||||
/**
|
||||
* 发起流程的用户
|
||||
*/
|
||||
private User startUser;
|
||||
|
||||
/**
|
||||
* 流程定义编号
|
||||
*/
|
||||
|
||||
private String processDefinitionId;
|
||||
/**
|
||||
* 流程定义
|
||||
*/
|
||||
private BpmProcessDefinitionRespDTO processDefinition;
|
||||
|
||||
|
||||
/**
|
||||
* 当前审批中的任务
|
||||
*/
|
||||
private List<Task> tasks; // 仅在流程实例分页才返回
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*/
|
||||
@Data
|
||||
public static class User {
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String nickname;
|
||||
/**
|
||||
* 部门编号
|
||||
*/
|
||||
private Long deptId;
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程任务
|
||||
*/
|
||||
@Data
|
||||
public static class Task {
|
||||
|
||||
/**
|
||||
* 流程任务编号
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -1,144 +0,0 @@
|
||||
package cn.iocoder.yudao.module.bpm.api.task.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 指定流程实例的任务
|
||||
*/
|
||||
@Data
|
||||
public class BpmTaskRespDTO {
|
||||
|
||||
/**
|
||||
* 任务编号
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 任务名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
|
||||
|
||||
/**
|
||||
* 持续时间
|
||||
*/
|
||||
private Long durationInMillis;
|
||||
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
private Integer status; // 参见 BpmTaskStatusEnum 枚举
|
||||
|
||||
/**
|
||||
* 审批理由
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 负责人的用户信息
|
||||
*/
|
||||
private BpmProcessInstanceRespDTO.User ownerUser;
|
||||
/**
|
||||
* 审核的用户信息
|
||||
*/
|
||||
private BpmProcessInstanceRespDTO.User assigneeUser;
|
||||
|
||||
/**
|
||||
* 任务定义的标识
|
||||
*/
|
||||
private String taskDefinitionKey;
|
||||
|
||||
/**
|
||||
* 所属流程实例编号
|
||||
*/
|
||||
private String processInstanceId;
|
||||
/**
|
||||
* 所属流程实例
|
||||
*/
|
||||
private ProcessInstance processInstance;
|
||||
|
||||
/**
|
||||
* 父任务编号
|
||||
*/
|
||||
private String parentTaskId;
|
||||
|
||||
/**
|
||||
* 子任务列表(由加签生成)
|
||||
*/
|
||||
private List<BpmTaskRespDTO> children;
|
||||
|
||||
/**
|
||||
* 表单编号
|
||||
*/
|
||||
private Long formId;
|
||||
|
||||
/**
|
||||
* 表单名字
|
||||
*/
|
||||
private String formName;
|
||||
|
||||
/**
|
||||
* 表单的配置-JSON 字符串
|
||||
*/
|
||||
private String formConf;
|
||||
|
||||
/**
|
||||
* 表单项的数组
|
||||
*/
|
||||
private List<String> formFields;
|
||||
|
||||
/**
|
||||
* 提交的表单值
|
||||
*/
|
||||
private Map<String, Object> formVariables;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例
|
||||
*/
|
||||
@Data
|
||||
public static class ProcessInstance {
|
||||
|
||||
/**
|
||||
* 流程实例编号
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 流程实例名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 提交时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 流程定义的编号
|
||||
*/
|
||||
private String processDefinitionId;
|
||||
|
||||
/**
|
||||
* 发起人的用户信息
|
||||
*/
|
||||
private BpmProcessInstanceRespDTO.User startUser;
|
||||
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
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);
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
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;
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
package cn.iocoder.yudao.module.cms.api.outscontract;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public interface OutsContractApi {
|
||||
|
||||
BigDecimal getOutsContractAmount(Long contractId);
|
||||
|
||||
}
|
@@ -1,14 +0,0 @@
|
||||
package cn.iocoder.yudao.module.cms.api.outscontract.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class OutsContractDTO {
|
||||
|
||||
/**
|
||||
* 外包合同金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
}
|
@@ -20,6 +20,9 @@ public interface ErrorCodeConstants {
|
||||
// ========== 外包合同 2_021_000_000 ==========
|
||||
ErrorCode OUTS_CONTRACT_NOT_EXISTS = new ErrorCode(2_021_000_000, "外包合同不存在");
|
||||
|
||||
ErrorCode OUTS_CONTRACT_EXISTS = new ErrorCode(2_021_001_000, "外包合同已经存在");
|
||||
|
||||
|
||||
// ========== 外包合同历史 2_022_000_000 ==========
|
||||
ErrorCode OUTS_CONTRACT_HISTORY_NOT_EXISTS = new ErrorCode(2_022_000_000, "外包合同历史不存在");
|
||||
|
||||
@@ -43,7 +46,7 @@ public interface ErrorCodeConstants {
|
||||
// ========== 外部合同信息 2_026_000_000 ==========
|
||||
ErrorCode EXT_CONTRACT_NOT_EXISTS = new ErrorCode(2_026_000_000, "外部合同不存在");
|
||||
|
||||
ErrorCode EXT_CONTRACT_EXISTS = new ErrorCode(2_026_000_000, "外部合同已经存在");
|
||||
ErrorCode EXT_CONTRACT_EXISTS = new ErrorCode(2_026_001_000, "外部合同已经存在");
|
||||
|
||||
// ========== 历史外部合同信息 2_027_000_000 ==========
|
||||
ErrorCode EXT_CONTRACT_HISTORY_NOT_EXISTS = new ErrorCode(2_027_000_000, "历史外部合同不存在");
|
||||
@@ -52,4 +55,8 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode CONTRACT_EXT_NOT_EXISTS = new ErrorCode(2_028_000_000, "外部合同关联不存在");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -11,17 +11,15 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ProcessStatusEnum {
|
||||
//未执行
|
||||
NO_EXECUTION("0","no_execution"),
|
||||
//正在执行
|
||||
EXECUTING("1","executing"),
|
||||
//执行完成
|
||||
COMPLETED("2","completed");
|
||||
RUNNING(1, "审批中"),
|
||||
APPROVE(2, "审批通过"),
|
||||
REJECT(3, "审批不通过"),
|
||||
CANCEL(4, "已取消");
|
||||
|
||||
/**
|
||||
* 类型编号
|
||||
*/
|
||||
private final String code;
|
||||
private final Integer code;
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
@@ -32,7 +30,7 @@ public enum ProcessStatusEnum {
|
||||
* @param code 字典编号
|
||||
* @return 类型编码
|
||||
*/
|
||||
public static String getNoByCode(String code) {
|
||||
public static String getNoByCode(Integer code) {
|
||||
for (ProcessStatusEnum value : values()) {
|
||||
if (value.getCode().equals(code)) {
|
||||
return value.getNo();
|
||||
|
@@ -1,28 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
@@ -1,30 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@@ -29,8 +29,7 @@ public class ContractPageReqVO extends PageParam {
|
||||
@DictFormat(DictTypeConstants.COUNT_TYPE)
|
||||
private String countType;
|
||||
|
||||
@Schema(description = "外部合同id", example = "28")
|
||||
@Schema(description = "外部合同id", example = "13085")
|
||||
@ExcelProperty("合同id")
|
||||
private Long extContractId;
|
||||
|
||||
}
|
@@ -74,12 +74,12 @@ 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));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -4,11 +4,15 @@ import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.file.FileUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractRespVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.OutsContractPageReqVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.OutsContractRespVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.OutsContractSaveReqVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.extcontract.ExtContractDetailDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontract.OutsContractDetailDO;
|
||||
import cn.iocoder.yudao.module.cms.service.outscontract.OutsContractService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -65,7 +69,11 @@ public class OutsContractController {
|
||||
@Parameter(name = "id", description = "主合同编号", required = true, example = "1")
|
||||
@PreAuthorize("@ss.hasPermission('cms:outs-contract:query')")
|
||||
public CommonResult<OutsContractRespVO> getOutsContract(@RequestParam("id") Long id) {
|
||||
OutsContractRespVO outsContractRespVO = outsContractService.getOutsContract(id);
|
||||
OutsContractDetailDO outsContractDetail = outsContractService.getOutsContractDetail(id);
|
||||
OutsContractRespVO outsContractRespVO = new OutsContractRespVO();
|
||||
org.springframework.beans.BeanUtils.copyProperties(outsContractDetail, outsContractRespVO, "contractFileUrl");
|
||||
outsContractRespVO.setContractFileUrl(FileUtils.covertJSONStringToFile(outsContractDetail.getContractFileUrl()));
|
||||
|
||||
return success(outsContractRespVO);
|
||||
}
|
||||
|
||||
|
@@ -23,35 +23,12 @@ public class OutsContractPageReqVO extends PageParam {
|
||||
@Schema(description = "项目id", example = "27415")
|
||||
private Long projectId;
|
||||
|
||||
@Schema(description = "合同名称", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "主合同id", example = "19816")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "计费类型", example = "2")
|
||||
@DictFormat(DictTypeConstants.COUNT_TYPE)
|
||||
private String countType;
|
||||
|
||||
@Schema(description = "合同金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "编号")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "专业")
|
||||
@DictFormat(DictTypeConstants.OUTS_CONTRACT_MAJOR)
|
||||
private String major;
|
||||
|
||||
@Schema(description = "签订时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] signingTime;
|
||||
|
||||
@Schema(description = "结算数")
|
||||
private BigDecimal settlementAmount;
|
||||
|
||||
@Schema(description = "合同文件url", example = "https://www.iocoder.cn")
|
||||
private String contractFileUrl;
|
||||
|
||||
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.outscontract.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;
|
||||
@@ -10,6 +11,7 @@ import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 外包合同 Response VO")
|
||||
@Data
|
||||
@@ -44,7 +46,7 @@ public class OutsContractRespVO {
|
||||
|
||||
@Schema(description = "签订合同总额")
|
||||
@ExcelProperty("签订合同总额")
|
||||
private BigDecimal outsAmount;
|
||||
private BigDecimal amount;
|
||||
|
||||
|
||||
|
||||
@@ -63,9 +65,9 @@ public class OutsContractRespVO {
|
||||
@ExcelProperty("签订时间")
|
||||
private LocalDateTime signingTime;
|
||||
|
||||
@Schema(description = "合同文件url", example = "https://www.iocoder.cn")
|
||||
@Schema(description = "合同文件url")
|
||||
@ExcelProperty("合同文件url")
|
||||
private String contractFileUrl;
|
||||
private List<FileDTO> contractFileUrl;
|
||||
|
||||
|
||||
@Schema(description = "外包单位")
|
||||
@@ -74,11 +76,11 @@ public class OutsContractRespVO {
|
||||
|
||||
@Schema(description = "外包合同金额")
|
||||
@ExcelProperty("外包合同金额")
|
||||
private BigDecimal amount;
|
||||
private BigDecimal outsAmount;
|
||||
|
||||
@Schema(description = "外包合同编号")
|
||||
@ExcelProperty("外包合同编号")
|
||||
private Integer code;
|
||||
private Integer OutsCode;
|
||||
|
||||
@Schema(description = "最终外包金额")
|
||||
@ExcelProperty("最终外包金额")
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.outscontract.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;
|
||||
@@ -9,6 +10,7 @@ import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 外包合同新增/修改 Request VO")
|
||||
@Data
|
||||
@@ -28,24 +30,6 @@ public class OutsContractSaveReqVO {
|
||||
|
||||
|
||||
|
||||
@Schema(description = "合同名称", example = "张三")
|
||||
@ExcelProperty("合同名称")
|
||||
private String name;
|
||||
|
||||
@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 BigDecimal outsAmount;
|
||||
|
||||
|
||||
|
||||
|
||||
@Schema(description = "类型", example = "2")
|
||||
@ExcelProperty(value = "类型", converter = DictConvert.class)
|
||||
@@ -61,9 +45,9 @@ public class OutsContractSaveReqVO {
|
||||
@ExcelProperty("签订时间")
|
||||
private LocalDateTime signingTime;
|
||||
|
||||
@Schema(description = "合同文件url", example = "https://www.iocoder.cn")
|
||||
@Schema(description = "合同文件url")
|
||||
@ExcelProperty("合同文件url")
|
||||
private String contractFileUrl;
|
||||
private List<FileDTO> contractFileUrl;
|
||||
|
||||
|
||||
@Schema(description = "外包单位")
|
||||
@@ -72,11 +56,11 @@ public class OutsContractSaveReqVO {
|
||||
|
||||
@Schema(description = "外包合同金额")
|
||||
@ExcelProperty("外包合同金额")
|
||||
private BigDecimal amount;
|
||||
private BigDecimal outsAmount;
|
||||
|
||||
@Schema(description = "外包合同编号")
|
||||
@ExcelProperty("外包合同编号")
|
||||
private Integer code;
|
||||
private Integer OutsCode;
|
||||
|
||||
@Schema(description = "最终外包金额")
|
||||
@ExcelProperty("最终外包金额")
|
||||
|
@@ -1,10 +1,16 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.dataobject.contractHistory;
|
||||
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contract.ContractDO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author wyw
|
||||
* @description
|
||||
* @date 2024/8/14
|
||||
*/
|
||||
@Data
|
||||
public class ContractHistoryDetailDO extends ContractHistoryDO {
|
||||
/**
|
||||
|
@@ -4,6 +4,11 @@ import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author wyw
|
||||
* @description
|
||||
* @date 2024/8/14
|
||||
*/
|
||||
@Data
|
||||
public class ExtContractDetailDO extends ExtContractDO {
|
||||
/**
|
||||
|
@@ -1,8 +1,23 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.dataobject.extcontracthistory;
|
||||
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
@@ -153,4 +168,3 @@ public class ExtContractHistoryDO extends BaseDO {
|
||||
private String version;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,9 +1,15 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.dataobject.extcontracthistory;
|
||||
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.extcontract.ExtContractDO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author wyw
|
||||
* @description
|
||||
* @date 2024/8/14
|
||||
*/
|
||||
@Data
|
||||
public class ExtContractHistoryDetailDO extends ExtContractHistoryDO {
|
||||
/**
|
||||
@@ -32,4 +38,3 @@ public class ExtContractHistoryDetailDO extends ExtContractHistoryDO {
|
||||
private LocalDateTime exReminderTime;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -65,7 +65,7 @@ public class OutsContractDO extends BaseDO {
|
||||
/**
|
||||
* 外包合同编号
|
||||
*/
|
||||
private Integer outsCode;
|
||||
private Integer OutsCode;
|
||||
/**
|
||||
* 最终外包金额
|
||||
*/
|
||||
|
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.dataobject.outscontract;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 外包合同 DO
|
||||
*
|
||||
* @author zqc
|
||||
*/
|
||||
@Data
|
||||
public class OutsContractDetailDO extends OutsContractDO {
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 主控部门
|
||||
*/
|
||||
private String trackingDep;
|
||||
|
||||
/**
|
||||
* 项目经理
|
||||
*/
|
||||
private String projectManager;
|
||||
|
||||
/**
|
||||
* 签订合同总额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
|
||||
}
|
@@ -30,4 +30,3 @@ public interface ExtContractHistoryMapper extends BaseMapperX<ExtContractHistory
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -19,13 +19,8 @@ public interface OutsContractMapper extends BaseMapperX<OutsContractDO> {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<OutsContractDO>()
|
||||
.eqIfPresent(OutsContractDO::getProjectId, reqVO.getProjectId())
|
||||
.eqIfPresent(OutsContractDO::getContractId, reqVO.getContractId())
|
||||
.eqIfPresent(OutsContractDO::getCountType, reqVO.getCountType())
|
||||
.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())
|
||||
.orderByDesc(OutsContractDO::getId));
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@@ -60,4 +60,7 @@ public interface ContractService {
|
||||
*/
|
||||
ContractDetailDO getContractDetail(Long id);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -58,6 +58,7 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
@Resource
|
||||
private ProjectScheduleApi projectScheduleApi;
|
||||
|
||||
|
||||
@Resource
|
||||
private BpmProcessInstanceApi processInstanceApi;
|
||||
|
||||
@@ -67,6 +68,7 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
@Resource
|
||||
private BpmProcessInstanceApi bpmProcessInstanceApi;
|
||||
|
||||
|
||||
@Override
|
||||
public Long createExtContract(Long loginUserId, ExtContractSaveReqVO createReqVO) {
|
||||
//插入外部合同表
|
||||
@@ -200,6 +202,7 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
BeanUtil.copyProperties(processInstance, extContractProcessInstanceRespVO);
|
||||
extContractHistoryDO.setProcessStatus(processInstance.getStatus());
|
||||
|
||||
|
||||
return extContractProcessInstanceRespVO;
|
||||
}
|
||||
|
||||
|
@@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.OutsContractPageReqVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.OutsContractRespVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.OutsContractSaveReqVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontract.OutsContractDetailDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
@@ -43,7 +44,7 @@ public interface OutsContractService {
|
||||
* @param id 编号
|
||||
* @return 外包合同
|
||||
*/
|
||||
OutsContractRespVO getOutsContract(Long id);
|
||||
OutsContractDetailDO getOutsContractDetail(Long id);
|
||||
|
||||
/**
|
||||
* 获得外包合同分页
|
||||
|
@@ -1,15 +1,20 @@
|
||||
package cn.iocoder.yudao.module.cms.service.outscontract;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.OutsContractPageReqVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.OutsContractRespVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.OutsContractSaveReqVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contract.ContractDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontract.OutsContractDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontract.OutsContractDetailDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.outscontract.OutsContractMapper;
|
||||
import cn.iocoder.yudao.module.cms.enums.*;
|
||||
import cn.iocoder.yudao.module.cms.service.contract.ContractService;
|
||||
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 jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -17,11 +22,9 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 外包合同 Service 实现类
|
||||
@@ -31,34 +34,41 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_E
|
||||
@Service
|
||||
@Validated
|
||||
public class OutsContractServiceImpl implements OutsContractService {
|
||||
|
||||
/**
|
||||
* 外包合同立项审批流程定义
|
||||
*/
|
||||
public static final String PROCESS_KEY = "outs_contract_init";
|
||||
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
public static String VERSION = "1";
|
||||
@Resource
|
||||
private OutsContractMapper outsContractMapper;
|
||||
|
||||
@Resource
|
||||
private ContractService contractService;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private BpmProcessInstanceApi processInstanceApi;
|
||||
private ContractService contractService;
|
||||
|
||||
@Resource
|
||||
private ProjectTrackingApi projectTrackingApi;
|
||||
|
||||
@Resource
|
||||
private ProjectScheduleApi projectScheduleApi;
|
||||
|
||||
|
||||
@Override
|
||||
public Long createOutsContract(Long loginUserId,OutsContractSaveReqVO createReqVO) {
|
||||
return null;
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
//校验,项目是否存在
|
||||
Long contractId = createReqVO.getContractId();
|
||||
List<OutsContractDO> outsContractList = outsContractMapper.selectList("contract_id", contractId);
|
||||
for (OutsContractDO outsContractDO : outsContractList) {
|
||||
String major = outsContractDO.getMajor();
|
||||
if (createReqVO.getMajor().equals(major)){
|
||||
throw exception(OUTS_CONTRACT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
OutsContractDO outsContractDO = BeanUtils.toBean(createReqVO, OutsContractDO.class);
|
||||
outsContractDO.setCreator(userName);
|
||||
outsContractDO.setUpdater(userName);
|
||||
outsContractMapper.insert(outsContractDO);
|
||||
//返回
|
||||
return outsContractDO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,15 +77,13 @@ public class OutsContractServiceImpl implements OutsContractService {
|
||||
validateOutsContractExists(updateReqVO.getId());
|
||||
|
||||
Long contractId = updateReqVO.getContractId();
|
||||
OutsContractDO outsContractDO = outsContractMapper.selectById(updateReqVO.getId());
|
||||
if (!Objects.equals(updateReqVO.getProjectId(), outsContractDO.getProjectId())) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
if (userName == null){
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
contractService.validateContractExists(contractId);
|
||||
|
||||
Long projectId = updateReqVO.getProjectId();
|
||||
projectTrackingApi.validateProjectExists(projectId);
|
||||
|
||||
// 更新
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
OutsContractDO updateObj = BeanUtils.toBean(updateReqVO, OutsContractDO.class);
|
||||
updateObj.setUpdater(userName);
|
||||
outsContractMapper.updateById(updateObj);
|
||||
@@ -89,50 +97,42 @@ public class OutsContractServiceImpl implements OutsContractService {
|
||||
outsContractMapper.deleteById(id);
|
||||
}
|
||||
|
||||
// 需要联表查询
|
||||
// 1.合同名称 √
|
||||
// 2.主控部门(跟踪部门) √
|
||||
// 3.项目经理 √
|
||||
// 4.签订合同总额 √
|
||||
|
||||
@Override
|
||||
public OutsContractRespVO getOutsContract(Long id) {
|
||||
//校验
|
||||
if (id == null) {
|
||||
throw exception(OUTS_CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
public OutsContractDetailDO getOutsContractDetail(Long id) {
|
||||
OutsContractDetailDO outsContractDetailDO = new OutsContractDetailDO();
|
||||
OutsContractDO outsContractDO = outsContractMapper.selectById(id);
|
||||
OutsContractRespVO outsContractRespVO = BeanUtils.toBean(outsContractDO, OutsContractRespVO.class);
|
||||
Long contractId = outsContractDO.getContractId();
|
||||
ContractDO contractDO = contractService.getContractDetail(outsContractDO.getContractId());
|
||||
outsContractDetailDO.setAmount(contractDO.getAmount());
|
||||
outsContractDetailDO.setName(contractDO.getName());
|
||||
//校验
|
||||
validateOutsContractExists(id);
|
||||
|
||||
Long projectId = outsContractDO.getProjectId();
|
||||
projectTrackingApi.validateProjectExists(projectId);
|
||||
ProjectScheduleDetailDTO projectScheduleDetail = projectScheduleApi.getProjectScheduleDetail(projectId);
|
||||
ProjectTrackingDetailDTO projectTracking = projectTrackingApi.getProjectTracking(projectId);
|
||||
BeanUtil.copyProperties(outsContractDO, outsContractDetailDO);
|
||||
BeanUtil.copyProperties(projectTracking,outsContractDetailDO);
|
||||
BeanUtil.copyProperties(projectScheduleDetail,outsContractDetailDO);
|
||||
|
||||
outsContractRespVO.setMajor(OutsContractMajorEnum.getNoByCode(outsContractRespVO.getMajor()));
|
||||
outsContractRespVO.setCountType(CountTypeEnum.getNoByCode(outsContractRespVO.getCountType()));
|
||||
|
||||
return outsContractRespVO;
|
||||
return outsContractDetailDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OutsContractRespVO> getOutsContractPage(OutsContractPageReqVO pageReqVO) {
|
||||
|
||||
if (pageReqVO == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
PageResult<OutsContractDO> outsContractDOPage = outsContractMapper.selectPage(pageReqVO);
|
||||
List<OutsContractDO> list = outsContractDOPage.getList();
|
||||
List<OutsContractDetailDO> outsContractDetailDOS = new ArrayList<>();
|
||||
|
||||
|
||||
PageResult<OutsContractDO> outsContractDOPageResult = outsContractMapper.selectPage(pageReqVO);
|
||||
List<OutsContractDO> outsContractDOList = outsContractDOPageResult.getList();
|
||||
List<OutsContractRespVO> outsContractRespVOList = new ArrayList<>();
|
||||
|
||||
|
||||
for (OutsContractDO outsContractDO : outsContractDOList) {
|
||||
for (OutsContractDO outsContractDO : list) {
|
||||
Long id = outsContractDO.getId();
|
||||
OutsContractRespVO outsContract = getOutsContract(id);
|
||||
outsContractRespVOList.add(outsContract);
|
||||
OutsContractDetailDO outsContractDetail = getOutsContractDetail(id);
|
||||
outsContractDetailDOS.add(outsContractDetail);
|
||||
}
|
||||
|
||||
List<OutsContractRespVO> respVOS = BeanUtils.toBean(outsContractDetailDOS, OutsContractRespVO.class);
|
||||
PageResult<OutsContractRespVO> pageResult = new PageResult<>();
|
||||
pageResult.setList(outsContractRespVOList);
|
||||
pageResult.setList(respVOS);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,6 @@ 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, "应收款管理历史记录不存在");
|
||||
|
||||
@@ -30,9 +29,7 @@ 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, "预算管理已存在");
|
||||
|
||||
}
|
||||
|
@@ -23,13 +23,6 @@
|
||||
<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>
|
||||
|
@@ -1,6 +1,5 @@
|
||||
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;
|
||||
@@ -9,6 +8,7 @@ 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,7 +24,6 @@ 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;
|
||||
@@ -43,14 +42,14 @@ public class BudgetController {
|
||||
@Operation(summary = "创建预算管理")
|
||||
@PreAuthorize("@ss.hasPermission('pms:budget:create')")
|
||||
public CommonResult<Long> createBudget(@Valid @RequestBody BudgetSaveReqVO createReqVO) {
|
||||
return success(budgetService.createBudget(getLoginUserId(), createReqVO));
|
||||
return success(budgetService.createBudget(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新预算管理")
|
||||
@PreAuthorize("@ss.hasPermission('pms:budget:update')")
|
||||
public CommonResult<Boolean> updateBudget(@Valid @RequestBody BudgetSaveReqVO updateReqVO) {
|
||||
budgetService.updateBudget(getLoginUserId(), updateReqVO);
|
||||
budgetService.updateBudget(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -68,19 +67,16 @@ 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) {
|
||||
BudgetDetailDO budgetDetailDO = budgetService.getBudgetDetail(id);
|
||||
BudgetRespVO budgetRespVO = new BudgetRespVO();
|
||||
org.springframework.beans.BeanUtils.copyProperties(budgetDetailDO, budgetRespVO);
|
||||
|
||||
return success(budgetRespVO);
|
||||
BudgetDO budget = budgetService.getBudget(id);
|
||||
return success(BeanUtils.toBean(budget, BudgetRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得预算管理分页")
|
||||
@PreAuthorize("@ss.hasPermission('pms:budget:query')")
|
||||
public CommonResult<PageResult<BudgetRespVO>> getBudgetPage(@Valid BudgetPageReqVO pageReqVO) {
|
||||
PageResult<BudgetRespVO> pageResult = budgetService.getBudgetPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
PageResult<BudgetDO> pageResult = budgetService.getBudgetPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, BudgetRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@@ -90,7 +86,7 @@ public class BudgetController {
|
||||
public void exportBudgetExcel(@Valid BudgetPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<BudgetRespVO> list = budgetService.getBudgetPage(pageReqVO).getList();
|
||||
List<BudgetDO> list = budgetService.getBudgetPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "预算管理.xls", "数据", BudgetRespVO.class,
|
||||
BeanUtils.toBean(list, BudgetRespVO.class));
|
||||
|
@@ -16,11 +16,41 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@ToString(callSuper = true)
|
||||
public class BudgetPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@Schema(description = "项目id", example = "13470")
|
||||
private Long projectId;
|
||||
|
||||
@Schema(description = "合同编号", example = "47")
|
||||
@Schema(description = "合同管理", example = "20248")
|
||||
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;
|
||||
|
||||
}
|
@@ -13,39 +13,6 @@ 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;
|
||||
|
@@ -1,6 +1,5 @@
|
||||
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.*;
|
||||
@@ -11,40 +10,6 @@ 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;
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
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;
|
||||
@@ -25,7 +24,6 @@ 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;
|
||||
@@ -40,11 +38,27 @@ 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(getLoginUserId(), 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);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -53,18 +67,16 @@ 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) {
|
||||
BudgetHistoryDetailDO budgetHistoryDetailDO = budgetHistoryService.getBudgetHistoryDetail(id);
|
||||
BudgetHistoryRespVO budgetHistoryRespVO = new BudgetHistoryRespVO();
|
||||
org.springframework.beans.BeanUtils.copyProperties(budgetHistoryDetailDO, budgetHistoryRespVO);
|
||||
return success(budgetHistoryRespVO);
|
||||
BudgetHistoryDO budgetHistory = budgetHistoryService.getBudgetHistory(id);
|
||||
return success(BeanUtils.toBean(budgetHistory, BudgetHistoryRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得历史预算管理分页")
|
||||
@PreAuthorize("@ss.hasPermission('pms:budget-history:query')")
|
||||
public CommonResult<PageResult<BudgetHistoryRespVO>> getBudgetHistoryPage(@Valid BudgetHistoryPageReqVO pageReqVO) {
|
||||
PageResult<BudgetHistoryRespVO> pageResult = budgetHistoryService.getBudgetHistoryPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
PageResult<BudgetHistoryDO> pageResult = budgetHistoryService.getBudgetHistoryPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, BudgetHistoryRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@@ -74,7 +86,7 @@ public class BudgetHistoryController {
|
||||
public void exportBudgetHistoryExcel(@Valid BudgetHistoryPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<BudgetHistoryRespVO> list = budgetHistoryService.getBudgetHistoryPage(pageReqVO).getList();
|
||||
List<BudgetHistoryDO> list = budgetHistoryService.getBudgetHistoryPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "历史预算管理.xls", "数据", BudgetHistoryRespVO.class,
|
||||
BeanUtils.toBean(list, BudgetHistoryRespVO.class));
|
||||
|
@@ -16,10 +16,53 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@ToString(callSuper = true)
|
||||
public class BudgetHistoryPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@Schema(description = "项目id", example = "15123")
|
||||
private Long projectId;
|
||||
|
||||
@Schema(description = "合同编号", example = "47")
|
||||
@Schema(description = "合同管理", example = "23971")
|
||||
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;
|
||||
|
||||
}
|
@@ -13,40 +13,6 @@ 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;
|
||||
|
@@ -1,6 +1,5 @@
|
||||
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.*;
|
||||
@@ -11,40 +10,6 @@ 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;
|
||||
|
||||
|
@@ -1,55 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
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;
|
||||
}
|
@@ -13,6 +13,8 @@ import java.math.BigDecimal;
|
||||
@Data
|
||||
public class ProjectTrackingDetailDO extends ProjectDO {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 项目编号
|
||||
*/
|
||||
@@ -23,6 +25,7 @@ public class ProjectTrackingDetailDO extends ProjectDO {
|
||||
*/
|
||||
private String trackingDep;
|
||||
|
||||
|
||||
/**
|
||||
* 出图公司
|
||||
*/
|
||||
@@ -38,5 +41,4 @@ public class ProjectTrackingDetailDO extends ProjectDO {
|
||||
*/
|
||||
private String constructionSide;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -21,6 +21,16 @@ 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));
|
||||
}
|
||||
|
||||
|
@@ -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));
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,6 @@
|
||||
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;
|
||||
@@ -16,15 +14,42 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
*/
|
||||
public interface BudgetService {
|
||||
|
||||
Long createBudget(Long loginUserId, @Valid BudgetSaveReqVO createReqVO);
|
||||
/**
|
||||
* 创建预算管理
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createBudget(@Valid BudgetSaveReqVO createReqVO);
|
||||
|
||||
void updateBudget(Long loginUserId, @Valid BudgetSaveReqVO updateReqVO);
|
||||
/**
|
||||
* 更新预算管理
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateBudget(@Valid BudgetSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除预算管理
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteBudget(Long id);
|
||||
|
||||
PageResult<BudgetRespVO> getBudgetPage(BudgetPageReqVO pageReqVO);
|
||||
/**
|
||||
* 获得预算管理
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 预算管理
|
||||
*/
|
||||
BudgetDO getBudget(Long id);
|
||||
|
||||
BudgetDetailDO getBudgetDetail(Long id);
|
||||
/**
|
||||
* 获得预算管理分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 预算管理分页
|
||||
*/
|
||||
PageResult<BudgetDO> getBudgetPage(BudgetPageReqVO pageReqVO);
|
||||
|
||||
void validateBudgetExists(Long id);
|
||||
}
|
@@ -1,23 +1,10 @@
|
||||
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;
|
||||
@@ -29,7 +16,6 @@ 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 实现类
|
||||
@@ -40,103 +26,24 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_E
|
||||
@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(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);
|
||||
}
|
||||
}
|
||||
public Long createBudget(BudgetSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
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(Long loginUserId, BudgetSaveReqVO updateReqVO) {
|
||||
public void updateBudget(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);
|
||||
}
|
||||
|
||||
@@ -148,57 +55,20 @@ public class BudgetServiceImpl implements BudgetService {
|
||||
budgetMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateBudgetExists(Long id) {
|
||||
private void validateBudgetExists(Long id) {
|
||||
if (budgetMapper.selectById(id) == null) {
|
||||
throw exception(BUDGET_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
public BudgetDO getBudget(Long id) {
|
||||
return budgetMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
public PageResult<BudgetDO> getBudgetPage(BudgetPageReqVO pageReqVO) {
|
||||
return budgetMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@@ -1,8 +1,6 @@
|
||||
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;
|
||||
@@ -16,12 +14,27 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
*/
|
||||
public interface BudgetHistoryService {
|
||||
|
||||
/**
|
||||
* 创建预算管理
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createBudgetHistory(@Valid BudgetHistorySaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新预算管理
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateBudgetHistory(Long loginUserId, @Valid BudgetHistorySaveReqVO updateReqVO);
|
||||
void updateBudgetHistory(@Valid BudgetHistorySaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除预算管理
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteBudgetHistory(Long id);
|
||||
|
||||
/**
|
||||
* 获得预算管理
|
||||
@@ -29,7 +42,7 @@ public interface BudgetHistoryService {
|
||||
* @param id 编号
|
||||
* @return 预算管理
|
||||
*/
|
||||
BudgetHistoryDetailDO getBudgetHistoryDetail(Long id);
|
||||
BudgetHistoryDO getBudgetHistory(Long id);
|
||||
|
||||
/**
|
||||
* 获得预算管理分页
|
||||
@@ -37,6 +50,6 @@ public interface BudgetHistoryService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 预算管理分页
|
||||
*/
|
||||
PageResult<BudgetHistoryRespVO> getBudgetHistoryPage(BudgetHistoryPageReqVO pageReqVO);
|
||||
PageResult<BudgetHistoryDO> getBudgetHistoryPage(BudgetHistoryPageReqVO pageReqVO);
|
||||
|
||||
}
|
@@ -1,20 +1,10 @@
|
||||
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;
|
||||
@@ -25,16 +15,13 @@ 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 {
|
||||
@@ -42,34 +29,32 @@ public class BudgetHistoryServiceImpl implements BudgetHistoryService {
|
||||
@Resource
|
||||
private BudgetHistoryMapper budgetHistoryMapper;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private ProjectTrackingService projectTrackingService;
|
||||
|
||||
@Resource
|
||||
private ContractApi contractApi;
|
||||
|
||||
@Resource
|
||||
private OutsContractApi outsContractApi;
|
||||
@Override
|
||||
public Long createBudgetHistory(BudgetHistorySaveReqVO createReqVO) {
|
||||
// 插入
|
||||
BudgetHistoryDO budgetHistory = BeanUtils.toBean(createReqVO, BudgetHistoryDO.class);
|
||||
budgetHistoryMapper.insert(budgetHistory);
|
||||
// 返回
|
||||
return budgetHistory.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBudgetHistory(Long loginUserId, BudgetHistorySaveReqVO updateReqVO) {
|
||||
public void updateBudgetHistory(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);
|
||||
@@ -77,55 +62,13 @@ public class BudgetHistoryServiceImpl implements BudgetHistoryService {
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
public BudgetHistoryDO getBudgetHistory(Long id) {
|
||||
return budgetHistoryMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
public PageResult<BudgetHistoryDO> getBudgetHistoryPage(BudgetHistoryPageReqVO pageReqVO) {
|
||||
return budgetHistoryMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user