Commit c3407cd06cbb094ff446b358b0b892bdfba52c84
1 parent
7cceed4d
iss提交10:
1、添加使用路牌配置服务的controller,把原来的controller放入legacy包中 2、在dubbo消费者配置文件中配置路牌配置服务
Showing
5 changed files
with
238 additions
and
18 deletions
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController_facade.java
| @@ -8,7 +8,6 @@ import com.bsth.control_v2.plan_module.common.dto.baseinfo.LineDto; | @@ -8,7 +8,6 @@ import com.bsth.control_v2.plan_module.common.dto.baseinfo.LineDto; | ||
| 8 | import com.bsth.control_v2.plan_module.common.dto.schedule.config.VehicleConfigDto; | 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; | 9 | import com.bsth.control_v2.plan_module.common.dto.sys.CompanyAuthorityDto; |
| 10 | import com.bsth.control_v2.plan_module.common.dto.sys.UserDto; | 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; | 11 | import com.bsth.control_v2.plan_module.common.service.BServiceFacade; |
| 13 | import com.bsth.control_v2.plan_module.common.service.schedule.config.VehicleConfigServiceFacade; | 12 | import com.bsth.control_v2.plan_module.common.service.schedule.config.VehicleConfigServiceFacade; |
| 14 | import com.bsth.controller.schedule.BController_facade; | 13 | import com.bsth.controller.schedule.BController_facade; |
| @@ -94,7 +93,7 @@ public class CarConfigInfoController_facade extends BController_facade<Long, Veh | @@ -94,7 +93,7 @@ public class CarConfigInfoController_facade extends BController_facade<Long, Veh | ||
| 94 | 93 | ||
| 95 | vehicleConfigServiceFacade.validate_already_config(vehicleConfigDto); | 94 | vehicleConfigServiceFacade.validate_already_config(vehicleConfigDto); |
| 96 | rtn.put("status", ResponseCode.SUCCESS); | 95 | rtn.put("status", ResponseCode.SUCCESS); |
| 97 | - } catch (PlanModuleException exp) { | 96 | + } catch (Exception exp) { |
| 98 | rtn.put("status", ResponseCode.ERROR); | 97 | rtn.put("status", ResponseCode.ERROR); |
| 99 | rtn.put("msg", exp.getMessage()); | 98 | rtn.put("msg", exp.getMessage()); |
| 100 | } | 99 | } |
| @@ -117,7 +116,7 @@ public class CarConfigInfoController_facade extends BController_facade<Long, Veh | @@ -117,7 +116,7 @@ public class CarConfigInfoController_facade extends BController_facade<Long, Veh | ||
| 117 | 116 | ||
| 118 | vehicleConfigServiceFacade.validate_already_config(vehicleConfigDto); | 117 | vehicleConfigServiceFacade.validate_already_config(vehicleConfigDto); |
| 119 | rtn.put("status", ResponseCode.SUCCESS); | 118 | rtn.put("status", ResponseCode.SUCCESS); |
| 120 | - } catch (PlanModuleException exp) { | 119 | + } catch (Exception exp) { |
| 121 | rtn.put("status", ResponseCode.ERROR); | 120 | rtn.put("status", ResponseCode.ERROR); |
| 122 | rtn.put("msg", exp.getMessage()); | 121 | rtn.put("msg", exp.getMessage()); |
| 123 | } | 122 | } |
| @@ -159,7 +158,7 @@ public class CarConfigInfoController_facade extends BController_facade<Long, Veh | @@ -159,7 +158,7 @@ public class CarConfigInfoController_facade extends BController_facade<Long, Veh | ||
| 159 | 158 | ||
| 160 | vehicleConfigServiceFacade.validate_cars_gs(vehicleConfigDto, companyAuthorityDtoList); | 159 | vehicleConfigServiceFacade.validate_cars_gs(vehicleConfigDto, companyAuthorityDtoList); |
| 161 | rtn.put("status", ResponseCode.SUCCESS); | 160 | rtn.put("status", ResponseCode.SUCCESS); |
| 162 | - } catch (PlanModuleException exp) { | 161 | + } catch (Exception exp) { |
| 163 | rtn.put("status", ResponseCode.ERROR); | 162 | rtn.put("status", ResponseCode.ERROR); |
| 164 | rtn.put("msg", exp.getMessage()); | 163 | rtn.put("msg", exp.getMessage()); |
| 165 | } | 164 | } |
| @@ -201,7 +200,7 @@ public class CarConfigInfoController_facade extends BController_facade<Long, Veh | @@ -201,7 +200,7 @@ public class CarConfigInfoController_facade extends BController_facade<Long, Veh | ||
| 201 | 200 | ||
| 202 | vehicleConfigServiceFacade.validate_cars_fgs(vehicleConfigDto, companyAuthorityDtoList); | 201 | vehicleConfigServiceFacade.validate_cars_fgs(vehicleConfigDto, companyAuthorityDtoList); |
| 203 | rtn.put("status", ResponseCode.SUCCESS); | 202 | rtn.put("status", ResponseCode.SUCCESS); |
| 204 | - } catch (PlanModuleException exp) { | 203 | + } catch (Exception exp) { |
| 205 | rtn.put("status", ResponseCode.ERROR); | 204 | rtn.put("status", ResponseCode.ERROR); |
| 206 | rtn.put("msg", exp.getMessage()); | 205 | rtn.put("msg", exp.getMessage()); |
| 207 | } | 206 | } |
| @@ -228,7 +227,7 @@ public class CarConfigInfoController_facade extends BController_facade<Long, Veh | @@ -228,7 +227,7 @@ public class CarConfigInfoController_facade extends BController_facade<Long, Veh | ||
| 228 | .build(); | 227 | .build(); |
| 229 | vehicleConfigServiceFacade.validate_config_exist(vehicleConfigDto); | 228 | vehicleConfigServiceFacade.validate_config_exist(vehicleConfigDto); |
| 230 | rtn.put("status", ResponseCode.SUCCESS); | 229 | rtn.put("status", ResponseCode.SUCCESS); |
| 231 | - } catch (PlanModuleException exp) { | 230 | + } catch (Exception exp) { |
| 232 | rtn.put("status", ResponseCode.ERROR); | 231 | rtn.put("status", ResponseCode.ERROR); |
| 233 | rtn.put("msg", exp.getMessage()); | 232 | rtn.put("msg", exp.getMessage()); |
| 234 | } | 233 | } |
src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController_facade.java
| @@ -8,7 +8,6 @@ import com.bsth.control_v2.plan_module.common.dto.baseinfo.PersonnelDto; | @@ -8,7 +8,6 @@ import com.bsth.control_v2.plan_module.common.dto.baseinfo.PersonnelDto; | ||
| 8 | import com.bsth.control_v2.plan_module.common.dto.schedule.config.EmployeeConfigDto; | 8 | import com.bsth.control_v2.plan_module.common.dto.schedule.config.EmployeeConfigDto; |
| 9 | import com.bsth.control_v2.plan_module.common.dto.sys.CompanyAuthorityDto; | 9 | import com.bsth.control_v2.plan_module.common.dto.sys.CompanyAuthorityDto; |
| 10 | import com.bsth.control_v2.plan_module.common.dto.sys.UserDto; | 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; | 11 | import com.bsth.control_v2.plan_module.common.service.BServiceFacade; |
| 13 | import com.bsth.control_v2.plan_module.common.service.schedule.config.EmployeeConfigServiceFacade; | 12 | import com.bsth.control_v2.plan_module.common.service.schedule.config.EmployeeConfigServiceFacade; |
| 14 | import com.bsth.controller.schedule.BController_facade; | 13 | import com.bsth.controller.schedule.BController_facade; |
| @@ -105,7 +104,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | @@ -105,7 +104,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | ||
| 105 | .build(); | 104 | .build(); |
| 106 | employeeConfigServiceFacade.validate_jsy_duplicate_without_current(employeeConfigDto); | 105 | employeeConfigServiceFacade.validate_jsy_duplicate_without_current(employeeConfigDto); |
| 107 | rtn.put("status", ResponseCode.SUCCESS); | 106 | rtn.put("status", ResponseCode.SUCCESS); |
| 108 | - } catch (PlanModuleException exp) { | 107 | + } catch (Exception exp) { |
| 109 | rtn.put("status", ResponseCode.ERROR); | 108 | rtn.put("status", ResponseCode.ERROR); |
| 110 | rtn.put("msg", exp.getMessage()); | 109 | rtn.put("msg", exp.getMessage()); |
| 111 | } | 110 | } |
| @@ -132,7 +131,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | @@ -132,7 +131,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | ||
| 132 | .build(); | 131 | .build(); |
| 133 | employeeConfigServiceFacade.validate_jsy_exist(employeeConfigDto); | 132 | employeeConfigServiceFacade.validate_jsy_exist(employeeConfigDto); |
| 134 | rtn.put("status", ResponseCode.SUCCESS); | 133 | rtn.put("status", ResponseCode.SUCCESS); |
| 135 | - } catch (PlanModuleException exp) { | 134 | + } catch (Exception exp) { |
| 136 | rtn.put("status", ResponseCode.ERROR); | 135 | rtn.put("status", ResponseCode.ERROR); |
| 137 | rtn.put("msg", exp.getMessage()); | 136 | rtn.put("msg", exp.getMessage()); |
| 138 | } | 137 | } |
| @@ -173,7 +172,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | @@ -173,7 +172,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | ||
| 173 | .build(); | 172 | .build(); |
| 174 | employeeConfigServiceFacade.validate_jsy_gs_authority(employeeConfigDto, companyAuthorityDtoList); | 173 | employeeConfigServiceFacade.validate_jsy_gs_authority(employeeConfigDto, companyAuthorityDtoList); |
| 175 | rtn.put("status", ResponseCode.SUCCESS); | 174 | rtn.put("status", ResponseCode.SUCCESS); |
| 176 | - } catch (PlanModuleException exp) { | 175 | + } catch (Exception exp) { |
| 177 | rtn.put("status", ResponseCode.ERROR); | 176 | rtn.put("status", ResponseCode.ERROR); |
| 178 | rtn.put("msg", exp.getMessage()); | 177 | rtn.put("msg", exp.getMessage()); |
| 179 | } | 178 | } |
| @@ -214,7 +213,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | @@ -214,7 +213,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | ||
| 214 | .build(); | 213 | .build(); |
| 215 | employeeConfigServiceFacade.validate_jsy_fgs_authority(employeeConfigDto, companyAuthorityDtoList); | 214 | employeeConfigServiceFacade.validate_jsy_fgs_authority(employeeConfigDto, companyAuthorityDtoList); |
| 216 | rtn.put("status", ResponseCode.SUCCESS); | 215 | rtn.put("status", ResponseCode.SUCCESS); |
| 217 | - } catch (PlanModuleException exp) { | 216 | + } catch (Exception exp) { |
| 218 | rtn.put("status", ResponseCode.ERROR); | 217 | rtn.put("status", ResponseCode.ERROR); |
| 219 | rtn.put("msg", exp.getMessage()); | 218 | rtn.put("msg", exp.getMessage()); |
| 220 | } | 219 | } |
| @@ -242,7 +241,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | @@ -242,7 +241,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | ||
| 242 | .build(); | 241 | .build(); |
| 243 | employeeConfigServiceFacade.validate_spy_duplicate_without_current(employeeConfigDto); | 242 | employeeConfigServiceFacade.validate_spy_duplicate_without_current(employeeConfigDto); |
| 244 | rtn.put("status", ResponseCode.SUCCESS); | 243 | rtn.put("status", ResponseCode.SUCCESS); |
| 245 | - } catch (PlanModuleException exp) { | 244 | + } catch (Exception exp) { |
| 246 | rtn.put("status", ResponseCode.ERROR); | 245 | rtn.put("status", ResponseCode.ERROR); |
| 247 | rtn.put("msg", exp.getMessage()); | 246 | rtn.put("msg", exp.getMessage()); |
| 248 | } | 247 | } |
| @@ -268,7 +267,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | @@ -268,7 +267,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | ||
| 268 | .build(); | 267 | .build(); |
| 269 | employeeConfigServiceFacade.validate_spy_exist(employeeConfigDto); | 268 | employeeConfigServiceFacade.validate_spy_exist(employeeConfigDto); |
| 270 | rtn.put("status", ResponseCode.SUCCESS); | 269 | rtn.put("status", ResponseCode.SUCCESS); |
| 271 | - } catch (PlanModuleException exp) { | 270 | + } catch (Exception exp) { |
| 272 | rtn.put("status", ResponseCode.ERROR); | 271 | rtn.put("status", ResponseCode.ERROR); |
| 273 | rtn.put("msg", exp.getMessage()); | 272 | rtn.put("msg", exp.getMessage()); |
| 274 | } | 273 | } |
| @@ -308,7 +307,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | @@ -308,7 +307,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | ||
| 308 | .build(); | 307 | .build(); |
| 309 | employeeConfigServiceFacade.validate_spy_gs_authority(employeeConfigDto, companyAuthorityDtoList); | 308 | employeeConfigServiceFacade.validate_spy_gs_authority(employeeConfigDto, companyAuthorityDtoList); |
| 310 | rtn.put("status", ResponseCode.SUCCESS); | 309 | rtn.put("status", ResponseCode.SUCCESS); |
| 311 | - } catch (PlanModuleException exp) { | 310 | + } catch (Exception exp) { |
| 312 | rtn.put("status", ResponseCode.ERROR); | 311 | rtn.put("status", ResponseCode.ERROR); |
| 313 | rtn.put("msg", exp.getMessage()); | 312 | rtn.put("msg", exp.getMessage()); |
| 314 | } | 313 | } |
| @@ -348,7 +347,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | @@ -348,7 +347,7 @@ public class EmployeeConfigInfoController_facade extends BController_facade<Long | ||
| 348 | .build(); | 347 | .build(); |
| 349 | employeeConfigServiceFacade.validate_spy_fgs_authority(employeeConfigDto, companyAuthorityDtoList); | 348 | employeeConfigServiceFacade.validate_spy_fgs_authority(employeeConfigDto, companyAuthorityDtoList); |
| 350 | rtn.put("status", ResponseCode.SUCCESS); | 349 | rtn.put("status", ResponseCode.SUCCESS); |
| 351 | - } catch (PlanModuleException exp) { | 350 | + } catch (Exception exp) { |
| 352 | rtn.put("status", ResponseCode.ERROR); | 351 | rtn.put("status", ResponseCode.ERROR); |
| 353 | rtn.put("msg", exp.getMessage()); | 352 | rtn.put("msg", exp.getMessage()); |
| 354 | } | 353 | } |
src/main/java/com/bsth/controller/schedule/core/GuideboardInfoController_facade.java
0 → 100644
| 1 | +package com.bsth.controller.schedule.core; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.control_v2.plan_module.common.dto.baseinfo.LineDto; | ||
| 5 | +import com.bsth.control_v2.plan_module.common.dto.schedule.config.LpConfigDto; | ||
| 6 | +import com.bsth.control_v2.plan_module.common.dto.sys.UserDto; | ||
| 7 | +import com.bsth.control_v2.plan_module.common.exception.PlanModuleException; | ||
| 8 | +import com.bsth.control_v2.plan_module.common.service.BServiceFacade; | ||
| 9 | +import com.bsth.control_v2.plan_module.common.service.schedule.config.LpConfigServiceFacade; | ||
| 10 | +import com.bsth.controller.schedule.BController_facade; | ||
| 11 | +import com.bsth.entity.schedule.GuideboardInfo; | ||
| 12 | +import com.bsth.service.schedule.GuideboardInfoService; | ||
| 13 | +import com.bsth.service.schedule.exception.ScheduleException; | ||
| 14 | +import com.bsth.service.schedule.utils.DataToolsFile; | ||
| 15 | +import org.apache.commons.lang3.StringUtils; | ||
| 16 | +import org.apache.poi.ss.usermodel.Workbook; | ||
| 17 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 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 | +@RequestMapping("gic") | ||
| 30 | +public class GuideboardInfoController_facade extends BController_facade<Long, LpConfigDto> { | ||
| 31 | + @Override | ||
| 32 | + public void setCreateUserInfo(LpConfigDto lpConfigDto, Integer userId, Date createDate) { | ||
| 33 | + UserDto userDto = UserDto.getBuilder() | ||
| 34 | + .setId(userId) | ||
| 35 | + .build(); | ||
| 36 | + lpConfigDto.setCreateBy(userDto); | ||
| 37 | + lpConfigDto.setCreateDate(createDate); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public void setUpdateUserInfo(LpConfigDto lpConfigDto, Integer userId, Date updateDate) { | ||
| 42 | + UserDto userDto = UserDto.getBuilder() | ||
| 43 | + .setId(userId) | ||
| 44 | + .build(); | ||
| 45 | + lpConfigDto.setUpdateBy(userDto); | ||
| 46 | + lpConfigDto.setUpdateDate(updateDate); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + @Autowired | ||
| 50 | + private LpConfigServiceFacade lpConfigServiceFacade; | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + protected BServiceFacade<Long, LpConfigDto> getBServiceFacade() { | ||
| 54 | + return lpConfigServiceFacade; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @RequestMapping(value = "/ttlpnames", method = RequestMethod.GET) | ||
| 58 | + public List<Map<String, Object>> findLpName(Long ttid) { | ||
| 59 | + return lpConfigServiceFacade.findLpName_from_ttinfo(ttid); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @RequestMapping(value = "lpno/{xlid}", method = RequestMethod.GET) | ||
| 63 | + public Map<String, Object> getLpNo(@PathVariable("xlid") Integer xl) { | ||
| 64 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 65 | + try { | ||
| 66 | + rtn.put("data", lpConfigServiceFacade.getMaxLpno(xl)); | ||
| 67 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 68 | + } catch (Exception exp) { | ||
| 69 | + exp.printStackTrace(); | ||
| 70 | + rtn.put("status", ResponseCode.ERROR); | ||
| 71 | + rtn.put("msg", exp.getMessage()); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + return rtn; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @RequestMapping(value = "/validate_lpno", method = RequestMethod.GET) | ||
| 78 | + public Map<String, Object> validate_lpno(@RequestParam Map<String, Object> param) { | ||
| 79 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 80 | + try { | ||
| 81 | + LpConfigDto lpConfigDto = LpConfigDto.getBuilder() | ||
| 82 | + .setId(param.get("id_eq") == null ? null : Long.valueOf(param.get("id_eq").toString())) | ||
| 83 | + .setXl(param.get("xl.id_eq") == null ? null : ( | ||
| 84 | + LineDto.getBuilder() | ||
| 85 | + .setId(Integer.valueOf(param.get("xl.id_eq").toString())) | ||
| 86 | + .build() | ||
| 87 | + )) | ||
| 88 | + .setLpNo(param.get("lpNo_eq") == null ? null : Integer.valueOf(param.get("lpNo_eq").toString())) | ||
| 89 | + .build(); | ||
| 90 | + lpConfigServiceFacade.validate_lpno_duplicate(lpConfigDto); | ||
| 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_lpname", method = RequestMethod.GET) | ||
| 100 | + public Map<String, Object> validate_lpname(@RequestParam Map<String, Object> param) { | ||
| 101 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 102 | + try { | ||
| 103 | + LpConfigDto lpConfigDto = LpConfigDto.getBuilder() | ||
| 104 | + .setId(param.get("id_eq") == null ? null : Long.valueOf(param.get("id_eq").toString())) | ||
| 105 | + .setXl(param.get("xl.id_eq") == null ? null : ( | ||
| 106 | + LineDto.getBuilder() | ||
| 107 | + .setId(Integer.valueOf(param.get("xl.id_eq").toString())) | ||
| 108 | + .build() | ||
| 109 | + )) | ||
| 110 | + .setLpName(param.get("lpName_eq") == null ? null : param.get("lpNo_eq").toString()) | ||
| 111 | + .build(); | ||
| 112 | + lpConfigServiceFacade.validate_lpname_duplicate(lpConfigDto); | ||
| 113 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 114 | + } catch (Exception exp) { | ||
| 115 | + rtn.put("status", ResponseCode.ERROR); | ||
| 116 | + rtn.put("msg", exp.getMessage()); | ||
| 117 | + } | ||
| 118 | + return rtn; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + //------------------ TODO:导入导出逻辑,之后会服务化 -----------------// | ||
| 122 | + @Autowired | ||
| 123 | + private GuideboardInfoService guideboardInfoService; | ||
| 124 | + // 上传excel文件 | ||
| 125 | + @RequestMapping(value = "/uploadFile", method = RequestMethod.POST) | ||
| 126 | + public Map<String, Object> uploadFile(MultipartFile file) { | ||
| 127 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 128 | + try { | ||
| 129 | + DataToolsFile dataToolsFile = guideboardInfoService.uploadFile(file.getOriginalFilename(), file.getBytes()); | ||
| 130 | + // excel文件名 | ||
| 131 | + String fileName = dataToolsFile.getFile().getAbsolutePath(); | ||
| 132 | + Workbook wb = dataToolsFile.getFileType().getWorkBook(dataToolsFile.getFile()); | ||
| 133 | + | ||
| 134 | + // excel文件sheet | ||
| 135 | + List<String> sheetnames = new ArrayList<>(); | ||
| 136 | + for (int i = 0; i < wb.getNumberOfSheets(); i ++) { | ||
| 137 | + sheetnames.add(wb.getSheetAt(i).getSheetName()); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + wb.close(); | ||
| 141 | + | ||
| 142 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 143 | + rtn.put("filename", fileName); | ||
| 144 | + rtn.put("sheetnames", StringUtils.join(sheetnames, ",")); | ||
| 145 | + } catch (Exception exp) { | ||
| 146 | + exp.printStackTrace(); | ||
| 147 | + rtn.put("status", ResponseCode.ERROR); | ||
| 148 | + rtn.put("msg", exp.getMessage()); | ||
| 149 | + } | ||
| 150 | + return rtn; | ||
| 151 | + } | ||
| 152 | + // 导入excel文件 | ||
| 153 | + @RequestMapping(value = "/importFile", method = RequestMethod.POST) | ||
| 154 | + public Map<String, Object> importFile(@RequestParam Map<String, Object> params) { | ||
| 155 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 156 | + | ||
| 157 | + try { | ||
| 158 | + File file = new File(String.valueOf(params.get("filename"))); | ||
| 159 | + if (!file.exists()) { | ||
| 160 | + throw new Exception("导入文件不存在!"); | ||
| 161 | + } | ||
| 162 | + guideboardInfoService.importData(file, params); | ||
| 163 | + | ||
| 164 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 165 | + rtn.put("msg", "导入文件成功"); | ||
| 166 | + } catch (Exception exp) { | ||
| 167 | + rtn.put("status", ResponseCode.ERROR); | ||
| 168 | + rtn.put("msg", exp.getMessage()); | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + return rtn; | ||
| 172 | + } | ||
| 173 | + // 上传并导入excel文件 | ||
| 174 | + @RequestMapping(value = "/uploadAndImportFile", method = RequestMethod.POST) | ||
| 175 | + public Map<String, Object> uploadAndImportFile(MultipartFile file) { | ||
| 176 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 177 | + | ||
| 178 | + try { | ||
| 179 | + DataToolsFile dataToolsFile = guideboardInfoService.uploadFile(file.getOriginalFilename(), file.getBytes()); | ||
| 180 | + Map<String, Object> params = new HashMap<>(); | ||
| 181 | + guideboardInfoService.importData(dataToolsFile.getFile(), params); | ||
| 182 | + | ||
| 183 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 184 | + rtn.put("msg", "上传&导入文件成功"); | ||
| 185 | + } catch (Exception exp) { | ||
| 186 | + exp.printStackTrace(); | ||
| 187 | + rtn.put("status", ResponseCode.ERROR); | ||
| 188 | + rtn.put("msg", exp.getMessage()); | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + return rtn; | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + // 导出数据到xls文件 | ||
| 195 | + @RequestMapping(value = "/exportFile", method = RequestMethod.GET) | ||
| 196 | + public void exportFile(HttpServletResponse response, | ||
| 197 | + @RequestParam Map<String, Object> params) throws Exception { | ||
| 198 | + DataToolsFile dataToolsFile = guideboardInfoService.exportData(params); | ||
| 199 | + // 流输出导出文件 | ||
| 200 | + response.setHeader("content-type", "application/octet-stream"); | ||
| 201 | + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName()); | ||
| 202 | + response.setContentType("application/octet-stream"); | ||
| 203 | + | ||
| 204 | + OutputStream os = response.getOutputStream(); | ||
| 205 | + BufferedOutputStream bos = new BufferedOutputStream(os); | ||
| 206 | + | ||
| 207 | + InputStream is = new FileInputStream(dataToolsFile.getFile()); | ||
| 208 | + BufferedInputStream bis = new BufferedInputStream(is); | ||
| 209 | + | ||
| 210 | + int length = 0; | ||
| 211 | + byte[] temp = new byte[1 * 1024 * 10]; | ||
| 212 | + while ((length = bis.read(temp)) != -1) { | ||
| 213 | + bos.write(temp, 0, length); | ||
| 214 | + } | ||
| 215 | + bos.flush(); | ||
| 216 | + bis.close(); | ||
| 217 | + bos.close(); | ||
| 218 | + is.close(); | ||
| 219 | + } | ||
| 220 | +} |
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; |
| @@ -16,8 +16,8 @@ import java.util.Map; | @@ -16,8 +16,8 @@ import java.util.Map; | ||
| 16 | /** | 16 | /** |
| 17 | * 路牌管理控制器。 | 17 | * 路牌管理控制器。 |
| 18 | */ | 18 | */ |
| 19 | -@RestController | ||
| 20 | -@RequestMapping("gic") | 19 | +//@RestController |
| 20 | +//@RequestMapping("gic") | ||
| 21 | public class GuideboardInfoController extends BController<GuideboardInfo, Long> { | 21 | public class GuideboardInfoController extends BController<GuideboardInfo, Long> { |
| 22 | @Autowired | 22 | @Autowired |
| 23 | private GuideboardInfoService guideboardInfoService; | 23 | private GuideboardInfoService guideboardInfoService; |
src/main/resources/dubbo/applicationContext_dubbo_consumer.xml
| @@ -23,6 +23,8 @@ | @@ -23,6 +23,8 @@ | ||
| 23 | <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.config.VehicleConfigServiceFacade" id="vehicleConfigServiceFacadeImpl" check="false" /> | 23 | <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.config.VehicleConfigServiceFacade" id="vehicleConfigServiceFacadeImpl" check="false" /> |
| 24 | <!-- 人员配置信息服务 --> | 24 | <!-- 人员配置信息服务 --> |
| 25 | <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.config.EmployeeConfigServiceFacade" id="employeeConfigServiceFacadeImpl" check="false" /> | 25 | <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.config.EmployeeConfigServiceFacade" id="employeeConfigServiceFacadeImpl" check="false" /> |
| 26 | + <!-- 路牌配置信息服务 --> | ||
| 27 | + <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.config.LpConfigServiceFacade" id="lpConfigServiceFacadeImpl" check="false" /> | ||
| 26 | 28 | ||
| 27 | <!-- 时刻表班型明细服务 --> | 29 | <!-- 时刻表班型明细服务 --> |
| 28 | <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoBxDetailServiceFacade" id="tTInfoBxDetailServiceFacadeImpl" check="false" /> | 30 | <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoBxDetailServiceFacade" id="tTInfoBxDetailServiceFacadeImpl" check="false" /> |