当前位置: 首页 > news >正文

重庆招聘一般上什么网站小程序制作费用多少

重庆招聘一般上什么网站,小程序制作费用多少,北京有哪些炫酷的网站页面,津南天津网站建设SpringBoot拉取日历数据 一、前言 万年历API#xff1a;https://www.mxnzp.com/doc/detail?id1 二、代码如下 按年生成日历数据国家一般当年10月底发布下一年度的节假日安排 package com.qiangesoft.calendar.mxnzp;import com.baomidou.mybatisplus.core.conditions.qu…SpringBoot拉取日历数据 一、前言 万年历APIhttps://www.mxnzp.com/doc/detail?id1 二、代码如下 按年生成日历数据国家一般当年10月底发布下一年度的节假日安排 package com.qiangesoft.calendar.mxnzp;import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.qiangesoft.calendar.entity.CalendarConfig; import com.qiangesoft.calendar.service.CalendarConfigService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component;import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAdjusters; import java.util.ArrayList; import java.util.List;/*** 日历数据生成 定时器执行者** author qiangesoft* date 2023-09-29*/ Slf4j Component public class CalendarTask {Autowiredprivate CalendarConfigService calendarConfigService;/*** 规则可设置为每日或者每月执行一次*/Scheduled(cron 0 0 10 * * ?)public void action() {log.info(Create calendar data start);// 生成未来五年的数据LocalDate thisYearFirstDay LocalDate.now().with(TemporalAdjusters.firstDayOfYear());for (int i 0; i 5; i) {LocalDate localDate thisYearFirstDay.plusYears(i);this.doCreate(localDate);}log.info(Create calendar data finish);}/*** 日历数据生成** param firstDay*/private void doCreate(LocalDate firstDay) {int year firstDay.getYear();log.info(Create {}year calendar data start!, year);LambdaQueryWrapperCalendarConfig queryWrapper new LambdaQueryWrapper();queryWrapper.eq(CalendarConfig::getYear, year);long count calendarConfigService.count(queryWrapper);if (count 0) {log.info(Calendar data already created, do nothing!);return;}LocalDate lastDay firstDay.plusYears(1);ListCalendarConfig calendarConfigList new ArrayList();LocalDate localDate firstDay;while (lastDay.isAfter(localDate)) {CalendarConfig calendarConfig new CalendarConfig();calendarConfig.setYear(year);calendarConfig.setMonth(localDate.getMonthValue());calendarConfig.setDate(localDate.format(DateTimeFormatter.ofPattern(yyyy-MM-dd)));int week localDate.getDayOfWeek().getValue();calendarConfig.setWeekDay(week);if (week 6 || week 7) {calendarConfig.setType(1);} else {calendarConfig.setType(0);}calendarConfigList.add(calendarConfig);localDate localDate.plusDays(1);}calendarConfigService.saveBatch(calendarConfigList);log.info(Create {}year calendar data finish!, year);} } package com.qiangesoft.calendar.mxnzp;import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.qiangesoft.calendar.entity.CalendarConfig; import com.qiangesoft.calendar.mxnzp.model.CalendarConfigDTO; import com.qiangesoft.calendar.mxnzp.model.MxnzpCalendarDTO; import com.qiangesoft.calendar.mxnzp.model.MxnzpResponseData; import com.qiangesoft.calendar.service.CalendarConfigService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import org.springframework.web.client.RestTemplate;import java.time.LocalDate; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors;/*** mxnpz数据拉取 定时器执行者** author qiangesoft* date 2023-09-29*/ Slf4j Component public class MxnzpCalendarTask {private static String URL https://www.mxnzp.com/api/holiday/list/year/%d?ignoreHolidayfalseapp_idtldkn1hkkoofquesapp_secretkV9qgeRJ5baZworKApsWVbHS3hNxndYZ;Autowiredprivate RestTemplate restTemplate;Autowiredprivate CalendarConfigService calendarConfigService;/*** 国家一般当年10月底发布下一年度的节假日安排*/Scheduled(cron 0 0 10 * * ?)public void action() {LocalDate today LocalDate.now();// 从11月开始拉取下一年的数据int year today.getYear();if (today.getMonthValue() 10) {year year 1;}log.info(Mxnzp data pull {}year start, year);LambdaQueryWrapperCalendarConfig countQueryWrapper new LambdaQueryWrapper();countQueryWrapper.eq(CalendarConfig::getYear, year).eq(CalendarConfig::getPullFlag, true);long count calendarConfigService.count(countQueryWrapper);if (count 0) {log.info(Mxnzp data already update, do nothing!);return;}ResponseEntityMxnzpResponseData responseEntity restTemplate.getForEntity(String.format(URL, year), MxnzpResponseData.class);HttpStatus statusCode responseEntity.getStatusCode();if (!HttpStatus.OK.equals(statusCode)) {log.info(Mxnzp data pull fail!);return;}MxnzpResponseData responseData responseEntity.getBody();if (!responseData.getCode().equals(1)) {log.info(Mxnzp data pull fail!);return;}ListMxnzpCalendarDTO data responseData.getData();if (CollectionUtils.isEmpty(data)) {log.info(Mxnzp data pull is empty!);return;}LambdaQueryWrapperCalendarConfig queryWrapper new LambdaQueryWrapper();queryWrapper.eq(CalendarConfig::getYear, year);ListCalendarConfig calendarConfigList calendarConfigService.list(queryWrapper);MapString, CalendarConfig configMap calendarConfigList.stream().collect(Collectors.toMap(CalendarConfig::getDate, calendarConfig - calendarConfig));ListCalendarConfig newConfigList new ArrayList();ListCalendarConfig updateConfigList new ArrayList();for (MxnzpCalendarDTO monthData : data) {ListCalendarConfigDTO days monthData.getDays();for (CalendarConfigDTO day : days) {CalendarConfig calendarConfig configMap.get(day.getDate());if (calendarConfig null) {calendarConfig new CalendarConfig();calendarConfig.setYear(monthData.getYear());calendarConfig.setMonth(monthData.getMonth());calendarConfig.setDate(day.getDate());calendarConfig.setType(day.getType());calendarConfig.setTypeDes(day.getTypeDes());calendarConfig.setWeekDay(day.getWeekDay());calendarConfig.setDayOfYear(day.getDayOfYear());calendarConfig.setWeekOfYear(day.getWeekOfYear());calendarConfig.setIndexWorkDayOfMonth(day.getIndexWorkDayOfMonth());calendarConfig.setLunarCalendar(day.getLunarCalendar());calendarConfig.setSolarTerms(day.getSolarTerms());calendarConfig.setYearTips(day.getYearTips());calendarConfig.setChineseZodiac(day.getChineseZodiac());calendarConfig.setConstellation(day.getConstellation());calendarConfig.setSuit(day.getSuit());calendarConfig.setAvoid(day.getAvoid());calendarConfig.setPullFlag(true);newConfigList.add(calendarConfig);} else {calendarConfig.setType(day.getType());calendarConfig.setTypeDes(day.getTypeDes());calendarConfig.setWeekDay(day.getWeekDay());calendarConfig.setDayOfYear(day.getDayOfYear());calendarConfig.setWeekOfYear(day.getWeekOfYear());calendarConfig.setIndexWorkDayOfMonth(day.getIndexWorkDayOfMonth());calendarConfig.setLunarCalendar(day.getLunarCalendar());calendarConfig.setSolarTerms(day.getSolarTerms());calendarConfig.setYearTips(day.getYearTips());calendarConfig.setChineseZodiac(day.getChineseZodiac());calendarConfig.setConstellation(day.getConstellation());calendarConfig.setSuit(day.getSuit());calendarConfig.setAvoid(day.getAvoid());calendarConfig.setPullFlag(true);updateConfigList.add(calendarConfig);}}}if (!CollectionUtils.isEmpty(newConfigList)) {calendarConfigService.saveBatch(newConfigList);}if (!CollectionUtils.isEmpty(updateConfigList)) {calendarConfigService.updateBatchById(updateConfigList);}log.info(Mxnzp data {}year updated, year);} } package com.qiangesoft.calendar.entity;import com.baomidou.mybatisplus.annotation.*; import lombok.Data;import java.util.Date;/*** 日历配置** author qiangesoft* date 2023-10-19 22:28:02*/ Data TableName(calendar_config) public class CalendarConfig {/*** id*/TableId(type IdType.ASSIGN_ID)private Long id;/*** 年份*/private Integer year;/*** 月份*/private Integer month;/*** 日期*/private String date;/*** 类型*/private String type;/*** 类型描述*/private String typeDes;/*** 本周第几天*/private Integer weekDay;/*** 年中第几天*/private Integer dayOfYear;/*** 年中第几周*/private Integer weekOfYear;/*** 当月的第几个工作日*/private Integer indexWorkDayOfMonth;/*** 农历日期*/private String lunarCalendar;/*** 节气描述*/private String solarTerms;/*** 天干地支纪年法*/private String yearTips;/*** 属相*/private String chineseZodiac;/*** 星座*/private String constellation;/*** 宜事项*/private String suit;/*** 忌事项*/private String avoid;/*** 是否拉取日历数据*/private Boolean pullFlag;/*** 创建时间*/TableField(fill FieldFill.INSERT)private Date createBy;/*** 创建人*/TableField(fill FieldFill.INSERT)private Long createUser;/*** 更新时间*/TableField(fill FieldFill.UPDATE)private Date updateTime;/*** 更新人*/TableField(fill FieldFill.UPDATE)private Long updateBy; } 三、源码地址 源码地址https://gitee.com/qiangesoft/boot-business/tree/master/boot-business-calendar
http://www.pierceye.com/news/807602/

