Commit 382450df authored by lisong's avatar lisong

修改任务生成定时任务bug

parent a32c8e94
...@@ -60,4 +60,6 @@ public interface PlanMapper extends BaseMapper { ...@@ -60,4 +60,6 @@ public interface PlanMapper extends BaseMapper {
void initUpdatePlanNextGenDate(); void initUpdatePlanNextGenDate();
Plan getPlan(String planId); Plan getPlan(String planId);
int checkData(@Param("planId")Long planId);
} }
...@@ -438,7 +438,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -438,7 +438,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
if (plan == null) { if (plan == null) {
throw new YeeException("计划不存在"); throw new YeeException("计划不存在");
} }
// 校验计划数据是否异常
if (!checkData(plan.getId())){
throw new YeeException("计划数据异常!");
}
//2.数据必输校验,不满足直接return,不再向下进行 //2.数据必输校验,不满足直接return,不再向下进行
Boolean fileFlag = PlanTaskUtil.checkMustFile(plan); Boolean fileFlag = PlanTaskUtil.checkMustFile(plan);
if (!fileFlag) { if (!fileFlag) {
...@@ -689,6 +692,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -689,6 +692,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
/** /**
* 校验计划数据是否异常
* @return
*/
private Boolean checkData(Long planId) {
if (planMapper.checkData(planId) > 0) {
return true;
}
return false;
}
/**
* 自动任务执行 * 自动任务执行
*/ */
@Override @Override
...@@ -710,6 +723,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -710,6 +723,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//2.循环遍历执行 //2.循环遍历执行
HashMap<String, Object> paramMap = new HashMap<String, Object>(); HashMap<String, Object> paramMap = new HashMap<String, Object>();
for (Plan plan : planList) { for (Plan plan : planList) {
// 校验计划数据是否异常
if (!checkData(plan.getId())){
continue;
}
// tzs修改为查询用户组id // tzs修改为查询用户组id
if (StringUtils.isEmpty(plan.getUserGroupId())) if (StringUtils.isEmpty(plan.getUserGroupId()))
continue; continue;
...@@ -1113,14 +1130,28 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1113,14 +1130,28 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
Map<String, List<AppCheckInputRespone>> collect2 = pointInputs.stream().collect(Collectors.groupingBy(AppCheckInputRespone::getPointId)); Map<String, List<AppCheckInputRespone>> collect2 = pointInputs.stream().collect(Collectors.groupingBy(AppCheckInputRespone::getPointId));
for (Map<String, String> excludeItem : excludeItems) { for (Map<String, String> excludeItem : excludeItems) {
String[] exclude_items = excludeItem.get("exclude_items").split(",");
List<AppCheckInputRespone> appCheckInputRespones = collect2.get(String.valueOf(excludeItem.get("point_id"))); List<AppCheckInputRespone> appCheckInputRespones = collect2.get(String.valueOf(excludeItem.get("point_id")));
if (excludeItem.containsKey("exclude_items") && !ObjectUtils.isEmpty(excludeItem.get("exclude_items"))){
String[] exclude_items = excludeItem.get("exclude_items").split(",");
List<AppCheckInputRespone> appCheckInputRespones1 = new ArrayList<>(); List<AppCheckInputRespone> appCheckInputRespones1 = new ArrayList<>();
for (String exclude_item : exclude_items) { for (String exclude_item : exclude_items) {
appCheckInputRespones1.add(appCheckInputRespones.stream().filter(x -> x.getPointInputItemId().equals(exclude_item)).collect(Collectors.toList()).get(0)); List<AppCheckInputRespone> collect = appCheckInputRespones.stream().filter(x -> x.getPointInputItemId().equals(exclude_item)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(collect) && !ObjectUtils.isEmpty(collect.get(0))){
continue;
}
appCheckInputRespones1.add(collect.get(0));
} }
appCheckInputRespones.removeAll(appCheckInputRespones1); appCheckInputRespones.removeAll(appCheckInputRespones1);
}
collect2.put(String.valueOf(excludeItem.get("point_id")), appCheckInputRespones); collect2.put(String.valueOf(excludeItem.get("point_id")), appCheckInputRespones);
// String[] exclude_items = excludeItem.get("exclude_items").split(",");
// List<AppCheckInputRespone> appCheckInputRespones = collect2.get(String.valueOf(excludeItem.get("point_id")));
// List<AppCheckInputRespone> appCheckInputRespones1 = new ArrayList<>();
// for (String exclude_item : exclude_items) {
// appCheckInputRespones1.add(appCheckInputRespones.stream().filter(x -> x.getPointInputItemId().equals(exclude_item)).collect(Collectors.toList()).get(0));
// }
// appCheckInputRespones.removeAll(appCheckInputRespones1);
// collect2.put(String.valueOf(excludeItem.get("point_id")), appCheckInputRespones);
} }
for (ESTaskDetailDto esTaskDetailDto : esTaskDetailDtos) { for (ESTaskDetailDto esTaskDetailDto : esTaskDetailDtos) {
...@@ -1864,21 +1895,17 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -1864,21 +1895,17 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
meBuilder.must(QueryBuilders.wildcardQuery("userId", "*" + test + "*")); meBuilder.must(QueryBuilders.wildcardQuery("userId", "*" + test + "*"));
boolMust.must(meBuilder); boolMust.must(meBuilder);
} }
if (!ObjectUtils.isEmpty(params.get("orgCode"))) {
if (!ObjectUtils.isEmpty(params.get("finishStatus"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery(); BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchPhraseQuery("orgCode", "*" + params.get("orgCode") + "*")); query.must(QueryBuilders.matchPhraseQuery("finishStatus", "*" + params.get("finishStatus") + "*"));
boolMust.must(query); boolMust.must(query);
} }
if (!ObjectUtils.isEmpty(params.get("finishStatus"))) { if (!ObjectUtils.isEmpty(params.get("type"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery(); BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchPhraseQuery("finishStatus", "*" + params.get("finishStatus") + "*")); query.must(QueryBuilders.matchPhraseQuery("type", "*" + params.get("type") + "*"));
boolMust.must(query); boolMust.must(query);
} }
// if (!ObjectUtils.isEmpty(params.get("type"))) {
// BoolQueryBuilder query = QueryBuilders.boolQuery();
// query.must(QueryBuilders.matchPhraseQuery("type", "*" + params.get("type") + "*"));
// boolMust.must(query);
// }
if (!ObjectUtils.isEmpty(params.get("startTime"))) { if (!ObjectUtils.isEmpty(params.get("startTime"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery(); BoolQueryBuilder query = QueryBuilders.boolQuery();
......
...@@ -174,4 +174,11 @@ ...@@ -174,4 +174,11 @@
<select id="getPlan" resultType="com.yeejoin.amos.patrol.dao.entity.Plan"> <select id="getPlan" resultType="com.yeejoin.amos.patrol.dao.entity.Plan">
select * from p_plan where id = #{planId} select * from p_plan where id = #{planId}
</select> </select>
<select id="checkData" resultType="java.lang.Integer">
SELECT count(1) FROM "p_plan" plan
INNER JOIN p_route_point route on plan.route_id = route.route_id
INNER JOIN p_point_inputitem item on route.point_id = item.point_id
WHERE plan.id = #{planId}
</select>
</mapper> </mapper>
\ No newline at end of file
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