Commit d60d4d1d81ec2e06ba260d89257fd9ededf05dfc
1 parent
ed1eda3a
新增路单审计报表
Showing
8 changed files
with
887 additions
and
1 deletions
src/main/java/com/bsth/controller/realcontrol/AuditReportController.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol; | |
| 2 | + | |
| 3 | +import com.bsth.controller.BaseController; | |
| 4 | +import com.bsth.data.schedule.DayOfSchedule; | |
| 5 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 6 | +import com.bsth.service.calc.CalcWaybillAuditService; | |
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 8 | +import org.springframework.web.bind.annotation.*; | |
| 9 | +import java.util.*; | |
| 10 | + | |
| 11 | +@RestController | |
| 12 | +@RequestMapping("/auditReport") | |
| 13 | +public class AuditReportController extends BaseController<ScheduleRealInfo, Long> { | |
| 14 | + | |
| 15 | + @Autowired | |
| 16 | + CalcWaybillAuditService calcWaybillAuditService; | |
| 17 | + | |
| 18 | + @Autowired | |
| 19 | + DayOfSchedule dayOfSchedule; | |
| 20 | + | |
| 21 | + @RequestMapping(value="/queryList") | |
| 22 | + public List<Map<String,Object>> queryList(@RequestParam Map<String, Object> map){ | |
| 23 | + String gsdm=null; | |
| 24 | + if(map.get("gsdm")!=null &&! "".equals(map.get("gsdm").toString().trim())){ | |
| 25 | + gsdm=map.get("gsdm").toString(); | |
| 26 | + } | |
| 27 | + String fgsdm=null; | |
| 28 | + if(map.get("fgsdm")!=null && !"".equals(map.get("fgsdm").toString().trim())){ | |
| 29 | + fgsdm=map.get("fgsdm").toString(); | |
| 30 | + } | |
| 31 | + String line=null; | |
| 32 | + if(map.get("line")!=null && !"".equals(map.get("line").toString().trim())){ | |
| 33 | + line=map.get("line").toString(); | |
| 34 | + } | |
| 35 | + String date=""; | |
| 36 | + if(map.get("date")!=null){ | |
| 37 | + date=map.get("date").toString(); | |
| 38 | + } | |
| 39 | + String date2=""; | |
| 40 | + if(map.get("date2")!=null){ | |
| 41 | + date2=map.get("date2").toString(); | |
| 42 | + } | |
| 43 | + String xlName=""; | |
| 44 | + if(map.get("xlName")!=null){ | |
| 45 | + xlName=map.get("xlName").toString(); | |
| 46 | + } | |
| 47 | + String type=""; | |
| 48 | + if(map.get("type")!=null){ | |
| 49 | + type=map.get("type").toString(); | |
| 50 | + } | |
| 51 | + String nbbm=null; | |
| 52 | + if(map.get("nbbm")!=null && !"".equals(map.get("nbbm").toString().trim())){ | |
| 53 | + nbbm=map.get("nbbm").toString(); | |
| 54 | + } | |
| 55 | + return calcWaybillAuditService.auditReport(gsdm,fgsdm,date,date2,line,nbbm,type,xlName); | |
| 56 | + } | |
| 57 | + | |
| 58 | + @RequestMapping(value="/queryCarList",method = RequestMethod.GET) | |
| 59 | + public List<Map<String, String>> queryCarList(){ | |
| 60 | + return calcWaybillAuditService.carList(); | |
| 61 | + } | |
| 62 | + | |
| 63 | + @RequestMapping(value="/create") | |
| 64 | + public Map<String,Object> create(@RequestParam Map<String, Object> map){ | |
| 65 | + Map<String,Object> map2=new HashMap<>(); | |
| 66 | + String date=""; | |
| 67 | + if(map.get("date")!=null){ | |
| 68 | + date=map.get("date").toString(); | |
| 69 | + } | |
| 70 | + calcWaybillAuditService.create(date); | |
| 71 | + return map2; | |
| 72 | + } | |
| 73 | +} | ... | ... |
src/main/java/com/bsth/data/BasicData.java
| ... | ... | @@ -55,6 +55,11 @@ public class BasicData { |
| 55 | 55 | //线路编码和名称对照 |
| 56 | 56 | public static Map<String, String> lineCode2NameMap; |
| 57 | 57 | |
| 58 | + //名称和线路编码对照 | |
| 59 | + public static Map<String, String> lineName2CodeMap; | |
| 60 | + | |
| 61 | + public static Map<String, String> lineCodeAllNameMap; | |
| 62 | + | |
| 58 | 63 | //停车场 |
| 59 | 64 | public static List<String> parkCodeList; |
| 60 | 65 | |
| ... | ... | @@ -78,6 +83,9 @@ public class BasicData { |
| 78 | 83 | |
| 79 | 84 | private static Map<String, SystemParam> key2param = new HashMap<>(); |
| 80 | 85 | |
| 86 | + //车辆自编号和车辆(K: 车辆自编号 ,V:车辆) | |
| 87 | + public static Map<String, Cars> nbbm2CarMap; | |
| 88 | + | |
| 81 | 89 | static Logger logger = LoggerFactory.getLogger(BasicData.class); |
| 82 | 90 | |
| 83 | 91 | public static String getStationNameByCode(String code, String prefix){ |
| ... | ... | @@ -200,7 +208,9 @@ public class BasicData { |
| 200 | 208 | Map<String, String> nbbm2CompanyCode = new HashMap<>(); |
| 201 | 209 | //车辆和分公司代码对照 |
| 202 | 210 | Map<String, String> nbbm2FgsCompanyCode = new HashMap<>(); |
| 203 | - | |
| 211 | + | |
| 212 | + Map<String, Cars> nbbm2Car = new HashMap<>(); | |
| 213 | + | |
| 204 | 214 | //车辆自编号和拍照号对照 |
| 205 | 215 | Map<String, String> nbbmCompanyPlate = new HashMap<>(); |
| 206 | 216 | |
| ... | ... | @@ -212,12 +222,14 @@ public class BasicData { |
| 212 | 222 | nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode()); |
| 213 | 223 | nbbm2FgsCompanyCode.put(car.getInsideCode(), car.getBrancheCompanyCode() + "_" + car.getBusinessCode() ); |
| 214 | 224 | nbbmCompanyPlate.put(car.getInsideCode(), car.getCarPlate()); |
| 225 | + nbbm2Car.put(car.getInsideCode(), car); | |
| 215 | 226 | } |
| 216 | 227 | |
| 217 | 228 | deviceId2NbbmMap = deviceId2Nbbm; |
| 218 | 229 | nbbm2CompanyCodeMap = nbbm2CompanyCode; |
| 219 | 230 | nbbm2FgsCompanyCodeMap = nbbm2FgsCompanyCode; |
| 220 | 231 | nbbmCompanyPlateMap =nbbmCompanyPlate; |
| 232 | + nbbm2CarMap=nbbm2Car; | |
| 221 | 233 | } |
| 222 | 234 | |
| 223 | 235 | /** |
| ... | ... | @@ -277,6 +289,7 @@ public class BasicData { |
| 277 | 289 | Line line; |
| 278 | 290 | BiMap<Integer, String> biMap = HashBiMap.create(); |
| 279 | 291 | Map<String, String> code2name = new HashMap<>(); |
| 292 | + Map<String, String> name2code = new HashMap<>(); | |
| 280 | 293 | Map<Integer, String> id2SHcode = new HashMap<Integer, String>(); |
| 281 | 294 | Map<String, String> code2SHcode = new HashMap<String, String>(); |
| 282 | 295 | Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>(); |
| ... | ... | @@ -310,6 +323,7 @@ public class BasicData { |
| 310 | 323 | line = iterator.next(); |
| 311 | 324 | biMap.put(line.getId(), line.getLineCode()); |
| 312 | 325 | code2name.put(line.getLineCode(), line.getName()); |
| 326 | + name2code.put(line.getName(), line.getLineCode()); | |
| 313 | 327 | id2SHcode.put(line.getId(), line.getShanghaiLinecode()); |
| 314 | 328 | code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode()); |
| 315 | 329 | } |
| ... | ... | @@ -320,9 +334,18 @@ public class BasicData { |
| 320 | 334 | |
| 321 | 335 | lineId2CodeMap = biMap; |
| 322 | 336 | lineCode2NameMap = code2name; |
| 337 | + lineName2CodeMap = name2code; | |
| 323 | 338 | lineId2ShangHaiCodeMap = id2SHcode; |
| 324 | 339 | lineCode2ShangHaiCodeMap = code2SHcode; |
| 325 | 340 | stationName2YgcNumber = tempStationName2YgcNumber; |
| 341 | + | |
| 342 | + Map<String, String> code2nameAll = new HashMap<>(); | |
| 343 | + Iterator<Line> iteratorAll = lineRepository.findAll().iterator(); | |
| 344 | + while (iteratorAll.hasNext()) { | |
| 345 | + line = iteratorAll.next(); | |
| 346 | + code2nameAll.put(line.getLineCode(), line.getName()); | |
| 347 | + } | |
| 348 | + lineCodeAllNameMap=code2nameAll; | |
| 326 | 349 | } |
| 327 | 350 | |
| 328 | 351 | /** | ... | ... |
src/main/java/com/bsth/repository/calc/CalcWaybillAuditRepository.java
0 → 100644
| 1 | +package com.bsth.repository.calc; | |
| 2 | + | |
| 3 | +import com.bsth.entity.calc.CalcWaybillAudit; | |
| 4 | +import com.bsth.repository.BaseRepository; | |
| 5 | +import org.springframework.data.jpa.repository.Modifying; | |
| 6 | +import org.springframework.data.jpa.repository.Query; | |
| 7 | +import org.springframework.data.repository.query.Param; | |
| 8 | +import org.springframework.stereotype.Repository; | |
| 9 | +import javax.transaction.Transactional; | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | + | |
| 13 | +@Repository | |
| 14 | +public interface CalcWaybillAuditRepository extends BaseRepository<CalcWaybillAudit, Integer>{ | |
| 15 | + | |
| 16 | + @Query(value="select DISTINCT c from CalcWaybillAudit c where c.rq between :date and :date2 and (:gsbm IS NULL OR c.gsbm = :gsbm) and (:fgsbm IS NULL OR c.fgsbm = :fgsbm) and (:lineCode IS NULL OR c.lineCode = :lineCode) and (:nbbm IS NULL OR c.nbbm = :nbbm)") | |
| 17 | + List<CalcWaybillAudit> auditReport(@Param("date")String date,@Param("date2")String date2,@Param("gsbm")String gsbm,@Param("fgsbm")String fgsbm,@Param("lineCode") String lineCode, @Param("nbbm") String nbbm); | |
| 18 | + | |
| 19 | + | |
| 20 | + @Transactional | |
| 21 | + @Modifying | |
| 22 | + @Query(value="delete from calc_waybill_audit where rq = ?1", nativeQuery=true) | |
| 23 | + void delete(String date); | |
| 24 | + | |
| 25 | + | |
| 26 | +} | ... | ... |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| ... | ... | @@ -9,6 +9,7 @@ import org.springframework.data.jpa.domain.Specification; |
| 9 | 9 | import org.springframework.data.jpa.repository.EntityGraph; |
| 10 | 10 | import org.springframework.data.jpa.repository.Modifying; |
| 11 | 11 | import org.springframework.data.jpa.repository.Query; |
| 12 | +import org.springframework.data.repository.query.Param; | |
| 12 | 13 | import org.springframework.stereotype.Repository; |
| 13 | 14 | |
| 14 | 15 | import javax.transaction.Transactional; |
| ... | ... | @@ -244,4 +245,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 244 | 245 | @Override |
| 245 | 246 | List<ScheduleRealInfo> findAll(); |
| 246 | 247 | |
| 248 | + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | |
| 249 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr = :date order by s.xlDir,s.realExecDate,s.fcsj, s.lpName") | |
| 250 | + List<ScheduleRealInfo> auditReport(@Param("date")String date); | |
| 251 | + | |
| 252 | + | |
| 247 | 253 | } | ... | ... |
src/main/java/com/bsth/service/calc/CalcWaybillAuditService.java
0 → 100644
| 1 | +package com.bsth.service.calc; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 5 | + | |
| 6 | +import java.util.List; | |
| 7 | +import java.util.Map; | |
| 8 | + | |
| 9 | + | |
| 10 | +public interface CalcWaybillAuditService { | |
| 11 | + | |
| 12 | + List<Map<String,Object>> auditReport(String gsdm, String fgsdm, String date, String date2, String line, String nbbm, String type, String xlName); | |
| 13 | + | |
| 14 | + //计算各类班次型空驶公里 | |
| 15 | + Map<String, Double> culateksgl(List<ScheduleRealInfo> lists); | |
| 16 | + | |
| 17 | + List<Map<String, String>> carList(); | |
| 18 | + | |
| 19 | + void create(String date); | |
| 20 | +} | ... | ... |
src/main/java/com/bsth/service/calc/impl/CalcWaybillAuditServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.calc.impl; | |
| 2 | + | |
| 3 | +import com.bsth.data.BasicData; | |
| 4 | +import com.bsth.entity.Cars; | |
| 5 | +import com.bsth.entity.calc.CalcWaybillAudit; | |
| 6 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | |
| 7 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 8 | +import com.bsth.repository.calc.CalcWaybillAuditRepository; | |
| 9 | +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | |
| 10 | +import com.bsth.service.calc.CalcWaybillAuditService; | |
| 11 | +import com.bsth.service.report.CulateMileageService; | |
| 12 | +import com.bsth.util.Arith; | |
| 13 | +import com.bsth.util.ReportUtils; | |
| 14 | +import com.github.stuxuhai.jpinyin.PinyinException; | |
| 15 | +import com.github.stuxuhai.jpinyin.PinyinFormat; | |
| 16 | +import com.github.stuxuhai.jpinyin.PinyinHelper; | |
| 17 | +import org.slf4j.Logger; | |
| 18 | +import org.slf4j.LoggerFactory; | |
| 19 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 20 | +import org.springframework.scheduling.annotation.Scheduled; | |
| 21 | +import org.springframework.stereotype.Component; | |
| 22 | +import org.springframework.stereotype.Service; | |
| 23 | +import java.text.SimpleDateFormat; | |
| 24 | +import java.time.LocalDate; | |
| 25 | +import java.time.format.DateTimeFormatter; | |
| 26 | +import java.util.*; | |
| 27 | +import java.util.stream.Collectors; | |
| 28 | + | |
| 29 | + | |
| 30 | +@Component | |
| 31 | +@Service | |
| 32 | +public class CalcWaybillAuditServiceImpl implements CalcWaybillAuditService { | |
| 33 | + | |
| 34 | + @Autowired | |
| 35 | + ScheduleRealInfoRepository scheduleRealInfoRepository; | |
| 36 | + | |
| 37 | + @Autowired | |
| 38 | + CalcWaybillAuditRepository calcWaybillAuditRepository; | |
| 39 | + | |
| 40 | + @Autowired | |
| 41 | + CulateMileageService culateService; | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 47 | + | |
| 48 | + | |
| 49 | + //统计3天前的数据 | |
| 50 | + @Scheduled(cron = "0 0 2 * * *") | |
| 51 | + public void clear() { | |
| 52 | + LocalDate dateTime = LocalDate.now().minusDays(3); | |
| 53 | + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | |
| 54 | +/* dateTime= LocalDate.parse("2025-03-03",formatter);*/ | |
| 55 | + String date = dateTime.format(formatter); | |
| 56 | + this.create(date); | |
| 57 | + } | |
| 58 | + | |
| 59 | + //数据统计 | |
| 60 | + @Override | |
| 61 | + public void create(String date) { | |
| 62 | + List<CalcWaybillAudit> list = new ArrayList<>(); | |
| 63 | + //查询数据 | |
| 64 | + List<ScheduleRealInfo> listAll = scheduleRealInfoRepository.auditReport(date); | |
| 65 | + //按车辆分组 | |
| 66 | + Map<String, List<ScheduleRealInfo>> data=listAll.stream().collect(Collectors.groupingBy(sch-> sch.getScheduleDateStr()+"-"+sch.getXlBm()+"-"+sch.getClZbh())); | |
| 67 | + data.forEach((k,v)->{ | |
| 68 | + CalcWaybillAudit c=new CalcWaybillAudit(); | |
| 69 | + c.setRq(v.get(0).getScheduleDateStr()); | |
| 70 | + c.setLineCode(v.get(0).getXlBm()); | |
| 71 | + c.setLineName(v.get(0).getXlName()); | |
| 72 | + c.setNbbm(v.get(0).getClZbh()); | |
| 73 | + double sjyygl=culateService.culateSjgl(v);//实际营运公里 | |
| 74 | + double ljgl = culateService.culateLjgl(v);//临加公里 | |
| 75 | + c.setYylc(Arith.add(sjyygl,ljgl)); | |
| 76 | + Map<String, Double> ks=this.culateksgl(v); | |
| 77 | + c.setInlc(ks.get("in")); | |
| 78 | + c.setOutlc(ks.get("out")); | |
| 79 | + c.setKslc(ks.get("ksgl")); | |
| 80 | + c.setZkslc(ks.get("zksgl")); | |
| 81 | + c.setZlc(Arith.add(Arith.add(sjyygl,ljgl),ks.get("zksgl"))); | |
| 82 | + c.setFgsbm(v.get(0).getFgsBm()); | |
| 83 | + c.setFgsName(v.get(0).getFgsName()); | |
| 84 | + c.setGsbm(v.get(0).getGsBm()); | |
| 85 | + c.setGsName(v.get(0).getGsName()); | |
| 86 | + list.add(c); | |
| 87 | + }); | |
| 88 | + if(!list.isEmpty()){ | |
| 89 | + calcWaybillAuditRepository.delete(date); | |
| 90 | + calcWaybillAuditRepository.save(list); | |
| 91 | + } | |
| 92 | + } | |
| 93 | + | |
| 94 | + //汇总生成报表 | |
| 95 | + @Override | |
| 96 | + public List<Map<String, Object>> auditReport(String gsdm,String fgsdm,String date, String date2, | |
| 97 | + String line,String nbbm, String type, String xlName) { | |
| 98 | + List<Map<String, Object>> lMap = new ArrayList<>(); | |
| 99 | + //查询数据 | |
| 100 | + List<CalcWaybillAudit> listAll = calcWaybillAuditRepository.auditReport(date, date2,gsdm,fgsdm, line, nbbm); | |
| 101 | + //按车辆分组 | |
| 102 | + Map<String, List<CalcWaybillAudit>> data=listAll.stream().collect(Collectors.groupingBy(audit-> audit.getLineCode()+"-"+audit.getNbbm())); | |
| 103 | + data.forEach((k,v)->{ | |
| 104 | + Map<String, Object> resMap = new HashMap<>(); | |
| 105 | + Map<String,Double> sum=sum(v); | |
| 106 | + resMap.put("lineName", v.get(0).getLineName()); | |
| 107 | + String clzbh=v.get(0).getNbbm(); | |
| 108 | + resMap.put("plate", BasicData.nbbmCompanyPlateMap.get(clzbh)!=null?BasicData.nbbmCompanyPlateMap.get(clzbh):""); | |
| 109 | + Cars car=BasicData.nbbm2CarMap.get(clzbh); | |
| 110 | + resMap.put("carClass",car!=null&&car.getCarClass()!=null? car.getCarClass():""); | |
| 111 | + resMap.put("sfdc",car!=null&&car.getSfdc()!=null? (car.getSfdc()==true?"是":"否"):""); | |
| 112 | + resMap.put("sfmix",car!=null&&car.getSfmix()!=null? (car.getSfmix()==true?"是":"否"):""); | |
| 113 | + resMap.put("yylc", sum.get("yylc")); | |
| 114 | + resMap.put("in", sum.get("inlc")); | |
| 115 | + resMap.put("out", sum.get("outlc")); | |
| 116 | + resMap.put("kslc", sum.get("kslc")); | |
| 117 | + resMap.put("zkslc", sum.get("zkslc")); | |
| 118 | + resMap.put("zlc", sum.get("zlc")); | |
| 119 | + resMap.put("fgsBm", v.get(0).getFgsbm()); | |
| 120 | + resMap.put("xlBm", v.get(0).getLineCode()); | |
| 121 | + resMap.put("fgsName", v.get(0).getFgsName()); | |
| 122 | + try { | |
| 123 | + resMap.put("xlNamePy", PinyinHelper.convertToPinyinString(v.get(0).getFgsbm()+v.get(0).getLineName(), "", PinyinFormat.WITHOUT_TONE)); | |
| 124 | + } catch (PinyinException e) { | |
| 125 | + // TODO Auto-generated catch block | |
| 126 | + e.printStackTrace(); | |
| 127 | + } | |
| 128 | + lMap.add(resMap); | |
| 129 | + }); | |
| 130 | + | |
| 131 | + Collections.sort(lMap, new AccountXlbm()); | |
| 132 | + if (type != null && type.length() != 0 && type.equals("export")) { | |
| 133 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 134 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 135 | + List<Iterator<?>> listI = new ArrayList<>(); | |
| 136 | + Map<String, Object> m = new HashMap<>(); | |
| 137 | + m.put("date", date + "至" + date2); | |
| 138 | + ReportUtils ee = new ReportUtils(); | |
| 139 | + try { | |
| 140 | + String dateTime = ""; | |
| 141 | + if (date.equals(date2)) { | |
| 142 | + dateTime = sdfSimple.format(sdfMonth.parse(date)); | |
| 143 | + } else { | |
| 144 | + dateTime = sdfSimple.format(sdfMonth.parse(date)) | |
| 145 | + + "-" + sdfSimple.format(sdfMonth.parse(date2)); | |
| 146 | + } | |
| 147 | + listI.add(lMap.iterator()); | |
| 148 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 149 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/auditReport.xls", | |
| 150 | + path + "export/" + dateTime + "-" + xlName + "-路单审计.xls"); | |
| 151 | + } catch (Exception e) { | |
| 152 | + logger.error("", e); | |
| 153 | + } | |
| 154 | + } | |
| 155 | + | |
| 156 | + return lMap; | |
| 157 | + } | |
| 158 | + | |
| 159 | + //求和 | |
| 160 | + public static Map<String,Double> sum(List<CalcWaybillAudit> lists) { | |
| 161 | + Map<String,Double> sum=new HashMap<>(); | |
| 162 | + double yylc=0; | |
| 163 | + double inlc=0; | |
| 164 | + double outlc=0; | |
| 165 | + double kslc=0; | |
| 166 | + double zkslc=0; | |
| 167 | + double zlc=0; | |
| 168 | + | |
| 169 | + for (int i = 0; i < lists.size(); i++) { | |
| 170 | + CalcWaybillAudit audit=lists.get(i); | |
| 171 | + yylc=Arith.add(yylc,audit.getYylc()); | |
| 172 | + inlc=Arith.add(inlc,audit.getInlc()); | |
| 173 | + outlc=Arith.add(outlc,audit.getOutlc()); | |
| 174 | + kslc=Arith.add(kslc,audit.getKslc()); | |
| 175 | + zkslc=Arith.add(zkslc,audit.getZkslc()); | |
| 176 | + zlc=Arith.add(zlc,audit.getZlc()); | |
| 177 | + } | |
| 178 | + sum.put("yylc",yylc); | |
| 179 | + sum.put("inlc",inlc); | |
| 180 | + sum.put("outlc",outlc); | |
| 181 | + sum.put("kslc",kslc); | |
| 182 | + sum.put("zkslc",zkslc); | |
| 183 | + sum.put("zlc",zlc); | |
| 184 | + return sum; | |
| 185 | + } | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + //计算少驶里程 | |
| 190 | + //"normal-正常班次、out-出场、in-进场、region-区间、venting-放空班次、major-放站班次、ldks-两点间空驶" | |
| 191 | + @Override | |
| 192 | + public Map<String, Double> culateksgl(List<ScheduleRealInfo> lists) { | |
| 193 | + Map<String, Double> result=new HashMap<>(); | |
| 194 | + double out =0; | |
| 195 | + double in =0; | |
| 196 | + double venting =0; | |
| 197 | + double major =0; | |
| 198 | + double ldks =0; | |
| 199 | + double normal =0; | |
| 200 | + double region =0; | |
| 201 | + double ksgl =0;//除进出场以外的空驶 | |
| 202 | + double zksgl =0; | |
| 203 | + for (int i = 0; i < lists.size(); i++) { | |
| 204 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | |
| 205 | + if (scheduleRealInfo.getBcType().equals("in")) { | |
| 206 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 207 | + if(childTaskPlans.isEmpty()){ | |
| 208 | + if(!scheduleRealInfo.isDestroy()) | |
| 209 | + in =Arith.add(in, scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc()); | |
| 210 | + }else{ | |
| 211 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 212 | + while (it.hasNext()) { | |
| 213 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 214 | + if(childTaskPlan.getMileageType().equals("empty") && childTaskPlan.getCcId()==null){ | |
| 215 | + if (!childTaskPlan.isDestroy()) { | |
| 216 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | |
| 217 | + in=Arith.add(in,jhgl); | |
| 218 | + } | |
| 219 | + } | |
| 220 | + } | |
| 221 | + } | |
| 222 | + }else if (scheduleRealInfo.getBcType().equals("out")) { | |
| 223 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 224 | + if(childTaskPlans.isEmpty()){ | |
| 225 | + if(!scheduleRealInfo.isDestroy()) | |
| 226 | + out =Arith.add(out, scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc()); | |
| 227 | + }else{ | |
| 228 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 229 | + while (it.hasNext()) { | |
| 230 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 231 | + if(childTaskPlan.getMileageType().equals("empty") && childTaskPlan.getCcId()==null){ | |
| 232 | + if (!childTaskPlan.isDestroy()) { | |
| 233 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | |
| 234 | + out=Arith.add(out,jhgl); | |
| 235 | + } | |
| 236 | + } | |
| 237 | + } | |
| 238 | + } | |
| 239 | + }else if (scheduleRealInfo.getBcType().equals("venting")) { | |
| 240 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 241 | + if(childTaskPlans.isEmpty()){ | |
| 242 | + if(!scheduleRealInfo.isDestroy()) | |
| 243 | + venting =Arith.add(venting, scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc()); | |
| 244 | + }else{ | |
| 245 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 246 | + while (it.hasNext()) { | |
| 247 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 248 | + if(childTaskPlan.getMileageType().equals("empty") && childTaskPlan.getCcId()==null){ | |
| 249 | + if (!childTaskPlan.isDestroy()) { | |
| 250 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | |
| 251 | + venting=Arith.add(venting,jhgl); | |
| 252 | + } | |
| 253 | + } | |
| 254 | + } | |
| 255 | + } | |
| 256 | + }else if (scheduleRealInfo.getBcType().equals("major")) { | |
| 257 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 258 | + if(childTaskPlans.isEmpty()){ | |
| 259 | + if(!scheduleRealInfo.isDestroy()) | |
| 260 | + major =Arith.add(major, scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc()); | |
| 261 | + }else{ | |
| 262 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 263 | + while (it.hasNext()) { | |
| 264 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 265 | + if(childTaskPlan.getMileageType().equals("empty") && childTaskPlan.getCcId()==null){ | |
| 266 | + if (!childTaskPlan.isDestroy()) { | |
| 267 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | |
| 268 | + major=Arith.add(major,jhgl); | |
| 269 | + } | |
| 270 | + } | |
| 271 | + } | |
| 272 | + } | |
| 273 | + }else if (scheduleRealInfo.getBcType().equals("ldks")) { | |
| 274 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 275 | + if(childTaskPlans.isEmpty()){ | |
| 276 | + if(!scheduleRealInfo.isDestroy()) | |
| 277 | + ldks =Arith.add(ldks, scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc()); | |
| 278 | + }else{ | |
| 279 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 280 | + while (it.hasNext()) { | |
| 281 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 282 | + if(childTaskPlan.getMileageType().equals("empty") && childTaskPlan.getCcId()==null){ | |
| 283 | + if (!childTaskPlan.isDestroy()) { | |
| 284 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | |
| 285 | + ldks=Arith.add(ldks,jhgl); | |
| 286 | + } | |
| 287 | + } | |
| 288 | + } | |
| 289 | + } | |
| 290 | + }else if (scheduleRealInfo.getBcType().equals("normal")) { | |
| 291 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 292 | + if(!childTaskPlans.isEmpty()){ | |
| 293 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 294 | + while (it.hasNext()) { | |
| 295 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 296 | + if(childTaskPlan.getMileageType().equals("empty") && childTaskPlan.getCcId()==null){ | |
| 297 | + if (!childTaskPlan.isDestroy()) { | |
| 298 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | |
| 299 | + normal=Arith.add(normal,jhgl); | |
| 300 | + } | |
| 301 | + } | |
| 302 | + } | |
| 303 | + } | |
| 304 | + }else if (scheduleRealInfo.getBcType().equals("region")) { | |
| 305 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 306 | + if(!childTaskPlans.isEmpty()){ | |
| 307 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 308 | + while (it.hasNext()) { | |
| 309 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 310 | + if(childTaskPlan.getMileageType().equals("empty") && childTaskPlan.getCcId()==null){ | |
| 311 | + if (!childTaskPlan.isDestroy()) { | |
| 312 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | |
| 313 | + region=Arith.add(region,jhgl); | |
| 314 | + } | |
| 315 | + } | |
| 316 | + } | |
| 317 | + } | |
| 318 | + } | |
| 319 | + } | |
| 320 | + ksgl =Arith.add(Arith.add(Arith.add(Arith.add(venting,major),ldks),normal),region); | |
| 321 | + zksgl=Arith.add(Arith.add(ksgl,in),out); | |
| 322 | + result.put("out",out); | |
| 323 | + result.put("in",in); | |
| 324 | + result.put("venting",venting); | |
| 325 | + result.put("major",major); | |
| 326 | + result.put("in",in); | |
| 327 | + result.put("ldks",ldks); | |
| 328 | + result.put("normal",normal); | |
| 329 | + result.put("region",region); | |
| 330 | + result.put("ksgl",ksgl); | |
| 331 | + result.put("zksgl",zksgl); | |
| 332 | + return result; | |
| 333 | + } | |
| 334 | + | |
| 335 | + @Override | |
| 336 | + public List<Map<String, String>> carList() { | |
| 337 | + List<Map<String, String>> list=new ArrayList<>(); | |
| 338 | + Map<String, Cars> cars=BasicData.nbbm2CarMap; | |
| 339 | + Iterator<String> iterator = cars.keySet().iterator(); | |
| 340 | + String key; | |
| 341 | + while (iterator.hasNext()) { | |
| 342 | + Map<String, String> map = new HashMap<>(); | |
| 343 | + key = iterator.next(); | |
| 344 | + Cars car=cars.get(key); | |
| 345 | + map.put("nbbm", car.getInsideCode()); | |
| 346 | + map.put("carPlate", car.getCarPlate()); | |
| 347 | + map.put("gsbm", car.getBusinessCode()); | |
| 348 | + map.put("fgsbm", car.getBrancheCompanyCode()); | |
| 349 | + list.add(map); | |
| 350 | + } | |
| 351 | + return list; | |
| 352 | + } | |
| 353 | + | |
| 354 | + class AccountXlbm implements Comparator<Map<String, Object>> { | |
| 355 | + @Override | |
| 356 | + public int compare(Map<String, Object> o1, Map<String, Object> o2) { | |
| 357 | + return o1.get("xlNamePy").toString().compareTo( | |
| 358 | + o2.get("xlNamePy").toString()); | |
| 359 | + } | |
| 360 | + } | |
| 361 | +} | |
| 362 | + | |
| 363 | + | |
| 364 | + | ... | ... |
src/main/resources/static/pages/forms/mould/auditReport.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/auditReport.html
0 → 100644
| 1 | +<style type="text/css"> | |
| 2 | + .table-bordered { | |
| 3 | + border: 1px solid; } | |
| 4 | + .table-bordered > thead > tr > th, | |
| 5 | + .table-bordered > thead > tr > td, | |
| 6 | + .table-bordered > tbody > tr > th, | |
| 7 | + .table-bordered > tbody > tr > td, | |
| 8 | + .table-bordered > tfoot > tr > th, | |
| 9 | + .table-bordered > tfoot > tr > td { | |
| 10 | + border: 1px solid; } | |
| 11 | + .table-bordered > thead > tr > th, | |
| 12 | + .table-bordered > thead > tr > td { | |
| 13 | + border-bottom-width: 2px; } | |
| 14 | + | |
| 15 | + .table > tbody + tbody { | |
| 16 | + border-top: 1px solid; } | |
| 17 | + | |
| 18 | + #forms > thead > tr> td >span{ | |
| 19 | + width: 5px; | |
| 20 | + word-wrap: break-word; | |
| 21 | + letter-spacing: 20px; | |
| 22 | + } | |
| 23 | + | |
| 24 | + #forms > thead > tr> td >label{ | |
| 25 | + word-break: keep-all;white-space:nowrap; | |
| 26 | + } | |
| 27 | +</style> | |
| 28 | + | |
| 29 | +<div class="page-head"> | |
| 30 | + <div class="page-title"> | |
| 31 | + <h1>路单审计</h1> | |
| 32 | + </div> | |
| 33 | +</div> | |
| 34 | + | |
| 35 | +<!-- <div class="row"> --> | |
| 36 | + <div class="col-md-12 portlet light porttlet-fit bordered" style="height:calc(100% - 56px)"> | |
| 37 | +<!-- <div> --> | |
| 38 | + <div class="portlet-title"> | |
| 39 | + <form class="form-inline" action=""> | |
| 40 | + <div style="display: inline-block;margin-left: 29px; " id="gsdmDiv"> | |
| 41 | + <span class="item-label" style="width: 80px;">公司: </span> | |
| 42 | + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select> | |
| 43 | + </div> | |
| 44 | + <div style="display: inline-block; margin-left: 29px;" id="fgsdmDiv"> | |
| 45 | + <span class="item-label" style="width: 80px;">分公司: </span> | |
| 46 | + <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select> | |
| 47 | + </div> | |
| 48 | + <div style="display: inline-block;margin-left: 42px;"> | |
| 49 | + <span class="item-label" style="width: 80px;">线路: </span> | |
| 50 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | |
| 51 | + </div> | |
| 52 | + <div style="display: inline-block;margin-left: 42px;"> | |
| 53 | + <span class="item-label" style="width: 80px;">车辆: </span> | |
| 54 | + <select class="form-control" name="car" id="car" style="width: 180px;"></select> | |
| 55 | + </div> | |
| 56 | + <div style="margin-top: 3px"></div> | |
| 57 | + <div style="display: inline-block;margin-left: 15px;"> | |
| 58 | + <span class="item-label" style="width: 80px;">开始时间: </span> | |
| 59 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | |
| 60 | + </div> | |
| 61 | + <div style="display: inline-block;margin-left: 15px;"> | |
| 62 | + <span class="item-label" style="width: 80px;">结束时间: </span> | |
| 63 | + <input class="form-control" type="text" id="date2" style="width: 180px;"/> | |
| 64 | + </div> | |
| 65 | + <div class="form-group"> | |
| 66 | + <input class="btn btn-default" type="button" id="query" value="查询"/> | |
| 67 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | |
| 68 | + <input class="btn btn-default" type="button" id="create" value="生成" style="display: none;"/> | |
| 69 | + </div> | |
| 70 | + </form> | |
| 71 | + </div> | |
| 72 | + <div class="portlet-body" id="tjrbBody" style="overflow:auto;height: calc(100% - 80px)"> | |
| 73 | + <div class="table-container" style="margin-top: 10px;min-width: 906px"> | |
| 74 | +<!-- <label>早高峰:6:31~8:30 晚高峰:16:01~18:00</label>--> | |
| 75 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | |
| 76 | + <thead> | |
| 77 | + <tr> | |
| 78 | + <th colspan="46"><label id="tjrq"></label> 路单审计</th> | |
| 79 | + </tr> | |
| 80 | + <tr> | |
| 81 | + <td rowspan="4"><label>线路</label></td> | |
| 82 | + <td rowspan="3"><label>车牌号</label></td> | |
| 83 | + <td rowspan="3"><label>车型类别</label></td> | |
| 84 | + <td rowspan="3"><label>电车</label></td> | |
| 85 | + <td rowspan="3"><label>混合电车</label></td> | |
| 86 | + <td rowspan="3"><label>营运里程</label></td> | |
| 87 | + <td rowspan="3"><label>进场</label></td> | |
| 88 | + <td rowspan="2"><label>出场</label> | |
| 89 | + <td rowspan="2"><label>空驶</label></td> | |
| 90 | + <td rowspan="2"><label>总空驶</label></td> | |
| 91 | + <td rowspan="2"><label>总里程</label></td> | |
| 92 | + </tr> | |
| 93 | + </thead> | |
| 94 | + <tbody class="statisticsDailyCalc2"> | |
| 95 | + | |
| 96 | + </tbody> | |
| 97 | + </table> | |
| 98 | + </div> | |
| 99 | + </div> | |
| 100 | + </div> | |
| 101 | + | |
| 102 | +<script> | |
| 103 | + $(function(){ | |
| 104 | + $('#export').attr('disabled', "true"); | |
| 105 | + | |
| 106 | + // 关闭左侧栏 | |
| 107 | + if (!$('body').hasClass('page-sidebar-closed')) | |
| 108 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 109 | + | |
| 110 | + var d = new Date(); | |
| 111 | + d.setTime(d.getTime() - 4*1000*60*60*24); | |
| 112 | + var year = d.getFullYear(); | |
| 113 | + var month = d.getMonth() + 1; | |
| 114 | + var day = d.getDate(); | |
| 115 | + if(month < 10) | |
| 116 | + month = "0" + month; | |
| 117 | + if(day < 10) | |
| 118 | + day = "0" + day; | |
| 119 | + var dateTime = year + "-" + month + "-" + day; | |
| 120 | + $("#date").datetimepicker({ | |
| 121 | + format : 'YYYY-MM-DD', | |
| 122 | + locale : 'zh-cn', | |
| 123 | + maxDate : dateTime | |
| 124 | + }); | |
| 125 | + $("#date2").datetimepicker({ | |
| 126 | + format : 'YYYY-MM-DD', | |
| 127 | + locale : 'zh-cn', | |
| 128 | + maxDate : dateTime | |
| 129 | + }); | |
| 130 | + $("#date").val(dateTime); | |
| 131 | + $("#date2").val(dateTime); | |
| 132 | + | |
| 133 | + | |
| 134 | + var fage=true; | |
| 135 | + var obj = []; | |
| 136 | + var xlList; | |
| 137 | + $.get('/report/lineList',function(result){ | |
| 138 | + xlList=result; | |
| 139 | + $.get('/user/companyData', function(result){ | |
| 140 | + obj = result; | |
| 141 | + var options = '<option value="">请选择</option>'; | |
| 142 | + for(var i = 0; i < obj.length; i++){ | |
| 143 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | |
| 144 | + } | |
| 145 | + | |
| 146 | + if(obj.length ==0){ | |
| 147 | + $("#gsdmDiv").css('display','none'); | |
| 148 | + }else if(obj.length ==1){ | |
| 149 | + $("#gsdmDiv").css('display','none'); | |
| 150 | + if(obj[0].children.length == 1 || obj[0].children.length ==0){ | |
| 151 | + fage=false; | |
| 152 | + $('#fgsdmDiv').css('display','none'); | |
| 153 | + } | |
| 154 | + } | |
| 155 | + $('#gsdm').html(options); | |
| 156 | + updateCompany(); | |
| 157 | + }); | |
| 158 | + }) | |
| 159 | + $("#gsdm").on("change",updateCompany); | |
| 160 | + function updateCompany(){ | |
| 161 | + var company = $('#gsdm').val(); | |
| 162 | + var options = ''; | |
| 163 | + if(fage){ | |
| 164 | + options = '<option value="">请选择</option>'; | |
| 165 | + } | |
| 166 | + for(var i = 0; i < obj.length; i++){ | |
| 167 | + if(obj[i].companyCode == company){ | |
| 168 | + var children = obj[i].children; | |
| 169 | + for(var j = 0; j < children.length; j++){ | |
| 170 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | |
| 171 | + } | |
| 172 | + } | |
| 173 | + } | |
| 174 | + $('#fgsdm').html(options); | |
| 175 | + } | |
| 176 | + | |
| 177 | + var tempData = {}; | |
| 178 | + $.get('/report/lineList',function(xlList){ | |
| 179 | + var data = []; | |
| 180 | + data.push({id: " ", text: "全部线路"}); | |
| 181 | + $.get('/user/companyData', function(result){ | |
| 182 | + for(var i = 0; i < result.length; i++){ | |
| 183 | + var companyCode = result[i].companyCode; | |
| 184 | + var children = result[i].children; | |
| 185 | + for(var j = 0; j < children.length; j++){ | |
| 186 | + var code = children[j].code; | |
| 187 | + for(var k=0;k < xlList.length;k++ ){ | |
| 188 | + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | |
| 189 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | |
| 190 | + tempData[xlList[k]["xlbm"]] = companyCode+":"+code; | |
| 191 | + } | |
| 192 | + } | |
| 193 | + } | |
| 194 | + } | |
| 195 | + initPinYinSelect2('#line',data,''); | |
| 196 | + | |
| 197 | + }); | |
| 198 | + }); | |
| 199 | + | |
| 200 | + $.get('/auditReport/queryCarList',function(carList){ | |
| 201 | + var data = []; | |
| 202 | + data.push({id: " ", text: "全部车辆"}); | |
| 203 | + $.get('/user/companyData', function(result){ | |
| 204 | + for(var i = 0; i < result.length; i++){ | |
| 205 | + var companyCode = result[i].companyCode; | |
| 206 | + var children = result[i].children; | |
| 207 | + for(var j = 0; j < children.length; j++){ | |
| 208 | + var code = children[j].code; | |
| 209 | + for(var k=0;k < carList.length;k++ ){ | |
| 210 | + if(carList[k]["fgsbm"]==code && carList[k]["gsbm"]==companyCode){ | |
| 211 | + data.push({id: carList[k]["nbbm"], text: carList[k]["carPlate"]}); | |
| 212 | + } | |
| 213 | + } | |
| 214 | + } | |
| 215 | + } | |
| 216 | + initPinYinSelect2('#car',data,''); | |
| 217 | + }); | |
| 218 | + }); | |
| 219 | + | |
| 220 | + $("#line").on("change", function(){ | |
| 221 | + if($("#line").val() == " "){ | |
| 222 | + $("#gsdm").attr("disabled", false); | |
| 223 | + $("#fgsdm").attr("disabled", false); | |
| 224 | + } else { | |
| 225 | + var temp = tempData[$("#line").val()].split(":"); | |
| 226 | + $("#gsdm").val(temp[0]); | |
| 227 | + updateCompany(); | |
| 228 | + $("#fgsdm").val(temp[1]); | |
| 229 | + $("#gsdm").attr("disabled", true); | |
| 230 | + $("#fgsdm").attr("disabled", true); | |
| 231 | + } | |
| 232 | + }); | |
| 233 | + | |
| 234 | + | |
| 235 | + var line =""; | |
| 236 | + var xlName =""; | |
| 237 | + var date = ""; | |
| 238 | + var date2 =""; | |
| 239 | + var gsdm=""; | |
| 240 | + var fgsdm=""; | |
| 241 | + var nbbm=""; | |
| 242 | + $("#query").on("click",function(){ | |
| 243 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | |
| 244 | + layer.msg("请选择时间范围!"); | |
| 245 | + return; | |
| 246 | + } | |
| 247 | + if($("#date2").val() == null || $("#date2").val().trim().length == 0){ | |
| 248 | + layer.msg("请选择时间范围!"); | |
| 249 | + return; | |
| 250 | + } | |
| 251 | + line = $("#line").val(); | |
| 252 | + date = $("#date").val(); | |
| 253 | + date2 =$("#date2").val(); | |
| 254 | + if(getDateDifference(date, date2)>365){ | |
| 255 | + layer.msg("单次查询最多不超过365天!"); | |
| 256 | + return; | |
| 257 | + } | |
| 258 | + gsdm =$("#gsdm").val(); | |
| 259 | + fgsdm=$("#fgsdm").val(); | |
| 260 | + nbbm = $("#car").val(); | |
| 261 | + xlName = $("#select2-line-container").html(); | |
| 262 | + if(xlName == "全部线路") | |
| 263 | + xlName = $('#fgsdm option:selected').text(); | |
| 264 | + if(xlName =='请选择') | |
| 265 | + xlName = $('#gsdm option:selected').text(); | |
| 266 | + if(line=="请选择"){ | |
| 267 | + line=""; | |
| 268 | + } | |
| 269 | + if(date==null || date =="" ||date2==null || date2 ==""){ | |
| 270 | + layer.msg('请选择时间段.'); | |
| 271 | + }else{ | |
| 272 | + $("#tjrq").html(date+"至"+date2); | |
| 273 | + var params = {}; | |
| 274 | + params['gsdm'] = gsdm; | |
| 275 | + params['fgsdm'] =fgsdm ; | |
| 276 | + params['line'] = line; | |
| 277 | + params['date'] = date; | |
| 278 | + params['date2'] = date2; | |
| 279 | + params['xlName'] = xlName; | |
| 280 | + params['nbbm'] = nbbm; | |
| 281 | + params['type'] = "query"; | |
| 282 | + var i = layer.load(2); | |
| 283 | + $get('/auditReport/queryList',params,function(result){ | |
| 284 | + console.log(result); | |
| 285 | + // 把数据填充到模版中 | |
| 286 | + var tbodyHtml = template('statisticsDailyCalc2',{list:result}); | |
| 287 | + // 把渲染好的模版html文本追加到表格中 | |
| 288 | + $('#forms .statisticsDailyCalc2').html(tbodyHtml); | |
| 289 | + layer.close(i); | |
| 290 | + if(result.length == 0) | |
| 291 | + $("#export").attr('disabled',"true"); | |
| 292 | + else | |
| 293 | + $("#export").removeAttr("disabled"); | |
| 294 | + }); | |
| 295 | + } | |
| 296 | + | |
| 297 | + }); | |
| 298 | +// $("#tjrbBody").height($(window).height()-100); | |
| 299 | + $("#export").on("click",function(){ | |
| 300 | + if(getDateDifference(date, date2)>365){ | |
| 301 | + layer.msg("单次查询最多不超过365天!"); | |
| 302 | + return; | |
| 303 | + } | |
| 304 | + var params = {}; | |
| 305 | + params['gsdm'] = gsdm; | |
| 306 | + params['fgsdm'] =fgsdm ; | |
| 307 | + params['line'] = line; | |
| 308 | + params['date'] = date; | |
| 309 | + params['date2'] = date2; | |
| 310 | + params['xlName'] = xlName; | |
| 311 | + params['nbbm'] = nbbm; | |
| 312 | + params['type'] = "export"; | |
| 313 | + var i = layer.load(2); | |
| 314 | + $get('/auditReport/queryList',params,function(result){ | |
| 315 | + var dateTime = ""; | |
| 316 | + if(date == date2){ | |
| 317 | + dateTime = moment(date).format("YYYYMMDD"); | |
| 318 | + } else { | |
| 319 | + dateTime = moment(date).format("YYYYMMDD") | |
| 320 | + +"-"+moment(date2).format("YYYYMMDD"); | |
| 321 | + } | |
| 322 | + window.open("/downloadFile/download?fileName=" | |
| 323 | + +dateTime+"-"+xlName+"-路单审计"); | |
| 324 | + layer.close(i); | |
| 325 | + }); | |
| 326 | + }); | |
| 327 | + | |
| 328 | + $("#create").on("click",function(){ | |
| 329 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | |
| 330 | + layer.msg("请选择时间!"); | |
| 331 | + return; | |
| 332 | + } | |
| 333 | + date = $("#date").val(); | |
| 334 | + var params = {}; | |
| 335 | + params['date'] = date; | |
| 336 | + var i = layer.load(2); | |
| 337 | + $get('/auditReport/create',params,function(result){ | |
| 338 | + layer.close(i); | |
| 339 | + layer.msg('生成成功!'); | |
| 340 | + }); | |
| 341 | + }); | |
| 342 | + | |
| 343 | + function getDateDifference(start, end) { | |
| 344 | + const oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数 | |
| 345 | + const startDate = new Date(start); // 转换为Date对象 | |
| 346 | + const endDate = new Date(end); // 转换为Date对象 | |
| 347 | + const diffDays = Math.round(Math.abs((endDate - startDate) / oneDay)); // 计算两个日期的差值,取绝对值并四舍五入 | |
| 348 | + return diffDays; | |
| 349 | + } | |
| 350 | + | |
| 351 | + }); | |
| 352 | +</script> | |
| 353 | +<script type="text/html" id="statisticsDailyCalc2"> | |
| 354 | + {{each list as obj i}} | |
| 355 | + <tr> | |
| 356 | + <td>{{obj.lineName}}</td> | |
| 357 | + <td>{{obj.plate}}</td> | |
| 358 | + <td>{{obj.carClass}}</td> | |
| 359 | + <td>{{obj.sfdc}}</td> | |
| 360 | + <td>{{obj.sfmix}}</td> | |
| 361 | + <td>{{obj.yylc}}</td> | |
| 362 | + <td>{{obj.in}}</td> | |
| 363 | + <td>{{obj.out}}</td> | |
| 364 | + <td>{{obj.kslc}}</td> | |
| 365 | + <td>{{obj.zkslc}}</td> | |
| 366 | + <td>{{obj.zlc}}</td> | |
| 367 | + </tr> | |
| 368 | + {{/each}} | |
| 369 | + {{if list.length == 0}} | |
| 370 | + <tr> | |
| 371 | + <td colspan="46"><h6 class="muted">没有找到相关数据</h6></td> | |
| 372 | + </tr> | |
| 373 | + {{/if}} | |
| 374 | +</script> | |
| 0 | 375 | \ No newline at end of file | ... | ... |