|
@@ -22,6 +22,7 @@ import com.persagy.transfer.pojo.dto.RwdObjectWd;
|
|
|
import com.persagy.transfer.service.IHydomcAssetService;
|
|
|
import com.persagy.transfer.utils.StringTool;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
/**
|
|
@@ -46,15 +47,21 @@ public class HydomcAssetServiceImpl extends SuperServiceImpl<HydomcAssetMapper,
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public boolean saveHydomcAsset(RwdObjectWd rwdObjectWd, JSONObject infos, String wdProjectId, String classstructureid, String sbybm) {
|
|
|
- int valid = rwdObjectWd.getValid() == null ? 0 : rwdObjectWd.getValid();
|
|
|
+ String equipmentName = StringTool.object2String(infos.get(InfosKeyConstant.EQUIPMENT_NAME));
|
|
|
+ if (StrUtil.isBlank(equipmentName)) {
|
|
|
+ log.warn("万达设备名称为空,不进行同步,本方对象ID:{}", rwdObjectWd.getId());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ int valid = rwdObjectWd.getValid() == null ? 0 : rwdObjectWd.getValid();
|
|
|
Date updateTime = rwdObjectWd.getUpdateTime() == null ? DateUtil.date().toJdkDate() : rwdObjectWd.getUpdateTime();
|
|
|
+ String updateUser = StrUtil.isBlank(rwdObjectWd.getUpdateUser()) ? SwitchConstant.USER_ID : rwdObjectWd.getUpdateUser();
|
|
|
|
|
|
log.info("设备数据同步至万达数据库,本方对象ID:{},设备状态:{},万达项目ID:{}, 设备分类ID:{}", rwdObjectWd.getId(), valid, wdProjectId, classstructureid);
|
|
|
|
|
|
Integer result = null;
|
|
|
HydomcAsset hydomcAsset = this.getHydomcAssetByPKey(sbybm);
|
|
|
if (hydomcAsset == null) {
|
|
|
- hydomcAsset = this.buildHydomcAsset(infos, wdProjectId, classstructureid, rwdObjectWd.getUpdateUser(), valid, updateTime);
|
|
|
+ hydomcAsset = this.buildHydomcAsset(infos, wdProjectId, classstructureid, updateUser, valid, updateTime);
|
|
|
result = this.baseMapper.insert(hydomcAsset);
|
|
|
return SqlHelper.retBool(result);
|
|
|
}
|
|
@@ -67,7 +74,7 @@ public class HydomcAssetServiceImpl extends SuperServiceImpl<HydomcAssetMapper,
|
|
|
updateWrapper.set(HydomcAsset::getChangedate, updateTime); // 数据更新时间 增量字段
|
|
|
result = this.baseMapper.update(null, updateWrapper);
|
|
|
} else {
|
|
|
- hydomcAsset = this.buildHydomcAsset(infos, wdProjectId, classstructureid, rwdObjectWd.getUpdateUser(), valid, updateTime);
|
|
|
+ hydomcAsset = this.buildHydomcAsset(infos, wdProjectId, classstructureid, updateUser, valid, updateTime);
|
|
|
hydomcAsset.setSbybm(sbybm);
|
|
|
result = this.baseMapper.update(hydomcAsset, updateWrapper);
|
|
|
}
|