From 801bb13cadd66f9eb60fc917066751bd6672741b Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期一, 01 十二月 2025 16:20:58 +0800
Subject: [PATCH] 提交合计相关字体大小
---
north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java | 349 +++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 298 insertions(+), 51 deletions(-)
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java
index c5241eb..e6ebc62 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java
@@ -3,40 +3,44 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.example.erp.common.AsyncQueryExecutor;
import com.example.erp.common.Constants;
+import com.example.erp.common.Result;
import com.example.erp.dto.pp.OrderNumberTransferDTO;
+import com.example.erp.dto.sd.OrderProcessSortDTO;
import com.example.erp.entity.pp.*;
-import com.example.erp.entity.sd.*;
+import com.example.erp.entity.sd.BasicData;
+import com.example.erp.entity.sd.Order;
+import com.example.erp.entity.sd.OrderDetail;
+import com.example.erp.entity.sd.OrderProcessDetail;
import com.example.erp.entity.userInfo.Log;
import com.example.erp.entity.userInfo.SysError;
import com.example.erp.exception.ServiceException;
import com.example.erp.mapper.mm.FinishedOperateLogMapper;
import com.example.erp.mapper.pp.*;
-import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.erp.mapper.sd.*;
import com.example.erp.mapper.userInfo.LogMapper;
import com.example.erp.service.mm.FinishedGoodsInventoryService;
import com.example.erp.service.sd.OrderProcessDetailService;
import com.example.erp.service.userInfo.LogService;
import com.example.erp.service.userInfo.SysErrorService;
+import com.example.erp.tools.JacksonUtil;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.RequiredArgsConstructor;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
+import org.springframework.data.redis.core.RedisCallback;
+import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.client.RestTemplate;
-
-import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
@@ -45,6 +49,8 @@
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
@Service
@DS("pp")
@@ -58,13 +64,9 @@
private final ReportingWorkDetailMapper reportingWorkDetailMapper;
private final OrderMapper orderMapper;
private final OrderDetailMapper orderDetailMapper;
-
private final FlowCardMapper flowCardMapper;
-
private final OrderProcessDetailService orderProcessDetailService;
-
private final LogService logService;
-
private final LogMapper logMapper;
private final OrderGlassDetailMapper orderGlassDetailMapper;
private final SysErrorService sysErrorService;
@@ -74,6 +76,7 @@
private final ReworkMapper reworkMapper;
private final BasicDataMapper basicDataMapper;
private final FinishedGoodsInventoryService finishedGoodsInventoryService;
+ private final StringRedisTemplate stringRedisTemplate;
@Resource
private AsyncQueryExecutor asyncExecutor;
@@ -158,6 +161,8 @@
//宸ヨ壓娴佺▼
map.put("technologicalProcess", technologicalProcess);
+ //鑾峰彇鏈嶅姟鍣ㄦ椂闂�
+ map.put("reportingWorkTiem", LocalDateTime.now());
//璁惧涓嬫媺妗�
map.put("device", reportingWorkMapper.SelectWorkBasicDeviceMp(process));
//鐝粍涓嬫媺妗�
@@ -184,7 +189,7 @@
// if (reviewedState==1){//宸插鏍�
//涓嶆槸绗竴閬撳伐搴忥紝鏌ヨ鎶ュ伐鏁版嵁
List<Map<String,String>> details = reportingWorkMapper.SelectReworlDetailMp(processIdStr, splitTechNumbers(technologyStr), process,previousProcess,laminating);
- if(process.equals("涓┖")){
+ if(laminating.equals("stepD")){
//鑾峰彇璇ユ祦绋嬪崱璁㈠崟鍙�
String orderId = reportingWorkMapper.selectOrderid(processIdStr);
details.forEach( detail -> {
@@ -270,19 +275,7 @@
List<ReportingWorkDetail> reportingWorkDetails = JSONArray.parseArray(
JSONObject.toJSONString(reportingWorkJson.get("detail")), ReportingWorkDetail.class);
- // 鎶ュ伐缂栧彿
- Integer maxId = reportingWorkMapper.selectMaxReportingWorkId();
- if (maxId == null) {
- maxId = 0;
- }
- String formattedNumber = String.format("%04d", maxId + 1);
- // 鏍煎紡鍖栧綋鍓嶆棩鏈�
- Date currentDate = new Date();
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd");
- String formattedDate = dateFormat.format(currentDate);
- String reportingWorkId = "BG" + formattedDate + formattedNumber;
- reportingWork.setReportingWorkId(reportingWorkId);
// 澶勭悊宸ュ簭 ID
String[] processIdStr = reportingWork.getProcessId() != null
@@ -306,9 +299,23 @@
reportingWork.setReportingWorkTime(LocalDateTime.now());
}
- // 鏄惁绾胯ˉ 1鐜拌ˉ 0鏈幇琛�
+ // 鏄惁鐜拌ˉ 1鐜拌ˉ 0鏈幇琛�
int isPatch = reportingWorkJson.getInteger("isPatch") != null
? reportingWorkJson.getInteger("isPatch") : 0;
+
+ // 鎶ュ伐缂栧彿
+ Integer maxId = reportingWorkMapper.selectMaxReportingWorkId();
+ if (maxId == null) {
+ maxId = 0;
+ }
+ String formattedNumber = String.format("%04d", maxId + 1);
+
+ // 鏍煎紡鍖栧綋鍓嶆棩鏈�
+ Date currentDate = new Date();
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd");
+ String formattedDate = dateFormat.format(currentDate);
+ String reportingWorkId = "BG" + formattedDate + formattedNumber;
+ reportingWork.setReportingWorkId(reportingWorkId);
// 涓昏〃鎻掑叆
reportingWorkMapper.insert(reportingWork);
@@ -433,7 +440,7 @@
reportingWorkDetailMapper.insert(reportingWorkDetail);
}
- // 鏇存柊娴佺▼鍗℃姤宸ユ暟閲�
+ // 鍒ゆ柇鏈�鍚庝竴閬撳伐搴忥紝鏇存柊娴佺▼鍗℃姤宸ユ暟閲�
if (reportingWork.getNextProcess() == null || reportingWork.getNextProcess().isEmpty()) {
LambdaUpdateWrapper<FlowCard> flowCardLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
flowCardLambdaUpdateWrapper
@@ -649,22 +656,22 @@
String nowDate = LocalDate.now().toString();
//鑾峰彇鎶ュ伐宸ュ簭鏄惁涓哄鍚堝伐绋�
String laminating = reportingWorkMapper.getProcessLaminating(thisProcess);
-//鍚堢墖宸ュ簭
-if (laminating.indexOf("step")!=-1){
- LambdaUpdateWrapper
- <ReportingWork> updateWrapper = new LambdaUpdateWrapper<>();
- updateWrapper
- .eq(ReportingWork::getProcessId, processIdStr[0])
- .eq(ReportingWork::getThisProcess, reportingWork.get("process"))
- .eq(ReportingWork::getReviewedState, 0)
- .setSql("reviewed_state =1")
- .set(ReportingWork::getReviewed, userName)
- .set(ReportingWork::getExamineTime, nowDate);
- reportingWorkMapper.update(null, updateWrapper);
-}else {
- reportingWorkMapper.ReviewReportingWorkMp(processIdStr[0],reportingWork.get("process"),technologyStr,userName);
+ //鍚堢墖宸ュ簭
+ if (laminating.indexOf("step")!=-1){
+ LambdaUpdateWrapper
+ <ReportingWork> updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper
+ .eq(ReportingWork::getProcessId, processIdStr[0])
+ .eq(ReportingWork::getThisProcess, reportingWork.get("process"))
+ .eq(ReportingWork::getReviewedState, 0)
+ .setSql("reviewed_state =1")
+ .set(ReportingWork::getReviewed, userName)
+ .set(ReportingWork::getExamineTime, nowDate);
+ reportingWorkMapper.update(null, updateWrapper);
+ }else {
+ reportingWorkMapper.ReviewReportingWorkMp(processIdStr[0],reportingWork.get("process"),technologyStr,userName);
-}
+ }
return true;
}
@@ -741,6 +748,14 @@
JSONObject reportingWorkJson = new JSONObject(reportingWorkMap);
ReportingWork reportingWork = JSONObject.parseObject(JSONObject.toJSONString(reportingWorkJson.get("title")), ReportingWork.class);
List<ReportingWorkDetail> reportingWorkDetails = JSONArray.parseArray(JSONObject.toJSONString(reportingWorkJson.get("detail")), ReportingWorkDetail.class);
+
+
+ ReportingWork reportingWork1 = reportingWorkMapper.selectOne(new LambdaQueryWrapper<ReportingWork>()
+ .eq(ReportingWork::getReportingWorkId, reportingWork.getReportingWorkId()));
+ reportingWork.setCreatorId(reportingWork1.getCreatorId());
+ reportingWork.setCreator(reportingWork1.getCreator());
+ reportingWork.setUpdateTime(LocalDateTime.now());
+
//鏌ヨ璇ユ姤宸ユ槸鍚︿负鎶ュ伐杞Щ璁㈠崟
Integer transferState = reportingWorkMapper.selectReviewedState(reportingWork.getReportingWorkId());
if (transferState !=3){
@@ -899,7 +914,7 @@
} catch (Exception e) {
e.printStackTrace();
- throw new RuntimeException("骞惰鏌ヨ鎶ュ伐璁板綍寮傚父锛�" + e.getMessage(), e);
+ throw new RuntimeException("鎶ュ伐鏌ヨ骞惰鏌ヨ鎶ュ伐璁板綍寮傚父锛�" + e.getMessage(), e);
}
return result;
@@ -1112,7 +1127,9 @@
List<ReportingWork> ReportingWorks = reportingWorkMapper.selectJoinList(ReportingWork.class,
new MPJLambdaWrapper<ReportingWork>()
.select(ReportingWork::getReportingWorkId)
- .leftJoin(ReportingWorkDetail.class, ReportingWorkDetail::getReportingWorkId, ReportingWork::getReportingWorkId)
+ .leftJoin(ReportingWorkDetail.class,
+ ReportingWorkDetail::getReportingWorkId,
+ ReportingWork::getReportingWorkId)
.eq(ReportingWork::getProcessId,reportingWork.getProcessId())
.eq(ReportingWork::getThisProcess,reportingWork.getThisProcess())
.eq(ReportingWork::getDeviceName,reportingWork.getDeviceName())
@@ -1127,12 +1144,7 @@
//鍒ゆ柇鎶ュ伐琛ㄦ槸鍚﹀瓨鍦紝涓嶅瓨鍦ㄥ垯鏂板鎶ュ伐涓诲壇琛ㄦ暟鎹紝瀛樺湪鍒欎慨鏀瑰壇琛ㄦ暟鎹�
if(ReportingWorks.isEmpty()){
//鑾峰彇褰撳墠鏈�澶ф姤宸ュ崟鍙风敓鎴愭姤宸ュ崟鍙�
- String formattedNumber = String.format("%04d", reportingWorkMapper.selectMaxReportingWorkId() + 1);
- //鏍煎紡鍖栧綋鍓嶆棩鏈�
- Date currentDate = new Date();
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd");
- String formattedDate = dateFormat.format(currentDate);
- String reportingWorkId = "BG" + formattedDate + formattedNumber;
+ String reportingWorkId = this.getTodayMaxReportingId();
reportingWork.setReportingWorkId(reportingWorkId);
reportingWorkDetail.setReportingWorkId(reportingWorkId);
@@ -1195,7 +1207,7 @@
//灏嗗紓甯镐紶鍏ユ暟鎹簱
SysError sysError = new SysError();
sysError.setError(e +Arrays.toString(e.getStackTrace()));
- sysError.setFunc("姹夌幓mes鎶ュ伐");
+ sysError.setFunc("mes鎶ュ伐");
sysErrorService.insert(sysError);
throw new ServiceException(Constants.Code_500, "鏁版嵁璇锋眰寮傚父锛岃妫�鏌�");
@@ -1582,4 +1594,239 @@
map.put("breakageReason", reportingWorkMapper.selectBasicNameByType("breakagereason"));
return map;
}
+
+
+ //@Transactional(rollbackFor = Exception.class , noRollbackFor = ServiceException.class)
+ public Result mesReportingWorkSvToRedis(Map<String, Object> reportingWorkMap) throws JsonProcessingException, InterruptedException {
+
+ //璁剧疆鍥炴粴鐐�
+ //Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
+ //鎺ユ敹瑙f瀽涓婚檮琛ㄤ俊鎭�
+ String titleJson = JacksonUtil.writeValueAsString(reportingWorkMap.get("title"));
+ String detailJson = JacksonUtil.writeValueAsString(reportingWorkMap.get("detail"));
+ ReportingWork reportingWork = JacksonUtil.readValue(titleJson, ReportingWork.class);
+ ReportingWorkDetail reportingWorkDetail = JacksonUtil.readValue(detailJson, ReportingWorkDetail.class);
+ String Base_KEY = "reportingWork:"+reportingWork.getProcessId()+"/"+reportingWorkDetail.getTechnologyNumber()+":"+reportingWork.getThisProcess()+":"+reportingWork.getDeviceName();
+ String reportingWork_KEY = Base_KEY+":title";
+ String reportingWorkDetail_KEY = Base_KEY+":detail:"+reportingWorkDetail.getOrderNumber();
+
+ String process_KEY = "reportingWork:"+reportingWork.getProcessId()+"/"+reportingWorkDetail.getTechnologyNumber()+":process";
+
+ //鍒ゆ柇閿佹槸鍚﹀瓨鍦紝瀛樺湪绛夊緟5绉�
+ if(Boolean.TRUE.equals(stringRedisTemplate.hasKey("lock:reportingWork"))){
+ Thread.sleep(5*1000);
+ if(Boolean.TRUE.equals(stringRedisTemplate.hasKey("lock:reportingWork"))){
+ throw new ServiceException(Constants.Code_600, "褰撳墠鏈嶅姟鍣ㄦ鍦ㄥ鐞嗘姤宸ユ暟鎹紝璇风◢鍚庨噸璇曪紒");
+ }
+ }
+
+
+ //鍒ゆ柇宸ュ簭鏄惁瀛樺湪redis涓�
+ if(!Boolean.TRUE.equals(stringRedisTemplate.hasKey(process_KEY+":"+reportingWork.getThisProcess()))){
+ List<OrderProcessSortDTO> orderProcessSortDTOList = orderProcessDetailMapper.selectProcessSort(
+ reportingWork.getOrderId(),
+ reportingWork.getProcessId(),
+ reportingWorkDetail.getOrderNumber(),
+ reportingWorkDetail.getTechnologyNumber()
+ );
+ if (orderProcessSortDTOList.isEmpty()){
+ throw new ServiceException(Constants.Code_600, "鏈娴嬪埌娴佺▼鍗′俊鎭紝璇锋鏌�");
+ }
+
+ orderProcessSortDTOList.forEach(orderProcessSortDTO -> {
+ Map<String, String> map = new HashMap<>();
+ map.put("sort",orderProcessSortDTO.getSort());
+ map.put("recombination",orderProcessSortDTO.getRecombination());
+ stringRedisTemplate.opsForHash().putAll(process_KEY+":"+orderProcessSortDTO.getProcess(), map);
+ });
+ }
+ String recombination = (String) stringRedisTemplate.opsForHash().get(process_KEY+":"+reportingWork.getThisProcess(),"recombination");
+
+ if (!recombination.isEmpty()){
+ throw new ServiceException(Constants.Code_600, "澶嶅悎宸ュ簭璇峰埌ERP涓繘琛屾姤宸�");
+ }
+
+
+
+
+
+ //鍒ゆ柇鏄惁redis姝ゆ姤宸ョ紪鍙穔ey鏄惁瀛樺湪
+ if(Boolean.TRUE.equals(stringRedisTemplate.hasKey(reportingWork_KEY))){
+ stringRedisTemplate.opsForHash().increment(
+ reportingWork_KEY,
+ "thisCompletedQuantity",
+ reportingWork.getThisCompletedQuantity()
+ );
+ }
+ else{
+ stringRedisTemplate.opsForHash().putAll(
+ reportingWork_KEY,
+ JacksonUtil.readValueObjectToString(reportingWork,new TypeReference<Map<String, String>>() {})
+ );
+ }
+ //鑾峰彇鍙姤鏁伴噺
+
+ //鍒ゆ柇鏄惁redis姝ゆ姤宸ユ槑缁嗕腑key鏄惁瀛樺湪
+ if(Boolean.TRUE.equals(stringRedisTemplate.hasKey(reportingWorkDetail_KEY))){
+ stringRedisTemplate.opsForHash().increment(
+ reportingWorkDetail_KEY,
+ "completedQuantity",
+ reportingWorkDetail.getCompletedQuantity()
+ );
+ }else {
+ stringRedisTemplate.opsForHash().putAll(
+ reportingWorkDetail_KEY,
+ JacksonUtil.readValueObjectToString(reportingWorkDetail,new TypeReference<Map<String, String>>() {})
+ );
+ }
+ return Result.success("鎻愪氦鎴愬姛");
+ }
+
+ public void redisToMysqlReportingWork() throws InterruptedException {
+ if(Boolean.TRUE.equals(stringRedisTemplate.hasKey("lock:reportingWork"))){
+ throw new ServiceException(Constants.Code_600, "瀹氭椂浠诲姟:褰撳墠鏈嶅姟鍣ㄦ鍦ㄥ鐞嗘姤宸ユ暟鎹紝璇风◢鍚庨噸璇曪紒");
+ }
+ //鑾峰彇鎵�鏈塳ey
+ String pattern = "reportingWork:*";
+ Set<String> keys = stringRedisTemplate.keys(pattern);
+
+ //鍒ゆ柇redis涓槸鍚﹀瓨鍦ㄦ姤宸ユ暟鎹�,瀛樺湪鍒欐坊鍔犻攣 骞朵笖淇敼key杞Щ鍒颁笂浼爉ysql鐨刱ey涓�
+ if (keys != null && !keys.isEmpty()) {
+ //娣诲姞閿�
+ stringRedisTemplate.opsForValue().set("lock:reportingWork","1",60, TimeUnit.SECONDS);
+
+ if(Boolean.FALSE.equals(stringRedisTemplate.hasKey("upload:*" ))){
+ keys.forEach(key -> {
+ stringRedisTemplate.rename(key, "upload:" + key);
+ });
+ }
+ }else{
+ return;
+ }
+ //娣诲姞鏆傚仠鏃堕棿锛屾柟寮忚幏鍙杕ap鏃讹紝redis涓暟鎹繕鍦ㄥ彉鍖�
+ Thread.sleep(200);
+
+
+ // 淇濆瓨鏃ュ織锛屾妸redis涓殑鏁版嵁淇濆瓨鍒版棩蹇椾腑
+ Map<String, Map<Object, Object>> map = this.getAllHashesByPattern("upload:reportingWork:*");
+ Log log = new Log();
+ log.setContent(JacksonUtil.writeValueAsString(map));
+ log.setFunction("reportingWorkRedisToMysql");
+ log.setOperator("鑷姩瀹氭椂鎶ュ伐");
+ logService.saveLog(log);
+ //鍒犻櫎閿侊紝璁╂帴鍙g户缁帴鏀舵姤宸�
+ stringRedisTemplate.delete("lock:reportingWork");
+
+ //鑾峰彇鍒版墍鏈夊弬鏁板悗娓呯┖redis搴�
+ // stringRedisTemplate.getConnectionFactory().getConnection().flushDb();
+
+ //浠巖edis涓幏鍙栨墍鏈夋姤宸ヤ富琛ㄦ暟鎹�
+ String titleKeyString = "upload:reportingWork:*:title";
+ Set<String> titleKeys = stringRedisTemplate.keys(titleKeyString);
+ if (titleKeys != null) {
+ titleKeys.forEach(titleKey -> {
+ ReportingWork reportingWork = JSON.parseObject(
+ JSONObject.toJSONString(stringRedisTemplate.opsForHash().entries(titleKey))
+ , ReportingWork.class
+ );
+ //鑾峰彇褰撳ぉ涓�鍏辨湁澶氬皯涓姤宸ョ紪鍙�
+ String reportingWorkId = this.getTodayMaxReportingId();
+ //娣诲姞鎶ュ伐缂栧彿
+ reportingWork.setReportingWorkId(reportingWorkId);
+ //寰�涓昏〃鎻掑叆鎶ュ伐涓绘暟鎹�
+ reportingWorkMapper.insert(reportingWork);
+
+ String detailKeyString = titleKey.replace(":title", ":detail:*");
+ Set<String> detailKeys = stringRedisTemplate.keys(detailKeyString);
+ if (detailKeys != null) {
+ detailKeys.forEach(detailKey -> {
+
+ ReportingWorkDetail reportingWorkDetail = JSON.parseObject(
+ JSONObject.toJSONString(stringRedisTemplate.opsForHash().entries(detailKey))
+ , ReportingWorkDetail.class
+ );
+ reportingWorkDetail.setReportingWorkId(reportingWorkId);
+ reportingWorkDetailMapper.insert(reportingWorkDetail);
+
+ //鏍规嵁璁㈠崟id锛岃鍗曞簭鍙凤紝浠ュ強灏忕墖搴忓彿 鏇存柊灏忕墖娴佺▼鐨勫畬宸ユ暟閲忎互鍙婂埡鐮存暟閲�
+ LambdaUpdateWrapper<OrderProcessDetail> updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper.eq(OrderProcessDetail::getOrderNumber, reportingWorkDetail.getOrderNumber())
+ .eq(OrderProcessDetail::getProcessId, reportingWork.getProcessId())
+ .eq(OrderProcessDetail::getOrderId, reportingWork.getOrderId())
+ .eq(OrderProcessDetail::getProcess, reportingWork.getThisProcess())
+ .eq(OrderProcessDetail::getTechnologyNumber, reportingWorkDetail.getTechnologyNumber())
+ .setSql("reporting_work_num_count = reporting_work_num_count +" + reportingWorkDetail.getCompletedQuantity())
+ .setSql("reporting_work_num =reporting_work_num +" + reportingWorkDetail.getCompletedQuantity());
+
+ orderProcessDetailMapper.update(null, updateWrapper);
+ });
+ }
+
+ });
+ }
+ Set<String> uploadKeys = stringRedisTemplate.keys("upload:reportingWork:*");
+ if (uploadKeys != null) {
+ stringRedisTemplate.delete(uploadKeys);
+ }
+
+ }
+
+ public String getTodayMaxReportingId() {
+ String formattedNumber = String.format("%04d", reportingWorkMapper.selectMaxReportingWorkId() + 1);
+ //鏍煎紡鍖栧綋鍓嶆棩鏈�
+ Date currentDate = new Date();
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd");
+ String formattedDate = dateFormat.format(currentDate);
+ return "BG" + formattedDate + formattedNumber;
+
+ }
+
+
+/*鑾峰彇鎵�鏈夌殑鍙傛暟杞�*/
+ public Map<String, Map<Object, Object>> getAllHashesByPattern(String pattern) {
+ Set<String> keys = stringRedisTemplate.keys(pattern);
+ Map<String, Map<Object, Object>> result = new HashMap<>();
+
+ if (keys != null) {
+ for (String key : keys) {
+ Map<Object, Object> hashData = stringRedisTemplate.opsForHash().entries(key);
+ result.put(key, hashData);
+ }
+ }
+
+ return result;
+ }
+
+ @Transactional(rollbackFor = Exception.class)
+ public Result addWorkInProgress(Map<String, Object> object) {
+ List<Map<String,Object>> list = (List<Map<String,Object>>) object.get("reportingWorks");
+
+ list.forEach(item -> {
+ ReportingWork reportingWork = JSONObject.parseObject(
+ JSONObject.toJSONString(item.get("processTitle")), ReportingWork.class);
+ Map<String, String> mapTitle = new HashMap<>();
+ String[] processIdStr = reportingWork.getProcessId() != null
+ ? reportingWork.getProcessId().split("/")
+ : new String[]{""};
+ mapTitle.put("process", reportingWork.getPreviousProcess());
+ mapTitle.put("processId", reportingWork.getProcessId());
+ mapTitle.put("thisProcess", reportingWork.getThisProcess());
+ mapTitle.put("technologyStr", processIdStr[1]);
+ mapTitle.put("userName", object.get("userName").toString());
+ ReviewReportingWorkSv(mapTitle);
+
+
+ Map<String, Object> map = new HashMap<>();
+ map.put("detail", item.get("processList"));
+ map.put("title", item.get("processTitle"));
+ map.put("type", object.get("type"));
+ map.put("userId", object.get("userId"));
+ map.put("userName", object.get("userName"));
+ map.put("qualityInsStatus", object.get("qualityInsStatus"));
+ map.put("class", object.get("class"));
+ SaveReportingWorkSv(map);
+ });
+
+ return Result.success(true);
+ }
}
--
Gitblit v1.8.0