Commit b44d2743 by 徐高华

群列表查询

parent a49e8672
......@@ -56,11 +56,20 @@ public class GroupChatDTO implements Serializable {
private String staffName;
private String staffImage;
private String originalStaffId;
private String originalStaffName ;
private Date offTime;
// 1已关联导购 0未关联导购
private int clerkRelationFlag = 0;
private int openConcatFlag = 0;
public String getOriginalStaffName() {
return originalStaffName;
}
public void setOriginalStaffName(String originalStaffName) {
this.originalStaffName = originalStaffName;
}
public int getOpenConcatFlag() {
return openConcatFlag;
}
......
......@@ -6,6 +6,7 @@ import java.util.Set;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.api.dto.chat.GroupChatDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatSearchQDTO;
import com.gic.haoban.manage.service.entity.chat.TabGroupChat;
......@@ -56,7 +57,7 @@ public interface GroupChatMapper {
public List<TabGroupChat> listAllNeedInitWxChatIdDk();
public List<TabGroupChat> list(GroupChatSearchQDTO qdto);
public List<GroupChatDTO> list(GroupChatSearchQDTO qdto);
public void updateChatEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("enterpriseId") String enterpriseId, @Param("groupChatIdList") List<Long> groupChatIdList);
......
......@@ -4,6 +4,7 @@ import java.util.List;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.api.dto.chat.GroupChatDTO;
import com.gic.haoban.manage.api.dto.chat.GroupChatOwnerDTO;
import com.gic.haoban.manage.api.dto.chat.GroupChatOwnerHistoryDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatSearchQDTO;
......@@ -64,7 +65,7 @@ public interface GroupChatService {
* @return
* @throws
*/
public Page<GroupChatBO> listPage(GroupChatSearchQDTO qdto, BasePageInfo basePageInfo);
public Page<GroupChatDTO> listPage(GroupChatSearchQDTO qdto, BasePageInfo basePageInfo);
public void updateChatEnterpriseId(String wxEnterpriseId, String enterpriseId, List<Long> groupChatIdList);
......
......@@ -9,7 +9,6 @@ import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.MDC;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -55,7 +54,6 @@ import com.gic.haoban.manage.service.service.chat.GroupChatPlanOwnerLogService;
import com.gic.haoban.manage.service.service.chat.GroupChatPlanService;
import com.gic.haoban.manage.service.service.chat.GroupChatService;
import com.gic.haoban.manage.service.service.notify.PendingTaskService;
import com.gic.haoban.task.api.enums.TaskTypeEnum;
import com.gic.mq.sdk.GicMQClient;
import com.gic.quartz.api.dto.QuartzTaskDTO;
import com.gic.quartz.api.service.QuartzService;
......@@ -223,6 +221,7 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
@Override
public void doPlanSendInfoTimer(String params) {
List<TabGroupChatPlanOwnerLog> logList = this.groupChatPlanOwnerLogService.listForTimer();
logger.info("定时处理群发结果,条数={}", logList.size());
for (TabGroupChatPlanOwnerLog log : logList) {
Long ownerLogId = log.getOwnerLogId();
try {
......@@ -235,20 +234,18 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
@Override
public void doPlanSendInfo(Long ownerLogId) {
logger.info("开始处理群发结果,ownerlogId={}", ownerLogId);
TabGroupChatPlanOwnerLog ownerLog = this.groupChatPlanOwnerLogService.getById(ownerLogId);
String wxEnterpriseId = ownerLog.getWxEnterpriseId();
String enterpriseId = ownerLog.getEnterpriseId();
String msgid = ownerLog.getMsgid();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO != null) {
}
String staffId = ownerLog.getStaffId();
TabHaobanStaff staff = this.staffMapper.selectByPrimaryKey(staffId);
String userid = staff.getWxUserId();
if (qwDTO.needOpenUserId3th()) {
userid = staff.getWxOpenUseId();
}
JSONResponse respon = qywxSuiteApiService.resultExternalMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(),
msgid, null, userid);
logger.info("统计返回={}", JSON.toJSONString(respon));
......@@ -258,14 +255,16 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
int sendCount = 0;
int failCount = 0;
for (QywxSendMessageResultDTO item : list) {
TabGroupChatPlanLog entity = new TabGroupChatPlanLog();
if (item.getStatus() == 2) {
sendCount++;
entity.setSendStatus(2);
} else {
failCount++;
entity.setSendStatus(0);
}
String wxChatId = item.getChatId();
Date sendTime = item.getSendTime();
TabGroupChatPlanLog entity = new TabGroupChatPlanLog();
entity.setLogId(UniqueIdUtils.uniqueLong());
entity.setPlanId(ownerLog.getPlanId());
entity.setOwnLogId(ownerLog.getOwnerLogId());
......@@ -277,21 +276,21 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
entity.setGroupChatId(chat.getGroupChatId());
}
entity.setSendTime(sendTime);
entity.setSendStatus(1);
this.groupChatPlanLogMapper.insert(entity);
}
// 更新统计数量、状态
this.groupChatPlanOwnerLogService.updateSendCount(ownerLog.getOwnerLogId(), sendCount,
list.get(0).getSendTime(), failCount);
// 完成代办
this.pendingTaskService.updateFinish(ownerLog.getOwnerLogId()+"") ;
this.pendingTaskService.updateFinish(ownerLog.getOwnerLogId() + "");
}
}
}
@Override
public void del(String clerkId, String clerkName, Long planId) {
this.groupChatPlanMapper.deleteById(planId, clerkId, clerkName);
this.addOrDelTimer(planId, new Date(), 0);
this.groupChatPlanMapper.deleteById(planId, clerkId, clerkName);
}
@Override
......@@ -345,6 +344,7 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
}
public void addOrDelTimer(Long planId, Date sendTime, int status) {
logger.info("添加1/删除0定时,{},{}", status, planId);
QuartzTaskDTO quartzTask = new QuartzTaskDTO();
quartzTask.setTaskStatus(status);
String taskTimeInfo = this.getTaskTime(sendTime);
......
......@@ -28,6 +28,7 @@ import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.dto.chat.GroupChatDTO;
import com.gic.haoban.manage.api.dto.chat.GroupChatOwnerDTO;
import com.gic.haoban.manage.api.dto.chat.GroupChatOwnerHistoryDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatSearchQDTO;
......@@ -209,19 +210,19 @@ public class GroupChatServiceImpl implements GroupChatService {
}
@Override
public Page<GroupChatBO> listPage(GroupChatSearchQDTO qdto, BasePageInfo basePageInfo) {
public Page<GroupChatDTO> listPage(GroupChatSearchQDTO qdto, BasePageInfo basePageInfo) {
if (null != qdto.getChatHmId()) {
List<TabGroupChatHmRelation> list = this.groupChatHmRelationMapper.listByChatHmId(qdto.getChatHmId());
if (CollectionUtils.isEmpty(list)) {
return new Page<GroupChatBO>();
return new Page<GroupChatDTO>();
}
logger.info("活码页查询群列表{},关联群数={}", qdto.getChatHmId(), list.size());
List<Long> groupChatIdList = list.stream().map(dto -> dto.getGroupChatId()).collect(Collectors.toList());
qdto.setGroupChatIdList(groupChatIdList);
}
PageHelper.startPage(basePageInfo);
List<TabGroupChat> list = this.groupChatMapper.list(qdto);
Page<GroupChatBO> retPage = PageHelperUtils.changePageHelperToCurrentPage(list, GroupChatBO.class);
List<GroupChatDTO> list = this.groupChatMapper.list(qdto);
Page<GroupChatDTO> retPage = PageHelperUtils.changePageHelperToCurrentPage(list, GroupChatDTO.class);
return retPage;
}
......
......@@ -71,12 +71,13 @@ public class GroupChatApiServiceImpl implements GroupChatApiService {
sortColumn = "quit_member_count";
}
qdto.setSortColumn(sortColumn);
Page<GroupChatBO> page = this.groupChatService.listPage(qdto, basePageInfo);
Page<GroupChatDTO> page = this.groupChatService.listPage(qdto, basePageInfo);
Page<GroupChatDTO> resultPage = PageHelperUtils.changePageToCurrentPage(page, GroupChatDTO.class);
List<GroupChatDTO> dtoList = resultPage.getResult();
// 处理关联状态
if (CollectionUtils.isNotEmpty(dtoList)) {
boolean needClerkReltaion = (qdto.getStatus() == 1);
if (CollectionUtils.isNotEmpty(dtoList) && needClerkReltaion) {
if (needClerkReltaion) {
List<String> staffIdList = dtoList.stream().filter(dto -> StringUtils.isNotBlank(dto.getStaffId()))
.map(dto -> dto.getStaffId()).collect(Collectors.toList());
List<String> relationIdList = this.staffClerkRelationService
......@@ -85,6 +86,18 @@ public class GroupChatApiServiceImpl implements GroupChatApiService {
one.setClerkRelationFlag(relationIdList.contains(one.getStaffId()) ? 1 : 0);
});
}
// 原群主
if (qdto.getStatus() == 2) {
dtoList.forEach(one -> {
String staffId = one.getOriginalStaffId();
TabHaobanStaff staff = this.staffService.selectById(staffId);
if (null != staff) {
one.setOriginalStaffName(staff.getStaffName());
}
});
}
}
return ServiceResponse.success(resultPage);
}
......
......@@ -207,62 +207,84 @@
group by wx_enterprise_id , staff_id
</select>
<select id="list" resultMap="result-map-tabHaobanGroupChat" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.GroupChatSearchQDTO">
select <include refid="Base_Column_List" /> from tab_haoban_group_chat where wx_enterprise_id=#{wxEnterpriseId}
<select id="list" resultType="com.gic.haoban.manage.api.dto.chat.GroupChatDTO" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.GroupChatSearchQDTO">
select
b.staff_name staffName ,
b.head_img staffImage ,
b.open_concat_flag openConcatFlag ,
a.group_chat_id groupChatId ,
a.name name ,
a.staff_id staffId ,
a.wx_chat_id wxChatId ,
a.chat_add_time chatAddTime ,
a.chat_dissolve_time chatDissolveTime ,
a.chat_notice chatNotice ,
a.chat_status chatStatus ,
a.create_time createTime ,
a.total_count totalCount ,
a.total_member_count totalMemberCount ,
a.add_member_count addMemberCount ,
a.add_count addCount ,
a.quit_count quitCount ,
a.quit_member_count quitMemberCount ,
a.enterprise_id enterpriseId ,
a.gic_flag gicFlag , a.init_flag initFlag , a.wx_chat_id_dk wxChatIdDk , a.off_time offTime , a.original_staff_id originalStaffId , a.hm_add_status hmAddStatus ,
from tab_haoban_group_chat a left join tab_haoban_staff b on a.staff_id = b.staff_id
where a.wx_enterprise_id=#{wxEnterpriseId}
<if test="chatPageFlag==true">
and (enterprise_id = #{enterpriseId} or enterprise_id is null)
and (a.enterprise_id = #{enterpriseId} or a.enterprise_id is null)
</if>
<if test="chatPageFlag==false">
and enterprise_id = #{enterpriseId}
and a.enterprise_id = #{enterpriseId}
</if>
<if test="null != staffId">
and staff_id = #{staffId}
and a.staff_id = #{staffId}
</if>
<if test="null == status or 0==status">
and chat_status in (0,3)
and a.chat_status in (0,3)
</if>
<if test="null != status and 1==status">
and chat_status = 1
and a.chat_status = 1
</if>
<if test="null != status and 2==status">
and chat_status = 2
and a.chat_status = 2
</if>
<if test="null != status and 4==status">
and chat_status = 4
and a.chat_status = 4
</if>
<if test="null != searchParams">
and name like '%${searchParams}%'
and (a.name like '%${searchParams}%' or a.wx_chat_id like '${searchParams}%')
</if>
<if test="null != staffIdList and staffIdList.size>0">
and staff_id in
<foreach collection="staffIdList" close=")" index="index" item="staffId" open="(" separator=",">
#{staffId}
and a.staff_id in
<foreach collection="staffIdList" close=")" index="index" item="id" open="(" separator=",">
#{id}
</foreach>
</if>
<if test="null != startDate">
and chat_add_time <![CDATA[ >=]]> #{startDate} and chat_add_time <![CDATA[ <= ]]> #{endDate}
and a.chat_add_time <![CDATA[ >=]]> #{startDate} and a.chat_add_time <![CDATA[ <= ]]> #{endDate}
</if>
<if test="null != dismissStartDate">
and chat_dissolve_time <![CDATA[ >=]]> #{startDate} and chat_dissolve_time <![CDATA[ <= ]]> #{endDate}
and a.chat_dissolve_time <![CDATA[ >=]]> #{startDate} and a.chat_dissolve_time <![CDATA[ <= ]]> #{endDate}
</if>
<if test="null != gicFlag and gicFlag ==0 ">
and gic_flag = 0
and a.gic_flag = 0
</if>
<if test="null == gicFlag or gicFlag ==1 ">
and gic_flag = 1
and a.gic_flag = 1
</if>
<if test="null != groupChatIdList and groupChatIdList.size>0">
and group_chat_id in
and a.group_chat_id in
<foreach collection="groupChatIdList" close=")" open="(" index="index" item="groupChatId" separator=",">
#{groupChatId}
</foreach>
</if>
and delete_flag = 0
and a.delete_flag = 0
<if test="null == sortColumn">
order by chat_add_time desc
order by a.chat_add_time desc
</if>
<if test="null != sortColumn">
order by ${sortColumn} ${sortType}
order by a.${sortColumn} ${sortType}
</if>
</select>
......
......@@ -72,7 +72,7 @@
<!-- ==================更新 ========== -->
<update id="updateSendCount">
<![CDATA[
UPDATE tab_haoban_group_chat_plan_owner_log SET send_count = #{sendCount} , fail_count =#{failCount} ,
UPDATE tab_haoban_group_chat_plan_owner_log SET send_count = #{sendCount} , fail_count =#{failCount} , done_flag = 1
send_status = 2 , send_time = #{sendTime} ,
update_time = now() where owner_log_id = #{id}
]]>
......@@ -85,7 +85,7 @@
<select id="listForTimer" resultMap="result-map-tabHaobanGroupChatPlanOwnerLog">
SELECT <include refid="Base_Column_List"/> FROM tab_haoban_group_chat_plan_owner_log WHERE create_time >= DATE_ADD(NOW(),INTERVAL -60 day) and send_time is null and delete_flag = 0
SELECT <include refid="Base_Column_List"/> FROM tab_haoban_group_chat_plan_owner_log WHERE create_time >= DATE_ADD(NOW(),INTERVAL -60 day) and done_flag = 0 and delete_flag = 0
</select>
<select id="listPage" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.GroupChatPlanSearchQDTO" resultType="com.gic.haoban.manage.api.dto.chat.GroupChatPlanOwnerLogDTO">
......
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