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;
import cn.hutool.extra.servlet.ServletUtil;
import com.alibaba.fastjson.JSON;
import com.zq.api.constant.ApiCodeEnum;
import com.zq.api.constant.ApiMethod;
import com.zq.api.form.ApiForm;
import com.zq.api.form.ApiResp;
import com.zq.api.service.ApiService;
import com.zq.api.service.IApiLogic;
import com.zq.api.utils.ApiUtils;
import com.zq.common.utils.ThrowableUtil;
import com.zq.common.vo.ResultVo;
import feign.FeignException;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
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接口")
@RestController
......@@ -87,9 +96,7 @@ public class ApiController {
// 调试日志
if (ApiUtils.DEBUG) {
System.out.println("API DEBUG ACTION \n[from=" + form + "]"
+ "\n[resp=" + JSON.toJSONString(resp) + "]"
+ "\n[time=" + (System.currentTimeMillis() - start) + "ms]");
System.out.println("API DEBUG ACTION \n[from=" + form + "]" + "\n[resp=" + JSON.toJSONString(resp) + "]" + "\n[time=" + (System.currentTimeMillis() - start) + "ms]");
}
String clientIP = ServletUtil.getClientIP(request);
......@@ -109,4 +116,33 @@ public class ApiController {
ApiUtils.DEBUG = !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 {
@PostMapping("/stats/getAreaUnderNumStats")
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;
import com.zq.api.constant.ApiMethod;
import com.zq.api.form.ApiForm;
import com.zq.api.form.ApiResp;
......@@ -9,250 +10,105 @@ import com.zq.api.form.ApiResp;
* 2016年9月29日 上午11:45:08
*/
public interface IApiLogic extends IApiCommon {
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓SYS APP接口↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
/**
* 获取用户信息
*
* @return
*/
@ApiMethod(name = "获取用户信息", service = "SYS-SERVER")
ApiResp getUserInfo(ApiForm form);
/**
* 发送验证码
*
* @param form
* @return
*/
@ApiMethod(name = "发送验证码", service = "SYS-SERVER")
ApiResp sendCode(ApiForm form);
/**
* 重置密码
*
* @param form
* @return
*/
@ApiMethod(name = "重置密码", service = "SYS-SERVER")
ApiResp resetPassword(ApiForm form);
/**
* 用户手机号登录
*
* @param form
* @return
*/
@ApiMethod(name = "用户手机号登录", service = "SYS-SERVER")
ApiResp phoneLogin(ApiForm form);
/**
* 密码登录
*
* @param form
* @return
*/
@ApiMethod(name = "密码登录", service = "SYS-SERVER")
ApiResp passwdLogin(ApiForm form);
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓门户接口↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
/**
* 获取婚姻统计
*
* @param form
* @return
*/
@ApiMethod(name = "获取婚姻统计", service = "PORTAL-SERVER")
ApiResp getMarriageStats(ApiForm form);
/**
* 获取区域下的婚姻统计列表
*
* @param form
* @return
*/
@ApiMethod(name = "获取区域下的婚姻统计列表", service = "PORTAL-SERVER")
ApiResp getAreaUnderMarriageStatsList(ApiForm form);
/**
* 获取近5年婚姻走势
*
* @param form
* @return
*/
@ApiMethod(name = "获取近5年婚姻走势", service = "PORTAL-SERVER")
ApiResp getFivesYearMarriageLine(ApiForm form);
/**
* 获取区域残疾发放统计
*
* @param form
* @return
*/
@ApiMethod(name = "获取区域残疾发放统计", service = "PORTAL-SERVER")
ApiResp getAreaDisabledIssueStats(ApiForm form);
/**
* 近五年发放人数和金额统计
*
* @param form
* @return
*/
@ApiMethod(name = "近五年发放人数和金额统计", service = "PORTAL-SERVER")
ApiResp getYearDisabledIssueStats(ApiForm form);
/**
* 获取区域社会救助统计列表
*
* @param form
* @return
*/
@ApiMethod(name = "获取在享补贴统计", service = "PORTAL-SERVER")
ApiResp getEnjoySubsidyStats(ApiForm form);
@ApiMethod(name = "获取区域统计列表", service = "PORTAL-SERVER")
ApiResp getAreaShjzStats(ApiForm form);
/**
* 获取区域社会救助统计列表
*
* @param form
* @return
*/
@ApiMethod(name = "获取区域社会救助统计列表", service = "PORTAL-SERVER")
ApiResp getAreaUnderNumStats(ApiForm form);
/**
* 获取近五年城市农村低保发放人数统计
*
* @param form
* @return
*/
@ApiMethod(name = "获取近五年城市农村低保发放人数统计", service = "PORTAL-SERVER")
ApiResp getFivesYearShjzAchieveStats(ApiForm form);
/**
* 获取近五年城市农村低保发放金额统计
*
* @param form
* @return
*/
@ApiMethod(name = "获取近五年城市农村低保发放金额统计", service = "PORTAL-SERVER")
ApiResp getFivesYearShjzProvideStats(ApiForm form);
/**
* 修改登录密码
*
* @param form
* @return
*/
@ApiMethod(name = "修改登录密码", service = "PORTAL-SERVER")
ApiResp modifyPasswd(ApiForm form);
/**
* 获取App最新版本
*
* @param form
* @return
*/
@ApiMethod(name = "获取App最新版本", service = "PORTAL-SERVER")
ApiResp getAppVersion(ApiForm form);
/**
* 获取子区域列表
*
* @param form
* @return
*/
@ApiMethod(name = "获取子区域列表", service = "PORTAL-SERVER")
ApiResp getChildAreaList(ApiForm form);
/**
* 获取社会机构统计
*
* @param form
* @return
*/
@ApiMethod(name = "获取社会机构统计", service = "PORTAL-SERVER")
ApiResp getSoorganStats(ApiForm form);
/**
* 获取地区下面社会机构统计列表
*
* @param form
* @return
*/
@ApiMethod(name = "获取地区下面社会机构统计列表", service = "PORTAL-SERVER")
ApiResp getAreaUnderSoorganStatsList(ApiForm form);
/**
* 获取App首页地图数据
*
* @param form
* @return
*/
@ApiMethod(name = "获取App首页地图数据", service = "PORTAL-SERVER")
ApiResp getAppMapStats(ApiForm form);
/**
* 汇总搜索
*
* @param form
* @return
*/
@ApiMethod(name = "汇总搜索", service = "PORTAL-SERVER")
ApiResp gatherSearch(ApiForm form);
/**
* 指定区域下的儿童福利数据统计
*
* @param form
* @return
*/
@ApiMethod(name = "指定区域下的儿童福利数据统计", service = "PORTAL-SERVER")
ApiResp getAgencyChildStats(ApiForm form);
/**
* 指定区域下级区域的儿童福利数据统计列表
*
* @param form
* @return
*/
@ApiMethod(name = "指定区域下级区域的儿童福利数据统计列表", service = "PORTAL-SERVER")
ApiResp getAgencyChildStatsList(ApiForm form);
/**
* 火化量统计
*
* @param form
* @return
*/
@ApiMethod(name = "火化量统计", service = "PORTAL-SERVER")
ApiResp getCremationStats(ApiForm form);
/**
* 火化量统计列表
*
* @param form
* @return
*/
@ApiMethod(name = "火化量统计列表", service = "PORTAL-SERVER")
ApiResp getCremationStatsList(ApiForm form);
/**
* 殡仪馆火化量统计列表
*
* @param form
* @return
*/
@ApiMethod(name = "殡仪馆火化量统计列表", service = "PORTAL-SERVER")
ApiResp getCremationStatsById(ApiForm form);
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓SYS接口↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓SYS单点登录接口↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
/**
* 获取单点登录用户信息
*
* @param form
* @return
*/
@ApiMethod(name = "获取单点登录用户信息", service = "SYS-SERVER")
ApiResp getSsoUserInfo(ApiForm form);
/**
* 单点登出
*
* @param form
* @return
*/
@ApiMethod(name = "单点登出", service = "SYS-SERVER")
ApiResp ssoLogout(ApiForm form);
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓开放接口↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
/**
* 婚姻搜索接口
*
* @param form
* @return
*/
@ApiMethod(name = "婚姻搜索接口", service = "OPEN-SERVER")
ApiResp marriageSearch(ApiForm form);
/**
* 自然人搜索接口
*
* @param form
* @return
*/
@ApiMethod(name = "自然人搜索接口", service = "OPEN-SERVER")
ApiResp naturalPersonSearch(ApiForm form);
}
......@@ -91,6 +91,11 @@ public class ApiV100Logic extends BaseApiLogic implements IApiLogic {
}
@Override
public ApiResp getEnjoySubsidyStats(ApiForm form) {
return ApiUtils.toApiResp(form, portalFeign.getEnjoySubsidyStats(form.getParamsMap()));
}
@Override
public ApiResp getAreaShjzStats(ApiForm form) {
return ApiUtils.toApiResp(form, portalFeign.getAreaShjzStats(form.getParamsMap()));
}
......
......@@ -69,7 +69,7 @@ spring:
mybatis-plus:
global-config:
db-config:
select-strategy: not_empty
where-strategy: not_empty
update-strategy: not_empty
#logging.level.com.zq.drug.dao: debug
\ No newline at end of file
......@@ -62,7 +62,7 @@
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.2.1</version>
<version>5.3.0</version>
</dependency>
<!--spring boot 集成redis所需common-pool2-->
......@@ -82,7 +82,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
<version>2.11.0</version>
</dependency>
<!--工具包-->
......@@ -119,12 +119,18 @@
<dependency>
<groupId>com.jfinal</groupId>
<artifactId>jfinal-weixin</artifactId>
<version>3.1</version>
<version>3.4</version>
</dependency>
<dependency>
<groupId>com.jfinal</groupId>
<artifactId>jfinal-ext3</artifactId>
<version>4.0.3</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
......
......@@ -21,7 +21,11 @@ public class MybatisConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
// 分页插件
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
interceptor.addInnerInterceptor(paginationInnerInterceptor);
return interceptor;
}
......@@ -34,13 +38,8 @@ public class MybatisConfig {
public PageInterceptor pageInterceptor() {
PageInterceptor pageInterceptor = new PageInterceptor();
Properties properties = new Properties();
properties.setProperty("offsetAsPageNum", "false");
properties.setProperty("rowBoundsWithCount", "false");
properties.setProperty("pageSizeZero", "true");
properties.setProperty("reasonable", "false");
properties.setProperty("supportMethodsArguments", "false");
properties.setProperty("returnPageInfo", "none");
properties.setProperty("autoRuntimeDialect", "true");
// properties.setProperty("helperDialect", "mysql");//指定方言
properties.setProperty("autoRuntimeDialect", "true");//自动获取方言
pageInterceptor.setProperties(properties);
return pageInterceptor;
}
......
......@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String token = resolveToken(httpServletRequest);
String token = tokenProvider.getToken(httpServletRequest);
// 对于 Token 为空的不需要去查 Redis
if (StrUtil.isNotBlank(token)) {
OnlineUserDto onlineUserDto = null;
......@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean {
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;
import io.jsonwebtoken.SignatureAlgorithm;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
......@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
......@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean {
}
public Authentication getAuthentication(String token) {
Claims claims = Jwts.parser()
.setSigningKey(DatatypeConverter.parseBase64Binary(properties.getBase64Secret()))
.parseClaimsJws(token)
.getBody();
Claims claims = getClaims(token);
// fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException
Object authoritiesStr = claims.get(AUTHORITIES_KEY);
......@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean {
public String getToken(HttpServletRequest request) {
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(), "");
} else {
log.debug("非法Token:{}", bearerToken);
}
return null;
}
......
......@@ -71,7 +71,7 @@ spring:
mybatis-plus:
global-config:
db-config:
select-strategy: not_empty
where-strategy: not_empty
update-strategy: not_empty
#日志等级
......
......@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String token = resolveToken(httpServletRequest);
String token = tokenProvider.getToken(httpServletRequest);
// 对于 Token 为空的不需要去查 Redis
if (StrUtil.isNotBlank(token)) {
OnlineUserDto onlineUserDto = null;
......@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean {
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;
import io.jsonwebtoken.SignatureAlgorithm;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
......@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
......@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean {
}
public Authentication getAuthentication(String token) {
Claims claims = Jwts.parser()
.setSigningKey(DatatypeConverter.parseBase64Binary(properties.getBase64Secret()))
.parseClaimsJws(token)
.getBody();
Claims claims = getClaims(token);
// fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException
Object authoritiesStr = claims.get(AUTHORITIES_KEY);
......@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean {
public String getToken(HttpServletRequest request) {
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(), "");
} else {
log.debug("非法Token:{}", bearerToken);
}
return null;
}
......
......@@ -77,5 +77,5 @@ spring:
mybatis-plus:
global-config:
db-config:
select-strategy: not_empty
where-strategy: not_empty
update-strategy: not_empty
\ No newline at end of file
......@@ -23,11 +23,14 @@
<swagger.version>2.9.2</swagger.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>
<jjwt.version>0.9.1</jjwt.version>
<fastjson.version>1.2.76</fastjson.version>
<hutool.version>5.7.16</hutool.version>
<fastjson.version>1.2.79</fastjson.version>
<hutool.version>5.7.18</hutool.version>
<logback.version>1.2.10</logback.version>
<log4j2.version>2.17.1</log4j2.version>
</properties>
<modules>
......
......@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String token = resolveToken(httpServletRequest);
String token = tokenProvider.getToken(httpServletRequest);
// 对于 Token 为空的不需要去查 Redis
if (StrUtil.isNotBlank(token)) {
OnlineUserDto onlineUserDto = null;
......@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean {
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;
import io.jsonwebtoken.SignatureAlgorithm;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
......@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
......@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean {
}
public Authentication getAuthentication(String token) {
Claims claims = Jwts.parser()
.setSigningKey(DatatypeConverter.parseBase64Binary(properties.getBase64Secret()))
.parseClaimsJws(token)
.getBody();
Claims claims = getClaims(token);
// fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException
Object authoritiesStr = claims.get(AUTHORITIES_KEY);
......@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean {
public String getToken(HttpServletRequest request) {
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(), "");
} else {
log.debug("非法Token:{}", bearerToken);
}
return null;
}
......
......@@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
@Api(tags = "残疾统计相关接口")
@RequiredArgsConstructor
@RestController
......@@ -39,4 +41,10 @@ public class CjStatsController {
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 {
List<StatsVo> getYearIssueStats(StatsReqVo vo);
List<Map<String, Object>> search(SearchReqVo vo);
List<StatsVo> getAreaSubsidyStats(StatsReqVo vo);
StatsVo getEnjoySumStats(StatsReqVo vo);
}
......@@ -77,4 +77,6 @@ public interface ShjzStatsDao {
* @return
*/
List<StatsVo> getMonyNumStats(StatsReqVo vo);
List<StatsVo> getAreaTotalNumStats(StatsReqVo vo);
}
......@@ -76,6 +76,10 @@ public abstract class PortalCacheKeys {
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) {
return PREFIX + "getAreaNursingStatsList." + vo.getAreaCode() + "." + vo.getYear() + "." + vo.getType();
......@@ -135,4 +139,9 @@ public abstract class PortalCacheKeys {
public static String getAreaShjzStats(StatsReqVo vo) {
return PREFIX + "getAreaShjzStats." + vo.getAreaCode();
}
//获取两项补贴统计
public static String getEnjoySumStatsKey(StatsReqVo vo) {
return PREFIX + "getEnjoySumStats." + vo.getAreaCode();
}
}
......@@ -224,7 +224,7 @@ public class CjStatsService {
List<StatsVo> severeAreaIssueStats = cjStatsDao.getAreaIssueStats(vo);
for (StatsVo severeAreaIssueStat : severeAreaIssueStats) {
SystemArea area = areaDao.selectById(SystemArea.patchZero(severeAreaIssueStat.getCode()));
if(area==null){
if (area == null) {
continue;
}
areaList.add(area.getName());
......@@ -234,9 +234,9 @@ public class CjStatsService {
vo.setSubAreaCode(severeAreaIssueStat.getCode());
Map<String, Object> data = new HashMap<>();
data.put("areaName", area.getName());
data.put("areaCode",severeAreaIssueStat.getCode());
data.put("areaCode", severeAreaIssueStat.getCode());
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("issueAmount", severeAreaIssueStat.getAmount());
areaPeopleNumList.add(data);
......@@ -278,4 +278,54 @@ public class CjStatsService {
}
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 {
List<StatsVo> peopleNumStats = shjzStatsDao.getPeopleNumStats(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<>();
// 添加城市低保人数
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 -> {
Map<String, Object> data = map.computeIfAbsent(statsVo.getCode(), k -> new HashMap<>());
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 -> {
Map<String, Object> data = map.computeIfAbsent(statsVo.getCode(), k -> new HashMap<>());
data.put("villagePeopleNum", statsVo.getNum());
......@@ -388,7 +399,10 @@ public class ShjzStatsService {
v.put("city", area!=null?area.getName():"");
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);
......
......@@ -24,6 +24,14 @@ public class StatsVo {
private String amount;
private String hlnum;
private String hlamount;
private String shnum;
private String shamount;
private String code;
private String date;
......
......@@ -121,5 +121,5 @@ spring:
mybatis-plus:
global-config:
db-config:
select-strategy: not_empty
where-strategy: not_empty
update-strategy: not_empty
......@@ -99,6 +99,24 @@
GROUP BY LEFT(UNIT_ID, #{size})
</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 APPLY_TYPE_ID 'type', GRANT_YEAR 'year', SUM( COUNT_PEOPLE ) 'num', SUM( SUM_MONEY ) 'amount'
FROM `statics_grant`
......
......@@ -110,15 +110,7 @@
<select id="getAreaUnderNumStats" resultType="com.zq.portal.vo.StatsVo">
SELECT
LEFT(h.UNIT_ID, #{size}) 'code',
( CASE h.ISCITY
WHEN 0 THEN '农村低保'
WHEN 1 THEN '城市低保'
WHEN 6 THEN '特困供养'
WHEN 10 THEN '农村低收入'
WHEN 11 THEN '城市低收入'
WHEN 21 THEN '住房救助'
WHEN 31 THEN '城市特困'
ELSE '其他' END ) 'type',
h.ISCITY 'type',
SUM( h.SURE_POPULATION ) 'num'
FROM
ENBUZ_APPLY_HOME h
......@@ -127,11 +119,28 @@
<if test="subAreaCode != null and subAreaCode != ''">
AND h.UNIT_ID LIKE CONCAT(#{subAreaCode}, '%')
</if>
AND DATE_FORMAT( h.PERMIT_DATE, "%Y-%m-%d" ) &lt;= #{date}
AND DATE_FORMAT( h.STOP_DATE, "%Y-%m-%d" ) >= #{date}
<if test="type != null and type != ''">
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
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>
<!--
......@@ -214,10 +223,10 @@
FROM
mon_pay p
WHERE
p.pmonth >= CONCAT(DATE_FORMAT( NOW(), '%Y' ), '-01-01')
AND p.pmonth &lt;= DATE_FORMAT( NOW(), '%Y%m%d' )
p.pay_state = 2
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}
<if test="subAreaCode != null and subAreaCode != ''">
AND p.unit_id LIKE CONCAT(#{subAreaCode}, '%')
......
......@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String token = resolveToken(httpServletRequest);
String token = tokenProvider.getToken(httpServletRequest);
// 对于 Token 为空的不需要去查 Redis
if (StrUtil.isNotBlank(token)) {
OnlineUserDto onlineUserDto = null;
......@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean {
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;
import io.jsonwebtoken.SignatureAlgorithm;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
......@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
......@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean {
}
public Authentication getAuthentication(String token) {
Claims claims = Jwts.parser()
.setSigningKey(DatatypeConverter.parseBase64Binary(properties.getBase64Secret()))
.parseClaimsJws(token)
.getBody();
Claims claims = getClaims(token);
// fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException
Object authoritiesStr = claims.get(AUTHORITIES_KEY);
......@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean {
public String getToken(HttpServletRequest request) {
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(), "");
} else {
log.debug("非法Token:{}", bearerToken);
}
return null;
}
......
......@@ -71,7 +71,7 @@ spring:
mybatis-plus:
global-config:
db-config:
select-strategy: not_empty
where-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;
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 lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("fdx01")
public class Fdx01 {
/**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 残疾人姓名
*/
@ApiModelProperty("残疾人姓名")
......@@ -287,23 +299,23 @@ public class Fdx01 {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private Date datatime;
/**
* 区划代码
*/
@ApiModelProperty("区划代码")
private String areaCode;
private String areacode;
}
\ No newline at end of file
package com.zq.sync.entity;
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 lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("fdx02")
public class Fdx02 {
/**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 残疾人姓名
*/
@ApiModelProperty("残疾人姓名")
......@@ -287,23 +299,23 @@ public class Fdx02 {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private Date datatime;
/**
* 区划代码
*/
@ApiModelProperty("区划代码")
private String areaCode;
private String areacode;
}
\ No newline at end of file
package com.zq.sync.entity;
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 lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("fdx03")
public class Fdx03 {
/**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 残疾人姓名
*/
@ApiModelProperty("残疾人姓名")
......@@ -125,23 +137,23 @@ public class Fdx03 {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private Date datatime;
/**
* 区划代码
*/
@ApiModelProperty("区划代码")
private String areaCode;
private String areacode;
}
\ No newline at end of file
package com.zq.sync.entity;
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 lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("fdx04")
public class Fdx04 {
/**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 残疾人姓名
*/
@ApiModelProperty("残疾人姓名")
......@@ -149,23 +161,23 @@ public class Fdx04 {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private Date datatime;
/**
* 区划代码
*/
@ApiModelProperty("区划代码")
private String areaCode;
private String areacode;
}
\ No newline at end of file
package com.zq.sync.entity;
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 lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("fdx05")
public class Fdx05 {
/**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 残疾人姓名
*/
@ApiModelProperty("残疾人姓名")
......@@ -149,23 +161,23 @@ public class Fdx05 {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private Date datatime;
/**
* 区划代码
*/
@ApiModelProperty("区划代码")
private String areaCode;
private String areacode;
}
\ No newline at end of file
package com.zq.sync.entity;
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 lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -17,9 +21,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("fdx06")
public class Fdx06 {
/**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 残疾人姓名
*/
@ApiModelProperty("残疾人姓名")
......@@ -293,23 +305,23 @@ public class Fdx06 {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private Date datatime;
/**
* 区划代码
*/
@ApiModelProperty("区划代码")
private String areaCode;
private String areacode;
}
\ No newline at end of file
......@@ -2,6 +2,9 @@ package com.zq.sync.entity;
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 io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -19,9 +22,17 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("fdx07")
public class Fdx07 {
/**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 省
*/
@ApiModelProperty("省")
......@@ -175,23 +186,23 @@ public class Fdx07 {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private Date datatime;
/**
* 区划代码
*/
@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;
......@@ -23,6 +25,13 @@ import java.util.Date;
public class Fdx88 {
/**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 补贴对象类型名称
*/
@ApiModelProperty("补贴对象类型名称")
......@@ -128,23 +137,23 @@ public class Fdx88 {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private Date datatime;
/**
* 区划代码
*/
@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;
}
......@@ -2,11 +2,13 @@ package com.zq.sync.service;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zq.sync.dao.*;
import com.zq.sync.entity.*;
......@@ -32,62 +34,91 @@ public class DisabledService {
private final Fdx03Dao fdx03Dao;
private final Fdx02Dao fdx02Dao;
private final Fdx01Dao fdx01Dao;
private ReportErroorDao erroorDao;
public void fdx88(){
public void reportCommon(HttpRequest request, String tableName) {
HttpResponse response = request.execute();
if (response.getStatus() != 200) {
log.error("接口请求失败 => {}", request);
}
String body = response.body();
JSONObject obj = JSONUtil.parseObj(body);
Integer code = obj.getInt("code");
if (code == null || code != 1) {
log.warn("上报错误:{}, => {}", request.getUrl(), body);
}
JSONObject bizData = obj.getJSONObject("biz_data");
if (bizData != null) {
Integer workStatus = bizData.getInt("work_status");
if (workStatus == 2) {
log.warn("上报错误biz_data.work_status=2");
}
JSONArray errorList = bizData.getJSONArray("error_list");
if (errorList != null && errorList.size() > 0) {
for (Object o : errorList) {
JSONObject object = JSONUtil.parseObj(o);
String serialNumber = object.getStr("serialNumber");
String errorInfo = object.getStr("error_info");
erroorDao.insert(ReportError.builder()
.tableName(tableName)
.serialNumber(serialNumber)
.errorInfo(errorInfo)
.state(0)
.createTime(DateUtil.date())
.build());
}
}
}
}
public void fdx88() {
int page = 1;
int size = 10000;
while (true){
Page<Fdx88> fdx88Page = fdx88Dao.selectPage(new Page<>(page, size), null);
int size = 1000;
while (true) {
LambdaQueryWrapper<Fdx88> lambdaQuery = Wrappers.lambdaQuery(Fdx88.class).orderByAsc(Fdx88::getId);
Page<Fdx88> fdx88Page = fdx88Dao.selectPage(new Page<>(page, size), lambdaQuery);
List<Fdx88> records = fdx88Page.getRecords();
for (Fdx88 fdx88 : records) {
Fdx88Vo build = Fdx88Vo.builder()
.afdx0801(fdx88.getAfdx0801())
.axcp0004(fdx88.getAxcp0004())
.afdx0803(fdx88.getAfdx0803()!=null? BigDecimal.valueOf(fdx88.getAfdx0803()).setScale(2, RoundingMode.HALF_UP).toString():"")
.afdx0803(fdx88.getAfdx0803() != null ? BigDecimal.valueOf(fdx88.getAfdx0803()).setScale(2, RoundingMode.HALF_UP).toString() : "")
.afdx0804(fdx88.getAfdx0804())
.afdx0805(fdx88.getAfdx0805())
.afdx0806(fdx88.getAfdx0806())
.afdx0807(fdx88.getAfdx0807())
.afdx0808(fdx88.getAfdx0808())
.afdx0809(fdx88.getAfdx0809())
.afdx0810(fdx88.getAfdx0810()!=null? DateUtil.format(fdx88.getAfdx0810(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0811(fdx88.getAfdx0811()!=null? DateUtil.format(fdx88.getAfdx0811(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0810(fdx88.getAfdx0810() != null ? DateUtil.format(fdx88.getAfdx0810(), DatePattern.NORM_MONTH_PATTERN) : "")
.afdx0811(fdx88.getAfdx0811() != null ? DateUtil.format(fdx88.getAfdx0811(), DatePattern.NORM_MONTH_PATTERN) : "")
.afdx0812(fdx88.getAfdx0812())
.afdx0814(fdx88.getAfdx0814())
.afdx0815(fdx88.getAfdx0815())
.afdx0816(fdx88.getAfdx0816())
.afdx0817(fdx88.getAfdx0817()!=null? DateUtil.format(fdx88.getAfdx0817(), DatePattern.NORM_DATETIME_PATTERN):"")
.afdx0818(fdx88.getAfdx0818()!=null? DateUtil.format(fdx88.getAfdx0818(), DatePattern.NORM_DATETIME_PATTERN):"")
.serialNumner(fdx88.getSerialNumner())
.dataStatus(fdx88.getDataStatus())
.dataTime(fdx88.getDataTime())
.areaCode(fdx88.getAreaCode())
.afdx0817(fdx88.getAfdx0817() != null ? DateUtil.format(fdx88.getAfdx0817(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0818(fdx88.getAfdx0818() != null ? DateUtil.format(fdx88.getAfdx0818(), DatePattern.NORM_DATETIME_PATTERN) : "")
.serialnumber(fdx88.getSerialnumber())
.datastatus(fdx88.getDatastatus())
.datatime(fdx88.getDatatime() != null ? DateUtil.format(fdx88.getDatatime(), DatePattern.NORM_DATETIME_PATTERN) : "")
.areacode(fdx88.getAreacode())
.build();
HttpRequest request = HttpRequest.post("https://59.255.186.1/yhbcp-engine_gov/rest/cjrfl_report_btdxlxxx")
HttpRequest request = HttpRequest.post("https://zwxt.mca.gov.cn/yhbcp-engine_gov/rest/cjrfl_report_btdxlxxx")
.contentType("application/x-www-form-urlencoded")
.form("access_key", "mzb_gx_450000")
.form("format", "json")
.form("request_id", IdUtil.simpleUUID())
.form("sign", "")
.form("timestamp", System.currentTimeMillis())
.form("version", "1.0")
.form("biz_content", JSONUtil.toJsonStr(build));
HttpResponse response = request.execute();
if(response.getStatus()!=200){
log.error("接口请求失败 => {}", request);
}
String body = response.body();
JSONObject obj = JSONUtil.parseObj(body);
Integer code = obj.getInt("code");
if(code==null||code!=1){
log.warn("上报错误 => {}",body);
}
System.out.println(request);
reportCommon(request, "fdx88");
}
if(!fdx88Page.hasNext()){
if (!fdx88Page.hasNext()) {
break;
}
page++;
......@@ -96,94 +127,86 @@ public class DisabledService {
public void fdx07() {
int page = 1;
int size = 10000;
while (true){
Page<Fdx07> fdx07Page = fdx07Dao.selectPage(new Page<>(page, size), null);
int size = 5000;
while (true) {
LambdaQueryWrapper<Fdx07> lambdaQuery = Wrappers.lambdaQuery(Fdx07.class).orderByAsc(Fdx07::getId);
Page<Fdx07> fdx07Page = fdx07Dao.selectPage(new Page<>(page, size), lambdaQuery);
List<Fdx07> records = fdx07Page.getRecords();
for (Fdx07 fdx07 : records) {
Fdx07Vo build = Fdx07Vo.builder()
.agax0806(fdx07.getAgax0806())
.agax0807(fdx07.getAgax0807())
.agax0808(fdx07.getAgax0808())
.agax0901(fdx07.getAgax0901()!=null? DateUtil.format(fdx07.getAgax0901(), DatePattern.NORM_MONTH_PATTERN):"")
.agax0901(fdx07.getAgax0901() != null ? DateUtil.format(fdx07.getAgax0901(), DatePattern.NORM_MONTH_PATTERN) : "")
.agax0902(fdx07.getAgax0902())
.agax0903(fdx07.getAgax0903())
.agax0904(fdx07.getAgax0904())
.agax0905(fdx07.getAgax0905()!=null? BigDecimal.valueOf(fdx07.getAgax0905()).setScale(2, RoundingMode.HALF_UP).toString():"")
.agax0906(fdx07.getAgax0906()!=null? BigDecimal.valueOf(fdx07.getAgax0906()).setScale(2, RoundingMode.HALF_UP).toString():"")
.agax0907(fdx07.getAgax0907()!=null? BigDecimal.valueOf(fdx07.getAgax0907()).setScale(2, RoundingMode.HALF_UP).toString():"")
.agax0905(fdx07.getAgax0905() != null ? BigDecimal.valueOf(fdx07.getAgax0905()).setScale(2, RoundingMode.HALF_UP).toString() : "")
.agax0906(fdx07.getAgax0906() != null ? BigDecimal.valueOf(fdx07.getAgax0906()).setScale(2, RoundingMode.HALF_UP).toString() : "")
.agax0907(fdx07.getAgax0907() != null ? BigDecimal.valueOf(fdx07.getAgax0907()).setScale(2, RoundingMode.HALF_UP).toString() : "")
.agax0908(fdx07.getAgax0908())
.agax0909(fdx07.getAgax0909()!=null? BigDecimal.valueOf(fdx07.getAgax0909()).setScale(2, RoundingMode.HALF_UP).toString():"")
.agax0909(fdx07.getAgax0909() != null ? BigDecimal.valueOf(fdx07.getAgax0909()).setScale(2, RoundingMode.HALF_UP).toString() : "")
.agax0910(fdx07.getAgax0910())
.agax0911(fdx07.getAgax0911()!=null? BigDecimal.valueOf(fdx07.getAgax0911()).setScale(2, RoundingMode.HALF_UP).toString():"")
.agax0911(fdx07.getAgax0911() != null ? BigDecimal.valueOf(fdx07.getAgax0911()).setScale(2, RoundingMode.HALF_UP).toString() : "")
.agax0912(fdx07.getAgax0912())
.agax0913(fdx07.getAgax0913())
.agax0914(fdx07.getAgax0914())
.agax0915(fdx07.getAgax0915())
.agax0916(fdx07.getAgax0916())
.agax0917(fdx07.getAgax0917())
.agax0918(fdx07.getAgax0918()!=null? BigDecimal.valueOf(fdx07.getAgax0918()).setScale(2, RoundingMode.HALF_UP).toString():"")
.agax0918(fdx07.getAgax0918() != null ? BigDecimal.valueOf(fdx07.getAgax0918()).setScale(2, RoundingMode.HALF_UP).toString() : "")
.agax0919(fdx07.getAgax0919())
.agax0920(fdx07.getAgax0920())
.agax0921(fdx07.getAgax0921())
.agax0922(fdx07.getAgax0922())
.serialNumner(fdx07.getSerialNumner())
.dataStatus(fdx07.getDataStatus())
.dataTime(fdx07.getDataTime())
.areaCode(fdx07.getAreaCode())
.serialnumber(fdx07.getSerialnumber())
.datastatus(fdx07.getDatastatus())
.datatime(fdx07.getDatatime() != null ? DateUtil.format(fdx07.getDatatime(), DatePattern.NORM_DATETIME_PATTERN) : "")
.areacode(fdx07.getAreacode())
.build();
HttpRequest request = HttpRequest.post("https://59.255.186.1/yhbcp-engine_gov/rest/cjrfl_report_ffhzxx")
HttpRequest request = HttpRequest.post("https://zwxt.mca.gov.cn/yhbcp-engine_gov/rest/cjrfl_report_ffhzxx")
.contentType("application/x-www-form-urlencoded")
.form("access_key", "mzb_gx_450000")
.form("format", "json")
.form("request_id", IdUtil.simpleUUID())
.form("sign", "")
.form("timestamp", System.currentTimeMillis())
.form("version", "1.0")
.form("biz_content", JSONUtil.toJsonStr(build));
HttpResponse response = request.execute();
if(response.getStatus()!=200){
log.error("接口请求失败 => {}", request);
}
String body = response.body();
JSONObject obj = JSONUtil.parseObj(body);
Integer code = obj.getInt("code");
if(code==null||code!=1){
log.warn("上报错误 => {}",body);
}
reportCommon(request, "fdx07");
}
if(!fdx07Page.hasNext()){
if (!fdx07Page.hasNext()) {
break;
}
page++;
}
}
public void fdx06(){
public void fdx06() {
int page = 1;
int size = 10000;
while (true){
Page<Fdx06> fdx06Page = fdx06Dao.selectPage(new Page<>(page, size), null);
int size = 5000;
while (true) {
LambdaQueryWrapper<Fdx06> lambdaQuery = Wrappers.lambdaQuery(Fdx06.class).orderByAsc(Fdx06::getId);
Page<Fdx06> fdx06Page = fdx06Dao.selectPage(new Page<>(page, size), lambdaQuery);
List<Fdx06> records = fdx06Page.getRecords();
for (Fdx06 fdx06 : records) {
Fdx06Vo build =Fdx06Vo.builder()
Fdx06Vo build = Fdx06Vo.builder()
.axcp0002(fdx06.getAxcp0002())
.axcp0006(fdx06.getAxcp0006())
.agax0823(fdx06.getAgax0823()!=null? DateUtil.format(fdx06.getAgax0823(), DatePattern.NORM_MONTH_PATTERN):"")
.agax0823(fdx06.getAgax0823() != null ? DateUtil.format(fdx06.getAgax0823(), DatePattern.NORM_DATE_PATTERN) : "")
.axcp0008(fdx06.getAxcp0008())
.axcp0005(fdx06.getAxcp0005())
.afdp0505(fdx06.getAfdp0505())
.afdx0831(fdx06.getAfdx0831())
.afdx0831(fdx06.getAfdx0831()!= null ? DateUtil.format(fdx06.getAfdx0831(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0852(fdx06.getAfdx0852())
.afdp0504(fdx06.getAfdp0504())
.afdp0503(fdx06.getAfdp0503())
.afdx0053(fdx06.getAfdx0053())
.axcp0014(fdx06.getAxcp0014())
.afdx0054(fdx06.getAfdx0054()!=null? DateUtil.format(fdx06.getAfdx0054(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0055(fdx06.getAfdx0055()!=null? DateUtil.format(fdx06.getAfdx0055(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0851(fdx06.getAfdx0851()!=null? BigDecimal.valueOf(fdx06.getAfdx0851()).setScale(2, RoundingMode.HALF_UP).toString():"")
.afdx0561(fdx06.getAfdx0561()!=null? DateUtil.format(fdx06.getAfdx0561(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0054(fdx06.getAfdx0054() != null ? DateUtil.format(fdx06.getAfdx0054(), DatePattern.NORM_MONTH_PATTERN) : "")
.afdx0055(fdx06.getAfdx0055() != null ? DateUtil.format(fdx06.getAfdx0055(), DatePattern.NORM_MONTH_PATTERN) : "")
.afdx0851(fdx06.getAfdx0851() != null ? BigDecimal.valueOf(fdx06.getAfdx0851()).setScale(2, RoundingMode.HALF_UP).toString() : "")
.afdx0561(fdx06.getAfdx0561() != null ? DateUtil.format(fdx06.getAfdx0561(), DatePattern.NORM_MONTH_PATTERN) : "")
.afdx0829(fdx06.getAfdx0829())
.afdx0830(fdx06.getAfdx0830())
.afdx0820(fdx06.getAfdx0820())
......@@ -208,54 +231,45 @@ public class DisabledService {
.afdx1017(fdx06.getAfdx1017())
.afdx0574(fdx06.getAfdx0574())
.afdx0572(fdx06.getAfdx0572())
.afdx0868(fdx06.getAfdx0868()!=null? DateUtil.format(fdx06.getAfdx0868(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0869(fdx06.getAfdx0869()!=null? DateUtil.format(fdx06.getAfdx0869(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0870(fdx06.getAfdx0870()!=null? DateUtil.format(fdx06.getAfdx0870(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0817(fdx06.getAfdx0817()!=null? DateUtil.format(fdx06.getAfdx0817(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0818(fdx06.getAfdx0818()!=null? DateUtil.format(fdx06.getAfdx0818(), DatePattern.NORM_MONTH_PATTERN):"")
.serialNumner(fdx06.getSerialNumner())
.dataStatus(fdx06.getDataStatus())
.dataTime(fdx06.getDataTime())
.areaCode(fdx06.getAreaCode())
.afdx0868(fdx06.getAfdx0868() != null ? DateUtil.format(fdx06.getAfdx0868(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0869(fdx06.getAfdx0869() != null ? DateUtil.format(fdx06.getAfdx0869(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0870(fdx06.getAfdx0870() != null ? DateUtil.format(fdx06.getAfdx0870(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0817(fdx06.getAfdx0817() != null ? DateUtil.format(fdx06.getAfdx0817(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0818(fdx06.getAfdx0818() != null ? DateUtil.format(fdx06.getAfdx0818(), DatePattern.NORM_DATETIME_PATTERN) : "")
.serialnumber(fdx06.getSerialnumber())
.datastatus(fdx06.getDatastatus())
.datatime(fdx06.getDatatime() != null ? DateUtil.format(fdx06.getDatatime(), DatePattern.NORM_DATETIME_PATTERN) : "")
.areacode(fdx06.getAreacode())
.build();
HttpRequest request = HttpRequest.post("https://59.255.186.1/yhbcp-engine_gov/rest/cjrfl_report_lsxx")
HttpRequest request = HttpRequest.post("https://zwxt.mca.gov.cn/yhbcp-engine_gov/rest/cjrfl_report_lsxx")
.contentType("application/x-www-form-urlencoded")
.form("access_key", "mzb_gx_450000")
.form("format", "json")
.form("request_id", IdUtil.simpleUUID())
.form("sign", "")
.form("timestamp", System.currentTimeMillis())
.form("version", "1.0")
.form("biz_content", JSONUtil.toJsonStr(build));
HttpResponse response = request.execute();
if(response.getStatus()!=200){
log.error("接口请求失败 => {}", request);
}
String body = response.body();
JSONObject obj = JSONUtil.parseObj(body);
Integer code = obj.getInt("code");
if(code==null||code!=1){
log.warn("上报错误 => {}",body);
}
}
if(!fdx06Page.hasNext()){
break;
}
page++;
reportCommon(request, "fdx06");
}
if (!fdx06Page.hasNext()) {
break;
}
page++;
}
}
public void fdx05(){
public void fdx05() {
int page = 1;
int size = 10000;
while (true){
Page<Fdx05> fdx05Page = fdx05Dao.selectPage(new Page<>(page, size), null);
int size = 5000;
while (true) {
LambdaQueryWrapper<Fdx05> lambdaQuery = Wrappers.lambdaQuery(Fdx05.class).orderByAsc(Fdx05::getId);
Page<Fdx05> fdx05Page = fdx05Dao.selectPage(new Page<>(page, size), lambdaQuery);
List<Fdx05> records = fdx05Page.getRecords();
for (Fdx05 fdx05 : records) {
Fdx05Vo build = Fdx05Vo.builder()
.axcp0002(fdx05.getAxcp0002())
.axcp0006(fdx05.getAxcp0006())
.afdx0823(fdx05.getAfdx0823()!=null? DateUtil.format(fdx05.getAfdx0823(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0823(fdx05.getAfdx0823() != null ? DateUtil.format(fdx05.getAfdx0823(), DatePattern.NORM_DATE_PATTERN) : "")
.axcp0008(fdx05.getAxcp0008())
.axcp0005(fdx05.getAxcp0005())
.afdp0505(fdx05.getAfdp0505())
......@@ -265,60 +279,51 @@ public class DisabledService {
.afdx0830(fdx05.getAfdx0830())
.axcp0009(fdx05.getAxcp0009())
.axcp0010(fdx05.getAxcp0010())
.axcp0011(fdx05.getAxcp0011()!=null? DateUtil.format(fdx05.getAxcp0011(), DatePattern.NORM_MONTH_PATTERN):"")
.axcp0012(fdx05.getAxcp0012()!=null? DateUtil.format(fdx05.getAxcp0012(), DatePattern.NORM_MONTH_PATTERN):"")
.axcp0013(fdx05.getAxcp0013()!=null? DateUtil.format(fdx05.getAxcp0013(), DatePattern.NORM_MONTH_PATTERN):"")
.axcp0011(fdx05.getAxcp0011() != null ? DateUtil.format(fdx05.getAxcp0011(), DatePattern.NORM_MONTH_PATTERN) : "")
.axcp0012(fdx05.getAxcp0012() != null ? DateUtil.format(fdx05.getAxcp0012(), DatePattern.NORM_MONTH_PATTERN) : "")
.axcp0013(fdx05.getAxcp0013() != null ? DateUtil.format(fdx05.getAxcp0013(), DatePattern.NORM_MONTH_PATTERN) : "")
.axcp0014(fdx05.getAxcp0014())
.axcp0015(fdx05.getAxcp0015())
.afdx0806(fdx05.getAfdx0806())
.afdx0807(fdx05.getAfdx0807())
.afdx0808(fdx05.getAfdx0808())
.afdx0802(fdx05.getAfdx0802())
.serialNumner(fdx05.getSerialNumner())
.dataStatus(fdx05.getDataStatus())
.dataTime(fdx05.getDataTime())
.areaCode(fdx05.getAreaCode())
.serialnumber(fdx05.getSerialnumber())
.datastatus(fdx05.getDatastatus())
.datatime(fdx05.getDatatime() != null ? DateUtil.format(fdx05.getDatatime(), DatePattern.NORM_DATETIME_PATTERN) : "")
.areacode(fdx05.getAreacode())
.build();
HttpRequest request = HttpRequest.post("https://59.255.186.1/yhbcp-engine_gov/rest/cjrfl_report_zjryxx")
HttpRequest request = HttpRequest.post("https://zwxt.mca.gov.cn/yhbcp-engine_gov/rest/cjrfl_report_zjryxx")
.contentType("application/x-www-form-urlencoded")
.form("access_key", "mzb_gx_450000")
.form("format", "json")
.form("request_id", IdUtil.simpleUUID())
.form("sign", "")
.form("timestamp", System.currentTimeMillis())
.form("version", "1.0")
.form("biz_content", JSONUtil.toJsonStr(build));
HttpResponse response = request.execute();
if(response.getStatus()!=200){
log.error("接口请求失败 => {}", request);
}
String body = response.body();
JSONObject obj = JSONUtil.parseObj(body);
Integer code = obj.getInt("code");
if(code==null||code!=1){
log.warn("上报错误 => {}",body);
}
}
if(!fdx05Page.hasNext()){
break;
}
page++;
reportCommon(request, "fdx05");
}
if (!fdx05Page.hasNext()) {
break;
}
page++;
}
}
public void fdx04(){
public void fdx04() {
int page = 1;
int size = 10000;
while (true){
Page<Fdx04> fdx04Page = fdx04Dao.selectPage(new Page<>(page, size), null);
int size = 5000;
while (true) {
LambdaQueryWrapper<Fdx04> lambdaQuery = Wrappers.lambdaQuery(Fdx04.class).orderByAsc(Fdx04::getId);
Page<Fdx04> fdx04Page = fdx04Dao.selectPage(new Page<>(page, size), lambdaQuery);
List<Fdx04> records = fdx04Page.getRecords();
for (Fdx04 fdx04 : records){
for (Fdx04 fdx04 : records) {
Fdx04Vo build = Fdx04Vo.builder()
.axcp0002(fdx04.getAxcp0002())
.axcp0006(fdx04.getAxcp0006())
.afdx0823(fdx04.getAfdx0823()!=null? DateUtil.format(fdx04.getAfdx0823(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0823(fdx04.getAfdx0823() != null ? DateUtil.format(fdx04.getAfdx0823(), DatePattern.NORM_DATE_PATTERN) : "")
.axcp0008(fdx04.getAxcp0008())
.axcp0005(fdx04.getAxcp0005())
.afdp0505(fdx04.getAfdp0505())
......@@ -328,58 +333,49 @@ public class DisabledService {
.afdx0830(fdx04.getAfdx0830())
.axcp0009(fdx04.getAxcp0009())
.axcp0010(fdx04.getAxcp0010())
.axcp0011(fdx04.getAxcp0011()!=null? DateUtil.format(fdx04.getAxcp0011(), DatePattern.NORM_MONTH_PATTERN):"")
.axcp0012(fdx04.getAxcp0012()!=null? DateUtil.format(fdx04.getAxcp0012(), DatePattern.NORM_MONTH_PATTERN):"")
.axcp0013(fdx04.getAxcp0013()!=null? DateUtil.format(fdx04.getAxcp0013(), DatePattern.NORM_MONTH_PATTERN):"")
.axcp0011(fdx04.getAxcp0011() != null ? DateUtil.format(fdx04.getAxcp0011(), DatePattern.NORM_MONTH_PATTERN) : "")
.axcp0012(fdx04.getAxcp0012() != null ? DateUtil.format(fdx04.getAxcp0012(), DatePattern.NORM_MONTH_PATTERN) : "")
.axcp0013(fdx04.getAxcp0013() != null ? DateUtil.format(fdx04.getAxcp0013(), DatePattern.NORM_MONTH_PATTERN) : "")
.axcp0014(fdx04.getAxcp0014())
.afdx0055(fdx04.getAfdx0055()!=null? BigDecimal.valueOf(fdx04.getAfdx0055()).setScale(2, RoundingMode.HALF_UP).toString():"")
.afdx0055(fdx04.getAfdx0055() != null ? BigDecimal.valueOf(fdx04.getAfdx0055()).setScale(2, RoundingMode.HALF_UP).toString() : "")
.afdx0806(fdx04.getAfdx0806())
.afdx0807(fdx04.getAfdx0807())
.afdx0808(fdx04.getAfdx0808())
.afdx0802(fdx04.getAfdx0802())
.serialNumner(fdx04.getSerialNumner())
.dataStatus(fdx04.getDataStatus())
.dataTime(fdx04.getDataTime())
.areaCode(fdx04.getAreaCode())
.serialnumber(fdx04.getSerialnumber())
.datastatus(fdx04.getDatastatus())
.datatime(fdx04.getDatatime() != null ? DateUtil.format(fdx04.getDatatime(), DatePattern.NORM_DATETIME_PATTERN) : "")
.areacode(fdx04.getAreacode())
.build();
HttpRequest request = HttpRequest.post("https://59.255.186.1/yhbcp-engine_gov/rest/cjrfl_report_bfryxx")
HttpRequest request = HttpRequest.post("https://zwxt.mca.gov.cn/yhbcp-engine_gov/rest/cjrfl_report_bfryxx")
.contentType("application/x-www-form-urlencoded")
.form("access_key", "mzb_gx_450000")
.form("format", "json")
.form("request_id", IdUtil.simpleUUID())
.form("sign", "")
.form("timestamp", System.currentTimeMillis())
.form("version", "1.0")
.form("biz_content", JSONUtil.toJsonStr(build));
HttpResponse response = request.execute();
if(response.getStatus()!=200){
log.error("接口请求失败 => {}", request);
}
String body = response.body();
JSONObject obj = JSONUtil.parseObj(body);
Integer code = obj.getInt("code");
if(code==null||code!=1){
log.warn("上报错误 => {}",body);
}
}
if(!fdx04Page.hasNext()){
break;
}
page++;
reportCommon(request, "fdx04");
}
if (!fdx04Page.hasNext()) {
break;
}
page++;
}
}
public void fdx03() {
int page = 1;
int size = 10000;
while (true){
Page<Fdx03> fdx03Page = fdx03Dao.selectPage(new Page<>(page, size), null);
int size = 5000;
while (true) {
LambdaQueryWrapper<Fdx03> lambdaQuery = Wrappers.lambdaQuery(Fdx03.class).orderByAsc(Fdx03::getId);
Page<Fdx03> fdx03Page = fdx03Dao.selectPage(new Page<>(page, size), lambdaQuery);
List<Fdx03> records = fdx03Page.getRecords();
for (Fdx03 fdx03 : records) {
Fdx03Vo build = Fdx03Vo.builder()
.axcp0002(fdx03.getAxcp0002())
.axcp0006(fdx03.getAxcp0006())
.afdx0823(fdx03.getAfdx0823()!=null? DateUtil.format(fdx03.getAfdx0823(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0823(fdx03.getAfdx0823() != null ? DateUtil.format(fdx03.getAfdx0823(), DatePattern.NORM_DATE_PATTERN) : "")
.axcp0008(fdx03.getAxcp0008())
.axcp0005(fdx03.getAxcp0005())
.afdp0505(fdx03.getAfdp0505())
......@@ -388,68 +384,59 @@ public class DisabledService {
.afdx0829(fdx03.getAfdx0829())
.afdx0830(fdx03.getAfdx0830())
.afdx0831(fdx03.getAfdx0831())
.afdx0832(fdx03.getAfdx0832()!=null? DateUtil.format(fdx03.getAfdx0832(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0832(fdx03.getAfdx0832() != null ? DateUtil.format(fdx03.getAfdx0832(), DatePattern.NORM_MONTH_PATTERN) : "")
.axcp0004(fdx03.getAxcp0004())
.afdx0806(fdx03.getAfdx0806())
.afdx0807(fdx03.getAfdx0807())
.afdx0808(fdx03.getAfdx0808())
.afdx0802(fdx03.getAfdx0802())
.serialNumner(fdx03.getSerialNumner())
.dataStatus(fdx03.getDataStatus())
.dataTime(fdx03.getDataTime())
.areaCode(fdx03.getAreaCode())
.serialnumber(fdx03.getSerialnumber())
.datastatus(fdx03.getDatastatus())
.datatime(fdx03.getDatatime() != null ? DateUtil.format(fdx03.getDatatime(), DatePattern.NORM_DATETIME_PATTERN) : "")
.areacode(fdx03.getAreacode())
.build();
HttpRequest request = HttpRequest.post("https://59.255.186.1/yhbcp-engine_gov/rest/cjrfl_report_tfryxx")
HttpRequest request = HttpRequest.post("https://zwxt.mca.gov.cn/yhbcp-engine_gov/rest/cjrfl_report_tfryxx")
.contentType("application/x-www-form-urlencoded")
.form("access_key", "mzb_gx_450000")
.form("format", "json")
.form("request_id", IdUtil.simpleUUID())
.form("sign", "")
.form("timestamp", System.currentTimeMillis())
.form("version", "1.0")
.form("biz_content", JSONUtil.toJsonStr(build));
HttpResponse response = request.execute();
if (response.getStatus() != 200) {
log.error("接口请求失败 => {}", request);
}
String body = response.body();
JSONObject obj = JSONUtil.parseObj(body);
Integer code = obj.getInt("code");
if (code == null || code != 1) {
log.warn("上报错误 => {}", body);
}
}
if (!fdx03Page.hasNext()) {
break;
}
page++;
reportCommon(request, "fdx03");
}
if (!fdx03Page.hasNext()) {
break;
}
page++;
}
}
public void fdx02(){
public void fdx02() {
int page = 1;
int size = 10000;
while (true){
Page<Fdx02> fdx02Page = fdx02Dao.selectPage(new Page<>(page, size), null);
int size = 5000;
while (true) {
LambdaQueryWrapper<Fdx02> lambdaQuery = Wrappers.lambdaQuery(Fdx02.class).orderByAsc(Fdx02::getId);
Page<Fdx02> fdx02Page = fdx02Dao.selectPage(new Page<>(page, size), lambdaQuery);
List<Fdx02> records = fdx02Page.getRecords();
for (Fdx02 fdx02 : records) {
Fdx02Vo build= Fdx02Vo.builder()
Fdx02Vo build = Fdx02Vo.builder()
.axcp0002(fdx02.getAxcp0002())
.axcp0006(fdx02.getAxcp0006())
.afdx0823(fdx02.getAfdx0823()!=null? DateUtil.format(fdx02.getAfdx0823(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0823(fdx02.getAfdx0823() != null ? DateUtil.format(fdx02.getAfdx0823(), DatePattern.NORM_DATE_PATTERN) : "")
.axcp0008(fdx02.getAxcp0008())
.axcp0005(fdx02.getAxcp0005())
.afdp0505(fdx02.getAfdp0505())
.afdx0831(fdx02.getAfdx0831()!=null? DateUtil.format(fdx02.getAfdx0831(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0831(fdx02.getAfdx0831() != null ? DateUtil.format(fdx02.getAfdx0831(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0852(fdx02.getAfdx0852())
.afdp0504(fdx02.getAfdp0504())
.afdp0503(fdx02.getAfdp0503())
.afdx0053(fdx02.getAfdx0053())
.axcp0014(fdx02.getAxcp0014())
.afdx0055(fdx02.getAfdx0055()!=null? BigDecimal.valueOf(fdx02.getAfdx0055()).setScale(2, RoundingMode.HALF_UP).toString():"")
.afdx0851(fdx02.getAfdx0851()!=null? BigDecimal.valueOf(fdx02.getAfdx0851()).setScale(2, RoundingMode.HALF_UP).toString():"")
.afdx0561(fdx02.getAfdx0561()!=null? DateUtil.format(fdx02.getAfdx0561(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0055(fdx02.getAfdx0055() != null ? BigDecimal.valueOf(fdx02.getAfdx0055()).setScale(2, RoundingMode.HALF_UP).toString() : "")
.afdx0851(fdx02.getAfdx0851() != null ? BigDecimal.valueOf(fdx02.getAfdx0851()).setScale(2, RoundingMode.HALF_UP).toString() : "")
.afdx0561(fdx02.getAfdx0561() != null ? DateUtil.format(fdx02.getAfdx0561(), DatePattern.NORM_MONTH_PATTERN) : "")
.afdx0829(fdx02.getAfdx0829())
.afdx0830(fdx02.getAfdx0830())
.afdx0820(fdx02.getAfdx0820())
......@@ -474,39 +461,29 @@ public class DisabledService {
.afdx1017(fdx02.getAfdx1017())
.afdx0574(fdx02.getAfdx0574())
.afdx0572(fdx02.getAfdx0572())
.afdx0868(fdx02.getAfdx0868()!=null? DateUtil.format(fdx02.getAfdx0868(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0869(fdx02.getAfdx0869()!=null? DateUtil.format(fdx02.getAfdx0869(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0870(fdx02.getAfdx0870()!=null? DateUtil.format(fdx02.getAfdx0870(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0817(fdx02.getAfdx0817()!=null? DateUtil.format(fdx02.getAfdx0817(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0818(fdx02.getAfdx0818()!=null? DateUtil.format(fdx02.getAfdx0818(), DatePattern.NORM_MONTH_PATTERN):"")
.serialNumner(fdx02.getSerialNumner())
.dataStatus(fdx02.getDataStatus())
.dataTime(fdx02.getDataTime())
.areaCode(fdx02.getAreaCode())
.afdx0868(fdx02.getAfdx0868() != null ? DateUtil.format(fdx02.getAfdx0868(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0869(fdx02.getAfdx0869() != null ? DateUtil.format(fdx02.getAfdx0869(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0870(fdx02.getAfdx0870() != null ? DateUtil.format(fdx02.getAfdx0870(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0817(fdx02.getAfdx0817() != null ? DateUtil.format(fdx02.getAfdx0817(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0818(fdx02.getAfdx0818() != null ? DateUtil.format(fdx02.getAfdx0818(), DatePattern.NORM_DATETIME_PATTERN) : "")
.serialnumber(fdx02.getSerialnumber())
.datastatus(fdx02.getDatastatus())
.datatime(fdx02.getDatatime() != null ? DateUtil.format(fdx02.getDatatime(), DatePattern.NORM_DATETIME_PATTERN) : "")
.areacode(fdx02.getAreacode())
.build();
HttpRequest request = HttpRequest.post("https://59.255.186.1/yhbcp-engine_gov/rest/cjrfl_report_xzryxx")
HttpRequest request = HttpRequest.post("https://zwxt.mca.gov.cn/yhbcp-engine_gov/rest/cjrfl_report_xzryxx")
.contentType("application/x-www-form-urlencoded")
.form("access_key", "mzb_gx_450000")
.form("format", "json")
.form("request_id", IdUtil.simpleUUID())
.form("sign", "")
.form("timestamp", System.currentTimeMillis())
.form("version", "1.0")
.form("biz_content", JSONUtil.toJsonStr(build));
HttpResponse response = request.execute();
if(response.getStatus()!=200){
log.error("接口请求失败 => {}", request);
}
String body = response.body();
JSONObject obj = JSONUtil.parseObj(body);
Integer code = obj.getInt("code");
if(code==null||code!=1){
log.warn("上报错误 => {}",body);
}
reportCommon(request, "fdx02");
}
if(!fdx02Page.hasNext()){
if (!fdx02Page.hasNext()) {
break;
}
page++;
......@@ -515,27 +492,28 @@ public class DisabledService {
public void fdx01() {
int page = 1;
int size = 10000;
while (true){
Page<Fdx01> fdx01Page = fdx01Dao.selectPage(new Page<>(page, size), null);
int size = 5000;
while (true) {
LambdaQueryWrapper<Fdx01> lambdaQuery = Wrappers.lambdaQuery(Fdx01.class).orderByAsc(Fdx01::getId);
Page<Fdx01> fdx01Page = fdx01Dao.selectPage(new Page<>(page, size), lambdaQuery);
List<Fdx01> records = fdx01Page.getRecords();
for (Fdx01 fdx01 : records) {
Fdx01Vo build = Fdx01Vo.builder()
.axcp0002(fdx01.getAxcp0002())
.axcp0006(fdx01.getAxcp0006())
.afdx0823(fdx01.getAfdx0823()!=null? DateUtil.format(fdx01.getAfdx0823(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0823(fdx01.getAfdx0823() != null ? DateUtil.format(fdx01.getAfdx0823(), DatePattern.NORM_DATE_PATTERN) : "")
.axcp0008(fdx01.getAxcp0008())
.axcp0005(fdx01.getAxcp0005())
.afdp0505(fdx01.getAfdp0505())
.afdx0831(fdx01.getAfdx0831()!=null? DateUtil.format(fdx01.getAfdx0831(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0831(fdx01.getAfdx0831() != null ? DateUtil.format(fdx01.getAfdx0831(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0852(fdx01.getAfdx0852())
.afdp0504(fdx01.getAfdp0504())
.afdp0503(fdx01.getAfdp0503())
.afdx0053(fdx01.getAfdx0053())
.axcp0014(fdx01.getAxcp0014())
.afdx0055(fdx01.getAfdx0055()!=null? BigDecimal.valueOf(fdx01.getAfdx0055()).setScale(2, RoundingMode.HALF_UP).toString():"")
.afdx0851(fdx01.getAfdx0851()!=null? BigDecimal.valueOf(fdx01.getAfdx0851()).setScale(2, RoundingMode.HALF_UP).toString():"")
.afdx0561(fdx01.getAfdx0561()!=null? DateUtil.format(fdx01.getAfdx0561(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0055(fdx01.getAfdx0055() != null ? BigDecimal.valueOf(fdx01.getAfdx0055()).setScale(2, RoundingMode.HALF_UP).toString() : "")
.afdx0851(fdx01.getAfdx0851() != null ? BigDecimal.valueOf(fdx01.getAfdx0851()).setScale(2, RoundingMode.HALF_UP).toString() : "")
.afdx0561(fdx01.getAfdx0561() != null ? DateUtil.format(fdx01.getAfdx0561(), DatePattern.NORM_MONTH_PATTERN) : "")
.afdx0829(fdx01.getAfdx0829())
.afdx0830(fdx01.getAfdx0830())
.afdx0820(fdx01.getAfdx0820())
......@@ -560,44 +538,34 @@ public class DisabledService {
.afdx1017(fdx01.getAfdx1017())
.afdx0574(fdx01.getAfdx0574())
.afdx0572(fdx01.getAfdx0572())
.afdx0868(fdx01.getAfdx0868()!=null? DateUtil.format(fdx01.getAfdx0868(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0869(fdx01.getAfdx0869()!=null? DateUtil.format(fdx01.getAfdx0869(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0870(fdx01.getAfdx0870()!=null? DateUtil.format(fdx01.getAfdx0870(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0817(fdx01.getAfdx0817()!=null? DateUtil.format(fdx01.getAfdx0817(), DatePattern.NORM_MONTH_PATTERN):"")
.afdx0818(fdx01.getAfdx0818()!=null? DateUtil.format(fdx01.getAfdx0818(), DatePattern.NORM_MONTH_PATTERN):"")
.serialNumner(fdx01.getSerialNumner())
.dataStatus(fdx01.getDataStatus())
.dataTime(fdx01.getDataTime())
.areaCode(fdx01.getAreaCode())
.afdx0868(fdx01.getAfdx0868() != null ? DateUtil.format(fdx01.getAfdx0868(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0869(fdx01.getAfdx0869() != null ? DateUtil.format(fdx01.getAfdx0869(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0870(fdx01.getAfdx0870() != null ? DateUtil.format(fdx01.getAfdx0870(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0817(fdx01.getAfdx0817() != null ? DateUtil.format(fdx01.getAfdx0817(), DatePattern.NORM_DATETIME_PATTERN) : "")
.afdx0818(fdx01.getAfdx0818() != null ? DateUtil.format(fdx01.getAfdx0818(), DatePattern.NORM_DATETIME_PATTERN) : "")
.serialnumber(fdx01.getSerialnumber())
.datastatus(fdx01.getDatastatus())
.datatime(fdx01.getDatatime() != null ? DateUtil.format(fdx01.getDatatime(), DatePattern.NORM_DATETIME_PATTERN) : "")
.areacode(fdx01.getAreacode())
.build();
HttpRequest request = HttpRequest.post("https://59.255.186.1/yhbcp-engine_gov/rest/cjrfl_report_zcryxx")
HttpRequest request = HttpRequest.post("https://zwxt.mca.gov.cn/yhbcp-engine_gov/rest/cjrfl_report_zcryxx")
.contentType("application/x-www-form-urlencoded")
.form("access_key", "mzb_gx_450000")
.form("format", "json")
.form("request_id", IdUtil.simpleUUID())
.form("sign", "")
.form("timestamp", System.currentTimeMillis())
.form("version", "1.0")
.form("biz_content", JSONUtil.toJsonStr(build));
HttpResponse response = request.execute();
if(response.getStatus()!=200){
log.error("接口请求失败 => {}", request);
}
String body = response.body();
JSONObject obj = JSONUtil.parseObj(body);
Integer code = obj.getInt("code");
if(code==null||code!=1){
log.warn("上报错误 => {}",body);
}
reportCommon(request, "fdx01");
}
if(!fdx01Page.hasNext()){
if (!fdx01Page.hasNext()) {
break;
}
page++;
}
}
}
}
......@@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
@Slf4j
@Component
//@Component
@RequiredArgsConstructor
public class ReportTask {
......
......@@ -283,23 +283,23 @@ public class Fdx01Vo {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private String datatime;
/**
* 区划代码
*/
@ApiModelProperty("区划代码")
private String areaCode;
private String areacode;
}
......@@ -284,23 +284,23 @@ public class Fdx02Vo {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private String datatime;
/**
* 区划代码
*/
@ApiModelProperty("区划代码")
private String areaCode;
private String areacode;
}
......@@ -122,23 +122,23 @@ public class Fdx03Vo {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private String datatime;
/**
* 区划代码
*/
@ApiModelProperty("区划代码")
private String areaCode;
private String areacode;
}
......@@ -145,23 +145,23 @@ public class Fdx04Vo {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private String datatime;
/**
* 区划代码
*/
@ApiModelProperty("区划代码")
private String areaCode;
private String areacode;
}
......@@ -147,23 +147,23 @@ public class Fdx05Vo {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private String datatime;
/**
* 区划代码
*/
@ApiModelProperty("区划代码")
private String areaCode;
private String areacode;
}
......@@ -54,7 +54,7 @@ public class Fdx06Vo {
* 发证时间
*/
@ApiModelProperty("发证时间")
private Date afdx0831;
private String afdx0831;
/**
* 档案编号
......@@ -288,23 +288,23 @@ public class Fdx06Vo {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private String datatime;
/**
* 区划代码
*/
@ApiModelProperty("区划代码")
private String areaCode;
private String areacode;
}
......@@ -171,23 +171,23 @@ public class Fdx07Vo {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private String datatime;
/**
* 区划代码
*/
@ApiModelProperty("区划代码")
private String areaCode;
private String areacode;
}
......@@ -121,23 +121,23 @@ public class Fdx88Vo {
* 数据唯一流水号
*/
@ApiModelProperty("数据唯一流水号")
private String serialNumner;
private String serialnumber;
/**
* 数据状态
*/
@ApiModelProperty("数据状态")
private String dataStatus;
private String datastatus;
/**
* 数据上报时间
*/
@ApiModelProperty("数据上报时间")
private Date dataTime;
private String datatime;
/**
/**s
* 区划代码
*/
@ApiModelProperty("区划代码")
private String areaCode;
private String areacode;
}
......@@ -14,7 +14,7 @@ spring:
url-pattern: /druid/*
reset-enable: false
dynamic: # mybatis plus多数据源插件
primary: master #设置默认的数据源或者数据源组,默认值即为master
primary: gxcj #设置默认的数据源或者数据源组,默认值即为master
strict: true #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
datasource:
gxcj:
......@@ -53,5 +53,5 @@ spring:
mybatis-plus:
global-config:
db-config:
select-strategy: not_empty
where-strategy: not_empty
update-strategy: not_empty
\ No newline at end of file
......@@ -66,7 +66,7 @@ public class TokenFilter extends GenericFilterBean {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String token = resolveToken(httpServletRequest);
String token = tokenProvider.getToken(httpServletRequest);
// 对于 Token 为空的不需要去查 Redis
if (StrUtil.isNotBlank(token)) {
OnlineUserDto onlineUserDto = null;
......@@ -94,23 +94,4 @@ public class TokenFilter extends GenericFilterBean {
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;
import io.jsonwebtoken.SignatureAlgorithm;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
......@@ -34,7 +35,6 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
......@@ -132,9 +132,14 @@ public class TokenProvider implements InitializingBean {
public String getToken(HttpServletRequest request) {
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(), "");
} else {
log.debug("非法Token:{}", bearerToken);
}
return null;
}
......
......@@ -62,7 +62,7 @@ public class TokenFilter extends GenericFilterBean {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String token = resolveToken(httpServletRequest);
String token = tokenProvider.getToken(httpServletRequest);
// 对于 Token 为空的不需要去查 Redis
if (StrUtil.isNotBlank(token)) {
OnlineUserDto onlineUserDto = null;
......@@ -90,23 +90,4 @@ public class TokenFilter extends GenericFilterBean {
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;
import io.jsonwebtoken.SignatureAlgorithm;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
......@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
......@@ -89,10 +89,7 @@ public class TokenProvider implements InitializingBean {
}
public Authentication getAuthentication(String token) {
Claims claims = Jwts.parser()
.setSigningKey(DatatypeConverter.parseBase64Binary(properties.getBase64Secret()))
.parseClaimsJws(token)
.getBody();
Claims claims = getClaims(token);
// fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException
Object authoritiesStr = claims.get(AUTHORITIES_KEY);
......@@ -125,9 +122,14 @@ public class TokenProvider implements InitializingBean {
public String getToken(HttpServletRequest request) {
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(), "");
} else {
log.debug("非法Token:{}", bearerToken);
}
return null;
}
......
......@@ -63,5 +63,5 @@ spring:
mybatis-plus:
global-config:
db-config:
select-strategy: not_empty
where-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