Просмотр исходного кода

[招商]adjust

release_toaliyun_real
Burce 6 лет назад
Родитель
Сommit
d00c7e51d1
12 измененных файлов: 155 добавлений и 29 удалений
  1. +11
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java
  2. +8
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java
  3. +4
    -1
      mallinkService/src/main/java/com/iformall/domain/po/invest/InvestCustomerEntity.java
  4. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/invest/InvestDemandEntity.java
  5. +15
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestCustomerVo.java
  6. +4
    -0
      mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java
  7. +1
    -0
      mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java
  8. +13
    -13
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBaseServiceImpl.java
  9. +96
    -10
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java
  10. +0
    -1
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestCustomerServiceImpl.java
  11. +0
    -1
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestDemandServiceImpl.java
  12. +0
    -1
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestTaskServiceImpl.java

+ 11
- 0
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java Просмотреть файл

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.InitBinder;

import java.beans.PropertyEditor;
import java.beans.PropertyEditorSupport;
import java.util.function.BiConsumer;
import java.util.function.Function;


@@ -52,6 +53,16 @@ public class InvestBaseController extends BaseController {
}
}

public <T, U> void export(T t, U u, BiConsumer<T, U> action) {
try {
log.debug("[" + getIpAddr() + "] request , params : {}", JSON.toJSONString(t));
InvestUserContext.setUser(getUser());
action.accept(t, u);
} finally {
InvestUserContext.remove();
}
}

private void setUserRule() {
EnumInvestUserType investUserType = EnumInvestUserType.getEnum(getUser().getInvestRule()) ;
InvestUserContext.setInvestUserType(investUserType);


+ 8
- 2
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java Просмотреть файл

@@ -5,10 +5,8 @@ import com.iformall.annotation.SystemControllerLog;
import com.iformall.annotation.SystemServiceLog;
import com.iformall.common.InvestResultData;
import com.iformall.domain.dto.InvestDemandDto;
import com.iformall.domain.po.invest.InvestCustomerEntity;
import com.iformall.domain.vo.invest.InvestDemandQuery;
import com.iformall.domain.vo.invest.InvestDemandVo;
import com.iformall.domain.vo.invest.InvestPageQuery;
import com.iformall.domain.vo.invest.InvestPageResult;
import com.iformall.service.invest.InvestBizService;
import com.iformall.service.invest.InvestCustomerService;
@@ -18,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletResponse;
import java.util.List;


@@ -87,4 +86,11 @@ public class InvestCustomerController extends InvestBaseController{
return execute(customerDto, p -> investBizService.updateCustomerAndDemand(p));
}

@ApiOperation("导出客户信息")
@GetMapping("/exportCustomer")
@SystemControllerLog(description = "招商管理-导出客户信息")
public void exportCustomer(InvestDemandQuery params, HttpServletResponse response) {
export(params, response, (p, u) -> investBizService.exportCustomer(p, u));
}

}

+ 4
- 1
mallinkService/src/main/java/com/iformall/domain/po/invest/InvestCustomerEntity.java Просмотреть файл

@@ -1,5 +1,6 @@
package com.iformall.domain.po.invest;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableName;


