@@ -0,0 +1,19 @@ | |||
package com.taauav.admin.dto; | |||
import lombok.Data; | |||
import java.util.List; | |||
import java.util.Map; | |||
@Data | |||
public class TauvDriverDTO { | |||
private Integer id; | |||
/** | |||
* 名称 | |||
*/ | |||
private String name; | |||
private List<Map<String, String>> pointList; | |||
} |
@@ -3,9 +3,27 @@ package com.taauav.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.taauav.admin.entity.TauvDriverPoint; | |||
import java.math.BigInteger; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* 河流坐标mapper | |||
* @author dyg | |||
*/ | |||
public interface TauvDriverPointMapper extends BaseMapper<TauvDriverPoint> { | |||
/** | |||
* 根据城市id获取城市内所有河流坐标点 | |||
* @param cityId | |||
* @return | |||
*/ | |||
List<Map<String, String>> getPointListByCityId(BigInteger cityId); | |||
/** | |||
* 根据河道id获取河道所有坐标点 | |||
* @param driverId | |||
* @return | |||
*/ | |||
List<Map<String, String>> getPointListByDriverId(Integer driverId); | |||
} |
@@ -0,0 +1,13 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.TauvDriverPointMapper"> | |||
<select id="getPointListByCityId" resultType="java.util.Map"> | |||
select p.x, p.y from tauv_driver_point as p left join tauv_driver as d on p.driver_id=d.id | |||
where p.mark = 1 and d.mark = 1 and d.driver_area = #{cityId} | |||
</select> | |||
<select id="getPointListByDriverId" resultType="java.util.Map"> | |||
select x, y from tauv_driver_point where mark = 1 and status = 1 and driver_id = #{driverId} | |||
</select> | |||
</mapper> |
@@ -1,9 +1,14 @@ | |||
package com.taauav.admin.mapper; | |||
import com.taauav.admin.entity.TauvInspectDriver; | |||
import com.taauav.admin.entity.TauvInspectFile; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.taauav.front.dto.LsInspectFileDTO; | |||
import com.taauav.front.vo.LsInspectFileVo; | |||
import com.taauav.front.vo.SysCityVo; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.math.BigInteger; | |||
import java.util.List; | |||
import java.util.Map; | |||
@@ -16,7 +21,13 @@ import java.util.Map; | |||
* @since 2019-11-14 | |||
*/ | |||
public interface TauvInspectFileMapper extends BaseMapper<TauvInspectFile> { | |||
/** | |||
* 根据巡检任务河道id获取数据 | |||
* @param inspectDriverIds | |||
* @return | |||
*/ | |||
List<TauvInspectFile> getListByInspectDriverIds(@Param("inspectDriverIds") Integer[] inspectDriverIds); | |||
/** | |||
* 根据河道类型获取问题图片的数量 | |||
* @param driverArea | |||
@@ -26,4 +37,19 @@ public interface TauvInspectFileMapper extends BaseMapper<TauvInspectFile> { | |||
* @return | |||
*/ | |||
List<Map<String,Object>> getNumByFileDocument(@Param("driverArea") String[] driverArea, @Param("inspectDriverId") Integer inspectDriverId, @Param("inspectTime") Integer inspectTime, @Param("endTime") Integer endTime); | |||
/** | |||
* 根据区域统计下属河流的问题数量 | |||
* @param areaId | |||
* @param param | |||
* @return | |||
*/ | |||
List<Map<String, Integer>> countQuestionByArea(@Param("areaId") BigInteger areaId, @Param("param") Map<String, String> param); | |||
/** | |||
* 获取区划内所有河道问题坐标点 | |||
* @param inspectFileDTO | |||
* @return | |||
*/ | |||
List<LsInspectFileVo> getInspectFileList(@Param("param") LsInspectFileDTO inspectFileDTO); | |||
} |
@@ -25,4 +25,40 @@ | |||
and a.is_review=1 and | |||
a.is_effective=1 and a.file_type = 1 and a.status=1 and a.mark=1 and b.mark=1 group by a.`file_document` | |||
</select> | |||
<select id="countQuestionByArea" resultType="java.util.Map"> | |||
select count(f.id) as 'number', q.category from tauv_inspect_file as f | |||
left join tauv_inspect_driver as d on f.inspect_driver_id = d.id | |||
left join tauv_question_options as q on f.question_id = q.id | |||
left join sys_city as c on d.driver_area = c.id | |||
where f.mark = 1 and d.mark = 1 and q.mark = 1 and f.is_review = 1 and f.is_effective = 1 and f.status = 1 | |||
<if test="areaId != null and areaId > 0"> | |||
and d.driver_area = #{areaId} | |||
</if> | |||
<if test="param != null and param.beginTime != null and param.beginTime != ''"> | |||
and d.execution_time between concat(#{param.beginTime}, ' 00:00:00') and concat(#{param.endTime}, ' 23:59:59') | |||
</if> | |||
group by q.category; | |||
</select> | |||
<select id="getInspectFileList" resultType="com.taauav.front.vo.LsInspectFileVo"> | |||
select f.id, q.id as 'questionId', i.id as 'inspectDriverId', d.id as 'driverId', a.realname as 'driverManagerName', | |||
i.execution_time, f.gaode_latitude as 'latitude', f.gaode_longitude as 'longitude' | |||
from tauv_inspect_file as f | |||
left join tauv_question_options as q on f.question_id = q.id | |||
left join tauv_inspect_driver as i on f.inspect_driver_id = i.id | |||
left join tauv_driver as d on i.driver_id = d.id | |||
left join ls_admin as a on d.driver_manager = a.id | |||
where f.mark = 1 and d.mark = 1 and i.mark = 1 and f.is_review = 1 and f.is_effective = 1 and f.status = 1 | |||
and q.mark = 1 | |||
<if test="param != null and param.cityId != null and param.cityId > 0"> | |||
and d.driver_area = #{param.cityId} | |||
</if> | |||
<if test="param != null and param.category != null and param.category > 0"> | |||
and q.category = #{param.category} | |||
</if> | |||
<if test="param != null and param.beginTime != null and param.beginTime != ''"> | |||
and i.execution_time between concat(#{param.beginTime}, ' 00:00:00') and concat(#{param.endTime}, ' 23:59:59') | |||
</if> | |||
</select> | |||
</mapper> |
@@ -1,12 +1,19 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.admin.entity.SysCity; | |||
import com.taauav.admin.entity.TauvInspectFile; | |||
import com.taauav.admin.vo.LsAdminListVo; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.LsAdmin; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.taauav.admin.query.LsAdminQuery; | |||
import com.taauav.common.service.IBaseService; | |||
import com.taauav.front.dto.LsInspectFileDTO; | |||
import com.taauav.front.vo.LSAdminVo; | |||
import com.taauav.front.vo.SysCityVo; | |||
import javax.validation.constraints.Max; | |||
import java.math.BigInteger; | |||
import java.util.List; | |||
import java.util.Map; | |||
@@ -98,4 +105,34 @@ public interface ILsAdminService extends IBaseService<LsAdmin> { | |||
*/ | |||
Response getDriverManagerList(); | |||
/** | |||
* 获取用户信息 | |||
* @param userId | |||
* @return | |||
*/ | |||
LSAdminVo getAdminInfo(Integer userId); | |||
/** | |||
* 获取用户有查看权限区域id | |||
* @param adminInfo | |||
* @param map | |||
* @return | |||
*/ | |||
List<SysCityVo> getAdminAreaList(LSAdminVo adminInfo, Map<String, String> map); | |||
/** | |||
* 根据镇/街道id获取权限内下属村数据 | |||
* @param userId | |||
* @param cityId | |||
* @param map | |||
* @return | |||
*/ | |||
List<SysCityVo> getVillageList(Integer userId, BigInteger cityId, Map<String, String> map); | |||
/** | |||
* 获取区域内所有河道问题坐标点 | |||
* @param inspectFileDTO | |||
* @return | |||
*/ | |||
Response getQuestionList(LsInspectFileDTO inspectFileDTO); | |||
} |
@@ -65,4 +65,11 @@ public interface ISysCityService extends IService<SysCity> { | |||
* @return | |||
*/ | |||
String getCityName(BigInteger cityId); | |||
/** | |||
* 获取父级城市数据 | |||
* @param cityId | |||
* @return | |||
*/ | |||
List<SysCity> getParentCityList(BigInteger cityId); | |||
} |
@@ -3,7 +3,9 @@ package com.taauav.admin.service; | |||
import com.taauav.admin.entity.TauvDriverPoint; | |||
import com.taauav.common.service.IBaseService; | |||
import java.math.BigInteger; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* 河道坐标 | |||
@@ -12,4 +14,11 @@ import java.util.List; | |||
public interface ITauvDriverPointService extends IBaseService<TauvDriverPoint> { | |||
List<TauvDriverPoint> getListByDriverId(int driverId); | |||
/** | |||
* 根据区划id获取对应所有河流的坐标点 | |||
* @param cityId | |||
* @return | |||
*/ | |||
List<Map<String, String>> getPointListByCityId(BigInteger cityId); | |||
} |
@@ -1,11 +1,13 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.admin.dto.TauvDriverDTO; | |||
import com.taauav.admin.query.TauvDriverQuery; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.TauvDriver; | |||
import com.taauav.common.service.IBaseService; | |||
import java.math.BigInteger; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
@@ -86,4 +88,11 @@ public interface ITauvDriverService extends IBaseService<TauvDriver> { | |||
* @return | |||
*/ | |||
Response getDriverList(Map<String, Object> map); | |||
/** | |||
* 获取城市下所有河道 | |||
* @param cityId | |||
* @return | |||
*/ | |||
List<TauvDriverDTO> getDriverListByCityId(BigInteger cityId); | |||
} |
@@ -4,23 +4,30 @@ 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.constant.CommonConstant; | |||
import com.taauav.admin.dto.TauvDriverDTO; | |||
import com.taauav.admin.entity.LsAuthGroup; | |||
import com.taauav.admin.entity.SysCity; | |||
import com.taauav.admin.entity.TauvInspectFile; | |||
import com.taauav.admin.mapper.LsAuthGroupMapper; | |||
import com.taauav.admin.service.ILsAuthGroupService; | |||
import com.taauav.admin.service.ISysCityService; | |||
import com.taauav.admin.mapper.TauvInspectFileMapper; | |||
import com.taauav.admin.service.*; | |||
import com.taauav.admin.vo.LsAdminListVo; | |||
import com.taauav.admin.vo.LsDriverManagerListVo; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.constant.SysAdminConstant; | |||
import com.taauav.common.service.impl.BaseServiceImpl; | |||
import com.taauav.common.util.FunctionUtils; | |||
import com.taauav.common.util.StringUtils; | |||
import com.taauav.admin.entity.LsAdmin; | |||
import com.taauav.admin.mapper.LsAdminMapper; | |||
import com.taauav.admin.query.LsAdminQuery; | |||
import com.taauav.admin.service.ILsAdminService; | |||
import com.taauav.front.dto.LsInspectFileDTO; | |||
import com.taauav.front.vo.LSAdminVo; | |||
import com.taauav.front.vo.LsInspectFileVo; | |||
import com.taauav.front.vo.SysCityVo; | |||
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 java.math.BigInteger; | |||
@@ -42,19 +49,22 @@ public class LsAdminServiceImpl extends BaseServiceImpl<LsAdminMapper, LsAdmin> | |||
@Autowired | |||
private LsAdminMapper lsAdminMapper; | |||
@Autowired | |||
private Response response; | |||
@Autowired | |||
private ISysCityService cityService; | |||
@Autowired | |||
private ILsAuthGroupService authGroupService; | |||
@Autowired | |||
private LsAuthGroupMapper authGroupMapper; | |||
private QueryWrapper<LsAdmin> queryWrapper; | |||
@Value("${server.IMAGE_URL}") | |||
private String imageUrl; | |||
@Autowired | |||
private ILsCityService lsCityService; | |||
@Autowired | |||
private TauvInspectFileMapper inspectFileMapper; | |||
@Autowired | |||
private ITauvDriverService driverService; | |||
/** | |||
* 获取数据列表 | |||
@@ -295,4 +305,320 @@ public class LsAdminServiceImpl extends BaseServiceImpl<LsAdminMapper, LsAdmin> | |||
} | |||
return response.success(driverManagerListVoList); | |||
} | |||
@Override | |||
public LSAdminVo getAdminInfo(Integer userId) { | |||
if (userId <= 0) { | |||
return null; | |||
} | |||
LsAdmin admin = getInfo(userId); | |||
if (admin == null) { | |||
return null; | |||
} | |||
LSAdminVo info = new LSAdminVo(); | |||
BeanUtils.copyProperties(admin, info); | |||
//处理头像 | |||
if (!"".equals(info.getAvatar())) { | |||
info.setAvatar(imageUrl + info.getAvatar()); | |||
} | |||
//处理角色名称 | |||
String authText = authGroupService.getAuthGroupName(info.getAuthGroup()); | |||
info.setAuthGroupName(authText); | |||
//处理状态名称 | |||
String statusText = FunctionUtils.getArrayText(String.valueOf(info.getStatus()), SysAdminConstant.getAdminStatus()); | |||
info.setStatusText(statusText); | |||
//处理区划数据 | |||
if (info.getDriverArea() != null && info.getDriverArea().compareTo(BigInteger.ZERO) > 0) { | |||
SysCity city = cityService.getInfoById(info.getDriverArea()); | |||
if (city != null) { | |||
info.setDriverAreaName(city.getName()); | |||
info.setDriverAreaLevel(city.getLevel()); | |||
} | |||
} | |||
return info; | |||
} | |||
/** | |||
* 获取用户权限内区、镇数据 | |||
* @param adminInfo | |||
* @param map | |||
* @return | |||
*/ | |||
@Override | |||
public List<SysCityVo> getAdminAreaList(LSAdminVo adminInfo, Map<String, String> map) { | |||
if (adminInfo == null) { | |||
return null; | |||
} | |||
if (map == null) { | |||
map = new HashMap<>(); | |||
} | |||
String[] authGroup = adminInfo.getAuthGroup().split(","); | |||
ArrayList arrayList = new ArrayList(); | |||
if (authGroup.length > 0) { | |||
for (String authId : authGroup) { | |||
arrayList.add(authId); | |||
} | |||
} | |||
// 查询角色信息 | |||
QueryWrapper<LsAuthGroup> wrapper = new QueryWrapper<>(); | |||
wrapper.in("id", arrayList); | |||
wrapper.eq("status", 1); | |||
wrapper.eq("mark", 1); | |||
List<LsAuthGroup> authGroupList = authGroupService.list(wrapper); | |||
List<SysCity> areaList = new ArrayList<>(); | |||
List<SysCityVo> cityVoList = new ArrayList<>(); | |||
if (null != authGroupList && authGroupList.size() > 0) { | |||
for (LsAuthGroup auth : authGroupList) { | |||
//用户自己区划 | |||
if (auth.getAuthData().equals(1)) { | |||
SysCity areaInfo = cityService.getInfoById(adminInfo.getDriverArea()); | |||
if (!areaList.contains(areaInfo) && areaInfo.getLevel() < 5) { | |||
areaList.add(areaInfo); | |||
cityVoList.add(countQuestion(areaInfo, map)); | |||
} else if (areaInfo.getLevel() > 4) { | |||
cityVoList = getCityParentList(adminInfo.getDriverArea(), cityVoList); | |||
} | |||
} else if (auth.getAuthData().equals(2)) { | |||
//用户自己区划 | |||
SysCity areaInfo = cityService.getInfoById(adminInfo.getDriverArea()); | |||
if (!areaList.contains(areaInfo) && areaInfo.getLevel() < 5) { | |||
areaList.add(areaInfo); | |||
cityVoList.add(countQuestion(areaInfo, map)); | |||
} else if (areaInfo.getLevel() > 4) { | |||
cityVoList = getCityParentList(adminInfo.getDriverArea(), cityVoList); | |||
} | |||
//用户子级区划 | |||
List<SysCity> cityList = getChildCityList(adminInfo.getDriverArea(), 5); | |||
if (cityList != null && cityList.size() > 0) { | |||
for (SysCity city : cityList) { | |||
if (!areaList.contains(city)) { | |||
areaList.add(city); | |||
cityVoList.add(countQuestion(city, map)); | |||
} | |||
} | |||
} | |||
} else if (auth.getAuthData().equals(3)) { | |||
//用户指定区划 | |||
String[] driverList = auth.getDriverArea().split(","); | |||
if (driverList != null && driverList.length > 0) { | |||
for (String driver : driverList) { | |||
BigInteger areaId = new BigInteger(driver); | |||
SysCity areaInfo = cityService.getInfoById(areaId); | |||
if (!areaList.contains(areaInfo) && areaInfo.getLevel() < 5) { | |||
areaList.add(areaInfo); | |||
SysCityVo cityVo = new SysCityVo(); | |||
BeanUtils.copyProperties(areaInfo, cityVo); | |||
cityVo.setSurfaceWater(0); | |||
cityVo.setShoreLine(0); | |||
cityVo.setOutfall(0); | |||
cityVo.setWaterQuality(0); | |||
cityVo.setIsTrue(0); | |||
cityVo.setDriverList(new ArrayList<>()); | |||
if (cityVoList.contains(cityVo)) { | |||
cityVoList.remove(cityVo); | |||
} | |||
cityVoList.add(countQuestion(areaInfo, map)); | |||
} else if (areaInfo.getLevel() > 4) { | |||
cityVoList = getCityParentList(areaId, cityVoList); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} else { | |||
return null; | |||
} | |||
return cityVoList; | |||
} | |||
/** | |||
* 获取限定层级内的子区划数组 | |||
* @param cityId | |||
* @param limitLevel | |||
* @return | |||
*/ | |||
private List<SysCity> getChildCityList(BigInteger cityId, Integer limitLevel) { | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
wrapper.eq("mark", 1); | |||
wrapper.eq("pid", cityId); | |||
if (limitLevel > 0) { | |||
wrapper.lt("level", limitLevel); | |||
} | |||
List<SysCity> cityList = cityService.list(wrapper); | |||
return cityList; | |||
} | |||
/** | |||
* 根据城市id获取村级以上城市数据 | |||
* @param cityId | |||
* @param cityList | |||
* @return | |||
*/ | |||
private List<SysCityVo> getCityParentList(BigInteger cityId, List<SysCityVo> cityList) { | |||
List<SysCity> parentList = cityService.getParentCityList(cityId); | |||
if (parentList != null && parentList.size() > 0) { | |||
for (SysCity item : parentList) { | |||
SysCityVo cityVo = new SysCityVo(); | |||
BeanUtils.copyProperties(item, cityVo); | |||
cityVo.setSurfaceWater(0); | |||
cityVo.setShoreLine(0); | |||
cityVo.setOutfall(0); | |||
cityVo.setWaterQuality(0); | |||
cityVo.setIsTrue(0); | |||
cityVo.setDriverList(new ArrayList<>()); | |||
if (!cityList.contains(cityVo)) { | |||
cityList.add(cityVo); | |||
} | |||
} | |||
} | |||
return cityList; | |||
} | |||
/** | |||
* 计算区划问题数量 | |||
* @param city | |||
* @param map | |||
* @return | |||
*/ | |||
private SysCityVo countQuestion(SysCity city, Map<String, String> map) { | |||
List<Map<String, Integer>> questionList = inspectFileMapper.countQuestionByArea(city.getId(), map); | |||
SysCityVo cityVo = new SysCityVo(); | |||
BeanUtils.copyProperties(city, cityVo); | |||
if (questionList.size() > 0) { | |||
for (Map<String, Integer> question : questionList) { | |||
Number number = (Number) question.get("number"); | |||
switch (question.get("category")) { | |||
case 1: | |||
cityVo.setSurfaceWater(number.intValue()); | |||
break; | |||
case 2: | |||
cityVo.setShoreLine(number.intValue()); | |||
break; | |||
case 3: | |||
cityVo.setOutfall(number.intValue()); | |||
break; | |||
case 4: | |||
cityVo.setWaterQuality(number.intValue()); | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
} | |||
if (cityVo.getSurfaceWater() == null) { | |||
cityVo.setSurfaceWater(0); | |||
} | |||
if (cityVo.getShoreLine() == null) { | |||
cityVo.setShoreLine(0); | |||
} | |||
if (cityVo.getOutfall() == null) { | |||
cityVo.setOutfall(0); | |||
} | |||
if (cityVo.getWaterQuality() == null) { | |||
cityVo.setWaterQuality(0); | |||
} | |||
cityVo.setIsTrue(1); | |||
List<TauvDriverDTO> driverList = driverService.getDriverListByCityId(cityVo.getId()); | |||
cityVo.setDriverList(driverList); | |||
return cityVo; | |||
} | |||
/** | |||
* 根据镇/街道id获取权限内下属村数据 | |||
* @param userId | |||
* @param townId | |||
* @param map | |||
* @return | |||
*/ | |||
@Override | |||
public List<SysCityVo> getVillageList(Integer userId, BigInteger townId, Map<String, String> map) { | |||
LsAdmin adminInfo = getInfo(userId); | |||
if (adminInfo == null) { | |||
return null; | |||
} | |||
ArrayList arrayList = new ArrayList(); | |||
String[] authGroup = adminInfo.getAuthGroup().split(","); | |||
if (authGroup != null && authGroup.length > 0) { | |||
for (String authId : authGroup) { | |||
arrayList.add(authId); | |||
} | |||
} | |||
// 查询角色信息 | |||
QueryWrapper<LsAuthGroup> wrapper = new QueryWrapper<>(); | |||
wrapper.in("id", arrayList); | |||
wrapper.eq("status", 1); | |||
wrapper.eq("mark", 1); | |||
List<LsAuthGroup> authGroupList = authGroupService.list(wrapper); | |||
List<SysCityVo> cityVoList = new ArrayList<>(); | |||
List<SysCity> cityList = new ArrayList<>(); | |||
if (null != authGroupList && authGroupList.size() > 0) { | |||
for (LsAuthGroup auth : authGroupList) { | |||
SysCity city = new SysCity(); | |||
switch (auth.getAuthData()) { | |||
case 1: | |||
city = cityService.getInfoById(adminInfo.getDriverArea()); | |||
if (city.getLevel() == 5 && !cityList.contains(city) && city.getPid().equals(townId)) { | |||
cityList.add(city); | |||
cityVoList.add(countQuestion(city, map)); | |||
} | |||
break; | |||
case 2: | |||
city = cityService.getInfoById(adminInfo.getDriverArea()); | |||
if (city.getLevel() == 5 && !cityList.contains(city) && city.getPid().equals(townId)) { | |||
cityList.add(city); | |||
cityVoList.add(countQuestion(city, map)); | |||
} | |||
//获取子级 | |||
List<SysCity> childCityList = getChildCityList(adminInfo.getDriverArea(), 0); | |||
for (SysCity item : childCityList) { | |||
if (item.getPid().equals(townId) && !cityList.contains(item) && item.getLevel().equals(5)) { | |||
cityList.add(item); | |||
cityVoList.add(countQuestion(item, map)); | |||
} | |||
} | |||
break; | |||
case 3: | |||
//用户指定区划 | |||
String[] driverAreaList = auth.getDriverArea().split(","); | |||
if (driverAreaList != null && driverAreaList.length > 0) { | |||
for (String area : driverAreaList) { | |||
BigInteger areaId = new BigInteger(area); | |||
SysCity sysCity = cityService.getInfoById(areaId); | |||
if (sysCity.getLevel().equals(5) && !cityList.contains(sysCity) && sysCity.getPid().equals(townId)) { | |||
cityList.add(sysCity); | |||
cityVoList.add(countQuestion(sysCity, map)); | |||
} | |||
} | |||
} | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
} | |||
return cityVoList; | |||
} | |||
/** | |||
* 获取区划内所有河道问题坐标点 | |||
* @param inspectFileDTO | |||
* @return | |||
*/ | |||
@Override | |||
public Response getQuestionList(LsInspectFileDTO inspectFileDTO) { | |||
if (inspectFileDTO == null || inspectFileDTO.getCityId() == null || inspectFileDTO.getCategory() == null) { | |||
return response.failure("参数不能为空"); | |||
} | |||
if (inspectFileDTO.getCityId() == null || inspectFileDTO.getCityId().compareTo(BigInteger.ZERO) <= 0) { | |||
return response.failure("区划id不合法"); | |||
} | |||
if (inspectFileDTO.getCategory() == null || inspectFileDTO.getCategory() <= 0) { | |||
return response.failure("问题类型不正确"); | |||
} | |||
List<LsInspectFileVo> fileVoList = inspectFileMapper.getInspectFileList(inspectFileDTO); | |||
return response.success(fileVoList); | |||
} | |||
} |
@@ -166,4 +166,26 @@ public class SysCityServiceImpl extends ServiceImpl<SysCityMapper, SysCity> impl | |||
Collections.reverse(nameList); | |||
return org.apache.commons.lang3.StringUtils.join(nameList.toArray(), ">>"); | |||
} | |||
@Override | |||
public List<SysCity> getParentCityList(BigInteger cityId) { | |||
SysCity city = getInfoById(cityId); | |||
if (city == null) { | |||
return null; | |||
} | |||
List<SysCity> parentList = new ArrayList<>(); | |||
if (city.getPid() != null && city.getPid().compareTo(BigInteger.ZERO) > 0) { | |||
SysCity parent = getInfoById(city.getPid()); | |||
if (parent != null) { | |||
parentList.add(parent); | |||
if (parent.getPid() != null && parent.getPid().compareTo(BigInteger.ZERO) > 0) { | |||
SysCity parentCity = getInfoById(parent.getPid()); | |||
if (parentCity != null) { | |||
parentList.add(parentCity); | |||
} | |||
} | |||
} | |||
} | |||
return parentList; | |||
} | |||
} |
@@ -11,7 +11,9 @@ import com.taauav.common.util.StringUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.math.BigInteger; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* 河道坐标 | |||
@@ -21,6 +23,9 @@ import java.util.List; | |||
public class TauvDriverPointServiceImpl extends BaseServiceImpl<TauvDriverPointMapper, TauvDriverPoint> implements ITauvDriverPointService { | |||
@Autowired | |||
private RedisUtils redisUtils; | |||
@Autowired | |||
private TauvDriverPointMapper driverPointMapper; | |||
@Override | |||
public List<TauvDriverPoint> getListByDriverId(int driverId) { | |||
List<TauvDriverPoint> pointList = null; | |||
@@ -35,4 +40,10 @@ public class TauvDriverPointServiceImpl extends BaseServiceImpl<TauvDriverPointM | |||
} | |||
return pointList; | |||
} | |||
@Override | |||
public List<Map<String, String>> getPointListByCityId(BigInteger cityId) { | |||
List<Map<String, String>> pointList = driverPointMapper.getPointListByCityId(cityId); | |||
return pointList; | |||
} | |||
} |
@@ -4,9 +4,11 @@ import cn.hutool.core.bean.BeanUtil; | |||
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.LsAdmin; | |||
import com.taauav.admin.entity.TauvEquipment; | |||
import com.taauav.admin.mapper.LsAdminMapper; | |||
import com.taauav.admin.mapper.TauvDriverPointMapper; | |||
import com.taauav.admin.query.TauvDriverQuery; | |||
import com.taauav.admin.service.ILsCityService; | |||
import com.taauav.admin.service.ISysCityService; | |||
@@ -46,7 +48,6 @@ public class TauvDriverServiceImpl extends BaseServiceImpl<TauvDriverMapper, Tau | |||
private Integer pageSize; | |||
@Autowired | |||
private Response response; | |||
@Autowired | |||
private ISysAdminService iSysAdminService; | |||
@Autowired | |||
@@ -55,9 +56,10 @@ public class TauvDriverServiceImpl extends BaseServiceImpl<TauvDriverMapper, Tau | |||
private ISysCityService cityService; | |||
@Autowired | |||
private LsAdminMapper lsAdminMapper; | |||
@Autowired | |||
private ILsCityService lsCityService; | |||
@Autowired | |||
private TauvDriverPointMapper driverPointMapper; | |||
/** | |||
* 获取河道列表 | |||
@@ -332,4 +334,23 @@ public class TauvDriverServiceImpl extends BaseServiceImpl<TauvDriverMapper, Tau | |||
result.put("records", driverListVoList); | |||
return response.success(result); | |||
} | |||
@Override | |||
public List<TauvDriverDTO> getDriverListByCityId(BigInteger cityId) { | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
wrapper.eq("mark", 1); | |||
wrapper.eq("driver_area", cityId); | |||
List<TauvDriver> driverList = list(wrapper); | |||
List<TauvDriverDTO> driverDTOList = new ArrayList<>(); | |||
if (driverList != null && driverList.size() > 0) { | |||
for (TauvDriver driver : driverList) { | |||
List<Map<String, String>> pointList = driverPointMapper.getPointListByDriverId(driver.getId()); | |||
TauvDriverDTO driverDTO = new TauvDriverDTO(); | |||
BeanUtils.copyProperties(driver, driverDTO); | |||
driverDTO.setPointList(pointList); | |||
driverDTOList.add(driverDTO); | |||
} | |||
} | |||
return driverDTOList; | |||
} | |||
} |
@@ -79,7 +79,7 @@ public class TauvQuestionOptionsServiceImpl extends BaseServiceImpl<TauvQuestion | |||
dt.put("format_create_time", ""); | |||
} else { | |||
String createTime = dt.get("create_time").toString(); | |||
dt.put("format_create_time", FunctionUtils.formatTime(Integer.valueOf(createTime), "yyyy-MM-dd HH:mm:ss")); | |||
dt.put("format_create_time", createTime); | |||
} | |||
dt.put("format_create_user", ""); | |||
if (!StringUtils.isEmpty(dt.get("create_user"))) { |
@@ -35,6 +35,9 @@ public class ConcurrentDateFormat { | |||
} | |||
public String format(Date date) { | |||
if (date == null) { | |||
return null; | |||
} | |||
SimpleDateFormat sdf = (SimpleDateFormat)this.queue.poll(); | |||
if (sdf == null) { | |||
sdf = this.createInstance(); |
@@ -0,0 +1,75 @@ | |||
package com.taauav.front.controller; | |||
import com.taauav.admin.entity.SysCity; | |||
import com.taauav.admin.entity.TauvInspectFile; | |||
import com.taauav.admin.service.ILsAdminService; | |||
import com.taauav.admin.service.ILsAuthGroupService; | |||
import com.taauav.admin.service.ILsCityService; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.util.StringUtils; | |||
import com.taauav.front.dto.LsInspectFileDTO; | |||
import com.taauav.front.vo.LSAdminVo; | |||
import com.taauav.front.vo.SysCityVo; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.math.BigInteger; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* 前台用户 | |||
* | |||
* @author daixiantong | |||
* @date 2020-04-14 | |||
*/ | |||
@RestController | |||
@RequestMapping("/LsAdmin") | |||
public class LSAdminController { | |||
@Autowired | |||
private ILsAdminService lsAdminService; | |||
@Autowired | |||
private Response response; | |||
/** | |||
* 获取地图权限内区、镇/街道级数据 | |||
* @param userId | |||
* @param map | |||
* @return | |||
*/ | |||
@GetMapping("/info") | |||
public Response info(@RequestParam("userId") Integer userId, @RequestParam Map<String, String> map) { | |||
LSAdminVo info = lsAdminService.getAdminInfo(userId); | |||
//数据权限处理 | |||
List<SysCityVo> cityList = lsAdminService.getAdminAreaList(info, map); | |||
info.setCityList(cityList); | |||
return response.success(info); | |||
} | |||
/** | |||
* 根据镇/街道id获取权限内下属村数据 | |||
* @param townId | |||
* @return | |||
*/ | |||
@GetMapping("/village") | |||
public Response getVillageData(@RequestParam("userId")Integer userId, @RequestParam("townId") BigInteger townId, @RequestParam Map<String, String> map) { | |||
List<SysCityVo> villageList = lsAdminService.getVillageList(userId, townId, map); | |||
return response.success(villageList); | |||
} | |||
/** | |||
* 获取区划内问题坐标点 | |||
* @param inspectFileDTO | |||
* @return | |||
*/ | |||
@GetMapping("/question") | |||
@ApiOperation(value = "获取区划内对应类型问题坐标点", notes = "传入cityId、category、巡检起止时间") | |||
public Response getQuestionPointList(LsInspectFileDTO inspectFileDTO) { | |||
return lsAdminService.getQuestionList(inspectFileDTO); | |||
} | |||
} |
@@ -0,0 +1,78 @@ | |||
package com.taauav.front.controller; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.extension.api.R; | |||
import com.taauav.admin.entity.SysCity; | |||
import com.taauav.admin.mapper.SysCityMapper; | |||
import com.taauav.admin.service.ISysCityService; | |||
import com.taauav.common.util.DateUtil; | |||
import com.taauav.common.util.StringUtils; | |||
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.RequestParam; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import java.io.*; | |||
/** | |||
* 溧水区、镇、村数据处理控制器 | |||
* | |||
* @author daixiantong | |||
*/ | |||
@RequestMapping("/front/area") | |||
@RestController | |||
public class LsAreaController { | |||
@Autowired | |||
private ISysCityService cityService; | |||
@Autowired | |||
private SysCityMapper cityMapper; | |||
@GetMapping("/import") | |||
public R readAreaData(@RequestParam("file") String filePath) throws IOException { | |||
if (!StringUtils.isEmpty(filePath)) { | |||
File file = new File(filePath); | |||
InputStream inputStream = null; | |||
StringBuffer sb = new StringBuffer(); | |||
if (file.isFile() && file.exists()) { | |||
try { | |||
inputStream = new FileInputStream(file); | |||
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, "utf-8")); | |||
String buff; | |||
while ((buff = br.readLine()) != null) { | |||
sb.append(buff); | |||
} | |||
} catch (FileNotFoundException e) { | |||
e.printStackTrace(); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
} finally { | |||
inputStream.close(); | |||
} | |||
JSONArray jsonArray = JSON.parseArray(sb.toString()); | |||
for (int i = 0; i < jsonArray.size(); i++) { | |||
JSONObject jsonObject = jsonArray.getJSONObject(i); | |||
SysCity lishui = new SysCity(); | |||
lishui.setId(jsonObject.getBigInteger("code")); | |||
lishui.setPid(jsonObject.getBigInteger("pCode")); | |||
lishui.setLevel(jsonObject.getInteger("levelId")); | |||
lishui.setName(jsonObject.getString("name")); | |||
lishui.setHasChild(2); | |||
lishui.setCreateUser(1); | |||
lishui.setUpdateUser(1); | |||
lishui.setCreateTime(DateUtil.now()); | |||
lishui.setUpdateTime(DateUtil.now()); | |||
cityMapper.insert(lishui); | |||
} | |||
return R.ok("导入成功"); | |||
} else { | |||
return R.failed("文件不存在"); | |||
} | |||
} | |||
return R.failed("附件路径不能为空"); | |||
} | |||
} |
@@ -0,0 +1,28 @@ | |||
package com.taauav.front.dto; | |||
import lombok.Data; | |||
import java.math.BigInteger; | |||
@Data | |||
public class LsInspectFileDTO { | |||
/** | |||
* 区划id | |||
*/ | |||
private BigInteger cityId; | |||
/** | |||
* 问题分类:1水面 2岸线 3排口 4水质 | |||
*/ | |||
private Integer category; | |||
/** | |||
* 巡检时间 - 开始 | |||
*/ | |||
private String beginTime; | |||
/** | |||
* 巡检时间 - 结束 | |||
*/ | |||
private String endTime; | |||
} |
@@ -0,0 +1,168 @@ | |||
package com.taauav.front.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.math.BigInteger; | |||
import java.util.Date; | |||
import java.util.List; | |||
/** | |||
* 用户信息 | |||
* | |||
* @author daixiantong | |||
*/ | |||
@Data | |||
public class LSAdminVo { | |||
/** | |||
* 人员ID | |||
*/ | |||
private Integer id; | |||
/** | |||
* 姓名 | |||
*/ | |||
private String realname; | |||
/** | |||
* 用户名 | |||
*/ | |||
private String username; | |||
/** | |||
* 密码 | |||
*/ | |||
private String password; | |||
/** | |||
* 头像 | |||
*/ | |||
private String avatar; | |||
/** | |||
* 性别:1男 2女 3未知 | |||
*/ | |||
private Integer gender; | |||
/** | |||
* 联系方式(手机号码) | |||
*/ | |||
private String mobile; | |||
/** | |||
* 邮箱 | |||
*/ | |||
private String email; | |||
/** | |||
* 河长等级 | |||
*/ | |||
private Integer level; | |||
/** | |||
* 河长等级描述 | |||
*/ | |||
private String levelName; | |||
/** | |||
* 区划ID | |||
*/ | |||
private BigInteger driverArea; | |||
/** | |||
* 区划描述 | |||
*/ | |||
private String driverAreaName; | |||
/** | |||
* 职务 | |||
*/ | |||
private String duty; | |||
/** | |||
* 角色编号 | |||
*/ | |||
private String authGroup; | |||
/** | |||
* 角色描述 | |||
*/ | |||
private String authGroupName; | |||
/** | |||
* Session标识 | |||
*/ | |||
private String token; | |||
/** | |||
* 备注 | |||
*/ | |||
private String note; | |||
/** | |||
* 登录次数 | |||
*/ | |||
private Integer loginNum; | |||
/** | |||
* 上次登录IP | |||
*/ | |||
private Long lastIp; | |||
/** | |||
* 上次登录时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date lastTime; | |||
/** | |||
* 状态:1正常 2禁用 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 排序 | |||
*/ | |||
private Integer sort; | |||
/** | |||
* 创建人 | |||
*/ | |||
private Integer createUser; | |||
/** | |||
* 更新人 | |||
*/ | |||
private Integer updateUser; | |||
/** | |||
* 创建时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date createTime; | |||
/** | |||
* 更新时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date updateTime; | |||
/** | |||
* 状态名称 | |||
*/ | |||
private String statusText; | |||
/** | |||
* 区划层级 | |||
*/ | |||
private Integer driverAreaLevel; | |||
/** | |||
* 区划数组 | |||
*/ | |||
private List<SysCityVo> cityList; | |||
} |
@@ -0,0 +1,51 @@ | |||
package com.taauav.front.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import java.util.Date; | |||
@Data | |||
public class LsInspectFileVo { | |||
/** | |||
* 图片id | |||
*/ | |||
private Integer id; | |||
/** | |||
* 问题id | |||
*/ | |||
private Integer questionId; | |||
/** | |||
* 河道id | |||
*/ | |||
private Integer driverId; | |||
/** | |||
* 巡检河道id | |||
*/ | |||
private Integer inspectDriverId; | |||
/** | |||
* 河长姓名 | |||
*/ | |||
private String driverManagerName; | |||
/** | |||
* 执行时间 - 拍摄时间 | |||
*/ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
private Date executionTime; | |||
/** | |||
* 问题坐标 - 纬度 | |||
*/ | |||
private String latitude; | |||
/** | |||
* 问题坐标 - 经度 | |||
*/ | |||
private String longitude; | |||
} |
@@ -0,0 +1,139 @@ | |||
package com.taauav.front.vo; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.taauav.admin.dto.TauvDriverDTO; | |||
import lombok.Data; | |||
import org.hibernate.validator.constraints.Length; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.math.BigInteger; | |||
import java.util.Date; | |||
import java.util.List; | |||
import java.util.Map; | |||
@Data | |||
public class SysCityVo { | |||
/** | |||
* 编号 | |||
*/ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private BigInteger id; | |||
/** | |||
* 父级ID | |||
*/ | |||
private BigInteger pid; | |||
/** | |||
* 层级:1省 2市 3区 | |||
*/ | |||
private Integer level; | |||
/** | |||
* 省市区名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 简称 | |||
*/ | |||
private String simple; | |||
/** | |||
* 拼音 | |||
*/ | |||
private String pinyin; | |||
/** | |||
* 简拼 | |||
*/ | |||
private String code; | |||
/** | |||
* 首字母 | |||
*/ | |||
private String firstChar; | |||
/** | |||
* 原城市ID | |||
*/ | |||
private Integer oldCityId; | |||
/** | |||
* 有无子级:1有 2无 | |||
*/ | |||
private Integer hasChild; | |||
/** | |||
* 显示顺序 | |||
*/ | |||
private Integer sort; | |||
/** | |||
* 状态 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 备注 | |||
*/ | |||
@Length(max = 255, message = "备注最大长度为255") | |||
private String note; | |||
/** | |||
* 创建人 | |||
*/ | |||
private Integer createUser; | |||
/** | |||
* 创建时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date createTime; | |||
/** | |||
* 更新人 | |||
*/ | |||
private Integer updateUser; | |||
/** | |||
* 更新时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date updateTime; | |||
/** | |||
* 水面问题数量 | |||
*/ | |||
private Integer surfaceWater; | |||
/** | |||
* 岸线问题数量 | |||
*/ | |||
private Integer shoreLine; | |||
/** | |||
* 排口问题数量 | |||
*/ | |||
private Integer outfall; | |||
/** | |||
* 水质问题数量 | |||
*/ | |||
private Integer waterQuality; | |||
/** | |||
* 河流坐标点 | |||
*/ | |||
private List<TauvDriverDTO> driverList; | |||
/** | |||
* 是否有权限:1是 0否 | |||
*/ | |||
private Integer isTrue; | |||
} |