Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-finance
Overview
Overview
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
base_platform_enterprise
gic-platform-finance
Commits
a3a0a192
Commit
a3a0a192
authored
Aug 09, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
转账审批
parent
e87a42df
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
787 additions
and
25 deletions
+787
-25
.flattened-pom.xml
gic-platform-finance-api/.flattened-pom.xml
+1
-1
pom.xml
gic-platform-finance-service/pom.xml
+5
-0
T.java
...e-service/src/main/java/com/gic/finance/dao/mapper/T.java
+0
-4
TabTransferAccountsApprovalMapper.java
...finance/dao/mapper/TabTransferAccountsApprovalMapper.java
+62
-0
T.java
...nance-service/src/main/java/com/gic/finance/entity/T.java
+0
-4
TabTransferAccountsApproval.java
...a/com/gic/finance/entity/TabTransferAccountsApproval.java
+308
-0
TransferAccountsApprovalService.java
.../gic/finance/service/TransferAccountsApprovalService.java
+35
-0
T.java
...service/src/main/java/com/gic/finance/service/impl/T.java
+0
-4
TransferAccountsApprovalServiceImpl.java
...nce/service/impl/TransferAccountsApprovalServiceImpl.java
+50
-0
T.java
...e/src/main/java/com/gic/finance/service/outer/impl/T.java
+0
-4
TransferAccountsApprovalApiServiceImpl.java
...ce/outer/impl/TransferAccountsApprovalApiServiceImpl.java
+108
-0
dubbo-gic-platform-finance-service.xml
...src/main/resources/dubbo-gic-platform-finance-service.xml
+3
-0
TabTransferAccountsApprovalMapper.xml
...in/resources/mapper/TabTransferAccountsApprovalMapper.xml
+0
-0
pom.xml
gic-platform-finance-web/pom.xml
+5
-0
T.java
...e-web/src/main/java/com/gic/finance/web/controller/T.java
+0
-4
TransferAccountsApprovalController.java
...ce/web/controller/TransferAccountsApprovalController.java
+69
-0
GlobalExceptionHandler.java
...com/gic/finance/web/exception/GlobalExceptionHandler.java
+107
-0
T.java
...ce-web/src/main/java/com/gic/finance/web/exception/T.java
+0
-4
ResultControllerUtils.java
...java/com/gic/finance/web/utils/ResultControllerUtils.java
+30
-0
dubbo-gic-platform-finance-web.xml
...web/src/main/resources/dubbo-gic-platform-finance-web.xml
+4
-0
No files found.
gic-platform-finance-api/.flattened-pom.xml
View file @
a3a0a192
...
...
@@ -3,7 +3,7 @@
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.gic
</groupId>
<artifactId>
gic-platform-
auth
-api
</artifactId>
<artifactId>
gic-platform-
finance
-api
</artifactId>
<version>
4.0-SNAPSHOT
</version>
<dependencies>
<dependency>
...
...
gic-platform-finance-service/pom.xml
View file @
a3a0a192
...
...
@@ -113,6 +113,11 @@
<artifactId>
gic-platform-auth-api
</artifactId>
<version>
${gic-platform-auth-api}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-platform-finance-api
</artifactId>
<version>
4.0-SNAPSHOT
</version>
</dependency>
</dependencies>
<build>
...
...
gic-platform-finance-service/src/main/java/com/gic/finance/dao/mapper/T.java
deleted
100644 → 0
View file @
e87a42df
package
com
.
gic
.
finance
.
dao
.
mapper
;
public
class
T
{
}
gic-platform-finance-service/src/main/java/com/gic/finance/dao/mapper/TabTransferAccountsApprovalMapper.java
0 → 100644
View file @
a3a0a192
package
com
.
gic
.
finance
.
dao
.
mapper
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
import
com.gic.finance.entity.TabTransferAccountsApproval
;
public
interface
TabTransferAccountsApprovalMapper
{
/**
* 根据主键删除
*
* @param transferApprovalId 主键
* @return 更新条目数
*/
int
deleteByPrimaryKey
(
Integer
transferApprovalId
);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
insert
(
TabTransferAccountsApproval
record
);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
insertSelective
(
TabTransferAccountsApproval
record
);
/**
* 根据主键查询
*
* @param transferApprovalId 主键
* @return 实体对象
*/
TabTransferAccountsApproval
selectByPrimaryKey
(
Integer
transferApprovalId
);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
updateByPrimaryKeySelective
(
TabTransferAccountsApproval
record
);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
updateByPrimaryKey
(
TabTransferAccountsApproval
record
);
List
<
TabTransferAccountsApproval
>
listTransferAccountsApproval
(
@Param
(
"search"
)
String
search
,
@Param
(
"approvalStatus"
)
Integer
approvalStatus
,
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
}
\ No newline at end of file
gic-platform-finance-service/src/main/java/com/gic/finance/entity/T.java
deleted
100644 → 0
View file @
e87a42df
package
com
.
gic
.
finance
.
entity
;
public
class
T
{
}
gic-platform-finance-service/src/main/java/com/gic/finance/entity/TabTransferAccountsApproval.java
0 → 100644
View file @
a3a0a192
package
com
.
gic
.
finance
.
entity
;
import
java.util.Date
;
/**
* tab_transfer_accounts_approval
*/
public
class
TabTransferAccountsApproval
{
/**
*
*/
private
Integer
transferApprovalId
;
/**
* 关联订单流水号
*/
private
String
orderNumber
;
/**
* 关联订单平台方(商户类型)1:GIC 2: 好办
*/
private
Integer
platformType
;
/**
* 发起方1:商户 2:运维后台
*/
private
Integer
initiatorType
;
/**
* 发起方姓名
*/
private
String
initiatorName
;
/**
*
*/
private
Integer
enterpriseId
;
/**
* 计划金额
*/
private
Double
plannedAmount
;
/**
* 坏账金额
*/
private
Double
badAmount
;
/**
* 到账金额
*/
private
Double
accountAmount
;
/**
* 验证码
*/
private
String
verifyCode
;
/**
* 审批流水号
*/
private
String
approvalNumber
;
/**
* 审批状态 1:待审批 2:已取消 3:已驳回 4:审批通过
*/
private
Integer
approvalStatus
;
/**
* 审批人
*/
private
String
approvalId
;
/**
* 审批人姓名
*/
private
String
approvalName
;
/**
* 审批时间
*/
private
Date
approvalTime
;
/**
*
*/
private
Date
createTime
;
/**
*
*/
private
Date
updateTime
;
/**
* 审批人手机号码
*/
private
String
approvalPhone
;
/**
* 审批人手机号国际区号
*/
private
String
approvalPhoneAreaCode
;
/**
* 商户名称
*/
private
String
enterpriseName
;
/**
* 公司名称
*/
private
String
companyName
;
/**
* 公司logo
*/
private
String
logo
;
/**
* 1:套餐包 2:拓展包 3:服务 4:短信套餐包 5:充值
*/
private
Integer
orderType
;
public
Integer
getTransferApprovalId
()
{
return
transferApprovalId
;
}
public
void
setTransferApprovalId
(
Integer
transferApprovalId
)
{
this
.
transferApprovalId
=
transferApprovalId
;
}
public
String
getOrderNumber
()
{
return
orderNumber
;
}
public
void
setOrderNumber
(
String
orderNumber
)
{
this
.
orderNumber
=
orderNumber
;
}
public
Integer
getPlatformType
()
{
return
platformType
;
}
public
void
setPlatformType
(
Integer
platformType
)
{
this
.
platformType
=
platformType
;
}
public
Integer
getInitiatorType
()
{
return
initiatorType
;
}
public
void
setInitiatorType
(
Integer
initiatorType
)
{
this
.
initiatorType
=
initiatorType
;
}
public
String
getInitiatorName
()
{
return
initiatorName
;
}
public
void
setInitiatorName
(
String
initiatorName
)
{
this
.
initiatorName
=
initiatorName
;
}
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
Integer
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
Double
getPlannedAmount
()
{
return
plannedAmount
;
}
public
void
setPlannedAmount
(
Double
plannedAmount
)
{
this
.
plannedAmount
=
plannedAmount
;
}
public
Double
getBadAmount
()
{
return
badAmount
;
}
public
void
setBadAmount
(
Double
badAmount
)
{
this
.
badAmount
=
badAmount
;
}
public
Double
getAccountAmount
()
{
return
accountAmount
;
}
public
void
setAccountAmount
(
Double
accountAmount
)
{
this
.
accountAmount
=
accountAmount
;
}
public
String
getVerifyCode
()
{
return
verifyCode
;
}
public
void
setVerifyCode
(
String
verifyCode
)
{
this
.
verifyCode
=
verifyCode
;
}
public
String
getApprovalNumber
()
{
return
approvalNumber
;
}
public
void
setApprovalNumber
(
String
approvalNumber
)
{
this
.
approvalNumber
=
approvalNumber
;
}
public
Integer
getApprovalStatus
()
{
return
approvalStatus
;
}
public
void
setApprovalStatus
(
Integer
approvalStatus
)
{
this
.
approvalStatus
=
approvalStatus
;
}
public
String
getApprovalId
()
{
return
approvalId
;
}
public
void
setApprovalId
(
String
approvalId
)
{
this
.
approvalId
=
approvalId
;
}
public
String
getApprovalName
()
{
return
approvalName
;
}
public
void
setApprovalName
(
String
approvalName
)
{
this
.
approvalName
=
approvalName
;
}
public
Date
getApprovalTime
()
{
return
approvalTime
;
}
public
void
setApprovalTime
(
Date
approvalTime
)
{
this
.
approvalTime
=
approvalTime
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
String
getApprovalPhone
()
{
return
approvalPhone
;
}
public
void
setApprovalPhone
(
String
approvalPhone
)
{
this
.
approvalPhone
=
approvalPhone
;
}
public
String
getApprovalPhoneAreaCode
()
{
return
approvalPhoneAreaCode
;
}
public
void
setApprovalPhoneAreaCode
(
String
approvalPhoneAreaCode
)
{
this
.
approvalPhoneAreaCode
=
approvalPhoneAreaCode
;
}
public
String
getEnterpriseName
()
{
return
enterpriseName
;
}
public
void
setEnterpriseName
(
String
enterpriseName
)
{
this
.
enterpriseName
=
enterpriseName
;
}
public
String
getCompanyName
()
{
return
companyName
;
}
public
void
setCompanyName
(
String
companyName
)
{
this
.
companyName
=
companyName
;
}
public
String
getLogo
()
{
return
logo
;
}
public
void
setLogo
(
String
logo
)
{
this
.
logo
=
logo
;
}
public
Integer
getOrderType
()
{
return
orderType
;
}
public
void
setOrderType
(
Integer
orderType
)
{
this
.
orderType
=
orderType
;
}
}
\ No newline at end of file
gic-platform-finance-service/src/main/java/com/gic/finance/service/TransferAccountsApprovalService.java
0 → 100644
View file @
a3a0a192
package
com
.
gic
.
finance
.
service
;
import
com.gic.finance.dto.TransferAccountsApprovalDTO
;
import
com.gic.finance.entity.TabTransferAccountsApproval
;
import
com.github.pagehelper.Page
;
/**
* 转账审批
* @author $user$
* @ClassName: $ClassName$
* @Description: $desc$
* @date $date$ $time$
*/
public
interface
TransferAccountsApprovalService
{
/**
* 发起审批
* @param transferAccountsApprovalDTO
* @return
*/
int
initiateApproval
(
TransferAccountsApprovalDTO
transferAccountsApprovalDTO
);
/**
* 主键查询
* @param transferApprovalId
* @return
*/
TabTransferAccountsApproval
getById
(
Integer
transferApprovalId
);
void
updateTransferAccountsApproval
(
TransferAccountsApprovalDTO
transferAccountsApprovalDTO
);
Page
<
TransferAccountsApprovalDTO
>
listTransferAccountsApproval
(
String
search
,
Integer
approvalStatus
,
Integer
enterpriseId
,
Integer
pageNum
,
Integer
pageSize
);
}
gic-platform-finance-service/src/main/java/com/gic/finance/service/impl/T.java
deleted
100644 → 0
View file @
e87a42df
package
com
.
gic
.
finance
.
service
.
impl
;
public
class
T
{
}
gic-platform-finance-service/src/main/java/com/gic/finance/service/impl/TransferAccountsApprovalServiceImpl.java
0 → 100644
View file @
a3a0a192
package
com
.
gic
.
finance
.
service
.
impl
;
import
java.util.Date
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.finance.dao.mapper.TabTransferAccountsApprovalMapper
;
import
com.gic.finance.dto.TransferAccountsApprovalDTO
;
import
com.gic.finance.entity.TabTransferAccountsApproval
;
import
com.gic.finance.service.TransferAccountsApprovalService
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
/**
* @author $user$
* @ClassName: $ClassName$
* @Description: $desc$
* @date $date$ $time$
*/
@Service
(
"transferAccountsApprovalService"
)
public
class
TransferAccountsApprovalServiceImpl
implements
TransferAccountsApprovalService
{
@Autowired
private
TabTransferAccountsApprovalMapper
tabTransferAccountsApprovalMapper
;
@Override
public
int
initiateApproval
(
TransferAccountsApprovalDTO
transferAccountsApprovalDTO
)
{
TabTransferAccountsApproval
transfer
=
EntityUtil
.
changeEntityNew
(
TabTransferAccountsApproval
.
class
,
transferAccountsApprovalDTO
);
tabTransferAccountsApprovalMapper
.
insertSelective
(
transfer
);
return
1
;
}
@Override
public
TabTransferAccountsApproval
getById
(
Integer
transferApprovalId
)
{
return
tabTransferAccountsApprovalMapper
.
selectByPrimaryKey
(
transferApprovalId
);
}
@Override
public
void
updateTransferAccountsApproval
(
TransferAccountsApprovalDTO
transferAccountsApprovalDTO
)
{
transferAccountsApprovalDTO
.
setUpdateTime
(
new
Date
());
TabTransferAccountsApproval
transfer
=
EntityUtil
.
changeEntityNew
(
TabTransferAccountsApproval
.
class
,
transferAccountsApprovalDTO
);
tabTransferAccountsApprovalMapper
.
updateByPrimaryKeySelective
(
transfer
);
}
@Override
public
Page
<
TransferAccountsApprovalDTO
>
listTransferAccountsApproval
(
String
search
,
Integer
approvalStatus
,
Integer
enterpriseId
,
Integer
pageNum
,
Integer
pageSize
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
return
null
;
}
}
gic-platform-finance-service/src/main/java/com/gic/finance/service/outer/impl/T.java
deleted
100644 → 0
View file @
e87a42df
package
com
.
gic
.
finance
.
service
.
outer
.
impl
;
public
class
T
{
}
gic-platform-finance-service/src/main/java/com/gic/finance/service/outer/impl/TransferAccountsApprovalApiServiceImpl.java
0 → 100644
View file @
a3a0a192
package
com
.
gic
.
finance
.
service
.
outer
.
impl
;
import
java.util.Date
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.finance.constant.TransferAccountApprovalStatusEnum
;
import
com.gic.finance.dto.TransferAccountsApprovalDTO
;
import
com.gic.finance.entity.TabTransferAccountsApproval
;
import
com.gic.finance.service.TransferAccountsApprovalApiService
;
import
com.gic.finance.service.TransferAccountsApprovalService
;
import
com.gic.store.utils.CreateSerialNumberUtils
;
import
com.gic.store.utils.valid.ValidUtil
;
/**
* 转账审批
* @author $user$
* @ClassName: $ClassName$
* @Description: $desc$
* @date $date$ $time$
*/
@Service
(
"transferAccountsApprovalApiService"
)
public
class
TransferAccountsApprovalApiServiceImpl
implements
TransferAccountsApprovalApiService
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
TransferAccountsApprovalApiServiceImpl
.
class
);
private
final
static
String
SERVICE_NAME
=
"转账审批"
;
@Autowired
private
TransferAccountsApprovalService
transferAccountsApprovalService
;
@Override
public
ServiceResponse
<
Integer
>
initiateApproval
(
TransferAccountsApprovalDTO
transferAccountsApprovalDTO
)
{
//valid param
ServiceResponse
paramValid
=
ValidUtil
.
allCheckValidate
(
transferAccountsApprovalDTO
,
TransferAccountsApprovalDTO
.
InitiateApprovalValid
.
class
);
if
(!
paramValid
.
isSuccess
())
{
return
paramValid
;
}
transferAccountsApprovalDTO
.
setCreateTime
(
new
Date
());
transferAccountsApprovalDTO
.
setUpdateTime
(
new
Date
());
transferAccountsApprovalDTO
.
setApprovalStatus
(
TransferAccountApprovalStatusEnum
.
TO_BE_APPROVED
.
getCode
());
//审批流水号生成
String
approvalSerialNumber
=
CreateSerialNumberUtils
.
createSerialNumber
();
LOGGER
.
info
(
"转账审批-发起审批-审批流水号:{}"
,
approvalSerialNumber
);
transferAccountsApprovalDTO
.
setApprovalNumber
(
approvalSerialNumber
);
transferAccountsApprovalService
.
initiateApproval
(
transferAccountsApprovalDTO
);
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
TransferAccountsApprovalDTO
>
getById
(
Integer
transferApprovalId
)
{
LOGGER
.
info
(
SERVICE_NAME
+
"-getById:{}"
,
transferApprovalId
);
TabTransferAccountsApproval
tab
=
transferAccountsApprovalService
.
getById
(
transferApprovalId
);
if
(
tab
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"转账审批主键有误"
);
}
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityNew
(
TransferAccountsApprovalDTO
.
class
,
tab
));
}
@Override
public
ServiceResponse
<
Void
>
agreeApproval
(
Integer
transferApprovalId
,
Double
accountAmount
)
{
TabTransferAccountsApproval
tab
=
transferAccountsApprovalService
.
getById
(
transferApprovalId
);
if
(
tab
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"转账审批主键有误"
);
}
TransferAccountsApprovalDTO
dto
=
new
TransferAccountsApprovalDTO
();
dto
.
setTransferApprovalId
(
transferApprovalId
);
dto
.
setAccountAmount
(
accountAmount
);
dto
.
setApprovalStatus
(
TransferAccountApprovalStatusEnum
.
AGREE
.
getCode
());
dto
.
setApprovalTime
(
new
Date
());
//todo 审批人等信息获取插入
transferAccountsApprovalService
.
updateTransferAccountsApproval
(
dto
);
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
Void
>
rejectApproval
(
Integer
transferApprovalId
)
{
TabTransferAccountsApproval
tab
=
transferAccountsApprovalService
.
getById
(
transferApprovalId
);
if
(
tab
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"转账审批主键有误"
);
}
TransferAccountsApprovalDTO
dto
=
new
TransferAccountsApprovalDTO
();
dto
.
setTransferApprovalId
(
transferApprovalId
);
dto
.
setApprovalStatus
(
TransferAccountApprovalStatusEnum
.
REJECT
.
getCode
());
dto
.
setApprovalTime
(
new
Date
());
//todo 审批人等信息获取插入
transferAccountsApprovalService
.
updateTransferAccountsApproval
(
dto
);
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
Page
<
TransferAccountsApprovalDTO
>>
listTransferAccountsApproval
(
String
search
,
Integer
approvalStatus
,
Integer
enterpriseId
,
Integer
pageNum
,
Integer
pageSize
)
{
com
.
github
.
pagehelper
.
Page
page
=
transferAccountsApprovalService
.
listTransferAccountsApproval
(
search
,
approvalStatus
,
enterpriseId
,
pageNum
,
pageSize
);
Page
<
TransferAccountsApprovalDTO
>
resultPage
=
PageHelperUtils
.
changePageHelperToCurrentPage
(
page
);
return
ServiceResponse
.
success
(
resultPage
);
}
@Override
public
ServiceResponse
<
TransferAccountsApprovalDTO
>
getDetailById
(
Integer
transferApprovalId
)
{
return
null
;
}
}
gic-platform-finance-service/src/main/resources/dubbo-gic-platform-finance-service.xml
View file @
a3a0a192
...
...
@@ -15,4 +15,7 @@
<dubbo:protocol
name=
"dubbo"
port=
"20330"
/>
<!--转账审批-->
<dubbo:service
interface=
"com.gic.finance.service.TransferAccountsApprovalApiService"
ref=
"transferAccountsApprovalApiService"
timeout=
"60000"
/>
</beans>
gic-platform-finance-service/src/main/resources/mapper/TabTransferAccountsApprovalMapper.xml
0 → 100644
View file @
a3a0a192
This diff is collapsed.
Click to expand it.
gic-platform-finance-web/pom.xml
View file @
a3a0a192
...
...
@@ -122,6 +122,11 @@
<artifactId>
gic-redis-data
</artifactId>
<version>
${gic-redis-data}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-platform-finance-api
</artifactId>
<version>
4.0-SNAPSHOT
</version>
</dependency>
</dependencies>
<build>
...
...
gic-platform-finance-web/src/main/java/com/gic/finance/web/controller/T.java
deleted
100644 → 0
View file @
e87a42df
package
com
.
gic
.
finance
.
web
.
controller
;
public
class
T
{
}
gic-platform-finance-web/src/main/java/com/gic/finance/web/controller/TransferAccountsApprovalController.java
0 → 100644
View file @
a3a0a192
package
com
.
gic
.
finance
.
web
.
controller
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.web.qo.PageQO
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.response.EnterpriseRestResponse
;
import
com.gic.finance.dto.TransferAccountsApprovalDTO
;
import
com.gic.finance.service.TransferAccountsApprovalApiService
;
import
com.gic.finance.web.utils.ResultControllerUtils
;
/**
* 转账审批
* @ClassName: TransferAccountsApprovalController
* @Description:
* @author guojuxing
* @date 2019/8/9 5:05 PM
*/
@RestController
@RequestMapping
(
"/transfer-accounts-approval"
)
public
class
TransferAccountsApprovalController
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
TransferAccountsApprovalController
.
class
);
@Autowired
private
TransferAccountsApprovalApiService
transferAccountsApprovalApiService
;
/**
* 发起审批
* @param dto
* @return
*/
@RequestMapping
(
"/initiate-approval"
)
public
RestResponse
initiateApproval
(
TransferAccountsApprovalDTO
dto
)
{
return
ResultControllerUtils
.
commonResult
(
transferAccountsApprovalApiService
.
initiateApproval
(
dto
));
}
@RequestMapping
(
"/get-approval"
)
public
RestResponse
getById
(
Integer
id
)
{
return
ResultControllerUtils
.
commonResult
(
transferAccountsApprovalApiService
.
getDetailById
(
id
));
}
@RequestMapping
(
"/agree-approval"
)
public
RestResponse
agreeApproval
(
Integer
id
,
Double
accountAmount
)
{
return
ResultControllerUtils
.
commonResult
(
transferAccountsApprovalApiService
.
agreeApproval
(
id
,
accountAmount
));
}
@RequestMapping
(
"/reject-approval"
)
public
RestResponse
rejectApproval
(
Integer
id
)
{
return
ResultControllerUtils
.
commonResult
(
transferAccountsApprovalApiService
.
rejectApproval
(
id
));
}
@RequestMapping
(
"/list-approval"
)
public
RestResponse
listTransferAccountsApproval
(
String
search
,
Integer
approvalStatus
,
Integer
enterpriseId
,
PageQO
pageQO
)
{
ServiceResponse
<
Page
<
TransferAccountsApprovalDTO
>>
result
=
transferAccountsApprovalApiService
.
listTransferAccountsApproval
(
search
,
approvalStatus
,
enterpriseId
,
pageQO
.
getCurrentPage
(),
pageQO
.
getPageSize
());
if
(
result
.
isSuccess
())
{
return
RestResponse
.
success
(
result
.
getResult
());
}
else
{
return
EnterpriseRestResponse
.
failure
(
result
);
}
}
}
gic-platform-finance-web/src/main/java/com/gic/finance/web/exception/GlobalExceptionHandler.java
0 → 100644
View file @
a3a0a192
package
com
.
gic
.
finance
.
web
.
exception
;
import
java.io.ByteArrayOutputStream
;
import
java.io.PrintWriter
;
import
java.util.List
;
import
java.util.Set
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.ConstraintViolation
;
import
javax.validation.ConstraintViolationException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.validation.BindException
;
import
org.springframework.validation.FieldError
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.finance.exception.FinanceException
;
import
com.gic.store.exception.StoreException
;
/**
* 全局异常处理类
*
* @author hua
*/
@ControllerAdvice
public
class
GlobalExceptionHandler
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
GlobalExceptionHandler
.
class
);
@ResponseBody
@ExceptionHandler
(
Exception
.
class
)
public
RestResponse
controllerException
(
HttpServletResponse
response
,
Exception
ex
)
{
logger
.
error
(
"err"
,
ex
);
RestResponse
failureResponse
=
getRestResponse
(
ErrorCode
.
SYSTEM_ERROR
.
getCode
(),
ErrorCode
.
SYSTEM_ERROR
.
getMsg
());
StringBuilder
sb
=
new
StringBuilder
();
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
try
(
PrintWriter
printWriter
=
new
PrintWriter
(
baos
))
{
ex
.
printStackTrace
(
printWriter
);
}
try
{
sb
.
append
(
baos
.
toString
());
}
catch
(
Exception
ignored
)
{
}
if
(
sb
.
length
()
==
0
)
{
sb
.
append
(
ex
.
getMessage
());
}
// 输出详细错误信息,便于调试
failureResponse
.
setDetailError
(
sb
.
toString
());
return
failureResponse
;
}
/**
* 参数校验异常统一处理
* @param e
* @return
*/
@ResponseBody
@ExceptionHandler
(
BindException
.
class
)
public
RestResponse
customException
(
BindException
e
)
{
List
<
FieldError
>
fieldErrors
=
e
.
getFieldErrors
();
StringBuilder
errorMessage
=
new
StringBuilder
();
fieldErrors
.
forEach
(
fieldError
->
{
errorMessage
.
append
(
fieldError
.
getDefaultMessage
())
.
append
(
","
);
});
return
getRestResponse
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
errorMessage
.
toString
());
}
@ResponseBody
@ExceptionHandler
(
ConstraintViolationException
.
class
)
public
RestResponse
constraintViolationException
(
ConstraintViolationException
e
)
{
Set
<
ConstraintViolation
<?>>
constraintViolations
=
e
.
getConstraintViolations
();
String
paramName
=
constraintViolations
.
iterator
().
next
().
getPropertyPath
().
toString
();
String
paramError
=
constraintViolations
.
iterator
().
next
().
getMessage
();
return
getRestResponse
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
getFailFastMsg
(
paramName
,
paramError
));
}
/**
* 自定义异常统一处理
* @param e
* @return
*/
@ResponseBody
@ExceptionHandler
(
StoreException
.
class
)
public
RestResponse
customException
(
StoreException
e
)
{
return
getRestResponse
(
e
.
getErrorCode
(),
e
.
getMessage
());
}
@ResponseBody
@ExceptionHandler
(
FinanceException
.
class
)
public
RestResponse
customException
(
FinanceException
e
)
{
return
getRestResponse
(
e
.
getErrorCode
(),
e
.
getMessage
());
}
private
RestResponse
getRestResponse
(
String
errorCode
,
String
message
)
{
return
RestResponse
.
failure
(
errorCode
,
message
);
}
private
static
String
getFailFastMsg
(
String
paramName
,
String
paramError
)
{
return
String
.
format
(
"%s:%s"
,
paramName
,
paramError
);
}
}
gic-platform-finance-web/src/main/java/com/gic/finance/web/exception/T.java
deleted
100644 → 0
View file @
e87a42df
package
com
.
gic
.
finance
.
web
.
exception
;
public
class
T
{
}
gic-platform-finance-web/src/main/java/com/gic/finance/web/utils/ResultControllerUtils.java
0 → 100644
View file @
a3a0a192
package
com
.
gic
.
finance
.
web
.
utils
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.finance.exception.FinanceException
;
/**
* controller统一返回工具类
* @ClassName: ResultControllerUtils
* @Description:
* @author guojuxing
* @date 2019/8/9 5:12 PM
*/
public
class
ResultControllerUtils
{
/**
* 统一返回成功结果
* @Title: commonResult
* @Description:
* @author guojuxing
* @param response
* @return java.lang.Object
*/
public
static
RestResponse
commonResult
(
ServiceResponse
response
)
{
if
(
response
.
isSuccess
())
{
return
RestResponse
.
success
(
response
.
getResult
());
}
else
{
throw
new
FinanceException
(
response
);
}
}
}
gic-platform-finance-web/src/main/resources/dubbo-gic-platform-finance-web.xml
View file @
a3a0a192
...
...
@@ -35,4 +35,7 @@
<dubbo:reference
interface=
"com.gic.store.service.ProvincesApiService"
id=
"provincesApiService"
timeout=
"60000"
/>
<dubbo:reference
interface=
"com.gic.store.service.StoreStatusSettingApiService"
id=
"storeStatusSettingApiService"
timeout=
"60000"
/>
<dubbo:reference
interface=
"com.gic.log.api.service.LogApiService"
id=
"logApiService"
timeout=
"60000"
/>
<!--转账审批-->
<dubbo:reference
interface=
"com.gic.finance.service.TransferAccountsApprovalApiService"
id=
"transferAccountsApprovalApiService"
timeout=
"60000"
/>
</beans>
\ No newline at end of file
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