Commit 7f8e2384 by 徐高华

Merge branch 'feature-canvas' into 'developer'

Feature canvas

See merge request !2330
parents 1c6b7952 9726ac44
......@@ -22,6 +22,15 @@ public class ChatOwnerTotalDTO implements Serializable {
private int notSendCount;
// 计划状态 1进行中 2已结束
private int planStatus;
private int execType ;
public int getExecType() {
return execType;
}
public void setExecType(int execType) {
this.execType = execType;
}
public int getPlanStatus() {
return planStatus;
......
......@@ -38,7 +38,17 @@ public class GroupChatPlanOwnerLogDTO implements Serializable{
private String remark ;
private String msgid ;
private Date expireDate ;
private Date sendTime ;
private Date sendTime ;
private int execType ;
public int getExecType() {
return execType;
}
public void setExecType(int execType) {
this.execType = execType;
}
public Date getStartTime() {
return startTime;
}
......
......@@ -15,7 +15,7 @@ public interface GroupChatPlanOwnerLogService {
public void batchAdd(String staffIdList, TabGroupChatPlan entity);
public void update(TabGroupChatPlanOwnerLog entity);
public boolean update(TabGroupChatPlanOwnerLog entity);
public void deleteByStaffIds(Long planId, String delStaffIds);
......
......@@ -135,28 +135,33 @@ public class GroupChatPlanOwnerLogServiceImpl implements GroupChatPlanOwnerLogSe
}
@Override
public void update(TabGroupChatPlanOwnerLog entity) {
public boolean update(TabGroupChatPlanOwnerLog entity) {
String staffId = entity.getStaffId();
TabHaobanClerkMainStoreRelated mainStore = this.clerkMainStoreRelatedService.getMainStoreByStaffId(staffId,
entity.getWxEnterpriseId());
boolean flag = true ;
if (null == mainStore) {
entity.setRemark("区经/未配置主门店");
flag = false ;
} else {
String storeId = mainStore.getStoreId();
StaffClerkRelationDTO clerk = this.staffClerkRelationService.getOneBindByStoreId(staffId, storeId);
if (null != clerk) {
if (!clerk.getEnterpriseId().equals(entity.getEnterpriseId())) {
entity.setRemark("主门店不在任务商户下");
flag = false ;
} else {
entity.setClerkId(clerk.getClerkId());
entity.setStoreId(mainStore.getStoreId());
}
} else {
entity.setRemark("无关联导购");
flag = false ;
logger.info("导购关联数据不存在,staffid={},storeid={}", staffId, mainStore.getStoreId());
}
}
this.groupChatPlanOwnerLogMapper.update(entity);
return flag ;
}
@Override
......
......@@ -393,7 +393,6 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
int pageNum = 0;
if(plan.getExecType() == 1) {
logger.info("好办小程序执行={}",planId);
// 发送消息
while (true) {
ownerList = this.groupChatPlanOwnerLogMapper.listForDoPlan(planId, pageNum * pageSize, pageSize);
if (CollectionUtils.isEmpty(ownerList)) {
......@@ -401,7 +400,11 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
}
pageNum++;
for (TabGroupChatPlanOwnerLog ownerLog : ownerList) {
boolean flag = this.groupChatPlanOwnerLogService.update(ownerLog);
if(flag) {
// 发送消息
}
}
}
return;
......@@ -696,18 +699,27 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
List<GroupChatPlanOwnerLogDTO> list = this.groupChatPlanOwnerLogMapper.listForCancelSend();
if(CollectionUtils.isNotEmpty(list)) {
for(GroupChatPlanOwnerLogDTO dto : list) {
String wxEnterpriseId = dto.getWxEnterpriseId() ;
String msgid = dto.getMsgid() ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
String secret = config.getWxSuiteid() ;
if(qwDTO.isSelf()) {
secret = qwDTO.getSelfSecret() ;
}
ServiceResponse<Void> resp = this.qywxSuiteApiService.cancelGroupmsgSend(qwDTO.getThirdCorpid(),secret,msgid,qwDTO.isSelf(),qwDTO.getUrlHost()) ;
if(resp.isSuccess()) {
this.groupChatPlanOwnerLogMapper.giveUp(dto.getOwnerLogId()) ;
}
this.cancelSend(dto);
}
}
}
private void cancelSend(GroupChatPlanOwnerLogDTO dto) {
try {
String wxEnterpriseId = dto.getWxEnterpriseId();
String msgid = dto.getMsgid();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
String secret = config.getWxSuiteid();
if (qwDTO.isSelf()) {
secret = qwDTO.getSelfSecret();
}
ServiceResponse<Void> resp = this.qywxSuiteApiService.cancelGroupmsgSend(qwDTO.getThirdCorpid(), secret, msgid, qwDTO.isSelf(), qwDTO.getUrlHost());
if (resp.isSuccess()) {
this.groupChatPlanOwnerLogMapper.giveUp(dto.getOwnerLogId());
}
}catch (Exception e) {
logger.info("异常",e);
}
}
......@@ -723,13 +735,17 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
}
private void updateMsgid(GroupChatPlanOwnerLogDTO dto) {
Long ownerLogId = dto.getOwnerLogId() ;
String staffId = dto.getStaffId() ;
Date sendTime = dto.getSendTime() ;
String msgid = this.getQwMsgId(staffId,sendTime,GroupMessageServiceImpl.GroupMsgChatType.group) ;
if(null != msgid) {
logger.info("获取msgid={},{}",ownerLogId,msgid);
this.groupChatPlanOwnerLogMapper.updateMsgid(ownerLogId,msgid);
try{
Long ownerLogId = dto.getOwnerLogId() ;
String staffId = dto.getStaffId() ;
Date sendTime = dto.getSendTime() ;
String msgid = this.getQwMsgId(staffId,sendTime,GroupMessageServiceImpl.GroupMsgChatType.group) ;
if(null != msgid) {
logger.info("获取msgid={},{}",ownerLogId,msgid);
this.groupChatPlanOwnerLogMapper.updateMsgid(ownerLogId,msgid);
}
}catch (Exception e) {
logger.info("异常",e);
}
}
......
......@@ -105,7 +105,7 @@
</update>
<update id="giveUp" parameterType="java.lang.Long">
update tab_haoban_group_chat_plan_owner_log set status_flag = 3 where owner_log_id = #{id}
update tab_haoban_group_chat_plan_owner_log set send_status = 3 where owner_log_id = #{id}
</update>
<!-- ============ 查询=============-->
......@@ -161,6 +161,7 @@
b.name planName ,
b.start_time startTime ,
b.end_time endTime ,
b.exec_type execType ,
<!-- 已发送 -->
SUM(CASE a.send_status WHEN 2 THEN 1 ELSE 0 END ) sendCount,
<!-- 待发送 -->
......@@ -228,6 +229,7 @@
a.owner_log_id ownerLogId ,
b.plan_id planId ,
b.name planName ,
b.exec_type execType ,
a.staff_id staffId ,
a.clerk_id clerkId ,
a.store_id storeId ,
......
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