Commit e79aef25 authored by 姜鹏鹏's avatar 姜鹏鹏

Merge remote-tracking branch 'origin/master' into jiangpengpeng

parents bae09a0b 1438ae60
...@@ -188,7 +188,8 @@ public class BnsProjectController { ...@@ -188,7 +188,8 @@ public class BnsProjectController {
exportBnsProductDto.setShortName(projectListDto.getShortName()); exportBnsProductDto.setShortName(projectListDto.getShortName());
exportBnsProductDto.setLongitude(String.valueOf(projectListDto.getLongitude() == null ? "" : projectListDto.getLongitude())); exportBnsProductDto.setLongitude(String.valueOf(projectListDto.getLongitude() == null ? "" : projectListDto.getLongitude()));
exportBnsProductDto.setLatitude(String.valueOf(projectListDto.getLatitude() == null ? "" : projectListDto.getLatitude())); exportBnsProductDto.setLatitude(String.valueOf(projectListDto.getLatitude() == null ? "" : projectListDto.getLatitude()));
exportBnsProductDto.setSaleStatus(String.valueOf(projectListDto.getSaleStatus())); exportBnsProductDto.setSaleStatus(String.valueOf(projectListDto.getSaleStatus() == null ? "" : projectListDto.getSaleStatus()));
exportBnsProductDto.setIsTy(String.valueOf(projectListDto.getIsTy() == null ? "" : projectListDto.getIsTy()));
exportBnsProductDto.setPrice(projectListDto.getPrice()); exportBnsProductDto.setPrice(projectListDto.getPrice());
exportBnsProductDto.setOpenTime(projectListDto.getOpenTime()); exportBnsProductDto.setOpenTime(projectListDto.getOpenTime());
exportBnsProductDto.setLandArea(String.valueOf(projectListDto.getLandArea() == null ? "" : projectListDto.getLandArea())); exportBnsProductDto.setLandArea(String.valueOf(projectListDto.getLandArea() == null ? "" : projectListDto.getLandArea()));
...@@ -239,7 +240,8 @@ public class BnsProjectController { ...@@ -239,7 +240,8 @@ public class BnsProjectController {
exportBnsProductDto.setShortName(projectListDto.getShortName()); exportBnsProductDto.setShortName(projectListDto.getShortName());
exportBnsProductDto.setLongitude(String.valueOf(projectListDto.getLongitude() == null ? "" : projectListDto.getLongitude())); exportBnsProductDto.setLongitude(String.valueOf(projectListDto.getLongitude() == null ? "" : projectListDto.getLongitude()));
exportBnsProductDto.setLatitude(String.valueOf(projectListDto.getLatitude() == null ? "" : projectListDto.getLatitude())); exportBnsProductDto.setLatitude(String.valueOf(projectListDto.getLatitude() == null ? "" : projectListDto.getLatitude()));
exportBnsProductDto.setSaleStatus(String.valueOf(projectListDto.getSaleStatus())); exportBnsProductDto.setSaleStatus(String.valueOf(projectListDto.getSaleStatus() == null ? "" : projectListDto.getSaleStatus()));
exportBnsProductDto.setIsTy(String.valueOf(projectListDto.getIsTy() == null ? "" : projectListDto.getIsTy()));
exportBnsProductDto.setPrice(projectListDto.getPrice()); exportBnsProductDto.setPrice(projectListDto.getPrice());
exportBnsProductDto.setOpenTime(projectListDto.getOpenTime()); exportBnsProductDto.setOpenTime(projectListDto.getOpenTime());
exportBnsProductDto.setLandArea(String.valueOf(projectListDto.getLandArea() == null ? "" : projectListDto.getLandArea())); exportBnsProductDto.setLandArea(String.valueOf(projectListDto.getLandArea() == null ? "" : projectListDto.getLandArea()));
...@@ -704,12 +706,16 @@ public class BnsProjectController { ...@@ -704,12 +706,16 @@ public class BnsProjectController {
AtomicInteger indexInt = new AtomicInteger(1); AtomicInteger indexInt = new AtomicInteger(1);
regionProductMapSuplyOrderByDESC.forEach((key, value) -> { regionProductMapSuplyOrderByDESC.forEach((key, value) -> {
DetilRegionProductImgDto detilRegionProductImgDto = new DetilRegionProductImgDto(); DetilRegionProductImgDto detilRegionProductImgDto = new DetilRegionProductImgDto();
List<String> productIdS = new ArrayList<>(); Set<String> productSetIds = new HashSet<>();
for (RegionProductResultDto regionProductResultDto : value) { for (RegionProductResultDto regionProductResultDto : value) {
List<String> list = splitStrProductToList(regionProductResultDto.getProductId()); List<String> list = splitStrProductToList(regionProductResultDto.getProductId());
for (String s : list) { for (String s : list) {
productIdS.add(s); productSetIds.add(s);
} } }
}
List<String> productIdS = new ArrayList<>(productSetIds);
int index = indexInt.getAndIncrement(); int index = indexInt.getAndIncrement();
List<ProductQueryDto> productQueryDtoList = new ArrayList<ProductQueryDto>(); List<ProductQueryDto> productQueryDtoList = new ArrayList<ProductQueryDto>();
...@@ -848,7 +854,7 @@ public class BnsProjectController { ...@@ -848,7 +854,7 @@ public class BnsProjectController {
AtomicInteger indexInt = new AtomicInteger(1); AtomicInteger indexInt = new AtomicInteger(1);
regionProductMapSuplyOrderByDESC.forEach((key, value) -> { regionProductMapSuplyOrderByDESC.forEach((key, value) -> {
List<String> productIdS = new ArrayList<>(); Set<String> productSetIds = new HashSet<>();
PieDetilProductDto pieDetilProductDto = new PieDetilProductDto(); PieDetilProductDto pieDetilProductDto = new PieDetilProductDto();
BarProductDto barDetilDto = new BarProductDto(); BarProductDto barDetilDto = new BarProductDto();
int suplyNumberADD = 0; int suplyNumberADD = 0;
...@@ -858,10 +864,12 @@ public class BnsProjectController { ...@@ -858,10 +864,12 @@ public class BnsProjectController {
for (RegionProductResultDto regionProductResultDto : value) { for (RegionProductResultDto regionProductResultDto : value) {
List<String> list = splitStrProductToList(regionProductResultDto.getProductId()); List<String> list = splitStrProductToList(regionProductResultDto.getProductId());
for (String s : list) { for (String s : list) {
productIdS.add(s); productSetIds.add(s);
} }
} }
List<String> productIdS = new ArrayList<>(productSetIds);
int index = indexInt.getAndIncrement(); int index = indexInt.getAndIncrement();
pieDetilProductDto.setProductionPie("产品"+index); pieDetilProductDto.setProductionPie("产品"+index);
pieDetilProductDto.setSupplication(suplyNumberADD); pieDetilProductDto.setSupplication(suplyNumberADD);
...@@ -1615,9 +1623,14 @@ public class BnsProjectController { ...@@ -1615,9 +1623,14 @@ public class BnsProjectController {
bnsProject.setPrice(exportBnsProjectDto.getPrice()); bnsProject.setPrice(exportBnsProjectDto.getPrice());
} }
if(exportBnsProjectDto.getIsTy() != null){
bnsProject.setIsTy(Integer.valueOf(exportBnsProjectDto.getIsTy().trim()));
}
if(exportBnsProjectDto.getSaleStatus() != null){ if(exportBnsProjectDto.getSaleStatus() != null){
bnsProject.setSaleStatus(Integer.valueOf(exportBnsProjectDto.getSaleStatus().trim())); bnsProject.setSaleStatus(Integer.valueOf(exportBnsProjectDto.getSaleStatus().trim()));
} }
if(exportBnsProjectDto.getLandArea() != null){ if(exportBnsProjectDto.getLandArea() != null){
bnsProject.setLandArea(Float.valueOf(exportBnsProjectDto.getLandArea().trim())); bnsProject.setLandArea(Float.valueOf(exportBnsProjectDto.getLandArea().trim()));
} }
...@@ -1645,6 +1658,14 @@ public class BnsProjectController { ...@@ -1645,6 +1658,14 @@ public class BnsProjectController {
if(parentTpyeStr.equals("1")){ if(parentTpyeStr.equals("1")){
// 全删全入 隶属关联 1
BnsBuildingProduct bnsBuildingProductDel = new BnsBuildingProduct();
QueryWrapper wrapperQueryVerifyDel = new QueryWrapper();
bnsBuildingProductDel.setProjectId(byProdectId);
bnsBuildingProductDel.setType(1);
wrapperQueryVerifyDel.setEntity(bnsBuildingProductDel);
iBnsProjectParentService.remove(wrapperQueryVerifyDel);
QueryWrapper<BnsRegion> wrapper = new QueryWrapper(); QueryWrapper<BnsRegion> wrapper = new QueryWrapper();
BnsRegion bnsRegion = new BnsRegion(); BnsRegion bnsRegion = new BnsRegion();
bnsRegion.setDelFlag("0"); bnsRegion.setDelFlag("0");
...@@ -1680,6 +1701,7 @@ public class BnsProjectController { ...@@ -1680,6 +1701,7 @@ public class BnsProjectController {
} }
if(parentTpyeStr.equals("0")){ if(parentTpyeStr.equals("0")){
QueryWrapper<BnsLand> wrapper = new QueryWrapper(); QueryWrapper<BnsLand> wrapper = new QueryWrapper();
BnsLand bnsLand = new BnsLand(); BnsLand bnsLand = new BnsLand();
bnsLand.setDelFlag("0"); bnsLand.setDelFlag("0");
...@@ -1994,13 +2016,8 @@ public class BnsProjectController { ...@@ -1994,13 +2016,8 @@ public class BnsProjectController {
} }
List<ProductQueryDto> productQueryDtoList = new ArrayList<ProductQueryDto>(); List<ProductQueryDto> productQueryDtoList = new ArrayList<ProductQueryDto>();
QueryWrapper<BnsProduct> queryWrapperProduct = new QueryWrapper<BnsProduct>();
BnsProduct bnsProduct = new BnsProduct(); bnsProductList = iBnsProductService.getProductList(businessId);
bnsProduct.setDelFlag("0");
bnsProduct.setProjectId(businessId);
queryWrapperProduct.orderByAsc("PRODUCT_TYPE","UNIT_AREA");
queryWrapperProduct.setEntity(bnsProduct);
bnsProductList = iBnsProductService.list(queryWrapperProduct);
StringBuffer sBuffer = new StringBuffer(); StringBuffer sBuffer = new StringBuffer();
int i = 0; int i = 0;
...@@ -2536,7 +2553,9 @@ public class BnsProjectController { ...@@ -2536,7 +2553,9 @@ public class BnsProjectController {
iBnsProjectService.updateById(bnsProject); iBnsProjectService.updateById(bnsProject);
UpdateWrapper wrapper = new UpdateWrapper(); UpdateWrapper wrapper = new UpdateWrapper();
wrapper.set("PROJECT_ID", businessId); BnsProduct bnsProduct = new BnsProduct();
bnsProduct.setProjectId(businessId);
wrapper.setEntity(bnsProduct);
wrapper.set("DEL_FLAG", DelStatus.DELETED.getStatus()); wrapper.set("DEL_FLAG", DelStatus.DELETED.getStatus());
iBnsProductService.update(wrapper); iBnsProductService.update(wrapper);
......
...@@ -54,14 +54,12 @@ public class ExportBnsProductDto extends CommonEntity { ...@@ -54,14 +54,12 @@ public class ExportBnsProductDto extends CommonEntity {
*/ */
@Excel(name = "产品类型*", height = 20, width = 30) @Excel(name = "产品类型*", height = 20, width = 30)
@NotEmpty(message = "不能为空") @NotEmpty(message = "不能为空")
@Length(max = 64)
private String productType; private String productType;
/** /**
* 居室数 * 居室数
*/ */
@Excel(name = "居室数", height = 20, width = 30) @Excel(name = "居室数", height = 20, width = 30)
@Length(max = 4)
private String roomNumber; private String roomNumber;
/** /**
...@@ -69,42 +67,36 @@ public class ExportBnsProductDto extends CommonEntity { ...@@ -69,42 +67,36 @@ public class ExportBnsProductDto extends CommonEntity {
*/ */
@Excel(name = "户型面积*", height = 20, width = 30) @Excel(name = "户型面积*", height = 20, width = 30)
@NotEmpty(message = "不能为空") @NotEmpty(message = "不能为空")
@Length(max = 13)
private String unitArea; private String unitArea;
/** /**
* 南向面宽 * 南向面宽
*/ */
@Excel(name = "南向面宽", height = 20, width = 30) @Excel(name = "南向面宽", height = 20, width = 30)
@Length(max = 13)
private String southWidth; private String southWidth;
/** /**
* 起居室面宽 * 起居室面宽
*/ */
@Excel(name = "起居室面宽", height = 20, width = 30) @Excel(name = "起居室面宽", height = 20, width = 30)
@Length(max = 13)
private String liveRoomWidth; private String liveRoomWidth;
/** /**
* 主卧面宽 * 主卧面宽
*/ */
@Excel(name = "主卧面宽", height = 20, width = 30) @Excel(name = "主卧面宽", height = 20, width = 30)
@Length(max = 13)
private String masterRoomWidth; private String masterRoomWidth;
/** /**
* 客卧面宽 * 客卧面宽
*/ */
@Excel(name = "客卧面宽", height = 20, width = 30) @Excel(name = "客卧面宽", height = 20, width = 30)
@Length(max = 13)
private String guestRoomWidth; private String guestRoomWidth;
/** /**
* 厅数 * 厅数
*/ */
@Excel(name = "厅数", height = 20, width = 30) @Excel(name = "厅数", height = 20, width = 30)
@Length(max = 4)
private String hallNumber; private String hallNumber;
/** /**
...@@ -116,14 +108,12 @@ public class ExportBnsProductDto extends CommonEntity { ...@@ -116,14 +108,12 @@ public class ExportBnsProductDto extends CommonEntity {
* 卫生间数 * 卫生间数
*/ */
@Excel(name = "卫生间数", height = 20, width = 30) @Excel(name = "卫生间数", height = 20, width = 30)
@Length(max = 9)
private String toiletNumber; private String toiletNumber;
/** /**
* 开间数 * 开间数
*/ */
@Excel(name = "开间数", height = 20, width = 30) @Excel(name = "开间数", height = 20, width = 30)
@Length(max = 8)
private String bayNumber; private String bayNumber;
/** /**
......
...@@ -36,7 +36,6 @@ public class ExportBnsProjectDto extends CommonEntity { ...@@ -36,7 +36,6 @@ public class ExportBnsProjectDto extends CommonEntity {
*/ */
@Excel(name = "楼盘编码*", height = 20, width = 30) @Excel(name = "楼盘编码*", height = 20, width = 30)
@NotEmpty(message = "不能为空") @NotEmpty(message = "不能为空")
@Length(max = 20)
private String code; private String code;
/** /**
...@@ -44,14 +43,12 @@ public class ExportBnsProjectDto extends CommonEntity { ...@@ -44,14 +43,12 @@ public class ExportBnsProjectDto extends CommonEntity {
*/ */
@Excel(name = "楼盘名称*", height = 20, width = 30) @Excel(name = "楼盘名称*", height = 20, width = 30)
@NotEmpty(message = "不能为空") @NotEmpty(message = "不能为空")
@Length(max = 50)
private String name; private String name;
/** /**
* 楼盘简称(最大30个字符) * 楼盘简称(最大30个字符)
*/ */
@Excel(name = "其他名称", height = 20, width = 30) @Excel(name = "其他名称", height = 20, width = 30)
@Length(max = 30)
private String shortName; private String shortName;
/** /**
...@@ -59,7 +56,6 @@ public class ExportBnsProjectDto extends CommonEntity { ...@@ -59,7 +56,6 @@ public class ExportBnsProjectDto extends CommonEntity {
*/ */
@Excel(name = "隶属(0:土拍;1:板块)*", height = 20, width = 30) @Excel(name = "隶属(0:土拍;1:板块)*", height = 20, width = 30)
@NotEmpty(message = "类型不能为空") @NotEmpty(message = "类型不能为空")
@Length(max = 10)
private String parentTpye; private String parentTpye;
/** /**
...@@ -67,21 +63,18 @@ public class ExportBnsProjectDto extends CommonEntity { ...@@ -67,21 +63,18 @@ public class ExportBnsProjectDto extends CommonEntity {
*/ */
@Excel(name = "隶属板块(土拍)*", height = 20, width = 30) @Excel(name = "隶属板块(土拍)*", height = 20, width = 30)
@NotEmpty(message = "不能为空") @NotEmpty(message = "不能为空")
@Length(max = 30)
private String parentName; private String parentName;
/** /**
* 经度 * 经度
*/ */
@Excel(name = "经度", height = 20, width = 30) @Excel(name = "经度", height = 20, width = 30)
@Length(max = 17)
private String longitude; private String longitude;
/** /**
* 纬度 * 纬度
*/ */
@Excel(name = "纬度", height = 20, width = 30) @Excel(name = "纬度", height = 20, width = 30)
@Length(max = 17)
private String latitude; private String latitude;
/** /**
...@@ -89,7 +82,6 @@ public class ExportBnsProjectDto extends CommonEntity { ...@@ -89,7 +82,6 @@ public class ExportBnsProjectDto extends CommonEntity {
*/ */
@Excel(name = "销售状态(0:售罄;1:在售)*", height = 20, width = 30) @Excel(name = "销售状态(0:售罄;1:在售)*", height = 20, width = 30)
@NotEmpty(message = "不能为空") @NotEmpty(message = "不能为空")
@Length(max = 2)
private String saleStatus; private String saleStatus;
/** /**
...@@ -97,14 +89,12 @@ public class ExportBnsProjectDto extends CommonEntity { ...@@ -97,14 +89,12 @@ public class ExportBnsProjectDto extends CommonEntity {
*/ */
@Excel(name = "是否天友设计(0:否;1:是)*", height = 20, width = 30) @Excel(name = "是否天友设计(0:否;1:是)*", height = 20, width = 30)
@NotEmpty(message = "不能为空") @NotEmpty(message = "不能为空")
@Length(max = 2) private String isTy;
private String isTenio;
/** /**
* 价格 * 价格
*/ */
@Excel(name = "价格", height = 20, width = 30) @Excel(name = "价格", height = 20, width = 30)
@Length(max = 32)
private String price; private String price;
/** /**
...@@ -119,42 +109,36 @@ public class ExportBnsProjectDto extends CommonEntity { ...@@ -119,42 +109,36 @@ public class ExportBnsProjectDto extends CommonEntity {
* 用地面积 * 用地面积
*/ */
@Excel(name = "用地面积", height = 20, width = 30) @Excel(name = "用地面积", height = 20, width = 30)
@Length(max = 19)
private String landArea; private String landArea;
/** /**
* 总建筑面积 * 总建筑面积
*/ */
@Excel(name = "总建筑面积", height = 20, width = 30) @Excel(name = "总建筑面积", height = 20, width = 30)
@Length(max = 19)
private String totalArea; private String totalArea;
/** /**
* 容积率 * 容积率
*/ */
@Excel(name = "容积率", height = 20, width = 30) @Excel(name = "容积率", height = 20, width = 30)
@Length(max = 32)
private String plotRatio; private String plotRatio;
/** /**
* 总户数 * 总户数
*/ */
@Excel(name = "总户数", height = 20, width = 30) @Excel(name = "总户数", height = 20, width = 30)
@Length(max = 9)
private String totalHousehold; private String totalHousehold;
/** /**
* 开发商 * 开发商
*/ */
@Excel(name = "开发商", height = 20, width = 30) @Excel(name = "开发商", height = 20, width = 30)
@Length(max = 64)
private String developer; private String developer;
/** /**
* 物业管理 * 物业管理
*/ */
@Excel(name = "物业管理", height = 20, width = 30) @Excel(name = "物业管理", height = 20, width = 30)
@Length(max = 64)
private String estateManage; private String estateManage;
......
package com.isoft.tenio.business.bnssale.dto;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.isoft.tenio.utils.entity.CommonEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* @Author: HaoChangXi
* @Date: 2020/6/30 13:30
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ExportSaleProjectDTO extends CommonEntity {
/**
* 时间(月) -- 销售月份
* */
@Excel(name = "时间(月)", height = 20, width = 30)
@NotNull(message = "不能为空")
private String saleMonth;
/**
* 成交数量
*/
@Excel(name = "成交套数(套)", height = 20, width = 30)
private Integer dealNumber;
/**
* 供应套数
*/
@Excel(name = "供应套数(套)", height = 20, width = 30)
private Integer suplyNumber;
@Excel(name = "区域", height = 20, width = 30)
private String quYu;
@Excel(name = "板块", height = 20, width = 30)
private String banKai;
@Excel(name = "开发商", height = 20, width = 30)
private String kaiFaS;
@Excel(name = "供应面积(㎡)", height = 20, width = 30)
private String gongQiuM;
@Excel(name = "成交面积(㎡)", height = 20, width = 30)
private String chenJiaM;
@Excel(name = "成交均价(元/㎡)", height = 20, width = 30)
private String chenJiaJ;
@Excel(name = "套均价(元/套)", height = 20, width = 30)
private String taoJunJ;
@Excel(name = "成交金额(元)", height = 20, width = 30)
private String chenJiaJE;
@Excel(name = "供求比", height = 20, width = 30)
private String gongQiuBi;
/**
* 最小面积
*/
private String minArea;
/**
* 楼盘名称
*/
private String projectName;
/**
* 最大面积
*/
private String maxArea;
private String areaInterval;
private String productTypeName;
}
...@@ -194,11 +194,11 @@ public class BnsSaleServiceImpl extends ServiceImpl<BnsSaleMapper, BnsSale> impl ...@@ -194,11 +194,11 @@ public class BnsSaleServiceImpl extends ServiceImpl<BnsSaleMapper, BnsSale> impl
} }
if (s2.equals(o) || (o_minArea <= s2_minArea && o_maxArea >= s2_maxArea )) { if (s2.equals(o) || (o_minArea <= s2_minArea && o_maxArea >= s2_maxArea )) {
if (map.get(s2) != null) { if (map.get(o) != null) {
SaleDto saleDto1 = map.get(s2); SaleDto saleDto1 = map.get(o);
saleDto1.setDealNumber(map.get(s2).getDealNumber() + saleDto.getDealNumber()); saleDto1.setDealNumber(map.get(o).getDealNumber() + saleDto.getDealNumber());
saleDto1.setSuplyNumber(map.get(s2).getSuplyNumber() + saleDto.getSuplyNumber()); saleDto1.setSuplyNumber(map.get(o).getSuplyNumber() + saleDto.getSuplyNumber());
map.put(s2, saleDto1); map.put(o, saleDto1);
} else { } else {
SaleDto saleDto2 = new SaleDto(); SaleDto saleDto2 = new SaleDto();
saleDto2.setDealNumber(saleDto.getDealNumber()); saleDto2.setDealNumber(saleDto.getDealNumber());
...@@ -251,21 +251,32 @@ public class BnsSaleServiceImpl extends ServiceImpl<BnsSaleMapper, BnsSale> impl ...@@ -251,21 +251,32 @@ public class BnsSaleServiceImpl extends ServiceImpl<BnsSaleMapper, BnsSale> impl
for (SaleDto saleDto : saleDtos) { for (SaleDto saleDto : saleDtos) {
String s2 = new DecimalFormat("#.00").format(saleDto.getAreaMin()) + "-" + new DecimalFormat("#.00").format(saleDto.getAreaMax()); String s2 = new DecimalFormat("#.00").format(saleDto.getAreaMin()) + "-" + new DecimalFormat("#.00").format(saleDto.getAreaMax());
float s2_minArea = Float.valueOf(new DecimalFormat("#.00").format(saleDto.getAreaMin()));
float s2_maxArea = Float.valueOf(new DecimalFormat("#.00").format(saleDto.getAreaMax()));
dealTotal = dealTotal + saleDto.getDealNumber(); dealTotal = dealTotal + saleDto.getDealNumber();
suplyTotal = suplyTotal + saleDto.getSuplyNumber(); suplyTotal = suplyTotal + saleDto.getSuplyNumber();
for (Object o : map.keySet()) { for (Object o : map.keySet()) {
if (s2.equals(o)) { float o_minArea = 0;
if (map.get(s2) != null) { float o_maxArea = 0;
SaleDto saleDto1 = map.get(s2); if(o.toString().contains("-")){
saleDto1.setDealNumber(map.get(s2).getDealNumber() + saleDto.getDealNumber()); String[] o_Arr = o.toString().split("-");
saleDto1.setSuplyNumber(map.get(s2).getSuplyNumber() + saleDto.getSuplyNumber()); o_minArea = Float.valueOf(o_Arr[0]);
map.put(s2, saleDto1); o_maxArea = Float.valueOf(o_Arr[1]);
}
if (s2.equals(o) || (o_minArea <= s2_minArea && o_maxArea >= s2_maxArea )) {
if (map.get(o) != null) {
SaleDto saleDto1 = map.get(o);
saleDto1.setDealNumber(map.get(o).getDealNumber() + saleDto.getDealNumber());
saleDto1.setSuplyNumber(map.get(o).getSuplyNumber() + saleDto.getSuplyNumber());
map.put(o, saleDto1);
} else { } else {
SaleDto saleDto2 = new SaleDto(); SaleDto saleDto2 = new SaleDto();
saleDto2.setDealNumber(saleDto.getDealNumber()); saleDto2.setDealNumber(saleDto.getDealNumber());
saleDto2.setSuplyNumber(saleDto.getSuplyNumber()); saleDto2.setSuplyNumber(saleDto.getSuplyNumber());
map.put(s2, saleDto2); map.put(o, saleDto2);
} }
} }
} }
......
...@@ -30,6 +30,9 @@ public class ExcelPatternMsg { ...@@ -30,6 +30,9 @@ public class ExcelPatternMsg {
public static final String DATEMonth = "^(([1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2})\\/(0[1-9]|[12][0-9]|3[01]))$"; public static final String DATEMonth = "^(([1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2})\\/(0[1-9]|[12][0-9]|3[01]))$";
public static final String DATEMonth_MSG = "输入正确的日期格式:yyyy/MM"; public static final String DATEMonth_MSG = "输入正确的日期格式:yyyy/MM";
public static final String DATEMonthC = "^(([1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2})年(0[1-9]|[12][0-9]|3[01])月)$";
public static final String DATEMonthC_MSG = "输入正确的日期格式:yyyy年MM月";
//日期格式 yyyy/MM/dd //日期格式 yyyy/MM/dd
public static final String DATE1 = "(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})\\/(((0[13578]|1[02])\\/(0[1-9]|[12][0-9]|3[01]))|"+ public static final String DATE1 = "(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})\\/(((0[13578]|1[02])\\/(0[1-9]|[12][0-9]|3[01]))|"+
...@@ -95,10 +98,6 @@ public class ExcelPatternMsg { ...@@ -95,10 +98,6 @@ public class ExcelPatternMsg {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(Pattern.matches(DECIMALAreaInterval,"90/100")); System.out.println(Pattern.matches(DATEMonthC,"2019年06月"));
String[] s = "ssss-ssss.xlsx".split("\\.");
System.out.println(s[0]);
System.out.println(s[1]);
} }
} }
\ No newline at end of file
package com.isoft.tenio.utils.poi;
import cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult;
import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler;
import com.alibaba.fastjson.JSONObject;
import com.isoft.tenio.business.bnsproject.entity.BnsProject;
import com.isoft.tenio.business.bnsproject.service.IBnsProjectService;
import com.isoft.tenio.business.bnssale.dto.ExportSaleProjectDTO;
import com.isoft.tenio.business.bnssale.service.IBnsSaleService;
import com.isoft.tenio.business.bnssale.utils.SaleProductType;
import com.isoft.tenio.utils.Utils;
import com.isoft.tenio.utils.excel.ExcelPatternMsg;
import lombok.SneakyThrows;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* 自定义校验 官方api
*
* @author :jiangpengpeng
* @date:2020/6/24 11:17
*/
@Component
public class ExportSaleProjectHander implements IExcelVerifyHandler<ExportSaleProjectDTO> {
@Value("${file.dir.sale}")
private String sale;
/**
* 文件的目录
*/
@Value("${file.realFile}")
private String realFile;
@Autowired
private IBnsSaleService iBnsSaleService;
@Autowired
private IBnsProjectService iBnsProjectService;
/**
* 更新销售按行验证
* @author Super_liu
* @param ExportSaleProjectDTO
* @return
*/
@SneakyThrows
@Override
public ExcelVerifyHandlerResult verifyHandler(ExportSaleProjectDTO exportSaleProjectDTO) {
ExcelVerifyHandlerResult result=new ExcelVerifyHandlerResult(true,"");
List<String> list = new ArrayList<>();
String projectName = "";
String minArea = "";
String maxArea = "";
String saleTime = "";
String filePath = realFile + "/" +sale + "/saleProject.txt";
JSONObject jsonObject = null;
if(Utils.verifyFile(filePath)) {
jsonObject= JSONObject.parseObject(Utils.readFile(filePath));
}
if (jsonObject != null && jsonObject.get("areaInterval") != null && jsonObject.get("areaInterval").toString()!=""){
String[] str = jsonObject.get("areaInterval").toString().split("-");
minArea = str[0];
boolean matchesMin = Pattern.matches(ExcelPatternMsg.Decimal, minArea.toString());
maxArea = str[1];
boolean matchesMax = Pattern.matches(ExcelPatternMsg.Decimal, maxArea.toString());
if (!matchesMax && !matchesMin){
list.add("面积区间不合法"+ExcelPatternMsg.DECIMALAreaInterval_MSG);
}else if (!matchesMax && matchesMin){
list.add("面积区间最大面积不合法"+ExcelPatternMsg.DECIMALAreaInterval_MSG);
}else if (matchesMax && !matchesMin){
list.add("面积区间最小面积不合法"+ExcelPatternMsg.DECIMALAreaInterval_MSG);
}
}
if (exportSaleProjectDTO.getSaleMonth() != null && exportSaleProjectDTO.getSaleMonth().toString()!=""){
boolean matches = Pattern.matches(ExcelPatternMsg.DATEMonthC, exportSaleProjectDTO.getSaleMonth().toString());
if (!matches){
list.add("销售时间不合法"+ExcelPatternMsg.DATEMonthC_MSG);
}else {
saleTime = exportSaleProjectDTO.getSaleMonth().toString();
}
}
if (jsonObject != null && jsonObject.get("projectName") != null && jsonObject.get("projectName").toString()!=""){
projectName = jsonObject.get("projectName").toString();
BnsProject bnsProject = iBnsProjectService.getVerifyNameOne(projectName);
if(bnsProject==null) {
list.add( "楼盘不存在");
}else if((minArea != null && !minArea.equals("")) && (maxArea != null && !maxArea.equals(""))){
String projectId = bnsProject.getBusinessId();
String jsonTypeName = jsonObject.get("productTypeName").toString();
String productTypeName = SaleProductType.getSelectProductType(jsonTypeName);
String[] tName = null;
if(jsonTypeName.equals("别墅")){
tName = productTypeName.split("-");
}
List<String> listProductTypes = new ArrayList<>();
if(tName != null){
List<String> listProductTypes1 = iBnsSaleService.selectProductTypes(projectId,tName[0],minArea,maxArea);
List<String> listProductTypes2 = iBnsSaleService.selectProductTypes(projectId,tName[1],minArea,maxArea);
if(listProductTypes1.size() == 1 && listProductTypes2.size() == 1){
list.add( "该产品下的("+tName[0]+"-"+tName[1]+")面积区间("+minArea+"-"+maxArea+")产品类型各存在一个(俩种类型只可存在一个)");
}else if(listProductTypes1.size() >= 1 && listProductTypes2.size() == 0){
listProductTypes = listProductTypes1;
}else if(listProductTypes2.size() >= 1 && listProductTypes1.size() == 0){
listProductTypes = listProductTypes2;
}
}else {
listProductTypes = iBnsSaleService.selectProductTypes(projectId,productTypeName,minArea,maxArea);
}
if(minArea.equals(maxArea)){
list.add( "面积区间面积相等(请修改最大面积)");
}else if(listProductTypes == null || listProductTypes.size() == 0){
list.add( "楼盘产品类型不存在(请在楼盘管理设置当前楼盘产品类型)");
}else if(listProductTypes.size() > 1){
list.add("该楼盘("+projectName+")产品类型下的面积区间("+minArea+"-"+maxArea+"㎡)含多个产品(需缩短面积区间、精确定位产品)");
}else {
String productType = listProductTypes.get(0);
if(saleTime != null && !saleTime.equals("")){
String min = "";
String max = "";
if(Float.valueOf(maxArea) <= 70){
min = "0";
max = "70";
}else if(Float.valueOf(maxArea) > 200){
min = "200";
max = "20000";
}else {
min = minArea;
max = maxArea;
}
saleTime = new SimpleDateFormat("yyyy-mm-dd").format(new SimpleDateFormat("yyyy年mm月").parse(saleTime));
int count = iBnsSaleService.productTypeCount(projectId,productType,min,max,saleTime);
if(count == 1){
list.add("销售信息已存在");
}else if(count > 1){
list.add("销售信息重复存在多条");
}
}
}
}
}
// 验证每行在EXCEL中 是否出现重复数据 并 按行提示 ---Start---
String filePathE = realFile + "/" +sale + "/saleProject.xls";
File fileE = new File(filePathE);
FileInputStream inputStream = new FileInputStream(fileE);
MultipartFile multipartFile = new MockMultipartFile("file", fileE.getName(), "text/plain", IOUtils.toByteArray(inputStream));
List<ExportSaleProjectDTO> saleDTOList = Utils.importExcel(multipartFile, 1, 1, ExportSaleProjectDTO.class);
if(saleDTOList == null){
saleDTOList = Utils.importExcel(multipartFile, 2, 1, ExportSaleProjectDTO.class);
}
if(saleDTOList != null && saleDTOList.size() > 0){
if(saleDTOList.get(0).getSaleMonth() == null){
saleDTOList = Utils.importExcel(multipartFile, 2, 1, ExportSaleProjectDTO.class);
}
Map<ExportSaleProjectDTO, Long> collect = saleDTOList.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
if(collect.get(exportSaleProjectDTO) != null){
if(collect.get(exportSaleProjectDTO) > 1){
list.add("Excel中销售信息重复");
}
}
}
// 验证每行在EXCEL中 是否出现重复数据 并 按行提示 ---End---
if(list.size() > 0){
StringBuffer sb = new StringBuffer();
for (int i = 0; i < list.size(); i++) {
if(i == 0){
sb.append(list.get(i));
}else {
sb.append("," + list.get(i));
}
}
result.setMsg(sb.toString());
result.setSuccess(false);
return result;
}
return result;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment