diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/resources/banner.txt b/yudao-framework/yudao-spring-boot-starter-web/src/main/resources/banner.txt index 39a441d..8309afe 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/resources/banner.txt +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/resources/banner.txt @@ -1,4 +1,4 @@ -芋道源码 http://www.iocoder.cn +君风科技 http://www.jf81.com Application Version: ${yudao.info.version} Spring Boot Version: ${spring-boot.version} diff --git a/yudao-gateway/src/main/resources/application.yaml b/yudao-gateway/src/main/resources/application.yaml index 3a5cfc6..75eb7eb 100644 --- a/yudao-gateway/src/main/resources/application.yaml +++ b/yudao-gateway/src/main/resources/application.yaml @@ -72,6 +72,13 @@ spring: - Path=/admin-api/bpm/** filters: - RewritePath=/admin-api/bpm/v3/api-docs, /v3/api-docs + ## base-server 服务 + - id: base-admin-api # 路由的编号 + uri: grayLb://base-server + predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组 + - Path=/admin-api/base/** + filters: + - RewritePath=/admin-api/base/v3/api-docs, /v3/api-docs ## report-server 服务 - id: report-admin-api # 路由的编号 uri: grayLb://report-server @@ -197,6 +204,9 @@ knife4j: - name: bpm-server service-name: bpm-server url: /admin-api/bpm/v3/api-docs + - name: base-server + service-name: base-server + url: /admin-api/base/v3/api-docs - name: pay-server service-name: pay-server url: /admin-api/pay/v3/api-docs diff --git a/yudao-gateway/src/main/resources/banner.txt b/yudao-gateway/src/main/resources/banner.txt index 39a441d..8309afe 100644 --- a/yudao-gateway/src/main/resources/banner.txt +++ b/yudao-gateway/src/main/resources/banner.txt @@ -1,4 +1,4 @@ -芋道源码 http://www.iocoder.cn +君风科技 http://www.jf81.com Application Version: ${yudao.info.version} Spring Boot Version: ${spring-boot.version} diff --git a/yudao-module-base/yudao-module-base-api/src/main/java/cn/iocoder/yudao/module/base/enums/ErrorCodeConstants.java b/yudao-module-base/yudao-module-base-api/src/main/java/cn/iocoder/yudao/module/base/enums/ErrorCodeConstants.java new file mode 100644 index 0000000..ebc3494 --- /dev/null +++ b/yudao-module-base/yudao-module-base-api/src/main/java/cn/iocoder/yudao/module/base/enums/ErrorCodeConstants.java @@ -0,0 +1,16 @@ +package cn.iocoder.yudao.module.base.enums; + +import cn.iocoder.yudao.framework.common.exception.ErrorCode; + + +/** + * Member 错误码枚举类 + *

