Commit 9955d855be5e78d3ed6970a36dc75fcabd97d7dc

Authored by 游瑞烽
2 parents 2a08f11b 8629bc50

Merge remote-tracking branch 'origin/pudong' into pudong

Showing 27 changed files with 1781 additions and 85 deletions
src/main/java/com/bsth/controller/RefuelController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import com.bsth.entity.Refuel;
  4 +import com.bsth.service.RefuelService;
  5 +import com.google.common.io.Files;
  6 +
  7 +import java.io.File;
  8 +import java.util.List;
  9 +import java.util.Map;
  10 +
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.web.bind.annotation.RequestMapping;
  13 +import org.springframework.web.bind.annotation.RequestMethod;
  14 +import org.springframework.web.bind.annotation.RequestParam;
  15 +import org.springframework.web.bind.annotation.RestController;
  16 +import org.springframework.web.multipart.MultipartFile;
  17 +
  18 +/**
  19 + * Created in 19/9/3.
  20 + */
  21 +@RestController
  22 +@RequestMapping("refuel")
  23 +public class RefuelController extends BaseController<Refuel, Long> {
  24 +
  25 + @Autowired
  26 + private RefuelService refuelService;
  27 +
  28 + @RequestMapping(value = "/query", method = RequestMethod.GET)
  29 + public List<Refuel> query(@RequestParam Map<String, Object> map){
  30 + return refuelService.query(map);
  31 + }
  32 +
  33 + @RequestMapping(value = "/queryDaily", method = RequestMethod.GET)
  34 + public List<Map<String, Object>> queryDaily(@RequestParam Map<String, Object> map){
  35 + return refuelService.queryDaily(map);
  36 + }
  37 +
  38 + @RequestMapping(value = "/uploadFile",method = RequestMethod.POST)
  39 + public String uploadFile(MultipartFile file) throws Exception{
  40 + File newFile = new File(
  41 + getDataImportClasspath() + File.separator +
  42 + file.getOriginalFilename());
  43 + Files.write(file.getBytes(), newFile);
  44 + String result = refuelService.importExcel(newFile);
  45 + return "{\"result\":" + "\""+result+"\"}";
  46 + }
  47 +
  48 + private String getDataImportClasspath(){
  49 + return this.getClass().getResource("/").getPath() + "/static/pages/forms";
  50 + }
  51 +
  52 +}
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
1 1 package com.bsth.controller.realcontrol;
2 2  
3   -import java.io.ByteArrayOutputStream;
4   -import java.io.IOException;
5   -import java.io.InputStream;
6   -import java.io.OutputStream;
7   -import java.net.HttpURLConnection;
8   -import java.net.URL;
9 3 import java.util.ArrayList;
10 4 import java.util.Collection;
11 5 import java.util.HashMap;
12 6 import java.util.List;
13 7 import java.util.Map;
14 8  
15   -import org.apache.commons.io.IOUtils;
16 9 import org.apache.commons.lang3.StringEscapeUtils;
17 10 import org.joda.time.format.DateTimeFormat;
18 11 import org.joda.time.format.DateTimeFormatter;
... ... @@ -32,12 +25,9 @@ import com.bsth.data.BasicData;
32 25 import com.bsth.data.schedule.DayOfSchedule;
33 26 import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
34 27 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  28 +import com.bsth.entity.report.RepairReport;
35 29 import com.bsth.entity.schedule.SchedulePlanInfo;
36   -import com.bsth.entity.sys.SysUser;
37   -import com.bsth.security.util.SecurityUtils;
38 30 import com.bsth.service.realcontrol.ScheduleRealInfoService;
39   -import com.bsth.util.ConfigUtil;
40   -import com.fasterxml.jackson.databind.ObjectMapper;
41 31  
42 32 @RestController
43 33 @RequestMapping("/realSchedule")
... ... @@ -725,67 +715,12 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
725 715 * @return
726 716 */
727 717 @RequestMapping(value = "wxsb", method = RequestMethod.POST)
728   - public Map<String, Object> deleteToHistory(@RequestParam Map<String, Object> param){
729   - SysUser user = SecurityUtils.getCurrentUser();
730   - String uname = user.getUserName();
731   - StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url"));
732   - url.append("?nbbm=").append(param.get("nbbm")).append("&bxy=").append(uname).append("&bxbm=").append(param.get("bxType"));
733   - // 分公司保存格式 分公司编码_公司编码
734   - String val = BasicData.nbbm2FgsCompanyCodeMap.get(param.get("nbbm"));
735   - String[] arr = val.split("_");
736   - if (!"22".equals(arr[1])) {
737   - Map<String, Object> res = new HashMap<String, Object>();
738   - res.put("status", ResponseCode.ERROR);
739   - res.put("msg", "除金高公司外暂未开通此功能");
740   -
741   - return res;
742   - }
743   - url.append("&fgs=").append(arr[0]);
744   -
745   - return request(url.toString());
  718 + public Map<String, Object> repairReport(@RequestParam Map<String, Object> param){
  719 + return scheduleRealInfoService.repairReport(param, true);
746 720 }
747 721  
748   - @SuppressWarnings("unchecked")
749   - private static Map<String, Object> request(String url) {
750   - Map<String, Object> res = new HashMap<String, Object>();
751   - res.put("status", ResponseCode.SUCCESS);
752   - InputStream in = null;
753   - HttpURLConnection con = null;
754   - try {
755   - con = (HttpURLConnection)new URL(url).openConnection();
756   - con.setRequestMethod("POST");
757   - con.setRequestProperty("keep-alive", "true");
758   - con.setRequestProperty("accept", "application/json");
759   - con.setRequestProperty("content-type", "application/json");
760   - con.setDoInput(true);
761   - con.setReadTimeout(2500);
762   - con.setConnectTimeout(2500);
763   -
764   - con.connect();
765   - if (con.getResponseCode() == 200) {
766   - in = con.getInputStream();
767   - ByteArrayOutputStream bout = new ByteArrayOutputStream();
768   - IOUtils.copy(in, bout); bout.close();
769   - Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
770   - if (!"报修成功".equals(response.get("msg"))) {
771   - res.put("status", ResponseCode.ERROR);
772   - res.putAll(response);
773   - }
774   - }
775   - } catch (IOException e) {
776   - // TODO Auto-generated catch block
777   - res.put("status", ResponseCode.ERROR);
778   - res.put("msg", "调用上报接口异常");
779   - } finally {
780   - try {
781   - if (in != null) in.close();
782   - if (con != null) con.disconnect();
783   - } catch (IOException e) {
784   - // TODO Auto-generated catch block
785   - e.printStackTrace();
786   - }
787   - }
788   -
789   - return res;
  722 + @RequestMapping(value = "wxsb", method = RequestMethod.GET)
  723 + public List<RepairReport> repairReportList(@RequestParam String line, @RequestParam String date, @RequestParam String code, @RequestParam String type){
  724 + return scheduleRealInfoService.repairReportList(line, date, code, type);
790 725 }
791 726 }
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -10,6 +10,7 @@ import com.bsth.data.gpsdata_v2.utils.GpsDataRecovery;
10 10 import com.bsth.data.schedule.f_a_l.FirstAndLastHandler;
11 11 import com.bsth.entity.realcontrol.LineConfig;
12 12 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  13 +import com.bsth.entity.report.RepairReport;
13 14 import com.bsth.entity.schedule.SchedulePlanInfo;
14 15 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
15 16 import com.bsth.service.schedule.SchedulePlanInfoService;
... ... @@ -83,6 +84,8 @@ public class DayOfSchedule {
83 84 private static ScheduleComparator.DFSJ schDFSJComparator;
84 85  
85 86 private static Long sch_max_id=-1L;
  87 +
  88 + private Map<String, RepairReport> incode2report = new ConcurrentHashMap<String, RepairReport>();
86 89  
87 90 @Autowired
88 91 LineConfigData lineConfigData;
... ... @@ -1180,4 +1183,19 @@ public class DayOfSchedule {
1180 1183 reCalcExecPlan(sch.getClZbh());
1181 1184 }
1182 1185 }
  1186 +
  1187 + /**
  1188 + ** 用于重置维修上报计数,一般只应该在翻班的时候调用
  1189 + */
  1190 + public void resetRepairReport(String incode) {
  1191 + incode2report.remove(incode);
  1192 + }
  1193 +
  1194 + public RepairReport getLastestRepairReport(String incode) {
  1195 + return incode2report.get(incode);
  1196 + }
  1197 +
  1198 + public void setLastestRepairReport(RepairReport rr) {
  1199 + incode2report.put(rr.getIncode(), rr);
  1200 + }
1183 1201 }
1184 1202 \ No newline at end of file
... ...
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
... ... @@ -59,6 +59,7 @@ public class ScheduleRefreshThread extends Thread{
59 59 Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode);
60 60 for(String car : cars){
61 61 GpsCacheData.remove(car);
  62 + dayOfSchedule.resetRepairReport(car);
62 63 }
63 64 //清除驾驶员上报数据
64 65 pilotReport.clear(lineCode);
... ...
src/main/java/com/bsth/entity/Refuel.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +
  10 +/**
  11 + * Created in 19/9/3.
  12 + */
  13 +@Entity
  14 +@Table(name = "bsth_c_refuel")
  15 +public class Refuel {
  16 + @Id
  17 + @GeneratedValue
  18 + private Long id;
  19 +
  20 + private Date date;
  21 +
  22 + private String dateStr;
  23 +
  24 + private String lineName;
  25 +
  26 + private String car;
  27 +
  28 + private String driver;
  29 +
  30 + private String outOil;
  31 +
  32 + private String inOil;
  33 +
  34 + private String inStation0;
  35 +
  36 + private String inStation5;
  37 +
  38 + private String oilCard0;
  39 +
  40 + private String oilCard10;
  41 +
  42 + private String eastStation0;
  43 +
  44 + private String eastStation10;
  45 +
  46 + private String outStation0;
  47 +
  48 + private String outStation10;
  49 +
  50 + private String createBy;
  51 +
  52 + private Date createDate;
  53 +
  54 + private String updateBy;
  55 +
  56 + private Date updateDate;
  57 +
  58 + public Long getId() {
  59 + return id;
  60 + }
  61 +
  62 + public void setId(Long id) {
  63 + this.id = id;
  64 + }
  65 +
  66 + public Date getDate() {
  67 + return date;
  68 + }
  69 +
  70 + public void setDate(Date date) {
  71 + this.date = date;
  72 + }
  73 +
  74 + public String getDateStr() {
  75 + return dateStr;
  76 + }
  77 +
  78 + public void setDateStr(String dateStr) {
  79 + this.dateStr = dateStr;
  80 + }
  81 +
  82 + public String getLineName() {
  83 + return lineName;
  84 + }
  85 +
  86 + public void setLineName(String lineName) {
  87 + this.lineName = lineName;
  88 + }
  89 +
  90 + public String getCar() {
  91 + return car;
  92 + }
  93 +
  94 + public void setCar(String car) {
  95 + this.car = car;
  96 + }
  97 +
  98 + public String getDriver() {
  99 + return driver;
  100 + }
  101 +
  102 + public void setDriver(String driver) {
  103 + this.driver = driver;
  104 + }
  105 +
  106 + public String getOutOil() {
  107 + return outOil;
  108 + }
  109 +
  110 + public void setOutOil(String outOil) {
  111 + this.outOil = outOil;
  112 + }
  113 +
  114 + public String getInOil() {
  115 + return inOil;
  116 + }
  117 +
  118 + public void setInOil(String inOil) {
  119 + this.inOil = inOil;
  120 + }
  121 +
  122 + public String getInStation0() {
  123 + return inStation0;
  124 + }
  125 +
  126 + public void setInStation0(String inStation0) {
  127 + this.inStation0 = inStation0;
  128 + }
  129 +
  130 + public String getInStation5() {
  131 + return inStation5;
  132 + }
  133 +
  134 + public void setInStation5(String inStation5) {
  135 + this.inStation5 = inStation5;
  136 + }
  137 +
  138 + public String getOilCard0() {
  139 + return oilCard0;
  140 + }
  141 +
  142 + public void setOilCard0(String oilCard0) {
  143 + this.oilCard0 = oilCard0;
  144 + }
  145 +
  146 + public String getOilCard10() {
  147 + return oilCard10;
  148 + }
  149 +
  150 + public void setOilCard10(String oilCard10) {
  151 + this.oilCard10 = oilCard10;
  152 + }
  153 +
  154 + public String getEastStation0() {
  155 + return eastStation0;
  156 + }
  157 +
  158 + public void setEastStation0(String eastStation0) {
  159 + this.eastStation0 = eastStation0;
  160 + }
  161 +
  162 + public String getEastStation10() {
  163 + return eastStation10;
  164 + }
  165 +
  166 + public void setEastStation10(String eastStation10) {
  167 + this.eastStation10 = eastStation10;
  168 + }
  169 +
  170 + public String getOutStation0() {
  171 + return outStation0;
  172 + }
  173 +
  174 + public void setOutStation0(String outStation0) {
  175 + this.outStation0 = outStation0;
  176 + }
  177 +
  178 + public String getOutStation10() {
  179 + return outStation10;
  180 + }
  181 +
  182 + public void setOutStation10(String outStation10) {
  183 + this.outStation10 = outStation10;
  184 + }
  185 +
  186 + public String getCreateBy() {
  187 + return createBy;
  188 + }
  189 +
  190 + public void setCreateBy(String createBy) {
  191 + this.createBy = createBy;
  192 + }
  193 +
  194 + public Date getCreateDate() {
  195 + return createDate;
  196 + }
  197 +
  198 + public void setCreateDate(Date createDate) {
  199 + this.createDate = createDate;
  200 + }
  201 +
  202 + public String getUpdateBy() {
  203 + return updateBy;
  204 + }
  205 +
  206 + public void setUpdateBy(String updateBy) {
  207 + this.updateBy = updateBy;
  208 + }
  209 +
  210 + public Date getUpdateDate() {
  211 + return updateDate;
  212 + }
  213 +
  214 + public void setUpdateDate(Date updateDate) {
  215 + this.updateDate = updateDate;
  216 + }
  217 +
  218 +}
