Commit 176e9879 by 翁国栋

8小时运营后台--

保全支付回调
parent 6a1a7008
...@@ -96,7 +96,7 @@ public class CallBackContorll { ...@@ -96,7 +96,7 @@ public class CallBackContorll {
@PostMapping(value = "/addpPayCallBack") @PostMapping(value = "/addpPayCallBack")
@ApiOperation(value = "11.增员核保回调", httpMethod = "POST", notes = "增员核保回调") @ApiOperation(value = "11.增员核保回调", httpMethod = "POST", notes = "增员核保回调")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Map addpPayCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { public Map addpPayCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) {
/*核保*/ /*核保*/
/*如果是在线支付的话*/ /*如果是在线支付的话*/
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
...@@ -173,7 +173,7 @@ public class CallBackContorll { ...@@ -173,7 +173,7 @@ public class CallBackContorll {
@PostMapping(value = "/CallBack") @PostMapping(value = "/CallBack")
@ApiOperation(value = "7.保全增员申请回调", httpMethod = "POST", notes = "投保申请回调") @ApiOperation(value = "7.保全增员申请回调", httpMethod = "POST", notes = "投保申请回调")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Map callBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { public Map callBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) {
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
map.put("status", "error"); map.put("status", "error");
if (StringUtils.isNullOrEmpty(pid) || StringUtils.isNullOrEmpty(sign) && StringUtils.isNullOrEmpty(timestamp)) { if (StringUtils.isNullOrEmpty(pid) || StringUtils.isNullOrEmpty(sign) && StringUtils.isNullOrEmpty(timestamp)) {
...@@ -223,7 +223,7 @@ public class CallBackContorll { ...@@ -223,7 +223,7 @@ public class CallBackContorll {
insurePolicy.setPolicyFile(callBack.getOrder_import_info().getEndorsement_file()); insurePolicy.setPolicyFile(callBack.getOrder_import_info().getEndorsement_file());
InsureLog.builder().requestParam(JSONObject.toJSONString(paramsMap)).type(7) InsureLog.builder().requestParam(JSONObject.toJSONString(paramsMap)).type(7)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/CallBack") .requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/CallBack")
.returnCode(callBack.getStatus()).returnMsg("更新成功").policyId(insurePolicy.getId()).build().insert(); .returnCode(callBack.getStatus()).returnMsg("保单增员-更新成功").policyId(insurePolicy.getId()).build().insert();
} else { } else {
String errorMsg = ""; String errorMsg = "";
InsureLog insureLog = InsureLog.builder().build().selectOne(new QueryWrapper<InsureLog>().lambda().eq(InsureLog::getTransId, callBack.getOrder_import_info().getThird_uuid())); InsureLog insureLog = InsureLog.builder().build().selectOne(new QueryWrapper<InsureLog>().lambda().eq(InsureLog::getTransId, callBack.getOrder_import_info().getThird_uuid()));
...@@ -271,7 +271,7 @@ public class CallBackContorll { ...@@ -271,7 +271,7 @@ public class CallBackContorll {
@GetMapping(value = "/payStatus") @GetMapping(value = "/payStatus")
@ApiOperation(value = "8.支付完成跳转", httpMethod = "GET", notes = "用于支付时跳回我们系统更新状态") @ApiOperation(value = "8.支付完成跳转", httpMethod = "GET", notes = "用于支付时跳回我们系统更新状态")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ModelAndView callBackPayStatus(HttpServletRequest request, @RequestParam Integer policyId) throws IOException { public ModelAndView callBackPayStatus(HttpServletRequest request, @RequestParam Integer policyId) {
InsurePolicy insurePolicy = InsurePolicy.builder().id(policyId).build().selectById(); InsurePolicy insurePolicy = InsurePolicy.builder().id(policyId).build().selectById();
InsurePay insurePay = InsurePay.builder().id(insurePolicy.getPayId()).build().selectById(); InsurePay insurePay = InsurePay.builder().id(insurePolicy.getPayId()).build().selectById();
insurePay.setPayTime(new Date()); insurePay.setPayTime(new Date());
...@@ -286,7 +286,7 @@ public class CallBackContorll { ...@@ -286,7 +286,7 @@ public class CallBackContorll {
@PostMapping(value = "/payCallBack") @PostMapping(value = "/payCallBack")
@ApiOperation(value = "9.投保支付收银台回调", httpMethod = "POST", notes = "支付完成跳转") @ApiOperation(value = "9.投保支付收银台回调", httpMethod = "POST", notes = "支付完成跳转")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Map payCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { public Map payCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) {
try { try {
InputStream is = null; InputStream is = null;
is = request.getInputStream(); is = request.getInputStream();
...@@ -343,7 +343,7 @@ public class CallBackContorll { ...@@ -343,7 +343,7 @@ public class CallBackContorll {
@PostMapping(value = "/issueCallback") @PostMapping(value = "/issueCallback")
@ApiOperation(value = "10.保单出单回调", httpMethod = "POST", notes = "支付完成跳转") @ApiOperation(value = "10.保单出单回调", httpMethod = "POST", notes = "支付完成跳转")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Map issueCallback(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { public Map issueCallback(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) {
try { try {
InputStream is = null; InputStream is = null;
is = request.getInputStream(); is = request.getInputStream();
...@@ -397,9 +397,9 @@ public class CallBackContorll { ...@@ -397,9 +397,9 @@ public class CallBackContorll {
} }
@PostMapping(value = "/batchPayCallback") @PostMapping(value = "/batchPayCallback")
@ApiOperation(value = "增员支付回调-保司接口没启用", httpMethod = "POST", notes = "增员支付回调") @ApiOperation(value = "增员支付回调", httpMethod = "POST", notes = "增员支付回调")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Map batchPayCallback(HttpServletRequest request) throws IOException { public Map batchPayCallback(HttpServletRequest request,@RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) {
try { try {
InputStream is = null; InputStream is = null;
...@@ -409,6 +409,10 @@ public class CallBackContorll { ...@@ -409,6 +409,10 @@ public class CallBackContorll {
for (int n; (n = is.read(b)) != -1; ) { for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n)); sb.append(new String(b, 0, n));
} }
String value = DigestUtils.md5Hex(pid + secretq + timestamp);
if (!value.equals(sign)) {
throw new CustomException("增员支付回调验签失败");
}
BatchPayCallBack callBack = JSONObject.parseObject(sb.toString(), BatchPayCallBack.class); BatchPayCallBack callBack = JSONObject.parseObject(sb.toString(), BatchPayCallBack.class);
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getOrder_import_uuid())); InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getOrder_import_uuid()));
if (insurePay != null) { if (insurePay != null) {
......
...@@ -1342,7 +1342,6 @@ public class InsureContorll { ...@@ -1342,7 +1342,6 @@ public class InsureContorll {
} }
} else { } else {
/*保全支付*/ /*保全支付*/
toPayParamsMap = setParams(batchToPayUrl, appidq, secretq);
toPayParamsMap.put("order_import_uuid", insurePay.getSerialNumber()); toPayParamsMap.put("order_import_uuid", insurePay.getSerialNumber());
String returnPay = HttpUtils.sendPost(batchToPayUrl, setParams(JSONObject.toJSONString(toPayParamsMap), appidq, secretq), toPayParamsMap); String returnPay = HttpUtils.sendPost(batchToPayUrl, setParams(JSONObject.toJSONString(toPayParamsMap), appidq, secretq), toPayParamsMap);
Map<String, Object> payDataMap = JSONObject.parseObject(returnPay); Map<String, Object> payDataMap = JSONObject.parseObject(returnPay);
...@@ -1353,7 +1352,10 @@ public class InsureContorll { ...@@ -1353,7 +1352,10 @@ public class InsureContorll {
insurePay.updateById(); insurePay.updateById();
InsureLog.builder().requestParam(JSONObject.toJSONString(toPayParamsMap)).returnBody(returnPay).type(7).createTime(new Date()).requestType(2).requestPath(batchToPayUrl) InsureLog.builder().requestParam(JSONObject.toJSONString(toPayParamsMap)).returnBody(returnPay).type(7).createTime(new Date()).requestType(2).requestPath(batchToPayUrl)
.returnMsg("请求保全支付").policyId(insurePolicy.getId()).build().insert(); .returnMsg("请求保全支付").policyId(insurePolicy.getId()).build().insert();
return ResultUtil.data(importPayInfo.get("pay_url").toString() + "&jump_url=" + base_api_url + "/callBack/policy/payStatus?policyId=" + insurePolicy.getId() + "&notify_url=" + base_api_url + "/callBack/policy/batchPayCallback"); /*设置验签参数*/
long timestamp = System.currentTimeMillis() / 1000;
String sign= DigestUtils.md5Hex(appidq + secretq + timestamp);
return ResultUtil.data(importPayInfo.get("pay_url").toString() + "&jump_url=" + base_api_url + "/callBack/policy/payStatus?policyId=" + insurePolicy.getId() + "&notify_url=" + base_api_url + "/callBack/policy/batchPayCallback?pid="+appidq+"?timestamp="+timestamp+"?sign="+sign);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("重新发起支付异常:", e); log.error("重新发起支付异常:", e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment