Commit 0adafea3 by 徐高华

朋友圈

parent 3eeec831
...@@ -7,6 +7,8 @@ public class TaskDetailDTO implements Serializable { ...@@ -7,6 +7,8 @@ public class TaskDetailDTO implements Serializable {
private Long planId ; private Long planId ;
private Long attendId ;
private String clerkId ; private String clerkId ;
/** /**
...@@ -60,6 +62,14 @@ public class TaskDetailDTO implements Serializable { ...@@ -60,6 +62,14 @@ public class TaskDetailDTO implements Serializable {
// 0已失效1待执行 2已执行 // 0已失效1待执行 2已执行
private Integer taskStatus ; private Integer taskStatus ;
public Long getAttendId() {
return attendId;
}
public void setAttendId(Long attendId) {
this.attendId = attendId;
}
public Integer getTaskStatus() { public Integer getTaskStatus() {
return taskStatus; return taskStatus;
} }
......
...@@ -40,7 +40,8 @@ public enum NoticeMessageTypeEnum { ...@@ -40,7 +40,8 @@ public enum NoticeMessageTypeEnum {
TEL_TASK_CANVAS(2017, "话务任务通知", NoticeMessageCategoryTypeEnum.TASK.getType(), "haobanTelTaskCanvas", "/pages/route/index?pageType=", "hbapp_canvas_task", "haobanTelTaskCanvas", "haobanNotice"), 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"), 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"), STORE_ACCOUNT(3001, "账号申请", NoticeMessageCategoryTypeEnum.OTHER.getType(), "store_account", "/pages/route/index?pageType=", "store_relate_store_record_list", "accountApplication", "haobanNotice"),
// //
......
...@@ -8,6 +8,7 @@ import com.gic.haoban.manage.api.qdto.moment.TaskListWxaQDTO; ...@@ -8,6 +8,7 @@ import com.gic.haoban.manage.api.qdto.moment.TaskListWxaQDTO;
import com.gic.haoban.manage.service.entity.moment.TabQwMomentPlanAttend; import com.gic.haoban.manage.service.entity.moment.TabQwMomentPlanAttend;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
public interface QwMomentPlanAttendMapper { public interface QwMomentPlanAttendMapper {
...@@ -37,4 +38,6 @@ public interface QwMomentPlanAttendMapper { ...@@ -37,4 +38,6 @@ public interface QwMomentPlanAttendMapper {
TaskDetailDTO taskDetail(@Param("planId") Long planId, @Param("clerkId") String execClerkId); TaskDetailDTO taskDetail(@Param("planId") Long planId, @Param("clerkId") String execClerkId);
List<TaskListWxaDTO> taskListWxa(TaskListWxaQDTO qdto); List<TaskListWxaDTO> taskListWxa(TaskListWxaQDTO qdto);
void finishTask(@Param("planId")Long attendId, @Param("sendTime")Date sendTime);
} }
...@@ -8,9 +8,7 @@ import java.util.List; ...@@ -8,9 +8,7 @@ import java.util.List;
public interface QwMomentPlanDataMapper { public interface QwMomentPlanDataMapper {
void insert(QwMomentPlanDataDTO dto) ; void batchInsert(List<TabQwMomentPlanData> list) ;
void update(QwMomentPlanDataDTO dto) ;
List<QwMomentPlanDataDTO> list(PlanDataListQDTO qdto); List<QwMomentPlanDataDTO> list(PlanDataListQDTO qdto);
} }
...@@ -4,6 +4,7 @@ import com.gic.haoban.manage.api.dto.moment.QwMomentPlanDTO; ...@@ -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.dto.moment.QwMomentPlanWxaDTO;
import com.gic.haoban.manage.api.qdto.moment.PlanListWxaQDTO; 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.QwMomentPlanQDTO;
import com.gic.haoban.manage.api.qdto.moment.TaskNumQDTO;
import com.gic.haoban.manage.service.entity.moment.TabQwMomentPlan; import com.gic.haoban.manage.service.entity.moment.TabQwMomentPlan;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -26,4 +27,6 @@ public interface QwMomentPlanMapper { ...@@ -26,4 +27,6 @@ public interface QwMomentPlanMapper {
List<TabQwMomentPlan> list(QwMomentPlanQDTO qdto); List<TabQwMomentPlan> list(QwMomentPlanQDTO qdto);
List<QwMomentPlanWxaDTO> planListWxa(PlanListWxaQDTO qdto); List<QwMomentPlanWxaDTO> planListWxa(PlanListWxaQDTO qdto);
int getTaskNum(TaskNumQDTO qdto);
} }
...@@ -70,9 +70,19 @@ public class TabQwMomentPlan implements Serializable{ ...@@ -70,9 +70,19 @@ public class TabQwMomentPlan implements Serializable{
private Integer totalCommentCount; private Integer totalCommentCount;
/**企微jobid*/ /**企微jobid*/
private String qwJobid; private String qwJobid;
/**朋友圈id */
private String momentId ;
/**完成率*/ /**完成率*/
private Integer execRate; private Integer execRate;
public String getMomentId() {
return momentId;
}
public void setMomentId(String momentId) {
this.momentId = momentId;
}
public Long getPlanId() { public Long getPlanId() {
return planId; return planId;
} }
......
...@@ -28,6 +28,8 @@ public class TabQwMomentPlanData implements Serializable{ ...@@ -28,6 +28,8 @@ public class TabQwMomentPlanData implements Serializable{
private String staffId; private String staffId;
/**导购*/ /**导购*/
private String clerkId; private String clerkId;
private String clerkCode ;
private String clerkName ;
/**门店id*/ /**门店id*/
private String storeId; private String storeId;
/**客户id*/ /**客户id*/
...@@ -47,6 +49,22 @@ public class TabQwMomentPlanData implements Serializable{ ...@@ -47,6 +49,22 @@ public class TabQwMomentPlanData implements Serializable{
/**是否点赞*/ /**是否点赞*/
private Integer likeFlag; 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() { public Long getDataId() {
return dataId; return dataId;
} }
......
...@@ -4,9 +4,14 @@ import com.gic.api.base.commons.Page; ...@@ -4,9 +4,14 @@ import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.moment.QwMomentPlanDataDTO; import com.gic.haoban.manage.api.dto.moment.QwMomentPlanDataDTO;
import com.gic.haoban.manage.api.qdto.moment.PlanDataListQDTO; 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 { public interface QwMomentPlanDataService {
ServiceResponse<Page<QwMomentPlanDataDTO>> dataList(PlanDataListQDTO qdto) ; ServiceResponse<Page<QwMomentPlanDataDTO>> dataList(PlanDataListQDTO qdto) ;
ServiceResponse<Void> save(TabQwMomentPlanAttend task , MomentResultDTO dto) ;
} }
...@@ -7,6 +7,7 @@ import com.gic.haoban.manage.api.dto.moment.QwMomentPlanWxaDTO; ...@@ -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.PlanListWxaQDTO;
import com.gic.haoban.manage.api.qdto.moment.QwMomentPlanQDTO; import com.gic.haoban.manage.api.qdto.moment.QwMomentPlanQDTO;
import com.gic.haoban.manage.api.qdto.moment.TaskNumQDTO; import com.gic.haoban.manage.api.qdto.moment.TaskNumQDTO;
import com.gic.haoban.manage.service.entity.moment.TabQwMomentPlanAttend;
public interface QwMomentPlanService { public interface QwMomentPlanService {
...@@ -26,4 +27,10 @@ public interface QwMomentPlanService { ...@@ -26,4 +27,10 @@ public interface QwMomentPlanService {
ServiceResponse<Integer> getTaskNum(TaskNumQDTO qdto); ServiceResponse<Integer> getTaskNum(TaskNumQDTO qdto);
ServiceResponse<Page<QwMomentPlanWxaDTO>> planListWxa(PlanListWxaQDTO qdto); ServiceResponse<Page<QwMomentPlanWxaDTO>> planListWxa(PlanListWxaQDTO qdto);
/**
* 拉取企微点赞、评论
* @param task
*/
public void getQwData(TabQwMomentPlanAttend task) ;
} }
package com.gic.haoban.manage.service.service.moment.impl; 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.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.PageHelperUtils; import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.util.UniqueIdUtils; 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.QwMomentPlanAttendDTO;
import com.gic.haoban.manage.api.dto.moment.TaskDetailDTO; import com.gic.haoban.manage.api.dto.moment.TaskDetailDTO;
import com.gic.haoban.manage.api.dto.moment.TaskListWxaDTO; 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.PlanClerkListQDTO;
import com.gic.haoban.manage.api.qdto.moment.SendResultQDTO; import com.gic.haoban.manage.api.qdto.moment.SendResultQDTO;
import com.gic.haoban.manage.api.qdto.moment.TaskListWxaQDTO; 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.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.entity.moment.TabQwMomentPlanAttend;
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.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 com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -23,6 +33,7 @@ import org.apache.logging.log4j.Logger; ...@@ -23,6 +33,7 @@ import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -35,6 +46,14 @@ public class QwMomentPlanAttendServiceImpl implements QwMomentPlanAttendService ...@@ -35,6 +46,14 @@ public class QwMomentPlanAttendServiceImpl implements QwMomentPlanAttendService
private QwMomentPlanAttendMapper qwMomentPlanAttendMapper ; private QwMomentPlanAttendMapper qwMomentPlanAttendMapper ;
@Autowired @Autowired
private ClerkService clerkService ; private ClerkService clerkService ;
@Autowired
private QywxSuiteApiService qywxSuiteApiService ;
@Autowired
private WxEnterpriseService wxEnterpriseService ;
@Autowired
private StaffMapper staffMapper ;
@Autowired
private QwMomentPlanMapper qwMomentPlanMapper ;
@Override @Override
public ServiceResponse<Page<QwMomentPlanAttendDTO>> attendList(PlanClerkListQDTO qdto) { public ServiceResponse<Page<QwMomentPlanAttendDTO>> attendList(PlanClerkListQDTO qdto) {
...@@ -101,6 +120,45 @@ public class QwMomentPlanAttendServiceImpl implements QwMomentPlanAttendService ...@@ -101,6 +120,45 @@ public class QwMomentPlanAttendServiceImpl implements QwMomentPlanAttendService
@Override @Override
public ServiceResponse<Void> finishTask(SendResultQDTO qdto) { 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 ;
} }
} }
...@@ -3,21 +3,31 @@ package com.gic.haoban.manage.service.service.moment.impl; ...@@ -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.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.PageHelperUtils; 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.dto.moment.QwMomentPlanDataDTO;
import com.gic.haoban.manage.api.qdto.moment.PlanDataListQDTO; 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.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.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 com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.*;
@Service("qwMomentPlanDataService") @Service("qwMomentPlanDataService")
public class QwMomentPlanDataServiceImpl implements QwMomentPlanDataService { public class QwMomentPlanDataServiceImpl implements QwMomentPlanDataService {
@Autowired @Autowired
private QwMomentPlanDataMapper qwMomentPlanDataMapper ; private QwMomentPlanDataMapper qwMomentPlanDataMapper ;
@Autowired
private ExternalClerkRelatedService externalClerkRelatedService ;
@Override @Override
public ServiceResponse<Page<QwMomentPlanDataDTO>> dataList(PlanDataListQDTO qdto) { public ServiceResponse<Page<QwMomentPlanDataDTO>> dataList(PlanDataListQDTO qdto) {
...@@ -39,5 +49,72 @@ public class QwMomentPlanDataServiceImpl implements QwMomentPlanDataService { ...@@ -39,5 +49,72 @@ public class QwMomentPlanDataServiceImpl implements QwMomentPlanDataService {
return ServiceResponse.success(retPage); 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();
}
} }
...@@ -18,20 +18,27 @@ import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO; ...@@ -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.QwMomentPlanAttendDTO;
import com.gic.haoban.manage.api.dto.moment.QwMomentPlanDTO; import com.gic.haoban.manage.api.dto.moment.QwMomentPlanDTO;
import com.gic.haoban.manage.api.dto.moment.QwMomentPlanWxaDTO; 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.PlanListWxaQDTO;
import com.gic.haoban.manage.api.qdto.moment.QwMomentPlanQDTO; import com.gic.haoban.manage.api.qdto.moment.QwMomentPlanQDTO;
import com.gic.haoban.manage.api.qdto.moment.TaskNumQDTO; import com.gic.haoban.manage.api.qdto.moment.TaskNumQDTO;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService; 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.QwMomentPlanAttendMapper;
import com.gic.haoban.manage.service.dao.mapper.moment.QwMomentPlanMapper; 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.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.QywxSendService;
import com.gic.haoban.manage.service.service.WxEnterpriseService; 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.QwMomentPlanAttendService;
import com.gic.haoban.manage.service.service.moment.QwMomentPlanDataService;
import com.gic.haoban.manage.service.service.moment.QwMomentPlanService; import com.gic.haoban.manage.service.service.moment.QwMomentPlanService;
import com.gic.mq.sdk.GicMQClient; import com.gic.mq.sdk.GicMQClient;
import com.gic.quartz.api.dto.QuartzTaskDTO; import com.gic.quartz.api.dto.QuartzTaskDTO;
import com.gic.quartz.api.service.QuartzService; 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.gic.wechat.api.service.qywx.QywxExternalUserService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -74,6 +81,10 @@ public class QwMomentPlanServiceImpl implements QwMomentPlanService { ...@@ -74,6 +81,10 @@ public class QwMomentPlanServiceImpl implements QwMomentPlanService {
private QywxExternalUserService qywxExternalUserService; private QywxExternalUserService qywxExternalUserService;
@Autowired @Autowired
private WxEnterpriseService wxEnterpriseService ; private WxEnterpriseService wxEnterpriseService ;
@Autowired
private StaffMapper staffMapper ;
@Autowired
private QwMomentPlanDataService qwMomentPlanDataService ;
private GicMQClient clientInstance = GICMQClientUtil.getClientInstance(); private GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
...@@ -176,12 +187,12 @@ public class QwMomentPlanServiceImpl implements QwMomentPlanService { ...@@ -176,12 +187,12 @@ public class QwMomentPlanServiceImpl implements QwMomentPlanService {
private void sendTaskToClerk(String enterpriseId,String clerkId , Long planId) { private void sendTaskToClerk(String enterpriseId,String clerkId , Long planId) {
logger.info("发送任务通知,clerkId={}",clerkId); logger.info("发送任务通知,clerkId={}",clerkId);
// 发送通知
Map<String, String> map = new HashMap<String, String>(); 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 jsonObject = new JSONObject();
jsonObject.put("planId",planId) ; 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 { ...@@ -193,7 +204,15 @@ public class QwMomentPlanServiceImpl implements QwMomentPlanService {
@Override @Override
public ServiceResponse<Void> stop(Long planId) { public ServiceResponse<Void> stop(Long planId) {
TabQwMomentPlan plan = this.qwMomentPlanMapper.getById(planId) ;
this.qwMomentPlanMapper.stop(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(); return ServiceResponse.success();
} }
...@@ -337,6 +356,30 @@ public class QwMomentPlanServiceImpl implements QwMomentPlanService { ...@@ -337,6 +356,30 @@ public class QwMomentPlanServiceImpl implements QwMomentPlanService {
@Override @Override
public ServiceResponse<Integer> getTaskNum(TaskNumQDTO qdto) { 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 ;
} }
} }
...@@ -152,6 +152,11 @@ ...@@ -152,6 +152,11 @@
</if> </if>
</update> </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 id="batchInsert">
INSERT INTO tab_haoban_qw_moment_plan_attend( INSERT INTO tab_haoban_qw_moment_plan_attend(
......
...@@ -60,8 +60,7 @@ ...@@ -60,8 +60,7 @@
</if> </if>
</select> </select>
<insert id="insert"> <update id="batchInsert">
<![CDATA[
INSERT INTO tab_haoban_qw_moment_plan_data( INSERT INTO tab_haoban_qw_moment_plan_data(
data_id, data_id,
plan_id, plan_id,
...@@ -71,82 +70,26 @@ ...@@ -71,82 +70,26 @@
clerk_id, clerk_id,
store_id, store_id,
member_id, member_id,
create_time,
update_time,
delete_flag,
comment_time, comment_time,
like_time, like_time,
comment_flag, comment_flag,
like_flag like_flag
)VALUES( )VALUES
#{dataId,jdbcType=BIGINT},
#{planId,jdbcType=BIGINT}, <foreach collection="list" item="item" separator="," open="(" close=")" index="index">
#{wxEnterpriseId,jdbcType=CHAR}, #{item.dataId,jdbcType=BIGINT},
#{enterpriseId,jdbcType=CHAR}, #{item.planId,jdbcType=BIGINT},
#{staffId,jdbcType=CHAR}, #{item.wxEnterpriseId,jdbcType=CHAR},
#{clerkId,jdbcType=CHAR}, #{item.enterpriseId,jdbcType=CHAR},
#{storeId,jdbcType=CHAR}, #{item.staffId,jdbcType=CHAR},
#{memberId,jdbcType=CHAR}, #{item.clerkId,jdbcType=CHAR},
#{createTime,jdbcType=TIMESTAMP}, #{item.storeId,jdbcType=CHAR},
#{updateTime,jdbcType=TIMESTAMP}, #{item.memberId,jdbcType=CHAR},
#{deleteFlag,jdbcType=INTEGER},
#{commentTime,jdbcType=TIMESTAMP}, #{commentTime,jdbcType=TIMESTAMP},
#{likeTime,jdbcType=TIMESTAMP}, #{likeTime,jdbcType=TIMESTAMP},
#{commentFlag,jdbcType=INTEGER}, #{commentFlag,jdbcType=INTEGER},
#{likeFlag,jdbcType=INTEGER} #{likeFlag,jdbcType=INTEGER}
) </foreach>
]]>
</insert>
<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> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -220,6 +220,17 @@ ...@@ -220,6 +220,17 @@
</if> </if>
</select> </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" <select id="list" resultMap="result-map-tabHaobanQwMomentPlan"
parameterType="com.gic.haoban.manage.api.qdto.moment.QwMomentPlanQDTO"> parameterType="com.gic.haoban.manage.api.qdto.moment.QwMomentPlanQDTO">
...@@ -256,7 +267,6 @@ ...@@ -256,7 +267,6 @@
and delete_flag = 0 order by ${sortColumn} ${sortType} and delete_flag = 0 order by ${sortColumn} ${sortType}
</select> </select>
<update id="del" parameterType="java.lang.Long"> <update id="del" parameterType="java.lang.Long">
update tab_haoban_qw_moment_plan set delete_flag = 1 where plan_id = #{planId} update tab_haoban_qw_moment_plan set delete_flag = 1 where plan_id = #{planId}
</update> </update>
......
...@@ -42,7 +42,7 @@ public class MomentTest { ...@@ -42,7 +42,7 @@ public class MomentTest {
dto.setExpireDays(10); dto.setExpireDays(10);
dto.setPlanClerkType(1); dto.setPlanClerkType(1);
// ,"b2ef17cce11f476b996d0b27ebadf7fb" // ,"b2ef17cce11f476b996d0b27ebadf7fb"
List<String> clerkIds = Arrays.asList("a02065ae51594fb9832e4199d4e3a1b0","753a367d709d40a38b17ed25847d3b4b") ; List<String> clerkIds = Arrays.asList("b2ef17cce11f476b996d0b27ebadf7fb","753a367d709d40a38b17ed25847d3b4b") ;
dto.setSelectClerkIdList(clerkIds); dto.setSelectClerkIdList(clerkIds);
this.qwMomentApiService.save(dto) ; this.qwMomentApiService.save(dto) ;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment