From f3cba59fc471e42936a10d8e923fd097e80cbc97 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期二, 30 七月 2024 10:12:43 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/ForestFirePrevention

---
 ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionRkglServiceImpl.java |   75 ++++++++++++++++++++++++++-----------
 1 files changed, 52 insertions(+), 23 deletions(-)

diff --git a/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionRkglServiceImpl.java b/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionRkglServiceImpl.java
index 43888ca..eb5827b 100644
--- a/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionRkglServiceImpl.java
+++ b/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionRkglServiceImpl.java
@@ -18,6 +18,7 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.system.api.domain.SysUser;
 import com.ruoyi.system.api.domain.getVolumeProductionRkQuery;
+import com.ruoyi.system.api.feignClient.LogClient;
 import com.ruoyi.system.api.feignClient.SysUserClient;
 import org.springframework.stereotype.Service;
 
@@ -57,6 +58,9 @@
     @Resource
     private  ManagementGoodsMaterialsMapper managementGoodsMaterialsMapper;
 
+    @Resource
+    private LogClient logClient;
+
     @Override
     public PageDTO<SupplierVolumeProductionRkglVO> getSupplierVolumeProductionRkglList(SupplierVolumeProductionRkglQuery supplierVolumeProductionRkglQuery) {
         Page<SlVolumeProductionRkgl> page = new Page<>(supplierVolumeProductionRkglQuery.getPageCurr(), supplierVolumeProductionRkglQuery.getPageSize());
@@ -79,12 +83,13 @@
     }
 
     @Override
