Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
manager
Project
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
reyun
manager
Commits
919f3ba4
Commit
919f3ba4
authored
4 years ago
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整金
parent
4ad08b19
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
16 deletions
+46
-16
ContractController.java
src/main/java/common/controller/ContractController.java
+23
-14
Contract.java
src/main/java/common/model/Contract.java
+9
-0
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+14
-2
No files found.
src/main/java/common/controller/ContractController.java
View file @
919f3ba4
...
...
@@ -26,7 +26,9 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStreamWriter
;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.text.DecimalFormat
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -438,7 +440,7 @@ public class ContractController {
@RequestMapping
(
value
=
"/shareincome/export"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
@ResponseBody
@AuthKey
(
AuthMenuEnmm
.
SHARED_INCOME_E
)
public
ResponseEntity
<
byte
[]>
shareIncomeExport
(
@CurrentAccount
User
loginAccount
,
@PathVariable
String
platform
,
public
void
shareIncomeExport
(
@CurrentAccount
User
loginAccount
,
@PathVariable
String
platform
,
@RequestParam
String
startDate
,
@RequestParam
String
endDate
,
String
bodyCode
,
String
serchName
,
HttpServletResponse
response
,
HttpServletRequest
request
)
{
...
...
@@ -464,25 +466,32 @@ public class ContractController {
}
}
InputStream
in
=
new
ByteArrayInputStream
(
sb
.
toString
().
getBytes
());
OutputStreamWriter
osw
=
null
;
String
fileName
=
"分摊收入报表("
+
new
DateTime
(
startDate
).
toString
(
"yyyyMMdd"
)
+
"_"
+
new
DateTime
(
endDate
).
toString
(
"yyyyMMdd"
)
+
").csv"
;
try
{
content
=
IOUtils
.
toByteArray
(
in
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
String
fileName
=
"contract_shareincome_"
+
new
DateTime
().
toString
(
"yyyy_MM_dd"
)
+
".csv"
;
HttpHeaders
headers
=
new
HttpHeaders
();
fileName
=
URLEncoder
.
encode
(
fileName
,
"UTF-8"
);
response
.
setHeader
(
"filename"
,
fileName
);
response
.
setHeader
(
"content-disposition"
,
"attachment; filename="
+
fileName
);
response
.
setHeader
(
"Content-Type"
,
"text/csv"
);
response
.
setContentType
(
"APPLICATION/OCTET-STREAM"
);
osw
=
new
OutputStreamWriter
(
response
.
getOutputStream
(),
"UTF-8"
);
// osw.write(new String(new byte[]{(byte) 0xEF, (byte) 0xBB, (byte) 0xBF})+"\n");
osw
.
write
(
sb
.
toString
());
osw
.
flush
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"导出分摊收入报错"
,
e
);
}
finally
{
if
(
osw
!=
null
)
{
try
{
osw
.
close
();
}
catch
(
IOException
e
)
{
logger
.
error
(
"导出分摊收入关闭流报错"
,
e
);
}
}
NewUserLogThread
userlog
=
new
NewUserLogThread
(
loginAccount
.
getEmail
(),
loginAccount
.
getName
(),
OperateObjectTypeEnum
.
INNERUSER
.
getKey
(),
platform
,
"导出分摊收入报表"
,
startDate
,
endDate
,
request
,
platform
);
userlog
.
start
();
//返回文件字符串
return
new
ResponseEntity
<
byte
[]>(
content
,
headers
,
HttpStatus
.
CREATED
);
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/common/model/Contract.java
View file @
919f3ba4
...
...
@@ -56,6 +56,7 @@ public class Contract {
private
Long
firstBackId
;
//先回款记录的id
private
Long
adjustmentFund
;
// 分摊收入调整金额 (*100的结果)
private
String
adjustmentFundForm
;
// 表单提交的值(分摊收入调整金额)
private
Integer
intervalUseDays
;
//区间使用天数
private
Long
incomeExcludingTax
;
//不含税收入 (*100的结果)
private
Long
intervaIncomeShare
;
//区间分摊收入(*100的结果)
...
...
@@ -493,6 +494,14 @@ public class Contract {
this
.
incomeShareAll
=
incomeShareAll
;
}
@Transient
public
String
getAdjustmentFundForm
()
{
return
adjustmentFundForm
;
}
public
void
setAdjustmentFundForm
(
String
adjustmentFundForm
)
{
this
.
adjustmentFundForm
=
adjustmentFundForm
;
}
// public String getCreaterName() {
// return createrName;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
919f3ba4
...
...
@@ -514,7 +514,7 @@ public class ContractServiceImpl implements ContractService {
// }
this
.
calculateShareIncome
(
resource
);
this
.
calculateShareIncome
(
resource
);
//判断是否计算调整金
resource
=
contractRepository
.
save
(
resource
);
...
...
@@ -524,6 +524,14 @@ public class ContractServiceImpl implements ContractService {
}
public
void
calculateShareIncome
(
Contract
resource
)
{
if
(!
StringUtils
.
isEmpty
(
resource
.
getAdjustmentFundForm
()))
{
//表单有输入值 则优先保存该值
resource
.
setAdjustmentFund
(
Long
.
parseLong
(
resource
.
getAdjustmentFundForm
()));
return
;
}
DateTime
formStart
=
new
DateTime
(
resource
.
getStartDate
());
DateTime
contractStart
=
new
DateTime
(
resource
.
getStartDate
());
DateTime
contractEnd
=
new
DateTime
(
resource
.
getEndDate
());
...
...
@@ -776,10 +784,10 @@ public class ContractServiceImpl implements ContractService {
resource
.
setCreateName
(
contract
.
getCreateName
());
resource
.
setCreateAccount
(
contract
.
getCreateAccount
());
resource
.
setCreateTime
(
contract
.
getCreateTime
());
resource
.
setModifyTime
(
new
Date
());
resource
.
setDs
(
contract
.
getDs
());
resource
.
setProduct
(
contract
.
getProduct
());
resource
.
setModifyTime
(
new
Date
());
if
(
null
!=
loginUser
)
{
resource
.
setModifyAccount
(
loginUser
.
getId
());
}
...
...
@@ -2355,6 +2363,10 @@ public class ContractServiceImpl implements ContractService {
List
<
Contract
>
contracts
=
new
ArrayList
<>();
if
(
"all"
.
equals
(
bodyCode
))
{
bodyCode
=
null
;
}
List
<
String
>
financeBodies
=
null
;
if
(
RoleEnum
.
FINANCE
.
getKey
().
equals
(
loginAccount
.
getRole
()))
{
Auth
auth
=
authRepository
.
findByUser
(
loginAccount
.
getId
());
...
...
This diff is collapsed.
Click to expand it.
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