2020暑假项目-车辆派遣管理系统开发记录#8

  • 1、完成内容,
    - 统计模块->派车单统计 按用车单位、车号、驾驶员、业务员查询统计出出车日期范围内的派车单详细信息,可以生成报表
    - 统计模块->出车率分析 统计某段时间内容所有车辆的出车次数及租车费用,可以生成报表
    - 统计模块->已收款明细 按所属用车单位统计已收款的派车单信息,可以生成报表
    - 统计模块->未收款明细 按所属用车单位统计未收款或未结清的派车单信息,可以生成报表
    - 统计模块->车补贴查询 按出车日期统计驾驶员所获得补贴信息,可以生成报表
  • 2、核心源码
    tripRateAnalysis.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<jsp:include page="../common/menu.jsp" />

<html>
<head>
    <title>出车率分析</title>
</head>

<script src="<%=basePath%>js/tools.js"></script>
<script src="<%=basePath%>js/echarts.min.js"></script>
<body>
<div class="layui-tab">
    <ul class="layui-tab-title">
        <li class="layui-this">出车率分析</li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-inline">
            <label class="layui-form-label">出车日期</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" id="startDateSel"
                       name="startDateSel" placeholder=" - ">
            </div>
        </div>
        <button class="layui-btn" id="selCond" data-type="reload">搜索</button>
    </div>

    <div class="layui-tab-item layui-show">
        <table class="layui-hide" id="backUser" lay-filter="backUser"></table>
    </div>
</div>

</body>
</html>
<jsp:include page="../common/js.jsp" />

<script type="text/javascript">

    $('document').ready(function() {
        var layer = null;
        var laypage = null;
        var table = null;
        var form = null;
        layui.use([ "laypage", "layer", 'table' ,'laydate'], function() {
            layer = layui.layer;
            laypage = layui.laypage;
            table = layui.table;
            form = layui.form;
            laydate = layui.laydate;

            table.render({
                elem : '#backUser',
                url : '<%=basePath%>statistics/tripRateAnalysis',
                id : 'backUser',
                height:650,
                toolbar : '#toolbar',
                cellMinWidth : 100,
                cols : [ [
                    {
                        field : 'vehicleNum',
                        title : '车牌号',
                        width : '30%',
                        sort : true
                    }
                    , {
                        field : 'cs',
                        title : '出车次数',
                        width : '35%',
                        sort : true
                    }
                    , {
                        field: 'totalMoney',
                        title: '总营业额',
                        width: '35%',
                        sort: true
                    }
                ] ],
                page : false
            });


            laydate.render({
                elem : '#startDateSel',
                range : true
            });

            $("#selCond").click(function(){
                var startDateSel = $("#startDateSel").val();

                table.reload('backUser',{
                    url:'<%=basePath %>/statistics/tripRateAnalysis'
                    ,method:'get'
                    ,where:{
                        startDateSel : startDateSel
                    }
                    ,page:false
                });
            });

        });
    });

    function changeStatus(str) {
        var typeName = new Map();
        typeName.set(1, '未审核-未收款');
        typeName.set(2, '已审核-未收款');
        typeName.set(3, '已完成-已收款');
        typeName.set(0, '已取消');
        return typeName.get(str);
    }
</script>

StatisticsController.java

package com.vdm.action;

import com.vdm.model.*;
import com.vdm.service.*;
import com.vdm.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/statistics")
public class StatisticsController {

    @Autowired
    DispatchService dispatchService;

    @Autowired
    SalesmanService salesmanService;

    @Autowired
    CompanyService companyService;

    @Autowired
    VehicleService vehicleService;

    @Autowired
    PilotService pilotService;

    @Autowired
    AmountService amountService;

    @RequestMapping("toSettlementDetails")
    public String toSettlementDetails(){
        return "statistics/settlementDetails";
    }

    @RequestMapping("toTripRateAnalysis")
    public String toTripRateAnalysis(){
        return "statistics/tripRateAnalysis";
    }

    @ResponseBody
    @RequestMapping(value = "/tripRateAnalysis",method = RequestMethod.GET)
    public Map<String,Object> tripRateAnalysis(String startDateSel){
        Map map = new HashMap();

        if(!StringUtil.isEmpty(startDateSel)){
            String[] strs=startDateSel.split(" - ");
            map.put("startDateSelFrom", strs[0]);
            map.put("startDateSelTo", strs[1]);
        }else{
            map.put("startDateSelFrom",null );
            map.put("startDateSelTo",null );
        }
        List<HashMap<String,Object>> list = dispatchService.tripRateAnalysis(map);

        Map<String,Object> retMap = new HashMap();
        retMap.put("code",0);
        retMap.put("msg","");

        retMap.put("data",list);
        return retMap;
    }

    @ResponseBody
    @RequestMapping(value = "/carSubsidize",method = RequestMethod.GET)
    public Map<String,Object> carSubsidize(String startDateSel){
        Map map = new HashMap();
        if(!StringUtil.isEmpty(startDateSel)){
            String[] strs=startDateSel.split(" - ");
            map.put("startDateSelFrom", strs[0]);
            map.put("startDateSelTo", strs[1]);
        }else{
            map.put("startDateSelFrom",null );
            map.put("startDateSelTo",null );
        }

        List<HashMap<String,Object>> list = dispatchService.carSubsidize(map);

        Map<String,Object> retMap = new HashMap();
        retMap.put("code",0);
        retMap.put("msg","");
        retMap.put("data",list);
        return retMap;
    }

    @RequestMapping("toCarSubsidize")
    public String toCarSubsidize(){
        return "statistics/carSubsidize";
    }

    @RequestMapping("/toSingleSettlementDetails")
    public String toSingleSettlementDetails(Model model){
        List<VehicleInfo> vehicleInfos = vehicleService.getAllVehicleInfo();
        model.addAttribute("vehicleInfos",vehicleInfos);
        return "statistics/singleSettlementDetails";
    }

    @RequestMapping("/toReceivedDetails")
    public String toReceivedDetails(Model model){
        //公司信息
        List<CompanyInfo> companyList = companyService.getAllCompanyInfo();
        model.addAttribute("companyList",companyList);
        return "statistics/receivedDetails";
    }
    @RequestMapping("/toUnpaidDetails")
    public String toUnpaidDetails(Model model){
        //公司信息
        List<CompanyInfo> companyList = companyService.getAllCompanyInfo();
        model.addAttribute("companyList",companyList);
        return "statistics/unpaidDetails";
    }

    @RequestMapping("/toDispatchDetails")
    public String toDispatchDetails(Model model){
        //业务员
        List<SalesmanInfo> saleList = salesmanService.getAllSalesmanInfo();
        model.addAttribute("saleList",saleList);

        //公司信息
        List<CompanyInfo> companyList = companyService.getAllCompanyInfo();
        model.addAttribute("companyList",companyList);

        //车辆信息
        List<VehicleInfo> vehicleList = vehicleService.getAllVehicleInfo();
        model.addAttribute("vehicleList",vehicleList);

        //驾驶员信息
        List<PilotInfo> pilotList = pilotService.getAllPilotInfo();
        model.addAttribute("pilotList",pilotList);

        return "statistics/dispatchDetails";
    }


}

DispatchInfoMapper.xml

 <select id="tripRateAnalysis" resultType="java.util.HashMap" parameterType="Map">

        select di.vehicle_num as vehicleNum,count(*) as cs , sum(di.total_money) as totalMoney from dispatch_info di where di.status != 1

        <if test="startDateSelFrom != null and startDateSelFrom != '' " >
            and start_time &gt;= #{startDateSelFrom} and start_time &lt;= #{startDateSelTo}
        </if>

        group by di.vehicle_num

    </select>

    <select id="carSubsidize" resultType="java.util.HashMap" parameterType="Map">

        select di.pilot_name as pilotName ,sum(di.audit_subsidize_money) as auditSubsidizeMoney from dispatch_info di where di.pilot_name != ''

        <if test="startDateSelFrom != null and startDateSelFrom != '' " >
            and start_time &gt;= #{startDateSelFrom} and start_time &lt;= #{startDateSelTo}
        </if>

        GROUP BY di.pilot_name

    </select>

  <select id="dispatchListByCond" resultMap="BaseResultMap" parameterType="Map">
    select * from dispatch_info where 1=1
    <if test="salesmanId != null and salesmanId !='' ">
      and salesman_id = #{salesmanId}
    </if>

    <if test="pilotId != null and pilotId !='' ">
      and pilot_id = #{pilotId}
    </if>

    <if test="companyId != null and companyId !='' ">
      and company_id = #{companyId}
    </if>

    <if test="vehicleNum != null and vehicleNum !='' ">
      and vehicle_num = #{vehicleNum}
    </if>

    <if test="startDateSelFrom != null and startDateSelFrom != '' " >
      and start_time &gt;= #{startDateSelFrom} and start_time &lt;= #{startDateSelTo}
    </if>

     <if test="status != null and status != 0 ">
      and status = #{status}
     </if>

    <if test="page!=null and limit!=null">
      limit #{page},#{limit}
    </if>
  </select>
  • 3、遇到的问题

  • 4、解决问题`

  • 5、燃尽图(燃尽图说明,7月27日至7月31日为Java方向培训8月1日上午为培训考试,8月4日至8月8日全员参与招生无法继续写项目)

posted @ 2020-08-10 17:35  LemonTG  阅读(125)  评论(0编辑  收藏  举报