|
@@ -8,6 +8,7 @@ import com.huimv.common.result.ResultCode;
|
|
|
import com.huimv.production.datasource.dao.repo.TDeliveryRepo;
|
|
|
import com.huimv.production.datasource.service.IErpDataService;
|
|
|
import com.huimv.production.datasource.utils.DateUtils;
|
|
|
+import com.huimv.production.datasource.utils.MathUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -31,7 +32,8 @@ public class ErpDataServiceImpl implements IErpDataService {
|
|
|
private String isDemo;
|
|
|
@Autowired
|
|
|
private TDeliveryRepo tDeliveryRepo;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private MathUtil mathUtil;
|
|
|
|
|
|
/**
|
|
|
* @Method : getPsy
|
|
@@ -369,7 +371,29 @@ public class ErpDataServiceImpl implements IErpDataService {
|
|
|
System.out.println("yearMonth="+yearMonth);
|
|
|
//
|
|
|
List<Object[]> costList = tDeliveryRepo.getCostWithManyFarm(yearMonth);
|
|
|
- return new Result(ResultCode.SUCCESS,costList);
|
|
|
+ JSONArray costJa = new JSONArray();
|
|
|
+ for(int a=0;a<costList.size();a++){
|
|
|
+ Object[] costObj = (Object[]) costList.get(a);
|
|
|
+ JSONObject dataJo = new JSONObject();
|
|
|
+ costJa.add(dataJo);
|
|
|
+ //牧场名称
|
|
|
+ dataJo.put("mcmc", costObj[0]);
|
|
|
+ //基础猪群
|
|
|
+ dataJo.put("jczq", costObj[1]);
|
|
|
+ //保育猪群
|
|
|
+ dataJo.put("byzq", costObj[2]);
|
|
|
+ //育肥
|
|
|
+ dataJo.put("yf", costObj[3]);
|
|
|
+ //后备
|
|
|
+ dataJo.put("hb", costObj[4]);
|
|
|
+ //共同费用
|
|
|
+ dataJo.put("gtfy", costObj[5]);
|
|
|
+ //合计
|
|
|
+ dataJo.put("hj", costObj[6]);
|
|
|
+ //项目名称
|
|
|
+ dataJo.put("xmmc", costObj[7]);
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS,costJa);
|
|
|
}
|
|
|
/**
|
|
|
* @Method : getManyFarmStock
|
|
@@ -385,7 +409,33 @@ public class ErpDataServiceImpl implements IErpDataService {
|
|
|
public Result getManyFarmStock() {
|
|
|
//
|
|
|
List<Object[]> stockList = tDeliveryRepo.getManyFarmStock();
|
|
|
- return new Result(ResultCode.SUCCESS,stockList);
|
|
|
+ JSONArray stockJa = new JSONArray();
|
|
|
+ for(int a=0;a<stockList.size();a++){
|
|
|
+ Object[] stockObj = (Object[]) stockList.get(a);
|
|
|
+ JSONObject dataJo = new JSONObject();
|
|
|
+ stockJa.add(dataJo);
|
|
|
+ //牧场名称
|
|
|
+ dataJo.put("mcmc", stockObj[0]);
|
|
|
+ //母猪
|
|
|
+ dataJo.put("mz", stockObj[1]);
|
|
|
+ //公猪
|
|
|
+ dataJo.put("gz", stockObj[2]);
|
|
|
+ //仔猪
|
|
|
+ dataJo.put("zz", stockObj[3]);
|
|
|
+ //保育
|
|
|
+ dataJo.put("by", stockObj[4]);
|
|
|
+ //育肥
|
|
|
+ dataJo.put("yf", stockObj[5]);
|
|
|
+ //后备
|
|
|
+ dataJo.put("hb", stockObj[6]);
|
|
|
+ //妊娠
|
|
|
+ dataJo.put("rs", stockObj[7]);
|
|
|
+ //哺乳
|
|
|
+ dataJo.put("br", stockObj[8]);
|
|
|
+ //空怀
|
|
|
+ dataJo.put("kh", stockObj[9]);
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS,stockJa);
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@@ -407,8 +457,192 @@ public class ErpDataServiceImpl implements IErpDataService {
|
|
|
Date endDate = dateUtils.parseDate(endDateText);
|
|
|
//
|
|
|
List<Object[]> stockList = tDeliveryRepo.getManyFarmProduce(startDate,endDate);
|
|
|
- log.info("stockList.size>>"+stockList.size());
|
|
|
- return new Result(ResultCode.SUCCESS,stockList);
|
|
|
+ JSONArray produceJa = new JSONArray();
|
|
|
+ for(int a=0;a<stockList.size();a++){
|
|
|
+ Object[] stockObj = (Object[]) stockList.get(a);
|
|
|
+ JSONObject dataJo = new JSONObject();
|
|
|
+ produceJa.add(dataJo);
|
|
|
+ //牧场名称
|
|
|
+ dataJo.put("mcmc", stockObj[0]);
|
|
|
+ //产房成活率
|
|
|
+ dataJo.put("cfchl", stockObj[1]);
|
|
|
+ //保育成活率
|
|
|
+ dataJo.put("bychl", stockObj[2]);
|
|
|
+ //肥猪成活率
|
|
|
+ dataJo.put("fzchl", stockObj[3]);
|
|
|
+ //平均窝产仔猪
|
|
|
+ dataJo.put("pjwczz", stockObj[4]);
|
|
|
+ //平均窝产活仔数
|
|
|
+ dataJo.put("pjwchzs", stockObj[5]);
|
|
|
+ //平均窝产正常仔数
|
|
|
+ dataJo.put("pjwczczs", stockObj[6]);
|
|
|
+ //窝断奶仔猪数
|
|
|
+ dataJo.put("wdnzzs", stockObj[7]);
|
|
|
+ //平均断奶窝重
|
|
|
+ dataJo.put("pjdnwz", stockObj[8]);
|
|
|
+ //7日断配率
|
|
|
+ dataJo.put("7rdpl", stockObj[9]);
|
|
|
+ //年产窝数
|
|
|
+ dataJo.put("ncws", stockObj[10]);
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS,produceJa);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result getWarningMessage() {
|
|
|
+ //
|
|
|
+ List<Object[]> stockList = tDeliveryRepo.getWarningMessage();
|
|
|
+ JSONArray produceJa = new JSONArray();
|
|
|
+ for(int a=0;a<stockList.size();a++){
|
|
|
+ Object[] stockObj = (Object[]) stockList.get(a);
|
|
|
+ JSONObject dataJo = new JSONObject();
|
|
|
+ produceJa.add(dataJo);
|
|
|
+ //消息内容
|
|
|
+ dataJo.put("xxnr", stockObj[0]);
|
|
|
+ //提示日期
|
|
|
+ dataJo.put("tsrq", stockObj[1]);
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS,produceJa);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result getWorkPlan(String startDateText,String endDateText) {
|
|
|
+ Date startDate = dateUtils.parseDate(startDateText);
|
|
|
+ Date endDate = dateUtils.parseDate(endDateText);
|
|
|
+ //
|
|
|
+ List<Object[]> workPlanList = tDeliveryRepo.getWorkPlan(startDate,endDate);
|
|
|
+ System.out.println("workPlanList.size="+workPlanList.size());
|
|
|
+
|
|
|
+ JSONArray produceJa = new JSONArray();
|
|
|
+ for(int a=0;a<workPlanList.size();a++){
|
|
|
+ Object[] planObj = (Object[]) workPlanList.get(a);
|
|
|
+ JSONObject dataJo = new JSONObject();
|
|
|
+ produceJa.add(dataJo);
|
|
|
+ //计划名称
|
|
|
+ dataJo.put("jhmc", planObj[0]);
|
|
|
+ //计划数量
|
|
|
+ dataJo.put("jhsl", planObj[1]);
|
|
|
+ //实际数量
|
|
|
+ dataJo.put("sjsl", planObj[2]);
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS,produceJa);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result getPrepareStatusQuantity() {
|
|
|
+ //
|
|
|
+ List<Object[]> prepareStatusList = tDeliveryRepo.getPrepareStatusQuantity();
|
|
|
+ JSONArray produceJa = new JSONArray();
|
|
|
+ for(int a=0;a<prepareStatusList.size();a++){
|
|
|
+ Object[] planObj = (Object[]) prepareStatusList.get(a);
|
|
|
+ JSONObject dataJo = new JSONObject();
|
|
|
+ produceJa.add(dataJo);
|
|
|
+ //牧场名称
|
|
|
+ dataJo.put("mcmc", planObj[0]);
|
|
|
+ //待分娩
|
|
|
+ dataJo.put("dfm", planObj[1]);
|
|
|
+ //待断奶
|
|
|
+ dataJo.put("ddn", planObj[2]);
|
|
|
+ //待配种
|
|
|
+ dataJo.put("dpz", planObj[3]);
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS,produceJa);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result getPayable() {
|
|
|
+ //
|
|
|
+ List<Object[]> payableList = tDeliveryRepo.getPayable();
|
|
|
+ JSONArray produceJa = new JSONArray();
|
|
|
+ for(int a=0;a<payableList.size();a++){
|
|
|
+ Object[] planObj = (Object[]) payableList.get(a);
|
|
|
+ JSONObject dataJo = new JSONObject();
|
|
|
+ produceJa.add(dataJo);
|
|
|
+ //数据
|
|
|
+ dataJo.put("data", planObj[0]);
|
|
|
+ //名称
|
|
|
+ dataJo.put("mc", planObj[1]);
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS,produceJa);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result getSales() {
|
|
|
+ //
|
|
|
+ List<Object[]> salesList = tDeliveryRepo.getSales();
|
|
|
+ System.out.println("salesList.size="+salesList.size());
|
|
|
+ JSONArray produceJa = new JSONArray();
|
|
|
+ for(int a=0;a<salesList.size();a++){
|
|
|
+ Object[] salesObj = (Object[]) salesList.get(a);
|
|
|
+ JSONObject dataJo = new JSONObject();
|
|
|
+ produceJa.add(dataJo);
|
|
|
+ System.out.println("planObj[0].toString()="+salesObj[0]);
|
|
|
+ System.out.println("planObj[1].toString()="+salesObj[1]);
|
|
|
+ System.out.println("planObj[2].toString()="+salesObj[2]);
|
|
|
+ System.out.println("planObj[3].toString()="+salesObj[3]);
|
|
|
+ System.out.println("planObj[4].toString()="+salesObj[4]);
|
|
|
+ System.out.println("planObj[5].toString()="+salesObj[5]);
|
|
|
+ System.out.println("planObj[6].toString()="+salesObj[6]);
|
|
|
+ System.out.println("planObj[7].toString()="+salesObj[7]);
|
|
|
+ System.out.println("planObj[8].toString()="+salesObj[8]);
|
|
|
+ //今日数量
|
|
|
+// float f1 = 0;
|
|
|
+// if(salesObj[0] != null){
|
|
|
+// f1 = Float.parseFloat(salesObj[0].toString().replace(",",""));
|
|
|
+// }else{
|
|
|
+// System.out.println("==null");
|
|
|
+// }
|
|
|
+ dataJo.put("today_quantity", salesObj[0]);
|
|
|
+ //今日重量
|
|
|
+// float f2 = 0;
|
|
|
+// if(salesObj[1] != null){
|
|
|
+// f2 = Float.parseFloat(salesObj[1].toString().replace(",",""));
|
|
|
+// }
|
|
|
+ dataJo.put("today_weight", salesObj[1]);
|
|
|
+ //今日金额
|
|
|
+// float f3 = 0;
|
|
|
+// if(salesObj[2] != null){
|
|
|
+// f3 = Float.parseFloat(salesObj[2].toString().replace(",",""));
|
|
|
+// }
|
|
|
+ dataJo.put("today_money", salesObj[2]);
|
|
|
+ //本周数量
|
|
|
+// float f4 = 0;
|
|
|
+// if(salesObj[3] != null){
|
|
|
+// f4 = Float.parseFloat(salesObj[3].toString().replace(",",""));
|
|
|
+// }
|
|
|
+ dataJo.put("week_quantity", salesObj[3]);
|
|
|
+ //本周重量
|
|
|
+// float f5 = 0;
|
|
|
+// if(salesObj[4] != null){
|
|
|
+// f5 = Float.parseFloat(salesObj[4].toString().replace(",",""));
|
|
|
+// }
|
|
|
+ dataJo.put("week_weight", salesObj[4]);
|
|
|
+ //本周金额
|
|
|
+// float f6 = 0;
|
|
|
+// if(salesObj[5] != null){
|
|
|
+// f6 = Float.parseFloat(salesObj[5].toString().replace(",",""));
|
|
|
+// }
|
|
|
+ dataJo.put("week_money", salesObj[5]);
|
|
|
+ //本月数量
|
|
|
+// float f7 = 0;
|
|
|
+// if(salesObj[6] != null){
|
|
|
+// f7 = Float.parseFloat(salesObj[6].toString().replace(",",""));
|
|
|
+// }
|
|
|
+ dataJo.put("month_quantity", salesObj[6]);
|
|
|
+ //本月重量
|
|
|
+// float f8 = 0;
|
|
|
+// if(salesObj[7] != null){
|
|
|
+// f8 = Float.parseFloat(salesObj[7].toString().replace(",",""));
|
|
|
+// }
|
|
|
+ dataJo.put("month_weight", salesObj[7]);
|
|
|
+ //本月金额
|
|
|
+// float f9 = 0;
|
|
|
+// if(salesObj[8] != null){
|
|
|
+// f9 = Float.parseFloat(salesObj[8].toString().replace(",",""));
|
|
|
+// }
|
|
|
+ dataJo.put("month_money", salesObj[8]);
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS,produceJa);
|
|
|
}
|
|
|
|
|
|
}
|