|
@@ -3,7 +3,10 @@ package com.huimv.cattle.service.impl;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.huimv.cattle.mapper.IndustryOutputMapper;
|
|
|
+import com.huimv.cattle.mapper.StockMapper;
|
|
|
import com.huimv.cattle.mapper.SysRegionCounTownVillMapper;
|
|
|
+import com.huimv.cattle.pojo.IndustryOutput;
|
|
|
import com.huimv.cattle.pojo.Overview;
|
|
|
import com.huimv.cattle.mapper.OverviewMapper;
|
|
|
import com.huimv.cattle.pojo.Stock;
|
|
@@ -37,6 +40,10 @@ public class OverviewServiceImpl extends ServiceImpl<OverviewMapper, Overview> i
|
|
|
private OverviewMapper overviewMapper;
|
|
|
@Autowired
|
|
|
private SysRegionCounTownVillMapper sysRegionCounTownVillMapper;
|
|
|
+ @Autowired
|
|
|
+ private StockMapper stockMapper;
|
|
|
+ @Autowired
|
|
|
+ private IndustryOutputMapper industryOutputMapper;
|
|
|
|
|
|
@Override
|
|
|
public Result overList(HttpServletRequest httpServletRequest,Map<String, String> paramsMap) {
|
|
@@ -47,6 +54,7 @@ public class OverviewServiceImpl extends ServiceImpl<OverviewMapper, Overview> i
|
|
|
int breedCount=0;
|
|
|
int farmCount=0;
|
|
|
int outputValue=0;
|
|
|
+ int allMoney =0;
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (overviews.size()==0) {
|
|
|
jsonObject.put("stockCount", 0);
|
|
@@ -63,11 +71,16 @@ public class OverviewServiceImpl extends ServiceImpl<OverviewMapper, Overview> i
|
|
|
farmCount = farmCount + overviews.get(i).getFarmCount();
|
|
|
outputValue=outputValue+overviews.get(i).getOutputValue().intValue();
|
|
|
}
|
|
|
- jsonObject.put("stockCount", stockCount);
|
|
|
+ Stock stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("farm_code", "0"));
|
|
|
+ List<IndustryOutput> money = industryOutputMapper.selectList(new QueryWrapper<IndustryOutput>().eq("farm_code", "0"));
|
|
|
+ for (IndustryOutput industryOutput : money) {
|
|
|
+ allMoney +=industryOutput.getSalesMoney().intValue();
|
|
|
+ }
|
|
|
+ jsonObject.put("stockCount", stock.getFatStock()+stock.getCowStock()+stock.getBullStock());
|
|
|
jsonObject.put("outCount", outCount);
|
|
|
- jsonObject.put("breedCount", breedCount);
|
|
|
+ jsonObject.put("breedCount", stock.getBullStock());
|
|
|
jsonObject.put("farmCount",farmCount);
|
|
|
- jsonObject.put("outputValue", outputValue);
|
|
|
+ jsonObject.put("outputValue", allMoney);
|
|
|
jsonObject.put("variety",overviews.get(0).getVariety());
|
|
|
}
|
|
|
return new Result(ResultCode.SUCCESS,jsonObject);
|
|
@@ -143,14 +156,26 @@ public class OverviewServiceImpl extends ServiceImpl<OverviewMapper, Overview> i
|
|
|
farmCode = TokenSign.getFarmCode(httpServletRequest);
|
|
|
}
|
|
|
Overview overview = new Overview();
|
|
|
+ Stock stock = new Stock();
|
|
|
+ Integer allMoney=0;
|
|
|
if (farmCode == null || farmCode.equals("0")){
|
|
|
String cityCode = sysRegionCounTownVillMapper.listSub(farmCode);
|
|
|
String[] city = cityCode.split(",");
|
|
|
overview = overviewMapper.getListOverview(city);
|
|
|
+ stock = stockMapper.getListStock(city);
|
|
|
+ List<IndustryOutput> industryOutputs = industryOutputMapper.getIndustryOutputScreen(city);
|
|
|
+ for (IndustryOutput industryOutput : industryOutputs) {
|
|
|
+ allMoney += industryOutput.getSalesMoney().intValue();
|
|
|
+ }
|
|
|
}else {
|
|
|
QueryWrapper<Overview> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("farm_code", farmCode);
|
|
|
overview = overviewMapper.selectOne(queryWrapper);
|
|
|
+ stock = stockMapper.selectOne(new QueryWrapper<Stock>().eq("farm_code",farmCode));
|
|
|
+ List<IndustryOutput> industryOutputs = industryOutputMapper.selectList(new QueryWrapper<IndustryOutput>().eq("farm_code", farmCode));
|
|
|
+ for (IndustryOutput industryOutput : industryOutputs) {
|
|
|
+ allMoney += industryOutput.getSalesMoney().intValue();
|
|
|
+ }
|
|
|
}
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (ObjectUtil.isEmpty(overview)) {
|
|
@@ -161,11 +186,11 @@ public class OverviewServiceImpl extends ServiceImpl<OverviewMapper, Overview> i
|
|
|
jsonObject.put("outputValue", 0);
|
|
|
jsonObject.put("variety", 0);
|
|
|
} else {
|
|
|
- jsonObject.put("stockCount", overview.getStockCount());
|
|
|
+ jsonObject.put("stockCount", stock.getFatStock()+stock.getBullStock()+stock.getCowStock());
|
|
|
jsonObject.put("outCount", overview.getOutCount());
|
|
|
- jsonObject.put("breedCount", overview.getBreedCount());
|
|
|
+ jsonObject.put("breedCount", stock.getBullStock());
|
|
|
jsonObject.put("farmCount", overview.getFarmCount());
|
|
|
- jsonObject.put("outputValue", overview.getOutputValue());
|
|
|
+ jsonObject.put("outputValue", allMoney);
|
|
|
jsonObject.put("variety", overview.getVariety());
|
|
|
}
|
|
|
return new Result(ResultCode.SUCCESS,jsonObject);
|
|
@@ -190,8 +215,10 @@ public class OverviewServiceImpl extends ServiceImpl<OverviewMapper, Overview> i
|
|
|
farmCode = TokenSign.getFarmCode(httpServletRequest);
|
|
|
}
|
|
|
Overview overview = new Overview();
|
|
|
+ Stock stock = new Stock();
|
|
|
String cityCode ="";
|
|
|
String subCityCode="";
|
|
|
+ Integer allMoney =0;
|
|
|
List<String> subCityList = new ArrayList<>();
|
|
|
if (farmCode == null || farmCode.equals("0")){
|
|
|
cityCode = sysRegionCounTownVillMapper.listSub(farmCode);
|
|
@@ -205,11 +232,22 @@ public class OverviewServiceImpl extends ServiceImpl<OverviewMapper, Overview> i
|
|
|
}
|
|
|
String[] subCity = subCityList.toArray(new String[subCityList.size()]);
|
|
|
overview = overviewMapper.getListOverview(subCity);
|
|
|
+ stock = stockMapper.getListStock(subCity);
|
|
|
+ List<IndustryOutput> industryOutputScreen = industryOutputMapper.getIndustryOutputScreen(subCity);
|
|
|
+ for (IndustryOutput industryOutput : industryOutputScreen) {
|
|
|
+ allMoney +=industryOutput.getSalesMoney().intValue();
|
|
|
+ }
|
|
|
}else {
|
|
|
cityCode = sysRegionCounTownVillMapper.listSub(farmCode);
|
|
|
String[] city = cityCode.split(",");
|
|
|
overview = overviewMapper.getListOverview(city);
|
|
|
+ stock = stockMapper.getListStock(city);
|
|
|
+ List<IndustryOutput> industryOutputScreen = industryOutputMapper.getIndustryOutputScreen(city);
|
|
|
+ for (IndustryOutput industryOutput : industryOutputScreen) {
|
|
|
+ allMoney +=industryOutput.getSalesMoney().intValue();
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (ObjectUtil.isEmpty(overview)) {
|
|
|
jsonObject.put("stockCount", 0);
|
|
@@ -219,11 +257,11 @@ public class OverviewServiceImpl extends ServiceImpl<OverviewMapper, Overview> i
|
|
|
jsonObject.put("outputValue", 0);
|
|
|
jsonObject.put("variety", 0);
|
|
|
} else {
|
|
|
- jsonObject.put("stockCount", overview.getStockCount());
|
|
|
+ jsonObject.put("stockCount", stock.getFatStock()+stock.getBullStock()+stock.getCowStock());
|
|
|
jsonObject.put("outCount", overview.getOutCount());
|
|
|
- jsonObject.put("breedCount", overview.getBreedCount());
|
|
|
+ jsonObject.put("breedCount", stock.getBullStock());
|
|
|
jsonObject.put("farmCount", overview.getFarmCount());
|
|
|
- jsonObject.put("outputValue", overview.getOutputValue());
|
|
|
+ jsonObject.put("outputValue", allMoney);
|
|
|
jsonObject.put("variety", overview.getVariety());
|
|
|
}
|
|
|
return new Result(ResultCode.SUCCESS,jsonObject);
|