Commit e23ba12e authored by lanbaoming's avatar lanbaoming

2024-06-18-2提交

parent b525c1de
......@@ -24,7 +24,11 @@ public class BmpShipmentBatchAddPriceListener extends BpmProcessInstanceResultEv
@Override
protected void onEvent(BpmProcessInstanceResultEvent event) {
log.info("---------------------批量加价审核回调-----------------------{},{}", event.getBusinessKey(), event.getResult());
boxApprovalService.updateBoxApproveResult(WorkFlowEmus.SHIPMENT_BATCH_ADD_PRICE.getKey(), event.getBusinessKey(), event.getResult());
log.info("---------------------批量加价审核回调-----------------------{},{}",
event.getBusinessKey(), event.getResult());
//lanbm 2024-06-18 改为空运和海运都有此逻辑点
boxApprovalService.updateBoxApproveResult(
WorkFlowEmus.SHIPMENT_BATCH_ADD_PRICE.getKey(),
event.getBusinessKey(), event.getResult());
}
}
......@@ -574,28 +574,174 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
return orderExceptionCreateReqVO;
}
//lanbm 2024-06-18 添加的逻辑日志记录
private void saveLog(Collection<Long> orderIds,
BigDecimal freightFee,
Integer freightCurrencyId,
Long freightUnitId,
BigDecimal clearanceFee,
Integer clearanceCurrencyId,
Long clearanceUnitId) {
String s = "";
if (freightFee == null) {
s += "freightFee 为空";
} else {
s += "freightFee= " + freightFee.toString();
}
if (freightCurrencyId == null) {
s += "freightCurrencyId 为空";
} else {
s += "freightCurrencyId=" + freightCurrencyId.toString();
}
if (freightUnitId == null) {
s += "freightUnitId 为空";
} else {
s += "freightUnitId=" + freightUnitId.toString();
}
//清关费
if (clearanceFee == null) {
s += "clearanceFee 为空";
} else {
s += "clearanceFee=" + clearanceFee.toString();
}
if (clearanceCurrencyId == null) {
s += "clearanceCurrencyId 为空";
} else {
s += "clearanceCurrencyId=" + clearanceCurrencyId;
}
if (clearanceUnitId == null) {
s += "clearanceUnitId 为空";
} else {
s += "clearanceUnitId=" + clearanceUnitId.toString();
}
zTest z = new zTest();
z.setTestname("逻辑参数为:" + s);
z.setCreatedate(new Date());
zTestMapper.insert(z);
}
//记录逻辑日志 lanbm 2024-06-18 add
private String getLog(OrderItemDO it, BigDecimal freightFee,
Integer freightCurrencyId,
Long freightUnitId) {
String sR = "";
if (it == null) {
sR += "OrderItemDO 为空";
}
if (Objects.isNull(freightFee)) {
sR += " freightFee为空";
return sR;
}
if (Objects.isNull(freightCurrencyId)) {
sR += " freightCurrencyId 为空";
return sR;
}
if (Objects.isNull(freightUnitId)) {
sR += " freightUnitId 为空";
return sR;
}
if (it.getSeaFreightCurrency() == null) {
sR += " it.getSeaFreightCurrency 为空";
return sR;
}
if (freightCurrencyId.equals(it.getSeaFreightCurrency())) {
sR += " freightCurrencyId=it.getSeaFreightCurrency";
} else {
sR += " freightCurrencyId"+freightCurrencyId
+"<>it.getSeaFreightCurrency"+it.getSeaFreightCurrency();
return sR;
}
if (it.getSeaFreightVolume() == null) {
sR += " it.getSeaFreightVolume为空";
return sR;
}
if (freightUnitId.equals(it.getSeaFreightVolume())) {
sR+="freightUnitId=it.getSeaFreightVolume";
} else {
sR+="freightUnitId"+freightUnitId+"<>it.getSeaFreightVolume"+
it.getSeaFreightVolume();
}
return sR;
}
@Override
public void handleAirOrderBatchMarkup(Collection<Long> orderIds, BigDecimal freightFee, Integer freightCurrencyId, Long freightUnitId,
BigDecimal clearanceFee, Integer clearanceCurrencyId, Long clearanceUnitId) {
public void handleAirOrderBatchMarkup(Collection<Long> orderIds,
BigDecimal freightFee,
Integer freightCurrencyId,
Long freightUnitId,
BigDecimal clearanceFee,
Integer clearanceCurrencyId,
Long clearanceUnitId) {
//lanbm 2024-06-18 添加的逻辑日志记录
saveLog(orderIds,
freightFee,
freightCurrencyId,
freightUnitId,
clearanceFee,
clearanceCurrencyId,
clearanceUnitId);
for (Long orderId : orderIds) {
OrderDO orderDO = orderMapper.selectById(orderId);
if (Objects.isNull(orderDO)) {
throw exception(ORDER_NOT_EXISTS);
}
OrderConsignorDO orderConsignorDO = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, orderId).last("limit 1"));
OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, orderId).last("limit 1"));
List<OrderItemDO> orderItemDOList = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>().eq(OrderItemDO::getOrderId, orderId));
OrderConsignorDO orderConsignorDO =
orderConsignorService.getOne(
new LambdaQueryWrapper<OrderConsignorDO>().
eq(OrderConsignorDO::getOrderId, orderId).
last("limit 1"));
OrderConsigneeDO orderConsigneeDO =
orderConsigneeService.getOne(
new LambdaQueryWrapper<OrderConsigneeDO>().
eq(OrderConsigneeDO::getOrderId, orderId).
last("limit 1"));
List<OrderItemDO> orderItemDOList =
orderItemMapper.selectList(
new LambdaQueryWrapper<OrderItemDO>().
eq(OrderItemDO::getOrderId, orderId));
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Map<Integer, UnitRespDto> unitRespDtoMap = unitApi.getAllUnit();
Map<Integer, CurrencyRespDTO> currencyRespDTOMap = currencyApi.getAllCurrency();
//币种
Map<Integer, CurrencyRespDTO> currencyRespDTOMap =
currencyApi.getAllCurrency();
List<ApplyInfoVO> applyInfoVOList = new ArrayList<>();
for (OrderItemDO it : orderItemDOList) {
String sLog = getLog(it,freightFee,freightCurrencyId,freightUnitId);
// 只针对已入仓的品名进行加价处理
if (Objects.nonNull(it.getWarehouseInInfoVO()) && it.getWarehouseInInfoVO().getCartonsNum() > 0) {
if (Objects.nonNull(it.getWarehouseInInfoVO()) &&
it.getWarehouseInInfoVO().getCartonsNum() > 0) {
// 设置空运订单的每个品名的加价
if (Objects.nonNull(freightFee) && Objects.nonNull(freightCurrencyId) && Objects.nonNull(freightUnitId) &&
freightCurrencyId.equals(it.getSeaFreightCurrency()) && freightUnitId.equals(it.getSeaFreightVolume())) {
if (Objects.nonNull(freightFee) &&
Objects.nonNull(freightCurrencyId) &&
Objects.nonNull(freightUnitId) &&
freightCurrencyId.equals(it.getSeaFreightCurrency())
&& freightUnitId.equals(it.getSeaFreightVolume())) {
//运费价值,币种,单位都不能为空
//清关费币种和单位要和原来的一致
ApplyInfoVO freightInfoVO = new ApplyInfoVO();
// 货币与计量
it.setMarkupSeaFreight(it.getMarkupSeaFreight().add(freightFee));// 累加批量加价
......@@ -603,27 +749,66 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
freightInfoVO.setName(it.getProdTitleZh() + "/" + it.getProdTitleEn() + (it.getCharging() == 0 ? "运费加价" : "全包价加价"));
freightInfoVO.setNewValue(freightFee + currencyRespDTOMap.get(freightCurrencyId).getTitleZh() + "/" + unitRespDtoMap.get(freightUnitId.intValue()).getFuhao());
applyInfoVOList.add(freightInfoVO);
zTest z = new zTest();
z.setTestname("符合条件 币种和单位的判断");
z.setCreatedate(new Date());
zTestMapper.insert(z);
} else {
zTest z = new zTest();
z.setTestname(sLog + "不符合条件 币种和单位的判断");
z.setCreatedate(new Date());
zTestMapper.insert(z);
}
if (it.getCharging() == 0) {
if (Objects.nonNull(clearanceFee) && Objects.nonNull(clearanceCurrencyId) && Objects.nonNull(clearanceUnitId) &&
clearanceCurrencyId.equals(it.getClearanceFreightCurrency()) && clearanceUnitId.equals(it.getClearanceFreightVolume())) {
//运费加清关价
//运费价值,币种,单位都不能为空
//清关费币种和单位要和原来的一致
if (Objects.nonNull(clearanceFee) &&
Objects.nonNull(clearanceCurrencyId) &&
Objects.nonNull(clearanceUnitId) &&
clearanceCurrencyId.equals(it.getClearanceFreightCurrency()) &&
clearanceUnitId.equals(it.getClearanceFreightVolume())) {
ApplyInfoVO clearanceInfoVO = new ApplyInfoVO();
it.setMarkupClearanceFreight(it.getMarkupClearanceFreight().add(clearanceFee));// 累加批量加价
it.setOneClearanceFreight(it.getOneClearanceFreight().add(clearanceFee)); // 这里对成交单价进行修正
clearanceInfoVO.setName(it.getProdTitleZh() + "/" + it.getProdTitleEn() + "清关费加价");
clearanceInfoVO.setNewValue(clearanceFee + currencyRespDTOMap.get(clearanceCurrencyId).getTitleZh() + "/" + unitRespDtoMap.get(clearanceUnitId.intValue()).getFuhao());
applyInfoVOList.add(clearanceInfoVO);
zTest z = new zTest();
z.setTestname("符合条件 运费加清关价=0");
z.setCreatedate(new Date());
zTestMapper.insert(z);
} else {
zTest z = new zTest();
z.setTestname("不符合条件 运费加清关价<>0");
z.setCreatedate(new Date());
zTestMapper.insert(z);
}
}
}
}
String updater = String.valueOf(loginUser != null ? loginUser.getId() : null);
String updater =
String.valueOf(loginUser != null ? loginUser.getId() : null);
// 批量加价计价调整
this.costCalculation(updater, orderDO, orderConsignorDO.getCustomerId(), orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(), orderConsigneeDO.getCustomerContactsId(), orderItemDOList, 14);
this.costCalculation(updater,
orderDO, orderConsignorDO.getCustomerId(),
orderConsigneeDO.getCustomerId(),
orderConsignorDO.getCustomerContactsId(),
orderConsigneeDO.getCustomerContactsId(),
orderItemDOList, 14);
// 添加出货批量加价日志
if (CollectionUtil.isNotEmpty(applyInfoVOList) && applyInfoVOList.size() > 0) {
this.addOrderOperateLog(orderId, "出货操作", "出货批量加价", applyInfoVOList);
if (CollectionUtil.isNotEmpty(applyInfoVOList)
&& applyInfoVOList.size() > 0) {
this.addOrderOperateLog(orderId,
"出货操作",
"出货批量加价",
applyInfoVOList);
}
}
}
......@@ -1958,6 +2143,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
}
//14 是批量加价
public void costCalculation(String userId,
OrderDO orderDO,
Long consignorCustomerId,
......@@ -2250,9 +2436,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
event, item, warehouseInInfoVO,
type, orderNoCanShipmentChannelExceptionDOList);
}
}
else
{
} else {
//海运也需要判断单询价异常逻辑 lanbm 2024-06-17 add
OrderItemDO item =
orderItemMapper.selectById(
......@@ -2429,10 +2613,10 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
if (orderItemDO.getNeedOrderInquiry() != null) {
String sNo="";
if(orderDO.getOrderNo()!=null)sNo=orderDO.getOrderNo();
String sNo = "";
if (orderDO.getOrderNo() != null) sNo = orderDO.getOrderNo();
String s =sNo+"未报价日志,type=" + type.toString() +
String s = sNo + "未报价日志,type=" + type.toString() +
"getTransportId=" + orderDO.getTransportId().toString() +
"getNeedOrderInquiry=" + orderItemDO.getNeedOrderInquiry();
......@@ -2641,10 +2825,10 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
CollectionUtil.newArrayList(OrderExceptionEnum.GOODS_OVERWEIGHT_EXCEPTION.getKey(), OrderExceptionEnum.LINE_WEIGHT_EXCEPTION.getKey()));
if (orderItemDO.getNeedOrderInquiry() != null) {
String sNo="";
if(orderDO.getOrderNo()!=null)sNo=orderDO.getOrderNo();
String sNo = "";
if (orderDO.getOrderNo() != null) sNo = orderDO.getOrderNo();
String s =sNo+"清关价日志,type=" + type.toString() + " TransportId=" +
String s = sNo + "清关价日志,type=" + type.toString() + " TransportId=" +
orderDO.getTransportId().toString() +
" NeedOrderInquiry=" + orderItemDO.getNeedOrderInquiry().toString();
......
......@@ -49,6 +49,7 @@ import cn.iocoder.yudao.module.member.api.user.dto.UserRespDTO;
import cn.iocoder.yudao.module.order.convert.orderLocation.OrderLocationConvert;
import cn.iocoder.yudao.module.order.dal.dataobject.approval.OrderApprovalDO;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.dal.dataobject.order.zTest;
import cn.iocoder.yudao.module.order.dal.dataobject.orderCargoControl.OrderCargoControlDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignee.OrderConsigneeDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignor.OrderConsignorDO;
......@@ -56,6 +57,7 @@ import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderLocation.OrderLocationDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderSplit.OrderSplitDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderSplitItem.OrderSplitItemDO;
import cn.iocoder.yudao.module.order.dal.mysql.order.ZTestMapper2;
import cn.iocoder.yudao.module.order.dal.mysql.orderSplitItem.OrderSplitItemMapper;
import cn.iocoder.yudao.module.order.dto.ContainerNumberSummaryDto;
import cn.iocoder.yudao.module.order.dto.OrderRemindExceptionDto;
......@@ -234,6 +236,9 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.DEPT_NOT_F
@Slf4j
public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements BoxService {
@Resource
private ZTestMapper2 zTestMapper2;
@Resource
private BoxMapper boxMapper;
......@@ -4951,10 +4956,21 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
if (StringUtils.isEmpty(details)) {
throw new ServiceException(500, "加价详情不能为空");
}
BoxOrderMarkUpVO boxOrderMarkUpVO = JSON.parseObject(details, BoxOrderMarkUpVO.class);
orderBusinessService.handleAirOrderBatchMarkup(boxOrderMarkUpVO.getOrderIds(), boxOrderMarkUpVO.getFreightFee(),
boxOrderMarkUpVO.getFreightCurrencyId(), boxOrderMarkUpVO.getFreightUnitId(),
boxOrderMarkUpVO.getClearanceFee(), boxOrderMarkUpVO.getClearanceCurrencyId(),
BoxOrderMarkUpVO boxOrderMarkUpVO =
JSON.parseObject(details, BoxOrderMarkUpVO.class);
zTest z=new zTest();
z.setTestname("开始调用 handleAirOrderBatchMarkup");
z.setCreatedate(new Date());
zTestMapper2.insert(z);
orderBusinessService.handleAirOrderBatchMarkup(
boxOrderMarkUpVO.getOrderIds(),
boxOrderMarkUpVO.getFreightFee(),
boxOrderMarkUpVO.getFreightCurrencyId(),
boxOrderMarkUpVO.getFreightUnitId(),
boxOrderMarkUpVO.getClearanceFee(),
boxOrderMarkUpVO.getClearanceCurrencyId(),
boxOrderMarkUpVO.getClearanceUnitId());
}
......@@ -4973,7 +4989,8 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
@Override
public void checkIsInClearance(Long shipmentId, Long orderId) {
BoxClearanceOrderDO clearanceOrderDO = boxClearanceOrderService.getOne(new LambdaQueryWrapper<BoxClearanceOrderDO>()
BoxClearanceOrderDO clearanceOrderDO =
boxClearanceOrderService.getOne(new LambdaQueryWrapper<BoxClearanceOrderDO>()
.eq(BoxClearanceOrderDO::getShipmentId, shipmentId)
.eq(BoxClearanceOrderDO::getOrderId, orderId)
);
......@@ -5001,20 +5018,28 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
@Override
public void checkOrderPayStatus(Collection<Long> orderIds) {
if (CollectionUtil.isEmpty(orderIds)) return;
List<ReceivableDO> receivableList = receivableService.getOrderPayList(orderIds);
List<OrderDO> orderList = orderQueryService.getOrderList(orderIds);
List<ReceivableDO> receivableList =
receivableService.getOrderPayList(orderIds);
List<OrderDO> orderList =
orderQueryService.getOrderList(orderIds);
Map<Long, OrderDO> orderMap = orderList.stream()
.collect(Collectors.toMap(OrderDO::getOrderId, v -> v));
List<String> payOrderNoList = new ArrayList<>();
if (CollectionUtil.isNotEmpty(receivableList)) {
Map<Long, List<ReceivableDO>> receivableMap = receivableList.stream()
.collect(Collectors.groupingBy(ReceivableDO::getOrderId));
for (Map.Entry<Long, List<ReceivableDO>> entry : receivableMap.entrySet()) {
for (Map.Entry<Long,
List<ReceivableDO>> entry : receivableMap.entrySet()) {
Long orderId = entry.getKey();
OrderDO orderDO = orderMap.get(orderId);
payOrderNoList.add(orderDO.getOrderNo());
}
throw new ServiceException(500, Joiner.on(",").join(payOrderNoList) + "已预付核销,不允许修改价格");
throw new ServiceException(500,
Joiner.on(",").join(payOrderNoList) + "已预付核销,不允许修改价格");
}
}
......
......@@ -15,8 +15,10 @@ import cn.iocoder.yudao.module.bpm.resp.TaskResp;
import cn.iocoder.yudao.module.ecw.service.internalMessage.InternalMessageService;
import cn.iocoder.yudao.module.ecw.vo.internalMessage.InternalMessageCreateReqVO;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.dal.dataobject.order.zTest;
import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderSplitItem.OrderSplitItemDO;
import cn.iocoder.yudao.module.order.dal.mysql.order.ZTestMapper2;
import cn.iocoder.yudao.module.order.enums.*;
import cn.iocoder.yudao.module.order.service.targetLog.TargetLogService;
import cn.iocoder.yudao.module.order.vo.order.CostVO;
......@@ -74,6 +76,9 @@ import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.*;
@Validated
public class BoxApprovalServiceImpl extends AbstractService<BoxApprovalMapper, BoxApprovalDO> implements BoxApprovalService {
@Resource
private ZTestMapper2 zTestMapper2;
@Resource
private BoxApprovalMapper boxApprovalMapper;
@Resource
......@@ -604,10 +609,14 @@ public class BoxApprovalServiceImpl extends AbstractService<BoxApprovalMapper, B
@Override
@Transactional(rollbackFor = Exception.class)
public void updateBoxApproveResult(String flowKey, String id, int result) {
public void updateBoxApproveResult(String flowKey,
String id,
int result) {
BoxApprovalDO boxApprovalDO = boxApprovalMapper.selectById(id);
TaskResp taskResp = bpmCreateServiceFactory.getLastTaskByProcessInstanceId(boxApprovalDO.getBpmProcessId());
TaskResp taskResp =
bpmCreateServiceFactory.getLastTaskByProcessInstanceId(boxApprovalDO.getBpmProcessId());
Long shipmentId = boxApprovalDO.getShipmentId();
BoxDO boxDO = boxService.getBox(shipmentId);
......@@ -1145,9 +1154,27 @@ public class BoxApprovalServiceImpl extends AbstractService<BoxApprovalMapper, B
//======================批量加价格=======================
case SHIPMENT_BATCH_ADD_PRICE:
//批量加价格
//lanbm 2024-06-18 添加注释 是给自编号下的订单加价
if (result == BpmProcessInstanceResultEnum.APPROVE.getResult()) {
String details = boxApprovalDO.getDetails();
BoxOrderMarkUpVO boxOrderMarkUpVO = JSON.parseObject(details, BoxOrderMarkUpVO.class);
BoxOrderMarkUpVO boxOrderMarkUpVO =
JSON.parseObject(details, BoxOrderMarkUpVO.class);
if(boxOrderMarkUpVO.getOrderIds()!=null)
{
String s=String.valueOf(boxOrderMarkUpVO.getOrderIds());
zTest z=new zTest();
z.setTestname("订单id,"+s);
z.setCreatedate(new Date());
zTestMapper2.insert(z);
}
else
{
String s=String.valueOf(boxOrderMarkUpVO.getOrderIds());
zTest z=new zTest();
z.setTestname("批量加价申报批,订单id为空");
z.setCreatedate(new Date());
zTestMapper2.insert(z);
}
boxService.checkOrderPayStatus(boxOrderMarkUpVO.getOrderIds());
boxService.batchAddPriceSuccess(shipmentId, details);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment