Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐少华
midjourney-proxy
Commits
67cb4c89
Commit
67cb4c89
authored
Feb 11, 2020
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1002291代码提交
parent
ef6a2592
Show whitespace changes
Inline
Side-by-side
Showing
100 changed files
with
6800 additions
and
129 deletions
+6800
-129
BookTaskBindingDto.java
...a/com/pcloud/book/timecontrol/dto/BookTaskBindingDto.java
+46
-0
CreateReplyMessageDto.java
...om/pcloud/book/timecontrol/dto/CreateReplyMessageDto.java
+42
-0
CreateTaskDto.java
...n/java/com/pcloud/book/timecontrol/dto/CreateTaskDto.java
+38
-0
CreateTaskItemDto.java
...va/com/pcloud/book/timecontrol/dto/CreateTaskItemDto.java
+38
-0
LabelDto.java
...c/main/java/com/pcloud/book/timecontrol/dto/LabelDto.java
+18
-0
ReplyMessageBaseDto.java
.../com/pcloud/book/timecontrol/dto/ReplyMessageBaseDto.java
+22
-0
ReplyMessageDto.java
...java/com/pcloud/book/timecontrol/dto/ReplyMessageDto.java
+37
-0
TaskDto.java
...rc/main/java/com/pcloud/book/timecontrol/dto/TaskDto.java
+52
-0
TaskItemDto.java
...ain/java/com/pcloud/book/timecontrol/dto/TaskItemDto.java
+42
-0
TaskSendDto.java
...ain/java/com/pcloud/book/timecontrol/dto/TaskSendDto.java
+27
-0
UpdateTaskDto.java
...n/java/com/pcloud/book/timecontrol/dto/UpdateTaskDto.java
+38
-0
UpdateTaskItemDto.java
...va/com/pcloud/book/timecontrol/dto/UpdateTaskItemDto.java
+39
-0
TaskSendStateEnum.java
.../com/pcloud/book/timecontrol/enums/TaskSendStateEnum.java
+28
-0
TaskSubscribeStateEnum.java
...pcloud/book/timecontrol/enums/TaskSubscribeStateEnum.java
+28
-0
TimeControlTaskService.java
...loud/book/timecontrol/service/TimeControlTaskService.java
+65
-0
ProductConsr.java
.../java/com/pcloud/book/consumer/resource/ProductConsr.java
+16
-0
GroupQrcodeBiz.java
...c/main/java/com/pcloud/book/group/biz/GroupQrcodeBiz.java
+1
-1
GroupQrcodeBizImpl.java
...va/com/pcloud/book/group/biz/impl/GroupQrcodeBizImpl.java
+14
-2
GroupQrcodeFacadeImpl.java
.../pcloud/book/group/facade/impl/GroupQrcodeFacadeImpl.java
+3
-1
PushBookGroupUpdateHandler.java
...pcloud/book/group/handler/PushBookGroupUpdateHandler.java
+67
-67
PushBookGroupUpdateRunner.java
.../pcloud/book/group/handler/PushBookGroupUpdateRunner.java
+54
-0
ListGroupQrcodeResponseVO.java
...a/com/pcloud/book/group/vo/ListGroupQrcodeResponseVO.java
+10
-0
SelfRobotKeywordBiz.java
...ava/com/pcloud/book/keywords/biz/SelfRobotKeywordBiz.java
+7
-1
SelfRobotKeywordBizImpl.java
...cloud/book/keywords/biz/impl/SelfRobotKeywordBizImpl.java
+164
-40
RobotSkill4H5.java
...n/java/com/pcloud/book/keywords/entity/RobotSkill4H5.java
+44
-0
RobotSkillDetail.java
...ava/com/pcloud/book/keywords/entity/RobotSkillDetail.java
+44
-0
SelfRobotKeywordFacade.java
...m/pcloud/book/keywords/facade/SelfRobotKeywordFacade.java
+13
-2
SelfRobotKeywordFacadeImpl.java
...book/keywords/facade/impl/SelfRobotKeywordFacadeImpl.java
+19
-2
PcloudRobot.java
...ava/com/pcloud/book/pcloudkeyword/entity/PcloudRobot.java
+3
-0
SelfPushBizImpl.java
...n/java/com/pcloud/book/push/biz/impl/SelfPushBizImpl.java
+3
-13
PcloudGroupActivityBiz.java
...ava/com/pcloud/book/skill/biz/PcloudGroupActivityBiz.java
+38
-0
PcloudResourceBiz.java
...ain/java/com/pcloud/book/skill/biz/PcloudResourceBiz.java
+18
-0
PcloudSkillBiz.java
...c/main/java/com/pcloud/book/skill/biz/PcloudSkillBiz.java
+22
-0
PcloudGroupActivityBizImpl.java
...cloud/book/skill/biz/impl/PcloudGroupActivityBizImpl.java
+131
-0
PcloudResourceBizImpl.java
...com/pcloud/book/skill/biz/impl/PcloudResourceBizImpl.java
+123
-0
PcloudSkillBizImpl.java
...va/com/pcloud/book/skill/biz/impl/PcloudSkillBizImpl.java
+424
-0
PcloudSkillCheck.java
...in/java/com/pcloud/book/skill/check/PcloudSkillCheck.java
+71
-0
PcloudGroupActivityDao.java
...ava/com/pcloud/book/skill/dao/PcloudGroupActivityDao.java
+14
-0
PcloudResourceDao.java
...ain/java/com/pcloud/book/skill/dao/PcloudResourceDao.java
+16
-0
PcloudSkillDao.java
...c/main/java/com/pcloud/book/skill/dao/PcloudSkillDao.java
+31
-0
PcloudSkillGuideDao.java
...n/java/com/pcloud/book/skill/dao/PcloudSkillGuideDao.java
+17
-0
PcloudSubReplyDao.java
...ain/java/com/pcloud/book/skill/dao/PcloudSubReplyDao.java
+19
-0
PcloudGroupActivityDaoImpl.java
...cloud/book/skill/dao/impl/PcloudGroupActivityDaoImpl.java
+25
-0
PcloudResourceDaoImpl.java
...com/pcloud/book/skill/dao/impl/PcloudResourceDaoImpl.java
+29
-0
PcloudSkillDaoImpl.java
...va/com/pcloud/book/skill/dao/impl/PcloudSkillDaoImpl.java
+80
-0
PcloudSkillGuideDaoImpl.java
...m/pcloud/book/skill/dao/impl/PcloudSkillGuideDaoImpl.java
+35
-0
PcloudSubReplyDaoImpl.java
...com/pcloud/book/skill/dao/impl/PcloudSubReplyDaoImpl.java
+43
-0
PcloudGroupActivity.java
...ava/com/pcloud/book/skill/entity/PcloudGroupActivity.java
+129
-0
PcloudResource.java
...ain/java/com/pcloud/book/skill/entity/PcloudResource.java
+35
-0
PcloudResourceItem.java
...java/com/pcloud/book/skill/entity/PcloudResourceItem.java
+24
-0
PcloudSkill.java
...c/main/java/com/pcloud/book/skill/entity/PcloudSkill.java
+38
-0
PcloudSkillGuide.java
...n/java/com/pcloud/book/skill/entity/PcloudSkillGuide.java
+21
-0
PcloudSubReply.java
...ain/java/com/pcloud/book/skill/entity/PcloudSubReply.java
+84
-0
SkillTypeEnum.java
.../main/java/com/pcloud/book/skill/enums/SkillTypeEnum.java
+39
-0
SubTypeEnum.java
...rc/main/java/com/pcloud/book/skill/enums/SubTypeEnum.java
+23
-0
PcloudGroupActivityFacade.java
...m/pcloud/book/skill/facade/PcloudGroupActivityFacade.java
+66
-0
PcloudResourceFacade.java
...va/com/pcloud/book/skill/facade/PcloudResourceFacade.java
+79
-0
PcloudSkillFacade.java
.../java/com/pcloud/book/skill/facade/PcloudSkillFacade.java
+99
-0
QueryGroupActivityRequestVO.java
...ook/skill/facade/request/QueryGroupActivityRequestVO.java
+17
-0
SaveGroupActivityRequestVO.java
...book/skill/facade/request/SaveGroupActivityRequestVO.java
+70
-0
SaveResourceRequestVO.java
...loud/book/skill/facade/request/SaveResourceRequestVO.java
+33
-0
UpdateGroupActivityRequestVO.java
...ok/skill/facade/request/UpdateGroupActivityRequestVO.java
+70
-0
QueryGroupActivityResponseVO.java
...k/skill/facade/response/QueryGroupActivityResponseVO.java
+48
-0
QueryPcloudResponseVO.java
...oud/book/skill/facade/response/QueryPcloudResponseVO.java
+38
-0
BookTaskBindingBiz.java
...a/com/pcloud/book/timecontrol/biz/BookTaskBindingBiz.java
+37
-0
TaskBiz.java
...rc/main/java/com/pcloud/book/timecontrol/biz/TaskBiz.java
+62
-0
TaskSubscribeBiz.java
...ava/com/pcloud/book/timecontrol/biz/TaskSubscribeBiz.java
+34
-0
BookTaskBindingBizImpl.java
...oud/book/timecontrol/biz/impl/BookTaskBindingBizImpl.java
+151
-0
TaskBizImpl.java
...ava/com/pcloud/book/timecontrol/biz/impl/TaskBizImpl.java
+517
-0
TaskSubscribeBizImpl.java
...cloud/book/timecontrol/biz/impl/TaskSubscribeBizImpl.java
+493
-0
BookTaskBinding.java
...a/com/pcloud/book/timecontrol/entity/BookTaskBinding.java
+33
-0
TimeControlReplyMessage.java
...loud/book/timecontrol/entity/TimeControlReplyMessage.java
+51
-0
TimeControlTask.java
...a/com/pcloud/book/timecontrol/entity/TimeControlTask.java
+36
-0
TimeControlTaskItem.java
...m/pcloud/book/timecontrol/entity/TimeControlTaskItem.java
+106
-0
TimeControlTaskSend.java
...m/pcloud/book/timecontrol/entity/TimeControlTaskSend.java
+35
-0
TimeControlTaskSubscribe.java
...oud/book/timecontrol/entity/TimeControlTaskSubscribe.java
+31
-0
BookTaskBindingFacade.java
...d/book/timecontrol/facade/impl/BookTaskBindingFacade.java
+89
-0
TimeControlTaskFacadeImpl.java
...ok/timecontrol/facade/impl/TimeControlTaskFacadeImpl.java
+165
-0
BookTaskBindingMapper.java
...pcloud/book/timecontrol/mapper/BookTaskBindingMapper.java
+60
-0
TimeControlReplyMessageMapper.java
...ook/timecontrol/mapper/TimeControlReplyMessageMapper.java
+32
-0
TimeControlTaskItemMapper.java
...ud/book/timecontrol/mapper/TimeControlTaskItemMapper.java
+26
-0
TimeControlTaskMapper.java
...pcloud/book/timecontrol/mapper/TimeControlTaskMapper.java
+56
-0
TimeControlTaskSendMapper.java
...ud/book/timecontrol/mapper/TimeControlTaskSendMapper.java
+43
-0
TimeControlTaskSubscribeMapper.java
...ok/timecontrol/mapper/TimeControlTaskSubscribeMapper.java
+35
-0
TimeControlTaskServiceImpl.java
.../timecontrol/service/impl/TimeControlTaskServiceImpl.java
+97
-0
BookTaskBindingAddVO.java
.../com/pcloud/book/timecontrol/vo/BookTaskBindingAddVO.java
+14
-0
BookTaskBindingVO.java
...ava/com/pcloud/book/timecontrol/vo/BookTaskBindingVO.java
+46
-0
KeyWordTaskVO.java
...in/java/com/pcloud/book/timecontrol/vo/KeyWordTaskVO.java
+32
-0
GroupQrcode.Mapper.xml
...ok/src/main/resources/mapper/group/GroupQrcode.Mapper.xml
+9
-0
PcloudGroupActivityDao.xml
...rc/main/resources/mapper/skill/PcloudGroupActivityDao.xml
+153
-0
PcloudResourceDao.xml
...ook/src/main/resources/mapper/skill/PcloudResourceDao.xml
+110
-0
PcloudSkilll.xml
...ice-book/src/main/resources/mapper/skill/PcloudSkilll.xml
+195
-0
PcloudSkilllGuide.xml
...ook/src/main/resources/mapper/skill/PcloudSkilllGuide.xml
+71
-0
PcloudSubReply.xml
...e-book/src/main/resources/mapper/skill/PcloudSubReply.xml
+116
-0
BookTaskBindingMapper.xml
...in/resources/mapper/timecontrol/BookTaskBindingMapper.xml
+255
-0
TimeControlReplyMessageMapper.xml
...rces/mapper/timecontrol/TimeControlReplyMessageMapper.xml
+80
-0
TimeControlTaskItemMapper.xml
...esources/mapper/timecontrol/TimeControlTaskItemMapper.xml
+65
-0
TimeControlTaskMapper.xml
...in/resources/mapper/timecontrol/TimeControlTaskMapper.xml
+237
-0
TimeControlTaskSendMapper.xml
...esources/mapper/timecontrol/TimeControlTaskSendMapper.xml
+94
-0
TimeControlTaskSubscribeMapper.xml
...ces/mapper/timecontrol/TimeControlTaskSubscribeMapper.xml
+63
-0
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/BookTaskBindingDto.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
BookTaskBindingDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
7515841010418305282L
;
private
Integer
id
;
private
Integer
taskId
;
private
String
taskName
;
private
Integer
bookId
;
private
String
bookName
;
private
String
isbn
;
private
String
serialNumber
;
private
Integer
state
;
private
Long
proLabelId
;
private
String
proLabelName
;
private
Long
depLabelId
;
private
String
depLabelName
;
private
Long
purLabelId
;
private
String
purLabelName
;
private
Integer
taskCount
;
private
Integer
preSendCount
;
private
Integer
hasSentCount
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/CreateReplyMessageDto.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* @date: 2020年01月31日 9:50
* @Author: Zcy
* @Descprition
*/
@Data
public
class
CreateReplyMessageDto
implements
Serializable
{
private
String
messageType
;
private
String
text
;
private
Integer
appId
;
private
Integer
productId
;
private
String
imgUrl
;
private
String
fileName
;
private
String
fileUrl
;
private
String
linkUrl
;
/**
* 回复类型 0 普通回复 1 完成任务确认回复
*/
private
Integer
replyType
;
private
String
fileId
;
private
String
fileType
;
private
BigDecimal
size
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/CreateTaskDto.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
lombok.Builder
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
java.io.Serializable
;
/**
* @date: 2020年01月30日 14:08
* @Author: Zcy
* @Descprition 时间管理任务模板创建
*/
@Builder
@Data
public
class
CreateTaskDto
implements
Serializable
{
@NotNull
(
message
=
"任务名称不能为空"
)
@Size
(
max
=
20
)
private
String
taskName
;
@Size
(
max
=
300
)
@NotNull
(
message
=
"任务引导语不能为空"
)
private
String
taskIntroduce
;
@Size
(
max
=
20
)
@NotNull
(
message
=
"订阅方式不能为空"
)
private
String
subscribeWord
;
private
Integer
advancedSetting
;
private
Long
depLabelId
;
private
Long
purLabelId
;
private
Long
proLabelId
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/CreateTaskItemDto.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
lombok.Data
;
import
javax.validation.constraints.Max
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @date: 2020年01月30日 18:24
* @Author: Zcy
* @Descprition 任务配置
*/
@Data
public
class
CreateTaskItemDto
implements
Serializable
{
@NotNull
(
message
=
"任务ID不能为空"
)
private
Integer
taskId
;
@NotNull
(
message
=
"请输入天数"
)
@Max
(
value
=
200
)
private
Integer
startDay
;
private
Integer
finishConfirm
;
private
String
finishKeyWord
;
List
<
CreateReplyMessageDto
>
replyMessageList
;
private
Integer
tdConfirm
;
private
String
finishLinkIntroduce
;
private
String
finishLinkUrl
;
List
<
CreateReplyMessageDto
>
completedReplyMessageList
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/LabelDto.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @date: 2020年02月04日 17:32
* @Author: Zcy
* @Descprition
*/
@Data
public
class
LabelDto
implements
Serializable
{
private
Long
depLabelId
;
private
String
depLabelName
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/ReplyMessageBaseDto.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Description:TODO
* @Author:zcy
* @Date:2020-01-31
* @Version:1.0
*/
@Data
public
class
ReplyMessageBaseDto
implements
Serializable
{
private
Integer
id
;
private
Integer
taskId
;
private
Integer
startDay
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/ReplyMessageDto.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* @date: 2020年01月31日 9:50
* @Author: Zcy
* @Descprition
*/
@Data
public
class
ReplyMessageDto
implements
Serializable
{
private
String
messageType
;
private
String
text
;
private
Integer
appId
;
private
Integer
productId
;
private
String
imgUrl
;
private
String
fileName
;
private
String
fileUrl
;
private
String
linkUrl
;
private
String
fileId
;
private
String
fileType
;
private
BigDecimal
size
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/TaskDto.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @date: 2020年01月30日 15:20
* @Author: Zcy
* @Descprition
*/
@Data
public
class
TaskDto
implements
Serializable
{
private
Integer
taskId
;
private
String
taskName
;
private
String
taskIntroduce
;
private
String
taskKeyWord
;
private
String
subscribeWord
;
private
Integer
advancedSetting
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
private
Integer
taskItemCount
;
private
Long
depLabelId
;
private
Long
purLabelId
;
private
Long
proLabelId
;
private
String
successSubscribeWord
;
private
String
successUnSubscribeWord
;
private
Integer
subscribeState
;
private
String
proLabelName
;
private
String
depLabelName
;
private
String
purLabelName
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/TaskItemDto.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* @Description:TODO
* @Author:zcy
* @Date:2020-01-31
* @Version:1.0
*/
@Data
public
class
TaskItemDto
implements
Serializable
{
private
Integer
id
;
private
Integer
taskId
;
private
Integer
startDay
;
private
Integer
finishConfirm
;
private
String
finishKeyWord
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
private
List
<
ReplyMessageDto
>
replyMessageList
;
private
Integer
tdConfirm
;
private
String
finishLinkIntroduce
;
private
String
finishLinkUrl
;
List
<
ReplyMessageDto
>
completedReplyMessageList
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/TaskSendDto.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @date: 2020年02月01日 21:04
* @Author: lihao
* @Descprition
*/
@Data
public
class
TaskSendDto
implements
Serializable
{
private
Integer
id
;
private
String
robotWxId
;
private
String
wxUserId
;
private
Integer
taskId
;
private
Integer
taskItemId
;
private
Integer
completeState
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/UpdateTaskDto.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
java.io.Serializable
;
/**
* @Description:TODO
* @Author:zcy
* @Date:2020-01-30
* @Version:1.0
*/
@Data
public
class
UpdateTaskDto
implements
Serializable
{
@NotNull
(
message
=
"任务ID缺失"
)
private
Integer
taskId
;
@NotNull
(
message
=
"任务名称不能为空"
)
@Size
(
max
=
20
)
private
String
taskName
;
@Size
(
max
=
300
)
@NotNull
(
message
=
"任务引导语不能为空"
)
private
String
taskIntroduce
;
@Size
(
max
=
20
)
@NotNull
(
message
=
"订阅方式不能为空"
)
private
String
subscribeWord
;
private
Integer
advancedSetting
;
private
Long
depLabelId
;
private
Long
purLabelId
;
private
Long
proLabelId
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/UpdateTaskItemDto.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
lombok.Data
;
import
javax.validation.constraints.Max
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @date: 2020年01月30日 18:24
* @Author: Zcy
* @Descprition 任务配置
*/
@Data
public
class
UpdateTaskItemDto
implements
Serializable
{
@NotNull
(
message
=
"消息配置ID不能为空"
)
private
Integer
id
;
@NotNull
(
message
=
"请输入天数"
)
@Max
(
value
=
200
)
private
Integer
startDay
;
private
Integer
finishConfirm
;
private
String
finishKeyWord
;
List
<
CreateReplyMessageDto
>
replyMessageList
;
private
Integer
tdConfirm
;
private
String
finishLinkIntroduce
;
private
String
finishLinkUrl
;
List
<
CreateReplyMessageDto
>
completedReplyMessageList
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/enums/TaskSendStateEnum.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
enums
;
public
enum
TaskSendStateEnum
{
WAIT_SEND
(
0
,
"待发送"
),
FINISH_SEND
(
1
,
"已发送"
),
CANCEL
(
2
,
"已取消"
);
public
Integer
state
;
public
String
desc
;
public
Integer
getState
()
{
return
state
;
}
public
void
setState
(
Integer
state
)
{
this
.
state
=
state
;
}
TaskSendStateEnum
(
Integer
state
,
String
desc
)
{
this
.
state
=
state
;
this
.
desc
=
desc
;
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/enums/TaskSubscribeStateEnum.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
enums
;
public
enum
TaskSubscribeStateEnum
{
UNSUBSCRIBE
(
0
,
"取消订阅"
),
SUBSCRIBE
(
1
,
"订阅"
),
FINISH
(
2
,
"完成"
);
public
Integer
state
;
public
String
desc
;
public
Integer
getState
()
{
return
state
;
}
public
void
setState
(
Integer
state
)
{
this
.
state
=
state
;
}
TaskSubscribeStateEnum
(
Integer
state
,
String
desc
)
{
this
.
state
=
state
;
this
.
desc
=
desc
;
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/service/TimeControlTaskService.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
service
;
import
com.pcloud.book.timecontrol.dto.BookTaskBindingDto
;
import
com.pcloud.book.timecontrol.dto.LabelDto
;
import
com.pcloud.book.timecontrol.dto.TaskDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Description:TODO
* @Author:zcy
* @Date:2020-01-30
* @Version:1.0
*/
@FeignClient
(
value
=
"pcloud-service-wechatgroup"
,
qualifier
=
"timeControlTaskServiceCloud"
,
path
=
"/wechatgroup/v1.0/timeControlTaskService"
)
@Api
(
description
=
"时间管理内部接口"
)
public
interface
TimeControlTaskService
{
@ApiOperation
(
value
=
"定时发送任务消息"
,
httpMethod
=
"GET"
)
@GetMapping
(
"sendTimeTaskMessage"
)
void
sendTimeTaskMessage
();
@ApiOperation
(
value
=
"获取任务信息"
)
@GetMapping
(
"getTaskById"
)
ResponseEntity
<
ResponseDto
<
TaskDto
>>
getTaskById
(
@RequestParam
(
value
=
"taskId"
)
Integer
taskId
);
@ApiOperation
(
"获取任务列表"
)
@GetMapping
(
"listTask"
)
ResponseEntity
<
ResponseDto
<
List
<
BookTaskBindingDto
>>>
listTask
(
@RequestParam
(
value
=
"search"
,
required
=
false
)
String
search
);
@ApiOperation
(
value
=
"批量获取任务信息"
,
httpMethod
=
"POST"
)
@PostMapping
(
"getTaskBatch"
)
ResponseEntity
<
ResponseDto
<
Map
<
Integer
,
TaskDto
>>>
getTaskBatch
(
@RequestBody
List
<
Integer
>
taskIds
);
@ApiOperation
(
value
=
"获取最多的几个深度标签"
,
httpMethod
=
"GET"
)
@GetMapping
(
"listMaxDepLabel"
)
ResponseEntity
<
ResponseDto
<
List
<
LabelDto
>>>
listMaxDepLabel
(
@RequestParam
(
value
=
"num"
,
required
=
false
)
Integer
num
);
@ApiOperation
(
value
=
"用户通过关键词查找任务列表"
,
httpMethod
=
"GET"
)
@GetMapping
(
"listTaskByKey4User"
)
ResponseEntity
<
ResponseDto
<
List
<
TaskDto
>>>
listTaskByKey4User
(
@RequestParam
(
"wxUserId"
)
String
wxUserId
,
@RequestParam
(
"search"
)
String
search
);
@ApiOperation
(
value
=
"用户通过taskIds获取任务列表"
,
httpMethod
=
"POST"
)
@PostMapping
(
"listTaskByIds4User"
)
ResponseEntity
<
ResponseDto
<
List
<
TaskDto
>>>
listTaskByIds4User
(
@RequestParam
(
"wxUserId"
)
String
wxUserId
,
@RequestBody
List
<
Integer
>
taskIds
);
@ApiOperation
(
value
=
"用户通过标签获取任务列表"
,
httpMethod
=
"GET"
)
@GetMapping
(
"listTaskByLabelIds4User"
)
ResponseEntity
<
ResponseDto
<
List
<
TaskDto
>>>
listTaskByLabelIds4User
(
@RequestParam
(
"wxUserId"
)
String
wxUserId
,
@RequestParam
(
value
=
"labelId"
)
Long
labelId
);
@ApiOperation
(
value
=
"订阅任务"
)
@GetMapping
(
"unSubscribeTask"
)
void
unSubscribeTask
(
@RequestParam
(
"wxId"
)
String
wxId
,
@RequestParam
(
"taskId"
)
Integer
taskId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/consumer/resource/ProductConsr.java
View file @
67cb4c89
...
...
@@ -251,4 +251,20 @@ public class ProductConsr {
}
}
public
Long
getOneChannelIdByProId
(
Long
productId
)
throws
BizException
{
LOGGER
.
info
(
"【资源中心(消)】获取作品已上架的某个运营平台,<START>.[productId]="
+
productId
+
"]"
);
if
(
productId
==
null
)
{
return
null
;
}
try
{
return
ResponseHandleUtil
.
parseResponse
(
productService
.
getOneChannelIdByProId
(
productId
),
Long
.
class
);
}
catch
(
BizException
e
)
{
LOGGER
.
warn
(
"【资源中心(消)】获取作品已上架的某个运营平台失败:"
+
e
.
getMessage
(),
e
);
throw
new
BizException
(
e
.
getCode
(),
e
.
getMessage
());
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【资源中心(消)】获取作品已上架的某个运营平台.[getOneChannelIdByProId]:"
+
e
.
getMessage
(),
e
);
throw
new
BookBizException
(
BookBizException
.
INVOKE_RES_ERROR
,
"服务内部错误,请稍后重试"
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/GroupQrcodeBiz.java
View file @
67cb4c89
...
...
@@ -55,7 +55,7 @@ public interface GroupQrcodeBiz {
* @param numPerPage
* @return
*/
PageBeanNew
<
ListGroupQrcodeResponseVO
>
listAllGroupQrcode
(
String
wxGroupName
,
Integer
currentPage
,
Integer
numPerPage
);
PageBeanNew
<
ListGroupQrcodeResponseVO
>
listAllGroupQrcode
(
String
wxGroupName
,
Long
proLabelId
,
Long
depLabelId
,
Integer
currentPage
,
Integer
numPerPage
);
/**
* @Author:lili
* @Desr:新增微信群二维码
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/GroupQrcodeBizImpl.java
View file @
67cb4c89
...
...
@@ -332,18 +332,30 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
@Override
@ParamLog
(
"listAllGroupQrcode"
)
public
PageBeanNew
<
ListGroupQrcodeResponseVO
>
listAllGroupQrcode
(
String
wxGroupName
,
Integer
currentPage
,
Integer
numPerPage
)
{
public
PageBeanNew
<
ListGroupQrcodeResponseVO
>
listAllGroupQrcode
(
String
wxGroupName
,
Long
proLabelId
,
Long
depLabelId
,
Integer
currentPage
,
Integer
numPerPage
)
{
PageParam
pageParam
=
new
PageParam
(
currentPage
,
numPerPage
);
final
Map
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"groupName"
,
StringUtil
.
isEmpty
(
wxGroupName
)
?
null
:
wxGroupName
);
map
.
put
(
"proLabelId"
,
proLabelId
);
map
.
put
(
"depLabelId"
,
depLabelId
);
final
PageBeanNew
<
ListGroupQrcodeResponseVO
>
groupQrcode
=
this
.
groupQrcodeDao
.
listPageNew
(
pageParam
,
map
,
"listAllGroupQrcode"
);
if
(
null
==
groupQrcode
||
CollectionUtils
.
isEmpty
(
groupQrcode
.
getRecordList
()))
{
return
groupQrcode
;
}
final
List
<
Long
>
adviserIds
=
groupQrcode
.
getRecordList
().
stream
().
map
(
ListGroupQrcodeResponseVO:
:
getAdviserId
).
distinct
().
collect
(
Collectors
.
toList
());
final
List
<
Long
>
adviserIds
=
Lists
.
newArrayList
();
final
List
<
Long
>
depLabelIds
=
Lists
.
newArrayList
();
final
List
<
Long
>
proLabelIds
=
Lists
.
newArrayList
();
for
(
ListGroupQrcodeResponseVO
vo
:
groupQrcode
.
getRecordList
())
{
adviserIds
.
add
(
vo
.
getAdviserId
());
depLabelIds
.
add
(
vo
.
getDepLabelId
());
proLabelIds
.
add
(
vo
.
getProLabelId
());
}
Map
<
Long
,
String
>
labelName
=
labelConsr
.
getLabelName
(
depLabelIds
);
final
Map
<
Long
,
String
>
names
=
adviserConsr
.
getNames
(
adviserIds
);
for
(
ListGroupQrcodeResponseVO
vo
:
groupQrcode
.
getRecordList
())
{
vo
.
setAdviserName
(
names
.
get
(
vo
.
getAdviserId
()));
vo
.
setDepLabelName
(
labelName
.
get
(
vo
.
getDepLabelId
()));
vo
.
setProLabelName
(
labelName
.
get
(
vo
.
getProLabelId
()));
}
return
groupQrcode
;
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/impl/GroupQrcodeFacadeImpl.java
View file @
67cb4c89
...
...
@@ -57,9 +57,11 @@ public class GroupQrcodeFacadeImpl implements GroupQrcodeFacade {
@GetMapping
(
"listAllGroupQrcode"
)
public
ResponseDto
<
PageBeanNew
>
listAllGroupQrcode
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"wxGroupName"
,
required
=
false
)
String
wxGroupName
,
@RequestParam
(
value
=
"proLabelId"
,
required
=
false
)
Long
proLabelId
,
@RequestParam
(
value
=
"depLabelId"
,
required
=
false
)
Long
depLabelId
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
)
{
return
new
ResponseDto
<>(
groupQrcodeBiz
.
listAllGroupQrcode
(
wxGroupName
,
currentPage
,
numPerPage
));
return
new
ResponseDto
<>(
groupQrcodeBiz
.
listAllGroupQrcode
(
wxGroupName
,
proLabelId
,
depLabelId
,
currentPage
,
numPerPage
));
}
@PostMapping
(
"updateGroupQrcode"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/handler/PushBookGroupUpdateHandler.java
View file @
67cb4c89
package
com
.
pcloud
.
book
.
group
.
handler
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.common.utils.DateUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.Random
;
import
javax.annotation.PostConstruct
;
/**
* @Description 启动时开始推送1v1更新
* @Author ruansiyuan
* @Date 2019/10/28 16:36
**/
@Component
public
class
PushBookGroupUpdateHandler
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
PushBookGroupUpdateHandler
.
class
);
private
static
PushBookGroupUpdateHandler
pushBookGroupUpdateHandler
;
@Autowired
private
BookGroupBiz
bookGroupBiz
;
private
static
Thread
thread
=
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
while
(
true
)
{
//随机睡10到15s
Long
sleepMillis
=
Double
.
valueOf
(
new
Random
().
nextInt
(
10
)
+
5
).
longValue
()
*
1000
;
try
{
//判断是否是早八点到晚八点之间
Boolean
isInTime
=
DateUtils
.
isInBetweenTimes
(
"08:00:00"
,
"20:00:00"
);
if
(
isInTime
)
{
pushBookGroupUpdateHandler
.
bookGroupBiz
.
pushBookGroupUpdate
();
}
Thread
.
sleep
(
sleepMillis
);
}
catch
(
Throwable
e
)
{
LOGGER
.
error
(
"启动时开始推送1v1更新异常"
+
e
.
getMessage
(),
e
);
}
}
}
});
static
{
thread
.
start
();
}
@PostConstruct
public
void
init
()
{
pushBookGroupUpdateHandler
=
this
;
pushBookGroupUpdateHandler
.
bookGroupBiz
=
this
.
bookGroupBiz
;
}
public
static
Thread
getInstance
()
{
return
thread
;
}
}
//
package com.pcloud.book.group.handler;
//
//
import com.pcloud.book.group.biz.BookGroupBiz;
//
import com.pcloud.common.utils.DateUtils;
//
//
import org.slf4j.Logger;
//
import org.slf4j.LoggerFactory;
//
import org.springframework.beans.factory.annotation.Autowired;
//
import org.springframework.stereotype.Component;
//
//
import java.util.Random;
//
//
import javax.annotation.PostConstruct;
//
/
//
**
//
* @Description 启动时开始推送1v1更新
//
* @Author ruansiyuan
//
* @Date 2019/10/28 16:36
//
**/
//
@Component
//
public class PushBookGroupUpdateHandler {
//
//
//
private static final Logger LOGGER = LoggerFactory.getLogger(PushBookGroupUpdateHandler.class);
//
//
private static PushBookGroupUpdateHandler pushBookGroupUpdateHandler;
//
//
@Autowired
//
private BookGroupBiz bookGroupBiz;
//
//
private static Thread thread = new Thread(new Runnable() {
//
@Override
//
public void run() {
//
while (true) {
//
//随机睡10到15s
//
Long sleepMillis = Double.valueOf(new Random().nextInt(10) + 5).longValue() * 1000;
//
try {
//
//判断是否是早八点到晚八点之间
//
Boolean isInTime = DateUtils.isInBetweenTimes("08:00:00", "20:00:00");
//
if (isInTime) {
//
pushBookGroupUpdateHandler.bookGroupBiz.pushBookGroupUpdate();
//
}
//
Thread.sleep(sleepMillis);
//
} catch (Throwable e) {
//
LOGGER.error("启动时开始推送1v1更新异常" + e.getMessage(), e);
//
}
//
}
//
}
//
});
//
//
static {
//
thread.start();
//
}
//
//
@PostConstruct
//
public void init() {
//
pushBookGroupUpdateHandler = this;
//
pushBookGroupUpdateHandler.bookGroupBiz = this.bookGroupBiz;
//
}
//
//
public static Thread getInstance() {
//
return thread;
//
}
//
//
//
//
}
pcloud-service-book/src/main/java/com/pcloud/book/group/handler/PushBookGroupUpdateRunner.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
group
.
handler
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationRunner
;
import
org.springframework.stereotype.Component
;
import
java.util.Random
;
import
lombok.extern.slf4j.Slf4j
;
/**
* 项目启动制行的任务
*
* @author Gui_q
* @since 2020年2月3日 12点14分
*/
@Component
@Slf4j
public
class
PushBookGroupUpdateRunner
implements
ApplicationRunner
{
@Autowired
private
BookGroupBiz
bookGroupBiz
;
@Override
public
void
run
(
ApplicationArguments
applicationArguments
)
throws
Exception
{
log
.
info
(
"[启动时开始推送1v1更新]"
);
new
Thread
(()
->
{
while
(
true
)
{
//随机睡10到15s
Long
sleepMillis
=
Double
.
valueOf
(
new
Random
().
nextInt
(
10
)
+
5
).
longValue
()
*
1000
;
try
{
//判断是否是早八点到晚八点之间
Boolean
isInTime
=
DateUtils
.
isInBetweenTimes
(
"08:00:00"
,
"20:00:00"
);
if
(
isInTime
)
{
bookGroupBiz
.
pushBookGroupUpdate
();
}
Thread
.
sleep
(
sleepMillis
);
}
catch
(
Throwable
e
)
{
log
.
error
(
"启动时开始推送1v1更新异常"
+
e
.
getMessage
(),
e
);
try
{
Thread
.
sleep
(
sleepMillis
);
}
catch
(
InterruptedException
ex
)
{
log
.
error
(
"启动时开始推送1v1更新休眠异常"
+
e
.
getMessage
(),
e
);
}
}
}
}).
start
();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/vo/ListGroupQrcodeResponseVO.java
View file @
67cb4c89
...
...
@@ -20,4 +20,14 @@ public class ListGroupQrcodeResponseVO implements Serializable {
private
String
groupQrcode
;
private
Integer
userNumber
;
private
Long
depLabelId
;
private
String
depLabelName
;
private
Long
proLabelId
;
private
String
proLabelName
;
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/SelfRobotKeywordBiz.java
View file @
67cb4c89
package
com
.
pcloud
.
book
.
keywords
.
biz
;
import
com.pcloud.book.keywords.dto.SelfRobotBookRecordDTO
;
import
com.pcloud.book.keywords.entity.RobotSkill4H5
;
import
com.pcloud.book.keywords.entity.RobotSkillDetail
;
import
com.pcloud.book.keywords.entity.SelfRobotKeyword
;
import
com.pcloud.book.keywords.vo.GuideWordVO
;
import
com.pcloud.book.keywords.vo.LabelVO
;
...
...
@@ -28,7 +30,7 @@ public interface SelfRobotKeywordBiz {
List
<
SelfRobotReplyVO
>
getReplyByKeyWord
(
Integer
type
,
String
keyWord
,
String
robotId
,
String
wxUserId
);
List
<
GuideWordVO
>
getGuideWordListByType
(
Integer
type
);
List
<
RobotSkill4H5
>
getGuideWordListByType
(
Integer
type
,
Long
labelId
,
String
wxUserId
);
List
<
SelfRobotReplyVO
>
getReplyBuyGuide
(
Integer
type
,
Integer
id
,
String
robotId
,
String
wxUserId
);
...
...
@@ -47,4 +49,8 @@ public interface SelfRobotKeywordBiz {
Boolean
hasKeyword
(
Long
bookGroupId
);
SelfRobotKeyword
getById
(
Long
id
);
RobotSkillDetail
getSkillDetail
(
Integer
type
,
Integer
relSkillId
,
String
wxUserId
);
String
confirmSkill
(
Integer
id
,
Integer
type
,
Integer
relSkillId
,
String
robotId
,
String
wxUserId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/SelfRobotKeywordBizImpl.java
View file @
67cb4c89
...
...
@@ -2,8 +2,6 @@ package com.pcloud.book.keywords.biz.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.advertising.dto.AdvertisingSpaceDTO
;
import
com.pcloud.book.advertising.dto.GroupTagDTO
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
...
...
@@ -23,25 +21,33 @@ import com.pcloud.book.keywords.dao.SelfRobotBookRecordDao;
import
com.pcloud.book.keywords.dao.SelfRobotGuideDao
;
import
com.pcloud.book.keywords.dao.SelfRobotKeywordDao
;
import
com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao
;
import
com.pcloud.book.keywords.dto.SelfRobotBookRecordDTO
;
import
com.pcloud.book.keywords.entity.SelfRobotBookRecord
;
import
com.pcloud.book.keywords.entity.SelfRobotGuide
;
import
com.pcloud.book.keywords.entity.SelfRobotKeyword
;
import
com.pcloud.book.keywords.mapper.TempRobotSkillDao
;
import
com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO
;
import
com.pcloud.book.keywords.
entity.SelfRobotKeywordReply
;
import
com.pcloud.book.keywords.entity.
TempRobotSkill
;
import
com.pcloud.book.keywords.
dto.SelfRobotBookRecordDTO
;
import
com.pcloud.book.keywords.entity.
*
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.keywords.mapper.TempRobotSkillDao
;
import
com.pcloud.book.keywords.vo.GuideWordVO
;
import
com.pcloud.book.keywords.vo.LabelVO
;
import
com.pcloud.book.keywords.vo.SelfRobotReplyVO
;
import
com.pcloud.book.skill.biz.PcloudGroupActivityBiz
;
import
com.pcloud.book.skill.biz.impl.PcloudSkillBizImpl
;
import
com.pcloud.book.skill.dao.PcloudGroupActivityDao
;
import
com.pcloud.book.skill.dao.PcloudResourceDao
;
import
com.pcloud.book.skill.dao.PcloudSkillDao
;
import
com.pcloud.book.skill.entity.PcloudGroupActivity
;
import
com.pcloud.book.skill.entity.PcloudSkill
;
import
com.pcloud.book.skill.facade.response.QueryPcloudResponseVO
;
import
com.pcloud.book.timecontrol.biz.TaskBiz
;
import
com.pcloud.book.timecontrol.biz.TaskSubscribeBiz
;
import
com.pcloud.book.timecontrol.entity.TimeControlTaskSubscribe
;
import
com.pcloud.book.timecontrol.mapper.TimeControlTaskSubscribeMapper
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.biz.MessageBiz
;
import
com.pcloud.common.core.constant.SystemCode
;
import
com.pcloud.common.core.dto.SendNotifyDto
;
import
com.pcloud.common.core.enums.NotifyOriginTypeEnum
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.DateUtils
;
...
...
@@ -49,15 +55,17 @@ import com.pcloud.common.utils.ListUtils;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.pcloud.labelcenter.label.service.LabelService
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
com.pcloud.resourcecenter.product.dto.ProductTypeDto
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupUserDTO
;
import
com.pcloud.wechatgroup.timecontrol.dto.LabelDto
;
import
com.pcloud.wechatgroup.timecontrol.dto.TaskDto
;
import
com.pcloud.wechatgroup.timecontrol.service.TimeControlTaskService
;
import
com.sdk.wxgroup.*
;
import
com.pcloud.book.timecontrol.dto.TaskDto
;
import
com.sdk.wxgroup.SendFileVO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -66,7 +74,12 @@ import org.springframework.stereotype.Component;
import
org.springframework.transaction.annotation.Transactional
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -95,7 +108,7 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
@Autowired
private
SelfRobotKeywordReplyDao
selfRobotKeywordReplyDao
;
@Autowired
private
T
imeControlTaskService
timeControlTaskService
;
private
T
askBiz
taskBiz
;
@Autowired
private
TempRobotSkillDao
tempRobotSkillDao
;
@Autowired
...
...
@@ -110,6 +123,23 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
private
ExportConsr
exportConsr
;
@Autowired
private
MessageBiz
messageBiz
;
@Autowired
private
PcloudSkillDao
pcloudSkillDao
;
@Autowired
private
LabelService
labelService
;
@Autowired
private
PcloudGroupActivityDao
pcloudGroupActivityDao
;
@Autowired
private
PcloudResourceDao
pcloudResourceDao
;
@Autowired
private
TaskSubscribeBiz
taskSubscribeBiz
;
@Autowired
private
PcloudGroupActivityBiz
pcloudGroupActivityBiz
;
@Autowired
private
PcloudSkillBizImpl
pcloudSkillBiz
;
@Autowired
private
TimeControlTaskSubscribeMapper
timeControlTaskSubscribeMapper
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"批量新增个人号关键词"
)
...
...
@@ -275,38 +305,70 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
@Override
public
List
<
GuideWordVO
>
getGuideWordListByType
(
Integer
type
)
{
@ParamLog
(
value
=
"根据类型获取引导语列表"
,
isAfterReturn
=
false
)
public
List
<
RobotSkill4H5
>
getGuideWordListByType
(
Integer
type
,
Long
labelId
,
String
wxUserId
)
{
List
<
GuideWordVO
>
list
=
new
ArrayList
<>();
List
<
TempRobotSkill
>
skillList
=
tempRobotSkillDao
.
getTempRobotSkillListByType
(
type
);
for
(
TempRobotSkill
skill
:
skillList
)
{
GuideWordVO
guideWordVO
=
new
GuideWordVO
();
guideWordVO
.
setId
(
skill
.
getId
());
guideWordVO
.
setType
(
type
);
guideWordVO
.
setGuideWord
(
skill
.
getGuideWord
());
guideWordVO
.
setKeyWord
(
skill
.
getKeyWord
());
list
.
add
(
guideWordVO
);
if
(
null
==
type
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"type为空"
);
}
return
list
;
List
<
RobotSkill4H5
>
skillList
=
null
;
if
(
type
.
equals
(
1
)){
//读书计划
skillList
=
pcloudSkillDao
.
getSkillList4TimeController
(
type
,
labelId
,
wxUserId
);
if
(!
ListUtils
.
isEmpty
(
skillList
)
&&
null
!=
labelId
){
setSubscribeState
(
skillList
,
wxUserId
);
}
}
else
if
(
type
.
equals
(
2
)){
//共读活动
skillList
=
pcloudSkillDao
.
getSkillList4Activity
(
type
,
labelId
);
}
else
if
(
type
.
equals
(
3
)){
//配套资料
skillList
=
pcloudSkillDao
.
getSkillList4Resource
(
type
,
labelId
);
}
return
skillList
;
}
private
void
setSubscribeState
(
List
<
RobotSkill4H5
>
skillList
,
String
wxUserId
)
{
skillList
.
stream
().
forEach
(
e
->{
TimeControlTaskSubscribe
timeControlTaskSubscribe
=
timeControlTaskSubscribeMapper
.
getSubscribe
(
wxUserId
,
null
,
e
.
getRelSkillId
());
if
(
null
!=
timeControlTaskSubscribe
){
e
.
setState
(
timeControlTaskSubscribe
.
getState
());
}
else
{
e
.
setState
(
0
);
}
});
}
@Override
public
List
<
LabelVO
>
listLabelByType
(
Integer
type
)
{
List
<
LabelVO
>
list
=
new
ArrayList
<>();
if
(
type
==
1
)
{
if
(
null
==
type
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"type为空"
);
}
List
<
Long
>
labelIds
=
new
ArrayList
<>();
if
(
type
==
1
){
//时间管理
List
<
LabelDto
>
labelList
=
ResponseHandleUtil
.
parseList
(
timeControlTaskService
.
listMaxDepLabel
(
10
),
LabelDto
.
class
);
if
(!
ListUtils
.
isEmpty
(
labelList
))
{
for
(
LabelDto
item
:
labelList
)
{
LabelVO
labelVO
=
new
LabelVO
();
labelVO
.
setLabelId
(
item
.
getDepLabelId
());
labelVO
.
setLabelName
(
item
.
getDepLabelName
());
list
.
add
(
labelVO
);
labelIds
=
pcloudSkillDao
.
getLabelList4TimeController
(
type
);
}
if
(
type
==
2
)
{
//共读活动
labelIds
=
pcloudSkillDao
.
getLabelList4Activity
(
type
);
}
if
(
type
==
3
){
//配套资料
labelIds
=
pcloudSkillDao
.
getLabelList4Resource
(
type
);
}
if
(
type
==
2
||
type
==
3
)
{
list
=
tempRobotSkillDao
.
getLabelListByType
(
type
);
if
(!
ListUtils
.
isEmpty
(
labelIds
)){
labelIds
.
forEach
(
depLabelId
->
{
LabelVO
labelVO
=
new
LabelVO
();
labelVO
.
setLabelId
(
depLabelId
);
String
labelName
=
ResponseHandleUtil
.
parseResponse
(
labelService
.
getLabelName
(
depLabelId
),
String
.
class
);
labelVO
.
setLabelName
(
labelName
);
list
.
add
(
labelVO
);
});
}
return
list
;
}
...
...
@@ -315,7 +377,7 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
public
List
<
SelfRobotReplyVO
>
getReplyByLabel
(
Integer
type
,
Long
labelId
,
String
robotId
,
String
wxUserId
)
{
List
<
SelfRobotReplyVO
>
list
=
new
ArrayList
<>();
if
(
type
==
1
)
{
List
<
TaskDto
>
taskDtoList
=
ResponseHandleUtil
.
parseList
(
timeControlTaskService
.
listTaskByLabelIds4User
(
wxUserId
,
labelId
),
TaskDto
.
class
);
List
<
TaskDto
>
taskDtoList
=
taskBiz
.
listTaskByLabelIds4User
(
wxUserId
,
labelId
);
if
(!
ListUtils
.
isEmpty
(
taskDtoList
))
{
taskDtoList
.
forEach
(
item
->
{
SelfRobotReplyVO
selfRobotReplyVO
=
new
SelfRobotReplyVO
();
...
...
@@ -357,7 +419,7 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
public
List
<
SelfRobotReplyVO
>
getReplyByKeyWord
(
Integer
type
,
String
keyWord
,
String
robotId
,
String
wxUserId
)
{
List
<
SelfRobotReplyVO
>
list
=
new
ArrayList
<>();
if
(
type
==
1
)
{
List
<
TaskDto
>
taskDtoList
=
ResponseHandleUtil
.
parseList
(
timeControlTaskService
.
listTaskByKey4User
(
wxUserId
,
keyWord
),
TaskDto
.
class
);
List
<
TaskDto
>
taskDtoList
=
taskBiz
.
listTaskByKey4User
(
wxUserId
,
keyWord
);
if
(!
ListUtils
.
isEmpty
(
taskDtoList
))
{
taskDtoList
.
forEach
(
item
->
{
SelfRobotReplyVO
selfRobotReplyVO
=
new
SelfRobotReplyVO
();
...
...
@@ -408,7 +470,7 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
}
else
{
taskIds
=
Arrays
.
asList
(
5
);
}
List
<
TaskDto
>
taskDtoList
=
ResponseHandleUtil
.
parseList
(
timeControlTaskService
.
listTaskByIds4User
(
wxUserId
,
taskIds
),
TaskDto
.
clas
s
);
List
<
TaskDto
>
taskDtoList
=
taskBiz
.
listTaskByIds4User
(
wxUserId
,
taskId
s
);
if
(!
ListUtils
.
isEmpty
(
taskDtoList
))
{
taskDtoList
.
forEach
(
item
->
{
SelfRobotReplyVO
selfRobotReplyVO
=
new
SelfRobotReplyVO
();
...
...
@@ -565,6 +627,68 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
return
keyword
;
}
@Override
public
RobotSkillDetail
getSkillDetail
(
Integer
type
,
Integer
relSkillId
,
String
wxUserId
)
{
if
(
null
==
type
||
null
==
relSkillId
){
throw
new
BizException
(
BizException
.
PARAM_IS_NULL
.
getCode
(),
"type为空或者relSkillId为空"
);
}
RobotSkillDetail
robotSkillDetail
=
new
RobotSkillDetail
();
if
(
1
==
type
){
TaskDto
taskDto
=
taskBiz
.
getTaskById
(
relSkillId
);
if
(
null
!=
taskDto
){
TimeControlTaskSubscribe
timeControlTaskSubscribe
=
timeControlTaskSubscribeMapper
.
getSubscribe
(
wxUserId
,
null
,
relSkillId
);
if
(
null
!=
timeControlTaskSubscribe
){
robotSkillDetail
.
setState
(
timeControlTaskSubscribe
.
getState
());
}
else
{
robotSkillDetail
.
setState
(
0
);
}
robotSkillDetail
.
setRelSkillId
(
taskDto
.
getTaskId
());
robotSkillDetail
.
setRelSkillName
(
taskDto
.
getTaskName
());
robotSkillDetail
.
setRelSkillIntroduce
(
taskDto
.
getTaskIntroduce
());
robotSkillDetail
.
setState
(
taskDto
.
getSubscribeState
());
}
}
else
if
(
2
==
type
){
PcloudGroupActivity
pcloudGroupActivity
=
pcloudGroupActivityDao
.
getById
(
relSkillId
);
if
(
null
!=
pcloudGroupActivity
){
robotSkillDetail
.
setRelSkillId
(
Integer
.
valueOf
(
pcloudGroupActivity
.
getId
().
toString
()));
robotSkillDetail
.
setRelSkillName
(
pcloudGroupActivity
.
getName
());
robotSkillDetail
.
setRelSkillIntroduce
(
pcloudGroupActivity
.
getDesc
());
}
}
else
if
(
3
==
type
){
QueryPcloudResponseVO
queryPcloudResponseVO
=
pcloudResourceDao
.
getPcloudResource
(
Long
.
valueOf
(
relSkillId
.
toString
()));
if
(
null
!=
queryPcloudResponseVO
){
robotSkillDetail
.
setRelSkillId
(
Integer
.
valueOf
(
queryPcloudResponseVO
.
getId
().
toString
()));
robotSkillDetail
.
setRelSkillName
(
queryPcloudResponseVO
.
getName
());
robotSkillDetail
.
setRelSkillIntroduce
(
queryPcloudResponseVO
.
getDescription
());
}
}
return
robotSkillDetail
;
}
@Override
@ParamLog
(
"确认任务"
)
public
String
confirmSkill
(
Integer
id
,
Integer
type
,
Integer
relSkillId
,
String
robotId
,
String
wxUserId
)
{
if
(
null
==
type
||
null
==
relSkillId
||
null
==
robotId
||
null
==
wxUserId
){
throw
new
BizException
(
BizException
.
PARAM_IS_NULL
.
getCode
(),
"type为空或者relSkillId为空"
);
}
String
skillFuseReply
=
null
;
PcloudSkill
pcloudSkill
=
pcloudSkillDao
.
getById
(
id
);
if
(
null
!=
pcloudSkill
){
skillFuseReply
=
pcloudSkill
.
getSkillFuseReply
();
}
if
(
1
==
type
){
//读书计划 确认某个读书计划
taskSubscribeBiz
.
subscribeTask
(
wxUserId
,
null
,
relSkillId
,
robotId
);
}
else
if
(
2
==
type
){
pcloudGroupActivityBiz
.
processGroup
(
wxUserId
,
robotId
,
Long
.
valueOf
(
relSkillId
.
toString
()));
}
else
if
(
3
==
type
){
pcloudSkillBiz
.
sendResource
(
id
,
wxUserId
,
robotId
,
relSkillId
);
}
return
skillFuseReply
;
}
@ParamLog
(
"填充列表"
)
private
void
fillSelfRobotKeyword
(
List
<
SelfRobotKeyword
>
selfRobotKeywords
)
{
if
(
ListUtils
.
isEmpty
(
selfRobotKeywords
)){
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/entity/RobotSkill4H5.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
keywords
.
entity
;
import
lombok.Data
;
@Data
public
class
RobotSkill4H5
{
private
Integer
id
;
private
Integer
type
;
private
Integer
relSkillId
;
private
String
relSkillName
;
private
String
relSkillIntroduce
;
private
String
keyWord
;
private
String
guideWord
;
private
Integer
depthId
;
private
String
depthLabel
;
private
String
resourceType
;
private
String
text
;
private
String
imgUrl
;
private
Integer
productId
;
private
String
fileUrl
;
private
String
fileName
;
private
String
groupId
;
private
String
groupName
;
private
String
replyContent
;
private
Integer
state
;
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/entity/RobotSkillDetail.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
keywords
.
entity
;
import
lombok.Data
;
@Data
public
class
RobotSkillDetail
{
private
Integer
id
;
private
Integer
type
;
private
Integer
relSkillId
;
private
String
relSkillName
;
private
String
relSkillIntroduce
;
private
String
keyWord
;
private
String
guideWord
;
private
Integer
depthId
;
private
String
depthLabel
;
private
String
resourceType
;
private
String
text
;
private
String
imgUrl
;
private
Integer
productId
;
private
String
fileUrl
;
private
String
fileName
;
private
String
groupId
;
private
String
groupName
;
private
String
replyContent
;
private
Integer
state
;
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/facade/SelfRobotKeywordFacade.java
View file @
67cb4c89
...
...
@@ -82,7 +82,9 @@ public interface SelfRobotKeywordFacade {
@ApiOperation
(
"根据类型获取引导语列表"
)
@GetMapping
(
"getGuideWordListByType"
)
ResponseDto
<?>
getGuideWordListByType
(
@RequestParam
(
"type"
)
@ApiParam
(
"技能类型"
)
Integer
type
@RequestParam
(
"type"
)
@ApiParam
(
"技能类型"
)
Integer
type
,
@RequestParam
(
value
=
"labelId"
,
required
=
false
)
@ApiParam
(
"分类标签id"
)
Long
labelId
,
@RequestParam
(
value
=
"wxUserId"
,
required
=
false
)
@ApiParam
(
"微信用户id"
)
String
wxUserId
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"根据类型获取标签列表"
)
...
...
@@ -110,7 +112,16 @@ public interface SelfRobotKeywordFacade {
@GetMapping
(
"getReplyByGuide"
)
ResponseDto
<?>
getReplyByGuide
(
Integer
type
,
Integer
id
,
String
robotId
,
String
wxUserId
);
@ApiOperation
(
value
=
"获取资料"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"根据任务id获取任务详情"
,
httpMethod
=
"GET"
)
@GetMapping
(
"getSkillDetail"
)
ResponseDto
<?>
getSkillDetail
(
Integer
type
,
Integer
relSkillId
,
String
wxUserId
);
@ApiOperation
(
value
=
"确认任务"
,
httpMethod
=
"GET"
)
@GetMapping
(
"confirmSkill"
)
ResponseDto
<?>
confirmSkill
(
Integer
id
,
Integer
type
,
Integer
relSkillId
,
String
robotId
,
String
wxUserId
);
@ApiOperation
(
value
=
""
,
httpMethod
=
"GET"
)
@GetMapping
(
"getResource"
)
ResponseDto
<?>
getResource
(
Integer
id
,
String
robotId
,
String
wxUserId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/facade/impl/SelfRobotKeywordFacadeImpl.java
View file @
67cb4c89
package
com
.
pcloud
.
book
.
keywords
.
facade
.
impl
;
import
com.pcloud.book.keywords.biz.SelfRobotKeywordBiz
;
import
com.pcloud.book.keywords.entity.RobotSkillDetail
;
import
com.pcloud.book.keywords.entity.SelfRobotKeyword
;
import
com.pcloud.book.keywords.facade.SelfRobotKeywordFacade
;
import
com.pcloud.book.keywords.vo.LabelVO
;
...
...
@@ -131,8 +132,9 @@ public class SelfRobotKeywordFacadeImpl implements SelfRobotKeywordFacade {
@Override
@GetMapping
(
"getGuideWordListByType"
)
public
ResponseDto
<?>
getGuideWordListByType
(
@RequestParam
(
"type"
)
Integer
type
)
throws
BizException
,
PermissionException
{
return
new
ResponseDto
<>(
selfRobotKeywordBiz
.
getGuideWordListByType
(
type
));
public
ResponseDto
<?>
getGuideWordListByType
(
@RequestParam
(
"type"
)
Integer
type
,
@RequestParam
(
value
=
"labelId"
,
required
=
false
)
Long
labelId
,
@RequestParam
(
value
=
"wxUserId"
,
required
=
false
)
String
wxUserId
)
throws
BizException
,
PermissionException
{
return
new
ResponseDto
<>(
selfRobotKeywordBiz
.
getGuideWordListByType
(
type
,
labelId
,
wxUserId
));
}
@Override
...
...
@@ -167,6 +169,21 @@ public class SelfRobotKeywordFacadeImpl implements SelfRobotKeywordFacade {
}
@Override
@GetMapping
(
"getSkillDetail"
)
public
ResponseDto
<?>
getSkillDetail
(
@RequestParam
Integer
type
,
@RequestParam
Integer
relSkillId
,
@RequestParam
String
wxUserId
)
{
RobotSkillDetail
robotSkillDetail
=
selfRobotKeywordBiz
.
getSkillDetail
(
type
,
relSkillId
,
wxUserId
);
return
new
ResponseDto
<>(
robotSkillDetail
);
}
@Override
@GetMapping
(
"confirmSkill"
)
public
ResponseDto
<?>
confirmSkill
(
@RequestParam
Integer
id
,
@RequestParam
Integer
type
,
@RequestParam
Integer
relSkillId
,
@RequestParam
String
robotId
,
@RequestParam
String
wxUserId
)
{
return
new
ResponseDto
<>(
selfRobotKeywordBiz
.
confirmSkill
(
id
,
type
,
relSkillId
,
robotId
,
wxUserId
));
}
@Override
@GetMapping
(
"getResource"
)
public
ResponseDto
<?>
getResource
(
@RequestParam
Integer
id
,
@RequestParam
String
robotId
,
@RequestParam
String
wxUserId
)
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/pcloudkeyword/entity/PcloudRobot.java
View file @
67cb4c89
...
...
@@ -38,6 +38,9 @@ public class PcloudRobot extends BaseEntity {
@ApiModelProperty
(
"入口二维码url"
)
private
String
entryQrcodeUrl
;
@ApiModelProperty
(
"小号分类id"
)
private
String
classifyId
;
@ApiModelProperty
(
"状态:1 在线 2 离线"
)
private
Integer
state
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/push/biz/impl/SelfPushBizImpl.java
View file @
67cb4c89
...
...
@@ -36,27 +36,17 @@ import com.pcloud.facade.quartz.service.ScheduleService;
import
com.pcloud.usercenter.user.entity.UserLogin
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupUserDTO
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
com.sdk.wxgroup.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
lombok.extern.slf4j.Slf4j
;
/**
* @描述:个人号群发
* @作者:zhuyajie
...
...
pcloud-service-book/src/main/java/com/pcloud/book/skill/biz/PcloudGroupActivityBiz.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
biz
;
import
com.pcloud.book.skill.facade.request.QueryGroupActivityRequestVO
;
import
com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO
;
import
com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO
;
import
com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO
;
import
com.pcloud.common.page.PageBeanNew
;
import
org.springframework.web.bind.annotation.RequestParam
;
public
interface
PcloudGroupActivityBiz
{
/**
* 保存共读活动
*/
void
saveGroupActivity
(
SaveGroupActivityRequestVO
vo
);
/**
* 修改共读活动
*/
void
updateGroupActivity
(
UpdateGroupActivityRequestVO
vo
);
/**
* 删除共读
*/
void
deleteGroupActivity
(
Long
id
,
Long
partyId
);
/**
* 处理共读选取
*/
void
processGroup
(
String
wxId
,
String
robotWxId
,
Long
id
);
/**
* 获取共读活动列表(分页)
*/
PageBeanNew
<
QueryGroupActivityResponseVO
>
queryGroupActivity
(
String
name
,
Long
proLabelId
,
Long
purLabelId
,
Long
depLabelId
,
Integer
numPerPage
,
Integer
currentPage
);
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/biz/PcloudResourceBiz.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
biz
;
import
com.pcloud.book.skill.entity.PcloudResource
;
import
com.pcloud.book.skill.facade.response.QueryPcloudResponseVO
;
import
com.pcloud.common.page.PageBeanNew
;
public
interface
PcloudResourceBiz
{
void
savePcloudResource
(
PcloudResource
pcloudResource
);
void
updatePcloudResource
(
PcloudResource
pcloudResource
);
void
deletePcloudResource
(
Long
id
);
PageBeanNew
getPcloudResourceList
(
String
name
,
Long
proLabelId
,
Long
depLabelId
,
Long
purLabelId
,
Integer
currentPage
,
Integer
numPerPage
);
QueryPcloudResponseVO
getPcloudResource
(
Long
id
);
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/biz/PcloudSkillBiz.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
biz
;
import
com.pcloud.book.skill.entity.PcloudSkill
;
import
com.pcloud.common.page.PageBeanNew
;
public
interface
PcloudSkillBiz
{
void
createPcloudSkill
(
PcloudSkill
pcloudSkill
);
void
updatePcloudSkill
(
PcloudSkill
pcloudSkill
);
PcloudSkill
getPcloudSkill
(
Long
id
);
PageBeanNew
<
PcloudSkill
>
getPcloudSkillList
(
Integer
skillType
,
Integer
currentPage
,
Integer
numPerPage
);
void
deletePcloudSkill
(
Long
id
);
String
setSubscribeState
(
Long
skillId
,
Integer
taskId
,
String
robotWxId
,
String
userWxId
,
Boolean
subState
);
void
updateSeqNum
(
PcloudSkill
pcloudSkill
);
void
sendResource
(
Integer
id
,
String
wxUserId
,
String
robotId
,
Integer
relSkillId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/biz/impl/PcloudGroupActivityBizImpl.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
biz
.
impl
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.label.LabelConsr
;
import
com.pcloud.book.group.biz.GroupQrcodeBiz
;
import
com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO
;
import
com.pcloud.book.reading.biz.ReadingActivityBiz
;
import
com.pcloud.book.skill.biz.PcloudGroupActivityBiz
;
import
com.pcloud.book.skill.dao.PcloudGroupActivityDao
;
import
com.pcloud.book.skill.entity.PcloudGroupActivity
;
import
com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO
;
import
com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO
;
import
com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.sdk.wxgroup.SendGroupInviteVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
javax.annotation.Resource
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
@Service
public
class
PcloudGroupActivityBizImpl
implements
PcloudGroupActivityBiz
{
@Resource
private
PcloudGroupActivityDao
pcloudGroupActivityDao
;
@Resource
private
GroupQrcodeBiz
groupQrcodeBiz
;
@Resource
private
ReadingActivityBiz
readingActivityBiz
;
@Resource
private
LabelConsr
labelConsr
;
@ParamLog
(
"保存共读活动"
)
@Override
public
void
saveGroupActivity
(
SaveGroupActivityRequestVO
vo
)
{
vo
.
checkParam
();
PcloudGroupActivity
entity
=
vo
.
getEntity
();
Date
now
=
new
Date
();
entity
.
setCreateUser
(
vo
.
getUserId
());
entity
.
setCreateTime
(
now
);
entity
.
setUpdateUser
(
vo
.
getUserId
());
entity
.
setUpdateTime
(
now
);
entity
.
setIsDelete
(
0
);
pcloudGroupActivityDao
.
insert
(
entity
);
}
@Override
public
void
updateGroupActivity
(
UpdateGroupActivityRequestVO
vo
)
{
vo
.
checkParam
();
PcloudGroupActivity
activity
=
pcloudGroupActivityDao
.
getById
(
vo
.
getId
());
if
(
null
==
activity
)
{
throw
new
BookBizException
(
BookBizException
.
ID_NOT_EXIST
,
"共读活动不存在"
);
}
PcloudGroupActivity
entity
=
vo
.
getEntity
();
Date
now
=
new
Date
();
entity
.
setUpdateUser
(
vo
.
getUserId
());
entity
.
setUpdateTime
(
now
);
pcloudGroupActivityDao
.
updateByPrimaryKeySelective
(
entity
);
}
@Override
public
void
deleteGroupActivity
(
Long
id
,
Long
partyId
)
{
pcloudGroupActivityDao
.
deleteById
(
id
);
}
@Override
@ParamLog
(
"[processGroup]"
)
public
void
processGroup
(
String
wxId
,
String
robotWxId
,
Long
id
)
{
PcloudGroupActivity
byId
=
pcloudGroupActivityDao
.
getById
(
id
);
if
(
Objects
.
isNull
(
byId
))
{
log
.
error
(
"[processGroup] error 共读不存在"
);
return
;
}
GroupQrcodeBaseInfoVO
groupQrcode
=
groupQrcodeBiz
.
getBaseById
(
byId
.
getBookGroupQrcodeId
());
if
(
Objects
.
isNull
(
groupQrcode
))
{
log
.
error
(
"[processGroup] error 共读对应社群不存在"
);
return
;
}
SendGroupInviteVO
vo
=
new
SendGroupInviteVO
();
vo
.
setWxId
(
wxId
);
vo
.
setAltId
(
robotWxId
);
vo
.
setIp
(
readingActivityBiz
.
getIP
(
robotWxId
));
vo
.
setWxGroupId
(
groupQrcode
.
getWeixinGroupId
());
WxGroupSDK
.
sendGroupInvite
(
vo
);
log
.
info
(
"[processGroup] sendGroupInvite:{}"
,
vo
);
}
@Override
public
PageBeanNew
<
QueryGroupActivityResponseVO
>
queryGroupActivity
(
String
name
,
Long
proLabelId
,
Long
purLabelId
,
Long
depLabelId
,
Integer
numPerPage
,
Integer
currentPage
)
{
PageParam
pageParam
=
new
PageParam
(
currentPage
,
numPerPage
);
Map
<
String
,
Object
>
paraMap
=
Maps
.
newHashMap
();
paraMap
.
put
(
"name"
,
name
);
paraMap
.
put
(
"proLabelId"
,
proLabelId
);
paraMap
.
put
(
"purLabelId"
,
purLabelId
);
paraMap
.
put
(
"depLabelId"
,
depLabelId
);
PageBeanNew
<
QueryGroupActivityResponseVO
>
queryGroupActivity
=
pcloudGroupActivityDao
.
listPageNew
(
pageParam
,
paraMap
,
"queryGroupActivity"
);
if
(
null
==
queryGroupActivity
||
CollectionUtils
.
isEmpty
(
queryGroupActivity
.
getRecordList
()))
{
return
queryGroupActivity
;
}
// 组装标签名称
List
<
Long
>
labelId
=
Lists
.
newArrayList
();
for
(
QueryGroupActivityResponseVO
responseVO
:
queryGroupActivity
.
getRecordList
())
{
labelId
.
add
(
responseVO
.
getProLabelId
());
labelId
.
add
(
responseVO
.
getPurLabelId
());
labelId
.
add
(
responseVO
.
getDepLabelId
());
}
Map
<
Long
,
String
>
labelName
=
labelConsr
.
getLabelName
(
labelId
);
for
(
QueryGroupActivityResponseVO
responseVO
:
queryGroupActivity
.
getRecordList
())
{
responseVO
.
setPurLabelName
(
labelName
.
get
(
responseVO
.
getPurLabelId
()));
responseVO
.
setProLabelName
(
labelName
.
get
(
responseVO
.
getProLabelId
()));
responseVO
.
setDepLabelName
(
labelName
.
get
(
responseVO
.
getDepLabelId
()));
}
return
queryGroupActivity
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/biz/impl/PcloudResourceBizImpl.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
biz
.
impl
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.label.LabelConsr
;
import
com.pcloud.book.skill.biz.PcloudResourceBiz
;
import
com.pcloud.book.skill.dao.PcloudResourceDao
;
import
com.pcloud.book.skill.entity.PcloudResource
;
import
com.pcloud.book.skill.facade.response.QueryPcloudResponseVO
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
PcloudResourceBizImpl
implements
PcloudResourceBiz
{
@Autowired
private
PcloudResourceDao
pcloudResourceDao
;
@Autowired
private
LabelConsr
labelConsr
;
@ParamLog
(
"创建资源"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
savePcloudResource
(
PcloudResource
pcloudResource
)
{
checkPcloudResource
(
pcloudResource
);
// 处理资源盒子和列表关系
// pcloudResource.getItemList()
pcloudResourceDao
.
insert
(
pcloudResource
);
}
@ParamLog
(
"更新资源"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
updatePcloudResource
(
PcloudResource
pcloudResource
)
{
if
(
pcloudResource
.
getId
()
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"id不能为空!"
);
}
checkPcloudResource
(
pcloudResource
);
// 处理资源盒子和列表关系
// pcloudResource.getItemList()
pcloudResourceDao
.
update
(
pcloudResource
);
}
@ParamLog
(
"删除资源"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
deletePcloudResource
(
Long
id
)
{
if
(
id
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数为空!"
);
}
pcloudResourceDao
.
deletePcloudResource
(
id
);
// 删除关系
// pcloudResourceItemDao.deleteByPcloudResourceId(id);
}
@ParamLog
(
"获取资源列表"
)
@Override
public
PageBeanNew
getPcloudResourceList
(
String
name
,
Long
proLabelId
,
Long
depLabelId
,
Long
purLabelId
,
Integer
currentPage
,
Integer
numPerPage
)
{
HashMap
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"name"
,
name
);
map
.
put
(
"proLabelId"
,
proLabelId
);
map
.
put
(
"depLabelId"
,
depLabelId
);
map
.
put
(
"purLabelId"
,
purLabelId
);
PageBeanNew
<
QueryPcloudResponseVO
>
pageBeanNew
=
pcloudResourceDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"getPcloudResourceList"
);
if
(
null
==
pageBeanNew
||
CollectionUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
pageBeanNew
;
}
// 组装标签名称
fillLabels
(
pageBeanNew
.
getRecordList
());
return
pageBeanNew
;
}
@ParamLog
(
"获取资源"
)
@Override
public
QueryPcloudResponseVO
getPcloudResource
(
Long
id
)
{
if
(
id
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数为空!"
);
}
QueryPcloudResponseVO
vo
=
pcloudResourceDao
.
getPcloudResource
(
id
);
if
(
vo
==
null
){
return
new
QueryPcloudResponseVO
();
}
// 组装标签名称
fillLabels
(
Lists
.
newArrayList
(
vo
));
return
vo
;
}
@ParamLog
(
"组装标签名称"
)
private
void
fillLabels
(
List
<
QueryPcloudResponseVO
>
recordList
)
{
List
<
Long
>
labelId
=
Lists
.
newArrayList
();
for
(
QueryPcloudResponseVO
vo
:
recordList
)
{
labelId
.
add
(
vo
.
getProLabelId
());
labelId
.
add
(
vo
.
getPurLabelId
());
labelId
.
add
(
vo
.
getDepLabelId
());
}
Map
<
Long
,
String
>
labelName
=
labelConsr
.
getLabelName
(
labelId
);
for
(
QueryPcloudResponseVO
vo
:
recordList
)
{
vo
.
setPurLabelName
(
labelName
.
get
(
vo
.
getPurLabelId
()));
vo
.
setProLabelName
(
labelName
.
get
(
vo
.
getProLabelId
()));
vo
.
setDepLabelName
(
labelName
.
get
(
vo
.
getDepLabelId
()));
}
}
@ParamLog
(
"检测参数"
)
private
void
checkPcloudResource
(
PcloudResource
pcloudResource
)
{
if
(
StringUtil
.
isBlank
(
pcloudResource
.
getName
())
||
null
==
pcloudResource
.
getProLabelId
()
||
null
==
pcloudResource
.
getDepLabelId
()
||
null
==
pcloudResource
.
getPurLabelId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"请求参数缺失"
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/biz/impl/PcloudSkillBizImpl.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
biz
.
impl
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.WeixinQrcodeBiz
;
import
com.pcloud.book.group.enums.AppAndProductTypeEnum
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.pcloudkeyword.enums.WelcomeReplyTypeEnum
;
import
com.pcloud.book.skill.biz.PcloudSkillBiz
;
import
com.pcloud.book.skill.check.PcloudSkillCheck
;
import
com.pcloud.book.skill.dao.PcloudGroupActivityDao
;
import
com.pcloud.book.skill.dao.PcloudResourceDao
;
import
com.pcloud.book.skill.dao.PcloudSkillDao
;
import
com.pcloud.book.skill.dao.PcloudSubReplyDao
;
import
com.pcloud.book.skill.entity.PcloudGroupActivity
;
import
com.pcloud.book.skill.entity.PcloudResource
;
import
com.pcloud.book.skill.entity.PcloudSkill
;
import
com.pcloud.book.skill.entity.PcloudSubReply
;
import
com.pcloud.book.skill.enums.SkillTypeEnum
;
import
com.pcloud.book.skill.enums.SubTypeEnum
;
import
com.pcloud.book.timecontrol.dto.TaskDto
;
import
com.pcloud.book.timecontrol.mapper.TimeControlTaskMapper
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.sdk.wxgroup.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Component
(
"pcloudSkillBiz"
)
public
class
PcloudSkillBizImpl
implements
PcloudSkillBiz
{
@Autowired
private
PcloudSkillDao
pcloudSkillDao
;
@Autowired
private
PcloudSubReplyDao
pcloudSubReplyDao
;
@Autowired
private
PcloudSkillCheck
pcloudSkillCheck
;
@Autowired
private
AppConsr
appConsr
;
@Autowired
private
ResourceConsr
resourceConsr
;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@Autowired
private
WeixinQrcodeBiz
weixinQrcodeBiz
;
@Autowired
private
QrcodeSceneConsr
qrcodeSceneConsr
;
@Autowired
private
TimeControlTaskMapper
taskMapper
;
@Autowired
private
PcloudResourceDao
pcloudResourceDao
;
@Autowired
private
PcloudGroupActivityDao
pcloudGroupActivityDao
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"新增技能"
)
@Override
public
void
createPcloudSkill
(
PcloudSkill
pcloudSkill
)
{
pcloudSkillCheck
.
createPcloudSkillCheck
(
pcloudSkill
);
//获取最大排序值
Integer
maxSeqNum
=
pcloudSkillDao
.
getMaxSeqNum
();
Integer
seqNum
=
maxSeqNum
+
1
;
pcloudSkill
.
setSeqNum
(
seqNum
);
pcloudSkillDao
.
insert
(
pcloudSkill
);
addSuccessReplies
(
pcloudSkill
);
addCancelReplies
(
pcloudSkill
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"修改技能"
)
@Override
public
void
updatePcloudSkill
(
PcloudSkill
pcloudSkill
)
{
pcloudSkillCheck
.
updatePcloudSkill
(
pcloudSkill
);
pcloudSkillDao
.
update
(
pcloudSkill
);
//根据技能id删除订阅
pcloudSubReplyDao
.
deleteByPcloudSkillId
(
pcloudSkill
.
getId
());
//新增订阅回复
addSuccessReplies
(
pcloudSkill
);
addCancelReplies
(
pcloudSkill
);
}
@ParamLog
(
"获取技能"
)
@Override
public
PcloudSkill
getPcloudSkill
(
Long
id
)
{
PcloudSkill
pcloudSkill
=
pcloudSkillDao
.
getById
(
id
);
if
(
pcloudSkill
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"没找到该技能!"
);
}
List
<
PcloudSubReply
>
replies
=
pcloudSubReplyDao
.
getListByPcloudSkillId
(
id
);
fillRelies
(
replies
);
pcloudSkill
.
setSuccessSubReplies
(
replies
.
stream
().
filter
(
s
->
s
!=
null
&&
SubTypeEnum
.
SUCCESS
.
value
.
equals
(
s
.
getSubType
())).
collect
(
Collectors
.
toList
()));
pcloudSkill
.
setCancelSubReplies
(
replies
.
stream
().
filter
(
s
->
s
!=
null
&&
SubTypeEnum
.
CANCEL
.
value
.
equals
(
s
.
getSubType
())).
collect
(
Collectors
.
toList
()));
fillTitleAndDetail
(
pcloudSkill
);
return
pcloudSkill
;
}
@ParamLog
(
"获取技能列表"
)
@Override
public
PageBeanNew
<
PcloudSkill
>
getPcloudSkillList
(
Integer
skillType
,
Integer
currentPage
,
Integer
numPerPage
)
{
if
(
currentPage
==
null
||
currentPage
<
0
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"当前页不能为空且不能小于0!"
);
}
if
(
numPerPage
==
null
||
numPerPage
<=
0
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"每页条数不能为空且必须大于0!"
);
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"skillType"
,
skillType
);
PageBeanNew
<
PcloudSkill
>
page
=
pcloudSkillDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
map
,
"getPcloudSkillList"
);
if
(
ListUtils
.
isEmpty
(
page
.
getRecordList
())){
return
page
;
}
List
<
Long
>
skillIds
=
page
.
getRecordList
().
stream
().
map
(
PcloudSkill:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
PcloudSubReply
>
replies
=
pcloudSubReplyDao
.
getListByPcloudSkillIds
(
skillIds
);
fillRelies
(
replies
);
Map
<
Long
,
List
<
PcloudSubReply
>>
replyMap
=
replies
.
stream
().
collect
(
Collectors
.
groupingBy
(
PcloudSubReply:
:
getPcloudSkillId
));
for
(
PcloudSkill
pcloudSkill:
page
.
getRecordList
()){
List
<
PcloudSubReply
>
replyList
=
replyMap
.
get
(
pcloudSkill
.
getId
());
if
(!
ListUtils
.
isEmpty
(
replyList
)){
pcloudSkill
.
setSuccessSubReplies
(
replyList
.
stream
().
filter
(
s
->
SubTypeEnum
.
SUCCESS
.
value
.
equals
(
s
.
getSubType
())).
collect
(
Collectors
.
toList
()));
pcloudSkill
.
setCancelSubReplies
(
replyList
.
stream
().
filter
(
s
->
SubTypeEnum
.
CANCEL
.
value
.
equals
(
s
.
getSubType
())).
collect
(
Collectors
.
toList
()));
}
}
fillTitleAndDetailList
(
page
.
getRecordList
());
return
page
;
}
@ParamLog
(
"填充标题简介集合"
)
private
void
fillTitleAndDetailList
(
List
<
PcloudSkill
>
list
)
{
if
(
ListUtils
.
isEmpty
(
list
)){
return
;
}
List
<
Integer
>
timeManageIds
=
new
ArrayList
<>();
List
<
Long
>
readingIds
=
new
ArrayList
<>();
List
<
Long
>
resourceIds
=
new
ArrayList
<>();
for
(
PcloudSkill
pcloudSkill:
list
){
if
(
SkillTypeEnum
.
TIME_MANAGE
.
value
.
equals
(
pcloudSkill
.
getSkillType
())){
timeManageIds
.
add
(
pcloudSkill
.
getRelSkillId
().
intValue
());
}
if
(
SkillTypeEnum
.
READING
.
value
.
equals
(
pcloudSkill
.
getSkillType
())){
readingIds
.
add
(
pcloudSkill
.
getRelSkillId
());
}
if
(
SkillTypeEnum
.
RESOURCE
.
value
.
equals
(
pcloudSkill
.
getSkillType
())){
resourceIds
.
add
(
pcloudSkill
.
getRelSkillId
());
}
}
Map
<
Integer
,
TaskDto
>
taskDtoMap
=
new
HashMap
<>();
Map
<
Long
,
PcloudGroupActivity
>
readingMap
=
new
HashMap
<>();
Map
<
Long
,
PcloudResource
>
resourceMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
timeManageIds
)){
taskDtoMap
=
taskMapper
.
mapByIds
(
timeManageIds
);
}
if
(!
ListUtils
.
isEmpty
(
readingIds
)){
readingMap
=
pcloudGroupActivityDao
.
mayByIds
(
readingIds
);
}
if
(!
ListUtils
.
isEmpty
(
resourceIds
)){
resourceMap
=
pcloudResourceDao
.
mayByIds
(
resourceIds
);
}
for
(
PcloudSkill
pcloudSkill:
list
){
if
(
SkillTypeEnum
.
TIME_MANAGE
.
value
.
equals
(
pcloudSkill
.
getSkillType
())){
TaskDto
taskDto
=
taskDtoMap
.
get
(
pcloudSkill
.
getRelSkillId
().
intValue
());
if
(
taskDto
!=
null
){
pcloudSkill
.
setTitle
(
taskDto
.
getTaskName
());
pcloudSkill
.
setDetail
(
taskDto
.
getTaskIntroduce
());
}
}
if
(
SkillTypeEnum
.
READING
.
value
.
equals
(
pcloudSkill
.
getSkillType
())){
PcloudGroupActivity
pcloudGroupActivity
=
readingMap
.
get
(
pcloudSkill
.
getRelSkillId
());
if
(
pcloudGroupActivity
!=
null
){
pcloudSkill
.
setTitle
(
pcloudGroupActivity
.
getName
());
pcloudSkill
.
setDetail
(
pcloudGroupActivity
.
getDesc
());
}
}
if
(
SkillTypeEnum
.
RESOURCE
.
value
.
equals
(
pcloudSkill
.
getSkillType
())){
PcloudResource
pcloudResource
=
resourceMap
.
get
(
pcloudSkill
.
getRelSkillId
());
if
(
pcloudResource
!=
null
){
pcloudSkill
.
setTitle
(
pcloudResource
.
getName
());
pcloudSkill
.
setDetail
(
pcloudResource
.
getDescription
());
}
}
}
}
@ParamLog
(
"填充标题简介集合"
)
private
void
fillTitleAndDetail
(
PcloudSkill
pcloudSkill
)
{
if
(
SkillTypeEnum
.
TIME_MANAGE
.
value
.
equals
(
pcloudSkill
.
getSkillType
())){
Map
<
Integer
,
TaskDto
>
taskDtoMap
=
taskMapper
.
mapByIds
(
Arrays
.
asList
(
pcloudSkill
.
getRelSkillId
().
intValue
()));
TaskDto
taskDto
=
taskDtoMap
.
get
(
pcloudSkill
.
getRelSkillId
().
intValue
());
if
(
taskDto
!=
null
){
pcloudSkill
.
setTitle
(
taskDto
.
getTaskName
());
pcloudSkill
.
setDetail
(
taskDto
.
getTaskIntroduce
());
}
}
if
(
SkillTypeEnum
.
READING
.
value
.
equals
(
pcloudSkill
.
getSkillType
())){
Map
<
Long
,
PcloudGroupActivity
>
activityMap
=
pcloudGroupActivityDao
.
mayByIds
(
Arrays
.
asList
(
pcloudSkill
.
getRelSkillId
()));
PcloudGroupActivity
groupActivity
=
activityMap
.
get
(
pcloudSkill
.
getRelSkillId
());
if
(
groupActivity
!=
null
){
pcloudSkill
.
setTitle
(
groupActivity
.
getName
());
pcloudSkill
.
setDetail
(
groupActivity
.
getDesc
());
}
}
if
(
SkillTypeEnum
.
RESOURCE
.
value
.
equals
(
pcloudSkill
.
getSkillType
())){
Map
<
Long
,
PcloudResource
>
resourceMap
=
pcloudResourceDao
.
mayByIds
(
Arrays
.
asList
(
pcloudSkill
.
getRelSkillId
()));
PcloudResource
pcloudResource
=
resourceMap
.
get
(
pcloudSkill
.
getRelSkillId
());
if
(
pcloudResource
!=
null
){
pcloudSkill
.
setTitle
(
pcloudResource
.
getName
());
pcloudSkill
.
setDetail
(
pcloudResource
.
getDescription
());
}
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"删除技能"
)
@Override
public
void
deletePcloudSkill
(
Long
id
)
{
if
(
id
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数为空!"
);
}
pcloudSkillDao
.
deleteById
(
id
);
pcloudSubReplyDao
.
deleteByPcloudSkillId
(
id
);
}
@Override
@ParamLog
(
"订阅或取消订阅"
)
public
String
setSubscribeState
(
Long
skillId
,
Integer
taskId
,
String
robotWxId
,
String
userWxId
,
Boolean
subState
)
{
PcloudSkill
skill
=
pcloudSkillDao
.
getById
(
skillId
);
if
(
skill
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"技能不存在,订阅失败!"
);
}
ThreadPoolUtils
.
OTHER_THREAD_POOL
.
execute
(()
->
{
// TODO 时间管理任务添加订阅或取消
// 发送订阅回复信息
List
<
PcloudSubReply
>
replyList
=
pcloudSubReplyDao
.
getListByPcloudSkillId
(
skillId
);
List
<
PcloudSubReply
>
subReplyList
;
if
(
subState
)
{
subReplyList
=
replyList
.
stream
().
filter
(
s
->
SubTypeEnum
.
SUCCESS
.
value
.
equals
(
s
.
getSubType
())).
collect
(
Collectors
.
toList
());
}
else
{
subReplyList
=
replyList
.
stream
().
filter
(
s
->
SubTypeEnum
.
CANCEL
.
value
.
equals
(
s
.
getSubType
())).
collect
(
Collectors
.
toList
());
}
this
.
sendSubReplyMessage
(
subReplyList
,
robotWxId
,
userWxId
);
});
return
skill
.
getSkillFuseReply
();
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"修改排序值"
)
@Override
public
void
updateSeqNum
(
PcloudSkill
pcloudSkill
)
{
if
(
pcloudSkill
.
getId
()==
null
||
pcloudSkill
.
getSeqNum
()==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"id和排序值不能为空!"
);
}
pcloudSkillDao
.
updateSeqNum
(
pcloudSkill
.
getId
(),
pcloudSkill
.
getSeqNum
());
}
@Override
public
void
sendResource
(
Integer
id
,
String
wxUserId
,
String
robotId
,
Integer
relSkillId
)
{
PcloudSkill
skill
=
pcloudSkillDao
.
getById
(
id
);
if
(
skill
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"技能不存在,订阅失败!"
);
}
ThreadPoolUtils
.
OTHER_THREAD_POOL
.
execute
(()
->
{
// 发送订阅回复信息
List
<
PcloudSubReply
>
replyList
=
pcloudSubReplyDao
.
getListByPcloudSkillId
(
skill
.
getId
());
List
<
PcloudSubReply
>
subReplyList
;
subReplyList
=
replyList
.
stream
().
filter
(
s
->
SubTypeEnum
.
SUCCESS
.
value
.
equals
(
s
.
getSubType
())).
collect
(
Collectors
.
toList
());
this
.
sendSubReplyMessage
(
subReplyList
,
robotId
,
wxUserId
);
});
}
@ParamLog
(
"填充订阅回复"
)
private
void
fillRelies
(
List
<
PcloudSubReply
>
replies
)
{
if
(
ListUtils
.
isEmpty
(
replies
)){
return
;
}
List
<
Long
>
appIds
=
new
ArrayList
<>();
List
<
Long
>
resourceIds
=
new
ArrayList
<>();
for
(
PcloudSubReply
reply:
replies
){
Integer
type
=
reply
.
getType
();
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
)){
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
reply
.
getServeType
())){
appIds
.
add
(
reply
.
getServeId
());
}
}
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
)){
resourceIds
.
add
(
reply
.
getResourceId
());
}
}
Map
<
Long
,
AppDto
>
appDtoMap
=
new
HashMap
<>();
Map
<
Long
,
ResourceDTO
>
resourceDTOMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
appIds
)){
appDtoMap
=
appConsr
.
getBaseByIds
(
appIds
);
}
if
(!
ListUtils
.
isEmpty
(
resourceIds
)){
resourceDTOMap
=
resourceConsr
.
mapByIds
(
resourceIds
);
}
for
(
PcloudSubReply
reply:
replies
){
Integer
type
=
reply
.
getType
();
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
)){
Long
serveId
=
reply
.
getServeId
();
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
reply
.
getServeType
())){
AppDto
appDto
=
appDtoMap
.
get
(
serveId
);
if
(
appDto
!=
null
){
reply
.
setServePic
(
appDto
.
getSquareImg
());
reply
.
setServeName
(
appDto
.
getTitle
());
reply
.
setServeTypeCode
(
appDto
.
getTypeCode
());
reply
.
setServeTypeName
(
appDto
.
getTypeName
());
}
}
}
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
)){
ResourceDTO
resourceDTO
=
resourceDTOMap
.
get
(
reply
.
getResourceId
());
if
(
resourceDTO
!=
null
){
reply
.
setResourceName
(
resourceDTO
.
getResourceName
());
reply
.
setResourceUrl
(
resourceDTO
.
getFileUrl
());
reply
.
setResourceTypeCode
(
resourceDTO
.
getTypeCode
());
reply
.
setResourceTypeName
(
resourceDTO
.
getTypeName
());
reply
.
setFileType
(
resourceDTO
.
getFileType
());
reply
.
setResourcePdfItems
(
resourceDTO
.
getResourcePdfItems
());
reply
.
setResourceOfficeItemDTOs
(
resourceDTO
.
getResourceOfficeItemDTOs
());
reply
.
setFileSize
(
resourceDTO
.
getFileSize
());
}
}
}
}
@ParamLog
(
"新增订阅回复"
)
private
void
addSuccessReplies
(
PcloudSkill
pcloudSkill
){
List
<
PcloudSubReply
>
successReplies
=
pcloudSkill
.
getSuccessSubReplies
();
if
(
ListUtils
.
isEmpty
(
successReplies
)){
return
;
}
for
(
PcloudSubReply
reply:
successReplies
){
reply
.
setPcloudSkillId
(
pcloudSkill
.
getId
());
}
pcloudSubReplyDao
.
batchInsert
(
successReplies
);
}
@ParamLog
(
"新增取消订阅回复"
)
private
void
addCancelReplies
(
PcloudSkill
pcloudSkill
){
List
<
PcloudSubReply
>
cancelReplies
=
pcloudSkill
.
getCancelSubReplies
();
if
(
ListUtils
.
isEmpty
(
cancelReplies
)){
return
;
}
for
(
PcloudSubReply
reply:
cancelReplies
){
reply
.
setPcloudSkillId
(
pcloudSkill
.
getId
());
}
pcloudSubReplyDao
.
batchInsert
(
cancelReplies
);
}
private
void
sendSubReplyMessage
(
List
<
PcloudSubReply
>
subReplyList
,
String
robotWxId
,
String
userWxId
)
{
this
.
fillRelies
(
subReplyList
);
for
(
PcloudSubReply
reply
:
subReplyList
)
{
Integer
type
=
reply
.
getType
();
GroupRobotDTO
groupRobotDTO
=
wechatGroupConsr
.
getGroupRobotByWxId
(
robotWxId
);
String
ip
=
weixinQrcodeBiz
.
getRobotIpByGeneration
(
groupRobotDTO
.
getVersion
());
if
(
WelcomeReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
reply
.
getContent
());
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
else
if
(
WelcomeReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
sendPicMessageVO
.
setAltId
(
robotWxId
);
sendPicMessageVO
.
setPicUrl
(
reply
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
}
else
if
(
WelcomeReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
SendFileVO
sendFileVO
=
new
SendFileVO
();
sendFileVO
.
setFileUrl
(
reply
.
getResourceUrl
());
sendFileVO
.
setFileName
(
reply
.
getResourceName
());
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setWxId
(
userWxId
);
sendFileVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendFile
(
sendFileVO
);
}
else
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
))
{
Long
serveId
=
reply
.
getServeId
();
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
reply
.
getServeType
()))
{
AppDto
appDto
=
appConsr
.
getBaseById
(
serveId
);
if
(
appDto
!=
null
)
{
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
appDto
.
getChannelId
());
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendArticleMessageVO
.
setAltId
(
robotWxId
);
sendArticleMessageVO
.
setDescription
(
reply
.
getDescription
());
sendArticleMessageVO
.
setWxGroupId
(
userWxId
);
// 处理链接地址
String
endUrl
=
reply
.
getLinkUrl
();
String
linkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
endUrl
);
sendArticleMessageVO
.
setLinkUrl
(
linkUrl
);
sendArticleMessageVO
.
setPicUrl
(
reply
.
getPicUrl
());
sendArticleMessageVO
.
setTitle
(
reply
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
}
}
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/check/PcloudSkillCheck.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
check
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.skill.entity.PcloudSkill
;
import
com.pcloud.book.skill.entity.PcloudSkillGuide
;
import
com.pcloud.book.skill.entity.PcloudSubReply
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
(
"技能参数校验"
)
public
class
PcloudSkillCheck
{
@ParamLog
(
"新增技能参数校验"
)
public
void
createPcloudSkillCheck
(
PcloudSkill
pcloudSkill
)
{
if
(
pcloudSkill
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数为空!"
);
}
if
(
pcloudSkill
.
getSkillType
()==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"技能类型不能为空!"
);
}
if
(
StringUtil
.
isEmpty
(
pcloudSkill
.
getSkillFuseReply
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"聚合页回复不能为空!"
);
}
checkReply
(
pcloudSkill
.
getCancelSubReplies
());
checkReply
(
pcloudSkill
.
getSuccessSubReplies
());
}
private
void
checkReply
(
List
<
PcloudSubReply
>
list
){
if
(
ListUtils
.
isEmpty
(
list
)){
return
;
}
for
(
PcloudSubReply
reply
:
list
){
if
(
reply
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"回复不能为空!"
);
}
if
(
null
==
reply
.
getSubType
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"订阅回复类型不能为空!"
);
}
if
(
null
==
reply
.
getType
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"回复类型不能为空!"
);
}
Integer
type
=
reply
.
getType
();
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
)
&&
StringUtil
.
isEmpty
(
reply
.
getContent
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"内容不能为空!"
);
}
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
)
&&
StringUtil
.
isEmpty
(
reply
.
getPicUrl
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"图片地址不能为空!"
);
}
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
)
&&
(
StringUtil
.
isEmpty
(
reply
.
getServeType
())
||
reply
.
getServeId
()
==
null
||
StringUtil
.
isEmpty
(
reply
.
getLinkUrl
())))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"应用或作品id和类型、链接不能为空!"
);
}
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
)
&&
reply
.
getResourceId
()
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"资源id不能为空!"
);
}
}
}
@ParamLog
(
"修改技能校验"
)
public
void
updatePcloudSkill
(
PcloudSkill
pcloudSkill
)
{
if
(
pcloudSkill
.
getId
()==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"id不能为空!"
);
}
createPcloudSkillCheck
(
pcloudSkill
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/dao/PcloudGroupActivityDao.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
dao
;
import
com.pcloud.book.skill.entity.PcloudGroupActivity
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
import
java.util.Map
;
public
interface
PcloudGroupActivityDao
extends
BaseDao
<
PcloudGroupActivity
>
{
Map
<
Long
,
PcloudGroupActivity
>
mayByIds
(
List
<
Long
>
ids
);
void
updateByPrimaryKeySelective
(
PcloudGroupActivity
entity
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/skill/dao/PcloudResourceDao.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
dao
;
import
com.pcloud.book.skill.entity.PcloudResource
;
import
com.pcloud.book.skill.facade.response.QueryPcloudResponseVO
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
import
java.util.Map
;
public
interface
PcloudResourceDao
extends
BaseDao
<
PcloudResource
>
{
int
deletePcloudResource
(
Long
id
);
QueryPcloudResponseVO
getPcloudResource
(
Long
id
);
Map
<
Long
,
PcloudResource
>
mayByIds
(
List
<
Long
>
ids
);
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/dao/PcloudSkillDao.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
dao
;
import
com.pcloud.book.keywords.entity.RobotSkill4H5
;
import
com.pcloud.book.keywords.entity.TempRobotSkill
;
import
com.pcloud.book.keywords.vo.LabelVO
;
import
com.pcloud.book.skill.entity.PcloudSkill
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
public
interface
PcloudSkillDao
extends
BaseDao
<
PcloudSkill
>
{
void
updateSeqNum
(
Long
id
,
Integer
seqNum
);
List
<
RobotSkill4H5
>
getSkillList4TimeController
(
Integer
type
,
Long
labelId
,
String
wxUserId
);
List
<
RobotSkill4H5
>
getSkillList4Activity
(
Integer
type
,
Long
labelId
);
List
<
RobotSkill4H5
>
getSkillList4Resource
(
Integer
type
,
Long
labelId
);
List
<
Long
>
getLabelList4Activity
(
Integer
type
);
List
<
Long
>
getLabelList4TimeController
(
Integer
type
);
List
<
Long
>
getLabelList4Resource
(
Integer
type
);
Integer
getMaxSeqNum
();
PcloudSkill
getByRelSkillId
(
Integer
relSkillId
);
PcloudSkill
getByRelId
(
Integer
relSkillId
,
Integer
type
);
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/dao/PcloudSkillGuideDao.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
dao
;
import
com.pcloud.book.skill.entity.PcloudSkillGuide
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
public
interface
PcloudSkillGuideDao
extends
BaseDao
<
PcloudSkillGuide
>
{
Integer
batchInsert
(
List
<
PcloudSkillGuide
>
list
);
void
deleteByPcloudSkillId
(
Long
pcloudSkillId
);
List
<
PcloudSkillGuide
>
getListByPcloudSkillId
(
Long
pcloudSkillId
);
List
<
PcloudSkillGuide
>
getListByPcloudSkillIds
(
List
<
Long
>
pcloudSkillIds
);
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/dao/PcloudSubReplyDao.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
dao
;
import
com.pcloud.book.skill.entity.PcloudSubReply
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
public
interface
PcloudSubReplyDao
extends
BaseDao
<
PcloudSubReply
>
{
Integer
batchInsert
(
List
<
PcloudSubReply
>
list
);
void
deleteByPcloudSkillId
(
Long
pcloudSkillId
);
List
<
PcloudSubReply
>
getListByPcloudSkillId
(
Long
pcloudSkillId
);
List
<
PcloudSubReply
>
getListByPcloudSkillIds
(
List
<
Long
>
pcloudSkillIds
);
List
<
PcloudSubReply
>
getBySkillIdAndType
(
Long
skillId
,
Integer
subType
);
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/dao/impl/PcloudGroupActivityDaoImpl.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
dao
.
impl
;
import
com.pcloud.book.skill.dao.PcloudGroupActivityDao
;
import
com.pcloud.book.skill.entity.PcloudGroupActivity
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
@Component
public
class
PcloudGroupActivityDaoImpl
extends
BaseDaoImpl
<
PcloudGroupActivity
>
implements
PcloudGroupActivityDao
{
@Override
public
Map
<
Long
,
PcloudGroupActivity
>
mayByIds
(
List
<
Long
>
ids
)
{
return
super
.
getSqlSession
().
selectMap
(
getStatement
(
"mayByIds"
),
ids
,
"id"
);
}
@Override
public
void
updateByPrimaryKeySelective
(
PcloudGroupActivity
entity
)
{
this
.
getSqlSession
().
update
(
"com.pcloud.book.skill.dao.impl.PcloudGroupActivityDaoImpl.updateByPrimaryKeySelective"
,
entity
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/dao/impl/PcloudResourceDaoImpl.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
dao
.
impl
;
import
com.pcloud.book.skill.dao.PcloudResourceDao
;
import
com.pcloud.book.skill.entity.PcloudResource
;
import
com.pcloud.book.skill.facade.response.QueryPcloudResponseVO
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Map
;
@Repository
(
"pcloudResourceDao"
)
public
class
PcloudResourceDaoImpl
extends
BaseDaoImpl
<
PcloudResource
>
implements
PcloudResourceDao
{
@Override
public
int
deletePcloudResource
(
Long
id
)
{
return
super
.
getSqlSession
().
update
(
getStatement
(
"deletePcloudResource"
),
id
);
}
@Override
public
QueryPcloudResponseVO
getPcloudResource
(
Long
id
)
{
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getPcloudResource"
),
id
);
}
@Override
public
Map
<
Long
,
PcloudResource
>
mayByIds
(
List
<
Long
>
ids
)
{
return
super
.
getSqlSession
().
selectMap
(
getStatement
(
"mayByIds"
),
ids
,
"id"
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/dao/impl/PcloudSkillDaoImpl.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
dao
.
impl
;
import
com.pcloud.book.keywords.entity.RobotSkill4H5
;
import
com.pcloud.book.skill.dao.PcloudSkillDao
;
import
com.pcloud.book.skill.entity.PcloudSkill
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Component
(
"pcloudSkillDao"
)
public
class
PcloudSkillDaoImpl
extends
BaseDaoImpl
<
PcloudSkill
>
implements
PcloudSkillDao
{
@Override
public
void
updateSeqNum
(
Long
id
,
Integer
seqNum
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
id
);
map
.
put
(
"seqNum"
,
seqNum
);
super
.
getSqlSession
().
selectList
(
getStatement
(
"updateSeqNum"
),
map
);
}
@Override
public
Integer
getMaxSeqNum
()
{
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getMaxSeqNum"
));
}
@Override
public
PcloudSkill
getByRelSkillId
(
Integer
relSkillId
)
{
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getByRelSkillId"
),
relSkillId
);
}
@Override
public
List
<
RobotSkill4H5
>
getSkillList4TimeController
(
Integer
type
,
Long
labelId
,
String
wxUserId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
type
);
map
.
put
(
"labelId"
,
labelId
);
map
.
put
(
"wxUserId"
,
wxUserId
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getSkillList4TimeController"
),
map
);
}
@Override
public
List
<
RobotSkill4H5
>
getSkillList4Activity
(
Integer
type
,
Long
labelId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
type
);
map
.
put
(
"labelId"
,
labelId
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getSkillList4Activity"
),
map
);
}
@Override
public
List
<
RobotSkill4H5
>
getSkillList4Resource
(
Integer
type
,
Long
labelId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
type
);
map
.
put
(
"labelId"
,
labelId
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getSkillList4Resource"
),
map
);
}
@Override
public
List
<
Long
>
getLabelList4Activity
(
Integer
type
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getLabelList4Activity"
),
type
);
}
@Override
public
List
<
Long
>
getLabelList4TimeController
(
Integer
type
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getLabelList4TimeController"
),
type
);
}
@Override
public
List
<
Long
>
getLabelList4Resource
(
Integer
type
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getLabelList4Resource"
),
type
);
}
@Override
public
PcloudSkill
getByRelId
(
Integer
relSkillId
,
Integer
type
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"relSkillId"
,
relSkillId
);
paramMap
.
put
(
"type"
,
type
);
return
getSqlSession
().
selectOne
(
getStatement
(
"getByRelId"
),
paramMap
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/dao/impl/PcloudSkillGuideDaoImpl.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
dao
.
impl
;
import
com.pcloud.book.skill.dao.PcloudSkillGuideDao
;
import
com.pcloud.book.skill.entity.PcloudSkillGuide
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Component
(
"pcloudSkillGuideDao"
)
public
class
PcloudSkillGuideDaoImpl
extends
BaseDaoImpl
<
PcloudSkillGuide
>
implements
PcloudSkillGuideDao
{
@Override
public
Integer
batchInsert
(
List
<
PcloudSkillGuide
>
list
)
{
return
super
.
getSqlSession
().
insert
(
getStatement
(
"batchInsert"
),
list
);
}
@Override
public
void
deleteByPcloudSkillId
(
Long
pcloudSkillId
)
{
super
.
getSqlSession
().
delete
(
getStatement
(
"deleteByPcloudSkillId"
),
pcloudSkillId
);
}
@Override
public
List
<
PcloudSkillGuide
>
getListByPcloudSkillId
(
Long
pcloudSkillId
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getListByPcloudSkillId"
),
pcloudSkillId
);
}
@Override
public
List
<
PcloudSkillGuide
>
getListByPcloudSkillIds
(
List
<
Long
>
pcloudSkillIds
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"pcloudSkillIds"
,
pcloudSkillIds
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getListByPcloudSkillIds"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/dao/impl/PcloudSubReplyDaoImpl.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
dao
.
impl
;
import
com.pcloud.book.skill.dao.PcloudSubReplyDao
;
import
com.pcloud.book.skill.entity.PcloudSubReply
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Component
(
"pcloudSubReplyDao"
)
public
class
PcloudSubReplyDaoImpl
extends
BaseDaoImpl
<
PcloudSubReply
>
implements
PcloudSubReplyDao
{
@Override
public
Integer
batchInsert
(
List
<
PcloudSubReply
>
list
)
{
return
super
.
getSqlSession
().
insert
(
getStatement
(
"batchInsert"
),
list
);
}
@Override
public
void
deleteByPcloudSkillId
(
Long
pcloudSkillId
)
{
super
.
getSqlSession
().
delete
(
getStatement
(
"deleteByPcloudSkillId"
),
pcloudSkillId
);
}
@Override
public
List
<
PcloudSubReply
>
getListByPcloudSkillId
(
Long
pcloudSkillId
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getListByPcloudSkillId"
),
pcloudSkillId
);
}
@Override
public
List
<
PcloudSubReply
>
getListByPcloudSkillIds
(
List
<
Long
>
pcloudSkillIds
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"pcloudSkillIds"
,
pcloudSkillIds
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getListByPcloudSkillIds"
),
map
);
}
@Override
public
List
<
PcloudSubReply
>
getBySkillIdAndType
(
Long
skillId
,
Integer
subType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"skillId"
,
skillId
);
map
.
put
(
"subType"
,
subType
);
return
getSqlSession
().
selectList
(
getStatement
(
"getBySkillIdAndType"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/entity/PcloudGroupActivity.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
public
class
PcloudGroupActivity
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
-
2579070770051745966L
;
private
String
name
;
private
String
desc
;
private
String
groupPic
;
private
Integer
joinType
;
private
Long
proLabelId
;
private
Long
depLabelId
;
private
Long
purLabelId
;
private
Long
bookGroupQrcodeId
;
private
String
groupName
;
private
Long
createUser
;
private
Long
updateUser
;
private
Integer
isDelete
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
String
getGroupPic
()
{
return
groupPic
;
}
public
void
setGroupPic
(
String
groupPic
)
{
this
.
groupPic
=
groupPic
;
}
public
Integer
getJoinType
()
{
return
joinType
;
}
public
void
setJoinType
(
Integer
joinType
)
{
this
.
joinType
=
joinType
;
}
public
Long
getProLabelId
()
{
return
proLabelId
;
}
public
void
setProLabelId
(
Long
proLabelId
)
{
this
.
proLabelId
=
proLabelId
;
}
public
Long
getDepLabelId
()
{
return
depLabelId
;
}
public
void
setDepLabelId
(
Long
depLabelId
)
{
this
.
depLabelId
=
depLabelId
;
}
public
Long
getPurLabelId
()
{
return
purLabelId
;
}
public
void
setPurLabelId
(
Long
purLabelId
)
{
this
.
purLabelId
=
purLabelId
;
}
public
Long
getBookGroupQrcodeId
()
{
return
bookGroupQrcodeId
;
}
public
void
setBookGroupQrcodeId
(
Long
bookGroupQrcodeId
)
{
this
.
bookGroupQrcodeId
=
bookGroupQrcodeId
;
}
public
String
getGroupName
()
{
return
groupName
;
}
public
void
setGroupName
(
String
groupName
)
{
this
.
groupName
=
groupName
;
}
public
Long
getCreateUser
()
{
return
createUser
;
}
public
void
setCreateUser
(
Long
createUser
)
{
this
.
createUser
=
createUser
;
}
public
Long
getUpdateUser
()
{
return
updateUser
;
}
public
void
setUpdateUser
(
Long
updateUser
)
{
this
.
updateUser
=
updateUser
;
}
public
Integer
getIsDelete
()
{
return
isDelete
;
}
public
void
setIsDelete
(
Integer
isDelete
)
{
this
.
isDelete
=
isDelete
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/skill/entity/PcloudResource.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
@ApiModel
(
"配置资源"
)
@Data
public
class
PcloudResource
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
4051799074529645657L
;
@ApiModelProperty
(
"资源名称"
)
private
String
name
;
@ApiModelProperty
(
"资源介绍"
)
private
String
description
;
@ApiModelProperty
(
"专业"
)
private
Long
proLabelId
;
@ApiModelProperty
(
"深度"
)
private
Long
depLabelId
;
@ApiModelProperty
(
"目的"
)
private
Long
purLabelId
;
@ApiModelProperty
(
"创建人"
)
private
Long
createUser
;
private
Integer
isDelete
;
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/entity/PcloudResourceItem.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@ApiModel
(
"配置资源"
)
@Data
public
class
PcloudResourceItem
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
4051799074529645657L
;
@ApiModelProperty
(
"资源名称"
)
private
String
name
;
@ApiModelProperty
(
"资源介绍"
)
private
String
desc
;
@ApiModelProperty
(
"创建人"
)
private
Long
createUser
;
private
Integer
isDelete
;
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/entity/PcloudSkill.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
@ApiModel
(
"平台端技能"
)
@Data
public
class
PcloudSkill
extends
BaseEntity
{
@ApiModelProperty
(
"技能类型:1时间管理,2共读活动,3配套资料,4教辅书单,5配套老师,6音乐"
)
private
Integer
skillType
;
@ApiModelProperty
(
"具体关联技能id"
)
private
Long
relSkillId
;
@ApiModelProperty
(
"成功订阅回复集合"
)
private
List
<
PcloudSubReply
>
successSubReplies
;
@ApiModelProperty
(
"取消订阅回复集合"
)
private
List
<
PcloudSubReply
>
cancelSubReplies
;
@ApiModelProperty
(
"技能融合页回复"
)
private
String
skillFuseReply
;
@ApiModelProperty
(
"排序值"
)
private
Integer
seqNum
;
@ApiModelProperty
(
"技能标题"
)
private
String
title
;
@ApiModelProperty
(
"技能简介"
)
private
String
detail
;
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/entity/PcloudSkillGuide.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@ApiModel
(
"技能关联引导语"
)
@Data
public
class
PcloudSkillGuide
extends
BaseEntity
{
@ApiModelProperty
(
"技能id"
)
private
Long
pcloudSkillId
;
@ApiModelProperty
(
"引导语id"
)
private
Long
guideId
;
@ApiModelProperty
(
"导语名称"
)
private
String
guideName
;
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/entity/PcloudSubReply.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
com.pcloud.contentcenter.resource.dto.ResourceOfficeItemDTO
;
import
com.pcloud.contentcenter.resource.dto.ResourcePdfItemDTO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
@Data
@ApiModel
(
"订阅回复"
)
public
class
PcloudSubReply
extends
BaseEntity
{
@ApiModelProperty
(
"技能id"
)
private
Long
pcloudSkillId
;
@ApiModelProperty
(
"订阅回复类型:1成功,2取消"
)
private
Integer
subType
;
@ApiModelProperty
(
"类型 1 文字 2 图片 3 链接 4应用 5素材"
)
private
Integer
type
;
@ApiModelProperty
(
"内容"
)
private
String
content
;
@ApiModelProperty
(
"描述"
)
private
String
description
;
@ApiModelProperty
(
"链接地址"
)
private
String
linkUrl
;
@ApiModelProperty
(
"图片地址"
)
private
String
picUrl
;
@ApiModelProperty
(
"应用或作品id"
)
private
Long
serveId
;
@ApiModelProperty
(
"应用或作品类型"
)
private
String
serveType
;
@ApiModelProperty
(
"资源id"
)
private
Long
resourceId
;
@ApiModelProperty
(
"创建人"
)
private
Long
createUser
;
@ApiModelProperty
(
"应用或作品图片"
)
private
String
servePic
;
@ApiModelProperty
(
"应用或作品名称"
)
private
String
serveName
;
@ApiModelProperty
(
"应用或作品类型名称"
)
private
String
serveTypeName
;
@ApiModelProperty
(
"应用或作品类型编码"
)
private
String
serveTypeCode
;
@ApiModelProperty
(
"资源链接"
)
private
String
resourceUrl
;
@ApiModelProperty
(
"资源名称"
)
private
String
resourceName
;
@ApiModelProperty
(
"资源类型编码"
)
private
String
resourceTypeCode
;
@ApiModelProperty
(
"资源类型名称"
)
private
String
resourceTypeName
;
@ApiModelProperty
(
"文件类型"
)
private
String
fileType
;
@ApiModelProperty
(
"文件大小"
)
private
Long
fileSize
;
@ApiModelProperty
(
"pdf转码后的单张图片集合"
)
private
List
<
ResourcePdfItemDTO
>
resourcePdfItems
;
@ApiModelProperty
(
"文件转码后的单张图片集合"
)
private
List
<
ResourceOfficeItemDTO
>
resourceOfficeItemDTOs
;
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/enums/SkillTypeEnum.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
enums
;
public
enum
SkillTypeEnum
{
/**
* 1时间管理
*/
TIME_MANAGE
(
1
),
/**
* 2共读活动
*/
READING
(
2
),
/**
* 3配套资料
*/
RESOURCE
(
3
),
/**
* 4教辅书单
*/
TEACH_BOOK
(
4
),
/**
* 5配套老师
*/
TEACHER
(
5
),
/**
* 6音乐
*/
MUSIC
(
6
);
/**
* 值
*/
public
final
Integer
value
;
SkillTypeEnum
(
Integer
value
)
{
this
.
value
=
value
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/enums/SubTypeEnum.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
enums
;
public
enum
SubTypeEnum
{
/**
* 成功订阅
*/
SUCCESS
(
1
),
/**
* 取消订阅
*/
CANCEL
(
2
);
/**
* 值
*/
public
final
Integer
value
;
SubTypeEnum
(
Integer
value
)
{
this
.
value
=
value
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/facade/PcloudGroupActivityFacade.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
facade
;
import
com.pcloud.book.skill.biz.PcloudGroupActivityBiz
;
import
com.pcloud.book.skill.facade.request.QueryGroupActivityRequestVO
;
import
com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO
;
import
com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO
;
import
com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.SessionUtil
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
io.swagger.annotations.ApiModelProperty
;
@RestController
@RequestMapping
(
"groupActivity"
)
public
class
PcloudGroupActivityFacade
{
@Resource
private
PcloudGroupActivityBiz
pcloudGroupActivityBiz
;
@PostMapping
(
"saveGroupActivity"
)
public
ResponseDto
<
Void
>
saveGroupActivity
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
SaveGroupActivityRequestVO
vo
)
throws
PermissionException
{
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
vo
.
setUserId
(
partyId
);
pcloudGroupActivityBiz
.
saveGroupActivity
(
vo
);
return
new
ResponseDto
<>();
}
@PostMapping
(
"updateGroupActivity"
)
public
ResponseDto
<
Void
>
updateGroupActivity
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
UpdateGroupActivityRequestVO
vo
)
throws
PermissionException
{
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
vo
.
setUserId
(
partyId
);
pcloudGroupActivityBiz
.
updateGroupActivity
(
vo
);
return
new
ResponseDto
<>();
}
@GetMapping
(
"deleteGroupActivity"
)
public
ResponseDto
<
Void
>
queryGroupActivity
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"id"
)
Long
id
)
throws
PermissionException
{
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
pcloudGroupActivityBiz
.
deleteGroupActivity
(
id
,
partyId
);
return
new
ResponseDto
<>();
}
@GetMapping
(
"queryGroupActivity"
)
public
ResponseDto
<
PageBeanNew
<
QueryGroupActivityResponseVO
>>
queryGroupActivity
(
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"proLabelId"
,
required
=
false
)
Long
proLabelId
,
@RequestParam
(
value
=
"purLabelId"
,
required
=
false
)
Long
purLabelId
,
@RequestParam
(
value
=
"depLabelId"
,
required
=
false
)
Long
depLabelId
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
){
return
new
ResponseDto
<>(
pcloudGroupActivityBiz
.
queryGroupActivity
(
name
,
proLabelId
,
purLabelId
,
depLabelId
,
numPerPage
,
currentPage
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/facade/PcloudResourceFacade.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
facade
;
import
com.pcloud.book.skill.biz.PcloudResourceBiz
;
import
com.pcloud.book.skill.entity.PcloudResource
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.SessionUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
@Api
(
"技能-配置资源"
)
@RestController
(
"pcloudResourceFacade"
)
@RequestMapping
(
"pcloudResource"
)
public
class
PcloudResourceFacade
{
@Resource
private
PcloudResourceBiz
pcloudResourceBiz
;
@ApiOperation
(
"新增资源"
)
@PostMapping
(
"saveResource"
)
public
ResponseDto
<
Void
>
savePcloudResource
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
PcloudResource
pcloudResource
)
throws
BizException
,
PermissionException
{
pcloudResourceBiz
.
savePcloudResource
(
pcloudResource
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"更新资源"
)
@PostMapping
(
"updatePcloudResource"
)
public
ResponseDto
<
Void
>
updatePcloudResource
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
PcloudResource
pcloudResource
)
throws
BizException
,
PermissionException
{
pcloudResourceBiz
.
updatePcloudResource
(
pcloudResource
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"删除资源"
)
@GetMapping
(
"/deletePcloudResource"
)
public
ResponseDto
<?>
deletePcloudResource
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
"id"
)
@ApiParam
(
"资源id"
)
Long
id
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
pcloudResourceBiz
.
deletePcloudResource
(
id
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取资源"
)
@GetMapping
(
"/getPcloudResource"
)
public
ResponseDto
<?>
getPcloudResource
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
"id"
)
@ApiParam
(
"资源id"
)
Long
id
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
return
new
ResponseDto
<>(
pcloudResourceBiz
.
getPcloudResource
(
id
));
}
@ApiOperation
(
"获取资源列表"
)
@GetMapping
(
"/getPcloudResourceList"
)
public
ResponseDto
<?>
getPcloudResourceList
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
@ApiParam
(
"资源名称"
)
String
name
,
@RequestParam
(
value
=
"proLabelId"
,
required
=
false
)
@ApiParam
(
"专业"
)
Long
proLabelId
,
@RequestParam
(
value
=
"depLabelId"
,
required
=
false
)
@ApiParam
(
"深度"
)
Long
depLabelId
,
@RequestParam
(
value
=
"purLabelId"
,
required
=
false
)
@ApiParam
(
"目的"
)
Long
purLabelId
,
@RequestParam
(
value
=
"currentPage"
,
defaultValue
=
"0"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
defaultValue
=
"10"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
return
new
ResponseDto
<>(
pcloudResourceBiz
.
getPcloudResourceList
(
name
,
proLabelId
,
depLabelId
,
purLabelId
,
currentPage
,
numPerPage
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/facade/PcloudSkillFacade.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
facade
;
import
com.pcloud.book.skill.biz.PcloudSkillBiz
;
import
com.pcloud.book.skill.entity.PcloudSkill
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.SessionUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
@Api
(
"技能"
)
@RestController
(
"pcloudSkillFacade"
)
@RequestMapping
(
"pcloudSkill"
)
public
class
PcloudSkillFacade
{
@Autowired
private
PcloudSkillBiz
pcloudSkillBiz
;
@ApiOperation
(
"新增技能"
)
@PostMapping
(
"/createPcloudSkill"
)
public
ResponseDto
<?>
createPcloudSkill
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestBody
@ApiParam
(
"技能模型"
)
PcloudSkill
pcloudSkill
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
pcloudSkillBiz
.
createPcloudSkill
(
pcloudSkill
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"修改技能"
)
@PostMapping
(
"/updatePcloudSkill"
)
public
ResponseDto
<?>
updatePcloudSkill
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestBody
@ApiParam
(
"技能模型"
)
PcloudSkill
pcloudSkill
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
pcloudSkillBiz
.
updatePcloudSkill
(
pcloudSkill
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取技能"
)
@GetMapping
(
"/getPcloudSkill"
)
public
ResponseDto
<?>
getPcloudSkill
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
"id"
)
@ApiParam
(
"技能模型"
)
Long
id
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
return
new
ResponseDto
<>(
pcloudSkillBiz
.
getPcloudSkill
(
id
));
}
@ApiOperation
(
"获取技能列表"
)
@GetMapping
(
"/getPcloudSkillList"
)
public
ResponseDto
<?>
getPcloudSkillList
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
value
=
"skillType"
,
required
=
false
)
@ApiParam
(
"技能类型:1时间管理,2共读活动,3配套资料,4教辅书单,5配套老师,6音乐"
)
Integer
skillType
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
return
new
ResponseDto
<>(
pcloudSkillBiz
.
getPcloudSkillList
(
skillType
,
currentPage
,
numPerPage
));
}
@ApiOperation
(
"删除技能"
)
@GetMapping
(
"/deletePcloudSkill"
)
public
ResponseDto
<?>
deletePcloudSkill
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
"id"
)
@ApiParam
(
"技能模型"
)
Long
id
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
pcloudSkillBiz
.
deletePcloudSkill
(
id
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
value
=
"订阅回复-H5"
,
httpMethod
=
"GET"
)
@GetMapping
(
"/subscribePlan"
)
public
ResponseDto
<?>
subscribePlan
(
@RequestParam
(
value
=
"skillId"
,
required
=
false
)
Long
skillId
,
@RequestParam
(
value
=
"taskId"
,
required
=
false
)
Integer
taskId
,
@RequestParam
(
value
=
"robotWxId"
,
required
=
false
)
String
robotWxId
,
@RequestParam
(
value
=
"userWxId"
,
required
=
false
)
String
userWxId
)
throws
BizException
{
return
new
ResponseDto
<>(
pcloudSkillBiz
.
setSubscribeState
(
skillId
,
taskId
,
robotWxId
,
userWxId
,
true
));
}
@ApiOperation
(
"修改技能"
)
@PostMapping
(
"/updateSeqNum"
)
public
ResponseDto
<?>
updateSeqNum
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestBody
@ApiParam
(
"技能模型"
)
PcloudSkill
pcloudSkill
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
pcloudSkillBiz
.
updateSeqNum
(
pcloudSkill
);
return
new
ResponseDto
<>();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/facade/request/QueryGroupActivityRequestVO.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
facade
.
request
;
import
com.pcloud.common.entity.BasePageRequestVO
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
public
class
QueryGroupActivityRequestVO
extends
BasePageRequestVO
{
private
static
final
long
serialVersionUID
=
-
8791894022020799857L
;
@ApiModelProperty
(
"活动名称"
)
private
String
name
;
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/facade/request/SaveGroupActivityRequestVO.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
facade
.
request
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.skill.entity.PcloudGroupActivity
;
import
com.pcloud.common.entity.BaseRequestVO
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.util.List
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* 保存共读活动
*/
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@ApiModel
(
"新增共读活动"
)
public
class
SaveGroupActivityRequestVO
extends
BaseRequestVO
{
private
static
final
long
serialVersionUID
=
-
5370056714391879364L
;
@ApiModelProperty
(
"共度名称"
)
private
String
name
;
@ApiModelProperty
(
"描述"
)
private
String
desc
;
@ApiModelProperty
(
"群图片,加群方式为图片时有效"
)
private
String
groupPic
;
@ApiModelProperty
(
"加群类型(0:邀请 1:图片)"
)
private
Integer
joinType
;
@ApiModelProperty
(
"专业标签"
)
private
Long
proLabelId
;
@ApiModelProperty
(
"深度标签"
)
private
Long
depLabelId
;
@ApiModelProperty
(
"目的标签"
)
private
Long
purLabelId
;
@ApiModelProperty
(
"社群码id"
)
private
Long
bookGroupQrcodeId
;
public
void
checkParam
()
{
if
(
StringUtil
.
isBlank
(
this
.
getName
())
||
null
==
this
.
getProLabelId
()
||
null
==
this
.
getDepLabelId
()
||
null
==
this
.
getJoinType
()
||
(
this
.
getJoinType
()
==
1
&&
StringUtil
.
isBlank
(
this
.
getGroupPic
()))
||
null
==
this
.
getPurLabelId
()
||
null
==
this
.
getBookGroupQrcodeId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"请求参数缺失"
);
}
}
/**
* 转换实体映射
*/
public
PcloudGroupActivity
getEntity
()
{
PcloudGroupActivity
pcloudGroupActivity
=
new
PcloudGroupActivity
();
BeanUtils
.
copyProperties
(
this
,
pcloudGroupActivity
);
return
pcloudGroupActivity
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/facade/request/SaveResourceRequestVO.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
facade
.
request
;
import
com.pcloud.common.entity.BaseRequestVO
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
public
class
SaveResourceRequestVO
extends
BaseRequestVO
{
private
static
final
long
serialVersionUID
=
-
5318135618854061242L
;
@ApiModelProperty
(
"资源名称"
)
private
String
name
;
@ApiModelProperty
(
"资源介绍"
)
private
String
desc
;
@ApiModelProperty
(
"专业"
)
private
Integer
proLabelId
;
@ApiModelProperty
(
"深度"
)
private
Integer
depLabelId
;
@ApiModelProperty
(
"目的"
)
private
Integer
purLabelId
;
@ApiModelProperty
(
"创建人"
)
private
Long
createUser
;
private
Integer
isDelete
;
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/facade/request/UpdateGroupActivityRequestVO.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
facade
.
request
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.skill.entity.PcloudGroupActivity
;
import
com.pcloud.common.entity.BaseRequestVO
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.springframework.beans.BeanUtils
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* 修改共读活动
*/
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@ApiModel
(
"修改共读活动"
)
public
class
UpdateGroupActivityRequestVO
extends
BaseRequestVO
{
private
static
final
long
serialVersionUID
=
3642060073527485455L
;
@ApiModelProperty
(
"主键"
)
private
Long
id
;
@ApiModelProperty
(
"共度名称"
)
private
String
name
;
@ApiModelProperty
(
"描述"
)
private
String
desc
;
@ApiModelProperty
(
"群图片,加群方式为图片时有效"
)
private
String
groupPic
;
@ApiModelProperty
(
"加群类型(0:邀请 1:图片)"
)
private
Integer
joinType
;
@ApiModelProperty
(
"专业标签"
)
private
Long
proLabelId
;
@ApiModelProperty
(
"深度标签"
)
private
Long
depLabelId
;
@ApiModelProperty
(
"目的标签"
)
private
Long
purLabelId
;
@ApiModelProperty
(
"社群码id"
)
private
Long
bookGroupQrcodeId
;
public
void
checkParam
()
{
if
(
null
==
id
||
StringUtil
.
isBlank
(
this
.
getName
())
||
null
==
this
.
getProLabelId
()
||
null
==
this
.
getDepLabelId
()
||
null
==
this
.
getJoinType
()
||
(
this
.
getJoinType
()
==
1
&&
StringUtil
.
isBlank
(
this
.
getGroupPic
()))
||
null
==
this
.
getPurLabelId
()
||
null
==
this
.
getBookGroupQrcodeId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"请求参数缺失"
);
}
}
/**
* 转换实体映射
*/
public
PcloudGroupActivity
getEntity
()
{
PcloudGroupActivity
pcloudGroupActivity
=
new
PcloudGroupActivity
();
BeanUtils
.
copyProperties
(
this
,
pcloudGroupActivity
);
return
pcloudGroupActivity
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/facade/response/QueryGroupActivityResponseVO.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
facade
.
response
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
QueryGroupActivityResponseVO
{
@ApiModelProperty
(
"主键"
)
private
Integer
id
;
@ApiModelProperty
(
"共度名称"
)
private
String
name
;
@ApiModelProperty
(
"描述"
)
private
String
desc
;
@ApiModelProperty
(
"群图片,加群方式为图片时有效"
)
private
String
groupPic
;
@ApiModelProperty
(
"加群类型(0:邀请 1:图片)"
)
private
Integer
joinType
;
@ApiModelProperty
(
"社群码id"
)
private
Long
bookGroupQrcodeId
;
@ApiModelProperty
(
"社群码名称"
)
private
String
groupName
;
@ApiModelProperty
(
"专业标签id"
)
private
Long
proLabelId
;
@ApiModelProperty
(
"专业标签"
)
private
String
proLabelName
;
@ApiModelProperty
(
"深度标签id"
)
private
Long
depLabelId
;
@ApiModelProperty
(
"深度标签"
)
private
String
depLabelName
;
@ApiModelProperty
(
"目的标签id"
)
private
Long
purLabelId
;
@ApiModelProperty
(
"目的标签"
)
private
String
purLabelName
;
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/facade/response/QueryPcloudResponseVO.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
skill
.
facade
.
response
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
QueryPcloudResponseVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1258875813607055164L
;
private
Long
id
;
@ApiModelProperty
(
"资源名称"
)
private
String
name
;
@ApiModelProperty
(
"资源介绍"
)
private
String
description
;
@ApiModelProperty
(
"专业标签id"
)
private
Long
proLabelId
;
@ApiModelProperty
(
"专业标签"
)
private
String
proLabelName
;
@ApiModelProperty
(
"深度标签id"
)
private
Long
depLabelId
;
@ApiModelProperty
(
"深度标签"
)
private
String
depLabelName
;
@ApiModelProperty
(
"目的标签id"
)
private
Long
purLabelId
;
@ApiModelProperty
(
"目的标签"
)
private
String
purLabelName
;
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/BookTaskBindingBiz.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
biz
;
import
com.pcloud.book.timecontrol.vo.BookTaskBindingAddVO
;
import
com.pcloud.book.timecontrol.vo.BookTaskBindingVO
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.List
;
/**
* @author Gui_q
* @since 2020年1月30日 17点25分
*/
public
interface
BookTaskBindingBiz
{
/**
* 创建任务关联书刊
*
* @param bookTaskBindingAddVO
*/
void
create
(
BookTaskBindingAddVO
bookTaskBindingAddVO
);
/**
* 平台获取任务配置发布列表
*
* @return BookTaskBindingVO
*/
PageBeanNew
<
BookTaskBindingVO
>
listBookTaskBinding4Pcloud
(
String
book
,
Integer
proLabelId
,
Integer
depLabelId
,
Integer
purLabelId
,
Integer
currentPage
,
Integer
numPerPage
);
/**
* 批量更新任务配置发布状态
*/
void
batchUpdateBookTaskState
(
List
<
Integer
>
ids
,
Integer
state
);
/**
* 批量删除任务配置发布状态
*/
void
batchDeleteBookTask
(
List
<
Integer
>
ids
);
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/TaskBiz.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
biz
;
import
com.pcloud.book.timecontrol.dto.BookTaskBindingDto
;
import
com.pcloud.book.timecontrol.dto.CreateTaskDto
;
import
com.pcloud.book.timecontrol.dto.CreateTaskItemDto
;
import
com.pcloud.book.timecontrol.dto.LabelDto
;
import
com.pcloud.book.timecontrol.dto.ReplyMessageBaseDto
;
import
com.pcloud.book.timecontrol.dto.TaskDto
;
import
com.pcloud.book.timecontrol.dto.TaskItemDto
;
import
com.pcloud.book.timecontrol.dto.UpdateTaskDto
;
import
com.pcloud.book.timecontrol.dto.UpdateTaskItemDto
;
import
com.pcloud.book.timecontrol.vo.KeyWordTaskVO
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.List
;
/**
* @Description:TODO
* @Author:zcy
* @Date:2020-01-30
* @Version:1.0
*/
public
interface
TaskBiz
{
Integer
createTask
(
CreateTaskDto
createTaskDto
);
void
deleteTask
(
Integer
taskId
);
void
updateTask
(
UpdateTaskDto
updateTaskDto
);
TaskDto
getTaskById
(
Integer
taskId
);
PageBeanNew
<
TaskDto
>
listTask4Pcloud
(
Integer
currentPage
,
Integer
numPerPage
,
String
search
);
Integer
createTaskItem
(
CreateTaskItemDto
createTaskItemDto
);
void
deleteTaskItem
(
Integer
id
);
void
updateTaskItem
(
UpdateTaskItemDto
updateTaskItemDto
);
TaskItemDto
getTaskItem
(
Integer
id
);
List
<
ReplyMessageBaseDto
>
listTaskItemDay
(
Integer
taskId
);
List
<
BookTaskBindingDto
>
listTask
(
String
search
);
List
<
KeyWordTaskVO
>
listKeyWordTask
();
TaskDto
getTaskByKey
(
String
search
,
String
wxUserId
);
List
<
LabelDto
>
listMaxDepLabel
(
Integer
num
);
List
<
TaskDto
>
listTaskByKey4User
(
String
wxUserId
,
String
search
);
List
<
TaskDto
>
listTaskByIds4User
(
String
wxUserId
,
List
<
Integer
>
taskIds
);
List
<
TaskDto
>
listTaskByLabelIds4User
(
String
wxUserId
,
Long
labelId
);
void
finishTaskSend
(
Integer
taskSendId
);
TaskDto
getTaskByIdAndWxUserId
(
Integer
relSkillId
,
String
wxUserId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/TaskSubscribeBiz.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
biz
;
import
com.pcloud.book.timecontrol.entity.TimeControlTaskSubscribe
;
/**
* @date: 2020年01月31日 20:11
* @Author: Zcy
* @Descprition
*/
public
interface
TaskSubscribeBiz
{
/**
* 订阅任务
*/
void
subscribeTask
(
String
wxUserId
,
Long
bookId
,
Integer
taskId
,
String
robotWxId
);
/**
* 取消订阅任务
*/
void
unSubscribeTask
(
String
wxUserId
,
Long
bookId
,
Integer
taskId
);
/**
* 获取今日需要发送任务列表
*/
void
listTodayTask
();
/**
* 定时发送任务消息
*/
void
sendTimeTaskMessage
();
TimeControlTaskSubscribe
getSubscribeState
(
String
wxUserId
,
Integer
taskId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/impl/BookTaskBindingBizImpl.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
biz
.
impl
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.book.service.BookService
;
import
com.pcloud.book.timecontrol.biz.BookTaskBindingBiz
;
import
com.pcloud.book.timecontrol.entity.TimeControlTask
;
import
com.pcloud.book.timecontrol.mapper.BookTaskBindingMapper
;
import
com.pcloud.book.timecontrol.mapper.TimeControlTaskMapper
;
import
com.pcloud.book.timecontrol.mapper.TimeControlTaskSendMapper
;
import
com.pcloud.book.timecontrol.mapper.TimeControlTaskSubscribeMapper
;
import
com.pcloud.book.timecontrol.vo.BookTaskBindingAddVO
;
import
com.pcloud.book.timecontrol.vo.BookTaskBindingVO
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.labelcenter.label.service.LabelService
;
import
com.pcloud.wechatgroup.base.exception.WechatGroupBizException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
/**
* @author Gui_q
* @since 2020年1月30日 17点27分
*/
@Component
(
"bookTaskBindingBiz"
)
@Slf4j
public
class
BookTaskBindingBizImpl
implements
BookTaskBindingBiz
{
@Autowired
private
BookTaskBindingMapper
bookTaskBindingMapper
;
@Autowired
private
BookService
bookService
;
@Autowired
private
TimeControlTaskMapper
timeControlTaskMapper
;
@Autowired
private
LabelService
labelService
;
@Autowired
private
TimeControlTaskSendMapper
timeControlTaskSendMapper
;
@Autowired
private
TimeControlTaskSubscribeMapper
timeControlTaskSubscribeMapper
;
@Override
public
void
create
(
BookTaskBindingAddVO
bookTaskBindingAddVO
)
{
// 查询图书是否与任务模板有过关联
if
(
bookTaskBindingMapper
.
checkHasBinding
(
bookTaskBindingAddVO
.
getBookIds
(),
bookTaskBindingAddVO
.
getTaskId
())
>
0
)
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
PARAM_IS_EXIST
,
"该书刊与任务已存在关联!"
);
}
TimeControlTask
timeControlTask
=
timeControlTaskMapper
.
selectByPrimaryKey
(
bookTaskBindingAddVO
.
getTaskId
());
// 批量查询图书信息
List
<
Integer
>
bookIds
=
bookTaskBindingAddVO
.
getBookIds
();
final
List
<
Long
>
ids
=
bookIds
.
stream
().
map
(
Long:
:
valueOf
).
collect
(
Collectors
.
toList
());
try
{
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
BookDto
>>>
response
=
bookService
.
getListByIds
(
ids
);
Map
<
Long
,
BookDto
>
bookMap
=
ResponseHandleUtil
.
parseMap
(
response
,
Long
.
class
,
BookDto
.
class
);
// 批量插入
bookTaskBindingMapper
.
batchInsert
(
new
ArrayList
<>(
bookMap
.
values
()),
timeControlTask
);
}
catch
(
Exception
e
)
{
log
.
error
(
"bookService.getListByIds 批量获取书籍信息失败"
+
e
.
getMessage
());
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
RESULT_NULL
,
"系统繁忙"
);
}
}
@Override
public
PageBeanNew
<
BookTaskBindingVO
>
listBookTaskBinding4Pcloud
(
String
book
,
Integer
proLabelId
,
Integer
depLabelId
,
Integer
purLabelId
,
Integer
currentPage
,
Integer
numPerPage
)
{
List
<
BookTaskBindingVO
>
list
=
new
ArrayList
<>();
List
<
Integer
>
bookIds
=
null
;
// TODO 1. 根据社群码名称/书刊名称/ISBN/编号查询书籍ID列表
try
{
ResponseEntity
<
ResponseDto
<
List
<
Long
>>>
response
=
bookService
.
getIdsByName
(
book
);
List
<
Long
>
ids
=
ResponseHandleUtil
.
parseList
(
response
,
Long
.
class
);
bookIds
=
ids
.
stream
().
map
(
item
->
Integer
.
valueOf
(
item
.
intValue
())).
collect
(
Collectors
.
toList
());
}
catch
(
Exception
e
)
{
log
.
error
(
"bookService.getListByIds 批量获取书籍信息失败"
+
e
.
getMessage
());
}
Integer
count
=
bookTaskBindingMapper
.
getBookTaskBindingCount
(
bookIds
,
proLabelId
,
depLabelId
,
purLabelId
);
if
(
count
<=
0
)
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
count
,
list
);
}
list
=
bookTaskBindingMapper
.
selectBookTaskBinding4Pcloud
(
bookIds
,
proLabelId
,
depLabelId
,
purLabelId
,
currentPage
*
numPerPage
,
numPerPage
);
String
sendDay
=
DateUtils
.
getReqDate
(
new
Date
());
// 补充统计数据
list
.
forEach
(
item
->
{
item
.
setTaskCount
(
timeControlTaskSubscribeMapper
.
countTaskSubscribe
(
item
.
getTaskId
(),
item
.
getBookId
()));
item
.
setPreSendCount
(
timeControlTaskSendMapper
.
countTodayNotSend
(
item
.
getTaskId
(),
item
.
getBookId
(),
sendDay
));
item
.
setHasSentCount
(
timeControlTaskSendMapper
.
countMsgSend
(
item
.
getTaskId
(),
item
.
getBookId
()));
});
// 封装标签 统计数据
Set
<
Long
>
labelSet
=
new
HashSet
<>();
// 获取所有标签 统一获取标签名称
list
.
forEach
(
item
->
{
labelSet
.
add
(
item
.
getProLabelId
());
labelSet
.
add
(
item
.
getDepLabelId
());
labelSet
.
add
(
item
.
getPurLabelId
());
});
labelSet
.
remove
(
null
);
if
(
labelSet
.
size
()
>
0
)
{
try
{
// 批量获取标签名称
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
String
>>>
response
=
labelService
.
getLabelName
(
new
ArrayList
<>(
labelSet
));
Map
<
Long
,
String
>
labelMap
=
ResponseHandleUtil
.
parseMap
(
response
,
Long
.
class
,
String
.
class
);
// 补充标签名称
list
.
forEach
(
item
->
{
item
.
setProLabelName
(
labelMap
.
get
(
item
.
getProLabelId
()));
item
.
setDepLabelName
(
labelMap
.
get
(
item
.
getDepLabelId
()));
item
.
setPurLabelName
(
labelMap
.
get
(
item
.
getPurLabelId
()));
});
}
catch
(
Exception
e
)
{
log
.
error
(
"labelService.getLabelName 批量获取标签名称失败"
+
e
.
getMessage
());
}
}
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
count
,
list
);
}
@Override
public
void
batchUpdateBookTaskState
(
List
<
Integer
>
ids
,
Integer
state
)
{
bookTaskBindingMapper
.
batchUpdateBookTaskState
(
ids
,
state
);
}
@Override
public
void
batchDeleteBookTask
(
List
<
Integer
>
ids
)
{
bookTaskBindingMapper
.
batchDeleteBookTask
(
ids
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/impl/TaskBizImpl.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
biz
.
impl
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.WeixinQrcodeBiz
;
import
com.pcloud.book.timecontrol.biz.TaskBiz
;
import
com.pcloud.book.timecontrol.biz.TaskSubscribeBiz
;
import
com.pcloud.book.timecontrol.dto.*
;
import
com.pcloud.book.timecontrol.entity.*
;
import
com.pcloud.book.timecontrol.mapper.*
;
import
com.pcloud.book.timecontrol.enums.TaskSendStateEnum
;
import
com.pcloud.book.timecontrol.vo.KeyWordTaskVO
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.labelcenter.label.service.LabelService
;
import
com.pcloud.wechatgroup.base.exception.WechatGroupBizException
;
import
lombok.extern.slf4j.Slf4j
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.sdk.wxgroup.SendFileVO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
/**
* @date: 2020年01月30日 14:20
* @Author: Zcy
* @Descprition
*/
@Slf4j
@Component
(
"taskBiz"
)
public
class
TaskBizImpl
implements
TaskBiz
{
private
final
static
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
TaskBizImpl
.
class
);
@Autowired
private
TimeControlTaskMapper
taskMapper
;
@Autowired
private
TimeControlTaskItemMapper
taskItemMapper
;
@Autowired
private
TimeControlReplyMessageMapper
replyMessageMapper
;
@Autowired
private
BookTaskBindingMapper
bookTaskBindingMapper
;
@Autowired
private
TimeControlTaskSubscribeMapper
taskSubscribeMapper
;
@Autowired
private
TimeControlTaskSendMapper
timeControlTaskSendMapper
;
@Autowired
private
LabelService
labelService
;
@Autowired
private
TaskSubscribeBiz
taskSubscribeBiz
;
//@Autowired
//private PcloudKeywordService pcloudKeywordService;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@Autowired
private
WeixinQrcodeBiz
weixinQrcodeBiz
;
@Override
public
Integer
createTask
(
CreateTaskDto
createTaskDto
)
{
TimeControlTask
timeControlTask
=
new
TimeControlTask
();
BeanUtils
.
copyProperties
(
createTaskDto
,
timeControlTask
);
taskMapper
.
insert
(
timeControlTask
);
return
timeControlTask
.
getTaskId
();
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteTask
(
Integer
taskId
)
{
// 1删除任务模板
taskMapper
.
deleteByPrimaryKey
(
taskId
);
// 2删除书与任务之间的关联关系
bookTaskBindingMapper
.
deleteByTask
(
taskId
);
// 3删除用户对这个任务的订阅关系
taskSubscribeMapper
.
unSubscribeTaskByTaskId
(
taskId
);
//4 取消待发送的任务
timeControlTaskSendMapper
.
cancelSendByTaskId
(
taskId
);
}
@Override
public
void
updateTask
(
UpdateTaskDto
updateTaskDto
)
{
TimeControlTask
timeControlTask
=
new
TimeControlTask
();
BeanUtils
.
copyProperties
(
updateTaskDto
,
timeControlTask
);
taskMapper
.
updateTask
(
timeControlTask
);
//同步任务名称
bookTaskBindingMapper
.
updateTaskName
(
updateTaskDto
.
getTaskId
(),
updateTaskDto
.
getTaskName
());
}
@Override
public
TaskDto
getTaskById
(
Integer
taskId
)
{
TimeControlTask
timeControlTask
=
taskMapper
.
selectByPrimaryKey
(
taskId
);
if
(
null
!=
timeControlTask
)
{
TaskDto
taskDto
=
new
TaskDto
();
BeanUtils
.
copyProperties
(
timeControlTask
,
taskDto
);
return
taskDto
;
}
return
null
;
}
@Override
public
PageBeanNew
<
TaskDto
>
listTask4Pcloud
(
Integer
currentPage
,
Integer
numPerPage
,
String
search
)
{
List
<
TaskDto
>
list
=
new
ArrayList
<>();
Integer
count
=
taskMapper
.
getTaskCount
(
search
);
if
(
count
<=
0
)
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
list
);
}
list
=
taskMapper
.
listTask4Pcloud
(
currentPage
*
numPerPage
,
numPerPage
,
search
);
// 封装标签 统计数据
Set
<
Long
>
labelSet
=
new
HashSet
<>();
// 获取所有标签 统一获取标签名称
list
.
forEach
(
item
->
{
labelSet
.
add
(
item
.
getProLabelId
());
labelSet
.
add
(
item
.
getDepLabelId
());
labelSet
.
add
(
item
.
getPurLabelId
());
});
labelSet
.
remove
(
null
);
if
(
labelSet
.
size
()
>
0
)
{
try
{
// 批量获取标签名称
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
String
>>>
response
=
labelService
.
getLabelName
(
new
ArrayList
<>(
labelSet
));
Map
<
Long
,
String
>
labelMap
=
ResponseHandleUtil
.
parseMap
(
response
,
Long
.
class
,
String
.
class
);
// 补充标签名称
list
.
forEach
(
item
->
{
item
.
setProLabelName
(
labelMap
.
get
(
item
.
getProLabelId
()));
item
.
setDepLabelName
(
labelMap
.
get
(
item
.
getDepLabelId
()));
item
.
setPurLabelName
(
labelMap
.
get
(
item
.
getPurLabelId
()));
});
}
catch
(
Exception
e
)
{
log
.
error
(
"labelService.getLabelName 批量获取标签名称失败"
+
e
.
getMessage
());
}
}
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
count
,
list
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Integer
createTaskItem
(
CreateTaskItemDto
createTaskItemDto
)
{
Integer
taskId
=
createTaskItemDto
.
getTaskId
();
Integer
startDay
=
createTaskItemDto
.
getStartDay
();
TimeControlTask
timeControlTask
=
taskMapper
.
selectByPrimaryKey
(
taskId
);
if
(
null
==
timeControlTask
)
{
return
null
;
}
List
<
CreateReplyMessageDto
>
replyMessageList
=
createTaskItemDto
.
getReplyMessageList
();
if
(
ListUtils
.
isEmpty
(
replyMessageList
))
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
ERROR
,
"请至少填写一条任务提醒"
);
}
if
(
replyMessageList
.
size
()
>
3
)
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
ERROR
,
"至多填写3条任务提醒"
);
}
//检验是否存在当天定时任务
TimeControlTaskItem
item
=
taskItemMapper
.
getByTaskIdAndDay
(
taskId
,
startDay
);
if
(
null
!=
item
)
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
ERROR
,
"已配置过当天消息!"
);
}
List
<
CreateReplyMessageDto
>
completedReplyMessageList
=
createTaskItemDto
.
getCompletedReplyMessageList
();
if
(
null
!=
createTaskItemDto
.
getFinishConfirm
()
&&
createTaskItemDto
.
getFinishConfirm
()==
1
){
if
(
StringUtil
.
isEmpty
(
createTaskItemDto
.
getFinishLinkIntroduce
()))
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
ERROR
,
"任务完成资源封装链接介绍不能为空!"
);
}
if
(
StringUtil
.
isEmpty
(
createTaskItemDto
.
getFinishLinkUrl
()))
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
ERROR
,
"任务完成资源封装链接地址不能为空!"
);
}
if
(
ListUtils
.
isEmpty
(
completedReplyMessageList
))
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
ERROR
,
"请至少填写一条完成任务提醒"
);
}
if
(
completedReplyMessageList
.
size
()
>
4
)
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
ERROR
,
"至多填写3条完成任务提醒"
);
}
}
item
=
new
TimeControlTaskItem
();
BeanUtils
.
copyProperties
(
createTaskItemDto
,
item
);
if
(
null
==
item
.
getFinishConfirm
())
{
item
.
setFinishConfirm
(
0
);
}
if
(
null
==
item
.
getTdConfirm
()){
item
.
setTdConfirm
(
0
);
}
taskItemMapper
.
insert
(
item
);
Integer
taskItemId
=
item
.
getId
();
List
<
TimeControlReplyMessage
>
list
=
new
ArrayList
<>();
replyMessageList
.
forEach
(
message
->
{
TimeControlReplyMessage
replyMessage
=
new
TimeControlReplyMessage
();
BeanUtils
.
copyProperties
(
message
,
replyMessage
);
replyMessage
.
setTaskItemId
(
taskItemId
);
replyMessage
.
setTaskId
(
taskId
);
replyMessage
.
setReplyType
(
0
);
list
.
add
(
replyMessage
);
});
//任务完成回复消息list
if
(
null
!=
createTaskItemDto
.
getFinishConfirm
()
&&
createTaskItemDto
.
getFinishConfirm
()==
1
){
List
<
TimeControlReplyMessage
>
messageList
=
new
ArrayList
<>();
completedReplyMessageList
.
forEach
(
message
->
{
TimeControlReplyMessage
replyMessage
=
new
TimeControlReplyMessage
();
BeanUtils
.
copyProperties
(
message
,
replyMessage
);
replyMessage
.
setTaskItemId
(
taskItemId
);
replyMessage
.
setTaskId
(
taskId
);
replyMessage
.
setReplyType
(
1
);
list
.
add
(
replyMessage
);
});
}
replyMessageMapper
.
batchInsert
(
list
);
return
taskItemId
;
}
@Override
public
void
deleteTaskItem
(
Integer
taskItemId
)
{
taskItemMapper
.
deleteByPrimaryKey
(
taskItemId
);
replyMessageMapper
.
deleteByItemId
(
taskItemId
);
//删除待发送任务
timeControlTaskSendMapper
.
cancelSendByItemId
(
taskItemId
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateTaskItem
(
UpdateTaskItemDto
updateTaskItemDto
)
{
Integer
taskItemId
=
updateTaskItemDto
.
getId
();
TimeControlTaskItem
timeControlTaskItem
=
taskItemMapper
.
selectByPrimaryKey
(
taskItemId
);
if
(
null
==
timeControlTaskItem
)
{
return
;
}
Integer
taskId
=
timeControlTaskItem
.
getTaskId
();
Integer
startDay
=
updateTaskItemDto
.
getStartDay
();
TimeControlTask
timeControlTask
=
taskMapper
.
selectByPrimaryKey
(
taskId
);
if
(
null
==
timeControlTask
)
{
return
;
}
List
<
CreateReplyMessageDto
>
replyMessageList
=
updateTaskItemDto
.
getReplyMessageList
();
if
(
ListUtils
.
isEmpty
(
replyMessageList
))
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
ERROR
,
"请至少填写一条任务提醒"
);
}
if
(
replyMessageList
.
size
()
>
3
)
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
ERROR
,
"至多填写3条任务提醒"
);
}
//检验是否存在当天定时任务
TimeControlTaskItem
item
=
taskItemMapper
.
getByTaskIdAndDay
(
taskId
,
startDay
);
if
(
null
!=
item
&&
!
item
.
getId
().
equals
(
taskItemId
))
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
ERROR
,
"已配置过当天消息!"
);
}
List
<
CreateReplyMessageDto
>
completedReplyMessageList
=
updateTaskItemDto
.
getCompletedReplyMessageList
();
if
(
null
!=
updateTaskItemDto
.
getFinishConfirm
()
&&
updateTaskItemDto
.
getFinishConfirm
()==
1
){
if
(
StringUtil
.
isEmpty
(
updateTaskItemDto
.
getFinishLinkIntroduce
()))
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
ERROR
,
"任务完成资源封装链接介绍不能为空!"
);
}
if
(
StringUtil
.
isEmpty
(
updateTaskItemDto
.
getFinishLinkUrl
()))
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
ERROR
,
"任务完成资源封装链接地址不能为空!"
);
}
if
(
ListUtils
.
isEmpty
(
completedReplyMessageList
))
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
ERROR
,
"请至少填写一条完成任务提醒"
);
}
if
(
completedReplyMessageList
.
size
()
>
4
)
{
throw
new
WechatGroupBizException
(
WechatGroupBizException
.
ERROR
,
"至多填写3条完成任务提醒"
);
}
}
BeanUtils
.
copyProperties
(
updateTaskItemDto
,
timeControlTaskItem
);
if
(
null
==
timeControlTaskItem
.
getFinishConfirm
())
{
timeControlTaskItem
.
setFinishConfirm
(
0
);
}
if
(
null
==
item
.
getTdConfirm
()){
item
.
setTdConfirm
(
0
);
}
taskItemMapper
.
updateTtaskItem
(
timeControlTaskItem
);
//删除原item下的配置
replyMessageMapper
.
deleteByItemId
(
taskItemId
);
//重新插入
List
<
TimeControlReplyMessage
>
list
=
new
ArrayList
<>();
replyMessageList
.
forEach
(
message
->
{
TimeControlReplyMessage
replyMessage
=
new
TimeControlReplyMessage
();
BeanUtils
.
copyProperties
(
message
,
replyMessage
);
replyMessage
.
setTaskItemId
(
taskItemId
);
replyMessage
.
setTaskId
(
taskId
);
replyMessage
.
setReplyType
(
0
);
list
.
add
(
replyMessage
);
});
//任务完成回复消息list
if
(
null
!=
updateTaskItemDto
.
getFinishConfirm
()
&&
updateTaskItemDto
.
getFinishConfirm
()==
1
){
List
<
TimeControlReplyMessage
>
messageList
=
new
ArrayList
<>();
completedReplyMessageList
.
forEach
(
message
->
{
TimeControlReplyMessage
replyMessage
=
new
TimeControlReplyMessage
();
BeanUtils
.
copyProperties
(
message
,
replyMessage
);
replyMessage
.
setTaskItemId
(
taskItemId
);
replyMessage
.
setTaskId
(
taskId
);
replyMessage
.
setReplyType
(
1
);
list
.
add
(
replyMessage
);
});
}
replyMessageMapper
.
batchInsert
(
list
);
}
@Override
public
TaskItemDto
getTaskItem
(
Integer
id
)
{
TaskItemDto
taskItemDto
=
new
TaskItemDto
();
TimeControlTaskItem
timeControlTaskItem
=
taskItemMapper
.
selectByPrimaryKey
(
id
);
if
(
null
==
timeControlTaskItem
)
{
return
taskItemDto
;
}
BeanUtils
.
copyProperties
(
timeControlTaskItem
,
taskItemDto
);
List
<
TimeControlReplyMessage
>
list
=
replyMessageMapper
.
list4TaskItem
(
id
,
0
);
List
<
TimeControlReplyMessage
>
completeReplyMessageList
=
replyMessageMapper
.
list4TaskItem
(
id
,
1
);
List
<
ReplyMessageDto
>
messageDtos
=
new
ArrayList
<>();
if
(!
ListUtils
.
isEmpty
(
list
))
{
list
.
forEach
(
message
->
{
ReplyMessageDto
replyMessageDto
=
new
ReplyMessageDto
();
BeanUtils
.
copyProperties
(
message
,
replyMessageDto
);
messageDtos
.
add
(
replyMessageDto
);
});
}
taskItemDto
.
setReplyMessageList
(
messageDtos
);
//完成任务回复消息List
List
<
ReplyMessageDto
>
completedMessageDtos
=
new
ArrayList
<>();
if
(!
ListUtils
.
isEmpty
(
completeReplyMessageList
)){
completeReplyMessageList
.
forEach
(
message
->
{
ReplyMessageDto
replyMessageDto
=
new
ReplyMessageDto
();
BeanUtils
.
copyProperties
(
message
,
replyMessageDto
);
completedMessageDtos
.
add
(
replyMessageDto
);
});
}
taskItemDto
.
setCompletedReplyMessageList
(
completedMessageDtos
);
return
taskItemDto
;
}
@Override
public
List
<
ReplyMessageBaseDto
>
listTaskItemDay
(
Integer
taskId
)
{
return
taskItemMapper
.
listTaskItemDay
(
taskId
);
}
@Override
public
List
<
BookTaskBindingDto
>
listTask
(
String
search
)
{
List
<
BookTaskBindingDto
>
list
=
taskMapper
.
listTask
(
search
);
if
(!
ListUtils
.
isEmpty
(
list
))
{
// 封装标签 统计数据
Set
<
Long
>
labelSet
=
new
HashSet
<>();
// 获取所有标签 统一获取标签名称
list
.
forEach
(
item
->
{
labelSet
.
add
(
item
.
getProLabelId
());
labelSet
.
add
(
item
.
getDepLabelId
());
labelSet
.
add
(
item
.
getPurLabelId
());
});
labelSet
.
remove
(
null
);
if
(
labelSet
.
size
()
>
0
)
{
// 批量获取标签名称
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
String
>>>
response
=
labelService
.
getLabelName
(
new
ArrayList
<>(
labelSet
));
Map
<
Long
,
String
>
labelMap
=
ResponseHandleUtil
.
parseMap
(
response
,
Long
.
class
,
String
.
class
);
// 补充标签名称
list
.
forEach
(
item
->
{
item
.
setProLabelName
(
labelMap
.
get
(
item
.
getProLabelId
()));
item
.
setDepLabelName
(
labelMap
.
get
(
item
.
getDepLabelId
()));
item
.
setPurLabelName
(
labelMap
.
get
(
item
.
getPurLabelId
()));
});
}
}
return
list
;
}
@Override
public
List
<
KeyWordTaskVO
>
listKeyWordTask
()
{
return
taskMapper
.
listKeyWordTask
();
}
@Override
public
TaskDto
getTaskByKey
(
String
search
,
String
wxUserId
)
{
TaskDto
taskByKey
=
taskMapper
.
getTaskByKey
(
search
);
if
(
taskByKey
!=
null
)
{
taskByKey
.
setSubscribeState
(
taskSubscribeBiz
.
getSubscribeState
(
wxUserId
,
taskByKey
.
getTaskId
()).
getState
());
}
return
taskByKey
;
}
@Override
public
List
<
LabelDto
>
listMaxDepLabel
(
Integer
num
)
{
if
(
null
==
num
)
{
num
=
10
;
}
List
<
Long
>
depLabelIds
=
taskMapper
.
listMaxDepLabel
(
num
);
List
<
LabelDto
>
list
=
new
ArrayList
<>();
if
(!
ListUtils
.
isEmpty
(
depLabelIds
))
{
depLabelIds
.
forEach
(
depLabelId
->
{
LabelDto
labelDto
=
new
LabelDto
();
labelDto
.
setDepLabelId
(
depLabelId
);
String
labelName
=
ResponseHandleUtil
.
parseResponse
(
labelService
.
getLabelName
(
depLabelId
),
String
.
class
);
labelDto
.
setDepLabelName
(
labelName
);
list
.
add
(
labelDto
);
});
}
return
list
;
}
@Override
public
List
<
TaskDto
>
listTaskByKey4User
(
String
wxUserId
,
String
search
)
{
//1根据关键词去查询关联任务ID集合
//List<Long> taskIds = ResponseHandleUtil.parseList(pcloudKeywordService.getTimePlanByGuideKeyword(search),Long.class);
List
<
Long
>
taskIds
=
new
ArrayList
<>();
List
<
TaskDto
>
taskDtoList
=
taskMapper
.
listTaskByKey4User
(
search
,
taskIds
);
if
(!
ListUtils
.
isEmpty
(
taskDtoList
))
{
//封装用户订阅状态
taskDtoList
.
forEach
(
taskDto
->
{
taskDto
.
setSubscribeState
(
taskSubscribeBiz
.
getSubscribeState
(
wxUserId
,
taskDto
.
getTaskId
()).
getState
());
});
}
return
taskDtoList
;
}
@Override
public
List
<
TaskDto
>
listTaskByIds4User
(
String
wxUserId
,
List
<
Integer
>
taskIds
)
{
List
<
TaskDto
>
taskDtoList
=
taskMapper
.
listTaskByIds
(
taskIds
);
if
(!
ListUtils
.
isEmpty
(
taskDtoList
))
{
//封装用户订阅状态
taskDtoList
.
forEach
(
taskDto
->
{
taskDto
.
setSubscribeState
(
taskSubscribeBiz
.
getSubscribeState
(
wxUserId
,
taskDto
.
getTaskId
()).
getState
());
});
}
return
taskDtoList
;
}
@Override
public
List
<
TaskDto
>
listTaskByLabelIds4User
(
String
wxUserId
,
Long
labelId
)
{
List
<
TaskDto
>
taskDtoList
=
taskMapper
.
listTaskByLabelId
(
labelId
);
if
(!
ListUtils
.
isEmpty
(
taskDtoList
))
{
//封装用户订阅状态
taskDtoList
.
forEach
(
taskDto
->
{
taskDto
.
setSubscribeState
(
taskSubscribeBiz
.
getSubscribeState
(
wxUserId
,
taskDto
.
getTaskId
()).
getState
());
});
}
return
taskDtoList
;
}
@Override
@ParamLog
public
void
finishTaskSend
(
Integer
taskSendId
)
{
TimeControlTaskSend
timeControlTaskSend
=
timeControlTaskSendMapper
.
getById
(
taskSendId
);
if
(
null
==
timeControlTaskSend
)
{
return
;
}
if
(!
TaskSendStateEnum
.
FINISH_SEND
.
getState
().
equals
(
timeControlTaskSend
.
getSendState
()))
{
LOGGER
.
info
(
"任务未完成"
);
}
Integer
taskItemId
=
timeControlTaskSend
.
getTaskItemId
();
String
wxUserId
=
timeControlTaskSend
.
getWxUserId
();
TimeControlTaskSubscribe
timeControlTaskSubscribe
=
taskSubscribeMapper
.
getById
(
timeControlTaskSend
.
getSubscribeId
());
String
robotWxId
=
timeControlTaskSubscribe
.
getRobotWxId
();
GroupRobotDTO
groupRobotDTO
=
wechatGroupConsr
.
getGroupRobotByWxId
(
robotWxId
);
String
ip
=
weixinQrcodeBiz
.
getRobotIpByGeneration
(
groupRobotDTO
.
getVersion
());
List
<
TimeControlReplyMessage
>
replyMessages
=
replyMessageMapper
.
list4TaskItem
(
taskItemId
,
1
);
if
(!
ListUtils
.
isEmpty
(
replyMessages
))
{
LOGGER
.
info
(
"發送消息開始"
);
for
(
TimeControlReplyMessage
replyMessage
:
replyMessages
)
{
if
(
replyMessage
!=
null
)
{
switch
(
replyMessage
.
getMessageType
())
{
case
"text"
:
// 发送文本
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
replyMessage
.
getText
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setWxId
(
robotWxId
);
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
break
;
case
"img"
:
// 发送图片
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendPicMessageVO
.
setAltId
(
timeControlTaskSubscribe
.
getRobotWxId
());
sendPicMessageVO
.
setWxGroupId
(
wxUserId
);
sendPicMessageVO
.
setPicUrl
(
replyMessage
.
getImgUrl
());
sendPicMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
break
;
case
"file"
:
// 发送文件
SendFileVO
sendFileVO
=
new
SendFileVO
();
sendFileVO
.
setFileUrl
(
replyMessage
.
getFileUrl
());
sendFileVO
.
setFileName
(
replyMessage
.
getFileName
());
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setWxId
(
wxUserId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
break
;
default
:
break
;
}
}
}
}
timeControlTaskSendMapper
.
updateSendState
(
taskSendId
,
TaskSendStateEnum
.
FINISH_SEND
.
getState
(),
1
);
//每次都要判断一下是否所有单项任务都完成。完成之后需要同步修改关注表里面完成状态
Integer
noCompletedItem
=
timeControlTaskSendMapper
.
getNoCompletedItem
(
timeControlTaskSend
.
getTaskId
());
if
(
noCompletedItem
==
0
){
taskSubscribeMapper
.
completedTaskById
(
timeControlTaskSend
.
getSubscribeId
());
}
}
@Override
public
TaskDto
getTaskByIdAndWxUserId
(
Integer
relSkillId
,
String
wxUserId
)
{
return
taskMapper
.
getTaskByIdAndWxUserId
(
relSkillId
,
wxUserId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/impl/TaskSubscribeBizImpl.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
biz
.
impl
;
import
com.google.common.util.concurrent.ThreadFactoryBuilder
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.WeixinQrcodeBiz
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.skill.dao.PcloudSkillDao
;
import
com.pcloud.book.skill.dao.PcloudSubReplyDao
;
import
com.pcloud.book.skill.entity.PcloudSkill
;
import
com.pcloud.book.skill.entity.PcloudSubReply
;
import
com.pcloud.book.skill.enums.SkillTypeEnum
;
import
com.pcloud.book.skill.enums.SubTypeEnum
;
import
com.pcloud.book.timecontrol.biz.TaskSubscribeBiz
;
import
com.pcloud.book.timecontrol.dto.ReplyMessageBaseDto
;
import
com.pcloud.book.timecontrol.dto.TaskSendDto
;
import
com.pcloud.book.timecontrol.entity.TimeControlReplyMessage
;
import
com.pcloud.book.timecontrol.entity.TimeControlTask
;
import
com.pcloud.book.timecontrol.entity.TimeControlTaskItem
;
import
com.pcloud.book.timecontrol.entity.TimeControlTaskSend
;
import
com.pcloud.book.timecontrol.entity.TimeControlTaskSubscribe
;
import
com.pcloud.book.timecontrol.enums.TaskSendStateEnum
;
import
com.pcloud.book.timecontrol.enums.TaskSubscribeStateEnum
;
import
com.pcloud.book.timecontrol.mapper.TimeControlReplyMessageMapper
;
import
com.pcloud.book.timecontrol.mapper.TimeControlTaskItemMapper
;
import
com.pcloud.book.timecontrol.mapper.TimeControlTaskMapper
;
import
com.pcloud.book.timecontrol.mapper.TimeControlTaskSendMapper
;
import
com.pcloud.book.timecontrol.mapper.TimeControlTaskSubscribeMapper
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.channelcenter.base.constants.ChannelConstants
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.httpclient.UrlUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendFileVO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.ThreadFactory
;
import
java.util.concurrent.ThreadPoolExecutor
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
/**
* @date: 2020年01月31日 20:12
* @Author: Zcy
* @Descprition
*/
@Component
(
"taskSubscribeBiz"
)
public
class
TaskSubscribeBizImpl
implements
TaskSubscribeBiz
{
private
final
static
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
TaskSubscribeBizImpl
.
class
);
private
static
final
ThreadFactory
NAMED_THREAD_FACTORY
=
new
ThreadFactoryBuilder
()
.
setNameFormat
(
"attendancetask-cashbak-pool-%d"
).
build
();
private
static
final
ExecutorService
EXECUTOR_SERVICE
=
new
ThreadPoolExecutor
(
5
,
10
,
0L
,
TimeUnit
.
MILLISECONDS
,
new
LinkedBlockingQueue
<>(
1024
),
NAMED_THREAD_FACTORY
,
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
@Autowired
private
TimeControlTaskSubscribeMapper
taskSubscribeMapper
;
@Autowired
private
TimeControlTaskItemMapper
taskItemMapper
;
@Autowired
private
TimeControlReplyMessageMapper
replyMessageMapper
;
@Autowired
private
TimeControlTaskSendMapper
timeControlTaskSendMapper
;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@Autowired
private
AppConsr
appConsr
;
@Autowired
private
QrcodeSceneConsr
qrcodeSceneConsr
;
@Autowired
private
TimeControlTaskMapper
taskMapper
;
@Autowired
private
ProductConsr
productConsr
;
@Autowired
private
WeixinQrcodeBiz
weixinQrcodeBiz
;
@Autowired
private
PcloudSkillDao
pcloudSkillDao
;
@Autowired
private
PcloudSubReplyDao
pcloudSubReplyDao
;
@Autowired
private
ResourceConsr
resourceConsr
;
@Value
(
"${wechat.group.link.prefix}"
)
private
String
wechatGroupLinkPrefix
;
@Override
@ParamLog
(
"任务订阅"
)
public
void
subscribeTask
(
String
wxUserId
,
Long
bookId
,
Integer
taskId
,
String
robotWxId
)
{
TimeControlTask
timeControlTask
=
taskMapper
.
selectByPrimaryKey
(
taskId
);
if
(
null
==
timeControlTask
)
{
return
;
}
TimeControlTaskSubscribe
taskSubscribe
=
taskSubscribeMapper
.
getSubscribe
(
wxUserId
,
bookId
,
taskId
);
if
(
null
!=
taskSubscribe
)
{
if
(
TaskSubscribeStateEnum
.
FINISH
.
getState
().
equals
(
taskSubscribe
.
getState
()))
{
LOGGER
.
info
(
"任务已完成,直接返回"
);
return
;
}
else
if
(
TaskSubscribeStateEnum
.
SUBSCRIBE
.
getState
().
equals
(
taskSubscribe
.
getState
()))
{
LOGGER
.
info
(
"任务已订阅,直接返回"
);
return
;
}
else
{
//1.改状态
taskSubscribeMapper
.
subscribeTaskExist
(
taskSubscribe
);
}
}
else
{
taskSubscribe
=
new
TimeControlTaskSubscribe
();
taskSubscribe
.
setWxUserId
(
wxUserId
);
taskSubscribe
.
setBookId
(
bookId
);
taskSubscribe
.
setTaskId
(
taskId
);
taskSubscribe
.
setState
(
TaskSubscribeStateEnum
.
SUBSCRIBE
.
getState
());
taskSubscribe
.
setRobotWxId
(
robotWxId
);
taskSubscribeMapper
.
subscribeTask
(
taskSubscribe
);
}
//插入待发送记录
List
<
ReplyMessageBaseDto
>
dayList
=
taskItemMapper
.
listTaskItemDay
(
taskId
);
List
<
TimeControlTaskSend
>
taskSendList
=
new
ArrayList
<>();
if
(!
ListUtils
.
isEmpty
(
dayList
))
{
for
(
ReplyMessageBaseDto
item
:
dayList
)
{
TimeControlTaskSend
taskSend
=
new
TimeControlTaskSend
();
taskSend
.
setWxUserId
(
wxUserId
);
taskSend
.
setBookId
(
bookId
);
taskSend
.
setTaskId
(
taskId
);
taskSend
.
setSubscribeId
(
taskSubscribe
.
getId
());
taskSend
.
setSendState
(
TaskSendStateEnum
.
WAIT_SEND
.
state
);
taskSend
.
setTaskItemId
(
item
.
getId
());
taskSend
.
setSendDay
(
DateUtils
.
getShortDateStr
(
DateUtils
.
addDay
(
new
Date
(),
item
.
getStartDay
())));
taskSendList
.
add
(
taskSend
);
}
LOGGER
.
info
(
"111"
);
timeControlTaskSendMapper
.
batchInsert
(
taskSendList
);
}
//订阅成功个人号回复消息
EXECUTOR_SERVICE
.
execute
(()
->
{
PcloudSkill
pcloudSkill
=
pcloudSkillDao
.
getByRelId
(
taskId
,
SkillTypeEnum
.
TIME_MANAGE
.
value
);
if
(
null
==
pcloudSkill
)
{
return
;
}
List
<
PcloudSubReply
>
bySkillIdAndType
=
pcloudSubReplyDao
.
getBySkillIdAndType
(
pcloudSkill
.
getId
(),
SubTypeEnum
.
SUCCESS
.
value
);
GroupRobotDTO
groupRobotDTO
=
wechatGroupConsr
.
getGroupRobotByWxId
(
robotWxId
);
String
ip
=
weixinQrcodeBiz
.
getRobotIpByGeneration
(
groupRobotDTO
.
getVersion
());
if
(!
ListUtils
.
isEmpty
(
bySkillIdAndType
))
{
bySkillIdAndType
.
forEach
(
pcloudSubReply
->
{
sendReply
(
pcloudSubReply
,
wxUserId
,
robotWxId
,
ip
);
});
}
});
LOGGER
.
info
(
"222"
);
}
@ParamLog
private
void
sendReply
(
PcloudSubReply
pcloudSubReply
,
String
userWxId
,
String
robotWxId
,
String
ip
)
{
Integer
type
=
pcloudSubReply
.
getType
();
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
type
))
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
pcloudSubReply
.
getContent
());
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setWxGroupId
(
userWxId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
1
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
type
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setWxGroupId
(
userWxId
);
sendPicMessageVO
.
setAltId
(
robotWxId
);
sendPicMessageVO
.
setPicUrl
(
pcloudSubReply
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
1
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
}
if
(
ReplyTypeEnum
.
LINK
.
value
.
equals
(
type
))
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setCode
(
1
);
sendArticleMessageVO
.
setAltId
(
robotWxId
);
sendArticleMessageVO
.
setDescription
(
pcloudSubReply
.
getDescription
());
sendArticleMessageVO
.
setWxGroupId
(
userWxId
);
sendArticleMessageVO
.
setLinkUrl
(
pcloudSubReply
.
getLinkUrl
());
sendArticleMessageVO
.
setPicUrl
(
pcloudSubReply
.
getPicUrl
());
sendArticleMessageVO
.
setTitle
(
pcloudSubReply
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
}
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
))
{
SendFileVO
sendFileVO
=
new
SendFileVO
();
Map
<
Long
,
ResourceDTO
>
map
=
resourceConsr
.
mapByIds
(
Arrays
.
asList
(
pcloudSubReply
.
getResourceId
()));
ResourceDTO
resourceDTO
=
map
.
get
(
pcloudSubReply
.
getResourceId
());
if
(
resourceDTO
!=
null
)
{
sendFileVO
.
setFileUrl
(
resourceDTO
.
getFileUrl
());
String
fileName
=
resourceDTO
.
getResourceName
();
String
fileType
=
resourceDTO
.
getFileType
();
if
(
fileName
.
contains
(
fileType
))
{
//去掉后缀
fileName
=
fileName
.
substring
(
0
,
fileName
.
indexOf
(
fileType
)
-
1
);
}
sendFileVO
.
setFileName
(
fileName
);
}
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setWxId
(
userWxId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
}
}
@Override
@ParamLog
(
"取消订阅"
)
public
void
unSubscribeTask
(
String
wxUserId
,
Long
bookId
,
Integer
taskId
)
{
TimeControlTask
timeControlTask
=
taskMapper
.
selectByPrimaryKey
(
taskId
);
if
(
null
==
timeControlTask
)
{
return
;
}
TimeControlTaskSubscribe
taskSubscribe
=
taskSubscribeMapper
.
getSubscribe
(
wxUserId
,
bookId
,
taskId
);
LOGGER
.
info
(
"taskSubscribe = "
+
taskSubscribe
);
if
(
null
!=
taskSubscribe
&&
TaskSubscribeStateEnum
.
SUBSCRIBE
.
getState
().
equals
(
taskSubscribe
.
getState
()))
{
taskSubscribe
.
setState
(
TaskSubscribeStateEnum
.
UNSUBSCRIBE
.
getState
());
taskSubscribeMapper
.
unSubscribeTask
(
taskSubscribe
);
//取消订阅的同时需要取消待发送的任务
timeControlTaskSendMapper
.
cancelSend
(
taskSubscribe
.
getId
(),
TaskSendStateEnum
.
CANCEL
.
getState
());
//取消订阅个人号回复消息
EXECUTOR_SERVICE
.
execute
(()
->
{
PcloudSkill
pcloudSkill
=
pcloudSkillDao
.
getByRelId
(
taskId
,
SkillTypeEnum
.
TIME_MANAGE
.
value
);
if
(
null
==
pcloudSkill
)
{
return
;
}
List
<
PcloudSubReply
>
bySkillIdAndType
=
pcloudSubReplyDao
.
getBySkillIdAndType
(
pcloudSkill
.
getId
(),
SubTypeEnum
.
CANCEL
.
value
);
GroupRobotDTO
groupRobotDTO
=
wechatGroupConsr
.
getGroupRobotByWxId
(
taskSubscribe
.
getRobotWxId
());
String
ip
=
weixinQrcodeBiz
.
getRobotIpByGeneration
(
groupRobotDTO
.
getVersion
());
if
(!
ListUtils
.
isEmpty
(
bySkillIdAndType
))
{
bySkillIdAndType
.
forEach
(
pcloudSubReply
->
{
sendReply
(
pcloudSubReply
,
wxUserId
,
taskSubscribe
.
getRobotWxId
(),
ip
);
});
}
});
}
}
@Override
public
void
listTodayTask
()
{
}
@Override
public
void
sendTimeTaskMessage
()
{
List
<
TaskSendDto
>
taskSendList
=
timeControlTaskSendMapper
.
listTodayTask
();
if
(
ListUtils
.
isEmpty
(
taskSendList
)){
return
;
}
Map
<
String
,
List
<
TaskSendDto
>>
collect
=
taskSendList
.
stream
().
collect
(
Collectors
.
groupingBy
(
taskSendDto
->
taskSendDto
.
getWxUserId
()
+
"_"
+
taskSendDto
.
getTaskId
()));
for
(
String
s
:
collect
.
keySet
())
{
sendTaskMsg
(
collect
.
get
(
s
));
}
}
private
void
sendTaskMsg
(
List
<
TaskSendDto
>
taskSendList
)
{
// 判断是否处理过
boolean
success
=
false
;
int
count
=
0
;
for
(
TaskSendDto
sendDto
:
taskSendList
)
{
count
++;
Integer
taskItemId
=
sendDto
.
getTaskItemId
();
TimeControlTaskItem
timeControlTaskItem
=
taskItemMapper
.
selectByPrimaryKey
(
taskItemId
);
if
(
null
==
timeControlTaskItem
)
{
continue
;
}
List
<
TimeControlReplyMessage
>
replyMessages
=
replyMessageMapper
.
list4TaskItem
(
sendDto
.
getTaskItemId
(),
0
);
String
robotWxId
=
sendDto
.
getRobotWxId
();
String
wxUserId
=
sendDto
.
getWxUserId
();
GroupRobotDTO
groupRobotDTO
=
wechatGroupConsr
.
getGroupRobotByWxId
(
robotWxId
);
String
ip
=
weixinQrcodeBiz
.
getRobotIpByGeneration
(
groupRobotDTO
.
getVersion
());
Integer
taskSendId
=
sendDto
.
getId
();
TimeControlTaskSend
timeControlTaskSend
=
timeControlTaskSendMapper
.
getById
(
taskSendId
);
for
(
TimeControlReplyMessage
replyMessage
:
replyMessages
)
{
if
(
replyMessage
!=
null
)
{
switch
(
replyMessage
.
getMessageType
())
{
case
"text"
:
// 发送文本
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
replyMessage
.
getText
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setWxId
(
robotWxId
);
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
break
;
case
"img"
:
// 发送图片
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendPicMessageVO
.
setAltId
(
robotWxId
);
sendPicMessageVO
.
setWxGroupId
(
wxUserId
);
sendPicMessageVO
.
setPicUrl
(
replyMessage
.
getImgUrl
());
sendPicMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
break
;
case
"file"
:
// 发送文件
SendFileVO
sendFileVO
=
new
SendFileVO
();
sendFileVO
.
setFileUrl
(
replyMessage
.
getFileUrl
());
sendFileVO
.
setFileName
(
replyMessage
.
getFileName
());
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setWxId
(
wxUserId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
break
;
case
"app"
:
//发送应用
if
(
replyMessage
.
getAppId
()
!=
null
)
{
AppDto
appDto
=
appConsr
.
getBaseById
(
replyMessage
.
getAppId
().
longValue
());
if
(
appDto
!=
null
)
{
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
appDto
.
getChannelId
());
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendArticleMessageVO
.
setAltId
(
robotWxId
);
sendArticleMessageVO
.
setDescription
(
appDto
.
getTypeName
());
sendArticleMessageVO
.
setWxGroupId
(
wxUserId
);
// 链接地址
String
linkUrl
=
this
.
splitUrl
(
accountSettingDto
,
replyMessage
.
getLinkUrl
());
sendArticleMessageVO
.
setLinkUrl
(
linkUrl
);
sendArticleMessageVO
.
setPicUrl
(
appDto
.
getSquareImg
());
sendArticleMessageVO
.
setTitle
(
appDto
.
getTitle
());
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
}
}
//发送作品
if
(
replyMessage
.
getProductId
()
!=
null
)
{
ProductDto
productDto
=
productConsr
.
getProBaseById
(
replyMessage
.
getProductId
().
longValue
());
Long
channelId
=
productConsr
.
getOneChannelIdByProId
(
replyMessage
.
getProductId
().
longValue
());
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
channelId
);
if
(
productDto
!=
null
&&
accountSettingDto
!=
null
)
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendArticleMessageVO
.
setAltId
(
robotWxId
);
if
(
productDto
.
getProductTypeDto
()
!=
null
)
{
sendArticleMessageVO
.
setDescription
(
productDto
.
getProductTypeDto
().
getTypeName
());
}
sendArticleMessageVO
.
setWxGroupId
(
wxUserId
);
// 处理链接地址
String
linkUrl
=
this
.
splitUrl
(
accountSettingDto
,
replyMessage
.
getLinkUrl
());
sendArticleMessageVO
.
setLinkUrl
(
linkUrl
);
sendArticleMessageVO
.
setPicUrl
(
productDto
.
getCoverImg
());
sendArticleMessageVO
.
setTitle
(
productDto
.
getProductName
());
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
}
}
break
;
default
:
break
;
}
}
}
if
(
YesOrNoEnums
.
YES
.
getValue
().
equals
(
timeControlTaskItem
.
getFinishConfirm
())
||
YesOrNoEnums
.
YES
.
getValue
().
equals
(
timeControlTaskItem
.
getTdConfirm
())){
//封装退订提醒
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setWxId
(
robotWxId
);
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setIp
(
ip
);
String
content
=
""
;
if
(
YesOrNoEnums
.
YES
.
getValue
().
equals
(
timeControlTaskItem
.
getFinishConfirm
()))
{
String
finishLinkUrl
=
timeControlTaskItem
.
getFinishLinkUrl
();
if
(
finishLinkUrl
!=
null
)
{
String
baseUrl
=
wechatGroupLinkPrefix
+
"/link?"
;
finishLinkUrl
=
baseUrl
+
"wxId="
+
wxUserId
+
"&taskSendId="
+
taskSendId
+
"&url="
+
URLEncoder
.
encode
(
finishLinkUrl
);
String
resultUrl
=
UrlUtils
.
getShortUrl4Own
(
finishLinkUrl
);
content
=
content
+
timeControlTaskItem
.
getFinishLinkIntroduce
()
+
"\n"
+
resultUrl
;
}
}
if
(
YesOrNoEnums
.
YES
.
getValue
().
equals
(
timeControlTaskItem
.
getTdConfirm
()))
{
if
(
StringUtil
.
isEmpty
(
content
))
{
content
=
content
+
"如需退订,请回复 TD"
+
sendDto
.
getTaskId
();
}
else
{
content
=
content
+
"\n如需退订,请回复 TD"
+
sendDto
.
getTaskId
();
}
}
sendTextMessageVO
.
setContent
(
content
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
//更新发送状态
Integer
completeState
=
null
;
if
(!
YesOrNoEnums
.
YES
.
getValue
().
equals
(
timeControlTaskItem
.
getFinishConfirm
()))
{
completeState
=
1
;
}
timeControlTaskSendMapper
.
updateSendState
(
sendDto
.
getId
(),
TaskSendStateEnum
.
FINISH_SEND
.
getState
(),
completeState
);
//每次都要判断一下是否所有单项任务都完成。完成之后需要同步修改关注表里面完成状态
if
(
count
==
taskSendList
.
size
())
{
Integer
noCompletedItem
=
timeControlTaskSendMapper
.
getNoCompletedItem
(
timeControlTaskSend
.
getTaskId
());
if
(
noCompletedItem
==
0
)
{
taskSubscribeMapper
.
completedTaskById
(
timeControlTaskSend
.
getSubscribeId
());
}
}
}
}
/**
* 补充退订提示信息
*
* @param replyMessages
*/
private
boolean
fillUnsubscribeInfo
(
List
<
TimeControlReplyMessage
>
replyMessages
,
boolean
lastOne
)
{
boolean
tmp
=
false
;
if
(
replyMessages
.
size
()
==
0
)
{
return
tmp
;
}
boolean
hasText
=
false
;
for
(
TimeControlReplyMessage
replyMessage
:
replyMessages
)
{
if
(
"text"
.
equals
(
replyMessage
.
getMessageType
()))
{
hasText
=
true
;
tmp
=
true
;
replyMessage
.
setText
(
replyMessage
.
getText
()
+
"\n如需退订,请回复 TD"
+
replyMessage
.
getTaskId
());
}
}
if
(
lastOne
&&
!
hasText
)
{
// 不存在文本消息 追加消息进行推送
TimeControlReplyMessage
text
=
TimeControlReplyMessage
.
builder
().
messageType
(
"text"
).
text
(
"如需退订,请回复 TD"
+
replyMessages
.
get
(
0
).
getTaskId
()).
build
();
replyMessages
.
add
(
text
);
}
return
tmp
;
}
@Override
public
TimeControlTaskSubscribe
getSubscribeState
(
String
wxUserId
,
Integer
taskId
)
{
TimeControlTaskSubscribe
timeControlTaskSubscribe
=
taskSubscribeMapper
.
getSubscribe
(
wxUserId
,
null
,
taskId
);
if
(
null
==
timeControlTaskSubscribe
)
{
timeControlTaskSubscribe
=
new
TimeControlTaskSubscribe
();
timeControlTaskSubscribe
.
setTaskId
(
taskId
);
timeControlTaskSubscribe
.
setState
(
TaskSubscribeStateEnum
.
UNSUBSCRIBE
.
getState
());
timeControlTaskSubscribe
.
setWxUserId
(
wxUserId
);
}
return
timeControlTaskSubscribe
;
}
private
String
splitUrl
(
AccountSettingDto
accountSettingDto
,
String
url
)
{
String
protocol
=
accountSettingDto
.
getProtocol
();
if
(
StringUtils
.
isEmpty
(
protocol
))
{
protocol
=
ChannelConstants
.
HTTP
;
}
String
resultUrl
=
""
;
if
(!
StringUtils
.
isEmpty
(
url
))
{
if
(
url
.
startsWith
(
"http"
))
{
return
url
;
}
if
(
url
.
startsWith
(
"*"
))
{
String
endUrl
=
url
.
substring
(
url
.
indexOf
(
"/"
));
if
(
accountSettingDto
.
getRandom
()
==
null
)
{
resultUrl
=
protocol
+
"app."
+
accountSettingDto
.
getFirstDomain
()
+
"/"
+
url
.
substring
(
1
,
url
.
indexOf
(
"/"
))
+
"/W"
+
accountSettingDto
.
getAccountSettingId
()
+
endUrl
;
}
else
{
resultUrl
=
protocol
+
"app"
+
accountSettingDto
.
getRandom
()
+
"."
+
accountSettingDto
.
getFirstDomain
()
+
"/"
+
url
.
substring
(
1
,
url
.
indexOf
(
"/"
))
+
"/W"
+
accountSettingDto
.
getAccountSettingId
()
+
endUrl
;
}
}
else
{
resultUrl
=
protocol
+
accountSettingDto
.
getDomain
()
+
"/W"
+
accountSettingDto
.
getAccountSettingId
()
+
url
;
}
}
return
resultUrl
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/entity/BookTaskBinding.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
entity
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.ToString
;
import
java.util.Date
;
@Builder
@Data
@ToString
public
class
BookTaskBinding
{
private
Integer
id
;
private
Integer
taskId
;
private
String
taskName
;
private
Integer
bookId
;
private
String
bookName
;
private
String
isbn
;
private
Integer
state
;
private
Integer
delete
;
private
Date
createTime
;
private
Date
updateTime
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/entity/TimeControlReplyMessage.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
entity
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
TimeControlReplyMessage
{
private
Integer
id
;
private
Integer
taskId
;
private
Integer
taskItemId
;
private
Integer
replyType
;
private
String
messageType
;
private
String
text
;
private
Integer
appId
;
private
Integer
productId
;
private
String
imgUrl
;
private
String
fileName
;
private
String
fileUrl
;
private
Date
createTime
;
private
Date
updateTime
;
private
String
linkUrl
;
private
String
fileId
;
private
String
fileType
;
private
BigDecimal
size
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/entity/TimeControlTask.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
entity
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
TimeControlTask
{
private
Integer
taskId
;
private
String
taskName
;
private
String
taskIntroduce
;
private
String
taskKeyWord
;
private
String
subscribeWord
;
private
Integer
advancedSetting
;
private
Date
createTime
;
private
Date
updateTime
;
private
Long
depLabelId
;
private
Long
purLabelId
;
private
Long
proLabelId
;
private
String
successSubscribeWord
;
private
String
successUnSubscribeWord
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/entity/TimeControlTaskItem.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
entity
;
import
java.util.Date
;
public
class
TimeControlTaskItem
{
private
Integer
id
;
private
Integer
taskId
;
private
Integer
startDay
;
private
Integer
finishConfirm
;
private
String
finishKeyWord
;
private
Date
createTime
;
private
Date
updateTime
;
private
Integer
tdConfirm
;
private
String
finishLinkIntroduce
;
private
String
finishLinkUrl
;
public
Integer
getTdConfirm
()
{
return
tdConfirm
;
}
public
void
setTdConfirm
(
Integer
tdConfirm
)
{
this
.
tdConfirm
=
tdConfirm
;
}
public
String
getFinishLinkIntroduce
()
{
return
finishLinkIntroduce
;
}
public
void
setFinishLinkIntroduce
(
String
finishLinkIntroduce
)
{
this
.
finishLinkIntroduce
=
finishLinkIntroduce
;
}
public
String
getFinishLinkUrl
()
{
return
finishLinkUrl
;
}
public
void
setFinishLinkUrl
(
String
finishLinkUrl
)
{
this
.
finishLinkUrl
=
finishLinkUrl
;
}
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getTaskId
()
{
return
taskId
;
}
public
void
setTaskId
(
Integer
taskId
)
{
this
.
taskId
=
taskId
;
}
public
Integer
getStartDay
()
{
return
startDay
;
}
public
void
setStartDay
(
Integer
startDay
)
{
this
.
startDay
=
startDay
;
}
public
Integer
getFinishConfirm
()
{
return
finishConfirm
;
}
public
void
setFinishConfirm
(
Integer
finishConfirm
)
{
this
.
finishConfirm
=
finishConfirm
;
}
public
String
getFinishKeyWord
()
{
return
finishKeyWord
;
}
public
void
setFinishKeyWord
(
String
finishKeyWord
)
{
this
.
finishKeyWord
=
finishKeyWord
==
null
?
null
:
finishKeyWord
.
trim
();
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/entity/TimeControlTaskSend.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
entity
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @date: 2020年02月01日 11:04
* @Author: Zcy
* @Descprition
*/
@Data
public
class
TimeControlTaskSend
implements
Serializable
{
private
Integer
id
;
private
String
wxUserId
;
private
Long
bookId
;
private
Integer
taskId
;
private
Integer
taskItemId
;
private
Integer
subscribeId
;
private
String
sendDay
;
private
Date
createTime
;
private
Integer
sendState
;
private
Integer
completeState
;
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/entity/TimeControlTaskSubscribe.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
entity
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @date: 2020年01月31日 20:02
* @Author: Zcy
* @Descprition
*/
@Data
public
class
TimeControlTaskSubscribe
{
private
Integer
id
;
private
String
wxUserId
;
private
Long
bookId
;
private
Integer
taskId
;
private
Integer
state
;
private
Date
createTime
;
private
Date
updateTime
;
private
String
robotWxId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/facade/impl/BookTaskBindingFacade.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
facade
.
impl
;
import
com.pcloud.book.timecontrol.biz.BookTaskBindingBiz
;
import
com.pcloud.book.timecontrol.vo.BookTaskBindingAddVO
;
import
com.pcloud.book.timecontrol.vo.BookTaskBindingVO
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.SessionUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* 书刊与任务模板绑定关联关系 外部接口
*
* @author Gui_q
* @since 2020年1月30日 14点36分
*/
@Api
(
tags
=
"任务配置发布 外部接口"
)
@RequestMapping
(
value
=
"/bookTaskBinding"
)
@RestController
(
"bookTaskBindingFacadeImpl"
)
public
class
BookTaskBindingFacade
{
@Autowired
private
BookTaskBindingBiz
bookTaskBindingBiz
;
@ApiOperation
(
value
=
"获取任务配置发布列表"
,
httpMethod
=
"GET"
)
@RequestMapping
(
value
=
"/listBookTaskBinding4Pcloud"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<
PageBeanNew
<
BookTaskBindingVO
>>
listBookTaskBinding4Pcloud
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"book"
,
required
=
false
)
String
book
,
@RequestParam
(
value
=
"proLabelId"
,
required
=
false
)
Integer
proLabelId
,
@RequestParam
(
value
=
"depLabelId"
,
required
=
false
)
Integer
depLabelId
,
@RequestParam
(
value
=
"purLabelId"
,
required
=
false
)
Integer
purLabelId
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
PageBeanNew
<
BookTaskBindingVO
>
result
=
bookTaskBindingBiz
.
listBookTaskBinding4Pcloud
(
book
,
proLabelId
,
depLabelId
,
purLabelId
,
currentPage
,
numPerPage
);
return
new
ResponseDto
<>(
result
);
}
@ApiOperation
(
value
=
"批量开启任务"
,
httpMethod
=
"POST"
)
@RequestMapping
(
value
=
"/batchStartTask"
,
method
=
RequestMethod
.
POST
)
ResponseDto
<?>
batchStartTask
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
List
<
Integer
>
ids
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
bookTaskBindingBiz
.
batchUpdateBookTaskState
(
ids
,
1
);
return
new
ResponseDto
<>(
null
);
}
@ApiOperation
(
value
=
"批量关闭任务"
,
httpMethod
=
"POST"
)
@RequestMapping
(
value
=
"/batchCloseTask"
,
method
=
RequestMethod
.
POST
)
ResponseDto
<?>
batchCloseTask
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
List
<
Integer
>
ids
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
bookTaskBindingBiz
.
batchUpdateBookTaskState
(
ids
,
0
);
return
new
ResponseDto
<>(
null
);
}
@ApiOperation
(
value
=
"批量删除任务"
,
httpMethod
=
"POST"
)
@RequestMapping
(
value
=
"/batchDeleteTask"
,
method
=
RequestMethod
.
POST
)
ResponseDto
<?>
batchDeleteTask
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
List
<
Integer
>
ids
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
bookTaskBindingBiz
.
batchDeleteBookTask
(
ids
);
return
new
ResponseDto
<>(
null
);
}
@ApiOperation
(
value
=
"创建任务关联书刊"
,
httpMethod
=
"POST"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
ResponseDto
<?>
create
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
BookTaskBindingAddVO
bookTaskBindingAddVO
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
bookTaskBindingBiz
.
create
(
bookTaskBindingAddVO
);
return
new
ResponseDto
<>(
null
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/facade/impl/TimeControlTaskFacadeImpl.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
facade
.
impl
;
import
com.pcloud.book.timecontrol.biz.TaskBiz
;
import
com.pcloud.book.timecontrol.biz.TaskSubscribeBiz
;
import
com.pcloud.book.timecontrol.entity.TimeControlTaskSubscribe
;
import
com.pcloud.book.timecontrol.vo.KeyWordTaskVO
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.book.timecontrol.dto.CreateTaskDto
;
import
com.pcloud.book.timecontrol.dto.CreateTaskItemDto
;
import
com.pcloud.book.timecontrol.dto.ReplyMessageBaseDto
;
import
com.pcloud.book.timecontrol.dto.TaskDto
;
import
com.pcloud.book.timecontrol.dto.UpdateTaskDto
;
import
com.pcloud.book.timecontrol.dto.UpdateTaskItemDto
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* @date: 2020年01月30日 11:29
* @Author: Zcy
* @Descprition
*/
@Api
(
value
=
"时间管理任务模板配置"
)
@RequestMapping
(
value
=
"/task"
)
@RestController
(
"taskFacade"
)
public
class
TimeControlTaskFacadeImpl
{
@Autowired
private
TaskBiz
taskBiz
;
@Autowired
private
TaskSubscribeBiz
taskSubscribeBiz
;
@PostMapping
(
"createTask"
)
@ApiOperation
(
value
=
"创建任务模板"
,
httpMethod
=
"POST"
)
ResponseDto
<
Integer
>
createTask
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
CreateTaskDto
createTaskDto
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
taskBiz
.
createTask
(
createTaskDto
));
}
@ApiOperation
(
value
=
"删除任务模板"
,
httpMethod
=
"GET"
)
@GetMapping
(
"deleteTask"
)
ResponseDto
<?>
deleteTask
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"taskId"
)
Integer
taskId
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
taskBiz
.
deleteTask
(
taskId
);
return
new
ResponseDto
<>(
taskId
);
}
@PostMapping
(
"updateTask"
)
@ApiOperation
(
value
=
"修改任务模板"
,
httpMethod
=
"POST"
)
ResponseDto
<?>
updateTask
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@Validated
UpdateTaskDto
updateTaskDto
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
taskBiz
.
updateTask
(
updateTaskDto
);
return
new
ResponseDto
<>();
}
@GetMapping
(
"getTask"
)
@ApiOperation
(
value
=
"获取任务信息"
,
httpMethod
=
"GET"
)
ResponseDto
<
TaskDto
>
getTask
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"taskId"
)
Integer
taskId
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
taskBiz
.
getTaskById
(
taskId
));
}
@GetMapping
(
"listTask4Pcloud"
)
@ApiOperation
(
value
=
"平台端查询任务列表"
,
httpMethod
=
"GET"
)
ResponseDto
<
PageBeanNew
<
TaskDto
>>
listTask4Pcloud
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
Integer
currentPage
,
@RequestParam
Integer
numPerPage
,
@RequestParam
(
value
=
"search"
,
required
=
false
)
String
search
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
PageBeanNew
<
TaskDto
>
pageResult
=
taskBiz
.
listTask4Pcloud
(
currentPage
,
numPerPage
,
search
);
return
new
ResponseDto
<>(
pageResult
);
}
@PostMapping
(
"createTaskItem"
)
@ApiOperation
(
value
=
"创建消息配置"
,
httpMethod
=
"POST"
)
ResponseDto
<?>
createTaskItem
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@Validated
CreateTaskItemDto
createTaskItemDto
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
taskBiz
.
createTaskItem
(
createTaskItemDto
));
}
@GetMapping
(
"deleteTaskItem"
)
@ApiOperation
(
value
=
"删除消息配置"
,
httpMethod
=
"GET"
)
ResponseDto
<?>
deleteTaskItem
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
Integer
id
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
taskBiz
.
deleteTaskItem
(
id
);
return
new
ResponseDto
<>();
}
@PostMapping
(
"updateTaskItem"
)
@ApiOperation
(
value
=
"修改消息配置"
,
httpMethod
=
"POST"
)
ResponseDto
<?>
updateTaskItem
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@Validated
UpdateTaskItemDto
updateTaskItemDto
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
taskBiz
.
updateTaskItem
(
updateTaskItemDto
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
value
=
"获取一条消息配置"
,
httpMethod
=
"GET"
)
@GetMapping
(
"getOneTaskItem"
)
ResponseDto
<?>
getOneTaskItem
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
Integer
id
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
taskBiz
.
getTaskItem
(
id
));
}
@ApiOperation
(
value
=
"获取任务模板下所有消息配置天数"
,
httpMethod
=
"GET"
)
@GetMapping
(
"listTaskItemDay"
)
ResponseDto
<?>
listTaskItemDay
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
Integer
taskId
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
List
<
ReplyMessageBaseDto
>
resultList
=
taskBiz
.
listTaskItemDay
(
taskId
);
return
new
ResponseDto
<>(
resultList
);
}
@ApiOperation
(
value
=
"客户端订阅任务"
,
httpMethod
=
"GET"
)
@GetMapping
(
"subscribeTask"
)
ResponseDto
<?>
subscribeTask
(
@RequestParam
String
wxUserId
,
@RequestParam
Integer
taskId
,
@RequestParam
String
robotWxId
)
{
taskSubscribeBiz
.
subscribeTask
(
wxUserId
,
null
,
taskId
,
robotWxId
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
value
=
"取消订阅任务"
,
httpMethod
=
"GET"
)
@GetMapping
(
"unsubscribeTask"
)
ResponseDto
<?>
unsubscribeTask
(
@RequestParam
String
wxUserId
,
@RequestParam
Integer
taskId
)
{
taskSubscribeBiz
.
unSubscribeTask
(
wxUserId
,
null
,
taskId
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
value
=
"temp-接口H5技能聚合页面获取读书计划"
,
httpMethod
=
"GET"
)
@GetMapping
(
"listKeyWordTask"
)
ResponseDto
<
List
<
KeyWordTaskVO
>>
listKeyWordTask
(){
List
<
KeyWordTaskVO
>
resultList
=
taskBiz
.
listKeyWordTask
();
return
new
ResponseDto
<>(
resultList
);
}
@ApiOperation
(
value
=
"H5聚合页通过关键词获取任务"
,
httpMethod
=
"GET"
)
@GetMapping
(
"getTaskByKey"
)
ResponseDto
<?>
getTaskByKey
(
@RequestParam
(
"search"
)
String
search
,
@RequestParam
(
"wxUserId"
)
String
wxUserId
){
TaskDto
taskDto
=
taskBiz
.
getTaskByKey
(
search
,
wxUserId
);
return
new
ResponseDto
<>(
taskDto
);
}
@ApiOperation
(
value
=
"查询订阅状态"
,
httpMethod
=
"GET"
)
@GetMapping
(
"getSubscribeState"
)
ResponseDto
<?>
getSubscribeState
(
@RequestParam
String
wxUserId
,
@RequestParam
Integer
taskId
){
TimeControlTaskSubscribe
timeControlTaskSubscribe
=
taskSubscribeBiz
.
getSubscribeState
(
wxUserId
,
taskId
);
return
new
ResponseDto
<>(
timeControlTaskSubscribe
);
}
@ApiOperation
(
value
=
"客户端点击链接完成任务"
,
httpMethod
=
"GET"
)
@GetMapping
(
"finishTaskSend"
)
ResponseDto
<?>
finishTaskSend
(
@RequestParam
(
"taskSendId"
)
Integer
taskSendId
){
taskBiz
.
finishTaskSend
(
taskSendId
);
return
new
ResponseDto
<>();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/mapper/BookTaskBindingMapper.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
mapper
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.timecontrol.entity.BookTaskBinding
;
import
com.pcloud.book.timecontrol.entity.TimeControlTask
;
import
com.pcloud.book.timecontrol.vo.BookTaskBindingVO
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
public
interface
BookTaskBindingMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
BookTaskBinding
record
);
int
insertSelective
(
BookTaskBinding
record
);
BookTaskBinding
selectByPrimaryKey
(
Integer
id
);
int
updateByPrimaryKeySelective
(
BookTaskBinding
record
);
int
updateByPrimaryKey
(
BookTaskBinding
record
);
/**
* 批量新增任务配置发布
*/
int
batchInsert
(
@Param
(
"bookDtos"
)
List
<
BookDto
>
bookDtos
,
@Param
(
"timeControlTask"
)
TimeControlTask
timeControlTask
);
/**
* 获取任务配置发布数量
*/
Integer
getBookTaskBindingCount
(
@Param
(
"bookIds"
)
List
<
Integer
>
bookIds
,
@Param
(
"proLabelId"
)
Integer
proLabelId
,
@Param
(
"depLabelId"
)
Integer
depLabelId
,
@Param
(
"purLabelId"
)
Integer
purLabelId
);
/**
* 分页查询分页配置发布
*/
List
<
BookTaskBindingVO
>
selectBookTaskBinding4Pcloud
(
@Param
(
"bookIds"
)
List
<
Integer
>
bookIds
,
@Param
(
"proLabelId"
)
Integer
proLabelId
,
@Param
(
"depLabelId"
)
Integer
depLabelId
,
@Param
(
"purLabelId"
)
Integer
purLabelId
,
@Param
(
"pageNum"
)
Integer
pageNum
,
@Param
(
"numPerPage"
)
Integer
numPerPage
);
/**
* 批量更新任务配置发布状态
*/
int
batchUpdateBookTaskState
(
@Param
(
"ids"
)
List
<
Integer
>
ids
,
@Param
(
"state"
)
Integer
state
);
/**
* 批量删除任务配置发布
*/
int
batchDeleteBookTask
(
@Param
(
"ids"
)
List
<
Integer
>
ids
);
void
deleteByTask
(
Integer
taskId
);
void
updateTaskName
(
@Param
(
"taskId"
)
Integer
taskId
,
@Param
(
"taskName"
)
String
taskName
);
/**
* 查询图书是否与任务模板有过关联
*/
int
checkHasBinding
(
@Param
(
"bookIds"
)
List
<
Integer
>
bookIds
,
@Param
(
"taskId"
)
Integer
taskId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/mapper/TimeControlReplyMessageMapper.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
mapper
;
import
com.pcloud.book.timecontrol.entity.TimeControlReplyMessage
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
(
"replyMessageMapper"
)
public
interface
TimeControlReplyMessageMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
TimeControlReplyMessage
record
);
int
insertSelective
(
TimeControlReplyMessage
record
);
TimeControlReplyMessage
selectByPrimaryKey
(
Integer
id
);
int
updateByPrimaryKeySelective
(
TimeControlReplyMessage
record
);
int
updateByPrimaryKey
(
TimeControlReplyMessage
record
);
void
batchInsert
(
@Param
(
"list"
)
List
<
TimeControlReplyMessage
>
list
);
void
deleteByItemId
(
Integer
taskItemId
);
List
<
TimeControlReplyMessage
>
list4TaskItem
(
@Param
(
"taskItemId"
)
Integer
taskItemId
,
@Param
(
"replyType"
)
Integer
replyType
);
List
<
TimeControlReplyMessage
>
getByTaskItemId
(
Integer
taskItemId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/mapper/TimeControlTaskItemMapper.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
mapper
;
import
com.pcloud.book.timecontrol.entity.TimeControlTaskItem
;
import
com.pcloud.book.timecontrol.dto.ReplyMessageBaseDto
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
(
"taskItemMapper"
)
public
interface
TimeControlTaskItemMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
TimeControlTaskItem
record
);
TimeControlTaskItem
selectByPrimaryKey
(
Integer
id
);
TimeControlTaskItem
getByTaskIdAndDay
(
@Param
(
"taskId"
)
Integer
taskId
,
@Param
(
"startDay"
)
Integer
startDay
);
void
updateTtaskItem
(
TimeControlTaskItem
timeControlTaskItem
);
List
<
ReplyMessageBaseDto
>
listTaskItemDay
(
Integer
taskId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/mapper/TimeControlTaskMapper.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
mapper
;
import
com.pcloud.book.timecontrol.entity.TimeControlTask
;
import
com.pcloud.book.timecontrol.vo.KeyWordTaskVO
;
import
com.pcloud.book.timecontrol.dto.BookTaskBindingDto
;
import
com.pcloud.book.timecontrol.dto.TaskDto
;
import
org.apache.ibatis.annotations.MapKey
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
@Component
(
"taskMapper"
)
public
interface
TimeControlTaskMapper
{
int
deleteByPrimaryKey
(
Integer
taskId
);
int
insert
(
TimeControlTask
record
);
TimeControlTask
selectByPrimaryKey
(
Integer
taskId
);
void
updateTask
(
TimeControlTask
timeControlTask
);
Integer
getTaskCount
(
@Param
(
"search"
)
String
search
);
List
<
TaskDto
>
listTask4Pcloud
(
@Param
(
"pageNum"
)
Integer
pageNum
,
@Param
(
"numPerPage"
)
Integer
numPerPage
,
@Param
(
"search"
)
String
search
);
/**
* 根据 专业/深度/目的 标签查询任务模板集合
*/
List
<
Integer
>
listIdByLabelId
(
@Param
(
"proLabelId"
)
Integer
proLabelId
,
@Param
(
"depLabelId"
)
Integer
depLabelId
,
@Param
(
"purLabelId"
)
Integer
purLabelId
);
List
<
BookTaskBindingDto
>
listTask
(
@Param
(
"search"
)
String
search
);
@MapKey
(
"taskId"
)
Map
<
Integer
,
TaskDto
>
mapByIds
(
@Param
(
"taskIds"
)
List
<
Integer
>
taskIds
);
List
<
KeyWordTaskVO
>
listKeyWordTask
();
TaskDto
getTaskByKey
(
String
search
);
List
<
Long
>
listMaxDepLabel
(
Integer
num
);
List
<
TaskDto
>
listTaskByKey4User
(
@Param
(
"search"
)
String
search
,
@Param
(
"taskIds"
)
List
<
Long
>
taskIds
);
List
<
TaskDto
>
listTaskByIds
(
@Param
(
"taskIds"
)
List
<
Integer
>
taskIds
);
List
<
TaskDto
>
listTaskByLabelId
(
Long
labelId
);
TaskDto
getTaskByIdAndWxUserId
(
@Param
(
"relSkillId"
)
Integer
relSkillId
,
@Param
(
"wxUserId"
)
String
wxUserId
);
Integer
getSubscribeState
(
@Param
(
"relSkillId"
)
Integer
relSkillId
,
@Param
(
"wxUserId"
)
String
wxUserId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/mapper/TimeControlTaskSendMapper.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
mapper
;
import
com.pcloud.book.timecontrol.entity.TimeControlTaskSend
;
import
com.pcloud.book.timecontrol.dto.TaskSendDto
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* @date: 2020年01月31日 20:05
* @Author: Zcy
* @Descprition
*/
@Component
public
interface
TimeControlTaskSendMapper
{
void
batchInsert
(
List
<
TimeControlTaskSend
>
taskSendList
);
List
<
TaskSendDto
>
listTodayTask
();
void
cancelSend
(
@Param
(
"subscribeId"
)
Integer
subscribeId
,
@Param
(
"sendState"
)
Integer
sendState
);
void
cancelSendByTaskId
(
Integer
taskId
);
void
cancelSendByItemId
(
Integer
taskItemId
);
/**
* 查询已发送消息数
*/
Integer
countMsgSend
(
@Param
(
"taskId"
)
Integer
taskId
,
@Param
(
"bookId"
)
Integer
bookId
);
/**
* 查询今日未发送消息数
*/
Integer
countTodayNotSend
(
@Param
(
"taskId"
)
Integer
taskId
,
@Param
(
"bookId"
)
Integer
bookId
,
@Param
(
"sendDay"
)
String
sendDay
);
void
updateSendState
(
@Param
(
"sendId"
)
Integer
sendId
,
@Param
(
"sendState"
)
Integer
sendState
,
@Param
(
"completeState"
)
Integer
completeState
);
TimeControlTaskSend
getById
(
Integer
taskSendId
);
Integer
getNoCompletedItem
(
Integer
taskId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/mapper/TimeControlTaskSubscribeMapper.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
mapper
;
import
com.pcloud.book.timecontrol.entity.TimeControlTaskSubscribe
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Component
;
/**
* @date: 2020年01月31日 20:05
* @Author: Zcy
* @Descprition
*/
@Component
(
"taskSubscribeMapper"
)
public
interface
TimeControlTaskSubscribeMapper
{
void
subscribeTask
(
TimeControlTaskSubscribe
timeControlTaskSubscribe
);
TimeControlTaskSubscribe
getSubscribe
(
@Param
(
"wxUserId"
)
String
wxUserId
,
@Param
(
"bookId"
)
Long
bookId
,
@Param
(
"taskId"
)
Integer
taskId
);
void
subscribeTaskExist
(
TimeControlTaskSubscribe
taskSubscribe
);
void
unSubscribeTask
(
TimeControlTaskSubscribe
taskSubscribe
);
void
unSubscribeTaskByTaskId
(
Integer
taskId
);
/**
* 查询任务订阅人数
*/
Integer
countTaskSubscribe
(
@Param
(
"taskId"
)
Integer
taskId
,
@Param
(
"bookId"
)
Integer
bookId
);
TimeControlTaskSubscribe
getById
(
Integer
subscribeId
);
void
completedTaskById
(
Integer
subscribeId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/service/impl/TimeControlTaskServiceImpl.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
service
.
impl
;
import
com.pcloud.book.timecontrol.biz.TaskBiz
;
import
com.pcloud.book.timecontrol.biz.TaskSubscribeBiz
;
import
com.pcloud.book.timecontrol.dto.BookTaskBindingDto
;
import
com.pcloud.book.timecontrol.dto.LabelDto
;
import
com.pcloud.book.timecontrol.dto.TaskDto
;
import
com.pcloud.book.timecontrol.mapper.TimeControlTaskMapper
;
import
com.pcloud.book.timecontrol.service.TimeControlTaskService
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
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.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.Map
;
@RestController
(
"timeControlTaskService"
)
@RequestMapping
(
"timeControlTaskService"
)
public
class
TimeControlTaskServiceImpl
implements
TimeControlTaskService
{
@Autowired
private
TaskSubscribeBiz
taskSubscribeBiz
;
@Autowired
private
TaskBiz
taskBiz
;
@Autowired
private
TimeControlTaskMapper
taskMapper
;
@Override
@GetMapping
(
"sendTimeTaskMessage"
)
public
void
sendTimeTaskMessage
()
{
new
Thread
(()
->
{
taskSubscribeBiz
.
sendTimeTaskMessage
();
}).
start
();
}
@Override
@GetMapping
(
"getTaskById"
)
public
ResponseEntity
<
ResponseDto
<
TaskDto
>>
getTaskById
(
@RequestParam
(
value
=
"taskId"
)
Integer
taskId
)
{
return
ResponseHandleUtil
.
toResponse
(
taskBiz
.
getTaskById
(
taskId
));
}
@Override
@GetMapping
(
"listTask"
)
public
ResponseEntity
<
ResponseDto
<
List
<
BookTaskBindingDto
>>>
listTask
(
@RequestParam
(
value
=
"search"
,
required
=
false
)
String
search
)
{
List
<
BookTaskBindingDto
>
list
=
taskBiz
.
listTask
(
search
);
return
ResponseHandleUtil
.
toResponse
(
list
);
}
@Override
@PostMapping
(
"getTaskBatch"
)
public
ResponseEntity
<
ResponseDto
<
Map
<
Integer
,
TaskDto
>>>
getTaskBatch
(
@RequestBody
List
<
Integer
>
taskIds
)
{
return
ResponseHandleUtil
.
toResponse
(
taskMapper
.
mapByIds
(
taskIds
));
}
@Override
@GetMapping
(
"listMaxDepLabel"
)
public
ResponseEntity
<
ResponseDto
<
List
<
LabelDto
>>>
listMaxDepLabel
(
@RequestParam
(
value
=
"num"
,
required
=
false
)
Integer
num
)
{
List
<
LabelDto
>
list
=
taskBiz
.
listMaxDepLabel
(
num
);
return
ResponseHandleUtil
.
toResponse
(
list
);
}
@Override
@GetMapping
(
"listTaskByKey4User"
)
public
ResponseEntity
<
ResponseDto
<
List
<
TaskDto
>>>
listTaskByKey4User
(
@RequestParam
(
"wxUserId"
)
String
wxUserId
,
@RequestParam
(
"search"
)
String
search
)
{
List
<
TaskDto
>
list
=
taskBiz
.
listTaskByKey4User
(
wxUserId
,
search
);
return
ResponseHandleUtil
.
toResponse
(
list
);
}
@Override
@PostMapping
(
"listTaskByIds4User"
)
public
ResponseEntity
<
ResponseDto
<
List
<
TaskDto
>>>
listTaskByIds4User
(
@RequestParam
(
"wxUserId"
)
String
wxUserId
,
@RequestBody
List
<
Integer
>
taskIds
)
{
List
<
TaskDto
>
list
=
taskBiz
.
listTaskByIds4User
(
wxUserId
,
taskIds
);
return
ResponseHandleUtil
.
toResponse
(
list
);
}
@Override
@GetMapping
(
"listTaskByLabelIds4User"
)
public
ResponseEntity
<
ResponseDto
<
List
<
TaskDto
>>>
listTaskByLabelIds4User
(
@RequestParam
(
"wxUserId"
)
String
wxUserId
,
@RequestParam
(
"labelId"
)
Long
labelId
)
{
List
<
TaskDto
>
list
=
taskBiz
.
listTaskByLabelIds4User
(
wxUserId
,
labelId
);
return
ResponseHandleUtil
.
toResponse
(
list
);
}
@Override
@GetMapping
(
"unSubscribeTask"
)
public
void
unSubscribeTask
(
@RequestParam
(
"wxId"
)
String
wxId
,
@RequestParam
(
"taskId"
)
Integer
taskId
)
{
taskSubscribeBiz
.
unSubscribeTask
(
wxId
,
null
,
taskId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/vo/BookTaskBindingAddVO.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
vo
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
BookTaskBindingAddVO
{
List
<
Integer
>
bookIds
;
Integer
taskId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/vo/BookTaskBindingVO.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
BookTaskBindingVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
7515841010418305282L
;
private
Integer
id
;
private
Integer
taskId
;
private
String
taskName
;
private
Integer
bookId
;
private
String
bookName
;
private
String
isbn
;
private
String
serialNumber
;
private
Integer
state
;
private
Long
proLabelId
;
private
String
proLabelName
;
private
Long
depLabelId
;
private
String
depLabelName
;
private
Long
purLabelId
;
private
String
purLabelName
;
private
Integer
taskCount
;
private
Integer
preSendCount
;
private
Integer
hasSentCount
;
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/vo/KeyWordTaskVO.java
0 → 100644
View file @
67cb4c89
package
com
.
pcloud
.
book
.
timecontrol
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @date: 2020年02月03日 12:35
* @Author: Zcy
* @Descprition
*/
@Data
public
class
KeyWordTaskVO
implements
Serializable
{
private
Integer
id
;
private
String
keyWord
;
private
String
guideWord
;
private
Integer
taskId
;
private
String
taskName
;
private
String
taskIntroduce
;
private
String
taskKeyWord
;
private
String
subscribeWord
;
private
Integer
advancedSetting
;
}
pcloud-service-book/src/main/resources/mapper/group/GroupQrcode.Mapper.xml
View file @
67cb4c89
...
...
@@ -48,6 +48,9 @@
a.create_user AS adviserId,
a.group_name AS groupName,
a.qrcode_url AS groupQrcode,
a.user_number as userNumber,
d.dep_label_id as depLabelId,
d.pro_label_id as proLabelId,
c.BOOK_NAME AS bookName
FROM
book_group_qrcode a
...
...
@@ -58,6 +61,12 @@
a.is_delete = 0
AND b.is_delete = 0
AND c.IS_DELETE = 0
<if
test=
"depLabelId != null"
>
AND d.dep_label_id = #{depLabelId}
</if>
<if
test=
"proLabelId != null"
>
AND d.pro_label_id = #{proLabelId}
</if>
<if
test=
"groupName != null and groupName != '' "
>
AND (
a.group_name LIKE CONCAT('%', #{groupName},'%')
...
...
pcloud-service-book/src/main/resources/mapper/skill/PcloudGroupActivityDao.xml
0 → 100644
View file @
67cb4c89
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.skill.dao.impl.PcloudGroupActivityDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.skill.entity.PcloudGroupActivity"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"name"
property=
"name"
jdbcType=
"VARCHAR"
/>
<result
column=
"description"
property=
"desc"
jdbcType=
"VARCHAR"
/>
<result
column=
"join_type"
property=
"joinType"
jdbcType=
"INTEGER"
/>
<result
column=
"group_pic"
property=
"groupPic"
jdbcType=
"VARCHAR"
/>
<result
column=
"pro_label_id"
property=
"proLabelId"
jdbcType=
"INTEGER"
/>
<result
column=
"dep_label_id"
property=
"depLabelId"
jdbcType=
"INTEGER"
/>
<result
column=
"pur_label_id"
property=
"purLabelId"
jdbcType=
"INTEGER"
/>
<result
column=
"book_group_qrcode_id"
property=
"bookGroupQrcodeId"
jdbcType=
"INTEGER"
/>
<result
column=
"group_name"
property=
"groupName"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"create_user"
property=
"createUser"
jdbcType=
"INTEGER"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_user"
property=
"updateUser"
jdbcType=
"INTEGER"
/>
<result
column=
"is_delete"
property=
"isDelete"
jdbcType=
"BIT"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, name, description, join_type, group_pic, pro_label_id, dep_label_id,
pur_label_id, book_group_qrcode_id,
create_time, create_user, update_time, update_user, is_delete
</sql>
<update
id=
"deleteById"
parameterType=
"long"
>
update pcloud_group_activity set is_delete = 1 where id = #{id}
</update>
<select
id=
"queryGroupActivity"
resultType=
"com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO"
parameterType=
"map"
>
SELECT
a.id,
a.NAME,
a.description,
a.join_type AS joinType,
a.group_pic AS groupPic,
a.book_group_qrcode_id AS bookGroupQrcodeId,
a.pro_label_id AS proLabelId,
a.dep_label_id AS depLabelId,
a.pur_label_id AS purLabelId,
b.group_name AS groupName
FROM
pcloud_group_activity a left join book_group_qrcode b on a.book_group_qrcode_id = b.id
WHERE
a.is_delete = 0
<if
test=
"proLabelId != null"
>
and a.pro_label_id = #{proLabelId}
</if>
<if
test=
"depLabelId != null"
>
and a.dep_label_id = #{depLabelId}
</if>
<if
test=
"purLabelId != null"
>
and a.pur_label_id = #{purLabelId}
</if>
<if
test=
"name != null"
>
and a.name like CONCAT('%', #{name},'%')
</if>
</select>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"long"
>
select
a.id, a.name, a.description, a.join_type, a.group_pic, a.pro_label_id, a.dep_label_id,
a.pur_label_id, a.book_group_qrcode_id,
a.create_time, a.create_user, a.update_time, a.update_user, a.is_delete, b.group_name
from pcloud_group_activity a left join book_group_qrcode b on a.book_group_qrcode_id = b.id
where a.id = #{id,jdbcType=INTEGER}
</select>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.skill.entity.PcloudGroupActivity"
>
insert into pcloud_group_activity (id, name,
description, join_type, group_pic, pro_label_id, dep_label_id,
pur_label_id, book_group_qrcode_id, create_time,
create_user, update_time, update_user,
is_delete)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{desc,jdbcType=VARCHAR}, #{joinType,jdbcType=INTEGER}, #{groupPic,jdbcType=VARCHAR}, #{proLabelId,jdbcType=INTEGER}, #{depLabelId,jdbcType=INTEGER},
#{purLabelId,jdbcType=INTEGER}, #{bookGroupQrcodeId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{createUser,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER},
#{isDelete,jdbcType=BIT})
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pcloud.book.skill.entity.PcloudGroupActivity"
>
update pcloud_group_activity
<set
>
<if
test=
"name != null"
>
name = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"desc != null"
>
description = #{desc,jdbcType=VARCHAR},
</if>
<if
test=
"joinType != null"
>
join_type = #{joinType,jdbcType=INTEGER},
</if>
<if
test=
"groupPic != null"
>
group_pic = #{groupPic,jdbcType=VARCHAR},
</if>
<if
test=
"proLabelId != null"
>
pro_label_id = #{proLabelId,jdbcType=INTEGER},
</if>
<if
test=
"depLabelId != null"
>
dep_label_id = #{depLabelId,jdbcType=INTEGER},
</if>
<if
test=
"purLabelId != null"
>
pur_label_id = #{purLabelId,jdbcType=INTEGER},
</if>
<if
test=
"bookGroupQrcodeId != null"
>
book_group_qrcode_id = #{bookGroupQrcodeId,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"createUser != null"
>
create_user = #{createUser,jdbcType=INTEGER},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateUser != null"
>
update_user = #{updateUser,jdbcType=INTEGER},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"update"
parameterType=
"com.pcloud.book.skill.entity.PcloudGroupActivity"
>
update pcloud_group_activity
set name = #{name,jdbcType=VARCHAR},
description = #{desc,jdbcType=VARCHAR},
join_type = #{joinType,jdbcType=INTEGER},
group_pic = #{groupPic,jdbcType=VARCHAR},
pro_label_id = #{proLabelId,jdbcType=INTEGER},
dep_label_id = #{depLabelId,jdbcType=INTEGER},
pur_label_id = #{purLabelId,jdbcType=INTEGER},
book_group_qrcode_id = #{bookGroupQrcodeId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_user = #{createUser,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=TIMESTAMP},
update_user = #{updateUser,jdbcType=INTEGER},
is_delete = #{isDelete,jdbcType=BIT}
where id = #{id,jdbcType=INTEGER}
</update>
<select
id=
"mayByIds"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from pcloud_group_activity
where id in
<foreach
collection=
"list"
index=
"i"
item=
"item"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/skill/PcloudResourceDao.xml
0 → 100644
View file @
67cb4c89
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.skill.dao.impl.PcloudResourceDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.skill.entity.PcloudResource"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"name"
property=
"name"
jdbcType=
"VARCHAR"
/>
<result
column=
"description"
property=
"description"
jdbcType=
"VARCHAR"
/>
<result
column=
"pro_label_id"
property=
"proLabelId"
jdbcType=
"BIGINT"
/>
<result
column=
"dep_label_id"
property=
"depLabelId"
jdbcType=
"BIGINT"
/>
<result
column=
"pur_label_id"
property=
"purLabelId"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"is_delete"
property=
"isDelete"
jdbcType=
"BIT"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, name, description, pro_label_id, dep_label_id, pur_label_id,
create_time, update_time, is_delete
</sql>
<select
id=
"getPcloudResourceList"
resultType=
"com.pcloud.book.skill.facade.response.QueryPcloudResponseVO"
parameterType=
"map"
>
SELECT
id,
NAME,
description,
pro_label_id proLabelId,
dep_label_id depLabelId,
pur_label_id purLabelId
FROM
`pcloud_resource`
WHERE is_delete = 0
<if
test=
"name != null"
>
AND name like CONCAT('%',#{name},'%')
</if>
<if
test=
"proLabelId != null"
>
AND pro_label_id = #{proLabelId}
</if>
<if
test=
"depLabelId != null"
>
AND dep_label_id = #{depLabelId}
</if>
<if
test=
"purLabelId != null"
>
AND pur_label_id = #{purLabelId}
</if>
ORDER BY id DESC
</select>
<select
id=
"getPcloudResource"
resultType=
"com.pcloud.book.skill.facade.response.QueryPcloudResponseVO"
parameterType=
"long"
>
SELECT
id,
NAME,
description,
pro_label_id proLabelId,
dep_label_id depLabelId,
pur_label_id purLabelId
FROM pcloud_resource
WHERE id=#{id} AND is_delete = 0
</select>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from pcloud_resource
where id = #{id,jdbcType=INTEGER}
</select>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.skill.entity.PcloudResource"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into pcloud_resource (name, description, pro_label_id, dep_label_id, pur_label_id,
create_time, update_time, is_delete)
values (#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{proLabelId,jdbcType=INTEGER}, #{depLabelId,jdbcType=INTEGER}, #{purLabelId,jdbcType=INTEGER},
NOW(), NOW(), 0)
</insert>
<update
id=
"update"
parameterType=
"com.pcloud.book.skill.entity.PcloudResource"
>
update pcloud_resource
<set
>
<if
test=
"name != null"
>
name = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"description != null"
>
description = #{description,jdbcType=VARCHAR},
</if>
<if
test=
"proLabelId != null"
>
pro_label_id = #{proLabelId,jdbcType=INTEGER},
</if>
<if
test=
"depLabelId != null"
>
dep_label_id = #{depLabelId,jdbcType=INTEGER},
</if>
<if
test=
"purLabelId != null"
>
pur_label_id = #{purLabelId,jdbcType=INTEGER},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"deletePcloudResource"
parameterType=
"long"
>
update pcloud_resource
set is_delete = 1
where id = #{id,jdbcType=BIGINT}
</update>
<select
id=
"mayByIds"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from pcloud_resource
where id in
<foreach
collection=
"list"
index=
"i"
item=
"item"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/skill/PcloudSkilll.xml
0 → 100644
View file @
67cb4c89
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.skill.dao.impl.PcloudSkillDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.skill.entity.PcloudSkill"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"skill_type"
property=
"skillType"
jdbcType=
"INTEGER"
/>
<result
column=
"rel_skill_id"
property=
"relSkillId"
jdbcType=
"BIGINT"
/>
<result
column=
"skill_fuse_reply"
property=
"skillFuseReply"
jdbcType=
"VARCHAR"
/>
<result
column=
"seq_num"
property=
"seqNum"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, skill_type, rel_skill_id, skill_fuse_reply, seq_num, create_time
</sql>
<sql
id=
"Column_List_Skill"
>
id, skill_type, rel_skill_id, skill_fuse_reply, seq_num,
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from pcloud_skill
where id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteById"
parameterType=
"long"
>
delete from pcloud_skill
where id = #{id,jdbcType=BIGINT}
</delete>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.skill.entity.PcloudSkill"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into pcloud_skill
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
skill_type,
rel_skill_id,
skill_fuse_reply,
seq_num,
create_time
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{skillType,jdbcType=INTEGER},
#{relSkillId,jdbcType=BIGINT},
#{skillFuseReply,jdbcType=VARCHAR},
#{seqNum,jdbcType=INTEGER},
NOW()
</trim>
</insert>
<update
id=
"update"
parameterType=
"com.pcloud.book.push.entity.Push"
>
update pcloud_skill
<set>
<if
test=
"skillType != null"
>
skill_type = #{skillType,jdbcType=INTEGER},
</if>
<if
test=
"relSkillId != null"
>
rel_skill_id = #{relSkillId,jdbcType=BIGINT},
</if>
<if
test=
"skillFuseReply != null"
>
skill_fuse_reply = #{skillFuseReply,jdbcType=VARCHAR},
</if>
<if
test=
"seqNum != null"
>
seq_num = #{seqNum,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select
id=
"getPcloudSkillList"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from pcloud_skill
where 1=1
<if
test=
"skillType!=null"
>
and skill_type = #{skillType}
</if>
order by seq_num
</select>
<update
id=
"updateSeqNum"
parameterType=
"map"
>
update pcloud_skill
set seq_num=#{seqNum}
where id=#{id}
</update>
<select
id=
"getSkillList4TimeController"
parameterType=
"map"
resultType=
"com.pcloud.book.keywords.entity.RobotSkill4H5"
>
select
p.id,
p.skill_type type,
p.rel_skill_id relSkillId,
t.task_name relSkillName,
t.task_introduce relSkillIntroduce
from pcloud_skill p
left join time_control_task t
on p.rel_skill_id = t.task_id
where
skill_type = 1
<if
test=
"labelId != null"
>
and t.dep_label_id = #{labelId}
</if>
order by p.seq_num
</select>
<select
id=
"getSkillList4Activity"
parameterType=
"map"
resultType=
"com.pcloud.book.keywords.entity.RobotSkill4H5"
>
select
p.id,
p.skill_type type,
p.rel_skill_id relSkillId,
pa.name relSkillName,
pa.description relSkillIntroduce
from pcloud_skill p
left join pcloud_group_activity pa
on p.rel_skill_id = pa.id
where
skill_type = 2
<if
test=
"labelId != null"
>
and pa.dep_label_id = #{labelId}
</if>
order by p.seq_num
</select>
<select
id=
"getSkillList4Resource"
parameterType=
"map"
resultType=
"com.pcloud.book.keywords.entity.RobotSkill4H5"
>
select
p.id,
p.skill_type type,
p.rel_skill_id relSkillId,
pr.name relSkillName,
pr.description relSkillIntroduce
from pcloud_skill p
left join pcloud_resource pr
on p.rel_skill_id = pr.id
where
skill_type = 3 and pr.is_delete = 0
<if
test=
"labelId != null"
>
and pr.dep_label_id = #{labelId}
</if>
order by p.seq_num
</select>
<select
id=
"getLabelList4Activity"
parameterType=
"integer"
resultType=
"long"
>
select
DISTINCT pa.dep_label_id
from pcloud_skill p
left join pcloud_group_activity pa
on p.rel_skill_id = pa.id
where
skill_type = 2
and
pa.dep_label_id is not null
</select>
<select
id=
"getLabelList4TimeController"
parameterType=
"integer"
resultType=
"long"
>
select
DISTINCT t.dep_label_id
from pcloud_skill p
left join time_control_task t
on p.rel_skill_id = t.task_id
where
skill_type = 1
and
t.dep_label_id is not null
</select>
<select
id=
"getLabelList4Resource"
parameterType=
"integer"
resultType=
"long"
>
select
DISTINCT pr.dep_label_id
from pcloud_skill p
left join pcloud_resource pr
on p.rel_skill_id = pr.id
where
skill_type = 3 and pr.is_delete = 0
and
pr.dep_label_id is not null
</select>
<select
id=
"getMaxSeqNum"
resultType=
"integer"
>
select ifnull(max(seq_num),0) from pcloud_skill
</select>
<select
id=
"getByRelSkillId"
parameterType=
"integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from
pcloud_skill
where
rel_skill_id = #{relSkillId}
</select>
<select
id=
"getByRelId"
resultMap=
"BaseResultMap"
>
select id, skill_type, rel_skill_id, skill_fuse_reply, seq_num
from pcloud_skill where rel_skill_id = #{relSkillId} and skill_type = #{type}
limit 1
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/skill/PcloudSkilllGuide.xml
0 → 100644
View file @
67cb4c89
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.skill.dao.impl.PcloudSkillGuideDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.skill.entity.PcloudSkillGuide"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"pcloud_skill_id"
property=
"pcloudSkillId"
jdbcType=
"BIGINT"
/>
<result
column=
"guide_id"
property=
"guideId"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, pcloud_skill_id, guide_id, create_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from pcloud_skill_guide
where id = #{id,jdbcType=BIGINT}
</select>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.skill.entity.PcloudSkillGuide"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into pcloud_skill_guide
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
pcloud_skill_id,
guide_id,
create_time
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{pcloudSkillId,jdbcType=BIGINT},
#{guideId,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.skill.entity.PcloudSkillGuide"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into pcloud_skill_guide (
pcloud_skill_id,
guide_id,
create_time
) values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.pcloudSkillId,jdbcType=BIGINT},
#{item.guideId,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
<delete
id=
"deleteByPcloudSkillId"
parameterType=
"long"
>
delete from pcloud_skill_guide
where pcloud_skill_id=#{pcloudSkillId}
</delete>
<select
id=
"getListByPcloudSkillId"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from pcloud_skill_guide
where pcloud_skill_id=#{pcloudSkillId}
</select>
<select
id=
"getListByPcloudSkillIds"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from pcloud_skill_guide
where pcloud_skill_id in
<foreach
collection=
"pcloudSkillIds"
item=
"item"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/skill/PcloudSubReply.xml
0 → 100644
View file @
67cb4c89
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.skill.dao.impl.PcloudSubReplyDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.skill.entity.PcloudSubReply"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"pcloud_skill_id"
property=
"pcloudSkillId"
jdbcType=
"BIGINT"
/>
<result
column=
"sub_type"
property=
"subType"
jdbcType=
"BIGINT"
/>
<result
column=
"type"
property=
"type"
jdbcType=
"BIGINT"
/>
<result
column=
"content"
property=
"content"
jdbcType=
"BIGINT"
/>
<result
column=
"description"
property=
"description"
jdbcType=
"BIGINT"
/>
<result
column=
"link_url"
property=
"linkUrl"
jdbcType=
"BIGINT"
/>
<result
column=
"pic_url"
property=
"picUrl"
jdbcType=
"BIGINT"
/>
<result
column=
"serve_id"
property=
"serveId"
jdbcType=
"BIGINT"
/>
<result
column=
"serve_type"
property=
"serveType"
jdbcType=
"BIGINT"
/>
<result
column=
"resource_id"
property=
"resourceId"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id ,pcloud_skill_id ,sub_type ,type ,content ,description ,link_url ,pic_url ,serve_id ,serve_type ,resource_id ,create_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from pcloud_sub_reply
where id = #{id,jdbcType=BIGINT}
</select>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.skill.entity.PcloudSubReply"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into pcloud_sub_reply
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
pcloud_skill_id ,
sub_type ,
type ,
content ,
description ,
link_url ,
pic_url ,
serve_id ,
serve_type ,
resource_id ,
create_time
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{pcloudSkillId,jdbcType=BIGINT},
#{subType,jdbcType=INTEGER},
#{type,jdbcType=INTEGER},
#{content,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{linkUrl,jdbcType=VARCHAR},
#{picUrl,jdbcType=VARCHAR},
#{serveId,jdbcType=BIGINT},
#{serveType,jdbcType=VARCHAR},
#{resourceId,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.skill.entity.PcloudSubReply"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into pcloud_sub_reply (
pcloud_skill_id ,
sub_type ,
type ,
content ,
description ,
link_url ,
pic_url ,
serve_id ,
serve_type ,
resource_id ,
create_time
) values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.pcloudSkillId,jdbcType=BIGINT},
#{item.subType,jdbcType=INTEGER},
#{item.type,jdbcType=INTEGER},
#{item.content,jdbcType=VARCHAR},
#{item.description,jdbcType=VARCHAR},
#{item.linkUrl,jdbcType=VARCHAR},
#{item.picUrl,jdbcType=VARCHAR},
#{item.serveId,jdbcType=BIGINT},
#{item.serveType,jdbcType=VARCHAR},
#{item.resourceId,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
<delete
id=
"deleteByPcloudSkillId"
parameterType=
"long"
>
delete from pcloud_sub_reply
where pcloud_skill_id=#{pcloudSkillId}
</delete>
<select
id=
"getListByPcloudSkillId"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from pcloud_sub_reply
where pcloud_skill_id=#{pcloudSkillId}
</select>
<select
id=
"getListByPcloudSkillIds"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from pcloud_sub_reply
where pcloud_skill_id in
<foreach
collection=
"pcloudSkillIds"
item=
"item"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</select>
<select
id=
"getBySkillIdAndType"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from pcloud_sub_reply
where pcloud_skill_id=#{skillId} and sub_type = #{subType}
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/timecontrol/BookTaskBindingMapper.xml
0 → 100644
View file @
67cb4c89
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.timecontrol.mapper.BookTaskBindingMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.timecontrol.entity.BookTaskBinding"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"task_id"
property=
"taskId"
jdbcType=
"INTEGER"
/>
<result
column=
"task_name"
property=
"taskName"
jdbcType=
"VARCHAR"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"INTEGER"
/>
<result
column=
"book_name"
property=
"bookName"
jdbcType=
"VARCHAR"
/>
<result
column=
"isbn"
property=
"isbn"
jdbcType=
"VARCHAR"
/>
<result
column=
"state"
property=
"state"
jdbcType=
"BIT"
/>
<result
column=
"delete"
property=
"delete"
jdbcType=
"BIT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, task_id, task_name, book_id, book_name, isbn, state, delete, create_time, update_time
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from book_task_binding
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from book_task_binding
where id = #{id,jdbcType=INTEGER}
</delete>
<delete
id=
"deleteByTask"
>
delete from book_task_binding where task_id = #{taskId}
</delete>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.timecontrol.entity.BookTaskBinding"
>
insert into book_task_binding (id, task_id, task_name,
book_id, book_name, isbn,
state, delete, create_time,
update_time)
values (#{id,jdbcType=INTEGER}, #{taskId,jdbcType=INTEGER}, #{taskName,jdbcType=VARCHAR},
#{bookId,jdbcType=INTEGER}, #{bookName,jdbcType=VARCHAR}, #{isbn,jdbcType=VARCHAR},
#{state,jdbcType=BIT}, #{delete,jdbcType=BIT}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.pcloud.book.timecontrol.entity.BookTaskBinding"
>
insert into book_task_binding
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"taskId != null"
>
task_id,
</if>
<if
test=
"taskName != null"
>
task_name,
</if>
<if
test=
"bookId != null"
>
book_id,
</if>
<if
test=
"bookName != null"
>
book_name,
</if>
<if
test=
"isbn != null"
>
isbn,
</if>
<if
test=
"state != null"
>
state,
</if>
<if
test=
"delete != null"
>
delete,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
<if
test=
"taskId != null"
>
#{taskId,jdbcType=INTEGER},
</if>
<if
test=
"taskName != null"
>
#{taskName,jdbcType=VARCHAR},
</if>
<if
test=
"bookId != null"
>
#{bookId,jdbcType=INTEGER},
</if>
<if
test=
"bookName != null"
>
#{bookName,jdbcType=VARCHAR},
</if>
<if
test=
"isbn != null"
>
#{isbn,jdbcType=VARCHAR},
</if>
<if
test=
"state != null"
>
#{state,jdbcType=BIT},
</if>
<if
test=
"delete != null"
>
#{delete,jdbcType=BIT},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pcloud.book.timecontrol.entity.BookTaskBinding"
>
update book_task_binding
<set
>
<if
test=
"taskId != null"
>
task_id = #{taskId,jdbcType=INTEGER},
</if>
<if
test=
"taskName != null"
>
task_name = #{taskName,jdbcType=VARCHAR},
</if>
<if
test=
"bookId != null"
>
book_id = #{bookId,jdbcType=INTEGER},
</if>
<if
test=
"bookName != null"
>
book_name = #{bookName,jdbcType=VARCHAR},
</if>
<if
test=
"isbn != null"
>
isbn = #{isbn,jdbcType=VARCHAR},
</if>
<if
test=
"state != null"
>
state = #{state,jdbcType=BIT},
</if>
<if
test=
"delete != null"
>
delete = #{delete,jdbcType=BIT},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.pcloud.book.timecontrol.entity.BookTaskBinding"
>
update book_task_binding
set task_id = #{taskId,jdbcType=INTEGER},
task_name = #{taskName,jdbcType=VARCHAR},
book_id = #{bookId,jdbcType=INTEGER},
book_name = #{bookName,jdbcType=VARCHAR},
isbn = #{isbn,jdbcType=VARCHAR},
state = #{state,jdbcType=BIT},
delete = #{delete,jdbcType=BIT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<!--批量新增任务配置发布-->
<insert
id=
"batchInsert"
>
INSERT INTO book_task_binding (
task_id, task_name, book_id, book_name, isbn, state, `delete`, create_time
) VALUES
<foreach
collection=
"bookDtos"
item=
"book"
separator=
","
>
( #{timeControlTask.taskId}, #{timeControlTask.taskName}, #{book.bookId}, #{book.bookName}, #{book.isbn}, 0, 0, NOW())
</foreach>
</insert>
<!--获取任务配置发布数量-->
<select
id=
"getBookTaskBindingCount"
resultType=
"java.lang.Integer"
>
SELECT count(1) FROM book_task_binding a LEFT JOIN time_control_task b ON a.task_id = b.task_id
WHERE a.`delete` = 0
<if
test=
"proLabelId != null"
>
AND b.pro_label_id = #{proLabelId}
</if>
<if
test=
"depLabelId != null"
>
AND b.dep_label_id = #{depLabelId}
</if>
<if
test=
"purLabelId != null"
>
AND b.pur_label_id = #{purLabelId}
</if>
<if
test=
"bookIds!=null"
>
AND book_id IN
<foreach
collection=
"bookIds"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
</if>
</select>
<!--分页查询分页配置发布-->
<select
id=
"selectBookTaskBinding4Pcloud"
resultType=
"com.pcloud.book.timecontrol.vo.BookTaskBindingVO"
>
SELECT
a.id,
a.task_id taskId,
a.task_name taskName,
a.book_id bookId,
a.book_name bookName,
a.isbn,
CONCAT( 'BK', a.book_id ) serialNumber,
a.state,
b.pro_label_id proLabelId,
b.dep_label_id depLabelId,
b.pur_label_id purLabelId
FROM book_task_binding a LEFT JOIN time_control_task b ON a.task_id = b.task_id
WHERE a.`delete` = 0
<if
test=
"proLabelId != null"
>
AND b.pro_label_id = #{proLabelId}
</if>
<if
test=
"depLabelId != null"
>
AND b.dep_label_id = #{depLabelId}
</if>
<if
test=
"purLabelId != null"
>
AND b.pur_label_id = #{purLabelId}
</if>
<if
test=
"bookIds!=null"
>
AND a.book_id IN
<foreach
collection=
"bookIds"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
</if>
LIMIT #{pageNum}, #{numPerPage}
</select>
<select
id=
"checkHasBinding"
resultType=
"java.lang.Integer"
>
SELECT count(1) FROM book_task_binding
WHERE
<foreach
collection=
"bookIds"
item=
"bookId"
open=
"("
close=
") OR "
>
book_id = #{bookId} AND task_id = #{taskId}
</foreach>
0
</select>
<!--批量更新任务配置发布状态-->
<update
id=
"batchUpdateBookTaskState"
>
UPDATE book_task_binding SET state = #{state} WHERE id IN
<foreach
collection=
"ids"
item=
"item"
separator=
","
open=
"("
close=
")"
>
#{item}
</foreach>
</update>
<!--批量删除任务配置发布-->
<update
id=
"batchDeleteBookTask"
>
UPDATE book_task_binding SET `delete` = 1 WHERE id IN
<foreach
collection=
"ids"
item=
"item"
separator=
","
open=
"("
close=
")"
>
#{item}
</foreach>
</update>
<update
id=
"updateTaskName"
>
UPDATE book_task_binding set task_name = #{taskName}
where task_id = #{taskId}
</update>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/timecontrol/TimeControlReplyMessageMapper.xml
0 → 100644
View file @
67cb4c89
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.timecontrol.mapper.TimeControlReplyMessageMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.timecontrol.entity.TimeControlReplyMessage"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"task_item_id"
property=
"taskItemId"
jdbcType=
"INTEGER"
/>
<result
column=
"task_id"
property=
"taskId"
jdbcType=
"INTEGER"
/>
<result
column=
"reply_type"
property=
"replyType"
jdbcType=
"INTEGER"
/>
<result
column=
"message_type"
property=
"messageType"
jdbcType=
"VARCHAR"
/>
<result
column=
"text"
property=
"text"
jdbcType=
"VARCHAR"
/>
<result
column=
"app_id"
property=
"appId"
jdbcType=
"INTEGER"
/>
<result
column=
"product_id"
property=
"productId"
jdbcType=
"INTEGER"
/>
<result
column=
"img_url"
property=
"imgUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"file_name"
property=
"fileName"
jdbcType=
"VARCHAR"
/>
<result
column=
"file_url"
property=
"fileUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"file_id"
property=
"fileId"
jdbcType=
"VARCHAR"
/>
<result
column=
"file_type"
property=
"fileType"
jdbcType=
"VARCHAR"
/>
<result
column=
"size"
property=
"size"
jdbcType=
"DECIMAL"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"link_url"
property=
"linkUrl"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, task_id, task_item_id, reply_type, message_type, text, app_id, product_id, img_url, file_name,
file_url, create_time, update_time, link_url, file_id, file_type, size
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from time_control_reply_message
where id = #{id,jdbcType=INTEGER}
</select>
<select
id=
"list4TaskItem"
resultMap=
"BaseResultMap"
>
select task_id, task_item_id, reply_type, message_type, app_id, product_id, img_url, file_name,
file_url, create_time, text, link_url, file_id, file_type, size
from time_control_reply_message
where task_item_id = #{taskItemId} and reply_type = #{replyType}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from time_control_reply_message
where id = #{id,jdbcType=INTEGER}
</delete>
<delete
id=
"deleteByItemId"
>
delete from time_control_reply_message where task_item_id = #{taskItemId}
</delete>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.timecontrol.entity.TimeControlReplyMessage"
>
insert into time_control_reply_message (id, task_item_id, reply_type,
message_type, app_id, product_id,
img_url, file_name, file_url,
create_time, update_time)
values (#{id,jdbcType=INTEGER}, #{taskItemId,jdbcType=INTEGER}, #{replyType,jdbcType=INTEGER},
#{messageType,jdbcType=VARCHAR}, #{appId,jdbcType=INTEGER}, #{productId,jdbcType=INTEGER},
#{imgUrl,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR}, #{fileUrl,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"batchInsert"
>
insert into time_control_reply_message (task_id, task_item_id, reply_type,
message_type, text, app_id, product_id,
img_url, file_name, file_url,
create_time, update_time, link_url, file_id, file_type, size)
values
<foreach
collection=
"list"
separator=
","
item=
"item"
>
(#{item.taskId}, #{item.taskItemId}, #{item.replyType}, #{item.messageType}, #{item.text}, #{item.appId},
#{item.productId}, #{item.imgUrl}, #{item.fileName}, #{item.fileUrl}, now(), now(), #{item.linkUrl},
#{item.fileId}, #{item.fileType}, #{item.size})
</foreach>
</insert>
<select
id=
"getByTaskItemId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from time_control_reply_message
where task_item_id = #{taskItemId,jdbcType=INTEGER}
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/timecontrol/TimeControlTaskItemMapper.xml
0 → 100644
View file @
67cb4c89
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.timecontrol.mapper.TimeControlTaskItemMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.timecontrol.entity.TimeControlTaskItem"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"task_id"
property=
"taskId"
jdbcType=
"INTEGER"
/>
<result
column=
"start_day"
property=
"startDay"
jdbcType=
"INTEGER"
/>
<result
column=
"finish_confirm"
property=
"finishConfirm"
jdbcType=
"INTEGER"
/>
<result
column=
"finish_key_word"
property=
"finishKeyWord"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"td_confirm"
property=
"tdConfirm"
jdbcType=
"INTEGER"
/>
<result
column=
"finish_link_introduce"
property=
"finishLinkIntroduce"
jdbcType=
"VARCHAR"
/>
<result
column=
"finish_link_url"
property=
"finishLinkUrl"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, task_id, start_day, finish_confirm, finish_key_word, create_time, update_time,td_confirm,finish_link_introduce,finish_link_url
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.timecontrol.entity.TimeControlTaskItem"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into time_control_task_item(task_id, start_day, finish_confirm, finish_key_word, create_time, update_time
,td_confirm,finish_link_introduce,finish_link_url)
values (#{taskId}, #{startDay}, #{finishConfirm}, #{finishKeyWord}, now(), now(),#{tdConfirm},#{finishLinkIntroduce},#{finishLinkUrl})
</insert>
<update
id=
"updateTtaskItem"
parameterType=
"com.pcloud.book.timecontrol.entity.TimeControlTaskItem"
>
update time_control_task_item set start_day = #{startDay}, finish_confirm = #{finishConfirm}, finish_key_word = #{finishKeyWord},
td_confirm=#{tdConfirm},
<if
test=
"finishLinkIntroduce !=null"
>
finish_link_introduce=#{finishLinkIntroduce},
</if>
<if
test=
"finishLinkUrl"
>
finish_link_url=#{finishLinkUrl},
</if>
update_time = now()
where id = #{id}
</update>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from time_control_task_item
where id = #{id,jdbcType=INTEGER}
</select>
<select
id=
"getByTaskIdAndDay"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from time_control_task_item
where task_id = #{taskId} and start_day = #{startDay}
</select>
<select
id=
"listTaskItemDay"
resultType=
"com.pcloud.book.timecontrol.dto.ReplyMessageBaseDto"
>
select id, task_id taskId, start_day startDay
from time_control_task_item where task_id = #{taskId}
order by startDay asc
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from time_control_task_item
where id = #{id,jdbcType=INTEGER}
</delete>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/timecontrol/TimeControlTaskMapper.xml
0 → 100644
View file @
67cb4c89
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.timecontrol.mapper.TimeControlTaskMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.timecontrol.entity.TimeControlTask"
>
<id
column=
"task_id"
property=
"taskId"
jdbcType=
"INTEGER"
/>
<result
column=
"task_name"
property=
"taskName"
jdbcType=
"VARCHAR"
/>
<result
column=
"task_introduce"
property=
"taskIntroduce"
jdbcType=
"VARCHAR"
/>
<result
column=
"task_key_word"
property=
"taskKeyWord"
jdbcType=
"VARCHAR"
/>
<result
column=
"subscribe_word"
property=
"subscribeWord"
jdbcType=
"VARCHAR"
/>
<result
column=
"success_subscribe_word"
property=
"successSubscribeWord"
jdbcType=
"VARCHAR"
/>
<result
column=
"success_unsubscribe_word"
property=
"successUnSubscribeWord"
jdbcType=
"VARCHAR"
/>
<result
column=
"advanced_setting"
property=
"advancedSetting"
jdbcType=
"INTEGER"
/>
<result
column=
"pro_label_id"
property=
"proLabelId"
jdbcType=
"INTEGER"
/>
<result
column=
"dep_label_id"
property=
"depLabelId"
jdbcType=
"INTEGER"
/>
<result
column=
"pur_label_id"
property=
"purLabelId"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<resultMap
id=
"TaskDtoMap"
type=
"com.pcloud.book.timecontrol.dto.TaskDto"
>
<id
column=
"task_id"
property=
"taskId"
jdbcType=
"INTEGER"
/>
<result
column=
"task_name"
property=
"taskName"
jdbcType=
"VARCHAR"
/>
<result
column=
"task_introduce"
property=
"taskIntroduce"
jdbcType=
"VARCHAR"
/>
<result
column=
"task_key_word"
property=
"taskKeyWord"
jdbcType=
"VARCHAR"
/>
<result
column=
"subscribe_word"
property=
"subscribeWord"
jdbcType=
"VARCHAR"
/>
<result
column=
"advanced_setting"
property=
"advancedSetting"
jdbcType=
"INTEGER"
/>
<result
column=
"pro_label_id"
property=
"proLabelId"
jdbcType=
"INTEGER"
/>
<result
column=
"dep_label_id"
property=
"depLabelId"
jdbcType=
"INTEGER"
/>
<result
column=
"pur_label_id"
property=
"purLabelId"
jdbcType=
"INTEGER"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
task_id, task_name, task_introduce, task_key_word, subscribe_word, advanced_setting,
create_time, update_time, pro_label_id, dep_label_id, pur_label_id, success_subscribe_word, success_unsubscribe_word
</sql>
<update
id=
"updateTask"
parameterType=
"com.pcloud.book.timecontrol.entity.TimeControlTask"
>
update time_control_task set task_name = #{taskName}, task_introduce = #{taskIntroduce}, task_key_word = #{taskKeyWord},
subscribe_word = #{subscribeWord}, advanced_setting = #{advancedSetting}, update_time = now(),
pro_label_id = #{proLabelId}, dep_label_id = #{depLabelId}, pur_label_id = #{purLabelId}, success_subscribe_word = #{successSubscribeWord},
success_unsubscribe_word = #{successUnSubscribeWord}
where task_id = #{taskId}
</update>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from time_control_task
where task_id = #{taskId,jdbcType=INTEGER}
</select>
<select
id=
"getTaskCount"
resultType=
"java.lang.Integer"
>
SELECT COUNT(1) FROM time_control_task where 1=1
<if
test=
"search != null"
>
and task_name like concat('%', #{search}, '%')
</if>
</select>
<select
id=
"listTask4Pcloud"
resultType=
"com.pcloud.book.timecontrol.dto.TaskDto"
>
SELECT
a.task_id taskId,
task_name taskName,
task_introduce taskIntroduce,
task_key_word taskKeyWord,
subscribe_word subscribeWord,
a.create_time createTime,
COUNT(b.id) taskItemCount,
a.pur_label_id purLabelId,
a.pro_label_id proLabelId,
a.dep_label_id depLabelId
FROM
time_control_task a
LEFT JOIN time_control_task_item b ON a.task_id = b.task_id
where 1=1
<if
test=
"search != null"
>
and task_name like concat('%', #{search}, '%')
</if>
GROUP BY
a.task_id
<if
test=
"pageNum != null"
>
limit #{pageNum}, #{numPerPage}
</if>
</select>
<!--根据 专业/深度/目的 标签查询任务模板集合-->
<select
id=
"listIdByLabelId"
resultType=
"java.lang.Integer"
>
SELECT task_id FROM time_control_task WHERE 1 = 1
<if
test=
"proLabelId != null"
>
AND pro_label_id = #{proLabelId}
</if>
<if
test=
"depLabelId != null"
>
AND dep_label_id = #{depLabelId}
</if>
<if
test=
"purLabelId != null"
>
AND pur_label_id = #{purLabelId}
</if>
</select>
<select
id=
"listTask"
resultType=
"com.pcloud.book.timecontrol.dto.BookTaskBindingDto"
>
SELECT
a.task_id taskId,
a.task_name taskName,
b.book_id bookId,
b.book_name bookName,
b.isbn,
CONCAT('BK', b.book_id) serialNumber,
b.state,
a.pro_label_id proLabelId,
a.dep_label_id depLabelId,
a.pur_label_id purLabelId
FROM
time_control_task a
LEFT JOIN book_task_binding b ON a.task_id = b.task_id
<if
test=
"search != null"
>
and a.task_name like concat('%', #{search}, '%')
</if>
</select>
<select
id=
"mapByIds"
resultMap=
"TaskDtoMap"
>
select task_id, task_name, task_introduce, task_key_word, subscribe_word, advanced_setting,
pro_label_id, dep_label_id, pur_label_id
from time_control_task
where task_id in
<foreach
collection=
"taskIds"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
</select>
<select
id=
"listKeyWordTask"
resultType=
"com.pcloud.book.timecontrol.vo.KeyWordTaskVO"
>
SELECT
a.id,
a.key_word keyWord,
a.guide_word guideWord,
a.task_id taskId,
task_name taskName,
task_introduce taskIntroduce
FROM
time_control_key_task a
LEFT JOIN time_control_task b ON a.task_id = b.task_id
</select>
<select
id=
"getTaskByKey"
resultType=
"com.pcloud.book.timecontrol.dto.TaskDto"
>
SELECT
a.task_id taskId,
task_name taskName,
task_introduce taskIntroduce
FROM
time_control_key_task a
LEFT JOIN time_control_task b ON a.task_id = b.task_id
where a.key_word like concat('%', #{search}, '%')
limit 1
</select>
<select
id=
"listMaxDepLabel"
resultType=
"Long"
>
SELECT
dep_label_id
FROM
`time_control_task`
GROUP BY
dep_label_id
ORDER BY
COUNT(1) DESC
limit #{num}
</select>
<select
id=
"listTaskByKey4User"
resultType=
"com.pcloud.book.timecontrol.dto.TaskDto"
>
SELECT
task_id taskId,
task_name taskName,
task_introduce taskIntroduce
FROM
time_control_task
WHERE
task_name LIKE CONCAT('%', #{search}, '%')
<if
test=
"taskIds !=null and taskIds.size > 0"
>
OR task_id IN
<foreach
collection=
"taskIds"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
</if>
</select>
<select
id=
"listTaskByIds"
resultType=
"com.pcloud.book.timecontrol.dto.TaskDto"
>
SELECT
task_id taskId,
task_name taskName,
task_introduce taskIntroduce
FROM
time_control_task
WHERE task_id IN
<foreach
collection=
"taskIds"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
</select>
<select
id=
"listTaskByLabelId"
resultType=
"com.pcloud.book.timecontrol.dto.TaskDto"
>
SELECT
task_id taskId,
task_name taskName,
task_introduce taskIntroduce
FROM
time_control_task
WHERE
pro_label_id = #{labelId}
OR dep_label_id = #{labelId}
OR pur_label_id = #{labelId}
</select>
<select
id=
"getTaskByIdAndWxUserId"
resultType=
"com.pcloud.book.timecontrol.dto.TaskDto"
>
select
t.task_id taskId,
t.task_name taskName,
t.task_introduce taskIntroduce,
ts.state subscribeState
FROM
time_control_task t
left join time_control_task_subscribe ts
on t.task_id = ts.task_id
where
t.task_id = #{relSkillId}
and ts.wx_user_id = #{wxUserId}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from time_control_task
where task_id = #{taskId,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.timecontrol.entity.TimeControlTask"
useGeneratedKeys=
"true"
keyProperty=
"taskId"
>
insert into time_control_task (task_name, task_introduce,
task_key_word, subscribe_word, advanced_setting,
create_time, update_time, pro_label_id, dep_label_id, pur_label_id, success_subscribe_word,
success_unsubscribe_word)
values (#{taskName,jdbcType=VARCHAR}, #{taskIntroduce,jdbcType=VARCHAR},
#{taskKeyWord,jdbcType=VARCHAR}, #{subscribeWord,jdbcType=VARCHAR}, #{advancedSetting,jdbcType=INTEGER},
now(), now(), #{proLabelId}, #{depLabelId}, #{purLabelId}, #{successSubscribeWord}, #{successUnSubscribeWord})
</insert>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/timecontrol/TimeControlTaskSendMapper.xml
0 → 100644
View file @
67cb4c89
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.timecontrol.mapper.TimeControlTaskSendMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.timecontrol.entity.TimeControlTaskSend"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"wx_user_id"
property=
"wxUserId"
jdbcType=
"VARCHAR"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"INTEGER"
/>
<result
column=
"task_id"
property=
"taskId"
jdbcType=
"INTEGER"
/>
<result
column=
"task_item_id"
property=
"taskItemId"
jdbcType=
"INTEGER"
/>
<result
column=
"subscribe_id"
property=
"subscribeId"
jdbcType=
"INTEGER"
/>
<result
column=
"send_state"
property=
"sendState"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"send_day"
property=
"sendDay"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, wx_user_id, book_id, task_id, task_item_id, subscribe_id, send_day, send_state, create_time
</sql>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.timecontrol.entity.TimeControlTaskSend"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into time_control_task_send
(wx_user_id, book_id, task_id, task_item_id, subscribe_id, send_day, send_state, create_time)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.wxUserId,jdbcType=VARCHAR}, #{item.bookId,jdbcType=INTEGER}, #{item.taskId,jdbcType=INTEGER},
#{item.taskItemId,jdbcType=INTEGER}, #{item.subscribeId,jdbcType=INTEGER}, #{item.sendDay,jdbcType=VARCHAR},
#{item.sendState,jdbcType=INTEGER}, NOW()
)
</foreach>
</insert>
<select
id=
"listTodayTask"
resultType=
"TaskSendDto"
>
select
a.id id,
b.robot_wx_id robotWxId,
a.wx_user_id wxUserId,
a.task_id taskId,
a.task_item_id taskItemId
from time_control_task_send a
left join time_control_task_subscribe b on a.subscribe_id = b.id
where a.send_state = 0
and a.send_day = DATE_FORMAT(NOW(), '%Y-%m-%d')
</select>
<select
id=
"countMsgSend"
resultType=
"java.lang.Integer"
>
SELECT COUNT(1) FROM time_control_task_send WHERE send_state = 1
AND task_id = #{taskId} AND book_id = #{bookId}
</select>
<select
id=
"countTodayNotSend"
resultType=
"java.lang.Integer"
>
SELECT COUNT(1) FROM time_control_task_send WHERE send_state = 0
AND send_day = #{sendDay}
AND task_id = #{taskId} AND book_id = #{bookId}
</select>
<delete
id=
"cancelSend"
>
update time_control_task_send set send_state = #{sendState}, update_time = now()
where subscribe_id = #{subscribeId} and send_state = 0
</delete>
<delete
id=
"cancelSendByTaskId"
>
update time_control_task_send set send_state = 2, update_time = now()
where task_id = #{taskId} and send_state = 0
</delete>
<delete
id=
"cancelSendByItemId"
>
update time_control_task_send set send_state = 2, update_time = now()
where task_item_id = #{taskItemId} and send_state = 0
</delete>
<update
id=
"updateSendState"
>
update time_control_task_send set send_state = #{sendState}, update_time = now()
<if
test=
"completeState !=null"
>
,complete_state = #{completeState}
</if>
where id = #{sendId}
</update>
<select
id=
"getById"
resultMap=
"BaseResultMap"
>
select id, wx_user_id, book_id, task_id, task_item_id, subscribe_id, send_day, send_state
from time_control_task_send
where id = #{taskSendId}
</select>
<select
id=
"getNoCompletedItem"
resultType=
"java.lang.Integer"
>
select ifnull(count(1),0)
from time_control_task_send
WHERE task_id =#{taskId}
and complete_state !=1 AND send_state !=2
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/timecontrol/TimeControlTaskSubscribeMapper.xml
0 → 100644
View file @
67cb4c89
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.timecontrol.mapper.TimeControlTaskSubscribeMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.timecontrol.entity.TimeControlTaskSubscribe"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"wx_user_id"
property=
"wxUserId"
jdbcType=
"VARCHAR"
/>
<result
column=
"robot_wx_id"
property=
"robotWxId"
jdbcType=
"VARCHAR"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"INTEGER"
/>
<result
column=
"task_id"
property=
"taskId"
jdbcType=
"INTEGER"
/>
<result
column=
"state"
property=
"state"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<insert
id=
"subscribeTask"
parameterType=
"com.pcloud.book.timecontrol.entity.TimeControlTaskSubscribe"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into time_control_task_subscribe (wx_user_id, book_id, task_id, state, create_time, update_time, robot_wx_id)
values (#{wxUserId}, #{bookId}, #{taskId}, #{state}, now(), now(), #{robotWxId})
</insert>
<update
id=
"subscribeTaskExist"
>
UPDATE time_control_task_subscribe set state = 1, update_time = now()
where id = #{id}
</update>
<update
id=
"unSubscribeTask"
>
UPDATE time_control_task_subscribe set state = #{state}, update_time = now()
where id = #{id}
</update>
<update
id=
"unSubscribeTaskByTaskId"
>
UPDATE time_control_task_subscribe set state = 0, update_time = now()
where task_id = #{taskId}
</update>
<select
id=
"getSubscribe"
resultMap=
"BaseResultMap"
>
select wx_user_id, book_id, task_id, state, robot_wx_id, id
from time_control_task_subscribe
where wx_user_id = #{wxUserId}
<if
test=
"bookId != null"
>
and book_id = #{bookId}
</if>
and task_id = #{taskId}
</select>
<select
id=
"countTaskSubscribe"
resultType=
"java.lang.Integer"
>
SELECT count(1) FROM time_control_task_subscribe
WHERE book_id = #{bookId}
AND task_id= #{taskId}
AND state IN (1,2)
</select>
<select
id=
"getById"
resultMap=
"BaseResultMap"
>
select wx_user_id, book_id, task_id, state, create_time, update_time, robot_wx_id
from time_control_task_subscribe WHERE id = #{subscribeId}
</select>
<update
id=
"completedTaskById"
>
UPDATE time_control_task_subscribe set state = 2, update_time = now()
where id = #{subscribeId}
</update>
</mapper>
\ No newline at end of file
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