Commit b8a7ddee6d9b2d0431947934fc0628543568aef0

Authored by 徐烜
1 parent 770bf53b

iss提交8:

1、添加使用车辆配置服务的controller,把原来的controller放入legacy包中
2、在dubbo消费者配置文件中配置车辆配置服务
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.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.bsth.common.Constants; 4 import com.bsth.common.Constants;
4 import com.bsth.common.ResponseCode; 5 import com.bsth.common.ResponseCode;
5 -import com.bsth.controller.schedule.BController;  
6 -import com.bsth.entity.schedule.CarConfigInfo; 6 +import com.bsth.control_v2.plan_module.common.dto.baseinfo.CarDto;
  7 +import com.bsth.control_v2.plan_module.common.dto.baseinfo.LineDto;
  8 +import com.bsth.control_v2.plan_module.common.dto.schedule.config.VehicleConfigDto;
  9 +import com.bsth.control_v2.plan_module.common.dto.sys.CompanyAuthorityDto;
  10 +import com.bsth.control_v2.plan_module.common.dto.sys.UserDto;
  11 +import com.bsth.control_v2.plan_module.common.exception.PlanModuleException;
  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;
7 import com.bsth.entity.sys.CompanyAuthority; 15 import com.bsth.entity.sys.CompanyAuthority;
8 -import com.bsth.repository.schedule.CarConfigInfoRepository;  
9 import com.bsth.service.schedule.CarConfigInfoService; 16 import com.bsth.service.schedule.CarConfigInfoService;
10 -import com.bsth.service.schedule.exception.ScheduleException; 17 +import com.bsth.service.schedule.utils.DataToolsFile;
  18 +import org.apache.commons.lang3.StringUtils;
  19 +import org.apache.poi.ss.usermodel.Workbook;
11 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.web.bind.annotation.RequestMapping; 21 import org.springframework.web.bind.annotation.RequestMapping;
13 import org.springframework.web.bind.annotation.RequestMethod; 22 import org.springframework.web.bind.annotation.RequestMethod;
14 import org.springframework.web.bind.annotation.RequestParam; 23 import org.springframework.web.bind.annotation.RequestParam;
15 import org.springframework.web.bind.annotation.RestController; 24 import org.springframework.web.bind.annotation.RestController;
  25 +import org.springframework.web.multipart.MultipartFile;
16 26
17 import javax.servlet.http.HttpServletRequest; 27 import javax.servlet.http.HttpServletRequest;
  28 +import javax.servlet.http.HttpServletResponse;
18 import javax.servlet.http.HttpSession; 29 import javax.servlet.http.HttpSession;
19 -import java.util.HashMap;  
20 -import java.util.List;  
21 -import java.util.Map; 30 +import java.io.*;
  31 +import java.util.*;
