diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/printTemplate/PrintTemplateStatusConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/printTemplate/PrintTemplateStatusConstant.java index d09956628..2527ae6ad 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/printTemplate/PrintTemplateStatusConstant.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/printTemplate/PrintTemplateStatusConstant.java @@ -8,7 +8,7 @@ package org.springblade.common.constant.printTemplate; */ public enum PrintTemplateStatusConstant { - daiqueren_1("配送任务打印模板","1"), + daiqueren_1("配送任务打印模板-市配","1"), daiqueren_2("配载计划打印模板","2"), daiqueren_3("运单票据打印模板","3"), daiqueren_4("托运单模板","4"), @@ -18,7 +18,8 @@ public enum PrintTemplateStatusConstant { daiqueren_8("货位码模板","8"), daiqueren_9("货架码模板","9"), daiqueren_10("包件模板","10"), - daiqueren_11("库存品包件模板","11"); + daiqueren_11("库存品包件模板","11"), + daiqueren_12("配送任务打印模板-商配","12"); /** diff --git a/blade-biz-common/src/main/java/org/springblade/common/utils/TemplateUtil.java b/blade-biz-common/src/main/java/org/springblade/common/utils/TemplateUtil.java index 702cf1183..aee484626 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/utils/TemplateUtil.java +++ b/blade-biz-common/src/main/java/org/springblade/common/utils/TemplateUtil.java @@ -28,24 +28,52 @@ public class TemplateUtil { * 通过远程URL地址获取模板 * 此方法可以通过URL加载存储在远程服务器上的模板 * - * @param template - * @param map - * @param url + * @param name 模板名称 + * @param map 填充内容 + * @param url 模板地址 * @return * @throws Exception */ - public static String getTemplateByUrl(String template, Map map, String url) throws Exception { + public static String getTemplateByUrl(String name, Map map, String url) throws Exception { Configuration cfg = new Configuration(Configuration.VERSION_2_3_30); ByteArrayTemplateLoader byteArrayTemplateLoader = new ByteArrayTemplateLoader(); InputStream initialStream = getInputStreamByGet(url); - byteArrayTemplateLoader.putTemplate(template, + byteArrayTemplateLoader.putTemplate(name, IOUtils.toByteArray(initialStream)); cfg.setTemplateLoader(byteArrayTemplateLoader); cfg.setDefaultEncoding("UTF-8"); cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); cfg.setLogTemplateExceptions(false); cfg.setClassicCompatible(true); - Template temp = cfg.getTemplate(template); + Template temp = cfg.getTemplate(name); + StringWriter stringWriter = new StringWriter(); + temp.process(map, stringWriter); + stringWriter.flush(); + stringWriter.close(); + String result = stringWriter.getBuffer().toString(); + return result; + } + + + /** + * 根据模板填充模板内容 + * @param name 模板名称 + * @param map 填充内容 + * @param temlate + * @return + * @throws Exception + */ + public static String popTemplate(String name, Map map, String temlate) throws Exception { + Configuration cfg = new Configuration(Configuration.VERSION_2_3_30); + ByteArrayTemplateLoader byteArrayTemplateLoader = new ByteArrayTemplateLoader(); + byteArrayTemplateLoader.putTemplate(name, + temlate.getBytes()); + cfg.setTemplateLoader(byteArrayTemplateLoader); + cfg.setDefaultEncoding("UTF-8"); + cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + cfg.setLogTemplateExceptions(false); + cfg.setClassicCompatible(true); + Template temp = cfg.getTemplate(name); StringWriter stringWriter = new StringWriter(); temp.process(map, stringWriter); stringWriter.flush(); diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataCarrierClient.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataCarrierClient.java index 7d6c0885d..546b5426b 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataCarrierClient.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataCarrierClient.java @@ -46,5 +46,6 @@ public interface IBasicdataCarrierClient { */ @GetMapping(TOP) BladePage top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); - + @GetMapping(API_PREFIX + "/getCarrierById") + BasicdataCarrierEntity getCarrierById(@RequestParam("current") Long carrierId); } diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataVehicleClient.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataVehicleClient.java index 5696f313f..f48e64e17 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataVehicleClient.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataVehicleClient.java @@ -48,4 +48,7 @@ public interface IBasicdataVehicleClient { @GetMapping(TOP) BladePage top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); + @GetMapping(API_PREFIX + "/getVehicleById") + BasicdataVehicleEntity getVehicleById(@RequestParam("id") Long id); + } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionAddvalueVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionAddvalueVO.java index 497bc719f..b8fe2ea6f 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionAddvalueVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionAddvalueVO.java @@ -51,5 +51,7 @@ public class DistributionAddvalueVO extends DistributionAddvalueEntity { private Double distance; + private Long addvalueDetailId; + } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionReservationVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionReservationVO.java index 42878c3f3..d2da34338 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionReservationVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionReservationVO.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; +import java.math.BigDecimal; import java.util.List; /** @@ -83,6 +84,26 @@ public class DistributionReservationVO extends DistributionReservationEntity { private String signingStatusName; + /** + * 仓库地址 + */ + @ApiModelProperty(value = "签收状态") + private String warehouseAddress; + + + /** + * 仓库经度 + */ + @ApiModelProperty(value = "签收状态") + private BigDecimal jingdu; + + /** + * 仓库纬度 + */ + @ApiModelProperty(value = "签收状态") + private BigDecimal weidu; + + /** diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataVehicleClient.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataVehicleClient.java index b95753049..01c808e64 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataVehicleClient.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataVehicleClient.java @@ -50,4 +50,9 @@ public class BasicdataVehicleClient implements IBasicdataVehicleClient { return BladePage.of(page); } + @Override + public BasicdataVehicleEntity getVehicleById(Long id) { + return basicdataVehicleService.getOneById(id); + } + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAreaMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAreaMapper.xml index 4843b1bd8..d4305e43b 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAreaMapper.xml +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAreaMapper.xml @@ -200,37 +200,23 @@ sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.xml index d77e49548..a051f1bf8 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvaluePackageMapper.xml @@ -32,10 +32,10 @@ - DELETE FROM logpm_diatribution_addvalue_package WHERE reservation_id = #{reservationId} and addvalue_detail_id = #{addvalueDetailId} + DELETE FROM logpm_distribution_addvalue_package WHERE reservation_id = #{reservationId} and addvalue_detail_id = #{addvalueDetailId} - DELETE FROM logpm_diatribution_addvalue_package WHERE reservation_id = #{reservationId} and package_id = #{packageId} + DELETE FROM logpm_distribution_addvalue_package WHERE reservation_id = #{reservationId} and package_id = #{packageId} + + + + + + + + + + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java index 0f0910523..23c790824 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java @@ -225,5 +225,7 @@ public interface IDistributionDeliveryListService extends BaseService printBatch(String ids,Integer type) throws Exception; + + void testData(String s) throws Exception; } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java index fbb5841f6..1ab59540a 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java @@ -84,6 +84,26 @@ public interface IDistributionReservationService extends BaseService getReservationAddr(String ids); + List getReservationAddr(String ids); /** * 批量转配送任务 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java index 089d69366..749ad9641 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java @@ -103,6 +103,17 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl packageListIds = distributionAppAddvalueDTO.getPackageListIds(); + Integer isManual = distributionAppAddvalueDTO.getIsManual(); + List collect1 = parcelListEntityList.stream().filter(p -> packageListIds.contains(p.getId())).collect(Collectors.toList()); + if (collect1.size() == 1 ){ + return Resp.scanFail("重复扫描", "重复扫描"); + } + List collect2 = detailEntities.stream().filter(i -> packageListIds.contains(i.getId())).collect(Collectors.toList()); + if (collect2.size() == 1 ){ + return Resp.scanFail("重复扫描", "重复扫描"); + } List packageInfo = parcelListEntityList.stream().filter(p -> p.getOrderPackageCode().equals(distributionAppAddvalueDTO.getBarcode())).collect(Collectors.toList()); // DistributionAddvaluePackageEntity distributionAddvaluePackageEntiy = new DistributionAddvaluePackageEntity(); if (Func.isNotEmpty(packageInfo) && packageInfo.size() == 1) { @@ -115,7 +126,10 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl getAllPackageList(DistributionAppAddvalueDTO distributionAppAddvalueDTO) { - List packageEntityList = distributionAppAddvalueDTO.getPackageEntityList(); +// List packageEntityList = distributionAppAddvalueDTO.getPackageEntityList(); + List packageListIds = distributionAppAddvalueDTO.getPackageListIds(); Long reservationId = distributionAppAddvalueDTO.getReservationId(); - List parcelListEntities = distributionReservationMapper.selectAppPackageListByReservationId(reservationId); - List detailEntities = distributionReservationMapper.selectAppInventoryListByReservation(reservationId); + List parcelListEntities = distributionReservationMapper.selectAppPackageListByReservationId(reservationId,packageListIds); + List detailEntities = distributionReservationMapper.selectAppInventoryListByReservation(reservationId,packageListIds); parcelListEntities.addAll(detailEntities); if (Func.isEmpty(parcelListEntities)) { log.error("################该客户下包件信息:{}", parcelListEntities); log.error("################该客户下库存品包件信息:{}", detailEntities); // return R.fail("服务器正忙...."); } - List entityList = null; - if (Func.isNotEmpty(packageEntityList)) { - entityList = parcelListEntities.stream().filter(p1 -> packageEntityList.stream().noneMatch(p2 -> p2.equals(p1.getId()))).collect(Collectors.toList()); - if (Func.isEmpty(entityList)) { - log.error("################该客户下库存品包件信息:{}", detailEntities); - log.error("################该客户下包件信息:{}", parcelListEntities); - } - } else { - entityList = parcelListEntities; + if (Func.isNotEmpty(parcelListEntities)){ + parcelListEntities.stream().forEach(p->{p.setRecordType("1");}); } +// List entityList = null; +// if (Func.isNotEmpty(packageEntityList)) { +// entityList = parcelListEntities.stream().filter(p1 -> packageEntityList.stream().noneMatch(p2 -> p2.equals(p1.getId()))).collect(Collectors.toList()); +// if (Func.isEmpty(entityList)) { +// log.error("################该客户下库存品包件信息:{}", detailEntities); +// log.error("################该客户下包件信息:{}", parcelListEntities); +// } +// } else { +// entityList = parcelListEntities; +// } - return entityList; + return parcelListEntities; } @Override + @Transactional public R updateAddvalueInfo(DistributionAppAddvalueDTO distributionAppAddvalueDTO) { List packageEntityList = distributionAppAddvalueDTO.getPackageEntityList(); + //这里需要查询出原来的增值服务项详情 DistributionAddvalueDetailEntity distributionAddvalueDetailEntity = new DistributionAddvalueDetailEntity(); +// DistributionAddvalueVO addvalueVO = distributionAddvalueMapper.selectReservationAddvalue(distributionAppAddvalueDTO.getReservationId(), distributionAppAddvalueDTO.getAddvalueType()); + DistributionAddvalueDetailEntity detailEntity = distributionAddvalueDetailMapper.selectById(distributionAppAddvalueDTO.getAddvalueDetailId()); + +// if (Func.isEmpty(distributionAppAddvalueDTO.getNum())) { +// return Resp.scanFail("添加失败", "错误的包件数量"); +// }else { +// distributionAddvalueDetailEntity.setNum(distributionAppAddvalueDTO.getNum()); +// } // 上楼 超区 平移 搬运 分拣 专车 switch (distributionAppAddvalueDTO.getAddvalueType()) { case "1": if (Func.isEmpty(distributionAppAddvalueDTO.getFloolNum())) { return Resp.scanFail("添加失败", "请输入楼层数"); } else { - distributionAddvalueDetailEntity.setFloolNum(distributionAppAddvalueDTO.getFloolNum()); + detailEntity.setFloolNum(distributionAppAddvalueDTO.getFloolNum()); } break; case "2": if (Func.isEmpty(distributionAppAddvalueDTO.getDistance())) { return Resp.scanFail("添加失败", "请输入超区公里数"); } else { - distributionAddvalueDetailEntity.setDistance(distributionAppAddvalueDTO.getDistance()); + detailEntity.setDistance(distributionAppAddvalueDTO.getDistance()); } break; case "3": if (Func.isEmpty(distributionAppAddvalueDTO.getDistance())) { return Resp.scanFail("添加失败", "请输入平移距离"); } else { - distributionAddvalueDetailEntity.setDistance(distributionAppAddvalueDTO.getDistance()); + detailEntity.setDistance(distributionAppAddvalueDTO.getDistance()); } break; case "4": + case "5": if (Func.isEmpty(distributionAppAddvalueDTO.getNum())) { return Resp.scanFail("添加失败", "请输入件数"); } else { - distributionAddvalueDetailEntity.setNum(distributionAppAddvalueDTO.getNum()); + detailEntity.setNum(distributionAppAddvalueDTO.getNum()); } break; -// case "5": -// if (Func.isEmpty(distributionAppAddvalueDTO.getNum())) { -// return Resp.scanFail("添加失败", "请输入件数"); -// } else { -// distributionAddvalueDetailEntity.setNum(distributionAppAddvalueDTO.getNum()); -// } -// break; case "6": if (Func.isEmpty(distributionAppAddvalueDTO.getFee())) { - return Resp.scanFail("添加失败", "请输入件数"); + return Resp.scanFail("添加失败", "错误的包件数量"); } else { - distributionAddvalueDetailEntity.setFee(distributionAppAddvalueDTO.getFee()); + detailEntity.setFee(distributionAppAddvalueDTO.getFee()); } break; default: return Resp.scanFail("添加失败", "服务器正忙"); } + distributionAddvalueDetailMapper.updateById(detailEntity); if (Func.isEmpty(packageEntityList) && packageEntityList.size() == 0) { //没有包件信息,对该增值服务进行清除 DistributionAddvalueEntity distributionAddvalueEntity = distributionAddvalueMapper.selectOne(Wrappers.query().lambda() @@ -329,7 +355,9 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl distributionAddvaluePackageEntities = distributionAddvaluePackageService.listByIds(Func.toLongList(packageListIds)); + List distributionAddvaluePackageEntities = distributionAddvaluePackageService.list(Wrappers.query().lambda() + .in(DistributionAddvaluePackageEntity::getPackageId,Func.toLongList(packageListIds)) + .eq(DistributionAddvaluePackageEntity::getAddvalueDetailId,distributionAppAddvalueDTO.getAddvalueDetailId())); Map> oldPackageList = distributionAddvaluePackageEntities.stream().collect(Collectors.groupingBy(DistributionAddvaluePackageEntity::getPackageId)); Map> newPackageList = packageEntityList.stream().collect(Collectors.groupingBy(DistributionAddvaluePackageEntity::getPackageId)); newPackageList.forEach((k, v) -> { @@ -343,7 +371,7 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl { //进行删除 @@ -362,13 +390,14 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl longs = Func.toLongList(packageListIds); - List distributionAddvaluePackageEntities = distributionAddvaluePackageService.listByIds(longs); - addvalueVO.setPackageEntityList(distributionAddvaluePackageEntities); + if (Func.isNotEmpty(addvalueVO)){ + String packageListIds = addvalueVO.getPackageListIds(); + if (Func.isNotEmpty(packageListIds)){ + List longs = Func.toLongList(packageListIds); + List distributionAddvaluePackageEntities = distributionAddvaluePackageService.list(Wrappers.query().lambda().in(DistributionAddvaluePackageEntity::getPackageId,longs).eq(DistributionAddvaluePackageEntity::getAddvalueDetailId,addvalueVO.getAddvalueDetailId())); + addvalueVO.setPackageEntityList(distributionAddvaluePackageEntities); + } } - return R.data(addvalueVO); } 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 3bb613fe1..da02acd8c 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 @@ -17,6 +17,8 @@ package com.logpm.distribution.service.impl; import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -28,7 +30,9 @@ import com.logpm.basic.entity.BasicPrintTemplateEntity; import com.logpm.basic.feign.IBasicPrintTemplateClient; import com.logpm.basicdata.entity.BasicdataDriverArteryEntity; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; +import com.logpm.basicdata.feign.IBasicdataCarrierClient; import com.logpm.basicdata.feign.IBasicdataDriverArteryClient; +import com.logpm.basicdata.feign.IBasicdataVehicleClient; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.distribution.bean.Resp; import com.logpm.distribution.dto.*; @@ -60,12 +64,15 @@ import org.springblade.common.constant.order.OrderStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageLoadingStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageReservationStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant; +import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant; import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant; import org.springblade.common.constant.reservation.*; import org.springblade.common.constant.stockup.StockAssignStatusConstant; import org.springblade.common.constant.stockup.StockupStatusConstant; +import org.springblade.common.exception.CustomerException; import org.springblade.common.serviceConstant.ServiceConstant; import org.springblade.common.utils.CommonUtil; +import org.springblade.common.utils.QRCodeUtil; import org.springblade.common.utils.TemplateUtil; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; @@ -84,6 +91,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; @@ -137,6 +145,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl selectDistributionDeliveryListPage(IPage page, DistributionDeliveryListDTO distributionDeliveryList) { @@ -218,7 +228,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl distributionStockupVOList = distributionStockupMapper.getMarketDeliveryStockupInfo(detail.getId()); //这里需要处理一下 if (distributionStockupVOList.size() > 1) { - Date outboundDate = distributionStockupVOList.stream().filter(o -> o.getOutboundDate() != null).max(Comparator.comparing(DistributionStockupVO::getOutboundDate)).get().getOutboundDate(); +// Date outboundDate = distributionStockupVOList.stream().filter(o -> o.getOutboundDate() != null).max(Comparator.comparing(DistributionStockupVO::getOutboundDate)).get().getOutboundDate(); HashSet forkliftName = new HashSet<>(); HashSet loaderName = new HashSet<>(); HashSet stockUser = new HashSet<>(); @@ -241,7 +251,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl customList = distributionDeliveryInfoMapper.selectAppcustomListPage(page, distributionDeliveryList.getId()); for (DistributionAppReservationVO distributionAppReservationVO : customList) { - //查询备货是否完成 - int aLong = distributionStockMapper.selectCount(new QueryWrapper().lambda() - .eq(DistributionStockEntity::getReservationId, distributionAppReservationVO.getId()) - .eq(DistributionStockEntity::getType, 1) - ).intValue(); - distributionAppReservationVO.setIsstock("是"); - distributionAppReservationVO.setIsload("是"); - if (aLong < distributionAppReservationVO.getReservationNum()) { + List parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppReservationVO.getId()); + List stockListDetailEntityList = distributionReservationMapper.selectInventoryListByReservation(distributionAppReservationVO.getId()); + boolean stockArticleStockupStatus = parcelListEntities.stream().allMatch(s -> Func.isNotEmpty(s.getOrderPackageStockupStatus()) && s.getOrderPackageStockupStatus().equals(OrderPackageStockupStatusConstant.yibeihu.getValue())); + boolean inventoryStockupStatus = stockListDetailEntityList.stream().allMatch(i -> Func.isNotEmpty(i.getStockPackageCode())); + if (stockArticleStockupStatus && inventoryStockupStatus ){ + distributionAppReservationVO.setIsstock("是"); + }else { distributionAppReservationVO.setIsstock("否"); } - if (distributionAppReservationVO.getLoadingNub() < distributionAppReservationVO.getReservationNum()) { + boolean stockArticleLoadingStatus = parcelListEntities.stream().allMatch(s -> Func.isNotEmpty(s.getOrderPackageLoadingStatus()) && s.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); + boolean inventoryLoadingStatus = stockListDetailEntityList.stream().allMatch(i -> Func.isNotEmpty(i.getStockPackageCode()) && i.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); + if (stockArticleLoadingStatus && inventoryLoadingStatus){ + distributionAppReservationVO.setIsload("是"); + }else { distributionAppReservationVO.setIsload("否"); + } + +// //查询备货是否完成 +// int aLong = distributionStockMapper.selectCount(new QueryWrapper().lambda() +// .eq(DistributionStockEntity::getReservationId, distributionAppReservationVO.getId()) +// .eq(DistributionStockEntity::getType, 1) +// ).intValue(); +// distributionAppReservationVO.setIsstock("是"); +// distributionAppReservationVO.setIsload("是"); +// if (aLong < distributionAppReservationVO.getReservationNum()) { +// distributionAppReservationVO.setIsstock("否"); +// } +// if (distributionAppReservationVO.getLoadingNub() < distributionAppReservationVO.getReservationNum()) { +// distributionAppReservationVO.setIsload("否"); +// } } return page.setRecords(customList); } @@ -2673,7 +2701,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl printBatch(String ids, Integer type) throws Exception { PrintPreviewVO printPreviewVO = new PrintPreviewVO(); - List data = new ArrayList<>(); - BasicPrintTemplateEntity template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_1.getValue()); - if (ObjectUtil.isEmpty(template)) { - throw new ServiceException("模板内容未找到"); - } - String html = TemplateUtil.getTemplateByUrl(template.getTemplateUrl()); - printPreviewVO.setTemplateHtml(html); - printPreviewVO.setTemplateId(template.getId()); + BasicPrintTemplateEntity template = getPrintTemplate(type); + String html = TemplateUtil.getTemplateByUrl(template.getTemplateUrl()); +// printPreviewVO.setTemplateHtml(html); +// printPreviewVO.setTemplateId(template.getId()); String[] idArray = ids.split(","); if (ObjectUtils.isNull(idArray)) { throw new ServiceException("参数错误"); + } + if (2 == type) { + return handleShiPeiData(template, idArray,html); + + + } else if (1 == type) { + return handleShangPeiData(template.getId(), idArray,html); + } else { + log.warn("###########printBatch: 未知的打印类型"); + throw new CustomerException(403, "未知的打印类型"); } + } + @Override + public void testData(String s) throws Exception { + String[] split = s.split(","); + handleShangPeiData(1111L, split,"111"); + } + + private List handleShangPeiData(Long templateId, String[] idArray,String html) throws Exception { + List result = new ArrayList<>(); + List> test = 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)){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("delivery_id",deliveryListEntityId); + DistributionDeliverySelfEntity deliverySelfEntity = distributionDeliverySelfService.getOne(queryWrapper); + dirverName = deliverySelfEntity.getDriverName(); + dirverPhone = deliverySelfEntity.getDriverPhone(); + carNumber = deliverySelfEntity.getVehicleNub(); + }else if("2".equals(kind)){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("delivery_id",deliveryListEntityId); + DistributionDeliveryTripartiteEntity deliveryTripartiteEntity = distributionDeliveryTripartiteService.getOne(queryWrapper); + dirverName = deliveryTripartiteEntity.getDriverName(); + dirverPhone = deliveryTripartiteEntity.getDriverPhone(); + carNumber = deliveryTripartiteEntity.getVehicleNum(); + } + + List distributionReservationEntityList = distributionReservationMapper.findByDeliveryId(deliveryListEntityId); + //循环查询出来的预约单 + for (DistributionReservationEntity reservationEntity:distributionReservationEntityList){ + Map map = new HashMap<>(); + map.put("配送单号", reservationEntity.getReservationCode()); + String fileTypeName = QRCodeUtil.createCodeToFile(reservationEntity.getReservationCode()); + map.put("配送单二维码",QRCodeUtil.getEmpAutograph(fileTypeName)); + map.put("收货单单位",reservationEntity.getReceivingUnit());//收货单单位 + map.put("商场名称",reservationEntity.getStoreName());//商场名称 + map.put("收货人",reservationEntity.getConsignee());//收货人 + map.put("收货人电话",reservationEntity.getDeliveryPhone());//收货人电话 + map.put("收货人地址",reservationEntity.getDeliveryAddress());//收货人地址 + map.put("配送时间",taskTime);//配送时间 + map.put("承运商",deliveryListEntity.getDistributionCompany()); + map.put("配送仓库",deliveryListEntity.getWarehouseName()); + map.put("出库时间",deliveryListEntity.getWarehouseName()); + map.put("送货司机",dirverName+"/"+dirverPhone); + map.put("车牌号",carNumber); + + Long reservationId = reservationEntity.getId();//预约id + //通过预约id查询所有包件并按三级品类分组 + List> categoryList = distributionReservationMapper.findAllCategoryNum(reservationId); + //计算一个总计 + Map total = new HashMap<>(); + Integer totalNum = 0; + for (Map m:categoryList){ + Set set = m.keySet(); + String categoryName = ""; + Long num = 0L; + for (String s:set){ + if("num".equals(s)){ + num = (Long)m.get(s); + totalNum = totalNum + num.intValue(); + }else{ + categoryName = (String)m.get(s); + } + } + total.put(categoryName,num); + } + total.put("合计件数",totalNum); + + + + //先查询预约单对应有哪些订单 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("reservation_id",reservationId); + List reservationStockarticleList = distributionReservationStockarticleService.list(queryWrapper); + List> ls = new ArrayList<>(); + BigDecimal totalPrice = BigDecimal.ZERO; + for (int i = 0; i < reservationStockarticleList.size(); i++) { + DistributionReservationStockarticleEntity reservationStockarticleEntity = reservationStockarticleList.get(i); + Long stockArticleId = reservationStockarticleEntity.getStockArticleId();//订单id + DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(stockArticleId); + if(Objects.isNull(stockArticleEntity)){ + log.warn("#########handleShangPeiData: 订单信息不存在 stockArticleId={}",stockArticleId); + throw new CustomerException(403,"订单信息不存在"); + } + + Map orderMap = new HashMap<>(); + orderMap.put("序号",i+1); + orderMap.put("运单号",stockArticleEntity.getWaybillNumber()); + orderMap.put("合同号",stockArticleEntity.getOrderCode()); + + //通过订单id和预约id查询对应包件的库位信息 + List allocationStrList = distributionReservationMapper.getAllocationByStockArticleIdAndReservationId(stockArticleId,reservationId); + String allocationStr = StringUtils.join(allocationStrList, ","); + orderMap.put("货位",allocationStr); + //通过订单id和预约id查询对应包件的备货区信息 + List stockupAreaStrList = distributionReservationMapper.getStockupAreaByStockArticleIdAndReservationId(stockArticleId,reservationId); + String stockupAreaStr = StringUtils.join(stockupAreaStrList, ","); + orderMap.put("备货区",stockupAreaStr); + + //查询当前订单的品类数量 + List> mapList = distributionReservationMapper.getCategoryByStockArticleIdAndReservationId(stockArticleId,reservationId); + Map numObj = new HashMap<>(); + Integer tn = 0; + Set set = total.keySet(); + for (String key:set){ + if(!"合计件数".equals(key)){ + numObj.put(key,0); + for (Map m:mapList){ + String thirdProduct = (String)m.get("thirdProduct"); + Long num = (Long)m.get("num"); + if(thirdProduct.equals(key)){ + numObj.put(key,num); + tn = tn + num.intValue(); + } + } + } + } + numObj.put("合计数量",tn); + orderMap.put("产品明细",numObj); + + //通过订单id和预约id查询对应包件的物料信息 + List materialNameStrList = distributionReservationMapper.getMaterialNameByStockArticleIdAndReservationId(stockArticleId,reservationId); + String materialNameStr = StringUtils.join(materialNameStrList, ","); + orderMap.put("物料名称",materialNameStr); + orderMap.put("到付运费",0);//todo 需要累加到totalPrice上 + ls.add(orderMap); + } + total.put("到付费用",totalPrice); + map.put("明细",ls); + map.put("合计",total); + test.add(map); + String popHtml =TemplateUtil.popTemplate("商配配配送单",map,html); + PrintPreviewVO printPreviewVO = new PrintPreviewVO(); + printPreviewVO.setTemplateId(templateId); + printPreviewVO.setTemplateHtml(popHtml); + result.add(printPreviewVO); + } + } + log.info("#############test: test={}",test); + String s = JSON.toJSONString(test); + JSONArray array= JSONArray.parseArray(JSON.toJSONString(test)); + return result; + } - Map map = new HashMap<>(); + /** + * 得到填充内容 + * @param template + * @param idArray + * @param html + * @return + * @throws Exception + */ + private List handleShiPeiData(BasicPrintTemplateEntity template, String[] idArray,String html) throws Exception { + + List result = new ArrayList<>(); + List data = new ArrayList<>(); + for (String id : idArray) { + + // 获取需要的数据 DistributionDeliveryListEntity byId = this.getById(id); + if (ObjectUtils.isNull(byId)) { + throw new ServiceException("未找到相关数据"); + } //查询这个配送下面的预约单 - List distributionReservationEntityList = distributionReservationMapper.findByDeliveryId(byId.getId()); - for (DistributionReservationEntity distributionReservationEntity : distributionReservationEntityList) { + if (distributionReservationEntityList.isEmpty()) { + throw new ServiceException("未找到相关数据"); + } + for (DistributionReservationEntity distributionReservationEntity : distributionReservationEntityList) { + Map map = new HashMap<>(); + log.debug(">>>> distributionReservationEntity {}",distributionReservationEntity); map.put("配送单号", distributionReservationEntity.getReservationCode()); - // todo 商场电话是否需要查询商场信息得到电话 + String fileTypeName = QRCodeUtil.createCodeToFile(distributionReservationEntity.getReservationCode()); + map.put("配送单二维码",QRCodeUtil.getEmpAutograph(fileTypeName)); + + // todo 查询运单的收货人电话 + map.put("商场名称", distributionReservationEntity.getMallName()); map.put("商场电话", distributionReservationEntity.getReservationCode()); map.put("送货日期", DateUtil.format(distributionReservationEntity.getReservationDate(), "yyyy-MM-dd") + " 全天"); @@ -3201,44 +3414,52 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl> spaclOrderList = buildSpaclOrders(distributionReservationEntity, 1); - + List> spaclOrderList = buildSpaclOrders(distributionReservationEntity, 1); map.put("定制品集合", spaclOrderList); - map.put("备注", distributionReservationEntity.getRemarks()); - - + map.put("送货司机", byId.getVehicleName() + "/" + byId.getDriverName()); + data.add(map); + String popHtml =TemplateUtil.popTemplate("市配配送单",map,html); + PrintPreviewVO printPreviewVO = new PrintPreviewVO(); + printPreviewVO.setTemplateId(template.getId()); + printPreviewVO.setTemplateHtml(popHtml); + result.add(printPreviewVO); } - - - map.put("送货司机", byId.getTrainNumber() + "/" + byId.getDriverName()); - - - data.add(map); - - } + return result; + } - return printPreviewVO; + private BasicPrintTemplateEntity getPrintTemplate(Integer type) { + BasicPrintTemplateEntity template = null; + if (2 == type) { + template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_1.getValue()); + } else if (1 == type) { + template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_12.getValue()); + } + if (ObjectUtil.isEmpty(template)) { + throw new ServiceException("模板内容未找到"); + } + return template; } + /** * 构建预约单下面的订单信息 * - * @param id 预约单ID + * @param distributionReservationEntity 预约单 * @param i 构建类型 1 表示订单 2 表示库存品 * @return List */ - private List> buildSpaclOrders(DistributionReservationEntity distributionReservationEntity, int i) { + private List> buildSpaclOrders(DistributionReservationEntity distributionReservationEntity, int i) { List distributionReservationStocklistEntities; List distributionReservationStockarticleEntityList; - List> result = new ArrayList<>(); + List> result = new ArrayList<>(); switch (i) { case 1: // 订单 @@ -3247,17 +3468,18 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl temp = new HashMap<>(); + Map temp = new HashMap<>(); DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleMapper.selectById(distributionReservationStockarticleEntity.getStockArticleId()); - temp.put("合同号",distributionStockArticleEntity.getOrderCode()); - temp.put("产品名称",distributionStockArticleEntity.getDescriptionGoods()); + temp.put("合同号", distributionStockArticleEntity.getOrderCode()); + temp.put("产品名称", distributionStockArticleEntity.getDescriptionGoods()); //todo 单位是否需要查询物料表 - temp.put("单位","件"); - temp.put("数量",distributionReservationStockarticleEntity.getReservationNum()); - temp.put("备货区",null); + temp.put("单位", "件"); + temp.put("数量", distributionReservationStockarticleEntity.getReservationNum()); + temp.put("备货区", null); //todo 这里还没完成 + temp.put("货位", null); result.add(temp); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java index 81129a74a..3813feef4 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java @@ -462,8 +462,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl getReservationAddr(String ids) { + public List getReservationAddr(String ids) { if (Func.isBlank(ids)) { return null; } - String[] split = ids.split(","); - List distributionReservationVOS = new ArrayList<>(); - if (split.length == 1) { - DistributionReservationEntity reservationEntity = this.getBaseMapper().selectById(ids); - distributionReservationVOS.add(reservationEntity); - } else { - for (String s : split) { - DistributionReservationEntity reservationEntity = this.getBaseMapper().selectById(s); - distributionReservationVOS.add(reservationEntity); + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + List reservationVOList = null; + if (Func.isNotEmpty(myCurrentWarehouse)){ + List longs = Func.toLongList(ids); + List reservationEntityList = this.listByIds(longs); + reservationVOList = DistributionReservationWrapper.build().listVO(reservationEntityList); + BasicdataWarehouseEntity entityWarehouseId = warehouseClient.getEntityWarehouseId(reservationVOList.get(0).getWarehouseId()); + if (Func.isNotEmpty(entityWarehouseId)){ + reservationVOList.stream().forEach(r->{r.setJingdu(entityWarehouseId.getLongitude());r.setWeidu(entityWarehouseId.getLatitude());}); } } - Page distributionReservationVOPage = new Page<>(); - Page resultPage = distributionReservationVOPage.setRecords(distributionReservationVOS); - return resultPage; + +// String[] split = ids.split(","); +// +// List distributionReservationVOS = new ArrayList<>(); +// if (split.length == 1) { +// DistributionReservationEntity reservationEntity = this.getBaseMapper().selectById(ids); +// distributionReservationVOS.add(reservationEntity); +// } else { +// for (String s : split) { +// DistributionReservationEntity reservationEntity = this.getBaseMapper().selectById(s); +// distributionReservationVOS.add(reservationEntity); +// } +// } + + return reservationVOList; } @Override @@ -695,9 +777,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl 1) { // distributionDeliveryListEntity.setOrderId(orderIds.deleteCharAt(orderIds.length() - 1).toString()); // } @@ -1303,7 +1385,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl params = new HashMap<>(); - params.put("ids","1686560469635727362"); - try { - OrderPackgeCodeDataVO orderPackgeCodeDataVO =distributionStockArticleService.showOrderPackgeCode(params); - System.out.println(orderPackgeCodeDataVO); - } catch (Exception e) { - e.printStackTrace(); - } +// 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 new file mode 100644 index 000000000..d750cd869 --- /dev/null +++ b/blade-service/logpm-distribution/src/test/java/com/logpm/distribution/TestService.java @@ -0,0 +1,30 @@ +package com.logpm.distribution; + +import com.logpm.distribution.service.IDistributionDeliveryListService; +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; + +@ExtendWith(BladeSpringExtension.class) +@BladeBootTest(appName = "logpm-distribution", enableLoader = true) +public class TestService { + + @Autowired + private IDistributionDeliveryListService distributionDeliveryListService; + + @Test + public void test2() throws Exception { + +// List printPreviewVOS = distributionDeliveryListService.printBatch("1703958397055135745", 1); + + + distributionDeliveryListService.testData("1703958397055135745"); + + System.out.println(111111); + + } + +} + diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseGoodsAllocationServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseGoodsAllocationServiceImpl.java index 0f529aa04..0654dd1fa 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseGoodsAllocationServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseGoodsAllocationServiceImpl.java @@ -107,6 +107,7 @@ public class WarehouseGoodsAllocationServiceImpl extends BaseServiceImpl()); // } WarehouseGoodsAllocationVO warehouseGoodsAllocationVO = this.convert(warehouseGoodsAllocationEntity); + log.info("List>>>>>>>>>>>>>>>>>{}",warehouseGoodsAllocationVO); // map.get(layerNum).add(warehouseGoodsAllocationVO); warehouseGoodsAllocationVOS.add(warehouseGoodsAllocationVO); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java index f6f0b554f..11d9ed2a6 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java @@ -110,7 +110,7 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl detailEntityList = new ArrayList<>(); List list1 = warehouseWarehousingDetailService.list(Wrappers.query().lambda() .eq(WarehouseWarehousingDetailEntity::getWarehousingEntryId, warehouseWarehousingEntry.getId()) - .apply("conditions in ( 1,2) ") + .apply("conditions in (1,2) ") );//查询不是确定的数据 if(list1.size() > 0){ AtomicReference num = new AtomicReference<>(0); diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseStockVOWrapper.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseStockVOWrapper.java index 2c3e3043d..18d97eb56 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseStockVOWrapper.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseStockVOWrapper.java @@ -42,7 +42,9 @@ public class WarehouseStockVOWrapper extends BaseEntityWrapper