Commit 97e8551a by 翁国栋

8小时后台--

支付完成跳转页面
parent 2f350214
......@@ -18,6 +18,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
......@@ -59,6 +60,11 @@ public class CallBackContorll {
private String batchToPayUrl;
/*支付回调*/
@Value("${pay_page}")
private String payPage;
private Map setParams(String sign, String appid, String secret) {
/*当前时间戳*/
long timestamp = System.currentTimeMillis() / 1000;
......@@ -135,14 +141,14 @@ public class CallBackContorll {
}
CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class);
if(callBack.getCallback_type().equals("1")) {
List<InsureUser> insureUserList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo, callBack.getOrder_import_info().getUuid()));
List<InsureUser> insureUserList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getTransId, callBack.getOrder_import_info().getThird_uuid()));
InsurePolicy insurePolicy = InsurePolicy.builder().id(insureUserList.get(0).getPolicyId()).build().selectById();
if(callBack.getStatus().equals("1")) {
if (insureUserList.size() > 0) {
insurePolicy.setStatus("4");/*设置为支付状态*/
insurePolicy.setUpdateTime(new Date());
InsurePay insurePay= InsurePay.builder().payStatus(1).
serialNumber(callBack.getOrder_import_info().getUuid()).policyId(insurePolicy.getId()).build();
serialNumber(callBack.getOrder_import_info().getUuid()).policyId(insurePolicy.getId()).amount(Double.parseDouble(callBack.getOrder_import_info().getTotal_money())).build();
insurePay.insert();
insurePolicy.setPayId(insurePay.getId());
insurePolicy.updateById();
......@@ -150,7 +156,7 @@ public class CallBackContorll {
}
InsureLog.builder().type(7)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/addpPayCallBack")
.returnCode(callBack.getStatus()).returnMsg("核保通过").policyId(insurePolicy.getId()).build();
.returnCode(callBack.getStatus()).returnMsg("核保通过").policyId(insurePolicy.getId()).build().insert();
}else{
......@@ -261,10 +267,17 @@ public class CallBackContorll {
@GetMapping(value = "/payStatus")
@ApiOperation(value = "8.支付完成跳转", httpMethod = "GET", notes = "用于支付时跳回我们系统更新状态")
private void callBackPayStatus(HttpServletRequest request, @RequestParam Integer policyId) throws IOException {
private ModelAndView callBackPayStatus(HttpServletRequest request, @RequestParam Integer policyId) throws IOException {
log.info("支付完成回调(仅代表用户点了已支付,无法确认是否真正支付)");
InsurePolicy insurePolicy = InsurePolicy.builder().id(policyId).build().selectById();
InsurePay insurePay = InsurePay.builder().id(insurePolicy.getPayId()).build().selectById();
insurePay.setPayTime(new Date());
insurePay.updateById();
InsureLog.builder().type(7).createTime(new Date()).requestType(2).requestPath(base_api_url + "/payStatus?policyId=" + policyId)
.returnCode("suc").returnMsg("用户已支付,等待更新保单状态").policyId(policyId).build().insert();
.returnCode("suc").returnMsg("用户已支付"+insurePay.getAmount()+"元,等待更新保单状态").policyId(policyId).build().insert();
ModelAndView mav = new ModelAndView();
mav.setViewName("redirect:"+payPage+"/#/policy/payPage");
return mav;
}
@PostMapping(value = "/payCallBack")
......
......@@ -1490,6 +1490,7 @@ public class InsureContorll {
Map<String, Object> payData = JSONObject.parseObject(JSONObject.toJSONString(payDataMap.get("data")));
Map<String, Object> importPayInfo = JSONObject.parseObject(JSONObject.toJSONString(payData.get("import_pay_info")));
insurePay.setPaySerialNo(importPayInfo.get("pay_serial_no").toString());
insurePay.setAmount(Double.parseDouble(importPayInfo.get("pay_money").toString()));
insurePay.updateById();
return ResultUtil.data(importPayInfo.get("pay_url").toString()+"&jump_url="+base_api_url +"/callBack/policy/payStatus?policyId="+insurePolicy.getId());
}
......
......@@ -304,3 +304,6 @@ insure:
# base_api_url
BASE_API_URL: 'http://o49t563035.qicp.vip'
#支付回调
pay_page: 'http://localhost:9527'
......@@ -286,3 +286,5 @@ youling:
#h5服务地址
h5:
url: 'http://h5.8timer.cn'
#支付回调
pay_page: 'http://oss.youlingrc.com'
......@@ -281,5 +281,8 @@ youling:
h5:
url: 'http://javays.com'
#支付回调
pay_page: 'http://test-insurance-api.youlingrc.com'
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