| @@ -138,12 +138,22 @@ public class BaseController { | |||||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | throw new MallinkException(ErrorCode.USER_IS_EMPTY); | ||||
| } | } | ||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| if (user.getTenantId() == null) { | |||||
| user.setTenantId(tenantEntity.getTenantId()); | |||||
| } | |||||
| if (user.getParentTenantId() == null) { | |||||
| user.setParentTenantId(tenantEntity.getParentTenantId()); | |||||
| if (tenantEntity.isChildMall()) { | |||||
| if (user.getTenantId() == null) { | |||||
| user.setTenantId(tenantEntity.getParentTenantId()); | |||||
| } | |||||
| if (user.getParentTenantId() == null) { | |||||
| user.setParentTenantId(null); | |||||
| } | |||||
| }else { | |||||
| if (user.getTenantId() == null) { | |||||
| user.setTenantId(tenantEntity.getTenantId()); | |||||
| } | |||||
| if (user.getParentTenantId() == null) { | |||||
| user.setParentTenantId(tenantEntity.getParentTenantId()); | |||||
| } | |||||
| } | } | ||||
| return user; | return user; | ||||
| } | } | ||||
| @@ -158,9 +168,11 @@ public class BaseController { | |||||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | ||||
| String tenantId = (String) request.getAttribute(Constant.TENANT_ID); | String tenantId = (String) request.getAttribute(Constant.TENANT_ID); | ||||
| String parentTenantId = (String) request.getAttribute(Constant.PARENT_TENANT_ID); | String parentTenantId = (String) request.getAttribute(Constant.PARENT_TENANT_ID); | ||||
| boolean isChildMall = (boolean)request.getAttribute(Constant.IS_CHILD_MALL); | |||||
| TenantEntity tenantEntity = new TenantEntity(); | TenantEntity tenantEntity = new TenantEntity(); | ||||
| tenantEntity.setTenantId(tenantId); | tenantEntity.setTenantId(tenantId); | ||||
| tenantEntity.setParentTenantId(parentTenantId); | tenantEntity.setParentTenantId(parentTenantId); | ||||
| tenantEntity.setChildMall(isChildMall); | |||||
| return tenantEntity; | return tenantEntity; | ||||
| } | } | ||||
| @@ -4,10 +4,12 @@ import com.alibaba.fastjson.JSONObject; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.AuthIgnore; | import com.iformall.annotation.AuthIgnore; | ||||
| import com.iformall.annotation.RedisCache; | import com.iformall.annotation.RedisCache; | ||||
| import com.iformall.annotation.TenantIgnore; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.vo.WxCouponCVo; | import com.iformall.domain.vo.WxCouponCVo; | ||||
| import com.iformall.domain.vo.WxCouponOrderBVo; | import com.iformall.domain.vo.WxCouponOrderBVo; | ||||
| import com.iformall.domain.vo.WxCouponOrderCVo; | import com.iformall.domain.vo.WxCouponOrderCVo; | ||||
| @@ -282,6 +284,7 @@ public class WxCouponOrderController extends BaseController { | |||||
| return new ResultData(wxCouponOrderCVo); | return new ResultData(wxCouponOrderCVo); | ||||
| } | } | ||||
| @TenantIgnore | |||||
| @ApiOperation(value = "核销接口", notes = "{\"couponOrderId\":\"string\"}") | @ApiOperation(value = "核销接口", notes = "{\"couponOrderId\":\"string\"}") | ||||
| @PostMapping("verify") | @PostMapping("verify") | ||||
| public ResultData verify(@RequestBody Map<String, String> paramMap) { | public ResultData verify(@RequestBody Map<String, String> paramMap) { | ||||
| @@ -313,8 +316,19 @@ public class WxCouponOrderController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | ||||
| } | } | ||||
| WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderService.detailCUserVo(couponOrderIdStr,getTenantInfo()); | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| WxCouponOrderCVo wxCouponOrderCVo = null; | |||||
| if (tenantEntity.isChildMall()) { | |||||
| //查询父 | |||||
| TenantEntity parentTenant = new TenantEntity(); | |||||
| parentTenant.setTenantId(tenantEntity.getParentTenantId()); | |||||
| parentTenant.setParentTenantId(null); | |||||
| wxCouponOrderCVo = wxCouponOrderService.detailCUserVo(couponOrderIdStr,parentTenant); | |||||
| }else { | |||||
| wxCouponOrderCVo = wxCouponOrderService.detailCUserVo(couponOrderIdStr,tenantEntity); | |||||
| } | |||||
| if (wxCouponOrderCVo == null) | if (wxCouponOrderCVo == null) | ||||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | ||||
| @@ -353,7 +367,12 @@ public class WxCouponOrderController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| WxCouponOrder wxCouponOrder = wxCouponOrderService.getById(couponOrderId,getTenantInfo().getTenantId()); | |||||
| WxCouponOrder wxCouponOrder = null; | |||||
| if (tenantEntity.isChildMall()) { | |||||
| wxCouponOrder = wxCouponOrderService.getById(couponOrderId,tenantEntity.getParentTenantId()); | |||||
| }else { | |||||
| wxCouponOrder = wxCouponOrderService.getById(couponOrderId,tenantEntity.getTenantId()); | |||||
| } | |||||
| if (wxCouponOrder == null) { | if (wxCouponOrder == null) { | ||||
| logger.error("券ID不存在:" + couponOrderId); | logger.error("券ID不存在:" + couponOrderId); | ||||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | ||||
| @@ -79,6 +79,7 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { | |||||
| // 查询token信息 | // 查询token信息 | ||||
| String tenantId = null; | String tenantId = null; | ||||
| String parenTenantId = null; | String parenTenantId = null; | ||||
| boolean isChildMall = false; | |||||
| if (!StringUtils.isBlank(token)) { | if (!StringUtils.isBlank(token)) { | ||||
| BaseCUserEntity user = cUserTokenService.getBByToken(token); | BaseCUserEntity user = cUserTokenService.getBByToken(token); | ||||
| if (user == null || user.getExpireTime().getTime() < System.currentTimeMillis()) { | if (user == null || user.getExpireTime().getTime() < System.currentTimeMillis()) { | ||||
| @@ -90,11 +91,13 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { | |||||
| }else { | }else { | ||||
| tenantId = mallTenantId; | tenantId = mallTenantId; | ||||
| parenTenantId = user.getTenantId(); | parenTenantId = user.getTenantId(); | ||||
| isChildMall = true; | |||||
| } | } | ||||
| request.setAttribute(Constant.LOGIN_USER_KEY, user.getId()); | request.setAttribute(Constant.LOGIN_USER_KEY, user.getId()); | ||||
| request.setAttribute(Constant.TENANT_ID, tenantId); | request.setAttribute(Constant.TENANT_ID, tenantId); | ||||
| request.setAttribute(Constant.REQUEST_C_USER_KEY, user); | request.setAttribute(Constant.REQUEST_C_USER_KEY, user); | ||||
| request.setAttribute(Constant.APP_INFO, user.getAppinfo()); | request.setAttribute(Constant.APP_INFO, user.getAppinfo()); | ||||
| request.setAttribute(Constant.IS_CHILD_MALL,isChildMall); | |||||
| if (StringUtils.isNotBlank(parenTenantId)) { | if (StringUtils.isNotBlank(parenTenantId)) { | ||||
| request.setAttribute(Constant.PARENT_TENANT_ID, parenTenantId); | request.setAttribute(Constant.PARENT_TENANT_ID, parenTenantId); | ||||
| } | } | ||||
| @@ -111,8 +114,10 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { | |||||
| }else { | }else { | ||||
| tenantId = mallTenantId; | tenantId = mallTenantId; | ||||
| parenTenantId = buser.getTenantId(); | parenTenantId = buser.getTenantId(); | ||||
| isChildMall = true; | |||||
| } | } | ||||
| request.setAttribute(Constant.LOGIN_B_USER_KEY, buser.getId()); | request.setAttribute(Constant.LOGIN_B_USER_KEY, buser.getId()); | ||||
| request.setAttribute(Constant.IS_CHILD_MALL,isChildMall); | |||||
| request.setAttribute(Constant.TENANT_ID, tenantId); | request.setAttribute(Constant.TENANT_ID, tenantId); | ||||
| if (StringUtils.isNotBlank(parenTenantId)) { | if (StringUtils.isNotBlank(parenTenantId)) { | ||||
| request.setAttribute(Constant.PARENT_TENANT_ID, parenTenantId); | request.setAttribute(Constant.PARENT_TENANT_ID, parenTenantId); | ||||
| @@ -113,9 +113,11 @@ public class BaseController { | |||||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | ||||
| String tenantId = (String) request.getAttribute(Constant.TENANT_ID); | String tenantId = (String) request.getAttribute(Constant.TENANT_ID); | ||||
| String parentTenantId = (String) request.getAttribute(Constant.PARENT_TENANT_ID); | String parentTenantId = (String) request.getAttribute(Constant.PARENT_TENANT_ID); | ||||
| boolean isChildMall = (boolean)request.getAttribute(Constant.IS_CHILD_MALL); | |||||
| TenantEntity tenantEntity = new TenantEntity() ; | TenantEntity tenantEntity = new TenantEntity() ; | ||||
| tenantEntity.setTenantId(tenantId); | tenantEntity.setTenantId(tenantId); | ||||
| tenantEntity.setParentTenantId(parentTenantId); | tenantEntity.setParentTenantId(parentTenantId); | ||||
| tenantEntity.setChildMall(isChildMall); | |||||
| return tenantEntity; | return tenantEntity; | ||||
| } | } | ||||
| @@ -69,20 +69,19 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { | |||||
| if(StringUtils.isBlank(mallTenantId)){ | if(StringUtils.isBlank(mallTenantId)){ | ||||
| mallTenantId = request.getParameter("mallTenantId"); | mallTenantId = request.getParameter("mallTenantId"); | ||||
| } | } | ||||
| //设置userId到request里,后续根据userId,获取用户信息 | //设置userId到request里,后续根据userId,获取用户信息 | ||||
| request.setAttribute(Constant.LOGIN_USER_KEY, cUser.getId()); | request.setAttribute(Constant.LOGIN_USER_KEY, cUser.getId()); | ||||
| if (StringUtils.isNotBlank(mallTenantId)) { | if (StringUtils.isNotBlank(mallTenantId)) { | ||||
| request.setAttribute(Constant.TENANT_ID, mallTenantId); | request.setAttribute(Constant.TENANT_ID, mallTenantId); | ||||
| request.setAttribute(Constant.PARENT_TENANT_ID, cUser.getTenantId()); | request.setAttribute(Constant.PARENT_TENANT_ID, cUser.getTenantId()); | ||||
| request.setAttribute(Constant.IS_CHILD_MALL,true); | |||||
| }else { | }else { | ||||
| request.setAttribute(Constant.TENANT_ID, cUser.getTenantId()); | request.setAttribute(Constant.TENANT_ID, cUser.getTenantId()); | ||||
| if (StringUtils.isNotBlank(cUser.getParentTenantId())) { | if (StringUtils.isNotBlank(cUser.getParentTenantId())) { | ||||
| request.setAttribute(Constant.PARENT_TENANT_ID, cUser.getParentTenantId()); | request.setAttribute(Constant.PARENT_TENANT_ID, cUser.getParentTenantId()); | ||||
| } | } | ||||
| request.setAttribute(Constant.IS_CHILD_MALL,false); | |||||
| } | } | ||||
| request.setAttribute(Constant.REQUEST_C_USER_KEY, cUser); | request.setAttribute(Constant.REQUEST_C_USER_KEY, cUser); | ||||
| request.setAttribute(Constant.APP_INFO,cUser.getAppinfo()); | request.setAttribute(Constant.APP_INFO,cUser.getAppinfo()); | ||||
| @@ -26,6 +26,10 @@ public class TenantEntity extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="父租户ID",name="parentTenantId") | @io.swagger.annotations.ApiModelProperty(value="父租户ID",name="parentTenantId") | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| protected String finalTenantId; | protected String finalTenantId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="是否是集团统一小程序版本下的子广场",name="isChildMall") | |||||
| @TableField(exist = false) | |||||
| protected boolean isChildMall; | |||||
| @JsonIgnore | @JsonIgnore | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @@ -97,5 +101,13 @@ public class TenantEntity extends BaseEntity { | |||||
| public void setTenantIdList(List<String> tenantIdList) { | public void setTenantIdList(List<String> tenantIdList) { | ||||
| this.tenantIdList = tenantIdList; | this.tenantIdList = tenantIdList; | ||||
| } | } | ||||
| public boolean isChildMall() { | |||||
| return isChildMall; | |||||
| } | |||||
| public void setChildMall(boolean isChildMall) { | |||||
| this.isChildMall = isChildMall; | |||||
| } | |||||
| } | } | ||||
| @@ -1266,7 +1266,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| if(EnumCouponType.COUPON_DISTRIBUTION.getCode().equals(wxCoupon.getType())){ | if(EnumCouponType.COUPON_DISTRIBUTION.getCode().equals(wxCoupon.getType())){ | ||||
| //可配送商品 | //可配送商品 | ||||
| WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); | WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); | ||||
| wxCouponMerchant.updateTenantInfo(wxCoupon); | |||||
| wxCouponMerchant.updateTenantInfo(bUser); | |||||
| wxCouponMerchant.setProductId(wxCoupon.getId()); | wxCouponMerchant.setProductId(wxCoupon.getId()); | ||||
| wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); | wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); | ||||
| WxCouponMerchant cm = null; | WxCouponMerchant cm = null; | ||||
| @@ -1295,7 +1295,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| throw new MallinkException(ErrorCode.VERIFY_COUPON_TYPE_NOT_SUPPORT); | throw new MallinkException(ErrorCode.VERIFY_COUPON_TYPE_NOT_SUPPORT); | ||||
| } | } | ||||
| WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); | WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); | ||||
| wxCouponMerchant.updateTenantInfo(wxCoupon); | |||||
| wxCouponMerchant.updateTenantInfo(bUser); | |||||
| wxCouponMerchant.setProductId(wxCoupon.getId()); | wxCouponMerchant.setProductId(wxCoupon.getId()); | ||||
| wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); | wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); | ||||
| List<WxCouponMerchant> couponMerchantList = wxCouponMerchantMapper.findList(wxCouponMerchant); | List<WxCouponMerchant> couponMerchantList = wxCouponMerchantMapper.findList(wxCouponMerchant); | ||||
| @@ -1315,7 +1315,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| if(wxPayOrder != null && EnumPayMchType.TOTAL.getCode().equals(wxPayOrder.getMchType()) | if(wxPayOrder != null && EnumPayMchType.TOTAL.getCode().equals(wxPayOrder.getMchType()) | ||||
| && EnumPayShare.YES.getCode().equals(wxPayOrder.getShare())){ | && EnumPayShare.YES.getCode().equals(wxPayOrder.getShare())){ | ||||
| WxProfitSharingReceiver receiver = payServiceFactory.getPayShareAdapterService(wxPayOrder.getPayVendor(),couponOrder.getPayVersion()) | WxProfitSharingReceiver receiver = payServiceFactory.getPayShareAdapterService(wxPayOrder.getPayVendor(),couponOrder.getPayVersion()) | ||||
| .getReceiver(couponOrder, merchantId, wxPayOrder.getTtPayWay(),wxPayOrder.getMchType()); | |||||
| .getReceiver(bUser, merchantId, wxPayOrder.getTtPayWay(),wxPayOrder.getMchType()); | |||||
| if (null == receiver) { | if (null == receiver) { | ||||
| throw new MallinkException(ErrorCode.VERIFY_COUPON_ORDER_MERCHANT_IS_NULL.getCode(),"当前商户没有配置收款账号。"); | throw new MallinkException(ErrorCode.VERIFY_COUPON_ORDER_MERCHANT_IS_NULL.getCode(),"当前商户没有配置收款账号。"); | ||||
| } | } | ||||
| @@ -64,6 +64,7 @@ public class Constant { | |||||
| public static final String APP_Id = "APP_Id"; | public static final String APP_Id = "APP_Id"; | ||||
| public static final String APP_NAME = "APP_NAME"; | public static final String APP_NAME = "APP_NAME"; | ||||
| public static final String APP_INFO = "APPINFO"; | public static final String APP_INFO = "APPINFO"; | ||||
| public static final String IS_CHILD_MALL = "IS_CHILD_MALL"; | |||||
| public static final String LOGIN_B_USER_KEY = "LOGIN_B_USER_KEY"; | public static final String LOGIN_B_USER_KEY = "LOGIN_B_USER_KEY"; | ||||