Skip to content

Commit

Permalink
Merge pull request #48 from lianluoyi/dev
Browse files Browse the repository at this point in the history
V1.36.0版本更新
  • Loading branch information
broccoli77 committed Dec 5, 2023
2 parents b32af3e + c57f655 commit 4f4d0bb
Show file tree
Hide file tree
Showing 37 changed files with 236 additions and 147 deletions.
10 changes: 10 additions & 0 deletions easyink-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@


<dependencies>
<!--普罗米修斯 begin-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<!--普罗米修斯 end-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public AjaxResult<RadarAnalyseVO> getTimeRangeAnalyseCount(SearchRadarAnalyseDTO

@GetMapping("/getChannelSort")
@ApiOperation("获得渠道排序")
public AjaxResult<RadarChannelSortVO> getChannelSort(@RequestParam("radarId") Long radarId) {
return AjaxResult.success(radarClickRecordService.getChannelSort(radarId));
public AjaxResult<RadarChannelSortVO> getChannelSort(@RequestParam("radarId") Long radarId, @RequestParam("beginTime") String beginTime, @RequestParam("endTime") String endTime) {
return AjaxResult.success(radarClickRecordService.getChannelSort(radarId, beginTime, endTime));
}


Expand Down
71 changes: 44 additions & 27 deletions easyink-admin/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ ruoyi:
- /getPublicKey
- /url
- /wecom/transferData/**
- /actuator/**


# 开发环境配置
Expand Down Expand Up @@ -423,7 +424,33 @@ wecome:
- /wecom/chat/collection/addCollection
- /wecom/chat/collection/cancleCollection
- /wecom/chat/collection/list
needCustomTokenUrl:
needContactTokenUrl:
- /user/create
- /user/update
- /user/delete
- /user/batchdelete
- /department/create
- /department/update
- /department/delete
- /corp/get_join_qrcode
fileUplodUrl:
- /media/upload
- /media/uploadimg
- /media/upload_attachment
needChatTokenUrl:
- /msgaudit/get_permit_user_list
- /msgaudit/check_single_agree
- /msgaudit/check_room_agree
- /msgaudit/groupchat/get
# V1.36.0版本后,企微官方限制,客户联系Token不再使用,调用API凭证转到自建/代开发应用Token
thirdAppUrl:
- /user/getuserinfo
- /get_jsapi_ticket
- /ticket/get
- /agent/list
- /message/send
- /agent/get
- /agent/set
- /externalcontact/get_follow_user_list
- /externalcontact/add_contact_way
- /externalcontact/update_contact_way
Expand Down Expand Up @@ -462,32 +489,6 @@ wecome:
- /externalcontact/groupchat/update_join_way
- /externalcontact/groupchat/del_join_way
- /externalcontact/unionid_to_external_userid
needContactTokenUrl:
- /user/create
- /user/update
- /user/delete
- /user/batchdelete
- /department/create
- /department/update
- /department/delete
- /corp/get_join_qrcode
fileUplodUrl:
- /media/upload
- /media/uploadimg
- /media/upload_attachment
needChatTokenUrl:
- /msgaudit/get_permit_user_list
- /msgaudit/check_single_agree
- /msgaudit/check_room_agree
- /msgaudit/groupchat/get
thirdAppUrl:
- /user/getuserinfo
- /get_jsapi_ticket
- /ticket/get
- /agent/list
- /message/send
- /agent/get
- /agent/set
needErrcodeUrl: # 如果有错误码需要单独业务处理,不抛出异常的接口
- /externalcontact/get_group_msg_result
- /externalcontact/del_corp_tag
Expand Down Expand Up @@ -566,3 +567,19 @@ thread-pool-prop:
corePoolSize: ${THREAD_POOL_SEND_CALLBACK_CORE_SIZE:5}
maxPoolSize: ${THREAD_POOL_SEND_CALLBACK_MAX_SIZE:5}

# prometheus配置
management:
endpoints:
web:
exposure:
include: '*'
metrics:
tags:
application: ${spring.application.name}
export:
prometheus:
pushgateway:
enabled: false
base-url: #[*]
push-rate: 15s
job: ${spring.application.name}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public class WeConstans {


/**
* 获取外部联系人相关 token
* 获取内部联系人相关 token
*/
public static final String WE_CONTACT_ACCESS_TOKEN = "we_contact_access_token";
/**
Expand Down Expand Up @@ -738,9 +738,10 @@ public static String getWeActualGroupCodeKey(String actualId) {


/**
* 客户群标签最大创建数量(默认值3000)
* 客户群标签最大创建数量(默认值10000)
* V1.36.0版本 企微官方调整,由3000 => 10000
*/
public static final Integer DEFAULT_WE_GROUP_TAG_CATEGORY_SIZE = 3000;
public static final Integer DEFAULT_WE_GROUP_TAG_CATEGORY_SIZE = 10000;

/**
* 成员类型:1 企业成员
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ public String getAgentId() {
@TableField("corp_account")
private String corpAccount;

@ApiModelProperty("客户联系密钥")
@TableField("custom_secret")
private String customSecret;

@ApiModelProperty("应用回调aesKey")
@TableField("encoding_aes_key")
private String encodingAesKey;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.easyink.common.exception.wecom;

import com.easyink.common.enums.WeExceptionTip;

/**
* @description: 企业微信相关异常类
* @author admin
Expand All @@ -22,6 +24,16 @@ public WeComException(Integer code, String message) {
this.message = message;
}

/**
* 根据code获取异常提示语信息
*
* @param code 企微返回的errcode
*/
public WeComException(Integer code) {
this.code = code;
this.message = WeExceptionTip.getTipMsg(code);
}

@Override
public String getMessage() {
return message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private void getTransferResult(String corpId, List<WeCustomerTransferRecord> sub
}
// 获取企业详情
WeCorpAccount corpAccount = weCorpAccountService.findValidWeCorpAccount(corpId);
if (null == corpAccount || StringUtils.isAnyBlank(corpAccount.getAgentId(), corpAccount.getCustomSecret())) {
if (null == corpAccount || StringUtils.isAnyBlank(corpAccount.getAgentId())) {
log.error("[TransferResultTask]查询客户接替状态异常:获取企业配置异常,corpId:{}", corpId);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ public class WeEmpleCodeAnalyse {
@ApiModelProperty(value = "1:新增,0:流失")
@TableField("type")
private Boolean type;

@ApiModelProperty(value = "添加时间(冗余字段),用于获客链接客户维度显示,格式YYYY-MM-DD HH:MM:SS")
@TableField("add_time")
private Date addTime;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class FollowInfo {
/**
* 该成员对此客户备注的企业名称
*/
private String remark_company;
private String remark_corp_name;
/**
* 该成员对此客户备注的手机号码
*/
Expand Down Expand Up @@ -110,10 +110,10 @@ public String getDescription() {
}

public String getRemark_company() {
if (remark_company == null) {
if (remark_corp_name == null) {
return StringUtils.EMPTY;
}
return remark_company;
return remark_corp_name;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@ public class TransferResignedUserListDTO extends BaseEntity {
@ApiModelProperty(value = "离职是否分配(1:已分配;0:未分配)", required = true)
private Integer isAllocate;

@ApiModelProperty("开始行数")
private Integer startNum;

@ApiModelProperty("查询行数")
private Integer limit;

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.easyink.wecom.domain.vo.statistics;

import cn.hutool.core.util.StrUtil;
import com.easyink.common.annotation.Excel;
import com.easyink.common.constant.WeConstans;
import com.easyink.common.utils.StringUtils;
import com.easyink.wecom.domain.vo.UserBaseVO;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
Expand Down Expand Up @@ -191,6 +194,18 @@ public String getEffectiveCommunicationRate() {
.toPlainString();
}

/**
* 获取平均首次回复时长
*
* @return 平均首次回复时长
*/
public String getAverageFirstReplyDuration() {
if (averageFirstReplyDuration == null) {
return WeConstans.ZERO;
}
return averageFirstReplyDuration;
}

/**
* 绑定导出数据
* 导出框架不能直接使用get方法获取属性值
Expand All @@ -200,7 +215,7 @@ public void bindExportData(){
replyRate = getReplyRate() + "%";
customerPositiveCommentsRate = getCustomerPositiveCommentsRate() + "%";
averageChatTotal = getAverageChatTotal();
averageFirstReplyDuration += "分钟";
averageFirstReplyDuration = getAverageFirstReplyDuration() + "分钟";
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.easyink.wecom.factory.impl.tag;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.easyink.common.constant.Constants;
import com.easyink.wecom.domain.WeTag;
import com.easyink.wecom.domain.vo.WxCpXmlMessageVO;
import com.easyink.wecom.factory.WeEventStrategy;
Expand Down Expand Up @@ -46,10 +47,11 @@ public void eventHandle(WxCpXmlMessageVO message) {
switch (message.getTagType()) {
case tagGroup:
weTagGroupService.deleteTagGroup(message.getTagId(), message.getToUserName());
// 获取标签组下的所有标签ID
// 获取标签组下的所有状态正常的标签ID
List<WeTag> weTags = weTagService.list(new LambdaQueryWrapper<WeTag>().select(WeTag::getTagId)
.eq(WeTag::getCorpId, message.getToUserName())
.eq(WeTag::getGroupId, message.getTagId()));
.eq(WeTag::getGroupId, message.getTagId())
.eq(WeTag::getStatus, Constants.NORMAL_CODE));
if (CollectionUtils.isEmpty(weTags)) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.easyink.common.utils.spring.SpringUtils;
import com.easyink.wecom.domain.dto.WeResultDTO;
import com.easyink.wecom.service.WeAccessTokenService;
import com.easyink.wecom.service.WeCorpAccountService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.context.annotation.Lazy;
Expand All @@ -38,12 +39,14 @@ public class WeAccessTokenInterceptor implements Interceptor<Object> {
private final WeComeConfig weComeConfig;
private final ForestConfiguration forestConfiguration;
private final String urlPrefix;
private final WeCorpAccountService weCorpAccountService;

@Lazy
public WeAccessTokenInterceptor() {
weComeConfig = SpringUtils.getBean(WeComeConfig.class);
weAccessTokenService = SpringUtils.getBean(WeAccessTokenService.class);
forestConfiguration = SpringUtils.getBean(ForestConfiguration.class);
weCorpAccountService = SpringUtils.getBean(WeCorpAccountService.class);
String weComServerUrl = String.valueOf(forestConfiguration.getVariableValue(WeConstans.WECOM_SERVER_URL));
String weComePrefix = String.valueOf(forestConfiguration.getVariableValue(WeConstans.WECOM_PREFIX));
this.urlPrefix = weComServerUrl + weComePrefix;
Expand Down Expand Up @@ -79,10 +82,11 @@ public boolean beforeExecute(ForestRequest request) {
//内部应用token
String agentId = StrUtil.isEmpty(request.getHeaderValue(WeConstans.THIRD_APP_PARAM_TIP)) ?
(String) request.getQuery(WeConstans.THIRD_APP_PARAM_TIP) : request.getHeaderValue(WeConstans.THIRD_APP_PARAM_TIP);
// V1.36.0,企微调整,去除了客户联系token,转为使用内部应用token,如果从请求头或Query参数中未获取到应用id,则根据corpId获取
if (StringUtils.isBlank(agentId)) {
agentId = weCorpAccountService.getAgentId(corpid);
}
token = weAccessTokenService.findInternalAppAccessToken(agentId, corpid);
} else if (PatternMatchUtils.simpleMatch(weComeConfig.getNeedCustomTokenUrl(), uri)) {
//客服联系token
token = weAccessTokenService.findCustomAccessToken(corpid);
} else {
token = weAccessTokenService.findCommonAccessToken(corpid);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,5 @@ public interface WeUserCustomerMessageStatisticsMapper extends BaseMapper<WeUser
* @return {@link UserServiceTimeDTO}
*/
List<UserServiceTimeDTO> getFilterOfUser(@Param("corpId") String corpId, @Param("list") List<String> userIdList, @Param("beginTime") String beginTime, @Param("endTime") String endTime);

}

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.easyink.wecom.domain.dto.statistics.GoodCommitDTO;
import com.easyink.wecom.domain.dto.statistics.UserGoodReviewDTO;
import com.easyink.wecom.domain.dto.statistics.UserServiceDTO;
import org.apache.ibatis.annotations.Param;
import com.easyink.wecom.domain.entity.form.WeFormCustomerFeedback;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ public interface WeRadarClickRecordMapper extends BaseMapper<WeRadarClickRecord>
/**
* 查询雷达渠道点击数排序
*
* @param radarId
* @return
* @param radarId 雷达ID
* @param beginTime 开始时间,格式为YYYY-MM-DD
* @param endTime 结束时间,格式为YYYY-MM-DD
* @return {@link RadarChannelSortVO}
*/
List<RadarChannelSortVO> selectChannelSort(@Param("radarId") Long radarId);
List<RadarChannelSortVO> selectChannelSort(@Param("radarId") Long radarId, @Param("beginTime") String beginTime, @Param("endTime") String endTime);

/**
* 获得客户点击记录
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ public interface WeAccessTokenService {
*/
String findContactAccessToken(String corpId);

/**
* 获取客户联系凭证
*
* @return AccessToken
*/
String findCustomAccessToken(String corpId);

/**
* 获取服务商凭证
*
Expand Down Expand Up @@ -54,6 +47,13 @@ public interface WeAccessTokenService {
*/
String find3rdAppCorpAuthAccessToken(String corpId);

/**
* 获取自建/代开发应用凭证
*
* @param agentId 自建/代开发应用ID
* @param corpId 企业ID
* @return AccessToken
*/
String findInternalAppAccessToken(String agentId, String corpId);


Expand Down
Loading

0 comments on commit 4f4d0bb

Please sign in to comment.