Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
asset-distribution
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-spider
asset-distribution
Commits
1d3c4395
Commit
1d3c4395
authored
Dec 06, 2019
by
liwenbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
1c740e30
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
8 deletions
+27
-8
QGExceptionType.java
...ntgroup/asset/distribution/exception/QGExceptionType.java
+2
-1
FundModuleChannelFundConfigServiceImpl.java
.../funding/impl/FundModuleChannelFundConfigServiceImpl.java
+22
-3
IFundModuleChannelFundConfigRepository.java
...pa/repository/IFundModuleChannelFundConfigRepository.java
+3
-4
No files found.
src/main/java/com/quantgroup/asset/distribution/exception/QGExceptionType.java
View file @
1d3c4395
...
@@ -41,7 +41,8 @@ public enum QGExceptionType {
...
@@ -41,7 +41,8 @@ public enum QGExceptionType {
GET_ALL_FUNDS_INFO_ERROR
(
3001
,
"拉取所有资方信息失败, res : %s"
),
GET_ALL_FUNDS_INFO_ERROR
(
3001
,
"拉取所有资方信息失败, res : %s"
),
NO_FUND_INFO_BEEN_HIT
(
3002
,
"未命中任何资方, bizChannel : %s, amount : %s, term : %s"
),
NO_FUND_INFO_BEEN_HIT
(
3002
,
"未命中任何资方, bizChannel : %s, amount : %s, term : %s"
),
FUND_PRIORITY_IS_ERROR
(
3003
,
"资方优先级不符合要求, bizChannel : %s, amount : %s, term : %s"
),
FUND_PRIORITY_IS_ERROR
(
3003
,
"资方优先级不符合要求, bizChannel : %s, amount : %s, term : %s"
),
NOT_FOUNT_CHANNEL_FUNDS_INFO
(
3004
,
"未找到渠道资方配置, 请检查; bizChannel : %s"
);
NOT_FOUNT_CHANNEL_FUNDS_INFO
(
3004
,
"未找到渠道资方配置, 请检查; bizChannel : %s"
),
CHANNEL_FUND_CONFIG_GREATER_THAN_TOW
(
3005
,
"渠道资方有效配置大于2条,请检查; bizChannel : % s"
);
...
...
src/main/java/com/quantgroup/asset/distribution/service/funding/impl/FundModuleChannelFundConfigServiceImpl.java
View file @
1d3c4395
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
funding
.
impl
;
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
funding
.
impl
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -10,6 +11,7 @@ import javax.persistence.criteria.CriteriaQuery;
...
@@ -10,6 +11,7 @@ import javax.persistence.criteria.CriteriaQuery;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
javax.persistence.criteria.Root
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.CacheEvict
;
...
@@ -24,6 +26,8 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -24,6 +26,8 @@ import org.springframework.transaction.annotation.Transactional;
import
com.quantgroup.asset.distribution.enums.funding.AuditTargetEnum
;
import
com.quantgroup.asset.distribution.enums.funding.AuditTargetEnum
;
import
com.quantgroup.asset.distribution.enums.funding.AuditTypeEnum
;
import
com.quantgroup.asset.distribution.enums.funding.AuditTypeEnum
;
import
com.quantgroup.asset.distribution.enums.response.FundModuleResponse
;
import
com.quantgroup.asset.distribution.enums.response.FundModuleResponse
;
import
com.quantgroup.asset.distribution.exception.QGException
;
import
com.quantgroup.asset.distribution.exception.QGExceptionType
;
import
com.quantgroup.asset.distribution.model.response.GlobalResponse
;
import
com.quantgroup.asset.distribution.model.response.GlobalResponse
;
import
com.quantgroup.asset.distribution.service.approval.IApprovalLogService
;
import
com.quantgroup.asset.distribution.service.approval.IApprovalLogService
;
import
com.quantgroup.asset.distribution.service.funding.IFundModuleChannelFundConfigService
;
import
com.quantgroup.asset.distribution.service.funding.IFundModuleChannelFundConfigService
;
...
@@ -75,12 +79,11 @@ public class FundModuleChannelFundConfigServiceImpl implements IFundModuleChanne
...
@@ -75,12 +79,11 @@ public class FundModuleChannelFundConfigServiceImpl implements IFundModuleChanne
return
result
;
return
result
;
}
}
// @CacheEvict(value = "cacheManager", key="'ASSET_DISTRIBUTION:FUND_MODULE:CHANNEL_FUND_CONFIG:AC8A_'+#bizChannel")
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
GlobalResponse
addChannelFundConfig
(
String
bizChannel
,
String
funds
,
String
remarks
,
String
proposer
,
String
auditor
)
{
public
GlobalResponse
addChannelFundConfig
(
String
bizChannel
,
String
funds
,
String
remarks
,
String
proposer
,
String
auditor
)
{
// 新增配置, 根据渠道查询如果库里已存在,返回异常;
// 新增配置, 根据渠道查询如果库里已存在,返回异常;
FundModuleChannelFundConfig
fundModuleChannelFundConfig
=
f
undModuleChannelFundConfigRepository
.
findByBizChannelAndEnableIsTrue
(
bizChannel
);
FundModuleChannelFundConfig
fundModuleChannelFundConfig
=
f
indByBizChannel
(
bizChannel
);
if
(
fundModuleChannelFundConfig
!=
null
)
{
if
(
fundModuleChannelFundConfig
!=
null
)
{
log
.
info
(
"资方模块, 渠道 : {}资方配置已存在, 添加失败!"
,
bizChannel
);
log
.
info
(
"资方模块, 渠道 : {}资方配置已存在, 添加失败!"
,
bizChannel
);
return
GlobalResponse
.
create
(
FundModuleResponse
.
CHANNEL_FUND_CONFIG_IS_EXIST
);
return
GlobalResponse
.
create
(
FundModuleResponse
.
CHANNEL_FUND_CONFIG_IS_EXIST
);
...
@@ -113,7 +116,23 @@ public class FundModuleChannelFundConfigServiceImpl implements IFundModuleChanne
...
@@ -113,7 +116,23 @@ public class FundModuleChannelFundConfigServiceImpl implements IFundModuleChanne
@Cacheable
(
value
=
"cacheManager"
,
key
=
"'ASSET_DISTRIBUTION:FUND_MODULE:CHANNEL_FUND_CONFIG:AC8A_'+#bizChannel"
)
@Cacheable
(
value
=
"cacheManager"
,
key
=
"'ASSET_DISTRIBUTION:FUND_MODULE:CHANNEL_FUND_CONFIG:AC8A_'+#bizChannel"
)
@Override
@Override
public
FundModuleChannelFundConfig
findByBizChannel
(
String
bizChannel
)
{
public
FundModuleChannelFundConfig
findByBizChannel
(
String
bizChannel
)
{
return
fundModuleChannelFundConfigRepository
.
findByBizChannelAndEnableIsTrue
(
bizChannel
);
List
<
FundModuleChannelFundConfig
>
configList
=
fundModuleChannelFundConfigRepository
.
findByBizChannelAndEnableIsTrue
(
bizChannel
);
if
(
CollectionUtils
.
isEmpty
(
configList
))
{
return
null
;
}
// 避免脏读
if
(
configList
.
size
()
>
2
)
{
throw
new
QGException
(
QGExceptionType
.
CHANNEL_FUND_CONFIG_GREATER_THAN_TOW
,
bizChannel
);
}
Collections
.
sort
(
configList
,
(
c1
,
c2
)
->
{
// 别直接把相减把long类型转成int,可能越界
if
(
c2
.
getId
()
>
c1
.
getId
())
{
return
1
;
}
else
if
(
c2
.
getId
()
<
c1
.
getId
())
{
return
-
1
;
}
else
{
return
0
;
}
});
return
configList
.
get
(
0
);
}
}
@Override
@Override
...
...
src/main/java/com/quantgroup/asset/distribution/service/jpa/repository/IFundModuleChannelFundConfigRepository.java
View file @
1d3c4395
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
jpa
.
repository
;
package
com
.
quantgroup
.
asset
.
distribution
.
service
.
jpa
.
repository
;
import
java.util.List
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
import
com.quantgroup.asset.distribution.service.jpa.entity.FundModuleChannelFundConfig
;
import
com.quantgroup.asset.distribution.service.jpa.entity.FundModuleChannelFundConfig
;
...
@@ -19,7 +18,7 @@ public interface IFundModuleChannelFundConfigRepository extends JpaRepository<Fu
...
@@ -19,7 +18,7 @@ public interface IFundModuleChannelFundConfigRepository extends JpaRepository<Fu
* @param bizChannel
* @param bizChannel
* @return
* @return
*/
*/
public
FundModuleChannelFundConfig
findByBizChannelAndEnableIsTrue
(
String
bizChannel
);
public
List
<
FundModuleChannelFundConfig
>
findByBizChannelAndEnableIsTrue
(
String
bizChannel
);
/**
/**
* 根据id查询渠道资方配置
* 根据id查询渠道资方配置
...
@@ -29,7 +28,7 @@ public interface IFundModuleChannelFundConfigRepository extends JpaRepository<Fu
...
@@ -29,7 +28,7 @@ public interface IFundModuleChannelFundConfigRepository extends JpaRepository<Fu
public
FundModuleChannelFundConfig
findByIdAndEnableIsTrue
(
Long
id
);
public
FundModuleChannelFundConfig
findByIdAndEnableIsTrue
(
Long
id
);
/**
/**
*
*
注意,这个是给渠道资方配置审批用的,慎用,这个不关注enable状态
* @param id
* @param id
* @return
* @return
*/
*/
...
...
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