... ...
src/main/java/com/bsth/entity/report/RepairReport.java 0 → 100644
  1 +package com.bsth.entity.report;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +import javax.persistence.Transient;
  10 +
  11 +/**
  12 + ** 维修上报信息
  13 + * @author Hill
  14 + *
  15 + */
  16 +@Entity
  17 +@Table(name = "bsth_c_repair_report")
  18 +public class RepairReport {
  19 +
  20 + @Id
  21 + @GeneratedValue
  22 + private Integer id;
  23 + // 线路编码
  24 + private String lineId;
  25 + // 线路名称
  26 + private String lineName;
  27 + // 上报用户名
  28 + private String reportUser;
  29 + // 上报姓名
  30 + private String reportName;
  31 + // 班次ID
  32 + private Long schId;
  33 + // 内部编码
  34 + private String incode;
  35 + // 发车时间
  36 + private String departureTime;
  37 + // 报修类型
  38 + private String repairType;
  39 + // 报修时间
  40 + private Date reportDate;
  41 + // 格式化的时间字符串
  42 + @Transient
  43 + private String reportDateStr;
  44 + // 报修状态 0 不报 1上报成功 -1上报失败
  45 + private int reportState;
  46 + // 格式化的时间字符串
  47 + @Transient
  48 + private String reportStateStr;
  49 +
  50 + public Integer getId() {
  51 + return id;
  52 + }
  53 +
  54 + public void setId(Integer id) {
  55 + this.id = id;
  56 + }
  57 +
  58 + public String getLineId() {
  59 + return lineId;
  60 + }
  61 +
  62 + public void setLineId(String lineId) {
  63 + this.lineId = lineId;
  64 + }
  65 +
  66 + public String getLineName() {
  67 + return lineName;
  68 + }
  69 +
  70 + public void setLineName(String lineName) {
  71 + this.lineName = lineName;
  72 + }
  73 +
  74 + public String getReportUser() {
  75 + return reportUser;
  76 + }
  77 +
  78 + public void setReportUser(String reportUser) {
  79 + this.reportUser = reportUser;
  80 + }
  81 +
  82 + public String getReportName() {
  83 + return reportName;
  84 + }
  85 +
  86 + public void setReportName(String reportName) {
  87 + this.reportName = reportName;
  88 + }
  89 +
  90 + public Long getSchId() {
  91 + return schId;
  92 + }
  93 +
  94 + public void setSchId(Long schId) {
  95 + this.schId = schId;
  96 + }
  97 +
  98 + public String getIncode() {
  99 + return incode;
  100 + }
  101 +
  102 + public void setIncode(String incode) {
  103 + this.incode = incode;
  104 + }
  105 +
  106 + public String getDepartureTime() {
  107 + return departureTime;
  108 + }
  109 +
  110 + public void setDepartureTime(String departureTime) {
  111 + this.departureTime = departureTime;
  112 + }
  113 +
  114 + public String getRepairType() {
  115 + return repairType;
  116 + }
  117 +
  118 + public void setRepairType(String repairType) {
  119 + this.repairType = repairType;
  120 + }
  121 +
  122 + public Date getReportDate() {
  123 + return reportDate;
  124 + }
  125 +
  126 + public void setReportDate(Date reportDate) {
  127 + this.reportDate = reportDate;
  128 + }
  129 +
  130 + public String getReportDateStr() {
  131 + return reportDateStr;
  132 + }
  133 +
  134 + public void setReportDateStr(String reportDateStr) {
  135 + this.reportDateStr = reportDateStr;
  136 + }
  137 +
  138 + public int getReportState() {
  139 + return reportState;
  140 + }
  141 +
  142 + public void setReportState(int reportState) {
  143 + this.reportState = reportState;
  144 + }
  145 +
  146 + public String getReportStateStr() {
  147 + return reportStateStr;
  148 + }
  149 +
  150 + public void setReportStateStr(String reportStateStr) {
  151 + this.reportStateStr = reportStateStr;
  152 + }
  153 +}
... ...
src/main/java/com/bsth/repository/RefuelRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.EntityGraph;
  6 +import org.springframework.data.jpa.repository.Modifying;
  7 +import org.springframework.data.jpa.repository.Query;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +
  10 +import com.bsth.entity.Refuel;
  11 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  12 +import com.bsth.repository.BaseRepository;
  13 +
  14 +/**
  15 + * Created in 19/9/3.
  16 + */
  17 +public interface RefuelRepository extends BaseRepository<Refuel, Long> {
  18 +
  19 + @Query(value="select r.date_str, r.line_name, r.car, r.driver, r.in_oil, r.out_oil, r.in_station0, r.in_station5, "
  20 + +"r.oil_card0, r.oil_card10, r.east_station0, r.east_station10, r.out_station0, r.out_station10, r.id, "
  21 + +"r.date, r.create_by, r.create_date, r.update_by, r.update_date "
  22 + +"from bsth_c_refuel r where binary r.date_str = ?1 and r.car like ?2 and r.driver like ?3", nativeQuery=true)
  23 + List<Refuel> findByDate(String date, String car, String driver);
  24 +
  25 + @Query(value="select r from Refuel r where r.dateStr = ?1 and r.lineName = ?2 and r.car = ?3 and r.driver = ?4")
  26 + List<Refuel> selectByDateAndCar(String date, String line, String car, String driver);
  27 +
  28 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  29 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr = ?1 and s.clZbh = ?2 and s.jGh = ?3")
  30 + List<ScheduleRealInfo> scheduleByDate(String date, String clZbh, String jGh);
  31 +
  32 + @Transactional
  33 + @Modifying
  34 + @Query(value="INSERT INTO bsth_c_refuel(" +
  35 + "date, date_str, line_name, car, driver, out_oil, in_oil, in_station0, in_station5, oil_card0, oil_card10, east_station0, east_station10, out_station0, out_station10, create_by, create_date)" +
  36 + " VALUES(" +
  37 + "str_to_date(?1,'%Y-%m-%d'),?2,?3,?4,?5,?6,?7,?8,?9,?10,?11,?12,?13,?14,?15,?16,str_to_date(?17,'%Y-%m-%d %H:%i:%s'))", nativeQuery=true)
  38 + void insertData(String date, String dateStr, String lineName, String car, String driver, String outOil, String inOil, String inStation0, String inStation5, String oilCard0, String oilCard10,
  39 + String eastStation0, String eastStation10, String outStation0, String outStation10, String createBy, String createDate);
  40 +
  41 + @Transactional
  42 + @Modifying
  43 + @Query(value="update bsth_c_refuel set date=str_to_date(?2,'%Y-%m-%d'), date_str=?3, line_name=?4, car=?5, driver=?6, out_oil=?7, in_oil=?8,"
  44 + + " in_station0=?9, in_station5=?10, oil_card0=?11, oil_card10=?12, east_station0=?13, east_station10=?14, out_station0=?15, out_station10=?16,"
  45 + + " update_by=?17, update_date=str_to_date(?18,'%Y-%m-%d %H:%i:%s') where id=?1", nativeQuery=true)
  46 + public void update(long id, String date, String dateStr, String lineName, String car, String driver, String outOil, String inOil, String inStation0, String inStation5,
  47 + String oilCard0, String oilCard10, String eastStation0, String eastStation10, String outStation0, String outStation10, String updateBy, String updateDate);
  48 +
  49 +}
... ...
src/main/java/com/bsth/repository/RepairReportRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import java.util.Date;
  4 +import java.util.List;
  5 +
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.stereotype.Repository;
  8 +
  9 +import com.bsth.entity.report.RepairReport;
  10 +
  11 +/**
  12 + *
  13 + * @Interface: RepairReportRepository
  14 + *
  15 + * @Extends : BaseRepository
  16 + *
  17 + * @Description: 维修上报持久化层
  18 + *
  19 + * @Author Hill
  20 + *
  21 + * @Date 2019-09-25
  22 + *
  23 + * @Version
  24 + *
  25 + */
  26 +
  27 +@Repository
  28 +public interface RepairReportRepository extends BaseRepository<RepairReport, Integer> {
  29 +
  30 + @Query(value="select r from "
  31 + + " RepairReport r where r.lineId = ?1 and r.reportDate between ?2 and "
  32 + + "?3 and r.incode like ?4%")
  33 + List<RepairReport> repairReportList(String lineId,Date start,Date end,String incode);
  34 +}
... ...
src/main/java/com/bsth/service/RefuelService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import java.io.File;
  4 +import java.util.List;
  5 +import java.util.Map;
  6 +
  7 +import com.bsth.entity.Refuel;
  8 +
  9 +/**
  10 + * Created in 19/9/3.
  11 + */
  12 +public interface RefuelService extends BaseService<Refuel, Long> {
  13 +
  14 + List<Refuel> query(Map<String, Object> map);
  15 +
  16 + List<Map<String, Object>> queryDaily(Map<String, Object> map);
  17 +
  18 + public String importExcel(File file);
  19 +}
... ...
src/main/java/com/bsth/service/impl/RefuelServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import com.bsth.entity.Refuel;
  4 +import com.bsth.entity.realcontrol.ChildTaskPlan;
  5 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  6 +import com.bsth.entity.sys.SysUser;
  7 +import com.bsth.repository.RefuelRepository;
  8 +import com.bsth.security.util.SecurityUtils;
  9 +import com.bsth.service.RefuelService;
  10 +import com.bsth.service.report.CulateMileageService;
  11 +
  12 +import java.io.File;
  13 +import java.io.FileInputStream;
  14 +import java.math.BigDecimal;
  15 +import java.text.DecimalFormat;
  16 +import java.text.SimpleDateFormat;
  17 +import java.util.ArrayList;
  18 +import java.util.Date;
  19 +import java.util.HashMap;
  20 +import java.util.List;
  21 +import java.util.Map;
  22 +import java.util.Set;
  23 +
  24 +import org.apache.poi.hssf.usermodel.HSSFCell;
  25 +import org.apache.poi.hssf.usermodel.HSSFRow;
  26 +import org.apache.poi.hssf.usermodel.HSSFSheet;
  27 +import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  28 +import org.apache.poi.poifs.filesystem.POIFSFileSystem;
  29 +import org.springframework.beans.factory.annotation.Autowired;
  30 +import org.springframework.stereotype.Service;
  31 +
  32 +/**
  33 + * Created in 19/9/3.
  34 + */
  35 +@Service
  36 +public class RefuelServiceImpl extends BaseServiceImpl<Refuel, Long> implements RefuelService {
  37 +
  38 + @Autowired
  39 + private RefuelRepository repository;
  40 +
  41 + @Autowired
  42 + private CulateMileageService culateMileageService;
  43 +
  44 + @Override
  45 + public List<Refuel> query(Map<String, Object> map) {
  46 + // TODO Auto-generated method stub
  47 + String date = "", car = "%%", driver = "%%";
  48 + if(map.get("date") != null){
  49 + date = map.get("date").toString();
  50 + }
  51 + if(map.get("car") != null){
  52 + car = "%" + map.get("car").toString() + "%";
  53 + }
  54 + if(map.get("driver") != null){
  55 + driver = "%" + map.get("driver").toString() + "%";
  56 + }
  57 + List<Refuel> list = repository.findByDate(date, car, driver);
  58 + return list;
  59 + }
  60 +
  61 + @Override
  62 + public List<Map<String, Object>> queryDaily(Map<String, Object> map) {
  63 + // TODO Auto-generated method stub
  64 + DecimalFormat df = new DecimalFormat("0.##");
  65 +
  66 + String date = "", car = "%%", driver = "%%";
  67 + if(map.get("date") != null){
  68 + date = map.get("date").toString();
  69 + }
  70 + if(map.get("car") != null){
  71 + car = "%" + map.get("car").toString() + "%";
  72 + }
  73 + if(map.get("driver") != null){
  74 + driver = "%" + map.get("driver").toString() + "%";
  75 + }
  76 +
  77 + List<Refuel> list = repository.findByDate(date, car, driver);
  78 +
  79 + List<String> keyList = new ArrayList<String>();
  80 + Map<String, Refuel> rMap = new HashMap<String, Refuel>();
  81 + for(Refuel rf : list){
  82 + String key = rf.getCar() + "/" + rf.getDriver();
  83 + if("/".equals(key)){
  84 + continue;
  85 + }
  86 + if(rMap.containsKey(key)){
  87 + Refuel r = rMap.get(key);
  88 + if(rf.getOutOil().length() > 0){
  89 + if(r.getOutOil().length() == 0){
  90 + r.setOutOil(rf.getOutOil());
  91 + } else if(Double.valueOf(rf.getOutOil()) > Double.valueOf(r.getOutOil())){
  92 + r.setOutOil(rf.getOutOil());
  93 + }
  94 + }
  95 + if(rf.getInOil().length() > 0){
  96 + if(r.getInOil().length() == 0){
  97 + r.setInOil(rf.getInOil());
  98 + } else if(Double.valueOf(rf.getInOil()) < Double.valueOf(r.getInOil())){
  99 + r.setInOil(rf.getInOil());
  100 + }
  101 + }
  102 + if(rf.getInStation0().length() > 0){
  103 + if(r.getInStation0().length() == 0){
  104 + r.setInStation0(rf.getInStation0());
  105 + } else {
  106 + r.setInStation0(add(r.getInStation0(), rf.getInStation0()));
  107 + }
  108 + }
  109 + if(rf.getInStation5().length() > 0){
  110 + if(r.getInStation5().length() == 0){
  111 + r.setInStation5(rf.getInStation5());
  112 + } else {
  113 + r.setInStation5(add(r.getInStation5(), rf.getInStation5()));
  114 + }
  115 + }
  116 + if(rf.getOilCard0().length() > 0){
  117 + if(r.getOilCard0().length() == 0){
  118 + r.setOilCard0(rf.getOilCard0());
  119 + } else {
  120 + r.setOilCard0(add(r.getOilCard0(), rf.getOilCard0()));
  121 + }
  122 + }
  123 + if(rf.getOilCard10().length() > 0){
  124 + if(r.getOilCard10().length() == 0){
  125 + r.setOilCard10(rf.getOilCard10());
  126 + } else {
  127 + r.setOilCard10(add(r.getOilCard10(), rf.getOilCard10()));
  128 + }
  129 + }
  130 + if(rf.getEastStation0().length() > 0){
  131 + if(r.getEastStation0().length() == 0){
  132 + r.setEastStation0(rf.getEastStation0());
  133 + } else {
  134 + r.setEastStation0(add(r.getEastStation0(), rf.getEastStation0()));
  135 + }
  136 + }
  137 + if(rf.getEastStation10().length() > 0){
  138 + if(r.getEastStation10().length() == 0){
  139 + r.setEastStation10(rf.getEastStation10());
  140 + } else {
  141 + r.setEastStation10(add(r.getEastStation10(), rf.getEastStation10()));
  142 + }
  143 + }
  144 + if(rf.getOutStation0().length() > 0){
  145 + if(r.getOutStation0().length() == 0){
  146 + r.setOutStation0(rf.getOutStation0());
  147 + } else {
  148 + r.setOutStation0(add(r.getOutStation0(), rf.getOutStation0()));
  149 + }
  150 + }
  151 + if(rf.getOutStation10().length() > 0){
  152 + if(r.getOutStation10().length() == 0){
  153 + r.setOutStation10(rf.getOutStation10());
  154 + } else {
  155 + r.setOutStation10(add(r.getOutStation10(), rf.getOutStation10()));
  156 + }
  157 + }
  158 + } else {
  159 + keyList.add(key);
  160 + rMap.put(key, rf);
  161 + }
  162 + }
  163 +
  164 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  165 + for(String key : keyList){
  166 + Refuel r = rMap.get(key);
  167 + Map<String, Object> m = new HashMap<String, Object>();
  168 +
  169 + String realMileage = "", oil = "0", consume = "";
  170 + List<ScheduleRealInfo> temp = repository.scheduleByDate(date, r.getCar(), r.getDriver());
  171 + List<ScheduleRealInfo> temp2 = new ArrayList<ScheduleRealInfo>();
  172 + if(temp.size() > 0){
  173 + for(ScheduleRealInfo s : temp){
  174 + Set<ChildTaskPlan> cts = s.getcTasks();
  175 + if(cts != null && cts.size() > 0){
  176 + temp2.add(s);
  177 + }else{
  178 + if(s.getZdsjActual()!=null
  179 + && s.getFcsjActual()!=null){
  180 + temp2.add(s);
  181 + }
  182 + }
  183 + }
  184 + Double sjgl = culateMileageService.culateSjgl(temp2);
  185 + Double ksgl = culateMileageService.culateKsgl(temp);
  186 + Double jccgl = culateMileageService.culateJccgl(temp2);
  187 + Double ljgl = culateMileageService.culateLjgl(temp2);
  188 +
  189 + realMileage = add(add(sjgl, ksgl), add(jccgl, ljgl));
  190 + }
  191 +
  192 + if(r.getOutOil().length() > 0 && r.getInOil().length() > 0){
  193 + oil = new BigDecimal(r.getOutOil()).subtract(new BigDecimal(r.getInOil())).toString();
  194 + }
  195 + if(r.getInStation0().length() > 0){
  196 + oil = add(oil, r.getInStation0());
  197 + }
  198 + if(r.getInStation5().length() > 0){
  199 + oil = add(oil, r.getInStation5());
  200 + }
  201 + if(r.getOilCard0().length() > 0){
  202 + oil = add(oil, r.getOilCard0());
  203 + }
  204 + if(r.getOilCard10().length() > 0){
  205 + oil = add(oil, r.getOilCard10());
  206 + }
  207 + if(r.getEastStation0().length() > 0){
  208 + oil = add(oil, r.getEastStation0());
  209 + }
  210 + if(r.getEastStation10().length() > 0){
  211 + oil = add(oil, r.getEastStation10());
  212 + }
  213 + if(r.getOutStation0().length() > 0){
  214 + oil = add(oil, r.getOutStation0());
  215 + }
  216 + if(r.getOutStation10().length() > 0){
  217 + oil = add(oil, r.getOutStation10());
  218 + }
  219 +
  220 + if(realMileage.length() > 0 && oil.length() > 0 && !("0".equals(realMileage))){
  221 + consume = df.format(new BigDecimal(oil).divide(new BigDecimal(realMileage), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)));
  222 + }
  223 +
  224 + m.put("date", r.getDateStr());
  225 + m.put("line", r.getLineName());
  226 + m.put("car", r.getCar());
  227 + m.put("driver", r.getDriver());
  228 + m.put("realMileage", realMileage);
  229 + m.put("oil", oil);
  230 + m.put("consume", consume);
  231 +
  232 + resList.add(m);
  233 + }
  234 +
  235 + return resList;
  236 + }
  237 +
  238 + @Override
  239 + public String importExcel(File file) {
  240 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  241 + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  242 + List<String> textList = new ArrayList<String>();
  243 + try {
  244 + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file));
  245 + HSSFWorkbook wb = new HSSFWorkbook(fs);
  246 + HSSFSheet sheet = wb.getSheetAt(0);
  247 + // 取得总行数
  248 + int rowNum = sheet.getLastRowNum() + 1;
  249 + // 取得总列数
  250 + int cellNum = sheet.getRow(0).getLastCellNum();
  251 + HSSFRow row = null;
  252 + HSSFCell cell = null;
  253 +
  254 + String userName = "";
  255 + SysUser user = SecurityUtils.getCurrentUser();
  256 + if(user != null && user.getUserName() != null){
  257 + userName = user.getUserName();
  258 + }
  259 +
  260 + for(int i = 1; i < rowNum; i++){
  261 + row = sheet.getRow(i);
  262 + if (row == null){
  263 + continue;
  264 + }
  265 + String text = "";
  266 + for(int j = 0; j < cellNum; j++){
  267 + cell = row.getCell(j);
  268 + if(cell == null){
  269 + text += ",";
  270 + continue;
  271 + }
  272 + text += String.valueOf(cell) + ",";
  273 + }
  274 + String[] split = (text+";").split(",");
  275 + String str = "";
  276 + for(int j = 0; j < split.length && j < 14; j++){
  277 + str += split[j];
  278 + }
  279 + if(str.trim().length() == 0)
  280 + continue;
  281 + textList.add(text + ";");
  282 + }
  283 + for(int i = 0; i < textList.size(); i++){
  284 + String text = textList.get(i);
  285 + String[] split = text.split(",");
  286 + String rq = split[0].trim();
  287 + String line = split[1].trim();
  288 + String car = split[2].trim();
  289 + String driver = split[3].trim();
  290 + if((car + driver).trim().length() == 0){
  291 + continue;
  292 + }
  293 + String outOil = split[4].trim();
  294 + String inOil = split[5].trim();
  295 + String inStation0 = split[6].trim();
  296 + String inStation5 = split[7].trim();
  297 + String oilCard0 = split[8].trim();
  298 + String oilCard10 = split[9].trim();
  299 + String eastStation0 = split[10].trim();
  300 + String eastStation10 = split[11].trim();
  301 + String outStation0 = split[12].trim();
  302 + String outStation10 = split[13].trim();
  303 +
  304 + List<Refuel> list = repository.selectByDateAndCar(rq, line, car, driver);
  305 + if(list.size() > 0){
  306 + for(Refuel r : list){
  307 + if(r.getId() != null){
  308 + repository.update(r.getId(), rq, rq, line, car, driver, outOil, inOil, inStation0, inStation5,
  309 + oilCard0, oilCard10, eastStation0, eastStation10, outStation0, outStation10, userName, sd.format(new Date()));
  310 + }
  311 + }
  312 + } else {
  313 + repository.insertData(rq, rq, line, car, driver, outOil, inOil, inStation0, inStation5, oilCard0, oilCard10,
  314 + eastStation0, eastStation10, outStation0, outStation10, userName, sd.format(new Date()));
  315 + }
  316 + }
  317 + wb.close();
  318 + fs.close();
  319 + } catch (Exception e) {
  320 + // TODO Auto-generated catch block
  321 + e.printStackTrace();
  322 + return "文件导入失败";
  323 + } finally {
  324 + file.delete();
  325 + }
  326 + return "文件导入成功";
  327 + }
  328 +
  329 + public String add(Object v1, Object v2)
  330 + {
  331 + BigDecimal b1 = new BigDecimal(v1.toString());
  332 + BigDecimal b2 = new BigDecimal(v2.toString());
  333 + return b1.add(b2).toString();
  334 + }
  335 +
  336 +}
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -4,6 +4,7 @@ import com.bsth.controller.realcontrol.dto.ChangePersonCar;
4 4 import com.bsth.controller.realcontrol.dto.DfsjChange;
5 5 import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
6 6 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  7 +import com.bsth.entity.report.RepairReport;
7 8 import com.bsth.entity.schedule.SchedulePlanInfo;
8 9 import com.bsth.service.BaseService;
9 10 import org.springframework.stereotype.Service;
... ... @@ -194,4 +195,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
194 195 List<Map<String, Object>> scheduleCorrectionReport(String gsdm, String fgsdm,
195 196 String line, String date, String date2);
196 197 Integer isCircleQdz(String clzbh,String sdr,String xlbm,String qdzCode);
  198 +
  199 + Map<String, Object> repairReport(Map<String, Object> map, boolean isActive);
  200 +
  201 + List<RepairReport> repairReportList(String line,String date,String code, String type);
197 202 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -33,6 +33,7 @@ import com.bsth.entity.realcontrol.LineConfig;
33 33 import com.bsth.entity.realcontrol.ScheduleRealInfo;
34 34 import com.bsth.entity.realcontrol.SvgAttribute;
35 35 import com.bsth.entity.report.MileageReport;
  36 +import com.bsth.entity.report.RepairReport;
36 37 import com.bsth.entity.report.ScheduleCorrectionReport;
37 38 import com.bsth.entity.schedule.CarConfigInfo;
38 39 import com.bsth.entity.schedule.EmployeeConfigInfo;
... ... @@ -44,6 +45,7 @@ import com.bsth.entity.sys.SysUser;
44 45 import com.bsth.repository.CarDeviceRepository;
45 46 import com.bsth.repository.CarsRepository;
46 47 import com.bsth.repository.LineRepository;
  48 +import com.bsth.repository.RepairReportRepository;
47 49 import com.bsth.repository.oil.DlbRepository;
48 50 import com.bsth.repository.oil.YlbRepository;
49 51 import com.bsth.repository.oil.YlxxbRepository;
... ... @@ -66,11 +68,14 @@ import com.bsth.service.sys.DictionaryService;
66 68 import com.bsth.service.sys.DutyEmployeeService;
67 69 import com.bsth.util.*;
68 70 import com.bsth.websocket.handler.SendUtils;
  71 +import com.fasterxml.jackson.databind.ObjectMapper;
69 72 import com.github.stuxuhai.jpinyin.PinyinException;
70 73 import com.github.stuxuhai.jpinyin.PinyinFormat;
71 74 import com.github.stuxuhai.jpinyin.PinyinHelper;
72 75 import com.google.common.base.Splitter;
73 76 import com.google.common.collect.Lists;
  77 +
  78 +import org.apache.commons.io.IOUtils;
74 79 import org.apache.commons.lang3.StringEscapeUtils;
75 80 import org.apache.commons.lang3.StringUtils;
76 81 import org.joda.time.format.DateTimeFormat;
... ... @@ -82,8 +87,14 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
82 87 import org.springframework.jdbc.core.JdbcTemplate;
83 88 import org.springframework.jdbc.core.RowMapper;
84 89 import org.springframework.stereotype.Service;
  90 +import org.springframework.transaction.annotation.Transactional;
85 91  
  92 +import java.io.ByteArrayOutputStream;
86 93 import java.io.File;
  94 +import java.io.IOException;
  95 +import java.io.InputStream;
  96 +import java.net.HttpURLConnection;
  97 +import java.net.URL;
87 98 import java.sql.ResultSet;
88 99 import java.sql.SQLException;
89 100 import java.text.DecimalFormat;
... ... @@ -168,6 +179,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
168 179  
169 180 @Autowired
170 181 CarsRepository carsRepository;
  182 +
  183 + @Autowired
  184 + RepairReportRepository repairReportRepository;
