Browse Source

1.数据同步模块支持 指定订单号 和 老系统盘点同步

newStockUp
zhenghaoyu 1 year ago
parent
commit
f7f5ac9583
  1. 9
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOrderClient.java
  2. 2
      blade-service-api/logpm-patch-api/src/main/java/com/logpm/patch/entity/WarehouseMappingDataEntity.java
  3. 18
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OrderClient.java
  4. 8
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.java
  5. 88
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.xml
  6. 8
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IOrderService.java
  7. 18
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/OrderServiceImpl.java
  8. 5
      blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncOrderInfoToPlatform.java
  9. 4
      blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/AsyncDataServiceImpl.java

9
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOrderClient.java

@ -44,10 +44,10 @@ public interface IOrderClient {
List<String> findOrderListByParam(@RequestParam String param);
@GetMapping(API_PREFIX + "/getTotalCountBy")
Integer getTotalCountBy(@RequestParam String param, @RequestParam Integer oldWarehouseId);
Integer getTotalCountBy(@RequestParam String param, @RequestParam Integer oldWarehouseId, @RequestParam String tableName);
@GetMapping(API_PREFIX + "/findOrderCodeListByPage")
List<String> findOrderCodeListByPage(@RequestParam String param, @RequestParam Integer oldWarehouseId, @RequestParam Integer pageNum, @RequestParam Integer pageSize);
List<String> findOrderCodeListByPage(@RequestParam String param, @RequestParam Integer oldWarehouseId, @RequestParam Integer pageNum, @RequestParam Integer pageSize, @RequestParam String tableName);
@GetMapping(API_PREFIX + "/getGoodsTypeByOrderCode")
Integer getGoodsTypeByOrderCode(@RequestParam String orderCode,@RequestParam Integer oldWarehouseId);
@ -57,4 +57,9 @@ public interface IOrderClient {
@GetMapping(API_PREFIX + "/findOrderCodeListByZero")
List<String> findOrderCodeListByZero(@RequestParam String param, @RequestParam Integer oldWarehouseId, @RequestParam Integer pageNum, @RequestParam Integer pageSize);
@GetMapping(API_PREFIX + "/getTotalCountByInventory")
Integer getTotalCountByInventory(@RequestParam String param, @RequestParam Integer oldWarehouseId);
List<String> findOrderCodeListByPageWithInventoryId(@RequestParam String param, @RequestParam Integer oldWarehouseId, @RequestParam Integer pageNum, @RequestParam Integer pageSize);
}

2
blade-service-api/logpm-patch-api/src/main/java/com/logpm/patch/entity/WarehouseMappingDataEntity.java

@ -23,4 +23,6 @@ public class WarehouseMappingDataEntity {
private Integer inventoryId;
private String tableName;
}

18
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OrderClient.java

@ -48,13 +48,13 @@ public class OrderClient implements IOrderClient {
}
@Override
public Integer getTotalCountBy(String param, Integer oldWarehouseId) {
return orderService.getTotalCountBy(param,oldWarehouseId);
public Integer getTotalCountBy(String param, Integer oldWarehouseId,String tableName) {
return orderService.getTotalCountBy(param,oldWarehouseId,tableName);
}
@Override
public List<String> findOrderCodeListByPage(String param, Integer oldWarehouseId, Integer pageNum, Integer pageSize) {
return orderService.findOrderCodeListByPage(param,oldWarehouseId,pageNum,pageSize);
public List<String> findOrderCodeListByPage(String param, Integer oldWarehouseId, Integer pageNum, Integer pageSize,String tableName) {
return orderService.findOrderCodeListByPage(param,oldWarehouseId,pageNum,pageSize,tableName);
}
@Override
@ -71,4 +71,14 @@ public class OrderClient implements IOrderClient {
public List<String> findOrderCodeListByZero(String param, Integer oldWarehouseId, Integer pageNum, Integer pageSize) {
return orderService.findOrderCodeListByZero(param,oldWarehouseId,pageNum,pageSize);
}
@Override
public Integer getTotalCountByInventory(String param, Integer oldWarehouseId) {
return orderService.getTotalCountByInventory(param,oldWarehouseId);
}
@Override
public List<String> findOrderCodeListByPageWithInventoryId(String param, Integer oldWarehouseId, Integer pageNum, Integer pageSize) {
return orderService.findOrderCodeListByPageWithInventoryId(param,oldWarehouseId,pageNum,pageSize);
}
}

8
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.java

@ -30,13 +30,17 @@ import java.util.List;
*/
public interface OrderMapper extends BaseMapper<OrderEntity> {
Integer getTotalCountBy(@Param("param") String param, @Param("oldWarehouseId") Integer oldWarehouseId);
Integer getTotalCountBy(@Param("param") String param, @Param("oldWarehouseId") Integer oldWarehouseId, @Param("tableName") String tableName);
List<String> findOrderCodeListByPage(@Param("param") String param, @Param("oldWarehouseId") Integer oldWarehouseId, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);
List<String> findOrderCodeListByPage(@Param("param") String param, @Param("oldWarehouseId") Integer oldWarehouseId, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize, @Param("tableName") String tableName);
Integer getGoodsTypeByOrderCode(@Param("orderCode") String orderCode,@Param("oldWarehouseId") Integer oldWarehouseId);
Integer getTotalCountByZero(@Param("param") String param, @Param("oldWarehouseId") Integer oldWarehouseId);
List<String> findOrderCodeListByZero(@Param("param") String param, @Param("oldWarehouseId") Integer oldWarehouseId, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);
Integer getTotalCountByInventory(@Param("param") String param, @Param("oldWarehouseId") Integer oldWarehouseId);
List<String> findOrderCodeListByPageWithInventoryId(@Param("param") String param, @Param("oldWarehouseId") Integer oldWarehouseId, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);
}

88
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.xml

@ -4,29 +4,82 @@
<select id="getTotalCountBy" resultType="Integer">
select count(t.orderSelfNum)
from ${tableName} `o`
left join (SELECT
`i`.`is_opai`,
ORDER.serviceNum service_num,
i.is_opai opai,
`i`.`latest_in_time`,
`i`.`total`,
i.STATUS AS statuses,
`i`.`orderSelfNum`,
i.create_time AS invoice_time,
`i`.`status`,
`i`.`in_num`,
`i`.`delive_num`,
`i`.`out_num`,
`i`.`sorting`,
`i`.`sign_num`,
`i`.`trans_num`,
`i`.`update_time`,
`i`.`administrators_id`,
`i`.`warehouse_id`,
`i`.`create_time`,
`i`.`finish_time`,
`i`.`type`,
`order`.`id`,
`order`.`number`,
`order`.`servicenum`,
`order`.`location_id`,
`order`.`on_shelf_type`,
`order`.`source`,
`order`.`emergency`,
`order`.`selfnumber`,
`i`.`delive_total`,
`order`.`contact`,
`order`.`phone`,
`order`.`address`,
`order`.`door`,
`order`.`payment`,
`i`.`delives_num`
FROM `ht_order_count` `i`
INNER JOIN `ht_order` `order` ON `order`.`selfnumber` = `i`.`orderSelfNum`
WHERE
`i`.`status` &lt;&gt; 11
AND `i`.`delete_time` = '0'
AND `i`.`goods_type` = '1'
AND ( ( `i`.`in_num` + `i`.`delives_num` ) > 0 )
and `i`.warehouse_id = #{oldWarehouseId}
<if test="param != null and param != ''">
AND `i`.`orderSelfNum` = #{param}
</if>
ORDER BY
`i`.`update_time` DESC) t on `o`.order_code = t.orderSelfNum
</select>
<select id="getTotalCountByInventory" resultType="int">
SELECT
count(`i`.`orderSelfNum`)
FROM
`ht_order_count` `i`
FROM `ht_order_count` `i`
INNER JOIN `ht_order` `order` ON `order`.`selfnumber` = `i`.`orderSelfNum`
WHERE
`i`.`status` &lt;&gt; 11
and `i`.`history_type` = 0
AND `i`.`delete_time` = '0'
AND ( ( `i`.`in_num` + `i`.`delives_num` ) > 0 )
AND `i`.`goods_type` = '1'
AND `i`.warehouse_id = #{oldWarehouseId}
AND ( ( `i`.`in_num` + `i`.`delives_num` ) > 0 )
and `i`.warehouse_id = #{oldWarehouseId}
<if test="param != null and param != ''">
AND `i`.`orderSelfNum` = #{param}
</if>
ORDER BY
`i`.`update_time` DESC
</select>
<select id="findOrderCodeListByPage" resultType="java.lang.String">
<select id="findOrderCodeListByPageWithInventoryId" resultType="java.lang.String">
SELECT
`i`.`orderSelfNum`
FROM
@ -46,6 +99,27 @@
`i`.`id` ASC
LIMIT #{pageNum},#{pageSize}
</select>
findOrderCodeListByPage
<select id="findOrderCodeListByPage" resultType="java.lang.String">
select t.orderSelfNum
from ${tableName} `o`
left join (SELECT
`i`.`orderSelfNum`
FROM `ht_order_count` `i`
INNER JOIN `ht_order` `order` ON `order`.`selfnumber` = `i`.`orderSelfNum`
WHERE
`i`.`status` &lt;&gt; 11
AND `i`.`delete_time` = '0'
AND `i`.`goods_type` = '1'
AND ( ( `i`.`in_num` + `i`.`delives_num` ) > 0 )
and `i`.warehouse_id = #{oldWarehouseId}
<if test="param != null and param != ''">
AND `i`.`orderSelfNum` = #{param}
</if>
ORDER BY
`i`.`id` DESC) t on `o`.order_code = t.orderSelfNum
LIMIT #{pageNum},#{pageSize}
</select>
<select id="getGoodsTypeByOrderCode" resultType="java.lang.Integer">
select goods_type

8
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IOrderService.java

@ -10,13 +10,17 @@ public interface IOrderService {
List<String> findOrderListByParam(String param);
Integer getTotalCountBy(String param, Integer oldWarehouseId);
Integer getTotalCountBy(String param, Integer oldWarehouseId,String tableName);
List<String> findOrderCodeListByPage(String param, Integer oldWarehouseId, Integer pageNum, Integer pageSize);
List<String> findOrderCodeListByPage(String param, Integer oldWarehouseId, Integer pageNum, Integer pageSize,String tableName);
Integer getGoodsTypeByOrderCode(String orderCode,Integer oldWarehouseId);
Integer getTotalCountByZero(String param, Integer oldWarehouseId);
List<String> findOrderCodeListByZero(String param, Integer oldWarehouseId, Integer pageNum, Integer pageSize);
Integer getTotalCountByInventory(String param, Integer oldWarehouseId);
List<String> findOrderCodeListByPageWithInventoryId(String param, Integer oldWarehouseId, Integer pageNum, Integer pageSize);
}

18
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/OrderServiceImpl.java

@ -35,13 +35,13 @@ public class OrderServiceImpl implements IOrderService {
}
@Override
public Integer getTotalCountBy(String param, Integer oldWarehouseId) {
return orderMapper.getTotalCountBy(param,oldWarehouseId);
public Integer getTotalCountBy(String param, Integer oldWarehouseId,String tableName) {
return orderMapper.getTotalCountBy(param,oldWarehouseId,tableName);
}
@Override
public List<String> findOrderCodeListByPage(String param, Integer oldWarehouseId, Integer pageNum, Integer pageSize) {
return orderMapper.findOrderCodeListByPage(param,oldWarehouseId,pageNum*pageSize,pageSize);
public List<String> findOrderCodeListByPage(String param, Integer oldWarehouseId, Integer pageNum, Integer pageSize,String tableName) {
return orderMapper.findOrderCodeListByPage(param,oldWarehouseId,pageNum*pageSize,pageSize,tableName);
}
@Override
@ -58,4 +58,14 @@ public class OrderServiceImpl implements IOrderService {
public List<String> findOrderCodeListByZero(String param, Integer oldWarehouseId, Integer pageNum, Integer pageSize) {
return orderMapper.findOrderCodeListByZero(param,oldWarehouseId,pageNum*pageSize,pageSize);
}
@Override
public Integer getTotalCountByInventory(String param, Integer oldWarehouseId) {
return orderMapper.getTotalCountByInventory(param,oldWarehouseId);
}
@Override
public List<String> findOrderCodeListByPageWithInventoryId(String param, Integer oldWarehouseId, Integer pageNum, Integer pageSize) {
return orderMapper.findOrderCodeListByPageWithInventoryId(param,oldWarehouseId,pageNum,pageSize);
}
}

5
blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncOrderInfoToPlatform.java

@ -78,6 +78,7 @@ public class SyncOrderInfoToPlatform {
for (WarehouseMappingDataEntity mappingDataEntity:warehouseMappingDataEntityList){
Integer oldWarehouseId = mappingDataEntity.getOldWarehouseId();//老系统仓库id
Long newWarehouseId = mappingDataEntity.getNewWarehouseId();//新系统仓库id
String tableName = mappingDataEntity.getTableName();
//查询新系统是否已有仓库信息
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(newWarehouseId);
@ -100,7 +101,7 @@ public class SyncOrderInfoToPlatform {
currentPage = one.getCurrentPage();
}else{
//查询本次同步一共多少的个订单
Integer totalNum = orderClient.getTotalCountBy(param,oldWarehouseId);
Integer totalNum = orderClient.getTotalCountBy(param,oldWarehouseId,tableName);
if(totalNum == 0){
log.info("################syncZeroOrderInfo: 暂无需要执行的数据");
return ReturnT.SUCCESS;
@ -130,7 +131,7 @@ public class SyncOrderInfoToPlatform {
for (int j = currentPage; j < totalPage; j++) {
log.info("##################syncOrderInfo: 当前同步的第{}页的数据",j+1);
try{
List<String> orderCodeList = orderClient.findOrderCodeListByPage(param,oldWarehouseId,j,pageSize);
List<String> orderCodeList = orderClient.findOrderCodeListByPage(param,oldWarehouseId,j,pageSize,tableName);
syncOrderInfoService.handleData(orderCodeList,oldWarehouseId,newWarehouseId);

4
blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/AsyncDataServiceImpl.java

@ -70,7 +70,7 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
currentPage = one.getCurrentPage();
}else{
//查询本次同步一共多少的个订单
Integer totalNum = orderClient.getTotalCountBy("",oldWarehouseId);
Integer totalNum = orderClient.getTotalCountByInventory("",oldWarehouseId);
if(totalNum == 0){
log.info("################syncOrderInfo: 暂无需要执行的数据");
throw new CustomerException(403,"暂无需要执行的数据");
@ -104,7 +104,7 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
for (int j = currentPage; j < totalPage; j++) {
log.info("##################syncOrderInfo: 当前同步的第{}页的数据",j+1);
try{
List<String> orderCodeList = orderClient.findOrderCodeListByPage("",oldWarehouseId,j,pageSize);
List<String> orderCodeList = orderClient.findOrderCodeListByPageWithInventoryId("",oldWarehouseId,j,pageSize);
syncOrderInfoService.handleDataAndInventoryId(orderCodeList,oldWarehouseId,newWarehouseId,inventoryId);

Loading…
Cancel
Save