From da2d0647babd92e8929a09d4bfaaf413b980fe24 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期二, 02 十二月 2025 20:19:58 +0800
Subject: [PATCH] 登记及称重页面调整,及相关流程逻辑

---
 fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutNoticeService.java |  204 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 145 insertions(+), 59 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
index 9f157ce..7aba052 100644
--- 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
@@ -5,26 +5,18 @@
 import com.fzzy.igds.data.NoticeDto;
 import com.fzzy.igds.data.NoticeParam;
 import com.fzzy.igds.mapper.InoutNoticeInMapper;
-import com.fzzy.igds.mapper.InoutNoticeMapper;
-import com.fzzy.igds.repository.InoutNoticeInRepository;
-import com.fzzy.igds.repository.InoutNoticeOutRepository;
+import com.fzzy.igds.mapper.InoutNoticeOutMapper;
 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.Pageable;
-import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
-
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-
 import javax.annotation.Resource;
 import java.util.Date;
 import java.util.List;
-import java.util.Map;
 
 /**
  * @Description 鍑哄叆搴撻�氱煡鍗晄ervice灞傦紝鍖呭惈鍏ュ簱閫氱煡鍗曞拰鍑哄簱閫氱煡鍗�
@@ -36,47 +28,86 @@
 public class InoutNoticeService {
 
     @Resource
-    private InoutNoticeInRepository noticeInRepository;
-    @Resource
-    private InoutNoticeOutRepository noticeOutRepository;
-    @Resource
-    private InoutNoticeMapper noticeMapper;
-
-    @Resource
     private InoutNoticeInMapper noticeInMapper;
+    @Resource
+    private InoutNoticeOutMapper noticeOutMapper;
 
-
-/*    *//**
-     * JPA鍒嗛〉鏌ヨ鏁版嵁
-     *
-     *//*
-    public Page<InoutNoticeIn> queryAllNoticeIn(Specification<InoutNoticeIn> specification, Pageable pageable) {
-        return noticeInRepository.findAll(specification, pageable);
-    }*/
-
+    /*----------------------鍏ュ簱閫氱煡鍗曚俊鎭�-------------------------*/
+    /**
+     * 鍒嗛〉鏌ヨ鏁版嵁
+     * @param page
+     * @param param
+     */
     public void pageQueryIn(Page<InoutNoticeIn> page, NoticeParam param) {
         QueryWrapper<InoutNoticeIn> queryWrapper = new QueryWrapper<>();
 
-        if(null == param) param = new NoticeParam();
+        if(null == param) {
+            param = new NoticeParam();
+        }
         param.setCompanyId(ContextUtil.getCompanyId());
 
         queryWrapper.eq("company_id", param.getCompanyId());
+        if(StringUtils.isNotBlank(param.getCustomerName())){
+            queryWrapper.like("customer_name", param.getCustomerName());
+        }
+        if(StringUtils.isNotBlank(param.getFoodVariety())){
+            queryWrapper.like("food_variety", param.getFoodVariety());
+        }
+        if(StringUtils.isNotBlank(param.getCompleteStatus())){
+            queryWrapper.like("complete_status", param.getCompleteStatus());
+        }
 
         noticeInMapper.selectPage(page, queryWrapper);
     }
 
     /**
-     * JPA鏌ヨ鏁版嵁
+     * 鏍规嵁鏉′欢鏌ヨ
+     * @param companyId
+     * @param deptId
+     * @param completeStatus
+     * @return
+     */
+    public List<InoutNoticeIn> getNoticeIn(String companyId, String deptId, String completeStatus) {
+
+        QueryWrapper<InoutNoticeIn> queryWrapper = new QueryWrapper<>();
+        if(StringUtils.isNotBlank(companyId)){
+            queryWrapper.eq("company_id", companyId);
+        }
+        if(StringUtils.isNotBlank(deptId)){
+            queryWrapper.eq("dept_id", deptId);
+        }
+        if(StringUtils.isNotBlank(completeStatus)){
+            queryWrapper.eq("complete_status", completeStatus);
+        }
+        queryWrapper.orderByDesc("create_time");
+        
+        return noticeInMapper.selectList(queryWrapper);
+    }
+
+    /**
+     * 鏍规嵁鏉′欢鏌ヨ
+     * @param id
+     * @return
+     */
+    public InoutNoticeIn getNoticeInOne(String id) {
+
+        QueryWrapper<InoutNoticeIn> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("id", id);
+        return noticeInMapper.selectOne(queryWrapper);
+    }
+
+    /**
+     * 鏌ヨ鏁版嵁
      * @param companyId
      * @param deptId
      * @return
      */
     public List<InoutNoticeIn> listNoticeIn(String companyId, String deptId) {
-        return noticeInRepository.listNoticeIn(companyId, deptId, Constant.COMPLETE_STATUS_NONE);
+        return this.getNoticeIn(companyId, deptId, Constant.COMPLETE_STATUS_NONE);
     }
 
     /**
-     * jpa 鑾峰彇淇℃伅
+     *  鏌ヨ鏁版嵁
      * @param companyId
      * @return
      */
@@ -84,11 +115,11 @@
         if (StringUtils.isEmpty(companyId)) {
             companyId = ContextUtil.getCompanyId();
         }
-        return noticeInRepository.listNoticeIn(companyId, Constant.COMPLETE_STATUS_NONE);
+        return this.getNoticeIn(companyId, null, Constant.COMPLETE_STATUS_NONE);
     }
 
     /**
-     * JPA - 淇濆瓨鏇存柊鏁版嵁
+     *  - 淇濆瓨鏇存柊鏁版嵁
      *
      * @param data
      * @return
@@ -101,47 +132,99 @@
             data.setCreateTime(new Date());
             data.setAuditStatus(Constant.COMPLETE_STATUS_NONE);
             data.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
-            noticeInRepository.save(data);
+            noticeInMapper.insert(data);
         } else {
             data.setUpdateBy(ContextUtil.getLoginUserName());
             data.setUpdateTime(new Date());
-            noticeInRepository.save(data);
+            noticeInMapper.updateById(data);
         }
 
         return null;
     }
 
     /**
-     * JPA - 鍒犻櫎鏁版嵁
+     *  - 鍒犻櫎鏁版嵁
      *
      * @param data
      * @return
      */
     public String delDataIn(InoutNoticeIn data) {
-        noticeInRepository.delete(data);
+        noticeInMapper.deleteById(data);
         return null;
     }
 
+    /*----------------------鍑哄簱閫氱煡鍗曚俊鎭�-------------------------*/
     /**
-     * JPA鍒嗛〉鏌ヨ鏁版嵁
-     *
-     * @param specification
-     * @param pageable
+     * 鍒嗛〉鏌ヨ鏁版嵁
+     * @param page
+     * @param param
+     */
+    public void pageQueryOut(Page<InoutNoticeOut> page, NoticeParam param) {
+        QueryWrapper<InoutNoticeOut> queryWrapper = new QueryWrapper<>();
+
+        if(null == param) {
+            param = new NoticeParam();
+        }
+        param.setCompanyId(ContextUtil.getCompanyId());
+
+        queryWrapper.eq("company_id", param.getCompanyId());
+        if(StringUtils.isNotBlank(param.getCustomerName())){
+            queryWrapper.like("customer_name", param.getCustomerName());
+        }
+        if(StringUtils.isNotBlank(param.getFoodVariety())){
+            queryWrapper.like("food_variety", param.getFoodVariety());
+        }
+        if(StringUtils.isNotBlank(param.getCompleteStatus())){
+            queryWrapper.like("complete_status", param.getCompleteStatus());
+        }
+
+        noticeOutMapper.selectPage(page, queryWrapper);
+    }
+
+    /**
+     * 鏍规嵁鏉′欢鏌ヨ
+     * @param companyId
+     * @param deptId
+     * @param completeStatus
      * @return
      */
