From d1fcb0d4d5e0422db4d6bdfa645a6bc5aead3d0c Mon Sep 17 00:00:00 2001 From: liux <963924687@qq.com> Date: Mon, 4 Aug 2025 09:05:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=BA=93=E5=90=8E=E7=BB=AD=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReportInventoryBaseController.java | 2 - .../param/ImsIntoInventoryDetailAdd.java | 6 +- .../ims/mapper/ReportInventoryMapper.java | 13 ++ .../impl/ImsIntoInventoryServiceImpl.java | 8 +- .../impl/ReportInventoryBaseServiceImpl.java | 200 ++++++++++++++---- .../impl/SupplierBindMaterialServiceImpl.java | 37 ++-- .../canteen/core/ims/vo/ImsIndexDataVO.java | 25 ++- .../mapper/ims/ReportInventoryMapper.xml | 98 +++++++++ 8 files changed, 317 insertions(+), 72 deletions(-) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/controller/ReportInventoryBaseController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/controller/ReportInventoryBaseController.java index 039d0fa..ae529cb 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/controller/ReportInventoryBaseController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/controller/ReportInventoryBaseController.java @@ -87,8 +87,6 @@ public class ReportInventoryBaseController extends BaseController { } - - /**********************************************************************************/ /** diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsIntoInventoryDetailAdd.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsIntoInventoryDetailAdd.java index 9484c33..0fa78f6 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsIntoInventoryDetailAdd.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/domain/param/ImsIntoInventoryDetailAdd.java @@ -14,7 +14,7 @@ import java.io.Serializable; /** * 入库记录明细对象 ims_into_inventory_detail - * + * * @author gaowdong * @date 2025-07-07 */ @@ -100,8 +100,8 @@ public class ImsIntoInventoryDetailAdd implements Serializable /** 入库原料照片 */ @ApiModelProperty(value = "入库原料照片") - @NotNull(message = "入库原料照片不能为空") - private String imgUrl; + // @NotNull(message = "入库原料照片不能为空") + private String imgUrl=""; /** 是否补库存明细(1是2否) */ @ApiModelProperty(value = "是否补库存明细(1是2否)") diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/mapper/ReportInventoryMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/mapper/ReportInventoryMapper.java index 0d1b889..f60f3d5 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/mapper/ReportInventoryMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/mapper/ReportInventoryMapper.java @@ -7,6 +7,7 @@ import com.bonus.canteen.core.ims.dto.ImsIndexDateDTO; import com.bonus.canteen.core.ims.report.ReportInventoryIntoDetailParam; import com.bonus.canteen.core.ims.report.ReportInventoryOutDetailParam; import com.bonus.canteen.core.ims.vo.*; +import com.bonus.canteen.core.kitchen.vo.IndexMapCountVO; import org.apache.ibatis.annotations.Param; /** @@ -92,4 +93,16 @@ public interface ReportInventoryMapper { BigDecimal getStoreAmount(@Param("param")ImsIndexDateDTO thisTime); BigDecimal getOutboundAmount(@Param("param")ImsIndexDateDTO thisTime); + + List getOutImsRanking(@Param("param") ImsIndexDateDTO thisTime); + + List getIntoImsRanking(@Param("param") ImsIndexDateDTO thisTime); + + List getAcceptanceProportion(@Param("param") ImsIndexDateDTO thisTime); + + List getInventoryProportion(@Param("param") ImsIndexDateDTO thisTime); + + List getOrderSupplier(@Param("param") ImsIndexDateDTO thisTime); + + List getOrderCanteen(@Param("param") ImsIndexDateDTO thisTime); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ImsIntoInventoryServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ImsIntoInventoryServiceImpl.java index 169176b..cf0d80b 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ImsIntoInventoryServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ImsIntoInventoryServiceImpl.java @@ -279,8 +279,12 @@ public class ImsIntoInventoryServiceImpl implements IImsIntoInventoryService reportInventoryBase.setFetchUserId(-1L); reportInventoryBase.setOperatorId("王大力"); reportInventoryBase.setOperateTime(DateUtils.getNowDate()); - reportInventoryBaseMapper.insertReportInventoryBase(reportInventoryBase); //新增库存记录基础信息 - reportInventoryMapper.insertReportInventory(reportInventory); //新增库存记录 + if(Objects.nonNull(detail.getInventoryId())){ + reportInventoryBaseMapper.insertReportInventoryBase(reportInventoryBase); //新增库存记录基础信息 + reportInventoryMapper.insertReportInventory(reportInventory); //新增库存记录 + }else{ + return; + } updatetReportInventoryDTO.setWarehouseId(imsOutInventory.getWarehouseId()); updatetReportInventoryDTO.setMaterialId(detail.getMaterialId()); updatetReportInventoryDTO.setReportInventoryId(reportInventory.getId()); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ReportInventoryBaseServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ReportInventoryBaseServiceImpl.java index 70d06f1..399f714 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ReportInventoryBaseServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/ReportInventoryBaseServiceImpl.java @@ -4,9 +4,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.time.*; import java.time.format.DateTimeFormatter; -import java.util.HashMap; -import java.util.List; -import java.util.Optional; +import java.util.*; import java.util.stream.Collectors; import com.bonus.canteen.core.ims.domain.ImsOutInventory; @@ -27,6 +25,7 @@ import com.bonus.canteen.core.ims.service.IImsIntoInventoryService; import com.bonus.canteen.core.ims.service.IImsInventoryService; import com.bonus.canteen.core.ims.service.IImsOutInventoryService; import com.bonus.canteen.core.ims.vo.*; +import com.bonus.canteen.core.kitchen.vo.IndexMapCountVO; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import org.apache.catalina.security.SecurityUtil; @@ -120,52 +119,74 @@ public class ReportInventoryBaseServiceImpl implements IReportInventoryBaseServi ImsIndexDataVO imsIndexDataVO = new ImsIndexDataVO(); ImsIndexDateDTO thisTime = new ImsIndexDateDTO(); ImsIndexDateDTO beforeTime = new ImsIndexDateDTO(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); thisTime.setType(type); - if(type ==1){ - LocalDateTime thisStartDate = LocalDate.now().withDayOfMonth(1).atStartOfDay(); - // 获取当月最后一天结束时间(23:59:59.999999999) - LocalDateTime thisEndDate = LocalDate.now().withDayOfMonth(YearMonth.now().lengthOfMonth()).atTime(LocalTime.MAX); - LocalDateTime beforeStartDate = LocalDate.now().minusMonths(1).withDayOfMonth(1).atStartOfDay(); - // 获取上月结束时间(最后一天 23:59:59.999999999) - LocalDateTime beforeEndDate = YearMonth.now().minusMonths(1).atEndOfMonth().atTime(LocalTime.MAX); - thisTime.setStartDate(thisStartDate.format(formatter)); - thisTime.setEndDate(thisEndDate.format(formatter)); - beforeTime.setStartDate(beforeStartDate.format(formatter)); - beforeTime.setEndDate(beforeEndDate.format(formatter)); - }else if(type ==2){ - LocalDate monday = LocalDate.now().with(DayOfWeek.MONDAY); - // 获取本周日(结束日期) - LocalDate sunday = LocalDate.now().with(DayOfWeek.SUNDAY); - // 本周开始时间(周一 00:00:00) - LocalDateTime thisWeekStart = monday.atStartOfDay(); - // 本周结束时间(周日 23:59:59.999999999) - LocalDateTime thisWeekEnd = sunday.atTime(LocalTime.MAX); - LocalDate lastMonday = LocalDate.now().minusWeeks(1).with(DayOfWeek.MONDAY); // 设置为周一 - // 获取上周日(结束日期) - LocalDate lastSunday = lastMonday.plusDays(6); // 周一加6天到周日 - // 上周开始时间(周一 00:00:00) - LocalDateTime beforeWeekStart = lastMonday.atStartOfDay(); - // 上周结束时间(周日 23:59:59.999999999) - LocalDateTime beforelastWeekEnd = lastSunday.atTime(LocalTime.MAX); - thisTime.setStartDate(thisWeekStart.format(formatter)); - thisTime.setEndDate(thisWeekEnd.format(formatter)); - beforeTime.setStartDate(beforeWeekStart.format(formatter)); - beforeTime.setEndDate(beforelastWeekEnd.format(formatter)); - }else{ - //不做处理 - } + formatDate(thisTime, beforeTime, type); //采购订单总金额 getTotalOrderAmount(thisTime, beforeTime, imsIndexDataVO); + //采购订单数量(个) getTotalOrderNum(thisTime, beforeTime, imsIndexDataVO); + //未验收完成采购订单数(个) getUnFinshOrderNum(thisTime, beforeTime, imsIndexDataVO); + //采购订单货品总数 getTotalOrderGoodsNum(thisTime, beforeTime, imsIndexDataVO); + //入库货品数量 getStoreNum(thisTime, beforeTime, imsIndexDataVO); + //出库货品数量 getOutboundNum(thisTime, beforeTime, imsIndexDataVO); + //入库总金额(元) getStoreAmount(thisTime, beforeTime, imsIndexDataVO); + //出库总金额(元) getOutboundAmount(thisTime, beforeTime, imsIndexDataVO); + //出库排名 + getOutImsRanking(thisTime, imsIndexDataVO); + //入库排名 + getIntoImsRanking(thisTime, imsIndexDataVO); + //验收占比 + getAcceptanceProportion(thisTime, imsIndexDataVO); + //库存占比 + getInventoryProportion(thisTime, imsIndexDataVO); + //供应商占比 + getOrderSupplier(thisTime, imsIndexDataVO); + //食堂占比 + getOrderCanteen(thisTime, imsIndexDataVO); return imsIndexDataVO; } + + private void getOrderCanteen( ImsIndexDateDTO thisTime , ImsIndexDataVO imsIndexDataVO){ + List orderCanteen = reportInventoryMapper.getOrderCanteen(thisTime); + getRate(orderCanteen); + imsIndexDataVO.setOrderCanteen(orderCanteen); + } + + private void getOrderSupplier( ImsIndexDateDTO thisTime , ImsIndexDataVO imsIndexDataVO){ + List rrderSupplier = reportInventoryMapper.getOrderSupplier(thisTime); + getRate(rrderSupplier); + imsIndexDataVO.setOrderSupplier(rrderSupplier); + } + + private void getInventoryProportion( ImsIndexDateDTO thisTime , ImsIndexDataVO imsIndexDataVO){ + List inventoryProportion = reportInventoryMapper.getInventoryProportion(thisTime); + getRate(inventoryProportion); + imsIndexDataVO.setInventoryProportion(inventoryProportion); + } + + private void getAcceptanceProportion( ImsIndexDateDTO thisTime , ImsIndexDataVO imsIndexDataVO){ + List acceptanceProportion = reportInventoryMapper.getAcceptanceProportion(thisTime); + getRate(acceptanceProportion); + imsIndexDataVO.setAcceptanceProportion(acceptanceProportion); + } + + private void getIntoImsRanking( ImsIndexDateDTO thisTime , ImsIndexDataVO imsIndexDataVO){ + List intoImsRanking = reportInventoryMapper.getIntoImsRanking(thisTime); + getRate(intoImsRanking); + imsIndexDataVO.setIntoImsRanking(intoImsRanking); + } + private void getOutImsRanking( ImsIndexDateDTO thisTime , ImsIndexDataVO imsIndexDataVO){ + List outImsRanking = reportInventoryMapper.getOutImsRanking(thisTime); + getRate(outImsRanking); + imsIndexDataVO.setOutImsRanking(outImsRanking); + } + private void getOutboundAmount( ImsIndexDateDTO thisTime , ImsIndexDateDTO beforeTime, ImsIndexDataVO imsIndexDataVO){ BigDecimal totalOrderAmount_this = reportInventoryMapper.getOutboundAmount(thisTime); BigDecimal totalOrderAmount_before = reportInventoryMapper.getOutboundAmount(beforeTime); @@ -218,6 +239,65 @@ public class ReportInventoryBaseServiceImpl implements IReportInventoryBaseServi imsIndexDataVO.setTotalOrderAmount(bean); } + private void formatDate(ImsIndexDateDTO thisTime, ImsIndexDateDTO beforeTime,Long type) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + if(type ==1){ + LocalDateTime thisStartDate = LocalDate.now().withDayOfMonth(1).atStartOfDay(); + // 获取当月最后一天结束时间(23:59:59.999999999) + LocalDateTime thisEndDate = LocalDate.now().withDayOfMonth(YearMonth.now().lengthOfMonth()).atTime(LocalTime.MAX); + LocalDateTime beforeStartDate = LocalDate.now().minusMonths(1).withDayOfMonth(1).atStartOfDay(); + // 获取上月结束时间(最后一天 23:59:59.999999999) + LocalDateTime beforeEndDate = YearMonth.now().minusMonths(1).atEndOfMonth().atTime(LocalTime.MAX); + thisTime.setStartDate(thisStartDate.format(formatter)); + thisTime.setEndDate(thisEndDate.format(formatter)); + beforeTime.setStartDate(beforeStartDate.format(formatter)); + beforeTime.setEndDate(beforeEndDate.format(formatter)); + }else if(type ==2){ + LocalDate monday = LocalDate.now().with(DayOfWeek.MONDAY); + // 获取本周日(结束日期) + LocalDate sunday = LocalDate.now().with(DayOfWeek.SUNDAY); + // 本周开始时间(周一 00:00:00) + LocalDateTime thisWeekStart = monday.atStartOfDay(); + // 本周结束时间(周日 23:59:59.999999999) + LocalDateTime thisWeekEnd = sunday.atTime(LocalTime.MAX); + LocalDate lastMonday = LocalDate.now().minusWeeks(1).with(DayOfWeek.MONDAY); // 设置为周一 + // 获取上周日(结束日期) + LocalDate lastSunday = lastMonday.plusDays(6); // 周一加6天到周日 + // 上周开始时间(周一 00:00:00) + LocalDateTime beforeWeekStart = lastMonday.atStartOfDay(); + // 上周结束时间(周日 23:59:59.999999999) + LocalDateTime beforelastWeekEnd = lastSunday.atTime(LocalTime.MAX); + thisTime.setStartDate(thisWeekStart.format(formatter)); + thisTime.setEndDate(thisWeekEnd.format(formatter)); + beforeTime.setStartDate(beforeWeekStart.format(formatter)); + beforeTime.setEndDate(beforelastWeekEnd.format(formatter)); + }else{ + //不做处理 + } + } + private void getRate(List list) { + if (list != null && list.size() > 0) { + Long totalCount = list.stream() + .map(IndexMapCountVO::getCount) + .reduce(0, Integer::sum) + .longValue(); + for (IndexMapCountVO bean : list) { + if(totalCount != null){ + if (BigDecimal.valueOf(totalCount).compareTo(BigDecimal.ZERO) == 0) { + bean.setPercentage(0.0); + } else { + Integer countNum = bean.getCount() == null ? 0 : bean.getCount(); + // 计算百分比 + BigDecimal count = BigDecimal.valueOf(countNum); + BigDecimal rate =count.divide(BigDecimal.valueOf(totalCount), 2, RoundingMode.HALF_UP) + .multiply(new BigDecimal("100")); + bean.setPercentage(rate.doubleValue()); + } + } + } + } + + } private ImsIndexDataDetailsVO getRate(BigDecimal totalOrderAmount_this,BigDecimal totalOrderAmount_before) { ImsIndexDataDetailsVO totalOrderAmount = new ImsIndexDataDetailsVO(); BigDecimal rate; @@ -399,24 +479,31 @@ public class ReportInventoryBaseServiceImpl implements IReportInventoryBaseServi } } + Set duplicateMaterialIds = findDuplicateMaterialIds(updatetReportInventoryDTOList); if(updatetReportInventoryDTOList !=null && updatetReportInventoryDTOList.size()>0){ for(UpdatetReportInventoryDTO updatetReportInventoryDTO : updatetReportInventoryDTOList){ Long materialId = updatetReportInventoryDTO.getMaterialId(); - if (materialIMoneyMap.containsKey(materialId )) { + if (materialIMoneyMap.containsKey(materialId)) { BigDecimal monerValue = materialIMoneyMap.get(materialId); BigDecimal mumValue = materialINumMap.get(materialId); if(1== type){ - //如果存在则减去 - monerValue = monerValue.subtract(BigDecimal.valueOf(updatetReportInventoryDTO.getTotalPrice())); - materialIMoneyMap.put(materialId, monerValue.setScale(2, RoundingMode.HALF_UP)); - mumValue = mumValue.subtract(updatetReportInventoryDTO.getPurNum()); - materialIMoneyMap.put(materialId, mumValue.setScale(2, RoundingMode.HALF_UP)); + if(duplicateMaterialIds.contains(materialId)){ + //如果存在则减去 + monerValue = monerValue.subtract(BigDecimal.valueOf(updatetReportInventoryDTO.getTotalPrice())); + materialIMoneyMap.put(materialId, monerValue.setScale(2, RoundingMode.HALF_UP)); + mumValue = mumValue.subtract(updatetReportInventoryDTO.getPurNum()); + materialIMoneyMap.put(materialId, mumValue.setScale(2, RoundingMode.HALF_UP)); + } }else{ //如果存在则累加 - monerValue = monerValue.add(BigDecimal.valueOf(updatetReportInventoryDTO.getTotalPrice())); - materialIMoneyMap.put(materialId, monerValue.setScale(2, RoundingMode.HALF_UP)); - mumValue = mumValue.add(updatetReportInventoryDTO.getPurNum()); - materialINumMap.put(materialId, mumValue.setScale(2, RoundingMode.HALF_UP)); + if(duplicateMaterialIds.contains(materialId)){ + monerValue = monerValue.add(BigDecimal.valueOf(updatetReportInventoryDTO.getTotalPrice())); + materialIMoneyMap.put(materialId, monerValue.setScale(2, RoundingMode.HALF_UP)); + mumValue = mumValue.add(updatetReportInventoryDTO.getPurNum()); + materialINumMap.put(materialId, mumValue.setScale(2, RoundingMode.HALF_UP)); + } + + } materialIMoneyMap.put(materialId, monerValue); materialINumMap.put(materialId, mumValue); @@ -437,6 +524,25 @@ public class ReportInventoryBaseServiceImpl implements IReportInventoryBaseServi } } + public Set findDuplicateMaterialIds(List list) { + if (list == null || list.isEmpty()) { + return Collections.emptySet(); // 如果列表为空,返回空集合 + } + + // 1. 按 materialId 分组,并计算每个 materialId 出现的次数 + Map materialIdCountMap = list.stream() + .collect(Collectors.groupingBy( + UpdatetReportInventoryDTO::getMaterialId, + Collectors.counting() + )); + + // 2. 筛选出出现次数 >1 的 materialId + return materialIdCountMap.entrySet().stream() + .filter(entry -> entry.getValue() > 1) // 只保留重复的 materialId + .map(Map.Entry::getKey) + .collect(Collectors.toSet()); + } + public List getDistinctMaterialIds(List list){ return list.stream() .map(UpdatetReportInventoryDTO :: getMaterialId) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/SupplierBindMaterialServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/SupplierBindMaterialServiceImpl.java index 8bbd48c..721cf17 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/SupplierBindMaterialServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/service/impl/SupplierBindMaterialServiceImpl.java @@ -18,7 +18,7 @@ import com.bonus.canteen.core.ims.service.ISupplierBindMaterialService; /** * 原料绑定供应商Service业务层处理 - * + * * @author xsheng * @date 2025-07-14 */ @@ -31,7 +31,7 @@ public class SupplierBindMaterialServiceImpl implements ISupplierBindMaterialSer /** * 查询原料绑定供应商 - * + * * @param id 原料绑定供应商主键 * @return 原料绑定供应商 */ @@ -44,7 +44,7 @@ public class SupplierBindMaterialServiceImpl implements ISupplierBindMaterialSer /** * 查询原料绑定供应商列表 - * + * * @param supplierBindMaterial 原料绑定供应商 * @return 原料绑定供应商 */ @@ -52,14 +52,17 @@ public class SupplierBindMaterialServiceImpl implements ISupplierBindMaterialSer public List selectSupplierBindMaterialList(SupplierBindMaterial supplierBindMaterial) { List list = supplierBindMaterialMapper.selectSupplierBindMaterialList(supplierBindMaterial); for (SupplierBindMaterial bindMaterial : list) { - bindMaterial.setAlternativeSuppliers((List) JacksonUtil.readValue(bindMaterial.getAlternativeSupplier(), List.class)); + if(bindMaterial.getAlternativeSupplier() != null){ + bindMaterial.setAlternativeSuppliers((List) JacksonUtil.readValue(bindMaterial.getAlternativeSupplier(), List.class)); + } + } return list; } /** * 新增原料绑定供应商 - * + * * @param supplierBindMaterials 原料绑定供应商 * @return 结果 */ @@ -81,7 +84,7 @@ public class SupplierBindMaterialServiceImpl implements ISupplierBindMaterialSer /** * 修改原料绑定供应商 - * + * * @param supplierBindMaterials 原料绑定供应商 * @return 结果 */ @@ -93,16 +96,18 @@ public class SupplierBindMaterialServiceImpl implements ISupplierBindMaterialSer supplierBindMaterial.setUpdateTime(DateUtils.getNowDate()); supplierBindMaterial.setUpdateBy(SecurityUtils.getUsername()); List alternativeSuppliers = supplierBindMaterial.getAlternativeSuppliers(); - for (SupplierDTO supplierDTO : alternativeSuppliers) { - Supplier supplier = supplierMapper.selectSupplierBySupplierId(supplierDTO.getSupplierId()); - if (Objects.nonNull(supplier)) { - supplierDTO.setSupplierName(supplier.getSupplierName()); - supplierDTO.setAreaId(supplier.getAreaId()); - supplierDTO.setSupplierScore(supplier.getSupplierScore()); + if(alternativeSuppliers != null){ + for (SupplierDTO supplierDTO : alternativeSuppliers) { + Supplier supplier = supplierMapper.selectSupplierBySupplierId(supplierDTO.getSupplierId()); + if (Objects.nonNull(supplier)) { + supplierDTO.setSupplierName(supplier.getSupplierName()); + supplierDTO.setAreaId(supplier.getAreaId()); + supplierDTO.setSupplierScore(supplier.getSupplierScore()); + } } + supplierBindMaterial.setAlternativeSupplier(JacksonUtil.writeValueAsString(alternativeSuppliers)); + count += supplierBindMaterialMapper.updateSupplierBindMaterial(supplierBindMaterial); } - supplierBindMaterial.setAlternativeSupplier(JacksonUtil.writeValueAsString(alternativeSuppliers)); - count += supplierBindMaterialMapper.updateSupplierBindMaterial(supplierBindMaterial); } return count; } catch (Exception e) { @@ -112,7 +117,7 @@ public class SupplierBindMaterialServiceImpl implements ISupplierBindMaterialSer /** * 批量删除原料绑定供应商 - * + * * @param ids 需要删除的原料绑定供应商主键 * @return 结果 */ @@ -123,7 +128,7 @@ public class SupplierBindMaterialServiceImpl implements ISupplierBindMaterialSer /** * 删除原料绑定供应商信息 - * + * * @param id 原料绑定供应商主键 * @return 结果 */ diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/vo/ImsIndexDataVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/vo/ImsIndexDataVO.java index 88709ee..5e4dbf5 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/vo/ImsIndexDataVO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/ims/vo/ImsIndexDataVO.java @@ -1,7 +1,10 @@ package com.bonus.canteen.core.ims.vo; +import com.bonus.canteen.core.kitchen.vo.IndexMapCountVO; import lombok.Data; +import java.util.List; + /** * @author xliu * @date 2025/7/23 15:13 @@ -28,12 +31,30 @@ public class ImsIndexDataVO { //出库货品数量 private ImsIndexDataDetailsVO outboundNum; - //入库总金额(元) private ImsIndexDataDetailsVO storeAmount; - //出库总金额(元) private ImsIndexDataDetailsVO outboundAmount; + /*******************************************/ + + //出库排名 + private List outImsRanking; + + //入库排名 + private List intoImsRanking; + + //验收占比 + private List acceptanceProportion; + + //库存占比 + private List inventoryProportion; + + //采购单趋势-供应商 + private List orderSupplier; + + //采购单趋势-食堂 + private List orderCanteen; + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ReportInventoryMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ReportInventoryMapper.xml index 71901d6..2396ebb 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ReportInventoryMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/ims/ReportInventoryMapper.xml @@ -561,4 +561,102 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + +