获取当前年所有工作日与非工作日列表

public list<SysWorkingDay > add(year){
          StringBuilder stringBuilder = new StringBuilder(year);
            stringBuilder.append("-01-01");
            LocalDate beginDateTime = LocalDate.parse(stringBuilder.toString(),          DateTimeFormatter.ofPattern("yyyy-MM-dd"));
            List<SysWorkingDay> dateList = new ArrayList<>();
            SysWorkingDay entity = null;
            for (int i = 1; i <= beginDateTime.lengthOfYear(); i++) {

                LocalDate date = beginDateTime.withDayOfYear(i);  //当前年的第i天
                String state=date.getDayOfWeek().getValue() > 5 ? "0": "1";  //判断是否是工作日
                entity = new SysWorkingDay();
                entity.setDateTimeKey(date);
                entity.setYear(date.getYear());
                entity.setMonth(date.getMonthValue());
                entity.setDay(date.getDayOfMonth());
                entity.setIsWokingDay(state);
                entity.setModificationRecord(1);
                entity.setUpdator(systemUser.getUserGuid());
                entity.setUpdatorName(systemUser.getUserName());
                entity.setUpdatorTime(new Date());
                dateList.add(entity);
            }
            return dateList 
}
                
public class SysWorkingDay implements Serializable {

    private static final long serialVersionUID=1L;

    /**
     * 工作日(DateTimeKey)
     */
      @TableId(value = "date_time_key")
    private LocalDate dateTimeKey;

    /**
     * 所属年(Year)
     */
    private Integer year;

    /**
     * 所属月(Month)
     */
    private Integer month;

    /**
     * 所属日(Day)
     */
    private Integer day;

    /**
     * 是否是工作日(IsWorkingDay):1-是;0-不是
     */
    private String isWokingDay;

    /**
     * 修改记录(status)1-添加;2-排除
     */
    private Integer modificationRecord;

    /**
     * 修改人GUID(CreatorGuid)
     */
    private String updator;

    /**
     * 修改人姓名(CreatorName)
     */
    private String updatorName;

    /**
     * 修改时间
     */
    private Date updatorTime;


}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值