Compare commits

...

2 Commits

Author SHA1 Message Date
zhangshengli e948e54a48 Merge remote-tracking branch 'origin/main' 2 months ago
zhangshengli 4b33b0695f 高位漏洞修改 2 months ago

@ -11,4 +11,4 @@ VUE_APP_BASE_API = '/dev-api'
VUE_APP_PUBLIC_PATH = '/' VUE_APP_PUBLIC_PATH = '/'
# 后端接口地址 # 后端接口地址
VUE_APP_SERVER_URL = 'http://localhost:8081/' VUE_APP_SERVER_URL = 'https://spring.ennenergy.cn'

@ -11,5 +11,5 @@ VUE_APP_BASE_API = '/fuint-application/'
VUE_APP_PUBLIC_PATH = '/' VUE_APP_PUBLIC_PATH = '/'
# 后端接口地址 # 后端接口地址
VUE_APP_SERVER_URL = 'http://localhost:8081/' VUE_APP_SERVER_URL = 'https://spring.ennenergy.cn'

@ -69,11 +69,12 @@ export default {
} }
}, },
data() { data() {
alert(process.env.VUE_APP_BASE_API)
return { return {
number: 0, number: 0,
uploadList: [], uploadList: [],
baseUrl: process.env.VUE_APP_BASE_API, baseUrl: process.env.VUE_APP_BASE_API,
uploadFileUrl: process.env.VUE_APP_SERVER_URL + 'backendApi/file/upload', // uploadFileUrl: process.env.VUE_APP_SERVER_URL+process.env.VUE_APP_BASE_API + 'backendApi/file/upload', //
headers: { headers: {
'Access-Token': getToken(), 'Access-Token': getToken(),
}, },

@ -230,7 +230,7 @@ export default {
// //
storeList: [], storeList: [],
// //
uploadAction: process.env.VUE_APP_SERVER_URL + 'backendApi/file/upload', uploadAction: process.env.VUE_APP_SERVER_URL+ process.env.VUE_APP_BASE_API + 'backendApi/file/upload',
// //
hideUpload: false, hideUpload: false,
// //

@ -42,7 +42,11 @@ module.exports = {
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ['^' + process.env.VUE_APP_BASE_API]: ''
} }
} },
'/backendApi/file/upload': {
target: 'http://10.203.2.71:8081/backendApi/file/upload', //请求的地址
changeOrigin: true,
},
}, },
disableHostCheck: true disableHostCheck: true
}, },

@ -2,6 +2,7 @@ package com.fuint.common.config;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.builders.RequestHandlerSelectors;

@ -37,6 +37,7 @@ public class WebConfig extends WebMvcConfigurationSupport {
"classpath:/META-INF/resources/"); "classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations( registry.addResourceHandler("/webjars/**").addResourceLocations(
"classpath:/META-INF/resources/webjars/"); "classpath:/META-INF/resources/webjars/");
registry.addResourceHandler("/static/uploadImages/"+ "/**").addResourceLocations("file:"+"/home/e_wanglx/java/static/uploadImages/");
super.addResourceHandlers(registry); super.addResourceHandlers(registry);
} }
@ -67,7 +68,8 @@ public class WebConfig extends WebMvcConfigurationSupport {
.excludePathPatterns("/clientApi/captcha/**") .excludePathPatterns("/clientApi/captcha/**")
.excludePathPatterns("/backendApi/captcha/**") .excludePathPatterns("/backendApi/captcha/**")
.excludePathPatterns("/backendApi/userCoupon/exportList") .excludePathPatterns("/backendApi/userCoupon/exportList")
.excludePathPatterns("/backendApi/login/**"); .excludePathPatterns("/backendApi/login/**")
.excludePathPatterns("/static/uploadImages/**");
// 客户端拦截 // 客户端拦截
registry.addInterceptor(portalUserInterceptor()) registry.addInterceptor(portalUserInterceptor())

@ -1,101 +1,118 @@
package com.fuint.common.filter; //package com.fuint.common.filter;
//
//
import cn.hutool.core.util.ObjectUtil; //import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSONObject; //import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper; //import com.fasterxml.jackson.databind.ObjectMapper;
import com.fuint.framework.exception.BusinessRuntimeException; //import com.fuint.framework.exception.BusinessRuntimeException;
import org.apache.commons.lang3.StringUtils; //import org.apache.commons.lang3.StringUtils;
import org.springframework.web.multipart.support.StandardServletMultipartResolver; //import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
import javax.servlet.*; //import org.springframework.stereotype.Component;
import javax.servlet.annotation.WebFilter; //import org.springframework.web.multipart.support.StandardServletMultipartResolver;
import javax.servlet.http.HttpServletRequest; //import org.springframework.web.servlet.HandlerExceptionResolver;
import javax.servlet.http.HttpServletResponse; //
import java.io.BufferedReader; //import javax.servlet.*;
import java.io.IOException; //import javax.servlet.annotation.WebFilter;
import java.util.Map; //import javax.servlet.http.HttpServletRequest;
import java.util.Set; //import javax.servlet.http.HttpServletResponse;
import java.util.TreeMap; //import java.io.BufferedReader;
import java.util.stream.Collectors; //import java.io.IOException;
//import java.util.Map;
//import java.util.Set;
@WebFilter(filterName = "CharsetFilter",urlPatterns = "/*") //import java.util.TreeMap;
public class SpecialCharFilter implements Filter { //import java.util.stream.Collectors;
//
private static final String SQL_REGX = "[\\\\^$*+?{}()=&;%+\\[\\].|]"; //
//@WebFilter(filterName = "CharsetFilter", urlPatterns = "/*")
@Override //@Component
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException, IOException { //public class SpecialCharFilter implements Filter {
HttpServletRequest req = (HttpServletRequest) servletRequest; //
// private static final String SQL_REGX = "[=]";
// 防止流读取一次后就没有了, 所以需要将流继续写出去 // @Qualifier("handlerExceptionResolver")
MyRequestWrapper requestWrapper = new MyRequestWrapper(req); // @Autowired
// private HandlerExceptionResolver resolver;
// 获取请求参数 //
Map<String, Object> paramsMaps = new TreeMap<>(); // @Override
if ("POST".equals(req.getMethod().toUpperCase())) { // public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException, IOException {
String body = requestWrapper.getBody(); // HttpServletRequest req = (HttpServletRequest) servletRequest;
paramsMaps = JSONObject.parseObject(body, TreeMap.class); // String servletPath = req.getServletPath();
} else { // HttpServletResponse rep = (HttpServletResponse) servletResponse;
Map<String, String[]> parameterMap = requestWrapper.getParameterMap(); // MyRequestWrapper requestWrapper = new MyRequestWrapper(req);
Set<Map.Entry<String, String[]>> entries = parameterMap.entrySet(); // if (ObjectUtil.notEqual(servletPath,"/backendApi/login/doLogin")){
for (Map.Entry<String, String[]> next : entries) { // // 防止流读取一次后就没有了, 所以需要将流继续写出去
paramsMaps.put(next.getKey(), next.getValue()[0]); //
} // // 获取请求参数
} // Map<String, Object> paramsMaps = new TreeMap<>();
// if ("POST".equals(req.getMethod().toUpperCase())) {
// 校验SQL注入 // String body = requestWrapper.getBody();
if (ObjectUtil.isNotEmpty(paramsMaps)) { // paramsMaps = JSONObject.parseObject(body, TreeMap.class);
for (Object o : paramsMaps.entrySet()) { // } else {
Map.Entry entry = (Map.Entry) o; // Map<String, String[]> parameterMap = requestWrapper.getParameterMap();
Object value = entry.getValue(); // Set<Map.Entry<String, String[]>> entries = parameterMap.entrySet();
if (value != null) { // for (Map.Entry<String, String[]> next : entries) {
boolean isValid = checkSqlInject(value.toString(), servletResponse); // paramsMaps.put(next.getKey(), next.getValue()[0]);
if (!isValid) { // }
return; // }
} //
} // // 校验SQL注入
} // if (ObjectUtil.isNotEmpty(paramsMaps)) {
} // for (Object o : paramsMaps.entrySet()) {
// Map.Entry entry = (Map.Entry) o;
chain.doFilter(requestWrapper, servletResponse); // Object value = entry.getValue();
// if (value != null) {
//
} // boolean isValid = checkSqlInject(value.toString(), servletResponse);
// if (!isValid) {
//获取request请求body中参数 // resolver.resolveException(req, rep,
public static String getBodyString(BufferedReader br) { // null, FileterException("客户端信息非法!!,存在特殊字符请重新输入"));
String inputLine; // return;
String str = ""; // }
try { // }
while ((inputLine = br.readLine()) != null) { // }
str += inputLine; // }
} // }
br.close(); //
} catch (IOException e) { // chain.doFilter(requestWrapper, servletResponse);
System.out.println("IOException: " + e); //
} //
return str; // }
} //
// //获取request请求body中参数
/** // public static String getBodyString(BufferedReader br) {
* SQL // String inputLine;
* // String str = "";
* @param value // try {
* @param servletResponse // while ((inputLine = br.readLine()) != null) {
* @throws IOException IO // str += inputLine;
*/ // }
private boolean checkSqlInject(String value, ServletResponse servletResponse) throws IOException { // br.close();
if (null != value) { // } catch (IOException e) {
String output = value.replaceAll(SQL_REGX, ""); // System.out.println("IOException: " + e);
if (output.length()<value.length()) { // }
return false; // return str;
} // }
} //
return true; // /**
} // * 检查SQL注入
// *
// * @param value 参数值
// * @param servletResponse 相应实例
} // * @throws IOException IO异常
// */
// private boolean checkSqlInject(String value, ServletResponse servletResponse) throws IOException {
// if (null != value) {
// String output = value.replaceAll(SQL_REGX, "");
// if (output.length() < value.length()) {
// return false;
// }
// }
// return true;
// }
//
// public Exception FileterException(String cause) {
// return new Exception(cause);
// }
//
//
//}

