@@ -2,6 +2,7 @@ package com.taauav.admin.service; | |||
import com.taauav.admin.dto.TauvDriverDTO; | |||
import com.taauav.admin.query.TauvDriverQuery; | |||
import com.taauav.admin.vo.TauvDriverVo; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.TauvDriver; | |||
import com.taauav.common.service.IBaseService; | |||
@@ -97,8 +98,8 @@ public interface ITauvDriverService extends IBaseService<TauvDriver> { | |||
List<TauvDriverDTO> getDriverListByCityId(BigInteger cityId); | |||
/** | |||
* 获取所有区级河道及坐标点 | |||
* 获取南京区级河湖缓存数据 | |||
* @return | |||
*/ | |||
Response getAllDriverList(); | |||
List<TauvDriverVo> getDriverCacheList(); | |||
} |
@@ -53,17 +53,17 @@ public class SysCityServiceImpl extends ServiceImpl<SysCityMapper, SysCity> impl | |||
public Response getList() { | |||
// 查询条件 | |||
QueryWrapper<SysCity> queryWrapper = new QueryWrapper<>(); | |||
queryWrapper.eq("id", BigInteger.valueOf(320117)); | |||
queryWrapper.eq("id", BigInteger.valueOf(3201)); | |||
queryWrapper.eq("mark", 1); | |||
queryWrapper.orderByAsc("sort"); | |||
// 查询条件 | |||
SysCity cityInfo = sysCityMapper.selectById(BigInteger.valueOf(320117)); | |||
SysCity cityInfo = sysCityMapper.selectById(BigInteger.valueOf(3201)); | |||
SysCityListVo cityListVo = new SysCityListVo(); | |||
// 拷贝属性 | |||
BeanUtils.copyProperties(cityInfo, cityListVo); | |||
// 获取子级 | |||
List<SysCityListVo> cityList = this.getChildCityList(BigInteger.valueOf(320117)); | |||
List<SysCityListVo> cityList = this.getChildCityList(BigInteger.valueOf(3201)); | |||
// 添加子级 | |||
cityListVo.setChildrenList(cityList); | |||
@@ -135,6 +135,7 @@ public class SysCityServiceImpl extends ServiceImpl<SysCityMapper, SysCity> impl | |||
queryWrapper.eq("name", entity.getName()); | |||
queryWrapper.eq("level", entity.getLevel()); | |||
queryWrapper.eq("mark", 1); | |||
queryWrapper.ne("id", entity.getId()); | |||
SysCity cityInfo = sysCityMapper.selectOne(queryWrapper); | |||
if (cityInfo != null) { | |||
return response.failure("同级已存在该组织名称"); | |||
@@ -389,13 +390,13 @@ public class SysCityServiceImpl extends ServiceImpl<SysCityMapper, SysCity> impl | |||
// 拷贝属性 | |||
BeanUtils.copyProperties(item, cityListVo); | |||
// 判断是否有子级 | |||
List<SysCityListVo> childrenList = this.getChildCityList(item.getId()); | |||
if (!childrenList.isEmpty()) { | |||
cityListVo.setChildrenList(childrenList); | |||
cityListVo.setHasChildren(true); | |||
} else { | |||
cityListVo.setHasChildren(false); | |||
} | |||
// List<SysCityListVo> childrenList = this.getChildCityList(item.getId()); | |||
// if (!childrenList.isEmpty()) { | |||
// cityListVo.setChildrenList(childrenList); | |||
// cityListVo.setHasChildren(true); | |||
// } else { | |||
// cityListVo.setHasChildren(false); | |||
// } | |||
cityListVoList.add(cityListVo); | |||
}); | |||
} |
@@ -5,10 +5,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.taauav.admin.dto.TauvDriverDTO; | |||
import com.taauav.admin.entity.SysCity; | |||
import com.taauav.admin.mapper.TauvDriverPointMapper; | |||
import com.taauav.admin.query.TauvDriverQuery; | |||
import com.taauav.admin.service.ISysCityService; | |||
import com.taauav.admin.service.ITauvDriverPointService; | |||
import com.taauav.admin.vo.TauvDriverListVo; | |||
import com.taauav.admin.vo.TauvDriverVo; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysAdmin; | |||
import com.taauav.admin.entity.TauvDriver; | |||
@@ -17,9 +20,12 @@ import com.taauav.admin.service.ISysAdminService; | |||
import com.taauav.admin.service.ITauvDriverService; | |||
import com.taauav.common.service.impl.BaseServiceImpl; | |||
import com.taauav.common.util.DateUtil; | |||
import com.taauav.common.util.FunctionUtils; | |||
import com.taauav.common.util.RedisUtils; | |||
import com.taauav.common.util.ShiroUtils; | |||
import com.taauav.front.entity.UserAdmin; | |||
import com.taauav.front.mapper.UserAdminMapper; | |||
import com.taauav.front.vo.IndexDriverVo; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
@@ -56,6 +62,10 @@ public class TauvDriverServiceImpl extends BaseServiceImpl<TauvDriverMapper, Tau | |||
private UserAdminMapper lsAdminMapper; | |||
@Autowired | |||
private TauvDriverPointMapper driverPointMapper; | |||
@Autowired | |||
private ITauvDriverPointService driverPointService; | |||
@Autowired | |||
private RedisUtils redisUtils; | |||
/** | |||
* 获取河道列表 | |||
@@ -352,11 +362,45 @@ public class TauvDriverServiceImpl extends BaseServiceImpl<TauvDriverMapper, Tau | |||
} | |||
/** | |||
* 获取所有区级河道及坐标点 | |||
* 获取南京区级河湖缓存数据 | |||
* @return | |||
*/ | |||
@Override | |||
public Response getAllDriverList() { | |||
return null; | |||
public List<TauvDriverVo> getDriverCacheList() { | |||
// 获取所有区级id | |||
BigInteger cityId = new BigInteger("3201"); | |||
String key = "driver_all_" + cityId; | |||
Object allDriver = redisUtils.get(key); | |||
List<TauvDriverVo> driverVoList = new ArrayList<>(); | |||
if (allDriver != null) { | |||
driverVoList = FunctionUtils.castList(allDriver, TauvDriverVo.class); | |||
} | |||
if (driverVoList.isEmpty()) { | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
wrapper.eq("mark", 1); | |||
wrapper.eq("pid", cityId); | |||
wrapper.eq("level", 3); | |||
List<SysCity> cityList = cityService.list(wrapper); | |||
List<BigInteger> areaList = new ArrayList<>(); | |||
if (cityList != null && cityList.size() > 0) { | |||
for (SysCity city : cityList) { | |||
areaList.add(city.getId()); | |||
} | |||
} | |||
// 获取所有区级河湖 | |||
QueryWrapper queryWrapper = new QueryWrapper(); | |||
queryWrapper.eq("mark", 1); | |||
queryWrapper.eq("level", 3); | |||
queryWrapper.eq("status", 1); | |||
queryWrapper.in("driver_area", areaList); | |||
List<TauvDriver> driverList = list(queryWrapper); | |||
for (TauvDriver driver : driverList) { | |||
TauvDriverVo driverVo = new TauvDriverVo(); | |||
BeanUtils.copyProperties(driver, driverVo, TauvDriverVo.class); | |||
driverVoList.add(driverVo); | |||
} | |||
redisUtils.set(key, driverVoList); | |||
} | |||
return driverVoList; | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.taauav.admin.vo; | |||
import lombok.Data; | |||
import java.math.BigInteger; | |||
/** | |||
* 河湖实体类 | |||
* | |||
* @author daixiantong | |||
* @date 2020-05-23 | |||
*/ | |||
@Data | |||
public class TauvDriverVo { | |||
private Integer id; | |||
private String name; | |||
private BigInteger driverArea; | |||
} |
@@ -4,17 +4,23 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.taauav.admin.entity.SysCity; | |||
import com.taauav.admin.entity.TauvWaterWarn; | |||
import com.taauav.admin.service.ISysCityService; | |||
import com.taauav.admin.service.ITauvDriverPointService; | |||
import com.taauav.admin.service.ITauvDriverService; | |||
import com.taauav.admin.service.ITauvWaterTrendService; | |||
import com.taauav.admin.vo.TauvDriverVo; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.util.FunctionUtils; | |||
import com.taauav.front.service.IUserWaterSpectrumService; | |||
import com.taauav.front.service.IUserWaterWarnService; | |||
import com.taauav.front.vo.IndexDriverVo; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import javax.annotation.Resource; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
@@ -36,6 +42,10 @@ public class IndexWaterController { | |||
private ISysCityService cityService; | |||
@Autowired | |||
private ITauvDriverService driverService; | |||
@Autowired | |||
private IUserWaterSpectrumService waterSpectrumService; | |||
@Autowired | |||
private ITauvDriverPointService driverPointService; | |||
/** | |||
* 水质管理右侧 - 水质预警列表 | |||
@@ -76,6 +86,25 @@ public class IndexWaterController { | |||
*/ | |||
@GetMapping("/driver") | |||
public Response getAllDriverPoints() { | |||
return driverService.getAllDriverList(); | |||
List<TauvDriverVo> driverVoList = driverService.getDriverCacheList(); | |||
List<IndexDriverVo> list = new ArrayList<>(); | |||
if (driverVoList.size() > 0) { | |||
for (TauvDriverVo driver : driverVoList) { | |||
IndexDriverVo driverVo = new IndexDriverVo(); | |||
BeanUtils.copyProperties(driver, driverVo, IndexDriverVo.class); | |||
driverVo.setPointList(driverPointService.getListByDriverId(driverVo.getId())); | |||
list.add(driverVo); | |||
} | |||
} | |||
return response.success(list); | |||
} | |||
/** | |||
* 获取所有河湖最新的多光谱图 | |||
* @return | |||
*/ | |||
@GetMapping("/spectrum") | |||
public Response getAllSpectrum() { | |||
return waterSpectrumService.getAllSpectrum(); | |||
} | |||
} |
@@ -23,4 +23,9 @@ public interface IUserWaterSpectrumService extends IBaseService<TauvWaterSpectru | |||
*/ | |||
Response getList(UserWaterSpectrumQuery query); | |||
/** | |||
* 获取指挥大屏 所有多光谱图 | |||
* @return | |||
*/ | |||
Response getAllSpectrum(); | |||
} |
@@ -1,22 +1,30 @@ | |||
package com.taauav.front.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.taauav.admin.entity.SysCity; | |||
import com.taauav.admin.entity.TauvDriver; | |||
import com.taauav.admin.entity.TauvWaterSpectrum; | |||
import com.taauav.admin.service.ISysCityService; | |||
import com.taauav.admin.service.ITauvDriverService; | |||
import com.taauav.admin.vo.TauvDriverVo; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.service.impl.BaseServiceImpl; | |||
import com.taauav.common.util.FunctionUtils; | |||
import com.taauav.common.util.RedisUtils; | |||
import com.taauav.front.mapper.UserWaterSpectrumMapper; | |||
import com.taauav.front.query.UserWaterSpectrumQuery; | |||
import com.taauav.front.service.IUserWaterSpectrumService; | |||
import com.taauav.front.vo.userwaterspectrum.UserWaterSpectrumListVo; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.util.StringUtils; | |||
import java.math.BigInteger; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
@@ -32,15 +40,16 @@ public class UserWaterSpectrumServiceImpl extends BaseServiceImpl<UserWaterSpect | |||
@Autowired | |||
private UserWaterSpectrumMapper userWaterSpectrumMapper; | |||
@Autowired | |||
private ISysCityService sysCityService; | |||
@Autowired | |||
private Response response; | |||
@Value("${server.UPLOAD_URL}") | |||
private String uploadUrl; | |||
@Autowired | |||
private RedisUtils redisUtils; | |||
@Autowired | |||
private ITauvDriverService driverService; | |||
/** | |||
* 获取多光谱数据列表 | |||
@@ -98,4 +107,20 @@ public class UserWaterSpectrumServiceImpl extends BaseServiceImpl<UserWaterSpect | |||
page.setRecords(waterSpectrumListVoList); | |||
return response.success(page); | |||
} | |||
/** | |||
* 获取指挥大屏 所有河湖最新多光谱图 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
public Response getAllSpectrum() { | |||
List<TauvDriverVo> driverVoList = driverService.getDriverCacheList(); | |||
if (driverVoList.size() > 0) { | |||
for (TauvDriverVo driverVo : driverVoList) { | |||
} | |||
} | |||
return null; | |||
} | |||
} |
@@ -0,0 +1,47 @@ | |||
package com.taauav.front.vo; | |||
import lombok.Data; | |||
/** | |||
* 指挥大屏-河湖多光谱图返回结果实体类 | |||
* | |||
* @author daixiantong | |||
* @date 2020-05-23 | |||
*/ | |||
@Data | |||
public class IndexDriverSpectrumVo { | |||
/** | |||
* 河湖id | |||
*/ | |||
private Integer id; | |||
/** | |||
* 河湖名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 光谱图路径 | |||
*/ | |||
private String url; | |||
/** | |||
* 左下纬度 | |||
*/ | |||
private String leftLatitude; | |||
/** | |||
* 左下经度 | |||
*/ | |||
private String leftLongitude; | |||
/** | |||
* 右上纬度 | |||
*/ | |||
private String rightLatitude; | |||
/** | |||
* 右上经度 | |||
*/ | |||
private String rightLongitude; | |||
} |
@@ -0,0 +1,36 @@ | |||
package com.taauav.front.vo; | |||
import com.taauav.admin.entity.TauvDriverPoint; | |||
import lombok.Data; | |||
import java.math.BigInteger; | |||
import java.util.List; | |||
/** | |||
* 数据、指挥大屏 河湖数据返回结果实体类 | |||
* | |||
* @author daixiantong | |||
* @date 2020-05-23 | |||
*/ | |||
@Data | |||
public class IndexDriverVo { | |||
/** | |||
* 河湖id | |||
*/ | |||
private Integer id; | |||
/** | |||
* 河湖名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 区属id | |||
*/ | |||
private BigInteger driverArea; | |||
/** | |||
* 坐标点数组 | |||
*/ | |||
private List<TauvDriverPoint> pointList; | |||
} |