Commit c592cbd0 authored by 赵啸非's avatar 赵啸非

添加材料列表根据材料名称去重

parent f02dab53
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
public enum LimitStrategyEnum {
不限流(0, "不限流"),
一万次日(1, "10000次/日"),
一千次日(2, "1000次/日"),
一百次日(3, "100次/日"),
一千次小时(4, "1000次/小时"),
一百次小时(5, "100次/小时"),
一百次分钟(6, "100次/分钟"),
十次分钟(7, "10次/分钟"),
一次分钟(8, "1次/分钟");
private Integer value;
private String desc;
LimitStrategyEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static LimitStrategyEnum getByValue(Integer value) {
for (LimitStrategyEnum statusEnum : LimitStrategyEnum.values()) {
if (statusEnum.getValue() == value) {
return statusEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (LimitStrategyEnum item : LimitStrategyEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.product.web; ...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.product.web;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.code.LimitStrategyEnum;
import com.mortals.xhx.module.param.service.ParamService; import com.mortals.xhx.module.param.service.ParamService;
import com.mortals.xhx.module.product.model.ProductInterfaceEntity; import com.mortals.xhx.module.product.model.ProductInterfaceEntity;
import com.mortals.xhx.module.product.service.ProductInterfaceService; import com.mortals.xhx.module.product.service.ProductInterfaceService;
...@@ -32,7 +33,7 @@ public class ProductInterfaceController extends BaseCRUDJsonBodyMappingControlle ...@@ -32,7 +33,7 @@ public class ProductInterfaceController extends BaseCRUDJsonBodyMappingControlle
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "requestType", paramService.getParamBySecondOrganize("ProductInterface","requestType")); this.addDict(model, "requestType", paramService.getParamBySecondOrganize("ProductInterface","requestType"));
this.addDict(model, "requestProtocol", paramService.getParamBySecondOrganize("ProductInterface","requestProtocol")); this.addDict(model, "requestProtocol", paramService.getParamBySecondOrganize("ProductInterface","requestProtocol"));
this.addDict(model, "limitStrategy", paramService.getParamBySecondOrganize("ProductInterface","limitStrategy")); this.addDict(model, "limitStrategy", LimitStrategyEnum.getEnumMap());
this.addDict(model, "contentType", paramService.getParamBySecondOrganize("ProductInterface","contentType")); this.addDict(model, "contentType", paramService.getParamBySecondOrganize("ProductInterface","contentType"));
this.addDict(model, "network", paramService.getParamBySecondOrganize("ProductInterface","network")); this.addDict(model, "network", paramService.getParamBySecondOrganize("ProductInterface","network"));
this.addDict(model, "interfaceTag", paramService.getParamBySecondOrganize("ProductInterface","interfaceTag")); this.addDict(model, "interfaceTag", paramService.getParamBySecondOrganize("ProductInterface","interfaceTag"));
......
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
public enum LimitStrategyEnum {
不限流(0, "不限流"),
一万次日(1, "10000次/日"),
一千次日(2, "1000次/日"),
一百次日(3, "100次/日"),
一千次小时(4, "1000次/小时"),
一百次小时(5, "100次/小时"),
一百次分钟(6, "100次/分钟"),
十次分钟(7, "10次/分钟"),
一次分钟(8, "1次/分钟");
private Integer value;
private String desc;
LimitStrategyEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static LimitStrategyEnum getByValue(Integer value) {
for (LimitStrategyEnum statusEnum : LimitStrategyEnum.values()) {
if (statusEnum.getValue() == value) {
return statusEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (LimitStrategyEnum item : LimitStrategyEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
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