Commit b59694ad8f06ca1d63e1c1ede99edd1c6528e8e3

Authored by 房远帅
1 parent 0e9e007c

供应商报价:看板按月维度查看

... ... @@ -22,7 +22,7 @@ public class SupplierQuotationProjectRealtimeListener {
22 22 private SupplierQuotationProjectFinishedRealtimePushService finishedRealtimePushService;
23 23
24 24 /**
25   - * 报价项目或供应商报价变更后,广播当日完整看板数据
  25 + * 报价项目或供应商报价变更后,广播当月完整看板数据
26 26 *
27 27 * @param event 变更事件
28 28 */
... ... @@ -32,7 +32,7 @@ public class SupplierQuotationProjectRealtimeListener {
32 32 && !(event.getSource() instanceof SupplierQuotationProjectQuoteServiceImpl)) {
33 33 return;
34 34 }
35   - realtimePushService.broadcastCurrentDayFullData(event.getEventType());
36   - finishedRealtimePushService.broadcastCurrentDayFinishedData(event.getEventType());
  35 + realtimePushService.broadcastCurrentMonthFullData(event.getEventType());
  36 + finishedRealtimePushService.broadcastCurrentMonthFinishedData(event.getEventType());
37 37 }
38 38 }
... ...
... ... @@ -65,12 +65,12 @@ public class SupplierQuotationProjectController extends DefaultBaseController {
65 65 return InvokeResultBuilder.success(data);
66 66 }
67 67
68   - @ApiOperation("当日已完成/已中止项目实时查询")
  68 + @ApiOperation("当月已完成/已中止项目实时查询")
