Commit 8f4bde07 by liyanlin

增加同步WMS库存服务(MQ)

parent 847a87b0
package com.bailuntec.application;
import com.bailuntec.domain.DcAutoMonitorSkuType;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Author: li.yanlin
* @Description:
* @Date: Created in 2021-11-18
* @Modified by:
*/
public interface IDcAutoMonitorSkuTypeService extends IService<DcAutoMonitorSkuType> {
}
package com.bailuntec.application;
import com.bailuntec.domain.DcBaseStock;
import com.bailuntec.pojo.WmsStockItem;
import com.baomidou.mybatisplus.extension.service.IService;
/**
......@@ -13,4 +14,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IDcBaseStockService extends IService<DcBaseStock> {
void syncWmsStock(WmsStockItem wmsStockItem);
}
package com.bailuntec.application.impl;
import com.bailuntec.application.IDcAutoMonitorSkuTypeService;
import com.bailuntec.domain.DcAutoMonitorSkuType;
import com.bailuntec.infrastructure.mapper.DcAutoMonitorSkuTypeMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* @Author: li.yanlin
* @Description:
* @Date: Created in 2021-11-18
* @Modified by:
*/
@Service
public class DcAutoMonitorSkuTypeServiceImpl extends ServiceImpl<DcAutoMonitorSkuTypeMapper, DcAutoMonitorSkuType> implements IDcAutoMonitorSkuTypeService {
}
package com.bailuntec.application.impl;
import com.bailuntec.application.IDcAutoMonitorSkuTypeService;
import com.bailuntec.application.IDcBaseStockService;
import com.bailuntec.domain.DcAutoMonitorSkuType;
import com.bailuntec.domain.DcBaseStock;
import com.bailuntec.domain.DcBaseWarehouse;
import com.bailuntec.infrastructure.mapper.DcAutoMonitorSkuTypeMapper;
import com.bailuntec.infrastructure.mapper.DcBaseStockMapper;
import com.bailuntec.application.IDcBaseStockService;
import com.bailuntec.infrastructure.mapper.DcBaseWarehouseMapper;
import com.bailuntec.pojo.WmsStockItem;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* <p>
* 实时环球库存信息表 服务实现类
......@@ -15,6 +25,62 @@ import org.springframework.stereotype.Service;
* @since 2020-08-19
*/
@Service
@Slf4j
public class DcBaseStockServiceImpl extends ServiceImpl<DcBaseStockMapper, DcBaseStock> implements IDcBaseStockService {
@Resource
DcBaseStockMapper mapper;
@Resource
DcBaseWarehouseMapper dcBaseWarehouseMapper;
@Resource
DcAutoMonitorSkuTypeMapper dcAutoMonitorSkuTypeMapper;
@Resource
IDcAutoMonitorSkuTypeService dcAutoMonitorSkuTypeService;
@Override
public void syncWmsStock(WmsStockItem wmsStockItem) {
try {
DcBaseStock dcBaseStock = new DcBaseStock();
try {
//BeanUtils.copyProperties(dcBaseStock, wmsStockItem);
dcBaseStock.setBailunSku(wmsStockItem.getBailunSku());
dcBaseStock.setWarehouseCode(wmsStockItem.getWarehouseCode());
dcBaseStock.setWaitPutaway(wmsStockItem.getWaitPutaway());
dcBaseStock.setOccupyStock(wmsStockItem.getOccupyStock());
dcBaseStock.setQuantityFreeze(wmsStockItem.getQuantityFreeze());
dcBaseStock.setQuantityTransit(wmsStockItem.getQuantityTransit());
dcBaseStock.setShippedStock(wmsStockItem.getShippedStock());
dcBaseStock.setUsableSales(wmsStockItem.getUsableStock());
dcBaseStock.setCreateTime(wmsStockItem.getUpdateTime());
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("WMS库存BeanUtils.copyProperties失败");
}
int i = mapper.update(dcBaseStock, new LambdaQueryWrapper<DcBaseStock>()
.eq(DcBaseStock::getBailunSku, dcBaseStock.getBailunSku())
.eq(DcBaseStock::getWarehouseCode, dcBaseStock.getWarehouseCode()));
if (i == 0) {
try {
DcBaseWarehouse dcBaseWarehouse = dcBaseWarehouseMapper.selectOne(new LambdaQueryWrapper<DcBaseWarehouse>()
.eq(DcBaseWarehouse::getWarehouseCode, dcBaseStock.getWarehouseCode()));
if (dcBaseWarehouse != null) {
DcAutoMonitorSkuType dcAutoMonitorSkuType = new DcAutoMonitorSkuType();
dcAutoMonitorSkuType.setBailunSku(dcBaseStock.getBailunSku());
dcAutoMonitorSkuType.setWarehouseType(dcBaseWarehouse.getHqType());
dcAutoMonitorSkuTypeService.saveOrUpdate(dcAutoMonitorSkuType, new LambdaQueryWrapper<DcAutoMonitorSkuType>()
.eq(DcAutoMonitorSkuType::getBailunSku, dcAutoMonitorSkuType.getBailunSku())
.eq(DcAutoMonitorSkuType::getWarehouseType, dcAutoMonitorSkuType.getWarehouseType()));
}
} catch (Exception ignore) {
}
mapper.insert(dcBaseStock);
}
} catch (Exception ex) {
log.error(ex.getMessage());
throw ex;
}
}
}
package com.bailuntec.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class DcAutoMonitorSkuType implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_auto_monitor_sku_type.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_auto_monitor_sku_type.bailun_sku
*
* @mbg.generated
*/
private String bailunSku;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_auto_monitor_sku_type.warehouse_type
*
* @mbg.generated
*/
private String warehouseType;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", bailunSku=").append(bailunSku);
sb.append(", warehouseType=").append(warehouseType);
sb.append("]");
return sb.toString();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
DcAutoMonitorSkuType other = (DcAutoMonitorSkuType) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getBailunSku() == null ? other.getBailunSku() == null : this.getBailunSku().equals(other.getBailunSku()))
&& (this.getWarehouseType() == null ? other.getWarehouseType() == null : this.getWarehouseType().equals(other.getWarehouseType()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getBailunSku() == null) ? 0 : getBailunSku().hashCode());
result = prime * result + ((getWarehouseType() == null) ? 0 : getWarehouseType().hashCode());
return result;
}
}
\ No newline at end of file
package com.bailuntec.infrastructure.mapper;
import com.bailuntec.domain.DcAutoMonitorSkuType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Author: li.yanlin
* @Description:
* @Date: Created in 2021-11-18
* @Modified by:
*/
@Mapper
public interface DcAutoMonitorSkuTypeMapper extends BaseMapper<DcAutoMonitorSkuType> {
}
package com.bailuntec.pojo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @Author: li.yanlin
* @Description:
* @Date: Created in 2021-11-19
* @Modified by:
*/
@Data
public class WmsStockItem implements Serializable {
@JSONField(name = "Sku")
private String bailunSku;
@JSONField(name = "PlatSKU")
private String platformSku;
@JSONField(name = "Title")
private String skuTitle;
@JSONField(name = "WarehouseCode")
private String warehouseCode;
@JSONField(name = "PendingStock")
private Integer waitPutaway;
@JSONField(name = "ReserveStock")
private Integer occupyStock;
@JSONField(name = "AvailabelStock")
private Integer usableStock;
@JSONField(name = "InboundStock")
private Integer quantityTransit;
@JSONField(name = "UnSellStock")
private Integer quantityFreeze;
@JSONField(name = "ShippedStock")
private Integer shippedStock;
@JSONField(name = "LastModificationTimeStr")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
}
......@@ -22,7 +22,7 @@ public class EbayFeeJob {
@Resource
private SyncEbayFeeService service;
@Scheduled(cron = "0 0 16 * * ?")
@Scheduled(cron = "0 8 16 * * ?")
public void SyncEbayTransaction(){
service.SyncEbayTransaction();
}
......
......@@ -18,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
......@@ -60,6 +61,7 @@ public class SyncEbayFeeServiceImpl implements SyncEbayFeeService {
List<EbayAccountReportTask> ebayAccountReportTaskList = ebayAccountReportTaskService.list(
new LambdaQueryWrapper<EbayAccountReportTask>()
.ne(EbayAccountReportTask::getStatus, 1)
.ge(EbayAccountReportTask::getStartTime, LocalDateTime.now().minusDays(60))
);
/*List<EbayAccountReportTask> ebayAccountReportTaskList = ebayAccountReportTaskService.list(new LambdaQueryWrapper<EbayAccountReportTask>()
.ge(EbayAccountReportTask::getStartTime, LocalDateTime.of(2021, 7, 7, 0, 0, 0))
......
......@@ -103,7 +103,6 @@
<!-- 测试环境日志级别为INFO -->
<springProfile name="test">
<logger name="com.ebay.sdk" level="ERROR"/>
<logger name="com.bailuntec" level="DEBUG"/>
<logger name="org.springframework" level="INFO"/>
......@@ -124,7 +123,6 @@
<!-- 正式环境日志级别为INFO -->
<springProfile name="prod">
<logger name="com.ebay.sdk" level="ERROR"/>
<logger name="com.bailuntec" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
......
......@@ -4,7 +4,7 @@ spring:
name: base-sync-ebay-transaction
# 数据配置
datasource:
url: jdbc:mysql://10.0.8.15:3306/bailun_datacenter?serverTimezone=GMT%2B8&characterEncoding=utf-8&rewriteBatchedStatements=true
url: jdbc:mysql://10.0.8.15:3306/bailun_datacenter?serverTimezone=GMT%2B8&characterEncoding=utf-8&rewriteBatchedStatements=true?useSSL=false
username: root
password: '#7kfnymAM$Y9-Ntf'
driver-class-name: com.mysql.jdbc.Driver
......
......@@ -4,7 +4,7 @@ spring:
name: base-sync-ebay-transaction
# 数据配置
datasource:
url: jdbc:mysql://gz-cdb-kp7s5i79.sql.tencentcdb.com:61691/bailun_datacenter?serverTimezone=GMT%2B8&characterEncoding=utf-8&rewriteBatchedStatements=true
url: jdbc:mysql://gz-cdb-kp7s5i79.sql.tencentcdb.com:61691/bailun_datacenter?serverTimezone=GMT%2B8&characterEncoding=utf-8&rewriteBatchedStatements=true?useSSL=false
username: root
password: '#7kfnymAM$Y9-Ntf'
driver-class-name: com.mysql.jdbc.Driver
......
......@@ -74,6 +74,8 @@ public class BalanceSheetServiceTest {
@Rollback(value = false)
public void generateBalanceSheet() {
balanceSheetService.generateBalanceSheet();
//LocalDate date = LocalDate.now().minusDays(1);
//balanceSheetService.getSupplierTransaction();
}
@Test
......
package com.bailuntec.job.service;
import com.bailuntec.api.bailuntec.exceptionless.ExceptionlessApi;
import com.bailuntec.api.bailuntec.exceptionless.ExceptionlessInput;
import com.bailuntec.job.MidCalculateTransitApp;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.time.LocalDateTime;
/**
* <p>
......@@ -48,4 +52,20 @@ class MidCalculateTransitServiceTest {
void midCalculateNoShippedQuantity() {
midCalculateTransitService.midCalculateNoShippedQuantity();
}
@Resource
ExceptionlessApi exceptionlessApi;
@Value("${exceptionless.token}")
private String exceptionlessToken;
@Test
void exceptionless(){
ExceptionlessInput input = ExceptionlessInput.builder()
.source("midCalculateOutStockQuantity")
.message("执行时间:"+ LocalDateTime.now().toString())
.build();
exceptionlessApi
.events(exceptionlessToken,input);
}
}
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.5.6/maven-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.5.6/maven-plugin/reference/html/#build-image)
* [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/2.5.6/reference/htmlsingle/#using-boot-devtools)
* [Spring for RabbitMQ](https://docs.spring.io/spring-boot/docs/2.5.6/reference/htmlsingle/#boot-features-amqp)
* [Spring Boot Actuator](https://docs.spring.io/spring-boot/docs/2.5.6/reference/htmlsingle/#production-ready)
### Guides
The following guides illustrate how to use some features concretely:
* [Messaging with RabbitMQ](https://spring.io/guides/gs/messaging-rabbitmq/)
* [Building a RESTful Web Service with Spring Boot Actuator](https://spring.io/guides/gs/actuator-service/)
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.bailuntec</groupId>
<artifactId>datacenter-base-mq</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.bailuntec.mq</groupId>
<artifactId>base-sync-stock-wms</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>base-sync-stock-wms</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>com.bailuntec</groupId>
<artifactId>datacenter-domain</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.3.RELEASE</version>
<configuration>
<mainClass>com.bailuntec.mq.BaseSyncStockWmsApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<skipDockerBuild>false</skipDockerBuild>
<imageName>ccr.ccs.tencentyun.com/blt.data.job/base-sync-stock-wms:${maven.build.timestamp}
</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<serverId>bailuntec-docker</serverId>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
FROM openjdk:8-jdk-alpine
VOLUME /tmp
ADD base-sync-stock-wms-0.0.1-SNAPSHOT.jar base-sync-stock-wms-0.0.1-SNAPSHOT.jar
RUN echo "Asia/Shanghai" > /etc/timezone
ENTRYPOINT ["java","-Xms2048m","-Xmx2048m","-jar","-Dspring.profiles.active=prod","/base-sync-stock-wms-0.0.1-SNAPSHOT.jar"]
EXPOSE 8080
package com.bailuntec.mq;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.AutoConfigurationPackage;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@AutoConfigurationPackage
@ComponentScan("com.bailuntec")
public class BaseSyncStockWmsApplication {
public static void main(String[] args) {
SpringApplication.run(BaseSyncStockWmsApplication.class, args);
}
}
package com.bailuntec.mq.handler;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bailuntec.application.IDcBaseStockService;
import com.bailuntec.common.rabbitmq.listen.AbstractMessageHandler;
import com.bailuntec.pojo.WmsStockItem;
import com.rabbitmq.client.Channel;
import lombok.SneakyThrows;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
/**
* @Author: li.yanlin
* @Description:
* @Date: Created in 2021-11-18
* @Modified by:
*/
@Component
public class WmsStockMsgHandler extends AbstractMessageHandler {
@Resource
IDcBaseStockService dcBaseStockService;
private static boolean IS_INIT = false;
@PostConstruct
public void init(){
IS_INIT = true;
}
@SneakyThrows
@Override
public void handleMessage(String s, Channel channel) {
JSONObject jsonObject = JSON.parseObject(s);
WmsStockItem wmsStockItem = jsonObject.toJavaObject(WmsStockItem.class);
while (!IS_INIT){
Thread.sleep(1000);
}
//IDcBaseStockService dcBaseStockService = SpringContextUtil.getBean(DcBaseStockServiceImpl.class);
dcBaseStockService.syncWmsStock(wmsStockItem);
}
}
package com.bailuntec.mq.pojo;
import com.alibaba.fastjson.annotation.JSONField;
@lombok.Data
public class Data {
@JSONField(name = "search")
private Search search;
@JSONField(name = "page")
private Page page;
}
package com.bailuntec.mq.pojo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.time.LocalDateTime;
@Data
@ToString
@EqualsAndHashCode
public class DcBaseStockFbaDto {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_stock_fba.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_stock_fba.gmt_create
*
* @mbg.generated
*/
private LocalDateTime gmtCreate;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_stock_fba.gmt_modified
*
* @mbg.generated
*/
private LocalDateTime gmtModified;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_stock_fba.bailun_sku
*
* @mbg.generated
*/
private String bailunSku;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_stock_fba.platform_sku
*
* @mbg.generated
*/
private String platformSku;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_stock_fba.warehouse_code
*
* @mbg.generated
*/
private String warehouseCode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_stock_fba.usable_stock
*
* @mbg.generated
*/
private Integer usableStock;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_stock_fba.in_warehouse
*
* @mbg.generated
*/
private Integer inWarehouse;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_stock_fba.asin
*
* @mbg.generated
*/
private String asin;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_stock_fba.asin
*
* @mbg.generated
*/
private String bailunAccount;
}
\ No newline at end of file
package com.bailuntec.mq.pojo;
import java.util.List;
public class FbaStockData {
private List<FbaStockInfo> stocks;
private Integer pageIndex;
private Integer pageTotal;
private Integer pageRow;
public List<FbaStockInfo> getStocks() {
return stocks;
}
public void setStocks(List<FbaStockInfo> stocks) {
this.stocks = stocks;
}
public Integer getPageIndex() {
return pageIndex;
}
public void setPageIndex(Integer pageIndex) {
this.pageIndex = pageIndex;
}
public Integer getPageTotal() {
return pageTotal;
}
public void setPageTotal(Integer pageTotal) {
this.pageTotal = pageTotal;
}
public Integer getPageRow() {
return pageRow;
}
public void setPageRow(Integer pageRow) {
this.pageRow = pageRow;
}
}
/**
* Copyright 2019 bejson.com
*/
package com.bailuntec.mq.pojo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
/**
* Auto-generated: 2019-01-07 16:3:56
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@Data
public class FbaStockInfo {
@JSONField(name = "sellerSku")
private String platformSku;
@JSONField(name = "sku")
private String bailunSku;
@JSONField(name = "wareCode")
private String warehouseCode;
@JSONField(name = "asin")
private String asin;
@JSONField(name = "totalQuantity")
private Integer usableStock;
@JSONField(name = "stockQuantity")
private Integer inWarehouse;
}
\ No newline at end of file
package com.bailuntec.mq.pojo;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class Logistics {
private List<String> Company_Codes;
private String TrackingNo;
private String AllocatecargoOrderCode;
private LocalDateTime StartModificationTime;
private LocalDateTime EndModificationTime;
private Integer pageIndex;
private Integer pageCount;
}
package com.bailuntec.mq.pojo;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class LogisticsReconciliation {
private List<String> Company_Codes;
private String TrackingNo;
private String AllocatecargoOrderCode;
private LocalDateTime StartModificationTime;
private LocalDateTime EndModificationTime;
private Integer pageIndex;
private Integer pageCount;
private String FeeCode;
private List<String> DiffStateTypes;
}
package com.bailuntec.mq.pojo;
import lombok.Data;
@Data
public class Page {
private Integer rows;
private Integer page;
}
package com.bailuntec.mq.pojo;
import lombok.Data;
@Data
public class PageItem {
private Integer total;
private Integer currentPage;
private Integer pageSize;
}
package com.bailuntec.mq.pojo;
import com.alibaba.fastjson.annotation.JSONField;
@lombok.Data
public class Root {
@JSONField(name = "Data")
private Data data;
}
package com.bailuntec.mq.pojo;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class Search {
private List<String> warehouseCodes ;
private String skus;
private LocalDateTime lastModificationTime_start;
private LocalDateTime lastModificationTime_end;
}
package com.bailuntec.mq.pojo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class WmsLogisticsInfo {
private String targetUrl;
private Boolean success;
private String error;
private String unAuthorizedRequest;
private Result result;
@Data
public class Result{
private Integer pageIndex;
private Integer totalPages;
private Integer total;
private Boolean hasPreViousPage;
private Boolean hasNextPage;
private List<LogisticsInner> result;
@Data
public class LogisticsInner{
@JSONField(name = "id")
private Integer wmsId;
@JSONField(name = "company_Code")
private String companyCode;
@JSONField(name = "company_Name")
private String companyName;
private String billCode;
private String trackingNo;
private BigDecimal merchantOutputWeightKg;
private BigDecimal merchantShipmentCostCny;
private LocalDateTime merchantReconciliationTime;
private String reconciliationType;
private String infoId;
private BigDecimal outputWeightKg;
private BigDecimal bailunShipmentCostCny;
private LocalDateTime shipmentTime;
private String diffStateType;
private BigDecimal merchantOutputWeightKgOriginal;
private BigDecimal merchantShipmentCostSnyOriginal;
private BigDecimal costDiffDecimal;
private BigDecimal weightDiffDecimal;
private String lineName;
private String feeCode;
private String remark;
private String generateBillStatus;
private String feeProductType;
private LocalDateTime lastModificationTime;
private LocalDateTime gmtCreateTime;
private LocalDateTime gmtModifyTime;
}
}
}
package com.bailuntec.mq.pojo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class WmsLogisticsReconciliationInfo {
private String targetUrl;
private Boolean success;
private String error;
private String unAuthorizedRequest;
private Result result;
@Data
public class Result{
private Integer pageIndex;
private Integer totalPages;
private Integer total;
private Boolean hasPreViousPage;
private Boolean hasNextPage;
private List<LogisticsInner> result;
@Data
public class LogisticsInner{
@JSONField(name = "gmt_id")
private Integer id;
@JSONField(name = "id")
private Integer wmsId;
private String companyCode;
private String companyName;
private String lineCode;
private String lineName;
private String allocatecargoordercode;
private String yicangno;
private String trackingno;
private LocalDateTime shipmenttime;
private BigDecimal outputweightkg;
private BigDecimal bailunshipmentcostcny;
private BigDecimal merchantoutputweightkg;
private BigDecimal merchantshipmentcostcny;
private LocalDateTime merchantreconciliationtime;
private String reconciliationstatus;
private String weightdiff;
private String costdiff;
private String weightspecificdiff;
private LocalDateTime thisreconciliatetime;
private LocalDateTime originalscanningtime;
private String wareno;
private String reconciliationuser;
private String audituser;
private String auditstatus;
private String auditremark;
private String remark;
private BigDecimal confirmshipmentcostcny;
private BigDecimal confirmoutputweightkg;
private String createuser;
private LocalDateTime creationtime;
private LocalDateTime lastmodificationtime;
}
}
}
package com.bailuntec.mq.pojo;
import lombok.Data;
import java.util.List;
@Data
public class WmsStockInfo {
private List<WmsStockItem> items;
private PageItem pageItem;
}
package com.bailuntec.mq.pojo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class WmsStockItem {
@JSONField(name = "sku")
private String bailunSku;
@JSONField(name = "platSKU")
private String platformSku;
@JSONField(name = "title")
private String skuTitle;
@JSONField(name = "warehouseCode")
private String warehouseCode;
//待上架库存
@JSONField(name = "pendingStock")
private Integer waitPutaway;
//占用库存
@JSONField(name = "reserveStock")
private Integer occupyStock;
//可用库存
@JSONField(name = "availabelStock")
private Integer usableStock;
//在途库存
@JSONField(name = "inboundStock")
private Integer quantityTransit;
//不可用库存
@JSONField(name = "unSellStock")
private Integer quantityFreeze;
//已发货库存
@JSONField(name = "shippedStock")
private Integer shippedStock;
@JSONField(name = "lastModificationTime")
private LocalDateTime updateTime;
}
package com.bailuntec.mq.register;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
/**
* @Author: li.yanlin
* @Description:
* @Date: Created in 2021-11-18
* @Modified by:
*/
@Component
public class QueueRegister {
@Resource
private StockWmsRegisterQueueService stockWmsRegisterQueueService;
@PostConstruct
public void register(){
stockWmsRegisterQueueService
.queue("WMS_SendStockModifyToAims")
.routingKey("WMS_SendStockModifyToAims")
.registerQueue();
}
}
package com.bailuntec.mq.register;
import com.bailuntec.common.rabbitmq.listen.AbstractMessageHandler;
import com.bailuntec.common.rabbitmq.register.AbstractRegisterQueue;
import com.bailuntec.mq.handler.WmsStockMsgHandler;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @Author: li.yanlin
* @Description: 库存同步MQ消息处理服务
* @Date: Created in 2021-11-18
* @Modified by:
*/
@Service
public class StockWmsRegisterQueueService extends AbstractRegisterQueue{
@Resource
WmsStockMsgHandler wmsStockMsgHandler;
@Override
public AbstractMessageHandler messageHandler() {
return this.wmsStockMsgHandler;
}
}
spring:
application:
name: base-sync-stock-wms-mq
datasource:
url: jdbc:mysql://gz-cdb-kp7s5i79.sql.tencentcdb.com:61691/bailun_datacenter?serverTimezone=GMT%2B8&characterEncoding=utf-8&rewriteBatchedStatements=true
username: root
password: '#7kfnymAM$Y9-Ntf'
driver-class-name: com.mysql.jdbc.Driver
rabbitmq:
host: 111.230.164.154
port: 5672
username: bailun
password: 1234abcd
template:
mandatory: true
publisher-confirms: true
publisher-returns: true
queue:
isAck: true
\ No newline at end of file
spring:
application:
name: base-sync-stock-wms-mq
datasource:
url: jdbc:mysql://10.0.8.15:3306/bailun_datacenter?serverTimezone=GMT%2B8&characterEncoding=utf-8&rewriteBatchedStatements=true
username: root
password: '#7kfnymAM$Y9-Ntf'
driver-class-name: com.mysql.jdbc.Driver
rabbitmq:
host: 111.230.164.154
port: 5672
username: bailun
password: 1234abcd
template:
mandatory: true
publisher-confirms: true
publisher-returns: true
queue:
isAck: true
\ No newline at end of file
package com.bailuntec.mq;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class BaseSyncStockWmsApplicationTests {
@Test
void contextLoads() {
}
}
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>datacenter-mq</artifactId>
<groupId>com.bailuntec</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<artifactId>datacenter-base-mq</artifactId>
<version>1.0-SNAPSHOT</version>
<modules>
<module>base-sync-stock-wms</module>
</modules>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>bailuntec-datacenter</artifactId>
<groupId>com.bailuntec</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<artifactId>datacenter-mq</artifactId>
<version>1.0-SNAPSHOT</version>
<modules>
<module>datacenter-base-mq</module>
</modules>
<dependencies>
<dependency>
<groupId>com.bailuntec</groupId>
<artifactId>datacenter-domain</artifactId>
</dependency>
<dependency>
<groupId>com.bailuntec</groupId>
<artifactId>bailuntec-common</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -18,6 +18,7 @@
<module>datacenter-domain</module>
<module>datacenter-job</module>
<module>datacenter-task</module>
<module>datacenter-mq</module>
</modules>
</project>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment