Compare commits

...

3 Commits

@ -121,6 +121,19 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-loadbalancer</artifactId>
</dependency>
<dependency>
<groupId>com.vdurmont</groupId>
<artifactId>emoji-java</artifactId>
<version>4.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>

@ -163,6 +163,24 @@
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<!-- feign 依赖-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!--解决Did you forget to include spring-cloud-starter-loadbalancer?-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-loadbalancer</artifactId>
</dependency>
<dependency>
<groupId>com.vdurmont</groupId>
<artifactId>emoji-java</artifactId>
<version>4.0.0</version>
</dependency>
</dependencies>
<build>

@ -6,12 +6,14 @@ import org.ballcat.springsecurity.oauth2.server.resource.annotation.EnableOauth2
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* @author Hccake
*/
@EnableFeignClients
@EnableTransactionManagement
@EnableOauth2AuthorizationServer
@EnableOauth2ResourceServer

@ -14,6 +14,7 @@ import com.baiye.polling.QueueBalance;
import com.google.common.base.Splitter;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
import java.util.Set;
@ -87,17 +88,21 @@ public class AddFileFriendDataListener extends AnalysisEventListener<FileAddFrie
AddFriend friend;
for (FileAddFriendVO friendVO : cachedDataList) {
String pollingWechat = balance.chooseOne(saveAddFriendDTO.getTrumpetWechatList());
List<String> toList = Splitter.on
(StrPool.COMMA).trimResults().splitToList(friendVO.getFlagArrays());
friend = new AddFriend();
friend.setLabelIds(toList);
friend.setGreet(friendVO.getGreet());
friend.setTrumpetWechat(pollingWechat);
friend.setUserId(saveAddFriendDTO.getUserId());
friend.setTaskId(saveAddFriendDTO.getTaskId());
friend.setTargetWechat(friendVO.getTargetSource());
friend.setAddStatus(DefaultNumberConstants.ZERO_NUMBER);
list.add(friend);
if (StringUtils.isNotBlank(friendVO.getTargetSource())) {
if (StringUtils.isNotBlank(friendVO.getFlagArrays())) {
List<String> toList = Splitter.on
(StrPool.COMMA).trimResults().splitToList(friendVO.getFlagArrays());
friend.setLabelIds(toList);
}
friend.setGreet(friendVO.getGreet());
friend.setTrumpetWechat(pollingWechat);
friend.setUserId(saveAddFriendDTO.getUserId());
friend.setTaskId(saveAddFriendDTO.getTaskId());
friend.setTargetWechat(friendVO.getTargetSource());
friend.setAddStatus(DefaultNumberConstants.ZERO_NUMBER);
list.add(friend);
}
}
addFriendService.saveBatch(list);
log.info("存储数据库成功!");

@ -0,0 +1,104 @@
package com.baiye.listener;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.util.ListUtils;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.modules.scrm.dto.SaveComparisonDTO;
import com.baiye.modules.scrm.entity.ComparisonRecord;
import com.baiye.modules.scrm.service.ComparisonRecordService;
import com.baiye.modules.scrm.vo.ComparisonVO;
import com.baiye.util.AESUtils;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author Enzo
* @date : 2024/6/2
*/
@Slf4j
public class ComparisonAdditionalDataListener extends AnalysisEventListener<ComparisonVO> {
/**
* 5使100list 便
*/
private static final int BATCH_COUNT = 500;
/**
*
*/
private List<ComparisonVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
private final ComparisonRecordService comparisonRecordService;
private final SaveComparisonDTO saveComparisonDTO;
public ComparisonAdditionalDataListener(ComparisonRecordService comparisonRecordService, SaveComparisonDTO saveComparisonDTO) {
this.comparisonRecordService = comparisonRecordService;
this.saveComparisonDTO = saveComparisonDTO;
}
/**
*
*
* @param data one row value. Is is same as {@link AnalysisContext#readRowHolder()}
* @param context
*/
@Override
public void invoke(ComparisonVO data, AnalysisContext context) {
cachedDataList.add(data);
// 达到BATCH_COUNT了需要去存储一次数据库防止数据几万条数据在内存容易OOM
if (cachedDataList.size() >= BATCH_COUNT) {
updateDate();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
/**
*
*
* @param context
*/
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
// 这里也要保存数据,确保最后遗留的数据也存储到数据库
if (CollUtil.isNotEmpty(cachedDataList)) {
updateDate();
}
cachedDataList.clear();
log.info("所有数据解析完成!");
}
/**
*
*/
private void updateDate() {
Set<ComparisonRecord> set = Sets.newHashSet();
Map<String, String> resultMap =
cachedDataList.stream().filter(c -> StringUtils.isNotBlank(c.getRedBookId()) && StringUtils.isNotBlank
(c.getPhone()) && c.getPhone().length() == DefaultNumberConstants.ELEVEN_NUMBER)
.collect(Collectors.toMap(ComparisonVO::getRedBookId, ComparisonVO::getPhone));
List<ComparisonRecord> recordList = comparisonRecordService.queryByTaskAndRedBookId(saveComparisonDTO.getTaskId(), resultMap.keySet());
if (CollUtil.isNotEmpty(recordList)) {
for (ComparisonRecord record : recordList) {
String comparisonResult = resultMap.get(record.getRedBookId());
if (StringUtils.isNotBlank(comparisonResult)) {
record.setConversionTime(DateUtil.date());
record.setComparisonResult(AESUtils.encrypt(comparisonResult, "==marketing-scrm="));
set.add(record);
}
}
comparisonRecordService.updateBatchById(set);
}
log.info("数据解析成功!");
}
}

@ -0,0 +1,107 @@
package com.baiye.listener;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.StrPool;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.util.ListUtils;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.modules.scrm.dto.SaveAddFriendDTO;
import com.baiye.modules.scrm.dto.SaveComparisonDTO;
import com.baiye.modules.scrm.entity.AddFriend;
import com.baiye.modules.scrm.entity.ComparisonRecord;
import com.baiye.modules.scrm.service.AddFriendService;
import com.baiye.modules.scrm.service.ComparisonRecordService;
import com.baiye.modules.scrm.vo.ComparisonVO;
import com.baiye.modules.scrm.vo.FileAddFriendVO;
import com.baiye.polling.QueueBalance;
import com.google.common.base.Splitter;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
import java.util.Set;
/**
* @author Enzo
* @date : 2024/6/2
*/
@Slf4j
public class ComparisonRecordDataListener extends AnalysisEventListener<ComparisonVO> {
/**
* 5使100list 便
*/
private static final int BATCH_COUNT = 500;
/**
*
*/
private List<ComparisonVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
private final ComparisonRecordService comparisonRecordService;
private final SaveComparisonDTO saveComparisonDTO;
public ComparisonRecordDataListener(ComparisonRecordService comparisonRecordService, SaveComparisonDTO saveComparisonDTO) {
this.comparisonRecordService = comparisonRecordService;
this.saveComparisonDTO = saveComparisonDTO;
}
/**
*
*
* @param data one row value. Is is same as {@link AnalysisContext#readRowHolder()}
* @param context
*/
@Override
public void invoke(ComparisonVO data, AnalysisContext context) {
cachedDataList.add(data);
// 达到BATCH_COUNT了需要去存储一次数据库防止数据几万条数据在内存容易OOM
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
/**
*
*
* @param context
*/
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
// 这里也要保存数据,确保最后遗留的数据也存储到数据库
if (CollUtil.isNotEmpty(cachedDataList)) {
saveData();
}
cachedDataList.clear();
log.info("所有数据解析完成!");
}
/**
*
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
Set<ComparisonRecord> set = Sets.newHashSet();
// 随机添加微信
for (ComparisonVO vo : cachedDataList) {
ComparisonRecord record = new ComparisonRecord();
if (StringUtils.isNotBlank(vo.getRedBookId()) && StringUtils.isNotBlank(vo.getRedBookNo())){
record.setDateStr(vo.getDateStr());
record.setRedBookNo(vo.getRedBookNo());
record.setRedBookId(vo.getRedBookId());
record.setPhotograph(vo.getPhotograph());
record.setInstitution(vo.getInstitution());
record.setTaskId(saveComparisonDTO.getTaskId());
record.setUserId(saveComparisonDTO.getUserId());
set.add(record);
}
}
comparisonRecordService.saveBatch(set);
log.info("存储数据库成功!");
}
}

@ -0,0 +1,108 @@
package com.baiye.modules.customer.controller;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.modules.customer.entity.CustomerUserInfo;
import com.baiye.modules.customer.service.CustomerUserService;
import com.baiye.modules.scrm.dto.CustomerAddRobotDTO;
import com.baiye.modules.scrm.dto.CustomerUserInfoDTO;
import com.baiye.modules.scrm.qo.AccountQo;
import com.baiye.modules.scrm.qo.CustomerUserQo;
import com.baiye.modules.scrm.vo.CustomerUserInfoVO;
import com.baiye.modules.scrm.vo.WeChatAccountVO;
import com.baiye.result.BaseResultCode;
import com.baiye.result.R;
import com.baiye.security.util.SecurityUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.function.ServerResponse;
import java.util.List;
import java.util.Map;
/**
* @author Enzo
*/
@Tag(name = "客服相关接口")
@RestController
@RequestMapping("/customer/user")
@RequiredArgsConstructor
public class CustomerInfoController {
private final CustomerUserService customerUserService;
@Operation(summary = "保存客服账号")
@PostMapping("/create")
public R<Void> save(@RequestBody @Validated CustomerUserInfoDTO customerUserInfoDTO) {
Boolean saveCustomerInfo = customerUserService.saveCustomerInfo(customerUserInfoDTO, SecurityUtils.getCurrentUserId());
return saveCustomerInfo.equals(Boolean.TRUE) ? R.ok() : R.failed(BaseResultCode.UPDATE_DATABASE_ERROR);
}
@Operation(summary = "分页查询数据")
@GetMapping("/page")
public R<PageResult<CustomerUserInfoVO>> getCustomerPage(@Validated PageParam pageParam, CustomerUserQo qo) {
return R.ok(customerUserService.queryPage(pageParam, qo));
}
@Operation(summary = "获取客服详情")
@GetMapping("/detail")
public R<CustomerUserInfo> getDetail(@RequestParam Long id) {
return R.ok(customerUserService.getById(id));
}
@Operation(summary = "获取主次详情")
@GetMapping("listMasterDetailByCustomerId")
public R<Map<String, Object>> listMasterDetailByCustomerId(Long customerId) {
return R.ok(customerUserService.listMasterDetailByCustomerId(customerId));
}
@Operation(summary = "获取主账号")
@GetMapping("listRobotByCustomerId")
public List<WeChatAccountVO> listRobotBYCustomerId(Long customerId) {
return customerUserService.listRobotByCustomerId(customerId);
}
@Operation(summary = "添加主账号")
@PostMapping(value = "addMasterRobots")
public R<Boolean> batchAddMasterByRobots(@RequestBody CustomerAddRobotDTO addRobot) {
return R.ok(customerUserService.addMasterRobots(addRobot));
}
@Operation(summary = "获取次级账号")
@GetMapping(value = "acquisition/secondary")
public R<List<WeChatAccountVO>> acquisitionSecondary(Long customerId) {
return R.ok(customerUserService.acquisitionSecondary(customerId));
}
@DeleteMapping("/{id}")
@Operation(summary = "删除客服")
public R<String> deleteByUserId(@PathVariable("id") Long customerId) {
return Boolean.TRUE.equals(customerUserService.del(customerId)) ? R.ok() : R.failed(BaseResultCode.UPDATE_DATABASE_ERROR, "删除失败");
}
/**
*
*/
@Operation(summary = "批量移除主账号、微信")
@PostMapping(value = "delDeviceJoinCustomer")
public R<Boolean> batchRemoveMasterByRobots(@RequestBody CustomerAddRobotDTO addRobot) {
return R.ok(customerUserService.batchRemoveMasterByRobots(addRobot));
}
}

@ -0,0 +1,40 @@
package com.baiye.modules.customer.controller;
import com.baiye.modules.customer.service.CustomerVisibleRangeService;
import com.baiye.modules.scrm.dto.CustomerVisibleRangeDTO;
import com.baiye.result.R;
import com.baiye.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.function.ServerResponse;
import javax.annotation.Resource;
/**
*
* </p>
*
* @author hans
* @since 2023-02-27
*/
@Tag(name = "次级账号配置")
@RestController
@RequestMapping("/customer/visible/range")
@RequiredArgsConstructor
public class CustomerVisibleRangeController {
private final CustomerVisibleRangeService customerVisibleRangeService;
/**
*
*/
@PostMapping(value = "/save")
public R<Boolean> save(@RequestBody CustomerVisibleRangeDTO customerVisibleRangeVO) {
return R.ok(customerVisibleRangeService.createVisibleRange(customerVisibleRangeVO));
}
}

@ -0,0 +1,65 @@
package com.baiye.modules.customer.controller;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.modules.customer.service.CustomerRobotWxLabelService;
import com.baiye.modules.scrm.dto.CustomerWxLabelDTO;
import com.baiye.modules.scrm.qo.AccountQo;
import com.baiye.modules.scrm.qo.RobotWxLabelQO;
import com.baiye.modules.scrm.vo.CustomerWxLabelVO;
import com.baiye.modules.scrm.vo.WeChatAccountVO;
import com.baiye.result.BaseResultCode;
import com.baiye.result.R;
import com.baiye.security.util.SecurityUtils;
import com.baiye.validation.group.CreateGroup;
import com.baiye.validation.group.UpdateGroup;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Set;
/**
* @author Enzo
*/
@Tag(name = "标签")
@RestController
@RequestMapping("/customer/label")
@RequiredArgsConstructor
public class CustomerWxLabelController {
private final CustomerRobotWxLabelService customerRobotWxLabelService;
@GetMapping("/account/page")
@Operation(summary = "分页查询")
public R<PageResult<WeChatAccountVO>> getClueRecordPage(@Validated PageParam pageParam, AccountQo qo) {
qo.setUserId(SecurityUtils.getCurrentUserId());
return R.ok(customerRobotWxLabelService.queryAccountPage(pageParam, qo));
}
@GetMapping("/page")
@Operation(summary = "分页查询")
public R<PageResult<CustomerWxLabelVO>> getClueRecordPage(@Validated PageParam pageParam, RobotWxLabelQO qo) {
qo.setUserId(SecurityUtils.getCurrentUserId());
return R.ok(customerRobotWxLabelService.queryPage(pageParam, qo));
}
@PostMapping("/add")
@Operation(summary = "创建标签", description = "创建标签")
public R<Boolean> save(@Validated({CreateGroup.class}) @RequestBody CustomerWxLabelDTO labelDTO) {
return R.ok(customerRobotWxLabelService.add(labelDTO, SecurityUtils.getCurrentUserId()));
}
@DeleteMapping("/del/{id}")
@Operation(summary = "删除标签")
public R<String> deleteByUserId(@PathVariable("id") Long id) {
return Boolean.TRUE.equals(customerRobotWxLabelService.del(id)) ? R.ok() : R.failed(BaseResultCode.UPDATE_DATABASE_ERROR, "删除失败");
}
}

@ -0,0 +1,24 @@
package com.baiye.modules.customer.converter;
import com.baiye.modules.customer.entity.CustomerRobotWxLabel;
import com.baiye.modules.scrm.vo.CustomerWxLabelVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* @author Enzo
* @date : 2024/7/26
*/
@Mapper
public interface CustomerRobotWxLabelConverter {
CustomerRobotWxLabelConverter INSTANCE = Mappers.getMapper(CustomerRobotWxLabelConverter.class);
/**
* vo
*
* @param userInfo
* @return
*/
CustomerWxLabelVO entityToVo(CustomerRobotWxLabel userInfo);
}

@ -0,0 +1,24 @@
package com.baiye.modules.customer.converter;
import com.baiye.modules.customer.entity.CustomerUserInfo;
import com.baiye.modules.scrm.vo.CustomerUserInfoVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* @author Enzo
* @date : 2024/3/28
*/
@Mapper
public interface CustomerUserConverter {
CustomerUserConverter INSTANCE = Mappers.getMapper(CustomerUserConverter.class);
/**
* vo
*
* @param userInfo
* @return
*/
CustomerUserInfoVO entityToVo(CustomerUserInfo userInfo);
}

@ -0,0 +1,65 @@
package com.baiye.modules.customer.entity;
import com.baiye.entity.BaseEntity;
import com.baiye.entity.LogicDeletedBaseEntity;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotNull;
/**
* @author Enzo
* @date : 2024/7/8
*/
@Setter
@Getter
@TableName(value = "tb_customer_join_robot", autoResultMap = true)
public class CustomerJoinRobot extends LogicDeletedBaseEntity {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
@Schema(title = "ID")
@NotNull(message = "ID不能为空", groups = { UpdateGroup.class })
private Long id;
/**
* ID
*/
@TableField("customer_id")
private Long customerId;
/**
*
*/
@TableField("customer_account")
private String customerAccount;
/**
* ID
*/
@TableField("robot_id")
private Long robotId;
/**
* ID
*/
@TableField("robot_wx_id")
private String robotWxId;
/**
*
*/
@TableField("del_flag")
private Integer delFlag;
}

@ -0,0 +1,86 @@
package com.baiye.modules.customer.entity;
import com.baiye.entity.BaseEntity;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotNull;
/**
*
*
* </p>
*
* @author xiaoxx
* @since 2023-06-07
*/
@Setter
@Getter
@TableName(value = "tb_robot_wx_label",autoResultMap = true)
public class CustomerRobotWxLabel extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
@Schema(title = "ID")
@NotNull(message = "ID不能为空", groups = { UpdateGroup.class })
private Long id;
/**
* ID
*/
@TableField("user_id")
private Long userId;
/**
* ID
*/
@TableField("wechat_id")
private String wechatId;
/**
* 1-SCRM2-3-SCRM
*/
@TableField("label_type")
private Integer labelType;
/**
*
*/
@TableField("label_sync_wx")
private Integer labelSyncWx;
/**
* ID
*/
@TableField("label_id")
private Integer labelId;
/**
*
*/
@TableField("label_name")
private String labelName;
/**
*
*/
@TableField("label_num")
private Integer labelNum;
/**
* ID
*/
@TableField("label_wx_list")
private String labelWxList;
}

@ -0,0 +1,156 @@
package com.baiye.modules.customer.entity;
import com.baiye.entity.BaseEntity;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
/**
* @author Enzo
* @date : 2024/7/5
*/
@Setter
@Getter
@TableName(value = "tb_customer_info", autoResultMap = true)
public class CustomerUserInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
@Schema(title = "ID")
@NotNull(message = "ID不能为空", groups = {UpdateGroup.class})
private Long id;
/**
* id
*/
@TableField("user_id")
private Long userId;
/**
*
*/
@NotBlank(message = "账号未指定")
@TableField("account")
private String account;
/**
*
*/
@NotBlank(message = "昵称不能为空")
@TableField("nick")
private String nick;
/**
*
*/
@NotBlank(message = "密码不能为空")
@TableField("pwd")
private String pwd;
/**
* ID
*/
@TableField("bind_wx_id")
private String bindWxId;
/**
* OPENID
*/
@TableField("open_id")
private String openId;
/**
*
*/
@TableField("wx_nickname")
private String wxNickname;
/**
* headimgurl 04664961320640*640
*/
@TableField("wx_head_img_url")
private String wxHeadImgUrl;
/**
*
*/
@TableField("is_enable")
private Boolean isEnable = Boolean.TRUE;
/**
*
*/
@TableField("robot_num")
private Integer robotNum;
/**
*
*/
@TableField("robot_sub_num")
private Integer robotSubNum;
/**
* 线
*/
@TableField("on_line")
private Boolean onLine;
/**
*
*/
@TableField("private_msg_enable")
private Boolean privateMsgEnable;
/**
*
*/
@TableField("support_customer_enable")
private Boolean supportCustomerEnable;
/**
*
*/
@TableField("return_msg_num")
private Integer returnMsgNum;
/**
*
*/
@TableField("request_support_num")
private Integer requestSupportNum;
/**
*
*/
@TableField("was_request_support_num")
private Integer wasRequestSupportNum;
/**
*
*/
@TableField("average_response_time")
private BigDecimal averageResponseTime;
/**
* id
*/
@TableField(exist = false)
private List<Integer> robotIds;
/**
*
*/
@TableField(exist = false)
private Integer clientNum;
}

