|
@@ -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);
|
|
|
+ }
|
|
|
+
|
|
|
}
|