From c99b4706433088ee0cc43ec01ecf8397139e4c7c Mon Sep 17 00:00:00 2001 From: Burce Date: Thu, 24 Oct 2019 18:12:53 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=8B=9B=E5=95=86]adjust?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../invest/InvestCustomerController.java | 11 +++++------ .../V201910241500__W_INVEST_ALTER.sql | 1 - .../iformall/service/invest/InvestHelper.java | 2 +- .../invest/impl/InvestBizServiceImpl.java | 18 +++++++++++------- .../invest/impl/InvestCustomerServiceImpl.java | 3 +++ .../invest/impl/InvestTaskServiceImpl.java | 2 ++ 6 files changed, 22 insertions(+), 15 deletions(-) delete mode 100644 mallinkAdmin/src/main/resources/db/migration/V201910241500__W_INVEST_ALTER.sql diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java index a746e8d91..da6316136 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java +++ b/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.service.invest.InvestBizService; 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 org.springframework.web.bind.annotation.*; import org.springframework.beans.factory.annotation.Autowired; @@ -101,11 +100,11 @@ public class InvestCustomerController extends InvestBaseController{ 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 = "招商管理-导入客户信息") - 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)); } } diff --git a/mallinkAdmin/src/main/resources/db/migration/V201910241500__W_INVEST_ALTER.sql b/mallinkAdmin/src/main/resources/db/migration/V201910241500__W_INVEST_ALTER.sql deleted file mode 100644 index 920f76d95..000000000 --- a/mallinkAdmin/src/main/resources/db/migration/V201910241500__W_INVEST_ALTER.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `invest_task` ADD COLUMN `last_time` datetime DEFAULT NULL COMMENT '最晚出租时间' AFTER `content`; \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java b/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java index 95d37c38d..d444bd0eb 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java +++ b/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) { Map contentMap = JSON.parseObject(content, Map.class); if(Objects.nonNull(rentId)) { - contentMap.put(InvestTaskEntity.KEY_CONTRACT_ID, rentId); + contentMap.put(InvestTaskEntity.KEY_CONTRACT_ID, String.valueOf(rentId)); } if(Objects.nonNull(ContractType)) { contentMap.put(InvestTaskEntity.KEY_CONTRACT_TYPE, ContractType); diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java index ea84f9429..af8cfef0a 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java +++ b/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 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.concurrent.TimeUnit; import java.util.function.Function; @@ -186,8 +183,8 @@ public class InvestBizServiceImpl implements InvestBizService { targetFile.mkdirs(); } 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); @@ -195,7 +192,11 @@ public class InvestBizServiceImpl implements InvestBizService { BufferedInputStream fs = null; try { 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]; int len = 0; while ((len = fs.read(buffer)) != -1) { @@ -952,6 +953,9 @@ public class InvestBizServiceImpl implements InvestBizService { private InvestDemandVo buildDemindItem(InvestDemandEntity item, InvestCustomerEntity customer, WxBrand brand, WxShop shop, Map usersMap) { + if (Objects.isNull(customer.getBrandId())) { + customer.setBrandId(null); + } InvestDemandVo resultItemVo = new InvestDemandVo(); BeanUtils.copyProperties(customer, resultItemVo); resultItemVo.setBrand(brand); diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestCustomerServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestCustomerServiceImpl.java index cfb7558c0..14f871102 100755 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestCustomerServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestCustomerServiceImpl.java @@ -49,6 +49,9 @@ public class InvestCustomerServiceImpl extends InvestBaseServiceImpl