From 85ffb7d594a5601f0932a09b69262009458e5838 Mon Sep 17 00:00:00 2001 From: "DESKTOP-G8BCEP0\\HP" <2037158277@qq.com> Date: Tue, 10 Aug 2021 08:41:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=A4=9A=E6=9D=A1=E4=BB=B6=E6=9F=A5=E8=AF=A2=E7=9A=84=E5=8E=BF?= =?UTF-8?q?=E7=BA=A7=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../account/CustomAuthenticationProvider.java | 1 + .../xkrs/common/config/WebSecurityConfig.java | 1 + .../xkrs/controller/FirePointController.java | 2 +- src/main/java/com/xkrs/dao/SysUserDao.java | 4 +-- .../com/xkrs/model/entity/SysUserEntity.java | 26 +++++++++++++++++++ .../java/com/xkrs/model/qo/SysUserQo.java | 10 +++++++ .../java/com/xkrs/model/vo/SysUserVo.java | 13 +++++++++- .../service/impl/FirePointServiceImpl.java | 1 - .../xkrs/service/impl/SysUserServiceImpl.java | 1 + src/main/resources/application.properties | 2 +- 10 files changed, 55 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/xkrs/common/account/CustomAuthenticationProvider.java b/src/main/java/com/xkrs/common/account/CustomAuthenticationProvider.java index 3248a08..a5486c3 100644 --- a/src/main/java/com/xkrs/common/account/CustomAuthenticationProvider.java +++ b/src/main/java/com/xkrs/common/account/CustomAuthenticationProvider.java @@ -100,6 +100,7 @@ public class CustomAuthenticationProvider implements AuthenticationProvider { for(SysAuthorityEntity sysAuthorityEntity : permissionList) { permissions.add(new GrantedAuthorityImpl(sysAuthorityEntity.getAuthorityName())); } + // 生成令牌 Authentication authToken = new UsernamePasswordAuthenticationToken(userName, encryptPassword, permissions); return authToken; diff --git a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java index 9f3cf4f..7943196 100644 --- a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java +++ b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java @@ -51,6 +51,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers(HttpMethod.GET,"/websocketTest").permitAll() .antMatchers(HttpMethod.GET,"/selectCityName").permitAll() .antMatchers(HttpMethod.GET,"/weather/cityName").permitAll() + .antMatchers(HttpMethod.GET,"/weather/cityId").permitAll() .antMatchers(HttpMethod.GET,"/selectFirePoint").permitAll() .antMatchers(HttpMethod.POST,"/updateTypeByFireCode").permitAll() .antMatchers(HttpMethod.GET,"/api/user/verificationCode").permitAll() diff --git a/src/main/java/com/xkrs/controller/FirePointController.java b/src/main/java/com/xkrs/controller/FirePointController.java index 80491c0..6c89e75 100644 --- a/src/main/java/com/xkrs/controller/FirePointController.java +++ b/src/main/java/com/xkrs/controller/FirePointController.java @@ -136,7 +136,7 @@ public class FirePointController { return outputEncapsulationObject(PromptMessageEnum.SUCCESS,firePointEntities,locale); // 查询县 }else { - List firePointEntities = firePointService.selectFirePointByCounty(cityCode, satelliteType, landType, startTime, endTime); + List firePointEntities = firePointService.selectFirePointByCounty(sysUserEntity.getCountyCode(), satelliteType, landType, startTime, endTime); if(firePointEntities == null || firePointEntities.size() == 0){ return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有火点数据",locale); } diff --git a/src/main/java/com/xkrs/dao/SysUserDao.java b/src/main/java/com/xkrs/dao/SysUserDao.java index 3f945c4..4c1a77a 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,overTime,dayNum,accountType) " + + @Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName) " + "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,overTime,dayNum,accountType) " + + @Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName) " + "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 ad31c54..6157ad2 100644 --- a/src/main/java/com/xkrs/model/entity/SysUserEntity.java +++ b/src/main/java/com/xkrs/model/entity/SysUserEntity.java @@ -84,6 +84,14 @@ public class SysUserEntity implements Serializable { @Column(length = 64,columnDefinition = "varchar(64)") private String accountType; + @Column(length = 64,columnDefinition = "varchar(64)") + private String countyName; + + /** + * 登录次数 + */ + private Integer loginNum; + public Integer getId() { return id; } @@ -220,6 +228,22 @@ public class SysUserEntity implements Serializable { this.accountType = accountType; } + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } + + public Integer getLoginNum() { + return loginNum; + } + + public void setLoginNum(Integer loginNum) { + this.loginNum = loginNum; + } + @Override public String toString() { return "SysUserEntity{" + @@ -240,6 +264,8 @@ public class SysUserEntity implements Serializable { ", dayNum=" + dayNum + ", overTime='" + overTime + '\'' + ", accountType='" + accountType + '\'' + + ", countyName='" + countyName + '\'' + + ", loginNum=" + loginNum + '}'; } } diff --git a/src/main/java/com/xkrs/model/qo/SysUserQo.java b/src/main/java/com/xkrs/model/qo/SysUserQo.java index a2d767c..3128103 100644 --- a/src/main/java/com/xkrs/model/qo/SysUserQo.java +++ b/src/main/java/com/xkrs/model/qo/SysUserQo.java @@ -60,6 +60,8 @@ public class SysUserQo { private String accountType; + private String countyName; + public Integer getId() { return id; } @@ -155,4 +157,12 @@ public class SysUserQo { public void setAccountType(String accountType) { this.accountType = accountType; } + + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } } diff --git a/src/main/java/com/xkrs/model/vo/SysUserVo.java b/src/main/java/com/xkrs/model/vo/SysUserVo.java index 222fa50..76eecc2 100644 --- a/src/main/java/com/xkrs/model/vo/SysUserVo.java +++ b/src/main/java/com/xkrs/model/vo/SysUserVo.java @@ -26,7 +26,9 @@ public class SysUserVo implements Serializable { private String accountType; - public SysUserVo(Integer id, String reallyName, String telephone, String countyCode, Integer activeFlag, String addTime, String overTime, Integer dayNum, String accountType) { + private String countyName; + + public SysUserVo(Integer id, String reallyName, String telephone, String countyCode, Integer activeFlag, String addTime, String overTime, Integer dayNum, String accountType, String countyName) { this.id = id; this.reallyName = reallyName; this.telephone = telephone; @@ -36,6 +38,7 @@ public class SysUserVo implements Serializable { this.overTime = overTime; this.dayNum = dayNum; this.accountType = accountType; + this.countyName = countyName; } public Integer getId() { @@ -109,5 +112,13 @@ public class SysUserVo implements Serializable { public void setAccountType(String accountType) { this.accountType = accountType; } + + public String getCountyName() { + return countyName; + } + + public void setCountyName(String countyName) { + this.countyName = countyName; + } } diff --git a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java index 78fade2..0b6e53e 100644 --- a/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FirePointServiceImpl.java @@ -259,7 +259,6 @@ public class FirePointServiceImpl implements FirePointService { } List fireTaskPhotos = PhotoUtil.uploadImage(files, appTaskBodyVo.getFireCode()); List fireTaskPhotos1 = fireTaskPhotoDao.saveAll(fireTaskPhotos); - //List fireTaskPhotos1 = jdbcUtils.batchWithJdbcTemplate(fireTaskPhotos); if(fireTaskPhotos1 == null || fireTaskPhotos1.size() == 0){ return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"图片上传失败,任务提交失败",locale); } diff --git a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java index b85ef74..b32d4dd 100644 --- a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java @@ -100,6 +100,7 @@ public class SysUserServiceImpl implements SysUserService { sysUserEntity.setDayNum(7); String string = dateTimeToString(LocalDateTime.now().plusDays(7L)); sysUserEntity.setOverTime(string); + sysUserEntity.setCountyName(sysUserQo.getCountyName()); sysUserDao.save(sysUserEntity); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 67f3fd5..f581f5c 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -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