Commit f05d9c4f authored by jiaorz's avatar jiaorz

Merge branch 'master-vehicle-bug'

parents e4d8720d e0a20906
...@@ -40,6 +40,15 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler { ...@@ -40,6 +40,15 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
private Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class); private Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);
@Value("${spring.application.name}") @Value("${spring.application.name}")
private String applicationName; private String applicationName;
@Value("${email.log.account}")
private String emailLogAccount;
@Value("${email.log.title}")
private String emailLogTitle;
@Value("${email.log.host}")
private String emailLogHost;
/** /**
* 在controller里面内容执行之前,校验一些参数不匹配啊,Get post方法不对啊之类的 * 在controller里面内容执行之前,校验一些参数不匹配啊,Get post方法不对啊之类的
*/ */
...@@ -77,15 +86,6 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler { ...@@ -77,15 +86,6 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
if(0 == ex.getStatus()) { if(0 == ex.getStatus()) {
response.setStatus(500); response.setStatus(500);
} }
Map<String, String> map = new HashMap<>();
map.put("toUser", "jiaoruizhen@126.com");
map.put("subject", "服务器异常");
map.put("content", ex.toString() + ":" +ex.getMessage());
try {
HttpUtils.doPost("http://10.5.52.3:8765","/api/universal/mail/app/unauth/send", map);
} catch (Exception e) {
logger.error(e.getMessage());
}
return new BaseResponse(ex.getStatus(), ex.getMessage()); return new BaseResponse(ex.getStatus(), ex.getMessage());
} }
...@@ -94,27 +94,27 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler { ...@@ -94,27 +94,27 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
response.setStatus(500); response.setStatus(500);
logger.error(ex.getMessage(),ex); logger.error(ex.getMessage(),ex);
Throwable cause = ex.getCause(); Throwable cause = ex.getCause();
if(cause != null && cause.toString().contains("Exception")) { if(cause != null && cause.toString().contains("Exception") && !cause.toString().contains("UserTokenException")) {
StringWriter stringWriter = new StringWriter(); StringWriter stringWriter = new StringWriter();
cause.printStackTrace(new PrintWriter(stringWriter)); cause.printStackTrace(new PrintWriter(stringWriter));
logger.error(cause.getMessage(), ex); logger.error(cause.getMessage(), ex);
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("toUser", "jiaoruizhen@126.com"); map.put("toUser", emailLogAccount);
map.put("subject", "服务器异常"); map.put("subject", emailLogTitle);
map.put("content", initCommonLogPrePart()+ ":" +stringWriter.toString()); map.put("content", initCommonLogPrePart()+ ":" +stringWriter.toString());
try { try {
HttpUtils.doPost("http://10.5.52.3:8765","/api/universal/mail/app/unauth/send", map); HttpUtils.doPost(emailLogHost,"/api/universal/mail/app/unauth/send", map);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
} }
return new BaseResponse(5000, "Server exception: " + ex.getMessage()); return new BaseResponse(5000, "Server exception: " + ex.getMessage());
} }
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("toUser", "jiaoruizhen@126.com"); map.put("toUser", emailLogAccount);
map.put("subject", "服务器异常"); map.put("subject", emailLogTitle);
map.put("content", initCommonLogPrePart()+ ":" + ex.toString() + ":" + ex.getMessage()); map.put("content", initCommonLogPrePart()+ ":" + ex.toString() + ":" + ex.getMessage());
try { try {
HttpUtils.doPost("http://10.5.52.3:8765","/api/universal/mail/app/unauth/send", map); HttpUtils.doPost(emailLogHost,"/api/universal/mail/app/unauth/send", map);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
} }
......
...@@ -26,10 +26,19 @@ public class PlatformExceptionHandler { ...@@ -26,10 +26,19 @@ public class PlatformExceptionHandler {
@Value("${spring.application.name}") @Value("${spring.application.name}")
private String applicationName; private String applicationName;
@Value("${email.log.account}")
private String emailLogAccount;
@Value("${email.log.title}")
private String emailLogTitle;
@Value("${email.log.host}")
private String emailLogHost;
@ExceptionHandler(value = {BaseException.class}) @ExceptionHandler(value = {BaseException.class})
public BaseResponse baseExceptionHandler(Exception e) { public BaseResponse baseExceptionHandler(Exception e) {
if (e instanceof BaseException){ if (e instanceof BaseException){
BaseException be = (BaseException) e; BaseException be = (BaseException) e;
return new BaseResponse(be.getStatus(), StringUtils.isEmpty(be.getSubCode())?"NAN":be.getSubCode(), be.getMessage()); return new BaseResponse(be.getStatus(), StringUtils.isEmpty(be.getSubCode())?"NAN":be.getSubCode(), be.getMessage());
} }
return new BaseResponse(400,e.getMessage()); return new BaseResponse(400,e.getMessage());
...@@ -40,16 +49,16 @@ public class PlatformExceptionHandler { ...@@ -40,16 +49,16 @@ public class PlatformExceptionHandler {
public ObjectRestResponse<?> exceptionHandler(Exception e){ public ObjectRestResponse<?> exceptionHandler(Exception e){
Throwable cause = e.getCause(); Throwable cause = e.getCause();
if(cause != null && cause.toString().contains("Exception")) { if(cause != null && cause.toString().contains("Exception") && !cause.toString().contains("UserTokenException")) {
StringWriter stringWriter = new StringWriter(); StringWriter stringWriter = new StringWriter();
cause.printStackTrace(new PrintWriter(stringWriter)); cause.printStackTrace(new PrintWriter(stringWriter));
log.error(cause.getMessage(), e); log.error(cause.getMessage(), e);
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("toUser", "jiaoruizhen@126.com"); map.put("toUser", emailLogAccount);
map.put("subject", "服务器异常"); map.put("subject", emailLogTitle);
map.put("content", initCommonLogPrePart()+ ":" +stringWriter.toString()); map.put("content", initCommonLogPrePart()+ ":" +stringWriter.toString());
try { try {
HttpUtils.doPost("http://10.5.52.3:8765","/api/universal/mail/app/unauth/send", map); HttpUtils.doPost(emailLogHost,"/api/universal/mail/app/unauth/send", map);
} catch (Exception ex) { } catch (Exception ex) {
log.error(ex.getMessage()); log.error(ex.getMessage());
} }
...@@ -57,11 +66,11 @@ public class PlatformExceptionHandler { ...@@ -57,11 +66,11 @@ public class PlatformExceptionHandler {
} }
log.error("Server exception: ", e); log.error("Server exception: ", e);
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("toUser", "jiaoruizhen@126.com"); map.put("toUser", emailLogAccount);
map.put("subject", "服务器异常"); map.put("subject", emailLogTitle);
map.put("content", initCommonLogPrePart()+ ":" + e.toString() + ":" + e.getMessage()); map.put("content", initCommonLogPrePart()+ ":" + e.toString() + ":" + e.getMessage());
try { try {
HttpUtils.doPost("http://10.5.52.3:8765","/api/universal/mail/app/unauth/send", map); HttpUtils.doPost(emailLogHost,"/api/universal/mail/app/unauth/send", map);
} catch (Exception ex) { } catch (Exception ex) {
log.error(ex.getMessage()); log.error(ex.getMessage());
} }
...@@ -83,7 +92,6 @@ public class PlatformExceptionHandler { ...@@ -83,7 +92,6 @@ public class PlatformExceptionHandler {
HttpServletRequest request = servletRequestAttributes.getRequest();//获取request HttpServletRequest request = servletRequestAttributes.getRequest();//获取request
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
//request 获得头部 //request 获得头部
stringBuilder.append(request.getHeader("app"));
LocalDateTime startTime= LocalDateTime.now();//开始时间 LocalDateTime startTime= LocalDateTime.now();//开始时间
stringBuilder.append("》》" +startTime.toString()); stringBuilder.append("》》" +startTime.toString());
stringBuilder.append("》》" +request.getServletPath()); stringBuilder.append("》》" +request.getServletPath());
...@@ -91,4 +99,5 @@ public class PlatformExceptionHandler { ...@@ -91,4 +99,5 @@ public class PlatformExceptionHandler {
return stringBuilder.toString(); return stringBuilder.toString();
} }
} }
...@@ -445,11 +445,11 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{ ...@@ -445,11 +445,11 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
//apiname=com.alipay.account.auth&app_id=xxxxx&app_name=mc&auth_type=AUTHACCOUNT&biz_type=openservice&method=alipay.open.auth.sdk.code.get&pid=xxxxx&product_id=APP_FAST_LOGIN&scope=kuaijie&sign_type=RSA2&target_id=20141225xxxx&sign=fMcp4GtiM6rxSIeFnJCVePJKV43eXrUP86CQgiLhDHH2u%2FdN75eEvmywc2ulkm7qKRetkU9fbVZtJIqFdMJcJ9Yp%2BJI%2FF%2FpESafFR6rB2fRjiQQLGXvxmDGVMjPSxHxVtIqpZy5FDoKUSjQ2%2FILDKpu3%2F%2BtAtm2jRw1rUoMhgt0%3D //apiname=com.alipay.account.auth&app_id=xxxxx&app_name=mc&auth_type=AUTHACCOUNT&biz_type=openservice&method=alipay.open.auth.sdk.code.get&pid=xxxxx&product_id=APP_FAST_LOGIN&scope=kuaijie&sign_type=RSA2&target_id=20141225xxxx&sign=fMcp4GtiM6rxSIeFnJCVePJKV43eXrUP86CQgiLhDHH2u%2FdN75eEvmywc2ulkm7qKRetkU9fbVZtJIqFdMJcJ9Yp%2BJI%2FF%2FpESafFR6rB2fRjiQQLGXvxmDGVMjPSxHxVtIqpZy5FDoKUSjQ2%2FILDKpu3%2F%2BtAtm2jRw1rUoMhgt0%3D
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("apiname="); stringBuilder.append("apiname=");
stringBuilder.append(apiName); stringBuilder.append("com.alipay.account.auth");
stringBuilder.append("&app_id="); stringBuilder.append("&app_id=");
stringBuilder.append(SystemConfig.ALIPAY_APPID); stringBuilder.append(SystemConfig.ALIPAY_APPID);
stringBuilder.append("&app_name="); stringBuilder.append("&app_name=");
stringBuilder.append(appName); stringBuilder.append("mc");
stringBuilder.append("&auth_type=AUTHACCOUNT"); stringBuilder.append("&auth_type=AUTHACCOUNT");
stringBuilder.append("&biz_type=openservice"); stringBuilder.append("&biz_type=openservice");
stringBuilder.append("&method=alipay.open.auth.sdk.code.get"); stringBuilder.append("&method=alipay.open.auth.sdk.code.get");
...@@ -603,7 +603,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{ ...@@ -603,7 +603,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
try { try {
log.info("支付宝退款中:outTradeNo = {}, tradNo = {}, refundAmount = {}, refundReason = {}", outTradeNo, tradNo, refundAmount, refundReason); log.info("支付宝退款中:outTradeNo = {}, tradNo = {}, refundAmount = {}, refundReason = {}", outTradeNo, tradNo, refundAmount, refundReason);
AlipayTradeRefundResponse response = alipayClient.execute(request); AlipayTradeRefundResponse response = alipayClient.execute(request);
log.info("APP支付退款response: {}" + response.getBody());
if (response.isSuccess()) { if (response.isSuccess()) {
return true; return true;
} else { } else {
...@@ -678,7 +677,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{ ...@@ -678,7 +677,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
//orderPayBiz.testTradeRefund("216584713656209408", 105000, "退还违约金1050元", "2165847136562094081050"); //orderPayBiz.testTradeRefund("216584713656209408", 105000, "退还违约金1050元", "2165847136562094081050");
//orderPayBiz.fundAuthOrderUnFreeze(orderPayVo, ""); //orderPayBiz.fundAuthOrderUnFreeze(orderPayVo, "");
//orderPayBiz.alipayOrderRefund("20191024153859000003","2019102422001421530513773694", 2, "xxxx", ""); //orderPayBiz.alipayOrderRefund("20191024153859000003","2019102422001421530513773694", 2, "xxxx", "");
//orderPayBiz.tradePay("20191108195202000020", "2019110810002001710518149012", 120000,"退还押金", "退还押金"); //orderPayBiz.tradePay(orderPayVo, "");
//orderPayBiz.fundAuthCancel(orderPayVo, ""); //orderPayBiz.fundAuthCancel(orderPayVo, "");
//orderPayBiz.tradePay("20191114182254000019", "2019111410002001530505959461", 1,"扣除违约金", "扣除违约金"); //orderPayBiz.tradePay("20191114182254000019", "2019111410002001530505959461", 1,"扣除违约金", "扣除违约金");
orderPayBiz.fundAuthQuery("20191031172653000026"); orderPayBiz.fundAuthQuery("20191031172653000026");
......
...@@ -128,9 +128,15 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany ...@@ -128,9 +128,15 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
CompanyDetail detail = null; CompanyDetail detail = null;
if (branchCompany != null) { if (branchCompany != null) {
List<SysRegion> sysRegions = sysRegionBiz.getRegionsByCodes(new ArrayList<Long>() {{ List<SysRegion> sysRegions = sysRegionBiz.getRegionsByCodes(new ArrayList<Long>() {{
add(Long.valueOf(branchCompany.getAddrProvince())); if(branchCompany.getAddrProvince() != null) {
add(Long.valueOf(branchCompany.getAddrCity())); add(Long.valueOf(branchCompany.getAddrProvince()));
add(Long.valueOf(branchCompany.getAddrTown())); }
if(branchCompany.getAddrCity() != null) {
add(Long.valueOf(branchCompany.getAddrCity()));
}
if(branchCompany.getAddrTown() != null) {
add(Long.valueOf(branchCompany.getAddrTown()));
}
}}); }});
detail = BeanUtil.toBean(branchCompany, CompanyDetail.class); detail = BeanUtil.toBean(branchCompany, CompanyDetail.class);
detail.setSysRegions(sysRegions); detail.setSysRegions(sysRegions);
......
...@@ -116,7 +116,7 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi ...@@ -116,7 +116,7 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
//查询车型信息,车型类型关系 //查询车型信息,车型类型关系
//公司信息,系统信息(购车须知,预定须知) //公司信息,系统信息(购车须知,预定须知)
ObjectRestResponse<List<VehicleModel>> vms = entityList(vehicleModel); ObjectRestResponse<List<VehicleModel>> vms = entityList(vehicleModel);
if (null == vms.getData() || null == vms.getData().get(0)) if (null == vms.getData() || vms.getData().size() <= 0)
throw new BaseException(ResultCode.NOTEXIST_CODE); throw new BaseException(ResultCode.NOTEXIST_CODE);
VehicleModel vm = vms.getData().get(0); VehicleModel vm = vms.getData().get(0);
VModelDetailVO vModelDetailVO = initVModelDetailVO(vm); VModelDetailVO vModelDetailVO = initVModelDetailVO(vm);
......
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