69 69 @HasPermission({"procure-manage:supplier-price:query"})
70   - @GetMapping("/queryCurrentDayFinished")
71   - public InvokeResult<List<SupplierQuotationProject>> queryCurrentDayFinished() {
  70 + @GetMapping("/queryCurrentMonthFinished")
  71 + public InvokeResult<List<SupplierQuotationProject>> queryCurrentMonthFinished() {
72 72 return InvokeResultBuilder.success(
73   - supplierQuotationProjectService.queryCurrentDayFinishedBoardList(LocalDate.now(), getCurrentUser().getId()));
  73 + supplierQuotationProjectService.queryCurrentMonthFinishedBoardList(LocalDate.now(), getCurrentUser().getId()));
74 74 }
75 75
76 76 @ApiOperation("修改")
... ...
... ... @@ -91,8 +91,10 @@ public class SupplierQuotationProjectServiceImpl
91 91 }
92 92
93 93 @Override
94   - public List<SupplierQuotationProject> queryCurrentDayBoardList(LocalDate day, String userId) {
95   - List<SupplierQuotationProject> datas = getBaseMapper().queryCurrentDayList(day);
  94 + public List<SupplierQuotationProject> queryCurrentMonthBoardList(LocalDate month, String userId) {
  95 + LocalDate monthStart = month.withDayOfMonth(1);
  96 + LocalDate nextMonthStart = monthStart.plusMonths(1);
  97 + List<SupplierQuotationProject> datas = getBaseMapper().queryCurrentMonthList(monthStart, nextMonthStart);
96 98 fillComputedStatus(datas);
97 99 if (datas == null || datas.isEmpty()) {
98 100 return datas;
... ... @@ -105,8 +107,10 @@ public class SupplierQuotationProjectServiceImpl
105 107 }
106 108
107 109 @Override
108   - public List<SupplierQuotationProject> queryCurrentDayFinishedBoardList(LocalDate day, String userId) {
109   - List<SupplierQuotationProject> datas = getBaseMapper().queryCurrentDayFinishedList(day);
  110 + public List<SupplierQuotationProject> queryCurrentMonthFinishedBoardList(LocalDate month, String userId) {
  111 + LocalDate monthStart = month.withDayOfMonth(1);
  112 + LocalDate nextMonthStart = monthStart.plusMonths(1);
  113 + List<SupplierQuotationProject> datas = getBaseMapper().queryCurrentMonthFinishedList(monthStart, nextMonthStart);
110 114 fillComputedStatus(datas);
111 115 if (datas == null || datas.isEmpty()) {
112 116 return datas;
... ...
... ... @@ -15,8 +15,8 @@ public interface SupplierQuotationProjectMapper extends BaseMapper<SupplierQuota
15 15
16 16 String getMaxCodeByDay(@Param("dayPrefix") String dayPrefix);
17 17
18   - List<SupplierQuotationProject> queryCurrentDayList(@Param("day") LocalDate day);
  18 + List<SupplierQuotationProject> queryCurrentMonthList(@Param("monthStart") LocalDate monthStart, @Param("nextMonthStart") LocalDate nextMonthStart);
19 19
20   - List<SupplierQuotationProject> queryCurrentDayFinishedList(@Param("day") LocalDate day);
  20 + List<SupplierQuotationProject> queryCurrentMonthFinishedList(@Param("monthStart") LocalDate monthStart, @Param("nextMonthStart") LocalDate nextMonthStart);
21 21 }
22 22
... ...
... ... @@ -23,9 +23,9 @@ public interface SupplierQuotationProjectService extends BaseMpService<SupplierQ
23 23
24 24 void delete(String id);
25 25
26   - List<SupplierQuotationProject> queryCurrentDayBoardList(LocalDate day, String userId);
  26 + List<SupplierQuotationProject> queryCurrentMonthBoardList(LocalDate month, String userId);
27 27
28   - List<SupplierQuotationProject> queryCurrentDayFinishedBoardList(LocalDate day, String userId);
  28 + List<SupplierQuotationProject> queryCurrentMonthFinishedBoardList(LocalDate month, String userId);
29 29
30 30 /**
31 31 * 更新项目状态
... ...
... ... @@ -36,27 +36,27 @@ public class SupplierQuotationProjectFinishedRealtimePushService {
36 36 }
37 37 }
38 38
39   - public void broadcastCurrentDayFinishedData(String eventType) {
  39 + public void broadcastCurrentMonthFinishedData(String eventType) {
40 40 if (sessionMap.isEmpty()) {
41 41 return;
42 42 }
43 43
44 44 for (WebSocketSession session : sessionMap.values()) {
45   - replayCurrentDayFinishedData(session, eventType);
  45 + replayCurrentMonthFinishedData(session, eventType);
46 46 }
47 47 }
48 48
49   - public void replayCurrentDayFinishedData(WebSocketSession session, String eventType) {
  49 + public void replayCurrentMonthFinishedData(WebSocketSession session, String eventType) {
50 50 if (session == null) {
51 51 return;
52 52 }
53   - sendMessage(session, JsonUtil.toJsonString(buildCurrentDayMessage(session, eventType)));
  53 + sendMessage(session, JsonUtil.toJsonString(buildCurrentMonthMessage(session, eventType)));
54 54 }
55 55
56   - private SupplierQuotationProjectRealtimeMessage buildCurrentDayMessage(WebSocketSession session, String eventType) {
  56 + private SupplierQuotationProjectRealtimeMessage buildCurrentMonthMessage(WebSocketSession session, String eventType) {
57 57 LocalDate today = LocalDate.now();
58 58 String userId = getUserId(session);
59   - List<SupplierQuotationProject> records = supplierQuotationProjectService.queryCurrentDayFinishedBoardList(today, userId);
  59 + List<SupplierQuotationProject> records = supplierQuotationProjectService.queryCurrentMonthFinishedBoardList(today, userId);
60 60
61 61 SupplierQuotationProjectRealtimeMessage message = new SupplierQuotationProjectRealtimeMessage();
62 62 message.setMessageType("FULL_SYNC_FINISHED");
... ...
... ... @@ -19,14 +19,14 @@ public class SupplierQuotationProjectFinishedWebSocketHandler extends TextWebSoc
19 19 @Override
20 20 public void afterConnectionEstablished(WebSocketSession session) {
21 21 realtimePushService.register(session);
22   - realtimePushService.replayCurrentDayFinishedData(session, "INIT");
  22 + realtimePushService.replayCurrentMonthFinishedData(session, "INIT");
23 23 }
24 24
25 25 @Override
26 26 protected void handleTextMessage(WebSocketSession session, TextMessage message) {
27 27 String payload = StringUtils.trimToEmpty(message.getPayload());
28   - if ("SYNC_TODAY".equalsIgnoreCase(payload) || "RESYNC".equalsIgnoreCase(payload)) {
29   - realtimePushService.replayCurrentDayFinishedData(session, "RESYNC");
  28 + if ("SYNC_TODAY".equalsIgnoreCase(payload) || "SYNC_MONTH".equalsIgnoreCase(payload) || "RESYNC".equalsIgnoreCase(payload)) {
  29 + realtimePushService.replayCurrentMonthFinishedData(session, "RESYNC");
30 30 }
31 31 }
32 32
... ...
... ... @@ -53,44 +53,44 @@ public class SupplierQuotationProjectRealtimePushService {
53 53 }
54 54
55 55 /**
56   - * 广播当日完整报价项目看板数据
  56 + * 广播当月完整报价项目看板数据
57 57 *
58 58 * @param eventType 事件类型
59 59 */
60   - public void broadcastCurrentDayFullData(String eventType) {
  60 + public void broadcastCurrentMonthFullData(String eventType) {
61 61 if (sessionMap.isEmpty()) {
62 62 return;
63 63 }
64 64
65 65 for (WebSocketSession session : sessionMap.values()) {
66   - replayCurrentDayFullData(session, eventType);
  66 + replayCurrentMonthFullData(session, eventType);
67 67 }
68 68 }
69 69
70 70 /**
71   - * 向单个连接补推当日完整报价项目看板数据
  71 + * 向单个连接补推当月完整报价项目看板数据
72 72 *
73 73 * @param session WebSocket 会话
74 74 * @param eventType 事件类型
75 75 */
76   - public void replayCurrentDayFullData(WebSocketSession session, String eventType) {
  76 + public void replayCurrentMonthFullData(WebSocketSession session, String eventType) {
77 77 if (session == null) {
78 78 return;
79 79 }
80   - sendMessage(session, JsonUtil.toJsonString(buildCurrentDayMessage(session, eventType)));
  80 + sendMessage(session, JsonUtil.toJsonString(buildCurrentMonthMessage(session, eventType)));
81 81 }
82 82
83 83 /**
84   - * 构建当日完整数据消息
  84 + * 构建当月完整数据消息
85 85 *
86 86 * @param session WebSocket 会话
87 87 * @param eventType 事件类型
88 88 * @return 推送消息
89 89 */
90   - private SupplierQuotationProjectRealtimeMessage buildCurrentDayMessage(WebSocketSession session, String eventType) {
  90 + private SupplierQuotationProjectRealtimeMessage buildCurrentMonthMessage(WebSocketSession session, String eventType) {
91 91 LocalDate today = LocalDate.now();
92 92 String userId = getUserId(session);
93   - List<SupplierQuotationProject> records = supplierQuotationProjectService.queryCurrentDayBoardList(today, userId);
  93 + List<SupplierQuotationProject> records = supplierQuotationProjectService.queryCurrentMonthBoardList(today, userId);
94 94
95 95 SupplierQuotationProjectRealtimeMessage message = new SupplierQuotationProjectRealtimeMessage();
96 96 message.setMessageType("FULL_SYNC");
... ...
... ... @@ -22,14 +22,14 @@ public class SupplierQuotationProjectWebSocketHandler extends TextWebSocketHandl
22 22 @Override
23 23 public void afterConnectionEstablished(WebSocketSession session) {
24 24 realtimePushService.register(session);
25   - realtimePushService.replayCurrentDayFullData(session, "INIT");
  25 + realtimePushService.replayCurrentMonthFullData(session, "INIT");
26 26 }
27 27
28 28 @Override
29 29 protected void handleTextMessage(WebSocketSession session, TextMessage message) {
30 30 String payload = StringUtils.trimToEmpty(message.getPayload());
31   - if ("SYNC_TODAY".equalsIgnoreCase(payload) || "RESYNC".equalsIgnoreCase(payload)) {
32   - realtimePushService.replayCurrentDayFullData(session, "RESYNC");
  31 + if ("SYNC_TODAY".equalsIgnoreCase(payload) || "SYNC_MONTH".equalsIgnoreCase(payload) || "RESYNC".equalsIgnoreCase(payload)) {
  32 + realtimePushService.replayCurrentMonthFullData(session, "RESYNC");
33 33 }
34 34 }
35 35
... ...
... ... @@ -90,16 +90,18 @@
90 90 LIMIT 1
91 91 </select>
92 92
93   - <select id="queryCurrentDayList" resultMap="SupplierQuotationProject">
  93 + <select id="queryCurrentMonthList" resultMap="SupplierQuotationProject">
94 94 <include refid="SupplierQuotationProjectSql"/>
95   - WHERE DATE(tb.create_time) = #{day}
  95 + WHERE tb.create_time <![CDATA[ >= ]]> CONCAT(#{monthStart}, ' 00:00:00')
  96 + AND tb.create_time <![CDATA[ < ]]> CONCAT(#{nextMonthStart}, ' 00:00:00')
96 97 AND tb.status='PUBLISHED'
97 98 ORDER BY tb.create_time DESC, tb.id DESC
98 99 </select>
99 100
100   - <select id="queryCurrentDayFinishedList" resultMap="SupplierQuotationProject">
  101 + <select id="queryCurrentMonthFinishedList" resultMap="SupplierQuotationProject">
101 102 <include refid="SupplierQuotationProjectSql"/>
102   - WHERE DATE(tb.create_time) = #{day}
  103 + WHERE tb.create_time <![CDATA[ >= ]]> CONCAT(#{monthStart}, ' 00:00:00')
  104 + AND tb.create_time <![CDATA[ < ]]> CONCAT(#{nextMonthStart}, ' 00:00:00')
103 105 AND tb.status IN ('COMPLETED', 'ABORTED')
104 106 ORDER BY tb.update_time DESC, tb.id DESC
105 107 </select>
... ...