Kaynağa Gözat

//

release_toaliyun_real
xhxu 3 yıl önce
ebeveyn
işleme
7ce94b3800
9 değiştirilmiş dosya ile 112 ekleme ve 19 silme
  1. +14
    -6
      mallinkBApi/src/main/java/com/iformall/controller/WxMerchantBUserController.java
  2. +11
    -2
      mallinkBApi/src/main/java/com/iformall/controller/WxMsgValidationcodeController.java
  3. +1
    -1
      mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java
  4. +3
    -0
      mallinkService/src/main/java/com/iformall/service/WxMallService.java
  5. +5
    -2
      mallinkService/src/main/java/com/iformall/service/WxMerchantBUserService.java
  6. +2
    -0
      mallinkService/src/main/java/com/iformall/service/WxMerchantService.java
  7. +11
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxMallServiceImpl.java
  8. +54
    -8
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantBUserServiceImpl.java
  9. +11
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java

+ 14
- 6
mallinkBApi/src/main/java/com/iformall/controller/WxMerchantBUserController.java Dosyayı Görüntüle

@@ -160,11 +160,11 @@ public class WxMerchantBUserController extends BaseController {
} }


WxMerchantBUser userQ = new WxMerchantBUser(); WxMerchantBUser userQ = new WxMerchantBUser();
// userQ.updateTenantInfo(wxAppinfo);
userQ.setAppId(appId);
userQ.updateTenantInfo(wxAppinfo);
// userQ.setAppId(appId);
userQ.setPhone(phone); userQ.setPhone(phone);
userQ.setStatus(EnumMerchantBUserStatus.VALID.getCode()); userQ.setStatus(EnumMerchantBUserStatus.VALID.getCode());
List<WxMerchantBUser> orgList = wxMerchantBUserService.getBUserByAppId(userQ);
List<WxMerchantBUser> orgList = wxMerchantBUserService.findAllList(userQ);


