| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.RequestSeqUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.account.controller.AppOrderController; |
| | | import com.stylefeng.guns.modular.crossCity.dao.OrderCrossCityMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.huifu.biz.DouGongPayUtil; |
| | | import com.stylefeng.guns.modular.huifu.biz.DouGongRefundBiz; |
| | | import com.stylefeng.guns.modular.smallLogistics.dao.OrderLogisticsMapper; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogisticsSpread; |
| | |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsSpreadService; |
| | | import com.stylefeng.guns.modular.specialTrain.dao.OrderPrivateCarMapper; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | |
| | | import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | 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 com.unionpay.upyzt.exception.UpyztException; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | | |
| | | @Autowired |
| | | private DouGongRefundBiz douGongRefundBiz; |
| | | private static List<Integer> orderIds = new ArrayList<>(); |
| | | |
| | | |
| | |
| | | if(payType == 1){//微信支付 |
| | | String app = type == 1 ? "APP" : "JSAPI"; |
| | | // resultUtil = payMoneyUtil.weixinpay("小件物流下单支付", "", orderId + "_" + orderLogistics.getType() + "_" + UUIDUtil.getRandomCode(5), orderMoney.toString(), "/base/wxPayOrderTaxi", app, userInfo.getAppletsOpenId()); |
| | | resultUtil = DouGongPayUtil.wxPayOrder(orderMoney.toString(), userInfo.getAppletsOpenId(), "完成订单", orderLogistics.getType(), String.valueOf(orderId), 1); |
| | | resultUtil = douGongPayUtil.wxPayOrder(orderMoney.toString(), userInfo.getAppletsOpenId(), "完成订单", orderLogistics.getType(), String.valueOf(orderId), 1); |
| | | |
| | | paymentRecordService.saveData(1, orderLogistics.getUserId(), 1, orderId, orderLogistics.getType(), 1, orderMoney, "", 1);//添加预支付数据 |
| | | } |
| | |
| | | } |
| | | String app = type == 1 ? "APP" : "JSAPI"; |
| | | // resultUtil = payMoneyUtil.weixinpay("小件物流下单支付", "", orderId + "_" + orderLogistics.getType() + "_" + UUIDUtil.getRandomCode(5), orderMoney.toString(), "/base/wxPayOrderTaxi", app, userInfo.getAppletsOpenId()); |
| | | resultUtil = DouGongPayUtil.wxPayOrder(orderMoney.toString(), userInfo.getAppletsOpenId(), "小件物流下单支付", orderLogistics.getType(), String.valueOf(orderId), 1); |
| | | resultUtil = douGongPayUtil.wxPayOrder(orderMoney.toString(), userInfo.getAppletsOpenId(), "小件物流下单支付", orderLogistics.getType(), String.valueOf(orderId), 1); |
| | | paymentRecordService.saveData(1, orderLogistics.getUserId(), 1, orderId, orderLogistics.getType(), 1, orderMoney, "", 1);//添加预支付数据 |
| | | } |
| | | if(payType == 2){//支付宝支付 |
| | |
| | | if(payType == 1){//微信支付 |
| | | String app = type == 1 ? "APP" : "JSAPI"; |
| | | // resultUtil = payMoneyUtil.weixinpay("小件物流补差价", "", orderId + "_" + orderLogistics.getType() + "_" + UUIDUtil.getRandomCode(5), orderMoney.toString(), "/base/wxPayOrderLogisticsSpread", app, userInfo.getAppletsOpenId()); |
| | | resultUtil = DouGongPayUtil.wxPayOrder(orderMoney.toString(), userInfo.getAppletsOpenId(), "小件物流补差价", orderLogistics.getType(), String.valueOf(orderId), 2); |
| | | resultUtil = douGongPayUtil.wxPayOrder(orderMoney.toString(), userInfo.getAppletsOpenId(), "小件物流补差价", orderLogistics.getType(), String.valueOf(orderId), 2); |
| | | paymentRecordService.saveData(1, orderLogistics.getUserId(), 1, orderId, orderLogistics.getType(), 1, orderMoney, "", 1);//添加预支付数据 |
| | | } |
| | | if(payType == 2){//支付宝支付 |
| | |
| | | boolean b = false; |
| | | System.out.println("支付方式:"+query.getPayType()); |
| | | if(query.getPayType() == 1){//微信 |
| | | Map<String, String> map = payMoneyUtil.wxRefund(query.getCode(), orderLogistics.getId() + "_" + orderLogistics.getType(), query.getAmount().toString(), query.getAmount().toString(), "/base/cancleOrderWXPay"); |
| | | System.out.println("map:"+map); |
| | | if(!"SUCCESS".equals(map.get("return_code"))){ |
| | | return ResultUtil.error(map.get("return_msg")); |
| | | //Map<String, String> map = payMoneyUtil.wxRefund(query.getCode(), orderLogistics.getId() + "_" + orderLogistics.getType(), query.getAmount().toString(), query.getAmount().toString(), "/base/cancleOrderWXPay"); |
| | | //System.out.println("map:"+map); |
| | | //if(!"SUCCESS".equals(map.get("return_code"))){ |
| | | // return ResultUtil.error(map.get("return_msg")); |
| | | //} |
| | | String refundReqSeqId = RequestSeqUtil.generate("TK"); |
| | | Map<String, Object> refund = douGongRefundBiz.refund(refundReqSeqId, BigDecimal.valueOf(query.getAmount()), com.stylefeng.guns.core.util.DateUtil.format(query.getInsertTime(), "yyyyMMdd"), orderLogistics.getOutTradeNo(), 1); |
| | | orderLogistics.setRefundReqSeqId(refundReqSeqId); |
| | | if ("00000000".equals(refund.get("resp_code")) && "S".equals(refund.get("trans_stat"))) { |
| | | orderLogistics.setState(10); |
| | | }else if (!"00000000".equals(refund.get("resp_code"))) { |
| | | return ResultUtil.error("订单取消失败:" + refund.get("resp_desc").toString()); |
| | | } |
| | | orderLogisticsMapper.updateById(orderLogistics); |
| | | } |
| | | if(query.getPayType()==4){ |
| | | /* if(query.getPayType()==4){ |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | userInfo.setBalance(userInfo.getBalance() + orderLogistics.getPayMoney()); |
| | | userInfoService.updateById(userInfo); |
| | |
| | | orderLogistics.setCouponMoney(0.00); |
| | | // TODO 设置优惠券id回滚 |
| | | // orderLogistics.setCouponId(null); |
| | | }else if(query.getPayType()==2){//支付宝 |
| | | Map<String, String> map = payMoneyUtil.aliRefund(query.getCode(), query.getAmount().toString()); |
| | | }else */if(query.getPayType()==2){//支付宝 |
| | | //Map<String, String> map = payMoneyUtil.aliRefund(query.getCode(), query.getAmount().toString()); |
| | | UserCouponRecord userCouponRecord = userCouponRecordService.selectById(couponId); |
| | | userCouponRecord.setState(1); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | orderLogistics.setCouponMoney(0.00); |
| | | if(!"10000".equals(map.get("code"))){ |
| | | return ResultUtil.error(map.get("msg")); |
| | | //if(!"10000".equals(map.get("code"))){ |
| | | // return ResultUtil.error(map.get("msg")); |
| | | //} |
| | | String refundReqSeqId = RequestSeqUtil.generate("TK"); |
| | | Map<String, Object> refund = douGongRefundBiz.refund(refundReqSeqId, BigDecimal.valueOf(query.getAmount()), com.stylefeng.guns.core.util.DateUtil.format(query.getInsertTime(), "yyyyMMdd"), orderLogistics.getOutTradeNo(), 1); |
| | | orderLogistics.setRefundReqSeqId(refundReqSeqId); |
| | | if ("00000000".equals(refund.get("resp_code")) && "S".equals(refund.get("trans_stat"))) { |
| | | orderLogistics.setState(10); |
| | | }else if (!"00000000".equals(refund.get("resp_code"))) { |
| | | return ResultUtil.error("订单取消失败:" + refund.get("resp_desc").toString()); |
| | | } |
| | | orderLogisticsMapper.updateById(orderLogistics); |
| | | } |
| | | |
| | | |
| | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | return "LO" + sdf.format(new Date()) + UUIDUtil.getRandomCode(5); |
| | | } |
| | | @Autowired |
| | | private DouGongPayUtil douGongPayUtil; |
| | | |
| | | @Override |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | |
| | | if(payType == 1){//微信支付 |
| | | String app = type == 1 ? "APP" : "JSAPI"; |
| | | // resultUtil = payMoneyUtil.weixinpay("感谢费", "", orderId + "_" + orderLogistics.getType() + "_" + UUIDUtil.getRandomCode(5), money.toString(), "/base/wxPayThankYouFee", app, userInfo.getAppletsOpenId()); |
| | | resultUtil = DouGongPayUtil.wxPayOrder(money.toString(), userInfo.getAppletsOpenId(), "感谢费", orderLogistics.getType(), String.valueOf(orderId), 4); |
| | | resultUtil = douGongPayUtil.wxPayOrder(money.toString(), userInfo.getAppletsOpenId(), "感谢费", orderLogistics.getType(), String.valueOf(orderId), 4); |
| | | paymentRecordService.saveData(3, uid, 1, orderId, orderLogistics.getType(), 1, money, "", 1);//添加预支付数据 |
| | | } |
| | | if(payType == 2){//支付宝支付 |
| | | // resultUtil = payMoneyUtil.alipay("感谢费", "感谢费", "", orderId + "_" + orderLogistics.getType() + "_" + UUIDUtil.getRandomCode(5), money.toString(), "/base/aliPayThankYouFee"); |
| | | resultUtil = DouGongPayUtil.wxPayOrder(money.toString(), userInfo.getAppletsOpenId(), "感谢费", orderLogistics.getType(), String.valueOf(orderId), 4); |
| | | resultUtil = DouGongPayUtil.aliPayOrder(money.toString(), userInfo.getAppletsOpenId(), "感谢费", orderLogistics.getType(), String.valueOf(orderId), 4); |
| | | paymentRecordService.saveData(1, uid, 1, orderId, orderLogistics.getType(), 2, money, "", 1);//添加预支付数据 |
| | | } |
| | | if(payType == 3){//余额支付 |