2020暑假專案-車輛派遣管理系統開發記錄#8
阿新 • • 發佈:2020-08-10
- 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 >= #{startDateSelFrom} and start_time <= #{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 >= #{startDateSelFrom} and start_time <= #{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 >= #{startDateSelFrom} and start_time <= #{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日全員參與招生無法繼續寫專案)