Browse Source

[招商]adjust

release_toaliyun_real
Burce 6 years ago
parent
commit
07871712e7
4 changed files with 44 additions and 26 deletions
  1. +1
    -2
      mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java
  2. +14
    -3
      mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java
  3. +25
    -21
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java
  4. +4
    -0
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestTaskServiceImpl.java

+ 1
- 2
mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java View File

@@ -5,7 +5,6 @@ import com.iformall.domain.po.MallUserInfo;
import com.iformall.domain.po.invest.InvestMessageEntity; import com.iformall.domain.po.invest.InvestMessageEntity;
import com.iformall.domain.po.invest.InvestTaskEntity; import com.iformall.domain.po.invest.InvestTaskEntity;
import com.iformall.domain.vo.invest.*; import com.iformall.domain.vo.invest.*;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;


import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -21,7 +20,7 @@ public interface InvestBizService {


void exportCustomerTemplate(HttpServletResponse response); void exportCustomerTemplate(HttpServletResponse response);


void importCustomer(@RequestParam("file") MultipartFile mFile);
void importCustomer(MultipartFile mFile);


Map queryCustomerImportCount() ; Map queryCustomerImportCount() ;




+ 14
- 3
mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java View File

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


import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Multimaps; import com.google.common.collect.Multimaps;
@@ -8,8 +9,10 @@ import com.iformall.common.ErrorCode;
import com.iformall.domain.po.invest.InvestBaseEntity; import com.iformall.domain.po.invest.InvestBaseEntity;
import com.iformall.domain.po.invest.InvestTaskEntity; import com.iformall.domain.po.invest.InvestTaskEntity;
import com.iformall.domain.vo.invest.InvestPageQuery; import com.iformall.domain.vo.invest.InvestPageQuery;
import com.iformall.enums.EnumTaskStatus;
import com.iformall.exception.MallinkException; import com.iformall.exception.MallinkException;
import com.iformall.utils.JsonUtil; import com.iformall.utils.JsonUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@@ -189,8 +192,16 @@ public class InvestHelper {
return JsonUtil.obj2Json(contentMap); return JsonUtil.obj2Json(contentMap);
} }


public static Date parseDate(String dateStr) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.parse(dateStr);
public static void checkOwner(InvestTaskEntity entity) {
try {
List<Long> owner = JSONArray.parseArray(entity.getOwner(), Long.class);
if (CollectionUtils.isNotEmpty(owner)) {
entity.setStatus(EnumTaskStatus.NEGOTIATING);
} else {
entity.setStatus(EnumTaskStatus.CREATED);
}
} catch (Exception e) {
InvestHelper.throwException(ErrorCode.SYS_PARAMETER_ERROR, "owner");
}
} }
} }

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

