|
|
@ -39,7 +39,7 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da |
|
|
|
private ReportSetService reportSetService; |
|
|
|
|
|
|
|
public PagerVo<DailyReportVo> listPage(PagerQuery<DailyReportQuery> pagerQuery) { |
|
|
|
DailyReportQuery query = pagerQuery.getParams(); |
|
|
|
/* DailyReportQuery query = pagerQuery.getParams(); |
|
|
|
QueryWrapper<DailyReport> qw = new QueryWrapper<>(); |
|
|
|
if (query != null) { |
|
|
|
String useOrgSid = query.getUseOrgSid(); |
|
|
@ -80,11 +80,59 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<DailyReportVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p;*/ |
|
|
|
DailyReportQuery query = pagerQuery.getParams(); |
|
|
|
QueryWrapper<DailyReport> qw = new QueryWrapper<>(); |
|
|
|
if (query != null) { |
|
|
|
String useOrgSid = query.getUseOrgSid(); |
|
|
|
qw.eq("dr.useOrgSid", useOrgSid); |
|
|
|
if (StringUtils.isNotBlank(query.getTodayDate())) { |
|
|
|
qw.like("dr.createTime", query.getTodayDate()); |
|
|
|
} |
|
|
|
qw.orderByDesc("dr.useOrgSid"); |
|
|
|
qw.orderByDesc("dr.brandSid"); |
|
|
|
qw.groupBy("dr.brandSid"); |
|
|
|
qw.orderByDesc("bm.fuelTypeValue"); |
|
|
|
qw.groupBy("bm.fuelTypeValue"); |
|
|
|
qw.orderByDesc("bm.emissionStandardValue"); |
|
|
|
qw.groupBy("bm.emissionStandardValue"); |
|
|
|
List<DailyParameterVo> parameterVoList = baseMapper.selectByParameters(useOrgSid); |
|
|
|
parameterVoList.removeAll(Collections.singleton(null)); |
|
|
|
for (int i = 0; i < parameterVoList.size(); i++) { |
|
|
|
DailyParameterVo dailyParameterVo = parameterVoList.get(i); |
|
|
|
String tableName = Arrays.asList(dailyParameterVo.getTableNameKey().split("\\.")).get(1); |
|
|
|
if ("base_model_config".equals(tableName)) { |
|
|
|
qw.orderByDesc("bmc." + dailyParameterVo.getColName()); |
|
|
|
qw.groupBy("bmc." + dailyParameterVo.getColName()); |
|
|
|
} else if ("base_vehicle_model".equals(tableName)) { |
|
|
|
qw.orderByDesc("bm." + dailyParameterVo.getColName()); |
|
|
|
qw.groupBy("bm." + dailyParameterVo.getColName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
IPage<DailyReport> page = PagerUtil.queryToPage(pagerQuery); |
|
|
|
IPage<DailyReportVo> pagging = baseMapper.listPage(page, qw); |
|
|
|
List<DailyReportVo> recordList = pagging.getRecords(); |
|
|
|
recordList.removeAll(Collections.singleton(null)); |
|
|
|
if (!recordList.isEmpty()) { |
|
|
|
for (int i = 0; i < recordList.size(); i++) { |
|
|
|
DailyReportVo dailyReportVo = recordList.get(i); |
|
|
|
String ratio = ""; |
|
|
|
if (dailyReportVo.getSaleAllToThree() == 0) { |
|
|
|
ratio = dailyReportVo.getStock_subtotal() + ":1"; |
|
|
|
} else { |
|
|
|
ratio = new BigDecimal(dailyReportVo.getStock_total()).divide((new BigDecimal(dailyReportVo.getSaleAllToThree()).divide(new BigDecimal(3), 4, RoundingMode.HALF_UP)), 0, RoundingMode.HALF_UP).toString() + ":1"; |
|
|
|
} |
|
|
|
dailyReportVo.setSaleOfStockRatio(ratio); |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<DailyReportVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<DailyReportVo> listPage2(PagerQuery<DailyReportQuery> pagerQuery) { |
|
|
|
DailyReportQuery query = pagerQuery.getParams(); |
|
|
|
/*DailyReportQuery query = pagerQuery.getParams(); |
|
|
|
QueryWrapper<DailyReport> qw = new QueryWrapper<>(); |
|
|
|
if (query != null) { |
|
|
|
//查询事业部
|
|
|
@ -132,6 +180,65 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<DailyReportVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p;*/ |
|
|
|
DailyReportQuery query = pagerQuery.getParams(); |
|
|
|
QueryWrapper<DailyReport> qw = new QueryWrapper<>(); |
|
|
|
if (query != null) { |
|
|
|
//查询事业部
|
|
|
|
if (StringUtils.isNotBlank(query.getOrgPath())) { |
|
|
|
List<String> stringList = Arrays.asList(query.getOrgPath().split("/")); |
|
|
|
String sybOrgSid = query.getOrgPath().substring(37, 73); |
|
|
|
qw.eq("dr.busOrgSid", sybOrgSid); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getTodayDate())) { |
|
|
|
qw.like("dr.createTime", query.getTodayDate()); |
|
|
|
} |
|
|
|
|
|
|
|
qw.orderByDesc("dr.useOrgSid"); |
|
|
|
qw.groupBy("dr.useOrgSid"); |
|
|
|
qw.orderByDesc("dr.brandSid"); |
|
|
|
qw.groupBy("dr.brandSid"); |
|
|
|
qw.orderByDesc("bm.fuelTypeValue"); |
|
|
|
qw.groupBy("bm.fuelTypeValue"); |
|
|
|
qw.orderByDesc("bm.emissionStandardValue"); |
|
|
|
qw.groupBy("bm.emissionStandardValue"); |
|
|
|
} |
|
|
|
IPage<DailyReport> page = PagerUtil.queryToPage(pagerQuery); |
|
|
|
IPage<DailyReportVo> pagging = baseMapper.listPage(page, qw); |
|
|
|
List<DailyReportVo> recordList = pagging.getRecords(); |
|
|
|
recordList.removeAll(Collections.singleton(null)); |
|
|
|
if (!recordList.isEmpty()) { |
|
|
|
for (int i = 0; i < recordList.size(); i++) { |
|
|
|
DailyReportVo dailyReportVo = recordList.get(i); |
|
|
|
/*String modelSid = dailyReportVo.getVehModelSid(); |
|
|
|
String configSid = dailyReportVo.getVehMConfigSid(); |
|
|
|
BaseVehicleModel baseVehicleModel = baseMapper.selectModel(modelSid); |
|
|
|
BaseModelConfig baseModelConfig = baseMapper.selectConfig(configSid); |
|
|
|
BeanUtil.copyProperties(baseModelConfig, dailyReportVo, "useOrgName"); |
|
|
|
BeanUtil.copyProperties(baseVehicleModel, dailyReportVo, "useOrgName");*/ |
|
|
|
//根据库存小计和排产小计计算库存总计
|
|
|
|
/*int stock_subtotal = dailyReportVo.getStock_subtotal(); |
|
|
|
int pcOrder_subtotal = dailyReportVo.getPcOrder_subtotal(); |
|
|
|
int stock_total = stock_subtotal + pcOrder_subtotal; |
|
|
|
dailyReportVo.setStock_total(stock_total); |
|
|
|
//根据库存总计/前三月的平均销售台数为存销比
|
|
|
|
String threeNum = baseMapper.select(dailyReportVo.getUseOrgSid(), dailyReportVo.getBrandSid(), dailyReportVo.getVehModelSid(), dailyReportVo.getVehMConfigSid(), dailyReportVo.getCreateTime()); |
|
|
|
if ("0".equals(threeNum)) { |
|
|
|
dailyReportVo.setSaleOfStockRatio(String.valueOf(stock_total)); |
|
|
|
} else { |
|
|
|
BigDecimal big = new BigDecimal(stock_total).divide(new BigDecimal(threeNum).divide(new BigDecimal(3), 2, BigDecimal.ROUND_CEILING), 2, BigDecimal.ROUND_CEILING); |
|
|
|
dailyReportVo.setSaleOfStockRatio(big.toString()); |
|
|
|
}*/ |
|
|
|
String ratio = ""; |
|
|
|
if (dailyReportVo.getSaleAllToThree() == 0) { |
|
|
|
ratio = dailyReportVo.getStock_subtotal() + ":1"; |
|
|
|
} else { |
|
|
|
ratio = new BigDecimal(dailyReportVo.getStock_total()).divide((new BigDecimal(dailyReportVo.getSaleAllToThree()).divide(new BigDecimal(3), 4, RoundingMode.HALF_UP)), 0, RoundingMode.HALF_UP).toString() + ":1"; |
|
|
|
} |
|
|
|
dailyReportVo.setSaleOfStockRatio(ratio); |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<DailyReportVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
@ -159,7 +266,7 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da |
|
|
|
String busUseOrg = dailyReportVo.getBusOrgSid(); |
|
|
|
String prefix = "fd6435f2-0005-11ec-a033-48452053aa33/"; |
|
|
|
dailyReportVo.setOrgPath(prefix + busUseOrg); |
|
|
|
//根据库存小计和排产小计计算库存总计
|
|
|
|
/*//根据库存小计和排产小计计算库存总计
|
|
|
|
int stock_subtotal = dailyReportVo.getStock_subtotal(); |
|
|
|
int pcOrder_subtotal = dailyReportVo.getPcOrder_subtotal(); |
|
|
|
int stock_total = stock_subtotal + pcOrder_subtotal; |
|
|
@ -171,7 +278,14 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da |
|
|
|
} else { |
|
|
|
BigDecimal big = new BigDecimal(stock_total).divide(new BigDecimal(threeNum).divide(new BigDecimal(3), 2, BigDecimal.ROUND_CEILING), 2, BigDecimal.ROUND_CEILING); |
|
|
|
dailyReportVo.setSaleOfStockRatio(big.toString()); |
|
|
|
}*/ |
|
|
|
String ratio = ""; |
|
|
|
if (dailyReportVo.getSaleAllToThree() == 0) { |
|
|
|
ratio = dailyReportVo.getStock_subtotal() + ":1"; |
|
|
|
} else { |
|
|
|
ratio = new BigDecimal(dailyReportVo.getStock_total()).divide((new BigDecimal(dailyReportVo.getSaleAllToThree()).divide(new BigDecimal(3), 4, RoundingMode.HALF_UP)), 0, RoundingMode.HALF_UP).toString() + ":1"; |
|
|
|
} |
|
|
|
dailyReportVo.setSaleOfStockRatio(ratio); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -259,7 +373,7 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da |
|
|
|
recordList.removeAll(Collections.singleton(null)); |
|
|
|
if (!recordList.isEmpty()) { |
|
|
|
for (int i = 0; i < recordList.size(); i++) { |
|
|
|
DailyReportListVo dailyReportVo = recordList.get(i); |
|
|
|
/*DailyReportListVo dailyReportVo = recordList.get(i); |
|
|
|
//根据库存小计和排产小计计算库存总计
|
|
|
|
int stock_subtotal = dailyReportVo.getStock_subtotal(); |
|
|
|
int pcOrder_subtotal = dailyReportVo.getPcOrder_subtotal(); |
|
|
@ -271,8 +385,20 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da |
|
|
|
} else { |
|
|
|
BigDecimal big = new BigDecimal(stock_total).divide(new BigDecimal(threeNum).divide(new BigDecimal(3), 2, BigDecimal.ROUND_CEILING), 2, BigDecimal.ROUND_CEILING); |
|
|
|
dailyReportVo.setSaleOfStockRatio(big.toString()); |
|
|
|
}*/ |
|
|
|
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_total()).divide((new BigDecimal(dailyReportListVo.getSaleAllToThree()).divide(new BigDecimal(3), 4, RoundingMode.HALF_UP)), 0, RoundingMode.HALF_UP).toString() + ":1"; |
|
|
|
} |
|
|
|
} |
|
|
|
dailyReportListVo.setSaleOfStockRatio(ratio); |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<DailyReportListVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
@ -294,6 +420,24 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da |
|
|
|
} |
|
|
|
IPage<DailyReport> page = PagerUtil.queryToPage(pagerQuery); |
|
|
|
IPage<DailyReportListVo> pagging = baseMapper.listPage3_1(page, qw); |
|
|
|
List<DailyReportListVo> recordList = pagging.getRecords(); |
|
|
|
recordList.removeAll(Collections.singleton(null)); |
|
|
|
if (!recordList.isEmpty()) { |
|
|
|
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_total()).divide((new BigDecimal(dailyReportListVo.getSaleAllToThree()).divide(new BigDecimal(3), 4, RoundingMode.HALF_UP)), 0, RoundingMode.HALF_UP).toString() + ":1"; |
|
|
|
} |
|
|
|
} |
|
|
|
dailyReportListVo.setSaleOfStockRatio(ratio); |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<DailyReportListVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
@ -623,20 +767,20 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<ReportVo> getReport(String date, String userSid,String orgPath,String type) { |
|
|
|
public ResultBean<ReportVo> getReport(String date, String userSid, String orgPath, String type) { |
|
|
|
ResultBean<ReportVo> rb = ResultBean.fireFail(); |
|
|
|
QueryWrapper<DailyReport> qw = new QueryWrapper<>(); |
|
|
|
if (StringUtils.isNotBlank(date)) { |
|
|
|
qw.like("createTime", date); |
|
|
|
} |
|
|
|
if(StringUtils.isNotBlank(type)){//事业部或分公司
|
|
|
|
if("syb".equals(type)){ |
|
|
|
if (StringUtils.isNotBlank(type)) {//事业部或分公司
|
|
|
|
if ("syb".equals(type)) { |
|
|
|
if (StringUtils.isNotBlank(orgPath)) { |
|
|
|
List<String> stringList = Arrays.asList(orgPath.split("/")); |
|
|
|
String busOrgSid = orgPath.substring(37, 73); |
|
|
|
qw.eq("busOrgSid", busOrgSid); |
|
|
|
} |
|
|
|
}else if("fgs".equals(type)){ |
|
|
|
} else if ("fgs".equals(type)) { |
|
|
|
if (StringUtils.isNotBlank(orgPath)) { |
|
|
|
String useOrgSid = sysStaffOrgFeign.getOrgSidByPath(orgPath).getData(); |
|
|
|
qw.eq("useOrgSid", useOrgSid); |
|
|
|