Commit 183f69b0 by guojuxing

新建门店状态策略属性条件排序-代码优化

parent 72f52a29
......@@ -2,6 +2,8 @@ package com.gic.store.web.controller;
import java.util.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.download.utils.OperationResultUtils;
import com.gic.enterprise.service.EnterpriseInitApiService;
import org.apache.commons.lang3.StringUtils;
......@@ -58,8 +60,12 @@ public class StoreStrategyController {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "regionId:门店域ID不能为空");
}
//有序
Map<String, String> result = new LinkedHashMap<>(16);
List<Map<String, String>> result = new ArrayList<>(16);
Arrays.stream(StrategyStoreFieldEnum.values()).forEach(e -> {
Map<String, String> temp = new HashMap<>(2);
temp.put(e.getCode(), e.getMessage());
result.add(temp);
});
//单选或者多选的,也需要
ServiceResponse<List<StoreFieldDTO>> storeFieldDTOServiceResponse = storeFieldApiService
.listStoreFieldByRegionId(regionId);
......@@ -70,10 +76,11 @@ public class StoreStrategyController {
.filter(e -> e != null)
.filter(e -> e.getStoreFieldType().intValue() == StoreFieldTypeEnum.RADIO.getCode()
|| e.getStoreFieldType().intValue() == StoreFieldTypeEnum.CHECK.getCode())
.forEach(e -> result.put(e.getStoreFieldId().toString(), e.getStoreFieldName()));
}
for (StrategyStoreFieldEnum fieldEnum : StrategyStoreFieldEnum.values()) {
result.put(fieldEnum.getCode(), fieldEnum.getMessage());
.forEach(e -> {
Map<String, String> temp = new HashMap<>(2);
temp.put(e.getStoreFieldId().toString(), e.getStoreFieldName());
result.add(temp);
});
}
return RestResponse.success(result);
}
......
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