mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 10:18:42 +08:00 
			
		
		
		
	[feat]添加博爱错信息,添加注释信息
This commit is contained in:
		| @@ -0,0 +1,95 @@ | ||||
| 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)); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,54 @@ | ||||
| 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 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 OutsContractPageReqVO extends PageParam { | ||||
|  | ||||
|     @Schema(description = "项目id", example = "27415") | ||||
|     private Long projectId; | ||||
|  | ||||
|     @Schema(description = "合同名称", example = "张三") | ||||
|     private String name; | ||||
|  | ||||
|     @Schema(description = "主合同id", example = "19816") | ||||
|     private Long contractId; | ||||
|  | ||||
|     @Schema(description = "类型", example = "2") | ||||
|     private String countType; | ||||
|  | ||||
|     @Schema(description = "合同金额") | ||||
|     private BigDecimal amount; | ||||
|  | ||||
|     @Schema(description = "编号") | ||||
|     private String code; | ||||
|  | ||||
|     @Schema(description = "专业") | ||||
|     private String major; | ||||
|  | ||||
|     @Schema(description = "签订时间") | ||||
|     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||||
|     private LocalDateTime[] signingTime; | ||||
|  | ||||
|     @Schema(description = "结算数") | ||||
|     private BigDecimal settlementAmount; | ||||
|  | ||||
|     @Schema(description = "合同文件url", example = "https://www.iocoder.cn") | ||||
|     private String contractFileUrl; | ||||
|  | ||||
|     @Schema(description = "创建时间") | ||||
|     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||||
|     private LocalDateTime[] createTime; | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,68 @@ | ||||
| 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; | ||||
|  | ||||
| @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 = "主合同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 amount; | ||||
|  | ||||
|     @Schema(description = "编号") | ||||
|     @ExcelProperty("编号") | ||||
|     private String code; | ||||
|  | ||||
|     @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; | ||||
|  | ||||
|     @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||||
|     @ExcelProperty("创建时间") | ||||
|     private LocalDateTime createTime; | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,49 @@ | ||||
| package cn.iocoder.yudao.module.cms.controller.admin.outscontract.vo; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.*; | ||||
| import java.util.*; | ||||
| import jakarta.validation.constraints.*; | ||||
| import java.math.BigDecimal; | ||||
| import org.springframework.format.annotation.DateTimeFormat; | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| @Schema(description = "管理后台 - 外包合同新增/修改 Request VO") | ||||
| @Data | ||||
| public class OutsContractSaveReqVO { | ||||
|  | ||||
|     @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2034") | ||||
|     private Long id; | ||||
|  | ||||
|     @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27415") | ||||
|     @NotNull(message = "项目id不能为空") | ||||
|     private Long projectId; | ||||
|  | ||||
|     @Schema(description = "合同名称", example = "张三") | ||||
|     private String name; | ||||
|  | ||||
|     @Schema(description = "主合同id", example = "19816") | ||||
|     private Long contractId; | ||||
|  | ||||
|     @Schema(description = "类型", example = "2") | ||||
|     private String countType; | ||||
|  | ||||
|     @Schema(description = "合同金额") | ||||
|     private BigDecimal amount; | ||||
|  | ||||
|     @Schema(description = "编号") | ||||
|     private String code; | ||||
|  | ||||
|     @Schema(description = "专业") | ||||
|     private String major; | ||||
|  | ||||
|     @Schema(description = "签订时间") | ||||
|     private LocalDateTime signingTime; | ||||
|  | ||||
|     @Schema(description = "结算数") | ||||
|     private BigDecimal settlementAmount; | ||||
|  | ||||
|     @Schema(description = "合同文件url", example = "https://www.iocoder.cn") | ||||
|     private String contractFileUrl; | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Qiancheng Zhao
					Qiancheng Zhao