From 46adcbf7494340a495539708210bb39110bdc33b Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期六, 29 十一月 2025 17:35:03 +0800
Subject: [PATCH] 快速登记、化验及称重作业页面提交1
---
fzzy-igdss-web/src/main/java/com/fzzy/sys/manager/inout/InoutManager.java | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 153 insertions(+), 0 deletions(-)
diff --git a/fzzy-igdss-web/src/main/java/com/fzzy/sys/manager/inout/InoutManager.java b/fzzy-igdss-web/src/main/java/com/fzzy/sys/manager/inout/InoutManager.java
new file mode 100644
index 0000000..222cd44
--- /dev/null
+++ b/fzzy-igdss-web/src/main/java/com/fzzy/sys/manager/inout/InoutManager.java
@@ -0,0 +1,153 @@
+package com.fzzy.sys.manager.inout;
+
+import com.fzzy.igds.constant.Constant;
+import com.fzzy.igds.domain.InoutConf;
+import com.fzzy.igds.domain.InoutSysConf;
+import com.fzzy.igds.service.InoutConfService;
+import com.fzzy.igds.utils.SystemUtil;
+import com.ruoyi.common.core.redis.RedisCache;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description 鍑哄叆搴撲笟鍔″鐞�
+ * @Author CZT
+ * @Date 2025/11/29 11:02
+ */
+@Slf4j
+@Component
+public class InoutManager {
+
+ @Resource
+ private RedisCache redisCache;
+ @Resource
+ private InoutConfService inoutConfService;
+
+ /**
+ * 鏍规嵁鐢ㄦ埛璇锋眰淇℃伅锛屾牴鎹綋鍓嶅鎴风數鑴慖P锛岃幏鍙栧嚭鍏ュ簱绉伴噸涓婃閫夋嫨鐨勫湴纾�
+ *
+ * @param httpRequest
+ * @return
+ */
+ public String getInoutWeightByClient(HttpServletRequest httpRequest) {
+ String userIp = SystemUtil.getIP(httpRequest);
+ log.debug("----------------鏍规嵁鐢ㄦ埛IP鑾峰彇閫夋嫨-鍦扮----{}", userIp);
+
+ String key = "INOUT:WEIGHT:" + userIp;
+ String sort = (String) redisCache.getCacheObject(key);
+ if (com.ruoyi.common.utils.StringUtils.isEmpty(sort)) sort = "1";
+ return sort;
+ }
+
+ /**
+ * 鑾峰彇鍑哄叆搴撶殑鏁翠釜娴佺▼淇℃伅
+ *
+ * @param companyId
+ * @param deptId
+ * @param inoutType
+ * @return
+ */
+ public String getInoutProgressConf(String companyId, String deptId, String inoutType) {
+ // 浠庣紦瀛樹腑鑾峰彇鍑哄叆搴撶郴缁熼厤缃俊鎭�
+ InoutSysConf inoutSysConf = inoutConfService.getCacheInoutSysConf(companyId, deptId);
+ String progressConf = null;
+ if (inoutSysConf != null) {
+ if (Constant.TYPE_IN.equals(inoutType)) {
+ progressConf = inoutSysConf.getProgressIn();
+ }
+ if (Constant.TYPE_OUT.equals(inoutType)) {
+ progressConf = inoutSysConf.getProgressOut();
+ }
+ }
+ return progressConf;
+ }
+
+ /**
+ * 鑾峰彇鍑哄叆搴撹澶囬厤缃俊鎭�
+ *
+ * @param companyId
+ * @param deptId
+ * @return
+ */
+ public List<InoutConf> getListInoutConf(String companyId, String deptId) {
+ return inoutConfService.getCacheInoutConf(companyId, deptId);
+ }
+
+ /**
+ * 鏍规嵁閰嶇疆鑾峰彇鍑哄叆搴撶殑閰嶇疆鍙傛暟
+ *
+ * @param listInoutConf 閰嶇疆鍒楄〃
+ * @param sort 鏂规搴忓彿
+ * @param type 璁惧绫诲瀷
+ * @param inoutProgress 鍑哄叆搴撴祦绋�
+ * @return 杞︾墝璁惧閰嶇疆锛屾病鏈夊垯杩斿洖NULL
+ */
+ public InoutConf getInoutConf(List<InoutConf> listInoutConf, String sort, String type, String inoutProgress, int inOrder) {
+ if (null == listInoutConf) {
+ return new InoutConf(sort);
+ }
+ if (StringUtils.isEmpty(sort)) sort = "1";
+
+ InoutConf result = null;
+ for (InoutConf conf : listInoutConf) {
+ if (sort.equals(conf.getSort()) && type.equals(conf.getType()) && inoutProgress.equals(conf.getInoutProgress())) {
+ if (conf.getInOrder() == inOrder) {
+ result = conf;
+ break;
+ }
+ }
+ }
+
+ if (null == result) return new InoutConf(sort);
+
+ return result;
+ }
+
+ public List<InoutConf> getInoutConf(List<InoutConf> listInoutConf, String type) {
+ List<InoutConf> result = new ArrayList<>();
+ if (null == listInoutConf) return result;
+ for (InoutConf conf : listInoutConf) {
+ if (type.equals(conf.getType())) {
+ result.add(conf);
+ }
+ }
+ return result;
+ }
+
+ public InoutConf getInoutConf(List<InoutConf> listInoutConf, String sort, String type) {
+ if (null == listInoutConf) return new InoutConf(sort);
+ if (StringUtils.isEmpty(sort)) sort = "1";
+
+ for (InoutConf conf : listInoutConf) {
+ if (sort.equals(conf.getSort()) && type.equals(conf.getType())) {
+ return conf;
+ }
+ }
+ return new InoutConf(sort);
+ }
+
+ /**
+ * 鑾峰彇鍦扮閲嶉噺缂栬緫鏍囩
+ *
+ * @param companyId
+ * @param deptId
+ * @return
+ */
+ public String getWeightEditTag(String companyId, String deptId) {
+ // 浠庣紦瀛樹腑鑾峰彇鍑哄叆搴撶郴缁熼厤缃俊鎭�
+ InoutSysConf inoutSysConf = inoutConfService.getCacheInoutSysConf(companyId, deptId);
+ String weightEditTag = Constant.YN_N;
+ if (inoutSysConf != null) {
+ weightEditTag = inoutSysConf.getWeightEditTag();
+ }
+ if (null == weightEditTag) weightEditTag = Constant.YN_N;
+
+ return weightEditTag;
+ }
+}
--
Gitblit v1.9.3