mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-02-08 14:44:57 +08:00
[feat]合并wyw-7.26外包合同管理模块2
This commit is contained in:
commit
83e39a0197
@ -10,8 +10,26 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
public interface ErrorCodeConstants {
|
||||
ErrorCode CUSTOMER_COMPANY_NOT_EXISTS = new ErrorCode(1_020_000_000, "客户公司管理不存在");
|
||||
|
||||
ErrorCode PROJECT_NOT_EXISTS = new ErrorCode(1_021_000_000, "项目信息不存在");
|
||||
|
||||
ErrorCode PARAM_NOT_EXISTS = new ErrorCode(1_022_000_000, "请求参数错误");
|
||||
|
||||
// ========== 外包合同 2_021_000_000 ==========
|
||||
ErrorCode OUTS_CONTRACT_NOT_EXISTS = new ErrorCode(2_021_000_000, "外包合同不存在");
|
||||
|
||||
// ========== 外包合同历史 2_022_000_000 ==========
|
||||
ErrorCode OUTS_CONTRACT_HISTORY_NOT_EXISTS = new ErrorCode(2_022_000_000, "外包合同历史不存在");
|
||||
|
||||
// ========== 外包合同关联 2_023_000_000 ==========
|
||||
ErrorCode CONTRACT_OUTS_NOT_EXISTS = new ErrorCode(2_023_000_000, "外包合同关联不存在");
|
||||
|
||||
ErrorCode CONTRACT_OUTS_ALREADY_EXISTS = new ErrorCode(2_023_000_000, "外包合同关联已经存在");
|
||||
|
||||
ErrorCode CONTRACT_NOT_EXISTS = new ErrorCode(2_024_000_000, "合同不存在");
|
||||
|
||||
ErrorCode CONTRACT_NAME_NOT_EXISTS = new ErrorCode(2_024_001_000, "合同名称不存在");
|
||||
|
||||
|
||||
ErrorCode CONTRACT_HISTORY_NOT_EXISTS = new ErrorCode(2_025_000_000, "历史合同不存在");
|
||||
|
||||
|
||||
@ -22,18 +40,5 @@ public interface ErrorCodeConstants {
|
||||
|
||||
ErrorCode CONTRACT_EXT_NOT_EXISTS = new ErrorCode(2_028_000_000, "外部合同关联不存在");
|
||||
|
||||
// ========== 外包合同 2_021_000_000 ==========
|
||||
ErrorCode OUTS_CONTRACT_NOT_EXISTS = new ErrorCode(2_021_000_000, "外包合同不存在");
|
||||
|
||||
// ========== 外包合同历史 2_022_000_000 ==========
|
||||
ErrorCode OUTS_CONTRACT_HISTORY_NOT_EXISTS = new ErrorCode(2_022_000_000, "外包合同历史不存在");
|
||||
|
||||
// ========== 外包合同关联 2_023_000_000 ==========
|
||||
ErrorCode CONTRACT_OUTS_NOT_EXISTS = new ErrorCode(2_023_000_000, "外包合同关联不存在");
|
||||
|
||||
ErrorCode PROJECT_NOT_EXISTS = new ErrorCode(1_021_000_000, "项目信息不存在");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "管理后台 - 合同管理")
|
||||
@RestController
|
||||
@ -37,14 +38,14 @@ public class ContractController {
|
||||
@Operation(summary = "创建合同")
|
||||
@PreAuthorize("@ss.hasPermission('cms:contract:create')")
|
||||
public CommonResult<Long> createContract(@Valid @RequestBody ContractSaveReqVO createReqVO) {
|
||||
return success(contractService.createContract(createReqVO));
|
||||
return success(contractService.createContract(getLoginUserId(),createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新合同")
|
||||
@PreAuthorize("@ss.hasPermission('cms:contract:update')")
|
||||
public CommonResult<Boolean> updateContract(@Valid @RequestBody ContractSaveReqVO updateReqVO) {
|
||||
contractService.updateContract(updateReqVO);
|
||||
contractService.updateContract(getLoginUserId(),updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.contractouts;
|
||||
|
||||
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.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contractouts.vo.ContractOutsPageReqVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contractouts.vo.ContractOutsRespVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contractouts.vo.ContractOutsSaveReqVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contractouts.ContractOutsDO;
|
||||
import cn.iocoder.yudao.module.cms.service.contractouts.ContractOutsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "管理后台 - 外包合同关联")
|
||||
@RestController
|
||||
@RequestMapping("/cms/contract-outs")
|
||||
@Validated
|
||||
public class ContractOutsController {
|
||||
|
||||
@Resource
|
||||
private ContractOutsService contractOutsService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建外包合同关联")
|
||||
@PreAuthorize("@ss.hasPermission('cms:contract-outs:create')")
|
||||
public CommonResult<Long> createContractOuts(@Valid @RequestBody ContractOutsSaveReqVO createReqVO) {
|
||||
return success(contractOutsService.createContractOuts(getLoginUserId(),createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新外包合同关联")
|
||||
@PreAuthorize("@ss.hasPermission('cms:contract-outs:update')")
|
||||
public CommonResult<Boolean> updateContractOuts(@Valid @RequestBody ContractOutsSaveReqVO updateReqVO) {
|
||||
contractOutsService.updateContractOuts(getLoginUserId(),updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除外包合同关联")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('cms:contract-outs:delete')")
|
||||
public CommonResult<Boolean> deleteContractOuts(@RequestParam("id") Long id) {
|
||||
contractOutsService.deleteContractOuts(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得外包合同关联")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('cms:contract-outs:query')")
|
||||
public CommonResult<ContractOutsRespVO> getContractOuts(@RequestParam("id") Long id) {
|
||||
ContractOutsDO contractOuts = contractOutsService.getContractOuts(id);
|
||||
return success(BeanUtils.toBean(contractOuts, ContractOutsRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得外包合同关联分页")
|
||||
@PreAuthorize("@ss.hasPermission('cms:contract-outs:query')")
|
||||
public CommonResult<PageResult<ContractOutsRespVO>> getContractOutsPage(@Valid ContractOutsPageReqVO pageReqVO) {
|
||||
PageResult<ContractOutsDO> pageResult = contractOutsService.getContractOutsPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ContractOutsRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出外包合同关联 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('cms:contract-outs:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportContractOutsExcel(@Valid ContractOutsPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ContractOutsDO> list = contractOutsService.getContractOutsPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "外包合同关联.xls", "数据", ContractOutsRespVO.class,
|
||||
BeanUtils.toBean(list, ContractOutsRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.contractouts.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
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 ContractOutsPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "合同id", example = "16187")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "外包合同id", example = "9277")
|
||||
private Long outsContractId;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.contractouts.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 外包合同关联 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ContractOutsRespVO {
|
||||
|
||||
@Schema(description = "合同id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16187")
|
||||
@ExcelProperty("合同id")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "外包合同id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9277")
|
||||
@ExcelProperty("外包合同id")
|
||||
private Long outsContractId;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.contractouts.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 外包合同关联新增/修改 Request VO")
|
||||
@Data
|
||||
public class ContractOutsSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7688")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "合同id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16187")
|
||||
@NotNull(message = "合同id不能为空")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "外包合同id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9277")
|
||||
@NotNull(message = "外包合同id不能为空")
|
||||
private Long outsContractId;
|
||||
|
||||
}
|
@ -3,7 +3,7 @@ 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.service.extcontract.ExtContractService;
|
||||
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;
|
||||
@ -27,6 +27,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 外部合同")
|
||||
@ -42,14 +43,14 @@ public class ExtContractController {
|
||||
@Operation(summary = "创建外部合同")
|
||||
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:create')")
|
||||
public CommonResult<Long> createExtContract(@Valid @RequestBody ExtContractSaveReqVO createReqVO) {
|
||||
return success(extContractService.createExtContract(createReqVO));
|
||||
return success(extContractService.createExtContract(getLoginUserId(),createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新外部合同")
|
||||
@PreAuthorize("@ss.hasPermission('cms-ext:ext-contract:update')")
|
||||
public CommonResult<Boolean> updateExtContract(@Valid @RequestBody ExtContractSaveReqVO updateReqVO) {
|
||||
extContractService.updateExtContract(updateReqVO);
|
||||
extContractService.updateExtContract(getLoginUserId(),updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
}
|
@ -1,95 +1,94 @@
|
||||
//package cn.iocoder.yudao.module.cms.controller.admin.outscontract;
|
||||
//
|
||||
//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.constraints.*;
|
||||
//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.*;
|
||||
//
|
||||
//import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.*;
|
||||
//import cn.iocoder.yudao.module.cms.dal.dataobject.outscontract.OutsContractDO;
|
||||
//import cn.iocoder.yudao.module.cms.service.outscontract.OutsContractService;
|
||||
//
|
||||
//@Tag(name = "管理后台 - 外包合同")
|
||||
//@RestController
|
||||
//@RequestMapping("/cms/outs-contract")
|
||||
//@Validated
|
||||
//public class OutsContractController {
|
||||
//
|
||||
// @Resource
|
||||
// private OutsContractService outsContractService;
|
||||
//
|
||||
// @PostMapping("/create")
|
||||
// @Operation(summary = "创建外包合同")
|
||||
// @PreAuthorize("@ss.hasPermission('cms:outs-contract:create')")
|
||||
// public CommonResult<Long> createOutsContract(@Valid @RequestBody OutsContractSaveReqVO createReqVO) {
|
||||
// return success(outsContractService.createOutsContract(createReqVO));
|
||||
// }
|
||||
//
|
||||
// @PutMapping("/update")
|
||||
// @Operation(summary = "更新外包合同")
|
||||
// @PreAuthorize("@ss.hasPermission('cms:outs-contract:update')")
|
||||
// public CommonResult<Boolean> updateOutsContract(@Valid @RequestBody OutsContractSaveReqVO updateReqVO) {
|
||||
// outsContractService.updateOutsContract(updateReqVO);
|
||||
// return success(true);
|
||||
// }
|
||||
//
|
||||
// @DeleteMapping("/delete")
|
||||
// @Operation(summary = "删除外包合同")
|
||||
// @Parameter(name = "id", description = "编号", required = true)
|
||||
// @PreAuthorize("@ss.hasPermission('cms:outs-contract:delete')")
|
||||
// public CommonResult<Boolean> deleteOutsContract(@RequestParam("id") Long id) {
|
||||
// outsContractService.deleteOutsContract(id);
|
||||
// return success(true);
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/get")
|
||||
// @Operation(summary = "获得外包合同")
|
||||
// @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
// @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));
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/page")
|
||||
// @Operation(summary = "获得外包合同分页")
|
||||
// @PreAuthorize("@ss.hasPermission('cms:outs-contract:query')")
|
||||
// public CommonResult<PageResult<OutsContractRespVO>> getOutsContractPage(@Valid OutsContractPageReqVO pageReqVO) {
|
||||
// PageResult<OutsContractDO> pageResult = outsContractService.getOutsContractPage(pageReqVO);
|
||||
// return success(BeanUtils.toBean(pageResult, OutsContractRespVO.class));
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/export-excel")
|
||||
// @Operation(summary = "导出外包合同 Excel")
|
||||
// @PreAuthorize("@ss.hasPermission('cms:outs-contract:export')")
|
||||
// @ApiAccessLog(operateType = EXPORT)
|
||||
// public void exportOutsContractExcel(@Valid OutsContractPageReqVO pageReqVO,
|
||||
// HttpServletResponse response) throws IOException {
|
||||
// pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
// List<OutsContractDO> list = outsContractService.getOutsContractPage(pageReqVO).getList();
|
||||
// // 导出 Excel
|
||||
// ExcelUtils.write(response, "外包合同.xls", "数据", OutsContractRespVO.class,
|
||||
// BeanUtils.toBean(list, OutsContractRespVO.class));
|
||||
// }
|
||||
//
|
||||
//}
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.outscontract;
|
||||
|
||||
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.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contract.vo.ContractRespVO;
|
||||
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.service.outscontract.OutsContractService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "管理后台 - 外包合同")
|
||||
@RestController
|
||||
@RequestMapping("/cms/outs-contract")
|
||||
@Validated
|
||||
public class OutsContractController {
|
||||
|
||||
@Resource
|
||||
private OutsContractService outsContractService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建外包合同")
|
||||
@PreAuthorize("@ss.hasPermission('cms:outs-contract:create')")
|
||||
public CommonResult<Long> createOutsContract(@Valid @RequestBody OutsContractSaveReqVO createReqVO) {
|
||||
return success(outsContractService.createOutsContract(getLoginUserId(),createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新外包合同")
|
||||
@PreAuthorize("@ss.hasPermission('cms:outs-contract:update')")
|
||||
public CommonResult<Boolean> updateOutsContract(@Valid @RequestBody OutsContractSaveReqVO updateReqVO) {
|
||||
outsContractService.updateOutsContract(getLoginUserId(),updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除外包合同")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('cms:outs-contract:delete')")
|
||||
public CommonResult<Boolean> deleteOutsContract(@RequestParam("id") Long id) {
|
||||
outsContractService.deleteOutsContract(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得外包合同")
|
||||
@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);
|
||||
return success(outsContractRespVO);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得外包合同分页")
|
||||
@PreAuthorize("@ss.hasPermission('cms:outs-contract:query')")
|
||||
public CommonResult<PageResult<OutsContractRespVO>> getOutsContractPage(@Valid OutsContractPageReqVO pageReqVO) {
|
||||
PageResult<OutsContractRespVO> pageResult = outsContractService.getOutsContractPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出外包合同 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('cms:outs-contract:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportOutsContractExcel(@Valid OutsContractPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<OutsContractRespVO> list = outsContractService.getOutsContractPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "外包合同.xls", "数据", OutsContractRespVO.class,
|
||||
BeanUtils.toBean(list, OutsContractRespVO.class));
|
||||
}
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@ -47,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;
|
||||
|
||||
}
|
@ -1,49 +1,59 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 外包合同 Response VO")
|
||||
@Data
|
||||
@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 outsAmount;
|
||||
|
||||
|
||||
@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("合同金额")
|
||||
@Schema(description = "外包合同总额")
|
||||
@ExcelProperty("外包合同总额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "编号")
|
||||
@ExcelProperty("编号")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "专业")
|
||||
@ExcelProperty(value = "专业", converter = DictConvert.class)
|
||||
@DictFormat("major") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
@ -61,8 +71,5 @@ public class OutsContractRespVO {
|
||||
@ExcelProperty("合同文件url")
|
||||
private String contractFileUrl;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
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 lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 外包合同新增/修改 Request VO")
|
||||
@ -19,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;
|
||||
|
||||
}
|
@ -1,33 +1,31 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory;
|
||||
|
||||
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.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
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.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo.*;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo.OutsContractHistoryPageReqVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo.OutsContractHistoryRespVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo.OutsContractHistorySaveReqVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontracthistory.OutsContractHistoryDO;
|
||||
import cn.iocoder.yudao.module.cms.service.outscontracthistory.OutsContractHistoryService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 外包合同历史")
|
||||
@RestController
|
||||
|
@ -1,11 +1,13 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
@ -1,14 +1,14 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 外包合同历史 Response VO")
|
||||
@Data
|
||||
|
@ -1,11 +1,10 @@
|
||||
package cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 外包合同历史新增/修改 Request VO")
|
||||
|
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.dataobject.contractouts;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 外包合同关联 DO
|
||||
*
|
||||
* @author zqc
|
||||
*/
|
||||
@TableName("cms_contract_outs")
|
||||
@KeySequence("cms_contract_outs_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ContractOutsDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 合同id
|
||||
*/
|
||||
private Long contractId;
|
||||
/**
|
||||
* 外包合同id
|
||||
*/
|
||||
private Long outsContractId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updater;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Boolean deleted;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
private String tenantId;
|
||||
}
|
@ -1,14 +1,13 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.dataobject.outscontract;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
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;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 外包合同 DO
|
||||
@ -45,11 +44,11 @@ public class OutsContractDO extends BaseDO {
|
||||
/**
|
||||
* 类型
|
||||
*
|
||||
* 枚举 {@link TODO contract_billing_type 对应的类}
|
||||
* 枚举 //// TODO 搞成枚举
|
||||
*/
|
||||
private String countType;
|
||||
/**
|
||||
* 合同金额
|
||||
* 外包合同金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
@ -59,7 +58,7 @@ public class OutsContractDO extends BaseDO {
|
||||
/**
|
||||
* 专业
|
||||
*
|
||||
* 枚举 {@link TODO major 对应的类}
|
||||
* 枚举 // TODO 搞成枚举
|
||||
*/
|
||||
private String major;
|
||||
/**
|
||||
|
@ -1,14 +1,13 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.dataobject.outscontracthistory;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
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;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 外包合同历史 DO
|
||||
@ -42,10 +41,11 @@ public class OutsContractHistoryDO extends BaseDO {
|
||||
* 主合同id
|
||||
*/
|
||||
private Long contractId;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*
|
||||
* 枚举 {@link TODO contract_billing_type 对应的类}
|
||||
* 枚举 {@link // TODO contract_billing_type 对应的类}
|
||||
*/
|
||||
private String countType;
|
||||
/**
|
||||
@ -59,7 +59,7 @@ public class OutsContractHistoryDO extends BaseDO {
|
||||
/**
|
||||
* 专业
|
||||
*
|
||||
* 枚举 {@link TODO major 对应的类}
|
||||
* 枚举 {@link //TODO major 对应的类}
|
||||
*/
|
||||
private String major;
|
||||
/**
|
||||
|
@ -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())
|
||||
|
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.mysql.contractouts;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contractouts.vo.ContractOutsPageReqVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.contractouts.ContractOutsDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 外包合同关联 Mapper
|
||||
*
|
||||
* @author zqc
|
||||
*/
|
||||
@Mapper
|
||||
public interface ContractOutsMapper extends BaseMapperX<ContractOutsDO> {
|
||||
|
||||
default PageResult<ContractOutsDO> selectPage(ContractOutsPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ContractOutsDO>()
|
||||
.eqIfPresent(ContractOutsDO::getContractId, reqVO.getContractId())
|
||||
.eqIfPresent(ContractOutsDO::getOutsContractId, reqVO.getOutsContractId())
|
||||
.orderByDesc(ContractOutsDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -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())
|
||||
|
||||
);
|
||||
|
@ -1,13 +1,11 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.mysql.outscontract;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
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.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.OutsContractPageReqVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontract.OutsContractDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.*;
|
||||
|
||||
/**
|
||||
* 外包合同 Mapper
|
||||
@ -29,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,13 +1,11 @@
|
||||
package cn.iocoder.yudao.module.cms.dal.mysql.outscontracthistory;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
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.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo.OutsContractHistoryPageReqVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontracthistory.OutsContractHistoryDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo.*;
|
||||
|
||||
/**
|
||||
* 外包合同历史 Mapper
|
||||
|
@ -20,14 +20,14 @@ public interface ContractService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createContract(@Valid ContractSaveReqVO createReqVO);
|
||||
Long createContract(Long loginUserId,@Valid ContractSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新合同
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateContract(@Valid ContractSaveReqVO updateReqVO);
|
||||
void updateContract(Long loginUserId,@Valid ContractSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除合同
|
||||
@ -58,4 +58,12 @@ public interface ContractService {
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getProvisionalSettlement(Long id);
|
||||
|
||||
/**
|
||||
* 判断合同是否存在
|
||||
* @param id 合同id
|
||||
*/
|
||||
void validateContractExists(Long id);
|
||||
|
||||
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
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.project.ProjectApi;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectDetailRespDTO;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -17,11 +19,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.*;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 合同 Service 实现类
|
||||
@ -40,35 +44,47 @@ public class ContractServiceImpl implements ContractService {
|
||||
private ProjectApi projectApi;
|
||||
|
||||
@Resource
|
||||
private ExtContractMapper extContractMapper;
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
|
||||
@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);
|
||||
public Long createContract(Long loginUserId,ContractSaveReqVO createReqVO) {
|
||||
if (createReqVO == null){
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
if (loginUserId == null){
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
if (userName == null){
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 返回
|
||||
ContractDO contract = BeanUtils.toBean(createReqVO, ContractDO.class);
|
||||
//校验,项目是否存在
|
||||
projectApi.validProjectExist(contract.getProjectId());
|
||||
|
||||
contract.setCreator(userName);
|
||||
contract.setUpdater(userName);
|
||||
contractMapper.insert(contract);
|
||||
|
||||
|
||||
//返回
|
||||
return contract.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateContract(ContractSaveReqVO updateReqVO) {
|
||||
Long id = updateReqVO.getId();
|
||||
validateContractExists(id);
|
||||
Long projectId = updateReqVO.getProjectId();
|
||||
if (projectId == null){
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
public void updateContract(Long loginUserId,ContractSaveReqVO updateReqVO) {
|
||||
//校验
|
||||
validateContractExists(updateReqVO.getId());
|
||||
projectApi.validProjectExist(updateReqVO.getProjectId());
|
||||
// 更新
|
||||
ContractDO updateObj = BeanUtils.toBean(updateReqVO, ContractDO.class);
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
if (userName == null){
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
updateObj.setUpdater(userName);
|
||||
contractMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@ -83,11 +99,19 @@ public class ContractServiceImpl implements ContractService {
|
||||
|
||||
@Override
|
||||
public ContractRespVO getContract(Long id) {
|
||||
//校验
|
||||
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){
|
||||
|
||||
if (projectId == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
ContractRespVO contractRespVO = BeanUtils.toBean(contractDO, ContractRespVO.class);
|
||||
@ -100,6 +124,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 +134,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 +149,17 @@ public class ContractServiceImpl implements ContractService {
|
||||
|
||||
@Override
|
||||
public PageResult<ContractRespVO> getContractPage(ContractPageReqVO pageReqVO) {
|
||||
//校验
|
||||
if (pageReqVO == null){
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
|
||||
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<>();
|
||||
@ -156,11 +192,13 @@ public class ContractServiceImpl implements ContractService {
|
||||
}
|
||||
|
||||
|
||||
private void validateContractExists(Long projectId) {
|
||||
if (contractMapper.selectById(projectId) == null) {
|
||||
@Override
|
||||
public void validateContractExists(Long id) {
|
||||
if (contractMapper.selectById(id) == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.module.cms.service.contractouts;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
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.contractouts.ContractOutsDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
* 外包合同关联 Service 接口
|
||||
*
|
||||
* @author zqc
|
||||
*/
|
||||
public interface ContractOutsService {
|
||||
|
||||
/**
|
||||
* 创建外包合同关联
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createContractOuts(Long loginUserId ,@Valid ContractOutsSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新外包合同关联
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateContractOuts(Long loginUserId,@Valid ContractOutsSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除外包合同关联
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteContractOuts(Long id);
|
||||
|
||||
/**
|
||||
* 获得外包合同关联
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 外包合同关联
|
||||
*/
|
||||
ContractOutsDO getContractOuts(Long id);
|
||||
|
||||
/**
|
||||
* 获得外包合同关联分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 外包合同关联分页
|
||||
*/
|
||||
PageResult<ContractOutsDO> getContractOutsPage(ContractOutsPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package cn.iocoder.yudao.module.cms.service.contractouts;
|
||||
|
||||
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.contractouts.ContractOutsDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.contractouts.ContractOutsMapper;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.*;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 外包合同关联 Service 实现类
|
||||
*
|
||||
* @author zqc
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ContractOutsServiceImpl implements ContractOutsService {
|
||||
|
||||
@Resource
|
||||
private ContractOutsMapper contractOutsMapper;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Override
|
||||
public Long createContractOuts(Long loginUserId, ContractOutsSaveReqVO createReqVO) {
|
||||
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);
|
||||
}
|
||||
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
//用户不存在
|
||||
if (userName == null || userName.isEmpty()) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
//如果这条记录不存在,则创建者就是登陆者,如果存在,只更新更新者,创建者不再改变
|
||||
QueryWrapper<ContractOutsDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("contract_id", contractId);
|
||||
queryWrapper.eq("outs_contract_id", outsContractId);
|
||||
Long count = contractOutsMapper.selectCount(queryWrapper);
|
||||
if (count >= 1) {
|
||||
throw exception(CONTRACT_OUTS_ALREADY_EXISTS);
|
||||
}
|
||||
ContractOutsDO contractOutsDO = contractOutsMapper.selectOne(queryWrapper);
|
||||
|
||||
if (contractOutsDO == null) {
|
||||
outsDO.setCreator(userName);
|
||||
outsDO.setUpdater(userName);
|
||||
}
|
||||
|
||||
// 返回
|
||||
return (long) contractOutsMapper.insert(outsDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateContractOuts(Long loginUserId,ContractOutsSaveReqVO updateReqVO) {
|
||||
|
||||
// 校验存在
|
||||
validateContractOutsExists(updateReqVO.getId());
|
||||
if (loginUserId == null){
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
// 更新
|
||||
ContractOutsDO updateObj = BeanUtils.toBean(updateReqVO, ContractOutsDO.class);
|
||||
//校验
|
||||
ContractOutsDO contractOutsDO = contractOutsMapper.selectById(updateObj.getId());
|
||||
if (contractOutsDO == null) {
|
||||
throw exception(CONTRACT_OUTS_NOT_EXISTS);
|
||||
}
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
updateObj.setUpdater(userName);
|
||||
|
||||
contractOutsMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteContractOuts(Long id) {
|
||||
// 校验存在
|
||||
validateContractOutsExists(id);
|
||||
// 删除
|
||||
contractOutsMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateContractOutsExists(Long id) {
|
||||
if (contractOutsMapper.selectById(id) == null) {
|
||||
throw exception(CONTRACT_OUTS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContractOutsDO getContractOuts(Long id) {
|
||||
return contractOutsMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ContractOutsDO> getContractOutsPage(ContractOutsPageReqVO pageReqVO) {
|
||||
return contractOutsMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -3,13 +3,10 @@ package cn.iocoder.yudao.module.cms.service.customerCompany;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.customerCompany.vo.*;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.customerCompany.CustomerCompanyDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.customerCompany.CustomerCompanyMapper;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.cms.service.extcontract;
|
||||
package cn.iocoder.yudao.module.cms.service.extContract;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractPageReqVO;
|
||||
@ -22,14 +22,14 @@ public interface ExtContractService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createExtContract(@Valid ExtContractSaveReqVO createReqVO);
|
||||
Long createExtContract(Long loginUserId,@Valid ExtContractSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新外部合同
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateExtContract(@Valid ExtContractSaveReqVO updateReqVO);
|
||||
void updateExtContract(Long loginUserId,@Valid ExtContractSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除外部合同
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.cms.service.extcontract;
|
||||
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;
|
||||
@ -6,20 +6,25 @@ import cn.iocoder.yudao.module.cms.controller.admin.extContract.vo.ExtContractSa
|
||||
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.pms.api.project.ProjectApi;
|
||||
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;
|
||||
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 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.*;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 外部合同 Service 实现类
|
||||
@ -39,28 +44,46 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
@Resource
|
||||
private CustomerCompanyMapper customerCompanyMapper;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
|
||||
@Override
|
||||
public Long createExtContract(ExtContractSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ExtContractDO extContract = BeanUtils.toBean(createReqVO, ExtContractDO.class);
|
||||
if (projectId != null) {
|
||||
updateExtContract(createReqVO);
|
||||
} else {
|
||||
// 插入
|
||||
extContractMapper.insert(extContract);
|
||||
public Long createExtContract(Long loginUserId,ExtContractSaveReqVO createReqVO) {
|
||||
if (createReqVO == null){
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
ExtContractDO extContract = BeanUtils.toBean(createReqVO, ExtContractDO.class);
|
||||
//校验
|
||||
projectApi.validProjectExist(extContract.getProjectId());
|
||||
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
if (userName == null){
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
extContract.setCreator(userName);
|
||||
extContract.setUpdater(userName);
|
||||
extContractMapper.insert(extContract);
|
||||
//返回
|
||||
return extContract.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExtContract(ExtContractSaveReqVO updateReqVO) {
|
||||
public void updateExtContract(Long loginUserId,ExtContractSaveReqVO updateReqVO) {
|
||||
//校验
|
||||
Long id = updateReqVO.getId();
|
||||
validateExtContractExists(id);
|
||||
if (updateReqVO == null){
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
|
||||
validateExtContractExists(updateReqVO.getId());
|
||||
projectApi.validProjectExist(updateReqVO.getProjectId());
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
if (userName == null){
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
// 更新
|
||||
ExtContractDO updateObj = BeanUtils.toBean(updateReqVO, ExtContractDO.class);
|
||||
updateObj.setUpdater(userName);
|
||||
extContractMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@ -72,11 +95,6 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
extContractMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateExtContractExists(Long id) {
|
||||
if (extContractMapper.selectById(id) == null) {
|
||||
throw exception(EXT_CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
// 需要联表查询
|
||||
// 1.项目编号 pms_project 直接 √
|
||||
@ -84,11 +102,24 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
// 3.项目经理 pms_project找到的是id 需要联表 √
|
||||
// 4.客户公司名称 pms_project 联表 √
|
||||
// 5.合同总金额 √
|
||||
// 6.合同商议提示(和分包提示不一样)
|
||||
// 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);
|
||||
|
||||
@ -96,7 +127,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());
|
||||
@ -108,15 +138,21 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
|
||||
|
||||
//合同总金额
|
||||
|
||||
BigDecimal contractAmount = getContractAmount(id);
|
||||
extContractRespVO.setAmount(contractAmount);
|
||||
|
||||
//合同商议提示 // TODO 待优化
|
||||
extContractRespVO.setExReminderTime(LocalDateTime.now());
|
||||
|
||||
return extContractRespVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ExtContractRespVO> getExtContractPage(ExtContractPageReqVO pageReqVO) {
|
||||
if (pageReqVO == null){
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
|
||||
PageResult<ExtContractDO> extContractDOPageResult = extContractMapper.selectPage(pageReqVO);
|
||||
List<ExtContractDO> excontractDOList = extContractDOPageResult.getList();
|
||||
@ -145,4 +181,11 @@ public class ExtContractServiceImpl implements ExtContractService {
|
||||
return preAmount.add(designFee).add(surveyFees).add(testingFee).add(other);
|
||||
}
|
||||
|
||||
|
||||
private void validateExtContractExists(Long id) {
|
||||
if (extContractMapper.selectById(id) == null) {
|
||||
throw exception(EXT_CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
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 jakarta.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 外部合同 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<ExtContractRespVO> getExtContractPage(ExtContractPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 合同总金额
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getContractAmount(Long id);
|
||||
}
|
@ -1,148 +0,0 @@
|
||||
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.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.pms.api.project.ProjectApi;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectDetailRespDTO;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO;
|
||||
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 java.math.BigDecimal;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 外部合同 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ExtContractServiceImpl implements ExtContractService {
|
||||
|
||||
@Resource
|
||||
private ExtContractMapper extContractMapper;
|
||||
|
||||
@Resource
|
||||
private ProjectApi projectApi;
|
||||
|
||||
@Resource
|
||||
private CustomerCompanyMapper customerCompanyMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public Long createExtContract(ExtContractSaveReqVO createReqVO) {
|
||||
Long projectId = createReqVO.getProjectId();
|
||||
ExtContractDO extContract = BeanUtils.toBean(createReqVO, ExtContractDO.class);
|
||||
if (projectId != null) {
|
||||
updateExtContract(createReqVO);
|
||||
} else {
|
||||
// 插入
|
||||
extContractMapper.insert(extContract);
|
||||
}
|
||||
|
||||
return extContract.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExtContract(ExtContractSaveReqVO updateReqVO) {
|
||||
//校验
|
||||
Long id = updateReqVO.getId();
|
||||
validateExtContractExists(id);
|
||||
// 更新
|
||||
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();
|
||||
Long customerCompanyId = extContractDO.getCustomerCompanyId();
|
||||
ExtContractRespVO extContractRespVO = BeanUtils.toBean(extContractDO, ExtContractRespVO.class);
|
||||
|
||||
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
extContractRespVO.setCode(project.getCode());
|
||||
|
||||
|
||||
ProjectDetailRespDTO projectDetail = projectApi.getProjectDetailById(projectId);
|
||||
extContractRespVO.setTrackingDep(projectDetail.getTrackingDepName());
|
||||
extContractRespVO.setProjectManager(projectDetail.getProjectManagerName());
|
||||
|
||||
//用客户公司id查询
|
||||
CustomerCompanyDO customerCompanyDO = customerCompanyMapper.selectById(customerCompanyId);
|
||||
String name = customerCompanyDO.getName();
|
||||
extContractRespVO.setCustomerCompanyName(name);
|
||||
|
||||
|
||||
//合同总金额
|
||||
BigDecimal contractAmount = getContractAmount(id);
|
||||
extContractRespVO.setAmount(contractAmount);
|
||||
|
||||
|
||||
return extContractRespVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ExtContractRespVO> getExtContractPage(ExtContractPageReqVO pageReqVO) {
|
||||
|
||||
PageResult<ExtContractDO> extContractDOPageResult = extContractMapper.selectPage(pageReqVO);
|
||||
List<ExtContractDO> excontractDOList = extContractDOPageResult.getList();
|
||||
List<ExtContractRespVO> extContractRespVOList = new ArrayList<>();
|
||||
|
||||
|
||||
for (ExtContractDO extContractDO : excontractDOList) {
|
||||
Long id = extContractDO.getId();
|
||||
ExtContractRespVO extContractRespVO = getExtContract(id);
|
||||
extContractRespVOList.add(extContractRespVO);
|
||||
}
|
||||
PageResult<ExtContractRespVO> pageResult = new PageResult<>();
|
||||
pageResult.setList(extContractRespVOList);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getContractAmount(Long id) {
|
||||
//前期+设计+地勘+其他+检测
|
||||
ExtContractDO extContract = extContractMapper.selectById(id);
|
||||
BigDecimal preAmount = new BigDecimal(String.valueOf(extContract.getPreAmount()));
|
||||
BigDecimal designFee = new BigDecimal(String.valueOf(extContract.getDesignFee()));
|
||||
BigDecimal surveyFees = new BigDecimal(String.valueOf(extContract.getSurveyFees()));
|
||||
BigDecimal testingFee = new BigDecimal(String.valueOf(extContract.getTestingFee()));
|
||||
BigDecimal other = new BigDecimal(extContract.getOtherFee());
|
||||
return preAmount.add(designFee).add(surveyFees).add(testingFee).add(other);
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,14 @@
|
||||
package cn.iocoder.yudao.module.cms.service.outscontract;
|
||||
|
||||
import java.util.*;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.*;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontract.OutsContractDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contract.vo.ContractRespVO;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 外包合同 Service 接口
|
||||
@ -20,14 +23,14 @@ public interface OutsContractService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createOutsContract(@Valid OutsContractSaveReqVO createReqVO);
|
||||
Long createOutsContract(Long loginUserId,@Valid OutsContractSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新外包合同
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateOutsContract(@Valid OutsContractSaveReqVO updateReqVO);
|
||||
void updateOutsContract(Long loginUserId,@Valid OutsContractSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除外包合同
|
||||
@ -42,7 +45,7 @@ public interface OutsContractService {
|
||||
* @param id 编号
|
||||
* @return 外包合同
|
||||
*/
|
||||
OutsContractDO getOutsContract(Long id);
|
||||
OutsContractRespVO getOutsContract(Long id);
|
||||
|
||||
/**
|
||||
* 获得外包合同分页
|
||||
@ -50,6 +53,6 @@ public interface OutsContractService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 外包合同分页
|
||||
*/
|
||||
PageResult<OutsContractDO> getOutsContractPage(OutsContractPageReqVO pageReqVO);
|
||||
PageResult<OutsContractRespVO> getOutsContractPage(OutsContractPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -1,21 +1,28 @@
|
||||
package cn.iocoder.yudao.module.cms.service.outscontract;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo.*;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontract.OutsContractDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.contract.vo.ContractRespVO;
|
||||
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 cn.iocoder.yudao.module.pms.api.project.ProjectApi;
|
||||
import cn.iocoder.yudao.module.pms.api.project.dto.ProjectRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
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 实现类
|
||||
@ -29,46 +36,146 @@ public class OutsContractServiceImpl implements OutsContractService {
|
||||
@Resource
|
||||
private OutsContractMapper outsContractMapper;
|
||||
|
||||
@Resource
|
||||
private ContractService contractService;
|
||||
|
||||
@Resource
|
||||
private ProjectApi projectApi;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Override
|
||||
public Long createOutsContract(OutsContractSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
public Long createOutsContract(Long loginUserId,OutsContractSaveReqVO createReqVO) {
|
||||
|
||||
if (createReqVO == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
|
||||
OutsContractDO outsContract = BeanUtils.toBean(createReqVO, OutsContractDO.class);
|
||||
|
||||
Long contractId = outsContract.getContractId();
|
||||
|
||||
ContractRespVO contract = contractService.getContract(contractId);
|
||||
if (contract == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long projectId = outsContract.getProjectId();
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
if (project == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
//合同名称错误
|
||||
if (!Objects.equals(createReqVO.getName(), contract.getName())) {
|
||||
throw exception(CONTRACT_NAME_NOT_EXISTS);
|
||||
}
|
||||
//TODO 待优化
|
||||
String userName = adminUserApi.getUser(loginUserId).getNickname();
|
||||
if (userName == null){
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
outsContract.setCreator(userName);
|
||||
outsContract.setUpdater(userName);
|
||||
|
||||
|
||||
|
||||
outsContractMapper.insert(outsContract);
|
||||
// 返回
|
||||
return outsContract.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOutsContract(OutsContractSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
public void updateOutsContract(Long loginUserId,OutsContractSaveReqVO updateReqVO) {
|
||||
// 校验
|
||||
validateOutsContractExists(updateReqVO.getId());
|
||||
|
||||
Long contractId = updateReqVO.getContractId();
|
||||
ContractRespVO contract = contractService.getContract(contractId);
|
||||
if (contract == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
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);
|
||||
}
|
||||
// 更新
|
||||
OutsContractDO updateObj = BeanUtils.toBean(updateReqVO, OutsContractDO.class);
|
||||
updateObj.setUpdater(userName);
|
||||
outsContractMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOutsContract(Long id) {
|
||||
// 校验存在
|
||||
// 校验
|
||||
validateOutsContractExists(id);
|
||||
// 删除
|
||||
outsContractMapper.deleteById(id);
|
||||
}
|
||||
|
||||
// 需要联表查询
|
||||
// 1.合同名称 √
|
||||
// 2.主控部门(跟踪部门) √
|
||||
// 3.项目经理 √
|
||||
// 4.签订合同总额 √
|
||||
|
||||
@Override
|
||||
public OutsContractRespVO getOutsContract(Long id) {
|
||||
//校验
|
||||
if (id == null) {
|
||||
throw exception(OUTS_CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
OutsContractDO outsContractDO = outsContractMapper.selectById(id);
|
||||
OutsContractRespVO outsContractRespVO = BeanUtils.toBean(outsContractDO, OutsContractRespVO.class);
|
||||
Long contractId = outsContractDO.getContractId();
|
||||
ContractRespVO contract = contractService.getContract(contractId);
|
||||
|
||||
outsContractRespVO.setName(contract.getName());
|
||||
outsContractRespVO.setTrackingDep(contract.getTrackingDep());
|
||||
outsContractRespVO.setProjectManager(contract.getProjectManager());
|
||||
outsContractRespVO.setOutsAmount(contract.getAmount());
|
||||
|
||||
return outsContractRespVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OutsContractRespVO> getOutsContractPage(OutsContractPageReqVO pageReqVO) {
|
||||
|
||||
if (pageReqVO == null) {
|
||||
throw exception(PARAM_NOT_EXISTS);
|
||||
}
|
||||
|
||||
Long projectId = pageReqVO.getProjectId();
|
||||
ProjectRespDTO project = projectApi.getProject(projectId);
|
||||
if (project == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
PageResult<OutsContractDO> outsContractDOPageResult = outsContractMapper.selectPage(pageReqVO);
|
||||
List<OutsContractDO> outsContractDOList = outsContractDOPageResult.getList();
|
||||
List<OutsContractRespVO> outsContractRespVOList = new ArrayList<>();
|
||||
|
||||
|
||||
for (OutsContractDO outsContractDO : outsContractDOList) {
|
||||
Long id = outsContractDO.getId();
|
||||
OutsContractRespVO outsContract = getOutsContract(id);
|
||||
outsContractRespVOList.add(outsContract);
|
||||
}
|
||||
|
||||
PageResult<OutsContractRespVO> pageResult = new PageResult<>();
|
||||
pageResult.setList(outsContractRespVOList);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
package cn.iocoder.yudao.module.cms.service.outscontracthistory;
|
||||
|
||||
import java.util.*;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo.*;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontracthistory.OutsContractHistoryDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo.OutsContractHistoryPageReqVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo.OutsContractHistorySaveReqVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontracthistory.OutsContractHistoryDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
* 外包合同历史 Service 接口
|
||||
|
@ -1,21 +1,17 @@
|
||||
package cn.iocoder.yudao.module.cms.service.outscontracthistory;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo.*;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontracthistory.OutsContractHistoryDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo.OutsContractHistoryPageReqVO;
|
||||
import cn.iocoder.yudao.module.cms.controller.admin.outscontracthistory.vo.OutsContractHistorySaveReqVO;
|
||||
import cn.iocoder.yudao.module.cms.dal.dataobject.outscontracthistory.OutsContractHistoryDO;
|
||||
import cn.iocoder.yudao.module.cms.dal.mysql.outscontracthistory.OutsContractHistoryMapper;
|
||||
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.*;
|
||||
import static cn.iocoder.yudao.module.cms.enums.ErrorCodeConstants.OUTS_CONTRACT_HISTORY_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 外包合同历史 Service 实现类
|
||||
|
@ -14,4 +14,10 @@ public interface ProjectApi {
|
||||
*/
|
||||
ProjectDetailRespDTO getProjectDetailById(Long projectId);
|
||||
|
||||
/**
|
||||
* 判断项目是否存在
|
||||
* @param projectId
|
||||
*/
|
||||
void validProjectExist(Long projectId);
|
||||
|
||||
}
|
||||
|
@ -10,10 +10,14 @@ 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.pms.enums.ErrorCodeConstants.PROJECT_NOT_EXISTS;
|
||||
|
||||
@Service
|
||||
@Validated
|
||||
public class ProjectImpl implements ProjectApi {
|
||||
|
||||
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
|
||||
@ -31,4 +35,12 @@ public class ProjectImpl implements ProjectApi {
|
||||
ProjectDetailRespDTO detailRespDTO = BeanUtils.toBean(projectMapperDetail, ProjectDetailRespDTO.class);
|
||||
return detailRespDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validProjectExist(Long projectId) {
|
||||
if (projectMapper.selectById(projectId) == null) {
|
||||
throw exception(PROJECT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user