Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
8b2ad42d
Commit
8b2ad42d
authored
Nov 15, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
盲袋详情
parent
9da87711
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
8 deletions
+78
-8
ch-core/src/main/java/com/wwdz/ch/core/entity/ImageInfo.java
ch-core/src/main/java/com/wwdz/ch/core/entity/ImageInfo.java
+16
-2
ch-core/src/main/java/com/wwdz/ch/core/util/MediaUtil.java
ch-core/src/main/java/com/wwdz/ch/core/util/MediaUtil.java
+48
-3
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/BlindBoxDetailVo.java
...m/wwdz/ch/wx/entity/vo/distribution/BlindBoxDetailVo.java
+11
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/BlindBoxServiceImpl.java
...com/wwdz/ch/wx/impl/distribution/BlindBoxServiceImpl.java
+3
-1
No files found.
ch-core/src/main/java/com/wwdz/ch/core/entity/ImageInfo.java
View file @
8b2ad42d
...
@@ -6,12 +6,26 @@ import lombok.Data;
...
@@ -6,12 +6,26 @@ import lombok.Data;
@Data
@Data
public
class
ImageInfo
implements
Entity
{
public
class
ImageInfo
implements
Entity
{
private
int
height
;
private
Integer
height
;
private
int
width
;
private
Integer
width
;
public
String
formartString
()
{
public
String
formartString
()
{
return
this
.
width
+
"x"
+
this
.
height
;
return
this
.
width
+
"x"
+
this
.
height
;
}
}
private
String
url
;
/**
* 1视频
* 2图片
*/
private
Integer
type
;
/**
* 视频url
*/
private
String
videoUrl
;
}
}
ch-core/src/main/java/com/wwdz/ch/core/util/MediaUtil.java
View file @
8b2ad42d
...
@@ -20,9 +20,7 @@ import java.io.ByteArrayOutputStream;
...
@@ -20,9 +20,7 @@ import java.io.ByteArrayOutputStream;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.net.URL
;
import
java.util.Arrays
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
MediaUtil
{
public
class
MediaUtil
{
...
@@ -163,6 +161,53 @@ public class MediaUtil {
...
@@ -163,6 +161,53 @@ public class MediaUtil {
/**
* 分号拼接的图片url转成list,带宽高参数
* type 1视频 2图片
* @param images
* @return
*/
public
static
List
<
ImageInfo
>
convertImage
(
String
images
,
String
videos
)
{
List
<
ImageInfo
>
imageInfos
=
new
ArrayList
<>();
if
(
StringUtils
.
hasLength
(
videos
))
{
List
<
String
>
videoList
=
Arrays
.
asList
(
videos
.
split
(
";"
));
for
(
String
video
:
videoList
)
{
String
[]
arr
=
video
.
split
(
","
);
if
(
arr
.
length
>
1
)
{
try
{
String
videoUrl
=
arr
[
0
];
String
videoImg
=
arr
[
1
];
Map
<
String
,
Object
>
map
=
getAspect
(
videoImg
);
String
width
=
map
.
get
(
"width"
).
toString
();
String
height
=
map
.
get
(
"height"
).
toString
();
ImageInfo
imageInfo
=
new
ImageInfo
();
imageInfo
.
setType
(
1
);
imageInfo
.
setUrl
(
videoImg
);
imageInfo
.
setVideoUrl
(
videoUrl
);
imageInfo
.
setWidth
(
Integer
.
valueOf
(
width
));
imageInfo
.
setHeight
(
Integer
.
valueOf
(
height
));
imageInfos
.
add
(
imageInfo
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"视频字段转换imageInfo error:{}"
,
e
);
}
}
}
}
List
<
String
>
imageList
=
Arrays
.
asList
(
images
.
split
(
";"
));
for
(
String
image
:
imageList
)
{
Map
<
String
,
Object
>
map
=
getAspect
(
image
);
String
width
=
map
.
get
(
"width"
).
toString
();
String
height
=
map
.
get
(
"height"
).
toString
();
ImageInfo
imageInfo
=
new
ImageInfo
();
imageInfo
.
setType
(
2
);
imageInfo
.
setUrl
(
image
);
imageInfo
.
setWidth
(
Integer
.
valueOf
(
width
));
imageInfo
.
setHeight
(
Integer
.
valueOf
(
height
));
imageInfos
.
add
(
imageInfo
);
}
return
imageInfos
;
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/BlindBoxDetailVo.java
View file @
8b2ad42d
package
com.wwdz.ch.wx.entity.vo.distribution
;
package
com.wwdz.ch.wx.entity.vo.distribution
;
import
com.wwdz.ch.core.entity.ImageInfo
;
import
com.xxdxxs.entity.Entity
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
@Data
@Data
public
class
BlindBoxDetailVo
implements
Entity
{
public
class
BlindBoxDetailVo
implements
Entity
{
...
@@ -25,6 +24,11 @@ public class BlindBoxDetailVo implements Entity {
...
@@ -25,6 +24,11 @@ public class BlindBoxDetailVo implements Entity {
*/
*/
List
<
ItemSkuVo
>
itemSkuVoList
;
List
<
ItemSkuVo
>
itemSkuVoList
;
/**
* 盲袋图片视频集合
*/
private
List
<
ImageInfo
>
imageInfoList
;
/**
/**
* 福袋视频
* 福袋视频
*/
*/
...
@@ -54,4 +58,9 @@ public class BlindBoxDetailVo implements Entity {
...
@@ -54,4 +58,9 @@ public class BlindBoxDetailVo implements Entity {
* 盲袋购买记录
* 盲袋购买记录
*/
*/
private
List
<
BlindBoxBuyRecordVo
>
buyRecordList
;
private
List
<
BlindBoxBuyRecordVo
>
buyRecordList
;
/**
* 购买进度
*/
private
String
rate
;
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/BlindBoxServiceImpl.java
View file @
8b2ad42d
...
@@ -5,6 +5,7 @@ import com.wwdz.ch.core.consts.CommConsts;
...
@@ -5,6 +5,7 @@ import com.wwdz.ch.core.consts.CommConsts;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.CacheUtil
;
import
com.wwdz.ch.core.util.CacheUtil
;
import
com.wwdz.ch.core.util.MediaUtil
;
import
com.wwdz.ch.core.util.PriceUtil
;
import
com.wwdz.ch.core.util.PriceUtil
;
import
com.wwdz.ch.core.util.StringUtil
;
import
com.wwdz.ch.core.util.StringUtil
;
import
com.wwdz.ch.db.dao.distribution.DistributionOrderDao
;
import
com.wwdz.ch.db.dao.distribution.DistributionOrderDao
;
...
@@ -176,11 +177,12 @@ public class BlindBoxServiceImpl implements BlindBoxService {
...
@@ -176,11 +177,12 @@ public class BlindBoxServiceImpl implements BlindBoxService {
if
(
StringUtils
.
hasLength
(
supplierItem
.
getVideos
()))
{
if
(
StringUtils
.
hasLength
(
supplierItem
.
getVideos
()))
{
blindBoxDetailVo
.
setVideos
(
Arrays
.
asList
(
supplierItem
.
getVideos
().
split
(
";"
)));
blindBoxDetailVo
.
setVideos
(
Arrays
.
asList
(
supplierItem
.
getVideos
().
split
(
";"
)));
}
}
blindBoxDetailVo
.
setImageInfoList
(
MediaUtil
.
convertImage
(
supplierItem
.
getImages
(),
supplierItem
.
getVideos
()));
blindBoxDetailVo
.
setName
(
supplierItem
.
getName
());
blindBoxDetailVo
.
setName
(
supplierItem
.
getName
());
blindBoxDetailVo
.
setPrice
(
PriceUtil
.
convertPriceFenToYuan
(
supplierItem
.
getDistributionPrice
()));
blindBoxDetailVo
.
setPrice
(
PriceUtil
.
convertPriceFenToYuan
(
supplierItem
.
getDistributionPrice
()));
blindBoxDetailVo
.
setTotalNum
(
pageInfo
.
getTotal
());
blindBoxDetailVo
.
setTotalNum
(
pageInfo
.
getTotal
());
blindBoxDetailVo
.
setRemainNum
(
supplierItem
.
getStock
().
longValue
()
<
0
?
0
:
supplierItem
.
getStock
().
longValue
());
blindBoxDetailVo
.
setRemainNum
(
supplierItem
.
getStock
().
longValue
()
<
0
?
0
:
supplierItem
.
getStock
().
longValue
());
blindBoxDetailVo
.
setRate
(
String
.
valueOf
(
Math
.
ceil
(
blindBoxDetailVo
.
getRemainNum
()
/
pageInfo
.
getTotal
())));
//查询购买记录
//查询购买记录
//盲袋的编码
//盲袋的编码
List
<
String
>
codes
=
new
ArrayList
<>();
List
<
String
>
codes
=
new
ArrayList
<>();
...
...
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