Commit fc084ab105ab7f58c7b517ad1661bf1861fd3487

Authored by 廖磊
2 parents 4897c795 9fd1fbcb

Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control

into pudong
Showing 47 changed files with 3303 additions and 885 deletions

Too many changes to show.

To preserve performance only 47 of 96 files are displayed.

src/main/java/com/bsth/controller/calc/CalcExportController.java
@@ -158,10 +158,14 @@ public class CalcExportController { @@ -158,10 +158,14 @@ public class CalcExportController {
158 if(map.get("fgsdmSing")!=null){ 158 if(map.get("fgsdmSing")!=null){
159 fgsdmSing=map.get("fgsdmSing").toString().trim(); 159 fgsdmSing=map.get("fgsdmSing").toString().trim();
160 } 160 }
  161 + String sfdc="";
  162 + if(map.get("sfdc")!=null){
  163 + sfdc=map.get("sfdc").toString().trim();
  164 + }
161 165
162 Map<String, Object> resMap = new HashMap<String, Object>(); 166 Map<String, Object> resMap = new HashMap<String, Object>();
163 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 167 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
164 - List<Map<String, Object>> list = clacMixService.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing); 168 + List<Map<String, Object>> list = clacMixService.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing, sfdc);
165 169
166 Map<String, Object> temp = new HashMap<String, Object>(); 170 Map<String, Object> temp = new HashMap<String, Object>();
167 temp.put("i", "序号"); 171 temp.put("i", "序号");
src/main/java/com/bsth/controller/calc/CalcMixController.java
@@ -81,7 +81,11 @@ public class CalcMixController { @@ -81,7 +81,11 @@ public class CalcMixController {
81 if(map.get("fgsdmSing")!=null){ 81 if(map.get("fgsdmSing")!=null){
82 fgsdmSing=map.get("fgsdmSing").toString().trim(); 82 fgsdmSing=map.get("fgsdmSing").toString().trim();
83 } 83 }
84 - return service.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing); 84 + String sfdc="";
  85 + if(map.get("sfdc")!=null){
  86 + sfdc=map.get("sfdc").toString().trim();
  87 + }
  88 + return service.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing, sfdc);
85 } 89 }
86 90
87 } 91 }
src/main/java/com/bsth/controller/oil/CwjyController.java
1 package com.bsth.controller.oil; 1 package com.bsth.controller.oil;
2 2
3 3
  4 +import java.io.File;
4 import java.util.Date; 5 import java.util.Date;
5 import java.util.HashMap; 6 import java.util.HashMap;
6 import java.util.List; 7 import java.util.List;
@@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping; @@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
11 import org.springframework.web.bind.annotation.RequestMethod; 12 import org.springframework.web.bind.annotation.RequestMethod;
12 import org.springframework.web.bind.annotation.RequestParam; 13 import org.springframework.web.bind.annotation.RequestParam;
13 import org.springframework.web.bind.annotation.RestController; 14 import org.springframework.web.bind.annotation.RestController;
  15 +import org.springframework.web.multipart.MultipartFile;
14 16
15 import com.bsth.common.ResponseCode; 17 import com.bsth.common.ResponseCode;
16 import com.bsth.controller.BaseController; 18 import com.bsth.controller.BaseController;
@@ -22,6 +24,7 @@ import com.bsth.entity.sys.SysUser; @@ -22,6 +24,7 @@ import com.bsth.entity.sys.SysUser;
22 import com.bsth.security.util.SecurityUtils; 24 import com.bsth.security.util.SecurityUtils;
23 import com.bsth.service.oil.CwjyService; 25 import com.bsth.service.oil.CwjyService;
24 import com.bsth.util.PageObject; 26 import com.bsth.util.PageObject;
  27 +import com.google.common.io.Files;
25 28
26 @RestController 29 @RestController
27 @RequestMapping("cwjy") 30 @RequestMapping("cwjy")
@@ -95,4 +98,23 @@ public class CwjyController extends BaseController&lt;Cwjy, Integer&gt;{ @@ -95,4 +98,23 @@ public class CwjyController extends BaseController&lt;Cwjy, Integer&gt;{
95 return maps; 98 return maps;
96 } 99 }
97 100
  101 + /*
  102 + * 场外加油导入
  103 + */
  104 + @RequestMapping(value = "/uploadFile",method = RequestMethod.POST)
  105 + public String uploadFile(MultipartFile file, String gsbm_, String gsName,
  106 + String fgsbm_, String fgsName) throws Exception{
  107 + Map<String, Object> map = new HashMap<String, Object>();
  108 + File newFile = new File(
  109 + getDataImportClasspath() + File.separator +
  110 + file.getOriginalFilename());
  111 + Files.write(file.getBytes(), newFile);
  112 + String result = service.importExcel(newFile, gsbm_, gsName);
  113 + return "{\"result\":" + "\""+result+"\"}";
  114 + }
  115 +
  116 + public String getDataImportClasspath(){
  117 + return this.getClass().getResource("/").getPath() + "/static/pages/oil";
  118 + }
  119 +
98 } 120 }
src/main/java/com/bsth/controller/realcontrol/ReportRegisterController.java
1 -package com.bsth.controller.realcontrol;  
2 -  
3 -import com.alibaba.fastjson.JSON;  
4 -import com.alibaba.fastjson.JSONObject;  
5 -import com.bsth.common.ResponseCode;  
6 -import com.bsth.controller.BaseController;  
7 -import com.bsth.data.report_register.ReportRegisterService;  
8 -import com.bsth.data.report_register.entity.ReportRegister;  
9 -import com.bsth.util.HttpClientUtils;  
10 -import org.slf4j.Logger;  
11 -import org.slf4j.LoggerFactory;  
12 -import org.springframework.beans.factory.annotation.Autowired;  
13 -import org.springframework.beans.propertyeditors.CustomDateEditor;  
14 -import org.springframework.web.bind.WebDataBinder;  
15 -import org.springframework.web.bind.annotation.InitBinder;  
16 -import org.springframework.web.bind.annotation.PathVariable;  
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 org.springframework.web.context.request.WebRequest;  
22 -  
23 -import java.text.DateFormat;  
24 -import java.text.SimpleDateFormat;  
25 -import java.util.Date;  
26 -import java.util.HashMap;  
27 -import java.util.Map;  
28 -  
29 -/**  
30 - * 报备登记  
31 - * Created by yrf on 2019/12/04.  
32 - */  
33 -@RestController  
34 -@RequestMapping("reportRegister")  
35 -public class ReportRegisterController extends BaseController<ReportRegister, Long>{  
36 -  
37 - Logger log = LoggerFactory.getLogger(this.getClass());  
38 -  
39 - final static String url = "http://114.80.178.13/complaint/TsReport/input.do";  
40 -// final static String url = "http://192.168.168.228:8080/complaint/TsReport/input.do";  
41 -  
42 - @Autowired  
43 - ReportRegisterService reportRegisterService;  
44 -  
45 - @InitBinder  
46 - public void initBinder(WebDataBinder binder, WebRequest request) {  
47 - //转换日期 注意这里的转化要和传进来的字符串的格式一直 如2015-9-9 就应该为yyyy-MM-dd  
48 - DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
49 - binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));// CustomDateEditor为自定义日期编辑器  
50 - }  
51 -  
52 -  
53 - @RequestMapping(value = "/findList", method = RequestMethod.GET)  
54 - public Map<String, Object> findList(@RequestParam Map<String, String> map) {  
55 - return reportRegisterService.findList(map);  
56 - }  
57 -  
58 - @RequestMapping(value = "/{id}", method = RequestMethod.GET)  
59 - public ReportRegister findById(@PathVariable("id") Long id) {  
60 - ReportRegister reportRegister = reportRegisterService.findById(id);  
61 - return reportRegister;  
62 - }  
63 -  
64 - @RequestMapping(value = "/delete", method = RequestMethod.POST)  
65 - public Map<String, Object> deleteInfo(ReportRegister t) {  
66 - Map<String, Object> map = new HashMap<>();  
67 - try{  
68 -// map = baseService.delete(id);  
69 - reportRegisterService.deleteInfo(t);  
70 - String data = "{ID:'"+t.getID()+"', STATUS:'2'}";  
71 - StringBuilder sb = HttpClientUtils.post(url,data);  
72 - JSONObject obj = JSON.parseObject(sb.toString());  
73 - map.put("status2", obj);  
74 - } catch (Exception e) {  
75 - log.error(e.toString(), e);  
76 - }  
77 - return map;  
78 - }  
79 -  
80 -  
81 - @RequestMapping(method = RequestMethod.POST)  
82 - public Map<String, Object> save(ReportRegister t) {  
83 - Map<String, Object> map = new HashMap<>();  
84 - try{  
85 - reportRegisterService.save(t);  
86 - map.put("status", ResponseCode.SUCCESS);  
87 - map.put("t", t);  
88 - StringBuilder sb = HttpClientUtils.post(url,t.toString());  
89 - JSONObject obj = JSON.parseObject(sb.toString());  
90 - map.put("status2", obj);  
91 - } catch (Exception e) {  
92 - log.error(e.toString(), e);  
93 - }  
94 - return map;  
95 - }  
96 -} 1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONObject;
  5 +import com.bsth.common.ResponseCode;
  6 +import com.bsth.controller.BaseController;
  7 +import com.bsth.data.report_register.ReportRegisterService;
  8 +import com.bsth.data.report_register.entity.ReportRegister;
  9 +import com.bsth.util.HttpClientUtils;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.beans.propertyeditors.CustomDateEditor;
  14 +import org.springframework.web.bind.WebDataBinder;
  15 +import org.springframework.web.bind.annotation.InitBinder;
  16 +import org.springframework.web.bind.annotation.PathVariable;
  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 org.springframework.web.context.request.WebRequest;
  22 +
  23 +import java.text.DateFormat;
  24 +import java.text.SimpleDateFormat;
  25 +import java.util.Date;
  26 +import java.util.HashMap;
  27 +import java.util.Map;
  28 +
  29 +/**
  30 + * 报备登记
  31 + * Created by yrf on 2019/12/04.
  32 + */
  33 +@RestController
  34 +@RequestMapping("reportRegister")
  35 +public class ReportRegisterController extends BaseController<ReportRegister, Long>{
  36 +
  37 + Logger log = LoggerFactory.getLogger(this.getClass());
  38 +
  39 + final static String url = "http://114.80.178.13/complaint/TsReport/input.do";
  40 +// final static String url = "http://192.168.168.228:8080/complaint/TsReport/input.do";
  41 +
  42 + @Autowired
  43 + ReportRegisterService reportRegisterService;
  44 +
  45 + @InitBinder
  46 + public void initBinder(WebDataBinder binder, WebRequest request) {
  47 + //转换日期 注意这里的转化要和传进来的字符串的格式一直 如2015-9-9 就应该为yyyy-MM-dd
  48 + DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  49 + binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));// CustomDateEditor为自定义日期编辑器
  50 + }
  51 +
  52 +
  53 + @RequestMapping(value = "/findList", method = RequestMethod.GET)
  54 + public Map<String, Object> findList(@RequestParam Map<String, String> map) {
  55 + return reportRegisterService.findList(map);
  56 + }
  57 +
  58 + @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  59 + public ReportRegister findById(@PathVariable("id") Long id) {
  60 + ReportRegister reportRegister = reportRegisterService.findById(id);
  61 + return reportRegister;
  62 + }
  63 +
  64 + @RequestMapping(value = "/delete", method = RequestMethod.POST)
  65 + public Map<String, Object> deleteInfo(ReportRegister t) {
  66 + Map<String, Object> map = new HashMap<>();
  67 + try{
  68 +// map = baseService.delete(id);
  69 + reportRegisterService.deleteInfo(t);
  70 + String data = "{ID:'"+t.getID()+"', STATUS:'2'}";
  71 + StringBuilder sb = HttpClientUtils.post(url,data);
  72 + JSONObject obj = JSON.parseObject(sb.toString());
  73 + map.put("status2", obj);
  74 + } catch (Exception e) {
  75 + log.error(e.toString(), e);
  76 + }
  77 + return map;
  78 + }
  79 +
  80 +
  81 + @RequestMapping(method = RequestMethod.POST)
  82 + public Map<String, Object> save(ReportRegister t) {
  83 + Map<String, Object> map = new HashMap<>();
  84 + try{
  85 + reportRegisterService.save(t);
  86 + map.put("status", ResponseCode.SUCCESS);
  87 + map.put("t", t);
  88 + StringBuilder sb = HttpClientUtils.post(url,t.toString());
  89 + JSONObject obj = JSON.parseObject(sb.toString());
  90 + map.put("status2", obj);
  91 + } catch (Exception e) {
  92 + log.error(e.toString(), e);
  93 + }
  94 + return map;
  95 + }
  96 +}
src/main/java/com/bsth/controller/schedule/basicinfo/CarController_facade.java 0 → 100644
  1 +package com.bsth.controller.schedule.basicinfo;
  2 +
  3 +import com.alibaba.dubbo.config.annotation.Reference;
  4 +import com.bsth.common.ResponseCode;
  5 +import com.bsth.control_v2.plan_module.common.config.springboot.dubbo.DubboConfigCondition;
  6 +import com.bsth.control_v2.plan_module.common.dto.baseinfo.CarDto;
  7 +import com.bsth.control_v2.plan_module.common.dto.sys.UserDto;
  8 +import com.bsth.control_v2.plan_module.common.service.BServiceFacade;
  9 +import com.bsth.control_v2.plan_module.common.service.baseinfo.CarServiceFacade;
  10 +import com.bsth.controller.schedule.BController_facade;
  11 +import com.bsth.service.schedule.CarsService;
  12 +import com.bsth.service.schedule.utils.DataToolsFile;
  13 +import org.apache.commons.lang3.StringUtils;
  14 +import org.apache.poi.ss.usermodel.Workbook;
  15 +import org.springframework.beans.factory.annotation.Autowired;
  16 +import org.springframework.context.annotation.Conditional;
  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 org.springframework.web.multipart.MultipartFile;
  22 +
  23 +import javax.servlet.http.HttpServletResponse;
  24 +import java.io.*;
  25 +import java.util.*;
  26 +
  27 +/**
  28 + * 车辆基础信息controller_facade
  29 + */
  30 +@RestController
  31 +@Conditional(DubboConfigCondition.class)
  32 +@RequestMapping("cars_sc")
  33 +public class CarController_facade extends BController_facade<Integer, CarDto> {
  34 +
  35 + @Override
  36 + public void setCreateUserInfo(CarDto carDto, Integer userId, Date createDate) {
  37 + UserDto userDto = UserDto.getBuilder()
  38 + .setId(userId)
  39 + .build();
  40 + carDto.setCreateBy(userDto);
  41 + carDto.setCreateDate(createDate);
  42 + }
  43 + @Override
  44 + public void setUpdateUserInfo(CarDto carDto, Integer userId, Date updateDate) {
  45 + UserDto userDto = UserDto.getBuilder()
  46 + .setId(userId)
  47 + .build();
  48 + carDto.setUpdateBy(userDto);
  49 + carDto.setUpdateDate(updateDate);
  50 + }
  51 +
  52 + @Reference
  53 + private CarServiceFacade carServiceFacade;
  54 + @Override
  55 + protected BServiceFacade<Integer, CarDto> getBServiceFacade() {
  56 + return carServiceFacade;
  57 + }
  58 +
  59 + @RequestMapping(value = "/validate_zbh", method = RequestMethod.GET)
  60 + public Map<String, Object> validate_zbh(@RequestParam Map<String, Object> param) {
  61 + Map<String, Object> rtn = new HashMap<>();
  62 + try {
  63 + // 自编号验证
  64 + CarDto carDto = CarDto.getBuilder()
  65 + .setId(param.get("id_eq") == null ?
  66 + null : Integer.valueOf(param.get("id_eq").toString()))
  67 + .setInsideCode(param.get("insideCode_eq") == null ?
  68 + null : param.get("insideCode_eq").toString())
  69 + .build();
  70 + this.carServiceFacade.validate_repeat_nbbh(carDto);
  71 + rtn.put("status", ResponseCode.SUCCESS);
  72 + } catch (Exception exp) {
  73 + rtn.put("status", ResponseCode.ERROR);
  74 + rtn.put("msg", exp.getMessage());
  75 + }
  76 + return rtn;
  77 + }
  78 +
  79 + @RequestMapping(value = "/validate_clbh", method = RequestMethod.GET)
  80 + public Map<String, Object> validate_clbh(@RequestParam Map<String, Object> param) {
  81 + Map<String, Object> rtn = new HashMap<>();
  82 + try {
  83 + // 车辆编号验证
  84 + CarDto carDto = CarDto.getBuilder()
  85 + .setId(param.get("id_eq") == null ?
  86 + null : Integer.valueOf(param.get("id_eq").toString()))
  87 + .setCarCode(param.get("carCode_eq") == null ?
  88 + null : param.get("carCode_eq").toString())
  89 + .build();
  90 + this.carServiceFacade.validate_repeat_clbh(carDto);
  91 + rtn.put("status", ResponseCode.SUCCESS);
  92 + } catch (Exception exp) {
  93 + rtn.put("status", ResponseCode.ERROR);
  94 + rtn.put("msg", exp.getMessage());
  95 + }
  96 + return rtn;
  97 + }
  98 +
  99 + @RequestMapping(value = "/validate_cph", method = RequestMethod.GET)
  100 + public Map<String, Object> validate_cph(@RequestParam Map<String, Object> param) {
  101 + Map<String, Object> rtn = new HashMap<>();
  102 + try {
  103 + // 车牌号验证
  104 + CarDto carDto = CarDto.getBuilder()
  105 + .setId(param.get("id_eq") == null ?
  106 + null : Integer.valueOf(param.get("id_eq").toString()))
  107 + .setCarPlate(param.get("carPlate_eq") == null ?
  108 + null : param.get("carPlate_eq").toString())
  109 + .build();
  110 + this.carServiceFacade.validate_repeat_cph(carDto);
  111 + rtn.put("status", ResponseCode.SUCCESS);
  112 + } catch (Exception exp) {
  113 + rtn.put("status", ResponseCode.ERROR);
  114 + rtn.put("msg", exp.getMessage());
  115 + }
  116 + return rtn;
  117 + }
  118 +
  119 + @RequestMapping(value = "/validate_sbbh", method = RequestMethod.GET)
  120 + public Map<String, Object> validate_sbbh(@RequestParam Map<String, Object> param) {
  121 + Map<String, Object> rtn = new HashMap<>();
  122 + try {
  123 + // 设备编号验证
  124 + CarDto carDto = CarDto.getBuilder()
  125 + .setId(param.get("id_eq") == null ?
  126 + null : Integer.valueOf(param.get("id_eq").toString()))
  127 + .setEquipmentCode(param.get("equipmentCode_eq") == null ?
  128 + null : param.get("equipmentCode_eq").toString())
  129 + .build();
  130 + this.carServiceFacade.validate_repeat_sbbh(carDto);
  131 + rtn.put("status", ResponseCode.SUCCESS);
  132 + } catch (Exception exp) {
  133 + rtn.put("status", ResponseCode.ERROR);
  134 + rtn.put("msg", exp.getMessage());
  135 + }
  136 + return rtn;
  137 + }
  138 +
  139 + //------------------ TODO:导入导出逻辑,之后会服务化 -----------------//
  140 + @Autowired
  141 + private CarsService carsService;
  142 + // 上传excel文件
  143 + @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
  144 + public Map<String, Object> uploadFile(MultipartFile file) {
  145 + Map<String, Object> rtn = new HashMap<>();
  146 + try {
  147 + DataToolsFile dataToolsFile = carsService.uploadFile(file.getOriginalFilename(), file.getBytes());
  148 + // excel文件名
  149 + String fileName = dataToolsFile.getFile().getAbsolutePath();
  150 + Workbook wb = dataToolsFile.getFileType().getWorkBook(dataToolsFile.getFile());
  151 +
  152 + // excel文件sheet
  153 + List<String> sheetnames = new ArrayList<>();
  154 + for (int i = 0; i < wb.getNumberOfSheets(); i ++) {
  155 + sheetnames.add(wb.getSheetAt(i).getSheetName());
  156 + }
  157 +
  158 + wb.close();
  159 +
  160 + rtn.put("status", ResponseCode.SUCCESS);
  161 + rtn.put("filename", fileName);
  162 + rtn.put("sheetnames", StringUtils.join(sheetnames, ","));
  163 + } catch (Exception exp) {
  164 + exp.printStackTrace();
  165 + rtn.put("status", ResponseCode.ERROR);
  166 + rtn.put("msg", exp.getMessage());
  167 + }
  168 + return rtn;
  169 + }
  170 + // 导入excel文件
  171 + @RequestMapping(value = "/importFile", method = RequestMethod.POST)
  172 + public Map<String, Object> importFile(@RequestParam Map<String, Object> params) {
  173 + Map<String, Object> rtn = new HashMap<>();
  174 +
  175 + try {
  176 + File file = new File(String.valueOf(params.get("filename")));
  177 + if (!file.exists()) {
  178 + throw new Exception("导入文件不存在!");
  179 + }
  180 + carsService.importData(file, params);
  181 +
  182 + rtn.put("status", ResponseCode.SUCCESS);
  183 + rtn.put("msg", "导入文件成功");
  184 + } catch (Exception exp) {
  185 + rtn.put("status", ResponseCode.ERROR);
  186 + rtn.put("msg", exp.getMessage());
  187 + }
  188 +
  189 + return rtn;
  190 + }
  191 + // 上传并导入excel文件
  192 + @RequestMapping(value = "/uploadAndImportFile", method = RequestMethod.POST)
  193 + public Map<String, Object> uploadAndImportFile(MultipartFile file) {
  194 + Map<String, Object> rtn = new HashMap<>();
  195 +
  196 + try {
  197 + DataToolsFile dataToolsFile = carsService.uploadFile(file.getOriginalFilename(), file.getBytes());
  198 + Map<String, Object> params = new HashMap<>();
  199 + carsService.importData(dataToolsFile.getFile(), params);
  200 +
  201 + rtn.put("status", ResponseCode.SUCCESS);
  202 + rtn.put("msg", "上传&导入文件成功");
  203 + } catch (Exception exp) {
  204 + exp.printStackTrace();
  205 + rtn.put("status", ResponseCode.ERROR);
  206 + rtn.put("msg", exp.getMessage());
  207 + }
  208 +
  209 + return rtn;
  210 + }
  211 +
  212 + // 导出数据到xls文件
  213 + @RequestMapping(value = "/exportFile", method = RequestMethod.GET)
  214 + public void exportFile(HttpServletResponse response,
  215 + @RequestParam Map<String, Object> params) throws Exception {
  216 + DataToolsFile dataToolsFile = carsService.exportData(params);
  217 + // 流输出导出文件
  218 + response.setHeader("content-type", "application/octet-stream");
  219 + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName());
  220 + response.setContentType("application/octet-stream");
  221 +
  222 + OutputStream os = response.getOutputStream();
  223 + BufferedOutputStream bos = new BufferedOutputStream(os);
  224 +
  225 + InputStream is = new FileInputStream(dataToolsFile.getFile());
  226 + BufferedInputStream bis = new BufferedInputStream(is);
  227 +
  228 + int length = 0;
  229 + byte[] temp = new byte[1 * 1024 * 10];
  230 + while ((length = bis.read(temp)) != -1) {
  231 + bos.write(temp, 0, length);
  232 + }
  233 + bos.flush();
  234 + bis.close();
  235 + bos.close();
  236 + is.close();
  237 + }
  238 +
  239 +
  240 +
  241 +
  242 +}
src/main/java/com/bsth/controller/schedule/basicinfo/CarDeviceController_facade.java 0 → 100644
  1 +package com.bsth.controller.schedule.basicinfo;
  2 +
  3 +import com.alibaba.dubbo.config.annotation.Reference;
  4 +import com.bsth.common.ResponseCode;
  5 +import com.bsth.control_v2.plan_module.common.config.springboot.dubbo.DubboConfigCondition;
  6 +import com.bsth.control_v2.plan_module.common.dto.baseinfo.CarDeviceDto;
  7 +import com.bsth.control_v2.plan_module.common.dto.sys.UserDto;
  8 +import com.bsth.control_v2.plan_module.common.service.BServiceFacade;
  9 +import com.bsth.control_v2.plan_module.common.service.baseinfo.CarDeviceServiceFacade;
  10 +import com.bsth.controller.schedule.BController_facade;
  11 +import org.joda.time.DateTime;
  12 +import org.springframework.context.annotation.Conditional;
  13 +import org.springframework.web.bind.annotation.RequestMapping;
  14 +import org.springframework.web.bind.annotation.RequestMethod;
  15 +import org.springframework.web.bind.annotation.RequestParam;
  16 +import org.springframework.web.bind.annotation.RestController;
  17 +
  18 +import java.util.Date;
  19 +import java.util.HashMap;
  20 +import java.util.Map;
  21 +
  22 +@RestController
  23 +@Conditional(DubboConfigCondition.class)
  24 +@RequestMapping("cde_sc")
  25 +public class CarDeviceController_facade extends BController_facade<Long, CarDeviceDto> {
  26 + @Override
  27 + public void setCreateUserInfo(CarDeviceDto carDeviceDto, Integer userId, Date createDate) {
  28 + UserDto userDto = UserDto.getBuilder()
  29 + .setId(userId)
  30 + .build();
  31 + carDeviceDto.setCreateBy(userDto);
  32 + carDeviceDto.setCreateDate(createDate);
  33 + }
  34 +
  35 + @Override
  36 + public void setUpdateUserInfo(CarDeviceDto carDeviceDto, Integer userId, Date updateDate) {
  37 + UserDto userDto = UserDto.getBuilder()
  38 + .setId(userId)
  39 + .build();
  40 + carDeviceDto.setUpdateBy(userDto);
  41 + carDeviceDto.setUpdateDate(updateDate);
  42 + }
  43 +
  44 + @Reference
  45 + private CarDeviceServiceFacade carDeviceServiceFacade;
  46 +
  47 + @Override
  48 + protected BServiceFacade<Long, CarDeviceDto> getBServiceFacade() {
  49 + return carDeviceServiceFacade;
  50 + }
  51 + @RequestMapping(value = "/validate_qyrq", method = RequestMethod.GET)
  52 + public Map<String, Object> validate_qyrq(@RequestParam Map<String, Object> param) {
  53 + Map<String, Object> rtn = new HashMap<>();
  54 +
  55 + try {
  56 + // 启用日期验证
  57 + // 计算日期
  58 + Date qyrq_c = null;
  59 + if (param.get("qyrq_eq") != null) {
  60 + try {
  61 + qyrq_c = new Date();
  62 + qyrq_c.setTime(Long.parseLong(param.get("qyrq_eq").toString()));
  63 + } catch (Exception exp) {
  64 + qyrq_c = new DateTime(param.get("qyrq_eq").toString()).toDate();
  65 + }
  66 + }
  67 +
  68 + CarDeviceDto carDeviceDto = CarDeviceDto.getBuilder()
  69 + .setId(param.get("id_eq") == null ?
  70 + null : Long.valueOf(param.get("id_eq").toString()))
  71 + .setXl(param.get("xl_eq") == null ?
  72 + null : Integer.valueOf(param.get("xl_eq").toString()))
  73 + .setCl(param.get("cl_eq") == null ?
  74 + null : Integer.valueOf(param.get("cl_eq").toString()))
  75 + .setQyrq(qyrq_c)
  76 + .build();
  77 +
  78 + this.carDeviceServiceFacade.validate_qyrq(carDeviceDto);
  79 + rtn.put("status", ResponseCode.SUCCESS);
  80 + } catch (Exception exp) {
  81 + rtn.put("status", ResponseCode.ERROR);
  82 + rtn.put("msg", exp.getMessage());
  83 + }
  84 +
  85 + return rtn;
  86 + }
  87 +}
src/main/java/com/bsth/controller/schedule/basicinfo/EmployeeController_facade.java 0 → 100644
  1 +package com.bsth.controller.schedule.basicinfo;
  2 +
  3 +import com.alibaba.dubbo.config.annotation.Reference;
  4 +import com.bsth.common.ResponseCode;
  5 +import com.bsth.control_v2.plan_module.common.config.springboot.dubbo.DubboConfigCondition;
  6 +import com.bsth.control_v2.plan_module.common.dto.baseinfo.PersonnelDto;
  7 +import com.bsth.control_v2.plan_module.common.dto.sys.UserDto;
  8 +import com.bsth.control_v2.plan_module.common.service.BServiceFacade;
  9 +import com.bsth.control_v2.plan_module.common.service.baseinfo.PersonnelServiceFacade;
  10 +import com.bsth.controller.schedule.BController_facade;
  11 +import com.bsth.service.schedule.EmployeeService;
  12 +import com.bsth.service.schedule.utils.DataToolsFile;
  13 +import org.apache.commons.lang3.StringUtils;
  14 +import org.apache.poi.ss.usermodel.Workbook;
  15 +import org.springframework.beans.factory.annotation.Autowired;
  16 +import org.springframework.context.annotation.Conditional;
  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 org.springframework.web.multipart.MultipartFile;
  22 +
  23 +import javax.servlet.http.HttpServletResponse;
  24 +import java.io.*;
  25 +import java.util.*;
  26 +
  27 +/**
  28 + * 人员基础信息Controller_facade
  29 + */
  30 +@RestController
  31 +@Conditional(DubboConfigCondition.class)
  32 +@RequestMapping("ee")
  33 +public class EmployeeController_facade extends BController_facade<Integer, PersonnelDto> {
  34 + @Override
  35 + public void setCreateUserInfo(PersonnelDto personnelDto, Integer userId, Date createDate) {
  36 + UserDto userDto = UserDto.getBuilder()
  37 + .setId(userId)
  38 + .build();
  39 + personnelDto.setCreateBy(userDto);
  40 + personnelDto.setCreateDate(createDate);
  41 + }
  42 +
  43 + @Override
  44 + public void setUpdateUserInfo(PersonnelDto personnelDto, Integer userId, Date updateDate) {
  45 + UserDto userDto = UserDto.getBuilder()
  46 + .setId(userId)
  47 + .build();
  48 + personnelDto.setUpdateBy(userDto);
  49 + personnelDto.setUpdateDate(updateDate);
  50 + }
  51 +
  52 + @Reference
  53 + private PersonnelServiceFacade personnelServiceFacade;
  54 + @Override
  55 + protected BServiceFacade<Integer, PersonnelDto> getBServiceFacade() {
  56 + return personnelServiceFacade;
  57 + }
  58 + @RequestMapping(value = "/validate_gh", method = RequestMethod.GET)
  59 + public Map<String, Object> validate_gh(@RequestParam Map<String, Object> param) {
  60 + Map<String, Object> rtn = new HashMap<>();
  61 + try {
  62 + // 工号验证
  63 + PersonnelDto personnelDto = PersonnelDto.getBuilder()
  64 + .setId(param.get("id_eq") == null ?
  65 + null : Integer.valueOf(param.get("id_eq").toString()))
  66 + .setCompanyCode(param.get("companyCode_eq") == null ?
  67 + null : param.get("companyCode_eq").toString())
  68 + .setJobCode(param.get("jobCode_eq") == null ?
  69 + null : param.get("jobCode_eq").toString())
  70 + .build();
  71 + this.personnelServiceFacade.validate_gh(personnelDto);
  72 + rtn.put("status", ResponseCode.SUCCESS);
  73 + } catch (Exception exp) {
  74 + rtn.put("status", ResponseCode.ERROR);
  75 + rtn.put("msg", exp.getMessage());
  76 + }
  77 +
  78 + return rtn;
  79 + }
  80 +
  81 + //------------------ TODO:导入导出逻辑,之后会服务化 -----------------//
  82 + @Autowired
  83 + private EmployeeService employeeService;
  84 + // 上传excel文件
  85 + @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
  86 + public Map<String, Object> uploadFile(MultipartFile file) {
  87 + Map<String, Object> rtn = new HashMap<>();
  88 + try {
  89 + DataToolsFile dataToolsFile = employeeService.uploadFile(file.getOriginalFilename(), file.getBytes());
  90 + // excel文件名
  91 + String fileName = dataToolsFile.getFile().getAbsolutePath();
  92 + Workbook wb = dataToolsFile.getFileType().getWorkBook(dataToolsFile.getFile());
  93 +
  94 + // excel文件sheet
  95 + List<String> sheetnames = new ArrayList<>();
  96 + for (int i = 0; i < wb.getNumberOfSheets(); i ++) {
  97 + sheetnames.add(wb.getSheetAt(i).getSheetName());
  98 + }
  99 +
  100 + wb.close();
  101 +
  102 + rtn.put("status", ResponseCode.SUCCESS);
  103 + rtn.put("filename", fileName);
  104 + rtn.put("sheetnames", StringUtils.join(sheetnames, ","));
  105 + } catch (Exception exp) {
  106 + exp.printStackTrace();
  107 + rtn.put("status", ResponseCode.ERROR);
  108 + rtn.put("msg", exp.getMessage());
  109 + }
  110 + return rtn;
  111 + }
  112 + // 导入excel文件
  113 + @RequestMapping(value = "/importFile", method = RequestMethod.POST)
  114 + public Map<String, Object> importFile(@RequestParam Map<String, Object> params) {
  115 + Map<String, Object> rtn = new HashMap<>();
  116 +
  117 + try {
  118 + File file = new File(String.valueOf(params.get("filename")));
  119 + if (!file.exists()) {
  120 + throw new Exception("导入文件不存在!");
  121 + }
  122 + employeeService.importData(file, params);
  123 +
  124 + rtn.put("status", ResponseCode.SUCCESS);
  125 + rtn.put("msg", "导入文件成功");
  126 + } catch (Exception exp) {
  127 + rtn.put("status", ResponseCode.ERROR);
  128 + rtn.put("msg", exp.getMessage());
  129 + }
  130 +
  131 + return rtn;
  132 + }
  133 + // 上传并导入excel文件
  134 + @RequestMapping(value = "/uploadAndImportFile", method = RequestMethod.POST)
  135 + public Map<String, Object> uploadAndImportFile(MultipartFile file) {
  136 + Map<String, Object> rtn = new HashMap<>();
  137 +
  138 + try {
  139 + DataToolsFile dataToolsFile = employeeService.uploadFile(file.getOriginalFilename(), file.getBytes());
  140 + Map<String, Object> params = new HashMap<>();
  141 + employeeService.importData(dataToolsFile.getFile(), params);
  142 +
  143 + rtn.put("status", ResponseCode.SUCCESS);
  144 + rtn.put("msg", "上传&导入文件成功");
  145 + } catch (Exception exp) {
  146 + exp.printStackTrace();
  147 + rtn.put("status", ResponseCode.ERROR);
  148 + rtn.put("msg", exp.getMessage());
  149 + }
  150 +
  151 + return rtn;
  152 + }
  153 +
  154 + // 导出数据到xls文件
  155 + @RequestMapping(value = "/exportFile", method = RequestMethod.GET)
  156 + public void exportFile(HttpServletResponse response,
  157 + @RequestParam Map<String, Object> params) throws Exception {
  158 + DataToolsFile dataToolsFile = employeeService.exportData(params);
  159 + // 流输出导出文件
  160 + response.setHeader("content-type", "application/octet-stream");
  161 + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName());
  162 + response.setContentType("application/octet-stream");
  163 +
  164 + OutputStream os = response.getOutputStream();
  165 + BufferedOutputStream bos = new BufferedOutputStream(os);
  166 +
  167 + InputStream is = new FileInputStream(dataToolsFile.getFile());
  168 + BufferedInputStream bis = new BufferedInputStream(is);
  169 +
  170 + int length = 0;
  171 + byte[] temp = new byte[1 * 1024 * 10];
  172 + while ((length = bis.read(temp)) != -1) {
  173 + bos.write(temp, 0, length);
  174 + }
  175 + bos.flush();
  176 + bis.close();
  177 + bos.close();
  178 + is.close();
  179 + }
  180 +
  181 +}
src/main/java/com/bsth/controller/schedule/basicinfo/CarDeviceController.java renamed to src/main/java/com/bsth/controller/schedule/basicinfo/legacy/CarDeviceController.java
1 -package com.bsth.controller.schedule.basicinfo; 1 +package com.bsth.controller.schedule.basicinfo.legacy;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 4 import com.bsth.controller.schedule.BController;
  5 +import com.bsth.controller.schedule.basicinfo.CarDeviceController_facade;
5 import com.bsth.entity.CarDevice; 6 import com.bsth.entity.CarDevice;
6 import com.bsth.service.schedule.CarDeviceService; 7 import com.bsth.service.schedule.CarDeviceService;
7 import com.bsth.service.schedule.exception.ScheduleException; 8 import com.bsth.service.schedule.exception.ScheduleException;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
9 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
10 import org.springframework.web.bind.annotation.RequestMethod; 12 import org.springframework.web.bind.annotation.RequestMethod;
11 import org.springframework.web.bind.annotation.RequestParam; 13 import org.springframework.web.bind.annotation.RequestParam;
@@ -17,7 +19,8 @@ import java.util.Map; @@ -17,7 +19,8 @@ import java.util.Map;
17 /** 19 /**
18 * Created by xu on 16/12/15. 20 * Created by xu on 16/12/15.
19 */ 21 */
20 -@RestController(value = "carDeviceController_sc") 22 +@RestController("carDeviceController_sc")
  23 +@ConditionalOnMissingBean(CarDeviceController_facade.class)
