Commit 69cfe5b4 authored by zhangfeng's avatar zhangfeng

Merge branch 'refs/heads/dev' into feature_member_score

parents 369fbe44 20246d5c
......@@ -65,3 +65,10 @@ alter table `ecw_target_log`
alter table `ecw_order`
add column `is_in_open_sea` tinyint DEFAULT '0' COMMENT '是否公海客户',
-- 2024-07-25 刷新订单业绩客户新老客户状态冗余参数
update ecw_order o left join ecw_customer c on c.id = o.customer_id set o.yeji_type = IFNULL(c.is_new, 1);
-- 2027-08-07 仓库路线新增落款信息和图章名称
alter table ecw_warehouse_line add column lk_left varchar(600) COMMENT '左侧落款',add column lk_right varchar(600) COMMENT '右侧落款',add column tz_name varchar(255) COMMENT '图章名称';
package cn.iocoder.yudao.framework.apollo.core.event;
import cn.iocoder.yudao.framework.common.validation.Marks;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
@AllArgsConstructor
public class OrderAssociationOfferInfoEvent {
/**
* 订单ID
*/
private Long orderId;
@ApiModelProperty(value = "主键ID", required = true)
private Long offerId;
}
......@@ -7,10 +7,8 @@ import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import org.springframework.context.annotation.Lazy;
import org.springframework.util.Assert;
......@@ -49,6 +47,15 @@ public abstract class BpmTaskAssignLeaderAbstractScript implements BpmTaskAssign
dept = getStartUserDept(startUserId);
if (dept == null) { // 找不到发起人的部门,所以无法使用该规则
return emptySet();
} else {
if (dept.getLeaderUserId().equals(startUserId)) {
DeptRespDTO parentDept = deptApi.getDept(dept.getParentId());
if (parentDept != null) { // 找不到父级部门,所以只好结束寻找。原因是:例如说,级别比较高的人,所在部门层级比较少
dept = parentDept;
} else {
return emptySet();
}
}
}
} else {
DeptRespDTO parentDept = deptApi.getDept(dept.getParentId());
......
......@@ -2720,7 +2720,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
List<CustomerOrderBackPageVO> orderList = customerMapper.orderList(0, 10, new CustomerOrderQueryDTO().setCustomerId(customerId));
if (CollectionUtil.isNotEmpty(orderList) && orderList.size() > 0) {//客户成交的订单不为空
CustomerOrderBackPageVO orderBackPageVO = orderList.get(0);
if (loginUserId.equals(customer.getCustomerService()) && orderBackPageVO != null && orderBackPageVO.getSalesmanId().equals(loginUserId)) {//订单的客户经理和当前是同一个
if (loginUserId.equals(customer.getCustomerService()) && orderBackPageVO != null && loginUserId.equals(orderBackPageVO.getSalesmanId())) {//订单的客户经理和当前是同一个
estimateEnterOpenSeaTime = isFcl ? null : DateUtil.offsetMonth(now, 6).toJdkDate();//改为6个月
}
}
......@@ -2983,8 +2983,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
public void updateCustomerByCreateOrder(Long customerId, Long orderId, String orderNo, Date orderCreateTime) {
// //下单未入仓或取消订单,线索客户变成为意向客户, 意向客户需要等下单入仓完成后才转成交客户
// CustomerDO customer = customerMapper.selectById(customerId);
// if (customer != null) {
CustomerDO customer = customerMapper.selectById(customerId);
if (customer != null) {
// if (customer.getIsNew()) {
// OrderCustomerServiceEvent event = new OrderCustomerServiceEvent(customerId, null);
// applicationContext.publishEvent(event);
......@@ -3048,22 +3048,23 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
// customerMapper.updateById(customer);
// }
//
// //纪录日志
// LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// CustomerOperateLogCreateReqVO customerOperateLogCreateReqVO = new CustomerOperateLogCreateReqVO()
// .setOperator(loginUser == null ? null : loginUser.getId())
// .setOperatorName(loginUser == null ? null : loginUser.getNickname())
// .setCustomerId(customer.getId())
// .setNumber(customer.getNumber())
// .setName(customer.getName())
// .setOrderId(orderId)
// .setOrderNo(orderNo)
// .setOldEstimateEnterOpenSeaTime(oldEstimateEnterOpenSeaTime)
// .setNewEstimateEnterOpenSeaTime(customer.getEstimateEnterOpenSeaTime())
// .setOperateType(CustomerOperateTypeEnum.ORDER_CREATED.getValue())
// .setRemark("客户下单");
// customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
// }
//纪录日志
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
CustomerOperateLogCreateReqVO customerOperateLogCreateReqVO = new CustomerOperateLogCreateReqVO()
.setOperator(loginUser == null ? null : loginUser.getId())
.setOperatorName(loginUser == null ? null : loginUser.getNickname())
.setCustomerId(customer.getId())
.setNumber(customer.getNumber())
.setName(customer.getName())
.setOrderId(orderId)
.setOrderNo(orderNo)
// .setOldEstimateEnterOpenSeaTime(oldEstimateEnterOpenSeaTime)
.setOldEstimateEnterOpenSeaTime(customer.getEstimateEnterOpenSeaTime())
.setNewEstimateEnterOpenSeaTime(customer.getEstimateEnterOpenSeaTime())
.setOperateType(CustomerOperateTypeEnum.ORDER_CREATED.getValue())
.setRemark("客户下单");
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
}
}
......
......@@ -796,7 +796,11 @@
-- 捞取时间置为空
a.catch_time = null,
-- 移交客户重置报价延期次数为0
a.create_offer_postpone_num = 0
a.create_offer_postpone_num = 0,
-- 20240809修改 zendao #195 客户业绩类型字段,判断条件变更
-- 新客户置为1
a.is_new = (case when a.status = 3 then 0 else 1 end)
WHERE id in
<foreach item='customer' index='index' collection='customerList' open='(' separator=',' close=')'>
#{customer.id}
......@@ -859,8 +863,6 @@
a.is_in_open_sea = 0,
a.enter_open_sea_time = null,
-- 客户经理
a.customer_service = #{loginUserId},
-- 确认接收置为true #2201 公海池捞取客户后,捞取客户直接进入我的客户
a.is_customer_service_confirmed = 1,
-- 分配时间
......@@ -874,7 +876,14 @@
a.status = if(a.status = 2, 1, a.status),
-- 预计进入公海池时间
a.estimate_enter_open_sea_time = #{estimateEnterOpenSeaTime}
a.estimate_enter_open_sea_time = #{estimateEnterOpenSeaTime},
-- 20240809修改 zendao #195 客户业绩类型字段,判断条件变更
-- 不同客户经理更新为新客户; 同一客户经理,成交为老客户,非已成交状态为新客户
a.is_new = (case when a.customer_service != #{loginUserId} then 1 else (if(a.status = 3, 0, 1)) end),
-- 客户经理 (这个要放到后面,因为前面有用到这条件)
a.customer_service = #{loginUserId}
WHERE id = #{customerId}
</update>
......@@ -884,9 +893,9 @@
update ecw_customer a
set a.is_new = 0
where a.deleted = 0 and a.is_new = 1 and a.id = #{customerId}
and exists(
select 1 from ecw_target_log where deleted = 0 and customer_id = a.id
)
-- 20240809修改 zendao #195 客户业绩类型字段,判断条件变更
and a.status = 3
-- and exists(select 1 from ecw_target_log where deleted = 0 and customer_id = a.id)
</update>
<sql id="orderQuery">
......
......@@ -15,6 +15,7 @@ import cn.iocoder.yudao.module.depository.vo.warehouseLine.WarehouseLineBackVO;
import cn.iocoder.yudao.module.depository.vo.warehouseLine.WarehouseLineQueryVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -39,7 +40,7 @@ public interface WarehouseLineMapper extends BaseMapperX<WarehouseLineDO> {
default PageResult<WarehouseLineDO> selectPage(PageVO page, Object object) {
if (object instanceof WarehouseLineQueryVO) {
WarehouseLineQueryVO vo = (WarehouseLineQueryVO)object;
WarehouseLineQueryVO vo = (WarehouseLineQueryVO) object;
return selectPage(page, new LambdaQuery<WarehouseLineDO>()
.inIfPresent(WarehouseLineDO::getStartWarehouseId, vo.getStartWarehouseIdList())
.inIfPresent(WarehouseLineDO::getDestWarehouseId, vo.getDestWarehouseIdList())
......@@ -104,7 +105,6 @@ public interface WarehouseLineMapper extends BaseMapperX<WarehouseLineDO> {
LogisticsInfoDto getStartInfoAndDestInfoByLineId(@Param("lineId") Long lineId);
@ResultType(LogisticsInfoDto.class)
@Select({
"<script>",
......@@ -166,4 +166,13 @@ public interface WarehouseLineMapper extends BaseMapperX<WarehouseLineDO> {
WarehouseLineDO findOneIgnoreDeleted(@Param("id") Long id);
IPage<WarehouseLineBackVO> getWarehouseLinePage(IPage<WarehouseLineBackVO> page, @Param("query") WarehouseLineQueryVO query);
/**
* 根据线路id获取目的仓一致的全部线路id
*
* @param lineId 线路id
* @return
*/
@Select("select w1.id from ecw_warehouse_line w1 left join ecw_warehouse_line w2 on w1.dest_warehouse_id = w2.dest_warehouse_id where w1.deleted = 0 and w2.id = #{lineId}")
List<Long> getDestAsLinesByLineId(@Param("lineId") Long lineId);
}
......@@ -111,4 +111,7 @@ public class SupplierExternalBackVO {
@ApiModelProperty(value = "国家ID")
private Long countryId;
@ApiModelProperty(value = "TIN NO./RC NO.")
private String tinNoRcNo;
}
......@@ -283,6 +283,7 @@ public class MemberUserServiceImpl implements MemberUserService {
.eq(MemberUserDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
.and(StringUtils.isNotEmpty(searchKey),
i -> i.like(MemberUserDO::getNickname, searchKey).or().like(MemberUserDO::getMobile, searchKey))
.eq(MemberUserDO::getDeleted, 0)
.orderByDesc(MemberUserDO::getId);
memberUserMapper.getPage(mpPage, wrapper);
......
......@@ -627,4 +627,11 @@ public class OrderDO extends BaseDO {
@ApiModelProperty(value = "是否在公海")
private Boolean isInOpenSea;
@ApiModelProperty(value = "订单修改是否变动了归属客户,此字段用来判定订单是否需要重置归属客户经理,下单后归属客户的客户经理是固定的,除非订单归属客户变动,才需要重置客户经理")
@TableField(exist = false)
private Boolean isChargeCustomer;
}
......@@ -394,4 +394,10 @@ public interface ErrorCodeConstants {
ErrorCode ORDER_IS_PRE_INSTALLED = new ErrorCode(1004001153, "order.is.pre.installed");
ErrorCode ORDER_IS_NOT_PRE_INSTALLED = new ErrorCode(1004001154, "order.is.not.pre.installed");
ErrorCode ORDER_ITEM_CHARGING_NOT_NULL = new ErrorCode(1004001155, "order.item.charging.not.null");
ErrorCode ORDER_ITEM_IS_PAY_ADVANCE_NOT_NULL = new ErrorCode(1004001156, "order.item.is.pay.advance.not.null");
ErrorCode FREIGHT_CURRENCY_NOT_NULL = new ErrorCode(1004001157, "order.item.freight.currency.not.null");
ErrorCode FREIGHT_UNIT_NOT_NULL = new ErrorCode(1004001158, "order.item.freight.unit.not.null");
ErrorCode CLEARANCE_CURRENCY_NOT_NULL = new ErrorCode(1004001159, "order.item.clearance.currency.not.null");
ErrorCode CLEARANCE_UNIT_NOT_NULL = new ErrorCode(1004001160, "order.item.clearance.unit.not.null");
}
......@@ -2450,11 +2450,12 @@ public class OrderQueryServiceImpl implements OrderQueryService {
for (OrderItemDO orderItemDO : orderItemDOList) {
// 判断品名是否入仓
boolean isWarehouseIn = Objects.nonNull(orderItemDO.getWarehouseInInfoVO()) && orderItemDO.getWarehouseInInfoVO().getCartonsNum() > 0;
BigDecimal seaFreight = orderItemDO.getSeaFreight().setScale(0, RoundingMode.HALF_UP);
BigDecimal receivableSeaFreight = orderItemDO.getReceivableSeaFreight().compareTo(BigDecimal.ZERO) == 0 ? seaFreight : orderItemDO.getReceivableSeaFreight();
BigDecimal clearanceFreight = orderItemDO.getClearanceFreight().setScale(0, RoundingMode.HALF_UP);
BigDecimal receivableClearanceFreight = orderItemDO.getReceivableClearanceFreight().compareTo(BigDecimal.ZERO) == 0 ? clearanceFreight : orderItemDO.getReceivableClearanceFreight();
if (isWarehouseIn) {
BigDecimal seaFreight = Objects.nonNull(orderItemDO.getSeaFreight()) ? orderItemDO.getSeaFreight().setScale(0, RoundingMode.HALF_UP) : BigDecimal.ZERO;
BigDecimal receivableSeaFreight = Objects.nonNull(orderItemDO.getReceivableSeaFreight()) ? (orderItemDO.getReceivableSeaFreight().compareTo(BigDecimal.ZERO) == 0 ? seaFreight : orderItemDO.getReceivableSeaFreight()) : BigDecimal.ZERO;
BigDecimal clearanceFreight = Objects.nonNull(orderItemDO.getClearanceFreight()) ? orderItemDO.getClearanceFreight().setScale(0, RoundingMode.HALF_UP) : BigDecimal.ZERO;
BigDecimal receivableClearanceFreight = Objects.nonNull(orderItemDO.getReceivableClearanceFreight()) ? (orderItemDO.getReceivableClearanceFreight().compareTo(BigDecimal.ZERO) == 0 ? clearanceFreight : orderItemDO.getReceivableClearanceFreight()) : BigDecimal.ZERO;
Long freightCurrencyId = Long.parseLong(String.valueOf(orderItemDO.getSeaFreightCurrency()));
ExchangeRateRespDTO collectFreightRateRespDTO = currencyApi.getCurrencyRate(freightCurrencyId, collectFreightFeeId);
ExchangeRateRespDTO freightTotalFeeRateRespDTO = currencyApi.getCurrencyRate(freightCurrencyId, collectTotalFeeId);// 运费总费用汇率计算
......@@ -2790,9 +2791,7 @@ public class OrderQueryServiceImpl implements OrderQueryService {
// 运费优惠分组
StringBuilder discountFreightFeeGroup = new StringBuilder();
List<FeeGroupDto> discountFreightFeeGroupDtoList = new ArrayList<>();
this.
convertFeeGroup(currencyRespDTOMap, totalReceivableFreightFeeGroupDtoMap, totalNetReceiptsFreightFeeGroupDtoMap, discountFreightFeeGroupDtoList, discountFreightFeeGroup);
this.convertFeeGroup(currencyRespDTOMap, totalReceivableFreightFeeGroupDtoMap, totalNetReceiptsFreightFeeGroupDtoMap, discountFreightFeeGroupDtoList, discountFreightFeeGroup);
summaryDto.setDiscountFreightFeeGroupDtoList(discountFreightFeeGroupDtoList);
summaryDto.setDiscountFreightFeeGroup(discountFreightFeeGroup.toString());
// 运费换算成目的地设置的货币单位的总应收、总实收、总优惠
......
......@@ -1005,11 +1005,53 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
if (Objects.isNull(channelPrice.getOrderItemId())) {
throw exception(ORDER_ITEM_NOT_EXISTS);
}
//得到以前的费用
OrderItemDO orderItemDO = orderItemService.getOrderItem(channelPrice.getOrderItemId());
if (Objects.isNull(orderItemDO)) {
throw exception(ORDER_ITEM_NOT_EXISTS);
}
if (Objects.isNull(orderItemDO.getOneSeaFreight()) || orderItemDO.getOneSeaFreight().compareTo(BigDecimal.ZERO) == 0) {
// TODO 当原商品未报价(运费值为0时)即可以自定义收费模式、货币单位、计量单位
if (Objects.isNull(channelPrice.getCharging())) {
throw exception(ORDER_ITEM_CHARGING_NOT_NULL);
}
orderItemDO.setCharging(channelPrice.getCharging());
if (Objects.isNull(channelPrice.getIsPayAdvance())) {
throw exception(ORDER_ITEM_IS_PAY_ADVANCE_NOT_NULL);
}
orderItemDO.setIsPayAdvance(channelPrice.getIsPayAdvance() ? 1 : 0);
if (Objects.isNull(channelPrice.getIsPayAdvance())) {
throw exception(ORDER_ITEM_IS_PAY_ADVANCE_NOT_NULL);
}
if (Objects.isNull(channelPrice.getFreightCurrencyId())) {
throw exception(FREIGHT_CURRENCY_NOT_NULL);
}
orderItemDO.setSeaFreightCurrency(Math.toIntExact(channelPrice.getFreightCurrencyId()));
if (Objects.isNull(channelPrice.getFreightUnitId())) {
throw exception(FREIGHT_UNIT_NOT_NULL);
}
orderItemDO.setSeaFreightVolume(channelPrice.getFreightUnitId());
if (channelPrice.getCharging() == 0){
if (Objects.isNull(channelPrice.getClearanceCurrencyId())) {
throw exception(CLEARANCE_CURRENCY_NOT_NULL);
}
orderItemDO.setClearanceFreightCurrency(Math.toIntExact(channelPrice.getClearanceCurrencyId()));
if (Objects.isNull(channelPrice.getClearanceUnitId())) {
throw exception(CLEARANCE_UNIT_NOT_NULL);
}
orderItemDO.setClearanceFreightVolume(channelPrice.getClearanceUnitId());
}
}else {
// TODO 如果原订单商品价格非未报价,则不采用前端传值的货币单位、计量单位、收费方式、是否预付等参数,以原有参数为准
channelPrice.setCharging(orderItemDO.getCharging());
channelPrice.setIsPayAdvance(Objects.nonNull(orderItemDO.getIsPayAdvance()) && orderItemDO.getIsPayAdvance() == 1);
channelPrice.setFreightCurrencyId(Long.valueOf(orderItemDO.getSeaFreightCurrency()));
channelPrice.setFreightUnitId(orderItemDO.getSeaFreightVolume());
channelPrice.setClearanceCurrencyId(Long.valueOf(orderItemDO.getClearanceFreightCurrency()));
channelPrice.setClearanceUnitId(orderItemDO.getClearanceFreightVolume());
}
if (orderItemDO.getCharging() == 0) {
// 运费+清关费,两者都为0则不是自定义价格
if (channelPrice.getFreightFee().compareTo(BigDecimal.ZERO) == 0 && channelPrice.getClearanceFee().compareTo(BigDecimal.ZERO) == 0) {
......@@ -1021,12 +1063,15 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
continue;
}
}
channelPrice.setExceptionId(vo.getOrderExceptionId());
channelPrice.setExceptionResultId(orderExceptionResult.getId());
orderExceptionChannelPriceService.createExceptionChannelPrice(channelPrice);
OrderChangePriceParam priceParam = new OrderChangePriceParam();
BeanUtil.copyProperties(channelPrice, priceParam);
priceParam.setFreightCurrencyId(orderItemDO.getSeaFreightCurrency());
priceParam.setClearanceCurrencyId(orderItemDO.getClearanceFreightCurrency());
inquiryPriceParams.add(priceParam);
......@@ -2036,18 +2081,18 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
//更新订单跟进客服
if (null != orderExceptionDO.getOrderId()) {
OrderDO orderDo = orderService.getById(orderExceptionDO.getOrderId());
//有可能订单存在删除情况,需进行判断
if (null != orderDo) {
if (null == orderDo.getSalesmanId() || orderDo.getSalesmanId() == 0l) {
LambdaUpdateWrapper<OrderDO> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(OrderDO::getOrderId, orderDo.getOrderId());
updateWrapper.set(OrderDO::getSalesmanId, customerServiceId);
orderService.update(updateWrapper);
}
}
}
// if (null != orderExceptionDO.getOrderId()) {
// OrderDO orderDo = orderService.getById(orderExceptionDO.getOrderId());
// //有可能订单存在删除情况,需进行判断
// if (null != orderDo) {
// if (null == orderDo.getSalesmanId() || orderDo.getSalesmanId() == 0l) {
// LambdaUpdateWrapper<OrderDO> updateWrapper = new LambdaUpdateWrapper<>();
// updateWrapper.eq(OrderDO::getOrderId, orderDo.getOrderId());
// updateWrapper.set(OrderDO::getSalesmanId, customerServiceId);
// orderService.update(updateWrapper);
// }
// }
// }
//添加异常处理结果
......@@ -2463,6 +2508,7 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
//"AND (o.`salesman_id` = #{query.salesmanId} or o.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ))",
queryWrapper.and(wrapper -> wrapper.in("a.salesman_id", reqVo.getCustomerIds()).or().apply("a.customer_id in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service in ({0}))", ArrayUtil.join(reqVo.getCustomerIds().toArray(), ",")));
// queryWrapper.and(wrapper -> wrapper.in("a.salesman_id", reqVo.getCustomerIds()));
//queryWrapper.in("a.salesman_id", reqVo.getCustomerIds());
}
......
......@@ -52,6 +52,7 @@ import cn.iocoder.yudao.module.order.service.orderCargoControl.OrderCargoControl
import cn.iocoder.yudao.module.order.service.orderLabel.OrderLabelService;
import cn.iocoder.yudao.module.order.service.orderWarehouseIn.OrderWarehouseInService;
import cn.iocoder.yudao.module.order.service.orderWarehousePicture.OrderWarehousePictureService;
import cn.iocoder.yudao.module.order.service.targetLog.TargetLogService;
import cn.iocoder.yudao.module.order.vo.approval.OrderApprovalCancelApplyReqVO;
import cn.iocoder.yudao.module.order.vo.order.ApplyInfoVO;
import cn.iocoder.yudao.module.order.vo.order.CostVO;
......@@ -86,6 +87,7 @@ import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.order.enums.TargetLogEnum.SPLIT;
/**
* 订单拆单 Service 实现类
......@@ -109,6 +111,8 @@ public class OrderSplitServiceImpl extends AbstractService<OrderSplitMapper, Ord
@Resource
private OrderApprovalService orderApprovalService;
@Resource
private TargetLogService targetLogService;
@Resource
private OrderService orderService;
@Resource
......@@ -1086,7 +1090,8 @@ public class OrderSplitServiceImpl extends AbstractService<OrderSplitMapper, Ord
null, 0, OrderApprovalTypeResultEnum.order_split_pass.getDesc(), false);
// 原订单的应收单归档删除 (这些应收都是未核销的,核销的是不能拆单的)
// 拆单删除原单可能的业绩日志
targetLogService.addTargetLog(orderId, null, SPLIT);
// 判断是否为子拆单进行的再次拆单,如果是,其订单编号和订单id未变,则不用处理关联和互斥业务
if (orderNoAndSeq.length == 1) {
receivableService.deleteReceivableByOrderId(orderId);
......
......@@ -1416,41 +1416,43 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, orderDO.getOrderId())
.orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
if (orderConsignorDO2 != null &&
orderConsignorDO2.getCustomerId() != null &&
orderConsigneeDO2 != null &&
orderConsigneeDO2.getCustomerId() != null) {
//获取发货人客户经理
CustomerDO consignorCustomer =
customerService.getById(orderConsignorDO2.getCustomerId());
//获取收货人客户经理
CustomerDO consigneeCustomer =
customerService.getById(orderConsigneeDO2.getCustomerId());
//订单的发货人、收货人同属一个客户经理,则两个客户经理都延期,
// 否则只延期订单中业绩归属方客户
if (consignorCustomer != null && consigneeCustomer != null &&
Objects.nonNull(consignorCustomer.getCustomerService()) &&
Objects.nonNull(consigneeCustomer.getCustomerService()) &&
(consignorCustomer.getCustomerService().equals(consigneeCustomer.getCustomerService()) || consignorCustomer.getCustomerService() == consigneeCustomer.getCustomerService())) {
if (orderConsignorDO2 != null &&
orderConsignorDO2.getCustomerId() != null) {
idSet.add(orderConsignorDO2.getCustomerId());
}
if (orderConsigneeDO2 != null &&
orderConsigneeDO2.getCustomerId() != null) {
idSet.add(orderConsigneeDO2.getCustomerId());
}
}
// if (orderConsignorDO2 != null &&
// orderConsignorDO2.getCustomerId() != null &&
// orderConsigneeDO2 != null &&
// orderConsigneeDO2.getCustomerId() != null) {
// //获取发货人客户经理
// CustomerDO consignorCustomer =
// customerService.getById(orderConsignorDO2.getCustomerId());
// //获取收货人客户经理
// CustomerDO consigneeCustomer =
// customerService.getById(orderConsigneeDO2.getCustomerId());
// //订单的发货人、收货人同属一个客户经理,则两个客户经理都延期,
// // 否则只延期订单中业绩归属方客户
// if (consignorCustomer != null && consigneeCustomer != null &&
// Objects.nonNull(consignorCustomer.getCustomerService()) &&
// Objects.nonNull(consigneeCustomer.getCustomerService()) &&
// (consignorCustomer.getCustomerService().equals(consigneeCustomer.getCustomerService()) || consignorCustomer.getCustomerService() == consigneeCustomer.getCustomerService())) {
//
// if (orderConsignorDO2 != null &&
// orderConsignorDO2.getCustomerId() != null) {
// idSet.add(orderConsignorDO2.getCustomerId());
// }
// if (orderConsigneeDO2 != null &&
// orderConsigneeDO2.getCustomerId() != null) {
// idSet.add(orderConsigneeDO2.getCustomerId());
// }
// }
// }
// 上面逻辑是2024-05-21修改的, 下面在2024-08-08又恢复成之前的这种业务。
// zendao #196 当订单入仓完成,订单收发方客户的客户状态均修改为成交
if (orderConsignorDO2 != null && orderConsignorDO2.getCustomerId() != null) {
idSet.add(orderConsignorDO2.getCustomerId());
}
if (orderConsigneeDO2 != null && orderConsigneeDO2.getCustomerId() != null) {
idSet.add(orderConsigneeDO2.getCustomerId());
}
// //旧逻辑 2024-05-21
// if (orderConsignorDO2 != null && orderConsignorDO2.getCustomerId() != null) {
// idSet.add(orderConsignorDO2.getCustomerId());
// }
//
// if (orderConsigneeDO2 != null && orderConsigneeDO2.getCustomerId() != null) {
// idSet.add(orderConsigneeDO2.getCustomerId());
// }
for (Long id : idSet) {
customerService.updateCustomerByFinishWarehouseIn(id,
orderId, orderDO != null ? orderDO.getOrderNo() : "",
......
......@@ -103,7 +103,7 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
public void addTargetLog(Long orderId, Date achievementTime, TargetLogEnum targetLogEnum) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
if (targetLogEnum.getType() == 1 || targetLogEnum.getType() == 3) {//装柜和合单
dealTargetLog(orderId, achievementTime,targetLogEnum.getType());
dealTargetLog(orderId, achievementTime, targetLogEnum.getType());
} else if (targetLogEnum.getType() == 2 || targetLogEnum.getType() == 4) {//退仓和拆单
targetLogMapper.delete(new LambdaQueryWrapperX<TargetLogDO>()
.eq(TargetLogDO::getOrderId, orderId));
......@@ -116,12 +116,12 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
orderIds.stream().forEach(item -> targetLogMapper.delete(new LambdaQueryWrapperX<TargetLogDO>()
.eq(TargetLogDO::getOrderId, item)));
} else if (targetLogEnum.getType() == 4) {//拆单,分别计算每个订单的业绩归属
orderIds.stream().forEach(item -> dealTargetLog(item, achievementTime,targetLogEnum.getType()));
orderIds.stream().forEach(item -> dealTargetLog(item, achievementTime, targetLogEnum.getType()));
}
}
@Override
public List<TargetLogDO> getTargetLogListByUserIds(List<Long> collect, Date startTime,Date endTime) {
public List<TargetLogDO> getTargetLogListByUserIds(List<Long> collect, Date startTime, Date endTime) {
List<TargetLogDO> targetLogDOS = targetLogMapper.selectList(new LambdaQueryWrapperX<TargetLogDO>()
.betweenIfPresent(TargetLogDO::getAchievementTime, startTime, endTime)
.in(TargetLogDO::getUserId, collect));
......@@ -136,19 +136,19 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
if (targetLogDO == null) {
Date time = targetLogMapper.selectCabinetSealingTime(orderDO.getOrderId());
if (time != null) {
dealTargetLog(orderDO.getOrderId(),time,TargetLogEnum.LOADING.getType());
dealTargetLog(orderDO.getOrderId(), time, TargetLogEnum.LOADING.getType());
}
}
});
}
private void dealTargetLog(Long orderId, Date achievementTime,Integer type) {
private void dealTargetLog(Long orderId, Date achievementTime, Integer type) {
long selectCount = targetLogMapper.selectCount(TargetLogDO::getOrderId, orderId);
if (selectCount > 0L) {
return;
}
OrderBackInfoDto info = orderQueryService.info(orderId);
if (info.getIsInOpenSea()){
if (info.getIsInOpenSea()) {
// 订单归属客户产生业绩时在公海池,不添加业绩日志
return;
}
......@@ -167,21 +167,22 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
// }
// }
// }
TargetLogDO targetLogDO = new TargetLogDO();
targetLogDO.setOrderId(orderId);
targetLogDO.setCustomerId(info.getCustomerId());
targetLogDO.setUserId(info.getSalesmanId());
targetLogDO.setAchievementTime(achievementTime);
if (info.getTransportId() == 3) {
targetLogDO.setLdBoxTime(achievementTime);
} else {
targetLogDO.setLdBoxTime(targetLogMapper.selectCabinetLoadTime(orderId));
}
targetLogDO.setCompleteVolume(info.getWVolume());
targetLogDO.setCompleteWeight(info.getVWeight());
targetLogDO.setType(type);
targetLogMapper.insert(targetLogDO);
// customerService.updateCustomerIsNewToOld(customerId);
TargetLogDO targetLogDO = new TargetLogDO();
targetLogDO.setOrderId(orderId);
targetLogDO.setCustomerId(info.getCustomerId());
targetLogDO.setUserId(Objects.isNull(info.getSalesmanId()) ? 0L : info.getSalesmanId());
targetLogDO.setDeptId(Objects.isNull(info.getDeptId()) ? 0L : info.getDeptId());
targetLogDO.setAchievementTime(achievementTime);
if (info.getTransportId() == 3) {
targetLogDO.setLdBoxTime(achievementTime);
} else {
targetLogDO.setLdBoxTime(targetLogMapper.selectCabinetLoadTime(orderId));
}
targetLogDO.setCompleteVolume(info.getWVolume());
targetLogDO.setCompleteWeight(info.getVWeight());
targetLogDO.setType(type);
targetLogMapper.insert(targetLogDO);
// customerService.updateCustomerIsNewToOld(customerId);
// }
}
}
......@@ -587,6 +587,28 @@ public class OrderBackVO {
private Boolean isInOpenSea;
@ApiModelProperty(value = "订单修改是否变动了归属客户,此字段用来判定订单是否需要重置归属客户经理,下单后归属客户的客户经理是固定的,除非订单归属客户变动,才需要重置客户经理")
@TableField(exist = false)
private Boolean isChargeCustomer;
@ApiModelProperty(value = "客户业绩类型:1 新客户业绩 0老客户业绩")
private Integer yejiType;
/*
业绩产生时间
*/
private Date yejiCreateDate;
/*
海运根据体积计算出的V值,空运根据重量计算出的V值
*/
private BigDecimal calVValue;
@ApiModelProperty(value = "是否有收货人,1-是,0-否")
private Boolean hasConsignee = true;
public void setExternalWarehouseJson(String externalWarehouseJson) {
this.externalWarehouseJson = externalWarehouseJson;
if (StringUtils.isNotBlank(externalWarehouseJson)) {
......
package cn.iocoder.yudao.module.order.controller.admin.orderExceptionResult.orderException;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
......@@ -74,6 +75,11 @@ public class OrderExceptionController {
List<String> serviceIdList =
orderExceptionService.getCustomerServiceListById(
Long.parseLong(query.getSalesmanId()));
if(CollectionUtil.isEmpty(serviceIdList)){
serviceIdList = new ArrayList<>();
// 避免因为查询条件为空不执行,这里对没有对应客户经理的跟进客服,进行非空参数添加,以保证不能获取数据的查询条件执行
serviceIdList.add("-1");
}
List<String> customerServiceList = query.getCustomerIds();
if (null == customerServiceList) {
customerServiceList = new ArrayList<>();
......
......@@ -552,6 +552,8 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
dbItem.setValidateStartDate(productPrice.getValidateStartDate());
dbItem.setValidateEndDate(productPrice.getValidateEndDate());
dbItem.setNeedOrderInquiry(productPrice.getNeedOrderInquiry());
dbItem.setNeedBook(productPrice.getNeedBook());
dbItem.setDayLimit(productPrice.getDayLimit());
dbItem.setContainerLocation(productPrice.getContainerLocation());
......@@ -1257,7 +1259,7 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
//没有价格信息不继续后面的处理
if (!hasPrice) {
zTest3 m=new zTest3();
zTest3 m = new zTest3();
m.setTestname("没有价格信息,不后续处理");
m.setCreatedate(new Date());
zTestMapper.insert(m);
......@@ -1295,10 +1297,8 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
//ProductPriceExceptionHandleListener 监听
handleData.setNeedHandleList(needHandleList);
applicationContext.publishEvent(handleData);
}
else
{
zTest3 m=new zTest3();
} else {
zTest3 m = new zTest3();
m.setTestname("needHandleList 为空");
m.setCreatedate(new Date());
zTestMapper.insert(m);
......@@ -3018,9 +3018,12 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
private void checkAndUpdateStepToMainPrice(ProductPriceDO productPrice, ProductPriceReqBaseVO productPriceStepBaseVO) {
checkStepPrice(productPriceStepBaseVO);
updateStepToMainPriceAir(productPrice, productPriceStepBaseVO.getFreightPriceStepList(), PriceTypeEnum.FREIGHT);
updateStepToMainPriceAir(productPrice, productPriceStepBaseVO.getClearancePriceStepList(), PriceTypeEnum.CLEARANCE);
updateStepToMainPriceAir(productPrice, productPriceStepBaseVO.getFullPriceStepList(), PriceTypeEnum.FULL_PRICE);
if (productPrice.getStepPrice() == 1) {
// 只有阶梯定价才需要执行下面的逻辑
updateStepToMainPriceAir(productPrice, productPriceStepBaseVO.getFreightPriceStepList(), PriceTypeEnum.FREIGHT);
updateStepToMainPriceAir(productPrice, productPriceStepBaseVO.getClearancePriceStepList(), PriceTypeEnum.CLEARANCE);
updateStepToMainPriceAir(productPrice, productPriceStepBaseVO.getFullPriceStepList(), PriceTypeEnum.FULL_PRICE);
}
}
private void updateStepToMainPriceAir(ProductPriceDO productPrice, List<ProductPriceStepDO> priceStepList, PriceTypeEnum priceTypeEnum) {
......@@ -3444,7 +3447,8 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
in(ProductPriceDO::getId, ids));
if (productPriceDOList.size() > 0) {
productPriceDOList.forEach(price -> {
for (ProductPriceDO price : productPriceDOList) {
ProductPriceAirCreateReqVO createReqVO = new ProductPriceAirCreateReqVO();
BeanUtils.copyProperties(price, createReqVO);
......@@ -3617,7 +3621,7 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
warehouseLineList,
productList,
price);
});
}
}
......
......@@ -301,8 +301,11 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"</when>",
")",
"<when test = 'queryVO.lineId != null'>",
"AND o.`line_id` = #{queryVO.lineId}",
"AND o.`line_id` in (select w1.id from ecw_warehouse_line w1 left join ecw_warehouse_line w2 on w1.dest_warehouse_id = w2.dest_warehouse_id where w1.deleted = 0 and w2.id = #{queryVO.lineId})",
"</when>",
// "<when test = 'queryVO.lineId != null'>",
// "AND o.`line_id` = #{queryVO.lineId}",
// "</when>",
"<when test = 'queryVO.channelId != null'>",
"AND o.`channel_id` = #{queryVO.channelId}",
"</when>",
......
......@@ -3,11 +3,14 @@ package cn.iocoder.yudao.module.sale.listener;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.apollo.core.event.OrderAssociationOfferCostEvent;
import cn.iocoder.yudao.framework.apollo.core.event.OrderAssociationOfferInfoEvent;
import cn.iocoder.yudao.module.product.dto.FeeDto;
import cn.iocoder.yudao.module.product.enums.FeeTypeEnum;
import cn.iocoder.yudao.module.sale.service.offer.OfferService;
import cn.iocoder.yudao.module.sale.vo.offer.EstCostVO;
import cn.iocoder.yudao.module.sale.vo.offer.OfferRespVO;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
......@@ -53,4 +56,17 @@ public class OrderAssociationOfferListener {
}
}
}
/**
* 根据订单id查询关联报价单信息
*
* @param event 参数与返回值
*/
@EventListener(OrderAssociationOfferInfoEvent.class)
public void selectOfferInfoByOrderId(OrderAssociationOfferInfoEvent event) {
OfferRespVO offerRespVO = offerService.getOfferByOrderId(event.getOrderId());
if (Objects.nonNull(offerRespVO)) {
event.setOfferId(offerRespVO.getOfferId());
}
}
}
......@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ApiModel("订单关联报价单查询参数")
......@@ -33,6 +34,9 @@ public class OrderAssociationOfferQueryVO {
@NotNull(message = "线路ID不能为空")
private Long lineId;
@ApiModelProperty(value = "线路ID集合(不区分始发仓时,需要根据目的仓获取目的仓一致的所有线路,前端不需要传此参数)")
private List<Long> lineIds;
@ApiModelProperty(value = "渠道ID")
private Long channelId;
......
......@@ -45,7 +45,7 @@
select * from (
SELECT
IFNULL(t6.resource_type,1) as customer_type,
( CASE WHEN t6.is_new = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType,
( CASE WHEN t1.yeji_type = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType,
t2.number,
t1.order_no,
(CASE WHEN t9.customer_id=t.customer_id THEN t9.name ELSE tx.name END) as name,
......@@ -114,7 +114,7 @@
and t7.departure_warehouse_id = #{query.startWarehouseId}
</if>
<if test="query.achieveType != null">
and t6.is_new = #{query.achieveType}
and t1.yeji_type = #{query.achieveType}
</if>
<if test="query.destWarehouseIdList != null">
and t8.objective_warehouse_id in
......@@ -132,7 +132,7 @@
select * from (
SELECT
IFNULL(t6.resource_type,1) as customer_type,
( CASE WHEN t6.is_new = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType,
( CASE WHEN t1.yeji_type = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType,
t2.number,
t1.order_no,
(CASE WHEN t9.customer_id=t.customer_id THEN t9.name ELSE tx.name END) as name,
......@@ -206,7 +206,7 @@
and t7.departure_warehouse_id = #{query.startWarehouseId}
</if>
<if test="query.achieveType != null">
and t6.is_new = #{query.achieveType}
and t1.yeji_type = #{query.achieveType}
</if>
<if test="query.destWarehouseIdList != null">
and t8.objective_warehouse_id in
......@@ -224,7 +224,7 @@
select * from (
SELECT
IFNULL(t6.resource_type,1) as customer_type,
( CASE WHEN t6.is_new = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType,
( CASE WHEN t1.yeji_type = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType,
t2.number,
t1.order_no,
(CASE WHEN t9.customer_id=t.customer_id THEN t9.name ELSE tx.name END) as name,
......@@ -294,7 +294,7 @@
and t7.departure_warehouse_id = #{query.startWarehouseId}
</if>
<if test="query.achieveType != null">
and t6.is_new = #{query.achieveType}
and t1.yeji_type = #{query.achieveType}
</if>
<if test="query.destWarehouseIdList != null">
and t8.objective_warehouse_id in
......@@ -312,7 +312,7 @@
select * from (
SELECT
IFNULL(t6.resource_type,1) as customer_type,
( CASE WHEN t6.is_new = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType,
( CASE WHEN t1.yeji_type = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType,
t2.number,
t1.order_no,
(CASE WHEN t9.customer_id=t.customer_id THEN t9.name ELSE tx.name END) as name,
......@@ -382,7 +382,7 @@
and t7.departure_warehouse_id = #{query.startWarehouseId}
</if>
<if test="query.achieveType != null">
and t6.is_new = #{query.achieveType}
and t1.yeji_type = #{query.achieveType}
</if>
<if test="query.destWarehouseIdList != null">
and t8.objective_warehouse_id in
......@@ -406,7 +406,7 @@
FROM
(
SELECT
( CASE WHEN t6.is_new = 1 THEN '新客户' ELSE '旧客户' END ) AS cusType,
( CASE WHEN t1.yeji_type = 1 THEN '新客户' ELSE '旧客户' END ) AS cusType,
(
SELECT
CASE
......
......@@ -21,12 +21,18 @@ public class LoadDto {
@ExcelProperty("prodTitleZh")
private String prodTitleZh;
@ExcelProperty("quantity")
private Integer quantity;
@ExcelProperty("brand")
private String brand;
@ExcelProperty("productRecord")
private String productRecord;
@ExcelProperty("prodAttr")
private String prodAttr;//特性
@ExcelProperty("sumNum")
private Integer sumNum;
......@@ -45,6 +51,9 @@ public class LoadDto {
@ExcelProperty("material")
private String material;
@ExcelProperty("usageIds")
private String usageIds;//用途
@ExcelProperty("merge")
private String merge;
......@@ -57,7 +66,4 @@ public class LoadDto {
@ExcelProperty("worth")
private BigDecimal worth;
@ExcelProperty("quantity")
private Integer quantity;
}
......@@ -69,4 +69,7 @@ public class SeaPreloadDto {
@ExcelProperty("quantity")
private Integer quantity;
@ExcelProperty("prodAttr")
private String prodAttr;//特性
}
......@@ -305,8 +305,10 @@ public class ShipmentPreloadExcelExportListener {
preloadDto.setUsageIds(getUsageMsg(item.getUsageIds()));
BigDecimal totalWorth = orderInfo.getOrderItemVOList().stream().map(OrderItemBackVO::getWorth).reduce(BigDecimal.ZERO, BigDecimal::add);
preloadDto.setWorth(totalWorth);
preloadDto.setTotalVolume(orderInfo.getSumVolume());
preloadDto.setTotalWeight(orderInfo.getSumWeight());
preloadDto.setTotalVolume(orderInfo.getSumVolumeFinishedWarehouseIn().compareTo(BigDecimal.ZERO) == 0 ? orderInfo.getSumVolume():orderInfo.getSumVolumeFinishedWarehouseIn());
preloadDto.setTotalWeight(orderInfo.getSumWeightFinishedWarehouseIn().compareTo(BigDecimal.ZERO) == 0 ? orderInfo.getSumWeight():orderInfo.getSumWeightFinishedWarehouseIn());
// preloadDto.setTotalVolume(orderInfo.getSumVolume());
// preloadDto.setTotalWeight(orderInfo.getSumWeight());
preloadDtoList.add(preloadDto);
if (StringUtils.isNotBlank(item.getOrderWarehouseInDetails())) {
item.setOrderWarehouseInDetailsVOList(JsonUtils.parseArray(item.getOrderWarehouseInDetails(), OrderWarehouseInDetailsVO.class));
......
......@@ -20,6 +20,7 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
import cn.iocoder.yudao.module.infra.service.file.FileService;
import cn.iocoder.yudao.module.order.dto.OrderBackInfoDto;
import cn.iocoder.yudao.module.order.service.order.*;
import cn.iocoder.yudao.module.order.vo.orderItem.OrderItemBackVO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxMergePkgDO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxPkgOrderDO;
......@@ -42,8 +43,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.context.event.EventListener;
......@@ -470,8 +470,10 @@ public class ShipmentReceivableExcelExportListener2 {
map.put("sumNum", orderInfo.getSumNum());
sum14 = sum14 + orderInfo.getSumNum();
}
map.put("sumVolume", orderInfo.getSumVolume());
sum15 = sum15.add(orderInfo.getSumVolume());
BigDecimal volume = orderInfo.getOrderItemVOList().stream().map(OrderItemBackVO::getChargeVolume).reduce(BigDecimal.ZERO, BigDecimal::add);
map.put("sumVolume", volume);
// map.put("sumVolume", orderInfo.getSumVolume());
sum15 = sum15.add(volume);
map.put("sumWeight", orderInfo.getSumWeight());
sum16 = sum16.add(orderInfo.getSumWeight());
map.put("vWeight", orderInfo.getVWeight());
......@@ -514,7 +516,7 @@ public class ShipmentReceivableExcelExportListener2 {
sum6.multiply(new BigDecimal(0.2)).
setScale(2, RoundingMode.HALF_UP));
headMap.put("BillinTTl",
currencyFuhaoMap.get(qgCurrency)
currencyFuhaoMap.get(yfCurrency)
+ sum6.subtract(sum4).subtract(
sum6.multiply(new BigDecimal(0.2)).setScale(2, RoundingMode.HALF_UP)));
......@@ -535,6 +537,8 @@ public class ShipmentReceivableExcelExportListener2 {
stringBuffer.append(currencyMap.get(otherMainCurrency)).append(":").append(sum4).append(" ").append(currencyMap.get(otherAssisCurrency)).append(":").append(sum5);
}
headMap.put("otherFee", stringBuffer.toString());
headMap.put("otherFeeMain", currencyMap.get(otherMainCurrency)+":"+sum4);
headMap.put("otherFeeAssis", currencyMap.get(otherAssisCurrency)+":"+sum5);
File fileDir = new File(dir);
if (!fileDir.exists()) {
// 不存在则创建一个目录
......@@ -576,6 +580,24 @@ public class ShipmentReceivableExcelExportListener2 {
start = start + count;
}
}
//业务数据从12行开始,22列为是否控货
Font font = workbook.createFont();
font.setColor(Font.COLOR_RED); //红色
CellStyle cellStyle=workbook.createCellStyle();
cellStyle.setFont(font);
cellStyle.setAlignment(HorizontalAlignment.CENTER);
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setBorderBottom(BorderStyle.THIN);
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setBorderTop(BorderStyle.THIN);
for (int i = 0; i < list.size(); i++) {
if (poiSheet.getRow(i+12).getCell(22).getStringCellValue().equals("YES")) {
for (int i1 = 0; i1 < 29; i1++) {
poiSheet.getRow(i+12).getCell(i1).setCellStyle(cellStyle);
}
}
}
FileOutputStream fileOutputStream =
new FileOutputStream(new File(dir + fileNameMerge));
......
......@@ -27,7 +27,9 @@ import cn.iocoder.yudao.module.order.service.order.*;
import cn.iocoder.yudao.module.order.service.orderWarehouseIn.OrderWarehouseInService;
import cn.iocoder.yudao.module.order.vo.orderWarehouseIn.OrderWarehouseInBackItemDo;
import cn.iocoder.yudao.module.order.vo.orderWarehouseIn.OrderWarehouseInBackVO;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductAttrDO;
import cn.iocoder.yudao.module.product.dal.dataobject.productbrank.ProductBrankDO;
import cn.iocoder.yudao.module.product.service.product.ProductAttrService;
import cn.iocoder.yudao.module.product.service.productbrank.ProductBrankService;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxApprovalDO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO;
......@@ -107,6 +109,9 @@ public class ShipmentSeaPreloadExcelExportListener {
@Resource
private OrderService orderService;
@Resource
private ProductAttrService productAttrService;
// @Value("${ue.templates-url}")
// private String path;
......@@ -149,6 +154,9 @@ public class ShipmentSeaPreloadExcelExportListener {
// 不存在则创建一个目录
fileDir.mkdirs();
}
List<ProductAttrDO> productAttrDOList = productAttrService.getProductAttrList();
Map<String, String> idNameMap = productAttrDOList.stream()
.collect(Collectors.toMap(attr -> String.valueOf(attr.getId()), ProductAttrDO::getAttrName));
ExcelWriter excelWriter = EasyExcel.write(dir + fileName).withTemplate(inputStream).build();
WriteSheet sheet = EasyExcel.writerSheet(0).build();
excelWriter.fill(headMap, sheet);
......@@ -204,6 +212,7 @@ public class ShipmentSeaPreloadExcelExportListener {
.registerWriteHandler(new CustomMergeStrategy(orderMap,orderWarehouseInService,orderItemService,17,true))
.registerWriteHandler(new CustomMergeStrategy(orderMap,orderWarehouseInService,orderItemService,18,false))
.registerWriteHandler(new CustomMergeStrategy(orderMap,orderWarehouseInService,orderItemService,20,false))
.registerWriteHandler(new CustomMergeStrategy(orderMap,orderWarehouseInService,orderItemService,21,false))
.automaticMergeHead(true).head(headList).needHead(true).build();
for (Map.Entry<Long, List<BoxPreloadGoodsBackVO>> entry : orderMap.entrySet()) {
Long orderId = entry.getKey();
......@@ -287,6 +296,7 @@ public class ShipmentSeaPreloadExcelExportListener {
// preloadDto.setQuantity(collect1.get(warehouse.getInTime()).get(warehouse.getUnit()).get(warehouse.getOrderLocationStr4Merge()).stream().mapToInt(OrderWarehouseInBackItemDo::getQuantityAll).sum());
preloadDto.setQuantity(collect1.get(warehouse.getInTime()).get(warehouse.getUnit()).get(warehouse.getOrderLocationStr4Merge()).stream().mapToInt(s -> Objects.isNull(s.getQuantityAll()) ? 0:s.getQuantityAll()).sum());
// preloadDto.setQuantity(collect.get(warehouse.getInTime()).stream().filter(jj -> jj.getQuantityAll() !=null ).mapToInt(OrderWarehouseInBackItemDo::getQuantityAll).sum());
preloadDto.setProdAttr(getAttrNameByIds(item.getProdAttrIds(),idNameMap));
list.add(preloadDto);
}
totalNum = totalNum + item.getWarehouseInInfoVO().getCartonsNum();
......@@ -341,5 +351,18 @@ public class ShipmentSeaPreloadExcelExportListener {
}
}
private String getAttrNameByIds(String attrIds, Map<String, String> idNameMap) {
StringJoiner labelJoiner = new StringJoiner(",");
if(StringUtils.isNotBlank(attrIds)) {
String[] attrIdArray = attrIds.split(",");
for (String attrId : attrIdArray) {
//map一定包含数据,否则是数据错误
labelJoiner.add(idNameMap.get(attrId));
}
return labelJoiner.toString();
}
return "";
}
}
......@@ -1674,6 +1674,15 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
templateParams.put("marks", marks);
switch (smsSceneEnum) {
case SHIPMENT_CABINET:
BoxCabinetDO boxCabinetDO = boxCabinetService.getByShipmentId(boxDO.getId());
if (Objects.nonNull(boxCabinetDO) && Objects.nonNull(boxCabinetDO.getLdBoxTime())) {
DateTime ldBoxTime = DateTime.of(boxCabinetDO.getLdBoxTime());
// 这里需要重置时间参数,这里的时间参数为填写的实际装柜时间
templateParams.put("date", DateUtils.formatDateTime(ldBoxTime));
templateParams.put("year", ldBoxTime.year());
templateParams.put("month", ldBoxTime.month() + 1);
templateParams.put("day", ldBoxTime.dayOfMonth());
}
// 装柜通知
if (orderNoList.size() > 1) {
templateCode = SmsSceneEnum.SHIPMENT_CABINETS.getTemplateCode();
......
......@@ -45,8 +45,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_IS_PRE_INSTALLED;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_NOT_EXISTS;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.*;
/**
......@@ -226,7 +225,15 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B
private void create(BoxPkgOrderCreateReqVO createReqVO) {
checkMergePkgStatus(createReqVO.getPkgId());
BoxDO boxDO = checkMergePkgStatus(createReqVO.getPkgId());
// 这里添加合包装箱时,需要检查订单是否为该出货单下的预装订单
long count = boxPreloadGoodsMapper.selectCount(new LambdaQueryWrapper<BoxPreloadGoodsDO>()
.eq(BoxPreloadGoodsDO::getOrderId, createReqVO.getOrderId())
.eq(BoxPreloadGoodsDO::getShipmentId, boxDO.getId()));
if (count == 0){
// 订单未预装,不能合包
throw exception(ORDER_IS_NOT_PRE_INSTALLED);
}
List<OrderItemDO> orderItemDOS = orderItemService.selectList(OrderItemDO::getOrderId, createReqVO.getOrderId());
orderItemDOS.stream().forEach(item -> {
// 插入
......@@ -359,11 +366,12 @@ public class BoxPkgOrderServiceImpl extends AbstractService<BoxPkgOrderMapper, B
return map;
}
private void checkMergePkgStatus(Long pkgId) {
private BoxDO checkMergePkgStatus(Long pkgId) {
BoxMergePkgDO boxMergePkgDO = boxMergePkgService.selectOne(BoxMergePkgDO::getId, pkgId);
BoxDO box = boxService.getBox(boxMergePkgDO.getShipmentId());
if (box.getAirShipmentStatus() != AirShipmentStatusEnum.UNSHIPMENT.getStatus()) {
throw exception(MERGE_PKG_IS_FINISH);
}
return box;
}
}
......@@ -829,6 +829,12 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
if (makeBillOfLadingListBackVO.getSpecialPriceCount() > 0L) {
stringBuffer.append("申请特价").append(",");
}
if (makeBillOfLadingListBackVO.getAdminDiscountCount() > 0L) {
stringBuffer.append("申请管理折扣").append(",");
}
if (makeBillOfLadingListBackVO.getBubbleDiscount() > 0L) {
stringBuffer.append("申请泡货优惠").append(",");
}
if (makeBillOfLadingListBackVO.getHeavyDiscount() > 0L) {
stringBuffer.append("申请重货优惠").append(",");
}
......
package cn.iocoder.yudao.module.shipment.utils;
import cn.iocoder.yudao.module.shipment.dto.AirLoadDto;
import cn.iocoder.yudao.module.shipment.dto.LoadDto;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.write.merge.AbstractMergeStrategy;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author huyufeng
* @date 2022/12/14
* @description 自定义单元格合并策略
*/
public class CustomLoadMergeStrategyNew extends AbstractMergeStrategy {
/**
* 分组,每几行合并一次
*/
private List<Integer> exportFieldGroupCountList;
private List<Integer> partMergeList;
private int mergeType;
/**
* 目标合并列index
*/
private Integer targetColumnIndex;
// 需要开始合并单元格的首行index
private Integer rowIndex;
// exportDataList为待合并目标列的值 partMerge为另外一种合并方式计算好的合并行数,mergeType 合并类型 1为订单维度合并 2为入仓记录维度的合并
public CustomLoadMergeStrategyNew(List<LoadDto> exportDataList, List<Integer> partMergeList, Integer targetColumnIndex, int mergeType) {
this.exportFieldGroupCountList = getGroupCountList(exportDataList,targetColumnIndex);
this.partMergeList = partMergeList;
this.mergeType = mergeType;
this.targetColumnIndex = targetColumnIndex;
}
@Override
protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) {
if (null == rowIndex) {
rowIndex = cell.getRowIndex();
}
// 仅从首行以及目标列的单元格开始合并,忽略其他
if (cell.getRowIndex() == rowIndex && cell.getColumnIndex() == targetColumnIndex ) {
if (mergeType == 1) {
mergeGroupColumn(sheet,exportFieldGroupCountList);
} else if (mergeType == 2) {
mergeGroupColumn(sheet,partMergeList);
}
}
}
private void mergeGroupColumn(Sheet sheet,List<Integer> list) {
int rowCount = rowIndex;
for (Integer count : list) {
if (count == 1) {
rowCount += count;
continue;
}
// 合并单元格
CellRangeAddress cellRangeAddress = new CellRangeAddress(rowCount, rowCount + count - 1, targetColumnIndex, targetColumnIndex);
sheet.addMergedRegionUnsafe(cellRangeAddress);
rowCount += count;
}
}
// 该方法将目标列根据值是否相同连续可合并,存储可合并的行数
private List<Integer> getGroupCountList(List<LoadDto> exportDataList,Integer targetColumnIndex) {
if (CollectionUtils.isEmpty(exportDataList)) {
return new ArrayList<>();
}
List<Integer> groupCountList = new ArrayList<>();
int count = 1;
LinkedHashMap<String, List<LoadDto>> collect = exportDataList.stream().collect(Collectors.groupingBy(LoadDto::getId, LinkedHashMap::new, Collectors.toList()));
for (Map.Entry<String, List<LoadDto>> entry : collect.entrySet()) {
groupCountList.add(entry.getValue().size());
}
return groupCountList;
}
}
......@@ -78,6 +78,10 @@ public class MakeBillOfLadingListBackVO {
private Integer specialPriceCount;
private Integer adminDiscountCount;
private Integer bubbleDiscount;
private Integer heavyDiscount;
private String orderStatusString;
......
......@@ -14,8 +14,10 @@
t.order_no as orderNo,
t.customs_type,
t.drawee as draweeCode,
(select count(*) from ecw_order_approval c where c.order_id=t.order_id and c.type=1 and c.deleted=0) as specialPriceCount,
(select count(*) from ecw_order_approval c where c.order_id=t.order_id and c.type=4 and c.deleted=0) as heavyDiscount,
(select count(*) from ecw_order_approval c where c.order_id=t.order_id and c.type in (1,31) and c.deleted=0) as specialPriceCount,
(select count(*) from ecw_order_approval c where c.order_id=t.order_id and c.type in (2,32) and c.deleted=0) as adminDiscountCount,
(select count(*) from ecw_order_approval c where c.order_id=t.order_id and c.type=4 and c.deleted=0) as bubbleDiscount,
(select count(*) from ecw_order_approval c where c.order_id=t.order_id and c.type=5 and c.deleted=0) as heavyDiscount,
t.is_cargo_control as isCargoControl,
t.sum_num as num,(
SELECT
......
......@@ -282,9 +282,9 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
break;
//已装单导出
case SHIPMENT_LOAD_EXCEL_EXPORT:
shipmentLoadExcelExportPushEvent(downloadLog);
// shipmentLoadExcelExportPushEvent(downloadLog);
//总体切换
//shipmentLoadExcelExportPushEvent2(downloadLog);
shipmentLoadExcelExportPushEvent2(downloadLog);
break;
//应收汇总导出修改导出Excel样式
case SHIPMENT_RECEIVABLE_EXCEL_EXPORT:
......
......@@ -9,10 +9,8 @@ import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableBackVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableOrderPayedFeeTypeVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableQueryVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import java.util.List;
......@@ -397,5 +395,10 @@ public interface ReceivableMapper extends AbstractMapper<ReceivableDO> {
"AND rb.order_id = #{orderId} ",
"</script>"
})
List<ReceivableDO> allByOrderId(Long orderId);
List<ReceivableDO> allByOrderId(@Param("orderId") Long orderId);
@Update({
"update ecw_receivable set `deleted` = 0 ,update_time = now() where `id` = #{receivableId}"
})
void revokeDeleteReceivableById(@Param("receivableId") Long receivableId);
}
......@@ -73,7 +73,7 @@ public interface ReceivableService extends IService<ReceivableDO> {
/**
* 删除应收款--内部接口,不会判断应收能不能进行删除,判断前置
*
* @param orderId 编号
* @param orderId 编号
* @param feeSourceList 费用来源 1 订单计算 2 费用申请 3 特性费用
*/
void deleteReceivableByOrderIdAndFeeSource(Long orderId, Collection<Integer> feeSourceList);
......@@ -81,7 +81,7 @@ public interface ReceivableService extends IService<ReceivableDO> {
/**
* 删除应收款--内部接口,不会判断应收能不能进行删除,判断前置
*
* @param orderId 订单ID
* @param orderId 订单ID
* @param feeSource 费用来源:1 订单计算 2 费用申请 3 特需费用
*/
void deleteReceivableByOrderIdAndFeeSource(Long orderId, Integer feeSource);
......@@ -100,6 +100,7 @@ public interface ReceivableService extends IService<ReceivableDO> {
* @param orderItemId 编号
*/
ReceivableDO getReceivableByOrderItemId(Long orderItemId, Integer feeType);
/**
* 获得应收款
*
......@@ -242,4 +243,11 @@ public interface ReceivableService extends IService<ReceivableDO> {
List<ReceivableDO> allByOrderId(Long orderId);
List<ReceivableDO> getOrderPayList(Collection<Long> orderIdList);
/**
* 根据应收id撤销删除的应收单
*
* @param receivableId 应收id
*/
void revokeDeleteReceivableById(Long receivableId);
}
......@@ -372,4 +372,9 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
.in(ReceivableDO::getOrderId, orderIdList)
);
}
@Override
public void revokeDeleteReceivableById(Long receivableId) {
receivableMapper.revokeDeleteReceivableById(receivableId);
}
}
......@@ -262,5 +262,11 @@ order.already.in.merge.pkg=
customer.is.new.or.old.no.change=
order.is.pre.installed=
order.is.not.pre.installed=
order.item.charging.not.null=
order.item.is.pay.advance.not.null=
order.item.freight.currency.not.null=
order.item.freight.unit.not.null=
order.item.clearance.currency.not.null=
order.item.clearance.unit.not.null=
member.id.is.null=
score.count.error=
\ No newline at end of file
......@@ -998,6 +998,15 @@ order.already.in.merge.pkg=The order has been placed under the packaging box
customer.is.new.or.old.no.change=customer current business type is {}, it's no change
order.is.pre.installed=Order pre installed
customer.delay.approval.times.more.then.one=delay approval times more then one
order.is.not.pre.installed =Order not pre installed, unable to package together
order.item.charging.not.null=The billing method for order products cannot be empty
order.item.is.pay.advance.not.null=Whether the ordered goods have been prepaid cannot be left blank
order.item.freight.currency.not.null=The currency unit for the shipping cost of the order item cannot be empty
order.item.freight.unit.not.null=The unit of measurement for shipping fees for order items cannot be empty
order.item.clearance.currency.not.null=Customs clearance fee for order goods, currency unit cannot be empty
order.item.clearance.unit.not.null=The unit of measurement for customs clearance fees for order goods cannot be empty
member.id.is.null=no member ids
score.count.error= score count must > 0
member.score.not.enough = member score not enough
......
......@@ -1001,7 +1001,13 @@ case.num.in.merge.pkg=\u6B64\u7BB1\u5DF2\u88AB\u5408\u5305\uFF0C\u8BF7\u626B\u63
order.already.in.merge.pkg=\u8BA2\u5355\u5DF2\u5728\u5408\u5305\u7BB1\u4E0B
customer.is.new.or.old.no.change=\u5BA2\u6237\u5F53\u524D\u4E1A\u7EE9\u7C7B\u578B\u662F{}\u5BA2\u6237\uFF0C\u4E0D\u9700\u8981\u66F4\u65B0
order.is.pre.installed=\u8BA2\u5355\u5DF2\u9884\u88C5
order.is.not.pre.installed =\u8BA2\u5355\u672A\u88C5\u7BB1\uFF0C\u4E0D\u80FD\u5408\u5305
order.is.not.pre.installed =\u8ba2\u5355\u672a\u9884\u88c5\uff0c\u4e0d\u80fd\u5408\u5305
order.item.charging.not.null=\u8ba2\u5355\u5546\u54c1\u8ba1\u8d39\u65b9\u5f0f\u4e0d\u80fd\u4e3a\u7a7a
order.item.is.pay.advance.not.null=\u8ba2\u5355\u5546\u54c1\u662f\u5426\u9884\u4ed8\u4e0d\u80fd\u4e3a\u7a7a
order.item.freight.currency.not.null=\u8ba2\u5355\u5546\u54c1\u8fd0\u8d39\u8d27\u5e01\u5355\u4f4d\u4e0d\u80fd\u4e3a\u7a7a
order.item.freight.unit.not.null=\u8ba2\u5355\u5546\u54c1\u8fd0\u8d39\u8ba1\u91cf\u5355\u4f4d\u4e0d\u80fd\u4e3a\u7a7a
order.item.clearance.currency.not.null=\u8ba2\u5355\u5546\u54c1\u6e05\u5173\u8d39\u8d27\u5e01\u5355\u4f4d\u4e0d\u80fd\u4e3a\u7a7a
order.item.clearance.unit.not.null=\u8ba2\u5355\u5546\u54c1\u6e05\u5173\u8d39\u8ba1\u91cf\u5355\u4f4d\u4e0d\u80fd\u4e3a\u7a7a
member.id.is.null=\u7F3A\u5C11\u4F1A\u5458id
score.count.error=\u79EF\u5206\u5FC5\u987B > 0
member.score.not.enough = \u4F1A\u5458\u79EF\u5206\u4E0D\u8DB3
......
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