Commit 76812eb5 authored by lanbaoming's avatar lanbaoming

2024-06-07提交

parent d8302608
...@@ -230,7 +230,8 @@ public class FileConfigServiceImpl implements FileConfigService { ...@@ -230,7 +230,8 @@ public class FileConfigServiceImpl implements FileConfigService {
this.validateFileConfigExists(id); this.validateFileConfigExists(id);
// 上传文件 // 上传文件
byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
return fileClientFactory.getFileClient(id).upload(content, IdUtil.fastSimpleUUID() + ".jpg"); return fileClientFactory.getFileClient(id).upload(content,
IdUtil.fastSimpleUUID() + ".jpg");
} }
@Override @Override
......
...@@ -67,7 +67,7 @@ public class FileServiceImpl implements FileService { ...@@ -67,7 +67,7 @@ public class FileServiceImpl implements FileService {
Assert.notNull(client, "客户端(master) 不能为空"); Assert.notNull(client, "客户端(master) 不能为空");
String url = client.upload(content, path); String url = client.upload(content, path);
// 保存到数据库 //保存到数据库
FileDO file = new FileDO(); FileDO file = new FileDO();
file.setConfigId(client.getId()); file.setConfigId(client.getId());
file.setPath(path); file.setPath(path);
......
package cn.iocoder.yudao.module.order.dal.dataobject.order;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@TableName("z_test")
@Data
public class zTest {
private Long id;
private String testname;
private Date createdate;
}
package cn.iocoder.yudao.module.order.dal.mysql.order;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.order.dal.dataobject.order.zTest;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ZTestMapper2 extends AbstractMapper<zTest> {
}
...@@ -82,45 +82,66 @@ public class ProductPriceExceptionHandleListener { ...@@ -82,45 +82,66 @@ public class ProductPriceExceptionHandleListener {
//找出这些订单的未处理的未报价异常 //找出这些订单的未处理的未报价异常
List<OrderExceptionDO> exceptionDOList = List<OrderExceptionDO> exceptionDOList =
orderExceptionService.list(new LambdaQueryWrapper<OrderExceptionDO>() orderExceptionService.list(new LambdaQueryWrapper<OrderExceptionDO>()
.eq(OrderExceptionDO::getOrderExceptionType,OrderExceptionEnum.ORDER_NO_QUOTE_EXCEPTION.getKey()) .eq(OrderExceptionDO::getOrderExceptionType, OrderExceptionEnum.ORDER_NO_QUOTE_EXCEPTION.getKey())
.in(OrderExceptionDO::getOrderItemId, orderItemIdSet) .in(OrderExceptionDO::getOrderItemId, orderItemIdSet)
.ne(OrderExceptionDO::getOrderExceptionStatus, 2) .ne(OrderExceptionDO::getOrderExceptionStatus, 2)
); );
if (CollectionUtil.isNotEmpty(exceptionDOList)) { if (CollectionUtil.isNotEmpty(exceptionDOList)) {
for (OrderExceptionDO orderExceptionDO : exceptionDOList) { for (OrderExceptionDO orderExceptionDO : exceptionDOList) {
//修改这些订单的未报价异常为已处理
// OrderExceptionResultHandlerVo orderExceptionResultHandlerVo = new OrderExceptionResultHandlerVo();
// orderExceptionResultHandlerVo.setOrderExceptionId(orderExceptionDO.getId());
// orderExceptionResultHandlerVo.setOrderExceptionHandlerResult(OrderExceptionResult.ORDER_NO_QUOTE_EXCEPTION_RESULT.PROCESSED);
// orderExceptionResultHandlerVo.setHandlerId(Constant.SYSTEM_USER_ADMIN_ID); //admin
// orderExceptionResultHandlerVo.setOrderExceptionHandlerRemark("系统自动处理");
// orderExceptionService.handlerExceptionByExceptionId(orderExceptionResultHandlerVo);
orderBusinessService.handleOrderNoQuote( orderBusinessService.handleOrderNoQuote(
orderExceptionDO.getOrderId()); orderExceptionDO.getOrderId(),productPriceDO);
//修改这些订单的未报价异常为已处理
/*
if (productPriceDO.getNeedOrderInquiry() == 1) {
//lanbm 2024-06-06 把以前的注释开启
OrderExceptionResultHandlerVo orderExceptionResultHandlerVo =
new OrderExceptionResultHandlerVo();
orderExceptionResultHandlerVo.setOrderExceptionId(
orderExceptionDO.getId());
orderExceptionResultHandlerVo.setOrderExceptionHandlerResult(
OrderExceptionResult.ORDER_NO_QUOTE_EXCEPTION_RESULT.PROCESSED);
orderExceptionResultHandlerVo.setHandlerId(
Constant.SYSTEM_USER_ADMIN_ID);
orderExceptionResultHandlerVo.setOrderExceptionHandlerRemark("系统自动处理");
orderExceptionService.handlerExceptionByExceptionId(orderExceptionResultHandlerVo);
//end lanbm 2024-06-06 把以前的注释开启
}*/
} }
} }
//只要有价格就处理清关费未报价异常 //只要有价格就处理清关费未报价异常
// if (productPriceDO.getPriceType() == 0) { //if (productPriceDO.getPriceType() == 0) {
//找出这些订单的未处理的未报价清关费异常 //找出这些订单的未处理的未报价清关费异常
List<OrderExceptionDO> clearanceExceptionDOList = orderExceptionService.list(new LambdaQueryWrapper<OrderExceptionDO>() List<OrderExceptionDO> clearanceExceptionDOList =
.eq(OrderExceptionDO::getOrderExceptionType, OrderExceptionEnum.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION.getKey()) orderExceptionService.list(
.in(OrderExceptionDO::getOrderItemId, orderItemIdSet) new LambdaQueryWrapper<OrderExceptionDO>()
.ne(OrderExceptionDO::getOrderExceptionStatus, 2) .eq(OrderExceptionDO::getOrderExceptionType,
); OrderExceptionEnum.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION.getKey())
for (OrderExceptionDO orderExceptionDO : clearanceExceptionDOList) { .in(OrderExceptionDO::getOrderItemId, orderItemIdSet)
//修改这些订单的未报价异常为已处理 .ne(OrderExceptionDO::getOrderExceptionStatus,
// OrderExceptionResultHandlerVo orderExceptionResultHandlerVo = new OrderExceptionResultHandlerVo(); 2)
// orderExceptionResultHandlerVo.setOrderExceptionId(orderExceptionDO.getId()); );
// orderExceptionResultHandlerVo.setOrderExceptionHandlerResult(OrderExceptionResult.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION_RESULT.PROCESSED); for (OrderExceptionDO orderExceptionDO : clearanceExceptionDOList) {
// orderExceptionResultHandlerVo.setHandlerId(Constant.SYSTEM_USER_ADMIN_ID); //admin
// orderExceptionResultHandlerVo.setOrderExceptionHandlerRemark("系统自动处理"); //订单ID
// orderExceptionService.handlerExceptionByExceptionId(orderExceptionResultHandlerVo); orderBusinessService.handleOrderNoQuote(
orderBusinessService.handleOrderNoQuote( orderExceptionDO.getOrderId(),productPriceDO);
orderExceptionDO.getOrderId());
} //修改这些订单的未报价异常为已处理
// } /*
if (productPriceDO.getNeedOrderInquiry() == 1) {
//lanbm 2024-06-06 把以前的注释开启
OrderExceptionResultHandlerVo orderExceptionResultHandlerVo =
new OrderExceptionResultHandlerVo();
orderExceptionResultHandlerVo.setOrderExceptionId(orderExceptionDO.getId());
orderExceptionResultHandlerVo.setOrderExceptionHandlerResult(OrderExceptionResult.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION_RESULT.PROCESSED);
orderExceptionResultHandlerVo.setHandlerId(Constant.SYSTEM_USER_ADMIN_ID); //admin
orderExceptionResultHandlerVo.setOrderExceptionHandlerRemark("系统自动处理");
orderExceptionService.handlerExceptionByExceptionId(orderExceptionResultHandlerVo);
//end lanbm 2024-06-06 把以前的注释开启
}*/
}
} }
......
...@@ -45,7 +45,8 @@ public class ExceptionOrderStatisticsExcelExportListener { ...@@ -45,7 +45,8 @@ public class ExceptionOrderStatisticsExcelExportListener {
* @param event 编号记录 * @param event 编号记录
*/ */
@EventListener(ExceptionOrderStatisticsExcelExportEvent.class) @EventListener(ExceptionOrderStatisticsExcelExportEvent.class)
public void exceptionOrderStatisticsExcelExportEvent(ExceptionOrderStatisticsExcelExportEvent event) { public void exceptionOrderStatisticsExcelExportEvent(
ExceptionOrderStatisticsExcelExportEvent event) {
if (StringUtils.isNotBlank(event.getRequestParams())){ if (StringUtils.isNotBlank(event.getRequestParams())){
try { try {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATA_FORMAT); DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATA_FORMAT);
...@@ -72,8 +73,8 @@ public class ExceptionOrderStatisticsExcelExportListener { ...@@ -72,8 +73,8 @@ public class ExceptionOrderStatisticsExcelExportListener {
event.setFileName(fileDO.getPath()); event.setFileName(fileDO.getPath());
event.setUrl(fileDO.getUrl()); event.setUrl(fileDO.getUrl());
event.setFileId(fileDO.getId()); event.setFileId(fileDO.getId());
}catch (Exception e){ }catch (Exception e){
// TODO 测试阶段打印堆栈错误信息,便于分析原因
e.printStackTrace(); e.printStackTrace();
event.setResult(e.getMessage()); event.setResult(e.getMessage());
} }
......
...@@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.order.enums.OrderSeaTimeEnum; ...@@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.order.enums.OrderSeaTimeEnum;
import cn.iocoder.yudao.module.order.param.OrderChangePriceParam; import cn.iocoder.yudao.module.order.param.OrderChangePriceParam;
import cn.iocoder.yudao.module.order.param.OrderControlLogParam; import cn.iocoder.yudao.module.order.param.OrderControlLogParam;
import cn.iocoder.yudao.module.order.vo.order.*; import cn.iocoder.yudao.module.order.vo.order.*;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductPriceDO;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Collection; import java.util.Collection;
...@@ -33,6 +34,10 @@ public interface OrderBusinessService extends IService<OrderDO> { ...@@ -33,6 +34,10 @@ public interface OrderBusinessService extends IService<OrderDO> {
*/ */
void handleOrderNoQuote(Long orderId); void handleOrderNoQuote(Long orderId);
/*
lanbm 2024-06-06 添加的函数
*/
void handleOrderNoQuote(Long orderId, ProductPriceDO productPriceDO);
/** /**
* 切换线路、渠道处理不可出渠道异常(注:此接口不会标记处理过不可出异常,会切换线路id或渠道id后重新判定,请在处理完异常后再调用) * 切换线路、渠道处理不可出渠道异常(注:此接口不会标记处理过不可出异常,会切换线路id或渠道id后重新判定,请在处理完异常后再调用)
...@@ -131,7 +136,6 @@ public interface OrderBusinessService extends IService<OrderDO> { ...@@ -131,7 +136,6 @@ public interface OrderBusinessService extends IService<OrderDO> {
void handleOrderPickleType(Long orderId, Integer pickleType); void handleOrderPickleType(Long orderId, Integer pickleType);
/** /**
* 空运订单价格刷新(待入仓、入仓中、已入仓-待出订单进行没日单价重定更新) * 空运订单价格刷新(待入仓、入仓中、已入仓-待出订单进行没日单价重定更新)
* *
...@@ -140,7 +144,6 @@ public interface OrderBusinessService extends IService<OrderDO> { ...@@ -140,7 +144,6 @@ public interface OrderBusinessService extends IService<OrderDO> {
void airOrderPriceRefresh(OrderDO orderDO); void airOrderPriceRefresh(OrderDO orderDO);
/** /**
* 根据参数生成订单号,这里获取最新的订单编号,并保存记录 * 根据参数生成订单号,这里获取最新的订单编号,并保存记录
* *
...@@ -171,6 +174,7 @@ public interface OrderBusinessService extends IService<OrderDO> { ...@@ -171,6 +174,7 @@ public interface OrderBusinessService extends IService<OrderDO> {
* @param type 1 生成应收 2 修改价格时同步更新应收(未生成应收不予执行) * @param type 1 生成应收 2 修改价格时同步更新应收(未生成应收不予执行)
*/ */
boolean addOrderReceivable(OrderDO orderDO, Integer type); boolean addOrderReceivable(OrderDO orderDO, Integer type);
/** /**
* 添加订单动态日志 * 添加订单动态日志
* *
...@@ -279,6 +283,7 @@ public interface OrderBusinessService extends IService<OrderDO> { ...@@ -279,6 +283,7 @@ public interface OrderBusinessService extends IService<OrderDO> {
* @param now 业务系统同一创建时间 * @param now 业务系统同一创建时间
*/ */
void addOrderTimeLog(Integer status, OrderDO orderDO, Integer type, Date businessTime, Date now); void addOrderTimeLog(Integer status, OrderDO orderDO, Integer type, Date businessTime, Date now);
/** /**
* 更新不阻塞流程的订单异常信息 * 更新不阻塞流程的订单异常信息
* *
...@@ -293,6 +298,7 @@ public interface OrderBusinessService extends IService<OrderDO> { ...@@ -293,6 +298,7 @@ public interface OrderBusinessService extends IService<OrderDO> {
void updateOrderCustomer(List<String> orderNumbers); void updateOrderCustomer(List<String> orderNumbers);
void addOrderCustomerService(OrderDO order, int customerType); void addOrderCustomerService(OrderDO order, int customerType);
/** /**
* 手动更新订单价格(谨慎执行) * 手动更新订单价格(谨慎执行)
* *
...@@ -324,6 +330,7 @@ public interface OrderBusinessService extends IService<OrderDO> { ...@@ -324,6 +330,7 @@ public interface OrderBusinessService extends IService<OrderDO> {
* @param note 备注 {@link ApplyInfoVO 的详情集合} 不要传空字符串 * @param note 备注 {@link ApplyInfoVO 的详情集合} 不要传空字符串
*/ */
void addOrderOperateLog(Long orderId, String msg, String note); void addOrderOperateLog(Long orderId, String msg, String note);
/** /**
* 添加订单操作日志 * 添加订单操作日志
* *
......
...@@ -33,6 +33,7 @@ import cn.iocoder.yudao.module.ecw.dal.dataobject.country.CountryDO; ...@@ -33,6 +33,7 @@ import cn.iocoder.yudao.module.ecw.dal.dataobject.country.CountryDO;
import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO; import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.module.ecw.service.country.CountryService; import cn.iocoder.yudao.module.ecw.service.country.CountryService;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO; 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.orderCargoControl.OrderCargoControlDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignee.OrderConsigneeDO; import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignee.OrderConsigneeDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignor.OrderConsignorDO; import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignor.OrderConsignorDO;
...@@ -43,6 +44,7 @@ import cn.iocoder.yudao.module.order.dal.dataobject.orderObjective.OrderObjectiv ...@@ -43,6 +44,7 @@ import cn.iocoder.yudao.module.order.dal.dataobject.orderObjective.OrderObjectiv
import cn.iocoder.yudao.module.order.dal.dataobject.orderSplit.OrderSplitDO; import cn.iocoder.yudao.module.order.dal.dataobject.orderSplit.OrderSplitDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderTime.OrderTimeDO; import cn.iocoder.yudao.module.order.dal.dataobject.orderTime.OrderTimeDO;
import cn.iocoder.yudao.module.order.dal.mysql.order.OrderMapper; import cn.iocoder.yudao.module.order.dal.mysql.order.OrderMapper;
import cn.iocoder.yudao.module.order.dal.mysql.order.ZTestMapper2;
import cn.iocoder.yudao.module.order.dal.mysql.orderCargoControl.OrderCargoControlMapper; import cn.iocoder.yudao.module.order.dal.mysql.orderCargoControl.OrderCargoControlMapper;
import cn.iocoder.yudao.module.order.dal.mysql.orderItem.OrderItemMapper; import cn.iocoder.yudao.module.order.dal.mysql.orderItem.OrderItemMapper;
import cn.iocoder.yudao.module.order.dal.mysql.orderSplit.OrderSplitMapper; import cn.iocoder.yudao.module.order.dal.mysql.orderSplit.OrderSplitMapper;
...@@ -65,6 +67,7 @@ import cn.iocoder.yudao.module.order.vo.orderOperateLog.OrderOperateLogCreateReq ...@@ -65,6 +67,7 @@ import cn.iocoder.yudao.module.order.vo.orderOperateLog.OrderOperateLogCreateReq
import cn.iocoder.yudao.module.product.component.ProdCostCalculation; import cn.iocoder.yudao.module.product.component.ProdCostCalculation;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductAttrDO; import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductAttrDO;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO; import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductPriceDO;
import cn.iocoder.yudao.module.product.dto.CalculationCostResultDto; import cn.iocoder.yudao.module.product.dto.CalculationCostResultDto;
import cn.iocoder.yudao.module.product.dto.FeeDto; import cn.iocoder.yudao.module.product.dto.FeeDto;
import cn.iocoder.yudao.module.product.dto.ProdCostDto; import cn.iocoder.yudao.module.product.dto.ProdCostDto;
...@@ -113,6 +116,8 @@ import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.*; ...@@ -113,6 +116,8 @@ import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.*;
@Slf4j @Slf4j
public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, OrderDO> implements OrderBusinessService { public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, OrderDO> implements OrderBusinessService {
private final ZTestMapper2 zTestMapper;
private final OrderMapper orderMapper; private final OrderMapper orderMapper;
private final OrderSplitMapper orderSplitMapper; private final OrderSplitMapper orderSplitMapper;
private final OrderItemMapper orderItemMapper; private final OrderItemMapper orderItemMapper;
...@@ -306,6 +311,23 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -306,6 +311,23 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
log.info("处理未报价异常结束....订单id【{}】", orderId); log.info("处理未报价异常结束....订单id【{}】", orderId);
} }
/*
lanbm 2024-06-06 重载的函数
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void handleOrderNoQuote(Long orderId,
ProductPriceDO productPriceDO) {
log.info("处理未报价异常开始....订单id【{}】", orderId);
OrderDO orderDO = orderMapper.selectById(orderId);
if (Objects.isNull(orderDO)) {
throw exception(ORDER_NOT_EXISTS);
}
handleException(orderId, orderDO, 6, productPriceDO);
log.info("处理未报价异常结束....订单id【{}】", orderId);
}
@Override @Override
public void handleOrderChannelException(Long orderId, Long channelId, Long lineId, List<OrderChangePriceParam> channelPriceParams) { public void handleOrderChannelException(Long orderId, Long channelId, Long lineId, List<OrderChangePriceParam> channelPriceParams) {
log.info("切换线路处理不可出渠道异常开始....订单id【{}】....线路ID【{}】....渠道ID【{}】", orderId, lineId, channelId); log.info("切换线路处理不可出渠道异常开始....订单id【{}】....线路ID【{}】....渠道ID【{}】", orderId, lineId, channelId);
...@@ -409,14 +431,64 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -409,14 +431,64 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
private void handleException(Long orderId, OrderDO orderDO, int type) { private void handleException(Long orderId, OrderDO orderDO, int type) {
OrderConsignorDO orderConsignorDO = OrderConsignorDO orderConsignorDO =
orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, orderId).last("limit 1")); orderConsignorService.getOne(
new LambdaQueryWrapper<OrderConsignorDO>().
eq(OrderConsignorDO::getOrderId, orderId).
last("limit 1"));
OrderConsigneeDO orderConsigneeDO = OrderConsigneeDO orderConsigneeDO =
orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, orderId).last("limit 1")); orderConsigneeService.getOne(
new LambdaQueryWrapper<OrderConsigneeDO>().
eq(OrderConsigneeDO::getOrderId, orderId).
last("limit 1"));
List<OrderItemDO> orderItemDOList = List<OrderItemDO> orderItemDOList =
orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>().eq(OrderItemDO::getOrderId, orderId)); orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>().
eq(OrderItemDO::getOrderId, orderId));
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
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, type);
}
private void handleException(Long orderId, OrderDO orderDO, int type,
ProductPriceDO productPriceDO) {
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));
//lanbm 2024-06-06 添加的逻辑点
for (OrderItemDO oItem : orderItemDOList
) {
if (productPriceDO.getNeedOrderInquiry() == 1)
oItem.setNeedOrderInquiry(productPriceDO.getNeedOrderInquiry());
}
//end lanbm 2024-06-06 添加的逻辑点
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
String updater =
String.valueOf(loginUser != null ? loginUser.getId() : null);
// 插入订单商品项 // 插入订单商品项
this.costCalculation(updater, orderDO, this.costCalculation(updater, orderDO,
orderConsignorDO.getCustomerId(), orderConsignorDO.getCustomerId(),
...@@ -426,6 +498,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -426,6 +498,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderItemDOList, type); orderItemDOList, type);
} }
private void handleException(Long orderId, OrderDO orderDO, List<OrderChangePriceParam> channelPriceParams, int type) { private void handleException(Long orderId, OrderDO orderDO, List<OrderChangePriceParam> channelPriceParams, int type) {
OrderConsignorDO orderConsignorDO = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, orderId).last("limit 1")); 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")); OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, orderId).last("limit 1"));
...@@ -1885,11 +1958,19 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -1885,11 +1958,19 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} }
public void costCalculation(String userId, OrderDO orderDO, Long consignorCustomerId, Long consigneeCustomerId, public void costCalculation(String userId,
Long consignorCustomerContactsId, Long consigneeCustomerContactsId, OrderDO orderDO,
List<OrderItemDO> orderItemDOList, Integer type) { Long consignorCustomerId,
Long consigneeCustomerId,
Long consignorCustomerContactsId,
Long consigneeCustomerContactsId,
List<OrderItemDO> orderItemDOList,
Integer type) {
LogisticsInfoDto logisticsInfoDto =
warehouseLineMapper.getStartInfoAndDestInfoByLineId(
orderDO.getLineId());
LogisticsInfoDto logisticsInfoDto = warehouseLineMapper.getStartInfoAndDestInfoByLineId(orderDO.getLineId());
if (Objects.isNull(logisticsInfoDto)) { if (Objects.isNull(logisticsInfoDto)) {
throw exception(TRANSPORT_LINE_NOT_EXISTS); throw exception(TRANSPORT_LINE_NOT_EXISTS);
} }
...@@ -1899,35 +1980,47 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -1899,35 +1980,47 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
event.setChannelId(orderDO.getChannelId()); event.setChannelId(orderDO.getChannelId());
applicationContext.publishEvent(event); applicationContext.publishEvent(event);
} }
CustomerZhongPaoQueryVO customerZhongPaoQueryVO = new CustomerZhongPaoQueryVO(); CustomerZhongPaoQueryVO customerZhongPaoQueryVO =
new CustomerZhongPaoQueryVO();
customerZhongPaoQueryVO.setDepartureId(logisticsInfoDto.getStartCityId()); customerZhongPaoQueryVO.setDepartureId(logisticsInfoDto.getStartCityId());
customerZhongPaoQueryVO.setObjectiveId(logisticsInfoDto.getDestCityId()); customerZhongPaoQueryVO.setObjectiveId(logisticsInfoDto.getDestCityId());
customerZhongPaoQueryVO.setStartWarehouseId(logisticsInfoDto.getStartWarehouseId()); customerZhongPaoQueryVO.setStartWarehouseId(logisticsInfoDto.getStartWarehouseId());
customerZhongPaoQueryVO.setDestWarehouseId(logisticsInfoDto.getDestWarehouseId()); customerZhongPaoQueryVO.setDestWarehouseId(logisticsInfoDto.getDestWarehouseId());
// 先获取全局重泡货配置 // 先获取全局重泡货配置
ZhongPaoBestVO orgZhongPaoBestVO = zhongPaoService.getCustomerBestZhongPao(customerZhongPaoQueryVO); ZhongPaoBestVO orgZhongPaoBestVO =
zhongPaoService.getCustomerBestZhongPao(customerZhongPaoQueryVO);
customerZhongPaoQueryVO.setConsignorId(consignorCustomerId); customerZhongPaoQueryVO.setConsignorId(consignorCustomerId);
customerZhongPaoQueryVO.setConsigneeId(consigneeCustomerId); customerZhongPaoQueryVO.setConsigneeId(consigneeCustomerId);
// 获取全局重泡货与客户设置重泡货配置综合最优值 // 获取全局重泡货与客户设置重泡货配置综合最优值
ZhongPaoBestVO zhongPaoBestVO = zhongPaoService.getCustomerBestZhongPao(customerZhongPaoQueryVO); ZhongPaoBestVO zhongPaoBestVO =
zhongPaoService.getCustomerBestZhongPao(customerZhongPaoQueryVO);
if (Objects.isNull(orgZhongPaoBestVO)) { if (Objects.isNull(orgZhongPaoBestVO)) {
throw exception(THIS_LINE_ZHONG_PAO_SET_NOT_NULL); throw exception(THIS_LINE_ZHONG_PAO_SET_NOT_NULL);
} }
if (Objects.nonNull(orderDO.getWeightUnit()) && orderDO.getWeightUnit().compareTo(BigDecimal.ZERO) > 0) { if (Objects.nonNull(orderDO.getWeightUnit()) &&
orderDO.getWeightUnit().compareTo(BigDecimal.ZERO) > 0) {
// 特价使用的 // 特价使用的
zhongPaoBestVO.setZhongEdge(orderDO.getWeightUnit()); zhongPaoBestVO.setZhongEdge(orderDO.getWeightUnit());
} }
if (Objects.nonNull(orderDO.getVolumeUnit()) && orderDO.getVolumeUnit().compareTo(BigDecimal.ZERO) > 0) { if (Objects.nonNull(orderDO.getVolumeUnit()) &&
orderDO.getVolumeUnit().compareTo(BigDecimal.ZERO) > 0) {
// 特价使用的 // 特价使用的
zhongPaoBestVO.setPaoEdge(orderDO.getVolumeUnit()); zhongPaoBestVO.setPaoEdge(orderDO.getVolumeUnit());
} }
// 拆单业务或者子订单,并且拆单未做运输方式变更的不能进行收费数据重算处理 // 拆单业务或者子订单,并且拆单未做运输方式变更的不能进行收费数据重算处理
if ((type == 5 || (Objects.nonNull(orderDO.getParentOrderId()) && orderDO.getParentOrderId() > 0L)) && !orderDO.getSplitSeparateOrder()) { if ((type == 5 || (Objects.nonNull(orderDO.getParentOrderId())
&& orderDO.getParentOrderId() > 0L))
&& !orderDO.getSplitSeparateOrder()) {
// 拆单订单不对收费数据进行重算,拆单子订单都做了收费数据分拆处理 // 拆单订单不对收费数据进行重算,拆单子订单都做了收费数据分拆处理
// 订单的重货方数和泡货重量取订单订单项的收费数据之和 // 订单的重货方数和泡货重量取订单订单项的收费数据之和
BigDecimal wVolume = orderItemDOList.stream().map(OrderItemDO::getChargeVolume).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal wVolume = orderItemDOList.stream().map(
OrderItemDO::getChargeVolume).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
orderDO.setWVolume(wVolume); orderDO.setWVolume(wVolume);
BigDecimal vWeight = orderItemDOList.stream().map(OrderItemDO::getChargeWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal vWeight = orderItemDOList.stream().map(
OrderItemDO::getChargeWeight).filter(Objects::nonNull).
reduce(BigDecimal.ZERO, BigDecimal::add);
if (orderDO.getTransportId() == 3) { if (orderDO.getTransportId() == 3) {
vWeight = BigDecimalUtils.convertWv(vWeight); vWeight = BigDecimalUtils.convertWv(vWeight);
} }
...@@ -1946,16 +2039,26 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -1946,16 +2039,26 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
this.calculationOrderItem(orderDO, orderItemDOList, zhongPaoBestVO, event.getBubbleWeightRatio()); this.calculationOrderItem(orderDO, orderItemDOList, zhongPaoBestVO, event.getBubbleWeightRatio());
} }
// 计算订单商品项 // 计算订单商品项
CalculationItemFeeDto dto = this.insertOrderItemDOList(userId, orderItemDOList, orderDO, consignorCustomerId, consigneeCustomerId, consignorCustomerContactsId, consigneeCustomerContactsId, type); CalculationItemFeeDto dto = this.insertOrderItemDOList(userId,
orderItemDOList,
orderDO,
consignorCustomerId,
consigneeCustomerId,
consignorCustomerContactsId,
consigneeCustomerContactsId,
type);
List<OrderItemDO> newOrderItemDOList = dto.getOrderItemDOList(); List<OrderItemDO> newOrderItemDOList = dto.getOrderItemDOList();
// 统计订单项品牌属性 // 统计订单项品牌属性
Set<Integer> typeSet = new HashSet<>(); Set<Integer> typeSet = new HashSet<>();
for (OrderItemDO it : newOrderItemDOList) { for (OrderItemDO it : newOrderItemDOList) {
typeSet.add(StringUtils.isBlank(it.getWarehouseInInfo()) ? it.getBrandType() : it.getFeeType()); typeSet.add(StringUtils.isBlank(it.getWarehouseInInfo()) ? it.getBrandType() : it.getFeeType());
} }
orderDO.setMinMeteringQuantity(newOrderItemDOList.stream().map(OrderItemDO::getMinMeteringQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add)); orderDO.setMinMeteringQuantity(newOrderItemDOList.stream().
orderDO.setMinMeteringVolume(newOrderItemDOList.stream().map(OrderItemDO::getMinMeteringVolume).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add)); map(OrderItemDO::getMinMeteringQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
orderDO.setMinMeteringWeight(newOrderItemDOList.stream().map(OrderItemDO::getMinMeteringWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add)); orderDO.setMinMeteringVolume(newOrderItemDOList.stream().
map(OrderItemDO::getMinMeteringVolume).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
orderDO.setMinMeteringWeight(newOrderItemDOList.stream().
map(OrderItemDO::getMinMeteringWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
// 预计运费与清关费 // 预计运费与清关费
CostVO newCostVO = dto.getCostVO(); CostVO newCostVO = dto.getCostVO();
List<FeeDto> newFeeDtoList = newCostVO.getFeeDtoList(); List<FeeDto> newFeeDtoList = newCostVO.getFeeDtoList();
...@@ -2037,14 +2140,16 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2037,14 +2140,16 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
if (chargeVolume.compareTo(BigDecimal.ZERO) == 0) { if (chargeVolume.compareTo(BigDecimal.ZERO) == 0) {
orderDO.setWeightRatio(BigDecimal.ZERO); orderDO.setWeightRatio(BigDecimal.ZERO);
} else { } else {
orderDO.setWeightRatio(chargeWeight.divide(chargeVolume, 2, RoundingMode.HALF_UP)); orderDO.setWeightRatio(chargeWeight.divide(chargeVolume,
2, RoundingMode.HALF_UP));
} }
} else { } else {
// 入仓时根据入仓重量体积计算货重比 // 入仓时根据入仓重量体积计算货重比
if (sumVolume.compareTo(BigDecimal.ZERO) == 0) { if (sumVolume.compareTo(BigDecimal.ZERO) == 0) {
orderDO.setWeightRatio(BigDecimal.ZERO); orderDO.setWeightRatio(BigDecimal.ZERO);
} else { } else {
orderDO.setWeightRatio(sumWeight.divide(sumVolume, 2, RoundingMode.HALF_UP)); orderDO.setWeightRatio(sumWeight.divide(sumVolume,
2, RoundingMode.HALF_UP));
} }
} }
// } // }
...@@ -2085,39 +2190,71 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2085,39 +2190,71 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderMapper.updateById(updateOrder); orderMapper.updateById(updateOrder);
orderDO.setOrderItemDOList(newOrderItemDOList); orderDO.setOrderItemDOList(newOrderItemDOList);
// 空运的每日刷新价格业务不执行后面的异常及状态业务修正,只更新前面的价格数据 //空运的每日刷新价格业务不执行后面的异常及状态业务修正,只更新前面的价格数据
if (type != 30) { if (type != 30) {
// 更新完订单所有计价信息后,对未报价的订单项去生成未报价异常(待确认商品不予生成未报价异常) // 更新完订单所有计价信息后,对未报价的订单项去生成未报价异常(待确认商品不予生成未报价异常)
// 只对非拆单子订单进行校验 // 只对非拆单子订单进行校验
int noQuoteOrAutomaticNoQuote = 0; // 0 没有未报价 1 有未报价 2 自动处理了未报价 int noQuoteOrAutomaticNoQuote = 0;
if (Objects.isNull(orderDO.getParentOrderId()) || orderDO.getParentOrderId() == 0 || orderDO.getSplitSeparateOrder()) { // 0 没有未报价 1 有未报价 2 自动处理了未报价
if (Objects.isNull(orderDO.getParentOrderId()) ||
orderDO.getParentOrderId() == 0 ||
orderDO.getSplitSeparateOrder()) {
// 查询待处理的不可出渠道异常 // 查询待处理的不可出渠道异常
List<OrderExceptionDO> orderNoCanShipmentChannelExceptionDOList = orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderDO.getOrderId(), null, OrderExceptionEnum.NOT_SHIPPING_CHANNEL_EXCEPTION.getKey()); List<OrderExceptionDO> orderNoCanShipmentChannelExceptionDOList =
orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderDO.getOrderId(),
null,
OrderExceptionEnum.NOT_SHIPPING_CHANNEL_EXCEPTION.getKey());
orderDO.setIsAutomaticHandleNoCanShipmentChannelException(false); orderDO.setIsAutomaticHandleNoCanShipmentChannelException(false);
// 拆单子订单如果被标记为独立订单,则与非拆单订单一样的处理逻辑 // 拆单子订单如果被标记为独立订单,则与非拆单订单一样的处理逻辑
if (orderDO.getStatus() > OrderStatusEnum.DRAFT.getValue()) { if (orderDO.getStatus() > OrderStatusEnum.DRAFT.getValue()) {
for (OrderItemDO orderItemDO : newOrderItemDOList) { for (OrderItemDO orderItemDO : newOrderItemDOList) {
WarehouseInInfoVO warehouseInInfoVO = orderItemDO.getWarehouseInInfoVO(); WarehouseInInfoVO warehouseInInfoVO =
// 生成未报价异常 (草稿订单除外) orderItemDO.getWarehouseInInfoVO();
noQuoteOrAutomaticNoQuote = this.createOrderNoQuoteException(orderDO, noQuoteOrAutomaticNoQuote, orderItemDO); //生成未报价异常 (草稿订单除外)
if (Objects.equals(TransportTypeShortEnum.AIR_FREIGHT_LINE.getValue(), orderDO.getTransportId()) //创建未报价异常 lanbm 2024-06-06 添加参数type=6,是处理价格异常
|| Objects.equals(TransportTypeShortEnum.AIR_SEA_COMBINED_TRANSPORT.getValue(), orderDO.getTransportId())) { noQuoteOrAutomaticNoQuote =
this.createOrderNoQuoteException(orderDO,
noQuoteOrAutomaticNoQuote,
orderItemDO, type);
//专线空运,海空联运 2024-06-06 添加注释
if (Objects.equals(TransportTypeShortEnum.AIR_FREIGHT_LINE.getValue(),
orderDO.getTransportId())
|| Objects.equals(TransportTypeShortEnum.AIR_SEA_COMBINED_TRANSPORT.getValue(),
orderDO.getTransportId())) {
// 没有待处理的清关费未报价异常,则需要生成 // 没有待处理的清关费未报价异常,则需要生成
noQuoteOrAutomaticNoQuote = this.createClearanceFeeNoQuiteException(orderDO, noQuoteOrAutomaticNoQuote, orderItemDO); //生成清关费异常 lanbm 2024-06-06 添加参数type=6,是处理价格异常
// 这里可能因为自动处理未报价异常(包括未报价清关费异常)时,已经对此业务进行过校验更新,所以需要对品名进行数据再查询,以保证获取的是最新状态 noQuoteOrAutomaticNoQuote =
OrderItemDO item = orderItemMapper.selectById(orderItemDO.getOrderItemId()); this.createClearanceFeeNoQuiteException(orderDO,
// 非拆单订单完成入仓后,如果是已入仓的品名,线路价格设置了单询,且未生成过单询异常,则去生成单询异常 noQuoteOrAutomaticNoQuote,
this.createOrderInquiryException(orderDO, item, warehouseInInfoVO, type); orderItemDO, type);
// 入仓订单,当没有未报价异常(包括未报价清关费异常)时才判断是否需要生成不可出渠道异常和单询异常 // 这里可能因为自动处理未报价异常(包括未报价清关费异常)时,
if (noQuoteOrAutomaticNoQuote != 1 && Objects.nonNull(warehouseInInfoVO) && warehouseInInfoVO.getCartonsNum() > 0) { // 已经对此业务进行过校验更新,所以需要对品名进行数据再查询,以保证获取的是最新状态
OrderItemDO item =
orderItemMapper.selectById(
orderItemDO.getOrderItemId());
// 非拆单订单完成入仓后,如果是已入仓的品名,线路价格设置了单询,
// 且未生成过单询异常,则去生成单询异常
this.createOrderInquiryException(orderDO,
item, warehouseInInfoVO, type);
// 入仓订单,当没有未报价异常(包括未报价清关费异常)
// 时才判断是否需要生成不可出渠道异常和单询异常
if (noQuoteOrAutomaticNoQuote != 1 &&
Objects.nonNull(warehouseInInfoVO) &&
warehouseInInfoVO.getCartonsNum() > 0) {
// 不可出渠道异常 // 不可出渠道异常
this.createNoCanShipmentChannelException(orderDO, event, item, warehouseInInfoVO, type, orderNoCanShipmentChannelExceptionDOList); this.createNoCanShipmentChannelException(orderDO,
event, item, warehouseInInfoVO, type, orderNoCanShipmentChannelExceptionDOList);
} }
} }
// 当订单未报价、或待确认商品时,都需要将预付状态置null // 当订单未报价、或待确认商品时,都需要将预付状态置null
if (orderItemDO.getItemStatus() == -1 || orderItemDO.getIsProd()) { if (orderItemDO.getItemStatus() == -1 ||
orderItemDO.getIsProd()) {
// 因为调用updateById时无法更新置null的数据,所以当订单项未报价时需要单独将是否预付置为null // 因为调用updateById时无法更新置null的数据,所以当订单项未报价时需要单独将是否预付置为null
orderItemMapper.update(null, new LambdaUpdateWrapper<OrderItemDO>().set(OrderItemDO::getIsPayAdvance, null).eq(OrderItemDO::getOrderItemId, orderItemDO.getOrderItemId())); orderItemMapper.update(null,
new LambdaUpdateWrapper<OrderItemDO>().set(OrderItemDO::getIsPayAdvance, null).eq(OrderItemDO::getOrderItemId, orderItemDO.getOrderItemId()));
} }
} }
} }
...@@ -2133,15 +2270,19 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2133,15 +2270,19 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} }
} }
} }
// 创建订单费用变动异常,生成了未报价异常、处理未报价异常、自动处理未报价异常造成的费用变动都不产生费用异常 // 创建订单费用变动异常,生成了未报价异常、处理未报价异常、
// 自动处理未报价异常造成的费用变动都不产生费用异常
if (noQuoteOrAutomaticNoQuote == 0 && type != 6) { if (noQuoteOrAutomaticNoQuote == 0 && type != 6) {
this.createFeeChangeException(orderDO, type, oldFreightAndClearanceFee, newFreightAndClearanceFee); this.createFeeChangeException(orderDO, type,
oldFreightAndClearanceFee,
newFreightAndClearanceFee);
} }
boolean isPayAdvanceException = false; boolean isPayAdvanceException = false;
if ((Objects.nonNull(orderDO.getSumNum()) && orderDO.getSumNum() > 0) if ((Objects.nonNull(orderDO.getSumNum()) && orderDO.getSumNum() > 0)
|| (Objects.nonNull(orderDO.getSumVolume()) && orderDO.getSumVolume().compareTo(BigDecimal.ZERO) > 0) || (Objects.nonNull(orderDO.getSumVolume()) && orderDO.getSumVolume().compareTo(BigDecimal.ZERO) > 0)
|| (Objects.nonNull(orderDO.getSumWeight()) && orderDO.getSumWeight().compareTo(BigDecimal.ZERO) > 0) || (Objects.nonNull(orderDO.getSumWeight()) && orderDO.getSumWeight().compareTo(BigDecimal.ZERO) > 0)
|| (Objects.nonNull(orderDO.getSumQuantity()) && orderDO.getSumQuantity() > 0)) { || (Objects.nonNull(orderDO.getSumQuantity()) && orderDO.getSumQuantity() > 0)) {
if (type == 3 && (Objects.nonNull(orderDO.getParentOrderId()) && orderDO.getParentOrderId() != 0L)) { if (type == 3 && (Objects.nonNull(orderDO.getParentOrderId()) && orderDO.getParentOrderId() != 0L)) {
// 拆单后的子订单直接去生成应收 // 拆单后的子订单直接去生成应收
isPayAdvanceException = this.addOrderReceivable(orderDO, 1); isPayAdvanceException = this.addOrderReceivable(orderDO, 1);
...@@ -2156,12 +2297,22 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2156,12 +2297,22 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} }
if ((type == 6 || type == 10) && isPayAdvanceException) { if ((type == 6 || type == 10) && isPayAdvanceException) {
// TODO 待确定,订单之前处理过预付异常,这时入仓修改产生的新预付异常是否重复生成 // TODO 待确定,订单之前处理过预付异常,这时入仓修改产生的新预付异常是否重复生成
List<OrderExceptionDO> orderExceptionDOList = orderExceptionService.getOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderDO.getOrderId(), null, OrderExceptionEnum.ORDER_PAY_EXCEPTION.getKey()); List<OrderExceptionDO> orderExceptionDOList =
log.info("订单【{}】生成预付异常数量:{}", orderDO.getOrderNo(), CollectionUtil.isEmpty(orderExceptionDOList) ? 0 : orderExceptionDOList.size()); orderExceptionService.getOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderDO.getOrderId(),
null,
OrderExceptionEnum.ORDER_PAY_EXCEPTION.getKey());
log.info("订单【{}】生成预付异常数量:{}", orderDO.getOrderNo(),
CollectionUtil.isEmpty(orderExceptionDOList) ? 0 : orderExceptionDOList.size());
if (CollectionUtil.isEmpty(orderExceptionDOList)) { if (CollectionUtil.isEmpty(orderExceptionDOList)) {
log.info("订单【{}】生成预付异常", orderDO.getOrderNo()); log.info("订单【{}】生成预付异常", orderDO.getOrderNo());
OrderExceptionCreateReqVO orderExceptionCreateReqVO = this.genOrderException(orderDO.getOrderId(), orderDO, null, null, OrderExceptionEnum.ORDER_PAY_EXCEPTION, OrderExceptionCreateReqVO orderExceptionCreateReqVO =
OrderExceptionEnum.ORDER_PAY_EXCEPTION.getZhValueDesc(), OrderExceptionEnum.ORDER_PAY_EXCEPTION.getEnValueDesc()); this.genOrderException(orderDO.getOrderId(),
orderDO,
null,
null,
OrderExceptionEnum.ORDER_PAY_EXCEPTION,
OrderExceptionEnum.ORDER_PAY_EXCEPTION.getZhValueDesc(),
OrderExceptionEnum.ORDER_PAY_EXCEPTION.getEnValueDesc());
orderExceptionService.createOrderException(orderExceptionCreateReqVO); orderExceptionService.createOrderException(orderExceptionCreateReqVO);
} }
} }
...@@ -2172,15 +2323,26 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2172,15 +2323,26 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} }
} }
private void airShipmentStateUpdate(Integer type, List<FeeDto> newFeeDtoList, OrderDO newOrder) { private void airShipmentStateUpdate(Integer type,
if ((Objects.equals(TransportTypeShortEnum.AIR_FREIGHT_LINE.getValue(), newOrder.getTransportId()) List<FeeDto> newFeeDtoList,
|| Objects.equals(TransportTypeShortEnum.AIR_SEA_COMBINED_TRANSPORT.getValue(), newOrder.getTransportId()))) { OrderDO newOrder) {
if ((Objects.equals(TransportTypeShortEnum.AIR_FREIGHT_LINE.getValue(),
newOrder.getTransportId())
|| Objects.equals(TransportTypeShortEnum.AIR_SEA_COMBINED_TRANSPORT.getValue(),
newOrder.getTransportId()))) {
// 检查订单是否有关联报价单 // 检查订单是否有关联报价单
OrderAssociationOfferCostEvent offerCostEvent = new OrderAssociationOfferCostEvent(newOrder.getOrderId(), BigDecimal.ZERO, 0, BigDecimal.ZERO, 0, false); OrderAssociationOfferCostEvent offerCostEvent =
new OrderAssociationOfferCostEvent(newOrder.getOrderId(),
BigDecimal.ZERO, 0, BigDecimal.ZERO,
0, false);
applicationContext.publishEvent(offerCostEvent); applicationContext.publishEvent(offerCostEvent);
// 默认出货状态0或者待出状态1时,无异常、无审批,那么标记为可出2,否则为待出1 // 默认出货状态0或者待出状态1时,无异常、无审批,那么标记为可出2,否则为待出1
if ((type == 3 || type == 4 || type == 5 || newOrder.getStatus() == 5) && (newOrder.getAirShipment() == 0 || newOrder.getAirShipment() == 1)) { if ((type == 3 || type == 4 || type == 5 ||
newOrder.getStatus() == 5) &&
(newOrder.getAirShipment() == 0 ||
newOrder.getAirShipment() == 1)) {
// 默认设置运费与清关费的比较结果为true,因为当订单没有关联报价单时,是不用判断这个条件的,直接跳过 // 默认设置运费与清关费的比较结果为true,因为当订单没有关联报价单时,是不用判断这个条件的,直接跳过
boolean isEqFreight = false; boolean isEqFreight = false;
...@@ -2233,11 +2395,63 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2233,11 +2395,63 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} }
} }
private int createOrderNoQuoteException(OrderDO orderDO, int noQuoteOrAutomaticNoQuote, OrderItemDO orderItemDO) { private int createOrderNoQuoteException(OrderDO orderDO,
List<OrderExceptionDO> orderNoQuoteExceptionDOList = orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndProdIdAndExceptionKey(orderDO.getOrderId(), null, orderItemDO.getProdId(), OrderExceptionEnum.ORDER_NO_QUOTE_EXCEPTION.getKey()); int noQuoteOrAutomaticNoQuote,
OrderItemDO orderItemDO,
Integer type) {
//查询有无未报价异常 lanbm 2024-06-06 添加注释
List<OrderExceptionDO> orderNoQuoteExceptionDOList =
orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndProdIdAndExceptionKey(orderDO.getOrderId(),
null,
orderItemDO.getProdId(),
OrderExceptionEnum.ORDER_NO_QUOTE_EXCEPTION.getKey());
String s = "type=" + type.toString() +
"getTransportId=" + orderDO.getTransportId().toString() +
"getNeedOrderInquiry=" + orderItemDO.getNeedOrderInquiry();
//lanbm 2024-06-06 添加的逻辑点
if (orderDO.getTransportId() == 3
&& orderItemDO.getNeedOrderInquiry() == 1) {
//处理未报价异常,且是空运,且是单询价
if (CollectionUtil.isNotEmpty(orderNoQuoteExceptionDOList)) {
orderExceptionService.autoProcessException(orderDO.getOrderId(),
orderItemDO.getOrderItemId(),
OrderExceptionEnum.ORDER_NO_QUOTE_EXCEPTION,
"单询价,自动处理未报价异常",
OrderExceptionResult.ORDER_NO_QUOTE_EXCEPTION_RESULT.PROCESSED);
noQuoteOrAutomaticNoQuote = 2;
return noQuoteOrAutomaticNoQuote;
}
zTest z = new zTest();
z.setTestname(s);
z.setCreatedate(new Date());
zTestMapper.insert(z);
noQuoteOrAutomaticNoQuote = 2;
return noQuoteOrAutomaticNoQuote;
} else {
zTest z = new zTest();
z.setTestname(s);
z.setCreatedate(new Date());
zTestMapper.insert(z);
}
//lanbm 2024-06-06 添加的逻辑点
if (orderItemDO.getItemStatus() == -1 && !orderItemDO.getIsProd()) { if (orderItemDO.getItemStatus() == -1 && !orderItemDO.getIsProd()) {
if (CollectionUtil.isEmpty(orderNoQuoteExceptionDOList)) { if (CollectionUtil.isEmpty(orderNoQuoteExceptionDOList)) {
OrderExceptionCreateReqVO orderExceptionCreateReqVO = this.genOrderException(orderDO.getOrderId(), orderDO, orderItemDO, null, OrderExceptionEnum.ORDER_NO_QUOTE_EXCEPTION, String.format("订单【%s】中的商品【%s】未报价", orderDO.getOrderNo(), orderItemDO.getProdTitleZh()), String.format("The goods 【%s】 in the order 【%s】 are not quoted", orderItemDO.getProdTitleEn(), orderDO.getOrderNo())); OrderExceptionCreateReqVO orderExceptionCreateReqVO =
this.genOrderException(orderDO.getOrderId(),
orderDO,
orderItemDO,
null,
OrderExceptionEnum.ORDER_NO_QUOTE_EXCEPTION,
String.format("订单【%s】中的商品【%s】未报价6",
orderDO.getOrderNo(),
orderItemDO.getProdTitleZh()),
String.format("The goods 【%s】 in the order 【%s】 are not quoted",
orderItemDO.getProdTitleEn(),
orderDO.getOrderNo()));
// TODO 同一个订单相同品名有相同未报价异常时,不重复产生 // TODO 同一个订单相同品名有相同未报价异常时,不重复产生
orderExceptionService.createOrderException(orderExceptionCreateReqVO); orderExceptionService.createOrderException(orderExceptionCreateReqVO);
} }
...@@ -2245,46 +2459,206 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2245,46 +2459,206 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} else { } else {
if (CollectionUtil.isNotEmpty(orderNoQuoteExceptionDOList)) { if (CollectionUtil.isNotEmpty(orderNoQuoteExceptionDOList)) {
// TODO 当其他业务补充了品名价格后,如果还有待处理的未报价异常,需要同步处理掉 // TODO 当其他业务补充了品名价格后,如果还有待处理的未报价异常,需要同步处理掉
orderExceptionService.autoProcessException(orderDO.getOrderId(), orderItemDO.getOrderItemId(), OrderExceptionEnum.ORDER_NO_QUOTE_EXCEPTION, "设置价格自动处理", OrderExceptionResult.ORDER_NO_QUOTE_EXCEPTION_RESULT.PROCESSED); orderExceptionService.autoProcessException(orderDO.getOrderId(),
orderItemDO.getOrderItemId(),
OrderExceptionEnum.ORDER_NO_QUOTE_EXCEPTION,
"设置价格自动处理",
OrderExceptionResult.ORDER_NO_QUOTE_EXCEPTION_RESULT.PROCESSED);
noQuoteOrAutomaticNoQuote = 2; noQuoteOrAutomaticNoQuote = 2;
} }
} }
return noQuoteOrAutomaticNoQuote; return noQuoteOrAutomaticNoQuote;
} }
private void saveLog(OrderDO orderDO,
OrderItemDO orderItemDO,
WarehouseInInfoVO warehouseInInfoVO,
Integer type)
{
zTest z = new zTest();
z.setCreatedate(new Date());
if(orderDO==null)
{
//订单信息为空
z.setTestname("orderDO为空");
zTestMapper.insert(z);
return;
}
if(orderItemDO==null)
{
//订单明细为空
z.setTestname("orderItemDO为空");
zTestMapper.insert(z);
return;
}
if(warehouseInInfoVO==null)
{
//入仓信息为空
z.setTestname("warehouseInInfoVO为空");
zTestMapper.insert(z);
return;
}
String s = "type=" + type.toString() + "Status=" +
orderDO.getStatus().toString();
if (Objects.nonNull(orderItemDO.getNeedOrderInquiry())) {
s += "NeedOrderInquiry为空";
} else {
//单询价
s += "NeedOrderInquiry=" + orderItemDO.getNeedOrderInquiry();
}
if (Objects.nonNull(warehouseInInfoVO)) {
s += "warehouseInInfo为空";
}
else
{
s += "CartonsNum="
+warehouseInInfoVO.getCartonsNum().toString();
}
if (Objects.nonNull(orderItemDO.getIsHandlerOrderInquiryException())) {
s += "处理过单询价为空";
} else {
s += "处理过单询价为空=" + orderItemDO.getIsHandlerOrderInquiryException();
}
z.setTestname(s);
zTestMapper.insert(z);
}
/*
生成单询价异常 lanbm 2024-06-06 添加注释
*/
private void createOrderInquiryException(OrderDO orderDO,
OrderItemDO orderItemDO,
WarehouseInInfoVO warehouseInInfoVO,
Integer type) {
List<OrderExceptionDO> orderInquiryExceptionDOList =
orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderDO.getOrderId(),
orderItemDO.getOrderItemId(),
OrderExceptionEnum.LINE_LOOP_EXCEPTION.getKey());
saveLog(orderDO, orderItemDO, warehouseInInfoVO, type);
private void createOrderInquiryException(OrderDO orderDO, OrderItemDO orderItemDO, WarehouseInInfoVO warehouseInInfoVO, Integer type) {
List<OrderExceptionDO> orderInquiryExceptionDOList = orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderDO.getOrderId(), orderItemDO.getOrderItemId(), OrderExceptionEnum.LINE_LOOP_EXCEPTION.getKey());
// 避免在前面自动处理未报价异常和清关费未报价异常时的回调,优先创建了单询异常,造成并发的重复创建 // 避免在前面自动处理未报价异常和清关费未报价异常时的回调,优先创建了单询异常,造成并发的重复创建
if (CollectionUtil.isEmpty(orderInquiryExceptionDOList)) { if (CollectionUtil.isEmpty(orderInquiryExceptionDOList)) {
if ((Objects.equals(orderDO.getStatus(), OrderStatusEnum.IN_WAREHOUSE.getValue()) || type == 15 || type == 10) && Objects.nonNull(warehouseInInfoVO) if ((Objects.equals(orderDO.getStatus(), OrderStatusEnum.IN_WAREHOUSE.getValue()) ||
&& warehouseInInfoVO.getCartonsNum() > 0 && Objects.nonNull(orderItemDO.getNeedOrderInquiry()) && orderItemDO.getNeedOrderInquiry() == 1 type == 15 || type == 10) &&
&& Objects.nonNull(orderItemDO.getIsHandlerOrderInquiryException()) && !orderItemDO.getIsHandlerOrderInquiryException()) { Objects.nonNull(warehouseInInfoVO)
&& warehouseInInfoVO.getCartonsNum() > 0
&& Objects.nonNull(orderItemDO.getNeedOrderInquiry())
&& orderItemDO.getNeedOrderInquiry() == 1
&& Objects.nonNull(orderItemDO.getIsHandlerOrderInquiryException())
&& !orderItemDO.getIsHandlerOrderInquiryException()) {
// 产生单询异常 // 产生单询异常
OrderExceptionCreateReqVO orderExceptionCreateReqVO = this.genOrderException(orderDO.getOrderId(), orderDO, orderItemDO, OrderExceptionCreateReqVO orderExceptionCreateReqVO =
null, OrderExceptionEnum.LINE_LOOP_EXCEPTION, String.format("商品【%s】线路单询异常", orderItemDO.getProdTitleZh()), this.genOrderException(orderDO.getOrderId(),
String.format("Line inquiry exception for product [%s]", orderItemDO.getProdTitleEn())); orderDO, orderItemDO,
null, OrderExceptionEnum.LINE_LOOP_EXCEPTION,
String.format("商品【%s】线路单询异常",
orderItemDO.getProdTitleZh()),
String.format("Line inquiry exception for product [%s]",
orderItemDO.getProdTitleEn()));
orderExceptionService.createOrderException(orderExceptionCreateReqVO); orderExceptionService.createOrderException(orderExceptionCreateReqVO);
// 标记已产生过单询异常, 并更新到数据库 // 标记已产生过单询异常, 并更新到数据库
orderItemDO.setIsHandlerOrderInquiryException(Boolean.TRUE); orderItemDO.setIsHandlerOrderInquiryException(Boolean.TRUE);
orderItemMapper.update(null, new LambdaUpdateWrapper<OrderItemDO>().set(OrderItemDO::getIsHandlerOrderInquiryException, true).eq(OrderItemDO::getOrderItemId, orderItemDO.getOrderItemId())); orderItemMapper.update(null,
new LambdaUpdateWrapper<OrderItemDO>().
set(OrderItemDO::getIsHandlerOrderInquiryException, true).
eq(OrderItemDO::getOrderItemId,
orderItemDO.getOrderItemId()));
} else {
zTest z = new zTest();
z.setTestname("不符合产生单询价条件");
z.setCreatedate(new Date());
zTestMapper.insert(z);
} }
} else {
zTest z = new zTest();
z.setTestname("orderInquiryExceptionDOList 为空");
z.setCreatedate(new Date());
zTestMapper.insert(z);
} }
} }
private int createClearanceFeeNoQuiteException(OrderDO orderDO, int noQuoteOrAutomaticNoQuote, OrderItemDO orderItemDO) { /*
清关价异常处理 lanbm 2024-06-06 添加注释
*/
private int createClearanceFeeNoQuiteException(OrderDO orderDO,
int noQuoteOrAutomaticNoQuote,
OrderItemDO orderItemDO,
Integer type) {
// 查询是否有重量超限异常,如果有则不生成清关费异常 // 查询是否有重量超限异常,如果有则不生成清关费异常
// TODO 查询是否有重量超限异常和渠道包装重量超限异常,如果有则不生成清关费异常 // TODO 查询是否有重量超限异常和渠道包装重量超限异常,如果有则不生成清关费异常
List<OrderExceptionDO> goodsOverweightExceptionDOList = orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndProdIdAndExceptionKeys(orderDO.getOrderId(), null, orderItemDO.getProdId(), List<OrderExceptionDO> goodsOverweightExceptionDOList =
CollectionUtil.newArrayList(OrderExceptionEnum.GOODS_OVERWEIGHT_EXCEPTION.getKey(), OrderExceptionEnum.LINE_WEIGHT_EXCEPTION.getKey())); orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndProdIdAndExceptionKeys(orderDO.getOrderId(),
null,
orderItemDO.getProdId(),
CollectionUtil.newArrayList(OrderExceptionEnum.GOODS_OVERWEIGHT_EXCEPTION.getKey(), OrderExceptionEnum.LINE_WEIGHT_EXCEPTION.getKey()));
String s = "type=" + type.toString() + " TransportId=" +
orderDO.getTransportId().toString() +
" NeedOrderInquiry=" + orderItemDO.getNeedOrderInquiry().toString();
//lanbm 2024-06-06 添加的逻辑点
if (orderDO.getTransportId() == 3
&& orderItemDO.getNeedOrderInquiry() == 1) {
//根据订单号查询是否有清关费异常
List<OrderExceptionDO> orderClearanceFeeNoQuoteExceptionDOList =
orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(
orderDO.getOrderId(),
orderItemDO.getOrderItemId(),
OrderExceptionEnum.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION.getKey());
if (CollectionUtil.isNotEmpty(orderClearanceFeeNoQuoteExceptionDOList)) {
// 当其他业务补充了品名空运清关费价格后,如果还有待处理的清关费未报价异常,需要同步处理掉
orderExceptionService.autoProcessException(orderDO.getOrderId(),
orderItemDO.getOrderItemId(),
OrderExceptionEnum.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION,
"单询价,自动处理清关价异常",
OrderExceptionResult.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION_RESULT.PROCESSED);
noQuoteOrAutomaticNoQuote = 2;
return noQuoteOrAutomaticNoQuote;
}
zTest z = new zTest();
z.setTestname(s);
z.setCreatedate(new Date());
zTestMapper.insert(z);
noQuoteOrAutomaticNoQuote = 2;
return noQuoteOrAutomaticNoQuote;
} else {
zTest z = new zTest();
z.setTestname(s);
z.setCreatedate(new Date());
}
//end lanbm 2024-06-06 添加的逻辑点
// 渠道重量超限异常 channel_packaging_overweight_exception // 渠道重量超限异常 channel_packaging_overweight_exception
// List<OrderExceptionDO> channelPackagingOverweightExceptionDOList = orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderDO.getOrderId(), orderItemDO.getOrderItemId(), OrderExceptionEnum.CHANNEL_PACKAGING_OVERWEIGHT_EXCEPTION.getKey()); // List<OrderExceptionDO> channelPackagingOverweightExceptionDOList = orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderDO.getOrderId(), orderItemDO.getOrderItemId(), OrderExceptionEnum.CHANNEL_PACKAGING_OVERWEIGHT_EXCEPTION.getKey());
// if (CollectionUtil.isEmpty(goodsOverweightExceptionDOList) && CollectionUtil.isEmpty(channelPackagingOverweightExceptionDOList)) { // if (CollectionUtil.isEmpty(goodsOverweightExceptionDOList) && CollectionUtil.isEmpty(channelPackagingOverweightExceptionDOList)) {
if (CollectionUtil.isEmpty(goodsOverweightExceptionDOList) || goodsOverweightExceptionDOList.size() == 0) { if (CollectionUtil.isEmpty(goodsOverweightExceptionDOList) ||
List<OrderExceptionDO> orderClearanceFeeNoQuoteExceptionDOList = orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderDO.getOrderId(), orderItemDO.getOrderItemId(), OrderExceptionEnum.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION.getKey()); goodsOverweightExceptionDOList.size() == 0) {
if (orderItemDO.getCharging() == 0 && (Objects.isNull(orderItemDO.getOriginalClearanceFreight()) || orderItemDO.getOriginalClearanceFreight().compareTo(BigDecimal.ZERO) == 0)
&& ((Objects.isNull(orderItemDO.getChannelManualPricing()) || !orderItemDO.getChannelManualPricing()) List<OrderExceptionDO> orderClearanceFeeNoQuoteExceptionDOList =
&& (Objects.isNull(orderItemDO.getSpecialPriceType()) || !orderItemDO.getSpecialPriceType()) orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderDO.getOrderId(),
&& (Objects.isNull(orderItemDO.getSplitCustomPriceType()) || !orderItemDO.getSplitCustomPriceType()))) { orderItemDO.getOrderItemId(),
OrderExceptionEnum.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION.getKey());
//运费加清关价才生成清关费异常 lanbm 2024-06-06 添加注释
if (orderItemDO.getCharging() == 0 &&
(Objects.isNull(orderItemDO.getOriginalClearanceFreight()) ||
orderItemDO.getOriginalClearanceFreight().compareTo(BigDecimal.ZERO) == 0)
&& ((Objects.isNull(orderItemDO.getChannelManualPricing()) ||
!orderItemDO.getChannelManualPricing())
&& (Objects.isNull(orderItemDO.getSpecialPriceType()) ||
!orderItemDO.getSpecialPriceType())
&& (Objects.isNull(orderItemDO.getSplitCustomPriceType()) ||
!orderItemDO.getSplitCustomPriceType()))) {
if (CollectionUtil.isEmpty(orderClearanceFeeNoQuoteExceptionDOList)) { if (CollectionUtil.isEmpty(orderClearanceFeeNoQuoteExceptionDOList)) {
// 1-未设置商品清关费, 2-区间未匹配上 // 1-未设置商品清关费, 2-区间未匹配上
int productPriceEmptyType = orderItemDO.getProductPriceEmptyType(); int productPriceEmptyType = orderItemDO.getProductPriceEmptyType();
...@@ -2292,7 +2666,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2292,7 +2666,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
int channelPriceEmptyType = orderItemDO.getChannelPriceEmptyType(); int channelPriceEmptyType = orderItemDO.getChannelPriceEmptyType();
// 是否超出空运重量上限 // 是否超出空运重量上限
boolean isAirWeightLimit = orderItemDO.getIsAirWeightLimit(); boolean isAirWeightLimit = orderItemDO.getIsAirWeightLimit();
String descZh = "订单中商品%s的清关费未设置或已过期"; String descZh = "订单中商品%s的清关费未设置或已过期6";
String descEn = "The customs clearance fee for item %s in the order has not been set or has expired"; String descEn = "The customs clearance fee for item %s in the order has not been set or has expired";
if (productPriceEmptyType == 2) { if (productPriceEmptyType == 2) {
descZh = "订单中商品%s的清关费区间未匹配上"; descZh = "订单中商品%s的清关费区间未匹配上";
...@@ -2300,9 +2674,14 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -2300,9 +2674,14 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} }
descZh = String.format(descZh, orderItemDO.getProdTitleZh()); descZh = String.format(descZh, orderItemDO.getProdTitleZh());
descEn = String.format(descEn, orderItemDO.getProdTitleEn()); descEn = String.format(descEn, orderItemDO.getProdTitleEn());
// 当前空运或海空联运订单下单时,没又渠道id,则生成渠道异常 //当前空运或海空联运订单下单时,没又渠道id,则生成渠道异常
OrderExceptionCreateReqVO orderExceptionCreateReqVO = this.genOrderException(orderDO.getOrderId(), orderDO, orderItemDO, null, OrderExceptionEnum.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION, OrderExceptionCreateReqVO orderExceptionCreateReqVO =
descZh, descEn); this.genOrderException(orderDO.getOrderId(),
orderDO,
orderItemDO, null,
OrderExceptionEnum.CUSTOMS_FEE_NOT_QUOTE_EXCEPTION,
descZh, descEn);
orderExceptionService.createOrderException(orderExceptionCreateReqVO); orderExceptionService.createOrderException(orderExceptionCreateReqVO);
} }
noQuoteOrAutomaticNoQuote = 1; noQuoteOrAutomaticNoQuote = 1;
......
...@@ -1199,7 +1199,7 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper, ...@@ -1199,7 +1199,7 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
updateReqVO.getStepPrice() == 1) { updateReqVO.getStepPrice() == 1) {
List<ProductPriceStepDO> allStepList = buildAllStepList(updateReqVO); List<ProductPriceStepDO> allStepList = buildAllStepList(updateReqVO);
clearAndSavePriceStepList(Collections.singletonList( clearAndSavePriceStepList(Collections.singletonList(
updateReqVO.getId()), updateReqVO.getId()),
allStepList, allStepList,
priceTransportTypeMap, priceTransportTypeMap,
false); false);
...@@ -1241,6 +1241,11 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper, ...@@ -1241,6 +1241,11 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
hasPrice = allPrice != null && allPrice.floatValue() > 0; hasPrice = allPrice != null && allPrice.floatValue() > 0;
} }
//lanbm 2024-06-06 处理单询价问题添加的逻辑点。
if (productPriceDO.getNeedOrderInquiry() == 1) {
hasPrice = true;
}
//没有价格信息不继续后面的处理 //没有价格信息不继续后面的处理
if (!hasPrice) continue; if (!hasPrice) continue;
......
...@@ -156,7 +156,10 @@ public class ShipmentAirLoadExcelExportListener { ...@@ -156,7 +156,10 @@ public class ShipmentAirLoadExcelExportListener {
// 不存在则创建一个目录 // 不存在则创建一个目录
fileDir.mkdirs(); fileDir.mkdirs();
} }
String fileName = event.getUserId().toString().concat(StrUtil.DASHED).concat(event.getUserType().toString()).concat(StrUtil.DASHED).concat(nowTime).concat("shipment_preload.xlsx"); String fileName = event.getUserId().toString().
concat(StrUtil.DASHED).concat(event.getUserType().
toString()).concat(StrUtil.DASHED).
concat(nowTime).concat("shipment_preload.xlsx");
InputStream inputStream = null; InputStream inputStream = null;
inputStream = this.getClass().getClassLoader().getResourceAsStream(ueProperties.getTemplatesUrl() + "/airLoad.xlsx"); inputStream = this.getClass().getClassLoader().getResourceAsStream(ueProperties.getTemplatesUrl() + "/airLoad.xlsx");
JSONObject jsonObject = JSONObject.parseObject(event.getRequestParams()); JSONObject jsonObject = JSONObject.parseObject(event.getRequestParams());
...@@ -230,14 +233,19 @@ public class ShipmentAirLoadExcelExportListener { ...@@ -230,14 +233,19 @@ public class ShipmentAirLoadExcelExportListener {
Map<String,Integer> mergePkgCountMap = new LinkedHashMap<>(); Map<String,Integer> mergePkgCountMap = new LinkedHashMap<>();
int colorIndex = 0; int colorIndex = 0;
//以订单ID分组 //以订单ID分组
Map<Long, List<BoxPreloadGoodsBackVO>> orderMap = goodsItemList.stream().filter(item -> item.getSecId().longValue()==part.longValue() && StringUtils.isNotBlank(item.getWarehouseInInfo())) Map<Long, List<BoxPreloadGoodsBackVO>> orderMap =
.collect(Collectors.groupingBy(BoxPreloadGoodsBackVO::getOrderId,LinkedHashMap::new,Collectors.toList())); goodsItemList.stream().filter(item -> item.getSecId().longValue()==part.longValue() &&
StringUtils.isNotBlank(item.getWarehouseInInfo()))
.collect(Collectors.groupingBy(BoxPreloadGoodsBackVO::getOrderId,
LinkedHashMap::new,Collectors.toList()));
for (Map.Entry<Long, List<BoxPreloadGoodsBackVO>> entry : orderMap.entrySet()) { for (Map.Entry<Long, List<BoxPreloadGoodsBackVO>> entry : orderMap.entrySet()) {
Long orderId = entry.getKey(); Long orderId = entry.getKey();
Long pkgId = entry.getValue().get(0).getPkgId(); Long pkgId = entry.getValue().get(0).getPkgId();
OrderBackInfoDto orderInfo = orderQueryService.info(orderId); OrderBackInfoDto orderInfo = orderQueryService.info(orderId);
OrderDO orderDO = orderService.selectOne(OrderDO::getOrderId, orderId); OrderDO orderDO = orderService.selectOne(OrderDO::getOrderId, orderId);
List<OrderWarehouseInBackItemVO> orderWarehouseInBackItemVOS = orderWarehouseInService.getOrderWarehouseInListOrderByInTime(orderId); List<OrderWarehouseInBackItemVO> orderWarehouseInBackItemVOS =
orderWarehouseInService.getOrderWarehouseInListOrderByInTime(orderId);
for (OrderWarehouseInBackItemVO item : orderWarehouseInBackItemVOS) { for (OrderWarehouseInBackItemVO item : orderWarehouseInBackItemVOS) {
int andIncrement = colorRowNum.getAndIncrement(); int andIncrement = colorRowNum.getAndIncrement();
if (StringUtils.isNotBlank(item.getOrderWarehouseInDetails())) { if (StringUtils.isNotBlank(item.getOrderWarehouseInDetails())) {
...@@ -278,7 +286,8 @@ public class ShipmentAirLoadExcelExportListener { ...@@ -278,7 +286,8 @@ public class ShipmentAirLoadExcelExportListener {
preloadDto.setBoxGauge(item.getBoxGauge()); preloadDto.setBoxGauge(item.getBoxGauge());
preloadDto.setSumVolume(item.getVolume()); preloadDto.setSumVolume(item.getVolume());
preloadDto.setSumWeight(item.getWeight()); preloadDto.setSumWeight(item.getWeight());
List<BoxPkgOrderDO> boxPkgOrderDOS = boxPkgOrderService.selectList(BoxPkgOrderDO::getOrderId, orderId); List<BoxPkgOrderDO> boxPkgOrderDOS =
boxPkgOrderService.selectList(BoxPkgOrderDO::getOrderId, orderId);
if (CollectionUtil.isNotEmpty(boxPkgOrderDOS)) { if (CollectionUtil.isNotEmpty(boxPkgOrderDOS)) {
preloadDto.setMergePkgNum(1); preloadDto.setMergePkgNum(1);
BoxMergePkgDO boxMergePkg = boxMergePkgService.getBoxMergePkg(boxPkgOrderDOS.get(0).getPkgId()); BoxMergePkgDO boxMergePkg = boxMergePkgService.getBoxMergePkg(boxPkgOrderDOS.get(0).getPkgId());
...@@ -326,7 +335,8 @@ public class ShipmentAirLoadExcelExportListener { ...@@ -326,7 +335,8 @@ public class ShipmentAirLoadExcelExportListener {
} }
if (CollectionUtil.isNotEmpty(item.getOrderWarehouseInDetailsVOList())) { if (CollectionUtil.isNotEmpty(item.getOrderWarehouseInDetailsVOList())) {
mergeCount = mergeCount + item.getOrderWarehouseInDetailsVOList().size(); mergeCount = mergeCount + item.getOrderWarehouseInDetailsVOList().size();
List<OrderWarehouseInDetailsVO> orderWarehouseInDetailsVOList = item.getOrderWarehouseInDetailsVOList(); List<OrderWarehouseInDetailsVO> orderWarehouseInDetailsVOList =
item.getOrderWarehouseInDetailsVOList();
for (int j = 0; j < orderWarehouseInDetailsVOList.size(); j++) { for (int j = 0; j < orderWarehouseInDetailsVOList.size(); j++) {
OrderWarehouseInDetailsVO orderWarehouseInDetailsVO = orderWarehouseInDetailsVOList.get(j); OrderWarehouseInDetailsVO orderWarehouseInDetailsVO = orderWarehouseInDetailsVOList.get(j);
int andIncrement1 = colorRowNum.getAndIncrement(); int andIncrement1 = colorRowNum.getAndIncrement();
......
...@@ -251,7 +251,8 @@ public class ShipmentLoadExcelExportListener { ...@@ -251,7 +251,8 @@ public class ShipmentLoadExcelExportListener {
//以订单ID分组 //以订单ID分组
Map<Long, List<BoxPreloadGoodsBackVO>> orderMap = Map<Long, List<BoxPreloadGoodsBackVO>> orderMap =
goodsItemList.stream().filter(item -> item.getSecId().longValue() == part.longValue() && goodsItemList.stream().filter(item -> item.getSecId().longValue() ==
part.longValue() &&
StringUtils.isNotBlank(item.getWarehouseInInfo())) StringUtils.isNotBlank(item.getWarehouseInInfo()))
.collect(Collectors.groupingBy(BoxPreloadGoodsBackVO::getOrderId, .collect(Collectors.groupingBy(BoxPreloadGoodsBackVO::getOrderId,
LinkedHashMap::new, Collectors.toList())); LinkedHashMap::new, Collectors.toList()));
......
...@@ -261,7 +261,13 @@ public class BoxLadingBillServiceImpl extends AbstractService<BoxLadingBillMappe ...@@ -261,7 +261,13 @@ public class BoxLadingBillServiceImpl extends AbstractService<BoxLadingBillMappe
// } // }
// } // }
// headMap.put("description",boxLadingBillDO.getGoodsDesc()+"\r\n"+stringBuffer.toString()); // headMap.put("description",boxLadingBillDO.getGoodsDesc()+"\r\n"+stringBuffer.toString());
headMap.put("description", boxLadingBillDO.getGoodsDesc()); //lanbm 2024-06-06 添加保存数量和单位
String sDes=boxLadingBillDO.getPackageNum()+boxLadingBillDO.getPackageUnit();
sDes+="\r\n"+boxLadingBillDO.getGoodsDesc();
headMap.put("description",sDes);
//headMap.put("description", boxLadingBillDO.getGoodsDesc());
//end lanbm 2024-06-06 添加保存数量和单位
headMap.put("weight", boxLadingBillDO.getKgs() == null ? "" : String.valueOf(boxLadingBillDO.getKgs().doubleValue())); headMap.put("weight", boxLadingBillDO.getKgs() == null ? "" : String.valueOf(boxLadingBillDO.getKgs().doubleValue()));
headMap.put("volume", boxLadingBillDO.getCbm() == null ? "" : String.valueOf(boxLadingBillDO.getCbm().doubleValue())); headMap.put("volume", boxLadingBillDO.getCbm() == null ? "" : String.valueOf(boxLadingBillDO.getCbm().doubleValue()));
headMap.put("boxNo", boxLadingBillDO.getContainerSealNo()); headMap.put("boxNo", boxLadingBillDO.getContainerSealNo());
......
...@@ -178,7 +178,8 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B ...@@ -178,7 +178,8 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B
} }
BoxMergePkgDO boxMergePkgDO = boxMergePkgService.selectOne(new LambdaQueryWrapperX<BoxMergePkgDO>().eq(BoxMergePkgDO::getPkgNum,createReqVO.getPkgNum())); BoxMergePkgDO boxMergePkgDO =
boxMergePkgService.selectOne(new LambdaQueryWrapperX<BoxMergePkgDO>().eq(BoxMergePkgDO::getPkgNum,createReqVO.getPkgNum()));
vo.setPkgId(boxMergePkgDO.getId()) ; vo.setPkgId(boxMergePkgDO.getId()) ;
List<BoxPkgOrderDO> pkgOrderDO = boxPkgOrderMapper.selectList(new LambdaQueryWrapperX<BoxPkgOrderDO>().eq(BoxPkgOrderDO::getOrderId,orderId).eq(BoxPkgOrderDO::getPkgId,boxMergePkgDO.getId())); List<BoxPkgOrderDO> pkgOrderDO = boxPkgOrderMapper.selectList(new LambdaQueryWrapperX<BoxPkgOrderDO>().eq(BoxPkgOrderDO::getOrderId,orderId).eq(BoxPkgOrderDO::getPkgId,boxMergePkgDO.getId()));
if(vo.getOrderId()!=null && vo.getPkgId()!=null){//订单和包裹id 不为空,调用装箱方法 if(vo.getOrderId()!=null && vo.getPkgId()!=null){//订单和包裹id 不为空,调用装箱方法
......
...@@ -209,7 +209,8 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin ...@@ -209,7 +209,8 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
Long shipmentId = preloadGoodsDOList.get(0).getShipmentId(); Long shipmentId = preloadGoodsDOList.get(0).getShipmentId();
makeBillOfLading.setShipmentId(shipmentId); makeBillOfLading.setShipmentId(shipmentId);
LadingTemplateDO ladingTemplateByLineId = ladingTemplateService.getLadingTemplateByLineId(info.getLineId()); LadingTemplateDO ladingTemplateByLineId =
ladingTemplateService.getLadingTemplateByLineId(info.getLineId());
if (ladingTemplateByLineId == null) { if (ladingTemplateByLineId == null) {
throw exception(LADING_TEMPLATE_NOT_SET); throw exception(LADING_TEMPLATE_NOT_SET);
} }
...@@ -436,10 +437,12 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin ...@@ -436,10 +437,12 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
orderInfoMap.put("consigneePhone", "+" + info.getConsigneeVO().getCountryCode() + info.getConsigneeVO().getPhone()); orderInfoMap.put("consigneePhone", "+" + info.getConsigneeVO().getCountryCode() + info.getConsigneeVO().getPhone());
orderInfoMap.put("consignor", info.getConsignorVO().getName()); orderInfoMap.put("consignor", info.getConsignorVO().getName());
orderInfoMap.put("consignorPhone", "+" + info.getConsignorVO().getCountryCode() + info.getConsignorVO().getPhone()); orderInfoMap.put("consignorPhone", "+" + info.getConsignorVO().getCountryCode() + info.getConsignorVO().getPhone());
if (info.getDrawee() == 1) { //订单付款人为发货人 if (info.getDrawee() == 1) {
//订单付款人为发货人
String shipperName = getShipperNameAndConsignee(info, 1, orderInfoMap); String shipperName = getShipperNameAndConsignee(info, 1, orderInfoMap);
orderInfoMap.put("consignor", shipperName); orderInfoMap.put("consignor", shipperName);
} else if (info.getDrawee() == 2) { //订单付款人为收货人 } else if (info.getDrawee() == 2) {
//订单付款人为收货人
String consigneeName = getShipperNameAndConsignee(info, 2, orderInfoMap); String consigneeName = getShipperNameAndConsignee(info, 2, orderInfoMap);
orderInfoMap.put("consignee", consigneeName); orderInfoMap.put("consignee", consigneeName);
} }
......
...@@ -187,7 +187,8 @@ public class BoxPreloadGoodsBackVO { ...@@ -187,7 +187,8 @@ public class BoxPreloadGoodsBackVO {
private WarehouseInInfoVO getWarehouseInInfoVO() { private WarehouseInInfoVO getWarehouseInInfoVO() {
if(warehouseInInfoVO != null) return warehouseInInfoVO; if(warehouseInInfoVO != null) return warehouseInInfoVO;
if(StringUtils.isNotEmpty(this.warehouseInInfo)) { if(StringUtils.isNotEmpty(this.warehouseInInfo)) {
warehouseInInfoVO = JSONObject.parseObject(this.warehouseInInfo, WarehouseInInfoVO.class); warehouseInInfoVO = JSONObject.parseObject(this.warehouseInInfo,
WarehouseInInfoVO.class);
} }
return warehouseInInfoVO; return warehouseInInfoVO;
} }
......
...@@ -163,7 +163,6 @@ public class ReceiptDO extends BaseDO { ...@@ -163,7 +163,6 @@ public class ReceiptDO extends BaseDO {
*/ */
private Integer openInvoice; private Integer openInvoice;
/** /**
* 状态:0:草稿, 1待收款, 2待核销,3已部分核销,4已核销,5已核销待开票,6已开票 * 状态:0:草稿, 1待收款, 2待核销,3已部分核销,4已核销,5已核销待开票,6已开票
*/ */
......
...@@ -78,6 +78,7 @@ public class ReceiptItemDO extends BaseDO { ...@@ -78,6 +78,7 @@ public class ReceiptItemDO extends BaseDO {
* 状态0待核销,1已核销 * 状态0待核销,1已核销
*/ */
private Integer status; private Integer status;
/** /**
* 核销货币id * 核销货币id
*/ */
......
...@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil; ...@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.OrderNumberLogEvent; import cn.iocoder.yudao.framework.apollo.core.event.OrderNumberLogEvent;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.code.CodeUtils; import cn.iocoder.yudao.framework.common.util.code.CodeUtils;
import cn.iocoder.yudao.framework.common.util.collectors.CollectorsUtil;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO; import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService; import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
...@@ -26,6 +27,7 @@ import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptApproval.ReceiptAppr ...@@ -26,6 +27,7 @@ import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptApproval.ReceiptAppr
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO; import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableDO; import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableDO;
import cn.iocoder.yudao.module.wealth.dal.mysql.receipt.ReceiptMapper; import cn.iocoder.yudao.module.wealth.dal.mysql.receipt.ReceiptMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptAccount.ReceiptAccountMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.ReceiptItemMapper; import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.ReceiptItemMapper;
import cn.iocoder.yudao.module.wealth.enums.ReceiptStatusEnum; import cn.iocoder.yudao.module.wealth.enums.ReceiptStatusEnum;
import cn.iocoder.yudao.module.wealth.service.receiptAccount.ReceiptAccountService; import cn.iocoder.yudao.module.wealth.service.receiptAccount.ReceiptAccountService;
...@@ -48,6 +50,7 @@ import javax.annotation.Resource; ...@@ -48,6 +50,7 @@ import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.NumberFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -67,9 +70,13 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO ...@@ -67,9 +70,13 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
private ReceiptMapper receiptMapper; private ReceiptMapper receiptMapper;
@Resource @Resource
private ReceivableService receivableService; private ReceivableService receivableService;
@Resource @Resource
private ReceiptAccountService receiptAccountService; private ReceiptAccountService receiptAccountService;
@Resource
private ReceiptAccountMapper receiptAccountMapper;
@Resource @Resource
private ReceiptItemMapper receiptItemMapper; private ReceiptItemMapper receiptItemMapper;
@Autowired @Autowired
...@@ -86,6 +93,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO ...@@ -86,6 +93,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
@Resource @Resource
CurrencyApi currencyApi; CurrencyApi currencyApi;
private static final String RECEIPT_NEW_NUMBER = "receipt:new:number"; private static final String RECEIPT_NEW_NUMBER = "receipt:new:number";
...@@ -430,7 +438,8 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO ...@@ -430,7 +438,8 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
} }
@Override @Override
public PageResult<ReceiptBackVO> getReceiptPage(ReceiptQueryVO query, PageVO page) { public PageResult<ReceiptBackVO> getReceiptPage(ReceiptQueryVO query,
PageVO page) {
page.setField("er.id"); page.setField("er.id");
IPage<ReceiptBackVO> mpPage = MyBatisUtils.buildPage(page); IPage<ReceiptBackVO> mpPage = MyBatisUtils.buildPage(page);
receiptMapper.getReceiptBackPage(mpPage, query); receiptMapper.getReceiptBackPage(mpPage, query);
...@@ -441,21 +450,173 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO ...@@ -441,21 +450,173 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
.map(ReceiptBackVO::getId) .map(ReceiptBackVO::getId)
.collect(Collectors.toList()); .collect(Collectors.toList());
//根据List获取本页中所有的明细信息 //根据List获取本页中所有的明细信息
LambdaQueryWrapper<ReceiptItemDO> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ReceiptItemDO> lambdaQueryWrapper =
new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(ReceiptItemDO::getReceiptId, idList); lambdaQueryWrapper.in(ReceiptItemDO::getReceiptId, idList);
//所有收款单的明细 //所有收款单的明细
List<ReceiptItemDO> listItem = List<ReceiptItemDO> listItem =
receiptItemMapper.selectList(lambdaQueryWrapper); receiptItemMapper.selectList(lambdaQueryWrapper);
LambdaQueryWrapper<ReceiptAccountDO> lambdaQueryWrapper2 =
new LambdaQueryWrapper<>();
lambdaQueryWrapper2.in(ReceiptAccountDO::getReceiptId, idList);
List<ReceiptAccountDO> ReceiptAccountList =
receiptAccountMapper.selectList(lambdaQueryWrapper2);
Map<Integer, CurrencyRespDTO> currencyMap = currencyApi.getAllCurrency();
for (ReceiptBackVO r : mpPage.getRecords() for (ReceiptBackVO r : mpPage.getRecords()
) { ) {
String sR = getReceiptMxStatus(listItem, r.getId()); String sR = getReceiptMxStatus(listItem, r.getId());
r.setMxStatus(sR); r.setMxStatus(sR);
//应收
String s1 = getYSShow(ReceiptAccountList, r.getId(), currencyMap);
r.setYsShow(s1);
//实收
String s2 = getSSShow(listItem, r.getId(), currencyMap);
r.setSsShow(s2);
//核销比例
r.setHxBiLi(getHxBili(ReceiptAccountList,
listItem, r.getId()));
} }
return PageResult.of(mpPage); return PageResult.of(mpPage);
} }
private String getPercentage(BigDecimal part, BigDecimal total) {
BigDecimal percentage = part.divide(total, 5,
BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
// 输出百分比
String sR = format(percentage) + "%";
return sR;
}
private String format(BigDecimal value) {
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMinimumFractionDigits(2);
numberFormat.setMaximumFractionDigits(2);
return numberFormat.format(value.doubleValue());
}
/*
获取核销比例 lanbm 2024-06-06 add
*/
private String getHxBili(List<ReceiptAccountDO> ReceiptAccountList,
List<ReceiptItemDO> listItemList,
long ReceiptId) {
String sR = "0";
if (CollectionUtil.isEmpty(ReceiptAccountList))
return sR;
if (CollectionUtil.isEmpty(listItemList)) {
return sR;
}
List<ReceiptAccountDO> ReceiptAccountList1 =
ReceiptAccountList.stream().filter(i -> i.getReceiptId() == ReceiptId).
collect(Collectors.toList());
if (CollectionUtil.isEmpty(ReceiptAccountList1)) return sR;
BigDecimal bTotal = new BigDecimal(0);
BigDecimal bPart = new BigDecimal(0);
for (ReceiptAccountDO do1 : ReceiptAccountList1
) {
bTotal = bTotal.add(do1.getWriteOffAmount());
}
//总值为0,直接返回空
if (bTotal.compareTo(BigDecimal.ZERO) == 0) {
return sR;
}
//已核销状态记录
List<ReceiptItemDO> list =
listItemList.stream().filter(i -> i.getReceiptId() == ReceiptId
&& i.getStatus() != 0).collect(Collectors.toList());
if (CollectionUtil.isEmpty(list)) {
//核销金额为0 核销比例为空
return sR;
}
for (ReceiptItemDO do2 : list
) {
bPart = bPart.add(do2.getWriteOffAmount());
}
//计算百分比
sR = getPercentage(bPart, bTotal);
return sR;
}
/*
lanbm 2024-06-06 add
应收款
*/
private String getYSShow(List<ReceiptAccountDO> ReceiptAccountList,
long ReceiptId,
Map<Integer, CurrencyRespDTO> currencyMap) {
String sR = "";
if (CollectionUtil.isEmpty(ReceiptAccountList)) {
return sR;
}
List<ReceiptAccountDO> ReceiptAccountList1 =
ReceiptAccountList.stream().filter(i -> i.getReceiptId() == ReceiptId).
collect(Collectors.toList());
if (CollectionUtil.isEmpty(ReceiptAccountList1))
return sR;
for (ReceiptAccountDO do1 : ReceiptAccountList1
) {
BigDecimal b1 = do1.getReceivableAmount();
String s1 = b1.toString();
String s2 = "";
//获取币种
if (do1.getCurrencyId() != null) {
int n1 = Integer.parseInt(do1.getCurrencyId().toString());
s2 = currencyMap.get(n1).getTitleZh();
}
sR += s1 + s2 + "\r\n";
}
return sR;
}
/*
lanbm 2024-06-06 add
实收金额
*/
private String getSSShow(List<ReceiptItemDO> listItemList,
long ReceiptId,
Map<Integer, CurrencyRespDTO> currencyMap) {
String sR = "";
if (CollectionUtil.isEmpty(listItemList)) {
return sR;
}
List<ReceiptItemDO> list =
listItemList.stream().filter(i -> i.getReceiptId() == ReceiptId).
collect(Collectors.toList());
if (CollectionUtil.isEmpty(list)) return sR;
//根据币种分组求和
Map<Long, BigDecimal> dataMap =
list.stream().filter(t -> t.getCurrencyId() != null)
.collect(Collectors.groupingBy(ReceiptItemDO::getCurrencyId,
CollectorsUtil.summingBigDecimal(ReceiptItemDO::getAmount)));
//遍历币种信息
for (Map.Entry<Long, BigDecimal> entry : dataMap.entrySet()) {
String key = entry.getKey().toString();
String s1 = entry.getValue().toString();
String s2 = "";
//获取币种
int n1 = Integer.parseInt(key);
s2 = currencyMap.get(n1).getTitleZh();
sR += s1 + s2 + "\r\n";
}
return sR;
}
/* /*
lanbm 2024-05-13 计算收款单明细状态 lanbm 2024-05-13 计算收款单明细状态
收款单主表 收款单主表
......
package cn.iocoder.yudao.module.wealth.service.receiptItem; package cn.iocoder.yudao.module.wealth.service.receiptItem;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.io.FileModel;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.BankReceiptDetailsMapper; import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.BankReceiptDetailsMapper;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemReq; import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemReq;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp; import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/* /*
lanbm 2024-05-18 add lanbm 2024-05-18 add
...@@ -25,6 +32,11 @@ public class BankReceiptDetailsImpl implements BankReceiptDetailsService { ...@@ -25,6 +32,11 @@ public class BankReceiptDetailsImpl implements BankReceiptDetailsService {
@Resource @Resource
private BankReceiptDetailsMapper bankReceiptDetailsMapper; private BankReceiptDetailsMapper bankReceiptDetailsMapper;
/*
lanbm 2024-05-17 add
*/
@Autowired
private AdminUserService adminUserService;
/* /*
获取分页数据 获取分页数据
...@@ -35,12 +47,55 @@ public class BankReceiptDetailsImpl implements BankReceiptDetailsService { ...@@ -35,12 +47,55 @@ public class BankReceiptDetailsImpl implements BankReceiptDetailsService {
int start = (req.getPageNo() - 1) * req.getPageSize(); int start = (req.getPageNo() - 1) * req.getPageSize();
req.setStart(start); req.setStart(start);
List<AdminUserDO> ListUser = adminUserService.getUsersList();
Map<Long, String> userMap =
ListUser.stream().collect(
Collectors.toMap((AdminUserDO::getId), AdminUserDO::getNickname));
List<ReceiptItemResp> list = List<ReceiptItemResp> list =
bankReceiptDetailsMapper.getBankReceiptDetailsList(req); bankReceiptDetailsMapper.getBankReceiptDetailsList(req);
for (ReceiptItemResp r : list
) {
if (r.getCreator() == null || r.getCreator().length() == 0)
r.setCreator("");
else {
Long l = Long.parseLong(r.getCreator());
r.setCreator(userMap.get(l));
}
r.setAttrList(getFileList(r.getAttr()));
}
return new PageResult<>(list, total, mpPage.getSize(), return new PageResult<>(list, total, mpPage.getSize(),
req.getPageNo(), (total + mpPage.getSize() - 1) / mpPage.getSize()); req.getPageNo(), (total + mpPage.getSize() - 1) / mpPage.getSize());
} }
/*
组装附件信息 lanbm 2024-06-07 add
*/
private List<FileModel> getFileList(String sFileStr) {
if (sFileStr == null || sFileStr.length() == 0) {
return null;
} else {
String[] l = sFileStr.split(",");
List<FileModel> l1 = new ArrayList<>();
for (String f : l
) {
FileModel m = new FileModel();
m.setName(getFileName(f));
m.setUrl(f);
l1.add(m);
}
return l1;
}
}
/*
分解Url路径 lanbm 2024-06-07 add
*/
public String getFileName(String s) {
//String s="https://jiedao-test1.oss-cn-shenzhen.aliyuncs.com/2024/05/31/66592b5b556179746796617e.jpg";
int l = s.lastIndexOf('/');
String n = s.substring(l + 1);
return n;
}
} }
...@@ -110,10 +110,16 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R ...@@ -110,10 +110,16 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
receiptItemMapper.updateById(updateObj); receiptItemMapper.updateById(updateObj);
} }
/*
状态:0:草稿, 1待收款, 2待核销,3已部分核销,4已核销,5已核销待开票,6已开票
收款单状态
*/
@Override @Override
public void deleteReceiptItem(Long id) { public void deleteReceiptItem(Long id) {
// 校验存在 // 校验存在
ReceiptItemDO receiptItemDO = receiptItemMapper.selectById(id); ReceiptItemDO receiptItemDO =
receiptItemMapper.selectById(id);
if (null == receiptItemDO) { if (null == receiptItemDO) {
throw exception(RECEIPT_ITEM_NOT_EXISTS); throw exception(RECEIPT_ITEM_NOT_EXISTS);
} }
...@@ -121,8 +127,10 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R ...@@ -121,8 +127,10 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
receiptItemMapper.deleteById(id); receiptItemMapper.deleteById(id);
//判断当前收款单下还有没有收款明细 //判断当前收款单下还有没有收款明细
if (null != receiptItemDO.getReceiptId()) { if (null != receiptItemDO.getReceiptId()) {
LambdaQueryWrapper<ReceiptItemDO> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ReceiptItemDO> queryWrapper =
queryWrapper.eq(ReceiptItemDO::getReceiptId, receiptItemDO.getReceiptId()); new LambdaQueryWrapper<>();
queryWrapper.eq(ReceiptItemDO::getReceiptId,
receiptItemDO.getReceiptId());
long count = this.count(queryWrapper); long count = this.count(queryWrapper);
if (count == 0) { if (count == 0) {
ReceivableDO updateReceivableDO = new ReceivableDO(); ReceivableDO updateReceivableDO = new ReceivableDO();
...@@ -131,6 +139,14 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R ...@@ -131,6 +139,14 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
UpdateWrapper updateWrapper = new UpdateWrapper(); UpdateWrapper updateWrapper = new UpdateWrapper();
updateWrapper.eq("receipt_id", receiptItemDO.getReceiptId()); updateWrapper.eq("receipt_id", receiptItemDO.getReceiptId());
this.receivableService.update(updateReceivableDO, updateWrapper); this.receivableService.update(updateReceivableDO, updateWrapper);
//lanbm 2024-06-07 添加的逻辑点
//当银行收款明细为0是要改变收款单的状态为 待收款
ReceiptDO update = new ReceiptDO();
update.setId(receiptItemDO.getReceiptId());
update.setState(1);
receiptService.updateById(update);
//end lanbm 2024-06-07 添加的逻辑点
} }
} }
......
...@@ -220,6 +220,21 @@ public class ReceiptBackVO { ...@@ -220,6 +220,21 @@ public class ReceiptBackVO {
*/ */
private String tidanNo; private String tidanNo;
/*
应收金额
*/
private String ysShow;
/*
实数金额 lanbm 2024-06-06 add
*/
private String ssShow;
/*
核销比例 lanbm 2024-06-06 add
*/
private String hxBiLi;
/* @ApiModelProperty(value = "应收明细列表") /* @ApiModelProperty(value = "应收明细列表")
......
...@@ -47,6 +47,13 @@ public class ReceiptItemReq extends PageParam { ...@@ -47,6 +47,13 @@ public class ReceiptItemReq extends PageParam {
private String sDate3; private String sDate3;
private String eDate3; private String eDate3;
/*
实收日期 lanbm 2024-06-07 add
*/
private String sDate4;
private String eDate4;
/* /*
创建人 创建人
*/ */
......
package cn.iocoder.yudao.module.wealth.vo.receiptItem; package cn.iocoder.yudao.module.wealth.vo.receiptItem;
import cn.iocoder.yudao.framework.common.util.io.FileModel;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
...@@ -70,6 +74,7 @@ public class ReceiptItemResp { ...@@ -70,6 +74,7 @@ public class ReceiptItemResp {
* 附件多个,分隔 * 附件多个,分隔
*/ */
private String attr; private String attr;
private List<FileModel> attrList;
/** /**
* 状态0待核销,1已核销 * 状态0待核销,1已核销
*/ */
...@@ -112,4 +117,30 @@ public class ReceiptItemResp { ...@@ -112,4 +117,30 @@ public class ReceiptItemResp {
*/ */
private String tidanNo; private String tidanNo;
/*
创建人
*/
private String creator;
/*
创建时间
*/
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@ApiModelProperty(value = "创建时间")
private Date createTime;
/*
提交审批时间 lanbm 2024-06-07
*/
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date createTimeBpm;
/*
审批通过时间 lanbm 2024-06-07
*/
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date updateTimeBpm;
} }
...@@ -5,10 +5,12 @@ ...@@ -5,10 +5,12 @@
<select id="getBankReceiptDetailsList" <select id="getBankReceiptDetailsList"
resultType="cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp"> resultType="cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp">
SELECT p.*,m.receipt_no,m.order_id, SELECT p.*,m.receipt_no,m.order_id,
r.order_no,r.tidan_no r.order_no,r.tidan_no,a.create_time as create_time_bpm,
a.update_time as update_time_bpm
from ecw_receipt_item p from ecw_receipt_item p
left join ecw_receipt m on p.receipt_id=m.id and m.deleted=0 left join ecw_receipt m on p.receipt_id=m.id and m.deleted=0
left join ecw_order r on r.order_id=m.order_id and r.deleted=0 left join ecw_order r on r.order_id=m.order_id and r.deleted=0
left join ecw_receipt_approval a on a.bmp_id=m.bmp_id and a.deleted=0
<include refid="WherePage"/> <include refid="WherePage"/>
ORDER BY m.receipt_no desc,p.create_time asc limit #{start}, #{pageSize} ORDER BY m.receipt_no desc,p.create_time asc limit #{start}, #{pageSize}
</select> </select>
...@@ -33,17 +35,19 @@ ...@@ -33,17 +35,19 @@
<!--收款明细提交审批日期--> <!--收款明细提交审批日期-->
<if test="sDate2 != null and sDate2 != '' and <if test="sDate2 != null and sDate2 != '' and
eDate2 != null and eDate2 != ''"> eDate2 != null and eDate2 != ''">
AND m.bmp_id in AND a.create_time BETWEEN #{sDate2} and #{eDate2})
(select bmp_id from ecw_receipt_approval where create_time
BETWEEN #{sDate2} and #{eDate2})
</if> </if>
<!--收款明细提交审批通过日期--> <!--收款明细提交审批通过日期-->
<if test="sDate3 != null and sDate3 != '' and <if test="sDate3 != null and sDate3 != '' and
eDate3 != null and eDate3 != ''"> eDate3 != null and eDate3 != ''">
AND m.bmp_id in AND a.update_time BETWEEN #{sDate3} and #{eDate3}
(select bmp_id from ecw_receipt_approval where update_time </if>
BETWEEN #{sDate3} and #{eDate3})
<!--实收日期 lanbm 2024-06-07 add-->
<if test="sDate4 != null and sDate4 != '' and
eDate4 != null and eDate4 != ''">
AND p.amount_date BETWEEN #{sDate4} and #{eDate4}
</if> </if>
<!--收款明细创建人--> <!--收款明细创建人-->
...@@ -59,6 +63,7 @@ ...@@ -59,6 +63,7 @@
from ecw_receipt_item p from ecw_receipt_item p
left join ecw_receipt m on p.receipt_id=m.id and m.deleted=0 left join ecw_receipt m on p.receipt_id=m.id and m.deleted=0
left join ecw_order r on r.order_id=m.order_id and r.deleted=0 left join ecw_order r on r.order_id=m.order_id and r.deleted=0
left join ecw_receipt_approval a on a.bmp_id=m.bmp_id and a.deleted=0
<include refid="WherePage"/> <include refid="WherePage"/>
</select> </select>
......
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