Browse Source

报表中心

master
dimengzhe 1 year ago
parent
commit
eb88a74bd6
  1. 14
      anrui-reportcenter/anrui-reportcenter-api/src/main/java/com/yxt/anrui/reportcenter/api/dailyreport/DailyReportListVo.java
  2. 8
      anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/dailyreport/DailyReportMapper.java
  3. 38
      anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/dailyreport/DailyReportMapper.xml
  4. 73
      anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/dailyreport/DailyReportService.java

14
anrui-reportcenter/anrui-reportcenter-api/src/main/java/com/yxt/anrui/reportcenter/api/dailyreport/DailyReportListVo.java

@ -18,19 +18,19 @@ public class DailyReportListVo {
private String saleOfStockRatio;
//库存小计
@ApiModelProperty("库存小计")
private String stock_subtotal;
private int stock_subtotal;
@ApiModelProperty("排产小计")
private String pcOrder_subtotal;
private int pcOrder_subtotal;
@ApiModelProperty("本日销售订单")
private String saleOrder_subtotal_day;
private int saleOrder_subtotal_day;
@ApiModelProperty("本日销售")
private String sale_subtotal_day;
private int sale_subtotal_day;
@ApiModelProperty("欠款出库金额")
private String arrears_carry_veh_amount;
private int arrears_carry_veh_amount;
@ApiModelProperty("金融未放款金额")
private String loan_not_amount;
private int loan_not_amount;
@ApiModelProperty("本日买断")
private String buyout_day;
private int buyout_day;
private String useOrgSid;
}

8
anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/dailyreport/DailyReportMapper.java

@ -33,4 +33,12 @@ public interface DailyReportMapper extends BaseMapper<DailyReport> {
BaseModelConfig selectConfig(String configSid);
IPage<DailyReportListVo> listPage3_1(IPage<DailyReport> page, @Param(Constants.WRAPPER)QueryWrapper<DailyReport> qw);
String select(@Param("useOrgSid") String useOrgSid, @Param("brandSid") String brandSid, @Param("vehModelSid") String vehModelSid, @Param("vehMConfigSid") String vehMConfigSid, @Param("createTime") String createTime);
String select1(String date);
String select2(@Param("date") String date, @Param("busOrgSid") String busOrgSid);
String select3(@Param("busOrgSid") String busOrgSid, @Param("brandSid") String brandSid, @Param("vehModelSid") String vehModelSid, @Param("vehMConfigSid") String vehMConfigSid, @Param("createTime") String createTime);
}

38
anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/dailyreport/DailyReportMapper.xml

@ -59,4 +59,42 @@
</where>
group by DATE_FORMAT(createTime, '%Y-%m-%d')
</select>
<select id="select" resultType="java.lang.String">
select ifnull(sum(dr.sale_subtotal_month),0) from daily_report dr
where dr.vehMConfigSid = #{vehMConfigSid}
and dr.vehModelSid = #{vehMConfigSid}
and dr.brandSid = #{brandSid}
and dr.useOrgSid = #{useOrgSid}
and (DATE_FORMAT( createTime, '%Y-%m' ) LIKE DATE_FORMAT( DATE_SUB( #{createTime}, INTERVAL 1 MONTH ), '%Y-%m' )
OR DATE_FORMAT( createTime, '%Y-%m' ) LIKE DATE_FORMAT( DATE_SUB( #{createTime}, INTERVAL 2 MONTH ), '%Y-%m' )
OR DATE_FORMAT( createTime, '%Y-%m' ) LIKE DATE_FORMAT( DATE_SUB(#{createTime}, INTERVAL 3 MONTH ), '%Y-%m' ))
</select>
<select id="select1" resultType="java.lang.String">
select ifnull(sum(dr.sale_subtotal_month),0) from daily_report dr
where
(DATE_FORMAT( createTime, '%Y-%m' ) LIKE DATE_FORMAT( DATE_SUB( #{date}, INTERVAL 1 MONTH ), '%Y-%m' )
OR DATE_FORMAT( createTime, '%Y-%m' ) LIKE DATE_FORMAT( DATE_SUB( #{date}, INTERVAL 2 MONTH ), '%Y-%m' )
OR DATE_FORMAT( createTime, '%Y-%m' ) LIKE DATE_FORMAT( DATE_SUB(#{date}, INTERVAL 3 MONTH ), '%Y-%m' ))
</select>
<select id="select2" resultType="java.lang.String">
select ifnull(sum(dr.sale_subtotal_month),0) from daily_report dr
where busOrgSid = #{busOrgSid} and
(DATE_FORMAT( createTime, '%Y-%m' ) LIKE DATE_FORMAT( DATE_SUB( #{date}, INTERVAL 1 MONTH ), '%Y-%m' )
OR DATE_FORMAT( createTime, '%Y-%m' ) LIKE DATE_FORMAT( DATE_SUB( #{date}, INTERVAL 2 MONTH ), '%Y-%m' )
OR DATE_FORMAT( createTime, '%Y-%m' ) LIKE DATE_FORMAT( DATE_SUB(#{date}, INTERVAL 3 MONTH ), '%Y-%m' ))
</select>
<select id="select3" resultType="java.lang.String">
select ifnull(sum(dr.sale_subtotal_month),0) from daily_report dr
where dr.vehMConfigSid = #{vehMConfigSid}
and dr.vehModelSid = #{vehMConfigSid}
and dr.brandSid = #{brandSid}
and dr.busOrgSid = #{busOrgSid}
and (DATE_FORMAT( createTime, '%Y-%m' ) LIKE DATE_FORMAT( DATE_SUB( #{createTime}, INTERVAL 1 MONTH ), '%Y-%m' )
OR DATE_FORMAT( createTime, '%Y-%m' ) LIKE DATE_FORMAT( DATE_SUB( #{createTime}, INTERVAL 2 MONTH ), '%Y-%m' )
OR DATE_FORMAT( createTime, '%Y-%m' ) LIKE DATE_FORMAT( DATE_SUB(#{createTime}, INTERVAL 3 MONTH ), '%Y-%m' ))
</select>
</mapper>

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

@ -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;
}

Loading…
Cancel
Save