Browse Source

报表中心-销售报表的接口

master
lzh 2 years ago
parent
commit
e9431a4c7e
  1. 1
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageCountMapper.java
  2. 2
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageCountService.java
  3. 4
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageMapper.java
  4. 10
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageService.java
  5. 5
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdsales/GdSalesMapper.java
  6. 88
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdsales/GdSalesReportdayService.java
  7. 3
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdsales/GdSalesService.java
  8. 65
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdsales/ReportCenterRest.java

1
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageCountMapper.java

@ -117,4 +117,5 @@ public interface GdInstorageCountMapper extends BaseMapper<GdInstorageCount> {
" GROUP BY prs.storeCode,prt.code) t" +
" GROUP BY t.storeCode; ")
List<Map<String, Object>> ycspdhmxb();
}

2
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageCountService.java

@ -328,3 +328,5 @@ public class GdInstorageCountService extends ServiceImpl<GdInstorageCountMapper,
return wdhjz;
}
}

4
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageMapper.java

@ -29,6 +29,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
* Project: yxt_supervise <br/>
@ -48,4 +49,7 @@ public interface GdInstorageMapper extends BaseMapper<GdInstorage> {
@Delete("delete from gd_instorage where orderDate=#{orderDate} ")
void clearByOrderDate(@Param("orderDate") String orderDate);
@Select("select sum(colq16) as amount from gd_instorage where orderDate=#{orderDate}")
double amountOfDay(@Param("orderDate") String orderDate);
}

10
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageService.java

@ -320,4 +320,14 @@ public class GdInstorageService extends ServiceImpl<GdInstorageMapper, GdInstora
public void clearByOrderDate(String orderDate) {
baseMapper.clearByOrderDate(orderDate);
}
/**
* 112仓某一天的入库金额
*
* @param orderDate
* @return
*/
public double amountOfDay(String orderDate) {
return baseMapper.amountOfDay(orderDate);
}
}

5
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdsales/GdSalesMapper.java

@ -79,5 +79,8 @@ public interface GdSalesMapper extends BaseMapper<GdSales> {
@Select("select CONVERT(IFNULL(sum(saleNum*salePrice),0),DECIMAL(12,2)) as amount from ( " +
" select gs.saleNum,gs.salePrice from gd_sales gs left join store_index si on gs.storeCode=si.code " +
" where gs.dataDate=#{dataDate} and si.`type` ='连锁内加盟' ) t ")
double amountOfLsnjmOnDay(String orderDate);
double amountOfLsnjmOnDay(@Param("dataDate") String orderDate);
@Select("select CONVERT(IFNULL(sum(saleNum*salePrice),0),DECIMAL(12,2)) as amount from gd_sales gs where gs.dataDate=#{dataDate} ")
double amountOfDay(@Param("dataDate") String orderDate);
}

88
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdsales/GdSalesReportdayService.java

@ -1,12 +1,16 @@
package com.yxt.supervise.portal.biz.gdsales;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yxt.common.core.result.ResultBean;
import com.yxt.supervise.portal.biz.gdinstorage.GdInstorageCountService;
import com.yxt.supervise.portal.biz.gdinstorage.GdInstorageJmdService;
import com.yxt.supervise.portal.biz.gdinstorage.GdInstorageService;
import com.yxt.supervise.portal.biz.gdinstorage.GdInstorageYcService;
import com.yxt.supervise.portal.biz.gdinventory.GdInventoryOkService;
import com.yxt.supervise.portal.biz.gdinventory.GdInventoryYcService;
@ -14,8 +18,7 @@ import com.yxt.supervise.portal.biz.gdwholesale.GdWholesaleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.*;
@Service
public class GdSalesReportdayService extends ServiceImpl<GdSalesReportdayMapper, GdSalesReportday> {
@ -38,6 +41,8 @@ public class GdSalesReportdayService extends ServiceImpl<GdSalesReportdayMapper,
private GdInventoryYcService gdInventoryYcService;
@Autowired
private SalesDataDailySummaryService salesDataDailySummaryService;
@Autowired
private GdInstorageService gdInstorageService;
public GdSalesReportday clearAndInitByOrderDate(String orderDate) {
this.clearByOrderDate(orderDate); // 清除数据日的数据
@ -167,6 +172,8 @@ public class GdSalesReportdayService extends ServiceImpl<GdSalesReportdayMapper,
}
private String dayAgo(String orderDate, int offset) {
if (offset == 0)
return orderDate;
DateTime nowDate = DateUtil.parse(orderDate, "yyyy-MM-dd");
DateTime preDate = DateUtil.offsetDay(nowDate, offset);
return DateUtil.format(preDate, "yyyy-MM-dd");
@ -180,4 +187,81 @@ public class GdSalesReportdayService extends ServiceImpl<GdSalesReportdayMapper,
public void clearByOrderDate(String orderDate) {
baseMapper.clearByOrderDate(orderDate);
}
/**
* 获取销售报表
*
* @param customerSid 客户Sid
* @param orderDate 查询日期
* @param type 类型1.全部,2.常规商品3.烟草
* @return
*/
public ResultBean<Map<String, Object>> getSalesReport(String customerSid, String orderDate, String type) {
ResultBean rb = ResultBean.fireFail();
Map<String, Object> map = new HashMap<>();
double xsLwlsd = gdSalesService.amountOfLwlsdDay(orderDate); // 连网连锁店
double xsLsnjm = gdSalesService.amountOfLsnjmDay(orderDate); // 连锁内加盟
double xsPszx = gdWholesaleService.amountOfDay(orderDate); // 配送中心
double xsLswjm = gdInstorageJmdService.amountOfDay(orderDate); // 连锁外加盟
double xsYc = gdSalesYcService.amountOfDay(orderDate); // 36524集团报烟门店仓
double xsYcJmd = gdInstorageYcService.amountOfDayJmd(orderDate); // 烟草连锁外加盟(销配结算)
double cgsp = xsLwlsd + xsLsnjm + xsPszx + xsLswjm;//常规商品
double yc = xsYc + xsYcJmd; //烟草
double all = cgsp + yc; //全部
List<Map<String, String>> financialDataList = new ArrayList<>(); // 现金流量
financialDataList.add(MapUtil.builder(new HashMap<String, String>())
.put("name", "销售商品收到的现金(元)")
.put("totalPrice", "" + all).build());
financialDataList.add(MapUtil.builder(new HashMap<String, String>())
.put("name", "收到其他与经营活动有关的现金(元)")
.put("totalPrice", "0").build());
map.put("financialData", financialDataList);
List<Map<String, String>> listSalesChannelData = new ArrayList<>();
listSalesChannelData.add(MapUtil.builder(new HashMap<String, String>())
.put("salesChannelCategory", "连网连锁店")
.put("totalAmount", "" + xsLwlsd)
.put("accountsReceivable", "0")
.put("deductionAccountsReceivable", "" + xsLwlsd).build());
listSalesChannelData.add(MapUtil.builder(new HashMap<String, String>())
.put("salesChannelCategory", "连锁内加盟")
.put("totalAmount", "" + xsLsnjm)
.put("accountsReceivable", "0")
.put("deductionAccountsReceivable", "" + xsLsnjm).build());
listSalesChannelData.add(MapUtil.builder(new HashMap<String, String>())
.put("salesChannelCategory", "配送中心")
.put("totalAmount", "" + xsPszx)
.put("accountsReceivable", "0")
.put("deductionAccountsReceivable", "" + xsPszx).build());
listSalesChannelData.add(MapUtil.builder(new HashMap<String, String>())
.put("salesChannelCategory", "连锁外加盟")
.put("totalAmount", "" + xsLswjm)
.put("accountsReceivable", "0")
.put("deductionAccountsReceivable", "" + xsLswjm).build());
listSalesChannelData.add(MapUtil.builder(new HashMap<String, String>())
.put("salesChannelCategory", "36524集团报烟门店仓")
.put("totalAmount", "" + xsYc)
.put("accountsReceivable", "0")
.put("deductionAccountsReceivable", "" + xsYc).build());
listSalesChannelData.add(MapUtil.builder(new HashMap<String, String>())
.put("salesChannelCategory", "烟草连锁外加盟")
.put("totalAmount", "" + xsYcJmd)
.put("accountsReceivable", "0")
.put("deductionAccountsReceivable", "" + xsYcJmd).build());
map.put("listSalesChannelData", listSalesChannelData);
List<List<String>> financialAnalysisChartData = new ArrayList<>();
financialAnalysisChartData.add(CollUtil.newArrayList("日期", "分销商进货额", "实际发货额"));
for (int i = 7; i > 0; i--) {
String dateago = dayAgo(orderDate, -(i - 1));
System.out.println("xx " + dateago);
double rkje = gdInstorageService.amountOfDay(dateago); //入库金额
double xsje = xsLwlsd + xsLsnjm;
financialAnalysisChartData.add(CollUtil.newArrayList(dateago, "" + rkje, "" + xsje));
}
map.put("financialAnalysisChartData", financialAnalysisChartData);
return rb.success().setData(map);
}
}

3
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdsales/GdSalesService.java

@ -449,4 +449,7 @@ public class GdSalesService extends ServiceImpl<GdSalesMapper, GdSales> {
public double amountOfLsnjmDay(String orderDate) {
return baseMapper.amountOfLsnjmOnDay(orderDate);
}
public double amountOfDay(String orderDate) {
return baseMapper.amountOfDay(orderDate);
}
}

65
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdsales/ReportCenterRest.java

@ -0,0 +1,65 @@
/*********************************************************
*********************************************************
******************** *******************
************* ************
******* _oo0oo_ *******
*** o8888888o ***
* 88" . "88 *
* (| -_- |) *
* 0\ = /0 *
* ___/`---'\___ *
* .' \\| |// '. *
* / \\||| : |||// \ *
* / _||||| -:- |||||- \ *
* | | \\\ - /// | | *
* | \_| ''\---/'' |_/ | *
* \ .-\__ '-' ___/-. / *
* ___'. .' /--.--\ `. .'___ *
* ."" '< `.___\_<|>_/___.' >' "". *
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
* \ \ `_. \_ __\ /__ _/ .-` / / *
* =====`-.____`.___ \_____/___.-`___.-'===== *
* `=---=' *
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
*********************************************************/
package com.yxt.supervise.portal.biz.gdsales;
import com.yxt.common.core.result.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* Project: yxt_supervise <br/>
* File: ReportCenterRest.java <br/>
* Class: com.yxt.supervise.portal.biz.gdsales.ReportCenterRest <br/>
* Description: <描述类的功能>. <br/>
* Copyright: Copyright (c) 2011 <br/>
* Company: https://gitee.com/liuzp315 <br/>
* Makedate: 2023/1/17 14:17 <br/>
*
* @author liupopo
* @version 1.0
* @since 1.0
*/
@RestController("com.yxt.supervise.portal.biz.gdsales.ReportCenterRest")
@RequestMapping("/reportCenter")
public class ReportCenterRest {
@Autowired
private GdSalesReportdayService gdSalesReportdayService;
@GetMapping("/getSalesReport")
public ResultBean<Map<String, Object>> getSalesReport(@Param("customerSid") String customerSid,
@Param("date") String date,
@Param("type") String type) {
System.out.println("@@@@@: " + date);
return gdSalesReportdayService.getSalesReport(customerSid, date, type);
}
}
Loading…
Cancel
Save