diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationEntity.java index 33e2e7ea4..ea52278d2 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationEntity.java @@ -170,6 +170,9 @@ public class DistributionReservationEntity extends TenantEntity { @ApiModelProperty(value = "商场名称") private String mallName; + @ApiModelProperty(value = "商场电话") + private String mailPhone; + /** * 门店名称 */ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml index f779ca5cd..9c58e8b21 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml @@ -20,7 +20,7 @@ - + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java index 6f87d12ea..49574c7fd 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java @@ -3215,24 +3215,12 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl handleShangPeiData(Long templateId, String[] idArray,String html) throws Exception { - List result = new ArrayList<>(); - for (String id : idArray) { - - //查询对应配送单 - DistributionDeliveryListEntity deliveryListEntity = baseMapper.selectById(id);//配送单 - if(Objects.isNull(deliveryListEntity)){ - log.warn("#########handleShangPeiData: 配送单信息不存在 deliveryListEntityId={}",id); - throw new CustomerException(403,"配送单信息不存在"); - } - Long deliveryListEntityId = deliveryListEntity.getId(); - String taskTime = deliveryListEntity.getTaskTime();//配送时间 - String kind = deliveryListEntity.getKind(); - String dirverName = ""; - String dirverPhone = ""; - String carNumber = ""; - - if("1".equals(kind)){ + public Map getDriverCar(String kind, Long deliveryListEntityId) { + Map map = new HashMap<>(); + String dirverName = null; + String dirverPhone = null; + String carNumber = null; + if ("1".equals(kind)) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("delivery_id",deliveryListEntityId); DistributionDeliverySelfEntity deliverySelfEntity = distributionDeliverySelfService.getOne(queryWrapper); @@ -3247,6 +3235,31 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl handleShangPeiData(Long templateId, String[] idArray, String html) throws Exception { + List result = new ArrayList<>(); + for (String id : idArray) { + + //查询对应配送单 + DistributionDeliveryListEntity deliveryListEntity = baseMapper.selectById(id);//配送单 + if (Objects.isNull(deliveryListEntity)) { + log.warn("#########handleShangPeiData: 配送单信息不存在 deliveryListEntityId={}", id); + throw new CustomerException(403, "配送单信息不存在"); + } + Long deliveryListEntityId = deliveryListEntity.getId(); + String taskTime = deliveryListEntity.getTaskTime();//配送时间 + String kind = deliveryListEntity.getKind(); + Map driverCar = getDriverCar(kind, deliveryListEntityId); + String dirverName = driverCar.get("dirverName"); + String dirverPhone = driverCar.get("dirverPhone"); + String carNumber = driverCar.get("carNumber"); + List distributionReservationEntityList = distributionReservationMapper.findByDeliveryId(deliveryListEntityId); //循环查询出来的预约单 @@ -3364,6 +3377,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl> spaclOrderList = buildSpaclOrders(distributionReservationEntity, 1); map.put("定制品集合", spaclOrderList); + map.put("定制品合计", spaclOrderList.stream().mapToInt(map1 -> Integer.parseInt(map1.get("数量").toString())).sum()); + map.put("备注", distributionReservationEntity.getRemarks()); - map.put("送货司机", byId.getVehicleName() + "/" + byId.getDriverName()); + + + map.put("承运商", byId.getDistributionCompany()); + map.put("配送仓库", byId.getWarehouseName()); + // TODO 查询配送单的时间 + map.put("出库时间", byId.getTaskTime()); + data.add(map); - String popHtml =TemplateUtil.popTemplate("市配配送单",map,html); + Map driverCar = getDriverCar(byId.getKind(), byId.getId()); + String dirverName = driverCar.get("dirverName"); + String dirverPhone = driverCar.get("dirverPhone"); + String carNumber = driverCar.get("carNumber"); + + map.put("送货司机", dirverName + "/" + dirverPhone); + map.put("车牌号", carNumber); + + + String popHtml = TemplateUtil.popTemplate("市配配送单", map, html); PrintPreviewVO printPreviewVO = new PrintPreviewVO(); printPreviewVO.setTemplateId(template.getId()); printPreviewVO.setTemplateHtml(popHtml); diff --git a/blade-service/logpm-distribution/src/test/com/logpm/distribution/MyTest.java b/blade-service/logpm-distribution/src/test/com/logpm/distribution/MyTest.java deleted file mode 100644 index a9e75d041..000000000 --- a/blade-service/logpm-distribution/src/test/com/logpm/distribution/MyTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.logpm.distribution; - - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.logpm.distribution.dto.app.StockupDTO; -import com.logpm.distribution.entity.DistributionBillLadingScanEntity; -import com.logpm.distribution.service.*; -import com.logpm.distribution.vo.OrderPackgeCodeDataVO; -import org.checkerframework.checker.units.qual.A; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springblade.core.test.BladeBootTest; -import org.springblade.core.test.BladeSpringExtension; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.springblade.common.constant.ModuleNameConstant.APPLICATION_DISTRIBUTION_NAME; - -@ExtendWith(BladeSpringExtension.class) -@BladeBootTest(appName = APPLICATION_DISTRIBUTION_NAME, enableLoader = true) -public class MyTest { - - - @Autowired - private IDistributionStockupService distributionStockupService; - - @Autowired - private IDistributionReservationService distributionReservationService; - - @Autowired - private IDistributionParcelListService distributionParcelListService; - - @Autowired - private IDistributionStockListService distributionStockListService; - - @Autowired - private IDistributionStockArticleService distributionStockArticleService; - - - @Test - public void te(){ -// Map params = new HashMap<>(); -// params.put("ids","1686560469635727362"); -// try { -// OrderPackgeCodeDataVO orderPackgeCodeDataVO =distributionStockArticleService.showOrderPackgeCode(params); -// System.out.println(orderPackgeCodeDataVO); -// } catch (Exception e) { -// e.printStackTrace(); -// } - List printPreviewVOS = distributionDeliveryListService.printBatch(ids,type); - - } - -} diff --git a/blade-service/logpm-distribution/src/test/java/com/logpm/distribution/TestService.java b/blade-service/logpm-distribution/src/test/java/com/logpm/distribution/TestService.java index d750cd869..57cddf2b1 100644 --- a/blade-service/logpm-distribution/src/test/java/com/logpm/distribution/TestService.java +++ b/blade-service/logpm-distribution/src/test/java/com/logpm/distribution/TestService.java @@ -1,14 +1,17 @@ package com.logpm.distribution; import com.logpm.distribution.service.IDistributionDeliveryListService; +import com.logpm.distribution.vo.print.PrintPreviewVO; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springblade.core.test.BladeBootTest; import org.springblade.core.test.BladeSpringExtension; import org.springframework.beans.factory.annotation.Autowired; +import java.util.List; + @ExtendWith(BladeSpringExtension.class) -@BladeBootTest(appName = "logpm-distribution", enableLoader = true) +@BladeBootTest(appName = "logpm-distribution-pref", enableLoader = true) public class TestService { @Autowired @@ -26,5 +29,15 @@ public class TestService { } + @Test + public void test3() throws Exception { + + List ls = distributionDeliveryListService.printBatch("1704390271891935233",2); + System.out.println(ls); + + + + } + }