Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lcj-btp-java-app
Project
Project
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
郭智朋
lcj-btp-java-app
Commits
e68668a2
Commit
e68668a2
authored
Feb 16, 2025
by
guozhipeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传文件
parent
32fb5585
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
70 additions
and
45 deletions
+70
-45
CustomerController.js
app/router/controller/CustomerController.js
+2
-4
Party.controller.js
...uter/controller/organizationStructure/Party.controller.js
+1
-2
PrintTemplate.controller.js
app/router/controller/print/PrintTemplate.controller.js
+1
-2
PurchaseOrder.controller.js
app/router/controller/purchase/PurchaseOrder.controller.js
+9
-4
PurchaseOrderForReturn.controller.js
.../controller/purchase/PurchaseOrderForReturn.controller.js
+9
-4
SalesOrder.controller.js
app/router/controller/sales/SalesOrder.controller.js
+1
-2
mtaDeploy.sh
mtaDeploy.sh
+5
-0
AttachmentServiceImpl.java
...nchuangjie/master/service/impl/AttachmentServiceImpl.java
+42
-27
No files found.
app/router/controller/CustomerController.js
View file @
e68668a2
...
...
@@ -2790,8 +2790,7 @@ sap.ui.define(
var
headers
=
{};
//headers: headers,
if
(
that
.
getStorage
().
get
(
"csrfToken"
)
!=
null
&&
that
.
getStorage
().
get
(
"csrfToken"
)
!==
undefined
)
{
headers
=
{
'x-csrf-token'
:
that
.
getStorage
().
get
(
"csrfToken"
),
'Content-Type'
:
'application/json'
'x-csrf-token'
:
that
.
getStorage
().
get
(
"csrfToken"
)
};
}
headers
.
language
=
that
.
language
;
...
...
@@ -3360,8 +3359,7 @@ sap.ui.define(
var
headers
=
{};
//headers: headers,
if
(
that
.
getStorage
().
get
(
"csrfToken"
)
!=
null
&&
that
.
getStorage
().
get
(
"csrfToken"
)
!==
undefined
)
{
headers
=
{
'x-csrf-token'
:
that
.
getStorage
().
get
(
"csrfToken"
),
'Content-Type'
:
'application/json'
'x-csrf-token'
:
that
.
getStorage
().
get
(
"csrfToken"
)
};
}
headers
.
language
=
that
.
language
;
...
...
app/router/controller/organizationStructure/Party.controller.js
View file @
e68668a2
...
...
@@ -348,8 +348,7 @@ sap.ui.define(
var
headers
=
{};
//headers: headers,
if
(
that
.
getStorage
().
get
(
"csrfToken"
)
!=
null
&&
that
.
getStorage
().
get
(
"csrfToken"
)
!==
undefined
)
{
headers
=
{
'x-csrf-token'
:
that
.
getStorage
().
get
(
"csrfToken"
),
'Content-Type'
:
'application/json'
'x-csrf-token'
:
that
.
getStorage
().
get
(
"csrfToken"
)
};
}
headers
.
language
=
that
.
language
;
...
...
app/router/controller/print/PrintTemplate.controller.js
View file @
e68668a2
...
...
@@ -341,8 +341,7 @@ sap.ui.define(
var
headers
=
{};
//headers: headers,
if
(
that
.
getStorage
().
get
(
"csrfToken"
)
!=
null
&&
that
.
getStorage
().
get
(
"csrfToken"
)
!==
undefined
)
{
headers
=
{
'x-csrf-token'
:
that
.
getStorage
().
get
(
"csrfToken"
),
'Content-Type'
:
'application/json'
'x-csrf-token'
:
that
.
getStorage
().
get
(
"csrfToken"
)
};
}
headers
.
language
=
that
.
language
;
...
...
app/router/controller/purchase/PurchaseOrder.controller.js
View file @
e68668a2
...
...
@@ -2048,16 +2048,21 @@ sap.ui.define(
let
userAuthentication
=
this
.
loginInfo
.
userAuthentication
;
let
appKey
=
userAuthentication
.
appKey
;
var
headers
=
{};
//headers: headers,
if
(
that
.
getStorage
().
get
(
"csrfToken"
)
!=
null
&&
that
.
getStorage
().
get
(
"csrfToken"
)
!==
undefined
)
{
headers
=
{
'x-csrf-token'
:
that
.
getStorage
().
get
(
"csrfToken"
)
};
}
headers
.
language
=
that
.
language
;
headers
.
appKey
=
appKey
;
$
.
ajax
({
url
:
this
.
baseUrl
+
"attachment/batchUpload"
,
type
:
"POST"
,
headers
:
headers
,
data
:
formData
,
processData
:
false
,
contentType
:
false
,
headers
:
{
'appKey'
:
appKey
},
success
:
function
(
res
)
{
if
(
res
.
success
){
let
fileList
=
res
.
result
;
...
...
app/router/controller/purchase/PurchaseOrderForReturn.controller.js
View file @
e68668a2
...
...
@@ -1871,16 +1871,21 @@ sap.ui.define(
let
userAuthentication
=
this
.
loginInfo
.
userAuthentication
;
let
appKey
=
userAuthentication
.
appKey
;
var
headers
=
{};
//headers: headers,
if
(
that
.
getStorage
().
get
(
"csrfToken"
)
!=
null
&&
that
.
getStorage
().
get
(
"csrfToken"
)
!==
undefined
)
{
headers
=
{
'x-csrf-token'
:
that
.
getStorage
().
get
(
"csrfToken"
)
};
}
headers
.
language
=
that
.
language
;
headers
.
appKey
=
appKey
;
$
.
ajax
({
url
:
this
.
baseUrl
+
"attachment/batchUpload"
,
type
:
"POST"
,
headers
:
headers
,
data
:
formData
,
processData
:
false
,
contentType
:
false
,
headers
:
{
'appKey'
:
appKey
},
success
:
function
(
res
)
{
if
(
res
.
success
){
let
fileList
=
res
.
result
;
...
...
app/router/controller/sales/SalesOrder.controller.js
View file @
e68668a2
...
...
@@ -4331,8 +4331,7 @@ sap.ui.define(
var
headers
=
{};
//headers: headers,
if
(
that
.
getStorage
().
get
(
"csrfToken"
)
!=
null
&&
that
.
getStorage
().
get
(
"csrfToken"
)
!==
undefined
)
{
headers
=
{
'x-csrf-token'
:
that
.
getStorage
().
get
(
"csrfToken"
),
'Content-Type'
:
'application/json'
'x-csrf-token'
:
that
.
getStorage
().
get
(
"csrfToken"
)
};
}
headers
.
language
=
that
.
language
;
...
...
mtaDeploy.sh
View file @
e68668a2
...
...
@@ -146,6 +146,11 @@ common(){
starttime
=
`
date
+%s
`
secondsToTime
"
${
starttime
}
"
"
${
starttime
}
"
#登录BTP 输入密码: Gzp@123456 后回车。
echo
-e
"
\0
33[30;42m 登录BTP test 子账户 输入密码: Gzp@123456 后回车
\0
33[0m"
# 登录BTP命令:
cf login
-a
https://api.cf.cn40.platform.sapcloud.cn
-o
"Shenzhen-Lianchuangjie-Technology-Co-Ltd-test-cnrc164l"
-s
gzpTest
-u
zhipeng.guo@boscloud.cn
#校验登录状态
account
=
$(
cf services
)
accountMatch
=
'.*succeeded.*'
...
...
srv/src/main/java/customer/lianchuangjie/master/service/impl/AttachmentServiceImpl.java
View file @
e68668a2
...
...
@@ -36,6 +36,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
import
org.springframework.web.multipart.MultipartResolver
;
import
static
customer
.
lianchuangjie
.
common
.
util
.
ConvertUtils
.
getSuffix
;
...
...
@@ -54,6 +55,8 @@ public class AttachmentServiceImpl extends ServiceImpl<AttachmentDao, Attachment
private
AttachmentProductBatchDao
attachmentProductBatchDao
;
@Autowired
private
GoldSampleDao
goldSampleDao
;
@Autowired
private
MultipartResolver
multipartResolver
;
/**
* 批量上传
...
...
@@ -65,39 +68,51 @@ public class AttachmentServiceImpl extends ServiceImpl<AttachmentDao, Attachment
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<?>
batchUpload
(
HttpServletRequest
request
,
String
language
)
{
String
message
=
""
;
MultipartHttpServletRequest
multipartRequest
=
(
MultipartHttpServletRequest
)
request
;
Map
<
String
,
MultipartFile
>
fileMap
=
multipartRequest
.
getFileMap
();
List
<
JSONObject
>
results
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
MultipartFile
>
entity
:
fileMap
.
entrySet
())
{
JSONObject
item
=
new
JSONObject
();
MultipartFile
file
=
entity
.
getValue
();
// 获取上传文件对象
try
{
if
(
file
!=
null
)
{
// 文件不为空
String
originalFilename
=
file
.
getOriginalFilename
();
long
size
=
file
.
getSize
();
String
contentType
=
file
.
getContentType
();
String
fileId
=
FileServerUtil
.
upload
(
file
.
getInputStream
(),
file
.
getOriginalFilename
(),
FileServerUtil
.
Timeout
.
BEST
);
item
.
put
(
"fileId"
,
fileId
);
//文件服务器生成的文件ID
item
.
put
(
"fileName"
,
originalFilename
);
//原始文件名
item
.
put
(
"fileSize"
,
size
);
//文件大小 字节 byte
item
.
put
(
"contentType"
,
contentType
);
//文件类型
item
.
put
(
"fileSuffix"
,
getSuffix
(
originalFilename
));
//文件后缀名
results
.
add
(
item
);
}
else
{
throw
new
BtpException
(
MessageUtil
.
get
(
"paramNotEmpty"
,
new
Object
[]
{
""
},
language
));
}
}
catch
(
Exception
e
)
{
message
=
""
+
(
e
.
getMessage
()
!=
null
?
e
.
getMessage
()
:
e
);
log
.
error
(
message
);
throw
new
BtpException
(
MessageUtil
.
get
(
"error"
,
new
Object
[]
{
message
},
language
));
}
finally
{
// 获取原始请求对象
HttpServletRequest
originalRequest
=
request
;
while
(
originalRequest
instanceof
javax
.
servlet
.
http
.
HttpServletRequestWrapper
)
{
originalRequest
=
(
HttpServletRequest
)
((
javax
.
servlet
.
http
.
HttpServletRequestWrapper
)
originalRequest
).
getRequest
();
log
.
info
(
"[originalRequest instanceof javax.servlet.http.HttpServletRequestWrapper]true"
);
}
if
(
multipartResolver
.
isMultipart
(
originalRequest
))
{
log
.
info
(
"[multipartResolver.isMultipart(originalRequest)]true"
);
MultipartHttpServletRequest
multipartRequest
=
multipartResolver
.
resolveMultipart
(
originalRequest
);
Map
<
String
,
MultipartFile
>
fileMap
=
multipartRequest
.
getFileMap
();
for
(
Map
.
Entry
<
String
,
MultipartFile
>
entity
:
fileMap
.
entrySet
())
{
log
.
info
(
"[fileMap.entrySet()]for"
);
JSONObject
item
=
new
JSONObject
();
MultipartFile
file
=
entity
.
getValue
();
// 获取上传文件对象
try
{
file
.
getInputStream
().
close
();
}
catch
(
IOException
e
)
{
if
(
file
!=
null
)
{
// 文件不为空
String
originalFilename
=
file
.
getOriginalFilename
();
long
size
=
file
.
getSize
();
String
contentType
=
file
.
getContentType
();
String
fileId
=
FileServerUtil
.
upload
(
file
.
getInputStream
(),
file
.
getOriginalFilename
(),
FileServerUtil
.
Timeout
.
BEST
);
item
.
put
(
"fileId"
,
fileId
);
//文件服务器生成的文件ID
item
.
put
(
"fileName"
,
originalFilename
);
//原始文件名
item
.
put
(
"fileSize"
,
size
);
//文件大小 字节 byte
item
.
put
(
"contentType"
,
contentType
);
//文件类型
item
.
put
(
"fileSuffix"
,
getSuffix
(
originalFilename
));
//文件后缀名
results
.
add
(
item
);
}
else
{
throw
new
BtpException
(
MessageUtil
.
get
(
"paramNotEmpty"
,
new
Object
[]
{
""
},
language
));
}
}
catch
(
Exception
e
)
{
message
=
""
+
(
e
.
getMessage
()
!=
null
?
e
.
getMessage
()
:
e
);
log
.
error
(
message
);
throw
new
BtpException
(
MessageUtil
.
get
(
"error"
,
new
Object
[]
{
message
},
language
));
}
finally
{
try
{
file
.
getInputStream
().
close
();
}
catch
(
IOException
e
)
{
message
=
""
+
(
e
.
getMessage
()
!=
null
?
e
.
getMessage
()
:
e
);
log
.
error
(
message
);
}
}
}
}
else
{
log
.
info
(
"[multipartResolver.isMultipart(originalRequest)]false"
);
}
if
(
results
.
size
()
>
0
)
{
Result
<
Object
>
ok
=
Result
.
ok
(
MessageUtil
.
get
(
"success"
,
new
Object
[]
{
message
},
language
));
...
...
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