-    public VolumeProductionRkgInfoVO getVolumeProductionRkgInfo(Integer id) {
+    public VolumeProductionRkgInfoVO getVolumeProductionRkgInfo(Long id) {
         SlVolumeProductionRkgl byId = this.getById(id);
         VolumeProductionRkgInfoVO v=BeanUtils.copyBean(byId, VolumeProductionRkgInfoVO.class);
         SlStoreManagement slStoreManagement = slStoreManagementMapper.selectById(byId.getManagementId());
         v.setStoreManagementName(slStoreManagement.getStoreManagementName());
         SysUser data = sysUserClient.getSysUser(Long.valueOf(byId.getSupplierId())).getData();
+        v.setSupplierId(byId.getSupplierId());
         v.setSupplierName(data.getNickName());
         v.setSupplierPhone(data.getPhonenumber());
         SysUser data1 = sysUserClient.getSysUser(Long.valueOf(byId.getSysId())).getData();
@@ -103,9 +108,17 @@
                 .collect(Collectors.toSet());
 
         LambdaQueryWrapper< SlVolumeProductionRkgl> wrapper1= Wrappers.lambdaQuery();
-        wrapper1.eq(SlVolumeProductionRkgl::getPresentState,getVolumeProductionRkQuery.getPresentState());
-        wrapper1.eq(SlVolumeProductionRkgl::getAuditStatus,getVolumeProductionRkQuery.getAuditStatus());
+        if (getVolumeProductionRkQuery.getPresentState()!=0&&getVolumeProductionRkQuery.getPresentState()!=null){
+            wrapper1.eq(SlVolumeProductionRkgl::getPresentState,getVolumeProductionRkQuery.getPresentState());
+        }
+        if (getVolumeProductionRkQuery.getAuditStatus()!=0&&getVolumeProductionRkQuery.getAuditStatus()!=null) {
+            wrapper1.eq(SlVolumeProductionRkgl::getAuditStatus, getVolumeProductionRkQuery.getAuditStatus());
+        }
         if (goodsSkuIdList.size()>0){
+            wrapper1.in(SlVolumeProductionRkgl::getSysId,goodsSkuIdList);
+        }else{
+            goodsSkuIdList=new HashSet<>();
+            goodsSkuIdList.add(0l);
             wrapper1.in(SlVolumeProductionRkgl::getSysId,goodsSkuIdList);
         }
         wrapper1.eq( SlVolumeProductionRkgl::getDelFlag,0);
@@ -115,22 +128,25 @@
         PageDTO<SupplierVolumeProductionRkglVO> SlGoodsShelfDTO = PageDTO.of(page2, SupplierVolumeProductionRkglVO.class);
         List<SupplierVolumeProductionRkglVO> list2 = SlGoodsShelfDTO.getList();
         for(SupplierVolumeProductionRkglVO list:list2){
-            SysUser data = sysUserClient.getSysUser(list.getSupplierId()).getData();
+            SysUser data = sysUserClient.getSysUser(list.getSysId()).getData();
             list.setNickName(data.getNickName());
             list.setPhonenumber(data.getPhonenumber());
             SlStoreManagement slStoreManagement = slStoreManagementMapper.selectById(list.getManagementId());
-            list.setStoreManagementName(slStoreManagement.getStoreManagementName());
+            if (slStoreManagement!=null){
+                list.setStoreManagementName(slStoreManagement.getStoreManagementName());
+            }
         }
         return SlGoodsShelfDTO;
     }
 
     @Override
-    public void addVolumeProductionRkgl(VolumeProductionRkglDTO volumeProductionRkglDTO) {
+    public Long addVolumeProductionRkgl(VolumeProductionRkglDTO volumeProductionRkglDTO) {
         Long userid = SecurityUtils.getUserId();
-        if (volumeProductionRkglDTO.getId()!=null){
-            SlVolumeProductionRkgl slVolumeProductionRkgl=new  SlVolumeProductionRkgl();
+        SlVolumeProductionRkgl slVolumeProductionRkgl=null;
+        if (volumeProductionRkglDTO.getId()==null){
+            new  SlVolumeProductionRkgl();
             slVolumeProductionRkgl.setAttachmentUrl(volumeProductionRkglDTO.getAttachmentUrl());
-            slVolumeProductionRkgl.setAuthorization(volumeProductionRkglDTO.getAuthorization());
+            slVolumeProductionRkgl.setAuthorizationUrl(volumeProductionRkglDTO.getAuthorization());
             slVolumeProductionRkgl.setAuditStatus(1);
             slVolumeProductionRkgl.setManagementId(volumeProductionRkglDTO.getManagementId());
             slVolumeProductionRkgl.setPresentState(1);
@@ -141,31 +157,33 @@
             slVolumeProductionRkgl.setRemark(volumeProductionRkglDTO.getRemark());
             this.save(slVolumeProductionRkgl);
         }else{
-            SlVolumeProductionRkgl byId = this.getById(volumeProductionRkglDTO.getId());
+            slVolumeProductionRkgl = this.getById(volumeProductionRkglDTO.getId());
             if (volumeProductionRkglDTO.getSource()!=null){
-                byId.setSource(volumeProductionRkglDTO.getSource());
+                slVolumeProductionRkgl.setSource(volumeProductionRkglDTO.getSource());
             }
             if (volumeProductionRkglDTO.getRemark()!=null){
-                byId.setRemark(volumeProductionRkglDTO.getRemark());
+                slVolumeProductionRkgl.setRemark(volumeProductionRkglDTO.getRemark());
             }
             if (volumeProductionRkglDTO.getSupplierId()!=null){
-                byId.setSupplierId(volumeProductionRkglDTO.getSupplierId());
+                slVolumeProductionRkgl.setSupplierId(volumeProductionRkglDTO.getSupplierId());
             }
             if (volumeProductionRkglDTO.getAttachmentUrl()!=null){
-                byId.setAttachmentUrl(volumeProductionRkglDTO.getAttachmentUrl());
+                slVolumeProductionRkgl.setAttachmentUrl(volumeProductionRkglDTO.getAttachmentUrl());
             }
             if (volumeProductionRkglDTO.getAuthorization()!=null){
-                byId.setAuthorization(volumeProductionRkglDTO.getAuthorization());
+                slVolumeProductionRkgl.setAuthorizationUrl(volumeProductionRkglDTO.getAuthorization());
             }
-            this.updateById(byId);
+            this.updateById(slVolumeProductionRkgl);
+
         }
+        return slVolumeProductionRkgl.getId();
     }
 
     @Override
-    public VolumeProductionRkgInventoryVO getVolumeProductionRkgInventory(Integer id) {
+    public VolumeProductionRkgInventoryVO getVolumeProductionRkgInventory(Long id) {
         SlVolumeProductionRkgl byId = this.getById(id);
         VolumeProductionRkgInventoryVO vo = new VolumeProductionRkgInventoryVO();
-        SysUser data = sysUserClient.getSysUser(byId.getId()).getData();
+        SysUser data = sysUserClient.getSysUser(byId.getSysId()).getData();
         vo.setSysPhone(data.getPhonenumber());
         vo.setSysName(data.getNickName());
         vo.setStartiTime(byId.getStartiTime());
@@ -173,7 +191,7 @@
         vo.setStoreManagementName(slStoreManagement.getStoreManagementName());
         String directorId = slStoreManagement.getDirectorId();
         List<String> stri = Arrays.asList(directorId.split(","));
-        String str1 = null;
+        String str1 ="";
         if (stri.size() > 0) {
             for (String str : stri) {
                 SysUser data1 = sysUserClient.getSysUser(Long.valueOf(str)).getData();
@@ -184,7 +202,7 @@
 
         String competentId = slStoreManagement.getCompetentId();
         List<String> stri1 = Arrays.asList(competentId.split(","));
-        String str11 = null;
+        String str11 = "";
         if (stri1.size() > 0) {
             for (String str : stri1) {
                 SysUser data1 = sysUserClient.getSysUser(Long.valueOf(str)).getData();
@@ -195,7 +213,7 @@
 
         String administratorId = slStoreManagement.getAdministratorId();
         List<String> stri11 = Arrays.asList(administratorId.split(","));
-        String str111 = null;
+        String str111 = "";
         if (stri11.size() > 0) {
             for (String str : stri11) {
                 SysUser data1 = sysUserClient.getSysUser(Long.valueOf(str)).getData();
@@ -211,6 +229,7 @@
         wrapper1.eq(SlVolumeProductionRk::getVolumeProductionRkglId, byId.getId());
         wrapper1.eq(SlVolumeProductionRk::getDelFlag, 0);
         wrapper1.orderByDesc(SlVolumeProductionRk::getCreateTime);
+        SysUser data1 = sysUserClient.getSysUser(byId.getSupplierId()).getData();
         List<SlVolumeProductionRk> page2 = slVolumeProductionRkMapper.selectList(wrapper1);
         for (SlVolumeProductionRk list : page2) {
                 ManagementimgVolumeProductionRkVO rkVO = new ManagementimgVolumeProductionRkVO();
@@ -220,15 +239,18 @@
                 rkVO.setRkModel(list.getRkModel());
                 rkVO.setRkNum(list.getRkNum());
                 rkVO.setRkPice(list.getRkPice());
-                rkVO.setStoreManagementNumber(rkVO.getStoreManagementNumber());
+                rkVO.setStoreManagementNumber(list.getStoreManagementNumber());
                 SlGoodsShelf slGoodsShelf = slGoodsShelfMapper.selectById(list.getShelfId());
                 rkVO.setGoodsShelfName(slGoodsShelf.getGoodsShelfName());
+                rkVO.setSupplierName(data1.getNickName());
+                managementList.add(rkVO);
         }
+        vo.setManagementimgVolumeProductionRkVOList(managementList);
         return vo;
     }
 
     @Override
-    public void rk(Integer id) {
+    public void rk(Long id) {
         LambdaQueryWrapper<SlVolumeProductionRk> wrapper1 = Wrappers.lambdaQuery();
         wrapper1.eq(SlVolumeProductionRk::getVolumeProductionRkglId, id);
         wrapper1.eq(SlVolumeProductionRk::getDelFlag, 0);
@@ -240,6 +262,9 @@
             wrapper2.eq(ManagementGoodsMaterials::getManagementId,list.getManagementId());
             wrapper2.eq(ManagementGoodsMaterials::getDelFlag, 0);
             ManagementGoodsMaterials managementGoodsMaterials = managementGoodsMaterialsMapper.selectOne(wrapper2);
+
+            SlGoodsMaterials slGoodsMaterials = slGoodsMaterialsMapper.selectById(list.getMaterialsId());
+
             if (managementGoodsMaterials!=null){
                 Long repertorySum = managementGoodsMaterials.getRepertorySum();
                 Long repertoryZhai = managementGoodsMaterials.getRepertoryZhai();
@@ -247,6 +272,7 @@
                 Long re1=repertoryZhai+list.getRkNum();
                 managementGoodsMaterials.setRepertorySum(re);
                 managementGoodsMaterials.setRepertoryZhai(re1);
+                managementGoodsMaterials.setRepertory(slGoodsMaterials.getRepertory());
                 managementGoodsMaterialsMapper.updateById(managementGoodsMaterials);
             }else{
                 ManagementGoodsMaterials managementGoodsMaterials1=new ManagementGoodsMaterials();
@@ -254,6 +280,7 @@
                 managementGoodsMaterials1.setGoodsMaterialsId(list.getMaterialsId());
                 managementGoodsMaterials1.setRepertoryZhai(list.getRkNum());
                 managementGoodsMaterials1.setRepertorySum(list.getRkNum());
+                managementGoodsMaterials.setRepertory(slGoodsMaterials.getRepertory());
                 managementGoodsMaterialsMapper.insert(managementGoodsMaterials1);
             }
         }
@@ -262,6 +289,8 @@
         byId.setAuditStatus(6);
         byId.setEndTime(new Date());
         this.updateById(byId);
+
+        logClient.savelong();
     }
 
 }

--
Gitblit v1.7.1