廖井涛
2024-08-05 cc78e409cdca2a414f654490d3bc78cce429c59e
新增订单总报表
7个文件已修改
1个文件已添加
297 ■■■■■ 已修改文件
north-glass-erp/northglass-erp/src/lang/zh.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/router/index.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/order/Order.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/order/OrderSummaryReport.vue 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/sd/OrderController.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/sd/OrderDetailMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/sd/OrderDetailMapper.xml 187 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/lang/zh.js
@@ -236,6 +236,7 @@
        oneClickStorage:'一键完工',
        quantityMount:'数量金额',
        orderSummaryReport:'订单总报表',
        msg:{
            productCheck:'请选择产品',
            tableLengthNot:'没有表格数据',
north-glass-erp/northglass-erp/src/router/index.js
@@ -167,6 +167,11 @@
              component: () => import('../views/sd/order/UpdateOrderCraft.vue'),
            },
            {
              path: 'orderSummaryReport',
              name: 'orderSummaryReport',
              component: () => import('../views/sd/order/OrderSummaryReport.vue'),
            },
            {
              path: 'orderReport',
              name: 'orderReport',
              component: () => import('../views/sd/order/OrderReport.vue'),
north-glass-erp/northglass-erp/src/views/sd/order/Order.vue
@@ -39,6 +39,7 @@
            </span>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item command="/main/order/orderSummaryReport" >{{$t('order.orderSummaryReport')}}</el-dropdown-item>
                <el-dropdown-item command="/main/order/orderReport" >{{ $t('order.orderReport') }}</el-dropdown-item>
                <el-dropdown-item command="/main/order/orderProductSummaryReport">{{ $t('order.orderDetailsSummary') }}</el-dropdown-item>
              </el-dropdown-menu>
north-glass-erp/northglass-erp/src/views/sd/order/OrderSummaryReport.vue
New file
@@ -0,0 +1,48 @@
<script setup>
import BasicTable from "@/components/BasicTable.vue"
import { ref} from "vue"
import request from "@/utils/request"
import {useI18n} from "vue-i18n";
const { t } = useI18n()
const childrenData = ref({
  columns:[
    {type:'expand',fixed:"left",width: 80,slots: { content:'content' }},
    {type: 'seq',fixed:"left", title: t('basicData.Number'), width: 80 },
    {field: 'orderId',width:120, title: t('order.orderId'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'orderType',width:120, title: t('order.orderType'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'customerName',width:120, title: t('customer.customerName'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'project',width:120, title: t('order.project'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'batch',width:120, title: t('order.batch'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'quantity',width:120, title: t('order.quantity'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'area',width:120, title: t('order.area'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'otherMoney',width:120, title: t('basicData.otherAmounts'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'money',width:120, title: t('order.money'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'perimeter',width:120, title: t('order.perimeter'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'processingNote',width:120, title: t('order.processingNote'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'icon',width:120, title: t('order.icon'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'packType',width:120, title: t('order.packType'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'alType',width:120, title: t('order.alType'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'salesman',width:120, title: t('order.salesman'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'deliveryAddress',width:120, title: t('order.deliveryAddress'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'creator',width:120, title: t('order.creator'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'createTime',width:120, title: t('basicData.creationTime'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true},
    {field: 'customerBatch',width:120, title: t('order.customerBatch'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true}
  ],//表格表头字段
  data:[],//表格数据
  url :'/order/getOrderSummaryReport',
  exportUrl :'/order/exportOrderSummary',
  exportName:t('order.orderSummaryReport'),
  footList:['quantity','money','area','perimeter','otherMoney']
})
</script>
<template>
  <basic-table
      :childrenData="childrenData"/>
</template>
<style scoped>
</style>
north-glass-erp/src/main/java/com/example/erp/controller/sd/OrderController.java
@@ -151,6 +151,18 @@
        return  Result.seccess(orderService.getOrderProductSummary(pageNum,pageSize,selectDate,orderDetail));
    }
    @SaCheckPermission("orderReport.search")
    @ApiOperation("查询订单总报表")
    @PostMapping("/getOrderSummaryReport/{pageNum}/{pageSize}/{selectDate}")
    public Result getOrderSummaryReport(@PathVariable Integer pageNum,
                                 @PathVariable Integer pageSize,
                                 @PathVariable List<String> selectDate,
                                 @RequestBody Order order)  {
        return  Result.seccess(orderService.getOrderSummaryReport(pageNum,pageSize,selectDate,order));
    }
    @ApiOperation("订单报表导出")
    @PostMapping("/exportOrderReport")
    public void exportOrderReport(HttpServletResponse response, @RequestBody List<LocalDate> dates) throws IOException, IllegalAccessException, InstantiationException {
@@ -166,6 +178,14 @@
        DownExcel.download(response, OrderDTO.class, orderService.exportOrderProductSummary(dates),"orderReport");
    }
    @ApiOperation("订单总报表导出")
    @PostMapping("/exportOrderSummary")
    public void exportOrderSummary(HttpServletResponse response, @RequestBody List<LocalDate> dates) throws IOException, IllegalAccessException, InstantiationException {
        //参数:相应的数据,实体类信息,相应的方法(数据获取),生成的excel名字
        DownExcel.download(response, Order.class, orderService.exportOrderSummary(dates),"orderReport");
    }
    @ApiOperation("订单小片标签")
    @PostMapping("/getOrderProductDetailTag/{orderId}")
north-glass-erp/src/main/java/com/example/erp/mapper/sd/OrderDetailMapper.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.erp.dto.sd.OrderDTO;
import com.example.erp.dto.sd.OrderDetailProductDTO;
import com.example.erp.entity.sd.Order;
import com.example.erp.entity.sd.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
@@ -42,5 +43,11 @@
    List<Map<String,Object>> getOrderProductByProductIds(Object productId, String orderId);
    List<Order> getOrderSummaryReport(Integer offset, Integer pageSize, String startDate, String endDate, Order order);
    Map<String,Integer> getOrderSummaryReportTotal(Integer offset, Integer pageSize, String startDate, String endDate, Order order, String type);
    List<Order> exportOrderSummary(List<LocalDate> dates);
}
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java
@@ -430,6 +430,34 @@
        return orderDetailMapper.exportOrderReport(dates);
    }
    public Map<String,Object> getOrderSummaryReport(Integer pageNum, Integer pageSize, List<String> selectDate, Order order) {
        Integer offset = (pageNum-1)*pageSize;
        String endDate = LocalDate.now().toString();
        String startDate = LocalDate.now().minusDays(15).toString();
        if(selectDate !=null && selectDate.size()==2){
            if(!selectDate.get(0).isEmpty()){
                startDate = selectDate.get(0);
            }
            if(!selectDate.get(1).isEmpty()){
                endDate = selectDate.get(1);
            }
        }
        Map<String,Object> map = new HashMap<>();
        map.put("data",orderDetailMapper.getOrderSummaryReport(offset, pageSize, startDate, endDate, order));
        map.put("total",orderDetailMapper.getOrderSummaryReportTotal(offset, pageSize, startDate, endDate, order,"order"));
        List<String> list = new ArrayList<>();
        list.add(startDate);
        list.add(endDate);
        map.put("selectDate",list);
//        map.put("total",orderMapper.getPageTotal(offset, pageSize, startDate, endDate, orderDetail));
        return map;
    }
    public List<Order> exportOrderSummary(List<LocalDate> dates) {
        return orderDetailMapper.exportOrderSummary(dates);
    }
    public Map<String,Object> getOrderProductSummary(Integer pageNum, Integer pageSize, List<String> selectDate, OrderDetail orderDetail) {
        Integer offset = (pageNum-1)*pageSize;
        String endDate = LocalDate.now().toString();
north-glass-erp/src/main/resources/mapper/sd/OrderDetailMapper.xml
@@ -113,6 +113,153 @@
    </resultMap>
    <select id="getOrderSummaryReport" >
        SELECT
        *
        from  sd.`order` as b
        where  date(b.create_time)>=#{startDate} and date(b.create_time) &lt;= #{endDate}
        <if test="order.orderType != null and order.orderType != ''">
            and b.order_type like concat('%',#{order.orderType},'%')
        </if>
        <if test="order.customerId != null and order.customerId != ''">
            and b.customer_id like concat('%',#{order.customerId},'%')
        </if>
        <if test="order.customerName != null and order.customerName != ''">
            and b.customer_name like concat('%',#{order.customerName},'%')
        </if>
        <if test="order.project != null and order.project != ''">
            and b.project like concat('%',#{order.project},'%')
        </if>
        <if test="order.orderId != null and order.orderId != ''">
            and b.order_id like concat('%',#{order.orderId},'%')
        </if>
        <if test="order.batch != null and order.batch != ''">
            and b.batch like concat('%',#{order.batch},'%')
        </if>
        <if test="order.icon != null and order.icon != ''">
            and b.icon like concat('%',#{order.icon},'%')
        </if>
        <if test="order.packType != null and order.packType != ''">
            and b.pack_type like concat('%',#{order.packType},'%')
        </if>
        <if test="order.alType != null and order.alType != ''">
            and b.al_type like concat('%',#{order.alType},'%')
        </if>
        <if test="order.salesman != null and order.salesman != ''">
            and b.salesman like concat('%',#{order.salesman},'%')
        </if>
        <if test="order.deliveryAddress != null and order.deliveryAddress != ''">
            and b.delivery_address like concat('%',#{order.deliveryAddress},'%')
        </if>
        <if test="order.creator != null and order.creator != ''">
            and b.creator like concat('%',#{order.creator},'%')
        </if>
        <if test="order.otherMoney != null and order.otherMoney != ''">
            and b.other_money regexp REGEXP_REPLACE(#{order.otherMoney},'\\.0+$','')
        </if>
        <if test="order.quantity != null ">
            and b.quantity like concat('%',#{order.quantity},'%')
        </if>
        <if test="order.money != null ">
            and b.money  regexp REGEXP_REPLACE(#{order.money},'\\.0+$','')
        </if>
        <if test="order.perimeter != null and order.perimeter != ''">
            and b.perimeter regexp REGEXP_REPLACE(#{order.perimeter},'\\.0+$','')
        </if>
        <if test="order.processingNote != null and order.processingNote != ''">
            and b.processing_note like concat('%',#{order.processingNote},'%')
        </if>
        <if test="order.area != null and order.area != ''">
            and b.area regexp REGEXP_REPLACE(#{order.area},'\\.0+$','')
        </if>
        order by b.id desc
        limit #{offset},#{pageSize}
    </select>
    <select id="getOrderSummaryReportTotal" >
        SELECT
        CEILING(count(b.id)/#{pageSize}) as 'pageTotal',
        count(b.id) as 'total'
        from  sd.`order` as b
        where  date(b.create_time)>=#{startDate} and date(b.create_time) &lt;= #{endDate}
        <if test="order.orderType != null and order.orderType != ''">
            and b.order_type like concat('%',#{order.orderType},'%')
        </if>
        <if test="order.customerId != null and order.customerId != ''">
            and b.customer_id like concat('%',#{order.customerId},'%')
        </if>
        <if test="order.customerName != null and order.customerName != ''">
            and b.customer_name like concat('%',#{order.customerName},'%')
        </if>
        <if test="order.project != null and order.project != ''">
            and b.project like concat('%',#{order.project},'%')
        </if>
        <if test="order.orderId != null and order.orderId != ''">
            and b.order_id like concat('%',#{order.orderId},'%')
        </if>
        <if test="order.batch != null and order.batch != ''">
            and b.batch like concat('%',#{order.batch},'%')
        </if>
        <if test="order.icon != null and order.icon != ''">
            and b.icon like concat('%',#{order.icon},'%')
        </if>
        <if test="order.packType != null and order.packType != ''">
            and b.pack_type like concat('%',#{order.packType},'%')
        </if>
        <if test="order.alType != null and order.alType != ''">
            and b.al_type like concat('%',#{order.alType},'%')
        </if>
        <if test="order.salesman != null and order.salesman != ''">
            and b.salesman like concat('%',#{order.salesman},'%')
        </if>
        <if test="order.deliveryAddress != null and order.deliveryAddress != ''">
            and b.delivery_address like concat('%',#{order.deliveryAddress},'%')
        </if>
        <if test="order.creator != null and order.creator != ''">
            and b.creator like concat('%',#{order.creator},'%')
        </if>
        <if test="order.otherMoney != null and order.otherMoney != ''">
            and b.other_money regexp REGEXP_REPLACE(#{order.otherMoney},'\\.0+$','')
        </if>
        <if test="order.quantity != null ">
            and b.quantity like concat('%',#{order.quantity},'%')
        </if>
        <if test="order.money != null ">
            and b.money  regexp REGEXP_REPLACE(#{order.money},'\\.0+$','')
        </if>
        <if test="order.perimeter != null and order.perimeter != ''">
            and b.perimeter regexp REGEXP_REPLACE(#{order.perimeter},'\\.0+$','')
        </if>
        <if test="order.processingNote != null and order.processingNote != ''">
            and b.processing_note like concat('%',#{order.processingNote},'%')
        </if>
        <if test="order.area != null and order.area != ''">
            and b.area regexp REGEXP_REPLACE(#{order.area},'\\.0+$','')
        </if>
    </select>
    <select id="exportOrderSummary"  >
        SELECT *
        from sd.`order` as b
        where  date(b.create_time)>=#{dates[0]} and date(b.create_time) &lt;= #{dates[1]}
        order by b.id desc
    </select>
    <select id="getOrderReport" resultMap="orderMap">
        SELECT
            *,
@@ -165,11 +312,11 @@
        </if>
        <if test="orderDetail.width != null and orderDetail.width != ''">
            and a.width like concat('%',#{orderDetail.width},'%')
            and a.width regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
        </if>
        <if test="orderDetail.height != null and orderDetail.height != ''">
            and a.height like concat('%',#{orderDetail.height},'%')
            and a.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
        </if>
        <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
@@ -181,11 +328,11 @@
        </if>
        <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
            and a.gross_area like concat('%',#{orderDetail.grossArea},'%')
            and a.gross_area regexp REGEXP_REPLACE(#{orderDetail},'\\.0+$','')
        </if>
        <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
            and a.compute_gross_area like concat('%',#{orderDetail.computeGrossArea},'%')
            and a.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
        </if>
        <if test="orderDetail.shape != null and orderDetail.shape != ''">
@@ -221,7 +368,7 @@
        </if>
        <if test="orderDetail.grossAmount != null and orderDetail.grossAmount != ''">
            and a.gross_amount like concat('%',#{orderDetail.grossAmount},'%')
            and a.gross_amount regexp REGEXP_REPLACE(#{orderDetail.grossAmount},'\\.0+$','')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.alType != null and orderDetail.order.alType != ''">
@@ -307,11 +454,11 @@
        </if>
        <if test="orderDetail.width != null and orderDetail.width != ''">
            and a.width like concat('%',#{orderDetail.width},'%')
            and a.width regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
        </if>
        <if test="orderDetail.height != null and orderDetail.height != ''">
            and a.height like concat('%',#{orderDetail.height},'%')
            and a.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
        </if>
        <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
@@ -323,11 +470,11 @@
        </if>
        <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
            and a.gross_area like concat('%',#{orderDetail.grossArea},'%')
            and a.gross_area regexp REGEXP_REPLACE(#{orderDetail},'\\.0+$','')
        </if>
        <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
            and a.compute_gross_area like concat('%',#{orderDetail.computeGrossArea},'%')
            and a.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
        </if>
        <if test="orderDetail.shape != null and orderDetail.shape != ''">
@@ -363,7 +510,7 @@
        </if>
        <if test="orderDetail.grossAmount != null and orderDetail.grossAmount != ''">
            and a.gross_amount like concat('%',#{orderDetail.grossAmount},'%')
            and a.gross_amount regexp REGEXP_REPLACE(#{orderDetail.grossAmount},'\\.0+$','')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.alType != null and orderDetail.order.alType != ''">
@@ -498,11 +645,11 @@
        </if>
        <if test="orderDetail.width != null and orderDetail.width != ''">
            and a.width like concat('%',#{orderDetail.width},'%')
            and a.width  regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
        </if>
        <if test="orderDetail.height != null and orderDetail.height != ''">
            and a.height like concat('%',#{orderDetail.height},'%')
            and a.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
        </if>
        <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
@@ -514,11 +661,11 @@
        </if>
        <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
            and a.gross_area like concat('%',#{orderDetail.grossArea},'%')
            and a.gross_area regexp REGEXP_REPLACE(#{orderDetail.grossArea},'\\.0+$','')
        </if>
        <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
            and a.compute_gross_area like concat('%',#{orderDetail.computeGrossArea},'%')
            and a.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
        </if>
        <if test="orderDetail.shape != null and orderDetail.shape != ''">
@@ -554,7 +701,7 @@
        </if>
        <if test="orderDetail.grossAmount != null and orderDetail.grossAmount != ''">
            and a.gross_amount like concat('%',#{orderDetail.grossAmount},'%')
            and a.gross_amount regexp REGEXP_REPLACE(#{orderDetail.grossAmount},'\\.0+$','')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.alType != null and orderDetail.order.alType != ''">
@@ -647,11 +794,11 @@
        </if>
        <if test="orderDetail.width != null and orderDetail.width != ''">
            and a.width like concat('%',#{orderDetail.width},'%')
            and a.width  regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
        </if>
        <if test="orderDetail.height != null and orderDetail.height != ''">
            and a.height like concat('%',#{orderDetail.height},'%')
            and a.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
        </if>
        <if test="orderDetail.quantity != null and orderDetail.quantity != ''">
@@ -663,11 +810,11 @@
        </if>
        <if test="orderDetail.grossArea != null and orderDetail.grossArea != ''">
            and a.gross_area like concat('%',#{orderDetail.grossArea},'%')
            and a.gross_area regexp REGEXP_REPLACE(#{orderDetail.grossArea},'\\.0+$','')
        </if>
        <if test="orderDetail.computeGrossArea != null and orderDetail.computeGrossArea != ''">
            and a.compute_gross_area like concat('%',#{orderDetail.computeGrossArea},'%')
            and a.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
        </if>
        <if test="orderDetail.shape != null and orderDetail.shape != ''">
@@ -703,7 +850,7 @@
        </if>
        <if test="orderDetail.grossAmount != null and orderDetail.grossAmount != ''">
            and a.gross_amount like concat('%',#{orderDetail.grossAmount},'%')
            and a.gross_amount regexp REGEXP_REPLACE(#{orderDetail.grossAmount},'\\.0+$','')
        </if>
        <if test="orderDetail.order!=null and  orderDetail.order.alType != null and orderDetail.order.alType != ''">