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
d4427ecd
Commit
d4427ecd
authored
Jun 20, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增拍品的拍卖状态
parent
4b74e4a5
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
633 additions
and
55 deletions
+633
-55
ch-admin-api/src/main/java/com/wwdz/ch/admin/controller/SysSpecialPerformanceController.java
.../ch/admin/controller/SysSpecialPerformanceController.java
+11
-0
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/SysSpecialPerformanceServiceImpl.java
.../wwdz/ch/admin/impl/SysSpecialPerformanceServiceImpl.java
+23
-4
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/SysSupplierItemServiceImpl.java
...va/com/wwdz/ch/admin/impl/SysSupplierItemServiceImpl.java
+5
-4
ch-admin-api/src/main/java/com/wwdz/ch/admin/service/SysSpecialPerformanceService.java
...m/wwdz/ch/admin/service/SysSpecialPerformanceService.java
+7
-0
ch-core/src/main/java/com/wwdz/ch/core/consts/AuctionEnum.java
...re/src/main/java/com/wwdz/ch/core/consts/AuctionEnum.java
+44
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/AuctionConfigDao.java
...ava/com/wwdz/ch/db/dao/distribution/AuctionConfigDao.java
+10
-1
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/SpecialPerformanceConfigDao.java
...z/ch/db/dao/distribution/SpecialPerformanceConfigDao.java
+2
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/SpecialPerformanceDao.java
...om/wwdz/ch/db/dao/distribution/SpecialPerformanceDao.java
+2
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/AuctionConfig.java
...ava/com/wwdz/ch/db/domain/distribution/AuctionConfig.java
+21
-3
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/AuctionConfigExample.java
.../wwdz/ch/db/domain/distribution/AuctionConfigExample.java
+264
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/AuctionConfigRequestDto.java
.../db/dto/request/distribution/AuctionConfigRequestDto.java
+15
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/AuctionConfigDaoImpl.java
...om/wwdz/ch/db/impl/distribution/AuctionConfigDaoImpl.java
+13
-1
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/SpecialPerformanceConfigDaoImpl.java
...db/impl/distribution/SpecialPerformanceConfigDaoImpl.java
+11
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/SpecialPerformanceDaoImpl.java
...dz/ch/db/impl/distribution/SpecialPerformanceDaoImpl.java
+9
-0
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/AuctionConfigMapper.xml
...om/wwdz/ch/db/mapper/distribution/AuctionConfigMapper.xml
+48
-19
ch-dao/src/main/resources/generatorConfig_new.xml
ch-dao/src/main/resources/generatorConfig_new.xml
+4
-4
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/WxPayCallbackController.java
...main/java/com/wwdz/ch/wx/api/WxPayCallbackController.java
+6
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DistributionOrderServiceImpl.java
...ch/wx/impl/distribution/DistributionOrderServiceImpl.java
+2
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SpecialPerformanceServiceImpl.java
...h/wx/impl/distribution/SpecialPerformanceServiceImpl.java
+5
-5
ch-wx-api/src/main/java/com/wwdz/ch/wx/job/AutoCreateAuctionOrderJob.java
...in/java/com/wwdz/ch/wx/job/AutoCreateAuctionOrderJob.java
+4
-3
ch-wx-api/src/main/java/com/wwdz/ch/wx/job/AutoSendMsgJob.java
...-api/src/main/java/com/wwdz/ch/wx/job/AutoSendMsgJob.java
+37
-8
ch-wx-api/src/main/java/com/wwdz/ch/wx/job/SpecialPerformanceNoticeJob.java
.../java/com/wwdz/ch/wx/job/SpecialPerformanceNoticeJob.java
+90
-1
No files found.
ch-admin-api/src/main/java/com/wwdz/ch/admin/controller/SysSpecialPerformanceController.java
View file @
d4427ecd
...
...
@@ -97,6 +97,17 @@ public class SysSpecialPerformanceController {
}
@ApiOperation
(
value
=
"重新上架"
)
@PostMapping
(
"/reSale"
)
public
Result
reSale
(
@RequestBody
SpecialPerformanceConfigRequestDto
dto
)
{
logger
.
info
(
"重新上架,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
dto
.
getItemId
()
==
null
)
{
return
Result
.
failed
(
ResultCode
.
PARAM_ERROR
);
}
return
sysSpecialPerformanceService
.
reSale
(
dto
);
}
@ApiOperation
(
value
=
"修改拍卖专场"
)
@PostMapping
(
"/update"
)
public
Result
update
(
@RequestBody
SpecialPerformanceRequestDto
dto
)
{
...
...
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/SysSpecialPerformanceServiceImpl.java
View file @
d4427ecd
...
...
@@ -2,10 +2,7 @@ package com.wwdz.ch.admin.impl;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.admin.service.SysSpecialPerformanceService
;
import
com.wwdz.ch.core.consts.CommConsts
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.consts.SpecialPerformanceEnum
;
import
com.wwdz.ch.core.consts.SupplierItemEnum
;
import
com.wwdz.ch.core.consts.*
;
import
com.wwdz.ch.core.entity.SpecialPerformanceVo
;
import
com.wwdz.ch.core.entity.SupplierItemVo
;
import
com.wwdz.ch.core.type.PageSearchResult
;
...
...
@@ -202,6 +199,10 @@ public class SysSpecialPerformanceServiceImpl implements SysSpecialPerformanceSe
try
{
List
<
String
>
itemIds
=
Arrays
.
asList
(
dto
.
getItemIds
().
split
(
","
));
for
(
String
itemId
:
itemIds
)
{
boolean
flag
=
specialPerformanceConfigDao
.
isExisted
(
dto
.
getSpecialPerformanceId
(),
Long
.
valueOf
(
itemId
));
if
(
flag
)
{
continue
;
}
SpecialPerformanceConfig
specialPerformanceConfig
=
new
SpecialPerformanceConfig
();
specialPerformanceConfig
.
setItemId
(
Long
.
valueOf
(
itemId
));
specialPerformanceConfig
.
setSpecialPerformanceId
(
dto
.
getSpecialPerformanceId
());
...
...
@@ -217,4 +218,22 @@ public class SysSpecialPerformanceServiceImpl implements SysSpecialPerformanceSe
}
return
Result
.
failed
();
}
@Override
public
Result
reSale
(
SpecialPerformanceConfigRequestDto
dto
)
{
try
{
//拍卖配置重新生效
auctionConfigDao
.
updateState
(
dto
.
getItemId
(),
AuctionEnum
.
StateEnum
.
WAIT_ON_SALE
.
getCode
());
//商品表中,商品重新上架
SupplierItem
supplierItem
=
new
SupplierItem
();
supplierItem
.
setId
(
dto
.
getItemId
());
supplierItem
.
setIsOnSale
(
true
);
supplierItemDao
.
update
(
supplierItem
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"重新上架商品 error:{}"
,
e
);
}
return
Result
.
failed
();
}
}
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/SysSupplierItemServiceImpl.java
View file @
d4427ecd
...
...
@@ -3,10 +3,7 @@ package com.wwdz.ch.admin.impl;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.admin.service.SysSupplierItemService
;
import
com.wwdz.ch.core.api.WxAppletApi
;
import
com.wwdz.ch.core.consts.CommConsts
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.consts.MediaTypeEnum
;
import
com.wwdz.ch.core.consts.SupplierItemEnum
;
import
com.wwdz.ch.core.consts.*
;
import
com.wwdz.ch.core.entity.SupplierItemVo
;
import
com.wwdz.ch.core.notify.AliSmsSender
;
import
com.wwdz.ch.core.storage.QiniuStorage
;
...
...
@@ -128,6 +125,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
if
(
dto
.
getType
()
==
DistributionEnum
.
DistributionTypeEnum
.
AUCTION
.
getCode
())
{
AuctionConfig
auctionConfig
=
new
AuctionConfig
();
auctionConfig
.
setItemId
(
itemId
);
auctionConfig
.
setCreatorId
(
CommConsts
.
SYSTEM_ACCOUNT
);
auctionConfig
.
setIsValid
(
true
);
auctionConfig
.
setIsDeal
(
false
);
auctionConfig
.
setStartTime
(
DateUtils
.
parseString
(
dto
.
getAuctionStartTime
()));
...
...
@@ -137,6 +135,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
auctionConfig
.
setAddExtent
(
PriceUtil
.
convertPriceFromStr
(
dto
.
getAddExtent
()));
auctionConfig
.
setCreateTime
(
now
);
auctionConfig
.
setUpdateTime
(
now
);
auctionConfig
.
setState
(
AuctionEnum
.
StateEnum
.
WAIT_ON_SALE
.
getCode
());
auctionConfigDao
.
insert
(
auctionConfig
);
}
return
Result
.
success
();
...
...
@@ -428,7 +427,9 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
long
newItemId
=
supplierItemDao
.
insert
(
supplierItem
);
//新增默认拍卖配置
AuctionConfig
auctionConfig
=
new
AuctionConfig
();
auctionConfig
.
setState
(
AuctionEnum
.
StateEnum
.
WAIT_ON_SALE
.
getCode
());
auctionConfig
.
setItemId
(
newItemId
);
auctionConfig
.
setCreatorId
(
oldItem
.
getCreatorId
());
auctionConfig
.
setIsValid
(
false
);
auctionConfig
.
setIsDeal
(
false
);
auctionConfig
.
setStartTime
(
StringUtils
.
isEmpty
(
dto
.
getAuctionStartTime
())
?
new
Date
():
DateUtils
.
parseString
(
dto
.
getAuctionStartTime
()));
...
...
ch-admin-api/src/main/java/com/wwdz/ch/admin/service/SysSpecialPerformanceService.java
View file @
d4427ecd
...
...
@@ -64,4 +64,11 @@ public interface SysSpecialPerformanceService {
*/
Result
addItem
(
SpecialPerformanceConfigRequestDto
dto
);
/**
* 重新上架
* @param dto
* @return
*/
Result
reSale
(
SpecialPerformanceConfigRequestDto
dto
);
}
ch-core/src/main/java/com/wwdz/ch/core/consts/AuctionEnum.java
0 → 100644
View file @
d4427ecd
package
com.wwdz.ch.core.consts
;
public
class
AuctionEnum
{
/**
* 售后单状态
*/
public
enum
StateEnum
{
WAIT_ON_SALE
(
1
,
"待上架"
),
PREVIEW
(
10
,
"预展中"
),
AUCTIONING
(
20
,
"竞拍中"
),
GET_NOT_PAY
(
30
,
"中拍未付款"
),
GET_NOT_PAY_TO_PASS
(
40
,
"中拍未付款流拍"
),
NO_OFFER_TO_PASS
(
50
,
"无出价流拍"
),
DEALED
(
100
,
"成交"
),
;
private
int
code
;
private
String
des
;
StateEnum
(
int
code
,
String
des
)
{
this
.
code
=
code
;
this
.
des
=
des
;
}
public
static
String
getNameByCode
(
int
code
)
{
for
(
AuctionEnum
.
StateEnum
stateEnum
:
AuctionEnum
.
StateEnum
.
values
())
{
if
(
code
==
stateEnum
.
getCode
())
{
return
stateEnum
.
getDes
();
}
}
return
null
;
}
public
int
getCode
()
{
return
code
;
}
public
String
getDes
()
{
return
des
;
}
}
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/AuctionConfigDao.java
View file @
d4427ecd
...
...
@@ -24,6 +24,14 @@ public interface AuctionConfigDao {
*/
int
update
(
AuctionConfig
auctionConfig
);
/**
* 更新状态
* @param itemId
* @param state
* @return
*/
int
updateState
(
long
itemId
,
int
state
);
/**
* 根据商品id查询拍卖设置
* @param itemId
...
...
@@ -89,7 +97,8 @@ public interface AuctionConfigDao {
/**
* 拍卖配置更新为已处理
* @param itemId
* @param state
* @return
*/
int
setDeal
(
long
itemId
);
int
setDeal
(
long
itemId
,
int
state
);
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/SpecialPerformanceConfigDao.java
View file @
d4427ecd
...
...
@@ -23,4 +23,6 @@ public interface SpecialPerformanceConfigDao {
boolean
delete
(
int
specialPerformanceId
,
long
itemId
);
boolean
isExisted
(
int
specialPerformanceId
,
long
itemId
);
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/SpecialPerformanceDao.java
View file @
d4427ecd
...
...
@@ -15,6 +15,8 @@ public interface SpecialPerformanceDao {
boolean
update
(
SpecialPerformance
specialPerformance
);
boolean
updateState
(
int
id
,
int
state
);
int
insert
(
SpecialPerformance
specialPerformance
);
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/AuctionConfig.java
View file @
d4427ecd
...
...
@@ -10,7 +10,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2024/0
3/07
* @date 2024/0
6/20
*/
@Data
public
class
AuctionConfig
implements
Entity
{
...
...
@@ -21,6 +21,11 @@ public class AuctionConfig implements Entity {
*/
private
Long
itemId
;
/**
* 商品所属人id
*/
private
Long
creatorId
;
/**
* 竞拍开始时间
*/
...
...
@@ -66,6 +71,11 @@ public class AuctionConfig implements Entity {
*/
private
Boolean
isDeal
;
/**
* 状态
*/
private
Integer
state
;
private
static
final
long
serialVersionUID
=
1L
;
@Override
...
...
@@ -76,6 +86,7 @@ public class AuctionConfig implements Entity {
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", itemId="
).
append
(
itemId
);
sb
.
append
(
", creatorId="
).
append
(
creatorId
);
sb
.
append
(
", startTime="
).
append
(
startTime
);
sb
.
append
(
", endTime="
).
append
(
endTime
);
sb
.
append
(
", startPrice="
).
append
(
startPrice
);
...
...
@@ -85,6 +96,7 @@ public class AuctionConfig implements Entity {
sb
.
append
(
", updateTime="
).
append
(
updateTime
);
sb
.
append
(
", isValid="
).
append
(
isValid
);
sb
.
append
(
", isDeal="
).
append
(
isDeal
);
sb
.
append
(
", state="
).
append
(
state
);
sb
.
append
(
", serialVersionUID="
).
append
(
serialVersionUID
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
...
...
@@ -104,6 +116,7 @@ public class AuctionConfig implements Entity {
AuctionConfig
other
=
(
AuctionConfig
)
that
;
return
(
this
.
getId
()
==
null
?
other
.
getId
()
==
null
:
this
.
getId
().
equals
(
other
.
getId
()))
&&
(
this
.
getItemId
()
==
null
?
other
.
getItemId
()
==
null
:
this
.
getItemId
().
equals
(
other
.
getItemId
()))
&&
(
this
.
getCreatorId
()
==
null
?
other
.
getCreatorId
()
==
null
:
this
.
getCreatorId
().
equals
(
other
.
getCreatorId
()))
&&
(
this
.
getStartTime
()
==
null
?
other
.
getStartTime
()
==
null
:
this
.
getStartTime
().
equals
(
other
.
getStartTime
()))
&&
(
this
.
getEndTime
()
==
null
?
other
.
getEndTime
()
==
null
:
this
.
getEndTime
().
equals
(
other
.
getEndTime
()))
&&
(
this
.
getStartPrice
()
==
null
?
other
.
getStartPrice
()
==
null
:
this
.
getStartPrice
().
equals
(
other
.
getStartPrice
()))
...
...
@@ -112,7 +125,8 @@ public class AuctionConfig implements Entity {
&&
(
this
.
getCreateTime
()
==
null
?
other
.
getCreateTime
()
==
null
:
this
.
getCreateTime
().
equals
(
other
.
getCreateTime
()))
&&
(
this
.
getUpdateTime
()
==
null
?
other
.
getUpdateTime
()
==
null
:
this
.
getUpdateTime
().
equals
(
other
.
getUpdateTime
()))
&&
(
this
.
getIsValid
()
==
null
?
other
.
getIsValid
()
==
null
:
this
.
getIsValid
().
equals
(
other
.
getIsValid
()))
&&
(
this
.
getIsDeal
()
==
null
?
other
.
getIsDeal
()
==
null
:
this
.
getIsDeal
().
equals
(
other
.
getIsDeal
()));
&&
(
this
.
getIsDeal
()
==
null
?
other
.
getIsDeal
()
==
null
:
this
.
getIsDeal
().
equals
(
other
.
getIsDeal
()))
&&
(
this
.
getState
()
==
null
?
other
.
getState
()
==
null
:
this
.
getState
().
equals
(
other
.
getState
()));
}
@Override
...
...
@@ -121,6 +135,7 @@ public class AuctionConfig implements Entity {
int
result
=
1
;
result
=
prime
*
result
+
((
getId
()
==
null
)
?
0
:
getId
().
hashCode
());
result
=
prime
*
result
+
((
getItemId
()
==
null
)
?
0
:
getItemId
().
hashCode
());
result
=
prime
*
result
+
((
getCreatorId
()
==
null
)
?
0
:
getCreatorId
().
hashCode
());
result
=
prime
*
result
+
((
getStartTime
()
==
null
)
?
0
:
getStartTime
().
hashCode
());
result
=
prime
*
result
+
((
getEndTime
()
==
null
)
?
0
:
getEndTime
().
hashCode
());
result
=
prime
*
result
+
((
getStartPrice
()
==
null
)
?
0
:
getStartPrice
().
hashCode
());
...
...
@@ -130,6 +145,7 @@ public class AuctionConfig implements Entity {
result
=
prime
*
result
+
((
getUpdateTime
()
==
null
)
?
0
:
getUpdateTime
().
hashCode
());
result
=
prime
*
result
+
((
getIsValid
()
==
null
)
?
0
:
getIsValid
().
hashCode
());
result
=
prime
*
result
+
((
getIsDeal
()
==
null
)
?
0
:
getIsDeal
().
hashCode
());
result
=
prime
*
result
+
((
getState
()
==
null
)
?
0
:
getState
().
hashCode
());
return
result
;
}
...
...
@@ -143,6 +159,7 @@ public class AuctionConfig implements Entity {
public
enum
Column
{
id
(
"id"
,
"id"
,
"INTEGER"
,
false
),
itemId
(
"item_id"
,
"itemId"
,
"BIGINT"
,
false
),
creatorId
(
"creator_id"
,
"creatorId"
,
"BIGINT"
,
false
),
startTime
(
"start_time"
,
"startTime"
,
"TIMESTAMP"
,
false
),
endTime
(
"end_time"
,
"endTime"
,
"TIMESTAMP"
,
false
),
startPrice
(
"start_price"
,
"startPrice"
,
"BIGINT"
,
false
),
...
...
@@ -151,7 +168,8 @@ public class AuctionConfig implements Entity {
createTime
(
"create_time"
,
"createTime"
,
"TIMESTAMP"
,
false
),
updateTime
(
"update_time"
,
"updateTime"
,
"TIMESTAMP"
,
false
),
isValid
(
"is_valid"
,
"isValid"
,
"BIT"
,
false
),
isDeal
(
"is_deal"
,
"isDeal"
,
"BIT"
,
false
);
isDeal
(
"is_deal"
,
"isDeal"
,
"BIT"
,
false
),
state
(
"state"
,
"state"
,
"INTEGER"
,
true
);
/**
* This field was generated by MyBatis Generator.
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/AuctionConfigExample.java
View file @
d4427ecd
This diff is collapsed.
Click to expand it.
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/AuctionConfigRequestDto.java
View file @
d4427ecd
...
...
@@ -16,6 +16,11 @@ public class AuctionConfigRequestDto extends BaseRequestDto implements Entity {
*/
private
Long
itemId
;
/**
* 商品所属人id
*/
private
Long
creatorId
;
/**
* 竞拍开始时间
*/
...
...
@@ -56,5 +61,15 @@ public class AuctionConfigRequestDto extends BaseRequestDto implements Entity {
*/
private
Boolean
isValid
;
/**
* 是否成交
*/
private
Boolean
isDeal
;
/**
* 状态
*/
private
Integer
state
;
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/AuctionConfigDaoImpl.java
View file @
d4427ecd
...
...
@@ -36,6 +36,17 @@ public class AuctionConfigDaoImpl implements AuctionConfigDao {
return
auctionConfigMapper
.
updateByPrimaryKeySelective
(
auctionConfig
);
}
@Override
public
int
updateState
(
long
itemId
,
int
state
)
{
AuctionConfigExample
example
=
new
AuctionConfigExample
();
AuctionConfigExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andItemIdEqualTo
(
itemId
);
AuctionConfig
auctionConfig
=
new
AuctionConfig
();
auctionConfig
.
setUpdateTime
(
new
Date
());
auctionConfig
.
setState
(
state
);
return
auctionConfigMapper
.
updateByExampleSelective
(
auctionConfig
,
example
);
}
@Override
public
AuctionConfig
findByItemId
(
long
itemId
)
{
AuctionConfigExample
example
=
new
AuctionConfigExample
();
...
...
@@ -125,13 +136,14 @@ public class AuctionConfigDaoImpl implements AuctionConfigDao {
}
@Override
public
int
setDeal
(
long
itemId
)
{
public
int
setDeal
(
long
itemId
,
int
state
)
{
AuctionConfigExample
example
=
new
AuctionConfigExample
();
AuctionConfigExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andItemIdEqualTo
(
itemId
);
AuctionConfig
auctionConfig
=
new
AuctionConfig
();
auctionConfig
.
setUpdateTime
(
new
Date
());
auctionConfig
.
setIsDeal
(
true
);
auctionConfig
.
setState
(
state
);
return
auctionConfigMapper
.
updateByExampleSelective
(
auctionConfig
,
example
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/SpecialPerformanceConfigDaoImpl.java
View file @
d4427ecd
...
...
@@ -52,6 +52,7 @@ public class SpecialPerformanceConfigDaoImpl implements SpecialPerformanceConfig
SpecialPerformanceConfigExample
example
=
new
SpecialPerformanceConfigExample
();
SpecialPerformanceConfigExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andSpecialPerformanceIdEqualTo
(
specialPerformanceConfig
.
getSpecialPerformanceId
());
JdbcHelper
.
ifPresent
(
specialPerformanceConfig
.
getItemId
(),
criteria:
:
andItemIdEqualTo
);
return
specialPerformanceConfigMapper
.
updateByExampleSelective
(
specialPerformanceConfig
,
example
)
>
0
;
}
...
...
@@ -99,4 +100,14 @@ public class SpecialPerformanceConfigDaoImpl implements SpecialPerformanceConfig
specialPerformanceConfig
.
setState
(
0
);
return
specialPerformanceConfigMapper
.
updateByExampleSelective
(
specialPerformanceConfig
,
example
)
>
0
;
}
@Override
public
boolean
isExisted
(
int
specialPerformanceId
,
long
itemId
)
{
SpecialPerformanceConfigExample
example
=
new
SpecialPerformanceConfigExample
();
SpecialPerformanceConfigExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andSpecialPerformanceIdEqualTo
(
specialPerformanceId
);
criteria
.
andItemIdEqualTo
(
itemId
);
criteria
.
andStateEqualTo
(
1
);
return
specialPerformanceConfigMapper
.
countByExample
(
example
)
>
0
;
}
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/SpecialPerformanceDaoImpl.java
View file @
d4427ecd
...
...
@@ -59,6 +59,15 @@ public class SpecialPerformanceDaoImpl implements SpecialPerformanceDao {
}
@Override
public
boolean
updateState
(
int
id
,
int
state
)
{
SpecialPerformance
specialPerformance
=
new
SpecialPerformance
();
specialPerformance
.
setUpdateTime
(
new
Date
());
specialPerformance
.
setId
(
id
);
specialPerformance
.
setState
(
state
);
return
specialPerformanceMapper
.
updateByPrimaryKeySelective
(
specialPerformance
)
>
0
;
}
@Override
public
int
insert
(
SpecialPerformance
specialPerformance
)
{
specialPerformance
.
setCreateTime
(
new
Date
());
...
...
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/AuctionConfigMapper.xml
View file @
d4427ecd
...
...
@@ -4,6 +4,7 @@
<resultMap
id=
"BaseResultMap"
type=
"com.wwdz.ch.db.domain.distribution.AuctionConfig"
>
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"item_id"
jdbcType=
"BIGINT"
property=
"itemId"
/>
<result
column=
"creator_id"
jdbcType=
"BIGINT"
property=
"creatorId"
/>
<result
column=
"start_time"
jdbcType=
"TIMESTAMP"
property=
"startTime"
/>
<result
column=
"end_time"
jdbcType=
"TIMESTAMP"
property=
"endTime"
/>
<result
column=
"start_price"
jdbcType=
"BIGINT"
property=
"startPrice"
/>
...
...
@@ -13,6 +14,7 @@
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"is_valid"
jdbcType=
"BIT"
property=
"isValid"
/>
<result
column=
"is_deal"
jdbcType=
"BIT"
property=
"isDeal"
/>
<result
column=
"state"
jdbcType=
"INTEGER"
property=
"state"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
...
...
@@ -73,8 +75,8 @@
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id, item_id,
start_time, end_time, start_price, add_extent, real_end_time, create
_time,
update_time, is_valid, is_deal
id, item_id,
creator_id, start_time, end_time, start_price, add_extent, real_end
_time,
create_time, update_time, is_valid, is_deal, `state`
</sql>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.distribution.AuctionConfigExample"
resultMap=
"BaseResultMap"
>
select
...
...
@@ -109,8 +111,8 @@
</foreach>
</when>
<otherwise>
id, item_id,
start_time, end_time, start_price, add_extent, real_end_time, create
_time,
update_time, is_valid, is_deal
id, item_id,
creator_id, start_time, end_time, start_price, add_extent, real_end
_time,
create_time, update_time, is_valid, is_deal, `state`
</otherwise>
</choose>
from auction_config
...
...
@@ -141,8 +143,8 @@
</foreach>
</when>
<otherwise>
id, item_id,
start_time, end_time, start_price, add_extent, real_end_time, create
_time,
update_time, is_valid, is_deal
id, item_id,
creator_id, start_time, end_time, start_price, add_extent, real_end
_time,
create_time, update_time, is_valid, is_deal, `state`
</otherwise>
</choose>
from auction_config
...
...
@@ -162,14 +164,14 @@
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Integer"
>
SELECT LAST_INSERT_ID()
</selectKey>
insert into auction_config (item_id,
start_time, end
_time,
start_price, add_extent, real_end_time
,
create_time, update_time, is_valid
,
is_
deal
)
values (#{itemId,jdbcType=BIGINT}, #{
startTime,jdbcType=TIMESTAMP}, #{end
Time,jdbcType=TIMESTAMP},
#{
startPrice,jdbcType=BIGINT}, #{addExtent,jdbcType=BIGINT}, #{realEndTime,jdbcType=TIMESTAMP
},
#{
createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isValid,jdbcType=BIT
},
#{is
Deal,jdbcType=BIT
})
insert into auction_config (item_id,
creator_id, start
_time,
end_time, start_price, add_extent
,
real_end_time, create_time, update_time
,
is_
valid, is_deal, `state`
)
values (#{itemId,jdbcType=BIGINT}, #{
creatorId,jdbcType=BIGINT}, #{start
Time,jdbcType=TIMESTAMP},
#{
endTime,jdbcType=TIMESTAMP}, #{startPrice,jdbcType=BIGINT}, #{addExtent,jdbcType=BIGINT
},
#{
realEndTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP
},
#{is
Valid,jdbcType=BIT}, #{isDeal,jdbcType=BIT}, #{state,jdbcType=INTEGER
})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.distribution.AuctionConfig"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Integer"
>
...
...
@@ -180,6 +182,9 @@
<if
test=
"itemId != null"
>
item_id,
</if>
<if
test=
"creatorId != null"
>
creator_id,
</if>
<if
test=
"startTime != null"
>
start_time,
</if>
...
...
@@ -207,11 +212,17 @@
<if
test=
"isDeal != null"
>
is_deal,
</if>
<if
test=
"state != null"
>
`state`,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"itemId != null"
>
#{itemId,jdbcType=BIGINT},
</if>
<if
test=
"creatorId != null"
>
#{creatorId,jdbcType=BIGINT},
</if>
<if
test=
"startTime != null"
>
#{startTime,jdbcType=TIMESTAMP},
</if>
...
...
@@ -239,6 +250,9 @@
<if
test=
"isDeal != null"
>
#{isDeal,jdbcType=BIT},
</if>
<if
test=
"state != null"
>
#{state,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"com.wwdz.ch.db.domain.distribution.AuctionConfigExample"
resultType=
"java.lang.Long"
>
...
...
@@ -256,6 +270,9 @@
<if
test=
"record.itemId != null"
>
item_id = #{record.itemId,jdbcType=BIGINT},
</if>
<if
test=
"record.creatorId != null"
>
creator_id = #{record.creatorId,jdbcType=BIGINT},
</if>
<if
test=
"record.startTime != null"
>
start_time = #{record.startTime,jdbcType=TIMESTAMP},
</if>
...
...
@@ -283,6 +300,9 @@
<if
test=
"record.isDeal != null"
>
is_deal = #{record.isDeal,jdbcType=BIT},
</if>
<if
test=
"record.state != null"
>
`state` = #{record.state,jdbcType=INTEGER},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
...
...
@@ -292,6 +312,7 @@
update auction_config
set id = #{record.id,jdbcType=INTEGER},
item_id = #{record.itemId,jdbcType=BIGINT},
creator_id = #{record.creatorId,jdbcType=BIGINT},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
start_price = #{record.startPrice,jdbcType=BIGINT},
...
...
@@ -300,7 +321,8 @@
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_valid = #{record.isValid,jdbcType=BIT},
is_deal = #{record.isDeal,jdbcType=BIT}
is_deal = #{record.isDeal,jdbcType=BIT},
`state` = #{record.state,jdbcType=INTEGER}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
...
...
@@ -311,6 +333,9 @@
<if
test=
"itemId != null"
>
item_id = #{itemId,jdbcType=BIGINT},
</if>
<if
test=
"creatorId != null"
>
creator_id = #{creatorId,jdbcType=BIGINT},
</if>
<if
test=
"startTime != null"
>
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
...
...
@@ -338,12 +363,16 @@
<if
test=
"isDeal != null"
>
is_deal = #{isDeal,jdbcType=BIT},
</if>
<if
test=
"state != null"
>
`state` = #{state,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.wwdz.ch.db.domain.distribution.AuctionConfig"
>
update auction_config
set item_id = #{itemId,jdbcType=BIGINT},
creator_id = #{creatorId,jdbcType=BIGINT},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
start_price = #{startPrice,jdbcType=BIGINT},
...
...
@@ -352,7 +381,8 @@
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
is_valid = #{isValid,jdbcType=BIT},
is_deal = #{isDeal,jdbcType=BIT}
is_deal = #{isDeal,jdbcType=BIT},
`state` = #{state,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select
id=
"selectOneByExample"
parameterType=
"com.wwdz.ch.db.domain.distribution.AuctionConfigExample"
resultMap=
"BaseResultMap"
>
...
...
@@ -388,8 +418,8 @@
</foreach>
</when>
<otherwise>
id, item_id,
start_time, end_time, start_price, add_extent, real_end_time, create
_time,
update_time, is_valid, is_deal
id, item_id,
creator_id, start_time, end_time, start_price, add_extent, real_end
_time,
create_time, update_time, is_valid, is_deal, `state`
</otherwise>
</choose>
from auction_config
...
...
@@ -401,5 +431,4 @@
</if>
limit 1
</select>
</mapper>
\ No newline at end of file
ch-dao/src/main/resources/generatorConfig_new.xml
View file @
d4427ecd
...
...
@@ -63,16 +63,16 @@
<!--生成Model类存放位置-->
<javaModelGenerator
targetPackage=
"com.wwdz.ch.db.domain"
targetProject=
"ch-dao/src/main/java"
>
<javaModelGenerator
targetPackage=
"com.wwdz.ch.db.domain
.distribution
"
targetProject=
"ch-dao/src/main/java"
>
<property
name=
"enableSubPackages"
value=
"true"
/>
<property
name=
"trimStrings"
value=
"true"
/>
</javaModelGenerator>
<sqlMapGenerator
targetPackage=
"com.wwdz.ch.db.mapper"
targetProject=
"ch-dao/src/main/resources"
/>
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"com.wwdz.ch.db.mapper"
<sqlMapGenerator
targetPackage=
"com.wwdz.ch.db.mapper
.distribution
"
targetProject=
"ch-dao/src/main/resources"
/>
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"com.wwdz.ch.db.mapper
.distribution
"
targetProject=
"ch-dao/src/main/java"
/>
<table
tableName=
"
collector_white_list
"
enableCountByExample=
"true"
enableUpdateByExample=
"true"
enableDeleteByExample=
"true"
enableSelectByExample=
"true"
selectByExampleQueryId=
"true"
>
<table
tableName=
"
auction_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/api/WxPayCallbackController.java
View file @
d4427ecd
...
...
@@ -8,6 +8,7 @@ import com.wechat.pay.java.service.refund.model.RefundNotification;
import
com.wwdz.ch.core.api.OfficialAccountApi
;
import
com.wwdz.ch.core.api.WxAppletApi
;
import
com.wwdz.ch.core.api.wxpay.WxPayServiceApi
;
import
com.wwdz.ch.core.consts.AuctionEnum
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.consts.RefundOrderEnum
;
import
com.wwdz.ch.core.notify.AliSmsSender
;
...
...
@@ -94,6 +95,9 @@ public class WxPayCallbackController {
@Autowired
IdentifyOrderService
identifyOrderService
;
@Autowired
AuctionConfigDao
auctionConfigDao
;
@RequestMapping
(
value
=
"/getPayNotify"
)
public
String
payNotify
(
HttpServletRequest
request
)
throws
IOException
{
logger
.
info
(
"------------------ 收到微信支付回调通知 ------------------"
);
...
...
@@ -298,6 +302,8 @@ public class WxPayCallbackController {
distributorBind
.
setIsValid
(
true
);
distributorBindDao
.
insert
(
distributorBind
);
}
//更新拍品配置中的状态为"成交"
auctionConfigDao
.
updateState
(
distributionOrder
.
getItemId
(),
AuctionEnum
.
StateEnum
.
DEALED
.
getCode
());
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 @
d4427ecd
...
...
@@ -328,8 +328,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
aliSmsSender
.
sendSms
(
record
.
getDistributorId
(),
msg
);
}
}
//把该拍卖配置信息改为已处理
auctionConfigDao
.
setDeal
(
dto
.
getItemId
());
//把该拍卖配置信息改为已处理
, 拍品状态为"中拍未付款"
auctionConfigDao
.
setDeal
(
dto
.
getItemId
()
,
AuctionEnum
.
StateEnum
.
GET_NOT_PAY
.
getCode
()
);
//发送中拍信息给用户
String
userOpenId
=
sendMsgService
.
getOpenIdByUserId
(
auctionRecord
.
getUserId
());
Instant
instant
=
auctionConfig
.
getRealEndTime
().
toInstant
().
plus
(
Duration
.
ofHours
(
24
));
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SpecialPerformanceServiceImpl.java
View file @
d4427ecd
...
...
@@ -81,13 +81,13 @@ public class SpecialPerformanceServiceImpl implements SpecialPerformanceService
Date
now
=
new
Date
();
//到时自动开始,修改状态
SpecialPerformanceRequestDto
specialPerformanceRequestDto
=
new
SpecialPerformanceRequestDto
();
specialPerformanceRequestDto
.
setState
(
DistributionEnum
.
AuctionStateEnum
.
NOT_START
.
getCode
());
specialPerformanceRequestDto
.
setState
(
SpecialPerformanceEnum
.
StateEnum
.
PREVIEW
.
getCode
());
List
<
SpecialPerformance
>
specialPerformanceList
=
specialPerformanceDao
.
find
(
specialPerformanceRequestDto
);
for
(
SpecialPerformance
notStartSpecialPerformance
:
specialPerformanceList
)
{
if
(
now
.
after
(
notStartSpecialPerformance
.
getStartTime
()))
{
if
(
now
.
after
(
notStartSpecialPerformance
.
getStartTime
())
&&
notStartSpecialPerformance
.
getEndTime
().
after
(
now
)
)
{
SpecialPerformance
updateDto
=
new
SpecialPerformance
();
updateDto
.
setId
(
notStartSpecialPerformance
.
getId
());
updateDto
.
setState
(
DistributionEnum
.
AuctionStateEnum
.
IN_AUCTION
.
getCode
());
updateDto
.
setState
(
SpecialPerformanceEnum
.
StateEnum
.
PROCESSING
.
getCode
());
updateDto
.
setUpdateTime
(
now
);
specialPerformanceDao
.
update
(
updateDto
);
}
...
...
@@ -102,10 +102,10 @@ public class SpecialPerformanceServiceImpl implements SpecialPerformanceService
if
(
now
.
after
(
specialPerformance
.
getEndTime
()))
{
SpecialPerformance
updateDto
=
new
SpecialPerformance
();
updateDto
.
setId
(
specialPerformance
.
getId
());
updateDto
.
setState
(
DistributionEnum
.
Auction
StateEnum
.
END
.
getCode
());
updateDto
.
setState
(
SpecialPerformanceEnum
.
StateEnum
.
END
.
getCode
());
updateDto
.
setUpdateTime
(
now
);
specialPerformanceDao
.
update
(
updateDto
);
specialPerformance
.
setState
(
DistributionEnum
.
Auction
StateEnum
.
END
.
getCode
());
specialPerformance
.
setState
(
SpecialPerformanceEnum
.
StateEnum
.
END
.
getCode
());
}
int
specialPerformanceId
=
specialPerformance
.
getId
();
SpecialPerformanceConfigRequestDto
specialPerformanceConfigRequestDto
=
new
SpecialPerformanceConfigRequestDto
();
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/job/AutoCreateAuctionOrderJob.java
View file @
d4427ecd
package
com.wwdz.ch.wx.job
;
import
com.wwdz.ch.core.consts.AuctionEnum
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dao.distribution.AuctionConfigDao
;
import
com.wwdz.ch.db.dao.distribution.AuctionRecordDao
;
...
...
@@ -99,8 +101,8 @@ public class AutoCreateAuctionOrderJob {
}
}
}
else
{
//没有出价记录,流拍的商品也要更新拍卖配置信息为已处理
auctionConfigDao
.
setDeal
(
itemId
);
//没有出价记录,流拍的商品也要更新拍卖配置信息为已处理
, 拍品状态更新为"无出价流拍"
auctionConfigDao
.
setDeal
(
itemId
,
AuctionEnum
.
StateEnum
.
NO_OFFER_TO_PASS
.
getCode
()
);
}
});
//把截拍超过24小时的商品设置为下架
...
...
@@ -135,5 +137,4 @@ public class AutoCreateAuctionOrderJob {
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/job/AutoSendMsgJob.java
View file @
d4427ecd
package
com.wwdz.ch.wx.job
;
import
com.wwdz.ch.core.consts.AuctionEnum
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.consts.SpecialPerformanceEnum
;
import
com.wwdz.ch.core.notify.AliSmsSender
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.PriceUtil
;
import
com.wwdz.ch.core.util.RedisUtils
;
import
com.wwdz.ch.core.util.StringUtil
;
import
com.wwdz.ch.db.dao.distribution.AuctionConfigDao
;
import
com.wwdz.ch.db.dao.distribution.AuctionRecordDao
;
import
com.wwdz.ch.db.dao.distribution.DistributionOrderDao
;
import
com.wwdz.ch.db.dao.distribution.SupplierItemDao
;
import
com.wwdz.ch.db.domain.distribution.AuctionConfig
;
import
com.wwdz.ch.db.domain.distribution.AuctionRecord
;
import
com.wwdz.ch.db.domain.distribution.DistributionOrder
;
import
com.wwdz.ch.db.domain.distribution.SupplierItem
;
import
com.wwdz.ch.db.dao.distribution.*
;
import
com.wwdz.ch.db.domain.distribution.*
;
import
com.wwdz.ch.core.api.WxAppletApi
;
import
com.wwdz.ch.core.entity.AuctionOfferNoticeMsg
;
import
com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceConfigRequestDto
;
import
com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceRequestDto
;
import
com.wwdz.ch.wx.service.distribution.DistributionOrderService
;
import
com.wwdz.ch.core.service.SendMsgService
;
import
com.xxdxxs.utils.DateUtils
;
...
...
@@ -84,6 +84,9 @@ public class AutoSendMsgJob {
@Autowired
WxAppletApi
wxAppletApi
;
@Autowired
SpecialPerformanceDao
specialPerformanceDao
;
@Value
(
"${dts.wx.auction-msg-url}"
)
private
String
AUCTION_MSG_URL
;
...
...
@@ -99,6 +102,9 @@ public class AutoSendMsgJob {
}
logger
.
info
(
">>>>>>>>>>>>>>>>>>>>>>> 自动发送拍卖通知任务,开始执行 <<<<<<<<<<<<<<<<<<<<<"
);
try
{
//自动取消中拍未付款超时的订单
autoCancelNotPayOrder
();
//查询即将在一小时内截拍的商品,通知参与过出价的用户即将截拍
List
<
AuctionConfig
>
auctionConfigList
=
auctionConfigDao
.
findAbortEndList
();
logger
.
info
(
">>>>>> 一小时内即将截拍的商品数量 :{} <<<<<<<"
,
auctionConfigList
.
size
());
...
...
@@ -219,4 +225,27 @@ public class AutoSendMsgJob {
}
}
/**
* 拍卖订单中拍超时未付款导致流拍
* 自动更新这些拍品的状态为"中拍未付款流拍"
*/
public
void
autoCancelNotPayOrder
()
{
DistributionOrderRequestDto
dto
=
new
DistributionOrderRequestDto
();
dto
.
setType
(
DistributionEnum
.
DistributionTypeEnum
.
AUCTION
.
getCode
());
dto
.
setState
(
DistributionEnum
.
DistributionOrderStateEnum
.
PRE_PAY
.
getCode
());
List
<
DistributionOrder
>
prePayList
=
distributionOrderDao
.
findByPage
(
dto
);
prePayList
.
forEach
(
distributionOrder
->
{
long
diffInMillies
=
Math
.
abs
(
new
Date
().
getTime
()
-
distributionOrder
.
getCreateTime
().
getTime
());
//竞拍商品超出24小时未付款,订单取消
long
diffInHours
=
diffInMillies
/
(
60
*
1000
*
60
);
if
(
diffInHours
>=
24
)
{
distributionOrderDao
.
updateState
(
distributionOrder
.
getDistributionOrderId
(),
DistributionEnum
.
DistributionOrderStateEnum
.
CANCEL
.
getCode
());
auctionConfigDao
.
updateState
(
distributionOrder
.
getItemId
(),
AuctionEnum
.
StateEnum
.
GET_NOT_PAY_TO_PASS
.
getCode
());
logger
.
info
(
"================== 拍品:{}, 超过付款时效, 自动取消订单 =================="
,
distributionOrder
.
getItemId
());
}
});
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/job/SpecialPerformanceNoticeJob.java
View file @
d4427ecd
...
...
@@ -2,7 +2,9 @@ package com.wwdz.ch.wx.job;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.core.api.WxAppletApi
;
import
com.wwdz.ch.core.consts.AuctionEnum
;
import
com.wwdz.ch.core.consts.DistributionEnum
;
import
com.wwdz.ch.core.consts.SpecialPerformanceEnum
;
import
com.wwdz.ch.core.entity.AuctionOfferNoticeMsg
;
import
com.wwdz.ch.core.notify.AliSmsSender
;
import
com.wwdz.ch.core.service.SendMsgService
;
...
...
@@ -52,6 +54,9 @@ public class SpecialPerformanceNoticeJob {
@Autowired
SpecialPerformanceDao
specialPerformanceDao
;
@Autowired
SpecialPerformanceConfigDao
specialPerformanceConfigDao
;
@Autowired
RedissonClient
redissonClient
;
...
...
@@ -67,6 +72,9 @@ public class SpecialPerformanceNoticeJob {
@Autowired
WxAppletApi
wxAppletApi
;
@Autowired
AuctionConfigDao
auctionConfigDao
;
@Autowired
UserDao
userDao
;
...
...
@@ -84,8 +92,10 @@ public class SpecialPerformanceNoticeJob {
}
logger
.
info
(
">>>>>>>>>>>>>>>>>>>>>>> 专场即将开始通知任务,开始执行 <<<<<<<<<<<<<<<<<<<<<"
);
try
{
autoRefreshSpecialPerformanceState
();
SpecialPerformanceRequestDto
specialPerformanceRequestDto
=
new
SpecialPerformanceRequestDto
();
specialPerformanceRequestDto
.
setState
(
DistributionEnum
.
AuctionStateEnum
.
NOT_START
.
getCode
());
specialPerformanceRequestDto
.
setState
(
SpecialPerformanceEnum
.
StateEnum
.
PREVIEW
.
getCode
());
Date
now
=
new
Date
();
Instant
startInstant
=
now
.
toInstant
().
plus
(
Duration
.
ofMinutes
(
20
));
Date
startTime
=
Date
.
from
(
startInstant
);
...
...
@@ -143,4 +153,83 @@ public class SpecialPerformanceNoticeJob {
}
}
/**
* 自动更新专场和专场商品在竞拍结束前的状态
*/
public
void
autoRefreshSpecialPerformanceState
()
{
try
{
//查询专场
SpecialPerformanceRequestDto
specialPerformanceRequestDto
=
new
SpecialPerformanceRequestDto
();
specialPerformanceRequestDto
.
setFilterState
(
SpecialPerformanceEnum
.
StateEnum
.
END
.
getCode
());
List
<
SpecialPerformance
>
specialPerformanceList
=
specialPerformanceDao
.
find
(
specialPerformanceRequestDto
);
Date
now
=
new
Date
();
Instant
startInstant
=
now
.
toInstant
().
minus
(
Duration
.
ofDays
(
1
));
Date
startTime
=
Date
.
from
(
startInstant
);
for
(
SpecialPerformance
specialPerformance
:
specialPerformanceList
)
{
if
(
specialPerformance
.
getState
().
intValue
()
==
SpecialPerformanceEnum
.
StateEnum
.
DELETED
.
getCode
())
{
continue
;
}
else
if
(
specialPerformance
.
getState
().
intValue
()
==
SpecialPerformanceEnum
.
StateEnum
.
NOT_START
.
getCode
())
{
//未开始的专场判断是否需要改为预展中,开始时间提前一天预展
//设置为预展中
if
(
specialPerformance
.
getStartTime
().
after
(
startTime
)
&&
specialPerformance
.
getStartTime
().
before
(
now
))
{
if
(
specialPerformance
.
getState
().
intValue
()
!=
SpecialPerformanceEnum
.
StateEnum
.
PREVIEW
.
getCode
())
{
specialPerformanceDao
.
updateState
(
specialPerformance
.
getId
(),
SpecialPerformanceEnum
.
StateEnum
.
PREVIEW
.
getCode
());
}
}
else
if
(
specialPerformance
.
getStartTime
().
after
(
now
)
&&
specialPerformance
.
getEndTime
().
after
(
now
))
{
//开始时间之后,结束时间之前,状态设置为进行中
if
(
specialPerformance
.
getState
().
intValue
()
!=
SpecialPerformanceEnum
.
StateEnum
.
PROCESSING
.
getCode
())
{
specialPerformanceDao
.
updateState
(
specialPerformance
.
getId
(),
SpecialPerformanceEnum
.
StateEnum
.
PROCESSING
.
getCode
());
}
}
}
else
if
(
specialPerformance
.
getState
().
intValue
()
==
SpecialPerformanceEnum
.
StateEnum
.
PREVIEW
.
getCode
())
{
if
(
specialPerformance
.
getStartTime
().
after
(
now
)
&&
specialPerformance
.
getEndTime
().
after
(
now
))
{
//开始时间之后,结束时间之前,状态设置为进行中
if
(
specialPerformance
.
getState
().
intValue
()
!=
SpecialPerformanceEnum
.
StateEnum
.
PROCESSING
.
getCode
())
{
specialPerformanceDao
.
updateState
(
specialPerformance
.
getId
(),
SpecialPerformanceEnum
.
StateEnum
.
PROCESSING
.
getCode
());
}
}
else
if
(
specialPerformance
.
getEndTime
().
before
(
now
))
{
//超过结束时间,状态设置为结束
specialPerformanceDao
.
updateState
(
specialPerformance
.
getId
(),
SpecialPerformanceEnum
.
StateEnum
.
END
.
getCode
());
}
}
else
if
(
specialPerformance
.
getState
().
intValue
()
==
SpecialPerformanceEnum
.
StateEnum
.
PROCESSING
.
getCode
())
{
//超过结束时间,状态设置为结束
if
(
specialPerformance
.
getEndTime
().
before
(
now
))
{
specialPerformanceDao
.
updateState
(
specialPerformance
.
getId
(),
SpecialPerformanceEnum
.
StateEnum
.
END
.
getCode
());
}
}
//查询该专场下的商品,自动更新状态
List
<
SpecialPerformanceConfig
>
specialPerformanceConfigList
=
specialPerformanceConfigDao
.
findAllItem
(
specialPerformance
.
getId
());
for
(
SpecialPerformanceConfig
specialPerformanceConfig
:
specialPerformanceConfigList
)
{
long
itemId
=
specialPerformanceConfig
.
getItemId
();
AuctionConfig
auctionConfig
=
auctionConfigDao
.
findByItemId
(
itemId
);
if
(
auctionConfig
.
getState
().
intValue
()
==
AuctionEnum
.
StateEnum
.
WAIT_ON_SALE
.
getCode
())
{
//待上架的拍品判断是否需要改为预展中,开始时间提前一天预展
if
(
auctionConfig
.
getStartTime
().
after
(
startTime
)
&&
auctionConfig
.
getStartTime
().
before
(
now
))
{
if
(
auctionConfig
.
getState
().
intValue
()
!=
AuctionEnum
.
StateEnum
.
PREVIEW
.
getCode
())
{
auctionConfigDao
.
updateState
(
itemId
,
AuctionEnum
.
StateEnum
.
PREVIEW
.
getCode
());
}
}
else
if
(
auctionConfig
.
getStartTime
().
after
(
now
)
&&
auctionConfig
.
getEndTime
().
after
(
now
))
{
//开始时间之后,结束时间之前,状态设置为拍卖中
if
(
auctionConfig
.
getState
().
intValue
()
!=
AuctionEnum
.
StateEnum
.
AUCTIONING
.
getCode
())
{
auctionConfigDao
.
updateState
(
itemId
,
AuctionEnum
.
StateEnum
.
AUCTIONING
.
getCode
());
}
}
}
else
if
(
auctionConfig
.
getState
().
intValue
()
==
AuctionEnum
.
StateEnum
.
PREVIEW
.
getCode
())
{
if
(
auctionConfig
.
getStartTime
().
after
(
now
)
&&
specialPerformance
.
getEndTime
().
after
(
now
))
{
//开始时间之后,结束时间之前,状态设置为进行中
if
(
auctionConfig
.
getState
().
intValue
()
!=
AuctionEnum
.
StateEnum
.
AUCTIONING
.
getCode
())
{
auctionConfigDao
.
updateState
(
itemId
,
AuctionEnum
.
StateEnum
.
AUCTIONING
.
getCode
());
}
}
}
}
}
logger
.
info
(
">>>>>>>>>>>> 自动更新专场和专场商品在竞拍结束前的状态 SUCCESS <<<<<<<<<<<<<"
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"自动更新专场和专场商品在竞拍结束前的状态 ERROR :{}"
,
e
);
}
}
}
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