Browse Source

移动端事业部统计报表和分公司统计报表

master
dimengzhe 1 year ago
parent
commit
ce6e101fb0
  1. 2
      anrui-reportcenter/anrui-reportcenter-api/src/main/java/com/yxt/anrui/reportcenter/api/dailyreport/DailyReportAppPagerQuery.java
  2. 23
      anrui-reportcenter/anrui-reportcenter-api/src/main/java/com/yxt/anrui/reportcenter/api/dailyreport/DailyReportFeign.java
  3. 2
      anrui-reportcenter/anrui-reportcenter-api/src/main/java/com/yxt/anrui/reportcenter/api/dailyreport/DailyReportListVo.java
  4. 4
      anrui-reportcenter/anrui-reportcenter-api/src/main/java/com/yxt/anrui/reportcenter/api/dailyreport/ReportVo.java
  5. 1
      anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/dailyreport/DailyReportMapper.java
  6. 27
      anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/dailyreport/DailyReportMapper.xml
  7. 34
      anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/dailyreport/DailyReportRest.java
  8. 125
      anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/dailyreport/DailyReportService.java

2
anrui-reportcenter/anrui-reportcenter-api/src/main/java/com/yxt/anrui/reportcenter/api/dailyreport/DailyReportAppPagerQuery.java

@ -11,4 +11,6 @@ import lombok.Data;
@Data
public class DailyReportAppPagerQuery implements Query {
private static final long serialVersionUID = 1122320253221250027L;
private String orgPath;
}

23
anrui-reportcenter/anrui-reportcenter-api/src/main/java/com/yxt/anrui/reportcenter/api/dailyreport/DailyReportFeign.java

@ -74,6 +74,8 @@ public interface DailyReportFeign {
@ResponseBody
ResultBean<PagerVo<DailyReportListVo>> listPage_1(@RequestBody PagerQuery<DailyReportQuery> pagerQuery);
//--------------------------移动端------------------------------------->
@ApiOperation("事业部明细日报表")
@GetMapping("list1")
@ResponseBody
@ -82,7 +84,7 @@ public interface DailyReportFeign {
@ApiOperation("移动端集团列表")
@PostMapping("pageList1")
@ResponseBody
ResultBean<PagerVo<DailyReportAppPagerVo>> pageList1(@RequestBody PagerQuery<DailyReportAppPagerQuery> pagerQuery);
ResultBean<PagerVo<DailyReportListVo>> pageList1(@RequestBody PagerQuery<DailyReportAppPagerQuery> pagerQuery);
@ApiOperation("集团日期初始化")
@GetMapping("getReport")
@ -104,4 +106,23 @@ public interface DailyReportFeign {
@ResponseBody
ResultBean<DailyReportAppVo> list4(@RequestParam("date") String date, @RequestParam("useOrgSid") String useOrgSid);
@ApiOperation("事业部分页列表")
@PostMapping("pageList2")
@ResponseBody
ResultBean<DailyReportListVo> pageList2(@RequestBody PagerQuery<DailyReportAppPagerQuery> pagerQuery);
@ApiOperation("事业部日期初始化")
@GetMapping("getReport2")
@ResponseBody
ResultBean<ReportVo> getReport2(@RequestParam("date") String date, @RequestParam("orgPath") String orgPath);
@ApiOperation("分公司日报表分页列表")
@PostMapping("pageList3")
@ResponseBody
ResultBean<DailyReportListVo> pageList3(@RequestBody PagerQuery<DailyReportAppPagerQuery> pagerQuery);
@ApiOperation("分公司日期初始化")
@GetMapping("getReport3")
@ResponseBody
ResultBean<ReportVo> getReport3(@RequestParam("date") String date, @RequestParam("orgPath") String orgPath);
}

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

@ -37,4 +37,6 @@ public class DailyReportListVo {
private String saleAllToThree;
private String stock_total;
private String busOrgSid;
}

4
anrui-reportcenter/anrui-reportcenter-api/src/main/java/com/yxt/anrui/reportcenter/api/dailyreport/ReportVo.java

@ -109,4 +109,8 @@ public class ReportVo implements Vo {
private String loan_not_amount;
@ApiModelProperty("前三个月销售台数之和")
private String saleAllToThree;
private String busOrgSid;
private String useOrgSid;
}

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

@ -45,6 +45,7 @@ public interface DailyReportMapper extends BaseMapper<DailyReport> {
List<DailyReportVo> selectReport(@Param("join") List<String> brandList, @Param("sybOrgSid") String sybOrgSid, @Param("queryTime") String queryTime);
IPage<DailyReportListVo> pageList1(IPage<DailyReport> page, @Param(Constants.WRAPPER) QueryWrapper<DailyReport> qw);
IPage<DailyReportListVo> pageList2(IPage<DailyReport> page, @Param(Constants.WRAPPER) QueryWrapper<DailyReport> qw);
ReportVo getReport(@Param(Constants.WRAPPER) QueryWrapper<DailyReport> qw);

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

@ -212,7 +212,7 @@
sum(loan_not_amount) as loan_not_amount,
sum(buyout_day) as buyout_day,
sum(saleAllToThree) as saleAllToThree,
SUM(stock_total) as stock_total,
SUM(stock_total) as stock_total,
useOrgSid
from daily_report
<where>
@ -222,6 +222,28 @@
order by DATE_FORMAT(createTime, '%Y-%m-%d') desc
</select>
<select id="pageList2" resultType="com.yxt.anrui.reportcenter.api.dailyreport.DailyReportListVo">
select DATE_FORMAT(createTime, '%Y-%m-%d') as date,
sum(saleOfStockRatio) as saleOfStockRatio,
sum(stock_subtotal) as stock_subtotal,
sum(pcOrder_subtotal) as pcOrder_subtotal,
sum(saleOrder_subtotal_day) as saleOrder_subtotal_day,
sum(sale_subtotal_day) as sale_subtotal_day,
sum(arrears_carry_veh_amount) as arrears_carry_veh_amount,
sum(loan_not_amount) as loan_not_amount,
sum(buyout_day) as buyout_day,
sum(saleAllToThree) as saleAllToThree,
SUM(stock_total) as stock_total,
useOrgSid,
busOrgSid
from daily_report
<where>
${ew.sqlSegment}
</where>
group by DATE_FORMAT(createTime, '%Y-%m-%d')
order by DATE_FORMAT(createTime, '%Y-%m-%d') desc
</select>
<select id="getReport" resultType="com.yxt.anrui.reportcenter.api.dailyreport.ReportVo">
select DATE_FORMAT(createTime, '%Y-%m-%d') as date,
<!--ifnull(sum(SUBSTRING_INDEX(saleOfStockRatio, ':', 1) / SUBSTRING_INDEX(saleOfStockRatio, ':', -1)),
@ -274,7 +296,8 @@
ifnull(sum(arrears_carry_veh_amount), 0) as arrears_carry_veh_amount,
ifnull(sum(loan_not_count), 0) as loan_not_count,
ifnull(sum(loan_not_amount), 0) as loan_not_amount,
ifnull(sum(saleAllToThree), 0) as saleAllToThree
ifnull(sum(saleAllToThree), 0) as saleAllToThree,
busOrgSid,useOrgSid
from daily_report
<where>
${ew.sqlSegment}

34
anrui-reportcenter/anrui-reportcenter-biz/src/main/java/com/yxt/anrui/reportcenter/biz/dailyreport/DailyReportRest.java

@ -74,13 +74,13 @@ public class DailyReportRest implements DailyReportFeign {
@Override
public ResultBean<DailyReportAppVo> list1(String date, String busOrgSid) {
return dailyReportService.list1(date,busOrgSid);
return dailyReportService.list1(date, busOrgSid);
}
@Override
public ResultBean<PagerVo<DailyReportAppPagerVo>> pageList1(PagerQuery<DailyReportAppPagerQuery> pagerQuery) {
public ResultBean<PagerVo<DailyReportListVo>> pageList1(PagerQuery<DailyReportAppPagerQuery> pagerQuery) {
ResultBean rb = ResultBean.fireFail();
PagerVo<DailyReportAppPagerVo> pv = dailyReportService.pageList1(pagerQuery);
PagerVo<DailyReportListVo> pv = dailyReportService.pageList1(pagerQuery);
return rb.success().setData(pv);
}
@ -96,11 +96,35 @@ public class DailyReportRest implements DailyReportFeign {
@Override
public ResultBean<DailyReportAppVo> list3(String date, String busOrgSid) {
return dailyReportService.list3(date,busOrgSid);
return dailyReportService.list3(date, busOrgSid);
}
@Override
public ResultBean<DailyReportAppVo> list4(String date, String useOrgSid) {
return dailyReportService.list4(date,useOrgSid);
return dailyReportService.list4(date, useOrgSid);
}
@Override
public ResultBean<DailyReportListVo> pageList2(PagerQuery<DailyReportAppPagerQuery> pagerQuery) {
ResultBean rb = ResultBean.fireFail();
PagerVo<DailyReportListVo> pv = dailyReportService.pageList2(pagerQuery);
return rb.success().setData(pv);
}
@Override
public ResultBean<ReportVo> getReport2(String date, String orgPath) {
return dailyReportService.getReport2(date,orgPath);
}
@Override
public ResultBean<DailyReportListVo> pageList3(PagerQuery<DailyReportAppPagerQuery> pagerQuery) {
ResultBean rb = ResultBean.fireFail();
PagerVo<DailyReportListVo> pv = dailyReportService.pageList3(pagerQuery);
return rb.success().setData(pv);
}
@Override
public ResultBean<ReportVo> getReport3(String date, String orgPath) {
return dailyReportService.getReport3(date,orgPath);
}
}

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

@ -596,7 +596,7 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da
return rb.success().setData(dailyReportAppVo);
}
public PagerVo<DailyReportAppPagerVo> pageList1(PagerQuery<DailyReportAppPagerQuery> pagerQuery) {
public PagerVo<DailyReportListVo> pageList1(PagerQuery<DailyReportAppPagerQuery> pagerQuery) {
DailyReportAppPagerQuery query = pagerQuery.getParams();
QueryWrapper<DailyReport> qw = new QueryWrapper<>();
if (query != null) {
@ -622,7 +622,7 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da
dailyReportListVo.setSaleOfStockRatio(ratio);
}
}
PagerVo<DailyReportAppPagerVo> p = PagerUtil.pageToVo(pagging, null);
PagerVo<DailyReportListVo> p = PagerUtil.pageToVo(pagging, null);
return p;
}
@ -1747,4 +1747,125 @@ public class DailyReportService extends MybatisBaseService<DailyReportMapper, Da
return findGCD(b % a, a);
}
public PagerVo<DailyReportListVo> pageList2(PagerQuery<DailyReportAppPagerQuery> pagerQuery) {
DailyReportAppPagerQuery 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 busOrgSid = query.getOrgPath().substring(37, 73);
qw.eq("busOrgSid", busOrgSid);
}
}
IPage<DailyReport> page = PagerUtil.queryToPage(pagerQuery);
IPage<DailyReportListVo> pagging = baseMapper.pageList2(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, BigDecimal.ROUND_HALF_UP)), 0, BigDecimal.ROUND_HALF_UP).toString() + ":1";
}
}
dailyReportListVo.setSaleOfStockRatio(ratio);
}
}
PagerVo<DailyReportListVo> p = PagerUtil.pageToVo(pagging, null);
return p;
}
public ResultBean<ReportVo> getReport2(String date, String orgPath) {
ResultBean<ReportVo> rb = ResultBean.fireFail();
QueryWrapper<DailyReport> qw = new QueryWrapper<>();
if (StringUtils.isNotBlank(date)) {
qw.like("createTime", date);
}
if(StringUtils.isNotBlank(orgPath)){
List<String> stringList = Arrays.asList(orgPath.split("/"));
String busOrgSid = orgPath.substring(37, 73);
qw.eq("busOrgSid", busOrgSid);
}
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_total()).divide((new BigDecimal(reportVo.getSaleAllToThree()).divide(new BigDecimal(3), 4, BigDecimal.ROUND_HALF_UP)), 0, BigDecimal.ROUND_HALF_UP).toString() + ":1";
}
}
reportVo.setSaleOfStockRatio(ratio);
return rb.success().setData(reportVo);
}
public PagerVo<DailyReportListVo> pageList3(PagerQuery<DailyReportAppPagerQuery> pagerQuery) {
DailyReportAppPagerQuery 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 useOrgSid = sysStaffOrgFeign.getOrgSidByPath(query.getOrgPath()).getData();
qw.eq("useOrgSid",useOrgSid);
}
}
IPage<DailyReport> page = PagerUtil.queryToPage(pagerQuery);
IPage<DailyReportListVo> pagging = baseMapper.pageList2(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, BigDecimal.ROUND_HALF_UP)), 0, BigDecimal.ROUND_HALF_UP).toString() + ":1";
}
}
dailyReportListVo.setSaleOfStockRatio(ratio);
}
}
PagerVo<DailyReportListVo> p = PagerUtil.pageToVo(pagging, null);
return p;
}
public ResultBean<ReportVo> getReport3(String date, String orgPath) {
ResultBean<ReportVo> rb = ResultBean.fireFail();
QueryWrapper<DailyReport> qw = new QueryWrapper<>();
if (StringUtils.isNotBlank(date)) {
qw.like("createTime", date);
}
if(StringUtils.isNotBlank(orgPath)){
String useOrgSid= sysStaffOrgFeign.getOrgSidByPath(orgPath).getData();
qw.eq("useOrgSid",useOrgSid);
}
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_total()).divide((new BigDecimal(reportVo.getSaleAllToThree()).divide(new BigDecimal(3), 4, BigDecimal.ROUND_HALF_UP)), 0, BigDecimal.ROUND_HALF_UP).toString() + ":1";
}
}
reportVo.setSaleOfStockRatio(ratio);
return rb.success().setData(reportVo);
}
}

Loading…
Cancel
Save