Browse Source

统计参数存销比计算

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

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

@ -344,33 +344,26 @@ 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);//库存总计
if(StringUtils.isBlank(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";
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());
int saleAllToThreeAll = dailyReportVoList.stream().mapToInt(v->v.getSaleAllToThree()).sum();
int stock_totalAll = dailyReportVoList.stream().mapToInt(v->v.getStock_total()).sum();
int saleAllToThreeAll = dailyReportVoList.stream().mapToInt(v -> v.getSaleAllToThree()).sum();
int stock_totalAll = dailyReportVoList.stream().mapToInt(v -> v.getStock_total()).sum();
String saleOfStockRatioString = "";
if(saleAllToThreeAll == 0){
saleOfStockRatioString = stock_totalAll+":1";
}else{
saleOfStockRatioString = new BigDecimal(stock_totalAll).divide((new BigDecimal(saleAllToThreeAll).divide(new BigDecimal(3),4,BigDecimal.ROUND_HALF_UP)),2,BigDecimal.ROUND_HALF_UP).toString()+":1";
if (saleAllToThreeAll == 0) {
saleOfStockRatioString = stock_totalAll + ":1";
} else {
saleOfStockRatioString = new BigDecimal(stock_totalAll).divide((new BigDecimal(saleAllToThreeAll).divide(new BigDecimal(3), 4, BigDecimal.ROUND_HALF_UP)), 2, BigDecimal.ROUND_HALF_UP).toString() + ":1";
}
row4.add(saleOfStockRatioString);
dailyReportAppVo.setRow4(row4);
@ -617,13 +610,13 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da
for (int i = 0; i < recordList.size(); i++) {
DailyReportListVo dailyReportListVo = recordList.get(i);
String ratio = "";
if(StringUtils.isBlank(dailyReportListVo.getSaleAllToThree())){
ratio = dailyReportListVo.getStock_subtotal()+":1";
}else{
if("0".equals(dailyReportListVo.getSaleAllToThree())){
ratio = dailyReportListVo.getStock_subtotal()+":1";
}else{
ratio = new BigDecimal(dailyReportListVo.getStock_subtotal()).divide((new BigDecimal(dailyReportListVo.getSaleAllToThree()).divide(new BigDecimal(3),4,BigDecimal.ROUND_HALF_UP)),2,BigDecimal.ROUND_HALF_UP).toString()+":1";
if (StringUtils.isBlank(dailyReportListVo.getSaleAllToThree())) {
ratio = dailyReportListVo.getStock_subtotal() + ":1";
} else {
if ("0".equals(dailyReportListVo.getSaleAllToThree())) {
ratio = dailyReportListVo.getStock_subtotal() + ":1";
} else {
ratio = new BigDecimal(dailyReportListVo.getStock_subtotal()).divide((new BigDecimal(dailyReportListVo.getSaleAllToThree()).divide(new BigDecimal(3), 4, BigDecimal.ROUND_HALF_UP)), 2, BigDecimal.ROUND_HALF_UP).toString() + ":1";
}
}
dailyReportListVo.setSaleOfStockRatio(ratio);
@ -642,13 +635,13 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da
}
ReportVo reportVo = baseMapper.getReport(qw);
String ratio = "";
if(StringUtils.isBlank(reportVo.getSaleAllToThree())){
ratio = reportVo.getStock_subtotal()+":1";
}else{
if("0".equals(reportVo.getSaleAllToThree())){
ratio = reportVo.getStock_subtotal()+":1";
}else{
ratio = new BigDecimal(reportVo.getStock_subtotal()).divide((new BigDecimal(reportVo.getSaleAllToThree()).divide(new BigDecimal(3),4,BigDecimal.ROUND_HALF_UP)),2,BigDecimal.ROUND_HALF_UP).toString()+":1";
if (StringUtils.isBlank(reportVo.getSaleAllToThree())) {
ratio = reportVo.getStock_subtotal() + ":1";
} else {
if ("0".equals(reportVo.getSaleAllToThree())) {
ratio = reportVo.getStock_subtotal() + ":1";
} else {
ratio = new BigDecimal(reportVo.getStock_subtotal()).divide((new BigDecimal(reportVo.getSaleAllToThree()).divide(new BigDecimal(3), 4, BigDecimal.ROUND_HALF_UP)), 2, BigDecimal.ROUND_HALF_UP).toString() + ":1";
}
}
reportVo.setSaleOfStockRatio(ratio);
@ -691,33 +684,26 @@ 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);//库存总计
if(StringUtils.isBlank(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";
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());
int saleAllToThreeAll = dailyReportVoList.stream().mapToInt(v->v.getSaleAllToThree()).sum();
int stock_totalAll = dailyReportVoList.stream().mapToInt(v->v.getStock_total()).sum();
int saleAllToThreeAll = dailyReportVoList.stream().mapToInt(v -> v.getSaleAllToThree()).sum();
int stock_totalAll = dailyReportVoList.stream().mapToInt(v -> v.getStock_total()).sum();
String saleOfStockRatioString = "";
if(saleAllToThreeAll == 0){
saleOfStockRatioString = stock_totalAll+":1";
}else{
saleOfStockRatioString = new BigDecimal(stock_totalAll).divide((new BigDecimal(saleAllToThreeAll).divide(new BigDecimal(3),4,BigDecimal.ROUND_HALF_UP)),2,BigDecimal.ROUND_HALF_UP).toString()+":1";
if (saleAllToThreeAll == 0) {
saleOfStockRatioString = stock_totalAll + ":1";
} else {
saleOfStockRatioString = new BigDecimal(stock_totalAll).divide((new BigDecimal(saleAllToThreeAll).divide(new BigDecimal(3), 4, BigDecimal.ROUND_HALF_UP)), 2, BigDecimal.ROUND_HALF_UP).toString() + ":1";
}
row4.add(saleOfStockRatioString);
dailyReportAppVo.setRow4(row4);
@ -985,33 +971,26 @@ 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);//库存总计
if(StringUtils.isBlank(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";
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());
int saleAllToThreeAll = dailyReportVoList.stream().mapToInt(v->v.getSaleAllToThree()).sum();
int stock_totalAll = dailyReportVoList.stream().mapToInt(v->v.getStock_total()).sum();
int saleAllToThreeAll = dailyReportVoList.stream().mapToInt(v -> v.getSaleAllToThree()).sum();
int stock_totalAll = dailyReportVoList.stream().mapToInt(v -> v.getStock_total()).sum();
String saleOfStockRatioString = "";
if(saleAllToThreeAll == 0){
saleOfStockRatioString = stock_totalAll+":1";
}else{
saleOfStockRatioString = new BigDecimal(stock_totalAll).divide((new BigDecimal(saleAllToThreeAll).divide(new BigDecimal(3),4,BigDecimal.ROUND_HALF_UP)),2,BigDecimal.ROUND_HALF_UP).toString()+":1";
if (saleAllToThreeAll == 0) {
saleOfStockRatioString = stock_totalAll + ":1";
} else {
saleOfStockRatioString = new BigDecimal(stock_totalAll).divide((new BigDecimal(saleAllToThreeAll).divide(new BigDecimal(3), 4, BigDecimal.ROUND_HALF_UP)), 2, BigDecimal.ROUND_HALF_UP).toString() + ":1";
}
row4.add(saleOfStockRatioString);
dailyReportAppVo.setRow4(row4);
@ -1305,33 +1284,26 @@ 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);//库存总计
if(StringUtils.isBlank(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";
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());
int saleAllToThreeAll = dailyReportVoList.stream().mapToInt(v->v.getSaleAllToThree()).sum();
int stock_totalAll = dailyReportVoList.stream().mapToInt(v->v.getStock_total()).sum();
int saleAllToThreeAll = dailyReportVoList.stream().mapToInt(v -> v.getSaleAllToThree()).sum();
int stock_totalAll = dailyReportVoList.stream().mapToInt(v -> v.getStock_total()).sum();
String saleOfStockRatioString = "";
if(saleAllToThreeAll == 0){
saleOfStockRatioString = stock_totalAll+":1";
}else{
saleOfStockRatioString = new BigDecimal(stock_totalAll).divide((new BigDecimal(saleAllToThreeAll).divide(new BigDecimal(3),4,BigDecimal.ROUND_HALF_UP)),2,BigDecimal.ROUND_HALF_UP).toString()+":1";
if (saleAllToThreeAll == 0) {
saleOfStockRatioString = stock_totalAll + ":1";
} else {
saleOfStockRatioString = new BigDecimal(stock_totalAll).divide((new BigDecimal(saleAllToThreeAll).divide(new BigDecimal(3), 4, BigDecimal.ROUND_HALF_UP)), 2, BigDecimal.ROUND_HALF_UP).toString() + ":1";
}
row4.add(saleOfStockRatioString);
dailyReportAppVo.setRow4(row4);

Loading…
Cancel
Save