From 4670f5b3649dbcc03ace177bb74d12a7bd6c9760 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Thu, 24 Oct 2019 18:11:42 +0800 Subject: [PATCH 1/4] =?UTF-8?q?[=E8=B4=A6=E5=8D=95=E6=80=BB=E8=A7=88][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E6=9F=A5=E8=AF=A2]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/iformall/service/impl/WxBillAllServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index afa9f0fa6..58270dc89 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -147,7 +147,10 @@ public class WxBillAllServiceImpl implements WxBillAllService { //手续费 = 合同应收+手续费+滞纳金 pageInfo.getList().stream().forEach(e -> { //手续费 = 合同应收+手续费+滞纳金 - cmputeTotalMoney(wxPayAccountBill, e); + if (!e.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) + && !e.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode())) { + cmputeTotalMoney(wxPayAccountBill, e); + } }); Map result = new HashMap<>(); From 8724f74403a3457c8a4fca0159d4c14639cdc4f4 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Thu, 24 Oct 2019 18:26:07 +0800 Subject: [PATCH 2/4] =?UTF-8?q?[=E7=BB=93=E7=AE=97=E7=AE=A1=E7=90=86][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E6=9F=A5=E8=AF=A2]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxBillAllServiceImpl.java | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index 58270dc89..bd5ec20f4 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -147,10 +147,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { //手续费 = 合同应收+手续费+滞纳金 pageInfo.getList().stream().forEach(e -> { //手续费 = 合同应收+手续费+滞纳金 - if (!e.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) - && !e.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode())) { - cmputeTotalMoney(wxPayAccountBill, e); - } + cmputeTotalMoney(wxPayAccountBill, e); }); Map result = new HashMap<>(); @@ -159,22 +156,28 @@ public class WxBillAllServiceImpl implements WxBillAllService { } public void cmputeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillAllVo e) { - if (e.getReceivePay() != null) { - if (e.getLatePayPrice() == null) { - e.setLatePayPrice(0L); - } - BigDecimal servicePay; - if (e.getServiceChargePay() != null) { - servicePay = new BigDecimal(e.getServiceChargePay()); - } else { - servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); - } - Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); - e.setRealReceivePay(realReceivePay); - e.setServiceChargePay(servicePay.intValue()); - if (!e.getStatus().equals(EnumBillRentStatus.NOT_PAID.getCode())) { - e.setOwe(0L); + if (!e.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) + && !e.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode())) { + if (e.getReceivePay() != null) { + if (e.getLatePayPrice() == null) { + e.setLatePayPrice(0L); + } + BigDecimal servicePay; + if (e.getServiceChargePay() != null) { + servicePay = new BigDecimal(e.getServiceChargePay()); + } else { + servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP); + } + Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay(); + e.setRealReceivePay(realReceivePay); + e.setServiceChargePay(servicePay.intValue()); + if (!e.getStatus().equals(EnumBillRentStatus.NOT_PAID.getCode()) && + !e.getStatus().equals(EnumBillRentStatus.WAIT_PAY.getCode())) { + e.setOwe(0L); + } } + } else { + e.setRealReceivePay(e.getReceivePay()); } } From c99b4706433088ee0cc43ec01ecf8397139e4c7c Mon Sep 17 00:00:00 2001 From: Burce Date: Thu, 24 Oct 2019 18:12:53 +0800 Subject: [PATCH 3/4] =?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 Date: Thu, 24 Oct 2019 18:58:01 +0800 Subject: [PATCH 4/4] =?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 --- .../iformall/controller/invest/InvestBaseController.java | 5 +++++ .../src/main/java/com/iformall/utils/UrlCheck.java | 3 ++- .../iformall/service/invest/impl/InvestBizServiceImpl.java | 7 ++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java index d5212b078..ee2e2ac17 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java @@ -3,6 +3,7 @@ package com.iformall.controller.invest; import com.alibaba.fastjson.JSON; import com.iformall.common.ErrorCode; import com.iformall.common.InvestResultData; +import com.iformall.common.Result; import com.iformall.controller.base.BaseController; import com.iformall.domain.vo.invest.InvestUserContext; import com.iformall.enums.*; @@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.InitBinder; import java.beans.PropertyEditor; import java.beans.PropertyEditorSupport; +import java.util.Objects; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Function; @@ -41,6 +43,9 @@ public class InvestBaseController extends BaseController { return new InvestResultData(r); } catch (MallinkException e) { log.error("execute error", e); + if (Objects.equals(Result.SUCCESS, e.getErrorCode())) { + return new InvestResultData(); + } return new InvestResultData(e.getErrorCode(), e.getMessage()); } catch (NullPointerException e) { ErrorCode errorCode = ErrorCode.SYS_NULLPOINTER_ERROR ; diff --git a/mallinkAdmin/src/main/java/com/iformall/utils/UrlCheck.java b/mallinkAdmin/src/main/java/com/iformall/utils/UrlCheck.java index 219410d54..ec8380075 100644 --- a/mallinkAdmin/src/main/java/com/iformall/utils/UrlCheck.java +++ b/mallinkAdmin/src/main/java/com/iformall/utils/UrlCheck.java @@ -20,7 +20,8 @@ public class UrlCheck { || url.contains("pvlog") || url.contains("/wxBillDaily/importTemplate") || url.contains("/kwMeter/import") - || url.contains("/wxImportTemplate/importTemplate"); + || url.contains("/wxImportTemplate/importTemplate") + || url.contains("/invest/customer/importCustomer"); } } 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 af8cfef0a..19665f8c9 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 @@ -227,7 +227,6 @@ public class InvestBizServiceImpl implements InvestBizService { } doImport(lFile, tenantId, importKey); - throw new MallinkException(Result.SUCCESS, "模板正在导入"); } private void doImport(File file, String tenantId, String importKey) { @@ -831,10 +830,12 @@ public class InvestBizServiceImpl implements InvestBizService { Map usersMap = getMap(userInfoService.getByIds(getIds(recordList, InvestOperateRecordEntity::getOperator)), MallUserInfo::getId); //品牌信息 - Map brandMap = getBrandMap(); + List brands = brandService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); + Map brandMap = getMap(brands, WxBrand::getId); //业态信息 - Map businesseMap = getBusinessMap(); + List businesses = businessService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); + Map businesseMap = getMap(businesses, WxBusiness::getId); List resultList = new ArrayList<>(); for (InvestOperateRecordEntity recordEntity : recordList) {