|
@@ -1987,6 +1987,136 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ public void getPlay() throws IOException, ParseException {
|
|
|
|
+ String todayText = dateUtil.getTodayDateText();
|
|
|
|
+ List<ProdFarmNameEntity> farmNameEntityList = prodFarmNameRepo.findAll();
|
|
|
|
+ Map<String, String> paramsMap = new HashMap<String, String>();
|
|
|
|
+ for (ProdFarmNameEntity farmNameEntity : farmNameEntityList) {
|
|
|
|
+ if (null != farmNameEntity.getErpFarmId()) {
|
|
|
|
+ System.out.println("" + farmNameEntity.getErpShortName());
|
|
|
|
+ //
|
|
|
|
+ paramsMap.put("farmID", farmNameEntity.getErpFarmId());
|
|
|
|
+ System.out.println("" + farmNameEntity.getErpFarmName() + " , " + farmNameEntity.getErpFarmId());
|
|
|
|
+ paramsMap.put("farmCode", farmNameEntity.getErpFarmId());
|
|
|
|
+ String url = apiIp + apiPort + serviceName + "/getSales2";
|
|
|
|
+ log.info("销售数据接口访问地址=" + url);
|
|
|
|
+ log.info("业务请求参数=" + paramsMap.toString());
|
|
|
|
+ log.info("开始取数=" + new Date(System.currentTimeMillis()));
|
|
|
|
+ //
|
|
|
|
+ JSONObject outJo = httpClientUtil.doGet(url, paramsMap);
|
|
|
|
+ if (outJo.getBoolean("status")) {
|
|
|
|
+ JSONObject contentJo = outJo.getJSONObject("content");
|
|
|
|
+ if (contentJo.getBoolean("success")) {
|
|
|
|
+// String data = contentJo.getString("data");
|
|
|
|
+// JSONArray dataJa = contentJo.getJSONArray("data");
|
|
|
|
+ JSONArray dataJo = contentJo.getJSONArray("data");
|
|
|
|
+ if (dataJo.size() == 0) {
|
|
|
|
+ log.info("未取到数据 。");
|
|
|
|
+ } else {
|
|
|
|
+ BigDecimal totalBg = new BigDecimal(0);
|
|
|
|
+ BigDecimal totalMoneyBg = new BigDecimal(0);
|
|
|
|
+
|
|
|
|
+ BigDecimal totalBg1 = new BigDecimal(0);
|
|
|
|
+ BigDecimal totalMoneyBg1 = new BigDecimal(0);
|
|
|
|
+
|
|
|
|
+ String todayTotal1 ="0";
|
|
|
|
+ String todaySaleMoney1="0";
|
|
|
|
+ for(int b=0;b<dataJo.size();b++) {
|
|
|
|
+ List<Object> dataList = (List<Object>)dataJo.get(b);
|
|
|
|
+ if (todayText.equals(dataList.get(2))){
|
|
|
|
+ if( dataList.get(7) != null) {
|
|
|
|
+ todayTotal1 =dataList.get(7)+"";
|
|
|
|
+ }
|
|
|
|
+ if( dataList.get(9) != null) {
|
|
|
|
+ todaySaleMoney1 = dataList.get(9)+"";
|
|
|
|
+ }
|
|
|
|
+ totalMoneyBg1 = totalMoneyBg1.add(new BigDecimal(todaySaleMoney1));
|
|
|
|
+ totalBg1 = totalBg1.add(new BigDecimal(todayTotal1));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ String todayTotal ="0";
|
|
|
|
+ String todaySaleMoney ="0";
|
|
|
|
+ if( dataList.get(7) != null) {
|
|
|
|
+ todayTotal =dataList.get(7)+"";
|
|
|
|
+ }
|
|
|
|
+ if( dataList.get(9) != null) {
|
|
|
|
+ todaySaleMoney = dataList.get(9)+"";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ totalMoneyBg = totalMoneyBg.add(new BigDecimal(todaySaleMoney));
|
|
|
|
+ totalBg = totalBg.add(new BigDecimal(todayTotal));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ProdSalesEntity salesEntity = new ProdSalesEntity();
|
|
|
|
+ salesEntity.setAddDate(DateUtil.parse(todayText, "yyyy-MM-dd"));
|
|
|
|
+ salesEntity.setFarmId(farmNameEntity.getFarmId());
|
|
|
|
+ Example<ProdSalesEntity> example = Example.of(salesEntity);
|
|
|
|
+ Optional<ProdSalesEntity> optional = salesRepo.findOne(example);
|
|
|
|
+ if(optional.isPresent()){
|
|
|
|
+ ProdSalesEntity prodSalesEntity = optional.get();
|
|
|
|
+ prodSalesEntity.setTodayQuantity(totalBg1+"");
|
|
|
|
+ prodSalesEntity.setTodayMoney(totalMoneyBg1+"");
|
|
|
|
+ salesRepo.save(prodSalesEntity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ProdSalesEntity salesEntity1 = new ProdSalesEntity();
|
|
|
|
+ salesEntity1.setAddDate(DateUtil.parse(todayText, "yyyy-MM-dd"));
|
|
|
|
+ salesEntity1.setFarmId(farmNameEntity.getFarmId());
|
|
|
|
+ Example<ProdSalesEntity> example1 = Example.of(salesEntity1);
|
|
|
|
+ Optional<ProdSalesEntity> optional1 = salesRepo.findOne(example1);
|
|
|
|
+ if(optional1.isPresent()){
|
|
|
|
+ ProdSalesEntity prodSalesEntity = optional.get();
|
|
|
|
+ prodSalesEntity.setMonthMoney(totalMoneyBg+"");
|
|
|
|
+ prodSalesEntity.setMonthQuantity(totalBg+"");
|
|
|
|
+ salesRepo.save(prodSalesEntity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// for(int a=0;a<payableList.size();a++) {
|
|
|
|
+// Object[] salesObj = (Object[]) payableList.get(a);
|
|
|
|
+//// System.out.println("salesObj.length="+salesObj.length);
|
|
|
|
+// JSONObject saleJo = new JSONObject();
|
|
|
|
+// saleJa.add(saleJo);
|
|
|
|
+// //牧场名称
|
|
|
|
+// saleJo.put("f00", salesObj[0]);
|
|
|
|
+// saleJo.put("f01", salesObj[1]);
|
|
|
|
+// saleJo.put("f02", salesObj[2]);
|
|
|
|
+// saleJo.put("f03", salesObj[3]);
|
|
|
|
+// saleJo.put("f04", salesObj[4]);
|
|
|
|
+// saleJo.put("f05", salesObj[5]);
|
|
|
|
+// saleJo.put("f06", salesObj[6]);
|
|
|
|
+// saleJo.put("f07", salesObj[7]);
|
|
|
|
+// saleJo.put("f08", salesObj[8]);
|
|
|
|
+// saleJo.put("f09", salesObj[9]);
|
|
|
|
+// saleJo.put("f10", salesObj[10]);
|
|
|
|
+// saleJo.put("f11", salesObj[11]);
|
|
|
|
+// saleJo.put("f12", salesObj[12]);
|
|
|
|
+// saleJo.put("f13", salesObj[13]);
|
|
|
|
+// saleJo.put("f14", salesObj[14]);
|
|
|
|
+// saleJo.put("f15", salesObj[15]);
|
|
|
|
+// saleJo.put("f16", salesObj[16]);
|
|
|
|
+// String saleMoney = "0";
|
|
|
|
+// if(salesObj[9] != null){
|
|
|
|
+// saleMoney = salesObj[9] + "";
|
|
|
|
+// }
|
|
|
|
+// String total = "0";
|
|
|
|
+// if(salesObj[7] != null){
|
|
|
|
+// total = salesObj[7] + "";
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
public void getManyFarmPsy() throws IOException, InterruptedException {
|
|
public void getManyFarmPsy() throws IOException, InterruptedException {
|
|
//
|
|
//
|
|
Map timeoutMap = httpClientUtil.setTimeout(connectTimeout, requestTimeout, socketTimeout);
|
|
Map timeoutMap = httpClientUtil.setTimeout(connectTimeout, requestTimeout, socketTimeout);
|