Commit 9dcf0504 authored by 李秀明's avatar 李秀明

fix(巡检): 任务下发增加superviseOrgCode、superviseOrgName字段

parent f9939d7d
...@@ -168,7 +168,7 @@ public class PlanController extends AbstractBaseController { ...@@ -168,7 +168,7 @@ public class PlanController extends AbstractBaseController {
List<UserDetailsDto> resultList = response.getResult(); List<UserDetailsDto> resultList = response.getResult();
for (UserDetailsDto udd : resultList) { for (UserDetailsDto udd : resultList) {
userIdSB.append(",").append(udd.getUserId()); userIdSB.append(",").append(udd.getUserId());
userDeptSB.append(",").append(udd.getUserId()).append("@").append(udd.getUnitCode()); userDeptSB.append(",").append(udd.getUserId()).append("@").append(udd.getSuperviseOrgCode()).append("@").append(udd.getSuperviseOrgName());
userNameSB.append(",").append(udd.getUserName()); userNameSB.append(",").append(udd.getUserName());
} }
} }
......
...@@ -25,10 +25,18 @@ public class UserDetailsDto { ...@@ -25,10 +25,18 @@ public class UserDetailsDto {
*/ */
private String unitName; private String unitName;
/** /**
* 企业名称 * 企业Code
*/ */
private String unitCode; private String unitCode;
/** /**
* 组织名称
*/
private String superviseOrgName;
/**
* 组织Code
*/
private String superviseOrgCode;
/**
* 用户id * 用户id
*/ */
private String userId; private String userId;
......
...@@ -29,9 +29,9 @@ public class PlanTaskUtil { ...@@ -29,9 +29,9 @@ public class PlanTaskUtil {
*/ */
public static CalDateVo reGenPlanTaskData(Plan plan,String strBginDate,String strEndDate){ public static CalDateVo reGenPlanTaskData(Plan plan,String strBginDate,String strEndDate){
CalDateVo vo = CalDateData(strBginDate,strEndDate,plan); CalDateVo vo = CalDateData(strBginDate,strEndDate,plan);
return vo; return vo;
} }
/** /**
* 重做数据生成 * 重做数据生成
* @param strBginDate 前端上送重做开始日期 * @param strBginDate 前端上送重做开始日期
...@@ -61,7 +61,7 @@ public class PlanTaskUtil { ...@@ -61,7 +61,7 @@ public class PlanTaskUtil {
log.error(e.getMessage(),e); log.error(e.getMessage(),e);
throw new YeeException("日期转换失败"); throw new YeeException("日期转换失败");
} }
//日期区间判断 //日期区间判断
if(endDate.before(planBegin)){//计划未开始 if(endDate.before(planBegin)){//计划未开始
return null; return null;
...@@ -94,7 +94,7 @@ public class PlanTaskUtil { ...@@ -94,7 +94,7 @@ public class PlanTaskUtil {
} }
vo.setIsGenData(flag); vo.setIsGenData(flag);
return vo; return vo;
} }
/** /**
* 根据计划分类及计划类型校验合法性 * 根据计划分类及计划类型校验合法性
...@@ -144,7 +144,7 @@ public static Boolean checkMustFile(Plan plan) { ...@@ -144,7 +144,7 @@ public static Boolean checkMustFile(Plan plan) {
flag = false; flag = false;
} }
}else if(XJConstant.PLAN_TYPE_YEAR.equals(planType)){ }else if(XJConstant.PLAN_TYPE_YEAR.equals(planType)){
if(exeInt <= 0 || exeRate <=0){ if(exeInt <= 0 || exeRate <=0){
flag = false; flag = false;
} }
...@@ -156,33 +156,33 @@ public static Boolean checkMustFile(Plan plan) { ...@@ -156,33 +156,33 @@ public static Boolean checkMustFile(Plan plan) {
} }
/** /**
* 根据频率计算出开始日期及结束日期 * 根据频率计算出开始日期及结束日期
* @param strPlanDegin * @param strPlanDegin
* @param exeInt * @param exeInt
* @return * @return
*/ */
public static List<HashMap<String, String>> changeRateToDate(String strPlanDegin, int exeRate) { public static List<HashMap<String, String>> changeRateToDate(String strPlanDegin, int exeRate) {
List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
String strYear = strPlanDegin.substring(0, 4); String strYear = strPlanDegin.substring(0, 4);
int period = 12/exeRate;//频率的间隔 int period = 12/exeRate;//频率的间隔
for(int i=1;i<=exeRate;i++){ for(int i=1;i<=exeRate;i++){
HashMap<String, String> dateMap = new HashMap<String, String>(); HashMap<String, String> dateMap = new HashMap<String, String>();
int beginMonth = 1+(i-1)*period;//开始月 int beginMonth = 1+(i-1)*period;//开始月
int endMonth = beginMonth + period-1; int endMonth = beginMonth + period-1;
String tempBegin = "0" + beginMonth; String tempBegin = "0" + beginMonth;
String tempEnd = "0" + endMonth; String tempEnd = "0" + endMonth;
String strBeginMonth = tempBegin.substring(tempBegin.length()-2,tempBegin.length()); String strBeginMonth = tempBegin.substring(tempBegin.length()-2,tempBegin.length());
String strEndMonth= tempEnd.substring(tempEnd.length()-2,tempEnd.length()); String strEndMonth= tempEnd.substring(tempEnd.length()-2,tempEnd.length());
dateMap.put("begin_date", DateUtil.getStartMonthDate(strYear + strBeginMonth,"yyyy-MM-dd")); dateMap.put("begin_date", DateUtil.getStartMonthDate(strYear + strBeginMonth,"yyyy-MM-dd"));
dateMap.put("end_date", DateUtil.getEndMonthDate(strYear + strEndMonth,"yyyy-MM-dd")); dateMap.put("end_date", DateUtil.getEndMonthDate(strYear + strEndMonth,"yyyy-MM-dd"));
list.add(dateMap); list.add(dateMap);
} }
return list; return list;
} }
/** /**
* 计算时间间隔循环次数(以开始时间做间隔开始点) * 计算时间间隔循环次数(以开始时间做间隔开始点)
* @param dayBegin 开始日期 * @param dayBegin 开始日期
* @param dayEnd 结束日期 * @param dayEnd 结束日期
* @param duration 时长(单位分钟) * @param duration 时长(单位分钟)
* @param inter 间隔 * @param inter 间隔
* @param error 误差(单位分钟) * @param error 误差(单位分钟)
...@@ -221,7 +221,7 @@ public static List<HashMap<String, Date>> getLast6Time(Date dayBegin, Date dayEn ...@@ -221,7 +221,7 @@ public static List<HashMap<String, Date>> getLast6Time(Date dayBegin, Date dayEn
* @return * @return
*/ */
public static Date getAddStarDate(Date dayBegin, int duration, int inter, String unit, int i, int error) { public static Date getAddStarDate(Date dayBegin, int duration, int inter, String unit, int i, int error) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(dayBegin); calendar.setTime(dayBegin);
for (int j = 0; j < i; j++) { for (int j = 0; j < i; j++) {
if (XJConstant.INTERVAL_UNIT_HOUR.equals(unit)) { if (XJConstant.INTERVAL_UNIT_HOUR.equals(unit)) {
...@@ -243,11 +243,11 @@ public static Date getAddStarDate(Date dayBegin, int duration, int inter, String ...@@ -243,11 +243,11 @@ public static Date getAddStarDate(Date dayBegin, int duration, int inter, String
* @return * @return
*/ */
public static Date getAddEndDateStr(Date dayDegin, int duration, int error) { public static Date getAddEndDateStr(Date dayDegin, int duration, int error) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(dayDegin); calendar.setTime(dayDegin);
calendar.add(Calendar.MINUTE,duration); calendar.add(Calendar.MINUTE,duration);
calendar.add(Calendar.MINUTE, 2*error); calendar.add(Calendar.MINUTE, 2*error);
return calendar.getTime(); return calendar.getTime();
} }
/** /**
* 生成执行主表数据(开始日期,结束日期) * 生成执行主表数据(开始日期,结束日期)
...@@ -292,7 +292,7 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str ...@@ -292,7 +292,7 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str
String[] strArr = (!StringUtil.isNotEmpty(whatDay))?null: whatDay.split(",");//哪一天执行 String[] strArr = (!StringUtil.isNotEmpty(whatDay))?null: whatDay.split(",");//哪一天执行
while(calDate.getTime()<= exeBeginDate.getTime() || calDate.getTime() <= exeEndDate.getTime() ){ while(calDate.getTime()<= exeBeginDate.getTime() || calDate.getTime() <= exeEndDate.getTime() ){
HashMap<String, Date> dateMap = new HashMap<String, Date>(); HashMap<String, Date> dateMap = new HashMap<String, Date>();
if(XJConstant.PLAN_TYPE_DAY.equals(planType)){//日计划 if(XJConstant.PLAN_TYPE_DAY.equals(planType)){//日计划
if(calDate.getTime() >= exeBeginDate.getTime() && calDate.getTime() <= exeEndDate.getTime()){ if(calDate.getTime() >= exeBeginDate.getTime() && calDate.getTime() <= exeEndDate.getTime()){
dateMap.put("begin_date", calDate); dateMap.put("begin_date", calDate);
dateMap.put("end_date", calDate); dateMap.put("end_date", calDate);
...@@ -304,7 +304,7 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str ...@@ -304,7 +304,7 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str
}else if(XJConstant.PLAN_TYPE_WEEK.equals(planType)){//周计划 }else if(XJConstant.PLAN_TYPE_WEEK.equals(planType)){//周计划
for(String str :strArr){ for(String str :strArr){
HashMap<String, Date> tempMap = new HashMap<String, Date>(); HashMap<String, Date> tempMap = new HashMap<String, Date>();
int inter = Integer.parseInt(str); int inter = Integer.parseInt(str);
calDate = DateUtil.getIntervalDate(weekDate,inter); calDate = DateUtil.getIntervalDate(weekDate,inter);
if(calDate.getTime() >= exeDate.getTime() && (calDate.getTime()>=exeBeginDate.getTime() && calDate.getTime() <= exeEndDate.getTime())){ if(calDate.getTime() >= exeDate.getTime() && (calDate.getTime()>=exeBeginDate.getTime() && calDate.getTime() <= exeEndDate.getTime())){
tempMap.put("begin_date", calDate); tempMap.put("begin_date", calDate);
...@@ -312,7 +312,7 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str ...@@ -312,7 +312,7 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str
tempMap.put("next_gen_date", calDate); tempMap.put("next_gen_date", calDate);
dateList.add(tempMap); dateList.add(tempMap);
} }
} }
init = init + exeInt; init = init + exeInt;
weekDate = DateUtil.getIntervalWeekDate(exeDate,init); weekDate = DateUtil.getIntervalWeekDate(exeDate,init);
}else if(XJConstant.PLAN_TYPE_MONTH.equals(planType)){//月计划 }else if(XJConstant.PLAN_TYPE_MONTH.equals(planType)){//月计划
...@@ -327,14 +327,14 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str ...@@ -327,14 +327,14 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str
init = init + exeInt; init = init + exeInt;
mounthEndDate = DateUtil.getEndMonthDate(exeDate, init); mounthEndDate = DateUtil.getEndMonthDate(exeDate, init);
}else if(XJConstant.MONTH_TYPE_AT.equals(monthType)){//在第几周第几天 }else if(XJConstant.MONTH_TYPE_AT.equals(monthType)){//在第几周第几天
calDate = DateUtil.getIntMonthWeekDate(mounthFirstDate,whatWeek,weekDay) ; calDate = DateUtil.getIntMonthWeekDate(mounthFirstDate,whatWeek,weekDay) ;
if(calDate.getTime() >= exeDate.getTime() && (calDate.getTime()>=exeBeginDate.getTime() && calDate.getTime() <= exeEndDate.getTime())){ if(calDate.getTime() >= exeDate.getTime() && (calDate.getTime()>=exeBeginDate.getTime() && calDate.getTime() <= exeEndDate.getTime())){
dateMap.put("begin_date", calDate); dateMap.put("begin_date", calDate);
dateMap.put("end_date", calDate); dateMap.put("end_date", calDate);
dateMap.put("next_gen_date", calDate); dateMap.put("next_gen_date", calDate);
dateList.add(dateMap); dateList.add(dateMap);
} }
init = init + exeInt; init = init + exeInt;
mounthFirstDate = DateUtil.getIntervalDate(DateUtil.getEndMonthDate(exeDate, init), 1); mounthFirstDate = DateUtil.getIntervalDate(DateUtil.getEndMonthDate(exeDate, init), 1);
} }
} else { } else {
...@@ -345,7 +345,7 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str ...@@ -345,7 +345,7 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str
List<HashMap<String, String>> yearList = new ArrayList<HashMap<String, String>>(); List<HashMap<String, String>> yearList = new ArrayList<HashMap<String, String>>();
while(calDate.getTime()<= exeBeginDate.getTime() || calDate.getTime() <= exeEndDate.getTime() ){ while(calDate.getTime()<= exeBeginDate.getTime() || calDate.getTime() <= exeEndDate.getTime() ){
HashMap<String, Date> dateMap = new HashMap<String, Date>(); HashMap<String, Date> dateMap = new HashMap<String, Date>();
if(XJConstant.PLAN_TYPE_DAY.equals(planType)){//日计划 if(XJConstant.PLAN_TYPE_DAY.equals(planType)){//日计划
if(calDate.getTime() >= exeBeginDate.getTime() && calDate.getTime() <= exeEndDate.getTime()){ if(calDate.getTime() >= exeBeginDate.getTime() && calDate.getTime() <= exeEndDate.getTime()){
dateMap.put("begin_date", calDate); dateMap.put("begin_date", calDate);
dateMap.put("end_date",calDate); dateMap.put("end_date",calDate);
...@@ -362,23 +362,23 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str ...@@ -362,23 +362,23 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str
dateMap.put("end_date", DateUtil.getIntervalDate(weekDate, endNum)); dateMap.put("end_date", DateUtil.getIntervalDate(weekDate, endNum));
dateMap.put("next_gen_date", DateUtil.getIntervalDate(calDate, exeInt * 7 - 1)); dateMap.put("next_gen_date", DateUtil.getIntervalDate(calDate, exeInt * 7 - 1));
dateList.add(dateMap); dateList.add(dateMap);
} }
init = init + exeInt; init = init + exeInt;
weekDate = DateUtil.getIntervalWeekDate(exeDate,init); weekDate = DateUtil.getIntervalWeekDate(exeDate,init);
}else if(XJConstant.PLAN_TYPE_MONTH.equals(planType)){//月计划 }else if(XJConstant.PLAN_TYPE_MONTH.equals(planType)){//月计划
calDate = DateUtil.getIntervalDate(mounthEndDate,1); calDate = DateUtil.getIntervalDate(mounthEndDate,1);
if((calDate.getTime() <= exeBeginDate.getTime() && exeBeginDate.getTime() <= DateUtil.getEndMonthDate(calDate,1).getTime()) if((calDate.getTime() <= exeBeginDate.getTime() && exeBeginDate.getTime() <= DateUtil.getEndMonthDate(calDate,1).getTime())
|| (calDate.getTime() >= exeBeginDate.getTime() && calDate.getTime() <= exeEndDate.getTime())){ || (calDate.getTime() >= exeBeginDate.getTime() && calDate.getTime() <= exeEndDate.getTime())){
dateMap.put("begin_date", calDate); dateMap.put("begin_date", calDate);
dateMap.put("end_date",DateUtil.getEndMonthDate(calDate,1)); dateMap.put("end_date",DateUtil.getEndMonthDate(calDate,1));
dateMap.put("next_gen_date",DateUtil.getEndMonthDate(calDate,1)); dateMap.put("next_gen_date",DateUtil.getEndMonthDate(calDate,1));
dateList.add(dateMap); dateList.add(dateMap);
} }
init = init + 1; init = init + 1;
mounthEndDate = DateUtil.getEndMonthDate(exeDate,init); mounthEndDate = DateUtil.getEndMonthDate(exeDate,init);
}else if(XJConstant.PLAN_TYPE_YEAR.equals(planType)){//年计划 }else if(XJConstant.PLAN_TYPE_YEAR.equals(planType)){//年计划
yearList.clear(); yearList.clear();
yearList = PlanTaskUtil.changeRateToDate(strPlanDegin,exeRate); yearList = PlanTaskUtil.changeRateToDate(strPlanDegin,exeRate);
for(int i=0;i<yearList.size();i++){ for(int i=0;i<yearList.size();i++){
HashMap<String, Date> tempMap = new HashMap<String, Date>(); HashMap<String, Date> tempMap = new HashMap<String, Date>();
String beginDate = yearList.get(i).get("begin_date"); String beginDate = yearList.get(i).get("begin_date");
...@@ -392,7 +392,7 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str ...@@ -392,7 +392,7 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str
} catch (ParseException e) { } catch (ParseException e) {
throw new YeeException("日期格式化失败"); throw new YeeException("日期格式化失败");
} }
if((calDate.getTime() <= exeBeginDate.getTime() && exeBeginDate.getTime() <= dateYear.getTime()) if((calDate.getTime() <= exeBeginDate.getTime() && exeBeginDate.getTime() <= dateYear.getTime())
|| (calDate.getTime() >= exeBeginDate.getTime() && calDate.getTime() <= exeEndDate.getTime())){ || (calDate.getTime() >= exeBeginDate.getTime() && calDate.getTime() <= exeEndDate.getTime())){
tempMap.put("begin_date", calDate); tempMap.put("begin_date", calDate);
tempMap.put("end_date",dateYear); tempMap.put("end_date",dateYear);
...@@ -400,8 +400,8 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str ...@@ -400,8 +400,8 @@ public static List<HashMap<String, Date>> genExeDate(Plan plan, CalDateVo vo,Str
dateList.add(tempMap); dateList.add(tempMap);
}else if(calDate.getTime() > exeEndDate.getTime()){ }else if(calDate.getTime() > exeEndDate.getTime()){
break; break;
} }
} }
init = init + exeInt; init = init + exeInt;
strPlanDegin = DateUtil.getIntervalYearDate(exeDate,init); strPlanDegin = DateUtil.getIntervalYearDate(exeDate,init);
} else { } else {
...@@ -428,7 +428,7 @@ public static List<HashMap<String, Object>> genWholeExeDate(List<HashMap<String, ...@@ -428,7 +428,7 @@ public static List<HashMap<String, Object>> genWholeExeDate(List<HashMap<String,
String planType = plan.getPlanType();//计划类型:日,周,月,年 String planType = plan.getPlanType();//计划类型:日,周,月,年
Date dayBegin = plan.getDayBegin();//开始时间 Date dayBegin = plan.getDayBegin();//开始时间
Date dayEnd = plan.getDayEnd();//结束时间 Date dayEnd = plan.getDayEnd();//结束时间
List<HashMap<String, Object>> timeList = new ArrayList<HashMap<String, Object>>(); List<HashMap<String, Object>> timeList = new ArrayList<HashMap<String, Object>>();
if(XJConstant.FIX_DATE_YES.equals(isFixDate)){ if(XJConstant.FIX_DATE_YES.equals(isFixDate)){
timeList = genTimeByRate(plan,list); timeList = genTimeByRate(plan,list);
}else if (XJConstant.FIX_DATE_NO.equals(isFixDate)) }else if (XJConstant.FIX_DATE_NO.equals(isFixDate))
...@@ -448,7 +448,7 @@ public static List<HashMap<String, Object>> genWholeExeDate(List<HashMap<String, ...@@ -448,7 +448,7 @@ public static List<HashMap<String, Object>> genWholeExeDate(List<HashMap<String,
timeList.add(tempMap); timeList.add(tempMap);
} }
} }
return timeList; return timeList;
} }
/** /**
...@@ -466,24 +466,24 @@ private static List<HashMap<String, Object>> genTimeByRate(Plan plan,List<HashMa ...@@ -466,24 +466,24 @@ private static List<HashMap<String, Object>> genTimeByRate(Plan plan,List<HashMa
Date dayBegin = plan.getDayBegin();//开始时间(每天执行频率为多次时使用) Date dayBegin = plan.getDayBegin();//开始时间(每天执行频率为多次时使用)
Date dayEnd = plan.getDayEnd();//结束时间(每天执行频率为多次时使用) Date dayEnd = plan.getDayEnd();//结束时间(每天执行频率为多次时使用)
int error = plan.getError();//允许误差 int error = plan.getError();//允许误差
List<HashMap<String, Object>> timeList = new ArrayList<HashMap<String, Object>>(); List<HashMap<String, Object>> timeList = new ArrayList<HashMap<String, Object>>();
if(dayRate == XJConstant.DAY_RATE_ONE){ if(dayRate == XJConstant.DAY_RATE_ONE){
for(int i= 0;i<list.size();i++){ for(int i= 0;i<list.size();i++){
HashMap<String, Object> tempMap = new HashMap<String, Object>(); HashMap<String, Object> tempMap = new HashMap<String, Object>();
Date beginDate = list.get(i).get("begin_date"); Date beginDate = list.get(i).get("begin_date");
Date next_gen_date = list.get(i).get("next_gen_date"); Date next_gen_date = list.get(i).get("next_gen_date");
String strBeginTime = DateUtil.formatDatrToStr(beginDate,"yyyy-MM-dd") +" "+ dayTime; String strBeginTime = DateUtil.formatDatrToStr(beginDate,"yyyy-MM-dd") +" "+ dayTime;
String strEndTime = DateUtil.getIntMinStrDate(strBeginTime,duration,"yyyy-MM-dd HH:mm:ss"); String strEndTime = DateUtil.getIntMinStrDate(strBeginTime,duration,"yyyy-MM-dd HH:mm:ss");
tempMap.put("BEGIN_TIME", strBeginTime); tempMap.put("BEGIN_TIME", strBeginTime);
tempMap.put("END_TIME", strEndTime); tempMap.put("END_TIME", strEndTime);
tempMap.put("NEXT_GEN_DATE", DateUtil.formatDatrToStr(next_gen_date,"yyyy-MM-dd")); tempMap.put("NEXT_GEN_DATE", DateUtil.formatDatrToStr(next_gen_date,"yyyy-MM-dd"));
timeList.add(tempMap); timeList.add(tempMap);
} }
}else if(dayRate == XJConstant.DAY_RATE_MANY){ }else if(dayRate == XJConstant.DAY_RATE_MANY){
List<HashMap<String, Date>> last6Timelist = PlanTaskUtil.getLast6Time(dayBegin,dayEnd,duration,inter,error,unit);//循环次数 List<HashMap<String, Date>> last6Timelist = PlanTaskUtil.getLast6Time(dayBegin,dayEnd,duration,inter,error,unit);//循环次数
if(last6Timelist != null && last6Timelist.size() > 0){ if(last6Timelist != null && last6Timelist.size() > 0){
for(int i= 0;i<list.size();i++){ for(int i= 0;i<list.size();i++){
Date beginDate = list.get(i).get("begin_date"); Date beginDate = list.get(i).get("begin_date");
Date next_gen_date = list.get(i).get("next_gen_date"); Date next_gen_date = list.get(i).get("next_gen_date");
for(HashMap<String, Date> map :last6Timelist){ for(HashMap<String, Date> map :last6Timelist){
...@@ -496,7 +496,7 @@ private static List<HashMap<String, Object>> genTimeByRate(Plan plan,List<HashMa ...@@ -496,7 +496,7 @@ private static List<HashMap<String, Object>> genTimeByRate(Plan plan,List<HashMa
timeList.add(tempMap); timeList.add(tempMap);
} }
} }
} }
} }
return timeList; return timeList;
...@@ -520,7 +520,7 @@ public static List<HashMap<String, Object>> genWholeExeData(List<HashMap<String, ...@@ -520,7 +520,7 @@ public static List<HashMap<String, Object>> genWholeExeData(List<HashMap<String,
if (!CollectionUtils.isEmpty(userDetailsDtoList)) { if (!CollectionUtils.isEmpty(userDetailsDtoList)) {
Map<String, List<UserDetailsDto>> userDetailsDtoMap = userDetailsDtoList.stream(). Map<String, List<UserDetailsDto>> userDetailsDtoMap = userDetailsDtoList.stream().
filter(obj -> obj.getEquipCategoryCode().contains(deviceType) && obj.getUnitTypeCode().contains(unitType)) filter(obj -> obj.getEquipCategoryCode().contains(deviceType) && obj.getUnitTypeCode().contains(unitType))
.collect(Collectors.groupingBy(UserDetailsDto::getUnitCode)); .collect(Collectors.groupingBy(UserDetailsDto::getSuperviseOrgCode));
for (HashMap<String, Object> stringObjectHashMap : timeList) { for (HashMap<String, Object> stringObjectHashMap : timeList) {
HashMap<String, Object> tempMap = new HashMap<>(); HashMap<String, Object> tempMap = new HashMap<>();
Object strBeginTime = stringObjectHashMap.get("BEGIN_TIME"); Object strBeginTime = stringObjectHashMap.get("BEGIN_TIME");
...@@ -531,19 +531,18 @@ public static List<HashMap<String, Object>> genWholeExeData(List<HashMap<String, ...@@ -531,19 +531,18 @@ public static List<HashMap<String, Object>> genWholeExeData(List<HashMap<String,
tempMap.put("NEXT_GEN_DATE", nextGenDate); tempMap.put("NEXT_GEN_DATE", nextGenDate);
List<HashMap<String, Object>> finalWholeList = wholeList; List<HashMap<String, Object>> finalWholeList = wholeList;
userDetailsDtoMap.forEach((unitCode, userDetailsDto) -> { userDetailsDtoMap.forEach((superviseOrgCode, userDetailsDto) -> {
if (!plan.getIsSingleExecution()) { if (!plan.getIsSingleExecution()) {
HashMap<String, Object> temp; HashMap<String, Object> temp;
temp = (HashMap<String, Object>) tempMap.clone(); temp = (HashMap<String, Object>) tempMap.clone();
String userIds = userDetailsDto.stream().map(UserDetailsDto::getUserId).filter(Objects::nonNull).collect(Collectors.joining(",")); String userIds = userDetailsDto.stream().map(UserDetailsDto::getUserId).filter(Objects::nonNull).collect(Collectors.joining(","));
String userNames = userDetailsDto.stream().map(UserDetailsDto::getUserName).filter(Objects::nonNull).collect(Collectors.joining(",")); String userNames = userDetailsDto.stream().map(UserDetailsDto::getUserName).filter(Objects::nonNull).collect(Collectors.joining(","));
String userDept = userDetailsDto.stream().map(a->{ String userDept = userDetailsDto.stream().map(dto-> dto.getUserId() + "@" + superviseOrgCode + "@" + dto.getSuperviseOrgName()).collect(Collectors.joining(","));
return a.getUserId() + "@" + unitCode; String orgCodes = userDetailsDto.stream().map(UserDetailsDto::getSuperviseOrgCode).filter(Objects::nonNull).collect(Collectors.joining(","));
}).collect(Collectors.joining(","));
temp.put("USER_ID", userIds); temp.put("USER_ID", userIds);
temp.put("USER_NAME", userNames); temp.put("USER_NAME", userNames);
temp.put("ORG_CODE", unitCode); temp.put("ORG_CODE", orgCodes);
temp.put("USER_DEPT", userDept); temp.put("USER_DEPT", userDept);
finalWholeList.add(temp); finalWholeList.add(temp);
} else { } else {
...@@ -552,7 +551,7 @@ public static List<HashMap<String, Object>> genWholeExeData(List<HashMap<String, ...@@ -552,7 +551,7 @@ public static List<HashMap<String, Object>> genWholeExeData(List<HashMap<String,
temp = (HashMap<String, Object>) tempMap.clone(); temp = (HashMap<String, Object>) tempMap.clone();
temp.put("USER_ID", dto.getUserId()); temp.put("USER_ID", dto.getUserId());
temp.put("USER_NAME", dto.getUserName()); temp.put("USER_NAME", dto.getUserName());
temp.put("ORG_CODE", dto.getUserId() + "@" + unitCode); temp.put("ORG_CODE", dto.getUserId() + "@" + superviseOrgCode + "@" + dto.getSuperviseOrgName());
finalWholeList.add(temp); finalWholeList.add(temp);
}); });
} }
...@@ -572,7 +571,7 @@ public static List<HashMap<String, Object>> genWholeExeData(List<HashMap<String, ...@@ -572,7 +571,7 @@ public static List<HashMap<String, Object>> genWholeExeData(List<HashMap<String,
* @return * @return
*/ */
public static Date getYearCalDate(String strPlanDegin, int exeRate,SimpleDateFormat df) { public static Date getYearCalDate(String strPlanDegin, int exeRate,SimpleDateFormat df) {
List<HashMap<String, String>> yearList = PlanTaskUtil.changeRateToDate(strPlanDegin,exeRate); List<HashMap<String, String>> yearList = PlanTaskUtil.changeRateToDate(strPlanDegin,exeRate);
Date calDate = null ; Date calDate = null ;
for(int i=0;i<yearList.size();i++){ for(int i=0;i<yearList.size();i++){
String beginDateStr = yearList.get(i).get("begin_date"); String beginDateStr = yearList.get(i).get("begin_date");
...@@ -586,7 +585,7 @@ public static Date getYearCalDate(String strPlanDegin, int exeRate,SimpleDateFor ...@@ -586,7 +585,7 @@ public static Date getYearCalDate(String strPlanDegin, int exeRate,SimpleDateFor
planBegin = df.parse(beginDateStr); planBegin = df.parse(beginDateStr);
} catch (ParseException e) { } catch (ParseException e) {
throw new YeeException("日期格式化失败"); throw new YeeException("日期格式化失败");
} }
if(planBegin.getTime() >= beginDate.getTime() && planBegin.getTime() <= endDate.getTime()){ if(planBegin.getTime() >= beginDate.getTime() && planBegin.getTime() <= endDate.getTime()){
calDate = planBegin; calDate = planBegin;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment