From e3320c7d6ae344ef1150323d8d3d5397bb50a747 Mon Sep 17 00:00:00 2001 From: Burce Date: Tue, 29 Oct 2019 13:46:20 +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 --- .../controller/invest/InvestController.java | 10 ++++ .../iformall/service/invest/InvestHelper.java | 2 + .../invest/impl/InvestBizServiceImpl.java | 51 +++++++++++-------- .../invest/impl/InvestTaskServiceImpl.java | 1 - 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestController.java index 8e7032336..013470a95 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestController.java @@ -47,4 +47,14 @@ public class InvestController extends InvestBaseController { return execute(shopId, p -> bizService.shopRentInfo(p)); } + /** + * 招商概览 + */ + @ApiOperation("招商概览") + @SystemControllerLog(description = "招商概览") + @GetMapping("/overview") + public InvestResultData statistics() { + return execute(null, p -> bizService.statistics()); + } + } 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 5ee25f049..a064f9083 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java @@ -2,6 +2,7 @@ package com.iformall.service.invest; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.Multimaps; @@ -9,6 +10,7 @@ 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.domain.vo.invest.InvestUserContext; import com.iformall.enums.EnumTaskStatus; import com.iformall.exception.MallinkException; import com.iformall.utils.JsonUtil; 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 be1ecca25..a0c33044e 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 @@ -95,13 +95,13 @@ public class InvestBizServiceImpl implements InvestBizService { if (CollectionUtils.isEmpty(demandList) && Objects.nonNull(params.getDemandOwner())) { return investPage; } else { - queryWrapperCustomer.in(CollectionUtils.isNotEmpty(demandList),InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId)); + queryWrapperCustomer.in(CollectionUtils.isNotEmpty(demandList), InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId)); } } else { if (CollectionUtils.isEmpty(demandList)) { return investPage; } else { - queryWrapperCustomer.in(CollectionUtils.isNotEmpty(demandList),InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId)); + queryWrapperCustomer.in(CollectionUtils.isNotEmpty(demandList), InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId)); } } @@ -381,8 +381,8 @@ public class InvestBizServiceImpl implements InvestBizService { updateCustomerAndDemand(toImportCustomer); } //记数 - stringRedisTemplate.opsForHash().increment(importKey,"processCount",1); - stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); + stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); + stringRedisTemplate.expire(importKey, 10, TimeUnit.SECONDS); }); } catch (Exception e) { setRedisValue(importKey, "1", "0", "0", "1", true); @@ -655,7 +655,7 @@ public class InvestBizServiceImpl implements InvestBizService { } remindPageQuery.setQueryData(remindQuery); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(InvestRemindEntity::getTenantId,InvestUserContext.getUser().getTenantId()); + queryWrapper.eq(InvestRemindEntity::getTenantId, InvestUserContext.getUser().getTenantId()); 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()) @@ -750,7 +750,7 @@ public class InvestBizServiceImpl implements InvestBizService { //3、商品合同信息 Map shopContractMap = rentContractService.selectRentContractByShopIds(Arrays.asList(shop.getId()), StringUtils.join(shop.getId()), InvestUserContext.getUser().getTenantId()); WxRentContract contract = shopContractMap.get(shop.getId()); - InvestHelper.notNull(contract,"合同信息不存在"); + InvestHelper.notNull(contract, "合同信息不存在"); Map map = new HashMap<>(); map.put("startdate", contract.getRentalStartDate()); map.put("enddate", contract.getRentalEndDate()); @@ -811,7 +811,7 @@ public class InvestBizServiceImpl implements InvestBizService { if (Objects.nonNull(owner) && !Objects.equals(owner, 0L)) { List ownerArray = Collections.singletonList(owner); demandService.saveBatchMessage(ownerArray, EnumInvestMessageType.CUSTOMER_CREATE.getInfo(), - EnumInvestMessageTag.CUSTOMER_CREATE, EnumFollowType.DEMAND, customerEntity.getId(),customerEntity.getTenantId()); + EnumInvestMessageTag.CUSTOMER_CREATE, EnumFollowType.DEMAND, customerEntity.getId(), customerEntity.getTenantId()); } } @@ -945,8 +945,8 @@ public class InvestBizServiceImpl implements InvestBizService { itemVo.setRecord(convert(content, tableTriple -> { Object column = tableTriple.getColumn(); if (Objects.equals(column, "businessId")) { - WxBusiness businessBefore = businesseMap.get(tableTriple.getBefore()) ; - WxBusiness businessAfter = businesseMap.get(tableTriple.getAfter()) ; + WxBusiness businessBefore = businesseMap.get(tableTriple.getBefore()); + WxBusiness businessAfter = businesseMap.get(tableTriple.getAfter()); if (Objects.nonNull(businessBefore)) { tableTriple.setBefore(businessBefore.getTitle()); } @@ -954,8 +954,8 @@ public class InvestBizServiceImpl implements InvestBizService { tableTriple.setAfter(businessAfter.getTitle()); } } else if (Objects.equals(column, "brandId")) { - WxBrand brandBefore = brandMap.get(tableTriple.getBefore()) ; - WxBrand brandAfter = brandMap.get(tableTriple.getAfter()) ; + WxBrand brandBefore = brandMap.get(tableTriple.getBefore()); + WxBrand brandAfter = brandMap.get(tableTriple.getAfter()); if (Objects.nonNull(brandBefore)) { tableTriple.setBefore(brandBefore.getName()); } @@ -1024,26 +1024,35 @@ public class InvestBizServiceImpl implements InvestBizService { .ge(InvestTaskEntity::getStatus, EnumTaskStatus.CREATED) .eq(InvestTaskEntity::getTenantId, InvestUserContext.getUser().getTenantId()))); result.put("customerTotal", customerService.count(new LambdaQueryWrapper() - .ge(InvestCustomerEntity::getTenantId, InvestUserContext.getUser().getTenantId()))); + .eq(InvestCustomerEntity::getTenantId, InvestUserContext.getUser().getTenantId()))); result.put("taskToday", customerService.count(new LambdaQueryWrapper() .apply("date_format(create_date,'%Y-%m-%d') = {0}", DateUtils.format(new Date())) .eq(InvestCustomerEntity::getTenantId, InvestUserContext.getUser().getTenantId()))); - result.put("customerImport", customerService.count(new LambdaQueryWrapper() + result.put("customerImportant", customerService.count(new LambdaQueryWrapper() .eq(InvestCustomerEntity::getType, EnumCustomerType.INTENTIONAL) .eq(InvestCustomerEntity::getTenantId, InvestUserContext.getUser().getTenantId()))); - result.put("remindCount", remindService.count(new LambdaQueryWrapper() - .ge(InvestRemindEntity::getTenantId, InvestUserContext.getUser().getTenantId()))); - result.put("taskCreate", taskService.count(new LambdaQueryWrapper() + result.put("remindTotal", remindService.count(new LambdaQueryWrapper() + .eq(InvestRemindEntity::getTenantId, InvestUserContext.getUser().getTenantId()))); + result.put("taskUnassigned", taskService.count(new LambdaQueryWrapper() .eq(InvestTaskEntity::getStatus, EnumTaskStatus.CREATED) .eq(InvestTaskEntity::getTenantId, InvestUserContext.getUser().getTenantId()))); - //result.put("customerCreate", customerService.count(new LambdaQueryWrapper() - // .eq(InvestCustomerEntity::getStatus, EnumTaskStatus.CREATED))); + result.put("customerUnassigned", demandService.count(new LambdaQueryWrapper() + .eq(InvestDemandEntity::getTenantId, InvestUserContext.getUser().getTenantId()) + .eq(InvestDemandEntity::getOwner, 0L))); } else { result.put("taskTotal", taskService.count(new LambdaQueryWrapper() .ge(InvestTaskEntity::getStatus, EnumTaskStatus.CREATED) .apply("`owner` REGEXP {0}", InvestUserContext.getUserId()))); result.put("customerTotal", demandService.count(new LambdaQueryWrapper() - .ge(InvestDemandEntity::getOwner, InvestUserContext.getUser().getTenantId()))); + .eq(InvestDemandEntity::getOwner, InvestUserContext.getUser().getTenantId()))); + result.put("taskToday", customerService.count(new LambdaQueryWrapper() + .apply("`owner` REGEXP {0}", InvestUserContext.getUserId()) + .apply("date_format(create_date,'%Y-%m-%d') = {0}", DateUtils.format(new Date())) + .eq(InvestCustomerEntity::getTenantId, InvestUserContext.getUser().getTenantId()))); + result.put("customerToday", demandService.count(new LambdaQueryWrapper() + .eq(InvestDemandEntity::getOwner, InvestUserContext.getUser().getTenantId()) + .apply("date_format(create_date,'%Y-%m-%d') = {0}", DateUtils.format(new Date())) + .eq(InvestDemandEntity::getTenantId, InvestUserContext.getUser().getTenantId()))); } return result; } @@ -1073,8 +1082,8 @@ public class InvestBizServiceImpl implements InvestBizService { if (count > 0) { investTaskEntity.setStatus(EnumTaskStatus.INTENTION); } - } } + } } private InvestFollowRecordVo buildFollowRecordItem(Map usersMap, InvestFollowRecordEntity item, @@ -1205,7 +1214,7 @@ public class InvestBizServiceImpl implements InvestBizService { for (InvestCustomerEntity costomerItem : customers) { InvestDemandEntity demandItem = demindsMap.get(costomerItem.getId()); WxShop shop = null; - WxBrand brand = null ; + WxBrand brand = null; if (Objects.nonNull(demandItem)) { shop = shopsMap.get(demandItem.getTargetId()); brand = brandMap.get(costomerItem.getBrandId()); 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 8de63a715..8a1ae6dd9 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 @@ -15,7 +15,6 @@ 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;