From b121228b29da0b8fe57470d404ed2a28c21af88a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Mon, 24 Feb 2025 14:46:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=BF=E7=AD=96=E6=B3=95=E8=A7=84=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/policy/PolicyController.java | 6 +----- .../controller/admin/policy/vo/PolicyPageReqVO.java | 12 ++++++++++++ .../admin/policy/vo/PolicyRespDetailVO.java | 12 ++++++++++++ .../controller/admin/policy/vo/PolicyRespVO.java | 13 +++++++++++++ .../controller/admin/policy/vo/PolicySaveReqVO.java | 13 +++++++++++++ .../system/dal/dataobject/policy/PolicyDO.java | 6 ++++++ 6 files changed, 57 insertions(+), 5 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/PolicyController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/PolicyController.java index 28905ee..f6d6bc5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/PolicyController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/PolicyController.java @@ -56,7 +56,6 @@ public class PolicyController { @PostMapping("/create") @Operation(summary = "创建政策法规") - @PreAuthorize("@ss.hasPermission('system:policy:create')") public CommonResult createPolicy(@Valid @RequestBody PolicySaveReqVO createReqVO) { Integer policy = policyService.createPolicy(createReqVO); MaxkbdocumentVo maxkbdocumentVo =new MaxkbdocumentVo(); @@ -73,7 +72,6 @@ public class PolicyController { @PutMapping("/update") @Operation(summary = "更新政策法规") - @PreAuthorize("@ss.hasPermission('system:policy:update')") public CommonResult updatePolicy(@Valid @RequestBody PolicySaveReqVO updateReqVO) { policyService.updatePolicy(updateReqVO); String viewUrl = getViewUrl(updateReqVO.getId()); @@ -88,7 +86,6 @@ public class PolicyController { @DeleteMapping("/delete") @Operation(summary = "删除政策法规") @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('system:policy:delete')") public CommonResult deletePolicy(@RequestParam("id") Integer id) { policyService.deletePolicy(id); String viewUrl = getViewUrl(id); @@ -118,15 +115,14 @@ public class PolicyController { @GetMapping("/page") @Operation(summary = "获得政策法规分页") - @PreAuthorize("@ss.hasPermission('system:policy:query')") public CommonResult> getPolicyPage(@Valid PolicyPageReqVO pageReqVO) { PageResult pageResult = policyService.getPolicyPage(pageReqVO); return success(BeanUtils.toBean(pageResult, PolicyRespVO.class)); } + @GetMapping("/export-excel") @Operation(summary = "导出政策法规 Excel") - @PreAuthorize("@ss.hasPermission('system:policy:export')") @ApiAccessLog(operateType = EXPORT) public void exportPolicyExcel(@Valid PolicyPageReqVO pageReqVO, HttpServletResponse response) throws IOException { diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicyPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicyPageReqVO.java index 6c351db..bb54840 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicyPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicyPageReqVO.java @@ -1,6 +1,13 @@ package cn.iocoder.yudao.module.system.controller.admin.policy.vo; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; import lombok.*; + +import java.time.LocalDate; import java.util.*; import io.swagger.v3.oas.annotations.media.Schema; import cn.iocoder.yudao.framework.common.pojo.PageParam; @@ -17,6 +24,11 @@ public class PolicyPageReqVO extends PageParam { @Schema(description = "名称", example = "王五") private String name; + @Schema(description = "生效日期", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) + @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate effectiveDate; @Schema(description = "创建时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicyRespDetailVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicyRespDetailVO.java index f663313..34abfd7 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicyRespDetailVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicyRespDetailVO.java @@ -2,9 +2,15 @@ package cn.iocoder.yudao.module.system.controller.admin.policy.vo; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import java.time.LocalDate; import java.time.LocalDateTime; @Schema(description = "管理后台 - 政策法规 Response VO") @@ -20,6 +26,12 @@ public class PolicyRespDetailVO { @ExcelProperty("名称") private String name; + @Schema(description = "生效日期", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) + @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate effectiveDate; + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @ExcelProperty("创建时间") private LocalDateTime createTime; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicyRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicyRespVO.java index d165df3..bfd3930 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicyRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicyRespVO.java @@ -1,7 +1,14 @@ package cn.iocoder.yudao.module.system.controller.admin.policy.vo; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; + +import java.time.LocalDate; import java.util.*; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; @@ -20,6 +27,12 @@ public class PolicyRespVO { @ExcelProperty("名称") private String name; + @Schema(description = "生效日期", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) + @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate effectiveDate; + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @ExcelProperty("创建时间") private LocalDateTime createTime; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicySaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicySaveReqVO.java index 7fc1ed8..b49e377 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicySaveReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/policy/vo/PolicySaveReqVO.java @@ -1,7 +1,15 @@ package cn.iocoder.yudao.module.system.controller.admin.policy.vo; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; + +import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.*; @Schema(description = "管理后台 - 政策法规新增/修改 Request VO") @@ -17,4 +25,9 @@ public class PolicySaveReqVO { @Schema(description = "内容") private String context; + @Schema(description = "生效日期", requiredMode = Schema.RequiredMode.REQUIRED) + @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) + @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate effectiveDate; } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/policy/PolicyDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/policy/PolicyDO.java index 103e564..e81240d 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/policy/PolicyDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/policy/PolicyDO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.dal.dataobject.policy; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; import java.time.LocalDateTime; @@ -36,4 +37,9 @@ public class PolicyDO extends BaseDO { */ private String context; + /** + * 生效日期 + */ + private LocalDateTime effectiveDate; + } \ No newline at end of file