فهرست منبع

自定义工单 把图表的历史数据记录

wangmiaomiao 9 ماه پیش
والد
کامیت
212d6a70a7

+ 6 - 1
slibra-admin/src/main/java/com/slibra/web/controller/business/GRPCController.java

@@ -331,7 +331,12 @@ public class GRPCController extends BaseController {
                 chatReq.setShowVal(GONGDAN_TITLE_CUSTOM.replace("#{0}", timeBegin).replace("#{1}", timeEnd));//处理展示的标题
                 WorkOrderReq workOrderReq = new WorkOrderReq();
                 BeanUtils.copyProperties(chatReq, workOrderReq);
-                chatReq.setQuestion(this.buildGDQuestionCustom(frontService.customWorkOrder(workOrderReq), workOrderReq));
+                //拿到数据
+                List<WorkOrderRes> workOrderRes = frontService.customWorkOrder(workOrderReq);
+                //品种prompt
+                chatReq.setQuestion(this.buildGDQuestionCustom(workOrderRes, workOrderReq));
+                //2024年6月20日16:48:08  如果是自定义工单,需要处理图表 放到remark中
+                chatReq.setRemark(JSON.toJSONString(frontService.customWorkOrderHandleByData(workOrderReq, workOrderRes)));
             }
             isStrong = 1;
         }

+ 2 - 0
slibra-system/src/main/java/com/slibra/business/service/IFrontService.java

@@ -44,4 +44,6 @@ public interface IFrontService
     List<WorkOrderRes> customWorkOrder(WorkOrderReq workOrderReq);
 
     JSONObject customWorkOrderHandle(WorkOrderReq workOrderReq);
+
+    public JSONObject customWorkOrderHandleByData(WorkOrderReq workOrderReq, List<WorkOrderRes> workOrderRes);
 }

+ 79 - 0
slibra-system/src/main/java/com/slibra/business/service/impl/FrontServiceImpl.java

@@ -274,6 +274,85 @@ public class FrontServiceImpl implements IFrontService {
         return jsonObject;
     }
 
+
+    @Override
+    public JSONObject customWorkOrderHandleByData(WorkOrderReq workOrderReq, List<WorkOrderRes> workOrderRes) {
+        JSONObject jsonObject = new JSONObject();
+        List<JSONObject> jsGroup = new ArrayList<>();
+        List<JSONObject> csGroup = new ArrayList<>();
+        List<JSONObject> hyGroup = new ArrayList<>();
+        //处理成前端响应的结构
+        if(!CollectionUtils.isEmpty(workOrderRes)){
+            for (WorkOrderRes workOrderRe : workOrderRes) {
+                //处理进水
+                if(workOrderReq.getJsSlq() || workOrderReq.getJsCod() || workOrderReq.getJsTn()
+                        || workOrderReq.getJsTp() || workOrderReq.getJsNh3() || workOrderReq.getJsSs()){
+                    JSONObject jsonObjectJS = new JSONObject();
+                    jsonObjectJS.put("time", workOrderRe.getTime());
+                    if(workOrderReq.getJsSlq())
+                        jsonObjectJS.put("jsSlq", workOrderRe.getJsSlq());
+                    if(workOrderReq.getJsCod())
+                        jsonObjectJS.put("jsCod", workOrderRe.getJsCod());
+                    if(workOrderReq.getJsTn())
+                        jsonObjectJS.put("jsTn", workOrderRe.getJsTn());
+                    if(workOrderReq.getJsTp())
+                        jsonObjectJS.put("jsTp", workOrderRe.getJsTp());
+                    if(workOrderReq.getJsNh3())
+                        jsonObjectJS.put("jsNh3", workOrderRe.getJsNh3());
+                    if(workOrderReq.getJsSs())
+                        jsonObjectJS.put("jsSs", workOrderRe.getJsSs());
+                    jsGroup.add(jsonObjectJS);
+                }
+
+                //处理出水
+                if(workOrderReq.getCsSlqc() || workOrderReq.getCsCod() || workOrderReq.getCsTn()
+                        || workOrderReq.getCsTp() || workOrderReq.getCsNh3() || workOrderReq.getCsSs()){
+                    JSONObject jsonObjectCS = new JSONObject();
+                    jsonObjectCS.put("time", workOrderRe.getTime());
+                    if(workOrderReq.getJsSlq())
+                        jsonObjectCS.put("csSlqc", workOrderRe.getCsSlqc());
+                    if(workOrderReq.getJsCod())
+                        jsonObjectCS.put("csCod", workOrderRe.getCsCod());
+                    if(workOrderReq.getJsTn())
+                        jsonObjectCS.put("csTn", workOrderRe.getCsTn());
+                    if(workOrderReq.getJsTp())
+                        jsonObjectCS.put("csTp", workOrderRe.getCsTp());
+                    if(workOrderReq.getJsNh3())
+                        jsonObjectCS.put("csNh3", workOrderRe.getCsNh3());
+                    if(workOrderReq.getJsSs())
+                        jsonObjectCS.put("csSs", workOrderRe.getCsSs());
+                    csGroup.add(jsonObjectCS);
+                }
+
+                //处理化验
+                if(workOrderReq.getNo3Hlj1Jqr() || workOrderReq.getNo3Hlj2Jqr() || workOrderReq.getNh31Jqr()
+                        || workOrderReq.getNh32Jqr() || workOrderReq.getNo3Qyc1Jqr() || workOrderReq.getNo3Qyc2Jqr() || workOrderReq.getTpRccJqr()){
+                    JSONObject jsonObjectHY = new JSONObject();
+                    jsonObjectHY.put("time", workOrderRe.getTime());
+                    if(workOrderReq.getNo3Hlj1Jqr())
+                        jsonObjectHY.put("no3Hlj1Jqr", workOrderRe.getNo3Hlj1Jqr());
+                    if(workOrderReq.getNo3Hlj2Jqr())
+                        jsonObjectHY.put("no3Hlj2Jqr", workOrderRe.getNo3Hlj2Jqr());
+                    if(workOrderReq.getNh31Jqr())
+                        jsonObjectHY.put("nh31Jqr", workOrderRe.getNh31Jqr());
+                    if(workOrderReq.getNh32Jqr())
+                        jsonObjectHY.put("nh32Jqr", workOrderRe.getNh32Jqr());
+                    if(workOrderReq.getNo3Qyc1Jqr())
+                        jsonObjectHY.put("no3Qyc1Jqr", workOrderRe.getNo3Qyc1Jqr());
+                    if(workOrderReq.getNo3Qyc2Jqr())
+                        jsonObjectHY.put("no3Qyc2Jqr", workOrderRe.getNo3Qyc2Jqr());
+                    if(workOrderReq.getTpRccJqr())
+                        jsonObjectHY.put("tpRccJqr", workOrderRe.getTpRccJqr());
+                    hyGroup.add(jsonObjectHY);
+                }
+            }
+        }
+        jsonObject.put("jsGroup", jsGroup);
+        jsonObject.put("csGroup", csGroup);
+        jsonObject.put("hyGroup", hyGroup);
+        return jsonObject;
+    }
+
     private void buildIndustryData(TXinyiIndustry industry, WorkOrderRes workOrderRes, WorkOrderReq workOrderReq) {
         if(workOrderReq.getJsSlq())
             workOrderRes.setJsSlq(industry.getJsSlq());