| | |
| | | package com.ruoyi.management.service.impl; |
| | | |
| | | 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.PageDTO; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | @Override |
| | | public PageDTO<SlAuditVO> getslAuditList(AuditRecordListQuery auditRecordListQuery) { |
| | | List<Long> rkglIds = new ArrayList<>(); |
| | | List<Long> ckglIds = new ArrayList<>(); |
| | | List<Long> zyglIds = new ArrayList<>(); |
| | | List<Long> auditIds = new ArrayList<>(); |
| | | Long userid = SecurityUtils.getUserId(); |
| | | SysUser data = sysUserClient.getSysUser(userid).getData(); |
| | | getVolumeProductionRkQuery getVolumeProductionRkQuer=new getVolumeProductionRkQuery(); |
| | |
| | | goodsSkuIdList1.add(0L); |
| | | wrapper.in(SlAudit::getSysId,goodsSkuIdList1); |
| | | } |
| | | if (!data.getUserType().equals(00)){ |
| | | wrapper.in(SlAudit::getShenhId,userid); |
| | | |
| | | switch (auditRecordListQuery.getType()){ |
| | | case 1: |
| | | rkglIds = slVolumeProductionRkglMapper.selectList(new QueryWrapper<SlVolumeProductionRkgl>() |
| | | .ne("audit_status", 7)).stream().map(SlVolumeProductionRkgl::getId).collect(Collectors.toList()); |
| | | wrapper.in(SlAudit::getRkId,rkglIds); |
| | | if (!data.getUserType().equals("00")){ |
| | | // 只查询相关的审核 |
| | | auditIds = slAuditRecordMapper.selectList(new QueryWrapper<SlAuditRecord>() |
| | | .like("shenh_id", data.getUserId())).stream().map(SlAuditRecord::getAuditId).collect(Collectors.toList()); |
| | | wrapper.in(SlAudit::getId,auditIds); |
| | | } |
| | | |
| | | break; |
| | | case 2: |
| | | ckglIds = slVolumeProductionCKglMapper.selectList(new QueryWrapper<SlVolumeProductionCkgl>() |
| | | .ne("audit_status", 8)).stream().map(SlVolumeProductionCkgl::getId).collect(Collectors.toList()); |
| | | wrapper.in(SlAudit::getRkId,ckglIds); |
| | | if (!data.getUserType().equals("00")){ |
| | | // 只查询相关的审核 |
| | | auditIds = slAuditRecordMapper.selectList(new QueryWrapper<SlAuditRecord>() |
| | | .like("shenh_id", data.getUserId())).stream().map(SlAuditRecord::getAuditId).collect(Collectors.toList()); |
| | | wrapper.in(SlAudit::getId,auditIds); |
| | | } |
| | | |
| | | break; |
| | | case 3: |
| | | zyglIds = slVolumeProductionZyglMapper.selectList(new QueryWrapper<SlVolumeProductionZygl>() |
| | | .ne("audit_status", 7)).stream().map(SlVolumeProductionZygl::getId).collect(Collectors.toList()); |
| | | wrapper.in(SlAudit::getRkId,zyglIds); |
| | | if (!data.getUserType().equals("00")){ |
| | | // 只查询相关的审核 |
| | | auditIds = slAuditRecordMapper.selectList(new QueryWrapper<SlAuditRecord>() |
| | | .like("shenh_id", data.getUserId())).stream().map(SlAuditRecord::getAuditId).collect(Collectors.toList()); |
| | | wrapper.in(SlAudit::getId,auditIds); |
| | | } |
| | | |
| | | break; |
| | | } |
| | | wrapper.eq(SlAudit::getType,auditRecordListQuery.getType()); |
| | | wrapper.eq( SlAudit::getDelFlag,0); |
| | | wrapper.eq(SlAudit::getDelFlag,0); |
| | | wrapper.orderByDesc(SlAudit::getCreateTime); |
| | | Page<SlAudit> page1 = this.page(page, wrapper); |
| | | |
| | | PageDTO<SlAuditVO> slEquipmentVOPageDTO = PageDTO.of(page1, SlAuditVO.class); |
| | | List<SlAuditVO> list = slEquipmentVOPageDTO.getList(); |
| | | for (SlAuditVO sl:list){ |
| | | SlAuditVO slAuditVO=new SlAuditVO(); |
| | | SysUser data2 = sysUserClient.getSysUser(sl.getSysId()).getData(); |
| | | slAuditVO.setSysPhone(data2.getPhonenumber()); |
| | | slAuditVO.setSysName(data2.getNickName()); |
| | | sl.setSysPhone(data2.getPhonenumber()); |
| | | sl.setSysName(data2.getNickName()); |
| | | SlStoreManagement byId = slStoreManagementService.getById(sl.getManagementId()); |
| | | slAuditVO.setStoreManagementName(byId.getStoreManagementName()); |
| | | slAuditVO.setStoreManagementNo(byId.getStoreManagementNo()); |
| | | sl.setStoreManagementName(byId.getStoreManagementName()); |
| | | sl.setStoreManagementNo(byId.getStoreManagementNo()); |
| | | if (sl.getZymanagementId()!=null){ |
| | | SlStoreManagement byId1 = slStoreManagementService.getById(sl.getZymanagementId()); |
| | | slAuditVO.setBstoreManagementName(byId1.getStoreManagementName()); |
| | | slAuditVO.setBstoreManagementNo(byId1.getStoreManagementNo()); |
| | | sl.setBstoreManagementName(byId1.getStoreManagementName()); |
| | | sl.setBstoreManagementNo(byId1.getStoreManagementNo()); |
| | | } |
| | | } |
| | | return slEquipmentVOPageDTO; |
| | |
| | | } |
| | | this.removeById(page1); |
| | | } |
| | | |
| | | |
| | | SlAudit slAudit=new SlAudit(); |
| | | slAudit.setType(slAuditDTO.getType()); |
| | | slAudit.setState(1); |
| | | slAudit.setCreateTime(new Date()); |
| | | slAudit.setRkId(slAuditDTO.getRkId()); |
| | | if (slAudit.getType()==1){ |
| | | SlVolumeProductionRkgl slVolumeProductionRkgl = slVolumeProductionRkglMapper.selectById(slAuditDTO.getRkId()); |
| | |
| | | slAuditRecord.setShenhId(byId.getAdministratorId()); |
| | | slAuditRecord.setType(1); |
| | | slAuditRecord.setState(1); |
| | | slAuditRecord.setCreateTime(new Date()); |
| | | slAuditRecordMapper.insert(slAuditRecord); |
| | | |
| | | SlAuditRecord slAuditRecord1=new SlAuditRecord(); |
| | |
| | | slAuditRecord1.setShenhId(byId.getCompetentId()); |
| | | slAuditRecord1.setType(2); |
| | | slAuditRecord1.setState(1); |
| | | slAuditRecordMapper.insert(slAuditRecord); |
| | | slAuditRecord1.setCreateTime(new Date()); |
| | | slAuditRecordMapper.insert(slAuditRecord1); |
| | | |
| | | SlAuditRecord slAuditRecord2=new SlAuditRecord(); |
| | | slAuditRecord2.setAuditId(slAudit.getId()); |
| | | slAuditRecord2.setShenhId(byId.getDirectorId()); |
| | | slAuditRecord2.setType(3); |
| | | slAuditRecord2.setState(1); |
| | | slAuditRecordMapper.insert(slAuditRecord); |
| | | slAuditRecord2.setCreateTime(new Date()); |
| | | slAuditRecordMapper.insert(slAuditRecord2); |
| | | } |
| | | if (slAudit.getType()==2){ |
| | | |
| | |
| | | slAuditRecord.setShenhId(byId.getAdministratorId()); |
| | | slAuditRecord.setType(1); |
| | | slAuditRecord.setState(1); |
| | | slAuditRecord.setCreateTime(new Date()); |
| | | slAuditRecordMapper.insert(slAuditRecord); |
| | | |
| | | SlAuditRecord slAuditRecord1=new SlAuditRecord(); |
| | |
| | | slAuditRecord1.setShenhId(byId.getCompetentId()); |
| | | slAuditRecord1.setType(2); |
| | | slAuditRecord1.setState(1); |
| | | slAuditRecordMapper.insert(slAuditRecord); |
| | | slAuditRecord1.setCreateTime(new Date()); |
| | | slAuditRecordMapper.insert(slAuditRecord1); |
| | | |
| | | SlAuditRecord slAuditRecord2=new SlAuditRecord(); |
| | | slAuditRecord2.setAuditId(slAudit.getId()); |
| | | slAuditRecord2.setShenhId(byId.getDirectorId()); |
| | | slAuditRecord2.setType(3); |
| | | slAuditRecord2.setState(1); |
| | | slAuditRecordMapper.insert(slAuditRecord); |
| | | slAuditRecord2.setCreateTime(new Date()); |
| | | slAuditRecordMapper.insert(slAuditRecord2); |
| | | } |
| | | if (slAudit.getType()==3){ |
| | | SlVolumeProductionZygl slVolumeProductionZygl = slVolumeProductionZyglMapper.selectById(slAuditDTO.getRkId()); |
| | |
| | | slAuditRecord.setShenhId(byId.getAdministratorId()); |
| | | slAuditRecord.setType(1); |
| | | slAuditRecord.setState(1); |
| | | slAuditRecord.setCreateTime(new Date()); |
| | | slAuditRecordMapper.insert(slAuditRecord); |
| | | |
| | | SlAuditRecord slAuditRecord1=new SlAuditRecord(); |
| | |
| | | slAuditRecord1.setShenhId(byId.getCompetentId()); |
| | | slAuditRecord1.setType(2); |
| | | slAuditRecord1.setState(1); |
| | | slAuditRecordMapper.insert(slAuditRecord); |
| | | slAuditRecord1.setCreateTime(new Date()); |
| | | slAuditRecordMapper.insert(slAuditRecord1); |
| | | |
| | | SlAuditRecord slAuditRecord2=new SlAuditRecord(); |
| | | slAuditRecord2.setAuditId(slAudit.getId()); |
| | | slAuditRecord2.setShenhId(byId.getDirectorId()); |
| | | slAuditRecord2.setType(3); |
| | | slAuditRecord2.setState(1); |
| | | slAuditRecordMapper.insert(slAuditRecord); |
| | | slAuditRecord2.setCreateTime(new Date()); |
| | | slAuditRecordMapper.insert(slAuditRecord2); |
| | | } |
| | | |
| | | } |