Commit 95218239 authored by xinglei's avatar xinglei

重做计划增加修改nextGenDate字段

parent c2979340
...@@ -17,6 +17,7 @@ import com.yeejoin.amos.patrol.common.entity.Plan; ...@@ -17,6 +17,7 @@ import com.yeejoin.amos.patrol.common.entity.Plan;
import com.yeejoin.amos.patrol.common.entity.PlanTask; import com.yeejoin.amos.patrol.common.entity.PlanTask;
import com.yeejoin.amos.patrol.common.entity.PlanTaskDetail; import com.yeejoin.amos.patrol.common.entity.PlanTaskDetail;
import com.yeejoin.amos.patrol.common.entity.UserModel; import com.yeejoin.amos.patrol.common.entity.UserModel;
import com.yeejoin.amos.patrol.common.enums.PlanTypeEnum;
import com.yeejoin.amos.patrol.service.business.bo.patrol.CheckChkExListBo; import com.yeejoin.amos.patrol.service.business.bo.patrol.CheckChkExListBo;
import com.yeejoin.amos.patrol.service.business.bo.patrol.PointCheckDetailBo; import com.yeejoin.amos.patrol.service.business.bo.patrol.PointCheckDetailBo;
import com.yeejoin.amos.patrol.service.business.dao.mapper.PlanMapper; import com.yeejoin.amos.patrol.service.business.dao.mapper.PlanMapper;
...@@ -103,7 +104,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -103,7 +104,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
private RemoteSecurityService remoteSecurityService; private RemoteSecurityService remoteSecurityService;
@Override @Override
public Page<HashMap<String, Object>> getPlanTaskInfo(String toke,String product,String appKey,PlanTaskPageParam params) { public Page<HashMap<String, Object>> getPlanTaskInfo(String toke, String product, String appKey, PlanTaskPageParam params) {
long total = planTaskMapper.countPlanTask(params); long total = planTaskMapper.countPlanTask(params);
List<HashMap<String, Object>> content = planTaskMapper.getPlanTaskInfo(params); List<HashMap<String, Object>> content = planTaskMapper.getPlanTaskInfo(params);
...@@ -122,32 +123,23 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -122,32 +123,23 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
List<String> userList = new ArrayList<>(set); List<String> userList = new ArrayList<>(set);
List<String> deptList = new ArrayList<>(deptIdSet); List<String> deptList = new ArrayList<>(deptIdSet);
Map<String, String> deptMap = new HashMap<>(); Map<String, String> deptMap = new HashMap<>();
Map<String, String> userMap = new HashMap<>(); Map<String, String> userMap = new HashMap<>();
if (!CollectionUtils.isEmpty(userList)) { if (!CollectionUtils.isEmpty(userList)) {
userIds = String.join(",", userList); userIds = String.join(",", userList);
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds( toke, product, appKey,userIds); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, userIds);
userMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2)); userMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
} }
if (!CollectionUtils.isEmpty(deptList)) { if (!CollectionUtils.isEmpty(deptList)) {
deptIds = String.join(",", deptList); deptIds = String.join(",", deptList);
List<LinkedHashMap> deptBoList = remoteSecurityService.listDepartmentByDeptIds( toke, product, appKey,deptIds); List<LinkedHashMap> deptBoList = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, deptIds);
for (int i = 0; i < deptBoList.size(); i++) { for (int i = 0; i < deptBoList.size(); i++) {
deptMap.put(deptBoList.get(i).get("sequenceNbr").toString(), deptBoList.get(i).get("departmentName").toString()); deptMap.put(deptBoList.get(i).get("sequenceNbr").toString(), deptBoList.get(i).get("departmentName").toString());
} }
// deptMap = deptBoList.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName));
// deptMap = deptBoList.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName));
} }
List<String> userNames = new ArrayList<>(); List<String> userNames = new ArrayList<>();
...@@ -169,7 +161,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -169,7 +161,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void reGenPlanTask(HashMap<String, Object> param) throws ParseException { public void reGenPlanTask(HashMap<String, Object> param) throws ParseException {
//1.公共参数准备 //1.公共参数准备
String planId = param.get("planId").toString();//重做的计划编号id String planId = param.get("planId").toString();//重做的计划编号id
...@@ -180,12 +172,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -180,12 +172,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
if (plan == null) { if (plan == null) {
throw new YeeException("计划不存在"); throw new YeeException("计划不存在");
} }
if (plan.getStatus() == 1) {
if(plan.getStatus()==1){ throw new YeeException("1");
throw new YeeException("1");
} }
//2.数据必输校验,不满足直接return,不再向下进行 //2.数据必输校验,不满足直接return,不再向下进行
Boolean fileFlag = PlanTaskUtil.checkMustFile(plan); Boolean fileFlag = PlanTaskUtil.checkMustFile(plan);
if (!fileFlag) { if (!fileFlag) {
...@@ -198,8 +187,6 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -198,8 +187,6 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
if (null == vo) {//计划未开始,则结束 if (null == vo) {//计划未开始,则结束
return; return;
} }
if (!vo.getIsGenData()) {//日期不符合条件直接结束 if (!vo.getIsGenData()) {//日期不符合条件直接结束
return; return;
} }
...@@ -220,6 +207,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -220,6 +207,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
reformStatisticsPlanTask(strBginDate, strEndDate, plan.getUserId(), plan.getOrgCode()); reformStatisticsPlanTask(strBginDate, strEndDate, plan.getUserId(), plan.getOrgCode());
//8、重新更新nextGenDate字段
plan.setNextGenDate(getNextDataByPlan(plan));
iplanDao.saveAndFlush(plan);
} }
...@@ -266,25 +256,17 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -266,25 +256,17 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
param.put("IDS", new ArrayList<>(taskNos)); param.put("IDS", new ArrayList<>(taskNos));
param.put("FINISH_YES", XJConstant.PLAN_TASK_DET_FINISH_YES); param.put("FINISH_YES", XJConstant.PLAN_TASK_DET_FINISH_YES);
planTaskMapper.updatePlanTaskPtInfo(param);// 更新主表,点数量,完成数量 planTaskMapper.updatePlanTaskPtInfo(param);// 更新主表,点数量,完成数量
for (Long long1 : taskNos) { for (Long long1 : taskNos) {
int num = planTaskDetail.countByTaskNo(long1);
int num= planTaskDetail.countByTaskNo( long1); if (num <= 0) {
iplanTaskDao.deleteById(long1);
if(num<=0){ }
iplanTaskDao.deleteById(long1); }
}
}
} }
@Override @Override
public List<PlanTaskVo> planTaskReport(String toke,String product,String appKey,PlanTaskPageParam param) { public List<PlanTaskVo> planTaskReport(String toke, String product, String appKey, PlanTaskPageParam param) {
List<PlanTaskVo> content = planTaskMapper.getPlanTaskInfoList(param); List<PlanTaskVo> content = planTaskMapper.getPlanTaskInfoList(param);
Set<String> userIdSet = Sets.newHashSet(Lists.transform(content, PlanTaskVo::getUserName)); Set<String> userIdSet = Sets.newHashSet(Lists.transform(content, PlanTaskVo::getUserName));
...@@ -298,15 +280,15 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -298,15 +280,15 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, String> userMap = new HashMap<>(); Map<String, String> userMap = new HashMap<>();
Map<String, String> deptMap = new HashMap<>(); Map<String, String> deptMap = new HashMap<>();
if (!CollectionUtils.isEmpty(userIdSet)) { if (!CollectionUtils.isEmpty(userIdSet)) {
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds(toke, product, appKey,Joiner.on(",").join(userIdSet)); List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIdSet));
userMap = userModels.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2)); userMap = userModels.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
} }
if (!CollectionUtils.isEmpty(deptIdSet)) { if (!CollectionUtils.isEmpty(deptIdSet)) {
List<LinkedHashMap> departmentBos = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey,Joiner.on(",").join(deptIdSet)); List<LinkedHashMap> departmentBos = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIdSet));
//deptMap = departmentBos.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName)); //deptMap = departmentBos.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName));
for (int i = 0; i < departmentBos.size(); i++) { for (int i = 0; i < departmentBos.size(); i++) {
deptMap.put(departmentBos.get(i).get("sequenceNbr").toString(), departmentBos.get(i).get("departmentName").toString()); deptMap.put(departmentBos.get(i).get("sequenceNbr").toString(), departmentBos.get(i).get("departmentName").toString());
} }
} }
List<String> userNames = new ArrayList<>(); List<String> userNames = new ArrayList<>();
...@@ -315,15 +297,13 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -315,15 +297,13 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
content.forEach(e -> { content.forEach(e -> {
userNames.clear(); userNames.clear();
List<String> userIds1 = Arrays.asList(e.getUserName().split(",")); List<String> userIds1 = Arrays.asList(e.getUserName().split(","));
for(String userId : userIds1){ for (String userId : userIds1) {
userNames.add(finalUserMap1.get(userId)); userNames.add(finalUserMap1.get(userId));
} }
userNames.remove(null); userNames.remove(null);
e.setUserName(Joiner.on(",").join(userNames)); e.setUserName(Joiner.on(",").join(userNames));
e.setDeptName(finalDeptMap1.get(String.valueOf(e.getDeptId()))); e.setDeptName(finalDeptMap1.get(String.valueOf(e.getDeptId())));
}); });
return content; return content;
} }
...@@ -387,16 +367,14 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -387,16 +367,14 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
continue; continue;
} }
//2.4.删除今天可能重做生成的数据(计划重做后进行了计划的编辑) //2.4.删除今天可能重做生成的数据(计划重做后进行了计划的编辑)
if (iplanTaskDao.findById(plan.getPlanTaskId()) != null && plan.getFirstFlag() == XJConstant.PLAN_FIRST_STATUS_YES) if (iplanTaskDao.findById(plan.getPlanTaskId()) != null && plan.getFirstFlag() == XJConstant.PLAN_FIRST_STATUS_YES)
if(iplanTaskDao.existsById(plan.getPlanTaskId())){ if (iplanTaskDao.existsById(plan.getPlanTaskId())) {
iplanTaskDao.deleteById(plan.getPlanTaskId()); iplanTaskDao.deleteById(plan.getPlanTaskId());
} }
//2.5.插入planTask及planTaskDetail //2.5.插入planTask及planTaskDetail
insertPlanTaskAndDet(list, plan, XJConstant.SCHED_FLAG, now); insertPlanTaskAndDet(list, plan, XJConstant.SCHED_FLAG, now);
} }
} }
...@@ -412,7 +390,6 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -412,7 +390,6 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
for (long id : ids) { for (long id : ids) {
iplanTaskDao.deleteById(id); iplanTaskDao.deleteById(id);
} }
} }
/** /**
...@@ -572,7 +549,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -572,7 +549,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public Page<HashMap<String, Object>> getPlanTasks(String toke,String product,String appKey,HashMap<String, Object> params) { public Page<HashMap<String, Object>> getPlanTasks(String toke, String product, String appKey, HashMap<String, Object> params) {
CommonPageable pageParam = new CommonPageable(); CommonPageable pageParam = new CommonPageable();
List<HashMap<String, Object>> content = Lists.newArrayList(); List<HashMap<String, Object>> content = Lists.newArrayList();
long total = planTaskMapper.getPlanTasksCount(params); long total = planTaskMapper.getPlanTasksCount(params);
...@@ -588,21 +565,21 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -588,21 +565,21 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
userIds.add(userId); userIds.add(userId);
} }
}); });
List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey,Joiner.on(",").join(userIds)); List<AgencyUserModel> userModelList = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String,String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName ,(k1,k2)->k2)); Map<String, String> userModelMap = userModelList.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
List<String> userNames = new ArrayList<>(); List<String> userNames = new ArrayList<>();
content.forEach(e -> { content.forEach(e -> {
userNames.clear(); userNames.clear();
List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(",")); List<String> userIds1 = Arrays.asList(e.get("userId").toString().split(","));
for(String userId : userIds1){ for (String userId : userIds1) {
userNames.add(userModelMap.get(userId)); userNames.add(userModelMap.get(userId));
} }
userNames.remove(null); userNames.remove(null);
e.put("executiveName",Joiner.on(",").join(userNames)); e.put("executiveName", Joiner.on(",").join(userNames));
/*e.put("beginTime",new Date().getTime()); /*e.put("beginTime",new Date().getTime());
e.put("endTime",new Date().getTime());*/ e.put("endTime",new Date().getTime());*/
}); });
} }
return new PageImpl<>(content, pageParam, total); return new PageImpl<>(content, pageParam, total);
...@@ -624,8 +601,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -624,8 +601,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public List<PlanTaskVo> getPlanTaskListByIds(String toke,String product,String appKey,Long[] ids) { public List<PlanTaskVo> getPlanTaskListByIds(String toke, String product, String appKey, Long[] ids) {
List<PlanTaskVo> content = planTaskMapper.getPlanTaskListByIds(ids); List<PlanTaskVo> content = planTaskMapper.getPlanTaskListByIds(ids);
...@@ -640,15 +616,15 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -640,15 +616,15 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, String> userMap = new HashMap<>(); Map<String, String> userMap = new HashMap<>();
Map<String, String> deptMap = new HashMap<>(); Map<String, String> deptMap = new HashMap<>();
if (!CollectionUtils.isEmpty(userIdSet)) { if (!CollectionUtils.isEmpty(userIdSet)) {
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds(toke, product, appKey,Joiner.on(",").join(userIdSet)); List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIdSet));
userMap = userModels.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2)); userMap = userModels.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
} }
if (!CollectionUtils.isEmpty(deptIdSet)) { if (!CollectionUtils.isEmpty(deptIdSet)) {
List<LinkedHashMap> departmentBos = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey,Joiner.on(",").join(deptIdSet)); List<LinkedHashMap> departmentBos = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIdSet));
//deptMap = departmentBos.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName)); //deptMap = departmentBos.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName));
for (int i = 0; i < departmentBos.size(); i++) { for (int i = 0; i < departmentBos.size(); i++) {
deptMap.put(departmentBos.get(i).get("sequenceNbr").toString(), departmentBos.get(i).get("departmentName").toString()); deptMap.put(departmentBos.get(i).get("sequenceNbr").toString(), departmentBos.get(i).get("departmentName").toString());
} }
} }
List<String> userNames = new ArrayList<>(); List<String> userNames = new ArrayList<>();
...@@ -657,18 +633,14 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -657,18 +633,14 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
content.forEach(e -> { content.forEach(e -> {
userNames.clear(); userNames.clear();
List<String> userIds1 = Arrays.asList(e.getUserName().split(",")); List<String> userIds1 = Arrays.asList(e.getUserName().split(","));
for(String userId : userIds1){ for (String userId : userIds1) {
userNames.add(finalUserMap1.get(userId)); userNames.add(finalUserMap1.get(userId));
} }
userNames.remove(null); userNames.remove(null);
e.setUserName(Joiner.on(",").join(userNames)); e.setUserName(Joiner.on(",").join(userNames));
e.setDeptName(finalDeptMap1.get(String.valueOf(e.getDeptId()))); e.setDeptName(finalDeptMap1.get(String.valueOf(e.getDeptId())));
}); });
return content; return content;
} }
@Override @Override
...@@ -685,11 +657,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -685,11 +657,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public AppPointCheckRespone queryPointPlanTaskDetail(String toke,String product,String appKey,Long planTaskId, Long pointId) { public AppPointCheckRespone queryPointPlanTaskDetail(String toke, String product, String appKey, Long planTaskId, Long pointId) {
AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone(); AppPointCheckRespone pointCheckRespone = new AppPointCheckRespone();
Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId); Check check = checkDao.findByPlanTaskIdAndPointId(planTaskId, pointId);
if (check != null) { if (check != null) {
pointCheckRespone = checkService.queryCheckPointDetail( toke, product, appKey,check.getId()); pointCheckRespone = checkService.queryCheckPointDetail(toke, product, appKey, check.getId());
} else { } else {
PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId); PointCheckDetailBo planPointInfo = planTaskMapper.getPointPlanTaskInfo(planTaskId, pointId);
if (planPointInfo != null) { if (planPointInfo != null) {
...@@ -751,121 +723,121 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -751,121 +723,121 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override @Override
public PlanTask selectPlanTaskStatus(Long id) { public PlanTask selectPlanTaskStatus(Long id) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
Optional<PlanTask> date=iplanTaskDao.findById(id); Optional<PlanTask> date = iplanTaskDao.findById(id);
if(iplanTaskDao.findById(id)!=null){ if (iplanTaskDao.findById(id) != null) {
return date.get(); return date.get();
}else{ } else {
return null; return null;
} }
} }
@Override @Override
public CommonResponse startplan(List<String> ids) { public CommonResponse startplan(List<String> ids) {
try { try {
List<Plan> plans = iplanDao.findByids(ids); List<Plan> plans = iplanDao.findByids(ids);
if (plans != null&&plans.size()>0) { if (plans != null && plans.size() > 0) {
Plan plan =plans.get(0); Plan plan = plans.get(0);
plan.setStatus(Byte.parseByte(XJConstant.PLAN_STATUS_START)); plan.setStatus(Byte.parseByte(XJConstant.PLAN_STATUS_START));
iplanDao.save(plan); iplanDao.save(plan);
//1.公共参数准备 //1.公共参数准备
String planId =plan.getId()+"";//重做的计划编号id String planId = plan.getId() + "";//重做的计划编号id
SimpleDateFormat sdf1=new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
Date date=new Date(); Date datef = null;
try {
datef = sdf1.parse(plan.getPlanEnd());
date = sdf1.parse(sdf1.format(date));
} catch (Exception e1) {
// TODO Auto-generated catch block
Date datef = null; e1.printStackTrace();
try { }
datef = sdf1.parse(plan.getPlanEnd());
date = sdf1.parse(sdf1.format(date)); if (date.getTime() > datef.getTime()) {
} catch (Exception e1) { return CommonResponseUtil.failure("计划结束时间小于等于当前时间,计划不生成!");
// TODO Auto-generated catch block }
e1.printStackTrace();
} String strBginDate = sdf1.format(date);
String strEndDate = plan.getPlanEnd();
plan.setPlanBegin(strBginDate);
if(date.getTime()>datef.getTime()){ String flag = "0";
return CommonResponseUtil.failure("计划结束时间小于等于当前时间,计划不生成!");
} if (plan == null) {
throw new YeeException("计划不存在");
}
if (plan.getStatus() == 1) {
String strBginDate=sdf1.format(date); throw new YeeException("1");
String strEndDate = plan.getPlanEnd(); }
plan.setPlanBegin(strBginDate);
String flag = "0"; //2.数据必输校验,不满足直接return,不再向下进行
Boolean fileFlag = PlanTaskUtil.checkMustFile(plan);
if (!fileFlag) {
if (plan == null) { return CommonResponseUtil.failure();
throw new YeeException("计划不存在"); }
}
//3.计算生成数据的日期区间(前10位:yyyy-MM-dd)
if(plan.getStatus()==1){ CalDateVo vo = PlanTaskUtil.reGenPlanTaskData(plan, strBginDate, strEndDate);
throw new YeeException("1");
} if (null == vo) {//计划未开始,则结束
return CommonResponseUtil.failure();
}
//2.数据必输校验,不满足直接return,不再向下进行
Boolean fileFlag = PlanTaskUtil.checkMustFile(plan); if (!vo.getIsGenData()) {//日期不符合条件直接结束
if (!fileFlag) { return CommonResponseUtil.failure();
return CommonResponseUtil.failure(); }
}
//3.删除planTask表,按照计划id+日期
//3.计算生成数据的日期区间(前10位:yyyy-MM-dd) HashMap<String, Object> param = new HashMap<>();
CalDateVo vo = PlanTaskUtil.reGenPlanTaskData(plan, strBginDate, strEndDate); param.put("beginDate", strBginDate);
param.put("endDate", strEndDate);
if (null == vo) {//计划未开始,则结束 param.put("planId", planId);
return CommonResponseUtil.failure(); deletePlanTaskAndDet(param);
}
//5.执行数据生成(具体时间 + 人员)
List<HashMap<String, Object>> list = genAllExeDate(plan, vo, XJConstant.REGEN_FLAG);
if (!vo.getIsGenData()) {//日期不符合条件直接结束
return CommonResponseUtil.failure(); //6.插入planTask及planTaskDetail
} insertPlanTaskAndDet(list, plan, flag, new Date());
//3.删除planTask表,按照计划id+日期 //7.重新统计计划
HashMap<String, Object> param =new HashMap<>(); if (ObjectUtils.isEmpty(plan.getUserId())) {
param.put("beginDate",strBginDate); return CommonResponseUtil.failure();
param.put("endDate",strEndDate); }
param.put("planId",planId); try {
deletePlanTaskAndDet(param); reformStatisticsPlanTask(strBginDate, strEndDate, plan.getUserId(), plan.getOrgCode());
} catch (Exception e) {
//5.执行数据生成(具体时间 + 人员) // TODO Auto-generated catch block
List<HashMap<String, Object>> list = genAllExeDate(plan, vo, XJConstant.REGEN_FLAG); e.printStackTrace();
}
//6.插入planTask及planTaskDetail }
insertPlanTaskAndDet(list, plan, flag, new Date());
} catch (Exception e) {
//7.重新统计计划 }
if (ObjectUtils.isEmpty(plan.getUserId())) {
return CommonResponseUtil.failure();
}
try {
reformStatisticsPlanTask(strBginDate, strEndDate, plan.getUserId(), plan.getOrgCode());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} catch (Exception e) {
}
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} }
/**
* 根据计划获取下一次执行时间
*
* @param plan
* @return
*/
private Date getNextDataByPlan(Plan plan) {
Date date = DateUtil.format();
switch (plan.getPlanType()) {
case "1":
date = DateUtil.getDateByNumber(date, plan.getExecuteInterval());
break;
case "2":
date = DateUtil.getDateByWeek(date, plan.getExecuteInterval());
break;
case "3":
date = DateUtil.getDateByMonth(date, plan.getExecuteInterval());
break;
}
return date;
}
} }
...@@ -294,7 +294,5 @@ public class Safety3DDataSendServiceImpl implements ISafety3DDataSendService { ...@@ -294,7 +294,5 @@ public class Safety3DDataSendServiceImpl implements ISafety3DDataSendService {
remoteSpcService.pushSpcCheckResult(checkResultPushSpcRequest); remoteSpcService.pushSpcCheckResult(checkResultPushSpcRequest);
return checkResultPushSpcRequest; return checkResultPushSpcRequest;
} }
} }
...@@ -589,6 +589,20 @@ public class DateUtil { ...@@ -589,6 +589,20 @@ public class DateUtil {
return cal.getTime(); return cal.getTime();
} }
public static Date getDateByWeek(Date date, Integer dayNumber) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.WEEK_OF_YEAR, dayNumber);
return cal.getTime();
}
public static Date getDateByMonth(Date date, Integer dayNumber) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MONTH, dayNumber);
return cal.getTime();
}
public static Date getHourBeginOfDay(int hour) { public static Date getHourBeginOfDay(int hour) {
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.HOUR_OF_DAY, hour);
...@@ -596,4 +610,14 @@ public class DateUtil { ...@@ -596,4 +610,14 @@ public class DateUtil {
cal.set(Calendar.SECOND, 0); cal.set(Calendar.SECOND, 0);
return cal.getTime(); return cal.getTime();
} }
/**
* 获取当前时间
*
* @return
*/
public static Date format() {
Date date = new Date();
return date;
}
} }
...@@ -80,8 +80,6 @@ public class RemoteSecurityService { ...@@ -80,8 +80,6 @@ public class RemoteSecurityService {
} }
//登录 //登录
public Toke come() { public Toke come() {
IdPasswordAuthModel dPasswordAuthModel=new IdPasswordAuthModel(); IdPasswordAuthModel dPasswordAuthModel=new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(loginId); dPasswordAuthModel.setLoginId(loginId);
dPasswordAuthModel.setPassword(password); dPasswordAuthModel.setPassword(password);
...@@ -97,7 +95,6 @@ public class RemoteSecurityService { ...@@ -97,7 +95,6 @@ public class RemoteSecurityService {
oked.setToke(map.get("token").toString()); oked.setToke(map.get("token").toString());
oked.setProduct(productWeb); oked.setProduct(productWeb);
oked.setAppKey(appKeyWeb); oked.setAppKey(appKeyWeb);
} }
...@@ -209,7 +206,7 @@ public class RemoteSecurityService { ...@@ -209,7 +206,7 @@ public class RemoteSecurityService {
if (userId == null || userId.equals("")) { if (userId == null || userId.equals("")) {
return null; return null;
} }
RequestContext.setToken(toke); RequestContext.setToken(toke);
RequestContext.setProduct(product); RequestContext.setProduct(product);
RequestContext.setAppKey(appKey); RequestContext.setAppKey(appKey);
AgencyUserModel agencyUserModel=null; AgencyUserModel agencyUserModel=null;
......
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