ソースを参照

Merge branch 'master' into 'master'

指标报表结果增加修改和删除,增加指标手工数据录入维护

See merge request lighter/web-server!116
huangshuhua 8 ヶ月 前
コミット
d2c4282fd9

+ 15 - 0
src/main/java/thyyxxk/webserver/controller/targetmanagement/TargetManagementController.java

@@ -135,6 +135,16 @@ public class TargetManagementController {
         return service.saveTargetReportResult(list);
     }
 
+    @PostMapping("/saveTargetReportResultSinge")
+    public ResultVo<Map<String, Object>> saveTargetReportResultSinge(@RequestBody ZbReportResult result){
+        return service.saveTargetReportResultSinge(result);
+    }
+
+    @PostMapping("/delTargetReportResultByYear")
+    public ResultVo<Map<String, Object>> delTargetReportResultByYear(@RequestBody ZbReportResult result){
+        return service.delTargetReportResultByYear(result);
+    }
+
     @PostMapping("/selectTargetReportResult")
     public ResultVo<List<ZbReportResult>> selectTargetReportResult(@RequestBody @Validated TargetManagement dto){
         return service.selectTargetReportResult(dto);
@@ -237,4 +247,9 @@ public class TargetManagementController {
         return service.selectTargetMonthScoreSummary(dto);
     }
 
+    @PostMapping("/selectTargetDictConstantData")
+    public ResultVo<List<ReportBaseInfo>> selectTargetDictConstantData(@RequestBody @Validated TargetManagement dto){
+        return service.selectTargetDictConstantData(dto);
+    }
+
 }

+ 12 - 0
src/main/java/thyyxxk/webserver/dao/his/highreport/HighReportDao.java

@@ -266,4 +266,16 @@ public interface HighReportDao {
             " </if> " +
             "</script>")
     List<ZbReportMonthScore> selectTargetMonthScoreSummary(TargetManagement dto);
+
+    @Select("<script> " +
+            " select * from report_base_info where flag = 'Y' and report_type = 'sg' " +
+            " <if test=\"id != null and id != '' \"> " +
+            " and report_id = #{id} " +
+            " </if> " +
+            " <if test=\"text != null and text != '' \"> " +
+            "    and (isnull(report_id,'') like 'sg_${text}%' or isnull(report_name,'') like '${text}%' ) " +
+            " </if> " +
+            " order by sort " +
+            "</script> ")
+    List<ReportBaseInfo> selectTargetDictConstantData(TargetManagement dto);
 }

+ 2 - 2
src/main/java/thyyxxk/webserver/dao/his/targetmanagement/TargetManagementDao.java

@@ -48,13 +48,13 @@ public interface TargetManagementDao extends BaseMapper<ReportBaseInfo> {
     ReportBaseInfo selectReportBaseInfoByCalcId(@Param("calcId") String calcId);
 
     /**
-     * @Description 查询指标报表的所有id以及名称
+     * @Description 查询指标报表的所有id以及名称(包括增加的手工数据指标)
      * @Author hsh
      * @param reportType 报表类型
      * @return list
      * @Date 2024/4/1 16:49
      */
-    @Select(" select report_name as name, report_id as 'code' from report_base_info where flag = 'Y' and report_type = #{reportType} ")
+    @Select(" select report_name as name, report_id as 'code' from report_base_info where flag = 'Y' and (report_type = 'sg' or report_type = #{reportType}) ")
     List<Map<String, Object>> selectTargetZbReportId(@Param("reportType") String reportType);
 
 }

+ 2 - 0
src/main/java/thyyxxk/webserver/entity/targetmanagement/TargetManagement.java

@@ -43,4 +43,6 @@ public class TargetManagement {
     private String baseSql;
     // 指标年度周期
     private String reportCycle;
+    // 关键字
+    private String text;
 }

+ 73 - 1
src/main/java/thyyxxk/webserver/service/targetmanagement/TargetManagementService.java

@@ -726,6 +726,57 @@ public class TargetManagementService {
         return ResultVoUtil.success(resultMap);
     }
 
+    /**
+     * @Description 更新单个指标结果
+     * @Author hsh
+     * @param result 指标结果
+     * @return map
+     * @Date 2024/12/11 17:21
+     */
+    public ResultVo<Map<String, Object>> saveTargetReportResultSinge(ZbReportResult result){
+        Map<String, Object> resultMap = new HashMap<>();
+
+        if(result == null || StringUtil.isBlank(result.getYear())){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "指标结果记录不存在,请检查!");
+        }
+
+        UserInfo user = redis.getUserInfoByCode(TokenUtil.getInstance().getTokenUserId());
+        result.setOp(user.getName() != null ? user.getName().trim() : null);
+        result.setOpId(user.getCodeRs());
+        result.setOpTime(DateUtil.now());
+
+        // 入库或更新操作
+        int n = updateAndSaveTargetReportResult(result);
+        if (n <= 0) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新指标结果失败!");
+        }
+        resultMap.put("cg", "更新指标结果成功");
+        return ResultVoUtil.success(resultMap);
+    }
+
+    /**
+     * @Description 根据id,pid和年度删除指标结果
+     * @Author hsh
+     * @param result id,pid和年度等指标结果信息
+     * @return map
+     * @Date 2024/12/11 17:34
+     */
+    public ResultVo<Map<String, Object>> delTargetReportResultByYear(ZbReportResult result){
+        Map<String, Object> resultMap = new HashMap<>();
+
+        if(result == null || StringUtil.isBlank(result.getId()) || StringUtil.isBlank(result.getPid()) || StringUtil.isBlank(result.getYear())){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "指标结果记录不存在,请检查!");
+        }
+
+        // 根据id,pid和年度删除指标结果
+        int n = reportDao.deleteReportResultById(result.getId(), result.getPid(), result.getYear());
+        if (n <= 0) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除指标结果失败!");
+        }
+        resultMap.put("cg", "删除指标结果成功");
+        return ResultVoUtil.success(resultMap);
+    }
+
     /**
      * @description: 先删后保存数据
      * @author: hsh
@@ -775,6 +826,15 @@ public class TargetManagementService {
             reportDao.deleteReportBaseInfoById(info.getReportId());
         }
 
+        // 手工指标拼接基础sql
+        if(ReportUtil.SG.equals(info.getReportType())){
+            String bSql = info.getBaseSql();
+            info.setBaseSql("select " + bSql + " as sg");
+            UserInfo user = redis.getUserInfoByCode(TokenUtil.getInstance().getTokenUserId());
+            // 做一个标识
+            info.setDisplayType(user.getCode().trim());
+        }
+
         int n = dao.insert(info);
         if (n <= 0) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存指标详情失败!");
@@ -822,7 +882,7 @@ public class TargetManagementService {
     }
 
     /**
-     * @Description 查询指标报表的所有id以及名称
+     * @Description 查询指标报表的所有id以及名称(包括增加的手工数据指标)
      * @Author hsh
      * @param reportType 指标报表类型
      * @return list
@@ -1282,4 +1342,16 @@ public class TargetManagementService {
         return ResultVoUtil.success(reportDao.selectTargetMonthScoreSummary(dto));
     }
 
+    /**
+     * @Description 查询指标固定值(手工填写等)指标
+     * @Author hsh
+     * @param dto 查询条件
+     * @return list
+     * @Date 2024/12/4 16:26
+     */
+    public ResultVo<List<ReportBaseInfo>> selectTargetDictConstantData(TargetManagement dto) {
+        List<ReportBaseInfo> list = reportDao.selectTargetDictConstantData(dto);
+        return ResultVoUtil.success(list);
+    }
+
 }

+ 5 - 0
src/main/java/thyyxxk/webserver/utils/ReportUtil.java

@@ -54,6 +54,11 @@ public class ReportUtil {
 
     private static final String OTHER_PARAM = "其他";
 
+    /**
+     * 手工指标值(固定填写的值)
+     **/
+    public static final String SG = "sg";
+
     /**
      * @description: 拼接查询数据的sql(备注:采用了script标签包裹方式拼接sql)
      * @author: hsh