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
9fd84137
Commit
9fd84137
authored
Apr 23, 2020
by
吴博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1002761 按周设置
parent
3538ab8c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
974 additions
and
40 deletions
+974
-40
BookConstant.java
...main/java/com/pcloud/book/book/constant/BookConstant.java
+6
-0
CreateTaskDto.java
...n/java/com/pcloud/book/timecontrol/dto/CreateTaskDto.java
+3
-0
CreateTaskItemDto.java
...va/com/pcloud/book/timecontrol/dto/CreateTaskItemDto.java
+13
-1
ReplyMessageBaseDto.java
.../com/pcloud/book/timecontrol/dto/ReplyMessageBaseDto.java
+18
-0
SubscribeTaskUserDTO.java
...com/pcloud/book/timecontrol/dto/SubscribeTaskUserDTO.java
+2
-0
TaskCompletedDto.java
...ava/com/pcloud/book/timecontrol/dto/TaskCompletedDto.java
+2
-1
TaskDto.java
...rc/main/java/com/pcloud/book/timecontrol/dto/TaskDto.java
+3
-0
TaskItemDto.java
...ain/java/com/pcloud/book/timecontrol/dto/TaskItemDto.java
+11
-0
TaskSendDto.java
...ain/java/com/pcloud/book/timecontrol/dto/TaskSendDto.java
+20
-0
UpdateTaskDto.java
...n/java/com/pcloud/book/timecontrol/dto/UpdateTaskDto.java
+4
-0
UpdateTaskItemDto.java
...va/com/pcloud/book/timecontrol/dto/UpdateTaskItemDto.java
+12
-1
TimeControlWeekDay.java
...om/pcloud/book/timecontrol/entity/TimeControlWeekDay.java
+16
-0
SendTypeEnum.java
.../java/com/pcloud/book/timecontrol/enums/SendTypeEnum.java
+26
-0
TimeControlPushTypeEnum.java
...cloud/book/timecontrol/enums/TimeControlPushTypeEnum.java
+25
-0
TimeControlTaskService.java
...loud/book/timecontrol/service/TimeControlTaskService.java
+11
-0
TaskBiz.java
...rc/main/java/com/pcloud/book/timecontrol/biz/TaskBiz.java
+7
-0
TaskSubscribeBiz.java
...ava/com/pcloud/book/timecontrol/biz/TaskSubscribeBiz.java
+2
-0
TaskBizImpl.java
...ava/com/pcloud/book/timecontrol/biz/impl/TaskBizImpl.java
+0
-0
TaskCompletedBizImpl.java
...cloud/book/timecontrol/biz/impl/TaskCompletedBizImpl.java
+65
-15
TaskSubscribeBizImpl.java
...cloud/book/timecontrol/biz/impl/TaskSubscribeBizImpl.java
+0
-0
TimeControlTask.java
...a/com/pcloud/book/timecontrol/entity/TimeControlTask.java
+4
-0
TimeControlTaskItem.java
...m/pcloud/book/timecontrol/entity/TimeControlTaskItem.java
+44
-0
TimeControlTaskSend.java
...m/pcloud/book/timecontrol/entity/TimeControlTaskSend.java
+4
-0
TimeControlPrizeFacadeImpl.java
...k/timecontrol/facade/impl/TimeControlPrizeFacadeImpl.java
+11
-1
TimeControlTaskFacadeImpl.java
...ok/timecontrol/facade/impl/TimeControlTaskFacadeImpl.java
+20
-0
TimeControlTaskItemMapper.java
...ud/book/timecontrol/mapper/TimeControlTaskItemMapper.java
+12
-0
TimeControlTaskItemWeekMapper.java
...ook/timecontrol/mapper/TimeControlTaskItemWeekMapper.java
+25
-0
TimeControlTaskMapper.java
...pcloud/book/timecontrol/mapper/TimeControlTaskMapper.java
+2
-0
TimeControlTaskSendDetailMapper.java
...k/timecontrol/mapper/TimeControlTaskSendDetailMapper.java
+55
-0
TimeControlTaskSendMapper.java
...ud/book/timecontrol/mapper/TimeControlTaskSendMapper.java
+5
-0
TimeControlTaskServiceImpl.java
.../timecontrol/service/impl/TimeControlTaskServiceImpl.java
+21
-0
TimeControlTaskItemVO.java
...ud/book/timecontrol/vo/request/TimeControlTaskItemVO.java
+29
-0
TimeControlTaskItemMapper.xml
...esources/mapper/timecontrol/TimeControlTaskItemMapper.xml
+80
-9
TimeControlTaskItemWeekMapper.xml
...rces/mapper/timecontrol/TimeControlTaskItemWeekMapper.xml
+58
-0
TimeControlTaskMapper.xml
...in/resources/mapper/timecontrol/TimeControlTaskMapper.xml
+25
-7
TimeControlTaskSendDetailMapper.xml
...es/mapper/timecontrol/TimeControlTaskSendDetailMapper.xml
+264
-0
TimeControlTaskSendMapper.xml
...esources/mapper/timecontrol/TimeControlTaskSendMapper.xml
+69
-5
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/book/constant/BookConstant.java
View file @
9fd84137
...
...
@@ -324,4 +324,10 @@ public class BookConstant {
"ⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅬⅭⅮⅯⅰⅱⅲⅳⅴⅵⅶⅷⅸ"
+
"ⅹⅺⅻⅼⅽⅾⅿ┌┍┎┏┐┑┒┓└┕┖┗┘┙┚┛├┝┞┟┠┡┢┣┤┥┦┧┨┩┪┫┬┭┮┯┰┱┲┳┴┵┶┷┸┹┺┻┼┽┾┿╀╁╂╃╄╅╆╇╈╉╊╋╌╍╎╏═║╒╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡╢╣╤╥╦╧╨╩╪╫╬◤◥◄►▶◀◣◢▲▼◥▸◂"
+
"▴▾△▽▷◁⊿▻◅▵▿▹◃❏❐❑❒▀▁▂▃▄▅▆▇▉▊▋█▌▍▎▏▐░▒▓▔▕■□▢▣▤▥▦▧▨▩▪▫▬▭▮▯㋀㋁㋂㋃㋄㋅㋆㋇㋈㋉㋊㋋]+$"
;
public
static
final
String
TIME_CONTROL_KEY
=
"lgsc"
;
public
static
final
String
TIME_CONTROL_UPDATE_SEND
=
"TIME_CONTROL_UPDATE_SEND"
;
public
static
final
String
TIME_CONTROL_SEND
=
"TIME_CONTROL_SEND_"
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/CreateTaskDto.java
View file @
9fd84137
...
...
@@ -28,6 +28,8 @@ public class CreateTaskDto implements Serializable {
private
Integer
advancedSetting
;
private
Integer
sendType
;
private
Long
depLabelId
;
private
Long
purLabelId
;
...
...
@@ -35,4 +37,5 @@ public class CreateTaskDto implements Serializable {
private
Long
proLabelId
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/CreateTaskItemDto.java
View file @
9fd84137
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
javax.validation.constraints.Max
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -17,7 +19,6 @@ public class CreateTaskItemDto implements Serializable {
@NotNull
(
message
=
"任务ID不能为空"
)
private
Integer
taskId
;
@NotNull
(
message
=
"请输入天数"
)
@Max
(
value
=
200
)
private
Integer
startDay
;
...
...
@@ -44,4 +45,15 @@ public class CreateTaskItemDto implements Serializable {
private
String
itemIntroduce
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
startTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
endTime
;
//发送方式 /1每天 2每周
private
Integer
pushType
;
private
List
<
Integer
>
weekdays
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/ReplyMessageBaseDto.java
View file @
9fd84137
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.book.timecontrol.entity.TimeControlWeekDay
;
import
java.util.Date
;
import
java.util.List
;
import
lombok.Data
;
import
java.io.Serializable
;
...
...
@@ -25,4 +29,18 @@ public class ReplyMessageBaseDto implements Serializable {
* 0-不可配置,1-已配置,2-未配置
*/
private
Integer
configState
;
//周次
private
List
<
TimeControlWeekDay
>
timeControlWeekDayList
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
java
.
util
.
Date
startTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
endTime
;
//发送方式 /1每天 2每周
private
Integer
pushType
;
private
List
<
Integer
>
weekdays
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/SubscribeTaskUserDTO.java
View file @
9fd84137
...
...
@@ -43,4 +43,6 @@ public class SubscribeTaskUserDTO extends BaseDto {
* 订阅状态(0-取消订阅 1-订阅 2-完成)
*/
private
Integer
subscribeState
;
private
Integer
sendCount
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/TaskCompletedDto.java
View file @
9fd84137
...
...
@@ -37,5 +37,6 @@ public class TaskCompletedDto implements Serializable {
private
Integer
subscribePersonCount
;
//1按天发送 2按周发送
private
Integer
sendType
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/TaskDto.java
View file @
9fd84137
...
...
@@ -51,4 +51,7 @@ public class TaskDto implements Serializable {
private
String
purLabelName
;
//1按天发送 2按周发送
private
Integer
sendType
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/TaskItemDto.java
View file @
9fd84137
...
...
@@ -44,4 +44,15 @@ public class TaskItemDto implements Serializable {
private
String
sendHour
;
private
Integer
progressGuidance
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
startTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
endTime
;
//发送方式 /1每天 2每周
private
Integer
pushType
;
private
List
<
Integer
>
weekdays
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/TaskSendDto.java
View file @
9fd84137
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
java.util.Date
;
import
lombok.Data
;
import
java.io.Serializable
;
...
...
@@ -24,4 +25,23 @@ public class TaskSendDto implements Serializable {
private
Integer
completeState
;
private
Long
bookId
;
private
Integer
subscribeId
;
private
String
sendDay
;
private
Date
createTime
;
private
Integer
sendState
;
private
String
sendHour
;
private
Integer
working
;
private
Integer
sendWeek
;
private
Integer
sendCount
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/UpdateTaskDto.java
View file @
9fd84137
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
io.swagger.annotations.ApiParam
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
...
...
@@ -35,4 +36,7 @@ public class UpdateTaskDto implements Serializable {
private
Long
proLabelId
;
//1按天发送 2按周发送
private
Integer
sendType
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/UpdateTaskItemDto.java
View file @
9fd84137
package
com
.
pcloud
.
book
.
timecontrol
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
java.util.Date
;
import
lombok.Data
;
import
javax.validation.constraints.Max
;
...
...
@@ -18,7 +20,6 @@ public class UpdateTaskItemDto implements Serializable {
@NotNull
(
message
=
"消息配置ID不能为空"
)
private
Integer
id
;
@NotNull
(
message
=
"请输入天数"
)
@Max
(
value
=
200
)
private
Integer
startDay
;
...
...
@@ -45,4 +46,14 @@ public class UpdateTaskItemDto implements Serializable {
private
String
itemIntroduce
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
startTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
endTime
;
private
Integer
pushType
;
private
List
<
Integer
>
weekdays
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/entity/TimeControlWeekDay.java
0 → 100644
View file @
9fd84137
package
com
.
pcloud
.
book
.
timecontrol
.
entity
;
import
java.util.Date
;
import
lombok.Data
;
@Data
public
class
TimeControlWeekDay
{
private
Long
id
;
private
Integer
taskItemId
;
private
Integer
weekDay
;
private
Date
createTime
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/enums/SendTypeEnum.java
0 → 100644
View file @
9fd84137
package
com
.
pcloud
.
book
.
timecontrol
.
enums
;
public
enum
SendTypeEnum
{
SEND_DAY
(
1
,
"按天发送"
),
SEND_WEEK
(
2
,
"按周发送"
);
public
Integer
state
;
public
String
desc
;
public
Integer
getState
()
{
return
state
;
}
public
void
setState
(
Integer
state
)
{
this
.
state
=
state
;
}
SendTypeEnum
(
Integer
state
,
String
desc
)
{
this
.
state
=
state
;
this
.
desc
=
desc
;
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/enums/TimeControlPushTypeEnum.java
0 → 100644
View file @
9fd84137
package
com
.
pcloud
.
book
.
timecontrol
.
enums
;
public
enum
TimeControlPushTypeEnum
{
SEND_EVERY_DAY
(
1
,
"每天发送"
),
SEND_4_WEEK
(
2
,
"周几发送"
);
public
Integer
state
;
public
String
desc
;
public
Integer
getState
()
{
return
state
;
}
public
void
setState
(
Integer
state
)
{
this
.
state
=
state
;
}
TimeControlPushTypeEnum
(
Integer
state
,
String
desc
)
{
this
.
state
=
state
;
this
.
desc
=
desc
;
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/service/TimeControlTaskService.java
View file @
9fd84137
...
...
@@ -61,4 +61,14 @@ public interface TimeControlTaskService {
@ApiOperation
(
value
=
"订阅任务"
)
@GetMapping
(
"unSubscribeTask"
)
void
unSubscribeTask
(
@RequestParam
(
"wxId"
)
String
wxId
,
@RequestParam
(
"taskId"
)
Integer
taskId
);
@ApiOperation
(
value
=
"定时任务更新send表发送状态"
)
@GetMapping
(
"updateSendState4Week"
)
void
updateSendState4Week
();
@ApiOperation
(
value
=
"按周定时发送任务消息"
,
httpMethod
=
"POST"
)
@PostMapping
(
"sendTimeTaskMessage4Week"
)
void
sendTimeTaskMessage4Week
(
@RequestBody
Map
<
String
,
Object
>
map
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/TaskBiz.java
View file @
9fd84137
...
...
@@ -10,6 +10,7 @@ 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.entity.TimeControlReplyMessage
;
import
com.pcloud.book.timecontrol.entity.TimeControlTask
;
import
com.pcloud.book.timecontrol.vo.KeyWordTaskVO
;
import
com.pcloud.common.page.PageBeanNew
;
...
...
@@ -64,4 +65,10 @@ public interface TaskBiz {
void
sendReplyMessage
(
List
<
TimeControlReplyMessage
>
replyMessages
,
String
wxUserId
,
String
robotWxId
,
String
ip
);
Integer
copyTaskItem
(
Integer
taskItemId
);
void
addTask4TimeControl
();
void
updateSendState4Week
();
void
updateTaskSendType
(
TimeControlTask
taskDto
);
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/TaskSubscribeBiz.java
View file @
9fd84137
...
...
@@ -38,4 +38,6 @@ public interface TaskSubscribeBiz {
* 时间管理订阅
*/
void
subscribeTimeControlTask
(
String
wxUserId
,
Long
bookId
,
Integer
taskId
,
String
robotWxId
);
void
sendTimeTaskMessage4Week
(
Integer
taskItemId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/impl/TaskBizImpl.java
View file @
9fd84137
This diff is collapsed.
Click to expand it.
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/impl/TaskCompletedBizImpl.java
View file @
9fd84137
...
...
@@ -20,11 +20,14 @@ import com.pcloud.book.timecontrol.mapper.TaskPrizeMapper;
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.TimeControlTaskSendDetailMapper
;
import
com.pcloud.book.timecontrol.mapper.TimeControlTaskSendMapper
;
import
com.pcloud.book.timecontrol.mapper.TimeControlTaskSubscribeMapper
;
import
com.pcloud.book.timecontrol.vo.request.TimeControlTaskItemVO
;
import
com.pcloud.common.constant.CacheConstant
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
...
...
@@ -38,11 +41,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -80,6 +79,8 @@ public class TaskCompletedBizImpl implements TaskCompletedBiz {
//private PcloudKeywordService pcloudKeywordService;
@Autowired
private
ResourceConsr
resourceConsr
;
@Autowired
private
TimeControlTaskSendDetailMapper
timeControlTaskSendDetailMapper
;
@Override
...
...
@@ -121,12 +122,12 @@ public class TaskCompletedBizImpl implements TaskCompletedBiz {
private
void
fillUserCompletedList
(
Integer
taskId
,
List
<
SubscribeTaskUserDTO
>
list
)
{
List
<
String
>
wxIdList
=
list
.
stream
().
map
(
a
->
a
.
getWxUserId
()).
distinct
().
collect
(
Collectors
.
toList
());
//未完成次数
List
<
SubscribeTaskUserDTO
>
taskUserSendList
=
timeControlTaskSendMapper
.
getTaskNoCompletedCount
(
wxIdList
,
taskId
);
//未完成次数
不需要展示未完成次数
//
List<SubscribeTaskUserDTO> taskUserSendList=timeControlTaskSendMapper.getTaskNoCompletedCount(wxIdList,taskId);
Map
<
String
,
Integer
>
noCompletedMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
taskUserSendList
)){
/*
if(!ListUtils.isEmpty(taskUserSendList)){
noCompletedMap= taskUserSendList.stream().collect(Collectors.toMap(a -> a.getWxUserId(), a -> a.getNoCompletedCount(), (k1, k2) -> k2));
}
}
*/
Map
<
String
,
GroupUserDTO
>
userDTOMap
=
wechatGroupConsr
.
mapWxUserInfoByWxIdList
(
wxIdList
);
for
(
SubscribeTaskUserDTO
subscribeTaskUserDTO
:
list
)
{
//填充未完成次数
...
...
@@ -152,11 +153,11 @@ public class TaskCompletedBizImpl implements TaskCompletedBiz {
public
PageBeanNew
<
TaskItemSendDto
>
listTaskItemSendRecord4Pcloud
(
Integer
currentPage
,
Integer
numPerPage
,
String
startTime
,
String
endTime
,
String
robotWxId
,
String
taskName
,
String
sendContent
,
String
search
)
{
List
<
TaskItemSendDto
>
list
=
new
ArrayList
<>();
Integer
count
=
timeControlTaskSendMapper
.
getTaskItemSendCount
(
startTime
,
endTime
,
robotWxId
,
taskName
,
sendContent
);
Integer
count
=
timeControlTaskSend
Detail
Mapper
.
getTaskItemSendCount
(
startTime
,
endTime
,
robotWxId
,
taskName
,
sendContent
);
if
(
count
<=
0
)
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
count
,
list
);
}
list
=
timeControlTaskSendMapper
.
listTaskItemSendRecord4Pcloud
(
currentPage
*
numPerPage
,
numPerPage
,
startTime
,
endTime
,
robotWxId
,
taskName
,
sendContent
);
list
=
timeControlTaskSend
Detail
Mapper
.
listTaskItemSendRecord4Pcloud
(
currentPage
*
numPerPage
,
numPerPage
,
startTime
,
endTime
,
robotWxId
,
taskName
,
sendContent
);
log
.
info
(
"发送记录查询条数="
+
list
.
size
());
if
(
ListUtils
.
isEmpty
(
list
)){
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
count
,
list
);
...
...
@@ -224,11 +225,11 @@ public class TaskCompletedBizImpl implements TaskCompletedBiz {
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
list
);
}
}
Integer
count
=
timeControlTaskSendMapper
.
getTaskItemSendUserCount
(
wxIds
,
taskItemId
,
robotWxId
,
startTime
,
endTime
);
Integer
count
=
timeControlTaskSend
Detail
Mapper
.
getTaskItemSendUserCount
(
wxIds
,
taskItemId
,
robotWxId
,
startTime
,
endTime
);
if
(
count
<=
0
)
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
count
,
list
);
}
list
=
timeControlTaskSendMapper
.
listTaskItemSendUser4Pcloud
(
currentPage
*
numPerPage
,
numPerPage
,
wxIds
,
taskItemId
,
robotWxId
,
startTime
,
endTime
);
list
=
timeControlTaskSend
Detail
Mapper
.
listTaskItemSendUser4Pcloud
(
currentPage
*
numPerPage
,
numPerPage
,
wxIds
,
taskItemId
,
robotWxId
,
startTime
,
endTime
);
if
(
ListUtils
.
isEmpty
(
list
))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
count
,
list
);
}
...
...
@@ -249,7 +250,7 @@ public class TaskCompletedBizImpl implements TaskCompletedBiz {
@Override
public
TodayTaskSendDto
getTodayTaskSend
()
{
TodayTaskSendDto
todayTaskSendDto
=
new
TodayTaskSendDto
();
Integer
todayTaskSendCount
=
timeControlTaskSendMapper
.
todayTaskSendCount
();
Integer
todayTaskSendCount
=
timeControlTaskSend
Detail
Mapper
.
todayTaskSendCount
();
Integer
todayTaskNotSendCount
=
timeControlTaskSendMapper
.
todayTaskNotSendCount
();
todayTaskSendDto
.
setTodaySendCount
(
todayTaskSendCount
);
todayTaskSendDto
.
setTodayNotSendCount
(
todayTaskNotSendCount
);
...
...
@@ -258,10 +259,59 @@ public class TaskCompletedBizImpl implements TaskCompletedBiz {
@Override
public
List
<
String
>
getTaskSendDateList
(
String
date
)
{
List
<
String
>
taskSendDateList
=
timeControlTaskSendDetailMapper
.
getTaskSendDateList
(
date
);
/* //获取sendType=1的时间集合
List<String> taskSendDateList = timeControlTaskSendMapper.getTaskSendDateList(date);
if(ListUtils.isEmpty(taskSendDateList)){
taskSendDateList=new ArrayList<>();
}
//获取sendType=2 pushType=1的时间集合
date=date+"-01";
TimeControlTaskItemVO monthDay = taskItemMapper.getMonthDay(date);
List<Date> betweenDates = getBetweenDates(monthDay.getStartDay(), monthDay.getEndDay());
for (Date dateStr:betweenDates) {
String str = DateUtils.formatDate(dateStr, "yyyy-MM-dd");
if(!ListUtils.isEmpty(taskSendDateList)&&!taskSendDateList.contains(str)){
taskSendDateList.add(str);
}
}
//获取sendType=2 pushType=2的时间集合
List<TimeControlTaskItemVO> monthSecondDay=taskItemMapper.getMonthSecondDay(date);
for (TimeControlTaskItemVO taskItemVO:monthSecondDay) {
List<Date> betdate = getBetweenDates(taskItemVO.getStartDay(), taskItemVO.getEndDay());
for(int d=0;d<betdate.size();d++) {
Calendar betrq = Calendar.getInstance();
betrq.setTime(betdate.get(d));
Integer day = betrq.get(Calendar.DAY_OF_WEEK)-1;
if(day==0){
day=7;
}
String str1 = DateUtils.formatDate(betrq.getTime(), "yyyy-MM-dd");
if(!ListUtils.isEmpty(taskSendDateList)&&taskItemVO.getWeekDays().contains(day.toString())&&!taskSendDateList.contains(str1)){
taskSendDateList.add(str1);
}
}
}*/
return
taskSendDateList
;
}
private
List
<
Date
>
getBetweenDates
(
Date
start
,
Date
end
)
{
List
<
Date
>
datelist
=
new
ArrayList
<
Date
>();
Calendar
tempStart
=
Calendar
.
getInstance
();
tempStart
.
setTime
(
start
);
//tempStart.add(Calendar.DAY_OF_YEAR, 1);//这里可以设置从第二天开始
Calendar
tempEnd
=
Calendar
.
getInstance
();
tempEnd
.
setTime
(
end
);
while
(
tempStart
.
before
(
tempEnd
))
{
datelist
.
add
(
tempStart
.
getTime
());
tempStart
.
add
(
Calendar
.
DAY_OF_YEAR
,
1
);
}
return
datelist
;
}
@Override
public
TaskProgressDTO
getUserTaskProgress
(
Integer
taskId
,
String
wxUserId
)
throws
BizException
{
TaskProgressDTO
taskProgressDTO
=
new
TaskProgressDTO
();
...
...
@@ -283,7 +333,7 @@ public class TaskCompletedBizImpl implements TaskCompletedBiz {
taskProgressDTO
.
setFinishCount
(
progressDTO
.
getFinishCount
());
}
taskProgressDTO
.
setTaskCount
(
taskItemMapper
.
getTaskItemCount
(
taskId
));
List
<
TaskProgressItemDTO
>
itemList
=
timeControlTaskSendMapper
.
getUserTaskItemProgress
(
taskId
,
wxUserId
);
List
<
TaskProgressItemDTO
>
itemList
=
timeControlTaskSend
Detail
Mapper
.
getUserTaskItemProgress
(
taskId
,
wxUserId
);
taskProgressDTO
.
setItemList
(
itemList
);
Integer
finishTaskCount
=
0
;
if
(!
ListUtils
.
isEmpty
(
itemList
))
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/impl/TaskSubscribeBizImpl.java
View file @
9fd84137
This diff is collapsed.
Click to expand it.
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/entity/TimeControlTask.java
View file @
9fd84137
...
...
@@ -32,4 +32,7 @@ public class TimeControlTask {
private
String
successUnSubscribeWord
;
//1按天发送 2按周发送
private
Integer
sendType
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/entity/TimeControlTaskItem.java
View file @
9fd84137
...
...
@@ -3,6 +3,7 @@ package com.pcloud.book.timecontrol.entity;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
java.util.Date
;
import
java.util.List
;
public
class
TimeControlTaskItem
{
private
Integer
id
;
...
...
@@ -34,6 +35,49 @@ public class TimeControlTaskItem {
private
String
itemIntroduce
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
startTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
endTime
;
private
Integer
pushType
;
private
List
<
Integer
>
weekdays
;
public
List
<
Integer
>
getWeekdays
()
{
return
weekdays
;
}
public
void
setWeekdays
(
List
<
Integer
>
weekdays
)
{
this
.
weekdays
=
weekdays
;
}
public
Integer
getPushType
()
{
return
pushType
;
}
public
void
setPushType
(
Integer
pushType
)
{
this
.
pushType
=
pushType
;
}
public
Date
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
Date
startTime
)
{
this
.
startTime
=
startTime
;
}
public
Date
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
Date
endTime
)
{
this
.
endTime
=
endTime
;
}
public
Integer
getAddSendTime
()
{
return
addSendTime
;
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/entity/TimeControlTaskSend.java
View file @
9fd84137
...
...
@@ -36,4 +36,8 @@ public class TimeControlTaskSend implements Serializable {
private
String
sendHour
;
private
Integer
working
;
private
Integer
sendWeek
;
private
Integer
sendCount
;
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/facade/impl/TimeControlPrizeFacadeImpl.java
View file @
9fd84137
...
...
@@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.Map
;
import
java.util.Optional
;
...
...
@@ -68,7 +70,15 @@ public class TimeControlPrizeFacadeImpl {
@GetMapping
(
"downloadCertificate"
)
ResponseDto
<?>
downloadCertificate
(
@RequestHeader
String
token
,
@RequestParam
Integer
id
,
@RequestParam
Integer
type
)
{
String
url
=
taskPrizeBiz
.
downloadCertificate
(
id
,
type
);
return
new
ResponseDto
<>(
url
);
String
filePath
=
""
;
try
{
URLEncoder
.
encode
(
url
,
"utf-8"
);
filePath
=
new
String
(
url
.
getBytes
(
"iso8859-1"
),
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
return
new
ResponseDto
<>(
filePath
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/facade/impl/TimeControlTaskFacadeImpl.java
View file @
9fd84137
package
com
.
pcloud
.
book
.
timecontrol
.
facade
.
impl
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.timecontrol.biz.TaskBiz
;
import
com.pcloud.book.timecontrol.biz.TaskSubscribeBiz
;
import
com.pcloud.book.timecontrol.entity.TimeControlTask
;
import
com.pcloud.book.timecontrol.entity.TimeControlTaskSubscribe
;
import
com.pcloud.book.timecontrol.vo.KeyWordTaskVO
;
import
com.pcloud.common.dto.ResponseDto
;
...
...
@@ -168,4 +170,21 @@ public class TimeControlTaskFacadeImpl {
Integer
id
=
taskBiz
.
copyTaskItem
(
taskItemId
);
return
new
ResponseDto
<>(
id
);
}
@ApiOperation
(
value
=
"新增定时任务"
,
httpMethod
=
"GET"
)
@GetMapping
(
"addTask4TimeControl"
)
ResponseDto
<?>
addTask4TimeControl
(
@RequestHeader
String
token
,
@RequestParam
String
key
){
if
(
BookConstant
.
TIME_CONTROL_KEY
.
equalsIgnoreCase
(
key
)){
taskBiz
.
addTask4TimeControl
();
}
return
new
ResponseDto
<>();
}
@PostMapping
(
"updateTaskSendType"
)
@ApiOperation
(
value
=
"修改任务模板的发送方式"
,
httpMethod
=
"POST"
)
ResponseDto
<?>
updateTaskSendType
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
TimeControlTask
timeControlTask
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
taskBiz
.
updateTaskSendType
(
timeControlTask
);
return
new
ResponseDto
<>();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/mapper/TimeControlTaskItemMapper.java
View file @
9fd84137
...
...
@@ -3,6 +3,9 @@ package com.pcloud.book.timecontrol.mapper;
import
com.pcloud.book.timecontrol.entity.TimeControlTaskItem
;
import
com.pcloud.book.timecontrol.dto.ReplyMessageBaseDto
;
import
java.util.Date
;
import
com.pcloud.book.timecontrol.vo.request.TimeControlTaskItemVO
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Component
;
...
...
@@ -28,4 +31,12 @@ public interface TimeControlTaskItemMapper {
Integer
getTaskItemCount
(
@Param
(
"taskId"
)
Integer
taskId
);
List
<
TimeControlTaskItem
>
listByTaskId
(
Integer
taskId
);
Date
getMaxEndTime
(
Integer
taskId
);
void
deleteByTaskId
(
Integer
taskId
);
TimeControlTaskItemVO
getMonthDay
(
String
date
);
List
<
TimeControlTaskItemVO
>
getMonthSecondDay
(
String
date
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/mapper/TimeControlTaskItemWeekMapper.java
0 → 100644
View file @
9fd84137
package
com
.
pcloud
.
book
.
timecontrol
.
mapper
;
import
com.pcloud.book.timecontrol.dto.ReplyMessageBaseDto
;
import
com.pcloud.book.timecontrol.entity.TimeControlTaskItem
;
import
com.pcloud.book.timecontrol.entity.TimeControlWeekDay
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
(
"taskItemWeekMapper"
)
public
interface
TimeControlTaskItemWeekMapper
{
int
batchInsert
(
List
<
TimeControlWeekDay
>
record
);
List
<
TimeControlWeekDay
>
selectByItemId
(
Integer
taskItemId
);
Integer
getMaxWeekDay
(
Integer
taskItemId
);
void
batchDelete
(
List
<
Integer
>
taskItemIds
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/mapper/TimeControlTaskMapper.java
View file @
9fd84137
...
...
@@ -63,4 +63,5 @@ public interface TimeControlTaskMapper {
List
<
SubscribeTaskUserDTO
>
listTaskSubscribeUser4Pcloud
(
@Param
(
"pageNum"
)
Integer
pageNum
,
@Param
(
"numPerPage"
)
Integer
numPerPage
,
@Param
(
"search"
)
String
search
,
@Param
(
"taskId"
)
Integer
taskId
,
@Param
(
"subscribeType"
)
Integer
subscribeType
,
@Param
(
"wxIds"
)
List
<
String
>
wxIds
);
void
updateTaskSendType
(
TimeControlTask
taskDto
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/mapper/TimeControlTaskSendDetailMapper.java
0 → 100644
View file @
9fd84137
package
com
.
pcloud
.
book
.
timecontrol
.
mapper
;
import
com.pcloud.book.timecontrol.dto.SubscribeTaskUserDTO
;
import
com.pcloud.book.timecontrol.dto.TaskItemSendDto
;
import
com.pcloud.book.timecontrol.dto.TaskProgressItemDTO
;
import
com.pcloud.book.timecontrol.dto.TaskSendDto
;
import
com.pcloud.book.timecontrol.dto.TaskSendUserDto
;
import
com.pcloud.book.timecontrol.entity.TimeControlTaskSend
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Component
;
/**
* @date: 2020年01月31日 20:05
* @Author: Zcy
* @Descprition
*/
@Component
public
interface
TimeControlTaskSendDetailMapper
{
void
batchInsert
(
List
<
TimeControlTaskSend
>
taskSendList
);
Integer
getTaskItemSendCount
(
@Param
(
"startTime"
)
String
startTime
,
@Param
(
"endTime"
)
String
endTime
,
@Param
(
"robotWxId"
)
String
robotWxId
,
@Param
(
"taskName"
)
String
taskName
,
@Param
(
"sendContent"
)
String
sendContent
);
List
<
TaskItemSendDto
>
listTaskItemSendRecord4Pcloud
(
@Param
(
"pageNum"
)
Integer
pageNum
,
@Param
(
"numPerPage"
)
Integer
numPerPage
,
@Param
(
"startTime"
)
String
startTime
,
@Param
(
"endTime"
)
String
endTime
,
@Param
(
"robotWxId"
)
String
robotWxId
,
@Param
(
"taskName"
)
String
taskName
,
@Param
(
"sendContent"
)
String
sendContent
);
Integer
getTaskItemSendUserCount
(
@Param
(
"wxIds"
)
List
<
String
>
wxIds
,
@Param
(
"taskItemId"
)
Integer
taskItemId
,
@Param
(
"robotWxId"
)
String
robotWxId
,
@Param
(
"startTime"
)
String
startTime
,
@Param
(
"endTime"
)
String
endTime
);
List
<
TaskSendUserDto
>
listTaskItemSendUser4Pcloud
(
@Param
(
"pageNum"
)
Integer
pageNum
,
@Param
(
"numPerPage"
)
Integer
numPerPage
,
@Param
(
"wxIds"
)
List
<
String
>
wxIds
,
@Param
(
"taskItemId"
)
Integer
taskItemId
,
@Param
(
"robotWxId"
)
String
robotWxId
,
@Param
(
"startTime"
)
String
startTime
,
@Param
(
"endTime"
)
String
endTime
);
List
<
SubscribeTaskUserDTO
>
getTaskNoCompletedCount
(
@Param
(
"wxIds"
)
List
<
String
>
wxIds
,
@Param
(
"taskId"
)
Integer
taskId
);
Integer
getNoCompletedCount
(
@Param
(
"subscribeId"
)
Integer
subscribeId
);
Integer
getCompletedCount
(
Integer
subscribeId
);
List
<
TaskProgressItemDTO
>
getUserTaskItemProgress
(
@Param
(
"taskId"
)
Integer
taskId
,
@Param
(
"wxUserId"
)
String
wxUserId
);
void
updateSendState4Week
();
List
<
TaskSendDto
>
listTodayTask4Week
(
@Param
(
"taskItemId"
)
Integer
taskItemId
,
@Param
(
"weekDay"
)
Integer
weekDay
);
void
addSendCount
(
Integer
id
);
Integer
todayTaskSendCount
();
List
<
String
>
getTaskSendDateList
(
String
date
);
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/mapper/TimeControlTaskSendMapper.java
View file @
9fd84137
...
...
@@ -65,4 +65,9 @@ public interface TimeControlTaskSendMapper {
List
<
TaskProgressItemDTO
>
getUserTaskItemProgress
(
@Param
(
"taskId"
)
Integer
taskId
,
@Param
(
"wxUserId"
)
String
wxUserId
);
void
updateSendState4Week
();
List
<
TaskSendDto
>
listTodayTask4Week
(
@Param
(
"taskItemId"
)
Integer
taskItemId
,
@Param
(
"weekDay"
)
Integer
weekDay
);
void
addSendCount
(
Integer
id
);
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/service/impl/TimeControlTaskServiceImpl.java
View file @
9fd84137
...
...
@@ -9,6 +9,8 @@ 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
io.swagger.models.auth.In
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -24,6 +26,7 @@ import java.util.Map;
@RestController
(
"timeControlTaskService"
)
@RequestMapping
(
"timeControlTaskService"
)
@Slf4j
public
class
TimeControlTaskServiceImpl
implements
TimeControlTaskService
{
@Autowired
...
...
@@ -94,4 +97,22 @@ public class TimeControlTaskServiceImpl implements TimeControlTaskService {
taskSubscribeBiz
.
unSubscribeTask
(
wxId
,
null
,
taskId
);
}
@Override
@GetMapping
(
"updateSendState4Week"
)
public
void
updateSendState4Week
()
{
new
Thread
(()
->
{
taskBiz
.
updateSendState4Week
();
}).
start
();
}
@Override
@PostMapping
(
"sendTimeTaskMessage4Week"
)
public
void
sendTimeTaskMessage4Week
(
@RequestBody
Map
<
String
,
Object
>
map
)
{
new
Thread
(()
->
{
log
.
info
(
"sendTimeTaskMessage4Week开始执行定时任务"
);
Integer
taskItemId
=
(
Integer
)
map
.
get
(
"taskItemId"
);
taskSubscribeBiz
.
sendTimeTaskMessage4Week
(
taskItemId
);
}).
start
();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/vo/request/TimeControlTaskItemVO.java
0 → 100644
View file @
9fd84137
package
com
.
pcloud
.
book
.
timecontrol
.
vo
.
request
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.List
;
@Data
public
class
TimeControlTaskItemVO
{
private
Integer
id
;
private
Integer
pushType
;
private
Integer
sendType
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
startDay
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
endDay
;
private
String
weekDays
;
}
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/timecontrol/TimeControlTaskItemMapper.xml
View file @
9fd84137
...
...
@@ -16,17 +16,34 @@
<result
column=
"send_hour"
property=
"sendHour"
jdbcType=
"VARCHAR"
/>
<result
column=
"progress_guidance"
property=
"progressGuidance"
jdbcType=
"INTEGER"
/>
<result
column=
"item_introduce"
property=
"itemIntroduce"
jdbcType=
"VARCHAR"
/>
<result
column=
"start_time"
property=
"startTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"end_time"
property=
"endTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"push_type"
property=
"pushType"
jdbcType=
"INTEGER"
/>
</resultMap>
<resultMap
id=
"ReplyMessageBaseDtoMap"
type=
"com.pcloud.book.timecontrol.dto.ReplyMessageBaseDto"
>
<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=
"send_hour"
property=
"sendHour"
jdbcType=
"VARCHAR"
/>
<result
column=
"configState"
property=
"configState"
jdbcType=
"INTEGER"
/>
<result
column=
"start_time"
property=
"startTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"end_time"
property=
"endTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"push_type"
property=
"pushType"
jdbcType=
"INTEGER"
/>
<collection
property=
"weekdays"
ofType=
"integer"
>
<result
column=
"week_day"
jdbcType=
"INTEGER"
/>
</collection>
</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
,add_send_time,send_hour,progress_guidance, item_introduce
,add_send_time,send_hour,progress_guidance, item_introduce
,start_time,end_time,push_type
</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,add_send_time,send_hour,progress_guidance, item_introduce)
,td_confirm,finish_link_introduce,finish_link_url,add_send_time,send_hour,progress_guidance, item_introduce
,start_time,end_time,push_type
)
values (#{taskId}, #{startDay}, #{finishConfirm}, #{finishKeyWord}, now(), now(),#{tdConfirm},#{finishLinkIntroduce},#{finishLinkUrl}
,#{addSendTime},#{sendHour},#{progressGuidance}, #{itemIntroduce})
,#{addSendTime},#{sendHour},#{progressGuidance}, #{itemIntroduce}
,#{startTime},#{endTime},#{pushType}
)
</insert>
<update
id=
"updateTaskItem"
parameterType=
"com.pcloud.book.timecontrol.entity.TimeControlTaskItem"
>
...
...
@@ -41,7 +58,10 @@
add_send_time=#{addSendTime},
send_hour=#{sendHour},
progress_guidance=#{progressGuidance},
update_time = now(), item_introduce = #{itemIntroduce}
update_time = now(), item_introduce = #{itemIntroduce},
start_time = #{startTime},
end_time= #{endTime},
push_type = #{pushType}
where id = #{id}
</update>
...
...
@@ -59,11 +79,22 @@
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, send_hour sendHour,
if(finish_confirm=0,0,2) configState
from time_control_task_item where task_id = #{taskId}
order by startDay asc, send_hour asc
<select
id=
"listTaskItemDay"
resultMap=
"ReplyMessageBaseDtoMap"
>
select
item.id,
item.task_id ,
item.start_day ,
item.send_hour ,
if(item.finish_confirm=0,0,2) configState,
week.task_item_id,
week.week_day,
item.start_time,
item.end_time,
item.push_type
from time_control_task_item item
left join time_control_task_item_week week on item.id = week.task_item_id
where task_id = #{taskId}
order by start_time asc,end_time asc,start_day asc, send_hour asc
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
...
...
@@ -71,6 +102,11 @@
where id = #{id,jdbcType=INTEGER}
</delete>
<delete
id=
"deleteByTaskId"
parameterType=
"integer"
>
delete from time_control_task_item
where task_id = #{taskId}
</delete>
<select
id=
"getByItemIdList"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
...
...
@@ -98,4 +134,38 @@
WHERE
task_id = #{taskId}
</select>
<select
id=
"getMaxEndTime"
parameterType=
"Integer"
resultType=
"date"
>
select
max(end_time)
from
time_control_task_item
where
task_id = #{taskId}
</select>
<select
id=
"getMonthDay"
parameterType=
"String"
resultType=
"com.pcloud.book.timecontrol.vo.request.TimeControlTaskItemVO"
>
select a.id,if(min(a.start_time)
<![CDATA[ < ]]>
DATE_ADD(#{date},interval -day(#{date})+1 day),DATE_ADD(#{date},interval -day(#{date})+1 day),min(a.start_time)) startDay,
if(max(a.end_time)
<![CDATA[ > ]]>
last_day(#{date}),last_day(#{date}),max(a.end_time)) endDay
,a.push_type pushType,b.send_type sendType from time_control_task_item a
LEFT JOIN time_control_task b on b.task_id=a.task_id
where b.send_type=2
and end_time
<![CDATA[ >= ]]>
DATE_ADD(#{date},interval -day(#{date})+1 day)
AND start_time
<![CDATA[ <= ]]>
last_day(#{date})
and push_type=1
GROUP BY push_type;
</select>
<select
id=
"getMonthSecondDay"
parameterType=
"String"
resultType=
"com.pcloud.book.timecontrol.vo.request.TimeControlTaskItemVO"
>
select a.id,if(a.start_time
<![CDATA[ < ]]>
DATE_ADD(#{date},interval -day(#{date})+1 day) ,DATE_ADD(#{date},interval -day(#{date})+1 day),a.start_time)startDay,
if(a.end_time
<![CDATA[ > ]]>
last_day(#{date}),last_day(#{date}),a.end_time) endDay
,a.push_type pushType,b.send_type sendType ,GROUP_CONCAT(c.week_day) weekDays from time_control_task_item a
LEFT JOIN time_control_task b on b.task_id=a.task_id
LEFT JOIN time_control_task_item_week c on a.id=c.task_item_id
where b.send_type=2
and end_time
<![CDATA[ >= ]]>
DATE_ADD(#{date},interval -day(#{date})+1 day)
AND start_time
<![CDATA[ <= ]]>
last_day(#{date})
and push_type=2
GROUP BY a.id;
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/timecontrol/TimeControlTaskItemWeekMapper.xml
0 → 100644
View file @
9fd84137
<?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.TimeControlTaskItemWeekMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.timecontrol.entity.TimeControlWeekDay"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"task_item_id"
property=
"taskItemId"
jdbcType=
"INTEGER"
/>
<result
column=
"week_day"
property=
"weekDay"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, task_item_id, week_day, create_time
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.timecontrol.entity.TimeControlTaskItem"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into time_control_task_item_week(task_item_id, week_day, create_time)
values (#{taskItemId}, #{weekDay}, now())
</insert>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.timecontrol.entity.TimeControlTaskItem"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into time_control_task_item_week(task_item_id, week_day, create_time)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(#{item.taskItemId}, #{item.weekDay}, now())
</foreach>
</insert>
<delete
id=
"batchDelete"
parameterType=
"list"
>
delete
from
time_control_task_item_week
where
task_item_id in
<foreach
collection=
"list"
index=
"index"
item=
"item"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</delete>
<select
id=
"selectByItemId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
from time_control_task_item_week
where task_item_id = #{taskItemId}
</select>
<select
id=
"getMaxWeekDay"
parameterType=
"integer"
resultType=
"integer"
>
select
max(week_day)
from
time_control_task_item_week
where
task_item_id = #{taskItemId}
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/timecontrol/TimeControlTaskMapper.xml
View file @
9fd84137
...
...
@@ -15,6 +15,7 @@
<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"
/>
<result
column=
"send_type"
property=
"sendType"
jdbcType=
"TINYINT"
/>
</resultMap>
<resultMap
id=
"TaskDtoMap"
type=
"com.pcloud.book.timecontrol.dto.TaskDto"
>
...
...
@@ -30,7 +31,7 @@
</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
create_time, update_time, pro_label_id, dep_label_id, pur_label_id, success_subscribe_word, success_unsubscribe_word
,send_type
</sql>
<update
id=
"updateTask"
parameterType=
"com.pcloud.book.timecontrol.entity.TimeControlTask"
>
...
...
@@ -41,6 +42,16 @@
where task_id = #{taskId}
</update>
<update
id=
"updateTaskSendType"
parameterType=
"com.pcloud.book.timecontrol.entity.TimeControlTask"
>
update time_control_task
<set>
<if
test=
"sendType != null"
>
send_type = #{sendType}
</if>
</set>
where task_id = #{taskId}
</update>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
...
...
@@ -63,7 +74,8 @@
COUNT(b.id) taskItemCount,
a.pur_label_id purLabelId,
a.pro_label_id proLabelId,
a.dep_label_id depLabelId
a.dep_label_id depLabelId,
a.send_type sendType
FROM
time_control_task a
LEFT JOIN time_control_task_item b ON a.task_id = b.task_id
...
...
@@ -73,9 +85,11 @@
</if>
GROUP BY
a.task_id
order by a.create_time desc
<if
test=
"pageNum != null"
>
limit #{pageNum}, #{numPerPage}
</if>
</select>
<!--根据 专业/深度/目的 标签查询任务模板集合-->
...
...
@@ -224,10 +238,10 @@
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)
success_unsubscribe_word
,send_type
)
values (#{taskName,jdbcType=VARCHAR}, #{taskIntroduce,jdbcType=VARCHAR},
#{taskKeyWord,jdbcType=VARCHAR}, #{subscribeWord,jdbcType=VARCHAR}, #{advancedSetting,jdbcType=INTEGER},
now(), now(), #{proLabelId}, #{depLabelId}, #{purLabelId}, #{successSubscribeWord}, #{successUnSubscribeWord})
now(), now(), #{proLabelId}, #{depLabelId}, #{purLabelId}, #{successSubscribeWord}, #{successUnSubscribeWord}
, ifnull(#{sendType},2)
)
</insert>
<select
id=
"getTaskCompletedCount"
resultType=
"java.lang.Integer"
>
...
...
@@ -252,6 +266,7 @@
SELECT
a.task_id taskId,
a.task_name taskName,
a.send_type sendType,
COUNT(distinct c.id) taskItemCount,
COUNT(DISTINCT d.wx_user_id) subscribePersonCount
FROM time_control_task a
...
...
@@ -296,7 +311,9 @@
<select
id=
"listTaskSubscribeUser4Pcloud"
resultType=
"com.pcloud.book.timecontrol.dto.SubscribeTaskUserDTO"
>
select t1.wxUserId wxUserId,
t1.subscribeState subscribeState,
ifnull(t2.completedCount,0) completedCount from
ifnull(t2.completedCount,0) completedCount,
t2.sendCount
from
(select
wx_user_id wxUserId,
state subscribeState
...
...
@@ -315,8 +332,9 @@
)t1
left join
(
select wx_user_id wxId,count(1) completedCount
from time_control_task_send a where
select wx_user_id wxId,count(1) completedCount,
sum(send_count) sendCount
from time_control_task_send_detail a where
1=1
<if
test=
"wxIds != null and wxIds.size()>0"
>
and a.wx_user_id IN
...
...
pcloud-service-book/src/main/resources/mapper/timecontrol/TimeControlTaskSendDetailMapper.xml
0 → 100644
View file @
9fd84137
<?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.TimeControlTaskSendDetailMapper"
>
<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"
/>
<result
column=
"working"
property=
"working"
jdbcType=
"INTEGER"
/>
<result
column=
"complete_state"
property=
"completeState"
jdbcType=
"INTEGER"
/>
<result
column=
"send_week"
property=
"sendWeek"
jdbcType=
"INTEGER"
/>
<result
column=
"send_count"
property=
"sendCount"
jdbcType=
"INTEGER"
/>
</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, complete_state,send_week,send_count
</sql>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.timecontrol.entity.TimeControlTaskSend"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into time_control_task_send_detail
(wx_user_id, book_id, task_id, task_item_id, subscribe_id, send_day, send_state, create_time, send_hour,send_week)
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}, DATE_FORMAT(NOW(),'%Y-%m-%d'),
1, NOW(), #{item.sendHour},#{item.sendWeek}
)
</foreach>
</insert>
<select
id=
"getTaskItemSendCount"
resultType=
"java.lang.Integer"
>
select count(1) from (
select c.robot_wx_id
from
time_control_task_send_detail a LEFT JOIN
time_control_task b on a.task_id=b.task_id
LEFT JOIN time_control_task_subscribe c on a.subscribe_id=c.id
LEFT JOIN time_control_reply_message d on a.task_item_id=d.task_item_id
where 1=1
<if
test=
"startTime !=null"
>
and a.send_day
<![CDATA[ >= ]]>
STR_TO_DATE(#{startTime},'%Y-%m-%d')
</if>
<if
test=
"endTime !=null"
>
and a.send_day
<![CDATA[ <= ]]>
STR_TO_DATE(#{endTime},'%Y-%m-%d')
</if>
<if
test=
"robotWxId !=null"
>
and c.robot_wx_id=#{robotWxId}
</if>
<if
test=
"taskName !=null"
>
and b.task_name like concat('%', #{taskName}, '%')
</if>
<if
test=
"sendContent !=null"
>
and d.content like concat('%', #{sendContent}, '%')
</if>
group by
a.task_item_id,c.robot_wx_id
)s
</select>
<select
id=
"listTaskItemSendRecord4Pcloud"
resultType=
"com.pcloud.book.timecontrol.dto.TaskItemSendDto"
>
select
a.task_id taskId,
b.task_name taskName,
a.task_item_id taskItemId,
c.robot_wx_id robotWxId,
ifnull(count(DISTINCT a.wx_user_id),0) sendPersonCount,
e.create_time createTime
from
time_control_task_send_detail a LEFT JOIN
time_control_task b on a.task_id=b.task_id
LEFT JOIN time_control_task_subscribe c on a.subscribe_id=c.id
LEFT JOIN time_control_reply_message d on a.task_item_id=d.task_item_id
LEFT JOIN time_control_task_item e on a.task_item_id = e.id
where 1=1
<if
test=
"startTime !=null"
>
and a.send_day
<![CDATA[ >= ]]>
STR_TO_DATE(#{startTime},'%Y-%m-%d')
</if>
<if
test=
"endTime !=null"
>
and a.send_day
<![CDATA[ <= ]]>
STR_TO_DATE(#{endTime},'%Y-%m-%d')
</if>
<if
test=
"robotWxId !=null"
>
and c.robot_wx_id=#{robotWxId}
</if>
<if
test=
"taskName !=null"
>
and b.task_name like concat('%', #{taskName}, '%')
</if>
<if
test=
"sendContent !=null"
>
and d.content like concat('%', #{sendContent}, '%')
</if>
GROUP BY
a.task_item_id,c.robot_wx_id
<if
test=
"pageNum != null"
>
limit #{pageNum}, #{numPerPage}
</if>
</select>
<select
id=
"getTaskItemSendUserCount"
resultType=
"java.lang.Integer"
>
SELECT ifnull(COUNT(DISTINCT a.wx_user_id),0) FROM time_control_task_send_detail a
LEFT JOIN time_control_task_subscribe b ON a.subscribe_id = b.id
where 1=1
<if
test=
"wxIds != null and wxIds.size()>0"
>
and a.wx_user_id IN
<foreach
collection=
"wxIds"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
</if>
and a.task_item_id=#{taskItemId} AND b.robot_Wx_id = #{robotWxId}
<if
test=
"startTime !=null"
>
and a.send_day
<![CDATA[ >= ]]>
STR_TO_DATE(#{startTime},'%Y-%m-%d')
</if>
<if
test=
"endTime !=null"
>
and a.send_day
<![CDATA[ <= ]]>
STR_TO_DATE(#{endTime},'%Y-%m-%d')
</if>
</select>
<select
id=
"listTaskItemSendUser4Pcloud"
resultType=
"com.pcloud.book.timecontrol.dto.TaskSendUserDto"
>
SELECT
a.task_id taskId,
a.task_item_id taskItemId,
a.wx_user_id wxUserId,
a.send_state sendState, a.send_day sendDay, a.send_hour sendHour
FROM time_control_task_send_detail a
LEFT JOIN time_control_task_subscribe b on a.subscribe_id = b.id
where 1=1
<if
test=
"wxIds != null and wxIds.size()>0"
>
and a.wx_user_id IN
<foreach
collection=
"wxIds"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
</if>
and a.task_item_id=#{taskItemId} AND b.robot_wx_id = #{robotWxId}
<if
test=
"startTime !=null"
>
and a.send_day
<![CDATA[ >= ]]>
STR_TO_DATE(#{startTime},'%Y-%m-%d')
</if>
<if
test=
"endTime !=null"
>
and a.send_day
<![CDATA[ <= ]]>
STR_TO_DATE(#{endTime},'%Y-%m-%d')
</if>
<if
test=
"pageNum != null"
>
limit #{pageNum}, #{numPerPage}
</if>
</select>
<select
id=
"getTaskNoCompletedCount"
resultType=
"com.pcloud.book.timecontrol.dto.SubscribeTaskUserDTO"
>
select
wx_user_id wxUserId,
ifnull(count(1),0) noCompletedCount
from time_control_task_send
where task_id=#{taskId}
and complete_state=0
and send_state !=2
<if
test=
"wxIds !=null and wxIds.size()>0"
>
and wx_user_id IN
<foreach
collection=
"wxIds"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
</if>
group by wx_user_id
</select>
<select
id=
"getNoCompletedCount"
resultType=
"java.lang.Integer"
>
select ifnull(count(1),0)
from time_control_task_send
WHERE subscribe_id =#{subscribeId}
and complete_state !=1 AND send_state !=2
</select>
<select
id=
"getCompletedCount"
resultType=
"java.lang.Integer"
>
select ifnull(count(1),0)
from time_control_task_send
WHERE subscribe_id =#{subscribeId}
and working =1 and complete_state = 1
</select>
<select
id=
"getUserTaskItemProgress"
resultType=
"com.pcloud.book.timecontrol.dto.TaskProgressItemDTO"
>
SELECT
s.id taskSendId,
s.task_id taskId,
s.task_item_id taskItemId,
CONCAT(s.send_day, ' ', s.send_hour) taskItemName,
s.complete_state completeState,
IF (i.id IS NULL, 0, 1) hasPrize
FROM
time_control_task_send_detail s
LEFT JOIN time_control_task_prize_item i ON s.task_id = i.task_id
AND s.task_item_id = i.task_item_id
WHERE
s.task_id = #{taskId}
AND s.wx_user_id = #{wxUserId}
AND working = 1
GROUP BY
s.id
ORDER BY
s.send_day,
s.send_hour
</select>
<update
id=
"updateSendState4Week"
>
update
time_control_task_send
set
send_state = 0
where
working = 1
and
complete_state = 0
and
send_state = 1
and
send_week is not null
</update>
<select
id=
"listTodayTask4Week"
parameterType=
"map"
resultType=
"com.pcloud.book.timecontrol.dto.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
left join time_control_task_item t on a.task_item_id = t.id
where
a.send_state = 0
and
a.send_week is not null
and
DATE_FORMAT(NOW(), '%Y-%m-%d')
>
= t.start_time
and
DATE_FORMAT(NOW(), '%Y-%m-%d')
<
= t.end_time
and
a.send_week = #{weekDay}
and
a.task_item_id = #{taskItemId}
</select>
<select
id=
"todayTaskSendCount"
resultType=
"java.lang.Integer"
>
SELECT ifnull(COUNT(1),0) FROM time_control_task_send_detail WHERE send_state = 1
AND send_day =DATE_FORMAT(NOW(), '%Y-%m-%d')
</select>
<update
id=
"addSendCount"
parameterType=
"integer"
>
update
time_control_task_send
set
send_count = send_count + 1
where
id = #{id}
</update>
<select
id=
"getTaskSendDateList"
resultType=
"java.lang.String"
>
SELECT DISTINCT send_day from time_control_task_send_detail where SUBSTRING_INDEX(send_day,"-",2)=#{date}
ORDER BY send_day
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/timecontrol/TimeControlTaskSendMapper.xml
View file @
9fd84137
...
...
@@ -13,21 +13,23 @@
<result
column=
"send_day"
property=
"sendDay"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"working"
property=
"working"
jdbcType=
"INTEGER"
/>
<result
column=
"complete_state"
property=
"completeState"
jdbcType=
"INTEGER"
/>
<result
column=
"send_week"
property=
"sendWeek"
jdbcType=
"INTEGER"
/>
<result
column=
"send_count"
property=
"sendCount"
jdbcType=
"INTEGER"
/>
</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, complete_state
id, wx_user_id, book_id, task_id, task_item_id, subscribe_id, send_day, send_state, create_time, complete_state
,send_week,send_count
</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, send_hour)
(wx_user_id, book_id, task_id, task_item_id, subscribe_id, send_day, send_state, create_time, send_hour
,send_week,send_count
)
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(), #{item.sendHour}
#{item.sendState,jdbcType=INTEGER}, NOW(), #{item.sendHour}
,#{item.sendWeek},#{item.sendCount}
)
</foreach>
</insert>
...
...
@@ -38,11 +40,18 @@
b.robot_wx_id robotWxId,
a.wx_user_id wxUserId,
a.task_id taskId,
a.task_item_id taskItemId
a.task_item_id taskItemId,
a.book_id bookId,
a.task_id taskId,
a.subscribe_id subscribeId,
a.send_day sendDay,
a.send_hour sendHour,
a.send_week sendWeek
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 CONCAT_WS(" ",a.send_day,SUBSTRING_INDEX(a.send_hour,":",1)) = DATE_FORMAT(NOW(), '%Y-%m-%d %H');
and CONCAT_WS(" ",a.send_day,SUBSTRING_INDEX(a.send_hour,":",1)) = DATE_FORMAT(NOW(), '%Y-%m-%d %H')
and send_week is null;
</select>
...
...
@@ -273,4 +282,58 @@
s.send_day,
s.send_hour
</select>
<update
id=
"updateSendState4Week"
>
update
time_control_task_send
set
send_state = 0
where
working = 1
and
complete_state = 0
and
send_state = 1
and
send_week is not null
</update>
<select
id=
"listTodayTask4Week"
parameterType=
"map"
resultType=
"com.pcloud.book.timecontrol.dto.TaskSendDto"
>
select
a.id id,
b.robot_wx_id robotWxId,
a.wx_user_id wxUserId,
a.task_id taskId,
a.task_item_id taskItemId,
a.book_id bookId,
a.task_id taskId,
a.subscribe_id subscribeId,
a.send_day sendDay,
a.send_hour sendHour,
a.send_week sendWeek
from time_control_task_send a
left join time_control_task_subscribe b on a.subscribe_id = b.id
left join time_control_task_item t on a.task_item_id = t.id
where
a.send_state = 0
and
a.send_week is not null
and
DATE_FORMAT(NOW(), '%Y-%m-%d')
>
= t.start_time
and
DATE_FORMAT(NOW(), '%Y-%m-%d')
<
= t.end_time
and
a.send_week = #{weekDay}
and
a.task_item_id = #{taskItemId}
</select>
<update
id=
"addSendCount"
parameterType=
"integer"
>
update
time_control_task_send
set
send_count = send_count + 1
where
id = #{id}
</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