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

[招商]adjust

release_toaliyun_real
Burce 6 лет назад
Родитель
Сommit
92011a8416
23 измененных файлов: 299 добавлений и 134 удалений
  1. +4
    -5
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java
  2. +1
    -24
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java
  3. +4
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestFollowRecordController.java
  4. +5
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestOperateRecordController.java
  5. +7
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestRemindController.java
  6. +2
    -6
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestTaskController.java
  7. +6
    -17
      mallinkService/src/main/java/com/iformall/domain/dto/InvestTaskDto.java
  8. +5
    -0
      mallinkService/src/main/java/com/iformall/domain/po/invest/InvestRemindEntity.java
  9. +0
    -4
      mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandQuery.java
  10. +2
    -2
      mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandVo.java
  11. +2
    -2
      mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestPageResult.java
  12. +32
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestRemindVo.java
  13. +32
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskQuery.java
  14. +2
    -2
      mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskVo.java
  15. +1
    -1
      mallinkService/src/main/java/com/iformall/enums/EnumNegotiationType.java
  16. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxBrandService.java
  17. +5
    -0
      mallinkService/src/main/java/com/iformall/service/WxShopService.java
  18. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxBrandServiceImpl.java
  19. +5
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java
  20. +7
    -2
      mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java
  21. +2
    -1
      mallinkService/src/main/java/com/iformall/service/invest/event/InvestListener.java
  22. +0
    -1
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBaseServiceImpl.java
  23. +173
    -64
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java

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

@@ -5,7 +5,9 @@ import com.iformall.common.ErrorCode;
import com.iformall.common.InvestResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.vo.invest.InvestUserContext;
import com.iformall.enums.EnumCustomerRatingType;
import com.iformall.enums.EnumCustomerType;
import com.iformall.enums.EnumTaskStatus;
import com.iformall.exception.MallinkException;
import com.iformall.service.invest.InvestHelper;
import lombok.extern.slf4j.Slf4j;
@@ -24,6 +26,8 @@ public class InvestBaseController extends BaseController {
public void InitBinder(WebDataBinder dataBinder) {
super.InitBinder(dataBinder);
registerEnumEditor(dataBinder, EnumCustomerType.class, "customerType") ;
registerEnumEditor(dataBinder, EnumCustomerRatingType.class, "customerRatingType") ;
registerEnumEditor(dataBinder, EnumTaskStatus.class, "taskStatus") ;
}

public <R, T> InvestResultData<R> execute(T params, Function<T, R> function) {
@@ -43,11 +47,6 @@ public class InvestBaseController extends BaseController {
}
}

public <R, T> R convert(T params, Function<T, R> function) {
InvestHelper.notNull(params);
return function.apply(params);
}

private <T extends Enum<T>> void registerEnumEditor(WebDataBinder binder, Class<T> clz, String propertyName) {
binder.registerCustomEditor(clz, propertyName, newEnumEditor(clz));
}


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

@@ -3,18 +3,14 @@ package com.iformall.controller.invest;
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.po.invest.InvestDemandEntity;
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.InvestDemandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@@ -47,7 +43,7 @@ public class InvestDemandController extends InvestBaseController {
@ApiOperation(value = "分页列表接口")
@GetMapping("/list")
public InvestResultData<InvestPageResult<InvestDemandVo>> list(InvestDemandQuery params) {
return execute(convert(params, this::doConvert), p -> investBizService.queryPageDemand(p));
return execute(params, p -> investBizService.queryPageDemand(p));
}

/**
@@ -84,23 +80,4 @@ public class InvestDemandController extends InvestBaseController {
public InvestResultData delete(@RequestBody Long[] ids) {
return execute(ids, p -> investDemandService.removeByIds(Arrays.asList(p)));
}

private InvestPageQuery<InvestDemandDto> doConvert(InvestDemandQuery params) {
InvestCustomerEntity customerEntity = new InvestCustomerEntity();
customerEntity.setId(params.getCustomerId());
customerEntity.setType(params.getCustomerType());
customerEntity.setBusinessId(params.getBusinessId());

InvestDemandEntity demandEntity = new InvestDemandEntity();
demandEntity.setOwner(params.getOwner());

InvestDemandDto demandDto = new InvestDemandDto();
demandDto.setCustomer(customerEntity);
demandDto.setDemand(demandEntity);
InvestPageQuery<InvestDemandDto> pageQuery = new InvestPageQuery<>();
BeanUtils.copyProperties(params, pageQuery);
pageQuery.setQueryData(demandDto);
return pageQuery;
}

}

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

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

import com.iformall.annotation.SystemServiceLog;
import com.iformall.common.InvestResultData;
import com.iformall.domain.po.invest.InvestFollowRecordEntity;
import com.iformall.domain.vo.invest.InvestFollowRecordVo;
@@ -37,6 +38,7 @@ public class InvestFollowRecordController extends InvestBaseController {
/**
* 分页列表
*/
@SystemServiceLog
@ApiOperation("分页列表接口")
@GetMapping("/list")
public InvestResultData<InvestPageResult<InvestFollowRecordVo>> list(InvestPageQuery<InvestFollowRecordEntity> params) {
@@ -47,6 +49,7 @@ public class InvestFollowRecordController extends InvestBaseController {
/**
* 信息
*/
@SystemServiceLog
@GetMapping("/info/{id}")
public InvestResultData<InvestFollowRecordVo> info(@PathVariable("id") Long id){
return execute(id, p -> bizService.findFollowRecordById(p));
@@ -55,6 +58,7 @@ public class InvestFollowRecordController extends InvestBaseController {
/**
* 保存
*/
@SystemServiceLog
@PostMapping("/save")
public InvestResultData save(@RequestBody InvestFollowRecordEntity investFollowRecord){
return execute(investFollowRecord, p -> investFollowRecordService.save(p));


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

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

import com.iformall.annotation.SystemServiceLog;
import com.iformall.common.InvestResultData;
import com.iformall.domain.po.invest.InvestOperateRecordEntity;
import com.iformall.domain.vo.invest.InvestPageQuery;
@@ -33,6 +34,7 @@ public class InvestOperateRecordController extends InvestBaseController {
/**
* 分页列表
*/
@SystemServiceLog
@ApiOperation("分页列表接口")
@GetMapping("/list")
public InvestResultData<InvestPageResult<InvestOperateRecordEntity>> list(InvestPageQuery<InvestOperateRecordEntity> params) {
@@ -51,6 +53,7 @@ public class InvestOperateRecordController extends InvestBaseController {
/**
* 保存
*/
@SystemServiceLog
//@PostMapping("/save")
public InvestResultData save(@RequestBody InvestOperateRecordEntity investOperateRecord){
return execute(investOperateRecord, p -> investOperateRecordService.save(p));
@@ -59,6 +62,7 @@ public class InvestOperateRecordController extends InvestBaseController {
/**
* 修改
*/
@SystemServiceLog
//@PostMapping("/update")
public InvestResultData update(@RequestBody InvestOperateRecordEntity investOperateRecord){
return execute(investOperateRecord, p -> investOperateRecordService.updateById(p));
@@ -67,6 +71,7 @@ public class InvestOperateRecordController extends InvestBaseController {
/**
* 删除
*/
@SystemServiceLog
//@GetMapping("/delete")
public InvestResultData delete(@RequestBody Long[] ids){
return execute(ids, p -> investOperateRecordService.removeByIds(Arrays.asList(p)));


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

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

import com.iformall.annotation.SystemServiceLog;
import com.iformall.common.InvestResultData;
import com.iformall.domain.po.invest.InvestRemindEntity;
import com.iformall.domain.vo.invest.InvestPageQuery;
@@ -35,6 +36,7 @@ public class InvestRemindController extends InvestBaseController {
/**
* 分页列表
*/
@SystemServiceLog
@ApiOperation("分页列表接口")
@GetMapping("/list")
public InvestResultData<InvestPageResult<InvestRemindEntity>> list(InvestPageQuery<InvestRemindEntity> params) {
@@ -45,6 +47,7 @@ public class InvestRemindController extends InvestBaseController {
/**
* 信息
*/
@SystemServiceLog
@GetMapping("/info/{id}")
public InvestResultData<InvestRemindEntity> info(@PathVariable("id") Long id) {
return execute(id, p -> investRemindService.getByIdNotNull(p));
@@ -54,6 +57,7 @@ public class InvestRemindController extends InvestBaseController {
* 保存
*/
//@RequiresPermissions("investFollowRecordEdit")
@SystemServiceLog
@PostMapping("/save")
public InvestResultData save(@RequestBody InvestRemindEntity investRemind) {
return execute(investRemind, p -> investRemindService.save(p));
@@ -62,6 +66,7 @@ public class InvestRemindController extends InvestBaseController {
/**
* 修改
*/
@SystemServiceLog
@PostMapping("/update")
public InvestResultData update(@RequestBody InvestRemindEntity investRemind) {
return execute(investRemind, p -> investRemindService.updateById(p));
@@ -70,7 +75,8 @@ public class InvestRemindController extends InvestBaseController {
/**
* 删除
*/
@GetMapping("/delete")
@SystemServiceLog
@PostMapping("/delete")
public InvestResultData delete(@RequestBody Long[] ids) {
return execute(ids, p -> investRemindService.removeByIds(Arrays.asList(p)));
}


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

@@ -2,17 +2,13 @@ package com.iformall.controller.invest;

import com.iformall.annotation.SystemServiceLog;
import com.iformall.common.InvestResultData;
import com.iformall.domain.dto.InvestTaskDto;
import com.iformall.domain.po.invest.InvestTaskEntity;
import com.iformall.domain.vo.invest.InvestPageQuery;
import com.iformall.domain.vo.invest.InvestPageResult;
import com.iformall.domain.vo.invest.InvestTaskVo;
import com.iformall.domain.vo.invest.*;
import com.iformall.service.invest.InvestBizService;
import com.iformall.service.invest.InvestTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@@ -42,7 +38,7 @@ public class InvestTaskController extends InvestBaseController {
@SystemServiceLog
@ApiOperation("分页列表接口")
@GetMapping("/list")
public InvestResultData<InvestPageResult<InvestTaskVo>> list(InvestPageQuery<InvestTaskDto> params) {
public InvestResultData<InvestPageResult<InvestTaskVo>> list(InvestTaskQuery params) {
return execute(params, p -> bizService.queryPageTask(p));
}



+ 6
- 17
mallinkService/src/main/java/com/iformall/domain/dto/InvestTaskDto.java Просмотреть файл

@@ -1,26 +1,15 @@
package com.iformall.domain.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.iformall.common.LogColumn;
import com.iformall.domain.po.WxShop;
import com.iformall.domain.po.invest.InvestTaskEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class InvestTaskDto extends InvestTaskEntity {
public class InvestTaskDto {

@Excel(name="商铺号/多径点位号",width = 20,orderNum = "2")
@io.swagger.annotations.ApiModelProperty(value="商铺编号",name="shopNumber")
private String shopNumber;
@io.swagger.annotations.ApiModelProperty(value="任务信息",name="task")
private InvestTaskEntity task;

@Excel(name="租赁状态",width = 20,orderNum = "7",replace = {"未出租_0","已出租_1"})
@io.swagger.annotations.ApiModelProperty(value="状态(0:未出租, 1:已出租)",name="status")
private Integer shopStatus;
/**
* 经营业态
*/
@LogColumn
@io.swagger.annotations.ApiModelProperty(value = "经营业态", name = "businessId")
private Integer businessId;
@io.swagger.annotations.ApiModelProperty(value="商铺状态)",name="shop")
private WxShop shop;
}

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

@@ -19,6 +19,11 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
public class InvestRemindEntity extends InvestBaseEntity {

public static final String KEY_TEXT = "text" ;
public static final String KEY_NEGOTIATIONTYPE = "negotiationType" ;
public static final String KEY_CUSTOMER = "customerId" ;


/**
* 提醒用户InvestRemindEntity
*/


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

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

import com.iformall.common.LogColumn;
import com.iformall.enums.EnumCustomerType;
import lombok.Data;

@@ -17,13 +16,11 @@ public class InvestDemandQuery extends InvestPageQuery {
* 客户分类:0-潜在客户;1-意向客户;2-合作客户;3-谈判失败
*/
@io.swagger.annotations.ApiModelProperty(value = "客户分类:0-潜在客户;1-意向客户;2-合作客户;3-谈判失败", name = "customerType")
@LogColumn
private EnumCustomerType customerType;

/**
* 经营业态
*/
@LogColumn
@io.swagger.annotations.ApiModelProperty(value = "经营业态", name = "businessId")
private Integer businessId;

@@ -31,7 +28,6 @@ public class InvestDemandQuery extends InvestPageQuery {
* 负责人
*/
@io.swagger.annotations.ApiModelProperty(value = "负责人", name = "owner")
@LogColumn
private Long owner;

}

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

@@ -9,7 +9,7 @@ import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class InvestDemandVo<T> extends InvestDemandEntity {
public class InvestDemandVo extends InvestDemandEntity {

@io.swagger.annotations.ApiModelProperty(value = "customer", name = "customer")
private InvestCustomerEntity customer;
@@ -20,5 +20,5 @@ public class InvestDemandVo<T> extends InvestDemandEntity {
@io.swagger.annotations.ApiModelProperty(value = "ownerInfo", name = "ownerInfo")
private MallUserInfo ownerInfo;

private T targetInfo;
private Object targetInfo;
}

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

@@ -2,8 +2,8 @@ package com.iformall.domain.vo.invest;

import lombok.Data;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

@Data
public class InvestPageResult<T> {
@@ -11,7 +11,7 @@ public class InvestPageResult<T> {
/**
* 查询数据列表
*/
private List<T> records = Collections.emptyList();
private Collection<T> records = Collections.emptyList();
/**
* 总数
*/


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

@@ -0,0 +1,32 @@
package com.iformall.domain.vo.invest;

import com.iformall.domain.po.MallUserInfo;
import com.iformall.domain.po.WxBrand;
import com.iformall.domain.po.invest.InvestCustomerEntity;
import com.iformall.domain.po.invest.InvestRemindEntity;
import com.iformall.enums.EnumNegotiationType;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class InvestRemindVo extends InvestRemindEntity {

@io.swagger.annotations.ApiModelProperty(value = "ownerInfo", name = "ownerInfo")
private MallUserInfo ownerInfo;

/**
* 提醒用户InvestRemindEntity
*/
@io.swagger.annotations.ApiModelProperty(value = "customerId", name = "customerId")
private Long customerId;

@io.swagger.annotations.ApiModelProperty(value = "customer", name = "customer")
private InvestCustomerEntity customer;

@io.swagger.annotations.ApiModelProperty(value = "brand", name = "brand")
private WxBrand brand;

@io.swagger.annotations.ApiModelProperty(value = "拜访方式:0-拜访;1-来访;2-电话;3-短信、微信或其它", name = "negotiationType")
private EnumNegotiationType negotiationType;
}

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

@@ -0,0 +1,32 @@
package com.iformall.domain.vo.invest;

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

@Data
public class InvestTaskQuery extends InvestPageQuery {

@io.swagger.annotations.ApiModelProperty(value="商铺编号",name="shopNumber")
private String shopNumber;

@io.swagger.annotations.ApiModelProperty(value="状态(0:未出租, 1:已出租)",name="status")
private Integer shopStatus;
/**
* 经营业态
*/
@io.swagger.annotations.ApiModelProperty(value = "经营业态", name = "businessId")
private Integer businessId;

/**
* 负责人
*/
@io.swagger.annotations.ApiModelProperty(value = "负责人", name = "owner")
private String taskOwner;

/**
* 任务状态:-1-关闭;0-待分配;1-洽谈中;2-意向签约;3-已完成
*/
@io.swagger.annotations.ApiModelProperty(value = "任务状态:-1-关闭;0-待分配;1-洽谈中;2-意向签约;3-已完成", name = "status")
private EnumTaskStatus taskStatus;

}

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

@@ -9,13 +9,13 @@ import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
public class InvestTaskVo<T> extends InvestTaskEntity {
public class InvestTaskVo extends InvestTaskEntity {

/**
* targetInfo
*/
@io.swagger.annotations.ApiModelProperty(value = "targetInfo", name = "targetInfo")
private T targetInfo;
private Object targetInfo;

@io.swagger.annotations.ApiModelProperty(value = "ownerInfo", name = "ownerInfo")
private List<MallUserInfo> ownerInfo ;


+ 1
- 1
mallinkService/src/main/java/com/iformall/enums/EnumNegotiationType.java Просмотреть файл

@@ -21,8 +21,8 @@ public enum EnumNegotiationType {
return null;
}

@EnumValue
private final Integer code;
@EnumValue
private final String info;

EnumNegotiationType(Integer code, String info) {


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

@@ -33,7 +33,7 @@ public interface WxBrandService {
*/
WxBrand getById(Long id);

List<WxBrand> getByIds(Collection<? extends Serializable> ids);
Collection<WxBrand> getByIds(Collection<? extends Serializable> ids);

/**
* 根据Id删除实体


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

@@ -2,6 +2,9 @@ package com.iformall.service;

import java.io.Serializable;
import java.util.*;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxShop;
@@ -10,6 +13,8 @@ import javax.servlet.http.HttpServletResponse;

public interface WxShopService {

List<WxShop> selectList(QueryWrapper<WxShop> queryWrapper) ;

/**
* 根据实体查询分页列表
*


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

@@ -45,7 +45,7 @@ public class WxBrandServiceImpl implements WxBrandService {
}

@Override
public List<WxBrand> getByIds(Collection<? extends Serializable> ids) {
public Collection<WxBrand> getByIds(Collection<? extends Serializable> ids) {
return wxBrandMapper.selectBatchIds(ids);
}



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

@@ -45,6 +45,11 @@ public class WxShopServiceImpl implements WxShopService {
@Autowired
WxRentContractMapper wxRentContractMapper;

@Override
public List<WxShop> selectList(QueryWrapper<WxShop> queryWrapper) {
return wxShopMapper.selectList(queryWrapper) ;
}

@Override
public PageInfo<WxShop> listAsPage(WxShop record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxShopMapper.findList(record));


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

@@ -4,18 +4,21 @@ import com.iformall.domain.dto.InvestDemandDto;
import com.iformall.domain.dto.InvestTaskDto;
import com.iformall.domain.po.invest.InvestFollowRecordEntity;
import com.iformall.domain.po.MallUserInfo;
import com.iformall.domain.po.invest.InvestRemindEntity;
import com.iformall.domain.vo.invest.*;

import java.util.List;

public interface InvestBizService {

InvestPageResult<InvestDemandVo> queryPageDemand(InvestPageQuery<InvestDemandDto> params);
InvestPageResult<InvestDemandVo> queryPageDemand(InvestDemandQuery params);

InvestPageResult<InvestTaskVo> queryPageTask(InvestPageQuery<InvestTaskDto> params);
InvestPageResult<InvestTaskVo> queryPageTask(InvestTaskQuery params);

InvestPageResult<InvestFollowRecordVo> queryPageFollowRecord(InvestPageQuery<InvestFollowRecordEntity> params);

InvestPageResult<InvestRemindVo> queryPageRemind(InvestPageQuery<InvestRemindEntity> params);

List<MallUserInfo> queryUserList() ;

boolean saveCustomerAndDemand(InvestDemandDto customerDemandDto) ;
@@ -27,4 +30,6 @@ public interface InvestBizService {
InvestTaskVo findTaskById(Long id) ;

InvestFollowRecordVo findFollowRecordById(Long id) ;


}

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

@@ -16,6 +16,7 @@ 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;
@@ -54,7 +55,7 @@ public class InvestListener implements ApplicationListener<InvestEvent> {
for (InvestTaskEntity task : tasks) {
task.setStatus(status);
String content = task.getContent();
Map contentMap = JSON.parseObject(content, Map.class);
HashMap contentMap = JSON.parseObject(content, HashMap.class);
contentMap.put(InvestTaskEntity.KEY_CONTRACTID, rentEventInfo.getRentId());
task.setContent(JsonUtil.obj2Json(contentMap));
}


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

@@ -3,7 +3,6 @@ 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.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;


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

@@ -3,14 +3,13 @@ package com.iformall.service.invest.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.iformall.domain.dto.InvestDemandDto;
import com.iformall.domain.dto.InvestTaskDto;
import com.iformall.domain.po.*;
import com.iformall.domain.po.invest.InvestCustomerEntity;
import com.iformall.domain.po.invest.InvestDemandEntity;
import com.iformall.domain.po.invest.InvestFollowRecordEntity;
import com.iformall.domain.po.invest.InvestTaskEntity;
import com.iformall.domain.po.invest.*;
import com.iformall.domain.vo.invest.*;
import com.iformall.enums.EnumNegotiationType;
import com.iformall.service.MallUserInfoService;
import com.iformall.service.WxBrandService;
import com.iformall.service.WxShopService;
@@ -18,15 +17,15 @@ import com.iformall.service.invest.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

@Service
public class InvestBizServiceImpl implements InvestBizService {
@@ -38,6 +37,8 @@ public class InvestBizServiceImpl implements InvestBizService {
@Autowired
private InvestFollowRecordService followRecordService;
@Autowired
private InvestRemindService remindService;
@Autowired
private WxShopService shopService;
@Autowired
private InvestCustomerService customerService;
@@ -47,49 +48,87 @@ public class InvestBizServiceImpl implements InvestBizService {
private MallUserInfoService userInfoService;

@Override
public InvestPageResult<InvestDemandVo> queryPageDemand(InvestPageQuery<InvestDemandDto> params) {
InvestHelper.notNull(params);
InvestDemandDto queryParams = params.getQueryData();
public InvestPageResult<InvestDemandVo> queryPageDemand(InvestDemandQuery params) {
InvestDemandDto queryParams = convert(params, this::doConvertDemand);
InvestCustomerEntity customerParams = null;
InvestDemandEntity demandParams = null;
if (Objects.nonNull(queryParams)) {
customerParams = queryParams.getCustomer();
demandParams = queryParams.getDemand();
}

InvestPageResult<InvestDemandVo> investPage = new InvestPageResult<>();
InvestPageResult<InvestCustomerEntity> customerPage = customerService.queryPage(
new InvestPageQuery<>(Objects.isNull(queryParams) ? null : queryParams.getCustomer()));
if (CollectionUtils.isEmpty(customerPage.getRecords())) {
return investPage;

LambdaQueryWrapper<InvestDemandEntity> queryWrapperDemand = null;
if (Objects.nonNull(customerParams)) {
Collection<InvestCustomerEntity> customers = customerService.list(new QueryWrapper<>(customerParams));
if (CollectionUtils.isEmpty(customers)) {
return investPage;
}
queryWrapperDemand = new LambdaQueryWrapper<>();
queryWrapperDemand.in(InvestDemandEntity::getId, getIds(customers, InvestCustomerEntity::getId));
}
LambdaQueryWrapper<InvestDemandEntity> queryWrapperDemand = new LambdaQueryWrapper<>();
queryWrapperDemand.in(InvestDemandEntity::getCustomerId, customerPage.getRecords().stream().map(InvestCustomerEntity::getId).collect(Collectors.toList()));
InvestPageResult<InvestDemandEntity> demandPage = demandService.queryPage(new InvestPageQuery<>(Objects.isNull(queryParams) ? null : queryParams.getDemand()), queryWrapperDemand);

InvestPageResult<InvestDemandEntity> demandPage = demandService.queryPage(buildPageQuery(params, demandParams), queryWrapperDemand);
if (CollectionUtils.isEmpty(demandPage.getRecords())) {
return investPage;
}
List<InvestDemandVo> resultList = getTargeInfoList(demandPage, customerPage.getRecords());
List<InvestDemandVo> resultList = getTargeInfoList(demandPage);
BeanUtils.copyProperties(demandPage, investPage);
investPage.setRecords(resultList);
return investPage;
}

private InvestDemandDto doConvertDemand(InvestDemandQuery params) {
InvestCustomerEntity customerEntity = new InvestCustomerEntity();
customerEntity.setId(params.getCustomerId());
customerEntity.setType(params.getCustomerType());
customerEntity.setBusinessId(params.getBusinessId());

InvestDemandEntity demandEntity = new InvestDemandEntity();
demandEntity.setOwner(params.getOwner());

InvestDemandDto demandDto = new InvestDemandDto();
demandDto.setCustomer(customerEntity);
demandDto.setDemand(demandEntity);
return demandDto;
}

@Override
public InvestPageResult<InvestTaskVo> queryPageTask(InvestPageQuery<InvestTaskDto> params) {
InvestTaskDto queryParams = params.getQueryData();
InvestTaskEntity queryTask = null;
public InvestPageResult<InvestTaskVo> queryPageTask(InvestTaskQuery params) {
InvestTaskDto queryParams = convert(params, this::doConvertTask);
InvestTaskEntity taskParams = null;
WxShop shopParams = null;
if (Objects.nonNull(queryParams)) {
queryTask = new InvestTaskEntity();
shopParams = queryParams.getShop();
taskParams = queryParams.getTask();
}

InvestPageResult<InvestTaskEntity> taskPage = taskService.queryPage(new InvestPageQuery<>(queryTask));

LambdaQueryWrapper<InvestTaskEntity> taskQueryWrapper = null;
InvestPageResult<InvestTaskVo> investPage = new InvestPageResult<>();
if (Objects.nonNull(shopParams)) {
Collection<WxShop> shops = shopService.selectList(new QueryWrapper<>(shopParams));
if (CollectionUtils.isEmpty(shops)) {
return investPage;
}
taskQueryWrapper = new LambdaQueryWrapper<>();
taskQueryWrapper.in(InvestTaskEntity::getTargetId, getIds(shops, WxShop::getId));
}
if (Objects.nonNull(taskQueryWrapper) && Objects.nonNull(taskParams)) {
taskQueryWrapper.eq(InvestTaskEntity::getOwner, taskParams.getOwner());
taskQueryWrapper.apply(StringUtils.isNoneEmpty(taskParams.getOwner()), "`owner` REGEXP {0}", taskParams.getOwner());
}

InvestPageResult<InvestTaskEntity> taskPage = taskService.queryPage(buildPageQuery(params, taskParams), taskQueryWrapper);
if (CollectionUtils.isEmpty(taskPage.getRecords())) {
return investPage;
}

List<InvestTaskEntity> taskList = taskPage.getRecords();
Collection<InvestTaskEntity> taskList = taskPage.getRecords();
//2、目标信息
Collection<WxShop> shops = shopService.getByIds(taskList.stream().map(InvestTaskEntity::getTargetId).collect(Collectors.toList()));
Map<Long, WxShop> shopsMap = shops.stream().collect(Collectors.toMap(WxShop::getId, shop -> shop));
Collection<WxShop> shops = shopService.getByIds(getIds(taskList, InvestTaskEntity::getTargetId));
Map<Long, WxShop> shopsMap = getMap(shops, WxShop::getId);
//3、用户信息
Map<Long, MallUserInfo> usersMap = getUserInfoMap();
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());
@@ -97,10 +136,26 @@ public class InvestBizServiceImpl implements InvestBizService {
}
BeanUtils.copyProperties(taskPage, investPage);
investPage.setRecords(resultList);
investPage.setTotal(taskPage.getTotal());
return investPage;
}


private InvestTaskDto doConvertTask(InvestTaskQuery params) {
InvestTaskEntity task = new InvestTaskEntity();
task.setOwner(params.getTaskOwner());
task.setStatus(params.getTaskStatus());

WxShop shop = new WxShop();
shop.setShopNumber(params.getShopNumber());
shop.setStatus(params.getShopStatus());
shop.setBusinessId(params.getBusinessId());

InvestTaskDto taskDto = new InvestTaskDto();
taskDto.setShop(shop);
taskDto.setTask(task);
return taskDto;
}

@Override
public InvestPageResult<InvestFollowRecordVo> queryPageFollowRecord(InvestPageQuery<InvestFollowRecordEntity> params) {
InvestPageResult<InvestFollowRecordEntity> recordPage = followRecordService.queryPage(params);
@@ -110,16 +165,16 @@ public class InvestBizServiceImpl implements InvestBizService {
return investPage;
}

List<InvestFollowRecordEntity> recordList = recordPage.getRecords();
Collection<InvestFollowRecordEntity> recordList = recordPage.getRecords();

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

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

List<InvestFollowRecordVo> resultList = new ArrayList<>();
for (InvestFollowRecordEntity item : recordList) {
@@ -128,15 +183,63 @@ public class InvestBizServiceImpl implements InvestBizService {
resultList.add(buildFollowRecordItem(usersMap, item, customerEntity, brand));
}

BeanUtils.copyProperties(recordPage, investPage);
investPage.setRecords(resultList);
return investPage;
}

@Override
public InvestPageResult<InvestRemindVo> queryPageRemind(InvestPageQuery<InvestRemindEntity> params) {
InvestHelper.notNull(params);
InvestPageResult<InvestRemindVo> investPage = new InvestPageResult<>();
InvestPageResult<InvestRemindEntity> recordPage = remindService.queryPage(params);
if (CollectionUtils.isEmpty(recordPage.getRecords())) {
return investPage;
}
Collection<InvestRemindEntity> recordList = recordPage.getRecords();
Collection<InvestRemindVo> resultList = Collections.emptyList();
for (InvestRemindEntity investRemindEntity : recordList) {
InvestRemindVo remindVo = new InvestRemindVo();
BeanUtils.copyProperties(investRemindEntity, remindVo);
HashMap contentMap = JSON.parseObject(investRemindEntity.getContent(), HashMap.class);
if (MapUtils.isNotEmpty(contentMap)) {
Object customerId = contentMap.get(InvestRemindEntity.KEY_CUSTOMER);
remindVo.setCustomerId(Objects.isNull(customerId) ? null : Long.parseLong((String) customerId));
Object negotiationType = contentMap.get(InvestRemindEntity.KEY_NEGOTIATIONTYPE);
remindVo.setNegotiationType(EnumNegotiationType.getEnum(Integer.valueOf((String) negotiationType)));
}
resultList.add(remindVo);
}

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

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

for (InvestRemindVo remindVo : resultList) {
InvestCustomerEntity customerEntity = customerMap.get(remindVo.getCustomerId());
if (Objects.nonNull(customerEntity)) {
remindVo.setCustomer(customerEntity);
remindVo.setBrand(brandMap.get(customerEntity.getBrandId()));
}
remindVo.setOwnerInfo(usersMap.get(remindVo.getOwner()));
}


BeanUtils.copyProperties(recordPage, investPage);
investPage.setRecords(resultList);
investPage.setTotal(recordPage.getTotal());

return investPage;
}

private List<MallUserInfo> getMallUserInfos(Map<Long, MallUserInfo> usersMap, InvestFollowRecordEntity item) {
List<MallUserInfo> ownerInfo = null ;
Map contentMap = JSON.parseObject(item.getContent(),Map.class);
List<MallUserInfo> ownerInfo = null;
HashMap contentMap = JSON.parseObject(item.getContent(), HashMap.class);
if (MapUtils.isNotEmpty(contentMap)) {
Object followMember = contentMap.get(InvestFollowRecordEntity.KEY_MEMBER);
ownerInfo = getMallUserInfos(followMember, usersMap);
@@ -172,7 +275,7 @@ public class InvestBizServiceImpl implements InvestBizService {
public boolean updateCustomerAndDemand(InvestDemandDto demandDto) {
InvestHelper.notNull(demandDto, demandDto.getCustomer(), demandDto.getDemand());
customerService.updateById(demandDto.getCustomer());
InvestDemandEntity demandEntity = demandDto.getDemand() ;
InvestDemandEntity demandEntity = demandDto.getDemand();
demandEntity.setCustomerId(demandDto.getCustomer().getId());
return demandService.updateById(demandEntity);
}
@@ -183,28 +286,29 @@ public class InvestBizServiceImpl implements InvestBizService {
InvestCustomerEntity customerEntity = customerService.getByIdNotNull(demandEntity.getCustomerId());
WxBrand brand = brandService.getById(customerEntity.getBrandId());
WxShop shop = shopService.getById(demandEntity.getTargetId());
Map<Long, MallUserInfo> usersMap = getUserInfoMap();
return buildDemindItem(demandEntity, customerEntity, brand, shop,usersMap);
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId);
return buildDemindItem(demandEntity, customerEntity, brand, shop, usersMap);
}

@Override
public InvestTaskVo findTaskById(Long id) {
InvestTaskEntity taskEntity = taskService.getByIdNotNull(id);
WxShop shop = shopService.getById(taskEntity.getTargetId());
Map<Long, MallUserInfo> usersMap = getUserInfoMap();
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId);
return buildTaskItem(taskEntity, shop, usersMap);
}

@Override
public InvestFollowRecordVo findFollowRecordById(Long id) {
Map<Long, MallUserInfo> usersMap = getUserInfoMap();
InvestFollowRecordEntity followRecordEntity = followRecordService.getByIdNotNull(id);
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);
}

private InvestFollowRecordVo buildFollowRecordItem(Map<Long, MallUserInfo> usersMap, InvestFollowRecordEntity item, InvestCustomerEntity customerEntity, WxBrand brand) {
private InvestFollowRecordVo buildFollowRecordItem(Map<Long, MallUserInfo> usersMap, InvestFollowRecordEntity item,
InvestCustomerEntity customerEntity, WxBrand brand) {
List<MallUserInfo> ownerInfo = getMallUserInfos(usersMap, item);
InvestFollowRecordVo followRecordVo = new InvestFollowRecordVo();
followRecordVo.setCustomer(customerEntity);
@@ -215,7 +319,8 @@ public class InvestBizServiceImpl implements InvestBizService {
return followRecordVo;
}

private InvestDemandVo buildDemindItem(InvestDemandEntity item, InvestCustomerEntity customer, WxBrand brand, WxShop shop, Map<Long, MallUserInfo> usersMap) {
private InvestDemandVo buildDemindItem(InvestDemandEntity item, InvestCustomerEntity customer, WxBrand brand,
WxShop shop, Map<Long, MallUserInfo> usersMap) {
InvestDemandVo resultItemVo = new InvestDemandVo();
resultItemVo.setBrand(brand);
resultItemVo.setCustomer(customer);
@@ -225,11 +330,6 @@ public class InvestBizServiceImpl implements InvestBizService {
return resultItemVo;
}

private Map<Long, MallUserInfo> getUserInfoMap() {
Collection<MallUserInfo> users = userInfoService.findList(null);
return users.parallelStream().collect(Collectors.toMap(MallUserInfo::getId, MallUserInfo -> MallUserInfo));
}

private InvestTaskVo buildTaskItem(InvestTaskEntity item, WxShop shop, Map<Long, MallUserInfo> usersMap) {
List<MallUserInfo> ownerInfo = getMallUserInfos(item.getOwner(), usersMap);
InvestTaskVo resultItemVo = new InvestTaskVo();
@@ -242,8 +342,8 @@ public class InvestBizServiceImpl implements InvestBizService {
private List<MallUserInfo> getMallUserInfos(Object userJson, Map<Long, MallUserInfo> usersMap) {
List<MallUserInfo> ownerInfo = Lists.newArrayList();
JSONArray ownerList;
if(userJson instanceof String) {
ownerList = JSONArray.parseArray((String)userJson);
if (userJson instanceof String) {
ownerList = JSONArray.parseArray((String) userJson);
} else {
ownerList = (JSONArray) userJson;
}
@@ -255,18 +355,19 @@ public class InvestBizServiceImpl implements InvestBizService {
return ownerInfo;
}

private List<InvestDemandVo> getTargeInfoList(InvestPageResult<InvestDemandEntity> demandPage, List<InvestCustomerEntity> customers) {
List<InvestDemandEntity> demandList = demandPage.getRecords();
Map<Long, InvestCustomerEntity> customersMap = getCustomerMap(customers);
private List<InvestDemandVo> getTargeInfoList(InvestPageResult<InvestDemandEntity> demandPage) {
Collection<InvestDemandEntity> demandList = demandPage.getRecords();
Collection<InvestCustomerEntity> customers = customerService.listByIds(getIds(demandList, InvestDemandEntity::getCustomerId));
Map<Long, InvestCustomerEntity> customersMap = getMap(customers, InvestCustomerEntity::getId);

//3、目标信息
Collection<WxShop> shops = shopService.getByIds(demandList.stream().map(InvestDemandEntity::getTargetId).collect(Collectors.toList()));
Map<Long, WxShop> shopsMap = shops.stream().collect(Collectors.toMap(WxShop::getId, shop -> shop));
Collection<WxShop> shops = shopService.getByIds(getIds(demandList, InvestDemandEntity::getTargetId));
Map<Long, WxShop> shopsMap = getMap(shops, WxShop::getId);

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

List<InvestDemandVo> resultList = new ArrayList<>();
for (InvestDemandEntity item : demandList) {
@@ -281,17 +382,25 @@ public class InvestBizServiceImpl implements InvestBizService {
return resultList;
}

private Map<Long, WxBrand> getBrandMap(Collection<? extends Serializable> ids) {
Collection<WxBrand> brands = brandService.getByIds(ids);
return brands.stream().collect(Collectors.toMap(WxBrand::getId, brand -> brand));
private <T> InvestPageQuery<T> buildPageQuery(InvestPageQuery params, T t) {
InvestPageQuery<T> pageQuery = new InvestPageQuery<>();
BeanUtils.copyProperties(params, pageQuery);
if (Objects.nonNull(t)) {
pageQuery.setQueryData(t);
}
return pageQuery;
}

public <R, T> R convert(T params, Function<T, R> function) {
InvestHelper.notNull(params);
return function.apply(params);
}

private Map<Long, InvestCustomerEntity> getCustomerMap(Collection<InvestCustomerEntity> customers) {
return customers.stream().collect(Collectors.toMap(InvestCustomerEntity::getId, customer -> customer));
private <T, R> Map<R, T> getMap(Collection<T> dataList, Function<T, R> keyMapper) {
return dataList.parallelStream().collect(Collectors.toMap(keyMapper, entity -> entity));
}

private Collection<InvestCustomerEntity> getCustomers(Stream<Long> longStream) {
return customerService.listByIds(longStream.collect(Collectors.toList()));
private <T, R> Collection<R> getIds(Collection<T> dataList, Function<? super T, R> mapper) {
return dataList.parallelStream().map(mapper).collect(Collectors.toList());
}
}

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