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-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java |  288 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 288 insertions(+), 0 deletions(-)

diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java
new file mode 100644
index 0000000..cc37c83
--- /dev/null
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java
@@ -0,0 +1,288 @@
+package com.fzzy.igds.service;
+
+import com.fzzy.igds.constant.Constant;
+import com.fzzy.igds.data.NoticeDto;
+import com.fzzy.igds.data.NoticeParam;
+import com.fzzy.igds.mapper.InoutNoticeMapper;
+import com.fzzy.igds.repository.InoutNoticeInRepository;
+import com.fzzy.igds.repository.InoutNoticeOutRepository;
+import com.fzzy.igds.domain.InoutNoticeIn;
+import com.fzzy.igds.domain.InoutNoticeOut;
+import com.fzzy.igds.utils.ContextUtil;
+import com.ruoyi.common.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description 鍑哄叆搴撻�氱煡鍗晄ervice灞傦紝鍖呭惈鍏ュ簱閫氱煡鍗曞拰鍑哄簱閫氱煡鍗�
+ * @Author CZT
+ * @Date 2025/11/29 16:33
+ */
+@Slf4j
+@Service
+public class InoutNoticeService {
+
+    @Resource
+    private InoutNoticeInRepository noticeInRepository;
+    @Resource
+    private InoutNoticeOutRepository noticeOutRepository;
+    @Resource
+    private InoutNoticeMapper noticeMapper;
+
+    /**
+     * JPA鍒嗛〉鏌ヨ鏁版嵁
+     *
+     * @param specification
+     * @param pageable
+     * @return
+     */
+    public Page<InoutNoticeIn> queryAllNoticeIn(Specification<InoutNoticeIn> specification, Pageable pageable) {
+        return noticeInRepository.findAll(specification, pageable);
+    }
+
+    /**
+     * JPA鏌ヨ鏁版嵁
+     * @param companyId
+     * @param deptId
+     * @return
+     */
+    public List<InoutNoticeIn> listNoticeIn(String companyId, String deptId) {
+        return noticeInRepository.listNoticeIn(companyId, deptId, Constant.COMPLETE_STATUS_NONE);
+    }
+
+    /**
+     * jpa 鑾峰彇淇℃伅
+     * @param companyId
+     * @return
+     */
+    public List<InoutNoticeIn> getUnComNoticeIn(String companyId) {
+        if (StringUtils.isEmpty(companyId)) {
+            companyId = ContextUtil.getCompanyId();
+        }
+        return noticeInRepository.listNoticeIn(companyId, Constant.COMPLETE_STATUS_NONE);
+    }
+
+    /**
+     * JPA - 淇濆瓨鏇存柊鏁版嵁
+     *
+     * @param data
+     * @return
+     */
+    public String saveOrUpdateIn(InoutNoticeIn data) {
+        if (Constant.YN_Y.equals(data.getTag())) {
+            data.setCreateBy(ContextUtil.getLoginUserName());
+            data.setCreateTime(new Date());
+            data.setAuditStatus(Constant.COMPLETE_STATUS_NONE);
+            data.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
+        }
+        data.setUpdateBy(ContextUtil.getLoginUserName());
+        data.setUpdateTime(new Date());
+        noticeInRepository.save(data);
+        return null;
+    }
+
+    /**
+     * JPA - 鍒犻櫎鏁版嵁
+     *
+     * @param data
+     * @return
+     */
+    public String delDataIn(InoutNoticeIn data) {
+        noticeInRepository.delete(data);
+        return null;
+    }
+
+    /**
+     * JPA鍒嗛〉鏌ヨ鏁版嵁
+     *
+     * @param specification
+     * @param pageable
+     * @return
+     */
+    public Page<InoutNoticeOut> queryAllNoticeOut(Specification<InoutNoticeOut> specification, Pageable pageable) {
+        return noticeOutRepository.findAll(specification, pageable);
+    }
+
+    /**
+     * JPA鏌ヨ鏁版嵁
+     * @param companyId
+     * @param deptId
+     * @return
+     */
+    public List<InoutNoticeOut> listNoticeOut(String companyId, String deptId) {
+        return noticeOutRepository.listNoticeOut(companyId, deptId, Constant.COMPLETE_STATUS_NONE);
+    }
+
+    /**
+     * Mybatis-plus 鑾峰彇淇℃伅
+     * @param companyId
+     * @return
+     */
+    public List<InoutNoticeOut> getUnComNoticeOut(String companyId) {
+        if (StringUtils.isEmpty(companyId)) {
+            companyId = ContextUtil.getCompanyId();
+        }
+        return noticeOutRepository.listNoticeOut(companyId, Constant.COMPLETE_STATUS_NONE);
+    }
+
+    /**
+     * JPA - 淇濆瓨鏇存柊鏁版嵁
+     *
+     * @param data
+     * @return
+     */
+    public String saveOrUpdateOut(InoutNoticeOut data) {
+        if (Constant.YN_Y.equals(data.getTag())) {
+            data.setCreateBy(ContextUtil.getLoginUserName());
+            data.setCreateTime(new Date());
+            data.setAuditStatus(Constant.COMPLETE_STATUS_NONE);
+            data.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
+        }
+        data.setUpdateBy(ContextUtil.getLoginUserName());
+        data.setUpdateTime(new Date());
+        noticeOutRepository.save(data);
+        return null;
+    }
+
+    /**
+     * JPA - 鍒犻櫎鏁版嵁
+     *
+     * @param data
+     * @return
+     */
+    public String delDataOut(InoutNoticeOut data) {
+        noticeOutRepository.delete(data);
+        return null;
+    }
+
+    /**
+     * JPA - 鏍规嵁ID鑾峰彇閫氱煡鍗曚俊鎭�
+     * @param id
+     * @param type
+     * @return
+     */
+    public NoticeDto queryNoticeById(String id, String type) {
+        if (StringUtils.isEmpty(id) || StringUtils.isEmpty(type)) {
+            return null;
+        }
+        NoticeDto noticeDto = new NoticeDto();
+        if (Constant.TYPE_IN.equals(type)) {
+            InoutNoticeIn noticeIn = noticeInRepository.getDataById(ContextUtil.getCompanyId(), ContextUtil.subDeptId(null), id);
+            BeanUtils.copyProperties(noticeIn, noticeDto);
+        } else {
+            InoutNoticeOut noticeOut = noticeOutRepository.getDataById(ContextUtil.getCompanyId(), ContextUtil.subDeptId(null), id);
+            BeanUtils.copyProperties(noticeOut, noticeDto);
+        }
+        return noticeDto;
+    }
+
+    /**
+     * Mybatis-plus 鏇存柊淇℃伅
+     * @param noticeInList
+     * @return
+     */
+    public void updateSumNoticeIn(List<InoutNoticeIn> noticeInList) {
+
+        if (null == noticeInList || noticeInList.isEmpty()) {
+            return;
+        }
+
+        //閬嶅巻閫氱煡鍗�
+        NoticeParam param;
+        for (InoutNoticeIn noticeIn : noticeInList) {
+
+            param = new NoticeParam(noticeIn.getCompanyId(), noticeIn.getDeptId(),
+                    noticeIn.getCustomerName(), noticeIn.getFoodVariety(), noticeIn.getId());
+
+            log.info("寮�濮嬫洿鏂板嚭搴撻�氱煡鍗�={}", param.toString());
+
+            String msg = this.reSumNoticeInComplete(param);
+            if (msg != null) {
+                log.info("鍏ュ簱閫氱煡鍗曞畬鎴愰噺缁熻澶辫触={},澶辫触鍘熷洜={}", param.toString(), msg);
+            }
+        }
+    }
+
+    /**
+     * Mybatis-plus 鑾峰彇淇℃伅
+     * @param param
+     * @return
+     */
+    public String reSumNoticeInComplete(NoticeParam param) {
+        if (StringUtils.isEmpty(param.getCustomerName())) {
+            return "瀹㈡埛缂栫爜涓虹┖锛�";
+        }
+        if (StringUtils.isEmpty(param.getFoodVariety())) {
+            return "绮鍝佺涓虹┖锛�";
+        }
+        if (StringUtils.isEmpty(param.getCompanyId())) {
+            param.setCompanyId(ContextUtil.getCompanyId());
+        }
+        if (StringUtils.isEmpty(param.getDeptId())) {
+            param.setDeptId(ContextUtil.subDeptId(null));
+        }
+        noticeMapper.reSumNoticeInComplete(param);
+        return null;
+    }
+
+    /**
+     * Mybatis-plus 鏇存柊淇℃伅
+     * @param noticeOutList
+     * @return
+     */
+    public void updateSumNoticeOut(List<InoutNoticeOut> noticeOutList) {
+
+        if (null == noticeOutList || noticeOutList.isEmpty()) {
+            return;
+        }
+
+        //閬嶅巻閫氱煡鍗�
+        NoticeParam param;
+        for (InoutNoticeOut noticeOut : noticeOutList) {
+
+            param = new NoticeParam(noticeOut.getCompanyId(), noticeOut.getDeptId(), noticeOut.getDepotId(),
+                    noticeOut.getCustomerId(), noticeOut.getFoodVariety(), noticeOut.getId());
+
+            log.info("寮�濮嬫洿鏂板嚭搴撻�氱煡鍗�={}", param.toString());
+
+            String msg = this.reSumNoticeOutComplete(param);
+            if (msg != null) {
+                log.info("鍑哄簱閫氱煡鍗曞畬鎴愰噺缁熻澶辫触={},澶辫触鍘熷洜={}", param.toString(), msg);
+            }
+        }
+    }
+
+    /**
+     * Mybatis-plus 鏇存柊淇℃伅
+     * @param param
+     * @return
+     */
+    public String reSumNoticeOutComplete(NoticeParam param) {
+        if (StringUtils.isEmpty(param.getCustomerName())) {
+            return "瀹㈡埛缂栫爜涓虹┖锛�";
+        }
+        if (StringUtils.isEmpty(param.getFoodVariety())) {
+            return "绮鍝佺涓虹┖锛�";
+        }
+        if (StringUtils.isEmpty(param.getDepotId())) {
+            return "浠撳簱缂栫爜涓虹┖锛�";
+        }
+        if (StringUtils.isEmpty(param.getCompanyId())) {
+            param.setCompanyId(ContextUtil.getCompanyId());
+        }
+        if (StringUtils.isEmpty(param.getDeptId())) {
+            param.setDeptId(ContextUtil.subDeptId(null));
+        }
+        noticeMapper.reSumNoticeOutComplete(param);
+        return null;
+    }
+
+}

--
Gitblit v1.9.3