From d8047152e563ba7816208a3fe9cf1ffdc9cddc83 Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期三, 21 六月 2023 23:36:37 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
igds-inout/src/main/java/com/ld/igds/inout/service/impl/InoutServiceImpl.java | 86 +++++++++++++++++++++++--------------------
1 files changed, 46 insertions(+), 40 deletions(-)
diff --git a/igds-inout/src/main/java/com/ld/igds/inout/service/impl/InoutServiceImpl.java b/igds-inout/src/main/java/com/ld/igds/inout/service/impl/InoutServiceImpl.java
index 460f565..864fa2a 100644
--- a/igds-inout/src/main/java/com/ld/igds/inout/service/impl/InoutServiceImpl.java
+++ b/igds-inout/src/main/java/com/ld/igds/inout/service/impl/InoutServiceImpl.java
@@ -1,28 +1,25 @@
package com.ld.igds.inout.service.impl;
import com.bstek.dorado.data.entity.EntityUtils;
-import com.ld.igds.check.dto.CheckItemData;
import com.ld.igds.common.CoreCommonService;
import com.ld.igds.constant.BizType;
import com.ld.igds.constant.Constant;
-import com.ld.igds.constant.FoodType;
import com.ld.igds.constant.RedisConst;
import com.ld.igds.data.CommonData;
import com.ld.igds.data.Page;
import com.ld.igds.inout.InoutConstant;
-import com.ld.igds.inout.dto.InoutData;
-import com.ld.igds.inout.dto.InoutParam;
import com.ld.igds.inout.dto.InoutCheckData;
import com.ld.igds.inout.dto.InoutCheckParam;
+import com.ld.igds.inout.dto.InoutData;
+import com.ld.igds.inout.dto.InoutParam;
import com.ld.igds.inout.mapper.InoutCheckMapper;
import com.ld.igds.inout.mapper.InoutRecordMapper;
import com.ld.igds.inout.service.InoutService;
-import com.ld.igds.io.constant.OrderRespEnum;
import com.ld.igds.models.Depot;
+import com.ld.igds.models.InoutPrice;
import com.ld.igds.util.ContextUtil;
import com.ld.igds.util.DateUtil;
import com.ld.igds.util.RedisUtil;
-import com.ld.igds.websocket.WebSocketPacket;
import com.ld.igds.websocket.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -103,7 +100,7 @@
inoutMapper.deleteData(param);
- delInoutFromCache(param.getDeptId(), param.getType(), param.getId());
+ delFromCache(param.getDeptId(), param.getType(), param.getId());
return null;
}
@@ -115,7 +112,7 @@
}
// 缂撳瓨涓垹闄�
- delInoutFromCache(param.getDeptId(), param.getType(), param.getId());
+ delFromCache(param.getDeptId(), param.getType(), param.getId());
param.setProgress(InoutConstant.PROGRESS_RECORD);
param.setRecordStatus(InoutConstant.RECORD_STATUS_ERROR);
@@ -171,6 +168,8 @@
@Override
public String updateData(InoutData data) throws Exception {
+
+ data.setUpdateTime(new Date());
if (StringUtils.isEmpty(data.getCompanyId())) {
data.setCompanyId(ContextUtil.getCompanyId());
}
@@ -187,6 +186,29 @@
//鏇存柊缂撳瓨
updateInoutCache(newData);
+ return null;
+ }
+
+ @Override
+ public String updateDataByHandle(InoutData data) {
+ data.setUpdateTime(new Date());
+
+ if (StringUtils.isEmpty(data.getCompanyId())) {
+ data.setCompanyId(ContextUtil.getCompanyId());
+ }
+ InoutData newData;
+ if (EntityUtils.isEntity(data)) {
+ newData = new InoutData();
+ BeanUtils.copyProperties(data, newData, new String[]{"checkItems", "files"});
+ } else {
+ newData = data;
+ }
+
+ inoutMapper.updateDataByHandle(newData);
+
+ //鏇存柊缂撳瓨
+ updateInoutCache(newData);
+
return null;
}
@@ -260,11 +282,11 @@
public String toComplete(InoutParam param) throws Exception {
if (null == param.getCompanyId()) {
- param.setCompanyId(ContextUtil.getCompanyId());
+ param.setCompanyId(ContextUtil.getDefaultCompanyId());
}
// 娓呴櫎缂撳瓨
- this.delInoutFromCache(param.getDeptId(), param.getType(), param.getId());
+ this.delFromCache(param.getDeptId(), param.getType(), param.getId());
inoutMapper.toComplete(param);
@@ -336,7 +358,7 @@
if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
- delInoutFromCache(data.getDeptId(), data.getType(), data.getId());
+ delFromCache(data.getDeptId(), data.getType(), data.getId());
setCompleteInoutCache(data.getDeptId(), data);
@@ -348,7 +370,7 @@
}
- public void delInoutFromCache(String deptId, String type, String id) {
+ public void delFromCache(String deptId, String type, String id) {
if (StringUtils.isEmpty(deptId)) {
return;
}
@@ -425,22 +447,6 @@
}
@Override
- public void notifyWeb(InoutData result) {
- // 濡傛灉褰撳墠涓烘弧杞︾О閲嶆墽琛屾帹閫�
- if (result.getType().equals(InoutConstant.TYPE_IN) && result.getProgress().equals(InoutConstant.PROGRESS_WEIGHT_FULL)) {
- WebSocketPacket packet = new WebSocketPacket();
- packet.setBizType(BizType.SCREEN_CHECK.getCode());
- packet.setCompanyId(result.getCompanyId());
- packet.setOrderResp(OrderRespEnum.MSG_SUCCESS.getCode());
- packet.setData(result);
- packet.setBizTag(InoutConstant.PROGRESS_WEIGHT_FULL);
- log.debug("----鍚戝寲楠屽ぇ灞忔帹閫佹弧杞︾О閲嶄俊鎭� ----{}", result.getPlateNum());
- WebSocketServer.sendByBizTag(packet);
- }
-
- }
-
- @Override
public Page<InoutData> pageUnCompleteData(InoutParam param) {
if (StringUtils.isEmpty(param.getCompanyId())) {
@@ -473,10 +479,7 @@
}
@Override
- public InoutData getLastRecord(String companyId, String depotId) {
- InoutParam param = new InoutParam();
- param.setCompanyId(companyId);
- param.setDepotId(depotId);
+ public InoutData getLastRecord(InoutParam param) {
return inoutMapper.getLastRecord(param);
}
@@ -484,7 +487,7 @@
public String addInoutDataByLossOver(InoutData data) {
// 鑾峰彇涓婁竴杞︾殑娴佹按鏁版嵁
- InoutData inoutData = this.getLastRecord(data.getCompanyId(), data.getDepotId());
+ // InoutData inoutData = this.getLastRecord(data.getCompanyId(), data.getDepotId());
// // 璁剧疆娴佹按鐨勫簱瀛�
// if (InoutConstant.TYPE_IN.equals(inoutData.getType())) {
@@ -515,12 +518,6 @@
redisUtil.set(cacheKey, data.getCheckItems(), 60 * 60 * 24 * 3);
}
- @SuppressWarnings("unchecked")
- @Override
- public List<CheckItemData> getCheckCache(String companyId, String checkId) {
- String cacheKey = RedisConst.buildKey(companyId, checkId);
- return (List<CheckItemData>) redisUtil.get(cacheKey);
- }
/**
* 鍑哄叆搴撴祦绋婭D鍒涘缓 202001030001 202001030001
@@ -662,7 +659,6 @@
.getCode())) {
-
// 鍒涘缓涓�涓瓙浠诲姟杩涜鎺ㄩ�佷俊鎭�
FutureTask<String> futureTask = new FutureTask<>(new NotifyScreenTask(curList, completeList, deptId));
@@ -764,4 +760,14 @@
return null;
}
+ @Override
+ public List<InoutPrice> getPrice(InoutCheckParam param) {
+ if(null == param.getStart()){
+ param.setStart(new Date());
+ }
+ if(null == param.getEnd()){
+ param.setEnd(new Date());
+ }
+ return inoutCheckMapper.getPrice(param);
+ }
}
--
Gitblit v1.9.3