提交 b79b3207 作者: 沈振路

Merge branch 'customer_service_SZlu'

...@@ -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")
...@@ -135,44 +139,49 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -135,44 +139,49 @@ public class CustomerServiceCommonAsyncComponent {
} }
@Async("myExecutor") @Async("myExecutor")
public void obtainLink(Long materialId, CustomerGraphics customerGraphics, List<ReferralEntity> referralEntityList) { public void obtainMessageLink(Long materialId, CustomerGraphics customerGraphics, List<ReferralEntity> referralEntityList) {
// 获取符合人群包条件的用户所属的公众号列表
List<CrowdPackageUserVO> userListFromPackage = conditionMatchService.getUserListFromPackage(customerGraphics.getPackId(), null);
Map<String, List<CrowdPackageUserVO>> storeGroupMap = userListFromPackage.stream().collect(Collectors.groupingBy(CrowdPackageUserVO::getStoreType));
LOCAL_LOG.info("当前包含书城: {} 个", storeGroupMap.size());
// 删除之前设置人群包的时候获取链接生成的数据
referralEntityService.ultimateDeleteReferrals(materialId, "and account_id is not null");
for (ReferralEntity referralEntity : referralEntityList) { for (ReferralEntity referralEntity : referralEntityList) {
// 删除之前设置人群包的时候获取链接生成的数据
referralEntityService.ultimateDeleteReferrals(materialId, "and account_id is not null");
// 获取链接 // 获取链接
if (CustomerCommonConstant.REPLACE_LINK_NEWS_TYPE_LIST.contains(referralEntity.getNewsType())) { if (CustomerCommonConstant.REPLACE_LINK_NEWS_TYPE_LIST.contains(referralEntity.getNewsType())) {
LOCAL_LOG.info("异步获取图文客服链接"); LOCAL_LOG.info("异步获取图文客服链接");
getAuthListLink(customerGraphics, referralEntity); getMessageAuthListLink(storeGroupMap, customerGraphics, referralEntity);
} else { } else {
LOCAL_LOG.info("newsType: {}, 不需要获取链接", referralEntity.getNewsType()); LOCAL_LOG.info("newsType: {}, 不需要获取链接", referralEntity.getNewsType());
} }
} }
// 处理完之后将状态改为待发送 // 处理完之后将状态改为待发送
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 List<RegisterUserEntity> encapsulateUserEntity(List<CrowdPackageUserVO> userList) {
List<RegisterUserEntity> userEntityList = new ArrayList<>();
for (CrowdPackageUserVO crowdPackageUserVO : userList) {
RegisterUserEntity registerUserEntity = new RegisterUserEntity();
registerUserEntity.setId(crowdPackageUserVO.getId());
registerUserEntity.setInPackage(crowdPackageUserVO.getInPackage());
userEntityList.add(registerUserEntity);
}
return userEntityList;
} }
private void getAuthListLink(CustomerGraphics customerMain, ReferralEntity customerReferral) {
private void getMessageAuthListLink(Map<String, List<CrowdPackageUserVO>> storeGroupMap, CustomerGraphics customerMain, ReferralEntity customerReferral) {
Long packId = customerMain.getPackId(); Long packId = customerMain.getPackId();
LOCAL_LOG.info("开始异步处理客服链接, 客服标题: {}, 人群包主键: {}", customerMain.getName(), packId); LOCAL_LOG.info("开始异步处理客服链接, 客服标题: {}, 人群包主键: {}", customerMain.getName(), packId);
// 获取符合人群包条件的用户所属的公众号列表
List<CrowdPackageUserVO> userListFromPackage = conditionMatchService.getUserListFromPackage(packId, null);
Map<String, List<CrowdPackageUserVO>> storeGroupMap = userListFromPackage.stream().collect(Collectors.groupingBy(CrowdPackageUserVO::getStoreType));
LOCAL_LOG.info("当前包含书城: {} 个", storeGroupMap.size());
// 遍历处理书城 // 遍历处理书城
Integer newsType = customerReferral.getNewsType(); Integer newsType = customerReferral.getNewsType();
// 一个书城一个书城地处理 // 一个书城一个书城地处理
...@@ -235,6 +244,7 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -235,6 +244,7 @@ public class CustomerServiceCommonAsyncComponent {
storeGroupMap.forEach((storeType, userVoList) -> { storeGroupMap.forEach((storeType, userVoList) -> {
LOCAL_LOG.info("当前处理书城: {}", storeType); LOCAL_LOG.info("当前处理书城: {}", storeType);
boolean isLegal = true; boolean isLegal = true;
String configId = null;
// 阳光、掌中云 需要获取configId // 阳光、掌中云 需要获取configId
if (storeType.equals(CustomerCommonConstant.STORE_NAME_YANG_GUANG) || storeType.equals(CustomerCommonConstant.STORE_NAME_ZHANG_ZHONG_YUN)) { if (storeType.equals(CustomerCommonConstant.STORE_NAME_YANG_GUANG) || storeType.equals(CustomerCommonConstant.STORE_NAME_ZHANG_ZHONG_YUN)) {
R activityConfig = referralFeignClient.getActivityConfig(customerReferral.getRechargeAmount().stripTrailingZeros().toPlainString(), storeType, null); R activityConfig = referralFeignClient.getActivityConfig(customerReferral.getRechargeAmount().stripTrailingZeros().toPlainString(), storeType, null);
...@@ -247,9 +257,8 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -247,9 +257,8 @@ public class CustomerServiceCommonAsyncComponent {
if (!CollectionUtil.isEmpty(activityConfigList)) { if (!CollectionUtil.isEmpty(activityConfigList)) {
// 转换config // 转换config
Map<String, String> configMap = activityConfigList.stream().collect(Collectors.toMap(key -> key.getLabel().replaceAll("[^(0-9.送)]", ""), CommonOptionResponseVO::getValue, (o1, o2) -> o2)); Map<String, String> configMap = activityConfigList.stream().collect(Collectors.toMap(key -> key.getLabel().replaceAll("[^(0-9.送)]", ""), CommonOptionResponseVO::getValue, (o1, o2) -> o2));
String configId = configMap.get(activityContent); configId = configMap.get(activityContent);
LOCAL_LOG.info("活动内容: {} 获取到configId: {}", activityContent, configId); LOCAL_LOG.info("活动内容: {} 获取到configId: {}", activityContent, configId);
customerReferral.setConfigId(configId);
if (ObjectUtil.isNull(configId)) { if (ObjectUtil.isNull(configId)) {
isLegal = false; isLegal = false;
} }
...@@ -258,6 +267,8 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -258,6 +267,8 @@ public class CustomerServiceCommonAsyncComponent {
LOCAL_LOG.info("无法获取资源配置, 中断当前循环"); LOCAL_LOG.info("无法获取资源配置, 中断当前循环");
} }
} }
customerReferral.setConfigId(configId);
String tempId = CustomerStoreTemplateEnum.getTempId(storeType); String tempId = CustomerStoreTemplateEnum.getTempId(storeType);
customerReferral.setTemplateId(tempId); customerReferral.setTemplateId(tempId);
...@@ -287,6 +298,7 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -287,6 +298,7 @@ public class CustomerServiceCommonAsyncComponent {
} }
// 批量新增 // 批量新增
LOCAL_LOG.info("保存书城: {} 的链接实体, 数量:{}条", storeType, referralEntityList.size());
referralEntityService.saveBatch(referralEntityList); referralEntityService.saveBatch(referralEntityList);
} }
}); });
...@@ -367,5 +379,16 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -367,5 +379,16 @@ public class CustomerServiceCommonAsyncComponent {
} }
private List<RegisterUserEntity> encapsulateUserEntity(List<CrowdPackageUserVO> userList) {
List<RegisterUserEntity> userEntityList = new ArrayList<>();
for (CrowdPackageUserVO crowdPackageUserVO : userList) {
RegisterUserEntity registerUserEntity = new RegisterUserEntity();
registerUserEntity.setId(crowdPackageUserVO.getId());
registerUserEntity.setInPackage(crowdPackageUserVO.getInPackage());
userEntityList.add(registerUserEntity);
}
return userEntityList;
}
} }
...@@ -39,6 +39,7 @@ public class CustomerCommonConstant { ...@@ -39,6 +39,7 @@ public class CustomerCommonConstant {
public final static String CUSTOMER_TEXT_URL_PLACEHOLDER = "{url}-"; public final static String CUSTOMER_TEXT_URL_PLACEHOLDER = "{url}-";
public final static String CUSTOMER_TEXT_CONTENT_PLACEHOLDER = "{content}"; public final static String CUSTOMER_TEXT_CONTENT_PLACEHOLDER = "{content}";
public final static String H5_STYLE_CODE = " style='color: blue'";
public final static Integer USUAL_LINK_NEWS_TYPE = 3; public final static Integer USUAL_LINK_NEWS_TYPE = 3;
public final static String USUAL_LINK_NEWS_TYPE_NAME = "常用"; public final static String USUAL_LINK_NEWS_TYPE_NAME = "常用";
...@@ -51,6 +52,17 @@ public class CustomerCommonConstant { ...@@ -51,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;
......
package com.yaoyaozw.customer.controller;
import com.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO;
import com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO;
import com.yaoyaozw.customer.vo.customer.CustomerDelayListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* @author darker
* @date 2022/9/15 11:13
*/
@Api(tags = "延时客服接口")
@RestController
@RequestMapping("/customer-service/delay")
public class CustomerDelayController {
@ApiOperation("新增")
@PostMapping("/insert")
public BaseResult insertCustomerDelay(@RequestBody CustomerDelaySaveDTO saveDto) {
return new BaseResult().success();
}
@ApiOperation("编辑")
@PostMapping("/edit")
public BaseResult updateCustomerDelay(@RequestBody CustomerDelaySaveDTO saveDto) {
return new BaseResult().success();
}
@ApiOperation("查询")
@PostMapping("/pageList")
public GenericsResult<List<CustomerDelayListVO>> pageList(@RequestBody CustomerDelayQueryDTO queryDto) {
return new GenericsResult<>(new ArrayList<>());
}
@ApiOperation("删除")
@GetMapping("/remove/{id}")
public BaseResult removeCustomerDelay(@PathVariable("id") Long id) {
return new BaseResult().success();
}
}
package com.yaoyaozw.customer.controller;
import com.github.pagehelper.PageInfo;
import com.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO;
import com.yaoyaozw.customer.dto.customer.CustomerDelaySaveDTO;
import com.yaoyaozw.customer.service.CustomerGraphicsDelayService;
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.CustomerDelayGraphicsDetailVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author darker
* @date 2022/9/15 11:13
*/
@Api(tags = "延时客服接口")
@RestController
@RequestMapping("/customer-service/delay/graphics")
public class CustomerDelayGraphicsController {
@Autowired
private CustomerGraphicsDelayService customerGraphicsDelayService;
@ApiOperation("新增")
@PostMapping("/insert")
public BaseResult insertCustomerDelay(@RequestBody CustomerDelaySaveDTO saveDto) {
return customerGraphicsDelayService.insertCustomerDelay(saveDto);
}
@ApiOperation("获取详情")
@GetMapping("/detail/{id}")
public GenericsResult<CustomerDelayGraphicsDetailVO> getCustomerDelayDetail(@PathVariable("id") Long id) {
return customerGraphicsDelayService.getCustomerDelayDetail(id);
}
@ApiOperation("查询")
@PostMapping("/pageList")
public GenericsResult<PageInfo<CustomerDelayListVO>> pageList(@RequestBody CustomerDelayQueryDTO queryDto) {
return customerGraphicsDelayService.pageList(queryDto);
}
@ApiOperation("获取已生成客服的公众号列表")
@GetMapping("/getExistCustomerAccount")
public GenericsResult<List<AuthInfoVO>> getExistCustomerAccount(@RequestParam(required = false) String keyword) {
return customerGraphicsDelayService.getExistCustomerAccount(keyword);
}
@ApiOperation("删除")
@GetMapping("/remove/{id}")
public BaseResult removeCustomerDelay(@PathVariable("id") Long id) {
return customerGraphicsDelayService.removeCustomerDelay(id);
}
@ApiOperation("批量删除")
@PostMapping("/removeBatch")
public BaseResult removeBatch(@RequestBody List<Long> 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();
}
}
...@@ -4,7 +4,7 @@ import com.yaoyaozw.customer.common.GenericsResult; ...@@ -4,7 +4,7 @@ import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.customer.CustomerMessageTextSaveDTO; import com.yaoyaozw.customer.dto.customer.CustomerMessageTextSaveDTO;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO; import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
import com.yaoyaozw.customer.service.CustomerGraphicsTextService; import com.yaoyaozw.customer.service.CustomerGraphicsTextService;
import com.yaoyaozw.customer.vo.customer.CustomerGraphicTextDetailVO; import com.yaoyaozw.customer.vo.customer.CustomerMessageTextDetailVO;
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;
...@@ -30,19 +30,19 @@ public class CustomerMessageTextController { ...@@ -30,19 +30,19 @@ public class CustomerMessageTextController {
@ApiOperation("新增客服内容") @ApiOperation("新增客服内容")
@PostMapping("/insertCustomerContent") @PostMapping("/insertCustomerContent")
public GenericsResult<CustomerGraphicTextDetailVO> insertCustomerContent(@RequestBody CustomerReferralDTO referralDto) { public GenericsResult<CustomerMessageTextDetailVO> insertCustomerContent(@RequestBody CustomerReferralDTO referralDto) {
return textService.insertCustomerContent(referralDto); return textService.insertCustomerContent(referralDto);
} }
@ApiOperation("获取文本客服详情") @ApiOperation("获取文本客服详情")
@GetMapping("/detail/{id}") @GetMapping("/detail/{id}")
public GenericsResult<CustomerGraphicTextDetailVO> getCustomerTextDetail(@PathVariable("id") Long id) { public GenericsResult<CustomerMessageTextDetailVO> getCustomerTextDetail(@PathVariable("id") Long id) {
return textService.getCustomerTextDetail(id); return textService.getCustomerTextDetail(id);
} }
@ApiOperation("删除单条文本内容") @ApiOperation("删除单条文本内容")
@GetMapping("/removeCustomerContent/{contentId}") @GetMapping("/removeCustomerContent/{contentId}")
public GenericsResult<CustomerGraphicTextDetailVO> removeCustomerContent(@PathVariable("contentId") Long contentId) { public GenericsResult<CustomerMessageTextDetailVO> removeCustomerContent(@PathVariable("contentId") Long contentId) {
return textService.removeCustomerContent(contentId); return textService.removeCustomerContent(contentId);
} }
......
...@@ -12,17 +12,19 @@ import java.io.Serializable; ...@@ -12,17 +12,19 @@ import java.io.Serializable;
* @author darker * @author darker
* @date 2022/9/15 11:20 * @date 2022/9/15 11:20
*/ */
@EqualsAndHashCode(callSuper = true)
@Data @Data
@ApiModel("延时客服列表查询实体") @ApiModel("延时客服列表查询实体")
public class CustomerDelayQueryDTO implements Serializable { public class CustomerDelayQueryDTO extends PageParams implements Serializable {
private static final long serialVersionUID = 3580731044930990755L;
@ApiModelProperty("消息名称关键词") @ApiModelProperty("消息名称关键词")
private String messageKeyword; private String keyword;
@ApiModelProperty("客服消息类型") @ApiModelProperty("客服消息类型")
private Integer messageType; private String type;
@ApiModelProperty("公众号AppID")
private String appId;
} }
...@@ -13,13 +13,35 @@ import java.io.Serializable; ...@@ -13,13 +13,35 @@ import java.io.Serializable;
@Data @Data
@ApiModel("延时客服保存实体") @ApiModel("延时客服保存实体")
public class CustomerDelaySaveDTO implements Serializable { public class CustomerDelaySaveDTO implements Serializable {
private static final long serialVersionUID = 3396784031787662255L;
@ApiModelProperty("主键ID")
private Long id;
@ApiModelProperty("公众号appId")
private String appId;
@ApiModelProperty("客服消息名称") @ApiModelProperty("客服消息名称")
private String messageName; private String name;
@ApiModelProperty("客服消息类型(图文、文本)")
private String type;
@ApiModelProperty("客服消息类型(图文、文本)")
private String extendTitle;
@ApiModelProperty("客服消息类型(图文、文本)") @ApiModelProperty("客服消息类型(图文、文本)")
private Integer messageType; private String coverUrl;
@ApiModelProperty("文本内容")
private String content;
@ApiModelProperty("发文序号")
private Integer postSort;
@ApiModelProperty("发文间隔时间")
private Long timeInterval;
@ApiModelProperty("消息内容实体")
private CustomerReferralDTO customerReferralDto;
} }
...@@ -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,13 +6,20 @@ import com.baomidou.mybatisplus.annotation.TableId; ...@@ -6,13 +6,20 @@ 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;
/**
* 客户图形延迟
*
* @author Admin
* @date 2022/10/13
*/
@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;
/** /**
...@@ -22,6 +29,43 @@ public class CustomerGraphicsDelay implements Serializable { ...@@ -22,6 +29,43 @@ public class CustomerGraphicsDelay implements Serializable {
private String appId; private String appId;
/** /**
* 标题
*/
@TableField(value = "name")
private String name;
/**
* 类型
*/
@TableField(value = "type")
private String type;
/**
* 推广标题
*/
@TableField(value = "extend_title")
private String extendTitle;
/**
* 文本内容
*/
@TableField(value = "content")
private String content;
/**
* 状态
*/
@TableField(value = "send_status")
private Integer sendStatus;
/**
* 是否是历史遗留
*/
@TableField(value = "is_history")
private Integer isHistory;
/**
* 发送序列 * 发送序列
*/ */
@TableField(value = "post_sort") @TableField(value = "post_sort")
...@@ -61,7 +105,13 @@ public class CustomerGraphicsDelay implements Serializable { ...@@ -61,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;
...@@ -82,4 +132,15 @@ public class CustomerGraphicsDelay implements Serializable { ...@@ -82,4 +132,15 @@ public class CustomerGraphicsDelay implements Serializable {
public static final String COL_GMT_MODIFIED = "gmt_modified"; public static final String COL_GMT_MODIFIED = "gmt_modified";
public static final String COL_IS_DELETED = "is_deleted"; public static final String COL_IS_DELETED = "is_deleted";
public void initOperateInfo(Long userId, Boolean isCreate) {
Date now = new Date();
if (isCreate) {
this.createUser = userId;
this.gmtCreate = now;
}
this.gmtModified = now;
this.modifiedUser = userId;
}
} }
\ No newline at end of file
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
...@@ -2,8 +2,12 @@ package com.yaoyaozw.customer.mapper; ...@@ -2,8 +2,12 @@ package com.yaoyaozw.customer.mapper;
import com.baomidou.dynamic.datasource.annotation.DS; 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.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 org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -11,16 +15,48 @@ import java.util.List; ...@@ -11,16 +15,48 @@ 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);
/**
* 页面列表
*
* @param queryDto 查询dto
* @return {@link List}<{@link CustomerDelayListVO}>
*/
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> {
}
package com.yaoyaozw.customer.service; package com.yaoyaozw.customer.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.customer.CustomerDelayQueryDTO;
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.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 java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -15,5 +24,76 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD ...@@ -15,5 +24,76 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD
List<CustomerDelayItemVO> findAllDelayCustomerMessage(Set<String> appidList,Integer maxSortRage); List<CustomerDelayItemVO> findAllDelayCustomerMessage(Set<String> appidList,Integer maxSortRage);
/**
* 插入客户延迟
*
* @param saveDto 保存dto
* @return {@link BaseResult}
*/
BaseResult insertCustomerDelay(CustomerDelaySaveDTO saveDto);
/**
* 得到客户延迟细节
*
* @param id id
* @return {@link GenericsResult}<{@link CustomerDelayGraphicsDetailVO}>
*/
GenericsResult<CustomerDelayGraphicsDetailVO> getCustomerDelayDetail(Long id);
/**
* 页面列表
*
* @param queryDto 查询dto
* @return {@link GenericsResult}<{@link PageInfo}<{@link CustomerDelayListVO}>>
*/
GenericsResult<PageInfo<CustomerDelayListVO>> pageList(CustomerDelayQueryDTO queryDto);
/**
* 得到客户账户存在
*
* @param keyword 关键词
* @return {@link GenericsResult}<{@link List}<{@link AuthInfoVO}>>
*/
GenericsResult<List<AuthInfoVO>> getExistCustomerAccount(String keyword);
/**
* 删除客户延迟
*
* @param id id
* @return {@link BaseResult}
*/
BaseResult removeCustomerDelay(Long id);
/**
* 删除批处理
*
* @param idList id列表
* @return {@link BaseResult}
*/
BaseResult removeBatch(List<Long> idList);
/**
* 复制
*
* @param appId 应用程序id
* @param targetAppList 目标应用程序列表
* @return {@link BaseResult}
*/
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();
} }
...@@ -5,7 +5,7 @@ import com.yaoyaozw.customer.common.GenericsResult; ...@@ -5,7 +5,7 @@ import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.customer.CustomerMessageTextSaveDTO; import com.yaoyaozw.customer.dto.customer.CustomerMessageTextSaveDTO;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO; import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
import com.yaoyaozw.customer.entity.CustomerGraphics; import com.yaoyaozw.customer.entity.CustomerGraphics;
import com.yaoyaozw.customer.vo.customer.CustomerGraphicTextDetailVO; import com.yaoyaozw.customer.vo.customer.CustomerMessageTextDetailVO;
/** /**
...@@ -26,24 +26,24 @@ public interface CustomerGraphicsTextService extends IService<CustomerGraphics> ...@@ -26,24 +26,24 @@ public interface CustomerGraphicsTextService extends IService<CustomerGraphics>
* 新增客户内容 * 新增客户内容
* *
* @param referralDto 推荐dto * @param referralDto 推荐dto
* @return {@link GenericsResult}<{@link CustomerGraphicTextDetailVO}> * @return {@link GenericsResult}<{@link CustomerMessageTextDetailVO}>
*/ */
GenericsResult<CustomerGraphicTextDetailVO> insertCustomerContent(CustomerReferralDTO referralDto); GenericsResult<CustomerMessageTextDetailVO> insertCustomerContent(CustomerReferralDTO referralDto);
/** /**
* 获取文本客服详情 * 获取文本客服详情
* *
* @param id 主键id * @param id 主键id
* @return {@link GenericsResult}<{@link CustomerGraphicTextDetailVO}> * @return {@link GenericsResult}<{@link CustomerMessageTextDetailVO}>
*/ */
GenericsResult<CustomerGraphicTextDetailVO> getCustomerTextDetail(Long id); GenericsResult<CustomerMessageTextDetailVO> getCustomerTextDetail(Long id);
/** /**
* 删除客户内容 * 删除客户内容
* *
* @param contentId 文本内容id * @param contentId 文本内容id
* @return {@link GenericsResult}<{@link CustomerGraphicTextDetailVO}> * @return {@link GenericsResult}<{@link CustomerMessageTextDetailVO}>
*/ */
GenericsResult<CustomerGraphicTextDetailVO> removeCustomerContent(Long contentId); GenericsResult<CustomerMessageTextDetailVO> removeCustomerContent(Long contentId);
} }
package com.yaoyaozw.customer.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yaoyaozw.customer.entity.CustomerGraphicsDelay;
import com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO;
import java.util.List;
import java.util.Set;
/**
* @author darker
* @date 2022/9/15 11:13
*/
public interface CustomerTextDelayService extends IService<CustomerGraphicsDelay> {
}
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.collection.CollectionUtil;
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.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.AuthorizerInfo;
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.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.ReferralEntityService;
import com.yaoyaozw.customer.vo.AuthInfoVO;
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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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
...@@ -17,6 +49,18 @@ import java.util.Set; ...@@ -17,6 +49,18 @@ import java.util.Set;
@Service @Service
public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphicsDelayMapper, CustomerGraphicsDelay> implements CustomerGraphicsDelayService { public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphicsDelayMapper, CustomerGraphicsDelay> implements CustomerGraphicsDelayService {
private final static Logger localLog = LoggerFactory.getLogger(CustomerGraphicsDelayServiceImpl.class);
@Autowired
private TokenManager tokenManager;
@Autowired
private SnowflakeComponent snowflakeComponent;
@Autowired
private ReferralEntityService referralEntityService;
@Autowired
private AuthorizerInfoService authorizerInfoService;
@Autowired
private KanbanCommonMapper kanbanCommonMapper;
@Override @Override
...@@ -30,5 +74,155 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -30,5 +74,155 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
return baseMapper.findAllDelayCustomerMessage(appidList); return baseMapper.findAllDelayCustomerMessage(appidList);
} }
} }
@Override
@Transactional(rollbackFor = Exception.class)
public BaseResult insertCustomerDelay(CustomerDelaySaveDTO saveDto) {
CustomerGraphicsDelay customerGraphicsDelay = new CustomerGraphicsDelay();
BeanUtil.copyProperties(saveDto, customerGraphicsDelay);
// 初始化操作信息
customerGraphicsDelay.initOperateInfo(tokenManager.getUserIdFromToken(), ObjectUtil.isNull(saveDto.getId()));
if (ObjectUtil.isNull(customerGraphicsDelay.getId())) {
long id = snowflakeComponent.snowflakeId();
localLog.info("是新增, 新生成ID: {}", id);
customerGraphicsDelay.setId(id);
}
customerGraphicsDelay.setSendStatus(CustomerCommonConstant.SEND_STATUS_LINK_GETTING);
boolean mainResult = super.saveOrUpdate(customerGraphicsDelay);
if (!mainResult) {
localLog.info("主体数据生成异常");
return new BaseResult().error("新增/更新 主体数据异常");
}
localLog.info("生成referral数据");
ReferralEntity referralEntity = new ReferralEntity();
referralEntity.setMaterialGraphicsId(customerGraphicsDelay.getId());
BeanUtil.copyProperties(referralEntity, saveDto.getCustomerReferralDto());
boolean referralResult = referralEntityService.saveOrUpdate(referralEntity);
if (!referralResult) {
localLog.info("referral数据生成异常, 回滚事务");
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
// TODO: 2022/10/14 生成链接
return new BaseResult().success();
}
@Override
public GenericsResult<CustomerDelayGraphicsDetailVO> getCustomerDelayDetail(Long id) {
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
public GenericsResult<PageInfo<CustomerDelayListVO>> pageList(CustomerDelayQueryDTO queryDto) {
PageHelper.startPage(queryDto.getCurrentPage(), queryDto.getPageSize());
List<CustomerDelayListVO> customerDelayList = super.baseMapper.pageList(queryDto);
PageInfo<CustomerDelayListVO> pageResult = new PageInfo<>(customerDelayList);
return new GenericsResult<>(pageResult);
}
@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) {
return null;
}
@Override
public BaseResult removeBatch(List<Long> idList) {
return null;
}
@Override
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;
}
@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,10 +220,10 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap ...@@ -222,10 +220,10 @@ 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.obtainLink(id, byId, referralEntityList); commonAsyncComponent.obtainMessageLink(id, byId, referralEntityList);
return new BaseResult().success(); return new BaseResult().success();
} }
return new BaseResult().error("更新失败"); return new BaseResult().error("更新失败");
......
...@@ -17,7 +17,7 @@ import com.yaoyaozw.customer.mapper.CustomerGraphicsMapper; ...@@ -17,7 +17,7 @@ import com.yaoyaozw.customer.mapper.CustomerGraphicsMapper;
import com.yaoyaozw.customer.service.CustomerGraphicsTextService; import com.yaoyaozw.customer.service.CustomerGraphicsTextService;
import com.yaoyaozw.customer.service.ReferralEntityService; import com.yaoyaozw.customer.service.ReferralEntityService;
import com.yaoyaozw.customer.vo.customer.CustomerContentVO; import com.yaoyaozw.customer.vo.customer.CustomerContentVO;
import com.yaoyaozw.customer.vo.customer.CustomerGraphicTextDetailVO; import com.yaoyaozw.customer.vo.customer.CustomerMessageTextDetailVO;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -63,7 +63,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic ...@@ -63,7 +63,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public GenericsResult<CustomerGraphicTextDetailVO> insertCustomerContent(CustomerReferralDTO referralDto) { public GenericsResult<CustomerMessageTextDetailVO> insertCustomerContent(CustomerReferralDTO referralDto) {
System.out.println(referralDto); System.out.println(referralDto);
...@@ -83,7 +83,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic ...@@ -83,7 +83,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic
} }
@Override @Override
public GenericsResult<CustomerGraphicTextDetailVO> getCustomerTextDetail(Long id) { public GenericsResult<CustomerMessageTextDetailVO> getCustomerTextDetail(Long id) {
// 查询主体数据 // 查询主体数据
CustomerGraphics customerGraphics = super.getById(id); CustomerGraphics customerGraphics = super.getById(id);
if (ObjectUtil.isNull(customerGraphics)) { if (ObjectUtil.isNull(customerGraphics)) {
...@@ -91,7 +91,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic ...@@ -91,7 +91,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic
return new GenericsResult<>(false, "找不到主体数据"); return new GenericsResult<>(false, "找不到主体数据");
} }
// 赋值主体数据 // 赋值主体数据
CustomerGraphicTextDetailVO detailVO = new CustomerGraphicTextDetailVO(); CustomerMessageTextDetailVO detailVO = new CustomerMessageTextDetailVO();
BeanUtil.copyProperties(customerGraphics, detailVO); BeanUtil.copyProperties(customerGraphics, detailVO);
detailVO.setPostTime(customerGraphics.getPostTimeStr()); detailVO.setPostTime(customerGraphics.getPostTimeStr());
...@@ -140,7 +140,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic ...@@ -140,7 +140,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic
} }
idx += 1; idx += 1;
} }
customerGraphics.setContent(mainH5Content.toString()); customerGraphics.setContent(mainH5Content.toString().replace(CustomerCommonConstant.H5_STYLE_CODE, ""));
customerGraphics.setReferralSize(replaceLinkTypeNum); customerGraphics.setReferralSize(replaceLinkTypeNum);
detailVO.setContentList(contentList); detailVO.setContentList(contentList);
// 更新连接表 // 更新连接表
...@@ -157,7 +157,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic ...@@ -157,7 +157,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic
} }
@Override @Override
public GenericsResult<CustomerGraphicTextDetailVO> removeCustomerContent(Long contentId) { public GenericsResult<CustomerMessageTextDetailVO> removeCustomerContent(Long contentId) {
ReferralEntity referralEntity = referralEntityService.getById(contentId); ReferralEntity referralEntity = referralEntityService.getById(contentId);
if (ObjectUtil.isNull(referralEntity)) { if (ObjectUtil.isNull(referralEntity)) {
return new GenericsResult<>(false, "找不到主体数据"); return new GenericsResult<>(false, "找不到主体数据");
......
package com.yaoyaozw.customer.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yaoyaozw.customer.entity.CustomerGraphicsDelay;
import com.yaoyaozw.customer.mapper.CustomerGraphicsDelayMapper;
import com.yaoyaozw.customer.service.CustomerTextDelayService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
/**
* @author darker
* @date 2022/9/15 11:13
*/
@Service
public class CustomerTextDelayServiceImpl extends ServiceImpl<CustomerGraphicsDelayMapper, CustomerGraphicsDelay> implements CustomerTextDelayService {
private final static Logger localLog = LoggerFactory.getLogger(CustomerTextDelayServiceImpl.class);
}
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;
} }
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.dto.customer.CustomerReferralDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author darker
* @date 2022/10/8 17:13
*/
@Data
public class CustomerDelayGraphicsDetailVO implements Serializable {
@ApiModelProperty("客服消息id")
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@ApiModelProperty("公众号ID")
private String appId;
@ApiModelProperty("标题")
private String name;
@ApiModelProperty("客服消息类型(图文、文本)")
private String type;
@ApiModelProperty("是否支付 0-否 1-是")
private Integer isPay;
@ApiModelProperty("素材图片路径")
private String coverUrl;
@ApiModelProperty("素材文本内容")
private String content;
@ApiModelProperty("链接相关内容")
private CustomerReferralDTO customerReferralDto;
}
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;
...@@ -10,9 +14,38 @@ import java.io.Serializable; ...@@ -10,9 +14,38 @@ import java.io.Serializable;
*/ */
@Data @Data
public class CustomerDelayListVO implements Serializable { public class CustomerDelayListVO implements Serializable {
private static final long serialVersionUID = -7050943048581039251L;
@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);
}
} }
...@@ -15,7 +15,7 @@ import java.util.List; ...@@ -15,7 +15,7 @@ import java.util.List;
*/ */
@Data @Data
@ApiModel("文本客服详情实体") @ApiModel("文本客服详情实体")
public class CustomerGraphicTextDetailVO implements Serializable { public class CustomerMessageTextDetailVO implements Serializable {
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty("主键id") @ApiModelProperty("主键id")
......
...@@ -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
...@@ -34,4 +34,71 @@ ...@@ -34,4 +34,71 @@
</select> </select>
<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>
</mapper> </mapper>
\ No newline at end of file
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
select select
cg.id, cg.id,
cg.pack_id as packId,
cg.name, cg.name,
cg.type, cg.type,
cg.post_time as postTime, cg.post_time as postTime,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论