项目中日历管理学习使用
一些项目中会有日历或日期设置,最基本的会显示工作日,休息日,节假日等等,下面就是基于项目中的日历管理功能,要显示工作日,休息日,节假日
效果图
获取国家法定节假日工具类
public class HolidayUtils {private static Logger logger = LoggerFactory.getLogger(HolidayUtils.class);public static Map<String,Map<String,OtherData>> monthToHolidayDate = new ConcurrentHashMap<>(12);public static Map<String,OtherData> dateToOtherData = new ConcurrentHashMap<>(12);public static void main(String[] args) {System.out.println(getAllHoliday(2024));}/*** 获取周末和节假日** @param year* @return*/public static List<String> getAllHoliday(int year) {// 获取所有的周末Set<String> allWeekend = getAllWeekend(year);// http://timor.tech/api/holiday api文档地址Map apiHoliday = getApiHoliday(year);Integer code = (Integer) apiHoliday.get("code");if (code != 0) {return null;}Map<String, Map<String, Object>> holiday = (Map<String, Map<String, Object>>) apiHoliday.get("holiday");Set<String> strings = holiday.keySet();for (String str : strings) {Map<String, Object> stringObjectMap = holiday.get(str);Integer wage = (Integer) stringObjectMap.get("wage");String date = (String) stringObjectMap.get("date");//筛选掉补班if (wage.equals(1)) {allWeekend.remove(date);} else {allWeekend.add(date);}int monthByDate = CalendarUtils.getMonthByDate(CalendarUtils.parseDateStrToDate(date, "yyyy-MM-dd"));if (!monthToHolidayDate.containsKey(monthByDate)){monthToHolidayDate.put(monthByDate+"",new HashMap<>());}Map<String, OtherData> dateToOtherData = monthToHolidayDate.get(monthByDate);if (dateToOtherData == null) dateToOtherData = new HashMap<>();if (!dateToOtherData.containsKey(date)){OtherData otherData = new OtherData();otherData.putAll(stringObjectMap);dateToOtherData.put(date,otherData);dateToOtherData.put(date,otherData);}}List<String> result = new ArrayList<>(allWeekend);result = result.stream().sorted().collect(Collectors.toList());return result;}/*** 获取节假日不含周末** @param year* @return*/private static Map getApiHoliday(int year) {String url = "http://timor.tech/api/holiday/year/" + year;String rsa = HttpUtil.get(url);logger.info("rsa:{}",rsa);Map map = JsonConverter.jsonStrToObject(rsa, Map.class);return map;}/*** 获取周末 月从0开始** @param year* @return*/public static Set<String> getAllWeekend(int year) {Set<String> dateList = new HashSet<>();SimpleDateFormat simdf = new SimpleDateFormat("yyyy-MM-dd");Calendar calendar = new GregorianCalendar(year, 0, 1);Calendar endCalendar = new GregorianCalendar(year, 11, 31);while (true) {int weekday = calendar.get(Calendar.DAY_OF_WEEK);if (weekday == 1 || weekday == 7) {dateList.add(simdf.format(calendar.getTime()));}calendar.add(Calendar.DATE, 1);if (calendar.getTimeInMillis() >= endCalendar.getTimeInMillis()) {break;}}return dateList;}public static Map<String,OtherData> getHolidayByMonth(String month,Date date){if (monthToHolidayDate == null) return new HashMap<>();if (StringUtils.isNotBlank(month)){month = CalendarUtils.getMonthByDate(date) + "";Map<String, OtherData> dateToOtherData = monthToHolidayDate.get(month);if (dateToOtherData == null) dateToOtherData = new HashMap<>();return dateToOtherData;}return new HashMap<>();}public static OtherData getHolidayByDate(Date date){String month = CalendarUtils.getMonthByDate(date) + "";Map<String, OtherData> dateToOtherData = monthToHolidayDate.get(month);if (dateToOtherData == null || dateToOtherData.size() == 0) return null;String dateStr = CalendarUtils.toString(date, "yyyy-MM-dd");OtherData otherData = dateToOtherData.get(dateStr);if (otherData != null && otherData.obtainVal("wage",Integer.class) != null&& 1 == otherData.obtainVal("wage",Integer.class)){return null;}return otherData;}public static String isHoliday(Date date){String month = CalendarUtils.getMonthByDate(date) + "";Map<String, OtherData> dateToOtherData = monthToHolidayDate.get(month);if (dateToOtherData == null || dateToOtherData.size() == 0) return null;String dateStr = CalendarUtils.toString(date, "yyyy-MM-dd");OtherData otherData = dateToOtherData.get(dateStr);if (otherData == null) return null;if (otherData != null && otherData.obtainVal("wage",Integer.class) != null&& 1 == otherData.obtainVal("wage",Integer.class)){return DateRec.DATE_TYPE_WORK;}return DateRec.DATE_TYPE_HOLIDAY;}}
返回的JSON数据格式
{"code": 0,"holiday": {"01-01": {"holiday": true,"name": "元旦","wage": 3,"date": "2024-01-01","rest": 1},"02-04": {"holiday": false,"name": "春节前补班","wage": 1,"after": false,"target": "春节","date": "2024-02-04","rest": 9},"02-10": {"holiday": true,"name": "初一","wage": 3,"date": "2024-02-10","rest": 15},"02-11": {"holiday": true,"name": "初二","wage": 3,"date": "2024-02-11","rest": 1},"02-12": {"holiday": true,"name": "初三","wage": 3,"date": "2024-02-12"},"02-13": {"holiday": true,"name": "初四","wage": 2,"date": "2024-02-13"},"02-14": {"holiday": true,"name": "初五","wage": 2,"date": "2024-02-14"},"02-15": {"holiday": true,"name": "初六","wage": 2,"date": "2024-02-15"},"02-16": {"holiday": true,"name": "初七","wage": 2,"date": "2024-02-16"},"02-17": {"holiday": true,"name": "初八","wage": 2,"date": "2024-02-17"},"02-18": {"holiday": false,"name": "春节后补班","wage": 1,"after": true,"target": "春节","date": "2024-02-18"},"04-04": {"holiday": true,"name": "清明节","wage": 3,"date": "2024-04-04","rest": 46},"04-05": {"holiday": true,"name": "清明节","wage": 2,"date": "2024-04-05"},"04-06": {"holiday": true,"name": "清明节","wage": 2,"date": "2024-04-06"},"04-07": {"holiday": false,"name": "清明节后补班","wage": 1,"target": "清明节","after": true,"date": "2024-04-07"},"04-28": {"holiday": false,"name": "劳动节前补班","wage": 1,"target": "劳动节","after": false,"date": "2024-04-28"},"05-01": {"holiday": true,"name": "劳动节","wage": 3,"date": "2024-05-01"},"05-02": {"holiday": true,"name": "劳动节","wage": 2,"date": "2024-05-02","rest": 1},"05-03": {"holiday": true,"name": "劳动节","wage": 3,"date": "2024-05-03"},"05-04": {"holiday": true,"name": "劳动节","wage": 3,"date": "2024-05-04"},"05-05": {"holiday": true,"name": "劳动节","wage": 3,"date": "2024-05-05"},"05-11": {"holiday": false,"name": "劳动节后补班","after": true,"wage": 1,"target": "劳动节","date": "2024-05-11"},"06-08": {"holiday": true,"name": "端午节","wage": 2,"date": "2024-06-08"},"06-09": {"holiday": true,"name": "端午节","wage": 2,"date": "2024-06-09"},"06-10": {"holiday": true,"name": "端午节","wage": 3,"date": "2024-06-10"},"09-14": {"holiday": false,"name": "中秋节前补班","after": false,"wage": 1,"target": "中秋节","date": "2024-09-14","rest": 96},"09-15": {"holiday": true,"name": "中秋节","wage": 2,"date": "2024-09-15","rest": 97},"09-16": {"holiday": true,"name": "中秋节","wage": 2,"date": "2024-09-16"},"09-17": {"holiday": true,"name": "中秋节","wage": 3,"date": "2024-09-17"},"09-29": {"holiday": false,"name": "国庆节前补班","after": false,"wage": 1,"target": "国庆节","date": "2024-09-29"},"10-01": {"holiday": true,"name": "国庆节","wage": 3,"date": "2024-10-01"},"10-02": {"holiday": true,"name": "国庆节","wage": 3,"date": "2024-10-02","rest": 1},"10-03": {"holiday": true,"name": "国庆节","wage": 3,"date": "2024-10-03"},"10-04": {"holiday": true,"name": "国庆节","wage": 2,"date": "2024-10-04"},"10-05": {"holiday": true,"name": "国庆节","wage": 2,"date": "2024-10-05"},"10-06": {"holiday": true,"name": "国庆节","wage": 2,"date": "2024-10-06","rest": 1},"10-07": {"holiday": true,"name": "国庆节","wage": 2,"date": "2024-10-07","rest": 1},"10-12": {"holiday": false,"after": true,"wage": 1,"name": "国庆节后补班","target": "国庆节","date": "2024-10-12"}}
}
实体模型
@Entity
@Table(name = "t_daterec",indexes={@Index(name="idx_t_daterec1",columnList="dateType"),@Index(name="idx_t_daterec2",columnList="dateTime")}
)
public class DateRec extends ExBizEntity {public static final String DATE_TYPE_WORK = "work";public static final String DATE_TYPE_WEEKEND = "weekend";public static final String DATE_TYPE_HOLIDAY = "holiday";@Column(length=20,nullable=false)private String dateType;//日历类型private Date dateTime;//日期public String getDateType() {return dateType;}public Date getDateTime() {return dateTime;}public DateRec() {}public DateRec(String id,String dateType, Date dateRTime) {this.id = id;this.dateType = dateType;this.dateTime = dateTime;}
}
@Entity
@Table(name = "t_holiday",indexes={@Index(name="idx_t_holiday1",columnList="holidayDate")}
)
public class Holiday extends ExBizEntity{private Date holidayDate;public Holiday() {}public Holiday(Date holidayDate) {this.holidayDate = holidayDate;}public Date getHolidayDate() {return holidayDate;}
}
超类
@MappedSuperclass
public abstract class ExBizEntity extends ValueObjectEntity {@Type(type="com.xysd.common.utils.hibernateType.MyCustomJsonType")private OtherData exAttr = new OtherData();//额外属性mappublic OtherData getExAttr() {return exAttr;}protected ExBizEntity(){super();}protected ExBizEntity(Map<String, Object> exAttr) {super();this.getNotNullExAttrWithUpdate().putAll(exAttr);}//获取非空扩展属性private OtherData getNotNullExAttrWithUpdate() {if(this.exAttr == null) this.exAttr = new OtherData();return this.exAttr;}public void clearExAttr(){this.exAttr = null;}//更新扩展属性public void updateExAttr(Map<String, Object> exAttr){this.getNotNullExAttrWithUpdate().clear();if(exAttr==null) {this.exAttr = null;return;}this.addAttrs(exAttr);}//添加扩展属性public void addAttr(String key, Object value){if(StringUtils.isBlank(key)) return;if(value==null) {this.getNotNullExAttrWithUpdate().remove(key);}else {this.getNotNullExAttrWithUpdate().put(key, value);}}//添加扩展属性public void addAttrs(Map<String, Object> exAttr){if(exAttr==null) return;for (Map.Entry<String,Object> e : exAttr.entrySet()) {this.addAttr(e.getKey(), e.getValue());}}//获取指定类型的对象@Transientpublic <T> T getAttr(String key) {if(this.exAttr==null) return null;return this.exAttr.obtainVal(key);}//获取指定类型的对象@Transientpublic <T> T getAttr(String key, Class<T> valClass) {if(this.exAttr==null) return null;return this.exAttr.obtainVal(key, valClass);}//获取指定转换类型的对象@Transientpublic <T> T getAttr(String key, TypeReference<T> valTypeRef) {if(this.exAttr==null) return null;return this.exAttr.obtainVal(key, valTypeRef);}}
@MappedSuperclass
public abstract class ValueObjectEntity extends IEntity{public static String SYSCODE_CAD="cad";//系统编码-cad:cad接口protected Date createTime = new Date();//创建时间@Type(type = "org.hibernate.type.NumericBooleanType")protected boolean history=false;@Column(length=40)protected String createIp;//创建时的ipprotected int valid=1;//有效性protected Date lastUpdateDate = new Date();//最后更新时间@Column(length=10)protected String syscode=SYSCODE_HDXF; //数据系统编码public Date getCreateTime() {return createTime;}public boolean isHistory() {return history;}public String getCreateIp() {return createIp;}public int getValid() {return valid;}public Date getLastUpdateDate() {return lastUpdateDate;}public String getSyscode() {return syscode;}protected ValueObjectEntity() {super();}@Transientpublic boolean isValidEntity(){return this.getValid()==1;}public void updateValid(int valid){this.valid = valid;}}
@MappedSuperclass
public abstract class IEntity {@Id@Column(length=100)@GeneratedValue(generator="uuidkey")@GenericGenerator(name="uuidkey", strategy = "com.xysd.common.utils.BaseIDGenerator")protected String id;public String getId() {return this.id;}/*** 对比俩个实体是否是同一个*/public boolean compareObject(IEntity other) {return other != null && new EqualsBuilder().append(this.id, other.getId()).isEquals();}}
public class BaseIDGenerator implements IdentifierGenerator {private static AutoIncrementIdUtil autoIncrementIdUtil;public static void registAutoIncrementIdUtil(AutoIncrementIdUtil autoIncrementIdUtil){BaseIDGenerator.autoIncrementIdUtil = autoIncrementIdUtil;}@Overridepublic Serializable generate(SharedSessionContractImplementor arg0,Object o) throws HibernateException {if(o instanceof NeedAutoIncrementId){NeedAutoIncrementId entity = (NeedAutoIncrementId) o;String id = entity.obtainId();if(!StringUtils.isEmpty(id)){entity.initId(id);}else {id = autoIncrementIdUtil.getId(entity.getClass().getSimpleName(), entity.obtainParentId(),entity.obtainLength(), entity.obtainSeparator());entity.initId(id);}return id;}if(o instanceof IEntity){//允许自己指定IDIEntity be = (IEntity)o;if(StringUtils.isNotBlank(be.getId())){return be.getId();}}return Utils.getUUID("");}
}
接口
@ApiOperation(value="日历管理查看",httpMethod="GET")@ApiImplicitParams({@ApiImplicitParam(name="year",value="年份",required=true),@ApiImplicitParam(name="month",value="月份",required=true)})@RequestMapping(value = "/dates/list", method = RequestMethod.GET)public String getDates(@RequestParam int year, @RequestParam int month, HttpServletRequest hreq) {String weeks = myService.getDates(year,month);return weeks;}}
Service服务及封装数据
@Service
public class MyService {@Autowiredprivate DateRecRepositoryHibernate dateRecRepositoryHibernate;@PostConstructpublic void init(){//加载国家法定节假日HolidayUtils.getAllHoliday(CalendarUtils.getCurrentYear());Map<String, OtherData> dateToOtherData = HolidayUtils.dateToOtherData;List<Holiday> holidays = this.dateRecRepositoryHibernate.getHolidays();if (CollectionUtils.isNotEmpty(holidays)) {for (Holiday holiday : holidays) {HolidayUtils.dateToOtherData.put(CalendarUtils.toString(holiday.getHolidayDate(), "yyyy-MM-dd"), holiday.getExAttr());}} else {for (Map.Entry<String, OtherData> entry : dateToOtherData.entrySet()) {Holiday h = new Holiday(CalendarUtils.parseDateStrToDate(entry.getKey(), "yyyy-MM-dd"));h.addAttrs(entry.getValue());this.dateRecRepositoryHibernate.createOrUpdateHoliday(h);}}}public String getDates(int year, int month) {//要返回前端展示使用List<WeekDTO> weeks = new ArrayList<WeekDTO>();//获取year年month月的第一天Date monthBegin = CalendarUtils.getMonthBeginByYearAndMonth(year, month);//获取year年month月的最后一天Date monthEnd = CalendarUtils.getMonthEndByYearAndMonth(year, month);WeekValObj wo = CalendarUtils.getWeekValObjByDateOfYear(monthBegin);//获取year年month月的第一天是这一年中第几周int weekNumOfMonthBegin = wo.getWeek();//selectYear就是yearint selectedYear = wo.getYear();Map<String, DateDTO> allDates = new HashMap<String, DateDTO>();List<String> dates = new ArrayList<String>();int weekNum = 7;for (int k = 0; k < weekNum; k++) {//获取selectyear年总共有几周int maxWeekOfYear = CalendarUtils.getMaxWeekCountByYear(selectedYear);//获取selectedYear年第weekNumOfMonthBegin周的第一天日期Date weekBegin = CalendarUtils.getWeekBeginByYearAndWeek(selectedYear, weekNumOfMonthBegin);List<DateDTO> weekDates = new ArrayList<DateDTO>();if (weekBegin == null) {//如果没有获取到 则默认为year+1年的第一周的第一天日期weekBegin = CalendarUtils.getWeekBeginByYearAndWeek(year + 1, 1);}if (weekBegin != null && weekBegin.getTime() < monthEnd.getTime()) {for (int i = 0; i < 7; i++) {//开始取第weekNumOfMonthBegin周的第i天Date d = DateUtils.addDays(weekBegin, i);String type = null;if (StringUtils.isNotBlank(HolidayUtils.isHoliday(d))) {type = HolidayUtils.isHoliday(d);} else {type = DateRec.DATE_TYPE_WORK;if (i >= 5) {type = DateRec.DATE_TYPE_WEEKEND;}}//是否要展示boolean display = d.getTime() >= monthBegin.getTime() && d.getTime() <= monthEnd.getTime();String dateStr = CalendarUtils.toString(d, "yyyy-MM-dd");DateDTO dateDTO = new DateDTO(dateStr, type, display);weekDates.add(dateDTO);allDates.put(dateDTO.getDate(), dateDTO);}weeks.add(new WeekDTO(year, weekNumOfMonthBegin, weekDates));}if (weekNumOfMonthBegin >= maxWeekOfYear) {selectedYear++;weekNumOfMonthBegin = 1;} else {weekNumOfMonthBegin++;}}dates.addAll(allDates.keySet());Map<String, Object> params = new HashMap<>();params.put("dates", dates);List<DateRec> existedDateRecs = this.dateRecRepositoryHibernate.getDateRecBy(params);for (DateRec drec : existedDateRecs) {//已存在的DateDTO dto = allDates.remove(drec.getId());if (dto != null) {dto.setDateType(drec.getDateType());}}for (DateDTO dto : allDates.values()) {//需要创建的DateRec drec = new DateRec(dto.getDate(),dto.getDateType(), CalendarUtils.parseDateStrToDate(dto.getDate(), "yyyy-MM-dd"));this.dateRecRepositoryHibernate.createOrUpdateDateRec(drec);}return JsonConverter.toJsonStr(weeks);}}
数据基础层
@Repository
public class DateRecRepositoryHibernate extends JpaHibernateRepository {public void createOrUpdateDateRec(DateRec dateRec){this.getSession().saveOrUpdate(dateRec);}public List<DateRec> getDateRecBy(Map<String,Object> params){StringBuffer sql = new StringBuffer();sql.append(" select id from t_daterec where valid = 1 ");if (params.get("ids") != null){sql.append(" and id in (:ids) ");}if (params.get("dates") != null){sql.append(" and date in (:dates) ");}if (params.get("dateTypes") != null){sql.append(" and date_type in (:dateTypes) ");}List<String> ids = this.createSQLQueryByMapParams(sql.toString(), params).list();if (CollectionUtils.isEmpty(ids)) return new ArrayList<>();List<DateRec> recs = this.findByOrderedIds(DateRec.class, ids);if (recs == null) return new ArrayList<>();return recs;}public void createOrUpdateHoliday(Holiday holiday){this.getSession().saveOrUpdate(holiday);}public List<Holiday> getHolidays(){String sql = "select d from " + Holiday.class.getName() + " d where d.holidayDate >= : begin and d.holidayDate <= :end ";List<Holiday> list = this.createHQLQueryByMapParams(Holiday.class, sql, Utils.buildMap("begin", CalendarUtils.getCurrentYearBeginDate(), "end", CalendarUtils.getCurrentYearEndDate())).list();if (list == null) list = new ArrayList<>();return list;}
}
请求返回值
[{"year": 2024,"weekNum": 5,"dates": [{"date": "2024-01-29","dateType": "work","display": false},{"date": "2024-01-30","dateType": "work","display": false},{"date": "2024-01-31","dateType": "work","display": false},{"date": "2024-02-01","dateType": "work","display": true},{"date": "2024-02-02","dateType": "work","display": true},{"date": "2024-02-03","dateType": "weekend","display": true},{"date": "2024-02-04","dateType": "weekend","display": true}]},{"year": 2024,"weekNum": 6,"dates": [{"date": "2024-02-05","dateType": "work","display": true},{"date": "2024-02-06","dateType": "work","display": true},{"date": "2024-02-07","dateType": "work","display": true},{"date": "2024-02-08","dateType": "work","display": true},{"date": "2024-02-09","dateType": "work","display": true},{"date": "2024-02-10","dateType": "weekend","display": true},{"date": "2024-02-11","dateType": "weekend","display": true}]},{"year": 2024,"weekNum": 7,"dates": [{"date": "2024-02-12","dateType": "work","display": true},{"date": "2024-02-13","dateType": "work","display": true},{"date": "2024-02-14","dateType": "work","display": true},{"date": "2024-02-15","dateType": "work","display": true},{"date": "2024-02-16","dateType": "work","display": true},{"date": "2024-02-17","dateType": "weekend","display": true},{"date": "2024-02-18","dateType": "weekend","display": true}]},{"year": 2024,"weekNum": 8,"dates": [{"date": "2024-02-19","dateType": "work","display": true},{"date": "2024-02-20","dateType": "work","display": true},{"date": "2024-02-21","dateType": "work","display": true},{"date": "2024-02-22","dateType": "work","display": true},{"date": "2024-02-23","dateType": "work","display": true},{"date": "2024-02-24","dateType": "weekend","display": true},{"date": "2024-02-25","dateType": "weekend","display": true}]},{"year": 2024,"weekNum": 9,"dates": [{"date": "2024-02-26","dateType": "work","display": true},{"date": "2024-02-27","dateType": "work","display": true},{"date": "2024-02-28","dateType": "work","display": true},{"date": "2024-02-29","dateType": "work","display": true},{"date": "2024-03-01","dateType": "work","display": false},{"date": "2024-03-02","dateType": "weekend","display": false},{"date": "2024-03-03","dateType": "weekend","display": false}]}
]
相关文章:
项目中日历管理学习使用
一些项目中会有日历或日期设置,最基本的会显示工作日,休息日,节假日等等,下面就是基于项目中的日历管理功能,要显示工作日,休息日,节假日 效果图 获取国家法定节假日工具类 public class Holi…...
【单片机】使用AD2S1210旋变芯片读取转子位置和速度
历时十天的反复调试,终于跑通了。只能说第一次做这种小工程确实缺乏经验,跟书本上学的还是有些出入。做下记录,方便后面来查看。 0. 实验要求 基于STM32单片机,使用AD2S1210旋变芯片读取电机转子位置和速度。 硬件设施&#x…...
EasyExcel实现导出图片到excel
pom依赖: <dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId><version>3.1.0</version> </dependency> 实体类: package com.aicut.monitor.vo;import com.aicut.monit…...
Cybellum—信息安全测试工具
产品概述 由于软件和数据在汽车上的使用越来越多,汽车越来越“智能化”,汽车行业面临着重大的信息安全挑战。2021年8月,ISO/SAE 21434正式发布,标准中对汽车的信息安全提出了规范化的要求,汽车信息安全不容忽视。 Cyb…...
六、Kotlin 类型进阶
1. 类的构造器 & init 代码块 1.1 主构造器 & 副构造器在使用时的注意事项 & 注解 JvmOverloads 推荐在类定义时为类提供一个主构造器; 在为类提供了主构造器的情况下,当再定义其他的副构造器时,要求副构造器必须调用到主构造器…...
Chrome 浏览器插件 runtime 字段解析
运行时 runtime 使用 chrome.runtime API 检索 Service Worker,返回有关 manifest.json 的详细信息监听和响应应用或扩展程序生命周期中的事件还可以使用此 API 将网址的相对路径转换为完整的一个 URL 一、权限 Runtime API 上的大多数方法都不需要任何权限 但是…...
七分钟交友匿名聊天室源码
多人在线聊天交友工具,无需注册即可畅所欲言!你也可以放心讲述自己的故事,说出自己的秘密,因为谁也不知道对方是谁。 运行说明: 安装依赖项:npm install 启动:node app.js 运行:直接…...
Aleo项目详细介绍-一个兼顾隐私和可编程性的隐私公链
Aleo上线在即,整理一篇项目的详细介绍,喜欢的收藏。有计划做aleo节点的可交流。 一、项目简介 Aleo 最初是在 2016 年构思的,旨在研究可编程零知识。公司由 Howard Wu、Michael Beller、Collin Chin 和 Raymond Chu 于 2019 年正式成立。 …...
qt学习:实战 http请求获取qq的吉凶
目录 利用的api是 聚合数据 的qq号码测吉凶 编程步骤 配置ui界面 添加头文件,定义网络管理者和http响应槽函数 在界面的构造函数里创建管理者对象,关联http响应槽函数 实现按钮点击事件 实现槽函数 效果 利用的api是 聚合数据 的qq号码测吉凶 先…...
【NodeJS JS】动态加载字体的各方式及注意事项;
首先加载字体这个需求基本只存在于非系统字体,系统已有字体不需要加载即可直接使用; 方案1:创建 style 标签,写入 font-face{font-family: xxx;src: url(xxx)} 等相关字体样式;将style标签添加到body里;方…...
每次请求sessionid变化【SpringBoot+Vue】
引言:花了一晚上的时间,终于把问题解决了,一开始后端做完后,用apifox所有接口测试都是可以的,但当前端跑起来后发现接收不到后端的数据。 当我写完前后端,主页面和获取当前页面信息接口后,配置了cros注解 CrossOrigin…...
勤学苦练“prompts“,如沐春风“CodeArts Snap“
前言 CodeArts Snap 上手一段时间了,对编程很有帮助。但是,感觉代码编写的不尽人意。 我因此也感到困惑,想要一份完整的 CodeArts Snap 手册看看。 就在我感觉仿佛"独自彷徨在这条悠长、悠长又寂寥的雨巷"时,我听了大…...
springboot(ssm线上医院挂号系统 在线挂号预约系统Java系统
springboot(ssm线上医院挂号系统 在线挂号预约系统Java系统 开发语言:Java 框架:springboot(可改ssm) vue JDK版本:JDK1.8(或11) 服务器:tomcat 数据库:mysql 5.7&a…...
万界星空科技可视化数据大屏的作用
随着科技的不断发展和进步,当前各种数据化的设备也是如同雨后春笋般冒了出来,并且其可以说是给我们带来了极大的便利的。在这其中,数据大屏就是非常具有代表性的一个例子。 数据大屏的主要作用包括: 数据分析:数据大屏…...
5月22日比特币披萨日,今天你吃披萨了吗?
比特币披萨日 1. Laszlo Hanyecz2. 最贵披萨诞生记3. 梭哈买披萨4. 未完待续 2010年5月22日,美国佛罗里达州的程序员Laszlo Hanyecz(拉兹洛哈涅克斯)用10000个比特币购买了棒约翰(Papa Johns)比萨店一个价值25美元的奶…...
内网穿透、远程桌面、VPN的理解
最近在研究内网穿透的相关技术,然后回想起一些相关的技术,比如说要远程桌面公司的电脑,VPN连入内网等。然后想着在此处记录一下,各个的区别,这个纯粹是从技术层面的理解,此处不详细解释怎么去实现或者用什么…...
如何发布自己的npm包,详细流程
发布自己的npm包需要遵循以下具体流程: 创建npm账号:打开浏览器,访问npm官网,注册一个npm账号。 创建项目文件夹并进入:在本地创建一个项目文件夹,并使用终端进入该文件夹。 初始化包信息管理文件&#x…...
【书生·浦语大模型实战】“PDF阅读小助手”学习笔记
1 参考资料 《新版本Lmdeploy量化手册与评测》 2 项目资料 项目主页:【tcexeexe / pdf阅读小助手】 3 模型运行测试 在InternStudio平台中选择A100 (1/4)的配置,镜像选择Cuda11.7-conda,可以选择已有的开发机langchain; 3.1…...
用ChatGPT写申请文书写进常春藤联盟?
一年前,ChatGPT 的发布引发了教育工作者的恐慌。现在,各大学正值大学申请季,担心学生会利用人工智能工具伪造入学论文。但是,聊天机器人创作的论文足以骗过大学招生顾问吗? ChatGPT简介 ChatGPT,全称聊天生…...
uni-app导航栏自定义“返回按钮”多种方法设置原生返回
方法一、 导航栏返回按钮事件 onBackPress监听页面返回,返回 event = {from:backbutton、 navigateBack} ,backbutton 表示来源是左上角返回按钮或 android 返回键;navigateBack表示来源是 uni.navigateBack;详见app、H5、支付宝小程序onBackPress() { this.back1(); …...
【kubernets】kubelet证书单独更新
前言说明 接上一篇文章https://blog.csdn.net/margu_168/article/details/132584109关于kubernets中的证书管理。本篇文章将单独说明一下kubelet的证书更新。在1.19.16版本中,默认情况下使用 kubeadm alpha certs renew all 不能更新kubelet的证书,其他…...
【STM32】STM32学习笔记-硬件SPI读写W25Q64(40)
00. 目录 文章目录 00. 目录01. SPI简介02. W25Q64简介03. SPI相关API3.1 SPI_Init3.2 SPI_Cmd3.3 SPI_I2S_SendData3.4 SPI_I2S_ReceiveData3.5 SPI_I2S_GetFlagStatus3.6 SPI_I2S_ClearFlag3.7 SPI_InitTypeDef 04. 硬件SPI读写W25Q64接线图05. 硬件SPI读写W25Q64示例06. 程序…...
防御保护---安全策略
文章目录 目录 一.安全策略概述 概述: 安全策略的作用: 安全策略与传统防火墙的区别 二.案例分析 练习 一.安全策略概述 概述: 防火墙安全策略的作用在于加强网络系统的安全性,保护网络免受恶意攻击、非法访问和数据泄露的威胁。…...
RustDesk私有化部署,自建远程桌面搭建教程
以linux操作系统为例: 解压安装 # 使用wget进行下载1.1.8-2版本(最新版本可以看上述发布地址) wget https://github.com/rustdesk/rustdesk-server/releases/download/1.1.8-2/rustdesk-server-linux-amd64.zip # 使用unzip解压 unzip rust…...
Flutter环境搭建【win10虚拟机】+夜神模拟器【主机】
Flutter环境搭建 0 Android Studio 与 VS Code 资源消耗对比1 系统配置要求2 Flutter SDK2.1 获取 Flutter SDK2.2 解压2.3 更新 path 环境变量Dart SDK 要兼容 Flutter SDK双击 flutter_console.bat 输入 flutter doctor 检测环境 3 VS code 与插件3.1 安装 VS code3.2 安装 f…...
【数据结构和算法】种花问题
其他系列文章导航 Java基础合集数据结构与算法合集 设计模式合集 多线程合集 分布式合集 ES合集 文章目录 其他系列文章导航 文章目录 前言 一、题目描述 二、题解 2.1 方法一:贪心 2.2 贪心算法一般思路 三、代码 3.1 方法一…...
Vite+Electron快速构建一个VUE3桌面应用(一)
一. 简介 首先,介绍下vite和Electron。 Vite是一种新型前端构建工具,能够显著提升前端开发体验。Electron是一个使用 JavaScript、HTML 和 CSS 构建桌面应用程序的框架。 嵌入Chromium和Node.js到二进制的 Electron 允许您保持一个 JavaScript 代码代码…...
第二百八十九回
文章目录 1. 概念介绍2. 方法与细节2.1 实现方法2.2 具体细节 3. 示例代码4. 内容总结 我们在上一章回中介绍了"如何混合选择多个图片和视频文件"相关的内容,本章回中将介绍如何通过相机获取视频文件.闲话休提,让我们一起Talk Flutter吧。 1. …...
Likeshop多商户商城源码系统,支持二开
在电商行业高速发展的当下,拥有一套功能强大、易于操作的开源商城系统至关重要。Likeshop多商户商城系统正是这样一款集H5、小程序、独立APP于一体的开源电商解决方案,助力商家实现智能营销。 一、产品简介 Likeshop多商户商城系统为商家提供了丰富的营…...
Excel:将截面数据转换成面板数据
原始截面数据如下: 步骤:数据——自表格/区域 点击确定,出现下图: 然后,在这个界面选择:“转换”——“逆透视列”下选择逆透视其他列。会出现面板数据形式。 然后,点击“主页”——关闭并上载即…...
建设微信商城网站制作/典型的口碑营销案例
线性判别 文章目录线性判别1 线性判别与非线性判别2 样本集的线性可分性3 非线性判别问题转化成线性判别问题4 多分类线性判别4.1 绝对可分方式4.2 两两可分方式4.3 最大值可分方式5 线性判别函数的几何意义1 线性判别与非线性判别 我们知道,要实现模式识别&#x…...
高新区建网站外包/游戏广告推广平台
正题 Portal 很容易想到如果最小k-1条边之和>最大那条边,那么就可以构成一个k边形。 否则显然构不成一个多边形。 那么很容易可以想到Dp:表示用j条边构成总长度为i的组合有多少种,转移显然,时间复杂度就是,可以获得…...
php网站建设流程/西安网络seo公司
往期精选● 架构师高并发高性能分布式教程(4000G)● 39阶段精品云计算大数据实战视频教程● 互联网技术干货视频教程大全【菜单为准】● 2017年8月最新Intellij IDEA全套视频教程● 程序员如何制作高质量的简历【视频简历】● 两套大型电商实战项目 ● 200本经典编程相关…...
石家庄市住建局官网/seo搜索如何优化
一、准备工作 虚拟机软件 VMware-14;CentOS7_x64系统镜像;二、创建虚拟机 进入WMware主界面,选择“文件”->“新建虚拟机”选项;进入虚拟机安装向导,选择“自定义(高级)”;硬件兼容性,选择WMware当前所对应的版本&a…...
如何自己做网站发布到服务器上面/app开发自学教程
最近在看数据结构的知识,看到好多代码都是用c写的,就想试试用java实现,这里是二叉树的实现和层次遍历和先序遍历,因为中序和后序算法和先序类似,在这里就不写了,亲测可用。package testfile;import java.io…...
湛江企业自助建站/买卖交易网
1.查看当前的AWR保存策略select * from dba_hist_wr_control; DBID,SNAP_INTERVAL,RETENTION,TOPNSQL860524039,00 01:00:00.000000,07 00:00:00.000000,DEFAULT以上结果表示,每小时产生一个SNAPSHOT,保留7天2.调整AWR配置AWR配置都是通过dbms_workload_repository包…...