|
@@ -2,6 +2,7 @@ package com.huimv.cattle.service.impl;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.huimv.cattle.mapper.SysRegionCounTownVillMapper;
|
|
|
import com.huimv.cattle.pojo.SalesCattle;
|
|
|
import com.huimv.cattle.mapper.SalesCattleMapper;
|
|
|
import com.huimv.cattle.service.SalesCattleService;
|
|
@@ -26,6 +27,8 @@ import java.util.List;
|
|
|
public class SalesCattleServiceImpl extends ServiceImpl<SalesCattleMapper, SalesCattle> implements SalesCattleService {
|
|
|
@Autowired
|
|
|
private SalesCattleMapper salesCattleMapper;
|
|
|
+ @Autowired
|
|
|
+ private SysRegionCounTownVillMapper sysRegionCounTownVillMapper;
|
|
|
|
|
|
@Override
|
|
|
public Result getSalesCattle(String farmCode) {
|
|
@@ -49,9 +52,36 @@ public class SalesCattleServiceImpl extends ServiceImpl<SalesCattleMapper, Sales
|
|
|
return new Result(ResultCode.SUCCESS,list);
|
|
|
}
|
|
|
@Override
|
|
|
- public Result getSalesCattleScreen() {
|
|
|
- QueryWrapper<SalesCattle> wrapper = new QueryWrapper<SalesCattle>().ne("farm_code",0).orderByDesc("year").orderByDesc("quarter").groupBy("year ").groupBy("quarter");
|
|
|
- List<SalesCattle> list = salesCattleMapper.geaAllSaleCattle(wrapper);
|
|
|
+ public Result getSalesCattleScreen(String farmCode) {
|
|
|
+ String cityCode = sysRegionCounTownVillMapper.listSub(farmCode);
|
|
|
+ String[] city = cityCode.split(",");
|
|
|
+ QueryWrapper<SalesCattle> wrapper = new QueryWrapper<SalesCattle>().orderByDesc("year").orderByDesc("quarter").groupBy("year ").groupBy("quarter");
|
|
|
+ List<SalesCattle> list = salesCattleMapper.geaAllSaleCattle(wrapper,city);
|
|
|
+ if (ObjectUtil.isEmpty(list)){
|
|
|
+ return new Result(ResultCode.SUCCESS,new ArrayList<>());
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS,list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result getSalesCattleVillageScreen(String farmCode) {
|
|
|
+ String cityCode = sysRegionCounTownVillMapper.listSub(farmCode);
|
|
|
+ String[] city = cityCode.split(",");
|
|
|
+ List<String> subCityList = new ArrayList<>();
|
|
|
+ for (String s : city) {
|
|
|
+ String subCityCode = sysRegionCounTownVillMapper.listSub(s);
|
|
|
+ String[] strings = subCityCode.split(",");
|
|
|
+ for (String string : strings) {
|
|
|
+ subCityList.add(string);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String[] subCity = subCityList.toArray(new String[subCityList.size()]);
|
|
|
+ QueryWrapper<SalesCattle> wrapper = new QueryWrapper<SalesCattle>()
|
|
|
+ .orderByDesc("year")
|
|
|
+ .orderByDesc("quarter")
|
|
|
+ .groupBy("year ")
|
|
|
+ .groupBy("quarter");
|
|
|
+ List<SalesCattle> list = salesCattleMapper.geaAllSaleCattle(wrapper,subCity);
|
|
|
if (ObjectUtil.isEmpty(list)){
|
|
|
return new Result(ResultCode.SUCCESS,new ArrayList<>());
|
|
|
}
|