Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
C
chinafrica
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
chinafrica
Commits
23782532
提交
23782532
authored
1月 09, 2020
作者:
zgy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改评论
上级
d28e558e
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
501 行增加
和
414 行删除
+501
-414
TbCfItemCommentEntity.java
.../main/java/com/platform/entity/TbCfItemCommentEntity.java
+72
-21
TbCfItemCommentDao.xml
...rc/main/resources/com/platform/dao/TbCfItemCommentDao.xml
+23
-4
TbCfStationItemDao.xml
...rc/main/resources/com/platform/dao/TbCfStationItemDao.xml
+7
-0
tbcforderlist.html
...admin/src/main/webapp/WEB-INF/page/sys/tbcforderlist.html
+1
-1
tbcfstationitem.html
...min/src/main/webapp/WEB-INF/page/sys/tbcfstationitem.html
+11
-0
tbcfitemcomment.js
platform-admin/src/main/webapp/js/sys/tbcfitemcomment.js
+3
-3
tbcfstationitem.js
platform-admin/src/main/webapp/js/sys/tbcfstationitem.js
+26
-20
OssUtil.java
...form-common/src/main/java/com/platform/utils/OssUtil.java
+358
-365
没有找到文件。
platform-admin/src/main/java/com/platform/entity/TbCfItemCommentEntity.java
浏览文件 @
23782532
...
...
@@ -8,7 +8,7 @@ import java.util.Date;
* 表名 tb_cf_item_comment
*
* @author lipengjun
* @date 20
19-11-18 14:31:39
* @date 20
20-01-09 10:17:03
*/
public
class
TbCfItemCommentEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -29,6 +29,14 @@ public class TbCfItemCommentEntity implements Serializable {
* 商品ID
*/
private
String
itemId
;
/**
* 类型 0: 只有文本内容 1:带图片
*/
private
Integer
type
;
/**
* 图片或视频的url
*/
private
String
urls
;
/**
* 商品评分
*/
...
...
@@ -62,18 +70,41 @@ public class TbCfItemCommentEntity implements Serializable {
*/
private
Date
createTime
;
/**
*
回复
时间
*
更新
时间
*/
private
Date
updateTime
;
private
String
username
;
private
String
userName
;
private
String
orderNo
;
private
String
itemName
;
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getOrderNo
()
{
return
orderNo
;
}
public
void
setOrderNo
(
String
orderNo
)
{
this
.
orderNo
=
orderNo
;
}
public
String
get
Usern
ame
()
{
return
usern
ame
;
public
String
get
ItemN
ame
()
{
return
itemN
ame
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
public
void
setItemName
(
String
itemName
)
{
this
.
itemName
=
itemName
;
}
public
static
long
getSerialVersionUID
()
{
return
serialVersionUID
;
}
/**
...
...
@@ -89,7 +120,6 @@ public class TbCfItemCommentEntity implements Serializable {
public
String
getId
()
{
return
id
;
}
/**
* 设置:评论人
*/
...
...
@@ -103,7 +133,6 @@ public class TbCfItemCommentEntity implements Serializable {
public
String
getUserId
()
{
return
userId
;
}
/**
* 设置:订单ID
*/
...
...
@@ -117,7 +146,6 @@ public class TbCfItemCommentEntity implements Serializable {
public
String
getOrderId
()
{
return
orderId
;
}
/**
* 设置:商品ID
*/
...
...
@@ -131,7 +159,32 @@ public class TbCfItemCommentEntity implements Serializable {
public
String
getItemId
()
{
return
itemId
;
}
/**
* 设置:类型 0: 只有文本内容 1:带图片
*/
public
void
setType
(
Integer
type
)
{
this
.
type
=
type
;
}
/**
* 获取:类型 0: 只有文本内容 1:带图片
*/
public
Integer
getType
()
{
return
type
;
}
/**
* 设置:图片或视频的url
*/
public
void
setUrls
(
String
urls
)
{
this
.
urls
=
urls
;
}
/**
* 获取:图片或视频的url
*/
public
String
getUrls
()
{
return
urls
;
}
/**
* 设置:商品评分
*/
...
...
@@ -145,7 +198,6 @@ public class TbCfItemCommentEntity implements Serializable {
public
Integer
getItemScore
()
{
return
itemScore
;
}
/**
* 设置:服务评分
*/
...
...
@@ -159,7 +211,6 @@ public class TbCfItemCommentEntity implements Serializable {
public
Integer
getServiceScore
()
{
return
serviceScore
;
}
/**
* 设置:物流评分
*/
...
...
@@ -173,7 +224,6 @@ public class TbCfItemCommentEntity implements Serializable {
public
Integer
getLogisticsScore
()
{
return
logisticsScore
;
}
/**
* 设置:价格评分
*/
...
...
@@ -187,7 +237,6 @@ public class TbCfItemCommentEntity implements Serializable {
public
Integer
getPriceScore
()
{
return
priceScore
;
}
/**
* 设置:商品评论
*/
...
...
@@ -201,7 +250,6 @@ public class TbCfItemCommentEntity implements Serializable {
public
String
getItemReview
()
{
return
itemReview
;
}
/**
* 设置:点赞人数
*/
...
...
@@ -215,7 +263,6 @@ public class TbCfItemCommentEntity implements Serializable {
public
Long
getLikeNum
()
{
return
likeNum
;
}
/**
* 设置:删除标志 0:正常 1:已删除
*/
...
...
@@ -229,7 +276,6 @@ public class TbCfItemCommentEntity implements Serializable {
public
Integer
getDelFlag
()
{
return
delFlag
;
}
/**
* 设置:创建时间
*/
...
...
@@ -243,12 +289,17 @@ public class TbCfItemCommentEntity implements Serializable {
public
Date
getCreateTime
()
{
return
createTime
;
}
/**
* 设置:更新时间
*/
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
/**
* 获取:更新时间
*/
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
platform-admin/src/main/resources/com/platform/dao/TbCfItemCommentDao.xml
浏览文件 @
23782532
...
...
@@ -8,6 +8,8 @@
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"orderId"
column=
"order_id"
/>
<result
property=
"itemId"
column=
"item_id"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"urls"
column=
"urls"
/>
<result
property=
"itemScore"
column=
"item_score"
/>
<result
property=
"serviceScore"
column=
"service_score"
/>
<result
property=
"logisticsScore"
column=
"logistics_score"
/>
...
...
@@ -26,6 +28,8 @@
`user_id`,
`order_id`,
`item_id`,
`type`,
`urls`,
`item_score`,
`service_score`,
`logistics_score`,
...
...
@@ -40,11 +44,13 @@
</select>
<select
id=
"queryList"
resultMap=
"tbCfItemCommentMap"
>
select
SELECT
c.id,
c.user_id,
c.order_id,
c.item_id,
c.type,
c.urls,
c.item_score,
c.service_score,
c.logistics_score,
...
...
@@ -54,9 +60,16 @@
c.del_flag,
c.create_time,
c.update_time,
u.nick username
from tb_cf_item_comment c left join tb_cf_user_info u on c.user_id=u.user_id
where 1=1
u.nick userName,
o.order_no orderNo,
i.item_name itemName
FROM
tb_cf_item_comment c
LEFT JOIN tb_cf_user_info u ON c.user_id = u.user_id
left join tb_cf_order o on c.order_id=o.order_id
left join tb_cf_station_item i on c.item_id=i.item_id
WHERE
1 =1
<if
test=
"name != null and name.trim() != ''"
>
AND u.nick LIKE concat('%',#{name},'%')
</if>
...
...
@@ -87,6 +100,8 @@
`user_id`,
`order_id`,
`item_id`,
`type`,
`urls`,
`item_score`,
`service_score`,
`logistics_score`,
...
...
@@ -101,6 +116,8 @@
#{userId},
#{orderId},
#{itemId},
#{type},
#{urls},
#{itemScore},
#{serviceScore},
#{logisticsScore},
...
...
@@ -118,6 +135,8 @@
<if
test=
"userId != null"
>
`user_id` = #{userId},
</if>
<if
test=
"orderId != null"
>
`order_id` = #{orderId},
</if>
<if
test=
"itemId != null"
>
`item_id` = #{itemId},
</if>
<if
test=
"type != null"
>
`type` = #{type},
</if>
<if
test=
"urls != null"
>
`urls` = #{urls},
</if>
<if
test=
"itemScore != null"
>
`item_score` = #{itemScore},
</if>
<if
test=
"serviceScore != null"
>
`service_score` = #{serviceScore},
</if>
<if
test=
"logisticsScore != null"
>
`logistics_score` = #{logisticsScore},
</if>
...
...
platform-admin/src/main/resources/com/platform/dao/TbCfStationItemDao.xml
浏览文件 @
23782532
...
...
@@ -118,6 +118,10 @@
<if
test=
"status != null and status.trim() != ''"
>
AND enable_flag=#{status}
</if>
<if
test=
"itemCategory != null and itemCategory.trim() != ''"
>
AND item_category=#{itemCategory}
</if>
<choose>
<when
test=
"sidx != null and sidx.trim() != ''"
>
order by ${sidx} ${order}
...
...
@@ -155,6 +159,9 @@
<if
test=
"status != null and status.trim() != ''"
>
AND enable_flag=#{status}
</if>
<if
test=
"itemCategory != null and itemCategory.trim() != ''"
>
AND item_category=#{itemCategory}
</if>
</select>
<insert
id=
"save"
parameterType=
"com.platform.entity.TbCfStationItemEntity"
>
...
...
platform-admin/src/main/webapp/WEB-INF/page/sys/tbcforderlist.html
浏览文件 @
23782532
...
...
@@ -71,7 +71,7 @@
</style>
</head>
<body>
<div
id=
"rrapp"
v-cloak
style=
"width:1
700px
;
<div
id=
"rrapp"
v-cloak
style=
"width:1
00%
;
height: -webkit-calc(100% - 15px);
height: -moz-calc(100% - 15px);
height: calc(100% - 15px);"
>
...
...
platform-admin/src/main/webapp/WEB-INF/page/sys/tbcfstationitem.html
浏览文件 @
23782532
...
...
@@ -132,6 +132,7 @@
.query
{
float
:
right
;
margin-right
:
200px
;
}
.default-price
{
...
...
@@ -166,6 +167,16 @@
商品名称:
<i-input
v-model=
"q.name"
@
on-enter=
"query"
placeholder=
"商品名称"
style=
"width:160px"
>
</i-input>
</span>
<span>
一级分类:
<i-select
v-model=
"q.itemCategory"
@
on-enter=
"query"
placeholder=
"一级分类"
style=
"width:160px"
>
<i-option
v-for=
"(el,i) in Goodstype"
:key=
'i'
:value=
"el.goodstypeId"
>
{{el.goodstypeTitle}}
</i-option>
</i-select>
</span>
<span>
...
...
platform-admin/src/main/webapp/js/sys/tbcfitemcomment.js
浏览文件 @
23782532
...
...
@@ -3,9 +3,9 @@ $(function () {
url
:
'../tbcfitemcomment/list'
,
colModel
:
[
{
label
:
'id'
,
name
:
'id'
,
index
:
'id'
,
key
:
true
,
hidden
:
true
},
{
label
:
'评论人'
,
name
:
'user
n
ame'
,
index
:
'username'
,
width
:
80
},
{
label
:
'订单
ID'
,
name
:
'orderId
'
,
index
:
'order_id'
,
width
:
80
},
{
label
:
'商品
ID'
,
name
:
'itemId
'
,
index
:
'item_id'
,
width
:
80
},
{
label
:
'评论人'
,
name
:
'user
N
ame'
,
index
:
'username'
,
width
:
80
},
{
label
:
'订单
号'
,
name
:
'orderNo
'
,
index
:
'order_id'
,
width
:
80
},
{
label
:
'商品
名称'
,
name
:
'itemName
'
,
index
:
'item_id'
,
width
:
80
},
{
label
:
'商品评分'
,
name
:
'itemScore'
,
index
:
'item_score'
,
width
:
80
},
{
label
:
'服务评分'
,
name
:
'serviceScore'
,
index
:
'service_score'
,
width
:
80
},
{
label
:
'物流评分'
,
name
:
'logisticsScore'
,
index
:
'logistics_score'
,
width
:
80
},
...
...
platform-admin/src/main/webapp/js/sys/tbcfstationitem.js
浏览文件 @
23782532
...
...
@@ -43,12 +43,13 @@ let vm = new Vue({
q
:
{
name
:
''
,
code
:
''
,
status
:
''
status
:
''
,
itemCategory
:
''
},
alertShow
:
false
,
//警告弹窗
serverSkuAttr
:[],
serverSkuAttr
:
[],
attrItem
:
[{
categoryName
:
'Size'
,
option
:
[],
...
...
@@ -220,7 +221,7 @@ let vm = new Vue({
})
console
.
log
(
r
)
})()
console
.
log
(
123321
,
_this
.
attrItem
)
console
.
log
(
123321
,
_this
.
attrItem
)
vm
.
tbCfStationItem
=
r
.
tbCfStationItem
.
item
;
vm
.
uploadList
[
0
]
=
vm
.
tbCfStationItem
.
itemImg
;
let
itemDesc
=
vm
.
tbCfStationItem
.
itemDesc
;
...
...
@@ -230,15 +231,15 @@ let vm = new Vue({
vm
.
tbCfStationItem
.
enableFlag
===
1
&&
(()
=>
{
_this
.
putaway
=
true
;
})()
try
{
try
{
UE
.
getEditor
(
'itemDesc'
).
setContent
(
itemDesc
);
}
catch
(
e
)
{
}
catch
(
e
)
{
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
UE
.
getEditor
(
'itemDesc'
).
setContent
(
itemDesc
);
},
500
)
},
500
)
if
(
itemDesc
==
null
||
itemDesc
==
''
)
{
UE
.
getEditor
(
'itemDesc'
).
setContent
(
""
);
}
...
...
@@ -248,10 +249,7 @@ let vm = new Vue({
},
importExcel
:
function
()
{
let
itemIds
=
getSelectedRows
(
"#jqGrid"
);
if
(
itemIds
==
null
)
{
return
;
}
this
.
modal
=
''
},
exportExcel
:
function
()
{
...
...
@@ -261,8 +259,9 @@ let vm = new Vue({
type
:
"POST"
,
contentType
:
"application/json"
,
successCallback
:
function
(
resultData
)
{
// console.log(resultData);
iview
.
Message
.
success
(
resultData
.
success
);
alert
(
'操作成功!导出位置:D:
\\
Afrishop'
,
function
(
index
)
{
vm
.
reload
();
});
}
});
...
...
@@ -274,7 +273,12 @@ let vm = new Vue({
vm
.
showList
=
true
;
let
page
=
$
(
"#jqGrid"
).
jqGrid
(
'getGridParam'
,
'page'
);
$
(
"#jqGrid"
).
jqGrid
(
'setGridParam'
,
{
postData
:
{
'name'
:
vm
.
q
.
name
.
trim
(),
'code'
:
vm
.
q
.
code
.
trim
(),
'status'
:
vm
.
q
.
status
.
trim
()},
postData
:
{
'name'
:
vm
.
q
.
name
.
trim
(),
'code'
:
vm
.
q
.
code
.
trim
(),
'status'
:
vm
.
q
.
status
.
trim
(),
'itemCategory'
:
vm
.
q
.
itemCategory
.
trim
()
},
page
:
page
}).
trigger
(
"reloadGrid"
);
vm
.
handleReset
(
'formValidate'
);
...
...
@@ -283,7 +287,8 @@ let vm = new Vue({
vm
.
q
=
{
name
:
''
,
code
:
''
,
status
:
''
status
:
''
,
itemCategory
:
''
};
vm
.
reload
();
},
...
...
@@ -491,10 +496,11 @@ let vm = new Vue({
})
}
},
ok
(){
ok
()
{
this
.
reloadSearch
();
},
cancel
(){},
cancel
()
{
},
handleCreateSelect
(
val
)
{
let
option
=
JSON
.
parse
(
localStorage
.
getItem
(
'option'
))
option
.
push
(
val
)
...
...
@@ -523,9 +529,9 @@ let vm = new Vue({
})
//获取默认规格
$
.
get
(
'../tbcategorytemplate/queryAll'
,
res
=>
{
$
.
get
(
'../tbcategorytemplate/queryAll'
,
res
=>
{
let
_res
=
JSON
.
parse
(
res
)
_res
.
list
.
forEach
(
item
=>
{
_res
.
list
.
forEach
(
item
=>
{
this
.
attrItem
[
0
].
option
.
push
(
item
.
categoryDesc
)
this
.
serverSkuAttr
.
push
(
item
.
categoryDesc
)
})
...
...
platform-common/src/main/java/com/platform/utils/OssUtil.java
浏览文件 @
23782532
...
...
@@ -18,15 +18,15 @@ public class OssUtil {
////////// 阿里云要求jdom使用1.1版本!!!!!!!!!!!!!
//阿里云API的内或外网域名
private
static
final
String
ENDPOINT
=
"oss-cn-shenzhen.aliyuncs.com"
;
private
static
final
String
ENDPOINT
=
"oss-cn-shenzhen.aliyuncs.com"
;
//阿里云API的密钥Access Key ID
private
static
final
String
ACCESS_KEY_ID
=
"5d6h34keSd9K3l2x"
;
private
static
final
String
ACCESS_KEY_ID
=
"5d6h34keSd9K3l2x"
;
//阿里云API的密钥Access Key Secret
private
static
final
String
ACCESS_KEY_SECRET
=
"l2dJ4LpY6D6qV3jj3iQif7EPByoVQE"
;
private
static
final
String
ACCESS_KEY_SECRET
=
"l2dJ4LpY6D6qV3jj3iQif7EPByoVQE"
;
//阿里云API的bucket名称
private
static
final
String
BACKET_NAME
=
"diaosaas-prod"
;
private
static
final
String
BACKET_NAME
=
"diaosaas-prod"
;
//阿里云API的文件夹名称
private
static
final
String
FOLDER
=
"africa-shop/"
;
private
static
final
String
FOLDER
=
"africa-shop/"
;
// // 阿里云API的内或外网域名
// private static final String ENDPOINT = "oss-cn-shenzhen.aliyuncs.com";
// // 阿里云API的密钥Access Key ID
...
...
@@ -78,12 +78,9 @@ public class OssUtil {
/**
* 创建模拟文件夹
*
* @param ossClient
* oss连接
* @param bucketName
* 存储空间
* @param folder
* 模拟文件夹名如"wenjianjia/"
* @param ossClient oss连接
* @param bucketName 存储空间
* @param folder 模拟文件夹名如"wenjianjia/"
* @return
*/
public
static
String
createFolder
(
OSSClient
ossClient
,
String
bucketName
,
String
folder
)
{
...
...
@@ -105,12 +102,9 @@ public class OssUtil {
/**
* 根据key和folder删除OSS服务器上的文件
*
* @param bucketName
* bucketName存储空间
* @param folder
* folder模拟文件夹名 如"qj_nanjing/"
* @param key
* Bucket下的文件的路径名+文件名 如:"upload/cake.jpg"
* @param bucketName bucketName存储空间
* @param folder folder模拟文件夹名 如"qj_nanjing/"
* @param key Bucket下的文件的路径名+文件名 如:"upload/cake.jpg"
*/
public
static
String
deleteFile
(
String
bucketName
,
String
folder
,
String
key
)
{
OSSClient
ossClient
=
getOSSClient
();
...
...
@@ -128,10 +122,8 @@ public class OssUtil {
/**
* 根据key删除OSS服务器上的文件
*
* @param bucketName
* bucketName存储空间
* @param key
* Bucket下的文件的路径名+文件名 如:"upload/cake.jpg"
* @param bucketName bucketName存储空间
* @param key Bucket下的文件的路径名+文件名 如:"upload/cake.jpg"
*/
public
static
String
deleteFile
(
String
bucketName
,
String
key
)
{
OSSClient
ossClient
=
getOSSClient
();
...
...
@@ -149,8 +141,7 @@ public class OssUtil {
/**
* 根据key删除OSS服务器上的文件
*
* @param key
* Bucket下的文件的路径名+文件名 如:"upload/cake.jpg" "http://" + BACKET_NAME +
* @param key Bucket下的文件的路径名+文件名 如:"upload/cake.jpg" "http://" + BACKET_NAME +
* "." + ENDPOINT + "/" + FOLDER + secondaryFolderName + "/" +
* fileNameNew
*/
...
...
@@ -174,8 +165,7 @@ public class OssUtil {
* 上传图片至OSS
*
* @param file
* @param secondaryFolderName
* 二级文件夹目录
* @param secondaryFolderName 二级文件夹目录
* @return
*/
public
static
String
uploadObject2OSS
(
File
file
,
String
secondaryFolderName
)
{
...
...
@@ -224,7 +214,6 @@ public class OssUtil {
}
/**
* 通过文件名判断并获取OSS服务文件上传时文件的contentType
*
...
...
@@ -267,7 +256,6 @@ public class OssUtil {
}
/**
*
* @param ossClient
* @param key
* @return
...
...
@@ -282,6 +270,7 @@ public class OssUtil {
/**
* MultipartFile 形式上传文件
*
* @param file
* @return
* @throws Exception
...
...
@@ -295,8 +284,10 @@ public class OssUtil {
//System.out.println(url);
return
url
;
}
/**
* MultipartFile 形式上传文件
*
* @param file
* @return
* @throws Exception
...
...
@@ -310,14 +301,16 @@ public class OssUtil {
//System.out.println(url);
return
url
;
}
/**
* MultipartFile 形式上传文件
*
* @param file
* @return
* @throws Exception
*/
public
static
String
upload
(
MultipartFile
file
,
String
fileName
,
String
secondaryFolderName
)
throws
Exception
{
String
prefix
=
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
)
).
toLowerCase
();
public
static
String
upload
(
MultipartFile
file
,
String
fileName
,
String
secondaryFolderName
)
throws
Exception
{
String
prefix
=
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
)
).
toLowerCase
();
final
File
realfile
=
File
.
createTempFile
(
fileName
,
prefix
);
file
.
transferTo
(
realfile
);
String
url
=
OssUtil
.
uploadObject2OSS
(
realfile
,
secondaryFolderName
);
...
...
@@ -327,11 +320,12 @@ public class OssUtil {
/**
* MultipartFile 形式上传文件
*
* @param realfile
* @return
* @throws Exception
*/
public
static
String
upload
(
File
realfile
,
String
secondaryFolderName
)
{
public
static
String
upload
(
File
realfile
,
String
secondaryFolderName
)
{
String
url
=
OssUtil
.
uploadObject2OSS
(
realfile
,
secondaryFolderName
);
return
url
;
}
...
...
@@ -339,13 +333,14 @@ public class OssUtil {
/**
* 以byte数组上传到oss
*
* @param fbytes byte数组
* @param fileName 文件名称
* @param secondaryFolderName 二级文件夹目录
* @return
* @throws Exception
*/
public
static
String
upload
(
byte
[]
fbytes
,
String
fileName
,
String
secondaryFolderName
)
throws
Exception
{
public
static
String
upload
(
byte
[]
fbytes
,
String
fileName
,
String
secondaryFolderName
)
throws
Exception
{
OSSClient
ossClient
=
getOSSClient
();
// String fileNameNew = "1.jpg";
// 上传Byte数组。
...
...
@@ -361,58 +356,56 @@ public class OssUtil {
/**
* 将文件转换成byte数组
*
* @param tradeFile
* @return
*/
public
static
byte
[]
File2byte
(
File
tradeFile
)
{
public
static
byte
[]
File2byte
(
File
tradeFile
)
{
byte
[]
buffer
=
null
;
try
{
try
{
FileInputStream
fis
=
new
FileInputStream
(
tradeFile
);
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
byte
[]
b
=
new
byte
[
1024
];
int
n
;
while
((
n
=
fis
.
read
(
b
))
!=
-
1
)
{
while
((
n
=
fis
.
read
(
b
))
!=
-
1
)
{
bos
.
write
(
b
,
0
,
n
);
}
fis
.
close
();
bos
.
close
();
buffer
=
bos
.
toByteArray
();
}
catch
(
FileNotFoundException
e
)
{
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
buffer
;
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
boolean
flag
=
deleteFile
(
"http://guangzhou-douli.oss-cn-shenzhen.aliyuncs.com/shouli/qcrod/2.jpg"
);
//System.out.println(flag);
File
file
=
new
File
(
"C:\\Users\\yangshanlin\\Desktop\\bg-sfxt.jpg"
);
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
file
=
new
File
(
"D:\\123.mp4"
);
byte
[]
b
=
File2byte
(
file
);
//System.out.println(b);
// boolean flag = deleteFile("https://diaosaas-prod.oss-cn-shenzhen.aliyuncs.com/africa-shop/hello/hello.jpg");
String
s
=
upload
(
b
,
"hello.mp4"
,
"hello"
);
System
.
out
.
println
(
s
);
// System.out.println(flag);
String
s
=
upload
(
b
,
"3.jpg"
,
"qcrod"
);
//System.out.println(s);
}
public
static
State
uploadToAliOss
(
byte
[]
data
,
String
fileName
,
String
secondaryFolderName
)
throws
Exception
{
String
path
=
upload
(
data
,
fileName
,
secondaryFolderName
);
String
path
=
upload
(
data
,
fileName
,
secondaryFolderName
);
State
state
=
new
BaseState
(
true
,
path
);
state
.
putInfo
(
"size"
,
data
.
length
);
state
.
putInfo
(
"title"
,
fileName
);
state
.
putInfo
(
"url"
,
path
);
state
.
putInfo
(
"title"
,
fileName
);
state
.
putInfo
(
"url"
,
path
);
return
state
;
}
public
static
State
uploadFileToAliOss
(
File
realfile
,
String
secondaryFolderName
)
{
String
url
=
OssUtil
.
uploadObject2OSS
(
realfile
,
secondaryFolderName
);
State
state
=
new
BaseState
(
true
,
url
);
state
.
putInfo
(
"title"
,
realfile
.
getName
());
state
.
putInfo
(
"url"
,
url
);
state
.
putInfo
(
"title"
,
realfile
.
getName
());
state
.
putInfo
(
"url"
,
url
);
return
state
;
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论