|
|
|
@@ -94,6 +94,8 @@ public class WxUserGrantController extends BaseController { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private MemCouponFromDspService memCouponFromDspService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxMallService mallService; |
|
|
|
|
|
|
|
/** |
|
|
|
@@ -168,6 +170,8 @@ public class WxUserGrantController extends BaseController { |
|
|
|
if (!wxAuthorizerInfo.getEnable().equals(EnumEnableType.Enable.getCode())) { |
|
|
|
return new ResultData(ErrorCode.APP_ID_NOT_ENABLE); |
|
|
|
} |
|
|
|
|
|
|
|
WxMall wxMall = mallService.getById(Long.valueOf(wxAuthorizerInfo.getTenantId())); |
|
|
|
// 集团版,获取子集团list |
|
|
|
List<WxMall> mallList = null; |
|
|
|
if (wxAuthorizerInfo.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode())) { |
|
|
|
@@ -265,11 +269,16 @@ public class WxUserGrantController extends BaseController { |
|
|
|
request.setAttribute(Constant.LOGIN_USER_KEY, oldUser.getId()); |
|
|
|
request.setAttribute(Constant.TENANT_ID, wxAuthorizerInfo.getTenantId()); |
|
|
|
|
|
|
|
if(StringUtils.isBlank(oldUser.getParentTenantId()) && StringUtils.isNotBlank(wxMall.getParentTenantId())){ |
|
|
|
oldUser.setParentTenantId(wxMall.getParentTenantId()); |
|
|
|
request.setAttribute(Constant.PARENT_TENANT_ID, wxMall.getParentTenantId()); |
|
|
|
} |
|
|
|
|
|
|
|
// 老用户,给出来已选中的mall |
|
|
|
if (mallList != null) { |
|
|
|
WxMall selectedMall = null; |
|
|
|
if (StringUtils.isNotBlank(oldUser.getParentTenantId())) { |
|
|
|
final String lastSubTenant = oldUser.getParentTenantId(); |
|
|
|
final String lastSubTenant = oldUser.getTenantId(); |
|
|
|
List<WxMall> selMallList = mallList.stream().filter(ml -> ml.getTenantId().equalsIgnoreCase(lastSubTenant)).collect(Collectors.toList()); |
|
|
|
if (selMallList.size() > 0) { |
|
|
|
selectedMall = selMallList.get(0); |
|
|
|
@@ -282,9 +291,9 @@ public class WxUserGrantController extends BaseController { |
|
|
|
} |
|
|
|
} |
|
|
|
if (selectedMall != null) { |
|
|
|
request.setAttribute(Constant.PARENT_TENANT_ID, selectedMall.getTenantId()); |
|
|
|
request.setAttribute(Constant.PARENT_TENANT_ID, selectedMall.getParentTenantId()); |
|
|
|
resultMap.put("selectedMall", selectedMall.getTenantId()); |
|
|
|
oldUser.setParentTenantId(selectedMall.getTenantId()); |
|
|
|
oldUser.setParentTenantId(selectedMall.getParentTenantId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@@ -328,6 +337,9 @@ public class WxUserGrantController extends BaseController { |
|
|
|
} else { |
|
|
|
// 新用户 |
|
|
|
newUser.updateTenantInfo(wxAuthorizerInfo); |
|
|
|
if(StringUtils.isNotBlank(wxMall.getParentTenantId())){ |
|
|
|
newUser.setParentTenantId(wxMall.getParentTenantId()); |
|
|
|
} |
|
|
|
token = newUser.createToken(new Date()); |
|
|
|
|
|
|
|
newUser.setRegisterIp(ipaddress); |
|
|
|
|