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/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/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/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/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index afa9f0fa6..bd5ec20f4 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -156,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()); } } 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..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 @@ -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) { @@ -226,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) { @@ -830,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) { @@ -952,6 +954,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