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
c4665ea2
Commit
c4665ea2
authored
Mar 26, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修复
parent
183c8cd4
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
180 additions
and
5 deletions
+180
-5
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/SysSupplierItemServiceImpl.java
...va/com/wwdz/ch/admin/impl/SysSupplierItemServiceImpl.java
+3
-0
ch-core/src/main/java/com/wwdz/ch/core/api/OfficialAccountApi.java
...rc/main/java/com/wwdz/ch/core/api/OfficialAccountApi.java
+4
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/CollectionBookDao.java
...va/com/wwdz/ch/db/dao/distribution/CollectionBookDao.java
+4
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/CollectionBookDaoImpl.java
...m/wwdz/ch/db/impl/distribution/CollectionBookDaoImpl.java
+21
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/AuctionOfferNoticeMsg.java
...ain/java/com/wwdz/ch/wx/entity/AuctionOfferNoticeMsg.java
+10
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/CollectionBookServiceImpl.java
...dz/ch/wx/impl/distribution/CollectionBookServiceImpl.java
+8
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SendMsgServiceImpl.java
.../com/wwdz/ch/wx/impl/distribution/SendMsgServiceImpl.java
+111
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
...wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
+19
-5
No files found.
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/SysSupplierItemServiceImpl.java
View file @
c4665ea2
...
@@ -90,6 +90,9 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
...
@@ -90,6 +90,9 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
supplierItem
.
setUpdateTime
(
now
);
supplierItem
.
setUpdateTime
(
now
);
supplierItem
.
setIsOnSale
(
true
);
supplierItem
.
setIsOnSale
(
true
);
supplierItem
.
setIsDeleted
(
false
);
supplierItem
.
setIsDeleted
(
false
);
if
(
dto
.
getStock
()
==
null
)
{
supplierItem
.
setStock
(
1
);
}
//平台上传商品使用系统默认账号
//平台上传商品使用系统默认账号
supplierItem
.
setCreatorId
(
CommConsts
.
SYSTEM_ACCOUNT
);
supplierItem
.
setCreatorId
(
CommConsts
.
SYSTEM_ACCOUNT
);
long
itemId
=
supplierItemDao
.
insert
(
supplierItem
);
long
itemId
=
supplierItemDao
.
insert
(
supplierItem
);
...
...
ch-core/src/main/java/com/wwdz/ch/core/api/OfficialAccountApi.java
View file @
c4665ea2
...
@@ -26,6 +26,8 @@ public class OfficialAccountApi {
...
@@ -26,6 +26,8 @@ public class OfficialAccountApi {
private
final
static
String
SEND_MSG_URL
=
"https://api.weixin.qq.com/cgi-bin/message/template/send"
;
private
final
static
String
SEND_MSG_URL
=
"https://api.weixin.qq.com/cgi-bin/message/template/send"
;
/**
/**
* 测试环境和正式环境的url不同,相互隔离不会冲突
* 测试环境和正式环境的url不同,相互隔离不会冲突
*/
*/
...
@@ -173,4 +175,6 @@ public class OfficialAccountApi {
...
@@ -173,4 +175,6 @@ public class OfficialAccountApi {
}
}
}
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/CollectionBookDao.java
View file @
c4665ea2
...
@@ -25,7 +25,11 @@ public interface CollectionBookDao {
...
@@ -25,7 +25,11 @@ public interface CollectionBookDao {
List
<
CollectionBook
>
findByUserId
(
long
userId
);
List
<
CollectionBook
>
findByUserId
(
long
userId
);
long
countByUserId
(
long
userId
);
int
delete
(
long
id
);
int
delete
(
long
id
);
boolean
isExisted
(
long
userId
,
String
name
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/CollectionBookDaoImpl.java
View file @
c4665ea2
...
@@ -46,6 +46,16 @@ public class CollectionBookDaoImpl implements CollectionBookDao {
...
@@ -46,6 +46,16 @@ public class CollectionBookDaoImpl implements CollectionBookDao {
return
collectionBookMapper
.
selectByExample
(
example
);
return
collectionBookMapper
.
selectByExample
(
example
);
}
}
@Override
public
long
countByUserId
(
long
userId
)
{
CollectionBookExample
example
=
new
CollectionBookExample
();
CollectionBookExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
criteria
.
andIsDeletedEqualTo
(
false
);
return
collectionBookMapper
.
countByExample
(
example
);
}
@Override
@Override
public
int
delete
(
long
id
)
{
public
int
delete
(
long
id
)
{
CollectionBook
collectionBook
=
new
CollectionBook
();
CollectionBook
collectionBook
=
new
CollectionBook
();
...
@@ -54,4 +64,15 @@ public class CollectionBookDaoImpl implements CollectionBookDao {
...
@@ -54,4 +64,15 @@ public class CollectionBookDaoImpl implements CollectionBookDao {
collectionBook
.
setId
(
id
);
collectionBook
.
setId
(
id
);
return
collectionBookMapper
.
updateByPrimaryKeySelective
(
collectionBook
);
return
collectionBookMapper
.
updateByPrimaryKeySelective
(
collectionBook
);
}
}
@Override
public
boolean
isExisted
(
long
userId
,
String
name
)
{
CollectionBookExample
example
=
new
CollectionBookExample
();
CollectionBookExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
criteria
.
andTitleEqualTo
(
name
);
criteria
.
andIsDeletedEqualTo
(
false
);
return
collectionBookMapper
.
countByExample
(
example
)
>
0
;
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/AuctionOfferNoticeMsg.java
View file @
c4665ea2
...
@@ -61,6 +61,16 @@ public class AuctionOfferNoticeMsg implements Entity {
...
@@ -61,6 +61,16 @@ public class AuctionOfferNoticeMsg implements Entity {
*/
*/
private
String
profit
;
private
String
profit
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 消息内容
*/
private
String
content
;
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/CollectionBookServiceImpl.java
View file @
c4665ea2
...
@@ -30,6 +30,14 @@ public class CollectionBookServiceImpl implements CollectionBookService {
...
@@ -30,6 +30,14 @@ public class CollectionBookServiceImpl implements CollectionBookService {
@Override
@Override
public
Result
create
(
CollectionBookRequestDto
dto
)
{
public
Result
create
(
CollectionBookRequestDto
dto
)
{
try
{
try
{
long
countNum
=
collectionBookDao
.
countByUserId
(
dto
.
getUserId
());
if
(
countNum
>=
15
)
{
return
Result
.
failed
(
"标签数量已达上限"
);
}
if
(
collectionBookDao
.
isExisted
(
dto
.
getUserId
(),
dto
.
getTitle
()))
{
return
Result
.
failed
(
"标签名称已存在"
);
}
CollectionBook
collectionBook
=
new
CollectionBook
();
CollectionBook
collectionBook
=
new
CollectionBook
();
EntityMapper
.
copyAttribute
(
dto
,
collectionBook
);
EntityMapper
.
copyAttribute
(
dto
,
collectionBook
);
collectionBook
.
setSort
(
1
);
collectionBook
.
setSort
(
1
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SendMsgServiceImpl.java
View file @
c4665ea2
package
com.wwdz.ch.wx.impl.distribution
;
package
com.wwdz.ch.wx.impl.distribution
;
import
com.wwdz.ch.core.api.OfficialAccountApi
;
import
com.wwdz.ch.core.api.OfficialAccountApi
;
import
com.wwdz.ch.core.entity.ConsignSaleSubscribeMsg
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.OkHttpUtil
;
import
com.wwdz.ch.core.util.OkHttpUtil
;
import
com.wwdz.ch.db.dao.OfficialAccountSubscribeRecordDao
;
import
com.wwdz.ch.db.dao.OfficialAccountSubscribeRecordDao
;
...
@@ -37,6 +38,11 @@ public class SendMsgServiceImpl implements SendMsgService {
...
@@ -37,6 +38,11 @@ public class SendMsgServiceImpl implements SendMsgService {
private
final
static
String
SEND_MSG_URL
=
"https://api.weixin.qq.com/cgi-bin/message/template/send"
;
private
final
static
String
SEND_MSG_URL
=
"https://api.weixin.qq.com/cgi-bin/message/template/send"
;
/**
* 发送订阅消息url
*/
private
final
static
String
SEND_SUBSCRIBE_MSG_URL
=
"https://api.weixin.qq.com/cgi-bin/message/subscribe/send"
;
@Value
(
"${dts.wx.pay-templetId}"
)
@Value
(
"${dts.wx.pay-templetId}"
)
private
String
PAY_TEMPLETID
;
private
String
PAY_TEMPLETID
;
...
@@ -548,4 +554,109 @@ public class SendMsgServiceImpl implements SendMsgService {
...
@@ -548,4 +554,109 @@ public class SendMsgServiceImpl implements SendMsgService {
String
openId
=
officialAccountSubscribeRecord
.
getOpenid
();
String
openId
=
officialAccountSubscribeRecord
.
getOpenid
();
return
openId
;
return
openId
;
}
}
/**
* 商品上新通知
* @param auctionOfferNoticeMsg
* @return
*/
public
boolean
sendNewItemMsg
(
AuctionOfferNoticeMsg
auctionOfferNoticeMsg
)
{
String
openId
=
auctionOfferNoticeMsg
.
getOpenId
();
String
token
=
officialAccountApi
.
getAccessToken
();
String
url
=
SEND_SUBSCRIBE_MSG_URL
+
"?access_token="
+
token
;
OkHttpUtil
okHttpUtil
=
OkHttpUtil
.
builder
().
url
(
url
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"touser"
,
openId
);
map
.
put
(
"template_id"
,
"qazuHdQTudkRd-UIYb58nEW0Zw4_ZCVIYmi_muR9cgc"
);
Map
<
String
,
Object
>
miniprogramMap
=
new
HashMap
<>();
miniprogramMap
.
put
(
"appid"
,
APPLET_APPID
);
StringBuffer
stringBuffer
=
new
StringBuffer
(
AUCTION_MSG_URL
);
stringBuffer
.
append
(
"?itemId="
+
auctionOfferNoticeMsg
.
getItemId
());
if
(
StringUtils
.
hasLength
(
auctionOfferNoticeMsg
.
getShareRecordId
()))
{
stringBuffer
.
append
(
"&shareRecordId="
+
auctionOfferNoticeMsg
.
getShareRecordId
());
}
miniprogramMap
.
put
(
"pagepath"
,
stringBuffer
.
toString
());
map
.
put
(
"miniprogram"
,
miniprogramMap
);
Map
<
String
,
Object
>
paramMap
=
new
LinkedHashMap
<>();
paramMap
.
put
(
"thing1"
,
new
HashMap
()
{{
put
(
"value"
,
auctionOfferNoticeMsg
.
getItemName
());
}});
paramMap
.
put
(
"time4"
,
new
HashMap
()
{{
put
(
"value"
,
auctionOfferNoticeMsg
.
getCreateTime
());
}});
paramMap
.
put
(
"thing5"
,
new
HashMap
()
{{
put
(
"value"
,
auctionOfferNoticeMsg
.
getContent
());
}});
map
.
put
(
"data"
,
paramMap
);
logger
.
info
(
"============ 商品上新通知内容 : {}"
,
JsonUtils
.
fromMap
(
map
));
okHttpUtil
.
addParams
(
map
);
okHttpUtil
.
post
(
true
);
String
responseStr
=
okHttpUtil
.
async
();
logger
.
info
(
"openid : {}, 发送商品上新通知 response :{}"
,
openId
,
responseStr
);
String
errorCode
=
JsonUtils
.
getValueByPath
(
responseStr
,
"errcode"
);
String
errmsg
=
JsonUtils
.
getValueByPath
(
responseStr
,
"errmsg"
);
if
(!
"0"
.
equals
(
errorCode
))
{
logger
.
error
(
"openid : {}, 发送商品上新通知, errorCode : {}, errmsg : {} "
,
openId
,
errorCode
,
errmsg
);
return
false
;
}
logger
.
info
(
"============= 发送商品上新通知成功 ==========="
);
return
true
;
}
/**
* 竞拍开始通知
* @param auctionOfferNoticeMsg
* @return
*/
public
boolean
sendAuctionStartMsg
(
AuctionOfferNoticeMsg
auctionOfferNoticeMsg
)
{
String
openId
=
auctionOfferNoticeMsg
.
getOpenId
();
String
token
=
officialAccountApi
.
getAccessToken
();
String
url
=
SEND_SUBSCRIBE_MSG_URL
+
"?access_token="
+
token
;
OkHttpUtil
okHttpUtil
=
OkHttpUtil
.
builder
().
url
(
url
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"touser"
,
openId
);
map
.
put
(
"template_id"
,
"RjUUMuLyyW1g6ULUr9HWO8oEKoE-Vd_3s3p0XRI7tS0"
);
Map
<
String
,
Object
>
miniprogramMap
=
new
HashMap
<>();
miniprogramMap
.
put
(
"appid"
,
APPLET_APPID
);
StringBuffer
stringBuffer
=
new
StringBuffer
(
AUCTION_MSG_URL
);
stringBuffer
.
append
(
"?itemId="
+
auctionOfferNoticeMsg
.
getItemId
());
if
(
StringUtils
.
hasLength
(
auctionOfferNoticeMsg
.
getShareRecordId
()))
{
stringBuffer
.
append
(
"&shareRecordId="
+
auctionOfferNoticeMsg
.
getShareRecordId
());
}
miniprogramMap
.
put
(
"pagepath"
,
stringBuffer
.
toString
());
map
.
put
(
"miniprogram"
,
miniprogramMap
);
Map
<
String
,
Object
>
paramMap
=
new
LinkedHashMap
<>();
paramMap
.
put
(
"thing1"
,
new
HashMap
()
{{
put
(
"value"
,
auctionOfferNoticeMsg
.
getItemName
());
}});
paramMap
.
put
(
"time2"
,
new
HashMap
()
{{
put
(
"value"
,
auctionOfferNoticeMsg
.
getCreateTime
());
}});
paramMap
.
put
(
"time3"
,
new
HashMap
()
{{
put
(
"value"
,
auctionOfferNoticeMsg
.
getContent
());
}});
map
.
put
(
"data"
,
paramMap
);
logger
.
info
(
"============ 竞拍开始通知内容 : {}"
,
JsonUtils
.
fromMap
(
map
));
okHttpUtil
.
addParams
(
map
);
okHttpUtil
.
post
(
true
);
String
responseStr
=
okHttpUtil
.
async
();
logger
.
info
(
"openid : {}, 发送竞拍开始通知 response :{}"
,
openId
,
responseStr
);
String
errorCode
=
JsonUtils
.
getValueByPath
(
responseStr
,
"errcode"
);
String
errmsg
=
JsonUtils
.
getValueByPath
(
responseStr
,
"errmsg"
);
if
(!
"0"
.
equals
(
errorCode
))
{
logger
.
error
(
"openid : {}, 发送竞拍开始通知, errorCode : {}, errmsg : {} "
,
openId
,
errorCode
,
errmsg
);
return
false
;
}
logger
.
info
(
"============= 发送竞拍开始通知成功 ==========="
);
return
true
;
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/SupplierItemServiceImpl.java
View file @
c4665ea2
...
@@ -118,15 +118,29 @@ public class SupplierItemServiceImpl implements SupplierItemService {
...
@@ -118,15 +118,29 @@ public class SupplierItemServiceImpl implements SupplierItemService {
supplierItemVo
.
setRebate
(
supplierItem
.
getRebate
().
toPlainString
()
+
"%"
);
supplierItemVo
.
setRebate
(
supplierItem
.
getRebate
().
toPlainString
()
+
"%"
);
//竞拍商品需要展示当前价
//竞拍商品需要展示当前价
if
(
supplierItem
.
getType
()
==
DistributionEnum
.
DistributionTypeEnum
.
AUCTION
.
getCode
())
{
if
(
supplierItem
.
getType
()
==
DistributionEnum
.
DistributionTypeEnum
.
AUCTION
.
getCode
())
{
AuctionRecord
auctionRecord
=
auctionRecordDao
.
findLastedRecord
(
supplierItem
.
getId
());
Date
now
=
new
Date
();
if
(
auctionRecord
!=
null
&&
auctionRecord
.
getPrice
()
!=
null
)
{
AuctionRecord
lastedRecord
=
auctionRecordDao
.
findLastedRecord
(
supplierItem
.
getId
());
supplierItemVo
.
setCurrentPrice
(
PriceUtil
.
convertPriceFenToYuan
(
auctionRecord
.
getPrice
()));
if
(
lastedRecord
!=
null
&&
lastedRecord
.
getPrice
()
!=
null
)
{
supplierItemVo
.
setCurrentPrice
(
PriceUtil
.
convertPriceFenToYuan
(
lastedRecord
.
getPrice
()));
}
else
{
}
else
{
//没有出价记录最新价格为0
supplierItemVo
.
setCurrentPrice
(
"0"
);
supplierItemVo
.
setCurrentPrice
(
"0"
);
}
}
AuctionConfig
auctionConfig
=
auctionConfigDao
.
findByItemId
(
supplierItem
.
getId
());
AuctionConfig
auctionConfig
=
auctionConfigDao
.
findByItemId
(
supplierItem
.
getId
());
supplierItemVo
.
setRealEndTime
(
auctionConfig
.
getRealEndTime
());
supplierItemVo
.
setRealEndTime
(
auctionConfig
.
getRealEndTime
());
if
(
now
.
before
(
auctionConfig
.
getStartTime
()))
{
supplierItemVo
.
setState
(
DistributionEnum
.
AuctionStateEnum
.
NOT_START
.
getCode
());
supplierItemVo
.
setStateName
(
DistributionEnum
.
AuctionStateEnum
.
NOT_START
.
getDes
());
}
else
if
(
now
.
after
(
auctionConfig
.
getRealEndTime
()))
{
supplierItemVo
.
setState
(
DistributionEnum
.
AuctionStateEnum
.
END
.
getCode
());
supplierItemVo
.
setStateName
(
DistributionEnum
.
AuctionStateEnum
.
END
.
getDes
());
//如果当前时间已经超过截拍时间,并且竞拍配置还未改成无效,则进行修改
if
(
auctionConfig
.
getIsValid
())
{
auctionConfigDao
.
setEnd
(
supplierItem
.
getId
());
}
}
else
{
supplierItemVo
.
setState
(
DistributionEnum
.
AuctionStateEnum
.
IN_AUCTION
.
getCode
());
supplierItemVo
.
setStateName
(
DistributionEnum
.
AuctionStateEnum
.
IN_AUCTION
.
getDes
());
}
}
}
supplierItemVos
.
add
(
supplierItemVo
);
supplierItemVos
.
add
(
supplierItemVo
);
});
});
...
@@ -728,7 +742,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
...
@@ -728,7 +742,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
//查询用户的历史浏览记录
//查询用户的历史浏览记录
List
<
UserRecentBrowse
>
userRecentBrowseList
=
userRecentBrowseDao
.
findByUserId
(
userId
);
List
<
UserRecentBrowse
>
userRecentBrowseList
=
userRecentBrowseDao
.
findByUserId
(
userId
);
//浏览记录是平台商品的
//浏览记录是平台商品的
List
<
Long
>
sharedUserIdList
=
userRecentBrowseList
.
stream
().
filter
(
a
->
a
.
getType
()
==
DistributionEnum
.
UserBrowseTypeEnum
.
PLATFORM_ITEM
.
getCode
()).
map
(
UserRecentBrowse:
:
getSharedUserId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
sharedUserIdList
=
userRecentBrowseList
.
stream
().
map
(
UserRecentBrowse:
:
getSharedUserId
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
sharedUserIdList
))
{
if
(
CollectionUtils
.
isEmpty
(
sharedUserIdList
))
{
sharedUserIdList
.
add
(
sellerId
);
sharedUserIdList
.
add
(
sellerId
);
}
}
...
...
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