瀏覽代碼

营销sop提交

YPZ 3 天之前
父節點
當前提交
56efdaa09b

+ 69 - 0
java/storlead-sasa/storlead-trade/storlead-marketing/src/main/java/com/storlead/crm/marketing/common/Page.java

@@ -0,0 +1,69 @@
+package com.storlead.crm.marketing.common;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import ma.glasnost.orika.impl.DefaultMapperFactory;
+import org.springframework.util.CollectionUtils;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @program: sp-tems
+ * @description: page类
+ * @author: xiaojiawei
+ * @create: 2022-04-15 16:37
+ **/
+@Data
+public class Page implements Serializable {
+    private static final long serialVersionUID = 1004386013084749956L;
+
+    @TableField(exist = false)
+    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
+    @ApiModelProperty(value = "页码", example = "1")
+    private Integer pageIndex = 1;
+
+    @TableField(exist = false)
+    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
+    @ApiModelProperty(value = "页面大小", example = "10")
+    private Integer pageSize = 10;
+
+    @ApiModelProperty(value = "页码", example = "1")
+    private Integer pageNo = 1;
+
+    /**
+     * 设置 pageIndex 时同步到 pageNo
+     */
+    public void setPageIndex(Integer pageIndex) {
+        this.pageIndex = pageIndex;
+        if (pageIndex != null) {
+            this.pageNo = pageIndex;
+        }
+    }
+
+    /**
+     * 设置 pageNo 时同步到 pageIndex
+     */
+    public void setPageNo(Integer pageNo) {
+        this.pageNo = pageNo;
+        if (pageNo != null) {
+            this.pageIndex = pageNo;
+        }
+    }
+
+    public static  <T> IPage<T> page(IPage page, Class<T> t) {
+        DefaultMapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
+        IPage<T> pageVo = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(page.getCurrent(),page.getSize());
+        if (CollectionUtils.isEmpty(page.getRecords())) {
+            return page;
+        }
+        List<T> vos = mapperFactory.getMapperFacade().mapAsList(page.getRecords(),t);
+        pageVo.setTotal(page.getTotal());
+        pageVo.setRecords(vos);
+        return pageVo;
+    }
+
+}

+ 176 - 1
java/storlead-sasa/storlead-trade/storlead-marketing/src/main/java/com/storlead/crm/marketing/dto/MarketingCampaignDTO.java

@@ -1,20 +1,195 @@
 package com.storlead.crm.marketing.dto;
 
+import com.alibaba.fastjson.annotation.JSONField;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.storlead.crm.marketing.entity.MarketingCampaignEntity;
 import com.storlead.framework.mybatis.entity.SysBaseField;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.storlead.framework.mybatis.page.Page;
 
 import java.time.LocalDate;
 import java.util.List;
 
 @Data
 @TableName("marketing_campaign")
-public class MarketingCampaignDTO extends MarketingCampaignEntity {
+public class MarketingCampaignDTO extends Page {
+
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键id")
+    private Long id;
+
+    @ApiModelProperty(value = "活动名称")
+    @TableField("name")
+    private String name;
+
+    @ApiModelProperty(value = "活动类型(1潜客开发、2客户培养、3客户唤醒、4产品推广、5节日营销、6展会跟进)")
+    @TableField("type")
+    private Integer type;
+
+    @ApiModelProperty(value = "优先级(1紧急、2高优先、3中等、4低优先)")
+    @TableField("priority")
+    private Integer priority;
+
+    @ApiModelProperty(value = "开始日期")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @JSONField(format ="yyyy-MM-dd")
+    @TableField("begin_data")
+    private LocalDate beginData;
+
+    @ApiModelProperty(value = "结束日期")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @JSONField(format ="yyyy-MM-dd")
+    @TableField("end_date")
+    private LocalDate endDate;
+
+    @ApiModelProperty(value = "负责人id")
+    @TableField("supervisor")
+    private Long supervisor;
+
+    @ApiModelProperty(value = "关联商机")
+    @TableField("link_to_opportunity")
+    private Long linkToOpportunity;
+
+    @ApiModelProperty(value = "活动描述")
+    @TableField("description")
+    private String description;
+
+    @ApiModelProperty(value = "发送量")
+    @TableField("send_volume")
+    private Integer sendVolume;
+
+    @ApiModelProperty(value = "打开率")
+    @TableField("open rate")
+    private Double openRate;
+
+    @ApiModelProperty(value = "回复率")
+    @TableField("reply_rate")
+    private Double replyRate;
+
+    @ApiModelProperty(value = "商机数")
+    @TableField("opportunity_count")
+    private Integer opportunityCount;
+
+    @ApiModelProperty(value = "渠道配置")
+    @TableField("channel_configuration")
+    private Integer channelConfiguration;
+
+    @ApiModelProperty(value = "发送邮箱")
+    @TableField("email_address")
+    private String emailAddress;
+
+    @ApiModelProperty(value = "发送时间")
+    @TableField("email_sent_time")
+    private String emailSentTime;
+
+    @ApiModelProperty(value = "邮件模板")
+    @TableField("email_template")
+    private String emailTemplate;
+
+    @ApiModelProperty(value = "每批发送量")
+    @TableField("email_batch_size")
+    private Integer emailBatchSize;
+
+    @ApiModelProperty(value = "邮件主题")
+    @TableField("email_subject")
+    private String emailSubject;
+
+    @ApiModelProperty(value = "是否追踪邮件打开(1是0否)")
+    @TableField("track_config_open")
+    private Integer trackConfigOpen;
+
+    @ApiModelProperty(value = "是否追踪链接点击(1是0否)")
+    @TableField("track_config_click")
+    private Integer trackConfigClick;
+
+    @ApiModelProperty(value = "是否追踪回复(1是0否)")
+    @TableField("track_config_reply")
+    private Integer trackConfigReply;
+
+    @ApiModelProperty(value = "SOP序列id")
+    @TableField("sop_id")
+    private Integer sopId;
+
+    @ApiModelProperty(value = "未打开邮件跟进规则(1是0否)")
+    @TableField("follow_up_rules_not_opened")
+    private Integer followUpRulesNotOpened;
+
+    @ApiModelProperty(value = "未打开邮件跟进天数")
+    @TableField("follow_up_rules_not_opened_days")
+    private String followUpRulesNotOpenedDays;
+
+    @ApiModelProperty(value = "未回复邮件跟进规则(1是0否)")
+    @TableField("follow_up_rules_not_replied")
+    private Integer followUpRulesNotReplied;
+
+    @ApiModelProperty(value = "未回复邮件跟进天数")
+    @TableField("follow_up_rules_not_replied_days")
+    private String followUpRulesNotRepliedDays;
+
+    @ApiModelProperty(value = "未点击链接跟进规则(1是0否)")
+    @TableField("follow_up_rules_link_not_clicked")
+    private Integer followUpRulesLinkNotClicked;
+
+    @ApiModelProperty(value = "未点击链接跟进天数")
+    @TableField("follow_up_rules_link_not_clicked_days")
+    private String followUpRulesLinkNotClickedDays;
+
+    @ApiModelProperty(value = "客户回复后自动停止(1是0否)")
+    @TableField("follow_up_rules_replied")
+    private Integer followUpRulesReplied;
+
+    @ApiModelProperty(value = "客户预约后停止(1是0否)")
+    @TableField("follow_up_rules_appointment_booked")
+    private Integer followUpRulesAppointmentBooked;
+
+    @ApiModelProperty(value = "A/B测试(1是0否)")
+    @TableField("a_b_testing")
+    private Integer aBTesting;
+
+    @ApiModelProperty(value = "智能调度类型")
+    @TableField("smart_scheduling_type")
+    private String smartSchedulingType;
+
+    @ApiModelProperty(value = "智能调度开始日期")
+    @TableField("smart_scheduling_start_date")
+    private LocalDate smartSchedulingStartDate;
+
+    @ApiModelProperty(value = "智能调度开始时间")
+    @TableField("smart_scheduling_start_time")
+    private String smartSchedulingStartTime;
+
+    @ApiModelProperty(value = "是否已确认内容合规")
+    @TableField("has_content_compliant")
+    private Integer hasContentCompliant;
+
+    @ApiModelProperty(value = "是否已确认发送时间合理")
+    @TableField("has_schedule_approved")
+    private Integer hasScheduleApproved;
+
+    @ApiModelProperty(value = "是否符合GDPR")
+    @TableField("has_gdpr_compliant")
+    private Integer hasGdprCompliant;
+
+    @ApiModelProperty(value = "是否包含退订链接")
+    @TableField("has_unsubscribe_link")
+    private Integer hasUnsubscribeLink;
+
+    @ApiModelProperty(value = "进度百分比")
+    @TableField("progress_percent")
+    private Double progressPercent;
+
+    @ApiModelProperty(value = "状态 0未开始 1运行中 2暂停 3完成")
+    @TableField("status")
+    private Integer status;
+
     @ApiModelProperty(value = "idList")
     private List<Long> idList;
 

+ 25 - 2
java/storlead-sasa/storlead-trade/storlead-marketing/src/main/java/com/storlead/crm/marketing/service/impl/MarketingCampaignEntityServiceImpl.java

@@ -3,14 +3,18 @@ package com.storlead.crm.marketing.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.storlead.crm.marketing.dto.MarketingCampaignDTO;
 import com.storlead.crm.marketing.entity.CustomerBaseEntity;
 import com.storlead.crm.marketing.entity.MarketingCampaignEntity;
 import com.storlead.crm.marketing.mapper.MarketingCampaignEntityMapper;
 import com.storlead.crm.marketing.service.CustomerBaseEntityService;
 import com.storlead.crm.marketing.service.MarketingCampaignEntityService;
+import com.storlead.crm.marketing.vo.MarketingCampaignVO;
 import com.storlead.framework.common.constant.CommonConstant;
 import com.storlead.framework.common.result.Result;
+import com.storlead.framework.mybatis.entity.SysBaseField;
 import com.storlead.framework.mybatis.service.impl.MyBaseServiceImpl;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
@@ -19,6 +23,7 @@ import org.springframework.util.CollectionUtils;
 import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @Service
 public class MarketingCampaignEntityServiceImpl
@@ -29,11 +34,29 @@ public class MarketingCampaignEntityServiceImpl
     private CustomerBaseEntityService customerBaseEntityService;
     @Override
     public Result<Object> getList(MarketingCampaignDTO marketingCampaignDTO) {
+        IPage<MarketingCampaignVO> pageVO = new Page<>(marketingCampaignDTO.getPageIndex(), marketingCampaignDTO.getPageSize());
+        IPage<MarketingCampaignEntity> page = new Page<>(marketingCampaignDTO.getPageIndex(), marketingCampaignDTO.getPageSize());
         LambdaQueryWrapper<MarketingCampaignEntity> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(MarketingCampaignEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        List<MarketingCampaignEntity> list = this.list(queryWrapper);
+        IPage<MarketingCampaignEntity> pageList = this.page(page, queryWrapper);
 
-        return Result.ok(list);
+//        List<MarketingCampaignEntity> list = this.list(queryWrapper);
+        pageVO = SysBaseField.page(pageList, MarketingCampaignVO.class);
+        if (CollectionUtils.isEmpty(pageList.getRecords())){
+            return Result.ok(pageVO);
+        }
+        List<MarketingCampaignVO> marketingCampaignVOList = pageVO.getRecords();
+        List<Long> marketingCampaignIdList = marketingCampaignVOList.stream().map(MarketingCampaignVO::getId).collect(Collectors.toList());
+        LambdaQueryWrapper<CustomerBaseEntity> customerBaseEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        customerBaseEntityLambdaQueryWrapper.in(CustomerBaseEntity::getMarketingCampaignId, marketingCampaignIdList);
+        customerBaseEntityLambdaQueryWrapper.eq(CustomerBaseEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
+        List<CustomerBaseEntity> customerBaseEntityList = customerBaseEntityService.list(customerBaseEntityLambdaQueryWrapper);
+        //获取全部的关联客户id
+        List<Long> customerIdList = customerBaseEntityList.stream().map(CustomerBaseEntity::getCustomerId).collect(Collectors.toList());
+//        LambdaQueryWrapper<CustomerEntity> customerBaseEntityQueryWrapper = new LambdaQueryWrapper<>();
+
+
+        return Result.ok(pageVO);
     }
 
     @Override

+ 195 - 0
java/storlead-sasa/storlead-trade/storlead-marketing/src/main/java/com/storlead/crm/marketing/vo/MarketingCampaignVO.java

@@ -0,0 +1,195 @@
+package com.storlead.crm.marketing.vo;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.storlead.crm.marketing.entity.CustomerBaseEntity;
+import com.storlead.framework.mybatis.entity.SysBaseField;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDate;
+import java.util.List;
+
+@Data
+public class MarketingCampaignVO extends SysBaseField {
+
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键id")
+    private Long id;
+
+    @ApiModelProperty(value = "活动名称")
+    @TableField("name")
+    private String name;
+
+    @ApiModelProperty(value = "活动类型(1潜客开发、2客户培养、3客户唤醒、4产品推广、5节日营销、6展会跟进)")
+    @TableField("type")
+    private Integer type;
+
+    @ApiModelProperty(value = "优先级(1紧急、2高优先、3中等、4低优先)")
+    @TableField("priority")
+    private Integer priority;
+
+    @ApiModelProperty(value = "开始日期")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @JSONField(format ="yyyy-MM-dd")
+    @TableField("begin_data")
+    private LocalDate beginData;
+
+    @ApiModelProperty(value = "结束日期")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @JSONField(format ="yyyy-MM-dd")
+    @TableField("end_date")
+    private LocalDate endDate;
+
+    @ApiModelProperty(value = "负责人id")
+    @TableField("supervisor")
+    private Long supervisor;
+
+    @ApiModelProperty(value = "关联商机")
+    @TableField("link_to_opportunity")
+    private Long linkToOpportunity;
+
+    @ApiModelProperty(value = "活动描述")
+    @TableField("description")
+    private String description;
+
+    @ApiModelProperty(value = "发送量")
+    @TableField("send_volume")
+    private Integer sendVolume;
+
+    @ApiModelProperty(value = "打开率")
+    @TableField("open rate")
+    private Double openRate;
+
+    @ApiModelProperty(value = "回复率")
+    @TableField("reply_rate")
+    private Double replyRate;
+
+    @ApiModelProperty(value = "商机数")
+    @TableField("opportunity_count")
+    private Integer opportunityCount;
+
+    @ApiModelProperty(value = "渠道配置")
+    @TableField("channel_configuration")
+    private Integer channelConfiguration;
+
+    @ApiModelProperty(value = "发送邮箱")
+    @TableField("email_address")
+    private String emailAddress;
+
+    @ApiModelProperty(value = "发送时间")
+    @TableField("email_sent_time")
+    private String emailSentTime;
+
+    @ApiModelProperty(value = "邮件模板")
+    @TableField("email_template")
+    private String emailTemplate;
+
+    @ApiModelProperty(value = "每批发送量")
+    @TableField("email_batch_size")
+    private Integer emailBatchSize;
+
+    @ApiModelProperty(value = "邮件主题")
+    @TableField("email_subject")
+    private String emailSubject;
+
+    @ApiModelProperty(value = "是否追踪邮件打开(1是0否)")
+    @TableField("track_config_open")
+    private Integer trackConfigOpen;
+
+    @ApiModelProperty(value = "是否追踪链接点击(1是0否)")
+    @TableField("track_config_click")
+    private Integer trackConfigClick;
+
+    @ApiModelProperty(value = "是否追踪回复(1是0否)")
+    @TableField("track_config_reply")
+    private Integer trackConfigReply;
+
+    @ApiModelProperty(value = "SOP序列id")
+    @TableField("sop_id")
+    private Integer sopId;
+
+    @ApiModelProperty(value = "未打开邮件跟进规则(1是0否)")
+    @TableField("follow_up_rules_not_opened")
+    private Integer followUpRulesNotOpened;
+
+    @ApiModelProperty(value = "未打开邮件跟进天数")
+    @TableField("follow_up_rules_not_opened_days")
+    private String followUpRulesNotOpenedDays;
+
+    @ApiModelProperty(value = "未回复邮件跟进规则(1是0否)")
+    @TableField("follow_up_rules_not_replied")
+    private Integer followUpRulesNotReplied;
+
+    @ApiModelProperty(value = "未回复邮件跟进天数")
+    @TableField("follow_up_rules_not_replied_days")
+    private String followUpRulesNotRepliedDays;
+
+    @ApiModelProperty(value = "未点击链接跟进规则(1是0否)")
+    @TableField("follow_up_rules_link_not_clicked")
+    private Integer followUpRulesLinkNotClicked;
+
+    @ApiModelProperty(value = "未点击链接跟进天数")
+    @TableField("follow_up_rules_link_not_clicked_days")
+    private String followUpRulesLinkNotClickedDays;
+
+    @ApiModelProperty(value = "客户回复后自动停止(1是0否)")
+    @TableField("follow_up_rules_replied")
+    private Integer followUpRulesReplied;
+
+    @ApiModelProperty(value = "客户预约后停止(1是0否)")
+    @TableField("follow_up_rules_appointment_booked")
+    private Integer followUpRulesAppointmentBooked;
+
+    @ApiModelProperty(value = "A/B测试(1是0否)")
+    @TableField("a_b_testing")
+    private Integer aBTesting;
+
+    @ApiModelProperty(value = "智能调度类型")
+    @TableField("smart_scheduling_type")
+    private String smartSchedulingType;
+
+    @ApiModelProperty(value = "智能调度开始日期")
+    @TableField("smart_scheduling_start_date")
+    private LocalDate smartSchedulingStartDate;
+
+    @ApiModelProperty(value = "智能调度开始时间")
+    @TableField("smart_scheduling_start_time")
+    private String smartSchedulingStartTime;
+
+    @ApiModelProperty(value = "是否已确认内容合规")
+    @TableField("has_content_compliant")
+    private Integer hasContentCompliant;
+
+    @ApiModelProperty(value = "是否已确认发送时间合理")
+    @TableField("has_schedule_approved")
+    private Integer hasScheduleApproved;
+
+    @ApiModelProperty(value = "是否符合GDPR")
+    @TableField("has_gdpr_compliant")
+    private Integer hasGdprCompliant;
+
+    @ApiModelProperty(value = "是否包含退订链接")
+    @TableField("has_unsubscribe_link")
+    private Integer hasUnsubscribeLink;
+
+    @ApiModelProperty(value = "进度百分比")
+    @TableField("progress_percent")
+    private Double progressPercent;
+
+    @ApiModelProperty(value = "状态 0未开始 1运行中 2暂停 3完成")
+    @TableField("status")
+    private Integer status;
+
+    @ApiModelProperty(value = "关联客户id")
+    private List<Long> customerIdList;
+
+    @ApiModelProperty(value = "关联客户信息")
+    private List<CustomerBaseEntity> customerList;
+}