|
@@ -1366,148 +1366,148 @@ public class StoreOrderScrmController extends AppBaseController {
|
|
|
return R.ok().put("order", orderRes).put("prescribeOrder",prescribeOrder);
|
|
return R.ok().put("order", orderRes).put("prescribeOrder",prescribeOrder);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// @Login
|
|
|
|
|
-// @ApiOperation("亲友支付")
|
|
|
|
|
-// @PostMapping("/otherPaymentByCombinationId")
|
|
|
|
|
-// @Transactional
|
|
|
|
|
-// public R otherPaymentByCombinationId(@Validated @RequestBody FsStoreOrderOtherPayCombinationIdParam param, HttpServletRequest request) {
|
|
|
|
|
-// final WxMaService wxService = WxMaConfiguration.getMaService(param.getAppId());
|
|
|
|
|
-// try {
|
|
|
|
|
-// //组合微信支付order
|
|
|
|
|
-// FsStoreOrderScrm fsStoreOrder = new FsStoreOrderScrm();
|
|
|
|
|
-// BigDecimal payPrice = BigDecimal.ZERO;
|
|
|
|
|
-// BigDecimal payMoneyTotal = BigDecimal.ZERO;
|
|
|
|
|
-//
|
|
|
|
|
-// String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
|
|
-// //新增的支付详情id
|
|
|
|
|
-// ArrayList<Long> paymentIds = new ArrayList<>();
|
|
|
|
|
-// String ip = IpUtil.getRequestIp();
|
|
|
|
|
-// WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(param.getCode());
|
|
|
|
|
-// FsUserScrm user = userService.selectFsUserByMaOpenId(session.getOpenid());
|
|
|
|
|
-// if (user == null) {
|
|
|
|
|
-// //创建
|
|
|
|
|
-// user = new FsUserScrm();
|
|
|
|
|
-// user.setUsername("");
|
|
|
|
|
-// user.setNickname("微信用户");
|
|
|
|
|
-// user.setStatus(1);
|
|
|
|
|
-// user.setMaOpenId(session.getOpenid());
|
|
|
|
|
-// user.setUnionId(session.getUnionid());
|
|
|
|
|
-// user.setIsWeixinAuth(0);
|
|
|
|
|
-// user.setLastIp(ip);
|
|
|
|
|
-// user.setCreateTime(new Date());
|
|
|
|
|
-// userService.insertFsUser(user);
|
|
|
|
|
-// }
|
|
|
|
|
-//// FsStoreOrder order = orderService.selectFsStoreOrderById(param.getOrderId());
|
|
|
|
|
-// List<FsStoreOrderScrm> orders = orderService.getStoreOrderByCombinationId(param.getCombinationOrderId());
|
|
|
|
|
-// for (FsStoreOrderScrm order : orders) {
|
|
|
|
|
-// if (order == null) {
|
|
|
|
|
-// return R.error("订单不存在");
|
|
|
|
|
-// }
|
|
|
|
|
-// if (order.getStatus() != OrderInfoEnum.STATUS_0.getValue()) {
|
|
|
|
|
-// return R.error("此订单不能支付");
|
|
|
|
|
-// }
|
|
|
|
|
-// if (order.getPayMoney().compareTo(new BigDecimal(0)) < 1) {
|
|
|
|
|
-// return R.error("此订单没有可支付的金额");
|
|
|
|
|
-// }
|
|
|
|
|
-// payPrice = NumberUtil.add(payPrice, order.getPayPrice());
|
|
|
|
|
-// payMoneyTotal = NumberUtil.add(payMoneyTotal, order.getPayMoney());
|
|
|
|
|
-// String paySubCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
|
|
-// //小雨点支付
|
|
|
|
|
-// FsStorePaymentScrm storePayment = new FsStorePaymentScrm();
|
|
|
|
|
-// storePayment.setCompanyId(order.getCompanyId());
|
|
|
|
|
-// storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
|
|
-// storePayment.setStatus(0);
|
|
|
|
|
-// storePayment.setPayCode(payCode);
|
|
|
|
|
-// storePayment.setPaySubCode(paySubCode);
|
|
|
|
|
-// storePayment.setPayMoney(order.getPayMoney());
|
|
|
|
|
-// storePayment.setCreateTime(new Date());
|
|
|
|
|
-// storePayment.setPayTypeCode("weixin");
|
|
|
|
|
-// storePayment.setBusinessType(2);
|
|
|
|
|
-// storePayment.setRemark("商城订单支付");
|
|
|
|
|
-// storePayment.setOpenId(session.getOpenid());
|
|
|
|
|
-// storePayment.setUserId(user.getUserId());
|
|
|
|
|
-// storePayment.setBusinessOrderId(order.getCombinationOrderId().toString());
|
|
|
|
|
-// storePayment.setOrderId(order.getId());
|
|
|
|
|
-// fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
|
|
|
-// paymentIds.add(storePayment.getPaymentId());
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// //创建订单
|
|
|
|
|
-// fsStoreOrder.setPayType(orders.get(0).getPayType());
|
|
|
|
|
-// fsStoreOrder.setCompanyId(orders.get(0).getCompanyId());
|
|
|
|
|
-// fsStoreOrder.setCompanyUserId(orders.get(0).getCompanyUserId());
|
|
|
|
|
-// fsStoreOrder.setPayMoney(payMoneyTotal);
|
|
|
|
|
-//// fsStoreOrder.setPayMoney(BigDecimal.valueOf(0.01));
|
|
|
|
|
-// fsStoreOrder.setRealName(orders.get(0).getRealName());
|
|
|
|
|
-// fsStoreOrder.setCombinationOrderId(orders.get(0).getCombinationOrderId());
|
|
|
|
|
-//
|
|
|
|
|
-// FsStorePaymentScrm payment = new FsStorePaymentScrm();
|
|
|
|
|
-// payment.setCompanyId(fsStoreOrder.getCompanyId());
|
|
|
|
|
-// payment.setCompanyUserId(fsStoreOrder.getCompanyUserId());
|
|
|
|
|
-// payment.setStatus(0);
|
|
|
|
|
-// payment.setPayCode(payCode);
|
|
|
|
|
-// payment.setPayMoney(fsStoreOrder.getPayMoney());
|
|
|
|
|
-// payment.setCreateTime(new Date());
|
|
|
|
|
-// payment.setPayTypeCode("weixin");
|
|
|
|
|
-// payment.setBusinessType(2);
|
|
|
|
|
-// payment.setRemark("商城订单支付");
|
|
|
|
|
-// payment.setOpenId(session.getOpenid());
|
|
|
|
|
-// payment.setUserId(user.getUserId());
|
|
|
|
|
-//
|
|
|
|
|
-// HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
|
|
-// o.setTradeType("T_MINIAPP");
|
|
|
|
|
-// o.setOpenid(user.getMaOpenId());
|
|
|
|
|
-//// o.setReqSeqId("store-" + storePayment.getPayCode());
|
|
|
|
|
-// o.setReqSeqId("store-" + payment.getPayCode());
|
|
|
|
|
-// o.setTransAmt(payment.getPayMoney().toString());
|
|
|
|
|
-// o.setGoodsDesc("商城订单支付");
|
|
|
|
|
-// HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
|
|
|
-// if (result.getBank_code() != null && result.getBank_code().equals("00000000")) {
|
|
|
|
|
-// for (int i = 0; i < paymentIds.size(); i++) {
|
|
|
|
|
-// FsStorePaymentScrm mt = new FsStorePaymentScrm();
|
|
|
|
|
-// mt.setPaymentId(Long.parseLong(paymentIds.get(i).toString()));
|
|
|
|
|
-// mt.setTradeNo(result.getHf_seq_id());
|
|
|
|
|
-// fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
|
|
|
-// redisCache.setCacheObject("isPaying:" + orders.get(i).getId(), orders.get(i).getId().toString(), 1, TimeUnit.MINUTES);
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// String mes = result.getPay_info();
|
|
|
|
|
-// JSONObject payInfo = JSONUtil.parseObj(mes);
|
|
|
|
|
-// FsHuiFuPayInfo fsHuiFuPayInfo = new FsHuiFuPayInfo();
|
|
|
|
|
-// if (payInfo.get("timeStamp") != null) {
|
|
|
|
|
-// fsHuiFuPayInfo.setTimeStamp(payInfo.get("timeStamp").toString());
|
|
|
|
|
-// }
|
|
|
|
|
-// if (payInfo.get("package") != null) {
|
|
|
|
|
-// fsHuiFuPayInfo.setPackageStr(payInfo.get("package").toString());
|
|
|
|
|
-// }
|
|
|
|
|
-// if (payInfo.get("paySign") != null) {
|
|
|
|
|
-// fsHuiFuPayInfo.setPaySign(payInfo.get("paySign").toString());
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
-// if (payInfo.get("appId") != null) {
|
|
|
|
|
-// fsHuiFuPayInfo.setAppId(payInfo.get("appId").toString());
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
-// if (payInfo.get("signType") != null) {
|
|
|
|
|
-// fsHuiFuPayInfo.setSignType(payInfo.get("signType").toString());
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
-// if (payInfo.get("nonceStr") != null) {
|
|
|
|
|
-// fsHuiFuPayInfo.setNonceStr(payInfo.get("nonceStr").toString());
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// return R.ok().put("result", fsHuiFuPayInfo);
|
|
|
|
|
-// } else {
|
|
|
|
|
-// return R.error(result.getResp_desc());
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// } catch (WxErrorException e) {
|
|
|
|
|
-// e.printStackTrace();
|
|
|
|
|
-// return R.error(e.getMessage());
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ @Login
|
|
|
|
|
+ @ApiOperation("亲友支付")
|
|
|
|
|
+ @PostMapping("/otherPaymentByCombinationId")
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ public R otherPaymentByCombinationId(@Validated @RequestBody FsStoreOrderOtherPayCombinationIdParam param, HttpServletRequest request) {
|
|
|
|
|
+ final WxMaService wxService = WxMaConfiguration.getMaService(param.getAppId());
|
|
|
|
|
+ try {
|
|
|
|
|
+ //组合微信支付order
|
|
|
|
|
+ FsStoreOrderScrm fsStoreOrder = new FsStoreOrderScrm();
|
|
|
|
|
+ BigDecimal payPrice = BigDecimal.ZERO;
|
|
|
|
|
+ BigDecimal payMoneyTotal = BigDecimal.ZERO;
|
|
|
|
|
+
|
|
|
|
|
+ String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
|
|
+ //新增的支付详情id
|
|
|
|
|
+ ArrayList<Long> paymentIds = new ArrayList<>();
|
|
|
|
|
+ String ip = IpUtil.getRequestIp();
|
|
|
|
|
+ WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(param.getCode());
|
|
|
|
|
+ FsUser user = userService.selectFsUserByMaOpenId(session.getOpenid());
|
|
|
|
|
+ if (user == null) {
|
|
|
|
|
+ //创建
|
|
|
|
|
+ user = new FsUser();
|
|
|
|
|
+ user.setUsername("");
|
|
|
|
|
+ user.setNickname("微信用户");
|
|
|
|
|
+ user.setStatus(1);
|
|
|
|
|
+ user.setMaOpenId(session.getOpenid());
|
|
|
|
|
+ user.setUnionId(session.getUnionid());
|
|
|
|
|
+ user.setIsWeixinAuth(0);
|
|
|
|
|
+ user.setLastIp(ip);
|
|
|
|
|
+ user.setCreateTime(new Date());
|
|
|
|
|
+ userService.insertFsUser(user);
|
|
|
|
|
+ }
|
|
|
|
|
+// FsStoreOrder order = orderService.selectFsStoreOrderById(param.getOrderId());
|
|
|
|
|
+ List<FsStoreOrderScrm> orders = orderService.getStoreOrderByCombinationId(param.getCombinationOrderId());
|
|
|
|
|
+ for (FsStoreOrderScrm order : orders) {
|
|
|
|
|
+ if (order == null) {
|
|
|
|
|
+ return R.error("订单不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (order.getStatus() != OrderInfoEnum.STATUS_0.getValue()) {
|
|
|
|
|
+ return R.error("此订单不能支付");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (order.getPayMoney().compareTo(new BigDecimal(0)) < 1) {
|
|
|
|
|
+ return R.error("此订单没有可支付的金额");
|
|
|
|
|
+ }
|
|
|
|
|
+ payPrice = NumberUtil.add(payPrice, order.getPayPrice());
|
|
|
|
|
+ payMoneyTotal = NumberUtil.add(payMoneyTotal, order.getPayMoney());
|
|
|
|
|
+ String paySubCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
|
|
+ //小雨点支付
|
|
|
|
|
+ FsStorePaymentScrm storePayment = new FsStorePaymentScrm();
|
|
|
|
|
+ storePayment.setCompanyId(order.getCompanyId());
|
|
|
|
|
+ storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
|
|
+ storePayment.setStatus(0);
|
|
|
|
|
+ storePayment.setPayCode(payCode);
|
|
|
|
|
+ storePayment.setPaySubCode(paySubCode);
|
|
|
|
|
+ storePayment.setPayMoney(order.getPayMoney());
|
|
|
|
|
+ storePayment.setCreateTime(new Date());
|
|
|
|
|
+ storePayment.setPayTypeCode("weixin");
|
|
|
|
|
+ storePayment.setBusinessType(2);
|
|
|
|
|
+ storePayment.setRemark("商城订单支付");
|
|
|
|
|
+ storePayment.setOpenId(session.getOpenid());
|
|
|
|
|
+ storePayment.setUserId(user.getUserId());
|
|
|
|
|
+ storePayment.setBusinessOrderId(order.getCombinationOrderId().toString());
|
|
|
|
|
+ storePayment.setOrderId(order.getId());
|
|
|
|
|
+ fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
|
|
|
+ paymentIds.add(storePayment.getPaymentId());
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //创建订单
|
|
|
|
|
+ fsStoreOrder.setPayType(orders.get(0).getPayType());
|
|
|
|
|
+ fsStoreOrder.setCompanyId(orders.get(0).getCompanyId());
|
|
|
|
|
+ fsStoreOrder.setCompanyUserId(orders.get(0).getCompanyUserId());
|
|
|
|
|
+ fsStoreOrder.setPayMoney(payMoneyTotal);
|
|
|
|
|
+// fsStoreOrder.setPayMoney(BigDecimal.valueOf(0.01));
|
|
|
|
|
+ fsStoreOrder.setRealName(orders.get(0).getRealName());
|
|
|
|
|
+ fsStoreOrder.setCombinationOrderId(orders.get(0).getCombinationOrderId());
|
|
|
|
|
+
|
|
|
|
|
+ FsStorePaymentScrm payment = new FsStorePaymentScrm();
|
|
|
|
|
+ payment.setCompanyId(fsStoreOrder.getCompanyId());
|
|
|
|
|
+ payment.setCompanyUserId(fsStoreOrder.getCompanyUserId());
|
|
|
|
|
+ payment.setStatus(0);
|
|
|
|
|
+ payment.setPayCode(payCode);
|
|
|
|
|
+ payment.setPayMoney(fsStoreOrder.getPayMoney());
|
|
|
|
|
+ payment.setCreateTime(new Date());
|
|
|
|
|
+ payment.setPayTypeCode("weixin");
|
|
|
|
|
+ payment.setBusinessType(2);
|
|
|
|
|
+ payment.setRemark("商城订单支付");
|
|
|
|
|
+ payment.setOpenId(session.getOpenid());
|
|
|
|
|
+ payment.setUserId(user.getUserId());
|
|
|
|
|
+
|
|
|
|
|
+ HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
|
|
+ o.setTradeType("T_MINIAPP");
|
|
|
|
|
+ o.setOpenid(user.getMaOpenId());
|
|
|
|
|
+// o.setReqSeqId("store-" + storePayment.getPayCode());
|
|
|
|
|
+ o.setReqSeqId("store-" + payment.getPayCode());
|
|
|
|
|
+ o.setTransAmt(payment.getPayMoney().toString());
|
|
|
|
|
+ o.setGoodsDesc("商城订单支付");
|
|
|
|
|
+ HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
|
|
|
+ if (result.getBank_code() != null && result.getBank_code().equals("00000000")) {
|
|
|
|
|
+ for (int i = 0; i < paymentIds.size(); i++) {
|
|
|
|
|
+ FsStorePaymentScrm mt = new FsStorePaymentScrm();
|
|
|
|
|
+ mt.setPaymentId(Long.parseLong(paymentIds.get(i).toString()));
|
|
|
|
|
+ mt.setTradeNo(result.getHf_seq_id());
|
|
|
|
|
+ fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
|
|
|
+ redisCache.setCacheObject("isPaying:" + orders.get(i).getId(), orders.get(i).getId().toString(), 1, TimeUnit.MINUTES);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String mes = result.getPay_info();
|
|
|
|
|
+ JSONObject payInfo = JSONUtil.parseObj(mes);
|
|
|
|
|
+ FsHuiFuPayInfo fsHuiFuPayInfo = new FsHuiFuPayInfo();
|
|
|
|
|
+ if (payInfo.get("timeStamp") != null) {
|
|
|
|
|
+ fsHuiFuPayInfo.setTimeStamp(payInfo.get("timeStamp").toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payInfo.get("package") != null) {
|
|
|
|
|
+ fsHuiFuPayInfo.setPackageStr(payInfo.get("package").toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payInfo.get("paySign") != null) {
|
|
|
|
|
+ fsHuiFuPayInfo.setPaySign(payInfo.get("paySign").toString());
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payInfo.get("appId") != null) {
|
|
|
|
|
+ fsHuiFuPayInfo.setAppId(payInfo.get("appId").toString());
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payInfo.get("signType") != null) {
|
|
|
|
|
+ fsHuiFuPayInfo.setSignType(payInfo.get("signType").toString());
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ if (payInfo.get("nonceStr") != null) {
|
|
|
|
|
+ fsHuiFuPayInfo.setNonceStr(payInfo.get("nonceStr").toString());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return R.ok().put("result", fsHuiFuPayInfo);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return R.error(result.getResp_desc());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ } catch (WxErrorException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ return R.error(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 检查订单列表中是否存在含处方药但未开方的订单
|
|
* 检查订单列表中是否存在含处方药但未开方的订单
|