Commit ab9f41af by 王祖波

同步建联

parent 4fedbb9c
...@@ -60,6 +60,25 @@ public class ContactLogDTO implements Serializable { ...@@ -60,6 +60,25 @@ public class ContactLogDTO implements Serializable {
*/ */
private Date potentialTime; private Date potentialTime;
/** /**
* 来源日志id
*/
private Long sourceLogId;
/**
* 来源类型 1潜客(0001)2机会人群(0010)
*/
private Integer sourceType;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
*/
private Integer bizType;
/**
* 跟进记录组
*/
private String followTypes;
/**
* 企业id * 企业id
*/ */
private String enterpriseId; private String enterpriseId;
...@@ -168,4 +187,35 @@ public class ContactLogDTO implements Serializable { ...@@ -168,4 +187,35 @@ public class ContactLogDTO implements Serializable {
this.enterpriseId = enterpriseId; this.enterpriseId = enterpriseId;
} }
public Long getSourceLogId() {
return sourceLogId;
}
public void setSourceLogId(Long sourceLogId) {
this.sourceLogId = sourceLogId;
}
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public String getFollowTypes() {
return followTypes;
}
public void setFollowTypes(String followTypes) {
this.followTypes = followTypes;
}
} }
\ No newline at end of file
package com.gic.haoban.manage.api.enums.contact;
import java.util.Objects;
public enum ContactBizTypeEnum {
// 业务类型 1潜客(0001)2机会人群(0010)
POTENTIAL_CUSTOMER("10",1,"潜客"),
OPPORTUNITY_CUSTOMER("20",2,"机会人群");
private final String codePre;
private final int type;
private final String description;
public String getCodePre() {
return codePre;
}
public int getType() {
return type;
}
public String getDescription() {
return description;
}
public Long getEsClerkContactTime(Long contactTime) {
if (Objects.equals(contactTime, -1L)) {
return null;
}
return Long.parseLong(this.getCodePre() + contactTime);
}
ContactBizTypeEnum(String codePre, int type, String description) {
this.codePre = codePre;
this.type = type;
this.description = description;
}
public static ContactBizTypeEnum fromCode(String code) {
for (ContactBizTypeEnum type : values()) {
if (Objects.equals(type.codePre,code)) {
return type;
}
}
return ContactBizTypeEnum.POTENTIAL_CUSTOMER;
}
public static ContactBizTypeEnum fromType(int type) {
for (ContactBizTypeEnum bizTypeEnum : values()) {
if (bizTypeEnum.type == type) {
return bizTypeEnum;
}
}
return ContactBizTypeEnum.POTENTIAL_CUSTOMER;
}
}
\ No newline at end of file
package com.gic.haoban.manage.api.qdto.contact; package com.gic.haoban.manage.api.qdto.contact;
import com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -25,6 +27,22 @@ public class ContactFollowBatchQDTO implements Serializable { ...@@ -25,6 +27,22 @@ public class ContactFollowBatchQDTO implements Serializable {
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum * @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/ */
private Integer followType; private Integer followType;
/**
* 业务id(建联日志id)
*/
private String bizId;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer bizType = ContactBizTypeEnum.POTENTIAL_CUSTOMER.getType();
/**
* 来源类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer sourceType;
/** /**
* 跟进记录 * 跟进记录
*/ */
...@@ -67,6 +85,30 @@ public class ContactFollowBatchQDTO implements Serializable { ...@@ -67,6 +85,30 @@ public class ContactFollowBatchQDTO implements Serializable {
this.followType = followType; this.followType = followType;
} }
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 Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public String getFollowRemark() { public String getFollowRemark() {
return followRemark; return followRemark;
} }
......
package com.gic.haoban.manage.api.qdto.contact; package com.gic.haoban.manage.api.qdto.contact;
import com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -23,6 +25,24 @@ public class ContactFollowQDTO implements Serializable { ...@@ -23,6 +25,24 @@ public class ContactFollowQDTO implements Serializable {
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum * @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/ */
private Integer followType; private Integer followType;
/**
* 业务id(建联日志id)
*/
private String bizId;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer bizType = ContactBizTypeEnum.POTENTIAL_CUSTOMER.getType();
/**
* 来源类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer sourceType;
/** /**
* 跟进记录 * 跟进记录
*/ */
...@@ -76,6 +96,30 @@ public class ContactFollowQDTO implements Serializable { ...@@ -76,6 +96,30 @@ public class ContactFollowQDTO implements Serializable {
this.followType = followType; this.followType = followType;
} }
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 Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public String getFollowRemark() { public String getFollowRemark() {
return followRemark; return followRemark;
} }
......
...@@ -17,6 +17,12 @@ public class ContactLogCheckQDTO implements Serializable { ...@@ -17,6 +17,12 @@ public class ContactLogCheckQDTO implements Serializable {
*/ */
private String enterpriseId; private String enterpriseId;
/**
* 业务类型 1潜客(0001)2机会人群(0010)null为都校验
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer bizType;
public String getMemberId() { public String getMemberId() {
return memberId; return memberId;
} }
...@@ -40,4 +46,12 @@ public class ContactLogCheckQDTO implements Serializable { ...@@ -40,4 +46,12 @@ public class ContactLogCheckQDTO implements Serializable {
public void setEnterpriseId(String enterpriseId) { public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId; this.enterpriseId = enterpriseId;
} }
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
} }
\ No newline at end of file
package com.gic.haoban.manage.api.qdto.contact; package com.gic.haoban.manage.api.qdto.contact;
import com.gic.haoban.manage.api.enums.contact.ContactAutoTypeEnum; import com.gic.haoban.manage.api.enums.contact.ContactAutoTypeEnum;
import com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum;
import com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
public class ContactLogQDTO implements Serializable { public class ContactLogQDTO implements Serializable {
private static final long serialVersionUID = 973688857967269973L; private static final long serialVersionUID = 973688857967269973L;
...@@ -24,11 +27,42 @@ public class ContactLogQDTO implements Serializable { ...@@ -24,11 +27,42 @@ public class ContactLogQDTO implements Serializable {
private String enterpriseId; private String enterpriseId;
/** /**
* 跟进类型 1私人电话 2企微会话 3发送商品 4企微群发 5标记建联 6自动建联 7营销素材
* @see com.gic.haoban.manage.api.enums.contact.ContactFollowTypeEnum
*/
private Integer followType = ContactFollowTypeEnum.CONTACT.getCode();
/**
* 跟进记录
*/
private String followRemark;
/**
* 跟进上传素材,数组格式
*/
private List<String> followMaterialList;
/**
* 自动建联类型 * 自动建联类型
* @see ContactAutoTypeEnum * @see ContactAutoTypeEnum
*/ */
private Integer contactAutoType; private Integer contactAutoType;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer bizType = ContactBizTypeEnum.POTENTIAL_CUSTOMER.getType();
/**
* 来源类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer sourceType;
/**
* 来源建联id
*/
private Long sourceLogId;
public ContactLogQDTO() { public ContactLogQDTO() {
} }
...@@ -72,6 +106,30 @@ public class ContactLogQDTO implements Serializable { ...@@ -72,6 +106,30 @@ public class ContactLogQDTO implements Serializable {
this.enterpriseId = enterpriseId; this.enterpriseId = enterpriseId;
} }
public Integer getFollowType() {
return followType;
}
public void setFollowType(Integer followType) {
this.followType = followType;
}
public String getFollowRemark() {
return followRemark;
}
public void setFollowRemark(String followRemark) {
this.followRemark = followRemark;
}
public List<String> getFollowMaterialList() {
return followMaterialList;
}
public void setFollowMaterialList(List<String> followMaterialList) {
this.followMaterialList = followMaterialList;
}
public Integer getContactAutoType() { public Integer getContactAutoType() {
return contactAutoType; return contactAutoType;
} }
...@@ -79,4 +137,28 @@ public class ContactLogQDTO implements Serializable { ...@@ -79,4 +137,28 @@ public class ContactLogQDTO implements Serializable {
public void setContactAutoType(Integer contactAutoType) { public void setContactAutoType(Integer contactAutoType) {
this.contactAutoType = contactAutoType; this.contactAutoType = contactAutoType;
} }
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public Long getSourceLogId() {
return sourceLogId;
}
public void setSourceLogId(Long sourceLogId) {
this.sourceLogId = sourceLogId;
}
} }
\ No newline at end of file
package com.gic.haoban.manage.api.qdto.contact; package com.gic.haoban.manage.api.qdto.contact;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -43,6 +44,12 @@ public class ContactOrderSearchQDTO implements Serializable { ...@@ -43,6 +44,12 @@ public class ContactOrderSearchQDTO implements Serializable {
*/ */
private Date endTime; private Date endTime;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer bizType = ContactBizTypeEnum.POTENTIAL_CUSTOMER.getType();
public String getMemberId() { public String getMemberId() {
return memberId; return memberId;
} }
...@@ -102,4 +109,12 @@ public class ContactOrderSearchQDTO implements Serializable { ...@@ -102,4 +109,12 @@ public class ContactOrderSearchQDTO implements Serializable {
this.endTime = DateUtil.endOfDay(endTime); this.endTime = DateUtil.endOfDay(endTime);
} }
} }
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
} }
\ No newline at end of file
...@@ -5,6 +5,8 @@ import com.gic.haoban.manage.api.dto.contact.ContactLogDTO; ...@@ -5,6 +5,8 @@ import com.gic.haoban.manage.api.dto.contact.ContactLogDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactLogCheckQDTO; import com.gic.haoban.manage.api.qdto.contact.ContactLogCheckQDTO;
import com.gic.haoban.manage.api.qdto.contact.ContactLogQDTO; import com.gic.haoban.manage.api.qdto.contact.ContactLogQDTO;
import java.util.List;
public interface ContactLogApiService { public interface ContactLogApiService {
/** /**
...@@ -12,9 +14,17 @@ public interface ContactLogApiService { ...@@ -12,9 +14,17 @@ public interface ContactLogApiService {
* @param memberId * @param memberId
* @return * @return
*/ */
@Deprecated
ServiceResponse<ContactLogDTO> getClerkContactTime(String memberId); ServiceResponse<ContactLogDTO> getClerkContactTime(String memberId);
/** /**
* 获取每个业务最近一条有效建联记录
* @param memberId
* @return
*/
ServiceResponse<List<ContactLogDTO>> getClerkContactTimeList(String memberId);
/**
* 保存建联记录 * 保存建联记录
* @param qdto * @param qdto
* @return * @return
......
...@@ -93,6 +93,12 @@ ...@@ -93,6 +93,12 @@
<dependency> <dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>haoban-app-performance-api</artifactId>
<version>${haoban-app-performance-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-enterprise-api</artifactId> <artifactId>gic-enterprise-api</artifactId>
<version>${gic-enterprise-api}</version> <version>${gic-enterprise-api}</version>
<exclusions> <exclusions>
......
...@@ -5,6 +5,7 @@ import com.gic.haoban.manage.api.qdto.contact.ContactFollowSearchQDTO; ...@@ -5,6 +5,7 @@ import com.gic.haoban.manage.api.qdto.contact.ContactFollowSearchQDTO;
import com.gic.haoban.manage.service.entity.contact.TabContactFollow; import com.gic.haoban.manage.service.entity.contact.TabContactFollow;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -50,6 +51,21 @@ public interface TabContactFollowMapper { ...@@ -50,6 +51,21 @@ public interface TabContactFollowMapper {
List<TabContactFollow> queryByIds(@Param("followIds") List<Long> followIds); List<TabContactFollow> queryByIds(@Param("followIds") List<Long> followIds);
/** /**
* 获取时间段内跟进类型
* @param enterpriseId
* @param clerkId
* @param memberId
* @param beginTime
* @param endTime
* @return
*/
String getFollowTypes(@Param("enterpriseId") String enterpriseId,
@Param("clerkId") String clerkId,
@Param("memberId") String memberId,
@Param("beginTime") Date beginTime,
@Param("endTime") Date endTime);
/**
* 统计总行数 * 统计总行数
* *
* @param tabContactFollow 查询条件 * @param tabContactFollow 查询条件
......
...@@ -35,7 +35,7 @@ public interface TabContactLogMapper { ...@@ -35,7 +35,7 @@ public interface TabContactLogMapper {
* @param clerkId * @param clerkId
* @return * @return
*/ */
TabContactLog queryLastLog(@Param("memberId")String memberId, @Param("clerkId")String clerkId, @Param("beginTime")Date beginTime, @Param("endTime")Date endTime); List<TabContactLog> queryLastLog(@Param("memberId")String memberId, @Param("clerkId")String clerkId, @Param("beginTime")Date beginTime, @Param("endTime")Date endTime);
/** /**
* 统计总行数 * 统计总行数
......
...@@ -48,6 +48,22 @@ public class TabContactFollow implements Serializable { ...@@ -48,6 +48,22 @@ public class TabContactFollow implements Serializable {
* 跟进时间 * 跟进时间
*/ */
private Date followTime; private Date followTime;
/**
* 来源类型 1潜客(0001)2机会人群(0010)
*/
private Integer sourceType;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
*/
private Integer bizType;
/**
* 业务id(建联日志id)
*/
private String bizId;
/** /**
* 企业id * 企业id
*/ */
...@@ -137,6 +153,30 @@ public class TabContactFollow implements Serializable { ...@@ -137,6 +153,30 @@ public class TabContactFollow implements Serializable {
this.followTime = followTime; this.followTime = followTime;
} }
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public String getBizId() {
return bizId;
}
public void setBizId(String bizId) {
this.bizId = bizId;
}
public String getEnterpriseId() { public String getEnterpriseId() {
return enterpriseId; return enterpriseId;
} }
......
...@@ -59,6 +59,31 @@ public class TabContactLog implements Serializable { ...@@ -59,6 +59,31 @@ public class TabContactLog implements Serializable {
* 成为潜客时间 * 成为潜客时间
*/ */
private Date potentialTime; private Date potentialTime;
/**
* 来源日志id
*/
private Long sourceLogId;
/**
* 来源类型 1潜客(0001)2机会人群(0010)
*/
private Integer sourceType;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
*/
private Integer bizType;
/**
* 业务冗余数据
*/
private String bizData;
/**
* 跟进记录组
*/
private String followTypes;
/** /**
* 企业id * 企业id
*/ */
...@@ -172,6 +197,46 @@ public class TabContactLog implements Serializable { ...@@ -172,6 +197,46 @@ public class TabContactLog implements Serializable {
this.potentialTime = potentialTime; this.potentialTime = potentialTime;
} }
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public Long getSourceLogId() {
return sourceLogId;
}
public void setSourceLogId(Long sourceLogId) {
this.sourceLogId = sourceLogId;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public String getBizData() {
return bizData;
}
public void setBizData(String bizData) {
this.bizData = bizData;
}
public String getFollowTypes() {
return followTypes;
}
public void setFollowTypes(String followTypes) {
this.followTypes = followTypes;
}
public String getEnterpriseId() { public String getEnterpriseId() {
return enterpriseId; return enterpriseId;
} }
......
...@@ -88,6 +88,15 @@ public class TabContactOrder implements Serializable { ...@@ -88,6 +88,15 @@ public class TabContactOrder implements Serializable {
*/ */
private Integer potentialScore; private Integer potentialScore;
/** /**
* 来源类型 1潜客(0001)2机会人群(0010)
*/
private Integer sourceType;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
*/
private Integer bizType;
/**
* 是否删除 * 是否删除
*/ */
private Integer deleteFlag; private Integer deleteFlag;
...@@ -256,6 +265,22 @@ public class TabContactOrder implements Serializable { ...@@ -256,6 +265,22 @@ public class TabContactOrder implements Serializable {
this.potentialScore = potentialScore; this.potentialScore = potentialScore;
} }
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public Integer getDeleteFlag() { public Integer getDeleteFlag() {
return deleteFlag; return deleteFlag;
} }
......
...@@ -6,6 +6,8 @@ import com.gic.haoban.manage.api.qdto.contact.ContactLogQDTO; ...@@ -6,6 +6,8 @@ import com.gic.haoban.manage.api.qdto.contact.ContactLogQDTO;
import com.gic.haoban.manage.service.entity.contact.TabContactLog; import com.gic.haoban.manage.service.entity.contact.TabContactLog;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Map;
public interface ContactLogService { public interface ContactLogService {
...@@ -16,14 +18,14 @@ public interface ContactLogService { ...@@ -16,14 +18,14 @@ public interface ContactLogService {
* @param clerkDTO * @param clerkDTO
* @return * @return
*/ */
boolean contactCheck(String enterpriseId, String memberId, ClerkDTO clerkDTO) ; boolean contactCheck(String enterpriseId, String memberId, ClerkDTO clerkDTO,Integer bizType) ;
/** /**
* 保存建联记录 * 保存建联记录
* *
* @param qdto * @param qdto
*/ */
TabContactLog saveContactLog(ContactLogQDTO qdto) throws BusinessException; void saveContactLog(ContactLogQDTO qdto) throws BusinessException;
/** /**
* 自动建联 * 自动建联
...@@ -32,12 +34,18 @@ public interface ContactLogService { ...@@ -32,12 +34,18 @@ public interface ContactLogService {
void autoContactLog(ContactLogQDTO qdto); void autoContactLog(ContactLogQDTO qdto);
/** /**
* 同步建联
* @param qdto
*/
void syncContactLog(ContactLogQDTO qdto);
/**
* 清除建联状态 * 清除建联状态
* *
* @param memberId * @param memberId
* @param clearType 1 消费清除 2 换绑主导购 * @param clearType 1 消费清除 2 换绑主导购
*/ */
void clearContactLog(String memberId, Integer clearType,String clerkId); void clearContactLog(String enterpriseId,String memberId, Integer clearType,String clerkId);
/** /**
* 获取最近一条有效建联记录 * 获取最近一条有效建联记录
...@@ -48,10 +56,19 @@ public interface ContactLogService { ...@@ -48,10 +56,19 @@ public interface ContactLogService {
TabContactLog getClerkContactTime(String memberId); TabContactLog getClerkContactTime(String memberId);
/** /**
* 根据时间获取最近一条建联记录 * 获取每个业务最近一条有效建联记录
* @param memberId
* @return
*/
List<TabContactLog> getClerkContactTimeList(String memberId);
/**
* 获取最近一条建联记录
* @param memberId * @param memberId
* @param clerkId
* @param beginTime * @param beginTime
* @param endTime
* @return * @return
*/ */
TabContactLog getLastByTime(String memberId, Date beginTime,Date endTime); Map<Integer,TabContactLog> getLastByTime(String memberId, String clerkId, Date beginTime, Date endTime);
} }
...@@ -103,7 +103,7 @@ public class ContactFollowServiceImpl implements ContactFollowService { ...@@ -103,7 +103,7 @@ public class ContactFollowServiceImpl implements ContactFollowService {
autoContactSend(followList); autoContactSend(followList);
} }
private static void autoContactSend(List<TabContactFollow> followList) { private void autoContactSend(List<TabContactFollow> followList) {
// 自动建联 // 自动建联
Integer followType = followList.get(0).getFollowType(); Integer followType = followList.get(0).getFollowType();
Integer contactAutoType = ContactFollowTypeEnum.fromCode(followType).getContactAutoType(); Integer contactAutoType = ContactFollowTypeEnum.fromCode(followType).getContactAutoType();
...@@ -114,6 +114,8 @@ public class ContactFollowServiceImpl implements ContactFollowService { ...@@ -114,6 +114,8 @@ public class ContactFollowServiceImpl implements ContactFollowService {
contactLogQDTO.setClerkId(x.getClerkId()); contactLogQDTO.setClerkId(x.getClerkId());
contactLogQDTO.setEnterpriseId(x.getEnterpriseId()); contactLogQDTO.setEnterpriseId(x.getEnterpriseId());
contactLogQDTO.setContactAutoType(contactAutoType); contactLogQDTO.setContactAutoType(contactAutoType);
contactLogQDTO.setBizType(x.getSourceType());
contactLogQDTO.setSourceType(x.getSourceType());
return JSON.toJSONString(contactLogQDTO); return JSON.toJSONString(contactLogQDTO);
}).collect(Collectors.toList()); }).collect(Collectors.toList());
String routerName = "autoContactLogForMQ"; String routerName = "autoContactLogForMQ";
......
...@@ -91,44 +91,53 @@ public class ContactOrderServiceImpl implements ContactOrderService { ...@@ -91,44 +91,53 @@ public class ContactOrderServiceImpl implements ContactOrderService {
contactBeginTime = DateUtil.offsetDay(receiptsDate, -1); contactBeginTime = DateUtil.offsetDay(receiptsDate, -1);
} }
TabContactLog lastContactLog = contactLogService.getLastByTime(memberId, contactBeginTime,receiptsDate); Map<Integer, TabContactLog> contactMap = contactLogService.getLastByTime(memberId, null, contactBeginTime, receiptsDate);
if (lastContactLog == null) { if (contactMap == null || contactMap.isEmpty()) {
return false; return false;
} }
logger.info("建联转化订单建联信息:{}", JSON.toJSONString(lastContactLog)); for (Map.Entry<Integer, TabContactLog> entry : contactMap.entrySet()) {
TabContactOrder contactOrder = new TabContactOrder(); Integer key = entry.getKey();
contactOrder.setOrderId(orderId); TabContactLog lastContactLog = entry.getValue();
contactOrder.setMemberId(memberId); if (lastContactLog == null) {
contactOrder.setOrderNumber(orderInfoResp.getOrderNo()); continue;
Double paidAmount = orderInfoResp.getPayAmount(); }
if (Objects.equals(PlatformChannelEnum.C_WECHAT_MINI.getChannelCode(), channelCode)) { logger.info("建联转化订单建联信息:{}", JSON.toJSONString(lastContactLog));
paidAmount = paidAmount + (Objects.isNull(orderInfoResp.getDeliveryPaymentAmount()) ? 0.0 : orderInfoResp.getDeliveryPaymentAmount()); TabContactOrder contactOrder = new TabContactOrder();
} contactOrder.setOrderId(orderId);
contactOrder.setPaidAmount(paidAmount); contactOrder.setMemberId(memberId);
contactOrder.setProductCount(orderInfoResp.getGoodsCount()); contactOrder.setOrderNumber(orderInfoResp.getOrderNo());
contactOrder.setPayTime(orderInfoResp.getReceiptsDate()); Double paidAmount = orderInfoResp.getPayAmount();
contactOrder.setReceiptsDate(orderInfoResp.getReceiptsDate()); if (Objects.equals(PlatformChannelEnum.C_WECHAT_MINI.getChannelCode(), channelCode)) {
List<OrderItemResp> orderItems = orderInfoResp.getOrderItems(); paidAmount = paidAmount + (Objects.isNull(orderInfoResp.getDeliveryPaymentAmount()) ? 0.0 : orderInfoResp.getDeliveryPaymentAmount());
if (CollectionUtils.isNotEmpty(orderItems)) { }
List<ContactOrderGoodsInfoDTO> goodsInfoDTOS = JSONObject.parseArray(JSON.toJSONString(orderItems), ContactOrderGoodsInfoDTO.class); contactOrder.setPaidAmount(paidAmount);
contactOrder.setGoodsInfo(JSON.toJSONString(goodsInfoDTOS)); contactOrder.setProductCount(orderInfoResp.getGoodsCount());
} contactOrder.setPayTime(orderInfoResp.getReceiptsDate());
contactOrder.setChannelCode(channelCode); contactOrder.setReceiptsDate(orderInfoResp.getReceiptsDate());
contactOrder.setChannelType(channelType); List<OrderItemResp> orderItems = orderInfoResp.getOrderItems();
contactOrder.setClerkId(lastContactLog.getClerkId()); if (CollectionUtils.isNotEmpty(orderItems)) {
contactOrder.setClerkCode(lastContactLog.getClerkCode()); List<ContactOrderGoodsInfoDTO> goodsInfoDTOS = JSONObject.parseArray(JSON.toJSONString(orderItems), ContactOrderGoodsInfoDTO.class);
contactOrder.setClerkName(lastContactLog.getClerkName()); contactOrder.setGoodsInfo(JSON.toJSONString(goodsInfoDTOS));
contactOrder.setStoreId(lastContactLog.getStoreId()); }
contactOrder.setContactLogId(lastContactLog.getLogId()); contactOrder.setChannelCode(channelCode);
contactOrder.setContactTime(lastContactLog.getContactTime()); contactOrder.setChannelType(channelType);
contactOrder.setPotentialTime(lastContactLog.getPotentialTime()); contactOrder.setClerkId(lastContactLog.getClerkId());
contactOrder.setEnterpriseId(lastContactLog.getEnterpriseId()); contactOrder.setClerkCode(lastContactLog.getClerkCode());
contactOrder.setClerkName(lastContactLog.getClerkName());
contactOrder.setStoreId(lastContactLog.getStoreId());
contactOrder.setContactLogId(lastContactLog.getLogId());
contactOrder.setContactTime(lastContactLog.getContactTime());
contactOrder.setPotentialTime(lastContactLog.getPotentialTime());
contactOrder.setSourceType(lastContactLog.getSourceType());
contactOrder.setBizType(lastContactLog.getBizType());
contactOrder.setEnterpriseId(lastContactLog.getEnterpriseId());
JSONObject jsonObject = esMemberInfoService.queryDataSingle(enterpriseId, memberId, "potentialScore"); JSONObject jsonObject = esMemberInfoService.queryDataSingle(enterpriseId, memberId, "potentialScore");
if (jsonObject != null && jsonObject.getInteger("potentialScore") != null) { if (jsonObject != null && jsonObject.getInteger("potentialScore") != null) {
contactOrder.setPotentialScore(jsonObject.getInteger("potentialScore")); contactOrder.setPotentialScore(jsonObject.getInteger("potentialScore"));
}
contactOrderMapper.insert(contactOrder);
} }
contactOrderMapper.insert(contactOrder);
return true; return true;
} }
......
...@@ -6,6 +6,7 @@ import com.gic.enterprise.api.constant.EnterpriseServiceEnum; ...@@ -6,6 +6,7 @@ import com.gic.enterprise.api.constant.EnterpriseServiceEnum;
import com.gic.enterprise.api.dto.EnterpriseUsingPermissionDto; import com.gic.enterprise.api.dto.EnterpriseUsingPermissionDto;
import com.gic.enterprise.api.dto.enterprise.EnterpriseUsingStatusDTO; import com.gic.enterprise.api.dto.enterprise.EnterpriseUsingStatusDTO;
import com.gic.enterprise.api.service.EnterpriseUseForbidService; import com.gic.enterprise.api.service.EnterpriseUseForbidService;
import com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -134,6 +135,17 @@ public class EnterpriseAdaptor { ...@@ -134,6 +135,17 @@ public class EnterpriseAdaptor {
return StringUtils.equals(cache, "1"); return StringUtils.equals(cache, "1");
} }
public boolean checkEnterpriseHasRightByContactBizType(String enterpriseId,Integer contactBizType) {
if (Objects.equals(contactBizType, ContactBizTypeEnum.POTENTIAL_CUSTOMER.getType())) {
return checkEnterpriseHasRights(enterpriseId,Lists.newArrayList(EnterpriseServiceEnum.POTENTIAL.getRightMenuCode()));
} else if (Objects.equals(contactBizType, ContactBizTypeEnum.OPPORTUNITY_CUSTOMER.getType())) {
return checkEnterpriseHasRights(enterpriseId,Lists.newArrayList(EnterpriseServiceEnum.OBJECTIVES.getRightMenuCode()));
} else {
return checkEnterpriseHasRights(enterpriseId, Lists.newArrayList(EnterpriseServiceEnum.POTENTIAL.getRightMenuCode()))
|| checkEnterpriseHasRights(enterpriseId, Lists.newArrayList(EnterpriseServiceEnum.OBJECTIVES.getRightMenuCode()));
}
}
public boolean checkEnterpriseHasRight(String enterpriseId,String rightMenuCode) { public boolean checkEnterpriseHasRight(String enterpriseId,String rightMenuCode) {
return checkEnterpriseHasRights(enterpriseId,Lists.newArrayList(rightMenuCode)); return checkEnterpriseHasRights(enterpriseId,Lists.newArrayList(rightMenuCode));
} }
......
...@@ -31,12 +31,13 @@ public class RouterApiServiceImpl implements RouterApiService { ...@@ -31,12 +31,13 @@ public class RouterApiServiceImpl implements RouterApiService {
return ServiceResponse.success(); return ServiceResponse.success();
} }
ClerkAddEventParam clerkAddEventParam = JSONObject.parseObject(params, ClerkAddEventParam.class); ClerkAddEventParam clerkAddEventParam = JSONObject.parseObject(params, ClerkAddEventParam.class);
String enterpriseId = clerkAddEventParam.getEnterpriseId();
String memberId = clerkAddEventParam.getMemberId(); String memberId = clerkAddEventParam.getMemberId();
Integer changeType = clerkAddEventParam.getChangeType(); Integer changeType = clerkAddEventParam.getChangeType();
String clerkId = clerkAddEventParam.getClerkId(); String clerkId = clerkAddEventParam.getClerkId();
if (Objects.equals(changeType, 1)) { if (Objects.equals(changeType, 1)) {
// 换绑主导购清除建联状态 // 换绑主导购清除建联状态
contactLogService.clearContactLog(memberId, 2, clerkId); contactLogService.clearContactLog(enterpriseId,memberId, 2, clerkId);
} }
return ServiceResponse.success(); return ServiceResponse.success();
} }
......
...@@ -16,6 +16,9 @@ import org.apache.commons.lang3.StringUtils; ...@@ -16,6 +16,9 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by wangzubo on 2022/11/1. * Created by wangzubo on 2022/11/1.
*/ */
...@@ -35,6 +38,16 @@ public class ContactLogApiServiceImpl implements ContactLogApiService { ...@@ -35,6 +38,16 @@ public class ContactLogApiServiceImpl implements ContactLogApiService {
} }
@Override @Override
public ServiceResponse<List<ContactLogDTO>> getClerkContactTimeList(String memberId) {
List<TabContactLog> list = contactLogService.getClerkContactTimeList(memberId);
if (list == null) {
return ServiceResponse.success(new ArrayList<>());
}
List<ContactLogDTO> dtos = EntityUtil.changeEntityListNew(ContactLogDTO.class, list);
return ServiceResponse.success(dtos);
}
@Override
public ServiceResponse<Void> saveContactLog(ContactLogQDTO qdto) { public ServiceResponse<Void> saveContactLog(ContactLogQDTO qdto) {
try { try {
contactLogService.saveContactLog(qdto); contactLogService.saveContactLog(qdto);
...@@ -50,7 +63,12 @@ public class ContactLogApiServiceImpl implements ContactLogApiService { ...@@ -50,7 +63,12 @@ public class ContactLogApiServiceImpl implements ContactLogApiService {
return ServiceResponse.success(); return ServiceResponse.success();
} }
ContactLogQDTO contactLogQDTO = JSONObject.parseObject(message, ContactLogQDTO.class); ContactLogQDTO contactLogQDTO = JSONObject.parseObject(message, ContactLogQDTO.class);
contactLogService.autoContactLog(contactLogQDTO); Integer contactAutoType = contactLogQDTO.getContactAutoType();
if (contactAutoType != null) {
contactLogService.autoContactLog(contactLogQDTO);
}else {
contactLogService.syncContactLog(contactLogQDTO);
}
return ServiceResponse.success(); return ServiceResponse.success();
} }
...@@ -60,7 +78,7 @@ public class ContactLogApiServiceImpl implements ContactLogApiService { ...@@ -60,7 +78,7 @@ public class ContactLogApiServiceImpl implements ContactLogApiService {
if (clerkDTO == null) { if (clerkDTO == null) {
return ServiceResponse.success(Boolean.FALSE); return ServiceResponse.success(Boolean.FALSE);
} }
boolean check = contactLogService.contactCheck(checkQDTO.getEnterpriseId(), checkQDTO.getMemberId(), clerkDTO); boolean check = contactLogService.contactCheck(checkQDTO.getEnterpriseId(), checkQDTO.getMemberId(), clerkDTO,checkQDTO.getBizType());
return ServiceResponse.success(check); return ServiceResponse.success(check);
} }
} }
...@@ -41,7 +41,7 @@ public class ContactOrderApiServiceImpl implements ContactOrderApiService { ...@@ -41,7 +41,7 @@ public class ContactOrderApiServiceImpl implements ContactOrderApiService {
OrderInfoResp result = serviceResponse.getResult(); OrderInfoResp result = serviceResponse.getResult();
boolean contactOrder = contactOrderService.saveContactOrder(result); boolean contactOrder = contactOrderService.saveContactOrder(result);
if (contactOrder) { if (contactOrder) {
contactLogService.clearContactLog(memberId, 1,""); contactLogService.clearContactLog(enterpriseId,memberId, 1,"");
} }
return ServiceResponse.success(); return ServiceResponse.success();
} }
......
...@@ -180,6 +180,9 @@ ...@@ -180,6 +180,9 @@
<dubbo:reference id="customerApiService" <dubbo:reference id="customerApiService"
interface="com.gic.haoban.app.customer.service.api.service.CustomerApiService" timeout="10000" interface="com.gic.haoban.app.customer.service.api.service.CustomerApiService" timeout="10000"
retries="0" check="false"/> retries="0" check="false"/>
<dubbo:reference id="objectivesManageApiService"
interface="com.gic.haoban.app.objectives.api.service.ObjectivesManageApiService" timeout="10000"
retries="0" check="false"/>
<dubbo:reference id="qywxTagSyncApiService" <dubbo:reference id="qywxTagSyncApiService"
interface="com.gic.haoban.app.customer.service.api.service.QywxTagSyncApiService" timeout="10000" interface="com.gic.haoban.app.customer.service.api.service.QywxTagSyncApiService" timeout="10000"
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
<result column="follow_material" property="followMaterial" /> <result column="follow_material" property="followMaterial" />
<result column="goods_info" property="goodsInfo" /> <result column="goods_info" property="goodsInfo" />
<result column="follow_time" property="followTime" /> <result column="follow_time" property="followTime" />
<result column="source_type" property="sourceType" />
<result column="biz_type" property="bizType" />
<result column="biz_id" property="bizId" />
<result column="enterprise_id" property="enterpriseId" /> <result column="enterprise_id" property="enterpriseId" />
<result column="delete_flag" property="deleteFlag" /> <result column="delete_flag" property="deleteFlag" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
...@@ -21,10 +24,10 @@ ...@@ -21,10 +24,10 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
follow_id, member_id, clerk_id, clerk_code, follow_type,follow_remark, follow_material, goods_info, follow_time, enterprise_id, delete_flag, create_time, update_time follow_id, member_id, clerk_id, clerk_code, follow_type,follow_remark, follow_material, goods_info, follow_time, source_type,biz_type,biz_id,enterprise_id, delete_flag, create_time, update_time
</sql> </sql>
<sql id="Alias_Base_Column_List"> <sql id="Alias_Base_Column_List">
t.follow_id, t.member_id, t.clerk_id, t.clerk_code, t.follow_type,t.follow_remark, t.follow_material, t.goods_info, t.follow_time, t.enterprise_id, t.delete_flag, t.create_time, t.update_time t.follow_id, t.member_id, t.clerk_id, t.clerk_code, t.follow_type,t.follow_remark, t.follow_material, t.goods_info, t.follow_time,t.source_type,t.biz_type,t.biz_id, t.enterprise_id, t.delete_flag, t.create_time, t.update_time
</sql> </sql>
<select id="queryById" resultMap="BaseResultMap"> <select id="queryById" resultMap="BaseResultMap">
...@@ -44,6 +47,29 @@ ...@@ -44,6 +47,29 @@
</foreach> </foreach>
</select> </select>
<select id="getFollowTypes" resultType="java.lang.String">
SELECT
GROUP_CONCAT(DISTINCT follow_type)
FROM tab_contact_follow
<where>
enterprise_id = #{enterpriseId}
AND follow_type not in (5,6)
<if test="memberId != null">
AND member_id = #{memberId}
</if>
<if test="clerkId != null">
AND clerk_id = #{clerkId}
</if>
<if test="beginTime != null">
AND follow_time > #{beginTime}
</if>
<if test="endTime != null">
AND follow_time <![CDATA[<=]]> #{endTime}
</if>
</where>
group by member_id
</select>
<select id="count" resultType="long"> <select id="count" resultType="long">
SELECT COUNT(*) SELECT COUNT(*)
FROM tab_contact_follow FROM tab_contact_follow
...@@ -109,16 +135,27 @@ ...@@ -109,16 +135,27 @@
</select> </select>
<insert id="insert" useGeneratedKeys="true" keyProperty="followId"> <insert id="insert" useGeneratedKeys="true" keyProperty="followId">
INSERT INTO tab_contact_follow (member_id, clerk_id, clerk_code,follow_type, follow_remark, follow_material, goods_info, follow_time, enterprise_id, delete_flag, create_time, update_time) INSERT INTO tab_contact_follow (member_id, clerk_id, clerk_code,follow_type, follow_remark, follow_material, goods_info, follow_time, source_type,biz_type,biz_id,enterprise_id, delete_flag, create_time, update_time)
VALUES (#{memberId}, #{clerkId}, #{clerkCode},#{followType}, #{followRemark}, #{followMaterial}, #{goodsInfo}, #{followTime}, #{enterpriseId}, #{deleteFlag}, #{createTime}, #{updateTime}) VALUES (#{memberId}, #{clerkId}, #{clerkCode},#{followType}, #{followRemark}, #{followMaterial}, #{goodsInfo}, #{followTime},#{sourceType},#{bizType},#{bizId}, #{enterpriseId}, #{deleteFlag}, #{createTime}, #{updateTime})
</insert> </insert>
<insert id="insertBatch"> <insert id="insertBatch">
INSERT INTO tab_contact_follow (follow_id,member_id, clerk_id, clerk_code,follow_type, follow_remark, follow_material, goods_info, follow_time, enterprise_id) INSERT INTO tab_contact_follow (
follow_id, member_id, clerk_id, clerk_code,
follow_type, follow_remark, follow_material,
goods_info, follow_time, source_type, biz_type, biz_id, enterprise_id
)
VALUES VALUES
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.followId},#{item.memberId}, #{item.clerkId}, #{item.clerkCode}, #{item.followType},#{item.followRemark}, #{item.followMaterial}, #{item.goodsInfo}, #{item.followTime}, #{item.enterpriseId}) (#{item.followId}, #{item.memberId}, #{item.clerkId}, #{item.clerkCode},
#{item.followType}, #{item.followRemark}, #{item.followMaterial},
#{item.goodsInfo}, #{item.followTime}, #{sourceType}, #{bizType}, #{bizId}, #{item.enterpriseId})
</foreach> </foreach>
ON DUPLICATE KEY UPDATE
biz_type = CASE
WHEN VALUES(biz_id) IS NOT NULL THEN biz_type + VALUES(biz_type)
ELSE biz_type
END
</insert> </insert>
<update id="update"> <update id="update">
...@@ -132,6 +169,9 @@ ...@@ -132,6 +169,9 @@
<if test="followMaterial != null">follow_material = #{followMaterial},</if> <if test="followMaterial != null">follow_material = #{followMaterial},</if>
<if test="goodsInfo != null">goods_info = #{goodsInfo},</if> <if test="goodsInfo != null">goods_info = #{goodsInfo},</if>
<if test="followTime != null">follow_time = #{followTime},</if> <if test="followTime != null">follow_time = #{followTime},</if>
<if test="bizType != null">biz_type = #{bizType},</if>
<if test="bizId != null">biz_id = #{bizId},</if>
<if test="source_type != null">source_type = #{sourceType},</if>
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if> <if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
<if test="deleteFlag != null">delete_flag = #{deleteFlag},</if> <if test="deleteFlag != null">delete_flag = #{deleteFlag},</if>
update_time = #{updateTime} update_time = #{updateTime}
......
...@@ -14,6 +14,11 @@ ...@@ -14,6 +14,11 @@
<result property="contactCycle" column="contact_cycle" jdbcType="INTEGER"/> <result property="contactCycle" column="contact_cycle" jdbcType="INTEGER"/>
<result property="contactCycleFirst" column="contact_cycle_first" jdbcType="INTEGER"/> <result property="contactCycleFirst" column="contact_cycle_first" jdbcType="INTEGER"/>
<result property="potentialTime" column="potential_time" jdbcType="TIMESTAMP"/> <result property="potentialTime" column="potential_time" jdbcType="TIMESTAMP"/>
<result property="sourceType" column="source_type" jdbcType="INTEGER"/>
<result property="sourceLogId" column="source_log_id" jdbcType="BIGINT"/>
<result property="bizType" column="biz_type" jdbcType="INTEGER" />
<result property="bizData" column="biz_data" jdbcType="VARCHAR" />
<result property="followTypes" column="follow_types" jdbcType="VARCHAR" />
<result property="enterpriseId" column="enterprise_id" jdbcType="VARCHAR"/> <result property="enterpriseId" column="enterprise_id" jdbcType="VARCHAR"/>
<result property="deleteFlag" column="delete_flag" jdbcType="INTEGER"/> <result property="deleteFlag" column="delete_flag" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
...@@ -39,19 +44,41 @@ ...@@ -39,19 +44,41 @@
</select> </select>
<select id="queryLastLog" resultMap="TabContactLogMap"> <select id="queryLastLog" resultMap="TabContactLogMap">
select * SELECT t1.*
from tab_contact_log FROM tab_contact_log t1
where delete_flag = 0 and member_id = #{memberId} INNER JOIN (
SELECT biz_type, MAX(contact_time) AS max_contact_time
FROM tab_contact_log
WHERE delete_flag = 0
<if test="memberId != null">
AND member_id = #{memberId}
</if>
<if test="clerkId!=null and clerkId!=''"> <if test="clerkId!=null and clerkId!=''">
and clerk_id = #{clerkId} AND clerk_id = #{clerkId}
</if>
<if test="beginTime != null">
AND contact_time >= #{beginTime}
</if> </if>
<if test="beginTime!=null "> <if test="endTime != null">
and contact_time >= #{beginTime} AND contact_time <![CDATA[<=]]> #{endTime}
</if>
GROUP BY biz_type
) t2
ON t1.biz_type = t2.biz_type AND t1.contact_time = t2.max_contact_time
WHERE t1.delete_flag = 0
<if test="memberId != null">
AND t1.member_id = #{memberId}
</if>
<if test="clerkId!=null and clerkId!=''">
AND t1.clerk_id = #{clerkId}
</if> </if>
<if test="endTime!=null "> <if test="beginTime != null">
and contact_time <![CDATA[<=]]> #{endTime} AND t1.contact_time >= #{beginTime}
</if> </if>
order by contact_time desc,log_id desc limit 1 <if test="endTime != null">
AND t1.contact_time <![CDATA[<=]]> #{endTime}
</if>
ORDER BY t1.biz_type ASC,t1.contact_time desc,t1.log_id desc
</select> </select>
<!--查询列表--> <!--查询列表-->
...@@ -128,6 +155,11 @@ ...@@ -128,6 +155,11 @@
contact_cycle, contact_cycle,
contact_cycle_first, contact_cycle_first,
potential_time, potential_time,
source_type,
source_log_id,
biz_type,
biz_data,
follow_types,
enterprise_id enterprise_id
) )
values ( values (
...@@ -143,6 +175,11 @@ ...@@ -143,6 +175,11 @@
#{contactCycle}, #{contactCycle},
#{contactCycleFirst}, #{contactCycleFirst},
#{potentialTime}, #{potentialTime},
#{sourceType},
#{sourceLogId},
#{bizType},
#{bizData},
#{followTypes},
#{enterpriseId}) #{enterpriseId})
</insert> </insert>
...@@ -183,6 +220,21 @@ ...@@ -183,6 +220,21 @@
<if test="potentialTime != null"> <if test="potentialTime != null">
potential_time = #{potentialTime}, potential_time = #{potentialTime},
</if> </if>
<if test="sourceType != null">
source_type = #{sourceType},
</if>
<if test="sourceLogId != null">
source_log_id = #{sourceLogId},
</if>
<if test="bizType != null">
biz_type = #{bizType},
</if>
<if test="bizData != null">
biz_data = #{bizData},
</if>
<if test="followTypes != null">
follow_types = #{followTypes},
</if>
<if test="enterpriseId != null and enterpriseId != ''"> <if test="enterpriseId != null and enterpriseId != ''">
enterprise_id = #{enterpriseId}, enterprise_id = #{enterpriseId},
</if> </if>
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
<result column="contact_time" property="contactTime" /> <result column="contact_time" property="contactTime" />
<result column="potential_time" property="potentialTime" /> <result column="potential_time" property="potentialTime" />
<result column="potential_score" property="potentialScore" /> <result column="potential_score" property="potentialScore" />
<result column="source_type" property="sourceType" />
<result column="biz_type" property="bizType" />
<result column="delete_flag" property="deleteFlag" /> <result column="delete_flag" property="deleteFlag" />
<result column="enterprise_id" property="enterpriseId" /> <result column="enterprise_id" property="enterpriseId" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
...@@ -31,7 +33,7 @@ ...@@ -31,7 +33,7 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, order_id, member_id, order_number, paid_amount, product_count, goods_info, pay_time, receipts_date, channel_code, channel_type, clerk_id, clerk_code,clerk_name, store_id, contact_log_id, contact_time, potential_time, potential_score, delete_flag, enterprise_id, create_time, update_time id, order_id, member_id, order_number, paid_amount, product_count, goods_info, pay_time, receipts_date, channel_code, channel_type, clerk_id, clerk_code,clerk_name, store_id, contact_log_id, contact_time, potential_time, potential_score,source_type,biz_type, delete_flag, enterprise_id, create_time, update_time
</sql> </sql>
<select id="queryById" resultMap="BaseResultMap"> <select id="queryById" resultMap="BaseResultMap">
...@@ -45,7 +47,7 @@ ...@@ -45,7 +47,7 @@
SELECT SELECT
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
FROM tab_contact_order FROM tab_contact_order
WHERE order_id = #{orderId} and delete_flag = 0 WHERE order_id = #{orderId} and delete_flag = 0 limit 1
</select> </select>
<select id="queryByIds" resultMap="BaseResultMap"> <select id="queryByIds" resultMap="BaseResultMap">
...@@ -74,6 +76,9 @@ ...@@ -74,6 +76,9 @@
<if test="search.channelType != null"> <if test="search.channelType != null">
AND channel_type = #{search.channelType} AND channel_type = #{search.channelType}
</if> </if>
<if test="search.bizType != null">
AND biz_type = #{search.bizType}
</if>
<if test="search.storeIdList != null and search.storeIdList.size() > 0"> <if test="search.storeIdList != null and search.storeIdList.size() > 0">
AND store_id IN AND store_id IN
<foreach item="storeId" index="index" collection="search.storeIdList" open="(" separator="," close=")"> <foreach item="storeId" index="index" collection="search.storeIdList" open="(" separator="," close=")">
...@@ -109,8 +114,8 @@ ...@@ -109,8 +114,8 @@
</select> </select>
<insert id="insert" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO tab_contact_order (order_id, member_id, order_number, paid_amount, product_count, goods_info, pay_time, receipts_date, channel_code, channel_type, clerk_id, clerk_code,clerk_name, store_id, contact_log_id, contact_time, potential_time,potential_score, enterprise_id) INSERT INTO tab_contact_order (order_id, member_id, order_number, paid_amount, product_count, goods_info, pay_time, receipts_date, channel_code, channel_type, clerk_id, clerk_code,clerk_name, store_id, contact_log_id, contact_time, potential_time,potential_score, source_type,biz_type,enterprise_id)
VALUES (#{orderId}, #{memberId}, #{orderNumber}, #{paidAmount}, #{productCount}, #{goodsInfo}, #{payTime}, #{receiptsDate}, #{channelCode}, #{channelType}, #{clerkId}, #{clerkCode},#{clerkName}, #{storeId}, #{contactLogId}, #{contactTime}, #{potentialTime}, #{potentialScore}, #{enterpriseId}) VALUES (#{orderId}, #{memberId}, #{orderNumber}, #{paidAmount}, #{productCount}, #{goodsInfo}, #{payTime}, #{receiptsDate}, #{channelCode}, #{channelType}, #{clerkId}, #{clerkCode},#{clerkName}, #{storeId}, #{contactLogId}, #{contactTime}, #{potentialTime}, #{potentialScore}, #{sourceType},#{bizType},#{enterpriseId})
</insert> </insert>
<update id="update"> <update id="update">
...@@ -133,6 +138,8 @@ ...@@ -133,6 +138,8 @@
<if test="contactTime != null">contact_time = #{contactTime},</if> <if test="contactTime != null">contact_time = #{contactTime},</if>
<if test="potentialTime != null">potential_time = #{potentialTime},</if> <if test="potentialTime != null">potential_time = #{potentialTime},</if>
<if test="potentialScore != null">potential_score = #{potentialScore},</if> <if test="potentialScore != null">potential_score = #{potentialScore},</if>
<if test="bizType != null">biz_type = #{bizType},</if>
<if test="source_type != null">source_type = #{sourceType},</if>
<if test="deleteFlag != null">delete_flag = #{deleteFlag},</if> <if test="deleteFlag != null">delete_flag = #{deleteFlag},</if>
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if> <if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
update_time = #{updateTime} update_time = #{updateTime}
......
...@@ -102,7 +102,7 @@ public class ContactTest { ...@@ -102,7 +102,7 @@ public class ContactTest {
@Test @Test
public void clearContactLog() throws Exception { public void clearContactLog() throws Exception {
contactLogService.clearContactLog(memberId, 1,""); contactLogService.clearContactLog(eid,memberId, 1,"");
} }
@Test @Test
......
...@@ -120,6 +120,7 @@ public class ContactController { ...@@ -120,6 +120,7 @@ public class ContactController {
@RequestMapping(path = "/log") @RequestMapping(path = "/log")
public RestResponse<Void> saveLog(@RequestBody ContactLogQO contactLogQO) { public RestResponse<Void> saveLog(@RequestBody ContactLogQO contactLogQO) {
ContactLogQDTO logQDTO = EntityUtil.changeEntityNew(ContactLogQDTO.class, contactLogQO); ContactLogQDTO logQDTO = EntityUtil.changeEntityNew(ContactLogQDTO.class, contactLogQO);
logQDTO.setSourceType(contactLogQO.getBizType());
ServiceResponse<Void> serviceResponse = contactLogApiService.saveContactLog(logQDTO); ServiceResponse<Void> serviceResponse = contactLogApiService.saveContactLog(logQDTO);
if (!serviceResponse.isSuccess()) { if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage()); return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
......
...@@ -17,6 +17,12 @@ public class ContactLogCheckQO implements Serializable { ...@@ -17,6 +17,12 @@ public class ContactLogCheckQO implements Serializable {
*/ */
private String enterpriseId; private String enterpriseId;
/**
* 业务类型 1潜客(0001)2机会人群(0010)null为都校验
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer bizType;
public String getMemberId() { public String getMemberId() {
return memberId; return memberId;
} }
...@@ -40,4 +46,12 @@ public class ContactLogCheckQO implements Serializable { ...@@ -40,4 +46,12 @@ public class ContactLogCheckQO implements Serializable {
public void setEnterpriseId(String enterpriseId) { public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId; this.enterpriseId = enterpriseId;
} }
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
} }
\ No newline at end of file
package com.gic.haoban.manage.web.qo.contact; package com.gic.haoban.manage.web.qo.contact;
import com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
public class ContactLogQO implements Serializable { public class ContactLogQO implements Serializable {
private static final long serialVersionUID = 973688857967269973L; private static final long serialVersionUID = 973688857967269973L;
...@@ -21,6 +24,21 @@ public class ContactLogQO implements Serializable { ...@@ -21,6 +24,21 @@ public class ContactLogQO implements Serializable {
*/ */
private String enterpriseId; private String enterpriseId;
/**
* 业务类型 1潜客(0001)2机会人群(0010)
* @see com.gic.haoban.manage.api.enums.contact.ContactBizTypeEnum
*/
private Integer bizType = ContactBizTypeEnum.POTENTIAL_CUSTOMER.getType();
/**
* 跟进记录
*/
private String followRemark;
/**
* 跟进上传素材,数组格式
*/
private List<String> followMaterialList;
public String getMemberId() { public String getMemberId() {
return memberId; return memberId;
} }
...@@ -52,4 +70,28 @@ public class ContactLogQO implements Serializable { ...@@ -52,4 +70,28 @@ public class ContactLogQO implements Serializable {
public void setEnterpriseId(String enterpriseId) { public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId; this.enterpriseId = enterpriseId;
} }
public Integer getBizType() {
return bizType;
}
public void setBizType(Integer bizType) {
this.bizType = bizType;
}
public String getFollowRemark() {
return followRemark;
}
public void setFollowRemark(String followRemark) {
this.followRemark = followRemark;
}
public List<String> getFollowMaterialList() {
return followMaterialList;
}
public void setFollowMaterialList(List<String> followMaterialList) {
this.followMaterialList = followMaterialList;
}
} }
\ No newline at end of file
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