|
@@ -529,7 +529,7 @@ public class HeliPayNonOrderServiceImpl implements HeliPayNonOrderService {
|
|
|
log.info("--------进入超级会员公众号/小程序预创建订单接口----------");
|
|
|
AppPayPublicCreateOrderVo pay = new AppPayPublicCreateOrderVo();
|
|
|
//微信给openid
|
|
|
- if ("GZX".equals(heliDto.getPayType()) || "XCX".equals(heliDto.getPayType())) {
|
|
|
+ if ("GZH".equals(heliDto.getPayType()) || "XCX".equals(heliDto.getPayType())) {
|
|
|
PayParamBo tempParam = new PayParamBo();
|
|
|
BeanUtils.copyProperties(heliDto, tempParam);
|
|
|
ResponseJson<PayParamBo> jsonParam = getWeChatResponseJson(tempParam, headers);
|
|
@@ -1464,84 +1464,79 @@ public class HeliPayNonOrderServiceImpl implements HeliPayNonOrderService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResponseJson<JSONObject> payAuthVipByWeChat(HeliDto heliDto, HttpHeaders headers) {
|
|
|
+ public ResponseJson<JSONObject> payAuthVipByWeChat(HeliDto heliDto, HttpHeaders headers) throws IllegalAccessException, IntrospectionException, InvocationTargetException {
|
|
|
log.info("--------进入认证通会员公众号/小程序预创建订单接口----------");
|
|
|
- try {
|
|
|
- AppPayPublicCreateOrderVo pay = new AppPayPublicCreateOrderVo();
|
|
|
- //微信给openid
|
|
|
- if ("GZX".equals(heliDto.getPayType()) || "XCX".equals(heliDto.getPayType())) {
|
|
|
- PayParamBo tempParam = new PayParamBo();
|
|
|
- BeanUtils.copyProperties(heliDto, tempParam);
|
|
|
- ResponseJson<PayParamBo> jsonParam = getWeChatResponseJson(tempParam, headers);
|
|
|
- if (-1 == jsonParam.getCode()) {
|
|
|
- return ResponseJson.error(jsonParam.getMsg(), null);
|
|
|
- }
|
|
|
- PayParamBo payParam = jsonParam.getData();
|
|
|
- pay.setP8_openid(payParam.getOpenId());
|
|
|
- }
|
|
|
- // 获取会员套餐记录
|
|
|
- VipRecordBo record = payOrderMapper.getAuthVipRecord(heliDto.getVipRecordId());
|
|
|
- if (null == record) {
|
|
|
- log.info("【开通认证通会员-微信线上支付】该笔记录异常,记录Id:" + heliDto.getVipRecordId());
|
|
|
- return ResponseJson.error("该笔记录异常!", null);
|
|
|
- }
|
|
|
- if (null != record.getPayStatus() && 1 == record.getPayStatus()) {
|
|
|
- return ResponseJson.error("该笔记录已支付,请勿重复支付!", null);
|
|
|
+ AppPayPublicCreateOrderVo pay = new AppPayPublicCreateOrderVo();
|
|
|
+ //微信给openid
|
|
|
+ if ("GZH".equals(heliDto.getPayType()) || "XCX".equals(heliDto.getPayType())) {
|
|
|
+ PayParamBo tempParam = new PayParamBo();
|
|
|
+ BeanUtils.copyProperties(heliDto, tempParam);
|
|
|
+ ResponseJson<PayParamBo> jsonParam = getWeChatResponseJson(tempParam, headers);
|
|
|
+ if (-1 == jsonParam.getCode()) {
|
|
|
+ return ResponseJson.error(jsonParam.getMsg(), null);
|
|
|
}
|
|
|
- //合利宝接口参数赋值
|
|
|
- heliPayUtil.setOnlineValue(pay, heliDto, "authVip", headers);
|
|
|
- Map<String, String> map = MyBeanUtils.convertBean(pay, new LinkedHashMap());
|
|
|
- String oriMessage = MyBeanUtils.getSignedByPresetParameter(map, AppPayPublicCreateOrderVo.NEED_SIGN_PARAMS);
|
|
|
- oriMessage += Constant.SPLIT + Constant.SAOMA;
|
|
|
- log.info("签名原文串:" + oriMessage);
|
|
|
- String sign = Disguiser.disguiseMD5(oriMessage.trim());
|
|
|
- log.info("签名串:" + sign);
|
|
|
- map.put("sign", sign);
|
|
|
- log.info("发送参数:" + map);
|
|
|
- Map<String, Object> resultMap = HttpClientService.getHttpResp(map, Constant.REQUEST_URL);
|
|
|
- log.info("响应结果:" + resultMap);
|
|
|
- if ((Integer) resultMap.get("statusCode") == HttpStatus.SC_OK) {
|
|
|
- String resultMsg = (String) resultMap.get("response");
|
|
|
- AppPayPublicOrderResponseVo orderResponseVo = JSONObject.parseObject(resultMsg, AppPayPublicOrderResponseVo.class);
|
|
|
- String assemblyRespOriSign = MyBeanUtils.getSignedByPresetParameter(orderResponseVo, AppPayPublicOrderResponseVo.NEED_SIGN_PARAMS);
|
|
|
- log.info("组装返回结果签名串:" + assemblyRespOriSign);
|
|
|
- assemblyRespOriSign += Constant.SPLIT + Constant.SAOMA;
|
|
|
- String responseSign = orderResponseVo.getSign();
|
|
|
- log.info("响应签名:" + responseSign);
|
|
|
- String checkSign = Disguiser.disguiseMD5(assemblyRespOriSign.trim());
|
|
|
- if (checkSign.equals(responseSign) && "0000".equals(orderResponseVo.getRt2_retCode())) {
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(resultMsg);
|
|
|
- // 保存开通认证通会员分账参数
|
|
|
- SplitAccountPo splitAccount = new SplitAccountPo();
|
|
|
- splitAccount.setAuthVipRecordId(heliDto.getVipRecordId());
|
|
|
- // 超级会员 公账-专票
|
|
|
- splitAccount.setType(1);
|
|
|
- // 待分账总金额
|
|
|
- double splitAmount = record.getPrice();
|
|
|
- // 总手续费
|
|
|
- double procedureFee;
|
|
|
- //手续费
|
|
|
- procedureFee = MathUtil.mul(splitAmount, 0.0025, 2).doubleValue();
|
|
|
- if (MathUtil.compare(procedureFee, 0) == 0) {
|
|
|
- procedureFee = 0.01;
|
|
|
- }
|
|
|
- splitAmount = MathUtil.sub(splitAmount, procedureFee).doubleValue();
|
|
|
- splitAccount.setSplitAccount(splitAmount);
|
|
|
- splitAccount.setMbOrderId(orderResponseVo.getRt6_serialNumber());
|
|
|
- splitAccount.setOrderRequestNo(orderResponseVo.getRt5_orderId());
|
|
|
- splitAccount.setPayStatus(0);
|
|
|
- // 保存分账详情
|
|
|
- payOrderMapper.insertSplitAccount(splitAccount);
|
|
|
- return ResponseJson.success("请求成功", jsonObject);
|
|
|
- } else {
|
|
|
- return ResponseJson.error("支付请求失败", JSONObject.parseObject(resultMsg));
|
|
|
+ PayParamBo payParam = jsonParam.getData();
|
|
|
+ pay.setP8_openid(payParam.getOpenId());
|
|
|
+ }
|
|
|
+ // 获取会员套餐记录
|
|
|
+ VipRecordBo record = payOrderMapper.getAuthVipRecord(heliDto.getVipRecordId());
|
|
|
+ if (null == record) {
|
|
|
+ log.info("【开通认证通会员-微信线上支付】该笔记录异常,记录Id:" + heliDto.getVipRecordId());
|
|
|
+ return ResponseJson.error("该笔记录异常!", null);
|
|
|
+ }
|
|
|
+ if (null != record.getPayStatus() && 1 == record.getPayStatus()) {
|
|
|
+ return ResponseJson.error("该笔记录已支付,请勿重复支付!", null);
|
|
|
+ }
|
|
|
+ //合利宝接口参数赋值
|
|
|
+ heliPayUtil.setOnlineValue(pay, heliDto, "authVip", headers);
|
|
|
+ Map<String, String> map = MyBeanUtils.convertBean(pay, new LinkedHashMap());
|
|
|
+ String oriMessage = MyBeanUtils.getSignedByPresetParameter(map, AppPayPublicCreateOrderVo.NEED_SIGN_PARAMS);
|
|
|
+ oriMessage += Constant.SPLIT + Constant.SAOMA;
|
|
|
+ log.info("签名原文串:" + oriMessage);
|
|
|
+ String sign = Disguiser.disguiseMD5(oriMessage.trim());
|
|
|
+ log.info("签名串:" + sign);
|
|
|
+ map.put("sign", sign);
|
|
|
+ log.info("发送参数:" + map);
|
|
|
+ Map<String, Object> resultMap = HttpClientService.getHttpResp(map, Constant.REQUEST_URL);
|
|
|
+ log.info("响应结果:" + resultMap);
|
|
|
+ if ((Integer) resultMap.get("statusCode") == HttpStatus.SC_OK) {
|
|
|
+ String resultMsg = (String) resultMap.get("response");
|
|
|
+ AppPayPublicOrderResponseVo orderResponseVo = JSONObject.parseObject(resultMsg, AppPayPublicOrderResponseVo.class);
|
|
|
+ String assemblyRespOriSign = MyBeanUtils.getSignedByPresetParameter(orderResponseVo, AppPayPublicOrderResponseVo.NEED_SIGN_PARAMS);
|
|
|
+ log.info("组装返回结果签名串:" + assemblyRespOriSign);
|
|
|
+ assemblyRespOriSign += Constant.SPLIT + Constant.SAOMA;
|
|
|
+ String responseSign = orderResponseVo.getSign();
|
|
|
+ log.info("响应签名:" + responseSign);
|
|
|
+ String checkSign = Disguiser.disguiseMD5(assemblyRespOriSign.trim());
|
|
|
+ if (checkSign.equals(responseSign) && "0000".equals(orderResponseVo.getRt2_retCode())) {
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(resultMsg);
|
|
|
+ // 保存开通认证通会员分账参数
|
|
|
+ SplitAccountPo splitAccount = new SplitAccountPo();
|
|
|
+ splitAccount.setAuthVipRecordId(heliDto.getVipRecordId());
|
|
|
+ // 超级会员 公账-专票
|
|
|
+ splitAccount.setType(1);
|
|
|
+ // 待分账总金额
|
|
|
+ double splitAmount = record.getPrice();
|
|
|
+ // 总手续费
|
|
|
+ double procedureFee;
|
|
|
+ //手续费
|
|
|
+ procedureFee = MathUtil.mul(splitAmount, 0.0025, 2).doubleValue();
|
|
|
+ if (MathUtil.compare(procedureFee, 0) == 0) {
|
|
|
+ procedureFee = 0.01;
|
|
|
}
|
|
|
+ splitAmount = MathUtil.sub(splitAmount, procedureFee).doubleValue();
|
|
|
+ splitAccount.setSplitAccount(splitAmount);
|
|
|
+ splitAccount.setMbOrderId(orderResponseVo.getRt6_serialNumber());
|
|
|
+ splitAccount.setOrderRequestNo(orderResponseVo.getRt5_orderId());
|
|
|
+ splitAccount.setPayStatus(0);
|
|
|
+ // 保存分账详情
|
|
|
+ payOrderMapper.insertSplitAccount(splitAccount);
|
|
|
+ return ResponseJson.success("请求成功", jsonObject);
|
|
|
} else {
|
|
|
- return ResponseJson.error("请求失败", null);
|
|
|
+ return ResponseJson.error("支付请求失败", JSONObject.parseObject(resultMsg));
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("交易失败" + e);
|
|
|
- return ResponseJson.error("交易失败", null);
|
|
|
+ } else {
|
|
|
+ return ResponseJson.error("请求失败", null);
|
|
|
}
|
|
|
}
|
|
|
|