21 @RequestMapping("cde_sc") 24 @RequestMapping("cde_sc")
22 public class CarDeviceController extends BController<CarDevice, Long> { 25 public class CarDeviceController extends BController<CarDevice, Long> {
23 @Autowired 26 @Autowired
src/main/java/com/bsth/controller/schedule/basicinfo/CarsController.java renamed to src/main/java/com/bsth/controller/schedule/basicinfo/legacy/CarsController.java
1 -package com.bsth.controller.schedule.basicinfo; 1 +package com.bsth.controller.schedule.basicinfo.legacy;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 4 import com.bsth.controller.schedule.BController;
  5 +import com.bsth.controller.schedule.basicinfo.CarController_facade;
5 import com.bsth.entity.Cars; 6 import com.bsth.entity.Cars;
6 import com.bsth.service.schedule.CarsService; 7 import com.bsth.service.schedule.CarsService;
7 import com.bsth.service.schedule.exception.ScheduleException; 8 import com.bsth.service.schedule.exception.ScheduleException;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
9 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
10 import org.springframework.web.bind.annotation.RequestMethod; 12 import org.springframework.web.bind.annotation.RequestMethod;
11 import org.springframework.web.bind.annotation.RequestParam; 13 import org.springframework.web.bind.annotation.RequestParam;
@@ -17,7 +19,8 @@ import java.util.Map; @@ -17,7 +19,8 @@ import java.util.Map;
17 /** 19 /**
18 * 车辆基础信息controller 20 * 车辆基础信息controller
19 */ 21 */
20 -@RestController(value = "carsController_sc") 22 +@RestController("carsController_sc")
  23 +@ConditionalOnMissingBean(CarController_facade.class)
21 @RequestMapping("cars_sc") 24 @RequestMapping("cars_sc")
22 public class CarsController extends BController<Cars, Integer> { 25 public class CarsController extends BController<Cars, Integer> {
23 @Autowired 26 @Autowired
src/main/java/com/bsth/controller/schedule/basicinfo/EmployeeController.java renamed to src/main/java/com/bsth/controller/schedule/basicinfo/legacy/EmployeeController.java
1 -package com.bsth.controller.schedule.basicinfo; 1 +package com.bsth.controller.schedule.basicinfo.legacy;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 4 import com.bsth.controller.schedule.BController;
  5 +import com.bsth.controller.schedule.basicinfo.EmployeeController_facade;
5 import com.bsth.entity.Personnel; 6 import com.bsth.entity.Personnel;
6 import com.bsth.service.schedule.EmployeeService; 7 import com.bsth.service.schedule.EmployeeService;
7 import com.bsth.service.schedule.exception.ScheduleException; 8 import com.bsth.service.schedule.exception.ScheduleException;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
9 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
10 import org.springframework.web.bind.annotation.RequestMethod; 12 import org.springframework.web.bind.annotation.RequestMethod;
11 import org.springframework.web.bind.annotation.RequestParam; 13 import org.springframework.web.bind.annotation.RequestParam;
@@ -18,6 +20,7 @@ import java.util.Map; @@ -18,6 +20,7 @@ import java.util.Map;
18 * 人员基础信息Controller 20 * 人员基础信息Controller
19 */ 21 */
20 @RestController 22 @RestController
  23 +@ConditionalOnMissingBean(EmployeeController_facade.class)
21 @RequestMapping("ee") 24 @RequestMapping("ee")
22 public class EmployeeController extends BController<Personnel, Integer> { 25 public class EmployeeController extends BController<Personnel, Integer> {
23 @Autowired 26 @Autowired
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController_facade.java 0 → 100644
  1 +package com.bsth.controller.schedule.core;
  2 +
  3 +import com.alibaba.dubbo.config.annotation.Reference;
  4 +import com.bsth.common.Constants;
  5 +import com.bsth.common.ResponseCode;
  6 +import com.bsth.control_v2.plan_module.common.config.springboot.dubbo.DubboConfigCondition;
  7 +import com.bsth.control_v2.plan_module.common.dto.baseinfo.CarDto;
  8 +import com.bsth.control_v2.plan_module.common.dto.baseinfo.LineDto;
  9 +import com.bsth.control_v2.plan_module.common.dto.schedule.config.VehicleConfigDto;
  10 +import com.bsth.control_v2.plan_module.common.dto.sys.CompanyAuthorityDto;
  11 +import com.bsth.control_v2.plan_module.common.dto.sys.UserDto;
  12 +import com.bsth.control_v2.plan_module.common.service.BServiceFacade;
  13 +import com.bsth.control_v2.plan_module.common.service.schedule.config.VehicleConfigServiceFacade;
  14 +import com.bsth.controller.schedule.BController_facade;
  15 +import com.bsth.entity.sys.CompanyAuthority;
  16 +import com.bsth.service.schedule.CarConfigInfoService;
  17 +import com.bsth.service.schedule.utils.DataToolsFile;
  18 +import org.apache.commons.lang3.StringUtils;
  19 +import org.apache.poi.ss.usermodel.Workbook;
  20 +import org.springframework.beans.factory.annotation.Autowired;
  21 +import org.springframework.context.annotation.Conditional;
  22 +import org.springframework.web.bind.annotation.RequestMapping;
  23 +import org.springframework.web.bind.annotation.RequestMethod;
  24 +import org.springframework.web.bind.annotation.RequestParam;
  25 +import org.springframework.web.bind.annotation.RestController;
  26 +import org.springframework.web.multipart.MultipartFile;
  27 +
  28 +import javax.servlet.http.HttpServletRequest;
  29 +import javax.servlet.http.HttpServletResponse;
  30 +import javax.servlet.http.HttpSession;
  31 +import java.io.*;
  32 +import java.util.*;
  33 +
  34 +/**
  35 + * Created by xu on 16/5/9.
  36 + */
  37 +@RestController
  38 +@Conditional(DubboConfigCondition.class)
  39 +@RequestMapping("cci")
  40 +public class CarConfigInfoController_facade extends BController_facade<Long, VehicleConfigDto> {
  41 +
  42 + @Override
  43 + public void setCreateUserInfo(VehicleConfigDto vehicleConfigDto, Integer userId, Date createDate) {
  44 + UserDto userDto = UserDto.getBuilder()
  45 + .setId(userId)
  46 + .build();
  47 + vehicleConfigDto.setCreateBy(userDto);
  48 + vehicleConfigDto.setCreateDate(createDate);
  49 + }
  50 +
  51 + @Override
  52 + public void setUpdateUserInfo(VehicleConfigDto vehicleConfigDto, Integer userId, Date updateDate) {
  53 + UserDto userDto = UserDto.getBuilder()
  54 + .setId(userId)
  55 + .build();
  56 + vehicleConfigDto.setUpdateBy(userDto);
  57 + vehicleConfigDto.setUpdateDate(updateDate);
  58 + }
  59 +
  60 + @Reference
  61 + private VehicleConfigServiceFacade vehicleConfigServiceFacade;
  62 +
  63 + @Override
  64 + protected BServiceFacade<Long, VehicleConfigDto> getBServiceFacade() {
  65 + return vehicleConfigServiceFacade;
  66 + }
  67 +
  68 + @RequestMapping(value = "/cars", method = RequestMethod.GET)
  69 + public List<Map<String, Object>> findCarConfigCars() {
  70 + return vehicleConfigServiceFacade.findCarsFromConfig_nbbm();
  71 + }
  72 +
  73 + @RequestMapping(value = "/cars2", method = RequestMethod.GET)
  74 + public List<Map<String, Object>> findCarsFromConfig() {
  75 + return vehicleConfigServiceFacade.findCarsFromConfig_insideCode();
  76 + }
  77 +
  78 + @RequestMapping(value = "/validate_cars", method = RequestMethod.GET)
  79 + public Map<String, Object> validate_cars(@RequestParam Map<String, Object> param) {
  80 + Map<String, Object> rtn = new HashMap<>();
  81 + try {
  82 + VehicleConfigDto vehicleConfigDto = VehicleConfigDto.getBuilder()
  83 + .setId(param.get("id_eq") == null ? null : Long.parseLong(param.get("id_eq").toString()))
  84 + .setXl(param.get("xl.id_eq") == null ? null : (
  85 + LineDto.getBuilder()
  86 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  87 + .setName(param.get("xl.name_eq").toString())
  88 + .build()
  89 + ))
  90 + .setCl(param.get("cl.id_eq") == null ? null : (
  91 + CarDto.getBuilder()
  92 + .setId(Integer.valueOf(param.get("cl.id_eq").toString()))
  93 + .build()
  94 + ))
  95 + .build();
  96 +
  97 + vehicleConfigServiceFacade.validate_already_config(vehicleConfigDto);
  98 + rtn.put("status", ResponseCode.SUCCESS);
  99 + } catch (Exception exp) {
  100 + rtn.put("status", ResponseCode.ERROR);
  101 + rtn.put("msg", exp.getMessage());
  102 + }
  103 +
  104 + return rtn;
  105 + }
  106 +
  107 + @RequestMapping(value = "/validate_cars_2", method = RequestMethod.GET)
  108 + public Map<String, Object> validate_cars(@RequestParam Integer xlId, @RequestParam Integer clId) {
  109 + Map<String, Object> rtn = new HashMap<>();
  110 + try {
  111 + VehicleConfigDto vehicleConfigDto = VehicleConfigDto.getBuilder()
  112 + .setXl(xlId == null ? null : (LineDto.getBuilder()
  113 + .setId(xlId)
  114 + .build()))
  115 + .setCl(clId == null ? null : (CarDto.getBuilder()
  116 + .setId(clId)
  117 + .build()))
  118 + .build();
  119 +
  120 + vehicleConfigServiceFacade.validate_already_config(vehicleConfigDto);
  121 + rtn.put("status", ResponseCode.SUCCESS);
  122 + } catch (Exception exp) {
  123 + rtn.put("status", ResponseCode.ERROR);
  124 + rtn.put("msg", exp.getMessage());
  125 + }
  126 +
  127 + return rtn;
  128 + }
  129 +
  130 + @RequestMapping(value = "/validate_cars_gs", method = RequestMethod.GET)
  131 + public Map<String, Object> validate_cars_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  132 + HttpSession session = request.getSession();
  133 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  134 + List<CompanyAuthorityDto> companyAuthorityDtoList = new ArrayList<>();
  135 + for (CompanyAuthority companyAuthority : cmyAuths) {
  136 + CompanyAuthorityDto companyAuthorityDto = CompanyAuthorityDto.getBuilder()
  137 + .setId(companyAuthority.getId())
  138 + .setCompanyCode(companyAuthority.getCompanyCode())
  139 + .setCompanyName(companyAuthority.getCompanyName())
  140 + .setSubCompanyCode(companyAuthority.getSubCompanyCode())
  141 + .setSubCompanyName(companyAuthority.getSubCompanyName())
  142 + .build();
  143 + companyAuthorityDtoList.add(companyAuthorityDto);
  144 + }
  145 +
  146 + Map<String, Object> rtn = new HashMap<>();
  147 + try {
  148 + VehicleConfigDto vehicleConfigDto = VehicleConfigDto.getBuilder()
  149 + .setXl(param.get("xl.id_eq") == null ? null : (
  150 + LineDto.getBuilder()
  151 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  152 + .setName(param.get("xl.name_eq").toString())
  153 + .build()
  154 + ))
  155 + .setCl(param.get("cl.id_eq") == null ? null : (
  156 + CarDto.getBuilder()
  157 + .setId(Integer.valueOf(param.get("cl.id_eq").toString()))
  158 + .build()
  159 + ))
  160 + .build();
  161 +
  162 + vehicleConfigServiceFacade.validate_cars_gs(vehicleConfigDto, companyAuthorityDtoList);
  163 + rtn.put("status", ResponseCode.SUCCESS);
  164 + } catch (Exception exp) {
  165 + rtn.put("status", ResponseCode.ERROR);
  166 + rtn.put("msg", exp.getMessage());
  167 + }
  168 +
  169 + return rtn;
  170 + }
  171 +
  172 + @RequestMapping(value = "/validate_cars_fgs", method = RequestMethod.GET)
  173 + public Map<String, Object> validate_cars_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  174 + HttpSession session = request.getSession();
  175 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  176 + List<CompanyAuthorityDto> companyAuthorityDtoList = new ArrayList<>();
  177 + for (CompanyAuthority companyAuthority : cmyAuths) {
  178 + CompanyAuthorityDto companyAuthorityDto = CompanyAuthorityDto.getBuilder()
  179 + .setId(companyAuthority.getId())
  180 + .setCompanyCode(companyAuthority.getCompanyCode())
  181 + .setCompanyName(companyAuthority.getCompanyName())
  182 + .setSubCompanyCode(companyAuthority.getSubCompanyCode())
  183 + .setSubCompanyName(companyAuthority.getSubCompanyName())
  184 + .build();
  185 + companyAuthorityDtoList.add(companyAuthorityDto);
  186 + }
  187 +
  188 + Map<String, Object> rtn = new HashMap<>();
  189 + try {
  190 + VehicleConfigDto vehicleConfigDto = VehicleConfigDto.getBuilder()
  191 + .setXl(param.get("xl.id_eq") == null ? null : (
  192 + LineDto.getBuilder()
  193 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  194 + .setName(param.get("xl.name_eq").toString())
  195 + .build()
  196 + ))
  197 + .setCl(param.get("cl.id_eq") == null ? null : (
  198 + CarDto.getBuilder()
  199 + .setId(Integer.valueOf(param.get("cl.id_eq").toString()))
  200 + .build()
  201 + ))
  202 + .build();
  203 +
  204 + vehicleConfigServiceFacade.validate_cars_fgs(vehicleConfigDto, companyAuthorityDtoList);
  205 + rtn.put("status", ResponseCode.SUCCESS);
  206 + } catch (Exception exp) {
  207 + rtn.put("status", ResponseCode.ERROR);
  208 + rtn.put("msg", exp.getMessage());
  209 + }
  210 +
  211 + return rtn;
  212 + }
  213 +
  214 + @RequestMapping(value = "/validate_cars_config", method = RequestMethod.GET)
  215 + public Map<String, Object> validate_cars_config(@RequestParam Map<String, Object> param) {
  216 + Map<String, Object> rtn = new HashMap<>();
  217 + try {
  218 + VehicleConfigDto vehicleConfigDto = VehicleConfigDto.getBuilder()
  219 + .setXl(param.get("xl.id_eq") == null ? null : (
  220 + LineDto.getBuilder()
  221 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  222 + .setName(param.get("xl.name_eq").toString())
  223 + .build()
  224 + ))
  225 + .setCl(param.get("cl.id_eq") == null ? null : (
  226 + CarDto.getBuilder()
  227 + .setId(Integer.valueOf(param.get("cl.id_eq").toString()))
  228 + .build()
  229 + ))
  230 + .build();
  231 + vehicleConfigServiceFacade.validate_config_exist(vehicleConfigDto);
  232 + rtn.put("status", ResponseCode.SUCCESS);
  233 + } catch (Exception exp) {
  234 + rtn.put("status", ResponseCode.ERROR);
  235 + rtn.put("msg", exp.getMessage());
  236 + }
  237 +
  238 + return rtn;
  239 + }
  240 +
  241 + //------------------ TODO:导入导出逻辑,之后会服务化 -----------------//
  242 + @Autowired
  243 + private CarConfigInfoService carConfigInfoService;
  244 + // 上传excel文件
  245 + @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
  246 + public Map<String, Object> uploadFile(MultipartFile file) {
  247 + Map<String, Object> rtn = new HashMap<>();
  248 + try {
  249 + DataToolsFile dataToolsFile = carConfigInfoService.uploadFile(file.getOriginalFilename(), file.getBytes());
  250 + // excel文件名
  251 + String fileName = dataToolsFile.getFile().getAbsolutePath();
  252 + Workbook wb = dataToolsFile.getFileType().getWorkBook(dataToolsFile.getFile());
  253 +
  254 + // excel文件sheet
  255 + List<String> sheetnames = new ArrayList<>();
  256 + for (int i = 0; i < wb.getNumberOfSheets(); i ++) {
  257 + sheetnames.add(wb.getSheetAt(i).getSheetName());
  258 + }
  259 +
  260 + wb.close();
  261 +
  262 + rtn.put("status", ResponseCode.SUCCESS);
  263 + rtn.put("filename", fileName);
  264 + rtn.put("sheetnames", StringUtils.join(sheetnames, ","));
  265 + } catch (Exception exp) {
  266 + exp.printStackTrace();
  267 + rtn.put("status", ResponseCode.ERROR);
  268 + rtn.put("msg", exp.getMessage());
  269 + }
  270 + return rtn;
  271 + }
  272 + // 导入excel文件
  273 + @RequestMapping(value = "/importFile", method = RequestMethod.POST)
  274 + public Map<String, Object> importFile(@RequestParam Map<String, Object> params) {
  275 + Map<String, Object> rtn = new HashMap<>();
  276 +
  277 + try {
  278 + File file = new File(String.valueOf(params.get("filename")));
  279 + if (!file.exists()) {
  280 + throw new Exception("导入文件不存在!");
  281 + }
  282 + carConfigInfoService.importData(file, params);
  283 +
  284 + rtn.put("status", ResponseCode.SUCCESS);
  285 + rtn.put("msg", "导入文件成功");
  286 + } catch (Exception exp) {
  287 + rtn.put("status", ResponseCode.ERROR);
  288 + rtn.put("msg", exp.getMessage());
  289 + }
  290 +
  291 + return rtn;
  292 + }
  293 + // 上传并导入excel文件
  294 + @RequestMapping(value = "/uploadAndImportFile", method = RequestMethod.POST)
  295 + public Map<String, Object> uploadAndImportFile(MultipartFile file) {
  296 + Map<String, Object> rtn = new HashMap<>();
  297 +
  298 + try {
  299 + DataToolsFile dataToolsFile = carConfigInfoService.uploadFile(file.getOriginalFilename(), file.getBytes());
  300 + Map<String, Object> params = new HashMap<>();
  301 + carConfigInfoService.importData(dataToolsFile.getFile(), params);
  302 +
  303 + rtn.put("status", ResponseCode.SUCCESS);
  304 + rtn.put("msg", "上传&导入文件成功");
  305 + } catch (Exception exp) {
  306 + exp.printStackTrace();
  307 + rtn.put("status", ResponseCode.ERROR);
  308 + rtn.put("msg", exp.getMessage());
  309 + }
  310 +
  311 + return rtn;
  312 + }
  313 +
  314 + // 导出数据到xls文件
  315 + @RequestMapping(value = "/exportFile", method = RequestMethod.GET)
  316 + public void exportFile(HttpServletResponse response,
  317 + @RequestParam Map<String, Object> params) throws Exception {
  318 + DataToolsFile dataToolsFile = carConfigInfoService.exportData(params);
  319 + // 流输出导出文件
  320 + response.setHeader("content-type", "application/octet-stream");
  321 + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName());
  322 + response.setContentType("application/octet-stream");
  323 +
  324 + OutputStream os = response.getOutputStream();
  325 + BufferedOutputStream bos = new BufferedOutputStream(os);
  326 +
  327 + InputStream is = new FileInputStream(dataToolsFile.getFile());
  328 + BufferedInputStream bis = new BufferedInputStream(is);
  329 +
  330 + int length = 0;
  331 + byte[] temp = new byte[1 * 1024 * 10];
  332 + while ((length = bis.read(temp)) != -1) {
  333 + bos.write(temp, 0, length);
  334 + }
  335 + bos.flush();
  336 + bis.close();
  337 + bos.close();
  338 + is.close();
  339 + }
  340 +
  341 +
  342 +}
src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController_facade.java 0 → 100644
  1 +package com.bsth.controller.schedule.core;
  2 +
  3 +import com.alibaba.dubbo.config.annotation.Reference;
  4 +import com.bsth.common.Constants;
  5 +import com.bsth.common.ResponseCode;
  6 +import com.bsth.control_v2.plan_module.common.config.springboot.dubbo.DubboConfigCondition;
  7 +import com.bsth.control_v2.plan_module.common.dto.baseinfo.LineDto;
  8 +import com.bsth.control_v2.plan_module.common.dto.baseinfo.PersonnelDto;
  9 +import com.bsth.control_v2.plan_module.common.dto.schedule.config.EmployeeConfigDto;
  10 +import com.bsth.control_v2.plan_module.common.dto.sys.CompanyAuthorityDto;
  11 +import com.bsth.control_v2.plan_module.common.dto.sys.UserDto;
  12 +import com.bsth.control_v2.plan_module.common.service.BServiceFacade;
  13 +import com.bsth.control_v2.plan_module.common.service.schedule.config.EmployeeConfigServiceFacade;
  14 +import com.bsth.controller.schedule.BController_facade;
  15 +import com.bsth.entity.sys.CompanyAuthority;
  16 +import com.bsth.service.schedule.EmployeeConfigInfoService;
  17 +import com.bsth.service.schedule.utils.DataToolsFile;
  18 +import org.apache.commons.lang3.StringUtils;
  19 +import org.apache.poi.ss.usermodel.Workbook;
  20 +import org.springframework.beans.factory.annotation.Autowired;
  21 +import org.springframework.context.annotation.Conditional;
  22 +import org.springframework.web.bind.annotation.*;
  23 +import org.springframework.web.multipart.MultipartFile;
  24 +
  25 +import javax.servlet.http.HttpServletRequest;
  26 +import javax.servlet.http.HttpServletResponse;
  27 +import javax.servlet.http.HttpSession;
  28 +import java.io.*;
  29 +import java.util.*;
  30 +
  31 +/**
  32 + * Created by xu on 16/5/10.
  33 + */
  34 +@RestController
  35 +@Conditional(DubboConfigCondition.class)
  36 +@RequestMapping("eci")
  37 +public class EmployeeConfigInfoController_facade extends BController_facade<Long, EmployeeConfigDto> {
  38 +
  39 + @Override
  40 + public void setCreateUserInfo(EmployeeConfigDto employeeConfigDto, Integer userId, Date createDate) {
  41 + UserDto userDto = UserDto.getBuilder()
  42 + .setId(userId)
  43 + .build();
  44 + employeeConfigDto.setCreateBy(userDto);
  45 + employeeConfigDto.setCreateDate(createDate);
  46 + }
  47 +
  48 + @Override
  49 + public void setUpdateUserInfo(EmployeeConfigDto employeeConfigDto, Integer userId, Date updateDate) {
  50 + UserDto userDto = UserDto.getBuilder()
  51 + .setId(userId)
  52 + .build();
  53 + employeeConfigDto.setUpdateBy(userDto);
  54 + employeeConfigDto.setUpdateDate(updateDate);
  55 + }
  56 +
  57 + @Reference
  58 + private EmployeeConfigServiceFacade employeeConfigServiceFacade;
  59 +
  60 + @Override
  61 + protected BServiceFacade<Long, EmployeeConfigDto> getBServiceFacade() {
  62 + return employeeConfigServiceFacade;
  63 + }
  64 +
  65 + @RequestMapping(value = "/jsy", method = RequestMethod.GET)
  66 + public List<Map<String, Object>> findJsyFromConfig() {
  67 + return employeeConfigServiceFacade.findJsyFromConfig();
  68 + }
  69 +
  70 + @RequestMapping(value = "/spy", method = RequestMethod.GET)
  71 + public List<Map<String, Object>> findSpyFromConfig() {
  72 + return employeeConfigServiceFacade.findSpyFromConfig();
  73 + }
  74 +
  75 +
  76 + @RequestMapping(value = "/dbbm/{xlid}", method = RequestMethod.GET)
  77 + public Map<String, Object> getDbbm(@PathVariable("xlid") Integer xl) {
  78 + Map<String, Object> rtn = new HashMap<>();
  79 + try {
  80 + rtn.put("data", employeeConfigServiceFacade.getMaxDbbm(xl));
  81 + rtn.put("status", ResponseCode.SUCCESS);
  82 + } catch (Exception exp) {
  83 + exp.printStackTrace();
  84 + rtn.put("status", ResponseCode.ERROR);
  85 + rtn.put("msg", exp.getMessage());
  86 + }
  87 + return rtn;
  88 + }
  89 +
  90 + @RequestMapping(value = "/validate_jsy", method = RequestMethod.GET)
  91 + public Map<String, Object> validate_jsy(@RequestParam Map<String, Object> param) {
  92 + Map<String, Object> rtn = new HashMap<>();
  93 + try {
  94 + EmployeeConfigDto employeeConfigDto = EmployeeConfigDto.getBuilder()
  95 + .setId(param.get("id_eq") == null ? null : Long.parseLong(param.get("id_eq").toString()))
  96 + .setXl(param.get("xl.id_eq") == null ? null : (
  97 + LineDto.getBuilder()
  98 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  99 + .setName(param.get("xl.name_eq").toString())
  100 + .build()
  101 + ))
  102 + .setJsy(param.get("jsy.id_eq") == null ? null : (
  103 + PersonnelDto.getBuilder()
  104 + .setId(Integer.valueOf(param.get("jsy.id_eq").toString()))
  105 + .build()
  106 + ))
  107 + .build();
  108 + employeeConfigServiceFacade.validate_jsy_duplicate_without_current(employeeConfigDto);
  109 + rtn.put("status", ResponseCode.SUCCESS);
  110 + } catch (Exception exp) {
  111 + rtn.put("status", ResponseCode.ERROR);
  112 + rtn.put("msg", exp.getMessage());
  113 + }
  114 +
  115 + return rtn;
  116 + }
  117 +
  118 + @RequestMapping(value = "/validate_jsy_config", method = RequestMethod.GET)
  119 + public Map<String, Object> validate_jsy_config(@RequestParam Map<String, Object> param) {
  120 + Map<String, Object> rtn = new HashMap<>();
  121 + try {
  122 + EmployeeConfigDto employeeConfigDto = EmployeeConfigDto.getBuilder()
  123 + .setXl(param.get("xl.id_eq") == null ? null : (
  124 + LineDto.getBuilder()
  125 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  126 + .setName(param.get("xl.name_eq").toString())
  127 + .build()
  128 + ))
  129 + .setJsy(param.get("jsy.id_eq") == null ? null : (
  130 + PersonnelDto.getBuilder()
  131 + .setId(Integer.valueOf(param.get("jsy.id_eq").toString()))
  132 + .build()
  133 + ))
  134 + .build();
  135 + employeeConfigServiceFacade.validate_jsy_exist(employeeConfigDto);
  136 + rtn.put("status", ResponseCode.SUCCESS);
  137 + } catch (Exception exp) {
  138 + rtn.put("status", ResponseCode.ERROR);
  139 + rtn.put("msg", exp.getMessage());
  140 + }
  141 +
  142 + return rtn;
  143 + }
  144 +
  145 + @RequestMapping(value = "/validate_jsy_gs", method = RequestMethod.GET)
  146 + public Map<String, Object> validate_jsy_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  147 + HttpSession session = request.getSession();
  148 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  149 + List<CompanyAuthorityDto> companyAuthorityDtoList = new ArrayList<>();
  150 + for (CompanyAuthority companyAuthority : cmyAuths) {
  151 + CompanyAuthorityDto companyAuthorityDto = CompanyAuthorityDto.getBuilder()
  152 + .setId(companyAuthority.getId())
  153 + .setCompanyCode(companyAuthority.getCompanyCode())
  154 + .setCompanyName(companyAuthority.getCompanyName())
  155 + .setSubCompanyCode(companyAuthority.getSubCompanyCode())
  156 + .setSubCompanyName(companyAuthority.getSubCompanyName())
  157 + .build();
  158 + companyAuthorityDtoList.add(companyAuthorityDto);
  159 + }
  160 +
  161 + Map<String, Object> rtn = new HashMap<>();
  162 + try {
  163 + EmployeeConfigDto employeeConfigDto = EmployeeConfigDto.getBuilder()
  164 + .setXl(param.get("xl.id_eq") == null ? null : (
  165 + LineDto.getBuilder()
  166 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  167 + .setName(param.get("xl.name_eq").toString())
  168 + .build()
  169 + ))
  170 + .setJsy(param.get("jsy.id_eq") == null ? null : (
  171 + PersonnelDto.getBuilder()
  172 + .setId(Integer.valueOf(param.get("jsy.id_eq").toString()))
  173 + .build()
  174 + ))
  175 + .build();
  176 + employeeConfigServiceFacade.validate_jsy_gs_authority(employeeConfigDto, companyAuthorityDtoList);
  177 + rtn.put("status", ResponseCode.SUCCESS);
  178 + } catch (Exception exp) {
  179 + rtn.put("status", ResponseCode.ERROR);
  180 + rtn.put("msg", exp.getMessage());
  181 + }
  182 +
  183 + return rtn;
  184 + }
  185 +
  186 + @RequestMapping(value = "/validate_jsy_fgs", method = RequestMethod.GET)
  187 + public Map<String, Object> validate_jsy_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  188 + HttpSession session = request.getSession();
  189 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  190 + List<CompanyAuthorityDto> companyAuthorityDtoList = new ArrayList<>();
  191 + for (CompanyAuthority companyAuthority : cmyAuths) {
  192 + CompanyAuthorityDto companyAuthorityDto = CompanyAuthorityDto.getBuilder()
  193 + .setId(companyAuthority.getId())
  194 + .setCompanyCode(companyAuthority.getCompanyCode())
  195 + .setCompanyName(companyAuthority.getCompanyName())
  196 + .setSubCompanyCode(companyAuthority.getSubCompanyCode())
  197 + .setSubCompanyName(companyAuthority.getSubCompanyName())
  198 + .build();
  199 + companyAuthorityDtoList.add(companyAuthorityDto);
  200 + }
  201 +
  202 + Map<String, Object> rtn = new HashMap<>();
  203 + try {
  204 + EmployeeConfigDto employeeConfigDto = EmployeeConfigDto.getBuilder()
  205 + .setXl(param.get("xl.id_eq") == null ? null : (
  206 + LineDto.getBuilder()
  207 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  208 + .setName(param.get("xl.name_eq").toString())
  209 + .build()
  210 + ))
  211 + .setJsy(param.get("jsy.id_eq") == null ? null : (
  212 + PersonnelDto.getBuilder()
  213 + .setId(Integer.valueOf(param.get("jsy.id_eq").toString()))
  214 + .build()
  215 + ))
  216 + .build();
  217 + employeeConfigServiceFacade.validate_jsy_fgs_authority(employeeConfigDto, companyAuthorityDtoList);
  218 + rtn.put("status", ResponseCode.SUCCESS);
  219 + } catch (Exception exp) {
  220 + rtn.put("status", ResponseCode.ERROR);
  221 + rtn.put("msg", exp.getMessage());
  222 + }
  223 +
  224 + return rtn;
  225 + }
  226 +
  227 + @RequestMapping(value = "/validate_spy", method = RequestMethod.GET)
  228 + public Map<String, Object> validate_spy(@RequestParam Map<String, Object> param) {
  229 + Map<String, Object> rtn = new HashMap<>();
  230 + try {
  231 + EmployeeConfigDto employeeConfigDto = EmployeeConfigDto.getBuilder()
  232 + .setId(param.get("id_eq") == null ? null : Long.parseLong(param.get("id_eq").toString()))
  233 + .setXl(param.get("xl.id_eq") == null ? null : (
  234 + LineDto.getBuilder()
  235 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  236 + .setName(param.get("xl.name_eq").toString())
  237 + .build()
  238 + ))
  239 + .setSpy(param.get("spy.id_eq") == null ? null : (
  240 + PersonnelDto.getBuilder()
  241 + .setId(Integer.valueOf(param.get("spy.id_eq").toString()))
  242 + .build()
  243 + ))
  244 + .build();
  245 + employeeConfigServiceFacade.validate_spy_duplicate_without_current(employeeConfigDto);
  246 + rtn.put("status", ResponseCode.SUCCESS);
  247 + } catch (Exception exp) {
  248 + rtn.put("status", ResponseCode.ERROR);
  249 + rtn.put("msg", exp.getMessage());
  250 + }
  251 + return rtn;
  252 + }
  253 +
  254 + @RequestMapping(value = "/validate_spy_config", method = RequestMethod.GET)
  255 + public Map<String, Object> validate_spy_config(@RequestParam Map<String, Object> param) {
  256 + Map<String, Object> rtn = new HashMap<>();
  257 + try {
  258 + EmployeeConfigDto employeeConfigDto = EmployeeConfigDto.getBuilder()
  259 + .setXl(param.get("xl.id_eq") == null ? null : (
  260 + LineDto.getBuilder()
  261 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  262 + .setName(param.get("xl.name_eq").toString())
  263 + .build()
  264 + ))
  265 + .setSpy(param.get("spy.id_eq") == null ? null : (
  266 + PersonnelDto.getBuilder()
  267 + .setId(Integer.valueOf(param.get("spy.id_eq").toString()))
  268 + .build()
  269 + ))
  270 + .build();
  271 + employeeConfigServiceFacade.validate_spy_exist(employeeConfigDto);
  272 + rtn.put("status", ResponseCode.SUCCESS);
  273 + } catch (Exception exp) {
  274 + rtn.put("status", ResponseCode.ERROR);
  275 + rtn.put("msg", exp.getMessage());
  276 + }
  277 + return rtn;
  278 + }
  279 +
  280 + @RequestMapping(value = "/validate_spy_gs", method = RequestMethod.GET)
  281 + public Map<String, Object> validate_spy_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  282 + HttpSession session = request.getSession();
  283 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  284 + List<CompanyAuthorityDto> companyAuthorityDtoList = new ArrayList<>();
  285 + for (CompanyAuthority companyAuthority : cmyAuths) {
  286 + CompanyAuthorityDto companyAuthorityDto = CompanyAuthorityDto.getBuilder()
  287 + .setId(companyAuthority.getId())
  288 + .setCompanyCode(companyAuthority.getCompanyCode())
  289 + .setCompanyName(companyAuthority.getCompanyName())
  290 + .setSubCompanyCode(companyAuthority.getSubCompanyCode())
  291 + .setSubCompanyName(companyAuthority.getSubCompanyName())
  292 + .build();
  293 + companyAuthorityDtoList.add(companyAuthorityDto);
  294 + }
  295 +
  296 + Map<String, Object> rtn = new HashMap<>();
  297 + try {
  298 + EmployeeConfigDto employeeConfigDto = EmployeeConfigDto.getBuilder()
  299 + .setXl(param.get("xl.id_eq") == null ? null : (
  300 + LineDto.getBuilder()
  301 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  302 + .setName(param.get("xl.name_eq").toString())
  303 + .build()
  304 + ))
  305 + .setSpy(param.get("spy.id_eq") == null ? null : (
  306 + PersonnelDto.getBuilder()
  307 + .setId(Integer.valueOf(param.get("spy.id_eq").toString()))
  308 + .build()
  309 + ))
  310 + .build();
  311 + employeeConfigServiceFacade.validate_spy_gs_authority(employeeConfigDto, companyAuthorityDtoList);
  312 + rtn.put("status", ResponseCode.SUCCESS);
  313 + } catch (Exception exp) {
  314 + rtn.put("status", ResponseCode.ERROR);
  315 + rtn.put("msg", exp.getMessage());
  316 + }
  317 + return rtn;
  318 + }
  319 +
  320 + @RequestMapping(value = "/validate_spy_fgs", method = RequestMethod.GET)
  321 + public Map<String, Object> validate_spy_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  322 + HttpSession session = request.getSession();
  323 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  324 + List<CompanyAuthorityDto> companyAuthorityDtoList = new ArrayList<>();
  325 + for (CompanyAuthority companyAuthority : cmyAuths) {
  326 + CompanyAuthorityDto companyAuthorityDto = CompanyAuthorityDto.getBuilder()
  327 + .setId(companyAuthority.getId())
  328 + .setCompanyCode(companyAuthority.getCompanyCode())
  329 + .setCompanyName(companyAuthority.getCompanyName())
  330 + .setSubCompanyCode(companyAuthority.getSubCompanyCode())
  331 + .setSubCompanyName(companyAuthority.getSubCompanyName())
  332 + .build();
  333 + companyAuthorityDtoList.add(companyAuthorityDto);
  334 + }
  335 +
  336 + Map<String, Object> rtn = new HashMap<>();
  337 + try {
  338 + EmployeeConfigDto employeeConfigDto = EmployeeConfigDto.getBuilder()
  339 + .setXl(param.get("xl.id_eq") == null ? null : (
  340 + LineDto.getBuilder()
  341 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  342 + .setName(param.get("xl.name_eq").toString())
  343 + .build()
  344 + ))
  345 + .setSpy(param.get("spy.id_eq") == null ? null : (
  346 + PersonnelDto.getBuilder()
  347 + .setId(Integer.valueOf(param.get("spy.id_eq").toString()))
  348 + .build()
  349 + ))
  350 + .build();
  351 + employeeConfigServiceFacade.validate_spy_fgs_authority(employeeConfigDto, companyAuthorityDtoList);
  352 + rtn.put("status", ResponseCode.SUCCESS);
  353 + } catch (Exception exp) {
  354 + rtn.put("status", ResponseCode.ERROR);
  355 + rtn.put("msg", exp.getMessage());
  356 + }
  357 + return rtn;
  358 + }
  359 +
  360 + //------------------ TODO:导入导出逻辑,之后会服务化 -----------------//
  361 + @Autowired
  362 + private EmployeeConfigInfoService employeeConfigInfoService;
  363 + // 上传excel文件
  364 + @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
  365 + public Map<String, Object> uploadFile(MultipartFile file) {
  366 + Map<String, Object> rtn = new HashMap<>();
  367 + try {
  368 + DataToolsFile dataToolsFile = employeeConfigInfoService.uploadFile(file.getOriginalFilename(), file.getBytes());
  369 + // excel文件名
  370 + String fileName = dataToolsFile.getFile().getAbsolutePath();
  371 + Workbook wb = dataToolsFile.getFileType().getWorkBook(dataToolsFile.getFile());
  372 +
  373 + // excel文件sheet
  374 + List<String> sheetnames = new ArrayList<>();
  375 + for (int i = 0; i < wb.getNumberOfSheets(); i ++) {
  376 + sheetnames.add(wb.getSheetAt(i).getSheetName());
  377 + }
  378 +
  379 + wb.close();
  380 +
  381 + rtn.put("status", ResponseCode.SUCCESS);
  382 + rtn.put("filename", fileName);
  383 + rtn.put("sheetnames", StringUtils.join(sheetnames, ","));
  384 + } catch (Exception exp) {
  385 + exp.printStackTrace();
  386 + rtn.put("status", ResponseCode.ERROR);
  387 + rtn.put("msg", exp.getMessage());
  388 + }
  389 + return rtn;
  390 + }
  391 + // 导入excel文件
  392 + @RequestMapping(value = "/importFile", method = RequestMethod.POST)
  393 + public Map<String, Object> importFile(@RequestParam Map<String, Object> params) {
  394 + Map<String, Object> rtn = new HashMap<>();
  395 +
  396 + try {
  397 + File file = new File(String.valueOf(params.get("filename")));
  398 + if (!file.exists()) {
  399 + throw new Exception("导入文件不存在!");
  400 + }
  401 + employeeConfigInfoService.importData(file, params);
  402 +
  403 + rtn.put("status", ResponseCode.SUCCESS);
  404 + rtn.put("msg", "导入文件成功");
  405 + } catch (Exception exp) {
  406 + rtn.put("status", ResponseCode.ERROR);
  407 + rtn.put("msg", exp.getMessage());
  408 + }
  409 +
  410 + return rtn;
  411 + }
  412 + // 上传并导入excel文件
  413 + @RequestMapping(value = "/uploadAndImportFile", method = RequestMethod.POST)
  414 + public Map<String, Object> uploadAndImportFile(MultipartFile file) {
  415 + Map<String, Object> rtn = new HashMap<>();
  416 +
  417 + try {
  418 + DataToolsFile dataToolsFile = employeeConfigInfoService.uploadFile(file.getOriginalFilename(), file.getBytes());
  419 + Map<String, Object> params = new HashMap<>();
  420 + employeeConfigInfoService.importData(dataToolsFile.getFile(), params);
  421 +
  422 + rtn.put("status", ResponseCode.SUCCESS);
  423 + rtn.put("msg", "上传&导入文件成功");
  424 + } catch (Exception exp) {
  425 + exp.printStackTrace();
  426 + rtn.put("status", ResponseCode.ERROR);
  427 + rtn.put("msg", exp.getMessage());
  428 + }
  429 +
  430 + return rtn;
  431 + }
  432 +
  433 + // 导出数据到xls文件
  434 + @RequestMapping(value = "/exportFile", method = RequestMethod.GET)
  435 + public void exportFile(HttpServletResponse response,
  436 + @RequestParam Map<String, Object> params) throws Exception {
  437 + DataToolsFile dataToolsFile = employeeConfigInfoService.exportData(params);
  438 + // 流输出导出文件
  439 + response.setHeader("content-type", "application/octet-stream");
  440 + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName());
  441 + response.setContentType("application/octet-stream");
  442 +
  443 + OutputStream os = response.getOutputStream();
  444 + BufferedOutputStream bos = new BufferedOutputStream(os);
  445 +
  446 + InputStream is = new FileInputStream(dataToolsFile.getFile());
  447 + BufferedInputStream bis = new BufferedInputStream(is);
  448 +
  449 + int length = 0;
  450 + byte[] temp = new byte[1 * 1024 * 10];
  451 + while ((length = bis.read(temp)) != -1) {
  452 + bos.write(temp, 0, length);
  453 + }
  454 + bos.flush();
  455 + bis.close();
  456 + bos.close();
  457 + is.close();
  458 + }
  459 +
  460 +
  461 +}
src/main/java/com/bsth/controller/schedule/core/GuideboardInfoController_facade.java 0 → 100644
  1 +package com.bsth.controller.schedule.core;
  2 +
  3 +import com.alibaba.dubbo.config.annotation.Reference;
  4 +import com.bsth.common.ResponseCode;
  5 +import com.bsth.control_v2.plan_module.common.config.springboot.dubbo.DubboConfigCondition;
  6 +import com.bsth.control_v2.plan_module.common.dto.baseinfo.LineDto;
  7 +import com.bsth.control_v2.plan_module.common.dto.schedule.config.LpConfigDto;
  8 +import com.bsth.control_v2.plan_module.common.dto.sys.UserDto;
  9 +import com.bsth.control_v2.plan_module.common.service.BServiceFacade;
  10 +import com.bsth.control_v2.plan_module.common.service.schedule.config.LpConfigServiceFacade;
  11 +import com.bsth.controller.schedule.BController_facade;
  12 +import com.bsth.service.schedule.GuideboardInfoService;
  13 +import com.bsth.service.schedule.utils.DataToolsFile;
  14 +import org.apache.commons.lang3.StringUtils;
  15 +import org.apache.poi.ss.usermodel.Workbook;
  16 +import org.springframework.beans.factory.annotation.Autowired;
  17 +import org.springframework.context.annotation.Conditional;
  18 +import org.springframework.web.bind.annotation.*;
  19 +import org.springframework.web.multipart.MultipartFile;
  20 +
  21 +import javax.servlet.http.HttpServletResponse;
  22 +import java.io.*;
  23 +import java.util.*;
  24 +
  25 +/**
  26 + * 路牌管理控制器。
  27 + */
  28 +@RestController
  29 +@Conditional(DubboConfigCondition.class)
  30 +@RequestMapping("gic")
  31 +public class GuideboardInfoController_facade extends BController_facade<Long, LpConfigDto> {
  32 + @Override
  33 + public void setCreateUserInfo(LpConfigDto lpConfigDto, Integer userId, Date createDate) {
  34 + UserDto userDto = UserDto.getBuilder()
  35 + .setId(userId)
  36 + .build();
  37 + lpConfigDto.setCreateBy(userDto);
  38 + lpConfigDto.setCreateDate(createDate);
  39 + }
  40 +
  41 + @Override
  42 + public void setUpdateUserInfo(LpConfigDto lpConfigDto, Integer userId, Date updateDate) {
  43 + UserDto userDto = UserDto.getBuilder()
  44 + .setId(userId)
  45 + .build();
  46 + lpConfigDto.setUpdateBy(userDto);
  47 + lpConfigDto.setUpdateDate(updateDate);
  48 + }
  49 +
  50 + @Reference
  51 + private LpConfigServiceFacade lpConfigServiceFacade;
  52 +
  53 + @Override
  54 + protected BServiceFacade<Long, LpConfigDto> getBServiceFacade() {
  55 + return lpConfigServiceFacade;
  56 + }
  57 +
  58 + @RequestMapping(value = "/ttlpnames", method = RequestMethod.GET)
  59 + public List<Map<String, Object>> findLpName(Long ttid) {
  60 + return lpConfigServiceFacade.findLpName_from_ttinfo(ttid);
  61 + }
  62 +
  63 + @RequestMapping(value = "lpno/{xlid}", method = RequestMethod.GET)
  64 + public Map<String, Object> getLpNo(@PathVariable("xlid") Integer xl) {
  65 + Map<String, Object> rtn = new HashMap<>();
  66 + try {
  67 + rtn.put("data", lpConfigServiceFacade.getMaxLpno(xl));
  68 + rtn.put("status", ResponseCode.SUCCESS);
  69 + } catch (Exception exp) {
  70 + exp.printStackTrace();
  71 + rtn.put("status", ResponseCode.ERROR);
  72 + rtn.put("msg", exp.getMessage());
  73 + }
  74 +
  75 + return rtn;
  76 + }
  77 +
  78 + @RequestMapping(value = "/validate_lpno", method = RequestMethod.GET)
  79 + public Map<String, Object> validate_lpno(@RequestParam Map<String, Object> param) {
  80 + Map<String, Object> rtn = new HashMap<>();
  81 + try {
  82 + LpConfigDto lpConfigDto = LpConfigDto.getBuilder()
  83 + .setId(param.get("id_eq") == null ? null : Long.valueOf(param.get("id_eq").toString()))
  84 + .setXl(param.get("xl.id_eq") == null ? null : (
  85 + LineDto.getBuilder()
  86 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  87 + .build()
  88 + ))
  89 + .setLpNo(param.get("lpNo_eq") == null ? null : Integer.valueOf(param.get("lpNo_eq").toString()))
  90 + .build();
  91 + lpConfigServiceFacade.validate_lpno_duplicate(lpConfigDto);
  92 + rtn.put("status", ResponseCode.SUCCESS);
  93 + } catch (Exception exp) {
  94 + rtn.put("status", ResponseCode.ERROR);
  95 + rtn.put("msg", exp.getMessage());
  96 + }
  97 + return rtn;
  98 + }
  99 +
  100 + @RequestMapping(value = "/validate_lpname", method = RequestMethod.GET)
  101 + public Map<String, Object> validate_lpname(@RequestParam Map<String, Object> param) {
  102 + Map<String, Object> rtn = new HashMap<>();
  103 + try {
  104 + LpConfigDto lpConfigDto = LpConfigDto.getBuilder()
  105 + .setId(param.get("id_eq") == null ? null : Long.valueOf(param.get("id_eq").toString()))
  106 + .setXl(param.get("xl.id_eq") == null ? null : (
  107 + LineDto.getBuilder()
  108 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  109 + .build()
  110 + ))
  111 + .setLpName(param.get("lpName_eq") == null ? null : param.get("lpName_eq").toString())
  112 + .build();
  113 + lpConfigServiceFacade.validate_lpname_duplicate(lpConfigDto);
  114 + rtn.put("status", ResponseCode.SUCCESS);
  115 + } catch (Exception exp) {
  116 + rtn.put("status", ResponseCode.ERROR);
  117 + rtn.put("msg", exp.getMessage());
  118 + }
  119 + return rtn;
  120 + }
  121 +
  122 + //------------------ TODO:导入导出逻辑,之后会服务化 -----------------//
  123 + @Autowired
  124 + private GuideboardInfoService guideboardInfoService;
  125 + // 上传excel文件
  126 + @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
  127 + public Map<String, Object> uploadFile(MultipartFile file) {
  128 + Map<String, Object> rtn = new HashMap<>();
  129 + try {
  130 + DataToolsFile dataToolsFile = guideboardInfoService.uploadFile(file.getOriginalFilename(), file.getBytes());
  131 + // excel文件名
  132 + String fileName = dataToolsFile.getFile().getAbsolutePath();
  133 + Workbook wb = dataToolsFile.getFileType().getWorkBook(dataToolsFile.getFile());
  134 +
  135 + // excel文件sheet
  136 + List<String> sheetnames = new ArrayList<>();
  137 + for (int i = 0; i < wb.getNumberOfSheets(); i ++) {
  138 + sheetnames.add(wb.getSheetAt(i).getSheetName());
  139 + }
  140 +
  141 + wb.close();
  142 +
  143 + rtn.put("status", ResponseCode.SUCCESS);
  144 + rtn.put("filename", fileName);
  145 + rtn.put("sheetnames", StringUtils.join(sheetnames, ","));
  146 + } catch (Exception exp) {
  147 + exp.printStackTrace();
  148 + rtn.put("status", ResponseCode.ERROR);
  149 + rtn.put("msg", exp.getMessage());
  150 + }
  151 + return rtn;
  152 + }
  153 + // 导入excel文件
  154 + @RequestMapping(value = "/importFile", method = RequestMethod.POST)
  155 + public Map<String, Object> importFile(@RequestParam Map<String, Object> params) {
  156 + Map<String, Object> rtn = new HashMap<>();
  157 +
  158 + try {
  159 + File file = new File(String.valueOf(params.get("filename")));
  160 + if (!file.exists()) {
  161 + throw new Exception("导入文件不存在!");
  162 + }
  163 + guideboardInfoService.importData(file, params);
  164 +
  165 + rtn.put("status", ResponseCode.SUCCESS);
  166 + rtn.put("msg", "导入文件成功");
  167 + } catch (Exception exp) {
  168 + rtn.put("status", ResponseCode.ERROR);
  169 + rtn.put("msg", exp.getMessage());
  170 + }
  171 +
  172 + return rtn;
  173 + }
  174 + // 上传并导入excel文件
  175 + @RequestMapping(value = "/uploadAndImportFile", method = RequestMethod.POST)
  176 + public Map<String, Object> uploadAndImportFile(MultipartFile file) {
  177 + Map<String, Object> rtn = new HashMap<>();
  178 +
  179 + try {
  180 + DataToolsFile dataToolsFile = guideboardInfoService.uploadFile(file.getOriginalFilename(), file.getBytes());
  181 + Map<String, Object> params = new HashMap<>();
  182 + guideboardInfoService.importData(dataToolsFile.getFile(), params);
  183 +
  184 + rtn.put("status", ResponseCode.SUCCESS);
  185 + rtn.put("msg", "上传&导入文件成功");
  186 + } catch (Exception exp) {
  187 + exp.printStackTrace();
  188 + rtn.put("status", ResponseCode.ERROR);
  189 + rtn.put("msg", exp.getMessage());
  190 + }
  191 +
  192 + return rtn;
  193 + }
  194 +
  195 + // 导出数据到xls文件
  196 + @RequestMapping(value = "/exportFile", method = RequestMethod.GET)
  197 + public void exportFile(HttpServletResponse response,
  198 + @RequestParam Map<String, Object> params) throws Exception {
  199 + DataToolsFile dataToolsFile = guideboardInfoService.exportData(params);
  200 + // 流输出导出文件
  201 + response.setHeader("content-type", "application/octet-stream");
  202 + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName());
  203 + response.setContentType("application/octet-stream");
  204 +
  205 + OutputStream os = response.getOutputStream();
  206 + BufferedOutputStream bos = new BufferedOutputStream(os);
  207 +
  208 + InputStream is = new FileInputStream(dataToolsFile.getFile());
  209 + BufferedInputStream bis = new BufferedInputStream(is);
  210 +
  211 + int length = 0;
  212 + byte[] temp = new byte[1 * 1024 * 10];
  213 + while ((length = bis.read(temp)) != -1) {
  214 + bos.write(temp, 0, length);
  215 + }
  216 + bos.flush();
  217 + bis.close();
  218 + bos.close();
  219 + is.close();
  220 + }
  221 +}
