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
41a6eace
Commit
41a6eace
authored
Jul 31, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编辑团购商品
parent
3deb99dd
Changes
18
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
717 additions
and
88 deletions
+717
-88
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/SysGroupPurchaseServiceImpl.java
...a/com/wwdz/ch/admin/impl/SysGroupPurchaseServiceImpl.java
+3
-0
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/SysSupplierItemServiceImpl.java
...va/com/wwdz/ch/admin/impl/SysSupplierItemServiceImpl.java
+12
-9
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/GroupPurchaseConfigDao.java
...m/wwdz/ch/db/dao/distribution/GroupPurchaseConfigDao.java
+3
-1
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/GroupPurchaseRecordDao.java
...m/wwdz/ch/db/dao/distribution/GroupPurchaseRecordDao.java
+7
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/GroupPurchaseConfig.java
...m/wwdz/ch/db/domain/distribution/GroupPurchaseConfig.java
+25
-7
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/GroupPurchaseConfigExample.java
...ch/db/domain/distribution/GroupPurchaseConfigExample.java
+310
-36
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/GroupPurchaseConfigRequestDto.java
...o/request/distribution/GroupPurchaseConfigRequestDto.java
+5
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/SupplierItemRequestDto.java
...h/db/dto/request/distribution/SupplierItemRequestDto.java
+15
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/GroupPurchaseConfigDaoImpl.java
...z/ch/db/impl/distribution/GroupPurchaseConfigDaoImpl.java
+10
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/GroupPurchaseRecordDaoImpl.java
...z/ch/db/impl/distribution/GroupPurchaseRecordDaoImpl.java
+10
-0
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/GroupPurchaseConfigMapper.xml
...z/ch/db/mapper/distribution/GroupPurchaseConfigMapper.xml
+58
-26
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/impl/distribution/GroupPurchaseServiceImpl.java
...wdz/ch/wx/impl/distribution/GroupPurchaseServiceImpl.java
+14
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/IdentifyOrderServiceImpl.java
...wdz/ch/wx/impl/distribution/IdentifyOrderServiceImpl.java
+59
-3
ch-wx-api/src/main/java/com/wwdz/ch/wx/job/GroupPurchaseJob.java
...pi/src/main/java/com/wwdz/ch/wx/job/GroupPurchaseJob.java
+108
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/job/NewItemNoticeJob.java
...pi/src/main/java/com/wwdz/ch/wx/job/NewItemNoticeJob.java
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/distribution/GroupPurchaseService.java
...wwdz/ch/wx/service/distribution/GroupPurchaseService.java
+8
-4
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/distribution/GroupPurchaseController.java
.../wwdz/ch/wx/web/distribution/GroupPurchaseController.java
+68
-0
No files found.
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/SysGroupPurchaseServiceImpl.java
View file @
41a6eace
...
...
@@ -74,6 +74,9 @@ public class SysGroupPurchaseServiceImpl implements SysGroupPurchaseService {
groupPurchaseConfig
.
setState
(
GroupPurchaseEnum
.
ItemStateEnum
.
NOT_START
.
getCode
());
groupPurchaseConfig
.
setIsValid
(
true
);
groupPurchaseConfig
.
setIsDeal
(
false
);
groupPurchaseConfig
.
setTargetNum
(
0
);
//不限购
groupPurchaseConfig
.
setLimitNum
(
supplierItem
.
getStock
());
groupPurchaseConfig
.
setCreateTime
(
now
);
groupPurchaseConfig
.
setUpdateTime
(
now
);
groupPurchaseConfigDao
.
insert
(
groupPurchaseConfig
);
...
...
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/SysSupplierItemServiceImpl.java
View file @
41a6eace
...
...
@@ -89,8 +89,6 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
@Autowired
GroupPurchaseConfigDao
groupPurchaseConfigDao
;
@Autowired
GroupPurchaseDiscountDao
groupPurchaseDiscountDao
;
@Override
@Transactional
...
...
@@ -163,6 +161,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
DistributionEnum
.
DistributionTypeEnum
.
AUCTION
.
getCode
(),
DistributionEnum
.
DistributionTypeEnum
.
DISCOUNT
.
getCode
()));
}
Date
now
=
new
Date
();
List
<
SupplierItem
>
supplierItemList
=
supplierItemDao
.
findList
(
dto
);
PageInfo
<
SupplierItem
>
pageInfo
=
new
PageInfo
(
supplierItemList
);
supplierItemList
.
forEach
(
supplierItem
->
{
...
...
@@ -191,8 +190,13 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
}
}
else
if
(
supplierItem
.
getType
()
==
DistributionEnum
.
DistributionTypeEnum
.
GROUP_PURCHASE
.
getCode
())
{
GroupPurchaseConfig
groupPurchaseConfig
=
groupPurchaseConfigDao
.
findByItemId
(
supplierItem
.
getId
());
if
(
groupPurchaseConfig
.
getEndTime
().
before
(
now
)
&&
groupPurchaseConfig
.
getState
()
!=
GroupPurchaseEnum
.
ItemStateEnum
.
END
.
getCode
())
{
groupPurchaseConfigDao
.
updateState
(
supplierItem
.
getId
(),
GroupPurchaseEnum
.
ItemStateEnum
.
END
.
getCode
());
}
else
if
(
now
.
after
(
groupPurchaseConfig
.
getStartTime
())
&&
groupPurchaseConfig
.
getEndTime
().
after
(
now
)
&&
groupPurchaseConfig
.
getState
()
==
GroupPurchaseEnum
.
ItemStateEnum
.
NOT_START
.
getCode
())
{
groupPurchaseConfigDao
.
updateState
(
groupPurchaseConfig
.
getItemId
(),
GroupPurchaseEnum
.
ItemStateEnum
.
PROCESSING
.
getCode
());
}
supplierItemVo
.
setSalePrice
(
PriceUtil
.
convertPriceFenToYuan
(
groupPurchaseConfig
.
getPrice
()));
supplierItemVo
.
setDeposit
(
PriceUtil
.
convertPriceFenToYuan
(
groupPurchaseConfig
.
getDeposit
()));
supplierItemVo
.
setGroupPurchaseStartTime
(
DateUtils
.
toString
(
groupPurchaseConfig
.
getStartTime
()));
supplierItemVo
.
setGroupPurchaseEndTime
(
DateUtils
.
toString
(
groupPurchaseConfig
.
getEndTime
()));
}
...
...
@@ -357,12 +361,8 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
//团购商品查询相关配置和优惠信息
GroupPurchaseConfig
groupPurchaseConfig
=
groupPurchaseConfigDao
.
findByItemId
(
itemId
);
supplierItemVo
.
setSalePrice
(
PriceUtil
.
convertPriceFenToYuan
(
groupPurchaseConfig
.
getPrice
()));
supplierItemVo
.
setDeposit
(
PriceUtil
.
convertPriceFenToYuan
(
groupPurchaseConfig
.
getDeposit
()));
supplierItemVo
.
setGroupPurchaseStartTime
(
DateUtils
.
toString
(
groupPurchaseConfig
.
getStartTime
()));
supplierItemVo
.
setGroupPurchaseEndTime
(
DateUtils
.
toString
(
groupPurchaseConfig
.
getEndTime
()));
List
<
GroupPurchaseDiscount
>
discountList
=
groupPurchaseDiscountDao
.
findByItemId
(
itemId
);
supplierItemVo
.
setDiscountList
(
discountList
);
}
return
Result
.
success
(
supplierItemVo
);
}
catch
(
Exception
e
)
{
...
...
@@ -403,13 +403,15 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
//设置团购商品
GroupPurchaseConfig
groupPurchaseConfig
=
groupPurchaseConfigDao
.
findByItemId
(
dto
.
getId
());
groupPurchaseConfig
.
setPrice
(
PriceUtil
.
convertPriceFromStr
(
dto
.
getSalePrice
()));
groupPurchaseConfig
.
setDeposit
(
PriceUtil
.
convertPriceFromStr
(
dto
.
getDeposit
()));
groupPurchaseConfig
.
setSupplyPrice
(
PriceUtil
.
convertPriceFromStr
(
dto
.
getSupplyPrice
()));
groupPurchaseConfig
.
setStartTime
(
DateUtils
.
parseString
(
dto
.
getGroupPurchaseStartTime
()));
groupPurchaseConfig
.
setEndTime
(
DateUtils
.
parseString
(
dto
.
getGroupPurchaseEndTime
()));
groupPurchaseConfig
.
setLimitNum
(
dto
.
getLimitNum
());
groupPurchaseConfig
.
setTargetNum
(
dto
.
getTargetNum
());
groupPurchaseConfig
.
setWxQrcode
(
dto
.
getWxQrcode
());
groupPurchaseConfigDao
.
update
(
groupPurchaseConfig
);
//设置团购商品优惠
/*
//设置团购商品优惠
//先删除之前的优惠信息,再插入新的
if (groupPurchaseDiscountDao.isExisted(dto.getId())) {
groupPurchaseDiscountDao.delete(dto.getId());
...
...
@@ -428,6 +430,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
groupPurchaseDiscount.setState(GroupPurchaseEnum.StateEnum.VALID.getCode());
groupPurchaseDiscountDao.insert(groupPurchaseDiscount);
}
*/
}
long
oldDistributionPrice
=
oldSupplierItem
.
getDistributionPrice
();
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/GroupPurchaseConfigDao.java
View file @
41a6eace
...
...
@@ -34,6 +34,8 @@ public interface GroupPurchaseConfigDao {
*/
int
updateByItemId
(
GroupPurchaseConfig
groupPurchaseConfig
);
int
updateDealByPrimaryKey
(
int
id
,
boolean
isDeal
);
/**
* 更新状态
* @param itemId
...
...
@@ -52,7 +54,7 @@ public interface GroupPurchaseConfigDao {
/**
* 查询团购商品列表
* @param
itemId
* @param
dto
* @return
*/
List
<
GroupPurchaseConfig
>
findList
(
GroupPurchaseConfigRequestDto
dto
);
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/GroupPurchaseRecordDao.java
View file @
41a6eace
...
...
@@ -38,4 +38,11 @@ public interface GroupPurchaseRecordDao {
* @return
*/
List
<
GroupPurchaseRecord
>
countPeople
(
GroupPurchaseRecordRequestDto
dto
);
/**
* 统计某商品的团购记录
* @param itemId
* @return
*/
List
<
GroupPurchaseRecord
>
findByItemId
(
long
itemId
);
}
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/GroupPurchaseConfig.java
View file @
41a6eace
...
...
@@ -10,7 +10,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2024/07/
25
* @date 2024/07/
31
*/
@Data
public
class
GroupPurchaseConfig
implements
Entity
{
...
...
@@ -50,9 +50,19 @@ public class GroupPurchaseConfig implements Entity {
private
Long
supplyPrice
;
/**
*
定金
*
目标件数
*/
private
Long
deposit
;
private
Integer
targetNum
;
/**
* 限时数量
*/
private
Integer
limitNum
;
/**
* 群聊二维码
*/
private
String
wxQrcode
;
/**
* 创建时间
...
...
@@ -94,7 +104,9 @@ public class GroupPurchaseConfig implements Entity {
sb
.
append
(
", endTime="
).
append
(
endTime
);
sb
.
append
(
", price="
).
append
(
price
);
sb
.
append
(
", supplyPrice="
).
append
(
supplyPrice
);
sb
.
append
(
", deposit="
).
append
(
deposit
);
sb
.
append
(
", targetNum="
).
append
(
targetNum
);
sb
.
append
(
", limitNum="
).
append
(
limitNum
);
sb
.
append
(
", wxQrcode="
).
append
(
wxQrcode
);
sb
.
append
(
", createTime="
).
append
(
createTime
);
sb
.
append
(
", updateTime="
).
append
(
updateTime
);
sb
.
append
(
", state="
).
append
(
state
);
...
...
@@ -124,7 +136,9 @@ public class GroupPurchaseConfig implements Entity {
&&
(
this
.
getEndTime
()
==
null
?
other
.
getEndTime
()
==
null
:
this
.
getEndTime
().
equals
(
other
.
getEndTime
()))
&&
(
this
.
getPrice
()
==
null
?
other
.
getPrice
()
==
null
:
this
.
getPrice
().
equals
(
other
.
getPrice
()))
&&
(
this
.
getSupplyPrice
()
==
null
?
other
.
getSupplyPrice
()
==
null
:
this
.
getSupplyPrice
().
equals
(
other
.
getSupplyPrice
()))
&&
(
this
.
getDeposit
()
==
null
?
other
.
getDeposit
()
==
null
:
this
.
getDeposit
().
equals
(
other
.
getDeposit
()))
&&
(
this
.
getTargetNum
()
==
null
?
other
.
getTargetNum
()
==
null
:
this
.
getTargetNum
().
equals
(
other
.
getTargetNum
()))
&&
(
this
.
getLimitNum
()
==
null
?
other
.
getLimitNum
()
==
null
:
this
.
getLimitNum
().
equals
(
other
.
getLimitNum
()))
&&
(
this
.
getWxQrcode
()
==
null
?
other
.
getWxQrcode
()
==
null
:
this
.
getWxQrcode
().
equals
(
other
.
getWxQrcode
()))
&&
(
this
.
getCreateTime
()
==
null
?
other
.
getCreateTime
()
==
null
:
this
.
getCreateTime
().
equals
(
other
.
getCreateTime
()))
&&
(
this
.
getUpdateTime
()
==
null
?
other
.
getUpdateTime
()
==
null
:
this
.
getUpdateTime
().
equals
(
other
.
getUpdateTime
()))
&&
(
this
.
getState
()
==
null
?
other
.
getState
()
==
null
:
this
.
getState
().
equals
(
other
.
getState
()))
...
...
@@ -143,7 +157,9 @@ public class GroupPurchaseConfig implements Entity {
result
=
prime
*
result
+
((
getEndTime
()
==
null
)
?
0
:
getEndTime
().
hashCode
());
result
=
prime
*
result
+
((
getPrice
()
==
null
)
?
0
:
getPrice
().
hashCode
());
result
=
prime
*
result
+
((
getSupplyPrice
()
==
null
)
?
0
:
getSupplyPrice
().
hashCode
());
result
=
prime
*
result
+
((
getDeposit
()
==
null
)
?
0
:
getDeposit
().
hashCode
());
result
=
prime
*
result
+
((
getTargetNum
()
==
null
)
?
0
:
getTargetNum
().
hashCode
());
result
=
prime
*
result
+
((
getLimitNum
()
==
null
)
?
0
:
getLimitNum
().
hashCode
());
result
=
prime
*
result
+
((
getWxQrcode
()
==
null
)
?
0
:
getWxQrcode
().
hashCode
());
result
=
prime
*
result
+
((
getCreateTime
()
==
null
)
?
0
:
getCreateTime
().
hashCode
());
result
=
prime
*
result
+
((
getUpdateTime
()
==
null
)
?
0
:
getUpdateTime
().
hashCode
());
result
=
prime
*
result
+
((
getState
()
==
null
)
?
0
:
getState
().
hashCode
());
...
...
@@ -167,7 +183,9 @@ public class GroupPurchaseConfig implements Entity {
endTime
(
"end_time"
,
"endTime"
,
"TIMESTAMP"
,
false
),
price
(
"price"
,
"price"
,
"BIGINT"
,
false
),
supplyPrice
(
"supply_price"
,
"supplyPrice"
,
"BIGINT"
,
false
),
deposit
(
"deposit"
,
"deposit"
,
"BIGINT"
,
false
),
targetNum
(
"target_num"
,
"targetNum"
,
"INTEGER"
,
false
),
limitNum
(
"limit_num"
,
"limitNum"
,
"INTEGER"
,
false
),
wxQrcode
(
"wx_qrcode"
,
"wxQrcode"
,
"VARCHAR"
,
false
),
createTime
(
"create_time"
,
"createTime"
,
"TIMESTAMP"
,
false
),
updateTime
(
"update_time"
,
"updateTime"
,
"TIMESTAMP"
,
false
),
state
(
"state"
,
"state"
,
"INTEGER"
,
true
),
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/GroupPurchaseConfigExample.java
View file @
41a6eace
This diff is collapsed.
Click to expand it.
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/GroupPurchaseConfigRequestDto.java
View file @
41a6eace
...
...
@@ -36,6 +36,11 @@ public class GroupPurchaseConfigRequestDto extends BaseRequestDto implements Ent
*/
private
Date
endTime
;
/**
* 时间范围查询
*/
private
Date
queryEndTime
;
/**
* 售价
*/
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/SupplierItemRequestDto.java
View file @
41a6eace
...
...
@@ -180,6 +180,21 @@ public class SupplierItemRequestDto extends BaseRequestDto implements Entity {
*/
private
String
groupPurchaseEndTime
;
/**
* 目标件数
*/
private
Integer
targetNum
;
/**
* 限时数量
*/
private
Integer
limitNum
;
/**
* 群聊二维码
*/
private
String
wxQrcode
;
/**
* 起拍价
* 单位元 需要转为分
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/GroupPurchaseConfigDaoImpl.java
View file @
41a6eace
...
...
@@ -39,6 +39,14 @@ public class GroupPurchaseConfigDaoImpl implements GroupPurchaseConfigDao {
return
groupPurchaseConfigMapper
.
updateByExampleSelective
(
groupPurchaseConfig
,
example
);
}
@Override
public
int
updateDealByPrimaryKey
(
int
id
,
boolean
isDeal
)
{
GroupPurchaseConfig
groupPurchaseConfig
=
new
GroupPurchaseConfig
();
groupPurchaseConfig
.
setId
(
id
);
groupPurchaseConfig
.
setIsDeal
(
isDeal
);
return
groupPurchaseConfigMapper
.
updateByPrimaryKeySelective
(
groupPurchaseConfig
);
}
@Override
public
int
updateState
(
long
itemId
,
int
state
)
{
GroupPurchaseConfigExample
example
=
new
GroupPurchaseConfigExample
();
...
...
@@ -64,6 +72,8 @@ public class GroupPurchaseConfigDaoImpl implements GroupPurchaseConfigDao {
GroupPurchaseConfigExample
.
Criteria
criteria
=
example
.
createCriteria
();
JdbcHelper
.
ifPresent
(
dto
.
getItemId
(),
criteria:
:
andItemIdEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getState
(),
criteria:
:
andStateEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getQueryEndTime
(),
criteria:
:
andEndTimeLessThanOrEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getIsDeal
(),
criteria:
:
andIsDealEqualTo
);
example
.
setOrderByClause
(
" create_time desc"
);
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getLimit
());
return
groupPurchaseConfigMapper
.
selectByExample
(
example
);
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/GroupPurchaseRecordDaoImpl.java
View file @
41a6eace
...
...
@@ -72,4 +72,14 @@ public class GroupPurchaseRecordDaoImpl implements GroupPurchaseRecordDao {
JdbcHelper
.
ifPresent
(
dto
.
getUserId
(),
criteria:
:
andUserIdEqualTo
);
return
groupPurchaseRecordMapper
.
selectByExampleSelective
(
example
,
GroupPurchaseRecord
.
Column
.
userId
);
}
@Override
public
List
<
GroupPurchaseRecord
>
findByItemId
(
long
itemId
)
{
GroupPurchaseRecordExample
example
=
new
GroupPurchaseRecordExample
();
GroupPurchaseRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andItemIdEqualTo
(
itemId
);
criteria
.
andStateEqualTo
(
1
);
return
groupPurchaseRecordMapper
.
selectByExample
(
example
);
}
}
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/GroupPurchaseConfigMapper.xml
View file @
41a6eace
...
...
@@ -9,7 +9,9 @@
<result
column=
"end_time"
jdbcType=
"TIMESTAMP"
property=
"endTime"
/>
<result
column=
"price"
jdbcType=
"BIGINT"
property=
"price"
/>
<result
column=
"supply_price"
jdbcType=
"BIGINT"
property=
"supplyPrice"
/>
<result
column=
"deposit"
jdbcType=
"BIGINT"
property=
"deposit"
/>
<result
column=
"target_num"
jdbcType=
"INTEGER"
property=
"targetNum"
/>
<result
column=
"limit_num"
jdbcType=
"INTEGER"
property=
"limitNum"
/>
<result
column=
"wx_qrcode"
jdbcType=
"VARCHAR"
property=
"wxQrcode"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"state"
jdbcType=
"INTEGER"
property=
"state"
/>
...
...
@@ -75,8 +77,8 @@
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id, item_id, creator_id, start_time, end_time, price, supply_price,
deposit, create_time
,
update_time, `state`, is_valid, is_deal
id, item_id, creator_id, start_time, end_time, price, supply_price,
target_num, limit_num
,
wx_qrcode, create_time,
update_time, `state`, is_valid, is_deal
</sql>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.distribution.GroupPurchaseConfigExample"
resultMap=
"BaseResultMap"
>
select
...
...
@@ -105,14 +107,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, item_id, creator_id, start_time, end_time, price, supply_price,
deposit, create_time
,
update_time, `state`, is_valid, is_deal
id, item_id, creator_id, start_time, end_time, price, supply_price,
target_num, limit_num
,
wx_qrcode, create_time,
update_time, `state`, is_valid, is_deal
</otherwise>
</choose>
from group_purchase_config
...
...
@@ -137,14 +139,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, item_id, creator_id, start_time, end_time, price, supply_price,
deposit, create_time
,
update_time, `state`, is_valid, is_deal
id, item_id, creator_id, start_time, end_time, price, supply_price,
target_num, limit_num
,
wx_qrcode, create_time,
update_time, `state`, is_valid, is_deal
</otherwise>
</choose>
from group_purchase_config
...
...
@@ -166,12 +168,14 @@
</selectKey>
insert into group_purchase_config (item_id, creator_id, start_time,
end_time, price, supply_price,
deposit, create_time, update_time,
`state`, is_valid, is_deal)
target_num, limit_num, wx_qrcode,
create_time, update_time, `state`,
is_valid, is_deal)
values (#{itemId,jdbcType=BIGINT}, #{creatorId,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP}, #{price,jdbcType=BIGINT}, #{supplyPrice,jdbcType=BIGINT},
#{deposit,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{state,jdbcType=INTEGER}, #{isValid,jdbcType=BIT}, #{isDeal,jdbcType=BIT})
#{targetNum,jdbcType=INTEGER}, #{limitNum,jdbcType=INTEGER}, #{wxQrcode,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{state,jdbcType=INTEGER},
#{isValid,jdbcType=BIT}, #{isDeal,jdbcType=BIT})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.distribution.GroupPurchaseConfig"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Integer"
>
...
...
@@ -197,8 +201,14 @@
<if
test=
"supplyPrice != null"
>
supply_price,
</if>
<if
test=
"deposit != null"
>
deposit,
<if
test=
"targetNum != null"
>
target_num,
</if>
<if
test=
"limitNum != null"
>
limit_num,
</if>
<if
test=
"wxQrcode != null"
>
wx_qrcode,
</if>
<if
test=
"createTime != null"
>
create_time,
...
...
@@ -235,8 +245,14 @@
<if
test=
"supplyPrice != null"
>
#{supplyPrice,jdbcType=BIGINT},
</if>
<if
test=
"deposit != null"
>
#{deposit,jdbcType=BIGINT},
<if
test=
"targetNum != null"
>
#{targetNum,jdbcType=INTEGER},
</if>
<if
test=
"limitNum != null"
>
#{limitNum,jdbcType=INTEGER},
</if>
<if
test=
"wxQrcode != null"
>
#{wxQrcode,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
...
...
@@ -285,8 +301,14 @@
<if
test=
"record.supplyPrice != null"
>
supply_price = #{record.supplyPrice,jdbcType=BIGINT},
</if>
<if
test=
"record.deposit != null"
>
deposit = #{record.deposit,jdbcType=BIGINT},
<if
test=
"record.targetNum != null"
>
target_num = #{record.targetNum,jdbcType=INTEGER},
</if>
<if
test=
"record.limitNum != null"
>
limit_num = #{record.limitNum,jdbcType=INTEGER},
</if>
<if
test=
"record.wxQrcode != null"
>
wx_qrcode = #{record.wxQrcode,jdbcType=VARCHAR},
</if>
<if
test=
"record.createTime != null"
>
create_time = #{record.createTime,jdbcType=TIMESTAMP},
...
...
@@ -317,7 +339,9 @@
end_time = #{record.endTime,jdbcType=TIMESTAMP},
price = #{record.price,jdbcType=BIGINT},
supply_price = #{record.supplyPrice,jdbcType=BIGINT},
deposit = #{record.deposit,jdbcType=BIGINT},
target_num = #{record.targetNum,jdbcType=INTEGER},
limit_num = #{record.limitNum,jdbcType=INTEGER},
wx_qrcode = #{record.wxQrcode,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
`state` = #{record.state,jdbcType=INTEGER},
...
...
@@ -348,8 +372,14 @@
<if
test=
"supplyPrice != null"
>
supply_price = #{supplyPrice,jdbcType=BIGINT},
</if>
<if
test=
"deposit != null"
>
deposit = #{deposit,jdbcType=BIGINT},
<if
test=
"targetNum != null"
>
target_num = #{targetNum,jdbcType=INTEGER},
</if>
<if
test=
"limitNum != null"
>
limit_num = #{limitNum,jdbcType=INTEGER},
</if>
<if
test=
"wxQrcode != null"
>
wx_qrcode = #{wxQrcode,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
...
...
@@ -377,7 +407,9 @@
end_time = #{endTime,jdbcType=TIMESTAMP},
price = #{price,jdbcType=BIGINT},
supply_price = #{supplyPrice,jdbcType=BIGINT},
deposit = #{deposit,jdbcType=BIGINT},
target_num = #{targetNum,jdbcType=INTEGER},
limit_num = #{limitNum,jdbcType=INTEGER},
wx_qrcode = #{wxQrcode,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
`state` = #{state,jdbcType=INTEGER},
...
...
@@ -412,14 +444,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, item_id, creator_id, start_time, end_time, price, supply_price,
deposit, create_time
,
update_time, `state`, is_valid, is_deal
id, item_id, creator_id, start_time, end_time, price, supply_price,
target_num, limit_num
,
wx_qrcode, create_time,
update_time, `state`, is_valid, is_deal
</otherwise>
</choose>
from group_purchase_config
...
...
ch-dao/src/main/resources/generatorConfig_new.xml
View file @
41a6eace
...
...
@@ -72,7 +72,7 @@
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"com.wwdz.ch.db.mapper.distribution"
targetProject=
"ch-dao/src/main/java"
/>
<table
tableName=
"group_purchase_
record
"
enableCountByExample=
"true"
enableUpdateByExample=
"true"
enableDeleteByExample=
"true"
enableSelectByExample=
"true"
selectByExampleQueryId=
"true"
>
<table
tableName=
"group_purchase_
config
"
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/impl/distribution/GroupPurchaseServiceImpl.java
View file @
41a6eace
...
...
@@ -91,6 +91,11 @@ public class GroupPurchaseServiceImpl implements GroupPurchaseService {
List
<
GroupPurchaseConfig
>
groupPurchaseConfigs
=
groupPurchaseConfigDao
.
findList
(
dto
);
List
<
GroupPurchaseItemVo
>
groupPurchaseItemVos
=
new
ArrayList
<>();
for
(
GroupPurchaseConfig
groupPurchaseConfig
:
groupPurchaseConfigs
)
{
//检测是否结束
if
(
groupPurchaseConfig
.
getEndTime
().
before
(
now
))
{
groupPurchaseConfigDao
.
updateState
(
groupPurchaseConfig
.
getItemId
(),
GroupPurchaseEnum
.
ItemStateEnum
.
END
.
getCode
());
continue
;
}
SupplierItem
supplierItem
=
supplierItemDao
.
findById
(
groupPurchaseConfig
.
getItemId
());
GroupPurchaseItemVo
groupPurchaseItemVo
=
new
GroupPurchaseItemVo
();
groupPurchaseItemVo
.
setItemId
(
supplierItem
.
getId
());
...
...
@@ -300,6 +305,15 @@ public class GroupPurchaseServiceImpl implements GroupPurchaseService {
}
@Override
public
Result
payBalance
(
GroupPurchaseRecordRequestDto
dto
)
{
try
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"支付尾款失败 error : {}"
,
e
);
}
return
Result
.
failed
(
"支付尾款失败"
);
}
@Override
@Transactional
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/IdentifyOrderServiceImpl.java
View file @
41a6eace
...
...
@@ -2,12 +2,18 @@ package com.wwdz.ch.wx.impl.distribution;
import
com.wwdz.ch.core.consts.CommConsts
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.entity.DeliveryNoticeMsg
;
import
com.wwdz.ch.core.service.SendMsgService
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.IdUtils
;
import
com.wwdz.ch.db.dao.CollectorWhiteListDao
;
import
com.wwdz.ch.db.dao.distribution.DistributionOrderDao
;
import
com.wwdz.ch.db.dao.distribution.IdentifyOrderDao
;
import
com.wwdz.ch.db.dao.distribution.SupplierItemDao
;
import
com.wwdz.ch.db.domain.CollectorWhiteList
;
import
com.wwdz.ch.db.domain.distribution.DistributionOrder
;
import
com.wwdz.ch.db.domain.distribution.IdentifyOrder
;
import
com.wwdz.ch.db.domain.distribution.SupplierItem
;
import
com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.IdentifyOrderRequestDto
;
import
com.wwdz.ch.wx.service.distribution.IdentifyOrderService
;
...
...
@@ -30,26 +36,76 @@ public class IdentifyOrderServiceImpl implements IdentifyOrderService {
@Autowired
DistributionOrderDao
distributionOrderDao
;
@Autowired
CollectorWhiteListDao
collectorWhiteListDao
;
@Autowired
SendMsgService
sendMsgService
;
@Autowired
SupplierItemDao
supplierItemDao
;
@Override
public
Result
createIdentifyOrder
(
DistributionOrderRequestDto
dto
)
{
try
{
Date
now
=
new
Date
();
String
distributionOrderId
=
dto
.
getDistributionOrderId
();
DistributionOrder
distributionOrder
=
distributionOrderDao
.
findById
(
distributionOrderId
);
long
sellerId
=
distributionOrder
.
getSellerId
();
CollectorWhiteList
collectorWhiteList
=
collectorWhiteListDao
.
findById
(
sellerId
);
String
identifyOrderId
=
IdUtils
.
getOrderNumber
(
CommConsts
.
IDENTIFY_ORDER_PREFIX
);
IdentifyOrder
identifyOrder
=
new
IdentifyOrder
();
if
(
collectorWhiteList
.
getDeliveryAuth
()
==
1
)
{
//藏家可以自行发货
DistributionOrder
orderUpdateDto
=
new
DistributionOrder
();
orderUpdateDto
.
setDistributionOrderId
(
distributionOrderId
);
orderUpdateDto
.
setLogisticsCode
(
dto
.
getLogisticsCode
());
orderUpdateDto
.
setWaybill
(
dto
.
getWaybill
());
orderUpdateDto
.
setDeliveryTime
(
now
);
orderUpdateDto
.
setState
(
DistributionEnum
.
DistributionOrderStateEnum
.
PRE_SIGNED
.
getCode
());
distributionOrderDao
.
update
(
orderUpdateDto
);
//发货成功,发送模板信息通知买家
try
{
DeliveryNoticeMsg
deliveryNoticeMsg
=
new
DeliveryNoticeMsg
();
deliveryNoticeMsg
.
setDistributionOrderId
(
distributionOrderId
);
deliveryNoticeMsg
.
setWaybill
(
dto
.
getWaybill
());
deliveryNoticeMsg
.
setAddress
(
distributionOrder
.
getReceiverName
()
+
" "
+
distributionOrder
.
getReceiverPhone
()
+
" "
+
distributionOrder
.
getReceiverAddress
());
SupplierItem
supplierItem
=
supplierItemDao
.
findById
(
distributionOrder
.
getItemId
());
deliveryNoticeMsg
.
setItemName
(
supplierItem
.
getName
());
deliveryNoticeMsg
.
setDeliveryTime
(
now
);
//发送给买家
String
buyerOpenId
=
sendMsgService
.
getOpenIdByUserId
(
distributionOrder
.
getBuyerId
());
if
(
com
.
xxdxxs
.
utils
.
StringUtils
.
hasLength
(
buyerOpenId
))
{
deliveryNoticeMsg
.
setShopState
(
0
);
sendMsgService
.
sendDeliveryTempletMsg
(
buyerOpenId
,
deliveryNoticeMsg
);
}
else
{
logger
.
info
(
">>>>> 买家openid为空, 发送消息失败 <<<<<"
);
}
}
catch
(
Exception
e
)
{
logger
.
info
(
"鉴定通过发货通知发送失败:{}"
,
e
);
}
//设置鉴定单状态
identifyOrder
.
setState
(
DistributionEnum
.
IdentifyOrderStateEnum
.
CHANNEL_SENDED
.
getCode
());
identifyOrder
.
setOutLogisticsCode
(
dto
.
getLogisticsCode
());
identifyOrder
.
setOutWaybill
(
dto
.
getWaybill
());
identifyOrder
.
setApproved
(
1
);
}
else
{
identifyOrder
.
setState
(
DistributionEnum
.
IdentifyOrderStateEnum
.
CHANNEL_WAIT_RECEIVE
.
getCode
());
}
identifyOrder
.
setDistributionOrderId
(
distributionOrderId
);
identifyOrder
.
setItemId
(
distributionOrder
.
getItemId
());
identifyOrder
.
setItemNum
(
distributionOrder
.
getItemNum
());
identifyOrder
.
setSellerId
(
distributionOrder
.
getSellerId
());
identifyOrder
.
setIdentifyOrderId
(
identifyOrderId
);
identifyOrder
.
setState
(
DistributionEnum
.
IdentifyOrderStateEnum
.
CHANNEL_WAIT_RECEIVE
.
getCode
());
identifyOrder
.
setFromLogisticsCode
(
dto
.
getLogisticsCode
());
identifyOrder
.
setFromWaybill
(
dto
.
getWaybill
());
identifyOrder
.
setReturnName
(
dto
.
getReturnName
());
identifyOrder
.
setReturnAddress
(
dto
.
getReturnAddress
());
identifyOrder
.
setReturnPhone
(
dto
.
getReturnPhone
());
identifyOrder
.
setCreateTime
(
n
ew
Date
()
);
identifyOrder
.
setUpdateTime
(
n
ew
Date
()
);
identifyOrder
.
setCreateTime
(
n
ow
);
identifyOrder
.
setUpdateTime
(
n
ow
);
identifyOrderDao
.
insert
(
identifyOrder
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/job/GroupPurchaseJob.java
0 → 100644
View file @
41a6eace
package
com.wwdz.ch.wx.job
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.consts.GroupPurchaseEnum
;
import
com.wwdz.ch.db.dao.distribution.DistributionOrderDao
;
import
com.wwdz.ch.db.dao.distribution.DistributorProfitDao
;
import
com.wwdz.ch.db.dao.distribution.GroupPurchaseConfigDao
;
import
com.wwdz.ch.db.dao.distribution.GroupPurchaseRecordDao
;
import
com.wwdz.ch.db.domain.distribution.GroupPurchaseConfig
;
import
com.wwdz.ch.db.domain.distribution.GroupPurchaseRecord
;
import
com.wwdz.ch.db.dto.request.distribution.GroupPurchaseConfigRequestDto
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
java.util.Date
;
import
java.util.List
;
@Component
public
class
GroupPurchaseJob
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
GroupPurchaseJob
.
class
);
private
final
static
String
GROUPPURCHASE_KEY
=
"GROUPPURCHASE_KEY"
;
@Autowired
RedissonClient
redissonClient
;
@Autowired
GroupPurchaseConfigDao
groupPurchaseConfigDao
;
@Autowired
GroupPurchaseRecordDao
groupPurchaseRecordDao
;
@Autowired
DistributionOrderDao
distributionOrderDao
;
@Autowired
DistributorProfitDao
distributorProfitDao
;
/**
* 隔2分钟运行一次
*/
@Scheduled
(
fixedDelay
=
1000
*
60
*
2
)
public
void
execute
()
{
RLock
lock
=
redissonClient
.
getLock
(
GROUPPURCHASE_KEY
);
if
(!
lock
.
tryLock
())
{
logger
.
warn
(
"检测团购进度任务,当前服务实例获取锁成功: {} 获取锁失败,锁被占用不执行"
,
Thread
.
currentThread
().
getId
());
return
;
}
logger
.
info
(
">>>>>>>>>>>>>>>>>>>>>>> 检测团购进度任务, 开始执行 <<<<<<<<<<<<<<<<<<<<<"
);
try
{
//查询状态进行中,但实际已经结束的团购商品
checkProcessGroupPurchase
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"检测团购进度任务 error:{}"
,
e
);
}
finally
{
if
(
lock
!=
null
&&
lock
.
isHeldByCurrentThread
())
{
lock
.
unlock
();
logger
.
info
(
"======================== 线程id: {} , 检测团购进度任务结束, 释放锁成功 ========================"
,
Thread
.
currentThread
().
getId
());
}
}
}
public
void
checkProcessGroupPurchase
()
{
Date
now
=
new
Date
();
GroupPurchaseConfigRequestDto
groupPurchaseConfigRequestDto
=
new
GroupPurchaseConfigRequestDto
();
groupPurchaseConfigRequestDto
.
setState
(
GroupPurchaseEnum
.
ItemStateEnum
.
PROCESSING
.
getCode
());
groupPurchaseConfigRequestDto
.
setQueryEndTime
(
now
);
groupPurchaseConfigRequestDto
.
setLimit
(
100
);
List
<
GroupPurchaseConfig
>
purchaseConfigList
=
groupPurchaseConfigDao
.
findList
(
groupPurchaseConfigRequestDto
);
for
(
GroupPurchaseConfig
groupPurchaseConfig
:
purchaseConfigList
)
{
groupPurchaseConfigDao
.
updateState
(
groupPurchaseConfig
.
getItemId
(),
GroupPurchaseEnum
.
ItemStateEnum
.
END
.
getCode
());
}
}
//查询已经结束,还未处理订单的团购商品
public
void
checkEndGroupPurchase
()
{
GroupPurchaseConfigRequestDto
groupPurchaseConfigRequestDto
=
new
GroupPurchaseConfigRequestDto
();
groupPurchaseConfigRequestDto
.
setState
(
GroupPurchaseEnum
.
ItemStateEnum
.
END
.
getCode
());
groupPurchaseConfigRequestDto
.
setIsDeal
(
false
);
List
<
GroupPurchaseConfig
>
purchaseConfigList
=
groupPurchaseConfigDao
.
findList
(
groupPurchaseConfigRequestDto
);
for
(
GroupPurchaseConfig
groupPurchaseConfig
:
purchaseConfigList
)
{
//判断是否成功成团,暂时默认true
boolean
flag
=
true
;
long
itemId
=
groupPurchaseConfig
.
getItemId
();
List
<
GroupPurchaseRecord
>
groupPurchaseRecordList
=
groupPurchaseRecordDao
.
findByItemId
(
itemId
);
for
(
GroupPurchaseRecord
groupPurchaseRecord
:
groupPurchaseRecordList
)
{
String
distributionOrderId
=
groupPurchaseRecord
.
getDistributionOrderId
();
if
(
flag
)
{
//更改订单的状态为待发货
distributionOrderDao
.
updateState
(
distributionOrderId
,
DistributionEnum
.
DistributionOrderStateEnum
.
PRE_SEND
.
getCode
());
}
else
{
distributionOrderDao
.
updateState
(
distributionOrderId
,
DistributionEnum
.
DistributionOrderStateEnum
.
CANCEL
.
getCode
());
}
}
groupPurchaseConfigDao
.
updateDealByPrimaryKey
(
groupPurchaseConfig
.
getId
(),
true
);
logger
.
info
(
">>>>>>>> 商品id:{}, 团购结果:{}, 已处理完团购结束流程 <<<<<<<<<"
,
itemId
,
flag
);
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/job/NewItemNoticeJob.java
View file @
41a6eace
...
...
@@ -29,7 +29,7 @@ import java.util.stream.Collectors;
/**
*
拍卖结束自动创建订单
*
藏品上新通知
*/
@Component
public
class
NewItemNoticeJob
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/distribution/GroupPurchaseService.java
View file @
41a6eace
...
...
@@ -5,7 +5,6 @@ import com.wwdz.ch.db.dto.request.distribution.GroupPurchaseConfigRequestDto;
import
com.wwdz.ch.db.dto.request.distribution.GroupPurchaseRecordRequestDto
;
import
com.wwdz.ch.wx.entity.GroupPurchaseInfo
;
import
java.util.Map
;
public
interface
GroupPurchaseService
{
...
...
@@ -32,10 +31,8 @@ public interface GroupPurchaseService {
*/
Result
payDeposit
(
GroupPurchaseRecordRequestDto
dto
);
/**
* 取消订单
,
退定金
* 取消订单退定金
* @param dto
* @return
*/
...
...
@@ -48,6 +45,13 @@ public interface GroupPurchaseService {
*/
Result
<
GroupPurchaseInfo
>
checkGroupPurchase
(
GroupPurchaseRecordRequestDto
dto
);
/**
* 支付团购订单尾款
* @param dto
* @return
*/
Result
payBalance
(
GroupPurchaseRecordRequestDto
dto
);
Result
calculateProfit
(
GroupPurchaseRecordRequestDto
dto
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/distribution/GroupPurchaseController.java
0 → 100644
View file @
41a6eace
package
com.wwdz.ch.wx.web.distribution
;
import
com.alibaba.fastjson.JSON
;
import
com.wwdz.ch.core.consts.ResultCode
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dto.request.distribution.GroupPurchaseConfigRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.GroupPurchaseRecordRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceRequestDto
;
import
com.wwdz.ch.wx.service.distribution.GroupPurchaseService
;
import
com.xxdxxs.utils.StringUtils
;
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/groupPurchase"
)
public
class
GroupPurchaseController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
GroupPurchaseController
.
class
);
@Autowired
GroupPurchaseService
groupPurchaseService
;
@ApiOperation
(
value
=
"查询团购信息"
)
@PostMapping
(
"/findList"
)
public
Result
findList
(
@RequestBody
GroupPurchaseConfigRequestDto
dto
)
{
logger
.
info
(
"查询团购信息,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
return
groupPurchaseService
.
findList
(
dto
);
}
@ApiOperation
(
value
=
"查询团购商品详情"
)
@PostMapping
(
"/findItemDetail"
)
public
Result
findItemDetail
(
@RequestBody
GroupPurchaseConfigRequestDto
dto
)
{
logger
.
info
(
"查询团购商品详情,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
dto
.
getItemId
()
==
null
)
{
return
Result
.
failed
(
ResultCode
.
PARAM_ERROR
);
}
return
groupPurchaseService
.
findItemDetail
(
dto
);
}
@ApiOperation
(
value
=
"支付团购定金"
)
@PostMapping
(
"/payDeposit"
)
public
Result
payDeposit
(
@RequestBody
GroupPurchaseRecordRequestDto
dto
)
{
logger
.
info
(
"支付团购定金,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(!
StringUtils
.
isAllNotEmpty
(
dto
.
getItemId
(),
dto
.
getUserId
(),
dto
.
getAmount
()))
{
return
Result
.
failed
(
ResultCode
.
PARAM_ERROR
);
}
return
groupPurchaseService
.
payDeposit
(
dto
);
}
@ApiOperation
(
value
=
"取消订单退定金"
)
@PostMapping
(
"/cancelDeposit"
)
public
Result
cancelDeposit
(
@RequestBody
GroupPurchaseRecordRequestDto
dto
)
{
logger
.
info
(
"取消订单退定金,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(!
StringUtils
.
isAllNotEmpty
(
dto
.
getDistributionOrderId
()))
{
return
Result
.
failed
(
ResultCode
.
PARAM_ERROR
);
}
return
groupPurchaseService
.
cancelDeposit
(
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