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

[招商]adjust

release_toaliyun_real
Burce 6 лет назад
Родитель
Сommit
c99b470643
6 измененных файлов: 22 добавлений и 15 удалений
  1. +5
    -6
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java
  2. +0
    -1
      mallinkAdmin/src/main/resources/db/migration/V201910241500__W_INVEST_ALTER.sql
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java
  4. +11
    -7
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java
  5. +3
    -0
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestCustomerServiceImpl.java
  6. +2
    -0
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestTaskServiceImpl.java

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

@@ -10,8 +10,7 @@ import com.iformall.domain.vo.invest.InvestDemandVo;
import com.iformall.domain.vo.invest.InvestPageResult; import com.iformall.domain.vo.invest.InvestPageResult;
import com.iformall.service.invest.InvestBizService; import com.iformall.service.invest.InvestBizService;
import com.iformall.service.invest.InvestCustomerService; import com.iformall.service.invest.InvestCustomerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -101,11 +100,11 @@ public class InvestCustomerController extends InvestBaseController{
exportData(null, response, (p, u) -> investBizService.exportCustomerTemplate(u)); exportData(null, response, (p, u) -> investBizService.exportCustomerTemplate(u));
} }


@ApiOperation("导入客户信息")
@GetMapping("/importCustomer")
@ApiOperation("导入客户信息" )
@PostMapping(value = "/importCustomer", consumes = "multipart/*", headers = "content-type=multipart/form-data")
@SystemControllerLog(description = "招商管理-导入客户信息") @SystemControllerLog(description = "招商管理-导入客户信息")
public void importCustomer(@RequestParam("file") MultipartFile mFile) {
importData(mFile, p -> investBizService.importCustomer(p));
public void importCustomer(@RequestParam("file") MultipartFile file) {
importData(file, p -> investBizService.importCustomer(p));
} }


} }

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

@@ -1 +0,0 @@
ALTER TABLE `invest_task` ADD COLUMN `last_time` datetime DEFAULT NULL COMMENT '最晚出租时间' AFTER `content`;

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

@@ -182,7 +182,7 @@ public class InvestHelper {
public static String addContractId(String content,Long rentId,Integer ContractType) { public static String addContractId(String content,Long rentId,Integer ContractType) {
Map contentMap = JSON.parseObject(content, Map.class); Map contentMap = JSON.parseObject(content, Map.class);
if(Objects.nonNull(rentId)) { if(Objects.nonNull(rentId)) {
contentMap.put(InvestTaskEntity.KEY_CONTRACT_ID, rentId);
contentMap.put(InvestTaskEntity.KEY_CONTRACT_ID, String.valueOf(rentId));
} }
if(Objects.nonNull(ContractType)) { if(Objects.nonNull(ContractType)) {
contentMap.put(InvestTaskEntity.KEY_CONTRACT_TYPE, ContractType); contentMap.put(InvestTaskEntity.KEY_CONTRACT_TYPE, ContractType);


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

@@ -37,10 +37,7 @@ 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.io.*;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Function; import java.util.function.Function;
@@ -186,8 +183,8 @@ public class InvestBizServiceImpl implements InvestBizService {
targetFile.mkdirs(); targetFile.mkdirs();
} }
String fileName = "invest_1.xlsx"; String fileName = "invest_1.xlsx";
int dot = mFile.getOriginalFilename().lastIndexOf('.');
fileName = fileName + mFile.getOriginalFilename().substring(dot);
//int dot = mFile.getOriginalFilename().lastIndexOf('.');
//fileName = fileName + mFile.getOriginalFilename().substring(dot);


File lFile = new File(fpath + File.separator + fileName); File lFile = new File(fpath + File.separator + fileName);


@@ -195,7 +192,11 @@ public class InvestBizServiceImpl implements InvestBizService {
BufferedInputStream fs = null; BufferedInputStream fs = null;
try { try {
fos = new FileOutputStream(lFile); fos = new FileOutputStream(lFile);
fs = (BufferedInputStream) mFile.getInputStream();
if (mFile.getInputStream() instanceof ByteArrayInputStream) {
fs = new BufferedInputStream(mFile.getInputStream());
} else {
fs = (BufferedInputStream) mFile.getInputStream();
}
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
int len = 0; int len = 0;
while ((len = fs.read(buffer)) != -1) { while ((len = fs.read(buffer)) != -1) {
@@ -952,6 +953,9 @@ public class InvestBizServiceImpl implements InvestBizService {


private InvestDemandVo buildDemindItem(InvestDemandEntity item, InvestCustomerEntity customer, WxBrand brand, private InvestDemandVo buildDemindItem(InvestDemandEntity item, InvestCustomerEntity customer, WxBrand brand,
WxShop shop, Map<Long, MallUserInfo> usersMap) { WxShop shop, Map<Long, MallUserInfo> usersMap) {
if (Objects.isNull(customer.getBrandId())) {
customer.setBrandId(null);
}
InvestDemandVo resultItemVo = new InvestDemandVo(); InvestDemandVo resultItemVo = new InvestDemandVo();
BeanUtils.copyProperties(customer, resultItemVo); BeanUtils.copyProperties(customer, resultItemVo);
resultItemVo.setBrand(brand); resultItemVo.setBrand(brand);


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

@@ -49,6 +49,9 @@ public class InvestCustomerServiceImpl extends InvestBaseServiceImpl<InvestCusto
checkBusiness(businessService, entity.getBusinessId()); checkBusiness(businessService, entity.getBusinessId());
checkBrand(brandService, entity.getBrandId()); checkBrand(brandService, entity.getBrandId());
checkType(entity); checkType(entity);
if (Objects.isNull(entity.getBrandId())) {
entity.setBrandId(0L);
}
} }


/** /**


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

@@ -12,6 +12,7 @@ import com.iformall.enums.EnumTaskStatus;
import com.iformall.mapper.InvestTaskMapper; import com.iformall.mapper.InvestTaskMapper;
import com.iformall.service.MallUserInfoService; import com.iformall.service.MallUserInfoService;
import com.iformall.service.WxShopService; import com.iformall.service.WxShopService;
import com.iformall.service.invest.InvestHelper;
import com.iformall.service.invest.InvestTaskService; import com.iformall.service.invest.InvestTaskService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -63,6 +64,7 @@ public class InvestTaskServiceImpl extends InvestBaseServiceImpl<InvestTaskMappe
// 1 check shop 状态 // 1 check shop 状态
//checkShop(shopService, entity); //checkShop(shopService, entity);
// 2 check user // 2 check user
InvestHelper.notNull(entity.getLastTime(),"lastTime");
checkUserExit(userInfoService, entity.getOwner()); checkUserExit(userInfoService, entity.getOwner());
if (Objects.nonNull(entity.getOwner())) { if (Objects.nonNull(entity.getOwner())) {
entity.setOwner(stringToJson(entity.getOwner())); entity.setOwner(stringToJson(entity.getOwner()));


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