-    public Page<InoutNoticeOut> queryAllNoticeOut(Specification<InoutNoticeOut> specification, Pageable pageable) {
-        //return noticeOutRepository.findAll(specification, pageable);
-        return null;
+    public List<InoutNoticeOut> getNoticeOut(String companyId, String deptId, String completeStatus) {
+
+        QueryWrapper<InoutNoticeOut> queryWrapper = new QueryWrapper<>();
+        if(StringUtils.isNotBlank(companyId)){
+            queryWrapper.eq("company_id", companyId);
+        }
+        if(StringUtils.isNotBlank(deptId)){
+            queryWrapper.eq("dept_id", deptId);
+        }
+        if(StringUtils.isNotBlank(completeStatus)){
+            queryWrapper.eq("complete_status", completeStatus);
+        }
+        queryWrapper.orderByDesc("create_time");
+
+        return noticeOutMapper.selectList(queryWrapper);
     }
 
     /**
-     * JPA鏌ヨ鏁版嵁
+     * 鏍规嵁鏉′欢鏌ヨ
+     * @param id
+     * @return
+     */
+    public InoutNoticeOut getNoticeOutOne(String id) {
+
+        QueryWrapper<InoutNoticeOut> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("id", id);
+        return noticeOutMapper.selectOne(queryWrapper);
+    }
+
+    /**
+     * 鏌ヨ鏁版嵁
      * @param companyId
      * @param deptId
      * @return
      */
     public List<InoutNoticeOut> listNoticeOut(String companyId, String deptId) {
-        return noticeOutRepository.listNoticeOut(companyId, deptId, Constant.COMPLETE_STATUS_NONE);
+        return this.getNoticeOut(companyId, deptId, Constant.COMPLETE_STATUS_NONE);
     }
 
     /**
@@ -153,41 +236,45 @@
         if (StringUtils.isEmpty(companyId)) {
             companyId = ContextUtil.getCompanyId();
         }
-        return noticeOutRepository.listNoticeOut(companyId, Constant.COMPLETE_STATUS_NONE);
+        return this.getNoticeOut(companyId, null,Constant.COMPLETE_STATUS_NONE);
     }
 
     /**
-     * JPA - 淇濆瓨鏇存柊鏁版嵁
+     *  - 淇濆瓨鏇存柊鏁版嵁
      *
      * @param data
      * @return
      */
     public String saveOrUpdateOut(InoutNoticeOut data) {
-        if (Constant.YN_Y.equals(data.getTag())) {
+        if (null == data.getUpdateBy()) {
+            data.setUpdateBy(ContextUtil.getLoginUserName());
+            data.setUpdateTime(new Date());
             data.setCreateBy(ContextUtil.getLoginUserName());
             data.setCreateTime(new Date());
             data.setAuditStatus(Constant.COMPLETE_STATUS_NONE);
             data.setCompleteStatus(Constant.COMPLETE_STATUS_NONE);
+            noticeOutMapper.insert(data);
+        } else {
+            data.setUpdateBy(ContextUtil.getLoginUserName());
+            data.setUpdateTime(new Date());
+            noticeOutMapper.updateById(data);
         }
-        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);
+        noticeOutMapper.deleteById(data);
         return null;
     }
 
     /**
-     * JPA - 鏍规嵁ID鑾峰彇閫氱煡鍗曚俊鎭�
+     * 鏍规嵁ID鑾峰彇閫氱煡鍗曚俊鎭�
      * @param id
      * @param type
      * @return
@@ -198,10 +285,10 @@
         }
         NoticeDto noticeDto = new NoticeDto();
         if (Constant.TYPE_IN.equals(type)) {
-            InoutNoticeIn noticeIn = noticeInRepository.getDataById(ContextUtil.getCompanyId(), ContextUtil.subDeptId(null), id);
+            InoutNoticeIn noticeIn = this.getNoticeInOne(id);
             BeanUtils.copyProperties(noticeIn, noticeDto);
         } else {
-            InoutNoticeOut noticeOut = noticeOutRepository.getDataById(ContextUtil.getCompanyId(), ContextUtil.subDeptId(null), id);
+            InoutNoticeOut noticeOut = this.getNoticeOutOne(id);
             BeanUtils.copyProperties(noticeOut, noticeDto);
         }
         return noticeDto;
@@ -240,6 +327,7 @@
      * @return
      */
     public String reSumNoticeInComplete(NoticeParam param) {
+        //TODO 寰呭疄鐜帮紝鍚庣画鏍规嵁闇�姹傝繘琛屽疄鐜�
         if (StringUtils.isEmpty(param.getCustomerName())) {
             return "瀹㈡埛缂栫爜涓虹┖锛�";
         }
@@ -252,7 +340,6 @@
         if (StringUtils.isEmpty(param.getDeptId())) {
             param.setDeptId(ContextUtil.subDeptId(null));
         }
-        noticeMapper.reSumNoticeInComplete(param);
         return null;
     }
 
@@ -272,7 +359,7 @@
         for (InoutNoticeOut noticeOut : noticeOutList) {
 
             param = new NoticeParam(noticeOut.getCompanyId(), noticeOut.getDeptId(), noticeOut.getDepotId(),
-                    noticeOut.getCustomerId(), noticeOut.getFoodVariety(), noticeOut.getId());
+                    noticeOut.getCustomerName(), noticeOut.getFoodVariety(), noticeOut.getId());
 
             log.info("寮�濮嬫洿鏂板嚭搴撻�氱煡鍗�={}", param.toString());
 
@@ -289,6 +376,7 @@
      * @return
      */
     public String reSumNoticeOutComplete(NoticeParam param) {
+        //TODO 寰呭疄鐜帮紝鍚庣画鏍规嵁闇�姹傝繘琛屽疄鐜�
         if (StringUtils.isEmpty(param.getCustomerName())) {
             return "瀹㈡埛缂栫爜涓虹┖锛�";
         }
@@ -304,9 +392,7 @@
         if (StringUtils.isEmpty(param.getDeptId())) {
             param.setDeptId(ContextUtil.subDeptId(null));
         }
-        noticeMapper.reSumNoticeOutComplete(param);
         return null;
     }
-
 
 }

--
Gitblit v1.9.3