| @@ -0,0 +1,122 @@ | |||||
| package com.iformall.schedule; | |||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.google.common.collect.ImmutableListMultimap; | |||||
| import com.google.common.collect.Multimaps; | |||||
| import com.iformall.domain.po.invest.*; | |||||
| import com.iformall.domain.vo.invest.InvestCustomerVo; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.service.invest.*; | |||||
| import com.iformall.utils.DateUtils; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.scheduling.annotation.Scheduled; | |||||
| import org.springframework.stereotype.Component; | |||||
| import org.springframework.util.CollectionUtils; | |||||
| import java.util.*; | |||||
| @Component | |||||
| public class InvestSchedule { | |||||
| @Autowired | |||||
| InvestBizService bizService; | |||||
| @Autowired | |||||
| InvestTaskService taskService; | |||||
| @Autowired | |||||
| InvestMessageService messageService; | |||||
| @Autowired | |||||
| InvestDemandService demandService; | |||||
| @Autowired | |||||
| InvestCustomerService customerService; | |||||
| @Autowired | |||||
| InvestFollowRecordService followRecordService; | |||||
| @Scheduled(cron = "0 0 14 * * ?") // 每天凌晨1点盘点前一天的数据 | |||||
| //@Scheduled(cron = "*/30 * * * * ?") // 测试10秒中一次 | |||||
| public void messageSchedule() { | |||||
| //一个月内未完成提醒 | |||||
| taskMonthMessage(); | |||||
| //一周内未跟踪提醒 | |||||
| demandWeekMessage(); | |||||
| } | |||||
| private void taskMonthMessage() { | |||||
| //已经存在的提醒 | |||||
| List<InvestMessageEntity> taskMessages = messageService.listByTypeAndTag(EnumFollowType.TASK, EnumInvestMessageTag.TASK_CREATE); | |||||
| ImmutableListMultimap<Long, InvestMessageEntity> taskMessageUserIdMap = Multimaps.index(taskMessages, InvestMessageEntity::getOwner); | |||||
| //初始化时间条件 | |||||
| Calendar start = Calendar.getInstance(); | |||||
| Calendar end = Calendar.getInstance(); | |||||
| end.add(Calendar.MONTH, 1); | |||||
| //查询满足条件 | |||||
| List<InvestTaskEntity> tasks = taskService.listByStatusAndTime(Arrays.asList(EnumTaskStatus.INTENTION, EnumTaskStatus.NEGOTIATING), start.getTime(), end.getTime()); | |||||
| for (InvestTaskEntity task : tasks) { | |||||
| String owner = task.getOwner(); | |||||
| if (StringUtils.isEmpty(owner)) { | |||||
| continue; | |||||
| } | |||||
| List<Long> ownerArray = JSONArray.parseArray(owner, Long.class); | |||||
| for (Long ownerId : ownerArray) { | |||||
| List<InvestMessageEntity> messageList = taskMessageUserIdMap.get(ownerId); | |||||
| if (CollectionUtils.isEmpty(messageList)) { | |||||
| continue; | |||||
| } | |||||
| for (InvestMessageEntity messageEntity : messageList) { | |||||
| if (messageEntity.getTid().equals(task.getId())) { | |||||
| continue; | |||||
| } | |||||
| String message = String.format(EnumInvestMessageType.TASK_REMIND.getInfo(), task.getId(), DateUtils.format(task.getLastTime())); | |||||
| messageService.saveBatchMessage(ownerArray, message, EnumInvestMessageTag.TASK_MONTH, EnumFollowType.TASK, task.getId()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| private void demandWeekMessage() { | |||||
| //已经存在的提醒 | |||||
| List<InvestMessageEntity> demandMessages = messageService.listByTypeAndTag(EnumFollowType.DEMAND, EnumInvestMessageTag.CUSTOMER_WEEK); | |||||
| ImmutableListMultimap<Long, InvestMessageEntity> demandMessageUserIdMap = Multimaps.index(demandMessages, InvestMessageEntity::getOwner); | |||||
| //初始化时间条件 | |||||
| Calendar start = Calendar.getInstance(); | |||||
| start.add(Calendar.DAY_OF_YEAR, 7); | |||||
| //查询跟踪列表 | |||||
| List<InvestFollowRecordEntity> follows = followRecordService.listByTime(EnumFollowType.DEMAND, start.getTime()); | |||||
| List<InvestCustomerVo> demands = customerService.listByIds(InvestHelper.getIds(follows, InvestFollowRecordEntity::getFollowId), Arrays.asList(EnumCustomerType.INTENTIONAL, EnumCustomerType.POTENTIAL)); | |||||
| /** | |||||
| * 已经已经提醒过的用户 | |||||
| */ | |||||
| List<String> userDemandFlag = new ArrayList<>(); | |||||
| for (InvestCustomerVo demand : demands) { | |||||
| Long owner = demand.getDemandOwner(); | |||||
| if (Objects.isNull(owner)) { | |||||
| continue; | |||||
| } | |||||
| List<InvestMessageEntity> messageList = demandMessageUserIdMap.get(owner); | |||||
| if (CollectionUtils.isEmpty(messageList)) { | |||||
| continue; | |||||
| } | |||||
| for (InvestMessageEntity messageEntity : messageList) { | |||||
| if (messageEntity.getTid().equals(messageEntity.getId())) { | |||||
| continue; | |||||
| } | |||||
| String userDemandFlagItem = StringUtils.join(messageEntity.getOwner(), messageEntity.getId()); | |||||
| //已经提醒过的用户不在提醒 | |||||
| if (userDemandFlag.contains(userDemandFlagItem)) { | |||||
| continue; | |||||
| } | |||||
| String message = String.format(EnumInvestMessageType.COSTOMER_REMIND.getInfo(), demand.getId()); | |||||
| messageService.saveBatchMessage(Arrays.asList(owner), message, EnumInvestMessageTag.CUSTOMER_WEEK, EnumFollowType.DEMAND, demand.getId()); | |||||
| userDemandFlag.add(userDemandFlagItem); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -3,6 +3,7 @@ package com.iformall.domain.po.invest; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.fasterxml.jackson.annotation.JsonIgnore; | import com.fasterxml.jackson.annotation.JsonIgnore; | ||||
| import com.iformall.enums.EnumFollowType; | import com.iformall.enums.EnumFollowType; | ||||
| import com.iformall.enums.EnumInvestMessageTag; | |||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| @@ -36,6 +37,14 @@ public class InvestMessageEntity extends InvestBaseEntity { | |||||
| */ | */ | ||||
| @io.swagger.annotations.ApiModelProperty(value = "数据类型:0-招商任务;1-客户需求", name = "type") | @io.swagger.annotations.ApiModelProperty(value = "数据类型:0-招商任务;1-客户需求", name = "type") | ||||
| private EnumFollowType type; | private EnumFollowType type; | ||||
| /** | |||||
| * 消息标签:0-创建任务提醒;1-创建客户提醒;2-一个月内没完成任务;3-一周没有跟进客户 | |||||
| */ | |||||
| @JsonIgnore | |||||
| @io.swagger.annotations.ApiModelProperty(value = "消息标签:0-创建任务提醒;1-创建客户提醒;2-一个月内没完成任务;3-一周没有跟进客户", name = "tag") | |||||
| private EnumInvestMessageTag tag; | |||||
| /** | /** | ||||
| * 消息内容 | * 消息内容 | ||||
| */ | */ | ||||
| @@ -0,0 +1,19 @@ | |||||
| package com.iformall.domain.vo.invest; | |||||
| import com.iformall.domain.po.invest.InvestCustomerEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| @Data | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class InvestCustomerVo extends InvestCustomerEntity { | |||||
| /** | |||||
| * 负责人 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "负责人", name = "owner") | |||||
| private Long demandId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "客户需求负责人", name = "demandOwner") | |||||
| private Long demandOwner; | |||||
| } | |||||
| @@ -17,7 +17,7 @@ public class InvestRemindQuery extends InvestPageQuery { | |||||
| private Long ownerId; | private Long ownerId; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "预约时间", name = "dateType") | @io.swagger.annotations.ApiModelProperty(value = "预约时间", name = "dateType") | ||||
| private EnumRemindDateType dateType; | private EnumRemindDateType dateType; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "预约时间", name = "dateType",example = "2018-10-01 00:00:00") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "预约时间", name = "remindDate",example = "2018-10-01 00:00:00") | |||||
| private Date remindDate; | private Date remindDate; | ||||
| } | } | ||||
| @@ -0,0 +1,42 @@ | |||||
| package com.iformall.enums; | |||||
| import com.baomidou.mybatisplus.annotation.EnumValue; | |||||
| import com.fasterxml.jackson.annotation.JsonValue; | |||||
| /** | |||||
| * 消息标签:0-创建任务;1-创建客户;2-一个月内没完成任务;3-一周没有跟进客户 | |||||
| */ | |||||
| public enum EnumInvestMessageTag { | |||||
| TASK_CREATE(0, "创建任务"), | |||||
| CUSTOMER_CREATE(1, "创建客户"), | |||||
| TASK_MONTH(2, "一个月内没完成任务"), | |||||
| CUSTOMER_WEEK(3, "一周没有跟进客户"), | |||||
| ; | |||||
| public static EnumInvestMessageTag getEnum(Integer code) { | |||||
| for (EnumInvestMessageTag value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| @EnumValue | |||||
| private final Integer code; | |||||
| private final String info; | |||||
| EnumInvestMessageTag(Integer code, String info) { | |||||
| this.code = code; | |||||
| this.info = info; | |||||
| } | |||||
| @JsonValue | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getInfo() { | |||||
| return info; | |||||
| } | |||||
| } | |||||
| @@ -2,8 +2,14 @@ package com.iformall.mapper; | |||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
| import com.iformall.domain.po.invest.InvestCustomerEntity; | import com.iformall.domain.po.invest.InvestCustomerEntity; | ||||
| import com.iformall.domain.vo.invest.InvestCustomerVo; | |||||
| import com.iformall.enums.EnumCustomerType; | |||||
| import org.apache.ibatis.annotations.Mapper; | import org.apache.ibatis.annotations.Mapper; | ||||
| import java.io.Serializable; | |||||
| import java.util.Collection; | |||||
| import java.util.List; | |||||
| /** | /** | ||||
| * 客户列表 | * 客户列表 | ||||
| * | * | ||||
| @@ -13,5 +19,6 @@ import org.apache.ibatis.annotations.Mapper; | |||||
| */ | */ | ||||
| @Mapper | @Mapper | ||||
| public interface InvestCustomerDao extends BaseMapper<InvestCustomerEntity> { | public interface InvestCustomerDao extends BaseMapper<InvestCustomerEntity> { | ||||
| List<InvestCustomerVo> listByIds(Collection<? extends Serializable> ids, List<EnumCustomerType> type) ; | |||||
| } | } | ||||
| @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
| import com.iformall.domain.vo.invest.InvestPageQuery; | import com.iformall.domain.vo.invest.InvestPageQuery; | ||||
| import com.iformall.domain.vo.invest.InvestPageResult; | import com.iformall.domain.vo.invest.InvestPageResult; | ||||
| import com.iformall.enums.EnumFollowType; | import com.iformall.enums.EnumFollowType; | ||||
| import com.iformall.enums.EnumInvestMessageTag; | |||||
| import com.iformall.enums.EnumInvestMessageType; | import com.iformall.enums.EnumInvestMessageType; | ||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| @@ -32,7 +33,7 @@ public interface InvestBaseService<T> { | |||||
| * @param tid | * @param tid | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| default boolean saveBatchMessage(List<Long> ownerArray, EnumInvestMessageType message, EnumFollowType type, Long tid) { | |||||
| default boolean saveBatchMessage(List<Long> ownerArray, String message, EnumInvestMessageTag tag, EnumFollowType type, Long tid) { | |||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| @@ -2,8 +2,14 @@ package com.iformall.service.invest; | |||||
| import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||
| import com.iformall.domain.po.invest.InvestCustomerEntity; | import com.iformall.domain.po.invest.InvestCustomerEntity; | ||||
| import com.iformall.domain.vo.invest.InvestCustomerVo; | |||||
| import com.iformall.domain.vo.invest.InvestPageQuery; | import com.iformall.domain.vo.invest.InvestPageQuery; | ||||
| import com.iformall.domain.vo.invest.InvestPageResult; | import com.iformall.domain.vo.invest.InvestPageResult; | ||||
| import com.iformall.enums.EnumCustomerType; | |||||
| import java.io.Serializable; | |||||
| import java.util.Collection; | |||||
| import java.util.List; | |||||
| /** | /** | ||||
| * 客户列表 | * 客户列表 | ||||
| @@ -15,5 +21,8 @@ import com.iformall.domain.vo.invest.InvestPageResult; | |||||
| public interface InvestCustomerService extends IService<InvestCustomerEntity>,InvestBaseService<InvestCustomerEntity> { | public interface InvestCustomerService extends IService<InvestCustomerEntity>,InvestBaseService<InvestCustomerEntity> { | ||||
| InvestPageResult<InvestCustomerEntity> queryPage(InvestPageQuery<InvestCustomerEntity> params); | InvestPageResult<InvestCustomerEntity> queryPage(InvestPageQuery<InvestCustomerEntity> params); | ||||
| List<InvestCustomerVo> listByIds(Collection<? extends Serializable> idList, List<EnumCustomerType> type) ; | |||||
| } | } | ||||
| @@ -4,6 +4,10 @@ import com.baomidou.mybatisplus.extension.service.IService; | |||||
| import com.iformall.domain.po.invest.InvestFollowRecordEntity; | import com.iformall.domain.po.invest.InvestFollowRecordEntity; | ||||
| import com.iformall.domain.vo.invest.InvestPageQuery; | import com.iformall.domain.vo.invest.InvestPageQuery; | ||||
| import com.iformall.domain.vo.invest.InvestPageResult; | import com.iformall.domain.vo.invest.InvestPageResult; | ||||
| import com.iformall.enums.EnumFollowType; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| /** | /** | ||||
| * 跟踪记录 | * 跟踪记录 | ||||
| @@ -15,5 +19,7 @@ import com.iformall.domain.vo.invest.InvestPageResult; | |||||
| public interface InvestFollowRecordService extends IService<InvestFollowRecordEntity>,InvestBaseService<InvestFollowRecordEntity> { | public interface InvestFollowRecordService extends IService<InvestFollowRecordEntity>,InvestBaseService<InvestFollowRecordEntity> { | ||||
| InvestPageResult<InvestFollowRecordEntity> queryPage(InvestPageQuery<InvestFollowRecordEntity> params); | InvestPageResult<InvestFollowRecordEntity> queryPage(InvestPageQuery<InvestFollowRecordEntity> params); | ||||
| List<InvestFollowRecordEntity> listByTime(EnumFollowType followType, Date start); | |||||
| } | } | ||||
| @@ -2,6 +2,8 @@ package com.iformall.service.invest; | |||||
| import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||
| import com.iformall.domain.po.invest.InvestMessageEntity; | import com.iformall.domain.po.invest.InvestMessageEntity; | ||||
| import com.iformall.enums.EnumFollowType; | |||||
| import com.iformall.enums.EnumInvestMessageTag; | |||||
| import com.iformall.enums.EnumInvestMessageType; | import com.iformall.enums.EnumInvestMessageType; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -15,5 +17,7 @@ import java.util.List; | |||||
| */ | */ | ||||
| public interface InvestMessageService extends IService<InvestMessageEntity>,InvestBaseService<InvestMessageEntity> { | public interface InvestMessageService extends IService<InvestMessageEntity>,InvestBaseService<InvestMessageEntity> { | ||||
| boolean removeAll() ; | boolean removeAll() ; | ||||
| List<InvestMessageEntity> listByTypeAndTag(EnumFollowType type, EnumInvestMessageTag tag) ; | |||||
| } | } | ||||
| @@ -2,6 +2,10 @@ package com.iformall.service.invest; | |||||
| import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||
| import com.iformall.domain.po.invest.InvestTaskEntity; | import com.iformall.domain.po.invest.InvestTaskEntity; | ||||
| import com.iformall.enums.EnumTaskStatus; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| /** | /** | ||||
| * 招商任务 | * 招商任务 | ||||
| @@ -12,5 +16,6 @@ import com.iformall.domain.po.invest.InvestTaskEntity; | |||||
| */ | */ | ||||
| public interface InvestTaskService extends IService<InvestTaskEntity>,InvestBaseService<InvestTaskEntity> { | public interface InvestTaskService extends IService<InvestTaskEntity>,InvestBaseService<InvestTaskEntity> { | ||||
| List<InvestTaskEntity> listByStatusAndTime(List<EnumTaskStatus> status, Date start, Date end); | |||||
| } | } | ||||
| @@ -13,10 +13,7 @@ import com.iformall.domain.po.invest.*; | |||||
| import com.iformall.domain.vo.invest.InvestPageQuery; | import com.iformall.domain.vo.invest.InvestPageQuery; | ||||
| import com.iformall.domain.vo.invest.InvestPageResult; | import com.iformall.domain.vo.invest.InvestPageResult; | ||||
| import com.iformall.domain.vo.invest.InvestUserContext; | import com.iformall.domain.vo.invest.InvestUserContext; | ||||
| import com.iformall.enums.EnumFollowType; | |||||
| import com.iformall.enums.EnumInvestMessageType; | |||||
| import com.iformall.enums.EnumInvestType; | |||||
| import com.iformall.enums.EnumShopStatus; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.MallUserInfoService; | import com.iformall.service.MallUserInfoService; | ||||
| import com.iformall.service.WxBrandService; | import com.iformall.service.WxBrandService; | ||||
| @@ -107,7 +104,7 @@ public class InvestBaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceIm | |||||
| } | } | ||||
| @Override | @Override | ||||
| public boolean saveBatchMessage(List<Long> ownerArray, EnumInvestMessageType message, EnumFollowType type, Long tid) { | |||||
| public boolean saveBatchMessage(List<Long> ownerArray, String message, EnumInvestMessageTag tag, EnumFollowType type, Long tid) { | |||||
| if (CollectionUtils.isEmpty(ownerArray)) { | if (CollectionUtils.isEmpty(ownerArray)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -127,7 +124,8 @@ public class InvestBaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceIm | |||||
| messageEntity.setTid(tid); | messageEntity.setTid(tid); | ||||
| messageEntity.setType(type); | messageEntity.setType(type); | ||||
| messageEntity.setTenantId(InvestUserContext.getUser().getTenantId()); | messageEntity.setTenantId(InvestUserContext.getUser().getTenantId()); | ||||
| messageEntity.setMessage(EnumInvestMessageType.message(message)); | |||||
| messageEntity.setMessage(message); | |||||
| messageEntity.setTag(tag); | |||||
| messageEntityList.add(messageEntity); | messageEntityList.add(messageEntity); | ||||
| } | } | ||||
| return messageService.saveBatch(messageEntityList); | return messageService.saveBatch(messageEntityList); | ||||
| @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.TableLog; | import com.iformall.common.TableLog; | ||||
| import com.iformall.domain.po.invest.InvestCustomerEntity; | import com.iformall.domain.po.invest.InvestCustomerEntity; | ||||
| import com.iformall.domain.vo.invest.InvestCustomerVo; | |||||
| import com.iformall.enums.EnumCustomerType; | |||||
| import com.iformall.mapper.InvestCustomerDao; | import com.iformall.mapper.InvestCustomerDao; | ||||
| import com.iformall.service.WxBrandService; | import com.iformall.service.WxBrandService; | ||||
| import com.iformall.service.WxBusinessService; | import com.iformall.service.WxBusinessService; | ||||
| @@ -11,6 +13,9 @@ import com.iformall.service.invest.InvestCustomerService; | |||||
| 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.io.Serializable; | |||||
| import java.util.Collection; | |||||
| import java.util.List; | |||||
| import java.util.Objects; | import java.util.Objects; | ||||
| import static com.iformall.service.invest.InvestHelper.isTrue; | import static com.iformall.service.invest.InvestHelper.isTrue; | ||||
| @@ -69,4 +74,10 @@ public class InvestCustomerServiceImpl extends InvestBaseServiceImpl<InvestCusto | |||||
| notSupport(); | notSupport(); | ||||
| return false ; | return false ; | ||||
| } | } | ||||
| @Override | |||||
| public List<InvestCustomerVo> listByIds(Collection<? extends Serializable> idList, List<EnumCustomerType> type) { | |||||
| return getBaseMapper().listByIds(idList, type); | |||||
| } | |||||
| } | } | ||||
| @@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||||
| import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||||
| import com.iformall.common.TableLog; | import com.iformall.common.TableLog; | ||||
| import com.iformall.domain.po.invest.InvestDemandEntity; | import com.iformall.domain.po.invest.InvestDemandEntity; | ||||
| import com.iformall.enums.EnumCustomerType; | |||||
| import com.iformall.enums.EnumFollowType; | import com.iformall.enums.EnumFollowType; | ||||
| import com.iformall.enums.EnumInvestMessageTag; | |||||
| import com.iformall.enums.EnumInvestMessageType; | import com.iformall.enums.EnumInvestMessageType; | ||||
| import com.iformall.mapper.InvestDemandDao; | import com.iformall.mapper.InvestDemandDao; | ||||
| import com.iformall.service.MallUserInfoService; | import com.iformall.service.MallUserInfoService; | ||||
| @@ -14,9 +16,8 @@ import com.iformall.service.invest.InvestDemandService; | |||||
| 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.Arrays; | |||||
| import java.util.List; | |||||
| import java.util.Objects; | |||||
| import java.io.Serializable; | |||||
| import java.util.*; | |||||
| @Service | @Service | ||||
| @@ -57,7 +58,7 @@ public class InvestDemandServiceImpl extends InvestBaseServiceImpl<InvestDemandD | |||||
| Long owner = entity.getOwner(); | Long owner = entity.getOwner(); | ||||
| if (Objects.nonNull(owner)) { | if (Objects.nonNull(owner)) { | ||||
| List<Long> ownerArray = Arrays.asList(owner); | List<Long> ownerArray = Arrays.asList(owner); | ||||
| this.saveBatchMessage(ownerArray, EnumInvestMessageType.CUSTOMER_CREATE, EnumFollowType.DEMAND, entity.getId()); | |||||
| this.saveBatchMessage(ownerArray, EnumInvestMessageType.CUSTOMER_CREATE.getInfo(), EnumInvestMessageTag.CUSTOMER_CREATE, EnumFollowType.DEMAND, entity.getId()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -91,4 +92,5 @@ public class InvestDemandServiceImpl extends InvestBaseServiceImpl<InvestDemandD | |||||
| } | } | ||||
| return getOne(new LambdaUpdateWrapper<InvestDemandEntity>().eq(InvestDemandEntity::getCustomerId,customerId)) ; | return getOne(new LambdaUpdateWrapper<InvestDemandEntity>().eq(InvestDemandEntity::getCustomerId,customerId)) ; | ||||
| } | } | ||||
| } | } | ||||
| @@ -1,8 +1,10 @@ | |||||
| package com.iformall.service.invest.impl; | package com.iformall.service.invest.impl; | ||||
| import com.baomidou.mybatisplus.core.conditions.Wrapper; | import com.baomidou.mybatisplus.core.conditions.Wrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.domain.po.invest.InvestFollowRecordEntity; | import com.iformall.domain.po.invest.InvestFollowRecordEntity; | ||||
| import com.iformall.domain.po.invest.InvestTaskEntity; | |||||
| import com.iformall.domain.vo.invest.InvestPageQuery; | import com.iformall.domain.vo.invest.InvestPageQuery; | ||||
| import com.iformall.domain.vo.invest.InvestPageResult; | import com.iformall.domain.vo.invest.InvestPageResult; | ||||
| import com.iformall.domain.vo.invest.InvestUserContext; | import com.iformall.domain.vo.invest.InvestUserContext; | ||||
| @@ -15,6 +17,8 @@ import com.iformall.service.invest.InvestTaskService; | |||||
| 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.Date; | |||||
| import java.util.List; | |||||
| import java.util.Objects; | import java.util.Objects; | ||||
| @Service | @Service | ||||
| @@ -34,6 +38,14 @@ public class InvestFollowRecordServiceImpl extends InvestBaseServiceImpl<InvestF | |||||
| return super.queryPage(params); | return super.queryPage(params); | ||||
| } | } | ||||
| @Override | |||||
| public List<InvestFollowRecordEntity> listByTime(EnumFollowType followType, Date start) { | |||||
| LambdaUpdateWrapper<InvestFollowRecordEntity> query = new LambdaUpdateWrapper<>() ; | |||||
| query.eq(InvestFollowRecordEntity::getType,followType) ; | |||||
| query.ge(InvestFollowRecordEntity::getCreateDate, start); | |||||
| return list(query); | |||||
| } | |||||
| @Override | @Override | ||||
| public boolean save(InvestFollowRecordEntity entity) { | public boolean save(InvestFollowRecordEntity entity) { | ||||
| entity.setOperator(InvestUserContext.getUserId()); | entity.setOperator(InvestUserContext.getUserId()); | ||||
| @@ -1,14 +1,19 @@ | |||||
| package com.iformall.service.invest.impl; | package com.iformall.service.invest.impl; | ||||
| import com.baomidou.mybatisplus.core.conditions.Wrapper; | import com.baomidou.mybatisplus.core.conditions.Wrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
| import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||||
| import com.iformall.domain.po.invest.InvestMessageEntity; | import com.iformall.domain.po.invest.InvestMessageEntity; | ||||
| import com.iformall.domain.vo.invest.InvestUserContext; | import com.iformall.domain.vo.invest.InvestUserContext; | ||||
| import com.iformall.enums.EnumFollowType; | |||||
| import com.iformall.enums.EnumInvestMessageTag; | |||||
| import com.iformall.mapper.InvestMessageDao; | import com.iformall.mapper.InvestMessageDao; | ||||
| import com.iformall.service.invest.InvestHelper; | import com.iformall.service.invest.InvestHelper; | ||||
| import com.iformall.service.invest.InvestMessageService; | import com.iformall.service.invest.InvestMessageService; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import java.util.List; | |||||
| @Service | @Service | ||||
| public class InvestMessageServiceImpl extends InvestBaseServiceImpl<InvestMessageDao, InvestMessageEntity> implements InvestMessageService { | public class InvestMessageServiceImpl extends InvestBaseServiceImpl<InvestMessageDao, InvestMessageEntity> implements InvestMessageService { | ||||
| @@ -56,4 +61,12 @@ public class InvestMessageServiceImpl extends InvestBaseServiceImpl<InvestMessag | |||||
| wrapper.set(InvestMessageEntity::getDeleted, 1); | wrapper.set(InvestMessageEntity::getDeleted, 1); | ||||
| return super.update(null, wrapper); | return super.update(null, wrapper); | ||||
| } | } | ||||
| @Override | |||||
| public List<InvestMessageEntity> listByTypeAndTag(EnumFollowType type, EnumInvestMessageTag tag) { | |||||
| LambdaQueryWrapper<InvestMessageEntity> messageQueryWrapper = new LambdaQueryWrapper<>(); | |||||
| messageQueryWrapper.eq(InvestMessageEntity::getType, type); | |||||
| messageQueryWrapper.ge(InvestMessageEntity::getTag, tag); | |||||
| return list(messageQueryWrapper); | |||||
| } | |||||
| } | } | ||||
| @@ -2,10 +2,13 @@ package com.iformall.service.invest.impl; | |||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
| import com.baomidou.mybatisplus.core.conditions.Wrapper; | import com.baomidou.mybatisplus.core.conditions.Wrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
| import com.iformall.common.TableLog; | import com.iformall.common.TableLog; | ||||
| import com.iformall.domain.po.invest.InvestTaskEntity; | import com.iformall.domain.po.invest.InvestTaskEntity; | ||||
| import com.iformall.enums.EnumFollowType; | import com.iformall.enums.EnumFollowType; | ||||
| import com.iformall.enums.EnumInvestMessageTag; | |||||
| import com.iformall.enums.EnumInvestMessageType; | import com.iformall.enums.EnumInvestMessageType; | ||||
| import com.iformall.enums.EnumTaskStatus; | |||||
| import com.iformall.mapper.InvestTaskDao; | import com.iformall.mapper.InvestTaskDao; | ||||
| import com.iformall.service.MallUserInfoService; | import com.iformall.service.MallUserInfoService; | ||||
| import com.iformall.service.WxShopService; | import com.iformall.service.WxShopService; | ||||
| @@ -30,7 +33,6 @@ public class InvestTaskServiceImpl extends InvestBaseServiceImpl<InvestTaskDao, | |||||
| public boolean save(InvestTaskEntity entity) { | public boolean save(InvestTaskEntity entity) { | ||||
| super.saveAction(entity, this::checkBeforeSaveOrUpdate); | super.saveAction(entity, this::checkBeforeSaveOrUpdate); | ||||
| saveMessage(entity); | saveMessage(entity); | ||||
| //TODO 同步一下签约状态 | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -39,7 +41,6 @@ public class InvestTaskServiceImpl extends InvestBaseServiceImpl<InvestTaskDao, | |||||
| public boolean update(InvestTaskEntity entity, Wrapper<InvestTaskEntity> updateWrapper) { | public boolean update(InvestTaskEntity entity, Wrapper<InvestTaskEntity> updateWrapper) { | ||||
| super.updateActon(entity, updateWrapper, this::checkBeforeSaveOrUpdate); | super.updateActon(entity, updateWrapper, this::checkBeforeSaveOrUpdate); | ||||
| saveMessage(entity); | saveMessage(entity); | ||||
| //TODO 同步一下签约状态 | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -55,7 +56,7 @@ public class InvestTaskServiceImpl extends InvestBaseServiceImpl<InvestTaskDao, | |||||
| String owner = entity.getOwner(); | String owner = entity.getOwner(); | ||||
| if (StringUtils.isNotEmpty(owner)) { | if (StringUtils.isNotEmpty(owner)) { | ||||
| List<Long> ownerArray = JSONArray.parseArray(owner, Long.class); | List<Long> ownerArray = JSONArray.parseArray(owner, Long.class); | ||||
| this.saveBatchMessage(ownerArray, EnumInvestMessageType.TASK_CREATE, EnumFollowType.TASK, entity.getId()); | |||||
| this.saveBatchMessage(ownerArray, EnumInvestMessageType.TASK_CREATE.getInfo(), EnumInvestMessageTag.TASK_CREATE, EnumFollowType.TASK, entity.getId()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -85,4 +86,14 @@ public class InvestTaskServiceImpl extends InvestBaseServiceImpl<InvestTaskDao, | |||||
| notSupport(); | notSupport(); | ||||
| return false ; | return false ; | ||||
| } | } | ||||
| @Override | |||||
| public List<InvestTaskEntity> listByStatusAndTime(List<EnumTaskStatus> status, Date start, Date end) { | |||||
| LambdaQueryWrapper<InvestTaskEntity> taskQueryWrapper = new LambdaQueryWrapper<>(); | |||||
| taskQueryWrapper.in(InvestTaskEntity::getStatus, status); | |||||
| taskQueryWrapper.ge(InvestTaskEntity::getLastTime, start); | |||||
| taskQueryWrapper.le(InvestTaskEntity::getLastTime, end); | |||||
| taskQueryWrapper.isNotNull(InvestTaskEntity::getOwner); | |||||
| return this.list(taskQueryWrapper); | |||||
| } | |||||
| } | } | ||||
| @@ -18,5 +18,24 @@ | |||||
| <result property="updateDate" column="update_date"/> | <result property="updateDate" column="update_date"/> | ||||
| </resultMap> | </resultMap> | ||||
| <select id="listByIds" parameterType="long" resultType="com.iformall.domain.vo.invest.InvestCustomerVo"> | |||||
| select c.*,d.`id` as demandId,d.`owner` as demandOwner | |||||
| from `invest_follow_record` f | |||||
| LEFT JOIN `invest_demand` d ON d.id = f.`follow_id` | |||||
| LEFT JOIN invest_customer c ON d.`customer_id` = c.id | |||||
| where 1=1 | |||||
| <if test=" null != type "> | |||||
| AND c.type in | |||||
| <foreach collection="type" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| AND d.id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||