@ -1,6 +1,10 @@
package com.fuint.common.service.impl; package com.fuint.common.service.impl;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.asymmetric.KeyType;
import cn.hutool.crypto.asymmetric.RSA;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -350,6 +354,20 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
byte[] hashPassword = Digests.sha1(password.getBytes(), salt1, 1024); byte[] hashPassword = Digests.sha1(password.getBytes(), salt1, 1024);
return Encodes.encodeHex(hashPassword); return Encodes.encodeHex(hashPassword);
} }
public String getRsa(String password){
String privateKey="MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY\n" +
"7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKN\n" +
"PuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gA\n" +
"kM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWow\n" +
"cSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99Ecv\n" +
"DQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthh\n" +
"YhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3\n" +
"UP8iWi1Qw0Y=";
RSA rsa = new RSA(privateKey, null);
byte[] decrypt = rsa.decrypt(password, KeyType.PrivateKey);
return StrUtil.str(decrypt, CharsetUtil.CHARSET_UTF_8);
}
/** /**
* *
@ -374,7 +392,8 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
} }
Boolean captchaVerify = captchaService.checkCodeByUuid(captchaCode, uuid); Boolean captchaVerify = captchaService.checkCodeByUuid(captchaCode, uuid);
if (!captchaVerify) { if (!captchaVerify) {
throw new BusinessCheckException("图形验证码有误"); RedisUtil.remove(uuid);
throw new BusinessCheckException("图形验证码有误或已经失效");
} }
if (StringUtil.isEmpty(accountName) || StringUtil.isEmpty(password) || StringUtil.isEmpty(captchaCode)) { if (StringUtil.isEmpty(accountName) || StringUtil.isEmpty(password) || StringUtil.isEmpty(captchaCode)) {
@ -387,8 +406,8 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
TAccount tAccount = getAccountInfoById(accountInfo.getId()); TAccount tAccount = getAccountInfoById(accountInfo.getId());
String myPassword = tAccount.getPassword(); String myPassword = tAccount.getPassword();
String inputPassword = getEntryptPassword(password, tAccount.getSalt()); String entryptPassword = getEntryptPassword(getRsa(password), tAccount.getSalt());
if (!myPassword.equals(inputPassword) || !tAccount.getAccountStatus().toString().equals("1")) { if (!myPassword.equals(entryptPassword) || !tAccount.getAccountStatus().toString().equals("1")) {
Object userAccountName = RedisUtil.get("user" + accountName); Object userAccountName = RedisUtil.get("user" + accountName);
if (ObjectUtil.isEmpty(userAccountName)) { if (ObjectUtil.isEmpty(userAccountName)) {
RedisUtil.set("user" + accountName, 1); RedisUtil.set("user" + accountName, 1);

@ -131,7 +131,7 @@ public class TokenUtil {
* @return * @return
* */ * */
public static boolean removeToken(String token) { public static boolean removeToken(String token) {
RedisUtil.remove(token); RedisUtil.remove(Constants.SESSION_ADMIN_USER +token);
AuthUserUtil.clean(); AuthUserUtil.clean();
return true; return true;
} }

