Commit c3aba19e by huluobin

# 更新

parent 302bb61d
......@@ -27,6 +27,7 @@ import java.util.List;
public class PurchaseDetailsServiceImpl {
private static PropertiesUtil propertiesUtil = PropertiesUtil.getInstance("const");
private static OkHttpClient client = OkHttpUtil.getInstance();
public static void syncPurchaseDetails(JobPointLog jobPointLog) {
MediaType mediaType = MediaType.parse("application/json");
LinkedHashMap<String, Object> map = new LinkedHashMap<>(3);
......@@ -35,7 +36,7 @@ public class PurchaseDetailsServiceImpl {
map.put("type", jobPointLog.getType());
map.put("pagesize", jobPointLog.getPageSize());
do {
map.put("page", jobPointLog.getPageIndex() > 0? jobPointLog.getPageIndex() : 1);
map.put("page", jobPointLog.getPageIndex() > 0 ? jobPointLog.getPageIndex() : 1);
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(map));
String purchaseStr = null;
Response response = null;
......@@ -90,7 +91,7 @@ public class PurchaseDetailsServiceImpl {
if (dcBasePurchaseSelected != null && dcBasePurchaseSelected.getParentId() <= dcBasePurchase.getParentId()) {
dcBasePurchase.setId(dcBasePurchaseSelected.getId());
mapper1.updateByPrimaryKeySelective(dcBasePurchase);
} else if (dcBasePurchaseSelected == null){
} else if (dcBasePurchaseSelected == null) {
mapper1.insertSelective(dcBasePurchase);
}
SessionUtil.getSession().commit();
......@@ -145,8 +146,7 @@ public class PurchaseDetailsServiceImpl {
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("MYbatis操作DB失败", e);
}
finally {
} finally {
SessionUtil.closeSession();
}
}
......@@ -201,10 +201,10 @@ public class PurchaseDetailsServiceImpl {
break;
}
}
} else{
} else {
throw new RuntimeException("调用采购单sku流水接口失败");
}
} else{
} else {
throw new RuntimeException("调用采购单sku流水接口失败");
}
jobPointLog.setPageIndex(jobPointLog.getPageIndex() - 1);
......
#PURCHASE_DETAILS_URL=http://purchase.bailuntec.com/Api/GetPurchaseSkuForDataCenter
PURCHASE_DETAILS_URL=http://10.0.6.15:3333/Api/GetPurchaseSkuForDataCenter
PURCHASE_DETAILS_URL=http://purchase.bailuntec.com/Api/GetPurchaseSkuForDataCenter
#PURCHASE_DETAILS_URL=http://10.0.6.15:3333/Api/GetPurchaseSkuForDataCenter
import com.bailuntec.domain.entity.JobPointLog;
import com.bailuntec.job.PurchaseDetailsServiceImpl;
import org.junit.jupiter.api.Test;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class SyncPurchaseTest {
public static void main(String[] args) {
@Test
public void test() {
JobPointLog jobPointLog = new JobPointLog();
jobPointLog.setType(3);
jobPointLog.setStartTime(LocalDateTime.parse("2019-02-21 16:50:14", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
jobPointLog.setEndTime(LocalDateTime.parse("2019-02-21 16:50:15", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
jobPointLog.setStartTime(LocalDateTime.parse("2020-12-11 20:50:10", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
jobPointLog.setEndTime(LocalDateTime.parse("2020-12-14 20:50:57", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
jobPointLog.setPageSize(1000);
jobPointLog.setPageIndex(1);
jobPointLog.setIntervalTime(1);
PurchaseDetailsServiceImpl.syncPurchaseDetails(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