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

添加权重

parent bc596635
......@@ -25,6 +25,8 @@ public interface ParamService extends ICRUDCacheService<ParamEntity, Long>, IPar
*/
String getValueByKey(String key);
Long getIdByKey(String key);
/**
* 通过firstOrganize获取配置参数key-value
*
......
......@@ -39,6 +39,13 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par
return keyValueMap.getOrDefault(key, "");
}
@Override
public Long getIdByKey(String key) {
List<ParamEntity> list = this.getCacheList();
Map<String, Long> keyValueMap = list.parallelStream().collect(Collectors.toMap(x -> x.getParamKey(), y -> y.getId(), (o, n) -> n));
return keyValueMap.get(key);
}
@Override
public Map<String, String> getParamByFirstOrganize(String firstOrganize, String... excludeParamKeys) {
List<ParamEntity> list = this.getCacheList();
......
......@@ -74,7 +74,9 @@ public class ParamController extends BaseCRUDJsonBodyMappingController<ParamServ
WeightPdu weightPdu = new WeightPdu();
value = JSONObject.toJSONString(weightPdu);
}
Long id = this.service.getIdByKey(key);
jsonObject.put(KEY_RESULT_DATA, value);
jsonObject.put("id", id);
recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, busiDesc + "成功!");
......
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