|
@@ -1,31 +1,16 @@
|
|
|
package com.persagy.calendar.handle;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Iterator;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.hutool.core.date.DateField;
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
+import cn.hutool.core.date.DateUnit;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.persagy.calendar.constant.WorkCalendarConstant;
|
|
|
import com.persagy.calendar.pojo.dto.WorkCalendar;
|
|
|
import com.persagy.calendar.pojo.dto.WorkCalendarDate;
|
|
|
import com.persagy.calendar.pojo.dto.WorkCalendarRule;
|
|
|
-import com.persagy.calendar.pojo.vo.CalendarDateResult;
|
|
|
-import com.persagy.calendar.pojo.vo.CustomCalendarVO;
|
|
|
-import com.persagy.calendar.pojo.vo.WorkCalendarDateCreateVO;
|
|
|
-import com.persagy.calendar.pojo.vo.WorkCalendarDateQueryVO;
|
|
|
-import com.persagy.calendar.pojo.vo.WorkCalendarDateUpdateVO;
|
|
|
-import com.persagy.calendar.pojo.vo.WorkCalendarMoreDateCreateVO;
|
|
|
+import com.persagy.calendar.pojo.vo.*;
|
|
|
import com.persagy.calendar.service.IWorkCalendarDateService;
|
|
|
import com.persagy.calendar.service.IWorkCalendarDictService;
|
|
|
import com.persagy.calendar.service.IWorkCalendarRuleService;
|
|
@@ -35,12 +20,14 @@ import com.persagy.common.exception.BusinessException;
|
|
|
import com.persagy.common.utils.DateUtil;
|
|
|
import com.persagy.common.utils.IdGenerator;
|
|
|
import com.persagy.common.utils.StringUtil;
|
|
|
-
|
|
|
-import cn.hutool.core.collection.CollectionUtil;
|
|
|
-import cn.hutool.core.date.DateField;
|
|
|
-import cn.hutool.core.date.DateTime;
|
|
|
-import cn.hutool.core.date.DateUnit;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @version
|
|
@@ -69,16 +56,15 @@ public class WorkCalendarDateHandler {
|
|
|
* 创建工作历作息时间信息,先删除在创建
|
|
|
*
|
|
|
* @param workCalendarDates
|
|
|
- * @param workDateStart 不能为空
|
|
|
- * @param workDateEnd 不能为空
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public boolean createCalendarDateByDelete(List<WorkCalendarDate> workCalendarDates, String workDateStart, String workDateEnd) {
|
|
|
+ public boolean createCalendarDateByDelete(List<WorkCalendarDate> workCalendarDates, WorkCalendarDateQueryVO queryVO) {
|
|
|
// 1.防止重复执行,优先删除从今日开始的非自定义的作息时间信息
|
|
|
QueryWrapper<WorkCalendarDate> queryWrapper = new WorkCalendarDate.Builder().createQueryWrapper()
|
|
|
- .customFlagEq(WorkCalendarConstant.CUSTOM_CALENDAR_DATE_NO)
|
|
|
- .workDateGe(workDateStart).workDateLe(workDateEnd).builderQueryWrapper();
|
|
|
+ .groupCodeEq(queryVO.getGroupCode()).projectIdEq(queryVO.getProjectId(), null)
|
|
|
+ .workDateGe(queryVO.getWorkDateStart()).workDateLe(queryVO.getWorkDateEnd())
|
|
|
+ .customFlagEq(WorkCalendarConstant.CUSTOM_CALENDAR_DATE_NO).builderQueryWrapper();
|
|
|
this.workCalendarDateService.remove(queryWrapper);
|
|
|
|
|
|
// 2.信息插入
|
|
@@ -223,14 +209,12 @@ public class WorkCalendarDateHandler {
|
|
|
|
|
|
/**
|
|
|
* 自定义与规则的进行判断,存在的自定义的将不再进行插入
|
|
|
- *
|
|
|
- * @param queryVO
|
|
|
+ *
|
|
|
* @param customDateList
|
|
|
* @param calendarDateMap
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<WorkCalendarDate> handleParseCalendarRule(WorkCalendarDateQueryVO queryVO, List<WorkCalendarDate> customDateList,
|
|
|
- Map<String, List<WorkCalendarDate>> calendarDateMap) {
|
|
|
+ public List<WorkCalendarDate> handleParseCalendarRule(List<WorkCalendarDate> customDateList, Map<String, List<WorkCalendarDate>> calendarDateMap) {
|
|
|
List<WorkCalendarDate> resultList = new ArrayList<WorkCalendarDate>();
|
|
|
|
|
|
Set<String> keySet = calendarDateMap.keySet();
|
|
@@ -417,12 +401,13 @@ public class WorkCalendarDateHandler {
|
|
|
* 获取满足条件的所有新版规则信息
|
|
|
* TODO 这里工作历和项目ID不传参,则无影响,若传参了,目前仅支持工作历级别的规则解析
|
|
|
*
|
|
|
- * @param workCalendarDateQueryVO
|
|
|
+ * @param queryVO
|
|
|
* @param dictTypeLevel 0-集团级别,1-项目级别,2-工作历级别,null-默认工作历级别
|
|
|
* @return
|
|
|
*/
|
|
|
public List<WorkCalendarRule> selectWorkCalendarRuleList(WorkCalendarDateQueryVO queryVO, Integer dictTypeLevel) {
|
|
|
- QueryWrapper<WorkCalendarRule> queryWrapper = new WorkCalendarRule.Builder().createQueryWrapper().projectIdEq(queryVO.getProjectId(), dictTypeLevel)
|
|
|
+ QueryWrapper<WorkCalendarRule> queryWrapper = new WorkCalendarRule.Builder().createQueryWrapper()
|
|
|
+ .groupCodeEq(queryVO.getGroupCode()).projectIdEq(queryVO.getProjectId(), dictTypeLevel)
|
|
|
.calendarIdEq(queryVO.getCalendarId(), dictTypeLevel).ruleDateBetween(queryVO.getWorkDateStart(), queryVO.getWorkDateEnd())
|
|
|
.dictTypeEq(queryVO.getDictType()).dictCodeIn(queryVO.getDictCode()).dictTypeIn(queryVO.getDictTypes())
|
|
|
.idEq(queryVO.getRuleId()).delFlagEq(WorkCalendarConstant.WORK_CALENDAR_DEL_FLAG_NOR)
|
|
@@ -437,6 +422,7 @@ public class WorkCalendarDateHandler {
|
|
|
*/
|
|
|
public List<WorkCalendarDate> selectWorkCalendarDateList(WorkCalendarDateQueryVO workCalendarDateQueryVO, String customFlag, Integer dictTypeLevel) {
|
|
|
QueryWrapper<WorkCalendarDate> queryWrapper = new WorkCalendarDate.Builder().createQueryWrapper()
|
|
|
+ .groupCodeEq(workCalendarDateQueryVO.getGroupCode())
|
|
|
.projectIdEq(workCalendarDateQueryVO.getProjectId(), dictTypeLevel).idEq(workCalendarDateQueryVO.getId())
|
|
|
.ruleIdEq(workCalendarDateQueryVO.getRuleId()).calendarIdEq(workCalendarDateQueryVO.getCalendarId(), dictTypeLevel)
|
|
|
.workDateGe(workCalendarDateQueryVO.getWorkDateStart()).workDateLe(workCalendarDateQueryVO.getWorkDateEnd())
|