Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
0adafea3
Commit
0adafea3
authored
Mar 07, 2025
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
朋友圈
parent
3eeec831
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
280 additions
and
88 deletions
+280
-88
TaskDetailDTO.java
...a/com/gic/haoban/manage/api/dto/moment/TaskDetailDTO.java
+10
-0
NoticeMessageTypeEnum.java
...om/gic/haoban/manage/api/enums/NoticeMessageTypeEnum.java
+2
-1
QwMomentPlanAttendMapper.java
...e/service/dao/mapper/moment/QwMomentPlanAttendMapper.java
+3
-0
QwMomentPlanDataMapper.java
...age/service/dao/mapper/moment/QwMomentPlanDataMapper.java
+1
-3
QwMomentPlanMapper.java
.../manage/service/dao/mapper/moment/QwMomentPlanMapper.java
+3
-0
TabQwMomentPlan.java
.../haoban/manage/service/entity/moment/TabQwMomentPlan.java
+10
-0
TabQwMomentPlanData.java
...ban/manage/service/entity/moment/TabQwMomentPlanData.java
+18
-0
QwMomentPlanDataService.java
...anage/service/service/moment/QwMomentPlanDataService.java
+5
-0
QwMomentPlanService.java
...an/manage/service/service/moment/QwMomentPlanService.java
+7
-0
QwMomentPlanAttendServiceImpl.java
...ce/service/moment/impl/QwMomentPlanAttendServiceImpl.java
+59
-1
QwMomentPlanDataServiceImpl.java
...vice/service/moment/impl/QwMomentPlanDataServiceImpl.java
+79
-2
QwMomentPlanServiceImpl.java
.../service/service/moment/impl/QwMomentPlanServiceImpl.java
+47
-4
qwMomentPlanAttendMapper.xml
...main/resources/mapper/moment/qwMomentPlanAttendMapper.xml
+6
-1
qwMomentPlanDataMapper.xml
...c/main/resources/mapper/moment/qwMomentPlanDataMapper.xml
+18
-74
qwMomentPlanMapper.xml
...e/src/main/resources/mapper/moment/qwMomentPlanMapper.xml
+11
-1
MomentTest.java
haoban-manage3-service/src/test/java/MomentTest.java
+1
-1
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/moment/TaskDetailDTO.java
View file @
0adafea3
...
...
@@ -7,6 +7,8 @@ public class TaskDetailDTO implements Serializable {
private
Long
planId
;
private
Long
attendId
;
private
String
clerkId
;
/**
...
...
@@ -60,6 +62,14 @@ public class TaskDetailDTO implements Serializable {
// 0已失效1待执行 2已执行
private
Integer
taskStatus
;
public
Long
getAttendId
()
{
return
attendId
;
}
public
void
setAttendId
(
Long
attendId
)
{
this
.
attendId
=
attendId
;
}
public
Integer
getTaskStatus
()
{
return
taskStatus
;
}
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/enums/NoticeMessageTypeEnum.java
View file @
0adafea3
...
...
@@ -40,7 +40,8 @@ public enum NoticeMessageTypeEnum {
TEL_TASK_CANVAS
(
2017
,
"话务任务通知"
,
NoticeMessageCategoryTypeEnum
.
TASK
.
getType
(),
"haobanTelTaskCanvas"
,
"/pages/route/index?pageType="
,
"hbapp_canvas_task"
,
"haobanTelTaskCanvas"
,
"haobanNotice"
),
HB_TASK_TO_DO_LIST_NOTICE
(
2018
,
"任务执行提醒"
,
NoticeMessageCategoryTypeEnum
.
TASK
.
getType
(),
"haobanTaskTodoNotice"
,
"/pages/route/index?pageType="
,
""
,
"haobanTaskTodoNotice"
,
"haobanNotice"
),
hbapp_canvas_friend_circle_task
(
2019
,
"朋友圈活动-任务详情"
,
NoticeMessageCategoryTypeEnum
.
TASK
.
getType
(),
"haobanTaskTodoNotice"
,
"/pages/route/index?pageType="
,
"hbapp_canvas_friend_circle_task"
,
"haobanTaskTodoNotice"
,
"haobanNotice"
),
hbapp_canvas_friend_circle_list
(
2020
,
"朋友圈-活动列表"
,
NoticeMessageCategoryTypeEnum
.
TASK
.
getType
(),
"haobanTelTaskCanvas"
,
"/pages/route/index?pageType="
,
"hbapp_canvas_friend_circle_list"
,
"haobanTelTaskCanvas"
,
"haobanNotice"
),
STORE_ACCOUNT
(
3001
,
"账号申请"
,
NoticeMessageCategoryTypeEnum
.
OTHER
.
getType
(),
"store_account"
,
"/pages/route/index?pageType="
,
"store_relate_store_record_list"
,
"accountApplication"
,
"haobanNotice"
),
//
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/moment/QwMomentPlanAttendMapper.java
View file @
0adafea3
...
...
@@ -8,6 +8,7 @@ import com.gic.haoban.manage.api.qdto.moment.TaskListWxaQDTO;
import
com.gic.haoban.manage.service.entity.moment.TabQwMomentPlanAttend
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
public
interface
QwMomentPlanAttendMapper
{
...
...
@@ -37,4 +38,6 @@ public interface QwMomentPlanAttendMapper {
TaskDetailDTO
taskDetail
(
@Param
(
"planId"
)
Long
planId
,
@Param
(
"clerkId"
)
String
execClerkId
);
List
<
TaskListWxaDTO
>
taskListWxa
(
TaskListWxaQDTO
qdto
);
void
finishTask
(
@Param
(
"planId"
)
Long
attendId
,
@Param
(
"sendTime"
)
Date
sendTime
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/moment/QwMomentPlanDataMapper.java
View file @
0adafea3
...
...
@@ -8,9 +8,7 @@ import java.util.List;
public
interface
QwMomentPlanDataMapper
{
void
insert
(
QwMomentPlanDataDTO
dto
)
;
void
update
(
QwMomentPlanDataDTO
dto
)
;
void
batchInsert
(
List
<
TabQwMomentPlanData
>
list
)
;
List
<
QwMomentPlanDataDTO
>
list
(
PlanDataListQDTO
qdto
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/moment/QwMomentPlanMapper.java
View file @
0adafea3
...
...
@@ -4,6 +4,7 @@ import com.gic.haoban.manage.api.dto.moment.QwMomentPlanDTO;
import
com.gic.haoban.manage.api.dto.moment.QwMomentPlanWxaDTO
;
import
com.gic.haoban.manage.api.qdto.moment.PlanListWxaQDTO
;
import
com.gic.haoban.manage.api.qdto.moment.QwMomentPlanQDTO
;
import
com.gic.haoban.manage.api.qdto.moment.TaskNumQDTO
;
import
com.gic.haoban.manage.service.entity.moment.TabQwMomentPlan
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -26,4 +27,6 @@ public interface QwMomentPlanMapper {
List
<
TabQwMomentPlan
>
list
(
QwMomentPlanQDTO
qdto
);
List
<
QwMomentPlanWxaDTO
>
planListWxa
(
PlanListWxaQDTO
qdto
);
int
getTaskNum
(
TaskNumQDTO
qdto
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/moment/TabQwMomentPlan.java
View file @
0adafea3
...
...
@@ -70,9 +70,19 @@ public class TabQwMomentPlan implements Serializable{
private
Integer
totalCommentCount
;
/**企微jobid*/
private
String
qwJobid
;
/**朋友圈id */
private
String
momentId
;
/**完成率*/
private
Integer
execRate
;
public
String
getMomentId
()
{
return
momentId
;
}
public
void
setMomentId
(
String
momentId
)
{
this
.
momentId
=
momentId
;
}
public
Long
getPlanId
()
{
return
planId
;
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/moment/TabQwMomentPlanData.java
View file @
0adafea3
...
...
@@ -28,6 +28,8 @@ public class TabQwMomentPlanData implements Serializable{
private
String
staffId
;
/**导购*/
private
String
clerkId
;
private
String
clerkCode
;
private
String
clerkName
;
/**门店id*/
private
String
storeId
;
/**客户id*/
...
...
@@ -47,6 +49,22 @@ public class TabQwMomentPlanData implements Serializable{
/**是否点赞*/
private
Integer
likeFlag
;
public
String
getClerkCode
()
{
return
clerkCode
;
}
public
void
setClerkCode
(
String
clerkCode
)
{
this
.
clerkCode
=
clerkCode
;
}
public
String
getClerkName
()
{
return
clerkName
;
}
public
void
setClerkName
(
String
clerkName
)
{
this
.
clerkName
=
clerkName
;
}
public
Long
getDataId
()
{
return
dataId
;
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/moment/QwMomentPlanDataService.java
View file @
0adafea3
...
...
@@ -4,9 +4,14 @@ import com.gic.api.base.commons.Page;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.moment.QwMomentPlanDataDTO
;
import
com.gic.haoban.manage.api.qdto.moment.PlanDataListQDTO
;
import
com.gic.haoban.manage.service.entity.moment.TabQwMomentPlanAttend
;
import
com.gic.wechat.api.dto.qywx.moment.MomentResultDTO
;
public
interface
QwMomentPlanDataService
{
ServiceResponse
<
Page
<
QwMomentPlanDataDTO
>>
dataList
(
PlanDataListQDTO
qdto
)
;
ServiceResponse
<
Void
>
save
(
TabQwMomentPlanAttend
task
,
MomentResultDTO
dto
)
;
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/moment/QwMomentPlanService.java
View file @
0adafea3
...
...
@@ -7,6 +7,7 @@ import com.gic.haoban.manage.api.dto.moment.QwMomentPlanWxaDTO;
import
com.gic.haoban.manage.api.qdto.moment.PlanListWxaQDTO
;
import
com.gic.haoban.manage.api.qdto.moment.QwMomentPlanQDTO
;
import
com.gic.haoban.manage.api.qdto.moment.TaskNumQDTO
;
import
com.gic.haoban.manage.service.entity.moment.TabQwMomentPlanAttend
;
public
interface
QwMomentPlanService
{
...
...
@@ -26,4 +27,10 @@ public interface QwMomentPlanService {
ServiceResponse
<
Integer
>
getTaskNum
(
TaskNumQDTO
qdto
);
ServiceResponse
<
Page
<
QwMomentPlanWxaDTO
>>
planListWxa
(
PlanListWxaQDTO
qdto
);
/**
* 拉取企微点赞、评论
* @param task
*/
public
void
getQwData
(
TabQwMomentPlanAttend
task
)
;
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/moment/impl/QwMomentPlanAttendServiceImpl.java
View file @
0adafea3
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
moment
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.commons.util.UniqueIdUtils
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.dto.moment.QwMomentPlanAttendDTO
;
import
com.gic.haoban.manage.api.dto.moment.TaskDetailDTO
;
import
com.gic.haoban.manage.api.dto.moment.TaskListWxaDTO
;
import
com.gic.haoban.manage.api.qdto.moment.PlanClerkListQDTO
;
import
com.gic.haoban.manage.api.qdto.moment.SendResultQDTO
;
import
com.gic.haoban.manage.api.qdto.moment.TaskListWxaQDTO
;
import
com.gic.haoban.manage.service.dao.mapper.StaffMapper
;
import
com.gic.haoban.manage.service.dao.mapper.moment.QwMomentPlanAttendMapper
;
import
com.gic.haoban.manage.service.dao.mapper.moment.QwMomentPlanMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.gic.haoban.manage.service.entity.moment.TabQwMomentPlanAttend
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.service.moment.QwMomentPlanAttendService
;
import
com.gic.wechat.api.dto.qdto.group.QywxMomentInfoQDTO
;
import
com.gic.wechat.api.dto.qywx.group.QywxMomentRespDTO
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.github.pagehelper.PageHelper
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -23,6 +33,7 @@ import org.apache.logging.log4j.Logger;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -35,6 +46,14 @@ public class QwMomentPlanAttendServiceImpl implements QwMomentPlanAttendService
private
QwMomentPlanAttendMapper
qwMomentPlanAttendMapper
;
@Autowired
private
ClerkService
clerkService
;
@Autowired
private
QywxSuiteApiService
qywxSuiteApiService
;
@Autowired
private
WxEnterpriseService
wxEnterpriseService
;
@Autowired
private
StaffMapper
staffMapper
;
@Autowired
private
QwMomentPlanMapper
qwMomentPlanMapper
;
@Override
public
ServiceResponse
<
Page
<
QwMomentPlanAttendDTO
>>
attendList
(
PlanClerkListQDTO
qdto
)
{
...
...
@@ -101,6 +120,45 @@ public class QwMomentPlanAttendServiceImpl implements QwMomentPlanAttendService
@Override
public
ServiceResponse
<
Void
>
finishTask
(
SendResultQDTO
qdto
)
{
return
null
;
Long
planId
=
qdto
.
getPlanId
()
;
String
clerkId
=
qdto
.
getClerkId
()
;
TaskDetailDTO
dto
=
this
.
qwMomentPlanAttendMapper
.
taskDetail
(
planId
,
clerkId
)
;
if
(
null
==
dto
)
{
return
ServiceResponse
.
failure
(
"9999"
,
"任务不存在"
);
}
this
.
qwMomentPlanAttendMapper
.
finishTask
(
dto
.
getAttendId
(),
qdto
.
getSendTime
())
;
this
.
qwMomentPlanMapper
.
updateClerkNum
(
planId
,-
1
,-
1
,
1
);
String
momentId
=
this
.
getMomentId
(
qdto
.
getStaffId
()
,
qdto
.
getSendTime
())
;
return
ServiceResponse
.
success
()
;
}
public
String
getMomentId
(
String
staffId
,
Date
sendTime
)
{
Date
startTime
=
DateUtil
.
addNumForSecond
(
sendTime
,-
10
)
;
Date
endTime
=
DateUtil
.
addNumForMinute
(
sendTime
,
1
)
;
TabHaobanStaff
staff
=
this
.
staffMapper
.
selectByPrimaryKey
(
staffId
)
;
String
wxEnterpriseId
=
staff
.
getWxEnterpriseId
()
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
String
wxUserId
=
staff
.
getWxUserId
()
;
if
(
qwDTO
.
needOpenUserId3th
())
{
wxUserId
=
staff
.
getWxOpenUseId
()
;
}
QywxMomentInfoQDTO
qywxMomentInfoQDTO
=
new
QywxMomentInfoQDTO
();
qywxMomentInfoQDTO
.
setCorpid
(
qwDTO
.
getThirdCorpid
());
qywxMomentInfoQDTO
.
setSuiteid
(
qwDTO
.
getSelf3thSecret
());
qywxMomentInfoQDTO
.
setStartTime
(
startTime
.
getTime
()
/
1000
);
qywxMomentInfoQDTO
.
setEndTime
(
endTime
.
getTime
()
/
1000
);
qywxMomentInfoQDTO
.
setCreatorId
(
wxUserId
);
qywxMomentInfoQDTO
.
setPageSize
(
1
);
ServiceResponse
<
QywxMomentRespDTO
>
serviceResponse
=
qywxSuiteApiService
.
queryQywxMomentList
(
qywxMomentInfoQDTO
,
qwDTO
.
isSelf
(),
qwDTO
.
getUrlHost
());
logger
.
info
(
"查询朋友圈id={},{},{}"
,
staffId
,
sendTime
,
JSONObject
.
toJSONString
(
serviceResponse
));
List
<
QywxMomentRespDTO
.
QywxMomentInfoDTO
>
list
=
serviceResponse
.
getResult
().
getQywxMomentInfos
()
;
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
return
list
.
get
(
0
).
getMomentId
()
;
}
return
null
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/moment/impl/QwMomentPlanDataServiceImpl.java
View file @
0adafea3
...
...
@@ -3,21 +3,31 @@ package com.gic.haoban.manage.service.service.moment.impl;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.commons.util.UniqueIdUtils
;
import
com.gic.haoban.manage.api.dto.moment.QwMomentPlanDataDTO
;
import
com.gic.haoban.manage.api.qdto.moment.PlanDataListQDTO
;
import
com.gic.haoban.manage.service.dao.mapper.moment.QwMomentPlanDataMapper
;
import
com.gic.haoban.manage.service.entity.moment.TabQwMomentPlanAttend
;
import
com.gic.haoban.manage.service.entity.moment.TabQwMomentPlanData
;
import
com.gic.haoban.manage.service.service.ExternalClerkRelatedService
;
import
com.gic.haoban.manage.service.service.moment.QwMomentPlanDataService
;
import
com.gic.wechat.api.dto.qywx.moment.MomentComments
;
import
com.gic.wechat.api.dto.qywx.moment.MomentResultDTO
;
import
com.github.pagehelper.PageHelper
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.*
;
@Service
(
"qwMomentPlanDataService"
)
public
class
QwMomentPlanDataServiceImpl
implements
QwMomentPlanDataService
{
@Autowired
private
QwMomentPlanDataMapper
qwMomentPlanDataMapper
;
@Autowired
private
ExternalClerkRelatedService
externalClerkRelatedService
;
@Override
public
ServiceResponse
<
Page
<
QwMomentPlanDataDTO
>>
dataList
(
PlanDataListQDTO
qdto
)
{
...
...
@@ -39,5 +49,72 @@ public class QwMomentPlanDataServiceImpl implements QwMomentPlanDataService {
return
ServiceResponse
.
success
(
retPage
);
}
@Override
public
ServiceResponse
<
Void
>
save
(
TabQwMomentPlanAttend
task
,
MomentResultDTO
dto
)
{
Set
<
String
>
set
=
new
HashSet
<>()
;
Map
<
String
,
TabQwMomentPlanData
>
map
=
new
HashMap
<>()
;
List
<
MomentComments
>
likeList
=
dto
.
getLikeList
()
;
if
(
CollectionUtils
.
isNotEmpty
(
likeList
))
{
for
(
MomentComments
item
:
likeList
)
{
String
externalUserid
=
item
.
getExternal_userid
()
;
String
memberId
=
this
.
externalClerkRelatedService
.
getMemberIdByExternalId
(
task
.
getWxEnterpriseId
(),
externalUserid
)
;
if
(
StringUtils
.
isBlank
(
memberId
))
{
set
.
add
(
externalUserid
)
;
continue
;
}
TabQwMomentPlanData
data
=
new
TabQwMomentPlanData
()
;
data
.
setMemberId
(
memberId
);
data
.
setLikeFlag
(
1
);
data
.
setLikeTime
(
new
Date
(
item
.
getCreate_time
()*
1000
));
map
.
put
(
externalUserid
,
data
)
;
}
}
List
<
MomentComments
>
commentList
=
dto
.
getCommentList
()
;
if
(
CollectionUtils
.
isNotEmpty
(
commentList
))
{
for
(
MomentComments
item
:
commentList
)
{
String
externalUserid
=
item
.
getExternal_userid
()
;
if
(
set
.
contains
(
externalUserid
))
{
continue
;
}
TabQwMomentPlanData
data
=
map
.
get
(
externalUserid
)
;
if
(
null
!=
data
)
{
data
.
setCommentFlag
(
1
);
data
.
setCommentTime
(
new
Date
(
item
.
getCreate_time
()*
1000
));
}
else
{
String
memberId
=
this
.
externalClerkRelatedService
.
getMemberIdByExternalId
(
task
.
getWxEnterpriseId
(),
externalUserid
)
;
if
(
StringUtils
.
isBlank
(
memberId
))
{
continue
;
}
data
=
new
TabQwMomentPlanData
()
;
data
.
setMemberId
(
memberId
);
data
.
setCommentFlag
(
1
);
data
.
setCommentTime
(
new
Date
(
item
.
getCreate_time
()*
1000
));
map
.
put
(
externalUserid
,
data
)
;
}
}
}
List
<
TabQwMomentPlanData
>
addList
=
new
ArrayList
<>()
;
Set
<
String
>
keySet
=
map
.
keySet
()
;
Iterator
<
String
>
it
=
keySet
.
iterator
()
;
while
(
it
.
hasNext
())
{
String
key
=
it
.
next
()
;
TabQwMomentPlanData
value
=
map
.
get
(
key
)
;
if
(
null
!=
value
)
{
value
.
setDataId
(
UniqueIdUtils
.
uniqueLong
());
value
.
setPlanId
(
task
.
getPlanId
());
value
.
setEnterpriseId
(
task
.
getEnterpriseId
());
value
.
setStaffId
(
task
.
getStaffId
());
value
.
setClerkId
(
task
.
getClerkId
());
value
.
setStoreId
(
task
.
getStoreId
());
value
.
setWxEnterpriseId
(
task
.
getWxEnterpriseId
());
value
.
setClerkCode
(
task
.
getClerkCode
());
value
.
setClerkName
(
task
.
getClerkName
());
addList
.
add
(
value
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
addList
))
{
this
.
qwMomentPlanDataMapper
.
batchInsert
(
addList
);
}
return
ServiceResponse
.
success
();
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/moment/impl/QwMomentPlanServiceImpl.java
View file @
0adafea3
...
...
@@ -18,20 +18,27 @@ import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import
com.gic.haoban.manage.api.dto.moment.QwMomentPlanAttendDTO
;
import
com.gic.haoban.manage.api.dto.moment.QwMomentPlanDTO
;
import
com.gic.haoban.manage.api.dto.moment.QwMomentPlanWxaDTO
;
import
com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum
;
import
com.gic.haoban.manage.api.qdto.moment.PlanListWxaQDTO
;
import
com.gic.haoban.manage.api.qdto.moment.QwMomentPlanQDTO
;
import
com.gic.haoban.manage.api.qdto.moment.TaskNumQDTO
;
import
com.gic.haoban.manage.api.service.StaffClerkRelationApiService
;
import
com.gic.haoban.manage.api.util.notify.NoticeMessageUtil
;
import
com.gic.haoban.manage.service.dao.mapper.StaffMapper
;
import
com.gic.haoban.manage.service.dao.mapper.moment.QwMomentPlanAttendMapper
;
import
com.gic.haoban.manage.service.dao.mapper.moment.QwMomentPlanMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.gic.haoban.manage.service.entity.moment.TabQwMomentPlan
;
import
com.gic.haoban.manage.service.entity.moment.TabQwMomentPlanAttend
;
import
com.gic.haoban.manage.service.service.QywxSendService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.service.moment.QwMomentPlanAttendService
;
import
com.gic.haoban.manage.service.service.moment.QwMomentPlanDataService
;
import
com.gic.haoban.manage.service.service.moment.QwMomentPlanService
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.quartz.api.dto.QuartzTaskDTO
;
import
com.gic.quartz.api.service.QuartzService
;
import
com.gic.wechat.api.dto.qywx.moment.MomentResultDTO
;
import
com.gic.wechat.api.service.qywx.QywxExternalUserService
;
import
com.github.pagehelper.PageHelper
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -74,6 +81,10 @@ public class QwMomentPlanServiceImpl implements QwMomentPlanService {
private
QywxExternalUserService
qywxExternalUserService
;
@Autowired
private
WxEnterpriseService
wxEnterpriseService
;
@Autowired
private
StaffMapper
staffMapper
;
@Autowired
private
QwMomentPlanDataService
qwMomentPlanDataService
;
private
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
...
...
@@ -176,12 +187,12 @@ public class QwMomentPlanServiceImpl implements QwMomentPlanService {
private
void
sendTaskToClerk
(
String
enterpriseId
,
String
clerkId
,
Long
planId
)
{
logger
.
info
(
"发送任务通知,clerkId={}"
,
clerkId
);
// 发送通知
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
int
messageType
=
0
;
// NoticeMessageTypeEnum.CLERK_TASK_SEND_NOTICE
.getType();
int
messageType
=
NoticeMessageTypeEnum
.
hbapp_canvas_friend_circle_task
.
getType
();
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"planId"
,
planId
)
;
// NoticeMessageUtil.sendNoticeMessage(enterpriseId,clerkId,messageType,null,map,jsonObject);
jsonObject
.
put
(
"clerkId"
,
clerkId
)
;
NoticeMessageUtil
.
sendNoticeMessage
(
enterpriseId
,
clerkId
,
messageType
,
null
,
map
,
jsonObject
);
}
...
...
@@ -193,7 +204,15 @@ public class QwMomentPlanServiceImpl implements QwMomentPlanService {
@Override
public
ServiceResponse
<
Void
>
stop
(
Long
planId
)
{
TabQwMomentPlan
plan
=
this
.
qwMomentPlanMapper
.
getById
(
planId
)
;
this
.
qwMomentPlanMapper
.
stop
(
planId
);
if
(
plan
.
getExecType
()==
0
&&
StringUtils
.
isNotBlank
(
plan
.
getMomentId
()))
{
String
wxEnterpriseId
=
plan
.
getWxEnterpriseId
()
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
logger
.
info
(
"取消发送={},{}"
,
planId
,
plan
.
getMomentId
());
this
.
qywxExternalUserService
.
cancelMomentTask
(
qwDTO
.
getThirdCorpid
(),
qwDTO
.
getSelf3thSecret
(),
plan
.
getMomentId
()
,
qwDTO
.
isSelf
(),
qwDTO
.
getUrlHost
())
;
}
return
ServiceResponse
.
success
();
}
...
...
@@ -337,6 +356,30 @@ public class QwMomentPlanServiceImpl implements QwMomentPlanService {
@Override
public
ServiceResponse
<
Integer
>
getTaskNum
(
TaskNumQDTO
qdto
)
{
return
null
;
int
count
=
this
.
qwMomentPlanMapper
.
getTaskNum
(
qdto
);
return
ServiceResponse
.
success
(
count
);
}
@Override
public
void
getQwData
(
TabQwMomentPlanAttend
task
)
{
MomentResultDTO
dto
=
this
.
getQwData
(
task
.
getStaffId
(),
task
.
getMomentId
(),
task
.
getWxEnterpriseId
())
;
this
.
qwMomentPlanDataService
.
save
(
task
,
dto
)
;
}
private
MomentResultDTO
getQwData
(
String
staffId
,
String
momentId
,
String
wxEnterpriseId
)
{
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
return
this
.
getData
(
staffId
,
momentId
,
qwDTO
);
}
private
MomentResultDTO
getData
(
String
staffId
,
String
momentId
,
WxEnterpriseQwDTO
qwDTO
)
{
TabHaobanStaff
staff
=
this
.
staffMapper
.
selectByPrimaryKey
(
staffId
)
;
String
wxUserId
=
staff
.
getWxUserId
()
;
if
(
qwDTO
.
needOpenUserId3th
())
{
wxUserId
=
staff
.
getWxOpenUseId
()
;
}
ServiceResponse
<
MomentResultDTO
>
resp
=
this
.
qywxExternalUserService
.
getMomentComments
(
qwDTO
.
getThirdCorpid
(),
qwDTO
.
getSelf3thSecret
(),
momentId
,
wxUserId
,
qwDTO
.
isSelf
(),
qwDTO
.
getUrlHost
())
;
MomentResultDTO
dto
=
resp
.
getResult
()
;
return
dto
;
}
}
haoban-manage3-service/src/main/resources/mapper/moment/qwMomentPlanAttendMapper.xml
View file @
0adafea3
...
...
@@ -152,7 +152,12 @@
</if>
</update>
<!-- ===================== 新增 ======================== -->
<update
id=
"finishTask"
>
update tab_haoban_qw_moment_plan_attend set task_status = 2 , send_time= #{sendTime} where attend_id = #{attendId}
</update>
<!-- ===================== 新增 ======================== -->
<insert
id=
"batchInsert"
>
INSERT INTO tab_haoban_qw_moment_plan_attend(
attend_id,
...
...
haoban-manage3-service/src/main/resources/mapper/moment/qwMomentPlanDataMapper.xml
View file @
0adafea3
...
...
@@ -60,8 +60,7 @@
</if>
</select>
<insert
id=
"insert"
>
<![CDATA[
<update
id=
"batchInsert"
>
INSERT INTO tab_haoban_qw_moment_plan_data(
data_id,
plan_id,
...
...
@@ -71,82 +70,26 @@
clerk_id,
store_id,
member_id,
create_time,
update_time,
delete_flag,
comment_time,
like_time,
comment_flag,
like_flag
)VALUES(
#{dataId,jdbcType=BIGINT},
#{planId,jdbcType=BIGINT},
#{wxEnterpriseId,jdbcType=CHAR},
#{enterpriseId,jdbcType=CHAR},
#{staffId,jdbcType=CHAR},
#{clerkId,jdbcType=CHAR},
#{storeId,jdbcType=CHAR},
#{memberId,jdbcType=CHAR},
#{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},
#{deleteFlag,jdbcType=INTEGER},
#{commentTime,jdbcType=TIMESTAMP},
#{likeTime,jdbcType=TIMESTAMP},
#{commentFlag,jdbcType=INTEGER},
#{likeFlag,jdbcType=INTEGER}
)
]]>
</insert>
)VALUES
<update
id=
"update"
parameterType=
"com.gic.haoban.manage.api.dto.moment.QwMomentPlanDataDTO"
>
<![CDATA[
UPDATE tab_haoban_qw_moment_plan_data SET
<if test="null != dataId">
data_id=#{dataId},
</if>
<if
test=
"null != planId"
>
plan_id=#{planId},
</if>
<if
test=
"null != wxEnterpriseId"
>
wx_enterprise_id=#{wxEnterpriseId},
</if>
<if
test=
"null != enterpriseId"
>
enterprise_id=#{enterpriseId},
</if>
<if
test=
"null != staffId"
>
staff_id=#{staffId},
</if>
<if
test=
"null != clerkId"
>
clerk_id=#{clerkId},
</if>
<if
test=
"null != storeId"
>
store_id=#{storeId},
</if>
<if
test=
"null != memberId"
>
member_id=#{memberId},
</if>
<if
test=
"null != createTime"
>
create_time=#{createTime},
</if>
<if
test=
"null != updateTime"
>
update_time=#{updateTime},
</if>
<if
test=
"null != deleteFlag"
>
delete_flag=#{deleteFlag},
</if>
<if
test=
"null != commentTime"
>
comment_time=#{commentTime},
</if>
<if
test=
"null != likeTime"
>
like_time=#{likeTime},
</if>
<if
test=
"null != commentFlag"
>
comment_flag=#{commentFlag},
</if>
<if
test=
"null != likeFlag"
>
like_flag=#{likeFlag}
</if>
]]>
</update>
<foreach
collection=
"list"
item=
"item"
separator=
","
open=
"("
close=
")"
index=
"index"
>
#{item.dataId,jdbcType=BIGINT},
#{item.planId,jdbcType=BIGINT},
#{item.wxEnterpriseId,jdbcType=CHAR},
#{item.enterpriseId,jdbcType=CHAR},
#{item.staffId,jdbcType=CHAR},
#{item.clerkId,jdbcType=CHAR},
#{item.storeId,jdbcType=CHAR},
#{item.memberId,jdbcType=CHAR},
#{commentTime,jdbcType=TIMESTAMP},
#{likeTime,jdbcType=TIMESTAMP},
#{commentFlag,jdbcType=INTEGER},
#{likeFlag,jdbcType=INTEGER}
</foreach>
</update>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/main/resources/mapper/moment/qwMomentPlanMapper.xml
View file @
0adafea3
...
...
@@ -220,6 +220,17 @@
</if>
</select>
<select
id=
"getTaskNum"
resultType=
"java.lang.Integer"
parameterType=
"com.gic.haoban.manage.api.qdto.moment.TaskNumQDTO"
>
select count(1)
from tab_haoban_qw_moment_plan a left join tab_haoban_qw_moment_plan_attend b on a.plan_id = b.plan_id
where a.wx_enterprise_id=#{wxEnterpriseId} and a.enterprise_id=#{enterpriseId} and b.store_id=#{storeId}
and b.status_flag = 1 and a.end_date > now()
<if
test=
"null != clerkId"
>
and b.clerk_id = #{clerkId}
</if>
group by a.plan_id
</select>
<select
id=
"list"
resultMap=
"result-map-tabHaobanQwMomentPlan"
parameterType=
"com.gic.haoban.manage.api.qdto.moment.QwMomentPlanQDTO"
>
...
...
@@ -256,7 +267,6 @@
and delete_flag = 0 order by ${sortColumn} ${sortType}
</select>
<update
id=
"del"
parameterType=
"java.lang.Long"
>
update tab_haoban_qw_moment_plan set delete_flag = 1 where plan_id = #{planId}
</update>
...
...
haoban-manage3-service/src/test/java/MomentTest.java
View file @
0adafea3
...
...
@@ -42,7 +42,7 @@ public class MomentTest {
dto
.
setExpireDays
(
10
);
dto
.
setPlanClerkType
(
1
);
// ,"b2ef17cce11f476b996d0b27ebadf7fb"
List
<
String
>
clerkIds
=
Arrays
.
asList
(
"
a02065ae51594fb9832e4199d4e3a1b0
"
,
"753a367d709d40a38b17ed25847d3b4b"
)
;
List
<
String
>
clerkIds
=
Arrays
.
asList
(
"
b2ef17cce11f476b996d0b27ebadf7fb
"
,
"753a367d709d40a38b17ed25847d3b4b"
)
;
dto
.
setSelectClerkIdList
(
clerkIds
);
this
.
qwMomentApiService
.
save
(
dto
)
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment