| | |
| | | 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.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; |
| | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | | |
| | | @Autowired |
| | | private DouGongRefundBiz douGongRefundBiz; |
| | | private static List<Integer> orderIds = new ArrayList<>(); |
| | | |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | | |