From 6557d6b502ef7cd9566196af2b17bde76de321e3 Mon Sep 17 00:00:00 2001 From: aikai Date: Fri, 14 Jun 2024 12:05:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E8=8E=B7=E5=8F=96=E6=AF=8F?= =?UTF-8?q?=E5=B9=B4=E8=8A=82=E5=81=87=E6=97=A5=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/attendance/AttendanceServiceImpl.java | 14 +++++++++++--- .../admin/factoryinfo/vo/FactoryInfoSaveReqVO.java | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/attendance/AttendanceServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/attendance/AttendanceServiceImpl.java index ce5899da..a9184eb6 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/attendance/AttendanceServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/attendance/AttendanceServiceImpl.java @@ -214,10 +214,17 @@ public class AttendanceServiceImpl implements AttendanceService { Boolean flag = stringRedisTemplate.hasKey(key); // 缓存不存在 if (Boolean.FALSE.equals(flag)) { - String url = "https://cdn.jsdelivr.net/gh/NateScarlet/holiday-cn@master/" + year + ".json"; - String json = HttpUtil.get(url, 0); + String url = "https://timor.tech/api/holiday/year/" + year; + String json = HttpUtil.get(url, 3000); + Map map = new HashMap<>(); JSONObject jsonObject = JSONUtil.parseObj(json); - Map map = jsonObject.getBeanList("days", HolidayVO.class).stream().collect(Collectors.toMap(HolidayVO::getDate, HolidayVO::getIsOffDay)); + Object o = jsonObject.get("holiday"); + //将o转为json对象并且循环获取对象中所有的属性 + JSONObject data = JSONUtil.parseObj(o); + data.forEach((k, v) -> { + JSONObject item = JSONUtil.parseObj(v); + map.put(item.get("date").toString(), item.get("isOffDay").toString()); + }); stringRedisTemplate.opsForHash().putAll(key, map); // -- 删除去年的 String lastKey = "holiday_" + (Integer.parseInt(year) - 1); @@ -756,6 +763,7 @@ public class AttendanceServiceImpl implements AttendanceService { // 导出 Excel // ExcelUtils.write(response, "考勤组人员.xls", "数据", AttendanceGroupUserRespVO.class, // BeanUtils.toBean(list, AttendanceGroupUserRespVO.class)); + } /** diff --git a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/controller/admin/factoryinfo/vo/FactoryInfoSaveReqVO.java b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/controller/admin/factoryinfo/vo/FactoryInfoSaveReqVO.java index 73a39144..19716512 100644 --- a/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/controller/admin/factoryinfo/vo/FactoryInfoSaveReqVO.java +++ b/zn-module-smartfactory/zn-module-smartfactory-biz/src/main/java/cn/iocoder/yudao/module/smartfactory/controller/admin/factoryinfo/vo/FactoryInfoSaveReqVO.java @@ -63,7 +63,7 @@ public class FactoryInfoSaveReqVO { private BigDecimal lat; @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - @NotNull(message = "状态不能为空") +// @NotNull(message = "状态不能为空") private Integer status; @Schema(description = "负责人编号", example = "126")