修改 新增用户 接口
This commit is contained in:
parent
209985cdf0
commit
96279d7cdc
10
pom.xml
10
pom.xml
@ -65,7 +65,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||||
<!-- <scope>provided</scope>-->
|
<!-- <scope>provided</scope>-->
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
@ -104,8 +104,8 @@
|
|||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId> mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId> mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
@ -226,6 +226,10 @@
|
|||||||
<artifactId>spring-kafka</artifactId>
|
<artifactId>spring-kafka</artifactId>
|
||||||
<version>2.5.10.RELEASE</version>
|
<version>2.5.10.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
80
src/main/java/com/xkrs/controller/StreetController.java
Normal file
80
src/main/java/com/xkrs/controller/StreetController.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package com.xkrs.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import com.xkrs.dao.CityDao;
|
||||||
|
import com.xkrs.dao.CountyDao;
|
||||||
|
import com.xkrs.dao.StreetDao;
|
||||||
|
import com.xkrs.model.entity.CityEntity;
|
||||||
|
import com.xkrs.model.entity.CountyEntity;
|
||||||
|
import com.xkrs.model.entity.StreetEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class StreetController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CityDao cityDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CountyDao countyDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StreetDao streetDao;
|
||||||
|
|
||||||
|
@GetMapping("/formatStreetData")
|
||||||
|
public String formatStreetData() {
|
||||||
|
File file = new File("/Users/liuchengqian/Downloads/Administrative-divisions-of-China-master/dist/streets2.csv");
|
||||||
|
FileInputStream fileInputStream = IoUtil.toStream(file);
|
||||||
|
BufferedReader reader = IoUtil.getReader(fileInputStream, "UTF-8");
|
||||||
|
Stream<String> lines = reader.lines();
|
||||||
|
AtomicInteger count = new AtomicInteger();
|
||||||
|
lines.forEach(content -> {
|
||||||
|
try {
|
||||||
|
content = content.replace("\"", "");
|
||||||
|
String[] split = content.split(",");
|
||||||
|
StreetEntity streetEntity = new StreetEntity();
|
||||||
|
streetEntity.setProCode(split[3] + "0000");
|
||||||
|
List<CityEntity> byProCode1 = cityDao.findByProCode(streetEntity.getProCode());
|
||||||
|
if (byProCode1 == null || byProCode1.isEmpty()) {
|
||||||
|
streetEntity.setProName("");
|
||||||
|
} else {
|
||||||
|
streetEntity.setProName(byProCode1.get(0).getProName());
|
||||||
|
}
|
||||||
|
streetEntity.setCityCode(split[4] + "00");
|
||||||
|
List<CountyEntity> byCityCode1 = countyDao.findByCityCode(streetEntity.getCityCode());
|
||||||
|
if (byCityCode1 == null || byCityCode1.isEmpty()) {
|
||||||
|
streetEntity.setCityName("");
|
||||||
|
} else {
|
||||||
|
streetEntity.setCityName(byCityCode1.get(0).getCityName());
|
||||||
|
}
|
||||||
|
streetEntity.setCountyCode(split[2]);
|
||||||
|
List<CountyEntity> byCountyCode = countyDao.findByCountyCode(streetEntity.getCountyCode());
|
||||||
|
if (byCountyCode == null || byCountyCode.isEmpty()) {
|
||||||
|
streetEntity.setCountyName("");
|
||||||
|
} else {
|
||||||
|
streetEntity.setCountyName(byCountyCode.get(0).getCountyName());
|
||||||
|
}
|
||||||
|
streetEntity.setStreetCode(split[0]);
|
||||||
|
streetEntity.setStreetName(split[1]);
|
||||||
|
streetDao.save(streetEntity);
|
||||||
|
count.getAndIncrement();
|
||||||
|
System.out.println(content + " >>> " + count);
|
||||||
|
System.out.println(streetEntity.toString());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println("格式化街道数据时发生异常:" + e.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return "666";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -34,6 +34,7 @@ import static com.xkrs.utils.EncryptDecryptUtil.encry256;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统用户Controller
|
* 系统用户Controller
|
||||||
|
*
|
||||||
* @author tajocehn
|
* @author tajocehn
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@ -51,38 +52,37 @@ public class SysUserController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录用户Token验证
|
* 登录用户Token验证
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/logged/check",method = RequestMethod.POST)
|
@RequestMapping(value = "/logged/check", method = RequestMethod.POST)
|
||||||
public String loginUserTokenCheck(){
|
public String loginUserTokenCheck() {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/check/duplicate", method = RequestMethod.POST)
|
@RequestMapping(value = "/check/duplicate", method = RequestMethod.POST)
|
||||||
public String checkDuplicate(@RequestParam(value="userName", required=false) String userName){
|
public String checkDuplicate(@RequestParam(value = "userName", required = false) String userName) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
// 验证用户名是否重复
|
// 验证用户名是否重复
|
||||||
if(!sysUserService.checkUserName(userName)){
|
if (!sysUserService.checkUserName(userName)) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL, "", locale);
|
||||||
}
|
}
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"OK",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "OK", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||||
public String addUser(@Validated({SysUserQoInsert.class}) @RequestBody SysUserQo userQo,
|
public String addUser(@Validated({SysUserQoInsert.class}) @RequestBody SysUserQo userQo, BindingResult bindingResult) {
|
||||||
BindingResult bindingResult){
|
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
// 验证数据合法性
|
// 验证数据合法性
|
||||||
if(bindingResult.hasErrors()){
|
if (bindingResult.hasErrors()) {
|
||||||
return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale);
|
return outputEncapsulationErrorList(bindingResult.getFieldErrors(), locale);
|
||||||
}
|
}
|
||||||
// 验证用户名是否重复
|
// 验证用户名是否重复
|
||||||
if(!sysUserService.checkUserName(userQo.getUserName())){
|
if (!sysUserService.checkUserName(userQo.getUserName())) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"该账号已经注册,请勿重复注册",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL, "该账号已经注册,请勿重复注册", locale);
|
||||||
}
|
}
|
||||||
// 添加新用户
|
// 添加新用户
|
||||||
return sysUserService.addUser(userQo);
|
return sysUserService.addUser(userQo);
|
||||||
@ -90,89 +90,92 @@ public class SysUserController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 软删除指定id的普通用户
|
* 软删除指定id的普通用户
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/general/delete", method = RequestMethod.DELETE)
|
@RequestMapping(value = "/general/delete", method = RequestMethod.DELETE)
|
||||||
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user')")
|
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user')")
|
||||||
public String deleteCustomUser(@RequestParam(value="userId", required=false) int id){
|
public String deleteCustomUser(@RequestParam(value = "userId", required = false) int id) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
// 验证数据合法性
|
// 验证数据合法性
|
||||||
int res = sysUserService.softDeleteGeneralUser(id);
|
int res = sysUserService.softDeleteGeneralUser(id);
|
||||||
if(res==1){
|
if (res == 1) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "", locale);
|
||||||
} else {
|
} else {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "", locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||||
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')")
|
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')")
|
||||||
public String updateUser(@Validated({SysUserQoUpdate.class}) @RequestBody SysUserQo userQo,
|
public String updateUser(@Validated({SysUserQoUpdate.class}) @RequestBody SysUserQo userQo, BindingResult bindingResult) {
|
||||||
BindingResult bindingResult){
|
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
// 验证数据合法性
|
// 验证数据合法性
|
||||||
if(bindingResult.hasErrors()){
|
if (bindingResult.hasErrors()) {
|
||||||
return outputEncapsulationErrorList(bindingResult.getFieldErrors(),locale);
|
return outputEncapsulationErrorList(bindingResult.getFieldErrors(), locale);
|
||||||
}
|
}
|
||||||
// 修改用户
|
// 修改用户
|
||||||
sysUserService.updateSysUser(userQo);
|
sysUserService.updateSysUser(userQo);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"OK",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "OK", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断用户名是否存在
|
* 判断用户名是否存在
|
||||||
|
*
|
||||||
* @param userName
|
* @param userName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/booleanUserName")
|
@GetMapping("/booleanUserName")
|
||||||
public String booleanUserName(@RequestParam("userName") String userName){
|
public String booleanUserName(@RequestParam("userName") String userName) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
Map map = new HashMap(3);
|
Map map = new HashMap(3);
|
||||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(userName);
|
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(userName);
|
||||||
if(sysUserEntity == null){
|
if (sysUserEntity == null) {
|
||||||
map.put("status",0);
|
map.put("status", 0);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,map,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, map, locale);
|
||||||
}else {
|
} else {
|
||||||
map.put("status",1);
|
map.put("status", 1);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,map,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, map, locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看用户信息
|
* 查看用户信息
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectAllUser")
|
@GetMapping("/selectAllUser")
|
||||||
@PreAuthorize("hasAnyAuthority('auth_administor')")
|
@PreAuthorize("hasAnyAuthority('auth_administor')")
|
||||||
public String selectAllUser(@RequestHeader(value="Authorization") String token){
|
public String selectAllUser(@RequestHeader(value = "Authorization") String token) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
// 验证token
|
// 验证token
|
||||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
||||||
if(sysUserEntity == null){
|
if (sysUserEntity == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
|
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR, "您还没有注册登录,请先注册登录", locale);
|
||||||
}
|
}
|
||||||
List<SysUserVo> sysUserVos = sysUserService.selectAllUser();
|
List<SysUserVo> sysUserVos = sysUserService.selectAllUser();
|
||||||
if(sysUserVos == null || sysUserVos.size() == 0){
|
if (sysUserVos == null || sysUserVos.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有任何用户数据",locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有任何用户数据", locale);
|
||||||
}
|
}
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,sysUserVos,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, sysUserVos, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理员进行启用禁用的操作
|
* 管理员进行启用禁用的操作
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/operateActiveFlag")
|
@PostMapping("/operateActiveFlag")
|
||||||
@PreAuthorize("hasAnyAuthority('auth_administor')")
|
@PreAuthorize("hasAnyAuthority('auth_administor')")
|
||||||
public String operateActiveFlag(@RequestBody Map map,@RequestHeader(value="Authorization") String token){
|
public String operateActiveFlag(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
|
||||||
Integer userId = (Integer) map.get("userId");
|
Integer userId = (Integer) map.get("userId");
|
||||||
String keepType = (String) map.get("keepType");
|
String keepType = (String) map.get("keepType");
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
@ -180,28 +183,29 @@ public class SysUserController {
|
|||||||
// 验证token
|
// 验证token
|
||||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
||||||
if(sysUserEntity == null){
|
if (sysUserEntity == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
|
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR, "您还没有注册登录,请先注册登录", locale);
|
||||||
}
|
}
|
||||||
// 如果keepType等于1进行启用操作
|
// 如果keepType等于1进行启用操作
|
||||||
if("1".equals(keepType)){
|
if ("1".equals(keepType)) {
|
||||||
sysUserService.updateEnable(userId);
|
sysUserService.updateEnable(userId);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"启用成功",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "启用成功", locale);
|
||||||
}else {
|
} else {
|
||||||
sysUserService.updateDisable(userId);
|
sysUserService.updateDisable(userId);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"禁用成功",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "禁用成功", locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户修改密码
|
* 用户修改密码
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/updatePassword")
|
@PostMapping("/updatePassword")
|
||||||
@PreAuthorize("hasAnyAuthority('auth_administor','auth_general_user')")
|
@PreAuthorize("hasAnyAuthority('auth_administor','auth_general_user')")
|
||||||
public String updatePassword(@RequestBody Map map,@RequestHeader(value="Authorization") String token){
|
public String updatePassword(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
String oldPassword = (String) map.get("oldPassword");
|
String oldPassword = (String) map.get("oldPassword");
|
||||||
@ -210,21 +214,22 @@ public class SysUserController {
|
|||||||
// 验证token
|
// 验证token
|
||||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
||||||
if(sysUserEntity == null){
|
if (sysUserEntity == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
|
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR, "您还没有注册登录,请先注册登录", locale);
|
||||||
}
|
}
|
||||||
return sysUserService.updatePassword(oldPassword,newPassword,confirmPassword,sysUserEntity);
|
return sysUserService.updatePassword(oldPassword, newPassword, confirmPassword, sysUserEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理员修改用户的密码
|
* 管理员修改用户的密码
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/adminUpdatePassword")
|
@PostMapping("/adminUpdatePassword")
|
||||||
@PreAuthorize("hasAnyAuthority('auth_administor')")
|
@PreAuthorize("hasAnyAuthority('auth_administor')")
|
||||||
public String adminUpdatePassword(@RequestBody Map map,@RequestHeader(value="Authorization") String token){
|
public String adminUpdatePassword(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
// 要修改的用户的id
|
// 要修改的用户的id
|
||||||
@ -234,40 +239,42 @@ public class SysUserController {
|
|||||||
// 验证token
|
// 验证token
|
||||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
||||||
if(sysUserEntity == null){
|
if (sysUserEntity == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
|
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR, "您还没有注册登录,请先注册登录", locale);
|
||||||
}
|
}
|
||||||
return sysUserService.adminUpdatePassword(userId,newPassword,confirmPassword);
|
return sysUserService.adminUpdatePassword(userId, newPassword, confirmPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户忘记密码
|
* 用户忘记密码
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @param
|
* @param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor=Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@PostMapping("/userUnRememberPassword")
|
@PostMapping("/userUnRememberPassword")
|
||||||
public String userUnRememberPassword(@RequestBody Map map){
|
public String userUnRememberPassword(@RequestBody Map map) {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
String phone = (String) map.get("phone");
|
String phone = (String) map.get("phone");
|
||||||
String newPassword = (String) map.get("newPassword");
|
String newPassword = (String) map.get("newPassword");
|
||||||
String confirmPassword = (String) map.get("confirmPassword");
|
String confirmPassword = (String) map.get("confirmPassword");
|
||||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(phone);
|
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(phone);
|
||||||
if(sysUserEntity == null){
|
if (sysUserEntity == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
|
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR, "您还没有注册登录,请先注册登录", locale);
|
||||||
}
|
}
|
||||||
if(!newPassword.equals(confirmPassword)){
|
if (!newPassword.equals(confirmPassword)) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"两次密码输入不一致",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "两次密码输入不一致", locale);
|
||||||
}
|
}
|
||||||
String newAfterPassword = encry256(newPassword + sysUserEntity.getSalt());
|
String newAfterPassword = encry256(newPassword + sysUserEntity.getSalt());
|
||||||
sysUserDao.updatePassword(sysUserEntity.getId(),newAfterPassword);
|
sysUserDao.updatePassword(sysUserEntity.getId(), newAfterPassword);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"密码修改成功",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "密码修改成功", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送手机号
|
* 发送手机号
|
||||||
|
*
|
||||||
* @param phone
|
* @param phone
|
||||||
* @return
|
* @return
|
||||||
* @throws ClientException
|
* @throws ClientException
|
||||||
@ -277,13 +284,14 @@ public class SysUserController {
|
|||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
String optCode = String.valueOf(RandomUtil.returnCode());
|
String optCode = String.valueOf(RandomUtil.returnCode());
|
||||||
redisService.set(phone,optCode,10, TimeUnit.MINUTES);
|
redisService.set(phone, optCode, 10, TimeUnit.MINUTES);
|
||||||
SendSmsResponse response =sendSms(phone,optCode);
|
SendSmsResponse response = sendSms(phone, optCode);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 填写手机号发送验证码,用于用户忘记密码
|
* 填写手机号发送验证码,用于用户忘记密码
|
||||||
|
*
|
||||||
* @param phone
|
* @param phone
|
||||||
* @return
|
* @return
|
||||||
* @throws ClientException
|
* @throws ClientException
|
||||||
@ -293,67 +301,70 @@ public class SysUserController {
|
|||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
SysUserVo sysUserVo = sysUserDao.selectUserByUserName(phone);
|
SysUserVo sysUserVo = sysUserDao.selectUserByUserName(phone);
|
||||||
if(sysUserVo == null){
|
if (sysUserVo == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"手机号错误,请使用您注册的手机号",locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "手机号错误,请使用您注册的手机号", locale);
|
||||||
}
|
}
|
||||||
String optCode = String.valueOf(RandomUtil.returnCode());
|
String optCode = String.valueOf(RandomUtil.returnCode());
|
||||||
redisService.set(phone,optCode,10, TimeUnit.MINUTES);
|
redisService.set(phone, optCode, 10, TimeUnit.MINUTES);
|
||||||
SendSmsResponse response =sendSms(phone,optCode);
|
SendSmsResponse response = sendSms(phone, optCode);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 输入验证码进行判断
|
* 输入验证码进行判断
|
||||||
|
*
|
||||||
* @param phone
|
* @param phone
|
||||||
* @param verificationCode
|
* @param verificationCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getVerificationCode")
|
@GetMapping("/getVerificationCode")
|
||||||
public String getVerificationCode(@RequestParam("phone") String phone, @RequestParam("verificationCode") String verificationCode){
|
public String getVerificationCode(@RequestParam("phone") String phone, @RequestParam("verificationCode") String verificationCode) {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
String o = (String) redisService.get(phone);
|
String o = (String) redisService.get(phone);
|
||||||
if("".equals(o) || o == null){
|
if ("".equals(o) || o == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"请先发送验证码!",locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "请先发送验证码!", locale);
|
||||||
}
|
}
|
||||||
if(!redisService.get(phone).equals(verificationCode)){
|
if (!redisService.get(phone).equals(verificationCode)) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"验证码错误,请重新输入!",locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "验证码错误,请重新输入!", locale);
|
||||||
}
|
}
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"true",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "true", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更改账号过期时间
|
* 更改账号过期时间
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/updateExpireDate")
|
@PostMapping("/updateExpireDate")
|
||||||
@PreAuthorize("hasAnyAuthority('auth_administor')")
|
@PreAuthorize("hasAnyAuthority('auth_administor')")
|
||||||
public String updateExpireDate(@RequestBody Map map,@RequestHeader(value="Authorization") String token){
|
public String updateExpireDate(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
|
||||||
Integer userId = (Integer) map.get("userId");
|
Integer userId = (Integer) map.get("userId");
|
||||||
Integer timeNum = (Integer) map.get("timeNum");
|
Integer timeNum = (Integer) map.get("timeNum");
|
||||||
String keepType = (String) map.get("keepType");
|
String keepType = (String) map.get("keepType");
|
||||||
if("1".equals(keepType)){
|
if ("1".equals(keepType)) {
|
||||||
return sysUserService.updateExpireDateDay(userId, timeNum);
|
return sysUserService.updateExpireDateDay(userId, timeNum);
|
||||||
}else if("2".equals(keepType)){
|
} else if ("2".equals(keepType)) {
|
||||||
return sysUserService.updateExpireDateMonth(userId,timeNum);
|
return sysUserService.updateExpireDateMonth(userId, timeNum);
|
||||||
}else if("3".equals(keepType)){
|
} else if ("3".equals(keepType)) {
|
||||||
return sysUserService.updateExpireDateYear(userId,timeNum);
|
return sysUserService.updateExpireDateYear(userId, timeNum);
|
||||||
}else {
|
} else {
|
||||||
return sysUserService.updatePermanent(userId);
|
return sysUserService.updatePermanent(userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改账号到期时间
|
* 修改账号到期时间
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @param token
|
* @param token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/updateOverTime")
|
@PostMapping("/updateOverTime")
|
||||||
@PreAuthorize("hasAnyAuthority('auth_administor')")
|
@PreAuthorize("hasAnyAuthority('auth_administor')")
|
||||||
public String updateOverTime(@RequestBody Map map,@RequestHeader(value="Authorization") String token){
|
public String updateOverTime(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
|
||||||
Integer userId = (Integer) map.get("userId");
|
Integer userId = (Integer) map.get("userId");
|
||||||
String overTime = (String) map.get("overTime");
|
String overTime = (String) map.get("overTime");
|
||||||
return sysUserService.updateOverTime(userId,overTime);
|
return sysUserService.updateOverTime(userId, overTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,17 +12,19 @@ import java.util.Map;
|
|||||||
* @author XinYi Song
|
* @author XinYi Song
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public interface CountyDao extends JpaRepository<CountyEntity,Long> {
|
public interface CountyDao extends JpaRepository<CountyEntity, Long> {
|
||||||
/**
|
/**
|
||||||
* 查询市包含的区县和编码
|
* 查询市包含的区县和编码
|
||||||
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Query(value = "select county_name cityname,county_code citycode from county where city_code = :code",nativeQuery = true)
|
@Query(value = "select county_name cityname,county_code citycode from county where city_code = :code", nativeQuery = true)
|
||||||
List<Map<String,Object>> selectCountyName(String code);
|
List<Map<String, Object>> selectCountyName(String code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据市编码查询信息
|
* 根据市编码查询信息
|
||||||
|
*
|
||||||
* @param cityCode
|
* @param cityCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -32,15 +34,18 @@ public interface CountyDao extends JpaRepository<CountyEntity,Long> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据countyCode查询信息
|
* 根据countyCode查询信息
|
||||||
|
*
|
||||||
* @param countyCode
|
* @param countyCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CountyEntity findByCountyCode(String countyCode);
|
List<CountyEntity> findByCountyCode(String countyCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据县名称查询信息
|
* 根据县名称查询信息
|
||||||
|
*
|
||||||
* @param countyName
|
* @param countyName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CountyEntity findByCountyName(String countyName);
|
List<CountyEntity> findByCountyName(String countyName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
30
src/main/java/com/xkrs/dao/StreetDao.java
Normal file
30
src/main/java/com/xkrs/dao/StreetDao.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package com.xkrs.dao;
|
||||||
|
|
||||||
|
import com.xkrs.model.entity.StreetEntity;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public interface StreetDao extends JpaRepository<StreetEntity, Integer>, JpaSpecificationExecutor<StreetEntity> {
|
||||||
|
|
||||||
|
List<StreetEntity> findByProName(String proName);
|
||||||
|
|
||||||
|
List<StreetEntity> findByProCode(String proCode);
|
||||||
|
|
||||||
|
List<StreetEntity> findByCityName(String cityName);
|
||||||
|
|
||||||
|
List<StreetEntity> findByCityCode(String cityCode);
|
||||||
|
|
||||||
|
List<StreetEntity> findByCountyName(String countyName);
|
||||||
|
|
||||||
|
List<StreetEntity> findByCountyCode(String countyCode);
|
||||||
|
|
||||||
|
Optional<StreetEntity> findByStreetName(String streetName);
|
||||||
|
|
||||||
|
Optional<StreetEntity> findByStreetCode(String streetCode);
|
||||||
|
|
||||||
|
}
|
155
src/main/java/com/xkrs/model/entity/StreetEntity.java
Normal file
155
src/main/java/com/xkrs/model/entity/StreetEntity.java
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
package com.xkrs.model.entity;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "street")
|
||||||
|
public class StreetEntity implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "street_seq_gen")
|
||||||
|
@SequenceGenerator(name = "street_seq_gen", sequenceName = "street_id_seq", allocationSize = 1)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 省名称
|
||||||
|
*/
|
||||||
|
@Column(length = 65, columnDefinition = "varchar(65)")
|
||||||
|
private String proName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 省编码
|
||||||
|
*/
|
||||||
|
@Column(length = 65, columnDefinition = "varchar(65)")
|
||||||
|
private String proCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 市名称
|
||||||
|
*/
|
||||||
|
@Column(length = 65, columnDefinition = "varchar(65)")
|
||||||
|
private String cityName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 市编码
|
||||||
|
*/
|
||||||
|
@Column(length = 65, columnDefinition = "varchar(65)")
|
||||||
|
private String cityCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区县名称
|
||||||
|
*/
|
||||||
|
@Column(length = 65, columnDefinition = "varchar(65)")
|
||||||
|
private String countyName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区县编码
|
||||||
|
*/
|
||||||
|
@Column(length = 65, columnDefinition = "varchar(65)")
|
||||||
|
private String countyCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 街道名称
|
||||||
|
*/
|
||||||
|
@Column(length = 65, columnDefinition = "varchar(65)")
|
||||||
|
private String streetName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 街道编码
|
||||||
|
*/
|
||||||
|
@Column(length = 65, columnDefinition = "varchar(65)")
|
||||||
|
private String streetCode;
|
||||||
|
|
||||||
|
public StreetEntity() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProName() {
|
||||||
|
return proName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProName(String proName) {
|
||||||
|
this.proName = proName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProCode() {
|
||||||
|
return proCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProCode(String proCode) {
|
||||||
|
this.proCode = proCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCityName() {
|
||||||
|
return cityName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCityName(String cityName) {
|
||||||
|
this.cityName = cityName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCityCode() {
|
||||||
|
return cityCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCityCode(String cityCode) {
|
||||||
|
this.cityCode = cityCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountyName() {
|
||||||
|
return countyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountyName(String countyName) {
|
||||||
|
this.countyName = countyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountyCode() {
|
||||||
|
return countyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountyCode(String countyCode) {
|
||||||
|
this.countyCode = countyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStreetName() {
|
||||||
|
return streetName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStreetName(String streetName) {
|
||||||
|
this.streetName = streetName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStreetCode() {
|
||||||
|
return streetCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStreetCode(String streetCode) {
|
||||||
|
this.streetCode = streetCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "StreetEntity{" +
|
||||||
|
"id=" + id +
|
||||||
|
", proName='" + proName + '\'' +
|
||||||
|
", proCode='" + proCode + '\'' +
|
||||||
|
", cityName='" + cityName + '\'' +
|
||||||
|
", cityCode='" + cityCode + '\'' +
|
||||||
|
", countyName='" + countyName + '\'' +
|
||||||
|
", countyCode='" + countyCode + '\'' +
|
||||||
|
", streetName='" + streetName + '\'' +
|
||||||
|
", streetCode='" + streetCode + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -98,7 +98,8 @@ public class SysUserEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String loginLastTime;
|
private String loginLastTime;
|
||||||
|
|
||||||
private Integer street;
|
public SysUserEntity() {
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
@ -260,16 +261,8 @@ public class SysUserEntity implements Serializable {
|
|||||||
this.loginLastTime = loginLastTime;
|
this.loginLastTime = loginLastTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getStreet() {
|
|
||||||
return street;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStreet(Integer street) {
|
|
||||||
this.street = street;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SysUserEntity{" + "id=" + id + ", userName='" + userName + '\'' + ", reallyName='" + reallyName + '\'' + ", password='" + password + '\'' + ", salt='" + salt + '\'' + ", telephone='" + telephone + '\'' + ", countyCode='" + countyCode + '\'' + ", signature='" + signature + '\'' + ", activeFlag=" + activeFlag + ", statusCode=" + statusCode + ", addTime='" + addTime + '\'' + ", lastEntryTime=" + lastEntryTime + ", deleteFlag=" + deleteFlag + ", lastEntryIp='" + lastEntryIp + '\'' + ", dayNum=" + dayNum + ", overTime='" + overTime + '\'' + ", accountType='" + accountType + '\'' + ", countyName='" + countyName + '\'' + ", loginNum=" + loginNum + ", loginLastTime='" + loginLastTime + '\'' + ", street=" + street + '}';
|
return "SysUserEntity{" + "id=" + id + ", userName='" + userName + '\'' + ", reallyName='" + reallyName + '\'' + ", password='" + password + '\'' + ", salt='" + salt + '\'' + ", telephone='" + telephone + '\'' + ", countyCode='" + countyCode + '\'' + ", signature='" + signature + '\'' + ", activeFlag=" + activeFlag + ", statusCode=" + statusCode + ", addTime='" + addTime + '\'' + ", lastEntryTime=" + lastEntryTime + ", deleteFlag=" + deleteFlag + ", lastEntryIp='" + lastEntryIp + '\'' + ", dayNum=" + dayNum + ", overTime='" + overTime + '\'' + ", accountType='" + accountType + '\'' + ", countyName='" + countyName + '\'' + ", loginNum=" + loginNum + ", loginLastTime='" + loginLastTime + '\'' + '}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,10 @@ public class SysUserQo {
|
|||||||
@Range(min = 0, max = 2, message = "{SysUser.statusCode.illegal}", groups = {SysUserQoInsert.class, SysUserQoUpdate.class})
|
@Range(min = 0, max = 2, message = "{SysUser.statusCode.illegal}", groups = {SysUserQoInsert.class, SysUserQoUpdate.class})
|
||||||
private Integer statusCode;
|
private Integer statusCode;
|
||||||
|
|
||||||
|
@NotNull(message = "{SysUser.countyName.blank}", groups = {SysUserQoUpdate.class})
|
||||||
|
private String countyName;
|
||||||
|
|
||||||
|
@NotNull(message = "{SysUser.countyCode.blank}", groups = {SysUserQoUpdate.class})
|
||||||
private String countyCode;
|
private String countyCode;
|
||||||
|
|
||||||
@NotNull(message = "{SysUser.deleteFlag.null}", groups = {SysUserQoUpdate.class})
|
@NotNull(message = "{SysUser.deleteFlag.null}", groups = {SysUserQoUpdate.class})
|
||||||
@ -54,10 +58,8 @@ public class SysUserQo {
|
|||||||
|
|
||||||
private String accountType;
|
private String accountType;
|
||||||
|
|
||||||
private String countyName;
|
public SysUserQo() {
|
||||||
|
}
|
||||||
@NotNull(message = "{SysUser.street.blank}", groups = {SysUserQoUpdate.class})
|
|
||||||
private Integer street;
|
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
@ -107,6 +109,14 @@ public class SysUserQo {
|
|||||||
this.statusCode = statusCode;
|
this.statusCode = statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCountyName() {
|
||||||
|
return countyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountyName(String countyName) {
|
||||||
|
this.countyName = countyName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCountyCode() {
|
public String getCountyCode() {
|
||||||
return countyCode;
|
return countyCode;
|
||||||
}
|
}
|
||||||
@ -154,20 +164,4 @@ public class SysUserQo {
|
|||||||
public void setAccountType(String accountType) {
|
public void setAccountType(String accountType) {
|
||||||
this.accountType = accountType;
|
this.accountType = accountType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCountyName() {
|
|
||||||
return countyName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCountyName(String countyName) {
|
|
||||||
this.countyName = countyName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getStreet() {
|
|
||||||
return street;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStreet(Integer street) {
|
|
||||||
this.street = street;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -76,27 +76,28 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加火点信息
|
* 添加火点信息
|
||||||
|
*
|
||||||
* @param firePointQo
|
* @param firePointQo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@CacheEvict(value = "FirePointServiceCache",allEntries = true)
|
@CacheEvict(value = "FirePointServiceCache", allEntries = true)
|
||||||
@Override
|
@Override
|
||||||
public FirePointEntity insertFirePoint(FirePointQo firePointQo) {
|
public FirePointEntity insertFirePoint(FirePointQo firePointQo) {
|
||||||
FirePointEntity firePointEntity = new FirePointEntity();
|
FirePointEntity firePointEntity = new FirePointEntity();
|
||||||
if(firePointQo.getLandtype().equals("水体")){
|
if (firePointQo.getLandtype().equals("水体")) {
|
||||||
return null;
|
return null;
|
||||||
}else if("Himawari 8".equals(firePointQo.getSatelliteType()) && "L".equals(firePointQo.getConfidence())){
|
} else if ("Himawari 8".equals(firePointQo.getSatelliteType()) && "L".equals(firePointQo.getConfidence())) {
|
||||||
return null;
|
return null;
|
||||||
}else if("Himawari 8".equals(firePointQo.getSatelliteType()) && "N".equals(firePointQo.getConfidence())){
|
} else if ("Himawari 8".equals(firePointQo.getSatelliteType()) && "N".equals(firePointQo.getConfidence())) {
|
||||||
return null;
|
return null;
|
||||||
}else {
|
} else {
|
||||||
firePointEntity.setFireCode(firePointQo.getFireCode());
|
firePointEntity.setFireCode(firePointQo.getFireCode());
|
||||||
firePointEntity.setCountyCode(firePointQo.getCountyCode().toString());
|
firePointEntity.setCountyCode(firePointQo.getCountyCode().toString());
|
||||||
firePointEntity.setCountyName(firePointQo.getCountyName());
|
firePointEntity.setCountyName(firePointQo.getCountyName());
|
||||||
firePointEntity.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue()));
|
firePointEntity.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue()));
|
||||||
firePointEntity.setLongitude(firePointQo.getLongitude());
|
firePointEntity.setLongitude(firePointQo.getLongitude());
|
||||||
firePointEntity.setLatitude(firePointQo.getLatitude());
|
firePointEntity.setLatitude(firePointQo.getLatitude());
|
||||||
firePointEntity.setFirePointAddress(AddressUtils.getLocal(firePointQo.getLatitude().toString(),firePointQo.getLongitude().toString()));
|
firePointEntity.setFirePointAddress(AddressUtils.getLocal(firePointQo.getLatitude().toString(), firePointQo.getLongitude().toString()));
|
||||||
firePointEntity.setSatelliteType(firePointQo.getSatelliteType());
|
firePointEntity.setSatelliteType(firePointQo.getSatelliteType());
|
||||||
firePointEntity.setLandType(firePointQo.getLandtype());
|
firePointEntity.setLandType(firePointQo.getLandtype());
|
||||||
firePointEntity.setConfidence(firePointQo.getConfidence());
|
firePointEntity.setConfidence(firePointQo.getConfidence());
|
||||||
@ -127,44 +128,46 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询今天的火点信息
|
* 查询今天的火点信息
|
||||||
|
*
|
||||||
* @param
|
* @param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(keyGenerator = "keyGenerator", unless="#result == null")
|
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
||||||
@Override
|
@Override
|
||||||
public List<FirePointEntity> selectTodayFirePoint(String countyCode) {
|
public List<FirePointEntity> selectTodayFirePoint(String countyCode) {
|
||||||
String addTime = DateTimeUtil.dateToString(LocalDate.now());
|
String addTime = DateTimeUtil.dateToString(LocalDate.now());
|
||||||
if("0000".equals(countyCode.substring(2))){
|
if ("0000".equals(countyCode.substring(2))) {
|
||||||
List<CityEntity> byProCode = cityDao.findByProCode(countyCode);
|
List<CityEntity> byProCode = cityDao.findByProCode(countyCode);
|
||||||
String proName = byProCode.get(0).getProName();
|
String proName = byProCode.get(0).getProName();
|
||||||
// if(proName.equals("山东省")){
|
// if(proName.equals("山东省")){
|
||||||
// return firePointDao.selectTodayFirePointShandong(addTime,proName);
|
// return firePointDao.selectTodayFirePointShandong(addTime,proName);
|
||||||
// }
|
// }
|
||||||
return firePointDao.selectTodayFirePoint(addTime,proName);
|
return firePointDao.selectTodayFirePoint(addTime, proName);
|
||||||
|
|
||||||
}else if("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))){
|
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
||||||
List<CountyEntity> byCityCode = countyDao.findByCityCode(countyCode);
|
List<CountyEntity> byCityCode = countyDao.findByCityCode(countyCode);
|
||||||
String cityName = byCityCode.get(0).getCityName();
|
String cityName = byCityCode.get(0).getCityName();
|
||||||
CityEntity byCityName = cityDao.findByCityName(cityName);
|
CityEntity byCityName = cityDao.findByCityName(cityName);
|
||||||
// if(byCityName.getProName().equals("山东省")){
|
// if(byCityName.getProName().equals("山东省")){
|
||||||
// return firePointDao.selectTodayFirePointShandong(addTime,cityName);
|
// return firePointDao.selectTodayFirePointShandong(addTime,cityName);
|
||||||
// }
|
// }
|
||||||
return firePointDao.selectTodayFirePoint(addTime,cityName);
|
return firePointDao.selectTodayFirePoint(addTime, cityName);
|
||||||
}else {
|
} else {
|
||||||
CountyEntity byCountyCode = countyDao.findByCountyCode(countyCode);
|
List<CountyEntity> byCountyCode = countyDao.findByCountyCode(countyCode);
|
||||||
CityEntity byCityName = cityDao.findByCityName(byCountyCode.getCityName());
|
CityEntity byCityName = cityDao.findByCityName(byCountyCode.get(0).getCityName());
|
||||||
// if(b
|
// if(b
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// yCityName.getProName().equals("山东省")){
|
// yCityName.getProName().equals("山东省")){
|
||||||
// return firePointDao.selectTodayFirePointOneShandong(addTime,countyCode);
|
// return firePointDao.selectTodayFirePointOneShandong(addTime,countyCode);
|
||||||
// }
|
// }
|
||||||
return firePointDao.selectTodayFirePointOne(addTime,countyCode);
|
return firePointDao.selectTodayFirePointOne(addTime, countyCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态多条件查询火点信息(省)
|
* 动态多条件查询火点信息(省)
|
||||||
|
*
|
||||||
* @param cityCode
|
* @param cityCode
|
||||||
* @param satelliteType
|
* @param satelliteType
|
||||||
* @param landType
|
* @param landType
|
||||||
@ -172,32 +175,33 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
* @param endTime
|
* @param endTime
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(keyGenerator = "keyGenerator", unless="#result == null")
|
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
||||||
@Override
|
@Override
|
||||||
public List<FirePointEntity> selectFirePoint(String proCode,String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
public List<FirePointEntity> selectFirePoint(String proCode, String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||||
List<CityEntity> byProCode = cityDao.findByProCode(proCode);
|
List<CityEntity> byProCode = cityDao.findByProCode(proCode);
|
||||||
String proName = byProCode.get(0).getProName();
|
String proName = byProCode.get(0).getProName();
|
||||||
if(!"".equals(startTime) && !"".equals(endTime)){
|
if (!"".equals(startTime) && !"".equals(endTime)) {
|
||||||
LocalDate localDate = DateTimeUtil.stringToDate(endTime);
|
LocalDate localDate = DateTimeUtil.stringToDate(endTime);
|
||||||
// 结束时间
|
// 结束时间
|
||||||
LocalDate localDate1 = localDate.plusDays(1);
|
LocalDate localDate1 = localDate.plusDays(1);
|
||||||
String dateToString = DateTimeUtil.dateToString(localDate1);
|
String dateToString = DateTimeUtil.dateToString(localDate1);
|
||||||
return query.selectFirePointByPro(proName,cityCode, satelliteType, landType, startTime, dateToString);
|
return query.selectFirePointByPro(proName, cityCode, satelliteType, landType, startTime, dateToString);
|
||||||
}
|
}
|
||||||
return query.selectFirePointByPro(proName,cityCode, satelliteType, landType, startTime, endTime);
|
return query.selectFirePointByPro(proName, cityCode, satelliteType, landType, startTime, endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态多条件查询火点信息(市)
|
* 动态多条件查询火点信息(市)
|
||||||
* @param cityCodeOne 市编码
|
*
|
||||||
* @param cityCode 县编码
|
* @param cityCodeOne 市编码
|
||||||
|
* @param cityCode 县编码
|
||||||
* @param satelliteType
|
* @param satelliteType
|
||||||
* @param landType
|
* @param landType
|
||||||
* @param startTime
|
* @param startTime
|
||||||
* @param endTime
|
* @param endTime
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(keyGenerator = "keyGenerator", unless="#result == null")
|
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
||||||
@Override
|
@Override
|
||||||
public List<FirePointEntity> selectFirePointByCity(String cityCodeOne, String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
public List<FirePointEntity> selectFirePointByCity(String cityCodeOne, String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||||
//List<CityEntity> byCityCode = cityDao.findByCityCode(cityCodeOne.substring(0,3));
|
//List<CityEntity> byCityCode = cityDao.findByCityCode(cityCodeOne.substring(0,3));
|
||||||
@ -205,44 +209,46 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
String cityName = byCityCode.get(0).getCityName();
|
String cityName = byCityCode.get(0).getCityName();
|
||||||
CityEntity byCityCode1 = cityDao.findByCityName(cityName);
|
CityEntity byCityCode1 = cityDao.findByCityName(cityName);
|
||||||
String proName = byCityCode1.getProName();
|
String proName = byCityCode1.getProName();
|
||||||
if(!"".equals(startTime) && !"".equals(endTime)){
|
if (!"".equals(startTime) && !"".equals(endTime)) {
|
||||||
LocalDate localDate = DateTimeUtil.stringToDate(endTime);
|
LocalDate localDate = DateTimeUtil.stringToDate(endTime);
|
||||||
// 结束时间
|
// 结束时间
|
||||||
LocalDate localDate1 = localDate.plusDays(1);
|
LocalDate localDate1 = localDate.plusDays(1);
|
||||||
String dateToString = DateTimeUtil.dateToString(localDate1);
|
String dateToString = DateTimeUtil.dateToString(localDate1);
|
||||||
return query.selectFirePointByCity(proName, cityName,cityCode,satelliteType,landType,startTime,dateToString);
|
return query.selectFirePointByCity(proName, cityName, cityCode, satelliteType, landType, startTime, dateToString);
|
||||||
}
|
}
|
||||||
return query.selectFirePointByCity(proName, cityName,cityCode,satelliteType,landType,startTime,endTime);
|
return query.selectFirePointByCity(proName, cityName, cityCode, satelliteType, landType, startTime, endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态多条件查询火点信息(县)
|
* 动态多条件查询火点信息(县)
|
||||||
* @param cityCode 县编码
|
*
|
||||||
|
* @param cityCode 县编码
|
||||||
* @param satelliteType
|
* @param satelliteType
|
||||||
* @param landType
|
* @param landType
|
||||||
* @param startTime
|
* @param startTime
|
||||||
* @param endTime
|
* @param endTime
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(keyGenerator = "keyGenerator", unless="#result == null")
|
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
||||||
@Override
|
@Override
|
||||||
public List<FirePointEntity> selectFirePointByCounty(String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
public List<FirePointEntity> selectFirePointByCounty(String cityCode, String satelliteType, String landType, String startTime, String endTime) {
|
||||||
|
|
||||||
CountyEntity byCountyCode = countyDao.findByCountyCode(cityCode);
|
List<CountyEntity> byCountyCode = countyDao.findByCountyCode(cityCode);
|
||||||
CityEntity byCityCode = cityDao.findByCityName(byCountyCode.getCityName());
|
CityEntity byCityCode = cityDao.findByCityName(byCountyCode.get(0).getCityName());
|
||||||
String proName = byCityCode.getProName();
|
String proName = byCityCode.getProName();
|
||||||
if(!"".equals(startTime) && !"".equals(endTime)){
|
if (!"".equals(startTime) && !"".equals(endTime)) {
|
||||||
LocalDate localDate = DateTimeUtil.stringToDate(endTime);
|
LocalDate localDate = DateTimeUtil.stringToDate(endTime);
|
||||||
// 结束时间
|
// 结束时间
|
||||||
LocalDate localDate1 = localDate.plusDays(1);
|
LocalDate localDate1 = localDate.plusDays(1);
|
||||||
String dateToString = DateTimeUtil.dateToString(localDate1);
|
String dateToString = DateTimeUtil.dateToString(localDate1);
|
||||||
return query.selectFirePointByCounty(proName, cityCode,satelliteType,landType,startTime,dateToString);
|
return query.selectFirePointByCounty(proName, cityCode, satelliteType, landType, startTime, dateToString);
|
||||||
}
|
}
|
||||||
return query.selectFirePointByCounty(proName, cityCode,satelliteType,landType,startTime,endTime);
|
return query.selectFirePointByCounty(proName, cityCode, satelliteType, landType, startTime, endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据火点编码修改火点的状态(预警)
|
* 根据火点编码修改火点的状态(预警)
|
||||||
|
*
|
||||||
* @param fireCode
|
* @param fireCode
|
||||||
* @param fireType
|
* @param fireType
|
||||||
* @param token
|
* @param token
|
||||||
@ -257,20 +263,20 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
||||||
FirePointEntity byFireCode = firePointDao.findByFireCode(fireCode);
|
FirePointEntity byFireCode = firePointDao.findByFireCode(fireCode);
|
||||||
if ("3".equals(byFireCode.getFireType()) || "-1".equals(byFireCode.getFireType())) {
|
if ("3".equals(byFireCode.getFireType()) || "-1".equals(byFireCode.getFireType())) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"该火点已经结案,请勿进行有关状态操作",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "该火点已经结案,请勿进行有关状态操作", locale);
|
||||||
}
|
}
|
||||||
if (fireType.equals(byFireCode.getFireType())) {
|
if (fireType.equals(byFireCode.getFireType())) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"您正处于当前的状态,请勿进行该操作",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "您正处于当前的状态,请勿进行该操作", locale);
|
||||||
}
|
}
|
||||||
firePointDao.updateFireTypeByFireCode(fireCode, fireType);
|
firePointDao.updateFireTypeByFireCode(fireCode, fireType);
|
||||||
if ("1".equals(fireType)) {
|
if ("1".equals(fireType)) {
|
||||||
FirePointEntity byFireCode1 = firePointDao.findByFireCode(fireCode);
|
FirePointEntity byFireCode1 = firePointDao.findByFireCode(fireCode);
|
||||||
// 预警
|
// 预警
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,byFireCode1,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byFireCode1, locale);
|
||||||
} else if ("2".equals(fireType)){
|
} else if ("2".equals(fireType)) {
|
||||||
FirePointEntity byFireCode3 = firePointDao.findByFireCode(fireCode);
|
FirePointEntity byFireCode3 = firePointDao.findByFireCode(fireCode);
|
||||||
// 核查
|
// 核查
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,byFireCode3,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byFireCode3, locale);
|
||||||
} else {
|
} else {
|
||||||
String rangerType = "0";
|
String rangerType = "0";
|
||||||
FireAndRanger byFireCode1 = fireAndRangerDao.findByFireCode(fireCode);
|
FireAndRanger byFireCode1 = fireAndRangerDao.findByFireCode(fireCode);
|
||||||
@ -284,19 +290,20 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
fireAndRanger.setEndTime(time);
|
fireAndRanger.setEndTime(time);
|
||||||
fireAndRangerDao.save(fireAndRanger);
|
fireAndRangerDao.save(fireAndRanger);
|
||||||
// 结案
|
// 结案
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,byFireCode4,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byFireCode4, locale);
|
||||||
}
|
}
|
||||||
// 火点结案,将护林员的状态修改为0 表示该护林员没有在执行任务,处于空闲状态
|
// 火点结案,将护林员的状态修改为0 表示该护林员没有在执行任务,处于空闲状态
|
||||||
forestRangerDao.updateRangerTypeByPhone(byFireCode1.getRangerName(), rangerType);
|
forestRangerDao.updateRangerTypeByPhone(byFireCode1.getRangerName(), rangerType);
|
||||||
String time = DateTimeUtil.dateTimeToString(LocalDateTime.now());
|
String time = DateTimeUtil.dateTimeToString(LocalDateTime.now());
|
||||||
fireAndRangerDao.updateEndTimeByFireCode(fireCode, time);
|
fireAndRangerDao.updateEndTimeByFireCode(fireCode, time);
|
||||||
fireAndRangerDao.updateProgressTypeByFireCode(fireCode, "0");
|
fireAndRangerDao.updateProgressTypeByFireCode(fireCode, "0");
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"结案",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "结案", locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交核查任务
|
* 提交核查任务
|
||||||
|
*
|
||||||
* @param files
|
* @param files
|
||||||
* @param appTaskBodyVo
|
* @param appTaskBodyVo
|
||||||
* @return
|
* @return
|
||||||
@ -307,12 +314,12 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
FirePointEntity byFireCode = firePointDao.findByFireCode(appTaskBodyVo.getFireCode());
|
FirePointEntity byFireCode = firePointDao.findByFireCode(appTaskBodyVo.getFireCode());
|
||||||
if(byFireCode == null){
|
if (byFireCode == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"火点编码错误,请重新输入",locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "火点编码错误,请重新输入", locale);
|
||||||
}
|
}
|
||||||
FireTask byTaskFireCode = fireTaskDao.findByTaskFireCode(appTaskBodyVo.getFireCode());
|
FireTask byTaskFireCode = fireTaskDao.findByTaskFireCode(appTaskBodyVo.getFireCode());
|
||||||
if(byTaskFireCode != null){
|
if (byTaskFireCode != null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"该火点的任务已经提交,请勿重复提交",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "该火点的任务已经提交,请勿重复提交", locale);
|
||||||
}
|
}
|
||||||
String s = DateTimeUtil.dateTimeToString(LocalDateTime.now());
|
String s = DateTimeUtil.dateTimeToString(LocalDateTime.now());
|
||||||
FireTask fireTask = new FireTask();
|
FireTask fireTask = new FireTask();
|
||||||
@ -320,19 +327,20 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
fireTask.setTaskInformation(appTaskBodyVo.getTaskInformation());
|
fireTask.setTaskInformation(appTaskBodyVo.getTaskInformation());
|
||||||
fireTask.setTaskTime(s);
|
fireTask.setTaskTime(s);
|
||||||
FireTask save = fireTaskDao.save(fireTask);
|
FireTask save = fireTaskDao.save(fireTask);
|
||||||
if(save == null){
|
if (save == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"任务提交失败",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "任务提交失败", locale);
|
||||||
}
|
}
|
||||||
List<FireTaskPhoto> fireTaskPhotos = PhotoUtil.uploadImage(files, appTaskBodyVo.getFireCode());
|
List<FireTaskPhoto> fireTaskPhotos = PhotoUtil.uploadImage(files, appTaskBodyVo.getFireCode());
|
||||||
List<FireTaskPhoto> fireTaskPhotos1 = fireTaskPhotoDao.saveAll(fireTaskPhotos);
|
List<FireTaskPhoto> fireTaskPhotos1 = fireTaskPhotoDao.saveAll(fireTaskPhotos);
|
||||||
if(fireTaskPhotos1 == null || fireTaskPhotos1.size() == 0){
|
if (fireTaskPhotos1 == null || fireTaskPhotos1.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"图片上传失败,任务提交失败",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "图片上传失败,任务提交失败", locale);
|
||||||
}
|
}
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"任务提交成功",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "任务提交成功", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据火点编码查询任务信息
|
* 根据火点编码查询任务信息
|
||||||
|
*
|
||||||
* @param fireCode
|
* @param fireCode
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@ -342,26 +350,27 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
FireTask byTaskFireCode = fireTaskDao.findByTaskFireCode(fireCode);
|
FireTask byTaskFireCode = fireTaskDao.findByTaskFireCode(fireCode);
|
||||||
if(byTaskFireCode == null){
|
if (byTaskFireCode == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有该火点的任务信息",locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该火点的任务信息", locale);
|
||||||
}
|
}
|
||||||
AppTaskBodyVo appTaskBodyVo = new AppTaskBodyVo();
|
AppTaskBodyVo appTaskBodyVo = new AppTaskBodyVo();
|
||||||
// 做映射,返回vo类对象
|
// 做映射,返回vo类对象
|
||||||
BeanCopier beanCopier = BeanCopier.create(FireTask.class, AppTaskBodyVo.class, false);
|
BeanCopier beanCopier = BeanCopier.create(FireTask.class, AppTaskBodyVo.class, false);
|
||||||
beanCopier.copy(byTaskFireCode,appTaskBodyVo,null);
|
beanCopier.copy(byTaskFireCode, appTaskBodyVo, null);
|
||||||
|
|
||||||
List<Object[]> photoPath = fireTaskPhotoDao.findPhotoPath(fireCode);
|
List<Object[]> photoPath = fireTaskPhotoDao.findPhotoPath(fireCode);
|
||||||
List<AppPhotoVo> appPhotoVos = ObjectToBeanUtils.objectToBean(photoPath, AppPhotoVo.class);
|
List<AppPhotoVo> appPhotoVos = ObjectToBeanUtils.objectToBean(photoPath, AppPhotoVo.class);
|
||||||
appTaskBodyVo.setTaskFirePhoto(appPhotoVos);
|
appTaskBodyVo.setTaskFirePhoto(appPhotoVos);
|
||||||
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,appTaskBodyVo,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, appTaskBodyVo, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询近一周的火点信息
|
* 查询近一周的火点信息
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(keyGenerator = "keyGenerator", unless="#result == null")
|
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
||||||
@Override
|
@Override
|
||||||
public List<FirePointEntity> selectFirePointBetweenSeven() {
|
public List<FirePointEntity> selectFirePointBetweenSeven() {
|
||||||
LocalDateTime localDateTime = LocalDateTime.now();
|
LocalDateTime localDateTime = LocalDateTime.now();
|
||||||
@ -375,9 +384,10 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询近一个月的火点信息
|
* 查询近一个月的火点信息
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(keyGenerator = "keyGenerator", unless="#result == null")
|
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
||||||
@Override
|
@Override
|
||||||
public List<FirePointEntity> selectFirePointByMonth(String countyCode) {
|
public List<FirePointEntity> selectFirePointByMonth(String countyCode) {
|
||||||
LocalDateTime localDateTime = LocalDateTime.now();
|
LocalDateTime localDateTime = LocalDateTime.now();
|
||||||
@ -385,30 +395,31 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
// 当前时间减31
|
// 当前时间减31
|
||||||
LocalDateTime localDateTime1 = localDateTime.minusDays(31);
|
LocalDateTime localDateTime1 = localDateTime.minusDays(31);
|
||||||
String startTime = DateTimeUtil.dateTimeToString(localDateTime1);
|
String startTime = DateTimeUtil.dateTimeToString(localDateTime1);
|
||||||
if("0000".equals(countyCode.substring(2))){
|
if ("0000".equals(countyCode.substring(2))) {
|
||||||
List<CityEntity> byProCode = cityDao.findByProCode(countyCode);
|
List<CityEntity> byProCode = cityDao.findByProCode(countyCode);
|
||||||
String proName = byProCode.get(0).getProName();
|
String proName = byProCode.get(0).getProName();
|
||||||
return query.selectFirePointByMonth(proName,startTime,endTime);
|
return query.selectFirePointByMonth(proName, startTime, endTime);
|
||||||
}else if("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))){
|
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
||||||
List<CountyEntity> byCityCode = countyDao.findByCityCode(countyCode);
|
List<CountyEntity> byCityCode = countyDao.findByCityCode(countyCode);
|
||||||
String cityName = byCityCode.get(0).getCityName();
|
String cityName = byCityCode.get(0).getCityName();
|
||||||
CityEntity byCityName = cityDao.findByCityName(cityName);
|
CityEntity byCityName = cityDao.findByCityName(cityName);
|
||||||
String proName = byCityName.getProName();
|
String proName = byCityName.getProName();
|
||||||
return query.selectFirePointByMonthCity(proName, cityName,startTime,endTime);
|
return query.selectFirePointByMonthCity(proName, cityName, startTime, endTime);
|
||||||
}else {
|
} else {
|
||||||
CountyEntity byCountyCode = countyDao.findByCountyCode(countyCode);
|
List<CountyEntity> byCountyCode = countyDao.findByCountyCode(countyCode);
|
||||||
CityEntity byCityName = cityDao.findByCityName(byCountyCode.getCityName());
|
CityEntity byCityName = cityDao.findByCityName(byCountyCode.get(0).getCityName());
|
||||||
String proName = byCityName.getProName();
|
String proName = byCityName.getProName();
|
||||||
return query.selectFirePointByMonthCounty(proName, countyCode,startTime,endTime);
|
return query.selectFirePointByMonthCounty(proName, countyCode, startTime, endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询近一个月的火点数量
|
* 查询近一个月的火点数量
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(keyGenerator = "keyGenerator", unless="#result == null")
|
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
||||||
@Override
|
@Override
|
||||||
public String selectFirePointNumMonth() {
|
public String selectFirePointNumMonth() {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
@ -422,19 +433,20 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
String startTime = DateTimeUtil.dateTimeToString(localDateTime1);
|
String startTime = DateTimeUtil.dateTimeToString(localDateTime1);
|
||||||
// 查询近一个月各植被类型的火点数量
|
// 查询近一个月各植被类型的火点数量
|
||||||
List<Map<String, Object>> maps = firePointDao.selectNumByLandType(startTime, endTime);
|
List<Map<String, Object>> maps = firePointDao.selectNumByLandType(startTime, endTime);
|
||||||
map.put("land",maps);
|
map.put("land", maps);
|
||||||
// 查询近一个月各地区火点数量
|
// 查询近一个月各地区火点数量
|
||||||
List<Map<String, Object>> maps1 = firePointDao.selectNumByArea(startTime, endTime);
|
List<Map<String, Object>> maps1 = firePointDao.selectNumByArea(startTime, endTime);
|
||||||
map.put("area",maps1);
|
map.put("area", maps1);
|
||||||
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,map,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, map, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询近一天的火点数量
|
* 查询近一天的火点数量
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(keyGenerator = "keyGenerator", unless="#result == null")
|
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
||||||
@Override
|
@Override
|
||||||
public String selectFirePointNumDay() {
|
public String selectFirePointNumDay() {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
@ -448,19 +460,20 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
String startTime = DateTimeUtil.dateTimeToString(localDateTime1);
|
String startTime = DateTimeUtil.dateTimeToString(localDateTime1);
|
||||||
// 查询近一个月各植被类型的火点数量
|
// 查询近一个月各植被类型的火点数量
|
||||||
List<Map<String, Object>> maps = firePointDao.selectNumByLandType(startTime, endTime);
|
List<Map<String, Object>> maps = firePointDao.selectNumByLandType(startTime, endTime);
|
||||||
map.put("land",maps);
|
map.put("land", maps);
|
||||||
// 查询近一个月各地区火点数量
|
// 查询近一个月各地区火点数量
|
||||||
List<Map<String, Object>> maps1 = firePointDao.selectNumByArea(startTime, endTime);
|
List<Map<String, Object>> maps1 = firePointDao.selectNumByArea(startTime, endTime);
|
||||||
map.put("area",maps1);
|
map.put("area", maps1);
|
||||||
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,map,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, map, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询近一周的火点数量
|
* 查询近一周的火点数量
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(keyGenerator = "keyGenerator", unless="#result == null")
|
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
||||||
@Override
|
@Override
|
||||||
public String selectFirePointNumWeek() {
|
public String selectFirePointNumWeek() {
|
||||||
// 获取区域信息
|
// 获取区域信息
|
||||||
@ -474,16 +487,17 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
String startTime = DateTimeUtil.dateTimeToString(localDateTime1);
|
String startTime = DateTimeUtil.dateTimeToString(localDateTime1);
|
||||||
// 查询近一个月各植被类型的火点数量
|
// 查询近一个月各植被类型的火点数量
|
||||||
List<Map<String, Object>> maps = firePointDao.selectNumByLandType(startTime, endTime);
|
List<Map<String, Object>> maps = firePointDao.selectNumByLandType(startTime, endTime);
|
||||||
map.put("land",maps);
|
map.put("land", maps);
|
||||||
// 查询近一个月各地区火点数量
|
// 查询近一个月各地区火点数量
|
||||||
List<Map<String, Object>> maps1 = firePointDao.selectNumByArea(startTime, endTime);
|
List<Map<String, Object>> maps1 = firePointDao.selectNumByArea(startTime, endTime);
|
||||||
map.put("area",maps1);
|
map.put("area", maps1);
|
||||||
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,map,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, map, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询该省所有的市
|
* 查询该省所有的市
|
||||||
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -494,6 +508,7 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询市包含的区县和编码
|
* 查询市包含的区县和编码
|
||||||
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -504,6 +519,7 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试插入火点信息
|
* 测试插入火点信息
|
||||||
|
*
|
||||||
* @param firePointQo
|
* @param firePointQo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -516,7 +532,7 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
firePoint.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue()));
|
firePoint.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue()));
|
||||||
firePoint.setLongitude(firePointQo.getLongitude());
|
firePoint.setLongitude(firePointQo.getLongitude());
|
||||||
firePoint.setLatitude(firePointQo.getLatitude());
|
firePoint.setLatitude(firePointQo.getLatitude());
|
||||||
firePoint.setFirePointAddress(AddressUtils.getLocal(firePointQo.getLatitude().toString(),firePointQo.getLongitude().toString()));
|
firePoint.setFirePointAddress(AddressUtils.getLocal(firePointQo.getLatitude().toString(), firePointQo.getLongitude().toString()));
|
||||||
firePoint.setSatelliteType(firePointQo.getSatelliteType());
|
firePoint.setSatelliteType(firePointQo.getSatelliteType());
|
||||||
firePoint.setLandType(firePointQo.getLandtype());
|
firePoint.setLandType(firePointQo.getLandtype());
|
||||||
firePoint.setConfidence(firePointQo.getConfidence());
|
firePoint.setConfidence(firePointQo.getConfidence());
|
||||||
@ -530,6 +546,7 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入全国省市区
|
* 导入全国省市区
|
||||||
|
*
|
||||||
* @param file
|
* @param file
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@ -557,22 +574,23 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询今日的火点信息(测试)
|
* 查询今日的火点信息(测试)
|
||||||
|
*
|
||||||
* @param countyCode
|
* @param countyCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<FirePoint> selectTodayFire(String countyCode) {
|
public List<FirePoint> selectTodayFire(String countyCode) {
|
||||||
String addTime = DateTimeUtil.dateToString(LocalDate.now());
|
String addTime = DateTimeUtil.dateToString(LocalDate.now());
|
||||||
if("0000".equals(countyCode.substring(2))){
|
if ("0000".equals(countyCode.substring(2))) {
|
||||||
List<CityEntity> byProCode = cityDao.findByProCode(countyCode);
|
List<CityEntity> byProCode = cityDao.findByProCode(countyCode);
|
||||||
String proName = byProCode.get(0).getProName();
|
String proName = byProCode.get(0).getProName();
|
||||||
return fireDao.selectTodayFire(addTime,proName);
|
return fireDao.selectTodayFire(addTime, proName);
|
||||||
}else if("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))){
|
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
||||||
List<CountyEntity> byCityCode = countyDao.findByCityCode(countyCode);
|
List<CountyEntity> byCityCode = countyDao.findByCityCode(countyCode);
|
||||||
String cityName = byCityCode.get(0).getCityName();
|
String cityName = byCityCode.get(0).getCityName();
|
||||||
return fireDao.selectTodayFire(addTime,cityName);
|
return fireDao.selectTodayFire(addTime, cityName);
|
||||||
}else {
|
} else {
|
||||||
return fireDao.selectTodayFireOne(addTime,countyCode);
|
return fireDao.selectTodayFireOne(addTime, countyCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||||
import static com.xkrs.utils.DateTimeUtil.dateTimeToString;
|
import static com.xkrs.utils.DateTimeUtil.dateTimeToString;
|
||||||
@ -50,11 +51,14 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
@Resource
|
@Resource
|
||||||
private NationwideDao nationwideDao;
|
private NationwideDao nationwideDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CityDao cityDao;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private CountyDao countyDao;
|
private CountyDao countyDao;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private CityDao cityDao;
|
private StreetDao streetDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查用户名是否存在
|
* 检查用户名是否存在
|
||||||
@ -80,7 +84,6 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
String salt = KeyGenerators.string().generateKey();
|
String salt = KeyGenerators.string().generateKey();
|
||||||
SysUserEntity sysUserEntity = new SysUserEntity();
|
SysUserEntity sysUserEntity = new SysUserEntity();
|
||||||
sysUserEntity.setStreet(0);
|
|
||||||
sysUserEntity.setUserName(sysUserQo.getUserName());
|
sysUserEntity.setUserName(sysUserQo.getUserName());
|
||||||
String o = (String) redisService.get(sysUserQo.getUserName());
|
String o = (String) redisService.get(sysUserQo.getUserName());
|
||||||
if ("".equals(o) || o == null) {
|
if ("".equals(o) || o == null) {
|
||||||
@ -97,56 +100,72 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
sysUserEntity.setPassword(encry256(sysUserQo.getPassword() + salt));
|
sysUserEntity.setPassword(encry256(sysUserQo.getPassword() + salt));
|
||||||
sysUserEntity.setTelephone(sysUserQo.getUserName());
|
sysUserEntity.setTelephone(sysUserQo.getUserName());
|
||||||
|
|
||||||
if (TextUtils.isEmpty(sysUserQo.getCountyName())) {
|
String countyCode = sysUserQo.getCountyCode();
|
||||||
|
String countyName = sysUserQo.getCountyName();
|
||||||
|
if (TextUtils.isEmpty(countyCode)) {
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "省市区街道编码不能为空!", locale);
|
||||||
|
}
|
||||||
|
if (TextUtils.isEmpty(countyName)) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "省市区街道名称不能为空!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "省市区街道名称不能为空!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setCountyCode(sysUserQo.getCountyCode());
|
|
||||||
|
|
||||||
if (1 == sysUserQo.getStreet()) {
|
if (9 == countyCode.length()) {
|
||||||
|
Optional<StreetEntity> byStreetCodeOptional = streetDao.findByStreetCode(countyCode);
|
||||||
|
if (byStreetCodeOptional.isEmpty()) {
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "街道编码不存在!", locale);
|
||||||
|
}
|
||||||
|
Optional<StreetEntity> byStreetNameOptional = streetDao.findByStreetName(countyName);
|
||||||
|
if (byStreetNameOptional.isEmpty()) {
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
|
}
|
||||||
sysUserEntity.setActiveFlag(0);
|
sysUserEntity.setActiveFlag(0);
|
||||||
sysUserEntity.setAccountType("街道级");
|
sysUserEntity.setAccountType("街道级");
|
||||||
} else if ("0000".equals(sysUserQo.getCountyCode().substring(2))) {
|
} else if ("0000".equals(countyCode.substring(2))) {
|
||||||
List<CityEntity> byProCode = cityDao.findByProCode(sysUserQo.getCountyCode());
|
List<CityEntity> byProCode = cityDao.findByProCode(countyCode);
|
||||||
if (byProCode == null || byProCode.size() == 0) {
|
if (byProCode == null || byProCode.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "省编码不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "省编码不存在!", locale);
|
||||||
}
|
}
|
||||||
List<CityEntity> byProName = cityDao.findByProName(sysUserQo.getCountyName());
|
List<CityEntity> byProName = cityDao.findByProName(countyName);
|
||||||
if (byProName == null || byProName.size() == 0) {
|
if (byProName == null || byProName.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(1);
|
sysUserEntity.setActiveFlag(1);
|
||||||
sysUserEntity.setAccountType("省级");
|
sysUserEntity.setAccountType("省级");
|
||||||
} else if ("00".equals(sysUserQo.getCountyCode().substring(4)) && !"0000".equals(sysUserQo.getCountyCode().substring(2))) {
|
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
||||||
List<CountyEntity> byCityCode = countyDao.findByCityCode(sysUserQo.getCountyCode());
|
List<CountyEntity> byCityCode = countyDao.findByCityCode(countyCode);
|
||||||
if (byCityCode == null || byCityCode.size() == 0) {
|
if (byCityCode == null || byCityCode.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "市编码不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "市编码不存在!", locale);
|
||||||
}
|
}
|
||||||
List<CountyEntity> byCityName = countyDao.findByCityName(sysUserQo.getCountyName());
|
List<CountyEntity> byCityName = countyDao.findByCityName(countyName);
|
||||||
if (byCityName == null || byCityName.size() == 0) {
|
if (byCityName == null || byCityName.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(1);
|
sysUserEntity.setActiveFlag(1);
|
||||||
sysUserEntity.setAccountType("市级");
|
sysUserEntity.setAccountType("市级");
|
||||||
} else {
|
} else {
|
||||||
CountyEntity byCountyCode = countyDao.findByCountyCode(sysUserQo.getCountyCode());
|
List<CountyEntity> byCountyCode = countyDao.findByCountyCode(countyCode);
|
||||||
if (byCountyCode == null) {
|
if (byCountyCode == null || byCountyCode.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "编码不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "区县编码不存在!", locale);
|
||||||
}
|
}
|
||||||
CountyEntity byCountyName = countyDao.findByCountyName(sysUserQo.getCountyName());
|
List<CountyEntity> byCountyName = countyDao.findByCountyName(countyName);
|
||||||
if (byCountyName == null) {
|
if (byCountyName == null || byCountyName.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
|
||||||
}
|
}
|
||||||
sysUserEntity.setActiveFlag(0);
|
sysUserEntity.setActiveFlag(0);
|
||||||
sysUserEntity.setAccountType("县级");
|
sysUserEntity.setAccountType("县级");
|
||||||
}
|
}
|
||||||
|
if (9 == countyCode.length()) {//街道账号5天后过期
|
||||||
|
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(5L)));
|
||||||
|
} else {//省市区县账号3天后过期
|
||||||
|
sysUserEntity.setOverTime(dateTimeToString(LocalDateTime.now().plusDays(3L)));
|
||||||
|
}
|
||||||
sysUserEntity.setStatusCode(0);
|
sysUserEntity.setStatusCode(0);
|
||||||
sysUserEntity.setAddTime(dateTimeToString(LocalDateTime.now()));
|
sysUserEntity.setAddTime(dateTimeToString(LocalDateTime.now()));
|
||||||
sysUserEntity.setDeleteFlag(0);
|
sysUserEntity.setDeleteFlag(0);
|
||||||
sysUserEntity.setDayNum(7);
|
sysUserEntity.setDayNum(7);
|
||||||
String string = dateTimeToString(LocalDateTime.now().plusDays(3L));
|
|
||||||
sysUserEntity.setOverTime(string);
|
|
||||||
sysUserEntity.setLoginNum(0);
|
sysUserEntity.setLoginNum(0);
|
||||||
sysUserEntity.setCountyName(sysUserQo.getCountyName());
|
sysUserEntity.setCountyCode(countyCode);
|
||||||
|
sysUserEntity.setCountyName(countyName);
|
||||||
sysUserDao.save(sysUserEntity);
|
sysUserDao.save(sysUserEntity);
|
||||||
|
|
||||||
RelUserRoleEntity relUserRoleEntity = new RelUserRoleEntity();
|
RelUserRoleEntity relUserRoleEntity = new RelUserRoleEntity();
|
||||||
|
Loading…
Reference in New Issue
Block a user