设备配置同步

This commit is contained in:
曹磊 2025-08-08 09:14:57 +08:00
parent 180214c6dd
commit 5c781ec695
7 changed files with 21 additions and 18 deletions

View File

@ -43,7 +43,6 @@ public class TumsConfig implements Serializable {
private String ftpUsername; //回放视频转FTP上传用户 private String ftpUsername; //回放视频转FTP上传用户
private String ftpPassword; //回放视频转FTP上传密码 private String ftpPassword; //回放视频转FTP上传密码
private String ftpUploadpath; //回放视频转FTP上传路径 private String ftpUploadpath; //回放视频转FTP上传路径
@JsonIgnore
private String updateDate; //更新时间 private String updateDate; //更新时间
@JsonIgnore @JsonIgnore

View File

@ -65,7 +65,7 @@ public class TumsConfigServiceImpl extends ServiceImpl<TumsConfigMapper, TumsCon
log.setContent(json); log.setContent(json);
log.setServerType(type); log.setServerType(type);
log.setStatus("同步中"); log.setStatus("同步中");
log.setServerType("电水表"); log.setServerType("摄像头");
baseMapper.addConfigLog(log); baseMapper.addConfigLog(log);
itc.setLogId(logId); itc.setLogId(logId);

View File

@ -37,7 +37,6 @@ public class TqConfig implements Serializable {
private String notifyUrl; //通知地址 private String notifyUrl; //通知地址
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "org_code") @Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "org_code")
private String orgCode; //机构编码 private String orgCode; //机构编码
@JsonIgnore
private String updateDate; //更新时间 private String updateDate; //更新时间
@JsonIgnore @JsonIgnore

View File

@ -20,4 +20,5 @@ public interface TqConfigMapper extends BaseMapper<TqConfig> {
List<TqConfig> getAllConfigList(); List<TqConfig> getAllConfigList();
void addConfigLog(TqConfig tqConfig); void addConfigLog(TqConfig tqConfig);
void updateConfigLog(TqConfig tqConfig); void updateConfigLog(TqConfig tqConfig);
TqConfig getOrgName(String orgCode);
} }

View File

@ -62,4 +62,14 @@
where log_id = #{logId} where log_id = #{logId}
</update> </update>
<select id="getOrgName" parameterType="String" resultType="com.nu.modules.tq.common.entity.TqConfig">
select
org_code as orgCode,
depart_name as orgName
from sys_depart
where org_code = #{orgCode}
order by org_code asc
limit 1
</select>
</mapper> </mapper>

View File

@ -47,30 +47,25 @@ public class TqConfigServiceImpl extends ServiceImpl<TqConfigMapper, TqConfig> i
} }
private void syncMq(TqConfig tqConfig,String type){ private void syncMq(TqConfig tqConfig,String type){
IotTqConfigMQDto itc = new IotTqConfigMQDto(); String orgCode = tqConfig.getOrgCode();
BeanUtils.copyProperties(tqConfig, itc); if(orgCode!=null&&!orgCode.equals("")){
List<TqConfig> orgList = baseMapper.getAllConfigList(); TqConfig org = baseMapper.getOrgName(orgCode);
for(int i=0;i<orgList.size();i++){ IotTqConfigMQDto itc = new IotTqConfigMQDto();
TqConfig entity = orgList.get(i); BeanUtils.copyProperties(tqConfig, itc);
if(entity.getOrgCode().equals("")){
continue;
}
String logId = UuidUtils.getUUID(); String logId = UuidUtils.getUUID();
String json = JSON.toJSONString(tqConfig); String json = JSON.toJSONString(tqConfig);
TqConfig log = new TqConfig(); TqConfig log = new TqConfig();
log.setLogId(logId); log.setLogId(logId);
log.setOrgCode(entity.getOrgCode()); log.setOrgCode(orgCode);
log.setOrgName(entity.getOrgName()); log.setOrgName(org.getOrgName());
log.setContent(json); log.setContent(json);
log.setServerType(type); log.setServerType(type);
log.setStatus("同步中"); log.setStatus("同步中");
log.setServerType("摄像头"); log.setServerType("电水表");
baseMapper.addConfigLog(log); baseMapper.addConfigLog(log);
itc.setLogId(logId); itc.setLogId(logId);
rabbitMQUtil.sendToExchange("hldy.tqconfig", entity.getOrgCode() + ".tqconfig.async", itc); rabbitMQUtil.sendToExchange("hldy.tqconfig", orgCode + ".tqconfig.async", itc);
} }
} }
} }

View File

@ -32,7 +32,6 @@ public class YiweilianConfig implements Serializable {
private Integer id; private Integer id;
private String requestUrl; //云平台系统地址 private String requestUrl; //云平台系统地址
private String clientId; //识别用户的唯一标识 private String clientId; //识别用户的唯一标识
@JsonIgnore
private String updateDate; //更新时间 private String updateDate; //更新时间
@JsonIgnore @JsonIgnore