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

Merge tag 'jenkins-back-end-3123' into release

develop
release_toaliyun_real
Burce 6 лет назад
Родитель
Сommit
3218f42dd3
5 измененных файлов: 89 добавлений и 46 удалений
  1. +10
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestController.java
  2. +1
    -2
      mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java
  3. +19
    -3
      mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java
  4. +56
    -41
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java
  5. +3
    -0
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestTaskServiceImpl.java

+ 10
- 0
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<Map> statistics() {
return execute(null, p -> bizService.statistics());
}

}

+ 1
- 2
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() ;



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

@@ -1,6 +1,8 @@
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;
@@ -8,8 +10,11 @@ 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;
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 +194,19 @@ 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 boolean checkOwner(InvestTaskEntity entity) {
boolean ownerEmpty = true;
try {
List<Long> owner = JSONArray.parseArray(entity.getOwner(), Long.class);
if (CollectionUtils.isNotEmpty(owner)) {
entity.setStatus(EnumTaskStatus.NEGOTIATING);
ownerEmpty = false;
} else {
entity.setStatus(EnumTaskStatus.CREATED);
}
} catch (Exception e) {
InvestHelper.throwException(ErrorCode.SYS_PARAMETER_ERROR, "owner");
}
return ownerEmpty;
}
}

+ 56
- 41
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,11 +655,12 @@ public class InvestBizServiceImpl implements InvestBizService {
}
remindPageQuery.setQueryData(remindQuery);
LambdaQueryWrapper<InvestRemindEntity> 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()));
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())
, getDayEnd(params.getRemindDate()));
}
queryWrapper.orderByDesc(InvestRemindEntity::getCreateDate);
InvestPageResult<InvestRemindEntity> recordPage = remindService.queryPage(remindPageQuery, queryWrapper);
if (CollectionUtils.isEmpty(recordPage.getRecords())) {
@@ -749,7 +750,7 @@ public class InvestBizServiceImpl implements InvestBizService {
//3、商品合同信息
Map<Long, WxRentContract> 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<String, Object> map = new HashMap<>();
map.put("startdate", contract.getRentalStartDate());
map.put("enddate", contract.getRentalEndDate());
@@ -810,13 +811,13 @@ public class InvestBizServiceImpl implements InvestBizService {
if (Objects.nonNull(owner) && !Objects.equals(owner, 0L)) {
List<Long> 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());
}
}

@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<Long, WxRentContract> 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());
}
@@ -941,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());
}
@@ -950,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());
}
@@ -1020,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<InvestCustomerEntity>()
.ge(InvestCustomerEntity::getTenantId, InvestUserContext.getUser().getTenantId())));
.eq(InvestCustomerEntity::getTenantId, InvestUserContext.getUser().getTenantId())));
result.put("taskToday", customerService.count(new LambdaQueryWrapper<InvestCustomerEntity>()
.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<InvestCustomerEntity>()
result.put("customerImportant", customerService.count(new LambdaQueryWrapper<InvestCustomerEntity>()
.eq(InvestCustomerEntity::getType, EnumCustomerType.INTENTIONAL)
.eq(InvestCustomerEntity::getTenantId, InvestUserContext.getUser().getTenantId())));
result.put("remindCount", remindService.count(new LambdaQueryWrapper<InvestRemindEntity>()
.ge(InvestRemindEntity::getTenantId, InvestUserContext.getUser().getTenantId())));
result.put("taskCreate", taskService.count(new LambdaQueryWrapper<InvestTaskEntity>()
result.put("remindTotal", remindService.count(new LambdaQueryWrapper<InvestRemindEntity>()
.eq(InvestRemindEntity::getTenantId, InvestUserContext.getUser().getTenantId())));
result.put("taskUnassigned", taskService.count(new LambdaQueryWrapper<InvestTaskEntity>()
.eq(InvestTaskEntity::getStatus, EnumTaskStatus.CREATED)
.eq(InvestTaskEntity::getTenantId, InvestUserContext.getUser().getTenantId())));
//result.put("customerCreate", customerService.count(new LambdaQueryWrapper<InvestCustomerEntity>()
// .eq(InvestCustomerEntity::getStatus, EnumTaskStatus.CREATED)));
result.put("customerUnassigned", demandService.count(new LambdaQueryWrapper<InvestDemandEntity>()
.eq(InvestDemandEntity::getTenantId, InvestUserContext.getUser().getTenantId())
.eq(InvestDemandEntity::getOwner, 0L)));
} else {
result.put("taskTotal", taskService.count(new LambdaQueryWrapper<InvestTaskEntity>()
.ge(InvestTaskEntity::getStatus, EnumTaskStatus.CREATED)
.apply("`owner` REGEXP {0}", InvestUserContext.getUserId())));
result.put("customerTotal", demandService.count(new LambdaQueryWrapper<InvestDemandEntity>()
.ge(InvestDemandEntity::getOwner, InvestUserContext.getUser().getTenantId())));
.eq(InvestDemandEntity::getOwner, InvestUserContext.getUser().getTenantId())));
result.put("taskToday", customerService.count(new LambdaQueryWrapper<InvestCustomerEntity>()
.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<InvestDemandEntity>()
.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;
}
@@ -1049,10 +1062,11 @@ public class InvestBizServiceImpl implements InvestBizService {
// return;
//}

if (StringUtils.isBlank(investTaskEntity.getOwner())) {
investTaskEntity.setStatus(EnumTaskStatus.CREATED);
} else {
WxShop shop = shopService.getById(investTaskEntity.getTargetId());
if (InvestHelper.checkOwner(investTaskEntity)) {
return;
}
WxShop shop = shopService.getById(investTaskEntity.getTargetId());
if (Objects.nonNull(shop)) {
Map<Long, WxRentContract> shopContractMap = getWxRentContractMap(shop);
WxRentContract contract = shopContractMap.get(shop.getId());
if (Objects.nonNull(contract)) {
@@ -1067,8 +1081,6 @@ public class InvestBizServiceImpl implements InvestBizService {
int count = rentContractService.selectContractCountByShopId(contractQuery);
if (count > 0) {
investTaskEntity.setStatus(EnumTaskStatus.INTENTION);
} else {
investTaskEntity.setStatus(EnumTaskStatus.NEGOTIATING);
}
}
}
@@ -1202,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());
@@ -1213,26 +1225,29 @@ public class InvestBizServiceImpl implements InvestBizService {
}

private List<InvestDemandVo> getTargeInfoList(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);
Map<Long, InvestDemandEntity> demindsMap = new HashMap<>();
Map<Long, WxShop> shopsMap = new HashMap<>();
Map<Long, MallUserInfo> usersMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(demandList)) {
demindsMap = getMap(demandList, InvestDemandEntity::getCustomerId);
//3、目标信息
Collection<WxShop> 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<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId);
//5、用户
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.getByIds(getIds(demandList, InvestDemandEntity::getOwner)), MallUserInfo::getId);

List<InvestDemandVo> 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;


+ 3
- 0
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;
@@ -30,6 +32,7 @@ public class InvestTaskServiceImpl extends InvestBaseServiceImpl<InvestTaskMappe

@Override
public boolean save(InvestTaskEntity entity) {
InvestHelper.checkOwner(entity);
super.saveAction(entity, this::checkBeforeSaveOrUpdate);
saveMessage(entity);
return true;


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