@@ -656,10 +656,11 @@ public class InvestBizServiceImpl implements InvestBizService {
remindPageQuery.setQueryData(remindQuery); remindPageQuery.setQueryData(remindQuery);
LambdaQueryWrapper<InvestRemindEntity> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<InvestRemindEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(InvestRemindEntity::getTenantId,InvestUserContext.getUser().getTenantId()); queryWrapper.eq(InvestRemindEntity::getTenantId,InvestUserContext.getUser().getTenantId());
queryWrapper.apply(Objects.nonNull(params.getRemindDate()),
"date_format(begin_date,'%Y-%m-%d') >= {0} AND date_format(end_date,'%Y-%m-%d') < {1}"
, getDayStart(params.getRemindDate())
, getDayEnd(params.getRemindDate()));
if (Objects.nonNull(params.getRemindDate())) {
queryWrapper.apply("date_format(begin_date,'%Y-%m-%d') >= {0} AND date_format(end_date,'%Y-%m-%d') < {1}"
, getDayStart(params.getRemindDate())
, getDayEnd(params.getRemindDate()));
}
queryWrapper.orderByDesc(InvestRemindEntity::getCreateDate); queryWrapper.orderByDesc(InvestRemindEntity::getCreateDate);
InvestPageResult<InvestRemindEntity> recordPage = remindService.queryPage(remindPageQuery, queryWrapper); InvestPageResult<InvestRemindEntity> recordPage = remindService.queryPage(remindPageQuery, queryWrapper);
if (CollectionUtils.isEmpty(recordPage.getRecords())) { if (CollectionUtils.isEmpty(recordPage.getRecords())) {
@@ -816,7 +817,7 @@ public class InvestBizServiceImpl implements InvestBizService {


@Override @Override
public boolean saveTask(InvestTaskEntity investTaskEntity) { public boolean saveTask(InvestTaskEntity investTaskEntity) {
syncTargetStatus(investTaskEntity);
//syncTargetStatus(investTaskEntity);
return taskService.save(investTaskEntity); return taskService.save(investTaskEntity);
} }


@@ -880,7 +881,10 @@ public class InvestBizServiceImpl implements InvestBizService {
* @return * @return
*/ */
private Map<Long, WxRentContract> getWxRentContractMap(WxShop shop) { private Map<Long, WxRentContract> getWxRentContractMap(WxShop shop) {
InvestHelper.notNull(shop, "商铺不存在");
//InvestHelper.notNull(shop, "商铺不存在");
if (Objects.isNull(shop)) {
return new HashMap<>();
}
return rentContractService.selectRentContractByShopIds(Arrays.asList(shop.getId()), StringUtils.join(shop.getId(), ""), return rentContractService.selectRentContractByShopIds(Arrays.asList(shop.getId()), StringUtils.join(shop.getId(), ""),
InvestUserContext.getUser().getTenantId()); InvestUserContext.getUser().getTenantId());
} }
@@ -1049,10 +1053,9 @@ public class InvestBizServiceImpl implements InvestBizService {
// return; // return;
//} //}


if (StringUtils.isBlank(investTaskEntity.getOwner())) {
investTaskEntity.setStatus(EnumTaskStatus.CREATED);
} else {
WxShop shop = shopService.getById(investTaskEntity.getTargetId());
InvestHelper.checkOwner(investTaskEntity);
WxShop shop = shopService.getById(investTaskEntity.getTargetId());
if (Objects.nonNull(shop)) {
Map<Long, WxRentContract> shopContractMap = getWxRentContractMap(shop); Map<Long, WxRentContract> shopContractMap = getWxRentContractMap(shop);
WxRentContract contract = shopContractMap.get(shop.getId()); WxRentContract contract = shopContractMap.get(shop.getId());
if (Objects.nonNull(contract)) { if (Objects.nonNull(contract)) {
@@ -1067,8 +1070,6 @@ public class InvestBizServiceImpl implements InvestBizService {
int count = rentContractService.selectContractCountByShopId(contractQuery); int count = rentContractService.selectContractCountByShopId(contractQuery);
if (count > 0) { if (count > 0) {
investTaskEntity.setStatus(EnumTaskStatus.INTENTION); investTaskEntity.setStatus(EnumTaskStatus.INTENTION);
} else {
investTaskEntity.setStatus(EnumTaskStatus.NEGOTIATING);
} }
} }
} }
@@ -1213,26 +1214,29 @@ public class InvestBizServiceImpl implements InvestBizService {
} }


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

//3、目标信息
Collection<WxShop> shops = shopService.getByIds(getIds(demandList, InvestDemandEntity::getTargetId));
Map<Long, WxShop> shopsMap = getMap(shops, WxShop::getId);
Map<Long, InvestDemandEntity> demindsMap = new HashMap<>();
Map<Long, WxShop> shopsMap = new HashMap<>();
Map<Long, MallUserInfo> usersMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(demandList)) {
demindsMap = getMap(demandList, InvestDemandEntity::getCustomerId);
//3、目标信息
Collection<WxShop> shops = shopService.getByIds(getIds(demandList, InvestDemandEntity::getTargetId));
shopsMap = getMap(shops, WxShop::getId);
//5、用户
usersMap = getMap(userInfoService.getByIds(getIds(demandList, InvestDemandEntity::getOwner)), MallUserInfo::getId);
}


//4、品牌 //4、品牌
Map<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、用户
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.getByIds(getIds(demandList, InvestDemandEntity::getOwner)), MallUserInfo::getId);


List<InvestDemandVo> resultList = new ArrayList<>(); List<InvestDemandVo> resultList = new ArrayList<>();
for (InvestCustomerEntity costomerItem : customers) { for (InvestCustomerEntity costomerItem : customers) {
InvestDemandEntity demandItem = demindsMap.get(costomerItem.getId()); InvestDemandEntity demandItem = demindsMap.get(costomerItem.getId());
WxShop shop = null; WxShop shop = null;
WxBrand brand = null ;
if (Objects.nonNull(demandItem)) { if (Objects.nonNull(demandItem)) {
shop = shopsMap.get(demandItem.getTargetId()); shop = shopsMap.get(demandItem.getTargetId());
brand = brandMap.get(costomerItem.getBrandId());
} }
WxBrand brand = brandMap.get(costomerItem.getBrandId());
resultList.add(buildDemindItem(demandItem, costomerItem, brand, shop, usersMap)); resultList.add(buildDemindItem(demandItem, costomerItem, brand, shop, usersMap));
} }
return resultList; return resultList;


+ 4
- 0
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestTaskServiceImpl.java View File

@@ -3,6 +3,8 @@ 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.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.iformall.common.ErrorCode;
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.EnumInvestMessageTag;
@@ -13,6 +15,7 @@ import com.iformall.service.MallUserInfoService;
import com.iformall.service.WxShopService; import com.iformall.service.WxShopService;
import com.iformall.service.invest.InvestHelper; import com.iformall.service.invest.InvestHelper;
import com.iformall.service.invest.InvestTaskService; import com.iformall.service.invest.InvestTaskService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -30,6 +33,7 @@ public class InvestTaskServiceImpl extends InvestBaseServiceImpl<InvestTaskMappe


@Override @Override
public boolean save(InvestTaskEntity entity) { public boolean save(InvestTaskEntity entity) {
InvestHelper.checkOwner(entity);
super.saveAction(entity, this::checkBeforeSaveOrUpdate); super.saveAction(entity, this::checkBeforeSaveOrUpdate);
saveMessage(entity); saveMessage(entity);
return true; return true;


Loading…
Cancel
Save