rentaiming
2024-07-30 837da67d468fbcdd10ee27dcc44a94e7b1130a85
ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlAuditServiceImpl.java
@@ -20,9 +20,7 @@
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;
/**
@@ -75,27 +73,26 @@
            goodsSkuIdList1.add(0L);
            wrapper.in(SlAudit::getSysId,goodsSkuIdList1);
        }
        if (!data.getUserType().equals(00)){
        if (!data.getUserType().equals("00")){
            wrapper.in(SlAudit::getShenhId,userid);
        }
        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;
@@ -103,9 +100,26 @@
    @Override
    public void addslAudit(SlAuditDTO slAuditDTO) {
        LambdaQueryWrapper< SlAudit> wrapper= Wrappers.lambdaQuery();
        wrapper.eq(SlAudit::getRkId,slAuditDTO.getRkId());
        wrapper.eq(SlAudit::getType,slAuditDTO.getType());
        wrapper.eq( SlAudit::getDelFlag,0);
        wrapper.orderByDesc(SlAudit::getCreateTime);
        SlAudit page1 = this.getOne(wrapper);
        if (page1!=null){
            LambdaQueryWrapper<SlAuditRecord> wrapper1= Wrappers.lambdaQuery();
            wrapper1.eq(SlAuditRecord::getAuditId,page1.getId());
            List<SlAuditRecord> slAuditRecords = slAuditRecordMapper.selectList(wrapper1);
            for (SlAuditRecord lAuditRecord:slAuditRecords){
                slAuditRecordMapper.deleteById(lAuditRecord);
            }
            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());
@@ -126,14 +140,14 @@
            slAuditRecord1.setShenhId(byId.getCompetentId());
            slAuditRecord1.setType(2);
            slAuditRecord1.setState(1);
            slAuditRecordMapper.insert(slAuditRecord);
            slAuditRecordMapper.insert(slAuditRecord1);
            SlAuditRecord slAuditRecord2=new SlAuditRecord();
            slAuditRecord2.setAuditId(slAudit.getId());
            slAuditRecord2.setShenhId(byId.getDirectorId());
            slAuditRecord2.setType(3);
            slAuditRecord2.setState(1);
            slAuditRecordMapper.insert(slAuditRecord);
            slAuditRecordMapper.insert(slAuditRecord2);
        }
        if (slAudit.getType()==2){
@@ -155,14 +169,14 @@
            slAuditRecord1.setShenhId(byId.getCompetentId());
            slAuditRecord1.setType(2);
            slAuditRecord1.setState(1);
            slAuditRecordMapper.insert(slAuditRecord);
            slAuditRecordMapper.insert(slAuditRecord1);
            SlAuditRecord slAuditRecord2=new SlAuditRecord();
            slAuditRecord2.setAuditId(slAudit.getId());
            slAuditRecord2.setShenhId(byId.getDirectorId());
            slAuditRecord2.setType(3);
            slAuditRecord2.setState(1);
            slAuditRecordMapper.insert(slAuditRecord);
            slAuditRecordMapper.insert(slAuditRecord2);
        }
        if (slAudit.getType()==3){
            SlVolumeProductionZygl slVolumeProductionZygl = slVolumeProductionZyglMapper.selectById(slAuditDTO.getRkId());
@@ -184,14 +198,14 @@
            slAuditRecord1.setShenhId(byId.getCompetentId());
            slAuditRecord1.setType(2);
            slAuditRecord1.setState(1);
            slAuditRecordMapper.insert(slAuditRecord);
            slAuditRecordMapper.insert(slAuditRecord1);
            SlAuditRecord slAuditRecord2=new SlAuditRecord();
            slAuditRecord2.setAuditId(slAudit.getId());
            slAuditRecord2.setShenhId(byId.getDirectorId());
            slAuditRecord2.setType(3);
            slAuditRecord2.setState(1);
            slAuditRecordMapper.insert(slAuditRecord);
            slAuditRecordMapper.insert(slAuditRecord2);
        }
    }