@ -20,7 +20,6 @@ import org.tuckey.web.filters.urlrewrite.UrlRewriteFilter;
@SpringBootApplication @SpringBootApplication
//@PropertySource("file:${env.properties.path}/${env.profile}/application.properties") //@PropertySource("file:${env.properties.path}/${env.profile}/application.properties")
@PropertySource("application-${env.profile}.properties") @PropertySource("application-${env.profile}.properties")
@ServletComponentScan
public class fuintApplication { public class fuintApplication {
public static final String REWRITE_FILTER_NAME = "rewriteFilter"; public static final String REWRITE_FILTER_NAME = "rewriteFilter";

@ -10,11 +10,11 @@ spring.session.redis.namespace=fuint
# Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09 # Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09
spring.redis.database=0 spring.redis.database=0
# Redis\u670D\u52A1\u5668\u5730\u5740(\u751F\u4EA7) # Redis\u670D\u52A1\u5668\u5730\u5740(\u751F\u4EA7)
spring.redis.host=120.46.159.203 spring.redis.host=192.168.10.31
# Redis\u670D\u52A1\u5668\u8FDE\u63A5\u7AEF\u53E3 # Redis\u670D\u52A1\u5668\u8FDE\u63A5\u7AEF\u53E3
spring.redis.port=16379 spring.redis.port=7679
# Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09 # Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09
spring.redis.password=a8EYUSoT8wHbuRkX #spring.redis.password=
# \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 # \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
spring.redis.pool.max-active=-1 spring.redis.pool.max-active=-1
# \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 # \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
@ -33,13 +33,13 @@ system.name = fuint\u4F1A\u5458\u8425\u9500\u7BA1\u7406\u7CFB\u7EDF
website.url=https://www.huamar.com/h5/ website.url=https://www.huamar.com/h5/
# \u4E0A\u4F20\u56FE\u7247\u672C\u5730\u5730\u5740 # \u4E0A\u4F20\u56FE\u7247\u672C\u5730\u5730\u5740
images.root=/target/classes #images.root=/target/classes
#images.root=D:/download images.root=D:/download
#images.path=/profile/ #images.path=/profile/
images.path=/static/uploadImages/ images.path=/static/uploadImages/
# \u4E0A\u4F20\u56FE\u7247\u670D\u52A1\u5668\u57DF\u540D # \u4E0A\u4F20\u56FE\u7247\u670D\u52A1\u5668\u57DF\u540D
images.upload.url=http://192.168.10.70:8999 images.upload.url=http://192.168.10.70:8081
# \u4E0A\u4F20\u56FE\u7247\u5141\u8BB8\u7684\u5927\u5C0F\uFF08\u5355\u4F4D\uFF1AMB\uFF09 # \u4E0A\u4F20\u56FE\u7247\u5141\u8BB8\u7684\u5927\u5C0F\uFF08\u5355\u4F4D\uFF1AMB\uFF09
images.upload.maxSize=100 images.upload.maxSize=100

@ -33,11 +33,11 @@ system.name = fuint\u4F1A\u5458\u8425\u9500\u7BA1\u7406\u7CFB\u7EDF
website.url=https://www.huamar.com/h5/ website.url=https://www.huamar.com/h5/
# \u4E0A\u4F20\u56FE\u7247\u672C\u5730\u5730\u5740 # \u4E0A\u4F20\u56FE\u7247\u672C\u5730\u5730\u5740
images.root=/home/ images.root=/home/e_wanglx/java/
images.path=/static/uploadImages/ images.path=/static/uploadImages/
# \u4E0A\u4F20\u56FE\u7247\u670D\u52A1\u5668\u57DF\u540D # \u4E0A\u4F20\u56FE\u7247\u670D\u52A1\u5668\u57DF\u540D
images.upload.url=http://localhost:8081 images.upload.url=https://boot.ennenergy.cn
# \u4E0A\u4F20\u56FE\u7247\u5141\u8BB8\u7684\u5927\u5C0F\uFF08\u5355\u4F4D\uFF1AMB\uFF09 # \u4E0A\u4F20\u56FE\u7247\u5141\u8BB8\u7684\u5927\u5C0F\uFF08\u5355\u4F4D\uFF1AMB\uFF09
images.upload.maxSize=5 images.upload.maxSize=5
@ -90,7 +90,7 @@ wxpay.appSecret = 2cc8299450b5cccf3afa571498afb1de
wxpay.mchId=1663547246 wxpay.mchId=1663547246
wxpay.apiV2=Xinaoranqi2018Xinaoranqi20182024 wxpay.apiV2=Xinaoranqi2018Xinaoranqi20182024
wxpay.certPath=/usr/local/fuint/cert/apiclient_cert.p12 wxpay.certPath=/usr/local/fuint/cert/apiclient_cert.p12
wxpay.domain=https://www.huamar.com/fuint-application wxpay.domain=http://spring.ennenergy.cn/fuint-application/clientApi/pay/aliPayCallback
################## \u652F\u4ED8\u5B9D\u652F\u4ED8\u76F8\u5173\u914D\u7F6E ###################### ################## \u652F\u4ED8\u5B9D\u652F\u4ED8\u76F8\u5173\u914D\u7F6E ######################
alipay.appId = \u5E94\u7528\u7F16\u53F7 alipay.appId = \u5E94\u7528\u7F16\u53F7
@ -106,4 +106,4 @@ weixin.subMessage.couponExpire=[{'key':'name', 'name':'\u5361\u5238\u540D\u79F0'
weixin.subMessage.couponArrival=[{'key':'name', 'name':'\u5361\u5238\u540D\u79F0'},{'key':'amount', 'name':'\u91D1\u989D'},{'key':'tips', 'name':'\u6E29\u99A8\u63D0\u793A'}] weixin.subMessage.couponArrival=[{'key':'name', 'name':'\u5361\u5238\u540D\u79F0'},{'key':'amount', 'name':'\u91D1\u989D'},{'key':'tips', 'name':'\u6E29\u99A8\u63D0\u793A'}]
weixin.subMessage.balanceChange=[{'key':'amount', 'name':'\u53D8\u52A8\u91D1\u989D'},{'key':'time', 'name':'\u53D8\u52A8\u65F6\u95F4'},{'key':'tips', 'name':'\u6E29\u99A8\u63D0\u793A'}] weixin.subMessage.balanceChange=[{'key':'amount', 'name':'\u53D8\u52A8\u91D1\u989D'},{'key':'time', 'name':'\u53D8\u52A8\u65F6\u95F4'},{'key':'tips', 'name':'\u6E29\u99A8\u63D0\u793A'}]
weixin.subMessage.couponConfirm=[{'key':'name', 'name':'\u5361\u5238\u540D\u79F0'},{'key':'time', 'name':'\u6838\u9500\u65F6\u95F4'}] weixin.subMessage.couponConfirm=[{'key':'name', 'name':'\u5361\u5238\u540D\u79F0'},{'key':'time', 'name':'\u6838\u9500\u65F6\u95F4'}]
weixin.subMessage.pointChange=[{'key':'amount', 'name':'\u53D8\u52A8\u6570\u91CF'},{'key':'time', 'name':'\u53D8\u52A8\u65F6\u95F4'},{'key':'remark', 'name':'\u5907\u6CE8\u4FE1\u606F'}] weixin.subMessage.pointChange=[{'key':'amount', 'name':'\u53D8\u52A8\u6570\u91CF'},{'key':'time', 'name':'\u53D8\u52A8\u65F6\u95F4'},{'key':'remark',

@ -1,7 +1,8 @@
# \u57FA\u672C\u914D\u7F6E # \u57FA\u672C\u914D\u7F6E
server.port=8081 server.port=8081
env.profile=dev env.profile=prod
# \u6570\u636E\u5E93\u914D\u7F6E # \u6570\u636E\u5E93\u914D\u7F6E

@ -1,12 +1,15 @@
package com.fuint.framework.exception; package com.fuint.framework.exception;
/** import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus; /**
* *
* *
* Created by FSQ * Created by FSQ
* CopyRight https://www.huamar.com * CopyRight https://www.huamar.com
*/ */
public class BusinessCheckException extends Exception {
public class BusinessCheckException extends RuntimeException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Throwable rootCause; private Throwable rootCause;

@ -0,0 +1,23 @@
package com.fuint.framework.exception;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@EqualsAndHashCode(callSuper = true)
@Data
@ResponseStatus(HttpStatus.CREATED)
public class FileterException extends RuntimeException {
private static final long serialVersionUID = 1L;
private String reason;
public FileterException(String cause) {
super(cause);
this.reason = cause;
}
}

@ -3,6 +3,7 @@ package com.fuint.framework.exception;
import com.fuint.framework.web.ResponseObject; import com.fuint.framework.web.ResponseObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.Order;
import org.springframework.validation.BindException; import org.springframework.validation.BindException;
import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.MethodArgumentNotValidException;
@ -18,6 +19,7 @@ import javax.servlet.http.HttpServletRequest;
* Created by FSQ * Created by FSQ
* CopyRight https://www.huamar.com * CopyRight https://www.huamar.com
*/ */
@Order(1)
@RestControllerAdvice @RestControllerAdvice
public class GlobalExceptionHandler { public class GlobalExceptionHandler {
@ -103,4 +105,11 @@ public class GlobalExceptionHandler {
String message = e.getBindingResult().getFieldError().getDefaultMessage(); String message = e.getBindingResult().getFieldError().getDefaultMessage();
return new ResponseObject(201,message, null); return new ResponseObject(201,message, null);
} }
@ExceptionHandler(FileterException.class)
public Object FileterException(FileterException e) {
System.out.println("!1111111111111111111111111111111111111111");
log.error(e.getMessage(), e);
return new ResponseObject(201,e.getMessage(), null);
}
} }

Loading…
Cancel
Save