Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bailuntec-cost
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
huluobin
bailuntec-cost
Commits
247446d9
Commit
247446d9
authored
Mar 22, 2023
by
jianshuqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整提交出纳付款单逻辑
parent
4d8108f0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
29 deletions
+68
-29
CurUtils.java
...ice/src/main/java/com/blt/other/common/util/CurUtils.java
+20
-14
Lend2PayCostServiceImpl.java
...odule/cost/service/impl/cost/Lend2PayCostServiceImpl.java
+7
-1
PayCostServiceImpl.java
...her/module/cost/service/impl/cost/PayCostServiceImpl.java
+38
-14
CostPlanNewReceiptServiceImpl.java
.../service/impl/costplan/CostPlanNewReceiptServiceImpl.java
+3
-0
No files found.
cost-service/src/main/java/com/blt/other/common/util/CurUtils.java
View file @
247446d9
...
...
@@ -2,6 +2,7 @@ package com.blt.other.common.util;
import
com.bailuntec.common.SpringContextUtil
;
import
com.blt.other.common.config.property.CostUrlProperties
;
import
com.blt.other.common.exception.BizRuntimeException
;
import
com.blt.other.module.cost.vo.CurVo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -25,22 +26,27 @@ public class CurUtils {
log
.
info
(
fromCur
);
log
.
info
(
toCur
);
CostUrlProperties
costUrlProperties
=
SpringContextUtil
.
getBean
(
CostUrlProperties
.
class
);
String
getExchangeRateApi
=
costUrlProperties
.
getExchangeRateApi
;
if
(
fromCur
.
equalsIgnoreCase
(
toCur
))
{
return
BigDecimal
.
ONE
;
}
else
{
CostUrlProperties
costUrlProperties
=
SpringContextUtil
.
getBean
(
CostUrlProperties
.
class
);
String
getExchangeRateApi
=
costUrlProperties
.
getExchangeRateApi
;
RestTemplate
restTemplate
=
new
RestTemplate
();
String
url
=
getExchangeRateApi
+
"?"
+
"fromCUr="
+
fromCur
+
"&toCur="
+
toCur
;
ResponseEntity
<
String
>
forEntity
=
restTemplate
.
getForEntity
(
url
,
String
.
class
);
if
(
200
==
forEntity
.
getStatusCodeValue
())
{
String
body
=
forEntity
.
getBody
();
assert
body
!=
null
;
body
=
body
.
toLowerCase
();
body
=
body
.
replace
(
"\\"
,
""
);
body
=
body
.
substring
(
1
,
body
.
length
()
-
1
);
CurVo
curVo
=
(
CurVo
)
MyMapperUtil
.
getObject
(
body
,
CurVo
.
class
);
return
curVo
.
getRate
();
RestTemplate
restTemplate
=
new
RestTemplate
();
String
url
=
getExchangeRateApi
+
"?"
+
"fromCUr="
+
fromCur
+
"&toCur="
+
toCur
;
ResponseEntity
<
String
>
forEntity
=
restTemplate
.
getForEntity
(
url
,
String
.
class
);
if
(
200
==
forEntity
.
getStatusCodeValue
())
{
String
body
=
forEntity
.
getBody
();
assert
body
!=
null
;
body
=
body
.
toLowerCase
();
body
=
body
.
replace
(
"\\"
,
""
);
body
=
body
.
substring
(
1
,
body
.
length
()
-
1
);
CurVo
curVo
=
(
CurVo
)
MyMapperUtil
.
getObject
(
body
,
CurVo
.
class
);
return
curVo
.
getRate
();
}
else
{
return
BigDecimal
.
ZERO
;
}
}
return
new
BigDecimal
(
1
);
}
public
static
String
getCurDto
(
String
dic
)
{
...
...
cost-service/src/main/java/com/blt/other/module/cost/service/impl/cost/Lend2PayCostServiceImpl.java
View file @
247446d9
...
...
@@ -6,6 +6,7 @@ import com.bailuntec.api.bailuntec.cw.request.PostApplyReq;
import
com.bailuntec.api.bailuntec.cw.response.CwResult
;
import
com.bailuntec.common.BeanUtils
;
import
com.bailuntec.common.JsonUtilByJackson
;
import
com.blt.other.common.exception.BizRuntimeException
;
import
com.blt.other.common.exception.RpcException
;
import
com.blt.other.common.util.CurUtils
;
import
com.blt.other.database.model.CostCashiercallbackDomain
;
...
...
@@ -47,6 +48,9 @@ public class Lend2PayCostServiceImpl extends AbstractCostService implements Cost
cost
.
setCostStatus
(
CostDomain
.
STATUS_PAYED
);
cost
.
setPayTime
(
new
Date
());
BigDecimal
toRmbRate
=
CurUtils
.
getCur
(
cost
.
getDic
(),
"CNY"
);
if
(
BigDecimal
.
ZERO
.
compareTo
(
toRmbRate
)
==
0
)
{
throw
new
BizRuntimeException
(
"获取汇率异常,请重试!"
);
}
cost
.
setToRmbRate
(
toRmbRate
);
cost
.
setAmountRmb
(
cost
.
getAmount
().
multiply
(
toRmbRate
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
cost
.
setAuditTime
(
new
Date
());
...
...
@@ -135,7 +139,9 @@ public class Lend2PayCostServiceImpl extends AbstractCostService implements Cost
costDomain
.
setPayTime
(
new
Date
());
costDomain
.
setActualTime
(
costCashiercallbackDomain
.
getActualTime
());
BigDecimal
toRmbRate
=
CurUtils
.
getCur
(
costDomain
.
getDic
(),
"CNY"
);
if
(
BigDecimal
.
ZERO
.
compareTo
(
toRmbRate
)
==
0
)
{
throw
new
BizRuntimeException
(
"获取汇率异常,请重试!"
);
}
costDomain
.
setToRmbRate
(
toRmbRate
);
costDomain
.
setAmountRmb
(
costDomain
.
getAmount
().
multiply
(
toRmbRate
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
costDomain
.
setAuditTime
(
new
Date
());
...
...
cost-service/src/main/java/com/blt/other/module/cost/service/impl/cost/PayCostServiceImpl.java
View file @
247446d9
...
...
@@ -6,7 +6,9 @@ import com.bailuntec.api.bailuntec.cw.response.CwResult;
import
com.bailuntec.common.BeanUtils
;
import
com.bailuntec.common.JsonUtilByFsJson
;
import
com.bailuntec.common.JsonUtilByJackson
;
import
com.blt.other.common.exception.BizRuntimeException
;
import
com.blt.other.common.exception.RpcException
;
import
com.blt.other.common.util.CurUtils
;
import
com.blt.other.database.model.CostTofinanceDomain
;
import
com.blt.other.module.cost.model.CostDetailDomain
;
import
com.blt.other.module.cost.model.CostDomain
;
...
...
@@ -17,6 +19,7 @@ import com.blt.other.module.cost.vo.TofinanceVo;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -44,23 +47,44 @@ public class PayCostServiceImpl extends AbstractCostService implements CostServi
req
.
setApplyType
(
""
+
1
);
List
<
ApplyMoneyDetail
>
applyMoneyDetailList
=
new
ArrayList
<>();
ApplyMoneyDetail
applyMoneyDetail
=
new
ApplyMoneyDetail
();
applyMoneyDetail
.
setName
(
"费用单付款"
);
applyMoneyDetail
.
setMoney
(
cost
.
getAmount
());
//todo
applyMoneyDetail
.
setMoneyRmb
(
cost
.
getAmount
());
applyMoneyDetail
.
setRemark
(
""
);
applyMoneyDetailList
.
add
(
applyMoneyDetail
);
// 出纳申请金额明细(MoneyDetail)不可为空;
req
.
setMoneyDetail
(
applyMoneyDetailList
);
// 所属项目和所属账期
if
(
cost
.
getCostDetailDomainList
()
!=
null
&&
cost
.
getCostDetailDomainList
().
size
()
>
0
){
CostDetailDomain
detailDomain
=
cost
.
getCostDetailDomainList
().
get
(
0
);
req
.
setProject
(
detailDomain
.
getProject
());
req
.
setProjectDate
(
detailDomain
.
getProjectDate
());
req
.
setCategoryName
(
detailDomain
.
getCategoryName
());
for
(
int
i
=
0
;
i
<
cost
.
getCostDetailDomainList
().
size
();
i
++)
{
CostDetailDomain
detailDomain
=
cost
.
getCostDetailDomainList
().
get
(
i
);
if
(
i
==
0
)
{
req
.
setProject
(
detailDomain
.
getProject
());
req
.
setProjectDate
(
detailDomain
.
getProjectDate
());
req
.
setCategoryName
(
detailDomain
.
getCategoryName
());
}
ApplyMoneyDetail
applyMoneyDetail
=
new
ApplyMoneyDetail
();
applyMoneyDetail
.
setName
(
"费用单付款"
);
applyMoneyDetail
.
setMoney
(
detailDomain
.
getAmount
());
BigDecimal
toRmbRate
=
CurUtils
.
getCur
(
detailDomain
.
getDic
(),
"CNY"
);
if
(
BigDecimal
.
ZERO
.
compareTo
(
toRmbRate
)
==
0
)
{
throw
new
BizRuntimeException
(
"获取汇率异常,请重试!"
);
}
applyMoneyDetail
.
setMoneyRmb
(
detailDomain
.
getAmount
().
multiply
(
toRmbRate
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
applyMoneyDetail
.
setRemark
(
""
);
applyMoneyDetail
.
setUnitCode
(
detailDomain
.
getDic
());
applyMoneyDetail
.
setUnitName
(
detailDomain
.
getDic
());
applyMoneyDetail
.
setTypeName
(
detailDomain
.
getTypeName
());
applyMoneyDetail
.
setCategoryName
(
detailDomain
.
getCategoryName
());
applyMoneyDetail
.
setProject
(
detailDomain
.
getProject
());
applyMoneyDetail
.
setProjectDate
(
detailDomain
.
getProjectDate
());
applyMoneyDetailList
.
add
(
applyMoneyDetail
);
req
.
setMoneyDetail
(
applyMoneyDetailList
);
}
}
else
{
ApplyMoneyDetail
applyMoneyDetail
=
new
ApplyMoneyDetail
();
applyMoneyDetail
.
setName
(
"费用单付款"
);
applyMoneyDetail
.
setMoney
(
cost
.
getAmount
());
//todo
applyMoneyDetail
.
setMoneyRmb
(
cost
.
getAmountRmb
());
applyMoneyDetail
.
setRemark
(
""
);
applyMoneyDetailList
.
add
(
applyMoneyDetail
);
}
// 出纳申请金额明细(MoneyDetail)不可为空;
req
.
setMoneyDetail
(
applyMoneyDetailList
);
log
.
info
(
"提交出纳参数:{}"
,
JsonUtilByFsJson
.
beanToJson
(
req
));
CwResult
<
String
>
cwResult
=
cwApi
.
postApply
(
req
);
...
...
cost-service/src/main/java/com/blt/other/module/cost/service/impl/costplan/CostPlanNewReceiptServiceImpl.java
View file @
247446d9
...
...
@@ -74,6 +74,9 @@ public class CostPlanNewReceiptServiceImpl extends AbstractCostPlanService imple
costDomain
.
setCostStatus
(
0
);
costDomain
.
setAmount
(
costPlanDomain
.
getPlanAmount
());
BigDecimal
toRmbRate
=
CurUtils
.
getCur
(
costDomain
.
getDic
(),
"CNY"
);
if
(
BigDecimal
.
ZERO
.
compareTo
(
toRmbRate
)
==
0
)
{
throw
new
BizRuntimeException
(
"获取汇率异常,请重试!"
);
}
costDomain
.
setToRmbRate
(
toRmbRate
);
costDomain
.
setAmountRmb
(
costDomain
.
getAmount
().
multiply
(
toRmbRate
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
if
(
StringUtils
.
isBlank
(
costDomain
.
getCategoryName
())){
...
...
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