Forráskód Böngészése

Merge branch 'master' into 'master'

增加指标得分

See merge request lighter/web-server!102
huangshuhua 1 éve
szülő
commit
0680c7da2b

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

@@ -13,6 +13,8 @@ import thyyxxk.webserver.entity.highreport.HighReportDto;
 import thyyxxk.webserver.entity.highreport.ReportBaseInfo;
 import thyyxxk.webserver.entity.highreport.TableDisplayInfo;
 import thyyxxk.webserver.entity.highreport.TableGroupInfo;
+import thyyxxk.webserver.entity.highreport.ZbReportCycle;
+import thyyxxk.webserver.entity.highreport.ZbReportCycleScore;
 import thyyxxk.webserver.entity.highreport.ZbReportResult;
 import thyyxxk.webserver.entity.highreport.ZdReportType;
 import thyyxxk.webserver.entity.targetmanagement.TargetDictTree;
@@ -173,4 +175,24 @@ public class TargetManagementController {
         return service.delTableDisplayByProp(reportId, levelId, prop);
     }
 
+    @GetMapping("/selectScoreCycle")
+    public ResultVo<List<ZbReportCycle>> selectScoreCycle(){
+        return service.selectScoreCycle();
+    }
+
+    @PostMapping("/updateTargetReportScore")
+    public ResultVo<Map<String, Object>> updateTargetReportScore(@RequestBody @Validated ZbReportCycleScore score){
+        return service.updateTargetReportScore(score);
+    }
+
+    @PostMapping("/selectTargetReportScore")
+    public ResultVo<ZbReportCycleScore> selectTargetReportScore(@RequestBody @Validated ZbReportCycleScore score){
+        return service.selectTargetReportScore(score);
+    }
+
+    @GetMapping("/selectScoreCyclePermissions")
+    public ResultVo<Map<String, Object>> selectScoreCyclePermissions(){
+        return service.selectScoreCyclePermissions();
+    }
+
 }

+ 16 - 0
src/main/java/thyyxxk/webserver/dao/his/targetmanagement/ZbReportCycleDao.java

@@ -0,0 +1,16 @@
+package thyyxxk.webserver.dao.his.targetmanagement;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.highreport.ZbReportCycle;
+
+import java.util.List;
+
+@Mapper
+public interface ZbReportCycleDao extends BaseMapper<ZbReportCycle> {
+
+    @Select(" select * from zb_report_cycle ")
+    List<ZbReportCycle> selectScoreCycle();
+
+}

+ 50 - 0
src/main/java/thyyxxk/webserver/dao/his/targetmanagement/ZbReportCycleScoreDao.java

@@ -0,0 +1,50 @@
+package thyyxxk.webserver.dao.his.targetmanagement;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+import thyyxxk.webserver.entity.highreport.ZbReportCycleScore;
+
+import java.util.Map;
+
+@Mapper
+public interface ZbReportCycleScoreDao extends BaseMapper<ZbReportCycleScore> {
+
+    @Select(" select * from zb_report_cycle_score where id = #{id} and report_cycle = #{reportCycle} ")
+    ZbReportCycleScore selectZbReportCycleScoreByReportCycle(@Param("id") String id, @Param("reportCycle") String reportCycle);
+
+    @Update("<script>" +
+            "update zb_report_cycle_score " +
+            "<trim prefix=\"set\" suffixOverrides=\",\">" +
+            "<if test=\"id != null and id != '' \">" +
+            "id = #{id}, " +
+            "</if>" +
+            "<if test=\"pid != null and pid != '' \">" +
+            "pid = #{pid}, " +
+            "</if>" +
+            "<if test=\"reportCycle != null and reportCycle != '' \">" +
+            "report_cycle = #{reportCycle}, " +
+            "</if>" +
+            "<if test=\"reportScore != null and reportScore != '' \">" +
+            "report_score = #{reportScore}, " +
+            "</if>" +
+            "<if test=\"criterionScore != null and criterionScore != '' \">" +
+            "criterion_score = #{criterionScore}, " +
+            "</if>" +
+            "<if test=\"authorId != null and authorId != '' \">" +
+            "author_id = #{authorId}, " +
+            "</if>" +
+            "<if test=\"authorName != null and authorName != '' \">" +
+            "author_name = #{authorName}, " +
+            "</if>" +
+            "</trim>" +
+            "where id = #{id} and report_cycle = #{reportCycle} " +
+            "</script>")
+    int updateTargetReportScoreById(ZbReportCycleScore score);
+
+    @Select(" select name from sys_parameters where code = 'targetScore' ")
+    String selectScoreCyclePermissions();
+
+}

