Commit 19040ddd by 徐高华

欢迎语日志

parent 59c4f1a8
...@@ -14,14 +14,29 @@ public class QywxErrorLogDTO implements Serializable { ...@@ -14,14 +14,29 @@ public class QywxErrorLogDTO implements Serializable {
private Long id; private Long id;
private String wxEnterpriseId; private String wxEnterpriseId;
private String corpid;
private String qywxInterface;
private String scenario; private String scenario;
private String errorContent; private String errorContent;
private String weworkErrorUrl;
private String traceId; private String traceId;
private Integer qywxErrorType; private Integer qywxErrorType;
private Date createTime; private Date createTime;
private String memberId ;
private String externalUserId ;
public String getMemberId() {
return memberId;
}
public String getExternalUserId() {
return externalUserId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public void setExternalUserId(String externalUserId) {
this.externalUserId = externalUserId;
}
public Long getId() { public Long getId() {
return id; return id;
...@@ -39,22 +54,6 @@ public class QywxErrorLogDTO implements Serializable { ...@@ -39,22 +54,6 @@ public class QywxErrorLogDTO implements Serializable {
this.wxEnterpriseId = wxEnterpriseId; this.wxEnterpriseId = wxEnterpriseId;
} }
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public String getQywxInterface() {
return qywxInterface;
}
public void setQywxInterface(String qywxInterface) {
this.qywxInterface = qywxInterface;
}
public String getScenario() { public String getScenario() {
return scenario; return scenario;
} }
...@@ -71,14 +70,6 @@ public class QywxErrorLogDTO implements Serializable { ...@@ -71,14 +70,6 @@ public class QywxErrorLogDTO implements Serializable {
this.errorContent = errorContent; this.errorContent = errorContent;
} }
public String getWeworkErrorUrl() {
return weworkErrorUrl;
}
public void setWeworkErrorUrl(String weworkErrorUrl) {
this.weworkErrorUrl = weworkErrorUrl;
}
public String getTraceId() { public String getTraceId() {
return traceId; return traceId;
} }
......
...@@ -25,6 +25,25 @@ public class QywxErrorLogListQDTO extends BasePageInfo implements Serializable { ...@@ -25,6 +25,25 @@ public class QywxErrorLogListQDTO extends BasePageInfo implements Serializable {
private String startDate; private String startDate;
private String endDate; private String endDate;
private String memberId ;
private String externalUserId ;
public String getMemberId() {
return memberId;
}
public String getExternalUserId() {
return externalUserId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public void setExternalUserId(String externalUserId) {
this.externalUserId = externalUserId;
}
public String getScenario() { public String getScenario() {
return scenario; return scenario;
......
...@@ -15,29 +15,11 @@ public interface QywxErrorLogApiService { ...@@ -15,29 +15,11 @@ public interface QywxErrorLogApiService {
/** /**
* 新增数据 * 新增数据
* "routerName": "addQywxErrorLogMq", * "routerName": "addQywxErrorLogMq",
* @param param 参数
* @return {@link QywxErrorLogDTO }
* @author mozhu
* @date 2022-04-18 17:02:40
*/ */
void insertQywxErrorLog(String param); void insertQywxErrorLog(String param);
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
QywxErrorLogDTO queryById(Long id);
/** /**
* 查询分页列表 * 查询分页列表
*
* @param qywxErrorLogListQDTO qdto qywx错误日志列表
* @return {@link Page }<{@link QywxErrorLogDTO }>
* @author mozhu
* @date 2022-04-18 17:01:14
*/ */
Page<QywxErrorLogDTO> queryListByPage(QywxErrorLogListQDTO qywxErrorLogListQDTO); Page<QywxErrorLogDTO> queryListByPage(QywxErrorLogListQDTO qywxErrorLogListQDTO);
......
...@@ -21,14 +21,6 @@ public interface TabQywxErrorLogMapper { ...@@ -21,14 +21,6 @@ public interface TabQywxErrorLogMapper {
int insert(TabQywxErrorLog tabQywxErrorLog); int insert(TabQywxErrorLog tabQywxErrorLog);
/** /**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
TabQywxErrorLog queryById(Long id);
/**
* 分页列表 * 分页列表
* *
* @param qywxErrorLogListQDTO qdto qywx错误日志列表 * @param qywxErrorLogListQDTO qdto qywx错误日志列表
......
...@@ -17,8 +17,6 @@ public class TabQywxErrorLog implements Serializable { ...@@ -17,8 +17,6 @@ public class TabQywxErrorLog implements Serializable {
private Long id; private Long id;
private String wxEnterpriseId; private String wxEnterpriseId;
private String corpid;
private String qywxInterface;
/** /**
* 场景 * 场景
*/ */
...@@ -27,10 +25,10 @@ public class TabQywxErrorLog implements Serializable { ...@@ -27,10 +25,10 @@ public class TabQywxErrorLog implements Serializable {
* 报错内容 * 报错内容
*/ */
private String errorContent; private String errorContent;
/**
* 企微报错url private String memberId;
*/ private String externalUserId;
private String weworkErrorUrl;
/** /**
* 链路id * 链路id
*/ */
...@@ -58,22 +56,6 @@ public class TabQywxErrorLog implements Serializable { ...@@ -58,22 +56,6 @@ public class TabQywxErrorLog implements Serializable {
this.wxEnterpriseId = wxEnterpriseId; this.wxEnterpriseId = wxEnterpriseId;
} }
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public String getQywxInterface() {
return qywxInterface;
}
public void setQywxInterface(String qywxInterface) {
this.qywxInterface = qywxInterface;
}
public String getScenario() { public String getScenario() {
return scenario; return scenario;
} }
...@@ -89,13 +71,21 @@ public class TabQywxErrorLog implements Serializable { ...@@ -89,13 +71,21 @@ public class TabQywxErrorLog implements Serializable {
public void setErrorContent(String errorContent) { public void setErrorContent(String errorContent) {
this.errorContent = errorContent; this.errorContent = errorContent;
} }
public String getMemberId() {
return memberId;
}
public String getExternalUserId() {
return externalUserId;
}
public String getWeworkErrorUrl() { public void setMemberId(String memberId) {
return weworkErrorUrl; this.memberId = memberId;
} }
public void setWeworkErrorUrl(String weworkErrorUrl) { public void setExternalUserId(String externalUserId) {
this.weworkErrorUrl = weworkErrorUrl; this.externalUserId = externalUserId;
} }
public String getTraceId() { public String getTraceId() {
......
...@@ -14,11 +14,10 @@ public class TabQywxErrorLogBO implements Serializable { ...@@ -14,11 +14,10 @@ public class TabQywxErrorLogBO implements Serializable {
private Long id; private Long id;
private String wxEnterpriseId; private String wxEnterpriseId;
private String corpid; private String memberId;
private String qywxInterface; private String externalUserId;
private String scenario; private String scenario;
private String errorContent; private String errorContent;
private String weworkErrorUrl;
private String traceId; private String traceId;
private Integer qywxErrorType; private Integer qywxErrorType;
private Date createTime; private Date createTime;
...@@ -39,22 +38,6 @@ public class TabQywxErrorLogBO implements Serializable { ...@@ -39,22 +38,6 @@ public class TabQywxErrorLogBO implements Serializable {
this.wxEnterpriseId = wxEnterpriseId; this.wxEnterpriseId = wxEnterpriseId;
} }
public String getCorpid() {
return corpid;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public String getQywxInterface() {
return qywxInterface;
}
public void setQywxInterface(String qywxInterface) {
this.qywxInterface = qywxInterface;
}
public String getScenario() { public String getScenario() {
return scenario; return scenario;
} }
...@@ -70,13 +53,21 @@ public class TabQywxErrorLogBO implements Serializable { ...@@ -70,13 +53,21 @@ public class TabQywxErrorLogBO implements Serializable {
public void setErrorContent(String errorContent) { public void setErrorContent(String errorContent) {
this.errorContent = errorContent; this.errorContent = errorContent;
} }
public String getMemberId() {
return memberId;
}
public String getExternalUserId() {
return externalUserId;
}
public String getWeworkErrorUrl() { public void setMemberId(String memberId) {
return weworkErrorUrl; this.memberId = memberId;
} }
public void setWeworkErrorUrl(String weworkErrorUrl) { public void setExternalUserId(String externalUserId) {
this.weworkErrorUrl = weworkErrorUrl; this.externalUserId = externalUserId;
} }
public String getTraceId() { public String getTraceId() {
......
...@@ -23,15 +23,6 @@ public interface QywxErrorLogService { ...@@ -23,15 +23,6 @@ public interface QywxErrorLogService {
*/ */
TabQywxErrorLogBO insert(TabQywxErrorLogBO tabQywxErrorLogBO); TabQywxErrorLogBO insert(TabQywxErrorLogBO tabQywxErrorLogBO);
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
TabQywxErrorLogBO queryById(Long id);
/** /**
* 查询分页列表 * 查询分页列表
* *
......
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.commons.util.UniqueIdUtils; import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.common.utils.EntityUtil; import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.api.dto.qdto.QywxErrorLogListQDTO; import com.gic.haoban.manage.api.dto.qdto.QywxErrorLogListQDTO;
import com.gic.haoban.manage.service.dao.mapper.TabQywxErrorLogMapper; import com.gic.haoban.manage.service.dao.mapper.TabQywxErrorLogMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxApplication;
import com.gic.haoban.manage.service.entity.TabQywxErrorLog; import com.gic.haoban.manage.service.entity.TabQywxErrorLog;
import com.gic.haoban.manage.service.pojo.bo.TabQywxErrorLogBO; import com.gic.haoban.manage.service.pojo.bo.TabQywxErrorLogBO;
import com.gic.haoban.manage.service.service.QywxErrorLogService; import com.gic.haoban.manage.service.service.QywxErrorLogService;
import com.gic.haoban.manage.service.service.WxApplicationService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/** /**
* 企微报错日志(TabQywxErrorLog)表服务实现类 * 企微报错日志(TabQywxErrorLog)表服务实现类
...@@ -26,27 +23,14 @@ import java.util.List; ...@@ -26,27 +23,14 @@ import java.util.List;
*/ */
@Service @Service
public class TabQywxErrorLogServiceImpl implements QywxErrorLogService { public class TabQywxErrorLogServiceImpl implements QywxErrorLogService {
private static final Logger logger = LogManager.getLogger(TabQywxErrorLogServiceImpl.class);
@Autowired @Autowired
private TabQywxErrorLogMapper tabQywxErrorLogMapper; private TabQywxErrorLogMapper tabQywxErrorLogMapper;
@Autowired
private WxApplicationService wxApplicationService;
@Override @Override
public TabQywxErrorLogBO insert(TabQywxErrorLogBO tabQywxErrorLogBO) { public TabQywxErrorLogBO insert(TabQywxErrorLogBO tabQywxErrorLogBO) {
String wxEnterpriseId = tabQywxErrorLogBO.getWxEnterpriseId(); String wxEnterpriseId = tabQywxErrorLogBO.getWxEnterpriseId();
String corpid = tabQywxErrorLogBO.getCorpid();
if (StringUtils.isBlank(wxEnterpriseId)) { if (StringUtils.isBlank(wxEnterpriseId)) {
TabHaobanWxApplication tabHaobanWxApplication = wxApplicationService.selectByCorpId(corpid);
if (tabHaobanWxApplication != null) {
tabQywxErrorLogBO.setWxEnterpriseId(tabHaobanWxApplication.getWxEnterpriseId());
}
}
wxEnterpriseId = tabQywxErrorLogBO.getWxEnterpriseId();
if (StringUtils.isBlank(wxEnterpriseId)) {
logger.error("企业微信id为空,corpid:{}", corpid);
return null; return null;
} }
tabQywxErrorLogBO.setId(UniqueIdUtils.uniqueLong()); tabQywxErrorLogBO.setId(UniqueIdUtils.uniqueLong());
...@@ -56,12 +40,6 @@ public class TabQywxErrorLogServiceImpl implements QywxErrorLogService { ...@@ -56,12 +40,6 @@ public class TabQywxErrorLogServiceImpl implements QywxErrorLogService {
} }
@Override @Override
public TabQywxErrorLogBO queryById(Long id) {
TabQywxErrorLog tabQywxErrorLog = this.tabQywxErrorLogMapper.queryById(id);
return EntityUtil.changeEntityByOrika(TabQywxErrorLogBO.class, tabQywxErrorLog);
}
@Override
public List<TabQywxErrorLog> queryListByPage(QywxErrorLogListQDTO qywxErrorLogListQDTO) { public List<TabQywxErrorLog> queryListByPage(QywxErrorLogListQDTO qywxErrorLogListQDTO) {
return this.tabQywxErrorLogMapper.queryListByPage(qywxErrorLogListQDTO); return this.tabQywxErrorLogMapper.queryListByPage(qywxErrorLogListQDTO);
} }
......
...@@ -214,6 +214,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -214,6 +214,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
private QywxSendService qywxSendService ; private QywxSendService qywxSendService ;
@Autowired @Autowired
private GroupChatService groupChatService ; private GroupChatService groupChatService ;
private static GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
@Override @Override
...@@ -480,7 +482,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -480,7 +482,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
TabHaobanClerkMainStoreRelated mainStoreRelated = clerkMainStoreRelatedService.getMainStoreByStaffId(staffId, wxEnterpriseId); TabHaobanClerkMainStoreRelated mainStoreRelated = clerkMainStoreRelatedService.getMainStoreByStaffId(staffId, wxEnterpriseId);
if (mainStoreRelated == null) { if (mainStoreRelated == null) {
log.info("【新增外部联系人】主门店为空:staffId={}", staffId); log.info("【新增外部联系人】主门店为空:staffId={}", staffId);
this.sendWelcome(dto, qwDTO, null, staffId, null); this.sendWelcome(dto, qwDTO, null, staffId, null , null);
return; return;
} }
staffClerkRelationDTO = staffClerkRelationService.getOneBindByStoreId(staffId, mainStoreRelated.getStoreId()); staffClerkRelationDTO = staffClerkRelationService.getOneBindByStoreId(staffId, mainStoreRelated.getStoreId());
...@@ -645,7 +647,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -645,7 +647,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
} }
String storeId = staffClerkRelationDTO.getStoreId(); String storeId = staffClerkRelationDTO.getStoreId();
this.saveExternalClerk(memberId, staffId, dto, staffClerkRelationDTO , 1); this.saveExternalClerk(memberId, staffId, dto, staffClerkRelationDTO , 1);
this.sendWelcome(dto, qwDTO, enterpriseId, staffId, clerkId); this.sendWelcome(dto, qwDTO, enterpriseId, staffId, clerkId,memberId);
//同步好友标签 //同步好友标签
this.pushTagSync(memberId, wxEnterpriseId, enterpriseId); this.pushTagSync(memberId, wxEnterpriseId, enterpriseId);
//回调给会员,更新是否为企微好友 //回调给会员,更新是否为企微好友
...@@ -787,7 +789,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -787,7 +789,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String clerkId = staffClerkRelationDTO.getClerkId(); String clerkId = staffClerkRelationDTO.getClerkId();
String enterpriseId = staffClerkRelationDTO.getEnterpriseId(); String enterpriseId = staffClerkRelationDTO.getEnterpriseId();
//发送欢迎语 //发送欢迎语
sendWelcome(dto, qwDTO, enterpriseId, staffId, clerkId); sendWelcome(dto, qwDTO, enterpriseId, staffId, clerkId,null);
//保存好友关系 //保存好友关系
this.saveExternalClerk(null, staffId, dto, staffClerkRelationDTO, 4); this.saveExternalClerk(null, staffId, dto, staffClerkRelationDTO, 4);
} }
...@@ -800,40 +802,37 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -800,40 +802,37 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
* @param enterpriseId * @param enterpriseId
* @param staffId * @param staffId
*/ */
private void sendWelcome(MemberUnionidRelatedDTO dto, WxEnterpriseQwDTO wxEnterpriseDTO, String enterpriseId, String staffId, String clerkId) { private void sendWelcome(MemberUnionidRelatedDTO dto, WxEnterpriseQwDTO wxEnterpriseDTO, String enterpriseId, String staffId, String clerkId , String memberId) {
log.info("发送欢迎语:dto:{},staffId:{}", JSONObject.toJSONString(dto), staffId); log.info("发送欢迎语:dto:{},staffId:{}", JSONObject.toJSONString(dto), staffId);
String welcomeCode = dto.getWelcomeCode(); String welcomeCode = dto.getWelcomeCode();
String state = dto.getState(); String state = dto.getState();
String wxEnterpriseId = wxEnterpriseDTO.getWxEnterpriseId(); String wxEnterpriseId = wxEnterpriseDTO.getWxEnterpriseId();
QywxErrorLogDTO errLog = new QywxErrorLogDTO();
errLog.setWxEnterpriseId(wxEnterpriseId);
errLog.setMemberId(memberId);
errLog.setExternalUserId(dto.getExternalUserid());
errLog.setTraceId(ProviderLocalTag.tag.get().traceId);
errLog.setQywxErrorType(1);
if (StringUtils.isBlank(welcomeCode)) { if (StringUtils.isBlank(welcomeCode)) {
log.error("welcomeCode为空,请检查是否使用企微的欢迎语:{}", wxEnterpriseId); log.error("welcomeCode为空,请检查是否使用企微的欢迎语:{}", wxEnterpriseId);
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try { try {
QywxErrorLogDTO qywxErrorLogDTO = new QywxErrorLogDTO(); errLog.setScenario("欢迎语");
qywxErrorLogDTO.setWxEnterpriseId(wxEnterpriseId); errLog.setErrorContent("welcomeCode空,GIC不处理,使用企微发送欢迎语");
qywxErrorLogDTO.setCorpid(dto.getCorpid()); clientInstance.sendMessage(Manage3Constants.QYWX_ERROR_MSG, JSON.toJSONString(errLog));
qywxErrorLogDTO.setScenario("欢迎语不发送");
qywxErrorLogDTO.setErrorContent("welcomeCode为空,请检查是否使用企微的欢迎语");
qywxErrorLogDTO.setTraceId(ProviderLocalTag.tag.get().traceId);
qywxErrorLogDTO.setQywxErrorType(1);
clientInstance.sendMessage(Manage3Constants.QYWX_ERROR_MSG, JSON.toJSONString(qywxErrorLogDTO));
} catch (Exception e) { } catch (Exception e) {
log.error("发送消息失败:{}", e.getMessage(), e); log.error("发送消息失败:{}", e.getMessage(), e);
} }
return; return;
} }
String relationKey = SecureUtil.md5(staffId + dto.getExternalUserid()); String relationKey = SecureUtil.md5(staffId + dto.getExternalUserid());
WelcomeDetailBO welcomeDetailBO = null; WelcomeDetailBO welcomeDetailBO = null;
if (StringUtils.isNotBlank(state) && (state.startsWith(Manage3Constants.HM) || state.startsWith(Manage3Constants.DT))) { if (StringUtils.isNotBlank(state) && (state.startsWith(Manage3Constants.HM) || state.startsWith(Manage3Constants.DT))) {
//"HM+id" "DT+key"
log.info("特殊欢迎语 state:{}", state); log.info("特殊欢迎语 state:{}", state);
WelcomeReferBO welcomeReferBo = getWelcomeReferBo(state); WelcomeReferBO welcomeReferBo = getWelcomeReferBo(state);
welcomeDetailBO = welcomeService.getMatchWelcomeWithReferId(staffId, wxEnterpriseId, welcomeReferBo); welcomeDetailBO = welcomeService.getMatchWelcomeWithReferId(staffId, wxEnterpriseId, welcomeReferBo);
} else { } else {
welcomeDetailBO = welcomeService.getMatchWelcome(staffId, wxEnterpriseId); welcomeDetailBO = welcomeService.getMatchWelcome(staffId, wxEnterpriseId);
} }
if (Objects.isNull(welcomeDetailBO)) { if (Objects.isNull(welcomeDetailBO)) {
log.info("欢迎语未配置:wxEnterpriseId:{}", wxEnterpriseId); log.info("欢迎语未配置:wxEnterpriseId:{}", wxEnterpriseId);
return; return;
...@@ -877,12 +876,25 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -877,12 +876,25 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
} }
qywxWelcomeMsgDTO.setWelcomeCode(welcomeCode); qywxWelcomeMsgDTO.setWelcomeCode(welcomeCode);
log.info("[sendWelcome] 发送欢迎语 params:{}", JSON.toJSONString(qywxWelcomeMsgDTO)); log.info("[sendWelcome] 发送欢迎语 params:{}", JSON.toJSONString(qywxWelcomeMsgDTO));
String result = null ;
if (dto.getSuiteid().equals(SELF_APP)) { if (dto.getSuiteid().equals(SELF_APP)) {
//好办助手和代开发
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(dto.getWxEnterpriseId(), SecretTypeEnum.CUSTOMIZED_APP.getVal()); SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(dto.getWxEnterpriseId(), SecretTypeEnum.CUSTOMIZED_APP.getVal());
qywxUserApiService.sendSelfWelcomeMsgByExternal(dto.getCorpid(), secretSetting.getSecretVal(), qywxWelcomeMsgDTO); result = qywxUserApiService.sendSelfWelcomeMsgByExternal(dto.getCorpid(), secretSetting.getSecretVal(), qywxWelcomeMsgDTO);
} else { } else {
qywxUserApiService.sendWelcomeMsgByExternal(dto.getCorpid(), config.getWxSuiteid(), qywxWelcomeMsgDTO); result = qywxUserApiService.sendWelcomeMsgByExternal(dto.getCorpid(), config.getWxSuiteid(), qywxWelcomeMsgDTO);
}
if(StringUtils.isNotBlank(result)) {
JSONObject json = JSON.parseObject(result) ;
int errcode = json.getIntValue("errcode") ;
if(0 != errcode) {
try {
errLog.setScenario("欢迎语");
errLog.setErrorContent(result);
clientInstance.sendMessage(Manage3Constants.QYWX_ERROR_MSG, JSON.toJSONString(errLog));
} catch (Exception e) {
log.error("发送消息失败:{}", e.getMessage(), e);
}
}
} }
} }
......
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import cn.hutool.core.date.DatePattern; import java.util.List;
import cn.hutool.core.date.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.common.utils.EntityUtil; import com.gic.haoban.common.utils.EntityUtil;
...@@ -14,12 +17,9 @@ import com.gic.haoban.manage.service.pojo.bo.TabQywxErrorLogBO; ...@@ -14,12 +17,9 @@ import com.gic.haoban.manage.service.pojo.bo.TabQywxErrorLogBO;
import com.gic.haoban.manage.service.service.QywxErrorLogService; import com.gic.haoban.manage.service.service.QywxErrorLogService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
/** /**
* 企微报错日志(TabQywxErrorLog)表服务实现类 * 企微报错日志(TabQywxErrorLog)表服务实现类
...@@ -29,23 +29,16 @@ import java.util.List; ...@@ -29,23 +29,16 @@ import java.util.List;
*/ */
@Service @Service
public class QywxErrorLogApiServiceImpl implements QywxErrorLogApiService { public class QywxErrorLogApiServiceImpl implements QywxErrorLogApiService {
private static final Logger log = LogManager.getLogger(QywxErrorLogApiServiceImpl.class);
@Autowired @Autowired
private QywxErrorLogService tabQywxErrorLogService; private QywxErrorLogService tabQywxErrorLogService;
@Override @Override
public void insertQywxErrorLog(String param) { public void insertQywxErrorLog(String param) {
log.info("请求企微报错日志:{}", param);
QywxErrorLogDTO qywxErrorLogDTO = JSON.parseObject(param, QywxErrorLogDTO.class); QywxErrorLogDTO qywxErrorLogDTO = JSON.parseObject(param, QywxErrorLogDTO.class);
tabQywxErrorLogService.insert(EntityUtil.changeEntityByOrika(TabQywxErrorLogBO.class, qywxErrorLogDTO)); tabQywxErrorLogService.insert(EntityUtil.changeEntityByOrika(TabQywxErrorLogBO.class, qywxErrorLogDTO));
} }
@Override @Override
public QywxErrorLogDTO queryById(Long id) {
return EntityUtil.changeEntityByOrika(QywxErrorLogDTO.class, tabQywxErrorLogService.queryById(id));
}
@Override
public Page<QywxErrorLogDTO> queryListByPage(QywxErrorLogListQDTO qywxErrorLogListQDTO) { public Page<QywxErrorLogDTO> queryListByPage(QywxErrorLogListQDTO qywxErrorLogListQDTO) {
qywxErrorLogListQDTO.setStartDate(DateUtil.format(DateUtil.beginOfDay(DateUtil.parse(qywxErrorLogListQDTO.getStartDate())), DatePattern.NORM_DATETIME_PATTERN)); qywxErrorLogListQDTO.setStartDate(DateUtil.format(DateUtil.beginOfDay(DateUtil.parse(qywxErrorLogListQDTO.getStartDate())), DatePattern.NORM_DATETIME_PATTERN));
qywxErrorLogListQDTO.setEndDate(DateUtil.format(DateUtil.beginOfDay(DateUtil.parse(qywxErrorLogListQDTO.getEndDate())), DatePattern.NORM_DATETIME_PATTERN)); qywxErrorLogListQDTO.setEndDate(DateUtil.format(DateUtil.beginOfDay(DateUtil.parse(qywxErrorLogListQDTO.getEndDate())), DatePattern.NORM_DATETIME_PATTERN));
......
...@@ -3,19 +3,20 @@ ...@@ -3,19 +3,20 @@
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.TabQywxErrorLogMapper"> <mapper namespace="com.gic.haoban.manage.service.dao.mapper.TabQywxErrorLogMapper">
<resultMap type="com.gic.haoban.manage.service.entity.TabQywxErrorLog" id="TabQywxErrorLogMap"> <resultMap type="com.gic.haoban.manage.service.entity.TabQywxErrorLog" id="TabQywxErrorLogMap">
<result property="id" column="id" jdbcType="INTEGER"/> <result property="id" column="id" />
<result property="wxEnterpriseId" column="wx_enterprise_id" jdbcType="VARCHAR"/> <result property="wxEnterpriseId" column="wx_enterprise_id" />
<result property="corpid" column="corpid" jdbcType="VARCHAR"/> <result property="member_id" column="memberId"/>
<result property="qywxInterface" column="qywx_interface" jdbcType="VARCHAR"/> <result property="external_user_id" column="externalUserId" />
<result property="scenario" column="scenario" jdbcType="VARCHAR"/> <result property="scenario" column="scenario" />
<result property="errorContent" column="error_content" jdbcType="VARCHAR"/> <result property="errorContent" column="error_content" />
<result property="weworkErrorUrl" column="wework_error_url" jdbcType="VARCHAR"/> <result property="weworkErrorUrl" column="wework_error_url" />
<result property="traceId" column="trace_id" jdbcType="VARCHAR"/> <result property="traceId" column="trace_id" />
<result property="qywxErrorType" column="qywx_error_type" jdbcType="INTEGER"/> <result property="qywxErrorType" column="qywx_error_type" />
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> <result property="createTime" column="create_time"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, wx_enterprise_id,corpid,qywx_interface,scenario, error_content, wework_error_url, trace_id, qywx_error_type, create_time </sql> id, wx_enterprise_id, member_id , external_user_id ,scenario, error_content, trace_id, qywx_error_type, create_time
</sql>
<!--新增所有列--> <!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true" <insert id="insert" keyProperty="id" useGeneratedKeys="true"
...@@ -28,11 +29,11 @@ ...@@ -28,11 +29,11 @@
<if test="wxEnterpriseId != null and wxEnterpriseId != ''"> <if test="wxEnterpriseId != null and wxEnterpriseId != ''">
wx_enterprise_id, wx_enterprise_id,
</if> </if>
<if test="corpid != null and corpid != ''"> <if test="memberId != null and memberId != ''">
corpid, member_id,
</if> </if>
<if test="qywxInterface != null and qywxInterface != ''"> <if test="externalUserId != null and externalUserId != ''">
qywx_interface, external_user_id,
</if> </if>
<if test="scenario != null and scenario != ''"> <if test="scenario != null and scenario != ''">
scenario, scenario,
...@@ -40,9 +41,6 @@ ...@@ -40,9 +41,6 @@
<if test="errorContent != null and errorContent != ''"> <if test="errorContent != null and errorContent != ''">
error_content, error_content,
</if> </if>
<if test="weworkErrorUrl != null and weworkErrorUrl != ''">
wework_error_url,
</if>
<if test="traceId != null and traceId != ''"> <if test="traceId != null and traceId != ''">
trace_id, trace_id,
</if> </if>
...@@ -60,11 +58,11 @@ ...@@ -60,11 +58,11 @@
<if test="wxEnterpriseId != null and wxEnterpriseId != ''"> <if test="wxEnterpriseId != null and wxEnterpriseId != ''">
#{wxEnterpriseId}, #{wxEnterpriseId},
</if> </if>
<if test="corpid != null and corpid != ''"> <if test="memberId != null and memberId != ''">
#{corpid}, #{memberId},
</if> </if>
<if test="qywxInterface != null and qywxInterface != ''"> <if test="externalUserId != null and externalUserId != ''">
#{qywxInterface}, #{externalUserId},
</if> </if>
<if test="scenario != null and scenario != ''"> <if test="scenario != null and scenario != ''">
#{scenario}, #{scenario},
...@@ -72,9 +70,6 @@ ...@@ -72,9 +70,6 @@
<if test="errorContent != null and errorContent != ''"> <if test="errorContent != null and errorContent != ''">
#{errorContent}, #{errorContent},
</if> </if>
<if test="weworkErrorUrl != null and weworkErrorUrl != ''">
#{weworkErrorUrl},
</if>
<if test="traceId != null and traceId != ''"> <if test="traceId != null and traceId != ''">
#{traceId}, #{traceId},
</if> </if>
...@@ -88,14 +83,6 @@ ...@@ -88,14 +83,6 @@
</insert> </insert>
<!--查询单个-->
<select id="queryById" resultMap="TabQywxErrorLogMap">
select
<include refid="Base_Column_List"/>
from tab_qywx_error_log
where id = #{id}
</select>
<!--通过实体作为筛选条件查询--> <!--通过实体作为筛选条件查询-->
<select id="queryListByPage" parameterType="com.gic.haoban.manage.api.dto.qdto.QywxErrorLogListQDTO" <select id="queryListByPage" parameterType="com.gic.haoban.manage.api.dto.qdto.QywxErrorLogListQDTO"
resultMap="TabQywxErrorLogMap"> resultMap="TabQywxErrorLogMap">
...@@ -109,6 +96,12 @@ ...@@ -109,6 +96,12 @@
<if test="scenario != null and scenario != ''"> <if test="scenario != null and scenario != ''">
and scenario like CONCAT('%',#{scenario},'%') and scenario like CONCAT('%',#{scenario},'%')
</if> </if>
<if test="memberId != null and memberId != ''">
and member_id = #{memberId}
</if>
<if test="externalUserId != null and externalUserId != ''">
and external_user_id = #{externalUserId}
</if>
<if test="qywxErrorType != null"> <if test="qywxErrorType != null">
and qywx_error_type = #{qywxErrorType} and qywx_error_type = #{qywxErrorType}
</if> </if>
......
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