修改了用户注册的接口

This commit is contained in:
DESKTOP-G8BCEP0\HP 2021-08-06 11:36:13 +08:00
parent c75dac763e
commit 6935329dfa
9 changed files with 61 additions and 15 deletions

View File

@ -54,7 +54,6 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(HttpMethod.GET,"/selectFirePoint").permitAll() .antMatchers(HttpMethod.GET,"/selectFirePoint").permitAll()
.antMatchers(HttpMethod.POST,"/updateTypeByFireCode").permitAll() .antMatchers(HttpMethod.POST,"/updateTypeByFireCode").permitAll()
.antMatchers(HttpMethod.GET,"/api/user/verificationCode").permitAll() .antMatchers(HttpMethod.GET,"/api/user/verificationCode").permitAll()
.antMatchers(HttpMethod.POST,"/api/user/updateExpireDate").permitAll()
// 所有其它请求需要身份认证 // 所有其它请求需要身份认证
.anyRequest().authenticated() .anyRequest().authenticated()
.and() .and()

View File

@ -269,7 +269,8 @@ public class SysUserController {
* @return * @return
*/ */
@PostMapping("/updateExpireDate") @PostMapping("/updateExpireDate")
public String updateExpireDate(@RequestBody Map map){ @PreAuthorize("hasAnyAuthority('auth_administor')")
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");

View File

@ -82,7 +82,7 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
* 查询用户信息 * 查询用户信息
* @return * @return
*/ */
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,dayNum,overTime) " + @Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType) " +
"from SysUserEntity") "from SysUserEntity")
List<SysUserVo> selectAll(); List<SysUserVo> selectAll();
@ -91,7 +91,7 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
* @param userName * @param userName
* @return * @return
*/ */
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,dayNum,overTime) " + @Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType) " +
"from SysUserEntity where userName = :userName") "from SysUserEntity where userName = :userName")
SysUserVo selectUserByUserName(String userName); SysUserVo selectUserByUserName(String userName);

View File

@ -78,6 +78,12 @@ public class SysUserEntity implements Serializable {
*/ */
private String overTime; private String overTime;
/**
* 账号类别
*/
@Column(length = 64,columnDefinition = "varchar(64)")
private String accountType;
public Integer getId() { public Integer getId() {
return id; return id;
} }
@ -206,6 +212,14 @@ public class SysUserEntity implements Serializable {
this.overTime = overTime; this.overTime = overTime;
} }
public String getAccountType() {
return accountType;
}
public void setAccountType(String accountType) {
this.accountType = accountType;
}
@Override @Override
public String toString() { public String toString() {
return "SysUserEntity{" + return "SysUserEntity{" +
@ -225,6 +239,7 @@ public class SysUserEntity implements Serializable {
", lastEntryIp='" + lastEntryIp + '\'' + ", lastEntryIp='" + lastEntryIp + '\'' +
", dayNum=" + dayNum + ", dayNum=" + dayNum +
", overTime='" + overTime + '\'' + ", overTime='" + overTime + '\'' +
", accountType='" + accountType + '\'' +
'}'; '}';
} }
} }

View File

@ -58,6 +58,8 @@ public class SysUserQo {
private String verificationCode; private String verificationCode;
private String accountType;
public Integer getId() { public Integer getId() {
return id; return id;
} }
@ -145,4 +147,12 @@ public class SysUserQo {
public void setVerificationCode(String verificationCode) { public void setVerificationCode(String verificationCode) {
this.verificationCode = verificationCode; this.verificationCode = verificationCode;
} }
public String getAccountType() {
return accountType;
}
public void setAccountType(String accountType) {
this.accountType = accountType;
}
} }

View File