src/main/java/com/bsth/controller/schedule/core/LogController_facade.java
1 package com.bsth.controller.schedule.core; 1 package com.bsth.controller.schedule.core;
2 2
3 import com.alibaba.dubbo.config.annotation.Reference; 3 import com.alibaba.dubbo.config.annotation.Reference;
  4 +import com.bsth.control_v2.plan_module.common.config.springboot.dubbo.DubboConfigCondition;
4 import com.bsth.control_v2.plan_module.common.dto.schedule.log.ModuleOperatorLogDto; 5 import com.bsth.control_v2.plan_module.common.dto.schedule.log.ModuleOperatorLogDto;
5 import com.bsth.control_v2.plan_module.common.service.BServiceFacade; 6 import com.bsth.control_v2.plan_module.common.service.BServiceFacade;
6 import com.bsth.control_v2.plan_module.common.service.log.LogServiceFacade; 7 import com.bsth.control_v2.plan_module.common.service.log.LogServiceFacade;
7 import com.bsth.controller.schedule.BController_facade; 8 import com.bsth.controller.schedule.BController_facade;
  9 +import org.springframework.context.annotation.Conditional;
8 import org.springframework.web.bind.annotation.RequestMapping; 10 import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.bind.annotation.RestController; 11 import org.springframework.web.bind.annotation.RestController;
10 12
11 @RestController 13 @RestController
  14 +@Conditional(DubboConfigCondition.class)