@ -0,0 +1,53 @@
package com.baiye.modules.customer.entity;
import com.baiye.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
/**
*
* </p>
*
* @author hans
* @since 2023-02-27
*/
@Setter
@Getter
@TableName(value = "tb_customer_visible_range", autoResultMap = true)
public class CustomerVisibleRange extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableField("user_id")
private Long customerId;
@TableField("user_id")
private Long userId;
@TableField("account")
private String account;
@TableField("wechat_id")
private String wechatId;
@TableField("friend_wx_id")
private String friendWxId;
@TableField("friend_wx_img")
private String friendWxImg;
@TableField("friend_wx_nick")
private String friendWxNick;
@TableField("friend_all_enable")
private Boolean friendAllEnable;
@TableField("group_all_enable")
private Boolean groupAllEnable;
}

@ -0,0 +1,21 @@
package com.baiye.modules.customer.feign;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author Enzo
* @date : 2024/7/9
* @since https://blog.csdn.net/u014635374/article/details/118338358
*/
@FeignClient(name = "customerFeign", url = "${feign.request.url}" + "/customer")
public interface CustomerInfoFeign {
/**
*
* @param account
*/
@GetMapping(value = "/query/account")
void getUsers(@RequestParam("account") String account);
}

@ -0,0 +1,52 @@
package com.baiye.modules.customer.feign;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author Enzo
* @date : 2024/7/12
*/
@FeignClient(name = "customerVisibleFeign", url = "${feign.request.url}" + "/customer/visible")
public interface CustomerVisibleFeign {
/**
*
*
* @param account
*/
@GetMapping(value = "/account")
void createNewDevice(@RequestParam("account") String account);
/**
*
*
* @param dtoAccount
*/
@GetMapping(value = "/add")
void addCustomer(@RequestParam("account") String dtoAccount);
/**
*
*
* @param account
* @param stringList
*/
@PostMapping(value = "/device")
void newDeviceConversation(@RequestParam("account") String account, @RequestParam("wxIds") List<String> stringList);
/**
*
*
* @param account
* @param wechatId
* @param friendWxIds
*/
@PostMapping(value = "/clear")
void clearCustomerVisibleRanges(@RequestParam("account") String account, @RequestParam("wechatId") String wechatId, @RequestParam("friendWxIds") List<String> friendWxIds);
}

@ -0,0 +1,87 @@
package com.baiye.modules.customer.mapper;
import cn.hutool.core.collection.CollUtil;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.customer.entity.CustomerJoinRobot;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Enzo
* @date : 2024/7/8
*/
@Mapper
public interface CustomerJoinRobotMapper extends ExtendMapper<CustomerJoinRobot> {
/**
* Id
*
* @param customerId
* @param number
* @return
*/
default List<CustomerJoinRobot> selectListByCustomerId(Long customerId, Integer number) {
return selectList(WrappersX.lambdaQueryX(CustomerJoinRobot.class).eq(CustomerJoinRobot::getCustomerId, customerId).eq(CustomerJoinRobot::getDelFlag, number));
}
/**
* ID
*
* @param customerId
* @param list
* @return
*/
default int deleteByCustomerId(Long customerId, List<Long> list) {
LambdaUpdateWrapper<CustomerJoinRobot> wrapper = WrappersX.lambdaUpdate(CustomerJoinRobot.class);
wrapper.eq((CustomerJoinRobot::getCustomerId), customerId);
if (CollUtil.isNotEmpty(list)){
wrapper.in(CustomerJoinRobot::getRobotId, list);
}
return this.delete(wrapper);
}
/**
* id
*
* @param customerId
* @param number
* @return
*/
default Long selectCountByCustomerId(Long customerId, Integer number) {
return this.selectCount(WrappersX.lambdaQueryX(CustomerJoinRobot.class).eq
(CustomerJoinRobot::getCustomerId, customerId).eq(CustomerJoinRobot::getDelFlag, number));
}
/**
*
*
* @param id
* @param robotIds
* @param number
* @return
*/
default Integer cancelCustomerIdByIdsIn(Long id, List<Long> robotIds, Integer number) {
LambdaUpdateWrapper<CustomerJoinRobot> wrapper = WrappersX.lambdaUpdate(CustomerJoinRobot.class);
wrapper.eq(CustomerJoinRobot::getCustomerId, id).in(CustomerJoinRobot::getRobotId, robotIds);
wrapper.set(CustomerJoinRobot::getDelFlag, number);
return update(null, wrapper);
}
/**
*
*
* @param customerId
* @param list
* @param number
* @return
*/
default Integer updateByCustomerIdAndRobotId(Long customerId, List<Long> list, Integer number) {
LambdaUpdateWrapper<CustomerJoinRobot> wrapper = WrappersX.lambdaUpdate(CustomerJoinRobot.class);
wrapper.set(CustomerJoinRobot::getDelFlag, number);
wrapper.eq(CustomerJoinRobot::getCustomerId, customerId).in(CustomerJoinRobot::getId, list);
return update(null, wrapper);
}
}

@ -0,0 +1,62 @@
package com.baiye.modules.customer.mapper;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.customer.converter.CustomerRobotWxLabelConverter;
import com.baiye.modules.customer.entity.CustomerRobotWxLabel;
import com.baiye.modules.scrm.qo.AccountQo;
import com.baiye.modules.scrm.qo.RobotWxLabelQO;
import com.baiye.modules.scrm.vo.CustomerWxLabelVO;
import com.baiye.modules.scrm.vo.WeChatAccountVO;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @author Enzo
* @date : 2024/7/8
*/
@Mapper
public interface CustomerRobotWxLabelMapper extends ExtendMapper<CustomerRobotWxLabel> {
PageResult<WeChatAccountVO> selectAccountPage(@Param("page") Page<WeChatAccountVO> weChatAccountVOPage, @Param("qo") AccountQo qo);
/**
*
*
* @param pageParam
* @param qo
* @return
*/
default PageResult<CustomerWxLabelVO> queryPage(PageParam pageParam, RobotWxLabelQO qo) {
IPage<CustomerRobotWxLabel> page = this.prodPage(pageParam);
LambdaQueryWrapperX<CustomerRobotWxLabel> wrapperX = WrappersX.lambdaQueryX(CustomerRobotWxLabel.class);
if (StringUtils.isNotBlank(qo.getStartTime()) && StringUtils.isNotBlank(qo.getEndTime())) {
wrapperX.between(CustomerRobotWxLabel::getCreateTime, qo.getStartTime(), qo.getEndTime());
}
wrapperX.eqIfPresent(CustomerRobotWxLabel::getUserId, qo.getUserId());
wrapperX.likeIfPresent(CustomerRobotWxLabel::getLabelName, qo.getLabelName());
wrapperX.likeIfPresent(CustomerRobotWxLabel::getWechatId, qo.getWxId()).orderByDesc(CustomerRobotWxLabel::getId);
this.selectPage(page, wrapperX);
IPage<CustomerWxLabelVO> voPage = page.convert(CustomerRobotWxLabelConverter.INSTANCE::entityToVo);
return new PageResult<>(voPage.getRecords(), voPage.getTotal());
}
default Long selectCountByWechatId(String wxId) {
LambdaUpdateWrapper<CustomerRobotWxLabel> wrapper = WrappersX.lambdaUpdate(CustomerRobotWxLabel.class);
wrapper.eq(CustomerRobotWxLabel::getWechatId, wxId);
return this.selectCount(wrapper);
}
default Long selectCountByLabelNameAndUserId(String labelName, Long userId) {
LambdaUpdateWrapper<CustomerRobotWxLabel> wrapper = WrappersX.lambdaUpdate(CustomerRobotWxLabel.class);
wrapper.eq(CustomerRobotWxLabel::getLabelName, labelName).eq(CustomerRobotWxLabel::getUserId, userId);
return this.selectCount(wrapper);
}
}

@ -0,0 +1,76 @@
package com.baiye.modules.customer.mapper;
import cn.hutool.core.collection.CollUtil;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.customer.converter.CustomerUserConverter;
import com.baiye.modules.customer.entity.CustomerUserInfo;
import com.baiye.modules.scrm.converter.AddFriendTaskConverter;
import com.baiye.modules.scrm.entity.AddFriendTask;
import com.baiye.modules.scrm.qo.CustomerUserQo;
import com.baiye.modules.scrm.vo.AddFriendTaskVO;
import com.baiye.modules.scrm.vo.CustomerUserInfoVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Enzo
* @date 2024-5-31
*/
@Mapper
public interface CustomerUserInfoMapper extends ExtendMapper<CustomerUserInfo> {
/**
*
*
* @param account
* @return
*/
default Long queryCountByAccount(String account) {
return this.selectCount(WrappersX.lambdaQueryX(CustomerUserInfo.class).eq(CustomerUserInfo::getAccount, account));
}
/**
*
*
* @param pageParam
* @param qo
* @return
*/
default PageResult<CustomerUserInfoVO> queryPage(PageParam pageParam, CustomerUserQo qo) {
IPage<CustomerUserInfo> page = this.prodPage(pageParam);
LambdaQueryWrapperX<CustomerUserInfo> wrapperX = WrappersX.lambdaQueryX(CustomerUserInfo.class);
if (StringUtils.isNotBlank(qo.getStartTime()) && StringUtils.isNotBlank(qo.getEndTime())) {
wrapperX.between(CustomerUserInfo::getCreateTime, qo.getStartTime(), qo.getEndTime());
}
wrapperX.eqIfPresent(CustomerUserInfo::getUserId, qo.getUserId());
wrapperX.likeIfPresent(CustomerUserInfo::getAccount, qo.getAccount()).orderByDesc(CustomerUserInfo::getId);
this.selectPage(page, wrapperX);
IPage<CustomerUserInfoVO> voPage = page.convert(CustomerUserConverter.INSTANCE::entityToVo);
return new PageResult<>(voPage.getRecords(), voPage.getTotal());
}
/**
*
*
* @param account
* @return
*/
default CustomerUserInfo queryByAccount(String account) {
List<CustomerUserInfo> customerUserInfos =
this.selectList(WrappersX.lambdaQueryX(CustomerUserInfo.class).eq(CustomerUserInfo::getAccount, account).orderByAsc(CustomerUserInfo::getId));
if (CollUtil.isNotEmpty(customerUserInfos)) {
return customerUserInfos.get(DefaultNumberConstants.ZERO_NUMBER);
}
return new CustomerUserInfo();
}
}

@ -0,0 +1,45 @@
package com.baiye.modules.customer.mapper;
import com.baiye.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.customer.entity.CustomerVisibleRange;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Enzo
* @date : 2024/7/8
*/
@Mapper
public interface CustomerVisibleRangeMapper extends ExtendMapper<CustomerVisibleRange> {
/**
*
*
* @param customerId
* @param wechatId
* @return
*/
default List<CustomerVisibleRange> listByAccountAndWeChatId(Long customerId, String wechatId) {
LambdaQueryWrapperX<CustomerVisibleRange> wrapperX = WrappersX.lambdaQueryX
(CustomerVisibleRange.class).eq(CustomerVisibleRange::getCustomerId, customerId).eq(CustomerVisibleRange::getWechatId, wechatId);
return selectList(wrapperX);
}
/**
*
* @param customerId
* @param removeList
* @return
*/
default Boolean removeByCustomerAndFriendWxId(Long customerId, List<String> removeList){
LambdaUpdateWrapper<CustomerVisibleRange> wrapperX = WrappersX.lambdaUpdate
(CustomerVisibleRange.class).eq(CustomerVisibleRange::getCustomerId, customerId).in(CustomerVisibleRange::getFriendWxId, removeList);
return SqlHelper.retBool(delete(wrapperX));
}
}

@ -0,0 +1,72 @@
package com.baiye.modules.customer.service;
import com.baiye.extend.mybatis.plus.service.ExtendService;
import com.baiye.modules.customer.entity.CustomerJoinRobot;
import com.baiye.modules.scrm.entity.WeChatAccount;
import com.baiye.modules.scrm.vo.WeChatAccountVO;
import java.util.List;
/**
* @author Enzo
* @date : 2024/7/8
*/
public interface CustomerJoinRobotService extends ExtendService<CustomerJoinRobot> {
/**
*
* @param id
* @param account
* @param values
* @return
*/
Boolean saveCustomerJoinRobot(Long id, String account, List<WeChatAccount> values);
/**
* ID
*
* @param customerId
* @param list
* @return
*/
Boolean deleteRobotInfoByCustomerId(Long customerId, List<Long> list);
/**
* ID
* @param customerId
* @return
*/
List<WeChatAccountVO> queryWeAccountByCustomer(Long customerId);
/**
*
* @param customerId
* @return
*/
Long getCountByCustomerId(Long customerId);
/**
*
* @param id
* @return
*/
List<CustomerJoinRobot> queryCustomerByCustomerId(Long id);
/**
*
* @param id
* @param robotIds
* @return
*/
Boolean cancelCustomerIdByIdsIn(Long id, List<Long> robotIds);
/**
*
*
* @param customerId
* @param list
* @param number
* @return
*/
Boolean updateByCustomerIdAndRobotId(Long customerId, List<Long> list, Integer number);
}

