| | |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.OrderCancel; |
| | | import com.stylefeng.guns.modular.system.model.OrderPosition; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.*; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.model.TransactionDetails; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | |
| | | @Autowired |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | |
| | | @Autowired |
| | | private IPaymentRecordService paymentRecordService; |
| | | |
| | | @Autowired |
| | | private IOrderCancelService orderCancelService; |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 取消订单退款回调 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/orderCancelRefundCallback") |
| | | public PayoutCallbackResponse orderCancelRefundCallback(@RequestBody PayoutCallbackRequest request){ |
| | | try { |
| | | System.err.println("转账回调>>>>" + JSON.toJSONString(request)); |
| | | PayoutCallbackResponse payoutCallbackResponse = new PayoutCallbackResponse(); |
| | | AuthStatus authStatus = new AuthStatus(); |
| | | authStatus.setAuthStatusCode(131); |
| | | authStatus.setAuthStatusDescription("Authentication was successful"); |
| | | payoutCallbackResponse.setAuthStatus(authStatus); |
| | | Results results = new Results(); |
| | | PayoutPacket packet = request.getPayload().getPacket(); |
| | | String statusCode = packet.getStatusCode(); |
| | | String beepTransactionID = packet.getBeepTransactionID(); |
| | | String payerTransactionID = packet.getPayerTransactionID(); |
| | | |
| | | String id = payerTransactionID.substring(17); |
| | | OrderCancel orderCancel = orderCancelService.selectById(id); |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderCancel.getOrderId()); |
| | | PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 1, 2); |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "小件物流取消退款", query.getAmount(), 1, 1, 1, 4, orderLogistics.getId()); |
| | | |
| | | results.setBeepTransactionID(beepTransactionID); |
| | | results.setPayerTransactionID(payerTransactionID); |
| | | results.setStatusCode("188"); |
| | | results.setStatusDescription("Response was received"); |
| | | payoutCallbackResponse.setResults(results); |
| | | return payoutCallbackResponse; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取消操作支付 |
| | |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.*; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.TinggPayUtil; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.TinggPayoutUtil; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.AuthStatus; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.CheckoutRequest; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.PayoutResponse; |
| | | import com.stylefeng.guns.modular.system.util.Tingg.model.Results; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | |
| | | |
| | | @Autowired |
| | | private IBankCardService bankCardService; |
| | | |
| | | @Autowired |
| | | private TinggPayoutUtil tinggPayoutUtil; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | |
| | | orderCancelService.insert(orderCancel); |
| | | orderLogistics.setState(10); |
| | | this.updateById(orderLogistics); |
| | | integer = orderCancel.getId(); |
| | | //调用回退接口 |
| | | PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 1, 2); |
| | | Map<String, String> merrefund = payMoneyUtil.wxRefund(query.getCode(),orderLogistics.getId() + "," + orderLogistics.getType(),query.getAmount()+"",query.getAmount()+"",""); |
| | | //Map<String, Object> merrefund = icbcPayUtil.merrefund(query.getCode(), "", query.getAmount(), orderLogistics.getId() + "_" + orderLogistics.getType(), orderLogistics.getOrderNum()); |
| | | if ("SUCCESS".equals(merrefund.get("return_code"))) {//成功 |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "小件物流取消退款", query.getAmount(), 1, 1, 1, 4, orderLogistics.getId()); |
| | | }else{ |
| | | return ResultUtil.error("退款返回未知异常"); |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String payerTransactionID = sdf.format(new Date()) + orderCancel.getId(); |
| | | PayoutResponse payoutResponse = tinggPayoutUtil.sendPayout(userInfo.getPhoneOperator(), "+" + userInfo.getPhone(), payerTransactionID, query.getAmount().doubleValue(), callbackPath + "/base/orderCancelRefundCallback", "取消订单退款"); |
| | | AuthStatus authStatus = payoutResponse.getAuthStatus(); |
| | | Results results = payoutResponse.getResults().get(0); |
| | | String statusCode = results.getStatusCode(); |
| | | if(!"131".equals(authStatus.getAuthStatusCode())){ |
| | | return ResultUtil.error(authStatus.getAuthStatusDescription()); |
| | | } |
| | | /*if (Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 1) {//失败 |
| | | return ResultUtil.error("订单取消失败(退款不成功)"); |
| | | if(!"139".equals(statusCode)){ |
| | | return ResultUtil.error(results.getStatusDescription()); |
| | | } |
| | | if (Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 2) {//未知 |
| | | |
| | | |
| | | }*/ |
| | | } |
| | | if(null != orderLogistics.getPayType() && orderLogistics.getPayType() == 2){//支付宝 |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | |
| | | this.updateById(orderLogistics); |
| | | integer = orderCancel.getId(); |
| | | //调用回退接口 |
| | | PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 2, 2); |
| | | /*Map<String, Object> merrefund = icbcPayUtil.merrefund(query.getCode(), "", query.getAmount(), orderLogistics.getId() + "_" + orderLogistics.getType(), orderLogistics.getOrderNum()); |
| | | if (Integer.valueOf(merrefund.get("code").toString()) == 0) { |
| | | Map<String, Object> refundqry = icbcPayUtil.refundqry("", query.getCode(), orderLogistics.getOrderNum()); |
| | | if (Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 0) {//成功 |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "小件物流取消退款", query.getAmount(), 1, 1, 1, 4, orderLogistics.getId()); |
| | | PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 1, 2); |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String payerTransactionID = sdf.format(new Date()) + orderCancel.getId(); |
| | | PayoutResponse payoutResponse = tinggPayoutUtil.sendPayout(userInfo.getPhoneOperator(), "+" + userInfo.getPhone(), payerTransactionID, query.getAmount().doubleValue(), callbackPath + "/base/orderCancelRefundCallback", "取消订单退款"); |
| | | AuthStatus authStatus = payoutResponse.getAuthStatus(); |
| | | Results results = payoutResponse.getResults().get(0); |
| | | String statusCode = results.getStatusCode(); |
| | | if(!"131".equals(authStatus.getAuthStatusCode())){ |
| | | return ResultUtil.error(authStatus.getAuthStatusDescription()); |
| | | } |
| | | if (Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 1) {//失败 |
| | | return ResultUtil.error("订单取消失败(退款不成功)"); |
| | | } |
| | | if (Integer.valueOf(refundqry.get("code").toString()) == 0 && Integer.valueOf(refundqry.get("pay_status").toString()) == 2) {//未知 |
| | | return ResultUtil.error("退款返回未知异常"); |
| | | |
| | | } |
| | | }*/ |
| | | Map<String, String> merrefund = payMoneyUtil.aliRefund(query.getCode(),query.getAmount()+""); |
| | | //Map<String, Object> merrefund = icbcPayUtil.merrefund(query.getCode(), "", query.getAmount(), orderLogistics.getId() + "_" + orderLogistics.getType(), orderLogistics.getOrderNum()); |
| | | if ("SUCCESS".equals(merrefund.get("return_code"))) {//成功 |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "小件物流取消退款", query.getAmount(), 1, 1, 1, 4, orderLogistics.getId()); |
| | | }else{ |
| | | return ResultUtil.error("退款返回未知异常"); |
| | | if(!"139".equals(statusCode)){ |
| | | return ResultUtil.error(results.getStatusDescription()); |
| | | } |
| | | } |
| | | if(null != orderLogistics.getPayType() && orderLogistics.getPayType() == 3){//余额 |
| | |
| | | ResultUtil resultUtil = ResultUtil.success(""); |
| | | |
| | | if(null == orderPrivateCar){ |
| | | return ResultUtil.error("取消订单失败,订单信息有误", ""); |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,订单信息有误" : language == 2 ? "Order cancellation failed because the order information is incorrect" : "Annulation échouée, informations de commande incorrectes", ""); |
| | | } |
| | | if(orderPrivateCar.getState() != 12){ |
| | | return ResultUtil.error("取消订单失败,不合法的操作", ""); |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Order cancellation failed, illegal operation" : "Annulation de la commande échouée, opération illégale", ""); |
| | | } |
| | | OrderCancel orderCancel = null; |
| | | if(null == cancleId || cancleId==0){ |
| | |
| | | id as id, |
| | | registIp as registIp, |
| | | registAreaCode as registAreaCode, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | nickName as nickName, |
| | | avatar as avatar, |
| | |
| | | id as id, |
| | | registIp as registIp, |
| | | registAreaCode as registAreaCode, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | nickName as nickName, |
| | | avatar as avatar, |
| | |
| | | id as id, |
| | | registIp as registIp, |
| | | registAreaCode as registAreaCode, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | nickName as nickName, |
| | | avatar as avatar, |
| | |
| | | id as id, |
| | | registIp as registIp, |
| | | registAreaCode as registAreaCode, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | nickName as nickName, |
| | | avatar as avatar, |
| | |
| | | <select id="queryUserInfo" resultType="map"> |
| | | select |
| | | a.id as id, |
| | | a.phoneOperator as phoneOperator, |
| | | a.phone as phone, |
| | | a.email as email, |
| | | a.lastName as lastName, |
| | |
| | | <select id="queryMyInviteUserList" resultType="map"> |
| | | select |
| | | id as id, |
| | | phoneOperator as phoneOperator, |
| | | phone as phone, |
| | | IFNULL(lastName,nickName) as name, |
| | | avatar as avatar, |
| | |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 提现类型(1=活动收入体现,2=业务收入体现) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 申请时间 |
| | | */ |
| | | @TableField("insertTime") |
| | |
| | | */ |
| | | @TableField("serialNo") |
| | | private String serialNo; |
| | | /** |
| | | * 开户行名称 |
| | | */ |
| | | @TableField("bankName") |
| | | private String bankName; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | this.serialNo = serialNo; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Withdrawal{" + |
| | | "id=" + id + |
| | | ", userId=" + userId + |
| | | ", handleTime=" + handleTime + |
| | | ", balance=" + balance + |
| | | ", money=" + money + |
| | | ", state=" + state + |
| | | ", remark='" + remark + '\'' + |
| | | ", code='" + code + '\'' + |
| | | ", name='" + name + '\'' + |
| | | ", userType=" + userType + |
| | | ", insertTime=" + insertTime + |
| | | ", flag=" + flag + |
| | | ", withdrawalType=" + withdrawalType + |
| | | ", serialNo='" + serialNo + '\'' + |
| | | '}'; |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getBankName() { |
| | | return bankName; |
| | | } |
| | | |
| | | public void setBankName(String bankName) { |
| | | this.bankName = bankName; |
| | | } |
| | | } |
| | |
| | | Withdrawal withdrawal = new Withdrawal(); |
| | | withdrawal.setBalance(userInfo.getBalance()); |
| | | withdrawal.setCode(userInfo.getPhone());// TODO: 2023/7/5 第三方支支持手机号提现 |
| | | withdrawal.setBankName(userInfo.getPhoneOperator()); |
| | | withdrawal.setFlag(1); |
| | | withdrawal.setInsertTime(new Date()); |
| | | withdrawal.setMoney(money); |
| | | withdrawal.setName(userInfo.getPhoneOperator()); |
| | | withdrawal.setName(userInfo.getFirstName() + " " + userInfo.getLastName()); |
| | | withdrawal.setState(1); |
| | | withdrawal.setUserId(uid); |
| | | withdrawal.setUserType(1); |
| | |
| | | private String name; |
| | | @ApiModelProperty("昵称") |
| | | private String nickName; |
| | | @ApiModelProperty("手机号码运营商") |
| | | private String phoneOperator; |
| | | @ApiModelProperty("电话") |
| | | private String phone; |
| | | @ApiModelProperty("邮箱地址") |
| | |
| | | |
| | | public void setNickName(String nickName) { |
| | | this.nickName = nickName; |
| | | } |
| | | |
| | | public String getPhoneOperator() { |
| | | return phoneOperator; |
| | | } |
| | | |
| | | public void setPhoneOperator(String phoneOperator) { |
| | | this.phoneOperator = phoneOperator; |
| | | } |
| | | |
| | | public String getPhone() { |
| | |
| | | userInfoWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : null); |
| | | userInfoWarpper.setName(null != map.get("name") ? String.valueOf(map.get("name")) : ""); |
| | | userInfoWarpper.setNickName(null != map.get("nickName") ? String.valueOf(map.get("nickName")) : ""); |
| | | userInfoWarpper.setPhoneOperator(null != map.get("phoneOperator") ? String.valueOf(map.get("phoneOperator")) : ""); |
| | | userInfoWarpper.setPhone(null != map.get("phone") ? String.valueOf(map.get("phone")) : ""); |
| | | userInfoWarpper.setIsAuth(null != map.get("isAuth") ? Integer.valueOf(String.valueOf(map.get("isAuth"))) : null); |
| | | userInfoWarpper.setAvatar(null != map.get("avatar") ? String.valueOf(map.get("avatar")) : ""); |