mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-02-01 19:24:57 +08:00
[fix] 优化合同管理,外部合同管理功能
This commit is contained in:
parent
787f153bf1
commit
0a52eddbc6
@ -81,9 +81,6 @@ public class ContractPageReqVO extends PageParam {
|
||||
@Schema(description = "审核文件url", example = "https://www.iocoder.cn")
|
||||
private String reviewFileUrl;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "签订合同总额")
|
||||
private BigDecimal amount;
|
||||
|
@ -119,10 +119,6 @@ public class ContractRespVO {
|
||||
@ExcelProperty("审核文件url")
|
||||
private String reviewFileUrl;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "签订合同总额")
|
||||
@ExcelProperty("签订合同总额")
|
||||
private BigDecimal amount;
|
||||
|
@ -126,24 +126,4 @@ public class ContractSaveReqVO {
|
||||
@Schema(description = "其他费")
|
||||
private BigDecimal otherFee;
|
||||
|
||||
@Schema(description = "创建者")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "创建时间不能为空")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "更新者")
|
||||
private String updater;
|
||||
|
||||
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "更新时间不能为空")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12587")
|
||||
@NotNull(message = "租户编号不能为空")
|
||||
private Long tenantId;
|
||||
|
||||
|
||||
|
||||
}
|
@ -23,24 +23,5 @@ public class ContractOutsPageReqVO extends PageParam {
|
||||
@Schema(description = "外包合同id", example = "9277")
|
||||
private Long outsContractId;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] cteateTime;
|
||||
|
||||
@Schema(description = "更新人")
|
||||
private String updator;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] updateTime;
|
||||
|
||||
@Schema(description = "是否删除")
|
||||
private Boolean delete;
|
||||
|
||||
@Schema(description = "租户id", example = "15943")
|
||||
private Long tenantId;
|
||||
|
||||
}
|
@ -24,28 +24,4 @@ public class ContractOutsRespVO {
|
||||
@ExcelProperty("外包合同id")
|
||||
private Long outsContractId;
|
||||
|
||||
@Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime cteateTime;
|
||||
|
||||
@Schema(description = "更新人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("更新人")
|
||||
private String updator;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@ExcelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "是否删除", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("是否删除")
|
||||
private Boolean delete;
|
||||
|
||||
@Schema(description = "租户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "15943")
|
||||
@ExcelProperty("租户id")
|
||||
private Long tenantId;
|
||||
|
||||
}
|
@ -22,26 +22,7 @@ public class ContractOutsSaveReqVO {
|
||||
@NotNull(message = "外包合同id不能为空")
|
||||
private Long outsContractId;
|
||||
|
||||
@Schema(description = "创建人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "创建人不能为空")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime cteateTime;
|
||||
|
||||
@Schema(description = "更新人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "更新人不能为空")
|
||||
private String updator;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "是否删除", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "是否删除不能为空")
|
||||
private Boolean delete;
|
||||
|
||||
@Schema(description = "租户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "15943")
|
||||
@NotNull(message = "租户id不能为空")
|
||||
private Long tenantId;
|
||||
|
||||
}
|
@ -100,10 +100,6 @@ public class ExtContractPageReqVO extends PageParam {
|
||||
@Schema(description = "审核文件url", example = "https://www.iocoder.cn")
|
||||
private String reviewFileUrl;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "合同id", example = "27460")
|
||||
private Long contractId;
|
||||
|
||||
|
@ -38,11 +38,10 @@ public class ExtContractRespVO {
|
||||
@ExcelProperty("项目经理")
|
||||
private String projectManager;
|
||||
|
||||
@Schema(description = "合同提示时间")
|
||||
@ExcelProperty("合同提示时间")
|
||||
@Schema(description = "合同商议提示时间")
|
||||
@ExcelProperty("合同商议提示时间")
|
||||
private LocalDateTime exReminderTime;
|
||||
|
||||
|
||||
@Schema(description = "合同进展")
|
||||
@ExcelProperty("合同进展")
|
||||
private String progress;
|
||||
@ -142,18 +141,5 @@ public class ExtContractRespVO {
|
||||
private Long contractId;
|
||||
|
||||
|
||||
@Schema(description = "创建者")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "创建时间不能为空")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "更新者")
|
||||
private String updater;
|
||||
|
||||
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "更新时间不能为空")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
@ -129,22 +129,5 @@ public class ExtContractSaveReqVO {
|
||||
@Schema(description = "合同id", example = "27460")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "创建者")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "创建时间不能为空")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "更新者")
|
||||
private String updater;
|
||||
|
||||
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "更新时间不能为空")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12587")
|
||||
@NotNull(message = "租户编号不能为空")
|
||||
private Long tenantId;
|
||||
|
||||
}
|
@ -62,11 +62,11 @@ public class OutsContractController {
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得外包合同")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@Parameter(name = "contractId", description = "主合同编号", required = true, example = "1")
|
||||
@PreAuthorize("@ss.hasPermission('cms:outs-contract:query')")
|
||||
public CommonResult<OutsContractRespVO> getOutsContract(@RequestParam("id") Long id) {
|
||||
OutsContractDO outsContract = outsContractService.getOutsContract(id);
|
||||
return success(BeanUtils.toBean(outsContract, OutsContractRespVO.class));
|
||||
public CommonResult<OutsContractRespVO> getOutsContract(@RequestParam("contractId") Long contractId) {
|
||||
OutsContractRespVO outsContractRespVO = outsContractService.getOutsContract(contractId);
|
||||
return success(outsContractRespVO);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
|
@ -49,8 +49,5 @@ public class OutsContractPageReqVO extends PageParam {
|
||||
@Schema(description = "合同文件url", example = "https://www.iocoder.cn")
|
||||
private String contractFileUrl;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -15,34 +15,45 @@ import java.time.LocalDateTime;
|
||||
@ExcelIgnoreUnannotated
|
||||
public class OutsContractRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2034")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27415")
|
||||
@ExcelProperty("项目id")
|
||||
private Long projectId;
|
||||
|
||||
@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 amount;
|
||||
|
||||
@Schema(description = "外包合同编号")
|
||||
@ExcelProperty("编号")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "外包单位")
|
||||
@ExcelProperty("外包单位")
|
||||
private String outsCompany;
|
||||
|
||||
@Schema(description = "主合同id", example = "19816")
|
||||
@ExcelProperty("主合同id")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "类型", example = "2")
|
||||
@ExcelProperty(value = "类型", converter = DictConvert.class)
|
||||
|
||||
@Schema(description = "外包合同类型", example = "2")
|
||||
@ExcelProperty(value = "外包合同类型", converter = DictConvert.class)
|
||||
@DictFormat("contract_billing_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String countType;
|
||||
|
||||
@Schema(description = "合同金额")
|
||||
@ExcelProperty("合同金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "编号")
|
||||
@ExcelProperty("编号")
|
||||
private String code;
|
||||
@Schema(description = "外包合同金额")
|
||||
@ExcelProperty("外包合同金额")
|
||||
private BigDecimal outsAmount;
|
||||
|
||||
|
||||
@Schema(description = "专业")
|
||||
@ExcelProperty(value = "专业", converter = DictConvert.class)
|
||||
@ -61,8 +72,5 @@ public class OutsContractRespVO {
|
||||
@ExcelProperty("合同文件url")
|
||||
private String contractFileUrl;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
@ -18,31 +21,62 @@ public class OutsContractSaveReqVO {
|
||||
@NotNull(message = "项目id不能为空")
|
||||
private Long projectId;
|
||||
|
||||
|
||||
@Schema(description = "合同名称", example = "张三")
|
||||
@ExcelProperty("合同名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "主合同id", example = "19816")
|
||||
private Long contractId;
|
||||
@Schema(description = "主控部门", requiredMode = Schema.RequiredMode.REQUIRED, example = "生产一部")
|
||||
@ExcelProperty("主控部门")
|
||||
private String trackingDep;
|
||||
|
||||
@Schema(description = "类型", example = "2")
|
||||
private String countType;
|
||||
@Schema(description = "项目经理", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("项目经理")
|
||||
private String projectManager;
|
||||
|
||||
@Schema(description = "合同金额")
|
||||
@Schema(description = "签订合同总额")
|
||||
@ExcelProperty("签订合同总额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "编号")
|
||||
@Schema(description = "外包合同编号")
|
||||
@ExcelProperty("编号")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "外包单位")
|
||||
@ExcelProperty("外包单位")
|
||||
private String outsCompany;
|
||||
|
||||
@Schema(description = "主合同id", example = "19816")
|
||||
@ExcelProperty("主合同id")
|
||||
private Long contractId;
|
||||
|
||||
|
||||
@Schema(description = "外包合同类型", example = "2")
|
||||
@ExcelProperty(value = "外包合同类型", converter = DictConvert.class)
|
||||
@DictFormat("contract_billing_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String countType;
|
||||
|
||||
|
||||
@Schema(description = "外包合同金额")
|
||||
@ExcelProperty("外包合同金额")
|
||||
private BigDecimal outsAmount;
|
||||
|
||||
|
||||
@Schema(description = "专业")
|
||||
@ExcelProperty(value = "专业", converter = DictConvert.class)
|
||||
@DictFormat("major") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String major;
|
||||
|
||||
@Schema(description = "签订时间")
|
||||
@ExcelProperty("签订时间")
|
||||
private LocalDateTime signingTime;
|
||||
|
||||
@Schema(description = "结算数")
|
||||
@ExcelProperty("结算数")
|
||||
private BigDecimal settlementAmount;
|
||||
|
||||
@Schema(description = "合同文件url", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("合同文件url")
|
||||
private String contractFileUrl;
|
||||
|
||||
}
|
@ -39,11 +39,11 @@ public class ContractOutsDO extends BaseDO {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime cteateTime;
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updator;
|
||||
private String updater;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
|
@ -36,7 +36,6 @@ public interface ContractMapper extends BaseMapperX<ContractDO> {
|
||||
.eqIfPresent(ContractDO::getExtProportion, reqVO.getExtProportion())
|
||||
.eqIfPresent(ContractDO::getApprovedAmount, reqVO.getApprovedAmount())
|
||||
.eqIfPresent(ContractDO::getReviewFileUrl, reqVO.getReviewFileUrl())
|
||||
.betweenIfPresent(ContractDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(ContractDO::getAmount, reqVO.getAmount())
|
||||
.eqIfPresent(ContractDO::getPreAmount, reqVO.getPreAmount())
|
||||
.eqIfPresent(ContractDO::getDesignAmount, reqVO.getDesignAmount())
|
||||
|
@ -19,12 +19,6 @@ public interface ContractOutsMapper extends BaseMapperX<ContractOutsDO> {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ContractOutsDO>()
|
||||
.eqIfPresent(ContractOutsDO::getContractId, reqVO.getContractId())
|
||||
.eqIfPresent(ContractOutsDO::getOutsContractId, reqVO.getOutsContractId())
|
||||
.eqIfPresent(ContractOutsDO::getCreator, reqVO.getCreator())
|
||||
.betweenIfPresent(ContractOutsDO::getCteateTime, reqVO.getCteateTime())
|
||||
.eqIfPresent(ContractOutsDO::getUpdator, reqVO.getUpdator())
|
||||
.betweenIfPresent(ContractOutsDO::getUpdateTime, reqVO.getUpdateTime())
|
||||
.eqIfPresent(ContractOutsDO::getDelete, reqVO.getDelete())
|
||||
.eqIfPresent(ContractOutsDO::getTenantId, reqVO.getTenantId())
|
||||
.orderByDesc(ContractOutsDO::getId));
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.mysql.extContract;
|
||||
package cn.iocoder.yudao.module.cms.dal.mysql.extcontract;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@ -42,7 +42,6 @@ public interface ExtContractMapper extends BaseMapperX<ExtContractDO> {
|
||||
.eqIfPresent(ExtContractDO::getConsortiumCompany, reqVO.getConsortiumCompany())
|
||||
.eqIfPresent(ExtContractDO::getApprovedAmount, reqVO.getApprovedAmount())
|
||||
.eqIfPresent(ExtContractDO::getReviewFileUrl, reqVO.getReviewFileUrl())
|
||||
.betweenIfPresent(ExtContractDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(ExtContractDO::getContractId, reqVO.getContractId())
|
||||
|
||||
);
|
@ -27,7 +27,6 @@ public interface OutsContractMapper extends BaseMapperX<OutsContractDO> {
|
||||
.betweenIfPresent(OutsContractDO::getSigningTime, reqVO.getSigningTime())
|
||||
.eqIfPresent(OutsContractDO::getSettlementAmount, reqVO.getSettlementAmount())
|
||||
.eqIfPresent(OutsContractDO::getContractFileUrl, reqVO.getContractFileUrl())
|
||||
.betweenIfPresent(OutsContractDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(OutsContractDO::getId));
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
package cn.iocoder.yudao.module.cms.service.contract;
|
||||
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.extContract.ExtContractDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.contract.ContractMapper;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.extContract.ExtContractMapper;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.extcontract.ExtContractMapper;
|
||||
import cn.iocoder.yudao.module.pms.api.ProjectApi;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectDetailRespDTO;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO;
|
||||
@ -17,6 +18,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -46,26 +48,25 @@ public class ContractServiceImpl implements ContractService {
|
||||
@Override
|
||||
public Long createContract(ContractSaveReqVO createReqVO) {
|
||||
ContractDO contract = BeanUtils.toBean(createReqVO, ContractDO.class);
|
||||
Long projectId = createReqVO.getProjectId();
|
||||
if (projectId != null) {
|
||||
//进行更新
|
||||
updateContract(createReqVO);
|
||||
}else{
|
||||
//插入
|
||||
contractMapper.insert(contract);
|
||||
//校验
|
||||
Long projectId = contract.getProjectId();
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
if (project == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 返回
|
||||
contractMapper.insert(contract);
|
||||
//返回
|
||||
return contract.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateContract(ContractSaveReqVO updateReqVO) {
|
||||
Long id = updateReqVO.getId();
|
||||
validateContractExists(id);
|
||||
//校验
|
||||
validateContractExists(updateReqVO.getId());
|
||||
Long projectId = updateReqVO.getProjectId();
|
||||
if (projectId == null){
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
if (project == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
// 更新
|
||||
ContractDO updateObj = BeanUtils.toBean(updateReqVO, ContractDO.class);
|
||||
@ -83,11 +84,17 @@ public class ContractServiceImpl implements ContractService {
|
||||
|
||||
@Override
|
||||
public ContractRespVO getContract(Long id) {
|
||||
|
||||
ContractDO contractDO = contractMapper.selectById(id);
|
||||
Long projectId = contractDO.getProjectId();
|
||||
//校验
|
||||
if (projectId == null){
|
||||
if (id == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
ContractDO contractDO = contractMapper.selectById(id);
|
||||
if (contractDO == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
Long projectId = contractDO.getProjectId();
|
||||
|
||||
if (projectId == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
ContractRespVO contractRespVO = BeanUtils.toBean(contractDO, ContractRespVO.class);
|
||||
@ -100,6 +107,7 @@ public class ContractServiceImpl implements ContractService {
|
||||
// 5.预计合同金额 pms_project 直接 √
|
||||
// 6.分包合同商议提示 √
|
||||
// 7.暂定结算数 √
|
||||
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
contractRespVO.setCode(project.getCode());
|
||||
contractRespVO.setDrawingCompany(project.getDrawingCompany());
|
||||
@ -109,10 +117,10 @@ public class ContractServiceImpl implements ContractService {
|
||||
contractRespVO.setTrackingDep(projectDetail.getTrackingDepName());
|
||||
contractRespVO.setProjectManager(projectDetail.getProjectManagerName());
|
||||
|
||||
//分包合同商议提示
|
||||
// ExtContractDO extContractDO = extContractMapper.selectOne("project_id",projectId);
|
||||
// LocalDateTime reminderTime = extContractDO.getSubReminderTime();
|
||||
// contractRespVO.setSubReminderTime(reminderTime);
|
||||
//分包合同商议提示 TODO 待优化
|
||||
ExtContractDO extContractDO = extContractMapper.selectOne("project_id", projectId);
|
||||
LocalDateTime reminderTime = extContractDO.getReminderTime();
|
||||
contractRespVO.setReminderTime(LocalDateTime.now());
|
||||
|
||||
//暂定结算数
|
||||
BigDecimal provisionalSettlement = getProvisionalSettlement(id);
|
||||
@ -124,6 +132,13 @@ public class ContractServiceImpl implements ContractService {
|
||||
|
||||
@Override
|
||||
public PageResult<ContractRespVO> getContractPage(ContractPageReqVO pageReqVO) {
|
||||
//校验
|
||||
Long projectId = pageReqVO.getProjectId();
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
if (project == null){
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
PageResult<ContractDO> contractDOPageResult = contractMapper.selectPage(pageReqVO);
|
||||
List<ContractDO> contractDOList = contractDOPageResult.getList();
|
||||
List<ContractRespVO> contractRespVOList = new ArrayList<>();
|
||||
|
@ -4,13 +4,16 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contractouts.vo.ContractOutsPageReqVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contractouts.vo.ContractOutsSaveReqVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contract.ContractDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contractouts.ContractOutsDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.contract.ContractMapper;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.contractouts.ContractOutsMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
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.CONTRACT_OUTS_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
@ -25,13 +28,25 @@ public class ContractOutsServiceImpl implements ContractOutsService {
|
||||
@Resource
|
||||
private ContractOutsMapper contractOutsMapper;
|
||||
|
||||
@Resource
|
||||
private ContractMapper contractMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Long createContractOuts(ContractOutsSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ContractOutsDO contractOuts = BeanUtils.toBean(createReqVO, ContractOutsDO.class);
|
||||
contractOutsMapper.insert(contractOuts);
|
||||
ContractOutsDO outsDO = BeanUtils.toBean(createReqVO, ContractOutsDO.class);
|
||||
Long contractId = createReqVO.getContractId();
|
||||
Long outsContractId = createReqVO.getOutsContractId();
|
||||
if (contractId == null){
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
if (outsContractId == null){
|
||||
throw exception(CONTRACT_OUTS_NOT_EXISTS);
|
||||
}
|
||||
contractOutsMapper.insert(outsDO);
|
||||
// 返回
|
||||
return contractOuts.getId();
|
||||
return createReqVO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,10 +3,11 @@ 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.ExtContractRespVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractSaveReqVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contract.ContractDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.customerCompany.CustomerCompanyDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.extContract.ExtContractDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.customerCompany.CustomerCompanyMapper;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.extContract.ExtContractMapper;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.extcontract.ExtContractMapper;
|
||||
import cn.iocoder.yudao.module.pms.api.ProjectApi;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectDetailRespDTO;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO;
|
||||
@ -17,11 +18,13 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.EXT_CONTRACT_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.PROJECT_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 外部合同 Service 实现类
|
||||
@ -44,18 +47,27 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
|
||||
@Override
|
||||
public Long createExtContract(ExtContractSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ExtContractDO extContract = BeanUtils.toBean(createReqVO, ExtContractDO.class);
|
||||
extContractMapper.insert(extContract);
|
||||
// 返回
|
||||
return extContract.getId();
|
||||
ExtContractDO contract = BeanUtils.toBean(createReqVO, ExtContractDO.class);
|
||||
//校验
|
||||
Long projectId = contract.getProjectId();
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
if (project == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
extContractMapper.insert(contract);
|
||||
//返回
|
||||
return contract.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExtContract(ExtContractSaveReqVO updateReqVO) {
|
||||
//校验
|
||||
Long id = updateReqVO.getId();
|
||||
validateExtContractExists(id);
|
||||
validateExtContractExists(updateReqVO.getId());
|
||||
Long projectId = updateReqVO.getProjectId();
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
if (project == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
// 更新
|
||||
ExtContractDO updateObj = BeanUtils.toBean(updateReqVO, ExtContractDO.class);
|
||||
extContractMapper.updateById(updateObj);
|
||||
@ -84,8 +96,21 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
// 6.合同商议提示(和分包提示不一样)
|
||||
@Override
|
||||
public ExtContractRespVO getExtContract(Long id) {
|
||||
//校验
|
||||
if (id == null) {
|
||||
throw exception(EXT_CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
ExtContractDO extContractDO = extContractMapper.selectById(id);
|
||||
if (extContractDO == null) {
|
||||
throw exception(EXT_CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long projectId = extContractDO.getProjectId();
|
||||
if (projectApi.getProject(projectId) == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long customerCompanyId = extContractDO.getCustomerCompanyId();
|
||||
ExtContractRespVO extContractRespVO = BeanUtils.toBean(extContractDO, ExtContractRespVO.class);
|
||||
|
||||
@ -93,7 +118,6 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
extContractRespVO.setCode(project.getCode());
|
||||
|
||||
|
||||
ProjectDetailRespDTO projectDetail = projectApi.getProjectDetailById(projectId);
|
||||
extContractRespVO.setTrackingDep(projectDetail.getTrackingDepName());
|
||||
extContractRespVO.setProjectManager(projectDetail.getProjectManagerName());
|
||||
@ -105,9 +129,12 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
|
||||
|
||||
//合同总金额
|
||||
|
||||
BigDecimal contractAmount = getContractAmount(id);
|
||||
extContractRespVO.setAmount(contractAmount);
|
||||
|
||||
//合同商议提示 // TODO 待优化
|
||||
extContractRespVO.setExReminderTime(LocalDateTime.now());
|
||||
|
||||
return extContractRespVO;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.cms.service.outscontract;
|
||||
|
||||
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.OutsContractDO;
|
||||
import jakarta.validation.Valid;
|
||||
@ -41,7 +42,7 @@ public interface OutsContractService {
|
||||
* @param id 编号
|
||||
* @return 外包合同
|
||||
*/
|
||||
OutsContractDO getOutsContract(Long id);
|
||||
OutsContractRespVO getOutsContract(Long id);
|
||||
|
||||
/**
|
||||
* 获得外包合同分页
|
||||
|
@ -3,14 +3,17 @@ package cn.iocoder.yudao.module.cms.service.outscontract;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
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.OutsContractDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.outscontract.OutsContractMapper;
|
||||
import cn.iocoder.yudao.module.cms.service.contract.ContractService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
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.OUTS_CONTRACT_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
@ -25,18 +28,19 @@ public class OutsContractServiceImpl implements OutsContractService {
|
||||
@Resource
|
||||
private OutsContractMapper outsContractMapper;
|
||||
|
||||
@Resource
|
||||
private ContractService contractService;
|
||||
|
||||
@Override
|
||||
public Long createOutsContract(OutsContractSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
OutsContractDO outsContract = BeanUtils.toBean(createReqVO, OutsContractDO.class);
|
||||
outsContractMapper.insert(outsContract);
|
||||
// 返回
|
||||
return outsContract.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOutsContract(OutsContractSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
// 校验
|
||||
validateOutsContractExists(updateReqVO.getId());
|
||||
// 更新
|
||||
OutsContractDO updateObj = BeanUtils.toBean(updateReqVO, OutsContractDO.class);
|
||||
@ -45,26 +49,32 @@ public class OutsContractServiceImpl implements OutsContractService {
|
||||
|
||||
@Override
|
||||
public void deleteOutsContract(Long id) {
|
||||
// 校验存在
|
||||
// 校验
|
||||
validateOutsContractExists(id);
|
||||
// 删除
|
||||
outsContractMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutsContractRespVO getOutsContract(Long contractId) {
|
||||
//校验
|
||||
if (contractId == null){
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OutsContractDO> getOutsContractPage(OutsContractPageReqVO pageReqVO) {
|
||||
return outsContractMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
private void validateOutsContractExists(Long id) {
|
||||
if (outsContractMapper.selectById(id) == null) {
|
||||
throw exception(OUTS_CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutsContractDO getOutsContract(Long id) {
|
||||
return outsContractMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OutsContractDO> getOutsContractPage(OutsContractPageReqVO pageReqVO) {
|
||||
return outsContractMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user