Commit ce1dad44 by 韦华德

Merge remote-tracking branch 'origin/master'

parents 4ec094d4 9cd4cab6
package com.zq.api.constant;
import org.springframework.core.annotation.AliasFor;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author wilmiam
* @since 2022/1/5 10:42
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ApiMethod {
@AliasFor("name")
String value() default "";
@AliasFor("value")
String name() default "";
String service() default "";
}
...@@ -5,20 +5,29 @@ import cn.hutool.core.util.StrUtil; ...@@ -5,20 +5,29 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.servlet.ServletUtil; import cn.hutool.extra.servlet.ServletUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.zq.api.constant.ApiCodeEnum; import com.zq.api.constant.ApiCodeEnum;
import com.zq.api.constant.ApiMethod;
import com.zq.api.form.ApiForm; import com.zq.api.form.ApiForm;
import com.zq.api.form.ApiResp; import com.zq.api.form.ApiResp;
import com.zq.api.service.ApiService; import com.zq.api.service.ApiService;
import com.zq.api.service.IApiLogic;
import com.zq.api.utils.ApiUtils; import com.zq.api.utils.ApiUtils;
import com.zq.common.utils.ThrowableUtil; import com.zq.common.utils.ThrowableUtil;
import com.zq.common.vo.ResultVo; import com.zq.common.vo.ResultVo;
import feign.FeignException; import feign.FeignException;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Api(tags = "API接口") @Api(tags = "API接口")
@RestController @RestController
...@@ -87,9 +96,7 @@ public class ApiController { ...@@ -87,9 +96,7 @@ public class ApiController {
// 调试日志 // 调试日志
if (ApiUtils.DEBUG) { if (ApiUtils.DEBUG) {
System.out.println("API DEBUG ACTION \n[from=" + form + "]" System.out.println("API DEBUG ACTION \n[from=" + form + "]" + "\n[resp=" + JSON.toJSONString(resp) + "]" + "\n[time=" + (System.currentTimeMillis() - start) + "ms]");
+ "\n[resp=" + JSON.toJSONString(resp) + "]"
+ "\n[time=" + (System.currentTimeMillis() - start) + "ms]");
} }
String clientIP = ServletUtil.getClientIP(request); String clientIP = ServletUtil.getClientIP(request);
...@@ -109,4 +116,33 @@ public class ApiController { ...@@ -109,4 +116,33 @@ public class ApiController {
ApiUtils.DEBUG = !ApiUtils.DEBUG; ApiUtils.DEBUG = !ApiUtils.DEBUG;
return new ApiResp(from).setData(ApiUtils.DEBUG); return new ApiResp(from).setData(ApiUtils.DEBUG);
} }
@RequestMapping("/method")
public ApiResp getAllMethod(@RequestParam(required = false) String service, @RequestParam(required = false) String name) {
List<Map<String, Object>> methodList = new ArrayList<>();
Method[] methods = IApiLogic.class.getMethods();
for (Method method : methods) {
Class<?>[] params = method.getParameterTypes();
if (params.length == 1 && (params[0] == ApiForm.class)) {
ApiMethod apiMethod = AnnotationUtils.getAnnotation(method, ApiMethod.class);
if (StrUtil.isNotBlank(service)) {
if (apiMethod == null || !apiMethod.service().equals(service)) {
continue;
}
}
if (StrUtil.isNotBlank(name)) {
if ((apiMethod == null || !apiMethod.value().contains(name)) && !method.getName().toLowerCase().contains(name.toLowerCase())) {
continue;
}
}
Map<String, Object> data = new HashMap<>();
data.put("value", method.getName());
data.put("name", apiMethod == null ? "" : apiMethod.value());
data.put("service", apiMethod == null ? "" : apiMethod.service());
methodList.add(data);
}
}
return ApiUtils.toApiResp(new ApiForm(), ResultVo.success(methodList));
}
} }
...@@ -67,4 +67,10 @@ public interface PortalFeign { ...@@ -67,4 +67,10 @@ public interface PortalFeign {
@PostMapping("/stats/getAreaUnderNumStats") @PostMapping("/stats/getAreaUnderNumStats")
ResultVo getAreaUnderNumStats(@RequestBody Map<String, Object> paramsMap); ResultVo getAreaUnderNumStats(@RequestBody Map<String, Object> paramsMap);
@PostMapping("/stats/getEnjoySubsidyStats")
ResultVo getEnjoySubsidyStats(@RequestBody Map<String, Object> paramsMap);
@PostMapping("/stats/getEnjoySumStatsData")
ResultVo getEnjoySumStatsData(@RequestBody Map<String, Object> paramsMap);
} }
package com.zq.api.service; package com.zq.api.service;
import com.zq.api.constant.ApiMethod;
import com.zq.api.form.ApiForm; import com.zq.api.form.ApiForm;
import com.zq.api.form.ApiResp; import com.zq.api.form.ApiResp;
...@@ -9,250 +10,105 @@ import com.zq.api.form.ApiResp; ...@@ -9,250 +10,105 @@ import com.zq.api.form.ApiResp;
* 2016年9月29日 上午11:45:08 * 2016年9月29日 上午11:45:08
*/ */
public interface IApiLogic extends IApiCommon { public interface IApiLogic extends IApiCommon {
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓SYS APP接口↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
/** @ApiMethod(name = "获取用户信息", service = "SYS-SERVER")
* 获取用户信息
*
* @return
*/
ApiResp getUserInfo(ApiForm form); ApiResp getUserInfo(ApiForm form);
/** @ApiMethod(name = "发送验证码", service = "SYS-SERVER")
* 发送验证码
*
* @param form
* @return
*/
ApiResp sendCode(ApiForm form); ApiResp sendCode(ApiForm form);
/** @ApiMethod(name = "重置密码", service = "SYS-SERVER")
* 重置密码
*
* @param form
* @return
*/
ApiResp resetPassword(ApiForm form); ApiResp resetPassword(ApiForm form);
/** @ApiMethod(name = "用户手机号登录", service = "SYS-SERVER")
* 用户手机号登录
*
* @param form
* @return
*/
ApiResp phoneLogin(ApiForm form); ApiResp phoneLogin(ApiForm form);
/** @ApiMethod(name = "密码登录", service = "SYS-SERVER")
* 密码登录
*
* @param form
* @return
*/
ApiResp passwdLogin(ApiForm form); ApiResp passwdLogin(ApiForm form);
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓门户接口↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/ /*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓门户接口↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
/** @ApiMethod(name = "获取婚姻统计", service = "PORTAL-SERVER")
* 获取婚姻统计
*
* @param form
* @return
*/
ApiResp getMarriageStats(ApiForm form); ApiResp getMarriageStats(ApiForm form);
/** @ApiMethod(name = "获取区域下的婚姻统计列表", service = "PORTAL-SERVER")
* 获取区域下的婚姻统计列表
*
* @param form
* @return
*/
ApiResp getAreaUnderMarriageStatsList(ApiForm form); ApiResp getAreaUnderMarriageStatsList(ApiForm form);
/** @ApiMethod(name = "获取近5年婚姻走势", service = "PORTAL-SERVER")
* 获取近5年婚姻走势
*
* @param form
* @return
*/
ApiResp getFivesYearMarriageLine(ApiForm form); ApiResp getFivesYearMarriageLine(ApiForm form);
/** @ApiMethod(name = "获取区域残疾发放统计", service = "PORTAL-SERVER")
* 获取区域残疾发放统计
*
* @param form
* @return
*/
ApiResp getAreaDisabledIssueStats(ApiForm form); ApiResp getAreaDisabledIssueStats(ApiForm form);
/** @ApiMethod(name = "近五年发放人数和金额统计", service = "PORTAL-SERVER")
* 近五年发放人数和金额统计
*
* @param form
* @return
*/
ApiResp getYearDisabledIssueStats(ApiForm form); ApiResp getYearDisabledIssueStats(ApiForm form);
/** @ApiMethod(name = "获取在享补贴统计", service = "PORTAL-SERVER")
* 获取区域社会救助统计列表 ApiResp getEnjoySubsidyStats(ApiForm form);
*
* @param form @ApiMethod(name = "获取区域统计列表", service = "PORTAL-SERVER")
* @return
*/
ApiResp getAreaShjzStats(ApiForm form); ApiResp getAreaShjzStats(ApiForm form);
/** @ApiMethod(name = "获取区域社会救助统计列表", service = "PORTAL-SERVER")
* 获取区域社会救助统计列表
*
* @param form
* @return
*/
ApiResp getAreaUnderNumStats(ApiForm form); ApiResp getAreaUnderNumStats(ApiForm form);
/** @ApiMethod(name = "获取近五年城市农村低保发放人数统计", service = "PORTAL-SERVER")
* 获取近五年城市农村低保发放人数统计
*
* @param form
* @return
*/
ApiResp getFivesYearShjzAchieveStats(ApiForm form); ApiResp getFivesYearShjzAchieveStats(ApiForm form);
/** @ApiMethod(name = "获取近五年城市农村低保发放金额统计", service = "PORTAL-SERVER")
* 获取近五年城市农村低保发放金额统计
*
* @param form
* @return
*/
ApiResp getFivesYearShjzProvideStats(ApiForm form); ApiResp getFivesYearShjzProvideStats(ApiForm form);
/** @ApiMethod(name = "修改登录密码", service = "PORTAL-SERVER")
* 修改登录密码
*
* @param form
* @return
*/
ApiResp modifyPasswd(ApiForm form); ApiResp modifyPasswd(ApiForm form);
/** @ApiMethod(name = "获取App最新版本", service = "PORTAL-SERVER")
* 获取App最新版本
*
* @param form
* @return
*/
ApiResp getAppVersion(ApiForm form); ApiResp getAppVersion(ApiForm form);
/** @ApiMethod(name = "获取子区域列表", service = "PORTAL-SERVER")
* 获取子区域列表
*
* @param form
* @return
*/
ApiResp getChildAreaList(ApiForm form); ApiResp getChildAreaList(ApiForm form);
/** @ApiMethod(name = "获取社会机构统计", service = "PORTAL-SERVER")
* 获取社会机构统计
*
* @param form
* @return
*/
ApiResp getSoorganStats(ApiForm form); ApiResp getSoorganStats(ApiForm form);
/** @ApiMethod(name = "获取地区下面社会机构统计列表", service = "PORTAL-SERVER")
* 获取地区下面社会机构统计列表
*
* @param form
* @return
*/
ApiResp getAreaUnderSoorganStatsList(ApiForm form); ApiResp getAreaUnderSoorganStatsList(ApiForm form);
/** @ApiMethod(name = "获取App首页地图数据", service = "PORTAL-SERVER")
* 获取App首页地图数据
*
* @param form
* @return
*/
ApiResp getAppMapStats(ApiForm form); ApiResp getAppMapStats(ApiForm form);
/** @ApiMethod(name = "汇总搜索", service = "PORTAL-SERVER")
* 汇总搜索
*
* @param form
* @return
*/
ApiResp gatherSearch(ApiForm form); ApiResp gatherSearch(ApiForm form);
/** @ApiMethod(name = "指定区域下的儿童福利数据统计", service = "PORTAL-SERVER")
* 指定区域下的儿童福利数据统计
*
* @param form
* @return
*/
ApiResp getAgencyChildStats(ApiForm form); ApiResp getAgencyChildStats(ApiForm form);
/** @ApiMethod(name = "指定区域下级区域的儿童福利数据统计列表", service = "PORTAL-SERVER")
* 指定区域下级区域的儿童福利数据统计列表
*
* @param form
* @return
*/
ApiResp getAgencyChildStatsList(ApiForm form); ApiResp getAgencyChildStatsList(ApiForm form);
/** @ApiMethod(name = "火化量统计", service = "PORTAL-SERVER")
* 火化量统计
*
* @param form
* @return
*/
ApiResp getCremationStats(ApiForm form); ApiResp getCremationStats(ApiForm form);
/** @ApiMethod(name = "火化量统计列表", service = "PORTAL-SERVER")
* 火化量统计列表
*
* @param form
* @return
*/
ApiResp getCremationStatsList(ApiForm form); ApiResp getCremationStatsList(ApiForm form);
/** @ApiMethod(name = "殡仪馆火化量统计列表", service = "PORTAL-SERVER")
* 殡仪馆火化量统计列表
*
* @param form
* @return
*/
ApiResp getCremationStatsById(ApiForm form); ApiResp getCremationStatsById(ApiForm form);
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓SYS接口↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/ /*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓SYS单点登录接口↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
/** @ApiMethod(name = "获取单点登录用户信息", service = "SYS-SERVER")
* 获取单点登录用户信息
*
* @param form
* @return
*/
ApiResp getSsoUserInfo(ApiForm form); ApiResp getSsoUserInfo(ApiForm form);
/** @ApiMethod(name = "单点登出", service = "SYS-SERVER")
* 单点登出
*
* @param form
* @return
*/
ApiResp ssoLogout(ApiForm form); ApiResp ssoLogout(ApiForm form);
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓开放接口↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/ /*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓开放接口↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
/** @ApiMethod(name = "婚姻搜索接口", service = "OPEN-SERVER")
* 婚姻搜索接口
*
* @param form
* @return
*/
ApiResp marriageSearch(ApiForm form); ApiResp marriageSearch(ApiForm form);
/** @ApiMethod(name = "自然人搜索接口", service = "OPEN-SERVER")
* 自然人搜索接口
*
* @param form
* @return
*/
ApiResp naturalPersonSearch(ApiForm form); ApiResp naturalPersonSearch(ApiForm form);
} }
...@@ -91,6 +91,11 @@ public class ApiV100Logic extends BaseApiLogic implements IApiLogic { ...@@ -91,6 +91,11 @@ public class ApiV100Logic extends BaseApiLogic implements IApiLogic {
} }
@Override @Override
public ApiResp getEnjoySubsidyStats(ApiForm form) {
return ApiUtils.toApiResp(form, portalFeign.getEnjoySubsidyStats(form.getParamsMap()));
}
@Override
public ApiResp getAreaShjzStats(ApiForm form) { public ApiResp getAreaShjzStats(ApiForm form) {
return ApiUtils.toApiResp(form, portalFeign.getAreaShjzStats(form.getParamsMap())); return ApiUtils.toApiResp(form, portalFeign.getAreaShjzStats(form.getParamsMap()));
} }
......
...@@ -69,7 +69,7 @@ spring: ...@@ -69,7 +69,7 @@ spring:
mybatis-plus: mybatis-plus:
global-config: global-config:
db-config: db-config:
select-strategy: not_empty where-strategy: not_empty
update-strategy: not_empty update-strategy: not_empty
#logging.level.com.zq.drug.dao: debug #logging.level.com.zq.drug.dao: debug
\ No newline at end of file
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<dependency> <dependency>
<groupId>com.github.pagehelper</groupId> <groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId> <artifactId>pagehelper</artifactId>
<version>5.2.1</version> <version>5.3.0</version>
</dependency> </dependency>
<!--spring boot 集成redis所需common-pool2--> <!--spring boot 集成redis所需common-pool2-->
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.8.0</version> <version>2.11.0</version>
</dependency> </dependency>
<!--工具包--> <!--工具包-->
...@@ -119,12 +119,18 @@ ...@@ -119,12 +119,18 @@
<dependency> <dependency>
<groupId>com.jfinal</groupId> <groupId>com.jfinal</groupId>
<artifactId>jfinal-weixin</artifactId> <artifactId>jfinal-weixin</artifactId>
<version>3.1</version> <version>3.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.jfinal</groupId> <groupId>com.jfinal</groupId>
<artifactId>jfinal-ext3</artifactId> <artifactId>jfinal-ext3</artifactId>
<version>4.0.3</version> <version>4.0.3</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -21,7 +21,11 @@ public class MybatisConfig { ...@@ -21,7 +21,11 @@ public class MybatisConfig {
@Bean @Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() { public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
// 分页插件
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
interceptor.addInnerInterceptor(paginationInnerInterceptor);
return interceptor; return interceptor;
} }
...@@ -34,13 +38,8 @@ public class MybatisConfig { ...@@ -34,13 +38,8 @@ public class MybatisConfig {
public PageInterceptor pageInterceptor() { public PageInterceptor pageInterceptor() {
PageInterceptor pageInterceptor = new PageInterceptor(); PageInterceptor pageInterceptor = new PageInterceptor();
Properties properties = new Properties(); Properties properties = new Properties();
properties.setProperty("offsetAsPageNum", "false"); // properties.setProperty("helperDialect", "mysql");//指定方言
properties.setProperty("rowBoundsWithCount", "false"); properties.setProperty("autoRuntimeDialect", "true");//自动获取方言
properties.setProperty("pageSizeZero", "true");
properties.setProperty("reasonable", "false");
properties.setProperty("supportMethodsArguments", "false");
properties.setProperty("returnPageInfo", "none");
properties.setProperty("autoRuntimeDialect", "true");
pageInterceptor.setProperties(properties); pageInterceptor.setProperties(properties);
return pageInterceptor; return pageInterceptor;
} }
......
...@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean { ...@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException { throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String token = resolveToken(httpServletRequest); String token = tokenProvider.getToken(httpServletRequest);
// 对于 Token 为空的不需要去查 Redis // 对于 Token 为空的不需要去查 Redis
if (StrUtil.isNotBlank(token)) { if (StrUtil.isNotBlank(token)) {
OnlineUserDto onlineUserDto = null; OnlineUserDto onlineUserDto = null;
...@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean { ...@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean {
filterChain.doFilter(servletRequest, servletResponse); filterChain.doFilter(servletRequest, servletResponse);
} }
/**
* 初步检测Token
*
* @param request /
* @return /
*/
private String resolveToken(HttpServletRequest request) {
String bearerToken = request.getHeader(properties.getHeader());
if (StringUtils.isBlank(bearerToken)) {
return null;
}
if (bearerToken.startsWith(properties.getTokenStartWith())) {
// 去掉令牌前缀
return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token:{}", bearerToken);
}
return null;
}
} }
...@@ -25,6 +25,7 @@ import io.jsonwebtoken.Jwts; ...@@ -25,6 +25,7 @@ import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.SignatureAlgorithm;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
...@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority; ...@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean { ...@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean {
} }
public Authentication getAuthentication(String token) { public Authentication getAuthentication(String token) {
Claims claims = Jwts.parser() Claims claims = getClaims(token);
.setSigningKey(DatatypeConverter.parseBase64Binary(properties.getBase64Secret()))
.parseClaimsJws(token)
.getBody();
// fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException // fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException
Object authoritiesStr = claims.get(AUTHORITIES_KEY); Object authoritiesStr = claims.get(AUTHORITIES_KEY);
...@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean { ...@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean {
public String getToken(HttpServletRequest request) { public String getToken(HttpServletRequest request) {
String bearerToken = request.getHeader(properties.getHeader()); String bearerToken = request.getHeader(properties.getHeader());
if (StringUtils.hasText(bearerToken) && bearerToken.startsWith(properties.getTokenStartWith())) { if (StringUtils.isBlank(bearerToken)) {
return null;
}
if (bearerToken.startsWith(properties.getTokenStartWith())) {
// 去掉令牌前缀 // 去掉令牌前缀
return bearerToken.replace(properties.getTokenStartWith(), ""); return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token:{}", bearerToken);
} }
return null; return null;
} }
......
...@@ -71,7 +71,7 @@ spring: ...@@ -71,7 +71,7 @@ spring:
mybatis-plus: mybatis-plus:
global-config: global-config:
db-config: db-config:
select-strategy: not_empty where-strategy: not_empty
update-strategy: not_empty update-strategy: not_empty
#日志等级 #日志等级
......
...@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean { ...@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException { throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String token = resolveToken(httpServletRequest); String token = tokenProvider.getToken(httpServletRequest);
// 对于 Token 为空的不需要去查 Redis // 对于 Token 为空的不需要去查 Redis
if (StrUtil.isNotBlank(token)) { if (StrUtil.isNotBlank(token)) {
OnlineUserDto onlineUserDto = null; OnlineUserDto onlineUserDto = null;
...@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean { ...@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean {
filterChain.doFilter(servletRequest, servletResponse); filterChain.doFilter(servletRequest, servletResponse);
} }
/**
* 初步检测Token
*
* @param request /
* @return /
*/
private String resolveToken(HttpServletRequest request) {
String bearerToken = request.getHeader(properties.getHeader());
if (StringUtils.isBlank(bearerToken)) {
return null;
}
if (bearerToken.startsWith(properties.getTokenStartWith())) {
// 去掉令牌前缀
return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token:{}", bearerToken);
}
return null;
}
} }
...@@ -25,6 +25,7 @@ import io.jsonwebtoken.Jwts; ...@@ -25,6 +25,7 @@ import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.SignatureAlgorithm;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
...@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority; ...@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean { ...@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean {
} }
public Authentication getAuthentication(String token) { public Authentication getAuthentication(String token) {
Claims claims = Jwts.parser() Claims claims = getClaims(token);
.setSigningKey(DatatypeConverter.parseBase64Binary(properties.getBase64Secret()))
.parseClaimsJws(token)
.getBody();
// fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException // fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException
Object authoritiesStr = claims.get(AUTHORITIES_KEY); Object authoritiesStr = claims.get(AUTHORITIES_KEY);
...@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean { ...@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean {
public String getToken(HttpServletRequest request) { public String getToken(HttpServletRequest request) {
String bearerToken = request.getHeader(properties.getHeader()); String bearerToken = request.getHeader(properties.getHeader());
if (StringUtils.hasText(bearerToken) && bearerToken.startsWith(properties.getTokenStartWith())) { if (StringUtils.isBlank(bearerToken)) {
return null;
}
if (bearerToken.startsWith(properties.getTokenStartWith())) {
// 去掉令牌前缀 // 去掉令牌前缀
return bearerToken.replace(properties.getTokenStartWith(), ""); return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token:{}", bearerToken);
} }
return null; return null;
} }
......
...@@ -77,5 +77,5 @@ spring: ...@@ -77,5 +77,5 @@ spring:
mybatis-plus: mybatis-plus:
global-config: global-config:
db-config: db-config:
select-strategy: not_empty where-strategy: not_empty
update-strategy: not_empty update-strategy: not_empty
\ No newline at end of file
...@@ -23,11 +23,14 @@ ...@@ -23,11 +23,14 @@
<swagger.version>2.9.2</swagger.version> <swagger.version>2.9.2</swagger.version>
<alibaba.druid.version>1.1.22</alibaba.druid.version> <alibaba.druid.version>1.1.22</alibaba.druid.version>
<mybatis.plus.version>3.4.3</mybatis.plus.version> <mybatis.plus.version>3.5.0</mybatis.plus.version>
<pagehelper.version>5.2.0</pagehelper.version> <pagehelper.version>5.2.0</pagehelper.version>
<jjwt.version>0.9.1</jjwt.version> <jjwt.version>0.9.1</jjwt.version>
<fastjson.version>1.2.76</fastjson.version> <fastjson.version>1.2.79</fastjson.version>
<hutool.version>5.7.16</hutool.version> <hutool.version>5.7.18</hutool.version>
<logback.version>1.2.10</logback.version>
<log4j2.version>2.17.1</log4j2.version>
</properties> </properties>
<modules> <modules>
......
...@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean { ...@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException { throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String token = resolveToken(httpServletRequest); String token = tokenProvider.getToken(httpServletRequest);
// 对于 Token 为空的不需要去查 Redis // 对于 Token 为空的不需要去查 Redis
if (StrUtil.isNotBlank(token)) { if (StrUtil.isNotBlank(token)) {
OnlineUserDto onlineUserDto = null; OnlineUserDto onlineUserDto = null;
...@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean { ...@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean {
filterChain.doFilter(servletRequest, servletResponse); filterChain.doFilter(servletRequest, servletResponse);
} }
/**
* 初步检测Token
*
* @param request /
* @return /
*/
private String resolveToken(HttpServletRequest request) {
String bearerToken = request.getHeader(properties.getHeader());
if (StringUtils.isBlank(bearerToken)) {
return null;
}
if (bearerToken.startsWith(properties.getTokenStartWith())) {
// 去掉令牌前缀
return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token:{}", bearerToken);
}
return null;
}
} }
...@@ -25,6 +25,7 @@ import io.jsonwebtoken.Jwts; ...@@ -25,6 +25,7 @@ import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.SignatureAlgorithm;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
...@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority; ...@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean { ...@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean {
} }
public Authentication getAuthentication(String token) { public Authentication getAuthentication(String token) {
Claims claims = Jwts.parser() Claims claims = getClaims(token);
.setSigningKey(DatatypeConverter.parseBase64Binary(properties.getBase64Secret()))
.parseClaimsJws(token)
.getBody();
// fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException // fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException
Object authoritiesStr = claims.get(AUTHORITIES_KEY); Object authoritiesStr = claims.get(AUTHORITIES_KEY);
...@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean { ...@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean {
public String getToken(HttpServletRequest request) { public String getToken(HttpServletRequest request) {
String bearerToken = request.getHeader(properties.getHeader()); String bearerToken = request.getHeader(properties.getHeader());
if (StringUtils.hasText(bearerToken) && bearerToken.startsWith(properties.getTokenStartWith())) { if (StringUtils.isBlank(bearerToken)) {
return null;
}
if (bearerToken.startsWith(properties.getTokenStartWith())) {
// 去掉令牌前缀 // 去掉令牌前缀
return bearerToken.replace(properties.getTokenStartWith(), ""); return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token:{}", bearerToken);
} }
return null; return null;
} }
......
...@@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
@Api(tags = "残疾统计相关接口") @Api(tags = "残疾统计相关接口")
@RequiredArgsConstructor @RequiredArgsConstructor
@RestController @RestController
...@@ -39,4 +41,10 @@ public class CjStatsController { ...@@ -39,4 +41,10 @@ public class CjStatsController {
return ResultVo.success(cjStatsService.getCacheAreaDisabledIssueStats(vo)); return ResultVo.success(cjStatsService.getCacheAreaDisabledIssueStats(vo));
} }
@ApiOperation("区域在享发放统计")
@PostMapping(value = "/getEnjoySubsidyStats")
public ResultVo getEnjoySubsidyStats(@RequestBody StatsReqVo vo) {
return ResultVo.success(cjStatsService.getEnjoySubsidyStats(vo));
}
} }
...@@ -69,4 +69,8 @@ public interface CjStatsDao { ...@@ -69,4 +69,8 @@ public interface CjStatsDao {
List<StatsVo> getYearIssueStats(StatsReqVo vo); List<StatsVo> getYearIssueStats(StatsReqVo vo);
List<Map<String, Object>> search(SearchReqVo vo); List<Map<String, Object>> search(SearchReqVo vo);
List<StatsVo> getAreaSubsidyStats(StatsReqVo vo);
StatsVo getEnjoySumStats(StatsReqVo vo);
} }
...@@ -77,4 +77,6 @@ public interface ShjzStatsDao { ...@@ -77,4 +77,6 @@ public interface ShjzStatsDao {
* @return * @return
*/ */
List<StatsVo> getMonyNumStats(StatsReqVo vo); List<StatsVo> getMonyNumStats(StatsReqVo vo);
List<StatsVo> getAreaTotalNumStats(StatsReqVo vo);
} }
...@@ -76,6 +76,10 @@ public abstract class PortalCacheKeys { ...@@ -76,6 +76,10 @@ public abstract class PortalCacheKeys {
return PREFIX + "getAreaDisabledIssueStats." + vo.getAreaCode() + "." + vo.getYear(); return PREFIX + "getAreaDisabledIssueStats." + vo.getAreaCode() + "." + vo.getYear();
} }
public static String getEnjoySubsidyStatsKey(StatsReqVo vo) {
return PREFIX + "getEnjoySubsidyStats." + vo.getAreaCode() + "." + vo.getYear();
}
// 获取区域养老院统计列表 // 获取区域养老院统计列表
public static String getAreaNursingStatsListKey(StatsReqVo vo) { public static String getAreaNursingStatsListKey(StatsReqVo vo) {
return PREFIX + "getAreaNursingStatsList." + vo.getAreaCode() + "." + vo.getYear() + "." + vo.getType(); return PREFIX + "getAreaNursingStatsList." + vo.getAreaCode() + "." + vo.getYear() + "." + vo.getType();
...@@ -135,4 +139,9 @@ public abstract class PortalCacheKeys { ...@@ -135,4 +139,9 @@ public abstract class PortalCacheKeys {
public static String getAreaShjzStats(StatsReqVo vo) { public static String getAreaShjzStats(StatsReqVo vo) {
return PREFIX + "getAreaShjzStats." + vo.getAreaCode(); return PREFIX + "getAreaShjzStats." + vo.getAreaCode();
} }
//获取两项补贴统计
public static String getEnjoySumStatsKey(StatsReqVo vo) {
return PREFIX + "getEnjoySumStats." + vo.getAreaCode();
}
} }
...@@ -224,7 +224,7 @@ public class CjStatsService { ...@@ -224,7 +224,7 @@ public class CjStatsService {
List<StatsVo> severeAreaIssueStats = cjStatsDao.getAreaIssueStats(vo); List<StatsVo> severeAreaIssueStats = cjStatsDao.getAreaIssueStats(vo);
for (StatsVo severeAreaIssueStat : severeAreaIssueStats) { for (StatsVo severeAreaIssueStat : severeAreaIssueStats) {
SystemArea area = areaDao.selectById(SystemArea.patchZero(severeAreaIssueStat.getCode())); SystemArea area = areaDao.selectById(SystemArea.patchZero(severeAreaIssueStat.getCode()));
if(area==null){ if (area == null) {
continue; continue;
} }
areaList.add(area.getName()); areaList.add(area.getName());
...@@ -234,9 +234,9 @@ public class CjStatsService { ...@@ -234,9 +234,9 @@ public class CjStatsService {
vo.setSubAreaCode(severeAreaIssueStat.getCode()); vo.setSubAreaCode(severeAreaIssueStat.getCode());
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("areaName", area.getName()); data.put("areaName", area.getName());
data.put("areaCode",severeAreaIssueStat.getCode()); data.put("areaCode", severeAreaIssueStat.getCode());
data.put("severePeopleNum", cjStatsDao.getSeverePeopleNumStats(vo).getNum()); data.put("severePeopleNum", cjStatsDao.getSeverePeopleNumStats(vo).getNum());
data.put("difficultPeopleNum",cjStatsDao.getDifficultPeopleNumStats(vo).getNum()); data.put("difficultPeopleNum", cjStatsDao.getDifficultPeopleNumStats(vo).getNum());
data.put("issueNum", severeAreaIssueStat.getNum()); data.put("issueNum", severeAreaIssueStat.getNum());
data.put("issueAmount", severeAreaIssueStat.getAmount()); data.put("issueAmount", severeAreaIssueStat.getAmount());
areaPeopleNumList.add(data); areaPeopleNumList.add(data);
...@@ -278,4 +278,54 @@ public class CjStatsService { ...@@ -278,4 +278,54 @@ public class CjStatsService {
} }
return PagingUtils.paging(vo, cjStatsDao::search); return PagingUtils.paging(vo, cjStatsDao::search);
} }
// public Object getCacheEnjoySubsidyStats(StatsReqVo vo) {
// Object obj = redisUtils.getObj(PortalCacheKeys.getEnjoySubsidyStatsKey(vo));
// if (obj != null) {
// return obj;
// }
// return getEnjoySubsidyStats(vo);
// }
//区域补贴在享人和钱数
public Object getEnjoySubsidyStats(StatsReqVo vo) {
if (StringUtils.isBlank(vo.getAreaCode())) {
vo.setAreaCode("450000000000");
}
SystemArea systemArea = areaDao.selectById(vo.getAreaCode());
vo.setSubAreaCode(systemArea.subAreaCode());
vo.setSize(SystemArea.getNextLevelLength(systemArea.getType()));
StatsVo stats = cjStatsDao.getEnjoySumStats(vo);
Map<String, Object> totalData = new HashMap<>();
totalData.put("totalNum", stats.getNum());
totalData.put("totalAmount", stats.getAmount());
List<Map<String, Object>> areaPeopleNumList = new ArrayList<>();
List<StatsVo> subsidyStats = cjStatsDao.getAreaSubsidyStats(vo);
for (StatsVo subsidyStat : subsidyStats) {
SystemArea area = areaDao.selectById(SystemArea.patchZero(subsidyStat.getCode()));
if (area == null) {
continue;
}
Map<String, Object> data = new HashMap<>();
data.put("areaCode", subsidyStat.getCode());
data.put("areaName", area.getName());
data.put("nursingSubsidyNum", subsidyStat.getHlnum());
data.put("nursingSubsidyAmount", subsidyStat.getHlamount());
data.put("livingAllowanceNum", subsidyStat.getShnum());
data.put("livingAllowanceAmount", subsidyStat.getShamount());
areaPeopleNumList.add(data);
}
Map<String, Object> returnData = new HashMap<>();
returnData.put("total",totalData);
returnData.put("stats",areaPeopleNumList);
// redisUtils.setObj(PortalCacheKeys.getEnjoySubsidyStatsKey(vo), returnData);
return returnData;
}
} }
...@@ -353,16 +353,27 @@ public class ShjzStatsService { ...@@ -353,16 +353,27 @@ public class ShjzStatsService {
List<StatsVo> peopleNumStats = shjzStatsDao.getPeopleNumStats(vo); List<StatsVo> peopleNumStats = shjzStatsDao.getPeopleNumStats(vo);
// 金额 // 金额
List<StatsVo> monyStats = shjzStatsDao.getMonyNumStats(vo); List<StatsVo> monyStats = shjzStatsDao.getMonyNumStats(vo);
//总人数
List<StatsVo> stats= shjzStatsDao.getAreaTotalNumStats(vo);
Map<String, Object> totalData = new HashMap<>();
for (StatsVo totalStat : stats) {
if ("0".equals(totalStat.getType())) {
totalData.put("villageTotal",totalStat.getNum());//农村低保
} else {
totalData.put("cityTotal",totalStat.getNum());//城市低保
}
}
Map<String, Map<String, Object>> map = new HashMap<>(); Map<String, Map<String, Object>> map = new HashMap<>();
// 添加城市低保人数 // 添加城市低保人数
List<StatsVo> cityPeopleNumStats = peopleNumStats.stream().filter(statsVo -> "农村低保".equals(statsVo.getType())).collect(Collectors.toList()); List<StatsVo> cityPeopleNumStats = peopleNumStats.stream().filter(statsVo -> "城市低保".equals(statsVo.getType())).collect(Collectors.toList());
cityPeopleNumStats.forEach(statsVo -> { cityPeopleNumStats.forEach(statsVo -> {
Map<String, Object> data = map.computeIfAbsent(statsVo.getCode(), k -> new HashMap<>()); Map<String, Object> data = map.computeIfAbsent(statsVo.getCode(), k -> new HashMap<>());
data.put("cityPeopleNum", statsVo.getNum()); data.put("cityPeopleNum", statsVo.getNum());
}); });
// 添加农村低保人数 // 添加农村低保人数
List<StatsVo> villagePeopleNumStats = peopleNumStats.stream().filter(statsVo -> "城市低保".equals(statsVo.getType())).collect(Collectors.toList()); List<StatsVo> villagePeopleNumStats = peopleNumStats.stream().filter(statsVo -> "农村低保".equals(statsVo.getType())).collect(Collectors.toList());
villagePeopleNumStats.forEach(statsVo -> { villagePeopleNumStats.forEach(statsVo -> {
Map<String, Object> data = map.computeIfAbsent(statsVo.getCode(), k -> new HashMap<>()); Map<String, Object> data = map.computeIfAbsent(statsVo.getCode(), k -> new HashMap<>());
data.put("villagePeopleNum", statsVo.getNum()); data.put("villagePeopleNum", statsVo.getNum());
...@@ -388,7 +399,10 @@ public class ShjzStatsService { ...@@ -388,7 +399,10 @@ public class ShjzStatsService {
v.put("city", area!=null?area.getName():""); v.put("city", area!=null?area.getName():"");
dataList.add(v); dataList.add(v);
}); });
List<Map<String,Object>> returnData = dataList.stream().sorted(Comparator.comparing(m -> m.get("areaCode").toString())).collect(Collectors.toList()); List<Map<String,Object>> mapData = dataList.stream().sorted(Comparator.comparing(m -> m.get("areaCode").toString())).collect(Collectors.toList());
Map<String, Object> returnData = new HashMap<>();
returnData.put("map",mapData);
returnData.put("total",totalData);
redisUtils.setObj(PortalCacheKeys.getAreaShjzStats(vo), returnData); redisUtils.setObj(PortalCacheKeys.getAreaShjzStats(vo), returnData);
......
...@@ -24,6 +24,14 @@ public class StatsVo { ...@@ -24,6 +24,14 @@ public class StatsVo {
private String amount; private String amount;
private String hlnum;
private String hlamount;
private String shnum;
private String shamount;
private String code; private String code;
private String date; private String date;
......
...@@ -121,5 +121,5 @@ spring: ...@@ -121,5 +121,5 @@ spring:
mybatis-plus: mybatis-plus:
global-config: global-config:
db-config: db-config:
select-strategy: not_empty where-strategy: not_empty
update-strategy: not_empty update-strategy: not_empty
...@@ -99,6 +99,24 @@ ...@@ -99,6 +99,24 @@
GROUP BY LEFT(UNIT_ID, #{size}) GROUP BY LEFT(UNIT_ID, #{size})
</select> </select>
<select id="getAreaSubsidyStats" resultType="com.zq.portal.vo.StatsVo">
SELECT LEFT(AREACODE, #{size}) 'code', FF_DATE 'month',SUM(FF_ZD_PC ) 'hlnum', SUM(FF_ZD_MC) 'hlamount',SUM(FF_KUN_PC) 'shnum', SUM(FF_KUN_MC) 'shamount'
FROM `ff_data_jm`
WHERE
CHAR_LENGTH (LEFT ( AREACODE, #{size} )) = #{size}
AND FF_DATE = DATE_FORMAT(NOW(),'%Y-%m')
<if test="subAreaCode != null and subAreaCode != ''">
AND AREACODE LIKE CONCAT(#{subAreaCode}, '%')
</if>
GROUP BY LEFT(AREACODE, #{size})
</select>
<select id="getEnjoySumStats" resultType="com.zq.portal.vo.StatsVo">
SELECT SUM(S_PC) 'num' , SUM(S_MC) 'amount'
FROM ff_data_jm
WHERE FF_DATE = DATE_FORMAT(NOW(),'%Y-%m')
</select>
<select id="getYearIssueStats" resultType="com.zq.portal.vo.StatsVo"> <select id="getYearIssueStats" resultType="com.zq.portal.vo.StatsVo">
SELECT APPLY_TYPE_ID 'type', GRANT_YEAR 'year', SUM( COUNT_PEOPLE ) 'num', SUM( SUM_MONEY ) 'amount' SELECT APPLY_TYPE_ID 'type', GRANT_YEAR 'year', SUM( COUNT_PEOPLE ) 'num', SUM( SUM_MONEY ) 'amount'
FROM `statics_grant` FROM `statics_grant`
......
...@@ -110,15 +110,7 @@ ...@@ -110,15 +110,7 @@
<select id="getAreaUnderNumStats" resultType="com.zq.portal.vo.StatsVo"> <select id="getAreaUnderNumStats" resultType="com.zq.portal.vo.StatsVo">
SELECT SELECT
LEFT(h.UNIT_ID, #{size}) 'code', LEFT(h.UNIT_ID, #{size}) 'code',
( CASE h.ISCITY h.ISCITY 'type',
WHEN 0 THEN '农村低保'
WHEN 1 THEN '城市低保'
WHEN 6 THEN '特困供养'
WHEN 10 THEN '农村低收入'
WHEN 11 THEN '城市低收入'
WHEN 21 THEN '住房救助'
WHEN 31 THEN '城市特困'
ELSE '其他' END ) 'type',
SUM( h.SURE_POPULATION ) 'num' SUM( h.SURE_POPULATION ) 'num'
FROM FROM
ENBUZ_APPLY_HOME h ENBUZ_APPLY_HOME h
...@@ -127,11 +119,28 @@ ...@@ -127,11 +119,28 @@
<if test="subAreaCode != null and subAreaCode != ''"> <if test="subAreaCode != null and subAreaCode != ''">
AND h.UNIT_ID LIKE CONCAT(#{subAreaCode}, '%') AND h.UNIT_ID LIKE CONCAT(#{subAreaCode}, '%')
</if> </if>
AND DATE_FORMAT( h.PERMIT_DATE, "%Y-%m-%d" ) &lt;= #{date} <if test="type != null and type != ''">
AND DATE_FORMAT( h.STOP_DATE, "%Y-%m-%d" ) >= #{date} AND h.ISCITY = #{type}
</if>
AND DATE_FORMAT( h.PERMIT_DATE, "%Y-%m-%d" ) &lt;= '2021-12-01'
AND DATE_FORMAT( h.STOP_DATE, "%Y-%m-%d" ) >= '2021-12-01'
GROUP BY GROUP BY
LEFT(h.UNIT_ID, #{size}), LEFT(h.UNIT_ID, #{size}),
ISCITY type
</select>
<select id="getAreaTotalNumStats" resultType="com.zq.portal.vo.StatsVo">
SELECT
h.ISCITY 'type',
SUM( h.SURE_POPULATION ) 'num'
FROM
ENBUZ_APPLY_HOME h
WHERE h.VP_STATE = 4
AND DATE_FORMAT( h.PERMIT_DATE, "%Y-%m-%d" ) &lt;= '2021-12-01'
AND DATE_FORMAT( h.STOP_DATE, "%Y-%m-%d" ) >= '2021-12-01'
AND h.ISCITY IN(0,1)
GROUP BY
type
</select> </select>
<!-- <!--
...@@ -214,10 +223,10 @@ ...@@ -214,10 +223,10 @@
FROM FROM
mon_pay p mon_pay p
WHERE WHERE
p.pmonth >= CONCAT(DATE_FORMAT( NOW(), '%Y' ), '-01-01') p.pay_state = 2
AND p.pmonth &lt;= DATE_FORMAT( NOW(), '%Y%m%d' )
AND p.vp_state = 4 AND p.vp_state = 4
AND p.pay_state = 2 AND DATE_FORMAT( p.pmonth, "%Y-%m-%d" ) >= '2021-12-01'
AND DATE_FORMAT( p.pmonth, "%Y-%m-%d" ) &lt;= '2021-12-01'
AND CHAR_LENGTH (LEFT ( p.unit_id, #{size} )) = #{size} AND CHAR_LENGTH (LEFT ( p.unit_id, #{size} )) = #{size}
<if test="subAreaCode != null and subAreaCode != ''"> <if test="subAreaCode != null and subAreaCode != ''">
AND p.unit_id LIKE CONCAT(#{subAreaCode}, '%') AND p.unit_id LIKE CONCAT(#{subAreaCode}, '%')
......
...@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean { ...@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException { throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String token = resolveToken(httpServletRequest); String token = tokenProvider.getToken(httpServletRequest);
// 对于 Token 为空的不需要去查 Redis // 对于 Token 为空的不需要去查 Redis
if (StrUtil.isNotBlank(token)) { if (StrUtil.isNotBlank(token)) {
OnlineUserDto onlineUserDto = null; OnlineUserDto onlineUserDto = null;
...@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean { ...@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean {
filterChain.doFilter(servletRequest, servletResponse); filterChain.doFilter(servletRequest, servletResponse);
} }
/**
* 初步检测Token
*
* @param request /
* @return /
*/
private String resolveToken(HttpServletRequest request) {
String bearerToken = request.getHeader(properties.getHeader());
if (StringUtils.isBlank(bearerToken)) {
return null;
}
if (bearerToken.startsWith(properties.getTokenStartWith())) {
// 去掉令牌前缀
return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token:{}", bearerToken);
}
return null;
}
} }
...@@ -25,6 +25,7 @@ import io.jsonwebtoken.Jwts; ...@@ -25,6 +25,7 @@ import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.SignatureAlgorithm;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
...@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority; ...@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean { ...@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean {
} }
public Authentication getAuthentication(String token) { public Authentication getAuthentication(String token) {
Claims claims = Jwts.parser() Claims claims = getClaims(token);
.setSigningKey(DatatypeConverter.parseBase64Binary(properties.getBase64Secret()))
.parseClaimsJws(token)
.getBody();
// fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException // fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException
Object authoritiesStr = claims.get(AUTHORITIES_KEY); Object authoritiesStr = claims.get(AUTHORITIES_KEY);
...@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean { ...@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean {
public String getToken(HttpServletRequest request) { public String getToken(HttpServletRequest request) {
String bearerToken = request.getHeader(properties.getHeader()); String bearerToken = request.getHeader(properties.getHeader());
if (StringUtils.hasText(bearerToken) && bearerToken.startsWith(properties.getTokenStartWith())) { if (StringUtils.isBlank(bearerToken)) {
return null;
}
if (bearerToken.startsWith(properties.getTokenStartWith())) {
// 去掉令牌前缀 // 去掉令牌前缀
return bearerToken.replace(properties.getTokenStartWith(), ""); return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token:{}", bearerToken);
} }
return null; return null;
} }
......
...@@ -71,7 +71,7 @@ spring: ...@@ -71,7 +71,7 @@ spring:
mybatis-plus: mybatis-plus:
global-config: global-config:
db-config: db-config:
select-strategy: not_empty where-strategy: not_empty
update-strategy: not_empty update-strategy: not_empty
#日志等级 #日志等级
......
package com.zq.sync.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.common.constant.DBName;
import com.zq.sync.entity.ReportError;
import org.springframework.stereotype.Repository;
@DS(DBName.GXCJ)
@Repository
public interface ReportErroorDao extends BaseMapper<ReportError> {
}
package com.zq.sync.entity; package com.zq.sync.entity;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
...@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor; ...@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Builder @Builder
@TableName("fdx01")
public class Fdx01 { public class Fdx01 {
/** /**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 残疾人姓名 * 残疾人姓名
*/ */
@ApiModelProperty("残疾人姓名") @ApiModelProperty("残疾人姓名")
...@@ -287,23 +299,23 @@ public class Fdx01 { ...@@ -287,23 +299,23 @@ public class Fdx01 {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private Date datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
\ No newline at end of file
package com.zq.sync.entity; package com.zq.sync.entity;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
...@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor; ...@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Builder @Builder
@TableName("fdx02")
public class Fdx02 { public class Fdx02 {
/** /**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 残疾人姓名 * 残疾人姓名
*/ */
@ApiModelProperty("残疾人姓名") @ApiModelProperty("残疾人姓名")
...@@ -287,23 +299,23 @@ public class Fdx02 { ...@@ -287,23 +299,23 @@ public class Fdx02 {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private Date datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
\ No newline at end of file
package com.zq.sync.entity; package com.zq.sync.entity;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
...@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor; ...@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Builder @Builder
@TableName("fdx03")
public class Fdx03 { public class Fdx03 {
/** /**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 残疾人姓名 * 残疾人姓名
*/ */
@ApiModelProperty("残疾人姓名") @ApiModelProperty("残疾人姓名")
...@@ -125,23 +137,23 @@ public class Fdx03 { ...@@ -125,23 +137,23 @@ public class Fdx03 {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private Date datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
\ No newline at end of file
package com.zq.sync.entity; package com.zq.sync.entity;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
...@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor; ...@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Builder @Builder
@TableName("fdx04")
public class Fdx04 { public class Fdx04 {
/** /**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 残疾人姓名 * 残疾人姓名
*/ */
@ApiModelProperty("残疾人姓名") @ApiModelProperty("残疾人姓名")
...@@ -149,23 +161,23 @@ public class Fdx04 { ...@@ -149,23 +161,23 @@ public class Fdx04 {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private Date datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
\ No newline at end of file
package com.zq.sync.entity; package com.zq.sync.entity;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
...@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor; ...@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Builder @Builder
@TableName("fdx05")
public class Fdx05 { public class Fdx05 {
/** /**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 残疾人姓名 * 残疾人姓名
*/ */
@ApiModelProperty("残疾人姓名") @ApiModelProperty("残疾人姓名")
...@@ -149,23 +161,23 @@ public class Fdx05 { ...@@ -149,23 +161,23 @@ public class Fdx05 {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private Date datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
\ No newline at end of file
package com.zq.sync.entity; package com.zq.sync.entity;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
...@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor; ...@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Builder @Builder
@TableName("fdx06")
public class Fdx06 { public class Fdx06 {
/** /**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 残疾人姓名 * 残疾人姓名
*/ */
@ApiModelProperty("残疾人姓名") @ApiModelProperty("残疾人姓名")
...@@ -293,23 +305,23 @@ public class Fdx06 { ...@@ -293,23 +305,23 @@ public class Fdx06 {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private Date datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
\ No newline at end of file
...@@ -2,6 +2,9 @@ package com.zq.sync.entity; ...@@ -2,6 +2,9 @@ package com.zq.sync.entity;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -19,9 +22,17 @@ import lombok.NoArgsConstructor; ...@@ -19,9 +22,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Builder @Builder
@TableName("fdx07")
public class Fdx07 { public class Fdx07 {
/** /**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 省 * 省
*/ */
@ApiModelProperty("省") @ApiModelProperty("省")
...@@ -175,23 +186,23 @@ public class Fdx07 { ...@@ -175,23 +186,23 @@ public class Fdx07 {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private Date datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
\ No newline at end of file
package com.zq.sync.entity; package com.zq.sync.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -23,6 +25,13 @@ import java.util.Date; ...@@ -23,6 +25,13 @@ import java.util.Date;
public class Fdx88 { public class Fdx88 {
/** /**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 补贴对象类型名称 * 补贴对象类型名称
*/ */
@ApiModelProperty("补贴对象类型名称") @ApiModelProperty("补贴对象类型名称")
...@@ -128,23 +137,23 @@ public class Fdx88 { ...@@ -128,23 +137,23 @@ public class Fdx88 {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private Date datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
\ No newline at end of file
package com.zq.sync.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("reporterror")
public class ReportError {
/**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 表名
*/
@ApiModelProperty("表名")
private String tableName;
/**
* 流水号
*/
@ApiModelProperty("流水号")
private String serialNumber;
/**
* 错误信息
*/
@ApiModelProperty("错误信息")
private String errorInfo;
/**
* 状态
*/
@ApiModelProperty("状态")
private Integer state;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
}
...@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component; ...@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
@Slf4j @Slf4j
@Component //@Component
@RequiredArgsConstructor @RequiredArgsConstructor
public class ReportTask { public class ReportTask {
......
...@@ -283,23 +283,23 @@ public class Fdx01Vo { ...@@ -283,23 +283,23 @@ public class Fdx01Vo {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private String datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
...@@ -284,23 +284,23 @@ public class Fdx02Vo { ...@@ -284,23 +284,23 @@ public class Fdx02Vo {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private String datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
...@@ -122,23 +122,23 @@ public class Fdx03Vo { ...@@ -122,23 +122,23 @@ public class Fdx03Vo {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private String datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
...@@ -145,23 +145,23 @@ public class Fdx04Vo { ...@@ -145,23 +145,23 @@ public class Fdx04Vo {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private String datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
...@@ -147,23 +147,23 @@ public class Fdx05Vo { ...@@ -147,23 +147,23 @@ public class Fdx05Vo {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private String datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
...@@ -54,7 +54,7 @@ public class Fdx06Vo { ...@@ -54,7 +54,7 @@ public class Fdx06Vo {
* 发证时间 * 发证时间
*/ */
@ApiModelProperty("发证时间") @ApiModelProperty("发证时间")
private Date afdx0831; private String afdx0831;
/** /**
* 档案编号 * 档案编号
...@@ -288,23 +288,23 @@ public class Fdx06Vo { ...@@ -288,23 +288,23 @@ public class Fdx06Vo {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private String datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
...@@ -171,23 +171,23 @@ public class Fdx07Vo { ...@@ -171,23 +171,23 @@ public class Fdx07Vo {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private String datatime;
/** /**
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
...@@ -121,23 +121,23 @@ public class Fdx88Vo { ...@@ -121,23 +121,23 @@ public class Fdx88Vo {
* 数据唯一流水号 * 数据唯一流水号
*/ */
@ApiModelProperty("数据唯一流水号") @ApiModelProperty("数据唯一流水号")
private String serialNumner; private String serialnumber;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态") @ApiModelProperty("数据状态")
private String dataStatus; private String datastatus;
/** /**
* 数据上报时间 * 数据上报时间
*/ */
@ApiModelProperty("数据上报时间") @ApiModelProperty("数据上报时间")
private Date dataTime; private String datatime;
/** /**s
* 区划代码 * 区划代码
*/ */
@ApiModelProperty("区划代码") @ApiModelProperty("区划代码")
private String areaCode; private String areacode;
} }
...@@ -14,7 +14,7 @@ spring: ...@@ -14,7 +14,7 @@ spring:
url-pattern: /druid/* url-pattern: /druid/*
reset-enable: false reset-enable: false
dynamic: # mybatis plus多数据源插件 dynamic: # mybatis plus多数据源插件
primary: master #设置默认的数据源或者数据源组,默认值即为master primary: gxcj #设置默认的数据源或者数据源组,默认值即为master
strict: true #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源 strict: true #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
datasource: datasource:
gxcj: gxcj:
...@@ -53,5 +53,5 @@ spring: ...@@ -53,5 +53,5 @@ spring:
mybatis-plus: mybatis-plus:
global-config: global-config:
db-config: db-config:
select-strategy: not_empty where-strategy: not_empty
update-strategy: not_empty update-strategy: not_empty
\ No newline at end of file
...@@ -66,7 +66,7 @@ public class TokenFilter extends GenericFilterBean { ...@@ -66,7 +66,7 @@ public class TokenFilter extends GenericFilterBean {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException { throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String token = resolveToken(httpServletRequest); String token = tokenProvider.getToken(httpServletRequest);
// 对于 Token 为空的不需要去查 Redis // 对于 Token 为空的不需要去查 Redis
if (StrUtil.isNotBlank(token)) { if (StrUtil.isNotBlank(token)) {
OnlineUserDto onlineUserDto = null; OnlineUserDto onlineUserDto = null;
...@@ -94,23 +94,4 @@ public class TokenFilter extends GenericFilterBean { ...@@ -94,23 +94,4 @@ public class TokenFilter extends GenericFilterBean {
filterChain.doFilter(servletRequest, servletResponse); filterChain.doFilter(servletRequest, servletResponse);
} }
/**
* 初步检测Token
*
* @param request /
* @return /
*/
private String resolveToken(HttpServletRequest request) {
String bearerToken = request.getHeader(properties.getHeader());
if (StringUtils.isBlank(bearerToken)) {
return null;
}
if (bearerToken.startsWith(properties.getTokenStartWith())) {
// 去掉令牌前缀
return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token:{}", bearerToken);
}
return null;
}
} }
...@@ -27,6 +27,7 @@ import io.jsonwebtoken.Jwts; ...@@ -27,6 +27,7 @@ import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.SignatureAlgorithm;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
...@@ -34,7 +35,6 @@ import org.springframework.security.core.GrantedAuthority; ...@@ -34,7 +35,6 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -132,9 +132,14 @@ public class TokenProvider implements InitializingBean { ...@@ -132,9 +132,14 @@ public class TokenProvider implements InitializingBean {
public String getToken(HttpServletRequest request) { public String getToken(HttpServletRequest request) {
String bearerToken = request.getHeader(properties.getHeader()); String bearerToken = request.getHeader(properties.getHeader());
if (StringUtils.hasText(bearerToken) && bearerToken.startsWith(properties.getTokenStartWith())) { if (StringUtils.isBlank(bearerToken)) {
return null;
}
if (bearerToken.startsWith(properties.getTokenStartWith())) {
// 去掉令牌前缀 // 去掉令牌前缀
return bearerToken.replace(properties.getTokenStartWith(), ""); return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token:{}", bearerToken);
} }
return null; return null;
} }
......
...@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean { ...@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException { throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String token = resolveToken(httpServletRequest); String token = tokenProvider.getToken(httpServletRequest);
// 对于 Token 为空的不需要去查 Redis // 对于 Token 为空的不需要去查 Redis
if (StrUtil.isNotBlank(token)) { if (StrUtil.isNotBlank(token)) {
OnlineUserDto onlineUserDto = null; OnlineUserDto onlineUserDto = null;
...@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean { ...@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean {
filterChain.doFilter(servletRequest, servletResponse); filterChain.doFilter(servletRequest, servletResponse);
} }
/**
* 初步检测Token
*
* @param request /
* @return /
*/
private String resolveToken(HttpServletRequest request) {
String bearerToken = request.getHeader(properties.getHeader());
if (StringUtils.isBlank(bearerToken)) {
return null;
}
if (bearerToken.startsWith(properties.getTokenStartWith())) {
// 去掉令牌前缀
return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token:{}", bearerToken);
}
return null;
}
} }
...@@ -25,6 +25,7 @@ import io.jsonwebtoken.Jwts; ...@@ -25,6 +25,7 @@ import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.SignatureAlgorithm;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
...@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority; ...@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean { ...@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean {
} }
public Authentication getAuthentication(String token) { public Authentication getAuthentication(String token) {
Claims claims = Jwts.parser() Claims claims = getClaims(token);
.setSigningKey(DatatypeConverter.parseBase64Binary(properties.getBase64Secret()))
.parseClaimsJws(token)
.getBody();
// fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException // fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException
Object authoritiesStr = claims.get(AUTHORITIES_KEY); Object authoritiesStr = claims.get(AUTHORITIES_KEY);
...@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean { ...@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean {
public String getToken(HttpServletRequest request) { public String getToken(HttpServletRequest request) {
String bearerToken = request.getHeader(properties.getHeader()); String bearerToken = request.getHeader(properties.getHeader());
if (StringUtils.hasText(bearerToken) && bearerToken.startsWith(properties.getTokenStartWith())) { if (StringUtils.isBlank(bearerToken)) {
return null;
}
if (bearerToken.startsWith(properties.getTokenStartWith())) {
// 去掉令牌前缀 // 去掉令牌前缀
return bearerToken.replace(properties.getTokenStartWith(), ""); return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token:{}", bearerToken);
} }
return null; return null;
} }
......
...@@ -63,5 +63,5 @@ spring: ...@@ -63,5 +63,5 @@ spring:
mybatis-plus: mybatis-plus:
global-config: global-config:
db-config: db-config:
select-strategy: not_empty where-strategy: not_empty
update-strategy: not_empty update-strategy: not_empty
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment