Commit 302aefe3 by yinyong

半成品订单以sku维度同步

parent 4236061d
...@@ -4,10 +4,12 @@ import com.bailuntec.domain.entity.DcBaseFinancePaypal; ...@@ -4,10 +4,12 @@ import com.bailuntec.domain.entity.DcBaseFinancePaypal;
import com.bailuntec.domain.entity.DcSemiOrder; import com.bailuntec.domain.entity.DcSemiOrder;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
public class SemiOrderResultInfo { public class SemiOrderResultInfo {
private Boolean success; private Boolean success;
private ResultData<DcSemiOrder> data; private List<DcSemiOrder> data;
} }
...@@ -23,6 +23,7 @@ import java.io.IOException; ...@@ -23,6 +23,7 @@ import java.io.IOException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List;
@Slf4j @Slf4j
public class SemiOrderSyncJob extends PointJob { public class SemiOrderSyncJob extends PointJob {
...@@ -57,18 +58,14 @@ public class SemiOrderSyncJob extends PointJob { ...@@ -57,18 +58,14 @@ public class SemiOrderSyncJob extends PointJob {
if (StringUtils.isNoneBlank(palResultStr)) { if (StringUtils.isNoneBlank(palResultStr)) {
SemiOrderResultInfo palResultRoot = JSON.parseObject(palResultStr, SemiOrderResultInfo.class); SemiOrderResultInfo palResultRoot = JSON.parseObject(palResultStr, SemiOrderResultInfo.class);
if (palResultRoot != null && palResultRoot.getSuccess().booleanValue()) { if (palResultRoot != null && palResultRoot.getSuccess().booleanValue()) {
ResultData<DcSemiOrder> resultData = palResultRoot.getData(); List<DcSemiOrder> resultData = palResultRoot.getData();
if (jobPointLog.getPageIndex().equals(0)) { if (resultData != null && resultData.size() > 0) {
jobPointLog.setPageIndex(resultData.getTotalPages() + 1); for(DcSemiOrder semiOrder : resultData) {
}
if (resultData.getItems() != null && resultData.getItems().size() > 0) {
for(DcSemiOrder semiOrder : resultData.getItems()) {
semiOrder.setId(null);
DcSemiOrderMapper mapper = SessionUtil.getSession().getMapper(DcSemiOrderMapper.class); DcSemiOrderMapper mapper = SessionUtil.getSession().getMapper(DcSemiOrderMapper.class);
mapper.upsertSelective(semiOrder); mapper.upsertSelective(semiOrder);
} }
}else{
break;
} }
} else { } else {
throw new RuntimeException("调用流水接口同步百伦流水失败, 响应200, 请求参数" + map.toString()); throw new RuntimeException("调用流水接口同步百伦流水失败, 响应200, 请求参数" + map.toString());
...@@ -76,22 +73,10 @@ public class SemiOrderSyncJob extends PointJob { ...@@ -76,22 +73,10 @@ public class SemiOrderSyncJob extends PointJob {
} else { } else {
throw new RuntimeException("调用流水接口同步百伦流水失败, 响应为null, 请求参数" + map.toString()); throw new RuntimeException("调用流水接口同步百伦流水失败, 响应为null, 请求参数" + map.toString());
} }
if (jobPointLog.getPageIndex() % 10 == 0) { jobPointLog.setPageIndex(jobPointLog.getPageIndex() + 1);
try { } while (true);
JobPointLogMapper mapper = SessionUtil.getSession().getMapper(JobPointLogMapper.class);
mapper.upsertSelective(jobPointLog);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Mybatis操作DB插入任务记录失败", e);
} finally {
SessionUtil.closeSession();
}
}
jobPointLog.setPageIndex(jobPointLog.getPageIndex() - 1);
} while (0 < jobPointLog.getPageIndex());
jobPointLog.setPageIndex(0); jobPointLog.setPageIndex(0);
jobPointLog.setStartTime(jobPointLog.getEndTime()); jobPointLog.setStartTime(jobPointLog.getEndTime());
jobPointLog.setEndTime(jobPointLog.getEndTime().plusDays(jobPointLog.getIntervalTime()).isAfter(LocalDateTime.now()) ? LocalDateTime.now() : jobPointLog.getEndTime().plusDays(jobPointLog.getIntervalTime())); jobPointLog.setEndTime(jobPointLog.getEndTime().plusDays(jobPointLog.getIntervalTime()).isAfter(LocalDateTime.now()) ? LocalDateTime.now() : jobPointLog.getEndTime().plusDays(jobPointLog.getIntervalTime()));
} }
} }
SEMI_ORDER_URL=http://api.mjplan.bailuntec.com/api/applyorderlist SEMI_ORDER_URL=http://mjzz.bailuntec.com/api/ApiOrderApply
\ No newline at end of file
package com.bailuntec.domain.entity; package com.bailuntec.domain.entity;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -209,11 +208,73 @@ public class DcSemiOrder { ...@@ -209,11 +208,73 @@ public class DcSemiOrder {
/** /**
* *
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_semi_order.warehouse_id
*
* @mbg.generated
*/
private Integer warehouseId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_semi_order.last_update_date
*
* @mbg.generated
*/
private LocalDateTime lastUpdateDate;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_semi_order.sku_quantity
*
* @mbg.generated
*/
private BigDecimal skuQuantity;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_semi_order.sku_unit_cost
*
* @mbg.generated
*/
private BigDecimal skuUnitCost;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_semi_order.sku_unit_price
*
* @mbg.generated
*/
private BigDecimal skuUnitPrice;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_semi_order.sku
*
* @mbg.generated
*/
private String sku;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_semi_order.warehouse_name
*
* @mbg.generated
*/
private String warehouseName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_semi_order.semi_order_id * This field corresponds to the database column dc_semi_order.semi_order_id
* *
* @mbg.generated * @mbg.generated
*/ */
@JSONField(name = "ID")
private Integer semiOrderId; private Integer semiOrderId;
/** /**
...@@ -250,6 +311,13 @@ public class DcSemiOrder { ...@@ -250,6 +311,13 @@ public class DcSemiOrder {
sb.append(", originalQuantity=").append(originalQuantity); sb.append(", originalQuantity=").append(originalQuantity);
sb.append(", toalCostRecord=").append(toalCostRecord); sb.append(", toalCostRecord=").append(toalCostRecord);
sb.append(", toalPriceRecord=").append(toalPriceRecord); sb.append(", toalPriceRecord=").append(toalPriceRecord);
sb.append(", warehouseId=").append(warehouseId);
sb.append(", lastUpdateDate=").append(lastUpdateDate);
sb.append(", skuQuantity=").append(skuQuantity);
sb.append(", skuUnitCost=").append(skuUnitCost);
sb.append(", skuUnitPrice=").append(skuUnitPrice);
sb.append(", sku=").append(sku);
sb.append(", warehouseName=").append(warehouseName);
sb.append(", semiOrderId=").append(semiOrderId); sb.append(", semiOrderId=").append(semiOrderId);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
...@@ -295,6 +363,13 @@ public class DcSemiOrder { ...@@ -295,6 +363,13 @@ public class DcSemiOrder {
&& (this.getOriginalQuantity() == null ? other.getOriginalQuantity() == null : this.getOriginalQuantity().equals(other.getOriginalQuantity())) && (this.getOriginalQuantity() == null ? other.getOriginalQuantity() == null : this.getOriginalQuantity().equals(other.getOriginalQuantity()))
&& (this.getToalCostRecord() == null ? other.getToalCostRecord() == null : this.getToalCostRecord().equals(other.getToalCostRecord())) && (this.getToalCostRecord() == null ? other.getToalCostRecord() == null : this.getToalCostRecord().equals(other.getToalCostRecord()))
&& (this.getToalPriceRecord() == null ? other.getToalPriceRecord() == null : this.getToalPriceRecord().equals(other.getToalPriceRecord())) && (this.getToalPriceRecord() == null ? other.getToalPriceRecord() == null : this.getToalPriceRecord().equals(other.getToalPriceRecord()))
&& (this.getWarehouseId() == null ? other.getWarehouseId() == null : this.getWarehouseId().equals(other.getWarehouseId()))
&& (this.getLastUpdateDate() == null ? other.getLastUpdateDate() == null : this.getLastUpdateDate().equals(other.getLastUpdateDate()))
&& (this.getSkuQuantity() == null ? other.getSkuQuantity() == null : this.getSkuQuantity().equals(other.getSkuQuantity()))
&& (this.getSkuUnitCost() == null ? other.getSkuUnitCost() == null : this.getSkuUnitCost().equals(other.getSkuUnitCost()))
&& (this.getSkuUnitPrice() == null ? other.getSkuUnitPrice() == null : this.getSkuUnitPrice().equals(other.getSkuUnitPrice()))
&& (this.getSku() == null ? other.getSku() == null : this.getSku().equals(other.getSku()))
&& (this.getWarehouseName() == null ? other.getWarehouseName() == null : this.getWarehouseName().equals(other.getWarehouseName()))
&& (this.getSemiOrderId() == null ? other.getSemiOrderId() == null : this.getSemiOrderId().equals(other.getSemiOrderId())); && (this.getSemiOrderId() == null ? other.getSemiOrderId() == null : this.getSemiOrderId().equals(other.getSemiOrderId()));
} }
...@@ -330,6 +405,13 @@ public class DcSemiOrder { ...@@ -330,6 +405,13 @@ public class DcSemiOrder {
result = prime * result + ((getOriginalQuantity() == null) ? 0 : getOriginalQuantity().hashCode()); result = prime * result + ((getOriginalQuantity() == null) ? 0 : getOriginalQuantity().hashCode());
result = prime * result + ((getToalCostRecord() == null) ? 0 : getToalCostRecord().hashCode()); result = prime * result + ((getToalCostRecord() == null) ? 0 : getToalCostRecord().hashCode());
result = prime * result + ((getToalPriceRecord() == null) ? 0 : getToalPriceRecord().hashCode()); result = prime * result + ((getToalPriceRecord() == null) ? 0 : getToalPriceRecord().hashCode());
result = prime * result + ((getWarehouseId() == null) ? 0 : getWarehouseId().hashCode());
result = prime * result + ((getLastUpdateDate() == null) ? 0 : getLastUpdateDate().hashCode());
result = prime * result + ((getSkuQuantity() == null) ? 0 : getSkuQuantity().hashCode());
result = prime * result + ((getSkuUnitCost() == null) ? 0 : getSkuUnitCost().hashCode());
result = prime * result + ((getSkuUnitPrice() == null) ? 0 : getSkuUnitPrice().hashCode());
result = prime * result + ((getSku() == null) ? 0 : getSku().hashCode());
result = prime * result + ((getWarehouseName() == null) ? 0 : getWarehouseName().hashCode());
result = prime * result + ((getSemiOrderId() == null) ? 0 : getSemiOrderId().hashCode()); result = prime * result + ((getSemiOrderId() == null) ? 0 : getSemiOrderId().hashCode());
return result; return result;
} }
......
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