Commit f099dd00 by zhiwj

判断导购在不在某个门店下

parent 1580a9fb
......@@ -153,12 +153,24 @@ public interface ClerkApiService {
* 如果存在返回 门店下 同导购code 的 clerkId ,如果不存在,新建导购,返回新建的导购i
* @author zhiwj
* @param clerkId
* @param storeId
* @param storeInfoId
* @param enterpriseId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Integer> addClerkToOtherStore(Integer clerkId, Integer storeInfoId, Integer enterpriseId);
/**
* @Title: ensureClerkInStore
* @Description:
* @author zhiwj
* @param clerkId
* @param storeInfoId
* @param enterpriseId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Integer> addClerkToOtherStore(Integer clerkId, Integer storeId, Integer enterpriseId);
ServiceResponse<Boolean> ensureClerkInStore(Integer clerkId, Integer storeInfoId, Integer enterpriseId);
/**
* @Title: listClerkByStoreBrand
......
......@@ -576,13 +576,13 @@ public class ClerkApiServiceImpl implements ClerkApiService {
}
@Override
public ServiceResponse<Integer> addClerkToOtherStore(Integer clerkId, Integer storeId, Integer enterpriseId) {
logger.info("clerkId:{}, storeId:{}, enterpriseId:{}", clerkId, storeId, enterpriseId);
public ServiceResponse<Integer> addClerkToOtherStore(Integer clerkId, Integer storeInfoId, Integer enterpriseId) {
logger.info("clerkId:{}, storeInfoId:{}, enterpriseId:{}", clerkId, storeInfoId, enterpriseId);
TabClerk clerk = this.clerkService.getById(clerkId);
if (clerk == null) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS.getCode(), "导购不存在");
}
StoreDTO store = this.storeApiService.getStoreById(enterpriseId, storeId).getResult();
StoreDTO store = this.storeApiService.getStoreByStoreInfoId(enterpriseId, storeInfoId).getResult();
if (store == null) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS.getCode(), "门店不存在");
}
......@@ -604,6 +604,26 @@ public class ClerkApiServiceImpl implements ClerkApiService {
}
@Override
public ServiceResponse<Boolean> ensureClerkInStore(Integer clerkId, Integer storeInfoId, Integer enterpriseId) {
logger.info("clerkId:{}, storeInfoId:{}, enterpriseId:{}", clerkId, storeInfoId, enterpriseId);
TabClerk clerk = this.clerkService.getById(clerkId);
if (clerk == null) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS.getCode(), "导购不存在", Boolean.FALSE);
}
StoreDTO store = this.storeApiService.getStoreById(enterpriseId, storeInfoId).getResult();
if (store == null) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS.getCode(), "门店不存在", Boolean.FALSE);
}
if (clerk.getStoreInfoId().equals(store.getStoreInfoId())) {
logger.info("导购[clerkId:{}]已存在门店[storeId:{}, storeInfoId:{}]下", clerkId, store.getStoreId(), store.getStoreInfoId());
return EnterpriseServiceResponse.success(Boolean.TRUE);
} else {
logger.info("导购[clerkId:{}]不存在门店[storeId:{}, storeInfoId:{}]下", clerkId, store.getStoreId(), store.getStoreInfoId());
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS.getCode(), "导购不存在该门店下", Boolean.FALSE);
}
}
@Override
public ServiceResponse<List<ClerkDTO>> listClerkByStoreBrand(Integer enterpriseId, Integer storeBrandId, String clerkName) {
StoreSearchDBDTO storeSearchDBDTO = new StoreSearchDBDTO();
storeSearchDBDTO.setEnterpriseId(enterpriseId);
......
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