Commit d96aa36c by huluobin

update

parent 4979811c
......@@ -107,8 +107,8 @@ public class EbayFinanceAdSyncJobTest {
public void testThreadPool2() {
EbayFinanceAdSyncJob ebayFinanceAdSyncJob = new EbayFinanceAdSyncJob();
LocalDateTime start = LocalDateTime.of(2020, 12, 27, 0, 0);
LocalDateTime end = LocalDateTime.of(2020, 12, 29, 0, 0);
LocalDateTime start = LocalDateTime.of(2020, 12, 29, 0, 0);
LocalDateTime end = LocalDateTime.of(2020, 12, 31, 0, 0);
List<LocalDateTime> localDateTimeList = Stream.iterate(start,
localDateTime -> localDateTime.plusDays(1))
......
......@@ -12,6 +12,10 @@
<artifactId>base-sync-stock-wms</artifactId>
<properties>
<maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
</properties>
<dependencies>
<dependency>
......@@ -54,6 +58,29 @@
</execution>
</executions>
</plugin>
<!-- docker的maven插件,官网:https://github.com/spotify/docker-maven-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.center/dc-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>
</plugins>
<resources>
......
FROM openjdk:8-jdk-alpine
VOLUME /tmp
ADD base-sync-stock-wms-1.0-SNAPSHOT.jar base-sync-stock-wms-1.0-SNAPSHOT.jar
RUN echo "Asia/Shanghai" > /etc/timezone
ENTRYPOINT ["java","-jar","/base-sync-stock-wms-1.0-SNAPSHOT.jar"]
EXPOSE 8080
......@@ -2,10 +2,14 @@ package com.bailuntec.job;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bailuntec.domain.entity.DcAutoMonitorSkuType;
import com.bailuntec.domain.entity.DcBaseStock;
import com.bailuntec.domain.entity.DcBaseWarehouse;
import com.bailuntec.domain.entity.JobPointLog;
import com.bailuntec.domain.example.DcBaseStockExample;
import com.bailuntec.domain.example.DcBaseWarehouseExample;
import com.bailuntec.domain.pojo.*;
import com.bailuntec.mapper.DcAutoMonitorSkuTypeMapper;
import com.bailuntec.mapper.DcBaseStockMapper;
import com.bailuntec.mapper.DcBaseWarehouseMapper;
import com.bailuntec.mapper.JobPointLogMapper;
......@@ -91,6 +95,9 @@ public class WmsStockJob extends PointJob {
if (items != null && items.size() > 0) {
try {
DcBaseStockMapper mapper = SessionUtil.getSession().getMapper(DcBaseStockMapper.class);
DcBaseWarehouseMapper dcBaseWarehouseMapper = SessionUtil.getSession().getMapper(DcBaseWarehouseMapper.class);
DcAutoMonitorSkuTypeMapper dcAutoMonitorSkuTypeMapper = SessionUtil.getSession().getMapper(DcAutoMonitorSkuTypeMapper.class);
DcBaseStock dcBaseStock = new DcBaseStock();
items.forEach(wmsStockItem -> {
try {
......@@ -103,6 +110,20 @@ public class WmsStockJob extends PointJob {
}
int i = mapper.updateByExampleSelective(dcBaseStock, DcBaseStockExample.newAndCreateCriteria().andBailunSkuEqualTo(dcBaseStock.getBailunSku()).andWarehouseCodeEqualTo(dcBaseStock.getWarehouseCode()).example());
if (i == 0) {
try {
DcBaseWarehouse dcBaseWarehouse = dcBaseWarehouseMapper.selectOneByExample(DcBaseWarehouseExample.newAndCreateCriteria()
.andWarehouseCodeEqualTo(dcBaseStock.getWarehouseCode())
.example());
if (dcBaseWarehouse != null) {
DcAutoMonitorSkuType dcAutoMonitorSkuType = new DcAutoMonitorSkuType();
dcAutoMonitorSkuType.setBailunSku(dcBaseStock.getBailunSku());
dcAutoMonitorSkuType.setWarehouseType(dcBaseWarehouse.getHqType());
dcAutoMonitorSkuTypeMapper.upsertSelective(dcAutoMonitorSkuType);
}
} catch (Exception ignore) {
}
mapper.insertSelective(dcBaseStock);
}
});
......
package com.bailuntec.domain.entity;
import lombok.Data;
@Data
public class DcAutoMonitorSkuType {
/**
*
* 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.mapper;
import com.bailuntec.domain.entity.DcAutoMonitorSkuType;
import com.bailuntec.domain.example.DcAutoMonitorSkuTypeExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface DcAutoMonitorSkuTypeMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
*/
long countByExample(DcAutoMonitorSkuTypeExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
*/
int deleteByExample(DcAutoMonitorSkuTypeExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
*/
int insert(DcAutoMonitorSkuType record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
*/
int insertSelective(DcAutoMonitorSkuType record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
DcAutoMonitorSkuType selectOneByExample(DcAutoMonitorSkuTypeExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
*/
List<DcAutoMonitorSkuType> selectByExample(DcAutoMonitorSkuTypeExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
*/
DcAutoMonitorSkuType selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") DcAutoMonitorSkuType record, @Param("example") DcAutoMonitorSkuTypeExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
*/
int updateByExample(@Param("record") DcAutoMonitorSkuType record, @Param("example") DcAutoMonitorSkuTypeExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(DcAutoMonitorSkuType record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
*/
int updateByPrimaryKey(DcAutoMonitorSkuType record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsert(DcAutoMonitorSkuType record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_monitor_sku_type
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsertSelective(DcAutoMonitorSkuType record);
}
\ No newline at end of file
table-name=dc_base_trans_expectarrivaltime
table-name=dc_auto_monitor_sku_type
......@@ -5,8 +5,8 @@
<configuration>
<!--<properties resource="db-tj.properties"/>-->
<properties resource="db-dev.properties"/>
<!-- <properties resource="db-prod.properties"/>-->
<!-- <properties resource="db-dev.properties"/>-->
<properties resource="db-prod.properties"/>
<settings>
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
......
......@@ -140,16 +140,7 @@ public class AutoTurnoverJob extends PointJob {
.example());
this.autoTurnoverFromStock(queryTime, dcBaseStock);
} catch (Exception e) {
//错误记录到日志表, 任务跑完了再跑一次错误SKU
try {
DcAutoExceptionMapper dcAutoExceptionMapper = SessionUtil.getSession().getMapper(DcAutoExceptionMapper.class);
DcAutoException dcAutoException = new DcAutoException(dcBaseStock.getBailunSku(), dcBaseStock.getWarehouseCode(), e.toString());
dcAutoExceptionMapper.insertSelective(dcAutoException);
} catch (Exception ex) {
log.error("保存错误SKU失败,sku=" + dcBaseStock.getBailunSku() + ",仓库=" + dcBaseStock.getWarehouseCode());
} finally {
SessionUtil.closeSession();
}
e.printStackTrace();
} finally {
SessionUtil.closeSession();
}
......
......@@ -57,7 +57,7 @@ public class AutoTurnoverJobTest {
jobPointLog.setPageSize(1000);
AutoTurnoverJob autoTurnoverJob = new AutoTurnoverJob();
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 8, "INCREMENT", new HashMap<>()), 0),
autoTurnoverJob.executeJob(new ShardingContext(new ShardingContexts("x", null, 1, "INCREMENT", new HashMap<>()), 0),
jobPointLog);
}
......
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