Browse Source

Merge remote-tracking branch 'origin/pre-production'

master
zhenghaoyu 1 month ago
parent
commit
f0badf3d00
  1. 1
      blade-biz-common/src/main/java/org/springblade/common/constant/printTemplate/PrintTemplateStatusConstant.java
  2. 2
      blade-biz-common/src/main/java/org/springblade/common/utils/GaoDeApiUtil.java
  3. 4
      blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/feign/IExpenseDispatchClient.java
  4. 47
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java
  5. 7
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/job/ExpenseJob.java
  6. 27
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java
  7. 3
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java
  8. 85
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java
  9. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingServiceImpl.java

1
blade-biz-common/src/main/java/org/springblade/common/constant/printTemplate/PrintTemplateStatusConstant.java

@ -24,6 +24,7 @@ public enum PrintTemplateStatusConstant {
daiqueren_14("订单模版","15"),
wallbill_1("运单打印模板","16"),
stock_import_1("库存品入库模块","17"),
zero_label_18("零担标签模版","18"),
daiqueren_1("配送任务打印模板-市配","1");
/**

2
blade-biz-common/src/main/java/org/springblade/common/utils/GaoDeApiUtil.java

@ -85,6 +85,7 @@ public class GaoDeApiUtil {
* @Author zqb 2024/9/14
**/
public static Long measureDistance(String origins, String destination) {
// 计算距离服务高德每秒钟只能接收3次,需要评估每秒请求次数
// lat 小 log 大
String key = "40448f21dfc7a531e9db4c405d955bea";
String urlString = "https://restapi.amap.com/v3/distance?key=" + key + "&origins=" + origins + "&destination=" + destination;
@ -102,6 +103,7 @@ public class GaoDeApiUtil {
in.close();
// 解析结果
JSONObject jsonObject = JSONObject.parseObject(res);
log.info("根据经纬度测量路径获取成功:{}", jsonObject.toJSONString());
JSONArray results = jsonObject.getJSONArray("results");
if (CollUtil.isNotEmpty(results)) {
return results.getJSONObject(0).getLong("distance");

4
blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/feign/IExpenseDispatchClient.java

@ -25,8 +25,8 @@ public interface IExpenseDispatchClient {
void saveTrainDetailEntity(@RequestBody ExpenseDispatchTrainDetailEntity entity);
@PostMapping(API_PREFIX + "/saveDispatchOrderDetailEntity")
void saveDispatchOrderDetailEntity(ExpenseDispatchOrderDetailEntity orderDetailEntity);
void saveDispatchOrderDetailEntity(@RequestBody ExpenseDispatchOrderDetailEntity orderDetailEntity);
@PostMapping(API_PREFIX + "/saveWarehouseOrderEntity")
void saveWarehouseOrderEntity(ExpenseWarehouseOrderEntity orderDetailEntity);
void saveWarehouseOrderEntity(@RequestBody ExpenseWarehouseOrderEntity orderDetailEntity);
}

47
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java

@ -80,7 +80,18 @@ public class DeliverFinishReportListener implements ReportService {
FinishDistributionTrainVO vo = JSONUtil.toBean(entries, FinishDistributionTrainVO.class);
String trainNumber = vo.getTrainNumber();
String deliveryKind = vo.getDeliveryKind();
calculateTripCost(trainNumber, deliveryKind);
Map<String, TrunklineWaybillOrderEntity> waybillOrderMap = calculateTripCost(trainNumber, deliveryKind);
// 生成订单 发送延时消息生成报表
if (CollUtil.isNotEmpty(waybillOrderMap)) {
for (Map.Entry<String, TrunklineWaybillOrderEntity> entityEntry : waybillOrderMap.entrySet()) {
factoryDataClient.sendMessage(SendMsg.builder()
.exchange(ReportConstants.REPORT_EXPENSE_ORDER_EXCHANGE)
.routingKey(ReportConstants.REPORT_EXPENSE_ORDER_ROUTINGKEY)
.message(JSONUtil.toJsonStr(entityEntry.getValue()))
.delay(10000)
.build());
}
}
// 生成车辆车次成本 发送延时消息生成报表
factoryDataClient.sendMessage(SendMsg.builder()
.exchange(ReportConstants.REPORT_QUALITY_CAR_FINAL_EXCHANGE)
@ -92,7 +103,7 @@ public class DeliverFinishReportListener implements ReportService {
}
public void calculateTripCost(String trainNumber, String deliveryKindParam) {
public Map<String, TrunklineWaybillOrderEntity> calculateTripCost(String trainNumber, String deliveryKindParam) {
// 根据车次查询出包件明细,然后计算对应的成本
List<QualityDeliverEntity> entities = qualityDeliverService.list(Wrappers.<QualityDeliverEntity>lambdaQuery()
.eq(QualityDeliverEntity::getSignTrainNumber, trainNumber)
@ -142,7 +153,7 @@ public class DeliverFinishReportListener implements ReportService {
for (QualityDeliverEntity qualityDeliverEntity : value) {
QualityDeliverEntity entity = new QualityDeliverEntity();
entity.setId(qualityDeliverEntity.getId());
if(ObjectUtil.isEmpty(entity.getCarComplateTime())){
if(ObjectUtil.isEmpty(qualityDeliverEntity.getCarComplateTime())){
entity.setCarComplateTime(new Date());
}
entity.setOrderCode(qualityDeliverEntity.getOrderCode());
@ -381,6 +392,7 @@ public class DeliverFinishReportListener implements ReportService {
String key = allEntry.getKey();
lastCode = key;
if (StrUtil.isNotEmpty(allEntry.getValue())) {
log.info("公里数成本 总公里数:{},{}",key, allEntry.getValue());
total = NumberUtil.add(total, new BigDecimal(allEntry.getValue()));
}
}
@ -391,6 +403,7 @@ public class DeliverFinishReportListener implements ReportService {
if (CollUtil.isNotEmpty(firstRouteMap)) {
String s = firstRouteMap.get(lastCode);
if (StrUtil.isNotEmpty(s)) {
log.info("公里数成本 返程公里数:{}", s);
total = total.add(new BigDecimal(s));
}
}
@ -908,23 +921,13 @@ public class DeliverFinishReportListener implements ReportService {
waybillOrderMap.put(key, waybillOrderEntity);
}
}
// 生成订单 发送延时消息生成报表
if (CollUtil.isNotEmpty(waybillOrderMap)) {
for (Map.Entry<String, TrunklineWaybillOrderEntity> entityEntry : waybillOrderMap.entrySet()) {
factoryDataClient.sendMessage(SendMsg.builder()
.exchange(ReportConstants.REPORT_EXPENSE_ORDER_EXCHANGE)
.routingKey(ReportConstants.REPORT_EXPENSE_ORDER_ROUTINGKEY)
.message(JSONUtil.toJsonStr(entityEntry.getValue()))
.delay(10000)
.build());
}
}
return waybillOrderMap;
}
}
}
}
}
return null;
}
private static BigDecimal buildDisCost(QualityDeliverEntity entity, ExpenseDispatchPriceCategoryVO expenseDispatchPriceCategoryVO, QualityDeliverEntity entity1, BigDecimal totalFreight) {
@ -1036,6 +1039,7 @@ public class DeliverFinishReportListener implements ReportService {
private static void buildKilometerCost(ExpenseDispatchPriceVO priceVO, BigDecimal total, Map<Long, QualityDeliverEntity> valueMap, Integer totalNum) {
String kilometerCost = StrUtil.isEmpty(priceVO.getKilometerCost()) ? "0" : priceVO.getKilometerCost();
BigDecimal mul = NumberUtil.mul(total, new BigDecimal(kilometerCost));
log.info("公里数成本:{},{},{}", kilometerCost, Convert.toStr(total), Convert.toStr(mul));
BigDecimal deliveryFeeSum = BigDecimal.ZERO;
int idex = 0;
int size = valueMap.size();
@ -1097,16 +1101,25 @@ public class DeliverFinishReportListener implements ReportService {
if (StrUtil.isNotEmpty(arrivePositioning)) {
// A-B A-C A-D 仓库为起点到每一个点的距离
Long first = GaoDeApiUtil.measureDistance(firstPositioning, arrivePositioning);
log.info("点位计算结果 first:{}", first);
firstRouteMap.put(value1.getSignReservationCode(), Convert.toStr(ObjectUtil.isNotEmpty(first) ? NumberUtil.div(new BigDecimal(first), 1000) : 0L / 1000));
if (StrUtil.isEmpty(beforePositioning)) {
beforePositioning = firstPositioning;
}
// 等500毫秒再次调用
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
// A-B B-C C-D 每一个点为起点到下一个点的距离
Long distance = GaoDeApiUtil.measureDistance(beforePositioning, arrivePositioning);
log.info("点位计算结果 distance:{}", distance);
String str = Convert.toStr(ObjectUtil.isNotEmpty(distance) ? NumberUtil.div(new BigDecimal(distance), 1000) : 0L / 1000);
// 获取上一个点位的总距离
reduce = NumberUtil.add(reduce, new BigDecimal(str));
allRouteMap.put(value1.getSignReservationCode(), Convert.toStr(reduce));
// reduce = NumberUtil.add(reduce, new BigDecimal(str));
// allRouteMap.put(value1.getSignReservationCode(), Convert.toStr(reduce));
allRouteMap.put(value1.getSignReservationCode(), str);
beforePositioning = arrivePositioning;
}
}

7
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/job/ExpenseJob.java

@ -144,7 +144,11 @@ public class ExpenseJob {
if (CollUtil.isNotEmpty(qualityDeliverEntities)) {
for (QualityDeliverEntity entity : qualityDeliverEntities) {
if (StrUtil.isEmpty(entity.getOrderCode()) || StrUtil.isEmpty(entity.getWaybillNumber())) {
log.info("订单或运单为空,不生成订单总成本报表:id = {}", entity.getId());
log.info("dayWarehouseExpenseJob 订单或运单为空,不生成订单总成本报表:id = {}", entity.getId());
continue;
}
if (ObjectUtil.isEmpty(entity.getSignNum())) {
log.info("dayWarehouseExpenseJob 签收数量为空:{}, {}", entity.getOrderCode(), entity.getWaybillNumber());
continue;
}
String key = entity.getOrderCode() + entity.getWaybillNumber();
@ -367,6 +371,7 @@ public class ExpenseJob {
//
return ReturnT.SUCCESS;
}
/**
* 月度配送成本报表
*

27
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java

@ -1966,4 +1966,31 @@ public class OpenOrderController {
}
@ResponseBody
@PostMapping("/findZeroWaybillLabelInfo")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "查询零担运单标签信息", notes = "传入openOrderDTO")
public R findZeroWaybillLabelInfo(@RequestBody OpenOrderDTO openOrderDTO) {
String method = "############findZeroWaybillLabelInfo: ";
log.info(method + "请求参数{}", openOrderDTO);
String waybillNo = openOrderDTO.getWaybillNo();
try {
if (StringUtil.isBlank(waybillNo)) {
log.warn(method + "运单号不能为空 waybillNo={}", waybillNo);
return R.fail(405, "运单号不能为空");
}
return openOrderService.findZeroWaybillLabelInfo(openOrderDTO);
} catch (CustomerException e) {
log.error(e.message, e);
return R.fail(e.code, e.message);
} catch (Exception e) {
log.error(method + "系统异常", e);
return R.fail(500, "系统异常");
}
}
}

3
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java

@ -113,5 +113,8 @@ public interface IOpenOrderService {
void patchCheckWaybill(String waybillNo);
R findZeroWaybillLabelInfo(OpenOrderDTO openOrderDTO) throws Exception;
// R findWaybillInfo(String waybillNo);
}

85
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

@ -12,7 +12,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.logpm.basic.entity.BasicMaterialEntity;
import com.logpm.basic.entity.BasicPrintTemplateEntity;
import com.logpm.basic.feign.IBasicMaterialClient;
import com.logpm.basic.feign.IBasicPrintTemplateClient;
import com.logpm.basicdata.entity.*;
import com.logpm.basicdata.feign.*;
import com.logpm.basicdata.vo.BasicdataClientVO;
@ -54,6 +56,7 @@ import org.springblade.common.constant.IncomingTypeEnum;
import org.springblade.common.constant.WorkNodeEnums;
import org.springblade.common.constant.broadcast.FanoutConstants;
import org.springblade.common.constant.order.*;
import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant;
import org.springblade.common.enums.BizOperationEnums;
import org.springblade.common.enums.PackageTypeEnums;
import org.springblade.common.exception.CustomerException;
@ -61,6 +64,8 @@ import org.springblade.common.model.FanoutMsg;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.PackageData;
import org.springblade.common.utils.CommonUtil;
import org.springblade.common.utils.QRCodeUtil;
import org.springblade.common.utils.TemplateUtil;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
@ -128,6 +133,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
private final IWarehouseWaybillAbolishClient waybillAbolishClient;
private final IWarehouseWaybillDetailAbolishClient waybillDetailAbolishClient;
private final IPackageTrackLogAsyncService packageTrackLogAsyncService;
private final IBasicPrintTemplateClient basicPrintTemplateClient;
@Override
@ -228,6 +234,64 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
}
@Override
public R findZeroWaybillLabelInfo(OpenOrderDTO openOrderDTO) throws Exception {
String waybillNo = openOrderDTO.getWaybillNo();
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo);
if(Objects.isNull(waybillEntity)){
log.warn("################findZeroWaybillLabelInfo: 运单信息不存在 waybillNo={}",waybillNo);
return R.fail(405,"运单信息不存在");
}
List<WarehouseWayBillDetail> wayBillDetailList = warehouseWaybillDetailClient.findListByWaybillNo(waybillNo);
BasicPrintTemplateEntity template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.zero_label_18 .getValue());
if (org.springblade.core.tool.utils.ObjectUtil.isEmpty(template)) {
log.warn("################findZeroWaybillLabelInfo: 未找到模版 waybillNo={}",waybillNo);
return R.fail(405,"未找到模版");
}
String html = TemplateUtil.getTemplateByUrl(template.getTemplateUrl());
Map<String,Object> map = new HashMap<>();
map.put("waybillNo",waybillNo);
map.put("orderNo",waybillEntity.getOrderNo());
map.put("createDate",CommonUtil.dateToStringGeneral(waybillEntity.getCreateTime()));
map.put("departureWarehouseName",waybillEntity.getDepartureWarehouseName());
map.put("destinationWarehouseName",waybillEntity.getDestinationWarehouseName());
map.put("destination",waybillEntity.getDestination());
map.put("departure",waybillEntity.getDeparture());
map.put("totalCount",waybillEntity.getTotalCount());
map.put("totalWeight",waybillEntity.getTotalWeight());
map.put("total_volume",waybillEntity.getTotalVolume());
map.put("shipper",waybillEntity.getShipper());
map.put("shipperName",waybillEntity.getShipperName());
map.put("shipperMobile",waybillEntity.getShipperName());
map.put("shipperAddress",waybillEntity.getShipperAddress());
map.put("consignee",waybillEntity.getConsignee());
map.put("consigneeName",waybillEntity.getConsigneeName());
map.put("consigneeMobile",waybillEntity.getConsigneeMobile());
map.put("consigneeAddress",waybillEntity.getConsigneeAddress());
String fileTypeName = QRCodeUtil.createCodeToFile(waybillNo);
String image = QRCodeUtil.getEmpAutograph(fileTypeName);
map.put("waybillNoCode",image);
map.put("delivery_way",DictBizCache.getValue(DictBizConstant.OPEN_ORDER_DELIVERY_WAY,waybillEntity.getDeliveryWay()));
map.put("waybillNoCode",image);
List<Map<String,Object>> detailList = new ArrayList<>();
wayBillDetailList.forEach(item->{
Map<String,Object> m = new HashMap<>();
m.put("productName",item.getProductName());
m.put("num",item.getNum());
detailList.add(m);
});
map.put("detailList",detailList);
map.put("template",html);
return R.data(map);
}
@Override
public List<TrunklineAdvanceDetailVO> findAdvanceDetailList(Long advanceId) {
return advanceDetailService.findList(advanceId);
@ -1216,6 +1280,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
Map<String, Object> map = new HashMap<>();
map.put("waybillId", waybillId);
map.put("waybillNo", waybillNo);
return R.data(map);
}
@ -5614,7 +5679,23 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail();
warehouseWayBillDetail.setWaybillNo(waybillEntity.getWaybillNo());
warehouseWayBillDetail.setWaybillId(waybillEntity.getId());
warehouseWayBillDetail.setProductId(waybillDetailDTO.getGoodsId());
Long goodsId = waybillDetailDTO.getGoodsId();
if (Objects.isNull(goodsId)) {
//如果品名id没有就先通过goodsName查寻,没有就新增
BasicdataCategoryEntity basicdataCategoryEntity = basicdataCategoryClient.findByName(goodsName);
if (Objects.isNull(basicdataCategoryEntity)) {
basicdataCategoryEntity = new BasicdataCategoryEntity();
basicdataCategoryEntity.setName(goodsName);
basicdataCategoryEntity.setType("1");
goodsId = basicdataCategoryClient.addReturnId(basicdataCategoryEntity);
} else {
goodsId = basicdataCategoryEntity.getId();
}
}
warehouseWayBillDetail.setProductId(goodsId);
warehouseWayBillDetail.setProductName(waybillDetailDTO.getGoodsName());
warehouseWayBillDetail.setChargeType(waybillDetailDTO.getChargeType());
warehouseWayBillDetail.setNum(waybillDetailDTO.getNum());
@ -5622,6 +5703,8 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
warehouseWayBillDetail.setWeight(waybillDetailDTO.getWeight());
warehouseWayBillDetail.setPrice(waybillDetailDTO.getPrice());
warehouseWayBillDetail.setSubtotalFreight(waybillDetailDTO.getSubtotalFreight());
warehouseWayBillDetail.setDeliveryPrice(waybillDetailDTO.getDeliveryPrice());
warehouseWayBillDetail.setSubtotalDeliveryFee(waybillDetailDTO.getSubtotalDeliveryFee());
warehouseWayBillDetail.setPickupPrice(waybillDetailDTO.getPickupPrice());
warehouseWayBillDetail.setFreightPrice(waybillDetailDTO.getFreightPrice());
warehouseWayBillDetail.setSystemChargeType(waybillDetailDTO.getChargeType());

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingServiceImpl.java

@ -435,6 +435,8 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl<TrunklineBil
updateEntity.setBillladingStatus(billladingEntity.getBillladingStatus());
updateEntity.setEndTime(billladingEntity.getEndTime());
stringBuffer.append(",提货中变更为提货完成");
billladingWaybillService.updateBillladingFeeByBillladingId(billladingEntity);
} else {
log.warn("##################updateBillladingStatus: 提货单不能更新为已完成 billladingStatus={}", billladingStatus);
throw new CustomerException(405, "提货单不能更新为已完成");

Loading…
Cancel
Save