[feat] 新增外部合同管理功能

This commit is contained in:
wyw
2024-07-24 16:22:04 +08:00
parent 967a83948b
commit f0dc469105
28 changed files with 3650 additions and 28 deletions

View File

@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.cms.controller.admin.contract.vo.ContractPageReqVO;
import cn.iocoder.yudao.module.cms.controller.admin.contract.vo.ContractRespVO;
import cn.iocoder.yudao.module.cms.controller.admin.contract.vo.ContractSaveReqVO;
import cn.iocoder.yudao.module.cms.dal.dataobject.contract.ContractDO;
import cn.iocoder.yudao.module.cms.service.contract.ContractService;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
@ -16,7 +15,6 @@ import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;

View File

@ -26,9 +26,9 @@ public class ContractRespVO {
@ExcelProperty("项目经理")
private String projectManager;
@Schema(description = "合同提示时间")
@ExcelProperty("合同提示时间")
private LocalDateTime reminderTime;
@Schema(description = "分包合同提示时间")
@ExcelProperty("分包合同提示时间")
private LocalDateTime subReminderTime;
@Schema(description = "暂定结算数")
@ExcelProperty("暂定结算数")

View File

@ -97,4 +97,28 @@ 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)
@NotNull(message = "是否删除不能为空")
private Boolean deleted;
@Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12587")
@NotNull(message = "租户编号不能为空")
private Long tenantId;
}

View File

