| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private TErpSupplierWarehousingBatchMapper erpSupplierWarehousingBatchMapper; |
| | | |
| | | @Resource |
| | | private TErpClinicWarehousingBatchMapper erpClinicWarehousingBatchMapper; |
| | | |
| | | @Resource |
| | | private TErpSupplierWarehousingMapper erpSupplierWarehousingMapper; |
| | | |
| | | @Resource |
| | | private TErpClinicOutboundGoodsMapper erpClinicOutboundGoodsMapper; |
| | | |
| | | @Resource |
| | | private TErpSupplierOutboundGoodsMapper erpSupplierOutboundGoodsMapper; |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private TCrmClinicMapper crmClinicMapper; |
| | |
| | | // 获取明天的时间 |
| | | 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; |
| | | } |
| | |
| | | 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); |
| | |
| | | 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; |