解决策略同步数据不对和重复问题

This commit is contained in:
zq
2026-01-06 11:27:20 +08:00
parent 4f3cd8c82b
commit a4ac11e7d9

View File

@ -58,7 +58,7 @@ public class StrategyTempSyncAspect {
// 用ThreadLocal暂存删除前的对象
private ThreadLocal<EmsStrategyTemp> beforeDeleteThreadLocal = new ThreadLocal<>();
@Before("execution(* com.xzzn.ems.mapper.EmsStrategyTempMapper.deleteEmsStrategyTempById(..)) && args(templateId)")
@Before("execution(* com.xzzn.ems.mapper.EmsStrategyTempMapper.deleteTempByTempId(..)) && args(templateId)")
public void beforeDelete(JoinPoint joinPoint, String templateId) {
// 查询删除前的数据-仅存一获取siteId
List<EmsStrategyTemp> tempList = emsStrategyTempMapper.selectStrategyTempByTempId(templateId);
@ -67,7 +67,7 @@ public class StrategyTempSyncAspect {
}
}
@Pointcut("(execution(* com.xzzn.ems.mapper.EmsStrategyTempMapper.deleteEmsStrategyTempById(..)) && args(templateId)) ")
@Pointcut("(execution(* com.xzzn.ems.mapper.EmsStrategyTempMapper.deleteTempByTempId(..)) && args(templateId)) ")
public void deletePointCut(String templateId) {
logger.info("【删除策略模版切面】StrategyTempSyncAspect 被实例化");
}
@ -105,7 +105,7 @@ public class StrategyTempSyncAspect {
}
// 数据转换
SyncStrategyTempVo tempVo = convertEntity(insertEntity);
String content = objectMapper.writeValueAsString(tempVo);
String content = JSON.toJSONString(tempVo);
message.setContent(content);
// 发布到MQTT主题