feat:加盟部只能新建加盟店或者联营店
This commit is contained in:
@@ -312,6 +312,7 @@ public enum ErrorCodeEnum {
|
||||
|
||||
NOT_FLAGSHIP_STORE(16100005,"非直营店,无法跳过缴费阶段!",null),
|
||||
NOT_FLAGSHIP_STORE_NOT_EXIST(16100006,"当前阶段加盟类型不能变更!",null),
|
||||
JOIN_MODE_NOT_ALLOW_OPERATE(16100007,"加盟部人员只能新建加盟店或联营店,请确认!",null),
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -38,4 +38,10 @@ public enum JoinModeEnum {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 是否是加盟部加盟店或者联营店 如果不是 返回false
|
||||
*/
|
||||
public static boolean isFranchise(Integer code) {
|
||||
return code == FRANCHISE_DEPARTMENT.code || code == AFFILIATES.code;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,4 +22,11 @@ public interface EnterpriseService {
|
||||
* 获取并缓存refreshToken
|
||||
*/
|
||||
RefreshUser getRefreshUser(String userId, String mobile);
|
||||
|
||||
/**
|
||||
* 校验用户新建分店/新建线索 可以选择加盟类型类型
|
||||
* @param userId
|
||||
* @param joinMode
|
||||
*/
|
||||
void checkUser(String userId,Integer joinMode);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.cool.store.dao.EnterpriseUserDAO;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.entity.SysRoleDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.JoinModeEnum;
|
||||
import com.cool.store.enums.Role;
|
||||
import com.cool.store.enums.UserStatusEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
@@ -126,6 +127,22 @@ public class EnterpriseServiceImpl implements EnterpriseService {
|
||||
return refreshUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkUser(String userId,Integer joinMode) {
|
||||
EnterpriseUserDO userInfo = enterpriseUserDAO.getUserInfoById(userId);
|
||||
if (userInfo !=null){
|
||||
//校验当前人员是否是加盟部 581
|
||||
String departments = userInfo.getDepartments();
|
||||
//如果departments包含/581/ 加盟部
|
||||
if (com.cool.store.utils.poi.StringUtils.isNotBlank(departments) && departments.contains("/581/")) {
|
||||
//加盟部 FRANCHISE_COMPANIES
|
||||
if (!JoinModeEnum.isFranchise(joinMode)){
|
||||
throw new ServiceException(ErrorCodeEnum.JOIN_MODE_NOT_ALLOW_OPERATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
System.out.println(DateUtils.parseDate("2024-05-09 18:54:28",DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||
|
||||
@@ -88,6 +88,8 @@ public class LineServiceImpl implements LineService {
|
||||
private RegionQrcodeConfigDao regionQrcodeConfigDao;
|
||||
@Resource
|
||||
QualificationsInfoDAO qualificationsInfoDAO;
|
||||
@Resource
|
||||
EnterpriseService enterpriseService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -514,6 +516,7 @@ public class LineServiceImpl implements LineService {
|
||||
public Boolean addLine(AddLineRequest addLineRequest, LoginUserInfo userInfo) {
|
||||
//必填参数
|
||||
log.info("addLine:{}", JSONObject.toJSONString(addLineRequest));
|
||||
enterpriseService.checkUser(userInfo.getUserId(), addLineRequest.getJoinMode());
|
||||
if (!StringUtil.isNoneBlank(addLineRequest.getMobile(), addLineRequest.getUserName())) {
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
|
||||
}
|
||||
|
||||
@@ -110,6 +110,8 @@ public class ShopServiceImpl implements ShopService {
|
||||
DecorationDesignInfoDAO decorationDesignInfoDAO;
|
||||
@Resource
|
||||
StoreService storeService;
|
||||
@Resource
|
||||
EnterpriseService enterpriseService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -330,6 +332,7 @@ public class ShopServiceImpl implements ShopService {
|
||||
if (StringUtils.isBlank(request.getInvestmentManagerUserId())) {
|
||||
request.setInvestmentManagerUserId(userId);
|
||||
}
|
||||
enterpriseService.checkUser(userId, request.getJoinMode());
|
||||
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
|
||||
if (lineInfo.getWorkflowSubStageStatus() < WorkflowSubStageStatusEnum.PAY_DEPOSIT_45.getCode()) {
|
||||
throw new ServiceException(ErrorCodeEnum.LINE_STATUS_NOT_ALLOW_OPERATE);
|
||||
|
||||
Reference in New Issue
Block a user