Commit dfcb0319 by lixian7

违法信息查询

parent 1b4f9887
...@@ -4,6 +4,8 @@ import com.hikcreate.common.sdk.response.apiparam.Response; ...@@ -4,6 +4,8 @@ import com.hikcreate.common.sdk.response.apiparam.Response;
import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator; import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator;
import com.hikcreate.common.sdk.response.statuscode.StatusCode; import com.hikcreate.common.sdk.response.statuscode.StatusCode;
import com.hikcreate.edl.pub.web.mobile.domain.IBindService; import com.hikcreate.edl.pub.web.mobile.domain.IBindService;
import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.BodyDecryptAnnotation;
import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.HeaderDecryptAnnotation;
import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.ResponseEncryptAnnotation; import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.ResponseEncryptAnnotation;
import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper; import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo; import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo;
...@@ -79,6 +81,7 @@ public class BindInfoControlller extends BaseController { ...@@ -79,6 +81,7 @@ public class BindInfoControlller extends BaseController {
* @date: 2020/6/19 10:31 * @date: 2020/6/19 10:31
*/ */
@PostMapping("query") @PostMapping("query")
@BodyDecryptAnnotation
@ResponseEncryptAnnotation @ResponseEncryptAnnotation
public Response<ResultList<BindInfo>> bindInfoQery(@RequestBody @Validated BindInfoQueryReq query) { public Response<ResultList<BindInfo>> bindInfoQery(@RequestBody @Validated BindInfoQueryReq query) {
return ResponseGenerator.success(new ResultList<BindInfo>(service.selectByQuery(query))); return ResponseGenerator.success(new ResultList<BindInfo>(service.selectByQuery(query)));
......
...@@ -8,6 +8,7 @@ import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator; ...@@ -8,6 +8,7 @@ import com.hikcreate.common.sdk.response.apiparam.ResponseGenerator;
import com.hikcreate.common.sdk.response.statuscode.StatusCode; import com.hikcreate.common.sdk.response.statuscode.StatusCode;
import com.hikcreate.edl.common.sdk.util.VerifyCodeUtil; import com.hikcreate.edl.common.sdk.util.VerifyCodeUtil;
import com.hikcreate.edl.pub.web.mobile.domain.IBindService; import com.hikcreate.edl.pub.web.mobile.domain.IBindService;
import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.HeaderDecryptAnnotation;
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.SmsFeign; import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.SmsFeign;
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.CheckVerifyCodeMicReq; import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.CheckVerifyCodeMicReq;
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.SendVerifyCodeMicReq; import com.hikcreate.edl.pub.web.mobile.infra.data.feign.edl_pub_service_sms.param.request.SendVerifyCodeMicReq;
...@@ -63,6 +64,7 @@ public class H5Controller { ...@@ -63,6 +64,7 @@ public class H5Controller {
* @date: 2020/6/19 10:32 * @date: 2020/6/19 10:32
*/ */
@PostMapping("yearCheckInfo") @PostMapping("yearCheckInfo")
@HeaderDecryptAnnotation
public Response<YearCheckInfoRes> yearCheckInfo(@RequestBody @Validated H5BindInfoQuery query) { public Response<YearCheckInfoRes> yearCheckInfo(@RequestBody @Validated H5BindInfoQuery query) {
return service.yearCheckInfo(query); return service.yearCheckInfo(query);
...@@ -77,6 +79,7 @@ public class H5Controller { ...@@ -77,6 +79,7 @@ public class H5Controller {
* @date: 2020/6/19 16:28 * @date: 2020/6/19 16:28
*/ */
@PostMapping("violationInfo") @PostMapping("violationInfo")
@HeaderDecryptAnnotation
public Response<ResultList<ViolationInfoRes>> violationInfo(@RequestBody @Validated H5BindInfoQuery query) { public Response<ResultList<ViolationInfoRes>> violationInfo(@RequestBody @Validated H5BindInfoQuery query) {
return service.violationInfo(query); return service.violationInfo(query);
...@@ -91,6 +94,7 @@ public class H5Controller { ...@@ -91,6 +94,7 @@ public class H5Controller {
* @date: 2020/6/19 16:28 * @date: 2020/6/19 16:28
*/ */
@PostMapping("insuranceInfo") @PostMapping("insuranceInfo")
@HeaderDecryptAnnotation
public Response<InsuranceInfoRes> insuranceInfo(@RequestBody @Validated H5BindInfoQuery query) { public Response<InsuranceInfoRes> insuranceInfo(@RequestBody @Validated H5BindInfoQuery query) {
return service.insuranceInfo(query); return service.insuranceInfo(query);
...@@ -106,6 +110,7 @@ public class H5Controller { ...@@ -106,6 +110,7 @@ public class H5Controller {
* @date: 2020/6/19 16:28 * @date: 2020/6/19 16:28
*/ */
@PostMapping("drivingLicenseInfo") @PostMapping("drivingLicenseInfo")
@HeaderDecryptAnnotation
public Response<DrivingLicenseInfoRes> drivingLicenseInfo(@RequestBody @Validated H5BindInfoQuery query) { public Response<DrivingLicenseInfoRes> drivingLicenseInfo(@RequestBody @Validated H5BindInfoQuery query) {
return service.drivingLicenseInfo(query); return service.drivingLicenseInfo(query);
...@@ -117,6 +122,7 @@ public class H5Controller { ...@@ -117,6 +122,7 @@ public class H5Controller {
* @return * @return
*/ */
@PostMapping("checkValidity") @PostMapping("checkValidity")
@HeaderDecryptAnnotation
public Response<CheckValidityRes> checkValidity( @RequestBody @Validated H5BindInfoQuery query) { public Response<CheckValidityRes> checkValidity( @RequestBody @Validated H5BindInfoQuery query) {
VerifyInfo verifyInfo = verifyInfoMapper.checkValidity(query.getPhone(), query.getUserId(), VerifyInfo verifyInfo = verifyInfoMapper.checkValidity(query.getPhone(), query.getUserId(),
...@@ -177,6 +183,4 @@ public class H5Controller { ...@@ -177,6 +183,4 @@ public class H5Controller {
} }
return checkResult; return checkResult;
} }
} }
...@@ -5,9 +5,11 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -5,9 +5,11 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.hikcreate.edl.common.sdk.util.EncryptStringAes; import com.hikcreate.edl.common.sdk.util.EncryptStringAes;
import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.BodyDecryptAnnotation; import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.BodyDecryptAnnotation;
import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.HeaderDecryptAnnotation; import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.HeaderDecryptAnnotation;
import com.hikcreate.edl.pub.web.mobile.infra.core.configbean.SignKeyConfigBean;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.BaseEncryptReq; import com.hikcreate.edl.pub.web.mobile.infra.model.param.request.BaseEncryptReq;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.MethodParameter; import org.springframework.core.MethodParameter;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpInputMessage; import org.springframework.http.HttpInputMessage;
...@@ -30,6 +32,9 @@ import java.lang.reflect.Type; ...@@ -30,6 +32,9 @@ import java.lang.reflect.Type;
@Slf4j @Slf4j
@ControllerAdvice @ControllerAdvice
public class DecryptRequestBodyAdvice implements RequestBodyAdvice { public class DecryptRequestBodyAdvice implements RequestBodyAdvice {
@Autowired
SignKeyConfigBean signKeyConfigBean;
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
public static void main( String[] args ) { public static void main( String[] args ) {
...@@ -44,7 +49,7 @@ public class DecryptRequestBodyAdvice implements RequestBodyAdvice { ...@@ -44,7 +49,7 @@ public class DecryptRequestBodyAdvice implements RequestBodyAdvice {
@Override @Override
public HttpInputMessage beforeBodyRead( HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass ) throws IOException { public HttpInputMessage beforeBodyRead( HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class<? extends HttpMessageConverter<?>> aClass ) throws IOException {
XHttpInputMessage xHttpInputMessage = new XHttpInputMessage(httpInputMessage, methodParameter); XHttpInputMessage xHttpInputMessage = new XHttpInputMessage(httpInputMessage, methodParameter, signKeyConfigBean.getKey());
return xHttpInputMessage; return xHttpInputMessage;
/*return new HttpInputMessage() { /*return new HttpInputMessage() {
...@@ -83,11 +88,13 @@ public class DecryptRequestBodyAdvice implements RequestBodyAdvice { ...@@ -83,11 +88,13 @@ public class DecryptRequestBodyAdvice implements RequestBodyAdvice {
private HttpHeaders headers; private HttpHeaders headers;
private InputStream body; private InputStream body;
private MethodParameter methodParameter; private MethodParameter methodParameter;
private String key;
public XHttpInputMessage( HttpInputMessage httpInputMessage, MethodParameter methodParameter ) throws IOException { public XHttpInputMessage( HttpInputMessage httpInputMessage, MethodParameter methodParameter, String key ) throws IOException {
this.headers = httpInputMessage.getHeaders(); this.headers = httpInputMessage.getHeaders();
this.body = httpInputMessage.getBody(); this.body = httpInputMessage.getBody();
this.methodParameter = methodParameter; this.methodParameter = methodParameter;
this.key = key;
//解密请求数据 //解密请求数据
decrypt(); decrypt();
} }
...@@ -111,7 +118,7 @@ public class DecryptRequestBodyAdvice implements RequestBodyAdvice { ...@@ -111,7 +118,7 @@ public class DecryptRequestBodyAdvice implements RequestBodyAdvice {
} }
if ( StrUtil.isNotBlank(encryptStr) ) { if ( StrUtil.isNotBlank(encryptStr) ) {
//解密 //解密
String decryptStr = EncryptStringAes.decryptAes(encryptStr, "AES/ECB/PKCS5Padding"); String decryptStr = EncryptStringAes.decryptAes(encryptStr, key );
this.body = IOUtils.toInputStream(decryptStr, "utf-8"); this.body = IOUtils.toInputStream(decryptStr, "utf-8");
} }
} catch ( Exception e ) { } catch ( Exception e ) {
......
...@@ -5,8 +5,10 @@ import com.hikcreate.common.sdk.response.apiparam.Response; ...@@ -5,8 +5,10 @@ import com.hikcreate.common.sdk.response.apiparam.Response;
import com.hikcreate.common.sdk.response.statuscode.StatusCode; import com.hikcreate.common.sdk.response.statuscode.StatusCode;
import com.hikcreate.edl.common.sdk.util.EncryptStringAes; import com.hikcreate.edl.common.sdk.util.EncryptStringAes;
import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.ResponseEncryptAnnotation; import com.hikcreate.edl.pub.web.mobile.infra.core.annotatiion.ResponseEncryptAnnotation;
import com.hikcreate.edl.pub.web.mobile.infra.core.configbean.SignKeyConfigBean;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BaseEncryptRes; import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.BaseEncryptRes;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.MethodParameter; import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.server.ServerHttpRequest; import org.springframework.http.server.ServerHttpRequest;
...@@ -26,6 +28,9 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; ...@@ -26,6 +28,9 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
@Slf4j @Slf4j
@ControllerAdvice @ControllerAdvice
public class EncryptResponseBodyAdvice implements ResponseBodyAdvice { public class EncryptResponseBodyAdvice implements ResponseBodyAdvice {
@Autowired
SignKeyConfigBean signKeyConfigBean;
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
@Override @Override
...@@ -44,7 +49,7 @@ public class EncryptResponseBodyAdvice implements ResponseBodyAdvice { ...@@ -44,7 +49,7 @@ public class EncryptResponseBodyAdvice implements ResponseBodyAdvice {
Object data = result.getData(); Object data = result.getData();
if ( data != null ) { if ( data != null ) {
String dataStr = objectMapper.writeValueAsString(data); String dataStr = objectMapper.writeValueAsString(data);
String encryptStr = EncryptStringAes.encryptAes(dataStr, "AES/ECB/PKCS5Padding"); String encryptStr = EncryptStringAes.encryptAes(dataStr, signKeyConfigBean.getKey());
BaseEncryptRes baseEncryptRes = new BaseEncryptRes(); BaseEncryptRes baseEncryptRes = new BaseEncryptRes();
baseEncryptRes.setEncData(encryptStr); baseEncryptRes.setEncData(encryptStr);
result.setData(baseEncryptRes); result.setData(baseEncryptRes);
......
...@@ -221,6 +221,8 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -221,6 +221,8 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
ViolationPlateNumAndTypeQueryReq req = new ViolationPlateNumAndTypeQueryReq(); ViolationPlateNumAndTypeQueryReq req = new ViolationPlateNumAndTypeQueryReq();
req.setPlateNum(bindInfo.getPlateNum()); req.setPlateNum(bindInfo.getPlateNum());
req.setPlateType(bindInfo.getPlateType()); req.setPlateType(bindInfo.getPlateType());
req.setTimeEnd(new Date());
req.setTimeStart(DateUtil.offsetMonth(new Date(),-12));
List<ViolationRes> byPlateNumAndType = violationCache.getByPlateNumAndType(req); List<ViolationRes> byPlateNumAndType = violationCache.getByPlateNumAndType(req);
/** /**
...@@ -298,7 +300,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -298,7 +300,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
public void clearPast() { public void clearPast() {
DateTime now = DateTime.now(); DateTime now = DateTime.now();
log.info("开始清除,已过期且无效的绑定信息.当前时间:" + now); log.info("开始清除,已过期且无效的绑定信息.当前时间:" + now);
DateTime lastMonth = DateUtil.offsetDay(now, -30); Date lastMonth = DateUtil.offsetDay(now, -30);
Integer count = mapper.clearPast(lastMonth); Integer count = mapper.clearPast(lastMonth);
log.info("清除完毕,共清除过期且无效的绑定信息:" + count); log.info("清除完毕,共清除过期且无效的绑定信息:" + count);
......
package com.hikcreate.edl.pub.web.mobile.infra.core.configbean;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
/**
* @author lixian
* @description
* @date 2020/6/21 18:41
**/
@Data
@ConfigurationProperties("biz.sign")
@Component
@RefreshScope
public class SignKeyConfigBean {
String key;
}
...@@ -13,7 +13,7 @@ import javax.validation.Valid; ...@@ -13,7 +13,7 @@ import javax.validation.Valid;
* *
*/ */
@FeignClient( name = "dcp-service-vehicle", path = "dcp/drivingLicense", contextId = @FeignClient( name = "dcp-service-vehicle", path = "dcp/drivingLicense", contextId =
"dcp-service-vehicle-drivingLicense") "dcp-service-vehicle-drivingLicense", url = "http://10.197.236.100:40204")
public interface DrivingLicenseFeign { public interface DrivingLicenseFeign {
......
...@@ -22,7 +22,7 @@ public interface BindInfoMapper extends BaseMapper<BindInfo> { ...@@ -22,7 +22,7 @@ public interface BindInfoMapper extends BaseMapper<BindInfo> {
Integer bindInfoInsert(BindInfo info); Integer bindInfoInsert(BindInfo info);
Integer clearPast( Date dateTime); Integer clearPast(Date dateTime);
Integer unbind(BindInfo info); Integer unbind(BindInfo info);
......
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