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
8ffa328e
Commit
8ffa328e
authored
Nov 14, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
盲盒专区
parent
f6560013
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
380 additions
and
45 deletions
+380
-45
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/DistributionOrder.java
...com/wwdz/ch/db/domain/distribution/DistributionOrder.java
+12
-3
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/DistributionOrderExample.java
...z/ch/db/domain/distribution/DistributionOrderExample.java
+142
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/DistributionOrderRequestDto.java
...dto/request/distribution/DistributionOrderRequestDto.java
+5
-0
ch-dao/src/main/java/com/wwdz/ch/db/mapper/distribution/DistributionOrderMapper.java
...dz/ch/db/mapper/distribution/DistributionOrderMapper.java
+0
-1
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/DistributionOrderMapper.xml
...wdz/ch/db/mapper/distribution/DistributionOrderMapper.xml
+26
-10
ch-dao/src/main/resources/generatorConfig_new.xml
ch-dao/src/main/resources/generatorConfig_new.xml
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/BlindBoxBuyRecordVo.java
...wdz/ch/wx/entity/vo/distribution/BlindBoxBuyRecordVo.java
+37
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/BlindBoxDetailVo.java
...m/wwdz/ch/wx/entity/vo/distribution/BlindBoxDetailVo.java
+46
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/ItemSkuVo.java
...java/com/wwdz/ch/wx/entity/vo/distribution/ItemSkuVo.java
+29
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/BlindBoxServiceImpl.java
...com/wwdz/ch/wx/impl/distribution/BlindBoxServiceImpl.java
+75
-25
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributionOrderServiceImpl.java
...ch/wx/impl/distribution/DistributionOrderServiceImpl.java
+4
-2
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/WxPayServiceTest.java
...pi/src/test/java/com/wwdz/ch/wx/api/WxPayServiceTest.java
+3
-3
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/DistributionOrder.java
View file @
8ffa328e
...
...
@@ -11,7 +11,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2024/
09/11
* @date 2024/
11/14
*/
@Data
public
class
DistributionOrder
implements
Entity
{
...
...
@@ -182,6 +182,11 @@ public class DistributionOrder implements Entity {
*/
private
Boolean
isMultiple
;
/**
* 备注
*/
private
String
remark
;
private
static
final
long
serialVersionUID
=
1L
;
@Override
...
...
@@ -224,6 +229,7 @@ public class DistributionOrder implements Entity {
sb
.
append
(
", channelAmount="
).
append
(
channelAmount
);
sb
.
append
(
", channelRebate="
).
append
(
channelRebate
);
sb
.
append
(
", isMultiple="
).
append
(
isMultiple
);
sb
.
append
(
", remark="
).
append
(
remark
);
sb
.
append
(
", serialVersionUID="
).
append
(
serialVersionUID
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
...
...
@@ -274,7 +280,8 @@ public class DistributionOrder implements Entity {
&&
(
this
.
getIntroducerId
()
==
null
?
other
.
getIntroducerId
()
==
null
:
this
.
getIntroducerId
().
equals
(
other
.
getIntroducerId
()))
&&
(
this
.
getChannelAmount
()
==
null
?
other
.
getChannelAmount
()
==
null
:
this
.
getChannelAmount
().
equals
(
other
.
getChannelAmount
()))
&&
(
this
.
getChannelRebate
()
==
null
?
other
.
getChannelRebate
()
==
null
:
this
.
getChannelRebate
().
equals
(
other
.
getChannelRebate
()))
&&
(
this
.
getIsMultiple
()
==
null
?
other
.
getIsMultiple
()
==
null
:
this
.
getIsMultiple
().
equals
(
other
.
getIsMultiple
()));
&&
(
this
.
getIsMultiple
()
==
null
?
other
.
getIsMultiple
()
==
null
:
this
.
getIsMultiple
().
equals
(
other
.
getIsMultiple
()))
&&
(
this
.
getRemark
()
==
null
?
other
.
getRemark
()
==
null
:
this
.
getRemark
().
equals
(
other
.
getRemark
()));
}
@Override
...
...
@@ -315,6 +322,7 @@ public class DistributionOrder implements Entity {
result
=
prime
*
result
+
((
getChannelAmount
()
==
null
)
?
0
:
getChannelAmount
().
hashCode
());
result
=
prime
*
result
+
((
getChannelRebate
()
==
null
)
?
0
:
getChannelRebate
().
hashCode
());
result
=
prime
*
result
+
((
getIsMultiple
()
==
null
)
?
0
:
getIsMultiple
().
hashCode
());
result
=
prime
*
result
+
((
getRemark
()
==
null
)
?
0
:
getRemark
().
hashCode
());
return
result
;
}
...
...
@@ -359,7 +367,8 @@ public class DistributionOrder implements Entity {
introducerId
(
"introducer_id"
,
"introducerId"
,
"BIGINT"
,
false
),
channelAmount
(
"channel_amount"
,
"channelAmount"
,
"BIGINT"
,
false
),
channelRebate
(
"channel_rebate"
,
"channelRebate"
,
"DECIMAL"
,
false
),
isMultiple
(
"is_multiple"
,
"isMultiple"
,
"BIT"
,
false
);
isMultiple
(
"is_multiple"
,
"isMultiple"
,
"BIT"
,
false
),
remark
(
"remark"
,
"remark"
,
"VARCHAR"
,
false
);
/**
* This field was generated by MyBatis Generator.
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/DistributionOrderExample.java
View file @
8ffa328e
...
...
@@ -4736,6 +4736,148 @@ public class DistributionOrderExample {
addCriterion
(
"is_multiple not between"
,
value1
,
value2
,
"isMultiple"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRemarkIsNull
()
{
addCriterion
(
"remark is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRemarkIsNotNull
()
{
addCriterion
(
"remark is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRemarkEqualTo
(
String
value
)
{
addCriterion
(
"remark ="
,
value
,
"remark"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andRemarkEqualToColumn
(
DistributionOrder
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"remark = "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andRemarkNotEqualTo
(
String
value
)
{
addCriterion
(
"remark <>"
,
value
,
"remark"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andRemarkNotEqualToColumn
(
DistributionOrder
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"remark <> "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andRemarkGreaterThan
(
String
value
)
{
addCriterion
(
"remark >"
,
value
,
"remark"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andRemarkGreaterThanColumn
(
DistributionOrder
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"remark > "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andRemarkGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"remark >="
,
value
,
"remark"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andRemarkGreaterThanOrEqualToColumn
(
DistributionOrder
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"remark >= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andRemarkLessThan
(
String
value
)
{
addCriterion
(
"remark <"
,
value
,
"remark"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andRemarkLessThanColumn
(
DistributionOrder
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"remark < "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andRemarkLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"remark <="
,
value
,
"remark"
);
return
(
Criteria
)
this
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public
Criteria
andRemarkLessThanOrEqualToColumn
(
DistributionOrder
.
Column
column
)
{
addCriterion
(
new
StringBuilder
(
"remark <= "
).
append
(
column
.
getEscapedColumnName
()).
toString
());
return
(
Criteria
)
this
;
}
public
Criteria
andRemarkLike
(
String
value
)
{
addCriterion
(
"remark like"
,
value
,
"remark"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRemarkNotLike
(
String
value
)
{
addCriterion
(
"remark not like"
,
value
,
"remark"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRemarkIn
(
List
<
String
>
values
)
{
addCriterion
(
"remark in"
,
values
,
"remark"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRemarkNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"remark not in"
,
values
,
"remark"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRemarkBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"remark between"
,
value1
,
value2
,
"remark"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRemarkNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"remark not between"
,
value1
,
value2
,
"remark"
);
return
(
Criteria
)
this
;
}
}
public
static
class
Criteria
extends
GeneratedCriteria
{
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/DistributionOrderRequestDto.java
View file @
8ffa328e
...
...
@@ -145,6 +145,11 @@ public class DistributionOrderRequestDto extends BaseRequestDto implements Entit
*/
private
List
<
Integer
>
filterStateList
;
/**
* 盲袋订单,存放盲袋编码,多个用逗号分割
*/
private
String
remark
;
/**
* 微信支付订单号
*/
...
...
ch-dao/src/main/java/com/wwdz/ch/db/mapper/distribution/DistributionOrderMapper.java
View file @
8ffa328e
...
...
@@ -4,7 +4,6 @@ import com.wwdz.ch.db.bean.DistributionOrderNum;
import
com.wwdz.ch.db.domain.distribution.DistributionOrder
;
import
com.wwdz.ch.db.domain.distribution.DistributionOrderExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/DistributionOrderMapper.xml
View file @
8ffa328e
...
...
@@ -36,6 +36,7 @@
<result
column=
"channel_amount"
jdbcType=
"BIGINT"
property=
"channelAmount"
/>
<result
column=
"channel_rebate"
jdbcType=
"DECIMAL"
property=
"channelRebate"
/>
<result
column=
"is_multiple"
jdbcType=
"BIT"
property=
"isMultiple"
/>
<result
column=
"remark"
jdbcType=
"VARCHAR"
property=
"remark"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
...
...
@@ -101,7 +102,7 @@
receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time,
signed_time, finish_time, update_time, share_record_id, `state`, logistics_state,
`type`, supply_price, introduce_amount, introduce_rebate, introducer_id, channel_amount,
channel_rebate, is_multiple
channel_rebate, is_multiple
, remark
</sql>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.distribution.DistributionOrderExample"
resultMap=
"BaseResultMap"
>
select
...
...
@@ -141,7 +142,7 @@
receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time,
signed_time, finish_time, update_time, share_record_id, `state`, logistics_state,
`type`, supply_price, introduce_amount, introduce_rebate, introducer_id, channel_amount,
channel_rebate, is_multiple
channel_rebate, is_multiple
, remark
</otherwise>
</choose>
from distribution_order
...
...
@@ -177,7 +178,7 @@
receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time,
signed_time, finish_time, update_time, share_record_id, `state`, logistics_state,
`type`, supply_price, introduce_amount, introduce_rebate, introducer_id, channel_amount,
channel_rebate, is_multiple
channel_rebate, is_multiple
, remark
</otherwise>
</choose>
from distribution_order
...
...
@@ -207,8 +208,8 @@
update_time, share_record_id, `state`,
logistics_state, `type`, supply_price,
introduce_amount, introduce_rebate, introducer_id,
channel_amount, channel_rebate, is_multiple
)
channel_amount, channel_rebate, is_multiple
,
remark
)
values (#{distributionOrderId,jdbcType=VARCHAR}, #{prepayId,jdbcType=VARCHAR}, #{transactionId,jdbcType=VARCHAR},
#{itemId,jdbcType=BIGINT}, #{itemNum,jdbcType=INTEGER}, #{buyerId,jdbcType=BIGINT},
#{buyerOpenid,jdbcType=VARCHAR}, #{shopId,jdbcType=BIGINT}, #{sellerId,jdbcType=BIGINT},
...
...
@@ -219,8 +220,8 @@
#{updateTime,jdbcType=TIMESTAMP}, #{shareRecordId,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER},
#{logisticsState,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{supplyPrice,jdbcType=BIGINT},
#{introduceAmount,jdbcType=BIGINT}, #{introduceRebate,jdbcType=DECIMAL}, #{introducerId,jdbcType=BIGINT},
#{channelAmount,jdbcType=BIGINT}, #{channelRebate,jdbcType=DECIMAL}, #{isMultiple,jdbcType=BIT}
)
#{channelAmount,jdbcType=BIGINT}, #{channelRebate,jdbcType=DECIMAL}, #{isMultiple,jdbcType=BIT}
,
#{remark,jdbcType=VARCHAR}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.distribution.DistributionOrder"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Integer"
>
...
...
@@ -327,6 +328,9 @@
<if
test=
"isMultiple != null"
>
is_multiple,
</if>
<if
test=
"remark != null"
>
remark,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"distributionOrderId != null"
>
...
...
@@ -428,6 +432,9 @@
<if
test=
"isMultiple != null"
>
#{isMultiple,jdbcType=BIT},
</if>
<if
test=
"remark != null"
>
#{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"com.wwdz.ch.db.domain.distribution.DistributionOrderExample"
resultType=
"java.lang.Long"
>
...
...
@@ -541,6 +548,9 @@
<if
test=
"record.isMultiple != null"
>
is_multiple = #{record.isMultiple,jdbcType=BIT},
</if>
<if
test=
"record.remark != null"
>
remark = #{record.remark,jdbcType=VARCHAR},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
...
...
@@ -581,7 +591,8 @@
introducer_id = #{record.introducerId,jdbcType=BIGINT},
channel_amount = #{record.channelAmount,jdbcType=BIGINT},
channel_rebate = #{record.channelRebate,jdbcType=DECIMAL},
is_multiple = #{record.isMultiple,jdbcType=BIT}
is_multiple = #{record.isMultiple,jdbcType=BIT},
remark = #{record.remark,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
...
...
@@ -688,6 +699,9 @@
<if
test=
"isMultiple != null"
>
is_multiple = #{isMultiple,jdbcType=BIT},
</if>
<if
test=
"remark != null"
>
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
...
...
@@ -725,7 +739,8 @@
introducer_id = #{introducerId,jdbcType=BIGINT},
channel_amount = #{channelAmount,jdbcType=BIGINT},
channel_rebate = #{channelRebate,jdbcType=DECIMAL},
is_multiple = #{isMultiple,jdbcType=BIT}
is_multiple = #{isMultiple,jdbcType=BIT},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select
id=
"selectOneByExample"
parameterType=
"com.wwdz.ch.db.domain.distribution.DistributionOrderExample"
resultMap=
"BaseResultMap"
>
...
...
@@ -766,7 +781,7 @@
receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time,
signed_time, finish_time, update_time, share_record_id, `state`, logistics_state,
`type`, supply_price, introduce_amount, introduce_rebate, introducer_id, channel_amount,
channel_rebate, is_multiple
channel_rebate, is_multiple
, remark
</otherwise>
</choose>
from distribution_order
...
...
@@ -778,6 +793,7 @@
</if>
limit 1
</select>
<select
id=
"countGroupByStateForDistributor"
parameterType=
"java.lang.Long"
resultType=
"com.wwdz.ch.db.bean.DistributionOrderNum"
>
select state, count(distribution_order_id) as num from distribution_order where seller_id = #{sellerId} and type != 7 group by state
</select>
...
...
ch-dao/src/main/resources/generatorConfig_new.xml
View file @
8ffa328e
...
...
@@ -72,7 +72,7 @@
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"com.wwdz.ch.db.mapper.distribution"
targetProject=
"ch-dao/src/main/java"
/>
<table
tableName=
"
item_sku
"
enableCountByExample=
"true"
enableUpdateByExample=
"true"
enableDeleteByExample=
"true"
enableSelectByExample=
"true"
selectByExampleQueryId=
"true"
>
<table
tableName=
"
distribution_order
"
enableCountByExample=
"true"
enableUpdateByExample=
"true"
enableDeleteByExample=
"true"
enableSelectByExample=
"true"
selectByExampleQueryId=
"true"
>
<generatedKey
column=
"id"
sqlStatement=
"Mysql"
identity=
"true"
/>
</table>
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/BlindBoxBuyRecordVo.java
0 → 100644
View file @
8ffa328e
package
com.wwdz.ch.wx.entity.vo.distribution
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
BlindBoxBuyRecordVo
implements
Entity
{
/**
* 用户id
*/
private
Long
userId
;
/**
* 用户名称
*/
private
String
userName
;
/**
* 用户头像
*/
private
String
avatar
;
/**
* 购买时间
*/
private
Date
payTime
;
/**
* 购买的盲袋编号,顿号分割
*/
private
String
boxCodes
;
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/BlindBoxDetailVo.java
View file @
8ffa328e
...
...
@@ -2,10 +2,56 @@ package com.wwdz.ch.wx.entity.vo.distribution;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
@Data
public
class
BlindBoxDetailVo
implements
Entity
{
/**
* 名称
*/
private
String
name
;
/**
* 价格
*/
private
String
price
;
/**
* 盲盒中sku信息
*/
List
<
ItemSkuVo
>
itemSkuVoList
;
/**
* 福袋视频
*/
private
List
<
String
>
videos
;
/**
* 福袋图片
*/
private
List
<
String
>
images
;
/**
* 盲盒总sku数量
*/
private
Long
totalNum
;
/**
* 剩下sku数量
*/
private
Long
remainNum
;
/**
* 盲盒对应编号是否售卖出去
*/
private
List
<
Map
<
String
,
Object
>>
isSelledRecords
;
/**
* 盲袋购买记录
*/
private
List
<
BlindBoxBuyRecordVo
>
buyRecordList
;
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/distribution/ItemSkuVo.java
0 → 100644
View file @
8ffa328e
package
com.wwdz.ch.wx.entity.vo.distribution
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
@Data
public
class
ItemSkuVo
implements
Entity
{
/**
* sku编码
*/
private
String
skuCode
;
/**
* 名称
*/
private
String
name
;
/**
* 默认图
*/
private
String
defaultImage
;
/**
* 价格,单位元
*/
private
String
price
;
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/BlindBoxServiceImpl.java
View file @
8ffa328e
package
com.wwdz.ch.wx.impl.distribution
;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.core.consts.CommConsts
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.CacheUtil
;
...
...
@@ -15,9 +16,9 @@ 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.entity.vo.distribution.*
;
import
com.wwdz.ch.wx.service.distribution.BlindBoxService
;
import
com.xxdxxs.utils.EntityMapper
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -25,9 +26,7 @@ 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
;
import
java.util.*
;
@Service
public
class
BlindBoxServiceImpl
implements
BlindBoxService
{
...
...
@@ -103,7 +102,7 @@ public class BlindBoxServiceImpl implements BlindBoxService {
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
);
...
...
@@ -136,27 +135,78 @@ public class BlindBoxServiceImpl implements BlindBoxService {
@Override
public
Result
findDetail
(
SupplierItemRequestDto
dto
)
{
try
{
List
<
List
<
String
>>
itemList
=
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
)
{
long
itemId
=
supplierItem
.
getId
();
ItemSkuRequestDto
itemSkuRequestDto
=
new
ItemSkuRequestDto
();
itemSkuRequestDto
.
setItemId
(
itemId
);
itemSkuRequestDto
.
setLimit
(
5
);
List
<
ItemSku
>
itemSkuList
=
itemSkuDao
.
findByPage
(
itemSkuRequestDto
);
List
<
String
>
imageList
=
new
ArrayList
<>();
for
(
ItemSku
itemSku
:
itemSkuList
)
{
imageList
.
add
(
itemSku
.
getDefaultImage
());
long
itemId
=
dto
.
getId
();
BlindBoxDetailVo
blindBoxDetailVo
=
new
BlindBoxDetailVo
();
SupplierItem
supplierItem
=
supplierItemDao
.
findById
(
dto
.
getItemId
());
ItemSkuRequestDto
itemSkuRequestDto
=
new
ItemSkuRequestDto
();
itemSkuRequestDto
.
setItemId
(
itemId
);
itemSkuRequestDto
.
setLimit
(
500
);
List
<
ItemSku
>
itemSkuList
=
itemSkuDao
.
findByPage
(
itemSkuRequestDto
);
PageInfo
pageInfo
=
new
PageInfo
<>(
itemSkuList
);
List
<
ItemSkuVo
>
itemSkuVoList
=
new
ArrayList
<>();
for
(
ItemSku
itemSku
:
itemSkuList
)
{
ItemSkuVo
itemSkuVo
=
new
ItemSkuVo
();
EntityMapper
.
copyAttribute
(
itemSku
,
itemSkuVo
);
itemSkuVo
.
setPrice
(
PriceUtil
.
convertPriceFenToYuan
(
itemSku
.
getPrice
()));
itemSkuVoList
.
add
(
itemSkuVo
);
}
blindBoxDetailVo
.
setItemSkuVoList
(
itemSkuVoList
);
if
(
StringUtils
.
hasLength
(
supplierItem
.
getImages
()))
{
blindBoxDetailVo
.
setImages
(
Arrays
.
asList
(
supplierItem
.
getImages
().
split
(
";"
)));
}
if
(
StringUtils
.
hasLength
(
supplierItem
.
getVideos
()))
{
blindBoxDetailVo
.
setVideos
(
Arrays
.
asList
(
supplierItem
.
getVideos
().
split
(
";"
)));
}
blindBoxDetailVo
.
setName
(
supplierItem
.
getName
());
blindBoxDetailVo
.
setPrice
(
PriceUtil
.
convertPriceFenToYuan
(
supplierItem
.
getDistributionPrice
()));
blindBoxDetailVo
.
setTotalNum
(
pageInfo
.
getTotal
());
blindBoxDetailVo
.
setRemainNum
(
supplierItem
.
getStock
().
longValue
());
//查询购买记录
//盲袋的编码
List
<
String
>
codes
=
new
ArrayList
<>();
List
<
BlindBoxBuyRecordVo
>
blindBoxBuyRecordVoList
=
new
ArrayList
<>();
List
<
DistributionOrder
>
distributionOrderList
=
distributionOrderDao
.
findBuyRecordByItemId
(
itemId
);
for
(
DistributionOrder
distributionOrder
:
distributionOrderList
)
{
BlindBoxBuyRecordVo
blindBoxBuyRecordVo
=
new
BlindBoxBuyRecordVo
();
blindBoxBuyRecordVo
.
setUserId
(
distributionOrder
.
getBuyerId
());
User
user
=
cacheUtil
.
appletUserInfoCache
.
get
(
distributionOrder
.
getBuyerId
()).
get
();
blindBoxBuyRecordVo
.
setUserName
(
StringUtils
.
hasLength
(
user
.
getNickname
())
?
user
.
getNickname
()
:
"微信用户"
);
blindBoxBuyRecordVo
.
setAvatar
(
StringUtils
.
hasLength
(
user
.
getAvatar
())
?
user
.
getAvatar
()
:
CommConsts
.
DEFAULT_AVATAR
);
blindBoxBuyRecordVo
.
setPayTime
(
distributionOrder
.
getPayTime
());
//购买记录中,盲袋的编号
String
remark
=
distributionOrder
.
getRemark
();
StringBuffer
stringBuffer
=
new
StringBuffer
();
if
(
StringUtils
.
hasLength
(
remark
))
{
for
(
String
code
:
remark
.
split
(
","
))
{
stringBuffer
.
append
(
code
+
"号福袋"
);
stringBuffer
.
append
(
"、"
);
codes
.
add
(
code
);
}
}
itemList
.
add
(
imageList
);
if
(
stringBuffer
.
length
()
>
0
)
{
stringBuffer
.
deleteCharAt
(
stringBuffer
.
length
()
-
1
);
}
blindBoxBuyRecordVo
.
setBoxCodes
(
stringBuffer
.
toString
());
blindBoxBuyRecordVoList
.
add
(
blindBoxBuyRecordVo
);
}
BlindBoxVo
blindBoxVo
=
new
BlindBoxVo
();
blindBoxVo
.
setSellActivity
(
"全场限时立减五元"
);
blindBoxVo
.
setItemList
(
itemList
);
return
Result
.
success
(
blindBoxVo
);
blindBoxDetailVo
.
setBuyRecordList
(
blindBoxBuyRecordVoList
);
//盲袋对应编码是否被购买
List
<
Map
<
String
,
Object
>>
codeList
=
new
ArrayList
<>();
for
(
int
i
=
1
;
i
<=
pageInfo
.
getTotal
();
i
++)
{
HashMap
<
String
,
Object
>
codeMap
=
new
HashMap
<>();
codeMap
.
put
(
"code"
,
i
);
codeMap
.
put
(
"flag"
,
false
);
if
(
codes
.
contains
(
String
.
valueOf
(
i
)))
{
codeMap
.
put
(
"flag"
,
true
);
}
codeList
.
add
(
codeMap
);
}
blindBoxDetailVo
.
setIsSelledRecords
(
codeList
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询盲袋商品列表 error : {}"
,
e
);
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributionOrderServiceImpl.java
View file @
8ffa328e
...
...
@@ -213,7 +213,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributionOrder
.
setReceiverPhone
(
dto
.
getReceiverPhone
());
distributionOrder
.
setCreateTime
(
new
Date
());
distributionOrder
.
setUpdateTime
(
new
Date
());
distributionOrder
.
setType
(
DistributionEnum
.
DistributionTypeEnum
.
FIXED_PRICE
.
getCode
());
distributionOrder
.
setType
(
dto
.
getType
()
==
null
?
DistributionEnum
.
DistributionTypeEnum
.
FIXED_PRICE
.
getCode
()
:
dto
.
getType
());
distributionOrder
.
setRemark
(
dto
.
getRemark
());
distributionOrder
.
setState
(
DistributionEnum
.
DistributionOrderStateEnum
.
PRE_PAY
.
getCode
());
distributionOrderDao
.
insert
(
distributionOrder
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
...
...
@@ -477,7 +478,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributionOrder
.
setReceiverPhone
(
dto
.
getReceiverPhone
());
distributionOrder
.
setCreateTime
(
new
Date
());
distributionOrder
.
setUpdateTime
(
new
Date
());
distributionOrder
.
setType
(
DistributionEnum
.
DistributionTypeEnum
.
COLLECT
.
getCode
());
distributionOrder
.
setType
(
dto
.
getType
()
==
null
?
DistributionEnum
.
DistributionTypeEnum
.
COLLECT
.
getCode
()
:
dto
.
getType
());
distributionOrder
.
setRemark
(
dto
.
getRemark
());
distributionOrder
.
setState
(
DistributionEnum
.
DistributionOrderStateEnum
.
PRE_PAY
.
getCode
());
distributionOrderDao
.
insert
(
distributionOrder
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
...
...
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/WxPayServiceTest.java
View file @
8ffa328e
...
...
@@ -89,12 +89,12 @@ public class WxPayServiceTest {
@Test
public
void
refund
()
{
List
<
String
>
list
=
Arrays
.
asList
(
"DA24110
91934133307007
"
);
List
<
String
>
list
=
Arrays
.
asList
(
"DA24110
61130292824378"
,
"DA2411050940309904308"
,
"DA2411040955234251934
"
);
list
.
forEach
(
orderId
->{
DistributionOrderRequestDto
dto
=
new
DistributionOrderRequestDto
();
dto
.
setDistributionOrderId
(
orderId
);
dto
.
setAmount
(
"
20
"
);
dto
.
setRefundPrice
(
"
20
"
);
dto
.
setAmount
(
"
1
"
);
dto
.
setRefundPrice
(
"
1
"
);
Result
result
=
wxPayServiceApi
.
refund
(
dto
);
logger
.
info
(
"申请微信支付退款:{}"
,
result
);
});
...
...
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