Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
782881f6
Commit
782881f6
authored
Aug 26, 2022
by
zhaji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"feature-zhaJi:修复saveBath未指定事务的错误"
parent
c6a77358
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
InsurancesDataSourceConfig.java
...v1/yifu/insurances/config/InsurancesDataSourceConfig.java
+5
-4
TInsuranceDetailServiceImpl.java
...s/service/insurance/impl/TInsuranceDetailServiceImpl.java
+5
-7
No files found.
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/config/InsurancesDataSourceConfig.java
View file @
782881f6
...
@@ -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,8 +75,9 @@ public class InsurancesDataSourceConfig {
...
@@ -75,8 +75,9 @@ public class InsurancesDataSourceConfig {
}
}
@Bean
@Bean
(
name
=
"insurancesTransactionManager"
)
public
DataSourceTransactionManager
insurancesTransactionManager
(
@Qualifier
(
"insurancesDataSource"
)
DataSource
dataSource
)
{
@Primary
public
DataSourceTransactionManager
insurancesTransactionManager
(
@Qualifier
(
"insurancesDataSource"
)
DataSource
dataSource
)
{
return
new
DataSourceTransactionManager
(
dataSource
);
return
new
DataSourceTransactionManager
(
dataSource
);
}
}
@Bean
@Bean
...
...
yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/insurance/impl/TInsuranceDetailServiceImpl.java
View file @
782881f6
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment