Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dc-cost-system
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
bltdc
dc-cost-system
Commits
b4c173a4
Commit
b4c173a4
authored
Sep 28, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工资系统推送费用单
parent
4f128a7c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
12 deletions
+49
-12
CostApiServiceImpl.java
...blt/other/other_cost/service/impl/CostApiServiceImpl.java
+5
-4
CostFileUtil.java
...ain/java/com/blt/other/other_cost/utils/CostFileUtil.java
+5
-8
CostFileUtilTest.java
...java/com/blt/other/other_cost/utils/CostFileUtilTest.java
+39
-0
No files found.
cost-core/src/main/java/com/blt/other/other_cost/service/impl/CostApiServiceImpl.java
View file @
b4c173a4
...
...
@@ -6,10 +6,7 @@ import com.blt.other.other_commons.utils.CurUtils;
import
com.blt.other.other_commons.utils.DateTimeUtil
;
import
com.blt.other.other_commons.utils.HttpUtil
;
import
com.blt.other.other_commons.utils.PathUtil
;
import
com.blt.other.other_cost.dao.CostDao
;
import
com.blt.other.other_cost.dao.CostDetailDao
;
import
com.blt.other.other_cost.dao.CostTypeDao
;
import
com.blt.other.other_cost.dao.CostTypeKindDao
;
import
com.blt.other.other_cost.dao.*
;
import
com.blt.other.other_cost.dto.*
;
import
com.blt.other.other_cost.service.CostApiService
;
import
com.blt.other.other_cost.service.CostService
;
...
...
@@ -63,6 +60,9 @@ public class CostApiServiceImpl implements CostApiService {
@Value
(
"${url.api.getExchangeRateApi}"
)
private
String
getExchangeRateApi
;
@Autowired
CostLogDao
costLogDao
;
@Override
@Transactional
public
String
generateLogisticsCost
(
int
costForm
,
LogisticsCostDto
logisticsCostDto
)
throws
Exception
{
...
...
@@ -340,6 +340,7 @@ public class CostApiServiceImpl implements CostApiService {
costLogDomain
.
setUpdateTime
(
new
Date
());
costLogDomain
.
setUpdateNote
(
"老板已经审批通过了"
);
costLogDomain
.
setUpdateUsercode
(
user
.
getUsercode
());
costLogDao
.
insert
(
costLogDomain
);
return
costNo
;
}
...
...
cost-core/src/main/java/com/blt/other/other_cost/utils/CostFileUtil.java
View file @
b4c173a4
...
...
@@ -4,10 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.*
;
import
java.util.UUID
;
/**
...
...
@@ -56,11 +53,11 @@ public class CostFileUtil {
dir
.
mkdirs
();
dest
.
createNewFile
();
}
InputStream
inputStream
=
new
FileIn
putStream
(
fileName
);
OutputStream
outputStream
=
new
FileOut
putStream
(
fileName
);
int
size
=
inputStream
.
read
(
bytes
);
log
.
info
(
"文件大小:{}"
,
size
);
in
putStream
.
close
();
outputStream
.
write
(
bytes
);
out
putStream
.
close
();
return
fileName
;
}
...
...
cost-core/src/test/java/com/blt/other/other_cost/utils/CostFileUtilTest.java
0 → 100644
View file @
b4c173a4
package
com
.
blt
.
other
.
other_cost
.
utils
;
import
com.blt.other.other_commons.utils.PathUtil
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.web.client.RestTemplate
;
import
java.io.IOException
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/9/28 5:25 下午
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
public
class
CostFileUtilTest
{
@Test
public
void
upload
()
{
}
@Test
public
void
testUpload
()
throws
IOException
{
RestTemplate
restTemplate
=
new
RestTemplate
();
byte
[]
bytes
=
restTemplate
.
getForObject
(
"http://imgcache.bailuntec.com/20200928170018adb228b6-f277-40ff-8d70-1a6da09c82aa工资条附件.xlsx"
,
byte
[].
class
);
// 文件上传的路径
String
filePath
=
"/Users/huluobin/Downloads/"
;
// 调用工具类执行保存,并返回 path
String
path
=
CostFileUtil
.
upload
(
"http://imgcache.bailuntec.com/20200928170018adb228b6-f277-40ff-8d70-1a6da09c82aa工资条附件.xlsx"
,
filePath
);
}
}
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