Commit a9fd5b68 by 王祖波

Merge branch 'master' into feature-recommend3

parents 650c6f03 fbfe3fb5
...@@ -2,6 +2,8 @@ package com.gic.haoban.manage.api.dto.qdto.content; ...@@ -2,6 +2,8 @@ package com.gic.haoban.manage.api.dto.qdto.content;
import com.gic.api.base.commons.BasePageInfo; import com.gic.api.base.commons.BasePageInfo;
import java.util.Date;
/** /**
* @Author MUSI * @Author MUSI
* @Date 2023/3/29 1:11 PM * @Date 2023/3/29 1:11 PM
...@@ -20,6 +22,48 @@ public class InteractRecordQDTO extends BasePageInfo { ...@@ -20,6 +22,48 @@ public class InteractRecordQDTO extends BasePageInfo {
*/ */
private String memberId; private String memberId;
/**
* 企业id
*/
private String enterpriseId;
/**
* 线索来源
* @see com.gic.haoban.manage.api.enums.content.InteractRecordChannelSourceType
*/
private Integer channelSource;
/**
* 业务类型 1 素材 2 商品
*/
private Integer bizTypeAggs;
/**
* 事件类型
* @see com.gic.haoban.manage.api.enums.content.InteractRecordEventType
*/
private Integer eventTypeAggs;
/**
* 是否过滤空数据
*/
private Integer filterNull;
/**
* 排序字段
*/
private String orderBy;
/**
* 开始时间-创建时间
*/
private Date startTime;
/**
* 结束时间-创建时间
*/
private Date endTime;
public String getClerkId() { public String getClerkId() {
return clerkId; return clerkId;
...@@ -36,4 +80,68 @@ public class InteractRecordQDTO extends BasePageInfo { ...@@ -36,4 +80,68 @@ public class InteractRecordQDTO extends BasePageInfo {
public void setMemberId(String memberId) { public void setMemberId(String memberId) {
this.memberId = memberId; this.memberId = memberId;
} }
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getChannelSource() {
return channelSource;
}
public void setChannelSource(Integer channelSource) {
this.channelSource = channelSource;
}
public Integer getBizTypeAggs() {
return bizTypeAggs;
}
public void setBizTypeAggs(Integer bizTypeAggs) {
this.bizTypeAggs = bizTypeAggs;
}
public Integer getEventTypeAggs() {
return eventTypeAggs;
}
public void setEventTypeAggs(Integer eventTypeAggs) {
this.eventTypeAggs = eventTypeAggs;
}
public Integer getFilterNull() {
return filterNull;
}
public void setFilterNull(Integer filterNull) {
this.filterNull = filterNull;
}
public String getOrderBy() {
return orderBy;
}
public void setOrderBy(String orderBy) {
this.orderBy = orderBy;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
} }
package com.gic.haoban.manage.api.enums.content;
import java.util.Objects;
public enum InteractRecordChannelSourceType {
OTHER(0, "其他"),
FRIEND_CIRCLE(1, "朋友圈"),
CUSTOMER_GROUP(2, "客户群"),
CHAT_WINDOW(3, "对话框");
private final Integer code;
private final String description;
InteractRecordChannelSourceType(Integer code, String description) {
this.code = code;
this.description = description;
}
public Integer getCode() {
return code;
}
public String getDescription() {
return description;
}
public static InteractRecordChannelSourceType fromCode(Integer code) {
for (InteractRecordChannelSourceType source : values()) {
if (Objects.equals(source.code,code)) {
return source;
}
}
return OTHER;
}
}
package com.gic.haoban.manage.api.enums.content;
public enum InteractRecordEventType {
MATERIAL(1, "访问素材详情页"),
PRODUCT(2, "访问分享商品"),
ORDER(3, "下单购买"),
ADD_SHOPPING_CART(4, "加购");
InteractRecordEventType(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public static InteractRecordEventType getInstance(Integer code) {
if (code == null) {
return null;
}
for (InteractRecordEventType value : values()) {
if (value.code.equals(code)) {
return value;
}
}
return null;
}
private Integer code;
private String desc;
public Integer getCode() {
return code;
}
public String getDesc() {
return desc;
}
}
...@@ -138,11 +138,21 @@ public class InteractRecordExtendInfoDTO implements Serializable { ...@@ -138,11 +138,21 @@ public class InteractRecordExtendInfoDTO implements Serializable {
*/ */
public static class ExtendOrderInfo implements Serializable { public static class ExtendOrderInfo implements Serializable {
/** /**
* 订单id
*/
private String orderId;
/**
* 订单编号 * 订单编号
*/ */
private String orderNumber; private String orderNumber;
/** /**
* 订单渠道
* @see com.gic.enterprise.api.enums.PlatformChannelEnum
*/
private String channelCode;
/**
* 订单创建时间 * 订单创建时间
*/ */
private Date orderCreateTime; private Date orderCreateTime;
...@@ -175,6 +185,22 @@ public class InteractRecordExtendInfoDTO implements Serializable { ...@@ -175,6 +185,22 @@ public class InteractRecordExtendInfoDTO implements Serializable {
this.orderNumber = orderNumber; this.orderNumber = orderNumber;
} }
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getChannelCode() {
return channelCode;
}
public void setChannelCode(String channelCode) {
this.channelCode = channelCode;
}
public Date getOrderCreateTime() { public Date getOrderCreateTime() {
return orderCreateTime; return orderCreateTime;
} }
......
...@@ -17,6 +17,11 @@ public class InteractRecordInfoDTO implements Serializable { ...@@ -17,6 +17,11 @@ public class InteractRecordInfoDTO implements Serializable {
* 会员id * 会员id
*/ */
private String memberId; private String memberId;
/**
* 导购id
*/
private String clerkId;
/** /**
* 互动记录id * 互动记录id
*/ */
...@@ -44,6 +49,11 @@ public class InteractRecordInfoDTO implements Serializable { ...@@ -44,6 +49,11 @@ public class InteractRecordInfoDTO implements Serializable {
private Date createTime; private Date createTime;
/** /**
* 真正的创建时间 createTime可能会变成最新更新时间)
*/
private Date recordCreateTime;
/**
* 线索来源 1朋友圈; 2客户群; 3 对话框; 0其他 * 线索来源 1朋友圈; 2客户群; 3 对话框; 0其他
*/ */
private Integer channelSource; private Integer channelSource;
...@@ -61,6 +71,12 @@ public class InteractRecordInfoDTO implements Serializable { ...@@ -61,6 +71,12 @@ public class InteractRecordInfoDTO implements Serializable {
private Integer eventType; private Integer eventType;
/** /**
* 聚合的事件类型
* @see InteractRecordEventType
*/
private Integer eventTypeAggs;
/**
* 业务id * 业务id
*/ */
private String bizId; private String bizId;
...@@ -73,6 +89,11 @@ public class InteractRecordInfoDTO implements Serializable { ...@@ -73,6 +89,11 @@ public class InteractRecordInfoDTO implements Serializable {
private Integer bizType; private Integer bizType;
/** /**
* 聚合的业务类型
*/
private Integer bizTypeAggs;
/**
* 浏览的商品数量 * 浏览的商品数量
*/ */
private Integer visitGoodsNum; private Integer visitGoodsNum;
...@@ -87,6 +108,11 @@ public class InteractRecordInfoDTO implements Serializable { ...@@ -87,6 +108,11 @@ public class InteractRecordInfoDTO implements Serializable {
*/ */
private InteractRecordExtendInfoDTO extendInfo; private InteractRecordExtendInfoDTO extendInfo;
/**
* 跟进时间
*/
private Date followTime;
public String getMemberId() { public String getMemberId() {
return memberId; return memberId;
} }
...@@ -95,6 +121,14 @@ public class InteractRecordInfoDTO implements Serializable { ...@@ -95,6 +121,14 @@ public class InteractRecordInfoDTO implements Serializable {
this.memberId = memberId; this.memberId = memberId;
} }
public String getClerkId() {
return clerkId;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public Long getInteractRecordId() { public Long getInteractRecordId() {
return interactRecordId; return interactRecordId;
} }
...@@ -135,6 +169,14 @@ public class InteractRecordInfoDTO implements Serializable { ...@@ -135,6 +169,14 @@ public class InteractRecordInfoDTO implements Serializable {
this.createTime = createTime; this.createTime = createTime;
} }
public Date getRecordCreateTime() {
return recordCreateTime;
}
public void setRecordCreateTime(Date recordCreateTime) {
this.recordCreateTime = recordCreateTime;
}
public Integer getEventType() { public Integer getEventType() {
return eventType; return eventType;
} }
...@@ -198,4 +240,28 @@ public class InteractRecordInfoDTO implements Serializable { ...@@ -198,4 +240,28 @@ public class InteractRecordInfoDTO implements Serializable {
public void setBizType(Integer bizType) { public void setBizType(Integer bizType) {
this.bizType = bizType; this.bizType = bizType;
} }
public Integer getEventTypeAggs() {
return eventTypeAggs;
}
public void setEventTypeAggs(Integer eventTypeAggs) {
this.eventTypeAggs = eventTypeAggs;
}
public Integer getBizTypeAggs() {
return bizTypeAggs;
}
public void setBizTypeAggs(Integer bizTypeAggs) {
this.bizTypeAggs = bizTypeAggs;
}
public Date getFollowTime() {
return followTime;
}
public void setFollowTime(Date followTime) {
this.followTime = followTime;
}
} }
...@@ -143,5 +143,13 @@ public interface TabHaobanInteractRecordMapper { ...@@ -143,5 +143,13 @@ public interface TabHaobanInteractRecordMapper {
*/ */
int modifyUnionId(@Param("enterpriseId") String enterpriseId, @Param("oldUnionId") String oldUnionId, @Param("newUnionId") String newUnionId); int modifyUnionId(@Param("enterpriseId") String enterpriseId, @Param("oldUnionId") String oldUnionId, @Param("newUnionId") String newUnionId);
/**
* 更新跟进时间
*
* @param enterpriseId
* @return
*/
int modifyFollowTimeBatch(@Param("enterpriseId") String enterpriseId, @Param("clerkId") String clerkId, @Param("memberId") String memberId, @Param("limitTime") Date limitTime);
} }
...@@ -88,6 +88,11 @@ public class TabHaobanInteractRecord implements Serializable { ...@@ -88,6 +88,11 @@ public class TabHaobanInteractRecord implements Serializable {
*/ */
private Date lastAccessTime; private Date lastAccessTime;
/**
* 跟进时间
*/
private Date followTime;
public Long getId() { public Long getId() {
return id; return id;
...@@ -240,5 +245,13 @@ public class TabHaobanInteractRecord implements Serializable { ...@@ -240,5 +245,13 @@ public class TabHaobanInteractRecord implements Serializable {
public void setLastAccessTime(Date lastAccessTime) { public void setLastAccessTime(Date lastAccessTime) {
this.lastAccessTime = lastAccessTime; this.lastAccessTime = lastAccessTime;
} }
public Date getFollowTime() {
return followTime;
}
public void setFollowTime(Date followTime) {
this.followTime = followTime;
}
} }
...@@ -103,4 +103,9 @@ public class InteractRecordBO { ...@@ -103,4 +103,9 @@ public class InteractRecordBO {
* 最新访问时间 * 最新访问时间
*/ */
private Date lastAccessTime; private Date lastAccessTime;
/**
* 跟进时间
*/
private Date followTime;
} }
...@@ -103,12 +103,23 @@ public class InteractRecordExtendInfoBO implements Serializable { ...@@ -103,12 +103,23 @@ public class InteractRecordExtendInfoBO implements Serializable {
*/ */
@Data @Data
public static class ExtendOrderInfo implements Serializable { public static class ExtendOrderInfo implements Serializable {
/**
* 订单id
*/
private String orderId;
/** /**
* 订单编号 * 订单编号
*/ */
private String orderNumber; private String orderNumber;
/** /**
* 订单渠道
* @see com.gic.enterprise.api.enums.PlatformChannelEnum
*/
private String channelCode;
/**
* 订单创建时间 * 订单创建时间
*/ */
private Date orderCreateTime; private Date orderCreateTime;
......
...@@ -4,6 +4,7 @@ import com.gic.api.base.commons.BasePageInfo; ...@@ -4,6 +4,7 @@ import com.gic.api.base.commons.BasePageInfo;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @Author MUSI * @Author MUSI
...@@ -46,4 +47,31 @@ public class InteractRecordQO extends BasePageInfo { ...@@ -46,4 +47,31 @@ public class InteractRecordQO extends BasePageInfo {
*/ */
private String bizId; private String bizId;
/**
* 是否过滤空数据
*/
private Integer filterNull;
/**
* 排序字段
*/
private String orderBy;
/**
* 线索来源
* @see com.gic.haoban.manage.api.enums.content.InteractRecordChannelSourceType
*/
private List<Integer> channelSourceList;
/**
* 业务类型 1 素材 2 商品 3 多商品页
* @see com.gic.haoban.manage.api.enums.content.ShareBizType
*/
private List<Integer> bizTypeList;
/**
* 事件类型
*/
private List<Integer> eventTypeList;
} }
...@@ -332,6 +332,12 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -332,6 +332,12 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("planId",planId) ; jsonObject.put("planId",planId) ;
jsonObject.put("ownerLogId",ownerLogId) ; jsonObject.put("ownerLogId",ownerLogId) ;
if(null != clerkId) {
ClerkDTO clerk = this.clerkService.getclerkById(clerkId);
if (null != clerk) {
jsonObject.put("storeId", clerk.getStoreId());
}
}
int messageType = NoticeMessageTypeEnum.GROUP_CHAT_PLAN.getType(); int messageType = NoticeMessageTypeEnum.GROUP_CHAT_PLAN.getType();
NoticeMessageUtil.sendNoticeMessageByStaff(enterpriseId,staffId,clerkId,messageType,null,map,jsonObject); NoticeMessageUtil.sendNoticeMessageByStaff(enterpriseId,staffId,clerkId,messageType,null,map,jsonObject);
} }
...@@ -889,7 +895,7 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService { ...@@ -889,7 +895,7 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
@Override @Override
public String getQwMsgId(String staffId , Date sendTime, GroupMessageServiceImpl.GroupMsgChatType groupMsgChatType) { public String getQwMsgId(String staffId , Date sendTime, GroupMessageServiceImpl.GroupMsgChatType groupMsgChatType) {
Date startTime = DateUtil.addNumForSecond(sendTime,-10) ; Date startTime = DateUtil.addNumForSecond(sendTime,-30) ;
Date endTime = DateUtil.addNumForMinute(sendTime,1) ; Date endTime = DateUtil.addNumForMinute(sendTime,1) ;
TabHaobanStaff staff = this.staffMapper.selectByPrimaryKey(staffId) ; TabHaobanStaff staff = this.staffMapper.selectByPrimaryKey(staffId) ;
String wxEnterpriseId = staff.getWxEnterpriseId() ; String wxEnterpriseId = staff.getWxEnterpriseId() ;
......
...@@ -76,7 +76,13 @@ public interface InteractRecordService { ...@@ -76,7 +76,13 @@ public interface InteractRecordService {
*/ */
InteractRecordBO queryLeastRecord(String enterpriseId, String clerkId, String bizId, String memberId); InteractRecordBO queryLeastRecord(String enterpriseId, String clerkId, String bizId, String memberId);
// void modifyFollowTime(String enterpriseId,String clerkId, String memberId); /**
* 更新销售线索跟进时间
* @param enterpriseId
* @param clerkId
* @param memberId
*/
void modifyFollowTime(String enterpriseId,String clerkId, String memberId);
/** /**
* 更新unionId * 更新unionId
......
package com.gic.haoban.manage.service.service.content.adaptor; package com.gic.haoban.manage.service.service.content.adaptor;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.store.goods.dto.goods.GoodsInfoSimpleDTO;
import com.gic.store.goods.dto.goods.GoodsSpuInfoDTO; import com.gic.store.goods.dto.goods.GoodsSpuInfoDTO;
import com.gic.store.goods.service.GoodsCenterApiService; import com.gic.store.goods.service.GoodsCenterApiService;
import com.gic.store.goods.service.GoodsInfoOutApiService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -24,6 +26,8 @@ public class GoodsInfoAdaptor { ...@@ -24,6 +26,8 @@ public class GoodsInfoAdaptor {
@Autowired @Autowired
private GoodsCenterApiService goodsCenterApiService; private GoodsCenterApiService goodsCenterApiService;
@Autowired
private GoodsInfoOutApiService goodsInfoOutApiService;
public Map<String, GoodsSpuInfoDTO> queryGoodsMinPrice(String enterpriseId, List<String> goodsIds) { public Map<String, GoodsSpuInfoDTO> queryGoodsMinPrice(String enterpriseId, List<String> goodsIds) {
ServiceResponse<List<GoodsSpuInfoDTO>> response = goodsCenterApiService.queryGoodsMinPrice(enterpriseId, goodsIds); ServiceResponse<List<GoodsSpuInfoDTO>> response = goodsCenterApiService.queryGoodsMinPrice(enterpriseId, goodsIds);
...@@ -35,5 +39,20 @@ public class GoodsInfoAdaptor { ...@@ -35,5 +39,20 @@ public class GoodsInfoAdaptor {
.collect(Collectors.toMap(GoodsSpuInfoDTO::getGoodsId, Function.identity(), (v1, v2) -> v1)); .collect(Collectors.toMap(GoodsSpuInfoDTO::getGoodsId, Function.identity(), (v1, v2) -> v1));
} }
public Map<String, GoodsInfoSimpleDTO> queryGoodsAndMinPrice(String enterpriseId, List<String> goodsIds) {
ServiceResponse<List<GoodsInfoSimpleDTO>> response = goodsInfoOutApiService.queryGoodsSimpleInfo(goodsIds);
if (!response.isSuccess() || CollectionUtils.isEmpty(response.getResult())) {
return Collections.emptyMap();
}
Map<String, GoodsSpuInfoDTO> goodsMinPriceMap = queryGoodsMinPrice(enterpriseId, goodsIds);
return response.getResult()
.stream()
.peek(item->{
GoodsSpuInfoDTO goodsSpuInfoDTO = goodsMinPriceMap.get(item.getGoodsId());
if (goodsSpuInfoDTO != null && goodsSpuInfoDTO.getMinPrice() != null) {
item.setSalePrice(goodsSpuInfoDTO.getMinPrice());
}
}).collect(Collectors.toMap(GoodsInfoSimpleDTO::getGoodsId, Function.identity(), (v1, v2) -> v1));
}
} }
...@@ -20,6 +20,8 @@ import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessa ...@@ -20,6 +20,8 @@ import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessa
import com.gic.store.goods.dto.goods.GoodsInfoSimpleDTO; import com.gic.store.goods.dto.goods.GoodsInfoSimpleDTO;
import com.gic.store.goods.dto.goods.GoodsSpuInfoDTO; import com.gic.store.goods.dto.goods.GoodsSpuInfoDTO;
import com.gic.store.goods.service.GoodsInfoOutApiService; import com.gic.store.goods.service.GoodsInfoOutApiService;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -88,6 +90,26 @@ public class InteractRecordBuilder { ...@@ -88,6 +90,26 @@ public class InteractRecordBuilder {
return stringBuilder.toString(); return stringBuilder.toString();
} }
public Map<String,GoodsInfoSimpleDTO> buildGoodsMap(String enterprieseId,List<TabHaobanInteractRecord> list) {
Set<String> goodsIdSet = Sets.newHashSet();
list.forEach(item -> {
String extendInfo = Optional.ofNullable(item.getExtendInfo()).orElse("{}");
InteractRecordExtendInfoBO extendInfoBO = JSONObject.parseObject(extendInfo, InteractRecordExtendInfoBO.class);
List<String> goodsIds = extendInfoBO.getGoodsIds();
if (CollectionUtils.isNotEmpty(goodsIds)) {
goodsIdSet.addAll(goodsIds);
}
List<List<String>> groupGoodsIds = extendInfoBO.getGroupGoodsIds();
if (CollectionUtils.isNotEmpty(groupGoodsIds)) {
goodsIdSet.addAll(groupGoodsIds.stream().flatMap(Collection::stream).collect(Collectors.toList()));
}
});
if (CollectionUtils.isEmpty(goodsIdSet)) {
return new HashMap<>();
}
return goodsInfoAdaptor.queryGoodsAndMinPrice(enterprieseId,Lists.newArrayList(goodsIdSet));
}
/** /**
* 互动记录转换扩展信息 * 互动记录转换扩展信息
...@@ -95,7 +117,7 @@ public class InteractRecordBuilder { ...@@ -95,7 +117,7 @@ public class InteractRecordBuilder {
* @param interactRecord * @param interactRecord
* @return * @return
*/ */
public InteractRecordExtendInfoBO convertExtendInfo(TabHaobanInteractRecord interactRecord) { public InteractRecordExtendInfoBO convertExtendInfo(TabHaobanInteractRecord interactRecord,Map<String, GoodsInfoSimpleDTO> goodsMap) {
if (interactRecord == null) { if (interactRecord == null) {
log.info("互动记录为空"); log.info("互动记录为空");
return null; return null;
...@@ -110,7 +132,7 @@ public class InteractRecordBuilder { ...@@ -110,7 +132,7 @@ public class InteractRecordBuilder {
|| MaterialInteractRecordEventType.ADD_SHOPPING_CART.getCode().equals(interactRecord.getEventType()) || MaterialInteractRecordEventType.ADD_SHOPPING_CART.getCode().equals(interactRecord.getEventType())
|| MaterialInteractRecordEventType.ORDER.getCode().equals(interactRecord.getEventType()) || MaterialInteractRecordEventType.ORDER.getCode().equals(interactRecord.getEventType())
|| MaterialInteractRecordEventType.VISIT_MATERIAL.getCode().equals(interactRecord.getEventType())) { || MaterialInteractRecordEventType.VISIT_MATERIAL.getCode().equals(interactRecord.getEventType())) {
convertGroupGoods(interactRecord.getEnterpriseId(), extendInfo); convertGroupGoods(interactRecord.getEnterpriseId(), extendInfo, goodsMap);
// 浏览商品事件 // 浏览商品事件
List<String> visitGoodsIds = extendInfo.getGoodsIds(); List<String> visitGoodsIds = extendInfo.getGoodsIds();
if (CollectionUtils.isEmpty(visitGoodsIds)) { if (CollectionUtils.isEmpty(visitGoodsIds)) {
...@@ -119,7 +141,7 @@ public class InteractRecordBuilder { ...@@ -119,7 +141,7 @@ public class InteractRecordBuilder {
} }
// 拼接商品信息 // 拼接商品信息
List<InteractRecordExtendInfoBO.ExtendGoodsInfo> extendGoodsInfos = List<InteractRecordExtendInfoBO.ExtendGoodsInfo> extendGoodsInfos =
this.convertGoodsInfo(visitGoodsIds, interactRecord.getEnterpriseId()); this.convertGoodsInfo(visitGoodsIds, interactRecord.getEnterpriseId(),goodsMap);
extendInfo.setExtendGoodsInfos(extendGoodsInfos); extendInfo.setExtendGoodsInfos(extendGoodsInfos);
extendInfo.setInvalidGoodsNum(visitGoodsIds.size() - extendGoodsInfos.size()); extendInfo.setInvalidGoodsNum(visitGoodsIds.size() - extendGoodsInfos.size());
return extendInfo; return extendInfo;
...@@ -140,13 +162,13 @@ public class InteractRecordBuilder { ...@@ -140,13 +162,13 @@ public class InteractRecordBuilder {
return extendInfo; return extendInfo;
} }
private void convertGroupGoods(String enterpriseId, InteractRecordExtendInfoBO extendInfo) { private void convertGroupGoods(String enterpriseId, InteractRecordExtendInfoBO extendInfo,Map<String, GoodsInfoSimpleDTO> goodsMap) {
List<List<String>> groupGoodsIds = extendInfo.getGroupGoodsIds(); List<List<String>> groupGoodsIds = extendInfo.getGroupGoodsIds();
// 组装商品组数据 // 组装商品组数据
if (CollectionUtils.isNotEmpty(groupGoodsIds)) { if (CollectionUtils.isNotEmpty(groupGoodsIds)) {
List<String> groupGoodsIdList = groupGoodsIds.stream().flatMap(Collection::stream).collect(Collectors.toList()); List<String> groupGoodsIdList = groupGoodsIds.stream().flatMap(Collection::stream).collect(Collectors.toList());
List<InteractRecordExtendInfoBO.ExtendGoodsInfo> extendGoodsInfos = List<InteractRecordExtendInfoBO.ExtendGoodsInfo> extendGoodsInfos =
this.convertGoodsInfo(groupGoodsIdList, enterpriseId); this.convertGoodsInfo(groupGoodsIdList, enterpriseId,goodsMap);
if (CollectionUtils.isNotEmpty(extendGoodsInfos)) { if (CollectionUtils.isNotEmpty(extendGoodsInfos)) {
Map<String, InteractRecordExtendInfoBO.ExtendGoodsInfo> goodsInfoMap = extendGoodsInfos.stream() Map<String, InteractRecordExtendInfoBO.ExtendGoodsInfo> goodsInfoMap = extendGoodsInfos.stream()
.collect(Collectors.toMap(InteractRecordExtendInfoBO.ExtendGoodsInfo::getGoodsId, Function.identity(),(e,x)->e)); .collect(Collectors.toMap(InteractRecordExtendInfoBO.ExtendGoodsInfo::getGoodsId, Function.identity(),(e,x)->e));
...@@ -167,23 +189,37 @@ public class InteractRecordBuilder { ...@@ -167,23 +189,37 @@ public class InteractRecordBuilder {
} }
} }
private List<InteractRecordExtendInfoBO.ExtendGoodsInfo> convertGoodsInfo(List<String> visitGoodsIds, String enterpriseId) { private List<InteractRecordExtendInfoBO.ExtendGoodsInfo> convertGoodsInfo(List<String> visitGoodsIds, String enterpriseId,Map<String, GoodsInfoSimpleDTO> goodsMap) {
if (CollectionUtils.isEmpty(visitGoodsIds)) { if (CollectionUtils.isEmpty(visitGoodsIds)) {
return Collections.emptyList(); return Collections.emptyList();
} }
ServiceResponse<List<GoodsInfoSimpleDTO>> serviceResponse = goodsInfoOutApiService.queryGoodsSimpleInfo(visitGoodsIds); List<GoodsInfoSimpleDTO> list = new ArrayList<>();
// 1:已上线,2:未上线,3:回收站 Map<String, GoodsSpuInfoDTO> goodsMinPriceMap;
if (!serviceResponse.isSuccess()) { // 修改为支持外部先批量查询
log.info("查询商品异常 {}", JSON.toJSONString(serviceResponse)); if (goodsMap == null) {
return Collections.emptyList(); ServiceResponse<List<GoodsInfoSimpleDTO>> serviceResponse = goodsInfoOutApiService.queryGoodsSimpleInfo(visitGoodsIds);
} // 1:已上线,2:未上线,3:回收站
if (CollectionUtils.isEmpty(serviceResponse.getResult())) { if (!serviceResponse.isSuccess()) {
log.info("查询商品为空 {}", JSON.toJSONString(serviceResponse)); log.info("查询商品异常 {}", JSON.toJSONString(serviceResponse));
return Collections.emptyList(); return Collections.emptyList();
}
if (CollectionUtils.isEmpty(serviceResponse.getResult())) {
log.info("查询商品为空 {}", JSON.toJSONString(serviceResponse));
return Collections.emptyList();
}
list = serviceResponse.getResult();
goodsMinPriceMap = goodsInfoAdaptor.queryGoodsMinPrice(enterpriseId, visitGoodsIds);
}else {
goodsMinPriceMap = new HashMap<>();
for (String goodsId : visitGoodsIds) {
GoodsInfoSimpleDTO goodsInfoSimpleDTO = goodsMap.get(goodsId);
if (goodsInfoSimpleDTO != null) {
list.add(goodsInfoSimpleDTO);
}
}
} }
Map<String, GoodsSpuInfoDTO> goodsMinPriceMap = goodsInfoAdaptor.queryGoodsMinPrice(enterpriseId, visitGoodsIds);
List<Integer> excludeStatus = Arrays.asList(0, 3); List<Integer> excludeStatus = Arrays.asList(0, 3);
return serviceResponse.getResult() return list
.stream() .stream()
.filter(item -> !excludeStatus.contains(item.getStatus())) .filter(item -> !excludeStatus.contains(item.getStatus()))
.map(item -> { .map(item -> {
...@@ -310,7 +346,7 @@ public class InteractRecordBuilder { ...@@ -310,7 +346,7 @@ public class InteractRecordBuilder {
map.forEach((wxaLinkId, groupIds) -> { map.forEach((wxaLinkId, groupIds) -> {
InteractRecordExtendInfoBO extendInfoBO = new InteractRecordExtendInfoBO(); InteractRecordExtendInfoBO extendInfoBO = new InteractRecordExtendInfoBO();
extendInfoBO.setGroupGoodsIds(groupIds); extendInfoBO.setGroupGoodsIds(groupIds);
convertGroupGoods(enterpriseId, extendInfoBO); convertGroupGoods(enterpriseId, extendInfoBO,null);
extendInfoBOMap.put(wxaLinkId, extendInfoBO); extendInfoBOMap.put(wxaLinkId, extendInfoBO);
}); });
return extendInfoBOMap; return extendInfoBOMap;
......
...@@ -8,6 +8,7 @@ import com.gic.business.order.dto.ordermanage.ListOrderItemDTO; ...@@ -8,6 +8,7 @@ import com.gic.business.order.dto.ordermanage.ListOrderItemDTO;
import com.gic.business.order.dto.ordermanage.OrderOutInfoDTO; import com.gic.business.order.dto.ordermanage.OrderOutInfoDTO;
import com.gic.business.order.qdto.ordermanage.OrderInfoQDTO; import com.gic.business.order.qdto.ordermanage.OrderInfoQDTO;
import com.gic.business.order.service.ordermanage.OrderInfoOutApiService; import com.gic.business.order.service.ordermanage.OrderInfoOutApiService;
import com.gic.enterprise.api.enums.PlatformChannelEnum;
import com.gic.haoban.manage.api.enums.content.MaterialInteractRecordEventType; import com.gic.haoban.manage.api.enums.content.MaterialInteractRecordEventType;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordExtendInfoBO; import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordExtendInfoBO;
import com.gic.haoban.manage.service.pojo.bo.content.context.InteractRecordMessageContext; import com.gic.haoban.manage.service.pojo.bo.content.context.InteractRecordMessageContext;
...@@ -220,7 +221,9 @@ public class InteractRecordMessageBuilder { ...@@ -220,7 +221,9 @@ public class InteractRecordMessageBuilder {
OrderOutInfoDTO orderOutInfoDTO = serviceResponse.getResult(); OrderOutInfoDTO orderOutInfoDTO = serviceResponse.getResult();
InteractRecordExtendInfoBO.ExtendOrderInfo extendOrderInfo = new InteractRecordExtendInfoBO.ExtendOrderInfo(); InteractRecordExtendInfoBO.ExtendOrderInfo extendOrderInfo = new InteractRecordExtendInfoBO.ExtendOrderInfo();
extendOrderInfo.setOrderId(orderOutInfoDTO.getOrderId());
extendOrderInfo.setOrderNumber(orderOutInfoDTO.getOrderNumber()); extendOrderInfo.setOrderNumber(orderOutInfoDTO.getOrderNumber());
extendOrderInfo.setChannelCode(PlatformChannelEnum.C_WECHAT_MINI.getChannelCode());
extendOrderInfo.setOrderCreateTime(orderOutInfoDTO.getCreateTime()); extendOrderInfo.setOrderCreateTime(orderOutInfoDTO.getCreateTime());
extendOrderInfo.setOrderTotalNum(orderOutInfoDTO.getOrderItems().size()); extendOrderInfo.setOrderTotalNum(orderOutInfoDTO.getOrderItems().size());
extendOrderInfo.setOrderPay(orderOutInfoDTO.getReceivableAmount()); extendOrderInfo.setOrderPay(orderOutInfoDTO.getReceivableAmount());
...@@ -253,7 +256,9 @@ public class InteractRecordMessageBuilder { ...@@ -253,7 +256,9 @@ public class InteractRecordMessageBuilder {
return null; return null;
} }
InteractRecordExtendInfoBO.ExtendOrderInfo extendOrderInfo = new InteractRecordExtendInfoBO.ExtendOrderInfo(); InteractRecordExtendInfoBO.ExtendOrderInfo extendOrderInfo = new InteractRecordExtendInfoBO.ExtendOrderInfo();
extendOrderInfo.setOrderId(eorderDTO.getEorderId());
extendOrderInfo.setOrderNumber(eorderDTO.getOrderNo()); extendOrderInfo.setOrderNumber(eorderDTO.getOrderNo());
extendOrderInfo.setChannelCode(Optional.ofNullable(PlatformChannelEnum.getEnumByOldOrderType(eorderDTO.getOrderType())).orElse(PlatformChannelEnum.C_OTHER).getChannelCode());
extendOrderInfo.setOrderCreateTime(eorderDTO.getOrderCreateTime()); extendOrderInfo.setOrderCreateTime(eorderDTO.getOrderCreateTime());
extendOrderInfo.setOrderPay(BigDecimal.valueOf(eorderDTO.getTotalAmount())); extendOrderInfo.setOrderPay(BigDecimal.valueOf(eorderDTO.getTotalAmount()));
extendOrderInfo.setRealPay(BigDecimal.valueOf(eorderDTO.getPaymentAmount())); extendOrderInfo.setRealPay(BigDecimal.valueOf(eorderDTO.getPaymentAmount()));
...@@ -301,7 +306,9 @@ public class InteractRecordMessageBuilder { ...@@ -301,7 +306,9 @@ public class InteractRecordMessageBuilder {
} }
OrderDTO orderDTO = serviceResponse.getResult(); OrderDTO orderDTO = serviceResponse.getResult();
InteractRecordExtendInfoBO.ExtendOrderInfo extendOrderInfo = new InteractRecordExtendInfoBO.ExtendOrderInfo(); InteractRecordExtendInfoBO.ExtendOrderInfo extendOrderInfo = new InteractRecordExtendInfoBO.ExtendOrderInfo();
extendOrderInfo.setOrderId(orderDTO.getOrderId());
extendOrderInfo.setOrderNumber(orderDTO.getOrderNumber()); extendOrderInfo.setOrderNumber(orderDTO.getOrderNumber());
extendOrderInfo.setChannelCode(PlatformChannelEnum.C_POS.getChannelCode());
extendOrderInfo.setOrderCreateTime(orderDTO.getOrderTime()); extendOrderInfo.setOrderCreateTime(orderDTO.getOrderTime());
extendOrderInfo.setOrderTotalNum(orderDTO.getItemNum()); extendOrderInfo.setOrderTotalNum(orderDTO.getItemNum());
extendOrderInfo.setOrderPay(BigDecimal.valueOf(orderDTO.getPaidAmount())); extendOrderInfo.setOrderPay(BigDecimal.valueOf(orderDTO.getPaidAmount()));
......
package com.gic.haoban.manage.service.service.content.impl; package com.gic.haoban.manage.service.service.content.impl;
import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.commons.util.DateUtil; import com.gic.commons.util.DateUtil;
import com.gic.commons.util.UniqueIdUtils; import com.gic.commons.util.UniqueIdUtils;
...@@ -15,7 +17,10 @@ import com.gic.haoban.manage.service.pojo.qo.content.InteractRecordQO; ...@@ -15,7 +17,10 @@ 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.InteractRecordService;
import com.gic.haoban.manage.service.service.content.PotentialCustomerService; import com.gic.haoban.manage.service.service.content.PotentialCustomerService;
import com.gic.haoban.manage.service.service.content.adaptor.InteractRecordBuilder; import com.gic.haoban.manage.service.service.content.adaptor.InteractRecordBuilder;
import com.gic.store.goods.dto.goods.GoodsInfoSimpleDTO;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -25,7 +30,6 @@ import org.springframework.stereotype.Component; ...@@ -25,7 +30,6 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -81,12 +85,12 @@ public class InteractRecordServiceImpl implements InteractRecordService { ...@@ -81,12 +85,12 @@ public class InteractRecordServiceImpl implements InteractRecordService {
@Override @Override
public Page<InteractRecordBO> queryInteractRecordPage(InteractRecordQO interactRecordQO) { public Page<InteractRecordBO> queryInteractRecordPage(InteractRecordQO interactRecordQO) {
if (StringUtils.isBlank(interactRecordQO.getClerkId())) { if (Objects.equals(interactRecordQO.getClerkId(),"-1")) {
log.info("queryInteractRecordPage 参数缺失"); log.info("queryInteractRecordPage 参数缺失");
return new Page<>(); return new Page<>();
} }
// 默认查最近一年内的的数据 // 默认查最近一年内的的数据
if (interactRecordQO.getStartTime() == null || interactRecordQO.getStartTime().before(DateUtil.addNumForYear(new Date(), -1))) { if (interactRecordQO.getStartTime() == null) {
interactRecordQO.setStartTime(DateUtil.addNumForYear(new Date(), -1)); interactRecordQO.setStartTime(DateUtil.addNumForYear(new Date(), -1));
} }
PageHelper.startPage(interactRecordQO.getPageNum(), interactRecordQO.getPageSize()); PageHelper.startPage(interactRecordQO.getPageNum(), interactRecordQO.getPageSize());
...@@ -96,6 +100,9 @@ public class InteractRecordServiceImpl implements InteractRecordService { ...@@ -96,6 +100,9 @@ public class InteractRecordServiceImpl implements InteractRecordService {
log.info("查询互动记录数据为空 {}", JSON.toJSONString(interactRecordQO)); log.info("查询互动记录数据为空 {}", JSON.toJSONString(interactRecordQO));
return new Page<>(); return new Page<>();
} }
// 修改为批量查询
Map<String, GoodsInfoSimpleDTO> goodsMap = interactRecordBuilder.buildGoodsMap(interactRecordQO.getEnterpriseId(), pageResult.getResult());
Page<InteractRecordBO> result = new Page<>(); Page<InteractRecordBO> result = new Page<>();
result.setTotalCount((int) pageResult.getTotal()); result.setTotalCount((int) pageResult.getTotal());
List<InteractRecordBO> recordBos = pageResult.getResult() List<InteractRecordBO> recordBos = pageResult.getResult()
...@@ -104,7 +111,7 @@ public class InteractRecordServiceImpl implements InteractRecordService { ...@@ -104,7 +111,7 @@ public class InteractRecordServiceImpl implements InteractRecordService {
InteractRecordBO temp = new InteractRecordBO(); InteractRecordBO temp = new InteractRecordBO();
BeanUtils.copyProperties(item, temp); BeanUtils.copyProperties(item, temp);
temp.setRecordDesc(interactRecordBuilder.buildDesc(item)); temp.setRecordDesc(interactRecordBuilder.buildDesc(item));
temp.setExtendInfo(interactRecordBuilder.convertExtendInfo(item)); temp.setExtendInfo(interactRecordBuilder.convertExtendInfo(item,goodsMap));
interactRecordBuilder.warpRelationGoodsNum(temp); interactRecordBuilder.warpRelationGoodsNum(temp);
return temp; return temp;
}) })
...@@ -113,6 +120,8 @@ public class InteractRecordServiceImpl implements InteractRecordService { ...@@ -113,6 +120,8 @@ public class InteractRecordServiceImpl implements InteractRecordService {
return result; return result;
} }
/** /**
* 统计总数 * 统计总数
* *
...@@ -193,6 +202,7 @@ public class InteractRecordServiceImpl implements InteractRecordService { ...@@ -193,6 +202,7 @@ public class InteractRecordServiceImpl implements InteractRecordService {
if (StringUtils.isAnyBlank(memberId, unionId)) { if (StringUtils.isAnyBlank(memberId, unionId)) {
return; return;
} }
log.info("会员授权事件,memberId:{},unionId:{}", memberId,unionId);
InteractRecordQO interactRecordQO = new InteractRecordQO(); InteractRecordQO interactRecordQO = new InteractRecordQO();
interactRecordQO.setUnionId(unionId); interactRecordQO.setUnionId(unionId);
List<TabHaobanInteractRecord> interactRecords = this.tabHaobanInteractRecordMapper.queryInteractRecordList(interactRecordQO); List<TabHaobanInteractRecord> interactRecords = this.tabHaobanInteractRecordMapper.queryInteractRecordList(interactRecordQO);
...@@ -267,6 +277,21 @@ public class InteractRecordServiceImpl implements InteractRecordService { ...@@ -267,6 +277,21 @@ public class InteractRecordServiceImpl implements InteractRecordService {
} }
@Override @Override
public void modifyFollowTime(String enterpriseId, String clerkId, String memberId) {
DateTime now = cn.hutool.core.date.DateUtil.date();
DateTime limitTime = cn.hutool.core.date.DateUtil.offsetDay(cn.hutool.core.date.DateUtil.endOfDay(now), -7);
log.info("更新跟进时间 now:{},limitTime:{}", now, limitTime);
tabHaobanInteractRecordMapper.modifyFollowTimeBatch(enterpriseId, clerkId, memberId,limitTime);
InteractRecordBO interactRecordBO = queryLeastRecord(enterpriseId, clerkId, null, memberId);
if (interactRecordBO != null && cn.hutool.core.date.DateUtil.compare(interactRecordBO.getCreateTime(), limitTime) >= 0) {
TabHaobanInteractRecord modifyInteractRecord = new TabHaobanInteractRecord();
modifyInteractRecord.setId(interactRecordBO.getId());
modifyInteractRecord.setFollowTime(now);
tabHaobanInteractRecordMapper.update(modifyInteractRecord);
}
}
@Override
public List<InteractRecordBO> lastInteractRecord(String enterpriseId, String clerkId, List<MemberLastInteractBO> list) { public List<InteractRecordBO> lastInteractRecord(String enterpriseId, String clerkId, List<MemberLastInteractBO> list) {
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>(); return new ArrayList<>();
...@@ -277,7 +302,7 @@ public class InteractRecordServiceImpl implements InteractRecordService { ...@@ -277,7 +302,7 @@ public class InteractRecordServiceImpl implements InteractRecordService {
InteractRecordBO temp = new InteractRecordBO(); InteractRecordBO temp = new InteractRecordBO();
BeanUtils.copyProperties(item, temp); BeanUtils.copyProperties(item, temp);
temp.setRecordDesc(interactRecordBuilder.buildDesc(item)); temp.setRecordDesc(interactRecordBuilder.buildDesc(item));
temp.setExtendInfo(interactRecordBuilder.convertExtendInfo(item)); temp.setExtendInfo(interactRecordBuilder.convertExtendInfo(item,null));
interactRecordBuilder.warpRelationGoodsNum(temp); interactRecordBuilder.warpRelationGoodsNum(temp);
return temp; return temp;
}) })
......
...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service.content.impl; ...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service.content.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.BasePageInfo; import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Constant;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.UniqueIdUtils; import com.gic.commons.util.UniqueIdUtils;
...@@ -41,12 +42,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -41,12 +42,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Arrays; import java.util.*;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -246,6 +242,12 @@ public class PotentialCustomerServiceImpl implements PotentialCustomerService { ...@@ -246,6 +242,12 @@ public class PotentialCustomerServiceImpl implements PotentialCustomerService {
temp.setStarFlag(potentialCustomerBO.getStarFlag()); temp.setStarFlag(potentialCustomerBO.getStarFlag());
temp.setSeeFlag(potentialCustomerBO.getSeeFlag()); temp.setSeeFlag(potentialCustomerBO.getSeeFlag());
potentialCustomerMapper.update(temp); potentialCustomerMapper.update(temp);
if (Objects.equals(potentialCustomerBO.getSeeFlag(), Constant.FLAG_TRUE)) {
String enterpriseId = potentialCustomerBO.getEnterpriseId();
String clerkId = potentialCustomerBO.getClerkId();
String memberId = potentialCustomerBO.getMemberId();
interactRecordService.modifyFollowTime(enterpriseId, clerkId, memberId);
}
} }
/** /**
......
...@@ -269,6 +269,12 @@ public class MaterialServiceImpl implements MaterialService { ...@@ -269,6 +269,12 @@ public class MaterialServiceImpl implements MaterialService {
jp = qywxSuiteApiService.uploadAttachment(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), url, arr[count - 1], fileType.getCode() , selfFlag , qwDTO.getUrlHost()); jp = qywxSuiteApiService.uploadAttachment(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), url, arr[count - 1], fileType.getCode() , selfFlag , qwDTO.getUrlHost());
}else { }else {
// 群发上传 // 群发上传
if(!url.contains("?")) {
if(type == 2) {
url += "?imageView2/2/w/1080/h/10800/format/jpg";
}
logger.info("url={}",url);
}
jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), url, arr[count - 1], fileType.getCode() , selfFlag , qwDTO.getUrlHost()); jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), url, arr[count - 1], fileType.getCode() , selfFlag , qwDTO.getUrlHost());
} }
if (jp.getErrorCode() == 0) { if (jp.getErrorCode() == 0) {
......
...@@ -232,6 +232,10 @@ public class QwMomentPlanServiceImpl implements QwMomentPlanService { ...@@ -232,6 +232,10 @@ public class QwMomentPlanServiceImpl implements QwMomentPlanService {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("planId",planId) ; jsonObject.put("planId",planId) ;
jsonObject.put("clerkId",clerkId) ; jsonObject.put("clerkId",clerkId) ;
ClerkDTO clerk = this.clerkService.getclerkById(clerkId) ;
if(null != clerk) {
jsonObject.put("storeId", clerk.getStoreId());
}
NoticeMessageUtil.sendNoticeMessage(enterpriseId,clerkId,messageType,null,map,jsonObject); NoticeMessageUtil.sendNoticeMessage(enterpriseId,clerkId,messageType,null,map,jsonObject);
} }
......
...@@ -114,6 +114,9 @@ public class GroupChatPlanApiServiceImpl implements GroupChatPlanApiService { ...@@ -114,6 +114,9 @@ public class GroupChatPlanApiServiceImpl implements GroupChatPlanApiService {
} }
Long planId = log.getPlanId() ; Long planId = log.getPlanId() ;
GroupChatPlanBO plan = this.groupChatPlanService.getById(planId) ; GroupChatPlanBO plan = this.groupChatPlanService.getById(planId) ;
if(null == plan) {
return ServiceResponse.failure("9999","计划不存在或已删除") ;
}
dto.setPlanName(plan.getName()); dto.setPlanName(plan.getName());
if(dto.getSendStatus()==1) { if(dto.getSendStatus()==1) {
if(plan.getSendFlag()==0 || plan.getEndTime().getTime() < System.currentTimeMillis()) { if(plan.getSendFlag()==0 || plan.getEndTime().getTime() < System.currentTimeMillis()) {
......
...@@ -2,14 +2,14 @@ package com.gic.haoban.manage.service.service.out.impl.content; ...@@ -2,14 +2,14 @@ package com.gic.haoban.manage.service.service.out.impl.content;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Constant;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil; import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.manage.api.dto.content.MemberLastInteractDTO; import com.gic.haoban.manage.api.dto.content.MemberLastInteractDTO;
import com.gic.haoban.manage.api.dto.qdto.content.InteractRecordQDTO; 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.*;
import com.gic.haoban.manage.api.enums.content.InteractRecordInfoDTO;
import com.gic.haoban.manage.api.service.content.InteractRecordApiService; 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.bo.content.InteractRecordBO;
import com.gic.haoban.manage.service.pojo.bo.content.MemberAttrChangeBO; import com.gic.haoban.manage.service.pojo.bo.content.MemberAttrChangeBO;
...@@ -29,6 +29,7 @@ import com.gic.order.api.dto.OrderSaveNotifyDTO; ...@@ -29,6 +29,7 @@ import com.gic.order.api.dto.OrderSaveNotifyDTO;
import com.gic.order.api.dto.resp.OrderInfoResp; import com.gic.order.api.dto.resp.OrderInfoResp;
import com.gic.order.api.service.member.MemberOrderReadApiService; import com.gic.order.api.service.member.MemberOrderReadApiService;
import com.gic.haoban.manage.service.util.EventUtils; import com.gic.haoban.manage.service.util.EventUtils;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -60,6 +61,60 @@ public class InteractRecordApiServiceImpl implements InteractRecordApiService { ...@@ -60,6 +61,60 @@ public class InteractRecordApiServiceImpl implements InteractRecordApiService {
@Autowired @Autowired
private MemberOrderReadApiService memberOrderReadApiService; private MemberOrderReadApiService memberOrderReadApiService;
private InteractRecordQO convertParam(InteractRecordQDTO interactRecordQDTO) {
InteractRecordQO searchQo = EntityUtil.changeEntityNew(InteractRecordQO.class, interactRecordQDTO);
Integer bizType = interactRecordQDTO.getBizTypeAggs();
if (bizType != null) {
if (Objects.equals(bizType, ShareBizType.MATERIAL.getCode())) {
searchQo.setBizTypeList(Lists.newArrayList(bizType));
} else if (Objects.equals(bizType, ShareBizType.GOODS.getCode())) {
searchQo.setBizTypeList(Lists.newArrayList(bizType, ShareBizType.MULTIPLE_GOODS.getCode()));
}
}
Integer channelSource = interactRecordQDTO.getChannelSource();
if (channelSource != null) {
searchQo.setChannelSourceList(Lists.newArrayList(channelSource));
}
Integer eventType = interactRecordQDTO.getEventTypeAggs();
if (eventType != null) {
if (Objects.equals(eventType, InteractRecordEventType.MATERIAL.getCode())) {
searchQo.setEventTypeList(Lists.newArrayList(MaterialInteractRecordEventType.VISIT_MATERIAL.getCode(),MaterialInteractRecordEventType.VISIT_PRODUCT.getCode()));
List<Integer> bizTypeList = Optional.ofNullable(searchQo.getBizTypeList()).orElse(new ArrayList<>());
bizTypeList.add(ShareBizType.MATERIAL.getCode());
searchQo.setBizTypeList(bizTypeList);
} else if (Objects.equals(bizType, ShareBizType.GOODS.getCode())) {
searchQo.setEventTypeList(Lists.newArrayList(MaterialInteractRecordEventType.VISIT_MATERIAL.getCode(),MaterialInteractRecordEventType.VISIT_PRODUCT.getCode()));
List<Integer> bizTypeList = Optional.ofNullable(searchQo.getBizTypeList()).orElse(new ArrayList<>());
bizTypeList.add(ShareBizType.GOODS.getCode());
bizTypeList.add(ShareBizType.MULTIPLE_GOODS.getCode());
searchQo.setBizTypeList(bizTypeList);
}else {
searchQo.setEventTypeList(Lists.newArrayList(eventType));
}
}
return searchQo;
}
private void convertResult(InteractRecordInfoDTO recordInfoDTO) {
Integer bizType = recordInfoDTO.getBizType();
Integer eventType = recordInfoDTO.getEventType();
if (Objects.equals(bizType, ShareBizType.MATERIAL.getCode())) {
recordInfoDTO.setBizTypeAggs(bizType);
} else {
recordInfoDTO.setBizTypeAggs(ShareBizType.GOODS.getCode());
}
if (Objects.equals(eventType, MaterialInteractRecordEventType.VISIT_MATERIAL.getCode())
|| Objects.equals(eventType, MaterialInteractRecordEventType.VISIT_PRODUCT.getCode())) {
if (Objects.equals(bizType, ShareBizType.MATERIAL.getCode())) {
recordInfoDTO.setEventTypeAggs(InteractRecordEventType.MATERIAL.getCode());
} else {
recordInfoDTO.setEventTypeAggs(InteractRecordEventType.PRODUCT.getCode());
}
}else {
recordInfoDTO.setEventTypeAggs(eventType);
}
}
/** /**
* 查询互动记录 * 查询互动记录
* *
...@@ -71,8 +126,7 @@ public class InteractRecordApiServiceImpl implements InteractRecordApiService { ...@@ -71,8 +126,7 @@ public class InteractRecordApiServiceImpl implements InteractRecordApiService {
Page<InteractRecordInfoDTO> result = new Page<>(); Page<InteractRecordInfoDTO> result = new Page<>();
result.setTotalCount(0); result.setTotalCount(0);
result.setResult(Collections.emptyList()); result.setResult(Collections.emptyList());
InteractRecordQO searchQo = new InteractRecordQO(); InteractRecordQO searchQo = convertParam(interactRecordQDTO);
BeanUtils.copyProperties(interactRecordQDTO, searchQo);
Page<InteractRecordBO> pageResult = interactRecordService.queryInteractRecordPage(searchQo); Page<InteractRecordBO> pageResult = interactRecordService.queryInteractRecordPage(searchQo);
if (pageResult == null || CollectionUtils.isEmpty(pageResult.getResult())) { if (pageResult == null || CollectionUtils.isEmpty(pageResult.getResult())) {
log.info("查询结果为空 {}", JSON.toJSONString(interactRecordQDTO)); log.info("查询结果为空 {}", JSON.toJSONString(interactRecordQDTO));
...@@ -98,12 +152,14 @@ public class InteractRecordApiServiceImpl implements InteractRecordApiService { ...@@ -98,12 +152,14 @@ public class InteractRecordApiServiceImpl implements InteractRecordApiService {
if (item.getLastAccessTime() != null) { if (item.getLastAccessTime() != null) {
temp.setCreateTime(item.getLastAccessTime()); temp.setCreateTime(item.getLastAccessTime());
} }
temp.setRecordCreateTime(item.getCreateTime());
temp.setInteractRecordId(item.getId()); temp.setInteractRecordId(item.getId());
if (item.getExtendInfo() != null) { if (item.getExtendInfo() != null) {
InteractRecordExtendInfoDTO extendInfo = new InteractRecordExtendInfoDTO(); InteractRecordExtendInfoDTO extendInfo = new InteractRecordExtendInfoDTO();
BeanUtils.copyProperties(item.getExtendInfo(), extendInfo); BeanUtils.copyProperties(item.getExtendInfo(), extendInfo);
temp.setExtendInfo(extendInfo); temp.setExtendInfo(extendInfo);
} }
convertResult(temp);
return temp; return temp;
} }
......
...@@ -302,6 +302,7 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic ...@@ -302,6 +302,7 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
} }
for (String enterpriseId : enterpriseIds) { for (String enterpriseId : enterpriseIds) {
Integer potentialNotifyInterval = 30; Integer potentialNotifyInterval = 30;
Date notifyStartTime = null;
ServiceResponse<ContentSettingDTO> response = contentSettingApiService.queryContentSettingInfo(enterpriseId); ServiceResponse<ContentSettingDTO> response = contentSettingApiService.queryContentSettingInfo(enterpriseId);
if (response.isSuccess() && response.getResult() != null) { if (response.isSuccess() && response.getResult() != null) {
potentialNotifyInterval = response.getResult().getPotentialNotifyInterval(); potentialNotifyInterval = response.getResult().getPotentialNotifyInterval();
...@@ -309,13 +310,15 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic ...@@ -309,13 +310,15 @@ public class QywxGroupMsgTaskApiServiceImpl implements QywxGroupMsgTaskApiServic
if (potentialNotifyInterval <= 0 || cn.hutool.core.date.DateUtil.minute(now) % potentialNotifyInterval != 0) { if (potentialNotifyInterval <= 0 || cn.hutool.core.date.DateUtil.minute(now) % potentialNotifyInterval != 0) {
continue; continue;
} }
if (startTime == null) { if (startTime != null) {
startTime = cn.hutool.core.date.DateUtil.offsetMinute(now, -potentialNotifyInterval).toJdkDate(); notifyStartTime = startTime;
}else {
notifyStartTime = cn.hutool.core.date.DateUtil.offsetMinute(now, -potentialNotifyInterval).toJdkDate();
} }
log.info("销售线索执行eid:{},potentialNotifyInterval:{}", enterpriseId, potentialNotifyInterval); log.info("销售线索执行eid:{},potentialNotifyInterval:{}", enterpriseId, potentialNotifyInterval);
PotentialCustomerNotifyContext context = PotentialCustomerNotifyContext.builder() PotentialCustomerNotifyContext context = PotentialCustomerNotifyContext.builder()
.enterpriseId(enterpriseId) .enterpriseId(enterpriseId)
.startTime(startTime) .startTime(notifyStartTime)
.endTime(now) .endTime(now)
.build(); .build();
potentialCustomerService.sendPotentialCustomerNotice(context); potentialCustomerService.sendPotentialCustomerNotice(context);
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="lastAccessTime" column="last_access_time" jdbcType="TIMESTAMP"/> <result property="lastAccessTime" column="last_access_time" jdbcType="TIMESTAMP"/>
<result property="followTime" column="follow_time" jdbcType="TIMESTAMP"/>
</resultMap> </resultMap>
<sql id="baseSql"> <sql id="baseSql">
...@@ -43,7 +44,8 @@ ...@@ -43,7 +44,8 @@
extend_info, extend_info,
create_time, create_time,
update_time, update_time,
last_access_time last_access_time,
follow_time
</sql> </sql>
<!--查询单个--> <!--查询单个-->
...@@ -66,7 +68,8 @@ ...@@ -66,7 +68,8 @@
extend_info, extend_info,
create_time, create_time,
update_time, update_time,
last_access_time last_access_time,
follow_time
from tab_haoban_interact_record from tab_haoban_interact_record
where id = #{id} where id = #{id}
</select> </select>
...@@ -75,7 +78,7 @@ ...@@ -75,7 +78,7 @@
<select id="queryAllByLimit" resultMap="TabHaobanInteractRecordMap"> <select id="queryAllByLimit" resultMap="TabHaobanInteractRecordMap">
select select
id, enterprise_id, member_id, union_id, clerk_id, trace_id, biz_id, biz_type, store_id, channel_source,share_source, id, enterprise_id, member_id, union_id, clerk_id, trace_id, biz_id, biz_type, store_id, channel_source,share_source,
event_type, duration_time, times, delete_flag, extend_info, create_time, update_time,last_access_time event_type, duration_time, times, delete_flag, extend_info, create_time, update_time,last_access_time,follow_time
from tab_haoban_interact_record from tab_haoban_interact_record
<where> <where>
<if test="clerkId != null and clerkId != ''"> <if test="clerkId != null and clerkId != ''">
...@@ -254,7 +257,10 @@ ...@@ -254,7 +257,10 @@
update_time = #{updateTime}, update_time = #{updateTime},
</if> </if>
<if test="lastAccessTime != null"> <if test="lastAccessTime != null">
last_access_time = #{lastAccessTime} last_access_time = #{lastAccessTime},
</if>
<if test="followTime != null">
follow_time = #{followTime}
</if> </if>
</set> </set>
where id = #{id} where id = #{id}
...@@ -278,6 +284,11 @@ ...@@ -278,6 +284,11 @@
from tab_haoban_interact_record from tab_haoban_interact_record
<where> <where>
delete_flag = 0 delete_flag = 0
<if test="filterNull != null and filterNull == 1 ">
and member_id != '' and member_id is not null and member_id != '-1'
and store_id != '' and store_id is not null and store_id != '-1'
and clerk_id != '' and clerk_id is not null and clerk_id != '-1'
</if>
<if test="enterpriseId != null and enterpriseId != ''"> <if test="enterpriseId != null and enterpriseId != ''">
and enterprise_id = #{enterpriseId} and enterprise_id = #{enterpriseId}
</if> </if>
...@@ -299,8 +310,31 @@ ...@@ -299,8 +310,31 @@
<if test="bizId != null and bizId != ''"> <if test="bizId != null and bizId != ''">
and biz_id = #{bizId} and biz_id = #{bizId}
</if> </if>
<if test="channelSourceList != null and channelSourceList.size > 0">
AND channel_source IN
<foreach collection="channelSourceList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="bizTypeList != null and bizTypeList.size > 0">
AND biz_type IN
<foreach collection="bizTypeList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="eventTypeList != null and eventTypeList.size > 0">
AND event_type IN
<foreach collection="eventTypeList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where> </where>
order by last_access_time desc, id desc <if test="orderBy != null and orderBy != ''">
ORDER BY ${orderBy} DESC,id DESC
</if>
<if test="orderBy == null or orderBy == ''">
ORDER BY last_access_time DESC, id DESC
</if>
</select> </select>
<select id="staticsClerkInteractRecordNew" resultType="com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerStaticsBO"> <select id="staticsClerkInteractRecordNew" resultType="com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerStaticsBO">
...@@ -367,5 +401,13 @@ ...@@ -367,5 +401,13 @@
where enterprise_id = #{enterpriseId} and union_id = #{oldUnionId} and delete_flag = 0 where enterprise_id = #{enterpriseId} and union_id = #{oldUnionId} and delete_flag = 0
</update> </update>
<update id="modifyFollowTimeBatch">
update tab_haoban_interact_record
set follow_time = now()
where enterprise_id = #{enterpriseId} and clerk_id = #{clerkId} and member_id = #{memberId}
and create_time >= #{limitTime} and follow_time is null
and delete_flag = 0
</update>
</mapper> </mapper>
...@@ -2,8 +2,12 @@ import cn.hutool.crypto.digest.MD5; ...@@ -2,8 +2,12 @@ import cn.hutool.crypto.digest.MD5;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.business.order.dto.ordermanage.OrderOutInfoDTO;
import com.gic.business.order.qdto.ordermanage.OrderInfoQDTO;
import com.gic.business.order.service.ordermanage.OrderInfoOutApiService;
import com.gic.enterprise.api.constant.EnterpriseServiceEnum; import com.gic.enterprise.api.constant.EnterpriseServiceEnum;
import com.gic.enterprise.api.dto.enterprise.EnterpriseUsingStatusDTO; import com.gic.enterprise.api.dto.enterprise.EnterpriseUsingStatusDTO;
import com.gic.enterprise.api.enums.PlatformChannelEnum;
import com.gic.enterprise.api.service.EnterpriseUseForbidService; import com.gic.enterprise.api.service.EnterpriseUseForbidService;
import com.gic.haoban.manage.api.dto.chat.ChatOwnerTotalDTO; import com.gic.haoban.manage.api.dto.chat.ChatOwnerTotalDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatPlanSearchQDTO; import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatPlanSearchQDTO;
...@@ -14,21 +18,32 @@ import com.gic.haoban.manage.api.enums.content.TriggerCustomerChannelType; ...@@ -14,21 +18,32 @@ import com.gic.haoban.manage.api.enums.content.TriggerCustomerChannelType;
import com.gic.haoban.manage.api.service.content.InteractRecordApiService; import com.gic.haoban.manage.api.service.content.InteractRecordApiService;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatPlanOwnerLogMapper; import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatPlanOwnerLogMapper;
import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO; 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.MemberAttrChangeBO; import com.gic.haoban.manage.service.pojo.bo.content.MemberAttrChangeBO;
import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO; 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.pojo.qo.content.InteractRecordQO;
import com.gic.haoban.manage.service.service.content.InteractRecordService; import com.gic.haoban.manage.service.service.content.InteractRecordService;
import com.gic.haoban.manage.service.service.content.message.InteractRecordMessageService; import com.gic.haoban.manage.service.service.content.message.InteractRecordMessageService;
import com.gic.order.api.dto.OrderDTO;
import com.gic.order.api.dto.req.AllChannelOrderSearchReq;
import com.gic.order.api.dto.req.MemberOrderOptional;
import com.gic.order.api.dto.req.OrderFindQDTO;
import com.gic.order.api.dto.resp.OrderInfoResp;
import com.gic.order.api.service.member.MemberOrderReadApiService;
import com.gic.orderecommerce.api.dto.EorderDTO;
import com.gic.orderecommerce.api.service.EcommerceOrderOutputApiService;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Collections; import java.util.*;
import java.util.Date; import java.util.concurrent.ExecutorService;
import java.util.List; import java.util.concurrent.Executors;
import java.util.UUID; import java.util.concurrent.TimeUnit;
/** /**
* @Author MUSI * @Author MUSI
...@@ -48,6 +63,12 @@ public class InteractRecordTest { ...@@ -48,6 +63,12 @@ public class InteractRecordTest {
InteractRecordApiService interactRecordApiService; InteractRecordApiService interactRecordApiService;
@Autowired @Autowired
private EnterpriseUseForbidService enterpriseUseForbidService; private EnterpriseUseForbidService enterpriseUseForbidService;
@Autowired
private OrderInfoOutApiService orderInfoOutApiService;
@Autowired
private EcommerceOrderOutputApiService ecommerceOrderOutputApiService;
@Autowired
private MemberOrderReadApiService memberOrderReadApiService;
@Test @Test
public void test2222() { public void test2222() {
...@@ -116,4 +137,70 @@ public class InteractRecordTest { ...@@ -116,4 +137,70 @@ public class InteractRecordTest {
memberAttrChangeBO.setOpt(MemberAttrChangeBO.MemberChangeOpt.MINI_APP_AUTHORIZED.getCode()); memberAttrChangeBO.setOpt(MemberAttrChangeBO.MemberChangeOpt.MINI_APP_AUTHORIZED.getCode());
interactRecordApiService.memberChangeMQ(JSON.toJSONString(memberAttrChangeBO)); interactRecordApiService.memberChangeMQ(JSON.toJSONString(memberAttrChangeBO));
} }
@Test
public void fixOrderChannelCode() throws Exception{
ExecutorService executorService = Executors.newFixedThreadPool(10);
InteractRecordQO interactRecordQO = new InteractRecordQO();
interactRecordQO.setEnterpriseId("ff8080817af2def7017b146da4d212c4");
interactRecordQO.setPageNum(1);
interactRecordQO.setPageSize(100000);
interactRecordQO.setStartTime(new Date("2020/01/01"));
interactRecordQO.setEndTime(new Date("2026/01/01"));
interactRecordQO.setEventTypeList(Lists.newArrayList(MaterialInteractRecordEventType.ORDER.getCode()));
Page<InteractRecordBO> interactRecordBOPage = interactRecordService.queryInteractRecordPage(interactRecordQO);
List<InteractRecordBO> result = interactRecordBOPage.getResult();
for (InteractRecordBO interactRecordBO : result) {
executorService.execute(()->{
InteractRecordExtendInfoBO extendInfo = interactRecordBO.getExtendInfo();
if (extendInfo == null) {
return;
}
List<InteractRecordExtendInfoBO.ExtendOrderInfo> extendOrderInfos = extendInfo.getExtendOrderInfos();
for (InteractRecordExtendInfoBO.ExtendOrderInfo extendOrderInfo : extendOrderInfos) {
OrderInfoQDTO orderInfoQDTO = new OrderInfoQDTO();
String enterpriseId = interactRecordBO.getEnterpriseId();
String orderNumber = extendOrderInfo.getOrderNumber();
String memberId = interactRecordBO.getMemberId();
orderInfoQDTO.setOrderNumber(orderNumber);
orderInfoQDTO.setEnterpriseId(enterpriseId);
String orderId = "";
String channelCode = "";
ServiceResponse<OrderOutInfoDTO> serviceResponse = orderInfoOutApiService.queryOrderInfo(orderInfoQDTO);
if (serviceResponse.getResult() == null) {
EorderDTO eorderDTO = ecommerceOrderOutputApiService.getEorderByMemberIdAndOrderNumber(memberId, PlatformChannelEnum.C_WEIMOB.getOrderChannelCodeOld(),orderNumber,enterpriseId);
if (eorderDTO == null) {
eorderDTO = ecommerceOrderOutputApiService.getEorderByMemberIdAndOrderNumber(memberId, PlatformChannelEnum.C_BRAND_MALL.getOrderChannelCodeOld(),orderNumber,enterpriseId);
}
if (eorderDTO == null) {
ServiceResponse<OrderDTO> ipos = memberOrderReadApiService.queryByChannelOrderId(enterpriseId, memberId, "weimob", orderNumber);
OrderDTO result1 = ipos.getResult();
if (result1 != null) {
orderId = result1.getOrderId();
channelCode = PlatformChannelEnum.C_POS.getChannelCode();
}
}else {
orderId = eorderDTO.getEorderId();
channelCode = PlatformChannelEnum.getEnumByChannelCodeOrder(eorderDTO.getChannelCode()).getChannelCode();
}
}else {
orderId = serviceResponse.getResult().getOrderId();
channelCode = PlatformChannelEnum.C_WECHAT_MINI.getChannelCode();
}
if (StringUtils.isAnyBlank(orderId, channelCode)) {
continue;
}
extendOrderInfo.setOrderId(orderId);
extendOrderInfo.setChannelCode(channelCode);
}
extendInfo.setExtendOrderInfos(extendOrderInfos);
InteractRecordBO update = new InteractRecordBO();
update.setId(interactRecordBO.getId());
update.setExtendInfo(extendInfo);
interactRecordService.saveOrUpdateInteractRecord(update);
});
}
executorService.awaitTermination(10, TimeUnit.HOURS);
}
} }
...@@ -1560,6 +1560,9 @@ public class WxStaffController extends WebBaseController { ...@@ -1560,6 +1560,9 @@ public class WxStaffController extends WebBaseController {
*/ */
@RequestMapping(value = "/queryMenuCodesByClerkType", method = RequestMethod.GET) @RequestMapping(value = "/queryMenuCodesByClerkType", method = RequestMethod.GET)
public RestResponse<HaobanRoleDTO> queryMenuByClerkType(Integer clerkType, String staffId, String wxEnterpriseId , String enterpriseId) { public RestResponse<HaobanRoleDTO> queryMenuByClerkType(Integer clerkType, String staffId, String wxEnterpriseId , String enterpriseId) {
if(StringUtils.isBlank(wxEnterpriseId) || wxEnterpriseId.equals("-1")) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_2.getCode()), HaoBanErrCode.ERR_2.getMsg());
}
if (clerkType == null) { if (clerkType == null) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_2.getCode()), HaoBanErrCode.ERR_2.getMsg()); return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_2.getCode()), HaoBanErrCode.ERR_2.getMsg());
} }
......
...@@ -387,7 +387,7 @@ public class DataController { ...@@ -387,7 +387,7 @@ public class DataController {
apiParam.setIsClerk(1); apiParam.setIsClerk(1);
} }
return handle(getHandel(qo, "data_sales_perf_real_time_overview_hb", return handle(getHandel(qo, Objects.equals(qo.getApiParam().getUrlType(), "sales_data") ? "data_sales_perf_real_time_overview_hb" : "data_sales_perf_real_time_overview_hb_home",
JSONObject.toJSONString(qo.getApiParam()))); JSONObject.toJSONString(qo.getApiParam())));
} }
......
package com.gic.haoban.manage.web.qo.data; package com.gic.haoban.manage.web.qo.data;
import lombok.Data; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.ToString; import lombok.ToString;
import java.io.Serializable; import java.io.Serializable;
...@@ -10,6 +10,7 @@ import java.io.Serializable; ...@@ -10,6 +10,7 @@ import java.io.Serializable;
* @Date 2024/4/29 15:29 * @Date 2024/4/29 15:29
*/ */
@ToString @ToString
@JsonIgnoreProperties(ignoreUnknown = true)
public class StoreRealTimeSalesApiQO implements Serializable { public class StoreRealTimeSalesApiQO implements Serializable {
private String storeId; private String storeId;
...@@ -33,6 +34,19 @@ public class StoreRealTimeSalesApiQO implements Serializable { ...@@ -33,6 +34,19 @@ public class StoreRealTimeSalesApiQO implements Serializable {
*/ */
private Integer isClerk; private Integer isClerk;
/**
* 特殊参数,不知道有啥用
*/
private String urlType;
public String getUrlType() {
return urlType;
}
public void setUrlType(String urlType) {
this.urlType = urlType;
}
public String getStoreId() { public String getStoreId() {
return storeId; return storeId;
} }
......
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