修改 新增用户 接口

This commit is contained in:
liuchengqian 2022-05-06 17:49:37 +08:00
parent 209985cdf0
commit 96279d7cdc
10 changed files with 530 additions and 221 deletions

View File

@ -226,6 +226,10 @@
<artifactId>spring-kafka</artifactId>
<version>2.5.10.RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>

View 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";
}
}

View File

@ -34,6 +34,7 @@ import static com.xkrs.utils.EncryptDecryptUtil.encry256;
/**
* 系统用户Controller
*
* @author tajocehn
*/
@RestController
@ -51,6 +52,7 @@ public class SysUserController {
/**
* 登录用户Token验证
*
* @return
*/
@RequestMapping(value = "/logged/check", method = RequestMethod.POST)
@ -70,10 +72,8 @@ public class SysUserController {
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "OK", locale);
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
public String addUser(@Validated({SysUserQoInsert.class}) @RequestBody SysUserQo userQo,
BindingResult bindingResult){
public String addUser(@Validated({SysUserQoInsert.class}) @RequestBody SysUserQo userQo, BindingResult bindingResult) {
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
// 验证数据合法性
@ -90,6 +90,7 @@ public class SysUserController {
/**
* 软删除指定id的普通用户
*
* @param id
* @return
*/
@ -109,8 +110,7 @@ public class SysUserController {
@RequestMapping(value = "/update", method = RequestMethod.POST)
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')")
public String updateUser(@Validated({SysUserQoUpdate.class}) @RequestBody SysUserQo userQo,
BindingResult bindingResult){
public String updateUser(@Validated({SysUserQoUpdate.class}) @RequestBody SysUserQo userQo, BindingResult bindingResult) {
// 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
// 验证数据合法性
@ -124,6 +124,7 @@ public class SysUserController {
/**
* 判断用户名是否存在
*
* @param userName
* @return
*/
@ -144,6 +145,7 @@ public class SysUserController {
/**
* 查看用户信息
*
* @return
*/
@GetMapping("/selectAllUser")
@ -166,6 +168,7 @@ public class SysUserController {
/**
* 管理员进行启用禁用的操作
*
* @param map
* @param token
* @return
@ -195,6 +198,7 @@ public class SysUserController {
/**
* 用户修改密码
*
* @param map
* @param token
* @return
@ -218,6 +222,7 @@ public class SysUserController {
/**
* 管理员修改用户的密码
*
* @param map
* @param token
* @return
@ -242,6 +247,7 @@ public class SysUserController {
/**
* 用户忘记密码
*
* @param map
* @param
* @return
@ -268,6 +274,7 @@ public class SysUserController {
/**
* 发送手机号
*
* @param phone
* @return
* @throws ClientException
@ -284,6 +291,7 @@ public class SysUserController {
/**
* 填写手机号发送验证码用于用户忘记密码
*
* @param phone
* @return
* @throws ClientException
@ -304,6 +312,7 @@ public class SysUserController {
/**
* 输入验证码进行判断
*
* @param phone
* @param verificationCode
* @return
@ -323,6 +332,7 @@ public class SysUserController {
/**
* 更改账号过期时间
*
* @return
*/
@PostMapping("/updateExpireDate")
@ -344,6 +354,7 @@ public class SysUserController {
/**
* 修改账号到期时间
*
* @param map
* @param token
* @return

View File

@ -15,6 +15,7 @@ import java.util.Map;
public interface CountyDao extends JpaRepository<CountyEntity, Long> {
/**
* 查询市包含的区县和编码
*
* @param code
* @return
*/
@ -23,6 +24,7 @@ public interface CountyDao extends JpaRepository<CountyEntity,Long> {
/**
* 根据市编码查询信息
*
* @param cityCode
* @return
*/
@ -32,15 +34,18 @@ public interface CountyDao extends JpaRepository<CountyEntity,Long> {
/**
* 根据countyCode查询信息
*
* @param countyCode
* @return
*/
CountyEntity findByCountyCode(String countyCode);
List<CountyEntity> findByCountyCode(String countyCode);
/**
* 根据县名称查询信息
*
* @param countyName
* @return
*/
CountyEntity findByCountyName(String countyName);
List<CountyEntity> findByCountyName(String countyName);
}

View 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);
}

View 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 + '\'' +
'}';
}
}

View File

@ -98,7 +98,8 @@ public class SysUserEntity implements Serializable {
*/
private String loginLastTime;
private Integer street;
public SysUserEntity() {
}
public Integer getId() {
return id;
@ -260,16 +261,8 @@ public class SysUserEntity implements Serializable {
this.loginLastTime = loginLastTime;
}
public Integer getStreet() {
return street;
}
public void setStreet(Integer street) {
this.street = street;
}
@Override
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 + '\'' + '}';
}
}

View File

@ -41,6 +41,10 @@ public class SysUserQo {
@Range(min = 0, max = 2, message = "{SysUser.statusCode.illegal}", groups = {SysUserQoInsert.class, SysUserQoUpdate.class})
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;
@NotNull(message = "{SysUser.deleteFlag.null}", groups = {SysUserQoUpdate.class})
@ -54,10 +58,8 @@ public class SysUserQo {
private String accountType;
private String countyName;
@NotNull(message = "{SysUser.street.blank}", groups = {SysUserQoUpdate.class})
private Integer street;
public SysUserQo() {
}
public Integer getId() {
return id;
@ -107,6 +109,14 @@ public class SysUserQo {
this.statusCode = statusCode;
}
public String getCountyName() {
return countyName;
}
public void setCountyName(String countyName) {
this.countyName = countyName;
}
public String getCountyCode() {
return countyCode;
}
@ -154,20 +164,4 @@ public class SysUserQo {
public void setAccountType(String 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;
}
}

View File

@ -76,6 +76,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 添加火点信息
*
* @param firePointQo
* @return
*/
@ -127,6 +128,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 查询今天的火点信息
*
* @param
* @return
*/
@ -151,8 +153,8 @@ public class FirePointServiceImpl implements FirePointService {
// }
return firePointDao.selectTodayFirePoint(addTime, cityName);
} else {
CountyEntity byCountyCode = countyDao.findByCountyCode(countyCode);
CityEntity byCityName = cityDao.findByCityName(byCountyCode.getCityName());
List<CountyEntity> byCountyCode = countyDao.findByCountyCode(countyCode);
CityEntity byCityName = cityDao.findByCityName(byCountyCode.get(0).getCityName());
// if(b
//
//
@ -165,6 +167,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 动态多条件查询火点信息
*
* @param cityCode
* @param satelliteType
* @param landType
@ -189,6 +192,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 动态多条件查询火点信息
*
* @param cityCodeOne 市编码
* @param cityCode 县编码
* @param satelliteType
@ -217,6 +221,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 动态多条件查询火点信息
*
* @param cityCode 县编码
* @param satelliteType
* @param landType
@ -228,8 +233,8 @@ public class FirePointServiceImpl implements FirePointService {
@Override
public List<FirePointEntity> selectFirePointByCounty(String cityCode, String satelliteType, String landType, String startTime, String endTime) {
CountyEntity byCountyCode = countyDao.findByCountyCode(cityCode);
CityEntity byCityCode = cityDao.findByCityName(byCountyCode.getCityName());
List<CountyEntity> byCountyCode = countyDao.findByCountyCode(cityCode);
CityEntity byCityCode = cityDao.findByCityName(byCountyCode.get(0).getCityName());
String proName = byCityCode.getProName();
if (!"".equals(startTime) && !"".equals(endTime)) {
LocalDate localDate = DateTimeUtil.stringToDate(endTime);
@ -243,6 +248,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 根据火点编码修改火点的状态预警
*
* @param fireCode
* @param fireType
* @param token
@ -297,6 +303,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 提交核查任务
*
* @param files
* @param appTaskBodyVo
* @return
@ -333,6 +340,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 根据火点编码查询任务信息
*
* @param fireCode
* @return
* @throws Exception
@ -359,6 +367,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 查询近一周的火点信息
*
* @return
*/
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
@ -375,6 +384,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 查询近一个月的火点信息
*
* @return
*/
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
@ -396,8 +406,8 @@ public class FirePointServiceImpl implements FirePointService {
String proName = byCityName.getProName();
return query.selectFirePointByMonthCity(proName, cityName, startTime, endTime);
} else {
CountyEntity byCountyCode = countyDao.findByCountyCode(countyCode);
CityEntity byCityName = cityDao.findByCityName(byCountyCode.getCityName());
List<CountyEntity> byCountyCode = countyDao.findByCountyCode(countyCode);
CityEntity byCityName = cityDao.findByCityName(byCountyCode.get(0).getCityName());
String proName = byCityName.getProName();
return query.selectFirePointByMonthCounty(proName, countyCode, startTime, endTime);
}
@ -406,6 +416,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 查询近一个月的火点数量
*
* @return
*/
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
@ -432,6 +443,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 查询近一天的火点数量
*
* @return
*/
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
@ -458,6 +470,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 查询近一周的火点数量
*
* @return
*/
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
@ -484,6 +497,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 查询该省所有的市
*
* @param code
* @return
*/
@ -494,6 +508,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 查询市包含的区县和编码
*
* @param code
* @return
*/
@ -504,6 +519,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 测试插入火点信息
*
* @param firePointQo
* @return
*/
@ -530,6 +546,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 导入全国省市区
*
* @param file
* @throws Exception
*/
@ -557,6 +574,7 @@ public class FirePointServiceImpl implements FirePointService {
/**
* 查询今日的火点信息测试
*
* @param countyCode
* @return
*/

View File

@ -19,6 +19,7 @@ import java.time.LocalDateTime;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
import static com.xkrs.utils.DateTimeUtil.dateTimeToString;
@ -50,11 +51,14 @@ public class SysUserServiceImpl implements SysUserService {
@Resource
private NationwideDao nationwideDao;
@Resource
private CityDao cityDao;
@Resource
private CountyDao countyDao;
@Resource
private CityDao cityDao;
private StreetDao streetDao;
/**
* 检查用户名是否存在
@ -80,7 +84,6 @@ public class SysUserServiceImpl implements SysUserService {
Locale locale = LocaleContextHolder.getLocale();
String salt = KeyGenerators.string().generateKey();
SysUserEntity sysUserEntity = new SysUserEntity();
sysUserEntity.setStreet(0);
sysUserEntity.setUserName(sysUserQo.getUserName());
String o = (String) redisService.get(sysUserQo.getUserName());
if ("".equals(o) || o == null) {
@ -97,56 +100,72 @@ public class SysUserServiceImpl implements SysUserService {
sysUserEntity.setPassword(encry256(sysUserQo.getPassword() + salt));
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);
}
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.setAccountType("街道级");
} else if ("0000".equals(sysUserQo.getCountyCode().substring(2))) {
List<CityEntity> byProCode = cityDao.findByProCode(sysUserQo.getCountyCode());
} else if ("0000".equals(countyCode.substring(2))) {
List<CityEntity> byProCode = cityDao.findByProCode(countyCode);
if (byProCode == null || byProCode.size() == 0) {
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) {
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
}
sysUserEntity.setActiveFlag(1);
sysUserEntity.setAccountType("省级");
} else if ("00".equals(sysUserQo.getCountyCode().substring(4)) && !"0000".equals(sysUserQo.getCountyCode().substring(2))) {
List<CountyEntity> byCityCode = countyDao.findByCityCode(sysUserQo.getCountyCode());
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
List<CountyEntity> byCityCode = countyDao.findByCityCode(countyCode);
if (byCityCode == null || byCityCode.size() == 0) {
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) {
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
}
sysUserEntity.setActiveFlag(1);
sysUserEntity.setAccountType("市级");
} else {
CountyEntity byCountyCode = countyDao.findByCountyCode(sysUserQo.getCountyCode());
if (byCountyCode == null) {
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "编码不存在!", locale);
List<CountyEntity> byCountyCode = countyDao.findByCountyCode(countyCode);
if (byCountyCode == null || byCountyCode.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "区县编码不存在!", locale);
}
CountyEntity byCountyName = countyDao.findByCountyName(sysUserQo.getCountyName());
if (byCountyName == null) {
List<CountyEntity> byCountyName = countyDao.findByCountyName(countyName);
if (byCountyName == null || byCountyName.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "您所选择的区域不存在!", locale);
}
sysUserEntity.setActiveFlag(0);
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.setAddTime(dateTimeToString(LocalDateTime.now()));
sysUserEntity.setDeleteFlag(0);
sysUserEntity.setDayNum(7);
String string = dateTimeToString(LocalDateTime.now().plusDays(3L));
sysUserEntity.setOverTime(string);
sysUserEntity.setLoginNum(0);
sysUserEntity.setCountyName(sysUserQo.getCountyName());
sysUserEntity.setCountyCode(countyCode);
sysUserEntity.setCountyName(countyName);
sysUserDao.save(sysUserEntity);
RelUserRoleEntity relUserRoleEntity = new RelUserRoleEntity();