order产品修改

This commit is contained in:
dev 2025-04-12 11:09:01 +08:00
parent e3c2a12a19
commit 8ec2796770
20 changed files with 594 additions and 67 deletions

View File

@ -50,7 +50,8 @@ public class BizInquiryRequestController extends BaseController {
/**
* 根据目的地仓库和渠道查询物流询价单
*/
@SaCheckPermission("amz:inquiryRequest:list")
// @SaCheckPermission("amz:inquiryRequest:list")
@SaCheckPermission("amz:shipmentPlan:edit")
@GetMapping("/query/{destination}/{channelId}/{date}")
public TableDataInfo<BizInquiryRequestVo> queryWithDesAndChannel(@PathVariable("destination") @NotNull(message = "目的地不能为空") String destination,
@PathVariable("channelId") @NotNull(message = "渠道不能为空") String channelId,
@ -62,7 +63,8 @@ public class BizInquiryRequestController extends BaseController {
/**
* 根据目的地仓库和渠道创建物流询价单
*/
@SaCheckPermission("amz:inquiryRequest:list")
// @SaCheckPermission("amz:inquiryRequest:list")
@SaCheckPermission("amz:shipmentPlan:edit")
@GetMapping("/create/{destination}/{channelId}/{date}")
public R<String> createWithDesAndChannel(@PathVariable("destination") @NotNull(message = "目的地不能为空") String destination,
@PathVariable("channelId") @NotNull(message = "渠道不能为空") String channelId,

View File

@ -85,7 +85,7 @@ public class BizLogisticsOrderController extends BaseController {
/**
* 新增物流订单
*/
@SaCheckPermission("amz:logisticsOrder:add")
@SaCheckPermission("amz:shipmentPlan:add")
@Log(title = "物流订单", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/createOrder")

View File

@ -53,7 +53,8 @@ public class BizLogisticsQuoteController extends BaseController {
/**
* 根据目的地仓库和渠道查询物流报价列表
*/
@SaCheckPermission("amz:logisticsQuote:list")
// @SaCheckPermission("amz:logisticsQuote:list")
@SaCheckPermission("amz:shipmentPlan:edit")
@GetMapping("/query/{destination}/{channelId}/{date}")
public TableDataInfo<BizLogisticsQuoteVo> queryWithDesAndChannel(@PathVariable("destination") @NotNull(message = "目的地不能为空") String destination,
@PathVariable("channelId") @NotNull(message = "渠道不能为空") String channelId,

View File

@ -7,6 +7,7 @@ import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.asinkj.amz.domain.vo.BizLogisticsQuoteVo;
import org.asinkj.amz.domain.vo.BizShipmentPlanOrderVo;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.asinkj.common.idempotent.annotation.RepeatSubmit;
@ -47,6 +48,13 @@ public class BizShipmentPlanController extends BaseController {
return bizShipmentPlanService.queryPageList(bo, pageQuery);
}
@SaCheckPermission("amz:shipmentPlan:list")
@GetMapping("/list/order")
public TableDataInfo<BizShipmentPlanOrderVo> listOrder(BizShipmentPlanBo bo, PageQuery pageQuery) {
return bizShipmentPlanService.queryPageListOrder(bo, pageQuery);
}
/**
* 导出货件计划列表
*/

View File

@ -78,6 +78,12 @@ public class BizLogisticsOrder extends TenantEntity {
*/
private Long shelfTimeliness;
/**
* 根据哪个报价单生成的报价单
*/
private Long quoteOrderId;
/**
* 删除标记0=正常1=删除
*/

View File

@ -68,6 +68,13 @@ public class BizShipmentItem extends TenantEntity {
*/
private String sku;
/**
* 品名
*/
private String productName;
private String asin;
/**
* 有效期
*/

View File

@ -134,21 +134,40 @@ public class BizShipmentPlan extends TenantEntity {
private String isSta;
/**
* box_quantity
* box_size
* logistics_weight
* set_total
* 运营操作货件状态
*/
private String fbaStatus;
/**
* 总箱子数量
*/
private Long boxQuantity;
/**
* 箱子尺寸
*/
private String boxSize;
private BigDecimal logisticsWeight;
/**
* 供应商称重
*/
private Long vendorWeight;
/**
* 套数系统中的申报量
*/
private Long setTotal;
/**
* 渠道ID
*/
private Long channelId;
/**
* 物流渠道
*/
private String channelName;
/**
* 删除标记
*/

View File

@ -35,128 +35,157 @@ public class BizShipmentPlanBo extends BaseEntity {
/**
* 关联系统ID
*/
@NotNull(message = "关联系统ID不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotNull(message = "关联系统ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long sid;
/**
* 货件编号
*/
@NotBlank(message = "货件编号不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotBlank(message = "货件编号不能为空", groups = { AddGroup.class, EditGroup.class })
private String shipmentId;
/**
* 货件名称
*/
@NotBlank(message = "货件名称不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotBlank(message = "货件名称不能为空", groups = { AddGroup.class, EditGroup.class })
private String shipmentName;
/**
* 是否关闭
*/
@NotBlank(message = "是否关闭不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotBlank(message = "是否关闭不能为空", groups = { AddGroup.class, EditGroup.class })
private String isClosed;
/**
* 货件状态
*/
@NotBlank(message = "货件状态不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotBlank(message = "货件状态不能为空", groups = { AddGroup.class, EditGroup.class })
private String shipmentStatus;
/**
* 物流中心编码
*/
@NotBlank(message = "物流中心编码不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotBlank(message = "物流中心编码不能为空", groups = { AddGroup.class, EditGroup.class })
private String destination;
/**
* 运输模式
*/
@NotBlank(message = "运输模式不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotBlank(message = "运输模式不能为空", groups = { AddGroup.class, EditGroup.class })
private String shippingMode;
/**
* 运输方案
*/
@NotBlank(message = "运输方案不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotBlank(message = "运输方案不能为空", groups = { AddGroup.class, EditGroup.class })
private String shippingSolution;
/**
* 最后更新时间
*/
@NotNull(message = "最后更新时间不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotNull(message = "最后更新时间不能为空", groups = { AddGroup.class, EditGroup.class })
private Date gmtModified;
/**
* 创建时间
*/
@NotNull(message = "创建时间不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotNull(message = "创建时间不能为空", groups = { AddGroup.class, EditGroup.class })
private Date gmtCreate;
/**
* 同步时间
*/
@NotNull(message = "同步时间不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotNull(message = "同步时间不能为空", groups = { AddGroup.class, EditGroup.class })
private Date receivingTime;
/**
* 计划发货日期
*/
@NotNull(message = "计划发货日期不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotNull(message = "计划发货日期不能为空", groups = { AddGroup.class, EditGroup.class })
private Date staShipmentDate;
/**
* 预计到货开始日
*/
@NotNull(message = "预计到货开始日不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotNull(message = "预计到货开始日不能为空", groups = { AddGroup.class, EditGroup.class })
private Date staDeliveryStartDate;
/**
* 预计到货截止日
*/
@NotNull(message = "预计到货截止日不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotNull(message = "预计到货截止日不能为空", groups = { AddGroup.class, EditGroup.class })
private Date staDeliveryEndDate;
/**
* 发货地址
*/
@NotBlank(message = "发货地址不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotBlank(message = "发货地址不能为空", groups = { AddGroup.class, EditGroup.class })
private FbaShipmentApiResponse.Address shipFromAddress;
/**
* 收货地址
*/
@NotBlank(message = "收货地址不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotBlank(message = "收货地址不能为空", groups = { AddGroup.class, EditGroup.class })
private FbaShipmentApiResponse.Address shipToAddress;
/**
* 参考编号
*/
@NotBlank(message = "参考编号不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotBlank(message = "参考编号不能为空", groups = { AddGroup.class, EditGroup.class })
private String referenceId;
/**
* 入库计划ID
*/
@NotBlank(message = "入库计划ID不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotBlank(message = "入库计划ID不能为空", groups = { AddGroup.class, EditGroup.class })
private String staInboundPlanId;
/**
* 是否STA计划
*/
@NotBlank(message = "是否STA计划不能为空", groups = { AddGroup.class, EditGroup.class })
// @NotBlank(message = "是否STA计划不能为空", groups = { AddGroup.class, EditGroup.class })
private String isSta;
/**
* 运营操作货件状态
*/
// @NotBlank(message = "运营操作货件状态不能为空", groups = { AddGroup.class, EditGroup.class })
private String fbaStatus;
@ExcelProperty(value = "箱子数量")
/**
* 总箱子数量
*/
// @NotNull(message = "总箱子数量不能为空", groups = { AddGroup.class, EditGroup.class })
private Long boxQuantity;
@ExcelProperty(value = "箱子尺寸")
/**
* 箱子尺寸
*/
// @NotBlank(message = "箱子尺寸不能为空", groups = { AddGroup.class, EditGroup.class })
private String boxSize;
@ExcelProperty(value = "总的物流商计重")
private BigDecimal logisticsWeight;
/**
* 总的物流商计重单位KG物流商实际测量值
*/
// @NotNull(message = "总的物流商计重单位KG物流商实际测量值不能为空", groups = { AddGroup.class, EditGroup.class })
private Long vendorWeight;
@ExcelProperty(value = "套数(系统中的申报量)")
/**
* 套数系统中的申报量
*/
// @NotNull(message = "套数(系统中的申报量)不能为空", groups = { AddGroup.class, EditGroup.class })
private Long setTotal;
/**
* 渠道ID
*/
// @NotNull(message = "渠道ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long channelId;
/**
* 物流渠道
*/
// @NotBlank(message = "物流渠道不能为空", groups = { AddGroup.class, EditGroup.class })
private String channelName;
}

View File

@ -91,4 +91,7 @@ public class BizShipmentItemVo implements Serializable {
private Date expiration;
private String productName;
}

View File

@ -0,0 +1,232 @@
package org.asinkj.amz.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.asinkj.amz.domain.*;
import org.asinkj.amz.hanlder.AddressTypeHandler;
import org.asinkj.asinking.entity.FbaShipmentApiResponse;
import org.asinkj.common.excel.annotation.ExcelDictFormat;
import org.asinkj.common.excel.convert.ExcelDictConvert;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 货件计划视图对象 biz_shipment_plan
*
* @author shuo hu
* @date 2025-03-19
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = BizShipmentPlan.class)
public class BizShipmentPlanOrderVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@ExcelProperty(value = "主键ID")
private Long id;
/**
* 关联系统ID
*/
@ExcelProperty(value = "关联系统ID")
private Long sid;
/**
* 货件编号
*/
@ExcelProperty(value = "货件编号")
private String shipmentId;
/**
* 货件名称
*/
@ExcelProperty(value = "货件名称")
private String shipmentName;
@ExcelProperty(value = "店铺名称")
private String sellerName;
/**
* 是否关闭
*/
@ExcelProperty(value = "是否关闭")
private String isClosed;
/**
* 货件状态
*/
@ExcelProperty(value = "货件状态")
private String shipmentStatus;
/**
* 物流中心编码
*/
@ExcelProperty(value = "物流中心编码")
private String destination;
/**
* 运输模式
*/
@ExcelProperty(value = "运输模式")
private String shippingMode;
/**
* 运输方案
*/
@ExcelProperty(value = "运输方案")
private String shippingSolution;
/**
* 最后更新时间
*/
@ExcelProperty(value = "最后更新时间")
private Date gmtModified;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private Date gmtCreate;
/**
* 同步时间
*/
@ExcelProperty(value = "同步时间")
private Date receivingTime;
/**
* 计划发货日期
*/
@ExcelProperty(value = "计划发货日期")
private Date staShipmentDate;
/**
* 预计到货开始日
*/
@ExcelProperty(value = "预计到货开始日")
private Date staDeliveryStartDate;
/**
* 预计到货截止日
*/
@ExcelProperty(value = "预计到货截止日")
private Date staDeliveryEndDate;
/**
* 发货地址
*/
@ExcelProperty(value = "发货地址")
@TableField(value = "ship_from_address", typeHandler = AddressTypeHandler.class)
private FbaShipmentApiResponse.Address shipFromAddress;
/**
* 收货地址
*/
@ExcelProperty(value = "收货地址")
@TableField(value = "ship_to_address", typeHandler = AddressTypeHandler.class)
private FbaShipmentApiResponse.Address shipToAddress;
/**
* 参考编号
*/
@ExcelProperty(value = "参考编号")
private String referenceId;
/**
* 入库计划ID
*/
@ExcelProperty(value = "入库计划ID")
private String staInboundPlanId;
/**
* 是否STA计划
*/
@ExcelProperty(value = "是否STA计划")
private String isSta;
/**
* 运营操作货件状态
*/
@ExcelProperty(value = "运营操作货件状态")
private String fbaStatus;
/**
* 总箱子数量
*/
@ExcelProperty(value = "总箱子数量")
private Long boxQuantity;
/**
* 箱子尺寸
*/
@ExcelProperty(value = "箱子尺寸")
private String boxSize;
/**
* 供应商称重单位KG物流商实际测量值
*/
@ExcelProperty(value = "供应商称重")
private Long vendorWeight;
@ExcelProperty(value = "物流商称重")
private Long logisticWeight;
/**
* 称重差异应用层计算物流商计重 - 供应商称重
*/
private Long weightDiff;
/**
* 套数系统中的申报量
*/
@ExcelProperty(value = "套数")
private Long setTotal;
/**
* 渠道ID
*/
@ExcelProperty(value = "渠道ID")
private Long channelId;
/**
* 物流渠道
*/
@ExcelProperty(value = "物流渠道")
private String channelName;
private String trackingNumber;
/**
* 订单明细
*/
private List<BizLogisticsOrderDetail> detailList;
/**
* 产品明细
*/
private List<BizShipmentItem> itemVoList;
private BizLogisticsOrder order;
private BizLogisticsQuote quote;
}

View File

@ -6,9 +6,12 @@ import java.util.Date;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMappers;
import org.asinkj.amz.domain.BizShipmentItem;
import org.asinkj.amz.domain.BizShipmentPlan;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import org.asinkj.amz.domain.BizShipmentTracking;
import org.asinkj.amz.hanlder.AddressTypeHandler;
import org.asinkj.asinking.entity.FbaShipmentApiResponse;
import org.asinkj.common.excel.annotation.ExcelDictFormat;
@ -19,6 +22,7 @@ import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -29,7 +33,10 @@ import java.util.Date;
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = BizShipmentPlan.class)
@AutoMappers({
@AutoMapper(target = BizShipmentPlan.class),
@AutoMapper(target = BizShipmentPlanOrderVo.class)
})
public class BizShipmentPlanVo implements Serializable {
@Serial
@ -47,6 +54,9 @@ public class BizShipmentPlanVo implements Serializable {
@ExcelProperty(value = "关联系统ID")
private Long sid;
@ExcelProperty(value = "店铺名称")
private String sellerName;
/**
* 货件编号
*/
@ -158,22 +168,55 @@ public class BizShipmentPlanVo implements Serializable {
private String isSta;
@ExcelProperty(value = "箱子数量")
private Long boxNum;
/**
* 运营操作货件状态
*/
@ExcelProperty(value = "运营操作货件状态")
private String fbaStatus;
@ExcelProperty(value = "箱子数量")
/**
* 总箱子数量
*/
@ExcelProperty(value = "总箱子数量")
private Long boxQuantity;
/**
* 箱子尺寸
*/
@ExcelProperty(value = "箱子尺寸")
private String boxSize;
@ExcelProperty(value = "总的物流商计重")
private BigDecimal logisticsWeight;
/**
* 总的物流商计重单位KG物流商实际测量值
*/
@ExcelProperty(value = "总的物流商计重", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "单=位KG物流商实际测量值")
private Long vendorWeight;
@ExcelProperty(value = "套数(系统中的申报量)")
/**
* 套数系统中的申报量
*/
@ExcelProperty(value = "套数", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "系=统中的申报量")
private Long setTotal;
/**
* 渠道ID
*/
@ExcelProperty(value = "渠道ID")
private Long channelId;
/**
* 物流渠道
*/
@ExcelProperty(value = "物流渠道")
private String channelName;
private List<BizShipmentItem> itemVoList;
// 显式添加 Setter即使使用 @Data
public void setShipFromAddress(FbaShipmentApiResponse.Address shipFromAddress) {

View File

@ -1,6 +1,8 @@
package org.asinkj.amz.service;
import cn.hutool.core.lang.Opt;
import jakarta.validation.constraints.NotNull;
import org.asinkj.amz.domain.BizLogisticsQuote;
import org.asinkj.amz.domain.bo.BizLogisticsQuoteMostBo;
import org.asinkj.amz.domain.vo.BizLogisticsQuoteVo;
import org.asinkj.amz.domain.bo.BizLogisticsQuoteBo;
@ -12,6 +14,7 @@ import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 物流报价Service接口
@ -83,4 +86,6 @@ public interface IBizLogisticsQuoteService {
Boolean checkPriceQuoteByBo(BizLogisticsQuoteMostBo bo);
List<InquiryQuoteStatusDTO> getTodayQuoteStatus();
List<BizLogisticsQuote> queryQuoteWithQuoteId(Set<Long> quoteIds);
}

View File

@ -3,6 +3,7 @@ package org.asinkj.amz.service;
import jakarta.validation.constraints.NotNull;
import org.asinkj.amz.domain.BizShipmentPlan;
import org.asinkj.amz.domain.vo.BizLogisticsQuoteVo;
import org.asinkj.amz.domain.vo.BizShipmentPlanOrderVo;
import org.asinkj.amz.domain.vo.BizShipmentPlanVo;
import org.asinkj.amz.domain.bo.BizShipmentPlanBo;
import org.asinkj.common.mybatis.core.page.TableDataInfo;
@ -74,4 +75,6 @@ public interface IBizShipmentPlanService {
BizShipmentPlanVo queryByfbaShipmentId(String fbaShipmentId);
void takeTodayAmzPlanData();
TableDataInfo<BizShipmentPlanOrderVo> queryPageListOrder(BizShipmentPlanBo bo, PageQuery pageQuery);
}

View File

@ -9,6 +9,7 @@ import org.asinkj.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
* 亚马逊店铺信息Service接口
@ -87,5 +88,7 @@ public interface ISysAmazonStoreService {
void testAmazonData2() throws Exception;
List<SysAmazonStore> queryBySidList(Set<Long> sids);
// void pullAmzStaData(String startDate, String endDate);
}

View File

@ -215,7 +215,7 @@ public class BizLogisticsOrderServiceImpl implements IBizLogisticsOrderService {
List<BizShipmentTracking> trackingList = bizShipmentTrackingService.queryByPlanId(planVo.getShipmentId());
List<BizShipmentItem> itemList = bizShipmentItemService.queryByPlanId(planVo.getShipmentId());
long sum = itemList.stream().mapToLong(BizShipmentItem::getQuantityShipped).sum();
long sum = itemList.stream().filter(item -> item.getQuantityShipped() != null).mapToLong(BizShipmentItem::getQuantityShipped).sum();
BizLogisticsOrder bizLogisticsOrder = new BizLogisticsOrder();
@ -228,6 +228,8 @@ public class BizLogisticsOrderServiceImpl implements IBizLogisticsOrderService {
String nickName = remoteUserService.selectNicknameById(quoteVo.getUserId());
bizLogisticsOrder.setLogisticsProviderName(nickName);
bizLogisticsOrder.setQuoteOrderId(Long.valueOf(bo.getLogicQuoteId()));
bizLogisticsOrder.setChannelName(quoteVo.getChannelName());
// 目的地
bizLogisticsOrder.setDestination(quoteVo.getDestination());

View File

@ -3,6 +3,7 @@ package org.asinkj.amz.service.impl;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.util.NumberUtil;
import lombok.extern.slf4j.Slf4j;
import org.asinkj.amz.domain.BizInquiryRequest;
@ -318,6 +319,17 @@ public class BizLogisticsQuoteServiceImpl implements IBizLogisticsQuoteService {
return result;
}
@Override
public List<BizLogisticsQuote> queryQuoteWithQuoteId(Set<Long> quoteIds) {
if (quoteIds != null && !quoteIds.isEmpty()) {
LambdaQueryWrapper<BizLogisticsQuote> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(BizLogisticsQuote::getId, quoteIds);
return baseMapper.selectList(queryWrapper);
}
return List.of();
}
// 解析 target_providers 字符串为物流商ID列表
private List<Long> parseTargetProviders(String targetProviders) {
if (StringUtils.isBlank(targetProviders)) {

View File

@ -5,11 +5,12 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
import org.asinkj.amz.domain.BizShipmentTracking;
import org.asinkj.amz.domain.*;
import org.asinkj.amz.domain.bo.SysAmazonStoreBo;
import org.asinkj.amz.domain.vo.BizLogisticsQuoteVo;
import org.asinkj.amz.domain.vo.BizShipmentPlanOrderVo;
import org.asinkj.amz.domain.vo.SysAmazonStoreVo;
import org.asinkj.amz.mapper.BizShipmentTrackingMapper;
import org.asinkj.amz.mapper.*;
import org.asinkj.amz.service.IBizLogisticsQuoteService;
import org.asinkj.amz.service.ISysAmazonStoreService;
import org.asinkj.amz.service.LingxinCallback;
@ -26,15 +27,11 @@ import org.asinkj.resource.api.RemoteMessageService;
import org.springframework.stereotype.Service;
import org.asinkj.amz.domain.bo.BizShipmentPlanBo;
import org.asinkj.amz.domain.vo.BizShipmentPlanVo;
import org.asinkj.amz.domain.BizShipmentPlan;
import org.asinkj.amz.mapper.BizShipmentPlanMapper;
import org.asinkj.amz.service.IBizShipmentPlanService;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.Set;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -60,9 +57,19 @@ public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
@Resource
private BizShipmentTrackingMapper bizShipmentTrackingMapper;
@Resource
private BizShipmentItemMapper bizShipmentItemMapper;
@Resource
private RemoteMessageService remoteMessageService;
@Resource
private BizLogisticsOrderMapper bizLogisticsOrderMapper;
@Resource
private BizLogisticsOrderDetailMapper bizLogisticsOrderDetailMapper;
/**
* 查询货件计划
*
@ -87,20 +94,42 @@ public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
Page<BizShipmentPlanVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
Set<String> shipmentIds = result.getRecords().stream().map(BizShipmentPlanVo::getShipmentId).collect(Collectors.toSet());
if (CollectionUtil.isNotEmpty(shipmentIds)) {
LambdaQueryWrapper<BizShipmentTracking> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(BizShipmentTracking::getShipmentId, shipmentIds);
List<BizShipmentTracking> bizShipmentTrackings = bizShipmentTrackingMapper.selectList(queryWrapper);
Map<String, Long> collect = bizShipmentTrackings.stream()
.collect(Collectors.groupingBy(
BizShipmentTracking::getShipmentId,
Collectors.counting()
));
for (BizShipmentPlanVo bizShipmentPlanVo : result.getRecords()) {
Long count = collect.get(bizShipmentPlanVo.getShipmentId());
bizShipmentPlanVo.setBoxNum(count);
}
}
Set<Long> sids = result.getRecords().stream().map(BizShipmentPlanVo::getSid).collect(Collectors.toSet());
Map<Long, String> storeNameMap = new HashMap<>();
if (CollectionUtil.isNotEmpty(sids)) {
storeNameMap = iSysAmazonStoreService.queryBySidList(sids).stream().collect(Collectors.toMap(SysAmazonStore::getSid, SysAmazonStore::getStoreName));
}
if (CollectionUtil.isNotEmpty(shipmentIds)) {
LambdaQueryWrapper<BizShipmentTracking> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(BizShipmentTracking::getShipmentId, shipmentIds);
List<BizShipmentTracking> bizShipmentTrackings = bizShipmentTrackingMapper.selectList(queryWrapper);
Map<String, Long> collect = bizShipmentTrackings.stream()
.collect(Collectors.groupingBy(
BizShipmentTracking::getShipmentId,
Collectors.counting()
));
LambdaQueryWrapper<BizShipmentItem> bizShipmentItemLambdaQueryWrapper = new LambdaQueryWrapper<>();
bizShipmentItemLambdaQueryWrapper.in(BizShipmentItem::getShipmentId, shipmentIds);
List<BizShipmentItem> bizShipmentItems = bizShipmentItemMapper.selectList(bizShipmentItemLambdaQueryWrapper);
Map<String, List<BizShipmentItem>> collect1 = bizShipmentItems.stream().collect(Collectors.groupingBy(BizShipmentItem::getShipmentId, Collectors.toList()));
for (BizShipmentPlanVo bizShipmentPlanVo : result.getRecords()) {
Long count = collect.get(bizShipmentPlanVo.getShipmentId());
bizShipmentPlanVo.setBoxQuantity(count);
bizShipmentPlanVo.setItemVoList(collect1.get(bizShipmentPlanVo.getShipmentId()));
if (CollectionUtil.isNotEmpty(sids)) {
String storeName = storeNameMap.get(bizShipmentPlanVo.getSid());
bizShipmentPlanVo.setSellerName(storeName);
}
}
}
return TableDataInfo.build(result);
}
@ -125,7 +154,7 @@ public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
));
for (BizShipmentPlanVo bizShipmentPlanVo : bizShipmentPlanVos) {
Long count = collect.get(bizShipmentPlanVo.getShipmentId());
bizShipmentPlanVo.setBoxNum(count);
bizShipmentPlanVo.setBoxQuantity(count);
}
return bizShipmentPlanVos;
}
@ -153,6 +182,14 @@ public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
lqw.eq(StringUtils.isNotBlank(bo.getStaInboundPlanId()), BizShipmentPlan::getStaInboundPlanId, bo.getStaInboundPlanId());
lqw.eq(StringUtils.isNotBlank(bo.getIsSta()), BizShipmentPlan::getIsSta, bo.getIsSta());
lqw.eq(StringUtils.isNotBlank(bo.getFbaStatus()), BizShipmentPlan::getFbaStatus, bo.getFbaStatus());
lqw.eq(bo.getBoxQuantity() != null, BizShipmentPlan::getBoxQuantity, bo.getBoxQuantity());
lqw.eq(StringUtils.isNotBlank(bo.getBoxSize()), BizShipmentPlan::getBoxSize, bo.getBoxSize());
lqw.eq(bo.getVendorWeight() != null, BizShipmentPlan::getVendorWeight, bo.getVendorWeight());
lqw.eq(bo.getSetTotal() != null, BizShipmentPlan::getSetTotal, bo.getSetTotal());
lqw.eq(bo.getChannelId() != null, BizShipmentPlan::getChannelId, bo.getChannelId());
lqw.like(StringUtils.isNotBlank(bo.getChannelName()), BizShipmentPlan::getChannelName, bo.getChannelName());
SysAmazonStoreBo sysAmazonStoreBo = new SysAmazonStoreBo();
sysAmazonStoreBo.setUserId(LoginHelper.getUserId());
List<SysAmazonStoreVo> sysAmazonStoreVos = iSysAmazonStoreService.queryList(sysAmazonStoreBo);
@ -232,7 +269,6 @@ public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
}
@Override
public void takeTodayAmzPlanData() {
@ -252,4 +288,87 @@ public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
}
});
}
@Override
public TableDataInfo<BizShipmentPlanOrderVo> queryPageListOrder(BizShipmentPlanBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<BizShipmentPlan> lqw = buildQueryWrapper(bo);
Page<BizShipmentPlanVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
Set<String> shipmentIds = result.getRecords().stream().map(BizShipmentPlanVo::getShipmentId).collect(Collectors.toSet());
List<BizShipmentPlanOrderVo> convert = MapstructUtils.convert(result.getRecords(), BizShipmentPlanOrderVo.class);
Page<BizShipmentPlanOrderVo> bizShipmentPlanOrderVoPage = new Page<>(result.getCurrent(), result.getSize(), result.getTotal());
bizShipmentPlanOrderVoPage.setRecords(convert);
Set<Long> sids = result.getRecords().stream().map(BizShipmentPlanVo::getSid).collect(Collectors.toSet());
Map<Long, String> storeNameMap = new HashMap<>();
if (CollectionUtil.isNotEmpty(sids)) {
storeNameMap = iSysAmazonStoreService.queryBySidList(sids).stream().collect(Collectors.toMap(SysAmazonStore::getSid, SysAmazonStore::getStoreName));
}
if (CollectionUtil.isNotEmpty(shipmentIds)) {
LambdaQueryWrapper<BizShipmentTracking> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(BizShipmentTracking::getShipmentId, shipmentIds);
List<BizShipmentTracking> bizShipmentTrackings = bizShipmentTrackingMapper.selectList(queryWrapper);
Map<String, Long> collect = bizShipmentTrackings.stream()
.collect(Collectors.groupingBy(
BizShipmentTracking::getShipmentId,
Collectors.counting()
));
LambdaQueryWrapper<BizLogisticsOrder> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(BizLogisticsOrder::getFbaShipmentId, shipmentIds);
List<BizLogisticsOrder> bizLogisticsOrders = bizLogisticsOrderMapper.selectList(lambdaQueryWrapper);
Set<Long> quoteIds = bizLogisticsOrders.stream().map(BizLogisticsOrder::getQuoteOrderId).collect(Collectors.toSet());
List<BizLogisticsQuote> quotes = iLogisticsQuoteService.queryQuoteWithQuoteId(quoteIds);
Map<Long, BizLogisticsQuote> quoteMap = quotes.stream().collect(Collectors.toMap(BizLogisticsQuote::getId, Function.identity()));
Map<String, BizLogisticsOrder> orderMap = bizLogisticsOrders.stream().collect(Collectors.toMap(BizLogisticsOrder::getFbaShipmentId, Function.identity(),
(existing, replacement) -> existing));
LambdaQueryWrapper<BizLogisticsOrderDetail> orderDetailLambdaQueryWrapper = new LambdaQueryWrapper<>();
orderDetailLambdaQueryWrapper.in(BizLogisticsOrderDetail::getFbaShipmentId, shipmentIds);
List<BizLogisticsOrderDetail> bizLogisticsOrderDetails = bizLogisticsOrderDetailMapper.selectList(orderDetailLambdaQueryWrapper);
Map<String, List<BizLogisticsOrderDetail>> detailMap = bizLogisticsOrderDetails.stream().collect(Collectors.groupingBy(BizLogisticsOrderDetail::getFbaShipmentId));
LambdaQueryWrapper<BizShipmentItem> bizShipmentItemLambdaQueryWrapper = new LambdaQueryWrapper<>();
bizShipmentItemLambdaQueryWrapper.in(BizShipmentItem::getShipmentId, shipmentIds);
List<BizShipmentItem> bizShipmentItems = bizShipmentItemMapper.selectList(bizShipmentItemLambdaQueryWrapper);
Map<String, List<BizShipmentItem>> collect1 = bizShipmentItems.stream().collect(Collectors.groupingBy(BizShipmentItem::getShipmentId, Collectors.toList()));
for (BizShipmentPlanOrderVo bizShipmentPlanVo : bizShipmentPlanOrderVoPage.getRecords()) {
Long count = collect.get(bizShipmentPlanVo.getShipmentId());
BizLogisticsOrder bizLogisticsOrder = orderMap.get(bizShipmentPlanVo.getShipmentId());
List<BizLogisticsOrderDetail> bizLogisticsOrderDetails1 = detailMap.get(bizShipmentPlanVo.getShipmentId());
bizShipmentPlanVo.setItemVoList(collect1.get(bizShipmentPlanVo.getShipmentId()));
bizShipmentPlanVo.setDetailList(bizLogisticsOrderDetails1);
if (CollectionUtil.isNotEmpty(bizLogisticsOrderDetails1)) {
BizLogisticsOrderDetail bizLogisticsOrderDetail = bizLogisticsOrderDetails1.get(0);
bizShipmentPlanVo.setTrackingNumber(bizLogisticsOrderDetail.getTrackingNumber());
long sum = bizLogisticsOrderDetails1.stream().filter(item -> item.getLogisticsWeight() != null).mapToLong(BizLogisticsOrderDetail::getLogisticsWeight).sum();
bizShipmentPlanVo.setLogisticWeight(sum);
long l = bizShipmentPlanVo.getLogisticWeight() - bizShipmentPlanVo.getVendorWeight();
bizShipmentPlanVo.setWeightDiff(l);
}
bizShipmentPlanVo.setBoxQuantity(count);
bizShipmentPlanVo.setOrder(bizLogisticsOrder);
BizLogisticsQuote bizLogisticsQuote = quoteMap.get(bizLogisticsOrder.getQuoteOrderId());
bizShipmentPlanVo.setQuote(bizLogisticsQuote);
if (CollectionUtil.isNotEmpty(sids)) {
String storeName = storeNameMap.get(bizShipmentPlanVo.getSid());
bizShipmentPlanVo.setSellerName(storeName);
}
}
}
return TableDataInfo.build(bizShipmentPlanOrderVoPage);
}
}

View File

@ -147,6 +147,9 @@ public class SysAmazonStoreServiceImpl implements ISysAmazonStoreService {
lqw.eq(bo.getHasAdsSetting() != null, SysAmazonStore::getHasAdsSetting, bo.getHasAdsSetting());
lqw.eq(bo.getStatus() != null, SysAmazonStore::getStatus, bo.getStatus());
lqw.orderByDesc(SysAmazonStore::getSid);
if (!LoginHelper.isSuperAdmin()&&!LoginHelper.isManagerAdmin()){
lqw.eq(SysAmazonStore::getUserId, LoginHelper.getUserId());
}
return lqw;
}
@ -629,6 +632,8 @@ public class SysAmazonStoreServiceImpl implements ISysAmazonStoreService {
bizShipmentItem.setMsku(item.getMsku());
bizShipmentItem.setFnsku(item.getFnsku());
bizShipmentItem.setSku(item.getSku());
bizShipmentItem.setProductName(item.getProductName());
bizShipmentItem.setAsin(item.getAsin());
// bizShipmentItem.setQuantityShipped(item.getQuantity());
bizShipmentItems.add(bizShipmentItem);
}
@ -761,5 +766,15 @@ public class SysAmazonStoreServiceImpl implements ISysAmazonStoreService {
}
@Override
public List<SysAmazonStore> queryBySidList(Set<Long> sids) {
if (CollectionUtil.isNotEmpty(sids)) {
LambdaQueryWrapper<SysAmazonStore> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(SysAmazonStore::getSid, sids);
return baseMapper.selectList(queryWrapper);
}
return List.of();
}
}

View File

@ -32,6 +32,12 @@ public interface TenantConstants {
*/
String TENANT_ADMIN_ROLE_KEY = "admin";
String TENANT_MANAGER_ROLE_KEY = "manager";
String YUNYING_ADMIN_ROLE_KEY = "yunying";
/**
* 租户管理员角色名称
*/

View File

@ -178,6 +178,14 @@ public class LoginHelper {
return rolePermission.contains(TenantConstants.TENANT_ADMIN_ROLE_KEY);
}
public static boolean isManagerAdmin(Set<String> rolePermission) {
if (CollUtil.isEmpty(rolePermission)) {
return false;
}
return rolePermission.contains(TenantConstants.TENANT_MANAGER_ROLE_KEY);
}
/**
* 是否为租户管理员
*
@ -187,6 +195,10 @@ public class LoginHelper {
return Convert.toBool(isTenantAdmin(getLoginUser().getRolePermission()));
}
public static boolean isManagerAdmin() {
return Convert.toBool(isManagerAdmin(getLoginUser().getRolePermission()));
}
/**
* 检查当前用户是否已登录
*