171 185 Logger logger = LoggerFactory.getLogger(this.getClass());
172 186  
173 187 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
... ... @@ -1525,6 +1539,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1525 1539 Map<String, Object> rs = new HashMap<>();
1526 1540 List<ScheduleRealInfo> ts = new ArrayList<>();
1527 1541 try {
  1542 + // 维修上报
  1543 + if (StringUtils.isNotBlank(map.get("repairTypes"))) {
  1544 + Map<String, Object> param = new HashMap<String, Object>();
  1545 + param.putAll(map);
  1546 + repairReport(param, false);
  1547 + }
  1548 +
1528 1549 Long id = Long.parseLong(map.get("id"));
1529 1550 String remarks = map.get("remarks");
1530 1551  
... ... @@ -6020,6 +6041,192 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
6020 6041 Integer num2=num==0L?0:1;
6021 6042 return num2;
6022 6043 }
  6044 +
  6045 + @SuppressWarnings("unchecked")
  6046 + private static Map<String, Object> request(String url) {
  6047 + Map<String, Object> res = new HashMap<String, Object>();
  6048 + res.put("status", ResponseCode.SUCCESS);
  6049 + InputStream in = null;
  6050 + HttpURLConnection con = null;
  6051 + try {
  6052 + con = (HttpURLConnection)new URL(url).openConnection();
  6053 + con.setRequestMethod("POST");
  6054 + con.setRequestProperty("keep-alive", "true");
  6055 + con.setRequestProperty("accept", "application/json");
  6056 + con.setRequestProperty("content-type", "application/json");
  6057 + con.setDoInput(true);
  6058 + con.setReadTimeout(2500);
  6059 + con.setConnectTimeout(2500);
  6060 +
  6061 + con.connect();
  6062 + if (con.getResponseCode() == 200) {
  6063 + in = con.getInputStream();
  6064 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  6065 + IOUtils.copy(in, bout); bout.close();
  6066 + Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
  6067 + if (!"报修成功".equals(response.get("msg"))) {
  6068 + res.put("status", ResponseCode.ERROR);
  6069 + res.putAll(response);
  6070 + }
  6071 + }
  6072 + } catch (IOException e) {
  6073 + // TODO Auto-generated catch block
  6074 + res.put("status", ResponseCode.ERROR);
  6075 + res.put("msg", "调用上报接口异常");
  6076 + } finally {
  6077 + try {
  6078 + if (in != null) in.close();
  6079 + if (con != null) con.disconnect();
  6080 + } catch (IOException e) {
  6081 + // TODO Auto-generated catch block
  6082 + e.printStackTrace();
  6083 + }
  6084 + }
  6085 +
  6086 + return res;
  6087 + }
  6088 +
  6089 + /**
  6090 + ** 维修记录上报
  6091 + * @param param 参数信息
  6092 + * @param isActive 主/被动上报
  6093 + */
  6094 + @Override
  6095 + @Transactional
  6096 + public Map<String, Object> repairReport(Map<String, Object> param, boolean isActive) {
  6097 + Map<String, Object> res = new HashMap<String, Object>();
  6098 + res.put("status", ResponseCode.SUCCESS);
  6099 + // 获取实际排班信息
  6100 + Long id = Long.parseLong((String)param.get("id"));
  6101 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  6102 +
  6103 + if (null == sch) {
  6104 + res.put("status", ResponseCode.ERROR);
  6105 + res.put("msg", "不存在的班次!");
  6106 +
  6107 + return res;
  6108 + }
  6109 +
  6110 + int reportState = -1;
  6111 + SysUser user = SecurityUtils.getCurrentUser();
  6112 + String reportUser = user.getUserName(), reportName = user.getName(), incode = (String)param.get("clZbh"), repairTypes = (String)param.get("repairTypes");
  6113 + // 分公司保存格式 分公司编码_公司编码
  6114 + String val = BasicData.nbbm2FgsCompanyCodeMap.get(incode);
  6115 + String[] arr = val.split("_");
  6116 + StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url." + arr[1]));
  6117 + url.append("?nbbm=").append(incode).append("&bxy=").append(reportUser).append("&bxbm=").append(repairTypes).append("&fgs=").append(arr[0]);
  6118 +
  6119 + RepairReport lrr = dayOfSchedule.getLastestRepairReport(incode);
  6120 + // 非主动上报并且无上报记录或上次已上报或上次上报的同一个班次 则不用上报
  6121 + if (!isActive && (lrr == null || lrr.getReportState() != 0 || lrr.getSchId().equals(id))) {
  6122 + reportState = 0;
  6123 + } else {
  6124 + res = request(url.toString());
  6125 + if (ResponseCode.SUCCESS.equals(res.get("status"))) reportState = 1;
  6126 + }
  6127 + // 持久化此次上报记录
  6128 + RepairReport rr = new RepairReport();
  6129 + rr.setLineId(sch.getXlBm());
  6130 + rr.setLineName(sch.getXlName());
  6131 + rr.setReportUser(reportUser);
  6132 + rr.setReportName(reportName);
  6133 + rr.setSchId(id);
  6134 + rr.setIncode(incode);
  6135 + rr.setDepartureTime(sch.getFcsj());
  6136 + rr.setRepairType(repairTypes);
  6137 + rr.setReportDate(new Date());
  6138 + rr.setReportState(reportState);
  6139 + repairReportRepository.save(rr);
  6140 + dayOfSchedule.setLastestRepairReport(rr);
  6141 +
  6142 + return res;
  6143 + }
  6144 +
  6145 + @Override
  6146 + public List<RepairReport> repairReportList(String lineId, String date, String incode, String type) {
  6147 + List<RepairReport> result = new ArrayList<RepairReport>();
  6148 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  6149 +
  6150 + Date start = null, end = null;
  6151 + if (date.length() > 0) {
  6152 + try {
  6153 + start = sdf.parse(date + " 00:00:00");
  6154 + end = sdf.parse(date + " 23:59:59");
  6155 + } catch (ParseException e) {
  6156 + // TODO Auto-generated catch block
  6157 + e.printStackTrace();
  6158 + }
  6159 +
  6160 + }
  6161 +
  6162 + result = repairReportRepository.repairReportList(lineId, start, end, incode);
  6163 + Map<String, Object> dMap=new HashMap<>();
  6164 + dMap.put("dGroup", "repairtype");
  6165 + Map<String, String> code2name = new HashMap<String, String>();
  6166 + for (Dictionary dic : dictionaryService.list(dMap)) {
  6167 + code2name.put(dic.getdCode(), dic.getdName());
  6168 + }
  6169 + for (RepairReport rr : result) {
  6170 + String repairType = rr.getRepairType();
  6171 + String[] types = repairType.split(";");
  6172 + StringBuilder sb = new StringBuilder();
  6173 +
  6174 + for (String t : types) {
  6175 + sb.append(code2name.get(t)).append(";");
  6176 + }
  6177 +
  6178 + rr.setRepairType(sb.toString());
  6179 + rr.setReportDateStr(sdf.format(rr.getReportDate()));
  6180 + switch (rr.getReportState()) {
  6181 + case 0:
  6182 + rr.setReportStateStr("不报");
  6183 + break;
  6184 + case 1:
  6185 + rr.setReportStateStr("上报成功");
  6186 + break;
  6187 + case -1:
  6188 + rr.setReportStateStr("上报失败");
  6189 + break;
  6190 + default:
  6191 + break;
  6192 + }
  6193 + }
  6194 +
  6195 + if ("export".equals(type)) {
  6196 + String lineName = BasicData.lineCode2NameMap.get(lineId);
  6197 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  6198 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  6199 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  6200 + Map<String, Object> m = new HashMap<String, Object>();
  6201 + ReportUtils ee = new ReportUtils();
  6202 + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>();
  6203 + for (int i = 0; i < result.size(); i++) {
  6204 + Map<String, Object> map = new HashMap<String, Object>();
  6205 + RepairReport rr = result.get(i);
  6206 + map.put("row", i + 1);
  6207 + map.put("lineId", rr.getLineName());
  6208 + map.put("incode", rr.getIncode());
  6209 + map.put("departureTime", rr.getDepartureTime());
  6210 + map.put("reportUser", rr.getReportUser());
  6211 + map.put("reportDateStr", rr.getReportDate());
  6212 + map.put("repairType", rr.getRepairType());
  6213 + map.put("reportStateStr", rr.getReportStateStr());
  6214 + newList.add(map);
  6215 + }
  6216 + try {
  6217 + listI.add(newList.iterator());
  6218 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  6219 + ee.excelReplace(listI, new Object[]{m}, path + "mould/repairReport.xls",
  6220 + path + "export/" + sdfSimple.format(sdfMonth.parse(date))
  6221 + + "-" + lineName + "-维修上报记录.xls");
  6222 + } catch (Exception e) {
  6223 + // TODO: handle exception
  6224 + e.printStackTrace();
  6225 + }
  6226 + }
  6227 +
  6228 + return result;
  6229 + }
6023 6230 }
6024 6231  
6025 6232 class AccountMap implements Comparator<Map<String, Object>> {
... ...
src/main/java/com/bsth/webService/trafficManage/org/tempuri/WebServiceLocator.java
... ... @@ -22,7 +22,7 @@ public class WebServiceLocator extends org.apache.axis.client.Service implements
22 22 }
23 23  
24 24 // Use to get a proxy class for WebServiceSoap
25   - private java.lang.String WebServiceSoap_address = "http://218.242.195.76:8411/webservice.asmx";
  25 + private java.lang.String WebServiceSoap_address = "http://183.194.241.174:8411/webservice.asmx";
26 26  
27 27 public java.lang.String getWebServiceSoapAddress() {
28 28 return WebServiceSoap_address;
... ...
src/main/java/com/bsth/webService/trafficManage/up/org/tempuri/WebServiceLocator.java
... ... @@ -22,7 +22,7 @@ public class WebServiceLocator extends org.apache.axis.client.Service implements
22 22 }
23 23  
24 24 // Use to get a proxy class for WebServiceSoap
25   - private java.lang.String WebServiceSoap_address = "http://218.242.195.76:8411/WebService_test/WebService.asmx";
  25 + private java.lang.String WebServiceSoap_address = "http://183.194.241.174:8411/WebService_test/WebService.asmx";
26 26  
27 27 public java.lang.String getWebServiceSoapAddress() {
28 28 return WebServiceSoap_address;
... ...
src/main/resources/application-prod.properties
... ... @@ -2,7 +2,7 @@ server.port=9088
2 2 management.port= 9001
3 3 management.address= 127.0.0.1
4 4  
5   -spring.jpa.hibernate.ddl-auto= none
  5 +spring.jpa.hibernate.ddl-auto= update
6 6 spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
7 7 #DATABASE
8 8 spring.jpa.database= MYSQL
... ... @@ -28,4 +28,13 @@ http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all
28 28 ## gateway real data
29 29 http.gps.real.url= http://10.10.200.79:8080/transport_server/rtgps/
30 30 ## gateway send directive
31   -http.send.directive = http://10.10.200.79:8080/transport_server/message/
32 31 \ No newline at end of file
  32 +http.send.directive = http://10.10.200.79:8080/transport_server/message/
  33 +## wxsb
  34 +#http.report.url.05= http://192.168.168.154:8088/ygjwsystem_j2ee/clbx/clbx_dd.do
  35 +#http.report.url.22= http://192.168.168.154:8088/jgjwsystem_j2ee/clbx/clbx_dd.do
  36 +#http.report.url.26= http://192.168.168.154:8088/nhjwsystem_j2ee/clbx/clbx_dd.do
  37 +#http.report.url.55= http://192.168.168.154:8088/snjwsystem_j2ee/clbx/clbx_dd.do
  38 +http.report.url.05= http://116.228.197.222:8081/ygjwsystem_j2ee/clbx/clbx_dd.do
  39 +http.report.url.22= http://116.247.73.122:9098/jgjwsystem_j2ee/clbx/clbx_dd.do
  40 +http.report.url.26= http://116.236.141.34:8088/nhjwsystem_j2ee/clbx/clbx_dd.do
  41 +http.report.url.55= http://180.168.216.248:8088/snjwsystem_j2ee/clbx/clbx_dd.do
33 42 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/list.html
... ... @@ -122,6 +122,7 @@
122 122 <option value="csbs">穿梭巴士</option>
123 123 <option value="tyxl">特约线路</option>
124 124 <option value="cctxl">村村通线路</option>
  125 + <option value="hlwgj">互联网公交</option>
125 126 <option value="qt">其他</option>
126 127 </select>
127 128 </td>
... ... @@ -272,6 +273,8 @@
272 273 其他
273 274 {{else if obj.nature == 'cctxl'}}
274 275 村村通线路
  276 + {{else if obj.nature == 'hlwgj'}}
  277 + 互联网公交
275 278 {{/if}}
276 279 </td>
277 280 <td>
... ...
src/main/resources/static/pages/forms/export/refuel.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/repairReport.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/commandState.html
... ... @@ -329,6 +329,9 @@
329 329 $("#works_hidden").removeClass("hidden");
330 330 var i = layer.load(2);
331 331 $get('/pcpc/commandByLineList',params,function(result){
  332 + $(result).each(function(i, e){
  333 + e.jGh = (e.jsy).split("/")[0];
  334 + });
332 335 var commandByLine = template('list_commandState_1',{list:result});
333 336 $('#works tbody').html(commandByLine);
334 337 layer.close(i);
... ...
src/main/resources/static/pages/forms/statement/refuel.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 + .btn-default{
  18 + margin-left: 5px;
  19 + }
  20 +</style>
  21 +
  22 +<div class="page-head">
  23 + <div class="page-title">
  24 + <h1>加注量</h1>
  25 + </div>
  26 +</div>
  27 +
  28 +<div class="row">
  29 + <div class="col-md-12">
  30 + <div class="portlet light porttlet-fit bordered">
  31 + <div class="portlet-title">
  32 + <form class="form-inline" action="" autocomplete="off">
  33 + <div style="display: inline-block;margin-left: 24px;">
  34 + <span class="item-label" style="width: 80px;">&nbsp;日期: </span>
  35 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  36 + </div>
  37 + <div style="display: inline-block;margin-left: 6px;">
  38 + <span class="item-label" style="width: 80px;">&nbsp;车号: </span>
  39 + <input class="form-control" type="text" id="car" style="width: 180px;"/>
  40 + </div>
  41 + <div style="display: inline-block;margin-left: 6px;">
  42 + <span class="item-label" style="width: 80px;">&nbsp;驾驶员: </span>
  43 + <input class="form-control" type="text" id="driver" style="width: 180px;"/>
  44 + </div>
  45 + <div class="form-group">
  46 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  47 + <input class="btn btn-default" type="button" id="upload" value="导入Excel"/>
  48 +<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
  49 + </div>
  50 + </form>
  51 + </div>
  52 + <div class="portlet-body">
  53 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  54 + <table class="table table-bordered table-hover table-checkable" id="forms">
  55 + <thead>
  56 + <tr>
  57 + <td>序号</td>
  58 + <td>日期</td>
  59 + <td>路别</td>
  60 + <td>车号</td>
  61 + <td>驾驶员</td>
  62 + <td>出场</td>
  63 + <td>进场</td>
  64 + <td>场内0号</td>
  65 + <td>场内B5#</td>
  66 + <td>油卡0号</td>
  67 + <td>油卡-10#</td>
  68 + <td>东站0#</td>
  69 + <td>东站-10#</td>
  70 + <td>场外0#</td>
  71 + <td>场外-10#</td>
  72 + </tr>
  73 + </thead>
  74 + <tbody id="tbody">
  75 +
  76 + </tbody>
  77 + </table>
  78 + </div>
  79 + </div>
  80 + </div>
  81 + </div>
  82 +</div>
  83 +
  84 +<script>
  85 + $(function(){
  86 +
  87 + // 关闭左侧栏
  88 + if (!$('body').hasClass('page-sidebar-closed'))
  89 + $('.menu-toggler.sidebar-toggler').click();
  90 +
  91 + $("#date").datetimepicker({
  92 + format : 'YYYY-MM-DD',
  93 + locale : 'zh-cn'
  94 + });
  95 +
  96 + var d = new Date();
  97 + var year = d.getFullYear();
  98 + var mon = (d.getMonth()+1)>9?(d.getMonth()+1):("0"+(d.getMonth()+1));
  99 + var day = d.getDate()>9?d.getDate():("0"+d.getDate());
  100 + $("#date").val(year + "-" + mon + "-" + day);
  101 +
  102 +
  103 + var date, car, driver;
  104 + $("#query").on("click",function(){
  105 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  106 + layer.msg("请选择日期");
  107 + return;
  108 + }
  109 + date = $("#date").val();
  110 + car = $("#car").val();
  111 + driver = $("#driver").val();
  112 + var i = layer.load(2);
  113 + $get('/refuel/query',{date:date,car:car,driver:driver,type:'query'},function(result){
  114 + // 把数据填充到模版中
  115 + var tbodyHtml = template('refuel',{list:result});
  116 + // 把渲染好的模版html文本追加到表格中
  117 + $('#tbody').html(tbodyHtml);
  118 + layer.close(i);
  119 + });
  120 + });
  121 +
  122 + $("#upload").on("click", function(){
  123 + $.get('refuelUpload.html', function(m){$(pjaxContainer).append(m);});
  124 + });
  125 +
  126 +});
  127 +</script>
  128 +<script type="text/html" id="refuel">
  129 + {{each list as obj i}}
  130 + <tr>
  131 + <td>{{i + 1}}</td>
  132 + <td>{{obj.dateStr}}</td>
  133 + <td>{{obj.lineName}}</td>
  134 + <td>{{obj.car}}</td>
  135 + <td>{{obj.driver}}</td>
  136 + <td>{{obj.outOil}}</td>
  137 + <td>{{obj.inOil}}</td>
  138 + <td>{{obj.inStation0}}</td>
  139 + <td>{{obj.inStation5}}</td>
  140 + <td>{{obj.oilCard0}}</td>
  141 + <td>{{obj.oilCard10}}</td>
  142 + <td>{{obj.eastStation0}}</td>
  143 + <td>{{obj.eastStation10}}</td>
  144 + <td>{{obj.outStation0}}</td>
  145 + <td>{{obj.outStation10}}</td>
  146 + </tr>
  147 + {{/each}}
  148 + {{if list.length == 0}}
  149 + <tr>
  150 + <td colspan="15"><h6 class="muted">没有找到相关数据</h6></td>
  151 + </tr>
  152 + {{/if}}
  153 +</script>
0 154 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/refuelUpload.html 0 → 100644
  1 +<div class="modal fade" id="uploadFile" tabindex="-1" role="basic"
  2 + aria-hidden="true">
  3 + <div class="modal-dialog">
  4 + <div class="modal-content">
  5 + <div class="modal-header">
  6 + <button type="button" class="close" data-dismiss="modal"
  7 + aria-hidden="true"></button>
  8 + <h4 class="modal-title">导入Excel</h4>
  9 + </div>
  10 + <div class="modal-body">
  11 + <form class="form-horizontal" role="form" id="excelFile" method="post"
  12 + action="" enctype="multipart/form-data">
  13 + <div class="alert alert-danger display-hide">
  14 + <button class="close" data-close="alert"></button>
  15 + 您的输入有误,请检查下面的输入项
  16 + </div>
  17 + <div class="form-body">
  18 + <div class="form-group">
  19 + <label class="col-md-3 control-label">选择文件</label>
  20 + <div class="col-md-9">
  21 + <input type="file" name="file" id="file"
  22 + accept="application/vnd.ms-excel"/>
  23 + </div>
  24 + </div>
  25 + </div>
  26 + </form>
  27 + </div>
  28 + <div class="modal-footer">
  29 + <button type="button" class="btn default" id="downLoad">下载模板</button>
  30 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
  31 + <button type="button" class="btn btn-primary" id="submit">确认导入</button>
  32 + </div>
  33 + </div>
  34 + </div>
  35 +</div>
  36 +<script src="/assets/js/ajaxfileupload/ajaxfileupload.js"></script>
  37 +<script id="res_tbody_temp" type="text/html">
  38 +
  39 +</script>
  40 +<script data-exclude=1>
  41 + $(function() {
  42 + var form = $('#excelFile');
  43 + var error = $('.alert-danger', form);
  44 + var user = '';
  45 +
  46 + //modal 显示事件
  47 + $('#uploadFile').on('show.bs.modal', function(){
  48 + })
  49 + .modal('show');
  50 +
  51 + $('#submit').on('click', function() {
  52 + if($("#file").val().trim().length == 0){
  53 + alert("请先选择文件");
  54 + return;
  55 + }
  56 + var j = layer.load(2);
  57 + var param = {};
  58 + param.user = user;
  59 + param.uploadDir = 'upload';
  60 + $.ajaxFileUpload({
  61 + url : '/refuel/uploadFile',
  62 + secureuri : false,
  63 + fileElementId : 'file',
  64 + dataType : 'json',
  65 + data : param,
  66 + success : function(data) {
  67 + layer.close(j);
  68 + if((data.result).indexOf('失败') > -1){
  69 + alert(data.result);
  70 + $("#file").val("");
  71 + } else {
  72 + alert(data.result);
  73 +// alert("文件导入成功");
  74 + $('#uploadFile').modal('hide');
  75 + $('tr.filter .filter-submit').click();
  76 + }
  77 + },
  78 + error : function(data, status, e) {
  79 + layer.close(j);
  80 + alert("文件导入失败");
  81 + }
  82 + })
  83 + });
  84 +
  85 + $('#downLoad').on('click', function(){
  86 + window.open("/downloadFile/downloadModel?fileName=refuel");
  87 + });
  88 +
  89 + function getCurrSelNode(){
  90 + return $.jstree.reference("#modules_tree").get_selected(true);
  91 + }
  92 +
  93 + });
  94 +</script>
0 95 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/refuel_daily.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 + .btn-default{
  18 + margin-left: 5px;
  19 + }
  20 +</style>
  21 +
  22 +<div class="page-head">
  23 + <div class="page-title">
  24 + <h1>油耗日报</h1>
  25 + </div>
  26 +</div>
  27 +
  28 +<div class="row">
  29 + <div class="col-md-12">
  30 + <div class="portlet light porttlet-fit bordered">
  31 + <div class="portlet-title">
  32 + <form class="form-inline" action="">
  33 + <div style="display: inline-block;margin-left: 24px;">
  34 + <span class="item-label" style="width: 80px;">&nbsp;日期: </span>
  35 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  36 + </div>
  37 + <div style="display: inline-block;margin-left: 6px;">
  38 + <span class="item-label" style="width: 80px;">&nbsp;车号: </span>
  39 + <input class="form-control" type="text" id="car" style="width: 180px;"/>
  40 + </div>
  41 + <div style="display: inline-block;margin-left: 6px;">
  42 + <span class="item-label" style="width: 80px;">&nbsp;驾驶员: </span>
  43 + <input class="form-control" type="text" id="driver" style="width: 180px;"/>
  44 + </div>
  45 + <div class="form-group">
  46 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  47 +<!-- <input class="btn btn-default" type="button" id="upload" value="导入Excel"/> -->
  48 +<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
  49 + </div>
  50 + </form>
  51 + </div>
  52 + <div class="portlet-body">
  53 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  54 + <table class="table table-bordered table-hover table-checkable" id="forms">
  55 + <thead>
  56 + <tr>
  57 + <td>序号</td>
  58 + <td>日期</td>
  59 + <td>路别</td>
  60 + <td>车号</td>
  61 + <td>驾驶员</td>
  62 + <td>加注量</td>
  63 + <td>行驶里程</td>
  64 + <td>百公里油耗</td>
  65 + </tr>
  66 + </thead>
  67 + <tbody id="tbody">
  68 +
  69 + </tbody>
  70 + </table>
  71 + </div>
  72 + </div>
  73 + </div>
  74 + </div>
  75 +</div>
  76 +
  77 +<script>
  78 + $(function(){
  79 +
  80 + // 关闭左侧栏
  81 + if (!$('body').hasClass('page-sidebar-closed'))
  82 + $('.menu-toggler.sidebar-toggler').click();
  83 +
  84 + $("#date").datetimepicker({
  85 + format : 'YYYY-MM-DD',
  86 + locale : 'zh-cn'
  87 + });
  88 +
  89 + var d = new Date();
  90 + var year = d.getFullYear();
  91 + var mon = (d.getMonth()+1)>9?(d.getMonth()+1):("0"+(d.getMonth()+1));
  92 + var day = d.getDate()>9?d.getDate():("0"+d.getDate());
  93 + $("#date").val(year + "-" + mon + "-" + day);
  94 +
  95 +
  96 + var date, car, driver;
  97 + $("#query").on("click",function(){
  98 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  99 + layer.msg("请选择日期");
  100 + return;
  101 + }
  102 + date = $("#date").val();
  103 + car = $("#car").val();
  104 + driver = $("#driver").val();
  105 + var i = layer.load(2);
  106 + $get('/refuel/queryDaily',{date:date,car:car,driver:driver,type:'query'},function(result){
  107 + // 把数据填充到模版中
  108 + var tbodyHtml = template('refuel_daily',{list:result});
  109 + // 把渲染好的模版html文本追加到表格中
  110 + $('#tbody').html(tbodyHtml);
  111 + layer.close(i);
  112 + });
  113 + });
  114 +
  115 + $("#upload").on("click", function(){
  116 + $.get('refuelUpload.html', function(m){$(pjaxContainer).append(m);});
  117 + });
  118 +
  119 +});
  120 +</script>
  121 +<script type="text/html" id="refuel_daily">
  122 + {{each list as obj i}}
  123 + <tr>
  124 + <td>{{i + 1}}</td>
  125 + <td>{{obj.date}}</td>
  126 + <td>{{obj.line}}</td>
  127 + <td>{{obj.car}}</td>
  128 + <td>{{obj.driver}}</td>
  129 + <td>{{obj.oil}}</td>
  130 + <td>{{obj.realMileage}}</td>
  131 + <td>{{obj.consume}}</td>
  132 + </tr>
  133 + {{/each}}
  134 + {{if list.length == 0}}
  135 + <tr>
  136 + <td colspan="15"><h6 class="muted">没有找到相关数据</h6></td>
  137 + </tr>
  138 + {{/if}}
  139 +</script>
0 140 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/repairReport.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 +</style>
  18 +
  19 +<div class="page-head">
  20 + <div class="page-title">
  21 + <h1>维修上报记录</h1>
  22 + </div>
  23 +</div>
  24 +
  25 +<div class="row">
  26 + <div class="col-md-12">
  27 + <div class="portlet light porttlet-fit bordered">
  28 + <div class="portlet-title">
  29 + <form id="history" class="form-inline" action="">
  30 + <div style="display: inline-block;">
  31 + <span class="item-label" style="width: 80px;">线路: </span>
  32 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  33 + </div>
  34 + <div style="display: inline-block;margin-left: 15px;">
  35 + <span class="item-label" style="width: 80px;">时间: </span>
  36 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  37 + </div>
  38 + <div style="display: inline-block;margin-left: 15px">
  39 + <span class="item-label" style="width: 140px;">车辆编码: </span>
  40 + <select class="form-control" name="code" id="code" style="width: 180px;"></select>
  41 + </div>
  42 + <div class="form-group">
  43 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  44 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  45 + </div>
  46 + </form>
  47 + </div>
  48 + <div class="portlet-body">
  49 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px;">
  50 + <table class="table table-bordered table-hover table-checkable" id="forms">
  51 + <thead>
  52 + <tr class="hidden">
  53 + <th>序号</th>
  54 + <th>线路</th>
  55 + <th>车辆编码</th>
  56 + <th>发车时间</th>
  57 + <th>上报人</th>
  58 + <th>上报时间</th>
  59 + <th>维修类型</th>
  60 + <th>上报状态</th>
  61 + </tr>
  62 + </thead>
  63 + <tbody>
  64 +
  65 + </tbody>
  66 + </table>
  67 + </div>
  68 + </div>
  69 + </div>
  70 + </div>
  71 +</div>
  72 +
  73 +<script>
  74 + $(function(){
  75 + $('#export').attr('disabled', "true");
  76 +
  77 + // 关闭左侧栏
  78 + if (!$('body').hasClass('page-sidebar-closed'))
  79 + $('.menu-toggler.sidebar-toggler').click();
  80 +
  81 + $("#date").datetimepicker({
  82 + format : 'YYYY-MM-DD',
  83 + locale : 'zh-cn'
  84 + });
  85 +
  86 + $.get('/report/lineList',function(xlList){
  87 + var data = [];
  88 + $.get('/user/companyData', function(result){
  89 + debugger;
  90 + for(var i = 0; i < result.length; i++){
  91 + var companyCode = result[i].companyCode;
  92 + var children = result[i].children;
  93 + for(var j = 0; j < children.length; j++){
  94 + var code = children[j].code;
  95 + for(var k=0;k < xlList.length;k++ ){
  96 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  97 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  98 + }
  99 + }
  100 + }
  101 + }
  102 + initPinYinSelect2('#line',data,'');
  103 +
  104 + });
  105 + });
  106 +
  107 +
  108 + $('#code').select2({
  109 + ajax: {
  110 + url: '/realSchedule/sreachVehic',
  111 + dataType: 'json',
  112 + delay: 150,
  113 + data: function(params){
  114 + return{nbbm: params.term};
  115 + },
  116 + processResults: function (data) {
  117 + return {
  118 + results: data
  119 + };
  120 + },
  121 + cache: true
  122 + },
  123 + templateResult: function(repo){
  124 + if (repo.loading) return repo.text;
  125 + var h = '<span>'+repo.text+'</span>';
  126 + h += (repo.lineName?'&nbsp;<span class="select2-desc">'+repo.lineName+'</span>':'');
  127 + return h;
  128 + },
  129 + escapeMarkup: function (markup) { return markup; },
  130 + minimumInputLength: 1,
  131 + templateSelection: function(repo){
  132 + return repo.text;
  133 + },
  134 + language: {
  135 + noResults: function(){
  136 + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>';
  137 + },
  138 + inputTooShort : function(e) {
  139 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>';
  140 + },
  141 + searching : function() {
  142 + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
  143 + }
  144 + }
  145 + });
  146 +
  147 + var line = $("#line").val();
  148 + var date = $("#date").val();
  149 + var code = $("#code").val();
  150 + var lineName = $('#line option:selected').text();
  151 + $("#query").on("click",function(){
  152 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  153 + layer.msg("请选择时间");
  154 + return;
  155 + }
  156 + line = $("#line").val();
  157 + date = $("#date").val();
  158 + code = $("#code").val();
  159 + lineName = $('#line option:selected').text();
  160 + var type = "query";
  161 + $(".hidden").removeClass("hidden");
  162 + var i = layer.load(2);
  163 + $get('/realSchedule/wxsb',{line:line,date:date,code:code,type:type},function(result){
  164 + // 把数据填充到模版中
  165 + var tbodyHtml = template('list_repair',{list:result});
  166 + // 把渲染好的模版html文本追加到表格中
  167 + $('#forms tbody').html(tbodyHtml);
  168 + layer.close(i);
  169 +
  170 + if(result.length == 0)
  171 + $("#export").attr('disabled',"true");
  172 + else
  173 + $("#export").removeAttr("disabled");
  174 +
  175 + });
  176 + });
  177 +
  178 + $("#export").on("click",function(){
  179 + var type = "export";
  180 + var i = layer.load(2);
  181 + $get('/realSchedule/wxsb', {line:line,date:date,code:code,type:type}, function(result){
  182 + window.open("/downloadFile/download?fileName="
  183 + +moment(date).format("YYYYMMDD")
  184 + +"-"+lineName+"-维修上报记录");
  185 + layer.close(i);
  186 + });
  187 + });
  188 +
  189 + });
  190 +</script>
  191 +<script type="text/html" id="list_repair">
  192 + {{each list as obj i}}
  193 + <tr>
  194 + <td>{{i+1}}</td>
  195 + <td>{{obj.lineName}}</td>
  196 + <td>{{obj.incode}}</td>
  197 + <td>{{obj.departureTime}}</td>
  198 + <td>{{obj.reportUser}}</td>
  199 + <td>{{obj.reportDateStr}}</td>
  200 + <td>{{obj.repairType}}</td>
  201 + <td>{{obj.reportStateStr}}</td>
  202 + </tr>
  203 + {{/each}}
  204 + {{if list.length == 0}}
  205 + <tr>
  206 + <td colspan="8"><h6 class="muted">没有找到相关数据</h6></td>
  207 + </tr>
  208 + {{/if}}
  209 +</script>
