Commit 525cf4e5 by zhiwj

添加导购

parent adaf4bad
......@@ -110,20 +110,10 @@ public interface ClerkApiService {
ServiceResponse<String> importClerkForOperation(ProcessBatchClerkDTO clerkInfo);
/**
* @Title: existClerkInStore
* @Description: 判断导购在不在某个门店下
* @author zhiwj
* @param clerkId
* @param storeId
* @param enterpriseId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Boolean> existClerkInStore(Integer clerkId, Integer storeId, Integer enterpriseId);
/**
* @Title: addClerkToOtherStore
* @Description: 将同样导购的信息添加到另一个门店下
* 入参 storeId clerkId enterpriseId 判断该导购是否与该门店存在关联,
* 如果存在返回 门店下 同导购code 的 clerkId ,如果不存在,新建导购,返回新建的导购i
* @author zhiwj
* @param clerkId
* @param storeId
......@@ -131,5 +121,5 @@ public interface ClerkApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Void> addClerkToOtherStore(Integer clerkId, Integer storeId, Integer enterpriseId);
ServiceResponse<Integer> addClerkToOtherStore(Integer clerkId, Integer storeId, Integer enterpriseId);
}
......@@ -419,14 +419,31 @@ public class ClerkApiServiceImpl implements ClerkApiService {
}
@Override
public ServiceResponse<Boolean> existClerkInStore(Integer clerkId, Integer storeId, Integer enterpriseId) {
return null;
}
@Override
public ServiceResponse<Void> addClerkToOtherStore(Integer clerkId, Integer storeId, Integer enterpriseId) {
return null;
public ServiceResponse<Integer> addClerkToOtherStore(Integer clerkId, Integer storeId, Integer enterpriseId) {
logger.info("clerkId:{}, storeId:{}, enterpriseId:{}", clerkId, storeId, enterpriseId);
TabClerk clerk = this.clerkService.getById(clerkId);
if (clerk == null) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS.getCode(), "导购不存在");
}
StoreDTO store = this.storeApiService.getStoreById(enterpriseId, storeId).getResult();
if (store == null) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS.getCode(), "门店不存在");
}
if (clerk.getStoreInfoId().equals(store.getStoreInfoId())) {
logger.info("导购[clerkId:{}]已存在门店[storeId:{}, storeInfoId:{}]下", clerkId, store.getStoreId(), store.getStoreInfoId());
return EnterpriseServiceResponse.success(clerkId);
}
ClerkDTO clerkDTO = EntityUtil.changeEntityByJSON(ClerkDTO.class, clerk);
clerkDTO.setClerkId(null);
clerkDTO.setStoreInfoId(store.getStoreInfoId());
ServiceResponse<Integer> clerkResp = this.saveOrUpdate(clerkDTO);
if (clerkResp.isSuccess()) {
logger.info("导购[clerkId:{}]不存在门店[storeId:{}, storeInfoId:{}]下, 新增clerkId:{}", clerkId, store.getStoreId(), store.getStoreInfoId(), clerkResp.getResult());
return EnterpriseServiceResponse.success(clerkResp.getResult());
} else {
logger.info("保存导购失败:{}", clerkResp.getMessage());
return EnterpriseServiceResponse.failure(clerkResp.getCode(), clerkResp.getMessage());
}
}
private static ServiceResponse<String> responseErrorElement(ImportClerkBatchResultEnum error) {
......
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