From 5c91d7a1f6252d49aa4f75c5ef39033afbdb53dc Mon Sep 17 00:00:00 2001 From: gongbiao Date: Tue, 25 Dec 2018 16:59:01 +0800 Subject: [PATCH] =?UTF-8?q?[=E7=A7=9F=E8=B5=81=E5=90=88=E5=90=8C][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E8=A1=A5=E5=BD=95=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=8D=E5=AF=B9]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WxRentContractServiceImpl.java | 43 +++++++++++-------- .../main/resources/mapper/WxShopMapper.xml | 4 +- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index 824ade7a4..2caa5dacc 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -33,7 +33,6 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.net.HttpURLConnection; import java.net.URL; -import java.net.URLEncoder; import java.util.*; /** @@ -140,6 +139,16 @@ public class WxRentContractServiceImpl implements WxRentContractService { record.setEndDate(record.getStartDate()); } + if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { + BigDecimal hundred = new BigDecimal(100); + BigDecimal revenue = new BigDecimal(record.getRevenue() == null ? 0 : record.getRevenue()).divide(hundred); + BigDecimal payRatio = new BigDecimal(record.getPayRatio() == null ? 0 : record.getPayRatio()).divide(hundred); + BigDecimal price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); + record.setPrice(price.multiply(hundred).intValue()); + } + record.setPrice(record.getPrice() == null ? 0 : record.getPrice()); + record.setDeposit(record.getDeposit() == null ? 0 : record.getDeposit()); + Date date = new Date(); record.setCreatetime(date); record.setUpdatetime(date); @@ -417,9 +426,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { pDest.mkdirs(); } try { - String exportFileName=wxRentContract.getFilename()+filesuffix; + String exportFileName = wxRentContract.getFilename() + filesuffix; downLoadFromUrl(wxRentContract.getFilepath(), filename, filepath); - downFile(destPath, wxRentContract.getFilename(),exportFileName, response, request); + downFile(destPath, wxRentContract.getFilename(), exportFileName, response, request); org.apache.commons.io.FileUtils.forceDelete(dest); } catch (IOException e) { logger.info("创建本地文件失败" + e.getMessage()); @@ -665,7 +674,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { String filepath = Constant.fileDirectory; String filename = UUID.randomUUID() + ".docx"; String exportFileName = result.get("merchantName").toString() + "合同.docx"; - exportWord(templatePath, filepath, filename, exportFileName,result, request, response); + exportWord(templatePath, filepath, filename, exportFileName, result, request, response); } @Override @@ -697,7 +706,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { buildDeposit(wxMerchant); } } - return new ResultData(Result.SUCCESS,"操作成功") ; + return new ResultData(Result.SUCCESS, "操作成功"); } public Map getRentAndPropertyInfo(Long id) { @@ -725,8 +734,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { result.put("operationArea", wxShop.get("operationArea")); //商户信息 WxMerchant merchant = wxMerchantService.getById(wxRentContract.getMerchantId()); - if (merchant!=null) { - result.put("merchantName",merchant.getName()); + if (merchant != null) { + result.put("merchantName", merchant.getName()); //法人信息 WxMerchantCorp wxMerchantCorp = merchant.getWxMerchantCorp(); result.put("corpPapersNumber", StringUtils.isNotEmpty(wxMerchantCorp.getCorpPapersNumber()) ? wxMerchantCorp.getCorpPapersNumber() : " "); @@ -739,7 +748,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { result.put("bankAccount", StringUtils.isNotEmpty(wxMerchantTax.getBankAccount()) ? wxMerchantTax.getBankAccount() : " "); result.put("invoiceAddressPhone", StringUtils.isNotEmpty(wxMerchantTax.getInvoiceAddressPhone()) ? wxMerchantTax.getInvoiceAddressPhone() : " "); } else { - result.put("merchantName",""); + result.put("merchantName", ""); //法人信息 result.put("corpPapersNumber", " "); result.put("corpPapersType", " "); @@ -771,11 +780,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { result.put("signDate", DateUtils.date2String(wxRentContract.getSignDate(), "yyyy-MM-dd")); //品牌 Long brandId = wxRentContract.getBrand(); - String brand=" "; - if(brandId!=null){ + String brand = " "; + if (brandId != null) { WxBrand wxBrand = WxBrandMapper.selectByPrimaryKey(brandId); - if(wxBrand!=null){ - brand=wxBrand.getName(); + if (wxBrand != null) { + brand = wxBrand.getName(); } } result.put("brand", brand); @@ -830,8 +839,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); result.put("priceProperty", priceProperty); double unitPriceProperty = new BigDecimal(wxPropertyContract.get("price").toString()) - .divide(new BigDecimal(wxRentContract.getRentArea()),2,RoundingMode.HALF_EVEN) - .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); + .divide(new BigDecimal(wxRentContract.getRentArea()), 2, RoundingMode.HALF_EVEN) + .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); result.put("unitPriceProperty", unitPriceProperty); result.put("pricePropertyUpper", digitUppercase(priceProperty)); result.put("unitPricePropertyUpper", digitUppercase(unitPriceProperty)); @@ -904,7 +913,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { double payRatio = wxRentContract.getPayRatio() != null ? wxRentContract.getPayRatio() / 100.0 : 0; //常规租期 - for (int i = 0; i <=count; i++) { + for (int i = 0; i <= count; i++) { //开始时间 Calendar instance = Calendar.getInstance(); instance.setTime(wxRentContract.getRentalStartDate()); @@ -977,7 +986,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { public void areaWay(WxRentContract wxRentContract, Map result, Integer lease, double adjustRatio, int extralease, int extracount, int paycount, int index, int count, BigDecimal rentPrice) { //常规租期 - for (int i = 0; i <=count; i++) { + for (int i = 0; i <= count; i++) { //开始时间 Calendar instance = Calendar.getInstance(); instance.setTime(wxRentContract.getRentalStartDate()); @@ -1068,7 +1077,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { * @param request HttpServletRequest * @param response HttpServletResponse */ - public void exportWord(String templatePath, String temDir, String fileName, String exportFileName,Map params, HttpServletRequest request, HttpServletResponse response) { + public void exportWord(String templatePath, String temDir, String fileName, String exportFileName, Map params, HttpServletRequest request, HttpServletResponse response) { Assert.notNull(templatePath, "模板路径不能为空"); Assert.notNull(temDir, "临时文件路径不能为空"); Assert.notNull(exportFileName, "导出文件名不能为空"); diff --git a/mallinkService/src/main/resources/mapper/WxShopMapper.xml b/mallinkService/src/main/resources/mapper/WxShopMapper.xml index 7de04f6df..97507eec9 100644 --- a/mallinkService/src/main/resources/mapper/WxShopMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxShopMapper.xml @@ -269,11 +269,11 @@ s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId, m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone, m.brand,m.business_id businessId,m.shop_type shopType - from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0 + from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id left join wx_merchant m on ms.merchant_id=m.id left join wx_mall_building b on s.building=b.id left join wx_mall_floor f on s.floor=f.id - where 1=1 + where 1=1 and ms.is_del=0 and s.tenant_id=#{tenantId} and s.`status` = #{status}