Commit 2a30d5ca260f99ab486fda4d60fd2021f7006fee

Authored by 陈强
1 parent 91a27c26

IPO驾驶舱-区域板块指标每日明细相关接口修改新增,安全履职检查相关接口新增,质量缺陷、多能工相关接口优化

Showing 21 changed files with 1363 additions and 62 deletions
... ... @@ -17,17 +17,27 @@ public interface Constant {
17 17 String DEFAULT_USER_ID = "sync_admin";
18 18
19 19 /**
20   - * 停线板块编码:物流
  20 + * 板块编码:物流
21 21 */
22 22 String BLOCK_CODE_LOGISTICS = "W";
23 23
24 24 /**
25   - * 停线板块编码:设备
  25 + * 板块编码:设备
26 26 */
27 27 String BLOCK_CODE_EQUIPMENT = "M";
28 28
29 29 /**
30   - * 停线板块编码:质量
  30 + * 板块编码:质量
31 31 */
32 32 String BLOCK_CODE_QUALITY = "Q";
  33 +
  34 + /**
  35 + * 板块编码:安全
  36 + */
  37 + String BLOCK_CODE_SAFE = "S";
  38 +
  39 + /**
  40 + * 成本
  41 + */
  42 + String BLOCK_CODE_COST = "C";
33 43 }
... ...
1 1 package com.qgutech.qgyun.apaas.sync.cpsipo.controller;
2 2
  3 +import com.qgutech.qgyun.apaas.sync.cpsipo.dto.AreaBlockIndicatorDailyGroupDTO;
3 4 import com.qgutech.qgyun.apaas.sync.cpsipo.model.AreaBlockIndicatorDaily;
4 5 import com.qgutech.qgyun.apaas.sync.cpsipo.service.AreaBlockIndicatorDailyService;
5 6 import com.qgutech.qgyun.framework.common.result.JsonResult;
6 7 import lombok.extern.slf4j.Slf4j;
7 8 import org.springframework.web.bind.annotation.GetMapping;
8 9 import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestParam;
9 11 import org.springframework.web.bind.annotation.RestController;
10 12
11 13 import javax.annotation.Resource;
  14 +import java.util.Calendar;
12 15 import java.util.List;
13 16
14 17 /**
... ... @@ -32,4 +35,73 @@ public class AreaBlockIndicatorDailyController {
32 35 List<AreaBlockIndicatorDaily> list = areaBlockIndicatorDailyService.listAll();
33 36 return new JsonResult<>(true, "成功", list);
34 37 }
  38 +
  39 + /**
  40 + * 获取安全板块下看板项目的区域板块指标每日明细,按指标分组返回。
  41 + * <p>
  42 + * 返回结果中每个指标对应一个列表,列表中为月份内每天的记录数据。
  43 + * 每天每个指标多条记录取第一条,无记录则默认一条实际值为0的记录。
  44 + *
  45 + * @param qyxx 区域信息,可为空
  46 + * @param month 月份(1-12),可为空,默认当前月
  47 + * @return 按指标分组的每日明细列表
  48 + */
  49 + @GetMapping("/list/safetyKanbanDaily")
  50 + public JsonResult listSafetyKanbanDaily(@RequestParam(required = false) String qyxx,
  51 + @RequestParam(required = false) Integer month) {
  52 + // 如果月份为空,默认当前月
  53 + if (month == null) {
  54 + Calendar calendar = Calendar.getInstance();
  55 + month = calendar.get(Calendar.MONTH) + 1;
  56 + }
  57 +
  58 + List<AreaBlockIndicatorDailyGroupDTO> list = areaBlockIndicatorDailyService.listSafetyKanbanDailyByIndicator(qyxx, month);
  59 + return new JsonResult<>(true, "成功", list);
  60 + }
  61 +
  62 + /**
  63 + * 获取质量板块下看板项目的区域板块指标每日明细,按指标分组返回。
  64 + * <p>
  65 + * 返回结果中每个指标对应一个列表,列表中为月份内每天的记录数据。
  66 + * 每天每个指标多条记录取第一条,无记录则默认一条实际值为0的记录。
  67 + *
  68 + * @param qyxx 区域信息,可为空
  69 + * @param month 月份(1-12),可为空,默认当前月
  70 + * @return 按指标分组的每日明细列表
  71 + */
  72 + @GetMapping("/list/qualityKanbanDaily")
  73 + public JsonResult listQualityKanbanDaily(@RequestParam(required = false) String qyxx,
  74 + @RequestParam(required = false) Integer month) {
  75 + // 如果月份为空,默认当前月
  76 + if (month == null) {
  77 + Calendar calendar = Calendar.getInstance();
  78 + month = calendar.get(Calendar.MONTH) + 1;
  79 + }
  80 +
  81 + List<AreaBlockIndicatorDailyGroupDTO> list = areaBlockIndicatorDailyService.listQualityKanbanDailyByIndicator(qyxx, month);
  82 + return new JsonResult<>(true, "成功", list);
  83 + }
  84 +
  85 + /**
  86 + * 获取成本板块下看板项目的区域板块指标每日明细,按指标分组返回。
  87 + * <p>
  88 + * 返回结果中每个指标对应一个列表,列表中为月份内每天的记录数据。
  89 + * 每天每个指标多条记录取第一条,无记录则默认一条实际值为0的记录。
  90 + *
  91 + * @param qyxx 区域信息,可为空
  92 + * @param month 月份(1-12),可为空,默认当前月
  93 + * @return 按指标分组的每日明细列表
  94 + */
  95 + @GetMapping("/list/costKanbanDaily")
  96 + public JsonResult listCostKanbanDaily(@RequestParam(required = false) String qyxx,
  97 + @RequestParam(required = false) Integer month) {
  98 + // 如果月份为空,默认当前月
  99 + if (month == null) {
  100 + Calendar calendar = Calendar.getInstance();
  101 + month = calendar.get(Calendar.MONTH) + 1;
  102 + }
  103 +
  104 + List<AreaBlockIndicatorDailyGroupDTO> list = areaBlockIndicatorDailyService.listCostKanbanDailyByIndicator(qyxx, month);
  105 + return new JsonResult<>(true, "成功", list);
  106 + }
35 107 }
... ...
... ... @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestParam;
11 11 import org.springframework.web.bind.annotation.RestController;
12 12
13 13 import javax.annotation.Resource;
  14 +import java.util.Calendar;
14 15 import java.util.List;
15 16
16 17 /**
... ... @@ -46,7 +47,14 @@ public class AreaEmployeeAttendanceDetailController {
46 47 * @return
47 48 */
48 49 @GetMapping("/summary/daily")
49   - public JsonResult summaryDaily(@RequestParam String qyxx, @RequestParam Integer month) {
  50 + public JsonResult summaryDaily(@RequestParam(required = false) String qyxx,
  51 + @RequestParam(required = false) Integer month) {
  52 + // 如果月份为空,默认当前月
  53 + if (month == null) {
  54 + Calendar calendar = Calendar.getInstance();
  55 + month = calendar.get(Calendar.MONTH) + 1;
  56 + }
  57 +
50 58 List<AttendanceDailySummaryDTO> list = areaEmployeeAttendanceDetailService.summaryDailyByMonth(qyxx, month);
51 59 return new JsonResult<>(true, "成功", list);
52 60 }
... ...
... ... @@ -36,25 +36,32 @@ public class AreaScorecardController {
36 36 }
37 37
38 38 /**
39   - * 按区域和月份查询记分卡列表
  39 + * 按区域、年份和月份查询记分卡列表
40 40 *
41 41 * @param qyxx 区域信息,可为空
  42 + * @param year 年份,可为空,默认当前年
42 43 * @param month 月份(1-12),可为空,默认当前月
43 44 * @return 记分卡列表
44 45 */
45 46 @GetMapping("/list/byMonth")
46 47 public JsonResult listByMonth(@RequestParam(required = false) String qyxx,
  48 + @RequestParam(required = false) Integer year,
47 49 @RequestParam(required = false) Integer month) {
  50 + // 如果年份为空,默认当前年
  51 + if (year == null) {
  52 + Calendar calendar = Calendar.getInstance();
  53 + year = calendar.get(Calendar.YEAR);
  54 + }
48 55 // 如果月份为空,默认当前月
49 56 if (month == null) {
50 57 Calendar calendar = Calendar.getInstance();
51 58 month = calendar.get(Calendar.MONTH) + 1;
52 59 }
53   -
  60 +
54 61 // 将月份转换为枚举格式:1 -> #1#, 2 -> #2#, ..., 12 -> #12#
55 62 String yuefem = "#" + month + "#";
56   -
57   - List<AreaScorecard> list = areaScorecardService.listByQyxxAndYuefem(qyxx, yuefem);
  63 +
  64 + List<AreaScorecard> list = areaScorecardService.listByQyxxAndYearAndYuefem(qyxx, year, yuefem);
58 65 return new JsonResult<>(true, "成功", list);
59 66 }
60 67 }
... ...
... ... @@ -41,7 +41,7 @@ public class FiveSMapController {
41 41 * @return
42 42 */
43 43 @GetMapping("/list/area")
44   - public JsonResult listByArea(@RequestParam String qyxx) {
  44 + public JsonResult listByArea(@RequestParam(required = false) String qyxx) {
45 45 List<FiveSMap> list = fiveSMapService.listByArea(qyxx);
46 46 return new JsonResult<>(true, "成功", list);
47 47 }
... ...
... ... @@ -45,7 +45,7 @@ public class MultiSkilledWorkerController {
45 45 * @return
46 46 */
47 47 @GetMapping("/summary/area")
48   - public JsonResult summaryByArea(@RequestParam String qyxx) {
  48 + public JsonResult summaryByArea(@RequestParam(required = false) String qyxx) {
49 49 MultiSkilledWorkerSummaryDTO summary = multiSkilledWorkerService.summaryByArea(qyxx);
50 50 return new JsonResult<>(true, "成功", summary);
51 51 }
... ...
1 1 package com.qgutech.qgyun.apaas.sync.cpsipo.controller;
2 2
  3 +import com.qgutech.qgyun.apaas.sync.cpsipo.dto.SafetyObservationDailySummaryDTO;
3 4 import com.qgutech.qgyun.apaas.sync.cpsipo.model.SafetyObservation;
4 5 import com.qgutech.qgyun.apaas.sync.cpsipo.service.SafetyObservationService;
5 6 import com.qgutech.qgyun.framework.common.result.JsonResult;
6 7 import lombok.extern.slf4j.Slf4j;
7 8 import org.springframework.web.bind.annotation.GetMapping;
8 9 import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestParam;
9 11 import org.springframework.web.bind.annotation.RestController;
10 12
11 13 import javax.annotation.Resource;
  14 +import java.util.Calendar;
12 15 import java.util.List;
13 16
14 17 /**
... ... @@ -32,4 +35,43 @@ public class SafetyObservationController {
32 35 List<SafetyObservation> list = safetyObservationService.listAll();
33 36 return new JsonResult<>(true, "成功", list);
34 37 }
  38 +
  39 + /**
  40 + * 按区域、月份汇总每日安全观察与履职检查信息。
  41 + * <p>
  42 + * 每日明细记录条数为走访工位数,抽查结果为异常(ccjg=#2#)的记录条数为问题数。
  43 + * 返回每日汇总统计信息,从月初到当前日期(当前月)或月末(其他月份)缺记录的日期自动补一条工位数和问题数都为0的记录。
  44 + *
  45 + * @param qyxx 区域信息,可为空
  46 + * @param month 月份(1-12),可为空,默认当前月
  47 + * @return 每日汇总统计列表
  48 + */
  49 + @GetMapping("/summary/daily")
  50 + public JsonResult summaryDaily(@RequestParam(required = false) String qyxx,
  51 + @RequestParam(required = false) Integer month) {
  52 + // 如果月份为空,默认当前月
  53 + if (month == null) {
  54 + Calendar calendar = Calendar.getInstance();
  55 + month = calendar.get(Calendar.MONTH) + 1;
  56 + }
  57 +
  58 + List<SafetyObservationDailySummaryDTO> list = safetyObservationService.summaryDailyByMonth(qyxx, month);
  59 + return new JsonResult<>(true, "成功", list);
  60 + }
  61 +
  62 + /**
  63 + * 按区域、检查日期查询安全履职检查明细列表。
  64 + * <p>
  65 + * 返回列表补全区域名称/编号、班组名称/编号与观察工位名称/编号。
  66 + *
  67 + * @param qyxx 区域信息,可为空
  68 + * @param jcrq 检查日期(yyyy-MM-dd),必填
  69 + * @return 安全履职检查明细列表
  70 + */
  71 + @GetMapping("/list/detail")
  72 + public JsonResult listDetail(@RequestParam(required = false) String qyxx,
  73 + @RequestParam String jcrq) {
  74 + List<SafetyObservation> list = safetyObservationService.listDetailByDate(qyxx, jcrq);
  75 + return new JsonResult<>(true, "成功", list);
  76 + }
35 77 }
... ...
  1 +package com.qgutech.qgyun.apaas.sync.cpsipo.dto;
  2 +
  3 +import com.qgutech.qgyun.apaas.sync.cpsipo.model.AreaBlockIndicatorDaily;
  4 +import lombok.Getter;
  5 +import lombok.Setter;
  6 +import lombok.ToString;
  7 +
  8 +import java.io.Serializable;
  9 +import java.util.List;
  10 +
  11 +/**
  12 + * 区域板块指标每日明细分组DTO
  13 + * <p>
  14 + * 按指标分组返回每日明细列表,每个指标对应一个列表,
  15 + * 列表中为月份内每天的记录数据(无记录时默认实际值为0)。
  16 + */
  17 +@Getter
  18 +@Setter
  19 +@ToString
  20 +public class AreaBlockIndicatorDailyGroupDTO implements Serializable {
  21 +
  22 + private static final long serialVersionUID = 1L;
  23 +
  24 + /*
  25 + * 指标信息id(AreaBlockIndicator id)
  26 + */
  27 + private String zhibxx;
  28 +
  29 + /*
  30 + * 指标名称
  31 + */
  32 + private String zhibmc;
  33 +
  34 + /*
  35 + * 板块信息id
  36 + */
  37 + private String bkxx;
  38 +
  39 + /*
  40 + * 板块名称
  41 + */
  42 + private String bkmc;
  43 +
  44 + /*
  45 + * 板块编码
  46 + */
  47 + private String bkbm;
  48 +
  49 + /*
  50 + * 区域信息id
  51 + */
  52 + private String qyxx;
  53 +
  54 + /*
  55 + * 区域名称
  56 + */
  57 + private String qymc;
  58 +
  59 + /*
  60 + * 区域编号
  61 + */
  62 + private String qybh;
  63 +
  64 + /*
  65 + * 线体信息id
  66 + */
  67 + private String xtxx;
  68 +
  69 + /*
  70 + * 线体名称
  71 + */
  72 + private String xtmc;
  73 +
  74 + /*
  75 + * 线体编号
  76 + */
  77 + private String xtbh;
  78 +
  79 + /*
  80 + * 车间信息id
  81 + */
  82 + private String cjxx;
  83 +
  84 + /*
  85 + * 车间名称
  86 + */
  87 + private String dwmc;
  88 +
  89 + /*
  90 + * 车间编号
  91 + */
  92 + private String dwbh;
  93 +
  94 + /*
  95 + * 室组信息id
  96 + */
  97 + private String szxx;
  98 +
  99 + /*
  100 + * 室组名称
  101 + */
  102 + private String szmc;
  103 +
  104 + /*
  105 + * 室组编号
  106 + */
  107 + private String szbh;
  108 +
  109 + /*
  110 + * 该指标在月份内每天的明细记录列表
  111 + */
  112 + private List<AreaBlockIndicatorDaily> dailyList;
  113 +}
... ...
... ... @@ -17,12 +17,17 @@ public class MultiSkilledEmployeeDTO implements Serializable {
17 17 private static final long serialVersionUID = 1L;
18 18
19 19 /*
20   - * 员工信息ID(组织用户ID)
  20 + * 区域员工信息ID
21 21 */
22   - private String ygxx;
  22 + private String qyygxx;
23 23
24 24 /*
25   - * 员工姓名(关联组织用户 UcUser)
  25 + * 员工姓名
26 26 */
27   - private String ygName;
  27 + private String qyygName;
  28 +
  29 + /*
  30 + * 员工号
  31 + */
  32 + private String qyygCode;
28 33 }
... ...
  1 +package com.qgutech.qgyun.apaas.sync.cpsipo.dto;
  2 +
  3 +import lombok.Getter;
  4 +import lombok.Setter;
  5 +import lombok.ToString;
  6 +
  7 +import java.io.Serializable;
  8 +
  9 +/**
  10 + * 安全观察与履职检查每日汇总结果
  11 + */
  12 +@Getter
  13 +@Setter
  14 +@ToString
  15 +public class SafetyObservationDailySummaryDTO implements Serializable {
  16 +
  17 + private static final long serialVersionUID = 1L;
  18 +
  19 + /*
  20 + * 检查日期(yyyy-MM-dd)
  21 + */
  22 + private String date;
  23 +
  24 + /*
  25 + * 走访工位数(当日明细记录条数)
  26 + */
  27 + private Integer gws;
  28 +
  29 + /*
  30 + * 问题数(当日抽查结果为异常的记录条数)
  31 + */
  32 + private Integer wts;
  33 +
  34 + public SafetyObservationDailySummaryDTO() {
  35 + }
  36 +
  37 + public SafetyObservationDailySummaryDTO(String date, Integer gws, Integer wts) {
  38 + this.date = date;
  39 + this.gws = gws;
  40 + this.wts = wts;
  41 + }
  42 +}
... ...
... ... @@ -23,6 +23,7 @@ public class AreaBlockIndicator extends BaseCorpModel {
23 23 public static final String SZXX = "szxx";
24 24 public static final String QYXX = "qyxx";
25 25 public static final String BKXX = "bkxx";
  26 + public static final String SFKBXM = "sfkbxm";
26 27 public static final String ZT = "zt";
27 28
28 29 /*
... ... @@ -56,6 +57,11 @@ public class AreaBlockIndicator extends BaseCorpModel {
56 57 private String zhib;
57 58
58 59 /*
  60 + * 是否看板项目
  61 + */
  62 + private Boolean sfkbxm;
  63 +
  64 + /*
59 65 * 状态-枚举:#1#-草稿,#2#-启用,#3#-停用
60 66 */
61 67 private String zt;
... ... @@ -67,6 +73,54 @@ public class AreaBlockIndicator extends BaseCorpModel {
67 73 @Transient
68 74 private String ztDesc;
69 75
  76 + /*
  77 + * 线体名称(非数据库字段,关联 XtLine 填充)
  78 + */
  79 + @Transient
  80 + private String xtmc;
  81 +
  82 + /*
  83 + * 线体编号(非数据库字段,关联 XtLine 填充)
  84 + */
  85 + @Transient
  86 + private String xtbh;
  87 +
  88 + /*
  89 + * 车间名称(非数据库字段,关联 Workshop 填充)
  90 + */
  91 + @Transient
  92 + private String dwmc;
  93 +
  94 + /*
  95 + * 车间编号(非数据库字段,关联 Workshop 填充)
  96 + */
  97 + @Transient
  98 + private String dwbh;
  99 +
  100 + /*
  101 + * 室组名称(非数据库字段,关联 RoomGroup 填充)
  102 + */
  103 + @Transient
  104 + private String szmc;
  105 +
  106 + /*
  107 + * 室组编号(非数据库字段,关联 RoomGroup 填充)
  108 + */
  109 + @Transient
  110 + private String szbh;
  111 +
  112 + /*
  113 + * 区域名称(非数据库字段,关联 Area 填充)
  114 + */
  115 + @Transient
  116 + private String qymc;
  117 +
  118 + /*
  119 + * 区域编号(非数据库字段,关联 Area 填充)
  120 + */
  121 + @Transient
  122 + private String qybh;
  123 +
70 124 /**
71 125 * 获取状态中文描述
72 126 *
... ...
... ... @@ -8,6 +8,7 @@ import lombok.ToString;
8 8 import org.springframework.format.annotation.DateTimeFormat;
9 9
10 10 import javax.persistence.Table;
  11 +import javax.persistence.Transient;
11 12 import java.util.Date;
12 13
13 14 /**
... ... @@ -68,4 +69,71 @@ public class AreaBlockIndicatorDaily extends BaseCorpModel {
68 69 * 实际值
69 70 */
70 71 private Double realVal;
  72 +
  73 + /**********非持久化字段*********/
  74 + /*
  75 + * 线体名称(非数据库字段,关联 XtLine 填充)
  76 + */
  77 + @Transient
  78 + private String xtmc;
  79 +
  80 + /*
  81 + * 线体编号(非数据库字段,关联 XtLine 填充)
  82 + */
  83 + @Transient
  84 + private String xtbh;
  85 +
  86 + /*
  87 + * 车间名称(非数据库字段,关联 Workshop 填充)
  88 + */
  89 + @Transient
  90 + private String dwmc;
  91 +
  92 + /*
  93 + * 车间编号(非数据库字段,关联 Workshop 填充)
  94 + */
  95 + @Transient
  96 + private String dwbh;
  97 +
  98 + /*
  99 + * 室组名称(非数据库字段,关联 RoomGroup 填充)
  100 + */
  101 + @Transient
  102 + private String szmc;
  103 +
  104 + /*
  105 + * 室组编号(非数据库字段,关联 RoomGroup 填充)
  106 + */
  107 + @Transient
  108 + private String szbh;
  109 +
  110 + /*
  111 + * 区域名称(非数据库字段,关联 Area 填充)
  112 + */
  113 + @Transient
  114 + private String qymc;
  115 +
  116 + /*
  117 + * 区域编号(非数据库字段,关联 Area 填充)
  118 + */
  119 + @Transient
  120 + private String qybh;
  121 +
  122 + /*
  123 + * 板块名称(非数据库字段,关联 BlockInfo 填充)
  124 + */
  125 + @Transient
  126 + private String bkmc;
  127 +
  128 + /*
  129 + * 板块编码(非数据库字段,关联 BlockInfo 填充)
  130 + */
  131 + @Transient
  132 + private String bkbm;
  133 +
  134 + /*
  135 + * 指标名称(非数据库字段,关联 AreaBlockIndicator 填充)
  136 + */
  137 + @Transient
  138 + private String zhibmc;
71 139 }
... ...
... ... @@ -347,6 +347,42 @@ public class SafetyObservation extends BaseCorpModel {
347 347 @Transient
348 348 private String ccjgDesc;
349 349
  350 + /*
  351 + * 区域名称(非数据库字段,关联 Area 填充)
  352 + */
  353 + @Transient
  354 + private String qymc;
  355 +
  356 + /*
  357 + * 区域编号(非数据库字段,关联 Area 填充)
  358 + */
  359 + @Transient
  360 + private String qybh;
  361 +
  362 + /*
  363 + * 班组名称(非数据库字段,关联 Team 填充)
  364 + */
  365 + @Transient
  366 + private String bzmc;
  367 +
  368 + /*
  369 + * 班组编号(非数据库字段,关联 Team 填充)
  370 + */
  371 + @Transient
  372 + private String bzbh;
  373 +
  374 + /*
  375 + * 观察工位名称(非数据库字段,关联 Workstation 填充)
  376 + */
  377 + @Transient
  378 + private String gwmc;
  379 +
  380 + /*
  381 + * 观察工位编号(非数据库字段,关联 Workstation 填充)
  382 + */
  383 + @Transient
  384 + private String gwbh;
  385 +
350 386 /**
351 387 * 获取抽查结果中文描述
352 388 *
... ...
1 1 package com.qgutech.qgyun.apaas.sync.cpsipo.service;
2 2
  3 +import com.qgutech.qgyun.apaas.sync.constant.Constant;
  4 +import com.qgutech.qgyun.apaas.sync.cps.model.Area;
  5 +import com.qgutech.qgyun.apaas.sync.cps.model.RoomGroup;
  6 +import com.qgutech.qgyun.apaas.sync.cps.model.Workshop;
  7 +import com.qgutech.qgyun.apaas.sync.cps.model.XtLine;
  8 +import com.qgutech.qgyun.apaas.sync.cps.service.AreaService;
  9 +import com.qgutech.qgyun.apaas.sync.cps.service.RoomGroupService;
  10 +import com.qgutech.qgyun.apaas.sync.cps.service.WorkshopService;
  11 +import com.qgutech.qgyun.apaas.sync.cps.service.XtLineService;
  12 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.BlockInfo;
  13 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.service.BlockInfoService;
  14 +import com.qgutech.qgyun.apaas.sync.cpsipo.dto.AreaBlockIndicatorDailyGroupDTO;
  15 +import com.qgutech.qgyun.apaas.sync.cpsipo.model.AreaBlockIndicator;
  16 +import com.qgutech.qgyun.apaas.sync.utils.DateDealUtils;
3 17 import com.qgutech.qgyun.framework.database.mybatis.service.BaseServiceImpl;
4 18 import com.qgutech.qgyun.apaas.sync.base.BoErrorCode;
5 19 import com.qgutech.qgyun.apaas.sync.base.BoException;
... ... @@ -7,12 +21,14 @@ import com.qgutech.qgyun.apaas.sync.cpsipo.mapper.AreaBlockIndicatorDailyMapper;
7 21 import com.qgutech.qgyun.apaas.sync.cpsipo.model.AreaBlockIndicatorDaily;
8 22 import com.qgutech.qgyun.apaas.sync.utils.CorpExample;
9 23 import org.apache.commons.collections4.CollectionUtils;
  24 +import org.apache.commons.lang3.StringUtils;
10 25 import org.springframework.stereotype.Service;
11 26 import org.springframework.transaction.annotation.Transactional;
12 27 import org.springframework.util.Assert;
13 28 import tk.mybatis.mapper.entity.Example;
14 29
15 30 import javax.annotation.Resource;
  31 +import java.text.SimpleDateFormat;
16 32 import java.util.*;
17 33 import java.util.stream.Collectors;
18 34
... ... @@ -25,6 +41,24 @@ public class AreaBlockIndicatorDailyService extends BaseServiceImpl<AreaBlockInd
25 41 @Resource
26 42 private AreaBlockIndicatorDailyMapper areaBlockIndicatorDailyMapper;
27 43
  44 + @Resource
  45 + private AreaBlockIndicatorService areaBlockIndicatorService;
  46 +
  47 + @Resource
  48 + private BlockInfoService blockInfoService;
  49 +
  50 + @Resource
  51 + private XtLineService xtLineService;
  52 +
  53 + @Resource
  54 + private WorkshopService workshopService;
  55 +
  56 + @Resource
  57 + private RoomGroupService roomGroupService;
  58 +
  59 + @Resource
  60 + private AreaService areaService;
  61 +
28 62 @Transactional(readOnly = true)
29 63 public AreaBlockIndicatorDaily getById(String id) {
30 64 Assert.hasLength(id, "id is empty!");
... ... @@ -69,4 +103,313 @@ public class AreaBlockIndicatorDailyService extends BaseServiceImpl<AreaBlockInd
69 103 Example example = CorpExample.ofCorp(entityClass);
70 104 return areaBlockIndicatorDailyMapper.selectByExample(example);
71 105 }
  106 +
  107 + /**
  108 + * 获取指定板块下看板项目的区域板块指标每日明细,按指标分组返回。
  109 + * <p>
  110 + * 1. 先查询指定板块下 sfkbxm=true 的指标信息列表;
  111 + * 2. 再根据指标到每日明细中按区域、月份查询明细记录;
  112 + * 3. 每个指标对应一个列表,列表中为月份内每天的记录数据;
  113 + * 4. 每天每个指标多条记录取第一条,无记录则默认一条实际值为0的记录。
  114 + *
  115 + * @param blockCode 板块编码(S-安全,Q-质量,C-成本)
  116 + * @param qyxx 区域信息,可为空
  117 + * @param month 月份(1-12),可为空,默认当前月
  118 + * @return 按指标分组的每日明细列表
  119 + */
  120 + @Transactional(readOnly = true)
  121 + public List<AreaBlockIndicatorDailyGroupDTO> listKanbanDailyByIndicator(String blockCode, String qyxx, Integer month) {
  122 + if (StringUtils.isBlank(qyxx)) {
  123 + return new ArrayList<>(0);
  124 + }
  125 + // 1. 查询板块信息
  126 + BlockInfo block = blockInfoService.getByBm(blockCode);
  127 + if (block == null) {
  128 + return new ArrayList<>(0);
  129 + }
  130 +
  131 + // 2. 查询板块下看板项目的指标信息列表
  132 + List<AreaBlockIndicator> indicatorList = areaBlockIndicatorService.listAll().stream()
  133 + .filter(item -> block.getId().equals(item.getBkxx())
  134 + && Boolean.TRUE.equals(item.getSfkbxm())
  135 + && qyxx.equals(item.getQyxx()))
  136 + .collect(Collectors.toList());
  137 + if (CollectionUtils.isEmpty(indicatorList)) {
  138 + return new ArrayList<>(0);
  139 + }
  140 +
  141 + // 3. 计算月份时间范围
  142 + Date monthStart = DateDealUtils.getMonthStartTime(null, month);
  143 + Date monthEnd = DateDealUtils.getMonthEndTime(null, month);
  144 +
  145 + // 4. 查询每日明细记录
  146 + Set<String> zhibIds = indicatorList.stream().map(AreaBlockIndicator::getId).collect(Collectors.toSet());
  147 + Example dailyExample = new Example(entityClass);
  148 + Example.Criteria dailyCriteria = CorpExample.criteria(dailyExample);
  149 + dailyCriteria.andIn(AreaBlockIndicatorDaily.ZHIBXX, zhibIds);
  150 + dailyCriteria.andBetween(AreaBlockIndicatorDaily.SJQKDATE, monthStart, monthEnd);
  151 + dailyCriteria.andEqualTo(AreaBlockIndicatorDaily.QYXX, qyxx);
  152 + List<AreaBlockIndicatorDaily> dailyList = areaBlockIndicatorDailyMapper.selectByExample(dailyExample);
  153 +
  154 + // 5. 按指标+日期分组,每天取第一条
  155 + Map<String, Map<String, AreaBlockIndicatorDaily>> indicatorDateMap = new LinkedHashMap<>();
  156 + for (AreaBlockIndicatorDaily daily : dailyList) {
  157 + String zhibId = daily.getZhibxx();
  158 + String dateKey = formatDateKey(daily.getSjqkDate());
  159 + indicatorDateMap.computeIfAbsent(zhibId, k -> new LinkedHashMap<>());
  160 + Map<String, AreaBlockIndicatorDaily> dateMap = indicatorDateMap.get(zhibId);
  161 + // 每天每个指标多条记录取第一条
  162 + dateMap.putIfAbsent(dateKey, daily);
  163 + }
  164 +
  165 + // 6. 填充关联信息
  166 + fillRelatedInfo(dailyList);
  167 +
  168 + // 7. 批量填充指标关联信息并构建返回结果
  169 + fillIndicatorRelatedInfo(indicatorList);
  170 + int daysInMonth = getDaysInMonth(month);
  171 + List<AreaBlockIndicatorDailyGroupDTO> resultList = new ArrayList<>();
  172 + for (AreaBlockIndicator indicator : indicatorList) {
  173 + AreaBlockIndicatorDailyGroupDTO dto = buildGroupDTO(indicator, block);
  174 + Map<String, AreaBlockIndicatorDaily> dateMap = indicatorDateMap.getOrDefault(indicator.getId(), new LinkedHashMap<>());
  175 +
  176 + List<AreaBlockIndicatorDaily> dailyRecords = new ArrayList<>();
  177 + for (int day = 1; day <= daysInMonth; day++) {
  178 + String dateKey = buildDateKey(month, day);
  179 + AreaBlockIndicatorDaily record = dateMap.get(dateKey);
  180 + if (record == null) {
  181 + // 无记录时默认一条实际值为0的记录
  182 + record = buildDefaultDailyRecord(indicator, month, day);
  183 + }
  184 + dailyRecords.add(record);
  185 + }
  186 + dto.setDailyList(dailyRecords);
  187 + resultList.add(dto);
  188 + }
  189 +
  190 + return resultList;
  191 + }
  192 +
  193 + /**
  194 + * 获取安全板块下看板项目的区域板块指标每日明细,按指标分组返回。
  195 + *
  196 + * @param qyxx 区域信息,可为空
  197 + * @param month 月份(1-12),可为空,默认当前月
  198 + * @return 按指标分组的每日明细列表
  199 + */
  200 + @Transactional(readOnly = true)
  201 + public List<AreaBlockIndicatorDailyGroupDTO> listSafetyKanbanDailyByIndicator(String qyxx, Integer month) {
  202 + return listKanbanDailyByIndicator(Constant.BLOCK_CODE_SAFE, qyxx, month);
  203 + }
  204 +
  205 + /**
  206 + * 获取质量板块下看板项目的区域板块指标每日明细,按指标分组返回。
  207 + *
  208 + * @param qyxx 区域信息,可为空
  209 + * @param month 月份(1-12),可为空,默认当前月
  210 + * @return 按指标分组的每日明细列表
  211 + */
  212 + @Transactional(readOnly = true)
  213 + public List<AreaBlockIndicatorDailyGroupDTO> listQualityKanbanDailyByIndicator(String qyxx, Integer month) {
  214 + return listKanbanDailyByIndicator(Constant.BLOCK_CODE_QUALITY, qyxx, month);
  215 + }
  216 +
  217 + /**
  218 + * 获取成本板块下看板项目的区域板块指标每日明细,按指标分组返回。
  219 + *
  220 + * @param qyxx 区域信息,可为空
  221 + * @param month 月份(1-12),可为空,默认当前月
  222 + * @return 按指标分组的每日明细列表
  223 + */
  224 + @Transactional(readOnly = true)
  225 + public List<AreaBlockIndicatorDailyGroupDTO> listCostKanbanDailyByIndicator(String qyxx, Integer month) {
  226 + return listKanbanDailyByIndicator(Constant.BLOCK_CODE_COST, qyxx, month);
  227 + }
  228 +
  229 + /**
  230 + * 批量填充指标信息关联的线体/车间/室组/区域名称与编号。
  231 + */
  232 + private void fillIndicatorRelatedInfo(List<AreaBlockIndicator> indicatorList) {
  233 + if (CollectionUtils.isEmpty(indicatorList)) {
  234 + return;
  235 + }
  236 +
  237 + // 收集关联 Id
  238 + Set<String> xtIds = indicatorList.stream().map(AreaBlockIndicator::getXtxx).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
  239 + Set<String> cjIds = indicatorList.stream().map(AreaBlockIndicator::getCjxx).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
  240 + Set<String> szIds = indicatorList.stream().map(AreaBlockIndicator::getSzxx).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
  241 + Set<String> qyIds = indicatorList.stream().map(AreaBlockIndicator::getQyxx).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
  242 +
  243 + // 批量查询关联实体
  244 + Map<String, XtLine> xtMap = CollectionUtils.isEmpty(xtIds) ? new HashMap<>(0) : xtLineService.mapByIds(xtIds);
  245 + Map<String, Workshop> cjMap = CollectionUtils.isEmpty(cjIds) ? new HashMap<>(0) : workshopService.mapByIds(cjIds);
  246 + Map<String, RoomGroup> szMap = CollectionUtils.isEmpty(szIds) ? new HashMap<>(0) : roomGroupService.mapByIds(szIds);
  247 + Map<String, Area> qyMap = CollectionUtils.isEmpty(qyIds) ? new HashMap<>(0) : areaService.mapByIds(qyIds);
  248 +
  249 + // 填充非持久化字段(暂存到指标对象中,后续 buildGroupDTO 使用)
  250 + for (AreaBlockIndicator indicator : indicatorList) {
  251 + XtLine xt = xtMap.get(indicator.getXtxx());
  252 + if (xt != null) {
  253 + indicator.setXtmc(xt.getXtmc());
  254 + indicator.setXtbh(xt.getXtbh());
  255 + }
  256 + Workshop ws = cjMap.get(indicator.getCjxx());
  257 + if (ws != null) {
  258 + indicator.setDwmc(ws.getDwmc());
  259 + indicator.setDwbh(ws.getDwbh());
  260 + }
  261 + RoomGroup rg = szMap.get(indicator.getSzxx());
  262 + if (rg != null) {
  263 + indicator.setSzmc(rg.getSzmc());
  264 + indicator.setSzbh(rg.getSzbh());
  265 + }
  266 + Area area = qyMap.get(indicator.getQyxx());
  267 + if (area != null) {
  268 + indicator.setQymc(area.getQymc());
  269 + indicator.setQybh(area.getQybh());
  270 + }
  271 + }
  272 + }
  273 +
  274 + /**
  275 + * 构建指标分组DTO(从已填充关联信息的指标对象中复制)
  276 + */
  277 + private AreaBlockIndicatorDailyGroupDTO buildGroupDTO(AreaBlockIndicator indicator, BlockInfo safetyBlock) {
  278 + AreaBlockIndicatorDailyGroupDTO dto = new AreaBlockIndicatorDailyGroupDTO();
  279 + dto.setZhibxx(indicator.getId());
  280 + dto.setZhibmc(indicator.getZhib());
  281 + dto.setBkxx(safetyBlock.getId());
  282 + dto.setBkmc(safetyBlock.getMc());
  283 + dto.setBkbm(safetyBlock.getBm());
  284 + dto.setQyxx(indicator.getQyxx());
  285 + dto.setQymc(indicator.getQymc());
  286 + dto.setQybh(indicator.getQybh());
  287 + dto.setXtxx(indicator.getXtxx());
  288 + dto.setXtmc(indicator.getXtmc());
  289 + dto.setXtbh(indicator.getXtbh());
  290 + dto.setCjxx(indicator.getCjxx());
  291 + dto.setDwmc(indicator.getDwmc());
  292 + dto.setDwbh(indicator.getDwbh());
  293 + dto.setSzxx(indicator.getSzxx());
  294 + dto.setSzmc(indicator.getSzmc());
  295 + dto.setSzbh(indicator.getSzbh());
  296 + return dto;
  297 + }
  298 +
  299 + /**
  300 + * 构建默认的每日明细记录(无记录时实际值为0)
  301 + */
  302 + private AreaBlockIndicatorDaily buildDefaultDailyRecord(AreaBlockIndicator indicator, Integer month, int day) {
  303 + AreaBlockIndicatorDaily record = new AreaBlockIndicatorDaily();
  304 + record.setSjqkDate(buildDate(month, day));
  305 + record.setXtxx(indicator.getXtxx());
  306 + record.setCjxx(indicator.getCjxx());
  307 + record.setSzxx(indicator.getSzxx());
  308 + record.setQyxx(indicator.getQyxx());
  309 + record.setBkxx(indicator.getBkxx());
  310 + record.setZhibxx(indicator.getId());
  311 + record.setRealVal(0.0);
  312 + return record;
  313 + }
  314 +
  315 + /**
  316 + * 批量填充每日明细记录关联的线体/车间/室组/区域/板块/指标名称与编号。
  317 + */
  318 + private void fillRelatedInfo(List<AreaBlockIndicatorDaily> list) {
  319 + if (CollectionUtils.isEmpty(list)) {
  320 + return;
  321 + }
  322 +
  323 + // 收集关联 Id
  324 + Set<String> xtIds = list.stream().map(AreaBlockIndicatorDaily::getXtxx).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
  325 + Set<String> cjIds = list.stream().map(AreaBlockIndicatorDaily::getCjxx).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
  326 + Set<String> szIds = list.stream().map(AreaBlockIndicatorDaily::getSzxx).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
  327 + Set<String> qyIds = list.stream().map(AreaBlockIndicatorDaily::getQyxx).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
  328 + Set<String> bkIds = list.stream().map(AreaBlockIndicatorDaily::getBkxx).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
  329 + Set<String> zhibIds = list.stream().map(AreaBlockIndicatorDaily::getZhibxx).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
  330 +
  331 + // 批量查询关联实体
  332 + Map<String, XtLine> xtMap = CollectionUtils.isEmpty(xtIds) ? new HashMap<>(0) : xtLineService.mapByIds(xtIds);
  333 + Map<String, Workshop> cjMap = CollectionUtils.isEmpty(cjIds) ? new HashMap<>(0) : workshopService.mapByIds(cjIds);
  334 + Map<String, RoomGroup> szMap = CollectionUtils.isEmpty(szIds) ? new HashMap<>(0) : roomGroupService.mapByIds(szIds);
  335 + Map<String, Area> qyMap = CollectionUtils.isEmpty(qyIds) ? new HashMap<>(0) : areaService.mapByIds(qyIds);
  336 + Map<String, BlockInfo> bkMap = CollectionUtils.isEmpty(bkIds) ? new HashMap<>(0) : blockInfoService.mapByIds(bkIds);
  337 + Map<String, AreaBlockIndicator> zhibMap = CollectionUtils.isEmpty(zhibIds) ? new HashMap<>(0) : areaBlockIndicatorService.mapByIds(zhibIds);
  338 +
  339 + // 填充非持久化字段
  340 + for (AreaBlockIndicatorDaily record : list) {
  341 + XtLine xt = xtMap.get(record.getXtxx());
  342 + if (xt != null) {
  343 + record.setXtmc(xt.getXtmc());
  344 + record.setXtbh(xt.getXtbh());
  345 + }
  346 + Workshop ws = cjMap.get(record.getCjxx());
  347 + if (ws != null) {
  348 + record.setDwmc(ws.getDwmc());
  349 + record.setDwbh(ws.getDwbh());
  350 + }
  351 + RoomGroup rg = szMap.get(record.getSzxx());
  352 + if (rg != null) {
  353 + record.setSzmc(rg.getSzmc());
  354 + record.setSzbh(rg.getSzbh());
  355 + }
  356 + Area area = qyMap.get(record.getQyxx());
  357 + if (area != null) {
  358 + record.setQymc(area.getQymc());
  359 + record.setQybh(area.getQybh());
  360 + }
  361 + BlockInfo bk = bkMap.get(record.getBkxx());
  362 + if (bk != null) {
  363 + record.setBkmc(bk.getMc());
  364 + record.setBkbm(bk.getBm());
  365 + }
  366 + AreaBlockIndicator indicator = zhibMap.get(record.getZhibxx());
  367 + if (indicator != null) {
  368 + record.setZhibmc(indicator.getZhib());
  369 + }
  370 + }
  371 + }
  372 +
  373 + /**
  374 + * 格式化日期为 yyyy-MM-dd 键
  375 + */
  376 + private String formatDateKey(Date date) {
  377 + if (date == null) {
  378 + return "";
  379 + }
  380 + return new SimpleDateFormat("yyyy-MM-dd").format(date);
  381 + }
  382 +
  383 + /**
  384 + * 构建日期键(yyyy-MM-dd)
  385 + */
  386 + private String buildDateKey(Integer month, int day) {
  387 + Calendar cal = Calendar.getInstance();
  388 + int targetMonth = (month != null) ? month : cal.get(Calendar.MONTH) + 1;
  389 + int year = cal.get(Calendar.YEAR);
  390 + return String.format("%04d-%02d-%02d", year, targetMonth, day);
  391 + }
  392 +
  393 + /**
  394 + * 构建日期对象
  395 + */
  396 + private Date buildDate(Integer month, int day) {
  397 + Calendar cal = Calendar.getInstance();
  398 + int targetMonth = (month != null) ? month : cal.get(Calendar.MONTH) + 1;
  399 + int year = cal.get(Calendar.YEAR);
  400 + cal.set(year, targetMonth - 1, day, 0, 0, 0);
  401 + cal.set(Calendar.MILLISECOND, 0);
  402 + return cal.getTime();
  403 + }
  404 +
  405 + /**
  406 + * 获取指定月份的天数
  407 + */
  408 + private int getDaysInMonth(Integer month) {
  409 + Calendar cal = Calendar.getInstance();
  410 + if (month != null) {
  411 + cal.set(Calendar.MONTH, month - 1);
  412 + }
  413 + return cal.getActualMaximum(Calendar.DAY_OF_MONTH);
  414 + }
72 415 }
... ...
... ... @@ -97,7 +97,10 @@ public class AreaEmployeeAttendanceDetailService extends BaseServiceImpl<AreaEmp
97 97 */
98 98 @Transactional(readOnly = true)
99 99 public List<AttendanceDailySummaryDTO> summaryDailyByMonth(String qyxx, Integer month) {
100   - Assert.hasLength(qyxx, "qyxx is empty!");
  100 + if (StringUtils.isBlank(qyxx)) {
  101 + return new ArrayList<>(0);
  102 + }
  103 +
101 104 Assert.notNull(month, "month is empty!");
102 105
103 106 // 年份固定取当前年(year 传 null),month 必传
... ...
... ... @@ -5,6 +5,7 @@ import com.qgutech.qgyun.apaas.sync.cps.service.AreaService;
5 5 import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.BlockInfo;
6 6 import com.qgutech.qgyun.apaas.sync.cpsfzzk.service.BlockInfoService;
7 7 import com.qgutech.qgyun.apaas.sync.cpsipo.model.AreaBlockIndicator;
  8 +import com.qgutech.qgyun.apaas.sync.utils.DateDealUtils;
8 9 import com.qgutech.qgyun.framework.database.mybatis.service.BaseServiceImpl;
9 10 import com.qgutech.qgyun.apaas.sync.base.BoErrorCode;
10 11 import com.qgutech.qgyun.apaas.sync.base.BoException;
... ... @@ -86,36 +87,44 @@ public class AreaScorecardService extends BaseServiceImpl<AreaScorecard> {
86 87 }
87 88
88 89 /**
89   - * 按区域和月份查询记分卡列表(按板块序号排序,并填充关联信息)
  90 + * 按区域、年份和月份查询记分卡列表(按板块序号排序,并填充关联信息)
90 91 *
91 92 * @param qyxx 区域信息,可为空
92   - * @param yuefem 月份(格式:#1#-#12#)
  93 + * @param year 年份,可为空,默认当前年
  94 + * @param yuefem 月份(格式:#1#-#12#),可为空
93 95 * @return 记分卡列表
94 96 */
95 97 @Transactional(readOnly = true)
96   - public List<AreaScorecard> listByQyxxAndYuefem(String qyxx, String yuefem) {
97   - Example example = CorpExample.ofCorp(entityClass);
98   - Example.Criteria criteria = example.createCriteria();
99   -
  98 + public List<AreaScorecard> listByQyxxAndYearAndYuefem(String qyxx, Integer year, String yuefem) {
  99 + Example example = new Example(entityClass);
  100 + Example.Criteria criteria = CorpExample.criteria(example);
  101 +
  102 + // 添加年份范围条件(默认当前年)
  103 + Date yearStart = DateDealUtils.parseYearStartTime(String.valueOf(year != null ? year : Calendar.getInstance().get(Calendar.YEAR)));
  104 + Date yearEnd = DateDealUtils.parseYearEndTime(String.valueOf(year != null ? year : Calendar.getInstance().get(Calendar.YEAR)));
  105 + criteria.andBetween(AreaScorecard.YEAR, yearStart, yearEnd);
  106 +
100 107 // 添加月份条件
101   - criteria.andEqualTo(AreaScorecard.YUEFEM, yuefem);
102   -
  108 + if (StringUtils.isNotBlank(yuefem)) {
  109 + criteria.andEqualTo(AreaScorecard.YUEFEM, yuefem);
  110 + }
  111 +
103 112 // 如果区域信息不为空,添加区域条件
104 113 if (StringUtils.isNotBlank(qyxx)) {
105 114 criteria.andEqualTo(AreaScorecard.QYXX, qyxx);
106 115 }
107   -
  116 +
108 117 List<AreaScorecard> list = areaScorecardMapper.selectByExample(example);
109 118 if (CollectionUtils.isEmpty(list)) {
110 119 return new ArrayList<>(0);
111 120 }
112   -
  121 +
113 122 // 填充关联信息
114 123 fillRelatedInfo(list);
115   -
  124 +
116 125 // 按板块序号排序
117 126 list.sort(Comparator.comparing(AreaScorecard::getBkxh, Comparator.nullsLast(Comparator.naturalOrder())));
118   -
  127 +
119 128 return list;
120 129 }
121 130
... ...
... ... @@ -7,6 +7,7 @@ import com.qgutech.qgyun.apaas.sync.cpsipo.mapper.FiveSMapMapper;
7 7 import com.qgutech.qgyun.apaas.sync.cpsipo.model.FiveSMap;
8 8 import com.qgutech.qgyun.apaas.sync.utils.CorpExample;
9 9 import org.apache.commons.collections4.CollectionUtils;
  10 +import org.apache.commons.lang3.StringUtils;
10 11 import org.springframework.stereotype.Service;
11 12 import org.springframework.transaction.annotation.Transactional;
12 13 import org.springframework.util.Assert;
... ... @@ -78,7 +79,9 @@ public class FiveSMapService extends BaseServiceImpl<FiveSMap> {
78 79 */
79 80 @Transactional(readOnly = true)
80 81 public List<FiveSMap> listByArea(String qyxx) {
81   - Assert.hasLength(qyxx, "qyxx is empty!");
  82 + if (StringUtils.isBlank(qyxx)) {
  83 + return new ArrayList<>(0);
  84 + }
82 85
83 86 Example example = new Example(entityClass);
84 87 CorpExample.criteria(example).andEqualTo(FiveSMap.QYXX, qyxx);
... ...
1 1 package com.qgutech.qgyun.apaas.sync.cpsipo.service;
2 2
  3 +import com.qgutech.qgyun.apaas.sync.cps.model.*;
  4 +import com.qgutech.qgyun.apaas.sync.cps.service.*;
3 5 import com.qgutech.qgyun.framework.database.mybatis.service.BaseServiceImpl;
4 6 import com.qgutech.qgyun.apaas.sync.base.BoErrorCode;
5 7 import com.qgutech.qgyun.apaas.sync.base.BoException;
6   -import com.qgutech.qgyun.apaas.sync.cps.model.Area;
7   -import com.qgutech.qgyun.apaas.sync.cps.model.RoomGroup;
8   -import com.qgutech.qgyun.apaas.sync.cps.model.Team;
9   -import com.qgutech.qgyun.apaas.sync.cps.model.Workshop;
10   -import com.qgutech.qgyun.apaas.sync.cps.model.XtLine;
11   -import com.qgutech.qgyun.apaas.sync.cps.service.AreaService;
12   -import com.qgutech.qgyun.apaas.sync.cps.service.RoomGroupService;
13   -import com.qgutech.qgyun.apaas.sync.cps.service.TeamService;
14   -import com.qgutech.qgyun.apaas.sync.cps.service.WorkshopService;
15   -import com.qgutech.qgyun.apaas.sync.cps.service.XtLineService;
16 8 import com.qgutech.qgyun.apaas.sync.cpsipo.dto.MultiSkilledEmployeeDTO;
17 9 import com.qgutech.qgyun.apaas.sync.cpsipo.dto.MultiSkilledWorkstationDTO;
18 10 import com.qgutech.qgyun.apaas.sync.cpsipo.dto.MultiSkilledWorkerSummaryDTO;
... ... @@ -65,6 +57,9 @@ public class MultiSkilledWorkerService extends BaseServiceImpl<MultiSkilledWorke
65 57 private StopWorkstationService stopWorkstationService;
66 58
67 59 @Resource
  60 + private WorkstationService workstationService;
  61 +
  62 + @Resource
68 63 private AreaEmployeeService areaEmployeeService;
69 64
70 65 @Transactional(readOnly = true)
... ... @@ -127,9 +122,10 @@ public class MultiSkilledWorkerService extends BaseServiceImpl<MultiSkilledWorke
127 122 */
128 123 @Transactional(readOnly = true)
129 124 public MultiSkilledWorkerSummaryDTO summaryByArea(String qyxx) {
130   - Assert.hasLength(qyxx, "qyxx is empty!");
131   -
132 125 MultiSkilledWorkerSummaryDTO result = new MultiSkilledWorkerSummaryDTO();
  126 + if (StringUtils.isBlank(qyxx)) {
  127 + return result;
  128 + }
133 129
134 130 // 1. 查询当前企业下指定区域的多能工记录
135 131 Example example = new Example(entityClass);
... ... @@ -158,14 +154,15 @@ public class MultiSkilledWorkerService extends BaseServiceImpl<MultiSkilledWorke
158 154 private List<MultiSkilledEmployeeDTO> buildEmployeeList(List<MultiSkilledWorker> records) {
159 155 Map<String, MultiSkilledEmployeeDTO> employeeMap = new LinkedHashMap<>();
160 156 for (MultiSkilledWorker item : records) {
161   - String ygxx = item.getYgxx();
162   - if (StringUtils.isBlank(ygxx) || employeeMap.containsKey(ygxx)) {
  157 + String qyygxx = item.getQyygxx();
  158 + if (StringUtils.isBlank(qyygxx) || employeeMap.containsKey(qyygxx)) {
163 159 continue;
164 160 }
165 161 MultiSkilledEmployeeDTO dto = new MultiSkilledEmployeeDTO();
166   - dto.setYgxx(ygxx);
167   - dto.setYgName(item.getYgName());
168   - employeeMap.put(ygxx, dto);
  162 + dto.setQyygxx(qyygxx);
  163 + dto.setQyygName(item.getQyygxm());
  164 + dto.setQyygCode(item.getQyygh());
  165 + employeeMap.put(qyygxx, dto);
169 166 }
170 167 return new ArrayList<>(employeeMap.values());
171 168 }
... ... @@ -236,7 +233,8 @@ public class MultiSkilledWorkerService extends BaseServiceImpl<MultiSkilledWorke
236 233 Map<String, Area> qyMap = CollectionUtils.isEmpty(qyIds) ? new HashMap<>(0) : areaService.mapByIds(qyIds);
237 234 Map<String, Team> bzMap = CollectionUtils.isEmpty(bzIds) ? new HashMap<>(0) : teamService.mapByIds(bzIds);
238 235 Map<String, UcUser> ygMap = CollectionUtils.isEmpty(ygIds) ? new HashMap<>(0) : ucUserService.mapByIds(ygIds);
239   - Map<String, StopWorkstation> gwMap = CollectionUtils.isEmpty(gwIds) ? new HashMap<>(0) : stopWorkstationService.mapByIds(gwIds);
  236 + //多能工的关联工位信息取的是CPS体系的工位信息
  237 + Map<String, Workstation> gwMap = CollectionUtils.isEmpty(gwIds) ? new HashMap<>(0) : workstationService.mapByIds(gwIds);
240 238 Map<String, AreaEmployee> qyygMap = CollectionUtils.isEmpty(qyygIds) ? new HashMap<>(0) : areaEmployeeService.mapByIds(qyygIds);
241 239
242 240 // 回填名称、编号
... ... @@ -270,7 +268,7 @@ public class MultiSkilledWorkerService extends BaseServiceImpl<MultiSkilledWorke
270 268 if (null != ucUser) {
271 269 item.setYgName(ucUser.getName());
272 270 }
273   - StopWorkstation workstation = gwMap.get(item.getGwxx());
  271 + Workstation workstation = gwMap.get(item.getGwxx());
274 272 if (null != workstation) {
275 273 item.setGwmc(workstation.getGwmc());
276 274 item.setGwbh(workstation.getGwbh());
... ...
... ... @@ -2,6 +2,8 @@ package com.qgutech.qgyun.apaas.sync.cpsipo.service;
2 2
3 3 import com.qgutech.qgyun.apaas.sync.cps.service.AreaService;
4 4 import com.qgutech.qgyun.apaas.sync.cps.service.ShiftService;
  5 +import com.qgutech.qgyun.apaas.sync.cpsipo.dto.StopRecordDailySummaryDTO;
  6 +import com.qgutech.qgyun.apaas.sync.cpsipo.model.StopRecord;
5 7 import com.qgutech.qgyun.framework.database.mybatis.service.BaseServiceImpl;
6 8 import com.qgutech.qgyun.apaas.sync.base.BoErrorCode;
7 9 import com.qgutech.qgyun.apaas.sync.base.BoException;
... ... @@ -107,6 +109,11 @@ public class QualityDefectService extends BaseServiceImpl<QualityDefect> {
107 109 */
108 110 @Transactional(readOnly = true)
109 111 public List<QualityDefectDailySummaryDTO> summaryDailyByMonth(String zrqyxx, Integer year, Integer month) {
  112 + Calendar now = Calendar.getInstance();
  113 + int targetYear = (year == null) ? now.get(Calendar.YEAR) : year;
  114 + int targetMonth = (month == null) ? (now.get(Calendar.MONTH) + 1) : month;
  115 + Assert.isTrue(targetMonth >= 1 && targetMonth <= 12, "month must be between 1 and 12!");
  116 +
110 117 Date start = DateDealUtils.getMonthStartTime(year, month);
111 118 Date end = DateDealUtils.getMonthEndTime(year, month);
112 119
... ... @@ -123,14 +130,46 @@ public class QualityDefectService extends BaseServiceImpl<QualityDefect> {
123 130 item -> dateFormat.format(item.getTcrq()),
124 131 Collectors.counting()));
125 132
126   - List<QualityDefectDailySummaryDTO> result = new ArrayList<>();
127   - for (Map.Entry<String, Long> entry : dailyCountMap.entrySet()) {
128   - result.add(new QualityDefectDailySummaryDTO(entry.getKey(), entry.getValue().intValue()));
  133 + // 确定需要生成汇总记录的日期范围:从当月1号到当前天(若查询月份非当前月则到月末)
  134 + Calendar rangeCal = Calendar.getInstance();
  135 + rangeCal.set(Calendar.YEAR, targetYear);
  136 + rangeCal.set(Calendar.MONTH, targetMonth - 1);
  137 + int endDay;
  138 + if (targetYear == now.get(Calendar.YEAR) && targetMonth == (now.get(Calendar.MONTH) + 1)) {
  139 + // 查询的是当前月,只到当前天
  140 + endDay = now.get(Calendar.DAY_OF_MONTH);
  141 + } else {
  142 + // 查询的是历史月份,到月末
  143 + endDay = rangeCal.getActualMaximum(Calendar.DAY_OF_MONTH);
129 144 }
130 145
  146 + List<QualityDefectDailySummaryDTO> resultList = new ArrayList<>();
  147 + for (int day = 1; day <= endDay; day++) {
  148 + rangeCal.set(Calendar.DAY_OF_MONTH, day);
  149 + String dateKey = dateFormat.format(rangeCal.getTime());
  150 +
  151 + QualityDefectDailySummaryDTO dto = new QualityDefectDailySummaryDTO();
  152 + dto.setDate(dateKey);
  153 +
  154 + Long totalCount = dailyCountMap.get(dateKey);
  155 + if (null!=totalCount) {
  156 + dto.setCount(totalCount.intValue());
  157 + } else {
  158 + // 无记录的日期自动补0
  159 + dto.setCount(0);
  160 + }
  161 +
  162 + resultList.add(dto);
  163 + }
  164 +
  165 +// List<QualityDefectDailySummaryDTO> result = new ArrayList<>();
  166 +// for (Map.Entry<String, Long> entry : dailyCountMap.entrySet()) {
  167 +// result.add(new QualityDefectDailySummaryDTO(entry.getKey(), entry.getValue().intValue()));
  168 +// }
  169 +
131 170 // 按日期升序
132   - result.sort(Comparator.comparing(QualityDefectDailySummaryDTO::getDate));
133   - return result;
  171 + resultList.sort(Comparator.comparing(QualityDefectDailySummaryDTO::getDate));
  172 + return resultList;
134 173 }
135 174
136 175 /**
... ...
1 1 package com.qgutech.qgyun.apaas.sync.cpsipo.service;
2 2
  3 +import com.qgutech.qgyun.apaas.sync.cps.model.Area;
  4 +import com.qgutech.qgyun.apaas.sync.cps.model.Team;
  5 +import com.qgutech.qgyun.apaas.sync.cps.model.Workstation;
  6 +import com.qgutech.qgyun.apaas.sync.cps.service.AreaService;
  7 +import com.qgutech.qgyun.apaas.sync.cps.service.TeamService;
  8 +import com.qgutech.qgyun.apaas.sync.cps.service.WorkstationService;
3 9 import com.qgutech.qgyun.framework.database.mybatis.service.BaseServiceImpl;
4 10 import com.qgutech.qgyun.apaas.sync.base.BoErrorCode;
5 11 import com.qgutech.qgyun.apaas.sync.base.BoException;
  12 +import com.qgutech.qgyun.apaas.sync.cpsipo.dto.SafetyObservationDailySummaryDTO;
  13 +import com.qgutech.qgyun.apaas.sync.cpsipo.enums.CheckResultEnum;
6 14 import com.qgutech.qgyun.apaas.sync.cpsipo.mapper.SafetyObservationMapper;
7 15 import com.qgutech.qgyun.apaas.sync.cpsipo.model.SafetyObservation;
8 16 import com.qgutech.qgyun.apaas.sync.utils.CorpExample;
  17 +import com.qgutech.qgyun.apaas.sync.utils.DateDealUtils;
9 18 import org.apache.commons.collections4.CollectionUtils;
  19 +import org.apache.commons.lang3.StringUtils;
10 20 import org.springframework.stereotype.Service;
11 21 import org.springframework.transaction.annotation.Transactional;
12 22 import org.springframework.util.Assert;
13 23 import tk.mybatis.mapper.entity.Example;
14 24
15 25 import javax.annotation.Resource;
  26 +import java.text.SimpleDateFormat;
16 27 import java.util.*;
17 28 import java.util.stream.Collectors;
18 29
... ... @@ -25,6 +36,15 @@ public class SafetyObservationService extends BaseServiceImpl<SafetyObservation>
25 36 @Resource
26 37 private SafetyObservationMapper safetyObservationMapper;
27 38
  39 + @Resource
  40 + private AreaService areaService;
  41 +
  42 + @Resource
  43 + private TeamService teamService;
  44 +
  45 + @Resource
  46 + private WorkstationService workstationService;
  47 +
28 48 @Transactional(readOnly = true)
29 49 public SafetyObservation getById(String id) {
30 50 Assert.hasLength(id, "id is empty!");
... ... @@ -69,4 +89,149 @@ public class SafetyObservationService extends BaseServiceImpl<SafetyObservation>
69 89 Example example = CorpExample.ofCorp(entityClass);
70 90 return safetyObservationMapper.selectByExample(example);
71 91 }
  92 +
  93 + /**
  94 + * 根据区域、月份汇总该月每日安全观察与履职检查信息(按检查日期分组)。
  95 + * <p>
  96 + * 每日明细记录条数为走访工位数(gws),抽查结果 ccjg 为异常(CheckResultEnum.YICHANG)的记录条数为问题数(wts)。
  97 + * 年份固定取当前年,month(1-12)为空默认当前月;当前月截止当天,其他月份截止月末,缺记录日期自动补 0。
  98 + *
  99 + * @param qyxx 区域(Area)id,可为空
  100 + * @param month 月份(1-12),可为空,默认当前月
  101 + * @return 该月每日汇总列表(按日期升序)
  102 + */
  103 + @Transactional(readOnly = true)
  104 + public List<SafetyObservationDailySummaryDTO> summaryDailyByMonth(String qyxx, Integer month) {
  105 + // 月份为空时默认当前月
  106 + if (month == null) {
  107 + month = Calendar.getInstance().get(Calendar.MONTH) + 1;
  108 + }
  109 +
  110 + // 年份固定取当前年(year 传 null)
  111 + Date start = DateDealUtils.getMonthStartTime(null, month);
  112 + Date end = DateDealUtils.getMonthEndTime(null, month);
  113 +
  114 + Example example = new Example(entityClass);
  115 + Example.Criteria criteria = CorpExample.criteria(example).andBetween(SafetyObservation.JCRQ, start, end);
  116 + if (StringUtils.isNotBlank(qyxx)) {
  117 + criteria.andEqualTo(SafetyObservation.QYXX, qyxx);
  118 + }
  119 + List<SafetyObservation> list = safetyObservationMapper.selectByExample(example);
  120 +
  121 + // 按检查日期分组
  122 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
  123 + Map<String, List<SafetyObservation>> dailyGroup = list.stream()
  124 + .filter(item -> item.getJcrq() != null)
  125 + .collect(Collectors.groupingBy(item -> dateFormat.format(item.getJcrq())));
  126 +
  127 + // 补零截止日:当前月截止当天,其他月份截止月末
  128 + Calendar now = Calendar.getInstance();
  129 + int currentYear = now.get(Calendar.YEAR);
  130 + int currentMonth = now.get(Calendar.MONTH) + 1;
  131 + int endDay;
  132 + if (month == currentMonth) {
  133 + endDay = now.get(Calendar.DAY_OF_MONTH);
  134 + } else {
  135 + Calendar monthCal = Calendar.getInstance();
  136 + monthCal.set(Calendar.YEAR, currentYear);
  137 + monthCal.set(Calendar.MONTH, month - 1);
  138 + endDay = monthCal.getActualMaximum(Calendar.DAY_OF_MONTH);
  139 + }
  140 +
  141 + List<SafetyObservationDailySummaryDTO> result = new ArrayList<>();
  142 + for (int day = 1; day <= endDay; day++) {
  143 + String dateKey = String.format("%04d-%02d-%02d", currentYear, month, day);
  144 + List<SafetyObservation> dayList = dailyGroup.get(dateKey);
  145 + if (CollectionUtils.isEmpty(dayList)) {
  146 + // 无记录时补一条工位数和问题数都为0的记录
  147 + result.add(new SafetyObservationDailySummaryDTO(dateKey, 0, 0));
  148 + continue;
  149 + }
  150 + // 走访工位数:当日明细记录条数
  151 + int gws = dayList.size();
  152 + // 问题数:当日抽查结果为异常的记录条数
  153 + int wts = (int) dayList.stream()
  154 + .filter(item -> CheckResultEnum.YICHANG == CheckResultEnum.fromCode(item.getCcjg()))
  155 + .count();
  156 + result.add(new SafetyObservationDailySummaryDTO(dateKey, gws, wts));
  157 + }
  158 +
  159 + return result;
  160 + }
  161 +
  162 + /**
  163 + * 根据区域、检查日期查询安全履职检查明细列表,并补全关联信息。
  164 + * <p>
  165 + * 返回列表补全区域名称/编号(关联 Area)、班组名称/编号(关联 Team)与观察工位名称/编号(关联 Workstation)。
  166 + *
  167 + * @param qyxx 区域(Area)id,可为空
  168 + * @param jcrq 检查日期(yyyy-MM-dd),必填
  169 + * @return 当日安全履职检查明细列表
  170 + */
  171 + @Transactional(readOnly = true)
  172 + public List<SafetyObservation> listDetailByDate(String qyxx, String jcrq) {
  173 + Assert.hasLength(jcrq, "jcrq is empty!");
  174 +
  175 + Date start = DateDealUtils.parseStartTime(jcrq);
  176 + Date end = DateDealUtils.parseEndTime(jcrq);
  177 +
  178 + Example example = new Example(entityClass);
  179 + Example.Criteria criteria = CorpExample.criteria(example).andBetween(SafetyObservation.JCRQ, start, end);
  180 + if (StringUtils.isNotBlank(qyxx)) {
  181 + criteria.andEqualTo(SafetyObservation.QYXX, qyxx);
  182 + }
  183 + List<SafetyObservation> list = safetyObservationMapper.selectByExample(example);
  184 + if (CollectionUtils.isEmpty(list)) {
  185 + return new ArrayList<>(0);
  186 + }
  187 +
  188 + // 补全区域、班组、工位名称与编号
  189 + fillRelatedInfo(list);
  190 + return list;
  191 + }
  192 +
  193 + /**
  194 + * 批量补全安全履职检查明细关联的区域、班组、观察工位名称与编号。
  195 + */
  196 + private void fillRelatedInfo(List<SafetyObservation> list) {
  197 + // 收集关联 id
  198 + Set<String> qyIds = new HashSet<>();
  199 + Set<String> bzIds = new HashSet<>();
  200 + Set<String> gwIds = new HashSet<>();
  201 + for (SafetyObservation item : list) {
  202 + if (StringUtils.isNotBlank(item.getQyxx())) {
  203 + qyIds.add(item.getQyxx());
  204 + }
  205 + if (StringUtils.isNotBlank(item.getBzxx())) {
  206 + bzIds.add(item.getBzxx());
  207 + }
  208 + if (StringUtils.isNotBlank(item.getGcgw())) {
  209 + gwIds.add(item.getGcgw());
  210 + }
  211 + }
  212 +
  213 + // 批量查询关联实体(空集合时不调用,避免 mapByIds 断言报错)
  214 + Map<String, Area> qyMap = CollectionUtils.isEmpty(qyIds) ? new HashMap<>(0) : areaService.mapByIds(qyIds);
  215 + Map<String, Team> bzMap = CollectionUtils.isEmpty(bzIds) ? new HashMap<>(0) : teamService.mapByIds(bzIds);
  216 + Map<String, Workstation> gwMap = CollectionUtils.isEmpty(gwIds) ? new HashMap<>(0) : workstationService.mapByIds(gwIds);
  217 +
  218 + // 回填名称、编号
  219 + for (SafetyObservation item : list) {
  220 + Area area = qyMap.get(item.getQyxx());
  221 + if (null != area) {
  222 + item.setQymc(area.getQymc());
  223 + item.setQybh(area.getQybh());
  224 + }
  225 + Team team = bzMap.get(item.getBzxx());
  226 + if (null != team) {
  227 + item.setBzmc(team.getBzmc());
  228 + item.setBzbh(team.getBzbh());
  229 + }
  230 + Workstation workstation = gwMap.get(item.getGcgw());
  231 + if (null != workstation) {
  232 + item.setGwmc(workstation.getGwmc());
  233 + item.setGwbh(workstation.getGwbh());
  234 + }
  235 + }
  236 + }
72 237 }
... ...
... ... @@ -37,11 +37,12 @@
37 37 - [10.2 按区域汇总多能工信息 🆕新增](#102-按区域汇总多能工信息)
38 38 - [11. 区域记分卡接口](#11-区域记分卡接口)
39 39 - [11.1 获取所有区域记分卡列表 🆕新增](#111-获取所有区域记分卡列表)
40   - - [11.2 按区域和月份查询记分卡列表 🆕新增](#112-按区域和月份查询记分卡列表)
  40 + - [11.2 按区域、年份和月份查询记分卡列表 ✏️更新](#112-按区域年份和月份查询记分卡列表)
41 41 - [12. 区域板块指标信息接口](#12-区域板块指标信息接口)
42 42 - [12.1 获取所有区域板块指标信息列表 🆕新增](#121-获取所有区域板块指标信息列表)
43 43 - [13. 区域板块指标每日明细接口](#13-区域板块指标每日明细接口)
44 44 - [13.1 获取所有区域板块指标每日明细列表 🆕新增](#131-获取所有区域板块指标每日明细列表)
  45 + - [13.2 获取指定板块下看板项目的区域板块指标每日明细(按指标分组,安全/质量/成本 3 个端点) 🆕新增](#132-获取指定板块下看板项目的区域板块指标每日明细按指标分组)
45 46 - [14. 区域员工考勤信息接口](#14-区域员工考勤信息接口)
46 47 - [14.1 获取所有区域员工考勤信息列表 🆕新增](#141-获取所有区域员工考勤信息列表)
47 48 - [15. 区域员工考勤明细接口](#15-区域员工考勤明细接口)
... ... @@ -59,6 +60,8 @@
59 60 - [19.2 按区域查询5S责任图列表 🆕新增](#192-按区域查询5s责任图列表)
60 61 - [20. 安全观察与履职检查接口](#20-安全观察与履职检查接口)
61 62 - [20.1 获取所有安全观察与履职检查列表 🆕新增](#201-获取所有安全观察与履职检查列表)
  63 + - [20.2 按区域、月份汇总每日安全观察与履职检查信息 🆕新增](#202-按区域月份汇总每日安全观察与履职检查信息)
  64 + - [20.3 按区域、检查日期查询安全履职检查明细列表 🆕新增](#203-按区域检查日期查询安全履职检查明细列表)
62 65 - [21. 车间级工作计划接口](#21-车间级工作计划接口)
63 66 - [21.1 获取所有车间级工作计划列表 🆕新增](#211-获取所有车间级工作计划列表)
64 67
... ... @@ -92,9 +95,10 @@
92 95 | 🆕 | [10.1](#101-获取所有多能工信息列表) | `GET /multiSkilledWorker/list/all` | 新增接口 | 获取当前企业下所有多能工信息列表;响应含等级 `levelDesc` 中文描述计算字段 |
93 96 | 🆕 | [10.2](#102-按区域汇总多能工信息) | `GET /multiSkilledWorker/summary/area` | 新增接口 | 按区域(qyxx,必传)查询多能工记录并补全完整关联信息,同时对员工、工位分别去重汇总;一个接口返回员工列表、工位列表、员工工位等级信息列表 |
94 97 | 🆕 | [11.1](#111-获取所有区域记分卡列表) | `GET /areaScorecard/list/all` | 新增接口 | 获取当前企业下所有区域记分卡列表;响应含月份中文描述计算字段 |
95   -| 🆕 | [11.2](#112-按区域和月份查询记分卡列表) | `GET /areaScorecard/list/byMonth` | 新增接口 | 按区域(qyxx,可选)、月份(1-12,可选,默认当前月)查询记分卡列表,按板块序号排序,响应含区域/板块/指标关联信息 |
  98 +| ✏️ | [11.2](#112-按区域年份和月份查询记分卡列表) | `GET /areaScorecard/list/byMonth` | 接口更新 | 新增 `year` 参数,对 `year` 字段做范围查询(默认当前年);修复原 `month` 参数查询条件未生效的问题 |
96 99 | 🆕 | [12.1](#121-获取所有区域板块指标信息列表) | `GET /areaBlockIndicator/list/all` | 新增接口 | 获取当前企业下所有区域板块指标信息列表;响应含状态中文描述计算字段 |
97 100 | 🆕 | [13.1](#131-获取所有区域板块指标每日明细列表) | `GET /areaBlockIndicatorDaily/list/all` | 新增接口 | 获取当前企业下所有区域板块指标每日明细列表 |
  101 +| 🆕 | [13.2](#132-获取指定板块下看板项目的区域板块指标每日明细按指标分组) | `GET /areaBlockIndicatorDaily/list/{safety,quality,cost}KanbanDaily` | 新增接口 | 按板块拆分为安全(S)/质量(Q)/成本(C)3 个专用端点,获取对应板块下看板项目的区域板块指标每日明细;按指标分组返回,每个指标对应月份内每天的记录列表,每天多条记录取第一条,无记录默认实际值为0,关联信息返回名称与编号 |
98 102 | 🆕 | [14.1](#141-获取所有区域员工考勤信息列表) | `GET /areaEmployeeAttendance/list/all` | 新增接口 | 获取当前企业下所有区域员工考勤信息列表 |
99 103 | 🆕 | [15.1](#151-获取所有区域员工考勤明细列表) | `GET /areaEmployeeAttendanceDetail/list/all` | 新增接口 | 获取当前企业下所有区域员工考勤明细列表;响应含职位/假别中文描述计算字段 |
100 104 | 🆕 | [15.2](#152-按区域月份查询每日考勤汇总信息) | `GET /areaEmployeeAttendanceDetail/summary/daily` | 新增接口 | 按区域(qyxx,必传)、月份(1-12,必传)查询该月每日考勤汇总信息,含应到人数、实到人数 |
... ... @@ -105,6 +109,8 @@
105 109 | 🆕 | [19.1](#191-获取所有5s责任图列表) | `GET /fiveSMap/list/all` | 新增接口 | 获取当前企业下所有5S责任图列表 |
106 110 | 🆕 | [19.2](#192-按区域查询5s责任图列表) | `GET /fiveSMap/list/area` | 新增接口 | 按区域(qyxx,必传)查询该区域下的5S责任图列表 |
107 111 | 🆕 | [20.1](#201-获取所有安全观察与履职检查列表) | `GET /safetyObservation/list/all` | 新增接口 | 获取当前企业下所有安全观察与履职检查列表 |
  112 +| 🆕 | [20.2](#202-按区域月份汇总每日安全观察与履职检查信息) | `GET /safetyObservation/summary/daily` | 新增接口 | 按区域(qyxx,可选)、月份(1-12,可选,默认当前月)汇总每日安全观察与履职检查信息;每日记录条数为走访工位数,抽查结果异常(ccjg=#2#)记录条数为问题数;缺记录日期自动补工位数、问题数均为0的记录 |
  113 +| 🆕 | [20.3](#203-按区域检查日期查询安全履职检查明细列表) | `GET /safetyObservation/list/detail` | 新增接口 | 按区域(qyxx,可选)、检查日期(jcrq,必填)查询安全履职检查明细,补全区域/班组/观察工位名称与编号 |
108 114 | 🆕 | [21.1](#211-获取所有车间级工作计划列表) | `GET /workshopWorkPlan/list/all` | 新增接口 | 获取当前企业下所有车间级工作计划列表 |
109 115
110 116 ---
... ... @@ -1671,7 +1677,7 @@ uat3 环境: https://uat3.qgutech.com/fkyycustom
1671 1677
1672 1678 | 参数名 | 类型 | 必传 | 说明 |
1673 1679 |--------|------|------|------|
1674   -| qyxx | String | 是 | 区域信息(区域id) |
  1680 +| qyxx | String | 否 | 区域信息(区域id) |
1675 1681
1676 1682 **响应数据:** `MultiSkilledWorkerSummaryDTO`
1677 1683
... ... @@ -1680,8 +1686,9 @@ uat3 环境: https://uat3.qgutech.com/fkyycustom
1680 1686 | 字段 | 类型 | 说明 |
1681 1687 |------|------|------|
1682 1688 | employeeList | Array | 员工列表(按员工去重汇总) |
1683   -| employeeList[].ygxx | String | 员工信息ID(组织用户ID) |
1684   -| employeeList[].ygName | String | 员工姓名(关联组织用户) |
  1689 +| employeeList[].qyygxx | String | 区域员工信息ID |
  1690 +| employeeList[].qyygName | String | 区域员工姓名 |
  1691 +| employeeList[].qyygCode | String | 区域员工号 |
1685 1692 | workstationList | Array | 工位列表(按工位去重汇总) |
1686 1693 | workstationList[].gwxx | String | 工位信息ID(停线工位ID) |
1687 1694 | workstationList[].gwmc | String | 工位名称(关联停线工位) |
... ... @@ -1827,19 +1834,20 @@ uat3 环境: https://uat3.qgutech.com/fkyycustom
1827 1834
1828 1835 ---
1829 1836
1830   -### 11.2 按区域和月份查询记分卡列表 🆕新增
  1837 +### 11.2 按区域、年份和月份查询记分卡列表 ✏️更新
1831 1838
1832   -> 🆕 **新增接口**(2026-10-06 之后新建)
  1839 +> ✏️ **接口更新**(2026-10-16 更新):新增 `year` 参数,对实体属性字段 `year` 做范围查询(默认当前年开始时间~结束时间);修复原 `month` 参数查询条件未生效的问题。
1833 1840
1834 1841 **接口路径:** `GET /areaScorecard/list/byMonth`
1835 1842
1836   -**接口说明:** 按区域、月份查询记分卡列表,结果按板块序号升序排列。响应中除持久化字段外,还包含月份中文描述(计算字段),以及由 Service 批量填充的关联信息(区域名称/编号、板块名称/编码/序号、指标名称)。
  1843 +**接口说明:** 按区域、年份、月份查询记分卡列表,结果按板块序号升序排列。响应中除持久化字段外,还包含月份中文描述(计算字段),以及由 Service 批量填充的关联信息(区域名称/编号、板块名称/编码/序号、指标名称)。
1837 1844
1838 1845 **请求参数:**
1839 1846
1840 1847 | 参数名 | 类型 | 必传 | 说明 |
1841 1848 |--------|------|------|------|
1842 1849 | qyxx | String | 否 | 区域信息(区域id),为空则不限定 |
  1850 +| year | Integer | 否 | 年份,为空默认当前年 |
1843 1851 | month | Integer | 否 | 月份(1-12),为空默认当前月 |
1844 1852
1845 1853 **响应数据:** `List<AreaScorecard>`
... ... @@ -2019,6 +2027,159 @@ uat3 环境: https://uat3.qgutech.com/fkyycustom
2019 2027
2020 2028 ---
2021 2029
  2030 +### 13.2 获取指定板块下看板项目的区域板块指标每日明细(按指标分组) 🆕新增
  2031 +
  2032 +> 🆕 **新增接口**(2026-10-16 新建):按板块拆分为 3 个专用端点(安全、质量、成本),板块由端点区分,无需板块入参。
  2033 +
  2034 +**接口路径(按板块 3 个端点):**
  2035 +
  2036 +| 板块 | 端点 | 说明 |
  2037 +|------|------|------|
  2038 +| 安全(编码 S) | `GET /areaBlockIndicatorDaily/list/safetyKanbanDaily` | 获取安全板块下看板项目的区域板块指标每日明细 |
  2039 +| 质量(编码 Q) | `GET /areaBlockIndicatorDaily/list/qualityKanbanDaily` | 获取质量板块下看板项目的区域板块指标每日明细 |
  2040 +| 成本(编码 C) | `GET /areaBlockIndicatorDaily/list/costKanbanDaily` | 获取成本板块下看板项目的区域板块指标每日明细 |
  2041 +
  2042 +**接口说明:** 根据板块端点定位板块信息,查询该板块下是看板项目(`sfkbxm=true`)的区域板块指标信息列表,再根据列表中的指标到每日明细中按区域、月份获取明细记录。返回结果中每个指标对应一个列表,列表中是月份内每天的记录数据,每天每个指标多条记录的取第一条,没有记录的默认一条实际值为0的记录;指标信息及线体、车间、室组、区域、板块等关联信息均返回名称与编号。
  2043 +
  2044 +**请求参数:**
  2045 +
  2046 +| 参数名 | 类型 | 必传 | 说明 |
  2047 +|--------|------|------|------|
  2048 +| qyxx | String | 是 | 区域信息(区域id),为空时返回空列表 |
  2049 +| month | Integer | 否 | 月份(1-12),为空时默认当前月 |
  2050 +
  2051 +**响应数据:** `List<AreaBlockIndicatorDailyGroupDTO>`
  2052 +
  2053 +**响应字段说明:**
  2054 +
  2055 +| 字段 | 类型 | 说明 |
  2056 +|------|------|------|
  2057 +| zhibxx | String | 指标信息id(AreaBlockIndicator id) |
  2058 +| zhibmc | String | 指标名称 |
  2059 +| bkxx | String | 板块信息id |
  2060 +| bkmc | String | 板块名称 |
  2061 +| bkbm | String | 板块编码 |
  2062 +| qyxx | String | 区域信息id |
  2063 +| qymc | String | 区域名称 |
  2064 +| qybh | String | 区域编号 |
  2065 +| xtxx | String | 线体信息id |
  2066 +| xtmc | String | 线体名称 |
  2067 +| xtbh | String | 线体编号 |
  2068 +| cjxx | String | 车间信息id |
  2069 +| dwmc | String | 车间名称 |
  2070 +| dwbh | String | 车间编号 |
  2071 +| szxx | String | 室组信息id |
  2072 +| szmc | String | 室组名称 |
  2073 +| szbh | String | 室组编号 |
  2074 +| dailyList | List<AreaBlockIndicatorDaily> | 该指标在月份内每天的明细记录列表 |
  2075 +
  2076 +**dailyList 元素字段说明:**
  2077 +
  2078 +| 字段 | 类型 | 说明 |
  2079 +|------|------|------|
  2080 +| id | String | 记录ID(默认记录无id) |
  2081 +| corpCode | String | 企业编码 |
  2082 +| sjqkDate | String | 数据日期(yyyy-MM-dd HH:mm:ss) |
  2083 +| xtxx | String | 线体信息 |
  2084 +| cjxx | String | 车间信息 |
  2085 +| szxx | String | 室组信息 |
  2086 +| qyxx | String | 区域信息 |
  2087 +| bkxx | String | 板块信息 |
  2088 +| zhibxx | String | 指标信息 |
  2089 +| realVal | Double | 实际值(无记录时默认为0) |
  2090 +| xtmc | String | 线体名称(关联 XtLine) |
  2091 +| xtbh | String | 线体编号(关联 XtLine) |
  2092 +| dwmc | String | 车间名称(关联 Workshop) |
  2093 +| dwbh | String | 车间编号(关联 Workshop) |
  2094 +| szmc | String | 室组名称(关联 RoomGroup) |
  2095 +| szbh | String | 室组编号(关联 RoomGroup) |
  2096 +| qymc | String | 区域名称(关联 Area) |
  2097 +| qybh | String | 区域编号(关联 Area) |
  2098 +| bkmc | String | 板块名称(关联 BlockInfo) |
  2099 +| bkbm | String | 板块编码(关联 BlockInfo) |
  2100 +| zhibmc | String | 指标名称(关联 AreaBlockIndicator) |
  2101 +
  2102 +**响应示例(安全板块 `GET /areaBlockIndicatorDaily/list/safetyKanbanDaily`,10月每天取第一条,无记录默认实际值为0):**
  2103 +
  2104 +```json
  2105 +{
  2106 + "success": true,
  2107 + "data": [
  2108 + {
  2109 + "zhibxx": "ZB001",
  2110 + "zhibmc": "安全事故数",
  2111 + "bkxx": "BK001",
  2112 + "bkmc": "安全",
  2113 + "bkbm": "S",
  2114 + "qyxx": "QY001",
  2115 + "qymc": "总装区域",
  2116 + "qybh": "QY001",
  2117 + "xtxx": "XT001",
  2118 + "xtmc": "总装线",
  2119 + "xtbh": "XT001",
  2120 + "cjxx": "CJ001",
  2121 + "dwmc": "总装车间",
  2122 + "dwbh": "CJ001",
  2123 + "szxx": "SZ001",
  2124 + "szmc": "总装室组",
  2125 + "szbh": "SZ001",
  2126 + "dailyList": [
  2127 + {
  2128 + "id": "MRJ20261001001",
  2129 + "corpCode": "hfca",
  2130 + "sjqkDate": "2026-10-01 00:00:00",
  2131 + "xtxx": "XT001",
  2132 + "cjxx": "CJ001",
  2133 + "szxx": "SZ001",
  2134 + "qyxx": "QY001",
  2135 + "bkxx": "BK001",
  2136 + "zhibxx": "ZB001",
  2137 + "realVal": 85.0,
  2138 + "xtmc": "总装线",
  2139 + "xtbh": "XT001",
  2140 + "dwmc": "总装车间",
  2141 + "dwbh": "CJ001",
  2142 + "szmc": "总装室组",
  2143 + "szbh": "SZ001",
  2144 + "qymc": "总装区域",
  2145 + "qybh": "QY001",
  2146 + "bkmc": "安全",
  2147 + "bkbm": "S",
  2148 + "zhibmc": "安全事故数"
  2149 + },
  2150 + {
  2151 + "id": null,
  2152 + "corpCode": null,
  2153 + "sjqkDate": "2026-10-02 00:00:00",
  2154 + "xtxx": "XT001",
  2155 + "cjxx": "CJ001",
  2156 + "szxx": "SZ001",
  2157 + "qyxx": "QY001",
  2158 + "bkxx": "BK001",
  2159 + "zhibxx": "ZB001",
  2160 + "realVal": 0.0,
  2161 + "xtmc": null,
  2162 + "xtbh": null,
  2163 + "dwmc": null,
  2164 + "dwbh": null,
  2165 + "szmc": null,
  2166 + "szbh": null,
  2167 + "qymc": null,
  2168 + "qybh": null,
  2169 + "bkmc": null,
  2170 + "bkbm": null,
  2171 + "zhibmc": null
  2172 + }
  2173 + ]
  2174 + }
  2175 + ],
  2176 + "msg": "成功",
  2177 + "errCode": null
  2178 +}
  2179 +```
  2180 +
  2181 +---
  2182 +
2022 2183 ## 14. 区域员工考勤信息接口
2023 2184
2024 2185 ### 14.1 获取所有区域员工考勤信息列表 🆕新增
... ... @@ -2177,8 +2338,8 @@ uat3 环境: https://uat3.qgutech.com/fkyycustom
2177 2338
2178 2339 | 参数名 | 类型 | 必传 | 说明 |
2179 2340 |--------|------|------|------|
2180   -| qyxx | String | 是 | 区域(Area)id |
2181   -| month | Integer | 是 | 月份(1-12) |
  2341 +| qyxx | String | 否 | 区域(Area)id |
  2342 +| month | Integer | 否 | 月份(1-12),没传默认当前月 |
2182 2343
2183 2344 **响应数据:** `List<AttendanceDailySummaryDTO>`
2184 2345
... ... @@ -2614,6 +2775,129 @@ uat3 环境: https://uat3.qgutech.com/fkyycustom
2614 2775
2615 2776 ---
2616 2777
  2778 +### 20.2 按区域、月份汇总每日安全观察与履职检查信息 🆕新增
  2779 +
  2780 +> 🆕 **新增接口**(2026-10-16 之后新建)
  2781 +
  2782 +**接口路径:** `GET /safetyObservation/summary/daily`
  2783 +
  2784 +**接口说明:** 以检查日期(jcrq)为条件月份范围内的明细记录,按天分组汇总:每日明细记录条数为走访工位数(gws),抽查结果(ccjg)为异常(#2#)的记录条数为问题数(wts)。返回每日汇总统计信息,从月初到当前日期(当前月)或月末(其他月份)中缺记录的日期自动补一条工位数和问题数都为0的记录,结果按日期升序。年份固定取当前年。
  2785 +
  2786 +**请求参数:**
  2787 +
  2788 +| 参数名 | 类型 | 必传 | 说明 |
  2789 +|--------|------|------|------|
  2790 +| qyxx | String | 否 | 区域信息(区域id),为空时不限定 |
  2791 +| month | Integer | 否 | 月份(1-12),为空默认当前月 |
  2792 +
  2793 +**响应数据:** `List<SafetyObservationDailySummaryDTO>`
  2794 +
  2795 +**响应字段说明:**
  2796 +
  2797 +| 字段 | 类型 | 说明 |
  2798 +|------|------|------|
  2799 +| date | String | 检查日期(yyyy-MM-dd) |
  2800 +| gws | Integer | 走访工位数(当日明细记录条数,无记录时补0) |
  2801 +| wts | Integer | 问题数(当日抽查结果为异常的记录条数,无记录时补0) |
  2802 +
  2803 +**响应示例:**
  2804 +
  2805 +```json
  2806 +{
  2807 + "success": true,
  2808 + "data": [
  2809 + {
  2810 + "date": "2026-10-01",
  2811 + "gws": 5,
  2812 + "wts": 1
  2813 + },
  2814 + {
  2815 + "date": "2026-10-02",
  2816 + "gws": 0,
  2817 + "wts": 0
  2818 + }
  2819 + ],
  2820 + "msg": "成功",
  2821 + "errCode": null
  2822 +}
  2823 +```
  2824 +
  2825 +---
  2826 +
  2827 +### 20.3 按区域、检查日期查询安全履职检查明细列表 🆕新增
  2828 +
  2829 +> 🆕 **新增接口**(2026-10-16 之后新建)
  2830 +
  2831 +**接口路径:** `GET /safetyObservation/list/detail`
  2832 +
  2833 +**接口说明:** 按检查日期(jcrq,必填)查询当日安全履职检查明细列表,区域(qyxx)为空时不限定。响应中除持久化字段外,还包含抽查结果中文描述(`ccjgDesc`,计算字段),以及由 Service 批量填充的关联信息(区域名称/编号、班组名称/编号、观察工位名称/编号)。
  2834 +
  2835 +**请求参数:**
  2836 +
  2837 +| 参数名 | 类型 | 必传 | 说明 |
  2838 +|--------|------|------|------|
  2839 +| qyxx | String | 否 | 区域信息(区域id),为空时不限定 |
  2840 +| jcrq | String | 是 | 检查日期,格式:yyyy-MM-dd |
  2841 +
  2842 +**响应数据:** `List<SafetyObservation>`
  2843 +
  2844 +**响应字段说明:**
  2845 +
  2846 +| 字段 | 类型 | 说明 |
  2847 +|------|------|------|
  2848 +| id | String | 记录ID |
  2849 +| corpCode | String | 企业编码 |
  2850 +| jcrq | String | 检查日期(yyyy-MM-dd HH:mm:ss) |
  2851 +| qyxx | String | 区域信息(区域id) |
  2852 +| qymc | String | 区域名称(关联 Area,Service 填充) |
  2853 +| qybh | String | 区域编号(关联 Area,Service 填充) |
  2854 +| bzxx | String | 班组信息(班组id) |
  2855 +| bzmc | String | 班组名称(关联 Team,Service 填充) |
  2856 +| bzbh | String | 班组编号(关联 Team,Service 填充) |
  2857 +| gcgw | String | 观察工位(工位id) |
  2858 +| gwmc | String | 工位名称(关联 Workstation,Service 填充) |
  2859 +| gwbh | String | 工位编号(关联 Workstation,Service 填充) |
  2860 +| bgcr | String | 被观察人 |
  2861 +| ccxm | String | 抽查项目(枚举,多选) |
  2862 +| ccjg | String | 抽查结果(#1#-正常,#2#-异常,#3#-不涉及) |
  2863 +| ccjgDesc | String | 抽查结果中文描述(计算字段) |
  2864 +| jlnryy | String | 记录以下内容及其原因 |
  2865 +| ibpfgw | String | 说明 |
  2866 +
  2867 +**响应示例:**
  2868 +
  2869 +```json
  2870 +{
  2871 + "success": true,
  2872 + "data": [
  2873 + {
  2874 + "id": "AQGC20261001001",
  2875 + "corpCode": "hfca",
  2876 + "jcrq": "2026-10-01 09:00:00",
  2877 + "qyxx": "QY001",
  2878 + "qymc": "总装区域",
  2879 + "qybh": "QY001",
  2880 + "bzxx": "BZ001",
  2881 + "bzmc": "装配一班",
  2882 + "bzbh": "BZ001",
  2883 + "gcgw": "GW001",
  2884 + "gwmc": "装配工位",
  2885 + "gwbh": "01",
  2886 + "bgcr": "张三",
  2887 + "ccxm": "#1#,#4#",
  2888 + "ccjg": "#2#",
  2889 + "ccjgDesc": "异常",
  2890 + "jlnryy": "员工未正确佩戴劳保用品",
  2891 + "ibpfgw": ""
  2892 + }
  2893 + ],
  2894 + "msg": "成功",
  2895 + "errCode": null
  2896 +}
  2897 +```
  2898 +
  2899 +---
  2900 +
2617 2901 ## 21. 车间级工作计划接口
2618 2902
2619 2903 ### 21.1 获取所有车间级工作计划列表 🆕新增
... ...