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 1708 additions and 1898 deletions
package com.glsx.ordercenter.dto.common; package com.glsx.common.pojo;
import java.io.Serializable; import java.io.Serializable;
import com.glsx.common.utils.Page; import com.glsx.common.utils.Page;
...@@ -11,7 +11,7 @@ import com.glsx.common.utils.Page; ...@@ -11,7 +11,7 @@ import com.glsx.common.utils.Page;
* @author wbh * @author wbh
* @date 2020-05-22 * @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 { ...@@ -39,7 +39,7 @@ public abstract class PagedOrderRequest implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "PagedOrderRequest{" + return "PagedReq{" +
"pageIndex=" + this.pageIndex + "pageIndex=" + this.pageIndex +
", pageSize=" + this.pageSize + ", pageSize=" + this.pageSize +
'}'; '}';
......
package com.glsx.ordercenter.dto.common; package com.glsx.common.pojo;
import java.util.List; import java.util.List;
import com.glsx.common.utils.Page; import com.glsx.common.utils.Page;
...@@ -11,27 +11,25 @@ import com.glsx.common.utils.Page; ...@@ -11,27 +11,25 @@ import com.glsx.common.utils.Page;
* @author wbh * @author wbh
* @date 2020-05-22 * @date 2020-05-22
*/ */
public class PagedOrderResponse<E> { public class PagedResp<E> {
private Page page; private Page page;
private List<E> items; private List<E> items;
private PagedOrderResponse(Page page, List<E> items) { private PagedResp(Page page, List<E> items) {
this.page = page; this.page = page;
this.items = items; this.items = items;
} }
public static <E> PagedOrderResponse<E> of(long totalCount, PagedOrderRequest pagedOrderRequest, public static <E> PagedResp<E> of(long totalCount, PagedReq orderReq, List<E> list) {
List<E> list) {
Page page = new Page(pagedOrderRequest.getPageIndex(), Page page = new Page(orderReq.getPageIndex(), orderReq.getPageSize());
pagedOrderRequest.getPageSize());
page.setTotalCount((int) totalCount); page.setTotalCount((int) totalCount);
return of(page, list); return of(page, list);
} }
public static <E> PagedOrderResponse<E> of(Page page, List<E> list) { public static <E> PagedResp<E> of(Page page, List<E> list) {
return new PagedOrderResponse<>(page, list); return new PagedResp<>(page, list);
} }
public Page getPage() { public Page getPage() {
...@@ -52,7 +50,7 @@ public class PagedOrderResponse<E> { ...@@ -52,7 +50,7 @@ public class PagedOrderResponse<E> {
@Override @Override
public String toString() { public String toString() {
return "PagedOrderResponse{" + return "PagedResp{" +
"page=" + this.page + "page=" + this.page +
", items=" + this.items + ", items=" + this.items +
'}'; '}';
......
...@@ -131,14 +131,14 @@ public enum ResultCodeEnum { ...@@ -131,14 +131,14 @@ public enum ResultCodeEnum {
/** /**
* 保单-导出数据过多 * 保单-导出数据过多
*/ */
INSURANCE_EXPORT_TO_MANY(1, "保单导出数据量大于5000条,请条件过滤后重新导出"), INSURANCE_ID_NULL(1, "保单ID不能为空"),
INSURANCE_ID_NULL(2, "保单ID不能为空"), INSURANCE_THIRD_ID_NULL(2, "第三方保单号不能为空"),
INSURANCE_ID_NOT_FOUND(3, "无法根据保单ID获取保单数据"), INSURANCE_ID_NOT_FOUND(3, "无法根据保单ID获取保单数据"),
INSURANCE_EXPORT_NOT_SUPPORTED(4, "非页面请求,无法导出保单"), INSURANCE_PDF_NOT_FOUND(4, "无法获取到保单相关的PDF文件"),
INSURANCE_PDF_NOT_FOUND(5, "无法获取到保单相关的PDF文件"), INSURANCE_EXPORT_TO_MANY(5, "保单导出数据量大于5000条,请条件过滤后重新导出"),
INSURANCE_API_FAIL(6, "TSP保险接口异常"), INSURANCE_EXPORT_NOT_SUPPORTED(6, "无法导出保单数据"),
INSURANCE_UPDATE_ERROR(7, "修改保单状态异常"), INSURANCE_API_FAIL(7, "TSP保险接口错误"),
INSURANCE_THIRD_ID_NULL(8, "第三方保单号不能为空"), INSURANCE_UPDATE_ERROR(8, "修改保单信息异常"),
; ;
......
package com.glsx.ordercenter.controller; package com.glsx.ordercenter.controller;
import javax.servlet.http.HttpServletRequest;
import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolation;
import javax.validation.Validation; import javax.validation.Validation;
import javax.validation.Validator; import javax.validation.Validator;
...@@ -11,6 +12,7 @@ import java.util.Map; ...@@ -11,6 +12,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import com.glsx.common.constants.ResultCodeEnum; import com.glsx.common.constants.ResultCodeEnum;
import com.glsx.common.constants.ResultObject; import com.glsx.common.constants.ResultObject;
import com.glsx.common.pojo.PagedReq;
import com.glsx.ordercenter.exception.SysException; import com.glsx.ordercenter.exception.SysException;
import com.glsx.ordercenter.utils.LogUtils; import com.glsx.ordercenter.utils.LogUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -18,6 +20,8 @@ import org.slf4j.Logger; ...@@ -18,6 +20,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError; import org.springframework.validation.FieldError;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
/** /**
* @author zhanghj * @author zhanghj
...@@ -72,8 +76,31 @@ public class BaseController { ...@@ -72,8 +76,31 @@ public class BaseController {
Collection<String> values = errorMap.values(); Collection<String> values = errorMap.values();
String errorMsg = StringUtils.join(values, ";"); String errorMsg = StringUtils.join(values, ";");
throw SysException.create( throw SysException.create(ResultCodeEnum.PARAM_ERROR.getCode(),
ResultCodeEnum.PARAM_ERROR.getCode(), errorMsg); 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) { 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.common.constants.ResultObject;
import com.glsx.ordercenter.controller.BaseController; import com.glsx.common.pojo.PagedResp;
import com.glsx.ordercenter.dto.common.PagedOrderResponse; import com.glsx.ordercenter.dto.req.InsuranceReq;
import com.glsx.ordercenter.dto.insurance.*; import com.glsx.ordercenter.dto.resp.InsuranceResp;
import com.glsx.ordercenter.service.insurance.InsuranceService; import com.glsx.ordercenter.service.InsuranceService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -28,18 +28,16 @@ public class InsuranceController extends BaseController { ...@@ -28,18 +28,16 @@ public class InsuranceController extends BaseController {
/** /**
* 获取保单列表 * 获取保单列表
* *
* @param insuranceQueryReq 请求体 * @param insuranceReq 请求体
* @return 查询结果 * @return 查询结果
*/ */
@RequestMapping(value = "/getList", method = RequestMethod.POST) @RequestMapping(value = "/getList", method = RequestMethod.POST)
public ResultObject query(@RequestBody InsuranceQueryReq insuranceQueryReq) { public ResultObject query(@RequestBody InsuranceReq insuranceReq) {
super.logInfo("保单列表查询-参数", insuranceQueryReq); super.logInfo("保单列表查询-参数", insuranceReq);
ResultObject resultObject; super.setPagedInfo(insuranceReq);
PagedOrderResponse<InsuranceQueryResp> pagedOrderResponse; PagedResp<InsuranceResp> result = this.insuranceService.query(insuranceReq);
ResultObject resultObject = super.webOk(result);
pagedOrderResponse = this.insuranceService.query(insuranceQueryReq);
resultObject = super.webOk(pagedOrderResponse);
super.logInfo("保单列表查询-结果", resultObject); super.logInfo("保单列表查询-结果", resultObject);
...@@ -49,19 +47,17 @@ public class InsuranceController extends BaseController { ...@@ -49,19 +47,17 @@ public class InsuranceController extends BaseController {
/** /**
* 获取保单详情 * 获取保单详情
* *
* @param insuranceDetailReq 请求体 * @param insuranceReq 请求体
* @return 保单详情 * @return 保单详情
*/ */
//@AuthCheck //@AuthCheck
@RequestMapping(value = "/detail", method = RequestMethod.POST) @RequestMapping(value = "/detail", method = RequestMethod.POST)
public ResultObject detail(@RequestBody InsuranceDetailReq insuranceDetailReq) { public ResultObject detail(@RequestBody InsuranceReq insuranceReq) {
super.logInfo("保单详情查询-参数", insuranceDetailReq); super.logInfo("保单详情查询-参数", insuranceReq);
ResultObject resultObject;
PagedOrderResponse<InsuranceDetailResp> pagedOrderResponse;
pagedOrderResponse = this.insuranceService.detail(insuranceDetailReq); super.setPagedInfo(insuranceReq);
resultObject = super.webOk(pagedOrderResponse); PagedResp<InsuranceResp> result = this.insuranceService.detail(insuranceReq);
ResultObject resultObject = super.webOk(result);
super.logInfo("保单详情查询-结果", resultObject); super.logInfo("保单详情查询-结果", resultObject);
...@@ -71,18 +67,15 @@ public class InsuranceController extends BaseController { ...@@ -71,18 +67,15 @@ public class InsuranceController extends BaseController {
/** /**
* 下载保单PDF * 下载保单PDF
* *
* @param insuranceDetailReq 请求体 * @param insuranceReq 请求体
*/ */
//@AuthCheck //@AuthCheck
@RequestMapping(value = "/download", method = RequestMethod.POST) @RequestMapping(value = "/download", method = RequestMethod.POST)
public ResultObject download(@RequestBody InsuranceDetailReq insuranceDetailReq) { public ResultObject download(@RequestBody InsuranceReq insuranceReq) {
super.logInfo("下载保单-参数", insuranceDetailReq); super.logInfo("下载保单-参数", insuranceReq);
ResultObject resultObject;
InsuranceDetailResp insuranceDetailResp =
this.insuranceService.download(insuranceDetailReq);
resultObject = super.webOk(insuranceDetailResp); InsuranceResp insuranceResp = this.insuranceService.download(insuranceReq);
ResultObject resultObject = super.webOk(insuranceResp);
super.logInfo("下载保单-结果", resultObject); super.logInfo("下载保单-结果", resultObject);
...@@ -92,17 +85,16 @@ public class InsuranceController extends BaseController { ...@@ -92,17 +85,16 @@ public class InsuranceController extends BaseController {
/** /**
* 退保 * 退保
* *
* @param insuranceRefundReq 请求体 * @param insuranceReq 请求体
* @return 退保结果 * @return 退保结果
*/ */
//@AuthCheck //@AuthCheck
@RequestMapping(value = "/refund", method = RequestMethod.POST) @RequestMapping(value = "/refund", method = RequestMethod.POST)
public ResultObject refund(@RequestBody InsuranceRefundReq insuranceRefundReq) { public ResultObject refund(@RequestBody InsuranceReq insuranceReq) {
super.logInfo("退保-参数", insuranceRefundReq); super.logInfo("退保-参数", insuranceReq);
InsuranceRefundResp insuranceRefundResp = InsuranceResp insuranceResp = this.insuranceService.refund(insuranceReq);
this.insuranceService.refund(insuranceRefundReq); ResultObject resultObject = super.webOk(insuranceResp);
ResultObject resultObject = super.webOk(insuranceRefundResp);
super.logInfo("退保-结果", resultObject); super.logInfo("退保-结果", resultObject);
......
...@@ -14,6 +14,7 @@ import java.util.Map; ...@@ -14,6 +14,7 @@ import java.util.Map;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.glsx.common.feign.client.UserClient; import com.glsx.common.feign.client.UserClient;
import com.glsx.common.pojo.PagedResp;
import com.glsx.common.utils.UserUtils; import com.glsx.common.utils.UserUtils;
import com.glsx.ordercenter.constants.OrderTypeEnum; import com.glsx.ordercenter.constants.OrderTypeEnum;
import com.glsx.ordercenter.constants.ReconciliationStatusEnum; import com.glsx.ordercenter.constants.ReconciliationStatusEnum;
...@@ -29,11 +30,10 @@ import com.glsx.ordercenter.dto.OrderExceptionVO; ...@@ -29,11 +30,10 @@ import com.glsx.ordercenter.dto.OrderExceptionVO;
import com.glsx.ordercenter.dto.QueryOrderReq; import com.glsx.ordercenter.dto.QueryOrderReq;
import com.glsx.ordercenter.dto.ReconciliationDetailQuery; import com.glsx.ordercenter.dto.ReconciliationDetailQuery;
import com.glsx.ordercenter.dto.ReconciliationDetailVO; import com.glsx.ordercenter.dto.ReconciliationDetailVO;
import com.glsx.ordercenter.dto.common.PagedOrderResponse; import com.glsx.ordercenter.dto.req.InsuranceReq;
import com.glsx.ordercenter.dto.insurance.InsuranceQueryReq;
import com.glsx.ordercenter.dto.insurance.InsuranceQueryResp;
import com.glsx.ordercenter.dto.req.ReconciliationListQuery; import com.glsx.ordercenter.dto.req.ReconciliationListQuery;
import com.glsx.ordercenter.dto.resp.ExportReconciliationVo; import com.glsx.ordercenter.dto.resp.ExportReconciliationVo;
import com.glsx.ordercenter.dto.resp.InsuranceResp;
import com.glsx.ordercenter.exception.SysException; import com.glsx.ordercenter.exception.SysException;
import com.glsx.ordercenter.pojo.DictionaryData; import com.glsx.ordercenter.pojo.DictionaryData;
import com.glsx.ordercenter.pojo.ExportOrderExceptionVo; import com.glsx.ordercenter.pojo.ExportOrderExceptionVo;
...@@ -50,10 +50,10 @@ import com.glsx.ordercenter.service.IOrderExceptionService; ...@@ -50,10 +50,10 @@ import com.glsx.ordercenter.service.IOrderExceptionService;
import com.glsx.ordercenter.service.IOrderService; import com.glsx.ordercenter.service.IOrderService;
import com.glsx.ordercenter.service.IUnknownOrderService; import com.glsx.ordercenter.service.IUnknownOrderService;
import com.glsx.ordercenter.service.IndentService; import com.glsx.ordercenter.service.IndentService;
import com.glsx.ordercenter.service.InsuranceService;
import com.glsx.ordercenter.service.OperationAdvanceService; import com.glsx.ordercenter.service.OperationAdvanceService;
import com.glsx.ordercenter.service.ReconciliationDetailService; import com.glsx.ordercenter.service.ReconciliationDetailService;
import com.glsx.ordercenter.service.ReconciliationService; import com.glsx.ordercenter.service.ReconciliationService;
import com.glsx.ordercenter.service.insurance.InsuranceService;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -483,18 +483,17 @@ public class ReportController extends BaseReportController { ...@@ -483,18 +483,17 @@ public class ReportController extends BaseReportController {
} }
@RequestMapping(value = "/exportInsurance", method = {RequestMethod.POST, RequestMethod.GET}) @RequestMapping(value = "/exportInsurance", method = {RequestMethod.POST, RequestMethod.GET})
public void exportInsurance( InsuranceQueryReq insuranceQueryReq) { public void exportInsurance(InsuranceReq insuranceReq) {
this.logger.info("保单导出-参数: {}", JSON.toJSONString(insuranceQueryReq)); this.logger.info("保单导出-参数: {}", JSON.toJSONString(insuranceReq));
ServletRequestAttributes attributes = ServletRequestAttributes attributes =
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
insuranceQueryReq.setPageIndex(-1); insuranceReq.setPageIndex(null);
insuranceQueryReq.setPageSize(-1); insuranceReq.setPageSize(null);
PagedOrderResponse<InsuranceQueryResp> pagedOrderResponse = PagedResp<InsuranceResp> pagedResp = this.insuranceService.query(insuranceReq);
this.insuranceService.query(insuranceQueryReq);
if (pagedOrderResponse.getItems().size() > 5000) { if (pagedResp.getItems().size() > 5000) {
throw SysException.create( throw SysException.create(
ResultCodeEnum.INSURANCE_EXPORT_TO_MANY.getCode(), ResultCodeEnum.INSURANCE_EXPORT_TO_MANY.getCode(),
ResultCodeEnum.INSURANCE_EXPORT_TO_MANY.getMsg()); ResultCodeEnum.INSURANCE_EXPORT_TO_MANY.getMsg());
...@@ -503,8 +502,8 @@ public class ReportController extends BaseReportController { ...@@ -503,8 +502,8 @@ public class ReportController extends BaseReportController {
try { try {
if (attributes != null && attributes.getResponse() != null) { if (attributes != null && attributes.getResponse() != null) {
String title = "保单详情-" + String title = "保单详情-" +
DateTimeFormatter.ofPattern("yyyy-MM-dd_HH_mm_ss").format(LocalDateTime.now()); DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss").format(LocalDateTime.now());
this.exportObject(attributes.getResponse(), pagedOrderResponse.getItems(), title); this.exportObject(attributes.getResponse(), pagedResp.getItems(), title);
} else { } else {
throw new IOException(ResultCodeEnum.INSURANCE_EXPORT_NOT_SUPPORTED.getMsg()); 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; package com.glsx.ordercenter.controller.api;
import com.glsx.ordercenter.dto.api.OraInsuranceRefundReq; import com.glsx.common.constants.ResultObject;
import com.glsx.ordercenter.dto.api.OraInsuranceRefundResp; import com.glsx.ordercenter.constants.ResultCodeEnum;
import com.glsx.ordercenter.dto.api.OraInsuranceUpdateReq; import com.glsx.ordercenter.controller.BaseController;
import com.glsx.ordercenter.dto.api.OraInsuranceUpdateResp; import com.glsx.ordercenter.dto.req.OraInsuranceRefundReq;
import com.glsx.ordercenter.exception.insurance.OraBizException; 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.service.api.OraInsuranceService;
import com.glsx.ordercenter.utils.OraSignUtil; import com.glsx.ordercenter.utils.OraSignUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -26,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -26,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
*/ */
@RestController @RestController
@RequestMapping("/api/insurance") @RequestMapping("/api/insurance")
public class OraInsuranceController extends OraBaseController { public class OraInsuranceController extends BaseController {
@Value("${ora.api.url}") @Value("${ora.api.url}")
private String serverUrl; private String serverUrl;
...@@ -40,40 +42,48 @@ public class OraInsuranceController extends OraBaseController { ...@@ -40,40 +42,48 @@ public class OraInsuranceController extends OraBaseController {
private OraInsuranceService oraInsuranceService; private OraInsuranceService oraInsuranceService;
@RequestMapping(value = "/update", method = RequestMethod.POST) @RequestMapping(value = "/update", method = RequestMethod.POST)
public OraInsuranceUpdateResp update( public OraResultObject update(@Validated @RequestBody OraInsuranceUpdateReq updateReq,
@Validated @RequestBody OraInsuranceUpdateReq insuranceUpdateReq, BindingResult bindingResult) {
BindingResult bindingResult) {
super.logInfo("长城欧拉修改保单-参数", insuranceUpdateReq); super.logInfo("长城欧拉修改保单-参数", updateReq);
OraInsuranceUpdateResp insuranceUpdateResp; OraResultObject resultObject;
try { try {
OraSignUtil.verifyRequest(this.appKey, this.appSecret, updateReq);
super.checkRequestParam(bindingResult); super.checkRequestParam(bindingResult);
insuranceUpdateResp = this.oraInsuranceService.update(insuranceUpdateReq); resultObject = this.oraInsuranceService.update(updateReq);
} catch (OraBizException e) { } catch (SysException e) {
insuranceUpdateResp = super.oraWebOops(e.getCode(), e, new OraInsuranceUpdateResp()); super.logError("长城欧拉修改保单-异常", e);
ResultObject result = e.getResultEntity();
resultObject = new OraResultObject(result.getCode(), result.getMessage());
} catch (RuntimeException e) { } 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) @RequestMapping(value = "/refund", method = RequestMethod.POST)
public OraInsuranceRefundResp refund( public OraResultObject refund(@Validated @RequestBody OraInsuranceRefundReq refundReq,
@Validated @RequestBody OraInsuranceRefundReq insuranceRefundReq, BindingResult bindingResult) {
BindingResult bindingResult) { super.logInfo("长城欧拉退保-参数", refundReq);
super.logInfo("长城欧拉退保-参数", insuranceRefundReq); OraResultObject resultObject;
OraInsuranceRefundResp insuranceRefundResp;
try { try {
OraSignUtil.verifyRequest(this.appKey, this.appSecret, OraSignUtil.verifyRequest(this.appKey, this.appSecret, refundReq);
insuranceRefundReq);
super.checkRequestParam(bindingResult); super.checkRequestParam(bindingResult);
insuranceRefundResp = this.oraInsuranceService.refund(insuranceRefundReq); resultObject = this.oraInsuranceService.refund(refundReq);
} catch (OraBizException e) { } catch (SysException e) {
insuranceRefundResp = super.oraWebOops(e.getCode(), e, new OraInsuranceRefundResp()); super.logError("长城欧拉修改保单-异常", e);
ResultObject result = e.getResultEntity();
resultObject = new OraResultObject(result.getCode(), result.getMessage());
} catch (RuntimeException e) { } catch (RuntimeException e) {
insuranceRefundResp = super.oraWebOops(e, new OraInsuranceRefundResp()); super.logError("长城欧拉修改保单-异常", e);
resultObject = new OraResultObject(ResultCodeEnum.ERROR);
} }
super.logInfo("长城欧拉退保-结果", insuranceRefundResp); super.logInfo("长城欧拉退保-结果", resultObject);
return insuranceRefundResp; 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 java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; 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 * <p>Project: car-service
* *
* @author wbh * @author wbh
* @date 2020-05-22 * @date 2020-05-22
*/ */
public class InsuranceQueryReq extends PagedOrderRequest { public class InsuranceReq extends PagedReq {
/** /**
* 保单ID * 保单ID
*/ */
...@@ -144,7 +144,7 @@ public class InsuranceQueryReq extends PagedOrderRequest { ...@@ -144,7 +144,7 @@ public class InsuranceQueryReq extends PagedOrderRequest {
@Override @Override
public String toString() { public String toString() {
return "InsuranceQueryReq{" + return "InsuranceReq{" +
"id=" + this.id + "id=" + this.id +
", insuranceId='" + this.insuranceId + '\'' + ", insuranceId='" + this.insuranceId + '\'' +
", vehicleOwnerName='" + this.vehicleOwnerName + '\'' + ", vehicleOwnerName='" + this.vehicleOwnerName + '\'' +
......
package com.glsx.ordercenter.dto.api; package com.glsx.ordercenter.dto.req;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/** /**
* <p>Description: * <p>Description:
...@@ -10,7 +11,7 @@ import javax.validation.constraints.NotBlank; ...@@ -10,7 +11,7 @@ import javax.validation.constraints.NotBlank;
* @author wbh * @author wbh
* @date 2020-05-25 * @date 2020-05-25
*/ */
public class OraInsuranceRefundReq extends OraBaseRequest { public class OraInsuranceRefundReq implements Serializable {
/** /**
* 聚合保单ID(唯一不变值) * 聚合保单ID(唯一不变值)
*/ */
...@@ -43,6 +44,6 @@ public class OraInsuranceRefundReq extends OraBaseRequest { ...@@ -43,6 +44,6 @@ public class OraInsuranceRefundReq extends OraBaseRequest {
return "OraInsuranceRefundReq{" + return "OraInsuranceRefundReq{" +
"insuranceId='" + this.insuranceId + '\'' + "insuranceId='" + this.insuranceId + '\'' +
", reason='" + this.reason + '\'' + ", 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.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable;
/** /**
* <p>Description: * <p>Description:
...@@ -11,7 +12,7 @@ import javax.validation.constraints.NotNull; ...@@ -11,7 +12,7 @@ import javax.validation.constraints.NotNull;
* @author wbh * @author wbh
* @date 2020-05-25 * @date 2020-05-25
*/ */
public class OraInsuranceUpdateReq extends OraBaseRequest { public class OraInsuranceUpdateReq implements Serializable {
/** /**
* 聚合保单ID(唯一不变值) * 聚合保单ID(唯一不变值)
*/ */
...@@ -303,6 +304,6 @@ public class OraInsuranceUpdateReq extends OraBaseRequest { ...@@ -303,6 +304,6 @@ public class OraInsuranceUpdateReq extends OraBaseRequest {
", tastingUnit='" + this.tastingUnit + '\'' + ", tastingUnit='" + this.tastingUnit + '\'' +
", customerId=" + this.customerId + ", customerId=" + this.customerId +
", registrationDate='" + this.registrationDate + '\'' + ", registrationDate='" + this.registrationDate + '\'' +
"} " + super.toString(); '}';
} }
} }
package com.glsx.ordercenter.dto.insurance; package com.glsx.ordercenter.dto.req;
import java.io.Serializable; import java.io.Serializable;
......
package com.glsx.ordercenter.dto.insurance; package com.glsx.ordercenter.dto.req;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -74,7 +74,7 @@ public class TspSaveReq implements Serializable { ...@@ -74,7 +74,7 @@ public class TspSaveReq implements Serializable {
private Long sumPremium; private Long sumPremium;
public Long getSumPremium() { public Long getSumPremium() {
return sumPremium; return this.sumPremium;
} }
public void setSumPremium(Long sumPremium) { public void setSumPremium(Long sumPremium) {
...@@ -82,7 +82,7 @@ public class TspSaveReq implements Serializable { ...@@ -82,7 +82,7 @@ public class TspSaveReq implements Serializable {
} }
public String getInsuranceCompany() { public String getInsuranceCompany() {
return insuranceCompany; return this.insuranceCompany;
} }
public void setInsuranceCompany(String insuranceCompany) { public void setInsuranceCompany(String insuranceCompany) {
...@@ -90,7 +90,7 @@ public class TspSaveReq implements Serializable { ...@@ -90,7 +90,7 @@ public class TspSaveReq implements Serializable {
} }
public String getSeqNo() { public String getSeqNo() {
return seqNo; return this.seqNo;
} }
public void setSeqNo(String seqNo) { public void setSeqNo(String seqNo) {
...@@ -98,7 +98,7 @@ public class TspSaveReq implements Serializable { ...@@ -98,7 +98,7 @@ public class TspSaveReq implements Serializable {
} }
public String getCompensationName() { public String getCompensationName() {
return compensationName; return this.compensationName;
} }
public void setCompensationName(String compensationName) { public void setCompensationName(String compensationName) {
...@@ -106,7 +106,7 @@ public class TspSaveReq implements Serializable { ...@@ -106,7 +106,7 @@ public class TspSaveReq implements Serializable {
} }
public String getAddress() { public String getAddress() {
return address; return this.address;
} }
public void setAddress(String address) { public void setAddress(String address) {
...@@ -114,7 +114,7 @@ public class TspSaveReq implements Serializable { ...@@ -114,7 +114,7 @@ public class TspSaveReq implements Serializable {
} }
public String getCustomerType() { public String getCustomerType() {
return customerType; return this.customerType;
} }
public void setCustomerType(String customerType) { public void setCustomerType(String customerType) {
...@@ -122,7 +122,7 @@ public class TspSaveReq implements Serializable { ...@@ -122,7 +122,7 @@ public class TspSaveReq implements Serializable {
} }
public String getCardType() { public String getCardType() {
return cardType; return this.cardType;
} }
public void setCardType(String cardType) { public void setCardType(String cardType) {
...@@ -130,7 +130,7 @@ public class TspSaveReq implements Serializable { ...@@ -130,7 +130,7 @@ public class TspSaveReq implements Serializable {
} }
public String getCardNo() { public String getCardNo() {
return cardNo; return this.cardNo;
} }
public void setCardNo(String cardNo) { public void setCardNo(String cardNo) {
...@@ -138,7 +138,7 @@ public class TspSaveReq implements Serializable { ...@@ -138,7 +138,7 @@ public class TspSaveReq implements Serializable {
} }
public String getName() { public String getName() {
return name; return this.name;
} }
public void setName(String name) { public void setName(String name) {
...@@ -146,7 +146,7 @@ public class TspSaveReq implements Serializable { ...@@ -146,7 +146,7 @@ public class TspSaveReq implements Serializable {
} }
public String getPhone() { public String getPhone() {
return phone; return this.phone;
} }
public void setPhone(String phone) { public void setPhone(String phone) {
...@@ -154,7 +154,7 @@ public class TspSaveReq implements Serializable { ...@@ -154,7 +154,7 @@ public class TspSaveReq implements Serializable {
} }
public String getEffectDate() { public String getEffectDate() {
return effectDate; return this.effectDate;
} }
public void setEffectDate(String effectDate) { public void setEffectDate(String effectDate) {
...@@ -162,7 +162,7 @@ public class TspSaveReq implements Serializable { ...@@ -162,7 +162,7 @@ public class TspSaveReq implements Serializable {
} }
public String getInsurePeriod() { public String getInsurePeriod() {
return insurePeriod; return this.insurePeriod;
} }
public void setInsurePeriod(String insurePeriod) { public void setInsurePeriod(String insurePeriod) {
...@@ -170,7 +170,7 @@ public class TspSaveReq implements Serializable { ...@@ -170,7 +170,7 @@ public class TspSaveReq implements Serializable {
} }
public String getSumAmount() { public String getSumAmount() {
return sumAmount; return this.sumAmount;
} }
public void setSumAmount(String sumAmount) { public void setSumAmount(String sumAmount) {
...@@ -178,7 +178,7 @@ public class TspSaveReq implements Serializable { ...@@ -178,7 +178,7 @@ public class TspSaveReq implements Serializable {
} }
public String getStandNo() { public String getStandNo() {
return standNo; return this.standNo;
} }
public void setStandNo(String standNo) { public void setStandNo(String standNo) {
...@@ -186,7 +186,7 @@ public class TspSaveReq implements Serializable { ...@@ -186,7 +186,7 @@ public class TspSaveReq implements Serializable {
} }
public String getEngine() { public String getEngine() {
return engine; return this.engine;
} }
public void setEngine(String engine) { public void setEngine(String engine) {
...@@ -194,7 +194,7 @@ public class TspSaveReq implements Serializable { ...@@ -194,7 +194,7 @@ public class TspSaveReq implements Serializable {
} }
public String getBuyType() { public String getBuyType() {
return buyType; return this.buyType;
} }
public void setBuyType(String buyType) { public void setBuyType(String buyType) {
...@@ -202,7 +202,7 @@ public class TspSaveReq implements Serializable { ...@@ -202,7 +202,7 @@ public class TspSaveReq implements Serializable {
} }
public String getVehicleColor() { public String getVehicleColor() {
return vehicleColor; return this.vehicleColor;
} }
public void setVehicleColor(String vehicleColor) { public void setVehicleColor(String vehicleColor) {
...@@ -210,7 +210,7 @@ public class TspSaveReq implements Serializable { ...@@ -210,7 +210,7 @@ public class TspSaveReq implements Serializable {
} }
public String getVehicleBrand() { public String getVehicleBrand() {
return vehicleBrand; return this.vehicleBrand;
} }
public void setVehicleBrand(String vehicleBrand) { public void setVehicleBrand(String vehicleBrand) {
...@@ -218,7 +218,7 @@ public class TspSaveReq implements Serializable { ...@@ -218,7 +218,7 @@ public class TspSaveReq implements Serializable {
} }
public String getVehicleChildsBrandName() { public String getVehicleChildsBrandName() {
return vehicleChildsBrandName; return this.vehicleChildsBrandName;
} }
public void setVehicleChildsBrandName(String vehicleChildsBrandName) { public void setVehicleChildsBrandName(String vehicleChildsBrandName) {
...@@ -226,7 +226,7 @@ public class TspSaveReq implements Serializable { ...@@ -226,7 +226,7 @@ public class TspSaveReq implements Serializable {
} }
public String getVehicleSeriesName() { public String getVehicleSeriesName() {
return vehicleSeriesName; return this.vehicleSeriesName;
} }
public void setVehicleSeriesName(String vehicleSeriesName) { public void setVehicleSeriesName(String vehicleSeriesName) {
...@@ -234,7 +234,7 @@ public class TspSaveReq implements Serializable { ...@@ -234,7 +234,7 @@ public class TspSaveReq implements Serializable {
} }
public BigDecimal getVehiclePrice() { public BigDecimal getVehiclePrice() {
return vehiclePrice; return this.vehiclePrice;
} }
public void setVehiclePrice(BigDecimal vehiclePrice) { public void setVehiclePrice(BigDecimal vehiclePrice) {
...@@ -242,7 +242,7 @@ public class TspSaveReq implements Serializable { ...@@ -242,7 +242,7 @@ public class TspSaveReq implements Serializable {
} }
public String getVehicleUsage() { public String getVehicleUsage() {
return vehicleUsage; return this.vehicleUsage;
} }
public void setVehicleUsage(String vehicleUsage) { public void setVehicleUsage(String vehicleUsage) {
...@@ -250,7 +250,7 @@ public class TspSaveReq implements Serializable { ...@@ -250,7 +250,7 @@ public class TspSaveReq implements Serializable {
} }
public String getPlanNo() { public String getPlanNo() {
return planNo; return this.planNo;
} }
public void setPlanNo(String planNo) { public void setPlanNo(String planNo) {
...@@ -258,7 +258,7 @@ public class TspSaveReq implements Serializable { ...@@ -258,7 +258,7 @@ public class TspSaveReq implements Serializable {
} }
public String getBirthday() { public String getBirthday() {
return birthday; return this.birthday;
} }
public void setBirthday(String birthday) { public void setBirthday(String birthday) {
...@@ -266,7 +266,7 @@ public class TspSaveReq implements Serializable { ...@@ -266,7 +266,7 @@ public class TspSaveReq implements Serializable {
} }
public String getSex() { public String getSex() {
return sex; return this.sex;
} }
public void setSex(String sex) { public void setSex(String sex) {
...@@ -274,7 +274,7 @@ public class TspSaveReq implements Serializable { ...@@ -274,7 +274,7 @@ public class TspSaveReq implements Serializable {
} }
public String getInstallPoint() { public String getInstallPoint() {
return installPoint; return this.installPoint;
} }
public void setInstallPoint(String installPoint) { public void setInstallPoint(String installPoint) {
...@@ -282,7 +282,7 @@ public class TspSaveReq implements Serializable { ...@@ -282,7 +282,7 @@ public class TspSaveReq implements Serializable {
} }
public String getInstallPerson() { public String getInstallPerson() {
return installPerson; return this.installPerson;
} }
public void setInstallPerson(String installPerson) { public void setInstallPerson(String installPerson) {
...@@ -290,7 +290,7 @@ public class TspSaveReq implements Serializable { ...@@ -290,7 +290,7 @@ public class TspSaveReq implements Serializable {
} }
public String getSpid() { public String getSpid() {
return spid; return this.spid;
} }
public void setSpid(String spid) { public void setSpid(String spid) {
...@@ -298,7 +298,7 @@ public class TspSaveReq implements Serializable { ...@@ -298,7 +298,7 @@ public class TspSaveReq implements Serializable {
} }
public String getSpecialContent() { public String getSpecialContent() {
return specialContent; return this.specialContent;
} }
public void setSpecialContent(String specialContent) { public void setSpecialContent(String specialContent) {
...@@ -306,7 +306,7 @@ public class TspSaveReq implements Serializable { ...@@ -306,7 +306,7 @@ public class TspSaveReq implements Serializable {
} }
public String getDeviceName() { public String getDeviceName() {
return deviceName; return this.deviceName;
} }
public void setDeviceName(String deviceName) { public void setDeviceName(String deviceName) {
...@@ -314,7 +314,7 @@ public class TspSaveReq implements Serializable { ...@@ -314,7 +314,7 @@ public class TspSaveReq implements Serializable {
} }
public String getProductType() { public String getProductType() {
return productType; return this.productType;
} }
public void setProductType(String productType) { public void setProductType(String productType) {
...@@ -322,7 +322,7 @@ public class TspSaveReq implements Serializable { ...@@ -322,7 +322,7 @@ public class TspSaveReq implements Serializable {
} }
public String getDeviceType() { public String getDeviceType() {
return deviceType; return this.deviceType;
} }
public void setDeviceType(String deviceType) { public void setDeviceType(String deviceType) {
...@@ -330,7 +330,7 @@ public class TspSaveReq implements Serializable { ...@@ -330,7 +330,7 @@ public class TspSaveReq implements Serializable {
} }
public String getSn() { public String getSn() {
return sn; return this.sn;
} }
public void setSn(String sn) { public void setSn(String sn) {
...@@ -338,7 +338,7 @@ public class TspSaveReq implements Serializable { ...@@ -338,7 +338,7 @@ public class TspSaveReq implements Serializable {
} }
public String getActiveDate() { public String getActiveDate() {
return activeDate; return this.activeDate;
} }
public void setActiveDate(String activeDate) { public void setActiveDate(String activeDate) {
...@@ -346,7 +346,7 @@ public class TspSaveReq implements Serializable { ...@@ -346,7 +346,7 @@ public class TspSaveReq implements Serializable {
} }
public String getPlateNum() { public String getPlateNum() {
return plateNum; return this.plateNum;
} }
public void setPlateNum(String plateNum) { public void setPlateNum(String plateNum) {
...@@ -354,7 +354,7 @@ public class TspSaveReq implements Serializable { ...@@ -354,7 +354,7 @@ public class TspSaveReq implements Serializable {
} }
public String getVehicleTypeName() { public String getVehicleTypeName() {
return vehicleTypeName; return this.vehicleTypeName;
} }
public void setVehicleTypeName(String vehicleTypeName) { public void setVehicleTypeName(String vehicleTypeName) {
...@@ -362,7 +362,7 @@ public class TspSaveReq implements Serializable { ...@@ -362,7 +362,7 @@ public class TspSaveReq implements Serializable {
} }
public String getShopName() { public String getShopName() {
return shopName; return this.shopName;
} }
public void setShopName(String shopName) { public void setShopName(String shopName) {
...@@ -370,7 +370,7 @@ public class TspSaveReq implements Serializable { ...@@ -370,7 +370,7 @@ public class TspSaveReq implements Serializable {
} }
public String getFixTime() { public String getFixTime() {
return fixTime; return this.fixTime;
} }
public void setFixTime(String fixTime) { public void setFixTime(String fixTime) {
......
package com.glsx.ordercenter.dto.insurance; package com.glsx.ordercenter.dto.req;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -62,7 +62,7 @@ public class TspUpdateReq implements Serializable { ...@@ -62,7 +62,7 @@ public class TspUpdateReq implements Serializable {
private Long sumPremium; private Long sumPremium;
public Long getSumPremium() { public Long getSumPremium() {
return sumPremium; return this.sumPremium;
} }
public void setSumPremium(Long sumPremium) { public void setSumPremium(Long sumPremium) {
...@@ -70,7 +70,7 @@ public class TspUpdateReq implements Serializable { ...@@ -70,7 +70,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getInsuranceCompany() { public String getInsuranceCompany() {
return insuranceCompany; return this.insuranceCompany;
} }
public void setInsuranceCompany(String insuranceCompany) { public void setInsuranceCompany(String insuranceCompany) {
...@@ -78,7 +78,7 @@ public class TspUpdateReq implements Serializable { ...@@ -78,7 +78,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getFullInsuranceNo() { public String getFullInsuranceNo() {
return fullInsuranceNo; return this.fullInsuranceNo;
} }
public void setFullInsuranceNo(String fullInsuranceNo) { public void setFullInsuranceNo(String fullInsuranceNo) {
...@@ -86,7 +86,7 @@ public class TspUpdateReq implements Serializable { ...@@ -86,7 +86,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getSeqNo() { public String getSeqNo() {
return seqNo; return this.seqNo;
} }
public void setSeqNo(String seqNo) { public void setSeqNo(String seqNo) {
...@@ -94,7 +94,7 @@ public class TspUpdateReq implements Serializable { ...@@ -94,7 +94,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getCompensationName() { public String getCompensationName() {
return compensationName; return this.compensationName;
} }
public void setCompensationName(String compensationName) { public void setCompensationName(String compensationName) {
...@@ -102,7 +102,7 @@ public class TspUpdateReq implements Serializable { ...@@ -102,7 +102,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getAddress() { public String getAddress() {
return address; return this.address;
} }
public void setAddress(String address) { public void setAddress(String address) {
...@@ -110,7 +110,7 @@ public class TspUpdateReq implements Serializable { ...@@ -110,7 +110,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getCustomerType() { public String getCustomerType() {
return customerType; return this.customerType;
} }
public void setCustomerType(String customerType) { public void setCustomerType(String customerType) {
...@@ -118,7 +118,7 @@ public class TspUpdateReq implements Serializable { ...@@ -118,7 +118,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getCardType() { public String getCardType() {
return cardType; return this.cardType;
} }
public void setCardType(String cardType) { public void setCardType(String cardType) {
...@@ -126,7 +126,7 @@ public class TspUpdateReq implements Serializable { ...@@ -126,7 +126,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getBirthday() { public String getBirthday() {
return birthday; return this.birthday;
} }
public void setBirthday(String birthday) { public void setBirthday(String birthday) {
...@@ -134,7 +134,7 @@ public class TspUpdateReq implements Serializable { ...@@ -134,7 +134,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getCardNo() { public String getCardNo() {
return cardNo; return this.cardNo;
} }
public void setCardNo(String cardNo) { public void setCardNo(String cardNo) {
...@@ -142,7 +142,7 @@ public class TspUpdateReq implements Serializable { ...@@ -142,7 +142,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getName() { public String getName() {
return name; return this.name;
} }
public void setName(String name) { public void setName(String name) {
...@@ -150,7 +150,7 @@ public class TspUpdateReq implements Serializable { ...@@ -150,7 +150,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getSex() { public String getSex() {
return sex; return this.sex;
} }
public void setSex(String sex) { public void setSex(String sex) {
...@@ -158,7 +158,7 @@ public class TspUpdateReq implements Serializable { ...@@ -158,7 +158,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getPhone() { public String getPhone() {
return phone; return this.phone;
} }
public void setPhone(String phone) { public void setPhone(String phone) {
...@@ -166,7 +166,7 @@ public class TspUpdateReq implements Serializable { ...@@ -166,7 +166,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getEffectDate() { public String getEffectDate() {
return effectDate; return this.effectDate;
} }
public void setEffectDate(String effectDate) { public void setEffectDate(String effectDate) {
...@@ -174,7 +174,7 @@ public class TspUpdateReq implements Serializable { ...@@ -174,7 +174,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getInsurePeriod() { public String getInsurePeriod() {
return insurePeriod; return this.insurePeriod;
} }
public void setInsurePeriod(String insurePeriod) { public void setInsurePeriod(String insurePeriod) {
...@@ -182,7 +182,7 @@ public class TspUpdateReq implements Serializable { ...@@ -182,7 +182,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getInstallPoint() { public String getInstallPoint() {
return installPoint; return this.installPoint;
} }
public void setInstallPoint(String installPoint) { public void setInstallPoint(String installPoint) {
...@@ -190,7 +190,7 @@ public class TspUpdateReq implements Serializable { ...@@ -190,7 +190,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getInstallPerson() { public String getInstallPerson() {
return installPerson; return this.installPerson;
} }
public void setInstallPerson(String installPerson) { public void setInstallPerson(String installPerson) {
...@@ -198,7 +198,7 @@ public class TspUpdateReq implements Serializable { ...@@ -198,7 +198,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getSumAmount() { public String getSumAmount() {
return sumAmount; return this.sumAmount;
} }
public void setSumAmount(String sumAmount) { public void setSumAmount(String sumAmount) {
...@@ -206,7 +206,7 @@ public class TspUpdateReq implements Serializable { ...@@ -206,7 +206,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getSpid() { public String getSpid() {
return spid; return this.spid;
} }
public void setSpid(String spid) { public void setSpid(String spid) {
...@@ -214,7 +214,7 @@ public class TspUpdateReq implements Serializable { ...@@ -214,7 +214,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getSpecialContent() { public String getSpecialContent() {
return specialContent; return this.specialContent;
} }
public void setSpecialContent(String specialContent) { public void setSpecialContent(String specialContent) {
...@@ -222,7 +222,7 @@ public class TspUpdateReq implements Serializable { ...@@ -222,7 +222,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getStandNo() { public String getStandNo() {
return standNo; return this.standNo;
} }
public void setStandNo(String standNo) { public void setStandNo(String standNo) {
...@@ -230,7 +230,7 @@ public class TspUpdateReq implements Serializable { ...@@ -230,7 +230,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getPlateNum() { public String getPlateNum() {
return plateNum; return this.plateNum;
} }
public void setPlateNum(String plateNum) { public void setPlateNum(String plateNum) {
...@@ -238,7 +238,7 @@ public class TspUpdateReq implements Serializable { ...@@ -238,7 +238,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getEngine() { public String getEngine() {
return engine; return this.engine;
} }
public void setEngine(String engine) { public void setEngine(String engine) {
...@@ -246,7 +246,7 @@ public class TspUpdateReq implements Serializable { ...@@ -246,7 +246,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getBuyType() { public String getBuyType() {
return buyType; return this.buyType;
} }
public void setBuyType(String buyType) { public void setBuyType(String buyType) {
...@@ -254,7 +254,7 @@ public class TspUpdateReq implements Serializable { ...@@ -254,7 +254,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getVehicleColor() { public String getVehicleColor() {
return vehicleColor; return this.vehicleColor;
} }
public void setVehicleColor(String vehicleColor) { public void setVehicleColor(String vehicleColor) {
...@@ -262,7 +262,7 @@ public class TspUpdateReq implements Serializable { ...@@ -262,7 +262,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getVehicleBrand() { public String getVehicleBrand() {
return vehicleBrand; return this.vehicleBrand;
} }
public void setVehicleBrand(String vehicleBrand) { public void setVehicleBrand(String vehicleBrand) {
...@@ -270,7 +270,7 @@ public class TspUpdateReq implements Serializable { ...@@ -270,7 +270,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getVehicleChildsBrandName() { public String getVehicleChildsBrandName() {
return vehicleChildsBrandName; return this.vehicleChildsBrandName;
} }
public void setVehicleChildsBrandName(String vehicleChildsBrandName) { public void setVehicleChildsBrandName(String vehicleChildsBrandName) {
...@@ -278,7 +278,7 @@ public class TspUpdateReq implements Serializable { ...@@ -278,7 +278,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getVehicleSeriesName() { public String getVehicleSeriesName() {
return vehicleSeriesName; return this.vehicleSeriesName;
} }
public void setVehicleSeriesName(String vehicleSeriesName) { public void setVehicleSeriesName(String vehicleSeriesName) {
...@@ -286,7 +286,7 @@ public class TspUpdateReq implements Serializable { ...@@ -286,7 +286,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getVehicleTypeName() { public String getVehicleTypeName() {
return vehicleTypeName; return this.vehicleTypeName;
} }
public void setVehicleTypeName(String vehicleTypeName) { public void setVehicleTypeName(String vehicleTypeName) {
...@@ -294,7 +294,7 @@ public class TspUpdateReq implements Serializable { ...@@ -294,7 +294,7 @@ public class TspUpdateReq implements Serializable {
} }
public BigDecimal getVehiclePrice() { public BigDecimal getVehiclePrice() {
return vehiclePrice; return this.vehiclePrice;
} }
public void setVehiclePrice(BigDecimal vehiclePrice) { public void setVehiclePrice(BigDecimal vehiclePrice) {
...@@ -302,7 +302,7 @@ public class TspUpdateReq implements Serializable { ...@@ -302,7 +302,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getVehicleUsage() { public String getVehicleUsage() {
return vehicleUsage; return this.vehicleUsage;
} }
public void setVehicleUsage(String vehicleUsage) { public void setVehicleUsage(String vehicleUsage) {
...@@ -310,7 +310,7 @@ public class TspUpdateReq implements Serializable { ...@@ -310,7 +310,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getShopName() { public String getShopName() {
return shopName; return this.shopName;
} }
public void setShopName(String shopName) { public void setShopName(String shopName) {
...@@ -318,7 +318,7 @@ public class TspUpdateReq implements Serializable { ...@@ -318,7 +318,7 @@ public class TspUpdateReq implements Serializable {
} }
public String getFixTime() { public String getFixTime() {
return fixTime; return this.fixTime;
} }
public void setFixTime(String fixTime) { public void setFixTime(String fixTime) {
......
package com.glsx.ordercenter.dto.insurance; package com.glsx.ordercenter.dto.resp;
import java.io.Serializable; import java.io.Serializable;
import com.glsx.excel.poi.annotation.ExcelColumn; import com.glsx.excel.poi.annotation.ExcelColumn;
import com.glsx.excel.poi.annotation.ExcelExport; import com.glsx.excel.poi.annotation.ExcelExport;
/** /**
* <p>Description: 保单列表响应体 * <p>Description: 保单相关响应体
* *
* <p>Project: car-service * <p>Project: car-service
* *
...@@ -13,7 +13,7 @@ import com.glsx.excel.poi.annotation.ExcelExport; ...@@ -13,7 +13,7 @@ import com.glsx.excel.poi.annotation.ExcelExport;
* @date 2020-05-22 * @date 2020-05-22
*/ */
@ExcelExport @ExcelExport
public class InsuranceQueryResp implements Serializable { public class InsuranceResp implements Serializable {
/** /**
* ID * ID
*/ */
...@@ -112,6 +112,22 @@ public class InsuranceQueryResp implements Serializable { ...@@ -112,6 +112,22 @@ public class InsuranceQueryResp implements Serializable {
*/ */
@ExcelColumn(value = "备注", index = 17) @ExcelColumn(value = "备注", index = 17)
private String responseData; private String responseData;
/**
* 客户类型
*/
private Byte customerType;
/**
* 联系地址
*/
private String vehicleOwnerAddress;
/**
* 车辆颜色
*/
private String vehicleColor;
/**
* PDF地址
*/
private String insurancePdf;
public Integer getId() { public Integer getId() {
return this.id; return this.id;
...@@ -273,9 +289,41 @@ public class InsuranceQueryResp implements Serializable { ...@@ -273,9 +289,41 @@ public class InsuranceQueryResp implements Serializable {
this.responseData = responseData; 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 @Override
public String toString() { public String toString() {
return "InsuranceQueryResp{" + return "InsuranceResp{" +
"id=" + this.id + "id=" + this.id +
", insuranceId='" + this.insuranceId + '\'' + ", insuranceId='" + this.insuranceId + '\'' +
", vehicleOwnerName='" + this.vehicleOwnerName + '\'' + ", vehicleOwnerName='" + this.vehicleOwnerName + '\'' +
...@@ -296,6 +344,10 @@ public class InsuranceQueryResp implements Serializable { ...@@ -296,6 +344,10 @@ public class InsuranceQueryResp implements Serializable {
", vehicleInvoiceMoney='" + this.vehicleInvoiceMoney + '\'' + ", vehicleInvoiceMoney='" + this.vehicleInvoiceMoney + '\'' +
", tastingUnit='" + this.tastingUnit + '\'' + ", tastingUnit='" + this.tastingUnit + '\'' +
", responseData='" + this.responseData + '\'' + ", responseData='" + this.responseData + '\'' +
", customerType=" + this.customerType +
", vehicleOwnerAddress='" + this.vehicleOwnerAddress + '\'' +
", vehicleColor='" + this.vehicleColor + '\'' +
", insurancePdf='" + this.insurancePdf + '\'' +
'}'; '}';
} }
} }
package com.glsx.ordercenter.dto.resp; package com.glsx.ordercenter.dto.resp;
import com.glsx.ordercenter.constants.ResultCodeEnum;
import java.io.Serializable; import java.io.Serializable;
import com.glsx.ordercenter.constants.ResultCodeEnum;
/** /**
* @author think.wang * @author think.wang
...@@ -26,6 +25,8 @@ public class OraResultObject implements Serializable { ...@@ -26,6 +25,8 @@ public class OraResultObject implements Serializable {
private String insuranceId; //保单id private String insuranceId; //保单id
public OraResultObject() { public OraResultObject() {
this.code = ResultCodeEnum.SUCCESS.getCode();
this.message = ResultCodeEnum.SUCCESS.getMsg();
} }
/** /**
...@@ -85,8 +86,12 @@ public class OraResultObject implements Serializable { ...@@ -85,8 +86,12 @@ public class OraResultObject implements Serializable {
return this; return this;
} }
public static long getSerialVersionUID() {
return serialVersionUID;
}
public int getCode() { public int getCode() {
return code; return this.code;
} }
public void setCode(int code) { public void setCode(int code) {
...@@ -94,7 +99,7 @@ public class OraResultObject implements Serializable { ...@@ -94,7 +99,7 @@ public class OraResultObject implements Serializable {
} }
public String getMessage() { public String getMessage() {
return message; return this.message;
} }
public void setMessage(String message) { public void setMessage(String message) {
...@@ -102,7 +107,7 @@ public class OraResultObject implements Serializable { ...@@ -102,7 +107,7 @@ public class OraResultObject implements Serializable {
} }
public Object getData() { public Object getData() {
return data; return this.data;
} }
public void setData(Object data) { public void setData(Object data) {
...@@ -110,17 +115,29 @@ public class OraResultObject implements Serializable { ...@@ -110,17 +115,29 @@ public class OraResultObject implements Serializable {
} }
public String getOrderId() { public String getOrderId() {
return orderId; return this.orderId;
} }
public void setOrderId(String orderId) { public void setOrderId(String orderId) {
this.orderId = orderId; this.orderId = orderId;
} }
public String getInsuranceId() {
return this.insuranceId;
}
public void setInsuranceId(String insuranceId) {
this.insuranceId = insuranceId;
}
@Override @Override
public String toString() { public String toString() {
return "ResultObject [code=" + code + ", message=" + message return "OraResultObject{" +
+ ", data=" + data + ", orderId=" + orderId + ", insuranceId=" + insuranceId+ "]"; "code=" + this.code +
", message='" + this.message + '\'' +
", data=" + this.data +
", orderId='" + this.orderId + '\'' +
", insuranceId='" + this.insuranceId + '\'' +
'}';
} }
} }
package com.glsx.ordercenter.dto.insurance; package com.glsx.ordercenter.dto.resp;
import java.io.Serializable; import java.io.Serializable;
......
package com.glsx.ordercenter.dto.insurance; package com.glsx.ordercenter.dto.resp;
import java.io.Serializable; import java.io.Serializable;
......
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; package com.glsx.ordercenter.mapper.insurance;
import java.util.List; import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy;
import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy; import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicyExample;
import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicyExample; import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
/** * <p>Description:
* <p>Description: *
* * <p>Project: car-service
* <p>Project: car-service *
* * @author wbh
* @author wbh * @date 2020-05-29
* @date 2020-05-25 */
*/
@Repository public interface SysInsurancePolicyMapper {
public interface SysInsurancePolicyMapper { long countByExample(SysInsurancePolicyExample example);
long countByExample(SysInsurancePolicyExample example);
int deleteByExample(SysInsurancePolicyExample example);
int deleteByExample(SysInsurancePolicyExample example);
int deleteByPrimaryKey(Integer id);
int deleteByPrimaryKey(Integer id);
int insert(SysInsurancePolicy record);
int insert(SysInsurancePolicy record);
int insertSelective(SysInsurancePolicy record);
int insertSelective(SysInsurancePolicy record);
List<SysInsurancePolicy> selectByExample(SysInsurancePolicyExample example);
List<SysInsurancePolicy> selectByExample(SysInsurancePolicyExample example);
SysInsurancePolicy selectByPrimaryKey(Integer id);
SysInsurancePolicy selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") SysInsurancePolicy record,
int updateByExampleSelective(@Param("record") SysInsurancePolicy record, @Param("example") SysInsurancePolicyExample example);
@Param("example") SysInsurancePolicyExample example);
int updateByExample(@Param("record") SysInsurancePolicy record,
int updateByExample(@Param("record") SysInsurancePolicy record, @Param("example") SysInsurancePolicyExample example);
@Param("example") SysInsurancePolicyExample example);
int updateByPrimaryKeySelective(SysInsurancePolicy record);
int updateByPrimaryKeySelective(SysInsurancePolicy record);
int updateByPrimaryKey(SysInsurancePolicy record);
int updateByPrimaryKey(SysInsurancePolicy record);
Long selectCount(SysInsurancePolicyExample example);
Long selectCount(SysInsurancePolicyExample example); }
}
\ No newline at end of file \ No newline at end of file
package com.glsx.ordercenter.pojo.insurance; package com.glsx.ordercenter.pojo.insurance;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
* <p>Description: * <p>Description:
* *
* <p>Project: car-service * <p>Project: car-service
* *
* @author wbh * @author wbh
* @date 2020-05-25 * @date 2020-05-29
*/ */
/**
* 保单信息表 /**
*/ * 保单信息表
public class SysInsurancePolicy { */
/** public class SysInsurancePolicy {
* ID /**
*/ * ID
private Integer id; */
private Integer id;
/**
* 第三方公司保单id /**
*/ * 第三方公司保单id
private String insuranceId; */
private String insuranceId;
/**
* 保单来源:1长城欧拉 /**
*/ * 保单来源:1长城欧拉
private Byte source; */
private Byte source;
/**
* 保险状态(1待投保 2已投保 9已退保) /**
*/ * 保险状态(1待投保 2已投保 3投保失败 9已退保)
private Byte status; */
private Byte status;
/**
* 保险公司保单号 /**
*/ * 保险公司保单号
private String insuranceNo; */
private String insuranceNo;
/**
* 保单序列号 /**
*/ * 保单序列号
private String insuranceSeqNo; */
private String insuranceSeqNo;
/**
* 保险公司名称(华安:sinosafe,富德:sinofd,阳光:sinosig,人保:picc) /**
*/ * 保险公司名称(华安:sinosafe,富德:sinofd,阳光:sinosig,人保:picc)
private String insuranceCompany; */
private String insuranceCompany;
/**
* 设备sn /**
*/ * 设备sn
private String gpsNo; */
private String gpsNo;
/**
* 设备安装时间 /**
*/ * 设备安装时间
private Date installationTime; */
private Date installationTime;
/**
* 车架号 /**
*/ * 车架号
private String vin; */
private String vin;
/**
* 车牌号 /**
*/ * 车牌号
private String vehicleNo; */
private String vehicleNo;
/**
* 发动机号 /**
*/ * 发动机号
private String engineNumber; */
private String engineNumber;
/**
* 品牌车型 /**
*/ * 品牌车型
private String carBrand; */
private String carBrand;
/**
* 车辆类型(1:新车 2:二手车 3:进口车) /**
*/ * 车辆类型(1:新车 2:二手车 3:进口车)
private Byte vehicleType; */
private Byte vehicleType;
/**
* 车主姓名 /**
*/ * 车主姓名
private String vehicleOwnerName; */
private String vehicleOwnerName;
/**
* 车主电话 /**
*/ * 车主电话
private String phone; */
private String phone;
/**
* 车主地址 /**
*/ * 车主地址
private String vehicleOwnerAddress; */
private String vehicleOwnerAddress;
/**
* 客户类型(1:个人 2:企业) /**
*/ * 客户类型(1:个人 2:企业)
private Byte customerType; */
private Byte customerType;
/**
* 证件类型(1.身份证 2.统一社会信用代码 3.其他) /**
*/ * 证件类型(1.身份证 2.统一社会信用代码 3.其他)
private Byte idCardType; */
private Byte idCardType;
/**
* 证件号码 /**
*/ * 证件号码
private String idCardNum; */
private String idCardNum;
/**
* 保险商品(1:盗抢监控服务) /**
*/ * 保险商品(1:盗抢监控服务)
private Boolean insuranceCommodity; */
private Boolean insuranceCommodity;
/**
* 险额 /**
*/ * 险额
private BigDecimal pilferInsuranceMoney; */
private BigDecimal pilferInsuranceMoney;
/**
* 保险期限(默认单位:年) /**
*/ * 保险期限(默认单位:年)
private Integer insurancePeriod; */
private Integer insurancePeriod;
/**
* 车辆颜色 /**
*/ * 车辆颜色
private String vehicleColor; */
private String vehicleColor;
/**
* 车辆价格 /**
*/ * 车辆价格
private BigDecimal vehicleInvoiceMoney; */
private BigDecimal vehicleInvoiceMoney;
/**
* 受偿单位(第一受益人) /**
*/ * 受偿单位(第一受益人)
private String tastingUnit; */
private String tastingUnit;
/**
* 备注 /**
*/ * 退保原因
private String remark; */
private String cancelReason;
/**
* 预计生效时间 /**
*/ * 备注
private Date expectedEffectiveTime; */
private String remark;
/**
* 实际生效时间 /**
*/ * 预计生效时间
private Date realEffectiveTime; */
private Date expectedEffectiveTime;
/**
* 保单信息地址 /**
*/ * 实际生效时间
private String insurancePdf; */
private Date realEffectiveTime;
/**
* 创建时间 /**
*/ * 保单信息地址
private Date createTime; */
private String insurancePdf;
/**
* 更新时间 /**
*/ * 创建时间
private Date updateTime; */
private Date createTime;
/**
* 创建人 /**
*/ * 更新时间
private Integer createBy; */
private Date updateTime;
/**
* 更新人 /**
*/ * 创建人
private Integer updateBy; */
private Integer createBy;
/**
* 第三方公司接口传入数据 /**
*/ * 更新人
private String responseData; */
private Integer updateBy;
public Integer getId() {
return this.id; /**
} * 第三方公司接口传入数据
*/
public void setId(Integer id) { private String responseData;
this.id = id;
} public Integer getId() {
return this.id;
public String getInsuranceId() { }
return this.insuranceId;
} public void setId(Integer id) {
this.id = id;
public void setInsuranceId(String insuranceId) { }
this.insuranceId = insuranceId;
} public String getInsuranceId() {
return this.insuranceId;
public Byte getSource() { }
return this.source;
} public void setInsuranceId(String insuranceId) {
this.insuranceId = insuranceId;
public void setSource(Byte source) { }
this.source = source;
} public Byte getSource() {
return this.source;
public Byte getStatus() { }
return this.status;
} public void setSource(Byte source) {
this.source = source;
public void setStatus(Byte status) { }
this.status = status;
} public Byte getStatus() {
return this.status;
public String getInsuranceNo() { }
return this.insuranceNo;
} public void setStatus(Byte status) {
this.status = status;
public void setInsuranceNo(String insuranceNo) { }
this.insuranceNo = insuranceNo;
} public String getInsuranceNo() {
return this.insuranceNo;
public String getInsuranceSeqNo() { }
return this.insuranceSeqNo;
} public void setInsuranceNo(String insuranceNo) {
this.insuranceNo = insuranceNo;
public void setInsuranceSeqNo(String insuranceSeqNo) { }
this.insuranceSeqNo = insuranceSeqNo;
} public String getInsuranceSeqNo() {
return this.insuranceSeqNo;
public String getInsuranceCompany() { }
return this.insuranceCompany;
} public void setInsuranceSeqNo(String insuranceSeqNo) {
this.insuranceSeqNo = insuranceSeqNo;
public void setInsuranceCompany(String insuranceCompany) { }
this.insuranceCompany = insuranceCompany;
} public String getInsuranceCompany() {
return this.insuranceCompany;
public String getGpsNo() { }
return this.gpsNo;
} public void setInsuranceCompany(String insuranceCompany) {
this.insuranceCompany = insuranceCompany;
public void setGpsNo(String gpsNo) { }
this.gpsNo = gpsNo;
} public String getGpsNo() {
return this.gpsNo;
public Date getInstallationTime() { }
return this.installationTime;
} public void setGpsNo(String gpsNo) {
this.gpsNo = gpsNo;
public void setInstallationTime(Date installationTime) { }
this.installationTime = installationTime;
} public Date getInstallationTime() {
return this.installationTime;
public String getVin() { }
return this.vin;
} public void setInstallationTime(Date installationTime) {
this.installationTime = installationTime;
public void setVin(String vin) { }
this.vin = vin;
} public String getVin() {
return this.vin;
public String getVehicleNo() { }
return this.vehicleNo;
} public void setVin(String vin) {
this.vin = vin;
public void setVehicleNo(String vehicleNo) { }
this.vehicleNo = vehicleNo;
} public String getVehicleNo() {
return this.vehicleNo;
public String getEngineNumber() { }
return this.engineNumber;
} public void setVehicleNo(String vehicleNo) {
this.vehicleNo = vehicleNo;
public void setEngineNumber(String engineNumber) { }
this.engineNumber = engineNumber;
} public String getEngineNumber() {
return this.engineNumber;
public String getCarBrand() { }
return this.carBrand;
} public void setEngineNumber(String engineNumber) {
this.engineNumber = engineNumber;
public void setCarBrand(String carBrand) { }
this.carBrand = carBrand;
} public String getCarBrand() {
return this.carBrand;
public Byte getVehicleType() { }
return this.vehicleType;
} public void setCarBrand(String carBrand) {
this.carBrand = carBrand;
public void setVehicleType(Byte vehicleType) { }
this.vehicleType = vehicleType;
} public Byte getVehicleType() {
return this.vehicleType;
public String getVehicleOwnerName() { }
return this.vehicleOwnerName;
} public void setVehicleType(Byte vehicleType) {
this.vehicleType = vehicleType;
public void setVehicleOwnerName(String vehicleOwnerName) { }
this.vehicleOwnerName = vehicleOwnerName;
} public String getVehicleOwnerName() {
return this.vehicleOwnerName;
public String getPhone() { }
return this.phone;
} public void setVehicleOwnerName(String vehicleOwnerName) {
this.vehicleOwnerName = vehicleOwnerName;
public void setPhone(String phone) { }
this.phone = phone;
} public String getPhone() {
return this.phone;
public String getVehicleOwnerAddress() { }
return this.vehicleOwnerAddress;
} public void setPhone(String phone) {
this.phone = phone;
public void setVehicleOwnerAddress(String vehicleOwnerAddress) { }
this.vehicleOwnerAddress = vehicleOwnerAddress;
} public String getVehicleOwnerAddress() {
return this.vehicleOwnerAddress;
public Byte getCustomerType() { }
return this.customerType;
} public void setVehicleOwnerAddress(String vehicleOwnerAddress) {
this.vehicleOwnerAddress = vehicleOwnerAddress;
public void setCustomerType(Byte customerType) { }
this.customerType = customerType;
} public Byte getCustomerType() {
return this.customerType;
public Byte getIdCardType() { }
return this.idCardType;
} public void setCustomerType(Byte customerType) {
this.customerType = customerType;
public void setIdCardType(Byte idCardType) { }
this.idCardType = idCardType;
} public Byte getIdCardType() {
return this.idCardType;
public String getIdCardNum() { }
return this.idCardNum;
} public void setIdCardType(Byte idCardType) {
this.idCardType = idCardType;
public void setIdCardNum(String idCardNum) { }
this.idCardNum = idCardNum;
} public String getIdCardNum() {
return this.idCardNum;
public Boolean getInsuranceCommodity() { }
return this.insuranceCommodity;
} public void setIdCardNum(String idCardNum) {
this.idCardNum = idCardNum;
public void setInsuranceCommodity(Boolean insuranceCommodity) { }
this.insuranceCommodity = insuranceCommodity;
} public Boolean getInsuranceCommodity() {
return this.insuranceCommodity;
public BigDecimal getPilferInsuranceMoney() { }
return this.pilferInsuranceMoney;
} public void setInsuranceCommodity(Boolean insuranceCommodity) {
this.insuranceCommodity = insuranceCommodity;
public void setPilferInsuranceMoney(BigDecimal pilferInsuranceMoney) { }
this.pilferInsuranceMoney = pilferInsuranceMoney;
} public BigDecimal getPilferInsuranceMoney() {
return this.pilferInsuranceMoney;
public Integer getInsurancePeriod() { }
return this.insurancePeriod;
} public void setPilferInsuranceMoney(BigDecimal pilferInsuranceMoney) {
this.pilferInsuranceMoney = pilferInsuranceMoney;
public void setInsurancePeriod(Integer insurancePeriod) { }
this.insurancePeriod = insurancePeriod;
} public Integer getInsurancePeriod() {
return this.insurancePeriod;
public String getVehicleColor() { }
return this.vehicleColor;
} public void setInsurancePeriod(Integer insurancePeriod) {
this.insurancePeriod = insurancePeriod;
public void setVehicleColor(String vehicleColor) { }
this.vehicleColor = vehicleColor;
} public String getVehicleColor() {
return this.vehicleColor;
public BigDecimal getVehicleInvoiceMoney() { }
return this.vehicleInvoiceMoney;
} public void setVehicleColor(String vehicleColor) {
this.vehicleColor = vehicleColor;
public void setVehicleInvoiceMoney(BigDecimal vehicleInvoiceMoney) { }
this.vehicleInvoiceMoney = vehicleInvoiceMoney;
} public BigDecimal getVehicleInvoiceMoney() {
return this.vehicleInvoiceMoney;
public String getTastingUnit() { }
return this.tastingUnit;
} public void setVehicleInvoiceMoney(BigDecimal vehicleInvoiceMoney) {
this.vehicleInvoiceMoney = vehicleInvoiceMoney;
public void setTastingUnit(String tastingUnit) { }
this.tastingUnit = tastingUnit;
} public String getTastingUnit() {
return this.tastingUnit;
public String getRemark() { }
return this.remark;
} public void setTastingUnit(String tastingUnit) {
this.tastingUnit = tastingUnit;
public void setRemark(String remark) { }
this.remark = remark;
} public String getCancelReason() {
return this.cancelReason;
public Date getExpectedEffectiveTime() { }
return this.expectedEffectiveTime;
} public void setCancelReason(String cancelReason) {
this.cancelReason = cancelReason;
public void setExpectedEffectiveTime(Date expectedEffectiveTime) { }
this.expectedEffectiveTime = expectedEffectiveTime;
} public String getRemark() {
return this.remark;
public Date getRealEffectiveTime() { }
return this.realEffectiveTime;
} public void setRemark(String remark) {
this.remark = remark;
public void setRealEffectiveTime(Date realEffectiveTime) { }
this.realEffectiveTime = realEffectiveTime;
} public Date getExpectedEffectiveTime() {
return this.expectedEffectiveTime;
public String getInsurancePdf() { }
return this.insurancePdf;
} public void setExpectedEffectiveTime(Date expectedEffectiveTime) {
this.expectedEffectiveTime = expectedEffectiveTime;
public void setInsurancePdf(String insurancePdf) { }
this.insurancePdf = insurancePdf;
} public Date getRealEffectiveTime() {
return this.realEffectiveTime;
public Date getCreateTime() { }
return this.createTime;
} public void setRealEffectiveTime(Date realEffectiveTime) {
this.realEffectiveTime = realEffectiveTime;
public void setCreateTime(Date createTime) { }
this.createTime = createTime;
} public String getInsurancePdf() {
return this.insurancePdf;
public Date getUpdateTime() { }
return this.updateTime;
} public void setInsurancePdf(String insurancePdf) {
this.insurancePdf = insurancePdf;
public void setUpdateTime(Date updateTime) { }
this.updateTime = updateTime;
} public Date getCreateTime() {
return this.createTime;
public Integer getCreateBy() { }
return this.createBy;
} public void setCreateTime(Date createTime) {
this.createTime = createTime;
public void setCreateBy(Integer createBy) { }
this.createBy = createBy;
} public Date getUpdateTime() {
return this.updateTime;
public Integer getUpdateBy() { }
return this.updateBy;
} public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
public void setUpdateBy(Integer updateBy) { }
this.updateBy = updateBy;
} public Integer getCreateBy() {
return this.createBy;
public String getResponseData() { }
return this.responseData;
} public void setCreateBy(Integer createBy) {
this.createBy = createBy;
public void setResponseData(String responseData) { }
this.responseData = responseData;
} public Integer getUpdateBy() {
return this.updateBy;
@Override }
public String toString() {
return "SysInsurancePolicy{" + public void setUpdateBy(Integer updateBy) {
"id=" + this.id + this.updateBy = updateBy;
", insuranceId='" + this.insuranceId + '\'' + }
", source=" + this.source +
", status=" + this.status + public String getResponseData() {
", insuranceNo='" + this.insuranceNo + '\'' + return this.responseData;
", insuranceSeqNo='" + this.insuranceSeqNo + '\'' + }
", insuranceCompany='" + this.insuranceCompany + '\'' +
", gpsNo='" + this.gpsNo + '\'' + public void setResponseData(String responseData) {
", installationTime=" + this.installationTime + this.responseData = responseData;
", vin='" + this.vin + '\'' + }
", vehicleNo='" + this.vehicleNo + '\'' +
", engineNumber='" + this.engineNumber + '\'' + @Override
", carBrand='" + this.carBrand + '\'' + public String toString() {
", vehicleType=" + this.vehicleType + return "SysInsurancePolicy{" +
", vehicleOwnerName='" + this.vehicleOwnerName + '\'' + "id=" + this.id +
", phone='" + this.phone + '\'' + ", insuranceId='" + this.insuranceId + '\'' +
", vehicleOwnerAddress='" + this.vehicleOwnerAddress + '\'' + ", source=" + this.source +
", customerType=" + this.customerType + ", status=" + this.status +
", idCardType=" + this.idCardType + ", insuranceNo='" + this.insuranceNo + '\'' +
", idCardNum='" + this.idCardNum + '\'' + ", insuranceSeqNo='" + this.insuranceSeqNo + '\'' +
", insuranceCommodity=" + this.insuranceCommodity + ", insuranceCompany='" + this.insuranceCompany + '\'' +
", pilferInsuranceMoney=" + this.pilferInsuranceMoney + ", gpsNo='" + this.gpsNo + '\'' +
", insurancePeriod=" + this.insurancePeriod + ", installationTime=" + this.installationTime +
", vehicleColor='" + this.vehicleColor + '\'' + ", vin='" + this.vin + '\'' +
", vehicleInvoiceMoney=" + this.vehicleInvoiceMoney + ", vehicleNo='" + this.vehicleNo + '\'' +
", tastingUnit='" + this.tastingUnit + '\'' + ", engineNumber='" + this.engineNumber + '\'' +
", remark='" + this.remark + '\'' + ", carBrand='" + this.carBrand + '\'' +
", expectedEffectiveTime=" + this.expectedEffectiveTime + ", vehicleType=" + this.vehicleType +
", realEffectiveTime=" + this.realEffectiveTime + ", vehicleOwnerName='" + this.vehicleOwnerName + '\'' +
", insurancePdf='" + this.insurancePdf + '\'' + ", phone='" + this.phone + '\'' +
", createTime=" + this.createTime + ", vehicleOwnerAddress='" + this.vehicleOwnerAddress + '\'' +
", updateTime=" + this.updateTime + ", customerType=" + this.customerType +
", createBy=" + this.createBy + ", idCardType=" + this.idCardType +
", updateBy=" + this.updateBy + ", idCardNum='" + this.idCardNum + '\'' +
", responseData='" + this.responseData + '\'' + ", insuranceCommodity=" + this.insuranceCommodity +
'}'; ", pilferInsuranceMoney=" + this.pilferInsuranceMoney +
} ", insurancePeriod=" + this.insurancePeriod +
} ", vehicleColor='" + this.vehicleColor + '\'' +
", vehicleInvoiceMoney=" + this.vehicleInvoiceMoney +
", tastingUnit='" + this.tastingUnit + '\'' +
", cancelReason='" + this.cancelReason + '\'' +
", remark='" + this.remark + '\'' +
", expectedEffectiveTime=" + this.expectedEffectiveTime +
", realEffectiveTime=" + this.realEffectiveTime +
", insurancePdf='" + this.insurancePdf + '\'' +
", createTime=" + this.createTime +
", updateTime=" + this.updateTime +
", createBy=" + this.createBy +
", updateBy=" + this.updateBy +
", responseData='" + this.responseData + '\'' +
'}';
}
}
...@@ -11,7 +11,7 @@ import java.util.List; ...@@ -11,7 +11,7 @@ import java.util.List;
* <p>Project: car-service * <p>Project: car-service
* *
* @author wbh * @author wbh
* @date 2020-05-25 * @date 2020-05-29
*/ */
public class SysInsurancePolicyExample { public class SysInsurancePolicyExample {
...@@ -1825,6 +1825,76 @@ public class SysInsurancePolicyExample { ...@@ -1825,6 +1825,76 @@ public class SysInsurancePolicyExample {
return (Criteria) this; 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() { public Criteria andRemarkIsNull() {
this.addCriterion("remark is null"); this.addCriterion("remark is null");
return (Criteria) this; return (Criteria) this;
......
package com.glsx.ordercenter.service.common; package com.glsx.ordercenter.service;
import com.glsx.ordercenter.utils.LogUtils; import com.glsx.ordercenter.utils.LogUtils;
......
package com.glsx.ordercenter.service.insurance; package com.glsx.ordercenter.service;
import com.glsx.ordercenter.dto.common.PagedOrderResponse; import com.glsx.common.pojo.PagedResp;
import com.glsx.ordercenter.dto.insurance.InsuranceDetailReq; import com.glsx.ordercenter.dto.req.InsuranceReq;
import com.glsx.ordercenter.dto.insurance.InsuranceDetailResp; import com.glsx.ordercenter.dto.resp.InsuranceResp;
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;
/** /**
* <p>Description: 保单列表查询 * <p>Description: 保单列表查询
...@@ -20,32 +16,32 @@ public interface InsuranceService { ...@@ -20,32 +16,32 @@ public interface InsuranceService {
/** /**
* 保单列表查询 * 保单列表查询
* *
* @param insuranceQueryReq 请求体 * @param insuranceReq 请求体
* @return 分页后的列表数据 * @return 分页后的列表数据
*/ */
PagedOrderResponse<InsuranceQueryResp> query(InsuranceQueryReq insuranceQueryReq); PagedResp<InsuranceResp> query(InsuranceReq insuranceReq);
/** /**
* 保单详情查询 * 保单详情查询
* *
* @param insuranceDetailReq 请求体 * @param insuranceReq 请求体
* @return 分页后的详情数据 * @return 分页后的详情数据
*/ */
PagedOrderResponse<InsuranceDetailResp> detail(InsuranceDetailReq insuranceDetailReq); PagedResp<InsuranceResp> detail(InsuranceReq insuranceReq);
/** /**
* 保单下载 * 保单下载
* *
* @param insuranceDetailReq 请求体 * @param insuranceReq 请求体
* @return 保单详情,包含保单PDF地址 * @return 保单详情,包含保单PDF地址
*/ */
InsuranceDetailResp download(InsuranceDetailReq insuranceDetailReq); InsuranceResp download(InsuranceReq insuranceReq);
/** /**
* 退保 * 退保
* *
* @param insuranceRefundReq 请求体 * @param insuranceReq 请求体
* @return 退保结果 * @return 退保结果
*/ */
InsuranceRefundResp refund(InsuranceRefundReq insuranceRefundReq); InsuranceResp refund(InsuranceReq insuranceReq);
} }
package com.glsx.ordercenter.service.api; package com.glsx.ordercenter.service.api;
import com.glsx.ordercenter.dto.api.OraInsuranceRefundReq; import com.glsx.ordercenter.dto.req.OraInsuranceRefundReq;
import com.glsx.ordercenter.dto.api.OraInsuranceRefundResp; import com.glsx.ordercenter.dto.req.OraInsuranceUpdateReq;
import com.glsx.ordercenter.dto.api.OraInsuranceUpdateReq; import com.glsx.ordercenter.dto.resp.OraResultObject;
import com.glsx.ordercenter.dto.api.OraInsuranceUpdateResp;
/** /**
* <p>Description: * <p>Description:
...@@ -20,7 +19,7 @@ public interface OraInsuranceService { ...@@ -20,7 +19,7 @@ public interface OraInsuranceService {
* @param insuranceUpdateReq 请求体 * @param insuranceUpdateReq 请求体
* @return 更新结果 * @return 更新结果
*/ */
OraInsuranceUpdateResp update(OraInsuranceUpdateReq insuranceUpdateReq); OraResultObject update(OraInsuranceUpdateReq insuranceUpdateReq);
/** /**
* 长城欧拉-退保 * 长城欧拉-退保
...@@ -28,5 +27,5 @@ public interface OraInsuranceService { ...@@ -28,5 +27,5 @@ public interface OraInsuranceService {
* @param insuranceRefundReq 请求体 * @param insuranceRefundReq 请求体
* @return 退保结果 * @return 退保结果
*/ */
OraInsuranceRefundResp refund(OraInsuranceRefundReq insuranceRefundReq); OraResultObject refund(OraInsuranceRefundReq insuranceRefundReq);
} }
package com.glsx.ordercenter.service.api.impl; package com.glsx.ordercenter.service.api.impl;
import java.util.Date;
import java.util.List;
import com.glsx.common.utils.UserUtils; import com.glsx.common.utils.UserUtils;
import com.glsx.ordercenter.config.ThreadPoolConfig; import com.glsx.ordercenter.config.ThreadPoolConfig;
import com.glsx.ordercenter.constants.insurance.InsuranceCardType; import com.glsx.ordercenter.constants.insurance.InsuranceCardType;
import com.glsx.ordercenter.constants.insurance.InsuranceCustomerType; import com.glsx.ordercenter.constants.insurance.InsuranceCustomerType;
import com.glsx.ordercenter.constants.insurance.InsuranceStatus; import com.glsx.ordercenter.constants.insurance.InsuranceStatus;
import com.glsx.ordercenter.constants.insurance.OraResultCode; import com.glsx.ordercenter.constants.insurance.OraResultCode;
import com.glsx.ordercenter.dto.api.OraInsuranceRefundReq; import com.glsx.ordercenter.dto.req.OraInsuranceRefundReq;
import com.glsx.ordercenter.dto.api.OraInsuranceRefundResp; import com.glsx.ordercenter.dto.req.OraInsuranceUpdateReq;
import com.glsx.ordercenter.dto.api.OraInsuranceUpdateReq; import com.glsx.ordercenter.dto.resp.OraResultObject;
import com.glsx.ordercenter.dto.api.OraInsuranceUpdateResp; import com.glsx.ordercenter.exception.SysException;
import com.glsx.ordercenter.exception.insurance.OraBizException;
import com.glsx.ordercenter.mapper.insurance.SysInsurancePolicyMapper; import com.glsx.ordercenter.mapper.insurance.SysInsurancePolicyMapper;
import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy; import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy;
import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicyExample; 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.api.OraInsuranceService;
import com.glsx.ordercenter.service.common.BaseOrderService;
import com.glsx.ordercenter.utils.EmilUtils; import com.glsx.ordercenter.utils.EmilUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -24,9 +25,6 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -24,9 +25,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.Date;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* *
...@@ -36,8 +34,7 @@ import java.util.List; ...@@ -36,8 +34,7 @@ import java.util.List;
* @date 2020-05-25 * @date 2020-05-25
*/ */
@Service @Service
public class OraInsuranceServiceImpl extends BaseOrderService public class OraInsuranceServiceImpl extends BaseOrderService implements OraInsuranceService {
implements OraInsuranceService {
@Autowired @Autowired
private ThreadPoolConfig taskExecutor; private ThreadPoolConfig taskExecutor;
...@@ -48,40 +45,38 @@ public class OraInsuranceServiceImpl extends BaseOrderService ...@@ -48,40 +45,38 @@ public class OraInsuranceServiceImpl extends BaseOrderService
private SysInsurancePolicyMapper insurancePolicyMapper; private SysInsurancePolicyMapper insurancePolicyMapper;
@Override @Override
public OraInsuranceUpdateResp update(OraInsuranceUpdateReq insuranceUpdateReq) { public OraResultObject update(OraInsuranceUpdateReq updateReq) {
super.logInfo("长城欧拉修改保单-参数", insuranceUpdateReq); super.logInfo("长城欧拉修改保单-参数", updateReq);
OraInsuranceUpdateResp insuranceUpdateResp; OraResultObject result;
SysInsurancePolicy insurancePolicy = this.getInsurancePolicy( SysInsurancePolicy insurancePolicy = this.getInsurancePolicy(updateReq.getInsuranceId());
insuranceUpdateReq.getInsuranceId()); String title = this.buildUpdateMailTitle(updateReq);
String title = this.buildUpdateMailTitle(insuranceUpdateReq); String content = this.buildUpdateMailContent(updateReq, insurancePolicy);
String content = this.buildUpdateMailContent(insuranceUpdateReq, insurancePolicy);
this.sendMail(title, content); this.sendMail(title, content);
insuranceUpdateResp = this.getUpdateResult(insurancePolicy); result = this.getUpdateResult(insurancePolicy);
super.logInfo("长城欧拉修改保单-结果", insuranceUpdateResp); super.logInfo("长城欧拉修改保单-结果", result);
return insuranceUpdateResp; return result;
} }
@Override @Override
public OraInsuranceRefundResp refund(OraInsuranceRefundReq insuranceRefundReq) { public OraResultObject refund(OraInsuranceRefundReq refundReq) {
super.logInfo("长城欧拉退保-参数", insuranceRefundReq); super.logInfo("长城欧拉退保-参数", refundReq);
OraInsuranceRefundResp insuranceRefundResp; OraResultObject result;
SysInsurancePolicy insurancePolicy = this.getInsurancePolicy( SysInsurancePolicy insurancePolicy = this.getInsurancePolicy(refundReq.getInsuranceId());
insuranceRefundReq.getInsuranceId()); String title = this.buildRefundMailTitle(refundReq);
String title = this.buildRefundMailTitle(insuranceRefundReq); String content = this.buildRefundMailContent(refundReq, insurancePolicy);
String content = this.buildRefundMailContent(insuranceRefundReq, insurancePolicy);
this.sendMail(title, content); this.sendMail(title, content);
this.updateInsurancePolicy(insurancePolicy); 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) { private SysInsurancePolicy getInsurancePolicy(String insuranceId) {
...@@ -90,10 +85,10 @@ public class OraInsuranceServiceImpl extends BaseOrderService ...@@ -90,10 +85,10 @@ public class OraInsuranceServiceImpl extends BaseOrderService
byInsuranceId.andInsuranceIdEqualTo(insuranceId); byInsuranceId.andInsuranceIdEqualTo(insuranceId);
List<SysInsurancePolicy> insurancePolicyList = List<SysInsurancePolicy> insurancePolicyList =
this.insurancePolicyMapper.selectByExample(example); this.insurancePolicyMapper.selectByExample(example);
if (insurancePolicyList.isEmpty()) { if (insurancePolicyList.isEmpty()) {
throw new OraBizException(OraResultCode.PARAM_ERROR, "保单不存在"); throw SysException.create(OraResultCode.PARAM_ERROR.getCode(), "保单不存在");
} }
return insurancePolicyList.get(0); return insurancePolicyList.get(0);
...@@ -108,129 +103,129 @@ public class OraInsuranceServiceImpl extends BaseOrderService ...@@ -108,129 +103,129 @@ public class OraInsuranceServiceImpl extends BaseOrderService
} }
private String buildUpdateMailContent(OraInsuranceUpdateReq insuranceUpdateReq, private String buildUpdateMailContent(OraInsuranceUpdateReq insuranceUpdateReq,
SysInsurancePolicy insurancePolicy) { SysInsurancePolicy insurancePolicy) {
String content = "<table>" + String content = "<table>" +
"<tr>" + "<tr>" +
" <td>" + "客户类型" + "</td>" + " <td>" + "客户类型" + "</td>" +
" <td>" + InsuranceCustomerType.INDIVIDUAL.getTypeText() + "</td>" + " <td>" + InsuranceCustomerType.INDIVIDUAL.getTypeText() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "客户姓名" + "</td>" + " <td>" + "客户姓名" + "</td>" +
" <td>" + insuranceUpdateReq.getVehicleOwnerName() + "</td>" + " <td>" + insuranceUpdateReq.getVehicleOwnerName() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "证件类型" + "</td>" + " <td>" + "证件类型" + "</td>" +
" <td>" + InsuranceCardType.ID_CARD.getTypeText() + "</td>" + " <td>" + InsuranceCardType.ID_CARD.getTypeText() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "证件号码" + "</td>" + " <td>" + "证件号码" + "</td>" +
" <td>" + insuranceUpdateReq.getIdCardNum() + "</td>" + " <td>" + insuranceUpdateReq.getIdCardNum() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "联系方式" + "</td>" + " <td>" + "联系方式" + "</td>" +
" <td>" + insuranceUpdateReq.getPhone() + "</td>" + " <td>" + insuranceUpdateReq.getPhone() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "联系地址" + "</td>" + " <td>" + "联系地址" + "</td>" +
" <td>" + insuranceUpdateReq.getVehicleOwnerAddress() + "</td>" + " <td>" + insuranceUpdateReq.getVehicleOwnerAddress() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "设备信息" + "</td>" + " <td>" + "设备信息" + "</td>" +
" <td>" + insuranceUpdateReq.getGpsNo() + "</td>" + " <td>" + insuranceUpdateReq.getGpsNo() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "车辆价格" + "</td>" + " <td>" + "车辆价格" + "</td>" +
" <td>" + insuranceUpdateReq.getVehicleInvoiceMoney() + "</td>" + " <td>" + insuranceUpdateReq.getVehicleInvoiceMoney() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "车架号" + "</td>" + " <td>" + "车架号" + "</td>" +
" <td>" + insuranceUpdateReq.getVin() + "</td>" + " <td>" + insuranceUpdateReq.getVin() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "品牌车型" + "</td>" + " <td>" + "品牌车型" + "</td>" +
" <td>" + insuranceUpdateReq.getCarBrand() + "</td>" + " <td>" + insuranceUpdateReq.getCarBrand() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "发动机号" + "</td>" + " <td>" + "发动机号" + "</td>" +
" <td>" + insuranceUpdateReq.getEngineNumber() + "</td>" + " <td>" + insuranceUpdateReq.getEngineNumber() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "安装日期" + "</td>" + " <td>" + "安装日期" + "</td>" +
" <td>" + insuranceUpdateReq.getInstallationTime() + "</td>" + " <td>" + insuranceUpdateReq.getInstallationTime() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "生效日期" + "</td>" + " <td>" + "生效日期" + "</td>" +
" <td>" + insurancePolicy.getExpectedEffectiveTime() + "</td>" + " <td>" + insurancePolicy.getExpectedEffectiveTime() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "车身颜色" + "</td>" + " <td>" + "车身颜色" + "</td>" +
" <td>" + "其他" + "</td>" + " <td>" + "其他" + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "车牌号码" + "</td>" + " <td>" + "车牌号码" + "</td>" +
" <td>" + insuranceUpdateReq.getVehicleNo() + "</td>" + " <td>" + insuranceUpdateReq.getVehicleNo() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "保单年限" + "</td>" + " <td>" + "保单年限" + "</td>" +
" <td>" + insuranceUpdateReq.getInsurancePeriod() + " 年</td>" + " <td>" + insuranceUpdateReq.getInsurancePeriod() + " 年</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "第一受益人" + "</td>" + " <td>" + "第一受益人" + "</td>" +
" <td>" + insuranceUpdateReq.getTastingUnit() + "</td>" + " <td>" + insuranceUpdateReq.getTastingUnit() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "保单PDF地址" + "</td>" + " <td>" + "保单PDF地址" + "</td>" +
" <td>" + insurancePolicy.getInsurancePdf() + "</td>" + " <td>" + insurancePolicy.getInsurancePdf() + "</td>" +
"</tr>" + "</tr>" +
"</table>"; "</table>";
super.logInfo("长城欧拉修改保单-邮件内容", content); super.logInfo("长城欧拉修改保单-邮件内容", content);
return content; return content;
} }
private String buildRefundMailTitle(OraInsuranceRefundReq insuranceRefundReq) { private String buildRefundMailTitle(OraInsuranceRefundReq refundReq) {
String title; String title;
title = "包活干保单退保申请:" + insuranceRefundReq.getInsuranceId(); title = "包活干保单退保申请:" + refundReq.getInsuranceId();
return title; return title;
} }
private String buildRefundMailContent(OraInsuranceRefundReq insuranceRefundReq, private String buildRefundMailContent(OraInsuranceRefundReq refundReq,
SysInsurancePolicy insurancePolicy) { SysInsurancePolicy insurancePolicy) {
String content = "<table>" + String content = "<table>" +
"<tr>" + "<tr>" +
" <td>" + "第三方ID" + "</td>" + " <td>" + "第三方ID" + "</td>" +
" <td>" + insurancePolicy.getInsuranceId() + "</td>" + " <td>" + insurancePolicy.getInsuranceId() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "客户姓名" + "</td>" + " <td>" + "客户姓名" + "</td>" +
" <td>" + insurancePolicy.getVehicleOwnerName() + "</td>" + " <td>" + insurancePolicy.getVehicleOwnerName() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "车架号" + "</td>" + " <td>" + "车架号" + "</td>" +
" <td>" + insurancePolicy.getVin() + "</td>" + " <td>" + insurancePolicy.getVin() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "设备号" + "</td>" + " <td>" + "设备号" + "</td>" +
" <td>" + insurancePolicy.getGpsNo() + "</td>" + " <td>" + insurancePolicy.getGpsNo() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "状态" + "</td>" + " <td>" + "状态" + "</td>" +
" <td>" + InsuranceStatus.getStatusText(insurancePolicy.getStatus()) + "</td>" + " <td>" + InsuranceStatus.getStatusText(insurancePolicy.getStatus()) + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "提交日期" + "</td>" + " <td>" + "提交日期" + "</td>" +
" <td>" + insurancePolicy.getCreateTime() + "</td>" + " <td>" + insurancePolicy.getCreateTime() + "</td>" +
"</tr>" + "</tr>" +
"<tr>" + "<tr>" +
" <td>" + "生效日期" + "</td>" + " <td>" + "生效日期" + "</td>" +
" <td>" + insurancePolicy.getExpectedEffectiveTime() + "</td>" + " <td>" + insurancePolicy.getExpectedEffectiveTime() + "</td>" +
"</tr>" + "</tr>" +
"</table>"; "</table>";
super.logInfo("长城欧拉退保-邮件内容", content); super.logInfo("长城欧拉退保-邮件内容", content);
...@@ -238,7 +233,7 @@ public class OraInsuranceServiceImpl extends BaseOrderService ...@@ -238,7 +233,7 @@ public class OraInsuranceServiceImpl extends BaseOrderService
} }
private void sendMail(String title, String content) { private void sendMail(String title, String content) {
taskExecutor.defaultThreadPool().execute(() -> { this.taskExecutor.defaultThreadPool().execute(() -> {
try { try {
EmilUtils.sendEmail(this.mailUserName, title, content); EmilUtils.sendEmail(this.mailUserName, title, content);
} catch (Exception e) { } catch (Exception e) {
...@@ -247,18 +242,18 @@ public class OraInsuranceServiceImpl extends BaseOrderService ...@@ -247,18 +242,18 @@ public class OraInsuranceServiceImpl extends BaseOrderService
}); });
} }
private OraInsuranceUpdateResp getUpdateResult(SysInsurancePolicy insurancePolicy) { private OraResultObject getUpdateResult(SysInsurancePolicy insurancePolicy) {
OraInsuranceUpdateResp insuranceUpdateResp = new OraInsuranceUpdateResp(); OraResultObject result = new OraResultObject();
insuranceUpdateResp.setInsuranceId(insurancePolicy.getInsuranceId()); result.setInsuranceId(insurancePolicy.getInsuranceId());
return insuranceUpdateResp; return result;
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int updateInsurancePolicy(SysInsurancePolicy insurancePolicy) { public int updateInsurancePolicy(SysInsurancePolicy insurancePolicy) {
ServletRequestAttributes attributes = ServletRequestAttributes attributes =
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
insurancePolicy.setStatus(InsuranceStatus.REFUNDED.getStatus().byteValue()); insurancePolicy.setStatus(InsuranceStatus.REFUNDED.getStatus().byteValue());
insurancePolicy.setUpdateTime(new Date()); insurancePolicy.setUpdateTime(new Date());
...@@ -270,9 +265,11 @@ public class OraInsuranceServiceImpl extends BaseOrderService ...@@ -270,9 +265,11 @@ public class OraInsuranceServiceImpl extends BaseOrderService
return this.insurancePolicyMapper.updateByPrimaryKeySelective(insurancePolicy); return this.insurancePolicyMapper.updateByPrimaryKeySelective(insurancePolicy);
} }
public OraInsuranceRefundResp getRefundResult(SysInsurancePolicy insurancePolicy) { public OraResultObject getRefundResult(SysInsurancePolicy insurancePolicy) {
OraInsuranceRefundResp insuranceRefundResp = new OraInsuranceRefundResp(); OraResultObject result = new OraResultObject();
insuranceRefundResp.setInsuranceId(insurancePolicy.getInsuranceId());
return insuranceRefundResp; result.setInsuranceId(insurancePolicy.getInsuranceId());
return result;
} }
} }
package com.glsx.ordercenter.service.impl;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.glsx.common.pojo.PagedReq;
import com.glsx.common.pojo.PagedResp;
import com.glsx.common.utils.DateUtil;
import com.glsx.common.utils.UserUtils;
import com.glsx.ordercenter.constants.ResultCodeEnum;
import com.glsx.ordercenter.constants.insurance.InsuranceCardType;
import com.glsx.ordercenter.constants.insurance.InsuranceStatus;
import com.glsx.ordercenter.constants.insurance.TspResultCode;
import com.glsx.ordercenter.dto.req.InsuranceReq;
import com.glsx.ordercenter.dto.req.TspRefundReq;
import com.glsx.ordercenter.dto.resp.InsuranceResp;
import com.glsx.ordercenter.dto.resp.TspResp;
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.InsuranceService;
import com.glsx.ordercenter.utils.TspApiInvoker;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
/**
* <p>Description: 保险Service
*
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-22
*/
@Service
public class InsuranceServiceImpl extends BaseOrderService implements InsuranceService {
/**
* 排序
*/
private static final String ORDER_CLAUSE = "create_time DESC";
/**
* 一星期的毫秒数
*/
private static final Long MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000L;
@Autowired
private SysInsurancePolicyMapper insurancePolicyMapper;
@Autowired
private TspApiInvoker tspApiInvoker;
@Value("${ora.appKey}")
private String appKey;
@Value("${ora.appSecret}")
private String secret;
@Override
public PagedResp<InsuranceResp> query(InsuranceReq insuranceReq) {
super.logInfo("保单列表查询-参数", insuranceReq);
PagedResp<InsuranceResp> result;
SysInsurancePolicyExample example = this.buildQueryExample(insuranceReq);
List<SysInsurancePolicy> insurancePolicyList = this.getInsurancePolicyList(example,
insuranceReq);
result = this.getQueryResult(insuranceReq, insurancePolicyList);
super.logInfo("保单列表查询-结果", result);
return result;
}
@Override
public PagedResp<InsuranceResp> detail(InsuranceReq insuranceReq) {
super.logInfo("保单详情查询-参数", insuranceReq);
PagedResp<InsuranceResp> result;
SysInsurancePolicyExample example = this.buildDetailExample(insuranceReq);
List<SysInsurancePolicy> insurancePolicyList = this.getInsurancePolicyList(example,
insuranceReq);
result = this.getDetailResult(insuranceReq, insurancePolicyList);
super.logInfo("保单详情查询-结果", result);
return result;
}
@Override
public InsuranceResp download(InsuranceReq insuranceReq) {
super.logInfo("保单下载-参数", insuranceReq);
InsuranceResp result;
SysInsurancePolicyExample example = this.buildDetailExample(insuranceReq);
List<SysInsurancePolicy> insurancePolicyList = this.getInsurancePolicyList(example,
insuranceReq);
result = this.getDownloadResult(insurancePolicyList);
super.logInfo("保单下载-结果", result);
return result;
}
@Override
public InsuranceResp refund(InsuranceReq insuranceReq) {
super.logInfo("退保-参数", insuranceReq);
InsuranceResp result;
SysInsurancePolicyExample example = this.buildRefundExample(insuranceReq);
List<SysInsurancePolicy> insurancePolicyList = this.getInsurancePolicyList(example,
insuranceReq);
result = this.getRefundResult(insurancePolicyList);
super.logInfo("退保-结果", result);
return result;
}
private SysInsurancePolicyExample buildQueryExample(InsuranceReq insuranceReq) {
SysInsurancePolicyExample example = new SysInsurancePolicyExample();
SysInsurancePolicyExample.Criteria byExample = example.createCriteria();
if (StringUtils.isNotBlank(insuranceReq.getVehicleOwnerName())) {
byExample.andVehicleOwnerNameLike(
"%" + insuranceReq.getVehicleOwnerName() + "%");
}
if (StringUtils.isNotBlank(insuranceReq.getVin())) {
byExample.andVinLike("%" + insuranceReq.getVin() + "%");
}
if (StringUtils.isNotBlank(insuranceReq.getGpsNo())) {
byExample.andGpsNoLike("%" + insuranceReq.getGpsNo() + "%");
}
if (insuranceReq.getStatus() != null) {
byExample.andStatusEqualTo(insuranceReq.getStatus());
}
if (insuranceReq.getApplyTimeStart() != null) {
byExample.andInstallationTimeGreaterThanOrEqualTo(
insuranceReq.getApplyTimeStart());
}
if (insuranceReq.getApplyTimeEnd() != null) {
byExample.andInstallationTimeLessThan(insuranceReq.getApplyTimeEnd());
}
if (insuranceReq.getStartTimeStart() != null) {
byExample.andExpectedEffectiveTimeGreaterThanOrEqualTo(
insuranceReq.getStartTimeStart());
}
if (insuranceReq.getStartTimeEnd() != null) {
byExample.andExpectedEffectiveTimeLessThan(insuranceReq.getStartTimeEnd());
}
example.setOrderByClause(ORDER_CLAUSE);
return example;
}
private SysInsurancePolicyExample buildDetailExample(InsuranceReq insuranceReq) {
SysInsurancePolicyExample example = new SysInsurancePolicyExample();
SysInsurancePolicyExample.Criteria byExample = example.createCriteria();
if (insuranceReq.getId() == null) {
throw SysException.create(
ResultCodeEnum.INSURANCE_ID_NULL.getCode(),
ResultCodeEnum.INSURANCE_ID_NULL.getMsg());
}
byExample.andIdEqualTo(insuranceReq.getId());
example.setOrderByClause(ORDER_CLAUSE);
return example;
}
private SysInsurancePolicyExample buildRefundExample(InsuranceReq insuranceReq) {
SysInsurancePolicyExample example = new SysInsurancePolicyExample();
SysInsurancePolicyExample.Criteria byExample = example.createCriteria();
if (StringUtils.isBlank(insuranceReq.getInsuranceId())) {
throw SysException.create(
ResultCodeEnum.INSURANCE_THIRD_ID_NULL.getCode(),
ResultCodeEnum.INSURANCE_THIRD_ID_NULL.getMsg());
}
byExample.andInsuranceIdEqualTo(insuranceReq.getInsuranceId());
example.setOrderByClause(ORDER_CLAUSE);
return example;
}
private <T extends PagedReq> List<SysInsurancePolicy> getInsurancePolicyList(
SysInsurancePolicyExample example, T baseRequest) {
List<SysInsurancePolicy> insurancePolicyList;
if (baseRequest.getPageIndex() != null && baseRequest.getPageSize() != null) {
PageHelper.startPage(baseRequest.getPageIndex(),
baseRequest.getPageSize(), true);
}
insurancePolicyList = this.insurancePolicyMapper.selectByExample(example);
return insurancePolicyList;
}
private PagedResp<InsuranceResp> getQueryResult(InsuranceReq insuranceReq,
List<SysInsurancePolicy> insurancePolicyList) {
PagedResp<InsuranceResp> result;
PageInfo<SysInsurancePolicy> pageInfo = new PageInfo<>(insurancePolicyList);
List<InsuranceResp> insuranceRespList = this.entityToResp(
insurancePolicyList);
result = PagedResp.of(pageInfo.getTotal(), insuranceReq,
insuranceRespList);
return result;
}
private PagedResp<InsuranceResp> getDetailResult(InsuranceReq insuranceReq,
List<SysInsurancePolicy> insurancePolicyList) {
PagedResp<InsuranceResp> result;
PageInfo<SysInsurancePolicy> pageInfo = new PageInfo<>(insurancePolicyList);
List<InsuranceResp> insuranceRespList = this.entityToResp(insurancePolicyList);
result = PagedResp.of(pageInfo.getTotal(), insuranceReq, insuranceRespList);
return result;
}
private InsuranceResp getDownloadResult(List<SysInsurancePolicy> insurancePolicyList) {
InsuranceResp insuranceResp;
if (insurancePolicyList.isEmpty()) {
throw SysException.create(
ResultCodeEnum.INSURANCE_ID_NOT_FOUND.getCode(),
ResultCodeEnum.INSURANCE_ID_NOT_FOUND.getMsg());
}
SysInsurancePolicy insurancePolicy = insurancePolicyList.get(0);
if (StringUtils.isBlank(insurancePolicy.getInsurancePdf())) {
throw SysException.create(
ResultCodeEnum.INSURANCE_PDF_NOT_FOUND.getCode(),
ResultCodeEnum.INSURANCE_PDF_NOT_FOUND.getMsg());
}
insuranceResp = this.entityToResp(insurancePolicy);
return insuranceResp;
}
private InsuranceResp getRefundResult(List<SysInsurancePolicy> insurancePolicyList) {
InsuranceResp result;
if (insurancePolicyList.isEmpty()) {
throw SysException.create(
ResultCodeEnum.INSURANCE_ID_NOT_FOUND.getCode(),
ResultCodeEnum.INSURANCE_ID_NOT_FOUND.getMsg());
}
SysInsurancePolicy insurancePolicy = insurancePolicyList.get(0);
if (!this.hasOutdated(insurancePolicy)) {
this.refundByApi(insurancePolicy);
}
result = this.refundByManually(insurancePolicy);
return result;
}
private List<InsuranceResp> entityToResp(List<SysInsurancePolicy> insurancePolicyList) {
List<InsuranceResp> insuranceRespList = new ArrayList<>();
insurancePolicyList.forEach(insurancePolicy ->
insuranceRespList.add(this.entityToResp(insurancePolicy)));
return insuranceRespList;
}
private InsuranceResp entityToResp(SysInsurancePolicy insurancePolicy) {
InsuranceResp insuranceResp = new InsuranceResp();
String moneyStr = insurancePolicy.getVehicleInvoiceMoney()
.setScale(2, RoundingMode.HALF_UP)
.toPlainString();
BeanUtils.copyProperties(insurancePolicy, insuranceResp);
insuranceResp.setApplyTime(
DateUtil.formatDate(insurancePolicy.getCreateTime()));
insuranceResp.setExpectedEffectiveTime(
DateUtil.formatDate(insurancePolicy.getExpectedEffectiveTime()));
insuranceResp.setStatusText(
InsuranceStatus.getStatusText(insurancePolicy.getStatus()));
insuranceResp.setIdCardTypeText(
InsuranceCardType.getTypeText(insurancePolicy.getIdCardType()));
insuranceResp.setVehicleInvoiceMoney(moneyStr);
return insuranceResp;
}
//private List<InsuranceDetailResp> entityToDetailResp(
// List<SysInsurancePolicy> insurancePolicyList) {
//
// List<InsuranceDetailResp> insuranceDetailRespList = new ArrayList<>();
//
// insurancePolicyList.forEach(insurancePolicy ->
// insuranceDetailRespList.add(this.entityToDetailResp(insurancePolicy)));
//
// return insuranceDetailRespList;
//}
//
//private InsuranceDetailResp entityToDetailResp(SysInsurancePolicy insurancePolicy) {
// InsuranceDetailResp insuranceDetailResp = new InsuranceDetailResp();
// String moneyStr = insurancePolicy.getVehicleInvoiceMoney()
// .setScale(2, RoundingMode.HALF_UP)
// .toPlainString();
//
// BeanUtils.copyProperties(insurancePolicy, insuranceDetailResp);
// insuranceDetailResp.setApplyTime(
// DateUtil.formatDate(insurancePolicy.getCreateTime()));
// insuranceDetailResp.setExpectedEffectiveTime(
// DateUtil.formatDate(insurancePolicy.getExpectedEffectiveTime()));
// insuranceDetailResp.setStatusText(
// InsuranceStatus.getStatusText(insurancePolicy.getStatus()));
// insuranceDetailResp.setIdCardTypeText(
// InsuranceCardType.getTypeText(insurancePolicy.getIdCardType()));
// insuranceDetailResp.setVehicleInvoiceMoney(moneyStr);
//
// return insuranceDetailResp;
//}
private boolean hasOutdated(SysInsurancePolicy insurancePolicy) {
Date createTime = insurancePolicy.getCreateTime();
Date currentDate = new Date();
return ((currentDate.getTime() - createTime.getTime()) > MILLISECONDS_PER_WEEK);
}
private InsuranceResp refundByApi(SysInsurancePolicy insurancePolicy) {
InsuranceResp insuranceResp = new InsuranceResp();
TspRefundReq tspRefundReq = new TspRefundReq();
tspRefundReq.setInsuranceCompany(insurancePolicy.getInsuranceCompany());
tspRefundReq.setFullInsuranceNo(insurancePolicy.getInsuranceNo());
tspRefundReq.setSeqNo(insurancePolicy.getInsuranceSeqNo());
TspResp tspResp = this.tspApiInvoker.with(this.appKey, this.secret)
.refund(tspRefundReq);
super.logInfo("TSP接口调用结果", tspResp);
boolean invokeSuccess = TspResultCode.SUCCESS.getCode().equals(tspResp.getCode())
&& (tspResp.getData() != null)
&& tspResp.getData().getCallResult();
if (!invokeSuccess) {
throw SysException.create(
ResultCodeEnum.INSURANCE_API_FAIL.getCode(),
ResultCodeEnum.INSURANCE_API_FAIL.getMsg());
}
return insuranceResp;
}
@Transactional(rollbackFor = Exception.class)
public InsuranceResp refundByManually(SysInsurancePolicy insurancePolicy) {
InsuranceResp insuranceResp = new InsuranceResp();
ServletRequestAttributes attributes =
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
try {
insurancePolicy.setStatus(InsuranceStatus.REFUNDED.getStatus().byteValue());
insurancePolicy.setUpdateTime(new Date());
if (attributes != null) {
insurancePolicy.setUpdateBy(UserUtils.getUserId(attributes.getRequest()));
}
this.insurancePolicyMapper.updateByPrimaryKeySelective(insurancePolicy);
} catch (RuntimeException e) {
super.logError("更新保险表时出错", e);
throw SysException.create(
ResultCodeEnum.INSURANCE_UPDATE_ERROR.getCode(),
ResultCodeEnum.INSURANCE_UPDATE_ERROR.getMsg());
}
return insuranceResp;
}
}
package com.glsx.ordercenter.service.insurance.impl;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.glsx.common.utils.DateUtil;
import com.glsx.common.utils.UserUtils;
import com.glsx.ordercenter.constants.ResultCodeEnum;
import com.glsx.ordercenter.constants.insurance.InsuranceCardType;
import com.glsx.ordercenter.constants.insurance.InsuranceStatus;
import com.glsx.ordercenter.constants.insurance.TspResultCode;
import com.glsx.ordercenter.dto.common.PagedOrderRequest;
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.ordercenter.dto.insurance.TspRefundReq;
import com.glsx.ordercenter.dto.insurance.TspResp;
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.common.BaseOrderService;
import com.glsx.ordercenter.service.insurance.InsuranceService;
import com.glsx.ordercenter.utils.insurance.TspApiInvoker;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
/**
* <p>Description: 保险Service
*
* <p>Project: car-service
*
* @author wbh
* @date 2020-05-22
*/
@Service
public class InsuranceServiceImpl extends BaseOrderService implements InsuranceService {
/**
* 一星期的毫秒数
*/
private static final Long MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000L;
@Autowired
private SysInsurancePolicyMapper insurancePolicyMapper;
@Autowired
private TspApiInvoker tspApiInvoker;
@Value("${ora.appKey}")
private String appKey;
@Value("${ora.appSecret}")
private String secret;
@Override
public PagedOrderResponse<InsuranceQueryResp> query(InsuranceQueryReq insuranceQueryReq) {
super.logInfo("保单列表查询-参数", insuranceQueryReq);
PagedOrderResponse<InsuranceQueryResp> result;
SysInsurancePolicyExample example = this.buildQueryExample(insuranceQueryReq);
List<SysInsurancePolicy> insurancePolicyList = this.getInsurancePolicyList(example,
insuranceQueryReq);
result = this.getQueryResult(insuranceQueryReq, insurancePolicyList);
super.logInfo("保单列表查询-结果", result);
return result;
}
@Override
public PagedOrderResponse<InsuranceDetailResp> detail(InsuranceDetailReq insuranceDetailReq) {
super.logInfo("保单详情查询-参数", insuranceDetailReq);
PagedOrderResponse<InsuranceDetailResp> result;
SysInsurancePolicyExample example = this.buildDetailExample(insuranceDetailReq);
List<SysInsurancePolicy> insurancePolicyList = this.getInsurancePolicyList(example,
insuranceDetailReq);
result = this.getDetailResult(insuranceDetailReq, insurancePolicyList);
super.logInfo("保单详情查询-结果", result);
return result;
}
@Override
public InsuranceDetailResp download(InsuranceDetailReq insuranceDetailReq) {
super.logInfo("保单下载-参数", insuranceDetailReq);
InsuranceDetailResp result;
SysInsurancePolicyExample example = this.buildDetailExample(insuranceDetailReq);
List<SysInsurancePolicy> insurancePolicyList = this.getInsurancePolicyList(example,
insuranceDetailReq);
result = this.getDownloadResult(insurancePolicyList);
super.logInfo("保单下载-结果", result);
return result;
}
@Override
public InsuranceRefundResp refund(InsuranceRefundReq insuranceRefundReq) {
super.logInfo("退保-参数", insuranceRefundReq);
InsuranceRefundResp result;
SysInsurancePolicyExample example = this.buildRefundExample(insuranceRefundReq);
List<SysInsurancePolicy> insurancePolicyList = this.getInsurancePolicyList(example,
insuranceRefundReq);
result = this.getRefundResult(insurancePolicyList);
super.logInfo("退保-结果", result);
return result;
}
private SysInsurancePolicyExample buildQueryExample(InsuranceQueryReq insuranceQueryReq) {
SysInsurancePolicyExample example = new SysInsurancePolicyExample();
SysInsurancePolicyExample.Criteria byExample = example.createCriteria();
if (StringUtils.isNotBlank(insuranceQueryReq.getVehicleOwnerName())) {
byExample.andVehicleOwnerNameLike(
"%" + insuranceQueryReq.getVehicleOwnerName() + "%");
}
if (StringUtils.isNotBlank(insuranceQueryReq.getVin())) {
byExample.andVinLike("%" + insuranceQueryReq.getVin() + "%");
}
if (StringUtils.isNotBlank(insuranceQueryReq.getGpsNo())) {
byExample.andGpsNoLike("%" + insuranceQueryReq.getGpsNo() + "%");
}
if (insuranceQueryReq.getStatus() != null) {
byExample.andStatusEqualTo(insuranceQueryReq.getStatus());
}
if (insuranceQueryReq.getApplyTimeStart() != null) {
byExample.andInstallationTimeGreaterThanOrEqualTo(
insuranceQueryReq.getApplyTimeStart());
}
if (insuranceQueryReq.getApplyTimeEnd() != null) {
byExample.andInstallationTimeLessThan(insuranceQueryReq.getApplyTimeEnd());
}
if (insuranceQueryReq.getStartTimeStart() != null) {
byExample.andExpectedEffectiveTimeGreaterThanOrEqualTo(
insuranceQueryReq.getStartTimeStart());
}
if (insuranceQueryReq.getStartTimeEnd() != null) {
byExample.andExpectedEffectiveTimeLessThan(insuranceQueryReq.getStartTimeEnd());
}
example.setOrderByClause("installation_time DESC");
return example;
}
private SysInsurancePolicyExample buildDetailExample(InsuranceDetailReq insuranceDetailReq) {
SysInsurancePolicyExample example = new SysInsurancePolicyExample();
SysInsurancePolicyExample.Criteria byExample = example.createCriteria();
if (insuranceDetailReq.getId() == null) {
throw SysException.create(
ResultCodeEnum.INSURANCE_ID_NULL.getCode(),
ResultCodeEnum.INSURANCE_ID_NULL.getMsg());
}
byExample.andIdEqualTo(insuranceDetailReq.getId());
example.setOrderByClause("installation_time DESC");
return example;
}
private SysInsurancePolicyExample buildRefundExample(InsuranceRefundReq insuranceRefundReq) {
SysInsurancePolicyExample example = new SysInsurancePolicyExample();
SysInsurancePolicyExample.Criteria byExample = example.createCriteria();
if (StringUtils.isBlank(insuranceRefundReq.getInsuranceId())) {
throw SysException.create(
ResultCodeEnum.INSURANCE_THIRD_ID_NULL.getCode(),
ResultCodeEnum.INSURANCE_THIRD_ID_NULL.getMsg());
}
byExample.andInsuranceIdEqualTo(insuranceRefundReq.getInsuranceId());
example.setOrderByClause("installation_time DESC");
return example;
}
private <T extends PagedOrderRequest> List<SysInsurancePolicy> getInsurancePolicyList(
SysInsurancePolicyExample example, T baseRequest) {
List<SysInsurancePolicy> insurancePolicyList;
if (baseRequest.getPageIndex() > 0 && baseRequest.getPageSize() > 0) {
PageHelper.startPage(baseRequest.getPageIndex(),
baseRequest.getPageSize(), true);
}
insurancePolicyList = this.insurancePolicyMapper.selectByExample(example);
return insurancePolicyList;
}
private PagedOrderResponse<InsuranceQueryResp> getQueryResult(
InsuranceQueryReq insuranceQueryReq, List<SysInsurancePolicy> insurancePolicyList) {
PagedOrderResponse<InsuranceQueryResp> result;
PageInfo<SysInsurancePolicy> pageInfo = new PageInfo<>(insurancePolicyList);
List<InsuranceQueryResp> insuranceQueryRespList = this.entityToQueryResp(
insurancePolicyList);
result = PagedOrderResponse.of(pageInfo.getTotal(), insuranceQueryReq,
insuranceQueryRespList);
return result;
}
private PagedOrderResponse<InsuranceDetailResp> getDetailResult(
InsuranceDetailReq insuranceDetailReq, List<SysInsurancePolicy> insurancePolicyList) {
PagedOrderResponse<InsuranceDetailResp> result;
PageInfo<SysInsurancePolicy> pageInfo = new PageInfo<>(insurancePolicyList);
List<InsuranceDetailResp> insuranceDetailRespList = this.entityToDetailResp(
insurancePolicyList);
result = PagedOrderResponse.of(pageInfo.getTotal(), insuranceDetailReq,
insuranceDetailRespList);
return result;
}
private InsuranceDetailResp getDownloadResult(List<SysInsurancePolicy> insurancePolicyList) {
InsuranceDetailResp insuranceDetailResp;
if (insurancePolicyList.isEmpty()) {
throw SysException.create(
ResultCodeEnum.INSURANCE_ID_NOT_FOUND.getCode(),
ResultCodeEnum.INSURANCE_ID_NOT_FOUND.getMsg());
}
SysInsurancePolicy insurancePolicy = insurancePolicyList.get(0);
if (StringUtils.isBlank(insurancePolicy.getInsurancePdf())) {
throw SysException.create(
ResultCodeEnum.INSURANCE_PDF_NOT_FOUND.getCode(),
ResultCodeEnum.INSURANCE_PDF_NOT_FOUND.getMsg());
}
insuranceDetailResp = this.entityToDetailResp(insurancePolicy);
return insuranceDetailResp;
}
private InsuranceRefundResp getRefundResult(List<SysInsurancePolicy> insurancePolicyList) {
InsuranceRefundResp result;
if (insurancePolicyList.isEmpty()) {
throw SysException.create(
ResultCodeEnum.INSURANCE_ID_NOT_FOUND.getCode(),
ResultCodeEnum.INSURANCE_ID_NOT_FOUND.getMsg());
}
SysInsurancePolicy insurancePolicy = insurancePolicyList.get(0);
if (!this.hasOutdated(insurancePolicy)) {
this.refundByApi(insurancePolicy);
}
result = this.refundByManually(insurancePolicy);
return result;
}
private List<InsuranceQueryResp> entityToQueryResp(
List<SysInsurancePolicy> insurancePolicyList) {
List<InsuranceQueryResp> insuranceQueryRespList = new ArrayList<>();
insurancePolicyList.forEach(insurancePolicy ->
insuranceQueryRespList.add(this.entityToQueryResp(insurancePolicy)));
return insuranceQueryRespList;
}
private InsuranceQueryResp entityToQueryResp(SysInsurancePolicy insurancePolicy) {
InsuranceQueryResp insuranceQueryResp = new InsuranceQueryResp();
String moneyStr = insurancePolicy.getVehicleInvoiceMoney()
.setScale(2, RoundingMode.HALF_UP)
.toPlainString();
BeanUtils.copyProperties(insurancePolicy, insuranceQueryResp);
insuranceQueryResp.setApplyTime(
DateUtil.formatDate(insurancePolicy.getCreateTime()));
insuranceQueryResp.setExpectedEffectiveTime(
DateUtil.formatDate(insurancePolicy.getExpectedEffectiveTime()));
insuranceQueryResp.setStatusText(
InsuranceStatus.getStatusText(insurancePolicy.getStatus()));
insuranceQueryResp.setIdCardTypeText(
InsuranceCardType.getTypeText(insurancePolicy.getIdCardType()));
insuranceQueryResp.setVehicleInvoiceMoney(moneyStr);
return insuranceQueryResp;
}
private List<InsuranceDetailResp> entityToDetailResp(
List<SysInsurancePolicy> insurancePolicyList) {
List<InsuranceDetailResp> insuranceDetailRespList = new ArrayList<>();
insurancePolicyList.forEach(insurancePolicy ->
insuranceDetailRespList.add(this.entityToDetailResp(insurancePolicy)));
return insuranceDetailRespList;
}
private InsuranceDetailResp entityToDetailResp(SysInsurancePolicy insurancePolicy) {
InsuranceDetailResp insuranceDetailResp = new InsuranceDetailResp();
String moneyStr = insurancePolicy.getVehicleInvoiceMoney()
.setScale(2, RoundingMode.HALF_UP)
.toPlainString();
BeanUtils.copyProperties(insurancePolicy, insuranceDetailResp);
insuranceDetailResp.setApplyTime(
DateUtil.formatDate(insurancePolicy.getCreateTime()));
insuranceDetailResp.setExpectedEffectiveTime(
DateUtil.formatDate(insurancePolicy.getExpectedEffectiveTime()));
insuranceDetailResp.setStatusText(
InsuranceStatus.getStatusText(insurancePolicy.getStatus()));
insuranceDetailResp.setIdCardTypeText(
InsuranceCardType.getTypeText(insurancePolicy.getIdCardType()));
insuranceDetailResp.setVehicleInvoiceMoney(moneyStr);
return insuranceDetailResp;
}
private boolean hasOutdated(SysInsurancePolicy insurancePolicy) {
Date createTime = insurancePolicy.getCreateTime();
Date currentDate = new Date();
return ((currentDate.getTime() - createTime.getTime()) > MILLISECONDS_PER_WEEK);
}
private InsuranceRefundResp refundByApi(SysInsurancePolicy insurancePolicy) {
InsuranceRefundResp insuranceRefundResp = new InsuranceRefundResp();
TspRefundReq tspRefundReq = new TspRefundReq();
tspRefundReq.setInsuranceCompany(insurancePolicy.getInsuranceCompany());
tspRefundReq.setFullInsuranceNo(insurancePolicy.getInsuranceNo());
tspRefundReq.setSeqNo(insurancePolicy.getInsuranceSeqNo());
TspResp tspResp = this.tspApiInvoker.with(this.appKey, this.secret)
.refund(tspRefundReq);
super.logInfo("TSP接口调用结果", tspResp);
boolean invokeSuccess = TspResultCode.SUCCESS.getCode().equals(tspResp.getCode())
&& (tspResp.getData() != null)
&& tspResp.getData().getCallResult();
if (!invokeSuccess) {
throw SysException.create(
ResultCodeEnum.INSURANCE_API_FAIL.getCode(),
ResultCodeEnum.INSURANCE_API_FAIL.getMsg());
}
return insuranceRefundResp;
}
@Transactional(rollbackFor = Exception.class)
public InsuranceRefundResp refundByManually(SysInsurancePolicy insurancePolicy) {
InsuranceRefundResp insuranceRefundResp = new InsuranceRefundResp();
ServletRequestAttributes attributes =
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
try {
insurancePolicy.setStatus(InsuranceStatus.REFUNDED.getStatus().byteValue());
insurancePolicy.setUpdateTime(new Date());
if (attributes != null) {
insurancePolicy.setUpdateBy(UserUtils.getUserId(attributes.getRequest()));
}
this.insurancePolicyMapper.updateByPrimaryKeySelective(insurancePolicy);
} catch (RuntimeException e) {
super.logError("更新保险表时出错", e);
throw SysException.create(
ResultCodeEnum.INSURANCE_UPDATE_ERROR.getCode(),
ResultCodeEnum.INSURANCE_UPDATE_ERROR.getMsg());
}
return insuranceRefundResp;
}
}
package com.glsx.ordercenter.thread; 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.alibaba.fastjson.JSON;
import com.glsx.common.utils.DateUtil; import com.glsx.common.utils.DateUtil;
import com.glsx.common.utils.PropertiesUtil; import com.glsx.common.utils.PropertiesUtil;
import com.glsx.gps.utils.HttpUtil; import com.glsx.gps.utils.HttpUtil;
import com.glsx.ordercenter.dto.insurance.TspResp; import com.glsx.ordercenter.dto.resp.TspResp;
import com.glsx.ordercenter.dto.insurance.TspRespData; import com.glsx.ordercenter.dto.resp.TspRespData;
import com.glsx.ordercenter.mapper.insurance.SysInsurancePolicyMapper; import com.glsx.ordercenter.mapper.insurance.SysInsurancePolicyMapper;
import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy; import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy;
import com.glsx.ordercenter.utils.TspSignUtil; import com.glsx.ordercenter.utils.TspSignUtil;
...@@ -13,11 +17,6 @@ import org.apache.http.entity.ContentType; ...@@ -13,11 +17,6 @@ import org.apache.http.entity.ContentType;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Semaphore;
/** /**
* @author think.wang * @author think.wang
* @version 1.0.0 * @version 1.0.0
...@@ -46,7 +45,7 @@ public class TspGetInsurancePdfTask implements Runnable{ ...@@ -46,7 +45,7 @@ public class TspGetInsurancePdfTask implements Runnable{
@Override @Override
public void run() { public void run() {
try { try {
semaphore.acquire(); this.semaphore.acquire();
//系统参数获取 //系统参数获取
String insuranceUrl = PropertiesUtil.getProperty("insurance.picc.url"); String insuranceUrl = PropertiesUtil.getProperty("insurance.picc.url");
String method = PropertiesUtil.getProperty("insurance.picc.pdf"); //调用获取pdf方法 String method = PropertiesUtil.getProperty("insurance.picc.pdf"); //调用获取pdf方法
...@@ -56,9 +55,9 @@ public class TspGetInsurancePdfTask implements Runnable{ ...@@ -56,9 +55,9 @@ public class TspGetInsurancePdfTask implements Runnable{
String format = PropertiesUtil.getProperty("insurance.picc.format"); String format = PropertiesUtil.getProperty("insurance.picc.format");
String source = PropertiesUtil.getProperty("insurance.picc.source"); String source = PropertiesUtil.getProperty("insurance.picc.source");
SysInsurancePolicy insurancePolicy = policyMapper.selectByPrimaryKey(id); SysInsurancePolicy insurancePolicy = this.policyMapper.selectByPrimaryKey(this.id);
if(insurancePolicy == null){ if(insurancePolicy == null){
logger.error("通过id={}未找到保单数据", id); this.logger.error("通过id={}未找到保单数据", this.id);
return; return;
} }
//业务参数封装 //业务参数封装
...@@ -66,7 +65,7 @@ public class TspGetInsurancePdfTask implements Runnable{ ...@@ -66,7 +65,7 @@ public class TspGetInsurancePdfTask implements Runnable{
map.put("insuranceCompany", insurancePolicy.getInsuranceCompany()); map.put("insuranceCompany", insurancePolicy.getInsuranceCompany());
map.put("fullInsuranceNo", insurancePolicy.getInsuranceNo()); map.put("fullInsuranceNo", insurancePolicy.getInsuranceNo());
map.put("seqNo", insurancePolicy.getInsuranceSeqNo()); map.put("seqNo", insurancePolicy.getInsuranceSeqNo());
logger.info("获取pdf签名参数值为:{}", map); this.logger.info("获取pdf签名参数值为:{}", map);
//系统参数封装 //系统参数封装
map.put("method", method); map.put("method", method);
...@@ -80,31 +79,31 @@ public class TspGetInsurancePdfTask implements Runnable{ ...@@ -80,31 +79,31 @@ public class TspGetInsurancePdfTask implements Runnable{
//发送请求 //发送请求
String result = null; String result = null;
int tryCount = TRY_COUNT; int tryCount = this.TRY_COUNT;
while (tryCount-- > 0) { while (tryCount-- > 0) {
try { try {
result = HttpUtil.postData(insuranceUrl, JSON.toJSONString(map), ContentType.APPLICATION_JSON); result = HttpUtil.postData(insuranceUrl, JSON.toJSONString(map), ContentType.APPLICATION_JSON);
break; break;
} catch (Exception e) { } catch (Exception e) {
Thread.sleep(TRY_WAIT_TIME); Thread.sleep(this.TRY_WAIT_TIME);
continue; continue;
} }
} }
logger.info("保单号:{}获取pdf信息响应数据:{}", map.get("fullInsuranceNo"), result); this.logger.info("保单号:{}获取pdf信息响应数据:{}", map.get("fullInsuranceNo"), result);
TspResp tspResp = JSON.parseObject(result, TspResp.class); TspResp tspResp = JSON.parseObject(result, TspResp.class);
if(tspResp != null && "0".equals(tspResp.getCode())){ //请求成功 if(tspResp != null && "0".equals(tspResp.getCode())){ //请求成功
SysInsurancePolicy policy = new SysInsurancePolicy(); SysInsurancePolicy policy = new SysInsurancePolicy();
policy.setId(id); policy.setId(this.id);
TspRespData respData = tspResp.getData(); TspRespData respData = tspResp.getData();
policy.setInsurancePdf(respData.getObj()); //得到pdf路径 policy.setInsurancePdf(respData.getObj()); //得到pdf路径
policyMapper.updateByPrimaryKeySelective(policy); //保存返回数据 this.policyMapper.updateByPrimaryKeySelective(policy); //保存返回数据
}else{ }else{
logger.error("获取保单pdf失败,保单号为:{}", map.get("fullInsuranceNo")); this.logger.error("获取保单pdf失败,保单号为:{}", map.get("fullInsuranceNo"));
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("调用TSP获取pdf接口异常:{}", e); this.logger.error("调用TSP获取pdf接口异常:{}", e);
}finally { }finally {
semaphore.release(); this.semaphore.release();
} }
} }
......
package com.glsx.ordercenter.thread; 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.alibaba.fastjson.JSON;
import com.glsx.common.utils.DateUtil; import com.glsx.common.utils.DateUtil;
import com.glsx.common.utils.PropertiesUtil; import com.glsx.common.utils.PropertiesUtil;
...@@ -9,9 +13,9 @@ import com.glsx.ordercenter.constants.insurance.InsuranceCardType; ...@@ -9,9 +13,9 @@ import com.glsx.ordercenter.constants.insurance.InsuranceCardType;
import com.glsx.ordercenter.constants.insurance.InsuranceCompany; import com.glsx.ordercenter.constants.insurance.InsuranceCompany;
import com.glsx.ordercenter.constants.insurance.InsuranceCustomerType; import com.glsx.ordercenter.constants.insurance.InsuranceCustomerType;
import com.glsx.ordercenter.constants.insurance.InsuranceStatus; import com.glsx.ordercenter.constants.insurance.InsuranceStatus;
import com.glsx.ordercenter.dto.insurance.TspResp; import com.glsx.ordercenter.dto.req.TspSaveReq;
import com.glsx.ordercenter.dto.insurance.TspRespData; import com.glsx.ordercenter.dto.resp.TspResp;
import com.glsx.ordercenter.dto.insurance.TspSaveReq; import com.glsx.ordercenter.dto.resp.TspRespData;
import com.glsx.ordercenter.mapper.insurance.SysInsurancePolicyMapper; import com.glsx.ordercenter.mapper.insurance.SysInsurancePolicyMapper;
import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy; import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy;
import com.glsx.ordercenter.utils.ObjectUtils; import com.glsx.ordercenter.utils.ObjectUtils;
...@@ -20,11 +24,6 @@ import org.apache.http.entity.ContentType; ...@@ -20,11 +24,6 @@ import org.apache.http.entity.ContentType;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Semaphore;
/** /**
* @author think.wang * @author think.wang
* @version 1.0.0 * @version 1.0.0
...@@ -53,7 +52,7 @@ public class TspSaveInsuranceDataTask implements Runnable{ ...@@ -53,7 +52,7 @@ public class TspSaveInsuranceDataTask implements Runnable{
@Override @Override
public void run() { public void run() {
try { try {
semaphore.acquire(); this.semaphore.acquire();
//系统参数获取 //系统参数获取
String insuranceUrl = PropertiesUtil.getProperty("insurance.picc.url"); String insuranceUrl = PropertiesUtil.getProperty("insurance.picc.url");
String method = PropertiesUtil.getProperty("insurance.picc.save"); //调用投保方法 String method = PropertiesUtil.getProperty("insurance.picc.save"); //调用投保方法
...@@ -66,7 +65,7 @@ public class TspSaveInsuranceDataTask implements Runnable{ ...@@ -66,7 +65,7 @@ public class TspSaveInsuranceDataTask implements Runnable{
//业务参数封装 //业务参数封装
TspSaveReq saveData = this.setSendData(this.data); TspSaveReq saveData = this.setSendData(this.data);
//对象转map进行签名 //对象转map进行签名
logger.info("投保签名的对象为:{}", JSON.toJSONString(saveData)); this.logger.info("投保签名的对象为:{}", JSON.toJSONString(saveData));
Map<String, String> map = ObjectUtils.objectToMap(saveData); Map<String, String> map = ObjectUtils.objectToMap(saveData);
//系统参数封装 //系统参数封装
...@@ -81,17 +80,17 @@ public class TspSaveInsuranceDataTask implements Runnable{ ...@@ -81,17 +80,17 @@ public class TspSaveInsuranceDataTask implements Runnable{
//发送请求 //发送请求
String result = null; String result = null;
int tryCount = TRY_COUNT; int tryCount = this.TRY_COUNT;
while (tryCount-- > 0) { while (tryCount-- > 0) {
try { try {
result = HttpUtil.postData(insuranceUrl, JSON.toJSONString(map), ContentType.APPLICATION_JSON); result = HttpUtil.postData(insuranceUrl, JSON.toJSONString(map), ContentType.APPLICATION_JSON);
break; break;
} catch (Exception e) { } catch (Exception e) {
Thread.sleep(TRY_WAIT_TIME); Thread.sleep(this.TRY_WAIT_TIME);
continue; continue;
} }
} }
logger.info("车架号:{}投保响应数据:{}", map.get("standNo"), result); this.logger.info("车架号:{}投保响应数据:{}", map.get("standNo"), result);
SysInsurancePolicy policy = new SysInsurancePolicy(); SysInsurancePolicy policy = new SysInsurancePolicy();
policy.setId(this.data.getId()); policy.setId(this.data.getId());
TspResp tspResp = JSON.parseObject(result, TspResp.class); TspResp tspResp = JSON.parseObject(result, TspResp.class);
...@@ -103,11 +102,11 @@ public class TspSaveInsuranceDataTask implements Runnable{ ...@@ -103,11 +102,11 @@ public class TspSaveInsuranceDataTask implements Runnable{
}else{ }else{
policy.setStatus(InsuranceStatus.APPLY_FAILED.getStatus().byteValue()); //更新状态投保失败 policy.setStatus(InsuranceStatus.APPLY_FAILED.getStatus().byteValue()); //更新状态投保失败
} }
policyMapper.updateByPrimaryKeySelective(policy); //保存返回数据 this.policyMapper.updateByPrimaryKeySelective(policy); //保存返回数据
} catch (Exception e) { } catch (Exception e) {
logger.error("调用TSP投保接口异常:{}", e); this.logger.error("调用TSP投保接口异常:{}", e);
}finally { }finally {
semaphore.release(); this.semaphore.release();
} }
} }
......
package com.glsx.ordercenter.thread; 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.alibaba.fastjson.JSON;
import com.glsx.common.utils.DateUtil; import com.glsx.common.utils.DateUtil;
import com.glsx.common.utils.PropertiesUtil; import com.glsx.common.utils.PropertiesUtil;
...@@ -7,8 +10,8 @@ import com.glsx.common.utils.StringUtils; ...@@ -7,8 +10,8 @@ import com.glsx.common.utils.StringUtils;
import com.glsx.gps.utils.HttpUtil; import com.glsx.gps.utils.HttpUtil;
import com.glsx.ordercenter.constants.insurance.InsuranceCompany; import com.glsx.ordercenter.constants.insurance.InsuranceCompany;
import com.glsx.ordercenter.constants.insurance.InsuranceCustomerType; import com.glsx.ordercenter.constants.insurance.InsuranceCustomerType;
import com.glsx.ordercenter.dto.insurance.TspResp; import com.glsx.ordercenter.dto.req.TspUpdateReq;
import com.glsx.ordercenter.dto.insurance.TspUpdateReq; import com.glsx.ordercenter.dto.resp.TspResp;
import com.glsx.ordercenter.mapper.insurance.SysInsurancePolicyMapper; import com.glsx.ordercenter.mapper.insurance.SysInsurancePolicyMapper;
import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy; import com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy;
import com.glsx.ordercenter.utils.ObjectUtils; import com.glsx.ordercenter.utils.ObjectUtils;
...@@ -17,10 +20,6 @@ import org.apache.http.entity.ContentType; ...@@ -17,10 +20,6 @@ import org.apache.http.entity.ContentType;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.Semaphore;
/** /**
* @author think.wang * @author think.wang
* @version 1.0.0 * @version 1.0.0
...@@ -49,7 +48,7 @@ public class TspUpdateInsuranceDataTask implements Runnable{ ...@@ -49,7 +48,7 @@ public class TspUpdateInsuranceDataTask implements Runnable{
@Override @Override
public void run() { public void run() {
try { try {
semaphore.acquire(); this.semaphore.acquire();
//系统参数获取 //系统参数获取
String insuranceUrl = PropertiesUtil.getProperty("insurance.picc.url"); String insuranceUrl = PropertiesUtil.getProperty("insurance.picc.url");
String method = PropertiesUtil.getProperty("insurance.picc.update"); //修改保单方法 String method = PropertiesUtil.getProperty("insurance.picc.update"); //修改保单方法
...@@ -59,15 +58,15 @@ public class TspUpdateInsuranceDataTask implements Runnable{ ...@@ -59,15 +58,15 @@ public class TspUpdateInsuranceDataTask implements Runnable{
String format = PropertiesUtil.getProperty("insurance.picc.format"); String format = PropertiesUtil.getProperty("insurance.picc.format");
String source = PropertiesUtil.getProperty("insurance.picc.source"); String source = PropertiesUtil.getProperty("insurance.picc.source");
SysInsurancePolicy insurancePolicy = policyMapper.selectByPrimaryKey(id); SysInsurancePolicy insurancePolicy = this.policyMapper.selectByPrimaryKey(this.id);
if(insurancePolicy == null){ if(insurancePolicy == null){
logger.error("通过id={}未找到保单数据", id); this.logger.error("通过id={}未找到保单数据", this.id);
return; return;
} }
//业务参数封装 //业务参数封装
TspUpdateReq updateData = this.setSendData(insurancePolicy); TspUpdateReq updateData = this.setSendData(insurancePolicy);
//对象转map进行签名 //对象转map进行签名
logger.info("修改保单签名的对象为:{}", JSON.toJSONString(updateData)); this.logger.info("修改保单签名的对象为:{}", JSON.toJSONString(updateData));
Map<String, String> map = ObjectUtils.objectToMap(updateData); Map<String, String> map = ObjectUtils.objectToMap(updateData);
//系统参数封装 //系统参数封装
...@@ -82,27 +81,27 @@ public class TspUpdateInsuranceDataTask implements Runnable{ ...@@ -82,27 +81,27 @@ public class TspUpdateInsuranceDataTask implements Runnable{
//发送请求 //发送请求
String result = null; String result = null;
int tryCount = TRY_COUNT; int tryCount = this.TRY_COUNT;
while (tryCount-- > 0) { while (tryCount-- > 0) {
try { try {
result = HttpUtil.postData(insuranceUrl, JSON.toJSONString(map), ContentType.APPLICATION_JSON); result = HttpUtil.postData(insuranceUrl, JSON.toJSONString(map), ContentType.APPLICATION_JSON);
break; break;
} catch (Exception e) { } catch (Exception e) {
Thread.sleep(TRY_WAIT_TIME); Thread.sleep(this.TRY_WAIT_TIME);
continue; continue;
} }
} }
logger.info("保单号:{}修改投保响应数据:{}", map.get("fullInsuranceNo"), result); this.logger.info("保单号:{}修改投保响应数据:{}", map.get("fullInsuranceNo"), result);
TspResp tspResp = JSON.parseObject(result, TspResp.class); TspResp tspResp = JSON.parseObject(result, TspResp.class);
if(tspResp != null && "0".equals(tspResp.getCode())){ //请求成功 if(tspResp != null && "0".equals(tspResp.getCode())){ //请求成功
logger.info("修改保单数据成功,保单号为:{}", map.get("fullInsuranceNo")); this.logger.info("修改保单数据成功,保单号为:{}", map.get("fullInsuranceNo"));
}else{ }else{
logger.error("修改保单数据失败,保单号为:{}", map.get("fullInsuranceNo")); this.logger.error("修改保单数据失败,保单号为:{}", map.get("fullInsuranceNo"));
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("调用TSP投保接口异常:{}", e); this.logger.error("调用TSP投保接口异常:{}", e);
}finally { }finally {
semaphore.release(); this.semaphore.release();
} }
} }
......
package com.glsx.ordercenter.utils; 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.alibaba.fastjson.JSON;
import com.glsx.ordercenter.constants.insurance.OraConstants; import com.glsx.ordercenter.constants.insurance.OraConstants;
import com.glsx.ordercenter.constants.insurance.OraResultCode; 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.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; 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 * @author think.wang
* @version 1.0.0 * @version 1.0.0
...@@ -60,7 +63,7 @@ public class OraSignUtil { ...@@ -60,7 +63,7 @@ public class OraSignUtil {
/** /**
* <p>获取HTTp请求体和请求参数进行验签</p> * <p>获取HTTp请求体和请求参数进行验签</p>
* <p>验签失败则抛出 {@link OraBizException} 异常</p> * <p>验签失败则抛出 {@link SysException} 异常</p>
* *
* @param secret 密钥 * @param secret 密钥
* @param requestBody 请求体 * @param requestBody 请求体
...@@ -76,7 +79,8 @@ public class OraSignUtil { ...@@ -76,7 +79,8 @@ public class OraSignUtil {
Map<String, String> verifyParamMap = buildVerifyParamMap(paramMap, requestBody); Map<String, String> verifyParamMap = buildVerifyParamMap(paramMap, requestBody);
if (!verifyParamMap.containsKey(OraConstants.APP_KEY)) { 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); String storedAppKey = verifyParamMap.get(OraConstants.APP_KEY);
...@@ -85,11 +89,13 @@ public class OraSignUtil { ...@@ -85,11 +89,13 @@ public class OraSignUtil {
String signStr = sign(verifyParamMap, null, secret); String signStr = sign(verifyParamMap, null, secret);
if (!appKey.equals(storedAppKey)) { 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)) { 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.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -7,9 +7,8 @@ import com.alibaba.fastjson.JSON; ...@@ -7,9 +7,8 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.glsx.common.utils.DateUtil; import com.glsx.common.utils.DateUtil;
import com.glsx.ordercenter.constants.insurance.TspConstants; import com.glsx.ordercenter.constants.insurance.TspConstants;
import com.glsx.ordercenter.dto.insurance.TspRefundReq; import com.glsx.ordercenter.dto.req.TspRefundReq;
import com.glsx.ordercenter.dto.insurance.TspResp; import com.glsx.ordercenter.dto.resp.TspResp;
import com.glsx.ordercenter.utils.UrlUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
......
package com.glsx.ordercenter.utils.insurance; package com.glsx.ordercenter.utils;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.MessageDigest; import java.security.MessageDigest;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<result column="vehicle_color" jdbcType="VARCHAR" property="vehicleColor"/> <result column="vehicle_color" jdbcType="VARCHAR" property="vehicleColor"/>
<result column="vehicle_invoice_money" jdbcType="DECIMAL" property="vehicleInvoiceMoney"/> <result column="vehicle_invoice_money" jdbcType="DECIMAL" property="vehicleInvoiceMoney"/>
<result column="tasting_unit" jdbcType="VARCHAR" property="tastingUnit"/> <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="remark" jdbcType="VARCHAR" property="remark"/>
<result column="expected_effective_time" jdbcType="TIMESTAMP" <result column="expected_effective_time" jdbcType="TIMESTAMP"
property="expectedEffectiveTime"/> property="expectedEffectiveTime"/>
...@@ -109,19 +110,19 @@ ...@@ -109,19 +110,19 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!--@mbg.generated--> <!--@mbg.generated-->
sys_insurance_policy.id id, insurance_id, `source`, `status`, insurance_no, sys_insurance_policy.id id, insurance_id, `source`, `status`, insurance_no,
insurance_seq_no, insurance_seq_no, insurance_company,
insurance_company,
gps_no, installation_time, vin, vehicle_no, engine_number, car_brand, vehicle_type, 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, vehicle_owner_name, phone, vehicle_owner_address, customer_type, id_card_type, id_card_num,
insurance_commodity, pilfer_insurance_money, insurance_period, vehicle_color, insurance_commodity, pilfer_insurance_money, insurance_period, vehicle_color,
vehicle_invoice_money, vehicle_invoice_money,
tasting_unit, remark, expected_effective_time, real_effective_time, insurance_pdf, tasting_unit, cancel_reason, remark, expected_effective_time, real_effective_time,
create_time, update_time, create_by, update_by, insurance_pdf, create_time, update_time, create_by, update_by,
sys_insurance_data.response_data response_data sys_insurance_data.response_data response_data
</sql> </sql>
<sql id="joinClause"> <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> </sql>
<select id="selectCount" <select id="selectCount"
...@@ -132,7 +133,7 @@ ...@@ -132,7 +133,7 @@
distinct distinct
</if> </if>
count(0) count(0)
FROM sys_insurance_policy FROM sys_insurance_policy
<include refid="joinClause"/> <include refid="joinClause"/>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause"/>
...@@ -167,13 +168,15 @@ ...@@ -167,13 +168,15 @@
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated--> <!--@mbg.generated-->
delete from sys_insurance_policy delete
from sys_insurance_policy
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</delete> </delete>
<delete id="deleteByExample" <delete id="deleteByExample"
parameterType="com.glsx.ordercenter.pojo.insurance.SysInsurancePolicyExample"> parameterType="com.glsx.ordercenter.pojo.insurance.SysInsurancePolicyExample">
<!--@mbg.generated--> <!--@mbg.generated-->
delete from sys_insurance_policy delete
from sys_insurance_policy
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause"/>
</if> </if>
...@@ -183,38 +186,40 @@ ...@@ -183,38 +186,40 @@
useGeneratedKeys="true"> useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
insert into sys_insurance_policy (insurance_id, `source`, `status`, insert into sys_insurance_policy (insurance_id, `source`, `status`,
insurance_no, insurance_seq_no, insurance_company, insurance_no, insurance_seq_no, insurance_company,
gps_no, installation_time, vin, gps_no, installation_time, vin,
vehicle_no, engine_number, car_brand, vehicle_no, engine_number, car_brand,
vehicle_type, vehicle_owner_name, phone, vehicle_type, vehicle_owner_name, phone,
vehicle_owner_address, customer_type, id_card_type, vehicle_owner_address, customer_type, id_card_type,
id_card_num, insurance_commodity, pilfer_insurance_money, id_card_num, insurance_commodity, pilfer_insurance_money,
insurance_period, vehicle_color, vehicle_invoice_money, insurance_period, vehicle_color, vehicle_invoice_money,
tasting_unit, remark, expected_effective_time, tasting_unit, cancel_reason, remark,
real_effective_time, insurance_pdf, create_time, expected_effective_time, real_effective_time,
update_time, create_by, update_by insurance_pdf, create_time, update_time,
) create_by, update_by)
values (#{insuranceId,jdbcType=VARCHAR}, #{source,jdbcType=TINYINT}, values (#{insuranceId,jdbcType=VARCHAR}, #{source,jdbcType=TINYINT},
#{status,jdbcType=TINYINT}, #{status,jdbcType=TINYINT},
#{insuranceNo,jdbcType=VARCHAR}, #{insuranceSeqNo,jdbcType=VARCHAR}, #{insuranceNo,jdbcType=VARCHAR}, #{insuranceSeqNo,jdbcType=VARCHAR},
#{insuranceCompany,jdbcType=VARCHAR}, #{insuranceCompany,jdbcType=VARCHAR},
#{gpsNo,jdbcType=VARCHAR}, #{installationTime,jdbcType=TIMESTAMP}, #{vin,jdbcType=VARCHAR}, #{gpsNo,jdbcType=VARCHAR}, #{installationTime,jdbcType=TIMESTAMP},
#{vehicleNo,jdbcType=VARCHAR}, #{engineNumber,jdbcType=VARCHAR}, #{vin,jdbcType=VARCHAR},
#{carBrand,jdbcType=VARCHAR}, #{vehicleNo,jdbcType=VARCHAR}, #{engineNumber,jdbcType=VARCHAR},
#{vehicleType,jdbcType=TINYINT}, #{vehicleOwnerName,jdbcType=VARCHAR}, #{carBrand,jdbcType=VARCHAR},
#{phone,jdbcType=VARCHAR}, #{vehicleType,jdbcType=TINYINT}, #{vehicleOwnerName,jdbcType=VARCHAR},
#{vehicleOwnerAddress,jdbcType=VARCHAR}, #{customerType,jdbcType=TINYINT}, #{phone,jdbcType=VARCHAR},
#{idCardType,jdbcType=TINYINT}, #{vehicleOwnerAddress,jdbcType=VARCHAR}, #{customerType,jdbcType=TINYINT},
#{idCardNum,jdbcType=VARCHAR}, #{insuranceCommodity,jdbcType=BOOLEAN}, #{idCardType,jdbcType=TINYINT},
#{pilferInsuranceMoney,jdbcType=DECIMAL}, #{idCardNum,jdbcType=VARCHAR}, #{insuranceCommodity,jdbcType=BOOLEAN},
#{insurancePeriod,jdbcType=INTEGER}, #{vehicleColor,jdbcType=VARCHAR}, #{pilferInsuranceMoney,jdbcType=DECIMAL},
#{vehicleInvoiceMoney,jdbcType=DECIMAL}, #{insurancePeriod,jdbcType=INTEGER}, #{vehicleColor,jdbcType=VARCHAR},
#{tastingUnit,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{vehicleInvoiceMoney,jdbcType=DECIMAL},
#{expectedEffectiveTime,jdbcType=TIMESTAMP}, #{tastingUnit,jdbcType=VARCHAR}, #{cancelReason,jdbcType=VARCHAR},
#{realEffectiveTime,jdbcType=TIMESTAMP}, #{insurancePdf,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{expectedEffectiveTime,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>
<insert id="insertSelective" keyColumn="id" keyProperty="id" <insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy" parameterType="com.glsx.ordercenter.pojo.insurance.SysInsurancePolicy"
...@@ -297,6 +302,9 @@ ...@@ -297,6 +302,9 @@
<if test="tastingUnit != null"> <if test="tastingUnit != null">
tasting_unit, tasting_unit,
</if> </if>
<if test="cancelReason != null">
cancel_reason,
</if>
<if test="remark != null"> <if test="remark != null">
remark, remark,
</if> </if>
...@@ -398,6 +406,9 @@ ...@@ -398,6 +406,9 @@
<if test="tastingUnit != null"> <if test="tastingUnit != null">
#{tastingUnit,jdbcType=VARCHAR}, #{tastingUnit,jdbcType=VARCHAR},
</if> </if>
<if test="cancelReason != null">
#{cancelReason,jdbcType=VARCHAR},
</if>
<if test="remark != null"> <if test="remark != null">
#{remark,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
</if> </if>
...@@ -428,7 +439,8 @@ ...@@ -428,7 +439,8 @@
parameterType="com.glsx.ordercenter.pojo.insurance.SysInsurancePolicyExample" parameterType="com.glsx.ordercenter.pojo.insurance.SysInsurancePolicyExample"
resultType="java.lang.Long"> resultType="java.lang.Long">
<!--@mbg.generated--> <!--@mbg.generated-->
select count(*) from sys_insurance_policy select count(*)
from sys_insurance_policy
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause"/>
</if> </if>
...@@ -515,6 +527,9 @@ ...@@ -515,6 +527,9 @@
<if test="record.tastingUnit != null"> <if test="record.tastingUnit != null">
tasting_unit = #{record.tastingUnit,jdbcType=VARCHAR}, tasting_unit = #{record.tastingUnit,jdbcType=VARCHAR},
</if> </if>
<if test="record.cancelReason != null">
cancel_reason = #{record.cancelReason,jdbcType=VARCHAR},
</if>
<if test="record.remark != null"> <if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR}, remark = #{record.remark,jdbcType=VARCHAR},
</if> </if>
...@@ -548,39 +563,40 @@ ...@@ -548,39 +563,40 @@
<!--@mbg.generated--> <!--@mbg.generated-->
update sys_insurance_policy update sys_insurance_policy
set id = #{record.id,jdbcType=INTEGER}, set id = #{record.id,jdbcType=INTEGER},
insurance_id = #{record.insuranceId,jdbcType=VARCHAR}, insurance_id = #{record.insuranceId,jdbcType=VARCHAR},
`source` = #{record.source,jdbcType=TINYINT}, `source` = #{record.source,jdbcType=TINYINT},
`status` = #{record.status,jdbcType=TINYINT}, `status` = #{record.status,jdbcType=TINYINT},
insurance_no = #{record.insuranceNo,jdbcType=VARCHAR}, insurance_no = #{record.insuranceNo,jdbcType=VARCHAR},
insurance_seq_no = #{record.insuranceSeqNo,jdbcType=VARCHAR}, insurance_seq_no = #{record.insuranceSeqNo,jdbcType=VARCHAR},
insurance_company = #{record.insuranceCompany,jdbcType=VARCHAR}, insurance_company = #{record.insuranceCompany,jdbcType=VARCHAR},
gps_no = #{record.gpsNo,jdbcType=VARCHAR}, gps_no = #{record.gpsNo,jdbcType=VARCHAR},
installation_time = #{record.installationTime,jdbcType=TIMESTAMP}, installation_time = #{record.installationTime,jdbcType=TIMESTAMP},
vin = #{record.vin,jdbcType=VARCHAR}, vin = #{record.vin,jdbcType=VARCHAR},
vehicle_no = #{record.vehicleNo,jdbcType=VARCHAR}, vehicle_no = #{record.vehicleNo,jdbcType=VARCHAR},
engine_number = #{record.engineNumber,jdbcType=VARCHAR}, engine_number = #{record.engineNumber,jdbcType=VARCHAR},
car_brand = #{record.carBrand,jdbcType=VARCHAR}, car_brand = #{record.carBrand,jdbcType=VARCHAR},
vehicle_type = #{record.vehicleType,jdbcType=TINYINT}, vehicle_type = #{record.vehicleType,jdbcType=TINYINT},
vehicle_owner_name = #{record.vehicleOwnerName,jdbcType=VARCHAR}, vehicle_owner_name = #{record.vehicleOwnerName,jdbcType=VARCHAR},
phone = #{record.phone,jdbcType=VARCHAR}, phone = #{record.phone,jdbcType=VARCHAR},
vehicle_owner_address = #{record.vehicleOwnerAddress,jdbcType=VARCHAR}, vehicle_owner_address = #{record.vehicleOwnerAddress,jdbcType=VARCHAR},
customer_type = #{record.customerType,jdbcType=TINYINT}, customer_type = #{record.customerType,jdbcType=TINYINT},
id_card_type = #{record.idCardType,jdbcType=TINYINT}, id_card_type = #{record.idCardType,jdbcType=TINYINT},
id_card_num = #{record.idCardNum,jdbcType=VARCHAR}, id_card_num = #{record.idCardNum,jdbcType=VARCHAR},
insurance_commodity = #{record.insuranceCommodity,jdbcType=BOOLEAN}, insurance_commodity = #{record.insuranceCommodity,jdbcType=BOOLEAN},
pilfer_insurance_money = #{record.pilferInsuranceMoney,jdbcType=DECIMAL}, pilfer_insurance_money = #{record.pilferInsuranceMoney,jdbcType=DECIMAL},
insurance_period = #{record.insurancePeriod,jdbcType=INTEGER}, insurance_period = #{record.insurancePeriod,jdbcType=INTEGER},
vehicle_color = #{record.vehicleColor,jdbcType=VARCHAR}, vehicle_color = #{record.vehicleColor,jdbcType=VARCHAR},
vehicle_invoice_money = #{record.vehicleInvoiceMoney,jdbcType=DECIMAL}, vehicle_invoice_money = #{record.vehicleInvoiceMoney,jdbcType=DECIMAL},
tasting_unit = #{record.tastingUnit,jdbcType=VARCHAR}, tasting_unit = #{record.tastingUnit,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR}, cancel_reason = #{record.cancelReason,jdbcType=VARCHAR},
expected_effective_time = #{record.expectedEffectiveTime,jdbcType=TIMESTAMP}, remark = #{record.remark,jdbcType=VARCHAR},
real_effective_time = #{record.realEffectiveTime,jdbcType=TIMESTAMP}, expected_effective_time = #{record.expectedEffectiveTime,jdbcType=TIMESTAMP},
insurance_pdf = #{record.insurancePdf,jdbcType=VARCHAR}, real_effective_time = #{record.realEffectiveTime,jdbcType=TIMESTAMP},
create_time = #{record.createTime,jdbcType=TIMESTAMP}, insurance_pdf = #{record.insurancePdf,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
create_by = #{record.createBy,jdbcType=INTEGER}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
update_by = #{record.updateBy,jdbcType=INTEGER} create_by = #{record.createBy,jdbcType=INTEGER},
update_by = #{record.updateBy,jdbcType=INTEGER}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/> <include refid="Update_By_Example_Where_Clause"/>
</if> </if>
...@@ -665,6 +681,9 @@ ...@@ -665,6 +681,9 @@
<if test="tastingUnit != null"> <if test="tastingUnit != null">
tasting_unit = #{tastingUnit,jdbcType=VARCHAR}, tasting_unit = #{tastingUnit,jdbcType=VARCHAR},
</if> </if>
<if test="cancelReason != null">
cancel_reason = #{cancelReason,jdbcType=VARCHAR},
</if>
<if test="remark != null"> <if test="remark != null">
remark = #{remark,jdbcType=VARCHAR}, remark = #{remark,jdbcType=VARCHAR},
</if> </if>
...@@ -697,38 +716,39 @@ ...@@ -697,38 +716,39 @@
<!--@mbg.generated--> <!--@mbg.generated-->
update sys_insurance_policy update sys_insurance_policy
set insurance_id = #{insuranceId,jdbcType=VARCHAR}, set insurance_id = #{insuranceId,jdbcType=VARCHAR},
`source` = #{source,jdbcType=TINYINT}, `source` = #{source,jdbcType=TINYINT},
`status` = #{status,jdbcType=TINYINT}, `status` = #{status,jdbcType=TINYINT},
insurance_no = #{insuranceNo,jdbcType=VARCHAR}, insurance_no = #{insuranceNo,jdbcType=VARCHAR},
insurance_seq_no = #{insuranceSeqNo,jdbcType=VARCHAR}, insurance_seq_no = #{insuranceSeqNo,jdbcType=VARCHAR},
insurance_company = #{insuranceCompany,jdbcType=VARCHAR}, insurance_company = #{insuranceCompany,jdbcType=VARCHAR},
gps_no = #{gpsNo,jdbcType=VARCHAR}, gps_no = #{gpsNo,jdbcType=VARCHAR},
installation_time = #{installationTime,jdbcType=TIMESTAMP}, installation_time = #{installationTime,jdbcType=TIMESTAMP},
vin = #{vin,jdbcType=VARCHAR}, vin = #{vin,jdbcType=VARCHAR},
vehicle_no = #{vehicleNo,jdbcType=VARCHAR}, vehicle_no = #{vehicleNo,jdbcType=VARCHAR},
engine_number = #{engineNumber,jdbcType=VARCHAR}, engine_number = #{engineNumber,jdbcType=VARCHAR},
car_brand = #{carBrand,jdbcType=VARCHAR}, car_brand = #{carBrand,jdbcType=VARCHAR},
vehicle_type = #{vehicleType,jdbcType=TINYINT}, vehicle_type = #{vehicleType,jdbcType=TINYINT},
vehicle_owner_name = #{vehicleOwnerName,jdbcType=VARCHAR}, vehicle_owner_name = #{vehicleOwnerName,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR}, phone = #{phone,jdbcType=VARCHAR},
vehicle_owner_address = #{vehicleOwnerAddress,jdbcType=VARCHAR}, vehicle_owner_address = #{vehicleOwnerAddress,jdbcType=VARCHAR},
customer_type = #{customerType,jdbcType=TINYINT}, customer_type = #{customerType,jdbcType=TINYINT},
id_card_type = #{idCardType,jdbcType=TINYINT}, id_card_type = #{idCardType,jdbcType=TINYINT},
id_card_num = #{idCardNum,jdbcType=VARCHAR}, id_card_num = #{idCardNum,jdbcType=VARCHAR},
insurance_commodity = #{insuranceCommodity,jdbcType=BOOLEAN}, insurance_commodity = #{insuranceCommodity,jdbcType=BOOLEAN},
pilfer_insurance_money = #{pilferInsuranceMoney,jdbcType=DECIMAL}, pilfer_insurance_money = #{pilferInsuranceMoney,jdbcType=DECIMAL},
insurance_period = #{insurancePeriod,jdbcType=INTEGER}, insurance_period = #{insurancePeriod,jdbcType=INTEGER},
vehicle_color = #{vehicleColor,jdbcType=VARCHAR}, vehicle_color = #{vehicleColor,jdbcType=VARCHAR},
vehicle_invoice_money = #{vehicleInvoiceMoney,jdbcType=DECIMAL}, vehicle_invoice_money = #{vehicleInvoiceMoney,jdbcType=DECIMAL},
tasting_unit = #{tastingUnit,jdbcType=VARCHAR}, tasting_unit = #{tastingUnit,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR}, cancel_reason = #{cancelReason,jdbcType=VARCHAR},
expected_effective_time = #{expectedEffectiveTime,jdbcType=TIMESTAMP}, remark = #{remark,jdbcType=VARCHAR},
real_effective_time = #{realEffectiveTime,jdbcType=TIMESTAMP}, expected_effective_time = #{expectedEffectiveTime,jdbcType=TIMESTAMP},
insurance_pdf = #{insurancePdf,jdbcType=VARCHAR}, real_effective_time = #{realEffectiveTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP}, insurance_pdf = #{insurancePdf,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=INTEGER}, update_time = #{updateTime,jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=INTEGER} create_by = #{createBy,jdbcType=INTEGER},
update_by = #{updateBy,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
</mapper> </mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!