Browse Source

统计参数存销比计算

master
dimengzhe 1 year ago
parent
commit
ece58603b6
  1. 68
      anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/dailyreport/DailyReportService.java

68
anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/dailyreport/DailyReportService.java

@ -344,23 +344,16 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da
dailyReportAppVo.setRow4(row4);*/
List<String> row4 = dailyReportVoList.stream().map(v -> {
String saleOfStockRatio = "";
try {
Field field = v.getClass().getDeclaredField(String.valueOf(v.getSaleAllToThree()));
field.setAccessible(true);
String saleAllToThree = (String) field.get(v);//前三个月销售台数之和
Field fieldStockTotal = v.getClass().getDeclaredField(String.valueOf(v.getStock_total()));
fieldStockTotal.setAccessible(true);
String stock_total = (String) fieldStockTotal.get(v);//库存总计
String saleAllToThree = String.valueOf(v.getSaleAllToThree());
String stock_total = String.valueOf(v.getStock_total());
if (StringUtils.isBlank(saleAllToThree)) {
saleOfStockRatio = stock_total + ":1";
} else {
if ("0".equals(saleAllToThree)) {
saleOfStockRatio = stock_total + ":1";
} else {
saleOfStockRatio = new BigDecimal(stock_total).divide((new BigDecimal(saleAllToThree).divide(new BigDecimal(3), 4, BigDecimal.ROUND_HALF_UP)), 2, BigDecimal.ROUND_HALF_UP).toString() + ":1";
}
return saleOfStockRatio;
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
return saleOfStockRatio;
}).collect(Collectors.toList());
@ -691,23 +684,16 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da
dailyReportAppVo.setRow4(row4);*/
List<String> row4 = dailyReportVoList.stream().map(v -> {
String saleOfStockRatio = "";
try {
Field field = v.getClass().getDeclaredField(String.valueOf(v.getSaleAllToThree()));
field.setAccessible(true);
String saleAllToThree = (String) field.get(v);//前三个月销售台数之和
Field fieldStockTotal = v.getClass().getDeclaredField(String.valueOf(v.getStock_total()));
fieldStockTotal.setAccessible(true);
String stock_total = (String) fieldStockTotal.get(v);//库存总计
String saleAllToThree = String.valueOf(v.getSaleAllToThree());
String stock_total = String.valueOf(v.getStock_total());
if (StringUtils.isBlank(saleAllToThree)) {
saleOfStockRatio = stock_total + ":1";
} else {
if ("0".equals(saleAllToThree)) {
saleOfStockRatio = stock_total + ":1";
} else {
saleOfStockRatio = new BigDecimal(stock_total).divide((new BigDecimal(saleAllToThree).divide(new BigDecimal(3), 4, BigDecimal.ROUND_HALF_UP)), 2, BigDecimal.ROUND_HALF_UP).toString() + ":1";
}
return saleOfStockRatio;
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
return saleOfStockRatio;
}).collect(Collectors.toList());
@ -985,23 +971,16 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da
dailyReportAppVo.setRow4(row4);*/
List<String> row4 = dailyReportVoList.stream().map(v -> {
String saleOfStockRatio = "";
try {
Field field = v.getClass().getDeclaredField(String.valueOf(v.getSaleAllToThree()));
field.setAccessible(true);
String saleAllToThree = (String) field.get(v);//前三个月销售台数之和
Field fieldStockTotal = v.getClass().getDeclaredField(String.valueOf(v.getStock_total()));
fieldStockTotal.setAccessible(true);
String stock_total = (String) fieldStockTotal.get(v);//库存总计
String saleAllToThree = String.valueOf(v.getSaleAllToThree());
String stock_total = String.valueOf(v.getStock_total());
if (StringUtils.isBlank(saleAllToThree)) {
saleOfStockRatio = stock_total + ":1";
} else {
if ("0".equals(saleAllToThree)) {
saleOfStockRatio = stock_total + ":1";
} else {
saleOfStockRatio = new BigDecimal(stock_total).divide((new BigDecimal(saleAllToThree).divide(new BigDecimal(3), 4, BigDecimal.ROUND_HALF_UP)), 2, BigDecimal.ROUND_HALF_UP).toString() + ":1";
}
return saleOfStockRatio;
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
return saleOfStockRatio;
}).collect(Collectors.toList());
@ -1305,23 +1284,16 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da
dailyReportAppVo.setRow4(row4);*/
List<String> row4 = dailyReportVoList.stream().map(v -> {
String saleOfStockRatio = "";
try {
Field field = v.getClass().getDeclaredField(String.valueOf(v.getSaleAllToThree()));
field.setAccessible(true);
String saleAllToThree = (String) field.get(v);//前三个月销售台数之和
Field fieldStockTotal = v.getClass().getDeclaredField(String.valueOf(v.getStock_total()));
fieldStockTotal.setAccessible(true);
String stock_total = (String) fieldStockTotal.get(v);//库存总计
String saleAllToThree = String.valueOf(v.getSaleAllToThree());
String stock_total = String.valueOf(v.getStock_total());
if (StringUtils.isBlank(saleAllToThree)) {
saleOfStockRatio = stock_total + ":1";
} else {
if ("0".equals(saleAllToThree)) {
saleOfStockRatio = stock_total + ":1";
} else {
saleOfStockRatio = new BigDecimal(stock_total).divide((new BigDecimal(saleAllToThree).divide(new BigDecimal(3), 4, BigDecimal.ROUND_HALF_UP)), 2, BigDecimal.ROUND_HALF_UP).toString() + ":1";
}
return saleOfStockRatio;
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
return saleOfStockRatio;
}).collect(Collectors.toList());

Loading…
Cancel
Save