Commit 35d5fcc2 by 徐高华

sql

parent 349a6fce
package com.gic.haoban.manage.service.service.chat; package com.gic.haoban.manage.service.service.chat;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.gic.api.base.commons.BasePageInfo; import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
...@@ -18,5 +19,7 @@ public interface GroupChatPlanOwnerLogService { ...@@ -18,5 +19,7 @@ public interface GroupChatPlanOwnerLogService {
public Page<GroupChatPlanOwnerLogDTO> listPage(Long planId, GroupChatPlanSearchQDTO qdto, public Page<GroupChatPlanOwnerLogDTO> listPage(Long planId, GroupChatPlanSearchQDTO qdto,
BasePageInfo basePageInfo); BasePageInfo basePageInfo);
List<TabGroupChatPlanOwnerLog> listForTimer() ;
} }
\ No newline at end of file
...@@ -133,5 +133,10 @@ public class GroupChatPlanOwnerLogServiceImpl implements GroupChatPlanOwnerLogSe ...@@ -133,5 +133,10 @@ public class GroupChatPlanOwnerLogServiceImpl implements GroupChatPlanOwnerLogSe
} }
this.groupChatPlanOwnerLogMapper.insert(log); this.groupChatPlanOwnerLogMapper.insert(log);
} }
@Override
public List<TabGroupChatPlanOwnerLog> listForTimer() {
return null;
}
} }
\ No newline at end of file
...@@ -153,51 +153,55 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -153,51 +153,55 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
@Override @Override
public void doPlanSendInfoTimer(String params) { public void doPlanSendInfoTimer(String params) {
Long owner_log_id = 472092751301763073L; List<TabGroupChatPlanOwnerLog> logList = this.groupChatPlanOwnerLogService.listForTimer() ;
TabGroupChatPlanOwnerLog ownerLog = this.groupChatPlanOwnerLogService.getById(owner_log_id); for(TabGroupChatPlanOwnerLog log : logList) {
String wxEnterpriseId = ownerLog.getWxEnterpriseId(); Long ownerLogId = log.getOwnerLogId();
String enterpriseId = ownerLog.getEnterpriseId(); TabGroupChatPlanOwnerLog ownerLog = this.groupChatPlanOwnerLogService.getById(ownerLogId);
String msgid = ownerLog.getMsgid(); String wxEnterpriseId = ownerLog.getWxEnterpriseId();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId); String enterpriseId = ownerLog.getEnterpriseId();
if (qwDTO != null) { String msgid = ownerLog.getMsgid();
} WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO != null) {
}
String staffId = ownerLog.getStaffId(); String staffId = ownerLog.getStaffId();
TabHaobanStaff staff = this.staffMapper.selectByPrimaryKey(staffId); TabHaobanStaff staff = this.staffMapper.selectByPrimaryKey(staffId);
String userid = staff.getWxUserId(); String userid = staff.getWxUserId();
if (qwDTO.needOpenUserId3th()) { if (qwDTO.needOpenUserId3th()) {
userid = staff.getWxOpenUseId(); userid = staff.getWxOpenUseId();
} }
JSONResponse respon = qywxSuiteApiService.resultExternalMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(), JSONResponse respon = qywxSuiteApiService.resultExternalMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(),
msgid, null, userid); msgid, null, userid);
logger.info(JSON.toJSONString(respon)); logger.info(JSON.toJSONString(respon));
if (respon.getErrorCode() == 0) { if (respon.getErrorCode() == 0) {
List<QywxSendMessageResultDTO> list = (List<QywxSendMessageResultDTO>) respon.getList(); List<QywxSendMessageResultDTO> list = (List<QywxSendMessageResultDTO>) respon.getList();
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
int sendCount = list.size(); int sendCount = list.size();
this.groupChatPlanOwnerLogService.updateSendCount(ownerLog.getOwnerLogId(), sendCount, this.groupChatPlanOwnerLogService.updateSendCount(ownerLog.getOwnerLogId(), sendCount,
list.get(0).getSendTime()); list.get(0).getSendTime());
for (QywxSendMessageResultDTO item : list) { for (QywxSendMessageResultDTO item : list) {
String wxChatId3th = item.getChatId(); String wxChatId3th = item.getChatId();
Date sendTime = item.getSendTime(); Date sendTime = item.getSendTime();
TabGroupChatPlanLog entity = new TabGroupChatPlanLog(); TabGroupChatPlanLog entity = new TabGroupChatPlanLog();
entity.setLogId(UniqueIdUtils.uniqueLong()); entity.setLogId(UniqueIdUtils.uniqueLong());
entity.setPlanId(ownerLog.getPlanId()); entity.setPlanId(ownerLog.getPlanId());
entity.setOwnLogId(ownerLog.getOwnerLogId()); entity.setOwnLogId(ownerLog.getOwnerLogId());
entity.setWxEnterpriseId(wxEnterpriseId); entity.setWxEnterpriseId(wxEnterpriseId);
entity.setEnterpriseId(enterpriseId); entity.setEnterpriseId(enterpriseId);
entity.setWxChatId3th(wxChatId3th); entity.setWxChatId3th(wxChatId3th);
GroupChatBO chat = this.groupChatService.getByWxChatId3th(wxEnterpriseId, wxChatId3th); entity.setStaffId(staffId);
if (null != chat) { GroupChatBO chat = this.groupChatService.getByWxChatId3th(wxEnterpriseId, wxChatId3th);
entity.setGroupChatId(chat.getGroupChatId()); if (null != chat) {
entity.setGroupChatId(chat.getGroupChatId());
}
entity.setSendTime(sendTime);
entity.setSendStatus(1);
this.groupChatPlanLogMapper.insert(entity);
} }
entity.setSendTime(sendTime);
entity.setSendStatus(1);
this.groupChatPlanLogMapper.insert(entity);
}
}
} }
} }
} }
......
...@@ -80,6 +80,6 @@ ...@@ -80,6 +80,6 @@
LEFT JOIN tab_haoban_group_chat_plan_owner_log b ON a.`own_log_id` = b.`owner_log_id` LEFT JOIN tab_haoban_group_chat_plan_owner_log b ON a.`own_log_id` = b.`owner_log_id`
LEFT JOIN tab_haoban_staff c ON a.`staff_id` = c.`staff_id` LEFT JOIN tab_haoban_staff c ON a.`staff_id` = c.`staff_id`
LEFT JOIN tab_haoban_group_chat d ON a.group_chat_id = d.group_chat_id LEFT JOIN tab_haoban_group_chat d ON a.group_chat_id = d.group_chat_id
where a.wx_enterprise_id = #{wxEnterpriseId} and plan_id = #{planId} where a.wx_enterprise_id = #{wxEnterpriseId} and a.plan_id = #{planId}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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