From 2ed6ef796ef74c046b4ceb37a7a37a80a8e7e8a5 Mon Sep 17 00:00:00 2001 From: peihao <1280253838@qq.com> Date: Wed, 13 Oct 2021 17:02:24 +0800 Subject: [PATCH] =?UTF-8?q?1.1.0=20=E5=9C=B0=E5=9D=97=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=8A=9F=E8=83=BD=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../land/controller/LandListedController.java | 20 +- .../java/com/air/land/entity/LandListed.java | 4 +- .../service/impl/LandListedServiceImpl.java | 235 ++++++----- .../service/impl/LandToListServiceImpl.java | 151 ++++--- air/src/main/java/com/air/utils/DateUtil.java | 63 +-- .../main/java/com/air/utils/ExcelUtil.java | 195 +++++++-- air/src/main/resources/application.yml | 8 +- .../resources/config/landListed-config.json | 380 +++++++++++++++++- .../resources/config/landToList-config.json | 266 ++++++++++++ .../resources/mapper/AppletsMapMapper.xml | 24 +- 10 files changed, 1096 insertions(+), 250 deletions(-) create mode 100644 air/src/main/resources/config/landToList-config.json diff --git a/air/src/main/java/com/air/land/controller/LandListedController.java b/air/src/main/java/com/air/land/controller/LandListedController.java index c21ee65..55f5613 100644 --- a/air/src/main/java/com/air/land/controller/LandListedController.java +++ b/air/src/main/java/com/air/land/controller/LandListedController.java @@ -2,11 +2,8 @@ package com.air.land.controller; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.ObjectUtil; -import com.air.land.dto.LandListedDto; -import com.air.land.dto.LandListedStatisticsDto; import com.air.land.entity.LandListed; import com.air.land.service.LandListedService; -import com.air.land.vo.LandListedAppletsVo; import com.air.land.vo.LandListedPageVo; import com.air.land.vo.LandListedVo; import com.air.utils.DateUtil; @@ -17,12 +14,10 @@ import com.cinderella.framework.common.core.util.R; import com.cinderella.framework.common.data.mybatis.QueryPage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -30,10 +25,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.time.LocalDateTime; -import java.util.ArrayList; import java.util.List; @@ -56,6 +48,7 @@ public class LandListedController { @Value("${template.land_listed}") private String landListedUrl; + /** * 分页查询 * @@ -136,7 +129,7 @@ public class LandListedController { public R saveLandListed(@RequestBody LandListedVo landListedVo) { LandListed landListed = new LandListed(); BeanUtil.copyProperties(landListedVo, landListed); - landListed.setLandListedId(DateUtil.landListedIdfromDate(LocalDateTime.now(),"yyyyMMdd",landListedService.selectId())); + landListed.setLandListedId(DateUtil.landListedIdfromDate(LocalDateTime.now(), "yyyyMMdd", landListedService.selectId())); landListedService.save(landListed); return R.ok(landListed.getLandListedId()); } @@ -164,7 +157,7 @@ public class LandListedController { @ApiOperation(value = "通过id删除已挂牌地块", notes = "通过id删除已挂牌地块") @DeleteMapping public R removeByIds(@RequestBody List landListedIds) { - return R.ok(landListedService.removeLandByIds(landListedIds),"删除成功"); + return R.ok(landListedService.removeLandByIds(landListedIds), "删除成功"); } /** @@ -193,7 +186,7 @@ public class LandListedController { @ApiOperation(value = "导入已挂牌地块信息", notes = "导入已挂牌地块信息") @PostMapping(value = "/importLandListExcel") public R importLandListExcel(@RequestParam(value = "uploadFile") MultipartFile file) { - return R.ok(landListedService.importLandListExcel(file),"导入成功"); + return R.ok(landListedService.importLandListExcel(file), "导入成功"); } /** @@ -208,7 +201,7 @@ public class LandListedController { List> landList = landListedService.getLandList(ids); InputStream resourceAsStream = LandListedController.class.getClassLoader().getResourceAsStream("templates/excel/exportLandList.xlsx"); // 读取excel模板 - XSSFWorkbook wb = ExcelUtil.exportLandListedExcel(landList,resourceAsStream,2); + XSSFWorkbook wb = ExcelUtil.exportLandListedExcel(landList, resourceAsStream, 2); response.setContentType("application/vnd.ms-excel;charset=utf-8"); response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); OutputStream outputStream = response.getOutputStream(); @@ -223,8 +216,9 @@ public class LandListedController { @ApiOperation(value = "下载已挂牌地块模板", notes = "下载已挂牌地块模板") @GetMapping("/getTemplate") public R getLandListedTemplate() { - return R.ok(minioDownUrl+landListedUrl); + return R.ok(minioDownUrl + landListedUrl); } + } diff --git a/air/src/main/java/com/air/land/entity/LandListed.java b/air/src/main/java/com/air/land/entity/LandListed.java index 1296562..a81bdd3 100644 --- a/air/src/main/java/com/air/land/entity/LandListed.java +++ b/air/src/main/java/com/air/land/entity/LandListed.java @@ -88,9 +88,9 @@ public class LandListed extends Model { private BigDecimal civilAirDefence; @ApiModelProperty(value = "特殊条件") private String specialPlan; - @ApiModelProperty(value = "装配要求") + @ApiModelProperty(value = "装配建筑") private String assemblyBuilding; - @ApiModelProperty(value = "绿色要求") + @ApiModelProperty(value = "绿色建筑") private String greenBuilding; @ApiModelProperty(value = "其他条件") private String otherConditions; diff --git a/air/src/main/java/com/air/land/service/impl/LandListedServiceImpl.java b/air/src/main/java/com/air/land/service/impl/LandListedServiceImpl.java index 7b0c558..8b7156b 100644 --- a/air/src/main/java/com/air/land/service/impl/LandListedServiceImpl.java +++ b/air/src/main/java/com/air/land/service/impl/LandListedServiceImpl.java @@ -11,6 +11,7 @@ import com.air.land.mapper.LandListedMapper; import com.air.land.service.*; import com.air.land.vo.LandListedAppletsVo; import com.air.utils.DateUtil; +import com.air.utils.ExcelUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -79,26 +80,26 @@ public class LandListedServiceImpl extends ServiceImpl> appletsCalendar(String date, String city,String canton) { - List annoDateList = baseMapper.appletsCalendarToAnnoDate(date, city,canton); - List auctionDateList = baseMapper.appletsCalendarToAuctionDate(date, city,canton); - if (CollectionUtil.isEmpty(annoDateList)){ + public R> appletsCalendar(String date, String city, String canton) { + List annoDateList = baseMapper.appletsCalendarToAnnoDate(date, city, canton); + List auctionDateList = baseMapper.appletsCalendarToAuctionDate(date, city, canton); + if (CollectionUtil.isEmpty(annoDateList)) { return R.ok(auctionDateList); } - if (CollectionUtil.isEmpty(auctionDateList)){ + if (CollectionUtil.isEmpty(auctionDateList)) { return R.ok(annoDateList); } List indexs = new ArrayList<>(); - for(LandListedStatisticsDto annoDateVo : annoDateList){ - for(int i =0 ;i dataList; try { - dataList = importLandListedExcel(file); + dataList = ExcelUtil.importExcel(file.getInputStream(), 0, 1, 0, LandListed.class, "config/landListed-config.json"); } catch (Exception e) { - log.error("导入已挂牌地块数据解析出错",e); + log.error("导入已挂牌地块数据出错", e); throw new BusinessException("导入已挂牌地块数据出错"); } + if (CollectionUtil.isNotEmpty(dataList)) { + dataList.forEach(landListed -> { + landListed.setLandListedId(DateUtil.landListedIdfromDate(LocalDateTime.now(), "yyyyMMdd", this.selectId())); + //土地出让面积,计算土地出让面积(亩)(出让面积/2000*3) + BigDecimal landTransferSquare = landListed.getLandTransferSquare(); + if (landTransferSquare != null) { + landListed.setLandTransferMu(landTransferSquare.divide(new BigDecimal(2000), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(3)).setScale(0, BigDecimal.ROUND_HALF_UP)); + } + //总建筑面积 + BigDecimal totalConsArea = landListed.getTotalConsArea(); + //成交价(万元) + BigDecimal dealPrice = null; + //出让价款起始价(万元) + BigDecimal transferPrice = null; + if (totalConsArea != null) { + //计算容积率(总建筑面积/土地出让面积) + if (landTransferSquare != null) { + landListed.setPlotRatio(totalConsArea.doubleValue() == 0 ? new BigDecimal(0) : totalConsArea.divide(landTransferSquare, 2, BigDecimal.ROUND_HALF_UP)); + } + //出让价款起始价(万元),计算起始楼面价(元/㎡) (出让价款起始价/总建筑面积*10000) + transferPrice = landListed.getTransferPrice(); + if (transferPrice != null) { + landListed.setStartingFloorPrice((transferPrice.doubleValue() == 0 || totalConsArea.doubleValue() == 0) + ? new BigDecimal(0) : transferPrice.divide(totalConsArea, 4, BigDecimal.ROUND_HALF_UP) + .multiply(new BigDecimal(10000)).setScale(0, BigDecimal.ROUND_HALF_UP)); + } + //商业面积,商务面积 + BigDecimal bizSpace = landListed.getBizSpace() == null ? new BigDecimal(0) : landListed.getBizSpace(); + BigDecimal commerceSpace = landListed.getCommerceSpace() == null ? new BigDecimal(0) : landListed.getCommerceSpace(); + //计算商业商务占比((商业面积+商务面积)/总建筑面积) + landListed.setBizCommerceRate(totalConsArea.doubleValue() == 0 ? new BigDecimal(0) : (bizSpace.add(commerceSpace)). + divide(totalConsArea, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP)); + //成交价(万元),计算成交楼面价(元/㎡) (成交价/总建筑面积*10000) + dealPrice = landListed.getDealPrice(); + if (dealPrice != null) { + landListed.setDealFloorPrice((dealPrice.doubleValue() == 0 || totalConsArea.doubleValue() == 0) + ? new BigDecimal(0) : dealPrice.divide(totalConsArea, 4, BigDecimal.ROUND_HALF_UP) + .multiply(new BigDecimal(10000)).setScale(0, BigDecimal.ROUND_HALF_UP)); + } + } + //计算溢价率 + if (dealPrice != null && transferPrice != null) { + landListed.setPremiumRate((dealPrice.doubleValue() == 0 || transferPrice.doubleValue() == 0) + ? new BigDecimal(0) : (dealPrice.subtract(transferPrice)).divide(transferPrice, 4, BigDecimal.ROUND_HALF_UP) + .multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP)); + } + }); + } return this.saveBatch(dataList); } @Override public List> getLandList(List ids) { List landListeds = this.listByIds(ids); - if (CollectionUtil.isEmpty(landListeds)){ + if (CollectionUtil.isEmpty(landListeds)) { throw new BusinessException("未查询到已挂牌地块数据!"); } List> list = new ArrayList<>(); @@ -133,11 +182,11 @@ public class LandListedServiceImpl extends ServiceImpl appletsLandListed(Page page, LandVo landVo) { landVo.setNowDate(cn.hutool.core.date.DateUtil.formatDate(new Date())); List landDtos = baseMapper.appletsLandListed(page, landVo); - if(StringUtils.isEmpty(landVo.getTransactionStatus())){ + if (StringUtils.isEmpty(landVo.getTransactionStatus())) { landDtos.forEach(landDto -> { landDto.setIsToBeListed("0"); }); - }else { + } else { landDtos.forEach(landDto -> { landDto.setIsToBeListed("0"); landDto.setTransactionStatus(landVo.getTransactionStatus()); @@ -154,15 +203,15 @@ public class LandListedServiceImpl extends ServiceImpl landListedIds){ + public boolean removeLandByIds(List landListedIds) { this.removeByIds(landListedIds); - listedLonLatService.remove(Wrappers.query().lambda().in(LandListedLonLat::getLandListedId,landListedIds)); + listedLonLatService.remove(Wrappers.query().lambda().in(LandListedLonLat::getLandListedId, landListedIds)); conductEnterpriseService.remove(Wrappers.query().lambda() - .in(LandListedConductEnterprise::getLandListedId,landListedIds)); + .in(LandListedConductEnterprise::getLandListedId, landListedIds)); constructionPlanService.remove(Wrappers.query().lambda() - .in(LandListedConstructionPlan::getLandListedId,landListedIds)); - auctionRecordService.remove(Wrappers.query().lambda().in(AuctionRecord::getLandListedId,landListedIds)); - attachmentService.remove(Wrappers.query().lambda().in(LandAttachment::getLandListedId,landListedIds)); + .in(LandListedConstructionPlan::getLandListedId, landListedIds)); + auctionRecordService.remove(Wrappers.query().lambda().in(AuctionRecord::getLandListedId, landListedIds)); + attachmentService.remove(Wrappers.query().lambda().in(LandAttachment::getLandListedId, landListedIds)); return true; } @@ -184,24 +233,24 @@ public class LandListedServiceImpl extends ServiceImpl entityToList(LandListed data) { List list = new ArrayList<>(); @@ -306,36 +356,36 @@ public class LandListedServiceImpl extends ServiceImpl> getLandList(List ids) { List landListeds = this.listByIds(ids); - if (CollectionUtil.isEmpty(landListeds)){ + if (CollectionUtil.isEmpty(landListeds)) { throw new BusinessException("未查询到拟挂牌地块数据!"); } List> list = new ArrayList<>(); @@ -92,16 +89,48 @@ public class LandToListServiceImpl extends ServiceImpl dataList; try { - dataList = importLandListedExcel(file); + dataList = ExcelUtil.importExcel(file.getInputStream(), 0, 1, 0, LandToList.class, "config/landToList-config.json"); } catch (Exception e) { - log.error("导入拟挂牌地块数据解析出错",e); + log.error("导入拟挂牌地块数据解析出错", e); throw new BusinessException("导入拟挂牌地块数据出错"); } + if (CollectionUtil.isNotEmpty(dataList)) { + dataList.forEach(landToList -> { + landToList.setProposedseriaId(DateUtil.landToListIdfromDate(LocalDateTime.now(), "yyyyMMdd", this.selectId())); + //土地出让面积,计算土地出让面积(亩)(出让面积/2000*3) + BigDecimal landTransferSquare = landToList.getLandTransferSquare(); + if (landTransferSquare != null) { + landToList.setLandTransferMu(landTransferSquare.divide(new BigDecimal(2000), 4, BigDecimal.ROUND_HALF_UP) + .multiply(new BigDecimal(3)).setScale(0, BigDecimal.ROUND_HALF_UP)); + } + //总建筑面积 + BigDecimal totalConsArea = landToList.getTotalConsArea(); + if (totalConsArea != null) { + //计算容积率(总建筑面积/土地出让面积) + if (landTransferSquare != null) { + landToList.setPlotRatio(totalConsArea.doubleValue() == 0 ? new BigDecimal(0) : totalConsArea.divide(landTransferSquare, 2, BigDecimal.ROUND_HALF_UP)); + } + //出让价款起始价(万元),计算起始楼面价(元/㎡) (出让价款起始价/总建筑面积*10000) + BigDecimal transferPrice = landToList.getTransferPrice(); + if (transferPrice != null) { + landToList.setStartingFloorPrice((transferPrice.doubleValue() == 0 || totalConsArea.doubleValue() == 0) + ? new BigDecimal(0) : transferPrice.divide(totalConsArea, 4, BigDecimal.ROUND_HALF_UP) + .multiply(new BigDecimal(10000)).setScale(0, BigDecimal.ROUND_HALF_UP)); + } + //商业面积,商务面积 + BigDecimal bizSpace = landToList.getBizSpace() == null ? new BigDecimal(0) : landToList.getBizSpace(); + BigDecimal commerceSpace = landToList.getCommerceSpace() == null ? new BigDecimal(0) : landToList.getCommerceSpace(); + //计算商业商务占比((商业面积+商务面积)/总建筑面积) + landToList.setBizCommerceRate(totalConsArea.doubleValue() == 0 ? new BigDecimal(0) : (bizSpace.add(commerceSpace)) + .divide(totalConsArea, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP)); + } + }); + } return this.saveBatch(dataList); } @Override - public List appletsLandToList(Page page , LandVo landVo) { + public List appletsLandToList(Page page, LandVo landVo) { List landDtos = baseMapper.appletsLandToList(page, landVo); landDtos.forEach(landDto -> { landDto.setIsToBeListed("1"); @@ -117,14 +146,14 @@ public class LandToListServiceImpl extends ServiceImpl proposedseriaIds){ + public boolean removeLandToListByIds(List proposedseriaIds) { this.removeByIds(proposedseriaIds); - landToListLonLatService.remove(Wrappers.query().lambda().in(LandToListLonLat::getProposedseriaId,proposedseriaIds)); + landToListLonLatService.remove(Wrappers.query().lambda().in(LandToListLonLat::getProposedseriaId, proposedseriaIds)); conductEnterpriseService.remove(Wrappers.query().lambda() - .in(LandToListConductEnterprise::getProposedseriaId,proposedseriaIds)); + .in(LandToListConductEnterprise::getProposedseriaId, proposedseriaIds)); constructionPlanService.remove(Wrappers.query().lambda() - .in(LandToListConstructionPlan::getProposedseriaId,proposedseriaIds)); - attachmentService.remove(Wrappers.query().lambda().in(LandToListAttachment::getProposedseriaId,proposedseriaIds)); + .in(LandToListConstructionPlan::getProposedseriaId, proposedseriaIds)); + attachmentService.remove(Wrappers.query().lambda().in(LandToListAttachment::getProposedseriaId, proposedseriaIds)); return true; } @@ -146,27 +175,27 @@ public class LandToListServiceImpl extends ServiceImpl entityToList(LandToList data) { List list = new ArrayList<>(); @@ -236,36 +266,36 @@ public class LandToListServiceImpl extends ServiceImpl> dataList, InputStream inputStream,int startRow) throws IOException { + public static XSSFWorkbook exportLandListedExcel(List> dataList, InputStream inputStream, int startRow) throws IOException { // 读取excel模板 XSSFWorkbook wb = new XSSFWorkbook(inputStream); XSSFSheet sheet = wb.getSheetAt(0); //填充数据 for (int i = 0; i < dataList.size(); i++) { XSSFRow sheetRow = sheet.getRow(i + startRow); - if (sheetRow == null){ - sheetRow = sheet.createRow(i+startRow); + if (sheetRow == null) { + sheetRow = sheet.createRow(i + startRow); } List list = dataList.get(i); for (int j = 0; j < list.size(); j++) { String value = list.get(j); XSSFCell cell = sheetRow.getCell(j); - if (cell == null){ + if (cell == null) { cell = sheetRow.createCell(j); } cell.setCellValue(value); @@ -104,80 +105,202 @@ public class ExcelUtil { return result; } - public static List importExcel(InputStream fileInputStream,int startSheet,int titleRow,int titleColumn,Class clazz,String path) throws IOException{ + /** + * 导入数据解析 + * + * @param fileInputStream 文件流 + * @param startSheet 读取的sheet + * @param titleRow 表头行 + * @param titleColumn 开始列 + * @param clazz 返回数据类 + * @param path 配置文件路径 + * @return + * @author peihao + * @date 2021/10/13 + **/ + public static List importExcel(InputStream fileInputStream, int startSheet, int titleRow, int titleColumn, Class clazz, String path) throws IOException { //读取文件的指定sheet XSSFWorkbook workbook = new XSSFWorkbook(fileInputStream); XSSFSheet sheet = workbook.getSheetAt(startSheet); //总行数 int totalRows = sheet.getPhysicalNumberOfRows(); //读取表头,设置对应列索引 - List excelConfigList = getExcelJsonConfig(path,ExcelConfig.class); + List excelConfigList = getExcelJsonConfig(path, ExcelConfig.class); XSSFRow sheetRow = sheet.getRow(titleRow); int totalColumns = sheetRow.getPhysicalNumberOfCells(); //获取每个表头在excel中的列 - for (int i = titleColumn;i excelConfig = excelConfigList.stream().filter(item -> item.getTitleName().equals(cellStrValue)).findAny(); - if (excelConfig.isPresent()){ + if (excelConfig.isPresent()) { excelConfig.get().setColumn(i); } } //判断是否有为空的数据 Optional any = excelConfigList.stream().filter(e -> e.getColumn() == null).findAny(); - if (any.isPresent() && any.get().isRequired()){ - throw new BusinessException(any.get().getTitleName()+"列不能为空"); + if (any.isPresent() && any.get().isRequired()) { + throw new BusinessException(any.get().getTitleName() + "列不能为空"); } //读取数据 - List> mapList = new ArrayList<>(); - for (int i = titleRow+1;i map = new HashMap<>(); + List> mapList = new ArrayList<>(); + for (int i = titleRow + 1; i < totalRows; i++) { + Map map = new HashMap<>(); XSSFRow row = sheet.getRow(i); - for (ExcelConfig e:excelConfigList){ - Object value = getCellString(row.getCell(e.getColumn()), e.getValueType()); - map.put(e.getFieldName(),value); + for (ExcelConfig excelConfig : excelConfigList) { + try { + Object value = getCellString(row.getCell(excelConfig.getColumn()), excelConfig.getValueType()); + map.put(excelConfig.getFieldName(), value); + } catch (Exception e) { + log.error("解析出错:", e); + throw new BusinessException("第" + i + "行,第" + excelConfig.getFieldName() + "列数据解析出现错误"); + } } mapList.add(map); } - return mapList.stream().map(e -> BeanUtil.mapToBean(e,clazz,true)).collect(Collectors.toList()); + return mapList.stream().map(e -> BeanUtil.mapToBean(e, clazz, true)).collect(Collectors.toList()); } - public static List getExcelJsonConfig(String path,Class clazz){ + /** + * 读取excel数据列模板配置 + * + * @param path 配置文件路径 + * @param clazz 配置实体类 + * @return + * @author peihao + * @date 2021/10/13 + **/ + public static List getExcelJsonConfig(String path, Class clazz) { String config = ResourceUtil.readStr(path, Charset.defaultCharset()); - return JSONUtil.parseArray(config).stream().map(e ->JSONUtil.toBean((JSONObject)e,clazz)).collect(Collectors.toList()); + return JSONUtil.parseArray(config).stream().map(e -> JSONUtil.toBean((JSONObject) e, clazz)).collect(Collectors.toList()); } - public static Object getCellString(XSSFCell cell,String valueType){ + /** + * 根据不同的数据类型获取列的值 + * + * @param cell 列 + * @param valueType 数据类型 + * @return + * @author peihao + * @date 2021/10/13 + **/ + public static Object getCellString(XSSFCell cell, String valueType) { String cellStrValue = getCellStrValue(cell); - switch (valueType){ + switch (valueType) { case "string": return cellStrValue; - case "stringInt": - return String.valueOf(Double.valueOf(cellStrValue).intValue()); - case "int": - return Integer.valueOf(cellStrValue); - case "date": - return DateUtil.dateToLocalDate(cell.getDateCellValue()); + case "BigDecimal": + return numberFormat(cellStrValue, 0); + case "BigDecimal_mu": + return numberFormat(cellStrValue, 100, 0); + case "BigDecimal_2": + return numberFormat(cellStrValue, 2); + case "Integer": + return StrUtil.isEmpty(cellStrValue) ? null : Integer.valueOf(cellStrValue); + case "LocalDate": + return dateFormat(cell); case "enum": - return null; + return getEnumValue(cellStrValue); default: return null; } } - public static String getCellStrValue(XSSFCell cell){ + /** + * 字符串转换数字 + * + * @param decimal 保留小数位 + * @param value 数据 + * @return + * @author peihao + * @date 2021/6/25 + **/ + private static BigDecimal numberFormat(String value, int decimal) { + if (StringUtils.isEmpty(value)) { + return null; + } + return new BigDecimal(value).setScale(decimal, BigDecimal.ROUND_HALF_UP); + } + + /** + * 字符串转换数字 + * + * @param decimal 保留小数位 + * @param value 数据 + * @param mulitple 倍数 + * @return + * @author peihao + * @date 2021/6/25 + **/ + private static BigDecimal numberFormat(String value, int mulitple, int decimal) { + if (StringUtils.isEmpty(value)) { + return null; + } + return new BigDecimal(value).multiply(new BigDecimal(mulitple)).setScale(decimal, BigDecimal.ROUND_HALF_UP); + } + + /** + * 获取单元格的值 + * + * @param cell 单元格 + * @return + * @author peihao + * @date 2021/10/13 + **/ + public static String getCellStrValue(XSSFCell cell) { + if (cell == null) { + return null; + } String value; try { - value = cell.getRawValue(); + value = cell.getStringCellValue(); } catch (Exception e) { - value = cell.toString(); + value = cell.getRawValue(); } return valueFormat(value); } + /** + * 去除字符串中的空格和'-' + * + * @param value + * @return + * @author peihao + * @date 2021/10/13 + **/ private static String valueFormat(String value) { - value = StringUtils.isNotEmpty(value) ? value.trim() : value; + value = StringUtils.isNotEmpty(value) ? StrUtil.trim(value) : value; value = StringUtils.equals("-", value) ? "" : value; return value; } + /** + * 获取单元格时间 + * + * @param cell 单元格 + * @return + * @author peihao + * @date 2021/10/13 + **/ + private static Date dateFormat(XSSFCell cell) { + Date dateCellValue = null; + try { + dateCellValue = cell.getDateCellValue(); + } catch (Exception e) { + log.error("时间格式解析错误", e); + } + return dateCellValue; + } + + private static String getEnumValue(String value) { + if (StrUtil.isBlank(value)) { + return null; + } + if ("是".equals(value)) { + value = "1"; + } else if ("否".equals(value)) { + value = "0"; + } + return value; + } + } diff --git a/air/src/main/resources/application.yml b/air/src/main/resources/application.yml index 1535298..4dd7494 100644 --- a/air/src/main/resources/application.yml +++ b/air/src/main/resources/application.yml @@ -10,8 +10,8 @@ spring: driver-class-name: com.mysql.cj.jdbc.Driver username: air password: air123456 - url: jdbc:mysql://127.0.0.1:4000/air?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true -# url: jdbc:mysql://124.71.210.242:4000/air?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true +# url: jdbc:mysql://127.0.0.1:4000/air?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true + url: jdbc:mysql://124.71.210.242:4000/air?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true stat-view-servlet: enabled: true url-pattern: /druid/* @@ -34,7 +34,7 @@ spring: multipart: max-file-size: 100MB max-request-size: 100MB - location: /opt/air/tmp_files +# location: /opt/air/tmp_files freemarker: allow-request-override: false allow-session-override: false @@ -85,7 +85,7 @@ security: - /applets/landlisted/calendar/** - /applets/landlisted/list/** - /cityArea/** -# - /** + - /** # 文件系统 minio: diff --git a/air/src/main/resources/config/landListed-config.json b/air/src/main/resources/config/landListed-config.json index afe79e6..ca8feb9 100644 --- a/air/src/main/resources/config/landListed-config.json +++ b/air/src/main/resources/config/landListed-config.json @@ -1,6 +1,374 @@ -[{ - "title": "地块编号", - "key": "landCode", - "valueType": "string", - "required": true -}] +[ + { + "titleName": "公告序号", + "fieldName": "annoId", + "valueType": "string", + "required": true + }, + { + "titleName": "地块编号", + "fieldName": "landCode", + "valueType": "string", + "required": true + }, + { + "titleName": "地块位置", + "fieldName": "landPosition", + "valueType": "string", + "required": true + }, + { + "titleName": "土地用途", + "fieldName": "landUsage", + "valueType": "string", + "required": false + }, + { + "titleName": "土地出让面积(㎡)", + "fieldName": "landTransferSquare", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "总计容建筑面积(㎡)", + "fieldName": "totalConsArea", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "建筑密度(%)", + "fieldName": "buildingDensity", + "valueType": "BigDecimal_mu", + "required": false + }, + { + "titleName": "绿地率(%)", + "fieldName": "greenSpaceRatio", + "valueType": "BigDecimal_mu", + "required": false + }, + { + "titleName": "限高", + "fieldName": "heighPermitted", + "valueType": "string", + "required": false + }, + { + "titleName": "出让年限", + "fieldName": "remiseYears", + "valueType": "string", + "required": false + }, + { + "titleName": "出让价款起始价(万元)", + "fieldName": "transferPrice", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "竞买保证金(万元)", + "fieldName": "bidMargin", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "备注", + "fieldName": "bizRemark", + "valueType": "string", + "required": false + }, + { + "titleName": "公告开始日期", + "fieldName": "annoDate", + "valueType": "LocalDate", + "required": false + }, + { + "titleName": "公告截止日期", + "fieldName": "annoEndDate", + "valueType": "LocalDate", + "required": false + }, + { + "titleName": "拍卖日期", + "fieldName": "auctionDate", + "valueType": "LocalDate", + "required": false + }, + { + "titleName": "持证准用面积", + "fieldName": "licensedArea", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "商业面积(㎡)", + "fieldName": "bizSpace", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "商务面积(㎡)", + "fieldName": "commerceSpace", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "配建-计容(㎡)", + "fieldName": "allocationCapacity", + "valueType": "string", + "required": false + }, + { + "titleName": "配建-不计容(㎡)", + "fieldName": "allocationNotCapacity", + "valueType": "string", + "required": false + }, + { + "titleName": "地质灾害", + "fieldName": "geologicHazard", + "valueType": "string", + "required": false + }, + { + "titleName": "人防还建(㎡)", + "fieldName": "civilAirDefence", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "特殊条件", + "fieldName": "specialPlan", + "valueType": "string", + "required": false + }, + { + "titleName": "装配建筑", + "fieldName": "assemblyBuilding", + "valueType": "string", + "required": false + }, + { + "titleName": "绿色建筑", + "fieldName": "greenBuilding", + "valueType": "string", + "required": false + }, + { + "titleName": "其他条件", + "fieldName": "otherConditions", + "valueType": "string", + "required": false + }, + { + "titleName": "成品住宅比例(%)", + "fieldName": "percentFinishedHousing", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "竞买条件", + "fieldName": "biddingConditions", + "valueType": "string", + "required": false + }, + { + "titleName": "勾地形式", + "fieldName": "hookForm", + "valueType": "string", + "required": false + }, + { + "titleName": "一级治理方", + "fieldName": "firstGovernance", + "valueType": "string", + "required": false + }, + { + "titleName": "勾地企业", + "fieldName": "landEnterprises", + "valueType": "string", + "required": false + }, + { + "titleName": "付款节奏", + "fieldName": "paymentRhythm", + "valueType": "string", + "required": false + }, + { + "titleName": "出让人", + "fieldName": "bargainor", + "valueType": "string", + "required": false + }, + { + "titleName": "城市", + "fieldName": "city", + "valueType": "string", + "required": false + }, + { + "titleName": "行政区", + "fieldName": "canton", + "valueType": "string", + "required": false + }, + { + "titleName": "特区", + "fieldName": "specialZone", + "valueType": "string", + "required": false + }, + { + "titleName": "环线", + "fieldName": "loopWire", + "valueType": "string", + "required": false + }, + { + "titleName": "大组团", + "fieldName": "bigGroup", + "valueType": "string", + "required": false + }, + { + "titleName": "小组团", + "fieldName": "smallGroup", + "valueType": "string", + "required": false + }, + { + "titleName": "奥维定位", + "fieldName": "ovePosition", + "valueType": "string", + "required": false + }, + { + "titleName": "经纬度(百度BD09)", + "fieldName": "lonLatBd", + "valueType": "string", + "required": false + }, + { + "titleName": "是否成交", + "fieldName": "deal", + "valueType": "enum", + "required": false + }, + { + "titleName": "出让方式", + "fieldName": "transferMode", + "valueType": "string", + "required": false + }, + { + "titleName": "受让单位", + "fieldName": "assignee", + "valueType": "string", + "required": false + }, + { + "titleName": "拿地企业-简称", + "fieldName": "landEnterpriseShort", + "valueType": "string", + "required": false + }, + { + "titleName": "成交总价(万元)", + "fieldName": "dealPrice", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "商业自持比例(%)", + "fieldName": "commercialSelfRatio", + "valueType": "BigDecimal_mu", + "required": false + }, + { + "titleName": "商业自持年份", + "fieldName": "commercialSelfYear", + "valueType": "Integer", + "required": false + }, + { + "titleName": "住宅自持比例(%)", + "fieldName": "homeSelfRatio", + "valueType": "BigDecimal_mu", + "required": false + }, + { + "titleName": "住宅自持年份", + "fieldName": "homeSelfYear", + "valueType": "Integer", + "required": false + }, + { + "titleName": "无偿移交比例(%)", + "fieldName": "percentUnpaid", + "valueType": "BigDecimal_mu", + "required": false + }, + { + "titleName": "人才公寓面积(㎡)", + "fieldName": "talenApartmentArea", + "valueType": "BigDecimal_2", + "required": false + }, + { + "titleName": "参拍企业", + "fieldName": "participatingEnterprises", + "valueType": "string", + "required": false + }, + { + "titleName": "项目状态", + "fieldName": "projectStatus", + "valueType": "string", + "required": false + }, + { + "titleName": "楼盘名称", + "fieldName": "buildingName", + "valueType": "string", + "required": false + }, + { + "titleName": "项目公司", + "fieldName": "projectCompany", + "valueType": "string", + "required": false + }, + { + "titleName": "确权时间", + "fieldName": "confirmationTime", + "valueType": "LocalDate", + "required": false + }, + { + "titleName": "操盘企业", + "fieldName": "tradingEnterprises", + "valueType": "string", + "required": false + }, + { + "titleName": "合作方", + "fieldName": "partner", + "valueType": "string", + "required": false + }, + { + "titleName": "经营企业", + "fieldName": "conductEnterprise", + "valueType": "string", + "required": false + }, + { + "titleName": "项目首开时间", + "fieldName": "firstOpenTime", + "valueType": "LocalDate", + "required": false + } +] diff --git a/air/src/main/resources/config/landToList-config.json b/air/src/main/resources/config/landToList-config.json new file mode 100644 index 0000000..c645410 --- /dev/null +++ b/air/src/main/resources/config/landToList-config.json @@ -0,0 +1,266 @@ +[ + { + "titleName": "供地状态", + "fieldName": "supplyStatus", + "valueType": "string", + "required": false + }, + { + "titleName": "预计挂牌时间", + "fieldName": "estimatedListingTime", + "valueType": "string", + "required": false + }, + { + "titleName": "公告序号", + "fieldName": "annoId", + "valueType": "string", + "required": false + }, + { + "titleName": "地块编号", + "fieldName": "landCode", + "valueType": "string", + "required": true + }, + { + "titleName": "地块位置", + "fieldName": "landPosition", + "valueType": "string", + "required": true + }, + { + "titleName": "土地用途", + "fieldName": "landUsage", + "valueType": "string", + "required": false + }, + { + "titleName": "土地出让面积(㎡)", + "fieldName": "landTransferSquare", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "总计容建筑面积(㎡)", + "fieldName": "totalConsArea", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "建筑密度(%)", + "fieldName": "buildingDensity", + "valueType": "BigDecimal_mu", + "required": false + }, + { + "titleName": "绿地率(%)", + "fieldName": "greenSpaceRatio", + "valueType": "BigDecimal_mu", + "required": false + }, + { + "titleName": "限高", + "fieldName": "heighPermitted", + "valueType": "string", + "required": false + }, + { + "titleName": "出让年限", + "fieldName": "remiseYears", + "valueType": "string", + "required": false + }, + { + "titleName": "出让价款起始价(万元)", + "fieldName": "transferPrice", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "竞买保证金(万元)", + "fieldName": "bidMargin", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "备注", + "fieldName": "bizRemark", + "valueType": "string", + "required": false + }, + { + "titleName": "公告开始日期", + "fieldName": "annoDate", + "valueType": "LocalDate", + "required": false + }, + { + "titleName": "公告截止日期", + "fieldName": "annoEndDate", + "valueType": "LocalDate", + "required": false + }, + { + "titleName": "拍卖日期", + "fieldName": "auctionDate", + "valueType": "LocalDate", + "required": false + }, + { + "titleName": "持证准用面积", + "fieldName": "licensedArea", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "商业面积(㎡)", + "fieldName": "bizSpace", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "商务面积(㎡)", + "fieldName": "commerceSpace", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "配建-计容(㎡)", + "fieldName": "allocationCapacity", + "valueType": "string", + "required": false + }, + { + "titleName": "配建-不计容(㎡)", + "fieldName": "allocationNotCapacity", + "valueType": "string", + "required": false + }, + { + "titleName": "地质灾害", + "fieldName": "geologicHazard", + "valueType": "string", + "required": false + }, + { + "titleName": "人防还建(㎡)", + "fieldName": "civilAirDefence", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "特殊条件", + "fieldName": "specialPlan", + "valueType": "string", + "required": false + }, + { + "titleName": "装配建筑", + "fieldName": "assemblyBuilding", + "valueType": "string", + "required": false + }, + { + "titleName": "绿色建筑", + "fieldName": "greenBuilding", + "valueType": "string", + "required": false + }, + { + "titleName": "其他条件", + "fieldName": "otherConditions", + "valueType": "string", + "required": false + }, + { + "titleName": "成品住宅比例(%)", + "fieldName": "percentFinishedHousing", + "valueType": "BigDecimal", + "required": false + }, + { + "titleName": "竞买条件", + "fieldName": "biddingConditions", + "valueType": "string", + "required": false + }, + { + "titleName": "勾地形式", + "fieldName": "hookForm", + "valueType": "string", + "required": false + }, + { + "titleName": "一级治理方", + "fieldName": "firstGovernance", + "valueType": "string", + "required": false + }, + { + "titleName": "勾地企业", + "fieldName": "landEnterprises", + "valueType": "string", + "required": false + }, + { + "titleName": "付款节奏", + "fieldName": "paymentRhythm", + "valueType": "string", + "required": false + }, + { + "titleName": "出让人", + "fieldName": "bargainor", + "valueType": "string", + "required": false + }, + { + "titleName": "城市", + "fieldName": "city", + "valueType": "string", + "required": false + }, + { + "titleName": "行政区", + "fieldName": "canton", + "valueType": "string", + "required": false + }, + { + "titleName": "特区", + "fieldName": "specialZone", + "valueType": "string", + "required": false + }, + { + "titleName": "环线", + "fieldName": "loopWire", + "valueType": "string", + "required": false + }, + { + "titleName": "大组团", + "fieldName": "bigGroup", + "valueType": "string", + "required": false + }, + { + "titleName": "小组团", + "fieldName": "smallGroup", + "valueType": "string", + "required": false + }, + { + "titleName": "奥维定位", + "fieldName": "ovePosition", + "valueType": "string", + "required": false + }, + { + "titleName": "经纬度(百度BD09)", + "fieldName": "lonLatBd", + "valueType": "string", + "required": false + } +] diff --git a/air/src/main/resources/mapper/AppletsMapMapper.xml b/air/src/main/resources/mapper/AppletsMapMapper.xml index 1407efc..99f3179 100644 --- a/air/src/main/resources/mapper/AppletsMapMapper.xml +++ b/air/src/main/resources/mapper/AppletsMapMapper.xml @@ -46,21 +46,21 @@