|
@@ -91,6 +91,7 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
JSONObject jsonObject = template.getForObject(apiIp + apiPort + serviceName + "/getPsy?startDate=" + startDate + "&endDate=" + endDate + "&accessToken=" + token
|
|
|
, JSONObject.class);
|
|
|
String data = jsonObject.getString("data");
|
|
|
+ System.out.println("data>>"+data);
|
|
|
if (data == null) {
|
|
|
return;
|
|
|
}
|
|
@@ -420,6 +421,9 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProdProduceRepo produceRepo;
|
|
|
+
|
|
|
@Override
|
|
|
public void getManyFarmProduce() throws IOException {
|
|
|
String startDate;
|
|
@@ -465,76 +469,75 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
|
|
|
//删除旧数据
|
|
|
//删除产房成活率
|
|
|
- ProdStockEntity delStockEntity1 = new ProdStockEntity();
|
|
|
- delStockEntity1.setYear(Integer.parseInt(year));
|
|
|
- delStockEntity1.setMonth(Integer.parseInt(month));
|
|
|
- delStockEntity1.setStockType("grice_rate");
|
|
|
- Example<ProdStockEntity> example1 = Example.of(delStockEntity1);
|
|
|
-// prodStockRepo.delete(prodStockRepo.findOne(example10).get());
|
|
|
- prodStockRepo.deleteAll(prodStockRepo.findAll(example1));
|
|
|
+ ProdProduceEntity delEntity1 = new ProdProduceEntity();
|
|
|
+ delEntity1.setYear(Integer.parseInt(year));
|
|
|
+ delEntity1.setMonth(Integer.parseInt(month));
|
|
|
+ delEntity1.setStockType("grice_rate");
|
|
|
+ Example<ProdProduceEntity> example1 = Example.of(delEntity1);
|
|
|
+ produceRepo.deleteAll(produceRepo.findAll(example1));
|
|
|
//删除保育成活率
|
|
|
- ProdStockEntity delStockEntity2 = new ProdStockEntity();
|
|
|
- delStockEntity2.setYear(Integer.parseInt(year));
|
|
|
- delStockEntity2.setMonth(Integer.parseInt(month));
|
|
|
- delStockEntity2.setStockType("piglet_rate");
|
|
|
- Example<ProdStockEntity> example2 = Example.of(delStockEntity2);
|
|
|
- prodStockRepo.deleteAll(prodStockRepo.findAll(example2));
|
|
|
+ ProdProduceEntity delEntity2 = new ProdProduceEntity();
|
|
|
+ delEntity2.setYear(Integer.parseInt(year));
|
|
|
+ delEntity2.setMonth(Integer.parseInt(month));
|
|
|
+ delEntity2.setStockType("piglet_rate");
|
|
|
+ Example<ProdProduceEntity> example2 = Example.of(delEntity2);
|
|
|
+ produceRepo.deleteAll(produceRepo.findAll(example2));
|
|
|
//删除育肥成活率
|
|
|
- ProdStockEntity delStockEntity3 = new ProdStockEntity();
|
|
|
- delStockEntity3.setYear(Integer.parseInt(year));
|
|
|
- delStockEntity3.setMonth(Integer.parseInt(month));
|
|
|
- delStockEntity3.setStockType("fatpig_rate");
|
|
|
- Example<ProdStockEntity> example3 = Example.of(delStockEntity3);
|
|
|
- prodStockRepo.deleteAll(prodStockRepo.findAll(example3));
|
|
|
+ ProdProduceEntity delEntity3 = new ProdProduceEntity();
|
|
|
+ delEntity3.setYear(Integer.parseInt(year));
|
|
|
+ delEntity3.setMonth(Integer.parseInt(month));
|
|
|
+ delEntity3.setStockType("fatpig_rate");
|
|
|
+ Example<ProdProduceEntity> example3 = Example.of(delEntity3);
|
|
|
+ produceRepo.deleteAll(produceRepo.findAll(example3));
|
|
|
//删除7日内断配率
|
|
|
- ProdStockEntity delStockEntity4 = new ProdStockEntity();
|
|
|
- delStockEntity4.setYear(Integer.parseInt(year));
|
|
|
- delStockEntity4.setMonth(Integer.parseInt(month));
|
|
|
- delStockEntity4.setStockType("break_rate");
|
|
|
- Example<ProdStockEntity> example4 = Example.of(delStockEntity4);
|
|
|
- prodStockRepo.deleteAll(prodStockRepo.findAll(example4));
|
|
|
+ ProdProduceEntity delEntity4 = new ProdProduceEntity();
|
|
|
+ delEntity4.setYear(Integer.parseInt(year));
|
|
|
+ delEntity4.setMonth(Integer.parseInt(month));
|
|
|
+ delEntity4.setStockType("break_rate");
|
|
|
+ Example<ProdProduceEntity> example4 = Example.of(delEntity4);
|
|
|
+ produceRepo.deleteAll(produceRepo.findAll(example4));
|
|
|
//删除平均窝产仔猪
|
|
|
- ProdStockEntity delStockEntity5 = new ProdStockEntity();
|
|
|
- delStockEntity5.setYear(Integer.parseInt(year));
|
|
|
- delStockEntity5.setMonth(Integer.parseInt(month));
|
|
|
- delStockEntity5.setStockType("avg_farrow_1");
|
|
|
- Example<ProdStockEntity> example5 = Example.of(delStockEntity5);
|
|
|
- prodStockRepo.deleteAll(prodStockRepo.findAll(example5));
|
|
|
+ ProdProduceEntity delEntity5 = new ProdProduceEntity();
|
|
|
+ delEntity5.setYear(Integer.parseInt(year));
|
|
|
+ delEntity5.setMonth(Integer.parseInt(month));
|
|
|
+ delEntity5.setStockType("avg_farrow_1");
|
|
|
+ Example<ProdProduceEntity> example5 = Example.of(delEntity5);
|
|
|
+ produceRepo.deleteAll(produceRepo.findAll(example5));
|
|
|
//删除平均窝产活仔数
|
|
|
- ProdStockEntity delStockEntity6 = new ProdStockEntity();
|
|
|
- delStockEntity6.setYear(Integer.parseInt(year));
|
|
|
- delStockEntity6.setMonth(Integer.parseInt(month));
|
|
|
- delStockEntity6.setStockType("avg_farrow_2");
|
|
|
- Example<ProdStockEntity> example6 = Example.of(delStockEntity6);
|
|
|
- prodStockRepo.deleteAll(prodStockRepo.findAll(example6));
|
|
|
+ ProdProduceEntity delEntity6 = new ProdProduceEntity();
|
|
|
+ delEntity6.setYear(Integer.parseInt(year));
|
|
|
+ delEntity6.setMonth(Integer.parseInt(month));
|
|
|
+ delEntity6.setStockType("avg_farrow_2");
|
|
|
+ Example<ProdProduceEntity> example6 = Example.of(delEntity6);
|
|
|
+ produceRepo.deleteAll(produceRepo.findAll(example6));
|
|
|
//删除平均窝产正常仔数
|
|
|
- ProdStockEntity delStockEntity7 = new ProdStockEntity();
|
|
|
- delStockEntity7.setYear(Integer.parseInt(year));
|
|
|
- delStockEntity7.setMonth(Integer.parseInt(month));
|
|
|
- delStockEntity7.setStockType("avg_farrow_3");
|
|
|
- Example<ProdStockEntity> example7 = Example.of(delStockEntity7);
|
|
|
- prodStockRepo.deleteAll(prodStockRepo.findAll(example7));
|
|
|
+ ProdProduceEntity delEntity7 = new ProdProduceEntity();
|
|
|
+ delEntity7.setYear(Integer.parseInt(year));
|
|
|
+ delEntity7.setMonth(Integer.parseInt(month));
|
|
|
+ delEntity7.setStockType("avg_farrow_3");
|
|
|
+ Example<ProdProduceEntity> example7 = Example.of(delEntity7);
|
|
|
+ produceRepo.deleteAll(produceRepo.findAll(example7));
|
|
|
//删除窝断奶仔猪数
|
|
|
- ProdStockEntity delStockEntity8 = new ProdStockEntity();
|
|
|
- delStockEntity8.setYear(Integer.parseInt(year));
|
|
|
- delStockEntity8.setMonth(Integer.parseInt(month));
|
|
|
- delStockEntity8.setStockType("break_grice");
|
|
|
- Example<ProdStockEntity> example8 = Example.of(delStockEntity8);
|
|
|
- prodStockRepo.deleteAll(prodStockRepo.findAll(example8));
|
|
|
+ ProdProduceEntity delEntity8 = new ProdProduceEntity();
|
|
|
+ delEntity8.setYear(Integer.parseInt(year));
|
|
|
+ delEntity8.setMonth(Integer.parseInt(month));
|
|
|
+ delEntity8.setStockType("break_grice");
|
|
|
+ Example<ProdProduceEntity> example8 = Example.of(delEntity8);
|
|
|
+ produceRepo.deleteAll(produceRepo.findAll(example8));
|
|
|
//删除平均窝断奶重
|
|
|
- ProdStockEntity delStockEntity9 = new ProdStockEntity();
|
|
|
- delStockEntity9.setYear(Integer.parseInt(year));
|
|
|
- delStockEntity9.setMonth(Integer.parseInt(month));
|
|
|
- delStockEntity9.setStockType("avg_weight");
|
|
|
- Example<ProdStockEntity> example9 = Example.of(delStockEntity9);
|
|
|
- prodStockRepo.deleteAll(prodStockRepo.findAll(example9));
|
|
|
+ ProdProduceEntity delEntity9 = new ProdProduceEntity();
|
|
|
+ delEntity9.setYear(Integer.parseInt(year));
|
|
|
+ delEntity9.setMonth(Integer.parseInt(month));
|
|
|
+ delEntity9.setStockType("avg_weight");
|
|
|
+ Example<ProdProduceEntity> example9 = Example.of(delEntity9);
|
|
|
+ produceRepo.deleteAll(produceRepo.findAll(example9));
|
|
|
//删除产房成活率
|
|
|
- ProdStockEntity delStockEntity10 = new ProdStockEntity();
|
|
|
- delStockEntity10.setYear(Integer.parseInt(year));
|
|
|
- delStockEntity10.setMonth(Integer.parseInt(month));
|
|
|
- delStockEntity10.setStockType("nest_times");
|
|
|
- Example<ProdStockEntity> example10 = Example.of(delStockEntity10);
|
|
|
- prodStockRepo.deleteAll(prodStockRepo.findAll(example10));
|
|
|
+ ProdProduceEntity delEntity10 = new ProdProduceEntity();
|
|
|
+ delEntity10.setYear(Integer.parseInt(year));
|
|
|
+ delEntity10.setMonth(Integer.parseInt(month));
|
|
|
+ delEntity10.setStockType("nest_times");
|
|
|
+ Example<ProdProduceEntity> example10 = Example.of(delEntity10);
|
|
|
+ produceRepo.deleteAll(produceRepo.findAll(example10));
|
|
|
// 添加入库
|
|
|
for (int a = 0; a < dataJa.size(); a++) {
|
|
|
JSONObject dataJo = dataJa.getJSONObject(a);
|
|
@@ -547,142 +550,141 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
if (cfchl == null || cfchl.trim().length() == 0) {
|
|
|
cfchl = "0";
|
|
|
}
|
|
|
- ProdStockEntity stockEntity1 = new ProdStockEntity();
|
|
|
- stockEntity1.setFarmId(farmId);
|
|
|
- stockEntity1.setStockType("grice_rate");
|
|
|
- stockEntity1.setStockName("产房成活率");
|
|
|
- stockEntity1.setStockQuantity(mathUtil.countRate(Float.parseFloat(cfchl), 1));
|
|
|
-// stockEntity1.setRate();
|
|
|
- stockEntity1.setMonth(Integer.valueOf(month));
|
|
|
- stockEntity1.setYear(Integer.parseInt(year));
|
|
|
- prodStockRepo.saveAndFlush(stockEntity1);
|
|
|
+ ProdProduceEntity addEntity1 = new ProdProduceEntity();
|
|
|
+ addEntity1.setFarmId(farmId);
|
|
|
+ addEntity1.setStockType("grice_rate");
|
|
|
+ addEntity1.setStockName("产房成活率");
|
|
|
+ addEntity1.setStockQuantity(mathUtil.countRate(Float.parseFloat(cfchl), 1));
|
|
|
+ addEntity1.setMonth(Integer.valueOf(month));
|
|
|
+ addEntity1.setYear(Integer.parseInt(year));
|
|
|
+ produceRepo.saveAndFlush(addEntity1);
|
|
|
|
|
|
//保育成活率
|
|
|
String bychl = dataJo.getString("bychl");
|
|
|
if (bychl == null || bychl.trim().length() == 0) {
|
|
|
bychl = "0";
|
|
|
}
|
|
|
- ProdStockEntity stockEntity2 = new ProdStockEntity();
|
|
|
- stockEntity2.setFarmId(farmId);
|
|
|
- stockEntity2.setStockType("piglet_rate");
|
|
|
- stockEntity2.setStockName("保育成活率");
|
|
|
- stockEntity2.setStockQuantity(mathUtil.countRate(Float.parseFloat(bychl), 1));
|
|
|
+ ProdProduceEntity addEntity2 = new ProdProduceEntity();
|
|
|
+ addEntity2.setFarmId(farmId);
|
|
|
+ addEntity2.setStockType("piglet_rate");
|
|
|
+ addEntity2.setStockName("保育成活率");
|
|
|
+ addEntity2.setStockQuantity(mathUtil.countRate(Float.parseFloat(bychl), 1));
|
|
|
// stockEntity2.setRate();
|
|
|
- stockEntity2.setMonth(Integer.valueOf(month));
|
|
|
- stockEntity2.setYear(Integer.parseInt(year));
|
|
|
- prodStockRepo.saveAndFlush(stockEntity2);
|
|
|
+ addEntity2.setMonth(Integer.valueOf(month));
|
|
|
+ addEntity2.setYear(Integer.parseInt(year));
|
|
|
+ produceRepo.saveAndFlush(addEntity2);
|
|
|
//肥猪成活率
|
|
|
String fzchl = dataJo.getString("fzchl");
|
|
|
if (fzchl == null || fzchl.trim().length() == 0) {
|
|
|
fzchl = "0";
|
|
|
}
|
|
|
- ProdStockEntity stockEntity3 = new ProdStockEntity();
|
|
|
- stockEntity3.setFarmId(farmId);
|
|
|
- stockEntity3.setStockType("fatpig_rate");
|
|
|
- stockEntity3.setStockName("肥猪成活率");
|
|
|
- stockEntity3.setStockQuantity(mathUtil.countRate(Float.parseFloat(fzchl), 1));
|
|
|
-// stockEntity3.setRate();
|
|
|
- stockEntity3.setMonth(Integer.valueOf(month));
|
|
|
- stockEntity3.setYear(Integer.parseInt(year));
|
|
|
- prodStockRepo.saveAndFlush(stockEntity3);
|
|
|
+ ProdProduceEntity addEntity3 = new ProdProduceEntity();
|
|
|
+ addEntity3.setFarmId(farmId);
|
|
|
+ addEntity3.setStockType("fatpig_rate");
|
|
|
+ addEntity3.setStockName("肥猪成活率");
|
|
|
+ addEntity3.setStockQuantity(mathUtil.countRate(Float.parseFloat(fzchl), 1));
|
|
|
+// addEntity3.setRate();
|
|
|
+ addEntity3.setMonth(Integer.valueOf(month));
|
|
|
+ addEntity3.setYear(Integer.parseInt(year));
|
|
|
+ produceRepo.saveAndFlush(addEntity3);
|
|
|
//平均窝产仔猪
|
|
|
String pjwczz = dataJo.getString("pjwczz");
|
|
|
if (pjwczz == null || pjwczz.trim().length() == 0) {
|
|
|
pjwczz = "0";
|
|
|
}
|
|
|
- ProdStockEntity stockEntity4 = new ProdStockEntity();
|
|
|
- stockEntity4.setFarmId(farmId);
|
|
|
- stockEntity4.setStockType("avg_farrow_1");
|
|
|
- stockEntity4.setStockName("平均窝产仔猪");
|
|
|
- stockEntity4.setStockQuantity(mathUtil.countRate(Float.parseFloat(pjwczz), 1));
|
|
|
-// stockEntity4.setRate();
|
|
|
- stockEntity4.setMonth(Integer.valueOf(month));
|
|
|
- stockEntity4.setYear(Integer.parseInt(year));
|
|
|
- prodStockRepo.saveAndFlush(stockEntity4);
|
|
|
+ ProdProduceEntity addEntity4 = new ProdProduceEntity();
|
|
|
+ addEntity4.setFarmId(farmId);
|
|
|
+ addEntity4.setStockType("avg_farrow_1");
|
|
|
+ addEntity4.setStockName("平均窝产仔猪");
|
|
|
+ addEntity4.setStockQuantity(mathUtil.countRate(Float.parseFloat(pjwczz), 1));
|
|
|
+// addEntity4.setRate();
|
|
|
+ addEntity4.setMonth(Integer.valueOf(month));
|
|
|
+ addEntity4.setYear(Integer.parseInt(year));
|
|
|
+ produceRepo.saveAndFlush(addEntity4);
|
|
|
//平均窝产活仔数
|
|
|
String pjwchzs = dataJo.getString("pjwchzs");
|
|
|
if (pjwchzs == null || pjwchzs.trim().length() == 0) {
|
|
|
pjwchzs = "0";
|
|
|
}
|
|
|
- ProdStockEntity stockEntity5 = new ProdStockEntity();
|
|
|
- stockEntity5.setFarmId(farmId);
|
|
|
- stockEntity5.setStockType("avg_farrow_2");
|
|
|
- stockEntity5.setStockName("平均窝产活仔数");
|
|
|
- stockEntity5.setStockQuantity(mathUtil.countRate(Float.parseFloat(pjwchzs), 1));
|
|
|
-// stockEntity5.setRate();
|
|
|
- stockEntity5.setMonth(Integer.valueOf(month));
|
|
|
- stockEntity5.setYear(Integer.parseInt(year));
|
|
|
- prodStockRepo.saveAndFlush(stockEntity5);
|
|
|
+ ProdProduceEntity addEntity5 = new ProdProduceEntity();
|
|
|
+ addEntity5.setFarmId(farmId);
|
|
|
+ addEntity5.setStockType("avg_farrow_2");
|
|
|
+ addEntity5.setStockName("平均窝产活仔数");
|
|
|
+ addEntity5.setStockQuantity(mathUtil.countRate(Float.parseFloat(pjwchzs), 1));
|
|
|
+// addEntity5.setRate();
|
|
|
+ addEntity5.setMonth(Integer.valueOf(month));
|
|
|
+ addEntity5.setYear(Integer.parseInt(year));
|
|
|
+ produceRepo.saveAndFlush(addEntity5);
|
|
|
//平均窝产正常仔数
|
|
|
String pjwczczs = dataJo.getString("pjwczczs");
|
|
|
if (pjwczczs == null || pjwczczs.trim().length() == 0) {
|
|
|
pjwczczs = "0";
|
|
|
}
|
|
|
- ProdStockEntity stockEntity6 = new ProdStockEntity();
|
|
|
- stockEntity6.setFarmId(farmId);
|
|
|
- stockEntity6.setStockType("avg_farrow_3");
|
|
|
- stockEntity6.setStockName("平均窝产正常仔数");
|
|
|
- stockEntity6.setStockQuantity(mathUtil.countRate(Float.parseFloat(pjwczczs), 1));
|
|
|
-// stockEntity6.setRate();
|
|
|
- stockEntity6.setMonth(Integer.valueOf(month));
|
|
|
- stockEntity6.setYear(Integer.parseInt(year));
|
|
|
- prodStockRepo.saveAndFlush(stockEntity6);
|
|
|
+ ProdProduceEntity addEntity6 = new ProdProduceEntity();
|
|
|
+ addEntity6.setFarmId(farmId);
|
|
|
+ addEntity6.setStockType("avg_farrow_3");
|
|
|
+ addEntity6.setStockName("平均窝产正常仔数");
|
|
|
+ addEntity6.setStockQuantity(mathUtil.countRate(Float.parseFloat(pjwczczs), 1));
|
|
|
+// addEntity6.setRate();
|
|
|
+ addEntity6.setMonth(Integer.valueOf(month));
|
|
|
+ addEntity6.setYear(Integer.parseInt(year));
|
|
|
+ produceRepo.saveAndFlush(addEntity6);
|
|
|
//窝断奶仔猪数
|
|
|
String wdnzzs = dataJo.getString("wdnzzs");
|
|
|
if (wdnzzs == null || wdnzzs.trim().length() == 0) {
|
|
|
wdnzzs = "0";
|
|
|
}
|
|
|
- ProdStockEntity stockEntity7 = new ProdStockEntity();
|
|
|
- stockEntity7.setFarmId(farmId);
|
|
|
- stockEntity7.setStockType("break_grice");
|
|
|
- stockEntity7.setStockName("窝断奶仔猪数");
|
|
|
- stockEntity7.setStockQuantity(mathUtil.countRate(Float.parseFloat(wdnzzs), 1));
|
|
|
-// stockEntity7.setRate();
|
|
|
- stockEntity7.setMonth(Integer.valueOf(month));
|
|
|
- stockEntity7.setYear(Integer.parseInt(year));
|
|
|
- prodStockRepo.saveAndFlush(stockEntity7);
|
|
|
+ ProdProduceEntity addEntity7 = new ProdProduceEntity();
|
|
|
+ addEntity7.setFarmId(farmId);
|
|
|
+ addEntity7.setStockType("break_grice");
|
|
|
+ addEntity7.setStockName("窝断奶仔猪数");
|
|
|
+ addEntity7.setStockQuantity(mathUtil.countRate(Float.parseFloat(wdnzzs), 1));
|
|
|
+// addEntity7.setRate();
|
|
|
+ addEntity7.setMonth(Integer.valueOf(month));
|
|
|
+ addEntity7.setYear(Integer.parseInt(year));
|
|
|
+ produceRepo.saveAndFlush(addEntity7);
|
|
|
//平均断奶窝重
|
|
|
String pjdnwz = dataJo.getString("pjdnwz");
|
|
|
if (pjdnwz == null || pjdnwz.trim().length() == 0) {
|
|
|
pjdnwz = "0";
|
|
|
}
|
|
|
- ProdStockEntity stockEntity8 = new ProdStockEntity();
|
|
|
- stockEntity8.setFarmId(farmId);
|
|
|
- stockEntity8.setStockType("avg_weight");
|
|
|
- stockEntity8.setStockName("平均断奶窝重");
|
|
|
- stockEntity8.setStockQuantity(mathUtil.countRate(Float.parseFloat(pjdnwz), 1));
|
|
|
-// stockEntity8.setRate();
|
|
|
- stockEntity8.setMonth(Integer.valueOf(month));
|
|
|
- stockEntity8.setYear(Integer.parseInt(year));
|
|
|
- prodStockRepo.saveAndFlush(stockEntity8);
|
|
|
+ ProdProduceEntity addEntity8 = new ProdProduceEntity();
|
|
|
+ addEntity8.setFarmId(farmId);
|
|
|
+ addEntity8.setStockType("avg_weight");
|
|
|
+ addEntity8.setStockName("平均断奶窝重");
|
|
|
+ addEntity8.setStockQuantity(mathUtil.countRate(Float.parseFloat(pjdnwz), 1));
|
|
|
+// addEntity8.setRate();
|
|
|
+ addEntity8.setMonth(Integer.valueOf(month));
|
|
|
+ addEntity8.setYear(Integer.parseInt(year));
|
|
|
+ produceRepo.saveAndFlush(addEntity8);
|
|
|
//7日断配率
|
|
|
String dpl7r = dataJo.getString("7rdpl");
|
|
|
if (dpl7r == null || dpl7r.trim().length() == 0) {
|
|
|
dpl7r = "0";
|
|
|
}
|
|
|
- ProdStockEntity stockEntity9 = new ProdStockEntity();
|
|
|
- stockEntity9.setFarmId(farmId);
|
|
|
- stockEntity9.setStockType("break_rate");
|
|
|
- stockEntity9.setStockName("7日断配率");
|
|
|
- stockEntity9.setStockQuantity(mathUtil.countRate(Float.parseFloat(dpl7r), 1));
|
|
|
-// stockEntity9.setRate();
|
|
|
- stockEntity9.setMonth(Integer.valueOf(month));
|
|
|
- stockEntity9.setYear(Integer.parseInt(year));
|
|
|
- prodStockRepo.saveAndFlush(stockEntity9);
|
|
|
+ ProdProduceEntity addEntity9 = new ProdProduceEntity();
|
|
|
+ addEntity9.setFarmId(farmId);
|
|
|
+ addEntity9.setStockType("break_rate");
|
|
|
+ addEntity9.setStockName("7日断配率");
|
|
|
+ addEntity9.setStockQuantity(mathUtil.countRate(Float.parseFloat(dpl7r), 1));
|
|
|
+// addEntity9.setRate();
|
|
|
+ addEntity9.setMonth(Integer.valueOf(month));
|
|
|
+ addEntity9.setYear(Integer.parseInt(year));
|
|
|
+ produceRepo.saveAndFlush(addEntity9);
|
|
|
//年产窝数
|
|
|
String ncws = dataJo.getString("ncws");
|
|
|
if (ncws == null || ncws.length() == 0) {
|
|
|
ncws = "0";
|
|
|
}
|
|
|
- ProdStockEntity stockEntity10 = new ProdStockEntity();
|
|
|
- stockEntity10.setFarmId(farmId);
|
|
|
- stockEntity10.setStockType("nest_times");
|
|
|
- stockEntity10.setStockName("年产窝数");
|
|
|
- stockEntity10.setStockQuantity(mathUtil.countRate(Float.parseFloat(ncws), 1));
|
|
|
-// stockEntity10.setRate();
|
|
|
- stockEntity10.setMonth(Integer.valueOf(month));
|
|
|
- stockEntity10.setYear(Integer.parseInt(year));
|
|
|
- prodStockRepo.saveAndFlush(stockEntity10);
|
|
|
+ ProdProduceEntity addEntity10 = new ProdProduceEntity();
|
|
|
+ addEntity10.setFarmId(farmId);
|
|
|
+ addEntity10.setStockType("nest_times");
|
|
|
+ addEntity10.setStockName("年产窝数");
|
|
|
+ addEntity10.setStockQuantity(mathUtil.countRate(Float.parseFloat(ncws), 1));
|
|
|
+// addEntity10.setRate();
|
|
|
+ addEntity10.setMonth(Integer.valueOf(month));
|
|
|
+ addEntity10.setYear(Integer.parseInt(year));
|
|
|
+ produceRepo.saveAndFlush(addEntity10);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -857,7 +859,7 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
// 添加入库
|
|
|
for (int a = 0; a < dataJa.size(); a++) {
|
|
|
JSONObject dataJo = dataJa.getJSONObject(a);
|
|
|
- System.out.println((a + 1) + " " + dataJo);
|
|
|
+ //
|
|
|
int farmId = _getFarmIdByShortName(dataJo.getString("mcmc"), farmNameEntityList);
|
|
|
int mz = dataJo.getInteger("mz");
|
|
|
int gz = dataJo.getInteger("gz");
|
|
@@ -865,7 +867,6 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
int by = dataJo.getInteger("by");
|
|
|
int yf = dataJo.getInteger("yf");
|
|
|
int total = mz + gz + zz + by + yf;
|
|
|
- System.out.println("farmId=" + farmId + ",total=" + total);
|
|
|
//母猪存栏
|
|
|
ProdStockEntity stockEntity1 = new ProdStockEntity();
|
|
|
stockEntity1.setFarmId(farmId);
|
|
@@ -944,7 +945,7 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
stockEntity8.setMonth(Integer.valueOf(month));
|
|
|
stockEntity8.setYear(Integer.parseInt(year));
|
|
|
prodStockRepo.saveAndFlush(stockEntity8);
|
|
|
- //空怀
|
|
|
+ //空怀(包含返情)
|
|
|
ProdStockEntity stockEntity9 = new ProdStockEntity();
|
|
|
stockEntity9.setFarmId(farmId);
|
|
|
stockEntity9.setStockType("sow_stock_3");
|
|
@@ -953,8 +954,6 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
stockEntity9.setMonth(Integer.valueOf(month));
|
|
|
stockEntity9.setYear(Integer.parseInt(year));
|
|
|
prodStockRepo.saveAndFlush(stockEntity9);
|
|
|
- //返情
|
|
|
-
|
|
|
//后备
|
|
|
ProdStockEntity stockEntity10 = new ProdStockEntity();
|
|
|
stockEntity10.setFarmId(farmId);
|
|
@@ -1129,6 +1128,7 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
newWarningMsgEntity.setTipTime(dateUtil.formatDateTime(dataJo.getString("tsrq")));
|
|
|
newWarningMsgEntity.setFarmName(pigfarm);
|
|
|
newWarningMsgEntity.setWarningContent(message);
|
|
|
+ //
|
|
|
newWarningMsgEntity.setFarmId(_getFarmId(pigfarm, farmNameEntityList));
|
|
|
newWarningMsgEntity.setAddTime(new Timestamp(new Date().getTime()));
|
|
|
newWarningMsgEntity.setHandleState(0);
|
|
@@ -1144,12 +1144,11 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
|
|
|
//读取ERP数据中对应的名称
|
|
|
private int _getFarmId(String pigfarm, List<ProdFarmNameEntity> farmNameEntityList) {
|
|
|
- System.out.println("pigfarm=" + pigfarm);
|
|
|
//
|
|
|
int farmId = 0;
|
|
|
boolean isExist = false;
|
|
|
for (ProdFarmNameEntity prodFarmNameEntity : farmNameEntityList) {
|
|
|
- if (prodFarmNameEntity.getErpShortName() != null && prodFarmNameEntity.getErpShortName().indexOf(pigfarm) != -1) {
|
|
|
+ if (prodFarmNameEntity.getErpShortName() != null && (prodFarmNameEntity.getErpShortName().indexOf(pigfarm) != -1 || pigfarm.equalsIgnoreCase(prodFarmNameEntity.getErpWarnFarmName()))) {
|
|
|
farmId = prodFarmNameEntity.getFarmId();
|
|
|
isExist = true;
|
|
|
break;
|
|
@@ -1161,6 +1160,7 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
return farmId;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public void getWorkPlan() throws IOException, ParseException {
|
|
|
//
|
|
@@ -1230,7 +1230,7 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
paramsMap.put("accessToken", token);
|
|
|
|
|
|
String url = apiIp + apiPort + serviceName + "/getPrepareStatusQuantity";
|
|
|
- log.info("获取工作计划数据访问地址=" + url);
|
|
|
+ log.info("获取母猪和仔猪各种状态数据访问地址=" + url);
|
|
|
log.info("业务请求参数=" + paramsMap.toString());
|
|
|
log.info("开始取数=" + new Date(System.currentTimeMillis()));
|
|
|
//
|
|
@@ -1362,10 +1362,12 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
//获取牧场所有名称数据
|
|
|
for (int a = 0; a < dataJa.size(); a++) {
|
|
|
JSONObject dataJo = dataJa.getJSONObject(a);
|
|
|
+ System.out.println("dataJ>>"+dataJo);
|
|
|
ProdSalesEntity addSalesEntity = new ProdSalesEntity();
|
|
|
- addSalesEntity.setFarmName(dataJo.getString("mcmc"));
|
|
|
+ String farmName = dataJo.getString("farm_name");
|
|
|
+ addSalesEntity.setFarmName(farmName);
|
|
|
//
|
|
|
- addSalesEntity.setFarmId(_getFarmIdByShortName(dataJo.getString("mcmc"), farmNameEntityList));
|
|
|
+ addSalesEntity.setFarmId(_getFarmIdByShortName(farmName, farmNameEntityList));
|
|
|
addSalesEntity.setTodayMoney(dataJo.getString("today_money"));
|
|
|
addSalesEntity.setTodayQuantity(dataJo.getString("today_quantity"));
|
|
|
addSalesEntity.setTodayWeight(dataJo.getString("today_weight"));
|