mirror of
https://gitee.com/270580156/weiyu.git
synced 2025-12-30 10:52:26 +00:00
Sync from bytedesk-private: update
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
</elementProp>
|
||||
</ThreadGroup>
|
||||
<hashTree>
|
||||
<CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Visitor Counter" enabled="true">
|
||||
<CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Visitor Counter">
|
||||
<stringProp name="CounterConfig.start">1</stringProp>
|
||||
<stringProp name="CounterConfig.end">10</stringProp>
|
||||
<stringProp name="CounterConfig.incr">1</stringProp>
|
||||
@@ -89,7 +89,7 @@
|
||||
</JSONPostProcessor>
|
||||
<hashTree/>
|
||||
</hashTree>
|
||||
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Request Thread" enabled="true">
|
||||
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Request Thread">
|
||||
<stringProp name="HTTPSampler.domain">${HOST}</stringProp>
|
||||
<stringProp name="HTTPSampler.port">${PORT}</stringProp>
|
||||
<stringProp name="HTTPSampler.protocol">http</stringProp>
|
||||
@@ -167,7 +167,7 @@
|
||||
<stringProp name="filename">./report/multiple_visitors_results.jtl</stringProp>
|
||||
</ResultCollector>
|
||||
<hashTree/>
|
||||
<ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="Aggregate Report" enabled="true">
|
||||
<ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="Aggregate Report">
|
||||
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
||||
<objProp>
|
||||
<name>saveConfig</name>
|
||||
@@ -204,7 +204,7 @@
|
||||
<stringProp name="filename">./report/multiple_visitors_aggregate.jtl</stringProp>
|
||||
</ResultCollector>
|
||||
<hashTree/>
|
||||
<ResultCollector guiclass="GraphVisualizer" testclass="ResultCollector" testname="Graph Results" enabled="true">
|
||||
<ResultCollector guiclass="GraphVisualizer" testclass="ResultCollector" testname="Graph Results">
|
||||
<boolProp name="ResultCollector.error_logging">false</boolProp>
|
||||
<objProp>
|
||||
<name>saveConfig</name>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: jackning 270580156@qq.com
|
||||
* @Date: 2024-01-29 16:21:24
|
||||
* @LastEditors: jackning 270580156@qq.com
|
||||
* @LastEditTime: 2024-12-20 11:46:15
|
||||
* @LastEditTime: 2024-12-25 11:41:02
|
||||
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
|
||||
* Please be aware of the BSL license restrictions before installing Bytedesk IM –
|
||||
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
|
||||
@@ -70,11 +70,14 @@ public class VisitorEntity extends BaseEntity {
|
||||
private VisitorDevice device;
|
||||
|
||||
// used for agent notation
|
||||
private String mobile;
|
||||
@Builder.Default
|
||||
private String mobile = BytedeskConsts.EMPTY_STRING;
|
||||
|
||||
private String email;
|
||||
@Builder.Default
|
||||
private String email = BytedeskConsts.EMPTY_STRING;
|
||||
|
||||
private String note;
|
||||
@Builder.Default
|
||||
private String note = BytedeskConsts.EMPTY_STRING;
|
||||
|
||||
@Builder.Default
|
||||
private String client = ClientEnum.WEB.name();
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* @Author: jackning 270580156@qq.com
|
||||
* @Date: 2024-12-25 11:49:50
|
||||
* @LastEditors: jackning 270580156@qq.com
|
||||
* @LastEditTime: 2024-12-25 11:52:28
|
||||
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
|
||||
* Please be aware of the BSL license restrictions before installing Bytedesk IM –
|
||||
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
|
||||
* 仅支持企业内部员工自用,严禁私自用于销售、二次销售或者部署SaaS方式销售
|
||||
* Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE
|
||||
* contact: 270580156@qq.com
|
||||
* 联系:270580156@qq.com
|
||||
* Copyright (c) 2024 by bytedesk.com, All Rights Reserved.
|
||||
*/
|
||||
package com.bytedesk.service.visitor;
|
||||
|
||||
import org.modelmapper.ModelMapper;
|
||||
import org.modelmapper.PropertyMap;
|
||||
|
||||
public class VisitorMapper {
|
||||
|
||||
private final ModelMapper modelMapper;
|
||||
|
||||
public VisitorMapper() {
|
||||
this.modelMapper = new ModelMapper();
|
||||
configureMappings();
|
||||
}
|
||||
|
||||
// 创建一个自定义的 PropertyMap,在映射过程中检查源对象的字段是否为 null,如果是,则使用目标对象的默认值。
|
||||
private void configureMappings() {
|
||||
modelMapper.addMappings(new PropertyMap<VisitorRequest, VisitorEntity>() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
// 如果 visitorRequest 的字段为 null,则使用 visitorEntity 的默认值
|
||||
// using(ctx -> ctx.getSource() != null ? ctx.getSource() : ((VisitorEntity) ctx.getDestination()).getDefaultValue())
|
||||
// .map(source.getNickname(), destination.getNickname());
|
||||
|
||||
// using(ctx -> ctx.getSource() != null ? ctx.getSource() : ((VisitorEntity) ctx.getDestination()).getDefaultAvatar())
|
||||
// .map(source.getAvatar(), destination.getAvatar());
|
||||
|
||||
// 继续为其他字段添加类似的映射
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public VisitorEntity map(VisitorRequest visitorRequest) {
|
||||
return modelMapper.map(visitorRequest, VisitorEntity.class);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
package com.bytedesk.service.visitor;
|
||||
|
||||
import com.bytedesk.core.base.BaseRequest;
|
||||
import com.bytedesk.core.constant.BytedeskConsts;
|
||||
import com.bytedesk.core.enums.ClientEnum;
|
||||
import com.bytedesk.core.enums.LanguageEnum;
|
||||
import com.bytedesk.core.thread.ThreadTypeEnum;
|
||||
@@ -80,7 +81,8 @@ public class VisitorRequest extends BaseRequest {
|
||||
private String status = VisitorStatusEnum.ONLINE.name();
|
||||
|
||||
// 自定义参数,从URL传入,使用json格式传入,例如:{"key1":"value1","key2":"value2"}
|
||||
private String extra;
|
||||
@Builder.Default
|
||||
private String extra = BytedeskConsts.EMPTY_JSON_STRING;
|
||||
|
||||
// wechat mp extra
|
||||
private String threadExtra;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: jackning 270580156@qq.com
|
||||
* @Date: 2024-01-29 16:21:24
|
||||
* @LastEditors: jackning 270580156@qq.com
|
||||
* @LastEditTime: 2024-12-24 15:30:49
|
||||
* @LastEditTime: 2024-12-25 11:47:16
|
||||
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
|
||||
* Please be aware of the BSL license restrictions before installing Bytedesk IM –
|
||||
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
|
||||
@@ -31,6 +31,7 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import com.bytedesk.core.base.BaseRestService;
|
||||
import com.bytedesk.core.constant.AvatarConsts;
|
||||
import com.bytedesk.core.constant.BytedeskConsts;
|
||||
import com.bytedesk.core.enums.ClientEnum;
|
||||
// import com.bytedesk.core.ip.IpService;
|
||||
// import com.bytedesk.core.ip.IpUtils;
|
||||
@@ -53,8 +54,6 @@ public class VisitorRestService extends BaseRestService<VisitorEntity, VisitorRe
|
||||
|
||||
private final UidUtils uidUtils;
|
||||
|
||||
// private final IpService ipService;
|
||||
|
||||
private final CsThreadCreationContext csThreadCreationContext;
|
||||
|
||||
@Override
|
||||
@@ -91,8 +90,9 @@ public class VisitorRestService extends BaseRestService<VisitorEntity, VisitorRe
|
||||
//
|
||||
log.info("visitorRequest {}", visitorRequest);
|
||||
visitor = modelMapper.map(visitorRequest, VisitorEntity.class);
|
||||
visitor.setClient(visitorRequest.getClient());
|
||||
visitor.setOrgUid(visitorRequest.getOrgUid());
|
||||
if (!StringUtils.hasText(visitorRequest.getExtra())) {
|
||||
visitor.setExtra(BytedeskConsts.EMPTY_JSON_STRING);
|
||||
}
|
||||
//
|
||||
VisitorDevice device = modelMapper.map(visitorRequest, VisitorDevice.class);
|
||||
visitor.setDevice(device);
|
||||
|
||||
@@ -33,8 +33,8 @@ public class QueueIntegrationTest {
|
||||
private TestRestTemplate restTemplate;
|
||||
|
||||
private static final String ORG_UID = "df_org_uid";
|
||||
private static final String AGENT_UID = "df_ag_uid";
|
||||
private static final String TYPE = "0";
|
||||
private static final String AGENT_UID = "df_ag_uid"; // df_ag_uid or df_wg_uid
|
||||
private static final String TYPE = "0";// 0: agent, 1: workgroup
|
||||
|
||||
@Test
|
||||
public void testVisitorFlowWithRealServer() {
|
||||
|
||||
Reference in New Issue
Block a user