|
|
@@ -1,9 +1,16 @@ |
|
|
package com.iformall.service.invest.impl; |
|
|
package com.iformall.service.invest.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.ExcelImportUtil; |
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.ImportParams; |
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
|
|
|
|
|
import cn.afterturn.easypoi.handler.impl.ExcelDataHandlerDefaultImpl; |
|
|
|
|
|
import cn.afterturn.easypoi.handler.inter.IExcelDataHandler; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
|
|
import com.iformall.common.Result; |
|
|
import com.iformall.domain.dto.InvestDemandDto; |
|
|
import com.iformall.domain.dto.InvestDemandDto; |
|
|
import com.iformall.domain.dto.InvestTaskDto; |
|
|
import com.iformall.domain.dto.InvestTaskDto; |
|
|
import com.iformall.domain.po.*; |
|
|
import com.iformall.domain.po.*; |
|
|
@@ -11,9 +18,12 @@ import com.iformall.domain.po.invest.*; |
|
|
import com.iformall.domain.vo.WxShopVo; |
|
|
import com.iformall.domain.vo.WxShopVo; |
|
|
import com.iformall.domain.vo.invest.*; |
|
|
import com.iformall.domain.vo.invest.*; |
|
|
import com.iformall.enums.*; |
|
|
import com.iformall.enums.*; |
|
|
|
|
|
import com.iformall.exception.MallinkException; |
|
|
import com.iformall.service.*; |
|
|
import com.iformall.service.*; |
|
|
import com.iformall.service.invest.*; |
|
|
import com.iformall.service.invest.*; |
|
|
|
|
|
import com.iformall.utils.Constant; |
|
|
import com.iformall.utils.DateUtils; |
|
|
import com.iformall.utils.DateUtils; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
import org.apache.commons.collections.MapUtils; |
|
|
import org.apache.commons.collections.MapUtils; |
|
|
import org.apache.commons.compress.utils.Lists; |
|
|
import org.apache.commons.compress.utils.Lists; |
|
|
@@ -21,15 +31,22 @@ import org.apache.commons.lang3.ObjectUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
import java.io.BufferedInputStream; |
|
|
|
|
|
import java.io.File; |
|
|
|
|
|
import java.io.FileOutputStream; |
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
import java.util.function.Function; |
|
|
import java.util.function.Function; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Slf4j |
|
|
@Service |
|
|
@Service |
|
|
public class InvestBizServiceImpl implements InvestBizService { |
|
|
public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
|
|
|
|
|
@@ -59,6 +76,10 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
private WxRentContractService rentContractService; |
|
|
private WxRentContractService rentContractService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private ExcelService excelService; |
|
|
private ExcelService excelService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
StringRedisTemplate stringRedisTemplate; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private String fmUploadDir; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public InvestPageResult<InvestDemandVo> queryPageDemand(InvestDemandQuery params) { |
|
|
public InvestPageResult<InvestDemandVo> queryPageDemand(InvestDemandQuery params) { |
|
|
@@ -123,9 +144,262 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void exportCustomerTemplate(HttpServletResponse response) { |
|
|
|
|
|
List<InvestCustomerVo> resultList = new ArrayList<>(); |
|
|
|
|
|
InvestCustomerVo item = new InvestCustomerVo(); |
|
|
|
|
|
item.setBusiness("超市"); |
|
|
|
|
|
item.setRentArea(100); |
|
|
|
|
|
item.setShopNumber("A10092"); |
|
|
|
|
|
item.setBrandName("肯德基"); |
|
|
|
|
|
item.setName("张三"); |
|
|
|
|
|
item.setPhone("1358888888"); |
|
|
|
|
|
item.setOpeningTime("2019-01-01"); |
|
|
|
|
|
resultList.add(item); |
|
|
|
|
|
excelService.exportExcel(resultList, null, "客户信息模板", InvestCustomerVo.class, "客户信息模板.xlsx", response, true); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void importCustomer(MultipartFile mFile) { |
|
|
public void importCustomer(MultipartFile mFile) { |
|
|
|
|
|
if (mFile.isEmpty()) { |
|
|
|
|
|
throw new MallinkException(Result.ERROR, "上传文件不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String importKey = Constant.importInvestCustomerPrev + InvestUserContext.getUserId(); |
|
|
|
|
|
final String tenantId = InvestUserContext.getUser().getTenantId(); |
|
|
|
|
|
|
|
|
|
|
|
//查询当前用户得到的值是否为空,为空继续,不为空,返回模板正在导入 |
|
|
|
|
|
Boolean allCount = stringRedisTemplate.opsForHash().hasKey(importKey, "allCount"); |
|
|
|
|
|
if (allCount) { |
|
|
|
|
|
throw new MallinkException(Result.SUCCESS, "模板正在导入"); |
|
|
|
|
|
} |
|
|
|
|
|
setRedisValueIfAbsent(importKey); |
|
|
|
|
|
|
|
|
|
|
|
String fpath = fmUploadDir; |
|
|
|
|
|
File targetFile = new File(fpath); |
|
|
|
|
|
if (!targetFile.exists()) { |
|
|
|
|
|
targetFile.mkdirs(); |
|
|
|
|
|
} |
|
|
|
|
|
String fileName = "invest_1.xlsx"; |
|
|
|
|
|
int dot = mFile.getOriginalFilename().lastIndexOf('.'); |
|
|
|
|
|
fileName = fileName + mFile.getOriginalFilename().substring(dot); |
|
|
|
|
|
|
|
|
|
|
|
File lFile = new File(fpath + File.separator + fileName); |
|
|
|
|
|
|
|
|
|
|
|
FileOutputStream fos = null; |
|
|
|
|
|
BufferedInputStream fs = null; |
|
|
|
|
|
try { |
|
|
|
|
|
fos = new FileOutputStream(lFile); |
|
|
|
|
|
fs = (BufferedInputStream) mFile.getInputStream(); |
|
|
|
|
|
byte[] buffer = new byte[1024]; |
|
|
|
|
|
int len = 0; |
|
|
|
|
|
while ((len = fs.read(buffer)) != -1) { |
|
|
|
|
|
fos.write(buffer, 0, len); |
|
|
|
|
|
} |
|
|
|
|
|
fos.close(); |
|
|
|
|
|
fs.close(); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
setRedisValueIfError(importKey, "1", "1", e); |
|
|
|
|
|
throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); |
|
|
|
|
|
} finally { |
|
|
|
|
|
if (fos != null) { |
|
|
|
|
|
try { |
|
|
|
|
|
fos.close(); |
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
setRedisValueIfError(importKey, "1", "1", e); |
|
|
|
|
|
throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (fs != null) { |
|
|
|
|
|
try { |
|
|
|
|
|
fs.close(); |
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
setRedisValueIfError(importKey, "1", "1", e); |
|
|
|
|
|
throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
doImport(lFile, tenantId, importKey); |
|
|
|
|
|
throw new MallinkException(Result.SUCCESS, "模板正在导入"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void doImport(File file, String tenantId, String importKey) { |
|
|
|
|
|
ImportParams params = new ImportParams(); |
|
|
|
|
|
// 需要验证 |
|
|
|
|
|
params.setImportFields(new String[]{"品牌*", "品牌负责人*", "负责人电话*", "经营业态*", "意向铺位*", "意向租凭面积", "预计开业时间"}); |
|
|
|
|
|
IExcelDataHandler<InvestCustomerVoT> handler = new ExcelDataHandlerDefaultImpl<InvestCustomerVoT>() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public Object importHandler(InvestCustomerVoT obj, String name, Object value) { |
|
|
|
|
|
if (value == null) { |
|
|
|
|
|
value = ""; |
|
|
|
|
|
} |
|
|
|
|
|
System.out.println(name + " + " + value.toString()); |
|
|
|
|
|
return super.importHandler(obj, name, value); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
handler.setNeedHandlerFields(new String[]{"品牌*", "品牌负责人*", "负责人电话*", "经营业态*", "意向铺位*"}); |
|
|
|
|
|
params.setNeedVerify(true); |
|
|
|
|
|
|
|
|
|
|
|
ExcelImportResult<InvestCustomerVoT> datalist = null; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
datalist = ExcelImportUtil.importExcelMore(file, InvestCustomerVoT.class, params); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
setRedisValue(importKey, "1", "0", "0", "1", true); |
|
|
|
|
|
log.error(e.getMessage()); |
|
|
|
|
|
// 删除缓存文件 |
|
|
|
|
|
file.delete(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
// 删除缓存文件 |
|
|
|
|
|
file.delete(); |
|
|
|
|
|
|
|
|
|
|
|
if (datalist == null) { |
|
|
|
|
|
log.error("导入模板失败: 模板数据解析失败"); |
|
|
|
|
|
setRedisValue(importKey, "1", "0", "0", "1", true); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<InvestCustomerVoT> successList = datalist.getList(); |
|
|
|
|
|
List<InvestCustomerVoT> failList = datalist.getFailList(); |
|
|
|
|
|
|
|
|
|
|
|
log.info("验证通过的数量: " + successList.size()); |
|
|
|
|
|
log.info("验证未通过的数量: " + failList.size()); |
|
|
|
|
|
|
|
|
|
|
|
int total = successList.size() + failList.size(); |
|
|
|
|
|
int all_success = successList.size(); |
|
|
|
|
|
int all_fail = failList.size(); |
|
|
|
|
|
|
|
|
|
|
|
//添加到redis里 |
|
|
|
|
|
setRedisValue(importKey, "" + total, "" + all_success, "0", "" + all_fail, total == all_fail); |
|
|
|
|
|
if (CollectionUtils.isEmpty(successList)) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
//品牌信息 |
|
|
|
|
|
List<WxBrand> brands = brandService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); |
|
|
|
|
|
Map<String, WxBrand> brandMap = getMap(brands, WxBrand::getName); |
|
|
|
|
|
|
|
|
|
|
|
//业态信息 |
|
|
|
|
|
List<WxBusiness> businesses = businessService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); |
|
|
|
|
|
Map<String, WxBusiness> businesseMap = getMap(businesses, WxBusiness::getTitle); |
|
|
|
|
|
|
|
|
|
|
|
//商铺信息 |
|
|
|
|
|
List<WxShop> shops = shopService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); |
|
|
|
|
|
Map<String, WxShop> shopMap = getMap(shops, WxShop::getShopNumber); |
|
|
|
|
|
|
|
|
|
|
|
//商铺信息 |
|
|
|
|
|
LambdaQueryWrapper<InvestCustomerEntity> customerQuery = new LambdaQueryWrapper<>(); |
|
|
|
|
|
customerQuery.in(InvestCustomerEntity::getPhone, getIds(successList, InvestCustomerVoT::getPhone)); |
|
|
|
|
|
List<InvestCustomerEntity> customers = customerService.list(customerQuery); |
|
|
|
|
|
Map<String, InvestCustomerEntity> customerMap = getMap(customers, InvestCustomerEntity::getPhone); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
successList.parallelStream().forEach(customer -> { |
|
|
|
|
|
if (StringUtils.isBlank(customer.getPhone())) { |
|
|
|
|
|
stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); |
|
|
|
|
|
log.error("负责人电话为空", customer.toString()); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isBlank(customer.getShopNumber())) { |
|
|
|
|
|
stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); |
|
|
|
|
|
log.error("意向铺位为空", customer.toString()); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isBlank(customer.getBrandName())) { |
|
|
|
|
|
stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); |
|
|
|
|
|
log.error("品牌为空", customer.toString()); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isBlank(customer.getName())) { |
|
|
|
|
|
stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); |
|
|
|
|
|
log.error("品牌负责人为空", customer.toString()); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isBlank(customer.getBusiness())) { |
|
|
|
|
|
stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); |
|
|
|
|
|
log.error("经营业态为空", customer.toString()); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
InvestDemandDto customerBase = convetCustomer(customer, brandMap, businesseMap, shopMap, customerMap); |
|
|
|
|
|
if (customerBase == null) { |
|
|
|
|
|
stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); |
|
|
|
|
|
log.error("userBasenull"); |
|
|
|
|
|
} |
|
|
|
|
|
saveCustomerAndDemand(customerBase) ; |
|
|
|
|
|
}); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
setRedisValue(importKey, "1", "0", "0", "1", true); |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
log.error("导入模板失败:" + e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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()))) { |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
customerEntity.setBrandId(brandMap.get(customerVoT.getBrandName()).getId()); |
|
|
|
|
|
|
|
|
|
|
|
if (Objects.isNull(businesseMap.get(customerVoT.getBusiness()))) { |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
customerEntity.setBusinessId(businesseMap.get(customerVoT.getBusiness()).getId()); |
|
|
|
|
|
|
|
|
|
|
|
InvestDemandEntity demandEntity = new InvestDemandEntity(); |
|
|
|
|
|
if (Objects.isNull(shopMap.get(customerVoT.getShopNumber()))) { |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
demandEntity.setTargetId(shopMap.get(customerVoT.getShopNumber()).getId()); |
|
|
|
|
|
demandEntity.setTargetType(EnumInvestType.RENT); |
|
|
|
|
|
Map<String, Object> intent = new HashMap<>(); |
|
|
|
|
|
if (Objects.nonNull(customerVoT.getRentArea())) { |
|
|
|
|
|
intent.put(InvestDemandEntity.KEY_RENT_AREA, customerVoT.getRentArea()); |
|
|
|
|
|
} |
|
|
|
|
|
if (Objects.nonNull(customerVoT.getOpeningTime())) { |
|
|
|
|
|
intent.put(InvestDemandEntity.KEY_OPENING_TIME, customerVoT.getOpeningTime()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!intent.isEmpty()) { |
|
|
|
|
|
demandEntity.setIntent(JSON.toJSONString(intent)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
InvestDemandDto demandDto = new InvestDemandDto(); |
|
|
|
|
|
demandDto.setCustomer(customerEntity); |
|
|
|
|
|
demandDto.setDemand(demandEntity); |
|
|
|
|
|
if (Objects.isNull(customerMap.get(customerVoT.getPhone()))) { |
|
|
|
|
|
//TODO insert |
|
|
|
|
|
} else { |
|
|
|
|
|
//TODO update |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return demandDto; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setRedisValue(String importKey, String allCount, String allSuccessCount, String processCount, String failCount, boolean fail) { |
|
|
|
|
|
stringRedisTemplate.opsForHash().put(importKey, "allCount", allCount); |
|
|
|
|
|
stringRedisTemplate.opsForHash().put(importKey, "allSuccessCount", allSuccessCount); |
|
|
|
|
|
stringRedisTemplate.opsForHash().put(importKey, "processCount", processCount); |
|
|
|
|
|
stringRedisTemplate.opsForHash().put(importKey, "failCount", failCount); |
|
|
|
|
|
if (fail) { |
|
|
|
|
|
stringRedisTemplate.expire(importKey, 10, TimeUnit.SECONDS); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setRedisValueIfAbsent(String importKey) { |
|
|
|
|
|
stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", 0 + ""); |
|
|
|
|
|
stringRedisTemplate.expire(importKey, 30, TimeUnit.MINUTES); |
|
|
|
|
|
stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allSuccessCount", 0 + ""); |
|
|
|
|
|
stringRedisTemplate.opsForHash().putIfAbsent(importKey, "processCount", ""); |
|
|
|
|
|
stringRedisTemplate.opsForHash().putIfAbsent(importKey, "failCount", ""); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setRedisValueIfError(String importKey, String allCount, String failCount, Exception e) { |
|
|
|
|
|
stringRedisTemplate.expire(importKey, 3, TimeUnit.SECONDS); |
|
|
|
|
|
stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", allCount); |
|
|
|
|
|
stringRedisTemplate.opsForHash().putIfAbsent(importKey, "failCount", failCount); |
|
|
|
|
|
log.error(e.getMessage()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@@ -499,6 +773,12 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
return buildTaskItem(taskEntity, shopVo, usersMap); |
|
|
return buildTaskItem(taskEntity, shopVo, usersMap); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 获取商铺对应的正式合同信息 |
|
|
|
|
|
* |
|
|
|
|
|
* @param shop |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
private Map<Long, WxRentContract> getWxRentContractMap(WxShop shop) { |
|
|
private Map<Long, WxRentContract> getWxRentContractMap(WxShop shop) { |
|
|
InvestHelper.notNull(shop, "商铺不存在"); |
|
|
InvestHelper.notNull(shop, "商铺不存在"); |
|
|
return rentContractService.selectRentContractByShopIds(Arrays.asList(shop.getId()), StringUtils.join(shop.getId(), ""), |
|
|
return rentContractService.selectRentContractByShopIds(Arrays.asList(shop.getId()), StringUtils.join(shop.getId(), ""), |
|
|
@@ -588,12 +868,13 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
Map<Long, WxRentContract> shopContractMap = getWxRentContractMap(shop); |
|
|
Map<Long, WxRentContract> shopContractMap = getWxRentContractMap(shop); |
|
|
WxRentContract contract = shopContractMap.get(shop.getId()); |
|
|
WxRentContract contract = shopContractMap.get(shop.getId()); |
|
|
if (Objects.nonNull(contract)) { |
|
|
if (Objects.nonNull(contract)) { |
|
|
InvestHelper.addContractId(investTaskEntity.getContent(), contract.getId()); |
|
|
|
|
|
|
|
|
InvestHelper.addContractId(investTaskEntity.getContent(), contract.getId(), null); |
|
|
} else { |
|
|
} else { |
|
|
WxRentContract contractQuery = new WxRentContract(); |
|
|
WxRentContract contractQuery = new WxRentContract(); |
|
|
contractQuery.setTenantId(InvestUserContext.getUser().getTenantId()); |
|
|
contractQuery.setTenantId(InvestUserContext.getUser().getTenantId()); |
|
|
contractQuery.setShopId(investTaskEntity.getTargetId()); |
|
|
contractQuery.setShopId(investTaskEntity.getTargetId()); |
|
|
contractQuery.setStatus(EnumRentContractStatus.INTENTION.getCode()); |
|
|
contractQuery.setStatus(EnumRentContractStatus.INTENTION.getCode()); |
|
|
|
|
|
//获取意向合同 |
|
|
int count = rentContractService.selectContractCountByShopId(contractQuery); |
|
|
int count = rentContractService.selectContractCountByShopId(contractQuery); |
|
|
if (count > 0) { |
|
|
if (count > 0) { |
|
|
investTaskEntity.setStatus(EnumTaskStatus.INTENTION); |
|
|
investTaskEntity.setStatus(EnumTaskStatus.INTENTION); |
|
|
@@ -652,8 +933,14 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
resultItemVo.setDemandOwner(item.getOwner()); |
|
|
resultItemVo.setDemandOwner(item.getOwner()); |
|
|
if (StringUtils.isNotBlank(item.getIntent())) { |
|
|
if (StringUtils.isNotBlank(item.getIntent())) { |
|
|
Map intentMap = JSON.parseObject(item.getIntent(), Map.class); |
|
|
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))); |
|
|
|
|
|
|
|
|
Object rentArea = intentMap.get(InvestDemandEntity.KEY_RENT_AREA); |
|
|
|
|
|
Object openingTime = intentMap.get(InvestDemandEntity.KEY_OPENING_TIME); |
|
|
|
|
|
if (Objects.nonNull(rentArea)) { |
|
|
|
|
|
resultItemVo.setRentArea(Integer.valueOf(String.valueOf(rentArea))); |
|
|
|
|
|
} |
|
|
|
|
|
if (Objects.nonNull(openingTime)) { |
|
|
|
|
|
resultItemVo.setOpeningTime(String.valueOf(openingTime)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
//resultItemVo.setBusiness(usersMap.get(item.getOwner())); |
|
|
//resultItemVo.setBusiness(usersMap.get(item.getOwner())); |
|
|
|