更换获取每年节假日路径
This commit is contained in:
parent
7121d3bee2
commit
6557d6b502
@ -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<String, String> map = new HashMap<>();
|
||||
JSONObject jsonObject = JSONUtil.parseObj(json);
|
||||
Map<String, String> 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));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user