Browse Source

2026-07-17

异常规则配置
master
fengyuan_yang 4 months ago
parent
commit
3056b4555f
  1. 24
      src/main/java/com/gaotao/modules/schedule/controller/ScheduleController.java
  2. 9
      src/main/java/com/gaotao/modules/schedule/mapper/ScheduleTodoMessageMapper.java
  3. 16
      src/main/java/com/gaotao/modules/schedule/service/ScheduleService.java
  4. 74
      src/main/java/com/gaotao/modules/schedule/service/impl/ScheduleServiceImpl.java
  5. 104
      src/main/resources/mapper/schedule/ScheduleTodoMessageMapper.xml

24
src/main/java/com/gaotao/modules/schedule/controller/ScheduleController.java

@ -1330,6 +1330,30 @@ public class ScheduleController extends AbstractController {
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000)); .put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
} }
/**
* 功能代办中心:统计
*/
@PostMapping(value = "getTodoCenterStats")
public R getTodoCenterStats(@RequestBody Map<String, Object> inData) {
Map<String, Object> resultMap = scheduleService.getTodoCenterStats(inData);
return R.ok()
.put("code", 200)
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
.put("resultMap", resultMap);
}
/**
* 功能代办中心:分页查询
*/
@PostMapping(value = "searchTodoCenterList")
public R searchTodoCenterList(@RequestBody Map<String, Object> inData) {
PageUtils page = scheduleService.searchTodoCenterList(inData);
return R.ok()
.put("code", 200)
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
.put("page", page);
}
/** /**
* @Author LR * @Author LR
* @Description 执行创建分卷的业务逻辑 * @Description 执行创建分卷的业务逻辑

9
src/main/java/com/gaotao/modules/schedule/mapper/ScheduleTodoMessageMapper.java

@ -4,6 +4,9 @@ import com.gaotao.modules.schedule.entity.ScheduleTodoMessageEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface ScheduleTodoMessageMapper { public interface ScheduleTodoMessageMapper {
@ -20,4 +23,10 @@ public interface ScheduleTodoMessageMapper {
@Param("orderNo") String orderNo, @Param("orderNo") String orderNo,
@Param("seqNo") String seqNo, @Param("seqNo") String seqNo,
@Param("messageSourceLike") String messageSourceLike); @Param("messageSourceLike") String messageSourceLike);
List<Map<String, Object>> searchTodoCenterList(@Param("query") Map<String, Object> query);
Integer countTodoCenterList(@Param("query") Map<String, Object> query);
Map<String, Object> getTodoCenterStats(@Param("query") Map<String, Object> query);
} }

16
src/main/java/com/gaotao/modules/schedule/service/ScheduleService.java

@ -779,6 +779,22 @@ public interface ScheduleService {
*/ */
void completeSplitRuleTodoOperation(SearchScheduleData inData); void completeSplitRuleTodoOperation(SearchScheduleData inData);
/**
* 功能代办中心:查询统计信息
*
* @param inData 查询条件(site/buNo/keyword等)
* @return 统计数据
*/
Map<String, Object> getTodoCenterStats(Map<String, Object> inData);
/**
* 功能代办中心:分页查询代办列表
*
* @param inData 查询条件(page/limit/site/buNo/status等)
* @return 分页结果
*/
PageUtils searchTodoCenterList(Map<String, Object> inData);
/** /**
* @return void * @return void
* @Author LR * @Author LR

74
src/main/java/com/gaotao/modules/schedule/service/impl/ScheduleServiceImpl.java

@ -3714,6 +3714,80 @@ public class ScheduleServiceImpl implements ScheduleService {
} }
} }
@Override
public Map<String, Object> getTodoCenterStats(Map<String, Object> inData) {
Map<String, Object> query = buildTodoCenterQuery(inData, false);
Map<String, Object> dbStats = scheduleTodoMessageMapper.getTodoCenterStats(query);
Map<String, Object> result = new HashMap<>();
result.put("totalCount", toDefaultInt(dbStats == null ? null : dbStats.get("totalCount"), 0));
result.put("pendingAuditCount", toDefaultInt(dbStats == null ? null : dbStats.get("pendingAuditCount"), 0));
result.put("pendingOperateCount", toDefaultInt(dbStats == null ? null : dbStats.get("pendingOperateCount"), 0));
result.put("lockPendingCount", toDefaultInt(dbStats == null ? null : dbStats.get("lockPendingCount"), 0));
result.put("pendingTotalCount", toDefaultInt(dbStats == null ? null : dbStats.get("pendingTotalCount"), 0));
result.put("completedCount", toDefaultInt(dbStats == null ? null : dbStats.get("completedCount"), 0));
return result;
}
@Override
public PageUtils searchTodoCenterList(Map<String, Object> inData) {
Map<String, Object> query = buildTodoCenterQuery(inData, true);
int pageNo = toPositiveInt(inData == null ? null : inData.get("page"), 1);
int pageSize = toPositiveInt(inData == null ? null : inData.get("limit"), 15);
Integer totalCount = scheduleTodoMessageMapper.countTodoCenterList(query);
List<Map<String, Object>> list = new ArrayList<>();
if (totalCount != null && totalCount > 0) {
list = scheduleTodoMessageMapper.searchTodoCenterList(query);
}
return new PageUtils(list, totalCount == null ? 0 : totalCount, pageSize, pageNo);
}
private Map<String, Object> buildTodoCenterQuery(Map<String, Object> inData, boolean includePaging) {
Map<String, Object> query = new HashMap<>();
query.put("site", trimToEmpty(inData == null ? null : inData.get("site")));
query.put("buNo", trimToEmpty(inData == null ? null : inData.get("buNo")));
query.put("infoCode", trimToEmpty(inData == null ? null : inData.get("infoCode")));
query.put("orderNo", trimToEmpty(inData == null ? null : inData.get("orderNo")));
query.put("seqNo", trimToEmpty(inData == null ? null : inData.get("seqNo")));
query.put("responsibilityDept", trimToEmpty(inData == null ? null : inData.get("responsibilityDept")));
query.put("keyword", trimToEmpty(inData == null ? null : inData.get("keyword")));
query.put("forceType", trimToEmpty(inData == null ? null : inData.get("forceType")));
query.put("todoStatus", trimToEmpty(inData == null ? null : inData.get("todoStatus")));
query.put("status", trimToEmpty(inData == null ? null : inData.get("status")));
if (includePaging) {
int pageNo = toPositiveInt(inData == null ? null : inData.get("page"), 1);
int pageSize = toPositiveInt(inData == null ? null : inData.get("limit"), 15);
query.put("offset", (pageNo - 1) * pageSize);
query.put("limit", pageSize);
}
return query;
}
private int toPositiveInt(Object value, int defaultValue) {
Integer parsed = toInteger(value);
if (parsed == null || parsed <= 0) {
return defaultValue;
}
return parsed;
}
private int toDefaultInt(Object value, int defaultValue) {
Integer parsed = toInteger(value);
if (parsed == null) {
return defaultValue;
}
return parsed;
}
private String trimToEmpty(Object value) {
if (value == null) {
return "";
}
String text = String.valueOf(value).trim();
return StringUtils.hasText(text) ? text : "";
}
private List<SplitRollMetricContext> buildSplitRollMetricContexts(SearchScheduleData inData) { private List<SplitRollMetricContext> buildSplitRollMetricContexts(SearchScheduleData inData) {
List<SplitRollMetricContext> contextList = new ArrayList<>(); List<SplitRollMetricContext> contextList = new ArrayList<>();
List<Map<String, Object>> rollRows = inData.getRollRows(); List<Map<String, Object>> rollRows = inData.getRollRows();

104
src/main/resources/mapper/schedule/ScheduleTodoMessageMapper.xml

@ -76,4 +76,108 @@
ORDER BY created_time DESC, info_code DESC ORDER BY created_time DESC, info_code DESC
) )
</update> </update>
<sql id="todoCenterWhereSql">
<where>
1 = 1
<if test="query.site != null and query.site != ''">
AND stm.site = #{query.site}
</if>
<if test="query.buNo != null and query.buNo != ''">
AND stm.bu_no = #{query.buNo}
</if>
<if test="query.infoCode != null and query.infoCode != ''">
AND stm.info_code LIKE '%' + #{query.infoCode} + '%'
</if>
<if test="query.orderNo != null and query.orderNo != ''">
AND stm.order_no LIKE '%' + #{query.orderNo} + '%'
</if>
<if test="query.seqNo != null and query.seqNo != ''">
AND stm.seq_no LIKE '%' + #{query.seqNo} + '%'
</if>
<if test="query.responsibilityDept != null and query.responsibilityDept != ''">
AND stm.responsibility_dept = #{query.responsibilityDept}
</if>
<if test="query.keyword != null and query.keyword != ''">
AND (
stm.info_code LIKE '%' + #{query.keyword} + '%'
OR stm.order_no LIKE '%' + #{query.keyword} + '%'
OR stm.seq_no LIKE '%' + #{query.keyword} + '%'
OR stm.message_source LIKE '%' + #{query.keyword} + '%'
OR sr.role_name LIKE '%' + #{query.keyword} + '%'
)
</if>
<if test="query.forceType != null and query.forceType != ''">
<choose>
<when test="query.forceType == 'force'">
AND stm.lock_flag = 'Y'
</when>
<when test="query.forceType == 'hint'">
AND (stm.lock_flag IS NULL OR stm.lock_flag != 'Y')
</when>
</choose>
</if>
<if test="query.todoStatus != null and query.todoStatus != ''">
<choose>
<when test="query.todoStatus == 'pendingAudit'">
AND stm.audit_flag = 'N'
AND stm.operate_flag = 'N'
</when>
<when test="query.todoStatus == 'reportable'">
AND stm.audit_flag = 'Y'
AND stm.operate_flag = 'N'
</when>
<when test="query.todoStatus == 'completed'">
AND stm.audit_flag = 'Y'
AND stm.operate_flag = 'Y'
</when>
</choose>
</if>
</where>
</sql>
<select id="searchTodoCenterList" resultType="java.util.Map">
SELECT
stm.site AS site,
stm.bu_no AS buNo,
stm.info_code AS infoCode,
stm.seq_no AS seqNo,
stm.order_no AS orderNo,
stm.created_by AS createdBy,
stm.created_time AS createdTime,
stm.message_source AS messageSource,
stm.audit_flag AS auditFlag,
stm.operate_flag AS operateFlag,
stm.lock_flag AS lockFlag,
stm.responsibility_dept AS responsibilityDept,
ISNULL(sr.role_name, stm.responsibility_dept) AS responsibilityDeptName
FROM schedule_todo_message stm
LEFT JOIN sys_role sr
ON CAST(sr.role_id AS NVARCHAR(100)) = stm.responsibility_dept
<include refid="todoCenterWhereSql"/>
ORDER BY stm.created_time DESC, stm.info_code DESC
OFFSET #{query.offset} ROWS FETCH NEXT #{query.limit} ROWS ONLY
</select>
<select id="countTodoCenterList" resultType="java.lang.Integer">
SELECT COUNT(1)
FROM schedule_todo_message stm
LEFT JOIN sys_role sr
ON CAST(sr.role_id AS NVARCHAR(100)) = stm.responsibility_dept
<include refid="todoCenterWhereSql"/>
</select>
<select id="getTodoCenterStats" resultType="java.util.Map">
SELECT
COUNT(1) AS totalCount,
ISNULL(SUM(CASE WHEN stm.audit_flag = 'N' AND stm.operate_flag = 'N' THEN 1 ELSE 0 END), 0) AS pendingAuditCount,
ISNULL(SUM(CASE WHEN stm.audit_flag = 'Y' AND stm.operate_flag = 'N' THEN 1 ELSE 0 END), 0) AS pendingOperateCount,
ISNULL(SUM(CASE WHEN stm.audit_flag = 'N' AND stm.lock_flag = 'Y' THEN 1 ELSE 0 END), 0) AS lockPendingCount,
ISNULL(SUM(CASE WHEN stm.operate_flag = 'N' THEN 1 ELSE 0 END), 0) AS pendingTotalCount,
ISNULL(SUM(CASE WHEN stm.audit_flag = 'Y' AND stm.operate_flag = 'Y' THEN 1 ELSE 0 END), 0) AS completedCount
FROM schedule_todo_message stm
LEFT JOIN sys_role sr
ON CAST(sr.role_id AS NVARCHAR(100)) = stm.responsibility_dept
<include refid="todoCenterWhereSql"/>
</select>
</mapper> </mapper>
Loading…
Cancel
Save