*/ | */ | ||||
public static Map<Integer, String> LSADMIN_LEVEL_LIST = new HashMap<Integer, String>() { | public static Map<Integer, String> LSADMIN_LEVEL_LIST = new HashMap<Integer, String>() { | ||||
{ | { | ||||
put(1, "河长等级1"); | |||||
put(2, "河长等级2"); | |||||
put(1, "区级"); | |||||
put(2, "镇级"); | |||||
put(3, "村级"); | |||||
} | } | ||||
}; | }; | ||||
left join tauv_question_options as q on f.question_id = q.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 | 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 | 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 | ||||
and d.status = 4 | |||||
<if test="areaId != null and areaId > 0"> | <if test="areaId != null and areaId > 0"> | ||||
and d.driver_area = #{areaId} | and d.driver_area = #{areaId} | ||||
</if> | </if> | ||||
left join tauv_driver as d on i.driver_id = d.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 | 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 | 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 | |||||
and q.mark = 1 and i.status = 4 | |||||
<if test="param != null and param.cityId != null and param.cityId > 0"> | <if test="param != null and param.cityId != null and param.cityId > 0"> | ||||
and d.driver_area = #{param.cityId} | and d.driver_area = #{param.cityId} | ||||
</if> | </if> |
cityVo.setWaterQuality(0); | cityVo.setWaterQuality(0); | ||||
cityVo.setIsTrue(0); | cityVo.setIsTrue(0); | ||||
cityVo.setDriverList(new ArrayList<>()); | cityVo.setDriverList(new ArrayList<>()); | ||||
if (!cityList.contains(cityVo)) { | |||||
Boolean exist = false; | |||||
if (cityList != null && cityList.size() > 0) { | |||||
for (SysCityVo val : cityList) { | |||||
if (cityVo.getId().equals(val.getId())) { | |||||
exist = true; | |||||
} | |||||
} | |||||
} | |||||
if (!exist) { | |||||
cityList.add(cityVo); | cityList.add(cityVo); | ||||
} | } | ||||
} | } |
String path = inspectFile.getThumbImg().replace("_1", "_2"); | String path = inspectFile.getThumbImg().replace("_1", "_2"); | ||||
inspectFileDataVo.setFilePath(uploadUrl + path); | inspectFileDataVo.setFilePath(uploadUrl + path); | ||||
} | } | ||||
if (inspectFile.getOriginalImg() != null && inspectFile.getOriginalImg() != "") { | |||||
inspectFileDataVo.setOriginImg(uploadUrl + inspectFile.getOriginalImg()); | |||||
} | |||||
TauvInspectDriver inspectDriver = inspectDriverMapper.selectById(inspectFile.getInspectDriverId()); | TauvInspectDriver inspectDriver = inspectDriverMapper.selectById(inspectFile.getInspectDriverId()); | ||||
if (inspectDriver != null) { | if (inspectDriver != null) { |
@JsonFormat(pattern = "yyyy-MM-dd") | @JsonFormat(pattern = "yyyy-MM-dd") | ||||
private Date executionTime; | private Date executionTime; | ||||
@Length(min = 1, max = 20, message = "天气为1-20个字符") | |||||
@NotBlank(message = "天气不能为空") | |||||
/** | |||||
* 天气 | |||||
*/ | |||||
private String weather; | private String weather; | ||||
@Length(min = 1, max = 20, message = "风向为1-20个字符") | |||||
@NotBlank(message = "风向不能为空") | |||||
/** | |||||
* 风向 | |||||
*/ | |||||
private String wind; | private String wind; | ||||
@Length(min = 1, max = 20, message = "温度为1-20个字符") | |||||
@NotBlank(message = "温度不能为空") | |||||
/** | |||||
* 温度 | |||||
*/ | |||||
private String temperature; | private String temperature; | ||||
@Length(min = 1, max = 20, message = "飞行速度为1-20个字符") | |||||
@DecimalMin(value = "0", message = "飞行速度只能输入合理的数字") | |||||
@NotBlank(message = "飞行速度不能为空") | |||||
/** | |||||
* 飞行速度 | |||||
*/ | |||||
private String flightSpeed; | private String flightSpeed; | ||||
@Length(min = 1, max = 20, message = "飞行高度为1-20个字符") | |||||
@DecimalMin(value = "0", message = "飞行高度只能输入合理的数字") | |||||
@NotBlank(message = "飞行高度不能为空") | |||||
/** | |||||
* 飞行高度 | |||||
*/ | |||||
private String flightHeight; | private String flightHeight; | ||||
@Length(min = 1, max = 20, message = "飞行时间为1-20个字符") | |||||
@DecimalMin(value = "0", message = "飞行时间只能输入合理的数字") | |||||
@NotBlank(message = "飞行时间不能为空") | |||||
/** | |||||
* 飞行时间 | |||||
*/ | |||||
private String flightTime; | private String flightTime; | ||||
@Length(max = 200, message = "备注不能超过200个字符") | @Length(max = 200, message = "备注不能超过200个字符") |
*/ | */ | ||||
public class FrontBaseController { | public class FrontBaseController { | ||||
/** | |||||
* 登录用户ID | |||||
*/ | |||||
public Integer userId; | |||||
// /** | |||||
// * 登录用户ID | |||||
// */ | |||||
// public Integer userId; | |||||
/** | /** | ||||
* 将前台传递过来的日期格式的字符串,自动转化为Date类型 | * 将前台传递过来的日期格式的字符串,自动转化为Date类型 | ||||
System.out.println("初始化基类"); | System.out.println("初始化基类"); | ||||
String token = request.getHeader("token"); | String token = request.getHeader("token"); | ||||
Claims data = JwtUtil.parseJWT(token); | Claims data = JwtUtil.parseJWT(token); | ||||
this.userId = Integer.valueOf(data.get("id").toString()); | |||||
// this.userId = Integer.valueOf(data.get("id").toString()); | |||||
} | } | ||||
} | } |
package com.taauav.front.controller; | 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.ILsAdminService; | ||||
import com.taauav.admin.service.ILsAuthGroupService; | |||||
import com.taauav.admin.service.ILsCityService; | |||||
import com.taauav.admin.service.ITauvInspectFileService; | import com.taauav.admin.service.ITauvInspectFileService; | ||||
import com.taauav.common.bean.Response; | import com.taauav.common.bean.Response; | ||||
import com.taauav.common.util.StringUtils; | |||||
import com.taauav.front.dto.LsInspectFileDTO; | import com.taauav.front.dto.LsInspectFileDTO; | ||||
import com.taauav.front.utils.LoginUtils; | |||||
import com.taauav.front.vo.LSAdminVo; | import com.taauav.front.vo.LSAdminVo; | ||||
import com.taauav.front.vo.LSVillageVo; | import com.taauav.front.vo.LSVillageVo; | ||||
import com.taauav.front.vo.SysCityVo; | import com.taauav.front.vo.SysCityVo; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
import java.math.BigInteger; | import java.math.BigInteger; | ||||
import java.util.ArrayList; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
* @return | * @return | ||||
*/ | */ | ||||
@GetMapping("/info") | @GetMapping("/info") | ||||
public Response info(@RequestParam("userId") Integer userId, @RequestParam Map<String, String> map) { | |||||
public Response info(@RequestParam Map<String, String> map) { | |||||
Integer userId = LoginUtils.getAdminId(); | |||||
LSAdminVo info = lsAdminService.getAdminInfo(userId); | LSAdminVo info = lsAdminService.getAdminInfo(userId); | ||||
//数据权限处理 | //数据权限处理 | ||||
* @return | * @return | ||||
*/ | */ | ||||
@GetMapping("/village") | @GetMapping("/village") | ||||
public Response getVillageData(@RequestParam("userId")Integer userId, @RequestParam("townId") BigInteger townId, @RequestParam Map<String, String> map) { | |||||
public Response getVillageData(@RequestParam("townId") BigInteger townId, @RequestParam Map<String, String> map) { | |||||
Integer userId = LoginUtils.getAdminId(); | |||||
LSVillageVo village = lsAdminService.getVillageList(userId, townId, map); | LSVillageVo village = lsAdminService.getVillageList(userId, townId, map); | ||||
return response.success(village); | return response.success(village); | ||||
} | } |
*/ | */ | ||||
@PostMapping("/index") | @PostMapping("/index") | ||||
public Response index(@RequestBody(required = false) LSReportQuery query) { | public Response index(@RequestBody(required = false) LSReportQuery query) { | ||||
return reportService.getList(query, this.userId); | |||||
return reportService.getList(query); | |||||
} | } | ||||
/** | /** |
import com.taauav.common.util.JwtUtil; | import com.taauav.common.util.JwtUtil; | ||||
import com.taauav.common.util.StringUtils; | import com.taauav.common.util.StringUtils; | ||||
import com.taauav.front.dto.UpdatePwdDto; | import com.taauav.front.dto.UpdatePwdDto; | ||||
import com.taauav.front.utils.LoginUtils; | |||||
import io.jsonwebtoken.Claims; | import io.jsonwebtoken.Claims; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
*/ | */ | ||||
@PostMapping("/info") | @PostMapping("/info") | ||||
public Response info(HttpServletRequest request) { | public Response info(HttpServletRequest request) { | ||||
String token = request.getHeader("token"); | |||||
Claims data = JwtUtil.parseJWT(token); | |||||
Integer userId = Integer.valueOf(data.get("id").toString()); | |||||
LsAdmin adminInfo = adminService.getById(userId); | |||||
LsAdmin adminInfo = adminService.getById(LoginUtils.getAdminId()); | |||||
return response.success(adminInfo); | return response.success(adminInfo); | ||||
} | } | ||||
@PostMapping("/editPassword") | @PostMapping("/editPassword") | ||||
public Response editPassword(@RequestBody UpdatePwdDto updatePwdDto) { | public Response editPassword(@RequestBody UpdatePwdDto updatePwdDto) { | ||||
// 获取个人信息 | // 获取个人信息 | ||||
LsAdmin adminInfo = adminService.getById(this.userId); | |||||
LsAdmin adminInfo = adminService.getById(LoginUtils.getAdminId()); | |||||
if (adminInfo == null) { | if (adminInfo == null) { | ||||
return response.failure("用户信息不存在"); | return response.failure("用户信息不存在"); | ||||
} | } |
* 获取报告列表 | * 获取报告列表 | ||||
* | * | ||||
* @param query 查询条件 | * @param query 查询条件 | ||||
* @param userId 用户ID | |||||
* @return | * @return | ||||
*/ | */ | ||||
Response getList(LSReportQuery query, Integer userId); | |||||
Response getList(LSReportQuery query); | |||||
/** | /** | ||||
* 获取报告详情 | * 获取报告详情 |
import com.taauav.front.mapper.LSReportMapper; | import com.taauav.front.mapper.LSReportMapper; | ||||
import com.taauav.front.query.LSReportQuery; | import com.taauav.front.query.LSReportQuery; | ||||
import com.taauav.front.service.ILSReportService; | import com.taauav.front.service.ILSReportService; | ||||
import com.taauav.front.utils.LoginUtils; | |||||
import com.taauav.front.vo.LSReportInfoVo; | import com.taauav.front.vo.LSReportInfoVo; | ||||
import com.taauav.front.vo.LSReportListVo; | import com.taauav.front.vo.LSReportListVo; | ||||
import com.taauav.front.vo.LSReportQuestionFileListVo; | import com.taauav.front.vo.LSReportQuestionFileListVo; | ||||
/** | /** | ||||
* 获取报告列表 | * 获取报告列表 | ||||
* | * | ||||
* @param query 查询条件 | |||||
* @param userId 用户ID | |||||
* @param query 查询条件 | |||||
* @return | * @return | ||||
*/ | */ | ||||
@Override | @Override | ||||
public Response getList(LSReportQuery query, Integer userId) { | |||||
public Response getList(LSReportQuery query) { | |||||
// 查询条件 | // 查询条件 | ||||
QueryWrapper<TauvReport> queryWrapper = new QueryWrapper<>(); | QueryWrapper<TauvReport> queryWrapper = new QueryWrapper<>(); | ||||
// 报告编号 | // 报告编号 | ||||
Date endTime = DateUtil.parse(inspectEndTime + " 23:59:59", "yyyy-MM-dd HH:mm:ss"); | Date endTime = DateUtil.parse(inspectEndTime + " 23:59:59", "yyyy-MM-dd HH:mm:ss"); | ||||
queryWrapper.le("inspect_time", endTime); | queryWrapper.le("inspect_time", endTime); | ||||
} | } | ||||
// 只取审核通过的报告 | |||||
queryWrapper.eq("status", 3); | |||||
// 区划ID | // 区划ID | ||||
if (query.getDriverArea() != null) { | if (query.getDriverArea() != null) { | ||||
// 获取所有自己区划ID | // 获取所有自己区划ID | ||||
} | } | ||||
queryWrapper.in("driver_area", driverAreaList); | queryWrapper.in("driver_area", driverAreaList); | ||||
} | } | ||||
queryWrapper.eq("status", 3); | |||||
queryWrapper.eq("mark", 1); | queryWrapper.eq("mark", 1); | ||||
// 数据权限 | // 数据权限 | ||||
if (userId != 1) { | |||||
if (LoginUtils.getAdminId() != 1) { | |||||
List<BigInteger> driverAreaList = new ArrayList<>(); | List<BigInteger> driverAreaList = new ArrayList<>(); | ||||
// 获取当前登录人员信息 | // 获取当前登录人员信息 | ||||
LsAdmin lsAdmin = lsAdminMapper.selectById(userId); | |||||
LsAdmin lsAdmin = lsAdminMapper.selectById(LoginUtils.getAdminId()); | |||||
// 遍历数据权限 | // 遍历数据权限 | ||||
Map<Integer, String> map = adminService.getAdminAuthData(userId); | |||||
Map<Integer, String> map = adminService.getAdminAuthData(LoginUtils.getAdminId()); | |||||
for (Map.Entry<Integer, String> entry : map.entrySet()) { | for (Map.Entry<Integer, String> entry : map.entrySet()) { | ||||
if (entry.getKey() == 1) { | if (entry.getKey() == 1) { | ||||
// 查看本人负责的河湖 | // 查看本人负责的河湖 |
package com.taauav.front.utils; | |||||
import com.taauav.common.util.JwtUtil; | |||||
import com.taauav.common.util.StringUtils; | |||||
import io.jsonwebtoken.Claims; | |||||
/** | |||||
* 封路信息工具类 | |||||
*/ | |||||
public class LoginUtils { | |||||
/** | |||||
* 获取登录用户ID | |||||
* | |||||
* @return | |||||
*/ | |||||
public static Integer getAdminId() { | |||||
String token = ServletUtils.getRequest().getHeader("token"); | |||||
Claims data = JwtUtil.parseJWT(token); | |||||
if (!StringUtils.isEmpty(data.get("id").toString())) { | |||||
return Integer.valueOf(data.get("id").toString()); | |||||
} | |||||
return 0; | |||||
} | |||||
} |
package com.taauav.front.utils; | |||||
import org.springframework.web.context.request.RequestAttributes; | |||||
import org.springframework.web.context.request.RequestContextHolder; | |||||
import org.springframework.web.context.request.ServletRequestAttributes; | |||||
import javax.servlet.http.HttpServletRequest; | |||||
/** | |||||
* Servlet工具类 | |||||
*/ | |||||
public class ServletUtils { | |||||
/** | |||||
* 获取request | |||||
*/ | |||||
public static HttpServletRequest getRequest() { | |||||
return getRequestAttributes().getRequest(); | |||||
} | |||||
public static ServletRequestAttributes getRequestAttributes() { | |||||
RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); | |||||
return (ServletRequestAttributes) attributes; | |||||
} | |||||
} |
package com.taauav.front.vo; | package com.taauav.front.vo; | ||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import lombok.Data; | import lombok.Data; | ||||
import java.util.Date; | import java.util.Date; | ||||
private String driverAreaName; | private String driverAreaName; | ||||
@JsonFormat(pattern = "yyyy-MM-dd") | |||||
private Date executionTime; | private Date executionTime; | ||||
private String categoryText; | private String categoryText; | ||||
private String filePath; | private String filePath; | ||||
private String originImg; | |||||
} | } |
server: | server: | ||||
port: 8010 | port: 8010 | ||||
UPLOAD_URL: http://upload.yunhenggongchang.com/ | |||||
UPLOAD_URL: http://imageslishui.yunhengwang.com/ | |||||
AVATAR_URL: /data/webroot/taauav/public/uploads/ | AVATAR_URL: /data/webroot/taauav/public/uploads/ | ||||
IMAGE_URL: http://imageslishui.yunhengwang.com/ | IMAGE_URL: http://imageslishui.yunhengwang.com/ | ||||
servlet: | servlet: |