|
@@ -3,6 +3,8 @@ package com.huimv.production.autoGetData.service.impl;
|
|
|
import antlr.StringUtils;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.io.unit.DataUnit;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -969,6 +971,276 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void getManyFarmStock2() throws IOException {
|
|
|
+
|
|
|
+ for (int i = 9; i>=0 ;i--) {
|
|
|
+ String format = DateUtil.format( DateUtil.endOfMonth(DateUtil.offsetMonth(new Date(),-i)), "yyyy-MM-dd");
|
|
|
+ //
|
|
|
+ Map<String, String> paramsMap = new HashMap<String, String>();
|
|
|
+ paramsMap.put("endTime", format);
|
|
|
+ Map<String, Integer> timeoutMap = new HashMap<String, Integer>();
|
|
|
+ timeoutMap.put("connectTimeout", Integer.parseInt(connectTimeout));
|
|
|
+ timeoutMap.put("requestTimeout", Integer.parseInt(connectTimeout));
|
|
|
+ timeoutMap.put("socketTimeout", Integer.parseInt(connectTimeout));
|
|
|
+ String url = apiIp + apiPort + serviceName + "/getManyFarmStock2";
|
|
|
+ //
|
|
|
+ JSONObject outJo = httpClientUtil.doGet(url, paramsMap, timeoutMap);
|
|
|
+ System.out.println(outJo);
|
|
|
+ log.info("返回结果=" + outJo);
|
|
|
+ log.info("结束取数=" + new Date(System.currentTimeMillis()));
|
|
|
+ if (outJo.getBoolean("status")) {
|
|
|
+ JSONObject contentJo = outJo.getJSONObject("content");
|
|
|
+ if (contentJo.getBoolean("success")) {
|
|
|
+ JSONArray dataJa =(JSONArray) contentJo.get("data");
|
|
|
+ for(int a=0;a<dataJa.size();a++) {
|
|
|
+ List<Object> dataList = (List<Object>)dataJa.get(a);
|
|
|
+
|
|
|
+ //牧场id
|
|
|
+ ProdFarmNameEntity farmNameEntity = new ProdFarmNameEntity();
|
|
|
+ farmNameEntity.setErpFarmId( (String) dataList.get(0));
|
|
|
+ Example<ProdFarmNameEntity> example = Example.of(farmNameEntity);
|
|
|
+
|
|
|
+ Optional<ProdFarmNameEntity> one = prodFarmNameRepo.findOne(example);
|
|
|
+ if (one.isPresent()){
|
|
|
+ ProdFarmNameEntity prodFarmNameEntity=one.get();
|
|
|
+ //拿到当月数据
|
|
|
+ ProdStockEntity prodStockEntity = new ProdStockEntity();
|
|
|
+ prodStockEntity.setMonth(Integer.parseInt(format.substring(5,7)));
|
|
|
+ prodStockEntity.setYear(Integer.parseInt(format.substring(0,4)));
|
|
|
+ prodStockEntity.setFarmId(prodFarmNameEntity.getFarmId());
|
|
|
+ Example<ProdStockEntity> exampleStock = Example.of(prodStockEntity);
|
|
|
+ List<ProdStockEntity> all = prodStockRepo.findAll(exampleStock);
|
|
|
+ if (ObjectUtil.isEmpty(all)|| all.size() == 0){
|
|
|
+ ProdStockEntity prodStockEntity1 = new ProdStockEntity();
|
|
|
+ prodStockEntity1.setYear(Integer.parseInt(format.substring(0,4)));
|
|
|
+ prodStockEntity1.setFarmId(prodFarmNameEntity.getFarmId());
|
|
|
+ prodStockEntity1.setMonth(Integer.parseInt(format.substring(5,7)));
|
|
|
+ prodStockEntity1.setStockQuantity(dataList.get(2)+"");
|
|
|
+ prodStockEntity1.setStockName("母猪存栏");
|
|
|
+ prodStockEntity1.setStockType("sow_stock");
|
|
|
+ prodStockRepo.save(prodStockEntity1);
|
|
|
+
|
|
|
+ ProdStockEntity prodStockEntity2 = new ProdStockEntity();
|
|
|
+ prodStockEntity2.setYear(Integer.parseInt(format.substring(0,4)));
|
|
|
+ prodStockEntity2.setFarmId(prodFarmNameEntity.getFarmId());
|
|
|
+ prodStockEntity2.setMonth(Integer.parseInt(format.substring(5,7)));
|
|
|
+ prodStockEntity2.setStockQuantity(dataList.get(4)+"");
|
|
|
+ prodStockEntity2.setStockName("公猪存栏");
|
|
|
+ prodStockEntity2.setStockType("boar_stock");
|
|
|
+ prodStockRepo.save( prodStockEntity2);
|
|
|
+
|
|
|
+ ProdStockEntity prodStockEntity3 = new ProdStockEntity();
|
|
|
+ prodStockEntity3.setYear(Integer.parseInt(format.substring(0,4)));
|
|
|
+ prodStockEntity3.setFarmId(prodFarmNameEntity.getFarmId());
|
|
|
+ prodStockEntity3.setMonth(Integer.parseInt(format.substring(5,7)));
|
|
|
+ prodStockEntity3.setStockQuantity(dataList.get(6)+"");
|
|
|
+ prodStockEntity3.setStockName("哺乳猪存栏");
|
|
|
+ prodStockEntity3.setStockType("grice_stock");
|
|
|
+ prodStockRepo.save( prodStockEntity3);
|
|
|
+
|
|
|
+ ProdStockEntity prodStockEntity4 = new ProdStockEntity();
|
|
|
+ prodStockEntity4.setYear(Integer.parseInt(format.substring(0,4)));
|
|
|
+ prodStockEntity4.setFarmId(prodFarmNameEntity.getFarmId());
|
|
|
+ prodStockEntity4.setMonth(Integer.parseInt(format.substring(5,7)));
|
|
|
+ prodStockEntity4.setStockQuantity(dataList.get(7)+"");
|
|
|
+ prodStockEntity4.setStockName("保育猪存栏");
|
|
|
+ prodStockEntity4.setStockType("piglet_stock");
|
|
|
+ prodStockRepo.save( prodStockEntity4);
|
|
|
+
|
|
|
+ ProdStockEntity prodStockEntity5 = new ProdStockEntity();
|
|
|
+ prodStockEntity5.setYear(Integer.parseInt(format.substring(0,4)));
|
|
|
+ prodStockEntity5.setFarmId(prodFarmNameEntity.getFarmId());
|
|
|
+ prodStockEntity5.setMonth(Integer.parseInt(format.substring(5,7)));
|
|
|
+ Object o = dataList.get(8);
|
|
|
+ if (ObjectUtil.isEmpty(o)){
|
|
|
+ prodStockEntity5.setStockQuantity( "0");
|
|
|
+ }else {
|
|
|
+ prodStockEntity5.setStockQuantity( dataList.get(8)+"");
|
|
|
+ }
|
|
|
+ prodStockEntity5.setStockName("育肥猪存栏");
|
|
|
+ prodStockEntity5.setStockType("fatpig_stock");
|
|
|
+ prodStockRepo.save( prodStockEntity5);
|
|
|
+
|
|
|
+ ProdStockEntity prodStockEntity6 = new ProdStockEntity();
|
|
|
+ prodStockEntity6.setYear(Integer.parseInt(format.substring(0,4)));
|
|
|
+ prodStockEntity6.setFarmId(prodFarmNameEntity.getFarmId());
|
|
|
+ prodStockEntity6.setMonth(Integer.parseInt(format.substring(5,7)));
|
|
|
+ Object data = dataList.get(1);
|
|
|
+ if (ObjectUtil.isEmpty(data)){
|
|
|
+ prodStockEntity6.setStockQuantity( "0");
|
|
|
+ }else {
|
|
|
+ prodStockEntity6.setStockQuantity( dataList.get(1)+"");
|
|
|
+ }
|
|
|
+
|
|
|
+ prodStockEntity6.setStockName("总存栏");
|
|
|
+ prodStockEntity6.setStockType("total_stock");
|
|
|
+ prodStockRepo.save( prodStockEntity6);
|
|
|
+
|
|
|
+ ProdStockEntity prodStockEntity7 = new ProdStockEntity();
|
|
|
+ prodStockEntity7.setYear(Integer.parseInt(format.substring(0,4)));
|
|
|
+ prodStockEntity7.setFarmId(prodFarmNameEntity.getFarmId());
|
|
|
+ prodStockEntity7.setMonth(Integer.parseInt(format.substring(5,7)));
|
|
|
+ Integer muZhu = (Integer)dataList.get(3);
|
|
|
+ Integer gongZhu = (Integer)dataList.get(5);
|
|
|
+ int count1 = 0 ;
|
|
|
+ if (muZhu != null ){
|
|
|
+ count1 +=muZhu;
|
|
|
+ }
|
|
|
+ if (gongZhu != null ){
|
|
|
+ count1 +=gongZhu;
|
|
|
+ }
|
|
|
+ prodStockEntity7.setStockQuantity(count1+"");
|
|
|
+ prodStockEntity7.setStockName("后备猪存栏");
|
|
|
+ prodStockEntity7.setStockType("sow_stock_5");
|
|
|
+ prodStockRepo.save( prodStockEntity7);
|
|
|
+
|
|
|
+ ProdStockEntity prodStockEntity8 = new ProdStockEntity();
|
|
|
+ prodStockEntity8.setYear(Integer.parseInt(format.substring(0,4)));
|
|
|
+ prodStockEntity8.setFarmId(prodFarmNameEntity.getFarmId());
|
|
|
+ prodStockEntity8.setMonth(Integer.parseInt(format.substring(5,7)));
|
|
|
+ Integer zaiZhu = (Integer)dataList.get(6);
|
|
|
+ Integer baoYv = (Integer)dataList.get(7);
|
|
|
+ Integer yvFei = (Integer)dataList.get(8);
|
|
|
+ int count = 0 ;
|
|
|
+ if (zaiZhu != null ){
|
|
|
+ count +=zaiZhu;
|
|
|
+ }
|
|
|
+ if (baoYv != null ){
|
|
|
+ count +=baoYv;
|
|
|
+ }
|
|
|
+ if (yvFei != null ){
|
|
|
+ count +=yvFei;
|
|
|
+ }
|
|
|
+ prodStockEntity8.setStockQuantity(count+"");
|
|
|
+ prodStockEntity8.setStockName("商品猪");
|
|
|
+ prodStockEntity8.setStockType("business_stock");
|
|
|
+ prodStockRepo.save( prodStockEntity8);
|
|
|
+
|
|
|
+ ProdStockEntity prodStockEntity9 = new ProdStockEntity();
|
|
|
+ prodStockEntity9.setYear(Integer.parseInt(format.substring(0,4)));
|
|
|
+ prodStockEntity9.setFarmId(prodFarmNameEntity.getFarmId());
|
|
|
+ prodStockEntity9.setMonth(Integer.parseInt(format.substring(5,7)));
|
|
|
+ prodStockEntity9.setStockQuantity("0");
|
|
|
+ prodStockEntity9.setStockName("妊娠");
|
|
|
+ prodStockEntity9.setStockType("sow_stock_1");
|
|
|
+ prodStockRepo.save(prodStockEntity9);
|
|
|
+
|
|
|
+ ProdStockEntity prodStockEntity10 = new ProdStockEntity();
|
|
|
+ prodStockEntity10.setYear(Integer.parseInt(format.substring(0,4)));
|
|
|
+ prodStockEntity10.setFarmId(prodFarmNameEntity.getFarmId());
|
|
|
+ prodStockEntity10.setMonth(Integer.parseInt(format.substring(5,7)));
|
|
|
+ prodStockEntity10.setStockQuantity("0");
|
|
|
+ prodStockEntity10.setStockName("哺乳");
|
|
|
+ prodStockEntity10.setStockType("sow_stock_2");
|
|
|
+ prodStockRepo.save(prodStockEntity10);
|
|
|
+
|
|
|
+ ProdStockEntity prodStockEntity11 = new ProdStockEntity();
|
|
|
+ prodStockEntity11.setYear(Integer.parseInt(format.substring(0,4)));
|
|
|
+ prodStockEntity11.setFarmId(prodFarmNameEntity.getFarmId());
|
|
|
+ prodStockEntity11.setMonth(Integer.parseInt(format.substring(5,7)));
|
|
|
+ prodStockEntity11.setStockQuantity("0");
|
|
|
+ prodStockEntity11.setStockName("空怀");
|
|
|
+ prodStockEntity11.setStockType("sow_stock_3");
|
|
|
+ prodStockRepo.save(prodStockEntity11);
|
|
|
+ }else {
|
|
|
+ for (ProdStockEntity stockEntity : all) {
|
|
|
+ switch (stockEntity.getStockType()){
|
|
|
+ case "sow_stock":
|
|
|
+ //母猪存栏
|
|
|
+ stockEntity.setStockQuantity( dataList.get(2)+"");
|
|
|
+ prodStockRepo.save(stockEntity);
|
|
|
+ break;
|
|
|
+ case "boar_stock":
|
|
|
+ //公猪存栏
|
|
|
+ stockEntity.setStockQuantity( dataList.get(4)+"");
|
|
|
+ prodStockRepo.save(stockEntity);
|
|
|
+ break;
|
|
|
+ case "grice_stock":
|
|
|
+ //哺乳猪存栏
|
|
|
+ stockEntity.setStockQuantity( dataList.get(6)+"");
|
|
|
+ prodStockRepo.save(stockEntity);
|
|
|
+ break;
|
|
|
+ case "piglet_stock":
|
|
|
+ //保育猪存栏
|
|
|
+ stockEntity.setStockQuantity( dataList.get(7)+"");
|
|
|
+ prodStockRepo.save(stockEntity);
|
|
|
+ break;
|
|
|
+ case "fatpig_stock":
|
|
|
+ //育肥猪存栏
|
|
|
+ Object o = dataList.get(8);
|
|
|
+ if (ObjectUtil.isEmpty(o)){
|
|
|
+ stockEntity.setStockQuantity( "0");
|
|
|
+ }else {
|
|
|
+ stockEntity.setStockQuantity( dataList.get(8)+"");
|
|
|
+ }
|
|
|
+ prodStockRepo.save(stockEntity);
|
|
|
+ break;
|
|
|
+ case "total_stock":
|
|
|
+ //总存栏
|
|
|
+ Object data = dataList.get(1);
|
|
|
+ if (ObjectUtil.isEmpty(data)){
|
|
|
+ stockEntity.setStockQuantity( "0");
|
|
|
+ }else {
|
|
|
+ stockEntity.setStockQuantity( dataList.get(1)+"");
|
|
|
+ }
|
|
|
+
|
|
|
+ prodStockRepo.save(stockEntity);
|
|
|
+ break;
|
|
|
+ case "sow_stock_5":
|
|
|
+ //后备猪存栏
|
|
|
+ Integer muZhu = (Integer)dataList.get(3);
|
|
|
+ Integer gongZhu = (Integer)dataList.get(5);
|
|
|
+ int count1 = 0 ;
|
|
|
+ if (muZhu != null ){
|
|
|
+ count1 +=muZhu;
|
|
|
+ }
|
|
|
+ if (gongZhu != null ){
|
|
|
+ count1 +=gongZhu;
|
|
|
+ }
|
|
|
+
|
|
|
+ stockEntity.setStockQuantity( count1+"");
|
|
|
+ prodStockRepo.save(stockEntity);
|
|
|
+ break;
|
|
|
+ case "business_stock":
|
|
|
+ //商品猪
|
|
|
+ Integer zaiZhu = (Integer)dataList.get(6);
|
|
|
+ Integer baoYv = (Integer)dataList.get(7);
|
|
|
+ Integer yvFei = (Integer)dataList.get(8);
|
|
|
+ int count = 0 ;
|
|
|
+ if (zaiZhu != null ){
|
|
|
+ count +=zaiZhu;
|
|
|
+ }
|
|
|
+ if (baoYv != null ){
|
|
|
+ count +=baoYv;
|
|
|
+ }
|
|
|
+ if (yvFei != null ){
|
|
|
+ count +=yvFei;
|
|
|
+ }
|
|
|
+
|
|
|
+ stockEntity.setStockQuantity(count+"");
|
|
|
+ prodStockRepo.save(stockEntity);
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
public void getManyFarmStock() throws IOException {
|
|
|
String year = dateUtil.getThisYear();
|
|
|
String month = dateUtil.getThisMonth();
|
|
@@ -1988,8 +2260,7 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
|
|
|
@Override
|
|
|
public void getPlay() throws IOException, ParseException {
|
|
|
- String todayText = "2022-08-01";/*dateUtil.getTodayDateText();*/
|
|
|
- System.out.println(todayText);
|
|
|
+
|
|
|
List<ProdFarmNameEntity> farmNameEntityList = prodFarmNameRepo.findAll();
|
|
|
Map<String, String> paramsMap = new HashMap<String, String>();
|
|
|
for (ProdFarmNameEntity farmNameEntity : farmNameEntityList) {
|
|
@@ -2014,83 +2285,69 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
if (dataJo.size() == 0) {
|
|
|
log.info("未取到数据 。");
|
|
|
} else {
|
|
|
- BigDecimal totalBg = new BigDecimal(0);
|
|
|
- BigDecimal totalMoneyBg = new BigDecimal(0);
|
|
|
+ for(int a=0;a<dataJo.size();a++) {
|
|
|
+ List<Object> dataList1 = (List<Object>)dataJo.get(a);
|
|
|
+ String todayText = (String) dataList1.get(2);
|
|
|
+ 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));
|
|
|
+ }
|
|
|
|
|
|
- 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);
|
|
|
- System.out.println(dataList);
|
|
|
- if (todayText.equals(dataList.get(2))){
|
|
|
+ String todayTotal ="0";
|
|
|
+ String todaySaleMoney ="0";
|
|
|
if( dataList.get(7) != null) {
|
|
|
- todayTotal1 =dataList.get(7)+"";
|
|
|
+ todayTotal =dataList.get(7)+"";
|
|
|
}
|
|
|
if( dataList.get(9) != null) {
|
|
|
- todaySaleMoney1 = dataList.get(9)+"";
|
|
|
+ todaySaleMoney = 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));
|
|
|
}
|
|
|
|
|
|
- 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);
|
|
|
- }else {
|
|
|
- ProdSalesEntity prodSalesEntity = new ProdSalesEntity();
|
|
|
- prodSalesEntity.setTodayQuantity(totalBg1+"");
|
|
|
- prodSalesEntity.setTodayMoney(totalMoneyBg1+"");
|
|
|
- prodSalesEntity.setFarmId(farmNameEntity.getFarmId());
|
|
|
- prodSalesEntity.setFarmName(farmNameEntity.getFarmName());
|
|
|
- prodSalesEntity.setAddDate(DateUtil.parse(todayText, "yyyy-MM-dd"));
|
|
|
- salesRepo.save(prodSalesEntity);
|
|
|
- }
|
|
|
-
|
|
|
+ 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+"");
|
|
|
+ prodSalesEntity.setMonthMoney(totalMoneyBg+"");
|
|
|
+ prodSalesEntity.setMonthQuantity(totalBg+"");
|
|
|
+ salesRepo.save(prodSalesEntity);
|
|
|
+ }else {
|
|
|
+ ProdSalesEntity prodSalesEntity = new ProdSalesEntity();
|
|
|
+ prodSalesEntity.setTodayQuantity(totalBg1+"");
|
|
|
+ prodSalesEntity.setTodayMoney(totalMoneyBg1+"");
|
|
|
+ prodSalesEntity.setMonthMoney(totalMoneyBg+"");
|
|
|
+ prodSalesEntity.setMonthQuantity(totalBg+"");
|
|
|
+ prodSalesEntity.setFarmName(farmNameEntity.getFarmName());
|
|
|
+ prodSalesEntity.setFarmId(farmNameEntity.getFarmId());
|
|
|
+ prodSalesEntity.setAddDate(DateUtil.parse(todayText,"yyyy-MM-dd"));
|
|
|
+ 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 = optional1.get();
|
|
|
- prodSalesEntity.setMonthMoney(totalMoneyBg+"");
|
|
|
- prodSalesEntity.setMonthQuantity(totalBg+"");
|
|
|
- salesRepo.save(prodSalesEntity);
|
|
|
- }else {
|
|
|
- ProdSalesEntity prodSalesEntity = new ProdSalesEntity();
|
|
|
- prodSalesEntity.setMonthMoney(totalMoneyBg+"");
|
|
|
- prodSalesEntity.setMonthQuantity(totalBg+"");
|
|
|
- prodSalesEntity.setFarmId(farmNameEntity.getFarmId());
|
|
|
- prodSalesEntity.setFarmName(farmNameEntity.getFarmName());
|
|
|
- prodSalesEntity.setAddDate(DateUtil.parse(todayText, "yyyy-MM-dd"));
|
|
|
- salesRepo.save(prodSalesEntity);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -2381,7 +2638,6 @@ public class AutoGetErpDataImpl implements IAutoGetErpData {
|
|
|
newJo.put("year", year);
|
|
|
newJo.put("farm_id", farmNameEntity.getFarmId());
|
|
|
newJo.put("farm_name", farmNameEntity.getFarmName());
|
|
|
- System.out.println("farmName="+farmNameEntity.getFarmName()+","+dataJo.getString("parturition_rate"));
|
|
|
}
|
|
|
}
|
|
|
}
|