Commit 782881f6 authored by zhaji's avatar zhaji

"feature-zhaJi:修复saveBath未指定事务的错误"

parent c6a77358
...@@ -49,6 +49,7 @@ public class InsurancesDataSourceConfig { ...@@ -49,6 +49,7 @@ public class InsurancesDataSourceConfig {
GlobalConfig globalConfig = new GlobalConfig(); GlobalConfig globalConfig = new GlobalConfig();
globalConfig.setMetaObjectHandler(new MybatisPlusMetaObjectHandler()); globalConfig.setMetaObjectHandler(new MybatisPlusMetaObjectHandler());
globalConfig.setDbConfig(new GlobalConfig.DbConfig()); globalConfig.setDbConfig(new GlobalConfig.DbConfig());
globalConfig.setBanner(false);
bean.setGlobalConfig(globalConfig); bean.setGlobalConfig(globalConfig);
//添加XML目录 //添加XML目录
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
...@@ -57,9 +58,8 @@ public class InsurancesDataSourceConfig { ...@@ -57,9 +58,8 @@ public class InsurancesDataSourceConfig {
//分页插件配置,不配置分页插件无效,否则会出现total为0的情况 //分页插件配置,不配置分页插件无效,否则会出现total为0的情况
bean.setPlugins(insurancesPlusInterceptor()); bean.setPlugins(insurancesPlusInterceptor());
SqlSessionFactory sqlSessionFactory = bean.getObject(); SqlSessionFactory sqlSessionFactory = bean.getObject();
assert sqlSessionFactory != null;
sqlSessionFactory.getConfiguration().setMapUnderscoreToCamelCase(true); sqlSessionFactory.getConfiguration().setMapUnderscoreToCamelCase(true);
return bean.getObject(); return sqlSessionFactory;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException(e); throw new RuntimeException(e);
...@@ -75,7 +75,8 @@ public class InsurancesDataSourceConfig { ...@@ -75,7 +75,8 @@ public class InsurancesDataSourceConfig {
} }
@Bean @Bean(name = "insurancesTransactionManager")
@Primary
public DataSourceTransactionManager insurancesTransactionManager(@Qualifier("insurancesDataSource") DataSource dataSource) { public DataSourceTransactionManager insurancesTransactionManager(@Qualifier("insurancesDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource); return new DataSourceTransactionManager(dataSource);
} }
......
...@@ -2748,9 +2748,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2748,9 +2748,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param displayFlag 是否显示 0不显示/1显示 * @param displayFlag 是否显示 0不显示/1显示
* @return void * @return void
*/ */
private void addOperate(List<TInsuranceDetail> detailList,YifuUser user,String operateDesc,String remark,Integer displayFlag){ @Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public void addOperate(List<TInsuranceDetail> detailList,YifuUser user,String operateDesc,String remark,Integer displayFlag){
if (CollectionUtils.isNotEmpty(detailList)){ if (CollectionUtils.isNotEmpty(detailList)){
try {
List<TInsuranceOperate> operateList = new ArrayList<>(); List<TInsuranceOperate> operateList = new ArrayList<>();
for (TInsuranceDetail detail : detailList) { for (TInsuranceDetail detail : detailList) {
TInsuranceOperate operate = new TInsuranceOperate(); TInsuranceOperate operate = new TInsuranceOperate();
...@@ -2764,9 +2764,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2764,9 +2764,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
operateList.add(operate); operateList.add(operate);
} }
tInsuranceOperateService.saveBatch(operateList); tInsuranceOperateService.saveBatch(operateList);
}catch (Exception e){
e.getStackTrace();
}
} }
} }
...@@ -2779,7 +2776,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2779,7 +2776,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param operateDesc 操作描述 * @param operateDesc 操作描述
* @return void * @return void
*/ */
private void addOperate(List<InsuranceHandleParam> paramList,YifuUser user,String operateDesc){ @Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public void addOperate(List<InsuranceHandleParam> paramList,YifuUser user,String operateDesc){
if (CollectionUtils.isNotEmpty(paramList)){ if (CollectionUtils.isNotEmpty(paramList)){
try { try {
List<TInsuranceOperate> operateList = new ArrayList<>(); List<TInsuranceOperate> operateList = new ArrayList<>();
...@@ -4640,7 +4638,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -4640,7 +4638,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//查数据是否存在权限范围内 //查数据是否存在权限范围内
String regionSQL = getRegionSQL(user); String regionSQL = getRegionSQL(user);
TInsuranceDetail detailByRegionSQL = this.baseMapper.selectByregionSQL(regionSQL,detailId); TInsuranceDetail detailByRegionSQL = this.baseMapper.selectByregionSQL(regionSQL,detailId);
if (!Optional.ofNullable(detailByRegionSQL).isPresent()){ if (!Optional.ofNullable(detailByRegionSQL).isPresent() || !user.getId().equals(detailByRegionSQL.getUpdateBy())){
param.setErrorMessage(InsurancesConstants.NO_DETAIL_JURISDICTION); param.setErrorMessage(InsurancesConstants.NO_DETAIL_JURISDICTION);
errorList.add(param); errorList.add(param);
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment