Commit 4cad4707 by zhiwj

导购bug

parent 356e476a
......@@ -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);
}
......@@ -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();
}
}
......@@ -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