提交 1209a03c 作者: 沈振路

Merge branch 'customer_service_SZlu'

# Conflicts:
#	src/main/java/com/yaoyaozw/customer/service/impl/CustomerGraphicsServiceImpl.java
...@@ -22,13 +22,13 @@ public class MyMetaObjectHandler implements MetaObjectHandler { ...@@ -22,13 +22,13 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
@Override @Override
public void insertFill(MetaObject metaObject) { public void insertFill(MetaObject metaObject) {
Long userId = tokenManager.getUserIdFromToken(); Long userId = tokenManager.getUserIdFromToken();
if (ObjectUtil.isNull(userId)){ if (ObjectUtil.isNotNull(userId)){
this.setFieldValByName("gmtModifiedUser", "0", metaObject);
this.setFieldValByName("gmtCreateUser", "0", metaObject);
}else {
String userIdStr = userId.toString(); String userIdStr = userId.toString();
this.setFieldValByName("gmtModifiedUser", userIdStr, metaObject); this.setFieldValByName("gmtModifiedUser", userIdStr, metaObject);
this.setFieldValByName("gmtCreateUser", userIdStr, metaObject); this.setFieldValByName("gmtCreateUser", userIdStr, metaObject);
this.setFieldValByName("modifiedUser", userId, metaObject);
this.setFieldValByName("createUser", userId, metaObject);
} }
this.setFieldValByName("gmtCreate", new Date(), metaObject); this.setFieldValByName("gmtCreate", new Date(), metaObject);
this.setFieldValByName("gmtModified", new Date(), metaObject); this.setFieldValByName("gmtModified", new Date(), metaObject);
...@@ -41,10 +41,9 @@ public class MyMetaObjectHandler implements MetaObjectHandler { ...@@ -41,10 +41,9 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
public void updateFill(MetaObject metaObject) { public void updateFill(MetaObject metaObject) {
this.setFieldValByName("gmtModified",new Date(),metaObject); this.setFieldValByName("gmtModified",new Date(),metaObject);
Long userId = tokenManager.getUserIdFromToken(); Long userId = tokenManager.getUserIdFromToken();
if (ObjectUtil.isNull(userId)){ if (ObjectUtil.isNotNull(userId)){
this.setFieldValByName("gmtModifiedUser", "0", metaObject);
}else {
this.setFieldValByName("gmtModifiedUser", userId.toString(), metaObject); this.setFieldValByName("gmtModifiedUser", userId.toString(), metaObject);
this.setFieldValByName("modifiedUser", userId, metaObject);
} }
} }
} }
package com.yaoyaozw.customer.constants; package com.yaoyaozw.customer.constants;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
...@@ -43,6 +44,7 @@ public class CustomerCommonConstant { ...@@ -43,6 +44,7 @@ public class CustomerCommonConstant {
public final static Integer ACTIVITY_NEWS_TYPE = 2; public final static Integer ACTIVITY_NEWS_TYPE = 2;
public final static String ACTIVITY_NEWS_TYPE_NAME = "活动"; public final static String ACTIVITY_NEWS_TYPE_NAME = "活动";
public final static String ACTIVITY_NEWS_TYPE_NAME_MODEL = "系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-充{recharge}送{gift}"; public final static String ACTIVITY_NEWS_TYPE_NAME_MODEL = "系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-充{recharge}送{gift}";
public final static String ACTIVITY_NEWS_TYPE_NAME_CONFIG_NAME_MODEL = "系统-客服-{newsType}-{accountNickName}-{storeType}-{currentDate}-{configName}";
public final static String CUSTOMER_TEXT_LINK_TEMPLATE = "<a href=\"{url}-\" style='color: blue'>{content}</a>"; public final static String CUSTOMER_TEXT_LINK_TEMPLATE = "<a href=\"{url}-\" style='color: blue'>{content}</a>";
...@@ -91,7 +93,7 @@ public class CustomerCommonConstant { ...@@ -91,7 +93,7 @@ public class CustomerCommonConstant {
public static String getNewsTypeName(Integer code) { public static String getNewsTypeName(Integer code) {
if (ObjectUtil.isNull(code)) { if (ObjectUtil.isNull(code)) {
return null; return "";
} }
if (code.equals(BOOK_NEWS_TYPE)) { if (code.equals(BOOK_NEWS_TYPE)) {
return BOOK_NEWS_TYPE_NAME; return BOOK_NEWS_TYPE_NAME;
...@@ -102,12 +104,12 @@ public class CustomerCommonConstant { ...@@ -102,12 +104,12 @@ public class CustomerCommonConstant {
if (code.equals(USUAL_LINK_NEWS_TYPE)) { if (code.equals(USUAL_LINK_NEWS_TYPE)) {
return USUAL_LINK_NEWS_TYPE_NAME; return USUAL_LINK_NEWS_TYPE_NAME;
} }
return null; return "";
} }
public static String getLinkNameModel(Integer code) { public static String getLinkNameModel(Integer code) {
if (ObjectUtil.isNull(code)) { if (ObjectUtil.isNull(code)) {
return null; return "";
} }
if (code.equals(BOOK_NEWS_TYPE)) { if (code.equals(BOOK_NEWS_TYPE)) {
return BOOK_NEWS_TYPE_NAME_MODEL; return BOOK_NEWS_TYPE_NAME_MODEL;
...@@ -116,7 +118,25 @@ public class CustomerCommonConstant { ...@@ -116,7 +118,25 @@ public class CustomerCommonConstant {
return ACTIVITY_NEWS_TYPE_NAME_MODEL; return ACTIVITY_NEWS_TYPE_NAME_MODEL;
} }
return null; return "";
}
public static String getLinkNameModel(Integer code, String configName) {
if (ObjectUtil.isNull(code)) {
return "";
}
if (code.equals(BOOK_NEWS_TYPE)) {
return BOOK_NEWS_TYPE_NAME_MODEL;
}
if (code.equals(ACTIVITY_NEWS_TYPE)) {
if (StringUtils.isEmpty(configName)) {
return ACTIVITY_NEWS_TYPE_NAME_MODEL;
} else {
return ACTIVITY_NEWS_TYPE_NAME_CONFIG_NAME_MODEL;
}
}
return "";
} }
} }
package com.yaoyaozw.customer.constants;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.List;
/**
* @author darker
* @date 2023/3/14 11:56
*/
public class FollowReplyCommonConstant {
public final static String TENCENT_MEDIA_TYPE_PIC = "image";
public final static String TENCENT_MEDIA_TYPE_VOICE = "voice";
public final static String TENCENT_MEDIA_TYPE_NEWS = "news";
public final static String TENCENT_MEDIA_TYPE_TEXT = "text";
public static Boolean needUpload(String type) {
return TENCENT_MEDIA_TYPE_PIC.equals(type) || TENCENT_MEDIA_TYPE_VOICE.equals(type);
}
public static Boolean needReferral(String type) {
return TENCENT_MEDIA_TYPE_NEWS.equals(type) || TENCENT_MEDIA_TYPE_TEXT.equals(type);
}
public static String getTypeDesc(String type) {
if (TENCENT_MEDIA_TYPE_PIC.equals(type)) {
return "图片";
} else if (TENCENT_MEDIA_TYPE_VOICE.equals(type)) {
return "语音";
} else if (TENCENT_MEDIA_TYPE_NEWS.equals(type)) {
return "图文";
} else if (TENCENT_MEDIA_TYPE_TEXT.equals(type)) {
return "文本";
}
return "";
}
}
...@@ -4,7 +4,7 @@ import com.yaoyaozw.customer.annotations.AccountOperateControl; ...@@ -4,7 +4,7 @@ import com.yaoyaozw.customer.annotations.AccountOperateControl;
import com.yaoyaozw.customer.annotations.OperateLog; import com.yaoyaozw.customer.annotations.OperateLog;
import com.yaoyaozw.customer.common.GenericsResult; import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.customer.CustomerDelayTextSaveDTO; import com.yaoyaozw.customer.dto.customer.CustomerDelayTextSaveDTO;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO; import com.yaoyaozw.customer.entity.CommonReferralBody;
import com.yaoyaozw.customer.enums.AccountParamType; import com.yaoyaozw.customer.enums.AccountParamType;
import com.yaoyaozw.customer.enums.AccountTableColumnType; import com.yaoyaozw.customer.enums.AccountTableColumnType;
import com.yaoyaozw.customer.service.CustomerDelayTextService; import com.yaoyaozw.customer.service.CustomerDelayTextService;
...@@ -37,7 +37,7 @@ public class CustomerDelayTextController { ...@@ -37,7 +37,7 @@ public class CustomerDelayTextController {
@ApiOperation("新增客服内容") @ApiOperation("新增客服内容")
@PostMapping("/insertCustomerContent") @PostMapping("/insertCustomerContent")
@OperateLog(module = "延时客服-文本", desc = "新增文本延时客服子素材") @OperateLog(module = "延时客服-文本", desc = "新增文本延时客服子素材")
public GenericsResult<CustomerDelayTextDetailVO> insertCustomerContent(@RequestBody CustomerReferralDTO referralDto) { public GenericsResult<CustomerDelayTextDetailVO> insertCustomerContent(@RequestBody CommonReferralBody referralDto) {
return textService.insertCustomerContent(referralDto); return textService.insertCustomerContent(referralDto);
} }
......
...@@ -3,7 +3,7 @@ package com.yaoyaozw.customer.controller; ...@@ -3,7 +3,7 @@ package com.yaoyaozw.customer.controller;
import com.yaoyaozw.customer.annotations.OperateLog; import com.yaoyaozw.customer.annotations.OperateLog;
import com.yaoyaozw.customer.common.GenericsResult; 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.entity.CommonReferralBody;
import com.yaoyaozw.customer.service.CustomerGraphicsTextService; import com.yaoyaozw.customer.service.CustomerGraphicsTextService;
import com.yaoyaozw.customer.vo.customer.CustomerMessageTextDetailVO; import com.yaoyaozw.customer.vo.customer.CustomerMessageTextDetailVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -33,7 +33,7 @@ public class CustomerMessageTextController { ...@@ -33,7 +33,7 @@ public class CustomerMessageTextController {
@ApiOperation("新增客服内容") @ApiOperation("新增客服内容")
@PostMapping("/insertCustomerContent") @PostMapping("/insertCustomerContent")
@OperateLog(module = "客服消息-文本", desc = "新增文本客服消息子素材") @OperateLog(module = "客服消息-文本", desc = "新增文本客服消息子素材")
public GenericsResult<CustomerMessageTextDetailVO> insertCustomerContent(@RequestBody CustomerReferralDTO referralDto) { public GenericsResult<CustomerMessageTextDetailVO> insertCustomerContent(@RequestBody CommonReferralBody referralDto) {
return textService.insertCustomerContent(referralDto); return textService.insertCustomerContent(referralDto);
} }
......
package com.yaoyaozw.customer.controller;
import com.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.follow.FollowReplyCopyDTO;
import com.yaoyaozw.customer.entity.CommonReferralBody;
import com.yaoyaozw.customer.dto.follow.FollowReplyQueryDTO;
import com.yaoyaozw.customer.dto.follow.FollowReplySaveDTO;
import com.yaoyaozw.customer.service.CustomerFollowReplyService;
import com.yaoyaozw.customer.vo.follow.FollowReplyInfoVO;
import com.yaoyaozw.customer.vo.follow.FollowReplyListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author darker
* @date 2023/3/13 19:47
*/
@RestController
@RequestMapping("/follow-reply")
public class FollowReplyController {
@Autowired
private CustomerFollowReplyService followReplyService;
@PostMapping("/list")
public GenericsResult<List<FollowReplyListVO>> list(@RequestBody FollowReplyQueryDTO queryDto) {
return followReplyService.list(queryDto);
}
@PostMapping("/create")
public GenericsResult<String> create(@RequestBody @Validated FollowReplySaveDTO saveDto) {
return followReplyService.create(saveDto);
}
@PostMapping("/createTextItem")
public GenericsResult<List<CommonReferralBody>> createTextItem(@RequestBody CommonReferralBody referralBody) {
return followReplyService.createTextItem(referralBody);
}
@GetMapping("/info/{id}")
public GenericsResult<FollowReplyInfoVO> getInfo(@PathVariable("id") Long id) {
return followReplyService.getInfo(id);
}
@GetMapping("/remove/{id}")
public BaseResult remove(@PathVariable("id") Long id) {
return followReplyService.remove(id);
}
@GetMapping("/removeTextItem/{id}")
public GenericsResult<List<CommonReferralBody>> removeTextItem(@PathVariable("id") Long id) {
return followReplyService.removeTextItem(id);
}
@PostMapping("/copy")
public BaseResult copy(@RequestBody FollowReplyCopyDTO copyDto) {
return followReplyService.copy(copyDto);
}
}
package com.yaoyaozw.customer.dto.customer; package com.yaoyaozw.customer.dto.customer;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.yaoyaozw.customer.entity.CommonReferralBody;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -46,7 +47,7 @@ public class CustomerDelaySaveDTO implements Serializable { ...@@ -46,7 +47,7 @@ public class CustomerDelaySaveDTO implements Serializable {
private Integer isPay; private Integer isPay;
@ApiModelProperty("消息内容实体") @ApiModelProperty("消息内容实体")
private CustomerReferralDTO customerReferralDto; private CommonReferralBody customerReferralDto;
private Integer hour; private Integer hour;
......
package com.yaoyaozw.customer.dto.customer; package com.yaoyaozw.customer.dto.customer;
import com.yaoyaozw.customer.entity.CommonReferralBody;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -37,6 +38,6 @@ public class CustomerMessageSaveDTO implements Serializable { ...@@ -37,6 +38,6 @@ public class CustomerMessageSaveDTO implements Serializable {
private String content; private String content;
@ApiModelProperty("链接相关内容") @ApiModelProperty("链接相关内容")
private CustomerReferralDTO customerReferralDto; private CommonReferralBody customerReferralDto;
} }
package com.yaoyaozw.customer.dto.follow;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author darker
* @date 2023/3/13 19:59
*/
@Data
public class FollowReplyCopyDTO implements Serializable {
private AuthInfoVO sourceAuth;
private List<AuthInfoVO> targetAuthList;
}
package com.yaoyaozw.customer.dto.follow;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author darker
* @date 2023/3/13 19:59
*/
@Data
public class FollowReplyQueryDTO implements Serializable {
private String appId;
}
package com.yaoyaozw.customer.dto.follow;
import cn.hutool.core.util.ObjectUtil;
import com.yaoyaozw.customer.entity.CommonReferralBody;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author darker
* @date 2023/3/13 19:59
*/
@Data
public class FollowReplySaveDTO implements Serializable {
private Long id;
@NotEmpty(message = "appid不能为空")
private String appid;
@NotEmpty(message = "素材名称不能为空")
private String name;
@NotEmpty(message = "素材类型不能为空")
private String type;
private String originMediaUrl;
private String extendTitle;
private String extendDesc;
@NotNull(message = "素材排序不能为空")
private Integer sort;
private CommonReferralBody referralBody;
}
package com.yaoyaozw.customer.dto.customer; package com.yaoyaozw.customer.entity;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
...@@ -20,7 +20,7 @@ import java.util.List; ...@@ -20,7 +20,7 @@ import java.util.List;
* @date 2022/10/8 12:00 * @date 2022/10/8 12:00
*/ */
@Data @Data
public class CustomerReferralDTO implements Serializable { public class CommonReferralBody implements Serializable {
@ApiModelProperty("客服素材主体id") @ApiModelProperty("客服素材主体id")
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
...@@ -36,7 +36,10 @@ public class CustomerReferralDTO implements Serializable { ...@@ -36,7 +36,10 @@ public class CustomerReferralDTO implements Serializable {
@ApiModelProperty("appId") @ApiModelProperty("appId")
private String appId; private String appId;
private Long infoId;
@ApiModelProperty("链接类型") @ApiModelProperty("链接类型")
@JsonSerialize(using = ToStringSerializer.class)
private Integer newsType; private Integer newsType;
@ApiModelProperty("链接名") @ApiModelProperty("链接名")
...@@ -45,6 +48,11 @@ public class CustomerReferralDTO implements Serializable { ...@@ -45,6 +48,11 @@ public class CustomerReferralDTO implements Serializable {
@ApiModelProperty(value="序号") @ApiModelProperty(value="序号")
private Integer sort; private Integer sort;
private String accountName;
@ApiModelProperty(value = "渠道号")
private String accountId;
@ApiModelProperty("书城") @ApiModelProperty("书城")
private String storeType; private String storeType;
...@@ -87,6 +95,11 @@ public class CustomerReferralDTO implements Serializable { ...@@ -87,6 +95,11 @@ public class CustomerReferralDTO implements Serializable {
@ApiModelProperty(value = "赠送数量") @ApiModelProperty(value = "赠送数量")
private Integer giftAmount; private Integer giftAmount;
@ApiModelProperty(value = "模板Id")
private String templateId;
private String h5Content;
public Date getStartTime() { public Date getStartTime() {
if (ObjectUtil.isNull(this.startTime) && CollectionUtil.isNotEmpty(this.dateList)) { if (ObjectUtil.isNull(this.startTime) && CollectionUtil.isNotEmpty(this.dateList)) {
return dateList.get(0); return dateList.get(0);
......
package com.yaoyaozw.customer.entity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import org.springframework.data.annotation.Id;
/**
* 客户跟进回复
*
* @author darker
* @date 2023/03/14
*/
@Data
@TableName("customer_follow_reply")
public class CustomerFollowReply implements Serializable {
/**
* 主键id
*/
@Id
@TableId(value = "id", type = IdType.ID_WORKER)
private Long id;
/**
* 公众号appid
*/
@TableField("appid")
private String appid;
/**
* 素材名称
*/
@TableField("name")
private String name;
/**
* 类型
*/
@TableField("type")
private String type;
/**
* 图片/音频 原文件地址
*/
@TableField("origin_media_url")
private String originMediaUrl;
/**
* 图片/音频 腾讯后台地址
*/
@TableField("tx_media_url")
private String txMediaUrl;
/**
* 图片/音频 腾讯后台标识
*/
@TableField("tx_media_id")
private String txMediaId;
/**
* 图文-推广标题
*/
@TableField("extend_title")
private String extendTitle;
/**
* 图文-推广描述
*/
@TableField("extend_desc")
private String extendDesc;
/**
* 图文链接地址
*/
@TableField("source_url")
private String sourceUrl;
/**
* 文本-H5
*/
@TableField("content")
private String content;
/**
* 发文排序
*/
@TableField("sort")
private Integer sort;
/**
* 状态
*/
@TableField("status")
private Integer status;
/**
* 逻辑删除
*/
@TableField(value = "is_deleted", fill = FieldFill.INSERT)
@TableLogic
private Integer isDeleted;
/**
* 创建人
*/
@TableField(value = "create_user", fill = FieldFill.INSERT)
private Long createUser;
/**
* 创建时间
*/
@TableField(value = "gmt_create", fill = FieldFill.INSERT)
private Date gmtCreate;
/**
* 更新人
*/
@TableField(value = "modified_user", fill = FieldFill.INSERT_UPDATE)
private Long modifiedUser;
/**
* 更新时间
*/
@TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
private Date gmtModified;
@TableField(exist = false)
private List<ReferralEntity> referralEntityList;
private static final long serialVersionUID = 1L;
}
...@@ -208,6 +208,12 @@ public class ReferralEntity implements Serializable { ...@@ -208,6 +208,12 @@ public class ReferralEntity implements Serializable {
@ApiModelProperty(value = "infoId") @ApiModelProperty(value = "infoId")
private Long infoId; private Long infoId;
@TableField(exist = false)
private String h5Content;
@TableField(exist = false)
private String accountName;
public static final String COL_ID = "id"; public static final String COL_ID = "id";
public static final String COL_ACCOUNT_ID = "account_id"; public static final String COL_ACCOUNT_ID = "account_id";
......
...@@ -3,7 +3,9 @@ package com.yaoyaozw.customer.mapper; ...@@ -3,7 +3,9 @@ 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.entity.AuthorizerInfo; import com.yaoyaozw.customer.entity.AuthorizerInfo;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
...@@ -14,4 +16,12 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -14,4 +16,12 @@ import org.apache.ibatis.annotations.Mapper;
@DS("material") @DS("material")
public interface AuthorizerInfoMapper extends BaseMapper<AuthorizerInfo> { public interface AuthorizerInfoMapper extends BaseMapper<AuthorizerInfo> {
/**
* 根据appid获取公众号信息
*
* @param appid appid
* @return {@link AuthInfoVO}
*/
AuthInfoVO getAuthInfoByAppid(@Param("appid") String appid);
} }
\ No newline at end of file
package com.yaoyaozw.customer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yaoyaozw.customer.dto.follow.FollowReplyQueryDTO;
import com.yaoyaozw.customer.entity.CustomerFollowReply;
import com.yaoyaozw.customer.vo.follow.FollowReplyListVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author darker
* @date 2023/3/14 11:14
*/
@Repository
public interface CustomerFollowReplyMapper extends BaseMapper<CustomerFollowReply> {
/**
* 得到列表
*
* @param queryDto 查询dto
* @return {@link List}<{@link FollowReplyListVO}>
*/
List<FollowReplyListVO> getList(@Param("queryDto") FollowReplyQueryDTO queryDto);
}
...@@ -2,6 +2,7 @@ package com.yaoyaozw.customer.service; ...@@ -2,6 +2,7 @@ package com.yaoyaozw.customer.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yaoyaozw.customer.entity.AuthorizerInfo; import com.yaoyaozw.customer.entity.AuthorizerInfo;
import com.yaoyaozw.customer.vo.AuthInfoVO;
/** /**
...@@ -12,5 +13,12 @@ import com.yaoyaozw.customer.entity.AuthorizerInfo; ...@@ -12,5 +13,12 @@ import com.yaoyaozw.customer.entity.AuthorizerInfo;
*/ */
public interface AuthorizerInfoService extends IService<AuthorizerInfo> { public interface AuthorizerInfoService extends IService<AuthorizerInfo> {
/**
* 根据appid获取公众号信息
*
* @param appid appid
* @return {@link AuthInfoVO}
*/
AuthInfoVO getAuthInfoByAppid(String appid);
} }
...@@ -3,7 +3,7 @@ package com.yaoyaozw.customer.service; ...@@ -3,7 +3,7 @@ package com.yaoyaozw.customer.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yaoyaozw.customer.common.GenericsResult; import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.customer.CustomerDelayTextSaveDTO; import com.yaoyaozw.customer.dto.customer.CustomerDelayTextSaveDTO;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO; import com.yaoyaozw.customer.entity.CommonReferralBody;
import com.yaoyaozw.customer.entity.CustomerGraphicsDelay; import com.yaoyaozw.customer.entity.CustomerGraphicsDelay;
import com.yaoyaozw.customer.vo.customer.CustomerDelayTextDetailVO; import com.yaoyaozw.customer.vo.customer.CustomerDelayTextDetailVO;
...@@ -28,7 +28,7 @@ public interface CustomerDelayTextService extends IService<CustomerGraphicsDelay ...@@ -28,7 +28,7 @@ public interface CustomerDelayTextService extends IService<CustomerGraphicsDelay
* @param referralDto 推荐dto * @param referralDto 推荐dto
* @return {@link GenericsResult}<{@link CustomerDelayTextDetailVO}> * @return {@link GenericsResult}<{@link CustomerDelayTextDetailVO}>
*/ */
GenericsResult<CustomerDelayTextDetailVO> insertCustomerContent(CustomerReferralDTO referralDto); GenericsResult<CustomerDelayTextDetailVO> insertCustomerContent(CommonReferralBody referralDto);
/** /**
* 得到客户文本细节 * 得到客户文本细节
......
package com.yaoyaozw.customer.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.dto.follow.FollowReplyCopyDTO;
import com.yaoyaozw.customer.dto.follow.FollowReplyQueryDTO;
import com.yaoyaozw.customer.dto.follow.FollowReplySaveDTO;
import com.yaoyaozw.customer.entity.CommonReferralBody;
import com.yaoyaozw.customer.entity.CustomerFollowReply;
import com.yaoyaozw.customer.vo.follow.FollowReplyInfoVO;
import com.yaoyaozw.customer.vo.follow.FollowReplyListVO;
import java.util.List;
/**
* @author darker
* @date 2023/3/14 11:14
*/
public interface CustomerFollowReplyService extends IService<CustomerFollowReply> {
/**
* 列表
*
* @param queryDto 查询dto
* @return {@link GenericsResult}<{@link List}<{@link FollowReplyListVO}>>
*/
GenericsResult<List<FollowReplyListVO>> list(FollowReplyQueryDTO queryDto);
/**
* 创建
*
* @param saveDto 保存dto
* @return {@link GenericsResult}<{@link String}>
*/
GenericsResult<String> create(FollowReplySaveDTO saveDto);
/**
* 创建文本项
*
* @param referralBody 推荐身体
* @return {@link GenericsResult}<{@link List}<{@link CommonReferralBody}>>
*/
GenericsResult<List<CommonReferralBody>> createTextItem(CommonReferralBody referralBody);
/**
* 删除
*
* @param id id
* @return {@link BaseResult}
*/
BaseResult remove(Long id);
/**
* 删除文本项
*
* @param id id
* @return {@link GenericsResult}<{@link List}<{@link CommonReferralBody}>>
*/
GenericsResult<List<CommonReferralBody>> removeTextItem(Long id);
/**
* 复制
*
* @param copyDto 复制dto
* @return {@link BaseResult}
*/
BaseResult copy(FollowReplyCopyDTO copyDto);
/**
* 得到信息
*
* @param id id
* @return {@link GenericsResult}<{@link FollowReplyInfoVO}>
*/
GenericsResult<FollowReplyInfoVO> getInfo(Long id);
}
...@@ -3,7 +3,7 @@ package com.yaoyaozw.customer.service; ...@@ -3,7 +3,7 @@ package com.yaoyaozw.customer.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yaoyaozw.customer.common.GenericsResult; 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.entity.CommonReferralBody;
import com.yaoyaozw.customer.entity.CustomerGraphics; import com.yaoyaozw.customer.entity.CustomerGraphics;
import com.yaoyaozw.customer.vo.customer.CustomerMessageTextDetailVO; import com.yaoyaozw.customer.vo.customer.CustomerMessageTextDetailVO;
...@@ -28,7 +28,7 @@ public interface CustomerGraphicsTextService extends IService<CustomerGraphics> ...@@ -28,7 +28,7 @@ public interface CustomerGraphicsTextService extends IService<CustomerGraphics>
* @param referralDto 推荐dto * @param referralDto 推荐dto
* @return {@link GenericsResult}<{@link CustomerMessageTextDetailVO}> * @return {@link GenericsResult}<{@link CustomerMessageTextDetailVO}>
*/ */
GenericsResult<CustomerMessageTextDetailVO> insertCustomerContent(CustomerReferralDTO referralDto); GenericsResult<CustomerMessageTextDetailVO> insertCustomerContent(CommonReferralBody referralDto);
/** /**
* 获取文本客服详情 * 获取文本客服详情
......
...@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yaoyaozw.customer.entity.AuthorizerInfo; import com.yaoyaozw.customer.entity.AuthorizerInfo;
import com.yaoyaozw.customer.mapper.AuthorizerInfoMapper; import com.yaoyaozw.customer.mapper.AuthorizerInfoMapper;
import com.yaoyaozw.customer.service.AuthorizerInfoService; import com.yaoyaozw.customer.service.AuthorizerInfoService;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -16,4 +19,17 @@ import org.springframework.stereotype.Service; ...@@ -16,4 +19,17 @@ import org.springframework.stereotype.Service;
@Service @Service
public class AuthorizerInfoServiceImpl extends ServiceImpl<AuthorizerInfoMapper, AuthorizerInfo> implements AuthorizerInfoService { public class AuthorizerInfoServiceImpl extends ServiceImpl<AuthorizerInfoMapper, AuthorizerInfo> implements AuthorizerInfoService {
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@Override
public AuthInfoVO getAuthInfoByAppid(String appid) {
AuthInfoVO authInfo = this.baseMapper.getAuthInfoByAppid(appid);
Object storeTypeName = redisTemplate.opsForHash().get("STORE_NAME_MAP", authInfo.getStoreType());
if (storeTypeName != null) {
authInfo.setStoreTypeName(String.valueOf(storeTypeName));
}
return authInfo;
}
} }
...@@ -5,21 +5,17 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -5,21 +5,17 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.yaoyaozw.customer.common.BaseResult;
import com.yaoyaozw.customer.common.GenericsResult; import com.yaoyaozw.customer.common.GenericsResult;
import com.yaoyaozw.customer.components.CustomerServiceCommonAsyncComponent; import com.yaoyaozw.customer.components.CustomerServiceCommonAsyncComponent;
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.constants.CustomerCommonConstant;
import com.yaoyaozw.customer.dto.customer.CustomerDelayTextSaveDTO; import com.yaoyaozw.customer.dto.customer.CustomerDelayTextSaveDTO;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO; import com.yaoyaozw.customer.entity.CommonReferralBody;
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.mapper.MaterialCommonMapper; import com.yaoyaozw.customer.mapper.MaterialCommonMapper;
import com.yaoyaozw.customer.service.AuthorizerInfoService;
import com.yaoyaozw.customer.service.CustomerDelayTextService; import com.yaoyaozw.customer.service.CustomerDelayTextService;
import com.yaoyaozw.customer.service.CustomerGraphicsDelayService; import com.yaoyaozw.customer.service.CustomerGraphicsDelayService;
import com.yaoyaozw.customer.service.ReferralEntityService; import com.yaoyaozw.customer.service.ReferralEntityService;
...@@ -30,9 +26,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -30,9 +26,7 @@ import org.apache.commons.lang3.StringUtils;
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.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -102,7 +96,7 @@ public class CustomerDelayTextServiceImpl extends ServiceImpl<CustomerGraphicsDe ...@@ -102,7 +96,7 @@ public class CustomerDelayTextServiceImpl extends ServiceImpl<CustomerGraphicsDe
} }
@Override @Override
public GenericsResult<CustomerDelayTextDetailVO> insertCustomerContent(CustomerReferralDTO referralDto) { public GenericsResult<CustomerDelayTextDetailVO> insertCustomerContent(CommonReferralBody referralDto) {
// 处理活动数据 // 处理活动数据
ReferralEntity referralEntity = new ReferralEntity(); ReferralEntity referralEntity = new ReferralEntity();
...@@ -174,7 +168,7 @@ public class CustomerDelayTextServiceImpl extends ServiceImpl<CustomerGraphicsDe ...@@ -174,7 +168,7 @@ public class CustomerDelayTextServiceImpl extends ServiceImpl<CustomerGraphicsDe
} }
// 赋值链接信息 // 赋值链接信息
CustomerReferralDTO customerReferralDto = new CustomerReferralDTO(); CommonReferralBody customerReferralDto = new CommonReferralBody();
BeanUtil.copyProperties(item, customerReferralDto); BeanUtil.copyProperties(item, customerReferralDto);
customerContentVO.setCustomerReferralDto(customerReferralDto); customerContentVO.setCustomerReferralDto(customerReferralDto);
......
...@@ -15,7 +15,7 @@ import com.yaoyaozw.customer.components.TokenManager; ...@@ -15,7 +15,7 @@ import com.yaoyaozw.customer.components.TokenManager;
import com.yaoyaozw.customer.constants.CustomerCommonConstant; 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.CommonReferralBody;
import com.yaoyaozw.customer.entity.AuthorizerInfo; 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;
...@@ -23,7 +23,6 @@ import com.yaoyaozw.customer.mapper.CustomerGraphicsDelayMapper; ...@@ -23,7 +23,6 @@ import com.yaoyaozw.customer.mapper.CustomerGraphicsDelayMapper;
import com.yaoyaozw.customer.mapper.KanbanCommonMapper; import com.yaoyaozw.customer.mapper.KanbanCommonMapper;
import com.yaoyaozw.customer.mapper.MaterialCommonMapper; import com.yaoyaozw.customer.mapper.MaterialCommonMapper;
import com.yaoyaozw.customer.service.AuthorizerInfoService; import com.yaoyaozw.customer.service.AuthorizerInfoService;
import com.yaoyaozw.customer.service.CustomerDelayTextService;
import com.yaoyaozw.customer.service.CustomerGraphicsDelayService; import com.yaoyaozw.customer.service.CustomerGraphicsDelayService;
import com.yaoyaozw.customer.service.ReferralEntityService; import com.yaoyaozw.customer.service.ReferralEntityService;
import com.yaoyaozw.customer.vo.AuthInfoVO; import com.yaoyaozw.customer.vo.AuthInfoVO;
...@@ -36,9 +35,9 @@ import org.apache.commons.lang3.StringUtils; ...@@ -36,9 +35,9 @@ import org.apache.commons.lang3.StringUtils;
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.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -57,6 +56,8 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -57,6 +56,8 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
private final static String EMPTY_STR = " "; private final static String EMPTY_STR = " ";
private final static String STORE_NAME_REDIS_KEY = "STORE_NAME_MAP";
@Autowired @Autowired
private TokenManager tokenManager; private TokenManager tokenManager;
@Autowired @Autowired
...@@ -71,6 +72,8 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -71,6 +72,8 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
private CustomerServiceCommonAsyncComponent commonAsyncComponent; private CustomerServiceCommonAsyncComponent commonAsyncComponent;
@Autowired @Autowired
private MaterialCommonMapper materialCommonMapper; private MaterialCommonMapper materialCommonMapper;
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@Override @Override
...@@ -177,12 +180,12 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -177,12 +180,12 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
ReferralEntity referralEntity = referralEntityService.getOne(new QueryWrapper<ReferralEntity>().eq("material_graphics_id", id)); ReferralEntity referralEntity = referralEntityService.getOne(new QueryWrapper<ReferralEntity>().eq("material_graphics_id", id));
if (ObjectUtil.isNotNull(referralEntity)) { if (ObjectUtil.isNotNull(referralEntity)) {
CustomerReferralDTO customerReferralDto = new CustomerReferralDTO(); CommonReferralBody customerReferralDto = new CommonReferralBody();
BeanUtil.copyProperties(referralEntity, customerReferralDto); BeanUtil.copyProperties(referralEntity, customerReferralDto);
customerDelayGraphicsDetailVO.setCustomerReferralDto(customerReferralDto); customerDelayGraphicsDetailVO.setCustomerReferralDto(customerReferralDto);
} else { } else {
customerDelayGraphicsDetailVO.setCustomerReferralDto(new CustomerReferralDTO()); customerDelayGraphicsDetailVO.setCustomerReferralDto(new CommonReferralBody());
} }
AuthInfoVO authInfoVO = super.baseMapper.getCustomerDelayAuthInfo(id); AuthInfoVO authInfoVO = super.baseMapper.getCustomerDelayAuthInfo(id);
...@@ -312,6 +315,17 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi ...@@ -312,6 +315,17 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
} }
List<AuthInfoVO> authList = super.baseMapper.getAuthList(keyword, keywordList, storeType, appId); List<AuthInfoVO> authList = super.baseMapper.getAuthList(keyword, keywordList, storeType, appId);
Map<Object, Object> entries = redisTemplate.opsForHash().entries(STORE_NAME_REDIS_KEY);
if (CollectionUtil.isNotEmpty(entries)) {
Map<String, String> map = new HashMap<>(entries.size());
entries.forEach((key, value) -> {
map.put(key.toString(), value.toString());
});
authList.forEach(item -> item.setStoreTypeName(map.get(item.getStoreType())));
}
return new GenericsResult<>(authList); return new GenericsResult<>(authList);
} }
......
...@@ -15,6 +15,11 @@ import com.yaoyaozw.customer.constants.CustomerCommonConstant; ...@@ -15,6 +15,11 @@ import com.yaoyaozw.customer.constants.CustomerCommonConstant;
import com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO; import com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO;
import com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO; import com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO;
import com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO; import com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO;
import com.yaoyaozw.customer.entity.AuthorizerToken;
import com.yaoyaozw.customer.entity.CommonReferralBody;
import com.yaoyaozw.customer.entity.CrowdPackageCondition;
import com.yaoyaozw.customer.entity.CrowdPackageConditionMatch;
import com.yaoyaozw.customer.entity.ReferralEntity;
import com.yaoyaozw.customer.entity.*; import com.yaoyaozw.customer.entity.*;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO; import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO;
import com.yaoyaozw.customer.mapper.KanbanCommonMapper; import com.yaoyaozw.customer.mapper.KanbanCommonMapper;
...@@ -44,7 +49,6 @@ import com.yaoyaozw.customer.service.CustomerGraphicsService; ...@@ -44,7 +49,6 @@ import com.yaoyaozw.customer.service.CustomerGraphicsService;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toCollection; import static java.util.stream.Collectors.toCollection;
/** /**
...@@ -131,7 +135,7 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap ...@@ -131,7 +135,7 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
// 获取链接数据 // 获取链接数据
ReferralEntity referralEntity = referralEntityService.getOne(new QueryWrapper<ReferralEntity>().eq("material_graphics_id", id).isNull("account_id")); ReferralEntity referralEntity = referralEntityService.getOne(new QueryWrapper<ReferralEntity>().eq("material_graphics_id", id).isNull("account_id"));
CustomerReferralDTO customerReferralDto = new CustomerReferralDTO(); CommonReferralBody customerReferralDto = new CommonReferralBody();
if (ObjectUtil.isNull(referralEntity)) { if (ObjectUtil.isNull(referralEntity)) {
return new GenericsResult<>(false, "找不到链接数据"); return new GenericsResult<>(false, "找不到链接数据");
......
...@@ -10,7 +10,7 @@ import com.yaoyaozw.customer.components.SnowflakeComponent; ...@@ -10,7 +10,7 @@ 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.constants.CustomerCommonConstant;
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.entity.CommonReferralBody;
import com.yaoyaozw.customer.entity.CustomerGraphics; import com.yaoyaozw.customer.entity.CustomerGraphics;
import com.yaoyaozw.customer.entity.ReferralEntity; import com.yaoyaozw.customer.entity.ReferralEntity;
import com.yaoyaozw.customer.mapper.CustomerGraphicsMapper; import com.yaoyaozw.customer.mapper.CustomerGraphicsMapper;
...@@ -73,7 +73,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic ...@@ -73,7 +73,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public GenericsResult<CustomerMessageTextDetailVO> insertCustomerContent(CustomerReferralDTO referralDto) { public GenericsResult<CustomerMessageTextDetailVO> insertCustomerContent(CommonReferralBody referralDto) {
// 处理活动数据 // 处理活动数据
ReferralEntity referralEntity = new ReferralEntity(); ReferralEntity referralEntity = new ReferralEntity();
...@@ -136,7 +136,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic ...@@ -136,7 +136,7 @@ public class CustomerGraphicsTextServiceImpl extends ServiceImpl<CustomerGraphic
} }
// 赋值链接信息 // 赋值链接信息
CustomerReferralDTO customerReferralDto = new CustomerReferralDTO(); CommonReferralBody customerReferralDto = new CommonReferralBody();
BeanUtil.copyProperties(item, customerReferralDto); BeanUtil.copyProperties(item, customerReferralDto);
customerContentVO.setCustomerReferralDto(customerReferralDto); customerContentVO.setCustomerReferralDto(customerReferralDto);
......
package com.yaoyaozw.customer.utils;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yaoyaozw.customer.entity.AuthorizerToken;
import com.yaoyaozw.customer.entity.ReferralEntity;
import com.yaoyaozw.customer.service.AuthorizerTokenService;
import com.yaoyaozw.customer.service.ReferralEntityService;
import com.yaoyaozw.customer.vo.TencentMediaResponseVO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author darker
* @date 2023/3/13 20:11
*/
@Component
public class TencentCustomerUtil{
private final static Logger localLog = LoggerFactory.getLogger(TencentCustomerUtil.class);
private final static String AUTH_ACCESS_TOKEN_REDIS_KEY = "AUTH_ACCESS_TOKEN";
private final static String MEDIA_ADD_URL = "https://api.weixin.qq.com/cgi-bin/material/add_material";
private final static String MEDIA_DEL_URL = "https://api.weixin.qq.com/cgi-bin/material/del_material";
@Autowired
private AuthorizerTokenService authorizerTokenService;
@Autowired
private RedisTemplate<String, Object> redisTemplate;
/**
* 上传腾讯媒体
*
* @param appid 公众号
* @param fileUrl 文件url
* @return {@link TencentMediaResponseVO}
*/
public TencentMediaResponseVO uploadTencentMedia(String appid, String fileUrl, String mediaType) {
localLog.info("上传媒体文件, 原始文件地址: {}", fileUrl);
// 获取公众号token
String accessToken = getAccessTokenByAppid(appid);
if (StringUtils.isEmpty(accessToken)) {
localLog.warn("appid: {} 没找到accessToken", appid);
TencentMediaResponseVO response = new TencentMediaResponseVO();
response.setErrmsg("appid: " + appid + "没找到accessToken");
return response;
}
// 根据文件地址获取文件
String suffix = fileUrl.substring(fileUrl.lastIndexOf("=") + 1);
byte[] fileByte = HttpClientUtil.readInputStream(fileUrl);
// 构造参数,上传到腾讯后台
Map<String, String> map = new HashMap<>(4);
map.put("access_token", accessToken);
map.put("type", mediaType);
String json = HttpClientUtil.uploadFileByte(MEDIA_ADD_URL, fileByte, map, suffix);
return JSONUtil.toBean(JSONUtil.parseObj(json), TencentMediaResponseVO.class);
}
/**
* 删除永久媒体
*
* @param appid appid
* @param mediaId 媒体id
* @return {@link TencentMediaResponseVO}
*/
public TencentMediaResponseVO removePermanentMedia(String appid, String mediaId) {
// 获取公众号token
String accessToken = getAccessTokenByAppid(appid);
// 构造参数,上传到腾讯后台
Map<String, String> map = new HashMap<>(4);
map.put("access_token", accessToken);
JSONObject json = new JSONObject();
json.put("media_id", mediaId);
String jsonStr = JSONUtil.toJsonStr(json);
String delResult = HttpClientUtil.doPostJson(MEDIA_DEL_URL, jsonStr, map);
localLog.info("删除素材结果: {}", delResult);
return JSONUtil.toBean(JSONUtil.parseObj(delResult), TencentMediaResponseVO.class);
}
/**
* 通过appid获取访问令牌
*
* @param appid appid
* @return {@link String}
*/
private String getAccessTokenByAppid(String appid) {
Object token = redisTemplate.opsForHash().get(AUTH_ACCESS_TOKEN_REDIS_KEY, appid);
// 如果redis中没找到, 去数据库找
if (ObjectUtil.isNull(token)) {
AuthorizerToken authorizerToken = authorizerTokenService.findTokenByAppid(appid);
return ObjectUtil.isNull(authorizerToken) ? null : authorizerToken.getAuthorizerAccessToken();
}
return String.valueOf(token);
}
}
package com.yaoyaozw.customer.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @author darker
* @date 2023/3/13 20:12
*/
@Data
public class TencentMediaResponseVO implements Serializable {
private String media_id;
private String url;
private Integer errcode;
private String errmsg;
}
...@@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yaoyaozw.customer.constants.CustomerCommonConstant; import com.yaoyaozw.customer.constants.CustomerCommonConstant;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO; import com.yaoyaozw.customer.entity.CommonReferralBody;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -26,7 +26,7 @@ public class CustomerContentVO implements Serializable { ...@@ -26,7 +26,7 @@ public class CustomerContentVO implements Serializable {
private String content; private String content;
@ApiModelProperty("链接相关内容") @ApiModelProperty("链接相关内容")
private CustomerReferralDTO customerReferralDto; private CommonReferralBody customerReferralDto;
@ApiModelProperty("是否可编辑") @ApiModelProperty("是否可编辑")
private Boolean editable; private Boolean editable;
......
...@@ -3,7 +3,7 @@ package com.yaoyaozw.customer.vo.customer; ...@@ -3,7 +3,7 @@ package com.yaoyaozw.customer.vo.customer;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO; import com.yaoyaozw.customer.entity.CommonReferralBody;
import com.yaoyaozw.customer.vo.AuthInfoVO; import com.yaoyaozw.customer.vo.AuthInfoVO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -51,7 +51,7 @@ public class CustomerDelayGraphicsDetailVO implements Serializable { ...@@ -51,7 +51,7 @@ public class CustomerDelayGraphicsDetailVO implements Serializable {
private Long timeInterval; private Long timeInterval;
@ApiModelProperty("链接相关内容") @ApiModelProperty("链接相关内容")
private CustomerReferralDTO customerReferralDto; private CommonReferralBody customerReferralDto;
private AuthInfoVO authInfoVo; private AuthInfoVO authInfoVo;
......
...@@ -2,7 +2,7 @@ package com.yaoyaozw.customer.vo.customer; ...@@ -2,7 +2,7 @@ package com.yaoyaozw.customer.vo.customer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yaoyaozw.customer.dto.customer.CustomerReferralDTO; import com.yaoyaozw.customer.entity.CommonReferralBody;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -41,6 +41,6 @@ public class CustomerMessageDetailVO implements Serializable { ...@@ -41,6 +41,6 @@ public class CustomerMessageDetailVO implements Serializable {
private String content; private String content;
@ApiModelProperty("链接相关内容") @ApiModelProperty("链接相关内容")
private CustomerReferralDTO customerReferralDto; private CommonReferralBody customerReferralDto;
} }
package com.yaoyaozw.customer.vo.follow;
import com.yaoyaozw.customer.entity.CustomerFollowReply;
import com.yaoyaozw.customer.entity.ReferralEntity;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author darker
* @date 2023/3/14 16:48
*/
@Data
public class FollowReplyCopyResultVO implements Serializable {
private Boolean hasError;
private List<CustomerFollowReply> materialList;
private List<ReferralEntity> referralEntityList;
}
package com.yaoyaozw.customer.vo.follow;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yaoyaozw.customer.entity.CommonReferralBody;
import com.yaoyaozw.customer.vo.AuthInfoVO;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @author darker
* @date 2023/3/13 20:07
*/
@Data
public class FollowReplyInfoVO implements Serializable {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
private String appid;
private String name;
private String type;
private String originMediaUrl;
private String extendTitle;
private String extendDesc;
private Integer sort;
private AuthInfoVO authInfo;
private CommonReferralBody referralBody;
private List<CommonReferralBody> textBodyList;
public CommonReferralBody getReferralBody() {
return ObjectUtil.isNull(referralBody) ? new CommonReferralBody() : referralBody;
}
public List<CommonReferralBody> getTextBodyList() {
return textBodyList == null ? new ArrayList<>(4) : textBodyList;
}
}
package com.yaoyaozw.customer.vo.follow;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yaoyaozw.customer.constants.FollowReplyCommonConstant;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
/**
* @author darker
* @date 2023/3/13 20:07
*/
@Data
public class FollowReplyListVO implements Serializable {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
private String name;
private String authName;
private String typeDesc;
private String statusDesc;
private String type;
private Integer sort;
public String getTypeDesc() {
return FollowReplyCommonConstant.getTypeDesc(this.type);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yaoyaozw.customer.mapper.AuthorizerInfoMapper">
<select id="getAuthInfoByAppid" 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
where appid = #{appid}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yaoyaozw.customer.mapper.CustomerFollowReplyMapper">
<select id="getList" resultType="com.yaoyaozw.customer.vo.follow.FollowReplyListVO">
select
rep.id,
rep.name,
rep.type,
rep.sort,
ai.nick_name as authName,
if(rep.status = 1, '正常', '异常') as statusDesc
from customer_follow_reply rep
left join authorizer_info ai
on rep.appid = ai.appid
where rep.is_deleted = 0
and rep.appid = #{queryDto.appId}
</select>
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论