Commit b29a1cb6 by 王祖波

Merge remote-tracking branch 'origin/feature-content2' into feature-content2

parents 8c8b7c95 22f111f6
package com.gic.haoban.manage.api.dto.content;
import java.io.Serializable;
import java.util.Date;
/**
* @Author MUSI
* @Date 2023/3/29 9:47 AM
* @Description
* @Version
* 销售线索
**/
public class PotentialCustomerDTO implements Serializable {
private static final long serialVersionUID = -8058807467674069679L;
private Long potentialCustomerId;
/**
* 会员昵称
*/
private String memberName;
/**
* 会员头像
*/
private String memberImageUrl;
/**
* 会员id
*/
private String memberId;
/**
* 销售线索-业务id
*/
private String bizId;
/**
* 业务类型 1 素材
*/
private Integer bizType;
/**
* 最后访问时间
*/
private Date lastAccessTime;
/**
* 会员手机号
*/
private String memberPhone;
/**
* 是否导购星标客户
* 1 是; 0否
*/
private Integer starFlag;
/**
* 导购是否查看
* 1 已查看 0 未查看;
*/
private Integer seeFlag;
/**
* 销售线索描述
* 通过XXX访问XXX
*/
private String desc;
/**
* 最近30天访问次数
*/
private Integer visitNum;
/**
* 导购与会员是否有好友
* 1 是好友; 0不是
*/
private Integer hasMemberRelation;
/**
* 会员全渠道成交
* 1 有过成交; 0 没有成交
*/
private Integer dealRecord;
/**
* 第几次访问
*/
private Integer times;
/**
* 停留时长 单位秒
*/
private Integer durationTime;
public Long getPotentialCustomerId() {
return potentialCustomerId;
}
public void setPotentialCustomerId(Long potentialCustomerId) {
this.potentialCustomerId = potentialCustomerId;
}
public String getMemberName() {
return memberName;
}
public void setMemberName(String memberName) {
this.memberName = memberName;
}
public String getMemberImageUrl() {
return memberImageUrl;
}
public void setMemberImageUrl(String memberImageUrl) {
this.memberImageUrl = memberImageUrl;
}
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public Date getLastAccessTime() {
return lastAccessTime;
}
public void setLastAccessTime(Date lastAccessTime) {
this.lastAccessTime = lastAccessTime;
}
public String getMemberPhone() {
return memberPhone;
}
public void setMemberPhone(String memberPhone) {
this.memberPhone = memberPhone;
}
public Integer getStarFlag() {
return starFlag;
}
public void setStarFlag(Integer starFlag) {
this.starFlag = starFlag;
}
public Integer getSeeFlag() {
return seeFlag;
}
public void setSeeFlag(Integer seeFlag) {
this.seeFlag = seeFlag;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Integer getVisitNum() {
return visitNum;
}
public void setVisitNum(Integer visitNum) {
this.visitNum = visitNum;
}
public Integer getHasMemberRelation() {
return hasMemberRelation;
}
public void setHasMemberRelation(Integer hasMemberRelation) {
this.hasMemberRelation = hasMemberRelation;
}
public Integer getDealRecord() {
return dealRecord;
}
public void setDealRecord(Integer dealRecord) {
this.dealRecord = dealRecord;
}
public Integer getTimes() {
return times;
}
public void setTimes(Integer times) {
this.times = times;
}
public Integer getDurationTime() {
return durationTime;
}
public void setDurationTime(Integer durationTime) {
this.durationTime = durationTime;
}
public String getBizId() {
return bizId;
}
public void setBizId(String bizId) {
this.bizId = bizId;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
}
package com.gic.haoban.manage.api.dto.content.report;
import java.io.Serializable;
/**
* @Author MUSI
* @Date 2023/3/25 7:18 PM
* @Description
* @Version
**/
public class MaterialReportDTO implements Serializable {
private static final long serialVersionUID = -6373558370216756429L;
/**
* 企业id
*/
private String enterpriseId;
/**
* 成员id
*/
private String staffId;
/**
* 周报类型
*/
private Integer reportType;
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public Integer getReportType() {
return reportType;
}
public void setReportType(Integer reportType) {
this.reportType = reportType;
}
}
package com.gic.haoban.manage.api.dto.qdto.content;
import com.gic.api.base.commons.BasePageInfo;
/**
* @Author MUSI
* @Date 2023/3/29 1:11 PM
* @Description
* @Version
**/
public class InteractRecordQDTO extends BasePageInfo {
/**
* 导购id
*/
private String clerkId;
/**
* 会员id
*/
private String memberId;
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
}
package com.gic.haoban.manage.api.dto.qdto.content;
import java.io.Serializable;
/**
* @Author MUSI
* @Date 2023/3/29 9:58 AM
* @Description
* @Version
**/
public class PotentialCustomerMarkRecordDTO implements Serializable {
private static final long serialVersionUID = -5408267247555124255L;
/**
* 线索id
*/
private Long potentialCustomerId;
/**
* 企业id
*/
private String enterpriseId;
/**
* 微信企业id
*/
private String wxEnterpriseId;
/**
* 会员id
*/
private String memberId;
/**
* 导购id
*/
private String clerkId;
/**
* 导购是否看过
* 1已看过
* 0未看过
*/
private Integer seeFlag;
/**
* 是否导购星标客户
* 1 与导购是星标 0 取消星标
*/
private Integer starFlag;
public Long getPotentialCustomerId() {
return potentialCustomerId;
}
public void setPotentialCustomerId(Long potentialCustomerId) {
this.potentialCustomerId = potentialCustomerId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public Integer getSeeFlag() {
return seeFlag;
}
public void setSeeFlag(Integer seeFlag) {
this.seeFlag = seeFlag;
}
public Integer getStarFlag() {
return starFlag;
}
public void setStarFlag(Integer starFlag) {
this.starFlag = starFlag;
}
}
package com.gic.haoban.manage.api.dto.qdto.content;
import com.gic.api.base.commons.BasePageInfo;
/**
* @Author MUSI
* @Date 2023/3/29 9:55 AM
* @Description
* @Version
**/
public class PotentialCustomerQDTO extends BasePageInfo {
private static final long serialVersionUID = 1854515840082825892L;
/**
* 企业id
*/
private String enterpriseId;
/**
* 微信企业id
*/
private String wxEnterpriseId;
/**
* 导购id
*/
private String clerkId;
/**
* 搜索字段
*/
private String search;
/**
* 导购是否看过
* 1已看过
* 0未看过
*/
private Integer seeFlag;
/**
* 是否导购星标客户
* 1 与导购是星标
*/
private Integer starFlag;
/**
* 导购与会员是否 企微好友
* 1 是好友; 0不是
*/
private Integer hasMemberRelation;
/**
* 会员是否有过成交
* 1 有过成交
*/
private Integer dealRecord;
/**
* 1 会员有手机号
*/
private Integer hasMemberPhone;
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getSearch() {
return search;
}
public void setSearch(String search) {
this.search = search;
}
public Integer getSeeFlag() {
return seeFlag;
}
public void setSeeFlag(Integer seeFlag) {
this.seeFlag = seeFlag;
}
public Integer getStarFlag() {
return starFlag;
}
public void setStarFlag(Integer starFlag) {
this.starFlag = starFlag;
}
public Integer getHasMemberRelation() {
return hasMemberRelation;
}
public void setHasMemberRelation(Integer hasMemberRelation) {
this.hasMemberRelation = hasMemberRelation;
}
public Integer getDealRecord() {
return dealRecord;
}
public void setDealRecord(Integer dealRecord) {
this.dealRecord = dealRecord;
}
public Integer getHasMemberPhone() {
return hasMemberPhone;
}
public void setHasMemberPhone(Integer hasMemberPhone) {
this.hasMemberPhone = hasMemberPhone;
}
}
package com.gic.haoban.manage.api.enums;
/**
* @Author MUSI
* @Date 2023/3/24 5:17 PM
* @Description
* @Version
* 0:店员,1:店长,2:区经
**/
public enum HaobanClerkTypeEnum {
;
HaobanClerkTypeEnum(Integer type, String desc){
this.code = type;
this.desc = desc;
}
private int code;
private String desc;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
......@@ -59,6 +59,7 @@ public enum NoticeMessageTypeEnum {
CUSTOMER_SUCCESS_ORDER_REFUND(4006, "客户成功退单通知", NoticeMessageCategoryTypeEnum.CUSTOMER.getType(), "customer_success_order_refund", "/pages/route/index?pageType=", "hbapp_user_bill_detail"),
MATERIAL_NEW_NOTIFY(6001, "素材上新通知", NoticeMessageCategoryTypeEnum.MATERIAL.getType(), "material_new_notify", "/pages/route/index?pageType=", "hbapp_material_center"),
MATERIAL_WEEK_REPORT(6002, "素材周报通知", NoticeMessageCategoryTypeEnum.MATERIAL.getType(), "material_week_notify", "/pages/route/index?pageType=", "hbapp_material_report"),
;
/**
......
package com.gic.haoban.manage.api.enums.content;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @Author MUSI
* @Date 2023/3/29 1:08 PM
* @Description
* @Version
**/
public class InteractRecordExtendInfoDTO implements Serializable {
private static final long serialVersionUID = 1577766149535235456L;
/**
* 订单编号
*/
private String orderNumber;
/**
* 订单创建时间
*/
private Date orderCreateTime;
/**
* 订单商品项总数
*/
private Integer orderTotalNum;
/**
* 订单应付
*/
private BigDecimal orderPay;
/**
* 订单实付
*/
private BigDecimal realPay;
/**
* 失效商品数量
*/
private Integer invalidGoodsNum;
/**
* 素材扩展商品信息
*/
private List<ExtendGoodsInfo> extendGoodsInfos;
public static class ExtendGoodsInfo {
/**
* 商品名称
*/
private String goodsName;
/**
* 商品主图
*/
private String goodsImageUrl;
/**
* 商品货号
*/
private String goodsCode;
/**
* 商品规格 红色,S; 白色,S
*/
private String goodsNorm;
/**
* 订单项数量
*/
private Integer orderNum;
/**
* 商品单价
*/
private BigDecimal salePrice;
public String getGoodsName() {
return goodsName;
}
public void setGoodsName(String goodsName) {
this.goodsName = goodsName;
}
public String getGoodsImageUrl() {
return goodsImageUrl;
}
public void setGoodsImageUrl(String goodsImageUrl) {
this.goodsImageUrl = goodsImageUrl;
}
public String getGoodsCode() {
return goodsCode;
}
public void setGoodsCode(String goodsCode) {
this.goodsCode = goodsCode;
}
public String getGoodsNorm() {
return goodsNorm;
}
public void setGoodsNorm(String goodsNorm) {
this.goodsNorm = goodsNorm;
}
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public BigDecimal getSalePrice() {
return salePrice;
}
public void setSalePrice(BigDecimal salePrice) {
this.salePrice = salePrice;
}
}
public String getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber;
}
public Date getOrderCreateTime() {
return orderCreateTime;
}
public void setOrderCreateTime(Date orderCreateTime) {
this.orderCreateTime = orderCreateTime;
}
public Integer getOrderTotalNum() {
return orderTotalNum;
}
public void setOrderTotalNum(Integer orderTotalNum) {
this.orderTotalNum = orderTotalNum;
}
public BigDecimal getOrderPay() {
return orderPay;
}
public void setOrderPay(BigDecimal orderPay) {
this.orderPay = orderPay;
}
public BigDecimal getRealPay() {
return realPay;
}
public void setRealPay(BigDecimal realPay) {
this.realPay = realPay;
}
public Integer getInvalidGoodsNum() {
return invalidGoodsNum;
}
public void setInvalidGoodsNum(Integer invalidGoodsNum) {
this.invalidGoodsNum = invalidGoodsNum;
}
public List<ExtendGoodsInfo> getExtendGoodsInfos() {
return extendGoodsInfos;
}
public void setExtendGoodsInfos(List<ExtendGoodsInfo> extendGoodsInfos) {
this.extendGoodsInfos = extendGoodsInfos;
}
}
package com.gic.haoban.manage.api.enums.content;
import java.io.Serializable;
import java.util.Date;
/**
* @Author MUSI
* @Date 2023/3/29 12:46 PM
* @Description
* @Version
**/
public class InteractRecordInfoDTO implements Serializable {
private static final long serialVersionUID = -170525928535773136L;
/**
* 互动记录id
*/
private Long interactRecordId;
/**
* 记录描述
* 通过XXX访问XXXX
*/
private String recordDesc;
/**
* 第几次访问
*/
private Integer times;
/**
* 停留时长 单位秒
*/
private Integer durationTime;
/**
* 记录生成时间
*/
private Date createTime;
/**
* 记录事件类型
* 1浏览素材;2 查看商品; 3 购买商品
* 通过此类型区分 弹窗提示
*/
private Integer eventType;
/**
* 业务id
*/
private String bizId;
/**
* 扩展信息
*/
private InteractRecordExtendInfoDTO extendInfo;
public Long getInteractRecordId() {
return interactRecordId;
}
public void setInteractRecordId(Long interactRecordId) {
this.interactRecordId = interactRecordId;
}
public String getRecordDesc() {
return recordDesc;
}
public void setRecordDesc(String recordDesc) {
this.recordDesc = recordDesc;
}
public Integer getTimes() {
return times;
}
public void setTimes(Integer times) {
this.times = times;
}
public Integer getDurationTime() {
return durationTime;
}
public void setDurationTime(Integer durationTime) {
this.durationTime = durationTime;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getEventType() {
return eventType;
}
public void setEventType(Integer eventType) {
this.eventType = eventType;
}
public String getBizId() {
return bizId;
}
public void setBizId(String bizId) {
this.bizId = bizId;
}
public InteractRecordExtendInfoDTO getExtendInfo() {
return extendInfo;
}
public void setExtendInfo(InteractRecordExtendInfoDTO extendInfo) {
this.extendInfo = extendInfo;
}
}
package com.gic.haoban.manage.api.enums.content;
/**
* @Author MUSI
* @Date 2023/3/29 2:00 PM
* @Description
* @Version
* 素材分享记录 枚举
**/
public enum MaterialInteractRecordEventType {
VISIT_MATERIAL(1, "浏览了你分享的素材"),
VISIT_PRODUCT(2, "浏览了你分享的素材,并查看了关联商品"),
ORDER(3, "浏览了你分享的素材,并购买了商品");
MaterialInteractRecordEventType(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public static MaterialInteractRecordEventType getInstance(Integer code) {
if (code == null) {
return null;
}
for (MaterialInteractRecordEventType value : values()) {
if (value.code.equals(code)) {
return value;
}
}
return null;
}
private Integer code;
private String desc;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
package com.gic.haoban.manage.api.enums.content;
/**
* @Author MUSI
* @Date 2023/3/24 10:25 PM
* @Description
* @Version
**/
public enum MaterialReportType {
WEEK(1, "周报"),
MONTH(2, "月报");
MaterialReportType(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
private Integer code;
private String desc;
public Integer getCode() {
return code;
}
public String getDesc() {
return desc;
}
}
package com.gic.haoban.manage.api.enums.content;
import java.util.Arrays;
import java.util.List;
/**
* @Author MUSI
* @Date 2023/3/19 10:06 PM
......@@ -11,11 +14,28 @@ public enum TriggerCustomerChannelType {
PYQ(1, "朋友圈"),
CUSTOMER_GROUP(2, "客户群"),
DIALOG_BOX(3, "对话框/群发给客户"),
DIALOG_BOX(3, "对话框"),
CONTENT_COPY(4, "复制文案"),
CONTENT_DOWNLOAD(5, "下载素材")
;
/**
* 展示文案的渠道类型
* @return
*/
public static List<Integer> showDescChannel(){
return Arrays.asList(PYQ.code, CUSTOMER_GROUP.code, DIALOG_BOX.code);
}
public static TriggerCustomerChannelType getInstance(Integer code) {
for (TriggerCustomerChannelType customerChannelType : values()) {
if (customerChannelType.code.equals(code)) {
return customerChannelType;
}
}
return null;
}
TriggerCustomerChannelType(Integer code, String desc) {
this.code = code;
this.desc = desc;
......
package com.gic.haoban.manage.api.service.content;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.qdto.content.InteractRecordQDTO;
import com.gic.haoban.manage.api.enums.content.InteractRecordInfoDTO;
/**
* @Author MUSI
* @Date 2023/3/29 12:45 PM
* @Description
* @Version
* 互动记录
**/
public interface InteractRecordApiService {
/**
* 查询互动记录
* @param interactRecordQDTO
* @return
*/
ServiceResponse<Page<InteractRecordInfoDTO>> queryInteractRecordList(InteractRecordQDTO interactRecordQDTO);
}
package com.gic.haoban.manage.api.service.content;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.content.PotentialCustomerDTO;
import com.gic.haoban.manage.api.dto.qdto.content.PotentialCustomerMarkRecordDTO;
import com.gic.haoban.manage.api.dto.qdto.content.PotentialCustomerQDTO;
/**
* @Author MUSI
* @Date 2023/3/29 9:47 AM
* @Description
* @Version
* 销售线索
**/
public interface PotentialCustomerApiService {
/**
* 查询销售线索记录
* @param potentialCustomerQDTO
* @return
*/
ServiceResponse<Page<PotentialCustomerDTO>> queryPotentialCustomer(PotentialCustomerQDTO potentialCustomerQDTO);
/**
* 标记销售线索 已看、星标
* @param potentialCustomerMarkRecordDTO
* @return
*/
ServiceResponse<Long> markPotentialCustomer(PotentialCustomerMarkRecordDTO potentialCustomerMarkRecordDTO);
}
......@@ -26,4 +26,30 @@ public interface QywxGroupMsgTaskApiService {
* @return
*/
ServiceResponse<Void> handlerTriggerCustomerDetailLog(String params);
/**
* 素材周报
* 0 0 10 ? * MON
* 或者 0 0 10 ? * 2
* 每周一 10点
* @param params
* @return
*/
ServiceResponse<Void> handlerMaterialWeekReport(String params);
/**
* 素材月报
* 0 0 10 1 * ?
* @param params
* @return
*/
ServiceResponse<Void> handlerMaterialMonthReport(String params);
/**
* 处理单成员素材使用周报/月报
* @param params
* @return
*/
ServiceResponse<Void> doHandlerMaterialOneStaffReportMQ(String params);
}
......@@ -174,6 +174,18 @@
<version>${gic-thirdparty-sdk}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-sharding-sdk</artifactId>
<version>4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-store-goods-api</artifactId>
<version>${gic-store-goods-api}</version>
</dependency>
</dependencies>
<build>
......
......@@ -179,4 +179,11 @@ public interface StaffMapper {
@Param("expireTime")Date expireTime,
@Param("activeCode")String activeCode);
/**
* 查询企业下所有成员ID
* @param wxEnterpriseIds
* @return
*/
List<String> queryStaffIdsWithEnterpriseId(@Param("wxEnterpriseIds") List<String> wxEnterpriseIds);
}
\ No newline at end of file
......@@ -119,4 +119,6 @@ public interface TabHaobanStaffClerkRelationMapper {
List<StaffClerkRelationDTO> listManageBindByStaffId(@Param("staffId") String staffId);
List<StaffClerkRelationDTO> listByStoreIds(@Param("wxEnterpriseId") String wxEnterpriseId,@Param("storeIds") List<String> storeIds);
List<StaffClerkRelationDTO> listAllRelationDtosByEnterpriseId(@Param("enterpriseId") String enterpriseId);
}
\ No newline at end of file
......@@ -68,4 +68,11 @@ public interface WxEnterpriseMapper {
*
*/
List<WxEnterpriseDTO> listAllEnterprise();
/**
* 查询GIC企业下关联的所有企微
* @param enterpriseId
* @return
*/
List<String> queryWxEnterpriseByEnterpriseId(@Param("enterpriseId") String enterpriseId);
}
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper.content;
import com.gic.haoban.manage.service.entity.content.TabHaobanInteractRecord;
import com.gic.haoban.manage.service.entity.content.TabHaobanPotentialCustomer;
import com.gic.haoban.manage.service.pojo.qo.content.InteractRecordQO;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* 互动记录明细(TabHaobanInteractRecord)表数据库访问层
*
* @author makejava
* @since 2023-03-28 10:32:47
*/
public interface TabHaobanInteractRecordMapper {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
TabHaobanInteractRecord queryById(Long id);
/**
* 查询指定行数据
*
* @param tabHaobanInteractRecord 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<TabHaobanInteractRecord> queryAllByLimit(TabHaobanInteractRecord tabHaobanInteractRecord);
/**
* 统计总行数
*
* @param tabHaobanInteractRecord 查询条件
* @return 总行数
*/
long count(TabHaobanInteractRecord tabHaobanInteractRecord);
/**
* 新增数据
*
* @param tabHaobanInteractRecord 实例对象
* @return 影响行数
*/
int insert(TabHaobanInteractRecord tabHaobanInteractRecord);
/**
* 批量新增数据(MyBatis原生foreach方法)
*
* @param entities List<TabHaobanInteractRecord> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<TabHaobanInteractRecord> entities);
/**
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
*
* @param entities List<TabHaobanInteractRecord> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<TabHaobanInteractRecord> entities);
/**
* 修改数据
*
* @param tabHaobanInteractRecord 实例对象
* @return 影响行数
*/
int update(TabHaobanInteractRecord tabHaobanInteractRecord);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Long id);
/**
* 查询互动明细
* @param enterpriseId
* @param traceId
* @return
*/
TabHaobanInteractRecord queryWithEnterpriseIdAndTraceId(@Param("enterpriseId") String enterpriseId, @Param("traceId") String traceId);
/**
* 查询互动记录列表
* @param interactRecordQO
* @return
*/
List<TabHaobanInteractRecord> queryInteractRecordList(InteractRecordQO interactRecordQO);
}
package com.gic.haoban.manage.service.dao.mapper.content;
import com.gic.haoban.manage.service.entity.content.TabHaobanPotentialCustomer;
import com.gic.haoban.manage.service.pojo.qo.content.PotentialCustomerQO;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* 销售线索(TabHaobanPotentialCustomer)表数据库访问层
*
* @author makejava
* @since 2023-03-28 09:48:07
*/
public interface TabHaobanPotentialCustomerMapper {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
TabHaobanPotentialCustomer queryById(@Param("id") Long id, @Param("clerkId") String clerkId);
/**
* 查询销售线索
* @param clerkId
* @param memberId
* @return
*/
TabHaobanPotentialCustomer queryWithClerkIdAndMemberId(@Param("clerkId") String clerkId, @Param("memberId") String memberId);
/**
* 统计总行数
*
* @param tabHaobanPotentialCustomer 查询条件
* @return 总行数
*/
long count(TabHaobanPotentialCustomer tabHaobanPotentialCustomer);
/**
* 新增数据
*
* @param tabHaobanPotentialCustomer 实例对象
* @return 影响行数
*/
int insert(TabHaobanPotentialCustomer tabHaobanPotentialCustomer);
/**
* 批量新增数据(MyBatis原生foreach方法)
*
* @param entities List<TabHaobanPotentialCustomer> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<TabHaobanPotentialCustomer> entities);
/**
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
*
* @param entities List<TabHaobanPotentialCustomer> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<TabHaobanPotentialCustomer> entities);
/**
* 修改数据
*
* @param tabHaobanPotentialCustomer 实例对象
* @return 影响行数
*/
int update(TabHaobanPotentialCustomer tabHaobanPotentialCustomer);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Long id);
/**
* 查询明细
* @param potentialCustomerQO
* @return
*/
List<TabHaobanPotentialCustomer> queryPotentialCustomerList(PotentialCustomerQO potentialCustomerQO);
}
package com.gic.haoban.manage.service.entity.content;
import java.util.Date;
import java.io.Serializable;
/**
* 互动记录明细(TabHaobanInteractRecord)实体类
*
* @author makejava
* @since 2023-03-28 10:32:47
*/
public class TabHaobanInteractRecord implements Serializable {
private static final long serialVersionUID = 518532274984830043L;
private Long id;
private String enterpriseId;
/**
* 会员id
*/
private String memberId;
/**
* 会员微信公众号id
*/
private String unionId;
/**
* 导购id
*/
private String clerkId;
/**
* 埋点traceId
*/
private String traceId;
/**
* 销售线索-业务id
*/
private String bizId;
/**
* 业务类型 1 素材
*/
private Integer bizType;
/**
* 门店id
*/
private String storeId;
/**
* 线索来源 1朋友圈; 2客户群; 3 对话框; 0其他
*/
private Integer channelSource;
/**
* 事件类型 1浏览商品;2浏览并点击; 3浏览并查看; 4 浏览并购买; 5查看并购买
*/
private Integer eventType;
/**
* 停留时长 单位秒
*/
private Integer durationTime;
/**
* 第几次访问
*/
private Integer times;
/**
* 状态 1 删除; 0正常
*/
private Integer deleteFlag;
/**
* 扩展信息 查看的商品,关联的订单号
*/
private String extendInfo;
/**
* 创建时间
*/
private Date createTime;
private Date updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getTraceId() {
return traceId;
}
public void setTraceId(String traceId) {
this.traceId = traceId;
}
public String getBizId() {
return bizId;
}
public void setBizId(String bizId) {
this.bizId = bizId;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public Integer getChannelSource() {
return channelSource;
}
public void setChannelSource(Integer channelSource) {
this.channelSource = channelSource;
}
public Integer getEventType() {
return eventType;
}
public void setEventType(Integer eventType) {
this.eventType = eventType;
}
public Integer getDurationTime() {
return durationTime;
}
public void setDurationTime(Integer durationTime) {
this.durationTime = durationTime;
}
public Integer getTimes() {
return times;
}
public void setTimes(Integer times) {
this.times = times;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public String getExtendInfo() {
return extendInfo;
}
public void setExtendInfo(String extendInfo) {
this.extendInfo = extendInfo;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
package com.gic.haoban.manage.service.entity.content;
import java.util.Date;
import java.io.Serializable;
/**
* 销售线索(TabHaobanPotentialCustomer)实体类
*
* @author makejava
* @since 2023-03-28 09:48:07
*/
public class TabHaobanPotentialCustomer implements Serializable {
private static final long serialVersionUID = -28370046858269747L;
private Long id;
/**
* 企业id
*/
private String enterpriseId;
/**
* 会员id
*/
private String memberId;
/**
* 会员微信公众号id
*/
private String unionId;
/**
* 导购id
*/
private String clerkId;
/**
* 销售线索-业务id
*/
private String bizId;
/**
* 业务类型 1 素材
*/
private Integer bizType;
/**
* 门店id
*/
private String storeId;
/**
* 线索来源 1朋友圈; 2客户群; 3 对话框; 0其他
*/
private Integer channelSource;
/**
* 事件类型 1访问素材;2访问商品; 3购买商品;
*/
private Integer eventType;
/**
* 停留时长 单位秒
*/
private Integer durationTime;
/**
* 访问次数
*/
private Integer times;
/**
* 会员名称
*/
private String memberName;
/**
* 会员昵称
*/
private String memberNickName;
/**
* 会员手机号
*/
private String memberPhone;
/**
* 成交数量
*/
private Integer dealRecordNum;
/**
* 是否导购星标客户 1是; 0否
*/
private Integer starFlag;
/**
* 是否看过 1 看过; 0未看过
*/
private Integer seeFlag;
/**
* 最新访问时间
*/
private Date lastAccessTime;
/**
* 状态 1 删除; 0正常
*/
private Integer deleteFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public String getBizId() {
return bizId;
}
public void setBizId(String bizId) {
this.bizId = bizId;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public Integer getChannelSource() {
return channelSource;
}
public void setChannelSource(Integer channelSource) {
this.channelSource = channelSource;
}
public Integer getEventType() {
return eventType;
}
public void setEventType(Integer eventType) {
this.eventType = eventType;
}
public Integer getDurationTime() {
return durationTime;
}
public void setDurationTime(Integer durationTime) {
this.durationTime = durationTime;
}
public String getMemberName() {
return memberName;
}
public void setMemberName(String memberName) {
this.memberName = memberName;
}
public String getMemberNickName() {
return memberNickName;
}
public void setMemberNickName(String memberNickName) {
this.memberNickName = memberNickName;
}
public String getMemberPhone() {
return memberPhone;
}
public void setMemberPhone(String memberPhone) {
this.memberPhone = memberPhone;
}
public Integer getDealRecordNum() {
return dealRecordNum;
}
public void setDealRecordNum(Integer dealRecordNum) {
this.dealRecordNum = dealRecordNum;
}
public Integer getStarFlag() {
return starFlag;
}
public void setStarFlag(Integer starFlag) {
this.starFlag = starFlag;
}
public Integer getSeeFlag() {
return seeFlag;
}
public void setSeeFlag(Integer seeFlag) {
this.seeFlag = seeFlag;
}
public Date getLastAccessTime() {
return lastAccessTime;
}
public void setLastAccessTime(Date lastAccessTime) {
this.lastAccessTime = lastAccessTime;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getTimes() {
return times;
}
public void setTimes(Integer times) {
this.times = times;
}
}
package com.gic.haoban.manage.service.pojo.bo.content;
import com.gic.haoban.manage.api.enums.content.InteractRecordExtendInfoDTO;
import lombok.Data;
import java.util.Date;
/**
* @Author MUSI
* @Date 2023/3/28 11:25 PM
* @Description
* @Version
* 互动记录
**/
@Data
public class InteractRecordBO {
private Long id;
private String enterpriseId;
/**
* 会员id
*/
private String memberId;
/**
* 会员微信公众号id
*/
private String unionId;
/**
* 导购id
*/
private String clerkId;
/**
* 埋点traceId
*/
private String traceId;
/**
* 销售线索-业务id
*/
private String bizId;
/**
* 业务类型 1 素材
*/
private Integer bizType;
/**
* 门店id
*/
private String storeId;
/**
* 线索来源 1朋友圈; 2客户群; 3 对话框; 0其他
*/
private Integer channelSource;
/**
* 事件类型 1浏览商品;2浏览并点击; 3浏览并查看; 4 浏览并购买; 5查看并购买
*/
private Integer eventType;
/**
* 停留时长 单位秒
*/
private Integer durationTime;
/**
* 第几次访问
*/
private Integer times;
/**
* 状态 1 删除; 0正常
*/
private Integer deleteFlag;
/**
* 创建时间
*/
private Date createTime;
private Date updateTime;
/**
* 记录描述
* 通过XXX访问XXXX
*/
private String recordDesc;
/**
* 扩展信息
*/
private InteractRecordExtendInfoBO extendInfo;
}
package com.gic.haoban.manage.service.pojo.bo.content;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @Author MUSI
* @Date 2023/3/29 2:27 PM
* @Description
* @Version
**/
@Data
public class InteractRecordExtendInfoBO implements Serializable {
/**
* 浏览的商品id
*/
private List<String> goodsIds;
/**
* 订单编号
*/
private String orderNumber;
/**
* 订单创建时间
*/
private Date orderCreateTime;
/**
* 订单商品项总数
*/
private Integer orderTotalNum;
/**
* 订单应付
*/
private BigDecimal orderPay;
/**
* 订单实付
*/
private BigDecimal realPay;
/**
* 失效商品数量
*/
private Integer invalidGoodsNum;
/**
* 素材扩展商品信息
*/
private List<ExtendGoodsInfo> extendGoodsInfos;
@Data
public static class ExtendGoodsInfo {
/**
* 商品名称
*/
private String goodsName;
/**
* 商品主图
*/
private String goodsImageUrl;
/**
* 商品货号
*/
private String goodsCode;
/**
* 商品规格 红色,S; 白色,S
*/
private String goodsNorm;
/**
* 订单项数量
*/
private Integer orderNum;
/**
* 商品单价
*/
private BigDecimal salePrice;
}
public static InteractRecordExtendInfoBO empty() {
InteractRecordExtendInfoBO temp = new InteractRecordExtendInfoBO();
// 后续有操作 此处使用可修改类型
temp.setGoodsIds(new ArrayList<>());
return temp;
}
}
package com.gic.haoban.manage.service.pojo.bo.content;
import lombok.Data;
import java.util.Date;
/**
* @Author MUSI
* @Date 2023/3/29 10:02 AM
* @Description
* @Version
**/
@Data
public class PotentialCustomerBO {
private Long id;
/**
* 企业id
*/
private String enterpriseId;
/**
* 会员id
*/
private String memberId;
/**
* 会员微信公众号id
*/
private String unionId;
/**
* 导购id
*/
private String clerkId;
/**
* 销售线索-业务id
*/
private String bizId;
/**
* 业务类型 1 素材
*/
private Integer bizType;
/**
* 门店id
*/
private String storeId;
/**
* 线索来源 1朋友圈; 2客户群; 3 对话框; 0其他
*/
private Integer channelSource;
/**
* 事件类型 1访问素材;2访问商品; 3购买商品;
*/
private Integer eventType;
/**
* 停留时长 单位秒
*/
private Integer durationTime;
/**
* 访问次数
*/
private Integer times;
/**
* 会员名称
*/
private String memberName;
/**
* 会员昵称
*/
private String memberNickName;
/**
* 会员手机号
*/
private String memberPhone;
/**
* 成交数量
*/
private Integer dealRecordNum;
/**
* 是否导购星标客户 1是; 0否
*/
private Integer starFlag;
/**
* 是否看过 1 看过; 0未看过
*/
private Integer seeFlag;
/**
* 最新访问时间
*/
private Date lastAccessTime;
/**
* 状态 1 删除; 0正常
*/
private Integer deleteFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}
package com.gic.haoban.manage.service.pojo.bo.content.context;
import lombok.Data;
/**
* @Author MUSI
* @Date 2023/3/28 8:40 PM
* @Description
* @Version
* 销售线索上下文
**/
@Data
public class InteractRecordContext {
}
package com.gic.haoban.manage.service.pojo.bo.content.context;
import cn.hutool.crypto.digest.MD5;
import com.gic.haoban.manage.api.enums.content.ShareBizType;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordExtendInfoBO;
import com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerBO;
import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import java.util.Date;
/**
* @Author MUSI
* @Date 2023/3/29 3:23 PM
* @Description
* @Version
**/
@Data
public class InteractRecordMessageContext {
private InteractRecordMessageBO interactRecordMessageBO;
/**
* 访问次数
*/
private Integer times;
/**
* 冗余的会员信息
*/
private MemberInfo memberInfo;
/**
* 成交过订单
*/
private boolean hasDeal;
public static InteractRecordMessageContext create(InteractRecordMessageBO interactRecordMessageBO) {
InteractRecordMessageContext context = new InteractRecordMessageContext();
context.setInteractRecordMessageBO(interactRecordMessageBO);
return context;
}
/**
* 构建唯一key
*
* @return
*/
public String buildRecordKey() {
String customerId = StringUtils.isNotBlank(interactRecordMessageBO.getMemberId()) ? interactRecordMessageBO.getMemberId() : interactRecordMessageBO.getUnionId();
String key = interactRecordMessageBO.getBusinessUUId() + interactRecordMessageBO.getClerkId() + interactRecordMessageBO.getMaterialId() + customerId;
return MD5.create().digestHex(key);
}
/**
* 获取客户id
*
* @return
*/
public String getCustomerId() {
if (StringUtils.isNotBlank(this.interactRecordMessageBO.getMemberId())) {
return this.interactRecordMessageBO.getMemberId();
}
return this.interactRecordMessageBO.getUnionId();
}
public InteractRecordBO build() {
if (this.interactRecordMessageBO == null) {
return null;
}
InteractRecordBO temp = new InteractRecordBO();
temp.setEnterpriseId(this.interactRecordMessageBO.getEnterpriseId());
temp.setMemberId(this.interactRecordMessageBO.getMemberId());
temp.setUnionId(this.interactRecordMessageBO.getUnionId());
temp.setClerkId(this.interactRecordMessageBO.getClerkId());
temp.setStoreId(this.interactRecordMessageBO.getStoreId());
temp.setChannelSource(this.interactRecordMessageBO.getChannelSource());
temp.setEventType(this.interactRecordMessageBO.getEventType());
temp.setDurationTime(this.interactRecordMessageBO.getDurationTime());
temp.setBizType(ShareBizType.MATERIAL.getCode());
temp.setBizId(this.interactRecordMessageBO.getMaterialId() + "");
temp.setTimes(this.times);
temp.setTraceId(this.buildRecordKey());
temp.setDeleteFlag(0);
temp.setCreateTime(new Date());
temp.setUpdateTime(new Date());
temp.setExtendInfo(InteractRecordExtendInfoBO.empty());
return temp;
}
/**
* 构建销售线索
*/
public PotentialCustomerBO buildPotentialCustomerBo(InteractRecordBO interactRecordBO){
PotentialCustomerBO temp = new PotentialCustomerBO();
BeanUtils.copyProperties(interactRecordBO, temp);
temp.setDeleteFlag(0);
temp.setCreateTime(new Date());
temp.setUpdateTime(new Date());
temp.setStarFlag(0);
temp.setDealRecordNum(this.hasDeal ? 1 : 0);
temp.setLastAccessTime(new Date(this.interactRecordMessageBO.getLastAccessTime()));
if (this.memberInfo != null) {
temp.setMemberName(this.memberInfo.memberName);
temp.setMemberNickName(this.memberInfo.memberNickName);
temp.setMemberPhone(this.memberInfo.memberPhone);
}
return temp;
}
@Data
@AllArgsConstructor
public static class MemberInfo {
private String memberName;
private String memberNickName;
private String memberPhone;
}
}
package com.gic.haoban.manage.service.pojo.bo.content.context;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.enums.content.MaterialReportType;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.pojo.bo.NoticeMessageBO;
import lombok.Builder;
import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import static com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum.MATERIAL_WEEK_REPORT;
/**
* @Author MUSI
* @Date 2023/3/24 4:08 PM
* @Description
* @Version 好办 周报/月报 上下文
**/
@Data
@Builder
public class MaterialReportContext {
private static final String week_title = "素材使用周报";
private static final String month_title = "素材使用月报";
private static final String week_desc = "%s~%s的素材使用周报已生成,请查收";
private static final String month_desc = "%s~%s的素材使用月报已生成,请查收";
private String enterpriseId;
/**
* 素材周期
*
* @see com.gic.haoban.manage.api.enums.content.MaterialReportType
*/
private Integer reportType;
/**
* 成员id
*/
private String staffId;
/**
* 成员对象
*/
private TabHaobanStaff staffInfo;
/**
* 成员(店长或导购角色)在主门店时的导购id
* 区经时就是导购id
*/
private String clerkId;
/**
* 主门店
*/
private String mainStoreId;
/**
* 使用素材数量
*/
private Integer useMaterialNum;
/**
* 转化金额
*/
private String convertAmount;
/**
* 企业factoryCode
*/
private String factoryCode;
/**
* 导购关联表
*/
private List<StaffClerkRelationDTO> staffClerkRelations;
/**
* 素材报告 图片地址
*/
private String materialReportUrl;
/**
* 构建好办小程序消息
*
* @return
*/
public List<NoticeMessageBO> buildNotifyMessageBos() {
if (CollectionUtils.isEmpty(this.staffClerkRelations)) {
return Collections.emptyList();
}
if (StringUtils.isBlank(this.mainStoreId)) {
return Collections.emptyList();
}
return this.staffClerkRelations
.stream()
.map(item -> {
NoticeMessageBO noticeMessageBO = new NoticeMessageBO();
noticeMessageBO.setCategoryType(MATERIAL_WEEK_REPORT.getCategory());
noticeMessageBO.setMessageType(MATERIAL_WEEK_REPORT.getType());
noticeMessageBO.setClerkId(StringUtils.isNotBlank(item.getClerkId()) ? item.getClerkId() : "-1");
noticeMessageBO.setStoreId(StringUtils.isNotBlank(item.getStoreId()) ? item.getStoreId() : "-1");
noticeMessageBO.setTitle(this.getMessageTitle());
noticeMessageBO.setTemplateCode(MATERIAL_WEEK_REPORT.getTemplateCode());
noticeMessageBO.setDescription(this.getMessageDesc());
noticeMessageBO.setEnterpriseId(this.enterpriseId);
noticeMessageBO.setRelationId(this.clerkId);
noticeMessageBO.setMessageContent(this.extendParams());
return noticeMessageBO;
})
.collect(Collectors.toList());
}
public String getMessageTitle() {
if (MaterialReportType.WEEK.getCode().equals(this.reportType)) {
return week_title;
}
return month_title;
}
public String getMessageDesc() {
if (MaterialReportType.WEEK.getCode().equals(this.reportType)) {
// 获取周报信息
DateTime lastWeek = DateUtil.lastWeek();
String weekBeginStr = DateUtil.beginOfWeek(lastWeek)
.toString("MM月dd日");
String weekEndStr = DateUtil.endOfWeek(lastWeek)
.toString("MM月dd日");
return String.format(week_desc, weekBeginStr, weekEndStr);
}
DateTime lastMonth = DateUtil.lastMonth();
String monthBeginStr = DateUtil.beginOfMonth(lastMonth)
.toString("MM月dd日");
String monthEndStr = DateUtil.endOfMonth(lastMonth)
.toString("MM月dd日");
return String.format(month_desc, monthBeginStr, monthEndStr);
}
public String extendParams() {
JSONObject params = new JSONObject();
params.put("clerkId", this.clerkId);
params.put("storeId", this.mainStoreId);
return params.toJSONString();
}
}
package com.gic.haoban.manage.service.pojo.bo.content.message;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author MUSI
* @Date 2023/3/28 2:51 PM
* @Description
* @Version
**/
@Data
public class InteractRecordMessageBO implements Serializable {
/**
* 企业id
*/
private String enterpriseId;
/**
* 会员id
*/
private String memberId;
/**
* 会员unionId
*/
private String unionId;
/**
* 导购id
*/
private String clerkId;
/**
* 门店id
*/
private String storeId;
/**
* 素材id
*/
private String materialId;
/**
* 来源渠道
* 线索来源 1朋友圈; 2客户群; 3 对话框; 0其他
*/
private Integer channelSource;
/**
* 事件类型 1浏览素材;2查看商品; 3购买商品
*/
private Integer eventType;
/**
* 停留时长
* 单位ms
*/
private Integer durationTime;
/**
* 购买商品时的 订单id
*/
private String orderId;
/**
* 查看商品时查看的商品id
*/
private List<String> goodsIds;
/**
* 业务唯一标识
*/
private String businessUUId;
/**
* 访问时间
* 时间戳
*/
private Long lastAccessTime;
}
package com.gic.haoban.manage.service.pojo.bo.content.message;
import lombok.Data;
import java.util.Date;
/**
* @Author MUSI
* @Date 2023/3/28 11:13 PM
* @Description
* @Version
**/
@Data
public class PotentialCustomerMessageBO {
private static final long serialVersionUID = -28370046858269747L;
private Long id;
/**
* 企业id
*/
private String enterpriseId;
/**
* 会员id
*/
private String memberId;
/**
* 会员微信公众号id
*/
private String unionId;
/**
* 导购id
*/
private String clerkId;
/**
* 销售线索-业务id
*/
private String bizId;
/**
* 业务类型 1 素材
*/
private Integer bizType;
/**
* 门店id
*/
private String storeId;
/**
* 线索来源 1朋友圈; 2客户群; 3 对话框; 0其他
*/
private Integer channelSource;
/**
* 事件类型 1访问素材;2访问商品; 3购买商品;
*/
private Integer eventType;
/**
* 停留时长 单位秒
*/
private Integer durationTime;
/**
* 访问次数
*/
private Integer times;
/**
* 会员名称
*/
private String memberName;
/**
* 会员昵称
*/
private String memberNickName;
/**
* 会员手机号
*/
private String memberPhone;
/**
* 成交数量
*/
private Integer dealRecordNum;
/**
* 是否导购星标客户 1是; 0否
*/
private Integer starFlag;
/**
* 是否看过 1 看过; 0未看过
*/
private Integer seeFlag;
/**
* 最新访问时间
*/
private Date lastAccessTime;
/**
* 状态 1 删除; 0正常
*/
private Integer deleteFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}
package com.gic.haoban.manage.service.pojo.qo.content;
import com.gic.api.base.commons.BasePageInfo;
import lombok.Data;
import java.util.Date;
/**
* @Author MUSI
* @Date 2023/3/29 12:33 PM
* @Description
* @Version
**/
@Data
public class InteractRecordQO extends BasePageInfo {
/**
* 导购id
*/
private String clerkId;
/**
* 会员id
*/
private String memberId;
/**
*
*/
private String unionId;
/**
* 开始时间
*/
private Date startTime;
}
package com.gic.haoban.manage.service.pojo.qo.content;
import com.gic.api.base.commons.BasePageInfo;
import lombok.Data;
/**
* @Author MUSI
* @Date 2023/3/29 10:03 AM
* @Description
* @Version
**/
@Data
public class PotentialCustomerQO extends BasePageInfo {
private static final long serialVersionUID = 5117301447654788339L;
/**
* 企业id
*/
private String enterpriseId;
/**
* 微信企业id
*/
private String wxEnterpriseId;
/**
* 导购id
*/
private String clerkId;
/**
* 会员id
*/
private String memberId;
/**
* 搜索字段
*/
private String search;
/**
* 导购是否看过
* 1已看过
* 0未看过
*/
private Integer seeFlag;
/**
* 是否导购星标客户
* 1 与导购是星标
*/
private Integer starFlag;
/**
* 导购与会员是否 企微好友
* 1 是好友; 0不是
*/
private Integer hasMemberRelation;
/**
* 会员是否有过成交
* 1 有过成交
*/
private Integer dealRecord;
/**
* 1 会员有手机号
*/
private Integer hasMemberPhone;
}
......@@ -170,4 +170,11 @@ public interface StaffClerkRelationService {
boolean getBindByStaffIdAndEnterpriseId(String enterpriseId, String staffId);
List<StaffClerkRelationDTO> listManageBindByStaffId(String staffId);
/**
* 获取企业下所有关联关系
* @param enterpriseId
* @return
*/
List<StaffClerkRelationDTO> listAllRelationDtosByEnterpriseId(String enterpriseId);
}
......@@ -143,4 +143,11 @@ public interface StaffService {
* @return
*/
List<TabHaobanStaff> listStaffWithIds(List<String> staffIds);
/**
* 查询企业下所有成员id
* @param wxEnterpriseIds
* @return
*/
List<String> queryStaffIdsWithEnterpriseId(List<String> wxEnterpriseIds);
}
......@@ -69,4 +69,11 @@ public interface WxEnterpriseService {
void stopHaoban(String enterpriseId);
/**
* 查询企业下关联的微信企业id
* @param enterpriseId
* @return
*/
List<String> queryWxEnterpriseWithEnterpriseId(String enterpriseId);
}
......@@ -2,6 +2,8 @@ package com.gic.haoban.manage.service.service.content;
import com.gic.haoban.manage.service.pojo.bo.content.GroupMessageInfoBo;
import java.util.List;
/**
* @Author MUSI
* @Date 2023/3/19 9:46 PM
......@@ -16,4 +18,7 @@ public interface GroupMessageService {
* @param groupMessageInfoBo
*/
void handlerGroupMessage(GroupMessageInfoBo groupMessageInfoBo);
List<String> hasMaterialRightEnterprise();
}
package com.gic.haoban.manage.service.service.content;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.qo.content.InteractRecordQO;
/**
* 互动记录明细(TabHaobanInteractRecord)表服务接口
*
* @author makejava
* @since 2023-03-28 10:32:48
*/
public interface InteractRecordService {
/**
* 查询互动记录
* @param enterpriseId
* @param traceId
* @return
*/
InteractRecordBO queryWithInteractInfo(String enterpriseId, String traceId);
/**
* 互动记录查询
* @param interactRecordQO
* @return
*/
Page<InteractRecordBO> queryInteractRecordPage(InteractRecordQO interactRecordQO);
/**
* 统计总数
* @param interactRecordQO
* @return
*/
Integer countInteractRecord(InteractRecordQO interactRecordQO);
/**
* 保存互动记录
* @param interactRecordBO
* @return
*/
Long saveOrUpdateInteractRecord(InteractRecordBO interactRecordBO);
}
package com.gic.haoban.manage.service.service.content;
/**
* @Author MUSI
* @Date 2023/3/24 3:58 PM
* @Description
* @Version
* 素材报告 周报/日报
**/
public interface MaterialReportService {
/**
* 素材周报/月报
*
* @param enterpriseId
*
* @see com.gic.haoban.manage.api.enums.content.MaterialReportType
* @param reportType
*/
void handlerMaterialReport(String enterpriseId, String staffId, Integer reportType);
}
package com.gic.haoban.manage.service.service.content;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerBO;
import com.gic.haoban.manage.service.pojo.qo.content.PotentialCustomerQO;
/**
* 销售线索(TabHaobanPotentialCustomer)表服务接口
*
* @author makejava
* @since 2023-03-28 09:48:08
*/
public interface PotentialCustomerService {
/**
* 查询销售线索
* @param potentialCustomerQO
* @return
*/
Page<PotentialCustomerBO> queryPotentialCustomerPage(PotentialCustomerQO potentialCustomerQO);
/**
* 查询详情
* @param clerkId
* @param potentialCustomerId
* @return
*/
PotentialCustomerBO queryPotentialCustomerInfo(String clerkId, Long potentialCustomerId);
/**
* 根据导购和会员id查询销售线索
* @param clerkId
* @param memberId
* @return
*/
PotentialCustomerBO queryPotentialCustomerInfo(String clerkId, String memberId);
/**
* 修改销售线索
* @param potentialCustomerBO
*/
void markPotentialCustomer(PotentialCustomerBO potentialCustomerBO);
/**
* 更新保存
* @param potentialCustomerBO
* @return
*/
Long saveOrUpdatePotentialCustomer(PotentialCustomerBO potentialCustomerBO);
}
package com.gic.haoban.manage.service.service.content.adaptor;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.enums.content.MaterialInteractRecordEventType;
import com.gic.haoban.manage.api.enums.content.TriggerCustomerChannelType;
import com.gic.haoban.manage.service.entity.content.TabHaobanInteractRecord;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordExtendInfoBO;
import com.gic.store.goods.dto.goods.GoodsInfoSimpleDTO;
import com.gic.store.goods.dto.qdto.ErpGoodsInfoQDTO;
import com.gic.store.goods.enums.GoodsStatusEnum;
import com.gic.store.goods.service.GoodsInfoOutApiService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author MUSI
* @Date 2023/3/29 2:49 PM
* @Description
* @Version
**/
@Slf4j
@Component
public class InteractRecordBuilder {
@Autowired
private GoodsInfoOutApiService goodsInfoOutApiService;
/**
* 互动记录描述
*
* @param interactRecord
* @return
*/
public String buildDesc(TabHaobanInteractRecord interactRecord) {
StringBuilder stringBuilder = new StringBuilder();
if (TriggerCustomerChannelType.showDescChannel().contains(interactRecord.getChannelSource())) {
TriggerCustomerChannelType channelType = TriggerCustomerChannelType.getInstance(interactRecord.getChannelSource());
if (channelType != null) {
stringBuilder.append(String.format("通过[%s]", channelType.getDesc()));
}
}
MaterialInteractRecordEventType instance = MaterialInteractRecordEventType.getInstance(interactRecord.getEventType());
if (instance != null) {
stringBuilder.append(instance.getDesc());
}
return stringBuilder.toString();
}
/**
* 互动记录转换扩展信息
*
* @param interactRecord
* @return
*/
public InteractRecordExtendInfoBO convertExtendInfo(TabHaobanInteractRecord interactRecord) {
if (interactRecord == null) {
log.info("互动记录为空");
return null;
}
if (StringUtils.isBlank(interactRecord.getExtendInfo())) {
log.info("互动记录扩展信息为空 {}", interactRecord.getId());
return null;
}
if (MaterialInteractRecordEventType.VISIT_MATERIAL.getCode().equals(interactRecord.getEventType())) {
// 浏览素材事件无扩展信息
log.info("浏览素材事件无扩展信息 {}", interactRecord.getId());
return null;
}
InteractRecordExtendInfoBO extendInfo = JSON.parseObject(interactRecord.getExtendInfo(), new TypeReference<InteractRecordExtendInfoBO>() {
});
if (MaterialInteractRecordEventType.VISIT_PRODUCT.getCode().equals(interactRecord.getEventType())) {
// 浏览商品事件
List<String> visitGoodsIds = extendInfo.getGoodsIds();
if (CollectionUtils.isEmpty(visitGoodsIds)) {
return null;
}
// 拼接商品信息
List<InteractRecordExtendInfoBO.ExtendGoodsInfo> extendGoodsInfos = this.convertGoodsInfo(visitGoodsIds, interactRecord.getEnterpriseId());
extendInfo.setExtendGoodsInfos(extendGoodsInfos);
extendInfo.setInvalidGoodsNum(visitGoodsIds.size() - extendGoodsInfos.size());
return extendInfo;
}
return extendInfo;
}
private List<InteractRecordExtendInfoBO.ExtendGoodsInfo> convertGoodsInfo(List<String> visitGoodsIds, String enterpriseId) {
ErpGoodsInfoQDTO search = new ErpGoodsInfoQDTO();
search.setEnterpriseId(enterpriseId);
search.setGoodsIds(visitGoodsIds);
search.setExcludeStatus(Arrays.asList(GoodsStatusEnum.DELETED.getCode(), GoodsStatusEnum.BACK.getCode()));
ServiceResponse<List<GoodsInfoSimpleDTO>> serviceResponse =
goodsInfoOutApiService.queryErpGoodsInfoWithIds(search);
if (!serviceResponse.isSuccess()) {
return Collections.emptyList();
}
return serviceResponse.getResult()
.stream()
.map(item -> {
InteractRecordExtendInfoBO.ExtendGoodsInfo extendGoodsInfo = new InteractRecordExtendInfoBO.ExtendGoodsInfo();
extendGoodsInfo.setGoodsName(item.getGoodsName());
extendGoodsInfo.setGoodsCode(item.getGoodsCode());
extendGoodsInfo.setGoodsImageUrl(item.getGoodsImageUrl());
// todo 商品价格 待订单迭代上线后再调整
// extendGoodsInfo.setSalePrice(item.getStatus());
return extendGoodsInfo;
})
.collect(Collectors.toList());
}
}
package com.gic.haoban.manage.service.service.content.adaptor;
import com.gic.haoban.manage.service.pojo.bo.content.context.InteractRecordMessageContext;
import com.gic.haoban.manage.service.pojo.qo.content.InteractRecordQO;
import com.gic.haoban.manage.service.service.content.InteractRecordService;
import com.gic.member.api.dto.MemberDTO;
import com.gic.member.api.service.MemberService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @Author MUSI
* @Date 2023/3/29 3:48 PM
* @Description
* @Version
**/
@Slf4j
@Component
public class InteractRecordMessageBuilder {
@Autowired
private InteractRecordService interactRecordService;
@Autowired
private MemberService memberService;
/**
* 计算互动记录的访问次数
* // 通过clerkId、memberId、materialId 查询之前存在的记录总数,本次是第几次访问 在之前的记录总数上加1
*
* @param context
*/
public void calcCustomerVisitTimes(InteractRecordMessageContext context) {
InteractRecordQO searchQo = new InteractRecordQO();
searchQo.setClerkId(context.getInteractRecordMessageBO().getClerkId());
searchQo.setMemberId(context.getInteractRecordMessageBO().getMemberId());
if (StringUtils.isBlank(searchQo.getMemberId())) {
searchQo.setUnionId(context.getInteractRecordMessageBO().getUnionId());
}
searchQo.setPageSize(1);
Integer count = interactRecordService.countInteractRecord(searchQo);
context.setTimes(count + 1);
}
/**
* 冗余会员信息
* @param context
*/
public void redundantMemberInfo(InteractRecordMessageContext context) {
String memberId = context.getInteractRecordMessageBO().getMemberId();
if (StringUtils.isBlank(memberId)) {
log.info("互动记录冗余会员信息 会员不存在");
return;
}
MemberDTO memberDTO = memberService.queryMember(memberId);
if (memberDTO == null) {
log.info("查询会员信息为空 {}", memberId);
return;
}
InteractRecordMessageContext.MemberInfo memberInfo = new InteractRecordMessageContext
.MemberInfo(memberDTO.getMemberName(), memberDTO.getThirdNickname(), memberDTO.getPhoneNumber());
context.setMemberInfo(memberInfo);
}
/**
* 计算会员是否有过订单
* @param context
*/
public void calcHaveOrderNum(InteractRecordMessageContext context) {
String memberId = context.getInteractRecordMessageBO().getMemberId();
if (StringUtils.isBlank(memberId)) {
log.info("互动记录冗余会员信息 会员id不存在");
return;
}
// 查询会员全渠道订单
}
}
package com.gic.haoban.manage.service.service.content.adaptor;
import com.alibaba.fastjson.JSON;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.enums.content.MaterialReportType;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
import com.gic.haoban.manage.service.pojo.bo.content.context.MaterialReportContext;
import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.util.DrawImageUtils;
import com.gic.wechat.api.dto.qywx.QywxNewsArticleMessageDTO;
import com.gic.wechat.api.dto.qywx.QywxNewsSendMessageDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
/**
* @Author MUSI
* @Date 2023/3/24 4:11 PM
* @Description
* @Version 素材周报/月报组装
**/
@Slf4j
@Component
public class MaterialReportBuilder {
@Autowired
private StaffClerkRelationService staffClerkRelationService;
@Autowired
private ClerkMainStoreRelatedService clerkMainStoreRelatedService;
@Autowired
private Config config;
/**
* 周报模板
*/
private static final String week_template_report = "template/week_bkg.png";
/**
* 月报模板
*/
private static final String month_template_report = "template/month_bkg.png";
/**
* 柱状成员绑定的导购信息
*
* @param context
*/
public void buildStaffRelationClerk(MaterialReportContext context) {
if (StringUtils.isAnyBlank(context.getStaffId(), context.getEnterpriseId())) {
log.info("参数异常 staffId:{}, enterpriseId:{}", context.getStaffId(), context.getEnterpriseId());
return;
}
List<StaffClerkRelationDTO> staffClerkRelations =
staffClerkRelationService.listBindCodeByStaffId(Collections.singletonList(context.getEnterpriseId()), context.getStaffId());
if (CollectionUtils.isEmpty(staffClerkRelations)) {
log.info("成员未关联导购 staffId:{}, enterpriseId:{}", context.getStaffId(), context.getEnterpriseId());
return;
}
context.setStaffClerkRelations(staffClerkRelations);
}
/**
* 填充该成员的主门店
* @param context
*/
public void fillMainStore(MaterialReportContext context) {
if (CollectionUtils.isEmpty(context.getStaffClerkRelations())) {
return;
}
StaffClerkRelationDTO staffClerkRelationDTO = context.getStaffClerkRelations().get(0);
String wxEnterpriseId = staffClerkRelationDTO.getWxEnterpriseId();
context.setClerkId(staffClerkRelationDTO.getClerkId());
TabHaobanClerkMainStoreRelated mainStoreInfo = clerkMainStoreRelatedService.getMainStoreByStaffId(context.getStaffId(), wxEnterpriseId);
if (mainStoreInfo != null) {
context.setMainStoreId(mainStoreInfo.getStoreId());
Optional<StaffClerkRelationDTO> mainClerkInfo = context.getStaffClerkRelations()
.stream()
.filter(item -> StringUtils.equals(item.getStoreId(), mainStoreInfo.getStoreId()))
.findFirst();
if (!mainClerkInfo.isPresent()){
log.info("成员{}与主门店{}不存在导购关联关系", context.getStaffId(), context.getMainStoreId());
return;
}
context.setClerkId(mainClerkInfo.get().getClerkId());
}
}
/**
* 周报/月报 数据
* @param context
*/
public void buildMaterialReportData(MaterialReportContext context) {
// 获取该导购 在门店 的周报/月报数据
String templatePath = "";
if (MaterialReportType.WEEK.getCode().equals(context.getReportType())) {
context.setUseMaterialNum(103);
context.setConvertAmount("3.1万");
templatePath = week_template_report;
}else {
context.setUseMaterialNum(1043);
context.setConvertAmount("12.3万");
templatePath = month_template_report;
}
// 生成图片地址
String url = DrawImageUtils.drawImage(context.getFactoryCode(), context.getUseMaterialNum() + "", context.getConvertAmount(), templatePath);
context.setMaterialReportUrl(url);
}
/***
* 构建企业微信消息
*
* @param context
*/
public QywxNewsSendMessageDTO buildQywxNewsMessage(MaterialReportContext context, WxEnterpriseQwDTO wxEnterpriseQwDTO) {
if (context.getStaffInfo() == null) {
log.info("构建企业微信对象, 成员信息不存在 {}", JSON.toJSONString(context));
return null;
}
String wxUserId = context.getStaffInfo().getWxUserId();
if (wxEnterpriseQwDTO.needOpenUserId3th()) {
wxUserId = context.getStaffInfo().getWxOpenUseId();
}
QywxNewsSendMessageDTO newsSendMessage = new QywxNewsSendMessageDTO();
newsSendMessage.setAgentId(Integer.parseInt(wxEnterpriseQwDTO.getAgentId()));
newsSendMessage.setUserIds(Collections.singletonList(wxUserId));
QywxNewsArticleMessageDTO articleInfo = new QywxNewsArticleMessageDTO();
articleInfo.setAppid(config.getAppid());
articleInfo.setTitle(context.getMessageTitle());
articleInfo.setDescription(context.getMessageDesc());
// pagePath 拼接参数?
articleInfo.setPagepath("/monthList");
articleInfo.setPicurl(context.getMaterialReportUrl());
newsSendMessage.setArticleMessages(Collections.singletonList(articleInfo));
return newsSendMessage;
}
}
......@@ -489,4 +489,15 @@ public class GroupMessageServiceImpl implements GroupMessageService {
temp.setDeleteFlag(0);
return temp;
}
/**
* 获取当前时间 有素材权限的商户
* @return
*/
@Override
public List<String> hasMaterialRightEnterprise() {
return Collections.singletonList("ff8080815dacd3a2015dacd3ef5c0000");
// return Collections.emptyList();
}
}
package com.gic.haoban.manage.service.service.content.impl;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.service.dao.mapper.content.TabHaobanInteractRecordMapper;
import com.gic.haoban.manage.service.entity.content.TabHaobanInteractRecord;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.qo.content.InteractRecordQO;
import com.gic.haoban.manage.service.service.content.InteractRecordService;
import com.gic.haoban.manage.service.service.content.adaptor.InteractRecordBuilder;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 互动记录明细(TabHaobanInteractRecord)表服务实现类
*
* @author makejava
* @since 2023-03-28 10:32:48
*/
@Slf4j
@Component
public class InteractRecordServiceImpl implements InteractRecordService {
@Resource
private TabHaobanInteractRecordMapper tabHaobanInteractRecordMapper;
@Autowired
private InteractRecordBuilder interactRecordBuilder;
/**
* 查询互动记录
*
* @param enterpriseId
* @param traceId
* @return
*/
@Override
public InteractRecordBO queryWithInteractInfo(String enterpriseId, String traceId) {
if (StringUtils.isAnyBlank(enterpriseId, traceId)) {
return null;
}
TabHaobanInteractRecord interactRecord = tabHaobanInteractRecordMapper.queryWithEnterpriseIdAndTraceId(enterpriseId, traceId);
if (interactRecord == null) {
return null;
}
InteractRecordBO temp = new InteractRecordBO();
BeanUtils.copyProperties(interactRecord, temp);
return temp;
}
/**
* 互动记录查询
*
* @param interactRecordQO
* @return
*/
@Override
public Page<InteractRecordBO> queryInteractRecordPage(InteractRecordQO interactRecordQO) {
// 默认查最近一年内的的数据
if (StringUtils.isBlank(interactRecordQO.getClerkId())) {
log.info("queryInteractRecordPage 参数缺失");
return new Page<>();
}
interactRecordQO.setStartTime(DateUtil.addNumForYear(new Date(), -1));
PageHelper.startPage(interactRecordQO.getPageNum(), interactRecordQO.getPageSize());
com.github.pagehelper.Page<TabHaobanInteractRecord> pageResult =
(com.github.pagehelper.Page<TabHaobanInteractRecord>) tabHaobanInteractRecordMapper.queryInteractRecordList(interactRecordQO);
if (pageResult == null || CollectionUtils.isEmpty(pageResult)) {
log.info("查询互动记录数据为空 {}", JSON.toJSONString(interactRecordQO));
return new Page<>();
}
Page<InteractRecordBO> result = new Page<>();
result.setTotalCount((int) pageResult.getTotal());
List<InteractRecordBO> recordBos = pageResult.getResult()
.stream()
.map(item -> {
InteractRecordBO temp = new InteractRecordBO();
BeanUtils.copyProperties(item, temp);
temp.setRecordDesc(this.interactRecordBuilder.buildDesc(item));
temp.setExtendInfo(interactRecordBuilder.convertExtendInfo(item));
return temp;
})
.collect(Collectors.toList());
result.setResult(recordBos);
return result;
}
/**
* 统计总数
*
* @param interactRecordQO
* @return
*/
@Override
public Integer countInteractRecord(InteractRecordQO interactRecordQO) {
interactRecordQO.setPageNum(1);
interactRecordQO.setPageSize(1);
PageHelper.startPage(interactRecordQO.getPageNum(), interactRecordQO.getPageSize());
com.github.pagehelper.Page<TabHaobanInteractRecord> pageResult =
(com.github.pagehelper.Page<TabHaobanInteractRecord>) tabHaobanInteractRecordMapper.queryInteractRecordList(interactRecordQO);
if (pageResult == null || CollectionUtils.isEmpty(pageResult)) {
log.info("查询互动记录数据为空 {}", JSON.toJSONString(interactRecordQO));
return 0;
}
return (int)pageResult.getTotal();
}
/**
* 保存互动记录
*
* @param interactRecordBO
* @return
*/
@Override
public Long saveOrUpdateInteractRecord(InteractRecordBO interactRecordBO) {
TabHaobanInteractRecord temp = new TabHaobanInteractRecord();
BeanUtils.copyProperties(interactRecordBO, temp);
if (interactRecordBO.getExtendInfo() != null) {
temp.setExtendInfo(JSON.toJSONString(interactRecordBO.getExtendInfo()));
}
if (interactRecordBO.getId() == null) {
temp.setId(UniqueIdUtils.uniqueLong());
tabHaobanInteractRecordMapper.insert(temp);
}else {
tabHaobanInteractRecordMapper.update(temp);
}
return temp.getId();
}
}
package com.gic.haoban.manage.service.service.content.impl;
import com.alibaba.fastjson.JSON;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.pojo.bo.NoticeMessageBO;
import com.gic.haoban.manage.service.pojo.bo.content.context.MaterialReportContext;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.content.MaterialReportService;
import com.gic.haoban.manage.service.service.content.adaptor.MaterialReportBuilder;
import com.gic.haoban.manage.service.service.notify.NoticeMessageService;
import com.gic.wechat.api.dto.qywx.QywxNewsSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Author MUSI
* @Date 2023/3/24 3:59 PM
* @Description
* @Version
**/
@Slf4j
@Component
public class MaterialReportServiceImpl implements MaterialReportService {
@Autowired
private NoticeMessageService noticeMessageService;
@Autowired
private MaterialReportBuilder materialReportBuilder;
@Autowired
private QywxSuiteApiService qywxSuiteApiService;
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Autowired
private EnterpriseService enterpriseService;
@Autowired
private StaffService staffService;
@Autowired
private Config config;
/**
* 素材周报/月报
*
* @param enterpriseId
*/
@Override
public void handlerMaterialReport(String enterpriseId, String staffId, Integer reportType) {
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(enterpriseId);
if (enterpriseDTO == null) {
log.info("企业信息不存在 enterpriseId:{}", enterpriseId);
return;
}
TabHaobanStaff staffInfo = staffService.selectById(staffId);
if (staffInfo == null) {
log.info("成员不存在 {}", staffId);
return;
}
MaterialReportContext context = MaterialReportContext.builder()
.enterpriseId(enterpriseId)
.factoryCode(enterpriseDTO.getFactoryCode())
.staffId(staffId)
.staffInfo(staffInfo)
.reportType(reportType)
.build();
// 获取成员关联的导购
materialReportBuilder.buildStaffRelationClerk(context);
// 判断是区经还是 店长/导购 填充主门店
materialReportBuilder.fillMainStore(context);
// 获取素材数据
materialReportBuilder.buildMaterialReportData(context);
// 保存小程序消息
List<NoticeMessageBO> noticeMessageBos = context.buildNotifyMessageBos();
if (CollectionUtils.isNotEmpty(noticeMessageBos)) {
noticeMessageService.addNoticeMessageBatch(noticeMessageBos);
}
// 发送企微消息
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(staffInfo.getWxEnterpriseId());
QywxNewsSendMessageDTO newsSendMessageDTO = materialReportBuilder.buildQywxNewsMessage(context, qwDTO);
if (newsSendMessageDTO == null) {
return;
}
log.info("发送企业图文消息参数{}", JSON.toJSONString(newsSendMessageDTO));
boolean result = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(), newsSendMessageDTO);
log.info("成员{}发送素材企微使用报告结果 {}", staffId, result);
}
}
package com.gic.haoban.manage.service.service.content.impl;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.service.dao.mapper.content.TabHaobanPotentialCustomerMapper;
import com.gic.haoban.manage.service.entity.content.TabHaobanPotentialCustomer;
import com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerBO;
import com.gic.haoban.manage.service.pojo.qo.content.PotentialCustomerQO;
import com.gic.haoban.manage.service.service.content.PotentialCustomerService;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
/**
* 销售线索(TabHaobanPotentialCustomer)表服务实现类
*
* @author makejava
* @since 2023-03-28 09:48:08
*/
@Slf4j
@Component
public class PotentialCustomerServiceImpl implements PotentialCustomerService {
@Resource
private TabHaobanPotentialCustomerMapper potentialCustomerMapper;
/**
* 查询销售线索
*
* @param potentialCustomerQO
* @return
*/
@Override
public Page<PotentialCustomerBO> queryPotentialCustomerPage(PotentialCustomerQO potentialCustomerQO) {
if (StringUtils.isBlank(potentialCustomerQO.getClerkId())) {
log.info("参数缺失 {}", potentialCustomerQO.getClerkId());
return new Page<>();
}
PageHelper.startPage(potentialCustomerQO.getPageNum(), potentialCustomerQO.getPageSize());
com.github.pagehelper.Page<TabHaobanPotentialCustomer> pageResult =
(com.github.pagehelper.Page<TabHaobanPotentialCustomer>) potentialCustomerMapper.queryPotentialCustomerList(potentialCustomerQO);
return PageUtil.changePageHelperToCurrentPage(pageResult, PotentialCustomerBO.class);
}
/**
* 查询详情
*
* @param clerkId
* @param potentialCustomerId
* @return
*/
@Override
public PotentialCustomerBO queryPotentialCustomerInfo(String clerkId, Long potentialCustomerId) {
if (StringUtils.isBlank(clerkId)) {
return null;
}
TabHaobanPotentialCustomer haobanPotentialCustomer = potentialCustomerMapper.queryById(potentialCustomerId, clerkId);
if (haobanPotentialCustomer == null) {
return null;
}
PotentialCustomerBO temp = new PotentialCustomerBO();
BeanUtils.copyProperties(haobanPotentialCustomer, temp);
return temp;
}
/**
* 根据导购和会员id查询销售线索
*
* @param clerkId
* @param memberId
* @return
*/
@Override
public PotentialCustomerBO queryPotentialCustomerInfo(String clerkId, String memberId) {
TabHaobanPotentialCustomer potentialCustomer = potentialCustomerMapper.queryWithClerkIdAndMemberId(clerkId, memberId);
if (potentialCustomer == null) {
return null;
}
PotentialCustomerBO temp = new PotentialCustomerBO();
BeanUtils.copyProperties(potentialCustomer, temp);
return temp;
}
/**
* 标记销售线索为已读 或 星标客户
*
* @param potentialCustomerBO
*/
@Override
public void markPotentialCustomer(PotentialCustomerBO potentialCustomerBO) {
if (potentialCustomerBO.getId() == null) {
log.info("参数缺失");
return;
}
TabHaobanPotentialCustomer temp = new TabHaobanPotentialCustomer();
temp.setId(potentialCustomerBO.getId());
temp.setStarFlag(potentialCustomerBO.getStarFlag());
temp.setSeeFlag(potentialCustomerBO.getSeeFlag());
potentialCustomerMapper.update(temp);
}
/**
* 更新保存
*
* @param potentialCustomerBO
* @return
*/
@Override
public Long saveOrUpdatePotentialCustomer(PotentialCustomerBO potentialCustomerBO) {
TabHaobanPotentialCustomer temp = new TabHaobanPotentialCustomer();
BeanUtils.copyProperties(potentialCustomerBO, temp);
temp.setUpdateTime(new Date());
if (temp.getId() == null) {
temp.setId(UniqueIdUtils.uniqueLong());
potentialCustomerMapper.insert(temp);
}else {
potentialCustomerMapper.update(temp);
}
return temp.getId();
}
}
package com.gic.haoban.manage.service.service.content.message;
import com.gic.haoban.manage.api.enums.content.MaterialInteractRecordEventType;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordExtendInfoBO;
import com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerBO;
import com.gic.haoban.manage.service.pojo.bo.content.context.InteractRecordMessageContext;
import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO;
import com.gic.haoban.manage.service.service.content.InteractRecordService;
import com.gic.haoban.manage.service.service.content.PotentialCustomerService;
import com.gic.haoban.manage.service.service.content.adaptor.InteractRecordMessageBuilder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.Optional;
/**
* @Author MUSI
* @Date 2023/3/28 2:50 PM
* @Description
* @Version 互动记录消息处理器
**/
@Slf4j
@Component
public class InteractRecordMessageService {
@Autowired
InteractRecordService interactRecordService;
@Autowired
InteractRecordMessageBuilder interactRecordMessageBuilder;
@Autowired
PotentialCustomerService potentialCustomerService;
/**
* 处理互动记录
*
* @param interactRecordMessageBO
*/
public void dealRecord(InteractRecordMessageBO interactRecordMessageBO) {
InteractRecordMessageContext context = InteractRecordMessageContext.create(interactRecordMessageBO);
// 参数是否完整
// 根据businessId clerkId memberId materialId 构建唯一标识key
String recordKey = context.buildRecordKey();
// 根据key 查询是否存在记录
InteractRecordBO interactRecordBO = interactRecordService.queryWithInteractInfo(interactRecordMessageBO.getEnterpriseId(), recordKey);
if (interactRecordBO == null) {
// 新增
// 冗余会员信息
interactRecordMessageBuilder.redundantMemberInfo(context);
// 查询会员是否有过成交 (是否存在订单)
interactRecordMessageBuilder.calcHaveOrderNum(context);
// 计算访问次数
interactRecordMessageBuilder.calcCustomerVisitTimes(context);
interactRecordBO = context.build();
} else {
// 该key已存在 需要对之前的进行合并
// 修改访问类型
interactRecordBO.setUpdateTime(new Date());
Integer durationTime = Optional.ofNullable(interactRecordBO.getDurationTime()).orElse(0);
interactRecordBO.setDurationTime(durationTime + Optional.ofNullable(interactRecordMessageBO.getDurationTime()).orElse(0));
// 事件类型
if (interactRecordBO.getEventType() < interactRecordBO.getEventType()) {
interactRecordBO.setEventType(interactRecordMessageBO.getEventType());
}
}
// 组装扩展信息
if (MaterialInteractRecordEventType.VISIT_PRODUCT.getCode().equals(interactRecordMessageBO.getEventType())) {
// 浏览商品
if (CollectionUtils.isNotEmpty(interactRecordMessageBO.getGoodsIds())) {
if (interactRecordBO.getExtendInfo() == null){
interactRecordBO.setExtendInfo(InteractRecordExtendInfoBO.empty());
}
interactRecordBO.getExtendInfo().getGoodsIds().addAll(interactRecordMessageBO.getGoodsIds());
}
}
if (MaterialInteractRecordEventType.ORDER.getCode().equals(interactRecordMessageBO.getEventType())) {
// 下单
// 查询订单信息
String orderId = interactRecordMessageBO.getOrderId();
}
interactRecordService.saveOrUpdateInteractRecord(interactRecordBO);
// 更新销售线索
if (StringUtils.isNotBlank(interactRecordMessageBO.getMemberId())) {
// 查询销售线索
PotentialCustomerBO potentialCustomerBO = potentialCustomerService.queryPotentialCustomerInfo(interactRecordMessageBO.getClerkId(), interactRecordMessageBO.getMemberId());
if (potentialCustomerBO == null) {
potentialCustomerBO = context.buildPotentialCustomerBo(interactRecordBO);
}
// 最近访问时间
if (potentialCustomerBO.getLastAccessTime().before(new Date(interactRecordMessageBO.getLastAccessTime()))) {
potentialCustomerBO.setLastAccessTime(new Date(interactRecordMessageBO.getLastAccessTime()));
}
// 标记为未读
potentialCustomerBO.setSeeFlag(0);
//
potentialCustomerBO.setStoreId(interactRecordBO.getStoreId());
potentialCustomerBO.setBizId(interactRecordBO.getBizId());
potentialCustomerBO.setEventType(interactRecordBO.getEventType());
potentialCustomerBO.setChannelSource(interactRecordBO.getChannelSource());
potentialCustomerBO.setEventType(interactRecordBO.getEventType());
potentialCustomerBO.setDurationTime(interactRecordBO.getDurationTime());
potentialCustomerBO.setTimes(interactRecordBO.getTimes());
potentialCustomerService.saveOrUpdatePotentialCustomer(potentialCustomerBO);
// 累计 该导购 + 时间段内 未读数量
}
}
}
......@@ -413,4 +413,15 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
}
return dto ;
}
/**
* 获取企业下所有关联关系
*
* @param enterpriseId
* @return
*/
@Override
public List<StaffClerkRelationDTO> listAllRelationDtosByEnterpriseId(String enterpriseId) {
return this.mapper.listAllRelationDtosByEnterpriseId(enterpriseId);
}
}
......@@ -254,7 +254,6 @@ public class StaffServiceImpl implements StaffService {
/**
* 查询成员列表
*
* @param wxEnterpriseId
* @param staffIds
* @return
*/
......@@ -265,4 +264,19 @@ public class StaffServiceImpl implements StaffService {
}
return this.mapper.listByIds(staffIds);
}
/**
* 查询企业下所有成员id
*
* @param wxEnterpriseIds
* @return
*/
@Override
public List<String> queryStaffIdsWithEnterpriseId(List<String> wxEnterpriseIds) {
if (CollectionUtils.isEmpty(wxEnterpriseIds)) {
return Collections.emptyList();
}
return this.mapper.queryStaffIdsWithEnterpriseId(wxEnterpriseIds);
}
}
package com.gic.haoban.manage.service.service.impl;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -234,4 +236,18 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
String dingUrl = "https://oapi.dingtalk.com/robot/send?access_token=c38fdc53d26e9a019640755bdada1ce07ebd44a2555d1c8acc299de7a7b5b857";
DingUtils.send(msg, dingUrl, false);
}
/**
* 查询企业下关联的微信企业id
*
* @param enterpriseId
* @return
*/
@Override
public List<String> queryWxEnterpriseWithEnterpriseId(String enterpriseId) {
if (StringUtils.isBlank(enterpriseId)) {
return Collections.emptyList();
}
return this.mapper.queryWxEnterpriseByEnterpriseId(enterpriseId);
}
}
package com.gic.haoban.manage.service.service.out.impl.content;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.qdto.content.InteractRecordQDTO;
import com.gic.haoban.manage.api.enums.content.InteractRecordExtendInfoDTO;
import com.gic.haoban.manage.api.enums.content.InteractRecordInfoDTO;
import com.gic.haoban.manage.api.service.content.InteractRecordApiService;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.qo.content.InteractRecordQO;
import com.gic.haoban.manage.service.service.content.InteractRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author MUSI
* @Date 2023/3/29 1:12 PM
* @Description
* @Version
**/
@Slf4j
@Component("interactRecordApiService")
public class InteractRecordApiServiceImpl implements InteractRecordApiService {
@Autowired
private InteractRecordService interactRecordService;
/**
* 查询互动记录
*
* @param interactRecordQDTO
* @return
*/
@Override
public ServiceResponse<Page<InteractRecordInfoDTO>> queryInteractRecordList(InteractRecordQDTO interactRecordQDTO) {
Page<InteractRecordInfoDTO> result = new Page<>();
result.setTotalCount(0);
result.setResult(Collections.emptyList());
InteractRecordQO searchQo = new InteractRecordQO();
BeanUtils.copyProperties(interactRecordQDTO, searchQo);
Page<InteractRecordBO> pageResult = interactRecordService.queryInteractRecordPage(searchQo);
if (pageResult == null || CollectionUtils.isEmpty(pageResult.getResult())) {
log.info("查询结果为空 {}", JSON.toJSONString(interactRecordQDTO));
return ServiceResponse.success(result);
}
// 拼接描述
// 组装扩展信息
List<InteractRecordInfoDTO> recordInfos = pageResult.getResult()
.stream()
.map(item -> {
InteractRecordInfoDTO temp = new InteractRecordInfoDTO();
BeanUtils.copyProperties(item, temp);
temp.setInteractRecordId(item.getId());
if (item.getExtendInfo() != null) {
InteractRecordExtendInfoDTO extendInfo = new InteractRecordExtendInfoDTO();
BeanUtils.copyProperties(item.getExtendInfo(), extendInfo);
temp.setExtendInfo(extendInfo);
}
return temp;
})
.collect(Collectors.toList());
result.setTotalCount(pageResult.getTotalCount());
result.setResult(recordInfos);
return ServiceResponse.success(result);
}
}
package com.gic.haoban.manage.service.service.out.impl.content;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.content.PotentialCustomerDTO;
import com.gic.haoban.manage.api.dto.qdto.content.PotentialCustomerMarkRecordDTO;
import com.gic.haoban.manage.api.dto.qdto.content.PotentialCustomerQDTO;
import com.gic.haoban.manage.api.service.content.PotentialCustomerApiService;
import com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerBO;
import com.gic.haoban.manage.service.pojo.qo.content.PotentialCustomerQO;
import com.gic.haoban.manage.service.service.content.PotentialCustomerService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author MUSI
* @Date 2023/3/29 10:00 AM
* @Description
* @Version
**/
@Component("potentialCustomerApiService")
public class PotentialCustomerApiServiceImpl implements PotentialCustomerApiService {
@Autowired
PotentialCustomerService potentialCustomerService;
/**
* 查询销售线索记录
*
* @param potentialCustomerQDTO
* @return
*/
@Override
public ServiceResponse<Page<PotentialCustomerDTO>> queryPotentialCustomer(PotentialCustomerQDTO potentialCustomerQDTO) {
PotentialCustomerQO searchQO = new PotentialCustomerQO();
BeanUtils.copyProperties(potentialCustomerQDTO, searchQO);
Page<PotentialCustomerBO> customerPage = potentialCustomerService.queryPotentialCustomerPage(searchQO);
if (CollectionUtils.isEmpty(customerPage.getResult())) {
return ServiceResponse.success(new Page<>());
}
Page<PotentialCustomerDTO> resultPage = new Page<>();
resultPage.setTotalCount(customerPage.getTotalCount());
List<PotentialCustomerDTO> customerDTOS = customerPage.getResult()
.stream()
.map(item -> {
PotentialCustomerDTO temp = new PotentialCustomerDTO();
BeanUtils.copyProperties(item, temp);
return temp;
})
.collect(Collectors.toList());
resultPage.setResult(customerDTOS);
return ServiceResponse.success(resultPage);
}
/**
* 标记销售线索 已看、星标
*
* @param potentialCustomerMarkRecordDTO
* @return
*/
@Override
public ServiceResponse<Long> markPotentialCustomer(PotentialCustomerMarkRecordDTO potentialCustomerMarkRecordDTO) {
PotentialCustomerBO potentialCustomerBO = potentialCustomerService.queryPotentialCustomerInfo(potentialCustomerMarkRecordDTO.getClerkId(), potentialCustomerMarkRecordDTO.getPotentialCustomerId());
if (potentialCustomerBO == null) {
return ServiceResponse.failure("-701", "数据不存在");
}
potentialCustomerService.markPotentialCustomer(potentialCustomerBO);
return ServiceResponse.success(potentialCustomerBO.getId());
}
}
......@@ -3,17 +3,25 @@ package com.gic.haoban.manage.service.service.out.impl.content.task;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.manage.api.dto.content.log.TriggerCustomerDetailLogDTO;
import com.gic.haoban.manage.api.dto.content.report.MaterialReportDTO;
import com.gic.haoban.manage.api.enums.content.MaterialReportType;
import com.gic.haoban.manage.api.enums.content.TriggerCustomerChannelType;
import com.gic.haoban.manage.api.service.content.task.QywxGroupMsgTaskApiService;
import com.gic.haoban.manage.service.pojo.bo.content.GroupMessageInfoBo;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.content.GroupMessageService;
import com.gic.haoban.manage.service.service.content.MaterialReportService;
import com.gic.haoban.manage.service.task.RouterConstant;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -29,11 +37,17 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
private static final Logger log = LoggerFactory.getLogger(QywxGroupMsgTaskApiServiceImpl.class);
@Autowired
private GroupMessageService groupMessageService;
@Autowired
private MaterialReportService materialReportService;
@Autowired
private StaffService staffService;
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Override
public ServiceResponse<Void> groupMsgTaskJob(String params) {
// 获取开启【内容】权限的企业id
List<String> enterpriseIds = new ArrayList<>();
List<String> enterpriseIds = groupMessageService.hasMaterialRightEnterprise();
// 获取企业 (当前时间 - 30分钟, 当前时间)范围内的 导购分享记录。按创建时间排序
Date currentTime = new Date();
for (String enterpriseId : enterpriseIds) {
......@@ -74,4 +88,100 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
groupMessageService.handlerGroupMessage(groupMessageInfoBo);
return ServiceResponse.success();
}
/**
* 素材周报
*
* @param params
* @return
*/
@Override
public ServiceResponse<Void> handlerMaterialWeekReport(String params) {
log.info("handlerMaterialWeekReport 执行素材周报任务开始 >>>>> {}", DateUtil.datetimeToString(new Date()));
return doHandlerReportInner(MaterialReportType.WEEK.getCode());
}
/**
* 素材月报
*
* @param params
* @return
*/
@Override
public ServiceResponse<Void> handlerMaterialMonthReport(String params) {
log.info("handlerMaterialWeekReport 执行素材月报任务开始 >>>>> {}", DateUtil.datetimeToString(new Date()));
return doHandlerReportInner(MaterialReportType.MONTH.getCode());
}
/**
* 发送企业周报/月报素材
* @param reportType
* @return
*/
private ServiceResponse<Void> doHandlerReportInner(Integer reportType) {
List<String> enterpriseIds = groupMessageService.hasMaterialRightEnterprise();
if (CollectionUtils.isEmpty(enterpriseIds)) {
return ServiceResponse.success();
}
for (String enterpriseId : enterpriseIds) {
List<String> wxEnterpriseIds = wxEnterpriseService.queryWxEnterpriseWithEnterpriseId(enterpriseId);
if (CollectionUtils.isEmpty(wxEnterpriseIds)) {
log.info("企业 {}未关联企微", enterpriseId);
continue;
}
List<String> staffIds = staffService.queryStaffIdsWithEnterpriseId(wxEnterpriseIds);
if (CollectionUtils.isEmpty(staffIds)) {
log.info("企业 {} 不存在成员", enterpriseId);
continue;
}
for (String staffId : staffIds) {
if (!StringUtils.equals("e608b51b267e4943b87e222a343b4f25", staffId)) {
continue;
}
MaterialReportDTO temp = new MaterialReportDTO();
temp.setStaffId(staffId);
temp.setEnterpriseId(enterpriseId);
temp.setReportType(reportType);
boolean sendMQResult = this.sendMaterialReportMQ(temp);
log.info("发送企业{}, 成员id: {}, 结果: {}", enterpriseId, staffId, sendMQResult);
}
}
return ServiceResponse.success();
}
/**
* 处理单成员素材使用周报/月报
*
* @see RouterConstant#DEAL_ONE_STAFF_MATERIAL_REPORT
* @param params
* @return
*/
@Override
public ServiceResponse<Void> doHandlerMaterialOneStaffReportMQ(String params) {
log.info("doHandlerMaterialOneStaffReportMQ 参数: {}", params);
MaterialReportDTO materialReportDTO = JSON.parseObject(params, MaterialReportDTO.class);
if (materialReportDTO == null) {
log.info("参数异常 {}", params);
return ServiceResponse.success();
}
materialReportService.handlerMaterialReport(materialReportDTO.getEnterpriseId(), materialReportDTO.getStaffId(), materialReportDTO.getReportType());
return ServiceResponse.success();
}
/**
* 发送成员使用素材消息MQ
* @param materialReportDTO
* @return
*/
private boolean sendMaterialReportMQ(MaterialReportDTO materialReportDTO) {
try {
GICMQClientUtil.getClientInstance()
.sendMessage(RouterConstant.DEAL_ONE_STAFF_MATERIAL_REPORT, JSON.toJSONString(materialReportDTO));
return true;
}catch (Exception ex){
log.warn("发送成员使用素材周报/月报MQ异常, 参数: {}", JSON.toJSONString(materialReportDTO), ex);
}
return false;
}
}
package com.gic.haoban.manage.service.task;
import com.gic.haoban.manage.api.service.content.task.QywxGroupMsgTaskApiService;
/**
* @author
*/
......@@ -28,4 +30,11 @@ public class RouterConstant {
public final static int DEFAULT_STATUS = 1;
/**
* 素材周报/月报数据
* @see QywxGroupMsgTaskApiService#doHandlerMaterialOneStaffReportMQ(String)
*/
public static final String DEAL_ONE_STAFF_MATERIAL_REPORT = "dealOneStaffMaterialReport";
}
package com.gic.haoban.manage.service.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSON;
import com.gic.thirdparty.cloudfile.CloudFileUtil;
import com.gic.thirdparty.cloudfile.enums.CloudFileBusinessOptEnum;
import com.gic.thirdparty.cloudfile.enums.CloudFileTypeEnum;
import com.gic.thirdparty.cloudfile.pojo.CloudFileInfo;
import lombok.extern.slf4j.Slf4j;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.Random;
/**
* @Author MUSI
......@@ -18,29 +20,27 @@ import java.io.InputStream;
* @Description
* @Version
**/
@Slf4j
public class DrawImageUtils {
private static final Logger log = LoggerFactory.getLogger(DrawImageUtils.class);
/**
* 绘画素材月报海报图
* @param fileName
* 绘画素材周报/月报 海报图
*
* @param factoryCode
* @param materialNum
* @param amountText
* @throws IOException
*/
public static void drawImageMonth(String fileName, String materialNum, String amountText) {
public static String drawImage(String factoryCode, String materialNum, String amountText, String templatePath) {
try {
long startTime = System.currentTimeMillis();
InputStream inputStream = DrawImageUtils.class.getClassLoader().getResourceAsStream("template/month_bkg.png");
InputStream inputStream = DrawImageUtils.class.getClassLoader().getResourceAsStream(templatePath);
if (inputStream == null) {
return;
log.info("模板文件不存在 path:{}", templatePath);
return null;
}
BufferedImage image = ImageIO.read(inputStream);
Graphics2D pen = image.createGraphics();
pen.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
pen.setColor(Color.WHITE);
Font font = new Font("微软雅黑", Font.BOLD, 56);
pen.setFont(font);
......@@ -49,20 +49,28 @@ public class DrawImageUtils {
pen.drawString(materialNum, startX, 250);
int amountX = 320 + (353 - metrics.stringWidth(amountText)) / 2;
pen.drawString(amountText, amountX, 250);
File file = new File(fileName);
FileOutputStream fos = new FileOutputStream(file);
ImageIO.write(image, "png", fos);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ImageIO.write(image, "png", bos);
pen.dispose();
CloudFileInfo cloudFileInfo = CloudFileUtil.uploadFile(bos.toByteArray(), "png", CloudFileTypeEnum.IMAGE, factoryCode, CloudFileBusinessOptEnum.HAOBAN_COMMON);
log.info("上传图片结果:{}", JSON.toJSONString(cloudFileInfo));
long endTime = System.currentTimeMillis();
log.info("合成图片耗时 {} ms", (endTime - startTime));
}catch (Exception ex){
if (cloudFileInfo != null) {
return cloudFileInfo.getOrgFileUrl();
}
} catch (Exception ex) {
log.info("合成月报图片异常", ex);
}
return null;
}
public static void main(String[] args) throws IOException {
DrawImageUtils.drawImageMonth("test2.png", "104", "13,433.33");
DrawImageUtils.drawImageMonth("test3.png", "1", "1.43万");
public static void main(String[] args) {
System.setProperty("gic.module.name", "haoban-manage3-service");
Random random = new Random();
for (int i = 0; i < 50; i++) {
String url = DrawImageUtils.drawImage("jhdm", Math.abs(random.nextInt(1000)) + "", Math.abs(random.nextInt(1000)) + "万", "template/week_bkg.png");
System.out.println(url);
}
}
}
......@@ -9,5 +9,6 @@
<import resource="classpath:dubbo-haoban-manage-service.xml" />
<import resource="classpath:dubbo-setting-test.xml"/>
<import resource="classpath:jdbc-haoban-manage-service.xml" />
<!-- <import resource="classpath*:jdbc-haoban-manage-service-sharding.xml" />-->
<import resource="classpath*:log-record-init.xml" />
</beans>
\ No newline at end of file
......@@ -206,5 +206,13 @@
<dubbo:service interface="com.gic.haoban.manage.api.service.content.MaterialShareLogApiService"
ref="materialShareLogApiServiceImpl" timeout="10000" />
<dubbo:service interface="com.gic.haoban.manage.api.service.content.task.QywxGroupMsgTaskApiService"
ref="qywxGroupMsgTaskApiServiceImpl" timeout="10000" />
<dubbo:service interface="com.gic.haoban.manage.api.service.content.PotentialCustomerApiService"
ref="potentialCustomerApiService" timeout="10000" />
<dubbo:service interface="com.gic.haoban.manage.api.service.content.InteractRecordApiService"
ref="interactRecordApiService" timeout="10000" />
<dubbo:reference interface="com.gic.store.goods.service.GoodsInfoOutApiService" id="goodsInfoOutApiService" timeout="10000" retries="0" check="false"/>
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<context:annotation-config />
<!-- <import resource="classpath*:applicationContext-db-only-with-emoji.xml"/>-->
<import resource="classpath*:applicationContext-sharding-db.xml" />
<bean class="com.gic.haoban.common.init.HaobanSqlSessionFactoryBean" id="sqlSessionFactory">
<property name="dataSource" ref="dataSource" />
<property name="typeAliasesPackage" value="com.gic.haoban.**.entity,com.gic.haoban.*.entity" />
<property name="mapperLocations" value="classpath*:mapper/**/*.xml" />
<property name="plugins">
<array>
<bean class="com.github.pagehelper.PageHelper">
<property name="properties">
<value>
dialect=mysql
</value>
</property>
</bean>
</array>
</property>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.gic.haoban.**.dao.mapper,com.gic.haoban.*.mapper" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
</bean>
<bean class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 事务管理器 -->
<bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<tx:annotation-driven transaction-manager="txManager" />
</beans>
\ No newline at end of file
......@@ -619,4 +619,14 @@
where staff_id= #{staffId}
</update>
<select id="queryStaffIdsWithEnterpriseId" resultType="java.lang.String">
select staff_id
from tab_haoban_staff
where status_flag = 1
and wx_enterprise_id in
<foreach collection="wxEnterpriseIds" item="wxEnterpriseId" open="(" close=")" separator=",">
#{wxEnterpriseId}
</foreach>
</select>
</mapper>
\ No newline at end of file
......@@ -447,4 +447,9 @@
</if>
</select>
<select id="listAllRelationDtosByEnterpriseId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
<include refid="leftJoinStaffSQL"/>
where a.enterprise_id = #{wxEnterpriseId} and a.status_flag=1 and b.status_flag = 1
</select>
</mapper>
\ No newline at end of file
......@@ -506,4 +506,13 @@
group by a.enterprise_id
</select>
<select id="queryWxEnterpriseByEnterpriseId" resultType="java.lang.String">
select
a.wx_enterprise_id wxEnterpriseId
from tab_haoban_wx_enterprise_related a
inner join tab_haoban_wx_enterprise b on a.wx_enterprise_id = b.wx_enterprise_id
where a.status_flag = 1 and b.status_flag = 1
and a.enterprise_id = #{enterpriseId}
</select>
</mapper>
\ No newline at end of file
import cn.hutool.crypto.digest.MD5;
import com.gic.haoban.manage.api.enums.content.MaterialInteractRecordEventType;
import com.gic.haoban.manage.api.enums.content.TriggerCustomerChannelType;
import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO;
import com.gic.haoban.manage.service.pojo.qo.content.InteractRecordQO;
import com.gic.haoban.manage.service.service.content.InteractRecordService;
import com.gic.haoban.manage.service.service.content.message.InteractRecordMessageService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Collections;
import java.util.Date;
import java.util.UUID;
/**
* @Author MUSI
* @Date 2023/3/29 3:16 PM
* @Description
* @Version
**/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class InteractRecordTest {
@Autowired
private InteractRecordService interactRecordService;
@Autowired
private InteractRecordMessageService interactRecordMessageService;
String eid = "ff8080815dacd3a2015dacd3ef5c0000";
String wxEid = "ca66a01b79474c40b3e7c7f93daf1a3b";
String staffId = "e608b51b267e4943b87e222a343b4f25";
String clerkId = "fbc508e395f846ef9005852c420e1c4f";
String memberId = "ff8080818147efc8018148d1759903c8";
@Test
public void queryInteractPageTest(){
InteractRecordQO interactRecordQO = new InteractRecordQO();
interactRecordQO.setClerkId(staffId);
interactRecordService.queryInteractRecordPage(interactRecordQO);
}
@Test
public void dealRecordTest(){
String businessId = "UUID.randomUUID().toString()";
InteractRecordMessageBO message = new InteractRecordMessageBO();
message.setClerkId(clerkId);
message.setEnterpriseId(eid);
message.setMemberId(memberId);
message.setUnionId(memberId);
message.setStoreId("ff8080818499a54801849ce85f9f003f");
message.setMaterialId("1232139123912");
message.setChannelSource(TriggerCustomerChannelType.PYQ.getCode());
message.setEventType(MaterialInteractRecordEventType.VISIT_PRODUCT.getCode());
message.setGoodsIds(Collections.singletonList("fbc508e395f846ef9005852c420e1c23"));
message.setDurationTime(2000);
message.setBusinessUUId(businessId);
message.setLastAccessTime(new Date().getTime());
interactRecordMessageService.dealRecord(message);
}
@Test
public void test(){
for (int i = 0; i < 10; i++) {
System.out.println(MD5.create().digestHex("song"));
}
}
}
import com.alibaba.fastjson.JSON;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.api.enums.content.MaterialReportType;
import com.gic.haoban.manage.api.service.content.task.QywxGroupMsgTaskApiService;
import com.gic.haoban.manage.service.dao.mapper.content.TabHaobanInteractRecordMapper;
import com.gic.haoban.manage.service.entity.content.TabHaobanInteractRecord;
import com.gic.haoban.manage.service.service.content.MaterialReportService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date;
import java.util.List;
/**
* @Author MUSI
* @Date 2023/3/25 12:04 AM
* @Description
* @Version
**/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class MaterialReportServiceTest {
public MaterialReportServiceTest(){
}
@Autowired
private MaterialReportService materialReportService;
@Autowired
private QywxGroupMsgTaskApiService qywxGroupMsgTaskApiService;
@Autowired
private TabHaobanInteractRecordMapper interactRecordMapper;
String eid = "ff8080815dacd3a2015dacd3ef5c0000";
String wxEid = "ca66a01b79474c40b3e7c7f93daf1a3b";
String staffId = "e608b51b267e4943b87e222a343b4f25";
@Test
public void handlerMaterialWeekReportTest() {
System.setProperty("gic.module.name", "haoban-manage3-service");
materialReportService.handlerMaterialReport(eid, staffId, MaterialReportType.WEEK.getCode());
materialReportService.handlerMaterialReport(eid, staffId, MaterialReportType.MONTH.getCode());
}
@Test
public void weekReport(){
qywxGroupMsgTaskApiService.handlerMaterialMonthReport("");
}
@Test
public void shardingTest(){
TabHaobanInteractRecord temp = new TabHaobanInteractRecord();
temp.setId(UniqueIdUtils.uniqueLong());
temp.setEnterpriseId(eid);
temp.setClerkId(staffId);
temp.setMemberId(staffId);
temp.setUnionId(staffId);
temp.setTraceId(staffId);
temp.setBizType(1);
temp.setStoreId(staffId);
temp.setChannelSource(1);
temp.setEventType(1);
temp.setDurationTime(111);
temp.setTimes(1);
temp.setDeleteFlag(0);
temp.setCreateTime(new Date());
temp.setUpdateTime(new Date());
temp.setBizId(UniqueIdUtils.uniqueLong()+"");
// int insert = interactRecordMapper.insert(temp);
List<TabHaobanInteractRecord> tabHaobanInteractRecords = interactRecordMapper.queryAllByLimit(temp);
System.out.println(JSON.toJSONString(tabHaobanInteractRecords));
}
}
package com.gic.haoban.manage.web.controller;
import cn.hutool.core.collection.CollectionUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.ApplicationDTO;
import com.gic.haoban.manage.api.dto.ApplicationSettingDTO;
......@@ -103,5 +104,4 @@ public class ApplicationController extends WebBaseController {
private int checkNum(int limit, int cur) {
return cur > limit ? 1 : (cur == limit ? 0 : -1);
}
}
......@@ -9,6 +9,7 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.gic.haoban.manage.web.vo.EnterpriseConfigVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
......@@ -88,6 +89,9 @@ import com.gic.wechat.api.service.qywx.QywxUserApiService;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
/**
* 企微配置
*/
@RestController
public class WxEnterpriseInfoController extends WebBaseController {
......@@ -688,4 +692,27 @@ public class WxEnterpriseInfoController extends WebBaseController {
boolean check = this.accountService.storageFeeCheck(enterpriseId) ;
return RestResponse.successResult(check) ;
}
/**
* 查询企业配置
* @param enterpriseId
* @return
*/
@RequestMapping(path = "/enterprise/config")
public RestResponse<EnterpriseConfigVO> queryEnterpriseConfig(String enterpriseId) {
if (StringUtils.isBlank(enterpriseId)) {
return RestResponse.failure("-701", "参数缺失");
}
EnterpriseDTO enterpriseInfo = enterpriseService.getEnterpriseById(enterpriseId);
if (enterpriseInfo == null) {
return RestResponse.failure("-2", "企业信息不存在");
}
EnterpriseConfigVO configVO = EnterpriseConfigVO
.builder()
.miniAppId(enterpriseInfo.getMallMiniprogramAppid())
.build();
return RestResponse.successResult(configVO);
}
}
......@@ -17,6 +17,7 @@ import com.gic.content.api.service.ContentMaterialApiService;
import com.gic.content.api.service.ContentMaterialShareApiService;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.web.controller.content.adaptor.ClerkStoreAdaptor;
import com.gic.haoban.manage.web.controller.goods.GoodsInfoAdaptor;
import com.gic.haoban.manage.web.qo.content.ContentColumnClerkViewQO;
import com.gic.haoban.manage.web.qo.content.ContentMaterialQO;
......@@ -46,7 +47,6 @@ import java.util.stream.Collectors;
*
*/
@RestController
@RequestMapping(path = "/haoban-manage3-wx")
public class ContentMaterialController {
private static final Logger log = LoggerFactory.getLogger(ContentMaterialController.class);
......@@ -58,7 +58,7 @@ public class ContentMaterialController {
private ContentMaterialShareApiService contentMaterialShareApiService;
@Autowired
private StaffApiService staffApiService;
private ClerkStoreAdaptor clerkStoreAdaptor;
@Autowired
private GoodsInfoAdaptor goodsInfoAdaptor;
......@@ -74,7 +74,7 @@ public class ContentMaterialController {
List<String> storeIdList = new ArrayList<>();
if (StringUtils.isBlank(storeId)) {
// 区经 获取管辖的权限
List<String> storeIds = this.queryClerkStoreIds(clerkId, wxEnterpriseId);
List<String> storeIds = this.clerkStoreAdaptor.queryClerkStoreIds(clerkId, wxEnterpriseId);
storeIdList.addAll(storeIds);
} else {
storeIdList.add(storeId);
......@@ -114,7 +114,7 @@ public class ContentMaterialController {
}
if (StringUtils.isBlank(contentMaterialQO.getStoreId())) {
// 区经 获取管辖的权限
List<String> storeIds = this.queryClerkStoreIds(contentMaterialQO.getClerkId(), contentMaterialQO.getWxEnterpriseId());
List<String> storeIds = this.clerkStoreAdaptor.queryClerkStoreIds(contentMaterialQO.getClerkId(), contentMaterialQO.getWxEnterpriseId());
contentMaterialPageFrontQDTO.setStoreIdList(storeIds);
} else {
contentMaterialPageFrontQDTO.setStoreIdList(Collections.singletonList(contentMaterialQO.getStoreId()));
......@@ -227,25 +227,4 @@ public class ContentMaterialController {
return RestResponse.successResult();
}
/**
* 查询区经角色下管辖的门店权限
*
* @param clerkId
* @param wxEnterpriseId
* @return
*/
public List<String> queryClerkStoreIds(String clerkId, String wxEnterpriseId) {
List<String> storeIds = staffApiService.getHaoBanStoreIdsRolesByClerkId(clerkId, wxEnterpriseId);
if (CollectionUtils.isEmpty(storeIds)) {
log.info("根据区经id查询管辖的门店为空 {} {}", clerkId, wxEnterpriseId);
return Collections.singletonList("-100");
}
if (storeIds.size() == 1 && StringUtils.equals(storeIds.get(0), "-1")) {
// 全部门店权限
log.info("区经有全部门店权限 {}", clerkId);
return Collections.emptyList();
}
return storeIds;
}
}
package com.gic.haoban.manage.web.controller.content;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.content.api.dto.material.ContentMaterialBaseDTO;
import com.gic.haoban.manage.api.dto.qdto.content.InteractRecordQDTO;
import com.gic.haoban.manage.api.enums.content.InteractRecordInfoDTO;
import com.gic.haoban.manage.api.service.content.InteractRecordApiService;
import com.gic.haoban.manage.web.controller.content.adaptor.ContentMaterialAdaptor;
import com.gic.haoban.manage.web.qo.content.InteractRecordQO;
import com.gic.haoban.manage.web.vo.content.ContentMaterialInfoVO;
import com.gic.haoban.manage.web.vo.content.InteractRecordVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 好办-互动记录
**/
@Slf4j
@RestController
@RequestMapping(path = "/interact/record")
public class InteractRecordController {
@Autowired
InteractRecordApiService interactRecordApiService;
@Autowired
ContentMaterialAdaptor contentMaterialAdaptor;
/**
* 会员互动记录列表
*
* @return
*/
@RequestMapping(path = "/list")
public RestResponse<Page<InteractRecordVO>> queryInteractRecordList(InteractRecordQO interactRecordQO) {
InteractRecordQDTO searchQdto = new InteractRecordQDTO();
BeanUtils.copyProperties(interactRecordQO, searchQdto);
ServiceResponse<Page<InteractRecordInfoDTO>> serviceResponse = interactRecordApiService.queryInteractRecordList(searchQdto);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
if (CollectionUtils.isEmpty(serviceResponse.getResult().getResult())) {
return RestResponse.successResult(new Page<>());
}
List<Long> materialIds = serviceResponse.getResult()
.getResult()
.stream()
.map(item -> Long.parseLong(item.getBizId()))
.distinct()
.collect(Collectors.toList());
Map<Long, ContentMaterialBaseDTO> materialBaseMap =
contentMaterialAdaptor.queryMaterialInfoMap(interactRecordQO.getEnterpriseId(), materialIds);
List<InteractRecordVO> interactRecordVos = serviceResponse.getResult()
.getResult()
.stream()
.map(item -> {
InteractRecordVO interactRecordVO = new InteractRecordVO();
BeanUtils.copyProperties(interactRecordVO, interactRecordVO);
ContentMaterialBaseDTO materialBaseInfo = materialBaseMap.get(Long.parseLong(item.getBizId()));
if (materialBaseInfo != null) {
ContentMaterialInfoVO temp = new ContentMaterialInfoVO();
BeanUtils.copyProperties(materialBaseInfo, item);
interactRecordVO.setContentMaterialInfoVO(temp);
}
return interactRecordVO;
})
.collect(Collectors.toList());
Page<InteractRecordVO> result = new Page<>();
result.setTotalCount(serviceResponse.getResult().getTotalCount());
result.setResult(interactRecordVos);
return RestResponse.successResult(result);
}
// /**
// * 查询互动记录扩展信息
// * @param interactRecordQO
// * @return
// */
// @RequestMapping(path = "/relation/extend/info")
// public RestResponse<InteractRecordExtendInfoVO> queryInteractRecordRelationGoods(InteractRecordQO interactRecordQO) {
// return RestResponse.successResult();
// }
}
package com.gic.haoban.manage.web.controller.content;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.content.api.dto.material.ContentMaterialBaseDTO;
import com.gic.haoban.manage.api.dto.content.PotentialCustomerDTO;
import com.gic.haoban.manage.api.dto.qdto.content.PotentialCustomerMarkRecordDTO;
import com.gic.haoban.manage.api.dto.qdto.content.PotentialCustomerQDTO;
import com.gic.haoban.manage.api.enums.content.ShareBizType;
import com.gic.haoban.manage.api.service.content.PotentialCustomerApiService;
import com.gic.haoban.manage.web.controller.content.adaptor.ContentMaterialAdaptor;
import com.gic.haoban.manage.web.qo.content.potential.PotentialCustomerMarkRecordVO;
import com.gic.haoban.manage.web.qo.content.potential.PotentialCustomerQO;
import com.gic.haoban.manage.web.vo.content.ContentMaterialInfoVO;
import com.gic.haoban.manage.web.vo.content.potential.PotentialCustomerVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 好办小程序-销售线索
**/
@Slf4j
@RestController
@RequestMapping(path = "/potential/customer")
public class PotentialCustomerController {
@Autowired
private PotentialCustomerApiService potentialCustomerApiService;
@Autowired
ContentMaterialAdaptor contentMaterialAdaptor;
/**
* 销售线索列表
*
* @param potentialCustomerQO
* @return
*/
@RequestMapping(path = "/list")
public RestResponse<Page<PotentialCustomerVO>> queryPotentialCustomerList(@RequestBody PotentialCustomerQO potentialCustomerQO) {
PotentialCustomerQDTO searchQDTO = new PotentialCustomerQDTO();
BeanUtils.copyProperties(potentialCustomerQO, searchQDTO);
ServiceResponse<Page<PotentialCustomerDTO>> serviceResponse =
potentialCustomerApiService.queryPotentialCustomer(searchQDTO);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
List<PotentialCustomerDTO> customerDTOS = serviceResponse.getResult().getResult();
List<Long> materialIds = customerDTOS
.stream()
.filter(item -> ShareBizType.MATERIAL.getCode().equals(item.getBizType()))
.map(item -> Long.parseLong(item.getBizId()))
.collect(Collectors.toList());
Map<Long, ContentMaterialBaseDTO> materialInfoMap = contentMaterialAdaptor.queryMaterialInfoMap(potentialCustomerQO.getEnterpriseId(), materialIds);
List<PotentialCustomerVO> customerVOS = customerDTOS
.stream()
.map(item -> {
PotentialCustomerVO temp = new PotentialCustomerVO();
BeanUtils.copyProperties(item, temp);
temp.setPotentialCustomerId(item.getPotentialCustomerId());
ContentMaterialBaseDTO contentMaterialBaseDTO = materialInfoMap.get(Long.parseLong(item.getBizId()));
if (contentMaterialBaseDTO != null) {
ContentMaterialInfoVO contentMaterialInfoVO = new ContentMaterialInfoVO();
BeanUtils.copyProperties(contentMaterialBaseDTO, contentMaterialInfoVO);
temp.setContentMaterialInfoVO(contentMaterialInfoVO);
}
return temp;
})
.collect(Collectors.toList());
Page<PotentialCustomerVO> result = new Page<>();
result.setTotalCount(serviceResponse.getResult().getTotalCount());
result.setResult(customerVOS);
return RestResponse.successResult(result);
}
/**
* 标记销售线索为已看
*
* @return
*/
@RequestMapping(path = "/mark/record/see")
public RestResponse<?> markRecordSee(@RequestBody PotentialCustomerMarkRecordVO potentialCustomerMarkRecordVO) {
PotentialCustomerMarkRecordDTO markRecord = new PotentialCustomerMarkRecordDTO();
BeanUtils.copyProperties(potentialCustomerMarkRecordVO, markRecord);
ServiceResponse<Long> serviceResponse = potentialCustomerApiService.markPotentialCustomer(markRecord);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
return RestResponse.successResult();
}
/**
* 标记客户为星标客户
*
* @return
*/
@RequestMapping(path = "/mark/member/star")
public RestResponse<?> markMemberStar(@RequestBody PotentialCustomerMarkRecordVO potentialCustomerMarkRecordVO) {
PotentialCustomerMarkRecordDTO markRecord = new PotentialCustomerMarkRecordDTO();
BeanUtils.copyProperties(potentialCustomerMarkRecordVO, markRecord);
ServiceResponse<Long> serviceResponse = potentialCustomerApiService.markPotentialCustomer(markRecord);
if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
return RestResponse.successResult();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment