Commit 34f1f802 by wubh

包活干V1.9.0-修改:调整代码结构,删除冗余类

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@27010 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 3e06c87a
Showing 43 changed files with 553 additions and 739 deletions
package com.glsx.ordercenter.dto.common;
package com.glsx.common.pojo;
import java.io.Serializable;
import com.glsx.common.utils.Page;
......@@ -11,7 +11,7 @@ import com.glsx.common.utils.Page;
* @author wbh
* @date 2020-05-22
*/
public abstract class PagedOrderRequest implements Serializable {
public abstract class PagedReq implements Serializable {
/**
* 页码
*/
......@@ -39,7 +39,7 @@ public abstract class PagedOrderRequest implements Serializable {
@Override
public String toString() {
return "PagedOrderRequest{" +
return "PagedReq{" +
"pageIndex=" + this.pageIndex +
", pageSize=" + this.pageSize +
'}';
......
package com.glsx.ordercenter.dto.common;
package com.glsx.common.pojo;
import java.util.List;
import com.glsx.common.utils.Page;
......@@ -11,27 +11,25 @@ import com.glsx.common.utils.Page;
* @author wbh
* @date 2020-05-22
*/
public class PagedOrderResponse<E> {
public class PagedResp<E> {
private Page page;
private List<E> items;
private PagedOrderResponse(Page page, List<E> items) {
private PagedResp(Page page, List<E> items) {
this.page = page;
this.items = items;
}
public static <E> PagedOrderResponse<E> of(long totalCount, PagedOrderRequest pagedOrderRequest,
List<E> list) {
public static <E> PagedResp<E> of(long totalCount, PagedReq orderReq, List<E> list) {
Page page = new Page(pagedOrderRequest.getPageIndex(),
pagedOrderRequest.getPageSize());
Page page = new Page(orderReq.getPageIndex(), orderReq.getPageSize());
page.setTotalCount((int) totalCount);
return of(page, list);
}
public static <E> PagedOrderResponse<E> of(Page page, List<E> list) {
return new PagedOrderResponse<>(page, list);
public static <E> PagedResp<E> of(Page page, List<E> list) {
return new PagedResp<>(page, list);
}
public Page getPage() {
......@@ -52,7 +50,7 @@ public class PagedOrderResponse<E> {
@Override
public String toString() {
return "PagedOrderResponse{" +
return "PagedResp{" +
"page=" + this.page +
", items=" + this.items +
'}';
......
......@@ -131,14 +131,14 @@ public enum ResultCodeEnum {
/**
* 保单-导出数据过多
*/
INSURANCE_EXPORT_TO_MANY(1, "保单导出数据量大于5000条,请条件过滤后重新导出"),
INSURANCE_ID_NULL(2, "保单ID不能为空"),
INSURANCE_ID_NULL(1, "保单ID不能为空"),
INSURANCE_THIRD_ID_NULL(2, "第三方保单号不能为空"),
INSURANCE_ID_NOT_FOUND(3, "无法根据保单ID获取保单数据"),
INSURANCE_EXPORT_NOT_SUPPORTED(4, "非页面请求,无法导出保单"),
INSURANCE_PDF_NOT_FOUND(5, "无法获取到保单相关的PDF文件"),
INSURANCE_API_FAIL(6, "TSP保险接口异常"),
INSURANCE_UPDATE_ERROR(7, "修改保单状态异常"),
INSURANCE_THIRD_ID_NULL(8, "第三方保单号不能为空"),
INSURANCE_PDF_NOT_FOUND(4, "无法获取到保单相关的PDF文件"),
INSURANCE_EXPORT_TO_MANY(5, "保单导出数据量大于5000条,请条件过滤后重新导出"),
INSURANCE_EXPORT_NOT_SUPPORTED(6, "无法导出保单数据"),
INSURANCE_API_FAIL(7, "TSP保险接口错误"),
INSURANCE_UPDATE_ERROR(8, "修改保单信息异常"),
;
......
package com.glsx.ordercenter.controller;
import javax.servlet.http.HttpServletRequest;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
......@@ -11,6 +12,7 @@ import java.util.Map;
import java.util.Set;
import com.glsx.common.constants.ResultCodeEnum;
import com.glsx.common.constants.ResultObject;
import com.glsx.common.pojo.PagedReq;
import com.glsx.ordercenter.exception.SysException;
import com.glsx.ordercenter.utils.LogUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -18,6 +20,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
/**
* @author zhanghj
......@@ -72,8 +76,31 @@ public class BaseController {
Collection<String> values = errorMap.values();
String errorMsg = StringUtils.join(values, ";");
throw SysException.create(
ResultCodeEnum.PARAM_ERROR.getCode(), errorMsg);
throw SysException.create(ResultCodeEnum.PARAM_ERROR.getCode(),
ResultCodeEnum.PARAM_ERROR.getMsg() + ": " + errorMsg);
}
protected <T extends PagedReq> void setPagedInfo(T requestBody) {
ServletRequestAttributes attributes =
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes != null) {
HttpServletRequest request = attributes.getRequest();
String pageIndexStr = request.getParameter("pageIndex");
String pageSizeStr = request.getParameter("pageSize");
if (StringUtils.isNotBlank(pageIndexStr)) {
try {
requestBody.setPageIndex(Integer.parseInt(pageIndexStr));
} catch (NumberFormatException ignored) {}
}
if (StringUtils.isNotBlank(pageSizeStr)) {
try {
requestBody.setPageSize(Integer.parseInt(pageSizeStr));
} catch (NumberFormatException ignored) {}
}
}
}
protected ResultObject webOk(Object result) {
......
package com.glsx.ordercenter.controller.insurance;
package com.glsx.ordercenter.controller;
import com.glsx.common.constants.ResultObject;
import com.glsx.ordercenter.controller.BaseController;
import com.glsx.ordercenter.dto.common.PagedOrderResponse;
import com.glsx.ordercenter.dto.insurance.*;
import com.glsx.ordercenter.service.insurance.InsuranceService;
import com.glsx.common.pojo.PagedResp;
import com.glsx.ordercenter.dto.req.InsuranceReq;
import com.glsx.ordercenter.dto.resp.InsuranceResp;
import com.glsx.ordercenter.service.InsuranceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -28,18 +28,16 @@ public class InsuranceController extends BaseController {
/**
* 获取保单列表
*
* @param insuranceQueryReq 请求体
* @param insuranceReq 请求体
* @return 查询结果
*/
@RequestMapping(value = "/getList", method = RequestMethod.POST)
public ResultObject query(@RequestBody InsuranceQueryReq insuranceQueryReq) {
super.logInfo("保单列表查询-参数", insuranceQueryReq);
public ResultObject query(@RequestBody InsuranceReq insuranceReq) {
super.logInfo("保单列表查询-参数", insuranceReq);
ResultObject resultObject;
PagedOrderResponse<InsuranceQueryResp> pagedOrderResponse;
pagedOrderResponse = this.insuranceService.query(insuranceQueryReq);
resultObject = super.webOk(pagedOrderResponse);
super.setPagedInfo(insuranceReq);
PagedResp<InsuranceResp> result = this.insuranceService.query(insuranceReq);
ResultObject resultObject = super.webOk(result);
super.logInfo("保单列表查询-结果", resultObject);
......@@ -49,19 +47,17 @@ public class InsuranceController extends BaseController {
/**
* 获取保单详情
*
* @param insuranceDetailReq 请求体
* @param insuranceReq 请求体
* @return 保单详情
*/
//@AuthCheck
@RequestMapping(value = "/detail", method = RequestMethod.POST)
public ResultObject detail(@RequestBody InsuranceDetailReq insuranceDetailReq) {
super.logInfo("保单详情查询-参数", insuranceDetailReq);
ResultObject resultObject;
PagedOrderResponse<InsuranceDetailResp> pagedOrderResponse;
public ResultObject detail(@RequestBody InsuranceReq insuranceReq) {
super.logInfo("保单详情查询-参数", insuranceReq);
pagedOrderResponse = this.insuranceService.detail(insuranceDetailReq);
resultObject = super.webOk(pagedOrderResponse);
super.setPagedInfo(insuranceReq);
PagedResp<InsuranceResp> result = this.insuranceService.detail(insuranceReq);
ResultObject resultObject = super.webOk(result);
super.logInfo("保单详情查询-结果", resultObject);
......@@ -71,18 +67,15 @@ public class InsuranceController extends BaseController {
/**
* 下载保单PDF
*
* @param insuranceDetailReq 请求体
* @param insuranceReq 请求体
*/
//@AuthCheck
@RequestMapping(value = "/download", method = RequestMethod.POST)
public ResultObject download(@RequestBody InsuranceDetailReq insuranceDetailReq) {
super.logInfo("下载保单-参数", insuranceDetailReq);
ResultObject resultObject;
InsuranceDetailResp insuranceDetailResp =
this.insuranceService.download(insuranceDetailReq);
public ResultObject download(@RequestBody InsuranceReq insuranceReq) {
super.logInfo("下载保单-参数", insuranceReq);
resultObject = super.webOk(insuranceDetailResp);
InsuranceResp insuranceResp = this.insuranceService.download(insuranceReq);
ResultObject resultObject = super.webOk(insuranceResp);
super.logInfo("下载保单-结果", resultObject);
......@@ -92,17 +85,16 @@ public class InsuranceController extends BaseController {
/**
* 退保
*
* @param insuranceRefundReq 请求体
* @param insuranceReq 请求体
* @return 退保结果
*/
//@AuthCheck
@RequestMapping(value = "/refund", method = RequestMethod.POST)
public ResultObject refund(@RequestBody InsuranceRefundReq insuranceRefundReq) {
super.logInfo("退保-参数", insuranceRefundReq);
public ResultObject refund(@RequestBody InsuranceReq insuranceReq) {
super.logInfo("退保-参数", insuranceReq);
InsuranceRefundResp insuranceRefundResp =
this.insuranceService.refund(insuranceRefundReq);
ResultObject resultObject = super.webOk(insuranceRefundResp);
InsuranceResp insuranceResp = this.insuranceService.refund(insuranceReq);
ResultObject resultObject = super.webOk(insuranceResp);
super.logInfo("退保-结果", resultObject);
......
......@@ -14,6 +14,7 @@ import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.glsx.common.feign.client.UserClient;
import com.glsx.common.pojo.PagedResp;
import com.glsx.common.utils.UserUtils;
import com.glsx.ordercenter.constants.OrderTypeEnum;
import com.glsx.ordercenter.constants.ReconciliationStatusEnum;
......@@ -29,11 +30,10 @@ import com.glsx.ordercenter.dto.OrderExceptionVO;
import com.glsx.ordercenter.dto.QueryOrderReq;
import com.glsx.ordercenter.dto.ReconciliationDetailQuery;
import com.glsx.ordercenter.dto.ReconciliationDetailVO;
import com.glsx.ordercenter.dto.common.PagedOrderResponse;
import com.glsx.ordercenter.dto.insurance.InsuranceQueryReq;
import com.glsx.ordercenter.dto.insurance.InsuranceQueryResp;
import com.glsx.ordercenter.dto.req.InsuranceReq;
import com.glsx.ordercenter.dto.req.ReconciliationListQuery;
import com.glsx.ordercenter.dto.resp.ExportReconciliationVo;
import com.glsx.ordercenter.dto.resp.InsuranceResp;
import com.glsx.ordercenter.exception.SysException;
import com.glsx.ordercenter.pojo.DictionaryData;
import com.glsx.ordercenter.pojo.ExportOrderExceptionVo;
......@@ -50,10 +50,10 @@ import com.glsx.ordercenter.service.IOrderExceptionService;
import com.glsx.ordercenter.service.IOrderService;
import com.glsx.ordercenter.service.IUnknownOrderService;
import com.glsx.ordercenter.service.IndentService;
import com.glsx.ordercenter.service.InsuranceService;
import com.glsx.ordercenter.service.OperationAdvanceService;
import com.glsx.ordercenter.service.ReconciliationDetailService;
import com.glsx.ordercenter.service.ReconciliationService;
import com.glsx.ordercenter.service.insurance.InsuranceService;
import com.google.common.collect.Lists;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -483,18 +483,17 @@ public class ReportController extends BaseReportController {
}
@RequestMapping(value = "/exportInsurance", method = {RequestMethod.POST, RequestMethod.GET})
public void exportInsurance( InsuranceQueryReq insuranceQueryReq) {
this.logger.info("保单导出-参数: {}", JSON.toJSONString(insuranceQueryReq));
public void exportInsurance(InsuranceReq insuranceReq) {
this.logger.info("保单导出-参数: {}", JSON.toJSONString(insuranceReq));
ServletRequestAttributes attributes =
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
insuranceQueryReq.setPageIndex(-1);
insuranceQueryReq.setPageSize(-1);
PagedOrderResponse<InsuranceQueryResp> pagedOrderResponse =
this.insuranceService.query(insuranceQueryReq);
insuranceReq.setPageIndex(null);
insuranceReq.setPageSize(null);
PagedResp<InsuranceResp> pagedResp = this.insuranceService.query(insuranceReq);
if (pagedOrderResponse.getItems().size() > 5000) {
if (pagedResp.getItems().size() > 5000) {
throw SysException.create(
ResultCodeEnum.INSURANCE_EXPORT_TO_MANY.getCode(),
ResultCodeEnum.INSURANCE_EXPORT_TO_MANY.getMsg());
......@@ -503,8 +502,8 @@ public class ReportController extends BaseReportController {
try {
if (attributes != null && attributes.getResponse() != null) {
String title = "保单详情-" +
DateTimeFormatter.ofPattern("yyyy-MM-dd_HH_mm_ss").format(LocalDateTime.now());
this.exportObject(attributes.getResponse(), pagedOrderResponse.getItems(), title);
DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss").format(LocalDateTime.now());
this.exportObject(attributes.getResponse(), pagedResp.getItems(), title);
} else {
throw new IOException(ResultCodeEnum.INSURANCE_EXPORT_NOT_SUPPORTED.getMsg());
}
......
package com.glsx.ordercenter.controller.api;
import com.glsx.ordercenter.constants.insurance.OraResultCode;
import com.glsx.ordercenter.controller.BaseController;
import com.glsx.ordercenter.dto.api.OraBaseResponse;
import com.glsx.ordercenter.exception.insurance.OraBizException;
import org.springframework.validation.BindingResult;
/**
* <p>Description:
*
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-27
*/
public abstract class OraBaseController extends BaseController {
@Override
protected void checkRequestParam(BindingResult bindingResult) {
try {
super.checkRequestParam(bindingResult);
} catch (RuntimeException e) {
throw new OraBizException(OraResultCode.PARAM_ERROR, e.getMessage());
}
}
protected <T extends OraBaseResponse> T oraWebOops(Throwable t, T baseResponse) {
super.logError("长城欧拉Controller异常", t);
baseResponse.setCode(OraResultCode.SERVER_ERROR.getCode());
baseResponse.setMessage(OraResultCode.SERVER_ERROR.getMessage());
return baseResponse;
}
protected <T extends OraBaseResponse> T oraWebOops(OraResultCode code, Throwable t,
T baseResponse) {
super.logError("长城欧拉Controller异常", t);
baseResponse.setCode(code.getCode());
baseResponse.setMessage(t.getMessage());
return baseResponse;
}
}
package com.glsx.ordercenter.controller.api;
import com.glsx.ordercenter.dto.api.OraInsuranceRefundReq;
import com.glsx.ordercenter.dto.api.OraInsuranceRefundResp;
import com.glsx.ordercenter.dto.api.OraInsuranceUpdateReq;
import com.glsx.ordercenter.dto.api.OraInsuranceUpdateResp;
import com.glsx.ordercenter.exception.insurance.OraBizException;
import com.glsx.common.constants.ResultObject;
import com.glsx.ordercenter.constants.ResultCodeEnum;
import com.glsx.ordercenter.controller.BaseController;
import com.glsx.ordercenter.dto.req.OraInsuranceRefundReq;
import com.glsx.ordercenter.dto.req.OraInsuranceUpdateReq;
import com.glsx.ordercenter.dto.resp.OraResultObject;
import com.glsx.ordercenter.exception.SysException;
import com.glsx.ordercenter.service.api.OraInsuranceService;
import com.glsx.ordercenter.utils.OraSignUtil;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -26,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/api/insurance")
public class OraInsuranceController extends OraBaseController {
public class OraInsuranceController extends BaseController {
@Value("${ora.api.url}")
private String serverUrl;
......@@ -40,40 +42,48 @@ public class OraInsuranceController extends OraBaseController {
private OraInsuranceService oraInsuranceService;
@RequestMapping(value = "/update", method = RequestMethod.POST)
public OraInsuranceUpdateResp update(
@Validated @RequestBody OraInsuranceUpdateReq insuranceUpdateReq,
public OraResultObject update(@Validated @RequestBody OraInsuranceUpdateReq updateReq,
BindingResult bindingResult) {
super.logInfo("长城欧拉修改保单-参数", insuranceUpdateReq);
OraInsuranceUpdateResp insuranceUpdateResp;
super.logInfo("长城欧拉修改保单-参数", updateReq);
OraResultObject resultObject;
try {
OraSignUtil.verifyRequest(this.appKey, this.appSecret, updateReq);
super.checkRequestParam(bindingResult);
insuranceUpdateResp = this.oraInsuranceService.update(insuranceUpdateReq);
} catch (OraBizException e) {
insuranceUpdateResp = super.oraWebOops(e.getCode(), e, new OraInsuranceUpdateResp());
resultObject = this.oraInsuranceService.update(updateReq);
} catch (SysException e) {
super.logError("长城欧拉修改保单-异常", e);
ResultObject result = e.getResultEntity();
resultObject = new OraResultObject(result.getCode(), result.getMessage());
} catch (RuntimeException e) {
insuranceUpdateResp = super.oraWebOops(e, new OraInsuranceUpdateResp());
super.logError("长城欧拉修改保单-异常", e);
resultObject = new OraResultObject(ResultCodeEnum.ERROR);
}
super.logInfo("长城欧拉修改保单-结果", insuranceUpdateResp);
return insuranceUpdateResp;
super.logInfo("长城欧拉修改保单-结果", resultObject);
return resultObject;
}
@RequestMapping(value = "/refund", method = RequestMethod.POST)
public OraInsuranceRefundResp refund(
@Validated @RequestBody OraInsuranceRefundReq insuranceRefundReq,
public OraResultObject refund(@Validated @RequestBody OraInsuranceRefundReq refundReq,
BindingResult bindingResult) {
super.logInfo("长城欧拉退保-参数", insuranceRefundReq);
OraInsuranceRefundResp insuranceRefundResp;
super.logInfo("长城欧拉退保-参数", refundReq);
OraResultObject resultObject;
try {
OraSignUtil.verifyRequest(this.appKey, this.appSecret,
insuranceRefundReq);
OraSignUtil.verifyRequest(this.appKey, this.appSecret, refundReq);
super.checkRequestParam(bindingResult);
insuranceRefundResp = this.oraInsuranceService.refund(insuranceRefundReq);
} catch (OraBizException e) {
insuranceRefundResp = super.oraWebOops(e.getCode(), e, new OraInsuranceRefundResp());
resultObject = this.oraInsuranceService.refund(refundReq);
} catch (SysException e) {
super.logError("长城欧拉修改保单-异常", e);
ResultObject result = e.getResultEntity();
resultObject = new OraResultObject(result.getCode(), result.getMessage());
} catch (RuntimeException e) {
insuranceRefundResp = super.oraWebOops(e, new OraInsuranceRefundResp());
super.logError("长城欧拉修改保单-异常", e);
resultObject = new OraResultObject(ResultCodeEnum.ERROR);
}
super.logInfo("长城欧拉退保-结果", insuranceRefundResp);
return insuranceRefundResp;
super.logInfo("长城欧拉退保-结果", resultObject);
return resultObject;
}
}
package com.glsx.ordercenter.dto.api;
import java.io.Serializable;
/**
* <p>Description:
*
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-25
*/
public class OraBaseRequest implements Serializable {
}
package com.glsx.ordercenter.dto.api;
import java.io.Serializable;
/**
* <p>Description:
*
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-25
*/
public class OraBaseResponse implements Serializable {
/**
* 状态码
*/
private Integer code;
/**
* 信息
*/
private String message;
public Integer getCode() {
return this.code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String toString() {
return "OraBaseResponse{" +
"code=" + this.code +
", message='" + this.message + '\'' +
'}';
}
}
package com.glsx.ordercenter.dto.api;
/**
* <p>Description:
*
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-25
*/
public class OraInsuranceRefundResp extends OraBaseResponse {
/**
* 保单ID
*/
private String insuranceId;
public String getInsuranceId() {
return this.insuranceId;
}
public void setInsuranceId(String insuranceId) {
this.insuranceId = insuranceId;
}
@Override
public String toString() {
return "OraInsuranceRefundResp{" +
"insuranceId='" + this.insuranceId + '\'' +
"} " + super.toString();
}
}
package com.glsx.ordercenter.dto.api;
/**
* <p>Description:
*
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-25
*/
public class OraInsuranceUpdateResp extends OraBaseResponse {
/**
* 保单ID
*/
private String insuranceId;
public String getInsuranceId() {
return this.insuranceId;
}
public void setInsuranceId(String insuranceId) {
this.insuranceId = insuranceId;
}
@Override
public String toString() {
return "OraInsuranceUpdateResp{" +
"insuranceId='" + this.insuranceId + '\'' +
"} " + super.toString();
}
}
package com.glsx.ordercenter.dto.insurance;
/**
* <p>Description: 保单详情请求体
*
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-22
*/
public class InsuranceDetailReq extends InsuranceQueryReq {
}
package com.glsx.ordercenter.dto.insurance;
/**
* <p>Description: 保单详情响应体
*
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-22
*/
public class InsuranceDetailResp extends InsuranceQueryResp {
/**
* 客户类型
*/
private Byte customerType;
/**
* 联系地址
*/
private String vehicleOwnerAddress;
/**
* 车辆颜色
*/
private String vehicleColor;
/**
* PDF地址
*/
private String insurancePdf;
public Byte getCustomerType() {
return this.customerType;
}
public void setCustomerType(Byte customerType) {
this.customerType = customerType;
}
public String getVehicleOwnerAddress() {
return this.vehicleOwnerAddress;
}
public void setVehicleOwnerAddress(String vehicleOwnerAddress) {
this.vehicleOwnerAddress = vehicleOwnerAddress;
}
public String getVehicleColor() {
return this.vehicleColor;
}
public void setVehicleColor(String vehicleColor) {
this.vehicleColor = vehicleColor;
}
public String getInsurancePdf() {
return this.insurancePdf;
}
public void setInsurancePdf(String insurancePdf) {
this.insurancePdf = insurancePdf;
}
@Override
public String toString() {
return "InsuranceDetailResp{" +
"customerType=" + this.customerType +
", vehicleOwnerAddress='" + this.vehicleOwnerAddress + '\'' +
", vehicleColor='" + this.vehicleColor + '\'' +
", insurancePdf='" + this.insurancePdf + '\'' +
"} " + super.toString();
}
}
package com.glsx.ordercenter.dto.insurance;
import com.glsx.ordercenter.dto.common.PagedOrderRequest;
/**
* <p>Description:
*
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-25
*/
public class InsuranceRefundReq extends PagedOrderRequest {
/**
* 保单ID
*/
private Integer id;
/**
* 第三方保单ID
*/
private String insuranceId;
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getInsuranceId() {
return this.insuranceId;
}
public void setInsuranceId(String insuranceId) {
this.insuranceId = insuranceId;
}
@Override
public String toString() {
return "InsuranceRefundReq{" +
"id=" + this.id +
", insuranceId='" + this.insuranceId + '\'' +
"} " + super.toString();
}
}
package com.glsx.ordercenter.dto.insurance;
import java.io.Serializable;
/**
* <p>Description:
*
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-25
*/
public class InsuranceRefundResp implements Serializable {
}
package com.glsx.ordercenter.dto.insurance;
package com.glsx.ordercenter.dto.req;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.glsx.ordercenter.dto.common.PagedOrderRequest;
import com.glsx.common.pojo.PagedReq;
/**
* <p>Description: 保单列表请求体
* <p>Description: 保单相关请求体
*
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-22
*/
public class InsuranceQueryReq extends PagedOrderRequest {
public class InsuranceReq extends PagedReq {
/**
* 保单ID
*/
......@@ -144,7 +144,7 @@ public class InsuranceQueryReq extends PagedOrderRequest {
@Override
public String toString() {
return "InsuranceQueryReq{" +
return "InsuranceReq{" +
"id=" + this.id +
", insuranceId='" + this.insuranceId + '\'' +
", vehicleOwnerName='" + this.vehicleOwnerName + '\'' +
......
package com.glsx.ordercenter.dto.api;
package com.glsx.ordercenter.dto.req;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* <p>Description:
......@@ -10,7 +11,7 @@ import javax.validation.constraints.NotBlank;
* @author wbh
* @date 2020-05-25
*/
public class OraInsuranceRefundReq extends OraBaseRequest {
public class OraInsuranceRefundReq implements Serializable {
/**
* 聚合保单ID(唯一不变值)
*/
......@@ -43,6 +44,6 @@ public class OraInsuranceRefundReq extends OraBaseRequest {
return "OraInsuranceRefundReq{" +
"insuranceId='" + this.insuranceId + '\'' +
", reason='" + this.reason + '\'' +
"} " + super.toString();
'}';
}
}
package com.glsx.ordercenter.dto.api;
package com.glsx.ordercenter.dto.req;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* <p>Description:
......@@ -11,7 +12,7 @@ import javax.validation.constraints.NotNull;
* @author wbh
* @date 2020-05-25
*/
public class OraInsuranceUpdateReq extends OraBaseRequest {
public class OraInsuranceUpdateReq implements Serializable {
/**
* 聚合保单ID(唯一不变值)
*/
......@@ -303,6 +304,6 @@ public class OraInsuranceUpdateReq extends OraBaseRequest {
", tastingUnit='" + this.tastingUnit + '\'' +
", customerId=" + this.customerId +
", registrationDate='" + this.registrationDate + '\'' +
"} " + super.toString();
'}';
}
}
package com.glsx.ordercenter.dto.insurance;
package com.glsx.ordercenter.dto.req;
import java.io.Serializable;
import java.math.BigDecimal;
......@@ -74,7 +74,7 @@ public class TspSaveReq implements Serializable {
private Long sumPremium;
public Long getSumPremium() {
return sumPremium;
return this.sumPremium;
}
public void setSumPremium(Long sumPremium) {
......@@ -82,7 +82,7 @@ public class TspSaveReq implements Serializable {
}
public String getInsuranceCompany() {
return insuranceCompany;
return this.insuranceCompany;
}
public void setInsuranceCompany(String insuranceCompany) {
......@@ -90,7 +90,7 @@ public class TspSaveReq implements Serializable {
}
public String getSeqNo() {
return seqNo;
return this.seqNo;
}
public void setSeqNo(String seqNo) {
......@@ -98,7 +98,7 @@ public class TspSaveReq implements Serializable {
}
public String getCompensationName() {
return compensationName;
return this.compensationName;
}
public void setCompensationName(String compensationName) {
......@@ -106,7 +106,7 @@ public class TspSaveReq implements Serializable {
}
public String getAddress() {
return address;
return this.address;
}
public void setAddress(String address) {
......@@ -114,7 +114,7 @@ public class TspSaveReq implements Serializable {
}
public String getCustomerType() {
return customerType;
return this.customerType;
}
public void setCustomerType(String customerType) {
......@@ -122,7 +122,7 @@ public class TspSaveReq implements Serializable {
}
public String getCardType() {
return cardType;
return this.cardType;
}
public void setCardType(String cardType) {
......@@ -130,7 +130,7 @@ public class TspSaveReq implements Serializable {
}
public String getCardNo() {
return cardNo;
return this.cardNo;
}
public void setCardNo(String cardNo) {
......@@ -138,7 +138,7 @@ public class TspSaveReq implements Serializable {
}
public String getName() {
return name;
return this.name;
}
public void setName(String name) {
......@@ -146,7 +146,7 @@ public class TspSaveReq implements Serializable {
}
public String getPhone() {
return phone;
return this.phone;
}
public void setPhone(String phone) {
......@@ -154,7 +154,7 @@ public class TspSaveReq implements Serializable {
}
public String getEffectDate() {
return effectDate;
return this.effectDate;
}
public void setEffectDate(String effectDate) {
......@@ -162,7 +162,7 @@ public class TspSaveReq implements Serializable {
}
public String getInsurePeriod() {
return insurePeriod;
return this.insurePeriod;
}
public void setInsurePeriod(String insurePeriod) {
......@@ -170,7 +170,7 @@ public class TspSaveReq implements Serializable {
}
public String getSumAmount() {
return sumAmount;
return this.sumAmount;
}
public void setSumAmount(String sumAmount) {
......@@ -178,7 +178,7 @@ public class TspSaveReq implements Serializable {
}
public String getStandNo() {
return standNo;
return this.standNo;
}
public void setStandNo(String standNo) {
......@@ -186,7 +186,7 @@ public class TspSaveReq implements Serializable {
}
public String getEngine() {
return engine;
return this.engine;
}
public void setEngine(String engine) {
......@@ -194,7 +194,7 @@ public class TspSaveReq implements Serializable {
}
public String getBuyType() {
return buyType;
return this.buyType;
}
public void setBuyType(String buyType) {
......@@ -202,7 +202,7 @@ public class TspSaveReq implements Serializable {
}
public String getVehicleColor() {
return vehicleColor;
return this.vehicleColor;
}
public void setVehicleColor(String vehicleColor) {
......@@ -210,7 +210,7 @@ public class TspSaveReq implements Serializable {
}
public String getVehicleBrand() {
return vehicleBrand;
return this.vehicleBrand;
}
public void setVehicleBrand(String vehicleBrand) {
......@@ -218,7 +218,7 @@ public class TspSaveReq implements Serializable {
}
public String getVehicleChildsBrandName() {
return vehicleChildsBrandName;
return this.vehicleChildsBrandName;
}
public void setVehicleChildsBrandName(String vehicleChildsBrandName) {
......@@ -226,7 +226,7 @@ public class TspSaveReq implements Serializable {
}
public String getVehicleSeriesName() {
return vehicleSeriesName;
return this.vehicleSeriesName;
}
public void setVehicleSeriesName(String vehicleSeriesName) {
......@@ -234,7 +234,7 @@ public class TspSaveReq implements Serializable {
}
public BigDecimal getVehiclePrice() {
return vehiclePrice;
return this.vehiclePrice;
}
public void setVehiclePrice(BigDecimal vehiclePrice) {
......@@ -242,7 +242,7 @@ public class TspSaveReq implements Serializable {
}
public String getVehicleUsage() {
return vehicleUsage;
return this.vehicleUsage;
}
public void setVehicleUsage(String vehicleUsage) {
......@@ -250,7 +250,7 @@ public class TspSaveReq implements Serializable {
}
public String getPlanNo() {
return planNo;
return this.planNo;
}
public void setPlanNo(String planNo) {
......@@ -258,7 +258,7 @@ public class TspSaveReq implements Serializable {
}
public String getBirthday() {
return birthday;
return this.birthday;
}
public void setBirthday(String birthday) {
......@@ -266,7 +266,7 @@ public class TspSaveReq implements Serializable {
}
public String getSex() {
return sex;
return this.sex;
}
public void setSex(String sex) {
......@@ -274,7 +274,7 @@ public class TspSaveReq implements Serializable {
}
public String getInstallPoint() {
return installPoint;
return this.installPoint;
}
public void setInstallPoint(String installPoint) {
......@@ -282,7 +282,7 @@ public class TspSaveReq implements Serializable {
}
public String getInstallPerson() {
return installPerson;
return this.installPerson;
}
public void setInstallPerson(String installPerson) {
......@@ -290,7 +290,7 @@ public class TspSaveReq implements Serializable {
}
public String getSpid() {
return spid;
return this.spid;
}
public void setSpid(String spid) {
......@@ -298,7 +298,7 @@ public class TspSaveReq implements Serializable {
}
public String getSpecialContent() {
return specialContent;
return this.specialContent;
}
public void setSpecialContent(String specialContent) {
......@@ -306,7 +306,7 @@ public class TspSaveReq implements Serializable {
}
public String getDeviceName() {
return deviceName;
return this.deviceName;
}
public void setDeviceName(String deviceName) {
......@@ -314,7 +314,7 @@ public class TspSaveReq implements Serializable {
}
public String getProductType() {
return productType;
return this.productType;
}
public void setProductType(String productType) {
......@@ -322,7 +322,7 @@ public class TspSaveReq implements Serializable {
}
public String getDeviceType() {
return deviceType;
return this.deviceType;
}
public void setDeviceType(String deviceType) {
......@@ -330,7 +330,7 @@ public class TspSaveReq implements Serializable {
}
public String getSn() {
return sn;
return this.sn;
}
public void setSn(String sn) {
......@@ -338,7 +338,7 @@ public class TspSaveReq implements Serializable {
}
public String getActiveDate() {
return activeDate;
return this.activeDate;
}
public void setActiveDate(String activeDate) {
......@@ -346,7 +346,7 @@ public class TspSaveReq implements Serializable {
}
public String getPlateNum() {
return plateNum;
return this.plateNum;
}
public void setPlateNum(String plateNum) {
......@@ -354,7 +354,7 @@ public class TspSaveReq implements Serializable {
}
public String getVehicleTypeName() {
return vehicleTypeName;
return this.vehicleTypeName;
}
public void setVehicleTypeName(String vehicleTypeName) {
......@@ -362,7 +362,7 @@ public class TspSaveReq implements Serializable {
}
public String getShopName() {
return shopName;
return this.shopName;
}
public void setShopName(String shopName) {
......@@ -370,7 +370,7 @@ public class TspSaveReq implements Serializable {
}
public String getFixTime() {
return fixTime;
return this.fixTime;
}
public void setFixTime(String fixTime) {
......
package com.glsx.ordercenter.dto.insurance;
package com.glsx.ordercenter.dto.req;
import java.io.Serializable;
import java.math.BigDecimal;
......@@ -62,7 +62,7 @@ public class TspUpdateReq implements Serializable {
private Long sumPremium;
public Long getSumPremium() {
return sumPremium;
return this.sumPremium;
}
public void setSumPremium(Long sumPremium) {
......@@ -70,7 +70,7 @@ public class TspUpdateReq implements Serializable {
}
public String getInsuranceCompany() {
return insuranceCompany;
return this.insuranceCompany;
}
public void setInsuranceCompany(String insuranceCompany) {
......@@ -78,7 +78,7 @@ public class TspUpdateReq implements Serializable {
}
public String getFullInsuranceNo() {
return fullInsuranceNo;
return this.fullInsuranceNo;
}
public void setFullInsuranceNo(String fullInsuranceNo) {
......@@ -86,7 +86,7 @@ public class TspUpdateReq implements Serializable {
}
public String getSeqNo() {
return seqNo;
return this.seqNo;
}
public void setSeqNo(String seqNo) {
......@@ -94,7 +94,7 @@ public class TspUpdateReq implements Serializable {
}
public String getCompensationName() {
return compensationName;
return this.compensationName;
}
public void setCompensationName(String compensationName) {
......@@ -102,7 +102,7 @@ public class TspUpdateReq implements Serializable {
}
public String getAddress() {
return address;
return this.address;
}
public void setAddress(String address) {
......@@ -110,7 +110,7 @@ public class TspUpdateReq implements Serializable {
}
public String getCustomerType() {
return customerType;
return this.customerType;
}
public void setCustomerType(String customerType) {
......@@ -118,7 +118,7 @@ public class TspUpdateReq implements Serializable {
}
public String getCardType() {
return cardType;
return this.cardType;
}
public void setCardType(String cardType) {
......@@ -126,7 +126,7 @@ public class TspUpdateReq implements Serializable {
}
public String getBirthday() {
return birthday;
return this.birthday;
}
public void setBirthday(String birthday) {
......@@ -134,7 +134,7 @@ public class TspUpdateReq implements Serializable {
}
public String getCardNo() {
return cardNo;
return this.cardNo;
}
public void setCardNo(String cardNo) {
......@@ -142,7 +142,7 @@ public class TspUpdateReq implements Serializable {
}
public String getName() {
return name;
return this.name;
}
public void setName(String name) {
......@@ -150,7 +150,7 @@ public class TspUpdateReq implements Serializable {
}
public String getSex() {
return sex;
return this.sex;
}
public void setSex(String sex) {
......@@ -158,7 +158,7 @@ public class TspUpdateReq implements Serializable {
}
public String getPhone() {
return phone;
return this.phone;
}
public void setPhone(String phone) {
......@@ -166,7 +166,7 @@ public class TspUpdateReq implements Serializable {
}
public String getEffectDate() {
return effectDate;
return this.effectDate;
}
public void setEffectDate(String effectDate) {
......@@ -174,7 +174,7 @@ public class TspUpdateReq implements Serializable {
}
public String getInsurePeriod() {
return insurePeriod;
return this.insurePeriod;
}
public void setInsurePeriod(String insurePeriod) {
......@@ -182,7 +182,7 @@ public class TspUpdateReq implements Serializable {
}
public String getInstallPoint() {
return installPoint;
return this.installPoint;
}
public void setInstallPoint(String installPoint) {
......@@ -190,7 +190,7 @@ public class TspUpdateReq implements Serializable {
}
public String getInstallPerson() {
return installPerson;
return this.installPerson;
}
public void setInstallPerson(String installPerson) {
......@@ -198,7 +198,7 @@ public class TspUpdateReq implements Serializable {
}
public String getSumAmount() {
return sumAmount;
return this.sumAmount;
}
public void setSumAmount(String sumAmount) {
......@@ -206,7 +206,7 @@ public class TspUpdateReq implements Serializable {
}
public String getSpid() {
return spid;
return this.spid;
}
public void setSpid(String spid) {
......@@ -214,7 +214,7 @@ public class TspUpdateReq implements Serializable {
}
public String getSpecialContent() {
return specialContent;
return this.specialContent;
}
public void setSpecialContent(String specialContent) {
......@@ -222,7 +222,7 @@ public class TspUpdateReq implements Serializable {
}
public String getStandNo() {
return standNo;
return this.standNo;
}
public void setStandNo(String standNo) {
......@@ -230,7 +230,7 @@ public class TspUpdateReq implements Serializable {
}
public String getPlateNum() {
return plateNum;
return this.plateNum;
}
public void setPlateNum(String plateNum) {
......@@ -238,7 +238,7 @@ public class TspUpdateReq implements Serializable {
}
public String getEngine() {
return engine;
return this.engine;
}
public void setEngine(String engine) {
......@@ -246,7 +246,7 @@ public class TspUpdateReq implements Serializable {
}
public String getBuyType() {
return buyType;
return this.buyType;
}
public void setBuyType(String buyType) {
......@@ -254,7 +254,7 @@ public class TspUpdateReq implements Serializable {
}
public String getVehicleColor() {
return vehicleColor;
return this.vehicleColor;
}
public void setVehicleColor(String vehicleColor) {
......@@ -262,7 +262,7 @@ public class TspUpdateReq implements Serializable {
}
public String getVehicleBrand() {
return vehicleBrand;
return this.vehicleBrand;
}
public void setVehicleBrand(String vehicleBrand) {
......@@ -270,7 +270,7 @@ public class TspUpdateReq implements Serializable {
}
public String getVehicleChildsBrandName() {
return vehicleChildsBrandName;
return this.vehicleChildsBrandName;
}
public void setVehicleChildsBrandName(String vehicleChildsBrandName) {
......@@ -278,7 +278,7 @@ public class TspUpdateReq implements Serializable {
}
public String getVehicleSeriesName() {
return vehicleSeriesName;
return this.vehicleSeriesName;
}
public void setVehicleSeriesName(String vehicleSeriesName) {
......@@ -286,7 +286,7 @@ public class TspUpdateReq implements Serializable {
}
public String getVehicleTypeName() {
return vehicleTypeName;
return this.vehicleTypeName;
}
public void setVehicleTypeName(String vehicleTypeName) {
......@@ -294,7 +294,7 @@ public class TspUpdateReq implements Serializable {
}
public BigDecimal getVehiclePrice() {
return vehiclePrice;
return this.vehiclePrice;
}
public void setVehiclePrice(BigDecimal vehiclePrice) {
......@@ -302,7 +302,7 @@ public class TspUpdateReq implements Serializable {
}
public String getVehicleUsage() {
return vehicleUsage;
return this.vehicleUsage;
}
public void setVehicleUsage(String vehicleUsage) {
......@@ -310,7 +310,7 @@ public class TspUpdateReq implements Serializable {
}
public String getShopName() {
return shopName;
return this.shopName;
}
public void setShopName(String shopName) {
......@@ -318,7 +318,7 @@ public class TspUpdateReq implements Serializable {
}
public String getFixTime() {
return fixTime;
return this.fixTime;
}
public void setFixTime(String fixTime) {
......
package com.glsx.ordercenter.dto.insurance;
package com.glsx.ordercenter.dto.resp;
import java.io.Serializable;
import com.glsx.excel.poi.annotation.ExcelColumn;
import com.glsx.excel.poi.annotation.ExcelExport;
/**
* <p>Description: 保单列表响应体
* <p>Description: 保单相关响应体
*
* <p>Project: car-service
*
......@@ -13,7 +13,7 @@ import com.glsx.excel.poi.annotation.ExcelExport;
* @date 2020-05-22
*/
@ExcelExport
public class InsuranceQueryResp implements Serializable {
public class InsuranceResp implements Serializable {
/**
* ID
*/
......@@ -112,6 +112,22 @@ public class InsuranceQueryResp implements Serializable {
*/
@ExcelColumn(value = "备注", index = 17)
private String responseData;
/**
* 客户类型
*/
private Byte customerType;
/**
* 联系地址
*/
private String vehicleOwnerAddress;
/**
* 车辆颜色
*/
private String vehicleColor;
/**
* PDF地址
*/
private String insurancePdf;
public Integer getId() {
return this.id;
......@@ -273,9 +289,41 @@ public class InsuranceQueryResp implements Serializable {
this.responseData = responseData;
}
public Byte getCustomerType() {
return this.customerType;
}
public void setCustomerType(Byte customerType) {
this.customerType = customerType;
}
public String getVehicleOwnerAddress() {
return this.vehicleOwnerAddress;
}
public void setVehicleOwnerAddress(String vehicleOwnerAddress) {
this.vehicleOwnerAddress = vehicleOwnerAddress;
}
public String getVehicleColor() {
return this.vehicleColor;
}
public void setVehicleColor(String vehicleColor) {
this.vehicleColor = vehicleColor;
}
public String getInsurancePdf() {
return this.insurancePdf;
}
public void setInsurancePdf(String insurancePdf) {
this.insurancePdf = insurancePdf;
}
@Override
public String toString() {
return "InsuranceQueryResp{" +
return "InsuranceResp{" +
"id=" + this.id +
", insuranceId='" + this.insuranceId + '\'' +
", vehicleOwnerName='" + this.vehicleOwnerName + '\'' +
......@@ -296,6 +344,10 @@ public class InsuranceQueryResp implements Serializable {
", vehicleInvoiceMoney='" + this.vehicleInvoiceMoney + '\'' +
", tastingUnit='" + this.tastingUnit + '\'' +
", responseData='" + this.responseData + '\'' +
", customerType=" + this.customerType +
", vehicleOwnerAddress='" + this.vehicleOwnerAddress + '\'' +
", vehicleColor='" + this.vehicleColor + '\'' +
", insurancePdf='" + this.insurancePdf + '\'' +
'}';
}
}
package com.glsx.ordercenter.dto.resp;
import com.glsx.ordercenter.constants.ResultCodeEnum;
import java.io.Serializable;
import com.glsx.ordercenter.constants.ResultCodeEnum;
/**
* @author think.wang
......@@ -26,6 +25,8 @@ public class OraResultObject implements Serializable {
private String insuranceId; //保单id
public OraResultObject() {
this.code = ResultCodeEnum.SUCCESS.getCode();
this.message = ResultCodeEnum.SUCCESS.getMsg();
}
/**
......@@ -85,8 +86,12 @@ public class OraResultObject implements Serializable {
return this;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
public int getCode() {
return code;
return this.code;
}
public void setCode(int code) {
......@@ -94,7 +99,7 @@ public class OraResultObject implements Serializable {
}
public String getMessage() {
return message;
return this.message;
}
public void setMessage(String message) {
......@@ -102,7 +107,7 @@ public class OraResultObject implements Serializable {
}
public Object getData() {
return data;
return this.data;
}
public void setData(Object data) {
......@@ -110,17 +115,29 @@ public class OraResultObject implements Serializable {
}
public String getOrderId() {
return orderId;
return this.orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getInsuranceId() {
return this.insuranceId;
}
public void setInsuranceId(String insuranceId) {
this.insuranceId = insuranceId;
}
@Override
public String toString() {
return "ResultObject [code=" + code + ", message=" + message
+ ", data=" + data + ", orderId=" + orderId + ", insuranceId=" + insuranceId+ "]";
return "OraResultObject{" +
"code=" + this.code +
", message='" + this.message + '\'' +
", data=" + this.data +
", orderId='" + this.orderId + '\'' +
", insuranceId='" + this.insuranceId + '\'' +
'}';
}
}
package com.glsx.ordercenter.exception.insurance;
import com.alibaba.fastjson.JSON;
import com.glsx.ordercenter.constants.insurance.OraResultCode;
/**
* <p>Description: 长城欧拉业务异常
*
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-27
*/
public class OraBizException extends RuntimeException {
private OraResultCode code;
private Object[] params;
public OraBizException(Throwable cause) {
super(cause);
}
public OraBizException(OraResultCode code) {
super(code.getMessage());
this.code = code;
}
public OraBizException(OraResultCode code, Object... params) {
this(code);
this.params = params;
}
@Override
public String getMessage() {
String message;
message = (this.code == null) ? super.getMessage() : this.buildMessage();
return message;
}
public OraResultCode getCode() {
return this.code;
}
public void setCode(OraResultCode code) {
this.code = code;
}
private String buildMessage() {
StringBuilder messageSb = new StringBuilder();
String message;
if (this.code != null) {
messageSb.append(this.code.getMessage());
}
if (this.params != null) {
messageSb.append(":");
for (Object param : this.params) {
String messagePart = (param instanceof String)
? (String) param : JSON.toJSONString(param);
messageSb.append(messagePart).append(";");
}
}
message = messageSb.toString();
return message.replaceAll(";$", "");
}
}
package com.glsx.ordercenter.mapper.insurance;
import java.util.List;
import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy;
import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicyExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* <p>Description:
......@@ -12,9 +11,9 @@ import org.springframework.stereotype.Repository;
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-25
* @date 2020-05-29
*/
@Repository
public interface SysInsurancePolicyMapper {
long countByExample(SysInsurancePolicyExample example);
......
......@@ -9,9 +9,10 @@ import java.util.Date;
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-25
* @date 2020-05-29
*/
/**
* 保单信息表
*/
......@@ -32,7 +33,7 @@ public class SysInsurancePolicy {
private Byte source;
/**
* 保险状态(1待投保 2已投保 9已退保)
* 保险状态(1待投保 2已投保 3投保失败 9已退保)
*/
private Byte status;
......@@ -147,6 +148,11 @@ public class SysInsurancePolicy {
private String tastingUnit;
/**
* 退保原因
*/
private String cancelReason;
/**
* 备注
*/
private String remark;
......@@ -399,6 +405,14 @@ public class SysInsurancePolicy {
this.tastingUnit = tastingUnit;
}
public String getCancelReason() {
return this.cancelReason;
}
public void setCancelReason(String cancelReason) {
this.cancelReason = cancelReason;
}
public String getRemark() {
return this.remark;
}
......@@ -500,6 +514,7 @@ public class SysInsurancePolicy {
", vehicleColor='" + this.vehicleColor + '\'' +
", vehicleInvoiceMoney=" + this.vehicleInvoiceMoney +
", tastingUnit='" + this.tastingUnit + '\'' +
", cancelReason='" + this.cancelReason + '\'' +
", remark='" + this.remark + '\'' +
", expectedEffectiveTime=" + this.expectedEffectiveTime +
", realEffectiveTime=" + this.realEffectiveTime +
......
......@@ -11,7 +11,7 @@ import java.util.List;
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-25
* @date 2020-05-29
*/
public class SysInsurancePolicyExample {
......@@ -1825,6 +1825,76 @@ public class SysInsurancePolicyExample {
return (Criteria) this;
}
public Criteria andCancelReasonIsNull() {
this.addCriterion("cancel_reason is null");
return (Criteria) this;
}
public Criteria andCancelReasonIsNotNull() {
this.addCriterion("cancel_reason is not null");
return (Criteria) this;
}
public Criteria andCancelReasonEqualTo(String value) {
this.addCriterion("cancel_reason =", value, "cancelReason");
return (Criteria) this;
}
public Criteria andCancelReasonNotEqualTo(String value) {
this.addCriterion("cancel_reason <>", value, "cancelReason");
return (Criteria) this;
}
public Criteria andCancelReasonGreaterThan(String value) {
this.addCriterion("cancel_reason >", value, "cancelReason");
return (Criteria) this;
}
public Criteria andCancelReasonGreaterThanOrEqualTo(String value) {
this.addCriterion("cancel_reason >=", value, "cancelReason");
return (Criteria) this;
}
public Criteria andCancelReasonLessThan(String value) {
this.addCriterion("cancel_reason <", value, "cancelReason");
return (Criteria) this;
}
public Criteria andCancelReasonLessThanOrEqualTo(String value) {
this.addCriterion("cancel_reason <=", value, "cancelReason");
return (Criteria) this;
}
public Criteria andCancelReasonLike(String value) {
this.addCriterion("cancel_reason like", value, "cancelReason");
return (Criteria) this;
}
public Criteria andCancelReasonNotLike(String value) {
this.addCriterion("cancel_reason not like", value, "cancelReason");
return (Criteria) this;
}
public Criteria andCancelReasonIn(List<String> values) {
this.addCriterion("cancel_reason in", values, "cancelReason");
return (Criteria) this;
}
public Criteria andCancelReasonNotIn(List<String> values) {
this.addCriterion("cancel_reason not in", values, "cancelReason");
return (Criteria) this;
}
public Criteria andCancelReasonBetween(String value1, String value2) {
this.addCriterion("cancel_reason between", value1, value2, "cancelReason");
return (Criteria) this;
}
public Criteria andCancelReasonNotBetween(String value1, String value2) {
this.addCriterion("cancel_reason not between", value1, value2, "cancelReason");
return (Criteria) this;
}
public Criteria andRemarkIsNull() {
this.addCriterion("remark is null");
return (Criteria) this;
......
package com.glsx.ordercenter.service.insurance;
package com.glsx.ordercenter.service;
import com.glsx.ordercenter.dto.common.PagedOrderResponse;
import com.glsx.ordercenter.dto.insurance.InsuranceDetailReq;
import com.glsx.ordercenter.dto.insurance.InsuranceDetailResp;
import com.glsx.ordercenter.dto.insurance.InsuranceQueryReq;
import com.glsx.ordercenter.dto.insurance.InsuranceQueryResp;
import com.glsx.ordercenter.dto.insurance.InsuranceRefundReq;
import com.glsx.ordercenter.dto.insurance.InsuranceRefundResp;
import com.glsx.common.pojo.PagedResp;
import com.glsx.ordercenter.dto.req.InsuranceReq;
import com.glsx.ordercenter.dto.resp.InsuranceResp;
/**
* <p>Description: 保单列表查询
......@@ -20,32 +16,32 @@ public interface InsuranceService {
/**
* 保单列表查询
*
* @param insuranceQueryReq 请求体
* @param insuranceReq 请求体
* @return 分页后的列表数据
*/
PagedOrderResponse<InsuranceQueryResp> query(InsuranceQueryReq insuranceQueryReq);
PagedResp<InsuranceResp> query(InsuranceReq insuranceReq);
/**
* 保单详情查询
*
* @param insuranceDetailReq 请求体
* @param insuranceReq 请求体
* @return 分页后的详情数据
*/
PagedOrderResponse<InsuranceDetailResp> detail(InsuranceDetailReq insuranceDetailReq);
PagedResp<InsuranceResp> detail(InsuranceReq insuranceReq);
/**
* 保单下载
*
* @param insuranceDetailReq 请求体
* @param insuranceReq 请求体
* @return 保单详情,包含保单PDF地址
*/
InsuranceDetailResp download(InsuranceDetailReq insuranceDetailReq);
InsuranceResp download(InsuranceReq insuranceReq);
/**
* 退保
*
* @param insuranceRefundReq 请求体
* @param insuranceReq 请求体
* @return 退保结果
*/
InsuranceRefundResp refund(InsuranceRefundReq insuranceRefundReq);
InsuranceResp refund(InsuranceReq insuranceReq);
}
package com.glsx.ordercenter.service.api;
import com.glsx.ordercenter.dto.api.OraInsuranceRefundReq;
import com.glsx.ordercenter.dto.api.OraInsuranceRefundResp;
import com.glsx.ordercenter.dto.api.OraInsuranceUpdateReq;
import com.glsx.ordercenter.dto.api.OraInsuranceUpdateResp;
import com.glsx.ordercenter.dto.req.OraInsuranceRefundReq;
import com.glsx.ordercenter.dto.req.OraInsuranceUpdateReq;
import com.glsx.ordercenter.dto.resp.OraResultObject;
/**
* <p>Description:
......@@ -20,7 +19,7 @@ public interface OraInsuranceService {
* @param insuranceUpdateReq 请求体
* @return 更新结果
*/
OraInsuranceUpdateResp update(OraInsuranceUpdateReq insuranceUpdateReq);
OraResultObject update(OraInsuranceUpdateReq insuranceUpdateReq);
/**
* 长城欧拉-退保
......@@ -28,5 +27,5 @@ public interface OraInsuranceService {
* @param insuranceRefundReq 请求体
* @return 退保结果
*/
OraInsuranceRefundResp refund(OraInsuranceRefundReq insuranceRefundReq);
OraResultObject refund(OraInsuranceRefundReq insuranceRefundReq);
}
package com.glsx.ordercenter.service.api.impl;
import java.util.Date;
import java.util.List;
import com.glsx.common.utils.UserUtils;
import com.glsx.ordercenter.config.ThreadPoolConfig;
import com.glsx.ordercenter.constants.insurance.InsuranceCardType;
import com.glsx.ordercenter.constants.insurance.InsuranceCustomerType;
import com.glsx.ordercenter.constants.insurance.InsuranceStatus;
import com.glsx.ordercenter.constants.insurance.OraResultCode;
import com.glsx.ordercenter.dto.api.OraInsuranceRefundReq;
import com.glsx.ordercenter.dto.api.OraInsuranceRefundResp;
import com.glsx.ordercenter.dto.api.OraInsuranceUpdateReq;
import com.glsx.ordercenter.dto.api.OraInsuranceUpdateResp;
import com.glsx.ordercenter.exception.insurance.OraBizException;
import com.glsx.ordercenter.dto.req.OraInsuranceRefundReq;
import com.glsx.ordercenter.dto.req.OraInsuranceUpdateReq;
import com.glsx.ordercenter.dto.resp.OraResultObject;
import com.glsx.ordercenter.exception.SysException;
import com.glsx.ordercenter.mapper.insurance.SysInsurancePolicyMapper;
import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy;
import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicyExample;
import com.glsx.ordercenter.service.BaseOrderService;
import com.glsx.ordercenter.service.api.OraInsuranceService;
import com.glsx.ordercenter.service.common.BaseOrderService;
import com.glsx.ordercenter.utils.EmilUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -24,9 +25,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.Date;
import java.util.List;
/**
* <p>Description:
*
......@@ -36,8 +34,7 @@ import java.util.List;
* @date 2020-05-25
*/
@Service
public class OraInsuranceServiceImpl extends BaseOrderService
implements OraInsuranceService {
public class OraInsuranceServiceImpl extends BaseOrderService implements OraInsuranceService {
@Autowired
private ThreadPoolConfig taskExecutor;
......@@ -48,40 +45,38 @@ public class OraInsuranceServiceImpl extends BaseOrderService
private SysInsurancePolicyMapper insurancePolicyMapper;
@Override
public OraInsuranceUpdateResp update(OraInsuranceUpdateReq insuranceUpdateReq) {
super.logInfo("长城欧拉修改保单-参数", insuranceUpdateReq);
public OraResultObject update(OraInsuranceUpdateReq updateReq) {
super.logInfo("长城欧拉修改保单-参数", updateReq);
OraInsuranceUpdateResp insuranceUpdateResp;
OraResultObject result;
SysInsurancePolicy insurancePolicy = this.getInsurancePolicy(
insuranceUpdateReq.getInsuranceId());
String title = this.buildUpdateMailTitle(insuranceUpdateReq);
String content = this.buildUpdateMailContent(insuranceUpdateReq, insurancePolicy);
SysInsurancePolicy insurancePolicy = this.getInsurancePolicy(updateReq.getInsuranceId());
String title = this.buildUpdateMailTitle(updateReq);
String content = this.buildUpdateMailContent(updateReq, insurancePolicy);
this.sendMail(title, content);
insuranceUpdateResp = this.getUpdateResult(insurancePolicy);
result = this.getUpdateResult(insurancePolicy);
super.logInfo("长城欧拉修改保单-结果", insuranceUpdateResp);
super.logInfo("长城欧拉修改保单-结果", result);
return insuranceUpdateResp;
return result;
}
@Override
public OraInsuranceRefundResp refund(OraInsuranceRefundReq insuranceRefundReq) {
super.logInfo("长城欧拉退保-参数", insuranceRefundReq);
public OraResultObject refund(OraInsuranceRefundReq refundReq) {
super.logInfo("长城欧拉退保-参数", refundReq);
OraInsuranceRefundResp insuranceRefundResp;
OraResultObject result;
SysInsurancePolicy insurancePolicy = this.getInsurancePolicy(
insuranceRefundReq.getInsuranceId());
String title = this.buildRefundMailTitle(insuranceRefundReq);
String content = this.buildRefundMailContent(insuranceRefundReq, insurancePolicy);
SysInsurancePolicy insurancePolicy = this.getInsurancePolicy(refundReq.getInsuranceId());
String title = this.buildRefundMailTitle(refundReq);
String content = this.buildRefundMailContent(refundReq, insurancePolicy);
this.sendMail(title, content);
this.updateInsurancePolicy(insurancePolicy);
insuranceRefundResp = this.getRefundResult(insurancePolicy);
result = this.getRefundResult(insurancePolicy);
this.logInfo("长城欧拉退保-结果", insuranceRefundResp);
this.logInfo("长城欧拉退保-结果", result);
return insuranceRefundResp;
return result;
}
private SysInsurancePolicy getInsurancePolicy(String insuranceId) {
......@@ -93,7 +88,7 @@ public class OraInsuranceServiceImpl extends BaseOrderService
this.insurancePolicyMapper.selectByExample(example);
if (insurancePolicyList.isEmpty()) {
throw new OraBizException(OraResultCode.PARAM_ERROR, "保单不存在");
throw SysException.create(OraResultCode.PARAM_ERROR.getCode(), "保单不存在");
}
return insurancePolicyList.get(0);
......@@ -190,15 +185,15 @@ public class OraInsuranceServiceImpl extends BaseOrderService
return content;
}
private String buildRefundMailTitle(OraInsuranceRefundReq insuranceRefundReq) {
private String buildRefundMailTitle(OraInsuranceRefundReq refundReq) {
String title;
title = "包活干保单退保申请:" + insuranceRefundReq.getInsuranceId();
title = "包活干保单退保申请:" + refundReq.getInsuranceId();
return title;
}
private String buildRefundMailContent(OraInsuranceRefundReq insuranceRefundReq,
private String buildRefundMailContent(OraInsuranceRefundReq refundReq,
SysInsurancePolicy insurancePolicy) {
String content = "<table>" +
......@@ -238,7 +233,7 @@ public class OraInsuranceServiceImpl extends BaseOrderService
}
private void sendMail(String title, String content) {
taskExecutor.defaultThreadPool().execute(() -> {
this.taskExecutor.defaultThreadPool().execute(() -> {
try {
EmilUtils.sendEmail(this.mailUserName, title, content);
} catch (Exception e) {
......@@ -247,12 +242,12 @@ public class OraInsuranceServiceImpl extends BaseOrderService
});
}
private OraInsuranceUpdateResp getUpdateResult(SysInsurancePolicy insurancePolicy) {
OraInsuranceUpdateResp insuranceUpdateResp = new OraInsuranceUpdateResp();
private OraResultObject getUpdateResult(SysInsurancePolicy insurancePolicy) {
OraResultObject result = new OraResultObject();
insuranceUpdateResp.setInsuranceId(insurancePolicy.getInsuranceId());
result.setInsuranceId(insurancePolicy.getInsuranceId());
return insuranceUpdateResp;
return result;
}
@Transactional(rollbackFor = Exception.class)
......@@ -270,9 +265,11 @@ public class OraInsuranceServiceImpl extends BaseOrderService
return this.insurancePolicyMapper.updateByPrimaryKeySelective(insurancePolicy);
}
public OraInsuranceRefundResp getRefundResult(SysInsurancePolicy insurancePolicy) {
OraInsuranceRefundResp insuranceRefundResp = new OraInsuranceRefundResp();
insuranceRefundResp.setInsuranceId(insurancePolicy.getInsuranceId());
return insuranceRefundResp;
public OraResultObject getRefundResult(SysInsurancePolicy insurancePolicy) {
OraResultObject result = new OraResultObject();
result.setInsuranceId(insurancePolicy.getInsuranceId());
return result;
}
}
package com.glsx.ordercenter.thread;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Semaphore;
import com.alibaba.fastjson.JSON;
import com.glsx.common.utils.DateUtil;
import com.glsx.common.utils.PropertiesUtil;
import com.glsx.gps.utils.HttpUtil;
import com.glsx.ordercenter.dto.insurance.TspResp;
import com.glsx.ordercenter.dto.insurance.TspRespData;
import com.glsx.ordercenter.dto.resp.TspResp;
import com.glsx.ordercenter.dto.resp.TspRespData;
import com.glsx.ordercenter.mapper.insurance.SysInsurancePolicyMapper;
import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy;
import com.glsx.ordercenter.utils.TspSignUtil;
......@@ -13,11 +17,6 @@ import org.apache.http.entity.ContentType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Semaphore;
/**
* @author think.wang
* @version 1.0.0
......@@ -46,7 +45,7 @@ public class TspGetInsurancePdfTask implements Runnable{
@Override
public void run() {
try {
semaphore.acquire();
this.semaphore.acquire();
//系统参数获取
String insuranceUrl = PropertiesUtil.getProperty("insurance.picc.url");
String method = PropertiesUtil.getProperty("insurance.picc.pdf"); //调用获取pdf方法
......@@ -56,9 +55,9 @@ public class TspGetInsurancePdfTask implements Runnable{
String format = PropertiesUtil.getProperty("insurance.picc.format");
String source = PropertiesUtil.getProperty("insurance.picc.source");
SysInsurancePolicy insurancePolicy = policyMapper.selectByPrimaryKey(id);
SysInsurancePolicy insurancePolicy = this.policyMapper.selectByPrimaryKey(this.id);
if(insurancePolicy == null){
logger.error("通过id={}未找到保单数据", id);
this.logger.error("通过id={}未找到保单数据", this.id);
return;
}
//业务参数封装
......@@ -66,7 +65,7 @@ public class TspGetInsurancePdfTask implements Runnable{
map.put("insuranceCompany", insurancePolicy.getInsuranceCompany());
map.put("fullInsuranceNo", insurancePolicy.getInsuranceNo());
map.put("seqNo", insurancePolicy.getInsuranceSeqNo());
logger.info("获取pdf签名参数值为:{}", map);
this.logger.info("获取pdf签名参数值为:{}", map);
//系统参数封装
map.put("method", method);
......@@ -80,31 +79,31 @@ public class TspGetInsurancePdfTask implements Runnable{
//发送请求
String result = null;
int tryCount = TRY_COUNT;
int tryCount = this.TRY_COUNT;
while (tryCount-- > 0) {
try {
result = HttpUtil.postData(insuranceUrl, JSON.toJSONString(map), ContentType.APPLICATION_JSON);
break;
} catch (Exception e) {
Thread.sleep(TRY_WAIT_TIME);
Thread.sleep(this.TRY_WAIT_TIME);
continue;
}
}
logger.info("保单号:{}获取pdf信息响应数据:{}", map.get("fullInsuranceNo"), result);
this.logger.info("保单号:{}获取pdf信息响应数据:{}", map.get("fullInsuranceNo"), result);
TspResp tspResp = JSON.parseObject(result, TspResp.class);
if(tspResp != null && "0".equals(tspResp.getCode())){ //请求成功
SysInsurancePolicy policy = new SysInsurancePolicy();
policy.setId(id);
policy.setId(this.id);
TspRespData respData = tspResp.getData();
policy.setInsurancePdf(respData.getObj()); //得到pdf路径
policyMapper.updateByPrimaryKeySelective(policy); //保存返回数据
this.policyMapper.updateByPrimaryKeySelective(policy); //保存返回数据
}else{
logger.error("获取保单pdf失败,保单号为:{}", map.get("fullInsuranceNo"));
this.logger.error("获取保单pdf失败,保单号为:{}", map.get("fullInsuranceNo"));
}
} catch (Exception e) {
logger.error("调用TSP获取pdf接口异常:{}", e);
this.logger.error("调用TSP获取pdf接口异常:{}", e);
}finally {
semaphore.release();
this.semaphore.release();
}
}
......
package com.glsx.ordercenter.thread;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Semaphore;
import com.alibaba.fastjson.JSON;
import com.glsx.common.utils.DateUtil;
import com.glsx.common.utils.PropertiesUtil;
......@@ -9,9 +13,9 @@ import com.glsx.ordercenter.constants.insurance.InsuranceCardType;
import com.glsx.ordercenter.constants.insurance.InsuranceCompany;
import com.glsx.ordercenter.constants.insurance.InsuranceCustomerType;
import com.glsx.ordercenter.constants.insurance.InsuranceStatus;
import com.glsx.ordercenter.dto.insurance.TspResp;
import com.glsx.ordercenter.dto.insurance.TspRespData;
import com.glsx.ordercenter.dto.insurance.TspSaveReq;
import com.glsx.ordercenter.dto.req.TspSaveReq;
import com.glsx.ordercenter.dto.resp.TspResp;
import com.glsx.ordercenter.dto.resp.TspRespData;
import com.glsx.ordercenter.mapper.insurance.SysInsurancePolicyMapper;
import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy;
import com.glsx.ordercenter.utils.ObjectUtils;
......@@ -20,11 +24,6 @@ import org.apache.http.entity.ContentType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Semaphore;
/**
* @author think.wang
* @version 1.0.0
......@@ -53,7 +52,7 @@ public class TspSaveInsuranceDataTask implements Runnable{
@Override
public void run() {
try {
semaphore.acquire();
this.semaphore.acquire();
//系统参数获取
String insuranceUrl = PropertiesUtil.getProperty("insurance.picc.url");
String method = PropertiesUtil.getProperty("insurance.picc.save"); //调用投保方法
......@@ -66,7 +65,7 @@ public class TspSaveInsuranceDataTask implements Runnable{
//业务参数封装
TspSaveReq saveData = this.setSendData(this.data);
//对象转map进行签名
logger.info("投保签名的对象为:{}", JSON.toJSONString(saveData));
this.logger.info("投保签名的对象为:{}", JSON.toJSONString(saveData));
Map<String, String> map = ObjectUtils.objectToMap(saveData);
//系统参数封装
......@@ -81,17 +80,17 @@ public class TspSaveInsuranceDataTask implements Runnable{
//发送请求
String result = null;
int tryCount = TRY_COUNT;
int tryCount = this.TRY_COUNT;
while (tryCount-- > 0) {
try {
result = HttpUtil.postData(insuranceUrl, JSON.toJSONString(map), ContentType.APPLICATION_JSON);
break;
} catch (Exception e) {
Thread.sleep(TRY_WAIT_TIME);
Thread.sleep(this.TRY_WAIT_TIME);
continue;
}
}
logger.info("车架号:{}投保响应数据:{}", map.get("standNo"), result);
this.logger.info("车架号:{}投保响应数据:{}", map.get("standNo"), result);
SysInsurancePolicy policy = new SysInsurancePolicy();
policy.setId(this.data.getId());
TspResp tspResp = JSON.parseObject(result, TspResp.class);
......@@ -103,11 +102,11 @@ public class TspSaveInsuranceDataTask implements Runnable{
}else{
policy.setStatus(InsuranceStatus.APPLY_FAILED.getStatus().byteValue()); //更新状态投保失败
}
policyMapper.updateByPrimaryKeySelective(policy); //保存返回数据
this.policyMapper.updateByPrimaryKeySelective(policy); //保存返回数据
} catch (Exception e) {
logger.error("调用TSP投保接口异常:{}", e);
this.logger.error("调用TSP投保接口异常:{}", e);
}finally {
semaphore.release();
this.semaphore.release();
}
}
......
package com.glsx.ordercenter.thread;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.Semaphore;
import com.alibaba.fastjson.JSON;
import com.glsx.common.utils.DateUtil;
import com.glsx.common.utils.PropertiesUtil;
......@@ -7,8 +10,8 @@ import com.glsx.common.utils.StringUtils;
import com.glsx.gps.utils.HttpUtil;
import com.glsx.ordercenter.constants.insurance.InsuranceCompany;
import com.glsx.ordercenter.constants.insurance.InsuranceCustomerType;
import com.glsx.ordercenter.dto.insurance.TspResp;
import com.glsx.ordercenter.dto.insurance.TspUpdateReq;
import com.glsx.ordercenter.dto.req.TspUpdateReq;
import com.glsx.ordercenter.dto.resp.TspResp;
import com.glsx.ordercenter.mapper.insurance.SysInsurancePolicyMapper;
import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy;
import com.glsx.ordercenter.utils.ObjectUtils;
......@@ -17,10 +20,6 @@ import org.apache.http.entity.ContentType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.Semaphore;
/**
* @author think.wang
* @version 1.0.0
......@@ -49,7 +48,7 @@ public class TspUpdateInsuranceDataTask implements Runnable{
@Override
public void run() {
try {
semaphore.acquire();
this.semaphore.acquire();
//系统参数获取
String insuranceUrl = PropertiesUtil.getProperty("insurance.picc.url");
String method = PropertiesUtil.getProperty("insurance.picc.update"); //修改保单方法
......@@ -59,15 +58,15 @@ public class TspUpdateInsuranceDataTask implements Runnable{
String format = PropertiesUtil.getProperty("insurance.picc.format");
String source = PropertiesUtil.getProperty("insurance.picc.source");
SysInsurancePolicy insurancePolicy = policyMapper.selectByPrimaryKey(id);
SysInsurancePolicy insurancePolicy = this.policyMapper.selectByPrimaryKey(this.id);
if(insurancePolicy == null){
logger.error("通过id={}未找到保单数据", id);
this.logger.error("通过id={}未找到保单数据", this.id);
return;
}
//业务参数封装
TspUpdateReq updateData = this.setSendData(insurancePolicy);
//对象转map进行签名
logger.info("修改保单签名的对象为:{}", JSON.toJSONString(updateData));
this.logger.info("修改保单签名的对象为:{}", JSON.toJSONString(updateData));
Map<String, String> map = ObjectUtils.objectToMap(updateData);
//系统参数封装
......@@ -82,27 +81,27 @@ public class TspUpdateInsuranceDataTask implements Runnable{
//发送请求
String result = null;
int tryCount = TRY_COUNT;
int tryCount = this.TRY_COUNT;
while (tryCount-- > 0) {
try {
result = HttpUtil.postData(insuranceUrl, JSON.toJSONString(map), ContentType.APPLICATION_JSON);
break;
} catch (Exception e) {
Thread.sleep(TRY_WAIT_TIME);
Thread.sleep(this.TRY_WAIT_TIME);
continue;
}
}
logger.info("保单号:{}修改投保响应数据:{}", map.get("fullInsuranceNo"), result);
this.logger.info("保单号:{}修改投保响应数据:{}", map.get("fullInsuranceNo"), result);
TspResp tspResp = JSON.parseObject(result, TspResp.class);
if(tspResp != null && "0".equals(tspResp.getCode())){ //请求成功
logger.info("修改保单数据成功,保单号为:{}", map.get("fullInsuranceNo"));
this.logger.info("修改保单数据成功,保单号为:{}", map.get("fullInsuranceNo"));
}else{
logger.error("修改保单数据失败,保单号为:{}", map.get("fullInsuranceNo"));
this.logger.error("修改保单数据失败,保单号为:{}", map.get("fullInsuranceNo"));
}
} catch (Exception e) {
logger.error("调用TSP投保接口异常:{}", e);
this.logger.error("调用TSP投保接口异常:{}", e);
}finally {
semaphore.release();
this.semaphore.release();
}
}
......
package com.glsx.ordercenter.utils;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.glsx.ordercenter.constants.insurance.OraConstants;
import com.glsx.ordercenter.constants.insurance.OraResultCode;
import com.glsx.ordercenter.exception.insurance.OraBizException;
import com.glsx.ordercenter.exception.SysException;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.util.*;
/**
* @author think.wang
* @version 1.0.0
......@@ -60,7 +63,7 @@ public class OraSignUtil {
/**
* <p>获取HTTp请求体和请求参数进行验签</p>
* <p>验签失败则抛出 {@link OraBizException} 异常</p>
* <p>验签失败则抛出 {@link SysException} 异常</p>
*
* @param secret 密钥
* @param requestBody 请求体
......@@ -76,7 +79,8 @@ public class OraSignUtil {
Map<String, String> verifyParamMap = buildVerifyParamMap(paramMap, requestBody);
if (!verifyParamMap.containsKey(OraConstants.APP_KEY)) {
throw new OraBizException(OraResultCode.AK_NOT_FOUND);
throw SysException.create(OraResultCode.AK_NOT_FOUND.getCode(),
OraResultCode.AK_NOT_FOUND.getMessage());
}
String storedAppKey = verifyParamMap.get(OraConstants.APP_KEY);
......@@ -85,11 +89,13 @@ public class OraSignUtil {
String signStr = sign(verifyParamMap, null, secret);
if (!appKey.equals(storedAppKey)) {
throw new OraBizException(OraResultCode.AK_INVALID);
throw SysException.create(OraResultCode.AK_INVALID.getCode(),
OraResultCode.AK_INVALID.getMessage());
}
if (!signStr.equals(storedSignStr)) {
throw new OraBizException(OraResultCode.PARAM_ERROR);
throw SysException.create(OraResultCode.PARAM_ERROR.getCode(),
OraResultCode.PARAM_ERROR.getMessage());
}
}
}
......
package com.glsx.ordercenter.utils.insurance;
package com.glsx.ordercenter.utils;
import java.util.Date;
import java.util.HashMap;
......@@ -7,9 +7,8 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.glsx.common.utils.DateUtil;
import com.glsx.ordercenter.constants.insurance.TspConstants;
import com.glsx.ordercenter.dto.insurance.TspRefundReq;
import com.glsx.ordercenter.dto.insurance.TspResp;
import com.glsx.ordercenter.utils.UrlUtils;
import com.glsx.ordercenter.dto.req.TspRefundReq;
import com.glsx.ordercenter.dto.resp.TspResp;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
......
package com.glsx.ordercenter.utils.insurance;
package com.glsx.ordercenter.utils;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
......
......@@ -31,6 +31,7 @@
<result column="vehicle_color" jdbcType="VARCHAR" property="vehicleColor"/>
<result column="vehicle_invoice_money" jdbcType="DECIMAL" property="vehicleInvoiceMoney"/>
<result column="tasting_unit" jdbcType="VARCHAR" property="tastingUnit"/>
<result column="cancel_reason" jdbcType="VARCHAR" property="cancelReason"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="expected_effective_time" jdbcType="TIMESTAMP"
property="expectedEffectiveTime"/>
......@@ -109,19 +110,19 @@
<sql id="Base_Column_List">
<!--@mbg.generated-->
sys_insurance_policy.id id, insurance_id, `source`, `status`, insurance_no,
insurance_seq_no,
insurance_company,
insurance_seq_no, insurance_company,
gps_no, installation_time, vin, vehicle_no, engine_number, car_brand, vehicle_type,
vehicle_owner_name, phone, vehicle_owner_address, customer_type, id_card_type, id_card_num,
insurance_commodity, pilfer_insurance_money, insurance_period, vehicle_color,
vehicle_invoice_money,
tasting_unit, remark, expected_effective_time, real_effective_time, insurance_pdf,
create_time, update_time, create_by, update_by,
tasting_unit, cancel_reason, remark, expected_effective_time, real_effective_time,
insurance_pdf, create_time, update_time, create_by, update_by,
sys_insurance_data.response_data response_data
</sql>
<sql id="joinClause">
JOIN sys_insurance_data ON sys_insurance_policy.id = sys_insurance_data.policy_id
JOIN sys_insurance_data
ON sys_insurance_policy.id = sys_insurance_data.policy_id
</sql>
<select id="selectCount"
......@@ -167,13 +168,15 @@
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from sys_insurance_policy
delete
from sys_insurance_policy
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample"
parameterType="com.glsx.ordercenter.pojo.insurance.SysInsurancePolicyExample">
<!--@mbg.generated-->
delete from sys_insurance_policy
delete
from sys_insurance_policy
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
......@@ -190,15 +193,16 @@
vehicle_owner_address, customer_type, id_card_type,
id_card_num, insurance_commodity, pilfer_insurance_money,
insurance_period, vehicle_color, vehicle_invoice_money,
tasting_unit, remark, expected_effective_time,
real_effective_time, insurance_pdf, create_time,
update_time, create_by, update_by
)
tasting_unit, cancel_reason, remark,
expected_effective_time, real_effective_time,
insurance_pdf, create_time, update_time,
create_by, update_by)
values (#{insuranceId,jdbcType=VARCHAR}, #{source,jdbcType=TINYINT},
#{status,jdbcType=TINYINT},
#{insuranceNo,jdbcType=VARCHAR}, #{insuranceSeqNo,jdbcType=VARCHAR},
#{insuranceCompany,jdbcType=VARCHAR},
#{gpsNo,jdbcType=VARCHAR}, #{installationTime,jdbcType=TIMESTAMP}, #{vin,jdbcType=VARCHAR},
#{gpsNo,jdbcType=VARCHAR}, #{installationTime,jdbcType=TIMESTAMP},
#{vin,jdbcType=VARCHAR},
#{vehicleNo,jdbcType=VARCHAR}, #{engineNumber,jdbcType=VARCHAR},
#{carBrand,jdbcType=VARCHAR},
#{vehicleType,jdbcType=TINYINT}, #{vehicleOwnerName,jdbcType=VARCHAR},
......@@ -209,12 +213,13 @@
#{pilferInsuranceMoney,jdbcType=DECIMAL},
#{insurancePeriod,jdbcType=INTEGER}, #{vehicleColor,jdbcType=VARCHAR},
#{vehicleInvoiceMoney,jdbcType=DECIMAL},
#{tastingUnit,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{tastingUnit,jdbcType=VARCHAR}, #{cancelReason,jdbcType=VARCHAR},
#{remark,jdbcType=VARCHAR},
#{expectedEffectiveTime,jdbcType=TIMESTAMP},
#{realEffectiveTime,jdbcType=TIMESTAMP}, #{insurancePdf,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=INTEGER}, #{updateBy,jdbcType=INTEGER}
)
#{realEffectiveTime,jdbcType=TIMESTAMP},
#{insurancePdf,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=INTEGER}, #{updateBy,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy"
......@@ -297,6 +302,9 @@
<if test="tastingUnit != null">
tasting_unit,
</if>
<if test="cancelReason != null">
cancel_reason,
</if>
<if test="remark != null">
remark,
</if>
......@@ -398,6 +406,9 @@
<if test="tastingUnit != null">
#{tastingUnit,jdbcType=VARCHAR},
</if>
<if test="cancelReason != null">
#{cancelReason,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
......@@ -428,7 +439,8 @@
parameterType="com.glsx.ordercenter.pojo.insurance.SysInsurancePolicyExample"
resultType="java.lang.Long">
<!--@mbg.generated-->
select count(*) from sys_insurance_policy
select count(*)
from sys_insurance_policy
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
......@@ -515,6 +527,9 @@
<if test="record.tastingUnit != null">
tasting_unit = #{record.tastingUnit,jdbcType=VARCHAR},
</if>
<if test="record.cancelReason != null">
cancel_reason = #{record.cancelReason,jdbcType=VARCHAR},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
......@@ -573,6 +588,7 @@
vehicle_color = #{record.vehicleColor,jdbcType=VARCHAR},
vehicle_invoice_money = #{record.vehicleInvoiceMoney,jdbcType=DECIMAL},
tasting_unit = #{record.tastingUnit,jdbcType=VARCHAR},
cancel_reason = #{record.cancelReason,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
expected_effective_time = #{record.expectedEffectiveTime,jdbcType=TIMESTAMP},
real_effective_time = #{record.realEffectiveTime,jdbcType=TIMESTAMP},
......@@ -665,6 +681,9 @@
<if test="tastingUnit != null">
tasting_unit = #{tastingUnit,jdbcType=VARCHAR},
</if>
<if test="cancelReason != null">
cancel_reason = #{cancelReason,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
......@@ -721,6 +740,7 @@
vehicle_color = #{vehicleColor,jdbcType=VARCHAR},
vehicle_invoice_money = #{vehicleInvoiceMoney,jdbcType=DECIMAL},
tasting_unit = #{tastingUnit,jdbcType=VARCHAR},
cancel_reason = #{cancelReason,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
expected_effective_time = #{expectedEffectiveTime,jdbcType=TIMESTAMP},
real_effective_time = #{realEffectiveTime,jdbcType=TIMESTAMP},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!