22 32
23 /** 33 /**
24 * Created by xu on 16/5/9. 34 * Created by xu on 16/5/9.
25 */ 35 */
26 @RestController 36 @RestController
27 @RequestMapping("cci") 37 @RequestMapping("cci")
28 -public class CarConfigInfoController extends BController<CarConfigInfo, Long> {  
29 - @Autowired  
30 - private CarConfigInfoRepository carConfigInfoRepository;  
31 - @Autowired  
32 - private CarConfigInfoService carConfigInfoService; 38 +public class CarConfigInfoController extends BController_facade<Long, VehicleConfigDto> {
  39 +
  40 + @Override
  41 + public void setCreateUserInfo(VehicleConfigDto vehicleConfigDto, Integer userId, Date createDate) {
  42 + UserDto userDto = UserDto.getBuilder()
  43 + .setId(userId)
  44 + .build();
  45 + vehicleConfigDto.setCreateBy(userDto);
  46 + vehicleConfigDto.setCreateDate(createDate);
  47 + }
  48 +
  49 + @Override
  50 + public void setUpdateUserInfo(VehicleConfigDto vehicleConfigDto, Integer userId, Date updateDate) {
  51 + UserDto userDto = UserDto.getBuilder()
  52 + .setId(userId)
  53 + .build();
  54 + vehicleConfigDto.setUpdateBy(userDto);
  55 + vehicleConfigDto.setUpdateDate(updateDate);
  56 + }
33 57
  58 + @Reference
  59 + private VehicleConfigServiceFacade vehicleConfigServiceFacade;
  60 +
  61 + @Override
  62 + protected BServiceFacade<Long, VehicleConfigDto> getBServiceFacade() {
  63 + return vehicleConfigServiceFacade;
  64 + }
34 65
35 @RequestMapping(value = "/cars", method = RequestMethod.GET) 66 @RequestMapping(value = "/cars", method = RequestMethod.GET)
36 public List<Map<String, Object>> findCarConfigCars() { 67 public List<Map<String, Object>> findCarConfigCars() {
37 - return carConfigInfoRepository.findCarConfigCars(); 68 + return vehicleConfigServiceFacade.findCarsFromConfig_nbbm();
38 } 69 }
39 70
40 @RequestMapping(value = "/cars2", method = RequestMethod.GET) 71 @RequestMapping(value = "/cars2", method = RequestMethod.GET)
41 public List<Map<String, Object>> findCarsFromConfig() { 72 public List<Map<String, Object>> findCarsFromConfig() {
42 - return carConfigInfoRepository.findCarsFromConfig(); 73 + return vehicleConfigServiceFacade.findCarsFromConfig_insideCode();
43 } 74 }
44 75
45 @RequestMapping(value = "/validate_cars", method = RequestMethod.GET) 76 @RequestMapping(value = "/validate_cars", method = RequestMethod.GET)
46 public Map<String, Object> validate_cars(@RequestParam Map<String, Object> param) { 77 public Map<String, Object> validate_cars(@RequestParam Map<String, Object> param) {
47 Map<String, Object> rtn = new HashMap<>(); 78 Map<String, Object> rtn = new HashMap<>();
48 try { 79 try {
49 - // 车辆重复配置验证  
50 - CarConfigInfo carConfigInfo = new CarConfigInfo(  
51 - param.get("id_eq"),  
52 - param.get("xl.id_eq"),  
53 - param.get("xl.name_eq"),  
54 - param.get("cl.id_eq")  
55 - );  
56 - carConfigInfoService.validate_cars(carConfigInfo); 80 + VehicleConfigDto vehicleConfigDto = VehicleConfigDto.getBuilder()
  81 + .setId(param.get("id_eq") == null ? null : Long.parseLong(param.get("id_eq").toString()))
  82 + .setXl(param.get("xl.id_eq") == null ? null : (
  83 + LineDto.getBuilder()
  84 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  85 + .setName(param.get("xl.name_eq").toString())
  86 + .build()
  87 + ))
  88 + .setCl(param.get("cl.id_eq") == null ? null : (
  89 + CarDto.getBuilder()
  90 + .setId(Integer.valueOf(param.get("cl.id_eq").toString()))
  91 + .build()
  92 + ))
  93 + .build();
  94 +
  95 + vehicleConfigServiceFacade.validate_already_config(vehicleConfigDto);
57 rtn.put("status", ResponseCode.SUCCESS); 96 rtn.put("status", ResponseCode.SUCCESS);
58 - } catch (ScheduleException exp) { 97 + } catch (PlanModuleException exp) {
59 rtn.put("status", ResponseCode.ERROR); 98 rtn.put("status", ResponseCode.ERROR);
60 rtn.put("msg", exp.getMessage()); 99 rtn.put("msg", exp.getMessage());
61 } 100 }
@@ -67,9 +106,18 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; { @@ -67,9 +106,18 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; {
67 public Map<String, Object> validate_cars(@RequestParam Integer xlId, @RequestParam Integer clId) { 106 public Map<String, Object> validate_cars(@RequestParam Integer xlId, @RequestParam Integer clId) {
68 Map<String, Object> rtn = new HashMap<>(); 107 Map<String, Object> rtn = new HashMap<>();
69 try { 108 try {
70 - carConfigInfoService.validate_cars(xlId, clId); 109 + VehicleConfigDto vehicleConfigDto = VehicleConfigDto.getBuilder()
  110 + .setXl(xlId == null ? null : (LineDto.getBuilder()
  111 + .setId(xlId)
  112 + .build()))
  113 + .setCl(clId == null ? null : (CarDto.getBuilder()
  114 + .setId(clId)
  115 + .build()))
  116 + .build();
  117 +
  118 + vehicleConfigServiceFacade.validate_already_config(vehicleConfigDto);
71 rtn.put("status", ResponseCode.SUCCESS); 119 rtn.put("status", ResponseCode.SUCCESS);
72 - } catch (ScheduleException exp) { 120 + } catch (PlanModuleException exp) {
73 rtn.put("status", ResponseCode.ERROR); 121 rtn.put("status", ResponseCode.ERROR);
74 rtn.put("msg", exp.getMessage()); 122 rtn.put("msg", exp.getMessage());
75 } 123 }
@@ -81,18 +129,37 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; { @@ -81,18 +129,37 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; {
81 public Map<String, Object> validate_cars_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) { 129 public Map<String, Object> validate_cars_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
82 HttpSession session = request.getSession(); 130 HttpSession session = request.getSession();
83 List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS); 131 List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  132 + List<CompanyAuthorityDto> companyAuthorityDtoList = new ArrayList<>();
  133 + for (CompanyAuthority companyAuthority : cmyAuths) {
  134 + CompanyAuthorityDto companyAuthorityDto = CompanyAuthorityDto.getBuilder()
  135 + .setId(companyAuthority.getId())
  136 + .setCompanyCode(companyAuthority.getCompanyCode())
  137 + .setCompanyName(companyAuthority.getCompanyName())
  138 + .setSubCompanyCode(companyAuthority.getSubCompanyCode())
  139 + .setSubCompanyName(companyAuthority.getSubCompanyName())
  140 + .build();
  141 + companyAuthorityDtoList.add(companyAuthorityDto);
  142 + }
84 143
85 Map<String, Object> rtn = new HashMap<>(); 144 Map<String, Object> rtn = new HashMap<>();
86 try { 145 try {
87 - CarConfigInfo carConfigInfo = new CarConfigInfo(  
88 - null,  
89 - param.get("xl.id_eq"),  
90 - param.get("xl.name_eq"),  
91 - param.get("cl.id_eq")  
92 - );  
93 - carConfigInfoService.validate_cars_gs(carConfigInfo, cmyAuths); 146 + VehicleConfigDto vehicleConfigDto = VehicleConfigDto.getBuilder()
  147 + .setXl(param.get("xl.id_eq") == null ? null : (
  148 + LineDto.getBuilder()
  149 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  150 + .setName(param.get("xl.name_eq").toString())
  151 + .build()
  152 + ))
  153 + .setCl(param.get("cl.id_eq") == null ? null : (
  154 + CarDto.getBuilder()
  155 + .setId(Integer.valueOf(param.get("cl.id_eq").toString()))
  156 + .build()
  157 + ))
  158 + .build();
  159 +
  160 + vehicleConfigServiceFacade.validate_cars_gs(vehicleConfigDto, companyAuthorityDtoList);
94 rtn.put("status", ResponseCode.SUCCESS); 161 rtn.put("status", ResponseCode.SUCCESS);
95 - } catch (ScheduleException exp) { 162 + } catch (PlanModuleException exp) {
96 rtn.put("status", ResponseCode.ERROR); 163 rtn.put("status", ResponseCode.ERROR);
97 rtn.put("msg", exp.getMessage()); 164 rtn.put("msg", exp.getMessage());
98 } 165 }
@@ -104,18 +171,37 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; { @@ -104,18 +171,37 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; {
104 public Map<String, Object> validate_cars_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) { 171 public Map<String, Object> validate_cars_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
105 HttpSession session = request.getSession(); 172 HttpSession session = request.getSession();
106 List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS); 173 List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  174 + List<CompanyAuthorityDto> companyAuthorityDtoList = new ArrayList<>();
  175 + for (CompanyAuthority companyAuthority : cmyAuths) {
  176 + CompanyAuthorityDto companyAuthorityDto = CompanyAuthorityDto.getBuilder()
  177 + .setId(companyAuthority.getId())
  178 + .setCompanyCode(companyAuthority.getCompanyCode())
  179 + .setCompanyName(companyAuthority.getCompanyName())
  180 + .setSubCompanyCode(companyAuthority.getSubCompanyCode())
  181 + .setSubCompanyName(companyAuthority.getSubCompanyName())
  182 + .build();
  183 + companyAuthorityDtoList.add(companyAuthorityDto);
  184 + }
107 185
108 Map<String, Object> rtn = new HashMap<>(); 186 Map<String, Object> rtn = new HashMap<>();
109 try { 187 try {
110 - CarConfigInfo carConfigInfo = new CarConfigInfo(  
111 - null,  
112 - param.get("xl.id_eq"),  
113 - param.get("xl.name_eq"),  
114 - param.get("cl.id_eq")  
115 - );  
116 - carConfigInfoService.validate_cars_fgs(carConfigInfo, cmyAuths); 188 + VehicleConfigDto vehicleConfigDto = VehicleConfigDto.getBuilder()
  189 + .setXl(param.get("xl.id_eq") == null ? null : (
  190 + LineDto.getBuilder()
  191 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  192 + .setName(param.get("xl.name_eq").toString())
  193 + .build()
  194 + ))
  195 + .setCl(param.get("cl.id_eq") == null ? null : (
  196 + CarDto.getBuilder()
  197 + .setId(Integer.valueOf(param.get("cl.id_eq").toString()))
  198 + .build()
  199 + ))
  200 + .build();
  201 +
  202 + vehicleConfigServiceFacade.validate_cars_fgs(vehicleConfigDto, companyAuthorityDtoList);
117 rtn.put("status", ResponseCode.SUCCESS); 203 rtn.put("status", ResponseCode.SUCCESS);
118 - } catch (ScheduleException exp) { 204 + } catch (PlanModuleException exp) {
119 rtn.put("status", ResponseCode.ERROR); 205 rtn.put("status", ResponseCode.ERROR);
120 rtn.put("msg", exp.getMessage()); 206 rtn.put("msg", exp.getMessage());
121 } 207 }
@@ -127,19 +213,128 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; { @@ -127,19 +213,128 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; {
127 public Map<String, Object> validate_cars_config(@RequestParam Map<String, Object> param) { 213 public Map<String, Object> validate_cars_config(@RequestParam Map<String, Object> param) {
128 Map<String, Object> rtn = new HashMap<>(); 214 Map<String, Object> rtn = new HashMap<>();
129 try { 215 try {
130 - CarConfigInfo carConfigInfo = new CarConfigInfo(  
131 - null,  
132 - param.get("xl.id_eq"),  
133 - param.get("xl.name_eq"),  
134 - param.get("cl.id_eq")  
135 - );  
136 - carConfigInfoService.validate_cars_config(carConfigInfo); 216 + VehicleConfigDto vehicleConfigDto = VehicleConfigDto.getBuilder()
  217 + .setXl(param.get("xl.id_eq") == null ? null : (
  218 + LineDto.getBuilder()
  219 + .setId(Integer.valueOf(param.get("xl.id_eq").toString()))
  220 + .setName(param.get("xl.name_eq").toString())
  221 + .build()
  222 + ))
  223 + .setCl(param.get("cl.id_eq") == null ? null : (
  224 + CarDto.getBuilder()
  225 + .setId(Integer.valueOf(param.get("cl.id_eq").toString()))
  226 + .build()
  227 + ))
  228 + .build();
  229 + vehicleConfigServiceFacade.validate_config_exist(vehicleConfigDto);
137 rtn.put("status", ResponseCode.SUCCESS); 230 rtn.put("status", ResponseCode.SUCCESS);
138 - } catch (ScheduleException exp) { 231 + } catch (PlanModuleException exp) {
139 rtn.put("status", ResponseCode.ERROR); 232 rtn.put("status", ResponseCode.ERROR);
140 rtn.put("msg", exp.getMessage()); 233 rtn.put("msg", exp.getMessage());
141 } 234 }
142 235
143 return rtn; 236 return rtn;
144 } 237 }
  238 +
  239 + //------------------ TODO:导入导出逻辑,之后会服务化 -----------------//
  240 + @Autowired
  241 + private CarConfigInfoService carConfigInfoService;
  242 + // 上传excel文件
  243 + @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
  244 + public Map<String, Object> uploadFile(MultipartFile file) {
  245 + Map<String, Object> rtn = new HashMap<>();
  246 + try {
  247 + DataToolsFile dataToolsFile = carConfigInfoService.uploadFile(file.getOriginalFilename(), file.getBytes());
  248 + // excel文件名
  249 + String fileName = dataToolsFile.getFile().getAbsolutePath();
  250 + Workbook wb = dataToolsFile.getFileType().getWorkBook(dataToolsFile.getFile());
  251 +
  252 + // excel文件sheet
  253 + List<String> sheetnames = new ArrayList<>();
  254 + for (int i = 0; i < wb.getNumberOfSheets(); i ++) {
  255 + sheetnames.add(wb.getSheetAt(i).getSheetName());
  256 + }
  257 +
  258 + wb.close();
  259 +
  260 + rtn.put("status", ResponseCode.SUCCESS);
  261 + rtn.put("filename", fileName);
  262 + rtn.put("sheetnames", StringUtils.join(sheetnames, ","));
  263 + } catch (Exception exp) {
  264 + exp.printStackTrace();
  265 + rtn.put("status", ResponseCode.ERROR);
  266 + rtn.put("msg", exp.getMessage());
  267 + }
  268 + return rtn;
  269 + }
  270 + // 导入excel文件
  271 + @RequestMapping(value = "/importFile", method = RequestMethod.POST)
  272 + public Map<String, Object> importFile(@RequestParam Map<String, Object> params) {
  273 + Map<String, Object> rtn = new HashMap<>();
  274 +
  275 + try {
  276 + File file = new File(String.valueOf(params.get("filename")));
  277 + if (!file.exists()) {
  278 + throw new Exception("导入文件不存在!");
  279 + }
  280 + carConfigInfoService.importData(file, params);
  281 +
  282 + rtn.put("status", ResponseCode.SUCCESS);
  283 + rtn.put("msg", "导入文件成功");
  284 + } catch (Exception exp) {
  285 + rtn.put("status", ResponseCode.ERROR);
  286 + rtn.put("msg", exp.getMessage());
  287 + }
  288 +
  289 + return rtn;
  290 + }
  291 + // 上传并导入excel文件
  292 + @RequestMapping(value = "/uploadAndImportFile", method = RequestMethod.POST)
  293 + public Map<String, Object> uploadAndImportFile(MultipartFile file) {
  294 + Map<String, Object> rtn = new HashMap<>();
  295 +
  296 + try {
  297 + DataToolsFile dataToolsFile = carConfigInfoService.uploadFile(file.getOriginalFilename(), file.getBytes());
  298 + Map<String, Object> params = new HashMap<>();
  299 + carConfigInfoService.importData(dataToolsFile.getFile(), params);
  300 +
  301 + rtn.put("status", ResponseCode.SUCCESS);
  302 + rtn.put("msg", "上传&导入文件成功");
  303 + } catch (Exception exp) {
  304 + exp.printStackTrace();
  305 + rtn.put("status", ResponseCode.ERROR);
  306 + rtn.put("msg", exp.getMessage());
  307 + }
  308 +
  309 + return rtn;
  310 + }
  311 +
  312 + // 导出数据到xls文件
  313 + @RequestMapping(value = "/exportFile", method = RequestMethod.GET)
  314 + public void exportFile(HttpServletResponse response,
  315 + @RequestParam Map<String, Object> params) throws Exception {
  316 + DataToolsFile dataToolsFile = carConfigInfoService.exportData(params);
  317 + // 流输出导出文件
  318 + response.setHeader("content-type", "application/octet-stream");
  319 + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName());
  320 + response.setContentType("application/octet-stream");
  321 +
  322 + OutputStream os = response.getOutputStream();
  323 + BufferedOutputStream bos = new BufferedOutputStream(os);
  324 +
  325 + InputStream is = new FileInputStream(dataToolsFile.getFile());
  326 + BufferedInputStream bis = new BufferedInputStream(is);
  327 +
  328 + int length = 0;
  329 + byte[] temp = new byte[1 * 1024 * 10];
  330 + while ((length = bis.read(temp)) != -1) {
  331 + bos.write(temp, 0, length);
  332 + }
  333 + bos.flush();
  334 + bis.close();
  335 + bos.close();
  336 + is.close();
  337 + }
  338 +
  339 +
145 } 340 }
src/main/java/com/bsth/controller/schedule/core/legacy/CarConfigInfoController.java 0 → 100644
  1 +package com.bsth.controller.schedule.core.legacy;
  2 +
  3 +import com.bsth.common.Constants;
  4 +import com.bsth.common.ResponseCode;
  5 +import com.bsth.controller.schedule.BController;
  6 +import com.bsth.entity.schedule.CarConfigInfo;
  7 +import com.bsth.entity.sys.CompanyAuthority;
  8 +import com.bsth.repository.schedule.CarConfigInfoRepository;
  9 +import com.bsth.service.schedule.CarConfigInfoService;
  10 +import com.bsth.service.schedule.exception.ScheduleException;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.web.bind.annotation.RequestMapping;
  13 +import org.springframework.web.bind.annotation.RequestMethod;
  14 +import org.springframework.web.bind.annotation.RequestParam;
  15 +
  16 +import javax.servlet.http.HttpServletRequest;
  17 +import javax.servlet.http.HttpSession;
  18 +import java.util.HashMap;
  19 +import java.util.List;
  20 +import java.util.Map;
  21 +
  22 +/**
  23 + * Created by xu on 16/5/9.
  24 + */
  25 +//@RestController
  26 +//@RequestMapping("cci")
  27 +public class CarConfigInfoController extends BController<CarConfigInfo, Long> {
  28 + @Autowired
  29 + private CarConfigInfoRepository carConfigInfoRepository;
  30 + @Autowired
  31 + private CarConfigInfoService carConfigInfoService;
  32 +
  33 +
  34 + @RequestMapping(value = "/cars", method = RequestMethod.GET)
  35 + public List<Map<String, Object>> findCarConfigCars() {
  36 + return carConfigInfoRepository.findCarConfigCars();
  37 + }
  38 +
  39 + @RequestMapping(value = "/cars2", method = RequestMethod.GET)
  40 + public List<Map<String, Object>> findCarsFromConfig() {
  41 + return carConfigInfoRepository.findCarsFromConfig();
  42 + }
  43 +
  44 + @RequestMapping(value = "/validate_cars", method = RequestMethod.GET)
  45 + public Map<String, Object> validate_cars(@RequestParam Map<String, Object> param) {
  46 + Map<String, Object> rtn = new HashMap<>();
  47 + try {
  48 + // 车辆重复配置验证
  49 + CarConfigInfo carConfigInfo = new CarConfigInfo(
  50 + param.get("id_eq"),
  51 + param.get("xl.id_eq"),
  52 + param.get("xl.name_eq"),
  53 + param.get("cl.id_eq")
  54 + );
  55 + carConfigInfoService.validate_cars(carConfigInfo);
  56 + rtn.put("status", ResponseCode.SUCCESS);
  57 + } catch (ScheduleException exp) {
  58 + rtn.put("status", ResponseCode.ERROR);
  59 + rtn.put("msg", exp.getMessage());
  60 + }
  61 +
  62 + return rtn;
  63 + }
  64 +
  65 + @RequestMapping(value = "/validate_cars_2", method = RequestMethod.GET)
  66 + public Map<String, Object> validate_cars(@RequestParam Integer xlId, @RequestParam Integer clId) {
  67 + Map<String, Object> rtn = new HashMap<>();
  68 + try {
  69 + carConfigInfoService.validate_cars(xlId, clId);
  70 + rtn.put("status", ResponseCode.SUCCESS);
  71 + } catch (ScheduleException exp) {
  72 + rtn.put("status", ResponseCode.ERROR);
  73 + rtn.put("msg", exp.getMessage());
  74 + }
  75 +
  76 + return rtn;
  77 + }
  78 +
  79 + @RequestMapping(value = "/validate_cars_gs", method = RequestMethod.GET)
  80 + public Map<String, Object> validate_cars_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  81 + HttpSession session = request.getSession();
  82 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  83 +
  84 + Map<String, Object> rtn = new HashMap<>();
  85 + try {
  86 + CarConfigInfo carConfigInfo = new CarConfigInfo(
  87 + null,
  88 + param.get("xl.id_eq"),
  89 + param.get("xl.name_eq"),
  90 + param.get("cl.id_eq")
  91 + );
  92 + carConfigInfoService.validate_cars_gs(carConfigInfo, cmyAuths);
  93 + rtn.put("status", ResponseCode.SUCCESS);
  94 + } catch (ScheduleException exp) {
  95 + rtn.put("status", ResponseCode.ERROR);
  96 + rtn.put("msg", exp.getMessage());
  97 + }
  98 +
  99 + return rtn;
  100 + }
  101 +
  102 + @RequestMapping(value = "/validate_cars_fgs", method = RequestMethod.GET)
  103 + public Map<String, Object> validate_cars_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  104 + HttpSession session = request.getSession();
  105 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  106 +
  107 + Map<String, Object> rtn = new HashMap<>();
  108 + try {
  109 + CarConfigInfo carConfigInfo = new CarConfigInfo(
  110 + null,
  111 + param.get("xl.id_eq"),
  112 + param.get("xl.name_eq"),
  113 + param.get("cl.id_eq")
  114 + );
  115 + carConfigInfoService.validate_cars_fgs(carConfigInfo, cmyAuths);
  116 + rtn.put("status", ResponseCode.SUCCESS);
  117 + } catch (ScheduleException exp) {
  118 + rtn.put("status", ResponseCode.ERROR);
  119 + rtn.put("msg", exp.getMessage());
  120 + }
  121 +
  122 + return rtn;
  123 + }
  124 +
  125 + @RequestMapping(value = "/validate_cars_config", method = RequestMethod.GET)
  126 + public Map<String, Object> validate_cars_config(@RequestParam Map<String, Object> param) {
  127 + Map<String, Object> rtn = new HashMap<>();
  128 + try {
  129 + CarConfigInfo carConfigInfo = new CarConfigInfo(
  130 + null,
  131 + param.get("xl.id_eq"),
  132 + param.get("xl.name_eq"),
  133 + param.get("cl.id_eq")
  134 + );
  135 + carConfigInfoService.validate_cars_config(carConfigInfo);
  136 + rtn.put("status", ResponseCode.SUCCESS);
  137 + } catch (ScheduleException exp) {
  138 + rtn.put("status", ResponseCode.ERROR);
  139 + rtn.put("msg", exp.getMessage());
  140 + }
  141 +
  142 + return rtn;
  143 + }
  144 +}
src/main/resources/dubbo/applicationContext_dubbo_consumer.xml
@@ -19,6 +19,9 @@ @@ -19,6 +19,9 @@
19 <!-- 车辆设备信息服务 --> 19 <!-- 车辆设备信息服务 -->
20 <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.baseinfo.CarDeviceServiceFacade" id="carDeviceServiceFacadeImpl" check="false" /> 20 <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.baseinfo.CarDeviceServiceFacade" id="carDeviceServiceFacadeImpl" check="false" />
21 21
  22 + <!-- 车辆配置信息服务 -->
  23 + <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.config.VehicleConfigServiceFacade" id="vehicleConfigServiceFacadeImpl" check="false" />
  24 +
22 <!-- 时刻表班型明细服务 --> 25 <!-- 时刻表班型明细服务 -->
23 <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoBxDetailServiceFacade" id="tTInfoBxDetailServiceFacadeImpl" check="false" /> 26 <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoBxDetailServiceFacade" id="tTInfoBxDetailServiceFacadeImpl" check="false" />
24 <!-- 时刻表明细服务 --> 27 <!-- 时刻表明细服务 -->