| @@ -25,6 +25,7 @@ import com.iformall.domain.vo.WxOrderCouponVo; | |||
| import com.iformall.douyin.pay.TtPayService; | |||
| import com.iformall.douyin.pay.exception.TtPayException; | |||
| import com.iformall.douyin.payv2.result.CreateOrderCallback; | |||
| import com.iformall.douyin.payv2.result.RefundOrderCallback; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.interceptor.BodyReaderHttpServletRequestWrapper; | |||
| @@ -1069,7 +1070,7 @@ public class WxOrderController extends BaseController { | |||
| // return openId; | |||
| // } | |||
| @AuthIgnore | |||
| @ApiOperation(value = "抖音支付2.0退款回调推送订单", notes = "{\"couponChannelId\":\"String\",\"couponId\":\"String\",\"press\":\"String\",\"orderGroupId\":\"String\",\"formId\":\"String\"}") | |||
| @ApiOperation(value = "抖音支付2.0退款回调推送订单", notes = "{}") | |||
| @PostMapping("douyinRefundOrder") | |||
| public Map<String,Object> douyinRefundOrder(HttpServletRequest request) { | |||
| SignatureHeader header = new SignatureHeader(); | |||
| @@ -1081,11 +1082,80 @@ public class WxOrderController extends BaseController { | |||
| String body = ((BodyReaderHttpServletRequestWrapper) request).getBody(); | |||
| logger.info("抖音支付2.0退款回调---body{}"+body); | |||
| Map<String, Object> map = new HashMap(); | |||
| map.put("err_no",1001); | |||
| map.put("err_tips","未找到支付信息"); | |||
| map.put("err_no",ErrorCode.SYS_SERVER_ERROR.getCode()); | |||
| map.put("err_tips","暂不支持"); | |||
| return map; | |||
| // try { | |||
| // JSONObject jsonObject = JSONObject.parseObject(body); | |||
| // String msg = jsonObject.getString("msg"); | |||
| // | |||
| // JSONObject msgObject = JSONObject.parseObject(msg); | |||
| // String app_id = msgObject.getString("app_id"); | |||
| // String open_id = msgObject.getString("open_id"); | |||
| // | |||
| // //验证app | |||
| // WxAppinfo appinfo = wxAppinfoService.getByAppId(app_id); | |||
| // if(appinfo == null || !EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat()) | |||
| // || !EnumAppType.C.getCode().equals(appinfo.getType())){ | |||
| // map.put("err_no",ErrorCode.APP_ID_NOT_FOUND.getCode()); | |||
| // map.put("err_tips",ErrorCode.APP_ID_NOT_FOUND.getMessage()); | |||
| // return map; | |||
| // } | |||
| // WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); | |||
| // if(payAccount == null){ | |||
| // map.put("err_no",ErrorCode.API_KEY_NOT_FOUND.getCode()); | |||
| // map.put("err_tips","未找到支付配置"); | |||
| // return map; | |||
| // } | |||
| // TenantEntity tenantEntity = new TenantEntity(); | |||
| // tenantEntity.updateTenantInfo(appinfo); | |||
| // //验证用户 | |||
| // Long memberId = null; | |||
| // TtCUser cuser = (TtCUser) cuserFactory.getCUserService(EnumAppPlat.TOUTIAO).getByOpenId(open_id, tenantEntity.getTenantId()); | |||
| // if(cuser != null && cuser.getUserId() != null){ | |||
| // memberId = cuser.getUserId(); | |||
| // } | |||
| // if(memberId == null){ | |||
| // map.put("err_no",ErrorCode.USER_NOT_MEMBER.getCode()); | |||
| // map.put("err_tips",ErrorCode.USER_NOT_MEMBER.getMessage()); | |||
| // return map; | |||
| // } | |||
| // | |||
| // TtPayService ttPayService = maUtil.getTtPayService(appinfo, payAccount); | |||
| // RefundOrderCallback refundOrderCallback = ttPayService.refundOrderNotifyV2Result(body, header); | |||
| // | |||
| // ResultData resultData = wxRefundOrderService.ttCallBackCreateRefundOrder(tenantEntity,memberId,refundOrderCallback); | |||
| // | |||
| // if(resultData.code == 200){ | |||
| // WxRefundOrder refundOrder = (WxRefundOrder) resultData.data; | |||
| // Map<String, Object> data = new HashMap<>(); | |||
| // data.put("out_refund_no",refundOrder.getId().toString()); | |||
| // data.put("order_entry_schema",wxOrderService.getOrderEntrySchema(Long.parseLong(refundOrder.getPayOrderNo()))); | |||
| // map.put("data",data); | |||
| // map.put("err_no",0); | |||
| // map.put("err_tips",resultData.message); | |||
| // logger.info("resultData{}"+JSON.toJSONString(map)); | |||
| // return map; | |||
| // }else{ | |||
| // map.put("err_no",resultData.code); | |||
| // map.put("err_tips",resultData.message); | |||
| // return map; | |||
| // } | |||
| // | |||
| // } catch (TtPayException e) { | |||
| // logger.error(e.getMessage()); | |||
| // map.put("err_no",ErrorCode.SYS_BEAN_EMPTY_PROPERTY_ERROR.getCode()); | |||
| // map.put("err_tips",e.getMessage()); | |||
| // return map; | |||
| // } catch (Exception e){ | |||
| // logger.error(e.getMessage()); | |||
| // map.put("err_no",ErrorCode.SYS_SERVER_ERROR.getCode()); | |||
| // map.put("err_tips",e.getMessage()); | |||
| // return map; | |||
| // } | |||
| } | |||
| @@ -160,32 +160,39 @@ public class TtPayController extends BaseController { | |||
| out_order_no = (String) pMap.get("cp_orderno"); | |||
| } | |||
| String way = (String) pMap.get("way");//2-支付宝,1-微信 | |||
| String status = (String) pMap.get("status"); | |||
| if (StringUtils.isNotBlank(out_order_no)) { | |||
| try { | |||
| Long orderId = Long.valueOf(out_order_no); | |||
| WxPayOrder wxpayOrder = wxPayOrderService.getById(orderId, appinfo.getTenantId()); | |||
| if(wxpayOrder == null){ | |||
| TenantEntity tenantEntity = new TenantEntity(); | |||
| tenantEntity.setTenantId(appinfo.getTenantId()); | |||
| tenantEntity.setParentTenantId(appinfo.getParentTenantId()); | |||
| WxBatchOrder batchOrder = wxOrderService.getWxBatchOrder(tenantEntity,orderId); | |||
| if(batchOrder == null){ | |||
| logger.error("未找到订单"+orderId); | |||
| logger.error("未找到订单"+orderId); | |||
| resultMap.put("err_tips","未找到订单"); | |||
| }else{ | |||
| PayQueryAdapterResult queryResult = payServiceFactory.getPayAdapterService(wxpayOrder.getPayVendor()).queryPayStatus(wxpayOrder, appinfo, payAccount); | |||
| if (EnumPayStatus.PAY_STATUS_SUCCESS.getCode() == queryResult.getCode()) { | |||
| WxComposeOrder composeOrder = orderFactory.getOrderAdapterService(wxpayOrder.getComposeOrder()).getComposeOrder(wxpayOrder.getOrderId(), wxpayOrder.getTenantId()); | |||
| wxPayOrderService.handleSuccessOrder(wxpayOrder, composeOrder, queryResult, true,false); | |||
| }else { | |||
| if("CANCEL".equals(status)){ | |||
| //取消订单 | |||
| WxBatchOrder batchOrder = new WxBatchOrder(); | |||
| batchOrder.updateTenantInfo(wxpayOrder); | |||
| batchOrder.setId(orderId); | |||
| wxOrderService.cancelOrderBatchOrder(batchOrder,wxpayOrder); | |||
| } | |||
| } | |||
| } | |||
| PayQueryAdapterResult queryResult = payServiceFactory.getPayAdapterService(wxpayOrder.getPayVendor()).queryPayStatus(wxpayOrder, appinfo, payAccount); | |||
| if (EnumPayStatus.PAY_STATUS_SUCCESS.getCode() == queryResult.getCode()) { | |||
| WxComposeOrder composeOrder = orderFactory.getOrderAdapterService(wxpayOrder.getComposeOrder()).getComposeOrder(wxpayOrder.getOrderId(), wxpayOrder.getTenantId()); | |||
| wxPayOrderService.handleSuccessOrder(wxpayOrder, composeOrder, queryResult, true,false); | |||
| resultMap.put("err_no",0); | |||
| resultMap.put("err_tips","success"); | |||
| } | |||
| } catch (NumberFormatException e) { | |||
| logger.error("payOrderId参数不正确: " + toString() + ", e:" + e.getMessage()); | |||
| logger.error("支付回调失败 payOrderId参数不正确: " + toString() + ", e:" + e.getMessage()); | |||
| resultMap.put("err_tips","payOrderId参数异常"); | |||
| } catch (Exception e) { | |||
| logger.error("支付回调失败: " + e.getMessage()); | |||
| resultMap.put("err_tips",e.getMessage()); | |||
| } | |||
| } | |||
| resultMap.put("err_no",0); | |||
| resultMap.put("err_tips","success"); | |||
| }else if("refund".equals(type)){//退款回调 | |||
| String cp_refundno,status; | |||
| Integer refund_amount; | |||
| @@ -40,11 +40,11 @@ public class WxTemplateMsg extends TenantEntity { | |||
| private boolean isc; | |||
| // public String getTypeName(){ | |||
| // if(this.getType() != null) { | |||
| // this.typeName = EnumTemplateType.getEnum(this.getType()).getMessage(); | |||
| // } | |||
| // return typeName; | |||
| // } | |||
| public String getTypeName(){ | |||
| if(this.getType() != null) { | |||
| this.typeName = EnumTemplateType.getEnum(this.getType()).getMessage(); | |||
| } | |||
| return typeName; | |||
| } | |||
| } | |||
| @@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.douyin.payv2.result.RefundOrderCallback; | |||
| import com.iformall.enums.EnumPayType; | |||
| import com.iformall.enums.EnumPayWay; | |||
| @@ -102,4 +103,13 @@ public interface WxRefundOrderService { | |||
| void actionAfterCouponOrder(WxOrder wxOrder, WxCUserBasicInfo basicInfo); | |||
| WxRefundOrder findRefundOrder(TenantEntity tenantInfo, Long orderId); | |||
| /** | |||
| * 抖音2.0 退款回调创建退款订单 | |||
| * @param tenantEntity | |||
| * @param memberId | |||
| * @param refundOrderCallback | |||
| * @return | |||
| */ | |||
| ResultData ttCallBackCreateRefundOrder(TenantEntity tenantEntity, Long memberId, RefundOrderCallback refundOrderCallback); | |||
| } | |||
| @@ -3655,12 +3655,12 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| updOrder.setExtParam(JSON.toJSONString(good.getItemOrderInfoList().get(i))); | |||
| wxOrderMapper.updateById(updOrder); | |||
| } | |||
| }else if(wxOrders.size() == 1){ | |||
| WxOrder updOrder = new WxOrder(); | |||
| updOrder.updateTenantInfo(tenantEntity); | |||
| updOrder.setId(wxOrders.get(0).getId()); | |||
| updOrder.setExtParam(JSON.toJSONString(good.getItemOrderInfoList())); | |||
| wxOrderMapper.updateById(updOrder); | |||
| // }else if(wxOrders.size() == 1){ | |||
| // WxOrder updOrder = new WxOrder(); | |||
| // updOrder.updateTenantInfo(tenantEntity); | |||
| // updOrder.setId(wxOrders.get(0).getId()); | |||
| // updOrder.setExtParam(JSON.toJSONString(good.getItemOrderInfoList())); | |||
| // wxOrderMapper.updateById(updOrder); | |||
| }else{ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(),"数据异常"); | |||
| } | |||
| @@ -12,6 +12,7 @@ import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.msg.FmInsideOrderRefundMsg; | |||
| import com.iformall.domain.po.msg.WxMsgRecord; | |||
| import com.iformall.douyin.payv2.result.RefundOrderCallback; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| @@ -823,5 +824,191 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| return wxRefundOrderMapper.selectOne(new QueryWrapper<>(refundOrderQ)); | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public ResultData ttCallBackCreateRefundOrder(TenantEntity tenantEntity, Long memberId, RefundOrderCallback refundOrderCallback) { | |||
| String outOrderNo = refundOrderCallback.getOutOrderNo(); | |||
| Long compseOrderId = Long.parseLong(outOrderNo); | |||
| WxOrder wxOrderQ = new WxOrder(); | |||
| wxOrderQ.updateTenantInfo(tenantEntity); | |||
| wxOrderQ.setComposeOrderId(compseOrderId); | |||
| List<WxOrder> wxOrderList = wxOrderMapper.findList(wxOrderQ); | |||
| if(wxOrderList.size() == 1){ | |||
| WxOrder wxOrder = wxOrderList.get(0); | |||
| if (wxOrder == null) { | |||
| logger.error("交易订单不存在:compseOrderId=" + compseOrderId); | |||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | |||
| } | |||
| if (wxOrder.getPayment() <= 0) { | |||
| logger.error("订单支付金额小于等于0: " + wxOrder.toString()); | |||
| throw new MallinkException(ErrorCode.REFUND_PAY_ORDER_IS_ZERO); | |||
| } | |||
| if(!EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode().equals(wxOrder.getOrderStatus()) | |||
| && !EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode().equals(wxOrder.getOrderStatus())){ | |||
| logger.error("交易订单状态不支持退款:" + EnumOrderStatus.getEnum(wxOrder.getOrderStatus()).getMessage()); | |||
| throw new MallinkException(ErrorCode.ORDER_PAY_REFUND_FAIL); | |||
| } | |||
| WxCouponOrder couponOrderQ = new WxCouponOrder(); | |||
| couponOrderQ.updateTenantInfo(tenantEntity); | |||
| couponOrderQ.setOrderId(wxOrder.getId()); | |||
| List<WxCouponOrder> couponOrderList = wxCouponOrderMapper.findList(couponOrderQ); | |||
| if(couponOrderList == null || couponOrderList.isEmpty()){ | |||
| logger.error("数据异常,券未找到:" + wxOrder.getId()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||
| } | |||
| for (WxCouponOrder wxCouponOrder:couponOrderList) { | |||
| if (wxCouponOrder.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_INVALID.getCode())) { | |||
| logger.error("已退款: couponOrder-" + wxCouponOrder.getCouponId()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_OVER_TIME); | |||
| } | |||
| if (wxCouponOrder.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode())) { | |||
| logger.error("已经核销过的券: couponOrder-" + wxCouponOrder.getCouponId()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_USED); | |||
| } | |||
| } | |||
| Date currentDate = new Date(); | |||
| //这里wx_order不创建退款订单了, 直接修改原订单 | |||
| WxOrder updWxOrder = new WxOrder(); | |||
| updWxOrder.setId(wxOrder.getId()); | |||
| updWxOrder.updateTenantInfo(wxOrder); | |||
| if(refundOrderCallback.getRefundSource().intValue() == 1){ | |||
| updWxOrder.setPaymentType(EnumPayType.PAY_C_REFUND.getCode()); | |||
| updWxOrder.setRefDetail("用户发起退款"); | |||
| }else if(refundOrderCallback.getRefundSource().intValue() == 3){ | |||
| updWxOrder.setPaymentType(EnumPayType.PAY_AUTO_REFUND.getCode()); | |||
| updWxOrder.setRefDetail("过期退款"); | |||
| }else{ | |||
| logger.error("未知退款类型"); | |||
| throw new MallinkException(ErrorCode.REFUND_NOT_ALLOW.getCode(),"未知退款类型"); | |||
| } | |||
| updWxOrder.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_REFUND.getCode()); | |||
| updWxOrder.setUpdateDate(currentDate); | |||
| try { | |||
| wxOrderMapper.updateById(updWxOrder); | |||
| } catch (Exception e) { | |||
| logger.error("db failed: wxOrder-" + wxOrder.getId() + ", e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| for (WxCouponOrder wxCouponOrder:couponOrderList) { | |||
| // 更改 couponOrder 状态 | |||
| if (wxCouponOrder.getCouponType().equals(EnumCouponType.CARD_MULTIMCH.getCode())) { | |||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.CARD_RETURNED.getCode()); // 卡线下退款 | |||
| } else { | |||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_INVALID.getCode()); //3退款,券作废 | |||
| } | |||
| if(refundOrderCallback.getRefundSource().intValue() == 1){ | |||
| wxCouponOrder.setBUserId(EnumPayType.PAY_C_REFUND.getCode().longValue()); | |||
| wxCouponOrder.setAUserId(EnumPayType.PAY_C_REFUND.getCode().longValue()); | |||
| }else if(refundOrderCallback.getRefundSource().intValue() == 3){ | |||
| wxCouponOrder.setBUserId(EnumPayType.PAY_AUTO_REFUND.getCode().longValue()); | |||
| wxCouponOrder.setAUserId(EnumPayType.PAY_AUTO_REFUND.getCode().longValue()); | |||
| } | |||
| wxCouponOrder.setBMerchantId(0L); | |||
| wxCouponOrder.setUpdateDate(new Date()); | |||
| try { | |||
| wxCouponOrderMapper.updateById(wxCouponOrder); | |||
| } catch (Exception e) { | |||
| logger.error("db failed: couponOrder-" + wxCouponOrder.getId() + ", e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| // 卡退款,把卡余额设为0 | |||
| if (wxCouponOrder.getCouponType().equals(EnumCouponType.CARD_MULTIMCH.getCode())) { | |||
| WxCardInfo updateCardInfo = new WxCardInfo(); | |||
| updateCardInfo.setId(wxCouponOrder.getId()); | |||
| updateCardInfo.setRemainingAmount(0); | |||
| try { | |||
| cardInfoMapper.updateById(updateCardInfo); | |||
| } catch (Exception e) { | |||
| logger.error("db failed: wxCardInfo-" + wxCouponOrder.getId() + ", e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| // WxPayOrder payOrderQ = new WxPayOrder(); | |||
| // payOrderQ.updateTenantInfo(tenantEntity); | |||
| // payOrderQ.setCUserId(wxOrder.getCUserId()); | |||
| // payOrderQ.setOrderId(wxOrder.getComposeOrderId()); | |||
| // payOrderQ.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| // | |||
| // WxPayOrder payOrder = null; | |||
| // List<WxPayOrder> list = wxPayOrderMapper.findList(payOrderQ); | |||
| // if (list.size() > 0) { | |||
| // if (list.size() > 1) { | |||
| // return new ResultData(ErrorCode.PAY_ORDER_ERROR.getCode(),"异常:该订单找到多条支付信息wxpayorder!"); | |||
| // } | |||
| // payOrder = list.get(0); | |||
| // } | |||
| // if (payOrder == null) { | |||
| // logger.error("支付订单不存在(payOrder不存在)"); | |||
| // return new ResultData(ErrorCode.PAY_ORDER_NOT_FOUND); | |||
| // } | |||
| WxRefundOrder record = new WxRefundOrder(); | |||
| record.updateTenantInfo(tenantEntity); | |||
| record.setPayOrderNo(wxOrder.getComposeOrderId().toString()); | |||
| record.setOrderId(wxOrder.getId()); | |||
| // check 是否有退款订单 | |||
| List<WxRefundOrder> refundList = wxRefundOrderMapper.findList(record); | |||
| if (refundList.size() > 0) { | |||
| logger.error("退款订单已存在, 无法再提交退款申请"); | |||
| throw new MallinkException(ErrorCode.REFUND_ORDER_EXIST.getCode(), "退款订单已存在, 无法再提交退款申请"); | |||
| } | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| // 创建退款订单 | |||
| Long refundId = idWorker.nextId(); | |||
| //String out_refund_id = String.valueOf(refundId); | |||
| record.setId(refundId); | |||
| record.setCreateTime(currentDate); | |||
| record.setUpdateTime(currentDate); | |||
| // 微信内部订单号 | |||
| record.setTransactionId(refundOrderCallback.getOrderId()); | |||
| record.setCUserId(memberId); | |||
| record.setTotalFee(wxOrder.getPayment()); | |||
| record.setRefundFee(refundOrderCallback.getRefundTotalAmount()); | |||
| record.setRefundTimeStart(currentDate); | |||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode()); | |||
| record.setRefundVendor(wxOrder.getPayVendor()); | |||
| record.setRefundId(refundOrderCallback.getRefundId()); | |||
| // 退款订单 | |||
| try { | |||
| int sqlRow = wxRefundOrderMapper.insert(record); | |||
| if (sqlRow != 1) { | |||
| logger.error("退款订单数据库插入出错: " + record.toString()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error("退款订单数据库插入出错: " + record.toString()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||
| } | |||
| try { | |||
| sendInsideOrderRefundMsg(wxOrder); | |||
| } catch (Exception e) { | |||
| logger.error("订单成功通知用户error:" + e.getMessage(),e); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "退款订单申请成功", record); | |||
| }else{ | |||
| logger.error("订单数据异常:compseOrderId " + compseOrderId); | |||
| throw new MallinkException(ErrorCode.ORDER_PAY_REFUND_FAIL); | |||
| } | |||
| } | |||
| } | |||
| @@ -150,12 +150,12 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen | |||
| updOrder.setExtParam(JSON.toJSONString(itemOrderInfo.getItemOrderDetail().get(i))); | |||
| wxOrderMapper.updateById(updOrder); | |||
| } | |||
| }else if(wxOrders.size() == 1){ | |||
| WxOrder updOrder = new WxOrder(); | |||
| updOrder.updateTenantInfo(appInfo); | |||
| updOrder.setId(wxOrders.get(0).getId()); | |||
| updOrder.setExtParam(JSON.toJSONString(itemOrderInfo.getItemOrderDetail())); | |||
| wxOrderMapper.updateById(updOrder); | |||
| // }else if(wxOrders.size() == 1){ | |||
| // WxOrder updOrder = new WxOrder(); | |||
| // updOrder.updateTenantInfo(appInfo); | |||
| // updOrder.setId(wxOrders.get(0).getId()); | |||
| // updOrder.setExtParam(JSON.toJSONString(itemOrderInfo.getItemOrderDetail())); | |||
| // wxOrderMapper.updateById(updOrder); | |||
| }else{ | |||
| throw new Exception("下单数据异常"); | |||
| } | |||
| @@ -99,7 +99,7 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||
| if(EnumProfitSharingOrderStatus.PROFIT_SHARING_UNKNOWN.getCode().equals(record.getSharingStatus())){ | |||
| return new PayShareResult(false, EnumProfitSharingOrderStatus.PROFIT_SHARING_UNKNOWN.getCode(),"分账准备中", null,null); | |||
| } | |||
| String before3dayStr = DateUtils.getTimeBefore(3, new Date()); | |||
| String before3dayStr = DateUtils.getTimeBefore(2, new Date()); | |||
| Date before3day = DateUtils.stringToDate(before3dayStr); | |||
| if(before3day.before(record.getCreateTime())){ | |||
| return new PayShareResult(false, EnumProfitSharingOrderStatus.PROFIT_SHARING_READY.getCode(),"未满足D+3", null,null); | |||
| @@ -194,34 +194,36 @@ | |||
| <select id="getExpiriedCouponIdsByEndTime" resultType="Long"> | |||
| select distinct coupon_id from wx_coupon_channel | |||
| where status = 0 and tenant_id = #{tenantId} and end_time < now() | |||
| where status in (0,-1) and tenant_id = #{tenantId} and end_time < now() | |||
| </select> | |||
| <update id="offExpiriedCouponChannelByEndTime"> | |||
| update wx_coupon_channel SET status = 1, update_date = now() | |||
| where status = 0 and tenant_id = #{tenantId} and end_time < now() | |||
| where status in (0,-1) and tenant_id = #{tenantId} and end_time < now() | |||
| </update> | |||
| <select id="getExpiriedCouponIdsByValidDate" resultType="Long"> | |||
| select distinct cc.coupon_id from wx_coupon_channel cc, wx_coupon c | |||
| where cc.coupon_id = c.id and c.valid_type = 1 and c.valid_end_date < now() | |||
| and cc.status = 0 and cc.tenant_id = #{tenantId} | |||
| and cc.status in (0,-1) and cc.tenant_id = #{tenantId} | |||
| </select> | |||
| <update id="offExpiriedCouponChannelByValidDate"> | |||
| update wx_coupon_channel cc, wx_coupon c SET cc.status = 1, cc.update_date = now() | |||
| where cc.status = 0 and cc.tenant_id = #{tenantId} and cc.coupon_id = c.id and c.valid_type = 1 and c.valid_end_date < now() | |||
| where cc.coupon_id = c.id and c.valid_type = 1 and c.valid_end_date < now() | |||
| and cc.status in (0,-1) and cc.tenant_id = #{tenantId} | |||
| </update> | |||
| <select id="getExpiriedCouponIdsByCouponStatus" resultType="Long"> | |||
| select distinct cc.coupon_id from wx_coupon_channel cc, wx_coupon c | |||
| where cc.coupon_id = c.id and c.status = 1 | |||
| and cc.status = 0 and cc.tenant_id = #{tenantId} | |||
| and cc.status in (0,-1) and cc.tenant_id = #{tenantId} | |||
| </select> | |||
| <update id="offExpiriedCouponChannelByCouponStatus"> | |||
| update wx_coupon_channel cc, wx_coupon c SET cc.status = 1, cc.update_date = now() | |||
| where cc.status = 0 and cc.tenant_id = #{tenantId} and cc.coupon_id = c.id and c.status = 1 | |||
| where cc.coupon_id = c.id and c.status = 1 | |||
| and cc.status in (0,-1) and cc.tenant_id = #{tenantId} | |||
| </update> | |||
| <update id="offExpiriedCouponChannel2ByEndTime"> | |||