|
|
@ -12,11 +12,13 @@ import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import net.sf.jsqlparser.expression.StringValue; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
@ -129,7 +131,19 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da |
|
|
|
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()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<DailyReportVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
@ -160,6 +174,20 @@ 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; |
|
|
|
dailyReportVo.setStock_total(stock_total); |
|
|
|
//根据库存总计/前三月的平均销售台数为存销比
|
|
|
|
String threeNum = baseMapper.select3(dailyReportVo.getBusOrgSid(),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()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<DailyReportVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
@ -186,6 +214,25 @@ 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 dailyReportVo = recordList.get(i); |
|
|
|
//根据库存小计和排产小计计算库存总计
|
|
|
|
int stock_subtotal = dailyReportVo.getStock_subtotal(); |
|
|
|
int pcOrder_subtotal = dailyReportVo.getPcOrder_subtotal(); |
|
|
|
int stock_total = stock_subtotal+pcOrder_subtotal; |
|
|
|
//根据库存总计/前三月的平均销售台数为存销比
|
|
|
|
String threeNum = baseMapper.select1(dailyReportVo.getDate()); |
|
|
|
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()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<DailyReportListVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
@ -193,6 +240,7 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da |
|
|
|
public PagerVo<DailyReportListVo> listPage2_1(PagerQuery<DailyReportQuery> pagerQuery) { |
|
|
|
DailyReportQuery query = pagerQuery.getParams(); |
|
|
|
QueryWrapper<DailyReport> qw = new QueryWrapper<>(); |
|
|
|
String busOrgSid = ""; |
|
|
|
if (query != null) { |
|
|
|
//生成日期开始时间
|
|
|
|
String createTimeStart = query.getStartTime(); |
|
|
@ -204,12 +252,31 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da |
|
|
|
//查询事业部
|
|
|
|
if (StringUtils.isNotBlank(query.getOrgPath())) { |
|
|
|
List<String> stringList = Arrays.asList(query.getOrgPath().split("/")); |
|
|
|
String sybOrgSid = query.getOrgPath().substring(37, 73); |
|
|
|
qw.eq("busOrgSid", sybOrgSid); |
|
|
|
busOrgSid = query.getOrgPath().substring(37, 73); |
|
|
|
qw.eq("busOrgSid", busOrgSid); |
|
|
|
} |
|
|
|
} |
|
|
|
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 dailyReportVo = recordList.get(i); |
|
|
|
//根据库存小计和排产小计计算库存总计
|
|
|
|
int stock_subtotal = dailyReportVo.getStock_subtotal(); |
|
|
|
int pcOrder_subtotal = dailyReportVo.getPcOrder_subtotal(); |
|
|
|
int stock_total = stock_subtotal+pcOrder_subtotal; |
|
|
|
//根据库存总计/前三月的平均销售台数为存销比
|
|
|
|
String threeNum = baseMapper.select2(dailyReportVo.getDate(),busOrgSid); |
|
|
|
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()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<DailyReportListVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|