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
f0f6ef26
Commit
f0f6ef26
authored
Jul 01, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
一次性订阅新增类
parent
1a017c09
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
500 additions
and
50 deletions
+500
-50
ch-core/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
...ore/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
+5
-0
ch-core/src/main/java/com/wwdz/ch/core/entity/AuctionOfferNoticeMsg.java
...n/java/com/wwdz/ch/core/entity/AuctionOfferNoticeMsg.java
+22
-0
ch-core/src/main/java/com/wwdz/ch/core/impl/SendMsgServiceImpl.java
...c/main/java/com/wwdz/ch/core/impl/SendMsgServiceImpl.java
+58
-17
ch-dao/src/main/java/com/wwdz/ch/db/dao/DisposableSubscribeRecordDao.java
...java/com/wwdz/ch/db/dao/DisposableSubscribeRecordDao.java
+2
-2
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/DisposableSubscribeRecord.java
.../ch/db/domain/distribution/DisposableSubscribeRecord.java
+19
-1
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/DisposableSubscribeRecordExample.java
...domain/distribution/DisposableSubscribeRecordExample.java
+264
-0
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/DisposableSubscribeRecordRequestDto.java
...est/distribution/DisposableSubscribeRecordRequestDto.java
+53
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/DisposableSubscribeRecordDaoImpl.java
...b/impl/distribution/DisposableSubscribeRecordDaoImpl.java
+5
-2
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/DisposableSubscribeRecordMapper.xml
...b/mapper/distribution/DisposableSubscribeRecordMapper.xml
+44
-11
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/api/OfficialAccountCallbackController.java
...com/wwdz/ch/wx/api/OfficialAccountCallbackController.java
+4
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DisposableSubscribeRecordServiceImpl.java
...pl/distribution/DisposableSubscribeRecordServiceImpl.java
+12
-10
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/distribution/DisposableSubscribeRecordService.java
...ervice/distribution/DisposableSubscribeRecordService.java
+9
-3
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/LogisticsApiTest.java
...pi/src/test/java/com/wwdz/ch/wx/api/LogisticsApiTest.java
+2
-2
No files found.
ch-core/src/main/java/com/wwdz/ch/core/consts/CommConsts.java
View file @
f0f6ef26
...
...
@@ -73,4 +73,9 @@ public interface CommConsts {
* 平台收货地址
*/
public
final
static
String
SYSTEM_DEFAULT_ADDRESS
=
"换藏平台,13216703670,浙江省杭州市钱塘区2号大街海聚中心1幢1601"
;
/**
* 消息跳转专场页面
*/
public
final
static
String
SPECIAL_PERFORMANCE_URL
=
"/pages/saleSpecialList/index"
;
}
ch-core/src/main/java/com/wwdz/ch/core/entity/AuctionOfferNoticeMsg.java
View file @
f0f6ef26
...
...
@@ -11,6 +11,28 @@ public class AuctionOfferNoticeMsg implements Entity {
private
String
templetId
;
/**
* 专场id
*/
private
Integer
specialId
;
private
String
specialPerformanceTitle
;
/**
* 专场开始时间
*/
private
String
specialPerformanceStartTime
;
/**
* 专场结束时间
*/
private
String
specialPerformanceEndTime
;
/**
* 专场剩余时间
*/
private
String
specialPerformanceSurplusTime
;
/**
* 分销订单号
*/
...
...
ch-core/src/main/java/com/wwdz/ch/core/impl/SendMsgServiceImpl.java
View file @
f0f6ef26
package
com.wwdz.ch.core.impl
;
import
com.wwdz.ch.core.api.OfficialAccountApi
;
import
com.wwdz.ch.core.consts.CommConsts
;
import
com.wwdz.ch.core.entity.*
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.OkHttpUtil
;
...
...
@@ -607,52 +608,92 @@ public class SendMsgServiceImpl implements SendMsgService {
/**
*
竞拍开始通知
*
专场即将开始订阅消息
* @param auctionOfferNoticeMsg
* @return
*/
public
boolean
send
Auction
StartMsg
(
AuctionOfferNoticeMsg
auctionOfferNoticeMsg
)
{
public
boolean
send
SpecialPerformance
StartMsg
(
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
.
put
(
"template_id"
,
"
AzJht7hkLJHSCN7trT3zsV3TaOE0Xk8faqm2sTf3Pm4
"
);
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
());
StringBuffer
stringBuffer
=
new
StringBuffer
(
CommConsts
.
SPECIAL_PERFORMANCE_URL
);
stringBuffer
.
append
(
"?specialId=="
+
auctionOfferNoticeMsg
.
getSpecialId
());
miniprogramMap
.
put
(
"pagepath"
,
stringBuffer
.
toString
());
map
.
put
(
"miniprogram"
,
miniprogramMap
);
Map
<
String
,
Object
>
paramMap
=
new
LinkedHashMap
<>();
paramMap
.
put
(
"thing2"
,
new
HashMap
()
{{
put
(
"value"
,
auctionOfferNoticeMsg
.
getSpecialPerformanceTitle
());
}});
paramMap
.
put
(
"time4"
,
new
HashMap
()
{{
put
(
"value"
,
auctionOfferNoticeMsg
.
getSpecialPerformanceStartTime
());
}});
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
sendSpecialPerformanceEndMsg
(
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"
,
"G-GwA4yn63RJ6IysFotHB4anctNqbOy5qrz_R6vBJkM"
);
Map
<
String
,
Object
>
miniprogramMap
=
new
HashMap
<>();
miniprogramMap
.
put
(
"appid"
,
APPLET_APPID
);
StringBuffer
stringBuffer
=
new
StringBuffer
(
CommConsts
.
SPECIAL_PERFORMANCE_URL
);
stringBuffer
.
append
(
"?specialId=="
+
auctionOfferNoticeMsg
.
getSpecialId
());
miniprogramMap
.
put
(
"pagepath"
,
stringBuffer
.
toString
());
map
.
put
(
"miniprogram"
,
miniprogramMap
);
Map
<
String
,
Object
>
paramMap
=
new
LinkedHashMap
<>();
paramMap
.
put
(
"thing
1
"
,
new
HashMap
()
{{
put
(
"value"
,
auctionOfferNoticeMsg
.
get
ItemNam
e
());
paramMap
.
put
(
"thing
4
"
,
new
HashMap
()
{{
put
(
"value"
,
auctionOfferNoticeMsg
.
get
SpecialPerformanceTitl
e
());
}});
paramMap
.
put
(
"t
ime2
"
,
new
HashMap
()
{{
put
(
"value"
,
auctionOfferNoticeMsg
.
get
Create
Time
());
paramMap
.
put
(
"t
hing3
"
,
new
HashMap
()
{{
put
(
"value"
,
auctionOfferNoticeMsg
.
get
SpecialPerformanceSurplus
Time
());
}});
paramMap
.
put
(
"time
3
"
,
new
HashMap
()
{{
put
(
"value"
,
auctionOfferNoticeMsg
.
get
Content
());
paramMap
.
put
(
"time
7
"
,
new
HashMap
()
{{
put
(
"value"
,
auctionOfferNoticeMsg
.
get
SpecialPerformanceEndTime
());
}});
map
.
put
(
"data"
,
paramMap
);
logger
.
info
(
"============
竞拍开始通知
内容 : {}"
,
JsonUtils
.
fromMap
(
map
));
logger
.
info
(
"============
专场即将结束订阅消息
内容 : {}"
,
JsonUtils
.
fromMap
(
map
));
okHttpUtil
.
addParams
(
map
);
okHttpUtil
.
post
(
true
);
String
responseStr
=
okHttpUtil
.
async
();
logger
.
info
(
"openid : {}, 发送
竞拍开始通知
response :{}"
,
openId
,
responseStr
);
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
);
logger
.
error
(
"openid : {}, 发送
专场即将结束订阅消息
, errorCode : {}, errmsg : {} "
,
openId
,
errorCode
,
errmsg
);
return
false
;
}
logger
.
info
(
"============= 发送
竞拍开始通知
成功 ==========="
);
logger
.
info
(
"============= 发送
专场即将结束订阅消息
成功 ==========="
);
return
true
;
}
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dao/DisposableSubscribeRecordDao.java
View file @
f0f6ef26
...
...
@@ -16,7 +16,7 @@ public interface DisposableSubscribeRecordDao {
* @param templateId
* @return
*/
boolean
isExisted
(
String
openid
,
String
templateId
);
boolean
isExisted
(
String
openid
,
long
targetId
,
String
templateId
);
/**
* 是否订阅
...
...
@@ -24,7 +24,7 @@ public interface DisposableSubscribeRecordDao {
* @param templateId
* @return
*/
boolean
isSubscribed
(
String
openid
,
String
templateId
);
boolean
isSubscribed
(
String
openid
,
long
targetId
,
String
templateId
);
List
<
DisposableSubscribeRecord
>
findList
(
long
userId
);
}
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/DisposableSubscribeRecord.java
View file @
f0f6ef26
...
...
@@ -10,7 +10,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2024/0
4/07
* @date 2024/0
7/01
*/
@Data
public
class
DisposableSubscribeRecord
implements
Entity
{
...
...
@@ -31,6 +31,11 @@ public class DisposableSubscribeRecord implements Entity {
*/
private
String
templateId
;
/**
* 订阅对象id
*/
private
Long
targetId
;
/**
* 创建时间
*/
...
...
@@ -41,6 +46,11 @@ public class DisposableSubscribeRecord implements Entity {
*/
private
Date
updateTime
;
/**
* 类型
*/
private
Integer
type
;
/**
* 是否有效
*/
...
...
@@ -58,8 +68,10 @@ public class DisposableSubscribeRecord implements Entity {
sb
.
append
(
", userId="
).
append
(
userId
);
sb
.
append
(
", openid="
).
append
(
openid
);
sb
.
append
(
", templateId="
).
append
(
templateId
);
sb
.
append
(
", targetId="
).
append
(
targetId
);
sb
.
append
(
", createTime="
).
append
(
createTime
);
sb
.
append
(
", updateTime="
).
append
(
updateTime
);
sb
.
append
(
", type="
).
append
(
type
);
sb
.
append
(
", isValid="
).
append
(
isValid
);
sb
.
append
(
", serialVersionUID="
).
append
(
serialVersionUID
);
sb
.
append
(
"]"
);
...
...
@@ -82,8 +94,10 @@ public class DisposableSubscribeRecord implements Entity {
&&
(
this
.
getUserId
()
==
null
?
other
.
getUserId
()
==
null
:
this
.
getUserId
().
equals
(
other
.
getUserId
()))
&&
(
this
.
getOpenid
()
==
null
?
other
.
getOpenid
()
==
null
:
this
.
getOpenid
().
equals
(
other
.
getOpenid
()))
&&
(
this
.
getTemplateId
()
==
null
?
other
.
getTemplateId
()
==
null
:
this
.
getTemplateId
().
equals
(
other
.
getTemplateId
()))
&&
(
this
.
getTargetId
()
==
null
?
other
.
getTargetId
()
==
null
:
this
.
getTargetId
().
equals
(
other
.
getTargetId
()))
&&
(
this
.
getCreateTime
()
==
null
?
other
.
getCreateTime
()
==
null
:
this
.
getCreateTime
().
equals
(
other
.
getCreateTime
()))
&&
(
this
.
getUpdateTime
()
==
null
?
other
.
getUpdateTime
()
==
null
:
this
.
getUpdateTime
().
equals
(
other
.
getUpdateTime
()))
&&
(
this
.
getType
()
==
null
?
other
.
getType
()
==
null
:
this
.
getType
().
equals
(
other
.
getType
()))
&&
(
this
.
getIsValid
()
==
null
?
other
.
getIsValid
()
==
null
:
this
.
getIsValid
().
equals
(
other
.
getIsValid
()));
}
...
...
@@ -95,8 +109,10 @@ public class DisposableSubscribeRecord implements Entity {
result
=
prime
*
result
+
((
getUserId
()
==
null
)
?
0
:
getUserId
().
hashCode
());
result
=
prime
*
result
+
((
getOpenid
()
==
null
)
?
0
:
getOpenid
().
hashCode
());
result
=
prime
*
result
+
((
getTemplateId
()
==
null
)
?
0
:
getTemplateId
().
hashCode
());
result
=
prime
*
result
+
((
getTargetId
()
==
null
)
?
0
:
getTargetId
().
hashCode
());
result
=
prime
*
result
+
((
getCreateTime
()
==
null
)
?
0
:
getCreateTime
().
hashCode
());
result
=
prime
*
result
+
((
getUpdateTime
()
==
null
)
?
0
:
getUpdateTime
().
hashCode
());
result
=
prime
*
result
+
((
getType
()
==
null
)
?
0
:
getType
().
hashCode
());
result
=
prime
*
result
+
((
getIsValid
()
==
null
)
?
0
:
getIsValid
().
hashCode
());
return
result
;
}
...
...
@@ -113,8 +129,10 @@ public class DisposableSubscribeRecord implements Entity {
userId
(
"user_id"
,
"userId"
,
"BIGINT"
,
false
),
openid
(
"openid"
,
"openid"
,
"VARCHAR"
,
false
),
templateId
(
"template_id"
,
"templateId"
,
"VARCHAR"
,
false
),
targetId
(
"target_id"
,
"targetId"
,
"BIGINT"
,
false
),
createTime
(
"create_time"
,
"createTime"
,
"TIMESTAMP"
,
false
),
updateTime
(
"update_time"
,
"updateTime"
,
"TIMESTAMP"
,
false
),
type
(
"type"
,
"type"
,
"INTEGER"
,
true
),
isValid
(
"is_valid"
,
"isValid"
,
"BIT"
,
false
);
/**
...
...
ch-dao/src/main/java/com/wwdz/ch/db/domain/distribution/DisposableSubscribeRecordExample.java
View file @
f0f6ef26
This diff is collapsed.
Click to expand it.
ch-dao/src/main/java/com/wwdz/ch/db/dto/request/distribution/DisposableSubscribeRecordRequestDto.java
0 → 100644
View file @
f0f6ef26
package
com.wwdz.ch.db.dto.request.distribution
;
import
com.wwdz.ch.db.dto.request.BaseRequestDto
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
DisposableSubscribeRecordRequestDto
extends
BaseRequestDto
implements
Entity
{
private
Integer
id
;
/**
* 用户id
*/
private
Long
userId
;
/**
* openid
*/
private
String
openid
;
/**
* 模板id
*/
private
String
templateId
;
/**
* 订阅对象id
*/
private
Long
targetId
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
/**
* 类型
*/
private
Integer
type
;
/**
* 是否有效
*/
private
Boolean
isValid
;
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/DisposableSubscribeRecordDaoImpl.java
View file @
f0f6ef26
...
...
@@ -28,25 +28,28 @@ public class DisposableSubscribeRecordDaoImpl implements DisposableSubscribeReco
DisposableSubscribeRecordExample
example
=
new
DisposableSubscribeRecordExample
();
DisposableSubscribeRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andOpenidEqualTo
(
disposableSubscribeRecord
.
getOpenid
());
criteria
.
andTargetIdEqualTo
(
disposableSubscribeRecord
.
getTargetId
());
criteria
.
andTemplateIdEqualTo
(
disposableSubscribeRecord
.
getTemplateId
());
disposableSubscribeRecord
.
setUpdateTime
(
new
Date
());
return
disposableSubscribeRecordMapper
.
updateByExampleSelective
(
disposableSubscribeRecord
,
example
)
>
0
;
}
@Override
public
boolean
isExisted
(
String
openid
,
String
templateId
)
{
public
boolean
isExisted
(
String
openid
,
long
targetId
,
String
templateId
)
{
DisposableSubscribeRecordExample
example
=
new
DisposableSubscribeRecordExample
();
DisposableSubscribeRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andOpenidEqualTo
(
openid
);
criteria
.
andTargetIdEqualTo
(
targetId
);
criteria
.
andTemplateIdEqualTo
(
templateId
);
return
disposableSubscribeRecordMapper
.
countByExample
(
example
)
>
0
;
}
@Override
public
boolean
isSubscribed
(
String
openid
,
String
templateId
)
{
public
boolean
isSubscribed
(
String
openid
,
long
targetId
,
String
templateId
)
{
DisposableSubscribeRecordExample
example
=
new
DisposableSubscribeRecordExample
();
DisposableSubscribeRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andOpenidEqualTo
(
openid
);
criteria
.
andTargetIdEqualTo
(
targetId
);
criteria
.
andTemplateIdEqualTo
(
templateId
);
criteria
.
andIsValidEqualTo
(
true
);
return
disposableSubscribeRecordMapper
.
countByExample
(
example
)
>
0
;
...
...
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/distribution/DisposableSubscribeRecordMapper.xml
View file @
f0f6ef26
...
...
@@ -6,8 +6,10 @@
<result
column=
"user_id"
jdbcType=
"BIGINT"
property=
"userId"
/>
<result
column=
"openid"
jdbcType=
"VARCHAR"
property=
"openid"
/>
<result
column=
"template_id"
jdbcType=
"VARCHAR"
property=
"templateId"
/>
<result
column=
"target_id"
jdbcType=
"BIGINT"
property=
"targetId"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"type"
jdbcType=
"INTEGER"
property=
"type"
/>
<result
column=
"is_valid"
jdbcType=
"BIT"
property=
"isValid"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
...
...
@@ -69,7 +71,7 @@
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id, user_id, openid, template_id,
create_time, update_time
, is_valid
id, user_id, openid, template_id,
target_id, create_time, update_time, `type`
, is_valid
</sql>
<select
id=
"selectByExample"
parameterType=
"com.wwdz.ch.db.domain.distribution.DisposableSubscribeRecordExample"
resultMap=
"BaseResultMap"
>
select
...
...
@@ -98,13 +100,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, user_id, openid, template_id, create_time, update_time, is_valid
id, user_id, openid, template_id, target_id, create_time, update_time, `type`, is_valid
</otherwise>
</choose>
from disposable_subscribe_record
...
...
@@ -129,13 +132,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, user_id, openid, template_id, create_time, update_time, is_valid
id, user_id, openid, template_id, target_id, create_time, update_time, `type`, is_valid
</otherwise>
</choose>
from disposable_subscribe_record
...
...
@@ -156,11 +160,11 @@
SELECT LAST_INSERT_ID()
</selectKey>
insert into disposable_subscribe_record (user_id, openid, template_id,
create_time, update_time, is_valid
)
target_id, create_time, update_time,
`type`, is_valid
)
values (#{userId,jdbcType=BIGINT}, #{openid,jdbcType=VARCHAR}, #{templateId,jdbcType=VARCHAR},
#{
createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isValid,jdbcType=BIT}
)
#{
targetId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{type,jdbcType=INTEGER}, #{isValid,jdbcType=BIT}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.wwdz.ch.db.domain.distribution.DisposableSubscribeRecord"
>
<selectKey
keyProperty=
"id"
order=
"AFTER"
resultType=
"java.lang.Integer"
>
...
...
@@ -177,12 +181,18 @@
<if
test=
"templateId != null"
>
template_id,
</if>
<if
test=
"targetId != null"
>
target_id,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"type != null"
>
`type`,
</if>
<if
test=
"isValid != null"
>
is_valid,
</if>
...
...
@@ -197,12 +207,18 @@
<if
test=
"templateId != null"
>
#{templateId,jdbcType=VARCHAR},
</if>
<if
test=
"targetId != null"
>
#{targetId,jdbcType=BIGINT},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"type != null"
>
#{type,jdbcType=INTEGER},
</if>
<if
test=
"isValid != null"
>
#{isValid,jdbcType=BIT},
</if>
...
...
@@ -229,12 +245,18 @@
<if
test=
"record.templateId != null"
>
template_id = #{record.templateId,jdbcType=VARCHAR},
</if>
<if
test=
"record.targetId != null"
>
target_id = #{record.targetId,jdbcType=BIGINT},
</if>
<if
test=
"record.createTime != null"
>
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"record.updateTime != null"
>
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"record.type != null"
>
`type` = #{record.type,jdbcType=INTEGER},
</if>
<if
test=
"record.isValid != null"
>
is_valid = #{record.isValid,jdbcType=BIT},
</if>
...
...
@@ -249,8 +271,10 @@
user_id = #{record.userId,jdbcType=BIGINT},
openid = #{record.openid,jdbcType=VARCHAR},
template_id = #{record.templateId,jdbcType=VARCHAR},
target_id = #{record.targetId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
`type` = #{record.type,jdbcType=INTEGER},
is_valid = #{record.isValid,jdbcType=BIT}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
...
...
@@ -268,12 +292,18 @@
<if
test=
"templateId != null"
>
template_id = #{templateId,jdbcType=VARCHAR},
</if>
<if
test=
"targetId != null"
>
target_id = #{targetId,jdbcType=BIGINT},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"type != null"
>
`type` = #{type,jdbcType=INTEGER},
</if>
<if
test=
"isValid != null"
>
is_valid = #{isValid,jdbcType=BIT},
</if>
...
...
@@ -285,8 +315,10 @@
set user_id = #{userId,jdbcType=BIGINT},
openid = #{openid,jdbcType=VARCHAR},
template_id = #{templateId,jdbcType=VARCHAR},
target_id = #{targetId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
`type` = #{type,jdbcType=INTEGER},
is_valid = #{isValid,jdbcType=BIT}
where id = #{id,jdbcType=INTEGER}
</update>
...
...
@@ -317,13 +349,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, user_id, openid, template_id, create_time, update_time, is_valid
id, user_id, openid, template_id, target_id, create_time, update_time, `type`, is_valid
</otherwise>
</choose>
from disposable_subscribe_record
...
...
ch-dao/src/main/resources/generatorConfig_new.xml
View file @
f0f6ef26
...
...
@@ -72,7 +72,7 @@
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"com.wwdz.ch.db.mapper.distribution"
targetProject=
"ch-dao/src/main/java"
/>
<table
tableName=
"
special_performance
"
enableCountByExample=
"true"
enableUpdateByExample=
"true"
enableDeleteByExample=
"true"
enableSelectByExample=
"true"
selectByExampleQueryId=
"true"
>
<table
tableName=
"
disposable_subscribe_record
"
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/OfficialAccountCallbackController.java
View file @
f0f6ef26
...
...
@@ -5,6 +5,7 @@ import com.wwdz.ch.core.api.OfficialAccountApi;
import
com.wwdz.ch.core.consts.OfficalAccountEnum
;
import
com.wwdz.ch.core.entity.ConsignSaleSubscribeMsg
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dao.DisposableSubscribeRecordDao
;
import
com.wwdz.ch.db.dao.UserDao
;
import
com.wwdz.ch.db.domain.OfficialAccountSubscribeRecord
;
import
com.wwdz.ch.db.domain.User
;
...
...
@@ -63,6 +64,9 @@ public class OfficialAccountCallbackController {
@Autowired
UserDao
userDao
;
@Autowired
DisposableSubscribeRecordDao
disposableSubscribeRecordDao
;
@RequestMapping
(
value
=
"/getNotice"
)
public
Object
getNotice
(
@RequestParam
(
required
=
false
,
name
=
"signature"
)
String
signature
,
...
...
@@ -132,7 +136,6 @@ public class OfficialAccountCallbackController {
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"微信公众号通知回调接口 error : {}"
,
e
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/DisposableSubscribeRecordServiceImpl.java
View file @
f0f6ef26
...
...
@@ -3,6 +3,7 @@ package com.wwdz.ch.wx.impl.distribution;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dao.DisposableSubscribeRecordDao
;
import
com.wwdz.ch.db.domain.distribution.DisposableSubscribeRecord
;
import
com.wwdz.ch.db.dto.request.distribution.DisposableSubscribeRecordRequestDto
;
import
com.wwdz.ch.wx.service.distribution.DisposableSubscribeRecordService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -20,16 +21,17 @@ public class DisposableSubscribeRecordServiceImpl implements DisposableSubscribe
DisposableSubscribeRecordDao
disposableSubscribeRecordDao
;
@Override
public
Result
insert
(
DisposableSubscribeRecord
disposableSubscribeRecord
)
{
public
Result
subscribed
(
DisposableSubscribeRecordRequestDto
dto
)
{
try
{
Long
userId
=
disposableSubscribeRecord
.
getUserId
();
String
openid
=
disposableSubscribeRecord
.
getOpenid
();
String
templateId
=
disposableSubscribeRecord
.
getTemplateId
();
boolean
isExisted
=
disposableSubscribeRecordDao
.
isExisted
(
openid
,
templateId
);
Long
userId
=
dto
.
getUserId
();
String
openid
=
dto
.
getOpenid
();
String
templateId
=
dto
.
getTemplateId
();
long
targetId
=
dto
.
getTargetId
();
boolean
isExisted
=
disposableSubscribeRecordDao
.
isExisted
(
openid
,
targetId
,
templateId
);
DisposableSubscribeRecord
disposableSubscribeRecord
=
new
DisposableSubscribeRecord
();
disposableSubscribeRecord
.
setIsValid
(
true
);
//如果有历史记录,则做更新
if
(
isExisted
)
{
disposableSubscribeRecordDao
.
update
(
disposableSubscribeRecord
);
}
else
{
if
(!
disposableSubscribeRecordDao
.
isSubscribed
(
openid
,
targetId
,
templateId
))
{
disposableSubscribeRecordDao
.
insert
(
disposableSubscribeRecord
);
}
return
Result
.
success
();
...
...
@@ -46,12 +48,12 @@ public class DisposableSubscribeRecordServiceImpl implements DisposableSubscribe
}
@Override
public
Result
isExisted
(
String
openid
,
String
templateId
)
{
public
Result
isExisted
(
DisposableSubscribeRecordRequestDto
dto
)
{
return
null
;
}
@Override
public
Result
isSubscribed
(
String
openid
,
String
templateId
)
{
public
Result
isSubscribed
(
DisposableSubscribeRecordRequestDto
dto
)
{
return
null
;
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/distribution/DisposableSubscribeRecordService.java
View file @
f0f6ef26
...
...
@@ -2,6 +2,7 @@ package com.wwdz.ch.wx.service.distribution;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.domain.distribution.DisposableSubscribeRecord
;
import
com.wwdz.ch.db.dto.request.distribution.DisposableSubscribeRecordRequestDto
;
import
java.util.List
;
...
...
@@ -10,13 +11,18 @@ import java.util.List;
*/
public
interface
DisposableSubscribeRecordService
{
Result
insert
(
DisposableSubscribeRecord
disposableSubscribeRecord
);
/**
* 用户订阅
* @param dto
* @return
*/
Result
subscribed
(
DisposableSubscribeRecordRequestDto
dto
);
Result
update
(
DisposableSubscribeRecord
disposableSubscribeRecord
);
Result
isExisted
(
String
openid
,
String
templateId
);
Result
isExisted
(
DisposableSubscribeRecordRequestDto
dto
);
Result
isSubscribed
(
String
openid
,
String
templateId
);
Result
isSubscribed
(
DisposableSubscribeRecordRequestDto
dto
);
List
<
DisposableSubscribeRecord
>
findList
(
long
userId
);
}
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/LogisticsApiTest.java
View file @
f0f6ef26
...
...
@@ -25,8 +25,8 @@ public class LogisticsApiTest {
@Test
public
void
findTrails
()
{
LogisticsRequestDto
dto
=
new
LogisticsRequestDto
();
dto
.
setLogisticsCode
(
"Y
TO
"
);
dto
.
setWaybill
(
"
YT1160805180957
"
);
dto
.
setLogisticsCode
(
"Y
D
"
);
dto
.
setWaybill
(
"
312421269717964
"
);
Result
result
=
logisticsApi
.
findTrails
(
dto
);
logger
.
info
(
"物流轨迹: {}"
+
result
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment