Commit 39baaa329030857230cebab4f2133d3d168362e5
Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control
into pudong
Showing
23 changed files
with
606 additions
and
47 deletions
src/main/java/com/bsth/controller/DownloadController.java
| ... | ... | @@ -19,9 +19,6 @@ import org.springframework.http.MediaType; |
| 19 | 19 | import org.springframework.http.ResponseEntity; |
| 20 | 20 | import org.springframework.stereotype.Component; |
| 21 | 21 | import org.springframework.web.bind.annotation.RequestMapping; |
| 22 | - | |
| 23 | -import com.google.protobuf.UnknownFieldSet.Field; | |
| 24 | -import com.mysql.fabric.Response; | |
| 25 | 22 | |
| 26 | 23 | /** |
| 27 | 24 | * <一句话功能简述> |
| ... | ... | @@ -55,11 +52,12 @@ public class DownloadController |
| 55 | 52 | headers, HttpStatus.CREATED); |
| 56 | 53 | } |
| 57 | 54 | |
| 58 | - @RequestMapping("download") | |
| 55 | + @RequestMapping("download") | |
| 59 | 56 | public void download(HttpServletResponse response,String fileName) |
| 60 | 57 | throws IOException { |
| 61 | 58 | // String fileNames=URLDecoder.decode(fileName,"UTF-8"); |
| 62 | - fileName =fileName + ".xls"; | |
| 59 | + if(!fileName.contains(".xls")) | |
| 60 | + fileName =fileName + ".xls"; | |
| 63 | 61 | String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; |
| 64 | 62 | File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 |
| 65 | 63 | // String filename = file.getName();// 获取日志文件名称 |
| ... | ... | @@ -82,6 +80,7 @@ public class DownloadController |
| 82 | 80 | public void downloadList(HttpServletResponse response,String fileName) |
| 83 | 81 | throws IOException { |
| 84 | 82 | // String fileNames=URLDecoder.decode(fileName,"UTF-8"); |
| 83 | + File files = new File(this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName);// | |
| 85 | 84 | fileName = fileName + ".zip"; |
| 86 | 85 | String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; |
| 87 | 86 | File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 |
| ... | ... | @@ -99,7 +98,8 @@ public class DownloadController |
| 99 | 98 | os.flush(); |
| 100 | 99 | os.close(); |
| 101 | 100 | file.delete(); |
| 102 | - } | |
| 101 | + deleteFiles(files); | |
| 102 | + } | |
| 103 | 103 | |
| 104 | 104 | |
| 105 | 105 | @RequestMapping("downloadModel") |
| ... | ... | @@ -125,4 +125,23 @@ public class DownloadController |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | |
| 128 | + /** | |
| 129 | + * 删除文件夹 | |
| 130 | + * @param files | |
| 131 | + * @return | |
| 132 | + */ | |
| 133 | + public Boolean deleteFiles(File files){ | |
| 134 | + if (files.isDirectory()) { | |
| 135 | + String[] children = files.list(); | |
| 136 | + //递归删除目录中的子目录下 | |
| 137 | + for (int i=0; i<children.length; i++) { | |
| 138 | + boolean success = deleteFiles(new File(files, children[i])); | |
| 139 | + if (!success) { | |
| 140 | + return false; | |
| 141 | + } | |
| 142 | + } | |
| 143 | + } | |
| 144 | + //目录此时为空,可以删除 | |
| 145 | + return files.delete(); | |
| 146 | + } | |
| 128 | 147 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/cache/GpsCacheData.java
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -71,6 +71,8 @@ public class DayOfSchedule { |
| 71 | 71 | // 排序器 |
| 72 | 72 | private static ScheduleComparator.FCSJ schFCSJComparator; |
| 73 | 73 | |
| 74 | + private static Long sch_max_id=-1L; | |
| 75 | + | |
| 74 | 76 | @Autowired |
| 75 | 77 | LineConfigData lineConfigData; |
| 76 | 78 | |
| ... | ... | @@ -330,11 +332,13 @@ public class DayOfSchedule { |
| 330 | 332 | // 转换为实际排班 |
| 331 | 333 | realList = JSONArray.parseArray(JSON.toJSONString(planItr), ScheduleRealInfo.class); |
| 332 | 334 | |
| 335 | + Date d = new Date(); | |
| 333 | 336 | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); |
| 334 | 337 | String fcsj; |
| 335 | 338 | for (ScheduleRealInfo sch : realList) { |
| 336 | 339 | sch.setScheduleDateStr(fmtyyyyMMdd.print(sch.getScheduleDate().getTime())); |
| 337 | 340 | sch.setRealExecDate(sch.getScheduleDateStr()); |
| 341 | + sch.setCreateDate(d); | |
| 338 | 342 | |
| 339 | 343 | if (StringUtils.isEmpty(sch.getFcsj())) |
| 340 | 344 | sch.setFcsj("00:00"); |
| ... | ... | @@ -383,21 +387,28 @@ public class DayOfSchedule { |
| 383 | 387 | return realList; |
| 384 | 388 | } |
| 385 | 389 | |
| 390 | + | |
| 391 | + public synchronized long getId(){ | |
| 392 | + if(sch_max_id==-1){ | |
| 393 | + sch_max_id = schRepository.getMaxId(); | |
| 394 | + if(null == sch_max_id) | |
| 395 | + sch_max_id = 3000L;//留一点空间补数据用 | |
| 396 | + sch_max_id += 5; | |
| 397 | + } | |
| 398 | + else | |
| 399 | + sch_max_id ++; | |
| 400 | + return sch_max_id; | |
| 401 | + } | |
| 402 | + | |
| 386 | 403 | /** |
| 387 | 404 | * @Title: batchSave |
| 388 | 405 | * @Description: TODO(批量入库) |
| 389 | 406 | */ |
| 390 | 407 | private void batchSave(List<ScheduleRealInfo> list) { |
| 391 | - // 查询数据库最大ID | |
| 392 | - Long id = schRepository.getMaxId(); | |
| 393 | - if (null == id) | |
| 394 | - id = 0L; | |
| 395 | - id++; | |
| 396 | - | |
| 397 | 408 | SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); |
| 398 | 409 | for (ScheduleRealInfo item : list) { |
| 399 | 410 | item.setSpId(item.getId());// 保留原始的计划ID |
| 400 | - item.setId(id++);// 设置ID | |
| 411 | + item.setId(getId());// 设置ID | |
| 401 | 412 | item.setScheduleDateStr(sdfyyyyMMdd.format(item.getScheduleDate())); |
| 402 | 413 | } |
| 403 | 414 | |
| ... | ... | @@ -1107,4 +1118,16 @@ public class DayOfSchedule { |
| 1107 | 1118 | schAttrCalculator.calcQdzTimePlan(new ArrayList<ScheduleRealInfo>(map.get(k))); |
| 1108 | 1119 | } |
| 1109 | 1120 | } |
| 1121 | + | |
| 1122 | + public int dbCount(String lineCode, String currSchDate) { | |
| 1123 | + int count = -1; | |
| 1124 | + | |
| 1125 | + try{ | |
| 1126 | + count = jdbcTemplate.queryForObject("select count(*) from bsth_c_s_sp_info_real where schedule_date='"+currSchDate+"' and xl_bm='"+lineCode+"'", java.lang.Integer.class); | |
| 1127 | + | |
| 1128 | + }catch (Exception e){ | |
| 1129 | + logger.error("", e); | |
| 1130 | + } | |
| 1131 | + return count; | |
| 1132 | + } | |
| 1110 | 1133 | } |
| 1111 | 1134 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
| ... | ... | @@ -56,7 +56,7 @@ public class ScheduleRefreshThread extends Thread{ |
| 56 | 56 | |
| 57 | 57 | if(oldSchDate == null || !oldSchDate.equals(currSchDate)){ |
| 58 | 58 | |
| 59 | - logger.info(lineCode + "开始翻班, " + currSchDate); | |
| 59 | + //logger.info(lineCode + "开始翻班, " + currSchDate); | |
| 60 | 60 | |
| 61 | 61 | try{ |
| 62 | 62 | //清除指令数据 |
| ... | ... | @@ -74,6 +74,14 @@ public class ScheduleRefreshThread extends Thread{ |
| 74 | 74 | //重载排班数据 |
| 75 | 75 | dayOfSchedule.reloadSch(lineCode, currSchDate, false); |
| 76 | 76 | logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size()); |
| 77 | + | |
| 78 | + | |
| 79 | + //校验一下数据库和缓存的数据 | |
| 80 | + int dbCount = dayOfSchedule.dbCount(lineCode, currSchDate); | |
| 81 | + logger.info(lineCode + " 数据库数量:" + dbCount); | |
| 82 | + if(dbCount != dayOfSchedule.findByLineCode(lineCode).size()){ | |
| 83 | + logger.error("异常异常异常,,数据库和缓存数量不一致," + lineCode); | |
| 84 | + } | |
| 77 | 85 | } |
| 78 | 86 | }catch (Exception e){ |
| 79 | 87 | logger.error("班次更新失败!! -" + lineCode, e); | ... | ... |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
| ... | ... | @@ -18,6 +18,7 @@ import org.springframework.jdbc.core.JdbcTemplate; |
| 18 | 18 | import org.springframework.stereotype.Service; |
| 19 | 19 | |
| 20 | 20 | import javax.transaction.Transactional; |
| 21 | +import java.util.Date; | |
| 21 | 22 | import java.util.HashMap; |
| 22 | 23 | import java.util.Map; |
| 23 | 24 | |
| ... | ... | @@ -78,7 +79,7 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon |
| 78 | 79 | ccServiceSch.setScheduleDateStr(sch.getScheduleDateStr()); |
| 79 | 80 | ccServiceSch.setRealExecDate(sch.getRealExecDate()); |
| 80 | 81 | |
| 81 | - ccServiceSch.setId(null); | |
| 82 | + ccServiceSch.setId(dayOfSchedule.getId()); | |
| 82 | 83 | ccServiceSch.setSpId(null); |
| 83 | 84 | ccServiceSch.setClZbh(t.getNbbm()); |
| 84 | 85 | ccServiceSch.setCcService(true); |
| ... | ... | @@ -96,6 +97,7 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon |
| 96 | 97 | ccServiceSch.setZdsjActual(ccServiceSch.getZdsj()); |
| 97 | 98 | ccServiceSch.setRemarks(t.getRemarks()); |
| 98 | 99 | ccServiceSch.setStatus(2); |
| 100 | + ccServiceSch.setCreateDate(new Date()); | |
| 99 | 101 | if("1".equals(t.getType2())){ |
| 100 | 102 | ccServiceSch.setBcType("normal"); |
| 101 | 103 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -503,6 +503,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 503 | 503 | return rs; |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | + t.setId(dayOfSchedule.getId()); | |
| 506 | 507 | //实时入库 |
| 507 | 508 | rs = super.save(t); |
| 508 | 509 | } catch (Exception e) { |
| ... | ... | @@ -603,6 +604,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 603 | 604 | return rs; |
| 604 | 605 | } |
| 605 | 606 | |
| 607 | + t.setId(dayOfSchedule.getId()); | |
| 606 | 608 | //实时入库 |
| 607 | 609 | super.save(t); |
| 608 | 610 | |
| ... | ... | @@ -4336,7 +4338,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4336 | 4338 | return new ArrayList<Map<String, Object>>(); |
| 4337 | 4339 | } |
| 4338 | 4340 | |
| 4339 | - public void exportWaybill_pl(List<ScheduleRealInfo> listpl,String date,String jName, String clZbh,String lpName) { | |
| 4341 | + public void exportWaybill_pl(List<ScheduleRealInfo> listpl, | |
| 4342 | + String date, String jName, String clZbh, String lpName) { | |
| 4340 | 4343 | ReportUtils ee = new ReportUtils(); |
| 4341 | 4344 | ReportRelatedUtils rru = new ReportRelatedUtils(); |
| 4342 | 4345 | List<Iterator<?>> list = new ArrayList<Iterator<?>>(); |
| ... | ... | @@ -4359,7 +4362,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4359 | 4362 | // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); |
| 4360 | 4363 | // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); |
| 4361 | 4364 | //计算里程和班次数,并放入Map里 |
| 4362 | - Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId()); | |
| 4365 | + Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId()); | |
| 4363 | 4366 | |
| 4364 | 4367 | map.put("jhlc",Arith.add(culateMieageService.culateJhgl(scheduleRealInfos),culateMieageService.culateJhJccgl(scheduleRealInfos))); |
| 4365 | 4368 | map.put("remMileage",culateMieageService.culateLbgl(scheduleRealInfos)); |
| ... | ... | @@ -4506,7 +4509,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4506 | 4509 | |
| 4507 | 4510 | |
| 4508 | 4511 | String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; |
| 4509 | - | |
| 4510 | 4512 | list.add(listMap.iterator()); |
| 4511 | 4513 | String xls=""; |
| 4512 | 4514 | if(map.get("type").toString().equals("0")){ |
| ... | ... | @@ -4514,15 +4516,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4514 | 4516 | }else{ |
| 4515 | 4517 | xls="waybill_minhang_dl.xls"; |
| 4516 | 4518 | } |
| 4519 | + map.put("sheetName", jName + "-" + clZbh + "-" + lpName); | |
| 4517 | 4520 | ee.excelReplace(list, new Object[]{map}, path + "mould/"+xls, |
| 4518 | 4521 | path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); |
| 4519 | -// return scheduleRealInfos; | |
| 4520 | 4522 | } |
| 4521 | 4523 | |
| 4522 | 4524 | @Override |
| 4523 | 4525 | public Map<String, Object> exportWaybillMore(Map<String, Object> map) { |
| 4524 | 4526 | String date = map.get("date").toString(); |
| 4525 | 4527 | String line = map.get("line").toString(); |
| 4528 | + ReportUtils ee = new ReportUtils(); | |
| 4526 | 4529 | List<List> lists = JSON.parseArray(map.get("strs").toString(), List.class); |
| 4527 | 4530 | String path = this.getClass().getResource("/").getPath() + "static/pages/forms/export/"; |
| 4528 | 4531 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), |
| ... | ... | @@ -4532,16 +4535,19 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4532 | 4535 | try { |
| 4533 | 4536 | while (true) { |
| 4534 | 4537 | String fileUrl = path + "行车路单" + sdfSimple.format(sdfMonth.parse(date)); |
| 4535 | - file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/")); | |
| 4536 | - if (file.exists()) { | |
| 4538 | +// file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/")); //新建文件夹 | |
| 4539 | + file = new File(fileUrl + (num == 0 ? ".xls" : "(" + num + ").xls")); //新建excel文件 | |
| 4540 | + if (file.exists()) { //判断是否已存在重名 | |
| 4537 | 4541 | num++; |
| 4538 | 4542 | } else { |
| 4539 | 4543 | break; |
| 4540 | 4544 | } |
| 4541 | 4545 | } |
| 4542 | - file.mkdirs(); | |
| 4546 | +// file.mkdirs(); //创建 | |
| 4543 | 4547 | List<ScheduleRealInfo> lists_line=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date); |
| 4544 | - for (List<String> list : lists) { | |
| 4548 | + | |
| 4549 | + List<File> files = new ArrayList<File>(); | |
| 4550 | + for (List<String> list : lists){ | |
| 4545 | 4551 | List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); |
| 4546 | 4552 | String jName = list.get(0); |
| 4547 | 4553 | String clZbh = list.get(1); |
| ... | ... | @@ -4556,26 +4562,37 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4556 | 4562 | this.exportWaybill_pl(newList, date, jName, clZbh, lpName); |
| 4557 | 4563 | File temp = new File(path + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); |
| 4558 | 4564 | String fileName = file.getName(); |
| 4559 | - temp.renameTo(new File(path + fileName + "/" + temp.getName())); | |
| 4560 | - | |
| 4561 | - File[] listFiles = file.listFiles(); | |
| 4562 | - ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path + file.getName() + ".zip"))); | |
| 4563 | -// zos.setEncoding("gbk"); | |
| 4564 | -// zos.putNextEntry(new ZipEntry(fileName + "/")); | |
| 4565 | - for (int i = 0; i < listFiles.length; i++) { | |
| 4566 | - zos.putNextEntry(new ZipEntry(fileName + "/" + listFiles[i].getName())); | |
| 4567 | - BufferedInputStream bis = new BufferedInputStream(new FileInputStream(listFiles[i])); | |
| 4568 | - BufferedOutputStream bos = new BufferedOutputStream(zos); | |
| 4569 | - int bytesRead = 0; | |
| 4570 | - for (byte[] buffer = new byte[BUF_SIZE]; ((bytesRead = bis.read(buffer, 0, BUF_SIZE)) != -1); ) { | |
| 4571 | -// zos.write(buffer, 0, bytesRead); | |
| 4572 | -// zos.flush(); | |
| 4573 | - bos.write(buffer, 0, bytesRead); | |
| 4574 | - bos.flush(); | |
| 4575 | - } | |
| 4576 | - } | |
| 4577 | - zos.close(); | |
| 4578 | - } | |
| 4565 | + files.add(temp); | |
| 4566 | + } | |
| 4567 | + for(int i = 1; i < files.size(); i++){ | |
| 4568 | + File file1 = files.get(0); | |
| 4569 | + File file2 = files.get(i); | |
| 4570 | + ee.copySheetByFile(file2, file1, 0, 145); | |
| 4571 | + } | |
| 4572 | + File newFile = files.get(0); | |
| 4573 | + newFile.renameTo(file); | |
| 4574 | + | |
| 4575 | +// temp.renameTo(new File(path + fileName + "/" + temp.getName())); | |
| 4576 | +// File[] listFiles = file.listFiles(); | |
| 4577 | +// ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path + file.getName() + ".zip"))); | |
| 4578 | +//// zos.setEncoding("gbk"); | |
| 4579 | +//// zos.putNextEntry(new ZipEntry(fileName + "/")); | |
| 4580 | +// for (int i = 0; i < listFiles.length; i++) { | |
| 4581 | +// zos.putNextEntry(new ZipEntry(fileName + "/" + listFiles[i].getName())); | |
| 4582 | +// BufferedInputStream bis = new BufferedInputStream(new FileInputStream(listFiles[i])); | |
| 4583 | +// BufferedOutputStream bos = new BufferedOutputStream(zos); | |
| 4584 | +// int bytesRead = 0; | |
| 4585 | +// for (byte[] buffer = new byte[BUF_SIZE]; ((bytesRead = bis.read(buffer, 0, BUF_SIZE)) != -1); ) { | |
| 4586 | +//// zos.write(buffer, 0, bytesRead); | |
| 4587 | +//// zos.flush(); | |
| 4588 | +// bos.write(buffer, 0, bytesRead); | |
| 4589 | +// bos.flush(); | |
| 4590 | +// } | |
| 4591 | +//// bos.close(); | |
| 4592 | +// bis.close(); | |
| 4593 | +// } | |
| 4594 | +// zos.close(); | |
| 4595 | +// } | |
| 4579 | 4596 | |
| 4580 | 4597 | } catch (Exception e) { |
| 4581 | 4598 | // TODO: handle exception | ... | ... |
src/main/java/com/bsth/util/ReportUtils.java
| ... | ... | @@ -18,6 +18,7 @@ import org.apache.poi.hssf.usermodel.HSSFSheet; |
| 18 | 18 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| 19 | 19 | import org.apache.poi.poifs.filesystem.POIFSFileSystem; |
| 20 | 20 | import org.apache.poi.ss.usermodel.Cell; |
| 21 | +import org.apache.poi.ss.util.CellRangeAddress; | |
| 21 | 22 | |
| 22 | 23 | import com.bsth.entity.Line; |
| 23 | 24 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| ... | ... | @@ -114,6 +115,145 @@ public class ReportUtils { |
| 114 | 115 | } |
| 115 | 116 | } |
| 116 | 117 | |
| 118 | + /** | |
| 119 | + * 将file1中的一页sheet复制到file2中 | |
| 120 | + * | |
| 121 | + * @param file1 | |
| 122 | + * 原sheet所在的excel文件 | |
| 123 | + * @param file2 | |
| 124 | + * 目标excel文件 | |
| 125 | + * @param page | |
| 126 | + * 原excel中要被复制的sheet的位置(从0开始) | |
| 127 | + * @param rate | |
| 128 | + * 调整复制后的缩放倍率(列如:145,则为缩放145%) | |
| 129 | + */ | |
| 130 | + public void copySheetByFile(File file1, File file2, int page, int rate) { | |
| 131 | + try { | |
| 132 | + // 把源文件放入流中 | |
| 133 | + POIFSFileSystem fs1 = new POIFSFileSystem(new FileInputStream(file1)); | |
| 134 | + HSSFWorkbook wb1 = new HSSFWorkbook(fs1); | |
| 135 | + HSSFSheet sheet = wb1.getSheetAt(page); | |
| 136 | + POIFSFileSystem fs2 = new POIFSFileSystem(new FileInputStream(file2)); | |
| 137 | + HSSFWorkbook wb2 = new HSSFWorkbook(fs2); | |
| 138 | + HSSFSheet createSheet = wb2.createSheet(sheet.getSheetName()); | |
| 139 | + HSSFCellStyle createCellStyle = wb2.createCellStyle(); | |
| 140 | + HSSFRow row; | |
| 141 | + | |
| 142 | + createSheet.setZoom(rate, 100); | |
| 143 | + for(int i = 0; i < sheet.getRow(0).getPhysicalNumberOfCells(); i++){ | |
| 144 | + createSheet.setColumnWidth(i, sheet.getColumnWidth(i)); | |
| 145 | + } | |
| 146 | + | |
| 147 | + List<CellRangeAddress> mergedRegions = sheet.getMergedRegions(); | |
| 148 | + for(int l = 0; l < mergedRegions.size(); l++){ | |
| 149 | + //复制源表中的合并单元格 | |
| 150 | + createSheet.addMergedRegion(mergedRegions.get(l)); | |
| 151 | + } | |
| 152 | + int firstRow = sheet.getFirstRowNum(); | |
| 153 | + int lastRow = sheet.getLastRowNum(); | |
| 154 | + for(int k = firstRow; k <= lastRow; k++){ | |
| 155 | + // 创建新建excel Sheet的行 | |
| 156 | + HSSFRow rowCreat = createSheet.createRow(k); | |
| 157 | + // 取得源有excel Sheet的行 | |
| 158 | + row = sheet.getRow(k); | |
| 159 | +// rowCreat.setHeight(row.getHeight()); //设置行高 | |
| 160 | + // 单元格式样 | |
| 161 | + int firstCell = row.getFirstCellNum(); | |
| 162 | + int lastCell = row.getLastCellNum(); | |
| 163 | + for (int j = firstCell; j < lastCell; j++) { | |
| 164 | + // 自动适应列宽 貌似不起作用 | |
| 165 | +// createSheet.autoSizeColumn(j); | |
| 166 | +// System.out.println(row.getCell(j)); | |
| 167 | + rowCreat.createCell(j); | |
| 168 | + String strVal = ""; | |
| 169 | + if (row.getCell(j)==null) { | |
| 170 | + | |
| 171 | + } else { | |
| 172 | + strVal = row.getCell(j).getStringCellValue(); | |
| 173 | + rowCreat.getCell(j).setCellValue(strVal); | |
| 174 | + copyCellStyle(wb1, row.getCell(j).getCellStyle(), createCellStyle); | |
| 175 | + createCellStyle.setBorderTop((short)1); | |
| 176 | + createCellStyle.setBorderLeft((short)1); | |
| 177 | + createCellStyle.setBorderRight((short)1); | |
| 178 | + createCellStyle.setBorderBottom((short)1); | |
| 179 | + rowCreat.getCell(j).setCellStyle(createCellStyle); | |
| 180 | + } | |
| 181 | + } | |
| 182 | + } | |
| 183 | + | |
| 184 | +// int firstRowNum = createSheet.getFirstRowNum(); | |
| 185 | +// int lastRowNum = createSheet.getLastRowNum(); | |
| 186 | +// int test = 0; | |
| 187 | +// for(int k = firstRowNum; k <= lastRowNum; k++){ | |
| 188 | +// HSSFRow createRow = createSheet.getRow(k); | |
| 189 | +// int firstCellNum = createRow.getFirstCellNum(); | |
| 190 | +// int lastCellNum = createRow.getLastCellNum(); | |
| 191 | +// for(int i = firstCellNum; i < lastCellNum; i++){ | |
| 192 | +// HSSFCell cell = createRow.getCell(i); | |
| 193 | +// cell.getCellStyle().setBorderTop(HSSFCellStyle.BORDER_THIN); | |
| 194 | +// cell.getCellStyle().setBorderLeft(HSSFCellStyle.BORDER_THIN); | |
| 195 | +// cell.getCellStyle().setBorderRight(HSSFCellStyle.BORDER_THIN); | |
| 196 | +// cell.getCellStyle().setBorderBottom(HSSFCellStyle.BORDER_THIN); | |
| 197 | +// test ++; | |
| 198 | +// } | |
| 199 | +// } | |
| 200 | +// System.out.println("test = " + test); | |
| 201 | + | |
| 202 | + FileOutputStream fileOut = new FileOutputStream(file2); | |
| 203 | + wb2.write(fileOut); | |
| 204 | + fileOut.close(); | |
| 205 | + wb2.close(); | |
| 206 | + wb1.close(); | |
| 207 | + fs2.close(); | |
| 208 | + fs1.close(); | |
| 209 | + file1.delete(); | |
| 210 | +// // 创建目标文件夹 | |
| 211 | +// createFolder(targetPath); | |
| 212 | + // 输出文件 | |
| 213 | + } catch (Exception e) { | |
| 214 | + e.printStackTrace(); | |
| 215 | + } | |
| 216 | + } | |
| 217 | + | |
| 218 | + public void test(File file){ | |
| 219 | + POIFSFileSystem fs; | |
| 220 | + try { | |
| 221 | + fs = new POIFSFileSystem(new FileInputStream(file)); | |
| 222 | + HSSFWorkbook wb = new HSSFWorkbook(fs); | |
| 223 | + for(int j = 0; j < wb.getNumberOfSheets(); j++){ | |
| 224 | + HSSFSheet sheet = wb.getSheetAt(j); | |
| 225 | + int firstRowNum = sheet.getFirstRowNum(); | |
| 226 | + int lastRowNum = sheet.getLastRowNum(); | |
| 227 | + int test = 0; | |
| 228 | + for(int k = firstRowNum; k <= lastRowNum; k++){ | |
| 229 | + HSSFRow createRow = sheet.getRow(k); | |
| 230 | + int firstCellNum = createRow.getFirstCellNum(); | |
| 231 | + int lastCellNum = createRow.getLastCellNum(); | |
| 232 | + for(int i = firstCellNum; i < lastCellNum; i++){ | |
| 233 | + HSSFCell cell = createRow.getCell(i); | |
| 234 | + HSSFCellStyle cellStyle = wb.createCellStyle(); | |
| 235 | + | |
| 236 | + cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); | |
| 237 | + cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); | |
| 238 | + cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); | |
| 239 | + cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); | |
| 240 | + cell.setCellStyle(cellStyle); | |
| 241 | + test ++; | |
| 242 | + } | |
| 243 | + } | |
| 244 | + System.out.println("test = " + test); | |
| 245 | + | |
| 246 | + FileOutputStream fileOut = new FileOutputStream(file); | |
| 247 | + wb.write(fileOut); | |
| 248 | + fileOut.close(); | |
| 249 | + } | |
| 250 | + } catch (Exception e) { | |
| 251 | + // TODO Auto-generated catch block | |
| 252 | + e.printStackTrace(); | |
| 253 | + } | |
| 254 | + | |
| 255 | + } | |
| 256 | + | |
| 117 | 257 | public String getCellValue(HSSFCell cell) { |
| 118 | 258 | int cellType = 0; |
| 119 | 259 | String result = ""; | ... | ... |
src/main/resources/static/pages/base/linecast/cast.html
| ... | ... | @@ -166,6 +166,33 @@ function getTreeData(cb){ |
| 166 | 166 | }); |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | +/** | |
| 170 | + * 将模块List 转换为树结构 | |
| 171 | + * @param arr | |
| 172 | + * @returns {Array} | |
| 173 | + */ | |
| 174 | +function createTreeData(arr){ | |
| 175 | + var treeData = []; | |
| 176 | + var len = arr.length; | |
| 177 | + for(var i = 0; i < len; i ++){ | |
| 178 | + var pId = arr[i].pId; | |
| 179 | + arr[i].text = arr[i].name; | |
| 180 | + if(!pId){ | |
| 181 | + treeData.push(arr[i]); | |
| 182 | + } | |
| 183 | + | |
| 184 | + for(var j = 0; j < len; j ++){ | |
| 185 | + if(pId == arr[j].id){ | |
| 186 | + if(!arr[j].children) | |
| 187 | + arr[j].children = []; | |
| 188 | + arr[j].children.push(arr[i]); | |
| 189 | + break; | |
| 190 | + } | |
| 191 | + } | |
| 192 | + } | |
| 193 | + return treeData; | |
| 194 | +} | |
| 195 | + | |
| 169 | 196 | function getModuleTreeData(userId){ |
| 170 | 197 | |
| 171 | 198 | ... | ... |
src/main/resources/static/pages/forms/statement/busInterval.html
| ... | ... | @@ -412,6 +412,32 @@ |
| 412 | 412 | }); |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | + /** | |
| 416 | + * 将模块List 转换为树结构 | |
| 417 | + * @param arr | |
| 418 | + * @returns {Array} | |
| 419 | + */ | |
| 420 | + function createTreeData(arr){ | |
| 421 | + var treeData = []; | |
| 422 | + var len = arr.length; | |
| 423 | + for(var i = 0; i < len; i ++){ | |
| 424 | + var pId = arr[i].pId; | |
| 425 | + arr[i].text = arr[i].name; | |
| 426 | + if(!pId){ | |
| 427 | + treeData.push(arr[i]); | |
| 428 | + } | |
| 429 | + | |
| 430 | + for(var j = 0; j < len; j ++){ | |
| 431 | + if(pId == arr[j].id){ | |
| 432 | + if(!arr[j].children) | |
| 433 | + arr[j].children = []; | |
| 434 | + arr[j].children.push(arr[i]); | |
| 435 | + break; | |
| 436 | + } | |
| 437 | + } | |
| 438 | + } | |
| 439 | + return treeData; | |
| 440 | + } | |
| 415 | 441 | |
| 416 | 442 | function _w_table_rowspan(_w_table_id, _w_table_colnum){ |
| 417 | 443 | _w_table_firsttd = ""; | ... | ... |
src/main/resources/static/pages/forms/statement/lbStatuAnaly.html
| ... | ... | @@ -438,6 +438,32 @@ |
| 438 | 438 | }); |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | + /** | |
| 442 | + * 将模块List 转换为树结构 | |
| 443 | + * @param arr | |
| 444 | + * @returns {Array} | |
| 445 | + */ | |
| 446 | + function createTreeData(arr){ | |
| 447 | + var treeData = []; | |
| 448 | + var len = arr.length; | |
| 449 | + for(var i = 0; i < len; i ++){ | |
| 450 | + var pId = arr[i].pId; | |
| 451 | + arr[i].text = arr[i].name; | |
| 452 | + if(!pId){ | |
| 453 | + treeData.push(arr[i]); | |
| 454 | + } | |
| 455 | + | |
| 456 | + for(var j = 0; j < len; j ++){ | |
| 457 | + if(pId == arr[j].id){ | |
| 458 | + if(!arr[j].children) | |
| 459 | + arr[j].children = []; | |
| 460 | + arr[j].children.push(arr[i]); | |
| 461 | + break; | |
| 462 | + } | |
| 463 | + } | |
| 464 | + } | |
| 465 | + return treeData; | |
| 466 | + } | |
| 441 | 467 | |
| 442 | 468 | function _w_table_rowspan(_w_table_id, _w_table_colnum){ |
| 443 | 469 | _w_table_firsttd = ""; | ... | ... |
src/main/resources/static/pages/forms/statement/lineTimeAnaly.html
| ... | ... | @@ -478,6 +478,32 @@ |
| 478 | 478 | }); |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | + /** | |
| 482 | + * 将模块List 转换为树结构 | |
| 483 | + * @param arr | |
| 484 | + * @returns {Array} | |
| 485 | + */ | |
| 486 | + function createTreeData(arr){ | |
| 487 | + var treeData = []; | |
| 488 | + var len = arr.length; | |
| 489 | + for(var i = 0; i < len; i ++){ | |
| 490 | + var pId = arr[i].pId; | |
| 491 | + arr[i].text = arr[i].name; | |
| 492 | + if(!pId){ | |
| 493 | + treeData.push(arr[i]); | |
| 494 | + } | |
| 495 | + | |
| 496 | + for(var j = 0; j < len; j ++){ | |
| 497 | + if(pId == arr[j].id){ | |
| 498 | + if(!arr[j].children) | |
| 499 | + arr[j].children = []; | |
| 500 | + arr[j].children.push(arr[i]); | |
| 501 | + break; | |
| 502 | + } | |
| 503 | + } | |
| 504 | + } | |
| 505 | + return treeData; | |
| 506 | + } | |
| 481 | 507 | |
| 482 | 508 | }); |
| 483 | 509 | ... | ... |
src/main/resources/static/pages/forms/statement/scheduleAnaly.html
| ... | ... | @@ -327,6 +327,32 @@ |
| 327 | 327 | }); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | + /** | |
| 331 | + * 将模块List 转换为树结构 | |
| 332 | + * @param arr | |
| 333 | + * @returns {Array} | |
| 334 | + */ | |
| 335 | + function createTreeData(arr){ | |
| 336 | + var treeData = []; | |
| 337 | + var len = arr.length; | |
| 338 | + for(var i = 0; i < len; i ++){ | |
| 339 | + var pId = arr[i].pId; | |
| 340 | + arr[i].text = arr[i].name; | |
| 341 | + if(!pId){ | |
| 342 | + treeData.push(arr[i]); | |
| 343 | + } | |
| 344 | + | |
| 345 | + for(var j = 0; j < len; j ++){ | |
| 346 | + if(pId == arr[j].id){ | |
| 347 | + if(!arr[j].children) | |
| 348 | + arr[j].children = []; | |
| 349 | + arr[j].children.push(arr[i]); | |
| 350 | + break; | |
| 351 | + } | |
| 352 | + } | |
| 353 | + } | |
| 354 | + return treeData; | |
| 355 | + } | |
| 330 | 356 | |
| 331 | 357 | function showPagination(data){ |
| 332 | 358 | //分页 | ... | ... |
src/main/resources/static/pages/forms/statement/scheduleAnaly_sum.html
| ... | ... | @@ -335,6 +335,33 @@ |
| 335 | 335 | }); |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | + /** | |
| 339 | + * 将模块List 转换为树结构 | |
| 340 | + * @param arr | |
| 341 | + * @returns {Array} | |
| 342 | + */ | |
| 343 | + function createTreeData(arr){ | |
| 344 | + var treeData = []; | |
| 345 | + var len = arr.length; | |
| 346 | + for(var i = 0; i < len; i ++){ | |
| 347 | + var pId = arr[i].pId; | |
| 348 | + arr[i].text = arr[i].name; | |
| 349 | + if(!pId){ | |
| 350 | + treeData.push(arr[i]); | |
| 351 | + } | |
| 352 | + | |
| 353 | + for(var j = 0; j < len; j ++){ | |
| 354 | + if(pId == arr[j].id){ | |
| 355 | + if(!arr[j].children) | |
| 356 | + arr[j].children = []; | |
| 357 | + arr[j].children.push(arr[i]); | |
| 358 | + break; | |
| 359 | + } | |
| 360 | + } | |
| 361 | + } | |
| 362 | + return treeData; | |
| 363 | + } | |
| 364 | + | |
| 338 | 365 | function initCl(){ |
| 339 | 366 | $('#nbbm').select2({ |
| 340 | 367 | placeholder: '搜索车辆...', | ... | ... |
src/main/resources/static/pages/forms/statement/timeAndSpeed.html
| ... | ... | @@ -480,6 +480,33 @@ |
| 480 | 480 | }); |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | + /** | |
| 484 | + * 将模块List 转换为树结构 | |
| 485 | + * @param arr | |
| 486 | + * @returns {Array} | |
| 487 | + */ | |
| 488 | + function createTreeData(arr){ | |
| 489 | + var treeData = []; | |
| 490 | + var len = arr.length; | |
| 491 | + for(var i = 0; i < len; i ++){ | |
| 492 | + var pId = arr[i].pId; | |
| 493 | + arr[i].text = arr[i].name; | |
| 494 | + if(!pId){ | |
| 495 | + treeData.push(arr[i]); | |
| 496 | + } | |
| 497 | + | |
| 498 | + for(var j = 0; j < len; j ++){ | |
| 499 | + if(pId == arr[j].id){ | |
| 500 | + if(!arr[j].children) | |
| 501 | + arr[j].children = []; | |
| 502 | + arr[j].children.push(arr[i]); | |
| 503 | + break; | |
| 504 | + } | |
| 505 | + } | |
| 506 | + } | |
| 507 | + return treeData; | |
| 508 | + } | |
| 509 | + | |
| 483 | 510 | function _w_table_rowspan(_w_table_id, _w_table_colnum){ |
| 484 | 511 | _w_table_firsttd = ""; |
| 485 | 512 | _w_table_currenttd = ""; | ... | ... |
src/main/resources/static/pages/forms/statement/waybill.html
| ... | ... | @@ -359,7 +359,8 @@ |
| 359 | 359 | }); |
| 360 | 360 | }); |
| 361 | 361 | $get('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){ |
| 362 | - window.open("/downloadFile/downloadList?fileName="+result.fileName); | |
| 362 | +// window.open("/downloadFile/downloadList?fileName="+result.fileName); //下载压缩包 | |
| 363 | + window.open("/downloadFile/download?fileName="+result.fileName); | |
| 363 | 364 | }); |
| 364 | 365 | }); |
| 365 | 366 | ... | ... |
src/main/resources/static/pages/permission/module/list.html
| ... | ... | @@ -192,4 +192,31 @@ function getTreeData(cb){ |
| 192 | 192 | }); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | +/** | |
| 196 | + * 将模块List 转换为树结构 | |
| 197 | + * @param arr | |
| 198 | + * @returns {Array} | |
| 199 | + */ | |
| 200 | +function createTreeData(arr){ | |
| 201 | + var treeData = []; | |
| 202 | + var len = arr.length; | |
| 203 | + for(var i = 0; i < len; i ++){ | |
| 204 | + var pId = arr[i].pId; | |
| 205 | + arr[i].text = arr[i].name; | |
| 206 | + if(!pId){ | |
| 207 | + treeData.push(arr[i]); | |
| 208 | + } | |
| 209 | + | |
| 210 | + for(var j = 0; j < len; j ++){ | |
| 211 | + if(pId == arr[j].id){ | |
| 212 | + if(!arr[j].children) | |
| 213 | + arr[j].children = []; | |
| 214 | + arr[j].children.push(arr[i]); | |
| 215 | + break; | |
| 216 | + } | |
| 217 | + } | |
| 218 | + } | |
| 219 | + return treeData; | |
| 220 | +} | |
| 221 | + | |
| 195 | 222 | </script> |
| 196 | 223 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/permission/resource/add.html
| ... | ... | @@ -169,5 +169,33 @@ $(function(){ |
| 169 | 169 | cb && cb(treeData) |
| 170 | 170 | }); |
| 171 | 171 | } |
| 172 | + | |
| 173 | + /** | |
| 174 | + * 将模块List 转换为树结构 | |
| 175 | + * @param arr | |
| 176 | + * @returns {Array} | |
| 177 | + */ | |
| 178 | + function createTreeData(arr){ | |
| 179 | + var treeData = []; | |
| 180 | + var len = arr.length; | |
| 181 | + for(var i = 0; i < len; i ++){ | |
| 182 | + var pId = arr[i].pId; | |
| 183 | + arr[i].text = arr[i].name; | |
| 184 | + if(!pId){ | |
| 185 | + treeData.push(arr[i]); | |
| 186 | + } | |
| 187 | + | |
| 188 | + for(var j = 0; j < len; j ++){ | |
| 189 | + if(pId == arr[j].id){ | |
| 190 | + if(!arr[j].children) | |
| 191 | + arr[j].children = []; | |
| 192 | + arr[j].children.push(arr[i]); | |
| 193 | + break; | |
| 194 | + } | |
| 195 | + } | |
| 196 | + } | |
| 197 | + return treeData; | |
| 198 | + } | |
| 199 | + | |
| 172 | 200 | }); |
| 173 | 201 | </script> |
| 174 | 202 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/permission/resource/edit.html
| ... | ... | @@ -187,5 +187,33 @@ $(function(){ |
| 187 | 187 | cb && cb(treeData) |
| 188 | 188 | }); |
| 189 | 189 | } |
| 190 | + | |
| 191 | + /** | |
| 192 | + * 将模块List 转换为树结构 | |
| 193 | + * @param arr | |
| 194 | + * @returns {Array} | |
| 195 | + */ | |
| 196 | + function createTreeData(arr){ | |
| 197 | + var treeData = []; | |
| 198 | + var len = arr.length; | |
| 199 | + for(var i = 0; i < len; i ++){ | |
| 200 | + var pId = arr[i].pId; | |
| 201 | + arr[i].text = arr[i].name; | |
| 202 | + if(!pId){ | |
| 203 | + treeData.push(arr[i]); | |
| 204 | + } | |
| 205 | + | |
| 206 | + for(var j = 0; j < len; j ++){ | |
| 207 | + if(pId == arr[j].id){ | |
| 208 | + if(!arr[j].children) | |
| 209 | + arr[j].children = []; | |
| 210 | + arr[j].children.push(arr[i]); | |
| 211 | + break; | |
| 212 | + } | |
| 213 | + } | |
| 214 | + } | |
| 215 | + return treeData; | |
| 216 | + } | |
| 217 | + | |
| 190 | 218 | }); |
| 191 | 219 | </script> |
| 192 | 220 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/permission/resource/list.html
| ... | ... | @@ -281,6 +281,33 @@ $(function(){ |
| 281 | 281 | }); |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | + /** | |
| 285 | + * 将模块List 转换为树结构 | |
| 286 | + * @param arr | |
| 287 | + * @returns {Array} | |
| 288 | + */ | |
| 289 | + function createTreeData(arr){ | |
| 290 | + var treeData = []; | |
| 291 | + var len = arr.length; | |
| 292 | + for(var i = 0; i < len; i ++){ | |
| 293 | + var pId = arr[i].pId; | |
| 294 | + arr[i].text = arr[i].name; | |
| 295 | + if(!pId){ | |
| 296 | + treeData.push(arr[i]); | |
| 297 | + } | |
| 298 | + | |
| 299 | + for(var j = 0; j < len; j ++){ | |
| 300 | + if(pId == arr[j].id){ | |
| 301 | + if(!arr[j].children) | |
| 302 | + arr[j].children = []; | |
| 303 | + arr[j].children.push(arr[i]); | |
| 304 | + break; | |
| 305 | + } | |
| 306 | + } | |
| 307 | + } | |
| 308 | + return treeData; | |
| 309 | + } | |
| 310 | + | |
| 284 | 311 | //删除 |
| 285 | 312 | $('#removeButton').on('click', function(){ |
| 286 | 313 | if($(this).attr('disabled')) | ... | ... |
src/main/resources/static/pages/permission/role/settings.html
| ... | ... | @@ -215,5 +215,33 @@ $(function(){ |
| 215 | 215 | cb && cb(treeData) |
| 216 | 216 | }); |
| 217 | 217 | } |
| 218 | + | |
| 219 | + /** | |
| 220 | + * 将模块List 转换为树结构 | |
| 221 | + * @param arr | |
| 222 | + * @returns {Array} | |
| 223 | + */ | |
| 224 | + function createTreeData(arr){ | |
| 225 | + var treeData = []; | |
| 226 | + var len = arr.length; | |
| 227 | + for(var i = 0; i < len; i ++){ | |
| 228 | + var pId = arr[i].pId; | |
| 229 | + arr[i].text = arr[i].name; | |
| 230 | + if(!pId){ | |
| 231 | + treeData.push(arr[i]); | |
| 232 | + } | |
| 233 | + | |
| 234 | + for(var j = 0; j < len; j ++){ | |
| 235 | + if(pId == arr[j].id){ | |
| 236 | + if(!arr[j].children) | |
| 237 | + arr[j].children = []; | |
| 238 | + arr[j].children.push(arr[i]); | |
| 239 | + break; | |
| 240 | + } | |
| 241 | + } | |
| 242 | + } | |
| 243 | + return treeData; | |
| 244 | + } | |
| 245 | + | |
| 218 | 246 | }); |
| 219 | 247 | </script> | ... | ... |
src/main/resources/static/pages/report/timetable/timetable.html
| ... | ... | @@ -298,6 +298,33 @@ |
| 298 | 298 | }); |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | + /** | |
| 302 | + * 将模块List 转换为树结构 | |
| 303 | + * @param arr | |
| 304 | + * @returns {Array} | |
| 305 | + */ | |
| 306 | + function createTreeData(arr){ | |
| 307 | + var treeData = []; | |
| 308 | + var len = arr.length; | |
| 309 | + for(var i = 0; i < len; i ++){ | |
| 310 | + var pId = arr[i].pId; | |
| 311 | + arr[i].text = arr[i].name; | |
| 312 | + if(!pId){ | |
| 313 | + treeData.push(arr[i]); | |
| 314 | + } | |
| 315 | + | |
| 316 | + for(var j = 0; j < len; j ++){ | |
| 317 | + if(pId == arr[j].id){ | |
| 318 | + if(!arr[j].children) | |
| 319 | + arr[j].children = []; | |
| 320 | + arr[j].children.push(arr[i]); | |
| 321 | + break; | |
| 322 | + } | |
| 323 | + } | |
| 324 | + } | |
| 325 | + return treeData; | |
| 326 | + } | |
| 327 | + | |
| 301 | 328 | $("#line").on("change", function(){ |
| 302 | 329 | line = $("#line").val(); |
| 303 | 330 | updateTtinfo(); | ... | ... |
src/main/resources/static/real_control_v2/fragments/north/nav/history_sch/h_add_temp_sch.html
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | <div class="uk-form-row"> |
| 31 | 31 | <label class="uk-form-label">班次类型</label> |
| 32 | 32 | <div class="uk-form-controls"> |
| 33 | - <select class="form-control nt-dictionary" name="bcType" data-code="{{bcType}}" | |
| 33 | + <select class="form-control nt-dictionary" required name="bcType" data-code="{{bcType}}" | |
| 34 | 34 | data-group=ScheduleType></select> |
| 35 | 35 | </div> |
| 36 | 36 | </div> | ... | ... |