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
b52c1d5d
Commit
b52c1d5d
authored
Jan 23, 2025
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订阅消息
parent
1c61d217
Changes
13
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
2630 additions
and
1 deletion
+2630
-1
ch-core/src/main/java/com/wwdz/ch/core/consts/DisposableSubscribeRecordEnum.java
...om/wwdz/ch/core/consts/DisposableSubscribeRecordEnum.java
+3
-0
ch-core/src/main/java/com/wwdz/ch/core/entity/QdSignInNoticeMsg.java
.../main/java/com/wwdz/ch/core/entity/QdSignInNoticeMsg.java
+46
-0
ch-core/src/main/java/com/wwdz/ch/core/service/QdSendMsgService.java
.../main/java/com/wwdz/ch/core/service/QdSendMsgService.java
+19
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/qiandao/QdDisposableSubscribeRecordDao.java
...wdz/ch/db/dao/qiandao/QdDisposableSubscribeRecordDao.java
+40
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/qiandao/QdDisposableSubscribeRecord.java
...wdz/ch/db/domain/qiandao/QdDisposableSubscribeRecord.java
+302
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/qiandao/QdDisposableSubscribeRecordExample.java
...db/domain/qiandao/QdDisposableSubscribeRecordExample.java
+1511
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/qiandao/QdDisposableSubscribeRecordDaoImpl.java
...h/db/impl/qiandao/QdDisposableSubscribeRecordDaoImpl.java
+111
-0
ch-dao/src/main/java/com/wwdz/ch/db/mapper/qiandao/QdDisposableSubscribeRecordMapper.java
.../db/mapper/qiandao/QdDisposableSubscribeRecordMapper.java
+69
-0
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/qiandao/QdDisposableSubscribeRecordMapper.xml
...h/db/mapper/qiandao/QdDisposableSubscribeRecordMapper.xml
+371
-0
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/qiandao/QdDisposableSubscribeRecordServiceImpl.java
.../impl/qiandao/QdDisposableSubscribeRecordServiceImpl.java
+83
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/qiandao/QdDisposableSubscribeRecordService.java
...x/service/qiandao/QdDisposableSubscribeRecordService.java
+27
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/qiandao/QdDisposableSubscribeRecordController.java
...wx/web/qiandao/QdDisposableSubscribeRecordController.java
+47
-0
No files found.
ch-core/src/main/java/com/wwdz/ch/core/consts/DisposableSubscribeRecordEnum.java
View file @
b52c1d5d
...
...
@@ -16,6 +16,9 @@ public class DisposableSubscribeRecordEnum {
GROUPPURASE_CLOSER_TO_SUCCESS
(
5
,
"ekZ3s3OL6ZlWnORvvMOONfWNZsbm6DTlMNyv_2j2ijk"
,
"拼团待成团提醒"
),
GROUPPURASE_RATE
(
6
,
"nmpPtwVrFo261tcRbMvCK8NeAztDnrUubwh-04J4_Ow"
,
"拼团进度提醒"
),
SIGN_IN_REMIND
(
7
,
"bFVaiBLSMYQBfIrDpYZpwuWzh8IriIVhSdZrY0ewlWk"
,
"签到提醒"
),
//乾岛模板
QIANDAO_SIGN_IN
(
30
,
"pRwhVGkfCkwzLYnCMw_Py3Hm74SLYPQUOFSxKXJSDYU"
,
"签到订阅"
),
;
private
int
type
;
...
...
ch-core/src/main/java/com/wwdz/ch/core/entity/QdSignInNoticeMsg.java
0 → 100644
View file @
b52c1d5d
package
com.wwdz.ch.core.entity
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
java.util.Map
;
@Data
public
class
QdSignInNoticeMsg
implements
Entity
,
AbstractSubscribeMsg
{
/**
* 用户id
*/
private
Long
userId
;
/**
* 用户openid
*/
private
String
openId
;
/**
* 打卡任务名称
*/
private
String
taskName
;
/**
* 截止时间
*/
private
String
endTime
;
/**
* 签到天数
*/
private
Long
signInDays
;
@Override
public
Map
<
String
,
Object
>
getTempletParam
()
{
return
null
;
}
@Override
public
String
getTempletId
()
{
return
null
;
}
}
ch-core/src/main/java/com/wwdz/ch/core/service/QdSendMsgService.java
0 → 100644
View file @
b52c1d5d
package
com.wwdz.ch.core.service
;
import
com.wwdz.ch.core.entity.*
;
import
com.wwdz.ch.core.type.Result
;
public
interface
QdSendMsgService
{
/**
* 签到提醒订阅
* @param groupPurchaseNoticeMsg
* @return
*/
Result
sendGroupPurchasecloserToSuccessMsg
(
GroupPurchaseNoticeMsg
groupPurchaseNoticeMsg
);
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/qiandao/QdDisposableSubscribeRecordDao.java
0 → 100644
View file @
b52c1d5d
package
com.wwdz.ch.db.dao.qiandao
;
import
com.wwdz.ch.db.domain.distribution.DisposableSubscribeRecord
;
import
com.wwdz.ch.db.domain.qiandao.QdDisposableSubscribeRecord
;
import
com.wwdz.ch.db.dto.request.distribution.DisposableSubscribeRecordRequestDto
;
import
java.util.List
;
public
interface
QdDisposableSubscribeRecordDao
{
boolean
insert
(
QdDisposableSubscribeRecord
disposableSubscribeRecord
);
boolean
update
(
QdDisposableSubscribeRecord
disposableSubscribeRecord
);
boolean
updateInvalid
(
String
openid
,
long
targetId
,
String
templateId
);
/**
* 是否存在
* @param openid
* @param templateId
* @return
*/
boolean
isExisted
(
String
openid
,
long
targetId
,
String
templateId
);
/**
* 是否订阅
* @param openid
* @param templateId
* @return
*/
boolean
isSubscribed
(
String
openid
,
long
targetId
,
String
templateId
);
boolean
isSubscribed
(
long
userId
,
long
targetId
,
int
type
);
List
<
QdDisposableSubscribeRecord
>
findList
(
DisposableSubscribeRecordRequestDto
dto
);
List
<
QdDisposableSubscribeRecord
>
findValid
(
long
userId
);
}
ch-dao/src/main/java/com/wwdz/ch/db/domain/qiandao/QdDisposableSubscribeRecord.java
0 → 100644
View file @
b52c1d5d
This diff is collapsed.
Click to expand it.
ch-dao/src/main/java/com/wwdz/ch/db/domain/qiandao/QdDisposableSubscribeRecordExample.java
0 → 100644
View file @
b52c1d5d
This diff is collapsed.
Click to expand it.
ch-dao/src/main/java/com/wwdz/ch/db/impl/qiandao/QdDisposableSubscribeRecordDaoImpl.java
0 → 100644
View file @
b52c1d5d
package
com.wwdz.ch.db.impl.qiandao
;
import
com.github.pagehelper.PageHelper
;
import
com.wwdz.ch.db.dao.DisposableSubscribeRecordDao
;
import
com.wwdz.ch.db.dao.qiandao.QdDisposableSubscribeRecordDao
;
import
com.wwdz.ch.db.domain.distribution.DisposableSubscribeRecord
;
import
com.wwdz.ch.db.domain.qiandao.QdDisposableSubscribeRecord
;
import
com.wwdz.ch.db.domain.qiandao.QdDisposableSubscribeRecordExample
;
import
com.wwdz.ch.db.dto.request.distribution.DisposableSubscribeRecordRequestDto
;
import
com.wwdz.ch.db.mapper.distribution.DisposableSubscribeRecordMapper
;
import
com.wwdz.ch.db.mapper.qiandao.QdDisposableSubscribeRecordMapper
;
import
com.xxdxxs.db.component.JdbcHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
java.util.Date
;
import
java.util.List
;
@Repository
public
class
QdDisposableSubscribeRecordDaoImpl
implements
QdDisposableSubscribeRecordDao
{
@Autowired
QdDisposableSubscribeRecordMapper
qdDisposableSubscribeRecordMapper
;
@Override
public
boolean
insert
(
QdDisposableSubscribeRecord
disposableSubscribeRecord
)
{
return
qdDisposableSubscribeRecordMapper
.
insert
(
disposableSubscribeRecord
)
>
0
;
}
@Override
public
boolean
update
(
QdDisposableSubscribeRecord
qdDisposableSubscribeRecord
)
{
QdDisposableSubscribeRecordExample
example
=
new
QdDisposableSubscribeRecordExample
();
QdDisposableSubscribeRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andOpenidEqualTo
(
qdDisposableSubscribeRecord
.
getOpenid
());
criteria
.
andTargetIdEqualTo
(
qdDisposableSubscribeRecord
.
getTargetId
());
criteria
.
andTemplateIdEqualTo
(
qdDisposableSubscribeRecord
.
getTemplateId
());
qdDisposableSubscribeRecord
.
setUpdateTime
(
new
Date
());
return
qdDisposableSubscribeRecordMapper
.
updateByExampleSelective
(
qdDisposableSubscribeRecord
,
example
)
>
0
;
}
@Override
public
boolean
updateInvalid
(
String
openid
,
long
targetId
,
String
templateId
)
{
QdDisposableSubscribeRecordExample
example
=
new
QdDisposableSubscribeRecordExample
();
QdDisposableSubscribeRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andOpenidEqualTo
(
openid
);
criteria
.
andTargetIdEqualTo
(
targetId
);
criteria
.
andTemplateIdEqualTo
(
templateId
);
QdDisposableSubscribeRecord
disposableSubscribeRecord
=
new
QdDisposableSubscribeRecord
();
disposableSubscribeRecord
.
setIsValid
(
false
);
disposableSubscribeRecord
.
setUpdateTime
(
new
Date
());
return
qdDisposableSubscribeRecordMapper
.
updateByExampleSelective
(
disposableSubscribeRecord
,
example
)
>
0
;
}
@Override
public
boolean
isExisted
(
String
openid
,
long
targetId
,
String
templateId
)
{
QdDisposableSubscribeRecordExample
example
=
new
QdDisposableSubscribeRecordExample
();
QdDisposableSubscribeRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andOpenidEqualTo
(
openid
);
criteria
.
andTargetIdEqualTo
(
targetId
);
criteria
.
andTemplateIdEqualTo
(
templateId
);
return
qdDisposableSubscribeRecordMapper
.
countByExample
(
example
)
>
0
;
}
@Override
public
boolean
isSubscribed
(
String
openid
,
long
targetId
,
String
templateId
)
{
QdDisposableSubscribeRecordExample
example
=
new
QdDisposableSubscribeRecordExample
();
QdDisposableSubscribeRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andOpenidEqualTo
(
openid
);
criteria
.
andTargetIdEqualTo
(
targetId
);
criteria
.
andTemplateIdEqualTo
(
templateId
);
criteria
.
andIsValidEqualTo
(
true
);
return
qdDisposableSubscribeRecordMapper
.
countByExample
(
example
)
>
0
;
}
@Override
public
boolean
isSubscribed
(
long
userId
,
long
targetId
,
int
type
)
{
QdDisposableSubscribeRecordExample
example
=
new
QdDisposableSubscribeRecordExample
();
QdDisposableSubscribeRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
criteria
.
andTargetIdEqualTo
(
targetId
);
criteria
.
andTypeEqualTo
(
type
);
criteria
.
andIsValidEqualTo
(
true
);
return
qdDisposableSubscribeRecordMapper
.
countByExample
(
example
)
>
0
;
}
@Override
public
List
<
QdDisposableSubscribeRecord
>
findList
(
DisposableSubscribeRecordRequestDto
dto
)
{
QdDisposableSubscribeRecordExample
example
=
new
QdDisposableSubscribeRecordExample
();
QdDisposableSubscribeRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
JdbcHelper
.
ifPresent
(
dto
.
getUserId
(),
criteria:
:
andUserIdEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getOpenid
(),
criteria:
:
andOpenidEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getTargetId
(),
criteria:
:
andTargetIdEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getTemplateId
(),
criteria:
:
andTemplateIdEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getType
(),
criteria:
:
andTypeEqualTo
);
criteria
.
andIsValidEqualTo
(
true
);
example
.
setOrderByClause
(
"create_time desc"
);
PageHelper
.
startPage
(
dto
.
getPage
(),
dto
.
getLimit
());
return
qdDisposableSubscribeRecordMapper
.
selectByExample
(
example
);
}
@Override
public
List
<
QdDisposableSubscribeRecord
>
findValid
(
long
userId
)
{
QdDisposableSubscribeRecordExample
example
=
new
QdDisposableSubscribeRecordExample
();
QdDisposableSubscribeRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
userId
);
criteria
.
andIsValidEqualTo
(
true
);
return
qdDisposableSubscribeRecordMapper
.
selectByExample
(
example
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/mapper/qiandao/QdDisposableSubscribeRecordMapper.java
0 → 100644
View file @
b52c1d5d
package
com.wwdz.ch.db.mapper.qiandao
;
import
com.wwdz.ch.db.domain.qiandao.QdDisposableSubscribeRecord
;
import
com.wwdz.ch.db.domain.qiandao.QdDisposableSubscribeRecordExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
@Mapper
public
interface
QdDisposableSubscribeRecordMapper
{
long
countByExample
(
QdDisposableSubscribeRecordExample
example
);
int
deleteByExample
(
QdDisposableSubscribeRecordExample
example
);
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
QdDisposableSubscribeRecord
record
);
int
insertSelective
(
QdDisposableSubscribeRecord
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_disposable_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
QdDisposableSubscribeRecord
selectOneByExample
(
QdDisposableSubscribeRecordExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_disposable_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
QdDisposableSubscribeRecord
selectOneByExampleSelective
(
@Param
(
"example"
)
QdDisposableSubscribeRecordExample
example
,
@Param
(
"selective"
)
QdDisposableSubscribeRecord
.
Column
...
selective
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_disposable_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List
<
QdDisposableSubscribeRecord
>
selectByExampleSelective
(
@Param
(
"example"
)
QdDisposableSubscribeRecordExample
example
,
@Param
(
"selective"
)
QdDisposableSubscribeRecord
.
Column
...
selective
);
List
<
QdDisposableSubscribeRecord
>
selectByExample
(
QdDisposableSubscribeRecordExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table qd_disposable_subscribe_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
QdDisposableSubscribeRecord
selectByPrimaryKeySelective
(
@Param
(
"id"
)
Integer
id
,
@Param
(
"selective"
)
QdDisposableSubscribeRecord
.
Column
...
selective
);
QdDisposableSubscribeRecord
selectByPrimaryKey
(
Integer
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
QdDisposableSubscribeRecord
record
,
@Param
(
"example"
)
QdDisposableSubscribeRecordExample
example
);
int
updateByExample
(
@Param
(
"record"
)
QdDisposableSubscribeRecord
record
,
@Param
(
"example"
)
QdDisposableSubscribeRecordExample
example
);
int
updateByPrimaryKeySelective
(
QdDisposableSubscribeRecord
record
);
int
updateByPrimaryKey
(
QdDisposableSubscribeRecord
record
);
}
\ No newline at end of file
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/qiandao/QdDisposableSubscribeRecordMapper.xml
0 → 100644
View file @
b52c1d5d
This diff is collapsed.
Click to expand it.
ch-dao/src/main/resources/generatorConfig_new.xml
View file @
b52c1d5d
...
...
@@ -72,7 +72,7 @@
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"com.wwdz.ch.db.mapper.qiandao"
targetProject=
"ch-dao/src/main/java"
/>
<table
tableName=
"
wx_check
_record"
enableCountByExample=
"true"
enableUpdateByExample=
"true"
enableDeleteByExample=
"true"
enableSelectByExample=
"true"
selectByExampleQueryId=
"true"
>
<table
tableName=
"
qd_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/impl/qiandao/QdDisposableSubscribeRecordServiceImpl.java
0 → 100644
View file @
b52c1d5d
package
com.wwdz.ch.wx.impl.qiandao
;
import
com.wwdz.ch.core.consts.DisposableSubscribeRecordEnum
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dao.qiandao.QdDisposableSubscribeRecordDao
;
import
com.wwdz.ch.db.dao.qiandao.QdUserDao
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.domain.distribution.DisposableSubscribeRecord
;
import
com.wwdz.ch.db.domain.qiandao.QdDisposableSubscribeRecord
;
import
com.wwdz.ch.db.domain.qiandao.QdUser
;
import
com.wwdz.ch.db.dto.request.distribution.DisposableSubscribeRecordRequestDto
;
import
com.wwdz.ch.wx.service.qiandao.QdDisposableSubscribeRecordService
;
import
com.xxdxxs.utils.EntityMapper
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
@Service
public
class
QdDisposableSubscribeRecordServiceImpl
implements
QdDisposableSubscribeRecordService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
QdDisposableSubscribeRecordServiceImpl
.
class
);
@Autowired
QdDisposableSubscribeRecordDao
qdDisposableSubscribeRecordDao
;
@Autowired
QdUserDao
qdUserDao
;
@Override
public
Result
subscribe
(
DisposableSubscribeRecordRequestDto
dto
)
{
try
{
long
userId
=
dto
.
getUserId
();
QdUser
user
=
qdUserDao
.
queryById
(
userId
);
String
openid
=
user
.
getWxOpenid
();
String
templateId
=
dto
.
getTemplateId
();
long
targetId
=
dto
.
getTargetId
();
QdDisposableSubscribeRecord
disposableSubscribeRecord
=
new
QdDisposableSubscribeRecord
();
EntityMapper
.
copyAttribute
(
dto
,
disposableSubscribeRecord
);
disposableSubscribeRecord
.
setType
(
DisposableSubscribeRecordEnum
.
TypeEnum
.
getTypeByTemplateId
(
templateId
));
//签到消息订阅,targetId前端固定传0
disposableSubscribeRecord
.
setOpenid
(
openid
);
disposableSubscribeRecord
.
setIsValid
(
true
);
disposableSubscribeRecord
.
setCreateTime
(
new
Date
());
disposableSubscribeRecord
.
setUpdateTime
(
new
Date
());
//没订阅过就新增数据
if
(!
qdDisposableSubscribeRecordDao
.
isSubscribed
(
openid
,
targetId
,
templateId
))
{
qdDisposableSubscribeRecordDao
.
insert
(
disposableSubscribeRecord
);
}
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"保存一次性订阅消息记录 error: {}"
,
e
);
}
return
Result
.
failed
();
}
@Override
public
Result
update
(
QdDisposableSubscribeRecord
disposableSubscribeRecord
)
{
try
{
qdDisposableSubscribeRecordDao
.
update
(
disposableSubscribeRecord
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"更新订阅记录 error: {}"
,
e
);
}
return
Result
.
failed
();
}
@Override
public
Result
isSubscribed
(
DisposableSubscribeRecordRequestDto
dto
)
{
return
null
;
}
@Override
public
List
<
QdDisposableSubscribeRecord
>
findList
(
long
userId
)
{
return
null
;
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/qiandao/QdDisposableSubscribeRecordService.java
0 → 100644
View file @
b52c1d5d
package
com.wwdz.ch.wx.service.qiandao
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.domain.distribution.DisposableSubscribeRecord
;
import
com.wwdz.ch.db.domain.qiandao.QdDisposableSubscribeRecord
;
import
com.wwdz.ch.db.dto.request.distribution.DisposableSubscribeRecordRequestDto
;
import
java.util.List
;
/**
* 小程序一次性订阅消息
*/
public
interface
QdDisposableSubscribeRecordService
{
/**
* 用户订阅
* @param dto
* @return
*/
Result
subscribe
(
DisposableSubscribeRecordRequestDto
dto
);
Result
update
(
QdDisposableSubscribeRecord
disposableSubscribeRecord
);
Result
isSubscribed
(
DisposableSubscribeRecordRequestDto
dto
);
List
<
QdDisposableSubscribeRecord
>
findList
(
long
userId
);
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/qiandao/QdDisposableSubscribeRecordController.java
0 → 100644
View file @
b52c1d5d
package
com.wwdz.ch.wx.web.qiandao
;
import
com.alibaba.fastjson.JSON
;
import
com.wwdz.ch.core.consts.CommConsts
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dto.request.distribution.DisposableSubscribeRecordRequestDto
;
import
com.wwdz.ch.wx.service.qiandao.QdDisposableSubscribeRecordService
;
import
com.wwdz.ch.wx.web.distribution.DistributionOrderController
;
import
com.xxdxxs.service.FormHandler
;
import
com.xxdxxs.validation.Validator
;
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/qdDisposableSubscribeRecord"
)
public
class
QdDisposableSubscribeRecordController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DistributionOrderController
.
class
);
@Autowired
QdDisposableSubscribeRecordService
qdDisposableSubscribeRecordService
;
@ApiOperation
(
value
=
"小程序用户订阅消息"
)
@PostMapping
(
"/subscribe"
)
public
Result
subscribe
(
@RequestBody
DisposableSubscribeRecordRequestDto
dto
)
{
logger
.
info
(
"小程序用户订阅消息,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
if
(
dto
.
getUserId
()
==
null
)
{
dto
.
setUserId
(
CommConsts
.
SYSTEM_ACCOUNT_FOR_UNLOGIN
);
}
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"userId"
,
"用户id"
).
must
().
number
()
.
set
(
"templateId"
,
"模板id"
).
must
().
string
()
.
set
(
"targetId"
,
"订阅对象id"
).
must
().
number
()
.
end
();
if
(!
validator
.
isValid
())
{
return
Result
.
failed
(
validator
.
getErrorInfo
());
}
return
qdDisposableSubscribeRecordService
.
subscribe
(
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