diff --git a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java index 4f42c9e..9f3cf4f 100644 --- a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java +++ b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java @@ -54,7 +54,6 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers(HttpMethod.GET,"/selectFirePoint").permitAll() .antMatchers(HttpMethod.POST,"/updateTypeByFireCode").permitAll() .antMatchers(HttpMethod.GET,"/api/user/verificationCode").permitAll() - .antMatchers(HttpMethod.POST,"/api/user/updateExpireDate").permitAll() // 所有其它请求需要身份认证 .anyRequest().authenticated() .and() diff --git a/src/main/java/com/xkrs/controller/SysUserController.java b/src/main/java/com/xkrs/controller/SysUserController.java index d662b62..8b9ae2c 100644 --- a/src/main/java/com/xkrs/controller/SysUserController.java +++ b/src/main/java/com/xkrs/controller/SysUserController.java @@ -269,7 +269,8 @@ public class SysUserController { * @return */ @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 timeNum = (Integer) map.get("timeNum"); String keepType = (String) map.get("keepType"); diff --git a/src/main/java/com/xkrs/dao/SysUserDao.java b/src/main/java/com/xkrs/dao/SysUserDao.java index 57b6069..3f945c4 100644 --- a/src/main/java/com/xkrs/dao/SysUserDao.java +++ b/src/main/java/com/xkrs/dao/SysUserDao.java @@ -82,7 +82,7 @@ public interface SysUserDao extends JpaRepository { * 查询用户信息 * @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") List selectAll(); @@ -91,7 +91,7 @@ public interface SysUserDao extends JpaRepository { * @param userName * @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") SysUserVo selectUserByUserName(String userName); diff --git a/src/main/java/com/xkrs/model/entity/SysUserEntity.java b/src/main/java/com/xkrs/model/entity/SysUserEntity.java index 8dd2789..ad31c54 100644 --- a/src/main/java/com/xkrs/model/entity/SysUserEntity.java +++ b/src/main/java/com/xkrs/model/entity/SysUserEntity.java @@ -78,6 +78,12 @@ public class SysUserEntity implements Serializable { */ private String overTime; + /** + * 账号类别 + */ + @Column(length = 64,columnDefinition = "varchar(64)") + private String accountType; + public Integer getId() { return id; } @@ -206,6 +212,14 @@ public class SysUserEntity implements Serializable { this.overTime = overTime; } + public String getAccountType() { + return accountType; + } + + public void setAccountType(String accountType) { + this.accountType = accountType; + } + @Override public String toString() { return "SysUserEntity{" + @@ -225,6 +239,7 @@ public class SysUserEntity implements Serializable { ", lastEntryIp='" + lastEntryIp + '\'' + ", dayNum=" + dayNum + ", overTime='" + overTime + '\'' + + ", accountType='" + accountType + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/model/qo/SysUserQo.java b/src/main/java/com/xkrs/model/qo/SysUserQo.java index 4bd8c57..a2d767c 100644 --- a/src/main/java/com/xkrs/model/qo/SysUserQo.java +++ b/src/main/java/com/xkrs/model/qo/SysUserQo.java @@ -58,6 +58,8 @@ public class SysUserQo { private String verificationCode; + private String accountType; + public Integer getId() { return id; } @@ -145,4 +147,12 @@ public class SysUserQo { public void setVerificationCode(String verificationCode) { this.verificationCode = verificationCode; } + + public String getAccountType() { + return accountType; + } + + public void setAccountType(String accountType) { + this.accountType = accountType; + } } diff --git a/src/main/java/com/xkrs/model/vo/SysUserVo.java b/src/main/java/com/xkrs/model/vo/SysUserVo.java index cfabeec..222fa50 100644 --- a/src/main/java/com/xkrs/model/vo/SysUserVo.java +++ b/src/main/java/com/xkrs/model/vo/SysUserVo.java @@ -20,19 +20,22 @@ public class SysUserVo implements Serializable { private String addTime; - private Integer dayNum; - 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.reallyName = reallyName; this.telephone = telephone; this.countyCode = countyCode; this.activeFlag = activeFlag; this.addTime = addTime; - this.dayNum = dayNum; this.overTime = overTime; + this.dayNum = dayNum; + this.accountType = accountType; } public Integer getId() { @@ -83,6 +86,14 @@ public class SysUserVo implements Serializable { this.addTime = addTime; } + public String getOverTime() { + return overTime; + } + + public void setOverTime(String overTime) { + this.overTime = overTime; + } + public Integer getDayNum() { return dayNum; } @@ -91,12 +102,12 @@ public class SysUserVo implements Serializable { this.dayNum = dayNum; } - public String getOverTime() { - return overTime; + public String getAccountType() { + return accountType; } - public void setOverTime(String overTime) { - this.overTime = overTime; + public void setAccountType(String accountType) { + this.accountType = accountType; } } diff --git a/src/main/java/com/xkrs/service/SysUserService.java b/src/main/java/com/xkrs/service/SysUserService.java index f8edcad..2380a3a 100644 --- a/src/main/java/com/xkrs/service/SysUserService.java +++ b/src/main/java/com/xkrs/service/SysUserService.java @@ -28,6 +28,7 @@ public interface SysUserService { /** * 保存用户 * @param sysUserQo + * @return */ String addUser(SysUserQo sysUserQo); diff --git a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java index 98bf756..29ec83b 100644 --- a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java @@ -84,7 +84,16 @@ public class SysUserServiceImpl implements SysUserService { sysUserEntity.setPassword(encry256(sysUserQo.getPassword() + salt)); sysUserEntity.setTelephone(sysUserQo.getUserName()); sysUserEntity.setCountyCode(sysUserQo.getCountyCode()); - sysUserEntity.setActiveFlag(0); + 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.setAccountType("县级"); + } sysUserEntity.setStatusCode(0); sysUserEntity.setAddTime(dateTimeToString(LocalDateTime.now())); sysUserEntity.setDeleteFlag(0); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8ecbbfb..4aab479 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -24,7 +24,7 @@ spring.datasource.hikari.validation-timeout = 3000 ## Spring Data JPA 配置 spring.jpa.database = POSTGRESQL 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) spring.jpa.hibernate.ddl-auto = update # 命名策略 @@ -38,7 +38,7 @@ spring.cache.type = redis spring.redis.database = 8 spring.redis.host = localhost spring.redis.port = 6379 -#spring.redis.password=sdust2020 +spring.redis.password=sdust2020 spring.redis.timeout = 10000 spring.redis.lettuce.pool.max-active = 100 spring.redis.lettuce.pool.max-wait = 10000