Commit 962e1503 by 徐高华

Merge branch 'feature-canvas' into 'developer'

Feature canvas

See merge request !2335
parents ac7ff1e7 0c40b97c
......@@ -40,6 +40,15 @@ public class GroupChatPlanOwnerLogDTO implements Serializable{
private Date expireDate ;
private Date sendTime ;
private int execType ;
private Date dataGetTime ;
public Date getDataGetTime() {
return dataGetTime;
}
public void setDataGetTime(Date dataGetTime) {
this.dataGetTime = dataGetTime;
}
public int getExecType() {
return execType;
......
......@@ -15,7 +15,7 @@ public class GroupChatPlanSearchQDTO implements Serializable {
private String searchParams;
// 1进行中、2未开始、3已结束
private Integer status;
// 群主 0发送失败 1待发送 2已发送
// 群主 0发送失败 1待发送 2已发送 3放弃 30(失败+放弃)
private Integer sendStatus ;
// 群名称
private String chatName ;
......
......@@ -37,7 +37,18 @@ public class GroupChatSearchQDTO extends PageQo implements Serializable {
private Integer canUseFlag ;
private String wxChatId ;
private String searchPage ;
// 查询放弃群的过滤时间
private Date giveUpStartTime ;
public Date getGiveUpStartTime() {
return giveUpStartTime;
}
public void setGiveUpStartTime(Date giveUpStartTime) {
this.giveUpStartTime = giveUpStartTime;
}
public String getSearchPage() {
return searchPage;
}
......
......@@ -6,7 +6,10 @@ public enum PlanSendStatusEnum {
TO_BE_SEND(1, "待发送"),
SENDED(2, "禁用");
SENDED(2, "已发送"),
GIVE_UP(3, "放弃");
private int code;
private String name;
......
......@@ -35,6 +35,15 @@ public class TabGroupChatPlanOwnerLog implements Serializable {
private Integer deleteFlag;
private Date sendTime;
private int execType ;
private Date dataGetTime ;
public Date getDataGetTime() {
return dataGetTime;
}
public void setDataGetTime(Date dataGetTime) {
this.dataGetTime = dataGetTime;
}
public int getExecType() {
return execType;
......
......@@ -12,10 +12,11 @@ import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.manage.api.dto.ContentMaterialDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.chat.*;
import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatSearchQDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.OwnerSearchQDTO;
import com.gic.haoban.manage.api.qdto.StaffSendResultQDTO;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatOwnerMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.*;
import com.gic.haoban.manage.service.service.content.impl.GroupMessageServiceImpl;
import com.gic.haoban.manage.service.util.StreamUtils;
import com.gic.thirdparty.cloudfile.CloudFileUtil;
......@@ -55,9 +56,6 @@ import com.gic.haoban.manage.api.enums.PendingTaskTypeEnum;
import com.gic.haoban.manage.api.enums.chat.PlanSendStatusEnum;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatPlanLogMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatPlanMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatPlanOwnerLogMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatPlan;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatPlanLog;
......@@ -119,6 +117,8 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
private GroupChatOwnerMapper groupChatOwnerMapper ;
@Autowired
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper ;
@Autowired
private GroupChatMapper groupChatMapper ;
private static GicMQClient mqClient = GICMQClientUtil.getClientInstance();
......@@ -532,9 +532,11 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
int failCount = 0;
List<TabGroupChatPlanLog> addList = new ArrayList<>();
boolean endFlag = false;
List<Long> doneGroupChatIdList = new ArrayList<>() ;
Date sendTime = null ;
for (QywxSendMessageResultDTO item : list) {
TabGroupChatPlanLog entity = new TabGroupChatPlanLog();
Date sendTime = item.getSendTime();
sendTime = item.getSendTime();
String wxChatId = item.getChatId();
// 如果企微的发送时间晚于计划的结束时间,不记录此类数据
if (sendTime.after(plan.getEndTime())) {
......@@ -552,6 +554,7 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
continue;
}
entity.setGroupChatId(chat.getGroupChatId());
doneGroupChatIdList.add(chat.getGroupChatId()) ;
// 企微返回成功
// 0-未发送 1-已发送 2-因客户不是好友导致发送失败 3-因客户已经收到其他群发消息导致发送失败
if (item.getStatus() == 1) {
......@@ -572,9 +575,40 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
entity.setSendTime(sendTime);
addList.add(entity);
}
// 查询群主的所有群
GroupChatSearchQDTO chatQDTO = new GroupChatSearchQDTO() ;
chatQDTO.setWxEnterpriseId(wxEnterpriseId);
chatQDTO.setEnterpriseId(enterpriseId);
chatQDTO.setStaffId(staffId);
chatQDTO.setStatus(0);
chatQDTO.setGicFlag(1);
chatQDTO.setGiveUpStartTime(sendTime);
List<GroupChatDTO> groupChatDTOList = this.groupChatMapper.list(chatQDTO);
if(CollectionUtils.isNotEmpty(groupChatDTOList)) {
for(GroupChatDTO chatDTO : groupChatDTOList) {
Long groupChatId = chatDTO.getGroupChatId();
if(!doneGroupChatIdList.contains(groupChatId)) {
logger.info("放弃执行的群={}",groupChatId);
TabGroupChatPlanLog entity = new TabGroupChatPlanLog();
entity.setSendStatus(PlanSendStatusEnum.GIVE_UP.getCode());
entity.setGroupChatId(groupChatId);
entity.setLogId(UniqueIdUtils.uniqueLong());
entity.setPlanId(ownerLog.getPlanId());
entity.setOwnLogId(ownerLog.getOwnerLogId());
entity.setWxEnterpriseId(wxEnterpriseId);
entity.setEnterpriseId(enterpriseId);
entity.setStaffId(staffId);
entity.setSendTime(new Date());
failCount = failCount+1 ;
addList.add(entity) ;
}
}
}
if (CollectionUtils.isNotEmpty(addList)) {
this.groupChatPlanLogMapper.batchInsert(addList);
}
// 更新统计数量、状态
if (!endFlag) {
this.groupChatPlanOwnerLogService.updateSendCount(ownerLog.getOwnerLogId(), sendCount,
......
......@@ -316,6 +316,11 @@
<if test="null != startDate">
and a.chat_add_time <![CDATA[ >=]]> #{startDate} and a.chat_add_time <![CDATA[ <= ]]> #{endDate}
</if>
<if test="null != giveUpStartTime">
and a.chat_add_time <![CDATA[ <= ]]> #{giveUpStartTime}
</if>
<if test="null != dismissStartDate">
and a.chat_dissolve_time <![CDATA[ >=]]> #{startDate} and a.chat_dissolve_time <![CDATA[ <= ]]> #{endDate}
</if>
......
......@@ -19,6 +19,8 @@
<result column="done_flag" property="doneFlag"/>
<result column="send_time" property="sendTime"/>
<result column="fail_count" property="failCount"/>
<result column="exec_type" property="execType" />
<result column="data_get_time" property="dataGetTime" />
</resultMap>
<sql id="Base_Column_List">
owner_log_id,
......@@ -31,7 +33,7 @@
send_status,
send_count,
create_time,
update_time , remark , msgid , delete_flag , done_flag , send_time , fail_count , exec_type
update_time , remark , msgid , delete_flag , done_flag , send_time , fail_count , exec_type , data_get_time
</sql>
<!-- ===================== 新增 ======================== -->
......@@ -92,7 +94,7 @@
<update id="updateSendCount">
<![CDATA[
UPDATE tab_haoban_group_chat_plan_owner_log SET send_count = #{sendCount} , fail_count =#{failCount} , done_flag = 1 ,
send_status = 2 , send_time = #{sendTime} ,
send_status = 2 , send_time = #{sendTime} , data_get_time = now() ,
update_time = now() where owner_log_id = #{id}
]]>
</update>
......@@ -108,7 +110,7 @@
update tab_haoban_group_chat_plan_owner_log set send_status = 3 where owner_log_id = #{id}
</update>
<update id="staffSendResult">
update tab_haoban_group_chat_plan_owner_log set send_status = 2 , send_time = #{sendTime} where plan_id = #{planId} and staff_id = #{staffId}
update tab_haoban_group_chat_plan_owner_log set send_status = 2 , send_time = #{sendTime} where plan_id = #{planId} and staff_id = #{staffId}
</update>
<!-- ============ 查询=============-->
......
......@@ -98,6 +98,7 @@ public class GroupChatPlanController {
qdto.setEnterpriseId(qo.getEnterpriseId());
qdto.setSearchParams(qo.getChatName());
qdto.setStatus(0);
qdto.setGicFlag(1);
ServiceResponse<Page<GroupChatDTO>> page = this.groupChatApiService.listPage(qdto, qo);
return RestResponse.successResult(page.getResult());
}
......@@ -195,6 +196,7 @@ public class GroupChatPlanController {
ownerInfo.put("clerkName", owner.getClerkName());
ownerInfo.put("ownerLogId", owner.getOwnerLogId());
ownerInfo.put("sendStatus", owner.getSendStatus());
ownerInfo.put("dataGetTime",owner.getDataGetTime());
retMap.put("ownerInfo", ownerInfo);
}
return RestResponse.successResult(retMap);
......
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