liujie
3 天以前 a1a3b7ddc7ab7e89583ed0c8bca32e3730076ecd
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpMaintenanceReminderServiceImpl.java
@@ -15,6 +15,7 @@
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -45,10 +46,18 @@
    private TErpSupplierWarehousingBatchMapper erpSupplierWarehousingBatchMapper;
    @Resource
    private TErpClinicWarehousingBatchMapper erpClinicWarehousingBatchMapper;
    @Resource
    private TErpSupplierWarehousingMapper erpSupplierWarehousingMapper;
    @Resource
    private TErpClinicOutboundGoodsMapper erpClinicOutboundGoodsMapper;
    @Resource
    private TErpSupplierOutboundGoodsMapper erpSupplierOutboundGoodsMapper;
    @Resource
    private  TCrmClinicMapper crmClinicMapper;
@@ -79,8 +88,13 @@
        // 获取明天的时间
        LocalDateTime tomorrow = LocalDateTime.now().plusDays(1);
        List<TErpMaintenanceReminderListVo> list=new ArrayList<>();
        if(roleType==4){
           list = baseMapper.pageList(page, query, user,supplierClinicId,tomorrow);
        }else {
           list = baseMapper.pageList1(page, query, user,supplierClinicId,tomorrow);
        }
        List<TErpMaintenanceReminderListVo> list = baseMapper.pageList(page, query, user,supplierClinicId,tomorrow);
        if(list.isEmpty()){
            return page;
        }
@@ -95,7 +109,7 @@
        if(!personIds.isEmpty()){
            List<SysUser> userList = sysUserMapper.selectBatchIds(personIds);
            for (TErpMaintenanceReminderListVo tErpMaintenanceReminderListVo : list) {
                userList.stream().filter(t ->tErpMaintenanceReminderListVo.getMaintenancePersonId()!=null &&  t.getUserId().toString().equals(tErpMaintenanceReminderListVo.getMaintenancePersonId().toString())).findFirst().ifPresent(t -> tErpMaintenanceReminderListVo.setMaintenancePersonName(t.getUserName()));
                userList.stream().filter(t ->tErpMaintenanceReminderListVo.getMaintenancePersonId()!=null &&  t.getUserId().toString().equals(tErpMaintenanceReminderListVo.getMaintenancePersonId().toString())).findFirst().ifPresent(t -> tErpMaintenanceReminderListVo.setMaintenancePersonName(t.getNickName()));
            }
        }
        page.setRecords( list);
