提交 a290d60b 作者: 沈振路

延时客服

上级 36db6d37
...@@ -14,10 +14,12 @@ import com.yaoyaozw.customer.constants.CrowdPackageCommonConstant; ...@@ -14,10 +14,12 @@ import com.yaoyaozw.customer.constants.CrowdPackageCommonConstant;
import com.yaoyaozw.customer.constants.CustomerCommonConstant; import com.yaoyaozw.customer.constants.CustomerCommonConstant;
import com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO; import com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO;
import com.yaoyaozw.customer.entity.CustomerGraphics; import com.yaoyaozw.customer.entity.CustomerGraphics;
import com.yaoyaozw.customer.entity.CustomerGraphicsDelay;
import com.yaoyaozw.customer.entity.ReferralEntity; import com.yaoyaozw.customer.entity.ReferralEntity;
import com.yaoyaozw.customer.entity.RegisterUserEntity; import com.yaoyaozw.customer.entity.RegisterUserEntity;
import com.yaoyaozw.customer.enums.CustomerStoreTemplateEnum; import com.yaoyaozw.customer.enums.CustomerStoreTemplateEnum;
import com.yaoyaozw.customer.feigns.ReferralFeignClient; import com.yaoyaozw.customer.feigns.ReferralFeignClient;
import com.yaoyaozw.customer.mapper.CustomerGraphicsDelayMapper;
import com.yaoyaozw.customer.mapper.CustomerGraphicsMapper; import com.yaoyaozw.customer.mapper.CustomerGraphicsMapper;
import com.yaoyaozw.customer.mapper.KanbanCommonMapper; import com.yaoyaozw.customer.mapper.KanbanCommonMapper;
import com.yaoyaozw.customer.mapper.MaterialCommonMapper; import com.yaoyaozw.customer.mapper.MaterialCommonMapper;
...@@ -69,6 +71,8 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -69,6 +71,8 @@ public class CustomerServiceCommonAsyncComponent {
private CustomerGraphicsMapper customerGraphicsMapper; private CustomerGraphicsMapper customerGraphicsMapper;
@Autowired @Autowired
private KanbanCommonMapper kanbanCommonMapper; private KanbanCommonMapper kanbanCommonMapper;
@Autowired
private CustomerGraphicsDelayMapper customerGraphicsDelayMapper;
@Async("myExecutor") @Async("myExecutor")
...@@ -155,10 +159,23 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -155,10 +159,23 @@ public class CustomerServiceCommonAsyncComponent {
} }
} }
// 处理完之后将状态改为待发送 // 处理完之后将状态改为待发送
customerGraphics.setSendStatus(2); customerGraphics.setSendStatus(CustomerCommonConstant.SEND_STATUS_LINK_FINISH);
customerGraphicsMapper.updateById(customerGraphics); customerGraphicsMapper.updateById(customerGraphics);
} }
@Async("myExecutor")
public void obtainDelayLink(Long materialId, CustomerGraphicsDelay customerGraphicsDelay, List<ReferralEntity> referralEntityList) {
}
private void getMessageAuthListLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, CustomerGraphics customerMain, ReferralEntity customerReferral) { private void getMessageAuthListLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, CustomerGraphics customerMain, ReferralEntity customerReferral) {
......
...@@ -52,6 +52,17 @@ public class CustomerCommonConstant { ...@@ -52,6 +52,17 @@ public class CustomerCommonConstant {
public final static String CUSTOMER_TYPE_NAME_TEXT = "文本"; public final static String CUSTOMER_TYPE_NAME_TEXT = "文本";
public final static Integer SEND_STATUS_WAITING = 0;
public final static Integer SEND_STATUS_LINK_GETTING = 1;
public final static Integer SEND_STATUS_LINK_FINISH = 2;
public final static Integer SEND_STATUS_SENT_SUCCESS = 3;
public final static Integer SEND_STATUS_SENT_FAIL = 4;
public static String getCustomerType(String type) { public static String getCustomerType(String type) {
if (ObjectUtil.isNull(type)) { if (ObjectUtil.isNull(type)) {
return null; return null;
......
...@@ -5,19 +5,16 @@ import com.yaoyaozw.customer.common.BaseResult; ...@@ -5,19 +5,16 @@ import com.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.common.GenericsResult; import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO; import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO;
import com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO; import com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO;
import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO;
import com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO;
import com.yaoyaozw.customer.service.CustomerGraphicsDelayService; import com.yaoyaozw.customer.service.CustomerGraphicsDelayService;
import com.yaoyaozw.customer.vo.AuthInfoVO; import com.yaoyaozw.customer.vo.AuthInfoVO;
import com.yaoyaozw.customer.vo.CommonOptionResponseVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayListVO; import com.yaoyaozw.customer.vo.customer.CustomerDelayListVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayDetailVO; import com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayListVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -26,7 +23,7 @@ import java.util.List; ...@@ -26,7 +23,7 @@ import java.util.List;
*/ */
@Api(tags = "延时客服接口") @Api(tags = "延时客服接口")
@RestController @RestController
@RequestMapping("/customer-service/delay") @RequestMapping("/customer-service/delay/graphics")
public class CustomerDelayGraphicsController { public class CustomerDelayGraphicsController {
@Autowired @Autowired
...@@ -41,7 +38,7 @@ public class CustomerDelayGraphicsController { ...@@ -41,7 +38,7 @@ public class CustomerDelayGraphicsController {
@ApiOperation("获取详情") @ApiOperation("获取详情")
@GetMapping("/detail/{id}") @GetMapping("/detail/{id}")
public GenericsResult<CustomerDelayDetailVO> getCustomerDelayDetail(@PathVariable("id") Long id) { public GenericsResult<CustomerDelayGraphicsDetailVO> getCustomerDelayDetail(@PathVariable("id") Long id) {
return customerGraphicsDelayService.getCustomerDelayDetail(id); return customerGraphicsDelayService.getCustomerDelayDetail(id);
} }
...@@ -51,22 +48,40 @@ public class CustomerDelayGraphicsController { ...@@ -51,22 +48,40 @@ public class CustomerDelayGraphicsController {
return customerGraphicsDelayService.pageList(queryDto); return customerGraphicsDelayService.pageList(queryDto);
} }
@ApiOperation("获取已生成客服的公众号列表")
@GetMapping("/getExistCustomerAccount")
public GenericsResult<List<AuthInfoVO>> getExistCustomerAccount(@RequestParam(required = false) String keyword) {
return customerGraphicsDelayService.getExistCustomerAccount(keyword);
}
@ApiOperation("删除") @ApiOperation("删除")
@GetMapping("/remove/{id}") @GetMapping("/remove/{id}")
public BaseResult removeCustomerDelay(@PathVariable("id") Long id) { public BaseResult removeCustomerDelay(@PathVariable("id") Long id) {
return customerGraphicsDelayService.removeCustomerDelay(id); return customerGraphicsDelayService.removeCustomerDelay(id);
} }
@ApiOperation("获取已生成客服的公众号列表")
@GetMapping("/getExistCustomerAccount")
public GenericsResult<List<AuthInfoVO>> getExistCustomerAccount() {
return customerGraphicsDelayService.getExistCustomerAccount();
}
@ApiOperation("批量删除") @ApiOperation("批量删除")
@PostMapping("/removeBatch") @PostMapping("/removeBatch")
public BaseResult removeBatch(@RequestBody List<Long> idList) { public BaseResult removeBatch(@RequestBody List<Long> idList) {
return customerGraphicsDelayService.removeBatch(idList); return customerGraphicsDelayService.removeBatch(idList);
} }
@ApiOperation("复用")
@PostMapping("/copy")
public BaseResult copy(@RequestParam String appId, @RequestBody List<String> targetAppList) {
return customerGraphicsDelayService.copy(appId, targetAppList);
}
@ApiOperation("所有公众号")
@GetMapping("/getAuthList")
public GenericsResult<List<AuthInfoVO>> getAuthList(@RequestParam(required = false) String keyword) {
return customerGraphicsDelayService.getAuthList(keyword);
}
@ApiOperation("时间间隔")
@GetMapping("/getTimeIntervalList")
public GenericsResult<List<CommonOptionResponseVO>> getTimeIntervalList() {
return customerGraphicsDelayService.getTimeIntervalList();
}
} }
...@@ -14,8 +14,10 @@ import java.io.Serializable; ...@@ -14,8 +14,10 @@ import java.io.Serializable;
@ApiModel("延时客服保存实体") @ApiModel("延时客服保存实体")
public class CustomerDelaySaveDTO implements Serializable { public class CustomerDelaySaveDTO implements Serializable {
@ApiModelProperty("主键ID")
private Long id; private Long id;
@ApiModelProperty("公众号appId")
private String appId; private String appId;
@ApiModelProperty("客服消息名称") @ApiModelProperty("客服消息名称")
......
...@@ -11,7 +11,7 @@ import java.io.Serializable; ...@@ -11,7 +11,7 @@ import java.io.Serializable;
* @date 2022/9/15 11:14 * @date 2022/9/15 11:14
*/ */
@Data @Data
@ApiModel("延时客服保存实体") @ApiModel("客服消息保存实体")
public class CustomerMessageSaveDTO implements Serializable { public class CustomerMessageSaveDTO implements Serializable {
private static final long serialVersionUID = -4269904448093268275L; private static final long serialVersionUID = -4269904448093268275L;
......
package com.yaoyaozw.customer.entity;
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.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author didi
* @Create 2022/3/23 19:26
*/
@ApiModel(value="authorizer_info")
@Data
@TableName(value = "authorizer_info")
public class AuthorizerInfo implements Serializable {
@TableId(value = "id", type = IdType.INPUT)
@ApiModelProperty(value="")
private Long id;
@TableField(value = "`alias`")
@ApiModelProperty(value="")
private String alias;
@TableField(value = "appid")
@ApiModelProperty(value="")
private String appid;
@TableField(value = "create_time")
@ApiModelProperty(value="")
private Date createTime;
@TableField(value = "head_img")
@ApiModelProperty(value="")
private String headImg;
@TableField(value = "nick_name")
@ApiModelProperty(value="")
private String nickName;
@TableField(value = "principal_name")
@ApiModelProperty(value="")
private String principalName;
@TableField(value = "qrcode_url")
@ApiModelProperty(value="")
private String qrcodeUrl;
@TableField(value = "service_type_info")
@ApiModelProperty(value="")
private String serviceTypeInfo;
@TableField(value = "user_name")
@ApiModelProperty(value="")
private String userName;
@TableField(value = "verify_type_info")
@ApiModelProperty(value="")
private String verifyTypeInfo;
@TableField(value = "account_id")
@ApiModelProperty(value="")
private String accountId;
@TableField(value = "store_type")
@ApiModelProperty(value="")
private String storeType;
@TableField(exist = false)
@ApiModelProperty(value="")
private String storeTypeName;
private static final long serialVersionUID = 1L;
public static final String COL_ID = "id";
public static final String COL_ALIAS = "alias";
public static final String COL_APPID = "appid";
public static final String COL_CREATE_TIME = "create_time";
public static final String COL_HEAD_IMG = "head_img";
public static final String COL_NICK_NAME = "nick_name";
public static final String COL_PRINCIPAL_NAME = "principal_name";
public static final String COL_QRCODE_URL = "qrcode_url";
public static final String COL_SERVICE_TYPE_INFO = "service_type_info";
public static final String COL_USER_NAME = "user_name";
public static final String COL_VERIFY_TYPE_INFO = "verify_type_info";
public static final String COL_ACCOUNT_ID = "account_id";
}
\ No newline at end of file
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
import lombok.Data; import lombok.Data;
...@@ -18,7 +19,7 @@ import lombok.Data; ...@@ -18,7 +19,7 @@ import lombok.Data;
@Data @Data
@TableName(value = "customer_graphics_delay") @TableName(value = "customer_graphics_delay")
public class CustomerGraphicsDelay implements Serializable { public class CustomerGraphicsDelay implements Serializable {
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.ID_WORKER)
private Long id; private Long id;
/** /**
...@@ -104,7 +105,13 @@ public class CustomerGraphicsDelay implements Serializable { ...@@ -104,7 +105,13 @@ public class CustomerGraphicsDelay implements Serializable {
* 逻辑删除 * 逻辑删除
*/ */
@TableField(value = "is_deleted") @TableField(value = "is_deleted")
private Boolean isDeleted; private Integer isDeleted;
@TableField(exist = false)
private List<ReferralEntity> belongReferralList;
@TableField(exist = false)
private AuthorizerInfo authorizerInfo;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
package com.yaoyaozw.customer.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yaoyaozw.customer.entity.AuthorizerInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* @Author didi
* @Create 2022/3/23 19:26
*/
@Mapper
@DS("material")
public interface AuthorizerInfoMapper extends BaseMapper<AuthorizerInfo> {
}
\ No newline at end of file
...@@ -4,6 +4,8 @@ import com.baomidou.dynamic.datasource.annotation.DS; ...@@ -4,6 +4,8 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO; import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO;
import com.yaoyaozw.customer.entity.CustomerGraphicsDelay; import com.yaoyaozw.customer.entity.CustomerGraphicsDelay;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import com.yaoyaozw.customer.vo.CommonOptionResponseVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO; import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayListVO; import com.yaoyaozw.customer.vo.customer.CustomerDelayListVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -13,18 +15,18 @@ import java.util.List; ...@@ -13,18 +15,18 @@ import java.util.List;
import java.util.Set; import java.util.Set;
@DS("material") @DS("material")
@Mapper @Mapper
public interface CustomerGraphicsDelayMapper extends BaseMapper<CustomerGraphicsDelay> { public interface CustomerGraphicsDelayMapper extends BaseMapper<CustomerGraphicsDelay> {
/** /**
* 根据appid找延时客服 * 根据appid找延时客服
*
* @param appidList * @param appidList
* @return * @return
*/ */
List<CustomerDelayItemVO> findAllDelayCustomerMessage(@Param("appidList") Set<String> appidList); List<CustomerDelayItemVO> findAllDelayCustomerMessage(@Param("appidList") Set<String> appidList);
List<CustomerDelayItemVO> findDelayCustomerMessageByRange(@Param("appidList")Set<String> appidList,@Param("maxSort")Integer maxSort); List<CustomerDelayItemVO> findDelayCustomerMessageByRange(@Param("appidList") Set<String> appidList, @Param("maxSort") Integer maxSort);
/** /**
* 页面列表 * 页面列表
...@@ -33,4 +35,28 @@ public interface CustomerGraphicsDelayMapper extends BaseMapper<CustomerGraphics ...@@ -33,4 +35,28 @@ public interface CustomerGraphicsDelayMapper extends BaseMapper<CustomerGraphics
* @return {@link List}<{@link CustomerDelayListVO}> * @return {@link List}<{@link CustomerDelayListVO}>
*/ */
List<CustomerDelayListVO> pageList(CustomerDelayQueryDTO queryDto); List<CustomerDelayListVO> pageList(CustomerDelayQueryDTO queryDto);
/**
* 得到客户账户存在
*
* @param keyword 关键字
* @return {@link List}<{@link AuthInfoVO}>
*/
List<AuthInfoVO> getExistCustomerAccount(@Param("keyword") String keyword);
/**
* 让时间间隔列表
*
* @param keyword 关键词
* @return {@link List}<{@link AuthInfoVO}>
*/
List<AuthInfoVO> getAuthList(@Param("keyword") String keyword);
/**
* 让时间间隔列表
*
* @return {@link List}<{@link CommonOptionResponseVO}>
*/
List<CommonOptionResponseVO> getTimeIntervalList();
} }
\ No newline at end of file
package com.yaoyaozw.customer.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yaoyaozw.customer.entity.AuthorizerInfo;
/**
* 授权人信息服务
*
* @author Admin
* @date 2022/10/14
*/
public interface AuthorizerInfoService extends IService<AuthorizerInfo> {
}
...@@ -8,7 +8,8 @@ import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO; ...@@ -8,7 +8,8 @@ import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO;
import com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO; import com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO;
import com.yaoyaozw.customer.entity.CustomerGraphicsDelay; import com.yaoyaozw.customer.entity.CustomerGraphicsDelay;
import com.yaoyaozw.customer.vo.AuthInfoVO; import com.yaoyaozw.customer.vo.AuthInfoVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayDetailVO; import com.yaoyaozw.customer.vo.CommonOptionResponseVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO; import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayListVO; import com.yaoyaozw.customer.vo.customer.CustomerDelayListVO;
...@@ -35,9 +36,9 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD ...@@ -35,9 +36,9 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD
* 得到客户延迟细节 * 得到客户延迟细节
* *
* @param id id * @param id id
* @return {@link GenericsResult}<{@link CustomerDelayDetailVO}> * @return {@link GenericsResult}<{@link CustomerDelayGraphicsDetailVO}>
*/ */
GenericsResult<CustomerDelayDetailVO> getCustomerDelayDetail(Long id); GenericsResult<CustomerDelayGraphicsDetailVO> getCustomerDelayDetail(Long id);
/** /**
* 页面列表 * 页面列表
...@@ -48,6 +49,14 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD ...@@ -48,6 +49,14 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD
GenericsResult<PageInfo<CustomerDelayListVO>> pageList(CustomerDelayQueryDTO queryDto); GenericsResult<PageInfo<CustomerDelayListVO>> pageList(CustomerDelayQueryDTO queryDto);
/** /**
* 得到客户账户存在
*
* @param keyword 关键词
* @return {@link GenericsResult}<{@link List}<{@link AuthInfoVO}>>
*/
GenericsResult<List<AuthInfoVO>> getExistCustomerAccount(String keyword);
/**
* 删除客户延迟 * 删除客户延迟
* *
* @param id id * @param id id
...@@ -56,18 +65,35 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD ...@@ -56,18 +65,35 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD
BaseResult removeCustomerDelay(Long id); BaseResult removeCustomerDelay(Long id);
/** /**
* 得到客户账户存在 * 删除批处理
* *
* @return {@link GenericsResult}<{@link List}<{@link AuthInfoVO}>> * @param idList id列表
* @return {@link BaseResult}
*/ */
GenericsResult<List<AuthInfoVO>> getExistCustomerAccount(); BaseResult removeBatch(List<Long> idList);
/** /**
* 删除批处理 * 复制
* *
* @param idList id列表 * @param appId 应用程序id
* @param targetAppList 目标应用程序列表
* @return {@link BaseResult} * @return {@link BaseResult}
*/ */
BaseResult removeBatch(List<Long> idList); BaseResult copy(String appId, List<String> targetAppList);
/**
* 获得认证列表
*
* @param keyword 关键字
* @return {@link GenericsResult}<{@link List}<{@link AuthInfoVO}>>
*/
GenericsResult<List<AuthInfoVO>> getAuthList(String keyword);
/**
* 让时间间隔列表
*
* @return {@link GenericsResult}<{@link List}<{@link CommonOptionResponseVO}>>
*/
GenericsResult<List<CommonOptionResponseVO>> getTimeIntervalList();
} }
package com.yaoyaozw.customer.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yaoyaozw.customer.entity.AuthorizerInfo;
import com.yaoyaozw.customer.mapper.AuthorizerInfoMapper;
import com.yaoyaozw.customer.service.AuthorizerInfoService;
import org.springframework.stereotype.Service;
/**
* 授权人信息服务impl
*
* @author Admin
* @date 2022/10/14
*/
@Service
public class AuthorizerInfoServiceImpl extends ServiceImpl<AuthorizerInfoMapper, AuthorizerInfo> implements AuthorizerInfoService {
}
package com.yaoyaozw.customer.service.impl; package com.yaoyaozw.customer.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -9,25 +14,33 @@ import com.yaoyaozw.customer.common.BaseResult; ...@@ -9,25 +14,33 @@ import com.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.common.GenericsResult; import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.components.SnowflakeComponent; import com.yaoyaozw.customer.components.SnowflakeComponent;
import com.yaoyaozw.customer.components.TokenManager; import com.yaoyaozw.customer.components.TokenManager;
import com.yaoyaozw.customer.constants.CustomerCommonConstant;
import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO; import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO;
import com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO; import com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
import com.yaoyaozw.customer.entity.AuthorizerInfo;
import com.yaoyaozw.customer.entity.CustomerGraphicsDelay; import com.yaoyaozw.customer.entity.CustomerGraphicsDelay;
import com.yaoyaozw.customer.entity.ReferralEntity; import com.yaoyaozw.customer.entity.ReferralEntity;
import com.yaoyaozw.customer.mapper.CustomerGraphicsDelayMapper; import com.yaoyaozw.customer.mapper.CustomerGraphicsDelayMapper;
import com.yaoyaozw.customer.mapper.KanbanCommonMapper;
import com.yaoyaozw.customer.service.AuthorizerInfoService;
import com.yaoyaozw.customer.service.CustomerGraphicsDelayService; import com.yaoyaozw.customer.service.CustomerGraphicsDelayService;
import com.yaoyaozw.customer.service.CustomerTextDelayService;
import com.yaoyaozw.customer.service.ReferralEntityService; import com.yaoyaozw.customer.service.ReferralEntityService;
import com.yaoyaozw.customer.vo.AuthInfoVO; import com.yaoyaozw.customer.vo.AuthInfoVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayDetailVO; import com.yaoyaozw.customer.vo.CommonOptionResponseVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayGraphicsDetailVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO; import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayListVO; import com.yaoyaozw.customer.vo.customer.CustomerDelayListVO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.List; import java.util.*;
import java.util.Set; import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* @author darker * @author darker
...@@ -44,6 +57,10 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -44,6 +57,10 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
private SnowflakeComponent snowflakeComponent; private SnowflakeComponent snowflakeComponent;
@Autowired @Autowired
private ReferralEntityService referralEntityService; private ReferralEntityService referralEntityService;
@Autowired
private AuthorizerInfoService authorizerInfoService;
@Autowired
private KanbanCommonMapper kanbanCommonMapper;
@Override @Override
...@@ -59,6 +76,7 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -59,6 +76,7 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public BaseResult insertCustomerDelay(CustomerDelaySaveDTO saveDto) { public BaseResult insertCustomerDelay(CustomerDelaySaveDTO saveDto) {
CustomerGraphicsDelay customerGraphicsDelay = new CustomerGraphicsDelay(); CustomerGraphicsDelay customerGraphicsDelay = new CustomerGraphicsDelay();
...@@ -70,26 +88,55 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -70,26 +88,55 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
localLog.info("是新增, 新生成ID: {}", id); localLog.info("是新增, 新生成ID: {}", id);
customerGraphicsDelay.setId(id); customerGraphicsDelay.setId(id);
} }
super.saveOrUpdate(customerGraphicsDelay);
customerGraphicsDelay.setSendStatus(CustomerCommonConstant.SEND_STATUS_LINK_GETTING);
boolean mainResult = super.saveOrUpdate(customerGraphicsDelay);
if (!mainResult) {
localLog.info("主体数据生成异常");
return new BaseResult().error("新增/更新 主体数据异常");
}
localLog.info("生成referral数据"); localLog.info("生成referral数据");
ReferralEntity referralEntity = new ReferralEntity(); ReferralEntity referralEntity = new ReferralEntity();
referralEntity.setMaterialGraphicsId(customerGraphicsDelay.getId()); referralEntity.setMaterialGraphicsId(customerGraphicsDelay.getId());
BeanUtil.copyProperties(referralEntity, saveDto.getCustomerReferralDto()); BeanUtil.copyProperties(referralEntity, saveDto.getCustomerReferralDto());
referralEntityService.saveOrUpdate(referralEntity); boolean referralResult = referralEntityService.saveOrUpdate(referralEntity);
if (!referralResult) {
localLog.info("referral数据生成异常, 回滚事务");
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
// TODO: 2022/10/14 生成链接
return new BaseResult().success(); return new BaseResult().success();
} }
@Override @Override
public GenericsResult<CustomerDelayDetailVO> getCustomerDelayDetail(Long id) { public GenericsResult<CustomerDelayGraphicsDetailVO> getCustomerDelayDetail(Long id) {
return null; CustomerGraphicsDelay customerGraphicsDelay = super.getById(id);
if (ObjectUtil.isNull(customerGraphicsDelay)) {
return new GenericsResult<>(false, "找不到主体数据");
}
CustomerDelayGraphicsDetailVO customerDelayGraphicsDetailVO = new CustomerDelayGraphicsDetailVO();
BeanUtil.copyProperties(customerGraphicsDelay, customerDelayGraphicsDetailVO);
// 查询链接数据
ReferralEntity referralEntity = referralEntityService.getOne(new QueryWrapper<ReferralEntity>().eq("material_graphics_id", id));
if (ObjectUtil.isNull(referralEntity)) {
return new GenericsResult<>(false, "找不到链接数据");
}
CustomerReferralDTO customerReferralDto = new CustomerReferralDTO();
BeanUtil.copyProperties(referralEntity, customerReferralDto);
customerDelayGraphicsDetailVO.setCustomerReferralDto(customerReferralDto);
return new GenericsResult<>(customerDelayGraphicsDetailVO);
} }
@Override @Override
public GenericsResult<PageInfo<CustomerDelayListVO>> pageList(CustomerDelayQueryDTO queryDto) { public GenericsResult<PageInfo<CustomerDelayListVO>> pageList(CustomerDelayQueryDTO queryDto) {
PageHelper.startPage(queryDto.getPageSize(), queryDto.getCurrentPage()); PageHelper.startPage(queryDto.getCurrentPage(), queryDto.getPageSize());
List<CustomerDelayListVO> customerDelayList = super.baseMapper.pageList(queryDto); List<CustomerDelayListVO> customerDelayList = super.baseMapper.pageList(queryDto);
PageInfo<CustomerDelayListVO> pageResult = new PageInfo<>(customerDelayList); PageInfo<CustomerDelayListVO> pageResult = new PageInfo<>(customerDelayList);
...@@ -97,18 +144,85 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -97,18 +144,85 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
} }
@Override @Override
public GenericsResult<List<AuthInfoVO>> getExistCustomerAccount(String keyword) {
List<AuthInfoVO> existCustomerAccount = super.baseMapper.getExistCustomerAccount(keyword);
return new GenericsResult<>(existCustomerAccount);
}
@Override
public BaseResult removeCustomerDelay(Long id) { public BaseResult removeCustomerDelay(Long id) {
return null; return null;
} }
@Override @Override
public GenericsResult<List<AuthInfoVO>> getExistCustomerAccount() { public BaseResult removeBatch(List<Long> idList) {
return null; return null;
} }
@Override @Override
public BaseResult removeBatch(List<Long> idList) { public BaseResult copy(String appId, List<String> targetAppList) {
List<AuthorizerInfo> authorizerInfoList = authorizerInfoService.list();
Map<String, AuthorizerInfo> authMap = authorizerInfoList.stream().collect(Collectors.toMap(AuthorizerInfo::getAppid, Function.identity()));
AuthorizerInfo sourceAuthInfo = authMap.get(appId);
if (ObjectUtil.isNull(sourceAuthInfo)) {
return new BaseResult().error("找不到公众号信息");
}
String accountId = sourceAuthInfo.getAccountId();
localLog.info("原始accountId: {}", accountId);
// 找到号下面的所有的客服素材
List<CustomerGraphicsDelay> sourceCustomerList = super.list(new QueryWrapper<CustomerGraphicsDelay>().eq("app_id", appId));
List<Long> sourceMainIdList = sourceCustomerList.stream().map(CustomerGraphicsDelay::getId).collect(Collectors.toList());
// 获取原始链接素材
List<ReferralEntity> referralEntityList = referralEntityService.list(new QueryWrapper<ReferralEntity>().in("material_graphics_id", sourceMainIdList));
Map<Long, List<ReferralEntity>> referralGroupMap = referralEntityList.stream().collect(Collectors.groupingBy(ReferralEntity::getMaterialGraphicsId));
// 遍历处理
HashSet<String> storeTypeKeySet = CollectionUtil.newHashSet(sourceAuthInfo.getStoreType());
List<CommonOptionResponseVO> storeTypeList = kanbanCommonMapper.getStoreTypeEntity(storeTypeKeySet);
// 这里只有一个
String storeTypeName = storeTypeList.get(0).getName();
localLog.info("当前复用书城: {}", storeTypeName);
sourceAuthInfo.setStoreTypeName(storeTypeName);
for (String targetAppId : targetAppList) {
// 构造目标公众号的信息
AuthorizerInfo targetAuthInfo = authMap.get(targetAppId);
if (ObjectUtil.isNull(targetAuthInfo)) {
localLog.info("appId: {} 找不到对应公众号", targetAppId);
// 执行下一个公众号
continue;
}
targetAuthInfo.setStoreTypeName(storeTypeName);
// 遍历要复用的素材
for (CustomerGraphicsDelay item : sourceCustomerList) {
// 设置所属链接
item.setBelongReferralList(referralGroupMap.get(item.getId()));
// 为公众号设置书城名
item.setAuthorizerInfo(sourceAuthInfo);
// 执行复用
}
}
return null; return null;
} }
@Override
public GenericsResult<List<AuthInfoVO>> getAuthList(String keyword) {
List<AuthInfoVO> authList = super.baseMapper.getAuthList(keyword);
return new GenericsResult<>(authList);
}
@Override
public GenericsResult<List<CommonOptionResponseVO>> getTimeIntervalList() {
List<CommonOptionResponseVO> timeIntervalList = super.baseMapper.getTimeIntervalList();
return new GenericsResult<>(timeIntervalList);
}
} }
...@@ -39,12 +39,10 @@ import com.yaoyaozw.customer.service.CrowdPackageConditionService; ...@@ -39,12 +39,10 @@ import com.yaoyaozw.customer.service.CrowdPackageConditionService;
import com.yaoyaozw.customer.service.ReferralEntityService; import com.yaoyaozw.customer.service.ReferralEntityService;
import com.yaoyaozw.customer.vo.AuthInfoVO; import com.yaoyaozw.customer.vo.AuthInfoVO;
import com.yaoyaozw.customer.vo.CommonOptionResponseVO; import com.yaoyaozw.customer.vo.CommonOptionResponseVO;
import com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO; import com.yaoyaozw.customer.vo.customer.*;
import com.yaoyaozw.customer.vo.customer.CustomerMessageDetailVO;
import com.yaoyaozw.customer.service.*; import com.yaoyaozw.customer.service.*;
import com.yaoyaozw.customer.service.wechat.service.WeChatService; import com.yaoyaozw.customer.service.wechat.service.WeChatService;
import com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO; import com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO;
import com.yaoyaozw.customer.vo.customer.CustomerMessageListVO;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.yaoyaozw.customer.vo.referral.ReferralEntityVo; import com.yaoyaozw.customer.vo.referral.ReferralEntityVo;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -222,7 +220,7 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap ...@@ -222,7 +220,7 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
byId.setPackId(packId); byId.setPackId(packId);
// 设置状态为链接生成中 // 设置状态为链接生成中
byId.setSendStatus(1); byId.setSendStatus(CustomerCommonConstant.SEND_STATUS_LINK_GETTING);
boolean result = super.updateById(byId); boolean result = super.updateById(byId);
if (result) { if (result) {
commonAsyncComponent.obtainMessageLink(id, byId, referralEntityList); commonAsyncComponent.obtainMessageLink(id, byId, referralEntityList);
......
package com.yaoyaozw.customer.service.impl; package com.yaoyaozw.customer.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageInfo;
import com.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.components.SnowflakeComponent;
import com.yaoyaozw.customer.components.TokenManager;
import com.yaoyaozw.customer.constants.CustomerCommonConstant;
import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO;
import com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
import com.yaoyaozw.customer.entity.CustomerGraphicsDelay; import com.yaoyaozw.customer.entity.CustomerGraphicsDelay;
import com.yaoyaozw.customer.entity.ReferralEntity;
import com.yaoyaozw.customer.mapper.CustomerGraphicsDelayMapper; import com.yaoyaozw.customer.mapper.CustomerGraphicsDelayMapper;
import com.yaoyaozw.customer.service.CustomerGraphicsDelayService;
import com.yaoyaozw.customer.service.CustomerTextDelayService; import com.yaoyaozw.customer.service.CustomerTextDelayService;
import com.yaoyaozw.customer.service.ReferralEntityService;
import com.yaoyaozw.customer.vo.customer.CustomerDelayDetailVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayListVO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Set;
/** /**
* @author darker * @author darker
* @date 2022/9/15 11:13 * @date 2022/9/15 11:13
......
package com.yaoyaozw.customer.vo; package com.yaoyaozw.customer.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -11,14 +14,23 @@ import java.io.Serializable; ...@@ -11,14 +14,23 @@ import java.io.Serializable;
@Data @Data
public class AuthInfoVO implements Serializable { public class AuthInfoVO implements Serializable {
@ApiModelProperty("主键ID")
@JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;
@ApiModelProperty("appId")
private String appId;
@ApiModelProperty("渠道号")
private String accountId; private String accountId;
@ApiModelProperty("公众号名")
private String accountName; private String accountName;
@ApiModelProperty("书城拼音")
private String storeType; private String storeType;
@ApiModelProperty("书城名")
private String storeTypeName; private String storeTypeName;
} }
...@@ -13,23 +13,23 @@ import java.io.Serializable; ...@@ -13,23 +13,23 @@ import java.io.Serializable;
* @date 2022/10/8 17:13 * @date 2022/10/8 17:13
*/ */
@Data @Data
public class CustomerDelayDetailVO implements Serializable { public class CustomerDelayGraphicsDetailVO implements Serializable {
@ApiModelProperty("客服消息id") @ApiModelProperty("客服消息id")
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;
@ApiModelProperty("公众号ID")
private String appId;
@ApiModelProperty("标题") @ApiModelProperty("标题")
private String name; private String name;
@ApiModelProperty("是否支付 0-否 1-是")
private Integer isPay;
@ApiModelProperty("客服消息类型(图文、文本)") @ApiModelProperty("客服消息类型(图文、文本)")
private String type; private String type;
@ApiModelProperty("推广标题") @ApiModelProperty("是否支付 0-否 1-是")
private String extendTitle; private Integer isPay;
@ApiModelProperty("素材图片路径") @ApiModelProperty("素材图片路径")
private String coverUrl; private String coverUrl;
......
package com.yaoyaozw.customer.vo.customer; package com.yaoyaozw.customer.vo.customer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yaoyaozw.customer.constants.CustomerCommonConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -11,7 +15,37 @@ import java.io.Serializable; ...@@ -11,7 +15,37 @@ import java.io.Serializable;
@Data @Data
public class CustomerDelayListVO implements Serializable { public class CustomerDelayListVO implements Serializable {
@ApiModelProperty("客服消息id")
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@ApiModelProperty("公众号")
private String accountName;
@ApiModelProperty("客服消息类型(图文、文本)")
private String type;
@ApiModelProperty("标题")
private String name;
@ApiModelProperty("消息发送时间")
private String postTime;
@ApiModelProperty("发文排序")
private Integer postSort;
@ApiModelProperty("时间间隔")
private String timeInterval;
@ApiModelProperty("发送状态值")
private String sendStatus;
@ApiModelProperty("发送状态描述")
private String sendStatusStr;
public String getType() {
return CustomerCommonConstant.getCustomerType(this.type);
}
} }
...@@ -17,6 +17,7 @@ mybatis-plus: ...@@ -17,6 +17,7 @@ mybatis-plus:
cache-enabled: false cache-enabled: false
call-setters-on-nulls: true call-setters-on-nulls: true
jdbc-type-for-null: 'null' jdbc-type-for-null: 'null'
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
logging: logging:
level: level:
com.example.material.mapper: debug com.example.material.mapper: debug
...@@ -36,5 +36,69 @@ ...@@ -36,5 +36,69 @@
</select> </select>
<select id="pageList" resultType="com.yaoyaozw.customer.vo.customer.CustomerDelayListVO"> <select id="pageList" resultType="com.yaoyaozw.customer.vo.customer.CustomerDelayListVO">
select
cgd.id,
cgd.name,
cgd.type,
ai.nick_name as accountName,
cgd.post_sort as postSort,
t_dic.dic_value as timeInterval,
s_dic.dic_value as sendStatus
from customer_graphics_delay cgd
left join authorizer_info ai
on cgd.app_id = ai.appid
left join sys_dictionary t_dic
on t_dic.group_id = 'CUSTOMER_TIME_INTERVAL'
and t_dic.dic_key = cgd.time_interval
left join sys_dictionary s_dic
on s_dic.group_id = 'CUSTOMER_SEND_STATUS'
and s_dic.dic_key = cgd.send_status
</select>
<select id="getExistCustomerAccount" resultType="com.yaoyaozw.customer.vo.AuthInfoVO">
select
ai.id,
ai.appid as appId,
ai.account_id as accountId,
ai.nick_name as accountName,
ai.store_type as storeType
from authorizer_info ai
right join (
select distinct app_id from customer_graphics_delay
where is_deleted = 0 and app_id is not null and app_id != ''
) mid
on ai.appid = mid.app_id
<if test="keyword != null and keyword != ''">
where ai.nick_name like concat('%', #{keyword}, '%')
</if>
</select>
<select id="getTimeIntervalList" resultType="com.yaoyaozw.customer.vo.CommonOptionResponseVO">
select
dic_value as name,
dic_key as `key`
from sys_dictionary
where is_deleted = 0
and group_id = 'CUSTOMER_TIME_INTERVAL'
order by sort
</select>
<select id="getAuthList" resultType="com.yaoyaozw.customer.vo.AuthInfoVO">
select
id,
appid as appId,
account_id as accountId,
nick_name as accountName,
store_type as storeType
from authorizer_info
<if test="keyword != null and keyword != ''">
where nick_name like concat('%', #{keyword}, '%')
</if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论