if (orgList.size() == 1) { if (orgList.size() == 1) {
// 集团内只发现一个用户 // 集团内只发现一个用户
@@ -201,7 +201,7 @@ public class WxMerchantBUserController extends BaseController {
// check password // check password
if (orgUser.getUserPwd().equalsIgnoreCase(password)) { if (orgUser.getUserPwd().equalsIgnoreCase(password)) {
// 返回多个(商场+商户) // 返回多个(商场+商户)
List<WxMerchantBuInfoVo> merchantListInfo = wxMerchantBUserService.getMerchantInfoByBUser(userQ);
List<WxMerchantBuInfoVo> merchantListInfo = wxMerchantBUserService.handMerchantBUser(orgList);
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
resultMap.put("merchantList", merchantListInfo); resultMap.put("merchantList", merchantListInfo);
resultMap.put("logined", false); resultMap.put("logined", false);
@@ -242,7 +242,7 @@ public class WxMerchantBUserController extends BaseController {
WxMerchantBUser userQ = new WxMerchantBUser(); WxMerchantBUser userQ = new WxMerchantBUser();
userQ.setId(Long.valueOf(buUserIdStr)); userQ.setId(Long.valueOf(buUserIdStr));
userQ.setMerchantId(Long.valueOf(merchantIdStr)); userQ.setMerchantId(Long.valueOf(merchantIdStr));
List<WxMerchantBUser> orgList = wxMerchantBUserService.getBUserByAppId(userQ);
List<WxMerchantBUser> orgList = wxMerchantBUserService.findList(userQ);
if (orgList.size() == 1) { if (orgList.size() == 1) {
WxMerchantBUser orgUser = orgList.get(0); WxMerchantBUser orgUser = orgList.get(0);
if (orgUser != null) { if (orgUser != null) {
@@ -301,6 +301,14 @@ public class WxMerchantBUserController extends BaseController {
if (StringUtils.isBlank(appId)) { if (StringUtils.isBlank(appId)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "appId不能为空"); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "appId不能为空");
} }
WxAppinfo wxAppinfo = getAppInfo(appId);
if(wxAppinfo == null){
return new ResultData(ErrorCode.APP_ID_NOT_FOUND);
}
if(!wxAppinfo.getEnable().equals(EnumEnableType.Enable.getCode())){
return new ResultData(ErrorCode.APP_ID_NOT_ENABLE);
}

if (StringUtils.isBlank(phone)) { if (StringUtils.isBlank(phone)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号不能为空"); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号不能为空");
} }
@@ -310,7 +318,7 @@ public class WxMerchantBUserController extends BaseController {
if (StringUtils.isBlank(pwd)) { if (StringUtils.isBlank(pwd)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "密码不能为空"); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "密码不能为空");
} }
return wxMerchantBUserService.updatePwd(appId, phone, code, pwd);
return wxMerchantBUserService.updatePwd(wxAppinfo.getTenantId(), phone, code, pwd);
} }


} }

+ 11
- 2
mallinkBApi/src/main/java/com/iformall/controller/WxMsgValidationcodeController.java Dosyayı Görüntüle

@@ -3,6 +3,7 @@ package com.iformall.controller;
import com.iformall.annotation.TenantIgnore; import com.iformall.annotation.TenantIgnore;
import com.iformall.common.ErrorCode; import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData; import com.iformall.common.ResultData;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxMerchantBUser; import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.domain.po.WxMsgValidationcode; import com.iformall.domain.po.WxMsgValidationcode;
@@ -46,12 +47,20 @@ public class WxMsgValidationcodeController extends BaseController {
@ApiImplicitParam(name = "appid", value = "appid", dataType = "String", paramType = "query", required = true)}) @ApiImplicitParam(name = "appid", value = "appid", dataType = "String", paramType = "query", required = true)})
public ResultData sendvalidationcode(String phone, String type, String appid) { public ResultData sendvalidationcode(String phone, String type, String appid) {


WxAppinfo wxAppinfo = getAppInfo(appid);
if(wxAppinfo == null){
return new ResultData(ErrorCode.APP_ID_NOT_FOUND);
}
if(!wxAppinfo.getEnable().equals(EnumEnableType.Enable.getCode())){
return new ResultData(ErrorCode.APP_ID_NOT_ENABLE);
}

WxMerchantBUser userQ = new WxMerchantBUser(); WxMerchantBUser userQ = new WxMerchantBUser();
userQ.setAppId(appid);
userQ.updateTenantInfo(wxAppinfo);
userQ.setPhone(phone); userQ.setPhone(phone);
userQ.setStatus(EnumMerchantBUserStatus.VALID.getCode()); userQ.setStatus(EnumMerchantBUserStatus.VALID.getCode());


List<WxMerchantBUser> orgUserList = wxMerchantBUserService.getBUserByAppId(userQ);
List<WxMerchantBUser> orgUserList = wxMerchantBUserService.findList(userQ);
if (orgUserList.size() <= 0) { if (orgUserList.size() <= 0) {
logger.error("B端用户不存在, phone: " + phone); logger.error("B端用户不存在, phone: " + phone);
return new ResultData(ErrorCode.USER_IS_EMPTY); return new ResultData(ErrorCode.USER_IS_EMPTY);


+ 1
- 1
mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java Dosyayı Görüntüle

@@ -109,7 +109,7 @@ public class PosServiceImpl implements PosService {
List<WxMerchantBUser> orgUserList = null; List<WxMerchantBUser> orgUserList = null;


try { try {
orgUserList = merchantBUserService.getBUserByAppId(userQ);
orgUserList = merchantBUserService.findList(userQ);
} catch (Exception e) { } catch (Exception e) {
String errMessage = ErrorCode.MERCHANT_BUSER_NOT_VALID.getMessage() + "phone: " + phone + ", " +e.getMessage(); String errMessage = ErrorCode.MERCHANT_BUSER_NOT_VALID.getMessage() + "phone: " + phone + ", " +e.getMessage();
throw new MallinkException(ErrorCode.MERCHANT_BUSER_NOT_VALID.getCode(), errMessage); throw new MallinkException(ErrorCode.MERCHANT_BUSER_NOT_VALID.getCode(), errMessage);


+ 3
- 0
mallinkService/src/main/java/com/iformall/service/WxMallService.java Dosyayı Görüntüle

@@ -7,6 +7,7 @@ import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.WxMall; import com.iformall.domain.po.WxMall;


import java.util.List; import java.util.List;
import java.util.Map;


public interface WxMallService { public interface WxMallService {


@@ -93,4 +94,6 @@ public interface WxMallService {
boolean mallValid(Long loginUserId,WxMall mall); boolean mallValid(Long loginUserId,WxMall mall);


boolean isgroupSupport(TenantEntity tenantEntity); boolean isgroupSupport(TenantEntity tenantEntity);

Map<String, WxMall> getMallMap(WxMall mallQ);
} }

+ 5
- 2
mallinkService/src/main/java/com/iformall/service/WxMerchantBUserService.java Dosyayı Görüntüle

@@ -43,7 +43,7 @@ public interface WxMerchantBUserService {
* @param record * @param record
* @return * @return
*/ */
List<WxMerchantBUser> getBUserByAppId(WxMerchantBUser record);
List<WxMerchantBUser> findList(WxMerchantBUser record);


List<WxMerchantBuInfoVo> getMerchantInfoByBUser(WxMerchantBUser record); List<WxMerchantBuInfoVo> getMerchantInfoByBUser(WxMerchantBUser record);


@@ -64,6 +64,9 @@ public interface WxMerchantBUserService {


boolean hasPhone(TenantEntity tenantEntity, String phone); boolean hasPhone(TenantEntity tenantEntity, String phone);


ResultData updatePwd(String appId, String phone, String code, String pwd);
ResultData updatePwd(String tenantId, String phone, String code, String pwd);


List<WxMerchantBUser> findAllList(WxMerchantBUser userQ);

List<WxMerchantBuInfoVo> handMerchantBUser(List<WxMerchantBUser> orgList);
} }

+ 2
- 0
mallinkService/src/main/java/com/iformall/service/WxMerchantService.java Dosyayı Görüntüle

@@ -205,4 +205,6 @@ public interface WxMerchantService {
WxMerchant findAdmin(TenantEntity tenantEntity); WxMerchant findAdmin(TenantEntity tenantEntity);


WxMerchant findBrandAdmin(TenantEntity tenantEntity, Long brandId); WxMerchant findBrandAdmin(TenantEntity tenantEntity, Long brandId);

Map<Long, WxMerchant> findMerchantMap(WxMerchant merchantQ);
} }

+ 11
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxMallServiceImpl.java Dosyayı Görüntüle

@@ -34,6 +34,7 @@ import org.springframework.util.Assert;


import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;


@Service @Service
@@ -397,4 +398,14 @@ public class WxMallServiceImpl implements WxMallService {
return false; return false;
} }


@Override
public Map<String, WxMall> getMallMap(WxMall mallQ) {
Map<String,WxMall> mallMap = new HashMap<>();
List<WxMall> list = this.findList(mallQ);
if(!list.isEmpty()){
mallMap = list.stream().collect(Collectors.toMap(WxMall::getTenantId, Function.identity()));
}
return mallMap;
}

} }

+ 54
- 8
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantBUserServiceImpl.java Dosyayı Görüntüle

@@ -6,10 +6,7 @@ import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode; import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker; import com.iformall.common.IdWorker;
import com.iformall.common.ResultData; import com.iformall.common.ResultData;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.domain.po.WxMsgValidationcode;
import com.iformall.domain.po.*;
import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxMerchantBuInfoVo; import com.iformall.domain.vo.WxMerchantBuInfoVo;
import com.iformall.enums.EnumMerchantBUserStatus; import com.iformall.enums.EnumMerchantBUserStatus;
@@ -21,6 +18,7 @@ import com.iformall.mapper.WxMerchantMapper;
import com.iformall.mapper.WxMsgValidationcodeMapper; import com.iformall.mapper.WxMsgValidationcodeMapper;
import com.iformall.service.WxMallService; import com.iformall.service.WxMallService;
import com.iformall.service.WxMerchantBUserService; import com.iformall.service.WxMerchantBUserService;
import com.iformall.service.WxMerchantService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -43,6 +41,9 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService {
@Autowired @Autowired
WxAppinfoMapper wxAppinfoMapper; WxAppinfoMapper wxAppinfoMapper;


@Autowired
WxMerchantService wxMerchantService;

@Autowired @Autowired
WxMerchantMapper wxMerchantMapper; WxMerchantMapper wxMerchantMapper;


@@ -99,7 +100,7 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService {
} }


@Override @Override
public List<WxMerchantBUser> getBUserByAppId(WxMerchantBUser record) {
public List<WxMerchantBUser> findList(WxMerchantBUser record) {
return wxMerchantBUserMapper.findList(record); return wxMerchantBUserMapper.findList(record);
} }


@@ -148,9 +149,10 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService {
} }


@Override @Override
public ResultData updatePwd(String appId, String phone, String code, String pwd) {
public ResultData updatePwd(String tenantId, String phone, String code, String pwd) {


WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode();
wxMsgValidationcode.setTenantId(tenantId);
wxMsgValidationcode.setPhone(phone); wxMsgValidationcode.setPhone(phone);
wxMsgValidationcode.setCode(code); wxMsgValidationcode.setCode(code);
List<WxMsgValidationcode> msgValidationCodeList = wxMsgValidationcodeMapper.findList(wxMsgValidationcode); List<WxMsgValidationcode> msgValidationCodeList = wxMsgValidationcodeMapper.findList(wxMsgValidationcode);
@@ -160,10 +162,10 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService {
if (msgValidationCodeList.size() > 0) { if (msgValidationCodeList.size() > 0) {
//更新 //更新
WxMerchantBUser bUser = new WxMerchantBUser(); WxMerchantBUser bUser = new WxMerchantBUser();
bUser.setAppId(appId);
bUser.setTenantId(tenantId);
bUser.setPhone(phone); bUser.setPhone(phone);
bUser.setStatus(EnumMerchantBUserStatus.VALID.getCode()); bUser.setStatus(EnumMerchantBUserStatus.VALID.getCode());
List<WxMerchantBUser> list = wxMerchantBUserMapper.findList(bUser);
List<WxMerchantBUser> list = this.findAllList(bUser);
if (list.size() > 0) { if (list.size() > 0) {
for (WxMerchantBUser merchantBUser:list) { for (WxMerchantBUser merchantBUser:list) {
merchantBUser.setUserPwd(pwd); merchantBUser.setUserPwd(pwd);
@@ -182,5 +184,49 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService {
return new ResultData(); return new ResultData();
} }


@Override
public List<WxMerchantBUser> findAllList(WxMerchantBUser userQ) {
if(StringUtils.isBlank(userQ.getTenantId())){
return new ArrayList<>();
}
List<WxMerchantBUser> list = this.findList(userQ);
if(wxMallService.isgroupSupport(userQ)){
userQ.setTenantId(null);
userQ.setParentTenantId(userQ.getTenantId());
List<WxMerchantBUser> list1 = wxMerchantBUserMapper.findList(userQ);
if(list1.size() > 0){
list.addAll(list1);
}
}
return list;
}

@Override
public List<WxMerchantBuInfoVo> handMerchantBUser(List<WxMerchantBUser> orgList) {
List<String> tenantIds = orgList.stream().map(mb -> mb.getTenantId()).collect(Collectors.toList());
WxMall mallQ = new WxMall();
mallQ.setTenantIdList(tenantIds);
Map<String,WxMall> mallMap = wxMallService.getMallMap(mallQ);
List<Long> merchantIds = orgList.stream().map(mb -> mb.getMerchantId()).collect(Collectors.toList());
WxMerchant merchantQ = new WxMerchant();
merchantQ.setIds(merchantIds);
Map<Long,WxMerchant> merchantMap = wxMerchantService.findMerchantMap(merchantQ);

List<WxMerchantBuInfoVo> listvo = new ArrayList<>();
for (WxMerchantBUser bUser:orgList) {
WxMerchantBuInfoVo mbvo = new WxMerchantBuInfoVo();
WxMall wxMall = mallMap.get(mbvo.getTenantId());
mbvo.updateTenantInfo(wxMall);
mbvo.setTenantName(wxMall.getName());
mbvo.setMerchantId(mbvo.getMerchantId());
WxMerchant merchant = merchantMap.get(mbvo.getMerchantId());
mbvo.setMerchantName(merchant.getName());
mbvo.setImgUrl(merchant.getImgUrl());
mbvo.setBuUserId(bUser.getId());
listvo.add(mbvo);
}
return listvo;
}



} }

+ 11
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java Dosyayı Görüntüle

@@ -39,6 +39,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;


/** /**
@@ -1911,4 +1912,14 @@ public class WxMerchantServiceImpl implements WxMerchantService {
} }
return null; return null;
} }

@Override
public Map<Long, WxMerchant> findMerchantMap(WxMerchant merchantQ) {
Map<Long,WxMerchant> merchantMap = new HashMap<>();
List<WxMerchant> list = this.findList(merchantQ);
if(!list.isEmpty()){
merchantMap = list.stream().collect(Collectors.toMap(WxMerchant::getId, Function.identity()));
}
return merchantMap;
}
} }

Yükleniyor…
İptal
Kaydet