From d9e5ab959b7ff2c578672938c205a7a82765ef9f Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期二, 15 八月 2023 09:15:25 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
inspect-server/src/main/java/com/yuanchu/mom/service/impl/ResportServiceImpl.java | 144 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 144 insertions(+), 0 deletions(-)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/ResportServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/ResportServiceImpl.java
new file mode 100644
index 0000000..dae4d0c
--- /dev/null
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/ResportServiceImpl.java
@@ -0,0 +1,144 @@
+package com.yuanchu.mom.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.yuanchu.mom.mapper.FinishedInspectMapper;
+import com.yuanchu.mom.mapper.RawInspectMapper;
+import com.yuanchu.mom.pojo.ProReport;
+import com.yuanchu.mom.pojo.RawInspect;
+import com.yuanchu.mom.pojo.StatisticsData;
+import com.yuanchu.mom.service.ResportService;
+import lombok.Data;
+import org.apache.tomcat.util.buf.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Date;
+
+
+@Service
+public class ResportServiceImpl implements ResportService {
+
+ @Resource
+ RawInspectMapper rawInspectMapper;
+
+ @Resource
+ FinishedInspectMapper finishedInspectMapper;
+
+ //璁$畻鍚堟牸涓庝笉鍚堟牸鏁伴噺
+ @Override
+ public StatisticsData turno(String begin, String end) {
+ StatisticsData statisticsData = new StatisticsData();
+ //鍘熸潗鏂欏悎鏍�
+ Integer material = rawInspectMapper.selCountRaw(begin, end, 1);
+ statisticsData.setMaterial(material);
+ //鍘熸潗鏂欎笉鍚堟牸
+ Integer unmaterial = rawInspectMapper.selCountRaw(begin, end, 0);
+ statisticsData.setUnmaterial(unmaterial);
+ //杩囩▼鍚堟牸鏁�
+ Integer process = finishedInspectMapper.selCountFin(begin, end, 1, 1);
+ statisticsData.setProcess(process);
+ //杩囩▼涓嶅悎鏍�
+ Integer unprocess = finishedInspectMapper.selCountFin(begin, end, 1, 0);
+ statisticsData.setUnprocess(unprocess);
+ //鎴愬搧鍚堟牸鏁�
+ Integer finished = finishedInspectMapper.selCountFin(begin, end, 0, 1);
+ statisticsData.setFinished(finished);
+ //鎴愬搧涓嶅悎鏍�
+ Integer unfinished = finishedInspectMapper.selCountFin(begin, end, 0, 0);
+ statisticsData.setUnfinished(unfinished);
+ return statisticsData;
+ }
+
+ //璁$畻浜у搧鎬婚噺
+ @Override
+ public ProReport allNum() {
+ // 鑾峰彇褰撳墠鏃ユ湡鐨勫墠涓や釜鏈堢殑鏃ユ湡
+ ArrayList<String> dateList = new ArrayList<>();
+ LocalDate now = LocalDate.now();
+ LocalDate oneAgo = now.minusMonths(1);
+ LocalDate twoAgo = now.minusMonths(2);
+ // 鏍煎紡鍖栨棩鏈熷璞�
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
+ dateList.add(twoAgo.format(formatter));
+ dateList.add(oneAgo.format(formatter));
+ dateList.add(now.format(formatter));
+ //鑾峰彇鍘熸潗鏂欐湀浜ч噺
+ Long cLong = rawInspectMapper.seAllCount(now.withDayOfMonth(1).toString(), now.plusMonths(1).withDayOfMonth(1).minusDays(1).toString());
+ Long bLong = rawInspectMapper.seAllCount(oneAgo.withDayOfMonth(1).toString(), oneAgo.plusMonths(1).withDayOfMonth(1).minusDays(1).toString());
+ Long aLong = rawInspectMapper.seAllCount(twoAgo.withDayOfMonth(1).toString(), twoAgo.plusMonths(1).withDayOfMonth(1).minusDays(1).toString());
+ ArrayList<String> materialList = new ArrayList<>();
+ materialList.add(aLong.toString());
+ materialList.add(bLong.toString());
+ materialList.add(cLong.toString());
+ //鑾峰彇杩囩▼鏈堜骇閲�
+ Long c1Long = finishedInspectMapper.seAllCount(now.withDayOfMonth(1).toString(), now.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 1);
+ Long b1Long = finishedInspectMapper.seAllCount(oneAgo.withDayOfMonth(1).toString(), oneAgo.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 1);
+ Long a1Long = finishedInspectMapper.seAllCount(twoAgo.withDayOfMonth(1).toString(), twoAgo.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 1);
+ ArrayList<String> processList = new ArrayList<>();
+ processList.add(a1Long.toString());
+ processList.add(b1Long.toString());
+ processList.add(c1Long.toString());
+ //鑾峰彇鎴愬搧鏈堜骇閲�
+ Long c2Long = finishedInspectMapper.seAllCount(now.withDayOfMonth(1).toString(), now.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 0);
+ Long b2Long = finishedInspectMapper.seAllCount(oneAgo.withDayOfMonth(1).toString(), oneAgo.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 0);
+ Long a2Long = finishedInspectMapper.seAllCount(twoAgo.withDayOfMonth(1).toString(), twoAgo.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 0);
+ ArrayList<String> finishedList = new ArrayList<>();
+ finishedList.add(a2Long.toString());
+ finishedList.add(b2Long.toString());
+ finishedList.add(c2Long.toString());
+ return ProReport.builder()
+ .dateList(StringUtils.join(dateList, ','))
+ .materialList(StringUtils.join(materialList, ','))
+ .processList(StringUtils.join(processList, ','))
+ .finishedList(StringUtils.join(finishedList, ','))
+ .build();
+ }
+
+ //璁$畻杈炬爣鎬婚噺
+ @Override
+ public ProReport statisNum() {
+ // 鑾峰彇褰撳墠鏃ユ湡鐨勫墠涓や釜鏈堢殑鏃ユ湡
+ ArrayList<String> dateList = new ArrayList<>();
+ LocalDate now = LocalDate.now();
+ LocalDate oneAgo = now.minusMonths(1);
+ LocalDate twoAgo = now.minusMonths(2);
+ // 鏍煎紡鍖栨棩鏈熷璞�
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
+ dateList.add(twoAgo.format(formatter));
+ dateList.add(oneAgo.format(formatter));
+ dateList.add(now.format(formatter));
+ //鑾峰彇鍘熸潗鏂欐湀杈炬爣浜ч噺
+ Integer c = rawInspectMapper.selCountRaw(now.withDayOfMonth(1).toString(), now.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 1);
+ Integer b = rawInspectMapper.selCountRaw(oneAgo.withDayOfMonth(1).toString(), oneAgo.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 1);
+ Integer a = rawInspectMapper.selCountRaw(twoAgo.withDayOfMonth(1).toString(), twoAgo.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 1);
+ ArrayList<String> materialList = new ArrayList<>();
+ materialList.add(a.toString());
+ materialList.add(b.toString());
+ materialList.add(c.toString());
+ //鑾峰彇杩囩▼鏈堣揪鏍囦骇閲�
+ Integer c1 = finishedInspectMapper.selCountFin(now.withDayOfMonth(1).toString(), now.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 1, 1);
+ Integer b1 = finishedInspectMapper.selCountFin(oneAgo.withDayOfMonth(1).toString(), oneAgo.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 1, 1);
+ Integer a1 = finishedInspectMapper.selCountFin(twoAgo.withDayOfMonth(1).toString(), twoAgo.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 1, 1);
+ ArrayList<String> processList = new ArrayList<>();
+ processList.add(a1.toString());
+ processList.add(b1.toString());
+ processList.add(c1.toString());
+ //鑾峰彇鎴愬搧鏈堣揪鏍囦骇閲�
+ Integer c2 = finishedInspectMapper.selCountFin(now.withDayOfMonth(1).toString(), now.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 0, 1);
+ Integer b2 = finishedInspectMapper.selCountFin(oneAgo.withDayOfMonth(1).toString(), oneAgo.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 0, 1);
+ Integer a2 = finishedInspectMapper.selCountFin(twoAgo.withDayOfMonth(1).toString(), twoAgo.plusMonths(1).withDayOfMonth(1).minusDays(1).toString(), 0, 1);
+ ArrayList<String> finishedList = new ArrayList<>();
+ finishedList.add(a2.toString());
+ finishedList.add(b2.toString());
+ finishedList.add(c2.toString());
+ return ProReport.builder()
+ .dateList(StringUtils.join(dateList, ','))
+ .materialList(StringUtils.join(materialList, ','))
+ .processList(StringUtils.join(processList, ','))
+ .finishedList(StringUtils.join(finishedList, ','))
+ .build();
+ }
+}
--
Gitblit v1.9.3