[feat] 新增外部合同的流程管理 新增外部合同历史管理

This commit is contained in:
wyw 2024-08-20 10:24:42 +08:00
parent f12b055dfe
commit ca81820971
8 changed files with 160 additions and 36 deletions

View File

@ -1,5 +1,9 @@
package cn.iocoder.yudao.module.cms.controller.admin.extcontracthistory;
import cn.iocoder.yudao.framework.common.util.file.FileUtils;
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractRespVO;
import cn.iocoder.yudao.module.cms.dal.dataobject.extcontract.ExtContractDetailDO;
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;
@ -50,8 +54,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")

View File

@ -1,5 +1,6 @@
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;
@ -9,6 +10,7 @@ import lombok.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 外部合同新增/修改 Request VO")
@Data
@ -85,7 +87,7 @@ public class ExtContractHistorySaveReqVO {
@Schema(description = "合同附件url", example = "https://www.iocoder.cn")
@ExcelProperty("合同附件url")
private String contractFileUrl;
private List<FileDTO> contractFileUrl;
@Schema(description = "建安费")
@ExcelProperty("建安费")
@ -123,16 +125,12 @@ public class ExtContractHistorySaveReqVO {
@Schema(description = "审核文件url", example = "https://www.iocoder.cn")
@ExcelProperty("审核文件url")
private String reviewFileUrl;
private List<FileDTO> reviewFileUrl;
@Schema(description = "最后编辑人")
@ExcelProperty("最后编辑人")
private String finalEditor;
@Schema(description = "流程实体id", example = "24870")
@ExcelProperty("流程实体id")
private String processInstanceId;
@Schema(description = "流程状态")
@ExcelProperty(value = "流程状态", converter = DictConvert.class)
@DictFormat(DictTypeConstants.PROCESS_STATUS)

View File

@ -0,0 +1,45 @@
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 {
/**
* 项目编号
*/
private String code;
/**
* 跟踪部门
*/
private String trackingDep;
/**
* 出图公司
*/
private String drawingCompany;
/**
* 预计公司合同总金额
*/
private BigDecimal expectedContractAmount;
/**
* 项目负责人
*/
private String projectManager;
/**
* 合同商议提示
*/
private LocalDateTime reminderTime;
}

View File

@ -0,0 +1,40 @@
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 {
/**
* 项目编号
*/
private String code;
/**
* 建设方
*/
private String constructionSide;
/**
* 主控部门
*/
private String trackingDep;
/**
* 项目负责人
*/
private String projectManager;
/**
* 外部合同商议提示
*/
private LocalDateTime exReminderTime;
}

View File

@ -62,4 +62,9 @@ public interface ExtContractService {
String createProcess(Long loginUserId,Long id);
/**
* 判断外部合同是否存在
* @param id 外部合同id
*/
void validateExtContractExists(Long id);
}

View File

@ -191,7 +191,7 @@ public class ExtContractServiceImpl implements ExtContractService {
return processInstanceId;
}
private void validateExtContractExists(Long id) {
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;
}