From 07871712e7028809fa27b3ec9a8df3cfb59b8dd1 Mon Sep 17 00:00:00 2001 From: Burce Date: Tue, 29 Oct 2019 12:07:58 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=8B=9B=E5=95=86]adjust?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/invest/InvestBizService.java | 3 +- .../iformall/service/invest/InvestHelper.java | 17 +++++-- .../invest/impl/InvestBizServiceImpl.java | 46 ++++++++++--------- .../invest/impl/InvestTaskServiceImpl.java | 4 ++ 4 files changed, 44 insertions(+), 26 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java b/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java index 482822591..8ae58a192 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java @@ -5,7 +5,6 @@ import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.invest.InvestMessageEntity; import com.iformall.domain.po.invest.InvestTaskEntity; import com.iformall.domain.vo.invest.*; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; @@ -21,7 +20,7 @@ public interface InvestBizService { void exportCustomerTemplate(HttpServletResponse response); - void importCustomer(@RequestParam("file") MultipartFile mFile); + void importCustomer(MultipartFile mFile); Map queryCustomerImportCount() ; diff --git a/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java b/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java index 8481174a4..33c4f79af 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java @@ -1,6 +1,7 @@ package com.iformall.service.invest; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.ImmutableListMultimap; 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.InvestTaskEntity; import com.iformall.domain.vo.invest.InvestPageQuery; +import com.iformall.enums.EnumTaskStatus; import com.iformall.exception.MallinkException; import com.iformall.utils.JsonUtil; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -189,8 +192,16 @@ public class InvestHelper { 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 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"); + } } } diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java index 4a50976ac..ba735814d 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java @@ -656,10 +656,11 @@ public class InvestBizServiceImpl implements InvestBizService { remindPageQuery.setQueryData(remindQuery); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); 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); InvestPageResult recordPage = remindService.queryPage(remindPageQuery, queryWrapper); if (CollectionUtils.isEmpty(recordPage.getRecords())) { @@ -816,7 +817,7 @@ public class InvestBizServiceImpl implements InvestBizService { @Override public boolean saveTask(InvestTaskEntity investTaskEntity) { - syncTargetStatus(investTaskEntity); + //syncTargetStatus(investTaskEntity); return taskService.save(investTaskEntity); } @@ -880,7 +881,10 @@ public class InvestBizServiceImpl implements InvestBizService { * @return */ private Map 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(), ""), InvestUserContext.getUser().getTenantId()); } @@ -1049,10 +1053,9 @@ public class InvestBizServiceImpl implements InvestBizService { // 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 shopContractMap = getWxRentContractMap(shop); WxRentContract contract = shopContractMap.get(shop.getId()); if (Objects.nonNull(contract)) { @@ -1067,8 +1070,6 @@ public class InvestBizServiceImpl implements InvestBizService { int count = rentContractService.selectContractCountByShopId(contractQuery); if (count > 0) { investTaskEntity.setStatus(EnumTaskStatus.INTENTION); - } else { - investTaskEntity.setStatus(EnumTaskStatus.NEGOTIATING); } } } @@ -1213,26 +1214,29 @@ public class InvestBizServiceImpl implements InvestBizService { } private List getTargeInfoList(List demandList, Collection customers) { - Map demindsMap = getMap(demandList, InvestDemandEntity::getCustomerId); - - //3、目标信息 - Collection shops = shopService.getByIds(getIds(demandList, InvestDemandEntity::getTargetId)); - Map shopsMap = getMap(shops, WxShop::getId); + Map demindsMap = new HashMap<>(); + Map shopsMap = new HashMap<>(); + Map usersMap = new HashMap<>(); + if (CollectionUtils.isNotEmpty(demandList)) { + demindsMap = getMap(demandList, InvestDemandEntity::getCustomerId); + //3、目标信息 + Collection shops = shopService.getByIds(getIds(demandList, InvestDemandEntity::getTargetId)); + shopsMap = getMap(shops, WxShop::getId); + //5、用户 + usersMap = getMap(userInfoService.getByIds(getIds(demandList, InvestDemandEntity::getOwner)), MallUserInfo::getId); + } //4、品牌 Map brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId); - //5、用户 - Map usersMap = getMap(userInfoService.getByIds(getIds(demandList, InvestDemandEntity::getOwner)), MallUserInfo::getId); List resultList = new ArrayList<>(); for (InvestCustomerEntity costomerItem : customers) { InvestDemandEntity demandItem = demindsMap.get(costomerItem.getId()); WxShop shop = null; - WxBrand brand = null ; if (Objects.nonNull(demandItem)) { shop = shopsMap.get(demandItem.getTargetId()); - brand = brandMap.get(costomerItem.getBrandId()); } + WxBrand brand = brandMap.get(costomerItem.getBrandId()); resultList.add(buildDemindItem(demandItem, costomerItem, brand, shop, usersMap)); } return resultList; diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestTaskServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestTaskServiceImpl.java index 9bef2e11b..8de63a715 100755 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestTaskServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestTaskServiceImpl.java @@ -3,6 +3,8 @@ package com.iformall.service.invest.impl; import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.Wrapper; 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.enums.EnumFollowType; import com.iformall.enums.EnumInvestMessageTag; @@ -13,6 +15,7 @@ import com.iformall.service.MallUserInfoService; import com.iformall.service.WxShopService; import com.iformall.service.invest.InvestHelper; import com.iformall.service.invest.InvestTaskService; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,6 +33,7 @@ public class InvestTaskServiceImpl extends InvestBaseServiceImpl