运营端修改
This commit is contained in:
parent
022f73dd9e
commit
e3c2a12a19
2
.gitignore
vendored
2
.gitignore
vendored
@ -45,3 +45,5 @@ nbdist/
|
||||
!*/build/*.xml
|
||||
|
||||
.flattened-pom.xml
|
||||
|
||||
.lingma
|
||||
|
@ -1,12 +1,23 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="asinkj-gateway" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<configuration default="false" name="asinkj-gateway" type="docker-deploy" factoryName="dockerfile" server-name="阿里云">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="imageTag" value="asinkj/asinkj-gateway:2.2.2" />
|
||||
<option name="buildOnly" value="true" />
|
||||
<option name="containerName" value="asinkj-gateway" />
|
||||
<option name="portBindings">
|
||||
<list>
|
||||
<DockerPortBindingImpl>
|
||||
<option name="containerPort" value="8080" />
|
||||
<option name="hostPort" value="8080" />
|
||||
</DockerPortBindingImpl>
|
||||
</list>
|
||||
</option>
|
||||
<option name="commandLineOptions" value="--network 1panel-network" />
|
||||
<option name="sourceFilePath" value="asinkj-gateway/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<method v="2" />
|
||||
<method v="2">
|
||||
<option name="Maven.BeforeRunTask" enabled="true" file="F:\Asinkj-Cloud\asinkj-gateway/pom.xml" goal="package" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
@ -1,12 +1,23 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="asinkj-job" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<configuration default="false" name="asinkj-job" type="docker-deploy" factoryName="dockerfile" server-name="阿里云">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="imageTag" value="asinkj/asinkj-job:2.2.2" />
|
||||
<option name="buildOnly" value="true" />
|
||||
<option name="containerName" value="asinkj-job" />
|
||||
<option name="portBindings">
|
||||
<list>
|
||||
<DockerPortBindingImpl>
|
||||
<option name="containerPort" value="9203" />
|
||||
<option name="hostPort" value="9203" />
|
||||
</DockerPortBindingImpl>
|
||||
</list>
|
||||
</option>
|
||||
<option name="commandLineOptions" value="--network 1panel-network" />
|
||||
<option name="sourceFilePath" value="asinkj-modules/asinkj-job/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<method v="2" />
|
||||
<method v="2">
|
||||
<option name="Maven.BeforeRunTask" enabled="true" file="$PROJECT_DIR$/asinkj-modules/asinkj-job/pom.xml" goal="package -Pprod" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
@ -1,12 +1,23 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="asinkj-resource" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<configuration default="false" name="asinkj-resource" type="docker-deploy" factoryName="dockerfile" server-name="阿里云">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="imageTag" value="asinkj/asinkj-resource:2.2.2" />
|
||||
<option name="buildOnly" value="true" />
|
||||
<option name="containerName" value="asinkj-resource" />
|
||||
<option name="portBindings">
|
||||
<list>
|
||||
<DockerPortBindingImpl>
|
||||
<option name="containerPort" value="9204" />
|
||||
<option name="hostPort" value="9204" />
|
||||
</DockerPortBindingImpl>
|
||||
</list>
|
||||
</option>
|
||||
<option name="commandLineOptions" value="--network 1panel-network" />
|
||||
<option name="sourceFilePath" value="asinkj-modules/asinkj-resource/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<method v="2" />
|
||||
<method v="2">
|
||||
<option name="Maven.BeforeRunTask" enabled="true" file="F:\Asinkj-Cloud\asinkj-modules\asinkj-resource/pom.xml" goal="package" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
@ -1,12 +1,27 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="asinkj-snailjob-server" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<configuration default="false" name="asinkj-snailjob-server" type="docker-deploy" factoryName="dockerfile" server-name="阿里云">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="imageTag" value="asinkj/asinkj-snailjob-server:2.2.2" />
|
||||
<option name="buildOnly" value="true" />
|
||||
<option name="containerName" value="asinkj-snailjob-server" />
|
||||
<option name="portBindings">
|
||||
<list>
|
||||
<DockerPortBindingImpl>
|
||||
<option name="containerPort" value="8800" />
|
||||
<option name="hostPort" value="8800" />
|
||||
</DockerPortBindingImpl>
|
||||
<DockerPortBindingImpl>
|
||||
<option name="containerPort" value="17888" />
|
||||
<option name="hostPort" value="17888" />
|
||||
</DockerPortBindingImpl>
|
||||
</list>
|
||||
</option>
|
||||
<option name="commandLineOptions" value="--network 1panel-network" />
|
||||
<option name="sourceFilePath" value="asinkj-visual/asinkj-snailjob-server/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<method v="2" />
|
||||
<method v="2">
|
||||
<option name="Maven.BeforeRunTask" enabled="true" file="F:\Asinkj-Cloud\asinkj-visual\asinkj-snailjob-server/pom.xml" goal="package" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
@ -1,12 +1,23 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="asinkj-system" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<configuration default="false" name="asinkj-system" type="docker-deploy" factoryName="dockerfile" server-name="阿里云">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="imageTag" value="asinkj/asinkj-system:2.2.2" />
|
||||
<option name="buildOnly" value="true" />
|
||||
<option name="containerName" value="asinkj-system" />
|
||||
<option name="portBindings">
|
||||
<list>
|
||||
<DockerPortBindingImpl>
|
||||
<option name="containerPort" value="9201" />
|
||||
<option name="hostPort" value="9201" />
|
||||
</DockerPortBindingImpl>
|
||||
</list>
|
||||
</option>
|
||||
<option name="commandLineOptions" value="--network 1panel-network" />
|
||||
<option name="sourceFilePath" value="asinkj-modules/asinkj-system/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<method v="2" />
|
||||
<method v="2">
|
||||
<option name="Maven.BeforeRunTask" enabled="true" file="F:\Asinkj-Cloud\asinkj-modules\asinkj-system/pom.xml" goal="package" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
@ -1,10 +1,10 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-debian:17.0.11-cds
|
||||
#FROM bellsoft/liberica-openjdk-debian:21.0.3-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
FROM amazoncorretto:17.0.14
|
||||
|
||||
LABEL maintainer="Shuo Hu "
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
RUN mkdir -p /asinkj/auth/logs \
|
||||
/asinkj/auth/temp \
|
||||
/asinkj/skywalking/agent
|
||||
@ -18,7 +18,7 @@ EXPOSE ${SERVER_PORT}
|
||||
ADD ./target/asinkj-auth.jar ./app.jar
|
||||
|
||||
ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -Dserver.port=${SERVER_PORT} \
|
||||
-Dspring.profiles.active='prod' \ # 动态读取环境变量
|
||||
-Dspring.profiles.active="prod" \
|
||||
#-Dskywalking.agent.service_name=asinkj-auth \
|
||||
#-javaagent:/asinkj/skywalking/agent/skywalking-agent.jar \
|
||||
-XX:+HeapDumpOnOutOfMemoryError -XX:+UseZGC ${JAVA_OPTS} \
|
||||
|
27
asinkj-biz/asinkj-amz/Dockerfile
Normal file
27
asinkj-biz/asinkj-amz/Dockerfile
Normal file
@ -0,0 +1,27 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
#FROM bellsoft/liberica-openjdk-debian:17.0.11-cds
|
||||
#FROM bellsoft/liberica-openjdk-debian:21.0.3-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
FROM amazoncorretto:17.0.14
|
||||
|
||||
LABEL maintainer="Shuo Hu "
|
||||
|
||||
RUN mkdir -p /asinkj/amz/logs \
|
||||
/asinkj/amz/temp \
|
||||
/asinkj/skywalking/agent
|
||||
|
||||
WORKDIR /asinkj/amz
|
||||
|
||||
ENV SERVER_PORT=9404 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
||||
|
||||
EXPOSE ${SERVER_PORT}
|
||||
|
||||
ADD ./target/asinkj-amz.jar ./app.jar
|
||||
|
||||
ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -Dserver.port=${SERVER_PORT} \
|
||||
-Dspring.profiles.active="prod" \
|
||||
#-Dskywalking.agent.service_name=asinkj-auth \
|
||||
#-javaagent:/asinkj/skywalking/agent/skywalking-agent.jar \
|
||||
-XX:+HeapDumpOnOutOfMemoryError -XX:+UseZGC ${JAVA_OPTS} \
|
||||
-jar app.jar
|
||||
|
@ -2,21 +2,16 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.asinkj</groupId>
|
||||
<artifactId>asinkj-cloud-plus</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
<artifactId>asinkj-biz</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>asinkj-amz</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.asinkj</groupId>
|
||||
@ -113,8 +108,25 @@
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.9.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
@ -64,7 +64,7 @@ public class BizInquiryRequestController extends BaseController {
|
||||
*/
|
||||
@SaCheckPermission("amz:inquiryRequest:list")
|
||||
@GetMapping("/create/{destination}/{channelId}/{date}")
|
||||
public R<Void> createWithDesAndChannel(@PathVariable("destination") @NotNull(message = "目的地不能为空") String destination,
|
||||
public R<String> createWithDesAndChannel(@PathVariable("destination") @NotNull(message = "目的地不能为空") String destination,
|
||||
@PathVariable("channelId") @NotNull(message = "渠道不能为空") String channelId,
|
||||
@PathVariable("date") @NotNull(message = "日期不能为空") String date) {
|
||||
return bizInquiryRequestService.createWithDesAndChannel(destination, channelId,date);
|
||||
|
@ -46,7 +46,7 @@ public class BizLogisticsChannelController extends BaseController {
|
||||
return bizLogisticsChannelService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@SaCheckPermission("amz:logisticsChannel:list")
|
||||
// @SaCheckPermission("amz:logisticsChannel:list")
|
||||
@GetMapping("/list/all")
|
||||
public TableDataInfo<BizLogisticsChannelVo> listAll() {
|
||||
return bizLogisticsChannelService.queryListAll();
|
||||
|
@ -6,6 +6,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.asinkj.common.excel.core.ExcelResult;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.asinkj.common.idempotent.annotation.RepeatSubmit;
|
||||
@ -21,6 +23,7 @@ import org.asinkj.amz.domain.vo.BizLogisticsOrderDetailVo;
|
||||
import org.asinkj.amz.domain.bo.BizLogisticsOrderDetailBo;
|
||||
import org.asinkj.amz.service.IBizLogisticsOrderDetailService;
|
||||
import org.asinkj.common.mybatis.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 物流订单明细(按箱子维度存储)
|
||||
@ -57,6 +60,16 @@ public class BizLogisticsOrderDetailController extends BaseController {
|
||||
ExcelUtil.exportExcel(list, "物流订单明细(按箱子维度存储)", BizLogisticsOrderDetailVo.class, response);
|
||||
}
|
||||
|
||||
|
||||
@SaCheckPermission("amz:logisticsOrderDetail:export")
|
||||
@Log(title = "物流订单明细(按箱子维度存储)", businessType = BusinessType.EXPORT)
|
||||
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<Void> importData(@RequestPart("file") MultipartFile file) throws Exception {
|
||||
bizLogisticsOrderDetailService.importExcel(file.getInputStream());
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物流订单明细(按箱子维度存储)详细信息
|
||||
*
|
||||
|
@ -111,6 +111,16 @@ public class BizLogisticsQuoteController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@SaCheckPermission("amz:logisticsQuote:add")
|
||||
@Log(title = "生成报价建议", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/check-quote-price")
|
||||
public R<Boolean> checkQuotePrice(@Validated(AddGroup.class) @RequestBody BizLogisticsQuoteMostBo bo) {
|
||||
|
||||
return R.ok(bizLogisticsQuoteService.checkPriceQuoteByBo(bo));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/today-quote-status")
|
||||
@RepeatSubmit()
|
||||
public R<List<InquiryQuoteStatusDTO>> getTodayQuoteStatus() {
|
||||
|
@ -118,4 +118,17 @@ public class BizShipmentPlanController extends BaseController {
|
||||
return R.ok(bizShipmentPlanService.getQuote(destination,channel));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取货件计划详细信息
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SaCheckPermission("amz:shipmentPlan:query")
|
||||
@GetMapping("/take-today-amz-plan-data")
|
||||
public R<Void> takeTodayAmzPlanData() {
|
||||
bizShipmentPlanService.takeTodayAmzPlanData();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import org.asinkj.common.mybatis.core.page.TableDataInfo;
|
||||
* 前端访问路由地址为:/amz/shipmentTracking
|
||||
*
|
||||
* @author shuo hu
|
||||
* @date 2025-03-20
|
||||
* @date 2025-04-03
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
|
@ -6,6 +6,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.asinkj.amz.service.LingxinCallback;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.asinkj.common.idempotent.annotation.RepeatSubmit;
|
||||
@ -135,12 +136,29 @@ public class SysAmazonStoreController extends BaseController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@SaCheckPermission("amz:amazonStore:remove")
|
||||
@Log(title = "亚马逊STA", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/amz-sta/{startDate}/{endDate}")
|
||||
public R<Void> getAmzStaToken(@PathVariable String startDate, @PathVariable String endDate) {
|
||||
try {
|
||||
sysAmazonStoreService.pullAmzStaData(startDate, endDate, new LingxinCallback() {
|
||||
@Override
|
||||
public void onFinished(String result, int status) {
|
||||
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@SaCheckPermission("amz:amazonStore:remove")
|
||||
@Log(title = "亚马逊FBAtest", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/test")
|
||||
public R<Void> testAmzFbaToken() {
|
||||
try {
|
||||
sysAmazonStoreService.testAmazonData();
|
||||
sysAmazonStoreService.pullAmzBoxData2();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ import org.asinkj.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
@ -51,7 +53,7 @@ public class BizLogisticsQuote extends TenantEntity {
|
||||
/**
|
||||
* 基础价格
|
||||
*/
|
||||
private Long price;
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 时效(单位:天)
|
||||
|
@ -6,8 +6,9 @@ import org.asinkj.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
@ -40,6 +41,11 @@ public class BizShipmentPlan extends TenantEntity {
|
||||
*/
|
||||
private String shipmentId;
|
||||
|
||||
/**
|
||||
* 货件唯一编号
|
||||
*/
|
||||
private String shipmentUniqueId;
|
||||
|
||||
/**
|
||||
* 货件名称
|
||||
*/
|
||||
@ -83,7 +89,7 @@ public class BizShipmentPlan extends TenantEntity {
|
||||
/**
|
||||
* 同步时间
|
||||
*/
|
||||
private Date syncTime;
|
||||
private Date receivingTime;
|
||||
|
||||
/**
|
||||
* 计划发货日期
|
||||
@ -127,11 +133,32 @@ public class BizShipmentPlan extends TenantEntity {
|
||||
*/
|
||||
private String isSta;
|
||||
|
||||
/**
|
||||
* box_quantity
|
||||
* box_size
|
||||
* logistics_weight
|
||||
* set_total
|
||||
*/
|
||||
|
||||
|
||||
private Long boxQuantity;
|
||||
|
||||
private String boxSize;
|
||||
|
||||
private BigDecimal logisticsWeight;
|
||||
|
||||
private Long setTotal;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* sta 计划ID
|
||||
*/
|
||||
private String inboundPlanId;
|
||||
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import java.io.Serial;
|
||||
* 物流追踪对象 biz_shipment_tracking
|
||||
*
|
||||
* @author shuo hu
|
||||
* @date 2025-03-20
|
||||
* @date 2025-04-03
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ -47,5 +47,65 @@ public class BizShipmentTracking extends TenantEntity {
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 本地箱子编号
|
||||
*/
|
||||
private String localBoxId;
|
||||
|
||||
/**
|
||||
* 包裹唯一标识
|
||||
*/
|
||||
private String packageId;
|
||||
|
||||
/**
|
||||
* 总数量
|
||||
*/
|
||||
private Long total;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
private Long weight;
|
||||
|
||||
/**
|
||||
* 重量单位
|
||||
*/
|
||||
private String weightUnit;
|
||||
|
||||
/**
|
||||
* 长度
|
||||
*/
|
||||
private Long length;
|
||||
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
private Long width;
|
||||
|
||||
/**
|
||||
* 高度
|
||||
*/
|
||||
private Long height;
|
||||
|
||||
/**
|
||||
* 尺寸单位
|
||||
*/
|
||||
private String lengthUnit;
|
||||
|
||||
/**
|
||||
* 箱子展示名称
|
||||
*/
|
||||
private String boxName;
|
||||
|
||||
/**
|
||||
* 货件唯一编号
|
||||
*/
|
||||
private String shipmentUniqueId;
|
||||
|
||||
/**
|
||||
* STA任务编号
|
||||
*/
|
||||
private String inboundPlanId;
|
||||
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import org.asinkj.common.core.validate.EditGroup;
|
||||
import org.asinkj.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -55,7 +56,7 @@ public class BizLogisticsQuoteMostBo extends BaseEntity {
|
||||
* 基础价格
|
||||
*/
|
||||
@NotNull(message = "基础价格不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long price;
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 时效(单位:天)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.asinkj.amz.domain.bo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.asinkj.amz.domain.BizShipmentPlan;
|
||||
import org.asinkj.asinking.entity.FbaShipmentApiResponse;
|
||||
import org.asinkj.common.mybatis.core.domain.BaseEntity;
|
||||
@ -9,6 +10,8 @@ import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
@ -93,7 +96,7 @@ public class BizShipmentPlanBo extends BaseEntity {
|
||||
* 同步时间
|
||||
*/
|
||||
@NotNull(message = "同步时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date syncTime;
|
||||
private Date receivingTime;
|
||||
|
||||
/**
|
||||
* 计划发货日期
|
||||
@ -144,4 +147,16 @@ public class BizShipmentPlanBo extends BaseEntity {
|
||||
private String isSta;
|
||||
|
||||
|
||||
@ExcelProperty(value = "箱子数量")
|
||||
private Long boxQuantity;
|
||||
|
||||
@ExcelProperty(value = "箱子尺寸")
|
||||
private String boxSize;
|
||||
|
||||
@ExcelProperty(value = "总的物流商计重")
|
||||
private BigDecimal logisticsWeight;
|
||||
|
||||
@ExcelProperty(value = "套数(系统中的申报量)")
|
||||
private Long setTotal;
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import jakarta.validation.constraints.*;
|
||||
* 物流追踪业务对象 biz_shipment_tracking
|
||||
*
|
||||
* @author shuo hu
|
||||
* @date 2025-03-20
|
||||
* @date 2025-04-03
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ -44,5 +44,77 @@ public class BizShipmentTrackingBo extends BaseEntity {
|
||||
@NotBlank(message = "物流单号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String trackingNumber;
|
||||
|
||||
/**
|
||||
* 本地箱子编号
|
||||
*/
|
||||
@NotBlank(message = "本地箱子编号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String localBoxId;
|
||||
|
||||
/**
|
||||
* 包裹唯一标识
|
||||
*/
|
||||
@NotBlank(message = "包裹唯一标识不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String packageId;
|
||||
|
||||
/**
|
||||
* 总数量
|
||||
*/
|
||||
@NotNull(message = "总数量不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long total;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
@NotNull(message = "重量不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long weight;
|
||||
|
||||
/**
|
||||
* 重量单位
|
||||
*/
|
||||
@NotBlank(message = "重量单位不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String weightUnit;
|
||||
|
||||
/**
|
||||
* 长度
|
||||
*/
|
||||
@NotNull(message = "长度不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long length;
|
||||
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
@NotNull(message = "宽度不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long width;
|
||||
|
||||
/**
|
||||
* 高度
|
||||
*/
|
||||
@NotNull(message = "高度不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long height;
|
||||
|
||||
/**
|
||||
* 尺寸单位
|
||||
*/
|
||||
@NotBlank(message = "尺寸单位不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String lengthUnit;
|
||||
|
||||
/**
|
||||
* 箱子展示名称
|
||||
*/
|
||||
@NotBlank(message = "箱子展示名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String boxName;
|
||||
|
||||
/**
|
||||
* 货件唯一编号
|
||||
*/
|
||||
@NotBlank(message = "货件唯一编号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String shipmentUniqueId;
|
||||
|
||||
/**
|
||||
* STA任务编号
|
||||
*/
|
||||
@NotBlank(message = "STA任务编号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String inboundPlanId;
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
package org.asinkj.amz.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.alibaba.excel.annotation.write.style.ContentStyle;
|
||||
import com.alibaba.excel.annotation.write.style.HeadStyle;
|
||||
import com.alibaba.excel.enums.BooleanEnum;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.asinkj.amz.domain.BizLogisticsOrderDetail;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
@ -25,6 +29,7 @@ import java.util.Date;
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = BizLogisticsOrderDetail.class)
|
||||
@ContentStyle(locked = BooleanEnum.TRUE)
|
||||
public class BizLogisticsOrderDetailVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
@ -42,6 +47,7 @@ public class BizLogisticsOrderDetailVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "订单号")
|
||||
// @ExcelDictFormat(readConverterExp = "b=iz_logistics_order.id")
|
||||
@ContentStyle(locked = BooleanEnum.TRUE)
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
|
@ -71,7 +71,7 @@ public class BizLogisticsOrderVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "物流渠道", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "如=空运/海运/快递等")
|
||||
private String logisticsChannel;
|
||||
private String channelName;
|
||||
|
||||
/**
|
||||
* 目的地仓库名称或编码
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.asinkj.amz.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
@ -20,7 +21,6 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 货件计划视图对象 biz_shipment_plan
|
||||
*
|
||||
@ -105,7 +105,7 @@ public class BizShipmentPlanVo implements Serializable {
|
||||
* 同步时间
|
||||
*/
|
||||
@ExcelProperty(value = "同步时间")
|
||||
private Date syncTime;
|
||||
private Date receivingTime;
|
||||
|
||||
/**
|
||||
* 计划发货日期
|
||||
@ -158,9 +158,26 @@ public class BizShipmentPlanVo implements Serializable {
|
||||
private String isSta;
|
||||
|
||||
|
||||
@ExcelProperty(value = "箱子数量")
|
||||
private Long boxNum;
|
||||
|
||||
|
||||
@ExcelProperty(value = "箱子数量")
|
||||
private Long boxQuantity;
|
||||
|
||||
@ExcelProperty(value = "箱子尺寸")
|
||||
private String boxSize;
|
||||
|
||||
@ExcelProperty(value = "总的物流商计重")
|
||||
private BigDecimal logisticsWeight;
|
||||
|
||||
@ExcelProperty(value = "套数(系统中的申报量)")
|
||||
private Long setTotal;
|
||||
|
||||
|
||||
// 显式添加 Setter(即使使用 @Data)
|
||||
public void setShipFromAddress(FbaShipmentApiResponse.Address shipFromAddress) {
|
||||
System.out.printf(String.valueOf(shipToAddress));
|
||||
// System.out.printf(String.valueOf(shipToAddress));
|
||||
this.shipFromAddress = shipFromAddress;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ import java.util.Date;
|
||||
* 物流追踪视图对象 biz_shipment_tracking
|
||||
*
|
||||
* @author shuo hu
|
||||
* @date 2025-03-20
|
||||
* @date 2025-04-03
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@ -52,5 +52,77 @@ public class BizShipmentTrackingVo implements Serializable {
|
||||
@ExcelProperty(value = "物流单号")
|
||||
private String trackingNumber;
|
||||
|
||||
/**
|
||||
* 本地箱子编号
|
||||
*/
|
||||
@ExcelProperty(value = "本地箱子编号")
|
||||
private String localBoxId;
|
||||
|
||||
/**
|
||||
* 包裹唯一标识
|
||||
*/
|
||||
@ExcelProperty(value = "包裹唯一标识")
|
||||
private String packageId;
|
||||
|
||||
/**
|
||||
* 总数量
|
||||
*/
|
||||
@ExcelProperty(value = "总数量")
|
||||
private Long total;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
@ExcelProperty(value = "重量")
|
||||
private Long weight;
|
||||
|
||||
/**
|
||||
* 重量单位
|
||||
*/
|
||||
@ExcelProperty(value = "重量单位")
|
||||
private String weightUnit;
|
||||
|
||||
/**
|
||||
* 长度
|
||||
*/
|
||||
@ExcelProperty(value = "长度")
|
||||
private Long length;
|
||||
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
@ExcelProperty(value = "宽度")
|
||||
private Long width;
|
||||
|
||||
/**
|
||||
* 高度
|
||||
*/
|
||||
@ExcelProperty(value = "高度")
|
||||
private Long height;
|
||||
|
||||
/**
|
||||
* 尺寸单位
|
||||
*/
|
||||
@ExcelProperty(value = "尺寸单位")
|
||||
private String lengthUnit;
|
||||
|
||||
/**
|
||||
* 箱子展示名称
|
||||
*/
|
||||
@ExcelProperty(value = "箱子展示名称")
|
||||
private String boxName;
|
||||
|
||||
/**
|
||||
* 货件唯一编号
|
||||
*/
|
||||
@ExcelProperty(value = "货件唯一编号")
|
||||
private String shipmentUniqueId;
|
||||
|
||||
/**
|
||||
* STA任务编号
|
||||
*/
|
||||
@ExcelProperty(value = "STA任务编号")
|
||||
private String inboundPlanId;
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.asinkj.amz.api.RemoteFBADataService;
|
||||
import org.asinkj.amz.service.ISysAmazonStoreService;
|
||||
import org.asinkj.amz.service.LingxinCallback;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -18,6 +19,8 @@ public class RemoteFBADataServiceImpl implements RemoteFBADataService {
|
||||
|
||||
@Override
|
||||
public void pullAmzFbaDataToken(String startDate, String endDate) throws Exception {
|
||||
sysAmazonStoreService.pullAmzFBAData(startDate,endDate);
|
||||
sysAmazonStoreService.pullAmzStaData(startDate, endDate, (result, status) -> {
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ public class AddressTypeHandler extends BaseTypeHandler<FbaShipmentApiResponse.A
|
||||
|
||||
@Override
|
||||
public Address getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
log.info("getNullableResult: {}", columnName);
|
||||
return parseJsonb(rs.getString(columnName));
|
||||
}
|
||||
|
||||
@ -45,7 +44,6 @@ public class AddressTypeHandler extends BaseTypeHandler<FbaShipmentApiResponse.A
|
||||
}
|
||||
|
||||
private Address parseJsonb(String json) {
|
||||
log.info("parseJsonb: {}", json);
|
||||
return com.alibaba.fastjson2.JSON.parseObject(json, Address.class);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ import org.asinkj.amz.domain.BizLogisticsOrderDetail;
|
||||
import org.asinkj.amz.domain.vo.BizLogisticsOrderDetailVo;
|
||||
import org.asinkj.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物流订单明细(按箱子维度存储)Mapper接口
|
||||
*
|
||||
@ -12,4 +14,5 @@ import org.asinkj.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
*/
|
||||
public interface BizLogisticsOrderDetailMapper extends BaseMapperPlus<BizLogisticsOrderDetail, BizLogisticsOrderDetailVo> {
|
||||
|
||||
void updateByBoxId(List<BizLogisticsOrderDetailVo> bizLogisticsOrderDetailVos);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import org.asinkj.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
* 物流追踪Mapper接口
|
||||
*
|
||||
* @author shuo hu
|
||||
* @date 2025-03-20
|
||||
* @date 2025-04-03
|
||||
*/
|
||||
public interface BizShipmentTrackingMapper extends BaseMapperPlus<BizShipmentTracking, BizShipmentTrackingVo> {
|
||||
|
||||
|
@ -69,7 +69,7 @@ public interface IBizInquiryRequestService {
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
R<Void> createWithDesAndChannel(@NotNull(message = "目的地不能为空") String destination, @NotNull(message = "渠道不能为空") String channelId, @NotNull(message = "日期不能为空") String date);
|
||||
R<String> createWithDesAndChannel(@NotNull(message = "目的地不能为空") String destination, @NotNull(message = "渠道不能为空") String channelId, @NotNull(message = "日期不能为空") String date);
|
||||
|
||||
TableDataInfo<BizInquiryRequestVo> queryWithDesAndChannel(@NotNull(message = "目的地不能为空") String destination, @NotNull(message = "渠道不能为空") String channelId, @NotNull(message = "日期不能为空") String date);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import org.asinkj.amz.domain.bo.BizLogisticsOrderDetailBo;
|
||||
import org.asinkj.common.mybatis.core.page.TableDataInfo;
|
||||
import org.asinkj.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@ -68,4 +69,6 @@ public interface IBizLogisticsOrderDetailService {
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
void updateList(List<BizLogisticsOrderDetailBo> list);
|
||||
|
||||
void importExcel(InputStream inputStream);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import org.asinkj.amz.domain.vo.InquiryQuoteStatusDTO;
|
||||
import org.asinkj.common.mybatis.core.page.TableDataInfo;
|
||||
import org.asinkj.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -79,5 +80,7 @@ public interface IBizLogisticsQuoteService {
|
||||
|
||||
void insertMostQuoteByBo(BizLogisticsQuoteMostBo bo);
|
||||
|
||||
Boolean checkPriceQuoteByBo(BizLogisticsQuoteMostBo bo);
|
||||
|
||||
List<InquiryQuoteStatusDTO> getTodayQuoteStatus();
|
||||
}
|
||||
|
@ -72,4 +72,6 @@ public interface IBizShipmentPlanService {
|
||||
List<BizLogisticsQuoteVo> getQuote(@NotNull(message = "主键不能为空") String destination, String channel);
|
||||
|
||||
BizShipmentPlanVo queryByfbaShipmentId(String fbaShipmentId);
|
||||
|
||||
void takeTodayAmzPlanData();
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import java.util.List;
|
||||
* 物流追踪Service接口
|
||||
*
|
||||
* @author shuo hu
|
||||
* @date 2025-03-20
|
||||
* @date 2025-04-03
|
||||
*/
|
||||
public interface IBizShipmentTrackingService {
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.asinkj.amz.service;
|
||||
|
||||
import okhttp3.Callback;
|
||||
import org.asinkj.amz.domain.SysAmazonStore;
|
||||
import org.asinkj.amz.domain.vo.SysAmazonStoreVo;
|
||||
import org.asinkj.amz.domain.bo.SysAmazonStoreBo;
|
||||
@ -74,9 +75,17 @@ public interface ISysAmazonStoreService {
|
||||
|
||||
void pullAmzFBAData(String startDate,String endDate) throws Exception;
|
||||
|
||||
void pullAmzStaData(String startDate, String endDate, LingxinCallback lingxinCallback);
|
||||
|
||||
void pullAmzBoxData() throws Exception;
|
||||
|
||||
void pullAmzBoxData2() throws Exception;
|
||||
|
||||
void getAmzStoreTokenData() throws Exception;
|
||||
|
||||
void testAmazonData() throws Exception;
|
||||
|
||||
void testAmazonData2() throws Exception;
|
||||
|
||||
// void pullAmzStaData(String startDate, String endDate);
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
package org.asinkj.amz.service;
|
||||
|
||||
public interface LingxinCallback {
|
||||
void onFinished(String result, int status); // 自定义方法名
|
||||
}
|
@ -18,7 +18,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.asinkj.common.satoken.utils.LoginHelper;
|
||||
import org.asinkj.resource.api.RemoteMessageService;
|
||||
import org.asinkj.utils.SerialNoGenerator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.asinkj.amz.domain.bo.BizInquiryRequestBo;
|
||||
import org.asinkj.amz.domain.vo.BizInquiryRequestVo;
|
||||
@ -59,6 +61,8 @@ public class BizInquiryRequestServiceImpl implements IBizInquiryRequestService {
|
||||
|
||||
@Resource
|
||||
private BizLogisticsQuoteMapper logisticsQuoteMapper;
|
||||
@Resource
|
||||
private RemoteMessageService remoteMessageService;
|
||||
|
||||
/**
|
||||
* 查询物流询价
|
||||
@ -167,7 +171,7 @@ public class BizInquiryRequestServiceImpl implements IBizInquiryRequestService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Void> createWithDesAndChannel(String destination, String channelId,String date) {
|
||||
public R<String> createWithDesAndChannel(String destination, String channelId,String date) {
|
||||
|
||||
|
||||
|
||||
@ -216,7 +220,9 @@ public class BizInquiryRequestServiceImpl implements IBizInquiryRequestService {
|
||||
|
||||
billingRequestMapper.insert(bizInquiryRequest);
|
||||
|
||||
return R.ok();
|
||||
remoteMessageService.publishMessage(LoginHelper.getUserId(), "您好,您的询价单创建成功。具体询价单号为:"+bizInquiryRequest.getInquiryNo());
|
||||
|
||||
return R.ok(bizInquiryRequest.getInquiryNo());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,8 +149,10 @@ public class BizLogisticsChannelServiceImpl implements IBizLogisticsChannelServi
|
||||
public TableDataInfo<BizLogisticsChannelVo> queryListAll() {
|
||||
|
||||
LambdaQueryWrapper<BizLogisticsChannel> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(BizLogisticsChannel::getChannelType, "system");
|
||||
return TableDataInfo.build(baseMapper.selectVoList(lqw));
|
||||
// lqw.eq(BizLogisticsChannel::getChannelType, "system");
|
||||
TableDataInfo<BizLogisticsChannelVo> build = TableDataInfo.build(baseMapper.selectVoList(lqw));
|
||||
|
||||
return build;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,12 @@
|
||||
package org.asinkj.amz.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.asinkj.amz.domain.BizLogisticsOrder;
|
||||
import org.asinkj.common.core.exception.ServiceException;
|
||||
import org.asinkj.common.core.utils.MapstructUtils;
|
||||
import org.asinkj.common.core.utils.StringUtils;
|
||||
import org.asinkj.common.excel.utils.ExcelUtil;
|
||||
import org.asinkj.common.mybatis.core.page.TableDataInfo;
|
||||
import org.asinkj.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -17,9 +21,11 @@ import org.asinkj.amz.domain.BizLogisticsOrderDetail;
|
||||
import org.asinkj.amz.mapper.BizLogisticsOrderDetailMapper;
|
||||
import org.asinkj.amz.service.IBizLogisticsOrderDetailService;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 物流订单明细(按箱子维度存储)Service业务层处理
|
||||
@ -27,6 +33,7 @@ import java.util.Collection;
|
||||
* @author shuo hu
|
||||
* @date 2025-03-24
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class BizLogisticsOrderDetailServiceImpl implements IBizLogisticsOrderDetailService {
|
||||
@ -156,4 +163,25 @@ public class BizLogisticsOrderDetailServiceImpl implements IBizLogisticsOrderDet
|
||||
public void updateList(List<BizLogisticsOrderDetailBo> list) {
|
||||
baseMapper.updateBatchById(MapstructUtils.convert(list, BizLogisticsOrderDetail.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importExcel(InputStream inputStream) {
|
||||
List<BizLogisticsOrderDetailVo> bizLogisticsOrderDetailVos = ExcelUtil.importExcel(inputStream, BizLogisticsOrderDetailVo.class);
|
||||
checkData(bizLogisticsOrderDetailVos);
|
||||
log.info("导入数据条数:{}", JSONObject.toJSONString(bizLogisticsOrderDetailVos));
|
||||
|
||||
baseMapper.updateByBoxId(bizLogisticsOrderDetailVos);
|
||||
|
||||
}
|
||||
|
||||
private void checkData(List<BizLogisticsOrderDetailVo> bizLogisticsOrderDetailVos) {
|
||||
boolean isAllSame = bizLogisticsOrderDetailVos.stream()
|
||||
.map(BizLogisticsOrderDetailVo::getFbaShipmentId)
|
||||
.collect(Collectors.toSet())
|
||||
.size() == 1;
|
||||
if (!isAllSame) {
|
||||
throw new ServiceException("FBA货件编号不一致,请检查后重新导入");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ import org.asinkj.amz.domain.vo.BizLogisticsOrderVo;
|
||||
import org.asinkj.amz.mapper.BizLogisticsOrderMapper;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -41,6 +43,8 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class BizLogisticsOrderServiceImpl implements IBizLogisticsOrderService {
|
||||
|
||||
private static final BigDecimal LB_TO_KG_RATIO = new BigDecimal("0.45359237");
|
||||
|
||||
private final BizLogisticsOrderMapper baseMapper;
|
||||
|
||||
@Resource
|
||||
@ -246,7 +250,19 @@ public class BizLogisticsOrderServiceImpl implements IBizLogisticsOrderService {
|
||||
detail.setChannelName(quoteVo.getChannelName());
|
||||
detail.setDestination(quoteVo.getDestination());
|
||||
detail.setPricePerKg(quoteVo.getPrice());
|
||||
detail.setLogisticsStatus("pending");
|
||||
detail.setPlannedQuantity(bizShipmentTracking.getTotal());
|
||||
|
||||
BigDecimal lb = new BigDecimal(bizShipmentTracking.getWeight());
|
||||
|
||||
// 计算kg值(乘法运算)
|
||||
BigDecimal kgValue = lb.multiply(LB_TO_KG_RATIO);
|
||||
|
||||
// 保留两位小数并四舍五入
|
||||
kgValue = kgValue.setScale(2, RoundingMode.HALF_UP);
|
||||
|
||||
|
||||
detail.setSupplierWeight(kgValue.longValue());
|
||||
detail.setLogisticsStatus("IN_WAREHOUSE");
|
||||
// detail.setPlannedQuantity(bizShipmentTracking.getQuantity());
|
||||
// detail.setShipmentQuantity(sum);
|
||||
// detail.setTrackingNumber(bizShipmentTracking.getTrackingNumber());
|
||||
|
@ -31,6 +31,8 @@ import org.asinkj.amz.mapper.BizLogisticsQuoteMapper;
|
||||
import org.asinkj.amz.service.IBizLogisticsQuoteService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@ -61,7 +63,7 @@ public class BizLogisticsQuoteServiceImpl implements IBizLogisticsQuoteService {
|
||||
private BizLogisticsChannelMapper bizLogisticsChannelMapper;
|
||||
|
||||
@Resource
|
||||
private RemoteUserService remoteUserService ;
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
/**
|
||||
* 查询物流报价
|
||||
@ -75,10 +77,6 @@ public class BizLogisticsQuoteServiceImpl implements IBizLogisticsQuoteService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> generateReport() {
|
||||
// 1. 获取所有渠道名称
|
||||
@ -191,7 +189,7 @@ public class BizLogisticsQuoteServiceImpl implements IBizLogisticsQuoteService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<BizLogisticsQuoteVo> listWithDesAndChannel(String destination, String channel,String date) {
|
||||
public TableDataInfo<BizLogisticsQuoteVo> listWithDesAndChannel(String destination, String channel, String date) {
|
||||
|
||||
|
||||
if (StringUtils.isNotBlank(destination) && StringUtils.isNotBlank(channel)) {
|
||||
@ -211,6 +209,8 @@ public class BizLogisticsQuoteServiceImpl implements IBizLogisticsQuoteService {
|
||||
|
||||
@Override
|
||||
public void insertMostQuoteByBo(BizLogisticsQuoteMostBo bo) {
|
||||
|
||||
|
||||
//检查是否重复报价
|
||||
LambdaQueryWrapper<BizLogisticsQuote> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BizLogisticsQuote::getInquiryId, bo.getId());
|
||||
@ -219,6 +219,7 @@ public class BizLogisticsQuoteServiceImpl implements IBizLogisticsQuoteService {
|
||||
throw new ServiceException("该询价单已报价,请勿重复报价");
|
||||
}
|
||||
|
||||
|
||||
Date quoteStartDate = bo.getQuoteStartDate();
|
||||
Date quoteEndDate = bo.getQuoteEndDate();
|
||||
//计算中间的每一天的日期
|
||||
@ -248,6 +249,29 @@ public class BizLogisticsQuoteServiceImpl implements IBizLogisticsQuoteService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean checkPriceQuoteByBo(BizLogisticsQuoteMostBo bo) {
|
||||
LambdaQueryWrapper<BizLogisticsQuote> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BizLogisticsQuote::getDestination, bo.getDestination())
|
||||
.eq(BizLogisticsQuote::getChannelName, bo.getChannelName())
|
||||
.eq(BizLogisticsQuote::getQuoteDate, bo.getQuoteEndDate())
|
||||
;
|
||||
List<BizLogisticsQuote> bizLogisticsQuotes = baseMapper.selectList(queryWrapper);
|
||||
if (bizLogisticsQuotes.size() == 0){
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
BigDecimal average = bizLogisticsQuotes.stream()
|
||||
.map(BizLogisticsQuote::getPrice)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add)
|
||||
.divide(new BigDecimal(bizLogisticsQuotes.size()), 2, RoundingMode.HALF_UP);
|
||||
|
||||
if (average.compareTo(bo.getPrice()) > 0){
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<InquiryQuoteStatusDTO> getTodayQuoteStatus() {
|
||||
|
@ -1,9 +1,18 @@
|
||||
package org.asinkj.amz.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.asinkj.amz.domain.BizLogisticsQuote;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.asinkj.amz.domain.BizShipmentTracking;
|
||||
import org.asinkj.amz.domain.bo.SysAmazonStoreBo;
|
||||
import org.asinkj.amz.domain.vo.BizLogisticsQuoteVo;
|
||||
import org.asinkj.amz.domain.vo.SysAmazonStoreVo;
|
||||
import org.asinkj.amz.mapper.BizShipmentTrackingMapper;
|
||||
import org.asinkj.amz.service.IBizLogisticsQuoteService;
|
||||
import org.asinkj.amz.service.ISysAmazonStoreService;
|
||||
import org.asinkj.amz.service.LingxinCallback;
|
||||
import org.asinkj.common.core.utils.MapstructUtils;
|
||||
import org.asinkj.common.core.utils.StringUtils;
|
||||
import org.asinkj.common.mybatis.core.page.TableDataInfo;
|
||||
@ -12,6 +21,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.asinkj.common.satoken.utils.LoginHelper;
|
||||
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;
|
||||
@ -23,6 +34,8 @@ import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 货件计划Service业务层处理
|
||||
@ -32,12 +45,23 @@ import java.util.Collection;
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
|
||||
|
||||
private final BizShipmentPlanMapper baseMapper;
|
||||
|
||||
@Resource
|
||||
private IBizLogisticsQuoteService iLogisticsQuoteService;;
|
||||
private IBizLogisticsQuoteService iLogisticsQuoteService;
|
||||
;
|
||||
|
||||
@Resource
|
||||
private ISysAmazonStoreService iSysAmazonStoreService;
|
||||
|
||||
@Resource
|
||||
private BizShipmentTrackingMapper bizShipmentTrackingMapper;
|
||||
|
||||
@Resource
|
||||
private RemoteMessageService remoteMessageService;
|
||||
|
||||
/**
|
||||
* 查询货件计划
|
||||
@ -46,7 +70,7 @@ public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
|
||||
* @return 货件计划
|
||||
*/
|
||||
@Override
|
||||
public BizShipmentPlanVo queryById(Long id){
|
||||
public BizShipmentPlanVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@ -61,6 +85,22 @@ public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
|
||||
public TableDataInfo<BizShipmentPlanVo> queryPageList(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());
|
||||
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);
|
||||
}
|
||||
}
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@ -73,7 +113,21 @@ public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
|
||||
@Override
|
||||
public List<BizShipmentPlanVo> queryList(BizShipmentPlanBo bo) {
|
||||
LambdaQueryWrapper<BizShipmentPlan> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
List<BizShipmentPlanVo> bizShipmentPlanVos = baseMapper.selectVoList(lqw);
|
||||
Set<String> shipmentIds = bizShipmentPlanVos.stream().map(BizShipmentPlanVo::getShipmentId).collect(Collectors.toSet());
|
||||
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 : bizShipmentPlanVos) {
|
||||
Long count = collect.get(bizShipmentPlanVo.getShipmentId());
|
||||
bizShipmentPlanVo.setBoxNum(count);
|
||||
}
|
||||
return bizShipmentPlanVos;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<BizShipmentPlan> buildQueryWrapper(BizShipmentPlanBo bo) {
|
||||
@ -89,7 +143,7 @@ public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getShippingSolution()), BizShipmentPlan::getShippingSolution, bo.getShippingSolution());
|
||||
lqw.eq(bo.getGmtModified() != null, BizShipmentPlan::getGmtModified, bo.getGmtModified());
|
||||
lqw.eq(bo.getGmtCreate() != null, BizShipmentPlan::getGmtCreate, bo.getGmtCreate());
|
||||
lqw.eq(bo.getSyncTime() != null, BizShipmentPlan::getSyncTime, bo.getSyncTime());
|
||||
lqw.eq(bo.getReceivingTime() != null, BizShipmentPlan::getReceivingTime, bo.getReceivingTime());
|
||||
lqw.eq(bo.getStaShipmentDate() != null, BizShipmentPlan::getStaShipmentDate, bo.getStaShipmentDate());
|
||||
lqw.eq(bo.getStaDeliveryStartDate() != null, BizShipmentPlan::getStaDeliveryStartDate, bo.getStaDeliveryStartDate());
|
||||
lqw.eq(bo.getStaDeliveryEndDate() != null, BizShipmentPlan::getStaDeliveryEndDate, bo.getStaDeliveryEndDate());
|
||||
@ -98,6 +152,14 @@ public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getReferenceId()), BizShipmentPlan::getReferenceId, bo.getReferenceId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStaInboundPlanId()), BizShipmentPlan::getStaInboundPlanId, bo.getStaInboundPlanId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getIsSta()), BizShipmentPlan::getIsSta, bo.getIsSta());
|
||||
|
||||
SysAmazonStoreBo sysAmazonStoreBo = new SysAmazonStoreBo();
|
||||
sysAmazonStoreBo.setUserId(LoginHelper.getUserId());
|
||||
List<SysAmazonStoreVo> sysAmazonStoreVos = iSysAmazonStoreService.queryList(sysAmazonStoreBo);
|
||||
Set<Long> collect = sysAmazonStoreVos.stream().map(SysAmazonStoreVo::getSid).collect(Collectors.toSet());
|
||||
if (CollectionUtil.isNotEmpty(collect)) {
|
||||
lqw.in(BizShipmentPlan::getSid, collect);
|
||||
}
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@ -134,7 +196,7 @@ public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(BizShipmentPlan entity){
|
||||
private void validEntityBeforeSave(BizShipmentPlan entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@ -147,7 +209,7 @@ public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
@ -163,9 +225,31 @@ public class BizShipmentPlanServiceImpl implements IBizShipmentPlanService {
|
||||
LambdaQueryWrapper<BizShipmentPlan> bizShipmentPlanLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
bizShipmentPlanLambdaQueryWrapper.eq(BizShipmentPlan::getShipmentId, fbaShipmentId);
|
||||
BizShipmentPlanVo bizShipmentPlanVo = baseMapper.selectVoOne(bizShipmentPlanLambdaQueryWrapper);
|
||||
if (ObjectUtil.isNotNull(bizShipmentPlanVo)){
|
||||
return bizShipmentPlanVo;
|
||||
if (ObjectUtil.isNotNull(bizShipmentPlanVo)) {
|
||||
return bizShipmentPlanVo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void takeTodayAmzPlanData() {
|
||||
|
||||
DateTime today = DateUtil.date();
|
||||
String todayString = today.toString("yyyy-MM-dd");
|
||||
log.info("yesterdayString. yesterdayString:{}", todayString);
|
||||
//获取今天的日期
|
||||
DateTime tomorrow = DateUtil.tomorrow();
|
||||
String tomorrowString = tomorrow.toString("yyyy-MM-dd");
|
||||
log.info("todayString. todayString:{}", tomorrowString);
|
||||
// remoteFBADataService.pullAmzFbaDataToken(todayString, tomorrowString);
|
||||
Long userId = LoginHelper.getUserId();
|
||||
iSysAmazonStoreService.pullAmzStaData(todayString, tomorrowString, new LingxinCallback() {
|
||||
@Override
|
||||
public void onFinished(String result, int status) {
|
||||
remoteMessageService.publishMessage(userId, result);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ import java.util.Collection;
|
||||
* 物流追踪Service业务层处理
|
||||
*
|
||||
* @author shuo hu
|
||||
* @date 2025-03-20
|
||||
* @date 2025-04-03
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
@ -74,6 +74,18 @@ public class BizShipmentTrackingServiceImpl implements IBizShipmentTrackingServi
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getShipmentId()), BizShipmentTracking::getShipmentId, bo.getShipmentId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getBoxId()), BizShipmentTracking::getBoxId, bo.getBoxId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getTrackingNumber()), BizShipmentTracking::getTrackingNumber, bo.getTrackingNumber());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getLocalBoxId()), BizShipmentTracking::getLocalBoxId, bo.getLocalBoxId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getPackageId()), BizShipmentTracking::getPackageId, bo.getPackageId());
|
||||
lqw.eq(bo.getTotal() != null, BizShipmentTracking::getTotal, bo.getTotal());
|
||||
lqw.eq(bo.getWeight() != null, BizShipmentTracking::getWeight, bo.getWeight());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getWeightUnit()), BizShipmentTracking::getWeightUnit, bo.getWeightUnit());
|
||||
lqw.eq(bo.getLength() != null, BizShipmentTracking::getLength, bo.getLength());
|
||||
lqw.eq(bo.getWidth() != null, BizShipmentTracking::getWidth, bo.getWidth());
|
||||
lqw.eq(bo.getHeight() != null, BizShipmentTracking::getHeight, bo.getHeight());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getLengthUnit()), BizShipmentTracking::getLengthUnit, bo.getLengthUnit());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getBoxName()), BizShipmentTracking::getBoxName, bo.getBoxName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getShipmentUniqueId()), BizShipmentTracking::getShipmentUniqueId, bo.getShipmentUniqueId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getInboundPlanId()), BizShipmentTracking::getInboundPlanId, bo.getInboundPlanId());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@ -132,10 +144,9 @@ public class BizShipmentTrackingServiceImpl implements IBizShipmentTrackingServi
|
||||
@Override
|
||||
public List<BizShipmentTracking> queryByPlanId(String shipmentId) {
|
||||
if (StringUtils.isNotBlank(shipmentId)) {
|
||||
return baseMapper.selectList(Wrappers.<BizShipmentTracking>lambdaQuery().eq(BizShipmentTracking::getShipmentId, shipmentId));
|
||||
return baseMapper.selectList(Wrappers.lambdaQuery(BizShipmentTracking.class)
|
||||
.eq(BizShipmentTracking::getShipmentId, shipmentId));
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,15 @@
|
||||
package org.asinkj.amz.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.Call;
|
||||
@ -17,10 +22,8 @@ import org.asinkj.amz.domain.BizShipmentTracking;
|
||||
import org.asinkj.amz.mapper.BizShipmentItemMapper;
|
||||
import org.asinkj.amz.mapper.BizShipmentPlanMapper;
|
||||
import org.asinkj.amz.mapper.BizShipmentTrackingMapper;
|
||||
import org.asinkj.asinking.entity.FbaShipmentApiResponse;
|
||||
import org.asinkj.asinking.entity.Result;
|
||||
import org.asinkj.asinking.entity.SellerAccountResponse;
|
||||
import org.asinkj.asinking.entity.TokenInfo;
|
||||
import org.asinkj.amz.service.LingxinCallback;
|
||||
import org.asinkj.asinking.entity.*;
|
||||
import org.asinkj.asinking.okhttp.AKRestClientBuild;
|
||||
import org.asinkj.common.core.utils.MapstructUtils;
|
||||
import org.asinkj.common.core.utils.StringUtils;
|
||||
@ -51,6 +54,8 @@ import java.time.Duration;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static jodd.util.ThreadUtil.sleep;
|
||||
|
||||
/**
|
||||
* 亚马逊店铺信息Service业务层处理
|
||||
*
|
||||
@ -79,6 +84,7 @@ public class SysAmazonStoreServiceImpl implements ISysAmazonStoreService {
|
||||
@Resource
|
||||
private BizShipmentTrackingMapper bizShipmentTrackingMapper;
|
||||
|
||||
|
||||
@Value("${lingxing.appId}")
|
||||
private String appId;
|
||||
|
||||
@ -161,6 +167,45 @@ public class SysAmazonStoreServiceImpl implements ISysAmazonStoreService {
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getAmzStoreTokenData() throws Exception {
|
||||
|
||||
// 如果用postman等其他工具调试时,需要将appSecret用urlencode.encode()进行转义
|
||||
if (ObjectUtil.isNull(RedisUtils.getCacheObject(REFRESH_TOKEN))) {
|
||||
Result result = AKRestClientBuild.builder().endpoint(url).getAccessToken(appId, appSecret);
|
||||
Object data = result.getData();
|
||||
if (data instanceof LinkedHashMap) {
|
||||
// 将LinkedHashMap转为TokenInfo
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
TokenInfo tokenInfo = mapper.convertValue(data, TokenInfo.class); // 关键点
|
||||
log.info("token:{}", tokenInfo.getRefreshToken());
|
||||
RedisUtils.setCacheObject(REFRESH_TOKEN, tokenInfo.getRefreshToken(), Duration.ofHours(2));
|
||||
RedisUtils.setCacheObject(ACCESS_TOKEN, tokenInfo.getAccessToken(), Duration.ofSeconds(tokenInfo.getExpiresIn()));
|
||||
} else {
|
||||
throw new IllegalStateException("data字段类型不匹配");
|
||||
}
|
||||
} else {
|
||||
Object result = AKRestClientBuild.builder().endpoint(url).refreshToken(appId, RedisUtils.getCacheObject(REFRESH_TOKEN));
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Result result1 = mapper.convertValue(result, Result.class); // 关键点
|
||||
if (result1.getData() != null && result1.getData() instanceof LinkedHashMap) {
|
||||
TokenInfo tokenInfo = mapper.convertValue(result1.getData(), TokenInfo.class); // 关键点
|
||||
log.info("tokenInfo:{}", tokenInfo.getRefreshToken());
|
||||
RedisUtils.setCacheObject(REFRESH_TOKEN, tokenInfo.getRefreshToken(), Duration.ofHours(2));
|
||||
RedisUtils.setCacheObject(ACCESS_TOKEN, tokenInfo.getAccessToken(), Duration.ofSeconds(tokenInfo.getExpiresIn()));
|
||||
|
||||
} else {
|
||||
log.info("删除Redis存储的token");
|
||||
RedisUtils.deleteObject(REFRESH_TOKEN);
|
||||
RedisUtils.deleteObject(ACCESS_TOKEN);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改亚马逊店铺信息
|
||||
*
|
||||
@ -276,7 +321,10 @@ public class SysAmazonStoreServiceImpl implements ISysAmazonStoreService {
|
||||
public void pullAmzFBAData(String startDate, String endDate) throws Exception {
|
||||
|
||||
Map<String, String> queryParam = new HashMap<>();
|
||||
queryParam.put("sid", String.valueOf(143));
|
||||
List<SysAmazonStore> sysAmazonStores = baseMapper.selectList();
|
||||
String sids = sysAmazonStores.stream().map(item -> String.valueOf(item.getSid())).collect(Collectors.joining(","));
|
||||
log.info("sids:{}", sids);
|
||||
queryParam.put("sid", "153");
|
||||
queryParam.put("start_date", startDate);
|
||||
queryParam.put("end_date", endDate);
|
||||
queryParam.put("shipment_status", "READY_TO_SHIP");
|
||||
@ -326,6 +374,8 @@ public class SysAmazonStoreServiceImpl implements ISysAmazonStoreService {
|
||||
for (FbaShipmentApiResponse.ShipmentPlan listDatum : listData) {
|
||||
listDatum.setId(null);
|
||||
BizShipmentPlan bizShipmentPlan = BeanUtil.copyProperties(listDatum, BizShipmentPlan.class);
|
||||
bizShipmentPlan.setCreateBy(1L);
|
||||
bizShipmentPlan.setDestination(listDatum.getDestination());
|
||||
BizShipmentPlanList.add(bizShipmentPlan);
|
||||
listDatum.getItemList().forEach(item -> {
|
||||
item.setId(null);
|
||||
@ -335,6 +385,7 @@ public class SysAmazonStoreServiceImpl implements ISysAmazonStoreService {
|
||||
List<BizShipmentItem> bizShipmentItems = BeanUtil.copyToList(listDatum.getItemList(), BizShipmentItem.class);
|
||||
for (BizShipmentItem bizShipmentItem : bizShipmentItems) {
|
||||
bizShipmentItem.setId(null);
|
||||
bizShipmentItem.setCreateBy(1L);
|
||||
bizShipmentItem.setShipmentId(bizShipmentPlan.getShipmentId());
|
||||
}
|
||||
|
||||
@ -342,6 +393,7 @@ public class SysAmazonStoreServiceImpl implements ISysAmazonStoreService {
|
||||
List<BizShipmentTracking> bizShipmentTrackings = BeanUtil.copyToList(listDatum.getTrackingNumberList(), BizShipmentTracking.class);
|
||||
for (BizShipmentTracking bizShipmentTracking : bizShipmentTrackings) {
|
||||
bizShipmentTracking.setId(null);
|
||||
bizShipmentTracking.setCreateBy(1L);
|
||||
bizShipmentTracking.setShipmentId(bizShipmentPlan.getShipmentId());
|
||||
}
|
||||
bizShipmentTrackingsList.addAll(bizShipmentTrackings);
|
||||
@ -355,75 +407,296 @@ public class SysAmazonStoreServiceImpl implements ISysAmazonStoreService {
|
||||
}
|
||||
}
|
||||
});
|
||||
// if (ObjectUtil.isNull(RedisUtils.getCacheObject(ACCESS_TOKEN))){
|
||||
// getAmzStoreTokenData();
|
||||
// }
|
||||
//
|
||||
// Map<String, Object> queryParam = new HashMap<>();
|
||||
// queryParam.put("timestamp", System.currentTimeMillis() / 1000 + "");
|
||||
// queryParam.put("access_token", RedisUtils.getCacheObject(ACCESS_TOKEN));
|
||||
// queryParam.put("app_key", appId);
|
||||
// queryParam.put("sid",536);
|
||||
// queryParam.put("start_date","2025-01-17");
|
||||
// queryParam.put("end_date","2025-03-18");
|
||||
//// queryParam.put("offset", 0);
|
||||
//// queryParam.put("length", 20);
|
||||
//
|
||||
// String sign = ApiSign.sign(queryParam, appId);
|
||||
// queryParam.put("sign", sign);
|
||||
//
|
||||
// log.info("sign:{}", sign);
|
||||
//
|
||||
// HttpRequest<Object> build = HttpRequest.builder(Object.class)
|
||||
// .method(HttpMethod.POST)
|
||||
// .endpoint(url)
|
||||
// .path("erp/sc/data/fba_report/shipmentList")
|
||||
// .queryParams(queryParam)
|
||||
// .build();
|
||||
// HttpResponse execute = HttpExecutor.create().execute(build);
|
||||
// Object o = execute.readEntity(Object.class);
|
||||
// log.info("execute:{}", o);
|
||||
// Shipment shipment = execute.readEntity(Shipment.class);
|
||||
// log.info("HttpResponse:{}", JSON.toJSON(shipment));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过STA查询STA任务
|
||||
*
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
*/
|
||||
@Override
|
||||
public void pullAmzStaData(String startDate, String endDate, LingxinCallback lingxinCallback) {
|
||||
Map<String, Object> queryParam = new HashMap<>();
|
||||
queryParam.put("page", 1);
|
||||
queryParam.put("length", 200);
|
||||
queryParam.put("dateBegin", startDate);
|
||||
queryParam.put("dateEnd", endDate);
|
||||
queryParam.put("dateType", 1);
|
||||
|
||||
HttpUtil.postWithParams("/amzStaServer/openapi/inbound-plan/page", queryParam, new Callback() {
|
||||
@Override
|
||||
public void onFailure(@NotNull Call call, @NotNull IOException e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
|
||||
|
||||
try {
|
||||
String string = response.body().string();
|
||||
log.info("string:+{}", string);
|
||||
AmzStaApiResponse amzStaApiResponse = JSON.parseObject(string, new TypeReference<AmzStaApiResponse>() {
|
||||
});
|
||||
log.info("amzStaApiResponse:{}", amzStaApiResponse);
|
||||
List<BizShipmentPlan> bizShipmentPlans = new ArrayList<>();
|
||||
|
||||
List<BizShipmentTracking> bizTrackingList = new ArrayList<>();
|
||||
List<BizShipmentItem> bizShipmentItems = new ArrayList<>();
|
||||
|
||||
List<String> shipmentIds = new ArrayList<>();
|
||||
|
||||
if (amzStaApiResponse.getData() == null || amzStaApiResponse.getData().getTotal().equals(0)) {
|
||||
log.info("没有获取到数据");
|
||||
return;
|
||||
}
|
||||
List<AmzStaApiResponse.InboundPlanRecord> records = amzStaApiResponse.getData().getRecords();
|
||||
|
||||
HashMap<String, List<AmzStaApiResponse.Shipment>> shipmentHashMap = new HashMap<>();
|
||||
HashMap<String, String> gmtCreateDateMap = new HashMap<>();
|
||||
for (AmzStaApiResponse.InboundPlanRecord record : records) {
|
||||
String inboundPlanId = record.getInboundPlanId();
|
||||
List<AmzStaApiResponse.Shipment> shipmentList = record.getShipmentList();
|
||||
Set<String> shipmentCollect = shipmentList.stream().map(AmzStaApiResponse.Shipment::getShipmentId).collect(Collectors.toSet());
|
||||
Set<String> shipmentConfiramtionIds = shipmentList.stream().map(AmzStaApiResponse.Shipment::getShipmentConfirmationId).collect(Collectors.toSet());
|
||||
|
||||
shipmentIds.addAll(shipmentConfiramtionIds);
|
||||
if (CollectionUtil.isEmpty(shipmentCollect)) {
|
||||
log.info("shipmentCollect:{}", shipmentCollect);
|
||||
continue;
|
||||
}
|
||||
|
||||
shipmentHashMap.put(inboundPlanId + "," + record.getSid(), shipmentList);
|
||||
gmtCreateDateMap.put(inboundPlanId + "," + record.getSid(), record.getGmtCreate());
|
||||
}
|
||||
|
||||
if (CollectionUtil.isEmpty(shipmentIds)) {
|
||||
log.info("shipmentIds:{}", shipmentIds);
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> selectExistingShipmentIds = bizShipmentPlanMapper.selectList(new LambdaQueryWrapper<BizShipmentPlan>().in(BizShipmentPlan::getShipmentId, shipmentIds)).stream().map(BizShipmentPlan::getShipmentId).collect(Collectors.toList());
|
||||
|
||||
Collection<String> subtract = CollUtil.subtract(shipmentIds, selectExistingShipmentIds);
|
||||
log.info("shipmentIds过滤以后:{}", subtract);
|
||||
if (CollectionUtil.isEmpty(subtract)) {
|
||||
lingxinCallback.onFinished("没有最新的数据", 100);
|
||||
return;
|
||||
}
|
||||
for (String key : shipmentHashMap.keySet()) {
|
||||
List<String> split = StrUtil.split(key, ",");
|
||||
log.info("key:{}", key);
|
||||
List<AmzStaApiResponse.Shipment> shipments = shipmentHashMap.get(key);
|
||||
|
||||
List<String> shipmentIdList = shipments.stream().map(c->{
|
||||
if (selectExistingShipmentIds.contains(c.getShipmentConfirmationId())){
|
||||
return null;
|
||||
}
|
||||
return c.getShipmentId();
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtil.isEmpty(shipmentIdList)) {
|
||||
log.info("shipmentIdList过滤以后:{}", shipmentIdList);
|
||||
continue;
|
||||
}
|
||||
Map<String, String> shipmentMap = shipments.stream().collect(Collectors.toMap(AmzStaApiResponse.Shipment::getShipmentId, AmzStaApiResponse.Shipment::getShipmentConfirmationId));
|
||||
|
||||
Map<String, Object> shipmentParms = new HashMap<>();
|
||||
shipmentParms.put("inboundPlanId", split.get(0));
|
||||
shipmentParms.put("sid", Long.valueOf(split.get(1)));
|
||||
shipmentParms.put("shipmentIds", JSON.toJSON(shipmentIdList));
|
||||
|
||||
String gmtDate = gmtCreateDateMap.get(key);
|
||||
makeShipmentRequest(shipmentParms, bizShipmentPlans,bizShipmentItems,gmtDate);
|
||||
|
||||
|
||||
Map<String, Object> boxParms = new HashMap<>();
|
||||
boxParms.put("inboundPlanId", split.get(0));
|
||||
boxParms.put("sid", split.get(1));
|
||||
boxParms.put("shipmentIdList", JSON.toJSON(shipmentIdList));
|
||||
|
||||
|
||||
// 查询货件装箱详情
|
||||
makeBoxRequest(boxParms, shipmentMap, bizTrackingList);
|
||||
}
|
||||
|
||||
log.info("bizShipmentPlans:{}", bizShipmentPlans);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(bizShipmentPlans)) {
|
||||
bizShipmentPlanMapper.insertBatch(bizShipmentPlans);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(bizTrackingList)) {
|
||||
bizShipmentTrackingMapper.insertBatch(bizTrackingList);
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(bizShipmentItems)) {
|
||||
bizShipmentItemMapper.insertBatch(bizShipmentItems);
|
||||
}
|
||||
lingxinCallback.onFinished("获取货件信息完成", 200);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error("Sta货件获取出错了", e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void makeBoxRequest(Map<String, Object> boxParms, Map<String, String> shipmentMap, List<BizShipmentTracking> bizTrackingList) throws IOException {
|
||||
String boxString = HttpUtil.postWithParamsSync("/amzStaServer/openapi/inbound-shipment/listShipmentBoxes", boxParms);
|
||||
log.info("查询货件装箱详情:{}", boxString);
|
||||
AmzBoxResponse amzBoxResponse = JSON.parseObject(boxString, new TypeReference<>() {
|
||||
});
|
||||
if (amzBoxResponse.getCode() != 0) {
|
||||
log.error("查询货件装箱详情出错了:{}", amzBoxResponse.getMessage());
|
||||
return;
|
||||
}
|
||||
String inboundPlanId = amzBoxResponse.getData().getInboundPlanId();
|
||||
List<AmzBoxResponse.Shipment> shipmentList = amzBoxResponse.getData().getShipmentList();
|
||||
for (AmzBoxResponse.Shipment shipment : shipmentList) {
|
||||
List<AmzBoxResponse.PackageBox> packageBoxList = shipment.getShipmentPackingList();
|
||||
List<BizShipmentTracking> bizShipmentTrackings = BeanUtil.copyToList(packageBoxList, BizShipmentTracking.class);
|
||||
for (BizShipmentTracking bizShipmentTracking : bizShipmentTrackings) {
|
||||
|
||||
bizShipmentTracking.setCreateBy(1L);
|
||||
bizShipmentTracking.setInboundPlanId(inboundPlanId);
|
||||
bizShipmentTracking.setShipmentId(shipmentMap.get(shipment.getShipmentId()));
|
||||
bizTrackingList.add(bizShipmentTracking);
|
||||
}
|
||||
}
|
||||
sleep(1000);
|
||||
}
|
||||
|
||||
private List<BizShipmentPlan> makeShipmentRequest(Map<String, Object> shipmentParms, List<BizShipmentPlan> bizShipmentPlans,List<BizShipmentItem> bizShipmentItems,String gmtDate) throws IOException {
|
||||
String shipmentString = HttpUtil.postWithParamsSync("/amzStaServer/openapi/inbound-shipment/shipmentDetailList", shipmentParms);
|
||||
|
||||
log.info("查询货件详情:{}", shipmentString);
|
||||
|
||||
AmzShippingResponse amzShippingResponse = JSON.parseObject(shipmentString, new TypeReference<>() {
|
||||
});
|
||||
|
||||
|
||||
List<AmzShippingResponse.Shipment> shipmentList1 = amzShippingResponse.getData().getShipmentList();
|
||||
|
||||
for (AmzShippingResponse.Shipment shipment : shipmentList1) {
|
||||
BizShipmentPlan bizShipmentPlan = new BizShipmentPlan();
|
||||
bizShipmentPlan.setCreateBy(1L);
|
||||
bizShipmentPlan.setSid(shipment.getSid());
|
||||
bizShipmentPlan.setStaInboundPlanId((String) shipmentParms.get("inboundPlanId"));
|
||||
bizShipmentPlan.setInboundPlanId((String) shipmentParms.get("inboundPlanId"));
|
||||
bizShipmentPlan.setShipmentId(shipment.getShipmentConfirmationId());
|
||||
bizShipmentPlan.setShipmentUniqueId(shipment.getShipmentId());
|
||||
bizShipmentPlan.setGmtCreate(DateUtil.parse(gmtDate));
|
||||
bizShipmentPlan.setShipmentName(shipment.getShipmentName());
|
||||
bizShipmentPlan.setShipmentStatus(shipment.getStatus());
|
||||
bizShipmentPlan.setDestination(shipment.getWarehouseId());
|
||||
bizShipmentPlan.setStaShipmentDate(shipment.getShipingTime());
|
||||
FbaShipmentApiResponse.Address shipFromAddress = new FbaShipmentApiResponse.Address();
|
||||
shipFromAddress.setAddressLine1(shipment.getSendAddress().getAddressLine1());
|
||||
shipFromAddress.setAddressLine2(shipment.getSendAddress().getAddressLine2());
|
||||
shipFromAddress.setCity(shipment.getSendAddress().getCity());
|
||||
shipFromAddress.setCountryCode(shipment.getSendAddress().getCountryCode());
|
||||
shipFromAddress.setDoorplate(shipment.getSendAddress().getPostalCode());
|
||||
shipFromAddress.setPhone(shipment.getSendAddress().getPhoneNumber());
|
||||
shipFromAddress.setPostalCode(shipment.getSendAddress().getPostalCode());
|
||||
shipFromAddress.setRegion(shipment.getSendAddress().getStateOrProvinceCode());
|
||||
bizShipmentPlan.setShipFromAddress(shipFromAddress);
|
||||
|
||||
FbaShipmentApiResponse.Address shipToAddress = new FbaShipmentApiResponse.Address();
|
||||
shipToAddress.setAddressLine1(shipment.getShippingAddress().getAddressLine1());
|
||||
shipToAddress.setAddressLine2(shipment.getShippingAddress().getAddressLine2());
|
||||
shipToAddress.setCity(shipment.getShippingAddress().getCity());
|
||||
shipToAddress.setCountryCode(shipment.getShippingAddress().getCountryCode());
|
||||
shipToAddress.setDoorplate(shipment.getShippingAddress().getPostalCode());
|
||||
shipToAddress.setPhone(shipment.getShippingAddress().getPhoneNumber());
|
||||
shipToAddress.setPostalCode(shipment.getShippingAddress().getPostalCode());
|
||||
shipToAddress.setRegion(shipment.getShippingAddress().getStateOrProvinceCode());
|
||||
bizShipmentPlan.setShipToAddress(shipToAddress);
|
||||
|
||||
bizShipmentPlans.add(bizShipmentPlan);
|
||||
|
||||
|
||||
List<AmzShippingResponse.Item> itemList = shipment.getItemList();
|
||||
for (AmzShippingResponse.Item item : itemList) {
|
||||
BizShipmentItem bizShipmentItem = new BizShipmentItem();
|
||||
bizShipmentItem.setCreateBy(1L);
|
||||
bizShipmentItem.setShipmentId(shipment.getShipmentConfirmationId());
|
||||
bizShipmentItem.setMsku(item.getMsku());
|
||||
bizShipmentItem.setFnsku(item.getFnsku());
|
||||
bizShipmentItem.setSku(item.getSku());
|
||||
// bizShipmentItem.setQuantityShipped(item.getQuantity());
|
||||
bizShipmentItems.add(bizShipmentItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sleep(1000);
|
||||
|
||||
return bizShipmentPlans;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pullAmzBoxData() throws Exception {
|
||||
Map<String, Object> queryParam = new HashMap<>();
|
||||
queryParam.put("page", 1);
|
||||
queryParam.put("length", 200);
|
||||
queryParam.put("dateBegin", "2025-04-02");
|
||||
queryParam.put("dateEnd", "2025-04-02");
|
||||
queryParam.put("dateType", 1);
|
||||
|
||||
|
||||
HttpUtil.postWithParams("/amzStaServer/openapi/inbound-plan/page", queryParam, new Callback() {
|
||||
@Override
|
||||
public void onFailure(@NotNull Call call, @NotNull IOException e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
|
||||
|
||||
|
||||
String string = response.body().string();
|
||||
AmzStaApiResponse amzStaApiResponse = JSONObject.parseObject(string, AmzStaApiResponse.class);
|
||||
log.info("amzStaApiResponse:{}", amzStaApiResponse);
|
||||
|
||||
try {
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error("Sta货件获取出错了", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getAmzStoreTokenData() throws Exception {
|
||||
public void pullAmzBoxData2() throws Exception {
|
||||
Map<String, Object> queryParam = new HashMap<>();
|
||||
queryParam.put("inboundPlanId", "wfc758b280-f9d1-4a54-873f-31de17da1e88");
|
||||
queryParam.put("sid", 153);
|
||||
// queryParam.put("shipmentIdList", JSON.toJSON(List.of("shfb03a733-5928-4754-aeff-b02727d69176")));
|
||||
|
||||
// 如果用postman等其他工具调试时,需要将appSecret用urlencode.encode()进行转义
|
||||
if (ObjectUtil.isNull(RedisUtils.getCacheObject(REFRESH_TOKEN))) {
|
||||
Result result = AKRestClientBuild.builder().endpoint(url).getAccessToken(appId, appSecret);
|
||||
Object data = result.getData();
|
||||
if (data instanceof LinkedHashMap) {
|
||||
// 将LinkedHashMap转为TokenInfo
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
TokenInfo tokenInfo = mapper.convertValue(data, TokenInfo.class); // 关键点
|
||||
log.info("token:{}", tokenInfo.getRefreshToken());
|
||||
RedisUtils.setCacheObject(REFRESH_TOKEN, tokenInfo.getRefreshToken(), Duration.ofHours(2));
|
||||
RedisUtils.setCacheObject(ACCESS_TOKEN, tokenInfo.getAccessToken(), Duration.ofSeconds(tokenInfo.getExpiresIn()));
|
||||
} else {
|
||||
throw new IllegalStateException("data字段类型不匹配");
|
||||
}
|
||||
} else {
|
||||
Object result = AKRestClientBuild.builder().endpoint(url).refreshToken(appId, RedisUtils.getCacheObject(REFRESH_TOKEN));
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Result result1 = mapper.convertValue(result, Result.class); // 关键点
|
||||
if (result1.getData() != null && result1.getData() instanceof LinkedHashMap) {
|
||||
TokenInfo tokenInfo = mapper.convertValue(result1.getData(), TokenInfo.class); // 关键点
|
||||
log.info("tokenInfo:{}", tokenInfo.getRefreshToken());
|
||||
RedisUtils.setCacheObject(REFRESH_TOKEN, tokenInfo.getRefreshToken(), Duration.ofHours(2));
|
||||
RedisUtils.setCacheObject(ACCESS_TOKEN, tokenInfo.getAccessToken(), Duration.ofSeconds(tokenInfo.getExpiresIn()));
|
||||
// /amzStaServer/openapi/inbound-shipment/listShipmentBoxes
|
||||
// /amzStaServer/openapi/inbound-shipment/shipmentDetailList
|
||||
// /amzStaServer/openapi/inbound-packing/getInboundPackingBoxInfo
|
||||
HttpUtil.postWithParams("/amzStaServer/openapi/inbound-packing/getInboundPackingBoxInfo", queryParam, new Callback() {
|
||||
@Override
|
||||
public void onFailure(@NotNull Call call, @NotNull IOException e) {
|
||||
|
||||
} else {
|
||||
log.info("删除Redis存储的token");
|
||||
RedisUtils.deleteObject(REFRESH_TOKEN);
|
||||
RedisUtils.deleteObject(ACCESS_TOKEN);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
|
||||
System.out.println(response.body().string());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -433,25 +706,7 @@ public class SysAmazonStoreServiceImpl implements ISysAmazonStoreService {
|
||||
Map<String, Object> queryParam = new HashMap<>();
|
||||
queryParam.put("sid", 143);
|
||||
queryParam.put("event_date", "2025-03-27");
|
||||
queryParam.put("type",2);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// HttpUtil.postWithUrlParams("/erp/sc/data/sales_report/asinList", queryParam, new Callback() {
|
||||
// @Override
|
||||
// public void onFailure(@NotNull Call call, @NotNull IOException e) {
|
||||
//
|
||||
// log.info("onFailure");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
|
||||
//
|
||||
// System.out.println(response.body().string());
|
||||
// }
|
||||
// });
|
||||
|
||||
queryParam.put("type", 2);
|
||||
|
||||
|
||||
HttpUtil.postWithParams("/erp/sc/data/sales_report/asinDailyLists", queryParam, new Callback() {
|
||||
@ -476,7 +731,6 @@ public class SysAmazonStoreServiceImpl implements ISysAmazonStoreService {
|
||||
queryParam.put("end_date", "2025-03-27");
|
||||
|
||||
|
||||
|
||||
//
|
||||
// HttpUtil.postWithUrlParams("/erp/sc/data/sales_report/asinList", queryParam, new Callback() {
|
||||
// @Override
|
||||
@ -493,7 +747,6 @@ public class SysAmazonStoreServiceImpl implements ISysAmazonStoreService {
|
||||
// });
|
||||
|
||||
|
||||
|
||||
HttpUtil.postWithParams("/erp/sc/data/sales_report/asinList", queryParam, new Callback() {
|
||||
@Override
|
||||
public void onFailure(@NotNull Call call, @NotNull IOException e) {
|
||||
|
@ -0,0 +1,149 @@
|
||||
package org.asinkj.asinking.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class AmzBoxResponse {
|
||||
|
||||
@JSONField(name = "code")
|
||||
private Integer code;
|
||||
|
||||
@JSONField(name = "message")
|
||||
private String message;
|
||||
|
||||
@JSONField(name = "errorDetails")
|
||||
private String errorDetails;
|
||||
|
||||
@JSONField(name = "requestId")
|
||||
private String requestId;
|
||||
|
||||
@JSONField(name = "responseTime")
|
||||
private String responseTime;
|
||||
|
||||
@JSONField(name = "data")
|
||||
private BoxData data;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class BoxData {
|
||||
@JSONField(name = "inboundPlanId")
|
||||
private String inboundPlanId;
|
||||
|
||||
@JSONField(name = "shipmentList")
|
||||
private List<Shipment> shipmentList;
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Accessors(chain = true)
|
||||
public static class Shipment {
|
||||
@JSONField(name = "shipmentId")
|
||||
private String shipmentId;
|
||||
|
||||
@JSONField(name = "shipmentPackingList")
|
||||
private List<PackageBox> shipmentPackingList;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Accessors(chain = true)
|
||||
public static class PackageBox {
|
||||
@JSONField(name = "localBoxId")
|
||||
private String localBoxId;
|
||||
|
||||
@JSONField(name = "packageId")
|
||||
private String packageId;
|
||||
|
||||
@JSONField(name = "boxId")
|
||||
private String boxId;
|
||||
|
||||
@JSONField(name = "total")
|
||||
private Integer total;
|
||||
|
||||
@JSONField(name = "weight")
|
||||
private Double weight;
|
||||
|
||||
@JSONField(name = "weightUnit")
|
||||
private String weightUnit;
|
||||
|
||||
@JSONField(name = "length")
|
||||
private Double length;
|
||||
|
||||
@JSONField(name = "width")
|
||||
private Double width;
|
||||
|
||||
@JSONField(name = "height")
|
||||
private Double height;
|
||||
|
||||
@JSONField(name = "lengthUnit")
|
||||
private String lengthUnit;
|
||||
|
||||
@JSONField(name = "boxName")
|
||||
private String boxName;
|
||||
|
||||
|
||||
@JSONField(name = "productList")
|
||||
private List<Product> productList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public static class Product {
|
||||
@JSONField(name = "msku")
|
||||
private String msku;
|
||||
|
||||
@JSONField(name = "fnsku")
|
||||
private String fnsku;
|
||||
|
||||
@JSONField(name = "asin")
|
||||
private String asin;
|
||||
|
||||
@JSONField(name = "parentAsin")
|
||||
private String parentAsin;
|
||||
|
||||
@JSONField(name = "productName")
|
||||
private String productName;
|
||||
|
||||
@JSONField(name = "sku")
|
||||
private String sku;
|
||||
|
||||
@JSONField(name = "title")
|
||||
private String title;
|
||||
|
||||
@JSONField(name = "url")
|
||||
private String url;
|
||||
|
||||
@JSONField(name = "expiration")
|
||||
private String expiration;
|
||||
|
||||
@JSONField(name = "quantityInBox")
|
||||
private Integer quantityInBox;
|
||||
|
||||
@JSONField(name = "prepOwner")
|
||||
private String prepOwner;
|
||||
|
||||
@JSONField(name = "labelOwner")
|
||||
private String labelOwner;
|
||||
}
|
||||
}
|
@ -0,0 +1,200 @@
|
||||
package org.asinkj.asinking.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class AmzShippingResponse {
|
||||
|
||||
@JSONField(name = "code")
|
||||
private Integer code;
|
||||
|
||||
@JSONField(name = "message")
|
||||
private String message;
|
||||
|
||||
@JSONField(name = "errorDetails")
|
||||
private String errorDetails;
|
||||
|
||||
@JSONField(name = "requestId")
|
||||
private String requestId;
|
||||
|
||||
@JSONField(name = "responseTime")
|
||||
private String responseTime;
|
||||
|
||||
@JSONField(name = "data")
|
||||
private ShippingData data;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class ShippingData {
|
||||
@JSONField(name = "inboundPlanId")
|
||||
private String inboundPlanId;
|
||||
|
||||
@JSONField(name = "shipmentList")
|
||||
private List<Shipment> shipmentList;
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Accessors(chain = true)
|
||||
public static class Shipment {
|
||||
@JSONField(name = "shipmentId")
|
||||
private String shipmentId;
|
||||
|
||||
@JSONField(name = "shipmentConfirmationId")
|
||||
private String shipmentConfirmationId;
|
||||
|
||||
@JSONField(name = "sid")
|
||||
private Long sid;
|
||||
|
||||
@JSONField(name = "shipmentName")
|
||||
private String shipmentName;
|
||||
|
||||
@JSONField(name = "shippingAddress")
|
||||
private ShippingAddress shippingAddress;
|
||||
|
||||
@JSONField(name = "inboundRegion")
|
||||
private String inboundRegion;
|
||||
|
||||
@JSONField(name = "warehouseId")
|
||||
private String warehouseId;
|
||||
|
||||
@JSONField(name = "sendAddress")
|
||||
private ShippingAddress sendAddress;
|
||||
|
||||
@JSONField(name = "amazonReferenceId")
|
||||
private String amazonReferenceId;
|
||||
|
||||
@JSONField(name = "status")
|
||||
private String status;
|
||||
|
||||
@JSONField(name = "itemCount")
|
||||
private Integer itemCount;
|
||||
|
||||
@JSONField(name = "itemList")
|
||||
private List<Item> itemList;
|
||||
|
||||
@JSONField(name = "shippingMode")
|
||||
private String shippingMode;
|
||||
|
||||
@JSONField(name = "shippingSolution")
|
||||
private String shippingSolution;
|
||||
|
||||
@JSONField(name = "alphaCode")
|
||||
private String alphaCode;
|
||||
|
||||
@JSONField(name = "shipingTime")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date shipingTime;
|
||||
|
||||
@JSONField(name = "startDate")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date startDate;
|
||||
|
||||
@JSONField(name = "endDate")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date endDate;
|
||||
|
||||
@JSONField(name = "pickUpId")
|
||||
private String pickUpId;
|
||||
|
||||
@JSONField(name = "trackingNumber")
|
||||
private String trackingNumber;
|
||||
|
||||
@JSONField(name = "trackingNumberList")
|
||||
private List<?> trackingNumberList = List.of();
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public static class ShippingAddress {
|
||||
@JSONField(name = "addressLine1")
|
||||
private String addressLine1;
|
||||
|
||||
@JSONField(name = "addressLine2")
|
||||
private String addressLine2;
|
||||
|
||||
@JSONField(name = "city")
|
||||
private String city;
|
||||
|
||||
@JSONField(name = "countryCode")
|
||||
private String countryCode;
|
||||
|
||||
@JSONField(name = "country")
|
||||
private String country;
|
||||
|
||||
@JSONField(name = "stateOrProvinceCode")
|
||||
private String stateOrProvinceCode;
|
||||
|
||||
@JSONField(name = "addressName")
|
||||
private String addressName;
|
||||
|
||||
@JSONField(name = "postalCode")
|
||||
private String postalCode;
|
||||
|
||||
@JSONField(name = "email")
|
||||
private String email;
|
||||
|
||||
@JSONField(name = "phoneNumber")
|
||||
private String phoneNumber;
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public static class Item {
|
||||
@JSONField(name = "msku")
|
||||
private String msku;
|
||||
|
||||
@JSONField(name = "fnsku")
|
||||
private String fnsku;
|
||||
|
||||
@JSONField(name = "asin")
|
||||
private String asin;
|
||||
|
||||
@JSONField(name = "parentAsin")
|
||||
private String parentAsin;
|
||||
|
||||
@JSONField(name = "productName")
|
||||
private String productName;
|
||||
|
||||
@JSONField(name = "sku")
|
||||
private String sku;
|
||||
|
||||
@JSONField(name = "title")
|
||||
private String title;
|
||||
|
||||
@JSONField(name = "url")
|
||||
private String url;
|
||||
|
||||
@JSONField(name = "quantity")
|
||||
private Integer quantity;
|
||||
|
||||
@JSONField(name = "labelOwner")
|
||||
private String labelOwner;
|
||||
|
||||
@JSONField(name = "prepOwner")
|
||||
private String prepOwner;
|
||||
|
||||
@JSONField(name = "expiration")
|
||||
private Object expiration;
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
package org.asinkj.asinking.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AmzStaApiResponse {
|
||||
@JSONField(name = "code")
|
||||
private Integer code;
|
||||
|
||||
@JSONField(name = "message")
|
||||
private String message;
|
||||
|
||||
@JSONField(name = "errorDetails")
|
||||
private String errorDetails;
|
||||
|
||||
@JSONField(name = "requestId")
|
||||
private String requestId;
|
||||
|
||||
@JSONField(name = "responseTime")
|
||||
private String responseTime;
|
||||
|
||||
@JSONField(name = "data")
|
||||
private PageData data;
|
||||
|
||||
@Data
|
||||
public static class PageData {
|
||||
@JSONField(name = "records")
|
||||
private List<InboundPlanRecord> records;
|
||||
|
||||
@JSONField(name = "total")
|
||||
private Integer total;
|
||||
|
||||
@JSONField(name = "size")
|
||||
private Integer size;
|
||||
|
||||
@JSONField(name = "current")
|
||||
private Integer current;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class InboundPlanRecord {
|
||||
@JSONField(name = "sid")
|
||||
private Long sid;
|
||||
|
||||
@JSONField(name = "inboundPlanId")
|
||||
private String inboundPlanId;
|
||||
|
||||
@JSONField(name = "planName")
|
||||
private String planName;
|
||||
|
||||
@JSONField(name = "gmtCreate")
|
||||
private String gmtCreate;
|
||||
|
||||
@JSONField(name = "gmtModified")
|
||||
private String gmtModified;
|
||||
|
||||
@JSONField(name = "status")
|
||||
private String status;
|
||||
|
||||
@JSONField(name = "positionType")
|
||||
private String positionType;
|
||||
|
||||
@JSONField(name = "shipmentList")
|
||||
private List<Shipment> shipmentList;
|
||||
|
||||
@JSONField(name = "inboundPlanItemList")
|
||||
private List<PlanItem> inboundPlanItemList;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Shipment {
|
||||
@JSONField(name = "shipmentId")
|
||||
private String shipmentId;
|
||||
|
||||
@JSONField(name = "shipmentConfirmationId")
|
||||
private String shipmentConfirmationId;
|
||||
|
||||
@JSONField(name = "freightBillNumber")
|
||||
private Object freightBillNumber;
|
||||
|
||||
@JSONField(name = "pickUpId")
|
||||
private Object pickUpId;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class PlanItem {
|
||||
@JSONField(name = "msku")
|
||||
private String msku;
|
||||
|
||||
@JSONField(name = "fnsku")
|
||||
private String fnsku;
|
||||
|
||||
@JSONField(name = "asin")
|
||||
private String asin;
|
||||
|
||||
@JSONField(name = "parentAsin")
|
||||
private String parentAsin;
|
||||
|
||||
@JSONField(name = "productName")
|
||||
private String productName;
|
||||
|
||||
@JSONField(name = "sku")
|
||||
private String sku;
|
||||
|
||||
@JSONField(name = "title")
|
||||
private String title;
|
||||
|
||||
@JSONField(name = "url")
|
||||
private String url;
|
||||
|
||||
@JSONField(name = "quantity")
|
||||
private Integer quantity;
|
||||
|
||||
@JSONField(name = "labelOwner")
|
||||
private String labelOwner;
|
||||
|
||||
@JSONField(name = "prepOwner")
|
||||
private String prepOwner;
|
||||
|
||||
@JSONField(name = "expiration")
|
||||
private Object expiration;
|
||||
}
|
||||
}
|
@ -52,7 +52,7 @@ public class FbaShipmentApiResponse {
|
||||
@JSONField(name = "sync_time")
|
||||
private String syncTime;
|
||||
|
||||
@JSONField(name = "destination")
|
||||
@JSONField(name = "destination_fulfillment_center_id")
|
||||
private String destination;
|
||||
|
||||
private String username;
|
||||
|
@ -29,6 +29,6 @@ public class Token {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Token token = new Token(false);
|
||||
System.out.println(token.toString());
|
||||
log.info(token.toString());
|
||||
}
|
||||
}
|
||||
|
@ -76,38 +76,8 @@ public class HttpUtil {
|
||||
buildAndSendRequest(url, queryParams, "POST", RequestBody.create(new byte[0], null), callback);
|
||||
}
|
||||
|
||||
public static void postWithParams(String url, Map<String, Object> queryParams, Callback callback) {
|
||||
|
||||
|
||||
checkInitialized();
|
||||
Map<String, Object> signParams = new HashMap<>();
|
||||
Map<String, String> baseParams = new HashMap<>();
|
||||
|
||||
// 动态获取最新access_token
|
||||
baseParams.put("app_key", appId);
|
||||
baseParams.put("access_token", RedisUtils.getCacheObject(ACCESS_TOKEN));
|
||||
long l = System.currentTimeMillis() / 1000;
|
||||
baseParams.put("timestamp", String.valueOf(l));
|
||||
|
||||
signParams.putAll(baseParams);
|
||||
signParams.putAll(queryParams);
|
||||
|
||||
String sign = ApiSign.sign(signParams, appId);
|
||||
baseParams.put("sign", sign);
|
||||
|
||||
|
||||
// Map<String, String> queryParams = convertToStringMap(allParams);
|
||||
String json = JSON.toJSONString(queryParams);
|
||||
|
||||
// 3. 创建 RequestBody(指定 MediaType 为 JSON)
|
||||
RequestBody requestBody = RequestBody.create(
|
||||
json,
|
||||
MediaType.parse("application/json; charset=utf-8")
|
||||
);
|
||||
|
||||
buildAndSendRequest(url, baseParams, "POST", requestBody, callback);
|
||||
}
|
||||
|
||||
// POST JSON
|
||||
public static void postJson(String url, String jsonBody, Callback callback) {
|
||||
RequestBody body = RequestBody.create(jsonBody, MediaType.get("application/json"));
|
||||
@ -223,6 +193,39 @@ public class HttpUtil {
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
public static void postWithParams(String url, Map<String, Object> queryParams, Callback callback) {
|
||||
|
||||
|
||||
checkInitialized();
|
||||
Map<String, Object> signParams = new HashMap<>();
|
||||
Map<String, String> baseParams = new HashMap<>();
|
||||
|
||||
// 动态获取最新access_token
|
||||
baseParams.put("app_key", appId);
|
||||
baseParams.put("access_token", RedisUtils.getCacheObject(ACCESS_TOKEN));
|
||||
long l = System.currentTimeMillis() / 1000;
|
||||
baseParams.put("timestamp", String.valueOf(l));
|
||||
|
||||
signParams.putAll(baseParams);
|
||||
signParams.putAll(queryParams);
|
||||
|
||||
String sign = ApiSign.sign(signParams, appId);
|
||||
baseParams.put("sign", sign);
|
||||
|
||||
|
||||
// Map<String, String> queryParams = convertToStringMap(allParams);
|
||||
String json = JSON.toJSONString(queryParams);
|
||||
|
||||
// 3. 创建 RequestBody(指定 MediaType 为 JSON)
|
||||
RequestBody requestBody = RequestBody.create(
|
||||
json,
|
||||
MediaType.parse("application/json; charset=utf-8")
|
||||
);
|
||||
|
||||
buildAndSendRequest(url, baseParams, "POST", requestBody, callback);
|
||||
}
|
||||
|
||||
private static void buildAndSendRequest(String url, Map<String, String> queryParams,
|
||||
String method, RequestBody body, Callback callback) {
|
||||
try {
|
||||
@ -241,4 +244,71 @@ public class HttpUtil {
|
||||
callback.onFailure(null, new IOException("请求配置错误", e));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String postWithParamsSync(String url, Map<String, Object> queryParams) throws IOException {
|
||||
checkInitialized();
|
||||
Map<String, Object> signParams = new HashMap<>();
|
||||
Map<String, String> baseParams = new HashMap<>();
|
||||
|
||||
// 动态获取最新 access_token
|
||||
baseParams.put("app_key", appId);
|
||||
baseParams.put("access_token", RedisUtils.getCacheObject(ACCESS_TOKEN));
|
||||
long l = System.currentTimeMillis() / 1000;
|
||||
baseParams.put("timestamp", String.valueOf(l));
|
||||
|
||||
signParams.putAll(baseParams);
|
||||
signParams.putAll(queryParams);
|
||||
|
||||
String sign = ApiSign.sign(signParams, appId);
|
||||
baseParams.put("sign", sign);
|
||||
|
||||
// 将 queryParams 转换为 JSON 字符串
|
||||
String json = JSON.toJSONString(queryParams);
|
||||
|
||||
// 创建 RequestBody
|
||||
RequestBody requestBody = RequestBody.create(
|
||||
json,
|
||||
MediaType.parse("application/json; charset=utf-8")
|
||||
);
|
||||
|
||||
// 发送同步请求并获取响应
|
||||
Response response = buildAndSendSyncRequest(url, baseParams, "POST", requestBody);
|
||||
|
||||
// 解析响应(根据业务需求调整)
|
||||
if (!response.isSuccessful()) {
|
||||
throw new IOException("请求失败,状态码: " + response.code());
|
||||
}
|
||||
String responseData = response.body().string();
|
||||
response.close(); // 确保关闭资源
|
||||
|
||||
return responseData;
|
||||
}
|
||||
|
||||
private static Response buildAndSendSyncRequest(
|
||||
String url,
|
||||
Map<String, String> queryParams,
|
||||
String method,
|
||||
RequestBody body
|
||||
) throws IOException {
|
||||
// 构建完整 URL
|
||||
HttpUrl.Builder urlBuilder = HttpUrl.parse(baseurl + url).newBuilder();
|
||||
if (queryParams != null) {
|
||||
queryParams.forEach(urlBuilder::addQueryParameter);
|
||||
}
|
||||
|
||||
// 创建 Request
|
||||
Request.Builder requestBuilder = new Request.Builder()
|
||||
.url(urlBuilder.build());
|
||||
|
||||
// 设置请求方法
|
||||
if ("POST".equalsIgnoreCase(method)) {
|
||||
requestBuilder.post(body);
|
||||
} else {
|
||||
requestBuilder.get();
|
||||
}
|
||||
|
||||
// 同步执行请求
|
||||
return client.newCall(requestBuilder.build()).execute();
|
||||
}
|
||||
}
|
||||
|
@ -4,4 +4,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.asinkj.amz.mapper.BizLogisticsOrderDetailMapper">
|
||||
|
||||
<update id="updateByBoxId" parameterType="java.util.List">
|
||||
<foreach collection="list" item="item" index="index" separator=";">
|
||||
UPDATE biz_logistics_order_detail
|
||||
<set>
|
||||
<if test="item.logisticsStatus != null">
|
||||
logistics_status = #{item.logisticsStatus},
|
||||
</if>
|
||||
<if test="item.logisticsProviderName != null and item.logisticsProviderName != ''">
|
||||
logistics_provider_name = #{item.logisticsProviderName},
|
||||
</if>
|
||||
</set>
|
||||
WHERE fba_box_number = #{item.fbaBoxNumber}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
|
@ -324,7 +324,8 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return (P) voPage;
|
||||
}
|
||||
voPage.setRecords(MapstructUtils.convert(list, voClass));
|
||||
List<C> convert = MapstructUtils.convert(list, voClass);
|
||||
voPage.setRecords(convert);
|
||||
return (P) voPage;
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-debian:17.0.11-cds
|
||||
#FROM bellsoft/liberica-openjdk-debian:21.0.3-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
FROM amazoncorretto:17.0.14
|
||||
|
||||
LABEL maintainer="Shuo Hu "
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
RUN mkdir -p /asinkj/gateway/logs \
|
||||
/asinkj/gateway/temp \
|
||||
/asinkj/skywalking/agent
|
||||
@ -18,6 +18,7 @@ EXPOSE ${SERVER_PORT}
|
||||
ADD ./target/asinkj-gateway.jar ./app.jar
|
||||
|
||||
ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -Dserver.port=${SERVER_PORT} \
|
||||
-Dspring.profiles.active="prod" \
|
||||
#-Dskywalking.agent.service_name=asinkj-gateway \
|
||||
#-javaagent:/asinkj/skywalking/agent/skywalking-agent.jar \
|
||||
-XX:+HeapDumpOnOutOfMemoryError -XX:+UseZGC ${JAVA_OPTS} \
|
||||
|
@ -1,10 +1,10 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-debian:17.0.11-cds
|
||||
#FROM bellsoft/liberica-openjdk-debian:21.0.3-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
FROM amazoncorretto:17.0.14
|
||||
|
||||
LABEL maintainer="Shuo Hu "
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
RUN mkdir -p /asinkj/job/logs \
|
||||
/asinkj/job/temp \
|
||||
/asinkj/skywalking/agent
|
||||
@ -18,6 +18,7 @@ EXPOSE ${SERVER_PORT}
|
||||
ADD ./target/asinkj-job.jar ./app.jar
|
||||
|
||||
ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -Dserver.port=${SERVER_PORT} \
|
||||
-Dspring.profiles.active="prod" \
|
||||
#-Dskywalking.agent.service_name=asinkj-job \
|
||||
#-javaagent:/asinkj/skywalking/agent/skywalking-agent.jar \
|
||||
-XX:+HeapDumpOnOutOfMemoryError -XX:+UseZGC ${JAVA_OPTS} \
|
||||
|
@ -38,18 +38,52 @@ public class AmzPullFBAJobExecutor {
|
||||
String yesterdayString = yesterday.toString("yyyy-MM-dd");
|
||||
SnailJobLog.LOCAL.info("yesterdayString. yesterdayString:{}", yesterdayString);
|
||||
//获取今天的日期
|
||||
DateTime today = DateUtil.date();
|
||||
String todayString = today.toString("yyyy-MM-dd");
|
||||
SnailJobLog.LOCAL.info("todayString. todayString:{}", todayString);
|
||||
remoteFBADataService.pullAmzFbaDataToken(yesterdayString, todayString);
|
||||
DateTime tomorrow = DateUtil.tomorrow();
|
||||
String tomorrowString = tomorrow.toString("yyyy-MM-dd");
|
||||
SnailJobLog.LOCAL.info("todayString. todayString:{}", tomorrowString);
|
||||
remoteFBADataService.pullAmzFbaDataToken(yesterdayString, tomorrowString);
|
||||
return ExecuteResult.success("获取从昨天开始的FBA货件数据");
|
||||
} else if ("today".equals(jobArgs.getJobParams())) {
|
||||
DateTime today = DateUtil.date();
|
||||
String todayString = today.toString("yyyy-MM-dd");
|
||||
SnailJobLog.LOCAL.info("todayString. todayString:{}", todayString);
|
||||
remoteFBADataService.pullAmzFbaDataToken(todayString, todayString);
|
||||
return ExecuteResult.success("获取今天的FBA货件数据");
|
||||
SnailJobLog.LOCAL.info("yesterdayString. yesterdayString:{}", todayString);
|
||||
//获取今天的日期
|
||||
DateTime tomorrow = DateUtil.tomorrow();
|
||||
String tomorrowString = tomorrow.toString("yyyy-MM-dd");
|
||||
SnailJobLog.LOCAL.info("todayString. todayString:{}", tomorrowString);
|
||||
remoteFBADataService.pullAmzFbaDataToken(todayString, tomorrowString);
|
||||
}
|
||||
return ExecuteResult.success("请指定参数yesterday或者today");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public ExecuteResult jobExecute(JobArgs jobArgs) throws Exception {
|
||||
// SnailJobLog.LOCAL.info("amzPullFBAJobExecutor. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
|
||||
// SnailJobLog.REMOTE.info("amzPullFBAJobExecutor. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
|
||||
// log.info("amzPullFBAJobExecutor {}", jobArgs.getJobParams());
|
||||
// //昨天的日期yyyy-MM-dd
|
||||
// // 获取昨天的日期
|
||||
// if ("yesterday".equals(jobArgs.getJobParams())) {
|
||||
// DateTime yesterday = DateUtil.yesterday();
|
||||
// String yesterdayString = yesterday.toString("yyyy-MM-dd");
|
||||
// SnailJobLog.LOCAL.info("yesterdayString. yesterdayString:{}", yesterdayString);
|
||||
// //获取今天的日期
|
||||
// DateTime tomorrow = DateUtil.tomorrow();
|
||||
// String tomorrowString = tomorrow.toString("yyyy-MM-dd");
|
||||
// SnailJobLog.LOCAL.info("todayString. todayString:{}", tomorrowString);
|
||||
// remoteFBADataService.pullAmzFbaDataToken(yesterdayString, tomorrowString);
|
||||
// return ExecuteResult.success("获取从昨天开始的FBA货件数据");
|
||||
// } else if ("today".equals(jobArgs.getJobParams())) {
|
||||
// DateTime today = DateUtil.date();
|
||||
// String todayString = today.toString("yyyy-MM-dd");
|
||||
// SnailJobLog.LOCAL.info("yesterdayString. yesterdayString:{}", todayString);
|
||||
// //获取今天的日期
|
||||
// DateTime tomorrow = DateUtil.tomorrow();
|
||||
// String tomorrowString = tomorrow.toString("yyyy-MM-dd");
|
||||
// SnailJobLog.LOCAL.info("todayString. todayString:{}", tomorrowString);
|
||||
// remoteFBADataService.pullAmzFbaDataToken(todayString, tomorrowString);
|
||||
// }
|
||||
// return ExecuteResult.success("请指定参数yesterday或者today");
|
||||
// }
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-debian:17.0.11-cds
|
||||
#FROM bellsoft/liberica-openjdk-debian:21.0.3-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
FROM amazoncorretto:17.0.14
|
||||
|
||||
LABEL maintainer="Shuo Hu "
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
RUN mkdir -p /asinkj/resource/logs \
|
||||
/asinkj/resource/temp \
|
||||
/asinkj/skywalking/agent
|
||||
@ -18,6 +18,7 @@ EXPOSE ${SERVER_PORT}
|
||||
ADD ./target/asinkj-resource.jar ./app.jar
|
||||
|
||||
ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -Dserver.port=${SERVER_PORT} \
|
||||
-Dspring.profiles.active="prod" \
|
||||
#-Dskywalking.agent.service_name=asinkj-resource \
|
||||
#-javaagent:/asinkj/skywalking/agent/skywalking-agent.jar \
|
||||
-XX:+HeapDumpOnOutOfMemoryError -XX:+UseZGC ${JAVA_OPTS} \
|
||||
|
@ -1,10 +1,11 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-debian:17.0.11-cds
|
||||
#FROM bellsoft/liberica-openjdk-debian:21.0.3-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
FROM amazoncorretto:17.0.14
|
||||
|
||||
LABEL maintainer="Shuo Hu "
|
||||
|
||||
# 设置时区为上海
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
RUN mkdir -p /asinkj/system/logs \
|
||||
/asinkj/system/temp \
|
||||
/asinkj/skywalking/agent
|
||||
@ -18,8 +19,8 @@ EXPOSE ${SERVER_PORT}
|
||||
ADD ./target/asinkj-system.jar ./app.jar
|
||||
|
||||
ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -Dserver.port=${SERVER_PORT} \
|
||||
-Dspring.profiles.active="prod" \
|
||||
#-Dskywalking.agent.service_name=asinkj-system \
|
||||
#-javaagent:/asinkj/skywalking/agent/skywalking-agent.jar \
|
||||
-XX:+HeapDumpOnOutOfMemoryError -XX:+UseZGC ${JAVA_OPTS} \
|
||||
-jar app.jar
|
||||
|
||||
|
@ -161,7 +161,7 @@ public class SysRoleController extends BaseController {
|
||||
/**
|
||||
* 查询已分配用户角色列表
|
||||
*/
|
||||
@SaCheckPermission("system:role:list")
|
||||
@SaCheckPermission("system:user:list")
|
||||
@GetMapping("/authUser/allocatedList")
|
||||
public TableDataInfo<SysUserVo> allocatedList(SysUserBo user, PageQuery pageQuery) {
|
||||
return userService.selectAllocatedList(user, pageQuery);
|
||||
|
@ -48,6 +48,7 @@ db.password.0=mysql_FP56kH
|
||||
#db.user.0=root
|
||||
#db.password.0=123456
|
||||
|
||||
|
||||
### the maximum retry times for push
|
||||
nacos.config.push.maxRetryTime=50
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-debian:17.0.11-cds
|
||||
#FROM bellsoft/liberica-openjdk-debian:21.0.3-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
FROM amazoncorretto:17.0.14
|
||||
|
||||
LABEL maintainer="Shuo Hu "
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
RUN mkdir -p /asinkj/snailjob/logs
|
||||
|
||||
WORKDIR /asinkj/snailjob
|
||||
|
2
pom.xml
2
pom.xml
@ -89,7 +89,7 @@
|
||||
<id>prod</id>
|
||||
<properties>
|
||||
<profiles.active>prod</profiles.active>
|
||||
<nacos.server>112.74.106.216:8848</nacos.server>
|
||||
<nacos.server>asinkj-nacos</nacos.server>
|
||||
<nacos.discovery.group>DEFAULT_GROUP</nacos.discovery.group>
|
||||
<nacos.config.group>DEFAULT_GROUP</nacos.config.group>
|
||||
<nacos.username>nacos</nacos.username>
|
||||
|
Loading…
x
Reference in New Issue
Block a user