设备配置同步

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 ftpPassword; //回放视频转FTP上传密码
private String ftpUploadpath; //回放视频转FTP上传路径
@JsonIgnore
private String updateDate; //更新时间
@JsonIgnore

View File

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

View File

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

View File

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

View File

@ -62,4 +62,14 @@
where log_id = #{logId}
</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>

View File

@ -47,30 +47,25 @@ public class TqConfigServiceImpl extends ServiceImpl<TqConfigMapper, TqConfig> i
}
private void syncMq(TqConfig tqConfig,String type){
IotTqConfigMQDto itc = new IotTqConfigMQDto();
BeanUtils.copyProperties(tqConfig, itc);
List<TqConfig> orgList = baseMapper.getAllConfigList();
for(int i=0;i<orgList.size();i++){
TqConfig entity = orgList.get(i);
if(entity.getOrgCode().equals("")){
continue;
}
String orgCode = tqConfig.getOrgCode();
if(orgCode!=null&&!orgCode.equals("")){
TqConfig org = baseMapper.getOrgName(orgCode);
IotTqConfigMQDto itc = new IotTqConfigMQDto();
BeanUtils.copyProperties(tqConfig, itc);
String logId = UuidUtils.getUUID();
String json = JSON.toJSONString(tqConfig);
TqConfig log = new TqConfig();
log.setLogId(logId);
log.setOrgCode(entity.getOrgCode());
log.setOrgName(entity.getOrgName());
log.setOrgCode(orgCode);
log.setOrgName(org.getOrgName());
log.setContent(json);
log.setServerType(type);
log.setStatus("同步中");
log.setServerType("摄像头");
log.setServerType("电水表");
baseMapper.addConfigLog(log);
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 String requestUrl; //云平台系统地址
private String clientId; //识别用户的唯一标识
@JsonIgnore
private String updateDate; //更新时间
@JsonIgnore