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
f6560013
Commit
f6560013
authored
Nov 13, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
盲盒专区
parent
05cfcdff
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
397 additions
and
20 deletions
+397
-20
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/SysItemSkuServiceImpl.java
...in/java/com/wwdz/ch/admin/impl/SysItemSkuServiceImpl.java
+1
-0
ch-core/src/main/java/com/wwdz/ch/core/util/StringUtil.java
ch-core/src/main/java/com/wwdz/ch/core/util/StringUtil.java
+16
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/DistributionOrderDao.java
...com/wwdz/ch/db/dao/distribution/DistributionOrderDao.java
+8
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/ItemSku.java
...main/java/com/wwdz/ch/db/domain/distribution/ItemSku.java
+9
-2
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/ItemSkuExample.java
...va/com/wwdz/ch/db/domain/distribution/ItemSkuExample.java
+132
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/ItemSkuRequestDto.java
...wdz/ch/db/dto/request/distribution/ItemSkuRequestDto.java
+5
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/DistributionOrderDaoImpl.java
...wdz/ch/db/impl/distribution/DistributionOrderDaoImpl.java
+11
-0
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/ItemSkuMapper.xml
...rces/com/wwdz/ch/db/mapper/distribution/ItemSkuMapper.xml
+33
-13
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
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/BlindBoxInfoVo.java
...com/wwdz/ch/wx/entity/vo/distribution/BlindBoxInfoVo.java
+51
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/BlindBoxVo.java
...ava/com/wwdz/ch/wx/entity/vo/distribution/BlindBoxVo.java
+6
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/BlindBoxServiceImpl.java
...com/wwdz/ch/wx/impl/distribution/BlindBoxServiceImpl.java
+65
-4
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/distribution/BlindBoxService.java
.../com/wwdz/ch/wx/service/distribution/BlindBoxService.java
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/distribution/BlindBoxController.java
...a/com/wwdz/ch/wx/web/distribution/BlindBoxController.java
+48
-0
No files found.
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/SysItemSkuServiceImpl.java
View file @
f6560013
...
...
@@ -46,6 +46,7 @@ public class SysItemSkuServiceImpl implements SysItemSkuService {
ItemSku
itemSku
=
new
ItemSku
();
EntityMapper
.
copyAttribute
(
dto
,
itemSku
);
itemSku
.
setSkuCode
(
UUID
.
fastUUID
().
toString
(
true
));
itemSku
.
setSort
(
dto
.
getSort
()
==
null
?
1
:
dto
.
getSort
());
itemSku
.
setPrice
(
PriceUtil
.
convertPriceFromStr
(
StringUtils
.
isEmpty
(
dto
.
getPrice
())?
"0"
:
dto
.
getPrice
()));
itemSku
.
setImages
(
dto
.
getImages
());
if
(
StringUtils
.
hasLength
(
dto
.
getVideos
()))
{
...
...
ch-core/src/main/java/com/wwdz/ch/core/util/StringUtil.java
View file @
f6560013
...
...
@@ -53,6 +53,22 @@ public class StringUtil {
}
public
static
String
anonymizeUsername
(
String
username
)
{
if
(
username
==
null
||
username
.
isEmpty
())
{
return
"****"
;
}
String
lastChar
=
username
.
substring
(
username
.
length
()
-
1
);
StringBuilder
anonymized
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
username
.
length
()
-
1
;
i
++)
{
anonymized
.
append
(
'*'
);
}
anonymized
.
append
(
lastChar
);
return
anonymized
.
toString
();
}
/**
* 创建sku编码
* 商品id
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/DistributionOrderDao.java
View file @
f6560013
...
...
@@ -67,6 +67,14 @@ public interface DistributionOrderDao {
*/
DistributionOrder
findLastedByBuyerId
(
long
buyerId
);
/**
* 根据商品id查询购买记录
* @param itemId
* @return
*/
List
<
DistributionOrder
>
findBuyRecordByItemId
(
long
itemId
);
/**
* 根据买家id查询对于这个商品的历史有效购买记录,排除已取消的订单
* @param buyerId
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/ItemSku.java
View file @
f6560013
package
com.wwdz.ch.db.domain.distribution
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
...
...
@@ -56,6 +54,11 @@ public class ItemSku implements Entity {
*/
private
Date
updateTime
;
/**
* 排序字段
*/
private
Integer
sort
;
/**
* 图片
*/
...
...
@@ -88,6 +91,7 @@ public class ItemSku implements Entity {
sb
.
append
(
", isDeleted="
).
append
(
isDeleted
);
sb
.
append
(
", createTime="
).
append
(
createTime
);
sb
.
append
(
", updateTime="
).
append
(
updateTime
);
sb
.
append
(
", sort="
).
append
(
sort
);
sb
.
append
(
", images="
).
append
(
images
);
sb
.
append
(
", videos="
).
append
(
videos
);
sb
.
append
(
", description="
).
append
(
description
);
...
...
@@ -117,6 +121,7 @@ public class ItemSku implements Entity {
&&
(
this
.
getIsDeleted
()
==
null
?
other
.
getIsDeleted
()
==
null
:
this
.
getIsDeleted
().
equals
(
other
.
getIsDeleted
()))
&&
(
this
.
getCreateTime
()
==
null
?
other
.
getCreateTime
()
==
null
:
this
.
getCreateTime
().
equals
(
other
.
getCreateTime
()))
&&
(
this
.
getUpdateTime
()
==
null
?
other
.
getUpdateTime
()
==
null
:
this
.
getUpdateTime
().
equals
(
other
.
getUpdateTime
()))
&&
(
this
.
getSort
()
==
null
?
other
.
getSort
()
==
null
:
this
.
getSort
().
equals
(
other
.
getSort
()))
&&
(
this
.
getImages
()
==
null
?
other
.
getImages
()
==
null
:
this
.
getImages
().
equals
(
other
.
getImages
()))
&&
(
this
.
getVideos
()
==
null
?
other
.
getVideos
()
==
null
:
this
.
getVideos
().
equals
(
other
.
getVideos
()))
&&
(
this
.
getDescription
()
==
null
?
other
.
getDescription
()
==
null
:
this
.
getDescription
().
equals
(
other
.
getDescription
()));
...
...
@@ -135,6 +140,7 @@ public class ItemSku implements Entity {
result
=
prime
*
result
+
((
getIsDeleted
()
==
null
)
?
0
:
getIsDeleted
().
hashCode
());
result
=
prime
*
result
+
((
getCreateTime
()
==
null
)
?
0
:
getCreateTime
().
hashCode
());
result
=
prime
*
result
+
((
getUpdateTime
()
==
null
)
?
0
:
getUpdateTime
().
hashCode
());
result
=
prime
*
result
+
((
getSort
()
==
null
)
?
0
:
getSort
().
hashCode
());
result
=
prime
*
result
+
((
getImages
()
==
null
)
?
0
:
getImages
().
hashCode
());
result
=
prime
*
result
+
((
getVideos
()
==
null
)
?
0
:
getVideos
().
hashCode
());
result
=
prime
*
result
+
((
getDescription
()
==
null
)
?
0
:
getDescription
().
hashCode
());
...
...
@@ -158,6 +164,7 @@ public class ItemSku implements Entity {
isDeleted
(
"is_deleted"
,
"isDeleted"
,
"BIT"
,
false
),
createTime
(
"create_time"
,
"createTime"
,
"TIMESTAMP"
,
false
),
updateTime
(
"update_time"
,
"updateTime"
,
"TIMESTAMP"
,
false
),
sort
(
"sort"
,
"sort"
,
"INTEGER"
,
false
),
images
(
"images"
,
"images"
,
"LONGVARCHAR"
,
false
),
videos
(
"videos"
,
"videos"
,
"LONGVARCHAR"
,
false
),
description
(
"description"
,
"description"
,
"LONGVARCHAR"
,
false
);
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/ItemSkuExample.java
View file @
f6560013
...
...
@@ -1365,6 +1365,138 @@ public class ItemSkuExample {
addCriterion
(
"update_time not between"
,
value1
,
value2
,
"updateTime"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSortIsNull
()
{
addCriterion
(
"sort is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSortIsNotNull
()
{
addCriterion
(
"sort is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSortEqualTo
(
Integer
value
)
{
addCriterion
(
"sort ="
,
value
,
"sort"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_sku
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andSortEqualToColumn
(
ItemSku
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"sort = "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andSortNotEqualTo
(
Integer
value
)
{
addCriterion
(
"sort <>"
,
value
,
"sort"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_sku
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andSortNotEqualToColumn
(
ItemSku
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"sort <> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andSortGreaterThan
(
Integer
value
)
{
addCriterion
(
"sort >"
,
value
,
"sort"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_sku
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andSortGreaterThanColumn
(
ItemSku
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"sort > "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andSortGreaterThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"sort >="
,
value
,
"sort"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_sku
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andSortGreaterThanOrEqualToColumn
(
ItemSku
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"sort >= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andSortLessThan
(
Integer
value
)
{
addCriterion
(
"sort <"
,
value
,
"sort"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_sku
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andSortLessThanColumn
(
ItemSku
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"sort < "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andSortLessThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"sort <="
,
value
,
"sort"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table item_sku
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andSortLessThanOrEqualToColumn
(
ItemSku
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"sort <= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andSortIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"sort in"
,
values
,
"sort"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSortNotIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"sort not in"
,
values
,
"sort"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSortBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"sort between"
,
value1
,
value2
,
"sort"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSortNotBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"sort not between"
,
value1
,
value2
,
"sort"
);
return
(
Criteria
)
this
;
}
}
public
static
class
Criteria
extends
GeneratedCriteria
{
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/ItemSkuRequestDto.java
View file @
f6560013
...
...
@@ -41,6 +41,11 @@ public class ItemSkuRequestDto extends BaseRequestDto implements Entity {
*/
private
Boolean
isDeleted
;
/**
* 排序字段
*/
private
Integer
sort
;
/**
* 创建时间
*/
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/DistributionOrderDaoImpl.java
View file @
f6560013
...
...
@@ -85,6 +85,17 @@ public class DistributionOrderDaoImpl implements DistributionOrderDao {
return
distributionOrderMapper
.
selectOneByExample
(
example
);
}
@Override
public
List
<
DistributionOrder
>
findBuyRecordByItemId
(
long
itemId
)
{
DistributionOrderExample
example
=
new
DistributionOrderExample
();
DistributionOrderExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andItemIdEqualTo
(
itemId
);
criteria
.
andPayTimeIsNotNull
();
criteria
.
andStateNotEqualTo
(
101
);
example
.
setOrderByClause
(
"pay_time desc"
);
return
distributionOrderMapper
.
selectByExample
(
example
);
}
@Override
public
List
<
DistributionOrder
>
findValidOrderOfItemIdByBuyerId
(
long
buyerId
,
long
itemId
)
{
DistributionOrderExample
example
=
new
DistributionOrderExample
();
...
...
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/ItemSkuMapper.xml
View file @
f6560013
...
...
@@ -11,6 +11,7 @@
<result
column=
"is_deleted"
jdbcType=
"BIT"
property=
"isDeleted"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"sort"
jdbcType=
"INTEGER"
property=
"sort"
/>
</resultMap>
<resultMap
extends=
"BaseResultMap"
id=
"ResultMapWithBLOBs"
type=
"com.wwdz.ch.db.domain.distribution.ItemSku"
>
<result
column=
"images"
jdbcType=
"LONGVARCHAR"
property=
"images"
/>
...
...
@@ -76,7 +77,8 @@
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id, sku_code, `name`, item_id, default_image, price, is_deleted, create_time, update_time
id, sku_code, `name`, item_id, default_image, price, is_deleted, create_time, update_time,
sort
</sql>
<sql
id=
"Blob_Column_List"
>
images, videos, description
...
...
@@ -125,14 +127,14 @@
distinct
</if>
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<when
test=
"selective != null and selective.length
>
0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, sku_code, `name`, item_id, default_image, price, is_deleted, create_time, update_time,
images, videos, description
sort,
images, videos, description
</otherwise>
</choose>
from item_sku
...
...
@@ -159,14 +161,14 @@
-->
select
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<when
test=
"selective != null and selective.length
>
0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, sku_code, `name`, item_id, default_image, price, is_deleted, create_time, update_time,
images, videos, description
sort,
images, videos, description
</otherwise>
</choose>
from item_sku
...
...
@@ -188,12 +190,14 @@
</selectKey>
insert into item_sku (sku_code, `name`, item_id,
default_image, price, is_deleted,
create_time, update_time, images,
videos, description)
create_time, update_time, sort,
images, videos, description
)
values (#{skuCode,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{itemId,jdbcType=BIGINT},
#{defaultImage,jdbcType=VARCHAR}, #{price,jdbcType=BIGINT}, #{isDeleted,jdbcType=BIT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{images,jdbcType=LONGVARCHAR},
#{videos,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR})
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{sort,jdbcType=INTEGER},
#{images,jdbcType=LONGVARCHAR}, #{videos,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.distribution.ItemSku"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Long"
>
...
...
@@ -225,6 +229,9 @@
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"sort != null"
>
sort,
</if>
<if
test=
"images != null"
>
images,
</if>
...
...
@@ -260,6 +267,9 @@
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"sort != null"
>
#{sort,jdbcType=INTEGER},
</if>
<if
test=
"images != null"
>
#{images,jdbcType=LONGVARCHAR},
</if>
...
...
@@ -307,6 +317,9 @@
<if
test=
"record.updateTime != null"
>
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"record.sort != null"
>
sort = #{record.sort,jdbcType=INTEGER},
</if>
<if
test=
"record.images != null"
>
images = #{record.images,jdbcType=LONGVARCHAR},
</if>
...
...
@@ -332,6 +345,7 @@
is_deleted = #{record.isDeleted,jdbcType=BIT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
sort = #{record.sort,jdbcType=INTEGER},
images = #{record.images,jdbcType=LONGVARCHAR},
videos = #{record.videos,jdbcType=LONGVARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR}
...
...
@@ -349,7 +363,8 @@
price = #{record.price,jdbcType=BIGINT},
is_deleted = #{record.isDeleted,jdbcType=BIT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
sort = #{record.sort,jdbcType=INTEGER}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
...
...
@@ -381,6 +396,9 @@
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"sort != null"
>
sort = #{sort,jdbcType=INTEGER},
</if>
<if
test=
"images != null"
>
images = #{images,jdbcType=LONGVARCHAR},
</if>
...
...
@@ -403,6 +421,7 @@
is_deleted = #{isDeleted,jdbcType=BIT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
sort = #{sort,jdbcType=INTEGER},
images = #{images,jdbcType=LONGVARCHAR},
videos = #{videos,jdbcType=LONGVARCHAR},
description = #{description,jdbcType=LONGVARCHAR}
...
...
@@ -417,7 +436,8 @@
price = #{price,jdbcType=BIGINT},
is_deleted = #{isDeleted,jdbcType=BIT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
update_time = #{updateTime,jdbcType=TIMESTAMP},
sort = #{sort,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
<select
id=
"selectOneByExample"
parameterType=
"com.wwdz.ch.db.domain.distribution.ItemSkuExample"
resultMap=
"BaseResultMap"
>
...
...
@@ -467,14 +487,14 @@
select
'true' as QUERYID,
<choose>
<when
test=
"selective != null and selective.length
>
0"
>
<when
test=
"selective != null and selective.length
>
0"
>
<foreach
collection=
"selective"
item=
"column"
separator=
","
>
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, sku_code, `name`, item_id, default_image, price, is_deleted, create_time, update_time,
images, videos, description
sort,
images, videos, description
</otherwise>
</choose>
from item_sku
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/BlindBoxDetailVo.java
0 → 100644
View file @
f6560013
package
com.wwdz.ch.wx.entity.vo.distribution
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
@Data
public
class
BlindBoxDetailVo
implements
Entity
{
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/BlindBoxInfoVo.java
0 → 100644
View file @
f6560013
package
com.wwdz.ch.wx.entity.vo.distribution
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
BlindBoxInfoVo
implements
Entity
{
/**
* 名称
*/
private
String
name
;
/**
* 价格
*/
private
String
price
;
/**
* 图片
* 默认展示前五个sku图片
*/
private
List
<
String
>
imageList
;
/**
* 盲盒总sku数量
*/
private
Long
totalNum
;
/**
* 剩下sku数量
*/
private
Long
remainNum
;
/**
* 购买记录
*/
private
String
buyRecord
;
/**
* 优惠活动
*/
private
String
sellActivity
;
/**
* 背景图
*/
private
String
backgroundImage
;
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/BlindBoxVo.java
View file @
f6560013
...
...
@@ -7,6 +7,12 @@ import java.util.List;
@Data
public
class
BlindBoxVo
implements
Entity
{
/**
* 优惠活动描述
*/
private
String
desc
;
/**
* 优惠活动
*/
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/BlindBoxServiceImpl.java
View file @
f6560013
package
com.wwdz.ch.wx.impl.distribution
;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.CacheUtil
;
import
com.wwdz.ch.core.util.PriceUtil
;
import
com.wwdz.ch.core.util.StringUtil
;
import
com.wwdz.ch.db.dao.distribution.DistributionOrderDao
;
import
com.wwdz.ch.db.dao.distribution.ItemSkuDao
;
import
com.wwdz.ch.db.dao.distribution.SupplierItemDao
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.domain.distribution.DistributionOrder
;
import
com.wwdz.ch.db.domain.distribution.ItemSku
;
import
com.wwdz.ch.db.domain.distribution.SupplierItem
;
import
com.wwdz.ch.db.dto.request.distribution.ItemSkuRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto
;
import
com.wwdz.ch.wx.entity.vo.distribution.BlindBoxInfoVo
;
import
com.wwdz.ch.wx.entity.vo.distribution.BlindBoxVo
;
import
com.wwdz.ch.wx.service.distribution.BlindBoxService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
@Service
...
...
@@ -29,6 +40,12 @@ public class BlindBoxServiceImpl implements BlindBoxService {
@Autowired
ItemSkuDao
itemSkuDao
;
@Autowired
DistributionOrderDao
distributionOrderDao
;
@Autowired
CacheUtil
cacheUtil
;
@Override
public
Result
findForHomePage
(
SupplierItemRequestDto
dto
)
{
try
{
...
...
@@ -51,7 +68,7 @@ public class BlindBoxServiceImpl implements BlindBoxService {
itemList
.
add
(
imageList
);
}
BlindBoxVo
blindBoxVo
=
new
BlindBoxVo
();
blindBoxVo
.
setSellActivity
(
"全场限时
立减五
元"
);
blindBoxVo
.
setSellActivity
(
"全场限时
立减5
元"
);
blindBoxVo
.
setItemList
(
itemList
);
return
Result
.
success
(
blindBoxVo
);
}
catch
(
Exception
e
)
{
...
...
@@ -64,7 +81,52 @@ public class BlindBoxServiceImpl implements BlindBoxService {
@Override
public
Result
findList
(
SupplierItemRequestDto
dto
)
{
try
{
List
<
BlindBoxInfoVo
>
blindBoxInfoVoList
=
new
ArrayList
<>();
dto
.
setType
(
DistributionEnum
.
DistributionTypeEnum
.
BLACK_COLLECTION
.
getCode
());
dto
.
setStock
(
0
);
dto
.
setIsDeleted
(
false
);
List
<
SupplierItem
>
supplierItemList
=
supplierItemDao
.
findList
(
dto
);
for
(
SupplierItem
supplierItem
:
supplierItemList
)
{
BlindBoxInfoVo
blindBoxInfoVo
=
new
BlindBoxInfoVo
();
long
itemId
=
supplierItem
.
getId
();
ItemSkuRequestDto
itemSkuRequestDto
=
new
ItemSkuRequestDto
();
itemSkuRequestDto
.
setItemId
(
itemId
);
itemSkuRequestDto
.
setLimit
(
5
);
List
<
ItemSku
>
itemSkuList
=
itemSkuDao
.
findByPage
(
itemSkuRequestDto
);
PageInfo
pageInfo
=
new
PageInfo
<>(
itemSkuList
);
List
<
String
>
imageList
=
new
ArrayList
<>();
for
(
ItemSku
itemSku
:
itemSkuList
)
{
imageList
.
add
(
itemSku
.
getDefaultImage
());
}
blindBoxInfoVo
.
setImageList
(
imageList
);
blindBoxInfoVo
.
setName
(
supplierItem
.
getName
());
blindBoxInfoVo
.
setPrice
(
PriceUtil
.
convertPriceFenToYuan
(
supplierItem
.
getDistributionPrice
()));
blindBoxInfoVo
.
setTotalNum
(
pageInfo
.
getTotal
());
blindBoxInfoVo
.
setRemainNum
(
supplierItem
.
getStock
().
longValue
());
//查询最近的购买记录
List
<
DistributionOrder
>
distributionOrderList
=
distributionOrderDao
.
findBuyRecordByItemId
(
itemId
);
if
(!
CollectionUtils
.
isEmpty
(
distributionOrderList
))
{
DistributionOrder
lastedRecord
=
distributionOrderList
.
get
(
0
);
long
buyerId
=
lastedRecord
.
getBuyerId
();
User
user
=
cacheUtil
.
appletUserInfoCache
.
get
(
buyerId
).
get
();
String
nickName
=
StringUtils
.
isEmpty
(
user
.
getNickname
())
?
"微信用户"
:
user
.
getNickname
();
nickName
=
StringUtil
.
anonymizeUsername
(
nickName
);
long
diffInMillies
=
Math
.
abs
(
new
Date
().
getTime
()
-
lastedRecord
.
getPayTime
().
getTime
());
long
diffInHours
=
diffInMillies
/
(
60
*
1000
*
60
);
String
buyRecord
=
""
;
if
(
diffInHours
>=
1
&&
diffInHours
<
24
)
{
buyRecord
=
nickName
+
" "
+
diffInHours
+
"小时前下单"
;
}
else
if
(
diffInHours
>
24
)
{
long
diffInDays
=
diffInMillies
/
(
60
*
1000
*
60
*
24
);
buyRecord
=
nickName
+
" "
+
diffInDays
+
"天前下单"
;
}
else
{
buyRecord
=
nickName
+
" 1小时内下单"
;
}
blindBoxInfoVo
.
setBuyRecord
(
buyRecord
);
}
blindBoxInfoVoList
.
add
(
blindBoxInfoVo
);
}
return
Result
.
success
(
blindBoxInfoVoList
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询盲袋商品列表 error : {}"
,
e
);
}
...
...
@@ -78,13 +140,12 @@ public class BlindBoxServiceImpl implements BlindBoxService {
dto
.
setType
(
DistributionEnum
.
DistributionTypeEnum
.
BLACK_COLLECTION
.
getCode
());
dto
.
setStock
(
0
);
dto
.
setIsDeleted
(
false
);
dto
.
setLimit
(
3
);
List
<
SupplierItem
>
supplierItemList
=
supplierItemDao
.
findList
(
dto
);
for
(
SupplierItem
supplierItem
:
supplierItemList
)
{
long
itemId
=
supplierItem
.
getId
();
ItemSkuRequestDto
itemSkuRequestDto
=
new
ItemSkuRequestDto
();
itemSkuRequestDto
.
setItemId
(
itemId
);
itemSkuRequestDto
.
setLimit
(
3
);
itemSkuRequestDto
.
setLimit
(
5
);
List
<
ItemSku
>
itemSkuList
=
itemSkuDao
.
findByPage
(
itemSkuRequestDto
);
List
<
String
>
imageList
=
new
ArrayList
<>();
for
(
ItemSku
itemSku
:
itemSkuList
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/distribution/BlindBoxService.java
View file @
f6560013
...
...
@@ -9,7 +9,7 @@ import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
public
interface
BlindBoxService
{
/**
* 查询首页福袋
* 查询首页福袋
专区信息
* @param dto
* @return
*/
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/distribution/BlindBoxController.java
0 → 100644
View file @
f6560013
package
com.wwdz.ch.wx.web.distribution
;
import
com.alibaba.fastjson.JSON
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto
;
import
com.wwdz.ch.wx.service.distribution.BlindBoxService
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/wx/blindBox"
)
public
class
BlindBoxController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
BlindBoxController
.
class
);
@Autowired
BlindBoxService
blindBoxService
;
@ApiOperation
(
value
=
"查询首页福袋专区信息"
)
@PostMapping
(
"/findForHomePage"
)
public
Result
findForHomePage
(
@RequestBody
SupplierItemRequestDto
dto
)
{
logger
.
info
(
"查询首页福袋专区信息,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
return
blindBoxService
.
findForHomePage
(
dto
);
}
@ApiOperation
(
value
=
"查询福袋列表"
)
@PostMapping
(
"/findList"
)
public
Result
findList
(
@RequestBody
SupplierItemRequestDto
dto
)
{
logger
.
info
(
"查询福袋列表,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
return
blindBoxService
.
findList
(
dto
);
}
@ApiOperation
(
value
=
"查询福袋详情"
)
@PostMapping
(
"/findDetail"
)
public
Result
findDetail
(
@RequestBody
SupplierItemRequestDto
dto
)
{
logger
.
info
(
"查询福袋详情,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
return
blindBoxService
.
findDetail
(
dto
);
}
}
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