Commit cff242ba by 陶光胜

Merge branch 'developer' into 'master'

Developer

See merge request !16
parents 37ca4cfc fff72a63
......@@ -121,6 +121,8 @@ public interface ClerkApiService {
ServiceResponse<List<ClerkDTO>> listClerkByStoreId(Integer enterpriseId, Integer storeId, String search);
ServiceResponse<List<ClerkDTO>> listClerkByStoreInfoId(Integer enterpriseId, Integer storeInfoId, String search);
/**
* 店长
* @Title: getHeadClerk

......
......@@ -17,4 +17,16 @@ public interface StoreTransferApiService {
* @throws
*/
ServiceResponse<Void> save(Integer enterpriseId, Integer fromStoreId, Integer toStoreId);
/**
* @Title: save
* @Description:
* @author zhiwj
* @param enterpriseId
* @param storeIds
* @param toStoreId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>
* @throws
*/
ServiceResponse<Void> save(Integer enterpriseId, String storeIds, Integer toStoreId);
}
......@@ -455,6 +455,14 @@ public class ClerkApiServiceImpl implements ClerkApiService {
}
@Override
public ServiceResponse<List<ClerkDTO>> listClerkByStoreInfoId(Integer enterpriseId, Integer storeInfoId, String search) {
List<Integer> storeInfoIds = new ArrayList<>();
storeInfoIds.add(storeInfoId);
List<TabClerk> clerkList = this.clerkService.listClerkByStoreInfoId(enterpriseId, storeInfoIds, search);
return ServiceResponse.success(EntityUtil.changeEntityListByJSON(ClerkDTO.class, clerkList));
}
@Override
public ServiceResponse<ClerkDTO> getHeadClerk(Integer enterpriseId, Integer storeId) {
ServiceResponse<StoreDTO> response = storeApiService.getStoreById(enterpriseId, storeId);
if (response.isSuccess() && response.getResult() != null) {
......
......@@ -8,9 +8,14 @@ import com.gic.store.dto.StoreTransferDTO;
import com.gic.store.service.StoreService;
import com.gic.store.service.StoreTransferApiService;
import com.gic.store.service.StoreTransferService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author zhiwj
* @Description:
......@@ -44,4 +49,20 @@ public class StoreTransferApiServiceImpl implements StoreTransferApiService {
return EnterpriseServiceResponse.success();
}
@Override
public ServiceResponse<Void> save(Integer enterpriseId, String storeIds, Integer toStoreId) {
if (StringUtils.isNotBlank(storeIds)) {
List<Integer> storeIdList;
if (StringUtils.equals(storeIds, "all")) {
storeIdList = this.storeService.listAllStoreId(enterpriseId);
} else {
storeIdList = Stream.of(storeIds.split(",")).map(Integer::valueOf).collect(Collectors.toList());
}
for (Integer storeId : storeIdList) {
this.save(enterpriseId, storeId, toStoreId);
}
}
return ServiceResponse.success();
}
}
......@@ -291,7 +291,7 @@ public class ClerkController extends DownloadUtils {
@RequestMapping("/list-clerk-in-store")
public RestResponse listClerkInStore(Integer storeId, String search) {
ServiceResponse<List<ClerkDTO>> serviceResponse = clerkApiService.listClerkByStoreId(UserDetailUtils.getUserDetail().getEnterpriseId(), storeId, search);
ServiceResponse<List<ClerkDTO>> serviceResponse = clerkApiService.listClerkByStoreInfoId(UserDetailUtils.getUserDetail().getEnterpriseId(), storeId, search);
return ResultControllerUtils.commonResult(serviceResponse);
}
......
......@@ -356,22 +356,7 @@ public class StoreController extends DownloadUtils {
if (response.isSuccess()) {
if (type == 1 && toStoreId != null) {
// 如果是批量修改状态 要转移门店
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
storeSearchDTO.setStoreIds(storeIds.replace(',', ' '));
Page<StoreDTO> page = this.storeApiService.listStore(storeSearchDTO, 1, 1000, "storeInfoId").getResult();
if (page == null || page.getResult() == null) {
return EnterpriseRestResponse.failure(ErrorCode.NOTEXISTS);
}
List<String> list = page.getResult().stream().map(e -> e.getStoreInfoId().toString()).collect(Collectors.toList());
Integer storeInfoId = storeApiService.getStoreById(UserDetailUtils.getUserDetail().getEnterpriseId(), toStoreId).getResult().getStoreInfoId();
StoreBatchUpdateDTO storeBatchUpdateDTO = new StoreBatchUpdateDTO();
storeBatchUpdateDTO.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
storeBatchUpdateDTO.setSourceStoreInfoIdList(list);
storeBatchUpdateDTO.setTargetStoreInfoId(storeInfoId + "");
storeBatchUpdateDTO.setUserId(UserDetailUtils.getUserDetail().getUserId());
logger.info("transfer-store-member:{}", JSON.toJSONString(storeBatchUpdateDTO));
this.storeUpdateApiService.storeBatchUpdate(storeBatchUpdateDTO);
ServiceResponse<Void> serviceResponse = storeTransferApiService.save(UserDetailUtils.getUserDetail().getEnterpriseId(), storeIds, toStoreId);
}
// 写日志
String[] storeArr = storeIds.split(",");
......
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