developrelease_toaliyun_real
| @@ -3,6 +3,7 @@ package com.iformall.controller.invest; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.InvestResultData; | import com.iformall.common.InvestResultData; | ||||
| import com.iformall.common.Result; | |||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.vo.invest.InvestUserContext; | import com.iformall.domain.vo.invest.InvestUserContext; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| @@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.InitBinder; | |||||
| import java.beans.PropertyEditor; | import java.beans.PropertyEditor; | ||||
| import java.beans.PropertyEditorSupport; | import java.beans.PropertyEditorSupport; | ||||
| import java.util.Objects; | |||||
| import java.util.function.BiConsumer; | import java.util.function.BiConsumer; | ||||
| import java.util.function.Consumer; | import java.util.function.Consumer; | ||||
| import java.util.function.Function; | import java.util.function.Function; | ||||
| @@ -41,6 +43,9 @@ public class InvestBaseController extends BaseController { | |||||
| return new InvestResultData(r); | return new InvestResultData(r); | ||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| log.error("execute error", e); | log.error("execute error", e); | ||||
| if (Objects.equals(Result.SUCCESS, e.getErrorCode())) { | |||||
| return new InvestResultData(); | |||||
| } | |||||
| return new InvestResultData(e.getErrorCode(), e.getMessage()); | return new InvestResultData(e.getErrorCode(), e.getMessage()); | ||||
| } catch (NullPointerException e) { | } catch (NullPointerException e) { | ||||
| ErrorCode errorCode = ErrorCode.SYS_NULLPOINTER_ERROR ; | ErrorCode errorCode = ErrorCode.SYS_NULLPOINTER_ERROR ; | ||||
| @@ -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)); | |||||
| } | } | ||||
| } | } | ||||
| @@ -20,7 +20,8 @@ public class UrlCheck { | |||||
| || url.contains("pvlog") | || url.contains("pvlog") | ||||
| || url.contains("/wxBillDaily/importTemplate") | || url.contains("/wxBillDaily/importTemplate") | ||||
| || url.contains("/kwMeter/import") | || url.contains("/kwMeter/import") | ||||
| || url.contains("/wxImportTemplate/importTemplate"); | |||||
| || url.contains("/wxImportTemplate/importTemplate") | |||||
| || url.contains("/invest/customer/importCustomer"); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1 +0,0 @@ | |||||
| ALTER TABLE `invest_task` ADD COLUMN `last_time` datetime DEFAULT NULL COMMENT '最晚出租时间' AFTER `content`; | |||||
| @@ -156,22 +156,28 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| } | } | ||||
| public void cmputeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillAllVo e) { | 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()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -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); | ||||
| @@ -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) { | ||||
| @@ -226,7 +227,6 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| } | } | ||||
| doImport(lFile, tenantId, importKey); | doImport(lFile, tenantId, importKey); | ||||
| throw new MallinkException(Result.SUCCESS, "模板正在导入"); | |||||
| } | } | ||||
| private void doImport(File file, String tenantId, String importKey) { | private void doImport(File file, String tenantId, String importKey) { | ||||
| @@ -830,10 +830,12 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| Map<Long, MallUserInfo> usersMap = getMap(userInfoService.getByIds(getIds(recordList, InvestOperateRecordEntity::getOperator)), MallUserInfo::getId); | Map<Long, MallUserInfo> usersMap = getMap(userInfoService.getByIds(getIds(recordList, InvestOperateRecordEntity::getOperator)), MallUserInfo::getId); | ||||
| //品牌信息 | //品牌信息 | ||||
| Map<String, WxBrand> brandMap = getBrandMap(); | |||||
| List<WxBrand> brands = brandService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); | |||||
| Map<Long, WxBrand> brandMap = getMap(brands, WxBrand::getId); | |||||
| //业态信息 | //业态信息 | ||||
| Map<String, WxBusiness> businesseMap = getBusinessMap(); | |||||
| List<WxBusiness> businesses = businessService.listAsPage(null, 1, Integer.MAX_VALUE).getList(); | |||||
| Map<Integer, WxBusiness> businesseMap = getMap(businesses, WxBusiness::getId); | |||||
| List<InvestOperateRecordVo> resultList = new ArrayList<>(); | List<InvestOperateRecordVo> resultList = new ArrayList<>(); | ||||
| for (InvestOperateRecordEntity recordEntity : recordList) { | for (InvestOperateRecordEntity recordEntity : recordList) { | ||||
| @@ -952,6 +954,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); | ||||
| @@ -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); | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -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())); | ||||