Commit 4ec49d61 authored by 332784038@qq.com's avatar 332784038@qq.com

单询异常的空值线路价格下载业务对货币单位、计量单位的转化处理bug修复

parent 046fe455
......@@ -78,7 +78,7 @@ public class ProductPriceExcelExportListener {
String nowTime = formatter.format(LocalDateTime.now());
String dir = ueProperties.getTempDir().concat("/productPrice/excel/");
File fileDir = new File(dir);
if(!fileDir.exists()) {
if (!fileDir.exists()) {
fileDir.mkdirs();
}
......@@ -89,11 +89,11 @@ public class ProductPriceExcelExportListener {
long total = productPriceService.getExcelListCount(exportReqVO);
int pageNumber = (int) Math.ceil((double) total / (double) pageSize);
String sheetName = "路线价格第{0}页";
String sheetName = "路线价格第{0}页";
List<CurrencyDO> currencyList = currencyService.getCurrencyList();
Map<Integer, CurrencyDO> currencyMap = currencyList.stream()
.collect(Collectors.toMap(CurrencyDO::getId, v->v));
.collect(Collectors.toMap(CurrencyDO::getId, v -> v));
List<UnitDO> unitList = unitService.getUnitList();
Map<Integer, UnitDO> unitMap = unitList.stream()
......@@ -113,7 +113,7 @@ public class ProductPriceExcelExportListener {
List<ProductPriceExcelData> list =
productPriceService.getExcelList(pageSize, maxId, exportReqVO);
log.error("路线价格数据{}-{}处理成功", start, end);
if(CollectionUtil.isEmpty(list)) continue;
if (CollectionUtil.isEmpty(list)) continue;
maxId = list.get(list.size() - 1).getId();
for (ProductPriceExcelData item : list) {
......@@ -121,7 +121,7 @@ public class ProductPriceExcelExportListener {
String transportPrice = "";
String clearancePrice = "";
if(item.getStepPrice() == 0) {
if (item.getStepPrice() == 0) {
transportPrice = getPrice(item.getTransportPrice(),
item.getTransportPriceUnit().intValue(),
item.getTransportVolumeUnit().intValue(), currencyMap, unitMap);
......@@ -132,13 +132,13 @@ public class ProductPriceExcelExportListener {
String allPrice = getPrice(item.getAllPrice(), item.getAllPriceUnit().intValue(),
item.getAllVolumeUnit().intValue(), currencyMap, unitMap);
if(item.getPriceType() == 1) {
if (item.getPriceType() == 1) {
transportPrice = allPrice;
clearancePrice = "";
}
List<ProductPriceSpecialDO> specialList = item.getSpecialList();
if(CollectionUtil.isNotEmpty(specialList)) {
if (CollectionUtil.isNotEmpty(specialList)) {
for (ProductPriceSpecialDO specialDO : specialList) {
String key = specialDO.getSpecialDictType();
String specialTransportPrice = getPrice(specialDO.getTransportPrice(),
......@@ -151,31 +151,31 @@ public class ProductPriceExcelExportListener {
String specialAllPrice = getPrice(specialDO.getAllPrice(), specialDO.getAllPriceUnit().intValue(),
specialDO.getAllVolumeUnit().intValue(), currencyMap, unitMap);
if(item.getPriceType() == 1) {
if (item.getPriceType() == 1) {
specialTransportPrice = specialAllPrice;
specialClearancePrice = "";
}
if(key.equals("licensed_price")) {
if (key.equals("licensed_price")) {
item.setYpTransportPrice(specialTransportPrice);
item.setYpClearancePrice(specialClearancePrice);
} else if(key.equals("neutral_brand_prices")) {
} else if (key.equals("neutral_brand_prices")) {
item.setZxTransportPrice(specialTransportPrice);
item.setZxClearancePrice(specialClearancePrice);
} else if(key.equals("liquid_price")) {
} else if (key.equals("liquid_price")) {
item.setYtTransportPrice(specialTransportPrice);
item.setYtClearancePrice(specialClearancePrice);
} else if(key.equals("live_price")) {
} else if (key.equals("live_price")) {
item.setDdTransportPrice(specialTransportPrice);
item.setDdClearancePrice(specialClearancePrice);
}
}
}
} else if(item.getStepPrice() == 1) {
} else if (item.getStepPrice() == 1) {
//阶梯价格
List<ProductPriceStepDO> stepList = item.getStepList();
if(CollectionUtil.isNotEmpty(stepList)) {
if (CollectionUtil.isNotEmpty(stepList)) {
Map<Integer, List<ProductPriceStepDO>> stepTypeMap = stepList.stream()
.collect(Collectors.groupingBy(ProductPriceStepDO::getPriceType));
List<ProductPriceStepDO> yfStepList = stepTypeMap.get(PriceTypeEnum.FREIGHT.getPriceType());
......@@ -194,14 +194,14 @@ public class ProductPriceExcelExportListener {
StringBuilder ddyfSb = new StringBuilder();
StringBuilder ddqgfSb = new StringBuilder();
if(CollectionUtil.isNotEmpty(yfStepList)) {
if (CollectionUtil.isNotEmpty(yfStepList)) {
yfStepList.sort(Comparator.comparing(ProductPriceStepDO::getRankNum));
for (int j = 1; j <= yfStepList.size(); j++) {
ProductPriceStepDO stepDO = yfStepList.get(j - 1);
List<ProductPriceStepSpecialDO> stepSpecialDOS = stepDO.getSpecialList();
if(CollectionUtil.isNotEmpty(stepSpecialDOS)) {
if (CollectionUtil.isNotEmpty(stepSpecialDOS)) {
Map<String, ProductPriceStepSpecialDO> stepSpecialDOMap = stepSpecialDOS.stream()
.collect(Collectors.toMap(ProductPriceStepSpecialDO::getSpecialDictType, v -> v, (v1,v2) -> v2));
.collect(Collectors.toMap(ProductPriceStepSpecialDO::getSpecialDictType, v -> v, (v1, v2) -> v2));
//有牌
ProductPriceStepSpecialDO yp = stepSpecialDOMap.get("licensed_price");
//中性
......@@ -216,11 +216,11 @@ public class ProductPriceExcelExportListener {
addStepSpecialPrice(zx, currencyMap, unitMap, zxyfSb, stepInfo, PriceTypeEnum.FREIGHT);
addStepSpecialPrice(yt, currencyMap, unitMap, ytyfSb, stepInfo, PriceTypeEnum.FREIGHT);
addStepSpecialPrice(dd, currencyMap, unitMap, ddyfSb, stepInfo, PriceTypeEnum.FREIGHT);
if(i != yfStepList.size()) {
ypyfSb.append((char)10);
zxyfSb.append((char)10);
ytyfSb.append((char)10);
ddyfSb.append((char)10);
if (i != yfStepList.size()) {
ypyfSb.append((char) 10);
zxyfSb.append((char) 10);
ytyfSb.append((char) 10);
ddyfSb.append((char) 10);
}
}
......@@ -230,28 +230,28 @@ public class ProductPriceExcelExportListener {
Long weightUnit = stepDO.getWeightUnit();
String unit = "";
if(weightUnit != null) {
if (weightUnit != null) {
UnitDO unitDO = unitMap.get(weightUnit.intValue());
unit = unitDO.getTitleZh();
unit = Objects.nonNull(unitDO)?unitDO.getTitleZh():"空";
}
BigDecimal startNum = stepDO.getStartNum();
BigDecimal endNum = stepDO.getEndNum();
transportPriceSb.append("第").append(j).append("阶梯:").append(startNum)
.append("-").append(endNum).append(unit).append(" ").append(stepTransportPrice);
if(i != stepList.size()) {
transportPriceSb.append((char)10);
if (i != stepList.size()) {
transportPriceSb.append((char) 10);
}
}
}
if(CollectionUtil.isNotEmpty(qgfStepList)) {
if (CollectionUtil.isNotEmpty(qgfStepList)) {
qgfStepList.sort(Comparator.comparing(ProductPriceStepDO::getRankNum));
for (int j = 1; j <= qgfStepList.size(); j++) {
ProductPriceStepDO stepDO = qgfStepList.get(j - 1);
List<ProductPriceStepSpecialDO> stepSpecialDOS = stepDO.getSpecialList();
if(CollectionUtil.isNotEmpty(stepSpecialDOS)) {
if (CollectionUtil.isNotEmpty(stepSpecialDOS)) {
Map<String, ProductPriceStepSpecialDO> stepSpecialDOMap = stepSpecialDOS.stream()
.collect(Collectors.toMap(ProductPriceStepSpecialDO::getSpecialDictType, v -> v, (v1,v2) -> v2));
.collect(Collectors.toMap(ProductPriceStepSpecialDO::getSpecialDictType, v -> v, (v1, v2) -> v2));
//有牌
ProductPriceStepSpecialDO yp = stepSpecialDOMap.get("licensed_price");
//中性
......@@ -266,11 +266,11 @@ public class ProductPriceExcelExportListener {
addStepSpecialPrice(zx, currencyMap, unitMap, zxqgfSb, stepInfo, PriceTypeEnum.CLEARANCE);
addStepSpecialPrice(yt, currencyMap, unitMap, ytqgfSb, stepInfo, PriceTypeEnum.CLEARANCE);
addStepSpecialPrice(dd, currencyMap, unitMap, ddqgfSb, stepInfo, PriceTypeEnum.CLEARANCE);
if(i != qgfStepList.size()) {
ypqgfSb.append((char)10);
zxqgfSb.append((char)10);
ytqgfSb.append((char)10);
ddqgfSb.append((char)10);
if (i != qgfStepList.size()) {
ypqgfSb.append((char) 10);
zxqgfSb.append((char) 10);
ytqgfSb.append((char) 10);
ddqgfSb.append((char) 10);
}
}
......@@ -280,7 +280,7 @@ public class ProductPriceExcelExportListener {
//
Long weightUnit = stepDO.getWeightUnit();
String unit = "";
if(weightUnit != null) {
if (weightUnit != null) {
UnitDO unitDO = unitMap.get(weightUnit.intValue());
unit = unitDO.getTitleZh();
}
......@@ -288,20 +288,20 @@ public class ProductPriceExcelExportListener {
BigDecimal endNum = stepDO.getEndNum();
clearancePriceSb.append("第").append(j).append("阶梯:").append(startNum)
.append("-").append(endNum).append(unit).append(" ").append(stepClearancePrice);
if(i != stepList.size()) {
clearancePriceSb.append((char)10);
if (i != stepList.size()) {
clearancePriceSb.append((char) 10);
}
}
}
if(CollectionUtil.isNotEmpty(qbjStepList) && item.getPriceType() == 1) {
if (CollectionUtil.isNotEmpty(qbjStepList) && item.getPriceType() == 1) {
qbjStepList.sort(Comparator.comparing(ProductPriceStepDO::getRankNum));
for (int j = 1; j <= qbjStepList.size(); j++) {
ProductPriceStepDO stepDO = qbjStepList.get(j - 1);
List<ProductPriceStepSpecialDO> stepSpecialDOS = stepDO.getSpecialList();
if(CollectionUtil.isNotEmpty(stepSpecialDOS)) {
if (CollectionUtil.isNotEmpty(stepSpecialDOS)) {
Map<String, ProductPriceStepSpecialDO> stepSpecialDOMap = stepSpecialDOS.stream()
.collect(Collectors.toMap(ProductPriceStepSpecialDO::getSpecialDictType, v -> v, (v1,v2) -> v2));
.collect(Collectors.toMap(ProductPriceStepSpecialDO::getSpecialDictType, v -> v, (v1, v2) -> v2));
//有牌
ProductPriceStepSpecialDO yp = stepSpecialDOMap.get("licensed_price");
//中性
......@@ -316,11 +316,11 @@ public class ProductPriceExcelExportListener {
addStepSpecialPrice(zx, currencyMap, unitMap, zxyfSb, stepInfo, PriceTypeEnum.FULL_PRICE);
addStepSpecialPrice(yt, currencyMap, unitMap, ytyfSb, stepInfo, PriceTypeEnum.FULL_PRICE);
addStepSpecialPrice(dd, currencyMap, unitMap, ddyfSb, stepInfo, PriceTypeEnum.FULL_PRICE);
if(i != qbjStepList.size()) {
ypyfSb.append((char)10);
zxyfSb.append((char)10);
ytyfSb.append((char)10);
ddyfSb.append((char)10);
if (i != qbjStepList.size()) {
ypyfSb.append((char) 10);
zxyfSb.append((char) 10);
ytyfSb.append((char) 10);
ddyfSb.append((char) 10);
}
}
......@@ -330,16 +330,16 @@ public class ProductPriceExcelExportListener {
//
Long weightUnit = stepDO.getWeightUnit();
String unit = "";
if(weightUnit != null) {
if (weightUnit != null) {
UnitDO unitDO = unitMap.get(weightUnit.intValue());
unit = unitDO.getTitleZh();
unit = Objects.nonNull(unitDO) ? unitDO.getTitleZh() : "空";
}
BigDecimal startNum = stepDO.getStartNum();
BigDecimal endNum = stepDO.getEndNum();
transportPriceSb.append("第").append(j).append("阶梯:").append(startNum)
.append("-").append(endNum).append(unit).append(" ").append(stepTransportPrice);
if(i != stepList.size()) {
transportPriceSb.append((char)10);
if (i != stepList.size()) {
transportPriceSb.append((char) 10);
}
}
}
......@@ -363,9 +363,9 @@ public class ProductPriceExcelExportListener {
statusName(item);
if(item.getNeedPay() == 0) {
if (item.getNeedPay() == 0) {
item.setPayType("到付");
} else if(item.getNeedPay() == 1) {
} else if (item.getNeedPay() == 1) {
item.setPayType("预付");
}
String date = DateUtil.format(item.getUpdateTime(), "yyyy-MM-dd HH:mm:ss");
......@@ -374,12 +374,12 @@ public class ProductPriceExcelExportListener {
Date startDate = item.getValidateStartDate();
Date endDate = item.getValidateEndDate();
StringBuilder expireSb = new StringBuilder();
if(startDate != null) {
if (startDate != null) {
String startDateStr = DateUtil.format(startDate, "yyyy-MM-dd");
expireSb.append(startDateStr);
}
expireSb.append("~");
if(endDate != null) {
if (endDate != null) {
String endDateStr = DateUtil.format(endDate, "yyyy-MM-dd");
expireSb.append(endDateStr);
}
......@@ -388,10 +388,10 @@ public class ProductPriceExcelExportListener {
List<ProductPriceExcelVO> datas = ProductPriceConvert.INSTANCE.convertList02(list);
excelWriter.write(datas, writeSheet);
list.forEach(m -> {
if(m.getSpecialList() != null) {
if (m.getSpecialList() != null) {
m.getSpecialList().clear();
}
if(m.getStepList() != null) {
if (m.getStepList() != null) {
m.getStepList().clear();
}
});
......@@ -417,8 +417,8 @@ public class ProductPriceExcelExportListener {
event.setFileId(fileDO.getId());
} catch (Exception e) {
// TODO 测试阶段打印堆栈错误信息,便于分析原因
e.printStackTrace();
event.setResult(e.getMessage());
log.error(e + "");
event.setResult(e + "");
}
} else {
event.setResult("param fail");
......@@ -427,20 +427,20 @@ public class ProductPriceExcelExportListener {
}
private void addStepSpecialPrice(ProductPriceStepSpecialDO stepSpecialDO, Map<Integer, CurrencyDO> currencyMap,
Map<Integer, UnitDO> unitMap, StringBuilder sb, String stepInfo, PriceTypeEnum priceTypeEnum) {
Map<Integer, UnitDO> unitMap, StringBuilder sb, String stepInfo, PriceTypeEnum priceTypeEnum) {
sb.append(stepInfo);
if(stepSpecialDO != null) {
if(priceTypeEnum == PriceTypeEnum.FREIGHT) {
if (stepSpecialDO != null) {
if (priceTypeEnum == PriceTypeEnum.FREIGHT) {
String specialTransportPrice = getPrice(stepSpecialDO.getTransportPrice(),
stepSpecialDO.getTransportPriceUnit().intValue(),
stepSpecialDO.getTransportVolumeUnit().intValue(), currencyMap, unitMap);
sb.append(specialTransportPrice);
} else if(priceTypeEnum == PriceTypeEnum.CLEARANCE) {
} else if (priceTypeEnum == PriceTypeEnum.CLEARANCE) {
String specialClearancePrice = getPrice(stepSpecialDO.getClearancePrice(),
stepSpecialDO.getClearancePriceUnit().intValue(),
stepSpecialDO.getClearanceVolumeUnit().intValue(), currencyMap, unitMap);
sb.append(specialClearancePrice);
} else if(priceTypeEnum == PriceTypeEnum.FULL_PRICE) {
} else if (priceTypeEnum == PriceTypeEnum.FULL_PRICE) {
String specialAllPrice = getPrice(stepSpecialDO.getAllPrice(), stepSpecialDO.getAllPriceUnit().intValue(),
stepSpecialDO.getAllVolumeUnit().intValue(), currencyMap, unitMap);
sb.append(specialAllPrice);
......@@ -452,8 +452,8 @@ public class ProductPriceExcelExportListener {
CurrencyDO currencyDO = currencyMap.get(priceUnit);
UnitDO unitDO = unitMap.get(volumeUnit);
return (currencyDO != null ? currencyDO.getFuhao() : "") + price.toString() + (currencyDO != null ? currencyDO.getTitleZh() : "") + "/" +
(unitDO != null ? unitDO.getTitleZh() : "");
return (currencyDO != null ? currencyDO.getFuhao() : "空") + price.toString() + (currencyDO != null ? currencyDO.getTitleZh() : "空") + "/" +
(unitDO != null ? unitDO.getTitleZh() : "");
}
private void statusName(ProductPriceExcelData item) {
......@@ -461,18 +461,18 @@ public class ProductPriceExcelExportListener {
Date endDate = item.getValidateEndDate();
boolean notSetPrice = false;
long now = new Date().getTime();
if(startDate != null && startDate.getTime() > now) {
if (startDate != null && startDate.getTime() > now) {
notSetPrice = true;
}
if(endDate != null && endDate.getTime() < now) {
if (endDate != null && endDate.getTime() < now) {
notSetPrice = true;
}
String setPriceText = notSetPrice ? "(未设置价格)" : "";
if(item.getBlacklist() == 1) {
if (item.getBlacklist() == 1) {
item.setStatusName("黑名单" + setPriceText);
return;
}
if(item.getAuditStatus() == 0) {
if (item.getAuditStatus() == 0) {
item.setStatusName("已审核" + setPriceText);
return;
}
......
......@@ -69,9 +69,8 @@ public class AchievementDetailExcelListener {
event.setUrl(fileDO.getUrl());
event.setFileId(fileDO.getId());
} catch (Exception e) {
log.info("业绩明细导出失败",e);
e.printStackTrace();
event.setResult(e.getMessage());
log.error("业绩明细导出失败",e);
event.setResult(e + "");
}
}
}
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