@ -0,0 +1,96 @@
package cn.iocoder.yudao.module.cms.controller.admin.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.extcontract.ExtContractDO;
import cn.iocoder.yudao.module.cms.service.extcontract.ExtContractService;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
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.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 外部合同")
@RestController
@RequestMapping("/cms-ext/ext-contract")
@Validated
public class ExtContractController {
@Resource
private ExtContractService extContractService;
@PostMapping("/create")
@Operation(summary = "创建外部合同")
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:create')")
public CommonResult<Long> createExtContract(@Valid @RequestBody ExtContractSaveReqVO createReqVO) {
return success(extContractService.createExtContract(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新外部合同")
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:update')")
public CommonResult<Boolean> updateExtContract(@Valid @RequestBody ExtContractSaveReqVO updateReqVO) {
extContractService.updateExtContract(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除外部合同")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:delete')")
public CommonResult<Boolean> deleteExtContract(@RequestParam("id") Long id) {
extContractService.deleteExtContract(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得外部合同")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:query')")
public CommonResult<ExtContractRespVO> getExtContract(@RequestParam("id") Long id) {
ExtContractRespVO extContract = extContractService.getExtContract(id);
return success(extContract);
}
@GetMapping("/page")
@Operation(summary = "获得外部合同分页")
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:query')")
public CommonResult<PageResult<ExtContractRespVO>> getExtContractPage(@Valid ExtContractPageReqVO pageReqVO) {
PageResult<ExtContractDO> pageResult = extContractService.getExtContractPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ExtContractRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出外部合同 Excel")
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportExtContractExcel(@Valid ExtContractPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ExtContractDO> list = extContractService.getExtContractPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "外部合同.xls", "数据", ExtContractRespVO.class,
BeanUtils.toBean(list, ExtContractRespVO.class));
}
}

View File

@ -0,0 +1,110 @@
package cn.iocoder.yudao.module.cms.controller.admin.extcontract.vo;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 外部合同分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ExtContractPageReqVO extends PageParam {
@Schema(description = "项目id", example = "30598")
private Long projectId;
@Schema(description = "合同名称", example = "芋艿")
private String name;
@Schema(description = "合同类型", example = "1")
private String type;
@Schema(description = "客户公司id", example = "25191")
private Long customerCompanyId;
@Schema(description = "合同进展")
private String progress;
@Schema(description = "预计签订时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] expectedTime;
@Schema(description = "签订时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] signingTime;
@Schema(description = "归档时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] archiveTime;
@Schema(description = "状态", example = "2")
private String status;
@Schema(description = "合同金额")
private BigDecimal amount;
@Schema(description = "前期费用")
private BigDecimal preAmount;
@Schema(description = "设计费")
private BigDecimal designFee;
@Schema(description = "勘测费")
private BigDecimal surveyFees;
@Schema(description = "检测费")
private BigDecimal testingFee;
@Schema(description = "其他费")
private String otherFee;
@Schema(description = "计费方式", example = "1")
private String countType;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "合同附件url", example = "https://www.iocoder.cn")
private String contractFileUrl;
@Schema(description = "建安费")
private BigDecimal constructionCost;
@Schema(description = "资金来源")
private String source;
@Schema(description = "收费标准")
private String chargingStandard;
@Schema(description = "优惠", example = "15529")
private String discount;
@Schema(description = "是否联合体")
private Boolean consortium;
@Schema(description = "联合体单位")
private String consortiumCompany;
@Schema(description = "合同提示时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] reminderTime;
@Schema(description = "审定金额")
private BigDecimal approvedAmount;
@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;
}

View File

@ -0,0 +1,159 @@
package cn.iocoder.yudao.module.cms.controller.admin.extcontract.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 外部合同 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ExtContractRespVO {
@Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SJ24001")
@ExcelProperty("项目编号")
private String code;
@Schema(description = "合同名称", example = "芋艿")
@ExcelProperty("合同名称")
private String name;
@Schema(description = "合同类型", example = "1")
@ExcelProperty("合同类型")
private String type;
@Schema(description = "客户名称")
@ExcelProperty("客户名称")
private String customerCompanyName;
@Schema(description = "主控部门", requiredMode = Schema.RequiredMode.REQUIRED, example = "生产一部")
@ExcelProperty("主控部门")
private String trackingDep;
@Schema(description = "项目经理", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("项目经理")
private String projectManager;
@Schema(description = "合同提示时间")
@ExcelProperty("合同提示时间")
private LocalDateTime reminderTime;
@Schema(description = "合同进展")
@ExcelProperty("合同进展")
private String progress;
@Schema(description = "预计签订时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("预计签订时间")
private LocalDateTime expectedTime;
@Schema(description = "签订时间")
@ExcelProperty("签订时间")
private LocalDateTime signingTime;
@Schema(description = "归档时间")
@ExcelProperty("归档时间")
private LocalDateTime archiveTime;
@Schema(description = "状态", example = "2")
@ExcelProperty("状态")
private String status;
@Schema(description = "合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("合同金额")
private BigDecimal amount;
@Schema(description = "前期费用")
@ExcelProperty("前期费用")
private BigDecimal preAmount;
@Schema(description = "设计费")
@ExcelProperty("设计费")
private BigDecimal designFee;
@Schema(description = "勘测费")
@ExcelProperty("勘测费")
private BigDecimal surveyFees;
@Schema(description = "检测费")
@ExcelProperty("检测费")
private BigDecimal testingFee;
@Schema(description = "其他费")
@ExcelProperty("其他费")
private String otherFee;
@Schema(description = "计费方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("计费方式")
private String countType;
@Schema(description = "备注", example = "你猜")
@ExcelProperty("备注")
private String remark;
@Schema(description = "合同附件url", example = "https://www.iocoder.cn")
@ExcelProperty("合同附件url")
private String contractFileUrl;
@Schema(description = "建安费")
@ExcelProperty("建安费")
private BigDecimal constructionCost;
@Schema(description = "资金来源")
@ExcelProperty("资金来源")
private String source;
@Schema(description = "分包合同提示时间")
@ExcelProperty("分包合同提示时间")
private LocalDateTime subReminderTime;
@Schema(description = "收费标准", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("收费标准")
private String chargingStandard;
@Schema(description = "优惠", example = "15529")
@ExcelProperty("优惠")
private String discount;
@Schema(description = "是否联合体", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("是否联合体")
private Boolean consortium;
@Schema(description = "联合体单位")
@ExcelProperty("联合体单位")
private String consortiumCompany;
@Schema(description = "审定金额")
@ExcelProperty("审定金额")
private BigDecimal approvedAmount;
@Schema(description = "审核文件url", example = "https://www.iocoder.cn")
@ExcelProperty("审核文件url")
private String reviewFileUrl;
@Schema(description = "合同id", example = "27460")
@ExcelProperty("合同id")
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;
}

View File

@ -0,0 +1,129 @@
package cn.iocoder.yudao.module.cms.controller.admin.extcontract.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 外部合同新增/修改 Request VO")
@Data
public class ExtContractSaveReqVO {
@Schema(description = "外部合同编号", requiredMode = Schema.RequiredMode.REQUIRED)
private Long id;
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "30598")
@NotNull(message = "项目id不能为空")
private Long projectId;
@Schema(description = "合同名称", example = "芋艿")
private String name;
@Schema(description = "合同类型", example = "1")
private String type;
@Schema(description = "客户公司id", example = "25191")
private Long customerCompanyId;
@Schema(description = "合同进展")
private String progress;
@Schema(description = "预计签订时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "预计签订时间不能为空")
private LocalDateTime expectedTime;
@Schema(description = "签订时间")
private LocalDateTime signingTime;
@Schema(description = "归档时间")
private LocalDateTime archiveTime;
@Schema(description = "状态", example = "2")
private String status;
@Schema(description = "合同金额", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "合同金额不能为空")
private BigDecimal amount;
@Schema(description = "前期费用")
private BigDecimal preAmount;
@Schema(description = "设计费")
private BigDecimal designFee;
@Schema(description = "勘测费")
private BigDecimal surveyFees;
@Schema(description = "检测费")
private BigDecimal testingFee;
@Schema(description = "其他费")
private String otherFee;
@Schema(description = "计费方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotEmpty(message = "计费方式不能为空")
private String countType;
@Schema(description = "备注", example = "你猜")
private String remark;
@Schema(description = "合同附件url", example = "https://www.iocoder.cn")
private String contractFileUrl;
@Schema(description = "建安费")
private BigDecimal constructionCost;
@Schema(description = "资金来源")
private String source;
@Schema(description = "收费标准", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "收费标准不能为空")
private String chargingStandard;
@Schema(description = "优惠", example = "15529")
private String discount;
@Schema(description = "是否联合体", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "是否联合体不能为空")
private Boolean consortium;
@Schema(description = "联合体单位")
private String consortiumCompany;
@Schema(description = "合同提示时间")
private LocalDateTime reminderTime;
@Schema(description = "审定金额")
private BigDecimal approvedAmount;
@Schema(description = "审核文件url", example = "https://www.iocoder.cn")
private String reviewFileUrl;
@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)
@NotNull(message = "是否删除不能为空")
private Boolean deleted;
@Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12587")
@NotNull(message = "租户编号不能为空")
private Long tenantId;
}

View File

@ -133,24 +133,4 @@ public class ContractDO extends BaseDO {
*/
private BigDecimal otherFee;
/**
* 创建者
*/
private String creator;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新者
*/
private String updater;
/**
* 更新时间
*/
private LocalDateTime updateTime;
}

View File

@ -0,0 +1,152 @@
package cn.iocoder.yudao.module.cms.dal.dataobject.extcontract;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 外部合同 DO
*
* @author 管理员
*/
@TableName("cms_ext_contract")
@KeySequence("cms_ext_contract_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ExtContractDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 项目id
*/
private Long projectId;
/**
* 合同名称
*/
private String name;
/**
* 合同类型
*/
private String type;
/**
* 客户公司id
*/
private Long customerCompanyId;
/**
* 合同进展
*/
private String progress;
/**
* 预计签订时间
*/
private LocalDateTime expectedTime;
/**
* 签订时间
*/
private LocalDateTime signingTime;
/**
* 归档时间
*/
private LocalDateTime archiveTime;
/**
* 状态
*/
private String status;
/**
* 合同金额
*/
private BigDecimal amount;
/**
* 前期费用
*/
private BigDecimal preAmount;
/**
* 设计费
*/
private BigDecimal designFee;
/**
* 勘测费
*/
private BigDecimal surveyFees;
/**
* 检测费
*/
private BigDecimal testingFee;
/**
* 其他费
*/
private String otherFee;
/**
* 计费方式
*/
private String countType;
/**
* 备注
*/
private String remark;
/**
* 合同附件url
*/
private String contractFileUrl;
/**
* 建安费
*/
private BigDecimal constructionCost;
/**
* 资金来源
*/
private String source;
/**
* 收费标准
*/
private String chargingStandard;
/**
* 优惠
*/
private String discount;
/**
* 是否联合体
*/
private Boolean consortium;
/**
* 联合体单位
*/
private String consortiumCompany;
/**
* 分包合同提示时间
*/
private LocalDateTime subReminderTime;
/**
* 审定金额
*/
private BigDecimal approvedAmount;
/**
* 审核文件url
*/
private String reviewFileUrl;
/**
* 合同id
*/
private Long contractId;
/**
* 合同提示时间
*/
private LocalDateTime reminderTime;
}

View File

@ -0,0 +1,50 @@
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;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.cms.controller.admin.extcontract.vo.ExtContractPageReqVO;
import cn.iocoder.yudao.module.cms.dal.dataobject.extcontract.ExtContractDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 外部合同 Mapper
*
* @author 管理员
*/
@Mapper
public interface ExtContractMapper extends BaseMapperX<ExtContractDO> {
default PageResult<ExtContractDO> selectPage(ExtContractPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ExtContractDO>()
.likeIfPresent(ExtContractDO::getName, reqVO.getName())
.eqIfPresent(ExtContractDO::getType, reqVO.getType())
.eqIfPresent(ExtContractDO::getCustomerCompanyId, reqVO.getCustomerCompanyId())
.eqIfPresent(ExtContractDO::getProgress, reqVO.getProgress())
.betweenIfPresent(ExtContractDO::getExpectedTime, reqVO.getExpectedTime())
.betweenIfPresent(ExtContractDO::getSigningTime, reqVO.getSigningTime())
.betweenIfPresent(ExtContractDO::getArchiveTime, reqVO.getArchiveTime())
.eqIfPresent(ExtContractDO::getStatus, reqVO.getStatus())
.eqIfPresent(ExtContractDO::getAmount, reqVO.getAmount())
.eqIfPresent(ExtContractDO::getPreAmount, reqVO.getPreAmount())
.eqIfPresent(ExtContractDO::getDesignFee, reqVO.getDesignFee())
.eqIfPresent(ExtContractDO::getSurveyFees, reqVO.getSurveyFees())
.eqIfPresent(ExtContractDO::getTestingFee, reqVO.getTestingFee())
.eqIfPresent(ExtContractDO::getOtherFee, reqVO.getOtherFee())
.eqIfPresent(ExtContractDO::getCountType, reqVO.getCountType())
.eqIfPresent(ExtContractDO::getRemark, reqVO.getRemark())
.eqIfPresent(ExtContractDO::getContractFileUrl, reqVO.getContractFileUrl())
.eqIfPresent(ExtContractDO::getConstructionCost, reqVO.getConstructionCost())
.eqIfPresent(ExtContractDO::getSource, reqVO.getSource())
.eqIfPresent(ExtContractDO::getChargingStandard, reqVO.getChargingStandard())
.eqIfPresent(ExtContractDO::getDiscount, reqVO.getDiscount())
.eqIfPresent(ExtContractDO::getConsortium, reqVO.getConsortium())
.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())
.orderByDesc(ExtContractDO::getId));
}
}

View File

@ -1,6 +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.pms.api.ProjectApi;
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectDetailRespDTO;
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO;
@ -16,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;
@ -38,6 +41,9 @@ public class ContractServiceImpl implements ContractService {
@Resource
private ProjectApi projectApi;
@Resource
private ExtContractMapper extContractMapper;
@Override
public Long createContract(ContractSaveReqVO createReqVO) {
@ -82,7 +88,7 @@ public class ContractServiceImpl implements ContractService {
// 3.项目经理 pms_project找到的是id 需要联表 √
// 4.出图公司 pms_project 直接 √
// 5.预计合同金额 pms_project 直接 √
// 6.分包合同商议提示 pms_project_schedule
// 6.分包合同商议提示
// 7.暂定结算数 √
ProjectRespDTO project = projectApi.getProject(projectId);
contractRespVO.setCode(project.getCode());
@ -93,6 +99,11 @@ 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);
//暂定结算数
BigDecimal provisionalSettlement = getProvisionalSettlement(id);
contractRespVO.setProvisionalSettlement(provisionalSettlement);

View File

@ -0,0 +1,56 @@
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.extcontract.ExtContractDO;
import jakarta.validation.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* 外部合同 Service 接口
*
* @author 管理员
*/
public interface ExtContractService {
/**
* 创建外部合同
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createExtContract(@Valid ExtContractSaveReqVO createReqVO);
/**
* 更新外部合同
*
* @param updateReqVO 更新信息
*/
void updateExtContract(@Valid ExtContractSaveReqVO updateReqVO);
/**
* 删除外部合同
*
* @param id 编号
*/
void deleteExtContract(Long id);
/**
* 获得外部合同
*
* @param id 编号
* @return 外部合同
*/
ExtContractRespVO getExtContract(Long id);
/**
* 获得外部合同分页
*
* @param pageReqVO 分页查询
* @return 外部合同分页
*/
PageResult<ExtContractDO> getExtContractPage(ExtContractPageReqVO pageReqVO);
}

View File

@ -0,0 +1,83 @@
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.extcontract.ExtContractDO;
import cn.iocoder.yudao.module.cms.dal.mysql.extcontract.ExtContractMapper;
import cn.iocoder.yudao.module.pms.api.ProjectApi;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.EXT_CONTRACT_NOT_EXISTS;
/**
* 外部合同 Service 实现类
*
* @author 管理员
*/
@Service
@Validated
public class ExtContractServiceImpl implements ExtContractService {
@Resource
private ExtContractMapper extContractMapper;
@Resource
private ProjectApi projectApi;
@Override
public Long createExtContract(ExtContractSaveReqVO createReqVO) {
// 插入
ExtContractDO extContract = BeanUtils.toBean(createReqVO, ExtContractDO.class);
extContractMapper.insert(extContract);
// 返回
return extContract.getId();
}
@Override
public void updateExtContract(ExtContractSaveReqVO updateReqVO) {
// 更新
ExtContractDO updateObj = BeanUtils.toBean(updateReqVO, ExtContractDO.class);
extContractMapper.updateById(updateObj);
}
@Override
public void deleteExtContract(Long id) {
// 校验存在
validateExtContractExists(id);
// 删除
extContractMapper.deleteById(id);
}
private void validateExtContractExists(Long id) {
if (extContractMapper.selectById(id) == null) {
throw exception(EXT_CONTRACT_NOT_EXISTS);
}
}
// 需要联表查询
// 1.项目编号 pms_project 直接
// 2.主控部门(跟踪部门) pms_project找到的是id 需要联表
// 3.项目经理 pms_project找到的是id 需要联表
// 4.客户名称 pms_project 联表
// 5.合同总金额
// 6.合同商议提示(和分包提示不一样)
@Override
public ExtContractRespVO getExtContract(Long id) {
ExtContractDO extContractDO = extContractMapper.selectById(id);
Long projectId = extContractDO.getProjectId();
return null;
}
@Override
public PageResult<ExtContractDO> getExtContractPage(ExtContractPageReqVO pageReqVO) {
return extContractMapper.selectPage(pageReqVO);
}
}

View File

@ -1,2 +1,3 @@
-- 将该删表 SQL 语句,添加到 yudao-module-cms-biz 模块的 test/resources/sql/clean.sql 文件里
DELETE FROM "cms_contract";
DELETE
FROM "cms_contract";

View File

@ -0,0 +1,39 @@
-- 将该建表 SQL 语句,添加到 yudao-module-cms-biz 模块的 test/resources/sql/create_tables.sql 文件里
CREATE TABLE IF NOT EXISTS "cms_contract"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"project_id" bigint NOT NULL,
"name" varchar NOT NULL,
"type" varchar NOT NULL,
"progress" varchar NOT NULL,
"expected_time" varchar NOT NULL,
"printing_time" varchar NOT NULL,
"signing_time" varchar,
"archive_time" varchar,
"status" varchar NOT NULL,
"count_type" varchar,
"remark" varchar,
"contract_file_url" varchar,
"construction_cost" varchar,
"source" varchar,
"discount" varchar,
"consortium" bit,
"consortium_company" varchar,
"ext_proportion" varchar,
"approved_amount" varchar NOT NULL,
"review_file_url" varchar,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint NOT NULL,
"amount" varchar,
"pre_amount" varchar,
"design_amount" varchar,
"survey_fees" varchar,
"measurement_fee" varchar,
"other_fee" varchar,
PRIMARY KEY ("id")
) COMMENT '合同';