Commit eabb6bd3 by ThomasAdv

添加事务注解,去除todo标识

1 parent fece0554
...@@ -107,9 +107,9 @@ public class DataReportRabbitMQConsumer { ...@@ -107,9 +107,9 @@ public class DataReportRabbitMQConsumer {
if (CollectionUtils.isNotEmpty(modelDTO.getModelFieldMappings())) { if (CollectionUtils.isNotEmpty(modelDTO.getModelFieldMappings())) {
Map<String, Object> existModelData = getExistModelData(modelDTO); Map<String, Object> existModelData = getExistModelData(modelDTO);
if (existModelData == null) { if (existModelData == null) {
addModelData(modelDTO); thiz.addModelData(modelDTO);
}else{ }else{
updateModelData(modelDTO, existModelData); thiz.updateModelData(modelDTO, existModelData);
} }
}else{ }else{
log.error("model field mapping is empty, model:{}", modelDTO); log.error("model field mapping is empty, model:{}", modelDTO);
...@@ -125,7 +125,8 @@ public class DataReportRabbitMQConsumer { ...@@ -125,7 +125,8 @@ public class DataReportRabbitMQConsumer {
* @author caiym * @author caiym
* @date 2023年09月15日 17:14:42 * @date 2023年09月15日 17:14:42
*/ */
private void updateModelData(ModelDTO modelDTO, Map<String, Object> existModelData) { @Transactional(propagation= Propagation.REQUIRED,rollbackFor=RpcServiceException.class)
public void updateModelData(ModelDTO modelDTO, Map<String, Object> existModelData) {
log.info("updateModelData, modelDTO:{}, existModelData:{}", modelDTO, existModelData); log.info("updateModelData, modelDTO:{}, existModelData:{}", modelDTO, existModelData);
if (CollectionUtils.isNotEmpty(modelDTO.getModelFieldMappings())) { if (CollectionUtils.isNotEmpty(modelDTO.getModelFieldMappings())) {
Map<String, Object> fieldMap = mergeModelData(modelDTO, existModelData); Map<String, Object> fieldMap = mergeModelData(modelDTO, existModelData);
...@@ -287,7 +288,8 @@ public class DataReportRabbitMQConsumer { ...@@ -287,7 +288,8 @@ public class DataReportRabbitMQConsumer {
* @author caiym * @author caiym
* @date 2023年09月15日 17:14:29 * @date 2023年09月15日 17:14:29
*/ */
private void addModelData(ModelDTO modelDTO) { @Transactional(propagation= Propagation.REQUIRED,rollbackFor=RpcServiceException.class)
public void addModelData(ModelDTO modelDTO) {
log.info("addModelData, modelDTO:{}", modelDTO); log.info("addModelData, modelDTO:{}", modelDTO);
if (CollectionUtils.isNotEmpty(modelDTO.getModelFieldMappings())) { if (CollectionUtils.isNotEmpty(modelDTO.getModelFieldMappings())) {
JSONObject exJson = new JSONObject(); JSONObject exJson = new JSONObject();
......
...@@ -60,6 +60,8 @@ public class ModelService { ...@@ -60,6 +60,8 @@ public class ModelService {
} }
} }
@Transactional(propagation= Propagation.REQUIRED,rollbackFor=RpcServiceException.class)
public void insertTable(String sql){ public void insertTable(String sql){
try{ try{
modelMapper.insertTable(sql); modelMapper.insertTable(sql);
...@@ -69,6 +71,7 @@ public class ModelService { ...@@ -69,6 +71,7 @@ public class ModelService {
} }
} }
@Transactional(propagation= Propagation.REQUIRED,rollbackFor=RpcServiceException.class)
public void updateTable(String sql){ public void updateTable(String sql){
try{ try{
modelMapper.updateTable(sql); modelMapper.updateTable(sql);
......
...@@ -55,7 +55,6 @@ public class OneIdService { ...@@ -55,7 +55,6 @@ public class OneIdService {
RpcAssert.assertNotNull(param.getBusinessType(), DefaultErrorEnum.DATA_NULL,"param.getBusinessType() not be null"); RpcAssert.assertNotNull(param.getBusinessType(), DefaultErrorEnum.DATA_NULL,"param.getBusinessType() not be null");
RpcAssert.assertNotEmpty(param.getOneIdFieldJson(), DefaultErrorEnum.DATA_NULL,"param.getOneIdFieldJson() not be empty"); RpcAssert.assertNotEmpty(param.getOneIdFieldJson(), DefaultErrorEnum.DATA_NULL,"param.getOneIdFieldJson() not be empty");
List<OneIdFieldConfigDTO> readyMatchOneIdFieldConfigs = getReadyMatchOneIdFieldConfigs(param); List<OneIdFieldConfigDTO> readyMatchOneIdFieldConfigs = getReadyMatchOneIdFieldConfigs(param);
//TODO 分布式锁
String finalOneId = null; String finalOneId = null;
if (CollectionUtils.isNotEmpty(readyMatchOneIdFieldConfigs)) { if (CollectionUtils.isNotEmpty(readyMatchOneIdFieldConfigs)) {
for (OneIdFieldConfigDTO readyMatchOneIdFieldConfig : readyMatchOneIdFieldConfigs) { for (OneIdFieldConfigDTO readyMatchOneIdFieldConfig : readyMatchOneIdFieldConfigs) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!