Commit 27f20da5 by zhiwj

门店代码修改

parent a58f3106
......@@ -43,7 +43,7 @@ public class StoreBusinessTimeServiceImpl implements StoreBusinessTimeService {
TabStoreBusinessTime businessTime = new TabStoreBusinessTime();
businessTime.setStoreBusinessTimeId(storeBusinessTimeDTO.getStoreBusinessTimeId());
if (StringUtils.isNotBlank(storeBusinessTimeDTO.getWeekday())) {
String weekday = Stream.of(storeBusinessTimeDTO.getWeekday().split(GlobalInfo.FLAG_COMMA)).sorted().reduce((x, y) -> x + GlobalInfo.FLAG_COMMA + y).get();
String weekday = Stream.of(storeBusinessTimeDTO.getWeekday().split(GlobalInfo.FLAG_COMMA)).sorted().collect(Collectors.joining(","));
businessTime.setWeekday(weekday);
}
businessTime.setOpenTime(storeBusinessTimeDTO.getOpenTime());
......
......@@ -495,7 +495,7 @@ public class StoreServiceImpl implements StoreService {
public String listStoreInfoIdByStoreIds(String storeIds, Integer enterpriseId) {
List<Integer> list = Stream.of(storeIds.split(GlobalInfo.FLAG_COMMA)).map(Integer::valueOf).collect(Collectors.toList());
List<Integer> ids = tabStoreMapper.listStoreInfoIdByStoreIds(list, enterpriseId);
return Optional.ofNullable(ids).orElse(Collections.emptyList()).stream().map(String::valueOf).reduce((x,y)-> x + GlobalInfo.FLAG_COMMA + y).orElse("");
return Optional.ofNullable(ids).orElse(Collections.emptyList()).stream().map(String::valueOf).collect(Collectors.joining(","));
}
@Override
......
......@@ -424,8 +424,7 @@ public class ClerkApiServiceImpl implements ClerkApiService {
storeSearchDBDTO.setStoreInfoIdList(storeInfoIdsBySearch);
storeSearchDBDTO.setSearch(search);
List<StoreDTO> dtos = storeService.listStore(storeSearchDBDTO, 1, Integer.MAX_VALUE);
return Optional.ofNullable(dtos).orElse(Collections.emptyList()).stream().map(e -> e.getStoreId().toString())
.reduce((x, y) -> x + " " + y).orElse("");
return Optional.ofNullable(dtos).orElse(Collections.emptyList()).stream().map(e -> e.getStoreId().toString()).collect(Collectors.joining(" "));
}
......@@ -678,7 +677,7 @@ public class ClerkApiServiceImpl implements ClerkApiService {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS);
}
// list 如果太大, 让 mybatis 解析 会打满内存
String storeInfoIds = list.stream().map(e -> e.getStoreInfoId().toString()).reduce((x, y) -> x + "," + y).get();
String storeInfoIds = list.stream().map(e -> e.getStoreInfoId().toString()).collect(Collectors.joining(","));
storeInfoIds = "(" + storeInfoIds + ")";
List<TabClerk> clerkList = this.clerkService.listClerkByStoreInfoId(enterpriseId, storeInfoIds, clerkName);
List<ClerkDTO> dtoList = EntityUtil.changeEntityListByJSON(ClerkDTO.class, clerkList);
......
......@@ -426,15 +426,14 @@ public class StoreApiServiceImpl implements StoreApiService {
this.storeBusinessTimeService.convertBusinessTime(newStore.getBusinessTimeList());
String newBusinessTimeShow = newStore.getBusinessTimeList().stream()
.map(e -> e.getWeekdayShow() + ":" + DateUtil.dateToStr(e.getOpenTime(), DateUtil.FORMAT_MINUTE_TIME) + "~" + DateUtil.dateToStr(e.getCloseTime(), DateUtil.FORMAT_MINUTE_TIME))
.reduce((x, y) -> x + "," + y)
.orElse("");
.collect(Collectors.joining(","));
sb.append("营业时间").append("变更为【").append(newBusinessTimeShow).append("】");
}
}
}
if (StringUtils.isNotBlank(newStore.getBrandIds()) && !StringUtils.equals(newStore.getBrandIds(), oldStore.getBrandIds())) {
List<TabStoreBrand> tabStoreBrands = this.storeBrandService.listStoreBrandByIds(newStore.getBrandIds());
String storeBrandShow = tabStoreBrands.stream().map(TabStoreBrand::getStoreBrandName).reduce((x, y) -> x + "," + y).orElse("");
String storeBrandShow = tabStoreBrands.stream().map(TabStoreBrand::getStoreBrandName).collect(Collectors.joining(","));;
sb.append("门店品牌").append("变更为【").append(storeBrandShow).append("】");
}
if (StringUtils.isNotBlank(newStore.getAddress()) && !StringUtils.equals(newStore.getAddress(), oldStore.getAddress())) {
......
......@@ -106,7 +106,7 @@ public class StoreBrandApiServiceImpl implements StoreBrandApiService {
if (CollectionUtils.isEmpty(storeBrandList)) {
return ServiceResponse.success();
}
String ids = storeBrandList.stream().map(e -> e.getStoreBrandId().toString()).reduce((x, y) -> x + GlobalInfo.FLAG_COMMA + y).get();
String ids = storeBrandList.stream().map(e -> e.getStoreBrandId().toString()).collect(Collectors.joining(","));
return this.deleteByIds(enterpriseId, ids);
}
......
......@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @author zhiwj
......@@ -283,7 +284,7 @@ public class StoreTaskServiceImpl extends AbstractTaskAllocationOperation implem
return false;
})
.map(e -> e.getStoreFieldSelectId() + "")
.reduce((x, y) -> x + GlobalInfo.FLAG_COMMA + y).get();
.collect(Collectors.joining(","));
storeExtendDTO.setValue(newValue);
}
}
......
......@@ -95,8 +95,7 @@ public class StoreBrandController {
.orElse(Collections.emptyList())
.stream()
.map(StoreBrandDTO::getStoreBrandName)
.reduce((x, y) -> x + "," + y)
.orElse("");
.collect(Collectors.joining(","));
LogUtils.createLog("删除门店品牌", logName);
}
return RestResponse.success(serviceResponse.getResult());
......
......@@ -393,7 +393,7 @@ public class StoreController extends DownloadUtils {
if (page != null && CollectionUtils.isNotEmpty(page.getResult())) {
List<StoreDTO> storeList = page.getResult();
if (CollectionUtils.isNotEmpty(storeList)) {
String storeName = storeList.stream().map(StoreDTO::getStoreName).reduce((x, y) -> x + "," + y).get();
String storeName = storeList.stream().map(StoreDTO::getStoreName).collect(Collectors.joining(","));
if (storeArr.length > 3) {
storeName += "等" + storeArr.length + "家门店";
}
......
......@@ -32,6 +32,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author zhiwj
......@@ -539,7 +540,7 @@ public class StoreImportController {
if (response.isSuccess()) {
List<String> brandList = response.getResult();
if (CollectionUtils.isNotEmpty(brandList)) {
String error = brandList.stream().reduce((x, y) -> x + " " + y).get();
String error = brandList.stream().collect(Collectors.joining(","));
return "品牌 " + error + " 不存在";
}
return null;
......
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