Commit 0f71691f by 翁国栋 Committed by 284718418@qq.com

8小时后台--

支付完成跳转页面
parent 065e806b
...@@ -18,6 +18,7 @@ import org.slf4j.LoggerFactory; ...@@ -18,6 +18,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
...@@ -59,6 +60,11 @@ public class CallBackContorll { ...@@ -59,6 +60,11 @@ public class CallBackContorll {
private String batchToPayUrl; private String batchToPayUrl;
/*支付回调*/
@Value("${pay_page}")
private String payPage;
private Map setParams(String sign, String appid, String secret) { private Map setParams(String sign, String appid, String secret) {
/*当前时间戳*/ /*当前时间戳*/
long timestamp = System.currentTimeMillis() / 1000; long timestamp = System.currentTimeMillis() / 1000;
...@@ -135,14 +141,14 @@ public class CallBackContorll { ...@@ -135,14 +141,14 @@ public class CallBackContorll {
} }
CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class); CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class);
if(callBack.getCallback_type().equals("1")) { 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(); InsurePolicy insurePolicy = InsurePolicy.builder().id(insureUserList.get(0).getPolicyId()).build().selectById();
if(callBack.getStatus().equals("1")) { if(callBack.getStatus().equals("1")) {
if (insureUserList.size() > 0) { if (insureUserList.size() > 0) {
insurePolicy.setStatus("4");/*设置为支付状态*/ insurePolicy.setStatus("4");/*设置为支付状态*/
insurePolicy.setUpdateTime(new Date()); insurePolicy.setUpdateTime(new Date());
InsurePay insurePay= InsurePay.builder().payStatus(1). 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(); insurePay.insert();
insurePolicy.setPayId(insurePay.getId()); insurePolicy.setPayId(insurePay.getId());
insurePolicy.updateById(); insurePolicy.updateById();
...@@ -150,7 +156,7 @@ public class CallBackContorll { ...@@ -150,7 +156,7 @@ public class CallBackContorll {
} }
InsureLog.builder().type(7) InsureLog.builder().type(7)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/addpPayCallBack") .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{ }else{
...@@ -261,10 +267,17 @@ public class CallBackContorll { ...@@ -261,10 +267,17 @@ public class CallBackContorll {
@GetMapping(value = "/payStatus") @GetMapping(value = "/payStatus")
@ApiOperation(value = "8.支付完成跳转", httpMethod = "GET", notes = "用于支付时跳回我们系统更新状态") @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("支付完成回调(仅代表用户点了已支付,无法确认是否真正支付)"); 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) 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") @PostMapping(value = "/payCallBack")
......
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