相关文章:

  • 中国建设银行官网站预定红念币天元建设集团有限公司地址
  • wix做网站教程网站建设 销售提成
  • 长安网站建设费用开天猫旗舰店网站建设
  • 网页游戏网站哪个最好专业建站公司建站系统该规划哪些内容
  • 青岛网站建设公司大全在那些网站上做企业宣传好
  • 天河定制型网站建设中国科技成就的例子
  • 网站报备查询android安卓软件下载
  • 百度站长平台网站验证wordpress关闭略缩图
  • 网站怎么做qq微信登陆界面设计的有趣的网站推荐
  • 设计logo网站赚钱注册域名怎么做网站
  • 网站备案 教程网站设计大全推荐
  • 临沂建设局网站官网文明网站建设工作进度表
  • 网站编辑seo旅游网站建设代码
  • 为什么自己做的网站打开是乱码wordpress live-2d
  • 素材下载网站电商自建站
  • 浙江省的网站建设公司有哪些代理注册公司一般多少钱
  • 如何在建设银行网站预约纪念币东莞网站建设服务有什
  • 有哪些可以做h5的网站代理网址上境外网
  • 做网站所需要的代码6红杏直播
  • 南通制作网站wordpress移动版设置
  • 哪个网站有免费ppt下载建筑类网站的推荐理由
  • 视觉差的网站公司外包
  • 基础做网站内蒙住房和城乡建设部网站
  • 发帖效果好的网站展馆展示设计公司排名
  • 童装网站建设文案什么网站做的号
  • 能打开的a站莆田网站建设建站系统
  • 上海市城乡建设管理局网站一个月做网站
  • 网站后台管理系统 aspwordpress拖拽上传
  • 华为手机官方网站登录爬虫做视频网站
  • 山东省工程建设信息官方网站河南网站seo推广