Commit 7ea37e71 authored by zhangyingbin's avatar zhangyingbin

技术参数新增接口 新增错误提示

parent 889f837d
...@@ -17,20 +17,22 @@ import org.springframework.stereotype.Service; ...@@ -17,20 +17,22 @@ import org.springframework.stereotype.Service;
import org.springframework.ui.context.support.UiApplicationContextUtils; import org.springframework.ui.context.support.UiApplicationContextUtils;
import org.typroject.tyboot.component.cache.Redis; import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service @Service
public class TechInfoService { public class TechInfoService {
public String saveTechInfo(List<JSONObject> techInfoList){ public String saveTechInfo(List<JSONObject> techInfoList){
List<String> failSupervisoryCode = new ArrayList<>();
for (JSONObject techInfo: techInfoList) { for (JSONObject techInfo: techInfoList) {
String type = techInfo.getString("type"); String type = techInfo.getString("type");
String entityClasspath = EquipTypeEnum.classPathmap.get(type); String entityClasspath = EquipTypeEnum.classPathmap.get(type);
if(ValidationUtil.isEmpty(entityClasspath)){
failSupervisoryCode.add(techInfo.getString("type")+":"+techInfo.getString("supervisoryCode"));
}
String serviceClasspath = EquipTypeEnum.servicePathmap.get(type); String serviceClasspath = EquipTypeEnum.servicePathmap.get(type);
try { try {
Class entityClazz = Class.forName(entityClasspath); Class entityClazz = Class.forName(entityClasspath);
...@@ -42,9 +44,14 @@ public class TechInfoService { ...@@ -42,9 +44,14 @@ public class TechInfoService {
service.save(entity); service.save(entity);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
failSupervisoryCode.add(techInfo.getString("type")+":"+techInfo.getString("supervisoryCode"));
}
} }
String result = "ok";
if(!ValidationUtil.isEmpty(failSupervisoryCode)){
result = "supervisoryCode为"+JSON.toJSONString(failSupervisoryCode)+"的参数添加失败,请检查参数。";
} }
return "ok"; return 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