|
|
@ -12,7 +12,7 @@ import com.xydl.cac.model.i2sync.Datanode;
|
|
|
|
import com.xydl.cac.model.i2sync.Monitordata;
|
|
|
|
import com.xydl.cac.model.i2sync.Monitordata;
|
|
|
|
import com.xydl.cac.model.i2sync.Request;
|
|
|
|
import com.xydl.cac.model.i2sync.Request;
|
|
|
|
import com.xydl.cac.service.I2syncService;
|
|
|
|
import com.xydl.cac.service.I2syncService;
|
|
|
|
import com.xydl.cac.util.DataTable;
|
|
|
|
import com.xydl.cac.service.ModevTypeService;
|
|
|
|
import com.xydl.cac.util.DateUtil;
|
|
|
|
import com.xydl.cac.util.DateUtil;
|
|
|
|
import com.xydl.cac.util.JSONUtil;
|
|
|
|
import com.xydl.cac.util.JSONUtil;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
@ -35,6 +35,8 @@ public class I2syncController extends BasicController {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
I2syncService service;
|
|
|
|
I2syncService service;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
ModevTypeService modevTypeService;
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("listFieldConfig")
|
|
|
|
@GetMapping("listFieldConfig")
|
|
|
|
@ApiOperation("查询字段映射")
|
|
|
|
@ApiOperation("查询字段映射")
|
|
|
@ -93,8 +95,9 @@ public class I2syncController extends BasicController {
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("prewXml")
|
|
|
|
@GetMapping("prewXml")
|
|
|
|
@ApiOperation("预览xml结构")
|
|
|
|
@ApiOperation("预览xml结构")
|
|
|
|
public Response<String> prewXml(String tablename) throws Exception {
|
|
|
|
public Response<String> prewXml(Integer modevtypeId) throws Exception {
|
|
|
|
List<I2syncField> fieldList = service.listFieldConfig(tablename);
|
|
|
|
ModevType modevType = modevTypeService.detail(modevtypeId);
|
|
|
|
|
|
|
|
List<I2syncField> fieldList = service.listFieldConfig(modevType.getTablename());
|
|
|
|
List<Attr> attrs = new ArrayList<>();
|
|
|
|
List<Attr> attrs = new ArrayList<>();
|
|
|
|
Attr attr = new Attr();
|
|
|
|
Attr attr = new Attr();
|
|
|
|
attr.setName("Phase");
|
|
|
|
attr.setName("Phase");
|
|
|
@ -110,7 +113,7 @@ public class I2syncController extends BasicController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Datanode node = new Datanode();
|
|
|
|
Datanode node = new Datanode();
|
|
|
|
node.setSensorid("HNHFT001Q1W000104");
|
|
|
|
node.setSensorid("HNHFT001Q1W000104");
|
|
|
|
node.setType(DataTable.getDevType(tablename));
|
|
|
|
node.setType(modevType.getTypeCode());
|
|
|
|
node.setEquipmentid("HNHFT001Q1W000104");
|
|
|
|
node.setEquipmentid("HNHFT001Q1W000104");
|
|
|
|
node.setTimestamp(DateUtil.format(new Date()));
|
|
|
|
node.setTimestamp(DateUtil.format(new Date()));
|
|
|
|
node.setAttr(attrs);
|
|
|
|
node.setAttr(attrs);
|
|
|
@ -125,7 +128,7 @@ public class I2syncController extends BasicController {
|
|
|
|
String xml = JSONUtil.object2Xml(request);
|
|
|
|
String xml = JSONUtil.object2Xml(request);
|
|
|
|
Response<String> resp = Response.success(xml);
|
|
|
|
Response<String> resp = Response.success(xml);
|
|
|
|
if (StringUtils.isBlank(node.getType())) {
|
|
|
|
if (StringUtils.isBlank(node.getType())) {
|
|
|
|
resp.setWarnMsg("该类型还未配置对应的监测类型编码将导致type为空");
|
|
|
|
resp.setWarnMsg("该类型还未配置对应的类型编码将导致type为空");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|