@@ -30,13 +31,15 @@ public class InvestCustomerEntity extends InvestBaseEntity {
* 客户名称
*/
@LogColumn
@io.swagger.annotations.ApiModelProperty(value = "客户名称", name = "name")
@io.swagger.annotations.ApiModelProperty(value = "品牌负责人", name = "name")
@Excel(name = "品牌负责人", width = 20, orderNum = "2")
private String name;
/**
* 电话
*/
@LogColumn
@io.swagger.annotations.ApiModelProperty(value = "电话", name = "phone")
@Excel(name = "负责人电话", width = 20, orderNum = "3")
private String phone;
/**
* 经营业态


+ 3
- 0
mallinkService/src/main/java/com/iformall/domain/po/invest/InvestDemandEntity.java Просмотреть файл

@@ -24,6 +24,9 @@ import java.util.Date;
@EqualsAndHashCode(callSuper = true)
public class InvestDemandEntity extends InvestBaseEntity {

public static final String KEY_RENT_AREA = "rent_area" ;
public static final String KEY_OPENING_TIME = "opening_time" ;

/**
* 负责人
*/


+ 15
- 0
mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestCustomerVo.java Просмотреть файл

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

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.iformall.domain.po.invest.InvestCustomerEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -16,4 +17,18 @@ public class InvestCustomerVo extends InvestCustomerEntity {

@io.swagger.annotations.ApiModelProperty(value = "客户需求负责人", name = "demandOwner")
private Long demandOwner;

@Excel(name = "品牌", width = 30, orderNum = "1")
private String brandName;
@Excel(name = "经营业态", width = 20, orderNum = "3")
private String business;

@Excel(name = "意向租赁面积", width = 20, orderNum = "5")
private String rentArea;

@Excel(name = "预计开业时间", width = 20, orderNum = "6")
private String openingTime;

@Excel(name = "意向铺位", width = 20, orderNum = "4")
private String shopNumber;
}

+ 4
- 0
mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java Просмотреть файл

@@ -6,12 +6,16 @@ import com.iformall.domain.po.invest.InvestMessageEntity;
import com.iformall.domain.po.invest.InvestTaskEntity;
import com.iformall.domain.vo.invest.*;

import javax.servlet.http.HttpServletResponse;
import java.util.Collection;
import java.util.List;

public interface InvestBizService {

InvestPageResult<InvestDemandVo> queryPageDemand(InvestDemandQuery params);

void exportCustomer(InvestDemandQuery params, HttpServletResponse response);

List<InvestDemandVo> queryCustomer();

InvestPageResult<InvestTaskVo> queryPageTask(InvestTaskQuery params);


+ 1
- 0
mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java Просмотреть файл

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

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Multimaps;


+ 13
- 13
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBaseServiceImpl.java Просмотреть файл

@@ -68,37 +68,37 @@ public class InvestBaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceIm

@Override
public T getByIdNotNull(Serializable id) {
InvestHelper.checkResult(id,"id=null");
InvestHelper.checkResult(id, "id=null");
T t = super.getById(id);
InvestHelper.checkResult(t,"id=null");
InvestHelper.checkResult(t, "id=null");
return t;
}

boolean saveAction(T entity, Consumer<T> consumer) {
checkUserAndTenant(entity,consumer);
checkUserAndTenant(entity, consumer);
return super.save(entity);
}

boolean updateActon(T entity, Wrapper<T> updateWrapper, Consumer<T> consumer) {
checkUserAndTenant(entity,consumer);
checkUserAndTenant(entity, consumer);
return super.update(entity, updateWrapper);
}

boolean saveOrUpdateAction(T entity, Consumer<T> consumer) {
checkUserAndTenant(entity,consumer);
checkUserAndTenant(entity, consumer);
return super.saveOrUpdate(entity);
}

boolean updateByIdAction(T entity, Consumer<T> consumer) {
checkUserAndTenant(entity,consumer);
checkUserAndTenant(entity, consumer);
return super.updateById(entity);
}

void checkUserAndTenant(T input,Consumer<T> consumer) {
void checkUserAndTenant(T input, Consumer<T> consumer) {
InvestHelper.notNull(input, "参数");
InvestHelper.notNull(InvestUserContext.getUser(), ErrorCode.USER_IS_EMPTY);
((InvestBaseEntity) input).setTenantId(InvestUserContext.getUser().getTenantId());
if(consumer!=null) {
if (consumer != null) {
consumer.accept(input);
}
}
@@ -111,13 +111,13 @@ public class InvestBaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceIm
LambdaQueryWrapper<InvestMessageEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(InvestMessageEntity::getType, type);
queryWrapper.eq(InvestMessageEntity::getTid, tid);
queryWrapper.eq(InvestMessageEntity::getTag,tag) ;
queryWrapper.eq(InvestMessageEntity::getTag, tag);
queryWrapper.in(InvestMessageEntity::getOwner, ownerArray);
List<InvestMessageEntity> before = messageService.list(queryWrapper);
Map<Long,InvestMessageEntity> map = InvestHelper.getMap(before,InvestMessageEntity::getOwner) ;
Map<Long, InvestMessageEntity> map = InvestHelper.getMap(before, InvestMessageEntity::getOwner);
List<InvestMessageEntity> messageEntityList = new ArrayList<>();
for (Long aLong : ownerArray) {
if(Objects.nonNull(map.get(aLong))) {
if (Objects.nonNull(map.get(aLong))) {
continue;
}
InvestMessageEntity messageEntity = new InvestMessageEntity();
@@ -198,7 +198,7 @@ public class InvestBaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceIm
}

void checkBusiness(WxBusinessService businessService, Integer businessId) {
WxBusiness business = businessService.getById(businessId) ;
WxBusiness business = businessService.getById(businessId);
InvestHelper.notNull(business, ErrorCode.BUSINESS_NOT_FOUND);
}

@@ -208,7 +208,7 @@ public class InvestBaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceIm
}

protected Page<T> buildQueryPage(InvestPageQuery<T> pageQuery) {
return InvestHelper.buildQueryPage(pageQuery) ;
return InvestHelper.buildQueryPage(pageQuery);
}




+ 96
- 10
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java Просмотреть файл

@@ -10,10 +10,7 @@ import com.iformall.domain.po.*;
import com.iformall.domain.po.invest.*;
import com.iformall.domain.vo.invest.*;
import com.iformall.enums.*;
import com.iformall.service.MallUserInfoService;
import com.iformall.service.WxBrandService;
import com.iformall.service.WxRentContractService;
import com.iformall.service.WxShopService;
import com.iformall.service.*;
import com.iformall.service.invest.*;
import com.iformall.utils.DateUtils;
import org.apache.commons.collections.CollectionUtils;
@@ -26,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -54,10 +52,15 @@ public class InvestBizServiceImpl implements InvestBizService {
@Autowired
private MallUserInfoService userInfoService;
@Autowired
private WxBusinessService businessService;
@Autowired
private WxRentContractService rentContractService;
@Autowired
private ExcelService excelService;

@Override
public InvestPageResult<InvestDemandVo> queryPageDemand(InvestDemandQuery params) {
InvestPageResult<InvestDemandVo> investPage = new InvestPageResult<>();
InvestDemandDto queryParams = convert(params, this::doConvertDemand);
InvestCustomerEntity customerParams = null;
InvestDemandEntity demandParams = null;
@@ -65,10 +68,8 @@ public class InvestBizServiceImpl implements InvestBizService {
customerParams = queryParams.getCustomer();
demandParams = queryParams.getDemand();
}
InvestPageResult<InvestDemandVo> investPage = new InvestPageResult<>();
List<InvestDemandEntity> demandList = demandService.list(new LambdaQueryWrapper<>(demandParams));
LambdaQueryWrapper<InvestCustomerEntity> queryWrapperCustomer = new LambdaQueryWrapper<>(customerParams);
InvestPageResult<InvestCustomerEntity> customers;
if (Objects.isNull(InvestUserContext.getDataUser())) {
queryWrapperCustomer.in(ObjectUtils.allNotNull(params.getDemandOwner()),
InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId));
@@ -79,7 +80,8 @@ public class InvestBizServiceImpl implements InvestBizService {
queryWrapperCustomer.in(InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId));
}
}
customers = customerService.queryPage(buildPageQuery(params, null), queryWrapperCustomer);
queryWrapperCustomer.orderByDesc(InvestCustomerEntity::getCreateDate);
InvestPageResult<InvestCustomerEntity> customers = customerService.queryPage(buildPageQuery(params, null), queryWrapperCustomer);
List<InvestDemandVo> resultList = getTargeInfoList(demandList, customers.getRecords());
BeanUtils.copyProperties(customers, investPage);
investPage.setRecords(resultList);
@@ -90,6 +92,35 @@ public class InvestBizServiceImpl implements InvestBizService {
return investPage;
}

@Override
public void exportCustomer(InvestDemandQuery params, HttpServletResponse response) {
InvestDemandDto queryParams = convert(params, this::doConvertDemand);
InvestCustomerEntity customerParams = null;
InvestDemandEntity demandParams = null;
if (Objects.nonNull(queryParams)) {
customerParams = queryParams.getCustomer();
demandParams = queryParams.getDemand();
}
List<InvestDemandEntity> demandList = demandService.list(new LambdaQueryWrapper<>(demandParams));
LambdaQueryWrapper<InvestCustomerEntity> queryWrapperCustomer = new LambdaQueryWrapper<>(customerParams);
if (Objects.isNull(InvestUserContext.getDataUser())) {
queryWrapperCustomer.in(ObjectUtils.allNotNull(params.getDemandOwner()),
InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId));
} else {
if (CollectionUtils.isNotEmpty(demandList)) {
return;
} else {
queryWrapperCustomer.in(InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId));
}
}
queryWrapperCustomer.orderByDesc(InvestCustomerEntity::getCreateDate);
Collection<InvestCustomerEntity> customers = customerService.list(queryWrapperCustomer);
if (CollectionUtils.isNotEmpty(customers)) {
List<InvestCustomerVo> resultList = getCustomerVOList(demandList, customers);
excelService.exportExcel(resultList, null, "客户信息", InvestCustomerVo.class, "客户信息.xlsx", response, false);
}
}

@Override
public List<InvestDemandVo> queryCustomer() {
List<InvestCustomerEntity> customerEntities = customerService.list();
@@ -140,7 +171,7 @@ public class InvestBizServiceImpl implements InvestBizService {
}
taskQueryWrapper.in(InvestTaskEntity::getTargetId, getIds(shops, WxShop::getId));
}
taskQueryWrapper.orderByDesc(InvestTaskEntity::getCreateDate);
InvestPageResult<InvestTaskEntity> taskPage = taskService.queryPage(buildPageQuery(params, null), taskQueryWrapper);
if (CollectionUtils.isEmpty(taskPage.getRecords())) {
return investPage;
@@ -220,7 +251,6 @@ public class InvestBizServiceImpl implements InvestBizService {
followRecordEntity.setFollowId(params.getFollowId());
followRecordEntity.setType(params.getType());
InvestPageQuery<InvestFollowRecordEntity> pageQuery = buildPageQuery(params, followRecordEntity);

InvestPageResult<InvestFollowRecordEntity> recordPage = followRecordService.queryPage(pageQuery);

InvestPageResult<InvestFollowRecordVo> investPage = new InvestPageResult<>();
@@ -270,6 +300,7 @@ public class InvestBizServiceImpl implements InvestBizService {
LambdaQueryWrapper<InvestRemindEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.ge(Objects.nonNull(params.getRemindDate()), InvestRemindEntity::getBeginDate, getDayStart(params.getRemindDate()));
queryWrapper.le(Objects.nonNull(params.getRemindDate()), InvestRemindEntity::getEndDate, getDayEnd(params.getRemindDate()));
queryWrapper.orderByDesc(InvestRemindEntity::getCreateDate);
InvestPageResult<InvestRemindEntity> recordPage = remindService.queryPage(remindPageQuery, queryWrapper);
if (CollectionUtils.isEmpty(recordPage.getRecords())) {
return investPage;
@@ -320,6 +351,8 @@ public class InvestBizServiceImpl implements InvestBizService {
InvestMessageEntity messageEntity = new InvestMessageEntity();
messageEntity.setOwner(InvestUserContext.getUserId());
query.setQueryData(messageEntity);
query.setSortColumn("createDate");
query.setSortOrder("desc");
return messageService.queryPage(query);
}

@@ -327,6 +360,7 @@ public class InvestBizServiceImpl implements InvestBizService {
if (ObjectUtils.allNotNull(tbl, tId)) {
wrapper.eq(InvestOperateRecordEntity::getTbl, tbl);
wrapper.eq(InvestOperateRecordEntity::getTid, tId);
wrapper.orderByDesc(InvestOperateRecordEntity::getCreateDate);
}
}

@@ -538,6 +572,31 @@ public class InvestBizServiceImpl implements InvestBizService {
return resultItemVo;
}

private InvestCustomerVo buildCustomerItem(InvestDemandEntity item, InvestCustomerEntity customer, WxBrand brand,
WxShop shop, WxBusiness business) {
InvestCustomerVo resultItemVo = new InvestCustomerVo();
BeanUtils.copyProperties(customer, resultItemVo);
if (Objects.nonNull(brand)) {
resultItemVo.setBrandName(brand.getName());
}
if (Objects.nonNull(shop)) {
resultItemVo.setShopNumber(shop.getShopNumber());
}
if (Objects.nonNull(business)) {
resultItemVo.setBusiness(business.getTitle());
}
if (Objects.nonNull(item)) {
resultItemVo.setDemandOwner(item.getOwner());
if (StringUtils.isNotBlank(item.getIntent())) {
Map intentMap = JSON.parseObject(item.getIntent(), Map.class);
resultItemVo.setRentArea(String.valueOf(intentMap.get(InvestDemandEntity.KEY_RENT_AREA)));
resultItemVo.setOpeningTime(String.valueOf(intentMap.get(InvestDemandEntity.KEY_OPENING_TIME)));
}
}
//resultItemVo.setBusiness(usersMap.get(item.getOwner()));
return resultItemVo;
}

private InvestTaskVo buildTaskItem(InvestTaskEntity item, WxShop shop, Map<Long, MallUserInfo> usersMap) {
List<MallUserInfo> ownerInfo = getMallUserInfos(item.getOwner(), usersMap);
InvestTaskVo resultItemVo = new InvestTaskVo();
@@ -574,13 +633,40 @@ public class InvestBizServiceImpl implements InvestBizService {
if (userId instanceof Long) {
ownerInfo.add(usersMap.get(userId));
} else {
ownerInfo.add(usersMap.get(Long.parseLong((String) userId)));
String uId = (String) userId;
if (StringUtils.isNotBlank(uId)) {
ownerInfo.add(usersMap.get(Long.parseLong(uId)));
}
}
}
}
return ownerInfo;
}

private List<InvestCustomerVo> getCustomerVOList(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);

//4、品牌
Map<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId);
//5、用户
Map<Integer, WxBusiness> bussinessMap = getMap(businessService.getByIds(getIds(customers, InvestCustomerEntity::getBusinessId)), WxBusiness::getId);
List<InvestCustomerVo> resultList = new ArrayList<>();
for (InvestCustomerEntity costomerItem : customers) {
InvestDemandEntity demandItem = demindsMap.get(costomerItem.getId());
WxShop shop = null;
if (Objects.nonNull(demandItem)) {
shop = shopsMap.get(demandItem.getTargetId());
}
WxBrand brand = brandMap.get(costomerItem.getBrandId());
resultList.add(buildCustomerItem(demandItem, costomerItem, brand, shop, bussinessMap.get(costomerItem.getBusinessId())));
}
return resultList;
}

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



+ 0
- 1
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestCustomerServiceImpl.java Просмотреть файл

@@ -33,7 +33,6 @@ public class InvestCustomerServiceImpl extends InvestBaseServiceImpl<InvestCusto
return super.saveAction(entity, this::checkBeforeSaveOrUpdate);
}

@TableLog
@Override
public boolean update(InvestCustomerEntity entity, Wrapper<InvestCustomerEntity> updateWrapper) {
return super.updateActon(entity, updateWrapper, this::checkBeforeSaveOrUpdate);


+ 0
- 1
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestDemandServiceImpl.java Просмотреть файл

@@ -30,7 +30,6 @@ public class InvestDemandServiceImpl extends InvestBaseServiceImpl<InvestDemandD
@Autowired
private InvestCustomerService customerService;

@TableLog
@Override
public boolean save(InvestDemandEntity entity) {
super.saveAction(entity, this::checkBeforeSaveOrUpdate);


+ 0
- 1
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestTaskServiceImpl.java Просмотреть файл

@@ -28,7 +28,6 @@ public class InvestTaskServiceImpl extends InvestBaseServiceImpl<InvestTaskDao,
@Autowired
private MallUserInfoService userInfoService;

@TableLog
@Override
public boolean save(InvestTaskEntity entity) {
super.saveAction(entity, this::checkBeforeSaveOrUpdate);


Загрузка…
Отмена
Сохранить