|
@@ -3,6 +3,7 @@ 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.SysRegionCounTownVillMapper;
|
|
|
import com.huimv.cattle.pojo.Overview;
|
|
|
import com.huimv.cattle.mapper.OverviewMapper;
|
|
|
import com.huimv.cattle.pojo.Stock;
|
|
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -33,6 +35,9 @@ public class OverviewServiceImpl extends ServiceImpl<OverviewMapper, Overview> i
|
|
|
|
|
|
@Autowired
|
|
|
private OverviewMapper overviewMapper;
|
|
|
+ @Autowired
|
|
|
+ private SysRegionCounTownVillMapper sysRegionCounTownVillMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public Result overList(HttpServletRequest httpServletRequest,Map<String, String> paramsMap) {
|
|
|
String farmCode = FarmCodeUtils.getFarmCode(paramsMap.get("farmCode"), httpServletRequest);
|
|
@@ -139,7 +144,9 @@ public class OverviewServiceImpl extends ServiceImpl<OverviewMapper, Overview> i
|
|
|
}
|
|
|
Overview overview = new Overview();
|
|
|
if (farmCode == null || farmCode.equals("0")){
|
|
|
- overview = overviewMapper.getListOverview();
|
|
|
+ String cityCode = sysRegionCounTownVillMapper.listSub(farmCode);
|
|
|
+ String[] city = cityCode.split(",");
|
|
|
+ overview = overviewMapper.getListOverview(city);
|
|
|
}else {
|
|
|
QueryWrapper<Overview> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("farm_code", farmCode);
|
|
@@ -175,4 +182,50 @@ public class OverviewServiceImpl extends ServiceImpl<OverviewMapper, Overview> i
|
|
|
return overview.getOutCount();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result getListOverviewVillageScreen(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
+ String farmCode =paramsMap.get("farmCode");
|
|
|
+ if (farmCode==null) {
|
|
|
+ farmCode = TokenSign.getFarmCode(httpServletRequest);
|
|
|
+ }
|
|
|
+ Overview overview = new Overview();
|
|
|
+ String cityCode ="";
|
|
|
+ String subCityCode="";
|
|
|
+ List<String> subCityList = new ArrayList<>();
|
|
|
+ if (farmCode == null || farmCode.equals("0")){
|
|
|
+ cityCode = sysRegionCounTownVillMapper.listSub(farmCode);
|
|
|
+ String[] city = cityCode.split(",");
|
|
|
+ for (String s : city) {
|
|
|
+ subCityCode = sysRegionCounTownVillMapper.listSub(s);
|
|
|
+ String[] strings = subCityCode.split(",");
|
|
|
+ for (String string : strings) {
|
|
|
+ subCityList.add(string);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String[] subCity = subCityList.toArray(new String[subCityList.size()]);
|
|
|
+ overview = overviewMapper.getListOverview(subCity);
|
|
|
+ }else {
|
|
|
+ cityCode = sysRegionCounTownVillMapper.listSub(farmCode);
|
|
|
+ String[] city = cityCode.split(",");
|
|
|
+ overview = overviewMapper.getListOverview(city);
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ if (ObjectUtil.isEmpty(overview)) {
|
|
|
+ jsonObject.put("stockCount", 0);
|
|
|
+ jsonObject.put("outCount", 0);
|
|
|
+ jsonObject.put("breedCount", 0);
|
|
|
+ jsonObject.put("farmCount", 0);
|
|
|
+ jsonObject.put("outputValue", 0);
|
|
|
+ jsonObject.put("variety", 0);
|
|
|
+ } else {
|
|
|
+ jsonObject.put("stockCount", overview.getStockCount());
|
|
|
+ jsonObject.put("outCount", overview.getOutCount());
|
|
|
+ jsonObject.put("breedCount", overview.getBreedCount());
|
|
|
+ jsonObject.put("farmCount", overview.getFarmCount());
|
|
|
+ jsonObject.put("outputValue", overview.getOutputValue());
|
|
|
+ jsonObject.put("variety", overview.getVariety());
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS,jsonObject);
|
|
|
+ }
|
|
|
}
|