Commit 08c1d755 by 王祖波

获取最近一条有效建联记录

parent 191eaec9
package com.gic.haoban.manage.api.dto.contact;
import java.io.Serializable;
import java.util.Date;
/**
* 建联日志表(TabContactLog)实体类
*
* @author TONGYI Lingma
* @since 2024-09-27 16:09:38
*/
public class ContactLogDTO implements Serializable {
private static final long serialVersionUID = 973688857967269973L;
/**
* 主键id
*/
private Long logId;
/**
* 会员id
*/
private String memberId;
/**
* 导购id
*/
private String clerkId;
/**
* 导购code
*/
private String clerkCode;
/**
* 导购名称
*/
private String clerkName;
/**
* 门店id
*/
private String storeId;
/**
* 门店code
*/
private String storeCode;
/**
* 建联状态 1是0否
*/
private Integer contactStatus;
/**
* 建联时间
*/
private Date contactTime;
/**
* 建联周期
*/
private Integer contactCycle;
/**
* 是否周期内首次建联1是0否
*/
private Integer contactCycleFirst;
/**
* 成为潜客时间
*/
private Date potentialTime;
/**
* 企业id
*/
private String enterpriseId;
public Long getLogId() {
return logId;
}
public void setLogId(Long logId) {
this.logId = logId;
}
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 String getClerkCode() {
return clerkCode;
}
public void setClerkCode(String clerkCode) {
this.clerkCode = clerkCode;
}
public String getClerkName() {
return clerkName;
}
public void setClerkName(String clerkName) {
this.clerkName = clerkName;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getStoreCode() {
return storeCode;
}
public void setStoreCode(String storeCode) {
this.storeCode = storeCode;
}
public Integer getContactStatus() {
return contactStatus;
}
public void setContactStatus(Integer contactStatus) {
this.contactStatus = contactStatus;
}
public Date getContactTime() {
return contactTime;
}
public void setContactTime(Date contactTime) {
this.contactTime = contactTime;
}
public Integer getContactCycle() {
return contactCycle;
}
public void setContactCycle(Integer contactCycle) {
this.contactCycle = contactCycle;
}
public Integer getContactCycleFirst() {
return contactCycleFirst;
}
public void setContactCycleFirst(Integer contactCycleFirst) {
this.contactCycleFirst = contactCycleFirst;
}
public Date getPotentialTime() {
return potentialTime;
}
public void setPotentialTime(Date potentialTime) {
this.potentialTime = potentialTime;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
}
\ No newline at end of file
package com.gic.haoban.manage.api.service.contact;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.contact.ContactLogDTO;
public interface ContactLogApiService {
/**
* 获取最近一条有效建联记录
* @param memberId
* @return
*/
ServiceResponse<ContactLogDTO> getClerkContactTime(String memberId);
}
package com.gic.haoban.manage.service.service.contact;
import com.gic.haoban.manage.api.qdto.contact.ContactLogQDTO;
import com.gic.haoban.manage.service.entity.contact.TabContactLog;
public interface ContactLogService {
......@@ -17,4 +18,11 @@ public interface ContactLogService {
* @param clearType 1 消费清除 2 换绑主导购
*/
void clearContactLog(String memberId,Integer clearType);
/**
* 获取最近一条有效建联记录
* @param memberId
* @return
*/
TabContactLog getClerkContactTime(String memberId);
}
package com.gic.haoban.manage.service.service.contact.impl;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
......@@ -16,6 +17,8 @@ import com.gic.haoban.manage.service.dao.mapper.contact.TabContactLogMapper;
import com.gic.haoban.manage.service.entity.contact.TabContactLog;
import com.gic.haoban.manage.service.service.contact.ContactFollowService;
import com.gic.haoban.manage.service.service.contact.ContactLogService;
import com.gic.member.api.dto.MemberStoreClerkDTO;
import com.gic.member.api.service.MemberService;
import com.gic.store.goods.service.StoreGoodsService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -39,6 +42,8 @@ public class ContactLogServiceImpl implements ContactLogService {
private ClerkService clerkService;
@Autowired
private StoreService storeService;
@Autowired
private MemberService memberService;
@Override
......@@ -109,4 +114,30 @@ public class ContactLogServiceImpl implements ContactLogService {
}
// todo 清除es建联时间 -1
}
@Override
public TabContactLog getClerkContactTime(String memberId) {
TabContactLog lastContactLog = contactLogMapper.queryLastLog(memberId, null);
if (lastContactLog == null) {
return null;
}
Integer contactStatus = lastContactLog.getContactStatus();
if (Objects.equals(contactStatus, Constant.FLAG_FALSE)) {
return null;
}
String clerkId = lastContactLog.getClerkId();
Date contactTime = lastContactLog.getContactTime();
MemberStoreClerkDTO memberStoreClerk = memberService.getMemberStoreClerk(memberId);
if (memberStoreClerk == null) {
return null;
}
logger.info("建联导购id:{},专属导购id:{}", clerkId, memberStoreClerk.getClerkId());
if (!Objects.equals(clerkId, memberStoreClerk.getClerkId())) {
return null;
}
if (DateUtil.compare(contactTime, DateUtil.date().offset(DateField.DAY_OF_MONTH, -14)) < 0) {
return null;
}
return lastContactLog;
}
}
package com.gic.haoban.manage.service.service.out.impl.contact;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.dto.contact.ContactLogDTO;
import com.gic.haoban.manage.api.service.contact.ContactLogApiService;
import com.gic.haoban.manage.service.entity.contact.TabContactLog;
import com.gic.haoban.manage.service.service.contact.ContactLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by wangzubo on 2022/11/1.
*/
@Service("contactLogApiService")
public class ContactLogApiServiceImpl implements ContactLogApiService {
@Autowired
private ContactLogService contactLogService;
@Override
public ServiceResponse<ContactLogDTO> getClerkContactTime(String memberId) {
TabContactLog contactLog = contactLogService.getClerkContactTime(memberId);
ContactLogDTO contactLogDTO = EntityUtil.changeEntityNew(ContactLogDTO.class, contactLog);
return ServiceResponse.success(contactLogDTO);
}
}
......@@ -144,6 +144,7 @@
<dubbo:service interface="com.gic.haoban.manage.api.service.role.HaobanMenuApiService" ref="haobanMenuApiServiceImpl"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.role.HaobanRoleApiService" ref="haobanRoleApiServiceImpl"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.contact.ContactFollowApiService" ref="contactFollowApiService"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.contact.ContactLogApiService" ref="contactLogApiService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="gicDepartmentService"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxDepartmentApiService"
......
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