| @@ -8,7 +8,7 @@ import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.domain.vo.WxCouponOrderBVo; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.enums.EnumRefundWay; | |||
| import com.iformall.enums.EnumPayType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxAppinfoService; | |||
| import com.iformall.service.WxCouponOrderService; | |||
| @@ -128,7 +128,7 @@ public class WxCouponOrderController extends BaseController { | |||
| WxAppinfo appinfo = appinfoPageInfo.getList().get(0); | |||
| if (appinfo != null) { | |||
| try { | |||
| wxRefundOrderService.createRefundOrder(payProperty.isReal(), appinfo, couponOrderId, EnumRefundWay.ADMIN, null); | |||
| wxRefundOrderService.createRefundOrder(payProperty.isReal(), appinfo, couponOrderId, EnumPayType.PAY_ADMIN_REFUND, null); | |||
| return new ResultData(); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| @@ -131,7 +131,7 @@ public class WxCouponOrderController extends BaseController { | |||
| // 核销分账 | |||
| if (couponOrder != null) { | |||
| try { | |||
| wxCouponOrderService.shareAfterVerify(couponOrder); | |||
| wxCouponOrderService.shareAfterVerify(couponOrder, getUser().getMerchantId()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| @@ -5,10 +5,9 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.config.PayProperty; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.enums.EnumOrderType; | |||
| import com.iformall.enums.EnumPayType; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.enums.EnumRefundWay; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.IPUtil; | |||
| @@ -82,7 +81,7 @@ public class WxMicroPayController extends BaseController { | |||
| WxOrder order = null; | |||
| try { | |||
| order = wxOrderService.saveMicroOrder(user, totalFeeStr); | |||
| order = wxOrderService.saveMicroPayOrder(user, totalFeeStr); | |||
| } catch (MallinkException e) { | |||
| logger.error("saveMicopayOrder 1" + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| @@ -254,7 +253,7 @@ public class WxMicroPayController extends BaseController { | |||
| WxMerchantBUser bUser = getUser(); | |||
| WxAppinfo appinfo = getAppInfo(bUser.getAppId()); | |||
| try { | |||
| ResultData rd = wxRefundOrderService.createRefundOrderFromMicroPay(payProperty.isReal(), appinfo, orderId, EnumRefundWay.B, bUser.getId()); | |||
| ResultData rd = wxRefundOrderService.createRefundOrderFromMicroPay(payProperty.isReal(), appinfo, orderId, EnumPayType.PAY_B_REFUND, bUser.getId()); | |||
| return rd; | |||
| } catch (MallinkException e) { | |||
| logger.error("退款 1:" + e.getMessage()); | |||
| @@ -8,7 +8,7 @@ import com.iformall.config.PayProperty; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.po.WxRefundOrder; | |||
| import com.iformall.enums.EnumRefundWay; | |||
| import com.iformall.enums.EnumPayType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxRefundOrderService; | |||
| import io.swagger.annotations.Api; | |||
| @@ -57,7 +57,7 @@ public class WxRefundOrderController extends BaseController { | |||
| WxMerchantBUser bUser = getUser(); | |||
| WxAppinfo appinfo = getAppInfo(bUser.getAppId()); | |||
| try { | |||
| ResultData rd = wxRefundOrderService.createRefundOrder(payProperty.isReal(), appinfo, couponOrderId, EnumRefundWay.B, bUser.getId()); | |||
| ResultData rd = wxRefundOrderService.createRefundOrder(payProperty.isReal(), appinfo, couponOrderId, EnumPayType.PAY_B_REFUND, bUser.getId()); | |||
| return rd; | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| @@ -7,10 +7,9 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import com.iformall.domain.vo.WxOrderCVo; | |||
| import com.iformall.domain.vo.WxOrderCouponVo; | |||
| import com.iformall.enums.EnumCouponChannelStatus; | |||
| import com.iformall.enums.EnumOrderStatus; | |||
| import com.iformall.enums.EnumOrderType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxCouponChannelService; | |||
| import com.iformall.service.WxOrderService; | |||
| @@ -73,7 +72,7 @@ public class WxOrderController extends BaseController { | |||
| WxOrder order = null; | |||
| try { | |||
| order = wxOrderService.sendUserFreeCoupon(user.getId(), couponId); | |||
| order = wxOrderService.saveFreeCouponOrder(user.getId(), couponId); | |||
| return new ResultData(order); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| @@ -135,7 +134,7 @@ public class WxOrderController extends BaseController { | |||
| WxCUser user = getUser(); | |||
| try { | |||
| WxOrder order = wxOrderService.saveOrder(user, couponChannelId, couponId); | |||
| WxOrder order = wxOrderService.saveCouponOrder(user, couponChannelId, couponId); | |||
| return new ResultData(order); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| @@ -216,7 +215,7 @@ public class WxOrderController extends BaseController { | |||
| if (wxOrder == null) wxOrder = new WxOrder(); | |||
| wxOrder.setCUserId(getUser().getId()); | |||
| wxOrder.setSortColumns(WxOrder.Field.CreateDate_DESC); | |||
| final PageInfo<WxOrderCVo> page = wxOrderService.listCUserVoAsPage(wxOrder, pageNum, pageSize); | |||
| final PageInfo<WxOrderCouponVo> page = wxOrderService.listCUserVoAsPage(wxOrder, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -237,7 +236,7 @@ public class WxOrderController extends BaseController { | |||
| } | |||
| wxOrder.setId(id); | |||
| wxOrder.setCUserId(getUser().getId()); | |||
| WxOrderCVo wxOrderCVo = wxOrderService.detailCUserVo(wxOrder); | |||
| WxOrderCouponVo wxOrderCVo = wxOrderService.detailCUserVo(wxOrder); | |||
| if (wxOrderCVo == null) | |||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | |||
| return new ResultData(wxOrderCVo); | |||
| @@ -3,7 +3,7 @@ package com.iformall.schedule; | |||
| import com.iformall.config.PayProperty; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.enums.EnumRefundWay; | |||
| import com.iformall.enums.EnumPayType; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.WxPayOrderService; | |||
| import com.iformall.service.WxRefundOrderService; | |||
| @@ -59,7 +59,7 @@ public class CouponOrderExpiringSchedule { | |||
| appinfo = wxAppinfoMapper.findList(appinfo).get(0); | |||
| try { | |||
| wxRefundOrderService.createRefundOrder(payProperty.isReal(), appinfo, co.getId(), EnumRefundWay.AUTO, null); | |||
| wxRefundOrderService.createRefundOrder(payProperty.isReal(), appinfo, co.getId(), EnumPayType.PAY_AUTO_REFUND, null); | |||
| } catch (Exception e) { | |||
| logger.error("退款失败:"+e.getMessage()+"couponOrderId="+co.getId()); | |||
| continue; | |||
| @@ -50,16 +50,11 @@ public class WxOrder implements Serializable { | |||
| /*c端用户id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="c端用户id",name="cUserId") | |||
| private Long cUserId; | |||
| /*商户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | |||
| private Long merchantId; | |||
| /*操作券B端小程序用户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="操作券B端小程序用户ID",name="bUserId") | |||
| private Long bUserId; | |||
| /*券ID-产品ID将来的产品都会放在coupon表里**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券ID",name="couponId") | |||
| private Long couponId; | |||
| /*类型0:券,1:刷卡支付金**/ | |||
| /*产品ID,根据order type**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="产品ID",name="productId") | |||
| private Long productId; | |||
| /*类型0:券,1:B刷卡支付,2:C扫码支付,3:储值卡**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="类型",name="type") | |||
| private Integer type; | |||
| /*0: 付款 1: 退款**/ | |||
| @@ -101,30 +96,17 @@ public class WxOrder implements Serializable { | |||
| public void setCUserId(Long _cUserId) { | |||
| cUserId = _cUserId; | |||
| } | |||
| public Long getMerchantId() { | |||
| return merchantId; | |||
| } | |||
| public void setMerchantId(Long _merchantId) { | |||
| merchantId = _merchantId; | |||
| } | |||
| public Long getBUserId() { | |||
| return bUserId; | |||
| } | |||
| public void setBUserId(Long _bUserId) { | |||
| bUserId = _bUserId; | |||
| } | |||
| public Long getCouponId() { | |||
| return couponId; | |||
| } | |||
| public void setCouponId(Long _couponId) { | |||
| this.couponId = _couponId; | |||
| public Long getPorductId() { | |||
| return productId; | |||
| } | |||
| public void setPorductId(Long _productId) { | |||
| this.productId = _productId; | |||
| } | |||
| public Integer getType() { | |||
| return type; | |||
| } | |||
| public void setType(Integer type) { | |||
| this.type = type; | |||
| } | |||
| @@ -182,7 +164,7 @@ public class WxOrder implements Serializable { | |||
| ,CUserId_ASC("`c_user_id` ASC"),CUserId_DESC("`c_user_id` DESC") | |||
| ,MerchantId_ASC("`merchant_id` ASC"),MerchantId_DESC("`merchant_id` DESC") | |||
| ,BUserId_ASC("`b_user_id` ASC"),BUserId_DESC("`b_user_id` DESC") | |||
| ,CouponId_ASC("`coupon_id` ASC"),CouponId_DESC("`coupon_id` DESC") | |||
| ,ProductId_ASC("`product_id` ASC"),ProductId_DESC("`product_id` DESC") | |||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||
| ,PaymentType_ASC("`payment_type` ASC"),PaymentType_DESC("`payment_type` DESC") | |||
| ,Payment_ASC("`payment` ASC"),Payment_DESC("`payment` DESC") | |||
| @@ -0,0 +1,119 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Transient; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| public class WxMerchantVo extends WxCouponOrder{ | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 6687954932922444531L; | |||
| @Id | |||
| protected Long id; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| /*发券商户信息*/ | |||
| /*商户图片**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户图片",name="imgUrl") | |||
| private String merchantImgUrl; | |||
| /*商户名**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") | |||
| private String merchantName; | |||
| /*联系方式**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户联系方式",name="linkPhone") | |||
| private String merchantLinkPhone; | |||
| /*商户状态**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户状态1可用0停用",name="status") | |||
| private Integer merchantStatus; | |||
| /*地址**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="地址",name="addr") | |||
| private String addr; | |||
| /*百度poi(省市区县street等)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="百度poi(省市区县street等)",name="baiduPoi") | |||
| private String baiduPoi; | |||
| /*商铺编号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商铺编号",name="shopNumber") | |||
| private String shopNumber; | |||
| /*楼座号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="楼座",name="buildingName") | |||
| private String buildingName; | |||
| /*楼层号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="楼层",name="floorName") | |||
| private String floorName; | |||
| public String getBuildingName() {return buildingName; } | |||
| public void setBuildingName(String _building) { | |||
| buildingName = _building; | |||
| } | |||
| public String getFloorName() { | |||
| return floorName; | |||
| } | |||
| public void setFloorName(String _floor) { | |||
| floorName = _floor; | |||
| } | |||
| public String getShopNumber() { | |||
| return shopNumber; | |||
| } | |||
| public void setShopNumber(String _shopNumber) { | |||
| shopNumber = _shopNumber; | |||
| } | |||
| public String getBaiduPoi() { | |||
| return baiduPoi; | |||
| } | |||
| public void setBaiduPoi(String _baiduPoi) { | |||
| baiduPoi = _baiduPoi; | |||
| } | |||
| public String getAddr() { | |||
| return addr; | |||
| } | |||
| public void setAddr(String _addr) { | |||
| addr = _addr; | |||
| } | |||
| public String getMerChantImgUrl() { | |||
| return merchantImgUrl; | |||
| } | |||
| public void setMerChantImgUrl(String _imgUrl) { | |||
| merchantImgUrl = _imgUrl; | |||
| } | |||
| public String getMerchantName() { | |||
| return merchantName; | |||
| } | |||
| public void setMerchantName(String _name) { | |||
| merchantName = _name; | |||
| } | |||
| public String getMerchantLinkPhone() { | |||
| return merchantLinkPhone; | |||
| } | |||
| public void setMerchantLinkPhone(String _linkPhone) { | |||
| merchantLinkPhone = _linkPhone; | |||
| } | |||
| public Integer getMerchantStatus() { | |||
| return merchantStatus; | |||
| } | |||
| public void setMerchantStatus(Integer status) { | |||
| this.merchantStatus = status; | |||
| } | |||
| } | |||
| @@ -8,7 +8,7 @@ import javax.persistence.Transient; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| public class WxOrderCVo extends WxCouponOrder{ | |||
| public class WxOrderCouponVo extends WxCouponOrder{ | |||
| /** | |||
| * | |||
| @@ -56,15 +56,11 @@ public class WxOrderCVo extends WxCouponOrder{ | |||
| /*c端用户id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="c端用户id",name="cUserId") | |||
| private Long cUserId; | |||
| /*商户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | |||
| private Long merchantId; | |||
| /*操作券B端小程序用户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="操作券B端小程序用户ID",name="bUserId") | |||
| private Long bUserId; | |||
| /*券ID-产品ID将来的产品都会放在coupon表里**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券ID",name="couponId") | |||
| private Long couponId; | |||
| /*产品ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券ID",name="productId") | |||
| private Long productId; | |||
| /*0: 付款 1: 退款**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="0: 付款 1: 退款",name="paymentType") | |||
| private Integer paymentType; | |||
| @@ -126,104 +122,67 @@ public class WxOrderCVo extends WxCouponOrder{ | |||
| private String remark; | |||
| /*发券商户信息*/ | |||
| /*商户图片**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户图片",name="imgUrl") | |||
| private String merchantImgUrl; | |||
| /*商户名**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") | |||
| private String merchantName; | |||
| /*联系方式**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户联系方式",name="linkPhone") | |||
| private String merchantLinkPhone; | |||
| /*商户状态**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户状态1可用0停用",name="status") | |||
| private Integer merchantStatus; | |||
| /*地址**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="地址",name="addr") | |||
| private String addr; | |||
| /*百度poi(省市区县street等)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="百度poi(省市区县street等)",name="baiduPoi") | |||
| private String baiduPoi; | |||
| /*商铺编号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商铺编号",name="shopNumber") | |||
| private String shopNumber; | |||
| /*楼座号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="楼座",name="buildingName") | |||
| private String buildingName; | |||
| /*楼层号**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="楼层",name="floorName") | |||
| private String floorName; | |||
| public Long getOrderNumber() { | |||
| private List<WxMerchantVo> merchantVoList; | |||
| public Long getOrderNumber() { | |||
| return orderNumber; | |||
| } | |||
| public void setOrderNumber(Long _orderNumber) { | |||
| orderNumber = _orderNumber; | |||
| } | |||
| public String getTenantId() { | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public Long getCUserId() { | |||
| public Long getCUserId() { | |||
| return cUserId; | |||
| } | |||
| public void setCUserId(Long _cUserId) { | |||
| cUserId = _cUserId; | |||
| } | |||
| public Long getMerchantId() { | |||
| return merchantId; | |||
| } | |||
| public void setMerchantId(Long _merchantId) { | |||
| merchantId = _merchantId; | |||
| } | |||
| public Long getBUserId() { | |||
| return bUserId; | |||
| } | |||
| public void setBUserId(Long _bUserId) { | |||
| bUserId = _bUserId; | |||
| } | |||
| public Long getCouponId() { | |||
| return couponId; | |||
| public Long getProductId() { | |||
| return productId; | |||
| } | |||
| public void setCouponId(Long _couponId) { | |||
| this.couponId = _couponId; | |||
| public void setProductId(Long _productId) { | |||
| this.productId = _productId; | |||
| } | |||
| public Integer getPaymentType() { | |||
| public Integer getPaymentType() { | |||
| return paymentType; | |||
| } | |||
| public void setPaymentType(Integer _paymentType) { | |||
| paymentType = _paymentType; | |||
| } | |||
| public Integer getPayment() { | |||
| public Integer getPayment() { | |||
| return payment; | |||
| } | |||
| public void setPayment(Integer _payment) { | |||
| payment = _payment; | |||
| } | |||
| public Date getPaymentTime() { | |||
| public Date getPaymentTime() { | |||
| return paymentTime; | |||
| } | |||
| public void setPaymentTime(Date _paymentTime) { | |||
| paymentTime = _paymentTime; | |||
| } | |||
| public Integer getOrderStatus() { | |||
| public Integer getOrderStatus() { | |||
| return orderStatus; | |||
| } | |||
| public void setOrderStatus(Integer _orderStatus) { | |||
| orderStatus = _orderStatus; | |||
| } | |||
| public Date getCreateDate() { | |||
| public Date getCreateDate() { | |||
| return createDate; | |||
| } | |||
| public void setCreateDate(Date _createDate) { | |||
| createDate = _createDate; | |||
| } | |||
| public Date getUpdateDate() { | |||
| public Date getUpdateDate() { | |||
| return updateDate; | |||
| } | |||
| public void setUpdateDate(Date _updateDate) { | |||
| @@ -236,142 +195,90 @@ public class WxOrderCVo extends WxCouponOrder{ | |||
| public void setCouponOrderId(Long _couponOrderId) { | |||
| this.couponOrderId = _couponOrderId; | |||
| } | |||
| public Integer getCouponOrderStatus() { | |||
| public Integer getCouponOrderStatus() { | |||
| return couponOrderStatus; | |||
| } | |||
| public void setCouponOrderStatus(Integer _couponOrderStatus) { | |||
| couponOrderStatus = _couponOrderStatus; | |||
| } | |||
| public Integer getType() { | |||
| public Integer getType() { | |||
| return type; | |||
| } | |||
| public void setType(Integer _type) { | |||
| type = _type; | |||
| } | |||
| public String getCoverImg() { | |||
| public String getCoverImg() { | |||
| return coverImg; | |||
| } | |||
| public void setCoverImg(String _coverImg) { | |||
| coverImg = _coverImg; | |||
| } | |||
| public String getTitle() { | |||
| public String getTitle() { | |||
| return title; | |||
| } | |||
| public void setTitle(String _title) { | |||
| title = _title; | |||
| } | |||
| public String getSubTitle() { | |||
| public String getSubTitle() { | |||
| return subTitle; | |||
| } | |||
| public void setSubTitle(String _subTitle) { | |||
| subTitle = _subTitle; | |||
| } | |||
| public Integer getSalePrice() { | |||
| public Integer getSalePrice() { | |||
| return salePrice; | |||
| } | |||
| public void setSalePrice(Integer _salePrice) { | |||
| salePrice = _salePrice; | |||
| } | |||
| public Integer getUsePrice() { | |||
| public Integer getUsePrice() { | |||
| return usePrice; | |||
| } | |||
| public void setUsePrice(Integer _usePrice) { | |||
| usePrice = _usePrice; | |||
| } | |||
| public String getDetail() { | |||
| public String getDetail() { | |||
| return detail; | |||
| } | |||
| public void setDetail(String _detail) { | |||
| detail = _detail; | |||
| } | |||
| public Integer getPrice() { | |||
| public Integer getPrice() { | |||
| return price; | |||
| } | |||
| public void setPrice(Integer _price) { | |||
| price = _price; | |||
| } | |||
| public Integer getUnit() { | |||
| return unit; | |||
| } | |||
| public void setUnit(Integer unit) { | |||
| this.unit = unit; | |||
| } | |||
| public String getRemark() { | |||
| return remark; | |||
| } | |||
| public void setRemark(String _remark) { | |||
| remark = _remark; | |||
| public List<WxMerchantVo> getMerchantVoList() { | |||
| return merchantVoList; | |||
| } | |||
| public String getBuildingName() {return buildingName; } | |||
| public void setBuildingName(String _building) { | |||
| buildingName = _building; | |||
| } | |||
| public String getFloorName() { | |||
| return floorName; | |||
| } | |||
| public void setFloorName(String _floor) { | |||
| floorName = _floor; | |||
| public void setMerchantVoList(List<WxMerchantVo> merchantVoList) { | |||
| this.merchantVoList = merchantVoList; | |||
| } | |||
| public String getShopNumber() { | |||
| return shopNumber; | |||
| } | |||
| public void setShopNumber(String _shopNumber) { | |||
| shopNumber = _shopNumber; | |||
| } | |||
| public String getBaiduPoi() { | |||
| return baiduPoi; | |||
| } | |||
| public void setBaiduPoi(String _baiduPoi) { | |||
| baiduPoi = _baiduPoi; | |||
| } | |||
| public String getAddr() { | |||
| return addr; | |||
| } | |||
| public void setAddr(String _addr) { | |||
| addr = _addr; | |||
| } | |||
| public String getMerChantImgUrl() { | |||
| return merchantImgUrl; | |||
| } | |||
| public void setMerChantImgUrl(String _imgUrl) { | |||
| merchantImgUrl = _imgUrl; | |||
| } | |||
| public String getMerchantName() { | |||
| return merchantName; | |||
| } | |||
| public void setMerchantName(String _name) { | |||
| merchantName = _name; | |||
| } | |||
| public String getMerchantLinkPhone() { | |||
| return merchantLinkPhone; | |||
| } | |||
| public void setMerchantLinkPhone(String _linkPhone) { | |||
| merchantLinkPhone = _linkPhone; | |||
| } | |||
| public Integer getMerchantStatus() { | |||
| return merchantStatus; | |||
| public String getRemark() { | |||
| return remark; | |||
| } | |||
| public void setMerchantStatus(Integer status) { | |||
| this.merchantStatus = status; | |||
| public void setRemark(String _remark) { | |||
| remark = _remark; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,OrderNumber_ASC("`order_number` ASC"),OrderNumber_DESC("`order_number` DESC") | |||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||
| ,CUserId_ASC("`c_user_id` ASC"),CUserId_DESC("`c_user_id` DESC") | |||
| ,MerchantId_ASC("`merchant_id` ASC"),MerchantId_DESC("`merchant_id` DESC") | |||
| ,BUserId_ASC("`b_user_id` ASC"),BUserId_DESC("`b_user_id` DESC") | |||
| ,CouponId_ASC("`coupon_id` ASC"),CouponId_DESC("`coupon_id` DESC") | |||
| ,CouponId_ASC("`product_id` ASC"),CouponId_DESC("`product_id` DESC") | |||
| ,PaymentType_ASC("`payment_type` ASC"),PaymentType_DESC("`payment_type` DESC") | |||
| ,Payment_ASC("`payment` ASC"),Payment_DESC("`payment` DESC") | |||
| ,PaymentTime_ASC("`payment_time` ASC"),PaymentTime_DESC("`payment_time` DESC") | |||
| @@ -59,9 +59,7 @@ public class WxOrderPayVo extends WxOrder { | |||
| ,OrderNumber_ASC("`order_number` ASC"),OrderNumber_DESC("`order_number` DESC") | |||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||
| ,CUserId_ASC("`c_user_id` ASC"),CUserId_DESC("`c_user_id` DESC") | |||
| ,MerchantId_ASC("`merchant_id` ASC"),MerchantId_DESC("`merchant_id` DESC") | |||
| ,BUserId_ASC("`b_user_id` ASC"),BUserId_DESC("`b_user_id` DESC") | |||
| ,CouponId_ASC("`coupon_id` ASC"),CouponId_DESC("`coupon_id` DESC") | |||
| ,CouponId_ASC("`product_id` ASC"),CouponId_DESC("`product_id` DESC") | |||
| ,PaymentType_ASC("`payment_type` ASC"),PaymentType_DESC("`payment_type` DESC") | |||
| ,Payment_ASC("`payment` ASC"),Payment_DESC("`payment` DESC") | |||
| ,PaymentTime_ASC("`payment_time` ASC"),PaymentTime_DESC("`payment_time` DESC") | |||
| @@ -8,7 +8,9 @@ package com.iformall.enums; | |||
| public enum EnumOrderType { | |||
| COUPON(0,"券"), | |||
| MICROPAY(1,"刷卡支付金") | |||
| MICROPAY(1,"B收款码支付"), | |||
| NATIVEPAY(2,"C扫码支付"), | |||
| PREPAIDCARD(3, "储值卡") | |||
| ; | |||
| public static EnumOrderType getEnum(Integer code) { | |||
| @@ -6,8 +6,9 @@ package com.iformall.enums; | |||
| public enum EnumPayType { | |||
| PAY_PAYMENT(0, "付款"), | |||
| PAY_REFUND(1, "退款"); | |||
| PAY_B_REFUND(1, "B端退款"), | |||
| PAY_AUTO_REFUND(2, "自动退款"), | |||
| PAY_ADMIN_REFUND(3, "A端退款"); | |||
| public static EnumPayType getEnum(Integer code) { | |||
| for (EnumPayType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| @@ -1,37 +0,0 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumRefundWay { | |||
| B(0, "B端小程序"), | |||
| ADMIN(1, "WEB端小程序"), | |||
| C(2, "C端小程序"), | |||
| AUTO(3, "自动退款"); | |||
| public static EnumRefundWay getEnum(Integer code) { | |||
| for (EnumRefundWay value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumRefundWay(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -3,7 +3,7 @@ package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.vo.MarkingSceneDataVo; | |||
| import com.iformall.domain.vo.WxOrderCVo; | |||
| import com.iformall.domain.vo.WxOrderCouponVo; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import com.iformall.domain.vo.WxOrderPayVo; | |||
| @@ -17,8 +17,8 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||
| List<WxOrder> findListOfUnpaidOrderByDate(Map dateMap); | |||
| List<WxOrderCVo> findListOfCUser(WxOrder wxOrder); | |||
| WxOrderCVo selectDetailOfCUser(WxOrder wxOrder); | |||
| List<WxOrderCouponVo> findListOfCUser(WxOrder wxOrder); | |||
| WxOrderCouponVo selectDetailOfCUser(WxOrder wxOrder); | |||
| Map dayMicroPayAmountList(Map dateMap); | |||
| List<WxOrderPayVo> findListOfMicroPayOrderByDate(Map dateMap); | |||
| @@ -84,7 +84,7 @@ public interface WxCouponOrderService { | |||
| * 核销分账 | |||
| * @param couponOrder | |||
| */ | |||
| void shareAfterVerify(WxCouponOrder couponOrder); | |||
| void shareAfterVerify(WxCouponOrder couponOrder, Long merchantId); | |||
| /** | |||
| * 核销模板消息 | |||
| @@ -8,7 +8,7 @@ import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import com.iformall.domain.vo.WxOrderCVo; | |||
| import com.iformall.domain.vo.WxOrderCouponVo; | |||
| import com.iformall.enums.EnumOrderStatus; | |||
| public interface WxOrderService { | |||
| @@ -39,7 +39,7 @@ public interface WxOrderService { | |||
| * @param couponId | |||
| * @return 订单id | |||
| */ | |||
| WxOrder saveOrder(WxCUser user, Long couponChannelId, Long couponId); | |||
| WxOrder saveCouponOrder(WxCUser user, Long couponChannelId, Long couponId); | |||
| /** | |||
| * 刷卡支付 | |||
| @@ -47,7 +47,7 @@ public interface WxOrderService { | |||
| * @param totalFeeStr | |||
| * @return 订单id | |||
| */ | |||
| WxOrder saveMicroOrder(WxMerchantBUser user, String totalFeeStr); | |||
| WxOrder saveMicroPayOrder(WxMerchantBUser user, String totalFeeStr); | |||
| /** | |||
| * 免费券订单接口 | |||
| @@ -55,7 +55,7 @@ public interface WxOrderService { | |||
| * @param couponId | |||
| * @return WxOrder | |||
| */ | |||
| WxOrder sendUserFreeCoupon(Long userId, Long couponId); | |||
| WxOrder saveFreeCouponOrder(Long userId, Long couponId); | |||
| /** | |||
| * 免费券订单接口 | |||
| @@ -70,7 +70,7 @@ public interface WxOrderService { | |||
| * @param updateOrder | |||
| * @return | |||
| */ | |||
| int orderSuccess(WxOrder updateOrder); | |||
| int couponOrderSuccess(WxOrder updateOrder); | |||
| /** | |||
| * microPayOrderSuccess 刷卡支付成功 | |||
| @@ -121,10 +121,10 @@ public interface WxOrderService { | |||
| PageInfo<WxOrderCVo> listCUserVoAsPage(WxOrder record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxOrderCouponVo> listCUserVoAsPage(WxOrder record, Integer pageIndex, Integer pageSize); | |||
| WxOrderCVo detailCUserVo(WxOrder record); | |||
| WxOrderCouponVo detailCUserVo(WxOrder record); | |||
| void stockBack(WxOrder updateOrder); | |||
| @@ -39,16 +39,10 @@ public interface WxProfitSharingOrderService { | |||
| */ | |||
| void deleteById(Long id); | |||
| /** | |||
| * 临时测试 | |||
| */ | |||
| public void test(); | |||
| /** | |||
| * 创建分账订单 | |||
| */ | |||
| public ResultData createSharingOrder(WxPayOrder wxPayOrder); | |||
| public ResultData createSharingOrder(WxPayOrder wxPayOrder, Long merchantId); | |||
| /** | |||
| * 查询分账订单 | |||
| @@ -5,8 +5,9 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxRefundOrder; | |||
| import com.iformall.enums.EnumPayType; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.enums.EnumRefundWay; | |||
| public interface WxRefundOrderService { | |||
| @@ -15,22 +16,22 @@ public interface WxRefundOrderService { | |||
| * @param isReal | |||
| * @param appInfo | |||
| * @param couponOrderId 券包Id | |||
| * @param refundWay 退款来源 | |||
| * @param payType 退款来源 | |||
| * @param bUserId b端退款Id,auto,admin,self可为null | |||
| * @return | |||
| */ | |||
| ResultData createRefundOrder(boolean isReal, WxAppinfo appInfo, Long couponOrderId, EnumRefundWay refundWay, Long bUserId); | |||
| ResultData createRefundOrder(boolean isReal, WxAppinfo appInfo, Long couponOrderId, EnumPayType payType, Long bUserId); | |||
| /** | |||
| * 创建退款订单 | |||
| * @param isReal | |||
| * @param appInfo | |||
| * @param orderId 订单Id | |||
| * @param refundWay 退款来源 | |||
| * @param payType 退款来源 | |||
| * @param bUserId b端退款Id,auto,admin,self可为null | |||
| * @return | |||
| */ | |||
| ResultData createRefundOrderFromMicroPay(boolean isReal, WxAppinfo appInfo, Long orderId, EnumRefundWay refundWay, Long bUserId); | |||
| ResultData createRefundOrderFromMicroPay(boolean isReal, WxAppinfo appInfo, Long orderId, EnumPayType payType, Long bUserId); | |||
| /** | |||
| * 退款订单查询 | |||
| @@ -52,6 +52,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| @Autowired | |||
| WxMerchantMapper wxMerchantMapper; | |||
| @Autowired | |||
| WxCouponMerchantMapper wxCouponMerchantMapper; | |||
| @Autowired | |||
| WxMerchantBUserMapper wxMerchantBUserMapper; | |||
| @@ -324,12 +327,22 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||
| } | |||
| WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(wxCouponOrder.getOrderId()); | |||
| if (!wxOrder.getMerchantId().equals(wxMerchantBUser.getMerchantId())) { | |||
| logger.error("券: couponMerchantId-" + wxOrder.getMerchantId() + "核销: couponMerchantId-" + wxMerchantBUser.getMerchantId()); | |||
| WxCoupon wxCoupon = wxCouponMapper.selectByPrimaryKey(wxCouponOrder.getCouponId()); | |||
| if (wxCoupon == null) { | |||
| logger.error("券: coupon-" + wxCoupon.getId() + "不存在" + "couponOrder-" + wxCouponOrder.getId()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||
| }else { | |||
| WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); | |||
| wxCouponMerchant.setCouponId(wxCoupon.getId()); | |||
| wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); | |||
| List<WxCouponMerchant> couponMerchantList = wxCouponMerchantMapper.findList(wxCouponMerchant); | |||
| if (!couponMerchantList.stream().anyMatch(cm->cm.getMerchantId().equals(wxMerchantBUser.getMerchantId()))){ | |||
| logger.error("券: coupon-" + wxCoupon.getId() + "核销: couponMerchantId-" + wxMerchantBUser.getMerchantId()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||
| } | |||
| } | |||
| if (wxCouponOrder.getCouponOrderStatus() == EnumCouponOrderStatus.COUPON_ORDER_OVER_TIME.getCode()) { | |||
| logger.error("已过期: couponOrder-" + wxCouponOrder.getId()); | |||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_OVER_TIME); | |||
| @@ -359,7 +372,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void shareAfterVerify(WxCouponOrder couponOrder) { | |||
| public void shareAfterVerify(WxCouponOrder couponOrder, Long merchantId) { | |||
| // 微信分账 | |||
| try { | |||
| WxPayOrder wxPayOrder = new WxPayOrder(); | |||
| @@ -368,7 +381,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| wxPayOrder.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| wxPayOrder = wxPayOrderMapper.selectOne(wxPayOrder); | |||
| if (wxPayOrder != null && wxPayOrder.getShare().equals(EnumPayShare.YES.getCode())) | |||
| wxProfitSharingOrderService.createSharingOrder(wxPayOrder); | |||
| wxProfitSharingOrderService.createSharingOrder(wxPayOrder, merchantId); | |||
| } catch (Exception e) { | |||
| logger.error("微信分账: " + e.getMessage()); | |||
| } | |||
| @@ -6,7 +6,7 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.WxOrderCVo; | |||
| import com.iformall.domain.vo.WxOrderCouponVo; | |||
| import com.iformall.domain.vo.WxOrderPayVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -157,8 +157,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| int countOrder = 0, countCouponOrder = 0; | |||
| WxOrder orderQ = new WxOrder(); | |||
| orderQ.setTenantId(user.getTenantId()); | |||
| orderQ.setCouponId(counpon.getId()); | |||
| orderQ.setType(EnumOrderType.COUPON.getCode()); | |||
| orderQ.setPorductId(counpon.getId()); | |||
| orderQ.setType(EnumOrderType.COUPON.getCode()); | |||
| orderQ.setCUserId(user.getId()); | |||
| orderQ.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | |||
| @@ -249,7 +248,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| public void stockBack(WxOrder updateOrder) { | |||
| // 已取消/已退款,库存加1 | |||
| // 获取订单相关coupon | |||
| Long couponId = updateOrder.getCouponId(); | |||
| Long couponId = updateOrder.getPorductId(); | |||
| String couponIdStr = "" + couponId; | |||
| //加锁 | |||
| long time = System.currentTimeMillis() + RedisLock.TIMEOUT; | |||
| @@ -286,7 +285,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public WxOrder saveOrder(WxCUser user, Long couponChannelId, Long couponId) { | |||
| public WxOrder saveCouponOrder(WxCUser user, Long couponChannelId, Long couponId) { | |||
| // 检查用户 | |||
| if (user == null) { | |||
| logger.error("用户不存在"); | |||
| @@ -340,11 +339,9 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| record.setId(orderNumber); | |||
| record.setTenantId(user.getTenantId()); | |||
| record.setOrderNumber(orderNumber); | |||
| record.setCouponId(couponId); | |||
| record.setType(EnumOrderType.COUPON.getCode()); | |||
| record.setPorductId(couponId); | |||
| record.setType(EnumOrderType.COUPON.getCode()); | |||
| record.setCUserId(user.getId()); | |||
| record.setMerchantId(coupon.getMerchantId()); | |||
| record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | |||
| record.setPayment(payment); | |||
| record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | |||
| @@ -376,7 +373,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public WxOrder saveMicroOrder(WxMerchantBUser user, String totalFeeStr) { | |||
| public WxOrder saveMicroPayOrder(WxMerchantBUser user, String totalFeeStr) { | |||
| // 检查用户 | |||
| if (user == null) { | |||
| logger.error("用户不存在"); | |||
| @@ -413,8 +410,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| record.setTenantId(user.getTenantId()); | |||
| record.setOrderNumber(orderNumber); | |||
| record.setType(EnumOrderType.MICROPAY.getCode()); | |||
| record.setBUserId(user.getId()); | |||
| record.setMerchantId(user.getMerchantId()); | |||
| record.setPorductId(user.getId()); | |||
| record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | |||
| record.setPayment(payment); | |||
| record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | |||
| @@ -470,7 +466,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| WxCouponOrder couponOrder = new WxCouponOrder(); | |||
| couponOrder.setId(idWorker.nextId()); | |||
| couponOrder.setTenantId(user.getTenantId()); | |||
| couponOrder.setCouponId(order.getCouponId()); | |||
| couponOrder.setCouponId(order.getPorductId()); | |||
| couponOrder.setCUserId(user.getId()); | |||
| couponOrder.setOrderId(order.getOrderNumber()); | |||
| couponOrder.setExpiredTime(valid_date); | |||
| @@ -487,7 +483,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public WxOrder sendUserFreeCoupon(Long userId, Long couponId) { | |||
| public WxOrder saveFreeCouponOrder(Long userId, Long couponId) { | |||
| // check 用户状态 | |||
| WxCUser user = null; | |||
| try { | |||
| @@ -531,10 +527,9 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| record.setId(orderNumber); | |||
| record.setTenantId(user.getTenantId()); | |||
| record.setOrderNumber(orderNumber); | |||
| record.setCouponId(couponId); | |||
| record.setPorductId(couponId); | |||
| record.setType(EnumOrderType.COUPON.getCode()); | |||
| record.setCUserId(user.getId()); | |||
| record.setMerchantId(coupon.getMerchantId()); | |||
| record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | |||
| record.setPayment(payment); | |||
| record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | |||
| @@ -611,10 +606,9 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| record.setId(orderNumber); | |||
| record.setTenantId(user.getTenantId()); | |||
| record.setOrderNumber(orderNumber); | |||
| record.setCouponId(couponId); | |||
| record.setPorductId(couponId); | |||
| record.setType(EnumOrderType.COUPON.getCode()); | |||
| record.setCUserId(user.getId()); | |||
| record.setMerchantId(coupon.getMerchantId()); | |||
| record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | |||
| record.setPayment(payment); | |||
| record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | |||
| @@ -648,15 +642,15 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public int orderSuccess(WxOrder updateOrder) { | |||
| public int couponOrderSuccess(WxOrder updateOrder) { | |||
| Date currentDate = new Date(); | |||
| WxCoupon coupon = wxCouponMapper.selectByPrimaryKey(updateOrder.getCouponId()); | |||
| WxCoupon coupon = wxCouponMapper.selectByPrimaryKey(updateOrder.getPorductId()); | |||
| if (coupon == null) { | |||
| logger.error("券不存在, couponId: " + updateOrder.getCouponId()); | |||
| logger.error("券不存在, couponId: " + updateOrder.getPorductId()); | |||
| throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); | |||
| } | |||
| if (coupon.getStatus() == EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()) { | |||
| logger.error("券已下架, couponId: " + updateOrder.getCouponId()); | |||
| logger.error("券已下架, couponId: " + updateOrder.getPorductId()); | |||
| throw new MallinkException(ErrorCode.COUPON_IS_TAKE_OFF); | |||
| } | |||
| WxCUser user = wxCUserMapper.selectByPrimaryKey(updateOrder.getCUserId()); | |||
| @@ -703,9 +697,9 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| // B端用户 | |||
| WxMerchantBUser bUser = wxMerchantBUserMapper.selectByPrimaryKey(updateOrder.getBUserId()); | |||
| WxMerchantBUser bUser = wxMerchantBUserMapper.selectByPrimaryKey(updateOrder.getPorductId()); | |||
| if(bUser == null) { | |||
| logger.error("B端用户不存在, bUserId: " + updateOrder.getBUserId()); | |||
| logger.error("B端用户不存在, bUserId: " + updateOrder.getPorductId()); | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| // 基于B端User查找merchant | |||
| @@ -826,12 +820,12 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| } | |||
| @Override | |||
| public PageInfo<WxOrderCVo> listCUserVoAsPage(WxOrder record, Integer pageIndex, Integer pageSize) { | |||
| public PageInfo<WxOrderCouponVo> listCUserVoAsPage(WxOrder record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findListOfCUser(record)); | |||
| } | |||
| @Override | |||
| public WxOrderCVo detailCUserVo(WxOrder record) { | |||
| public WxOrderCouponVo detailCUserVo(WxOrder record) { | |||
| return wxOrderMapper.selectDetailOfCUser(record); | |||
| } | |||
| @@ -846,9 +840,14 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| wxPayOrder.setOrderId(orderId); | |||
| wxPayOrder.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| wxPayOrder = wxPayOrderMapper.selectOne(wxPayOrder); | |||
| if (wxPayOrder != null && | |||
| WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(orderId); | |||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(wxOrder.getPorductId()); | |||
| if (wxPayOrder != null && wxMerchantBUser != null && | |||
| wxPayOrder.getShare().equals(EnumPayShare.YES.getCode())) { | |||
| wxProfitSharingOrderService.createSharingOrder(wxPayOrder); | |||
| wxProfitSharingOrderService.createSharingOrder(wxPayOrder, wxMerchantBUser.getMerchantId()); | |||
| } else { | |||
| logger.error("微信分账: 未找到payorder or merchant at orderid-" + orderId); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error("微信分账: " + e.getMessage()); | |||
| @@ -123,6 +123,8 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| if (payAccount.getShare().intValue() > 0) { | |||
| isShare = EnumPayShare.YES; | |||
| } | |||
| /*设置进入分账,待分账时再判断是否存在对应的分账账户 | |||
| // 1.5 check 分账 receive | |||
| if (isShare == EnumPayShare.YES) { | |||
| WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); | |||
| @@ -134,6 +136,8 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| isShare = EnumPayShare.NO; | |||
| } | |||
| } | |||
| */ | |||
| // 2. check 是否有支付订单 | |||
| Date currentDate = new Date(); | |||
| record.setPayOrderStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); | |||
| @@ -385,6 +389,8 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| if (payAccount.getShare().intValue() > 0) { | |||
| isShare = EnumPayShare.YES; | |||
| } | |||
| /*进入分账,待分账时再判断是否存在对应的分账账户 | |||
| // 1.5 check 分账 receive | |||
| if (isShare == EnumPayShare.YES) { | |||
| WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); | |||
| @@ -396,6 +402,8 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| isShare = EnumPayShare.NO; | |||
| } | |||
| } | |||
| */ | |||
| // 2. check 是否有支付订单 | |||
| Date currentDate = new Date(); | |||
| record.setPayOrderStatus(EnumPayStatus.PAY_STATUS_WAIT.getCode()); | |||
| @@ -1176,7 +1184,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| // 修改订单状态 | |||
| try { | |||
| int _count = wxOrderService.orderSuccess(order); | |||
| int _count = wxOrderService.couponOrderSuccess(order); | |||
| if (_count > 1) { | |||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||
| } | |||
| @@ -1407,7 +1415,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||
| // 修改订单状态 | |||
| if (record.getPayOrderStatus() == EnumPayStatus.PAY_STATUS_SUCCESS.getCode()) { | |||
| try { | |||
| int _count = wxOrderService.orderSuccess(order); | |||
| int _count = wxOrderService.couponOrderSuccess(order); | |||
| if (_count > 1) { | |||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||
| } | |||
| @@ -121,11 +121,6 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| @Autowired | |||
| WxPayOrderMapper wxPayOrderMapper; | |||
| @Override | |||
| public void test() { | |||
| querySharingOrder(wxPayOrderMapper.selectByPrimaryKey(new Long(220465483168612352L))); | |||
| } | |||
| private WxAppinfo getAppinfo(WxPayOrder wxPayOrder) { | |||
| WxAppinfo wxAppinfo = new WxAppinfo(); | |||
| @@ -143,10 +138,9 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| @Override | |||
| @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | |||
| public ResultData createSharingOrder(WxPayOrder wxPayOrder) { | |||
| public ResultData createSharingOrder(WxPayOrder wxPayOrder, Long merchantId) { | |||
| final IdWorker idworker = IdWorker.get(); | |||
| WxAppinfo appInfo = getAppinfo(wxPayOrder); | |||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); | |||
| @@ -165,7 +159,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| record.setTransactionId(wxPayOrder.getTransactionId()); | |||
| record.setOrderId(wxPayOrder.getId()); | |||
| record.setPayAmount(wxPayOrder.getPayAmount()); | |||
| record.setMerchantId(wxOrder.getMerchantId()); | |||
| record.setMerchantId(merchantId); | |||
| record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_UNKNOWN.getCode()); | |||
| record.setCreateTime(currentDate); | |||
| record.setUpdateTime(currentDate); | |||
| @@ -187,7 +181,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||
| //添加分账接受方 | |||
| WxProfitSharingReceiver wxProfitSharingReceiver = new WxProfitSharingReceiver(); | |||
| wxProfitSharingReceiver.setTenantId(wxOrder.getTenantId()); | |||
| wxProfitSharingReceiver.setMerchantId(wxOrder.getMerchantId()); | |||
| wxProfitSharingReceiver.setMerchantId(merchantId); | |||
| wxProfitSharingReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode()); | |||
| wxProfitSharingReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||
| List<WxProfitSharingReceiver> wxProfitSharingReceiverList = wxProfitSharingReceiverMapper.findList(wxProfitSharingReceiver); | |||
| @@ -69,6 +69,9 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| @Autowired | |||
| WxMerchantMapper wxMerchantMapper; | |||
| @Autowired | |||
| WxCouponMerchantMapper wxCouponMerchantMapper; | |||
| @Autowired | |||
| WxCUserMapper wxCUserMapper; | |||
| @@ -229,9 +232,38 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| " }\n" + | |||
| "}"); | |||
| private boolean isMerchantOrder(WxOrder wxOrder, Long merchantId) { | |||
| if (wxOrder.getType().equals(EnumOrderType.COUPON.getCode())){ | |||
| WxCoupon wxCoupon = wxCouponMapper.selectByPrimaryKey(wxOrder.getPorductId()); | |||
| if (wxCoupon != null) { | |||
| WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); | |||
| wxCouponMerchant.setCouponId(wxCoupon.getId()); | |||
| wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); | |||
| List<WxCouponMerchant> couponMerchantList = wxCouponMerchantMapper.findList(wxCouponMerchant); | |||
| if (couponMerchantList.stream().anyMatch(cm->cm.getMerchantId().equals(merchantId))){ | |||
| return true; | |||
| } | |||
| } | |||
| }else if(wxOrder.getType().equals(EnumOrderType.MICROPAY.getCode())) { | |||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(wxOrder.getPorductId()); | |||
| if (wxMerchantBUser != null && wxMerchantBUser.equals(merchantId)) { | |||
| return true; | |||
| } | |||
| }else if(wxOrder.getType().equals(EnumOrderType.NATIVEPAY.getCode())) { | |||
| }else if(wxOrder.getType().equals(EnumOrderType.PREPAIDCARD.getCode())) { | |||
| } | |||
| return false; | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public ResultData createRefundOrder(boolean isReal, WxAppinfo appInfo, Long couponOrderId, EnumRefundWay refundWay, Long bUserId) { | |||
| public ResultData createRefundOrder(boolean isReal, WxAppinfo appInfo, Long couponOrderId, EnumPayType payType, Long bUserId) { | |||
| WxCouponOrder wxCouponOrder = wxCouponOrderMapper.selectByPrimaryKey(couponOrderId); | |||
| if (wxCouponOrder == null) { | |||
| logger.error("券ID不存在:" + couponOrderId); | |||
| @@ -240,7 +272,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(wxCouponOrder.getOrderId()); | |||
| if (refundWay == EnumRefundWay.B) { | |||
| if (payType == EnumPayType.PAY_B_REFUND) { | |||
| logger.info("B端发起退款: bUserId-" + bUserId); | |||
| if (bUserId == null || bUserId == 0) { | |||
| logger.error("B端用户不存在:" + bUserId); | |||
| @@ -252,13 +284,13 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| logger.error("操作员ID不存在:" + bUserId); | |||
| throw new MallinkException(ErrorCode.REFUND_ORDER_BUSER_IS_NULL); | |||
| } | |||
| if (!wxOrder.getMerchantId().equals(wxMerchantBUser.getMerchantId())) { | |||
| logger.error("券: couponMerchantId-" + wxOrder.getMerchantId() + "退款: couponMerchantId-" + wxMerchantBUser.getMerchantId()); | |||
| if (isMerchantOrder(wxOrder, wxMerchantBUser.getMerchantId())) { | |||
| logger.error("订单: productId-" + wxOrder.getPorductId() + "退款: couponMerchantId-" + wxMerchantBUser.getMerchantId()); | |||
| throw new MallinkException(ErrorCode.REFUND_ORDER_BUSER_NOT_EQUAL); | |||
| } | |||
| } else if (refundWay == EnumRefundWay.ADMIN) { | |||
| } else if (payType == EnumPayType.PAY_ADMIN_REFUND) { | |||
| logger.info("ADMIN端发起退款: bUserId-" + bUserId); | |||
| } else if (refundWay == EnumRefundWay.AUTO) { | |||
| } else if (payType == EnumPayType.PAY_AUTO_REFUND) { | |||
| logger.info("auto端发起退款"); | |||
| } else { | |||
| logger.info("自己发起退款: cUserId-" + bUserId); | |||
| @@ -290,20 +322,13 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| rOrder.setId(refundOrderId); | |||
| rOrder.setTenantId(appInfo.getTenantId()); | |||
| rOrder.setOrderNumber(wxOrder.getOrderNumber()); // 退款订单填写支付订单orderNumber | |||
| rOrder.setCouponId(wxOrder.getCouponId()); | |||
| rOrder.setPorductId(wxOrder.getPorductId()); | |||
| rOrder.setType(EnumOrderType.COUPON.getCode()); | |||
| rOrder.setCUserId(wxOrder.getCUserId()); | |||
| if (refundWay == EnumRefundWay.B) { | |||
| rOrder.setBUserId(bUserId); | |||
| } else if (refundWay == EnumRefundWay.AUTO) { | |||
| rOrder.setBUserId(0L); // 自动退款, 设置bUserId为0 | |||
| } else if (refundWay == EnumRefundWay.ADMIN) { | |||
| rOrder.setBUserId(1L); // ADMIN发起退款, 设置bUserId为1 | |||
| } else { | |||
| rOrder.setBUserId(2L); // 自己发起退款, 设置bUserId为2 | |||
| if (payType == EnumPayType.PAY_B_REFUND) { | |||
| rOrder.setPorductId(bUserId); //B端发起退款后存B端用户ID在此 | |||
| } | |||
| rOrder.setMerchantId(wxOrder.getMerchantId()); | |||
| rOrder.setPaymentType(EnumPayType.PAY_REFUND.getCode()); | |||
| rOrder.setPaymentType(payType.getCode()); | |||
| rOrder.setPayment(wxOrder.getPayment()); | |||
| rOrder.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_REFUND.getCode()); | |||
| rOrder.setCreateDate(currentDate); | |||
| @@ -317,14 +342,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| // 更改 couponOrder 状态 | |||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_INVALID.getCode()); //3退款,券作废 | |||
| if (refundWay == EnumRefundWay.B) { | |||
| if (payType == EnumPayType.PAY_B_REFUND) { | |||
| wxCouponOrder.setBUserId(bUserId); | |||
| } else if (refundWay == EnumRefundWay.AUTO) { | |||
| wxCouponOrder.setBUserId(0L); // 自动退款, 设置bUserId为0 | |||
| } else if (refundWay == EnumRefundWay.ADMIN) { | |||
| wxCouponOrder.setBUserId(1L); // ADMIN发起退款, 设置bUserId为1 | |||
| } else { | |||
| wxCouponOrder.setBUserId(2L); // 自己发起退款, 设置bUserId为2 | |||
| } else{ | |||
| wxCouponOrder.setBUserId(payType.getCode().longValue());//其他退款模式将退款方式存入BUSERID | |||
| } | |||
| wxCouponOrder.setUpdateDate(currentDate); | |||
| try { | |||
| @@ -424,11 +445,11 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| wxRefundOrderP.setOut_refund_no(out_refund_id); | |||
| wxRefundOrderP.setTotal_fee(record.getTotalFee()); | |||
| wxRefundOrderP.setRefund_fee(record.getRefundFee()); | |||
| if (refundWay == EnumRefundWay.B) { | |||
| if (payType == EnumPayType.PAY_B_REFUND) { | |||
| wxRefundOrderP.setRefund_desc("B端商户退款"); | |||
| } else if (refundWay == EnumRefundWay.ADMIN) { | |||
| } else if (payType == EnumPayType.PAY_ADMIN_REFUND) { | |||
| wxRefundOrderP.setRefund_desc("管理端商户退款"); | |||
| } else if (refundWay == EnumRefundWay.AUTO) { | |||
| } else if (payType == EnumPayType.PAY_AUTO_REFUND) { | |||
| wxRefundOrderP.setRefund_desc("超期自动退款"); | |||
| } else { | |||
| wxRefundOrderP.setRefund_desc("用户自己退款"); | |||
| @@ -502,11 +523,11 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| wxRefundOrderSP.setOut_refund_no(out_refund_id); | |||
| wxRefundOrderSP.setTotal_fee(record.getTotalFee()); | |||
| wxRefundOrderSP.setRefund_fee(record.getRefundFee()); | |||
| if (refundWay == EnumRefundWay.B) { | |||
| if (payType == EnumPayType.PAY_B_REFUND) { | |||
| wxRefundOrderSP.setRefund_desc("B端商户退款"); | |||
| } else if (refundWay == EnumRefundWay.ADMIN) { | |||
| } else if (payType == EnumPayType.PAY_ADMIN_REFUND) { | |||
| wxRefundOrderSP.setRefund_desc("管理端商户退款"); | |||
| } else if (refundWay == EnumRefundWay.AUTO) { | |||
| } else if (payType == EnumPayType.PAY_AUTO_REFUND) { | |||
| wxRefundOrderSP.setRefund_desc("超期自动退款"); | |||
| } else { | |||
| wxRefundOrderSP.setRefund_desc("用户自己退款"); | |||
| @@ -581,11 +602,11 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| wxRefundOrderP.setOut_refund_no(out_refund_id); | |||
| wxRefundOrderP.setTotal_fee(record.getTotalFee()); | |||
| wxRefundOrderP.setRefund_fee(record.getRefundFee()); | |||
| if (refundWay == EnumRefundWay.B) { | |||
| if (payType == EnumPayType.PAY_B_REFUND) { | |||
| wxRefundOrderP.setRefund_desc("B端商户退款"); | |||
| } else if (refundWay == EnumRefundWay.ADMIN) { | |||
| } else if (payType == EnumPayType.PAY_ADMIN_REFUND) { | |||
| wxRefundOrderP.setRefund_desc("管理端商户退款"); | |||
| } else if (refundWay == EnumRefundWay.AUTO) { | |||
| } else if (payType == EnumPayType.PAY_AUTO_REFUND) { | |||
| wxRefundOrderP.setRefund_desc("超期自动退款"); | |||
| } else { | |||
| wxRefundOrderP.setRefund_desc("用户自己退款"); | |||
| @@ -612,10 +633,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public ResultData createRefundOrderFromMicroPay(boolean isReal, WxAppinfo appInfo, Long orderId, EnumRefundWay refundWay, Long bUserId) { | |||
| public ResultData createRefundOrderFromMicroPay(boolean isReal, WxAppinfo appInfo, Long orderId, EnumPayType payType, Long bUserId) { | |||
| WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(orderId); | |||
| if (refundWay == EnumRefundWay.B) { | |||
| if (payType == EnumPayType.PAY_B_REFUND) { | |||
| logger.info("B端发起退款: bUserId-" + bUserId); | |||
| if (bUserId == null || bUserId == 0) { | |||
| logger.error("B端用户不存在:" + bUserId); | |||
| @@ -627,13 +648,13 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| logger.error("操作员ID不存在:" + bUserId); | |||
| throw new MallinkException(ErrorCode.REFUND_ORDER_BUSER_IS_NULL); | |||
| } | |||
| if (!wxOrder.getMerchantId().equals(wxMerchantBUser.getMerchantId())) { | |||
| logger.error("券: order MerchantId-" + wxOrder.getMerchantId() + "发起用户: B端MerchantId-" + wxMerchantBUser.getMerchantId()); | |||
| if (isMerchantOrder(wxOrder, wxMerchantBUser.getMerchantId())) { | |||
| logger.error("订单: productId-" + wxOrder.getPorductId() + "退款: MerchantId-" + wxMerchantBUser.getMerchantId()); | |||
| throw new MallinkException(ErrorCode.REFUND_ORDER_BUSER_NOT_EQUAL); | |||
| } | |||
| } else if (refundWay == EnumRefundWay.ADMIN) { | |||
| } else if (payType == EnumPayType.PAY_ADMIN_REFUND) { | |||
| logger.info("ADMIN端发起退款: bUserId-" + bUserId); | |||
| } else if (refundWay == EnumRefundWay.AUTO) { | |||
| } else if (payType == EnumPayType.PAY_AUTO_REFUND) { | |||
| logger.info("auto端发起退款"); | |||
| } else { | |||
| logger.info("自己发起退款: cUserId-" + bUserId); | |||
| @@ -654,17 +675,10 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| rOrder.setOrderNumber(wxOrder.getOrderNumber()); // 退款订单填写支付订单orderNumber | |||
| rOrder.setType(EnumOrderType.MICROPAY.getCode()); | |||
| rOrder.setCUserId(wxOrder.getCUserId()); | |||
| if (refundWay == EnumRefundWay.B) { | |||
| rOrder.setBUserId(bUserId); | |||
| } else if (refundWay == EnumRefundWay.AUTO) { | |||
| rOrder.setBUserId(0L); // 自动退款, 设置bUserId为0 | |||
| } else if (refundWay == EnumRefundWay.ADMIN) { | |||
| rOrder.setBUserId(1L); // ADMIN发起退款, 设置bUserId为1 | |||
| } else { | |||
| rOrder.setBUserId(2L); // 自己发起退款, 设置bUserId为2 | |||
| if (payType == EnumPayType.PAY_B_REFUND) { | |||
| rOrder.setPorductId(bUserId); //B端发起退款后存B端用户ID在此 | |||
| } | |||
| rOrder.setMerchantId(wxOrder.getMerchantId()); | |||
| rOrder.setPaymentType(EnumPayType.PAY_REFUND.getCode()); | |||
| rOrder.setPaymentType(payType.getCode()); | |||
| rOrder.setPayment(wxOrder.getPayment()); | |||
| rOrder.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_REFUND.getCode()); | |||
| rOrder.setCreateDate(currentDate); | |||
| @@ -766,11 +780,11 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| wxRefundOrderP.setOut_refund_no(out_refund_id); | |||
| wxRefundOrderP.setTotal_fee(record.getTotalFee()); | |||
| wxRefundOrderP.setRefund_fee(record.getRefundFee()); | |||
| if (refundWay == EnumRefundWay.B) { | |||
| if (payType == EnumPayType.PAY_B_REFUND) { | |||
| wxRefundOrderP.setRefund_desc("B端商户退款"); | |||
| } else if (refundWay == EnumRefundWay.ADMIN) { | |||
| } else if (payType == EnumPayType.PAY_ADMIN_REFUND) { | |||
| wxRefundOrderP.setRefund_desc("管理端商户退款"); | |||
| } else if (refundWay == EnumRefundWay.AUTO) { | |||
| } else if (payType == EnumPayType.PAY_AUTO_REFUND) { | |||
| wxRefundOrderP.setRefund_desc("超期自动退款"); | |||
| } else { | |||
| wxRefundOrderP.setRefund_desc("用户自己退款"); | |||
| @@ -844,11 +858,11 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| wxRefundOrderSP.setOut_refund_no(out_refund_id); | |||
| wxRefundOrderSP.setTotal_fee(record.getTotalFee()); | |||
| wxRefundOrderSP.setRefund_fee(record.getRefundFee()); | |||
| if (refundWay == EnumRefundWay.B) { | |||
| if (payType == EnumPayType.PAY_B_REFUND) { | |||
| wxRefundOrderSP.setRefund_desc("B端商户退款"); | |||
| } else if (refundWay == EnumRefundWay.ADMIN) { | |||
| } else if (payType == EnumPayType.PAY_ADMIN_REFUND) { | |||
| wxRefundOrderSP.setRefund_desc("管理端商户退款"); | |||
| } else if (refundWay == EnumRefundWay.AUTO) { | |||
| } else if (payType == EnumPayType.PAY_AUTO_REFUND) { | |||
| wxRefundOrderSP.setRefund_desc("超期自动退款"); | |||
| } else { | |||
| wxRefundOrderSP.setRefund_desc("用户自己退款"); | |||
| @@ -923,11 +937,11 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||
| wxRefundOrderP.setOut_refund_no(out_refund_id); | |||
| wxRefundOrderP.setTotal_fee(record.getTotalFee()); | |||
| wxRefundOrderP.setRefund_fee(record.getRefundFee()); | |||
| if (refundWay == EnumRefundWay.B) { | |||
| if (payType == EnumPayType.PAY_B_REFUND) { | |||
| wxRefundOrderP.setRefund_desc("B端商户退款"); | |||
| } else if (refundWay == EnumRefundWay.ADMIN) { | |||
| } else if (payType == EnumPayType.PAY_ADMIN_REFUND) { | |||
| wxRefundOrderP.setRefund_desc("管理端商户退款"); | |||
| } else if (refundWay == EnumRefundWay.AUTO) { | |||
| } else if (payType == EnumPayType.PAY_AUTO_REFUND) { | |||
| wxRefundOrderP.setRefund_desc("超期自动退款"); | |||
| } else { | |||
| wxRefundOrderP.setRefund_desc("用户自己退款"); | |||
| @@ -6,10 +6,8 @@ | |||
| <result column="order_number" jdbcType="BIGINT" property="orderNumber"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId"/> | |||
| <result column="product_id" jdbcType="BIGINT" property="productId"/> | |||
| <result column="type" jdbcType="TINYINT" property="type"/> | |||
| <result column="b_user_id" jdbcType="BIGINT" property="bUserId"/> | |||
| <result column="payment_type" jdbcType="INTEGER" property="paymentType"/> | |||
| <result column="payment" jdbcType="INTEGER" property="payment"/> | |||
| <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime"/> | |||
| @@ -20,7 +18,7 @@ | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`order_number`,`tenant_id`,`c_user_id`,`merchant_id`,`coupon_id`,`type`,`b_user_id`,`payment_type`,`payment`,`payment_time`,`order_status`,`create_date`,`update_date`,`detail` | |||
| `id`,`order_number`,`tenant_id`,`c_user_id`,`product_id`,`type`,`payment_type`,`payment`,`payment_time`,`order_status`,`create_date`,`update_date`,`detail` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -42,16 +40,8 @@ | |||
| and `c_user_id` = #{cUserId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != bUserId "> | |||
| and `b_user_id` = #{bUserId} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and `coupon_id` = #{couponId} | |||
| <if test=" null != productId "> | |||
| and `product_id` = #{productId} | |||
| </if> | |||
| <if test=" null != type "> | |||
| @@ -115,8 +105,8 @@ | |||
| <if test=" null != cUserId "> | |||
| and `c_user_id` = #{cUserId} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and `coupon_id` = #{couponId} | |||
| <if test=" null != productId "> | |||
| and `product_id` = #{productId} | |||
| </if> | |||
| <if test=" null != orderStatus "> | |||
| and `order_status` = #{orderStatus} | |||
| @@ -142,29 +132,34 @@ | |||
| <sql id="allCUserOrderListColumns"> | |||
| o.id,o.order_number,o.tenant_id,o.c_user_id,o.merchant_id,o.b_user_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date, | |||
| o.id,o.order_number,o.tenant_id,o.c_user_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date, | |||
| co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,co.unit, | |||
| </sql> | |||
| <sql id="allCUserOrderListMerchantColumns"> | |||
| m.name | |||
| </sql> | |||
| <sql id="allCUserOrderDetailColumns"> | |||
| o.id,o.order_number,o.tenant_id,o.c_user_id,o.merchant_id,o.b_user_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date, | |||
| o.id,o.order_number,o.tenant_id,o.c_user_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date, | |||
| co.type,co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,co.unit,co.detail,co.remark, | |||
| c.id as coupon_order_id,c.coupon_order_status | |||
| </sql> | |||
| <sql id="allCUserOrderDetailMerchantColumns"> | |||
| m.id, | |||
| m.img_url,m.name,m.link_phone,m.status, | |||
| s.addr,s.shop_number,s.baidu_poi, | |||
| mb.building_name,mf.floor_name, | |||
| c.id as coupon_order_id,c.coupon_order_status | |||
| </sql> | |||
| <resultMap id="CVoResultMap" type="com.iformall.domain.vo.WxOrderCVo"> | |||
| <resultMap id="CVoResultMap" type="com.iformall.domain.vo.WxOrderCouponVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="order_number" jdbcType="BIGINT" property="orderNumber"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId"/> | |||
| <result column="b_user_id" jdbcType="BIGINT" property="bUserId"/> | |||
| <result column="product_id" jdbcType="BIGINT" property="productId"/> | |||
| <result column="payment_type" jdbcType="INTEGER" property="paymentType"/> | |||
| <result column="payment" jdbcType="INTEGER" property="payment"/> | |||
| <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime"/> | |||
| @@ -186,6 +181,15 @@ | |||
| <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId"/> | |||
| <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus"/> | |||
| <collection property="merchantVoList" | |||
| ofType="com.iformall.domain.vo.WxMerchantVo" | |||
| column="coupon_id" | |||
| select="com.iformall.mapper.WxOrderMapper.findMerchantList" > | |||
| </collection> | |||
| </resultMap> | |||
| <resultMap id="CVoMerchantResultMap" type="com.iformall.domain.vo.WxMerchantVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl"/> | |||
| <result column="name" jdbcType="VARCHAR" property="merchantName"/> | |||
| <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/> | |||
| @@ -198,12 +202,23 @@ | |||
| <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/> | |||
| </resultMap> | |||
| <select id="findMerchantList" parameterType="com.iformall.domain.vo.WxMerchantVo" resultMap="CVoMerchantResultMap"> | |||
| select | |||
| <include refid="allCUserOrderDetailMerchantColumns"/> | |||
| from wx_coupon_merchant cm | |||
| left join wx_merchant m on m.id = cm.merchant_id | |||
| left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0 | |||
| left join wx_shop s on ms.shop_id = s.id | |||
| left join wx_mall_building mb on s.building = mb.id | |||
| left join wx_mall_floor mf on s.floor = mf.id | |||
| where cm.product_id = #{productId} | |||
| </select> | |||
| <select id="findListOfCUser" parameterType="com.iformall.domain.po.WxOrder" resultMap="CVoResultMap"> | |||
| select | |||
| <include refid="allCUserOrderListColumns"/> | |||
| from wx_order o,wx_coupon co,wx_merchant m | |||
| where o.coupon_id = co.id | |||
| where o.product_id = co.id | |||
| and co.merchant_id = m.id | |||
| <if test="cUserId != null"> | |||
| and o.c_user_id = #{cUserId} | |||
| @@ -221,15 +236,9 @@ | |||
| select | |||
| <include refid="allCUserOrderDetailColumns"/> | |||
| FROM wx_order o | |||
| left join wx_coupon co ON o.coupon_id = co.id | |||
| left join wx_merchant m ON co.merchant_id = m.id | |||
| left join wx_coupon co ON o.product_id = co.id | |||
| left join wx_coupon_order c on o.id = c.order_id | |||
| left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0 | |||
| left join wx_shop s on ms.shop_id = s.id | |||
| left join wx_mall_building mb on s.building = mb.id | |||
| left join wx_mall_floor mf on s.floor = mf.id | |||
| where o.coupon_id = co.id | |||
| and co.merchant_id = m.id | |||
| where o.product_id = co.id | |||
| <if test="cUserId != null"> | |||
| and o.c_user_id = #{cUserId} | |||
| </if> | |||
| @@ -242,29 +251,38 @@ | |||
| </select> | |||
| <select id="dayMicroPayAmountList" parameterType="map" resultType="map"> | |||
| select count(*) as count, IFNULL(sum(payment), 0) as total_price | |||
| from wx_order | |||
| inner join wx_merchant_b_user bu on bu.id = product_id | |||
| inner join wx_merchant m on m.id = bu.merchant_id | |||
| where `type` = 1 and `order_status` = 1 | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and bu.`merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| and `c_user_id` = #{cUserId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != bUserId "> | |||
| and `b_user_id` = #{bUserId} | |||
| and bu.`id` = #{bUserId} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and `coupon_id` = #{couponId} | |||
| <if test=" null != productId "> | |||
| and `product_id` = #{productId} | |||
| </if> | |||
| <if test="startDate != null"> | |||
| AND create_date > #{startDate,jdbcType=TIMESTAMP} | |||
| </if> | |||
| <if test="endDate != null"> | |||
| AND create_date < #{endDate,jdbcType=TIMESTAMP} | |||
| </if> | |||
| @@ -275,10 +293,8 @@ | |||
| <result column="order_number" jdbcType="BIGINT" property="orderNumber"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId"/> | |||
| <result column="product_id" jdbcType="BIGINT" property="productId"/> | |||
| <result column="type" jdbcType="TINYINT" property="type"/> | |||
| <result column="b_user_id" jdbcType="BIGINT" property="bUserId"/> | |||
| <result column="payment_type" jdbcType="INTEGER" property="paymentType"/> | |||
| <result column="payment" jdbcType="INTEGER" property="payment"/> | |||
| <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime"/> | |||
| @@ -294,7 +310,7 @@ | |||
| </resultMap> | |||
| <sql id="allPayOrderColumns"> | |||
| o.`id`,o.`order_number`,o.`tenant_id`,o.`c_user_id`,o.`merchant_id`,o.`coupon_id`,o.`type`,o.`b_user_id`, | |||
| o.`id`,o.`order_number`,o.`tenant_id`,o.`c_user_id`,o.`product_id`,o.`type`, | |||
| o.`payment_type`,o.`payment`,o.`payment_time`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail`, | |||
| m.name as merchant_name, bu.name, bu.phone as bphone, cu.phone | |||
| </sql> | |||
| @@ -303,18 +319,18 @@ | |||
| select | |||
| <include refid="allPayOrderColumns"/> | |||
| from wx_order o | |||
| inner JOIN wx_merchant m on m.id = o.merchant_id | |||
| left join wx_merchant_b_user bu on bu.`merchant_id` = o.`merchant_id` and bu.id = o.`b_user_id` | |||
| left JOIN wx_c_user cu on cu.id = o.c_user_id | |||
| inner join wx_merchant_b_user bu on bu.id = o.product_id | |||
| inner join wx_merchant m on m.id = bu.merchant_id | |||
| left join wx_c_user cu on cu.id = o.c_user_id | |||
| where o.order_status = '1' and o.`type` = 1 | |||
| <if test=" null != tenantId "> | |||
| and o.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and o.`merchant_id` = #{merchantId} | |||
| and bu.`merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != bUserId "> | |||
| and o.`b_user_id` = #{bUserId} | |||
| and bu.`id` = #{bUserId} | |||
| </if> | |||
| <if test="startDate != null"> | |||
| AND o.create_date > #{startDate,jdbcType=TIMESTAMP} | |||