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
10bea416
Commit
10bea416
authored
Oct 21, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
8165b5d1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
CostPlanNewController.java
...odule/cost/controller/costplan/CostPlanNewController.java
+51
-0
No files found.
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/controller/costplan/CostPlanNewController.java
View file @
10bea416
package
com
.
blt
.
other
.
module
.
cost
.
controller
.
costplan
;
import
com.blt.other.common.util.CurUtils
;
import
com.blt.other.module.cost.dto.CostPlanNewApiDto
;
import
com.blt.other.module.cost.service.CostPlanService
;
import
com.blt.other.module.cost.service.impl.costplan.CostPlanServiceFactory
;
...
...
@@ -7,8 +8,12 @@ import com.blt.other.module.database.model.CostPlanDomain;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -22,6 +27,8 @@ import java.util.Map;
"/cost/plan/new/receipt"
})
public
class
CostPlanNewController
{
@Value
(
"${url.api.getExchangeRateApi}"
)
private
String
getExchangeRateApi
;
@ApiOperation
(
"获取新增费用计划编号"
)
@GetMapping
(
"/getNo"
)
...
...
@@ -95,5 +102,49 @@ public class CostPlanNewController {
return
resp
;
}
@PostMapping
(
"/changeDic"
)
public
Map
<
String
,
Object
>
changeDic
(
HttpServletResponse
response
,
HttpServletRequest
request
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
String
fromDic
=
request
.
getParameter
(
"fromDic"
);
String
payCounteractStr
=
request
.
getParameter
(
"payCounteract"
);
payCounteractStr
=
payCounteractStr
.
replace
(
" "
,
""
);
BigDecimal
payCounteract
=
null
;
if
(!
payCounteractStr
.
isEmpty
())
{
payCounteract
=
new
BigDecimal
(
payCounteractStr
);
}
else
{
// result.put("success",false);
// result.put("msg","请输入合法的冲销金额");
// return result;
payCounteract
=
new
BigDecimal
(
0
);
}
String
payLendBalanceStr
=
request
.
getParameter
(
"payLendBalance"
);
payLendBalanceStr
=
payLendBalanceStr
.
replace
(
" "
,
""
);
BigDecimal
payLendBalance
=
null
;
if
(!
payLendBalanceStr
.
isEmpty
())
{
payLendBalance
=
new
BigDecimal
(
payLendBalanceStr
);
}
else
{
// result.put("success",false);
// result.put("msg","请输入合法的余额");
// return result;
payLendBalance
=
new
BigDecimal
(
0
);
}
String
toDic
=
request
.
getParameter
(
"toDic"
);
BigDecimal
cur
=
CurUtils
.
getCur
(
fromDic
,
toDic
,
getExchangeRateApi
);
BigDecimal
counteract
=
payCounteract
.
multiply
(
cur
);
BigDecimal
lendBalance
=
payLendBalance
.
multiply
(
cur
);
BigDecimal
planAmount
=
counteract
.
add
(
lendBalance
);
BigDecimal
payPlanAmount
=
payCounteract
.
add
(
payLendBalance
);
result
.
put
(
"success"
,
true
);
result
.
put
(
"counteract"
,
counteract
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
result
.
put
(
"lendBalance"
,
lendBalance
);
result
.
put
(
"planAmount"
,
planAmount
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
result
.
put
(
"payPlanAmount"
,
payPlanAmount
);
result
.
put
(
"cur"
,
cur
);
return
result
;
}
}
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