Browse Source

[招商]adjust

release_toaliyun_real
Burce 6 years ago
parent
commit
bfc9774d9d
5 changed files with 24 additions and 26 deletions
  1. +2
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java
  2. +0
    -1
      mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestFollowQuery.java
  3. +2
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumFollowType.java
  4. +1
    -3
      mallinkService/src/main/java/com/iformall/service/invest/event/InvestListener.java
  5. +19
    -20
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java

+ 2
- 2
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java View File

@@ -29,7 +29,7 @@ public class InvestBaseController extends BaseController {
registerEnumEditor(dataBinder, EnumCustomerType.class, "customerType") ;
registerEnumEditor(dataBinder, EnumCustomerRatingType.class, "customerRatingType") ;
registerEnumEditor(dataBinder, EnumTaskStatus.class, "taskStatus") ;
registerEnumEditor(dataBinder, EnumFollowType.class, "followType") ;
registerEnumEditor(dataBinder, EnumFollowType.class, "type") ;
}

public <R, T> InvestResultData<R> execute(T params, Function<T, R> function) {
@@ -43,7 +43,7 @@ public class InvestBaseController extends BaseController {
return new InvestResultData(e.getErrorCode(), e.getMessage());
} catch (NullPointerException e) {
ErrorCode errorCode = ErrorCode.SYS_NULLPOINTER_ERROR ;
log.error("execute error", errorCode.getMessage());
log.error("execute error {}", errorCode.getMessage());
return new InvestResultData(errorCode);
} catch (Exception e) {
log.error("execute error", e);


+ 0
- 1
mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestFollowQuery.java View File

@@ -1,7 +1,6 @@
package com.iformall.domain.vo.invest;

import com.iformall.enums.EnumFollowType;
import com.iformall.enums.EnumTaskStatus;
import lombok.Data;

@Data


+ 2
- 0
mallinkService/src/main/java/com/iformall/enums/EnumFollowType.java View File

@@ -1,6 +1,7 @@
package com.iformall.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

/**
* 跟踪类型:0-招商任务;1-客户需求
@@ -28,6 +29,7 @@ public enum EnumFollowType {
this.info = info;
}

@JsonValue
public Integer getCode() {
return code;
}


+ 1
- 3
mallinkService/src/main/java/com/iformall/service/invest/event/InvestListener.java View File

@@ -7,7 +7,6 @@ import com.iformall.domain.vo.RentEventInfo;
import com.iformall.enums.EnumInvestType;
import com.iformall.enums.EnumRentContractStatus;
import com.iformall.enums.EnumTaskStatus;
import com.iformall.service.invest.InvestHelper;
import com.iformall.service.invest.InvestTaskService;
import com.iformall.utils.JsonUtil;
import lombok.extern.slf4j.Slf4j;
@@ -16,7 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -55,7 +53,7 @@ public class InvestListener implements ApplicationListener<InvestEvent> {
for (InvestTaskEntity task : tasks) {
task.setStatus(status);
String content = task.getContent();
HashMap contentMap = JSON.parseObject(content, HashMap.class);
Map contentMap = JSON.parseObject(content, Map.class);
contentMap.put(InvestTaskEntity.KEY_CONTRACTID, rentEventInfo.getRentId());
task.setContent(JsonUtil.obj2Json(contentMap));
}


+ 19
- 20
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java View File

@@ -128,9 +128,9 @@ public class InvestBizServiceImpl implements InvestBizService {
Collection<InvestTaskEntity> taskList = taskPage.getRecords();
//2、目标信息
Collection<WxShop> shops = shopService.getByIds(getIds(taskList, InvestTaskEntity::getTargetId));
HashMap<Long, WxShop> shopsMap = getMap(shops, WxShop::getId);
Map<Long, WxShop> shopsMap = getMap(shops, WxShop::getId);
//3、用户信息
HashMap<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId);
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId);
List<InvestTaskVo> resultList = new ArrayList<>();
for (InvestTaskEntity item : taskList) {
WxShop shop = shopsMap.get(item.getTargetId());
@@ -182,13 +182,13 @@ public class InvestBizServiceImpl implements InvestBizService {
Collection<InvestFollowRecordEntity> recordList = recordPage.getRecords();

//2、用户信息
HashMap<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId);
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId);

//3、客户
Collection<InvestCustomerEntity> customers = customerService.listByIds(getIds(recordList, InvestFollowRecordEntity::getCustomerId));
HashMap<Long, InvestCustomerEntity> customerMap = getMap(customers, InvestCustomerEntity::getId);
Map<Long, InvestCustomerEntity> customerMap = getMap(customers, InvestCustomerEntity::getId);
//4、 品牌
HashMap<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId);
Map<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId);

List<InvestFollowRecordVo> resultList = new ArrayList<>();
for (InvestFollowRecordEntity item : recordList) {
@@ -217,13 +217,13 @@ public class InvestBizServiceImpl implements InvestBizService {
}

//2、用户信息
HashMap<Long, MallUserInfo> usersMap = getMap(userInfoService.getByIds(getIds(recordList, InvestRemindEntity::getOwner)), MallUserInfo::getId);
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.getByIds(getIds(recordList, InvestRemindEntity::getOwner)), MallUserInfo::getId);

//3、客户
Collection<InvestCustomerEntity> customers = customerService.listByIds(getIds(resultList, InvestRemindVo::getCustomerId));
HashMap<Long, InvestCustomerEntity> customerMap = getMap(customers, InvestCustomerEntity::getId);
Map<Long, InvestCustomerEntity> customerMap = getMap(customers, InvestCustomerEntity::getId);
//4、 品牌
HashMap<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId);
Map<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId);

for (InvestRemindVo remindVo : resultList) {
InvestCustomerEntity customerEntity = customerMap.get(remindVo.getCustomerId());
@@ -244,7 +244,7 @@ public class InvestBizServiceImpl implements InvestBizService {

private List<MallUserInfo> getMallUserInfos(Map<Long, MallUserInfo> usersMap, InvestFollowRecordEntity item) {
List<MallUserInfo> ownerInfo = null;
HashMap contentMap = JSON.parseObject(item.getContent(), HashMap.class);
Map contentMap = JSON.parseObject(item.getContent(), Map.class);
if (MapUtils.isNotEmpty(contentMap)) {
Object followMember = contentMap.get(InvestFollowRecordEntity.KEY_MEMBER);
ownerInfo = getMallUserInfos(followMember, usersMap);
@@ -291,7 +291,7 @@ public class InvestBizServiceImpl implements InvestBizService {
InvestCustomerEntity customerEntity = customerService.getByIdNotNull(demandEntity.getCustomerId());
WxBrand brand = brandService.getById(customerEntity.getBrandId());
WxShop shop = shopService.getById(demandEntity.getTargetId());
HashMap<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId);
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId);
return buildDemindItem(demandEntity, customerEntity, brand, shop, usersMap);
}

@@ -299,7 +299,7 @@ public class InvestBizServiceImpl implements InvestBizService {
public InvestTaskVo findTaskById(Long id) {
InvestTaskEntity taskEntity = taskService.getByIdNotNull(id);
WxShop shop = shopService.getById(taskEntity.getTargetId());
HashMap<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId);
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId);
return buildTaskItem(taskEntity, shop, usersMap);
}

@@ -321,7 +321,7 @@ public class InvestBizServiceImpl implements InvestBizService {
@Override
public InvestFollowRecordVo findFollowRecordById(Long id) {
InvestFollowRecordEntity followRecordEntity = followRecordService.getByIdNotNull(id);
HashMap<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId);
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId);
InvestCustomerEntity customerEntity = customerService.getByIdNotNull(followRecordEntity.getCustomerId());
WxBrand brand = brandService.getById(customerEntity.getBrandId());
return buildFollowRecordItem(usersMap, followRecordEntity, customerEntity, brand);
@@ -365,7 +365,7 @@ public class InvestBizServiceImpl implements InvestBizService {
private InvestRemindVo buildRemindItem(InvestRemindEntity remindEntity) {
InvestRemindVo remindVo = new InvestRemindVo();
BeanUtils.copyProperties(remindEntity, remindVo);
HashMap contentMap = JSON.parseObject(remindEntity.getContent(), HashMap.class);
Map contentMap = JSON.parseObject(remindEntity.getContent(), Map.class);
if (MapUtils.isNotEmpty(contentMap)) {
Object customerId = contentMap.get(InvestRemindEntity.KEY_CUSTOMER);
remindVo.setCustomerId(Objects.isNull(customerId) ? null : Long.parseLong((String) customerId));
@@ -392,16 +392,16 @@ public class InvestBizServiceImpl implements InvestBizService {
}

private List<InvestDemandVo> getTargeInfoList(List<InvestDemandEntity> demandList, Collection<InvestCustomerEntity> customers) {
HashMap<Long, InvestDemandEntity> demindsMap = getMap(demandList, InvestDemandEntity::getCustomerId);
Map<Long, InvestDemandEntity> demindsMap = getMap(demandList, InvestDemandEntity::getCustomerId);

//3、目标信息
Collection<WxShop> shops = shopService.getByIds(getIds(demandList, InvestDemandEntity::getTargetId));
HashMap<Long, WxShop> shopsMap = getMap(shops, WxShop::getId);
Map<Long, WxShop> shopsMap = getMap(shops, WxShop::getId);

//4、品牌
HashMap<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId);
Map<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId);
//5、用户
HashMap<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId);
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId);

List<InvestDemandVo> resultList = new ArrayList<>();
for (InvestCustomerEntity costomerItem : customers) {
@@ -430,9 +430,8 @@ public class InvestBizServiceImpl implements InvestBizService {
return function.apply(params);
}

private <T, R> HashMap<R, T> getMap(Collection<T> dataList, Function<T, R> keyMapper) {
Map<R, T> map = dataList.parallelStream().collect(Collectors.toMap(keyMapper, entity -> entity));
return new HashMap<>(map);
private <T, R> Map<R, T> getMap(Collection<T> dataList, Function<T, R> keyMapper) {
return dataList.parallelStream().collect(Collectors.toMap(keyMapper, entity -> entity));
}

private <T, R> Collection<R> getIds(Collection<T> dataList, Function<? super T, R> mapper) {


Loading…
Cancel
Save