diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/CpsQuestionInfo.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/CpsQuestionInfo.java index efd0a86..0ae0a6b 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/CpsQuestionInfo.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/CpsQuestionInfo.java @@ -41,11 +41,11 @@ public class CpsQuestionInfo extends BaseMgrEntity { private String controlArea; private String knowledgeAccumulation; private Integer status = 0; - private Integer status1 = 0; - private Integer status2 = 0; - private Integer status3 = 0; - private Integer status4 = 0; - private Integer status5 = 0; - private Integer status6 = 0; + private Integer status1 = 1; + private Integer status2 = 1; + private Integer status3 = 1; + private Integer status4 = 1; + private Integer status5 = 1; + private Integer status6 = 1; private String timestamp; } \ No newline at end of file diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/cps/CpsQuestionGetService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/cps/CpsQuestionGetService.java index 50784d2..16d8d9a 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/cps/CpsQuestionGetService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/cps/CpsQuestionGetService.java @@ -7,18 +7,22 @@ */ package com.digiwin.athena.app.service.cps; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.digiwin.app.service.DWEAIResult; import com.digiwin.athena.app.infra.entity.CpsQuestionInfo; import com.digiwin.athena.app.infra.service.CpsQuestionInfoService; import com.digiwin.athena.opt.common.eai.EAIRequest; +import com.digiwin.athena.opt.common.eai.EAIUtil; import com.digiwin.athena.opt.common.eai.service.AbsEAIService; import com.digiwin.athena.opt.persistence.domain.BaseMgrEntity; +import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; @@ -60,32 +64,33 @@ public class CpsQuestionGetService extends AbsEAIService { } // 任务卡查询 - List questionInfo = eaiRequest.getObject("question_info", new TypeReference>() { - }); + List> questionInfo = eaiRequest.getObject("question_info", EAIUtil.TYPE_LIST_MAP_V_OBJ); - List collectIds = questionInfo.stream().map(BaseMgrEntity::getId).collect(Collectors.toList()); + if (questionInfo.isEmpty()) { + return buildOK("question_info", new ArrayList<>()); + } + List collectIds = questionInfo.stream().map(o -> MapUtils.getLong(o, "id")).collect(Collectors.toList()); LambdaQueryChainWrapper lambdaQuery = cpsQuestionInfoService.lambdaQuery().in(CpsQuestionInfo::getId, collectIds); - String status = eaiRequest.getString("status"); switch (option) { case "1": - lambdaQuery.eq(CpsQuestionInfo::getStatus1, status); + lambdaQuery.eq(CpsQuestionInfo::getStatus1, MapUtils.getInteger(questionInfo.get(0), "status1")); break; case "2": - lambdaQuery.eq(CpsQuestionInfo::getStatus2, status); + lambdaQuery.eq(CpsQuestionInfo::getStatus2, MapUtils.getInteger(questionInfo.get(0), "status2")); break; case "3": - lambdaQuery.eq(CpsQuestionInfo::getStatus3, status); + lambdaQuery.eq(CpsQuestionInfo::getStatus3, MapUtils.getInteger(questionInfo.get(0), "status3")); break; case "4": - lambdaQuery.eq(CpsQuestionInfo::getStatus4, status); + lambdaQuery.eq(CpsQuestionInfo::getStatus4, MapUtils.getInteger(questionInfo.get(0), "status4")); break; case "5": - lambdaQuery.eq(CpsQuestionInfo::getStatus5, status); + lambdaQuery.eq(CpsQuestionInfo::getStatus5, MapUtils.getInteger(questionInfo.get(0), "status5")); break; case "6": - lambdaQuery.eq(CpsQuestionInfo::getStatus6, status); + lambdaQuery.eq(CpsQuestionInfo::getStatus6, MapUtils.getInteger(questionInfo.get(0), "status6")); break; } diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/cps/CpsQuestionUpdateService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/cps/CpsQuestionUpdateService.java index c787a86..c5f9bff 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/cps/CpsQuestionUpdateService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/service/cps/CpsQuestionUpdateService.java @@ -50,23 +50,23 @@ public class CpsQuestionUpdateService extends AbsEAIService { switch (option) { case "1": - o.setStatus1(1); + o.setStatus1(2); break; case "2": - o.setStatus2(1); + o.setStatus2(2); break; case "3": - o.setStatus3(1); + o.setStatus3(2); o.setCompletionTime(DateUtils.getDateTimeNow()); break; case "4": - o.setStatus4(1); + o.setStatus4(2); break; case "5": - o.setStatus5(1); + o.setStatus5(2); break; case "6": - o.setStatus6(1); + o.setStatus6(2); break; }