+ * member 系统,使用 1-004-000-000 段 + */ +public interface ErrorCodeConstants { + // ========== 假日 1-011-001-000 ============ + ErrorCode HOLIDAYS_NOT_EXISTS = new ErrorCode(1-011-001-000 , "假日不存在"); + // ========== 请假管理 1-011-002-000 ========== + ErrorCode QJGL_NOT_EXISTS = new ErrorCode(1-011-002-000, "请假管理不存在"); +} diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/holidays/holidaysController.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/holidays/holidaysController.java new file mode 100644 index 0000000..fd0d922 --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/holidays/holidaysController.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.base.controller.admin.holidays; + +import org.springframework.web.bind.annotation.*; +import javax.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 javax.validation.constraints.*; +import javax.validation.*; +import javax.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.base.controller.admin.holidays.vo.*; +import cn.iocoder.yudao.module.base.dal.dataobject.holidays.holidaysDO; +import cn.iocoder.yudao.module.base.service.holidays.holidaysService; + +@Tag(name = "管理后台 - 假日") +@RestController +@RequestMapping("/base/holidays") +@Validated +public class holidaysController { + + @Resource + private holidaysService holidaysService; + + @PostMapping("/create") + @Operation(summary = "创建假日") + @PreAuthorize("@ss.hasPermission('base:holidays:create')") + public CommonResult createholidays(@Valid @RequestBody holidaysSaveReqVO createReqVO) { + return success(holidaysService.createholidays(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新假日") + @PreAuthorize("@ss.hasPermission('base:holidays:update')") + public CommonResult updateholidays(@Valid @RequestBody holidaysSaveReqVO updateReqVO) { + holidaysService.updateholidays(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除假日") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('base:holidays:delete')") + public CommonResult deleteholidays(@RequestParam("id") Long id) { + holidaysService.deleteholidays(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得假日") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('base:holidays:query')") + public CommonResult getholidays(@RequestParam("id") Long id) { + holidaysDO holidays = holidaysService.getholidays(id); + return success(BeanUtils.toBean(holidays, holidaysRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得假日分页") + @PreAuthorize("@ss.hasPermission('base:holidays:query')") + public CommonResult> getholidaysPage(@Valid holidaysPageReqVO pageReqVO) { + PageResult pageResult = holidaysService.getholidaysPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, holidaysRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出假日 Excel") + @PreAuthorize("@ss.hasPermission('base:holidays:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportholidaysExcel(@Valid holidaysPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = holidaysService.getholidaysPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "假日.xls", "数据", holidaysRespVO.class, + BeanUtils.toBean(list, holidaysRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/holidays/vo/holidaysPageReqVO.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/holidays/vo/holidaysPageReqVO.java new file mode 100644 index 0000000..e0fdd8b --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/holidays/vo/holidaysPageReqVO.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.base.controller.admin.holidays.vo; + +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; +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 holidaysPageReqVO extends PageParam { + + @Schema(description = "节日名称", example = "元旦") + private String holidayName; + + @Schema(description = "日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDate[] holidayDate; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/holidays/vo/holidaysRespVO.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/holidays/vo/holidaysRespVO.java new file mode 100644 index 0000000..e526dc8 --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/holidays/vo/holidaysRespVO.java @@ -0,0 +1,33 @@ +package cn.iocoder.yudao.module.base.controller.admin.holidays.vo; + +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; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 假日 Response VO") +@Data +@ExcelIgnoreUnannotated +public class holidaysRespVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19556") + @ExcelProperty("id") + private Long id; + + @Schema(description = "节日名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "元旦") + @ExcelProperty("节日名称") + private String holidayName; + + @Schema(description = "日期", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("日期") + private LocalDate holidayDate; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/holidays/vo/holidaysSaveReqVO.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/holidays/vo/holidaysSaveReqVO.java new file mode 100644 index 0000000..3cfc566 --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/holidays/vo/holidaysSaveReqVO.java @@ -0,0 +1,25 @@ +package cn.iocoder.yudao.module.base.controller.admin.holidays.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDate; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 假日新增/修改 Request VO") +@Data +public class holidaysSaveReqVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19556") + private Long id; + + @Schema(description = "节日名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "元旦") + @NotEmpty(message = "节日名称不能为空") + private String holidayName; + + @Schema(description = "日期", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "日期不能为空") + private LocalDate holidayDate; + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/qjgl/QjglController.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/qjgl/QjglController.java new file mode 100644 index 0000000..a47ebe6 --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/qjgl/QjglController.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.base.controller.admin.qjgl; + +import org.springframework.web.bind.annotation.*; +import javax.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 javax.validation.constraints.*; +import javax.validation.*; +import javax.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.base.controller.admin.qjgl.vo.*; +import cn.iocoder.yudao.module.base.dal.dataobject.qjgl.QjglDO; +import cn.iocoder.yudao.module.base.service.qjgl.QjglService; + +@Tag(name = "管理后台 - 请假管理") +@RestController +@RequestMapping("/base/qjgl") +@Validated +public class QjglController { + + @Resource + private QjglService qjglService; + + @PostMapping("/create") + @Operation(summary = "创建请假管理") + @PreAuthorize("@ss.hasPermission('base:qjgl:create')") + public CommonResult createQjgl(@Valid @RequestBody QjglSaveReqVO createReqVO) { + return success(qjglService.createQjgl(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新请假管理") + @PreAuthorize("@ss.hasPermission('base:qjgl:update')") + public CommonResult updateQjgl(@Valid @RequestBody QjglSaveReqVO updateReqVO) { + qjglService.updateQjgl(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除请假管理") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('base:qjgl:delete')") + public CommonResult deleteQjgl(@RequestParam("id") Long id) { + qjglService.deleteQjgl(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得请假管理") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('base:qjgl:query')") + public CommonResult getQjgl(@RequestParam("id") Long id) { + QjglDO qjgl = qjglService.getQjgl(id); + return success(BeanUtils.toBean(qjgl, QjglRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得请假管理分页") + @PreAuthorize("@ss.hasPermission('base:qjgl:query')") + public CommonResult> getQjglPage(@Valid QjglPageReqVO pageReqVO) { + PageResult pageResult = qjglService.getQjglPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, QjglRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出请假管理 Excel") + @PreAuthorize("@ss.hasPermission('base:qjgl:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportQjglExcel(@Valid QjglPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = qjglService.getQjglPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "请假管理.xls", "数据", QjglRespVO.class, + BeanUtils.toBean(list, QjglRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/qjgl/vo/QjglPageReqVO.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/qjgl/vo/QjglPageReqVO.java new file mode 100644 index 0000000..d5b9b53 --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/qjgl/vo/QjglPageReqVO.java @@ -0,0 +1,60 @@ +package cn.iocoder.yudao.module.base.controller.admin.qjgl.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +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 QjglPageReqVO extends PageParam { + + @Schema(description = "请假标题") + private String title; + + @Schema(description = "请假原因", example = "不对") + private String reason; + + @Schema(description = "请假类型", example = "1") + private Integer type; + + @Schema(description = "开始时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] startTime; + + @Schema(description = "结束时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] endTime; + + @Schema(description = "请假天数") + private Integer day; + + @Schema(description = "文件路径") + private String filePath; + + @Schema(description = "作者", example = "赵六") + private String userName; + + @Schema(description = "部门id", example = "8402") + private Long deptId; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "流程实例的编号", example = "24108") + private String processInstanceId; + + @Schema(description = "申请人的用户编号", example = "14417") + private Long userId; + + @Schema(description = "审批状态", example = "2") + private Integer status; + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/qjgl/vo/QjglRespVO.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/qjgl/vo/QjglRespVO.java new file mode 100644 index 0000000..65ac8bc --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/qjgl/vo/QjglRespVO.java @@ -0,0 +1,71 @@ +package cn.iocoder.yudao.module.base.controller.admin.qjgl.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 请假管理 Response VO") +@Data +@ExcelIgnoreUnannotated +public class QjglRespVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14023") + @ExcelProperty("id") + private Long id; + + @Schema(description = "请假标题") + @ExcelProperty("请假标题") + private String title; + + @Schema(description = "请假原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "不对") + @ExcelProperty("请假原因") + private String reason; + + @Schema(description = "请假类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("请假类型") + private Integer type; + + @Schema(description = "开始时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("开始时间") + private LocalDateTime startTime; + + @Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("结束时间") + private LocalDateTime endTime; + + @Schema(description = "请假天数", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("请假天数") + private Integer day; + + @Schema(description = "文件路径") + @ExcelProperty("文件路径") + private String filePath; + + @Schema(description = "作者", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") + @ExcelProperty("作者") + private String userName; + + @Schema(description = "部门id", example = "8402") + @ExcelProperty("部门id") + private Long deptId; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "流程实例的编号", example = "24108") + @ExcelProperty("流程实例的编号") + private String processInstanceId; + + @Schema(description = "申请人的用户编号", example = "14417") + @ExcelProperty("申请人的用户编号") + private Long userId; + + @Schema(description = "审批状态", example = "2") + @ExcelProperty("审批状态") + private Integer status; + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/qjgl/vo/QjglSaveReqVO.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/qjgl/vo/QjglSaveReqVO.java new file mode 100644 index 0000000..2366b9b --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/controller/admin/qjgl/vo/QjglSaveReqVO.java @@ -0,0 +1,59 @@ +package cn.iocoder.yudao.module.base.controller.admin.qjgl.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 请假管理新增/修改 Request VO") +@Data +public class QjglSaveReqVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14023") + private Long id; + + @Schema(description = "请假标题") + private String title; + + @Schema(description = "请假原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "不对") + @NotEmpty(message = "请假原因不能为空") + private String reason; + + @Schema(description = "请假类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "请假类型不能为空") + private Integer type; + + @Schema(description = "开始时间", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "开始时间不能为空") + private LocalDateTime startTime; + + @Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "结束时间不能为空") + private LocalDateTime endTime; + + @Schema(description = "请假天数", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "请假天数不能为空") + private Integer day; + + @Schema(description = "文件路径") + private String filePath; + + @Schema(description = "作者", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") + @NotEmpty(message = "作者不能为空") + private String userName; + + @Schema(description = "部门id", example = "8402") + private Long deptId; + + @Schema(description = "流程实例的编号", example = "24108") + private String processInstanceId; + + @Schema(description = "申请人的用户编号", example = "14417") + private Long userId; + + @Schema(description = "审批状态", example = "2") + private Integer status; + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/dataobject/holidays/holidaysDO.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/dataobject/holidays/holidaysDO.java new file mode 100644 index 0000000..b47516c --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/dataobject/holidays/holidaysDO.java @@ -0,0 +1,41 @@ +package cn.iocoder.yudao.module.base.dal.dataobject.holidays; + +import lombok.*; + +import java.time.LocalDate; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 假日 DO + * + * @author 君风 + */ +@TableName("oa_holidays") +@KeySequence("oa_holidays_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class holidaysDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 节日名称 + */ + private String holidayName; + /** + * 日期 + */ + private LocalDate holidayDate; + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/dataobject/package-info.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/dataobject/package-info.java new file mode 100644 index 0000000..b01c034 --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/dataobject/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.yudao.module.base.dal.dataobject; \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/dataobject/qjgl/QjglDO.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/dataobject/qjgl/QjglDO.java new file mode 100644 index 0000000..975b171 --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/dataobject/qjgl/QjglDO.java @@ -0,0 +1,81 @@ +package cn.iocoder.yudao.module.base.dal.dataobject.qjgl; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 请假管理 DO + * + * @author 君风 + */ +@TableName("oa_qjgl") +@KeySequence("oa_qjgl_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class QjglDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 请假标题 + */ + private String title; + /** + * 请假原因 + */ + private String reason; + /** + * 请假类型 + */ + private Integer type; + /** + * 开始时间 + */ + private LocalDateTime startTime; + /** + * 结束时间 + */ + private LocalDateTime endTime; + /** + * 请假天数 + */ + private Integer day; + /** + * 文件路径 + */ + private String filePath; + /** + * 作者 + */ + private String userName; + /** + * 部门id + */ + private Long deptId; + /** + * 流程实例的编号 + */ + private String processInstanceId; + /** + * 申请人的用户编号 + */ + private Long userId; + /** + * 审批状态 + */ + private Integer status; + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/mysql/holidays/holidaysMapper.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/mysql/holidays/holidaysMapper.java new file mode 100644 index 0000000..29cf627 --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/mysql/holidays/holidaysMapper.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.base.dal.mysql.holidays; + +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.module.base.dal.dataobject.holidays.holidaysDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.base.controller.admin.holidays.vo.*; + +/** + * 假日 Mapper + * + * @author 君风 + */ +@Mapper +public interface holidaysMapper extends BaseMapperX { + + default PageResult selectPage(holidaysPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(holidaysDO::getHolidayName, reqVO.getHolidayName()) + .betweenIfPresent(holidaysDO::getHolidayDate, reqVO.getHolidayDate()) + .betweenIfPresent(holidaysDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(holidaysDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/mysql/package-info.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/mysql/package-info.java new file mode 100644 index 0000000..fd58fde --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/mysql/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.yudao.module.base.dal.mysql; \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/mysql/qjgl/QjglMapper.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/mysql/qjgl/QjglMapper.java new file mode 100644 index 0000000..5f3bece --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/dal/mysql/qjgl/QjglMapper.java @@ -0,0 +1,38 @@ +package cn.iocoder.yudao.module.base.dal.mysql.qjgl; + +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.module.base.dal.dataobject.qjgl.QjglDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.base.controller.admin.qjgl.vo.*; + +/** + * 请假管理 Mapper + * + * @author 君风 + */ +@Mapper +public interface QjglMapper extends BaseMapperX { + + default PageResult selectPage(QjglPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(QjglDO::getTitle, reqVO.getTitle()) + .eqIfPresent(QjglDO::getReason, reqVO.getReason()) + .eqIfPresent(QjglDO::getType, reqVO.getType()) + .betweenIfPresent(QjglDO::getStartTime, reqVO.getStartTime()) + .betweenIfPresent(QjglDO::getEndTime, reqVO.getEndTime()) + .eqIfPresent(QjglDO::getDay, reqVO.getDay()) + .eqIfPresent(QjglDO::getFilePath, reqVO.getFilePath()) + .likeIfPresent(QjglDO::getUserName, reqVO.getUserName()) + .eqIfPresent(QjglDO::getDeptId, reqVO.getDeptId()) + .betweenIfPresent(QjglDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(QjglDO::getProcessInstanceId, reqVO.getProcessInstanceId()) + .eqIfPresent(QjglDO::getUserId, reqVO.getUserId()) + .eqIfPresent(QjglDO::getStatus, reqVO.getStatus()) + .orderByDesc(QjglDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/holidays/holidaysService.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/holidays/holidaysService.java new file mode 100644 index 0000000..b96eaaa --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/holidays/holidaysService.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.base.service.holidays; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.base.controller.admin.holidays.vo.*; +import cn.iocoder.yudao.module.base.dal.dataobject.holidays.holidaysDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +/** + * 假日 Service 接口 + * + * @author 君风 + */ +public interface holidaysService { + + /** + * 创建假日 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createholidays(@Valid holidaysSaveReqVO createReqVO); + + /** + * 更新假日 + * + * @param updateReqVO 更新信息 + */ + void updateholidays(@Valid holidaysSaveReqVO updateReqVO); + + /** + * 删除假日 + * + * @param id 编号 + */ + void deleteholidays(Long id); + + /** + * 获得假日 + * + * @param id 编号 + * @return 假日 + */ + holidaysDO getholidays(Long id); + + /** + * 获得假日分页 + * + * @param pageReqVO 分页查询 + * @return 假日分页 + */ + PageResult getholidaysPage(holidaysPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/holidays/holidaysServiceImpl.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/holidays/holidaysServiceImpl.java new file mode 100644 index 0000000..2941a02 --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/holidays/holidaysServiceImpl.java @@ -0,0 +1,74 @@ +package cn.iocoder.yudao.module.base.service.holidays; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.module.base.controller.admin.holidays.vo.*; +import cn.iocoder.yudao.module.base.dal.dataobject.holidays.holidaysDO; +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.base.dal.mysql.holidays.holidaysMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.base.enums.ErrorCodeConstants.*; + +/** + * 假日 Service 实现类 + * + * @author 君风 + */ +@Service +@Validated +public class holidaysServiceImpl implements holidaysService { + + @Resource + private holidaysMapper holidaysMapper; + + @Override + public Long createholidays(holidaysSaveReqVO createReqVO) { + // 插入 + holidaysDO holidays = BeanUtils.toBean(createReqVO, holidaysDO.class); + holidaysMapper.insert(holidays); + // 返回 + return holidays.getId(); + } + + @Override + public void updateholidays(holidaysSaveReqVO updateReqVO) { + // 校验存在 + validateholidaysExists(updateReqVO.getId()); + // 更新 + holidaysDO updateObj = BeanUtils.toBean(updateReqVO, holidaysDO.class); + holidaysMapper.updateById(updateObj); + } + + @Override + public void deleteholidays(Long id) { + // 校验存在 + validateholidaysExists(id); + // 删除 + holidaysMapper.deleteById(id); + } + + private void validateholidaysExists(Long id) { + if (holidaysMapper.selectById(id) == null) { + throw exception(HOLIDAYS_NOT_EXISTS); + } + } + + @Override + public holidaysDO getholidays(Long id) { + return holidaysMapper.selectById(id); + } + + @Override + public PageResult getholidaysPage(holidaysPageReqVO pageReqVO) { + return holidaysMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/package-info.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/package-info.java new file mode 100644 index 0000000..7fd8f38 --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.yudao.module.base.service; \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/qjgl/QjglService.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/qjgl/QjglService.java new file mode 100644 index 0000000..49e11a6 --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/qjgl/QjglService.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.base.service.qjgl; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.base.controller.admin.qjgl.vo.*; +import cn.iocoder.yudao.module.base.dal.dataobject.qjgl.QjglDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +/** + * 请假管理 Service 接口 + * + * @author 君风 + */ +public interface QjglService { + + /** + * 创建请假管理 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createQjgl(@Valid QjglSaveReqVO createReqVO); + + /** + * 更新请假管理 + * + * @param updateReqVO 更新信息 + */ + void updateQjgl(@Valid QjglSaveReqVO updateReqVO); + + /** + * 删除请假管理 + * + * @param id 编号 + */ + void deleteQjgl(Long id); + + /** + * 获得请假管理 + * + * @param id 编号 + * @return 请假管理 + */ + QjglDO getQjgl(Long id); + + /** + * 获得请假管理分页 + * + * @param pageReqVO 分页查询 + * @return 请假管理分页 + */ + PageResult getQjglPage(QjglPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/qjgl/QjglServiceImpl.java b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/qjgl/QjglServiceImpl.java new file mode 100644 index 0000000..74663e6 --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/main/java/cn/iocoder/yudao/module/base/service/qjgl/QjglServiceImpl.java @@ -0,0 +1,74 @@ +package cn.iocoder.yudao.module.base.service.qjgl; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.module.base.controller.admin.qjgl.vo.*; +import cn.iocoder.yudao.module.base.dal.dataobject.qjgl.QjglDO; +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.base.dal.mysql.qjgl.QjglMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.base.enums.ErrorCodeConstants.*; + +/** + * 请假管理 Service 实现类 + * + * @author 君风 + */ +@Service +@Validated +public class QjglServiceImpl implements QjglService { + + @Resource + private QjglMapper qjglMapper; + + @Override + public Long createQjgl(QjglSaveReqVO createReqVO) { + // 插入 + QjglDO qjgl = BeanUtils.toBean(createReqVO, QjglDO.class); + qjglMapper.insert(qjgl); + // 返回 + return qjgl.getId(); + } + + @Override + public void updateQjgl(QjglSaveReqVO updateReqVO) { + // 校验存在 + validateQjglExists(updateReqVO.getId()); + // 更新 + QjglDO updateObj = BeanUtils.toBean(updateReqVO, QjglDO.class); + qjglMapper.updateById(updateObj); + } + + @Override + public void deleteQjgl(Long id) { + // 校验存在 + validateQjglExists(id); + // 删除 + qjglMapper.deleteById(id); + } + + private void validateQjglExists(Long id) { + if (qjglMapper.selectById(id) == null) { + throw exception(QJGL_NOT_EXISTS); + } + } + + @Override + public QjglDO getQjgl(Long id) { + return qjglMapper.selectById(id); + } + + @Override + public PageResult getQjglPage(QjglPageReqVO pageReqVO) { + return qjglMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/main/resources/application11.yaml b/yudao-module-base/yudao-module-base-biz/src/main/resources/application11.yaml deleted file mode 100644 index 31846cf..0000000 --- a/yudao-module-base/yudao-module-base-biz/src/main/resources/application11.yaml +++ /dev/null @@ -1,62 +0,0 @@ -spring: - application: - name: base-server - - profiles: - active: local - - main: - allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 - allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务 - config: - import: - - optional:classpath:application-${spring.profiles.active}.yaml # 加载【本地】配置 - - optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml # 加载【Nacos】的配置 - -server: - port: 48099 - -logging: - file: - name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 - -# MyBatis Plus 的配置项 -mybatis-plus: - configuration: - map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 - global-config: - db-config: - id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。 - # id-type: AUTO # 自增 ID,适合 MySQL 等直接自增的数据库 - # id-type: INPUT # 用户输入 ID,适合 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库 - # id-type: ASSIGN_ID # 分配 ID,默认使用雪花算法。注意,Oracle、PostgreSQL、Kingbase、DB2、H2 数据库时,需要去除实体类上的 @KeySequence 注解 - logic-delete-value: 1 # 逻辑已删除值(默认为 1) - logic-not-delete-value: 0 # 逻辑未删除值(默认为 0) - banner: false # 关闭控制台的 Banner 打印 - type-aliases-package: ${yudao.info.base-package}.dal.dataobject - encryptor: - password: XDV71a+xqStEA3WH # 加解密的秘钥,可使用 https://www.imaegoo.com/2020/aes-key-generator/ 网站生成 - -mybatis-plus-join: - banner: false # 关闭控制台的 Banner 打印 - -yudao: - info: - version: 1.0.0 - base-package: cn.iocoder.yudao.module.base - web: - admin-ui: - url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址 - xss: - enable: false - exclude-urls: # 如下 url,仅仅是为了演示,去掉配置也没关系 - - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 - swagger: - title: 管理后台 - description: 提供管理员管理的所有功能 - version: ${yudao.info.version} - tenant: # 多租户相关配置项 - enable: true - ignore-urls: - -debug: true \ No newline at end of file diff --git a/yudao-module-base/yudao-module-base-biz/src/test/java/DateInfo.java b/yudao-module-base/yudao-module-base-biz/src/test/java/DateInfo.java new file mode 100644 index 0000000..7d3e024 --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/test/java/DateInfo.java @@ -0,0 +1,18 @@ +import lombok.Getter; +import java.time.LocalDate; +@Getter +public class DateInfo { + private LocalDate date; + private boolean isWorkDay; + public DateInfo(LocalDate date, boolean isWorkDay) { + this.date = date; + this.isWorkDay = isWorkDay; + } + public boolean isWorkDay() { + return isWorkDay; + } + @Override + public String toString() { + return date + " - " + (isWorkDay ? "1" : "0"); + } +} diff --git a/yudao-module-base/yudao-module-base-biz/src/test/java/WorkDateInitializer.java b/yudao-module-base/yudao-module-base-biz/src/test/java/WorkDateInitializer.java new file mode 100644 index 0000000..954ae7e --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/test/java/WorkDateInitializer.java @@ -0,0 +1,48 @@ +import org.junit.jupiter.api.Test; + +import java.time.LocalDate; +import java.time.DayOfWeek; +import java.util.ArrayList; +import java.util.List; +public class WorkDateInitializer { + // 假设这是本年度的法定节假日列表 + private static final List HOLIDAYS = new ArrayList<>(); + static { + HOLIDAYS.add(LocalDate.of(2024, 1, 1)); + HOLIDAYS.add(LocalDate.of(2024, 5, 1)); + HOLIDAYS.add(LocalDate.of(2024, 10, 1)); + } + + public static List initializeWorkDates() { + List yearlyDates = new ArrayList<>(); + LocalDate startDate = LocalDate.of(LocalDate.now().getYear(), 1, 1); // 年初 + LocalDate endDate = LocalDate.of(LocalDate.now().getYear(), 12, 31); // 年底 + + LocalDate date = startDate; + while (!date.isAfter(endDate)) { + boolean isWorkDay = isWorkDay(date); + yearlyDates.add(new DateInfo(date, isWorkDay)); + date = date.plusDays(1); + } + + return yearlyDates; + } + + private static boolean isWorkDay(LocalDate date) { + // 检查是否是工作日(周一到周五) + if (date.getDayOfWeek() == DayOfWeek.SATURDAY || date.getDayOfWeek() == DayOfWeek.SUNDAY) { + return false; + } + // 检查是否是节假日 + if (HOLIDAYS.contains(date)) { + return false; + } + return true; + } + @Test + public void testmain() { + List yearlyDates = initializeWorkDates(); + System.out.println("本年度每一天的日期及其是否为工作日:"); + yearlyDates.forEach(System.out::println); + } +} diff --git a/yudao-module-base/yudao-module-base-biz/src/test/java/testDate.java b/yudao-module-base/yudao-module-base-biz/src/test/java/testDate.java new file mode 100644 index 0000000..9defc4e --- /dev/null +++ b/yudao-module-base/yudao-module-base-biz/src/test/java/testDate.java @@ -0,0 +1,15 @@ +import org.junit.jupiter.api.Test; + +import java.time.Instant; +import java.time.LocalDate; +import java.time.ZoneId; + +public class testDate { + @Test + public void testmain() { + long timestamp = 1727712000000L; // 示例时间戳(毫秒) + LocalDate date = Instant.ofEpochMilli(timestamp).atZone(ZoneId.systemDefault()).toLocalDate(); + System.out.println(date); + } + +} diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml index 86b44ae..59a8cc2 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-local.yaml @@ -3,7 +3,7 @@ spring: cloud: nacos: - server-addr: 192.168.1.102:8848 # Nacos 服务器地址 + server-addr: 127.0.0.1:8848 # Nacos 服务器地址 username: nacos # Nacos 账号 password: nacos # Nacos 密码 discovery: # 【配置中心】配置项 @@ -81,10 +81,10 @@ spring: # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 redis: - host: 127.0.0.1 # 地址 + host: 192.168.1.28 # 地址 port: 6379 # 端口 database: 0 # 数据库索引 -# password: 123456 # 密码,建议生产环境开启 + password: 123456 # 密码,建议生产环境开启 --- #################### MQ 消息队列相关配置 ####################