0 210 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/css/line_schedule.css
... ... @@ -370,6 +370,23 @@ span.fcsj-diff {
370 370 padding-left: 12px;
371 371 }
372 372  
  373 +.repair-type-checkbox-list {
  374 + height: 180px;
  375 + overflow: auto;
  376 + border: 1px solid #c4c4c4;
  377 + border-radius: 4px;
  378 + padding: 9px 0;
  379 +}
  380 +
  381 +.repair-type-checkbox-list label {
  382 + display: block;
  383 + font-size: 14px;
  384 + border-bottom: 1px dashed #e6e3e3;
  385 + height: 30px;
  386 + line-height: 30px;
  387 + padding-left: 12px;
  388 +}
  389 +
373 390 /*.sch-time-checkbox-list label input[type=checkbox] {
374 391 width: 20px;
375 392 height: 18px !important;
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/fcxxwt.html
... ... @@ -125,6 +125,21 @@
125 125 </div>
126 126 </div>
127 127 </div>
  128 + <div class="uk-grid">
  129 + <div class="uk-width-1-1">
  130 + <div class="uk-form-row">
  131 + <label class="uk-form-label" >维修类型</label>
  132 + <div class="uk-form-controls repair-type-checkbox-list">
  133 + {{each repairTypes as repair i}}
  134 + <label>
  135 + <input class="i-cbox" name="repairTypes[]" value="{{repair.code}}" type="checkbox" title="{{repair.name}}">
  136 + {{repair.name}}
  137 + </label>
  138 + {{/each}}
  139 + </div>
  140 + </div>
  141 + </div>
  142 + </div>
128 143 <div class="uk-grid">
129 144 <div class="uk-width-1-1">
130 145 <div class="uk-form-row ct-stacked">
... ... @@ -166,13 +181,23 @@
166 181 <script>
167 182 (function() {
168 183 var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他'];
  184 + var repairTypes = [{name:"轨迹不连续", code:"9101"}, {name:"无轨迹", code:"9102"}, {name:"收不到调度指令", code:"9103"}, {name:"调度指令延迟", code:"9105"}, {name:"信号漂移", code:"9104"}, {name:"其它GPS报修", code:"9109"}];
169 185 var modal = '#schedule-fcxxwt-modal'
170 186 ,sch;
171 187 $(modal).on('init', function(e, data) {
172 188 e.stopPropagation();
173 189 sch=data.sch;
174   - var formHtml = template('schedule-fcxxwt-form-temp', {sch: sch, adjustExps:adjustExps});
  190 + var formHtml = template('schedule-fcxxwt-form-temp', {sch: sch, adjustExps:adjustExps, repairTypes:repairTypes});
175 191 $('form', modal).html(formHtml);
  192 + $('input:checkbox').click(function(){
  193 + var remark = $('[name=remarks]').val(), title = $(this).prop("title");
  194 + if ($(this).prop('checked')) {
  195 + if (remark.indexOf(title) > -1) return;
  196 + $('[name=remarks]').val((remark ? remark + ";" : "") + title);
  197 + } else {
  198 + $('[name=remarks]').val(remark.replace(";" + title, "").replace(title + ";", "").replace(title, ""));
  199 + }
  200 + });
176 201 //字典转换
177 202 dictionaryUtils.transformDom($('.nt-dictionary', modal));
178 203  
... ... @@ -184,6 +209,20 @@
184 209 gb_common.personAutocomplete($('.jsy-autocom', modal));
185 210 //售票员
186 211 gb_common.personAutocomplete($('.spy-autocom', modal));
  212 + // 维修类型选中
  213 + var initRepair = function() {
  214 + var remark = $('[name=remarks]').val(), items = remark.split(';');
  215 + for (var i = 0;i < items.length;i++) {
  216 + if (items[i].length > 2) {
  217 + for (var j = 0;j < repairTypes.length;j++) {
  218 + if (items[i] == repairTypes[j].name) {
  219 + $('input:checkbox[value=' + repairTypes[j].code + ']').prop('checked', true);
  220 + }
  221 + }
  222 + }
  223 + }
  224 + }
  225 + initRepair();
187 226  
188 227 //submit
189 228 var f = $('form', modal).formValidation(gb_form_validation_opts);
... ... @@ -201,6 +240,8 @@
201 240 var normalDestory = data.jhlc==0 && sch.bcType != 'in' && sch.bcType != 'out';
202 241 //修改里程
203 242 var editJhlc = data.jhlc != sch.jhlc && data.jhlc != 0;
  243 + // 修改报修类型为字符串
  244 + if (data.repairTypes) data.repairTypes = data.repairTypes.join(";");
204 245 if(!data.adjustExps && (data.status==-1 || normalDestory || editJhlc)){
205 246 notify_err("当前操作需要选择调整原因!");
206 247 return;
... ... @@ -240,7 +281,7 @@
240 281  
241 282 $('[name=adjustExps]', f).on('change', function(){
242 283 var rem=$('[name=remarks]', f);
243   - rem.val(rem.val() + $(this).val() + ',').trigger('input');
  284 + rem.val((rem.val() ? rem.val() + ";" : "") + $(this).val()).trigger('input');
244 285 });
245 286  
246 287  
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/wxsb.html
... ... @@ -14,7 +14,7 @@
14 14 <div class="uk-form-row">
15 15 <label class="uk-form-label" >车辆编码</label>
16 16 <div class="uk-form-controls">
17   - <input type="text" name="nbbm" value="{{clZbh}}" readonly>
  17 + <input type="text" name="clZbh" value="{{clZbh}}" readonly>
18 18 </div>
19 19 </div>
20 20 </div>
... ... @@ -22,7 +22,7 @@
22 22 <div class="uk-form-row">
23 23 <label class="uk-form-label" >报修类型</label>
24 24 <div class="uk-form-controls">
25   - <select name="bxType"></select>
  25 + <select name="repairTypes"></select>
26 26 </div>
27 27 </div>
28 28 </div>
... ... @@ -44,12 +44,13 @@
44 44 var formHtml = template('schedule-wxsb-form-temp', sch);
45 45 $('form', modal).html(formHtml);
46 46  
47   - //班次类型字典
48   - var bxtypes=[{code:"9101", des:"轨迹不连续"}, {code:"9102", des:"无轨迹"}, {code:"9103", des:"收不到调度指令"}, {code:"9104", des:"漂移"}, {code:"9109", des:"其它"}],opts='';
49   - for(var i = 0;i < bxtypes.length;i++){
50   - opts+='<option value="'+bxtypes[i].code+'">'+bxtypes[i].des+'</option>';
  47 + //报修类型字典
  48 + var opts = new Array();
  49 + var repairTypes=[{name:"录像不连续", code:"9201"}, {name:"无录像", code:"9202"}, {name:"录像缺通告", code:"9203"}, {name:"无法调取录像", code:"9204"}, {name:"其它录像报修", code:"9209"}, {name:"黑屏", code:"9301"}, {name:"间歇性黑屏", code:"9302"}, {name:"中门视屏无", code:"9303"}, {name:"卡在启动界面", code:"9304"}, {name:"倒车视频无", code:"9305"}, {name:"启动后显示倒车", code:"9306"}, {name:"其它屏幕报修", code:"9309"}];
  50 + for(var i = 0;i < repairTypes.length;i++){
  51 + opts.push('<option value="'+repairTypes[i].code+'">'+repairTypes[i].name+'</option>');
51 52 }
52   - $('[name=bxType]', modal).html(opts);
  53 + $('[name=repairTypes]', modal).html(opts.join(""));
53 54  
54 55 //submit
55 56 var f = $('form', modal).formValidation(gb_form_validation_opts);
... ...
src/main/resources/traffic-jdbc.properties
... ... @@ -4,7 +4,7 @@
4 4 #ms.mysql.password= 123456
5 5  
6 6 ms.mysql.driver= com.mysql.jdbc.Driver
7   -ms.mysql.url= jdbc:mysql://10.10.150.226:3306/ms?useUnicode=true&characterEncoding=utf-8
  7 +ms.mysql.url= jdbc:mysql://10.10.200.226:3306/ms?useUnicode=true&characterEncoding=utf-8
8 8 ms.mysql.username= root
9 9 ms.mysql.password= root2jsp
10 10  
... ...