12 @RequestMapping("s_log") 15 @RequestMapping("s_log")
13 public class LogController_facade extends BController_facade<Long, ModuleOperatorLogDto> { 16 public class LogController_facade extends BController_facade<Long, ModuleOperatorLogDto> {
14 @Reference 17 @Reference
src/main/java/com/bsth/controller/schedule/core/RerunController_facade.java 0 → 100644
  1 +package com.bsth.controller.schedule.core;
  2 +
  3 +import com.alibaba.dubbo.config.annotation.Reference;
  4 +import com.bsth.control_v2.plan_module.common.config.springboot.dubbo.DubboConfigCondition;
  5 +import com.bsth.control_v2.plan_module.common.dto.schedule.rule.RerunRuleDto;
  6 +import com.bsth.control_v2.plan_module.common.dto.sys.UserDto;
  7 +import com.bsth.control_v2.plan_module.common.service.BServiceFacade;
  8 +import com.bsth.control_v2.plan_module.common.service.schedule.rule.RerunRuleConfigServiceFacade;
  9 +import com.bsth.controller.schedule.BController_facade;
  10 +import org.springframework.context.annotation.Conditional;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import java.util.Date;
  15 +
  16 +/**
  17 + * Created by xu on 16/10/20.
  18 + */
  19 +@RestController
  20 +@Conditional(DubboConfigCondition.class)
  21 +@RequestMapping("rms")
  22 +public class RerunController_facade extends BController_facade<Long, RerunRuleDto> {
  23 + @Override
  24 + public void setCreateUserInfo(RerunRuleDto rerunRuleDto, Integer userId, Date createDate) {
  25 + UserDto userDto = UserDto.getBuilder()
  26 + .setId(userId)
  27 + .build();
  28 + rerunRuleDto.setCreateBy(userDto);
  29 + rerunRuleDto.setCreateDate(createDate);
  30 + }
  31 +
  32 + @Override
  33 + public void setUpdateUserInfo(RerunRuleDto rerunRuleDto, Integer userId, Date updateDate) {
  34 + UserDto userDto = UserDto.getBuilder()
  35 + .setId(userId)
  36 + .build();
  37 + rerunRuleDto.setUpdateBy(userDto);
  38 + rerunRuleDto.setUpdateDate(updateDate);
  39 + }
  40 +
  41 + @Reference
  42 + private RerunRuleConfigServiceFacade rerunRuleConfigServiceFacade;
  43 +
  44 + @Override
  45 + protected BServiceFacade<Long, RerunRuleDto> getBServiceFacade() {
  46 + return rerunRuleConfigServiceFacade;
  47 + }
  48 +}
src/main/java/com/bsth/controller/schedule/core/SchedulePlanController_facade.java
@@ -2,15 +2,17 @@ package com.bsth.controller.schedule.core; @@ -2,15 +2,17 @@ package com.bsth.controller.schedule.core;
2 2
3 import com.alibaba.dubbo.config.annotation.Reference; 3 import com.alibaba.dubbo.config.annotation.Reference;
4 import com.bsth.common.ResponseCode; 4 import com.bsth.common.ResponseCode;
  5 +import com.bsth.control_v2.plan_module.common.config.springboot.dubbo.DubboConfigCondition;
5 import com.bsth.control_v2.plan_module.common.dto.schedule.PlanDto; 6 import com.bsth.control_v2.plan_module.common.dto.schedule.PlanDto;
  7 +import com.bsth.control_v2.plan_module.common.dto.sys.UserDto;
6 import com.bsth.control_v2.plan_module.common.service.BServiceFacade; 8 import com.bsth.control_v2.plan_module.common.service.BServiceFacade;
7 -import com.bsth.control_v2.plan_module.common.service.schedule.PlanGenerateFacade;  
8 import com.bsth.control_v2.plan_module.common.service.schedule.PlanServiceFacade; 9 import com.bsth.control_v2.plan_module.common.service.schedule.PlanServiceFacade;
9 import com.bsth.control_v2.plan_module.common.service.schedule.validate.PlanPreValidateFacade; 10 import com.bsth.control_v2.plan_module.common.service.schedule.validate.PlanPreValidateFacade;
10 import com.bsth.controller.schedule.BController_facade; 11 import com.bsth.controller.schedule.BController_facade;
11 import com.bsth.entity.schedule.SchedulePlan; 12 import com.bsth.entity.schedule.SchedulePlan;
12 import com.bsth.service.schedule.SchedulePlanService; 13 import com.bsth.service.schedule.SchedulePlanService;
13 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.context.annotation.Conditional;
14 import org.springframework.web.bind.annotation.PathVariable; 16 import org.springframework.web.bind.annotation.PathVariable;
15 import org.springframework.web.bind.annotation.RequestMapping; 17 import org.springframework.web.bind.annotation.RequestMapping;
16 import org.springframework.web.bind.annotation.RequestMethod; 18 import org.springframework.web.bind.annotation.RequestMethod;
@@ -21,14 +23,13 @@ import java.util.HashMap; @@ -21,14 +23,13 @@ import java.util.HashMap;
21 import java.util.Map; 23 import java.util.Map;
22 24
23 @RestController 25 @RestController
  26 +@Conditional(DubboConfigCondition.class)
24 @RequestMapping("spc") 27 @RequestMapping("spc")
25 public class SchedulePlanController_facade extends BController_facade<Long, PlanDto> { 28 public class SchedulePlanController_facade extends BController_facade<Long, PlanDto> {
26 @Reference 29 @Reference
27 private PlanServiceFacade planServiceFacade; 30 private PlanServiceFacade planServiceFacade;
28 @Reference 31 @Reference
29 private PlanPreValidateFacade planPreValidateFacade; 32 private PlanPreValidateFacade planPreValidateFacade;
30 - @Reference  
31 - private PlanGenerateFacade planGenerateFacade;  
32 33
33 @Override 34 @Override
34 protected BServiceFacade<Long, PlanDto> getBServiceFacade() { 35 protected BServiceFacade<Long, PlanDto> getBServiceFacade() {
@@ -73,19 +74,21 @@ public class SchedulePlanController_facade extends BController_facade&lt;Long, Plan @@ -73,19 +74,21 @@ public class SchedulePlanController_facade extends BController_facade&lt;Long, Plan
73 } 74 }
74 75
75 @Override 76 @Override
76 - protected boolean isSaveExtend() {  
77 - return true; 77 + public void setCreateUserInfo(PlanDto planDto, Integer userId, Date createDate) {
  78 + UserDto userDto = UserDto.getBuilder()
  79 + .setId(userId)
  80 + .build();
  81 + planDto.setCreateBy(userDto);
  82 + planDto.setCreateDate(createDate);
78 } 83 }
79 84
80 - /**  
81 - * 生成排班计划。  
82 - * @param planDto  
83 - * @return  
84 - */  
85 @Override 85 @Override
86 - protected PlanDto saveExtend(PlanDto planDto) {  
87 - planGenerateFacade.generatePlan(planDto);  
88 - return planDto; 86 + public void setUpdateUserInfo(PlanDto planDto, Integer userId, Date updateDate) {
  87 + UserDto userDto = UserDto.getBuilder()
  88 + .setId(userId)
  89 + .build();
  90 + planDto.setUpdateBy(userDto);
  91 + planDto.setUpdateDate(updateDate);
89 } 92 }
90 93
91 //------------------------- 以下是还未服务话的功能 --------------------------// 94 //------------------------- 以下是还未服务话的功能 --------------------------//
src/main/java/com/bsth/controller/schedule/core/SchedulePlanInfoController_facade.java
@@ -2,12 +2,14 @@ package com.bsth.controller.schedule.core; @@ -2,12 +2,14 @@ package com.bsth.controller.schedule.core;
2 2
3 import com.alibaba.dubbo.config.annotation.Reference; 3 import com.alibaba.dubbo.config.annotation.Reference;
4 import com.bsth.common.ResponseCode; 4 import com.bsth.common.ResponseCode;
  5 +import com.bsth.control_v2.plan_module.common.config.springboot.dubbo.DubboConfigCondition;
5 import com.bsth.control_v2.plan_module.common.dto.schedule.PlanInfoDto; 6 import com.bsth.control_v2.plan_module.common.dto.schedule.PlanInfoDto;
6 import com.bsth.control_v2.plan_module.common.dto.sys.UserDto; 7 import com.bsth.control_v2.plan_module.common.dto.sys.UserDto;
7 import com.bsth.control_v2.plan_module.common.service.BServiceFacade; 8 import com.bsth.control_v2.plan_module.common.service.BServiceFacade;
8 import com.bsth.control_v2.plan_module.common.service.schedule.PlanInfoServiceFacade; 9 import com.bsth.control_v2.plan_module.common.service.schedule.PlanInfoServiceFacade;
9 import com.bsth.control_v2.plan_module.common.utils.SystemInfoUtils; 10 import com.bsth.control_v2.plan_module.common.utils.SystemInfoUtils;
10 import com.bsth.controller.schedule.BController_facade; 11 import com.bsth.controller.schedule.BController_facade;
  12 +import org.springframework.context.annotation.Conditional;
11 import org.springframework.web.bind.annotation.PathVariable; 13 import org.springframework.web.bind.annotation.PathVariable;
12 import org.springframework.web.bind.annotation.RequestMapping; 14 import org.springframework.web.bind.annotation.RequestMapping;
13 import org.springframework.web.bind.annotation.RequestMethod; 15 import org.springframework.web.bind.annotation.RequestMethod;
@@ -18,6 +20,7 @@ import java.util.HashMap; @@ -18,6 +20,7 @@ import java.util.HashMap;
18 import java.util.Map; 20 import java.util.Map;
19 21
20 @RestController 22 @RestController
  23 +@Conditional(DubboConfigCondition.class)
21 @RequestMapping("spic") 24 @RequestMapping("spic")
22 public class SchedulePlanInfoController_facade extends BController_facade<Long, PlanInfoDto> { 25 public class SchedulePlanInfoController_facade extends BController_facade<Long, PlanInfoDto> {
23 @Reference 26 @Reference
src/main/java/com/bsth/controller/schedule/core/ScheduleRule1FlatController_facade.java 0 → 100644
  1 +package com.bsth.controller.schedule.core;
  2 +
  3 +import com.alibaba.dubbo.config.annotation.Reference;
  4 +import com.bsth.control_v2.plan_module.common.config.springboot.dubbo.DubboConfigCondition;
  5 +import com.bsth.control_v2.plan_module.common.dto.schedule.rule.FlatRuleDto;
  6 +import com.bsth.control_v2.plan_module.common.dto.sys.UserDto;
  7 +import com.bsth.control_v2.plan_module.common.service.BServiceFacade;
  8 +import com.bsth.control_v2.plan_module.common.service.schedule.rule.FlatRuleConfigServiceFacade;
  9 +import com.bsth.controller.schedule.BController_facade;
  10 +import org.springframework.context.annotation.Conditional;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import java.util.Date;
  15 +
  16 +/**
  17 + * Created by xu on 16/7/4.
  18 + */
  19 +@RestController
  20 +@Conditional(DubboConfigCondition.class)
  21 +@RequestMapping("sr1fc")
  22 +public class ScheduleRule1FlatController_facade extends BController_facade<Long, FlatRuleDto> {
  23 + @Override
  24 + public void setCreateUserInfo(FlatRuleDto flatRuleDto, Integer userId, Date createDate) {
  25 + UserDto userDto = UserDto.getBuilder()
  26 + .setId(userId)
  27 + .build();
  28 + flatRuleDto.setCreateBy(userDto);
  29 + flatRuleDto.setCreateDate(createDate);
  30 + }
  31 +
  32 + @Override
  33 + public void setUpdateUserInfo(FlatRuleDto flatRuleDto, Integer userId, Date updateDate) {
  34 + UserDto userDto = UserDto.getBuilder()
  35 + .setId(userId)
  36 + .build();
  37 + flatRuleDto.setUpdateBy(userDto);
  38 + flatRuleDto.setUpdateDate(updateDate);
  39 + }
  40 +
  41 + @Reference
  42 + private FlatRuleConfigServiceFacade flatRuleConfigServiceFacade;
  43 +
  44 + @Override
  45 + protected BServiceFacade<Long, FlatRuleDto> getBServiceFacade() {
  46 + return flatRuleConfigServiceFacade;
  47 + }
  48 +}
src/main/java/com/bsth/controller/schedule/core/TTInfoBxDetailController_facade.java
1 package com.bsth.controller.schedule.core; 1 package com.bsth.controller.schedule.core;
2 2
3 import com.alibaba.dubbo.config.annotation.Reference; 3 import com.alibaba.dubbo.config.annotation.Reference;
  4 +import com.bsth.control_v2.plan_module.common.config.springboot.dubbo.DubboConfigCondition;
4 import com.bsth.control_v2.plan_module.common.dto.schedule.timetable.TTInfoBxDetailDto; 5 import com.bsth.control_v2.plan_module.common.dto.schedule.timetable.TTInfoBxDetailDto;
5 import com.bsth.control_v2.plan_module.common.dto.sys.UserDto; 6 import com.bsth.control_v2.plan_module.common.dto.sys.UserDto;
6 import com.bsth.control_v2.plan_module.common.service.BServiceFacade; 7 import com.bsth.control_v2.plan_module.common.service.BServiceFacade;
7 import com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoBxDetailServiceFacade; 8 import com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoBxDetailServiceFacade;
8 import com.bsth.controller.schedule.BController_facade; 9 import com.bsth.controller.schedule.BController_facade;
  10 +import org.springframework.context.annotation.Conditional;
9 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
10 import org.springframework.web.bind.annotation.RestController; 12 import org.springframework.web.bind.annotation.RestController;
11 13
12 import java.util.Date; 14 import java.util.Date;
13 15
14 @RestController 16 @RestController
  17 +@Conditional(DubboConfigCondition.class)
15 @RequestMapping("tibxdc") 18 @RequestMapping("tibxdc")
16 public class TTInfoBxDetailController_facade extends BController_facade<Long, TTInfoBxDetailDto> { 19 public class TTInfoBxDetailController_facade extends BController_facade<Long, TTInfoBxDetailDto> {
17 @Reference 20 @Reference
src/main/java/com/bsth/controller/schedule/core/TTInfoController_facade.java 0 → 100644
  1 +package com.bsth.controller.schedule.core;
  2 +
  3 +import com.alibaba.dubbo.config.annotation.Reference;
  4 +import com.bsth.common.ResponseCode;
  5 +import com.bsth.control_v2.plan_module.common.config.springboot.dubbo.DubboConfigCondition;
  6 +import com.bsth.control_v2.plan_module.common.dto.baseinfo.LineDto;
  7 +import com.bsth.control_v2.plan_module.common.dto.schedule.timetable.TTInfoDto;
  8 +import com.bsth.control_v2.plan_module.common.dto.sys.UserDto;
  9 +import com.bsth.control_v2.plan_module.common.exception.PlanModuleException;
  10 +import com.bsth.control_v2.plan_module.common.service.BServiceFacade;
  11 +import com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoServiceFacade;
  12 +import com.bsth.controller.schedule.BController_facade;
  13 +import org.springframework.context.annotation.Conditional;
  14 +import org.springframework.web.bind.annotation.*;
  15 +
  16 +import java.util.Date;
  17 +import java.util.HashMap;
  18 +import java.util.Map;
  19 +
  20 +/**
  21 + * Created by xu on 16/12/20.
  22 + */
  23 +@RestController
  24 +@Conditional(DubboConfigCondition.class)
  25 +@RequestMapping(value = "tic_ec")
  26 +public class TTInfoController_facade extends BController_facade<Long, TTInfoDto> {
  27 + @Override
  28 + public void setCreateUserInfo(TTInfoDto ttInfoDto, Integer userId, Date createDate) {
  29 + UserDto userDto = UserDto.getBuilder()
  30 + .setId(userId)
  31 + .build();
  32 + ttInfoDto.setCreateBy(userDto);
  33 + ttInfoDto.setCreateDate(createDate);
  34 + }
  35 +
  36 + @Override
  37 + public void setUpdateUserInfo(TTInfoDto ttInfoDto, Integer userId, Date updateDate) {
  38 + UserDto userDto = UserDto.getBuilder()
  39 + .setId(userId)
  40 + .build();
  41 + ttInfoDto.setUpdateBy(userDto);
  42 + ttInfoDto.setUpdateDate(updateDate);
  43 + }
  44 +
  45 + @Reference
  46 + private TTInfoServiceFacade ttInfoServiceFacade;
  47 +
  48 + @Override
  49 + protected BServiceFacade<Long, TTInfoDto> getBServiceFacade() {
  50 + return ttInfoServiceFacade;
  51 + }
  52 +
  53 + @RequestMapping(value = "/stationroute/{lineid}", method = RequestMethod.GET)
  54 + public Map<String, Object> getLineStationRouteVersions(@PathVariable(value = "lineid") Integer lineid) {
  55 + Map<String, Object> rtn = new HashMap<>();
  56 + try {
  57 + rtn.put("status", ResponseCode.SUCCESS);
  58 + rtn.put("data", ttInfoServiceFacade.getLineStationRouteVersions(lineid));
  59 +
  60 + } catch (Exception exp) {
  61 + rtn.put("status", ResponseCode.ERROR);
  62 + rtn.put("msg", exp.getMessage());
  63 + }
  64 +
  65 + return rtn;
  66 +
  67 + }
  68 +
  69 + @RequestMapping(value = "/versiondesc/{lineid}/{version}")
  70 + public Map<String, Object> getLineVersionDesc(
  71 + @PathVariable(value = "lineid") Integer lineid,
  72 + @PathVariable(value = "version") Integer version) {
  73 + Map<String, Object> rtn = new HashMap<>();
  74 + try {
  75 + Map<String, String> desc = new HashMap<>();
  76 + desc.put("desc", ttInfoServiceFacade.getLineVersionDesc(lineid, version));
  77 + rtn.put("status", ResponseCode.SUCCESS);
  78 + rtn.put("data", desc);
  79 +
  80 + } catch (Exception exp) {
  81 + rtn.put("status", ResponseCode.ERROR);
  82 + rtn.put("msg", exp.getMessage());
  83 + }
  84 +
  85 + return rtn;
  86 + }
  87 +
  88 + @RequestMapping(value = "/versiondesc2/{lineid}/{status}")
  89 + public Map<String, Object> getLineVersionDesc2(
  90 + @PathVariable(value = "lineid") Integer lineid,
  91 + @PathVariable(value = "status") Integer status) {
  92 + Map<String, Object> rtn = new HashMap<>();
  93 + try {
  94 + rtn.put("status", ResponseCode.SUCCESS);
  95 + rtn.put("data", ttInfoServiceFacade.getLineVersions(lineid, status));
  96 +
  97 + } catch (Exception exp) {
  98 + rtn.put("status", ResponseCode.ERROR);
  99 + rtn.put("msg", exp.getMessage());
  100 + }
  101 +
  102 + return rtn;
  103 + }
  104 +
  105 + @RequestMapping(value = "/validate_name", method = RequestMethod.GET)
  106 + public Map<String, Object> validate_name(@RequestParam Map<String, Object> param) {
  107 + Map<String, Object> rtn = new HashMap<>();
  108 + try {
  109 + // 名字重复验证
  110 + TTInfoDto ttInfoDto = TTInfoDto.getBuilder()
  111 + .setId(param.get("id_eq") == null ? null : Long.valueOf(param.get("id_eq").toString()))
  112 + .setXl(param.get("xl.id_eq") == null ? null : (
  113 + LineDto.getBuilder()
  114 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  115 + .build()
  116 + ))
  117 + .setName(param.get("name_eq") == null ? null : param.get("name_eq").toString())
  118 + .setRule_days(param.get("rule_days_eq") == null ? null : param.get("rule_days_eq").toString())
  119 + .setSpecial_days(param.get("special_days_eq") == null ? null : param.get("special_days_eq").toString())
  120 + .build();
  121 + ttInfoServiceFacade.validate_name_duplicate(ttInfoDto);
  122 + rtn.put("status", ResponseCode.SUCCESS);
  123 + } catch (PlanModuleException exp) {
  124 + rtn.put("status", ResponseCode.ERROR);
  125 + rtn.put("msg", exp.getMessage());
  126 + }
  127 +
  128 + return rtn;
  129 + }
  130 +
  131 + @RequestMapping(value = "/validate_n_d", method = RequestMethod.GET)
  132 + public Map<String, Object> validate_n_d(@RequestParam Map<String, Object> param) {
  133 + Map<String, Object> rtn = new HashMap<>();
  134 + try {
  135 + // 常规有效日重复验证
  136 + TTInfoDto ttInfoDto = TTInfoDto.getBuilder()
  137 + .setId(param.get("id_eq") == null ? null : Long.valueOf(param.get("id_eq").toString()))
  138 + .setXl(param.get("xl.id_eq") == null ? null : (
  139 + LineDto.getBuilder()
  140 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  141 + .build()
  142 + ))
  143 + .setName(param.get("name_eq") == null ? null : param.get("name_eq").toString())
  144 + .setRule_days(param.get("rule_days_eq") == null ? null : param.get("rule_days_eq").toString())
  145 + .setSpecial_days(param.get("special_days_eq") == null ? null : param.get("special_days_eq").toString())
  146 + .build();
  147 + ttInfoServiceFacade.validate_normal_day_duplicate(ttInfoDto);
  148 + rtn.put("status", ResponseCode.SUCCESS);
  149 + } catch (PlanModuleException exp) {
  150 + rtn.put("status", ResponseCode.ERROR);
  151 + rtn.put("msg", exp.getMessage());
  152 + }
  153 + return rtn;
  154 + }
  155 +
  156 + @RequestMapping(value = "/validate_s_d", method = RequestMethod.GET)
  157 + public Map<String, Object> validate_s_d(@RequestParam Map<String, Object> param) {
  158 + Map<String, Object> rtn = new HashMap<>();
  159 + try {
  160 + // 特殊有效日重复判定
  161 + TTInfoDto ttInfoDto = TTInfoDto.getBuilder()
  162 + .setId(param.get("id_eq") == null ? null : Long.valueOf(param.get("id_eq").toString()))
  163 + .setXl(param.get("xl.id_eq") == null ? null : (
  164 + LineDto.getBuilder()
  165 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  166 + .build()
  167 + ))
  168 + .setName(param.get("name_eq") == null ? null : param.get("name_eq").toString())
  169 + .setRule_days(param.get("rule_days_eq") == null ? null : param.get("rule_days_eq").toString())
  170 + .setSpecial_days(param.get("special_days_eq") == null ? null : param.get("special_days_eq").toString())
  171 + .build();
  172 + ttInfoServiceFacade.validate_special_day_duplicate(ttInfoDto);
  173 + rtn.put("status", ResponseCode.SUCCESS);
  174 + } catch (PlanModuleException exp) {
  175 + rtn.put("status", ResponseCode.ERROR);
  176 + rtn.put("msg", exp.getMessage());
  177 + }
  178 + return rtn;
  179 + }
  180 +
  181 + @RequestMapping(value = "/backup/{ttinfo}", method = RequestMethod.GET)
  182 + public Map<String, Object> backup(@PathVariable(value = "ttinfo") Long ttInfoId) {
  183 + Map<String, Object> rtn = new HashMap<>();
  184 + try {
  185 + // 备份时刻表
  186 + this.ttInfoServiceFacade.backUp(ttInfoId);
  187 + } catch (PlanModuleException exp) {
  188 + rtn.put("status", ResponseCode.ERROR);
  189 + rtn.put("msg", exp.getMessage());
  190 + }
  191 +
  192 + return rtn;
  193 + }
  194 +
  195 +}
0 \ No newline at end of file 196 \ No newline at end of file
src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController_facade.java
@@ -2,6 +2,7 @@ package com.bsth.controller.schedule.core; @@ -2,6 +2,7 @@ package com.bsth.controller.schedule.core;
2 2
3 import com.alibaba.dubbo.config.annotation.Reference; 3 import com.alibaba.dubbo.config.annotation.Reference;
4 import com.bsth.common.ResponseCode; 4 import com.bsth.common.ResponseCode;
  5 +import com.bsth.control_v2.plan_module.common.config.springboot.dubbo.DubboConfigCondition;
5 import com.bsth.control_v2.plan_module.common.dto.schedule.timetable.TTInfoDetailDto; 6 import com.bsth.control_v2.plan_module.common.dto.schedule.timetable.TTInfoDetailDto;
6 import com.bsth.control_v2.plan_module.common.dto.sys.UserDto; 7 import com.bsth.control_v2.plan_module.common.dto.sys.UserDto;
7 import com.bsth.control_v2.plan_module.common.service.BServiceFacade; 8 import com.bsth.control_v2.plan_module.common.service.BServiceFacade;
@@ -10,18 +11,23 @@ import com.bsth.control_v2.plan_module.common.utils.SystemInfoUtils; @@ -10,18 +11,23 @@ import com.bsth.control_v2.plan_module.common.utils.SystemInfoUtils;
10 import com.bsth.controller.schedule.BController_facade; 11 import com.bsth.controller.schedule.BController_facade;
11 import com.bsth.service.schedule.TTInfoDetailService; 12 import com.bsth.service.schedule.TTInfoDetailService;
12 import com.bsth.service.schedule.datatools.TTInfoDetailForEdit; 13 import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
  14 +import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData;
  15 +import com.bsth.service.schedule.timetable.ExcelFormatType;
  16 +import com.bsth.service.schedule.utils.DataToolsFile;
  17 +import com.bsth.service.schedule.utils.DataToolsFileType;
  18 +import org.apache.commons.lang3.StringUtils;
  19 +import org.apache.poi.ss.usermodel.Workbook;
13 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
14 -import org.springframework.web.bind.annotation.PathVariable;  
15 -import org.springframework.web.bind.annotation.RequestMapping;  
16 -import org.springframework.web.bind.annotation.RequestMethod;  
17 -import org.springframework.web.bind.annotation.RestController; 21 +import org.springframework.context.annotation.Conditional;
  22 +import org.springframework.web.bind.annotation.*;
  23 +import org.springframework.web.multipart.MultipartFile;
18 24
19 -import java.util.Date;  
20 -import java.util.HashMap;  
21 -import java.util.List;  
22 -import java.util.Map; 25 +import javax.servlet.http.HttpServletResponse;
  26 +import java.io.*;
  27 +import java.util.*;
23 28
24 @RestController 29 @RestController
  30 +@Conditional(DubboConfigCondition.class)
25 @RequestMapping("tidc") 31 @RequestMapping("tidc")
26 public class TTInfoDetailController_facade extends BController_facade<Long, TTInfoDetailDto> { 32 public class TTInfoDetailController_facade extends BController_facade<Long, TTInfoDetailDto> {
27 @Reference 33 @Reference
@@ -77,9 +83,75 @@ public class TTInfoDetailController_facade extends BController_facade&lt;Long, TTIn @@ -77,9 +83,75 @@ public class TTInfoDetailController_facade extends BController_facade&lt;Long, TTIn
77 ttInfoDetailServiceFacade.deleteInfo(aLong, SystemInfoUtils.createClientSystemInfo()); 83 ttInfoDetailServiceFacade.deleteInfo(aLong, SystemInfoUtils.createClientSystemInfo());
78 } 84 }
79 85
  86 + @RequestMapping(value = "/bcdetail", method = RequestMethod.GET)
  87 + public List<TTInfoDetailDto> findBcdetails(Integer xlId, Long ttinfoId, Long lpId) {
  88 + return ttInfoDetailServiceFacade.findBcdetails(xlId, ttinfoId, lpId);
  89 + }
  90 +
  91 + /**
  92 + * 验证关联的线路标准信息(以后放到规则引擎里去做)。
  93 + * @param lineinfoid
  94 + * @return
  95 + */
  96 + @RequestMapping(value = "/validate/lineinfo", method = RequestMethod.GET)
  97 + public Map<String, Object> validate_lineInfo(Integer lineinfoid) {
  98 + Map<String, Object> rtn = new HashMap<>();
  99 + try {
  100 + ttInfoDetailServiceFacade.validateAssoLineInfo(lineinfoid);
  101 + rtn.put("status", ResponseCode.SUCCESS);
  102 + } catch (Exception exp) {
  103 + rtn.put("status", ResponseCode.ERROR);
  104 + rtn.put("msg", exp.getMessage());
  105 + }
  106 + return rtn;
  107 + }
  108 +
  109 + @RequestMapping(value = "/zd_tcc", method = RequestMethod.GET)
  110 + public Map<String, Object> getZdAndTccInfo(Integer lineid, Integer xldir, Integer lineversion) {
  111 + Map<String, Object> rtn = new HashMap<>();
  112 + try {
  113 + List<Map<String, Object>> list = ttInfoDetailServiceFacade.findZdAndTcc(lineid, xldir, lineversion);
  114 + rtn.put("status", ResponseCode.SUCCESS);
  115 + rtn.put("data", list);
  116 + } catch (Exception exp) {
  117 + rtn.put("status", ResponseCode.ERROR);
  118 + rtn.put("msg", exp.getMessage());
  119 + }
  120 + return rtn;
  121 + }
  122 +
  123 +
80 //--------------- TODO:以下操作不属于BController_facade,暂时没用定义在TTInfoDetailServiceFacade中 ----------// 124 //--------------- TODO:以下操作不属于BController_facade,暂时没用定义在TTInfoDetailServiceFacade中 ----------//
81 @Autowired 125 @Autowired
82 private TTInfoDetailService ttInfoDetailService; 126 private TTInfoDetailService ttInfoDetailService;
  127 +
  128 + /**
  129 + * 验证sheet(以后放到规则引擎里去做)。
  130 + * @param filename excel文件全路径名
  131 + * @param sheetname sheet名字
  132 + * @param lineid 线路id
  133 + * @param linename 线路名称
  134 + * @param lineversion 线路版本
  135 + * @return
  136 + */
  137 + @RequestMapping(value = "/validate/sheet", method = RequestMethod.POST)
  138 + public Map<String, Object> validate_sheet(
  139 + String filename, String sheetname, Integer lineid, String linename, Integer lineversion, String excelFormatType) {
  140 + Map<String, Object> rtn = new HashMap<>();
  141 + try {
  142 + if (lineversion == null) {
  143 + throw new Exception("线路版本未知");
  144 + }
  145 + ttInfoDetailService.validateExcelSheet(filename, sheetname, lineid, linename, lineversion,
  146 + ExcelFormatType.getEnum(excelFormatType));
  147 + rtn.put("status", ResponseCode.SUCCESS);
  148 + } catch (Exception exp) {
  149 + rtn.put("status", ResponseCode.ERROR);
  150 + rtn.put("msg", exp.getMessage());
  151 + }
  152 + return rtn;
  153 + }
  154 +
83 /** 155 /**
84 * 获取时刻表明细编辑信息。 156 * 获取时刻表明细编辑信息。
85 * @param xlid 线路id 157 * @param xlid 线路id
@@ -105,17 +177,151 @@ public class TTInfoDetailController_facade extends BController_facade&lt;Long, TTIn @@ -105,17 +177,151 @@ public class TTInfoDetailController_facade extends BController_facade&lt;Long, TTIn
105 return rtn; 177 return rtn;
106 } 178 }
107 179
108 - @RequestMapping(value = "/zd_tcc", method = RequestMethod.GET)  
109 - public Map<String, Object> getZdAndTccInfo(Integer lineid, Integer xldir, Integer lineversion) { 180 + /**
  181 + * 时刻表明细批量插入
  182 + *
  183 + * @param entities
  184 + *
  185 + * @return
  186 + */
  187 + @RequestMapping(value = "/skbDetailMxSave" ,method = RequestMethod.POST)
  188 + public Map<String, Object> skbDetailMxSave(@RequestParam Map<String, Object> entities){
  189 + return ttInfoDetailService.skbDetailMxSave(entities);
  190 + }
  191 +
  192 + //------------------ TODO:导入导出逻辑,之后会服务化 -----------------//
  193 +
  194 + // 上传excel文件
  195 + @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
  196 + public Map<String, Object> uploadFile(MultipartFile file) {
110 Map<String, Object> rtn = new HashMap<>(); 197 Map<String, Object> rtn = new HashMap<>();
111 try { 198 try {
112 - List<Map<String, Object>> list = ttInfoDetailService.findZdAndTcc(lineid, xldir, lineversion); 199 + DataToolsFile dataToolsFile = ttInfoDetailService.uploadFile(file.getOriginalFilename(), file.getBytes());
  200 + // excel文件名
  201 + String fileName = dataToolsFile.getFile().getAbsolutePath();
  202 + Workbook wb = dataToolsFile.getFileType().getWorkBook(dataToolsFile.getFile());
  203 +
  204 + // excel文件sheet
  205 + List<String> sheetnames = new ArrayList<>();
  206 + for (int i = 0; i < wb.getNumberOfSheets(); i ++) {
  207 + sheetnames.add(wb.getSheetAt(i).getSheetName());
  208 + }
  209 +
  210 + wb.close();
  211 +
113 rtn.put("status", ResponseCode.SUCCESS); 212 rtn.put("status", ResponseCode.SUCCESS);
114 - rtn.put("data", list); 213 + rtn.put("filename", fileName);
  214 + rtn.put("sheetnames", StringUtils.join(sheetnames, ","));
  215 + } catch (Exception exp) {
  216 + exp.printStackTrace();
  217 + rtn.put("status", ResponseCode.ERROR);
  218 + rtn.put("msg", exp.getMessage());
  219 + }
  220 + return rtn;
  221 + }
  222 + // 导入excel文件
  223 + @RequestMapping(value = "/importFile", method = RequestMethod.POST)
  224 + public Map<String, Object> importFile(@RequestParam Map<String, Object> params) {
  225 + Map<String, Object> rtn = new HashMap<>();
  226 +
  227 + try {
  228 + File file = new File(String.valueOf(params.get("filename")));
  229 + if (!file.exists()) {
  230 + throw new Exception("导入文件不存在!");
  231 + }
  232 + ttInfoDetailService.importData(file, params);
  233 +
  234 + rtn.put("status", ResponseCode.SUCCESS);
  235 + rtn.put("msg", "导入文件成功");
115 } catch (Exception exp) { 236 } catch (Exception exp) {
116 rtn.put("status", ResponseCode.ERROR); 237 rtn.put("status", ResponseCode.ERROR);
117 rtn.put("msg", exp.getMessage()); 238 rtn.put("msg", exp.getMessage());
118 } 239 }
  240 +
119 return rtn; 241 return rtn;
120 } 242 }
  243 + // 上传并导入excel文件
  244 + @RequestMapping(value = "/uploadAndImportFile", method = RequestMethod.POST)
  245 + public Map<String, Object> uploadAndImportFile(MultipartFile file) {
  246 + Map<String, Object> rtn = new HashMap<>();
  247 +
  248 + try {
  249 + DataToolsFile dataToolsFile = ttInfoDetailService.uploadFile(file.getOriginalFilename(), file.getBytes());
  250 + Map<String, Object> params = new HashMap<>();
  251 + ttInfoDetailService.importData(dataToolsFile.getFile(), params);
  252 +
  253 + rtn.put("status", ResponseCode.SUCCESS);
  254 + rtn.put("msg", "上传&导入文件成功");
  255 + } catch (Exception exp) {
  256 + exp.printStackTrace();
  257 + rtn.put("status", ResponseCode.ERROR);
  258 + rtn.put("msg", exp.getMessage());
  259 + }
  260 +
  261 + return rtn;
  262 + }
  263 +
  264 + // 导出数据到xls文件
  265 + @RequestMapping(value = "/exportFile", method = RequestMethod.GET)
  266 + public void exportFile(HttpServletResponse response,
  267 + @RequestParam Map<String, Object> params) throws Exception {
  268 + DataToolsFile dataToolsFile = ttInfoDetailService.exportData(params);
  269 + // 流输出导出文件
  270 + response.setHeader("content-type", "application/octet-stream");
  271 + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName());
  272 + response.setContentType("application/octet-stream");
  273 +
  274 + OutputStream os = response.getOutputStream();
  275 + BufferedOutputStream bos = new BufferedOutputStream(os);
  276 +
  277 + InputStream is = new FileInputStream(dataToolsFile.getFile());
  278 + BufferedInputStream bis = new BufferedInputStream(is);
  279 +
  280 + int length = 0;
  281 + byte[] temp = new byte[1 * 1024 * 10];
  282 + while ((length = bis.read(temp)) != -1) {
  283 + bos.write(temp, 0, length);
  284 + }
  285 + bos.flush();
  286 + bis.close();
  287 + bos.close();
  288 + is.close();
  289 + }
  290 +
  291 + @RequestMapping(value = "/exportDTDFile/{type}", method = RequestMethod.POST)
  292 + public void exportFile(
  293 + @RequestBody TTinfoDetailDynamicData.DTInfos dtInfos, @PathVariable("type") String type,
  294 + HttpServletResponse response) throws Exception {
  295 + DataToolsFile dataToolsFile = null;
  296 + if ("xls".equals(type)) {
  297 + dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos, DataToolsFileType.XLS);
  298 + } else if ("xlsx".equals(type)) {
  299 + dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos, DataToolsFileType.XLSX);
  300 + } else {
  301 + throw new Exception("未知的导出格式==>" + type);
  302 + }
  303 +
  304 + // 流输出导出文件
  305 + response.setHeader("content-type", "application/octet-stream");
  306 + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName());
  307 + response.setContentType("application/octet-stream");
  308 +
  309 + OutputStream os = response.getOutputStream();
  310 + BufferedOutputStream bos = new BufferedOutputStream(os);
  311 +
  312 + InputStream is = new FileInputStream(dataToolsFile.getFile());
  313 + BufferedInputStream bis = new BufferedInputStream(is);
  314 +
  315 + int length = 0;
  316 + byte[] temp = new byte[1 * 1024 * 10];
  317 + while ((length = bis.read(temp)) != -1) {
  318 + bos.write(temp, 0, length);
  319 + }
  320 + bos.flush();
  321 + bis.close();
  322 + bos.close();
  323 + is.close();
  324 + }
  325 +
  326 +
121 } 327 }
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.java renamed to src/main/java/com/bsth/controller/schedule/core/legacy/CarConfigInfoController.java
1 -package com.bsth.controller.schedule.core; 1 +package com.bsth.controller.schedule.core.legacy;
2 2
3 import com.bsth.common.Constants; 3 import com.bsth.common.Constants;
4 import com.bsth.common.ResponseCode; 4 import com.bsth.common.ResponseCode;
5 import com.bsth.controller.schedule.BController; 5 import com.bsth.controller.schedule.BController;
  6 +import com.bsth.controller.schedule.core.CarConfigInfoController_facade;
6 import com.bsth.entity.schedule.CarConfigInfo; 7 import com.bsth.entity.schedule.CarConfigInfo;
7 import com.bsth.entity.sys.CompanyAuthority; 8 import com.bsth.entity.sys.CompanyAuthority;
8 import com.bsth.repository.schedule.CarConfigInfoRepository; 9 import com.bsth.repository.schedule.CarConfigInfoRepository;
9 import com.bsth.service.schedule.CarConfigInfoService; 10 import com.bsth.service.schedule.CarConfigInfoService;
10 import com.bsth.service.schedule.exception.ScheduleException; 11 import com.bsth.service.schedule.exception.ScheduleException;
11 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
12 import org.springframework.web.bind.annotation.RequestMapping; 14 import org.springframework.web.bind.annotation.RequestMapping;
13 import org.springframework.web.bind.annotation.RequestMethod; 15 import org.springframework.web.bind.annotation.RequestMethod;
14 import org.springframework.web.bind.annotation.RequestParam; 16 import org.springframework.web.bind.annotation.RequestParam;
@@ -24,6 +26,7 @@ import java.util.Map; @@ -24,6 +26,7 @@ import java.util.Map;
24 * Created by xu on 16/5/9. 26 * Created by xu on 16/5/9.
25 */ 27 */
26 @RestController 28 @RestController
  29 +@ConditionalOnMissingBean(CarConfigInfoController_facade.class)
27 @RequestMapping("cci") 30 @RequestMapping("cci")
28 public class CarConfigInfoController extends BController<CarConfigInfo, Long> { 31 public class CarConfigInfoController extends BController<CarConfigInfo, Long> {
29 @Autowired 32 @Autowired
src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController.java renamed to src/main/java/com/bsth/controller/schedule/core/legacy/EmployeeConfigInfoController.java
1 -package com.bsth.controller.schedule.core; 1 +package com.bsth.controller.schedule.core.legacy;
2 2
3 import com.bsth.common.Constants; 3 import com.bsth.common.Constants;
4 import com.bsth.common.ResponseCode; 4 import com.bsth.common.ResponseCode;
5 import com.bsth.controller.schedule.BController; 5 import com.bsth.controller.schedule.BController;
  6 +import com.bsth.controller.schedule.core.EmployeeConfigInfoController_facade;
6 import com.bsth.entity.schedule.EmployeeConfigInfo; 7 import com.bsth.entity.schedule.EmployeeConfigInfo;
7 import com.bsth.entity.sys.CompanyAuthority; 8 import com.bsth.entity.sys.CompanyAuthority;
8 import com.bsth.repository.schedule.EmployeeConfigInfoRepository; 9 import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
9 import com.bsth.service.schedule.EmployeeConfigInfoService; 10 import com.bsth.service.schedule.EmployeeConfigInfoService;
10 import com.bsth.service.schedule.exception.ScheduleException; 11 import com.bsth.service.schedule.exception.ScheduleException;
11 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
12 import org.springframework.web.bind.annotation.*; 14 import org.springframework.web.bind.annotation.*;
13 15
14 import javax.servlet.http.HttpServletRequest; 16 import javax.servlet.http.HttpServletRequest;
@@ -21,6 +23,7 @@ import java.util.Map; @@ -21,6 +23,7 @@ import java.util.Map;
21 * Created by xu on 16/5/10. 23 * Created by xu on 16/5/10.
22 */ 24 */
23 @RestController 25 @RestController
  26 +@ConditionalOnMissingBean(EmployeeConfigInfoController_facade.class)
24 @RequestMapping("eci") 27 @RequestMapping("eci")
25 public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo, Long> { 28 public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo, Long> {
26 @Autowired 29 @Autowired
src/main/java/com/bsth/controller/schedule/core/GuideboardInfoController.java renamed to src/main/java/com/bsth/controller/schedule/core/legacy/GuideboardInfoController.java
1 -package com.bsth.controller.schedule.core; 1 +package com.bsth.controller.schedule.core.legacy;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 4 import com.bsth.controller.schedule.BController;
  5 +import com.bsth.controller.schedule.core.GuideboardInfoController_facade;
5 import com.bsth.entity.schedule.GuideboardInfo; 6 import com.bsth.entity.schedule.GuideboardInfo;
6 import com.bsth.repository.schedule.GuideboardInfoRepository; 7 import com.bsth.repository.schedule.GuideboardInfoRepository;
7 import com.bsth.service.schedule.GuideboardInfoService; 8 import com.bsth.service.schedule.GuideboardInfoService;
8 import com.bsth.service.schedule.exception.ScheduleException; 9 import com.bsth.service.schedule.exception.ScheduleException;
9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
10 import org.springframework.web.bind.annotation.*; 12 import org.springframework.web.bind.annotation.*;
11 13
12 import java.util.HashMap; 14 import java.util.HashMap;
@@ -17,6 +19,7 @@ import java.util.Map; @@ -17,6 +19,7 @@ import java.util.Map;
17 * 路牌管理控制器。 19 * 路牌管理控制器。
18 */ 20 */
19 @RestController 21 @RestController
  22 +@ConditionalOnMissingBean(GuideboardInfoController_facade.class)
20 @RequestMapping("gic") 23 @RequestMapping("gic")
21 public class GuideboardInfoController extends BController<GuideboardInfo, Long> { 24 public class GuideboardInfoController extends BController<GuideboardInfo, Long> {
22 @Autowired 25 @Autowired
src/main/java/com/bsth/controller/schedule/core/RerunController.java renamed to src/main/java/com/bsth/controller/schedule/core/legacy/RerunController.java
1 -package com.bsth.controller.schedule.core; 1 +package com.bsth.controller.schedule.core.legacy;
2 2
3 import com.bsth.controller.schedule.BController; 3 import com.bsth.controller.schedule.BController;
  4 +import com.bsth.controller.schedule.core.RerunController_facade;
4 import com.bsth.entity.schedule.rule.RerunRule; 5 import com.bsth.entity.schedule.rule.RerunRule;
  6 +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
5 import org.springframework.web.bind.annotation.RequestMapping; 7 import org.springframework.web.bind.annotation.RequestMapping;
6 import org.springframework.web.bind.annotation.RestController; 8 import org.springframework.web.bind.annotation.RestController;
7 9
@@ -9,6 +11,7 @@ import org.springframework.web.bind.annotation.RestController; @@ -9,6 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
9 * Created by xu on 16/10/20. 11 * Created by xu on 16/10/20.
10 */ 12 */
11 @RestController 13 @RestController
  14 +@ConditionalOnMissingBean(RerunController_facade.class)
12 @RequestMapping("rms") 15 @RequestMapping("rms")
13 public class RerunController extends BController<RerunRule, Long> { 16 public class RerunController extends BController<RerunRule, Long> {
14 17
src/main/java/com/bsth/controller/schedule/core/SchedulePlanController.java renamed to src/main/java/com/bsth/controller/schedule/core/legacy/SchedulePlanController.java
1 -package com.bsth.controller.schedule.core; 1 +package com.bsth.controller.schedule.core.legacy;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 4 import com.bsth.controller.schedule.BController;
  5 +import com.bsth.controller.schedule.core.SchedulePlanController_facade;
5 import com.bsth.entity.schedule.SchedulePlan; 6 import com.bsth.entity.schedule.SchedulePlan;
6 import com.bsth.service.schedule.SchedulePlanService; 7 import com.bsth.service.schedule.SchedulePlanService;
7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
8 import org.springframework.web.bind.annotation.PathVariable; 10 import org.springframework.web.bind.annotation.PathVariable;
9 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
10 import org.springframework.web.bind.annotation.RequestMethod; 12 import org.springframework.web.bind.annotation.RequestMethod;
  13 +import org.springframework.web.bind.annotation.RestController;
11 14
12 import java.util.Date; 15 import java.util.Date;
13 import java.util.HashMap; 16 import java.util.HashMap;
@@ -16,8 +19,9 @@ import java.util.Map; @@ -16,8 +19,9 @@ import java.util.Map;
16 /** 19 /**
17 * Created by xu on 16/6/16. 20 * Created by xu on 16/6/16.
18 */ 21 */
19 -//@RestController  
20 -//@RequestMapping("spc") 22 +@RestController
  23 +@ConditionalOnMissingBean(SchedulePlanController_facade.class)
  24 +@RequestMapping("spc")
21 public class SchedulePlanController extends BController<SchedulePlan, Long> { 25 public class SchedulePlanController extends BController<SchedulePlan, Long> {
22 @Autowired 26 @Autowired
23 private SchedulePlanService schedulePlanService; 27 private SchedulePlanService schedulePlanService;
src/main/java/com/bsth/controller/schedule/core/SchedulePlanInfoController.java renamed to src/main/java/com/bsth/controller/schedule/core/legacy/SchedulePlanInfoController.java
1 -package com.bsth.controller.schedule.core; 1 +package com.bsth.controller.schedule.core.legacy;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 4 import com.bsth.controller.schedule.BController;
  5 +import com.bsth.controller.schedule.core.SchedulePlanInfoController_facade;
5 import com.bsth.entity.schedule.SchedulePlanInfo; 6 import com.bsth.entity.schedule.SchedulePlanInfo;
6 import com.bsth.service.schedule.SchedulePlanInfoService; 7 import com.bsth.service.schedule.SchedulePlanInfoService;
7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
8 import org.springframework.web.bind.annotation.*; 10 import org.springframework.web.bind.annotation.*;
9 11
10 import java.util.Date; 12 import java.util.Date;
@@ -15,8 +17,9 @@ import java.util.Map; @@ -15,8 +17,9 @@ import java.util.Map;
15 /** 17 /**
16 * Created by xu on 17/5/1. 18 * Created by xu on 17/5/1.
17 */ 19 */
18 -//@RestController  
19 -//@RequestMapping("spic") 20 +@RestController
  21 +@ConditionalOnMissingBean(SchedulePlanInfoController_facade.class)
  22 +@RequestMapping("spic")
20 public class SchedulePlanInfoController extends BController<SchedulePlanInfo, Long> { 23 public class SchedulePlanInfoController extends BController<SchedulePlanInfo, Long> {
21 @Autowired 24 @Autowired
22 private SchedulePlanInfoService schedulePlanInfoService; 25 private SchedulePlanInfoService schedulePlanInfoService;
src/main/java/com/bsth/controller/schedule/core/ScheduleRule1FlatController.java renamed to src/main/java/com/bsth/controller/schedule/core/legacy/ScheduleRule1FlatController.java
1 -package com.bsth.controller.schedule.core; 1 +package com.bsth.controller.schedule.core.legacy;
2 2
3 import com.bsth.controller.schedule.BController; 3 import com.bsth.controller.schedule.BController;
  4 +import com.bsth.controller.schedule.core.ScheduleRule1FlatController_facade;
4 import com.bsth.entity.schedule.rule.ScheduleRule1Flat; 5 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  6 +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
5 import org.springframework.web.bind.annotation.RequestMapping; 7 import org.springframework.web.bind.annotation.RequestMapping;
6 import org.springframework.web.bind.annotation.RestController; 8 import org.springframework.web.bind.annotation.RestController;
7 9
@@ -9,6 +11,7 @@ import org.springframework.web.bind.annotation.RestController; @@ -9,6 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
9 * Created by xu on 16/7/4. 11 * Created by xu on 16/7/4.
10 */ 12 */
11 @RestController 13 @RestController
  14 +@ConditionalOnMissingBean(ScheduleRule1FlatController_facade.class)
12 @RequestMapping("sr1fc") 15 @RequestMapping("sr1fc")
13 public class ScheduleRule1FlatController extends BController<ScheduleRule1Flat, Long> { 16 public class ScheduleRule1FlatController extends BController<ScheduleRule1Flat, Long> {
14 17
src/main/java/com/bsth/controller/schedule/core/legacy/TTInfoBxDetailController.java 0 → 100644
  1 +package com.bsth.controller.schedule.core.legacy;
  2 +
  3 +import com.bsth.controller.schedule.BController;
  4 +import com.bsth.controller.schedule.core.TTInfoBxDetailController_facade;
  5 +import com.bsth.entity.schedule.TTInfoBxDetail;
  6 +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RestController;
  9 +
  10 +@RestController
  11 +@ConditionalOnMissingBean(TTInfoBxDetailController_facade.class)
  12 +@RequestMapping("tibxdc")
  13 +public class TTInfoBxDetailController extends BController<TTInfoBxDetail, Long> {
  14 +}
src/main/java/com/bsth/controller/schedule/core/TTInfoController.java renamed to src/main/java/com/bsth/controller/schedule/core/legacy/TTInfoController.java
1 -package com.bsth.controller.schedule.core; 1 +package com.bsth.controller.schedule.core.legacy;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 4 import com.bsth.controller.schedule.BController;
  5 +import com.bsth.controller.schedule.core.TTInfoController_facade;
5 import com.bsth.entity.schedule.TTInfo; 6 import com.bsth.entity.schedule.TTInfo;
6 import com.bsth.service.schedule.TTInfoService; 7 import com.bsth.service.schedule.TTInfoService;
7 import com.bsth.service.schedule.exception.ScheduleException; 8 import com.bsth.service.schedule.exception.ScheduleException;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
9 import org.springframework.web.bind.annotation.*; 11 import org.springframework.web.bind.annotation.*;
10 12
11 import java.util.HashMap; 13 import java.util.HashMap;
@@ -14,7 +16,8 @@ import java.util.Map; @@ -14,7 +16,8 @@ import java.util.Map;
14 /** 16 /**
15 * Created by xu on 16/12/20. 17 * Created by xu on 16/12/20.
16 */ 18 */
17 -@RestController(value = "tTInfoController_ec") 19 +@RestController
  20 +@ConditionalOnMissingBean(TTInfoController_facade.class)
18 @RequestMapping(value = "tic_ec") 21 @RequestMapping(value = "tic_ec")
19 public class TTInfoController extends BController<TTInfo, Long> { 22 public class TTInfoController extends BController<TTInfo, Long> {
20 @Autowired 23 @Autowired
src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController.java renamed to src/main/java/com/bsth/controller/schedule/core/legacy/TTInfoDetailController.java
1 -package com.bsth.controller.schedule.core; 1 +package com.bsth.controller.schedule.core.legacy;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 4 import com.bsth.controller.schedule.BController;
  5 +import com.bsth.controller.schedule.core.TTInfoDetailController_facade;
5 import com.bsth.entity.schedule.TTInfoDetail; 6 import com.bsth.entity.schedule.TTInfoDetail;
6 import com.bsth.service.schedule.TTInfoDetailService; 7 import com.bsth.service.schedule.TTInfoDetailService;
7 import com.bsth.service.schedule.datatools.TTInfoDetailForEdit; 8 import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
@@ -10,6 +11,7 @@ import com.bsth.service.schedule.timetable.ExcelFormatType; @@ -10,6 +11,7 @@ import com.bsth.service.schedule.timetable.ExcelFormatType;
10 import com.bsth.service.schedule.utils.DataToolsFile; 11 import com.bsth.service.schedule.utils.DataToolsFile;
11 import com.bsth.service.schedule.utils.DataToolsFileType; 12 import com.bsth.service.schedule.utils.DataToolsFileType;
12 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
13 import org.springframework.web.bind.annotation.*; 15 import org.springframework.web.bind.annotation.*;
14 16
15 import javax.servlet.http.HttpServletResponse; 17 import javax.servlet.http.HttpServletResponse;
@@ -21,8 +23,9 @@ import java.util.Map; @@ -21,8 +23,9 @@ import java.util.Map;
21 /** 23 /**
22 * Created by xu on 17/1/4. 24 * Created by xu on 17/1/4.
23 */ 25 */
24 -//@RestController  
25 -//@RequestMapping("tidc") 26 +@RestController
  27 +@ConditionalOnMissingBean(TTInfoDetailController_facade.class)
  28 +@RequestMapping("tidc")
26 public class TTInfoDetailController extends BController<TTInfoDetail, Long> { 29 public class TTInfoDetailController extends BController<TTInfoDetail, Long> {
27 @Autowired 30 @Autowired
28 private TTInfoDetailService ttInfoDetailService; 31 private TTInfoDetailService ttInfoDetailService;
src/main/java/com/bsth/controller/sys/RoleController.java
@@ -68,4 +68,14 @@ public class RoleController extends BaseController&lt;Role, Integer&gt;{ @@ -68,4 +68,14 @@ public class RoleController extends BaseController&lt;Role, Integer&gt;{
68 public Map<String, Object> roleInfo(@RequestParam Integer id){ 68 public Map<String, Object> roleInfo(@RequestParam Integer id){
69 return roleService.roleInfo(id); 69 return roleService.roleInfo(id);
70 } 70 }
  71 +
  72 + /**
  73 + * 检查操作合法性 操作的是否是下级角色
  74 + * @param operationRoleId 下级角色Id
  75 + * @return
  76 + */
  77 + @RequestMapping(value = "/checkOperationLegality")
  78 + public boolean checkOperationLegality(@RequestParam Integer operationRoleId){
  79 + return roleService.checkOperationLegality(operationRoleId);
  80 + }
71 } 81 }
src/main/java/com/bsth/controller/sys/UserController.java
@@ -260,6 +260,15 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; { @@ -260,6 +260,15 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; {
260 public String changePWD(@RequestParam String oldPWD, @RequestParam String newPWD, @RequestParam String cnewPWD) { 260 public String changePWD(@RequestParam String oldPWD, @RequestParam String newPWD, @RequestParam String cnewPWD) {
261 SysUser sysUser = SecurityUtils.getCurrentUser(); 261 SysUser sysUser = SecurityUtils.getCurrentUser();
262 String msg = ""; 262 String msg = "";
  263 +
  264 + //解密RSA
  265 + try{
  266 + oldPWD = (RSAUtils.decryptBase64(oldPWD));
  267 + newPWD = (RSAUtils.decryptBase64(newPWD));
  268 + cnewPWD = (RSAUtils.decryptBase64(cnewPWD));
  269 + }catch (RuntimeException e) {
  270 + return "网络延迟,解密失败,请重新添加!";
  271 + }
263 if (new BCryptPasswordEncoder(4).matches(oldPWD, sysUser.getPassword())) { 272 if (new BCryptPasswordEncoder(4).matches(oldPWD, sysUser.getPassword())) {
264 if (oldPWD.equals(newPWD)) { 273 if (oldPWD.equals(newPWD)) {
265 msg = "新密码不能跟原始密码一样!"; 274 msg = "新密码不能跟原始密码一样!";
@@ -282,8 +291,16 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; { @@ -282,8 +291,16 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; {
282 return sysUserService.register(u); 291 return sysUserService.register(u);
283 } 292 }
284 293
  294 + // 查询用户下所有下级角色
285 @RequestMapping(value = "/all_distinct") 295 @RequestMapping(value = "/all_distinct")
286 public List<SysUser> findAll_distinct() { 296 public List<SysUser> findAll_distinct() {
287 return sysUserService.findAll_distinct(); 297 return sysUserService.findAll_distinct();
288 } 298 }
  299 +
  300 + // 重置密码
  301 + @RequestMapping(value = "/resetPassword", method = RequestMethod.POST)
  302 + public Map<String, Object> resetPassword(@RequestParam Integer id) {
  303 + return sysUserService.resetPassword(id);
  304 + }
  305 +
289 } 306 }
src/main/java/com/bsth/data/ThreadMonotor.java
@@ -2,6 +2,9 @@ package com.bsth.data; @@ -2,6 +2,9 @@ package com.bsth.data;
2 2
3 import com.bsth.data.gpsdata_v2.DataHandleProcess; 3 import com.bsth.data.gpsdata_v2.DataHandleProcess;
4 import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; 4 import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
  5 +
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
5 import org.springframework.stereotype.Component; 8 import org.springframework.stereotype.Component;
6 9
7 /** 10 /**
@@ -9,11 +12,15 @@ import org.springframework.stereotype.Component; @@ -9,11 +12,15 @@ import org.springframework.stereotype.Component;
9 */ 12 */
10 @Component 13 @Component
11 public class ThreadMonotor extends Thread{ 14 public class ThreadMonotor extends Thread{
  15 +
  16 + Logger logger = LoggerFactory.getLogger(this.getClass());
12 17
13 @Override 18 @Override
14 public void run() { 19 public void run() {
15 //切换到备用的网关实时GPS对照数据 20 //切换到备用的网关实时GPS对照数据
16 - if(DataHandleProcess.isBlock())  
17 - GpsDataLoaderThread.setFlag(-1); 21 + if(DataHandleProcess.isBlock()) {
  22 + GpsDataLoaderThread.setFlag(-1);
  23 + logger.error("切换到备用GPS数据源");
  24 + }
18 } 25 }
19 } 26 }
20 \ No newline at end of file 27 \ No newline at end of file
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON; @@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
4 import com.bsth.data.gpsdata_v2.cache.GpsCacheData; 4 import com.bsth.data.gpsdata_v2.cache.GpsCacheData;
5 import com.bsth.data.gpsdata_v2.entity.GpsEntity; 5 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
6 import com.bsth.data.gpsdata_v2.handlers.*; 6 import com.bsth.data.gpsdata_v2.handlers.*;
  7 +import com.bsth.email.SendEmailController;
  8 +import com.bsth.email.entity.EmailBean;
7 import com.google.common.collect.ArrayListMultimap; 9 import com.google.common.collect.ArrayListMultimap;
8 import org.apache.commons.lang3.StringUtils; 10 import org.apache.commons.lang3.StringUtils;
9 import org.slf4j.Logger; 11 import org.slf4j.Logger;
@@ -15,6 +17,8 @@ import java.util.*; @@ -15,6 +17,8 @@ import java.util.*;
15 import java.util.concurrent.CountDownLatch; 17 import java.util.concurrent.CountDownLatch;
16 import java.util.concurrent.ExecutorService; 18 import java.util.concurrent.ExecutorService;
17 import java.util.concurrent.Executors; 19 import java.util.concurrent.Executors;
  20 +import java.util.concurrent.ThreadFactory;
  21 +import java.util.concurrent.TimeUnit;
18 22
19 /** 23 /**
20 * 实时信号数据处理 24 * 实时信号数据处理
@@ -37,13 +41,27 @@ public class DataHandleProcess { @@ -37,13 +41,27 @@ public class DataHandleProcess {
37 ReverseRouteProcess reverseRouteProcess; 41 ReverseRouteProcess reverseRouteProcess;
38 @Autowired 42 @Autowired
39 GpsRealData gpsRealData; 43 GpsRealData gpsRealData;
  44 + // 发送邮件
  45 + @Autowired
  46 + private SendEmailController sendEmailController;
40 47
41 48
42 static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class); 49 static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class);
43 50
44 final static int POOL_SIZE = 20; 51 final static int POOL_SIZE = 20;
45 52
46 - static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1); 53 + static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1, new ThreadFactory() {
  54 +
  55 + @Override
  56 + public Thread newThread(Runnable r) {
  57 + // TODO Auto-generated method stub
  58 + Thread t = new Thread(r);
  59 + t.setName("GPSProcessor");
  60 +
  61 + return t;
  62 + }
  63 +
  64 + });
47 public static CountDownLatch count; 65 public static CountDownLatch count;
48 66
49 static long lastTime; 67 static long lastTime;
@@ -51,7 +69,22 @@ public class DataHandleProcess { @@ -51,7 +69,22 @@ public class DataHandleProcess {
51 public static boolean isBlock() { 69 public static boolean isBlock() {
52 return System.currentTimeMillis() - lastTime > 1000 * 30; 70 return System.currentTimeMillis() - lastTime > 1000 * 30;
53 } 71 }
54 - 72 +
  73 + private void shutdownAndAwaitTermination(ExecutorService pool) {
  74 + pool.shutdown();
  75 + try {
  76 + if (!pool.awaitTermination(500, TimeUnit.MILLISECONDS)) {
  77 + pool.shutdownNow();
  78 + }
  79 + if (!pool.awaitTermination(500, TimeUnit.MILLISECONDS)) {
  80 + logger.error("线程池无法正常终止");
  81 + }
  82 + } catch (InterruptedException e) {
  83 + pool.shutdown();
  84 + Thread.currentThread().interrupt();
  85 + }
  86 + }
  87 +
55 public void handle(List<GpsEntity> list) { 88 public void handle(List<GpsEntity> list) {
56 try { 89 try {
57 if (list.size() == 0) 90 if (list.size() == 0)
@@ -85,7 +118,32 @@ public class DataHandleProcess { @@ -85,7 +118,32 @@ public class DataHandleProcess {
85 118
86 119
87 //等待子线程结束 120 //等待子线程结束
88 - count.await(); 121 + boolean isNormal = count.await(5, TimeUnit.SECONDS);
  122 + if (!isNormal) {
  123 + try {
  124 + shutdownAndAwaitTermination(threadPool);
  125 + threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1, new ThreadFactory() {
  126 +
  127 + @Override
  128 + public Thread newThread(Runnable r) {
  129 + // TODO Auto-generated method stub
  130 + Thread t = new Thread(r);
  131 + t.setName("GPSProcessor");
  132 +
  133 + return t;
  134 + }
  135 +
  136 + });
  137 + //发送邮件
  138 + EmailBean mail = new EmailBean();
  139 + mail.setSubject("线调GPS处理");
  140 + mail.setContent("GPS处理超时,检查线程栈文件信息<br/>");
  141 + sendEmailController.sendMail("113252620@qq.com", mail);
  142 + logger.info("DataHandlerProcess:邮件发送成功!");
  143 + } catch (Exception e){
  144 + logger.error("DataHandlerProcess:邮件发送失败!",e);
  145 + }
  146 + }
89 147
90 //加入实时gps对照 148 //加入实时gps对照
91 for (GpsEntity gps : list) 149 for (GpsEntity gps : list)
@@ -115,6 +173,7 @@ public class DataHandleProcess { @@ -115,6 +173,7 @@ public class DataHandleProcess {
115 Collections.sort(list, comp); 173 Collections.sort(list, comp);
116 GpsEntity gps; 174 GpsEntity gps;
117 for(int i = 0,len = list.size(); i< len ;i ++){ 175 for(int i = 0,len = list.size(); i< len ;i ++){
  176 + if (Thread.currentThread().isInterrupted()) break;
118 gps = list.get(i); 177 gps = list.get(i);
119 178
120 try { 179 try {
src/main/java/com/bsth/data/report_register/ReportRegisterService.java
1 -package com.bsth.data.report_register;  
2 -  
3 -import com.bsth.data.report_register.entity.ReportRegister;  
4 -import com.bsth.service.BaseService;  
5 -  
6 -import java.util.Map;  
7 -  
8 -public interface ReportRegisterService extends BaseService<ReportRegister, Long>{  
9 -  
10 - Map<String, Object> findList(Map<String, String> map);  
11 -  
12 - Map<String, Object> deleteInfo( ReportRegister t);  
13 -} 1 +package com.bsth.data.report_register;
  2 +
  3 +import com.bsth.data.report_register.entity.ReportRegister;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +import java.util.Map;
  7 +
  8 +public interface ReportRegisterService extends BaseService<ReportRegister, Long>{
  9 +
  10 + Map<String, Object> findList(Map<String, String> map);
  11 +
  12 + Map<String, Object> deleteInfo( ReportRegister t);
  13 +}
src/main/java/com/bsth/data/report_register/ReportRegisterServiceImpl.java
1 -package com.bsth.data.report_register;  
2 -  
3 -import com.bsth.common.ResponseCode;  
4 -import com.bsth.data.report_register.entity.ReportRegister;  
5 -import com.bsth.service.impl.BaseServiceImpl;  
6 -import com.bsth.util.ReportUtils;  
7 -import org.slf4j.Logger;  
8 -import org.slf4j.LoggerFactory;  
9 -import org.springframework.beans.factory.annotation.Autowired;  
10 -import org.springframework.dao.DataIntegrityViolationException;  
11 -import org.springframework.jdbc.core.BeanPropertyRowMapper;  
12 -import org.springframework.jdbc.core.JdbcTemplate;  
13 -import org.springframework.stereotype.Service;  
14 -  
15 -import java.text.SimpleDateFormat;  
16 -import java.util.ArrayList;  
17 -import java.util.Date;  
18 -import java.util.HashMap;  
19 -import java.util.Iterator;  
20 -import java.util.List;  
21 -import java.util.Map;  
22 -  
23 -@Service  
24 -public class ReportRegisterServiceImpl extends BaseServiceImpl<ReportRegister, Long> implements ReportRegisterService{  
25 -  
26 - Logger log = LoggerFactory.getLogger(this.getClass());  
27 -  
28 - @Autowired  
29 - JdbcTemplate jdbcTemplate;  
30 -  
31 - @Override  
32 - public Map<String, Object> findList(Map<String, String> map) {  
33 - Map<String, Object> rs = new HashMap();  
34 - try {  
35 -  
36 - String lineCodes = map.get("lineCodes") == null ? "" : map.get("lineCodes").toString();  
37 - String lineName = map.get("lineName") == null ? "" : map.get("lineName").toString();  
38 - String type = map.get("type") == null ? "" : map.get("type").toString();  
39 - String date1 = "",date2 = "";  
40 - String isFindDelete = "";  
41 - if(type!=null && (type.equals("query") || type.equals("export"))){  
42 - // 导出是不要删除的  
43 - if(type.equals("export"))  
44 - isFindDelete = " and STATUS !=2 ";  
45 - date1 = map.get("date1") == null ? "" : map.get("date1").toString()+" 00:00:00";  
46 - date2 = map.get("date2") == null ? "" : map.get("date2").toString()+" 23:59:59";  
47 - } else {  
48 - Date startDate = new Date();  
49 - startDate.setHours(0);  
50 - startDate.setMinutes(0);  
51 - startDate.setSeconds(0);  
52 - Date endDate = new Date();  
53 - endDate.setHours(23);  
54 - endDate.setMinutes(59);  
55 - endDate.setSeconds(59);  
56 - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
57 - date1 = sdf.format(startDate);  
58 - date2 = sdf.format(endDate);  
59 - }  
60 - String sql = "select * from bsth_t_report where REPORT_DATE >=\""+date1+"\" and REPORT_DATE <= \""+date2+"\" and REPORT_XL in("+lineCodes+") " + isFindDelete;  
61 - List<ReportRegister> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ReportRegister.class));  
62 -  
63 - if(type!=null && type.equals("export")){  
64 - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),  
65 - sdfSimple = new SimpleDateFormat("yyyyMMdd");  
66 - String dateTime = "";  
67 - try {  
68 - String dateStr1 = sdfSimple.format(sdfMonth.parse(date1));  
69 - String dateStr2 = sdfSimple.format(sdfMonth.parse(date2));  
70 - if (dateStr1.equals(dateStr2)) {  
71 - dateTime = dateStr1;  
72 - } else {  
73 - dateTime = dateStr1 + "-" + dateStr2;  
74 - }  
75 - } catch (Exception e) {  
76 - // TODO: handle exception  
77 - e.printStackTrace();  
78 - }  
79 - List<List<Iterator<?>>> lists = new ArrayList<>();  
80 - List<Iterator<?>> list1 = new ArrayList<>();  
81 - List<Iterator<?>> list2 = new ArrayList<>();  
82 - List<Iterator<?>> list3 = new ArrayList<>();  
83 - List<Iterator<?>> list4 = new ArrayList<>();  
84 - List<Iterator<?>> list5 = new ArrayList<>();  
85 - List<Iterator<?>> list6 = new ArrayList<>();  
86 - List<Map<String, Object>> resList1 = new ArrayList<Map<String, Object>>();  
87 - List<Map<String, Object>> resList2 = new ArrayList<Map<String, Object>>();  
88 - List<Map<String, Object>> resList3 = new ArrayList<Map<String, Object>>();  
89 - List<Map<String, Object>> resList4 = new ArrayList<Map<String, Object>>();  
90 - List<Map<String, Object>> resList5 = new ArrayList<Map<String, Object>>();  
91 - List<Map<String, Object>> resList6 = new ArrayList<Map<String, Object>>();  
92 - int i1 =0,i2 =0,i3 =0,i4 =0,i5 =0,i6 =0;  
93 - ReportUtils ee = new ReportUtils();  
94 - for (ReportRegister l : list) {  
95 - Map<String, Object> m = new HashMap<String, Object>();  
96 - String report_type = l.getREPORT_TYPE();  
97 - m.put("REPORT_DATE", l.getREPORT_DATE());  
98 - m.put("REPORT_TYPE", report_type);  
99 - m.put("REPORT_GSNAME", l.getREPORT_GSNAME());  
100 - m.put("REPORT_FGSNAME", l.getREPORT_FGSNAME());  
101 - m.put("REPORT_BBR", l.getREPORT_BBR());  
102 - m.put("REPORT_XL", l.getREPORT_XL());  
103 - m.put("REPORT_XLNAME", l.getREPORT_XLNAME());  
104 - m.put("REPORT_STATION", l.getREPORT_STATION());  
105 - m.put("REPORT_DWSBBM", l.getREPORT_DWSBBM());  
106 - m.put("REPORT_DWSBSJ", l.getREPORT_DWSBSJ());  
107 - m.put("REPORT_YWSJ", l.getREPORT_YWSJ());  
108 - m.put("REPORT_SMBWD", l.getREPORT_SMBWD());  
109 - m.put("REPORT_DJGSJ", l.getREPORT_DJGSJ());  
110 - m.put("REPORT_DJGYY", l.getREPORT_DJGYY());  
111 - m.put("REPORT_TFSJ", l.getREPORT_TFSJ());  
112 - m.put("REPORT_YXSJ", l.getREPORT_YXSJ());  
113 - m.put("REPORT_YXBC", l.getREPORT_YXBC());  
114 - m.put("REPORT_TZCS", l.getREPORT_TZCS());  
115 - m.put("REPORT_SGBH", l.getREPORT_SGBH());  
116 - m.put("REPORT_ZBH", l.getREPORT_ZBH());  
117 - m.put("REPORT_PZH", l.getREPORT_PZH());  
118 - m.put("REPORT_JSY", l.getREPORT_JSY());  
119 - m.put("REPORT_SGSJ", l.getREPORT_SGSJ());  
120 - m.put("REPORT_SGDD", l.getREPORT_SGDD());  
121 - m.put("REPORT_XSFX", l.getREPORT_XSFX());  
122 - m.put("REPORT_SGDX", l.getREPORT_SGDX());  
123 - m.put("REPORT_DXPZH", l.getREPORT_DXPZH());  
124 - m.put("REPORT_SGGK", l.getREPORT_SGGK());  
125 - m.put("REPORT_SSRS", l.getREPORT_SSRS());  
126 - m.put("REPORT_SWRS", l.getREPORT_SWRS());  
127 - m.put("REPORT_BGR", l.getREPORT_BGR());  
128 - m.put("REPORT_BGRDH", l.getREPORT_BGRDH());  
129 - m.put("REPORT_BZ", l.getREPORT_BZ());  
130 - m.put("REPORT_ROAD", l.getREPORT_ROAD());  
131 - if(report_type.equals("1")){  
132 - i1++;  
133 - m.put("i", i1);  
134 - resList1.add(m);  
135 - }else if(report_type.equals("2")){  
136 - i2++;  
137 - m.put("i", i2);  
138 - resList2.add(m);  
139 - }else if(report_type.equals("3")){  
140 - i3++;  
141 - m.put("i", i3);  
142 - resList3.add(m);  
143 - }else if(report_type.equals("4")){  
144 - i4++;  
145 - m.put("i", i4);  
146 - resList4.add(m);  
147 - } else if(report_type.equals("5")){  
148 - i5++;  
149 - m.put("i", i5);  
150 - resList5.add(m);  
151 - }else if(report_type.equals("6")){  
152 - i6++;  
153 - m.put("i", i6);  
154 - resList6.add(m);  
155 - }  
156 - }  
157 - try {  
158 - list1.add(resList1.iterator());  
159 - lists.add(list1);  
160 - list2.add(resList2.iterator());  
161 - lists.add(list2);  
162 - list3.add(resList3.iterator());  
163 - lists.add(list3);  
164 - list4.add(resList4.iterator());  
165 - lists.add(list4);  
166 - list5.add(resList5.iterator());  
167 - lists.add(list5);  
168 - list6.add(resList6.iterator());  
169 - lists.add(list6);  
170 - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";  
171 - ee.excelMoreSheetReplace(lists, new Object[]{map}, path + "mould/report_register.xls",  
172 - path + "export/" + dateTime +"_"+lineName+ "_报备登记.xls");  
173 - } catch (Exception e) {  
174 - // TODO: handle exception  
175 - e.printStackTrace();  
176 - }  
177 - }  
178 - rs.put("status", ResponseCode.SUCCESS);  
179 - rs.put("list", list);  
180 - }  
181 -// catch (ParseException e) {  
182 -// e.printStackTrace();  
183 -// }  
184 - catch (Exception e){  
185 - log.error("", e);  
186 - rs.put("status", ResponseCode.ERROR);  
187 - rs.put("msg", e.getMessage());  
188 - }  
189 - return rs;  
190 - }  
191 -  
192 - @Override  
193 - public Map<String, Object> deleteInfo(ReportRegister rr) {  
194 - Map<String, Object> map = new HashMap<>();  
195 - try{  
196 - Long id = rr.getID();  
197 - String bbr = rr.getREPORT_BBR();  
198 -  
199 - jdbcTemplate.update("UPDATE bsth_t_report SET STATUS = 2,REPORT_BBR = ? WHERE ID = ? ",bbr,id);  
200 - map.put("status", ResponseCode.SUCCESS);  
201 - }catch(DataIntegrityViolationException de){  
202 - map.put("status", ResponseCode.ERROR);  
203 - map.put("msg", "“完整性约束”校验失败,请检查要删除的对象是否存在外键约束");  
204 - }  
205 - return map;  
206 - }  
207 -} 1 +package com.bsth.data.report_register;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.data.report_register.entity.ReportRegister;
  5 +import com.bsth.service.impl.BaseServiceImpl;
  6 +import com.bsth.util.ReportUtils;
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.dao.DataIntegrityViolationException;
  11 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  12 +import org.springframework.jdbc.core.JdbcTemplate;
  13 +import org.springframework.stereotype.Service;
  14 +
  15 +import java.text.SimpleDateFormat;
  16 +import java.util.ArrayList;
  17 +import java.util.Date;
  18 +import java.util.HashMap;
  19 +import java.util.Iterator;
  20 +import java.util.List;
  21 +import java.util.Map;
  22 +
  23 +@Service
  24 +public class ReportRegisterServiceImpl extends BaseServiceImpl<ReportRegister, Long> implements ReportRegisterService{
  25 +
  26 + Logger log = LoggerFactory.getLogger(this.getClass());
  27 +
  28 + @Autowired
  29 + JdbcTemplate jdbcTemplate;
  30 +
  31 + @Override
  32 + public Map<String, Object> findList(Map<String, String> map) {
  33 + Map<String, Object> rs = new HashMap();
  34 + try {
  35 +
  36 + String lineCodes = map.get("lineCodes") == null ? "" : map.get("lineCodes").toString();
  37 + String lineName = map.get("lineName") == null ? "" : map.get("lineName").toString();
  38 + String type = map.get("type") == null ? "" : map.get("type").toString();
  39 + String date1 = "",date2 = "";
  40 + String isFindDelete = "";
  41 + if(type!=null && (type.equals("query") || type.equals("export"))){
  42 + // 导出是不要删除的
  43 + if(type.equals("export"))
  44 + isFindDelete = " and STATUS !=2 ";
  45 + date1 = map.get("date1") == null ? "" : map.get("date1").toString()+" 00:00:00";
  46 + date2 = map.get("date2") == null ? "" : map.get("date2").toString()+" 23:59:59";
  47 + } else {
  48 + Date startDate = new Date();
  49 + startDate.setHours(0);
  50 + startDate.setMinutes(0);
  51 + startDate.setSeconds(0);
  52 + Date endDate = new Date();
  53 + endDate.setHours(23);
  54 + endDate.setMinutes(59);
  55 + endDate.setSeconds(59);
  56 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  57 + date1 = sdf.format(startDate);
  58 + date2 = sdf.format(endDate);
  59 + }
  60 + String sql = "select * from bsth_t_report where REPORT_DATE >=\""+date1+"\" and REPORT_DATE <= \""+date2+"\" and REPORT_XL in("+lineCodes+") " + isFindDelete;
  61 + List<ReportRegister> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ReportRegister.class));
  62 +
  63 + if(type!=null && type.equals("export")){
  64 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  65 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  66 + String dateTime = "";
  67 + try {
  68 + String dateStr1 = sdfSimple.format(sdfMonth.parse(date1));
  69 + String dateStr2 = sdfSimple.format(sdfMonth.parse(date2));
  70 + if (dateStr1.equals(dateStr2)) {
  71 + dateTime = dateStr1;
  72 + } else {
  73 + dateTime = dateStr1 + "-" + dateStr2;
  74 + }
  75 + } catch (Exception e) {
  76 + // TODO: handle exception
  77 + e.printStackTrace();
  78 + }
  79 + List<List<Iterator<?>>> lists = new ArrayList<>();
  80 + List<Iterator<?>> list1 = new ArrayList<>();
  81 + List<Iterator<?>> list2 = new ArrayList<>();
  82 + List<Iterator<?>> list3 = new ArrayList<>();
  83 + List<Iterator<?>> list4 = new ArrayList<>();
  84 + List<Iterator<?>> list5 = new ArrayList<>();
  85 + List<Iterator<?>> list6 = new ArrayList<>();
  86 + List<Map<String, Object>> resList1 = new ArrayList<Map<String, Object>>();
  87 + List<Map<String, Object>> resList2 = new ArrayList<Map<String, Object>>();
  88 + List<Map<String, Object>> resList3 = new ArrayList<Map<String, Object>>();
  89 + List<Map<String, Object>> resList4 = new ArrayList<Map<String, Object>>();
  90 + List<Map<String, Object>> resList5 = new ArrayList<Map<String, Object>>();
  91 + List<Map<String, Object>> resList6 = new ArrayList<Map<String, Object>>();
  92 + int i1 =0,i2 =0,i3 =0,i4 =0,i5 =0,i6 =0;
  93 + ReportUtils ee = new ReportUtils();
  94 + for (ReportRegister l : list) {
  95 + Map<String, Object> m = new HashMap<String, Object>();
  96 + String report_type = l.getREPORT_TYPE();
  97 + m.put("REPORT_DATE", l.getREPORT_DATE());
  98 + m.put("REPORT_TYPE", report_type);
  99 + m.put("REPORT_GSNAME", l.getREPORT_GSNAME());
  100 + m.put("REPORT_FGSNAME", l.getREPORT_FGSNAME());
  101 + m.put("REPORT_BBR", l.getREPORT_BBR());
  102 + m.put("REPORT_XL", l.getREPORT_XL());
  103 + m.put("REPORT_XLNAME", l.getREPORT_XLNAME());
  104 + m.put("REPORT_STATION", l.getREPORT_STATION());
  105 + m.put("REPORT_DWSBBM", l.getREPORT_DWSBBM());
  106 + m.put("REPORT_DWSBSJ", l.getREPORT_DWSBSJ());
  107 + m.put("REPORT_YWSJ", l.getREPORT_YWSJ());
  108 + m.put("REPORT_SMBWD", l.getREPORT_SMBWD());
  109 + m.put("REPORT_DJGSJ", l.getREPORT_DJGSJ());
  110 + m.put("REPORT_DJGYY", l.getREPORT_DJGYY());
  111 + m.put("REPORT_TFSJ", l.getREPORT_TFSJ());
  112 + m.put("REPORT_YXSJ", l.getREPORT_YXSJ());
  113 + m.put("REPORT_YXBC", l.getREPORT_YXBC());
  114 + m.put("REPORT_TZCS", l.getREPORT_TZCS());
  115 + m.put("REPORT_SGBH", l.getREPORT_SGBH());
  116 + m.put("REPORT_ZBH", l.getREPORT_ZBH());
  117 + m.put("REPORT_PZH", l.getREPORT_PZH());
  118 + m.put("REPORT_JSY", l.getREPORT_JSY());
  119 + m.put("REPORT_SGSJ", l.getREPORT_SGSJ());
  120 + m.put("REPORT_SGDD", l.getREPORT_SGDD());
  121 + m.put("REPORT_XSFX", l.getREPORT_XSFX());
  122 + m.put("REPORT_SGDX", l.getREPORT_SGDX());
  123 + m.put("REPORT_DXPZH", l.getREPORT_DXPZH());
  124 + m.put("REPORT_SGGK", l.getREPORT_SGGK());
  125 + m.put("REPORT_SSRS", l.getREPORT_SSRS());
  126 + m.put("REPORT_SWRS", l.getREPORT_SWRS());
  127 + m.put("REPORT_BGR", l.getREPORT_BGR());
  128 + m.put("REPORT_BGRDH", l.getREPORT_BGRDH());
  129 + m.put("REPORT_BZ", l.getREPORT_BZ());
  130 + m.put("REPORT_ROAD", l.getREPORT_ROAD());
  131 + if(report_type.equals("1")){
  132 + i1++;
  133 + m.put("i", i1);
  134 + resList1.add(m);
  135 + }else if(report_type.equals("2")){
  136 + i2++;
  137 + m.put("i", i2);
  138 + resList2.add(m);
  139 + }else if(report_type.equals("3")){
  140 + i3++;
  141 + m.put("i", i3);
  142 + resList3.add(m);
  143 + }else if(report_type.equals("4")){
  144 + i4++;
  145 + m.put("i", i4);
  146 + resList4.add(m);
  147 + } else if(report_type.equals("5")){
  148 + i5++;
  149 + m.put("i", i5);
  150 + resList5.add(m);
  151 + }else if(report_type.equals("6")){
  152 + i6++;
  153 + m.put("i", i6);
  154 + resList6.add(m);
  155 + }
  156 + }
  157 + try {
  158 + list1.add(resList1.iterator());
  159 + lists.add(list1);
  160 + list2.add(resList2.iterator());
  161 + lists.add(list2);
  162 + list3.add(resList3.iterator());
  163 + lists.add(list3);
  164 + list4.add(resList4.iterator());
  165 + lists.add(list4);
  166 + list5.add(resList5.iterator());
  167 + lists.add(list5);
  168 + list6.add(resList6.iterator());
  169 + lists.add(list6);
  170 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  171 + ee.excelMoreSheetReplace(lists, new Object[]{map}, path + "mould/report_register.xls",
  172 + path + "export/" + dateTime +"_"+lineName+ "_报备登记.xls");
  173 + } catch (Exception e) {
  174 + // TODO: handle exception
  175 + e.printStackTrace();
  176 + }
  177 + }
  178 + rs.put("status", ResponseCode.SUCCESS);
  179 + rs.put("list", list);
  180 + }
  181 +// catch (ParseException e) {
  182 +// e.printStackTrace();
  183 +// }
  184 + catch (Exception e){
  185 + log.error("", e);
  186 + rs.put("status", ResponseCode.ERROR);
  187 + rs.put("msg", e.getMessage());
  188 + }
  189 + return rs;
  190 + }
  191 +
  192 + @Override
  193 + public Map<String, Object> deleteInfo(ReportRegister rr) {
  194 + Map<String, Object> map = new HashMap<>();
  195 + try{
  196 + Long id = rr.getID();
  197 + String bbr = rr.getREPORT_BBR();
  198 +
  199 + jdbcTemplate.update("UPDATE bsth_t_report SET STATUS = 2,REPORT_BBR = ? WHERE ID = ? ",bbr,id);
  200 + map.put("status", ResponseCode.SUCCESS);
  201 + }catch(DataIntegrityViolationException de){
  202 + map.put("status", ResponseCode.ERROR);
  203 + map.put("msg", "“完整性约束”校验失败,请检查要删除的对象是否存在外键约束");
  204 + }
  205 + return map;
  206 + }
  207 +}
src/main/java/com/bsth/data/report_register/entity/ReportRegister.java
1 -package com.bsth.data.report_register.entity;  
2 -  
3 -import javax.persistence.Column;  
4 -import javax.persistence.Entity;  
5 -import javax.persistence.GeneratedValue;  
6 -import javax.persistence.Id;  
7 -import javax.persistence.Table;  
8 -import java.text.DateFormat;  
9 -import java.text.SimpleDateFormat;  
10 -import java.util.Date;  
11 -  
12 -  
13 -@Entity  
14 -@Table(name = "bsth_t_report")  
15 -public class ReportRegister {  
16 -  
17 - @Id  
18 - @GeneratedValue  
19 - private long ID;  
20 -  
21 - /** 类型*/  
22 - private String REPORT_TYPE;  
23 - /** 公司 */  
24 - private String REPORT_GS;  
25 - /** 分公司 */  
26 - private String REPORT_FGS;  
27 - /** 公司名 */  
28 - private String REPORT_GSNAME;  
29 - /** 分公司名 */  
30 - private String REPORT_FGSNAME;  
31 - /** 时间*/  
32 - private Date REPORT_DATE;  
33 - /** 报备人*/  
34 - private String REPORT_BBR;  
35 - /** 线路编码 */  
36 - private String REPORT_XL;  
37 - /** 线路名*/  
38 - private String REPORT_XLNAME;  
39 - /** 站点*/  
40 - private String REPORT_STATION;  
41 - /** 对外上报部门*/  
42 - private String REPORT_DWSBBM;  
43 - /** 对外上报时间*/  
44 - private String REPORT_DWSBSJ;  
45 - /** 延误时间*/  
46 - private String REPORT_YWSJ;  
47 - /** 首末班误点原因*/  
48 - private String REPORT_SMBWD;  
49 - /** 大间隔时间*/  
50 - private String REPORT_DJGSJ;  
51 - /** 大间隔原因*/  
52 - private String REPORT_DJGYY;  
53 - /** 突发事件*/  
54 - private String REPORT_TFSJ;  
55 - /** 影响时间*/  
56 - private String REPORT_YXSJ;  
57 - /** 影响班次数*/  
58 - private String REPORT_YXBC;  
59 - /** 调整措施*/  
60 - private String REPORT_TZCS;  
61 - /** 报案事故编号*/  
62 - private String REPORT_SGBH;  
63 - /** 车辆自编号*/  
64 - private String REPORT_ZBH;  
65 - /** 车辆牌照号*/  
66 - private String REPORT_PZH;  
67 - /** 驾驶员*/  
68 - private String REPORT_JSY;  
69 - /** 事故发生时间*/  
70 - private String REPORT_SGSJ;  
71 - /** 事故发生地点*/  
72 - private String REPORT_SGDD;  
73 - /** 行驶方向*/  
74 - private String REPORT_XSFX;  
75 - /** 事故对象*/  
76 - private String REPORT_SGDX;  
77 - /** 对象车牌照号*/  
78 - private String REPORT_DXPZH;  
79 - /** 事故概况*/  
80 - private String REPORT_SGGK;  
81 - /** 受伤人数*/  
82 - private String REPORT_SSRS;  
83 - /** 死亡人数*/  
84 - private String REPORT_SWRS;  
85 - /** 报告人 */  
86 - private String REPORT_BGR;  
87 - /** 报告人电话 */  
88 - private String REPORT_BGRDH;  
89 - /** 备注 */  
90 - private String REPORT_BZ;  
91 - /** 路段*/  
92 - private String REPORT_ROAD;  
93 - /** 访问接口时使用的状态码 操作类型,0:新增;1:修改;2:删除 */  
94 - private String STATUS;  
95 - /** 创建人*/  
96 - private String CREATE_BY;  
97 - /** 创建时间 */  
98 - @Column(updatable = false, name = "CREATE_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")  
99 - private Date CREATE_DATE;  
100 - /** 修改人*/  
101 - private String UPDATE_BY;  
102 - /** 修改时间*/  
103 - @Column(name = "UPDATE_DATE", columnDefinition = "UPDATE_DATE DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")  
104 - private Date UPDATE_DATE;  
105 -  
106 - public long getID() {  
107 - return ID;  
108 - }  
109 -  
110 - public void setID(long ID) {  
111 - this.ID = ID;  
112 - }  
113 -  
114 - public String getREPORT_TYPE() {  
115 - return REPORT_TYPE;  
116 - }  
117 -  
118 - public void setREPORT_TYPE(String REPORT_TYPE) {  
119 - this.REPORT_TYPE = REPORT_TYPE;  
120 - }  
121 -  
122 - public String getREPORT_GS() {  
123 - return REPORT_GS;  
124 - }  
125 -  
126 - public void setREPORT_GS(String REPORT_GS) {  
127 - this.REPORT_GS = REPORT_GS;  
128 - }  
129 -  
130 - public String getREPORT_FGS() {  
131 - return REPORT_FGS;  
132 - }  
133 -  
134 - public void setREPORT_FGS(String REPORT_FGS) {  
135 - this.REPORT_FGS = REPORT_FGS;  
136 - }  
137 -  
138 - public String getREPORT_GSNAME() {  
139 - return REPORT_GSNAME;  
140 - }  
141 -  
142 - public void setREPORT_GSNAME(String REPORT_GSNAME) {  
143 - this.REPORT_GSNAME = REPORT_GSNAME;  
144 - }  
145 -  
146 - public String getREPORT_FGSNAME() {  
147 - return REPORT_FGSNAME;  
148 - }  
149 -  
150 - public void setREPORT_FGSNAME(String REPORT_FGSNAME) {  
151 - this.REPORT_FGSNAME = REPORT_FGSNAME;  
152 - }  
153 -  
154 - public Date getREPORT_DATE() {  
155 - return REPORT_DATE;  
156 - }  
157 -  
158 - public void setREPORT_DATE(Date REPORT_DATE) {  
159 - this.REPORT_DATE = REPORT_DATE;  
160 - }  
161 -  
162 - public String getREPORT_BBR() {  
163 - return REPORT_BBR;  
164 - }  
165 -  
166 - public void setREPORT_BBR(String REPORT_BBR) {  
167 - this.REPORT_BBR = REPORT_BBR;  
168 - }  
169 -  
170 - public String getREPORT_XL() {  
171 - return REPORT_XL;  
172 - }  
173 -  
174 - public void setREPORT_XL(String REPORT_XL) {  
175 - this.REPORT_XL = REPORT_XL;  
176 - }  
177 -  
178 - public String getREPORT_XLNAME() {  
179 - return REPORT_XLNAME;  
180 - }  
181 -  
182 - public void setREPORT_XLNAME(String REPORT_XLNAME) {  
183 - this.REPORT_XLNAME = REPORT_XLNAME;  
184 - }  
185 -  
186 - public String getREPORT_STATION() {  
187 - return REPORT_STATION;  
188 - }  
189 -  
190 - public void setREPORT_STATION(String REPORT_STATION) {  
191 - this.REPORT_STATION = REPORT_STATION;  
192 - }  
193 -  
194 - public String getREPORT_DWSBBM() {  
195 - return REPORT_DWSBBM;  
196 - }  
197 -  
198 - public void setREPORT_DWSBBM(String REPORT_DWSBBM) {  
199 - this.REPORT_DWSBBM = REPORT_DWSBBM;  
200 - }  
201 -  
202 - public String getREPORT_DWSBSJ() {  
203 - return REPORT_DWSBSJ;  
204 - }  
205 -  
206 - public void setREPORT_DWSBSJ(String REPORT_DWSBSJ) {  
207 - this.REPORT_DWSBSJ = REPORT_DWSBSJ;  
208 - }  
209 -  
210 - public String getREPORT_YWSJ() {  
211 - return REPORT_YWSJ;  
212 - }  
213 -  
214 - public void setREPORT_YWSJ(String REPORT_YWSJ) {  
215 - this.REPORT_YWSJ = REPORT_YWSJ;  
216 - }  
217 -  
218 - public String getREPORT_SMBWD() {  
219 - return REPORT_SMBWD;  
220 - }  
221 -  
222 - public void setREPORT_SMBWD(String REPORT_SMBWD) {  
223 - this.REPORT_SMBWD = REPORT_SMBWD;  
224 - }  
225 -  
226 - public String getREPORT_DJGSJ() {  
227 - return REPORT_DJGSJ;  
228 - }  
229 -  
230 - public void setREPORT_DJGSJ(String REPORT_DJGSJ) {  
231 - this.REPORT_DJGSJ = REPORT_DJGSJ;  
232 - }  
233 -  
234 - public String getREPORT_DJGYY() {  
235 - return REPORT_DJGYY;  
236 - }  
237 -  
238 - public void setREPORT_DJGYY(String REPORT_DJGYY) {  
239 - this.REPORT_DJGYY = REPORT_DJGYY;  
240 - }  
241 -  
242 - public String getREPORT_TFSJ() {  
243 - return REPORT_TFSJ;  
244 - }  
245 -  
246 - public void setREPORT_TFSJ(String REPORT_TFSJ) {  
247 - this.REPORT_TFSJ = REPORT_TFSJ;  
248 - }  
249 -  
250 - public String getREPORT_YXSJ() {  
251 - return REPORT_YXSJ;  
252 - }  
253 -  
254 - public void setREPORT_YXSJ(String REPORT_YXSJ) {  
255 - this.REPORT_YXSJ = REPORT_YXSJ;  
256 - }  
257 -  
258 - public String getREPORT_YXBC() {  
259 - return REPORT_YXBC;  
260 - }  
261 -  
262 - public void setREPORT_YXBC(String REPORT_YXBC) {  
263 - this.REPORT_YXBC = REPORT_YXBC;  
264 - }  
265 -  
266 - public String getREPORT_TZCS() {  
267 - return REPORT_TZCS;  
268 - }  
269 -  
270 - public void setREPORT_TZCS(String REPORT_TZCS) {  
271 - this.REPORT_TZCS = REPORT_TZCS;  
272 - }  
273 -  
274 - public String getREPORT_SGBH() {  
275 - return REPORT_SGBH;  
276 - }  
277 -  
278 - public void setREPORT_SGBH(String REPORT_SGBH) {  
279 - this.REPORT_SGBH = REPORT_SGBH;  
280 - }  
281 -  
282 - public String getREPORT_ZBH() {  
283 - return REPORT_ZBH;  
284 - }  
285 -  
286 - public void setREPORT_ZBH(String REPORT_ZBH) {  
287 - this.REPORT_ZBH = REPORT_ZBH;  
288 - }  
289 -  
290 - public String getREPORT_PZH() {  
291 - return REPORT_PZH;  
292 - }  
293 -  
294 - public void setREPORT_PZH(String REPORT_PZH) {  
295 - this.REPORT_PZH = REPORT_PZH;  
296 - }  
297 -  
298 - public String getREPORT_JSY() {  
299 - return REPORT_JSY;  
300 - }  
301 -  
302 - public void setREPORT_JSY(String REPORT_JSY) {  
303 - this.REPORT_JSY = REPORT_JSY;  
304 - }  
305 -  
306 - public String getREPORT_SGSJ() {  
307 - return REPORT_SGSJ;  
308 - }  
309 -  
310 - public void setREPORT_SGSJ(String REPORT_SGSJ) {  
311 - this.REPORT_SGSJ = REPORT_SGSJ;  
312 - }  
313 -  
314 - public String getREPORT_SGDD() {  
315 - return REPORT_SGDD;  
316 - }  
317 -  
318 - public void setREPORT_SGDD(String REPORT_SGDD) {  
319 - this.REPORT_SGDD = REPORT_SGDD;  
320 - }  
321 -  
322 - public String getREPORT_XSFX() {  
323 - return REPORT_XSFX;  
324 - }  
325 -  
326 - public void setREPORT_XSFX(String REPORT_XSFX) {  
327 - this.REPORT_XSFX = REPORT_XSFX;  
328 - }  
329 -  
330 - public String getREPORT_SGDX() {  
331 - return REPORT_SGDX;  
332 - }  
333 -  
334 - public void setREPORT_SGDX(String REPORT_SGDX) {  
335 - this.REPORT_SGDX = REPORT_SGDX;  
336 - }  
337 -  
338 - public String getREPORT_DXPZH() {  
339 - return REPORT_DXPZH;  
340 - }  
341 -  
342 - public void setREPORT_DXPZH(String REPORT_DXPZH) {  
343 - this.REPORT_DXPZH = REPORT_DXPZH;  
344 - }  
345 -  
346 - public String getREPORT_SGGK() {  
347 - return REPORT_SGGK;  
348 - }  
349 -  
350 - public void setREPORT_SGGK(String REPORT_SGGK) {  
351 - this.REPORT_SGGK = REPORT_SGGK;  
352 - }  
353 -  
354 - public String getREPORT_SSRS() {  
355 - return REPORT_SSRS;  
356 - }  
357 -  
358 - public void setREPORT_SSRS(String REPORT_SSRS) {  
359 - this.REPORT_SSRS = REPORT_SSRS;  
360 - }  
361 -  
362 - public String getREPORT_SWRS() {  
363 - return REPORT_SWRS;  
364 - }  
365 -  
366 - public void setREPORT_SWRS(String REPORT_SWRS) {  
367 - this.REPORT_SWRS = REPORT_SWRS;  
368 - }  
369 -  
370 - public String getREPORT_BGR() {  
371 - return REPORT_BGR;  
372 - }  
373 -  
374 - public void setREPORT_BGR(String REPORT_BGR) {  
375 - this.REPORT_BGR = REPORT_BGR;  
376 - }  
377 -  
378 - public String getREPORT_BGRDH() {  
379 - return REPORT_BGRDH;  
380 - }  
381 -  
382 - public void setREPORT_BGRDH(String REPORT_BGRDH) {  
383 - this.REPORT_BGRDH = REPORT_BGRDH;  
384 - }  
385 -  
386 - public String getREPORT_BZ() {  
387 - return REPORT_BZ;  
388 - }  
389 -  
390 - public void setREPORT_BZ(String REPORT_BZ) {  
391 - this.REPORT_BZ = REPORT_BZ;  
392 - }  
393 -  
394 - public String getCREATE_BY() {  
395 - return CREATE_BY;  
396 - }  
397 -  
398 - public void setCREATE_BY(String CREATE_BY) {  
399 - this.CREATE_BY = CREATE_BY;  
400 - }  
401 -  
402 - public Date getCREATE_DATE() {  
403 - return CREATE_DATE;  
404 - }  
405 -  
406 - public void setCREATE_DATE(Date CREATE_DATE) {  
407 - this.CREATE_DATE = CREATE_DATE;  
408 - }  
409 -  
410 - public String getUPDATE_BY() {  
411 - return UPDATE_BY;  
412 - }  
413 -  
414 - public void setUPDATE_BY(String UPDATE_BY) {  
415 - this.UPDATE_BY = UPDATE_BY;  
416 - }  
417 -  
418 - public Date getUPDATE_DATE() {  
419 - return UPDATE_DATE;  
420 - }  
421 -  
422 - public void setUPDATE_DATE(Date UPDATE_DATE) {  
423 - this.UPDATE_DATE = UPDATE_DATE;  
424 - }  
425 -  
426 - public String getREPORT_ROAD() {  
427 - return REPORT_ROAD;  
428 - }  
429 -  
430 - public void setREPORT_ROAD(String REPORT_ROAD) {  
431 - this.REPORT_ROAD = REPORT_ROAD;  
432 - }  
433 -  
434 - public String getSTATUS() {  
435 - return STATUS;  
436 - }  
437 -  
438 - public void setSTATUS(String STATUS) {  
439 - this.STATUS = STATUS;  
440 - }  
441 -  
442 - @Override  
443 - public String toString() {  
444 - DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
445 - return "{" +  
446 - "ID:'" + ID + '\'' +  
447 - ", REPORT_TYPE:'" + REPORT_TYPE + '\'' +  
448 - ", REPORT_GS:'" + REPORT_GS + '\'' +  
449 - ", REPORT_FGS:'" + REPORT_FGS + '\'' +  
450 - ", REPORT_DATE:'" + dateFormat.format(REPORT_DATE) + '\'' +  
451 - ", REPORT_BBR:'" + REPORT_BBR + '\'' +  
452 - ", REPORT_XL:'" + REPORT_XL + '\'' +  
453 - ", REPORT_XLNAME:'" + REPORT_XLNAME + '\'' +  
454 - ", REPORT_STATION:'" + REPORT_STATION + '\'' +  
455 - ", REPORT_DWSBBM:'" + REPORT_DWSBBM + '\'' +  
456 - ", REPORT_DWSBSJ:'" + REPORT_DWSBSJ + '\'' +  
457 - ", REPORT_YWSJ:'" + REPORT_YWSJ + '\'' +  
458 - ", REPORT_SMBWD:'" + REPORT_SMBWD + '\'' +  
459 - ", REPORT_DJGSJ:'" + REPORT_DJGSJ + '\'' +  
460 - ", REPORT_DJGYY:'" + REPORT_DJGYY + '\'' +  
461 - ", REPORT_TFSJ:'" + REPORT_TFSJ + '\'' +  
462 - ", REPORT_YXSJ:'" + REPORT_YXSJ + '\'' +  
463 - ", REPORT_YXBC:'" + REPORT_YXBC + '\'' +  
464 - ", REPORT_TZCS:'" + REPORT_TZCS + '\'' +  
465 - ", REPORT_SGBH:'" + REPORT_SGBH + '\'' +  
466 - ", REPORT_ZBH:'" + REPORT_ZBH + '\'' +  
467 - ", REPORT_PZH:'" + REPORT_PZH + '\'' +  
468 - ", REPORT_JSY:'" + REPORT_JSY + '\'' +  
469 - ", REPORT_SGSJ:'" + REPORT_SGSJ + '\'' +  
470 - ", REPORT_SGDD:'" + REPORT_SGDD + '\'' +  
471 - ", REPORT_XSFX:'" + REPORT_XSFX + '\'' +  
472 - ", REPORT_SGDX:'" + REPORT_SGDX + '\'' +  
473 - ", REPORT_DXPZH:'" + REPORT_DXPZH + '\'' +  
474 - ", REPORT_SGGK:'" + REPORT_SGGK + '\'' +  
475 - ", REPORT_SSRS:'" + REPORT_SSRS + '\'' +  
476 - ", REPORT_SWRS:'" + REPORT_SWRS + '\'' +  
477 - ", REPORT_BGR:'" + REPORT_BGR + '\'' +  
478 - ", REPORT_BGRDH:'" + REPORT_BGRDH + '\'' +  
479 - ", REPORT_BZ:'" + REPORT_BZ + '\'' +  
480 - ", CREATE_BY:'" + CREATE_BY + '\'' +  
481 - ", CREATE_DATE:" + CREATE_DATE +  
482 - ", UPDATE_BY:'" + UPDATE_BY + '\'' +  
483 - ", UPDATE_DATE:" + UPDATE_DATE +  
484 - ", REPORT_ROAD:'" + REPORT_ROAD + '\'' +  
485 - ", STATUS:'" + STATUS + '\'' +  
486 - '}';  
487 - }  
488 -} 1 +package com.bsth.data.report_register.entity;
  2 +
  3 +import javax.persistence.Column;
  4 +import javax.persistence.Entity;
  5 +import javax.persistence.GeneratedValue;
  6 +import javax.persistence.Id;
  7 +import javax.persistence.Table;
  8 +import java.text.DateFormat;
  9 +import java.text.SimpleDateFormat;
  10 +import java.util.Date;
  11 +
  12 +
  13 +@Entity
  14 +@Table(name = "bsth_t_report")
  15 +public class ReportRegister {
  16 +
  17 + @Id
  18 + @GeneratedValue
  19 + private long ID;
  20 +
  21 + /** 类型*/
  22 + private String REPORT_TYPE;
  23 + /** 公司 */
  24 + private String REPORT_GS;
  25 + /** 分公司 */
  26 + private String REPORT_FGS;
  27 + /** 公司名 */
  28 + private String REPORT_GSNAME;
  29 + /** 分公司名 */
  30 + private String REPORT_FGSNAME;
  31 + /** 时间*/
  32 + private Date REPORT_DATE;
  33 + /** 报备人*/
  34 + private String REPORT_BBR;
  35 + /** 线路编码 */
  36 + private String REPORT_XL;
  37 + /** 线路名*/
  38 + private String REPORT_XLNAME;
  39 + /** 站点*/
  40 + private String REPORT_STATION;
  41 + /** 对外上报部门*/
  42 + private String REPORT_DWSBBM;
  43 + /** 对外上报时间*/
  44 + private String REPORT_DWSBSJ;
  45 + /** 延误时间*/
  46 + private String REPORT_YWSJ;
  47 + /** 首末班误点原因*/
  48 + private String REPORT_SMBWD;
  49 + /** 大间隔时间*/
  50 + private String REPORT_DJGSJ;
  51 + /** 大间隔原因*/
  52 + private String REPORT_DJGYY;
  53 + /** 突发事件*/
  54 + private String REPORT_TFSJ;
  55 + /** 影响时间*/
  56 + private String REPORT_YXSJ;
  57 + /** 影响班次数*/
  58 + private String REPORT_YXBC;
  59 + /** 调整措施*/
  60 + private String REPORT_TZCS;
  61 + /** 报案事故编号*/
  62 + private String REPORT_SGBH;
  63 + /** 车辆自编号*/
  64 + private String REPORT_ZBH;
  65 + /** 车辆牌照号*/
  66 + private String REPORT_PZH;
  67 + /** 驾驶员*/
  68 + private String REPORT_JSY;
  69 + /** 事故发生时间*/
  70 + private String REPORT_SGSJ;
  71 + /** 事故发生地点*/
  72 + private String REPORT_SGDD;
  73 + /** 行驶方向*/
  74 + private String REPORT_XSFX;
  75 + /** 事故对象*/
  76 + private String REPORT_SGDX;
  77 + /** 对象车牌照号*/
  78 + private String REPORT_DXPZH;
  79 + /** 事故概况*/
  80 + private String REPORT_SGGK;
  81 + /** 受伤人数*/
  82 + private String REPORT_SSRS;
  83 + /** 死亡人数*/
  84 + private String REPORT_SWRS;
  85 + /** 报告人 */
  86 + private String REPORT_BGR;
  87 + /** 报告人电话 */
  88 + private String REPORT_BGRDH;
  89 + /** 备注 */
  90 + private String REPORT_BZ;
  91 + /** 路段*/
  92 + private String REPORT_ROAD;
  93 + /** 访问接口时使用的状态码 操作类型,0:新增;1:修改;2:删除 */
  94 + private String STATUS;
  95 + /** 创建人*/
  96 + private String CREATE_BY;
  97 + /** 创建时间 */
  98 + @Column(updatable = false, name = "CREATE_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  99 + private Date CREATE_DATE;
  100 + /** 修改人*/
  101 + private String UPDATE_BY;
  102 + /** 修改时间*/
  103 + @Column(name = "UPDATE_DATE", columnDefinition = "UPDATE_DATE DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  104 + private Date UPDATE_DATE;
  105 +
  106 + public long getID() {
  107 + return ID;
  108 + }
  109 +
  110 + public void setID(long ID) {
  111 + this.ID = ID;
  112 + }
  113 +
  114 + public String getREPORT_TYPE() {
  115 + return REPORT_TYPE;
  116 + }
  117 +
  118 + public void setREPORT_TYPE(String REPORT_TYPE) {
  119 + this.REPORT_TYPE = REPORT_TYPE;
  120 + }
  121 +
  122 + public String getREPORT_GS() {
  123 + return REPORT_GS;
  124 + }
  125 +
  126 + public void setREPORT_GS(String REPORT_GS) {
  127 + this.REPORT_GS = REPORT_GS;
  128 + }
  129 +
  130 + public String getREPORT_FGS() {
  131 + return REPORT_FGS;
  132 + }
  133 +
  134 + public void setREPORT_FGS(String REPORT_FGS) {
  135 + this.REPORT_FGS = REPORT_FGS;
  136 + }
  137 +
  138 + public String getREPORT_GSNAME() {
  139 + return REPORT_GSNAME;
  140 + }
  141 +
  142 + public void setREPORT_GSNAME(String REPORT_GSNAME) {
  143 + this.REPORT_GSNAME = REPORT_GSNAME;
  144 + }
  145 +
  146 + public String getREPORT_FGSNAME() {
  147 + return REPORT_FGSNAME;
  148 + }
  149 +
  150 + public void setREPORT_FGSNAME(String REPORT_FGSNAME) {
  151 + this.REPORT_FGSNAME = REPORT_FGSNAME;
  152 + }
  153 +
  154 + public Date getREPORT_DATE() {
  155 + return REPORT_DATE;
  156 + }
  157 +
  158 + public void setREPORT_DATE(Date REPORT_DATE) {
  159 + this.REPORT_DATE = REPORT_DATE;
  160 + }
  161 +
  162 + public String getREPORT_BBR() {
  163 + return REPORT_BBR;
  164 + }
  165 +
  166 + public void setREPORT_BBR(String REPORT_BBR) {
  167 + this.REPORT_BBR = REPORT_BBR;
  168 + }
  169 +
  170 + public String getREPORT_XL() {
  171 + return REPORT_XL;
  172 + }
  173 +
  174 + public void setREPORT_XL(String REPORT_XL) {
  175 + this.REPORT_XL = REPORT_XL;
  176 + }
  177 +
  178 + public String getREPORT_XLNAME() {
  179 + return REPORT_XLNAME;
  180 + }
  181 +
  182 + public void setREPORT_XLNAME(String REPORT_XLNAME) {
  183 + this.REPORT_XLNAME = REPORT_XLNAME;
  184 + }
  185 +
  186 + public String getREPORT_STATION() {
  187 + return REPORT_STATION;
  188 + }
  189 +
  190 + public void setREPORT_STATION(String REPORT_STATION) {
  191 + this.REPORT_STATION = REPORT_STATION;
  192 + }
  193 +
  194 + public String getREPORT_DWSBBM() {
  195 + return REPORT_DWSBBM;
  196 + }
  197 +
  198 + public void setREPORT_DWSBBM(String REPORT_DWSBBM) {
  199 + this.REPORT_DWSBBM = REPORT_DWSBBM;
  200 + }
  201 +
  202 + public String getREPORT_DWSBSJ() {
  203 + return REPORT_DWSBSJ;
  204 + }
  205 +
  206 + public void setREPORT_DWSBSJ(String REPORT_DWSBSJ) {
  207 + this.REPORT_DWSBSJ = REPORT_DWSBSJ;
  208 + }
  209 +
  210 + public String getREPORT_YWSJ() {
  211 + return REPORT_YWSJ;
  212 + }
  213 +
  214 + public void setREPORT_YWSJ(String REPORT_YWSJ) {
  215 + this.REPORT_YWSJ = REPORT_YWSJ;
  216 + }
  217 +
  218 + public String getREPORT_SMBWD() {
  219 + return REPORT_SMBWD;
  220 + }
  221 +
  222 + public void setREPORT_SMBWD(String REPORT_SMBWD) {
  223 + this.REPORT_SMBWD = REPORT_SMBWD;
  224 + }
  225 +
  226 + public String getREPORT_DJGSJ() {
  227 + return REPORT_DJGSJ;
  228 + }
  229 +
  230 + public void setREPORT_DJGSJ(String REPORT_DJGSJ) {
  231 + this.REPORT_DJGSJ = REPORT_DJGSJ;
  232 + }
  233 +
  234 + public String getREPORT_DJGYY() {
  235 + return REPORT_DJGYY;
  236 + }
  237 +
  238 + public void setREPORT_DJGYY(String REPORT_DJGYY) {
  239 + this.REPORT_DJGYY = REPORT_DJGYY;
  240 + }
  241 +
  242 + public String getREPORT_TFSJ() {
  243 + return REPORT_TFSJ;
  244 + }
  245 +
  246 + public void setREPORT_TFSJ(String REPORT_TFSJ) {
  247 + this.REPORT_TFSJ = REPORT_TFSJ;
  248 + }
  249 +
  250 + public String getREPORT_YXSJ() {
  251 + return REPORT_YXSJ;
  252 + }
  253 +
  254 + public void setREPORT_YXSJ(String REPORT_YXSJ) {
  255 + this.REPORT_YXSJ = REPORT_YXSJ;
  256 + }
  257 +
  258 + public String getREPORT_YXBC() {
  259 + return REPORT_YXBC;
  260 + }
  261 +
  262 + public void setREPORT_YXBC(String REPORT_YXBC) {
  263 + this.REPORT_YXBC = REPORT_YXBC;
  264 + }
  265 +
  266 + public String getREPORT_TZCS() {
  267 + return REPORT_TZCS;
  268 + }
  269 +
  270 + public void setREPORT_TZCS(String REPORT_TZCS) {
  271 + this.REPORT_TZCS = REPORT_TZCS;
  272 + }
  273 +
  274 + public String getREPORT_SGBH() {
  275 + return REPORT_SGBH;
  276 + }
  277 +
  278 + public void setREPORT_SGBH(String REPORT_SGBH) {
  279 + this.REPORT_SGBH = REPORT_SGBH;
  280 + }
  281 +
  282 + public String getREPORT_ZBH() {
  283 + return REPORT_ZBH;
  284 + }
  285 +
  286 + public void setREPORT_ZBH(String REPORT_ZBH) {
  287 + this.REPORT_ZBH = REPORT_ZBH;
  288 + }
  289 +
  290 + public String getREPORT_PZH() {
  291 + return REPORT_PZH;
  292 + }
  293 +
  294 + public void setREPORT_PZH(String REPORT_PZH) {
  295 + this.REPORT_PZH = REPORT_PZH;
  296 + }
  297 +
  298 + public String getREPORT_JSY() {
  299 + return REPORT_JSY;
  300 + }
  301 +
  302 + public void setREPORT_JSY(String REPORT_JSY) {
  303 + this.REPORT_JSY = REPORT_JSY;
  304 + }
  305 +
  306 + public String getREPORT_SGSJ() {
  307 + return REPORT_SGSJ;
  308 + }
  309 +
  310 + public void setREPORT_SGSJ(String REPORT_SGSJ) {
  311 + this.REPORT_SGSJ = REPORT_SGSJ;
  312 + }
  313 +
  314 + public String getREPORT_SGDD() {
  315 + return REPORT_SGDD;
  316 + }
  317 +
  318 + public void setREPORT_SGDD(String REPORT_SGDD) {
  319 + this.REPORT_SGDD = REPORT_SGDD;
  320 + }
  321 +
  322 + public String getREPORT_XSFX() {
  323 + return REPORT_XSFX;
  324 + }
  325 +
  326 + public void setREPORT_XSFX(String REPORT_XSFX) {
  327 + this.REPORT_XSFX = REPORT_XSFX;
  328 + }
  329 +
  330 + public String getREPORT_SGDX() {
  331 + return REPORT_SGDX;
  332 + }
  333 +
  334 + public void setREPORT_SGDX(String REPORT_SGDX) {
  335 + this.REPORT_SGDX = REPORT_SGDX;
  336 + }
  337 +
  338 + public String getREPORT_DXPZH() {
  339 + return REPORT_DXPZH;
  340 + }
  341 +
  342 + public void setREPORT_DXPZH(String REPORT_DXPZH) {
  343 + this.REPORT_DXPZH = REPORT_DXPZH;
  344 + }
  345 +
  346 + public String getREPORT_SGGK() {
  347 + return REPORT_SGGK;
  348 + }
  349 +
  350 + public void setREPORT_SGGK(String REPORT_SGGK) {
  351 + this.REPORT_SGGK = REPORT_SGGK;
  352 + }
  353 +
  354 + public String getREPORT_SSRS() {
  355 + return REPORT_SSRS;
  356 + }
  357 +
  358 + public void setREPORT_SSRS(String REPORT_SSRS) {
  359 + this.REPORT_SSRS = REPORT_SSRS;
  360 + }
  361 +
  362 + public String getREPORT_SWRS() {
  363 + return REPORT_SWRS;
  364 + }
  365 +
  366 + public void setREPORT_SWRS(String REPORT_SWRS) {
  367 + this.REPORT_SWRS = REPORT_SWRS;
  368 + }
  369 +
  370 + public String getREPORT_BGR() {
  371 + return REPORT_BGR;
  372 + }
  373 +
  374 + public void setREPORT_BGR(String REPORT_BGR) {
  375 + this.REPORT_BGR = REPORT_BGR;
  376 + }
  377 +
  378 + public String getREPORT_BGRDH() {
  379 + return REPORT_BGRDH;
  380 + }
  381 +
  382 + public void setREPORT_BGRDH(String REPORT_BGRDH) {
  383 + this.REPORT_BGRDH = REPORT_BGRDH;
  384 + }
  385 +
  386 + public String getREPORT_BZ() {
  387 + return REPORT_BZ;
  388 + }
  389 +
  390 + public void setREPORT_BZ(String REPORT_BZ) {
  391 + this.REPORT_BZ = REPORT_BZ;
  392 + }
  393 +
  394 + public String getCREATE_BY() {
  395 + return CREATE_BY;
  396 + }
  397 +
  398 + public void setCREATE_BY(String CREATE_BY) {
  399 + this.CREATE_BY = CREATE_BY;
  400 + }
  401 +
  402 + public Date getCREATE_DATE() {
  403 + return CREATE_DATE;
  404 + }
  405 +
  406 + public void setCREATE_DATE(Date CREATE_DATE) {
  407 + this.CREATE_DATE = CREATE_DATE;
  408 + }
  409 +
  410 + public String getUPDATE_BY() {
  411 + return UPDATE_BY;
  412 + }
  413 +
  414 + public void setUPDATE_BY(String UPDATE_BY) {
  415 + this.UPDATE_BY = UPDATE_BY;
  416 + }
  417 +
  418 + public Date getUPDATE_DATE() {
  419 + return UPDATE_DATE;
  420 + }
  421 +
  422 + public void setUPDATE_DATE(Date UPDATE_DATE) {
  423 + this.UPDATE_DATE = UPDATE_DATE;
  424 + }
  425 +
  426 + public String getREPORT_ROAD() {
  427 + return REPORT_ROAD;
  428 + }
  429 +
  430 + public void setREPORT_ROAD(String REPORT_ROAD) {
  431 + this.REPORT_ROAD = REPORT_ROAD;
  432 + }
  433 +
  434 + public String getSTATUS() {
  435 + return STATUS;
  436 + }
  437 +
  438 + public void setSTATUS(String STATUS) {
  439 + this.STATUS = STATUS;
  440 + }
  441 +
  442 + @Override
  443 + public String toString() {
  444 + DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  445 + return "{" +
  446 + "ID:'" + ID + '\'' +
  447 + ", REPORT_TYPE:'" + REPORT_TYPE + '\'' +
  448 + ", REPORT_GS:'" + REPORT_GS + '\'' +
  449 + ", REPORT_FGS:'" + REPORT_FGS + '\'' +
  450 + ", REPORT_DATE:'" + dateFormat.format(REPORT_DATE) + '\'' +
  451 + ", REPORT_BBR:'" + REPORT_BBR + '\'' +
  452 + ", REPORT_XL:'" + REPORT_XL + '\'' +
  453 + ", REPORT_XLNAME:'" + REPORT_XLNAME + '\'' +
  454 + ", REPORT_STATION:'" + REPORT_STATION + '\'' +
  455 + ", REPORT_DWSBBM:'" + REPORT_DWSBBM + '\'' +
  456 + ", REPORT_DWSBSJ:'" + REPORT_DWSBSJ + '\'' +
  457 + ", REPORT_YWSJ:'" + REPORT_YWSJ + '\'' +
  458 + ", REPORT_SMBWD:'" + REPORT_SMBWD + '\'' +
  459 + ", REPORT_DJGSJ:'" + REPORT_DJGSJ + '\'' +
  460 + ", REPORT_DJGYY:'" + REPORT_DJGYY + '\'' +
  461 + ", REPORT_TFSJ:'" + REPORT_TFSJ + '\'' +
  462 + ", REPORT_YXSJ:'" + REPORT_YXSJ + '\'' +
  463 + ", REPORT_YXBC:'" + REPORT_YXBC + '\'' +
  464 + ", REPORT_TZCS:'" + REPORT_TZCS + '\'' +
  465 + ", REPORT_SGBH:'" + REPORT_SGBH + '\'' +
  466 + ", REPORT_ZBH:'" + REPORT_ZBH + '\'' +
  467 + ", REPORT_PZH:'" + REPORT_PZH + '\'' +
  468 + ", REPORT_JSY:'" + REPORT_JSY + '\'' +
  469 + ", REPORT_SGSJ:'" + REPORT_SGSJ + '\'' +
  470 + ", REPORT_SGDD:'" + REPORT_SGDD + '\'' +
  471 + ", REPORT_XSFX:'" + REPORT_XSFX + '\'' +
  472 + ", REPORT_SGDX:'" + REPORT_SGDX + '\'' +
  473 + ", REPORT_DXPZH:'" + REPORT_DXPZH + '\'' +
  474 + ", REPORT_SGGK:'" + REPORT_SGGK + '\'' +
  475 + ", REPORT_SSRS:'" + REPORT_SSRS + '\'' +
  476 + ", REPORT_SWRS:'" + REPORT_SWRS + '\'' +
  477 + ", REPORT_BGR:'" + REPORT_BGR + '\'' +
  478 + ", REPORT_BGRDH:'" + REPORT_BGRDH + '\'' +
  479 + ", REPORT_BZ:'" + REPORT_BZ + '\'' +
  480 + ", CREATE_BY:'" + CREATE_BY + '\'' +
  481 + ", CREATE_DATE:" + CREATE_DATE +
  482 + ", UPDATE_BY:'" + UPDATE_BY + '\'' +
  483 + ", UPDATE_DATE:" + UPDATE_DATE +
  484 + ", REPORT_ROAD:'" + REPORT_ROAD + '\'' +
  485 + ", STATUS:'" + STATUS + '\'' +
  486 + '}';
  487 + }
  488 +}
src/main/java/com/bsth/data/report_register/repository/ReportRegisterRepository.java
1 -package com.bsth.data.report_register.repository;  
2 -  
3 -import com.bsth.data.report_register.entity.ReportRegister;  
4 -import com.bsth.repository.BaseRepository;  
5 -import org.springframework.stereotype.Repository;  
6 -  
7 -/**  
8 - *  
9 - * @Interface: ReportRegisterRepository(等级报表Repository数据持久层接口)  
10 - *  
11 - * @Author yrf  
12 - *  
13 - * @Date 2019-12-04  
14 - *  
15 - * @Version 公交调度系统BS版 0.1  
16 - *  
17 - */  
18 -  
19 -@Repository  
20 -public interface ReportRegisterRepository extends BaseRepository<ReportRegister, Long> {  
21 -  
22 -} 1 +package com.bsth.data.report_register.repository;
  2 +
  3 +import com.bsth.data.report_register.entity.ReportRegister;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +/**
  8 + *
  9 + * @Interface: ReportRegisterRepository(等级报表Repository数据持久层接口)
  10 + *
  11 + * @Author yrf
  12 + *
  13 + * @Date 2019-12-04
  14 + *
  15 + * @Version 公交调度系统BS版 0.1
  16 + *
  17 + */
  18 +
  19 +@Repository
  20 +public interface ReportRegisterRepository extends BaseRepository<ReportRegister, Long> {
  21 +
  22 +}
src/main/java/com/bsth/entity/schedule/TTInfoBxDetail.java 0 → 100644
  1 +package com.bsth.entity.schedule;
  2 +
  3 +import com.bsth.control_v2.plan_module.common.enums.ttinfo.BxType;
  4 +import com.bsth.entity.Line;
  5 +import com.bsth.entity.schedule.covert.BxTypeConverter;
  6 +
  7 +import javax.persistence.*;
  8 +
  9 +/**
  10 + * 时刻表明细信息(班型信息)。
  11 + */
  12 +@Entity
  13 +@Table(name = "bsth_c_s_ttinfo_bx_detail")
  14 +public class TTInfoBxDetail extends BEntity {
  15 +
  16 + /** 主健Id */
  17 + @Id
  18 + @GeneratedValue
  19 + private Long id;
  20 +
  21 +
  22 + /** 关联线路 */
  23 + @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
  24 + private Line xl;
  25 + /** 线路版本(bsth_c_line_versions表对应字段) */
  26 + @Column(nullable = false)
  27 + private int lineVersion;
  28 + /** 时刻表主对象关联 */
  29 + @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
  30 + private TTInfo ttinfo;
  31 + /** 关联的路牌 */
  32 + @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
  33 + private GuideboardInfo lp;
  34 +
  35 + /** 路牌班型1 */
  36 + @Convert(converter = BxTypeConverter.class)
  37 + @Column(nullable = false)
  38 + private BxType bxType1;
  39 + /** 路牌班型2 */
  40 + @Column(nullable = false)
  41 + @Convert(converter = BxTypeConverter.class)
  42 + private BxType bxType2;
  43 + /** 路牌配档数 */
  44 + private String bxPds;
  45 +
  46 + /** 版本控制 */
  47 + @Version
  48 + @Column(nullable = false)
  49 + private int version;
  50 +
  51 + // TODO:
  52 +
  53 + public Long getId() {
  54 + return id;
  55 + }
  56 +
  57 + public void setId(Long id) {
  58 + this.id = id;
  59 + }
  60 +
  61 + public Line getXl() {
  62 + return xl;
  63 + }
  64 +
  65 + public void setXl(Line xl) {
  66 + this.xl = xl;
  67 + }
  68 +
  69 + public int getLineVersion() {
  70 + return lineVersion;
  71 + }
  72 +
  73 + public void setLineVersion(int lineVersion) {
  74 + this.lineVersion = lineVersion;
  75 + }
  76 +
  77 + public TTInfo getTtinfo() {
  78 + return ttinfo;
  79 + }
  80 +
  81 + public void setTtinfo(TTInfo ttinfo) {
  82 + this.ttinfo = ttinfo;
  83 + }
  84 +
  85 + public GuideboardInfo getLp() {
  86 + return lp;
  87 + }
  88 +
  89 + public void setLp(GuideboardInfo lp) {
  90 + this.lp = lp;
  91 + }
  92 +
  93 + public BxType getBxType1() {
  94 + return bxType1;
  95 + }
  96 +
  97 + public void setBxType1(BxType bxType1) {
  98 + this.bxType1 = bxType1;
  99 + }
  100 +
  101 + public BxType getBxType2() {
  102 + return bxType2;
  103 + }
  104 +
  105 + public void setBxType2(BxType bxType2) {
  106 + this.bxType2 = bxType2;
  107 + }
  108 +
  109 + public String getBxPds() {
  110 + return bxPds;
  111 + }
  112 +
  113 + public void setBxPds(String bxPds) {
  114 + this.bxPds = bxPds;
  115 + }
  116 +
  117 + public int getVersion() {
  118 + return version;
  119 + }
  120 +
  121 + public void setVersion(int version) {
  122 + this.version = version;
  123 + }
  124 +
  125 +}
src/main/java/com/bsth/entity/schedule/covert/BxTypeConverter.java 0 → 100644
  1 +package com.bsth.entity.schedule.covert;
  2 +
  3 +import com.bsth.control_v2.plan_module.common.enums.ttinfo.BxType;
  4 +import org.apache.commons.lang3.StringUtils;
  5 +
  6 +import javax.persistence.AttributeConverter;
  7 +import javax.persistence.Convert;
  8 +
  9 +@Convert
  10 +public class BxTypeConverter implements AttributeConverter<BxType, String> {
  11 + @Override
  12 + public String convertToDatabaseColumn(BxType attribute) {
  13 + return attribute.getDicDesc();
  14 + }
  15 +
  16 + @Override
  17 + public BxType convertToEntityAttribute(String dbData) {
  18 + if (StringUtils.isEmpty(dbData)) {
  19 + return null;
  20 + } else {
  21 + return BxType.fromDicDesc(dbData);
  22 + }
  23 +
  24 + }
  25 +}
src/main/java/com/bsth/repository/calc/CalcWaybillRepository.java
@@ -66,7 +66,10 @@ public interface CalcWaybillRepository extends BaseRepository&lt;CalcWaybill, Integ @@ -66,7 +66,10 @@ public interface CalcWaybillRepository extends BaseRepository&lt;CalcWaybill, Integ
66 @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and CONCAT(sGh,'/',sName) like %?6% order by c.xl") 66 @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and CONCAT(sGh,'/',sName) like %?6% order by c.xl")
67 List<CalcWaybill> scheduleBySpy(String line,String date,String date2,String gsdm,String fgsdm,String spy); 67 List<CalcWaybill> scheduleBySpy(String line,String date,String date2,String gsdm,String fgsdm,String spy);
68 //按照时间段统计,公司下线路 (车辆自编号) 68 //按照时间段统计,公司下线路 (车辆自编号)
69 - @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and cl like %?6% order by c.xl") 69 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and c.cl like %?6% order by c.xl")
70 List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh); 70 List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh);
  71 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and c.cl like %?6%"
  72 + + " and c.cl in (select s.carCode from Cars s where s.sfdc = ?7) order by c.xl")
  73 + List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh,Boolean sfdc);
71 74
72 } 75 }
src/main/java/com/bsth/repository/oil/CwjyRepository.java
@@ -33,5 +33,22 @@ public interface CwjyRepository extends BaseRepository&lt;Cwjy, Integer&gt;{ @@ -33,5 +33,22 @@ public interface CwjyRepository extends BaseRepository&lt;Cwjy, Integer&gt;{
33 @Query(value="select * from bsth_c_cwjy where nbbm like %?1% and gsdm like %?2% and fgsdm like %?3% and line =?4",nativeQuery=true) 33 @Query(value="select * from bsth_c_cwjy where nbbm like %?1% and gsdm like %?2% and fgsdm like %?3% and line =?4",nativeQuery=true)
34 List<Cwjy> selectAll_s(String nbbm,String gsdm,String fgsdm,String line); 34 List<Cwjy> selectAll_s(String nbbm,String gsdm,String fgsdm,String line);
35 35
  36 +
  37 + @Query(value="SELECT jzl FROM bsth_c_ylxxb where gsdm = ?1 and yyrq = ?2 and nbbm = ?3 and jylx = '1' ",nativeQuery=true)
  38 + List<Double> import_queryBySame( String gsbm, String rq, String nbbm);
  39 +
  40 + @Transactional
  41 + @Modifying
  42 + @Query(value="INSERT INTO bsth_c_ylxxb("+
  43 + "gsdm, yyrq, nbbm, jsy, jzl, stationid, bz, createtime, nylx, jylx) " +
  44 + "VALUES(" +
  45 + "?1,str_to_date(?2,'%Y-%m-%d'),?3,?4,?5,?6,?7,str_to_date(?8,'%Y-%m-%d %H:%i:%s'), '0', '1') ", nativeQuery=true)
  46 + void import_insertData(String gsbm, String rq, String nbbm, String jsy, String jzl, String jyz, String remarks, String createtime);
  47 +
  48 + @Transactional
  49 + @Modifying
  50 + @Query(value="UPDATE bsth_c_ylxxb set jzl = ?1, jsy = ?2, stationid = ?3, bz = ?4 "
  51 + + "where gsdm = ?5 and yyrq = ?6 and nbbm = ?7 and jylx = '1' ",nativeQuery=true)
  52 + void import_UpdateJzl(String jzl, String jsy, String jyz, String remarks, String gsbm, String rq, String nbbm);
36 53
37 } 54 }
src/main/java/com/bsth/repository/schedule/TTInfoBxDetailRepository.java 0 → 100644
  1 +package com.bsth.repository.schedule;
  2 +
  3 +import com.bsth.entity.schedule.TTInfoBxDetail;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +@Repository
  8 +public interface TTInfoBxDetailRepository extends BaseRepository<TTInfoBxDetail, Long> {
  9 +
  10 +}
src/main/java/com/bsth/service/calc/CalcMixService.java
@@ -10,6 +10,6 @@ public interface CalcMixService { @@ -10,6 +10,6 @@ public interface CalcMixService {
10 10
11 List<Map<String, Object>> calcjsyspy(String line, String startDate, String endDate, String cont, String empnames, String gsdmManth, String fgsdmManth); 11 List<Map<String, Object>> calcjsyspy(String line, String startDate, String endDate, String cont, String empnames, String gsdmManth, String fgsdmManth);
12 12
13 - List<Map<String, Object>> singledatatj(String line, String startDate, String endDate, String tjtype, String cont, String gsdmSing, String fgsdmSing); 13 + List<Map<String, Object>> singledatatj(String line, String startDate, String endDate, String tjtype, String cont, String gsdmSing, String fgsdmSing, String sfdc);
14 14
15 } 15 }
src/main/java/com/bsth/service/calc/impl/CalcMixServiceImpl.java
@@ -160,7 +160,7 @@ public class CalcMixServiceImpl implements CalcMixService { @@ -160,7 +160,7 @@ public class CalcMixServiceImpl implements CalcMixService {
160 public List<Map<String, Object>> singledatatj(String line, 160 public List<Map<String, Object>> singledatatj(String line,
161 String date, String date2, 161 String date, String date2,
162 String tjtype, String cont, 162 String tjtype, String cont,
163 - String gsdm, String fgsdm) { 163 + String gsdm, String fgsdm, String sfdc) {
164 164
165 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 165 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
166 List<CalcWaybill> list = null; 166 List<CalcWaybill> list = null;
@@ -174,7 +174,13 @@ public class CalcMixServiceImpl implements CalcMixService { @@ -174,7 +174,13 @@ public class CalcMixServiceImpl implements CalcMixService {
174 list = calcRepository.scheduleBySpy(line, date, date2, gsdm, fgsdm, cont); 174 list = calcRepository.scheduleBySpy(line, date, date2, gsdm, fgsdm, cont);
175 } else if("车辆自编号".equals(tjtype)){ 175 } else if("车辆自编号".equals(tjtype)){
176 flag = 3; 176 flag = 3;
177 - list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont); 177 + if("1".equals(sfdc)){
  178 + list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont, true);
  179 + } else if("0".equals(sfdc)){
  180 + list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont, false);
  181 + } else {
  182 + list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont);
  183 + }
178 } 184 }
179 185
180 List<CalcWaybill> calcList = new ArrayList<CalcWaybill>(); 186 List<CalcWaybill> calcList = new ArrayList<CalcWaybill>();
@@ -267,7 +273,7 @@ public class CalcMixServiceImpl implements CalcMixService { @@ -267,7 +273,7 @@ public class CalcMixServiceImpl implements CalcMixService {
267 + linesql 273 + linesql
268 + " union" 274 + " union"
269 + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb" 275 + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb"
270 - + " WHERE rq >= '"+date2+"' and rq <= '"+date2+"'" 276 + + " WHERE rq >= '"+date+"' and rq <= '"+date2+"'"
271 + linesql; 277 + linesql;
272 List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { 278 List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() {
273 @Override 279 @Override
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
@@ -13,6 +13,7 @@ import java.text.DecimalFormat; @@ -13,6 +13,7 @@ import java.text.DecimalFormat;
13 import java.text.ParseException; 13 import java.text.ParseException;
14 import java.text.SimpleDateFormat; 14 import java.text.SimpleDateFormat;
15 import java.util.ArrayList; 15 import java.util.ArrayList;
  16 +import java.util.Arrays;
16 import java.util.Calendar; 17 import java.util.Calendar;
17 import java.util.Collections; 18 import java.util.Collections;
18 import java.util.Comparator; 19 import java.util.Comparator;
@@ -1173,7 +1174,7 @@ public class GpsServiceImpl implements GpsService { @@ -1173,7 +1174,7 @@ public class GpsServiceImpl implements GpsService {
1173 } 1174 }
1174 //过滤数据 1175 //过滤数据
1175 for (SafeDriv sd : list) { 1176 for (SafeDriv sd : list) {
1176 - if (fieldEquals(fs, sd, map)) 1177 + if (isSpecialLines(sd, map) && fieldEquals(fs, sd, map))
1177 rs.add(sd); 1178 rs.add(sd);
1178 } 1179 }
1179 1180
@@ -1294,6 +1295,20 @@ public class GpsServiceImpl implements GpsService { @@ -1294,6 +1295,20 @@ public class GpsServiceImpl implements GpsService {
1294 } 1295 }
1295 }); 1296 });
1296 } 1297 }
  1298 +
  1299 + /**
  1300 + *
  1301 + * @param sd
  1302 + * @param map
  1303 + * @return
  1304 + */
  1305 + public boolean isSpecialLines(SafeDriv sd, Map<String, Object> map) {
  1306 + String lines = (String)map.get("lines");
  1307 + if (lines == null) lines = "";
  1308 +
  1309 + if (Arrays.asList(lines.split(",")).contains(sd.getXlbm())) return true;
  1310 + return false;
  1311 + }
1297 1312
1298 public boolean fieldEquals(List<Field> fs, Object obj, Map<String, Object> map) { 1313 public boolean fieldEquals(List<Field> fs, Object obj, Map<String, Object> map) {
1299 try { 1314 try {