|
@@ -3,6 +3,7 @@ package com.huimv.cattle.service.impl;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.huimv.cattle.mapper.StockMapper;
|
|
import com.huimv.cattle.mapper.StockMapper;
|
|
|
|
+import com.huimv.cattle.mapper.SysRegionCounTownVillMapper;
|
|
import com.huimv.cattle.pojo.DataSource;
|
|
import com.huimv.cattle.pojo.DataSource;
|
|
import com.huimv.cattle.pojo.StockStatus;
|
|
import com.huimv.cattle.pojo.StockStatus;
|
|
import com.huimv.cattle.mapper.StockStatusMapper;
|
|
import com.huimv.cattle.mapper.StockStatusMapper;
|
|
@@ -18,6 +19,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -35,6 +38,8 @@ public class StockStatusServiceImpl extends ServiceImpl<StockStatusMapper, Stock
|
|
private StockStatusMapper stockStatusMapper;
|
|
private StockStatusMapper stockStatusMapper;
|
|
@Resource
|
|
@Resource
|
|
private DataSourceService dataSourceService;
|
|
private DataSourceService dataSourceService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private SysRegionCounTownVillMapper sysRegionCounTownVillMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Result getStockStatus(HttpServletRequest request, Map<String, String> paramsMap) {
|
|
public Result getStockStatus(HttpServletRequest request, Map<String, String> paramsMap) {
|
|
@@ -90,9 +95,28 @@ public class StockStatusServiceImpl extends ServiceImpl<StockStatusMapper, Stock
|
|
}
|
|
}
|
|
DataSource dataSource = dataSourceService.getDataSourceStatus();
|
|
DataSource dataSource = dataSourceService.getDataSourceStatus();
|
|
StockStatus stockStatus = new StockStatus();
|
|
StockStatus stockStatus = new StockStatus();
|
|
|
|
+ List<String> subCityList = new ArrayList<>();
|
|
if (dataSource.getDsStatus() == 1 && dataSource.getViewType() ==2) {
|
|
if (dataSource.getDsStatus() == 1 && dataSource.getViewType() ==2) {
|
|
- stockStatus = stockStatusMapper.getStockStatusScreen();
|
|
|
|
- }else{
|
|
|
|
|
|
+ if (farmCode == null || farmCode.equals("0")){
|
|
|
|
+ String cityCode = sysRegionCounTownVillMapper.listSub(farmCode);
|
|
|
|
+ String[] city = cityCode.split(",");
|
|
|
|
+ stockStatus = stockStatusMapper.getStockStatusScreen(city);
|
|
|
|
+ }
|
|
|
|
+ }else if (dataSource.getDsStatus() == 1 && dataSource.getViewType() ==3){
|
|
|
|
+ if (farmCode == null || farmCode.equals("0")){
|
|
|
|
+ String cityCode = sysRegionCounTownVillMapper.listSub(farmCode);
|
|
|
|
+ String[] city = cityCode.split(",");
|
|
|
|
+ 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()]);
|
|
|
|
+ stockStatus = stockStatusMapper.getStockStatusScreen(subCity);
|
|
|
|
+ }
|
|
|
|
+ } else{
|
|
stockStatus = stockStatusMapper.getStockStatus(farmCode);
|
|
stockStatus = stockStatusMapper.getStockStatus(farmCode);
|
|
if (ObjectUtil.isEmpty(stockStatus)){
|
|
if (ObjectUtil.isEmpty(stockStatus)){
|
|
stockStatus = new StockStatus();
|
|
stockStatus = new StockStatus();
|