diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/HolidayController.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/HolidayController.java new file mode 100644 index 0000000..1f07223 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/HolidayController.java @@ -0,0 +1,65 @@ +package com.biutag.outeradmin.controller; + +import com.biutag.core.AjaxResult; +import com.biutag.outeradmin.model.dto.LoginDto; +import com.biutag.outeradmin.model.vo.HolidayVo; +import com.biutag.outeradmin.service.HolidayService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +@RequiredArgsConstructor +@RestController +@Api(tags = "节假日接口") +@RequestMapping("/outer/holiday") +public class HolidayController { + + @Resource + private HolidayService holidayService; + + @RequestMapping("/getholiday") + @ApiOperation("查询节假日") + public AjaxResult getlist(@RequestParam("search") String search) throws Exception { + + //判断年份 + LocalDateTime currentDate = LocalDateTime.now(); + int currentyear = currentDate.getYear(); + if (Integer.parseInt(search) != currentyear){ + return AjaxResult.success(); + } + Map> map = holidayService.showholiday(); + return AjaxResult.success(map); + + } + + + @PostMapping("/saveholiday") + @ApiOperation("节假日") + public AjaxResult setlist(@RequestBody String search) throws Exception { + LocalDateTime currentDate = LocalDateTime.now(); + int currentyear = currentDate.getYear(); + if (Integer.parseInt(search) != currentyear){ + return AjaxResult.success(); + } + holidayService.saveholiday(search); + return AjaxResult.success(); + + } + + + @RequestMapping("/showholiday") + @ApiOperation("进入页面显示节假日") + public AjaxResult getlist() throws Exception { + Map> map = holidayService.showholiday(); + return AjaxResult.success(map); + } + + + +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailController.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailController.java index 9f64889..222151b 100644 --- a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailController.java +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailController.java @@ -48,27 +48,55 @@ public class MailController { public MailPageInfo siftList(@RequestBody String form) { //todo 这里根据表单数据查询数据库,记得删掉 System.out.println(form); - FormPage formPage = JSON.parseObject(form, FormPage.class); + MailFormPage mailFormPage = JSON.parseObject(form, MailFormPage.class); QueryWrapper queryWrapper = new QueryWrapper<>(); - if (formPage != null && formPage.getFormData() != null && formPage.getPageData() != null) { - FormData formData = formPage.getFormData(); + if (mailFormPage != null && mailFormPage.getFormData() != null && mailFormPage.getPageData() != null) { + MailFormData mailFormData = mailFormPage.getFormData(); + if (StringUtils.isNotEmpty(mailFormData.getEvaluate())) { + System.out.println(mailFormData.getEvaluate()); + switch (mailFormData.getEvaluate()) { + case "不满意": + mailFormData.setEvaluate("NOT_SATISFIED"); + break; + case "基本满意": + mailFormData.setEvaluate("BASICALLY_SATISFIED"); + break; + case "满意": + mailFormData.setEvaluate("SATISFIED"); + break; + } + } - queryWrapper.lambda().like(StringUtils.isNotEmpty(formData.getContactName()), Mail::getContactName, formData.getContactName()) - .like(StringUtils.isNotEmpty(formData.getContactPhone()), Mail::getContactPhone, formData.getContactPhone()) - .like(StringUtils.isNotEmpty(formData.getContactIdCard()), Mail::getContactIdCard, formData.getContactIdCard()) - .like(StringUtils.isNotEmpty(formData.getId()), Mail::getId, formData.getId()) - .like(StringUtils.isNotEmpty(formData.getContent()), Mail::getContent, formData.getContent()); - if (CollectionUtils.isNotEmpty(formData.getDate()) && formData.getDate().size() == 2) { - queryWrapper.lambda().between(Mail::getCreateTime, formData.getDate().get(0), formData.getDate().get(1)); + queryWrapper.lambda().like(StringUtils.isNotEmpty(mailFormData.getContactName()), Mail::getContactName, mailFormData.getContactName()) + .like(StringUtils.isNotEmpty(mailFormData.getContactPhone()), Mail::getContactPhone, mailFormData.getContactPhone()) + .like(StringUtils.isNotEmpty(mailFormData.getContactIdCard()), Mail::getContactIdCard, mailFormData.getContactIdCard()) + .like(StringUtils.isNotEmpty(mailFormData.getId()), Mail::getId, mailFormData.getId()) + .like(StringUtils.isNotEmpty(mailFormData.getContent()), Mail::getContent, mailFormData.getContent()) + .eq(StringUtils.isNotEmpty(mailFormData.getEvaluate()), Mail::getSatisfaction, mailFormData.getEvaluate()); + if (CollectionUtils.isNotEmpty(mailFormData.getDate()) && mailFormData.getDate().size() == 2) { + queryWrapper.lambda().between(Mail::getCreateTime, mailFormData.getDate().get(0), mailFormData.getDate().get(1)); } } - PageSet pageSet = formPage.getPageData(); + PageSet pageSet = mailFormPage.getPageData(); Page page = new Page<>(pageSet.getCurrentPage(), pageSet.getPageSize()); List mailPage = mailMapper.selectPage(page, queryWrapper).getRecords(); for (Mail mail : mailPage) { mail.setContactIdCard(DesensitizedUtil.encryptIDCard(mail.getContactIdCard())); mail.setContactPhone(DesensitizedUtil.encryptPhone(mail.getContactPhone())); + if (StringUtils.isNotEmpty(mail.getSatisfaction())) { + switch (mail.getSatisfaction()) { + case "SATISFIED": + mail.setSatisfaction("满意"); + break; + case "NOT_SATISFIED": + mail.setSatisfaction("不满意"); + break; + case "BASICALLY_SATISFIED": + mail.setSatisfaction("基本满意"); + break; + } + } } pageSet.setTotalSize((int) page.getTotal()); MailPageInfo result = new MailPageInfo(); diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/UserController.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/UserController.java new file mode 100644 index 0000000..5013a5a --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/UserController.java @@ -0,0 +1,91 @@ +package com.biutag.outeradmin.controller; + +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.biutag.outeradmin.entity.*; +import com.biutag.outeradmin.mapper.UserMapper; +import com.biutag.outeradmin.service.UserService; +import com.biutag.outeradmin.util.DesensitizedUtil; +import com.biutag.util.StringUtils; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +@RequestMapping("/user") +@RestController +@RequiredArgsConstructor +public class UserController { + private final UserMapper userMapper; + private final UserService userService; + + @RequestMapping("/list-submit") + public UserPageInfo siftList(@RequestBody String form) { + //todo 这里根据表单数据查询数据库,记得删掉 + System.out.println(form); + UserFormPage userFormPage = JSON.parseObject(form, UserFormPage.class); + System.out.println(userFormPage); + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (userFormPage != null && userFormPage.getFormData() != null && userFormPage.getPageData() != null) { + UserFormData formData = userFormPage.getFormData(); + + queryWrapper.lambda().like(StringUtils.isNotEmpty(formData.getRealName()), User::getRealName, formData.getRealName()) + .like(StringUtils.isNotEmpty(formData.getPhone()), User::getPhone, formData.getPhone()) + .like(StringUtils.isNotEmpty(formData.getIdCard()), User::getIdCard, formData.getIdCard()); + if (CollectionUtils.isNotEmpty(formData.getDate()) && formData.getDate().size() == 2) { + queryWrapper.lambda().between(User::getCreateTime, formData.getDate().get(0), formData.getDate().get(1)); + } + } + PageSet pageSet = userFormPage.getPageData(); + + Page page = new Page<>(pageSet.getCurrentPage(), pageSet.getPageSize()); + List userPage = userMapper.selectPage(page, queryWrapper).getRecords(); + for (User user : userPage) { + user.setIdCard(DesensitizedUtil.encryptIDCard(user.getIdCard())); + user.setPhone(DesensitizedUtil.encryptPhone(user.getPhone())); + } + pageSet.setTotalSize((int) page.getTotal()); + UserPageInfo result = new UserPageInfo(); + result.setUsers(userPage); + result.setPageSet(pageSet); + + return result; + } + + @RequestMapping("/add-user") + public String addUser(@RequestBody String form) { + UserFormData userForm = JSON.parseObject(form, UserFormData.class); + System.out.println("新用户数据" + userForm); + User user = new User(); + user.setRealName(userForm.getRealName()); + user.setPhone(userForm.getPhone()); + user.setIdCard(userForm.getIdCard()); + LocalDateTime createTime = LocalDateTime.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + user.setCreateTime(simpleDateFormat.parse(createTime.format(formatter))); + userMapper.insert(user); + return "success"; + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + @RequestMapping("/delete-user") + public String deleteUser(@RequestBody String id){ + User user = JSON.parseObject(id, User.class); + System.out.println("User数据为" + user); + userMapper.deleteById(user.getId()); + return "success"; + } +} + diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/domain/Holiday.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/domain/Holiday.java new file mode 100644 index 0000000..577afe5 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/domain/Holiday.java @@ -0,0 +1,29 @@ +package com.biutag.outeradmin.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 管理员 + */ +@Data +@TableName("holiday") +@NoArgsConstructor +@AllArgsConstructor +public class Holiday implements Serializable { +@TableId(type = IdType.AUTO) + private Integer id; + + private String date; + + private String holiday_flag; + + private String detail; + +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/FormData.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/MailFormData.java similarity index 91% rename from mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/FormData.java rename to mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/MailFormData.java index 8388b1d..dd1c408 100644 --- a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/FormData.java +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/MailFormData.java @@ -5,7 +5,7 @@ import lombok.Data; import java.util.List; @Data -public class FormData { +public class MailFormData { private List date; private String contactName; private String contactPhone; diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/FormPage.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/MailFormPage.java similarity index 61% rename from mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/FormPage.java rename to mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/MailFormPage.java index 74ebb03..a5b93fd 100644 --- a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/FormPage.java +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/MailFormPage.java @@ -3,8 +3,8 @@ package com.biutag.outeradmin.entity; import lombok.Data; @Data -public class FormPage { - private FormData formData; +public class MailFormPage { + private MailFormData formData; private PageSet pageData; } diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/User.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/User.java new file mode 100644 index 0000000..ed1fe55 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/User.java @@ -0,0 +1,22 @@ +package com.biutag.outeradmin.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; + +@Data +@TableName("\"user\"") +public class User { + @TableId + private Integer id; + private String openid; + private String nickName; + private Date createTime; + private String idCard; + private String realName; + private String phone; + private Date updateTime; + private Date faceAuthTime; +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/UserFormData.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/UserFormData.java new file mode 100644 index 0000000..f0c2e39 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/UserFormData.java @@ -0,0 +1,13 @@ +package com.biutag.outeradmin.entity; + +import lombok.Data; + +import java.util.List; + +@Data +public class UserFormData { + private List date; + private String realName; + private String phone; + private String idCard; +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/UserFormPage.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/UserFormPage.java new file mode 100644 index 0000000..2703a4d --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/UserFormPage.java @@ -0,0 +1,9 @@ +package com.biutag.outeradmin.entity; + +import lombok.Data; + +@Data +public class UserFormPage { + private UserFormData formData; + private PageSet pageData; +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/UserPageInfo.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/UserPageInfo.java new file mode 100644 index 0000000..54384c4 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/UserPageInfo.java @@ -0,0 +1,11 @@ +package com.biutag.outeradmin.entity; + +import lombok.Data; + +import java.util.List; + +@Data +public class UserPageInfo { + private List users; + private PageSet pageSet; +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/HolidayMapper.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/HolidayMapper.java new file mode 100644 index 0000000..147dc6e --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/HolidayMapper.java @@ -0,0 +1,11 @@ +package com.biutag.outeradmin.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.entity.user.User; +import com.biutag.outeradmin.domain.Holiday; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface HolidayMapper extends BaseMapper { +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/UserMapper.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/UserMapper.java new file mode 100644 index 0000000..de443cc --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/UserMapper.java @@ -0,0 +1,9 @@ +package com.biutag.outeradmin.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.outeradmin.entity.User; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface UserMapper extends BaseMapper { +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/model/vo/HolidayVo.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/model/vo/HolidayVo.java new file mode 100644 index 0000000..723d0c7 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/model/vo/HolidayVo.java @@ -0,0 +1,14 @@ +package com.biutag.outeradmin.model.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class HolidayVo { + private String workingday;//日期 + + private String content;//描述 +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/HolidayService.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/HolidayService.java new file mode 100644 index 0000000..215414b --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/HolidayService.java @@ -0,0 +1,15 @@ +package com.biutag.outeradmin.service; + +import com.biutag.outeradmin.domain.Holiday; +import com.biutag.outeradmin.model.vo.HolidayVo; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +public interface HolidayService { + + List getholiday(String search) throws IOException; + void saveholiday(String search) throws IOException; + Map> showholiday(); +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/UserService.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/UserService.java new file mode 100644 index 0000000..d6835fe --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/UserService.java @@ -0,0 +1,10 @@ +package com.biutag.outeradmin.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.outeradmin.entity.User; +import com.biutag.outeradmin.mapper.UserMapper; +import org.springframework.stereotype.Service; + +@Service +public class UserService extends ServiceImpl { +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/impl/HolidayServiceImpl.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/impl/HolidayServiceImpl.java new file mode 100644 index 0000000..3e363b5 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/impl/HolidayServiceImpl.java @@ -0,0 +1,40 @@ +package com.biutag.outeradmin.service.impl; + +import com.biutag.outeradmin.domain.Holiday; +import com.biutag.outeradmin.mapper.HolidayMapper; + +import com.biutag.outeradmin.model.vo.HolidayVo; +import com.biutag.outeradmin.service.HolidayService; +import com.biutag.outeradmin.utils.HolidayUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +@Service +public class HolidayServiceImpl implements HolidayService { + + @Autowired + private HolidayMapper holidayMapper; + + @Override + public List getholiday(String search) throws IOException { + return HolidayUtil.getAllHolidayByYear(search); + } + public Map> showholiday() { + List list = holidayMapper.selectList(null); + return HolidayUtil.HolidayHandle(list); + } + @Override + public void saveholiday(String search) throws IOException { + holidayMapper.delete(null); + List list = HolidayUtil.getAllHolidayByYear(search); + for(Holiday holiday :list){ + holidayMapper.insert(holiday); + } + } + + +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/utils/HolidayUtil.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/utils/HolidayUtil.java new file mode 100644 index 0000000..933db8c --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/utils/HolidayUtil.java @@ -0,0 +1,165 @@ +package com.biutag.outeradmin.utils; + + +import com.biutag.outeradmin.domain.Holiday; +import com.biutag.outeradmin.model.vo.HolidayVo; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.time.DayOfWeek; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; + +public class HolidayUtil { + + /** + * 发送get请求 + */ + private static String get(String url){ + StringBuilder inputLine = new StringBuilder(); + String read; + try { + HttpURLConnection urlConnection = (HttpURLConnection) new URL(url).openConnection(); + urlConnection.setReadTimeout(30 * 1000); + urlConnection.setConnectTimeout(30 * 1000); + urlConnection.setRequestProperty("Charset", "UTF-8"); + urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36)"); + BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream(), StandardCharsets.UTF_8)); + while ((read = in.readLine()) != null) { + inputLine.append(read); + } + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + + return inputLine.toString(); + } + + + public static List getAllHolidayByYear(String year) throws IOException { + List allDateDayList = new ArrayList<>(); + +// SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); +// ArrayList holidayVoList = new ArrayList<>(); +// HashMap hashMap = new HashMap<>(); + + //查询全年日历包含周末 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + List allDateList = new ArrayList<>(); + LocalDate startDate = LocalDate.of(Integer.parseInt(year.trim()), 1, 1); + LocalDate endDate = startDate; + + while (Integer.parseInt(year) == endDate.getYear()) { + Holiday holiday = new Holiday(); + DayOfWeek week = endDate.getDayOfWeek(); + if(week == DayOfWeek.SATURDAY ) { + holiday.setHoliday_flag("Y"); + holiday.setDate(endDate.format(formatter)); + holiday.setDetail("周六"); + allDateDayList.add(holiday); + }else if(week == DayOfWeek.SUNDAY){ + holiday.setHoliday_flag("Y"); + holiday.setDate(endDate.format(formatter)); + holiday.setDetail("周日"); + allDateDayList.add(holiday); + }else{ + holiday.setHoliday_flag("N"); + holiday.setDate(endDate.format(formatter)); + allDateDayList.add(holiday); + } + + endDate = endDate.plusDays(1L); + } + + + //查询全年节假日、调休 + String holidayJson = HolidayUtil.get("https://timor.tech/api/holiday/year/"+year + "/"); + ObjectMapper mapper = new ObjectMapper(); + Map holidayMap = mapper.readValue(holidayJson,Map.class); + LinkedHashMap holidayList = (LinkedHashMap)holidayMap.get("holiday"); +// if(holidayList == null){ +// +// } + holidayList.forEach((key,value) -> { + Holiday holiday = new Holiday(); + Map value1 = (Map) value; + String dateTime = value1.get("date").toString(); + holiday.setDate(dateTime); + if(value1.get("name").toString().contains("补班")){ + holiday.setDetail("正常上班"); + holiday.setHoliday_flag("N"); + }else { + holiday.setDetail(value1.get("name").toString()); + holiday.setHoliday_flag("Y"); + } + + for(int i = 0;i { + Integer i = o1.getDate().compareTo(o2.getDate()); + return i; + }); + for(Holiday holiday : allDateDayList){ + System.out.println(holiday); + } + + return allDateDayList; + } + + public static Map> HolidayHandle(List list){ + Map> map = new HashMap>(); + for(Holiday holiday : list){ + HolidayVo holidayVo = new HolidayVo(); + + if (holiday.getDetail()==null){ + continue; + }else if(holiday.getDetail().contains("初")||holiday.getDetail().contains("元旦")||holiday.getDetail().contains("节")||holiday.getDetail().contains("周")){ + holidayVo.setContent(holiday.getDetail()); + }else if(holiday.getDetail().contains("正常上班")){ + holidayVo.setContent(holiday.getDetail()); + } + String mouth = holiday.getDate().substring(5,7); + holidayVo.setWorkingday(holiday.getDate().substring(8,10)); + + if (map.containsKey("mouth"+mouth)){ + List listofmap = map.get("mouth"+mouth); + listofmap.add(holidayVo); + }else { + List listHolidayVo = new ArrayList<>(); + listHolidayVo.add(holidayVo); + map.put("mouth"+mouth,listHolidayVo); + } + System.out.println(holidayVo); + } + return map; + } + + + +}