@@ -113,32 +127,53 @@
        tErpMaintenanceReminderDetailVo.setMaintenanceRecord(tErpMaintenanceReminder.getMaintenanceRecord());
        tErpMaintenanceReminderDetailVo.setMaintenancePersonId(tErpMaintenanceReminder.getMaintenancePersonId());
        if(tErpMaintenanceReminder.getMaintenancePersonId()!=null){
            tErpMaintenanceReminderDetailVo.setMaintenancePersonName(sysUserMapper.selectUserById(Long.valueOf(tErpMaintenanceReminder.getMaintenancePersonId())).getUserName());
            tErpMaintenanceReminderDetailVo.setMaintenancePersonName(sysUserMapper.selectUserById(Long.valueOf(tErpMaintenanceReminder.getMaintenancePersonId())).getNickName());
        }
        tErpMaintenanceReminderDetailVo.setStatus(tErpMaintenanceReminder.getStatus());
        String warehousingBatchId = tErpMaintenanceReminder.getWarehousingBatchId();
        if(warehousingBatchId != null){
            TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch = erpSupplierWarehousingBatchMapper.selectById(warehousingBatchId);
            tErpMaintenanceReminderDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber());
            TErpSupplierWarehousing tErpSupplierWarehousing = erpSupplierWarehousingMapper.selectById(tErpSupplierWarehousingBatch.getWarehousingId());
            if(tErpSupplierWarehousing!=null){
                String goodsId = tErpSupplierWarehousing.getGoodsId();
                if(goodsId != null){
                    TErpGoods goods = erpGoodsMapper.selectById(goodsId);
                    tErpMaintenanceReminderDetailVo.setGoodsName(goods.getGoodsName());
                    tErpMaintenanceReminderDetailVo.setQuasiNumber(goods.getQuasiNumber());
                    tErpMaintenanceReminderDetailVo.setGoodsIdCode(goods.getGoodsIdCode());
                    String packingUnitId = goods.getPackingUnitId();
                    if(packingUnitId != null){
                        TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(packingUnitId);
                        tErpMaintenanceReminderDetailVo.setUnitName(tErpGoodsUnit.getUnitName());
            if(tErpMaintenanceReminder.getMaintenanceType()==2){
                TErpClinicWarehousingBatch tErpSupplierWarehousingBatch = erpClinicWarehousingBatchMapper.selectById(warehousingBatchId);
                tErpMaintenanceReminderDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber());
                    String goodsId = tErpSupplierWarehousingBatch.getGoodsId();
                    if(goodsId != null){
                        TErpGoods goods = erpGoodsMapper.selectById(goodsId);
                        tErpMaintenanceReminderDetailVo.setGoodsName(goods.getGoodsName());
                        tErpMaintenanceReminderDetailVo.setQuasiNumber(goods.getQuasiNumber());
                        tErpMaintenanceReminderDetailVo.setGoodsIdCode(goods.getGoodsIdCode());
                        String packingUnitId = goods.getPackingUnitId();
                        if(packingUnitId != null){
                            TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(packingUnitId);
                            tErpMaintenanceReminderDetailVo.setUnitName(tErpGoodsUnit.getUnitName());
                        }
                    }
                List<TErpClinicOutboundGoods> tErpSupplierOutboundGoods = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getWarehousingBatchId, warehousingBatchId));
                int sum = tErpSupplierOutboundGoods.stream().mapToInt(TErpClinicOutboundGoods::getOutboundCount).sum();
                tErpMaintenanceReminderDetailVo.setNumber(tErpSupplierWarehousingBatch.getWarehousingNumber()-sum);
            }else {
                TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch = erpSupplierWarehousingBatchMapper.selectById(warehousingBatchId);
                tErpMaintenanceReminderDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber());
                TErpSupplierWarehousing tErpSupplierWarehousing = erpSupplierWarehousingMapper.selectById(tErpSupplierWarehousingBatch.getWarehousingId());
                if(tErpSupplierWarehousing!=null){
                    String goodsId = tErpSupplierWarehousing.getGoodsId();
                    if(goodsId != null){
                        TErpGoods goods = erpGoodsMapper.selectById(goodsId);
                        tErpMaintenanceReminderDetailVo.setGoodsName(goods.getGoodsName());
                        tErpMaintenanceReminderDetailVo.setQuasiNumber(goods.getQuasiNumber());
                        tErpMaintenanceReminderDetailVo.setGoodsIdCode(goods.getGoodsIdCode());
                        String packingUnitId = goods.getPackingUnitId();
                        if(packingUnitId != null){
                            TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(packingUnitId);
                            tErpMaintenanceReminderDetailVo.setUnitName(tErpGoodsUnit.getUnitName());
                        }
                    }
                }
                List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods = erpSupplierOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpSupplierOutboundGoods>().eq(TErpSupplierOutboundGoods::getWarehousingBatchId, warehousingBatchId));
                int sum = tErpSupplierOutboundGoods.stream().mapToInt(TErpSupplierOutboundGoods::getOutboundCount).sum();
                tErpMaintenanceReminderDetailVo.setNumber(tErpSupplierWarehousingBatch.getWarehousingNumber()-sum);
            }
            List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods = erpSupplierOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpSupplierOutboundGoods>().eq(TErpSupplierOutboundGoods::getWarehousingBatchId, warehousingBatchId));
            int sum = tErpSupplierOutboundGoods.stream().mapToInt(TErpSupplierOutboundGoods::getOutboundCount).sum();
            tErpMaintenanceReminderDetailVo.setNumber(tErpSupplierWarehousingBatch.getWarehousingNumber()-sum);
        }
        return tErpMaintenanceReminderDetailVo;