Commit 3b669a5d9439e6e9d2604143cf38ddf2953c2d9b
Merge branch 'pudong_jdk8_wvp' of http://192.168.168.245:8888/panzhaov5/bsth_con…
…trol into pudong_jdk8_wvp
Showing
10 changed files
with
2289 additions
and
2260 deletions
Too many changes to show.
To preserve performance only 10 of 116 files are displayed.
src/main/java/com/bsth/common/Constants.java
| ... | ... | @@ -22,6 +22,8 @@ public class Constants { |
| 22 | 22 | public static final String LOGIN_FAILURE = "/user/loginFailure"; |
| 23 | 23 | public static final String CAPTCHA = "/captcha.jpg"; |
| 24 | 24 | |
| 25 | + public static final String I18N_LOGIN = "/i18n/login/**"; | |
| 26 | + | |
| 25 | 27 | // springboot manage health的检测url |
| 26 | 28 | public static final String ACTUATOR_MANAGEMENT_HEALTH = "/manage/health"; |
| 27 | 29 | // 车辆数据同步url | ... | ... |
src/main/java/com/bsth/controller/DeviceGpsController.java
| 1 | -package com.bsth.controller; | |
| 2 | - | |
| 3 | -import com.bsth.data.gpsdata_v2.GpsRealData; | |
| 4 | -import com.bsth.data.gpsdata_v2.entity.GpsEntity; | |
| 5 | -import com.fasterxml.jackson.core.JsonParseException; | |
| 6 | -import com.fasterxml.jackson.databind.JsonMappingException; | |
| 7 | -import com.fasterxml.jackson.databind.ObjectMapper; | |
| 8 | -import org.apache.commons.lang.StringEscapeUtils; | |
| 9 | -import org.apache.poi.hssf.usermodel.*; | |
| 10 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | -import org.springframework.util.StringUtils; | |
| 12 | -import org.springframework.web.bind.annotation.*; | |
| 13 | -import org.springframework.web.multipart.MultipartFile; | |
| 14 | - | |
| 15 | -import javax.servlet.http.HttpServletRequest; | |
| 16 | -import javax.servlet.http.HttpServletResponse; | |
| 17 | -import java.io.*; | |
| 18 | -import java.text.SimpleDateFormat; | |
| 19 | -import java.util.*; | |
| 20 | - | |
| 21 | -@RestController | |
| 22 | -@RequestMapping("devicegps") | |
| 23 | -public class DeviceGpsController { | |
| 24 | - | |
| 25 | - @Autowired | |
| 26 | - GpsRealData gpsRealData; | |
| 27 | - | |
| 28 | - @RequestMapping(value = "/real/line/{lineCode}") | |
| 29 | - public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) { | |
| 30 | - return gpsRealData.getByLine(lineCode); | |
| 31 | - } | |
| 32 | - | |
| 33 | - @RequestMapping(value = "/real/all") | |
| 34 | - public List<GpsEntity> findByLineCodes() { | |
| 35 | - return new ArrayList<>(gpsRealData.all()); | |
| 36 | - } | |
| 37 | - | |
| 38 | - @RequestMapping(value = "/open", method = RequestMethod.POST) | |
| 39 | - public Map<String, Object> open(@RequestParam(value = "_txt_", required = false) MultipartFile file, HttpServletRequest request) { | |
| 40 | - Map<String, Object> res = new HashMap<>(); | |
| 41 | - File rf = new File(request.getServletContext().getRealPath("/temp"), System.currentTimeMillis() + ""); | |
| 42 | - File rd = rf.getParentFile(); | |
| 43 | - if (!rd.exists()) { | |
| 44 | - rd.mkdirs(); | |
| 45 | - } | |
| 46 | - | |
| 47 | - BufferedReader reader = null; | |
| 48 | - try { | |
| 49 | - file.transferTo(rf); | |
| 50 | - reader = new BufferedReader(new InputStreamReader(new FileInputStream(rf), "GBK")); | |
| 51 | - String line = null; | |
| 52 | - List<Map<String, Object>> data = new ArrayList<>(); | |
| 53 | - while ((line = reader.readLine()) != null) { | |
| 54 | - if (!StringUtils.isEmpty(line)) { | |
| 55 | - String temp[] = line.split(","); | |
| 56 | - if (temp.length != 4) { | |
| 57 | - res.put("errCode", 1); | |
| 58 | - res.put("msg", "txt文档格式错误,请检查"); | |
| 59 | - return res; | |
| 60 | - } | |
| 61 | - Map<String, Object> info = new HashMap<>(); | |
| 62 | - info.put("lineName", temp[0]); | |
| 63 | - info.put("lineCode", temp[1]); | |
| 64 | - info.put("inCode", temp[2]); | |
| 65 | - info.put("deviceId", temp[3]); | |
| 66 | - info.put("detail", gpsRealData.get(temp[3])); | |
| 67 | - | |
| 68 | - data.add(info); | |
| 69 | - } | |
| 70 | - } | |
| 71 | - // 删除临时文件 | |
| 72 | - rf.delete(); | |
| 73 | - res.put("errCode", 0); | |
| 74 | - res.put("data", data); | |
| 75 | - } catch (IllegalStateException e) { | |
| 76 | - // TODO Auto-generated catch block | |
| 77 | - e.printStackTrace(); | |
| 78 | - } catch (IOException e) { | |
| 79 | - // TODO Auto-generated catch block | |
| 80 | - e.printStackTrace(); | |
| 81 | - } finally { | |
| 82 | - try { | |
| 83 | - if (reader != null) reader.close(); | |
| 84 | - } catch (IOException e) { | |
| 85 | - // TODO Auto-generated catch block | |
| 86 | - e.printStackTrace(); | |
| 87 | - } | |
| 88 | - } | |
| 89 | - | |
| 90 | - return res; | |
| 91 | - } | |
| 92 | - | |
| 93 | - @SuppressWarnings("unchecked") | |
| 94 | - @RequestMapping(value = "/opened", method = RequestMethod.POST) | |
| 95 | - public Map<String, Object> opened(@RequestParam(value = "json")String json) { | |
| 96 | - json = StringEscapeUtils.unescapeHtml(json); | |
| 97 | - Map<String, Object> res = new HashMap<>(); | |
| 98 | - List<Map<String, Object>> data = null; | |
| 99 | - try { | |
| 100 | - data = new ObjectMapper().readValue(json, List.class); | |
| 101 | - for (Map<String, Object> info : data) { | |
| 102 | - info.put("detail", gpsRealData.get((String)info.get("deviceId"))); | |
| 103 | - } | |
| 104 | - | |
| 105 | - res.put("errCode", 0); | |
| 106 | - res.put("data", data); | |
| 107 | - } catch (JsonParseException e) { | |
| 108 | - // TODO Auto-generated catch block | |
| 109 | - e.printStackTrace(); | |
| 110 | - } catch (JsonMappingException e) { | |
| 111 | - // TODO Auto-generated catch block | |
| 112 | - e.printStackTrace(); | |
| 113 | - } catch (IOException e) { | |
| 114 | - // TODO Auto-generated catch block | |
| 115 | - e.printStackTrace(); | |
| 116 | - } | |
| 117 | - | |
| 118 | - return res; | |
| 119 | - } | |
| 120 | - | |
| 121 | - @SuppressWarnings("unchecked") | |
| 122 | - @RequestMapping(value = "/export", method = RequestMethod.POST) | |
| 123 | - public void export(@RequestParam(value = "json")String json, HttpServletResponse response) { | |
| 124 | - json = StringEscapeUtils.unescapeHtml(json); | |
| 125 | - List<Map<String, Object>> data = null; | |
| 126 | - OutputStream out = null; | |
| 127 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 128 | - try { | |
| 129 | - data = new ObjectMapper().readValue(json, List.class); | |
| 130 | - for (Map<String, Object> info : data) { | |
| 131 | - Map<String, Object> detail = (Map<String, Object>)info.get("detail"); | |
| 132 | - if (detail != null) { | |
| 133 | - info.put("lineId", detail.get("lineId")); | |
| 134 | - info.put("valid", (int)detail.get("valid") == 0 ? "$$$$$${txt-3829}" : "$$$$$${txt-4006}"); | |
| 135 | - info.put("timestamp", sdf.format(new Date((Long)detail.get("timestamp")))); | |
| 136 | - info.put("version", detail.get("version")); | |
| 137 | - } else { | |
| 138 | - info.put("lineId", ""); | |
| 139 | - info.put("valid", ""); | |
| 140 | - info.put("timestamp", ""); | |
| 141 | - info.put("version", ""); | |
| 142 | - } | |
| 143 | - } | |
| 144 | - | |
| 145 | - List<Header> head = new ArrayList<>(); | |
| 146 | - head.add(new Header("$$$$$${txt-3381}", "lineCode")); | |
| 147 | - head.add(new Header("$$$$$${txt-3347}", "lineName")); | |
| 148 | - head.add(new Header("$$$$$${txt-2576}", "inCode")); | |
| 149 | - head.add(new Header("$$$$$${txt-3562}", "deviceId")); | |
| 150 | - head.add(new Header("$$$$$${txt-3381}", "lineId")); | |
| 151 | - head.add(new Header("GPS", "valid")); | |
| 152 | - head.add(new Header("report", "timestamp")); | |
| 153 | - head.add(new Header("版本", "version")); | |
| 154 | - | |
| 155 | - // 清空response | |
| 156 | - response.reset(); | |
| 157 | - // 设置response的Header | |
| 158 | - response.addHeader("Content-Disposition", "attachment;filename=" + System.currentTimeMillis() + ".xls"); | |
| 159 | - response.setContentType("application/vnd.ms-excel;charset=UTF-8"); | |
| 160 | - out = new BufferedOutputStream(response.getOutputStream()); | |
| 161 | - excel(head, data, out); | |
| 162 | - out.flush(); | |
| 163 | - } catch (JsonParseException e) { | |
| 164 | - // TODO Auto-generated catch block | |
| 165 | - e.printStackTrace(); | |
| 166 | - } catch (JsonMappingException e) { | |
| 167 | - // TODO Auto-generated catch block | |
| 168 | - e.printStackTrace(); | |
| 169 | - } catch (IOException e) { | |
| 170 | - // TODO Auto-generated catch block | |
| 171 | - e.printStackTrace(); | |
| 172 | - } finally { | |
| 173 | - try { | |
| 174 | - if (out != null) out.close(); | |
| 175 | - } catch (IOException e) { | |
| 176 | - e.printStackTrace(); | |
| 177 | - } | |
| 178 | - } | |
| 179 | - } | |
| 180 | - | |
| 181 | - private void excel(List<Header> head, List<Map<String, Object>> data, OutputStream out) throws IOException { | |
| 182 | - // 声明一个工作薄 | |
| 183 | - HSSFWorkbook wb = new HSSFWorkbook(); | |
| 184 | - // 生成一个表格 | |
| 185 | - HSSFSheet sheet = wb.createSheet("1"); | |
| 186 | - // 产生表格标题行 | |
| 187 | - HSSFRow row = sheet.createRow(0); | |
| 188 | - for (int i = 0;i < head.size();i++) { | |
| 189 | - HSSFCell cell = row.createCell(i); | |
| 190 | - HSSFRichTextString text = new HSSFRichTextString(head.get(i).getDescribe()); | |
| 191 | - cell.setCellValue(text); | |
| 192 | - } | |
| 193 | - | |
| 194 | - int rownum = 1; | |
| 195 | - for (Map<String, Object> map : data) { | |
| 196 | - HSSFRow r = sheet.createRow(rownum); | |
| 197 | - for (int i = 0;i < head.size();i++) { | |
| 198 | - HSSFCell cell = r.createCell(i); | |
| 199 | - HSSFRichTextString text = new HSSFRichTextString(String.valueOf(map.get(head.get(i).getField()))); | |
| 200 | - cell.setCellValue(text); | |
| 201 | - } | |
| 202 | - rownum++; | |
| 203 | - } | |
| 204 | - | |
| 205 | - wb.write(out); | |
| 206 | - wb.close(); | |
| 207 | - } | |
| 208 | - | |
| 209 | - final class Header { | |
| 210 | - private String describe; | |
| 211 | - private String field; | |
| 212 | - | |
| 213 | - Header(){ | |
| 214 | - | |
| 215 | - } | |
| 216 | - | |
| 217 | - Header(String describe, String field) { | |
| 218 | - this.describe = describe; | |
| 219 | - this.field = field; | |
| 220 | - } | |
| 221 | - | |
| 222 | - public String getDescribe() { | |
| 223 | - return describe; | |
| 224 | - } | |
| 225 | - | |
| 226 | - public void setDescribe(String describe) { | |
| 227 | - this.describe = describe; | |
| 228 | - } | |
| 229 | - | |
| 230 | - public String getField() { | |
| 231 | - return field; | |
| 232 | - } | |
| 233 | - | |
| 234 | - public void setField(String field) { | |
| 235 | - this.field = field; | |
| 236 | - } | |
| 237 | - } | |
| 238 | -} | |
| 1 | +package com.bsth.controller; | |
| 2 | + | |
| 3 | +import com.bsth.data.gpsdata_v2.GpsRealData; | |
| 4 | +import com.bsth.data.gpsdata_v2.entity.GpsEntity; | |
| 5 | +import com.bsth.util.I18n; | |
| 6 | +import com.fasterxml.jackson.core.JsonParseException; | |
| 7 | +import com.fasterxml.jackson.databind.JsonMappingException; | |
| 8 | +import com.fasterxml.jackson.databind.ObjectMapper; | |
| 9 | +import org.apache.commons.lang.StringEscapeUtils; | |
| 10 | +import org.apache.poi.hssf.usermodel.*; | |
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | +import org.springframework.util.StringUtils; | |
| 13 | +import org.springframework.web.bind.annotation.*; | |
| 14 | +import org.springframework.web.multipart.MultipartFile; | |
| 15 | + | |
| 16 | +import javax.servlet.http.HttpServletRequest; | |
| 17 | +import javax.servlet.http.HttpServletResponse; | |
| 18 | +import java.io.*; | |
| 19 | +import java.text.SimpleDateFormat; | |
| 20 | +import java.util.*; | |
| 21 | + | |
| 22 | +@RestController | |
| 23 | +@RequestMapping("devicegps") | |
| 24 | +public class DeviceGpsController { | |
| 25 | + | |
| 26 | + @Autowired | |
| 27 | + GpsRealData gpsRealData; | |
| 28 | + | |
| 29 | + @RequestMapping(value = "/real/line/{lineCode}") | |
| 30 | + public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) { | |
| 31 | + return gpsRealData.getByLine(lineCode); | |
| 32 | + } | |
| 33 | + | |
| 34 | + @RequestMapping(value = "/real/all") | |
| 35 | + public List<GpsEntity> findByLineCodes() { | |
| 36 | + return new ArrayList<>(gpsRealData.all()); | |
| 37 | + } | |
| 38 | + | |
| 39 | + @RequestMapping(value = "/open", method = RequestMethod.POST) | |
| 40 | + public Map<String, Object> open(@RequestParam(value = "_txt_", required = false) MultipartFile file, HttpServletRequest request) { | |
| 41 | + Map<String, Object> res = new HashMap<>(); | |
| 42 | + File rf = new File(request.getServletContext().getRealPath("/temp"), System.currentTimeMillis() + ""); | |
| 43 | + File rd = rf.getParentFile(); | |
| 44 | + if (!rd.exists()) { | |
| 45 | + rd.mkdirs(); | |
| 46 | + } | |
| 47 | + | |
| 48 | + BufferedReader reader = null; | |
| 49 | + try { | |
| 50 | + file.transferTo(rf); | |
| 51 | + reader = new BufferedReader(new InputStreamReader(new FileInputStream(rf), "GBK")); | |
| 52 | + String line = null; | |
| 53 | + List<Map<String, Object>> data = new ArrayList<>(); | |
| 54 | + while ((line = reader.readLine()) != null) { | |
| 55 | + if (!StringUtils.isEmpty(line)) { | |
| 56 | + String temp[] = line.split(","); | |
| 57 | + if (temp.length != 4) { | |
| 58 | + res.put("errCode", 1); | |
| 59 | + res.put("msg", "txt文档格式错误,请检查"); | |
| 60 | + return res; | |
| 61 | + } | |
| 62 | + Map<String, Object> info = new HashMap<>(); | |
| 63 | + info.put("lineName", temp[0]); | |
| 64 | + info.put("lineCode", temp[1]); | |
| 65 | + info.put("inCode", temp[2]); | |
| 66 | + info.put("deviceId", temp[3]); | |
| 67 | + info.put("detail", gpsRealData.get(temp[3])); | |
| 68 | + | |
| 69 | + data.add(info); | |
| 70 | + } | |
| 71 | + } | |
| 72 | + // 删除临时文件 | |
| 73 | + rf.delete(); | |
| 74 | + res.put("errCode", 0); | |
| 75 | + res.put("data", data); | |
| 76 | + } catch (IllegalStateException e) { | |
| 77 | + // TODO Auto-generated catch block | |
| 78 | + e.printStackTrace(); | |
| 79 | + } catch (IOException e) { | |
| 80 | + // TODO Auto-generated catch block | |
| 81 | + e.printStackTrace(); | |
| 82 | + } finally { | |
| 83 | + try { | |
| 84 | + if (reader != null) reader.close(); | |
| 85 | + } catch (IOException e) { | |
| 86 | + // TODO Auto-generated catch block | |
| 87 | + e.printStackTrace(); | |
| 88 | + } | |
| 89 | + } | |
| 90 | + | |
| 91 | + return res; | |
| 92 | + } | |
| 93 | + | |
| 94 | + @SuppressWarnings("unchecked") | |
| 95 | + @RequestMapping(value = "/opened", method = RequestMethod.POST) | |
| 96 | + public Map<String, Object> opened(@RequestParam(value = "json")String json) { | |
| 97 | + json = StringEscapeUtils.unescapeHtml(json); | |
| 98 | + Map<String, Object> res = new HashMap<>(); | |
| 99 | + List<Map<String, Object>> data = null; | |
| 100 | + try { | |
| 101 | + data = new ObjectMapper().readValue(json, List.class); | |
| 102 | + for (Map<String, Object> info : data) { | |
| 103 | + info.put("detail", gpsRealData.get((String)info.get("deviceId"))); | |
| 104 | + } | |
| 105 | + | |
| 106 | + res.put("errCode", 0); | |
| 107 | + res.put("data", data); | |
| 108 | + } catch (JsonParseException e) { | |
| 109 | + // TODO Auto-generated catch block | |
| 110 | + e.printStackTrace(); | |
| 111 | + } catch (JsonMappingException e) { | |
| 112 | + // TODO Auto-generated catch block | |
| 113 | + e.printStackTrace(); | |
| 114 | + } catch (IOException e) { | |
| 115 | + // TODO Auto-generated catch block | |
| 116 | + e.printStackTrace(); | |
| 117 | + } | |
| 118 | + | |
| 119 | + return res; | |
| 120 | + } | |
| 121 | + | |
| 122 | + @SuppressWarnings("unchecked") | |
| 123 | + @RequestMapping(value = "/export", method = RequestMethod.POST) | |
| 124 | + public void export(@RequestParam(value = "json")String json, HttpServletResponse response) { | |
| 125 | + json = StringEscapeUtils.unescapeHtml(json); | |
| 126 | + List<Map<String, Object>> data = null; | |
| 127 | + OutputStream out = null; | |
| 128 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 129 | + try { | |
| 130 | + data = new ObjectMapper().readValue(json, List.class); | |
| 131 | + for (Map<String, Object> info : data) { | |
| 132 | + Map<String, Object> detail = (Map<String, Object>)info.get("detail"); | |
| 133 | + if (detail != null) { | |
| 134 | + info.put("lineId", detail.get("lineId")); | |
| 135 | + info.put("valid", (int)detail.get("valid") == 0 ? I18n.getInstance().getMessage("txt-3829") : I18n.getInstance().getMessage("txt-4006")); | |
| 136 | + info.put("timestamp", sdf.format(new Date((Long)detail.get("timestamp")))); | |
| 137 | + info.put("version", detail.get("version")); | |
| 138 | + } else { | |
| 139 | + info.put("lineId", ""); | |
| 140 | + info.put("valid", ""); | |
| 141 | + info.put("timestamp", ""); | |
| 142 | + info.put("version", ""); | |
| 143 | + } | |
| 144 | + } | |
| 145 | + | |
| 146 | + List<Header> head = new ArrayList<>(); | |
| 147 | + head.add(new Header(I18n.getInstance().getMessage("txt-3381"), "lineCode")); | |
| 148 | + head.add(new Header(I18n.getInstance().getMessage("txt-3347"), "lineName")); | |
| 149 | + head.add(new Header(I18n.getInstance().getMessage("txt-2576"), "inCode")); | |
| 150 | + head.add(new Header(I18n.getInstance().getMessage("txt-3562"), "deviceId")); | |
| 151 | + head.add(new Header(I18n.getInstance().getMessage("txt-3381"), "lineId")); | |
| 152 | + head.add(new Header("GPS", "valid")); | |
| 153 | + head.add(new Header("report", "timestamp")); | |
| 154 | + head.add(new Header("版本", "version")); | |
| 155 | + | |
| 156 | + // 清空response | |
| 157 | + response.reset(); | |
| 158 | + // 设置response的Header | |
| 159 | + response.addHeader("Content-Disposition", "attachment;filename=" + System.currentTimeMillis() + ".xls"); | |
| 160 | + response.setContentType("application/vnd.ms-excel;charset=UTF-8"); | |
| 161 | + out = new BufferedOutputStream(response.getOutputStream()); | |
| 162 | + excel(head, data, out); | |
| 163 | + out.flush(); | |
| 164 | + } catch (JsonParseException e) { | |
| 165 | + // TODO Auto-generated catch block | |
| 166 | + e.printStackTrace(); | |
| 167 | + } catch (JsonMappingException e) { | |
| 168 | + // TODO Auto-generated catch block | |
| 169 | + e.printStackTrace(); | |
| 170 | + } catch (IOException e) { | |
| 171 | + // TODO Auto-generated catch block | |
| 172 | + e.printStackTrace(); | |
| 173 | + } finally { | |
| 174 | + try { | |
| 175 | + if (out != null) out.close(); | |
| 176 | + } catch (IOException e) { | |
| 177 | + e.printStackTrace(); | |
| 178 | + } | |
| 179 | + } | |
| 180 | + } | |
| 181 | + | |
| 182 | + private void excel(List<Header> head, List<Map<String, Object>> data, OutputStream out) throws IOException { | |
| 183 | + // 声明一个工作薄 | |
| 184 | + HSSFWorkbook wb = new HSSFWorkbook(); | |
| 185 | + // 生成一个表格 | |
| 186 | + HSSFSheet sheet = wb.createSheet("1"); | |
| 187 | + // 产生表格标题行 | |
| 188 | + HSSFRow row = sheet.createRow(0); | |
| 189 | + for (int i = 0;i < head.size();i++) { | |
| 190 | + HSSFCell cell = row.createCell(i); | |
| 191 | + HSSFRichTextString text = new HSSFRichTextString(head.get(i).getDescribe()); | |
| 192 | + cell.setCellValue(text); | |
| 193 | + } | |
| 194 | + | |
| 195 | + int rownum = 1; | |
| 196 | + for (Map<String, Object> map : data) { | |
| 197 | + HSSFRow r = sheet.createRow(rownum); | |
| 198 | + for (int i = 0;i < head.size();i++) { | |
| 199 | + HSSFCell cell = r.createCell(i); | |
| 200 | + HSSFRichTextString text = new HSSFRichTextString(String.valueOf(map.get(head.get(i).getField()))); | |
| 201 | + cell.setCellValue(text); | |
| 202 | + } | |
| 203 | + rownum++; | |
| 204 | + } | |
| 205 | + | |
| 206 | + wb.write(out); | |
| 207 | + wb.close(); | |
| 208 | + } | |
| 209 | + | |
| 210 | + final class Header { | |
| 211 | + private String describe; | |
| 212 | + private String field; | |
| 213 | + | |
| 214 | + Header(){ | |
| 215 | + | |
| 216 | + } | |
| 217 | + | |
| 218 | + Header(String describe, String field) { | |
| 219 | + this.describe = describe; | |
| 220 | + this.field = field; | |
| 221 | + } | |
| 222 | + | |
| 223 | + public String getDescribe() { | |
| 224 | + return describe; | |
| 225 | + } | |
| 226 | + | |
| 227 | + public void setDescribe(String describe) { | |
| 228 | + this.describe = describe; | |
| 229 | + } | |
| 230 | + | |
| 231 | + public String getField() { | |
| 232 | + return field; | |
| 233 | + } | |
| 234 | + | |
| 235 | + public void setField(String field) { | |
| 236 | + this.field = field; | |
| 237 | + } | |
| 238 | + } | |
| 239 | +} | ... | ... |
src/main/java/com/bsth/controller/I18nController.java
0 → 100644
| 1 | +package com.bsth.controller; | |
| 2 | + | |
| 3 | +import com.bsth.util.I18n; | |
| 4 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 5 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 6 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 7 | +import org.springframework.web.bind.annotation.RestController; | |
| 8 | + | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 11 | +@RestController | |
| 12 | +@RequestMapping("i18n") | |
| 13 | +public class I18nController { | |
| 14 | + | |
| 15 | + @RequestMapping(value = "/{basename}", method = RequestMethod.GET) | |
| 16 | + public Map<String, String> basename(@PathVariable("basename") String basename) { | |
| 17 | + return I18n.getInstance().getAllMessage(basename); | |
| 18 | + } | |
| 19 | +} | ... | ... |
src/main/java/com/bsth/controller/calc/CalcExportController.java
| 1 | -package com.bsth.controller.calc; | |
| 2 | - | |
| 3 | -import java.text.SimpleDateFormat; | |
| 4 | -import java.util.ArrayList; | |
| 5 | -import java.util.HashMap; | |
| 6 | -import java.util.Iterator; | |
| 7 | -import java.util.List; | |
| 8 | -import java.util.Map; | |
| 9 | - | |
| 10 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 12 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 13 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 14 | -import org.springframework.web.bind.annotation.RestController; | |
| 15 | - | |
| 16 | -import com.bsth.common.ResponseCode; | |
| 17 | -import com.bsth.entity.calc.CalcWaybill; | |
| 18 | -import com.bsth.entity.mcy_forms.Waybillday; | |
| 19 | -import com.bsth.service.calc.CalcLbStatuAnalyService; | |
| 20 | -import com.bsth.service.calc.CalcMixService; | |
| 21 | -import com.bsth.service.calc.CalcWaybillService; | |
| 22 | -import com.bsth.util.ReportUtils; | |
| 23 | - | |
| 24 | -@RestController | |
| 25 | -@RequestMapping("calc_export") | |
| 26 | -public class CalcExportController { | |
| 27 | - | |
| 28 | - @Autowired | |
| 29 | - CalcWaybillService service; | |
| 30 | - | |
| 31 | - @Autowired | |
| 32 | - CalcLbStatuAnalyService lbService; | |
| 33 | - | |
| 34 | - @Autowired | |
| 35 | - CalcMixService clacMixService; | |
| 36 | - | |
| 37 | - @RequestMapping(value = "/waybilldayExport", method = RequestMethod.GET) | |
| 38 | - public Map<String, Object> calcjsyspyExport(@RequestParam Map<String, Object> map) { | |
| 39 | - | |
| 40 | - String line=""; | |
| 41 | - if(map.get("line")!=null){ | |
| 42 | - line=map.get("line").toString().trim(); | |
| 43 | - } | |
| 44 | - String lineName=""; | |
| 45 | - if(map.get("lineName")!=null){ | |
| 46 | - lineName=map.get("lineName").toString().trim(); | |
| 47 | - } | |
| 48 | - String startDate=""; | |
| 49 | - if(map.get("startDate")!=null){ | |
| 50 | - startDate=map.get("startDate").toString().trim(); | |
| 51 | - } | |
| 52 | - String endDate=""; | |
| 53 | - if(map.get("endDate")!=null){ | |
| 54 | - endDate=map.get("endDate").toString().trim(); | |
| 55 | - } | |
| 56 | - String cont=""; | |
| 57 | - if(map.get("cont")!=null){ | |
| 58 | - cont=map.get("cont").toString().trim(); | |
| 59 | - } | |
| 60 | - String empnames=""; | |
| 61 | - if(map.get("empnames")!=null){ | |
| 62 | - empnames=map.get("empnames").toString().trim(); | |
| 63 | - } | |
| 64 | - String gsdmManth=""; | |
| 65 | - if(map.get("gsdmManth")!=null){ | |
| 66 | - gsdmManth=map.get("gsdmManth").toString().trim(); | |
| 67 | - } | |
| 68 | - String fgsdmManth=""; | |
| 69 | - if(map.get("fgsdmManth")!=null){ | |
| 70 | - fgsdmManth=map.get("fgsdmManth").toString().trim(); | |
| 71 | - } | |
| 72 | - | |
| 73 | - Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 74 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 75 | - List<Map<String, Object>> list = clacMixService.calcjsyspy(line, startDate, endDate, empnames, cont, gsdmManth, fgsdmManth); | |
| 76 | - | |
| 77 | - Map<String, Object> temp = new HashMap<String, Object>(); | |
| 78 | - temp.put("i", "$$$$$${txt-3934}"); | |
| 79 | - temp.put("jName", empnames); | |
| 80 | - temp.put("jhyybc", "$$$$$${txt-1496}"); | |
| 81 | - temp.put("jhfyybc", "$$$$$${txt-4377}"); | |
| 82 | - temp.put("sjyybc", "$$$$$${txt-1489}"); | |
| 83 | - temp.put("sjfyybc", "$$$$$${txt-1532}"); | |
| 84 | - temp.put("lbbc", "$$$$$${txt-2707}"); | |
| 85 | - temp.put("ljbc", "$$$$$${txt-2705}"); | |
| 86 | - temp.put("jhzlc", "$$$$$${txt-2003}"); | |
| 87 | - temp.put("jhyylc", "$$$$$${txt-1495}"); | |
| 88 | - temp.put("jhfyylc", "$$$$$${txt-1497}"); | |
| 89 | - temp.put("sjzlc", "$$$$$${txt-2001}"); | |
| 90 | - temp.put("sjyylc", "$$$$$${txt-1488}"); | |
| 91 | - temp.put("sjfyylc", "$$$$$${txt-1490}"); | |
| 92 | - temp.put("lblc", "$$$$$${txt-2706}"); | |
| 93 | - temp.put("ljyylc", "$$$$$${txt-1494}"); | |
| 94 | - temp.put("ljfyylc", "$$$$$${txt-4375}"); | |
| 95 | - resList.add(temp); | |
| 96 | - for(int i = 0; i < list.size(); i++){ | |
| 97 | - temp = list.get(i); | |
| 98 | - temp.put("i", i+1); | |
| 99 | - resList.add(temp); | |
| 100 | - } | |
| 101 | - | |
| 102 | - String date = startDate.replaceAll("-", ""); | |
| 103 | - if(!startDate.equals(endDate)){ | |
| 104 | - date = startDate.replaceAll("-", "") + "-" + endDate.replaceAll("-", ""); | |
| 105 | - } | |
| 106 | - | |
| 107 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 108 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 109 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 110 | - Map<String,Object> mm = new HashMap<String, Object>(); | |
| 111 | - ReportUtils ee = new ReportUtils(); | |
| 112 | - | |
| 113 | - try { | |
| 114 | - listI.add(resList.iterator()); | |
| 115 | - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 116 | - ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcjsyspy.xls", | |
| 117 | - path+"export/"+date+"-"+lineName+"-$$$$$${txt-735}.xls"); | |
| 118 | - resMap.put("status", ResponseCode.SUCCESS); | |
| 119 | - } catch (Exception e) { | |
| 120 | - e.printStackTrace(); | |
| 121 | - resMap.put("status", ResponseCode.ERROR); | |
| 122 | - } | |
| 123 | - return resMap; | |
| 124 | - } | |
| 125 | - | |
| 126 | - @RequestMapping(value = "/singledataExportTj", method = RequestMethod.GET) | |
| 127 | - public Map<String, Object> singledataExportTj(@RequestParam Map<String, Object> map) { | |
| 128 | - | |
| 129 | - String line=""; | |
| 130 | - if(map.get("line")!=null){ | |
| 131 | - line=map.get("line").toString().trim(); | |
| 132 | - } | |
| 133 | - String lineName=""; | |
| 134 | - if(map.get("lineName")!=null){ | |
| 135 | - lineName=map.get("lineName").toString().trim(); | |
| 136 | - } | |
| 137 | - String startDate=""; | |
| 138 | - if(map.get("startDate")!=null){ | |
| 139 | - startDate=map.get("startDate").toString().trim(); | |
| 140 | - } | |
| 141 | - String endDate=""; | |
| 142 | - if(map.get("endDate")!=null){ | |
| 143 | - endDate=map.get("endDate").toString().trim(); | |
| 144 | - } | |
| 145 | - String tjtype=""; | |
| 146 | - if(map.get("tjtype")!=null){ | |
| 147 | - tjtype=map.get("tjtype").toString().trim(); | |
| 148 | - } | |
| 149 | - String cont=""; | |
| 150 | - if(map.get("cont")!=null){ | |
| 151 | - cont=map.get("cont").toString().trim(); | |
| 152 | - } | |
| 153 | - String gsdmSing=""; | |
| 154 | - if(map.get("gsdmSing")!=null){ | |
| 155 | - gsdmSing=map.get("gsdmSing").toString().trim(); | |
| 156 | - } | |
| 157 | - String fgsdmSing=""; | |
| 158 | - if(map.get("fgsdmSing")!=null){ | |
| 159 | - fgsdmSing=map.get("fgsdmSing").toString().trim(); | |
| 160 | - } | |
| 161 | - String sfdc=""; | |
| 162 | - if(map.get("sfdc")!=null){ | |
| 163 | - sfdc=map.get("sfdc").toString().trim(); | |
| 164 | - } | |
| 165 | - | |
| 166 | - Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 167 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 168 | - List<Map<String, Object>> list = clacMixService.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing, sfdc); | |
| 169 | - | |
| 170 | - Map<String, Object> temp = new HashMap<String, Object>(); | |
| 171 | - temp.put("i", "$$$$$${txt-3934}"); | |
| 172 | - temp.put("gS", "$$$$$${txt-2686}"); | |
| 173 | - temp.put("xlName", "$$$$$${txt-3815}"); | |
| 174 | - temp.put("jName", tjtype); | |
| 175 | - temp.put("jhzlc", "$$$$$${txt-3185}"); | |
| 176 | - temp.put("sjzlc", "$$$$$${txt-4363}"); | |
| 177 | - temp.put("sjfyylc", "$$$$$${txt-2913}"); | |
| 178 | - temp.put("hyl", "$$$$$${txt-3438}"); | |
| 179 | - temp.put("jzl", "$$$$$${txt-3436}"); | |
| 180 | - temp.put("sh", "$$$$$${txt-1913}"); | |
| 181 | - | |
| 182 | - resList.add(temp); | |
| 183 | - for(int i = 0; i < list.size(); i++){ | |
| 184 | - temp = list.get(i); | |
| 185 | - temp.put("i", i+1); | |
| 186 | - if(temp.get("xlName") == null){ | |
| 187 | - temp.put("xlName", ""); | |
| 188 | - } | |
| 189 | - resList.add(temp); | |
| 190 | - } | |
| 191 | - | |
| 192 | - String date = startDate.replaceAll("-", ""); | |
| 193 | - if(!startDate.equals(endDate)){ | |
| 194 | - date = startDate.replaceAll("-", "") + "-" + endDate.replaceAll("-", ""); | |
| 195 | - } | |
| 196 | - | |
| 197 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 198 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 199 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 200 | - Map<String,Object> mm = new HashMap<String, Object>(); | |
| 201 | - ReportUtils ee = new ReportUtils(); | |
| 202 | - | |
| 203 | - try { | |
| 204 | - listI.add(resList.iterator()); | |
| 205 | - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 206 | - ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcsingledata.xls", | |
| 207 | - path+"export/"+date+"-"+lineName+"-$$$$$${txt-4362}.xls"); | |
| 208 | - resMap.put("status", ResponseCode.SUCCESS); | |
| 209 | - } catch (Exception e) { | |
| 210 | - e.printStackTrace(); | |
| 211 | - resMap.put("status", ResponseCode.ERROR); | |
| 212 | - } | |
| 213 | - return resMap; | |
| 214 | - } | |
| 215 | - | |
| 216 | - @RequestMapping(value = "/lbStatuAnalyExport", method = RequestMethod.GET) | |
| 217 | - public Map<String, Object> lbStatuAnalyExport(@RequestParam Map<String, Object> map) { | |
| 218 | - | |
| 219 | - String gsdm=""; | |
| 220 | - if(map.get("company")!=null){ | |
| 221 | - gsdm=map.get("company").toString().trim(); | |
| 222 | - } | |
| 223 | - String fgsdm=""; | |
| 224 | - if(map.get("subCompany")!=null){ | |
| 225 | - fgsdm=map.get("subCompany").toString().trim(); | |
| 226 | - } | |
| 227 | - String line=""; | |
| 228 | - if(map.get("line")!=null){ | |
| 229 | - line=map.get("line").toString().trim(); | |
| 230 | - } | |
| 231 | - String lineName=""; | |
| 232 | - if(map.get("lineName")!=null){ | |
| 233 | - lineName=map.get("lineName").toString().trim(); | |
| 234 | - } | |
| 235 | - String date=""; | |
| 236 | - if(map.get("startDate")!=null){ | |
| 237 | - date=map.get("startDate").toString().trim(); | |
| 238 | - } | |
| 239 | - String date2=""; | |
| 240 | - if(map.get("endDate")!=null){ | |
| 241 | - date2=map.get("endDate").toString().trim(); | |
| 242 | - } | |
| 243 | - String sfyy=""; | |
| 244 | - if(map.get("sfyy")!=null){ | |
| 245 | - sfyy=map.get("sfyy").toString().trim(); | |
| 246 | - } | |
| 247 | - String type=""; | |
| 248 | - if(map.get("type")!=null){ | |
| 249 | - type=map.get("type").toString().trim(); | |
| 250 | - } | |
| 251 | - | |
| 252 | - Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 253 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 254 | - List<Map<String, Object>> list = lbService.lbStatuAnaly(gsdm, fgsdm, line, date, date2, sfyy, type); | |
| 255 | - | |
| 256 | - for(int i = 0; i < list.size(); i++){ | |
| 257 | - Map<String, Object> temp = list.get(i); | |
| 258 | - temp.put("i", i+1); | |
| 259 | - if(!temp.containsKey("date") || temp.get("date") == null){ | |
| 260 | - temp.put("date", ""); | |
| 261 | - } | |
| 262 | - if(!temp.containsKey("company") || temp.get("company") == null){ | |
| 263 | - temp.put("company", ""); | |
| 264 | - } | |
| 265 | - if(!temp.containsKey("subCompany") || temp.get("subCompany") == null){ | |
| 266 | - temp.put("subCompany", ""); | |
| 267 | - } | |
| 268 | - resList.add(temp); | |
| 269 | - } | |
| 270 | - | |
| 271 | - String Data = date.replaceAll("-", ""); | |
| 272 | - if(!date.equals(date2)){ | |
| 273 | - Data = date.replaceAll("-", "") + "-" + date2.replaceAll("-", ""); | |
| 274 | - } | |
| 275 | - | |
| 276 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 277 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 278 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 279 | - Map<String,Object> mm = new HashMap<String, Object>(); | |
| 280 | - ReportUtils ee = new ReportUtils(); | |
| 281 | - | |
| 282 | - try { | |
| 283 | - listI.add(resList.iterator()); | |
| 284 | - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 285 | - ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcLbStatuAnaly.xls", | |
| 286 | - path+"export/"+Data+"-"+lineName+"-$$$$$${txt-1005}.xls"); | |
| 287 | - resMap.put("status", ResponseCode.SUCCESS); | |
| 288 | - } catch (Exception e) { | |
| 289 | - e.printStackTrace(); | |
| 290 | - resMap.put("status", ResponseCode.ERROR); | |
| 291 | - } | |
| 292 | - return resMap; | |
| 293 | - } | |
| 294 | - | |
| 295 | -} | |
| 1 | +package com.bsth.controller.calc; | |
| 2 | + | |
| 3 | +import java.text.SimpleDateFormat; | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.HashMap; | |
| 6 | +import java.util.Iterator; | |
| 7 | +import java.util.List; | |
| 8 | +import java.util.Map; | |
| 9 | + | |
| 10 | +import com.bsth.util.I18n; | |
| 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 | + | |
| 17 | +import com.bsth.common.ResponseCode; | |
| 18 | +import com.bsth.entity.calc.CalcWaybill; | |
| 19 | +import com.bsth.entity.mcy_forms.Waybillday; | |
| 20 | +import com.bsth.service.calc.CalcLbStatuAnalyService; | |
| 21 | +import com.bsth.service.calc.CalcMixService; | |
| 22 | +import com.bsth.service.calc.CalcWaybillService; | |
| 23 | +import com.bsth.util.ReportUtils; | |
| 24 | + | |
| 25 | +@RestController | |
| 26 | +@RequestMapping("calc_export") | |
| 27 | +public class CalcExportController { | |
| 28 | + | |
| 29 | + @Autowired | |
| 30 | + CalcWaybillService service; | |
| 31 | + | |
| 32 | + @Autowired | |
| 33 | + CalcLbStatuAnalyService lbService; | |
| 34 | + | |
| 35 | + @Autowired | |
| 36 | + CalcMixService clacMixService; | |
| 37 | + | |
| 38 | + @RequestMapping(value = "/waybilldayExport", method = RequestMethod.GET) | |
| 39 | + public Map<String, Object> calcjsyspyExport(@RequestParam Map<String, Object> map) { | |
| 40 | + | |
| 41 | + String line=""; | |
| 42 | + if(map.get("line")!=null){ | |
| 43 | + line=map.get("line").toString().trim(); | |
| 44 | + } | |
| 45 | + String lineName=""; | |
| 46 | + if(map.get("lineName")!=null){ | |
| 47 | + lineName=map.get("lineName").toString().trim(); | |
| 48 | + } | |
| 49 | + String startDate=""; | |
| 50 | + if(map.get("startDate")!=null){ | |
| 51 | + startDate=map.get("startDate").toString().trim(); | |
| 52 | + } | |
| 53 | + String endDate=""; | |
| 54 | + if(map.get("endDate")!=null){ | |
| 55 | + endDate=map.get("endDate").toString().trim(); | |
| 56 | + } | |
| 57 | + String cont=""; | |
| 58 | + if(map.get("cont")!=null){ | |
| 59 | + cont=map.get("cont").toString().trim(); | |
| 60 | + } | |
| 61 | + String empnames=""; | |
| 62 | + if(map.get("empnames")!=null){ | |
| 63 | + empnames=map.get("empnames").toString().trim(); | |
| 64 | + } | |
| 65 | + String gsdmManth=""; | |
| 66 | + if(map.get("gsdmManth")!=null){ | |
| 67 | + gsdmManth=map.get("gsdmManth").toString().trim(); | |
| 68 | + } | |
| 69 | + String fgsdmManth=""; | |
| 70 | + if(map.get("fgsdmManth")!=null){ | |
| 71 | + fgsdmManth=map.get("fgsdmManth").toString().trim(); | |
| 72 | + } | |
| 73 | + | |
| 74 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 75 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 76 | + List<Map<String, Object>> list = clacMixService.calcjsyspy(line, startDate, endDate, empnames, cont, gsdmManth, fgsdmManth); | |
| 77 | + | |
| 78 | + Map<String, Object> temp = new HashMap<String, Object>(); | |
| 79 | + temp.put("i", I18n.getInstance().getMessage("txt-3934")); | |
| 80 | + temp.put("jName", empnames); | |
| 81 | + temp.put("jhyybc", I18n.getInstance().getMessage("txt-1496")); | |
| 82 | + temp.put("jhfyybc", I18n.getInstance().getMessage("txt-4377")); | |
| 83 | + temp.put("sjyybc", I18n.getInstance().getMessage("txt-1489")); | |
| 84 | + temp.put("sjfyybc", I18n.getInstance().getMessage("txt-1532")); | |
| 85 | + temp.put("lbbc", I18n.getInstance().getMessage("txt-2707")); | |
| 86 | + temp.put("ljbc", I18n.getInstance().getMessage("txt-2705")); | |
| 87 | + temp.put("jhzlc", I18n.getInstance().getMessage("txt-2003")); | |
| 88 | + temp.put("jhyylc", I18n.getInstance().getMessage("txt-1495")); | |
| 89 | + temp.put("jhfyylc", I18n.getInstance().getMessage("txt-1497")); | |
| 90 | + temp.put("sjzlc", I18n.getInstance().getMessage("txt-2001")); | |
| 91 | + temp.put("sjyylc", I18n.getInstance().getMessage("txt-1488")); | |
| 92 | + temp.put("sjfyylc", I18n.getInstance().getMessage("txt-1490")); | |
| 93 | + temp.put("lblc", I18n.getInstance().getMessage("txt-2706")); | |
| 94 | + temp.put("ljyylc", I18n.getInstance().getMessage("txt-1494")); | |
| 95 | + temp.put("ljfyylc", I18n.getInstance().getMessage("txt-4375")); | |
| 96 | + resList.add(temp); | |
| 97 | + for(int i = 0; i < list.size(); i++){ | |
| 98 | + temp = list.get(i); | |
| 99 | + temp.put("i", i+1); | |
| 100 | + resList.add(temp); | |
| 101 | + } | |
| 102 | + | |
| 103 | + String date = startDate.replaceAll("-", ""); | |
| 104 | + if(!startDate.equals(endDate)){ | |
| 105 | + date = startDate.replaceAll("-", "") + "-" + endDate.replaceAll("-", ""); | |
| 106 | + } | |
| 107 | + | |
| 108 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 109 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 110 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 111 | + Map<String,Object> mm = new HashMap<String, Object>(); | |
| 112 | + ReportUtils ee = new ReportUtils(); | |
| 113 | + | |
| 114 | + try { | |
| 115 | + listI.add(resList.iterator()); | |
| 116 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 117 | + ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcjsyspy.xls", | |
| 118 | + path+"export/"+date+"-"+lineName+"-" + I18n.getInstance().getMessage("txt-735") + ".xls"); | |
| 119 | + resMap.put("status", ResponseCode.SUCCESS); | |
| 120 | + } catch (Exception e) { | |
| 121 | + e.printStackTrace(); | |
| 122 | + resMap.put("status", ResponseCode.ERROR); | |
| 123 | + } | |
| 124 | + return resMap; | |
| 125 | + } | |
| 126 | + | |
| 127 | + @RequestMapping(value = "/singledataExportTj", method = RequestMethod.GET) | |
| 128 | + public Map<String, Object> singledataExportTj(@RequestParam Map<String, Object> map) { | |
| 129 | + | |
| 130 | + String line=""; | |
| 131 | + if(map.get("line")!=null){ | |
| 132 | + line=map.get("line").toString().trim(); | |
| 133 | + } | |
| 134 | + String lineName=""; | |
| 135 | + if(map.get("lineName")!=null){ | |
| 136 | + lineName=map.get("lineName").toString().trim(); | |
| 137 | + } | |
| 138 | + String startDate=""; | |
| 139 | + if(map.get("startDate")!=null){ | |
| 140 | + startDate=map.get("startDate").toString().trim(); | |
| 141 | + } | |
| 142 | + String endDate=""; | |
| 143 | + if(map.get("endDate")!=null){ | |
| 144 | + endDate=map.get("endDate").toString().trim(); | |
| 145 | + } | |
| 146 | + String tjtype=""; | |
| 147 | + if(map.get("tjtype")!=null){ | |
| 148 | + tjtype=map.get("tjtype").toString().trim(); | |
| 149 | + } | |
| 150 | + String cont=""; | |
| 151 | + if(map.get("cont")!=null){ | |
| 152 | + cont=map.get("cont").toString().trim(); | |
| 153 | + } | |
| 154 | + String gsdmSing=""; | |
| 155 | + if(map.get("gsdmSing")!=null){ | |
| 156 | + gsdmSing=map.get("gsdmSing").toString().trim(); | |
| 157 | + } | |
| 158 | + String fgsdmSing=""; | |
| 159 | + if(map.get("fgsdmSing")!=null){ | |
| 160 | + fgsdmSing=map.get("fgsdmSing").toString().trim(); | |
| 161 | + } | |
| 162 | + String sfdc=""; | |
| 163 | + if(map.get("sfdc")!=null){ | |
| 164 | + sfdc=map.get("sfdc").toString().trim(); | |
| 165 | + } | |
| 166 | + | |
| 167 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 168 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 169 | + List<Map<String, Object>> list = clacMixService.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing, sfdc); | |
| 170 | + | |
| 171 | + Map<String, Object> temp = new HashMap<String, Object>(); | |
| 172 | + temp.put("i", I18n.getInstance().getMessage("txt-3934")); | |
| 173 | + temp.put("gS", I18n.getInstance().getMessage("txt-2686")); | |
| 174 | + temp.put("xlName", I18n.getInstance().getMessage("txt-3815")); | |
| 175 | + temp.put("jName", tjtype); | |
| 176 | + temp.put("jhzlc", I18n.getInstance().getMessage("txt-3185")); | |
| 177 | + temp.put("sjzlc", I18n.getInstance().getMessage("txt-4363")); | |
| 178 | + temp.put("sjfyylc", I18n.getInstance().getMessage("txt-2913")); | |
| 179 | + temp.put("hyl", I18n.getInstance().getMessage("txt-3438")); | |
| 180 | + temp.put("jzl", I18n.getInstance().getMessage("txt-3436")); | |
| 181 | + temp.put("sh", I18n.getInstance().getMessage("txt-1913")); | |
| 182 | + | |
| 183 | + resList.add(temp); | |
| 184 | + for(int i = 0; i < list.size(); i++){ | |
| 185 | + temp = list.get(i); | |
| 186 | + temp.put("i", i+1); | |
| 187 | + if(temp.get("xlName") == null){ | |
| 188 | + temp.put("xlName", ""); | |
| 189 | + } | |
| 190 | + resList.add(temp); | |
| 191 | + } | |
| 192 | + | |
| 193 | + String date = startDate.replaceAll("-", ""); | |
| 194 | + if(!startDate.equals(endDate)){ | |
| 195 | + date = startDate.replaceAll("-", "") + "-" + endDate.replaceAll("-", ""); | |
| 196 | + } | |
| 197 | + | |
| 198 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 199 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 200 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 201 | + Map<String,Object> mm = new HashMap<String, Object>(); | |
| 202 | + ReportUtils ee = new ReportUtils(); | |
| 203 | + | |
| 204 | + try { | |
| 205 | + listI.add(resList.iterator()); | |
| 206 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 207 | + ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcsingledata.xls", | |
| 208 | + path+"export/"+date+"-"+lineName+"-" + I18n.getInstance().getMessage("txt-4362") + ".xls"); | |
| 209 | + resMap.put("status", ResponseCode.SUCCESS); | |
| 210 | + } catch (Exception e) { | |
| 211 | + e.printStackTrace(); | |
| 212 | + resMap.put("status", ResponseCode.ERROR); | |
| 213 | + } | |
| 214 | + return resMap; | |
| 215 | + } | |
| 216 | + | |
| 217 | + @RequestMapping(value = "/lbStatuAnalyExport", method = RequestMethod.GET) | |
| 218 | + public Map<String, Object> lbStatuAnalyExport(@RequestParam Map<String, Object> map) { | |
| 219 | + | |
| 220 | + String gsdm=""; | |
| 221 | + if(map.get("company")!=null){ | |
| 222 | + gsdm=map.get("company").toString().trim(); | |
| 223 | + } | |
| 224 | + String fgsdm=""; | |
| 225 | + if(map.get("subCompany")!=null){ | |
| 226 | + fgsdm=map.get("subCompany").toString().trim(); | |
| 227 | + } | |
| 228 | + String line=""; | |
| 229 | + if(map.get("line")!=null){ | |
| 230 | + line=map.get("line").toString().trim(); | |
| 231 | + } | |
| 232 | + String lineName=""; | |
| 233 | + if(map.get("lineName")!=null){ | |
| 234 | + lineName=map.get("lineName").toString().trim(); | |
| 235 | + } | |
| 236 | + String date=""; | |
| 237 | + if(map.get("startDate")!=null){ | |
| 238 | + date=map.get("startDate").toString().trim(); | |
| 239 | + } | |
| 240 | + String date2=""; | |
| 241 | + if(map.get("endDate")!=null){ | |
| 242 | + date2=map.get("endDate").toString().trim(); | |
| 243 | + } | |
| 244 | + String sfyy=""; | |
| 245 | + if(map.get("sfyy")!=null){ | |
| 246 | + sfyy=map.get("sfyy").toString().trim(); | |
| 247 | + } | |
| 248 | + String type=""; | |
| 249 | + if(map.get("type")!=null){ | |
| 250 | + type=map.get("type").toString().trim(); | |
| 251 | + } | |
| 252 | + | |
| 253 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 254 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 255 | + List<Map<String, Object>> list = lbService.lbStatuAnaly(gsdm, fgsdm, line, date, date2, sfyy, type); | |
| 256 | + | |
| 257 | + for(int i = 0; i < list.size(); i++){ | |
| 258 | + Map<String, Object> temp = list.get(i); | |
| 259 | + temp.put("i", i+1); | |
| 260 | + if(!temp.containsKey("date") || temp.get("date") == null){ | |
| 261 | + temp.put("date", ""); | |
| 262 | + } | |
| 263 | + if(!temp.containsKey("company") || temp.get("company") == null){ | |
| 264 | + temp.put("company", ""); | |
| 265 | + } | |
| 266 | + if(!temp.containsKey("subCompany") || temp.get("subCompany") == null){ | |
| 267 | + temp.put("subCompany", ""); | |
| 268 | + } | |
| 269 | + resList.add(temp); | |
| 270 | + } | |
| 271 | + | |
| 272 | + String Data = date.replaceAll("-", ""); | |
| 273 | + if(!date.equals(date2)){ | |
| 274 | + Data = date.replaceAll("-", "") + "-" + date2.replaceAll("-", ""); | |
| 275 | + } | |
| 276 | + | |
| 277 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 278 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 279 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 280 | + Map<String,Object> mm = new HashMap<String, Object>(); | |
| 281 | + ReportUtils ee = new ReportUtils(); | |
| 282 | + | |
| 283 | + try { | |
| 284 | + listI.add(resList.iterator()); | |
| 285 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 286 | + ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcLbStatuAnaly.xls", | |
| 287 | + path+"export/"+Data+"-"+lineName+"-" + I18n.getInstance().getMessage("txt-1005") + ".xls"); | |
| 288 | + resMap.put("status", ResponseCode.SUCCESS); | |
| 289 | + } catch (Exception e) { | |
| 290 | + e.printStackTrace(); | |
| 291 | + resMap.put("status", ResponseCode.ERROR); | |
| 292 | + } | |
| 293 | + return resMap; | |
| 294 | + } | |
| 295 | + | |
| 296 | +} | ... | ... |
src/main/java/com/bsth/controller/forms/ExportController.java
| 1 | -package com.bsth.controller.forms; | |
| 2 | - | |
| 3 | -import java.text.SimpleDateFormat; | |
| 4 | -import java.util.ArrayList; | |
| 5 | -import java.util.HashMap; | |
| 6 | -import java.util.Iterator; | |
| 7 | -import java.util.List; | |
| 8 | -import java.util.Map; | |
| 9 | - | |
| 10 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 12 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 13 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 14 | -import org.springframework.web.bind.annotation.RestController; | |
| 15 | - | |
| 16 | -import com.bsth.data.BasicData; | |
| 17 | -import com.bsth.entity.mcy_forms.Allline; | |
| 18 | -import com.bsth.entity.mcy_forms.Changetochange; | |
| 19 | -import com.bsth.entity.mcy_forms.Daily; | |
| 20 | -import com.bsth.entity.mcy_forms.Executionrate; | |
| 21 | -import com.bsth.entity.mcy_forms.Linepasswengerflow; | |
| 22 | -import com.bsth.entity.mcy_forms.Operationservice; | |
| 23 | -import com.bsth.entity.mcy_forms.Shifday; | |
| 24 | -import com.bsth.entity.mcy_forms.Shiftuehiclemanth; | |
| 25 | -import com.bsth.entity.mcy_forms.Singledata; | |
| 26 | -import com.bsth.entity.mcy_forms.Turnoutrate; | |
| 27 | -import com.bsth.entity.mcy_forms.Vehicleloading; | |
| 28 | -import com.bsth.entity.mcy_forms.Waybillday; | |
| 29 | -import com.bsth.service.forms.ExportService; | |
| 30 | -import com.bsth.service.forms.FormsService; | |
| 31 | -import com.bsth.util.Arith; | |
| 32 | -import com.bsth.util.ReportUtils; | |
| 33 | - | |
| 34 | -@RestController | |
| 35 | -@RequestMapping("mcy_export") | |
| 36 | -public class ExportController { | |
| 37 | - | |
| 38 | - | |
| 39 | - @Autowired | |
| 40 | - FormsService formsService; | |
| 41 | - | |
| 42 | - @Autowired | |
| 43 | - ExportService exportService; | |
| 44 | - | |
| 45 | - // 行车路单日报表 | |
| 46 | - @RequestMapping(value = "/waybilldayExport", method = RequestMethod.POST) | |
| 47 | - public List<Waybillday> waybilldayExport(@RequestParam Map<String, Object> map) { | |
| 48 | - List<Waybillday> waybillday = formsService.waybillday(map); | |
| 49 | - exportService.waybillday(map.get("date").toString(), | |
| 50 | - map.get("lineName").toString(), waybillday); | |
| 51 | - return waybillday; | |
| 52 | - } | |
| 53 | - | |
| 54 | - // 线路客流量报表 | |
| 55 | - @RequestMapping(value = "/linepasswengerflowExport", method = RequestMethod.POST) | |
| 56 | - public List<Map<String, Object>> linepasswengerflowExport(@RequestParam Map<String, Object> map) { | |
| 57 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 58 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 59 | - ReportUtils ee = new ReportUtils(); | |
| 60 | - List<Linepasswengerflow> linepasswengerflow = formsService.linepasswengerflow(map); | |
| 61 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 62 | - int i = 1; | |
| 63 | - for (Linepasswengerflow l : linepasswengerflow) { | |
| 64 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 65 | - m.put("i", i); | |
| 66 | - m.put("stationName", l.getStationName()); | |
| 67 | - m.put("1", " "); | |
| 68 | - m.put("2", " "); | |
| 69 | - resList.add(m); | |
| 70 | - i++; | |
| 71 | - } | |
| 72 | - | |
| 73 | - | |
| 74 | - | |
| 75 | - try { | |
| 76 | - listI.add(resList.iterator()); | |
| 77 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 78 | - ee.excelReplace(listI, new Object[] { map }, path + "mould/linepasswengerflow.xls", | |
| 79 | - path + "export/$$$$$${txt-995}" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls"); | |
| 80 | - } catch (Exception e) { | |
| 81 | - e.printStackTrace(); | |
| 82 | - } | |
| 83 | - return resList; | |
| 84 | - } | |
| 85 | - | |
| 86 | - // $$$$$${txt-591} | |
| 87 | - @RequestMapping(value = "/shifdayExport", method = RequestMethod.GET) | |
| 88 | - public List<Map<String, Object>> shifdayExport(@RequestParam Map<String, Object> map) { | |
| 89 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 90 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 91 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 92 | - Map<String, Object> map2 = new HashMap<String, Object>(); | |
| 93 | - ReportUtils ee = new ReportUtils(); | |
| 94 | - List<Shifday> shifday = formsService.shifday(map); | |
| 95 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 96 | - for (Shifday l : shifday) { | |
| 97 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 98 | - m.put("jName", l.getjName()); | |
| 99 | - m.put("sName", l.getsName()); | |
| 100 | - m.put("lpName", l.getLpName()); | |
| 101 | - m.put("carPlate", l.getCarPlate()); | |
| 102 | - m.put("jhlc", l.getJhlc()); | |
| 103 | - m.put("sjjhlc", l.getSjjhlc()); | |
| 104 | - m.put("yygl", l.getYygl()); | |
| 105 | - m.put("emptMileage", l.getEmptMileage()); | |
| 106 | - m.put("remMileage", l.getRemMileage()); | |
| 107 | - m.put("addMileage", l.getAddMileage()); | |
| 108 | - m.put("totalm", l.getTotalm()); | |
| 109 | - m.put("jhbc", l.getJhbc()); | |
| 110 | - m.put("sjjhbc", l.getSjjhbc()); | |
| 111 | - m.put("cjbc", l.getCjbc()); | |
| 112 | - m.put("ljbc", l.getLjbc()); | |
| 113 | - m.put("sjbc", l.getSjbc()); | |
| 114 | - resList.add(m); | |
| 115 | - } | |
| 116 | - if(resList.size() > 0){ | |
| 117 | - map2 = resList.get(resList.size() - 1); | |
| 118 | - resList.remove(map2); | |
| 119 | - } | |
| 120 | - | |
| 121 | - try { | |
| 122 | - String lineName = ""; | |
| 123 | - if(map.containsKey("lineName")) | |
| 124 | - lineName = map.get("lineName").toString(); | |
| 125 | - listI.add(resList.iterator()); | |
| 126 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 127 | - ee.excelReplace(listI, new Object[] { map2 }, path + "mould/shifday.xls", | |
| 128 | - path + "export/" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) | |
| 129 | - + "-" + lineName + "-$$$$$${txt-543}.xls"); | |
| 130 | - } catch (Exception e) { | |
| 131 | - e.printStackTrace(); | |
| 132 | - } | |
| 133 | - return resList; | |
| 134 | - } | |
| 135 | - | |
| 136 | - // 班次车辆人员月统计 | |
| 137 | - @RequestMapping(value = "/shiftuehiclemanthExport", method = RequestMethod.GET) | |
| 138 | - public List<Map<String, Object>> shiftuehiclemanthExport(@RequestParam Map<String, Object> map) { | |
| 139 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 140 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 141 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 142 | - ReportUtils ee = new ReportUtils(); | |
| 143 | - List<Shiftuehiclemanth> shiftuehiclemanth = formsService.shiftuehiclemanth(map); | |
| 144 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 145 | - int i = 1; | |
| 146 | - for (Shiftuehiclemanth l : shiftuehiclemanth) { | |
| 147 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 148 | - m.put("i", i); | |
| 149 | - m.put("jName", l.getjName()); | |
| 150 | - m.put("jhlc", l.getJhlc()); | |
| 151 | - m.put("emptMileage", l.getEmptMileage()); | |
| 152 | - m.put("remMileage", l.getRemMileage()); | |
| 153 | - m.put("addMileage", l.getAddMileage()); | |
| 154 | - m.put("totalm", l.getTotalm()); | |
| 155 | - m.put("cjbc", l.getCjbc()); | |
| 156 | - m.put("ljbc", l.getLjbc()); | |
| 157 | - m.put("sjbc", l.getSjbc()); | |
| 158 | - resList.add(m); | |
| 159 | - i++; | |
| 160 | - } | |
| 161 | - | |
| 162 | - try { | |
| 163 | - String mouldurl = null, lineName = "", dateTime = "" | |
| 164 | - , startDate = "", endDate = ""; | |
| 165 | - if(map.containsKey("lineName")) | |
| 166 | - lineName = map.get("lineName").toString(); | |
| 167 | - if(map.containsKey("startDate")) | |
| 168 | - startDate = map.get("startDate").toString(); | |
| 169 | - if(map.containsKey("endDate")) | |
| 170 | - endDate = map.get("endDate").toString(); | |
| 171 | - if(startDate.equals(endDate)){ | |
| 172 | - dateTime = sdfSimple.format(sdfMonth.parse(startDate)); | |
| 173 | - } else { | |
| 174 | - dateTime = sdfSimple.format(sdfMonth.parse(startDate)) | |
| 175 | - +"-"+sdfSimple.format(sdfMonth.parse(endDate)); | |
| 176 | - } | |
| 177 | - if(map.get("empnames").equals("$$$$$${txt-3568}")){ | |
| 178 | - mouldurl="mould/shiftuehiclemanth.xls"; | |
| 179 | - }else if(map.get("empnames").equals("$$$$$${txt-3567}")){ | |
| 180 | - mouldurl="mould/shiftuehiclemanthspy.xls"; | |
| 181 | - }else if(map.get("empnames").equals("$$$$$${txt-2008}")){ | |
| 182 | - mouldurl="mould/shiftuehiclemanthclzbh.xls"; | |
| 183 | - } | |
| 184 | - listI.add(resList.iterator()); | |
| 185 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 186 | - ee.excelReplace(listI, new Object[] { map }, path +mouldurl, | |
| 187 | - path + "export/" + dateTime + "-" + lineName + "-$$$$$${txt-542}.xls"); | |
| 188 | - } catch (Exception e) { | |
| 189 | - e.printStackTrace(); | |
| 190 | - } | |
| 191 | - | |
| 192 | - return resList; | |
| 193 | - } | |
| 194 | - | |
| 195 | - // 班次车辆人员月统计 | |
| 196 | - @RequestMapping(value = "/shiftuehiclemanthExport2", method = RequestMethod.GET) | |
| 197 | - public List<Map<String, Object>> shiftuehiclemanthExport2(@RequestParam Map<String, Object> map) { | |
| 198 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 199 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 200 | - ReportUtils ee = new ReportUtils(); | |
| 201 | - List<Shiftuehiclemanth> shiftuehiclemanth = formsService.shiftuehiclemanth2(map); | |
| 202 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 203 | - int i = 1; | |
| 204 | - for (Shiftuehiclemanth l : shiftuehiclemanth) { | |
| 205 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 206 | - m.put("i", i); | |
| 207 | - m.put("jName", l.getjName()); | |
| 208 | - m.put("jhlc", l.getJhlc()); | |
| 209 | - m.put("emptMileage", l.getEmptMileage()); | |
| 210 | - m.put("remMileage", l.getRemMileage()); | |
| 211 | - m.put("addMileage", l.getAddMileage()); | |
| 212 | - m.put("totalm", l.getTotalm()); | |
| 213 | - m.put("cjbc", l.getCjbc()); | |
| 214 | - m.put("ljbc", l.getLjbc()); | |
| 215 | - m.put("sjbc", l.getSjbc()); | |
| 216 | - resList.add(m); | |
| 217 | - i++; | |
| 218 | - } | |
| 219 | - | |
| 220 | - try { | |
| 221 | - String mouldurl = null; | |
| 222 | - if(map.get("empnames").equals("$$$$$${txt-3568}")){ | |
| 223 | - mouldurl="mould/shiftuehiclemanth.xls"; | |
| 224 | - }else if(map.get("empnames").equals("$$$$$${txt-3567}")){ | |
| 225 | - mouldurl="mould/shiftuehiclemanthspy.xls"; | |
| 226 | - }else if(map.get("empnames").equals("$$$$$${txt-2008}")){ | |
| 227 | - mouldurl="mould/shiftuehiclemanthclzbh.xls"; | |
| 228 | - } | |
| 229 | - listI.add(resList.iterator()); | |
| 230 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 231 | - ee.excelReplace(listI, new Object[] { map }, path +mouldurl, | |
| 232 | - path + "export/$$$$$${txt-542}" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 233 | - } catch (Exception e) { | |
| 234 | - e.printStackTrace(); | |
| 235 | - } | |
| 236 | - | |
| 237 | - return resList; | |
| 238 | - } | |
| 239 | - | |
| 240 | - // 路单数据报表 | |
| 241 | - @RequestMapping(value = "/singledataExport", method = RequestMethod.GET) | |
| 242 | - public List<Map<String, Object>> singledataExport(@RequestParam Map<String, Object> map) { | |
| 243 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 244 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 245 | - ReportUtils ee = new ReportUtils(); | |
| 246 | - List<Singledata> singledata = formsService.singledata(map); | |
| 247 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 248 | - int i = 1; | |
| 249 | - for (Singledata l : singledata) { | |
| 250 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 251 | - m.put("i", i); | |
| 252 | - m.put("rQ", l.getrQ()); | |
| 253 | - m.put("gS", l.getgS()); | |
| 254 | - m.put("xL", l.getXlmc()); | |
| 255 | - m.put("clzbh", l.getClzbh()); | |
| 256 | - m.put("jsy", l.getJsy()); | |
| 257 | - m.put("jName", l.getjName()); | |
| 258 | - m.put("sgh", l.getSgh()); | |
| 259 | - m.put("sName", l.getsName()); | |
| 260 | - m.put("jhlc", l.getJhlc()); | |
| 261 | - m.put("emptMileage", l.getEmptMileage()); | |
| 262 | - m.put("hyl", l.getHyl()); | |
| 263 | - m.put("jzl", l.getJzl()); | |
| 264 | - m.put("unyyyl", l.getUnyyyl()); | |
| 265 | - m.put("jhjl", l.getJhjl()); | |
| 266 | - resList.add(m); | |
| 267 | - | |
| 268 | - i++; | |
| 269 | - } | |
| 270 | - | |
| 271 | - try { | |
| 272 | - listI.add(resList.iterator()); | |
| 273 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 274 | - ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls", | |
| 275 | - path + "export/$$$$$${txt-2458}" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls",new String[]{"jsy","sgh"}); | |
| 276 | - } catch (Exception e) { | |
| 277 | - e.printStackTrace(); | |
| 278 | - } | |
| 279 | - | |
| 280 | - return resList; | |
| 281 | - } | |
| 282 | - | |
| 283 | - // 路单数据报表 | |
| 284 | - @RequestMapping(value = "/singledataExport2", method = RequestMethod.GET) | |
| 285 | - public List<Map<String, Object>> singledataExport2(@RequestParam Map<String, Object> map) { | |
| 286 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 287 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 288 | - ReportUtils ee = new ReportUtils(); | |
| 289 | - List<Singledata> singledata = formsService.singledata2(map); | |
| 290 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 291 | - int i = 1; | |
| 292 | - for (Singledata l : singledata) { | |
| 293 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 294 | - m.put("i", i); | |
| 295 | - m.put("rQ", l.getrQ()); | |
| 296 | - m.put("gS", l.getgS()); | |
| 297 | - m.put("xL", l.getXlmc()); | |
| 298 | - m.put("clzbh", l.getClzbh()); | |
| 299 | - m.put("jsy", l.getJsy()); | |
| 300 | - m.put("jName", l.getjName()); | |
| 301 | - m.put("sgh", l.getSgh()); | |
| 302 | - m.put("sName", l.getsName()); | |
| 303 | - m.put("jhlc", l.getJhlc()); | |
| 304 | - m.put("emptMileage", l.getEmptMileage()); | |
| 305 | - m.put("hyl", l.getHyl()); | |
| 306 | - m.put("jzl", l.getJzl()); | |
| 307 | - m.put("unyyyl", l.getUnyyyl()); | |
| 308 | - m.put("jhjl", l.getJhjl()); | |
| 309 | - resList.add(m); | |
| 310 | - | |
| 311 | - i++; | |
| 312 | - } | |
| 313 | - | |
| 314 | - try { | |
| 315 | - listI.add(resList.iterator()); | |
| 316 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 317 | - ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls", | |
| 318 | - path + "export/$$$$$${txt-2458}" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 319 | - } catch (Exception e) { | |
| 320 | - e.printStackTrace(); | |
| 321 | - } | |
| 322 | - | |
| 323 | - return resList; | |
| 324 | - } | |
| 325 | - @RequestMapping(value = "/singledataExportTj", method = RequestMethod.GET) | |
| 326 | - public List<Map<String, Object>> singledataExportTj(@RequestParam Map<String, Object> map) { | |
| 327 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 328 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 329 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 330 | - ReportUtils ee = new ReportUtils(); | |
| 331 | - List<Singledata> singledata = formsService.singledatatj(map); | |
| 332 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 333 | - int i = 1; | |
| 334 | - for (Singledata l : singledata) { | |
| 335 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 336 | - m.put("i", i); | |
| 337 | - m.put("rQ", l.getrQ()); | |
| 338 | - m.put("gS", l.getgS()); | |
| 339 | - m.put("xL", l.getXlmc()); | |
| 340 | - m.put("clzbh", l.getClzbh()); | |
| 341 | - m.put("jsy", l.getJsy()); | |
| 342 | - m.put("jName", l.getjName()); | |
| 343 | - m.put("sgh", l.getSgh()); | |
| 344 | - m.put("sName", l.getsName()); | |
| 345 | - m.put("jhlc", l.getJhlc()); | |
| 346 | - m.put("emptMileage", l.getEmptMileage()); | |
| 347 | - m.put("hyl", l.getHyl()); | |
| 348 | - m.put("jzl", l.getJzl()); | |
| 349 | - m.put("unyyyl", l.getUnyyyl()); | |
| 350 | - m.put("jhjl", l.getJhjl()); | |
| 351 | - resList.add(m); | |
| 352 | - | |
| 353 | - i++; | |
| 354 | - } | |
| 355 | - | |
| 356 | - try { | |
| 357 | - String startDate = "", lineName = ""; | |
| 358 | - if(map.containsKey("startDate")) | |
| 359 | - startDate = map.get("startDate").toString(); | |
| 360 | - if(map.containsKey("lineName")) | |
| 361 | - lineName = map.get("lineName").toString(); | |
| 362 | - listI.add(resList.iterator()); | |
| 363 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 364 | - ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls", | |
| 365 | - path + "export/" + sdfSimple.format(sdfMonth.parse(startDate)) | |
| 366 | - + "-" + lineName + "-$$$$$${txt-2458}.xls"); | |
| 367 | - } catch (Exception e) { | |
| 368 | - e.printStackTrace(); | |
| 369 | - } | |
| 370 | - | |
| 371 | - return resList; | |
| 372 | - } | |
| 373 | - | |
| 374 | - @RequestMapping(value = "/singledataExportTj2", method = RequestMethod.GET) | |
| 375 | - public List<Map<String, Object>> singledataExportTj2(@RequestParam Map<String, Object> map) { | |
| 376 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 377 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 378 | - ReportUtils ee = new ReportUtils(); | |
| 379 | - List<Singledata> singledata = formsService.singledatatj2(map); | |
| 380 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 381 | - int i = 1; | |
| 382 | - for (Singledata l : singledata) { | |
| 383 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 384 | - m.put("i", i); | |
| 385 | - m.put("rQ", l.getrQ()); | |
| 386 | - m.put("gS", l.getgS()); | |
| 387 | - m.put("xL", l.getXlmc()); | |
| 388 | - m.put("clzbh", l.getClzbh()); | |
| 389 | - m.put("jsy", l.getJsy()); | |
| 390 | - m.put("jName", l.getjName()); | |
| 391 | - m.put("sgh", l.getSgh()); | |
| 392 | - m.put("sName", l.getsName()); | |
| 393 | - m.put("jhlc", l.getJhlc()); | |
| 394 | - m.put("emptMileage", l.getEmptMileage()); | |
| 395 | - m.put("hyl", l.getHyl()); | |
| 396 | - m.put("jzl", l.getJzl()); | |
| 397 | - m.put("unyyyl", l.getUnyyyl()); | |
| 398 | - m.put("jhjl", l.getJhjl()); | |
| 399 | - resList.add(m); | |
| 400 | - | |
| 401 | - i++; | |
| 402 | - } | |
| 403 | - | |
| 404 | - try { | |
| 405 | - listI.add(resList.iterator()); | |
| 406 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 407 | - ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls", | |
| 408 | - path + "export/$$$$$${txt-2458}" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 409 | - } catch (Exception e) { | |
| 410 | - e.printStackTrace(); | |
| 411 | - } | |
| 412 | - | |
| 413 | - return resList; | |
| 414 | - } | |
| 415 | - // 车辆加注 | |
| 416 | - @RequestMapping(value = "/vehicleloadingExport", method = RequestMethod.GET) | |
| 417 | - public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map) { | |
| 418 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 419 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 420 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 421 | - ReportUtils ee = new ReportUtils(); | |
| 422 | - List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("line").toString(), | |
| 423 | - map.get("data").toString()); | |
| 424 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 425 | - int i = 1; | |
| 426 | - for (Vehicleloading l : vehicleloading) { | |
| 427 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 428 | - m.put("i", i); | |
| 429 | - m.put("rQ", l.getrQ()); | |
| 430 | - m.put("gS", l.getgS()); | |
| 431 | - m.put("xL", l.getxL()); | |
| 432 | - m.put("clzbh", l.getClzbh()); | |
| 433 | - m.put("jzl", l.getJzl()); | |
| 434 | - m.put("hyl", l.getHyl()); | |
| 435 | - m.put("ls", l.getLs()); | |
| 436 | - m.put("jhlc", l.getJhlc()); | |
| 437 | - m.put("unyyyl", l.getUnyyyl()); | |
| 438 | - m.put("jhbc", l.getJhbc()); | |
| 439 | - m.put("sjbc", l.getSjbc()); | |
| 440 | - resList.add(m); | |
| 441 | - i++; | |
| 442 | - } | |
| 443 | - | |
| 444 | - try { | |
| 445 | - String date = "", lineName = ""; | |
| 446 | - if(map.containsKey("data")) | |
| 447 | - date = map.get("data").toString(); | |
| 448 | - if(map.containsKey("lineName")) | |
| 449 | - lineName = map.get("lineName").toString(); | |
| 450 | - listI.add(resList.iterator()); | |
| 451 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 452 | - ee.excelReplace(listI, new Object[] { map }, path + "mould/vehicleloading.xls", | |
| 453 | - path + "export/" + sdfSimple.format(sdfMonth.parse(date)) + "-" + lineName + "-$$$$$${txt-2462}.xls"); | |
| 454 | - } catch (Exception e) { | |
| 455 | - e.printStackTrace(); | |
| 456 | - } | |
| 457 | - return resList; | |
| 458 | - } | |
| 459 | - | |
| 460 | - // $$$$$${txt-730} | |
| 461 | - @RequestMapping(value = "/operationserviceExport", method = RequestMethod.GET) | |
| 462 | - public List<Map<String, Object>> operationserviceExport(@RequestParam Map<String, Object> map) { | |
| 463 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 464 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 465 | - ReportUtils ee = new ReportUtils(); | |
| 466 | - List<Operationservice> operationservice = formsService.operationservice(map); | |
| 467 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 468 | - int i = 1; | |
| 469 | - for (Operationservice l : operationservice) { | |
| 470 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 471 | - m.put("i", i); | |
| 472 | - m.put("fgs", l.getFgs()!=null?l.getFgs():""); | |
| 473 | - m.put("xlName", l.getXlName()!=null?l.getXlName():""); | |
| 474 | - m.put("jzl", l.getJzl()!=null?l.getJzl():""); | |
| 475 | - m.put("xhl", l.getXhl()!=null?l.getXhl():""); | |
| 476 | - m.put("xsgl", l.getXsgl()!=null?l.getXsgl():""); | |
| 477 | - m.put("emptMileage", l.getEmptMileage()!=null?l.getEmptMileage():""); | |
| 478 | - m.put("sjbc", l.getSjbc()!=null?l.getSjbc():""); | |
| 479 | - resList.add(m); | |
| 480 | - i++; | |
| 481 | - } | |
| 482 | - | |
| 483 | - try { | |
| 484 | - String dateTime = "", startDate = "", endDate = "", lineName = ""; | |
| 485 | - if(map.containsKey("startDate")) | |
| 486 | - startDate = map.get("startDate").toString(); | |
| 487 | - if(map.containsKey("endDate")) | |
| 488 | - endDate = map.get("endDate").toString(); | |
| 489 | - if(map.containsKey("lineName")) | |
| 490 | - lineName = map.get("lineName").toString(); | |
| 491 | - if(startDate.equals(endDate)){ | |
| 492 | - dateTime = sdfSimple.format(sdfMonth.parse(startDate)); | |
| 493 | - } else { | |
| 494 | - dateTime = sdfSimple.format(sdfMonth.parse(startDate)) | |
| 495 | - +"-"+sdfSimple.format(sdfMonth.parse(endDate)); | |
| 496 | - } | |
| 497 | - listI.add(resList.iterator()); | |
| 498 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 499 | - ee.excelReplace(listI, new Object[] { map }, path + "mould/operationservice.xls", path + "export/" | |
| 500 | - + dateTime + "-" + lineName + "-$$$$$${txt-730}.xls"); | |
| 501 | - } catch (Exception e) { | |
| 502 | - e.printStackTrace(); | |
| 503 | - } | |
| 504 | - return resList; | |
| 505 | - } | |
| 506 | - | |
| 507 | - // $$$$$${txt-597} | |
| 508 | - @RequestMapping(value = "/changetochangeExport", method = RequestMethod.POST) | |
| 509 | - public List<Map<String, Object>> changetochangeExport(@RequestParam Map<String, Object> map) { | |
| 510 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 511 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 512 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 513 | - ReportUtils ee = new ReportUtils(); | |
| 514 | - List<Changetochange> changetochange = formsService.changetochange(map); | |
| 515 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 516 | - for (Changetochange l : changetochange) { | |
| 517 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 518 | - m.put("rq", l.getRq()); | |
| 519 | - m.put("gs", l.getGs()); | |
| 520 | - m.put("fgs", l.getFgs()); | |
| 521 | - m.put("xl", l.getXl()); | |
| 522 | - m.put("lp", l.getLp()); | |
| 523 | - m.put("fssj", l.getFssj()); | |
| 524 | - m.put("xgsj", l.getXgsj()); | |
| 525 | - m.put("pcch", l.getPcch()); | |
| 526 | - m.put("sjch", l.getSjch()); | |
| 527 | - m.put("fcgh", l.getPcry()); | |
| 528 | - m.put("sjgh", l.getSjgh()); | |
| 529 | - m.put("yy", l.getYy()==null?"":l.getYy()); | |
| 530 | - m.put("xgr", l.getXgr()); | |
| 531 | - resList.add(m); | |
| 532 | - } | |
| 533 | - | |
| 534 | - try { | |
| 535 | - String dateTime = "", startDate = "", endDate = "", lineName = ""; | |
| 536 | - if(map.containsKey("startDate")) | |
| 537 | - startDate = map.get("startDate").toString(); | |
| 538 | - if(map.containsKey("endDate")) | |
| 539 | - endDate = map.get("endDate").toString(); | |
| 540 | - if(map.containsKey("lineName")) | |
| 541 | - lineName = map.get("lineName").toString(); | |
| 542 | - if(startDate.equals(endDate)){ | |
| 543 | - dateTime = sdfSimple.format(sdfMonth.parse(startDate)); | |
| 544 | - } else { | |
| 545 | - dateTime = sdfSimple.format(sdfMonth.parse(startDate)) | |
| 546 | - +"-"+sdfSimple.format(sdfMonth.parse(endDate)); | |
| 547 | - } | |
| 548 | - listI.add(resList.iterator()); | |
| 549 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 550 | - ee.excelReplace(listI, new Object[] { map }, path + "mould/changetochange.xls", path + "export/" | |
| 551 | - + dateTime + "-" + lineName + "-$$$$$${txt-597}.xls"); | |
| 552 | - } catch (Exception e) { | |
| 553 | - e.printStackTrace(); | |
| 554 | - } | |
| 555 | - return resList; | |
| 556 | - } | |
| 557 | - | |
| 558 | - // $$$$$${txt-406} | |
| 559 | - @RequestMapping(value = "/turnoutrateExport", method = RequestMethod.POST) | |
| 560 | - public List<Map<String, Object>> turnoutrateExport(@RequestParam Map<String, Object> map) { | |
| 561 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 562 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 563 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 564 | - ReportUtils ee = new ReportUtils(); | |
| 565 | - Map<String, Object> map1 = new HashMap<String, Object>(); | |
| 566 | - | |
| 567 | - List<Map<String, Object>> resList = formsService.turnoutrate(map); | |
| 568 | - Map<String, Object> m = resList.get(resList.size() - 1); | |
| 569 | - map1.put("line", m.get("line")); | |
| 570 | - map1.put("jhcc", m.get("jhcc")); | |
| 571 | - map1.put("sjcc", m.get("sjcc")); | |
| 572 | - map1.put("jhbc", m.get("jhbc")); | |
| 573 | - map1.put("sjbc", m.get("sjbc")); | |
| 574 | - map1.put("ccl", m.get("ccl")); | |
| 575 | - map1.put("zxl", m.get("zxl")); | |
| 576 | - map1.put("qz", m.get("qz")); | |
| 577 | - map1.put("sm", m.get("sm")); | |
| 578 | - | |
| 579 | - resList.remove(m); | |
| 580 | - | |
| 581 | - try { | |
| 582 | - String dateTime = "", startDate = "", endDate = "", lineName = ""; | |
| 583 | - if(map.containsKey("startDate")) | |
| 584 | - startDate = map.get("startDate").toString(); | |
| 585 | - if(map.containsKey("endDate")) | |
| 586 | - endDate = map.get("endDate").toString(); | |
| 587 | - if(map.containsKey("lineName")) | |
| 588 | - lineName = map.get("lineName").toString(); | |
| 589 | - if(startDate.equals(endDate)){ | |
| 590 | - dateTime = sdfSimple.format(sdfMonth.parse(startDate)); | |
| 591 | - } else { | |
| 592 | - dateTime = sdfSimple.format(sdfMonth.parse(startDate)) | |
| 593 | - +"-"+sdfSimple.format(sdfMonth.parse(endDate)); | |
| 594 | - } | |
| 595 | - listI.add(resList.iterator()); | |
| 596 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 597 | - ee.excelReplace(listI, new Object[] { map1 }, path + "mould/turnoutrate.xls", path + "export/" | |
| 598 | - + dateTime + "-" + lineName + "-$$$$$${txt-406}.xls"); | |
| 599 | - } catch (Exception e) { | |
| 600 | - e.printStackTrace(); | |
| 601 | - } | |
| 602 | - return resList; | |
| 603 | - } | |
| 604 | - | |
| 605 | - //$$$$$${txt-741} | |
| 606 | - @RequestMapping(value = "/executionrateExport", method = RequestMethod.POST) | |
| 607 | - public List<Map<String, Object>> executionrateExport(@RequestParam Map<String, Object> map) { | |
| 608 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 609 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 610 | - ReportUtils ee = new ReportUtils(); | |
| 611 | - List<Executionrate> executionrate = formsService.executionrate(map); | |
| 612 | - Map<String, Object> map1 = new HashMap<String, Object>(); | |
| 613 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 614 | - String xlts=""; | |
| 615 | - String zsgs=""; | |
| 616 | - String jh=""; | |
| 617 | - Float sj=0f; | |
| 618 | - Float ccl=0f; | |
| 619 | - Float bcjh=0f; | |
| 620 | - String bcsj=""; | |
| 621 | - Float bczxl=0f; | |
| 622 | - String gs=""; | |
| 623 | - String zhgs=""; | |
| 624 | - | |
| 625 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 626 | - | |
| 627 | - for (Executionrate l : executionrate) { | |
| 628 | - | |
| 629 | - xlts +=l.getGsgs()==""?0:String.valueOf(l.getGsgs()); | |
| 630 | - zsgs +=l.getFgsgs()==""?0:String.valueOf(l.getFgsgs()); | |
| 631 | - jh +=l.getXl()==""?0:String.valueOf(l.getXl()); | |
| 632 | - sj +=l.getCchjh()==""?0f:Float.valueOf(l.getCchjh()); | |
| 633 | - ccl +=l.getCchsj()==""?0f:Float.valueOf(l.getCchsj()); | |
| 634 | - bcsj +=l.getChl()==""?0:String.valueOf(l.getChl()); | |
| 635 | - bczxl +=l.getBcjh()==""?0f:Float.valueOf(l.getBcjh()); | |
| 636 | - gs +=l.getBcsj()==""?0:String.valueOf(l.getBcsj()); | |
| 637 | - zhgs +=l.getBbzxl()==""?0:String.valueOf(l.getBbzxl()); | |
| 638 | - | |
| 639 | - | |
| 640 | - | |
| 641 | - m.put("rq", l.getRq()); | |
| 642 | - m.put("gs", l.getGs()); | |
| 643 | - m.put("zhgs", l.getZhgs()); | |
| 644 | - m.put("xl", l.getXl()); | |
| 645 | - m.put("cchjh", l.getCchjh()); | |
| 646 | - m.put("cchsj", l.getCchsj()); | |
| 647 | - m.put("chl", l.getChl()); | |
| 648 | - m.put("bcjh", l.getBcjh()); | |
| 649 | - m.put("bcsj", l.getBcsj()); | |
| 650 | - m.put("bbzxl", l.getBbzxl()); | |
| 651 | - m.put("sm", l.getSm()); | |
| 652 | - resList.add(m); | |
| 653 | - | |
| 654 | - | |
| 655 | - m=new HashMap<String,Object>(); | |
| 656 | - m.put("total_gs", xlts); | |
| 657 | - m.put("total_zhgs", zsgs); | |
| 658 | - m.put("total_xlts", jh); | |
| 659 | - m.put("total_jh", sj); | |
| 660 | - m.put("total_sj", ccl); | |
| 661 | - m.put("total_ccl",bcsj); | |
| 662 | - m.put("total_bcjh", bczxl); | |
| 663 | - m.put("total_bcsj", gs); | |
| 664 | - m.put("total_bczxl", zhgs); | |
| 665 | - | |
| 666 | - map1 = m; | |
| 667 | - } | |
| 668 | - | |
| 669 | - try { | |
| 670 | - listI.add(resList.iterator()); | |
| 671 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 672 | - ee.excelReplace(listI, new Object[] { map1 }, path + "mould/executionrate.xls", path + "export/$$$$$${txt-741}" | |
| 673 | - + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 674 | - } catch (Exception e) { | |
| 675 | - e.printStackTrace(); | |
| 676 | - } | |
| 677 | - return resList; | |
| 678 | - } | |
| 679 | - | |
| 680 | - | |
| 681 | - ////$$$$$${txt-534} | |
| 682 | - @RequestMapping(value = "/alllineExport", method = RequestMethod.POST) | |
| 683 | - public List<Map<String, Object>> alllineExport(@RequestParam Map<String, Object> map) { | |
| 684 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 685 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 686 | - ReportUtils ee = new ReportUtils(); | |
| 687 | - List<Allline> allline = formsService.allline(map); | |
| 688 | - Map<String, Object> map1 = new HashMap<String, Object>(); | |
| 689 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 690 | - Integer jh=0; | |
| 691 | - Integer sj=0; | |
| 692 | - Integer ccl=0; | |
| 693 | - Double bcjh=0.0; | |
| 694 | - String bcsj=""; | |
| 695 | - Integer bczxl=0; | |
| 696 | - String gs=""; | |
| 697 | - String zhgs=""; | |
| 698 | - Map<String, Object> m ; | |
| 699 | - for (Allline l : allline) { | |
| 700 | - m = new HashMap<String, Object>(); | |
| 701 | - | |
| 702 | - jh +=l.getGsgs()=="" ? 0: Integer.valueOf(l.getGsgs()); | |
| 703 | - sj +=l.getFgsgs()==""?0: Integer.valueOf(l.getFgsgs()); | |
| 704 | - ccl +=l.getCchjh()==""?0: Integer.valueOf(l.getCchjh()); | |
| 705 | - bcjh +=l.getCchsj()==""?0: Double.valueOf(l.getCchsj()); | |
| 706 | - | |
| 707 | - bcsj +=l.getChl()==""? 0:String.valueOf(l.getChl()); | |
| 708 | - bczxl +=l.getBcjh()==""?0: Integer.valueOf(l.getBcjh()); | |
| 709 | - gs +=l.getBcsj()==""?0: String.valueOf(l.getBcsj()); | |
| 710 | - zhgs +=l.getBbzxl()==""?0:String.valueOf(l.getBbzxl()); | |
| 711 | - | |
| 712 | - m.put("rq", l.getRq()); | |
| 713 | - m.put("gs", l.getGs()); | |
| 714 | - m.put("zhgs", l.getZhgs()); | |
| 715 | - m.put("xl", l.getXl()); | |
| 716 | - m.put("cchjh", l.getCchjh()); | |
| 717 | - m.put("cchsj", l.getCchsj()); | |
| 718 | - m.put("chl", l.getChl()); | |
| 719 | - m.put("bcjh", l.getBcjh()); | |
| 720 | - m.put("bcsj", l.getBcsj()); | |
| 721 | - m.put("bbzxl", l.getBbzxl()); | |
| 722 | - m.put("sm", l.getSm()); | |
| 723 | - resList.add(m); | |
| 724 | - | |
| 725 | - m=new HashMap<String,Object>(); | |
| 726 | - m.put("total_jh", jh); | |
| 727 | - m.put("total_sj", sj); | |
| 728 | - m.put("total_ccl", ccl); | |
| 729 | - m.put("total_bcjh", bcjh); | |
| 730 | - m.put("total_bcsj", bcsj); | |
| 731 | - m.put("total_bczxl", bczxl); | |
| 732 | - m.put("total_gs", gs); | |
| 733 | - m.put("total_zhgs", zhgs); | |
| 734 | - map1 = m; | |
| 735 | - | |
| 736 | - } | |
| 737 | - | |
| 738 | - try { | |
| 739 | - listI.add(resList.iterator()); | |
| 740 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 741 | - ee.excelReplace(listI, new Object[] { map1 }, path + "mould/allline.xls", path + "export/$$$$$${txt-534}" | |
| 742 | - + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 743 | - } catch (Exception e) { | |
| 744 | - e.printStackTrace(); | |
| 745 | - } | |
| 746 | - return resList; | |
| 747 | - } | |
| 748 | - | |
| 749 | - | |
| 750 | - | |
| 751 | - //班次日报表 | |
| 752 | - @RequestMapping(value = "/dailyExport", method = RequestMethod.POST) | |
| 753 | - public List<Map<String, Object>> dailyExport(@RequestParam Map<String, Object> map) { | |
| 754 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 755 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 756 | - ReportUtils ee = new ReportUtils(); | |
| 757 | - List<Daily> allline = formsService.daily(map); | |
| 758 | - | |
| 759 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 760 | - double zgl=0.0; | |
| 761 | - double ks=0.0; | |
| 762 | - double yh=0.0; | |
| 763 | - int bc=0; | |
| 764 | - Map<String, Object> m ; | |
| 765 | - for (Daily d : allline) { | |
| 766 | - m = new HashMap<String, Object>(); | |
| 767 | - m.put("zbh", d.getZbh()); | |
| 768 | - m.put("jgh",d.getJgh()); | |
| 769 | - m.put("jName", d.getjName()); | |
| 770 | - m.put("zlc", d.getZlc()); | |
| 771 | - m.put("jzl1", d.getJzl1()); | |
| 772 | - m.put("yh", d.getYh()); | |
| 773 | - m.put("bc", d.getBc()); | |
| 774 | - zgl =Arith.add(zgl, d.getZlc()); | |
| 775 | - ks =Arith.add(ks, d.getJzl1()); | |
| 776 | - yh =Arith.add(yh, d.getYh()); | |
| 777 | - bc +=Integer.parseInt(d.getBc()); | |
| 778 | - | |
| 779 | - resList.add(m); | |
| 780 | - } | |
| 781 | - | |
| 782 | - m=new HashMap<String,Object>(); | |
| 783 | - m.put("total_zgl", zgl); | |
| 784 | - m.put("total_ks", ks); | |
| 785 | - m.put("total_yh", yh); | |
| 786 | - m.put("total_bc", bc); | |
| 787 | - | |
| 788 | - m.put("line", BasicData.lineCode2NameMap.get(map.get("line").toString())); | |
| 789 | - m.put("date", map.get("date").toString()); | |
| 790 | - try { | |
| 791 | - String lineName = map.get("lineName").toString(); | |
| 792 | - String date = map.get("date").toString(); | |
| 793 | - listI.add(resList.iterator()); | |
| 794 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 795 | - ee.excelReplace(listI, new Object[] { m }, path + "mould/daily.xls", | |
| 796 | - path + "export/" + sdfSimple.format(sdfMonth.parse(date)) | |
| 797 | - + "-" + lineName + "-$$$$$${txt-1897}.xls"); | |
| 798 | - } catch (Exception e) { | |
| 799 | - e.printStackTrace(); | |
| 800 | - } | |
| 801 | - return resList; | |
| 802 | - } | |
| 803 | - | |
| 804 | - | |
| 805 | - | |
| 806 | -} | |
| 1 | +package com.bsth.controller.forms; | |
| 2 | + | |
| 3 | +import java.text.SimpleDateFormat; | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.HashMap; | |
| 6 | +import java.util.Iterator; | |
| 7 | +import java.util.List; | |
| 8 | +import java.util.Map; | |
| 9 | + | |
| 10 | +import com.bsth.util.I18n; | |
| 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 | + | |
| 17 | +import com.bsth.data.BasicData; | |
| 18 | +import com.bsth.entity.mcy_forms.Allline; | |
| 19 | +import com.bsth.entity.mcy_forms.Changetochange; | |
| 20 | +import com.bsth.entity.mcy_forms.Daily; | |
| 21 | +import com.bsth.entity.mcy_forms.Executionrate; | |
| 22 | +import com.bsth.entity.mcy_forms.Linepasswengerflow; | |
| 23 | +import com.bsth.entity.mcy_forms.Operationservice; | |
| 24 | +import com.bsth.entity.mcy_forms.Shifday; | |
| 25 | +import com.bsth.entity.mcy_forms.Shiftuehiclemanth; | |
| 26 | +import com.bsth.entity.mcy_forms.Singledata; | |
| 27 | +import com.bsth.entity.mcy_forms.Turnoutrate; | |
| 28 | +import com.bsth.entity.mcy_forms.Vehicleloading; | |
| 29 | +import com.bsth.entity.mcy_forms.Waybillday; | |
| 30 | +import com.bsth.service.forms.ExportService; | |
| 31 | +import com.bsth.service.forms.FormsService; | |
| 32 | +import com.bsth.util.Arith; | |
| 33 | +import com.bsth.util.ReportUtils; | |
| 34 | + | |
| 35 | +@RestController | |
| 36 | +@RequestMapping("mcy_export") | |
| 37 | +public class ExportController { | |
| 38 | + | |
| 39 | + | |
| 40 | + @Autowired | |
| 41 | + FormsService formsService; | |
| 42 | + | |
| 43 | + @Autowired | |
| 44 | + ExportService exportService; | |
| 45 | + | |
| 46 | + // 行车路单日报表 | |
| 47 | + @RequestMapping(value = "/waybilldayExport", method = RequestMethod.POST) | |
| 48 | + public List<Waybillday> waybilldayExport(@RequestParam Map<String, Object> map) { | |
| 49 | + List<Waybillday> waybillday = formsService.waybillday(map); | |
| 50 | + exportService.waybillday(map.get("date").toString(), | |
| 51 | + map.get("lineName").toString(), waybillday); | |
| 52 | + return waybillday; | |
| 53 | + } | |
| 54 | + | |
| 55 | + // 线路客流量报表 | |
| 56 | + @RequestMapping(value = "/linepasswengerflowExport", method = RequestMethod.POST) | |
| 57 | + public List<Map<String, Object>> linepasswengerflowExport(@RequestParam Map<String, Object> map) { | |
| 58 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 59 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 60 | + ReportUtils ee = new ReportUtils(); | |
| 61 | + List<Linepasswengerflow> linepasswengerflow = formsService.linepasswengerflow(map); | |
| 62 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 63 | + int i = 1; | |
| 64 | + for (Linepasswengerflow l : linepasswengerflow) { | |
| 65 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 66 | + m.put("i", i); | |
| 67 | + m.put("stationName", l.getStationName()); | |
| 68 | + m.put("1", " "); | |
| 69 | + m.put("2", " "); | |
| 70 | + resList.add(m); | |
| 71 | + i++; | |
| 72 | + } | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + try { | |
| 77 | + listI.add(resList.iterator()); | |
| 78 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 79 | + ee.excelReplace(listI, new Object[] { map }, path + "mould/linepasswengerflow.xls", | |
| 80 | + path + "export/" + I18n.getInstance().getMessage("txt-995") + "" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls"); | |
| 81 | + } catch (Exception e) { | |
| 82 | + e.printStackTrace(); | |
| 83 | + } | |
| 84 | + return resList; | |
| 85 | + } | |
| 86 | + | |
| 87 | + | |
| 88 | + @RequestMapping(value = "/shifdayExport", method = RequestMethod.GET) | |
| 89 | + public List<Map<String, Object>> shifdayExport(@RequestParam Map<String, Object> map) { | |
| 90 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 91 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 92 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 93 | + Map<String, Object> map2 = new HashMap<String, Object>(); | |
| 94 | + ReportUtils ee = new ReportUtils(); | |
| 95 | + List<Shifday> shifday = formsService.shifday(map); | |
| 96 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 97 | + for (Shifday l : shifday) { | |
| 98 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 99 | + m.put("jName", l.getjName()); | |
| 100 | + m.put("sName", l.getsName()); | |
| 101 | + m.put("lpName", l.getLpName()); | |
| 102 | + m.put("carPlate", l.getCarPlate()); | |
| 103 | + m.put("jhlc", l.getJhlc()); | |
| 104 | + m.put("sjjhlc", l.getSjjhlc()); | |
| 105 | + m.put("yygl", l.getYygl()); | |
| 106 | + m.put("emptMileage", l.getEmptMileage()); | |
| 107 | + m.put("remMileage", l.getRemMileage()); | |
| 108 | + m.put("addMileage", l.getAddMileage()); | |
| 109 | + m.put("totalm", l.getTotalm()); | |
| 110 | + m.put("jhbc", l.getJhbc()); | |
| 111 | + m.put("sjjhbc", l.getSjjhbc()); | |
| 112 | + m.put("cjbc", l.getCjbc()); | |
| 113 | + m.put("ljbc", l.getLjbc()); | |
| 114 | + m.put("sjbc", l.getSjbc()); | |
| 115 | + resList.add(m); | |
| 116 | + } | |
| 117 | + if(resList.size() > 0){ | |
| 118 | + map2 = resList.get(resList.size() - 1); | |
| 119 | + resList.remove(map2); | |
| 120 | + } | |
| 121 | + | |
| 122 | + try { | |
| 123 | + String lineName = ""; | |
| 124 | + if(map.containsKey("lineName")) | |
| 125 | + lineName = map.get("lineName").toString(); | |
| 126 | + listI.add(resList.iterator()); | |
| 127 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 128 | + ee.excelReplace(listI, new Object[] { map2 }, path + "mould/shifday.xls", | |
| 129 | + path + "export/" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) | |
| 130 | + + "-" + lineName + "-" + I18n.getInstance().getMessage("txt-543") + ".xls"); | |
| 131 | + } catch (Exception e) { | |
| 132 | + e.printStackTrace(); | |
| 133 | + } | |
| 134 | + return resList; | |
| 135 | + } | |
| 136 | + | |
| 137 | + // 班次车辆人员月统计 | |
| 138 | + @RequestMapping(value = "/shiftuehiclemanthExport", method = RequestMethod.GET) | |
| 139 | + public List<Map<String, Object>> shiftuehiclemanthExport(@RequestParam Map<String, Object> map) { | |
| 140 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 141 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 142 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 143 | + ReportUtils ee = new ReportUtils(); | |
| 144 | + List<Shiftuehiclemanth> shiftuehiclemanth = formsService.shiftuehiclemanth(map); | |
| 145 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 146 | + int i = 1; | |
| 147 | + for (Shiftuehiclemanth l : shiftuehiclemanth) { | |
| 148 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 149 | + m.put("i", i); | |
| 150 | + m.put("jName", l.getjName()); | |
| 151 | + m.put("jhlc", l.getJhlc()); | |
| 152 | + m.put("emptMileage", l.getEmptMileage()); | |
| 153 | + m.put("remMileage", l.getRemMileage()); | |
| 154 | + m.put("addMileage", l.getAddMileage()); | |
| 155 | + m.put("totalm", l.getTotalm()); | |
| 156 | + m.put("cjbc", l.getCjbc()); | |
| 157 | + m.put("ljbc", l.getLjbc()); | |
| 158 | + m.put("sjbc", l.getSjbc()); | |
| 159 | + resList.add(m); | |
| 160 | + i++; | |
| 161 | + } | |
| 162 | + | |
| 163 | + try { | |
| 164 | + String mouldurl = null, lineName = "", dateTime = "" | |
| 165 | + , startDate = "", endDate = ""; | |
| 166 | + if(map.containsKey("lineName")) | |
| 167 | + lineName = map.get("lineName").toString(); | |
| 168 | + if(map.containsKey("startDate")) | |
| 169 | + startDate = map.get("startDate").toString(); | |
| 170 | + if(map.containsKey("endDate")) | |
| 171 | + endDate = map.get("endDate").toString(); | |
| 172 | + if(startDate.equals(endDate)){ | |
| 173 | + dateTime = sdfSimple.format(sdfMonth.parse(startDate)); | |
| 174 | + } else { | |
| 175 | + dateTime = sdfSimple.format(sdfMonth.parse(startDate)) | |
| 176 | + +"-"+sdfSimple.format(sdfMonth.parse(endDate)); | |
| 177 | + } | |
| 178 | + if(map.get("empnames").equals(I18n.getInstance().getMessage("txt-3568"))){ | |
| 179 | + mouldurl="mould/shiftuehiclemanth.xls"; | |
| 180 | + }else if(map.get("empnames").equals(I18n.getInstance().getMessage("txt-3567"))){ | |
| 181 | + mouldurl="mould/shiftuehiclemanthspy.xls"; | |
| 182 | + }else if(map.get("empnames").equals(I18n.getInstance().getMessage("txt-2008"))){ | |
| 183 | + mouldurl="mould/shiftuehiclemanthclzbh.xls"; | |
| 184 | + } | |
| 185 | + listI.add(resList.iterator()); | |
| 186 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 187 | + ee.excelReplace(listI, new Object[] { map }, path +mouldurl, | |
| 188 | + path + "export/" + dateTime + "-" + lineName + "-" + I18n.getInstance().getMessage("txt-542") + ".xls"); | |
| 189 | + } catch (Exception e) { | |
| 190 | + e.printStackTrace(); | |
| 191 | + } | |
| 192 | + | |
| 193 | + return resList; | |
| 194 | + } | |
| 195 | + | |
| 196 | + // 班次车辆人员月统计 | |
| 197 | + @RequestMapping(value = "/shiftuehiclemanthExport2", method = RequestMethod.GET) | |
| 198 | + public List<Map<String, Object>> shiftuehiclemanthExport2(@RequestParam Map<String, Object> map) { | |
| 199 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 200 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 201 | + ReportUtils ee = new ReportUtils(); | |
| 202 | + List<Shiftuehiclemanth> shiftuehiclemanth = formsService.shiftuehiclemanth2(map); | |
| 203 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 204 | + int i = 1; | |
| 205 | + for (Shiftuehiclemanth l : shiftuehiclemanth) { | |
| 206 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 207 | + m.put("i", i); | |
| 208 | + m.put("jName", l.getjName()); | |
| 209 | + m.put("jhlc", l.getJhlc()); | |
| 210 | + m.put("emptMileage", l.getEmptMileage()); | |
| 211 | + m.put("remMileage", l.getRemMileage()); | |
| 212 | + m.put("addMileage", l.getAddMileage()); | |
| 213 | + m.put("totalm", l.getTotalm()); | |
| 214 | + m.put("cjbc", l.getCjbc()); | |
| 215 | + m.put("ljbc", l.getLjbc()); | |
| 216 | + m.put("sjbc", l.getSjbc()); | |
| 217 | + resList.add(m); | |
| 218 | + i++; | |
| 219 | + } | |
| 220 | + | |
| 221 | + try { | |
| 222 | + String mouldurl = null; | |
| 223 | + if(map.get("empnames").equals(I18n.getInstance().getMessage("txt-3568"))){ | |
| 224 | + mouldurl="mould/shiftuehiclemanth.xls"; | |
| 225 | + }else if(map.get("empnames").equals(I18n.getInstance().getMessage("txt-3567"))){ | |
| 226 | + mouldurl="mould/shiftuehiclemanthspy.xls"; | |
| 227 | + }else if(map.get("empnames").equals(I18n.getInstance().getMessage("txt-2008"))){ | |
| 228 | + mouldurl="mould/shiftuehiclemanthclzbh.xls"; | |
| 229 | + } | |
| 230 | + listI.add(resList.iterator()); | |
| 231 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 232 | + ee.excelReplace(listI, new Object[] { map }, path +mouldurl, | |
| 233 | + path + "export/" + I18n.getInstance().getMessage("txt-542") + "" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 234 | + } catch (Exception e) { | |
| 235 | + e.printStackTrace(); | |
| 236 | + } | |
| 237 | + | |
| 238 | + return resList; | |
| 239 | + } | |
| 240 | + | |
| 241 | + // 路单数据报表 | |
| 242 | + @RequestMapping(value = "/singledataExport", method = RequestMethod.GET) | |
| 243 | + public List<Map<String, Object>> singledataExport(@RequestParam Map<String, Object> map) { | |
| 244 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 245 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 246 | + ReportUtils ee = new ReportUtils(); | |
| 247 | + List<Singledata> singledata = formsService.singledata(map); | |
| 248 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 249 | + int i = 1; | |
| 250 | + for (Singledata l : singledata) { | |
| 251 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 252 | + m.put("i", i); | |
| 253 | + m.put("rQ", l.getrQ()); | |
| 254 | + m.put("gS", l.getgS()); | |
| 255 | + m.put("xL", l.getXlmc()); | |
| 256 | + m.put("clzbh", l.getClzbh()); | |
| 257 | + m.put("jsy", l.getJsy()); | |
| 258 | + m.put("jName", l.getjName()); | |
| 259 | + m.put("sgh", l.getSgh()); | |
| 260 | + m.put("sName", l.getsName()); | |
| 261 | + m.put("jhlc", l.getJhlc()); | |
| 262 | + m.put("emptMileage", l.getEmptMileage()); | |
| 263 | + m.put("hyl", l.getHyl()); | |
| 264 | + m.put("jzl", l.getJzl()); | |
| 265 | + m.put("unyyyl", l.getUnyyyl()); | |
| 266 | + m.put("jhjl", l.getJhjl()); | |
| 267 | + resList.add(m); | |
| 268 | + | |
| 269 | + i++; | |
| 270 | + } | |
| 271 | + | |
| 272 | + try { | |
| 273 | + listI.add(resList.iterator()); | |
| 274 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 275 | + ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls", | |
| 276 | + path + "export/" + I18n.getInstance().getMessage("txt-2458") + "" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls",new String[]{"jsy","sgh"}); | |
| 277 | + } catch (Exception e) { | |
| 278 | + e.printStackTrace(); | |
| 279 | + } | |
| 280 | + | |
| 281 | + return resList; | |
| 282 | + } | |
| 283 | + | |
| 284 | + // 路单数据报表 | |
| 285 | + @RequestMapping(value = "/singledataExport2", method = RequestMethod.GET) | |
| 286 | + public List<Map<String, Object>> singledataExport2(@RequestParam Map<String, Object> map) { | |
| 287 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 288 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 289 | + ReportUtils ee = new ReportUtils(); | |
| 290 | + List<Singledata> singledata = formsService.singledata2(map); | |
| 291 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 292 | + int i = 1; | |
| 293 | + for (Singledata l : singledata) { | |
| 294 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 295 | + m.put("i", i); | |
| 296 | + m.put("rQ", l.getrQ()); | |
| 297 | + m.put("gS", l.getgS()); | |
| 298 | + m.put("xL", l.getXlmc()); | |
| 299 | + m.put("clzbh", l.getClzbh()); | |
| 300 | + m.put("jsy", l.getJsy()); | |
| 301 | + m.put("jName", l.getjName()); | |
| 302 | + m.put("sgh", l.getSgh()); | |
| 303 | + m.put("sName", l.getsName()); | |
| 304 | + m.put("jhlc", l.getJhlc()); | |
| 305 | + m.put("emptMileage", l.getEmptMileage()); | |
| 306 | + m.put("hyl", l.getHyl()); | |
| 307 | + m.put("jzl", l.getJzl()); | |
| 308 | + m.put("unyyyl", l.getUnyyyl()); | |
| 309 | + m.put("jhjl", l.getJhjl()); | |
| 310 | + resList.add(m); | |
| 311 | + | |
| 312 | + i++; | |
| 313 | + } | |
| 314 | + | |
| 315 | + try { | |
| 316 | + listI.add(resList.iterator()); | |
| 317 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 318 | + ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls", | |
| 319 | + path + "export/" + I18n.getInstance().getMessage("txt-2458") + "" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 320 | + } catch (Exception e) { | |
| 321 | + e.printStackTrace(); | |
| 322 | + } | |
| 323 | + | |
| 324 | + return resList; | |
| 325 | + } | |
| 326 | + @RequestMapping(value = "/singledataExportTj", method = RequestMethod.GET) | |
| 327 | + public List<Map<String, Object>> singledataExportTj(@RequestParam Map<String, Object> map) { | |
| 328 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 329 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 330 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 331 | + ReportUtils ee = new ReportUtils(); | |
| 332 | + List<Singledata> singledata = formsService.singledatatj(map); | |
| 333 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 334 | + int i = 1; | |
| 335 | + for (Singledata l : singledata) { | |
| 336 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 337 | + m.put("i", i); | |
| 338 | + m.put("rQ", l.getrQ()); | |
| 339 | + m.put("gS", l.getgS()); | |
| 340 | + m.put("xL", l.getXlmc()); | |
| 341 | + m.put("clzbh", l.getClzbh()); | |
| 342 | + m.put("jsy", l.getJsy()); | |
| 343 | + m.put("jName", l.getjName()); | |
| 344 | + m.put("sgh", l.getSgh()); | |
| 345 | + m.put("sName", l.getsName()); | |
| 346 | + m.put("jhlc", l.getJhlc()); | |
| 347 | + m.put("emptMileage", l.getEmptMileage()); | |
| 348 | + m.put("hyl", l.getHyl()); | |
| 349 | + m.put("jzl", l.getJzl()); | |
| 350 | + m.put("unyyyl", l.getUnyyyl()); | |
| 351 | + m.put("jhjl", l.getJhjl()); | |
| 352 | + resList.add(m); | |
| 353 | + | |
| 354 | + i++; | |
| 355 | + } | |
| 356 | + | |
| 357 | + try { | |
| 358 | + String startDate = "", lineName = ""; | |
| 359 | + if(map.containsKey("startDate")) | |
| 360 | + startDate = map.get("startDate").toString(); | |
| 361 | + if(map.containsKey("lineName")) | |
| 362 | + lineName = map.get("lineName").toString(); | |
| 363 | + listI.add(resList.iterator()); | |
| 364 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 365 | + ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls", | |
| 366 | + path + "export/" + sdfSimple.format(sdfMonth.parse(startDate)) | |
| 367 | + + "-" + lineName + "-" + I18n.getInstance().getMessage("txt-2458") + ".xls"); | |
| 368 | + } catch (Exception e) { | |
| 369 | + e.printStackTrace(); | |
| 370 | + } | |
| 371 | + | |
| 372 | + return resList; | |
| 373 | + } | |
| 374 | + | |
| 375 | + @RequestMapping(value = "/singledataExportTj2", method = RequestMethod.GET) | |
| 376 | + public List<Map<String, Object>> singledataExportTj2(@RequestParam Map<String, Object> map) { | |
| 377 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 378 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 379 | + ReportUtils ee = new ReportUtils(); | |
| 380 | + List<Singledata> singledata = formsService.singledatatj2(map); | |
| 381 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 382 | + int i = 1; | |
| 383 | + for (Singledata l : singledata) { | |
| 384 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 385 | + m.put("i", i); | |
| 386 | + m.put("rQ", l.getrQ()); | |
| 387 | + m.put("gS", l.getgS()); | |
| 388 | + m.put("xL", l.getXlmc()); | |
| 389 | + m.put("clzbh", l.getClzbh()); | |
| 390 | + m.put("jsy", l.getJsy()); | |
| 391 | + m.put("jName", l.getjName()); | |
| 392 | + m.put("sgh", l.getSgh()); | |
| 393 | + m.put("sName", l.getsName()); | |
| 394 | + m.put("jhlc", l.getJhlc()); | |
| 395 | + m.put("emptMileage", l.getEmptMileage()); | |
| 396 | + m.put("hyl", l.getHyl()); | |
| 397 | + m.put("jzl", l.getJzl()); | |
| 398 | + m.put("unyyyl", l.getUnyyyl()); | |
| 399 | + m.put("jhjl", l.getJhjl()); | |
| 400 | + resList.add(m); | |
| 401 | + | |
| 402 | + i++; | |
| 403 | + } | |
| 404 | + | |
| 405 | + try { | |
| 406 | + listI.add(resList.iterator()); | |
| 407 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 408 | + ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls", | |
| 409 | + path + "export/" + I18n.getInstance().getMessage("txt-2458") + "" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 410 | + } catch (Exception e) { | |
| 411 | + e.printStackTrace(); | |
| 412 | + } | |
| 413 | + | |
| 414 | + return resList; | |
| 415 | + } | |
| 416 | + // 车辆加注 | |
| 417 | + @RequestMapping(value = "/vehicleloadingExport", method = RequestMethod.GET) | |
| 418 | + public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map) { | |
| 419 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 420 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 421 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 422 | + ReportUtils ee = new ReportUtils(); | |
| 423 | + List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("line").toString(), | |
| 424 | + map.get("data").toString()); | |
| 425 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 426 | + int i = 1; | |
| 427 | + for (Vehicleloading l : vehicleloading) { | |
| 428 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 429 | + m.put("i", i); | |
| 430 | + m.put("rQ", l.getrQ()); | |
| 431 | + m.put("gS", l.getgS()); | |
| 432 | + m.put("xL", l.getxL()); | |
| 433 | + m.put("clzbh", l.getClzbh()); | |
| 434 | + m.put("jzl", l.getJzl()); | |
| 435 | + m.put("hyl", l.getHyl()); | |
| 436 | + m.put("ls", l.getLs()); | |
| 437 | + m.put("jhlc", l.getJhlc()); | |
| 438 | + m.put("unyyyl", l.getUnyyyl()); | |
| 439 | + m.put("jhbc", l.getJhbc()); | |
| 440 | + m.put("sjbc", l.getSjbc()); | |
| 441 | + resList.add(m); | |
| 442 | + i++; | |
| 443 | + } | |
| 444 | + | |
| 445 | + try { | |
| 446 | + String date = "", lineName = ""; | |
| 447 | + if(map.containsKey("data")) | |
| 448 | + date = map.get("data").toString(); | |
| 449 | + if(map.containsKey("lineName")) | |
| 450 | + lineName = map.get("lineName").toString(); | |
| 451 | + listI.add(resList.iterator()); | |
| 452 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 453 | + ee.excelReplace(listI, new Object[] { map }, path + "mould/vehicleloading.xls", | |
| 454 | + path + "export/" + sdfSimple.format(sdfMonth.parse(date)) + "-" + lineName + "-" + I18n.getInstance().getMessage("txt-2462") + ".xls"); | |
| 455 | + } catch (Exception e) { | |
| 456 | + e.printStackTrace(); | |
| 457 | + } | |
| 458 | + return resList; | |
| 459 | + } | |
| 460 | + | |
| 461 | + | |
| 462 | + @RequestMapping(value = "/operationserviceExport", method = RequestMethod.GET) | |
| 463 | + public List<Map<String, Object>> operationserviceExport(@RequestParam Map<String, Object> map) { | |
| 464 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 465 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 466 | + ReportUtils ee = new ReportUtils(); | |
| 467 | + List<Operationservice> operationservice = formsService.operationservice(map); | |
| 468 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 469 | + int i = 1; | |
| 470 | + for (Operationservice l : operationservice) { | |
| 471 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 472 | + m.put("i", i); | |
| 473 | + m.put("fgs", l.getFgs()!=null?l.getFgs():""); | |
| 474 | + m.put("xlName", l.getXlName()!=null?l.getXlName():""); | |
| 475 | + m.put("jzl", l.getJzl()!=null?l.getJzl():""); | |
| 476 | + m.put("xhl", l.getXhl()!=null?l.getXhl():""); | |
| 477 | + m.put("xsgl", l.getXsgl()!=null?l.getXsgl():""); | |
| 478 | + m.put("emptMileage", l.getEmptMileage()!=null?l.getEmptMileage():""); | |
| 479 | + m.put("sjbc", l.getSjbc()!=null?l.getSjbc():""); | |
| 480 | + resList.add(m); | |
| 481 | + i++; | |
| 482 | + } | |
| 483 | + | |
| 484 | + try { | |
| 485 | + String dateTime = "", startDate = "", endDate = "", lineName = ""; | |
| 486 | + if(map.containsKey("startDate")) | |
| 487 | + startDate = map.get("startDate").toString(); | |
| 488 | + if(map.containsKey("endDate")) | |
| 489 | + endDate = map.get("endDate").toString(); | |
| 490 | + if(map.containsKey("lineName")) | |
| 491 | + lineName = map.get("lineName").toString(); | |
| 492 | + if(startDate.equals(endDate)){ | |
| 493 | + dateTime = sdfSimple.format(sdfMonth.parse(startDate)); | |
| 494 | + } else { | |
| 495 | + dateTime = sdfSimple.format(sdfMonth.parse(startDate)) | |
| 496 | + +"-"+sdfSimple.format(sdfMonth.parse(endDate)); | |
| 497 | + } | |
| 498 | + listI.add(resList.iterator()); | |
| 499 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 500 | + ee.excelReplace(listI, new Object[] { map }, path + "mould/operationservice.xls", path + "export/" | |
| 501 | + + dateTime + "-" + lineName + "-" + I18n.getInstance().getMessage("txt-730") + ".xls"); | |
| 502 | + } catch (Exception e) { | |
| 503 | + e.printStackTrace(); | |
| 504 | + } | |
| 505 | + return resList; | |
| 506 | + } | |
| 507 | + | |
| 508 | + | |
| 509 | + @RequestMapping(value = "/changetochangeExport", method = RequestMethod.POST) | |
| 510 | + public List<Map<String, Object>> changetochangeExport(@RequestParam Map<String, Object> map) { | |
| 511 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 512 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 513 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 514 | + ReportUtils ee = new ReportUtils(); | |
| 515 | + List<Changetochange> changetochange = formsService.changetochange(map); | |
| 516 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 517 | + for (Changetochange l : changetochange) { | |
| 518 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 519 | + m.put("rq", l.getRq()); | |
| 520 | + m.put("gs", l.getGs()); | |
| 521 | + m.put("fgs", l.getFgs()); | |
| 522 | + m.put("xl", l.getXl()); | |
| 523 | + m.put("lp", l.getLp()); | |
| 524 | + m.put("fssj", l.getFssj()); | |
| 525 | + m.put("xgsj", l.getXgsj()); | |
| 526 | + m.put("pcch", l.getPcch()); | |
| 527 | + m.put("sjch", l.getSjch()); | |
| 528 | + m.put("fcgh", l.getPcry()); | |
| 529 | + m.put("sjgh", l.getSjgh()); | |
| 530 | + m.put("yy", l.getYy()==null?"":l.getYy()); | |
| 531 | + m.put("xgr", l.getXgr()); | |
| 532 | + resList.add(m); | |
| 533 | + } | |
| 534 | + | |
| 535 | + try { | |
| 536 | + String dateTime = "", startDate = "", endDate = "", lineName = ""; | |
| 537 | + if(map.containsKey("startDate")) | |
| 538 | + startDate = map.get("startDate").toString(); | |
| 539 | + if(map.containsKey("endDate")) | |
| 540 | + endDate = map.get("endDate").toString(); | |
| 541 | + if(map.containsKey("lineName")) | |
| 542 | + lineName = map.get("lineName").toString(); | |
| 543 | + if(startDate.equals(endDate)){ | |
| 544 | + dateTime = sdfSimple.format(sdfMonth.parse(startDate)); | |
| 545 | + } else { | |
| 546 | + dateTime = sdfSimple.format(sdfMonth.parse(startDate)) | |
| 547 | + +"-"+sdfSimple.format(sdfMonth.parse(endDate)); | |
| 548 | + } | |
| 549 | + listI.add(resList.iterator()); | |
| 550 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 551 | + ee.excelReplace(listI, new Object[] { map }, path + "mould/changetochange.xls", path + "export/" | |
| 552 | + + dateTime + "-" + lineName + "-" + I18n.getInstance().getMessage("txt-597") + ".xls"); | |
| 553 | + } catch (Exception e) { | |
| 554 | + e.printStackTrace(); | |
| 555 | + } | |
| 556 | + return resList; | |
| 557 | + } | |
| 558 | + | |
| 559 | + | |
| 560 | + @RequestMapping(value = "/turnoutrateExport", method = RequestMethod.POST) | |
| 561 | + public List<Map<String, Object>> turnoutrateExport(@RequestParam Map<String, Object> map) { | |
| 562 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 563 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 564 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 565 | + ReportUtils ee = new ReportUtils(); | |
| 566 | + Map<String, Object> map1 = new HashMap<String, Object>(); | |
| 567 | + | |
| 568 | + List<Map<String, Object>> resList = formsService.turnoutrate(map); | |
| 569 | + Map<String, Object> m = resList.get(resList.size() - 1); | |
| 570 | + map1.put("line", m.get("line")); | |
| 571 | + map1.put("jhcc", m.get("jhcc")); | |
| 572 | + map1.put("sjcc", m.get("sjcc")); | |
| 573 | + map1.put("jhbc", m.get("jhbc")); | |
| 574 | + map1.put("sjbc", m.get("sjbc")); | |
| 575 | + map1.put("ccl", m.get("ccl")); | |
| 576 | + map1.put("zxl", m.get("zxl")); | |
| 577 | + map1.put("qz", m.get("qz")); | |
| 578 | + map1.put("sm", m.get("sm")); | |
| 579 | + | |
| 580 | + resList.remove(m); | |
| 581 | + | |
| 582 | + try { | |
| 583 | + String dateTime = "", startDate = "", endDate = "", lineName = ""; | |
| 584 | + if(map.containsKey("startDate")) | |
| 585 | + startDate = map.get("startDate").toString(); | |
| 586 | + if(map.containsKey("endDate")) | |
| 587 | + endDate = map.get("endDate").toString(); | |
| 588 | + if(map.containsKey("lineName")) | |
| 589 | + lineName = map.get("lineName").toString(); | |
| 590 | + if(startDate.equals(endDate)){ | |
| 591 | + dateTime = sdfSimple.format(sdfMonth.parse(startDate)); | |
| 592 | + } else { | |
| 593 | + dateTime = sdfSimple.format(sdfMonth.parse(startDate)) | |
| 594 | + +"-"+sdfSimple.format(sdfMonth.parse(endDate)); | |
| 595 | + } | |
| 596 | + listI.add(resList.iterator()); | |
| 597 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 598 | + ee.excelReplace(listI, new Object[] { map1 }, path + "mould/turnoutrate.xls", path + "export/" | |
| 599 | + + dateTime + "-" + lineName + "-" + I18n.getInstance().getMessage("txt-406") + ".xls"); | |
| 600 | + } catch (Exception e) { | |
| 601 | + e.printStackTrace(); | |
| 602 | + } | |
| 603 | + return resList; | |
| 604 | + } | |
| 605 | + | |
| 606 | + | |
| 607 | + @RequestMapping(value = "/executionrateExport", method = RequestMethod.POST) | |
| 608 | + public List<Map<String, Object>> executionrateExport(@RequestParam Map<String, Object> map) { | |
| 609 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 610 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 611 | + ReportUtils ee = new ReportUtils(); | |
| 612 | + List<Executionrate> executionrate = formsService.executionrate(map); | |
| 613 | + Map<String, Object> map1 = new HashMap<String, Object>(); | |
| 614 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 615 | + String xlts=""; | |
| 616 | + String zsgs=""; | |
| 617 | + String jh=""; | |
| 618 | + Float sj=0f; | |
| 619 | + Float ccl=0f; | |
| 620 | + Float bcjh=0f; | |
| 621 | + String bcsj=""; | |
| 622 | + Float bczxl=0f; | |
| 623 | + String gs=""; | |
| 624 | + String zhgs=""; | |
| 625 | + | |
| 626 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 627 | + | |
| 628 | + for (Executionrate l : executionrate) { | |
| 629 | + | |
| 630 | + xlts +=l.getGsgs()==""?0:String.valueOf(l.getGsgs()); | |
| 631 | + zsgs +=l.getFgsgs()==""?0:String.valueOf(l.getFgsgs()); | |
| 632 | + jh +=l.getXl()==""?0:String.valueOf(l.getXl()); | |
| 633 | + sj +=l.getCchjh()==""?0f:Float.valueOf(l.getCchjh()); | |
| 634 | + ccl +=l.getCchsj()==""?0f:Float.valueOf(l.getCchsj()); | |
| 635 | + bcsj +=l.getChl()==""?0:String.valueOf(l.getChl()); | |
| 636 | + bczxl +=l.getBcjh()==""?0f:Float.valueOf(l.getBcjh()); | |
| 637 | + gs +=l.getBcsj()==""?0:String.valueOf(l.getBcsj()); | |
| 638 | + zhgs +=l.getBbzxl()==""?0:String.valueOf(l.getBbzxl()); | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + m.put("rq", l.getRq()); | |
| 643 | + m.put("gs", l.getGs()); | |
| 644 | + m.put("zhgs", l.getZhgs()); | |
| 645 | + m.put("xl", l.getXl()); | |
| 646 | + m.put("cchjh", l.getCchjh()); | |
| 647 | + m.put("cchsj", l.getCchsj()); | |
| 648 | + m.put("chl", l.getChl()); | |
| 649 | + m.put("bcjh", l.getBcjh()); | |
| 650 | + m.put("bcsj", l.getBcsj()); | |
| 651 | + m.put("bbzxl", l.getBbzxl()); | |
| 652 | + m.put("sm", l.getSm()); | |
| 653 | + resList.add(m); | |
| 654 | + | |
| 655 | + | |
| 656 | + m=new HashMap<String,Object>(); | |
| 657 | + m.put("total_gs", xlts); | |
| 658 | + m.put("total_zhgs", zsgs); | |
| 659 | + m.put("total_xlts", jh); | |
| 660 | + m.put("total_jh", sj); | |
| 661 | + m.put("total_sj", ccl); | |
| 662 | + m.put("total_ccl",bcsj); | |
| 663 | + m.put("total_bcjh", bczxl); | |
| 664 | + m.put("total_bcsj", gs); | |
| 665 | + m.put("total_bczxl", zhgs); | |
| 666 | + | |
| 667 | + map1 = m; | |
| 668 | + } | |
| 669 | + | |
| 670 | + try { | |
| 671 | + listI.add(resList.iterator()); | |
| 672 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 673 | + ee.excelReplace(listI, new Object[] { map1 }, path + "mould/executionrate.xls", path + "export/" + I18n.getInstance().getMessage("txt-741") + "" | |
| 674 | + + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 675 | + } catch (Exception e) { | |
| 676 | + e.printStackTrace(); | |
| 677 | + } | |
| 678 | + return resList; | |
| 679 | + } | |
| 680 | + | |
| 681 | + | |
| 682 | + // | |
| 683 | + @RequestMapping(value = "/alllineExport", method = RequestMethod.POST) | |
| 684 | + public List<Map<String, Object>> alllineExport(@RequestParam Map<String, Object> map) { | |
| 685 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 686 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 687 | + ReportUtils ee = new ReportUtils(); | |
| 688 | + List<Allline> allline = formsService.allline(map); | |
| 689 | + Map<String, Object> map1 = new HashMap<String, Object>(); | |
| 690 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 691 | + Integer jh=0; | |
| 692 | + Integer sj=0; | |
| 693 | + Integer ccl=0; | |
| 694 | + Double bcjh=0.0; | |
| 695 | + String bcsj=""; | |
| 696 | + Integer bczxl=0; | |
| 697 | + String gs=""; | |
| 698 | + String zhgs=""; | |
| 699 | + Map<String, Object> m ; | |
| 700 | + for (Allline l : allline) { | |
| 701 | + m = new HashMap<String, Object>(); | |
| 702 | + | |
| 703 | + jh +=l.getGsgs()=="" ? 0: Integer.valueOf(l.getGsgs()); | |
| 704 | + sj +=l.getFgsgs()==""?0: Integer.valueOf(l.getFgsgs()); | |
| 705 | + ccl +=l.getCchjh()==""?0: Integer.valueOf(l.getCchjh()); | |
| 706 | + bcjh +=l.getCchsj()==""?0: Double.valueOf(l.getCchsj()); | |
| 707 | + | |
| 708 | + bcsj +=l.getChl()==""? 0:String.valueOf(l.getChl()); | |
| 709 | + bczxl +=l.getBcjh()==""?0: Integer.valueOf(l.getBcjh()); | |
| 710 | + gs +=l.getBcsj()==""?0: String.valueOf(l.getBcsj()); | |
| 711 | + zhgs +=l.getBbzxl()==""?0:String.valueOf(l.getBbzxl()); | |
| 712 | + | |
| 713 | + m.put("rq", l.getRq()); | |
| 714 | + m.put("gs", l.getGs()); | |
| 715 | + m.put("zhgs", l.getZhgs()); | |
| 716 | + m.put("xl", l.getXl()); | |
| 717 | + m.put("cchjh", l.getCchjh()); | |
| 718 | + m.put("cchsj", l.getCchsj()); | |
| 719 | + m.put("chl", l.getChl()); | |
| 720 | + m.put("bcjh", l.getBcjh()); | |
| 721 | + m.put("bcsj", l.getBcsj()); | |
| 722 | + m.put("bbzxl", l.getBbzxl()); | |
| 723 | + m.put("sm", l.getSm()); | |
| 724 | + resList.add(m); | |
| 725 | + | |
| 726 | + m=new HashMap<String,Object>(); | |
| 727 | + m.put("total_jh", jh); | |
| 728 | + m.put("total_sj", sj); | |
| 729 | + m.put("total_ccl", ccl); | |
| 730 | + m.put("total_bcjh", bcjh); | |
| 731 | + m.put("total_bcsj", bcsj); | |
| 732 | + m.put("total_bczxl", bczxl); | |
| 733 | + m.put("total_gs", gs); | |
| 734 | + m.put("total_zhgs", zhgs); | |
| 735 | + map1 = m; | |
| 736 | + | |
| 737 | + } | |
| 738 | + | |
| 739 | + try { | |
| 740 | + listI.add(resList.iterator()); | |
| 741 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 742 | + ee.excelReplace(listI, new Object[] { map1 }, path + "mould/allline.xls", path + "export/" + I18n.getInstance().getMessage("txt-534") + "" | |
| 743 | + + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 744 | + } catch (Exception e) { | |
| 745 | + e.printStackTrace(); | |
| 746 | + } | |
| 747 | + return resList; | |
| 748 | + } | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + //班次日报表 | |
| 753 | + @RequestMapping(value = "/dailyExport", method = RequestMethod.POST) | |
| 754 | + public List<Map<String, Object>> dailyExport(@RequestParam Map<String, Object> map) { | |
| 755 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 756 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 757 | + ReportUtils ee = new ReportUtils(); | |
| 758 | + List<Daily> allline = formsService.daily(map); | |
| 759 | + | |
| 760 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 761 | + double zgl=0.0; | |
| 762 | + double ks=0.0; | |
| 763 | + double yh=0.0; | |
| 764 | + int bc=0; | |
| 765 | + Map<String, Object> m ; | |
| 766 | + for (Daily d : allline) { | |
| 767 | + m = new HashMap<String, Object>(); | |
| 768 | + m.put("zbh", d.getZbh()); | |
| 769 | + m.put("jgh",d.getJgh()); | |
| 770 | + m.put("jName", d.getjName()); | |
| 771 | + m.put("zlc", d.getZlc()); | |
| 772 | + m.put("jzl1", d.getJzl1()); | |
| 773 | + m.put("yh", d.getYh()); | |
| 774 | + m.put("bc", d.getBc()); | |
| 775 | + zgl =Arith.add(zgl, d.getZlc()); | |
| 776 | + ks =Arith.add(ks, d.getJzl1()); | |
| 777 | + yh =Arith.add(yh, d.getYh()); | |
| 778 | + bc +=Integer.parseInt(d.getBc()); | |
| 779 | + | |
| 780 | + resList.add(m); | |
| 781 | + } | |
| 782 | + | |
| 783 | + m=new HashMap<String,Object>(); | |
| 784 | + m.put("total_zgl", zgl); | |
| 785 | + m.put("total_ks", ks); | |
| 786 | + m.put("total_yh", yh); | |
| 787 | + m.put("total_bc", bc); | |
| 788 | + | |
| 789 | + m.put("line", BasicData.lineCode2NameMap.get(map.get("line").toString())); | |
| 790 | + m.put("date", map.get("date").toString()); | |
| 791 | + try { | |
| 792 | + String lineName = map.get("lineName").toString(); | |
| 793 | + String date = map.get("date").toString(); | |
| 794 | + listI.add(resList.iterator()); | |
| 795 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 796 | + ee.excelReplace(listI, new Object[] { m }, path + "mould/daily.xls", | |
| 797 | + path + "export/" + sdfSimple.format(sdfMonth.parse(date)) | |
| 798 | + + "-" + lineName + "-" + I18n.getInstance().getMessage("txt-1897") + ".xls"); | |
| 799 | + } catch (Exception e) { | |
| 800 | + e.printStackTrace(); | |
| 801 | + } | |
| 802 | + return resList; | |
| 803 | + } | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | +} | ... | ... |
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
| 1 | -package com.bsth.controller.forms; | |
| 2 | - | |
| 3 | -import java.util.List; | |
| 4 | -import java.util.Map; | |
| 5 | - | |
| 6 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 8 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 9 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 10 | -import org.springframework.web.bind.annotation.RestController; | |
| 11 | - | |
| 12 | -import com.bsth.entity.mcy_forms.Allline; | |
| 13 | -import com.bsth.entity.mcy_forms.Changetochange; | |
| 14 | -import com.bsth.entity.mcy_forms.Daily; | |
| 15 | -import com.bsth.entity.mcy_forms.Executionrate; | |
| 16 | -import com.bsth.entity.mcy_forms.Linepasswengerflow; | |
| 17 | -import com.bsth.entity.mcy_forms.Operationservice; | |
| 18 | -import com.bsth.entity.mcy_forms.Shifday; | |
| 19 | -import com.bsth.entity.mcy_forms.Shiftuehiclemanth; | |
| 20 | -import com.bsth.entity.mcy_forms.Singledata; | |
| 21 | -import com.bsth.entity.mcy_forms.Turnoutrate; | |
| 22 | -import com.bsth.entity.mcy_forms.Vehicleloading; | |
| 23 | -import com.bsth.entity.mcy_forms.Waybillday; | |
| 24 | -import com.bsth.service.forms.FormsService; | |
| 25 | -import com.bsth.service.realcontrol.ScheduleRealInfoService; | |
| 26 | - | |
| 27 | -@RestController | |
| 28 | -@RequestMapping("mcy_forms") | |
| 29 | -public class MCY_FormsController { | |
| 30 | - | |
| 31 | - @Autowired | |
| 32 | - FormsService formsService; | |
| 33 | - | |
| 34 | - @Autowired | |
| 35 | - ScheduleRealInfoService scheduleRealInfoService; | |
| 36 | - | |
| 37 | - // 行车路单日报表 | |
| 38 | - | |
| 39 | - @RequestMapping(value = "/waybillday", method = RequestMethod.POST) | |
| 40 | - public List<Waybillday> waybillday(@RequestParam Map<String, Object> map) { | |
| 41 | - | |
| 42 | - // scheduleRealInfoService.findKMBC(jName, clZbh, lpName, date) | |
| 43 | - return formsService.waybillday(map); | |
| 44 | - } | |
| 45 | - | |
| 46 | - // 线路客流量报表 | |
| 47 | - | |
| 48 | - @RequestMapping(value = "/linepasswengerflow", method = RequestMethod.POST) | |
| 49 | - public List<Linepasswengerflow> linepasswengerflow(@RequestParam Map<String, Object> map) { | |
| 50 | - | |
| 51 | - return formsService.linepasswengerflow(map); | |
| 52 | - } | |
| 53 | - | |
| 54 | - // $$$$$${txt-542} | |
| 55 | - @RequestMapping(value = "/shiftuehiclemanth", method = RequestMethod.GET) | |
| 56 | - public List<Shiftuehiclemanth> shiftuehiclemanth(@RequestParam Map<String, Object> map) { | |
| 57 | - | |
| 58 | - return formsService.shiftuehiclemanth(map); | |
| 59 | - } | |
| 60 | - | |
| 61 | - // $$$$$${txt-542} | |
| 62 | - @RequestMapping(value = "/shiftuehiclemanth2", method = RequestMethod.GET) | |
| 63 | - public List<Shiftuehiclemanth> shiftuehiclemanth2(@RequestParam Map<String, Object> map) { | |
| 64 | - | |
| 65 | - return formsService.shiftuehiclemanth2(map); | |
| 66 | - } | |
| 67 | - | |
| 68 | - // $$$$$${txt-591} | |
| 69 | - @RequestMapping(value = "/shifday", method = RequestMethod.GET) | |
| 70 | - public List<Shifday> shifday(@RequestParam Map<String, Object> map) { | |
| 71 | - | |
| 72 | - return formsService.shifday(map); | |
| 73 | - } | |
| 74 | - | |
| 75 | - // $$$$$${txt-539} | |
| 76 | - @RequestMapping(value = "/changetochange", method = RequestMethod.GET) | |
| 77 | - public List<Changetochange> changetochange(@RequestParam Map<String, Object> map) { | |
| 78 | - | |
| 79 | - return formsService.changetochange(map); | |
| 80 | - } | |
| 81 | - | |
| 82 | - // 路单数据 | |
| 83 | - @RequestMapping(value = "/singledata", method = RequestMethod.GET) | |
| 84 | - public List<Singledata> singledata(@RequestParam Map<String, Object> map) { | |
| 85 | - | |
| 86 | - return formsService.singledata(map); | |
| 87 | - } | |
| 88 | - | |
| 89 | - // 路单数据 | |
| 90 | - @RequestMapping(value = "/singledata2", method = RequestMethod.GET) | |
| 91 | - public List<Singledata> singledata2(@RequestParam Map<String, Object> map) { | |
| 92 | - | |
| 93 | - return formsService.singledata2(map); | |
| 94 | - } | |
| 95 | - | |
| 96 | - // 路单数据 | |
| 97 | - @RequestMapping(value = "/singledatanew", method = RequestMethod.GET) | |
| 98 | - public List<Singledata> singledatanew(@RequestParam Map<String, Object> map) { | |
| 99 | - | |
| 100 | - return formsService.singledatanew(map); | |
| 101 | - } | |
| 102 | - | |
| 103 | - @RequestMapping(value = "/singledatatj", method = RequestMethod.GET) | |
| 104 | - public List<Singledata> singledatatj(@RequestParam Map<String, Object> map) { | |
| 105 | - | |
| 106 | - return formsService.singledatatj(map); | |
| 107 | - } | |
| 108 | - | |
| 109 | - | |
| 110 | - @RequestMapping(value = "/singledatatj2", method = RequestMethod.GET) | |
| 111 | - public List<Singledata> singledatatj2(@RequestParam Map<String, Object> map) { | |
| 112 | - | |
| 113 | - return formsService.singledatatj2(map); | |
| 114 | - } | |
| 115 | - // 车辆加注 | |
| 116 | - @RequestMapping(value = "/vehicleloading", method = RequestMethod.GET) | |
| 117 | - public List<Vehicleloading> vehicleloading(@RequestParam String line, @RequestParam String data) { | |
| 118 | - return formsService.vehicleloading(line, data); | |
| 119 | - } | |
| 120 | - | |
| 121 | - // $$$$$${txt-730} | |
| 122 | - @RequestMapping(value = "/operationservice", method = RequestMethod.GET) | |
| 123 | - public List<Operationservice> operationservice(@RequestParam Map<String, Object> map) { | |
| 124 | - | |
| 125 | - return formsService.operationservice(map); | |
| 126 | - } | |
| 127 | - | |
| 128 | - // $$$$$${txt-406} | |
| 129 | - @RequestMapping(value = "/turnoutrate", method = RequestMethod.POST) | |
| 130 | - public List<Map<String, Object>> turnoutrate(@RequestParam Map<String, Object> map) { | |
| 131 | - | |
| 132 | - return formsService.turnoutrate(map); | |
| 133 | - } | |
| 134 | - | |
| 135 | - // $$$$$${txt-741} | |
| 136 | - @RequestMapping(value = "/executionrate", method = RequestMethod.POST) | |
| 137 | - public List<Executionrate> executionrate(@RequestParam Map<String, Object> map) { | |
| 138 | - | |
| 139 | - return formsService.executionrate(map); | |
| 140 | - } | |
| 141 | - | |
| 142 | - // $$$$$${txt-534} | |
| 143 | - @RequestMapping(value = "/allline", method = RequestMethod.POST) | |
| 144 | - public List<Allline> allline(@RequestParam Map<String, Object> map) { | |
| 145 | - | |
| 146 | - return formsService.allline(map); | |
| 147 | - } | |
| 148 | - | |
| 149 | - // $$$$$${txt-534} | |
| 150 | - @RequestMapping(value = "/daily", method = RequestMethod.GET) | |
| 151 | - public List<Daily> daily(@RequestParam Map<String, Object> map) { | |
| 152 | - | |
| 153 | - return formsService.daily(map); | |
| 154 | - } | |
| 155 | - | |
| 156 | -} | |
| 1 | +package com.bsth.controller.forms; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 10 | +import org.springframework.web.bind.annotation.RestController; | |
| 11 | + | |
| 12 | +import com.bsth.entity.mcy_forms.Allline; | |
| 13 | +import com.bsth.entity.mcy_forms.Changetochange; | |
| 14 | +import com.bsth.entity.mcy_forms.Daily; | |
| 15 | +import com.bsth.entity.mcy_forms.Executionrate; | |
| 16 | +import com.bsth.entity.mcy_forms.Linepasswengerflow; | |
| 17 | +import com.bsth.entity.mcy_forms.Operationservice; | |
| 18 | +import com.bsth.entity.mcy_forms.Shifday; | |
| 19 | +import com.bsth.entity.mcy_forms.Shiftuehiclemanth; | |
| 20 | +import com.bsth.entity.mcy_forms.Singledata; | |
| 21 | +import com.bsth.entity.mcy_forms.Turnoutrate; | |
| 22 | +import com.bsth.entity.mcy_forms.Vehicleloading; | |
| 23 | +import com.bsth.entity.mcy_forms.Waybillday; | |
| 24 | +import com.bsth.service.forms.FormsService; | |
| 25 | +import com.bsth.service.realcontrol.ScheduleRealInfoService; | |
| 26 | + | |
| 27 | +@RestController | |
| 28 | +@RequestMapping("mcy_forms") | |
| 29 | +public class MCY_FormsController { | |
| 30 | + | |
| 31 | + @Autowired | |
| 32 | + FormsService formsService; | |
| 33 | + | |
| 34 | + @Autowired | |
| 35 | + ScheduleRealInfoService scheduleRealInfoService; | |
| 36 | + | |
| 37 | + // 行车路单日报表 | |
| 38 | + | |
| 39 | + @RequestMapping(value = "/waybillday", method = RequestMethod.POST) | |
| 40 | + public List<Waybillday> waybillday(@RequestParam Map<String, Object> map) { | |
| 41 | + | |
| 42 | + // scheduleRealInfoService.findKMBC(jName, clZbh, lpName, date) | |
| 43 | + return formsService.waybillday(map); | |
| 44 | + } | |
| 45 | + | |
| 46 | + // 线路客流量报表 | |
| 47 | + | |
| 48 | + @RequestMapping(value = "/linepasswengerflow", method = RequestMethod.POST) | |
| 49 | + public List<Linepasswengerflow> linepasswengerflow(@RequestParam Map<String, Object> map) { | |
| 50 | + | |
| 51 | + return formsService.linepasswengerflow(map); | |
| 52 | + } | |
| 53 | + | |
| 54 | + | |
| 55 | + @RequestMapping(value = "/shiftuehiclemanth", method = RequestMethod.GET) | |
| 56 | + public List<Shiftuehiclemanth> shiftuehiclemanth(@RequestParam Map<String, Object> map) { | |
| 57 | + | |
| 58 | + return formsService.shiftuehiclemanth(map); | |
| 59 | + } | |
| 60 | + | |
| 61 | + | |
| 62 | + @RequestMapping(value = "/shiftuehiclemanth2", method = RequestMethod.GET) | |
| 63 | + public List<Shiftuehiclemanth> shiftuehiclemanth2(@RequestParam Map<String, Object> map) { | |
| 64 | + | |
| 65 | + return formsService.shiftuehiclemanth2(map); | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 69 | + @RequestMapping(value = "/shifday", method = RequestMethod.GET) | |
| 70 | + public List<Shifday> shifday(@RequestParam Map<String, Object> map) { | |
| 71 | + | |
| 72 | + return formsService.shifday(map); | |
| 73 | + } | |
| 74 | + | |
| 75 | + | |
| 76 | + @RequestMapping(value = "/changetochange", method = RequestMethod.GET) | |
| 77 | + public List<Changetochange> changetochange(@RequestParam Map<String, Object> map) { | |
| 78 | + | |
| 79 | + return formsService.changetochange(map); | |
| 80 | + } | |
| 81 | + | |
| 82 | + // 路单数据 | |
| 83 | + @RequestMapping(value = "/singledata", method = RequestMethod.GET) | |
| 84 | + public List<Singledata> singledata(@RequestParam Map<String, Object> map) { | |
| 85 | + | |
| 86 | + return formsService.singledata(map); | |
| 87 | + } | |
| 88 | + | |
| 89 | + // 路单数据 | |
| 90 | + @RequestMapping(value = "/singledata2", method = RequestMethod.GET) | |
| 91 | + public List<Singledata> singledata2(@RequestParam Map<String, Object> map) { | |
| 92 | + | |
| 93 | + return formsService.singledata2(map); | |
| 94 | + } | |
| 95 | + | |
| 96 | + // 路单数据 | |
| 97 | + @RequestMapping(value = "/singledatanew", method = RequestMethod.GET) | |
| 98 | + public List<Singledata> singledatanew(@RequestParam Map<String, Object> map) { | |
| 99 | + | |
| 100 | + return formsService.singledatanew(map); | |
| 101 | + } | |
| 102 | + | |
| 103 | + @RequestMapping(value = "/singledatatj", method = RequestMethod.GET) | |
| 104 | + public List<Singledata> singledatatj(@RequestParam Map<String, Object> map) { | |
| 105 | + | |
| 106 | + return formsService.singledatatj(map); | |
| 107 | + } | |
| 108 | + | |
| 109 | + | |
| 110 | + @RequestMapping(value = "/singledatatj2", method = RequestMethod.GET) | |
| 111 | + public List<Singledata> singledatatj2(@RequestParam Map<String, Object> map) { | |
| 112 | + | |
| 113 | + return formsService.singledatatj2(map); | |
| 114 | + } | |
| 115 | + // 车辆加注 | |
| 116 | + @RequestMapping(value = "/vehicleloading", method = RequestMethod.GET) | |
| 117 | + public List<Vehicleloading> vehicleloading(@RequestParam String line, @RequestParam String data) { | |
| 118 | + return formsService.vehicleloading(line, data); | |
| 119 | + } | |
| 120 | + | |
| 121 | + | |
| 122 | + @RequestMapping(value = "/operationservice", method = RequestMethod.GET) | |
| 123 | + public List<Operationservice> operationservice(@RequestParam Map<String, Object> map) { | |
| 124 | + | |
| 125 | + return formsService.operationservice(map); | |
| 126 | + } | |
| 127 | + | |
| 128 | + | |
| 129 | + @RequestMapping(value = "/turnoutrate", method = RequestMethod.POST) | |
| 130 | + public List<Map<String, Object>> turnoutrate(@RequestParam Map<String, Object> map) { | |
| 131 | + | |
| 132 | + return formsService.turnoutrate(map); | |
| 133 | + } | |
| 134 | + | |
| 135 | + | |
| 136 | + @RequestMapping(value = "/executionrate", method = RequestMethod.POST) | |
| 137 | + public List<Executionrate> executionrate(@RequestParam Map<String, Object> map) { | |
| 138 | + | |
| 139 | + return formsService.executionrate(map); | |
| 140 | + } | |
| 141 | + | |
| 142 | + | |
| 143 | + @RequestMapping(value = "/allline", method = RequestMethod.POST) | |
| 144 | + public List<Allline> allline(@RequestParam Map<String, Object> map) { | |
| 145 | + | |
| 146 | + return formsService.allline(map); | |
| 147 | + } | |
| 148 | + | |
| 149 | + | |
| 150 | + @RequestMapping(value = "/daily", method = RequestMethod.GET) | |
| 151 | + public List<Daily> daily(@RequestParam Map<String, Object> map) { | |
| 152 | + | |
| 153 | + return formsService.daily(map); | |
| 154 | + } | |
| 155 | + | |
| 156 | +} | ... | ... |
src/main/java/com/bsth/controller/jdtest/JdTestController.java
| 1 | -package com.bsth.controller.jdtest; | |
| 2 | - | |
| 3 | -import java.text.SimpleDateFormat; | |
| 4 | -import java.util.ArrayList; | |
| 5 | -import java.util.HashMap; | |
| 6 | -import java.util.Iterator; | |
| 7 | -import java.util.List; | |
| 8 | -import java.util.Map; | |
| 9 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 11 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 12 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 13 | -import org.springframework.web.bind.annotation.RestController; | |
| 14 | -import com.bsth.controller.BaseController; | |
| 15 | -import com.bsth.data.BasicData; | |
| 16 | -import com.bsth.entity.oil.Ylb; | |
| 17 | -import com.bsth.entity.oil.Ylxxb; | |
| 18 | -import com.bsth.entity.sys.Dictionary; | |
| 19 | -import com.bsth.service.jdtest.JdtestService; | |
| 20 | -import com.bsth.service.oil.YlbService; | |
| 21 | -import com.bsth.service.sys.DictionaryService; | |
| 22 | -import com.bsth.util.Arith; | |
| 23 | -import com.bsth.util.ReportUtils; | |
| 24 | - | |
| 25 | -@RestController | |
| 26 | -@RequestMapping("jdtest") | |
| 27 | -public class JdTestController extends BaseController<Ylb, Integer>{ | |
| 28 | - @Autowired | |
| 29 | - YlbService ylbService; | |
| 30 | - @Autowired | |
| 31 | - DictionaryService dictionaryService; | |
| 32 | - @Autowired | |
| 33 | - JdtestService jdtestService; | |
| 34 | - | |
| 35 | - /* | |
| 36 | - * 油量平衡表导出 | |
| 37 | - */ | |
| 38 | - @RequestMapping(value = "/listExport",method = RequestMethod.POST) | |
| 39 | - public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){ | |
| 40 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 41 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 42 | - Map<String, Object> dMap=new HashMap<>(); | |
| 43 | - dMap.put("dGroup_eq", "oilType"); | |
| 44 | - Iterator<Dictionary> it= dictionaryService.list(dMap).iterator(); | |
| 45 | - while (it.hasNext()) { | |
| 46 | - Dictionary d=it.next(); | |
| 47 | - dMap.put(d.getdCode(), d.getdName()); | |
| 48 | - } | |
| 49 | - | |
| 50 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 51 | - ReportUtils ee = new ReportUtils(); | |
| 52 | - List<Ylb> ylb= ylbService.listYlb(map); | |
| 53 | -// (new CustomerSpecs<Ylb>(map)).iterator(); | |
| 54 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 55 | - for (Ylb y : ylb) { | |
| 56 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 57 | - m.put("rq", sdfMonth.format(y.getRq())); | |
| 58 | - m.put("gsname",y.getGsname() ); | |
| 59 | - m.put("fgsname", y.getFgsname()); | |
| 60 | - m.put("xlname", y.getXlname()==null?"":y.getXlname()); | |
| 61 | - m.put("nbbm", y.getNbbm()); | |
| 62 | - m.put("jsy", y.getJsy()); | |
| 63 | - m.put("name", y.getName()); | |
| 64 | - m.put("jzl", y.getJzl()<=0?"0":y.getJzl()); | |
| 65 | - m.put("czlc", "0"); | |
| 66 | - m.put("jzlc", "0"); | |
| 67 | - m.put("czyl", y.getCzyl()<=0?"0":y.getCzyl()); | |
| 68 | - m.put("jzyl", y.getJzyl()<=0?"0":y.getJzyl()); | |
| 69 | - m.put("yh", y.getYh()<=0?"0":y.getYh()); | |
| 70 | - String rylx=""; | |
| 71 | - if(y.getRylx()!=null){ | |
| 72 | - if(dMap.get(y.getRylx())==null){ | |
| 73 | - rylx=""; | |
| 74 | - }else{ | |
| 75 | - rylx=dMap.get(y.getRylx()).toString(); | |
| 76 | - } | |
| 77 | - } | |
| 78 | - m.put("rylx", rylx); | |
| 79 | - m.put("ns", y.getNs()==null?"0":y.getNs()); | |
| 80 | - String shyy ="$$$$$${txt-4226}"; | |
| 81 | - if(y.getShyy()!=null){ | |
| 82 | - shyy=y.getShyy(); | |
| 83 | - if(shyy.equals("1")){shyy="$$$$$${txt-2788}";} | |
| 84 | - else if(shyy.equals("2")){shyy="$$$$$${txt-2787}";} | |
| 85 | - else if(shyy.equals("3")){shyy="$$$$$${txt-2032}";} | |
| 86 | - else if(shyy.equals("4")){shyy="$$$$$${txt-2785}";} | |
| 87 | - else if(shyy.equals("5")){shyy="$$$$$${txt-3541}";} | |
| 88 | - else if(shyy.equals("6")){shyy="$$$$$${txt-3978}";} | |
| 89 | - else if(shyy.equals("7")){shyy="$$$$$${txt-3976}";} | |
| 90 | - else if(shyy.equals("8")){shyy="$$$$$${txt-3975}";} | |
| 91 | - else{shyy ="$$$$$${txt-4226}";} | |
| 92 | - } | |
| 93 | - m.put("shyy", shyy); | |
| 94 | - m.put("sh", y.getSh()<=0?"0":y.getSh()); | |
| 95 | - m.put("zlc", y.getZlc()<=0?"0":y.getZlc()); | |
| 96 | - m.put("bglyh", y.getBglyh()); | |
| 97 | - m.put("zyh", Arith.add(y.getSh(), y.getYh())); | |
| 98 | - resList.add(m); | |
| 99 | - } | |
| 100 | - try { | |
| 101 | - map.put("sheetName", map.get("rq")); | |
| 102 | - listI.add(resList.iterator()); | |
| 103 | - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 104 | - ee.excelReplace(listI, new Object[] { map }, path+"mould/list.xls", | |
| 105 | - path+"export/"+map.get("rq").toString()+ "$$$$$${txt-1596}.xls"); | |
| 106 | - } catch (Exception e) { | |
| 107 | - e.printStackTrace(); | |
| 108 | - } | |
| 109 | - | |
| 110 | - return resList; | |
| 111 | - | |
| 112 | - } | |
| 113 | - | |
| 114 | - /* | |
| 115 | - * 场外加油匹配当天线路数据 | |
| 116 | - */ | |
| 117 | - @RequestMapping(value = "/cwjyList",method = RequestMethod.GET) | |
| 118 | - public List<Ylxxb> cwjyList(@RequestParam Map<String, Object> map){ | |
| 119 | - List<Ylxxb> cwjyList=jdtestService.cwjyList(map); | |
| 120 | - return cwjyList; | |
| 121 | - } | |
| 122 | - | |
| 123 | - /* | |
| 124 | - * 油量路单报表 | |
| 125 | - */ | |
| 126 | - @RequestMapping(value="/daily",method = RequestMethod.GET) | |
| 127 | - public List<Map<String, Object>> daily(@RequestParam Map<String, Object> map){ | |
| 128 | - List<Map<String, Object>> list=jdtestService.daily(map); | |
| 129 | - | |
| 130 | - if(map.get("type").toString().equals("export")){ | |
| 131 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 132 | - ReportUtils ee = new ReportUtils(); | |
| 133 | - Map<String, Object> m=new HashMap<>(); | |
| 134 | - | |
| 135 | - try { | |
| 136 | - String lineName = map.get("lineName").toString(); | |
| 137 | - String date = map.get("date").toString(); | |
| 138 | - m.put("line", lineName); | |
| 139 | - m.put("date", date); | |
| 140 | - listI.add(list.iterator()); | |
| 141 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 142 | - ee.excelReplace(listI, new Object[] { m }, path + "mould/jd_daily.xls", | |
| 143 | - path + "export/" + date | |
| 144 | - + "-" + lineName + "-$$$$$${txt-1897}.xls"); | |
| 145 | - } catch (Exception e) { | |
| 146 | - e.printStackTrace(); | |
| 147 | - } | |
| 148 | - } | |
| 149 | - return list; | |
| 150 | - } | |
| 151 | - | |
| 152 | -} | |
| 1 | +package com.bsth.controller.jdtest; | |
| 2 | + | |
| 3 | +import java.text.SimpleDateFormat; | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.HashMap; | |
| 6 | +import java.util.Iterator; | |
| 7 | +import java.util.List; | |
| 8 | +import java.util.Map; | |
| 9 | + | |
| 10 | +import com.bsth.util.I18n; | |
| 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 com.bsth.controller.BaseController; | |
| 17 | +import com.bsth.data.BasicData; | |
| 18 | +import com.bsth.entity.oil.Ylb; | |
| 19 | +import com.bsth.entity.oil.Ylxxb; | |
| 20 | +import com.bsth.entity.sys.Dictionary; | |
| 21 | +import com.bsth.service.jdtest.JdtestService; | |
| 22 | +import com.bsth.service.oil.YlbService; | |
| 23 | +import com.bsth.service.sys.DictionaryService; | |
| 24 | +import com.bsth.util.Arith; | |
| 25 | +import com.bsth.util.ReportUtils; | |
| 26 | + | |
| 27 | +@RestController | |
| 28 | +@RequestMapping("jdtest") | |
| 29 | +public class JdTestController extends BaseController<Ylb, Integer>{ | |
| 30 | + @Autowired | |
| 31 | + YlbService ylbService; | |
| 32 | + @Autowired | |
| 33 | + DictionaryService dictionaryService; | |
| 34 | + @Autowired | |
| 35 | + JdtestService jdtestService; | |
| 36 | + | |
| 37 | + /* | |
| 38 | + * 油量平衡表导出 | |
| 39 | + */ | |
| 40 | + @RequestMapping(value = "/listExport",method = RequestMethod.POST) | |
| 41 | + public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){ | |
| 42 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 43 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 44 | + Map<String, Object> dMap=new HashMap<>(); | |
| 45 | + dMap.put("dGroup_eq", "oilType"); | |
| 46 | + Iterator<Dictionary> it= dictionaryService.list(dMap).iterator(); | |
| 47 | + while (it.hasNext()) { | |
| 48 | + Dictionary d=it.next(); | |
| 49 | + dMap.put(d.getdCode(), d.getdName()); | |
| 50 | + } | |
| 51 | + | |
| 52 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 53 | + ReportUtils ee = new ReportUtils(); | |
| 54 | + List<Ylb> ylb= ylbService.listYlb(map); | |
| 55 | +// (new CustomerSpecs<Ylb>(map)).iterator(); | |
| 56 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 57 | + for (Ylb y : ylb) { | |
| 58 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 59 | + m.put("rq", sdfMonth.format(y.getRq())); | |
| 60 | + m.put("gsname",y.getGsname() ); | |
| 61 | + m.put("fgsname", y.getFgsname()); | |
| 62 | + m.put("xlname", y.getXlname()==null?"":y.getXlname()); | |
| 63 | + m.put("nbbm", y.getNbbm()); | |
| 64 | + m.put("jsy", y.getJsy()); | |
| 65 | + m.put("name", y.getName()); | |
| 66 | + m.put("jzl", y.getJzl()<=0?"0":y.getJzl()); | |
| 67 | + m.put("czlc", "0"); | |
| 68 | + m.put("jzlc", "0"); | |
| 69 | + m.put("czyl", y.getCzyl()<=0?"0":y.getCzyl()); | |
| 70 | + m.put("jzyl", y.getJzyl()<=0?"0":y.getJzyl()); | |
| 71 | + m.put("yh", y.getYh()<=0?"0":y.getYh()); | |
| 72 | + String rylx=""; | |
| 73 | + if(y.getRylx()!=null){ | |
| 74 | + if(dMap.get(y.getRylx())==null){ | |
| 75 | + rylx=""; | |
| 76 | + }else{ | |
| 77 | + rylx=dMap.get(y.getRylx()).toString(); | |
| 78 | + } | |
| 79 | + } | |
| 80 | + m.put("rylx", rylx); | |
| 81 | + m.put("ns", y.getNs()==null?"0":y.getNs()); | |
| 82 | + String shyy = I18n.getInstance().getMessage("txt-4226"); | |
| 83 | + if(y.getShyy()!=null){ | |
| 84 | + shyy=y.getShyy(); | |
| 85 | + if(shyy.equals("1")){shyy=I18n.getInstance().getMessage("txt-2788");} | |
| 86 | + else if(shyy.equals("2")){shyy=I18n.getInstance().getMessage("txt-2787");} | |
| 87 | + else if(shyy.equals("3")){shyy=I18n.getInstance().getMessage("txt-2032");} | |
| 88 | + else if(shyy.equals("4")){shyy=I18n.getInstance().getMessage("txt-2785");} | |
| 89 | + else if(shyy.equals("5")){shyy=I18n.getInstance().getMessage("txt-3541");} | |
| 90 | + else if(shyy.equals("6")){shyy=I18n.getInstance().getMessage("txt-3978");} | |
| 91 | + else if(shyy.equals("7")){shyy=I18n.getInstance().getMessage("txt-3976");} | |
| 92 | + else if(shyy.equals("8")){shyy=I18n.getInstance().getMessage("txt-3975");} | |
| 93 | + else{shyy =I18n.getInstance().getMessage("txt-4226");} | |
| 94 | + } | |
| 95 | + m.put("shyy", shyy); | |
| 96 | + m.put("sh", y.getSh()<=0?"0":y.getSh()); | |
| 97 | + m.put("zlc", y.getZlc()<=0?"0":y.getZlc()); | |
| 98 | + m.put("bglyh", y.getBglyh()); | |
| 99 | + m.put("zyh", Arith.add(y.getSh(), y.getYh())); | |
| 100 | + resList.add(m); | |
| 101 | + } | |
| 102 | + try { | |
| 103 | + map.put("sheetName", map.get("rq")); | |
| 104 | + listI.add(resList.iterator()); | |
| 105 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 106 | + ee.excelReplace(listI, new Object[] { map }, path+"mould/list.xls", | |
| 107 | + path+"export/"+map.get("rq").toString()+ "" + I18n.getInstance().getMessage("txt-1596") + ".xls"); | |
| 108 | + } catch (Exception e) { | |
| 109 | + e.printStackTrace(); | |
| 110 | + } | |
| 111 | + | |
| 112 | + return resList; | |
| 113 | + | |
| 114 | + } | |
| 115 | + | |
| 116 | + /* | |
| 117 | + * 场外加油匹配当天线路数据 | |
| 118 | + */ | |
| 119 | + @RequestMapping(value = "/cwjyList",method = RequestMethod.GET) | |
| 120 | + public List<Ylxxb> cwjyList(@RequestParam Map<String, Object> map){ | |
| 121 | + List<Ylxxb> cwjyList=jdtestService.cwjyList(map); | |
| 122 | + return cwjyList; | |
| 123 | + } | |
| 124 | + | |
| 125 | + /* | |
| 126 | + * 油量路单报表 | |
| 127 | + */ | |
| 128 | + @RequestMapping(value="/daily",method = RequestMethod.GET) | |
| 129 | + public List<Map<String, Object>> daily(@RequestParam Map<String, Object> map){ | |
| 130 | + List<Map<String, Object>> list=jdtestService.daily(map); | |
| 131 | + | |
| 132 | + if(map.get("type").toString().equals("export")){ | |
| 133 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 134 | + ReportUtils ee = new ReportUtils(); | |
| 135 | + Map<String, Object> m=new HashMap<>(); | |
| 136 | + | |
| 137 | + try { | |
| 138 | + String lineName = map.get("lineName").toString(); | |
| 139 | + String date = map.get("date").toString(); | |
| 140 | + m.put("line", lineName); | |
| 141 | + m.put("date", date); | |
| 142 | + listI.add(list.iterator()); | |
| 143 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 144 | + ee.excelReplace(listI, new Object[] { m }, path + "mould/jd_daily.xls", | |
| 145 | + path + "export/" + date | |
| 146 | + + "-" + lineName + "-" + I18n.getInstance().getMessage("txt-1897") + ".xls"); | |
| 147 | + } catch (Exception e) { | |
| 148 | + e.printStackTrace(); | |
| 149 | + } | |
| 150 | + } | |
| 151 | + return list; | |
| 152 | + } | |
| 153 | + | |
| 154 | +} | ... | ... |
src/main/java/com/bsth/controller/oil/DlbController.java
| 1 | -package com.bsth.controller.oil; | |
| 2 | - | |
| 3 | -import java.text.SimpleDateFormat; | |
| 4 | -import java.util.ArrayList; | |
| 5 | -import java.util.Date; | |
| 6 | -import java.util.HashMap; | |
| 7 | -import java.util.Iterator; | |
| 8 | -import java.util.List; | |
| 9 | -import java.util.Map; | |
| 10 | - | |
| 11 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | -import org.springframework.data.domain.Page; | |
| 13 | -import org.springframework.data.domain.PageRequest; | |
| 14 | -import org.springframework.data.domain.Sort; | |
| 15 | -import org.springframework.data.domain.Sort.Direction; | |
| 16 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 17 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 18 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 19 | -import org.springframework.web.bind.annotation.RestController; | |
| 20 | -import com.bsth.controller.BaseController; | |
| 21 | -import com.bsth.entity.oil.Dlb; | |
| 22 | -import com.bsth.entity.oil.Ylb; | |
| 23 | -import com.bsth.service.oil.DlbService; | |
| 24 | -import com.bsth.util.Arith; | |
| 25 | -import com.bsth.util.ReportUtils; | |
| 26 | -import com.google.common.base.Splitter; | |
| 27 | - | |
| 28 | -@RestController | |
| 29 | -@RequestMapping("dlb") | |
| 30 | -public class DlbController extends BaseController<Dlb, Integer>{ | |
| 31 | - @Autowired | |
| 32 | - DlbService service; | |
| 33 | - /** | |
| 34 | - * | |
| 35 | - * @Title: list | |
| 36 | - * @Description: TODO(多条件分页查询) | |
| 37 | - * @param @param map 查询条件 | |
| 38 | - * @param @param page 页码 | |
| 39 | - * @param @param size 每页显示数量 | |
| 40 | - * @throws | |
| 41 | - */ | |
| 42 | - @RequestMapping(method = RequestMethod.GET) | |
| 43 | - public Page<Dlb> list(@RequestParam Map<String, Object> map, | |
| 44 | - @RequestParam(defaultValue = "0") int page, | |
| 45 | - @RequestParam(defaultValue = "10") int size, | |
| 46 | - @RequestParam(defaultValue = "id") String order, | |
| 47 | - @RequestParam(defaultValue = "DESC") String direction){ | |
| 48 | - | |
| 49 | - Direction d; | |
| 50 | -// map.put("xlbm_like", map.get("xlbm_like").toString().trim()); | |
| 51 | -// try { | |
| 52 | - String rq=map.get("rq").toString(); | |
| 53 | - if(!(rq=="")){ | |
| 54 | -// | |
| 55 | -// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 56 | -// Calendar calendar = new GregorianCalendar(); | |
| 57 | -// calendar.setTime(sdf.parse(rq)); | |
| 58 | -// calendar.add(calendar.DATE,1); | |
| 59 | -// Date date=calendar.getTime(); | |
| 60 | - map.put("rq_eq", rq); | |
| 61 | -// map.put("rq_lt", sdf.format(date)); | |
| 62 | -// System.out.println(rq); | |
| 63 | -// System.out.println(sdf.format(date)); | |
| 64 | - } | |
| 65 | -// } catch (ParseException e) { | |
| 66 | -// // TODO Auto-generated catch block | |
| 67 | -// e.printStackTrace(); | |
| 68 | -// } | |
| 69 | - if(null != direction && direction.equals("ASC")) | |
| 70 | - d = Direction.ASC; | |
| 71 | - else | |
| 72 | - d = Direction.DESC; | |
| 73 | - | |
| 74 | - // 允许多个字段排序,order可以写单个字段,也可以写多个字段 | |
| 75 | - // 多个字段格式:{col1},{col2},{col3},....,{coln} | |
| 76 | - // 每个字段的排序方向都是一致,这个以后再看要不要改 | |
| 77 | - List<String> list = Splitter.on(",").trimResults().splitToList(order); | |
| 78 | - return baseService.list(map, new PageRequest(page, size, new Sort(d, list))); | |
| 79 | - } | |
| 80 | - @RequestMapping(value = "/dlbList",method = RequestMethod.GET) | |
| 81 | - public List<Dlb> dlbList(@RequestParam Map<String, Object> map){ | |
| 82 | - List<Dlb> list=service.listDlb(map); | |
| 83 | - return list; | |
| 84 | - } | |
| 85 | - | |
| 86 | - | |
| 87 | - | |
| 88 | - @RequestMapping(value = "/obtain",method = RequestMethod.GET) | |
| 89 | - public Map<String, Object> obtain(@RequestParam Map<String, Object> map) throws Exception{ | |
| 90 | - Map<String, Object> list=new HashMap<String, Object>(); | |
| 91 | - try { | |
| 92 | - list = service.obtain(map); | |
| 93 | - } catch (Exception e) { | |
| 94 | - // TODO Auto-generated catch block | |
| 95 | - throw e; | |
| 96 | - } | |
| 97 | - return list; | |
| 98 | - } | |
| 99 | - | |
| 100 | - /** | |
| 101 | - * 保存电量 | |
| 102 | - * @param map | |
| 103 | - * @return | |
| 104 | - */ | |
| 105 | - @RequestMapping(value = "/sort",method = RequestMethod.GET) | |
| 106 | - public Map<String, Object> sort(@RequestParam Map<String, Object> map){ | |
| 107 | - Map<String, Object> list=service.sort(map); | |
| 108 | - return list; | |
| 109 | - } | |
| 110 | - | |
| 111 | - /** | |
| 112 | - * 核对电量(有加电没里程) | |
| 113 | - * @param map | |
| 114 | - * @return | |
| 115 | - */ | |
| 116 | - @RequestMapping(value = "/checkDl",method = RequestMethod.GET) | |
| 117 | - public Map<String, Object> checkDl(@RequestParam Map<String, Object> map){ | |
| 118 | - Map<String, Object> list=service.checkDl(map); | |
| 119 | - return list; | |
| 120 | - } | |
| 121 | - | |
| 122 | - @RequestMapping(value = "/sumYlb",method = RequestMethod.GET) | |
| 123 | - public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){ | |
| 124 | - Map<String, Object> list=service.sumYlb(map); | |
| 125 | - return list; | |
| 126 | - } | |
| 127 | - | |
| 128 | - @RequestMapping(value = "/saveDlbList",method = RequestMethod.POST) | |
| 129 | - public Map<String, Object> saveDlbList(@RequestParam Map<String, Object> map){ | |
| 130 | - Map<String, Object> list=new HashMap<String, Object>(); | |
| 131 | - try { | |
| 132 | - list = service.saveDlbList(map); | |
| 133 | - } catch (Exception e) { | |
| 134 | - // TODO Auto-generated catch block | |
| 135 | - e.printStackTrace(); | |
| 136 | - } | |
| 137 | - return list; | |
| 138 | - } | |
| 139 | - | |
| 140 | - | |
| 141 | - @RequestMapping(value = "/listExport",method = RequestMethod.POST) | |
| 142 | - public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){ | |
| 143 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 144 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 145 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 146 | - ReportUtils ee = new ReportUtils(); | |
| 147 | - List<Dlb> dlb= service.listDlb(map); | |
| 148 | -// (new CustomerSpecs<Ylb>(map)).iterator(); | |
| 149 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 150 | - for (Dlb y : dlb) { | |
| 151 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 152 | - m.put("rq", y.getRq()); | |
| 153 | - m.put("gsname",y.getGsname() ); | |
| 154 | - m.put("fgsname", y.getFgsname()); | |
| 155 | - if(y.getLinename()==null){ | |
| 156 | - m.put("xlname", y.getXlname()==null?"":y.getXlname()); | |
| 157 | - }else{ | |
| 158 | - m.put("xlname", y.getLinename()); | |
| 159 | - } | |
| 160 | - m.put("nbbm", y.getNbbm()); | |
| 161 | - m.put("jsy", y.getJsy()); | |
| 162 | - m.put("name", y.getName()); | |
| 163 | - m.put("cdl", y.getCdl()<=0?"0":y.getCdl()); | |
| 164 | - m.put("czcd", y.getCzcd()<=0?"0":y.getCzcd()+"%"); | |
| 165 | - m.put("jzcd", y.getJzcd()<=0?"0":y.getJzcd()+"%"); | |
| 166 | - m.put("czlc", y.getCzlc()<=0?"0":y.getCzlc()); | |
| 167 | - m.put("jzlc", y.getJzlc()<=0?"0":y.getJzlc()); | |
| 168 | - m.put("hd", y.getHd()<=0?"0":y.getHd()); | |
| 169 | - String shyy ="$$$$$${txt-4226}"; | |
| 170 | - if(y.getShyy()!=null){ | |
| 171 | - shyy=y.getShyy(); | |
| 172 | - if(shyy.equals("1")){shyy="$$$$$${txt-2538}";} | |
| 173 | - else if(shyy.equals("2")){shyy="$$$$$${txt-2530}";} | |
| 174 | - else if(shyy.equals("3")){shyy="$$$$$${txt-1945}";} | |
| 175 | - else if(shyy.equals("4")){shyy="$$$$$${txt-2529}";} | |
| 176 | - else if(shyy.equals("5")){shyy="$$$$$${txt-3541}";} | |
| 177 | - else if(shyy.equals("6")){shyy="$$$$$${txt-3978}";} | |
| 178 | - else if(shyy.equals("7")){shyy="$$$$$${txt-3976}";} | |
| 179 | - else if(shyy.equals("8")){shyy="$$$$$${txt-3975}";} | |
| 180 | - else{shyy ="$$$$$${txt-4226}";} | |
| 181 | - } | |
| 182 | - m.put("ns", y.getNs()<=0?"0":y.getNs()); | |
| 183 | - m.put("shyy", shyy); | |
| 184 | - m.put("sh", y.getSh()<=0?"0":y.getSh()); | |
| 185 | - m.put("zlc", y.getZlc()<=0?"0":y.getZlc()); | |
| 186 | - m.put("rdlx", ""); | |
| 187 | - m.put("bglyh", y.getBglyh()); | |
| 188 | - m.put("zdh", Arith.add(y.getSh(), y.getHd())); | |
| 189 | - resList.add(m); | |
| 190 | - } | |
| 191 | - try { | |
| 192 | - map.put("sheetName", map.get("rq")); | |
| 193 | - listI.add(resList.iterator()); | |
| 194 | - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 195 | - ee.excelReplace(listI, new Object[] { map }, path+"mould/listDl.xls", | |
| 196 | - path+"export/"+map.get("rq").toString()+ "$$$$$${txt-1655}.xls"); | |
| 197 | - } catch (Exception e) { | |
| 198 | - e.printStackTrace(); | |
| 199 | - } | |
| 200 | - | |
| 201 | - return resList; | |
| 202 | - | |
| 203 | - } | |
| 204 | - | |
| 205 | - | |
| 206 | - @RequestMapping(value = "/checkJsy",method = RequestMethod.GET) | |
| 207 | - public String checkJsy(@RequestParam Map<String, Object> map){ | |
| 208 | - String list=service.checkJsy(map); | |
| 209 | - return list; | |
| 210 | - } | |
| 211 | - | |
| 212 | - @RequestMapping(value = "/deleteIds", method = RequestMethod.POST) | |
| 213 | - public Map<String, Object> deleteIds(@RequestParam Map<String, Object> map) { | |
| 214 | - Map<String, Object> maps=new HashMap<String, Object>(); | |
| 215 | - try { | |
| 216 | - maps= service.deleteIds(map); | |
| 217 | - } catch (Exception e) { | |
| 218 | - // TODO Auto-generated catch block | |
| 219 | - e.printStackTrace(); | |
| 220 | - } | |
| 221 | - return maps; | |
| 222 | - } | |
| 223 | - | |
| 224 | - @RequestMapping(value = "/saveDlb",method = RequestMethod.POST) | |
| 225 | - public Map<String, Object> saveDlb(Dlb t){ | |
| 226 | -// SysUser user = SecurityUtils.getCurrentUser(); | |
| 227 | - t.setCreatetime(new Date()); | |
| 228 | -// Ylb t=new Ylb(); | |
| 229 | - return service.saveDlb(t); | |
| 230 | - } | |
| 231 | - | |
| 232 | - @RequestMapping(value = "/updateJsy",method = RequestMethod.GET) | |
| 233 | - public Map<String, Object> updateJsy(@RequestParam Map<String, Object> map){ | |
| 234 | - return service.update(map); | |
| 235 | - } | |
| 236 | -} | |
| 1 | +package com.bsth.controller.oil; | |
| 2 | + | |
| 3 | +import java.text.SimpleDateFormat; | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.Date; | |
| 6 | +import java.util.HashMap; | |
| 7 | +import java.util.Iterator; | |
| 8 | +import java.util.List; | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 11 | +import com.bsth.util.I18n; | |
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 13 | +import org.springframework.data.domain.Page; | |
| 14 | +import org.springframework.data.domain.PageRequest; | |
| 15 | +import org.springframework.data.domain.Sort; | |
| 16 | +import org.springframework.data.domain.Sort.Direction; | |
| 17 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 18 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 19 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 20 | +import org.springframework.web.bind.annotation.RestController; | |
| 21 | +import com.bsth.controller.BaseController; | |
| 22 | +import com.bsth.entity.oil.Dlb; | |
| 23 | +import com.bsth.entity.oil.Ylb; | |
| 24 | +import com.bsth.service.oil.DlbService; | |
| 25 | +import com.bsth.util.Arith; | |
| 26 | +import com.bsth.util.ReportUtils; | |
| 27 | +import com.google.common.base.Splitter; | |
| 28 | + | |
| 29 | +@RestController | |
| 30 | +@RequestMapping("dlb") | |
| 31 | +public class DlbController extends BaseController<Dlb, Integer>{ | |
| 32 | + @Autowired | |
| 33 | + DlbService service; | |
| 34 | + /** | |
| 35 | + * | |
| 36 | + * @Title: list | |
| 37 | + * @Description: TODO(多条件分页查询) | |
| 38 | + * @param @param map 查询条件 | |
| 39 | + * @param @param page 页码 | |
| 40 | + * @param @param size 每页显示数量 | |
| 41 | + * @throws | |
| 42 | + */ | |
| 43 | + @RequestMapping(method = RequestMethod.GET) | |
| 44 | + public Page<Dlb> list(@RequestParam Map<String, Object> map, | |
| 45 | + @RequestParam(defaultValue = "0") int page, | |
| 46 | + @RequestParam(defaultValue = "10") int size, | |
| 47 | + @RequestParam(defaultValue = "id") String order, | |
| 48 | + @RequestParam(defaultValue = "DESC") String direction){ | |
| 49 | + | |
| 50 | + Direction d; | |
| 51 | +// map.put("xlbm_like", map.get("xlbm_like").toString().trim()); | |
| 52 | +// try { | |
| 53 | + String rq=map.get("rq").toString(); | |
| 54 | + if(!(rq=="")){ | |
| 55 | +// | |
| 56 | +// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 57 | +// Calendar calendar = new GregorianCalendar(); | |
| 58 | +// calendar.setTime(sdf.parse(rq)); | |
| 59 | +// calendar.add(calendar.DATE,1); | |
| 60 | +// Date date=calendar.getTime(); | |
| 61 | + map.put("rq_eq", rq); | |
| 62 | +// map.put("rq_lt", sdf.format(date)); | |
| 63 | +// System.out.println(rq); | |
| 64 | +// System.out.println(sdf.format(date)); | |
| 65 | + } | |
| 66 | +// } catch (ParseException e) { | |
| 67 | +// // TODO Auto-generated catch block | |
| 68 | +// e.printStackTrace(); | |
| 69 | +// } | |
| 70 | + if(null != direction && direction.equals("ASC")) | |
| 71 | + d = Direction.ASC; | |
| 72 | + else | |
| 73 | + d = Direction.DESC; | |
| 74 | + | |
| 75 | + // 允许多个字段排序,order可以写单个字段,也可以写多个字段 | |
| 76 | + // 多个字段格式:{col1},{col2},{col3},....,{coln} | |
| 77 | + // 每个字段的排序方向都是一致,这个以后再看要不要改 | |
| 78 | + List<String> list = Splitter.on(",").trimResults().splitToList(order); | |
| 79 | + return baseService.list(map, new PageRequest(page, size, new Sort(d, list))); | |
| 80 | + } | |
| 81 | + @RequestMapping(value = "/dlbList",method = RequestMethod.GET) | |
| 82 | + public List<Dlb> dlbList(@RequestParam Map<String, Object> map){ | |
| 83 | + List<Dlb> list=service.listDlb(map); | |
| 84 | + return list; | |
| 85 | + } | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + @RequestMapping(value = "/obtain",method = RequestMethod.GET) | |
| 90 | + public Map<String, Object> obtain(@RequestParam Map<String, Object> map) throws Exception{ | |
| 91 | + Map<String, Object> list=new HashMap<String, Object>(); | |
| 92 | + try { | |
| 93 | + list = service.obtain(map); | |
| 94 | + } catch (Exception e) { | |
| 95 | + // TODO Auto-generated catch block | |
| 96 | + throw e; | |
| 97 | + } | |
| 98 | + return list; | |
| 99 | + } | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * 保存电量 | |
| 103 | + * @param map | |
| 104 | + * @return | |
| 105 | + */ | |
| 106 | + @RequestMapping(value = "/sort",method = RequestMethod.GET) | |
| 107 | + public Map<String, Object> sort(@RequestParam Map<String, Object> map){ | |
| 108 | + Map<String, Object> list=service.sort(map); | |
| 109 | + return list; | |
| 110 | + } | |
| 111 | + | |
| 112 | + /** | |
| 113 | + * 核对电量(有加电没里程) | |
| 114 | + * @param map | |
| 115 | + * @return | |
| 116 | + */ | |
| 117 | + @RequestMapping(value = "/checkDl",method = RequestMethod.GET) | |
| 118 | + public Map<String, Object> checkDl(@RequestParam Map<String, Object> map){ | |
| 119 | + Map<String, Object> list=service.checkDl(map); | |
| 120 | + return list; | |
| 121 | + } | |
| 122 | + | |
| 123 | + @RequestMapping(value = "/sumYlb",method = RequestMethod.GET) | |
| 124 | + public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){ | |
| 125 | + Map<String, Object> list=service.sumYlb(map); | |
| 126 | + return list; | |
| 127 | + } | |
| 128 | + | |
| 129 | + @RequestMapping(value = "/saveDlbList",method = RequestMethod.POST) | |
| 130 | + public Map<String, Object> saveDlbList(@RequestParam Map<String, Object> map){ | |
| 131 | + Map<String, Object> list=new HashMap<String, Object>(); | |
| 132 | + try { | |
| 133 | + list = service.saveDlbList(map); | |
| 134 | + } catch (Exception e) { | |
| 135 | + // TODO Auto-generated catch block | |
| 136 | + e.printStackTrace(); | |
| 137 | + } | |
| 138 | + return list; | |
| 139 | + } | |
| 140 | + | |
| 141 | + | |
| 142 | + @RequestMapping(value = "/listExport",method = RequestMethod.POST) | |
| 143 | + public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){ | |
| 144 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 145 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 146 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 147 | + ReportUtils ee = new ReportUtils(); | |
| 148 | + List<Dlb> dlb= service.listDlb(map); | |
| 149 | +// (new CustomerSpecs<Ylb>(map)).iterator(); | |
| 150 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 151 | + for (Dlb y : dlb) { | |
| 152 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 153 | + m.put("rq", y.getRq()); | |
| 154 | + m.put("gsname",y.getGsname() ); | |
| 155 | + m.put("fgsname", y.getFgsname()); | |
| 156 | + if(y.getLinename()==null){ | |
| 157 | + m.put("xlname", y.getXlname()==null?"":y.getXlname()); | |
| 158 | + }else{ | |
| 159 | + m.put("xlname", y.getLinename()); | |
| 160 | + } | |
| 161 | + m.put("nbbm", y.getNbbm()); | |
| 162 | + m.put("jsy", y.getJsy()); | |
| 163 | + m.put("name", y.getName()); | |
| 164 | + m.put("cdl", y.getCdl()<=0?"0":y.getCdl()); | |
| 165 | + m.put("czcd", y.getCzcd()<=0?"0":y.getCzcd()+"%"); | |
| 166 | + m.put("jzcd", y.getJzcd()<=0?"0":y.getJzcd()+"%"); | |
| 167 | + m.put("czlc", y.getCzlc()<=0?"0":y.getCzlc()); | |
| 168 | + m.put("jzlc", y.getJzlc()<=0?"0":y.getJzlc()); | |
| 169 | + m.put("hd", y.getHd()<=0?"0":y.getHd()); | |
| 170 | + String shyy =I18n.getInstance().getMessage("txt-4226"); | |
| 171 | + if(y.getShyy()!=null){ | |
| 172 | + shyy=y.getShyy(); | |
| 173 | + if(shyy.equals("1")){shyy= I18n.getInstance().getMessage("txt-2538");} | |
| 174 | + else if(shyy.equals("2")){shyy=I18n.getInstance().getMessage("txt-2530");} | |
| 175 | + else if(shyy.equals("3")){shyy=I18n.getInstance().getMessage("txt-1945");} | |
| 176 | + else if(shyy.equals("4")){shyy=I18n.getInstance().getMessage("txt-2529");} | |
| 177 | + else if(shyy.equals("5")){shyy=I18n.getInstance().getMessage("txt-3541");} | |
| 178 | + else if(shyy.equals("6")){shyy=I18n.getInstance().getMessage("txt-3978");} | |
| 179 | + else if(shyy.equals("7")){shyy=I18n.getInstance().getMessage("txt-3976");} | |
| 180 | + else if(shyy.equals("8")){shyy=I18n.getInstance().getMessage("txt-3975");} | |
| 181 | + else{shyy =I18n.getInstance().getMessage("txt-4226");} | |
| 182 | + } | |
| 183 | + m.put("ns", y.getNs()<=0?"0":y.getNs()); | |
| 184 | + m.put("shyy", shyy); | |
| 185 | + m.put("sh", y.getSh()<=0?"0":y.getSh()); | |
| 186 | + m.put("zlc", y.getZlc()<=0?"0":y.getZlc()); | |
| 187 | + m.put("rdlx", ""); | |
| 188 | + m.put("bglyh", y.getBglyh()); | |
| 189 | + m.put("zdh", Arith.add(y.getSh(), y.getHd())); | |
| 190 | + resList.add(m); | |
| 191 | + } | |
| 192 | + try { | |
| 193 | + map.put("sheetName", map.get("rq")); | |
| 194 | + listI.add(resList.iterator()); | |
| 195 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 196 | + ee.excelReplace(listI, new Object[] { map }, path+"mould/listDl.xls", | |
| 197 | + path+"export/"+map.get("rq").toString()+ "" + I18n.getInstance().getMessage("txt-1655") + ".xls"); | |
| 198 | + } catch (Exception e) { | |
| 199 | + e.printStackTrace(); | |
| 200 | + } | |
| 201 | + | |
| 202 | + return resList; | |
| 203 | + | |
| 204 | + } | |
| 205 | + | |
| 206 | + | |
| 207 | + @RequestMapping(value = "/checkJsy",method = RequestMethod.GET) | |
| 208 | + public String checkJsy(@RequestParam Map<String, Object> map){ | |
| 209 | + String list=service.checkJsy(map); | |
| 210 | + return list; | |
| 211 | + } | |
| 212 | + | |
| 213 | + @RequestMapping(value = "/deleteIds", method = RequestMethod.POST) | |
| 214 | + public Map<String, Object> deleteIds(@RequestParam Map<String, Object> map) { | |
| 215 | + Map<String, Object> maps=new HashMap<String, Object>(); | |
| 216 | + try { | |
| 217 | + maps= service.deleteIds(map); | |
| 218 | + } catch (Exception e) { | |
| 219 | + // TODO Auto-generated catch block | |
| 220 | + e.printStackTrace(); | |
| 221 | + } | |
| 222 | + return maps; | |
| 223 | + } | |
| 224 | + | |
| 225 | + @RequestMapping(value = "/saveDlb",method = RequestMethod.POST) | |
| 226 | + public Map<String, Object> saveDlb(Dlb t){ | |
| 227 | +// SysUser user = SecurityUtils.getCurrentUser(); | |
| 228 | + t.setCreatetime(new Date()); | |
| 229 | +// Ylb t=new Ylb(); | |
| 230 | + return service.saveDlb(t); | |
| 231 | + } | |
| 232 | + | |
| 233 | + @RequestMapping(value = "/updateJsy",method = RequestMethod.GET) | |
| 234 | + public Map<String, Object> updateJsy(@RequestParam Map<String, Object> map){ | |
| 235 | + return service.update(map); | |
| 236 | + } | |
| 237 | +} | ... | ... |
src/main/java/com/bsth/controller/oil/LsylbController.java
| 1 | -package com.bsth.controller.oil; | |
| 2 | - | |
| 3 | -import java.text.SimpleDateFormat; | |
| 4 | -import java.util.ArrayList; | |
| 5 | -import java.util.HashMap; | |
| 6 | -import java.util.Iterator; | |
| 7 | -import java.util.List; | |
| 8 | -import java.util.Map; | |
| 9 | - | |
| 10 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 12 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 13 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 14 | -import org.springframework.web.bind.annotation.RestController; | |
| 15 | - | |
| 16 | -import com.bsth.controller.BaseController; | |
| 17 | -import com.bsth.entity.oil.Lsylb; | |
| 18 | -import com.bsth.entity.oil.Ylb; | |
| 19 | -import com.bsth.service.oil.LsylbService; | |
| 20 | -import com.bsth.util.Arith; | |
| 21 | -import com.bsth.util.ReportUtils; | |
| 22 | - | |
| 23 | -@RestController | |
| 24 | -@RequestMapping("lsylb") | |
| 25 | -public class LsylbController extends BaseController<Ylb, Integer>{ | |
| 26 | - @Autowired | |
| 27 | - LsylbService lsylbService; | |
| 28 | - | |
| 29 | - @RequestMapping(value = "/lsylbList",method = RequestMethod.GET) | |
| 30 | - public List<Lsylb> lsylbList(@RequestParam Map<String, Object> map){ | |
| 31 | - List<Lsylb> ylbList=lsylbService.listYlb(map); | |
| 32 | - return ylbList; | |
| 33 | - } | |
| 34 | - | |
| 35 | - @RequestMapping(value = "/sumLsylb",method = RequestMethod.GET) | |
| 36 | - public Map<String, Object> sumLsylb(@RequestParam Map<String, Object> map){ | |
| 37 | - Map<String, Object> list=lsylbService.sumYlb(map); | |
| 38 | - return list; | |
| 39 | - } | |
| 40 | - | |
| 41 | - @RequestMapping(value = "/listExport",method = RequestMethod.POST) | |
| 42 | - public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){ | |
| 43 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 44 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 45 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 46 | - ReportUtils ee = new ReportUtils(); | |
| 47 | - List<Lsylb> lsylb= lsylbService.listYlb(map); | |
| 48 | - String nylx=map.get("nylx").toString(); | |
| 49 | -// (new CustomerSpecs<Ylb>(map)).iterator(); | |
| 50 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 51 | - for (Lsylb y : lsylb) { | |
| 52 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 53 | - m.put("rq", sdfMonth.format(y.getRq())); | |
| 54 | - m.put("gsname",y.getGsname() ); | |
| 55 | - m.put("fgsname", y.getFgsname()); | |
| 56 | - m.put("xlname", y.getXlname()==null?"":y.getXlname()); | |
| 57 | - m.put("nbbm", y.getNbbm()); | |
| 58 | - m.put("jsy", y.getJsy()); | |
| 59 | - m.put("name", y.getName()); | |
| 60 | - m.put("czlc", "0"); | |
| 61 | - m.put("jzlc", "0"); | |
| 62 | - m.put("sh", y.getSh()==null?"0":y.getSh()); | |
| 63 | - | |
| 64 | - String shyy ="$$$$$${txt-4226}"; | |
| 65 | - | |
| 66 | - if(nylx.equals("0")){ | |
| 67 | - m.put("jzl", y.getJzl()==null?"0":y.getJzl()); | |
| 68 | - m.put("czyl", y.getCzyl()==null?"0":y.getCzyl()); | |
| 69 | - m.put("jzyl", y.getJzyl()==null?"0":y.getJzyl()); | |
| 70 | - m.put("yh", y.getYh()==null?"0":y.getYh()); | |
| 71 | - | |
| 72 | - if(y.getShyy()!=null){ | |
| 73 | - shyy=y.getShyy(); | |
| 74 | - if(shyy.equals("1")){shyy="$$$$$${txt-2788}";} | |
| 75 | - else if(shyy.equals("2")){shyy="$$$$$${txt-2787}";} | |
| 76 | - else if(shyy.equals("3")){shyy="$$$$$${txt-2032}";} | |
| 77 | - else if(shyy.equals("4")){shyy="$$$$$${txt-2785}";} | |
| 78 | - else if(shyy.equals("5")){shyy="$$$$$${txt-3541}";} | |
| 79 | - else if(shyy.equals("6")){shyy="$$$$$${txt-3978}";} | |
| 80 | - else if(shyy.equals("7")){shyy="$$$$$${txt-3976}";} | |
| 81 | - else if(shyy.equals("8")){shyy="$$$$$${txt-3975}";} | |
| 82 | - else{shyy ="$$$$$${txt-4226}";} | |
| 83 | - } | |
| 84 | - m.put("zyh", Arith.add(m.get("sh"), m.get("yh"))); | |
| 85 | - | |
| 86 | - String rylx=""; | |
| 87 | - if(y.getRylx()!=null){ | |
| 88 | - if(y.getRylx().equals("0")){rylx="0号柴油";} | |
| 89 | - if(y.getRylx().equals("1")){rylx="负10号柴油";} | |
| 90 | - } | |
| 91 | - m.put("rylx", rylx); | |
| 92 | - }else{ | |
| 93 | - m.put("cdl", y.getJzl()==null?"0":y.getJzl()); | |
| 94 | - m.put("czcd", y.getCzyl()==null?"0":y.getCzyl()); | |
| 95 | - m.put("jzcd", y.getJzyl()==null?"0":y.getJzyl()); | |
| 96 | - m.put("hd", y.getYh()==null?"0":y.getYh()); | |
| 97 | - if(y.getShyy()!=null){ | |
| 98 | - shyy=y.getShyy(); | |
| 99 | - if(shyy.equals("1")){shyy="$$$$$${txt-2538}";} | |
| 100 | - else if(shyy.equals("2")){shyy="$$$$$${txt-2530}";} | |
| 101 | - else if(shyy.equals("3")){shyy="$$$$$${txt-1945}";} | |
| 102 | - else if(shyy.equals("4")){shyy="$$$$$${txt-2529}";} | |
| 103 | - else if(shyy.equals("5")){shyy="$$$$$${txt-3541}";} | |
| 104 | - else if(shyy.equals("6")){shyy="$$$$$${txt-3978}";} | |
| 105 | - else if(shyy.equals("7")){shyy="$$$$$${txt-3976}";} | |
| 106 | - else if(shyy.equals("8")){shyy="$$$$$${txt-3975}";} | |
| 107 | - else{shyy ="$$$$$${txt-4226}";} | |
| 108 | - } | |
| 109 | - m.put("zyh", Arith.add(m.get("sh"), m.get("hd"))); | |
| 110 | - m.put("rdlx", ""); | |
| 111 | - | |
| 112 | - } | |
| 113 | - m.put("shyy", shyy); | |
| 114 | - m.put("ns", y.getNs()==null?"0":y.getNs()); | |
| 115 | - m.put("zlc", y.getZlc()==null?"0":y.getZlc()); | |
| 116 | - m.put("bglyh", y.getBglyh()); | |
| 117 | - resList.add(m); | |
| 118 | - } | |
| 119 | - try { | |
| 120 | - map.put("sheetName", map.get("rq")); | |
| 121 | - listI.add(resList.iterator()); | |
| 122 | - String xls=""; | |
| 123 | - String name=""; | |
| 124 | - | |
| 125 | - if(nylx.equals("0")){ | |
| 126 | - xls="list.xls"; | |
| 127 | - name="$$$$$${txt-1596}.xls"; | |
| 128 | - }else{ | |
| 129 | - xls="listDl.xls"; | |
| 130 | - name="$$$$$${txt-1655}.xls"; | |
| 131 | - } | |
| 132 | - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 133 | - ee.excelReplace(listI, new Object[] { map }, path+"mould/"+xls, | |
| 134 | - path+"export/"+map.get("rq").toString()+ name); | |
| 135 | - } catch (Exception e) { | |
| 136 | - e.printStackTrace(); | |
| 137 | - } | |
| 138 | - | |
| 139 | - return resList; | |
| 140 | - | |
| 141 | - } | |
| 142 | -} | |
| 1 | +package com.bsth.controller.oil; | |
| 2 | + | |
| 3 | +import java.text.SimpleDateFormat; | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.HashMap; | |
| 6 | +import java.util.Iterator; | |
| 7 | +import java.util.List; | |
| 8 | +import java.util.Map; | |
| 9 | + | |
| 10 | +import com.bsth.util.I18n; | |
| 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 | + | |
| 17 | +import com.bsth.controller.BaseController; | |
| 18 | +import com.bsth.entity.oil.Lsylb; | |
| 19 | +import com.bsth.entity.oil.Ylb; | |
| 20 | +import com.bsth.service.oil.LsylbService; | |
| 21 | +import com.bsth.util.Arith; | |
| 22 | +import com.bsth.util.ReportUtils; | |
| 23 | + | |
| 24 | +@RestController | |
| 25 | +@RequestMapping("lsylb") | |
| 26 | +public class LsylbController extends BaseController<Ylb, Integer>{ | |
| 27 | + @Autowired | |
| 28 | + LsylbService lsylbService; | |
| 29 | + | |
| 30 | + @RequestMapping(value = "/lsylbList",method = RequestMethod.GET) | |
| 31 | + public List<Lsylb> lsylbList(@RequestParam Map<String, Object> map){ | |
| 32 | + List<Lsylb> ylbList=lsylbService.listYlb(map); | |
| 33 | + return ylbList; | |
| 34 | + } | |
| 35 | + | |
| 36 | + @RequestMapping(value = "/sumLsylb",method = RequestMethod.GET) | |
| 37 | + public Map<String, Object> sumLsylb(@RequestParam Map<String, Object> map){ | |
| 38 | + Map<String, Object> list=lsylbService.sumYlb(map); | |
| 39 | + return list; | |
| 40 | + } | |
| 41 | + | |
| 42 | + @RequestMapping(value = "/listExport",method = RequestMethod.POST) | |
| 43 | + public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){ | |
| 44 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 45 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 46 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 47 | + ReportUtils ee = new ReportUtils(); | |
| 48 | + List<Lsylb> lsylb= lsylbService.listYlb(map); | |
| 49 | + String nylx=map.get("nylx").toString(); | |
| 50 | +// (new CustomerSpecs<Ylb>(map)).iterator(); | |
| 51 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 52 | + for (Lsylb y : lsylb) { | |
| 53 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 54 | + m.put("rq", sdfMonth.format(y.getRq())); | |
| 55 | + m.put("gsname",y.getGsname() ); | |
| 56 | + m.put("fgsname", y.getFgsname()); | |
| 57 | + m.put("xlname", y.getXlname()==null?"":y.getXlname()); | |
| 58 | + m.put("nbbm", y.getNbbm()); | |
| 59 | + m.put("jsy", y.getJsy()); | |
| 60 | + m.put("name", y.getName()); | |
| 61 | + m.put("czlc", "0"); | |
| 62 | + m.put("jzlc", "0"); | |
| 63 | + m.put("sh", y.getSh()==null?"0":y.getSh()); | |
| 64 | + | |
| 65 | + String shyy =I18n.getInstance().getMessage("txt-4226"); | |
| 66 | + | |
| 67 | + if(nylx.equals("0")){ | |
| 68 | + m.put("jzl", y.getJzl()==null?"0":y.getJzl()); | |
| 69 | + m.put("czyl", y.getCzyl()==null?"0":y.getCzyl()); | |
| 70 | + m.put("jzyl", y.getJzyl()==null?"0":y.getJzyl()); | |
| 71 | + m.put("yh", y.getYh()==null?"0":y.getYh()); | |
| 72 | + | |
| 73 | + if(y.getShyy()!=null){ | |
| 74 | + shyy=y.getShyy(); | |
| 75 | + if(shyy.equals("1")){shyy= I18n.getInstance().getMessage("txt-2788");} | |
| 76 | + else if(shyy.equals("2")){shyy=I18n.getInstance().getMessage("txt-2787");} | |
| 77 | + else if(shyy.equals("3")){shyy=I18n.getInstance().getMessage("txt-2032");} | |
| 78 | + else if(shyy.equals("4")){shyy=I18n.getInstance().getMessage("txt-2785");} | |
| 79 | + else if(shyy.equals("5")){shyy=I18n.getInstance().getMessage("txt-3541");} | |
| 80 | + else if(shyy.equals("6")){shyy=I18n.getInstance().getMessage("txt-3978");} | |
| 81 | + else if(shyy.equals("7")){shyy=I18n.getInstance().getMessage("txt-3976");} | |
| 82 | + else if(shyy.equals("8")){shyy=I18n.getInstance().getMessage("txt-3975");} | |
| 83 | + else{shyy =I18n.getInstance().getMessage("txt-4226");} | |
| 84 | + } | |
| 85 | + m.put("zyh", Arith.add(m.get("sh"), m.get("yh"))); | |
| 86 | + | |
| 87 | + String rylx=""; | |
| 88 | + if(y.getRylx()!=null){ | |
| 89 | + if(y.getRylx().equals("0")){rylx="0号柴油";} | |
| 90 | + if(y.getRylx().equals("1")){rylx="负10号柴油";} | |
| 91 | + } | |
| 92 | + m.put("rylx", rylx); | |
| 93 | + }else{ | |
| 94 | + m.put("cdl", y.getJzl()==null?"0":y.getJzl()); | |
| 95 | + m.put("czcd", y.getCzyl()==null?"0":y.getCzyl()); | |
| 96 | + m.put("jzcd", y.getJzyl()==null?"0":y.getJzyl()); | |
| 97 | + m.put("hd", y.getYh()==null?"0":y.getYh()); | |
| 98 | + if(y.getShyy()!=null){ | |
| 99 | + shyy=y.getShyy(); | |
| 100 | + if(shyy.equals("1")){shyy=I18n.getInstance().getMessage("txt-2538");} | |
| 101 | + else if(shyy.equals("2")){shyy=I18n.getInstance().getMessage("txt-2530");} | |
| 102 | + else if(shyy.equals("3")){shyy=I18n.getInstance().getMessage("txt-1945");} | |
| 103 | + else if(shyy.equals("4")){shyy=I18n.getInstance().getMessage("txt-2529");} | |
| 104 | + else if(shyy.equals("5")){shyy=I18n.getInstance().getMessage("txt-3541");} | |
| 105 | + else if(shyy.equals("6")){shyy=I18n.getInstance().getMessage("txt-3978");} | |
| 106 | + else if(shyy.equals("7")){shyy=I18n.getInstance().getMessage("txt-3976");} | |
| 107 | + else if(shyy.equals("8")){shyy=I18n.getInstance().getMessage("txt-3975");} | |
| 108 | + else{shyy =I18n.getInstance().getMessage("txt-4226");} | |
| 109 | + } | |
| 110 | + m.put("zyh", Arith.add(m.get("sh"), m.get("hd"))); | |
| 111 | + m.put("rdlx", ""); | |
| 112 | + | |
| 113 | + } | |
| 114 | + m.put("shyy", shyy); | |
| 115 | + m.put("ns", y.getNs()==null?"0":y.getNs()); | |
| 116 | + m.put("zlc", y.getZlc()==null?"0":y.getZlc()); | |
| 117 | + m.put("bglyh", y.getBglyh()); | |
| 118 | + resList.add(m); | |
| 119 | + } | |
| 120 | + try { | |
| 121 | + map.put("sheetName", map.get("rq")); | |
| 122 | + listI.add(resList.iterator()); | |
| 123 | + String xls=""; | |
| 124 | + String name=""; | |
| 125 | + | |
| 126 | + if(nylx.equals("0")){ | |
| 127 | + xls="list.xls"; | |
| 128 | + name="" + I18n.getInstance().getMessage("txt-1596") + ".xls"; | |
| 129 | + }else{ | |
| 130 | + xls="listDl.xls"; | |
| 131 | + name="" + I18n.getInstance().getMessage("txt-1655") + ".xls"; | |
| 132 | + } | |
| 133 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 134 | + ee.excelReplace(listI, new Object[] { map }, path+"mould/"+xls, | |
| 135 | + path+"export/"+map.get("rq").toString()+ name); | |
| 136 | + } catch (Exception e) { | |
| 137 | + e.printStackTrace(); | |
| 138 | + } | |
| 139 | + | |
| 140 | + return resList; | |
| 141 | + | |
| 142 | + } | |
| 143 | +} | ... | ... |
src/main/java/com/bsth/controller/oil/QlbController.java
| 1 | -package com.bsth.controller.oil; | |
| 2 | - | |
| 3 | -import java.text.SimpleDateFormat; | |
| 4 | -import java.util.ArrayList; | |
| 5 | -import java.util.Date; | |
| 6 | -import java.util.HashMap; | |
| 7 | -import java.util.Iterator; | |
| 8 | -import java.util.List; | |
| 9 | -import java.util.Map; | |
| 10 | - | |
| 11 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | -import org.springframework.data.domain.Page; | |
| 13 | -import org.springframework.data.domain.PageRequest; | |
| 14 | -import org.springframework.data.domain.Sort; | |
| 15 | -import org.springframework.data.domain.Sort.Direction; | |
| 16 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 17 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 18 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 19 | -import org.springframework.web.bind.annotation.RestController; | |
| 20 | -import com.bsth.controller.BaseController; | |
| 21 | -import com.bsth.entity.oil.Qlb; | |
| 22 | -import com.bsth.service.oil.QlbService; | |
| 23 | -import com.bsth.util.Arith; | |
| 24 | -import com.bsth.util.ReportUtils; | |
| 25 | -import com.google.common.base.Splitter; | |
| 26 | - | |
| 27 | -@RestController | |
| 28 | -@RequestMapping("qlb") | |
| 29 | -public class QlbController extends BaseController<Qlb, Integer>{ | |
| 30 | - @Autowired | |
| 31 | - QlbService service; | |
| 32 | - /** | |
| 33 | - * | |
| 34 | - * @Title: list | |
| 35 | - * @Description: TODO(多条件分页查询) | |
| 36 | - * @param @param map 查询条件 | |
| 37 | - * @param @param page 页码 | |
| 38 | - * @param @param size 每页显示数量 | |
| 39 | - * @throws | |
| 40 | - */ | |
| 41 | - @RequestMapping(method = RequestMethod.GET) | |
| 42 | - public Page<Qlb> list(@RequestParam Map<String, Object> map, | |
| 43 | - @RequestParam(defaultValue = "0") int page, | |
| 44 | - @RequestParam(defaultValue = "10") int size, | |
| 45 | - @RequestParam(defaultValue = "id") String order, | |
| 46 | - @RequestParam(defaultValue = "DESC") String direction){ | |
| 47 | - | |
| 48 | - Direction d; | |
| 49 | -// map.put("xlbm_like", map.get("xlbm_like").toString().trim()); | |
| 50 | -// try { | |
| 51 | - String rq=map.get("rq").toString(); | |
| 52 | - if(!(rq=="")){ | |
| 53 | -// | |
| 54 | -// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 55 | -// Calendar calendar = new GregorianCalendar(); | |
| 56 | -// calendar.setTime(sdf.parse(rq)); | |
| 57 | -// calendar.add(calendar.DATE,1); | |
| 58 | -// Date date=calendar.getTime(); | |
| 59 | - map.put("rq_eq", rq); | |
| 60 | -// map.put("rq_lt", sdf.format(date)); | |
| 61 | -// System.out.println(rq); | |
| 62 | -// System.out.println(sdf.format(date)); | |
| 63 | - } | |
| 64 | -// } catch (ParseException e) { | |
| 65 | -// // TODO Auto-generated catch block | |
| 66 | -// e.printStackTrace(); | |
| 67 | -// } | |
| 68 | - if(null != direction && direction.equals("ASC")) | |
| 69 | - d = Direction.ASC; | |
| 70 | - else | |
| 71 | - d = Direction.DESC; | |
| 72 | - | |
| 73 | - // 允许多个字段排序,order可以写单个字段,也可以写多个字段 | |
| 74 | - // 多个字段格式:{col1},{col2},{col3},....,{coln} | |
| 75 | - // 每个字段的排序方向都是一致,这个以后再看要不要改 | |
| 76 | - List<String> list = Splitter.on(",").trimResults().splitToList(order); | |
| 77 | - return baseService.list(map, new PageRequest(page, size, new Sort(d, list))); | |
| 78 | - } | |
| 79 | - @RequestMapping(value = "/qlbList",method = RequestMethod.GET) | |
| 80 | - public List<Qlb> qlbList(@RequestParam Map<String, Object> map){ | |
| 81 | - List<Qlb> list=service.listQlb(map); | |
| 82 | - return list; | |
| 83 | - } | |
| 84 | - | |
| 85 | - | |
| 86 | - | |
| 87 | - @RequestMapping(value = "/obtain",method = RequestMethod.GET) | |
| 88 | - public Map<String, Object> obtain(@RequestParam Map<String, Object> map) throws Exception{ | |
| 89 | - Map<String, Object> list=new HashMap<String, Object>(); | |
| 90 | - try { | |
| 91 | - list = service.obtain(map); | |
| 92 | - } catch (Exception e) { | |
| 93 | - // TODO Auto-generated catch block | |
| 94 | - throw e; | |
| 95 | - } | |
| 96 | - return list; | |
| 97 | - } | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * 保存氢量 | |
| 101 | - * @param map | |
| 102 | - * @return | |
| 103 | - */ | |
| 104 | - @RequestMapping(value = "/sort",method = RequestMethod.GET) | |
| 105 | - public Map<String, Object> sort(@RequestParam Map<String, Object> map){ | |
| 106 | - Map<String, Object> list=service.sort(map); | |
| 107 | - return list; | |
| 108 | - } | |
| 109 | - | |
| 110 | - /** | |
| 111 | - * 核对氢量(有加氢没里程) | |
| 112 | - * @param map | |
| 113 | - * @return | |
| 114 | - */ | |
| 115 | - @RequestMapping(value = "/checkQl",method = RequestMethod.GET) | |
| 116 | - public Map<String, Object> checkQl(@RequestParam Map<String, Object> map){ | |
| 117 | - Map<String, Object> list=service.checkQl(map); | |
| 118 | - return list; | |
| 119 | - } | |
| 120 | - | |
| 121 | - @RequestMapping(value = "/sumQlb",method = RequestMethod.GET) | |
| 122 | - public Map<String, Object> sumQlb(@RequestParam Map<String, Object> map){ | |
| 123 | - Map<String, Object> list=service.sumQlb(map); | |
| 124 | - return list; | |
| 125 | - } | |
| 126 | - | |
| 127 | - @RequestMapping(value = "/saveQlbList",method = RequestMethod.POST) | |
| 128 | - public Map<String, Object> saveQlbList(@RequestParam Map<String, Object> map){ | |
| 129 | - Map<String, Object> list=new HashMap<String, Object>(); | |
| 130 | - try { | |
| 131 | - list = service.saveQlbList(map); | |
| 132 | - } catch (Exception e) { | |
| 133 | - // TODO Auto-generated catch block | |
| 134 | - e.printStackTrace(); | |
| 135 | - } | |
| 136 | - return list; | |
| 137 | - } | |
| 138 | - | |
| 139 | - | |
| 140 | - @RequestMapping(value = "/listExport",method = RequestMethod.POST) | |
| 141 | - public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){ | |
| 142 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 143 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 144 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 145 | - ReportUtils ee = new ReportUtils(); | |
| 146 | - List<Qlb> qlb = service.listQlb(map); | |
| 147 | -// (new CustomerSpecs<Ylb>(map)).iterator(); | |
| 148 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 149 | - for (Qlb y : qlb) { | |
| 150 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 151 | - m.put("rq", y.getRq()); | |
| 152 | - m.put("gsname",y.getGsname() ); | |
| 153 | - m.put("fgsname", y.getFgsname()); | |
| 154 | - if(y.getLinename()==null){ | |
| 155 | - m.put("xlname", y.getXlname()==null?"":y.getXlname()); | |
| 156 | - }else{ | |
| 157 | - m.put("xlname", y.getLinename()); | |
| 158 | - } | |
| 159 | - m.put("nbbm", y.getNbbm()); | |
| 160 | - m.put("jsy", y.getJsy()); | |
| 161 | - m.put("name", y.getName()); | |
| 162 | - m.put("jql", y.getJql()<=0?"0":y.getJql()); | |
| 163 | - m.put("czcl", y.getCzcl()<=0?"0":y.getCzcl()+"%"); | |
| 164 | - m.put("jzcl", y.getJzcl()<=0?"0":y.getJzcl()+"%"); | |
| 165 | - m.put("czlc", y.getCzlc()<=0?"0":y.getCzlc()); | |
| 166 | - m.put("jzlc", y.getJzlc()<=0?"0":y.getJzlc()); | |
| 167 | - m.put("hn", y.getHn()<=0?"0":y.getHn()); | |
| 168 | - String shyy ="$$$$$${txt-4226}"; | |
| 169 | - if(y.getShyy()!=null){ | |
| 170 | - shyy=y.getShyy(); | |
| 171 | - if(shyy.equals("1")){shyy="$$$$$${txt-3544}";} | |
| 172 | - else if(shyy.equals("2")){shyy="$$$$$${txt-3543}";} | |
| 173 | - else if(shyy.equals("3")){shyy="$$$$$${txt-2786}";} | |
| 174 | - else if(shyy.equals("4")){shyy="$$$$$${txt-3542}";} | |
| 175 | - else if(shyy.equals("5")){shyy="$$$$$${txt-3541}";} | |
| 176 | - else if(shyy.equals("6")){shyy="$$$$$${txt-3978}";} | |
| 177 | - else if(shyy.equals("7")){shyy="$$$$$${txt-3976}";} | |
| 178 | - else if(shyy.equals("8")){shyy="$$$$$${txt-3975}";} | |
| 179 | - else{shyy ="$$$$$${txt-4226}";} | |
| 180 | - } | |
| 181 | - m.put("ns", y.getNs()<=0?"0":y.getNs()); | |
| 182 | - m.put("shyy", shyy); | |
| 183 | - m.put("sh", y.getSh()<=0?"0":y.getSh()); | |
| 184 | - m.put("zlc", y.getZlc()<=0?"0":y.getZlc()); | |
| 185 | - m.put("rdlx", ""); | |
| 186 | - m.put("bglnh", y.getBglhn()); | |
| 187 | - m.put("znh", Arith.add(y.getSh(), y.getHn())); | |
| 188 | - resList.add(m); | |
| 189 | - } | |
| 190 | - try { | |
| 191 | - map.put("sheetName", map.get("rq")); | |
| 192 | - listI.add(resList.iterator()); | |
| 193 | - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 194 | - ee.excelReplace(listI, new Object[] { map }, path+"mould/listQl.xls", | |
| 195 | - path+"export/"+map.get("rq").toString()+ "$$$$$${txt-1654}.xls"); | |
| 196 | - } catch (Exception e) { | |
| 197 | - e.printStackTrace(); | |
| 198 | - } | |
| 199 | - | |
| 200 | - return resList; | |
| 201 | - | |
| 202 | - } | |
| 203 | - | |
| 204 | - | |
| 205 | - @RequestMapping(value = "/checkJsy",method = RequestMethod.GET) | |
| 206 | - public String checkJsy(@RequestParam Map<String, Object> map){ | |
| 207 | - String list=service.checkJsy(map); | |
| 208 | - return list; | |
| 209 | - } | |
| 210 | - | |
| 211 | - @RequestMapping(value = "/deleteIds", method = RequestMethod.POST) | |
| 212 | - public Map<String, Object> deleteIds(@RequestParam Map<String, Object> map) { | |
| 213 | - Map<String, Object> maps=new HashMap<String, Object>(); | |
| 214 | - try { | |
| 215 | - maps= service.deleteIds(map); | |
| 216 | - } catch (Exception e) { | |
| 217 | - // TODO Auto-generated catch block | |
| 218 | - e.printStackTrace(); | |
| 219 | - } | |
| 220 | - return maps; | |
| 221 | - } | |
| 222 | - | |
| 223 | - @RequestMapping(value = "/saveQlb",method = RequestMethod.POST) | |
| 224 | - public Map<String, Object> saveQlb(Qlb t){ | |
| 225 | -// SysUser user = SecurityUtils.getCurrentUser(); | |
| 226 | - t.setCreatetime(new Date()); | |
| 227 | -// Ylb t=new Ylb(); | |
| 228 | - return service.saveQlb(t); | |
| 229 | - } | |
| 230 | - | |
| 231 | - @RequestMapping(value = "/updateJsy",method = RequestMethod.GET) | |
| 232 | - public Map<String, Object> updateJsy(@RequestParam Map<String, Object> map){ | |
| 233 | - return service.update(map); | |
| 234 | - } | |
| 235 | -} | |
| 1 | +package com.bsth.controller.oil; | |
| 2 | + | |
| 3 | +import java.text.SimpleDateFormat; | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.Date; | |
| 6 | +import java.util.HashMap; | |
| 7 | +import java.util.Iterator; | |
| 8 | +import java.util.List; | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 11 | +import com.bsth.util.I18n; | |
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 13 | +import org.springframework.data.domain.Page; | |
| 14 | +import org.springframework.data.domain.PageRequest; | |
| 15 | +import org.springframework.data.domain.Sort; | |
| 16 | +import org.springframework.data.domain.Sort.Direction; | |
| 17 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 18 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 19 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 20 | +import org.springframework.web.bind.annotation.RestController; | |
| 21 | +import com.bsth.controller.BaseController; | |
| 22 | +import com.bsth.entity.oil.Qlb; | |
| 23 | +import com.bsth.service.oil.QlbService; | |
| 24 | +import com.bsth.util.Arith; | |
| 25 | +import com.bsth.util.ReportUtils; | |
| 26 | +import com.google.common.base.Splitter; | |
| 27 | + | |
| 28 | +@RestController | |
| 29 | +@RequestMapping("qlb") | |
| 30 | +public class QlbController extends BaseController<Qlb, Integer>{ | |
| 31 | + @Autowired | |
| 32 | + QlbService service; | |
| 33 | + /** | |
| 34 | + * | |
| 35 | + * @Title: list | |
| 36 | + * @Description: TODO(多条件分页查询) | |
| 37 | + * @param @param map 查询条件 | |
| 38 | + * @param @param page 页码 | |
| 39 | + * @param @param size 每页显示数量 | |
| 40 | + * @throws | |
| 41 | + */ | |
| 42 | + @RequestMapping(method = RequestMethod.GET) | |
| 43 | + public Page<Qlb> list(@RequestParam Map<String, Object> map, | |
| 44 | + @RequestParam(defaultValue = "0") int page, | |
| 45 | + @RequestParam(defaultValue = "10") int size, | |
| 46 | + @RequestParam(defaultValue = "id") String order, | |
| 47 | + @RequestParam(defaultValue = "DESC") String direction){ | |
| 48 | + | |
| 49 | + Direction d; | |
| 50 | +// map.put("xlbm_like", map.get("xlbm_like").toString().trim()); | |
| 51 | +// try { | |
| 52 | + String rq=map.get("rq").toString(); | |
| 53 | + if(!(rq=="")){ | |
| 54 | +// | |
| 55 | +// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 56 | +// Calendar calendar = new GregorianCalendar(); | |
| 57 | +// calendar.setTime(sdf.parse(rq)); | |
| 58 | +// calendar.add(calendar.DATE,1); | |
| 59 | +// Date date=calendar.getTime(); | |
| 60 | + map.put("rq_eq", rq); | |
| 61 | +// map.put("rq_lt", sdf.format(date)); | |
| 62 | +// System.out.println(rq); | |
| 63 | +// System.out.println(sdf.format(date)); | |
| 64 | + } | |
| 65 | +// } catch (ParseException e) { | |
| 66 | +// // TODO Auto-generated catch block | |
| 67 | +// e.printStackTrace(); | |
| 68 | +// } | |
| 69 | + if(null != direction && direction.equals("ASC")) | |
| 70 | + d = Direction.ASC; | |
| 71 | + else | |
| 72 | + d = Direction.DESC; | |
| 73 | + | |
| 74 | + // 允许多个字段排序,order可以写单个字段,也可以写多个字段 | |
| 75 | + // 多个字段格式:{col1},{col2},{col3},....,{coln} | |
| 76 | + // 每个字段的排序方向都是一致,这个以后再看要不要改 | |
| 77 | + List<String> list = Splitter.on(",").trimResults().splitToList(order); | |
| 78 | + return baseService.list(map, new PageRequest(page, size, new Sort(d, list))); | |
| 79 | + } | |
| 80 | + @RequestMapping(value = "/qlbList",method = RequestMethod.GET) | |
| 81 | + public List<Qlb> qlbList(@RequestParam Map<String, Object> map){ | |
| 82 | + List<Qlb> list=service.listQlb(map); | |
| 83 | + return list; | |
| 84 | + } | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + @RequestMapping(value = "/obtain",method = RequestMethod.GET) | |
| 89 | + public Map<String, Object> obtain(@RequestParam Map<String, Object> map) throws Exception{ | |
| 90 | + Map<String, Object> list=new HashMap<String, Object>(); | |
| 91 | + try { | |
| 92 | + list = service.obtain(map); | |
| 93 | + } catch (Exception e) { | |
| 94 | + // TODO Auto-generated catch block | |
| 95 | + throw e; | |
| 96 | + } | |
| 97 | + return list; | |
| 98 | + } | |
| 99 | + | |
| 100 | + /** | |
| 101 | + * 保存氢量 | |
| 102 | + * @param map | |
| 103 | + * @return | |
| 104 | + */ | |
| 105 | + @RequestMapping(value = "/sort",method = RequestMethod.GET) | |
| 106 | + public Map<String, Object> sort(@RequestParam Map<String, Object> map){ | |
| 107 | + Map<String, Object> list=service.sort(map); | |
| 108 | + return list; | |
| 109 | + } | |
| 110 | + | |
| 111 | + /** | |
| 112 | + * 核对氢量(有加氢没里程) | |
| 113 | + * @param map | |
| 114 | + * @return | |
| 115 | + */ | |
| 116 | + @RequestMapping(value = "/checkQl",method = RequestMethod.GET) | |
| 117 | + public Map<String, Object> checkQl(@RequestParam Map<String, Object> map){ | |
| 118 | + Map<String, Object> list=service.checkQl(map); | |
| 119 | + return list; | |
| 120 | + } | |
| 121 | + | |
| 122 | + @RequestMapping(value = "/sumQlb",method = RequestMethod.GET) | |
| 123 | + public Map<String, Object> sumQlb(@RequestParam Map<String, Object> map){ | |
| 124 | + Map<String, Object> list=service.sumQlb(map); | |
| 125 | + return list; | |
| 126 | + } | |
| 127 | + | |
| 128 | + @RequestMapping(value = "/saveQlbList",method = RequestMethod.POST) | |
| 129 | + public Map<String, Object> saveQlbList(@RequestParam Map<String, Object> map){ | |
| 130 | + Map<String, Object> list=new HashMap<String, Object>(); | |
| 131 | + try { | |
| 132 | + list = service.saveQlbList(map); | |
| 133 | + } catch (Exception e) { | |
| 134 | + // TODO Auto-generated catch block | |
| 135 | + e.printStackTrace(); | |
| 136 | + } | |
| 137 | + return list; | |
| 138 | + } | |
| 139 | + | |
| 140 | + | |
| 141 | + @RequestMapping(value = "/listExport",method = RequestMethod.POST) | |
| 142 | + public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){ | |
| 143 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 144 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 145 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 146 | + ReportUtils ee = new ReportUtils(); | |
| 147 | + List<Qlb> qlb = service.listQlb(map); | |
| 148 | +// (new CustomerSpecs<Ylb>(map)).iterator(); | |
| 149 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 150 | + for (Qlb y : qlb) { | |
| 151 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 152 | + m.put("rq", y.getRq()); | |
| 153 | + m.put("gsname",y.getGsname() ); | |
| 154 | + m.put("fgsname", y.getFgsname()); | |
| 155 | + if(y.getLinename()==null){ | |
| 156 | + m.put("xlname", y.getXlname()==null?"":y.getXlname()); | |
| 157 | + }else{ | |
| 158 | + m.put("xlname", y.getLinename()); | |
| 159 | + } | |
| 160 | + m.put("nbbm", y.getNbbm()); | |
| 161 | + m.put("jsy", y.getJsy()); | |
| 162 | + m.put("name", y.getName()); | |
| 163 | + m.put("jql", y.getJql()<=0?"0":y.getJql()); | |
| 164 | + m.put("czcl", y.getCzcl()<=0?"0":y.getCzcl()+"%"); | |
| 165 | + m.put("jzcl", y.getJzcl()<=0?"0":y.getJzcl()+"%"); | |
| 166 | + m.put("czlc", y.getCzlc()<=0?"0":y.getCzlc()); | |
| 167 | + m.put("jzlc", y.getJzlc()<=0?"0":y.getJzlc()); | |
| 168 | + m.put("hn", y.getHn()<=0?"0":y.getHn()); | |
| 169 | + String shyy =I18n.getInstance().getMessage("txt-4226"); | |
| 170 | + if(y.getShyy()!=null){ | |
| 171 | + shyy=y.getShyy(); | |
| 172 | + if(shyy.equals("1")){shyy=I18n.getInstance().getMessage("txt-3544");} | |
| 173 | + else if(shyy.equals("2")){shyy=I18n.getInstance().getMessage("txt-3543");} | |
| 174 | + else if(shyy.equals("3")){shyy=I18n.getInstance().getMessage("txt-2786");} | |
| 175 | + else if(shyy.equals("4")){shyy=I18n.getInstance().getMessage("txt-3542");} | |
| 176 | + else if(shyy.equals("5")){shyy=I18n.getInstance().getMessage("txt-3541");} | |
| 177 | + else if(shyy.equals("6")){shyy= I18n.getInstance().getMessage("txt-3978");} | |
| 178 | + else if(shyy.equals("7")){shyy=I18n.getInstance().getMessage("txt-3976");} | |
| 179 | + else if(shyy.equals("8")){shyy=I18n.getInstance().getMessage("txt-3975");} | |
| 180 | + else{shyy =I18n.getInstance().getMessage("txt-4226");} | |
| 181 | + } | |
| 182 | + m.put("ns", y.getNs()<=0?"0":y.getNs()); | |
| 183 | + m.put("shyy", shyy); | |
| 184 | + m.put("sh", y.getSh()<=0?"0":y.getSh()); | |
| 185 | + m.put("zlc", y.getZlc()<=0?"0":y.getZlc()); | |
| 186 | + m.put("rdlx", ""); | |
| 187 | + m.put("bglnh", y.getBglhn()); | |
| 188 | + m.put("znh", Arith.add(y.getSh(), y.getHn())); | |
| 189 | + resList.add(m); | |
| 190 | + } | |
| 191 | + try { | |
| 192 | + map.put("sheetName", map.get("rq")); | |
| 193 | + listI.add(resList.iterator()); | |
| 194 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 195 | + ee.excelReplace(listI, new Object[] { map }, path+"mould/listQl.xls", | |
| 196 | + path+"export/"+map.get("rq").toString()+ "" + I18n.getInstance().getMessage("txt-1654") + ".xls"); | |
| 197 | + } catch (Exception e) { | |
| 198 | + e.printStackTrace(); | |
| 199 | + } | |
| 200 | + | |
| 201 | + return resList; | |
| 202 | + | |
| 203 | + } | |
| 204 | + | |
| 205 | + | |
| 206 | + @RequestMapping(value = "/checkJsy",method = RequestMethod.GET) | |
| 207 | + public String checkJsy(@RequestParam Map<String, Object> map){ | |
| 208 | + String list=service.checkJsy(map); | |
| 209 | + return list; | |
| 210 | + } | |
| 211 | + | |
| 212 | + @RequestMapping(value = "/deleteIds", method = RequestMethod.POST) | |
| 213 | + public Map<String, Object> deleteIds(@RequestParam Map<String, Object> map) { | |
| 214 | + Map<String, Object> maps=new HashMap<String, Object>(); | |
| 215 | + try { | |
| 216 | + maps= service.deleteIds(map); | |
| 217 | + } catch (Exception e) { | |
| 218 | + // TODO Auto-generated catch block | |
| 219 | + e.printStackTrace(); | |
| 220 | + } | |
| 221 | + return maps; | |
| 222 | + } | |
| 223 | + | |
| 224 | + @RequestMapping(value = "/saveQlb",method = RequestMethod.POST) | |
| 225 | + public Map<String, Object> saveQlb(Qlb t){ | |
| 226 | +// SysUser user = SecurityUtils.getCurrentUser(); | |
| 227 | + t.setCreatetime(new Date()); | |
| 228 | +// Ylb t=new Ylb(); | |
| 229 | + return service.saveQlb(t); | |
| 230 | + } | |
| 231 | + | |
| 232 | + @RequestMapping(value = "/updateJsy",method = RequestMethod.GET) | |
| 233 | + public Map<String, Object> updateJsy(@RequestParam Map<String, Object> map){ | |
| 234 | + return service.update(map); | |
| 235 | + } | |
| 236 | +} | ... | ... |