|
|
|
@ -17,8 +17,6 @@ import com.foreverwin.mesnac.equip.model.EdcDataResource;
|
|
|
|
|
import com.foreverwin.mesnac.equip.mapper.EdcDataResourceMapper;
|
|
|
|
|
import com.foreverwin.mesnac.equip.service.EdcDataResourceService;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
@ -41,8 +39,6 @@ import java.util.UUID;
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public class EdcDataResourceServiceImpl extends ServiceImpl<EdcDataResourceMapper, EdcDataResource> implements EdcDataResourceService {
|
|
|
|
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(EdcDataResourceServiceImpl.class);
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private EdcDataResourceMapper edcDataResourceMapper;
|
|
|
|
|
@Autowired
|
|
|
|
@ -65,7 +61,7 @@ public class EdcDataResourceServiceImpl extends ServiceImpl<EdcDataResourceMappe
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String saveResourceParamByMq(String text) {
|
|
|
|
|
public void saveResourceParamByMq(String text) {
|
|
|
|
|
// json解析,获取json中数据
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(text);
|
|
|
|
|
String handle = jsonObject.getString("TRANID");
|
|
|
|
@ -73,21 +69,17 @@ public class EdcDataResourceServiceImpl extends ServiceImpl<EdcDataResourceMappe
|
|
|
|
|
String resource = jsonObject.getString("RESOURCE");
|
|
|
|
|
String sendTime = jsonObject.getString("SEND_TIME");
|
|
|
|
|
if (StringUtil.isBlank(handle)) {
|
|
|
|
|
logger.error("唯一标识不能为空!");
|
|
|
|
|
throw BusinessException.build("唯一标识不能为空!");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtil.isBlank(site)) {
|
|
|
|
|
logger.error("站点不能为空!");
|
|
|
|
|
throw BusinessException.build("站点不能为空!");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtil.isBlank(resource)) {
|
|
|
|
|
logger.error("设备编号不能为空!");
|
|
|
|
|
throw BusinessException.build("设备编号不能为空!");
|
|
|
|
|
}
|
|
|
|
|
String resourceHandle = HandleEnum.RESOURCE.getHandle(site, resource);
|
|
|
|
|
Resrce resourceById = resrceService.getById(resourceHandle);
|
|
|
|
|
if (resourceById == null){
|
|
|
|
|
logger.error("未找到设备编号为" + resource + "的设备!");
|
|
|
|
|
throw BusinessException.build("未找到设备编号为" + resource + "的设备!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -107,7 +99,6 @@ public class EdcDataResourceServiceImpl extends ServiceImpl<EdcDataResourceMappe
|
|
|
|
|
if (dcGroupBo == null){
|
|
|
|
|
dcGroupBo = edcDataResourceMapper.getDcGroupBoByResourceBo2(resourceBo);
|
|
|
|
|
if (dcGroupBo == null){
|
|
|
|
|
logger.info("设备编号" + resource + "未找到数据收集组");
|
|
|
|
|
throw BusinessException.build("设备编号未找到数据收集组!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -116,7 +107,6 @@ public class EdcDataResourceServiceImpl extends ServiceImpl<EdcDataResourceMappe
|
|
|
|
|
StringBuilder columnSql = new StringBuilder();
|
|
|
|
|
List<DcParameter> getParamList = dcParameterMapper.getDcParameterByDcGroupBo(dcGroupBo);
|
|
|
|
|
if (getParamList.size() < 1){
|
|
|
|
|
logger.info("数据收集组" + dcGroupBo + "未维护字段信息");
|
|
|
|
|
throw BusinessException.build("数据收集组" + dcGroupBo + "未维护字段信息");
|
|
|
|
|
}
|
|
|
|
|
for (DcParameter dcParam:getParamList) {
|
|
|
|
@ -156,7 +146,6 @@ public class EdcDataResourceServiceImpl extends ServiceImpl<EdcDataResourceMappe
|
|
|
|
|
.append(columnValSql.substring(0,columnValSql.length()-1))
|
|
|
|
|
.append(" )");
|
|
|
|
|
edcDataResourceMapper.insertBySql(sqlStr.toString());
|
|
|
|
|
return handle;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|