@ -0,0 +1,49 @@
package com.baiye.modules.customer.service;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.extend.mybatis.plus.service.ExtendService;
import com.baiye.modules.customer.entity.CustomerRobotWxLabel;
import com.baiye.modules.scrm.dto.CustomerWxLabelDTO;
import com.baiye.modules.scrm.qo.AccountQo;
import com.baiye.modules.scrm.qo.RobotWxLabelQO;
import com.baiye.modules.scrm.vo.CustomerWxLabelVO;
import com.baiye.modules.scrm.vo.WeChatAccountVO;
import java.util.Set;
/**
* @author Enzo
* @date : 2024/7/26
*/
public interface CustomerRobotWxLabelService extends ExtendService<CustomerRobotWxLabel> {
/**
*
* @param pageParam
* @param qo
* @return
*/
PageResult<WeChatAccountVO> queryAccountPage(PageParam pageParam, AccountQo qo);
/**
*
* @param pageParam
* @param qo
* @return
*/
PageResult<CustomerWxLabelVO> queryPage(PageParam pageParam, RobotWxLabelQO qo);
/**
*
*
* @param labelDTO
* @param userId
* @return
*/
Boolean add(CustomerWxLabelDTO labelDTO, Long userId);
Boolean del(Long id);
}

@ -0,0 +1,88 @@
package com.baiye.modules.customer.service;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.extend.mybatis.plus.service.ExtendService;
import com.baiye.modules.customer.entity.CustomerUserInfo;
import com.baiye.modules.scrm.dto.CustomerAddRobotDTO;
import com.baiye.modules.scrm.dto.CustomerUserInfoDTO;
import com.baiye.modules.scrm.qo.CustomerUserQo;
import com.baiye.modules.scrm.vo.CustomerUserInfoVO;
import com.baiye.modules.scrm.vo.WeChatAccountVO;
import java.util.List;
import java.util.Map;
/**
* @author Enzo
* @date : 2024/7/5
*/
public interface CustomerUserService extends ExtendService<CustomerUserInfo> {
/**
*
*
* @param userInfoDTO
* @param currentUserId
* @return
*/
Boolean saveCustomerInfo(CustomerUserInfoDTO userInfoDTO, Long currentUserId);
/**
*
*
* @param pageParam
* @param qo
* @return
*/
PageResult<CustomerUserInfoVO> queryPage(PageParam pageParam, CustomerUserQo qo);
/**
*
*
* @param customerId
* @return
*/
Map<String, Object> listMasterDetailByCustomerId(Long customerId);
/**
*
*
* @param addRobot
* @return
*/
Boolean addMasterRobots(CustomerAddRobotDTO addRobot);
/**
*
*
* @param addRobot
* @return
*/
Boolean batchRemoveMasterByRobots(CustomerAddRobotDTO addRobot);
/**
*
*
* @param customerId
* @return
*/
Boolean del(Long customerId);
/**
*
*
* @param customerId
* @return
*/
List<WeChatAccountVO> listRobotByCustomerId(Long customerId);
/**
*
* @param customerId
* @return
*/
List<WeChatAccountVO> acquisitionSecondary(Long customerId);
}

@ -0,0 +1,19 @@
package com.baiye.modules.customer.service;
import com.baiye.extend.mybatis.plus.service.ExtendService;
import com.baiye.modules.customer.entity.CustomerVisibleRange;
import com.baiye.modules.scrm.dto.CustomerVisibleRangeDTO;
/**
* @author Enzo
* @date : 2024/7/18
*/
public interface CustomerVisibleRangeService extends ExtendService<CustomerVisibleRange> {
/**
*
*
* @param customerVisibleRangeVO
* @return
*/
Boolean createVisibleRange(CustomerVisibleRangeDTO customerVisibleRangeVO );
}

@ -0,0 +1,98 @@
package com.baiye.modules.customer.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.extend.mybatis.plus.service.impl.ExtendServiceImpl;
import com.baiye.modules.customer.entity.CustomerJoinRobot;
import com.baiye.modules.customer.service.CustomerJoinRobotService;
import com.baiye.modules.customer.mapper.CustomerJoinRobotMapper;
import com.baiye.modules.scrm.entity.WeChatAccount;
import com.baiye.modules.scrm.service.WechatAccountService;
import com.baiye.modules.scrm.vo.WeChatAccountVO;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.google.common.collect.Lists;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author Enzo
* @date : 2024/7/8
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class CustomerJoinRobotServiceImpl extends
ExtendServiceImpl<CustomerJoinRobotMapper, CustomerJoinRobot> implements CustomerJoinRobotService {
private final WechatAccountService wechatAccountService;
@Override
public Boolean saveCustomerJoinRobot(Long customerId, String account, List<WeChatAccount> values) {
List<CustomerJoinRobot> listByCustomerId = baseMapper.selectListByCustomerId(customerId, DefaultNumberConstants.ONE_NUMBER);
// 同步群成员
Map<Long, CustomerJoinRobot> robotMap =
listByCustomerId.stream().distinct().collect(Collectors.toMap(CustomerJoinRobot::getRobotId, robot -> robot));
for (WeChatAccount chatAccount : values) {
CustomerJoinRobot joinRobot = new CustomerJoinRobot();
CustomerJoinRobot customerJoinRobot = robotMap.get(chatAccount.getId());
joinRobot.setCustomerId(customerId);
joinRobot.setCustomerAccount(account);
joinRobot.setRobotId(chatAccount.getId());
joinRobot.setRobotWxId(chatAccount.getWxId());
joinRobot.setDelFlag(DefaultNumberConstants.ONE_NUMBER);
if (ObjectUtil.isNotNull(customerJoinRobot)) {
joinRobot.setId(customerJoinRobot.getId());
baseMapper.updateById(joinRobot);
}
if (ObjectUtil.isNull(customerJoinRobot)
|| ObjectUtil.isNull(customerJoinRobot.getId())) {
baseMapper.insert(joinRobot);
}
}
return Boolean.TRUE;
}
@Override
public Boolean deleteRobotInfoByCustomerId(Long customerId, List<Long> list) {
return SqlHelper.retBool(baseMapper.deleteByCustomerId(customerId, list));
}
@Override
public List<WeChatAccountVO> queryWeAccountByCustomer(Long customerId) {
List<CustomerJoinRobot> customerJoinRobots = baseMapper.selectListByCustomerId(customerId, DefaultNumberConstants.ONE_NUMBER);
List<Long> accountIdList = customerJoinRobots.stream().map(CustomerJoinRobot::getRobotId).collect(Collectors.toList());
if (CollUtil.isNotEmpty(accountIdList)) {
return wechatAccountService.findByBatchId(accountIdList);
}
return Lists.newArrayList();
}
@Override
public Long getCountByCustomerId(Long customerId) {
return baseMapper.selectCountByCustomerId(customerId, DefaultNumberConstants.ONE_NUMBER);
}
@Override
public List<CustomerJoinRobot> queryCustomerByCustomerId(Long id) {
return baseMapper.selectListByCustomerId(id, DefaultNumberConstants.ONE_NUMBER);
}
@Override
public Boolean cancelCustomerIdByIdsIn(Long id, List<Long> robotIds) {
return SqlHelper.retBool(baseMapper.cancelCustomerIdByIdsIn(id, robotIds, DefaultNumberConstants.ZERO_NUMBER));
}
@Override
public Boolean updateByCustomerIdAndRobotId(Long customerId, List<Long> list, Integer number) {
return SqlHelper.retBool(baseMapper.updateByCustomerIdAndRobotId(customerId, list, number));
}
}

