Sfoglia il codice sorgente

API接口格式约定

chengyao 4 anni fa
parent
commit
842049b1f1

+ 7 - 8
src/main/java/com/diagbot/dto/QcResultApiDTO.java

@@ -18,14 +18,13 @@ public class QcResultApiDTO implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    /**
-     * 等级
-     */
-    private String level;
-
-    /**
-     * 最后得分
-     */
+    //得分
     private BigDecimal scoreRes;
+    //等级
+    private String level;
+    //缺陷总数
+    private Long num;
+    //缺陷总扣分
+    private BigDecimal numScore;
 
 }

+ 16 - 8
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -1530,7 +1530,8 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
      * @param analyzeRunVO
      * @return
      */
-    public AnalyzeRunDTO analyzeApi(AnalyzeRunVO analyzeRunVO) {
+    public Map<String, Object> analyzeApi(AnalyzeRunVO analyzeRunVO) {
+        Map<String, Object> resMapData = new HashMap<>(); // 返回结果
         AnalyzeVO analyzeVO = new AnalyzeVO();
         BeanUtil.copyProperties(analyzeRunVO, analyzeVO);
         Long hospitalId = analyzeVO.getHospitalId();
@@ -1602,7 +1603,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
             //百分制
             reNum = "1";
         }
-        AnalyzeRunDTO analyzeRunDTO =  new AnalyzeRunDTO();
+        QcResultApiDTO qcResultApiDTO = new QcResultApiDTO();
         if(StringUtils.isNotEmpty(algorithmDTO.getLevel()) && algorithmDTO.getScore()!=null && msgDTOList != null){
             if("1".equals(reNum)) {
                 bigDecimal = resPr.subtract(algorithmDTO.getScore());
@@ -1616,13 +1617,20 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
                 .stream()
                 .filter(Objects::nonNull)
                 .count();
-        analyzeRunDTO.setScoreRes(algorithmDTO.getScore());
-        analyzeRunDTO.setLevel(algorithmDTO.getLevel());
-        analyzeRunDTO.setNum(num);
-        analyzeRunDTO.setNumScore(bigDecimal);
-        analyzeRunDTO.setMsgDTOList(msgDTOList);
+            qcResultApiDTO.setScoreRes(algorithmDTO.getScore());
+            qcResultApiDTO.setLevel(algorithmDTO.getLevel());
+            qcResultApiDTO.setNum(num);
+            qcResultApiDTO.setNumScore(bigDecimal);
+            resMapData.put("result", qcResultApiDTO);
+            List<MsgApiDTO> msgApiDTOList = BeanUtil.listCopyTo(msgDTOList, MsgApiDTO.class);
+            if (analyzeRunVO.getNeedGroup() == 0) {
+                resMapData.put("details", msgApiDTOList);
+            } else {
+                Map<String, List<MsgApiDTO>> msgMap = EntityUtil.makeEntityListMap(msgApiDTOList, "modelName");
+                resMapData.put("details", msgMap);
+            }
         };
-        return analyzeRunDTO;
+        return resMapData;
     }
 
 

+ 2 - 0
src/main/java/com/diagbot/vo/AnalyzeRunVO.java

@@ -22,4 +22,6 @@ public class AnalyzeRunVO {
     private Long modeId;
     // 归档字段
     private String isPlacefile = "0";
+
+    private Integer NeedGroup = 0;
 }

+ 1 - 1
src/main/java/com/diagbot/web/BehospitalInfoController.java

@@ -122,7 +122,7 @@ public class BehospitalInfoController {
     @SysLogger("analyze_api")
     @Transactional
     //    @ApiIgnore
-    public RespDTO<AnalyzeRunDTO> analyzeApi(@RequestBody AnalyzeRunVO analyzeRunVO) {
+    public RespDTO<Map<String, Object> > analyzeApi(@RequestBody AnalyzeRunVO analyzeRunVO) {
         return RespDTO.onSuc(behospitalInfoFacade.analyzeApi(analyzeRunVO));
     }