@ -20,19 +20,22 @@ public class SysUserVo implements Serializable {
private String addTime; private String addTime;
private Integer dayNum;
private String overTime; private String overTime;
public SysUserVo(Integer id, String reallyName, String telephone, String countyCode, Integer activeFlag, String addTime, Integer dayNum, String overTime) { private Integer dayNum;
private String accountType;
public SysUserVo(Integer id, String reallyName, String telephone, String countyCode, Integer activeFlag, String addTime, String overTime, Integer dayNum, String accountType) {
this.id = id; this.id = id;
this.reallyName = reallyName; this.reallyName = reallyName;
this.telephone = telephone; this.telephone = telephone;
this.countyCode = countyCode; this.countyCode = countyCode;
this.activeFlag = activeFlag; this.activeFlag = activeFlag;
this.addTime = addTime; this.addTime = addTime;
this.dayNum = dayNum;
this.overTime = overTime; this.overTime = overTime;
this.dayNum = dayNum;
this.accountType = accountType;
} }
public Integer getId() { public Integer getId() {
@ -83,6 +86,14 @@ public class SysUserVo implements Serializable {
this.addTime = addTime; this.addTime = addTime;
} }
public String getOverTime() {
return overTime;
}
public void setOverTime(String overTime) {
this.overTime = overTime;
}
public Integer getDayNum() { public Integer getDayNum() {
return dayNum; return dayNum;
} }
@ -91,12 +102,12 @@ public class SysUserVo implements Serializable {
this.dayNum = dayNum; this.dayNum = dayNum;
} }
public String getOverTime() { public String getAccountType() {
return overTime; return accountType;
} }
public void setOverTime(String overTime) { public void setAccountType(String accountType) {
this.overTime = overTime; this.accountType = accountType;
} }
} }

View File

@ -28,6 +28,7 @@ public interface SysUserService {
/** /**
* 保存用户 * 保存用户
* @param sysUserQo * @param sysUserQo
* @return
*/ */
String addUser(SysUserQo sysUserQo); String addUser(SysUserQo sysUserQo);

View File

@ -84,7 +84,16 @@ 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());
sysUserEntity.setCountyCode(sysUserQo.getCountyCode()); sysUserEntity.setCountyCode(sysUserQo.getCountyCode());
if("0000".equals(sysUserQo.getCountyCode().substring(2))){
sysUserEntity.setActiveFlag(1);
sysUserEntity.setAccountType("省级");
}else if("00".equals(sysUserQo.getCountyCode().substring(4)) && !"0000".equals(sysUserQo.getCountyCode().substring(2))){
sysUserEntity.setActiveFlag(1);
sysUserEntity.setAccountType("市级");
}else {
sysUserEntity.setActiveFlag(0); sysUserEntity.setActiveFlag(0);
sysUserEntity.setAccountType("县级");
}
sysUserEntity.setStatusCode(0); sysUserEntity.setStatusCode(0);
sysUserEntity.setAddTime(dateTimeToString(LocalDateTime.now())); sysUserEntity.setAddTime(dateTimeToString(LocalDateTime.now()));
sysUserEntity.setDeleteFlag(0); sysUserEntity.setDeleteFlag(0);

View File

@ -24,7 +24,7 @@ spring.datasource.hikari.validation-timeout = 3000
## Spring Data JPA 配置 ## Spring Data JPA 配置
spring.jpa.database = POSTGRESQL spring.jpa.database = POSTGRESQL
spring.jpa.database-platform = org.hibernate.dialect.PostgreSQLDialect spring.jpa.database-platform = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.show-sql = true spring.jpa.show-sql = false
# 指定 ddl mode (none, validate, create, create-drop, update) # 指定 ddl mode (none, validate, create, create-drop, update)
spring.jpa.hibernate.ddl-auto = update spring.jpa.hibernate.ddl-auto = update
# 命名策略 # 命名策略
@ -38,7 +38,7 @@ spring.cache.type = redis
spring.redis.database = 8 spring.redis.database = 8
spring.redis.host = localhost spring.redis.host = localhost
spring.redis.port = 6379 spring.redis.port = 6379
#spring.redis.password=sdust2020 spring.redis.password=sdust2020
spring.redis.timeout = 10000 spring.redis.timeout = 10000
spring.redis.lettuce.pool.max-active = 100 spring.redis.lettuce.pool.max-active = 100
spring.redis.lettuce.pool.max-wait = 10000 spring.redis.lettuce.pool.max-wait = 10000