@ -0,0 +1,76 @@
package com.baiye.modules.customer.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.exception.BadRequestException;
import com.baiye.extend.mybatis.plus.service.impl.ExtendServiceImpl;
import com.baiye.modules.customer.entity.CustomerRobotWxLabel;
import com.baiye.modules.customer.mapper.CustomerRobotWxLabelMapper;
import com.baiye.modules.customer.service.CustomerRobotWxLabelService;
import com.baiye.modules.scrm.dto.CustomerWxLabelDTO;
import com.baiye.modules.scrm.qo.AccountQo;
import com.baiye.modules.scrm.qo.RobotWxLabelQO;
import com.baiye.modules.scrm.service.WeChatService;
import com.baiye.modules.scrm.vo.CustomerWxLabelVO;
import com.baiye.modules.scrm.vo.WeChatAccountVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author Enzo
* @date : 2024/7/8
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class CustomerRobotWxLabelServiceImpl extends
ExtendServiceImpl<CustomerRobotWxLabelMapper, CustomerRobotWxLabel> implements CustomerRobotWxLabelService {
private final WeChatService wechatService;
@Override
public PageResult<WeChatAccountVO> queryAccountPage(PageParam pageParam, AccountQo qo) {
return baseMapper.selectAccountPage(new Page<>(pageParam.getPage(), pageParam.getSize()), qo);
}
@Override
public PageResult<CustomerWxLabelVO> queryPage(PageParam pageParam, RobotWxLabelQO qo) {
return baseMapper.queryPage(pageParam, qo);
}
@Override
public Boolean add(CustomerWxLabelDTO labelDTO, Long userId) {
Long count = baseMapper.selectCountByLabelNameAndUserId(labelDTO.getLabelName(), userId);
if (count > DefaultNumberConstants.ZERO_NUMBER) {
throw new BadRequestException("该标签已存在 请勿重复填写");
}
Integer weChatLabel = wechatService.addWeChatLabel(labelDTO.getWechatId(), labelDTO.getLabelName());
if (weChatLabel > DefaultNumberConstants.ZERO_NUMBER) {
CustomerRobotWxLabel wxLabel = new CustomerRobotWxLabel();
BeanUtil.copyProperties(labelDTO, wxLabel);
wxLabel.setUserId(userId);
return save(wxLabel);
}
return Boolean.FALSE;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean del(Long id) {
CustomerRobotWxLabel customerRobotWxLabel = baseMapper.selectById(id);
if (ObjectUtil.isNotNull(customerRobotWxLabel)) {
wechatService.deleteWeChatLabel(customerRobotWxLabel.getWechatId(), Lists.newArrayList(customerRobotWxLabel.getLabelId()));
return removeById(id);
}
return Boolean.FALSE;
}
}

@ -0,0 +1,228 @@
package com.baiye.modules.customer.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baiye.constant.CacheConstant;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.exception.BadRequestException;
import com.baiye.extend.mybatis.plus.service.impl.ExtendServiceImpl;
import com.baiye.modules.customer.entity.CustomerJoinRobot;
import com.baiye.modules.customer.entity.CustomerUserInfo;
import com.baiye.modules.customer.feign.CustomerVisibleFeign;
import com.baiye.modules.customer.mapper.CustomerUserInfoMapper;
import com.baiye.modules.customer.service.CustomerJoinRobotService;
import com.baiye.modules.customer.service.CustomerUserService;
import com.baiye.modules.scrm.dto.CustomerAddRobotDTO;
import com.baiye.modules.scrm.dto.CustomerUserInfoDTO;
import com.baiye.modules.scrm.entity.WeChatAccount;
import com.baiye.modules.scrm.qo.CustomerUserQo;
import com.baiye.modules.scrm.service.WechatAccountService;
import com.baiye.modules.scrm.vo.CustomerUserInfoVO;
import com.baiye.modules.scrm.vo.WeChatAccountVO;
import com.baiye.security.util.SecurityUtils;
import com.baiye.util.RedisUtils;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author Enzo
* @date : 2024/7/5
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class CustomerUserServiceImpl extends ExtendServiceImpl<CustomerUserInfoMapper, CustomerUserInfo> implements CustomerUserService {
private final CustomerJoinRobotService customerJoinRobotService;
private final CustomerUserInfoMapper customerUserInfoMapper;
private final WechatAccountService wechatAccountService;
private final CustomerVisibleFeign customerVisibleFeign;
private final RedisUtils redisUtils;
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean saveCustomerInfo(CustomerUserInfoDTO userInfoDTO, Long currentUserId) {
userInfoDTO.setUserId(currentUserId);
String dtoAccount = userInfoDTO.getAccount();
List<Long> robotIds = userInfoDTO.getRobotIds();
CustomerUserInfo userInfo = customerUserInfoMapper.queryByAccount(userInfoDTO.getAccount().trim());
if (ObjectUtil.isNotNull(userInfo) && ObjectUtil.isNotNull(userInfo.getId()) && !userInfo.getId().equals(userInfoDTO.getId())) {
throw new BadRequestException("该账号已被使用!");
}
if (CollUtil.isNotEmpty(robotIds)) {
// 添加次级账号
List<WeChatAccount> weChatAccounts = wechatAccountService.listByIds(robotIds);
// 次账号添加
if (ObjectUtil.isNotNull(userInfoDTO.getId())) {
Set<Long> saveAccountId;
CustomerUserInfo customerUserInfo = baseMapper.selectById(userInfoDTO.getId());
if (ObjectUtil.isNotNull(customerUserInfo) && ObjectUtil.isNotNull(customerUserInfo.getId())) {
// 是主客服的设备
Set<Long> customerSet = weChatAccounts.stream().filter(k -> userInfo.getId().equals(k.getCustomerId())).map(WeChatAccount::getId).collect(Collectors.toSet());
// 去除主客服设备
saveAccountId = Sets.newHashSet(Sets.difference(Sets.newHashSet(robotIds), customerSet));
Set<Long> customerJoinRobots =
customerJoinRobotService.queryCustomerByCustomerId(customerUserInfo.getId()).stream().map(CustomerJoinRobot::getRobotId).collect(Collectors.toSet());
// 去除已经添加的设备
List<Long> saveList = Lists.newArrayList(Sets.difference(saveAccountId, customerJoinRobots));
// 取消的客服设备
List<Long> cancelList = Lists.newArrayList(Sets.difference(customerJoinRobots, saveAccountId));
// 给设备分配次客服
if (CollUtil.isNotEmpty(saveList)) {
List<WeChatAccount> accountList = weChatAccounts.stream().filter(k -> saveList.contains(k.getId())).collect(Collectors.toList());
// 同步数据
customerJoinRobotService.saveCustomerJoinRobot(customerUserInfo.getId(), customerUserInfo.getAccount(), accountList);
}
if (CollUtil.isNotEmpty(cancelList)) {
// 取消数据
customerJoinRobotService.cancelCustomerIdByIdsIn(customerUserInfo.getId(), cancelList);
}
userInfoDTO.setRobotSubNum(Integer.valueOf(customerJoinRobotService.getCountByCustomerId(userInfoDTO.getId()).toString()));
}
List<String> stringList = weChatAccounts.stream().map(WeChatAccount::getWxId).collect(Collectors.toList());
customerVisibleFeign.newDeviceConversation(dtoAccount, stringList);
}
}
String cacheKey = CacheConstant.APP_KEY_CUSTOMER.concat(CacheConstant.CUSTOMER_ACCOUNT).concat(userInfoDTO.getAccount());
redisUtils.del(cacheKey);
// 同步新增客服
customerVisibleFeign.addCustomer(dtoAccount);
// 创建新设备
customerVisibleFeign.createNewDevice(userInfoDTO.getAccount());
if (ObjectUtil.isNotNull(userInfo) && ObjectUtil.isNotNull(userInfo.getId())) {
BeanUtil.copyProperties(userInfoDTO, userInfo);
return SqlHelper.retBool(customerUserInfoMapper.updateById(userInfo));
}
CustomerUserInfo info = new CustomerUserInfo();
BeanUtil.copyProperties(userInfoDTO, info);
info.setIsEnable(Boolean.TRUE);
return SqlHelper.retBool(customerUserInfoMapper.insert(info));
}
@Override
public PageResult<CustomerUserInfoVO> queryPage(PageParam pageParam, CustomerUserQo qo) {
qo.setUserId(SecurityUtils.getCurrentUserId());
PageResult<CustomerUserInfoVO> pageResult = baseMapper.queryPage(pageParam, qo);
pageResult.getRecords().forEach(result -> {
List<WeChatAccountVO> byCustomerId = wechatAccountService.findByCustomerId(result.getId());
List<CustomerJoinRobot> joinRobots = customerJoinRobotService.queryCustomerByCustomerId(result.getId());
List<Long> robotCustomerList = joinRobots.stream().map(CustomerJoinRobot::getRobotId).collect(Collectors.toList());
robotCustomerList.addAll(byCustomerId.stream().map(WeChatAccountVO::getId).collect(Collectors.toList()));
result.setRobotNum(Integer.valueOf(wechatAccountService.getCountByCustomerId(result.getId()).toString()));
result.setRobotSubNum(Integer.valueOf(customerJoinRobotService.getCountByCustomerId(result.getId()).toString()));
result.setRobotIds(robotCustomerList);
});
return pageResult;
}
@Override
public Boolean addMasterRobots(CustomerAddRobotDTO addRobot) {
CustomerUserInfo userInfo = baseMapper.selectById(addRobot.getCustomerId());
if (ObjectUtil.isNotNull(userInfo)) {
// 设置设备主客服
Map<Boolean, List<CustomerAddRobotDTO.ChangePrimaryDTO>> listMap = addRobot.getData().stream().collect(
Collectors.groupingBy(CustomerAddRobotDTO.ChangePrimaryDTO::getIsPrimary));
for (Map.Entry<Boolean, List<CustomerAddRobotDTO.ChangePrimaryDTO>> booleanListEntry : listMap.entrySet()) {
List<Long> list = booleanListEntry.getValue().stream().map(CustomerAddRobotDTO.ChangePrimaryDTO::getId).collect(Collectors.toList());
if (CollUtil.isNotEmpty(list)) {
// 主改次
if (Boolean.FALSE.equals(booleanListEntry.getKey())) {
// 修改主动
wechatAccountService.cancelCustomerIdByRobotIds(addRobot.getCustomerId(), list);
List<WeChatAccount> weChatAccounts = wechatAccountService.listByIds(list);
customerJoinRobotService.saveCustomerJoinRobot(addRobot.getCustomerId(), userInfo.getAccount(), weChatAccounts);
}
if (Boolean.TRUE.equals(booleanListEntry.getKey())) {
// 取消所有次级
wechatAccountService.updateByCustomerIdAndIds(userInfo.getId(), list);
customerJoinRobotService.cancelCustomerIdByIdsIn(userInfo.getId(), list);
}
}
}
userInfo.setRobotNum(Integer.valueOf(wechatAccountService.getCountByCustomerId(userInfo.getId()).toString()));
userInfo.setRobotSubNum(Integer.valueOf(customerJoinRobotService.getCountByCustomerId(userInfo.getId()).toString()));
return this.updateById(userInfo);
}
return Boolean.FALSE;
}
@Override
public Boolean batchRemoveMasterByRobots(CustomerAddRobotDTO addRobot) {
Long customerId = addRobot.getCustomerId();
Integer removeEnable = addRobot.getRemoveEnable();
List<Long> robotIds = addRobot.getRobotIds();
CustomerUserInfo customerUserInfo = this.baseMapper.selectById(customerId);
if (ObjectUtil.isNotNull(customerUserInfo) && ObjectUtil.isNotNull(customerUserInfo.getId())) {
Boolean result = removeEnable == DefaultNumberConstants.TWO_NUMBER
? customerJoinRobotService.cancelCustomerIdByIdsIn(customerId, robotIds) :
wechatAccountService.cancelCustomerIdByRobotIds(customerId, robotIds);
log.info("================ the cancel result {} ================", result);
customerUserInfo.setRobotNum(Integer.valueOf(wechatAccountService.getCountByCustomerId(customerId).toString()));
customerUserInfo.setRobotSubNum(Integer.valueOf(customerJoinRobotService.getCountByCustomerId(customerId).toString()));
this.baseMapper.updateById(customerUserInfo);
// 设备更新同步
customerVisibleFeign.createNewDevice(customerUserInfo.getAccount());
return Boolean.TRUE;
}
return Boolean.FALSE;
}
@Override
public Boolean del(Long customerId) {
CustomerUserInfo customerUserInfo = baseMapper.selectById(customerId);
if (ObjectUtil.isNotNull(customerUserInfo) && ObjectUtil.isNotNull(customerUserInfo.getId())) {
List<WeChatAccountVO> robotInfos = wechatAccountService.findByCustomerId(customerId);
if (CollUtil.isNotEmpty(robotInfos)) {
throw new BadRequestException("当前客户下有存在机器人配置,请先删除");
}
// 极联删除次级账号客服
customerJoinRobotService.deleteRobotInfoByCustomerId(customerId, Lists.newArrayList());
// 设备更新同步
customerVisibleFeign.createNewDevice(customerUserInfo.getAccount());
return this.removeById(customerId);
}
return Boolean.FALSE;
}
@Override
public List<WeChatAccountVO> listRobotByCustomerId(Long customerId) {
return wechatAccountService.findByCustomerId(customerId);
}
@Override
public List<WeChatAccountVO> acquisitionSecondary(Long customerId) {
return customerJoinRobotService.queryWeAccountByCustomer(customerId);
}
@Override
public Map<String, Object> listMasterDetailByCustomerId(Long customerId) {
List<WeChatAccountVO> masterCustomerList = wechatAccountService.findByCustomerId(customerId);
List<WeChatAccountVO> subCustomerList = customerJoinRobotService.queryWeAccountByCustomer(customerId);
return ImmutableMap.of("masterCustomerList", masterCustomerList, "subCustomerList", subCustomerList);
}
}

@ -0,0 +1,96 @@
package com.baiye.modules.customer.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.extend.mybatis.plus.service.impl.ExtendServiceImpl;
import com.baiye.modules.customer.entity.CustomerUserInfo;
import com.baiye.modules.customer.entity.CustomerVisibleRange;
import com.baiye.modules.customer.feign.CustomerVisibleFeign;
import com.baiye.modules.customer.mapper.CustomerVisibleRangeMapper;
import com.baiye.modules.customer.service.CustomerUserService;
import com.baiye.modules.customer.service.CustomerVisibleRangeService;
import com.baiye.modules.scrm.dto.CustomerVisibleRangeDTO;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author Enzo
* @date : 2024/7/18
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class CustomerVisibleRangeServiceImpl extends
ExtendServiceImpl<CustomerVisibleRangeMapper, CustomerVisibleRange> implements CustomerVisibleRangeService {
private final CustomerUserService customerUserService;
private final CustomerVisibleFeign customerVisibleFeign;
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean createVisibleRange(CustomerVisibleRangeDTO customerVisibleRangeVO) {
List<CustomerVisibleRange> arrayList = Lists.newArrayList();
CustomerUserInfo userInfo = customerUserService.getById(customerVisibleRangeVO.getCustomerId());
if (ObjectUtil.isNotNull(userInfo) && ObjectUtil.isNotNull(userInfo.getId())) {
List<CustomerVisibleRangeDTO.SelectRobotWxInfoVo> wxInfoVos = customerVisibleRangeVO.getWxInfoVos();
List<String> stringList = wxInfoVos.stream().map(CustomerVisibleRangeDTO.SelectRobotWxInfoVo::getWxId).distinct().collect(Collectors.toList());
if (CollUtil.isEmpty(stringList)) {
stringList.add(StringPool.ASTERISK);
}
// 已存在数据
List<CustomerVisibleRange> customerVisibleRanges = baseMapper.listByAccountAndWeChatId(customerVisibleRangeVO.getCustomerId(), customerVisibleRangeVO.getWechatId());
Set<String> presenceCustomer = customerVisibleRanges.stream().map(CustomerVisibleRange::getFriendWxId).collect(Collectors.toSet());
Map<String, CustomerVisibleRangeDTO.SelectRobotWxInfoVo> infoVoMap = wxInfoVos.stream().collect(Collectors.toMap(CustomerVisibleRangeDTO.SelectRobotWxInfoVo::getWxId, wxInfoVo -> wxInfoVo));
Set<String> saveWxId = infoVoMap.keySet();
List<String> removeList = Lists.newArrayList(Sets.difference(presenceCustomer, saveWxId));
// 删除已经存在数据
infoVoMap.keySet().removeIf(presenceCustomer::contains);
if (CollUtil.isNotEmpty(infoVoMap.values())) {
CustomerVisibleRange range;
// 保存数据
for (Map.Entry<String, CustomerVisibleRangeDTO.SelectRobotWxInfoVo> voEntry : infoVoMap.entrySet()) {
range = new CustomerVisibleRange();
CustomerVisibleRangeDTO.SelectRobotWxInfoVo wxInfoVo = voEntry.getValue();
range.setUserId(userInfo.getId());
range.setAccount(customerVisibleRangeVO.getAccount());
range.setWechatId(customerVisibleRangeVO.getWechatId());
range.setFriendWxId(wxInfoVo.getWxId());
range.setFriendWxImg(wxInfoVo.getWxImg());
range.setFriendWxNick(wxInfoVo.getWxNick());
range.setFriendAllEnable(customerVisibleRangeVO.getFriendAllEnable());
range.setGroupAllEnable(customerVisibleRangeVO.getGroupAllEnable());
arrayList.add(range);
}
baseMapper.insertBatchSomeColumn(arrayList);
}
if (CollUtil.isNotEmpty(removeList)) {
this.baseMapper.removeByCustomerAndFriendWxId(customerVisibleRangeVO.getCustomerId(), removeList);
}
customerVisibleFeign.clearCustomerVisibleRanges(customerVisibleRangeVO.getAccount(), customerVisibleRangeVO.getWechatId(), removeList);
return Boolean.TRUE;
}
return Boolean.FALSE;
}
}

@ -1,14 +1,18 @@
package com.baiye.modules.scrm.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONUtil;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.modules.scrm.dto.CreateAddFriendTaskDTO;
import com.baiye.modules.scrm.dto.UpdateTaskDTO;
import com.baiye.modules.scrm.qo.AccountQo;
import com.baiye.modules.scrm.qo.AddFriendQo;
import com.baiye.modules.scrm.qo.TaskQo;
import com.baiye.modules.scrm.service.AddFriendService;
import com.baiye.modules.scrm.service.AddFriendTaskService;
import com.baiye.modules.scrm.vo.AddFriendPageVO;
import com.baiye.modules.scrm.vo.AddFriendTaskVO;
import com.baiye.modules.scrm.vo.AddFriendVo;
import com.baiye.result.BaseResultCode;
import com.baiye.result.R;
import com.baiye.security.util.SecurityUtils;
@ -35,6 +39,16 @@ public class AddFriendController {
private final AddFriendTaskService addFriendTaskService;
private final AddFriendService addFriendService;
@GetMapping("/page")
@Operation(summary = "分页查询记录")
public R<PageResult<AddFriendPageVO>> getClueRecordPage(@Validated PageParam pageParam, AddFriendQo qo) {
return R.ok(addFriendService.queryPage(pageParam, qo));
}
@GetMapping("/task/page")
@Operation(summary = "分页查询记录")
public R<PageResult<AddFriendTaskVO>> getClueRecordPage(@Validated PageParam pageParam, TaskQo qo) {

@ -0,0 +1,65 @@
package com.baiye.modules.scrm.controller;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.modules.scrm.entity.CircleFriendTask;
import com.baiye.modules.scrm.qo.CircleFriendQO;
import com.baiye.modules.scrm.qo.ComparisonQO;
import com.baiye.modules.scrm.service.CircleFriendTaskService;
import com.baiye.modules.scrm.vo.CircleFriendTaskVO;
import com.baiye.modules.scrm.vo.ComparisonTaskVO;
import com.baiye.result.BaseResultCode;
import com.baiye.result.R;
import com.baiye.security.util.SecurityUtils;
import com.baiye.validation.group.CreateGroup;
import com.baiye.validation.group.UpdateGroup;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author Enzo
* @date : 2024/8/15
*/
@Tag(name = "朋友圈")
@Slf4j
@RestController
@RequestMapping(value = "/circle/friend")
@AllArgsConstructor
public class CircleFriendTaskController {
private final CircleFriendTaskService circleFriendTaskService;
@GetMapping("/page")
@Operation(summary = "分页查询记录")
public R<PageResult<CircleFriendTaskVO>> robotGroupPage(@Validated PageParam pageParam, CircleFriendQO qo) {
qo.setUserId(SecurityUtils.getCurrentUserId());
return R.ok(circleFriendTaskService.queryPage(pageParam, qo));
}
@PostMapping("/add")
public R<Object> add(@Validated({CreateGroup.class}) @RequestBody CircleFriendTask entity) {
circleFriendTaskService.create(entity);
return R.ok();
}
@PostMapping("/update")
public R<Object> update(@Validated({UpdateGroup.class}) @RequestBody CircleFriendTask entity) {
circleFriendTaskService.update(entity);
return R.ok();
}
@DeleteMapping("/{id}")
@Operation(summary = "ID删除任务")
public R<Void> deleteByUserId(@PathVariable("id") Long taskId) {
return Boolean.TRUE.equals(circleFriendTaskService.del(taskId)) ? R.ok() : R.failed(BaseResultCode.UPDATE_DATABASE_ERROR, "删除失败");
}
}

@ -0,0 +1,72 @@
package com.baiye.modules.scrm.controller;
import cn.hutool.json.JSONUtil;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.modules.scrm.dto.CreateAddFriendTaskDTO;
import com.baiye.modules.scrm.qo.ComparisonQO;
import com.baiye.modules.scrm.qo.RobotGroupQo;
import com.baiye.modules.scrm.service.ComparisonTaskService;
import com.baiye.modules.scrm.vo.ComparisonTaskVO;
import com.baiye.modules.scrm.vo.RobotGroupVO;
import com.baiye.result.R;
import com.baiye.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/**
* @author Enzo
* @date : 2024/8/16
*/
@Tag(name = "对比任务")
@Slf4j
@RestController
@RequestMapping(value = "/comparison/task")
@AllArgsConstructor
public class ComparisonTaskController {
private final ComparisonTaskService comparisonTaskService;
@GetMapping("/page")
@Operation(summary = "分页查询记录")
public R<PageResult<ComparisonTaskVO>> robotGroupPage(@Validated PageParam pageParam, ComparisonQO qo) {
qo.setUserId(SecurityUtils.getWhichUserId() ==
DefaultNumberConstants.ONE_NUMBER ? SecurityUtils.getCurrentUserId() : SecurityUtils.getWhichUserId());
return R.ok(comparisonTaskService.queryPage(pageParam, qo));
}
@PostMapping("/create/task")
@Operation(summary = "创建任务")
public R<String> createTestTask(MultipartFile file, String taskName,String remark) {
return Boolean.TRUE.equals(comparisonTaskService.createTask(file, taskName, remark)) ? R.ok() : R.failed("创建任务失败");
}
@PostMapping("/additional")
@Operation(summary = "追加任务")
public R<String> createTestTask(MultipartFile file, Long taskId,Boolean isComplete) {
return Boolean.TRUE.equals(comparisonTaskService.additionalTask(file, taskId, isComplete)) ? R.ok() : R.failed("追加任务失败");
}
@GetMapping("/export")
@Operation(summary = "导出数据")
public void export(HttpServletResponse response, Long taskId) {
comparisonTaskService.exportByTaskId(response, taskId);
}
}

@ -0,0 +1,93 @@
package com.baiye.modules.scrm.controller;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.result.R;
import com.baiye.system.properties.MinioConfig;
import com.baiye.system.util.MinioUtil;
import io.minio.messages.Bucket;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @author Enzo
* @date : 2024/7/4
*/
@Tag(name = "文件相关接口")
@Slf4j
@RestController
@RequestMapping(value = "/file")
@RequiredArgsConstructor
public class FileController {
private final MinioUtil minioUtil;
private final MinioConfig prop;
@Operation(summary = "查看存储bucket是否存在")
@GetMapping("/bucketExists")
public R<Boolean> bucketExists(@RequestParam("bucketName") String bucketName) {
return R.ok(minioUtil.bucketExists(bucketName));
}
@Operation(summary = "创建存储bucket")
@GetMapping("/makeBucket")
public R<Boolean> makeBucket(String bucketName) {
return R.ok(minioUtil.makeBucket(bucketName));
}
@Operation(summary = "删除存储bucket")
@GetMapping("/removeBucket")
public R<Boolean> removeBucket(String bucketName) {
return R.ok(minioUtil.removeBucket(bucketName));
}
@Operation(summary = "获取全部bucket")
@GetMapping("/getAllBuckets")
public R<List<Bucket>> getAllBuckets() {
return R.ok(minioUtil.getAllBuckets());
}
@Operation(summary = "文件上传返回url")
@PostMapping("/upload")
public R<String> upload(@RequestParam("file") MultipartFile file) {
String filename = minioUtil.upload(file);
if (ObjectUtil.isNotNull(filename)) {
return R.ok((prop.getEndpoint() + prop.getBucketName() +StrPool.SLASH + filename));
}
return R.failed("上传文件失败");
}
@Operation(summary = "图片/视频预览")
@GetMapping("/preview")
public R<String> preview(@RequestParam("fileName") String fileName) {
return R.ok(minioUtil.preview(fileName));
}
@Operation(summary = "文件下载")
@GetMapping("/download")
public R<Object> download(@RequestParam("fileName") String fileName, HttpServletResponse res) {
minioUtil.download(fileName, res);
return R.ok();
}
@Operation(summary = "删除文件")
@PostMapping("/delete")
public R<Object> remove(String url) {
String objName = url.substring(url.lastIndexOf(prop.getBucketName().concat
(StrPool.SLASH)) + prop.getBucketName().length() + DefaultNumberConstants.ONE_NUMBER);
minioUtil.remove(objName);
return R.ok(objName);
}
}

@ -2,6 +2,7 @@ package com.baiye.modules.scrm.controller;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.modules.scrm.dto.PacketDTO;
import com.baiye.modules.scrm.qo.AccountQo;
import com.baiye.modules.scrm.service.LoginEquipmentService;
import com.baiye.modules.scrm.vo.WeChatAccountVO;
@ -11,9 +12,9 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Enzo
@ -37,10 +38,4 @@ public class LoginEquipmentController {
}

@ -0,0 +1,36 @@
package com.baiye.modules.scrm.controller;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.modules.scrm.qo.RobotCustomerQo;
import com.baiye.modules.scrm.service.RobotCustomerService;
import com.baiye.modules.scrm.vo.RobotCustomerVO;
import com.baiye.result.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Enzo
* @date : 2024/7/11
*/
@RequiredArgsConstructor
@RestController
@Tag(name = "获取好友记录")
@RequestMapping("/robot/customer")
public class RobotCustomerController {
private final RobotCustomerService robotCustomerService;
@GetMapping("/page")
@Operation(summary = "分页查询记录")
public R<PageResult<RobotCustomerVO>> getClueRecordPage(@Validated PageParam pageParam, RobotCustomerQo qo) {
return R.ok(robotCustomerService.queryPage(pageParam, qo));
}
}

@ -0,0 +1,73 @@
package com.baiye.modules.scrm.controller;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.modules.scrm.entity.RobotGroup;
import com.baiye.modules.scrm.qo.RobotGroupQo;
import com.baiye.modules.scrm.service.RobotGroupService;
import com.baiye.modules.scrm.vo.RobotGroupVO;
import com.baiye.result.BaseResultCode;
import com.baiye.result.R;
import com.baiye.security.util.SecurityUtils;
import com.baiye.validation.group.CreateGroup;
import com.baiye.validation.group.UpdateGroup;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Enzo
* @date : 2024/8/14
*/
@RestController
@Tag(name = "分组管理")
@RequestMapping("/robot/group")
@RequiredArgsConstructor
public class RobotGroupController {
private final RobotGroupService robotGroupService;
@GetMapping("/page")
@Operation(summary = "分页查询记录")
public R<PageResult<RobotGroupVO>> robotGroupPage(@Validated PageParam pageParam, RobotGroupQo qo) {
qo.setUserId(SecurityUtils.getCurrentUserId());
return R.ok(robotGroupService.queryPage(pageParam, qo));
}
@PostMapping("/add")
public R<Object> add(@Validated({CreateGroup.class}) @RequestBody RobotGroup entity) {
robotGroupService.create(entity);
return R.ok();
}
@PostMapping("/update")
public R<Object> update(@Validated({ UpdateGroup.class }) @RequestBody RobotGroup entity) {
robotGroupService.update(entity);
return R.ok();
}
@DeleteMapping("/{id}")
@Operation(summary = "ID删除任务")
public R<Void> deleteByUserId(@PathVariable("id") Long groupId) {
return Boolean.TRUE.equals(robotGroupService.del(groupId)) ? R.ok() : R.failed(BaseResultCode.UPDATE_DATABASE_ERROR, "删除失败");
}
@GetMapping("/list")
@Operation(summary = "查询所有数据")
public R<List<RobotGroupVO>> robotGroupList() {
return R.ok(robotGroupService.queryByUserId(SecurityUtils.getCurrentUserId()));
}
}

@ -0,0 +1,60 @@
package com.baiye.modules.scrm.controller;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.modules.scrm.dto.StaticResourceDTO;
import com.baiye.modules.scrm.entity.StaticResource;
import com.baiye.modules.scrm.qo.ResourceQo;
import com.baiye.modules.scrm.service.StaticResourceService;
import com.baiye.modules.scrm.vo.StaticResourceVO;
import com.baiye.result.BaseResultCode;
import com.baiye.result.R;
import com.baiye.validation.group.CreateGroup;
import com.baiye.validation.group.UpdateGroup;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author Enzo
* @date 2023-12-6
*/
@RestController
@Tag(name = "素材管理")
@RequestMapping("/static/resource")
@RequiredArgsConstructor
public class StaticResourceController {
private final StaticResourceService staticResourceService;
@GetMapping("/page")
@Operation(summary = "分页查询")
public R<PageResult<StaticResourceVO>> queryPage(@Validated PageParam pageParam, ResourceQo qo) {
return R.ok(staticResourceService.queryPage(pageParam, qo));
}
@PostMapping("/add")
public R<Object> add(@Validated({CreateGroup.class}) @RequestBody StaticResource entity) {
staticResourceService.create(entity);
return R.ok();
}
@PostMapping("/update")
public R<Object> update(@Validated({ UpdateGroup.class }) @RequestBody StaticResourceDTO resourceDTO) {
staticResourceService.update(resourceDTO);
return R.ok();
}
@DeleteMapping("/{id}")
@Operation(summary = "ID删除任务")
public R<Void> deleteByUserId(@PathVariable("id") Long resourceId) {
return Boolean.TRUE.equals(staticResourceService.del(resourceId)) ? R.ok() : R.failed(BaseResultCode.UPDATE_DATABASE_ERROR, "删除失败");
}
}

@ -0,0 +1,31 @@
package com.baiye.modules.scrm.controller;
import com.baiye.modules.scrm.dto.PacketDTO;
import com.baiye.modules.scrm.service.WechatAccountService;
import com.baiye.result.R;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Enzo
* @date : 2024/8/16
*/
@Slf4j
@RestController
@RequestMapping("/wechat/account")
@RequiredArgsConstructor
public class WeChatAccountController {
private final WechatAccountService wechatAccountService;
@PostMapping("/update/packet")
@Operation(summary = "修改分组")
public R<Boolean> updatePacketById(@RequestBody PacketDTO dto) {
return R.ok(wechatAccountService.updatePacketById(dto));
}
}

@ -3,8 +3,8 @@ package com.baiye.modules.scrm.controller;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.modules.scrm.dto.CreateCodeDTO;
import com.baiye.modules.scrm.dto.PacketDTO;
import com.baiye.modules.scrm.dto.PushCodeDTO;
import com.baiye.modules.scrm.dto.WeChatAddFriendDTO;
import com.baiye.modules.scrm.dto.WeChatStatisticsDTO;
import com.baiye.modules.scrm.qo.AccountQo;
import com.baiye.modules.scrm.service.WeChatService;
@ -66,24 +66,18 @@ public class WeChatController {
return R.ok(weChatService.pushCode(pushCodeDTO));
}
@Operation(description = "添加好友")
@PostMapping("/addFriend")
public R<Object> addFriend(@Validated @RequestBody WeChatAddFriendDTO weChatFriendDTO) {
return R.ok(weChatService.addFriend(weChatFriendDTO));
}
@GetMapping("/create/equipment")
@Operation(summary = "创建设备")
public R<String> createEquipment(Integer num) {
return Boolean.TRUE.equals(weChatService.createEquipment(num, SecurityUtils.getCurrentUserId())) ? R.ok() : R.failed("创建设备失败");
public R<String> createEquipment(Integer num, Long packetId) {
return Boolean.TRUE.equals(weChatService.createEquipment(num, packetId, SecurityUtils.getCurrentUserId())) ? R.ok() : R.failed("创建设备失败");
}
@GetMapping("/friend/page")
@Operation(summary = "添加好友记录")
public R<PageResult<AddFriendVo>> getData(@Validated PageParam pageParam, AccountQo qo) {
return R.ok(weChatService.queryFirendData(pageParam, qo));
return R.ok(weChatService.queryFriendData(pageParam, qo));
}
@ -135,4 +129,6 @@ public class WeChatController {
}
}

@ -24,13 +24,13 @@ public class WeChatGroupController {
@GetMapping("/query/information")
@Operation(summary = "群列表")
public R<Object> queryInformation(String wxId) {
return R.ok(weChatGroupService.queryInformation(wxId));
public R<Object> queryInformation(String wxId,String groupName,String groupId) {
return R.ok(weChatGroupService.queryInformation(wxId, groupName, groupId));
}
@GetMapping("/user/list/groupId")
@Operation(summary = "群列表")
@Operation(summary = "群c成员列表")
public R<Object> queryGroupUserListByGroupId(Long groupId) {
return R.ok(weChatGroupService.queryGroupUserListByGroupId(groupId));
}

@ -0,0 +1,26 @@
package com.baiye.modules.scrm.converter;
import com.baiye.modules.scrm.entity.AddFriend;
import com.baiye.modules.scrm.entity.PayOrder;
import com.baiye.modules.scrm.vo.AddFriendPageVO;
import com.baiye.modules.scrm.vo.PayOrderVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* @author Enzo
* @date : 2024/3/28
*/
@Mapper
public interface AddFriendConverter {
AddFriendConverter INSTANCE = Mappers.getMapper(AddFriendConverter.class);
/**
* vo
*
* @param addFriend
* @return
*/
AddFriendPageVO entityToVo(AddFriend addFriend);
}

@ -18,6 +18,7 @@ public interface AddFriendTaskConverter {
/**
* vo
*
* @param addFriendTask
* @return
*/

@ -0,0 +1,26 @@
package com.baiye.modules.scrm.converter;
import com.baiye.modules.scrm.entity.CircleFriendTask;
import com.baiye.modules.scrm.entity.ComparisonTask;
import com.baiye.modules.scrm.vo.CircleFriendTaskVO;
import com.baiye.modules.scrm.vo.ComparisonTaskVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* @author Enzo
* @date : 2024/3/28
*/
@Mapper
public interface CircleFriendTaskConverter {
CircleFriendTaskConverter INSTANCE = Mappers.getMapper(CircleFriendTaskConverter.class);
/**
* vo
*
* @param circleFriendTask
* @return
*/
CircleFriendTaskVO entityToVo(CircleFriendTask circleFriendTask);
}

@ -0,0 +1,27 @@
package com.baiye.modules.scrm.converter;
import com.baiye.modules.scrm.entity.ComparisonTask;
import com.baiye.modules.scrm.entity.PayOrder;
import com.baiye.modules.scrm.vo.ComparisonTaskVO;
import com.baiye.modules.scrm.vo.ComparisonVO;
import com.baiye.modules.scrm.vo.PayOrderVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* @author Enzo
* @date : 2024/3/28
*/
@Mapper
public interface ComparisonConverter {
ComparisonConverter INSTANCE = Mappers.getMapper(ComparisonConverter.class);
/**
* vo
*
* @param comparisonTask
* @return
*/
ComparisonTaskVO entityToVo(ComparisonTask comparisonTask);
}

@ -16,6 +16,7 @@ public interface PayOrderConverter {
/**
* vo
*
* @param payOrder
* @return
*/

@ -0,0 +1,26 @@
package com.baiye.modules.scrm.converter;
import com.baiye.modules.scrm.entity.PayOrder;
import com.baiye.modules.scrm.entity.RobotCustomer;
import com.baiye.modules.scrm.vo.PayOrderVO;
import com.baiye.modules.scrm.vo.RobotCustomerVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* @author Enzo
* @date : 2024/3/28
*/
@Mapper
public interface RobotCustomerConverter {
RobotCustomerConverter INSTANCE = Mappers.getMapper(RobotCustomerConverter.class);
/**
* vo
*
* @param payOrder
* @return
*/
RobotCustomerVO entityToVo(RobotCustomer payOrder);
}

@ -0,0 +1,24 @@
package com.baiye.modules.scrm.converter;
import com.baiye.modules.scrm.entity.RobotGroup;
import com.baiye.modules.scrm.vo.RobotGroupVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* @author Enzo
* @date : 2024/3/28
*/
@Mapper
public interface RobotGroupConverter {
RobotGroupConverter INSTANCE = Mappers.getMapper(RobotGroupConverter.class);
/**
* vo
*
* @param robotGroup
* @return
*/
RobotGroupVO entityToVo(RobotGroup robotGroup);
}

@ -0,0 +1,24 @@
package com.baiye.modules.scrm.converter;
import com.baiye.modules.scrm.entity.StaticResource;
import com.baiye.modules.scrm.vo.StaticResourceVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* @author Enzo
* @date : 2024/7/2
*/
@Mapper
public interface StaticResourceConverter {
StaticResourceConverter INSTANCE = Mappers.getMapper(StaticResourceConverter.class);
/**
* vo
*
* @param resource
* @return
*/
StaticResourceVO entityToVo(StaticResource resource);
}

@ -16,6 +16,7 @@ public interface WeChatAccountConverter {
/**
* vo
*
* @param weChatAccount
* @return
*/

@ -19,11 +19,11 @@ public class AddFriendDTO {
private String greet;
@Schema(title = "微信小号")
private String trumpetWechat;
private List<String> trumpetWechat;
@Schema(title = "标签ID")
private List<String> labelIds;
@Schema(title = "小号微信")
private List<String> targetWechat;
@Schema(title = "对方微信")
private String targetWechat;
}

@ -0,0 +1,15 @@
package com.baiye.modules.scrm.dto;
import lombok.Data;
/**
* @author Enzo
* @date : 2024/8/5
*/
@Data
public class AfterPassingDTO {
private String passGreetMessage;
private Integer type;
}

@ -1,19 +1,11 @@
package com.baiye.modules.scrm.dto;
import cn.hutool.core.date.DatePattern;
import com.baiye.extend.mybatis.plus.converter.JsonStringArrayTypeHandler;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
@ -78,8 +70,7 @@ public class CreateAddFriendTaskDTO {
@Schema(title = "添加对象")
private List<AddFriendDTO> addFriendDTOList;
@Schema(title = "通过之后好友语句")
private List<String> passGreetMessage;
private List<AfterPassingDTO> afterPassing;
}

@ -0,0 +1,62 @@
package com.baiye.modules.scrm.dto;
import lombok.*;
import java.io.Serializable;
import java.util.List;
/**
* @author Enzo
* @date : 2024/7/5
*/
@Data
public class CustomerAddRobotDTO implements Serializable {
private static final long serialVersionUID = 196188603405909763L;
private Long id;
/**
* ID
*/
private Long customerId;
/**
*
*/
private String customerAccount;
/**
* 1-2-
*/
private Integer removeEnable;
/**
* id
*/
private List<Long> robotIds;
private List<ChangePrimaryDTO> data;
/**
*
*/
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Getter
@Setter
public static class ChangePrimaryDTO {
private Long id;
private Long robotId;
private Boolean isPrimary;
}
}

@ -0,0 +1,129 @@
package com.baiye.modules.scrm.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* @author Enzo
* @date : 2024/7/5
*/
@Data
public class CustomerUserInfoDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
/**
* id
*/
private Long userId;
/**
* ID
*/
private Long customerId;
/**
*
*/
@NotBlank(message = "账号未指定")
private String account;
/**
*
*/
@NotBlank(message = "昵称不能为空")
private String nick;
/**
*
*/
@NotBlank(message = "密码不能为空")
private String pwd;
/**
* ID
*/
private String bindWxId;
/**
* OPENID
*/
private String openId;
/**
*
*/
private String wxNickname;
/**
* headimgurl 04664961320640*640
*/
private String wxHeadImgUrl;
/**
*
*/
private Boolean isEnable;
/**
*
*/
private Integer robotNum;
/**
*
*/
private Integer robotSubNum;
/**
* 线
*/
private Boolean onLine;
/**
*
*/
private Boolean privateMsgEnable;
/**
*
*/
private Boolean supportCustomerEnable;
/**
*
*/
private Integer returnMsgNum;
/**
*
*/
private Integer requestSupportNum;
/**
*
*/
private Integer wasRequestSupportNum;
/**
*
*/
private BigDecimal averageResponseTime;
/**
* id
*/
private List<Long> robotIds;
/**
*
*/
private Integer clientNum;
}

@ -0,0 +1,54 @@
package com.baiye.modules.scrm.dto;
import lombok.*;
import java.util.List;
/**
* @author Enzo
* @date : 2024/7/18
*/
@Data
public class CustomerVisibleRangeDTO {
private Integer userId;
private String account;
private Long customerId;
private String wechatId;
private String friendWxId;
private String friendWxImg;
private String friendWxNick;
private Boolean friendAllEnable;
private Boolean groupAllEnable;
List<SelectRobotWxInfoVo> wxInfoVos;
/**
*
*/
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Getter
@Setter
public static class SelectRobotWxInfoVo {
private int robotId;
private String wxId;
private String wxNick;
private String wxImg;
}
}

@ -0,0 +1,66 @@
package com.baiye.modules.scrm.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @author Enzo
* @date : 2024/7/26
*/
@Data
public class CustomerWxLabelDTO {
private Long id;
/**
* ID
*/
private Integer userId;
/**
* ID
*/
@NotBlank
private String wechatId;
/**
* 1-SCRM2-3-SCRM
*/
private Integer labelType;
/**
*
*/
private Integer labelSyncWx;
/**
* ID
*/
private Integer labelId;
/**
*
*/
private String labelName;
/**
*
*/
private Integer labelNum;
/**
* ID
*/
private String labelWxList;
/**
*
*/
private String createBy;
/**
*
*/
private String updateBy;
}

@ -19,6 +19,8 @@ public class GroupMemberDTO {
private Integer sex;
private String alias;
private Integer type;
private String userName;

@ -37,4 +37,9 @@ public class OtherInformationDTO implements Serializable {
private String fromUserName;
private WechatMemberDTO targetWxInfo;
}

@ -0,0 +1,16 @@
package com.baiye.modules.scrm.dto;
import lombok.Data;
import java.util.List;
/**
* @author Enzo
* @date : 2024/8/15
*/
@Data
public class PacketDTO {
private List<Long> idList;
private Long packetId;
}

@ -11,7 +11,7 @@ public class PushCodeDTO {
private String pit;
private String wxId;
private String wechat;
private Integer protoVer;

@ -0,0 +1,26 @@
package com.baiye.modules.scrm.dto;
import lombok.Builder;
import lombok.Data;
import java.util.List;
/**
* @author Enzo
* @date : 2024/6/13
*/
@Data
@Builder
public class SaveComparisonDTO {
/**
* ID
*/
private Long userId;
/**
* id
*/
private Long taskId;
}

@ -0,0 +1,68 @@
package com.baiye.modules.scrm.dto;
import com.baiye.extend.mybatis.plus.converter.JsonStringArrayTypeHandler;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author Enzo
* @date : 2024/7/2
*/
@Data
public class StaticResourceDTO {
private Long id;
/**
* id
*/
private Long userId;
/**
*
*/
private String title;
/**
*
*/
private Integer type;
/**
*
*/
private String url;
/**
*
*/
private String fileUrl;
/**
*
*/
private Integer status;
/**
*
*/
private String remark;
/**
*
*/
private String content;
/**
*
*/
private List<String> serviceLabel;
}

@ -1,6 +1,7 @@
package com.baiye.modules.scrm.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
@ -10,12 +11,13 @@ import java.io.Serializable;
* @date : 2022/6/27
*/
@Data
public class WeChatFriendDTO implements Serializable {
@Schema(title = "机器人微信ID")
private String robotWxId;
@Schema(title = "添加好友方式")
@Schema(title = "添加好友方式 1 主动 2被动")
private Integer addFriendType;
@Schema(title = "省")

@ -0,0 +1,19 @@
package com.baiye.modules.scrm.dto;
import lombok.Data;
/**
* @author Enzo
* @date : 2024/6/27
*/
@Data
public class WeChatInformationDTO {
private String alias;
private String nickName;
private Integer sex;
private String userName;
}

@ -0,0 +1,17 @@
package com.baiye.modules.scrm.dto;
import lombok.Data;
/**
* @author Enzo
* @date : 2024/7/26
*/
@Data
public class WeChatLabelDTO {
private Integer labelId;
private String labelName;
}

@ -0,0 +1,63 @@
package com.baiye.modules.scrm.dto;
import lombok.Data;
/**
* @author Enzo
* @date : 2024/7/18
*/
@Data
public class WeChatLoginInfoDTO {
private String code;
private String deviceImEi;
private String deviceToken;
private String flag;
private String host;
private String loginName;
private Integer loginType;
private String msgSyncKey;
private Boolean newDevice;
private Boolean newWxLogin;
private String nickname;
private String pit;
private Integer protoVer;
private Boolean pushLogin;
private String randomId;
private String reConnectReason;
private String reConnectReqId;
private String result;
private String settings;
private String smallHeadImgUrl;
private String softwareId;
private String token;
private String wxId;
private String wxVersion;
private String wxdat;
private String wxid;
}

@ -14,9 +14,10 @@ public class WeChatUserLoginDTO implements Serializable {
private String pit;
private String wxid;
private String alias;
private String nickname;
private String smallHeadImgUrl;

@ -9,7 +9,7 @@ import java.io.Serializable;
* @date : 2024/6/12
*/
@Data
public class ContractDTO implements Serializable {
public class WechatMemberDTO implements Serializable {
private Integer verifyFlag;
private Integer msgType;
@ -26,7 +26,7 @@ public class ContractDTO implements Serializable {
private String remark;
private Integer type;
private String type;
private String userName;
@ -40,5 +40,7 @@ public class ContractDTO implements Serializable {
private String chatRoomOwner;
private String labelLists;
}

@ -2,14 +2,14 @@ package com.baiye.modules.scrm.entity;
import com.baiye.extend.mybatis.plus.alias.TableAlias;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* @author Enzo
@ -26,6 +26,12 @@ public class ActiveAddFriedRecord implements Serializable {
@NotNull(message = "ID不能为空", groups = { UpdateGroup.class })
private Long id;
@Schema(title = "微信id")
private Long addFriendId;
@Schema(title = "任务id")
private Long taskId;
@Schema(title = "机器人微信ID")
private String robotWxId;
@ -61,4 +67,87 @@ public class ActiveAddFriedRecord implements Serializable {
private String userName;
@Schema(title = "添加状态")
private Integer addStatus;
/**
* ID
*/
@TableField("friend_id")
private String friendId;
/**
*
*/
@TableField("friend_no")
private String friendNo;
/**
* id
*/
@TableField("source_user_name")
private String sourceUserName;
/**
*
*/
@TableField("source_nick_name")
private String sourceNickName;
/**
*
*/
@TableField("memo")
private String memo;
/**
* 1-2-
*/
@TableField("add_friend_type")
private Integer addFriendType;
/**
*
*/
@TableField("ticket")
private String ticket;
/**
*
*/
@TableField("scene")
private Integer scene;
/**
*
*/
@TableField("encrypt_username")
private String encryptUsername;
@TableField(fill = FieldFill.INSERT)
@Schema(title = "创建时间")
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(title = "修改时间")
private LocalDateTime updateTime;
/**
*
*/
@TableField("tg_time")
private Date tgTime;
@TableField("create_by")
private String createBy;
}

@ -5,10 +5,7 @@ import com.baiye.extend.mybatis.plus.converter.JsonStringArrayTypeHandler;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.*;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
@ -53,9 +50,13 @@ public class AddFriend {
@Schema(title = "对方微信")
private String targetWechat;
@Schema(title = "添加状态")
@Schema(title = "添加状态 0未添加 1 已添加 3添加失败 4 好友通过")
private Integer addStatus;
@Schema(title = "执行时间")
private Date executionTime;
@TableField(fill = FieldFill.INSERT)
@Schema(title = "创建时间")
private LocalDateTime createTime;
@ -65,6 +66,9 @@ public class AddFriend {
private LocalDateTime updateTime;
@Override
public boolean equals(Object o) {
if (this == o) return true;

@ -0,0 +1,43 @@
package com.baiye.modules.scrm.entity;
import com.baiye.entity.BaseEntity;
import com.baiye.extend.mybatis.plus.alias.TableAlias;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.validation.constraints.NotNull;
/**
* @author Enzo
* @date : 2024/6/17
*/
@Getter
@Setter
@ToString
@TableName(value = "tb_add_friend_frequently_record")
@Schema(title = "添加频繁记录")
@TableAlias("ar")
public class AddFriendFrequentlyRecord extends BaseEntity {
@TableId(type = IdType.AUTO)
@Schema(title = "ID")
@NotNull(message = "ID不能为空", groups = { UpdateGroup.class })
private Long id;
@Schema(title = "add_friend_id")
private Long addFriendId;
@Schema(title = "target_wechat")
private String targetWechat;
@Schema(title = "trumpet_wechat")
private String trumpetWechat;
}

@ -0,0 +1,39 @@
package com.baiye.modules.scrm.entity;
import com.baiye.entity.BaseEntity;
import com.baiye.extend.mybatis.plus.alias.TableAlias;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.validation.constraints.NotNull;
/**
* @author Enzo
* @date : 2024/8/5
*/
@Getter
@Setter
@ToString
@TableName(value = "tb_add_friend_pass_greet_message")
@Schema(title = "添加之后语句")
@TableAlias("am")
public class AddFriendPassGreetMessage extends BaseEntity {
@TableId(type = IdType.AUTO)
@Schema(title = "ID")
@NotNull(message = "ID不能为空", groups = { UpdateGroup.class })
private Long id;
private Long taskId;
private Integer type;
@Schema(title = "通过之后消息")
private String passGreetMessage;
}

@ -98,8 +98,10 @@ public class AddFriendTask extends LogicDeletedBaseEntity {
private List<String> passGreetMessage;
@TableField(value = "execute_wechat_list", typeHandler = JsonStringArrayTypeHandler.class)
@Schema(title = "执行微信号")
private List<String> executeWechatList;
@Schema(title = "上一次执行时间")
private Date lastExecutionTime;
}

@ -0,0 +1,85 @@
package com.baiye.modules.scrm.entity;
import com.baiye.entity.LogicDeletedBaseEntity;
import com.baiye.extend.mybatis.plus.alias.TableAlias;
import com.baiye.extend.mybatis.plus.converter.JsonStringArrayTypeHandler;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
* @author Enzo
* @date : 2024/8/13
*/
@Getter
@Setter
@ToString
@TableName(value = "tb_circle_friend_task")
@Schema(title = "朋友圈任务")
@TableAlias("ct")
public class CircleFriendTask extends LogicDeletedBaseEntity {
@TableId(type = IdType.AUTO)
@Schema(title = "ID")
@NotNull(message = "ID不能为空", groups = { UpdateGroup.class })
private Long id;
@Schema(title = "任务名称")
private String taskName;
@Schema(title = "标题")
private String title;
@Schema(title = "发送状态")
private Integer sendStatus;
@Schema(title = "用户ID")
private Long userId;
@Schema(title = "内容")
private String content;
@Schema(title = "类型")
private Integer type;
@Schema(title = "延后时间")
private Integer deferredTime;
@Schema(title = "是否现在执行")
private Boolean isNow;
@Schema(title = "执行时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date executionTime;
@Schema(title = "资源地址")
private String sourcePath;
@Schema(title = "延后评论")
@TableField(value = "deferred_comment", typeHandler = JsonStringArrayTypeHandler.class)
private List<String> deferredComment;
@Schema(title = "图片地址")
@TableField(value = "picture_list", typeHandler = JsonStringArrayTypeHandler.class)
private List<String> pictureList;
@TableField(value = "execute_wechat_list", typeHandler = JsonStringArrayTypeHandler.class)
@Schema(title = "执行微信号")
private List<String> executeWechatList;
}

@ -0,0 +1,84 @@
package com.baiye.modules.scrm.entity;
import com.baiye.entity.BaseEntity;
import com.baiye.extend.mybatis.plus.alias.TableAlias;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.Objects;
/**
* @author Enzo
* @date : 2024/8/19
*
*/
@Getter
@Setter
@ToString
@TableName(value = "tb_comparison_record", autoResultMap = true)
@Schema(title = "对比记录")
@TableAlias("cr")
public class ComparisonRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.INPUT)
@Schema(title = "线索ID")
@NotNull(message = "id")
private Long id;
@Schema(title = "任务ID")
private Long taskId;
@Schema(title = "用户ID")
private Long userId;
@Schema(description = "日期")
private String dateStr;
@Schema(description = "小红书ID")
private String redBookId;
@Schema(description = "小红书号")
private String redBookNo;
@Schema(description = "项目")
private String photograph;
@Schema( description = "机构")
private String institution;
@Schema( description = "建模时间")
private Date conversionTime;
@Schema( description = "对比结果")
private String comparisonResult;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ComparisonRecord that = (ComparisonRecord) o;
return Objects.equals(redBookId, that.redBookId) && Objects.equals(redBookNo, that.redBookNo);
}
@Override
public int hashCode() {
return Objects.hash(redBookId, redBookNo);
}
}

@ -0,0 +1,51 @@
package com.baiye.modules.scrm.entity;
import com.baiye.entity.BaseEntity;
import com.baiye.extend.mybatis.plus.alias.TableAlias;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.validation.constraints.NotNull;
/**
* @author Enzo
* @date : 2024/8/16
*/
@Getter
@Setter
@ToString
@TableName(value = "tb_comparison_task", autoResultMap = true)
@Schema(title = "对比")
@TableAlias("ct")
public class ComparisonTask extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.INPUT)
@Schema(title = "线索ID")
@NotNull(message = "分发ID不能为空", groups = {UpdateGroup.class})
private Long id;
@Schema(title = "任务名称")
private String taskName;
@Schema(title = "用户ID")
private Long userId;
@Schema(title = "父类ID")
private Long parentId;
@Schema(title = "线索备注")
private String remark;
@Schema(title = "是否完成")
private Boolean isComplete;
}

@ -0,0 +1,43 @@
package com.baiye.modules.scrm.entity;
import com.baiye.entity.BaseEntity;
import com.baiye.extend.mybatis.plus.alias.TableAlias;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.validation.constraints.NotNull;
/**
* @author Enzo
* @date : 2024/8/16
*/
@Getter
@Setter
@ToString
@TableName(value = "tb_down_comparison_log", autoResultMap = true)
@Schema(title = "下载日志")
@TableAlias("cl")
public class ComparisonTaskLog extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.INPUT)
@Schema(title = "线索ID")
@NotNull(message = "分发ID不能为空", groups = {UpdateGroup.class})
private Long id;
@Schema(title = "任务名称")
private Long taskId;
@Schema(title = "任务名称")
private Long userId;
}

@ -47,4 +47,8 @@ public class LoginEquipment extends BaseEntity {
@Schema(name = "expiration_time")
private Date expirationTime;
@Schema(name = "packet_id")
private Long packetId;
}

@ -0,0 +1,299 @@
package com.baiye.modules.scrm.entity;
import com.baiye.entity.BaseEntity;
import com.baiye.extend.mybatis.plus.alias.TableAlias;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
* @author Enzo
* @date : 2024/7/9
*
*/
@Data
@TableAlias("rc")
@EqualsAndHashCode(callSuper = false)
@TableName(value = "tb_robot_customer", autoResultMap = true)
public class RobotCustomer extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
@Schema(title = "线索ID")
@NotNull(message = "分发ID不能为空", groups = { UpdateGroup.class })
private Long id;
/**
* ID
*/
@TableField("user_id")
private Long userId;
/**
*
* {@link com.eco.fission.common.param.enums.RobotTypeEnum}
*/
@TableField("robot_type")
private Integer robotType;
/**
* ID
*/
@TableField("robot_account")
private String robotAccount;
/**
* ID
*/
@TableField("wechat_id")
private String wechatId;
/**
* ID
*/
@TableField("friend_id")
private String friendId;
/**
*
*/
@TableField("friend_name")
private String friendName;
/**
*
*/
@TableField("friend_pinyin")
private String friendPinyin;
/**
*
*/
@TableField("friend_no")
private String friendNo;
/**
* ID
*/
@TableField("source_user_name")
private String sourceUserName;
/**
*
*/
@TableField("source_nick_name")
private String sourceNickName;
/**
*
*/
@TableField("memo")
private String memo;
/**
*
*/
@TableField("friend_alias")
private String friendAlias;
/**
* 0- 1 2
*/
@TableField("gender")
private Integer gender;
/**
* url
*/
@TableField("avatar")
private String avatar;
/**
* 132
*/
@TableField("avatar_132")
private String avatar132;
/**
*
*/
@TableField("description")
private String description;
/**
*
*/
@TableField("province")
private String province;
/**
*
*/
@TableField("city")
private String city;
/**
* SCRM
*/
@TableField("label_ids")
private String labelIds;
/**
*
*/
@TableField("wx_label_ids")
private String wxLabelIds;
/**
*
*/
@TableField("corp_name")
private String corpName;
/**
* 0-1-2-
*/
@TableField("add_friend_type")
private Integer addFriendType;
/**
*
*/
@TableField("add_accept_time")
private Date addAcceptTime;
/**
*
*/
@TableField("friend_msg_immunity_enable")
private Boolean friendMsgImmunityEnable;
/**
*
*/
@TableField("friend_top_enable")
private Boolean friendTopEnable;
/**
*
*/
@TableField("phones")
private String phones;
/**
*
*/
@TableField("scene")
private Integer scene;
/**
*
*/
@TableField("last_contact_time")
private Date lastContactTime;
/**
*
*/
@TableField("last_contact_customer_account")
private String lastContactCustomerAccount;
/**
*
*/
@TableField("last_contact_customer_nick")
private String lastContactCustomerNick;
/**
*
*/
@TableField("full_name")
private String fullName;
/**
*
*/
@TableField("job_time")
private String jobTime;
/**
*
*/
@TableField("update_md5")
private String updateMd5;
/**
*
*/
@TableField(exist = false)
private String tag;
/**
*
*/
@TableField(exist = false)
private List<String> tags;
/**
*
*/
@TableField(exist = false)
private String wechatNickName;
/**
*
*/
@TableField(exist = false)
private List<String> labelNames;
/**
*
*/
@TableField(exist = false)
private Long quertAddStartTime;
@TableField(exist = false)
private Long quertAddEndTime;
/**
*
*/
@TableField(exist = false)
private Long quertLastStartTime;
@TableField(exist = false)
private Long quertLastEndTime;
/**
*
*/
@TableField(exist = false)
private String queryKey;
/**
*
*/
@TableField(exist = false)
private String customerAccount;
/**
*
*/
@TableField(exist = false)
private Boolean customerVisibleRange;
}

@ -0,0 +1,45 @@
package com.baiye.modules.scrm.entity;
import com.baiye.entity.LogicDeletedBaseEntity;
import com.baiye.extend.mybatis.plus.alias.TableAlias;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @author Enzo
* @date : 2024/8/14
*/
@Getter
@Setter
@TableAlias("rg")
@TableName(value = "tb_robot_group")
public class RobotGroup extends LogicDeletedBaseEntity {
@TableId(type = IdType.AUTO)
@Schema(title = "分组ID")
@NotNull(message = "分组ID", groups = { UpdateGroup.class })
private Long id;
@Schema(title = "user_id")
private Long userId;
@TableField("group_type")
private Integer groupType;
@Schema(title = "name")
@NotBlank
private String name;
@TableField
private String remark;
}

@ -0,0 +1,91 @@
package com.baiye.modules.scrm.entity;
import com.baiye.entity.BaseEntity;
import com.baiye.extend.mybatis.plus.alias.TableAlias;
import com.baiye.extend.mybatis.plus.converter.JsonStringArrayTypeHandler;
import com.baiye.validation.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @author Enzo
* @date : 2024/7/2
*
*/
@Getter
@Setter
@TableAlias("sr")
@TableName(value = "tb_static_resource", autoResultMap = true)
public class StaticResource extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
@Schema(title = "id")
@NotNull(message = "id", groups = {UpdateGroup.class})
private Long id;
/**
* id
*/
@TableField("user_id")
private Long userId;
/**
*
*/
@TableField("title")
private String title;
/**
*
*/
@TableField("type")
private Integer type;
/**
*
*/
@TableField("url")
private String url;
/**
*
*/
@TableField("file_url")
private String fileUrl;
/**
*
*/
@TableField("status")
private Integer status;
/**
*
*/
@TableField("remark")
private String remark;
/**
*
*/
@TableField("content")
private String content;
/**
*
*/
@TableField(value = "service_label", typeHandler = JsonStringArrayTypeHandler.class)
private List<String> serviceLabel;
}

@ -71,4 +71,11 @@ public class WeChatAccount extends LogicDeletedBaseEntity {
@Schema(title = "微信号")
private String weChatNo;
@Schema(title = "客服ID")
private Long customerId;
@Schema(title = "分组ID")
private Long packetId;
}

@ -1,46 +1,48 @@
package com.baiye.modules.scrm.entity;
import com.baiye.entity.BaseEntity;
import com.baiye.extend.mybatis.plus.alias.TableAlias;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
/**
*
* @author Enzo
*
*
*/
@Data
@Getter
@Setter
@ToString
@TableAlias("we")
@TableName("tb_wechat_equipment")
@Schema(title = "微信账号设备")
public class WeChatEquipment implements Serializable {
public class WeChatEquipment extends BaseEntity implements Serializable {
@TableId(type = IdType.AUTO)
private Long id;
@TableId(type = IdType.AUTO)
private Long id;
/**
* ID
*/
@Schema(title = "用户id")
private Long accountId;
/**
* ID
*/
@Schema(title = "用户id")
private Long accountId;
/**
* Code
*/
@Schema(title = "设备id")
private Long equipmentId;
/**
* Code
*/
@Schema(title = "设备id")
private Long equipmentId;
@Schema(title = "用户ID")
private Long userId;
@Schema(title = "用户ID")
private Long userId;
}

@ -63,13 +63,15 @@ public class WeChatGroupMember extends BaseEntity {
private String chatRoomNick;
/**
*
*/
@TableField("wx_nick")
private String wxNick;
@TableField("alias")
private String alias;
/**
*

@ -1,9 +1,14 @@
package com.baiye.modules.scrm.mapper;
import cn.hutool.core.date.DateTime;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.scrm.entity.ActiveAddFriedRecord;
import com.baiye.modules.scrm.entity.AddFriend;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Enzo
* @date 2024-5-31
@ -12,5 +17,29 @@ import org.apache.ibatis.annotations.Mapper;
public interface ActiveAddFriendRecordMapper extends ExtendMapper<ActiveAddFriedRecord> {
/**
*
*
* @param nickName
* @param wxId
* @param number
* @param type
* @return
*/
default List<ActiveAddFriedRecord> selectByFromUsernameAndToUsername(String nickName, String wxId, Integer number, Integer type) {
return selectList(WrappersX.lambdaQueryX(ActiveAddFriedRecord.class).eq
(ActiveAddFriedRecord::getRobotWxId, wxId).like(ActiveAddFriedRecord::getNickName, nickName).eq
(ActiveAddFriedRecord::getAddStatus, number).eq(ActiveAddFriedRecord::getType, type).orderByDesc(ActiveAddFriedRecord::getId));
}
/**
* @param taskId
* @param startTime
* @param endTime
* @return
*/
default Long selectCountByTaskIdAndDate(String taskId, DateTime startTime, DateTime endTime) {
return selectCount(WrappersX.lambdaQueryX(ActiveAddFriedRecord.class).eq
(ActiveAddFriedRecord::getTaskId, taskId).gt(ActiveAddFriedRecord::getCreateTime, startTime).lt(ActiveAddFriedRecord::getCreateTime, endTime));
}
}

@ -0,0 +1,39 @@
package com.baiye.modules.scrm.mapper;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.C;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.scrm.entity.ActiveAddFriedRecord;
import com.baiye.modules.scrm.entity.AddFriendFrequentlyRecord;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Enzo
* @date 2024-5-31
*/
@Mapper
public interface AddFriendFrequentlyRecordMapper extends ExtendMapper<AddFriendFrequentlyRecord> {
/**
*
*
* @param trumpetWechat
* @param dateTime
* @return
*/
default AddFriendFrequentlyRecord countByTrumpetWechatAndDate(String trumpetWechat, DateTime dateTime) {
List<AddFriendFrequentlyRecord> selectList = selectList(WrappersX.lambdaQueryX(AddFriendFrequentlyRecord.class).eq
(AddFriendFrequentlyRecord::getTrumpetWechat, trumpetWechat).gt(AddFriendFrequentlyRecord::getCreateTime, dateTime).orderByDesc(AddFriendFrequentlyRecord::getId));
if (CollUtil.isNotEmpty(selectList)) {
return selectList.get(DefaultNumberConstants.ZERO_NUMBER);
}
return new AddFriendFrequentlyRecord();
}
}

@ -3,9 +3,17 @@ package com.baiye.modules.scrm.mapper;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.scrm.converter.AddFriendConverter;
import com.baiye.modules.scrm.entity.AddFriend;
import com.baiye.modules.scrm.qo.AddFriendQo;
import com.baiye.modules.scrm.vo.AddFriendPageVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -28,8 +36,8 @@ public interface AddFriendMapper extends ExtendMapper<AddFriend> {
*/
default List<AddFriend> queryByTaskIdAndStatus(String taskId, Integer addFriendNum, Integer taskStatus) {
return selectList(WrappersX.lambdaQueryX(AddFriend.class).eq
(AddFriend::getTaskId, taskId).eq(AddFriend::getAddStatus, taskStatus).orderByDesc(AddFriend::getId).last(" limit " + addFriendNum));
return selectList(WrappersX.lambdaQueryX(AddFriend.class).lt(AddFriend::getAddStatus, taskStatus).eq(
AddFriend::getTaskId, taskId).orderByAsc(AddFriend::getId).last(" limit " + addFriendNum));
}
/**
@ -57,11 +65,35 @@ public interface AddFriendMapper extends ExtendMapper<AddFriend> {
*
*
* @param taskId
* @param number
* @param startTime
* @param endTime
* @return
*/
default Long selectCountByTime(String taskId, DateTime startTime, DateTime endTime) {
return selectCount(WrappersX.lambdaQueryX(AddFriend.class).eq(AddFriend::getTaskId, taskId).gt(AddFriend::getCreateTime, startTime).lt(AddFriend::getCreateTime, endTime));
default Long selectCountByTime(String taskId, Integer number, DateTime startTime, DateTime endTime) {
return selectCount(WrappersX.lambdaQueryX(AddFriend.class).eq(AddFriend::getTaskId, taskId).gt(AddFriend::getAddStatus,number).
gt(AddFriend::getCreateTime, startTime).lt(AddFriend::getCreateTime, endTime));
}
/**
*
*
* @param pageParam
* @param qo
* @return
*/
default PageResult<AddFriendPageVO> selectPageByTaskId(PageParam pageParam, AddFriendQo qo) {
IPage<AddFriend> page = this.prodPage(pageParam);
LambdaQueryWrapperX<AddFriend> wrapperX = WrappersX.lambdaQueryX(AddFriend.class);
if (StringUtils.isNotBlank(qo.getStartTime()) && StringUtils.isNotBlank(qo.getEndTime())) {
wrapperX.between(AddFriend::getExecutionTime, qo.getStartTime(), qo.getEndTime());
}
wrapperX.eqIfPresent(AddFriend::getTaskId, qo.getTaskId()).likeIfPresent
(AddFriend::getTrumpetWechat, qo.getTrumpetWechat()).likeIfPresent
(AddFriend::getTargetWechat, qo.getTargetWechat()).orderByDesc(AddFriend::getId);
this.selectPage(page, wrapperX);
IPage<AddFriendPageVO> voPage = page.convert(AddFriendConverter.INSTANCE::entityToVo);
return new PageResult<>(voPage.getRecords(), voPage.getTotal());
}
}

@ -0,0 +1,28 @@
package com.baiye.modules.scrm.mapper;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.scrm.entity.AddFriendPassGreetMessage;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Enzo
* @date : 2024/8/5
*/
@Mapper
public interface AddFriendPassGreetMessageMapper extends ExtendMapper<AddFriendPassGreetMessage> {
default List<AddFriendPassGreetMessage> selectListByTaskId(Long taskId){
return this.selectList(WrappersX.lambdaQueryX(AddFriendPassGreetMessage.class).eq
(AddFriendPassGreetMessage::getTaskId, taskId).orderByAsc(AddFriendPassGreetMessage::getId));
}
default Boolean deleteByTaskId(Long id){
LambdaUpdateWrapper<AddFriendPassGreetMessage> wrapper = WrappersX.lambdaUpdate(AddFriendPassGreetMessage.class);
wrapper.eq(AddFriendPassGreetMessage::getTaskId, id);
return SqlHelper.retBool(this.delete(wrapper));
}
}

@ -0,0 +1,45 @@
package com.baiye.modules.scrm.mapper;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.scrm.converter.CircleFriendTaskConverter;
import com.baiye.modules.scrm.converter.ComparisonConverter;
import com.baiye.modules.scrm.entity.CircleFriendTask;
import com.baiye.modules.scrm.entity.ComparisonTask;
import com.baiye.modules.scrm.qo.CircleFriendQO;
import com.baiye.modules.scrm.qo.ComparisonQO;
import com.baiye.modules.scrm.vo.CircleFriendTaskVO;
import com.baiye.modules.scrm.vo.ComparisonTaskVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.apache.ibatis.annotations.Mapper;
/**
* @author Enzo
* @date : 2024/8/13
*/
@Mapper
public interface CircleFriendTaskMapper extends ExtendMapper<CircleFriendTask> {
/**
*
*
* @param pageParam
* @param qo
* @return
*/
default PageResult<CircleFriendTaskVO> queryPage(PageParam pageParam, CircleFriendQO qo){
IPage<CircleFriendTask> page = this.prodPage(pageParam);
LambdaQueryWrapperX<CircleFriendTask> wrapperX = WrappersX.lambdaQueryX(CircleFriendTask.class);
if (StringUtils.isNotBlank(qo.getStartTime()) && StringUtils.isNotBlank(qo.getEndTime())) {
wrapperX.between(CircleFriendTask::getCreateTime, qo.getStartTime(), qo.getEndTime());
}
wrapperX.eqIfPresent(CircleFriendTask::getUserId, qo.getUserId()).orderByDesc(CircleFriendTask::getId);
this.selectPage(page, wrapperX);
IPage<CircleFriendTaskVO> voPage = page.convert(CircleFriendTaskConverter.INSTANCE::entityToVo);
return new PageResult<>(voPage.getRecords(), voPage.getTotal());
}
}

@ -0,0 +1,35 @@
package com.baiye.modules.scrm.mapper;
import com.baiye.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.scrm.entity.ComparisonRecord;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Set;
/**
* @author Enzo
* @date : 2024/8/19
*/
@Mapper
public interface ComparisonRecordMapper extends ExtendMapper<ComparisonRecord> {
default List<ComparisonRecord> selectListByTaskId(Long taskId, Boolean flag){
LambdaQueryWrapperX<ComparisonRecord> wrapperX = WrappersX.lambdaQueryX(ComparisonRecord.class);
if (Boolean.FALSE.equals(flag)){
wrapperX.select(ComparisonRecord::getRedBookId);
}
wrapperX.eq(ComparisonRecord::getTaskId, taskId);
return selectList(wrapperX);
}
default List<ComparisonRecord> selectListByTaskIdAndRedBookId(Long taskId, Set<String> strings){
LambdaQueryWrapperX<ComparisonRecord> wrapperX = WrappersX.lambdaQueryX(ComparisonRecord.class);
wrapperX.eq(ComparisonRecord::getTaskId, taskId).in(ComparisonRecord::getRedBookId, strings);
return selectList(wrapperX);
}
}

@ -0,0 +1,19 @@
package com.baiye.modules.scrm.mapper;
import com.baiye.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.scrm.entity.ComparisonTaskLog;
import org.apache.ibatis.annotations.Mapper;
/**
* @author Enzo
* @date : 2024/8/19
*/
@Mapper
public interface ComparisonTaskLogMapper extends ExtendMapper<ComparisonTaskLog> {
default Long countByUserAndTaskId(Long taskId, Long currentUserId){
LambdaQueryWrapperX<ComparisonTaskLog> wrapperX = WrappersX.lambdaQueryX();
return this.selectCount(wrapperX.eq(ComparisonTaskLog::getTaskId, taskId).eq(ComparisonTaskLog::getUserId, currentUserId));
}
}

@ -0,0 +1,45 @@
package com.baiye.modules.scrm.mapper;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.scrm.converter.ComparisonConverter;
import com.baiye.modules.scrm.entity.ComparisonTask;
import com.baiye.modules.scrm.qo.ComparisonQO;
import com.baiye.modules.scrm.vo.ComparisonTaskVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.apache.ibatis.annotations.Mapper;
/**
* @author Enzo
* @date : 2024/8/16
*/
@Mapper
public interface ComparisonTaskMapper extends ExtendMapper<ComparisonTask> {
/**
*
*
* @param pageParam
* @param qo
* @return
*/
default PageResult<ComparisonTaskVO> queryPage(PageParam pageParam, ComparisonQO qo) {
IPage<ComparisonTask> page = this.prodPage(pageParam);
LambdaQueryWrapperX<ComparisonTask> wrapperX = WrappersX.lambdaQueryX(ComparisonTask.class);
if (StringUtils.isNotBlank(qo.getStartTime()) && StringUtils.isNotBlank(qo.getEndTime())) {
wrapperX.between(ComparisonTask::getCreateTime, qo.getStartTime(), qo.getEndTime());
}
wrapperX.eqIfPresent(ComparisonTask::getParentId, qo.getUserId()).orderByDesc(ComparisonTask::getId);
this.selectPage(page, wrapperX);
IPage<ComparisonTaskVO> voPage = page.convert(ComparisonConverter.INSTANCE::entityToVo);
return new PageResult<>(voPage.getRecords(), voPage.getTotal());
}
default int setCompleteById(Long taskId) {
return this.update(null, WrappersX.lambdaUpdate(ComparisonTask.class).eq
(ComparisonTask::getId, taskId).set(ComparisonTask::getIsComplete, Boolean.TRUE));
}
}

@ -11,8 +11,10 @@ import com.baiye.modules.scrm.entity.WeChatAccount;
import com.baiye.modules.scrm.qo.AccountQo;
import com.baiye.modules.scrm.vo.WeChatAccountVO;
import com.baiye.modules.scrm.vo.WeChatAddFriendVo;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -35,7 +37,7 @@ public interface LoginEquipmentMapper extends ExtendMapper<LoginEquipment> {
}
wrapperX.likeIfPresent(WeChatAccount::getNickname, qo.getNickname()).likeIfPresent
(WeChatAccount::getWxId, qo.getWxId()).eqIfPresent(WeChatAccount::getUserId, qo.getUserId()).likeIfPresent(WeChatAccount::getWxId, qo.getWxId());
this.selectByPage(page, qo.getStartTime(), qo.getEndTime(), qo.getNickname(), qo.getWxId(), qo.getUserId());
this.selectByPage(page, qo.getStartTime(), qo.getEndTime(), qo.getNickname(), qo.getWxId(), qo.getUserId(), qo.getPacketId());
return new PageResult<>(page.getRecords(), page.getTotal());
}
@ -48,10 +50,12 @@ public interface LoginEquipmentMapper extends ExtendMapper<LoginEquipment> {
* @param username
* @param wxId
* @param userId
* @param packetId
* @return
*/
IPage<WeChatAccountVO> selectByPage(IPage<WeChatAccountVO> page,
@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("username") String username, @Param("wxId") String wxId, @Param("userId") Long userId);
@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("username") String username,
@Param("wxId") String wxId, @Param("userId") Long userId, @Param("packetId") Long packetId);
/**
@ -104,4 +108,20 @@ public interface LoginEquipmentMapper extends ExtendMapper<LoginEquipment> {
default List<LoginEquipment> selectListByTime(DateTime date) {
return this.selectList(WrappersX.lambdaQueryX(LoginEquipment.class).gt(LoginEquipment::getExpirationTime, date));
}
default int deleteByGroupId(Long groupId) {
return delete(WrappersX.lambdaUpdate(LoginEquipment.class).eq(LoginEquipment::getPacketId, groupId));
}
default int updatePacketById(List<Long> idList, Long packetId) {
LambdaUpdateWrapper<LoginEquipment> wrapper = Wrappers.<LoginEquipment>lambdaUpdate()
.set(LoginEquipment::getPacketId, packetId).in(LoginEquipment::getId, idList);
return this.update(null, wrapper);
}
default Long countByRobotId(Long id){
return selectCount(WrappersX.lambdaQueryX(LoginEquipment.class).eq(LoginEquipment::getPacketId, id));
}
List<WeChatAccountVO> queryByPacketId(@Param("packetId") Long id);
}

@ -0,0 +1,67 @@
package com.baiye.modules.scrm.mapper;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.scrm.converter.PayOrderConverter;
import com.baiye.modules.scrm.converter.RobotCustomerConverter;
import com.baiye.modules.scrm.entity.PayOrder;
import com.baiye.modules.scrm.entity.RobotCustomer;
import com.baiye.modules.scrm.qo.RobotCustomerQo;
import com.baiye.modules.scrm.vo.PayOrderVO;
import com.baiye.modules.scrm.vo.RobotCustomerVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author Enzo
* @date : 2024/7/9
*/
@Mapper
public interface RobotCustomerMapper extends ExtendMapper<RobotCustomer> {
/**
* IDID
*
* @param list
* @param wxId
* @return
*/
default List<String> selectListByWxId(List<String> list, String wxId) {
LambdaQueryWrapperX<RobotCustomer> select =
WrappersX.lambdaQueryX(RobotCustomer.class).select(RobotCustomer::getFriendId).eq(RobotCustomer::getWechatId, wxId).in(RobotCustomer::getFriendId, list);
return this.selectList(select).stream().map(RobotCustomer::getFriendId).collect(Collectors.toList());
}
/**
*
*
* @param removeList
* @return
*/
default int deleteByWeChatId(List<String> removeList) {
return this.delete(WrappersX.lambdaQueryX
(RobotCustomer.class).in(RobotCustomer::getFriendId, removeList));
}
/**
*
* @param pageParam
* @param qo
* @return
*/
default PageResult<RobotCustomerVO> queryPage(PageParam pageParam, RobotCustomerQo qo){
IPage<RobotCustomer> page = this.prodPage(pageParam);
LambdaQueryWrapperX<RobotCustomer> wrapperX = WrappersX.lambdaQueryX(RobotCustomer.class);
wrapperX.eqIfPresent(RobotCustomer::getWechatId, qo.getWxId()).likeIfPresent(RobotCustomer::getFriendId, qo.getFriendId()).likeIfPresent(RobotCustomer::getFriendName, qo.getFriendNickname()).orderByDesc(RobotCustomer::getId);
this.selectPage(page, wrapperX);
IPage<RobotCustomerVO> voPage = page.convert(RobotCustomerConverter.INSTANCE::entityToVo);
return new PageResult<>(voPage.getRecords(), voPage.getTotal());
}
}

@ -0,0 +1,61 @@
package com.baiye.modules.scrm.mapper;
import cn.hutool.core.convert.Convert;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.scrm.converter.RobotGroupConverter;
import com.baiye.modules.scrm.entity.RobotGroup;
import com.baiye.modules.scrm.qo.RobotGroupQo;
import com.baiye.modules.scrm.vo.RobotGroupVO;
import com.baiye.modules.scrm.vo.WeChatAccountVO;
import com.baiye.security.userdetails.User;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Enzo
* @date : 2024/8/14
*/
@Mapper
public interface RobotGroupMapper extends ExtendMapper<RobotGroup> {
/**
*
*
* @param pageParam
* @param qo
* @return
*/
default PageResult<RobotGroupVO> queryPage(PageParam pageParam, RobotGroupQo qo) {
IPage<RobotGroup> page = this.prodPage(pageParam);
LambdaQueryWrapperX<RobotGroup> wrapperX = WrappersX.lambdaQueryX(RobotGroup.class);
wrapperX.eqIfPresent(RobotGroup::getUserId, qo.getUserId()).likeIfPresent(RobotGroup::getName, qo.getName()).orderByDesc(RobotGroup::getId);
this.selectPage(page, wrapperX);
IPage<RobotGroupVO> voPage = page.convert(RobotGroupConverter.INSTANCE::entityToVo);
return new PageResult<>(voPage.getRecords(), voPage.getTotal());
}
/**
*
*
* @param name
* @param currentUserId
* @return
*/
default List<RobotGroup> findByName(String name, Long currentUserId) {
return this.selectList(WrappersX.lambdaUpdate(RobotGroup.class).eq
(RobotGroup::getName, name).eq(RobotGroup::getUserId, currentUserId));
}
default List<RobotGroupVO> selectListByUserId(Long currentUserId){
List<RobotGroup> groupList = this.selectList(WrappersX.lambdaUpdate(RobotGroup.class).eq
(RobotGroup::getUserId, currentUserId).eq(RobotGroup::getUserId, currentUserId));
return Convert.toList(RobotGroupVO.class, groupList);
}
}

@ -0,0 +1,45 @@
package com.baiye.modules.scrm.mapper;
import com.baiye.domain.PageParam;
import com.baiye.domain.PageResult;
import com.baiye.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.scrm.converter.PayOrderConverter;
import com.baiye.modules.scrm.converter.StaticResourceConverter;
import com.baiye.modules.scrm.entity.PayOrder;
import com.baiye.modules.scrm.entity.StaticResource;
import com.baiye.modules.scrm.qo.ResourceQo;
import com.baiye.modules.scrm.vo.PayOrderVO;
import com.baiye.modules.scrm.vo.StaticResourceVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.apache.ibatis.annotations.Mapper;
/**
* @author Enzo
* @date 2024-7-2
*/
@Mapper
public interface StaticResourceMapper extends ExtendMapper<StaticResource> {
/**
*
* @param pageParam
* @param qo
* @return
*/
default PageResult<StaticResourceVO> queryPage(PageParam pageParam, ResourceQo qo){
IPage<StaticResource> page = this.prodPage(pageParam);
LambdaQueryWrapperX<StaticResource> wrapperX = WrappersX.lambdaQueryX(StaticResource.class);
if (StringUtils.isNotBlank(qo.getStartTime()) && StringUtils.isNotBlank(qo.getEndTime())) {
wrapperX.between(StaticResource::getCreateTime, qo.getStartTime(), qo.getEndTime());
}
wrapperX.eqIfPresent(StaticResource::getUserId, qo.getUserId());
wrapperX.likeIfPresent(StaticResource::getTitle, qo.getTitle()).orderByDesc(StaticResource::getId);
this.selectPage(page, wrapperX);
IPage<StaticResourceVO> voPage = page.convert(StaticResourceConverter.INSTANCE::entityToVo);
return new PageResult<>(voPage.getRecords(), voPage.getTotal());
}
}

@ -9,6 +9,7 @@ import com.baiye.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.baiye.extend.mybatis.plus.mapper.ExtendMapper;
import com.baiye.extend.mybatis.plus.toolkit.WrappersX;
import com.baiye.modules.scrm.converter.WeChatAccountConverter;
import com.baiye.modules.scrm.entity.LoginEquipment;
import com.baiye.modules.scrm.entity.WeChatAccount;
import com.baiye.modules.scrm.qo.AccountQo;
import com.baiye.modules.scrm.vo.WeChatAccountVO;
@ -27,6 +28,7 @@ import java.util.List;
*/
@Mapper
public interface WeChatAccountMapper extends ExtendMapper<WeChatAccount> {
/**
* id
*
@ -57,7 +59,7 @@ public interface WeChatAccountMapper extends ExtendMapper<WeChatAccount> {
wrapperX.between(WeChatAccount::getCreateTime, qo.getStartTime(), qo.getEndTime());
}
wrapperX.likeIfPresent(WeChatAccount::getNickname, qo.getNickname()).likeIfPresent(WeChatAccount::getWxId, qo.getWxId()).
eqIfPresent(WeChatAccount::getUserId, qo.getUserId()).orderByDesc(WeChatAccount::getId);
eqIfPresent(WeChatAccount::getUserId, qo.getUserId()).eqIfPresent(WeChatAccount::getPacketId,qo.getPacketId()).orderByDesc(WeChatAccount::getId);
this.selectPage(page, wrapperX);
IPage<WeChatAccountVO> voPage = page.convert(WeChatAccountConverter.INSTANCE::entityToVo);
return new PageResult<>(voPage.getRecords(), voPage.getTotal());
@ -85,14 +87,138 @@ public interface WeChatAccountMapper extends ExtendMapper<WeChatAccount> {
LambdaUpdateWrapper<WeChatAccount> wrapper = Wrappers.<WeChatAccount>lambdaUpdate()
.set(WeChatAccount::getRemark, remark)
.eq(WeChatAccount::getWxId, wxId)
.eq(WeChatAccount::getDeleted, DefaultNumberConstants.ZERO_NUMBER);
.eq(WeChatAccount::getWxId, wxId)
.eq(WeChatAccount::getDeleted, DefaultNumberConstants.ZERO_NUMBER);
return SqlHelper.retBool(this.update(null, wrapper));
}
default List<WeChatAccountVO> queryListByQo(AccountQo qo){
/**
*
*
* @param qo
* @return
*/
default List<WeChatAccountVO> queryListByQo(AccountQo qo) {
LambdaQueryWrapperX<WeChatAccount> wrapperX = WrappersX.lambdaQueryX(WeChatAccount.class);
List<WeChatAccount> weChatAccounts = this.selectList(wrapperX.eq(WeChatAccount::getUserId, qo.getUserId()));
List<WeChatAccount> weChatAccounts = this.selectList(wrapperX.likeIfPresent
(WeChatAccount::getNickname, qo.getNickname()).eq(WeChatAccount::getUserId, qo.getUserId()));
return Convert.toList(WeChatAccountVO.class, weChatAccounts);
}
/**
*
*
* @param username
* @param number
* @return
*/
default Long selectCountByWeChatNo(String username, Integer number) {
LambdaQueryWrapperX<WeChatAccount> wrapperX = WrappersX.lambdaQueryX(WeChatAccount.class);
return this.selectCount(wrapperX.eq(WeChatAccount::getWxId, username).eq(WeChatAccount::getDeleted, number));
}
/**
* ID
*
* @param customerId
* @return
*/
default List<WeChatAccountVO> selectListByCustomerId(Long customerId) {
LambdaQueryWrapperX<WeChatAccount> wrapperX = WrappersX.lambdaQueryX(WeChatAccount.class);
return Convert.toList(WeChatAccountVO.class, this.selectList(wrapperX.eq(WeChatAccount::getCustomerId, customerId)));
}
/**
* Id
*
* @param accountIdList
* @return
*/
default List<WeChatAccountVO> selectListByAccountList(List<Long> accountIdList) {
List<WeChatAccount> weChatAccounts = selectBatchIds(accountIdList);
return Convert.toList(WeChatAccountVO.class, weChatAccounts);
}
/**
*
*
* @param customerId
* @param robotIds
* @return
*/
default Integer updateByCustomerIdAndIds(Long customerId, List<Long> robotIds) {
LambdaUpdateWrapper<WeChatAccount> wrapperX = WrappersX.lambdaUpdate(WeChatAccount.class);
wrapperX.set(WeChatAccount::getCustomerId, customerId);
wrapperX.in(WeChatAccount::getId, robotIds);
return this.update(null, wrapperX);
}
/**
* ID
*
* @param customerId
* @return
*/
default Long selectCountByCustomerId(Long customerId) {
LambdaQueryWrapperX<WeChatAccount> wrapperX = WrappersX.lambdaQueryX(WeChatAccount.class);
return this.selectCount(wrapperX.eq(WeChatAccount::getCustomerId, customerId));
}
/**
* IDID
*
* @param userId
* @param id
* @return
*/
default List<WeChatAccountVO> selectListByCustomerIdAndUserId(Long userId, Long id) {
LambdaQueryWrapperX<WeChatAccount> wrapperX = WrappersX.lambdaQueryX(WeChatAccount.class);
return Convert.toList(WeChatAccountVO.class, this.selectList(wrapperX.eq(WeChatAccount::getUserId, userId).eq(WeChatAccount::getCustomerId, id)));
}
/**
*
*
* @param customerId
* @param idList
* @return
*/
default Boolean cancelCustomerIdByRobotIds(Long customerId, List<Long> idList) {
LambdaUpdateWrapper<WeChatAccount> wrapperX = WrappersX.lambdaUpdate(WeChatAccount.class);
wrapperX.set(WeChatAccount::getCustomerId, null);
if (CollUtil.isNotEmpty(idList)) {
wrapperX.in(WeChatAccount::getId, idList);
}
wrapperX.eq(WeChatAccount::getCustomerId, customerId);
return SqlHelper.retBool(update(null, wrapperX));
}
/**
* 线
*
* @param wxId
* @param number
* @return
*/
default Boolean updateWechatOnlineByWxId(String wxId, Integer number) {
LambdaUpdateWrapper<WeChatAccount> wrapperX = WrappersX.lambdaUpdate(WeChatAccount.class);
wrapperX.set(WeChatAccount::getStatus, number);
wrapperX.eq(WeChatAccount::getWxId, wxId);
return SqlHelper.retBool(update(null, wrapperX));
}
default List<WeChatAccountVO> selectListByWechatId(List<String> executeWechatList){
LambdaUpdateWrapper<WeChatAccount> wrapperX = WrappersX.lambdaUpdate(WeChatAccount.class);
return Convert.toList(WeChatAccountVO.class, this.selectList(wrapperX.in(WeChatAccount::getWxId, executeWechatList)));
}
default int updatePacketIdByList(List<Long> idList, Long packetId){
LambdaUpdateWrapper<WeChatAccount> wrapper = Wrappers.<WeChatAccount>lambdaUpdate()
.set(WeChatAccount::getPacketId, packetId).in(WeChatAccount::getId, idList);
return this.update(null, wrapper);
}
}

@ -32,7 +32,7 @@ public interface WeChatGroupMemberMapper extends ExtendMapper<WeChatGroupMember>
default List<String> queryMemberWechatIdByChatRoomId(String userName, Long syncedGroup) {
LambdaQueryWrapperX<WeChatGroupMember> select =
WrappersX.lambdaQueryX(WeChatGroupMember.class).eq(WeChatGroupMember::getChatRoomId, userName).eq
(WeChatGroupMember::getGroupId,syncedGroup).select(WeChatGroupMember::getWechatId);
(WeChatGroupMember::getGroupId, syncedGroup).select(WeChatGroupMember::getWechatId);
return this.selectList(select).stream().map(WeChatGroupMember::getWechatId).collect(Collectors.toList());
}
@ -49,17 +49,21 @@ public interface WeChatGroupMemberMapper extends ExtendMapper<WeChatGroupMember>
/**
* id
*
* @param wxId
* @param groupName
* @param groupId
* @returnx
*/
List<GroupVO> queryMemberWechatIdByWxId(@Param("wxId") String wxId);
List<GroupVO> queryMemberWechatIdByWxId(@Param("wxId") String wxId,@Param("groupName") String groupName,@Param("groupId") String groupId);
/**
* ID
*
* @param groupId
* @return
*/
default List<WeChatGroupMemberVo> queryGroupUserListByGroupId(Long groupId){
default List<WeChatGroupMemberVo> queryGroupUserListByGroupId(Long groupId) {
return Convert.toList(WeChatGroupMemberVo.class, this.selectList
(WrappersX.lambdaQueryX(WeChatGroupMember.class).eq(WeChatGroupMember::getGroupId, groupId)));

@ -27,4 +27,10 @@ public class AccountQo {
@Schema(title = "微信id")
private String wxId;
@Schema(title = "分组ID")
private Long packetId;
@Schema(title = "查询类型 1:查询标签")
private Integer queryType;
}

@ -0,0 +1,31 @@
package com.baiye.modules.scrm.qo;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author Enzo
* @date : 2024/3/29
*/
@Data
public class AddFriendQo {
@Parameter(description = "开始时间")
private String startTime;
@Parameter(description = "结束时间")
private String endTime;
@Parameter(description = "微信小号")
private String trumpetWechat;
@Parameter(description = "对方微信")
private String targetWechat;
@Schema(title = "任务ID")
private Long taskId;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save