From 7bbce72b03664f56400fe7e70e8dcd4ea737a8da Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期五, 02 八月 2024 14:19:30 +0800 Subject: [PATCH] 代码提交 bug解决 --- ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionZyglServiceImpl.java | 320 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 318 insertions(+), 2 deletions(-) diff --git a/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionZyglServiceImpl.java b/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionZyglServiceImpl.java index 7f582f4..b01513e 100644 --- a/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionZyglServiceImpl.java +++ b/ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlVolumeProductionZyglServiceImpl.java @@ -1,10 +1,28 @@ package com.ruoyi.management.service.impl; -import com.ruoyi.management.domain.SlVolumeProductionZygl; -import com.ruoyi.management.mapper.SlVolumeProductionZyglMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.utils.page.BeanUtils; +import com.ruoyi.common.core.utils.page.PageDTO; +import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.management.domain.*; +import com.ruoyi.management.domain.dto.ManagementimgVolumeProductionZyQuery; +import com.ruoyi.management.domain.dto.SlVolumeProductionZyDTO; +import com.ruoyi.management.domain.dto.SlVolumeProductionZyQuery; +import com.ruoyi.management.domain.vo.*; +import com.ruoyi.management.mapper.*; import com.ruoyi.management.service.SlVolumeProductionZyglService; 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.SysUserClient; import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; /** * <p> @@ -16,5 +34,303 @@ */ @Service public class SlVolumeProductionZyglServiceImpl extends ServiceImpl<SlVolumeProductionZyglMapper, SlVolumeProductionZygl> implements SlVolumeProductionZyglService { + @Resource + private SysUserClient sysUserClient; + @Resource + private SlStoreManagementMapper slStoreManagementMapper; + + @Resource + private SlVolumeProductionZyglMapper slVolumeProductionZyglMapper; + + @Resource + private SlVolumeProductionRkMapper slVolumeProductionRkMapper; + + @Resource + private SlGoodsMaterialsMapper slGoodsMaterialsMapper; + + @Resource + private SlGoodsShelfMapper slGoodsShelfMapper; + + @Resource + private SlVolumeProductionZyMapper slVolumeProductionZyMapper; + + @Resource + private ManagementGoodsMaterialsMapper managementGoodsMaterialsMapper; + + @Override + public PageDTO<VolumeProductionzZyglVO> getVolumeProductionzZyglList(SlVolumeProductionZyQuery slVolumeProductionZyQuery) { + Page<SlVolumeProductionZygl> page = new Page<>(slVolumeProductionZyQuery.getPageCurr(), slVolumeProductionZyQuery.getPageSize()); + getVolumeProductionRkQuery getVolume=new getVolumeProductionRkQuery(); + getVolume.setSupplierPhone(slVolumeProductionZyQuery.getSupplierPhone()); + getVolume.setSupplierName(slVolumeProductionZyQuery.getSupplierName()); + List<SysUser> data1 = sysUserClient.getUserSupplierList(getVolume).getData(); + Set<Long> goodsSkuIdList = null; + goodsSkuIdList = data1.stream().map(SysUser::getUserId) + .collect(Collectors.toSet()); + + LambdaQueryWrapper< SlVolumeProductionZygl> wrapper1= Wrappers.lambdaQuery(); + if (slVolumeProductionZyQuery.getPresentState()!=null){ + wrapper1.eq(SlVolumeProductionZygl::getPresentState,slVolumeProductionZyQuery.getPresentState()); + } + if (slVolumeProductionZyQuery.getAuditStatus()!=null){ + wrapper1.eq(SlVolumeProductionZygl::getAuditStatus,slVolumeProductionZyQuery.getAuditStatus()); + + } + if (goodsSkuIdList.size()>0){ + wrapper1.in(SlVolumeProductionZygl::getSysId,goodsSkuIdList); + } + wrapper1.eq( SlVolumeProductionZygl::getDelFlag,0); + wrapper1.orderByDesc(SlVolumeProductionZygl::getCreateTime); + Page<SlVolumeProductionZygl> page2 = this.page(page, wrapper1); + + PageDTO<VolumeProductionzZyglVO> SlGoodsShelfDTO = PageDTO.of(page2, VolumeProductionzZyglVO .class); + List<VolumeProductionzZyglVO> list2 = SlGoodsShelfDTO.getList(); + for(VolumeProductionzZyglVO list:list2){ + 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()); + + SlStoreManagement bslStoreManagement = slStoreManagementMapper.selectById(list.getBmanagementId()); + list.setBstoreManagementName(bslStoreManagement.getStoreManagementName()); + } + return SlGoodsShelfDTO; + } + + @Override + public String addsVolumeProductionzZygl(SlVolumeProductionZyDTO slVolumeProductionZyDTO) { + Long userid = SecurityUtils.getUserId(); + if (slVolumeProductionZyDTO.getId()==null){ + SlVolumeProductionZygl slVolumeProductionZygl=new SlVolumeProductionZygl(); + slVolumeProductionZygl.setAttachmentUrl(slVolumeProductionZyDTO.getAttachmentUrl()); + slVolumeProductionZygl.setAuthorizationUrl(slVolumeProductionZyDTO.getAuthorization()); + slVolumeProductionZygl.setSource(slVolumeProductionZyDTO.getSource()); + slVolumeProductionZygl.setManagementId(slVolumeProductionZyDTO.getManagementId()); + slVolumeProductionZygl.setBmanagementId(slVolumeProductionZyDTO.getBmanagementId()); + slVolumeProductionZygl.setSysId(userid); + slVolumeProductionZygl.setStartiTime(new Date()); + slVolumeProductionZygl.setAuditStatus(1); + slVolumeProductionZygl.setPresentState(1); + this.save(slVolumeProductionZygl); + return slVolumeProductionZygl.getId().toString(); + }else { + SlVolumeProductionZygl byId = this.getById(slVolumeProductionZyDTO.getId()); + if (slVolumeProductionZyDTO.getSource()!=null){ + byId.setSource(slVolumeProductionZyDTO.getSource()); + } + if (slVolumeProductionZyDTO.getAttachmentUrl()!=null){ + byId.setAttachmentUrl(slVolumeProductionZyDTO.getAttachmentUrl()); + } + if (slVolumeProductionZyDTO.getAuthorization()!=null){ + byId.setAuthorizationUrl(slVolumeProductionZyDTO.getAuthorization()); + } + this.updateById(byId); + return slVolumeProductionZyDTO.getId().toString(); + } + + } + + @Override + public VolumeProductionZyglInfoVO getVolumeProductionzZyglnfo(ManagementimgVolumeProductionZyQuery managementimgVolumeProductionZyQuery) { + SlVolumeProductionZygl byId = this.getById(managementimgVolumeProductionZyQuery.getVolumeProductionzyglId()); + VolumeProductionZyglInfoVO v= BeanUtils.copyBean(byId, VolumeProductionZyglInfoVO.class); + SlStoreManagement slStoreManagement = slStoreManagementMapper.selectById(byId.getManagementId()); + v.setStoreManagementName(slStoreManagement.getStoreManagementName()); + SlStoreManagement bslStoreManagement = slStoreManagementMapper.selectById(byId.getBmanagementId()); + v.setBstoreManagementName(bslStoreManagement.getStoreManagementName()); + SysUser data1 = sysUserClient.getSysUser(Long.valueOf(byId.getSysId())).getData(); + v.setSysName(data1.getNickName()); + v.setSysPhone(data1.getPhonenumber()); + // 查询楼层数据 + SlStoreManagement slStoreManagement1 = slStoreManagementMapper.selectById(byId.getManagementId()); + List<String> number = new ArrayList<>(); + for (Integer i = 1; i <= slStoreManagement1.getStoreManagementNumber(); i++) { + switch (i){ + case 1: + number.add("一层"); + break; + case 2: + number.add("二层"); + break; + case 3: + number.add("三层"); + break; + } + } + v.setNumber(number); + + QueryWrapper<SlGoodsShelf> eq = new QueryWrapper<SlGoodsShelf>() + .eq("del_flag", "0") + .eq("store_management_id", byId.getManagementId()) + .eq("store_management_number",managementimgVolumeProductionZyQuery.getStoreManagementNumber()); + List<SlGoodsShelf> slGoodsShelves = slGoodsShelfMapper.selectList(eq); + v.setGoodsShelfList(slGoodsShelves); + // 查询物资列表 + LambdaQueryWrapper<SlVolumeProductionRk> wrapper2= Wrappers.lambdaQuery(); + wrapper2.eq(SlVolumeProductionRk::getManagementId,byId.getBmanagementId()); + if (managementimgVolumeProductionZyQuery.getShelfId() == null){ + managementimgVolumeProductionZyQuery.setShelfId(slGoodsShelves.get(0).getId()); + } + if (managementimgVolumeProductionZyQuery.getStoreManagementNumber()==null){ + wrapper2.eq(SlVolumeProductionRk::getStoreManagementNumber,1); + } + wrapper2.eq(SlVolumeProductionRk::getShelfId,managementimgVolumeProductionZyQuery.getShelfId()); + wrapper2.eq( SlVolumeProductionRk::getDelFlag,0); + wrapper2.orderByDesc(SlVolumeProductionRk::getCreateTime); + List<SlVolumeProductionRk> page1 = slVolumeProductionRkMapper.selectList(wrapper2); + + Set<Long> goodsSkuIdList = null; + goodsSkuIdList = page1.stream().map(SlVolumeProductionRk::getId) + .collect(Collectors.toSet()); + Page<SlVolumeProductionZy> page = new Page<>(managementimgVolumeProductionZyQuery.getPageCurr(), managementimgVolumeProductionZyQuery.getPageSize()); + LambdaQueryWrapper< SlVolumeProductionZy> wrapper1= Wrappers.lambdaQuery(); + wrapper1.eq(SlVolumeProductionZy::getZyglId,managementimgVolumeProductionZyQuery.getVolumeProductionzyglId()); + if (goodsSkuIdList.size()>0&&goodsSkuIdList!=null){ + wrapper1.in(SlVolumeProductionZy::getScrkId,goodsSkuIdList); + } + wrapper1.eq( SlVolumeProductionZy::getDelFlag,0); + wrapper1.orderByDesc(SlVolumeProductionZy::getCreateTime); + Page<SlVolumeProductionZy> page2 = slVolumeProductionZyMapper.selectPage(page, wrapper1); + PageDTO<com.ruoyi.management.domain.dto.ManagementimgVolumeProductionZyVO> SlGoodsShelfDTO = PageDTO.of(page2, com.ruoyi.management.domain.dto.ManagementimgVolumeProductionZyVO.class); + List<com.ruoyi.management.domain.dto.ManagementimgVolumeProductionZyVO> list2 = SlGoodsShelfDTO.getList(); + for(com.ruoyi.management.domain.dto.ManagementimgVolumeProductionZyVO list:list2) { + SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(list.getRkId()); + list.setStoreManagementNumber(slVolumeProductionRk.getStoreManagementNumber()); + list.setRkNumber(slVolumeProductionRk.getRkNumber()); + list.setRepertoryZhai(slVolumeProductionRk.getRepertoryZhai()); + SlGoodsMaterials slGoodsMaterials = slGoodsMaterialsMapper.selectById(slVolumeProductionRk.getMaterialsId()); + list.setGoodsMaterialsName(slGoodsMaterials.getGoodsMaterialsName()); + list.setIsConsume(slGoodsMaterials.getIsConsume()); + SlGoodsShelf slGoodsShelf = slGoodsShelfMapper.selectById(slVolumeProductionRk.getShelfId()); + list.setGoodsShelfName(slGoodsShelf.getGoodsShelfName()); + if(list.getScrkId()!=null){ + SlVolumeProductionRk slVolumeProductionRk1 = slVolumeProductionRkMapper.selectById(list.getScrkId()); + list.setStoreManagementNumber(slVolumeProductionRk1.getStoreManagementNumber()); + list.setRkNumber(slVolumeProductionRk1.getRkNumber()); + } + } + v.setList(SlGoodsShelfDTO); + + return v; + } + + @Override + public VolumeProductionZyglInventoryVO getVolumeProductionZyglnventory(Integer id) { + SlVolumeProductionZygl byId = this.getById(id); + VolumeProductionZyglInventoryVO vo = new VolumeProductionZyglInventoryVO(); + SysUser data = sysUserClient.getSysUser(byId.getId()).getData(); + vo.setSysPhone(data.getPhonenumber()); + vo.setSysName(data.getNickName()); + vo.setStartiTime(byId.getStartiTime()); + SlStoreManagement slStoreManagement = slStoreManagementMapper.selectById(byId.getManagementId()); + vo.setStoreManagementName(slStoreManagement.getStoreManagementName()); + SlStoreManagement bslStoreManagement = slStoreManagementMapper.selectById(byId.getBmanagementId()); + vo.setBstoreManagementName(bslStoreManagement.getStoreManagementName()); + String directorId = slStoreManagement.getDirectorId(); + List<String> stri = Arrays.asList(directorId.split(",")); + String str1 = ""; + if (stri.size() > 0) { + for (String str : stri) { + SysUser data1 = sysUserClient.getSysUser(Long.valueOf(str)).getData(); + str1 += data1.getNickName() + ","; + } + } + vo.setDirectorName(str1.substring(0, str1.length() - 1)); + + String competentId = slStoreManagement.getCompetentId(); + List<String> stri1 = Arrays.asList(competentId.split(",")); + String str11 = ""; + if (stri1.size() > 0) { + for (String str : stri1) { + SysUser data1 = sysUserClient.getSysUser(Long.valueOf(str)).getData(); + str11 += data1.getNickName() + ","; + } + } + vo.setCompetentName(str11.substring(0, str11.length() - 1)); + + String administratorId = slStoreManagement.getAdministratorId(); + List<String> stri11 = Arrays.asList(administratorId.split(",")); + String str111 = ""; + if (stri11.size() > 0) { + for (String str : stri11) { + SysUser data1 = sysUserClient.getSysUser(Long.valueOf(str)).getData(); + str111 += data1.getNickName() + ","; + } + } + vo.setAdministratorName(str111.substring(0, str111.length() - 1)); + + + LambdaQueryWrapper< SlVolumeProductionZy> wrapper2= Wrappers.lambdaQuery(); + wrapper2.eq(SlVolumeProductionZy::getZyglId,id); + wrapper2.eq( SlVolumeProductionZy::getDelFlag,0); + wrapper2.orderByDesc(SlVolumeProductionZy::getCreateTime); + List<SlVolumeProductionZy> page2 = slVolumeProductionZyMapper.selectList(wrapper2); + List<ManagementimgVolumeProductionZyVO> SlGoodsShelfDTO=new ArrayList<>(); + for(SlVolumeProductionZy list1:page2) { + ManagementimgVolumeProductionZyVO list=new ManagementimgVolumeProductionZyVO(); + list.setId(list1.getId()); + list.setZyNum(list1.getZyNum()); + SlVolumeProductionRk slVolumeProductionRk = slVolumeProductionRkMapper.selectById(list1.getRkId()); + list.setStoreManagementNumber(slVolumeProductionRk.getStoreManagementNumber()); + list.setRkNumber(slVolumeProductionRk.getRkNumber()); + list.setRepertoryZhai(slVolumeProductionRk.getRepertoryZhai()); + SlGoodsMaterials slGoodsMaterials = slGoodsMaterialsMapper.selectById(slVolumeProductionRk.getMaterialsId()); + list.setGoodsMaterialsName(slGoodsMaterials.getGoodsMaterialsName()); + list.setIsConsume(slGoodsMaterials.getIsConsume()); + SlGoodsShelf slGoodsShelf = slGoodsShelfMapper.selectById(slVolumeProductionRk.getShelfId()); + list.setGoodsShelfName(slGoodsShelf.getGoodsShelfName()); + + SlGoodsShelfDTO.add(list); + } + vo.setManagementimgVolumeProductionCkVOList(SlGoodsShelfDTO); + return vo; + } + + @Override + public void zy(Integer id) { + SlVolumeProductionZygl byId = this.getById(id); + LambdaQueryWrapper<SlVolumeProductionZy> wrapper1 = Wrappers.lambdaQuery(); + wrapper1.eq(SlVolumeProductionZy::getZyglId, id); + wrapper1.eq(SlVolumeProductionZy::getDelFlag, 0); + wrapper1.orderByDesc(SlVolumeProductionZy::getCreateTime); + List<SlVolumeProductionZy> page2 = slVolumeProductionZyMapper.selectList(wrapper1); + for (SlVolumeProductionZy zy:page2){ + SlVolumeProductionRk slVolumeProductionRk=new SlVolumeProductionRk(); + slVolumeProductionRk.setMaterialsId(zy.getMaterialsId()); + slVolumeProductionRk.setStoreManagementNumber(zy.getStoreManagementNumber()); + slVolumeProductionRk.setManagementId(byId.getBmanagementId()); + slVolumeProductionRk.setRkNumber("CD-"+new Date().getTime()); + slVolumeProductionRk.setRkNum(Long.valueOf(zy.getZyNum())); + slVolumeProductionRk.setShelfId(zy.getShelfId()); + slVolumeProductionRk.setRepertoryZhai(Long.valueOf(zy.getZyNum())); + slVolumeProductionRk.setCreateTime(new Date()); + slVolumeProductionRkMapper.insert(slVolumeProductionRk); + zy.setScrkId(slVolumeProductionRk.getId()); + slVolumeProductionZyMapper.updateById(zy); + LambdaQueryWrapper<ManagementGoodsMaterials> wrapper2 = Wrappers.lambdaQuery(); + wrapper2.eq(ManagementGoodsMaterials::getGoodsMaterialsId,zy.getMaterialsId()); + wrapper2.eq(ManagementGoodsMaterials::getManagementId,byId.getBmanagementId()); + wrapper2.eq(ManagementGoodsMaterials::getDelFlag, 0); + ManagementGoodsMaterials managementGoodsMaterials = managementGoodsMaterialsMapper.selectOne(wrapper2); + if (managementGoodsMaterials!=null){ + Long repertorySum = managementGoodsMaterials.getRepertorySum(); + Long repertoryZhai = managementGoodsMaterials.getRepertoryZhai(); + Long re=repertorySum+Long.valueOf(zy.getZyNum()); + Long re1=repertoryZhai+Long.valueOf(zy.getZyNum()); + managementGoodsMaterials.setRepertorySum(re); + managementGoodsMaterials.setRepertoryZhai(re1); + managementGoodsMaterialsMapper.updateById(managementGoodsMaterials); + }else{ + ManagementGoodsMaterials managementGoodsMaterials1=new ManagementGoodsMaterials(); + managementGoodsMaterials1.setManagementId(byId.getBmanagementId()); + managementGoodsMaterials1.setGoodsMaterialsId(zy.getMaterialsId()); + managementGoodsMaterials1.setRepertoryZhai(Long.valueOf(zy.getZyNum())); + managementGoodsMaterials1.setRepertorySum(Long.valueOf(zy.getZyNum())); + managementGoodsMaterials1.setCreateTime(new Date()); + managementGoodsMaterialsMapper.insert(managementGoodsMaterials1); + } + } + } } -- Gitblit v1.7.1