+ 49 - 0
src/main/java/thyyxxk/webserver/entity/highreport/ZbReportCycle.java

@@ -0,0 +1,49 @@
+package thyyxxk.webserver.entity.highreport;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * @ClassName ZbReportYear
+ * @Author hsh
+ * @Date 2024/8/14 10:31
+ * @Version 1.0
+ * @Description 指标(年份)周期字典
+ **/
+@Data
+@TableName("zb_report_cycle")
+public class ZbReportCycle {
+
+    /**
+     * 指标报表周期
+     */
+    @TableId(value = "report_cycle", type = IdType.NONE)
+    private String reportCycle;
+    /**
+     * 年度范围
+     */
+    private String yearRange;
+    /**
+     * 开始年份
+     */
+    private String startYear;
+    /**
+     * 结束年份
+     */
+    private String endYear;
+    /**
+     * 指标年度标准分
+     */
+    private String criterionScore;
+    /**
+     * 指标年度总分
+     */
+    private String cycleScore;
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 49 - 0
src/main/java/thyyxxk/webserver/entity/highreport/ZbReportCycleScore.java

@@ -0,0 +1,49 @@
+package thyyxxk.webserver.entity.highreport;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * @ClassName zb_report_cycle_score
+ * @Author hsh
+ * @Date 2024/8/14 10:40
+ * @Version 1.0
+ * @Description 指标(年度)周期得分
+ **/
+@Data
+@TableName("zb_report_cycle_score")
+public class ZbReportCycleScore {
+
+    /**
+     * 指标id
+     */
+    @TableId(value = "id", type = IdType.NONE)
+    private String id;
+    /**
+     * 指标父id
+     */
+    private String pid;
+    /**
+     * 指标(年度)周期
+     */
+    private String reportCycle;
+    /**
+     * 指标(年度)周期得分
+     */
+    private String reportScore;
+    /**
+     * 指标(年度)周期标准得分(满分)
+     */
+    private String criterionScore;
+    /**
+     * 操作人id
+     */
+    private String authorId;
+    /**
+     * 操作人姓名
+     */
+    private String authorName;
+
+}

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

@@ -9,6 +9,8 @@ import thyyxxk.webserver.dao.his.highreport.HighReportDao;
 import thyyxxk.webserver.dao.his.targetmanagement.TableDisplayInfoDao;
 import thyyxxk.webserver.dao.his.targetmanagement.TableGroupInfoDao;
 import thyyxxk.webserver.dao.his.targetmanagement.TargetManagementDao;
+import thyyxxk.webserver.dao.his.targetmanagement.ZbReportCycleDao;
+import thyyxxk.webserver.dao.his.targetmanagement.ZbReportCycleScoreDao;
 import thyyxxk.webserver.dao.his.targetmanagement.ZbZdBaseInfoDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.highreport.HighReportDto;
@@ -16,6 +18,8 @@ import thyyxxk.webserver.entity.highreport.ReportBaseInfo;
 import thyyxxk.webserver.entity.highreport.ReportType;
 import thyyxxk.webserver.entity.highreport.TableDisplayInfo;
 import thyyxxk.webserver.entity.highreport.TableGroupInfo;
+import thyyxxk.webserver.entity.highreport.ZbReportCycle;
+import thyyxxk.webserver.entity.highreport.ZbReportCycleScore;
 import thyyxxk.webserver.entity.highreport.ZbReportResult;
 import thyyxxk.webserver.entity.highreport.ZdReportType;
 import thyyxxk.webserver.entity.login.UserInfo;
@@ -61,15 +65,22 @@ public class TargetManagementService {
 
     private final TableDisplayInfoDao displayDao;
 
+    private final ZbReportCycleDao cycleDao;
+
+    private final ZbReportCycleScoreDao scoreDao;
+
     @Autowired
     public TargetManagementService(TargetManagementDao dao, ZbZdBaseInfoDao zbZdDao, HighReportDao reportDao,
-                                   RedisLikeService redis, TableGroupInfoDao tableDao, TableDisplayInfoDao displayDao) {
+                                   RedisLikeService redis, TableGroupInfoDao tableDao, TableDisplayInfoDao displayDao,
+                                   ZbReportCycleDao cycleDao, ZbReportCycleScoreDao scoreDao) {
         this.dao = dao;
         this.zbZdDao = zbZdDao;
         this.reportDao = reportDao;
         this.redis = redis;
         this.tableDao = tableDao;
         this.displayDao = displayDao;
+        this.cycleDao = cycleDao;
+        this.scoreDao = scoreDao;
     }
 
     /**
@@ -890,4 +901,88 @@ public class TargetManagementService {
         }
     }
 
+    /**
+     * @Description 查询指标年度周期明细
+     * @Author hsh
+     * @return list 指标年度周期明细
+     * @Date 2024/8/15 9:41
+     */
+    public ResultVo<List<ZbReportCycle>> selectScoreCycle(){
+        List<ZbReportCycle> list = cycleDao.selectScoreCycle();
+        return ResultVoUtil.success(list);
+    }
+
+    /**
+     * @Description 更新指标周期得分
+     * @Author hsh
+     * @param score 指标周期得分详情
+     * @return map
+     * @Date 2024/8/15 10:19
+     */
+    public ResultVo<Map<String, Object>> updateTargetReportScore(ZbReportCycleScore score){
+        Map<String, Object> resultMap = new HashMap<>();
+        String id = score.getId();
+        String reportCycle = score.getReportCycle();
+        if(StringUtil.isBlank(id) || StringUtil.isBlank(reportCycle)){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "指标id或年度周期信息不全,请检查!");
+        }
+        ZbReportCycleScore s = scoreDao.selectZbReportCycleScoreByReportCycle(id, reportCycle);
+        UserInfo user = redis.getUserInfoByCode(TokenUtil.getInstance().getTokenUserId());
+        score.setAuthorId(user.getCode().trim());
+        score.setAuthorName(user.getName().trim());
+        int num;
+        if(null != s){
+            num = scoreDao.updateTargetReportScoreById(score);
+        } else {
+            num = scoreDao.insert(score);
+        }
+        if(num > 0){
+            resultMap.put("cg", "更新指标周期得分成功!");
+        }
+        return ResultVoUtil.success(resultMap);
+    }
+
+    /**
+     * @Description 查询指标周期得分
+     * @Author hsh
+     * @param score 指标周期得分参数
+     * @return score 指标周期得分
+     * @Date 2024/8/15 15:47
+     */
+    public ResultVo<ZbReportCycleScore> selectTargetReportScore(ZbReportCycleScore score){
+        String id = score.getId();
+        String reportCycle = score.getReportCycle();
+        if(StringUtil.isBlank(id) || StringUtil.isBlank(reportCycle)){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "指标id或年度周期信息不全,请检查!");
+        }
+        ZbReportCycleScore zbScore = scoreDao.selectZbReportCycleScoreByReportCycle(id, reportCycle);
+        return ResultVoUtil.success(zbScore);
+    }
+
+    /**
+     * @Description 查询计算指标得分的权限
+     * @Author hsh
+     * @return map
+     * @Date 2024/8/15 16:54
+     */
+    public ResultVo<Map<String, Object>> selectScoreCyclePermissions(){
+        Map<String, Object> resultMap = new HashMap<>();
+        String permissions = scoreDao.selectScoreCyclePermissions();
+        if("N".equals(permissions)){
+            // 不做计算指标得分的权限限制
+            resultMap.put("permissions", 0);
+        } else {
+            UserInfo user = redis.getUserInfoByCode(TokenUtil.getInstance().getTokenUserId());
+            String code = user.getCode().trim();
+            if(permissions.contains(code)){
+                // 有权限计算指标得分
+                resultMap.put("permissions", 1);
+            } else {
+                // 没有权限计算指标得分
+                resultMap.put("permissions", 2);
+            }
+        }
+        return ResultVoUtil.success(resultMap);
+    }
+
 }