Commit bf2aee61 by guojuxing

共享门店的导购不能编辑,不能转移店长&去掉批量修改状态功能

parent 9cc173e6
......@@ -98,9 +98,7 @@ public class ClerkApiServiceImpl implements ClerkApiService {
if (!paramResult.isSuccess()) {
return paramResult;
}
if (validStoreIsOther(clerkDTO.getEnterpriseId(), clerkDTO.getStoreInfoId())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "权限不足");
}
validStoreIsOther(clerkDTO.getEnterpriseId(), clerkDTO.getStoreInfoId());
// 校验参数
if (StringUtils.isBlank(clerkDTO.getClerkCode())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "导购代码不可为空");
......@@ -199,9 +197,8 @@ public class ClerkApiServiceImpl implements ClerkApiService {
@Override
public ServiceResponse<Void> verifyParam(ClerkDTO clerkDTO) {
if (validStoreIsOther(clerkDTO.getEnterpriseId(), clerkDTO.getStoreInfoId())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "权限不足");
}
validStoreIsOther(clerkDTO.getEnterpriseId(), clerkDTO.getStoreInfoId());
// 校验参数
if (StringUtils.isBlank(clerkDTO.getClerkCode())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "导购代码不可为空");
......@@ -425,12 +422,11 @@ public class ClerkApiServiceImpl implements ClerkApiService {
}
}
private boolean validStoreIsOther(Integer enterpriseId, Integer storeInfoId) {
private void validStoreIsOther(Integer enterpriseId, Integer storeInfoId) {
Integer owner = storeService.getStoreOwnerByStoreInfoId(enterpriseId, storeInfoId);
if (owner == null) {
return false;
if (owner != null && owner == StoreOwnTypeEnum.OTHER.getCode()) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "共享数据不能编辑");
}
return owner == StoreOwnTypeEnum.OTHER.getCode();
}
@Override
......@@ -582,12 +578,19 @@ public class ClerkApiServiceImpl implements ClerkApiService {
List<Integer> clerkIdList;
if (StringUtils.isNotBlank(clerkIds)) {
if (StringUtils.equals(com.gic.store.constant.Constants.ALL, clerkIds)) {
clerkIdList = clerkService.listAllClerkId(enterpriseId);
// 废弃 :clerkIdList = clerkService.listAllClerkId(enterpriseId);
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "批量修改状态功能已废弃");
} else {
String[] split = clerkIds.split(GlobalInfo.FLAG_COMMA);
clerkIdList = Stream.of(split).map(Integer::parseInt).collect(Collectors.toList());
if (clerkIdList.size() > 1) {
throw new CommonException(ErrorCode.PARAMETER_ERROR.getCode(), "批量修改状态功能已废弃");
}
}
List<TabClerk> clerkList = this.clerkService.listClerkByIds(clerkIdList);
//编辑权限验证
validStoreIsOther(clerkList.get(0).getEnterpriseId(), clerkList.get(0).getStoreInfoId());
Map<Integer, TabClerk> clerkIdMap = clerkList.stream().collect(Collectors.toMap(TabClerk::getClerkId, TabClerk -> TabClerk));
//过滤掉默认导购
if(StoreStatusEnum.INONLINE.getCode() == status){
......@@ -894,6 +897,9 @@ public class ClerkApiServiceImpl implements ClerkApiService {
@Override
public ServiceResponse updateClerkLeader(Integer clerkId) {
TabClerk clerk = this.clerkService.getById(clerkId);
validStoreIsOther(clerk.getEnterpriseId(), clerk.getStoreInfoId());
clerk.setPositionId(com.gic.store.constant.Constants.CLERK_LEADER_POSITION_ID);
String positionName = this.clerkPositionService.getByClerkPositionId(clerk.getPositionId()).getPositionName();
clerk.setPositionName(positionName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment