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

[招商][客户编号]

release_toaliyun_real
Burce 6 лет назад
Родитель
Сommit
9c99cf039f
6 измененных файлов: 82 добавлений и 15 удалений
  1. +2
    -0
      mallinkAdmin/src/main/java/com/iformall/log/TableOperateAspect.java
  2. +2
    -0
      mallinkAdmin/src/main/resources/db/migration/V201910241400__W_INVEST_ALTER.sql
  3. +6
    -0
      mallinkService/src/main/java/com/iformall/domain/po/invest/InvestBaseEntity.java
  4. +8
    -0
      mallinkService/src/main/java/com/iformall/domain/po/invest/InvestCustomerEntity.java
  5. +3
    -3
      mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandQuery.java
  6. +61
    -12
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java

+ 2
- 0
mallinkAdmin/src/main/java/com/iformall/log/TableOperateAspect.java Просмотреть файл

@@ -8,6 +8,7 @@ import com.google.common.collect.Maps;
import com.iformall.common.LogColumn;
import com.iformall.domain.po.invest.InvestBaseEntity;
import com.iformall.domain.po.invest.InvestOperateRecordEntity;
import com.iformall.domain.vo.invest.InvestUserContext;
import com.iformall.domain.vo.invest.TableTriple;
import com.iformall.enums.EnumTableOperateType;
import com.iformall.service.invest.InvestHelper;
@@ -108,6 +109,7 @@ public class TableOperateAspect {
InvestOperateRecordEntity recordEntity = new InvestOperateRecordEntity();
recordEntity.setContent(JSON.toJSONString(o));
recordEntity.setOperateType(operateType);
recordEntity.setOperator(InvestUserContext.getUserId());
recordEntity.setTbl(getTbl(signature));
recordEntity.setTid(tid);
toSaveRecord.add(recordEntity) ;


+ 2
- 0
mallinkAdmin/src/main/resources/db/migration/V201910241400__W_INVEST_ALTER.sql Просмотреть файл

@@ -0,0 +1,2 @@
ALTER TABLE `invest_demand` CHANGE COLUMN `owner` `owner` bigint(20) DEFAULT 0 COMMENT '负责人';
ALTER TABLE `invest_customer` ADD COLUMN `customer_no` varchar(20) NOT NULL DEFAULT '' COMMENT '客户编号' AFTER `tenant_id`;

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

@@ -25,6 +25,12 @@ public class InvestBaseEntity implements Serializable {
@TableId(type = IdType.ID_WORKER)
@io.swagger.annotations.ApiModelProperty(value = "主键ID", name = "id")
private Long id;

/**
* 客户编号
*/
@io.swagger.annotations.ApiModelProperty(value = "客户编号", name = "customerNo")
private String customerNo;
/**
* 租户ID
*/


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

@@ -29,6 +29,13 @@ import java.util.Date;
@EqualsAndHashCode(callSuper = true)
public class InvestCustomerEntity extends InvestBaseEntity {

/**
* 品牌ID
*/
@LogColumn
@io.swagger.annotations.ApiModelProperty(value = "客户编号", name = "customerNo")
private String customerNo;

/**
* 客户名称
*/
@@ -55,6 +62,7 @@ public class InvestCustomerEntity extends InvestBaseEntity {
@LogColumn
@io.swagger.annotations.ApiModelProperty(value = "品牌ID", name = "brandId")
private Long brandId;

/**
* 客户分类:0-潜在客户;1-意向客户;2-合作客户;3-谈判失败
*/


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

@@ -9,10 +9,10 @@ import lombok.EqualsAndHashCode;
public class InvestDemandQuery extends InvestPageQuery {

/**
* 主键ID
* 客户编号
*/
@io.swagger.annotations.ApiModelProperty(value = "客户编号", name = "customerId")
private Long customerId;
@io.swagger.annotations.ApiModelProperty(value = "客户编号", name = "customerNo")
private String customerNo;

/**
* 客户分类:0-潜在客户;1-意向客户;2-合作客户;3-谈判失败


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

@@ -105,6 +105,7 @@ public class InvestBizServiceImpl implements InvestBizService {
queryWrapperCustomer.in(CollectionUtils.isNotEmpty(demandList),InvestCustomerEntity::getId, getIds(demandList, InvestDemandEntity::getCustomerId));
}
}
queryWrapperCustomer.like(StringUtils.isNotBlank(params.getCustomerNo()), InvestCustomerEntity::getCustomerNo, params.getCustomerNo());
queryWrapperCustomer.orderByDesc(InvestCustomerEntity::getCreateDate);
InvestPageResult<InvestCustomerEntity> customers = customerService.queryPage(buildPageQuery(params, null), queryWrapperCustomer);
List<InvestDemandVo> resultList = getTargeInfoList(demandList, customers.getRecords());
@@ -279,12 +280,10 @@ public class InvestBizServiceImpl implements InvestBizService {
return;
}
//品牌信息
List<WxBrand> brands = brandService.listAsPage(null, 1, Integer.MAX_VALUE).getList();
Map<String, WxBrand> brandMap = getMap(brands, WxBrand::getName);
Map<String, WxBrand> brandMap = getBrandMap();

//业态信息
List<WxBusiness> businesses = businessService.listAsPage(null, 1, Integer.MAX_VALUE).getList();
Map<String, WxBusiness> businesseMap = getMap(businesses, WxBusiness::getTitle);
Map<String, WxBusiness> businesseMap = getBusinessMap();

//商铺信息
List<WxShop> shops = shopService.listAsPage(null, 1, Integer.MAX_VALUE).getList();
@@ -337,6 +336,16 @@ public class InvestBizServiceImpl implements InvestBizService {
}
}

private Map<String, WxBusiness> getBusinessMap() {
List<WxBusiness> businesses = businessService.listAsPage(null, 1, Integer.MAX_VALUE).getList();
return getMap(businesses, WxBusiness::getTitle);
}

private Map<String, WxBrand> getBrandMap() {
List<WxBrand> brands = brandService.listAsPage(null, 1, Integer.MAX_VALUE).getList();
return getMap(brands, WxBrand::getName);
}

private InvestDemandDto convetCustomer(InvestCustomerVoT customerVoT, Map<String, WxBrand> brandMap, Map<String, WxBusiness> businesseMap, Map<String, WxShop> shopMap, Map<String, InvestCustomerEntity> customerMap) {
InvestCustomerEntity customerEntity = new InvestCustomerEntity();
if (Objects.isNull(brandMap.get(customerVoT.getBrandName()))) {
@@ -412,9 +421,9 @@ public class InvestBizServiceImpl implements InvestBizService {

private InvestDemandDto doConvertDemand(InvestDemandQuery params) {
InvestCustomerEntity customerEntity = null;
if (ObjectUtils.anyNotNull(params.getCustomerId(), params.getCustomerType(), params.getBusinessId())) {
if (ObjectUtils.anyNotNull(params.getCustomerNo(), params.getCustomerType(), params.getBusinessId())) {
customerEntity = new InvestCustomerEntity();
customerEntity.setId(params.getCustomerId());
customerEntity.setCustomerNo(params.getCustomerNo());
customerEntity.setType(params.getCustomerType());
customerEntity.setBusinessId(params.getBusinessId());
}
@@ -705,12 +714,12 @@ public class InvestBizServiceImpl implements InvestBizService {
return true;
}

private void saveMessage(InvestDemandEntity entity, InvestCustomerEntity customerEntity) {
if (Objects.isNull(entity)) {
private void saveMessage(InvestDemandEntity demandEntity, InvestCustomerEntity customerEntity) {
if (Objects.isNull(demandEntity)) {
return;
}
Long owner = entity.getOwner();
if (Objects.nonNull(owner)) {
Long owner = demandEntity.getOwner();
if (Objects.nonNull(owner) && !Objects.equals(owner, 0L)) {
List<Long> ownerArray = Arrays.asList(owner);
demandService.saveBatchMessage(ownerArray, EnumInvestMessageType.CUSTOMER_CREATE.getInfo(), EnumInvestMessageTag.CUSTOMER_CREATE, EnumFollowType.DEMAND, customerEntity.getId());
}
@@ -819,6 +828,12 @@ public class InvestBizServiceImpl implements InvestBizService {
Collection<InvestOperateRecordEntity> recordList = entityPageList.getRecords();
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.getByIds(getIds(recordList, InvestOperateRecordEntity::getOperator)), MallUserInfo::getId);

//品牌信息
Map<String, WxBrand> brandMap = getBrandMap();

//业态信息
Map<String, WxBusiness> businesseMap = getBusinessMap();

List<InvestOperateRecordVo> resultList = new ArrayList<>();
for (InvestOperateRecordEntity recordEntity : recordList) {
InvestOperateRecordVo itemVo = new InvestOperateRecordVo();
@@ -828,7 +843,38 @@ public class InvestBizServiceImpl implements InvestBizService {
itemVo.setOperatorName(userInfo.getName());
}
TableTriple content = JSON.parseObject(recordEntity.getContent(), TableTriple.class);
itemVo.setRecord(content);
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()) ;
if (Objects.nonNull(businessBefore)) {
tableTriple.setBefore(businessBefore.getTitle());
}
if (Objects.nonNull(businessAfter)) {
tableTriple.setBefore(businessAfter.getTitle());
}
} else if (Objects.equals(column, "brandId")) {
WxBrand brandBefore = brandMap.get(tableTriple.getBefore()) ;
WxBrand brandAfter = brandMap.get(tableTriple.getAfter()) ;
if (Objects.nonNull(brandBefore)) {
tableTriple.setBefore(brandBefore.getName());
}
if (Objects.nonNull(brandAfter)) {
tableTriple.setBefore(brandAfter.getName());
}
} else if (Objects.equals(column, "owner")) {
MallUserInfo userBefore = usersMap.get(tableTriple.getBefore());
MallUserInfo userAfter = usersMap.get(tableTriple.getAfter());
if (Objects.nonNull(userBefore)) {
tableTriple.setBefore(userBefore.getName());
}
if (Objects.nonNull(userAfter)) {
tableTriple.setBefore(userAfter.getName());
}
}
return tableTriple;
}));
resultList.add(itemVo);
}
BeanUtils.copyProperties(entityPageList, investPage);
@@ -908,13 +954,16 @@ public class InvestBizServiceImpl implements InvestBizService {
InvestDemandVo resultItemVo = new InvestDemandVo();
BeanUtils.copyProperties(customer, resultItemVo);
resultItemVo.setBrand(brand);
resultItemVo.setDemand(item);
resultItemVo.setTargetInfo(shop);
if (Objects.nonNull(item)) {
if (Objects.equals(item.getOwner(), 0L)) {
item.setOwner(null);
}
if (Objects.nonNull(usersMap.get(item.getOwner()))) {
resultItemVo.setOwnerInfo(usersMap.get(item.getOwner()));
}
}
resultItemVo.setDemand(item);
return resultItemVo;
}



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