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
00227a49
Commit
00227a49
authored
Nov 25, 2021
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传附件
parent
c3405769
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
129 additions
and
21 deletions
+129
-21
pom.xml
pom.xml
+2
-1
AttachmnetUploadController.java
...in/java/common/controller/AttachmnetUploadController.java
+65
-0
PdController.java
src/main/java/common/controller/PdController.java
+18
-17
PdAttachment.java
src/main/java/common/model/PdAttachment.java
+30
-0
PdAttachmentRepository.java
src/main/java/common/repository/PdAttachmentRepository.java
+8
-0
DmpIncomeService.java
src/main/java/common/service/DmpIncomeService.java
+1
-1
DmpIncomeServiceImpl.java
src/main/java/common/service/impl/DmpIncomeServiceImpl.java
+0
-0
Constant.java
src/main/java/util/Constant.java
+1
-0
ddb.properties
src/main/resources/ddb.properties
+4
-2
No files found.
pom.xml
View file @
00227a49
...
...
@@ -178,7 +178,7 @@
<redis.event.database>
13
</redis.event.database>
<!--Redis setting//end-->
<downhost>
http://172.23.6.108:9001
</downhost>
<ddb.accesskey>
AKIAOS2UEXIFNVER2O6A
</ddb.accesskey>
<ddb.secretkey>
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
</ddb.secretkey>
<ddb.region>
cn-north-1
</ddb.region>
...
...
@@ -286,6 +286,7 @@
<redis.event.database>
13
</redis.event.database>
<!--Redis setting//end-->
<downhost>
http://172.31.25.137:9001
</downhost>
<ddb.accesskey>
AKIA3XXNRTS2KXU632MD
</ddb.accesskey>
<ddb.secretkey>
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
</ddb.secretkey>
<ddb.region>
cn-north-1
</ddb.region>
...
...
src/main/java/common/controller/AttachmnetUploadController.java
0 → 100644
View file @
00227a49
package
common
.
controller
;
import
common.model.DmpIncome
;
import
common.model.PdAttachment
;
import
common.model.User
;
import
common.service.DmpIncomeService
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
security.annotation.CurrentAccount
;
import
util.ResultModel
;
@Controller
@RequestMapping
(
"{platform}"
)
public
class
AttachmnetUploadController
{
@Autowired
DmpIncomeService
dmpIncomeService
;
//上传附件
@PostMapping
(
"/upload/attachment"
)
@ResponseBody
public
ResultModel
uploadAttach
(
@RequestParam
(
"file"
)
MultipartFile
[]
files
,
String
contractCode
,
@CurrentAccount
User
user
)
{
String
erroNames
=
""
;
for
(
MultipartFile
file
:
files
)
{
PdAttachment
attachment
=
dmpIncomeService
.
uploadPdAttach
(
file
,
contractCode
,
user
);
if
(
attachment
.
getFaild
())
{
erroNames
+=
" "
+
attachment
.
getFileOrginName
();
}
}
if
(!
StringUtils
.
isEmpty
(
erroNames
))
{
return
ResultModel
.
ERROR
(
5001
,
"文件:"
+
erroNames
+
"上传失败"
);
}
return
ResultModel
.
OK
();
}
//下载附加
@RequestMapping
(
value
=
"/download/attachment/{id}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
public
ResponseEntity
<
byte
[]>
getDownloadResponseEntity
(
@PathVariable
Long
id
)
{
return
dmpIncomeService
.
downloadAttach
(
id
);
}
//删除附件
@PostMapping
(
"/delete/attachment/{id}"
)
@ResponseBody
public
ResultModel
deleteAttach
(
@PathVariable
Long
id
)
{
return
ResultModel
.
OK
(
dmpIncomeService
.
deleteAttach
(
id
));
}
//附件列表
@GetMapping
(
"/list/attachment"
)
@ResponseBody
public
ResultModel
attachList
(
String
code
,
String
startDate
,
String
endDate
,
@PathVariable
String
platform
)
{
return
dmpIncomeService
.
attachList
(
code
,
startDate
,
endDate
,
platform
);
}
}
src/main/java/common/controller/PdController.java
View file @
00227a49
...
...
@@ -48,22 +48,23 @@ public class PdController {
return
ResultModel
.
OK
(
dmpIncomeService
.
pdDelete
(
income
));
}
//上传附件
@PostMapping
(
"/upload/attachment"
)
public
ResultModel
uploadAttach
(
@RequestParam
(
"file"
)
MultipartFile
file
,
String
contractCode
,
@CurrentAccount
User
user
)
{
////上传附件
//@PostMapping("/upload/attachment")
//public ResultModel uploadAttach(@RequestParam("file") MultipartFile file, String contractCode, @CurrentAccount User user) {
//
// return ResultModel.OK(dmpIncomeService.uploadPdAttach(file, contractCode, user));
//}
//
////下载附加
//@RequestMapping(value = "download/attachment/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
//public ResponseEntity<byte[]> getDownloadResponseEntity(@PathVariable Long id) {
// return dmpIncomeService.downloadAttach(id);
//}
//
////删除附件
//@PostMapping("/delete/load/attachment/{id}")
//public ResultModel deleteAttach(@PathVariable Long id) {
// return ResultModel.OK(dmpIncomeService.deleteAttach(id));
//}
return
ResultModel
.
OK
(
dmpIncomeService
.
uploadPdAttach
(
file
,
contractCode
,
user
));
}
//下载附加
@RequestMapping
(
value
=
"download/attachment/{id}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
public
ResponseEntity
<
byte
[]>
getDownloadResponseEntity
(
@PathVariable
Long
id
)
{
return
dmpIncomeService
.
downloadAttach
(
id
);
}
//删除附件
@PostMapping
(
"/delete/load/attachment/{id}"
)
public
ResultModel
deleteAttach
(
@PathVariable
Long
id
)
{
return
ResultModel
.
OK
(
dmpIncomeService
.
deleteAttach
(
id
));
}
}
src/main/java/common/model/PdAttachment.java
View file @
00227a49
...
...
@@ -3,6 +3,7 @@ package common.model;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Transient
;
import
java.util.Date
;
@Entity
...
...
@@ -13,7 +14,10 @@ public class PdAttachment {
private
String
fileName
;
//文件名
private
String
fileType
;
//文件类型
private
Date
uploadDate
;
//上传日期
private
String
uploadDateValue
;
private
String
uploadUser
;
private
Boolean
isFaild
;
// 是否失败
private
String
downloadUrl
;
@Id
@GeneratedValue
...
...
@@ -72,4 +76,30 @@ public class PdAttachment {
public
void
setFileType
(
String
fileType
)
{
this
.
fileType
=
fileType
;
}
@Transient
public
Boolean
getFaild
()
{
return
isFaild
;
}
public
void
setFaild
(
Boolean
faild
)
{
isFaild
=
faild
;
}
public
String
getUploadDateValue
()
{
return
uploadDateValue
;
}
public
void
setUploadDateValue
(
String
uploadDateValue
)
{
this
.
uploadDateValue
=
uploadDateValue
;
}
@Transient
public
String
getDownloadUrl
()
{
return
downloadUrl
;
}
public
void
setDownloadUrl
(
String
downloadUrl
)
{
this
.
downloadUrl
=
downloadUrl
;
}
}
src/main/java/common/repository/PdAttachmentRepository.java
View file @
00227a49
...
...
@@ -2,6 +2,14 @@ package common.repository;
import
common.model.PdAttachment
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
java.util.List
;
public
interface
PdAttachmentRepository
extends
JpaRepository
<
PdAttachment
,
Long
>
{
List
<
PdAttachment
>
findBycontractCode
(
String
code
);
@Query
(
value
=
"select * from pd_attachment where contract_code=?1 and upload_date >= ?2 and upload_date <= ?3"
,
nativeQuery
=
true
)
List
<
PdAttachment
>
findBycontractCodeAndDate
(
String
code
,
String
startDate
,
String
endDate
);
}
src/main/java/common/service/DmpIncomeService.java
View file @
00227a49
...
...
@@ -7,7 +7,6 @@ import common.model.User;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.multipart.MultipartFile
;
import
tkio.model.Account
;
import
util.ResultModel
;
import
java.util.List
;
...
...
@@ -46,4 +45,5 @@ public interface DmpIncomeService {
HSSFWorkbook
exportPdIncomeList
(
String
startDate
,
String
endDate
,
String
bodyCode
,
String
serchName
);
ResultModel
attachList
(
String
code
,
String
startDate
,
String
endDate
,
String
platform
);
}
src/main/java/common/service/impl/DmpIncomeServiceImpl.java
View file @
00227a49
This diff is collapsed.
Click to expand it.
src/main/java/util/Constant.java
View file @
00227a49
...
...
@@ -45,6 +45,7 @@ public class Constant {
public
static
String
ddbregion
=
ddbBundle
.
getString
(
"ddb.region"
);
public
static
String
bucket
=
ddbBundle
.
getString
(
"ddb.bucket"
);
public
static
String
uploadPath
=
ddbBundle
.
getString
(
"ddb.upload.path"
);
public
static
String
downhost
=
ddbBundle
.
getString
(
"downhost"
);
}
src/main/resources/ddb.properties
View file @
00227a49
...
...
@@ -2,4 +2,6 @@ ddb.accesskey=${ddb.accesskey}
ddb.secretkey
=
${ddb.secretkey}
ddb.region
=
${ddb.region}
ddb.bucket
=
${ddb.bucket}
ddb.upload.path
=
${ddb.upload.path}
\ No newline at end of file
ddb.upload.path
=
${ddb.upload.path}
downhost
=
${downhost}
\ 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