Commit 5aff71c2ea0ec5095b2fa17fbc6070a373789318
Merge branch 'pudong' of 192.168.168.201:panzhaov5/bsth_control into pudong
Showing
49 changed files
with
2921 additions
and
521 deletions
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/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; | ||
| 2 | - | ||
| 3 | -import com.alibaba.dubbo.config.annotation.Reference; | ||
| 4 | -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.log.LogServiceFacade; | ||
| 7 | -import com.bsth.controller.schedule.BController_facade; | ||
| 8 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 9 | -import org.springframework.web.bind.annotation.RestController; | ||
| 10 | - | ||
| 11 | -@RestController | ||
| 12 | -@RequestMapping("s_log") | ||
| 13 | -public class LogController_facade extends BController_facade<Long, ModuleOperatorLogDto> { | ||
| 14 | - @Reference | ||
| 15 | - private LogServiceFacade logServiceFacade; | ||
| 16 | - | ||
| 17 | - @Override | ||
| 18 | - protected BServiceFacade<Long, ModuleOperatorLogDto> getBServiceFacade() { | ||
| 19 | - return logServiceFacade; | ||
| 20 | - } | ||
| 21 | -} | 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.log.ModuleOperatorLogDto; | ||
| 6 | +import com.bsth.control_v2.plan_module.common.service.BServiceFacade; | ||
| 7 | +import com.bsth.control_v2.plan_module.common.service.log.LogServiceFacade; | ||
| 8 | +import com.bsth.controller.schedule.BController_facade; | ||
| 9 | +import org.springframework.context.annotation.Conditional; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 11 | +import org.springframework.web.bind.annotation.RestController; | ||
| 12 | + | ||
| 13 | +@RestController | ||
| 14 | +@Conditional(DubboConfigCondition.class) | ||
| 15 | +@RequestMapping("s_log") | ||
| 16 | +public class LogController_facade extends BController_facade<Long, ModuleOperatorLogDto> { | ||
| 17 | + @Reference | ||
| 18 | + private LogServiceFacade logServiceFacade; | ||
| 19 | + | ||
| 20 | + @Override | ||
| 21 | + protected BServiceFacade<Long, ModuleOperatorLogDto> getBServiceFacade() { | ||
| 22 | + return logServiceFacade; | ||
| 23 | + } | ||
| 24 | +} |
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
| 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.dto.schedule.PlanDto; | ||
| 6 | -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.validate.PlanPreValidateFacade; | ||
| 10 | -import com.bsth.controller.schedule.BController_facade; | ||
| 11 | -import com.bsth.entity.schedule.SchedulePlan; | ||
| 12 | -import com.bsth.service.schedule.SchedulePlanService; | ||
| 13 | -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; | ||
| 18 | - | ||
| 19 | -import java.util.Date; | ||
| 20 | -import java.util.HashMap; | ||
| 21 | -import java.util.Map; | ||
| 22 | - | ||
| 23 | -@RestController | ||
| 24 | -@RequestMapping("spc") | ||
| 25 | -public class SchedulePlanController_facade extends BController_facade<Long, PlanDto> { | ||
| 26 | - @Reference | ||
| 27 | - private PlanServiceFacade planServiceFacade; | ||
| 28 | - @Reference | ||
| 29 | - private PlanPreValidateFacade planPreValidateFacade; | ||
| 30 | - @Reference | ||
| 31 | - private PlanGenerateFacade planGenerateFacade; | ||
| 32 | - | ||
| 33 | - @Override | ||
| 34 | - protected BServiceFacade<Long, PlanDto> getBServiceFacade() { | ||
| 35 | - return planServiceFacade; | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - /** | ||
| 39 | - * 创建指定线路,指定时间范围内的排班计划,使用的时刻表情况 | ||
| 40 | - * @param xlid 线路id | ||
| 41 | - * @param from 开始时间 | ||
| 42 | - * @param to 结束时间 | ||
| 43 | - * @return | ||
| 44 | - * @throws Exception | ||
| 45 | - */ | ||
| 46 | - @RequestMapping(value = "/valttinfo/{xlid}/{from}/{to}", method = RequestMethod.GET) | ||
| 47 | - public Map<String, Object> validateTTInfo( | ||
| 48 | - @PathVariable(value = "xlid") Integer xlid, | ||
| 49 | - @PathVariable(value = "from") Date from, | ||
| 50 | - @PathVariable(value = "to") Date to | ||
| 51 | - ) throws Exception { | ||
| 52 | - Map<String, Object> rtn = new HashMap<>(); | ||
| 53 | - rtn.put("status", ResponseCode.SUCCESS); | ||
| 54 | - rtn.put("data", planPreValidateFacade.validateTTInfo(xlid, from, to)); | ||
| 55 | - return rtn; | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - /** | ||
| 59 | - * 验证排班计划时间范围内规则的正确性。 | ||
| 60 | - * @return | ||
| 61 | - * @throws Exception | ||
| 62 | - */ | ||
| 63 | - @RequestMapping(value = "/valttrule/{xlid}/{from}/{to}", method = RequestMethod.GET) | ||
| 64 | - public Map<String, Object> validateRule( | ||
| 65 | - @PathVariable(value = "xlid") Integer xlid, | ||
| 66 | - @PathVariable(value = "from") Date from, | ||
| 67 | - @PathVariable(value = "to") Date to | ||
| 68 | - ) throws Exception { | ||
| 69 | - Map<String, Object> rtn = new HashMap<>(); | ||
| 70 | - rtn.put("status", ResponseCode.SUCCESS); | ||
| 71 | - rtn.put("data", planPreValidateFacade.validateRule(xlid, from, to)); | ||
| 72 | - return rtn; | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - @Override | ||
| 76 | - protected boolean isSaveExtend() { | ||
| 77 | - return true; | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - /** | ||
| 81 | - * 生成排班计划。 | ||
| 82 | - * @param planDto | ||
| 83 | - * @return | ||
| 84 | - */ | ||
| 85 | - @Override | ||
| 86 | - protected PlanDto saveExtend(PlanDto planDto) { | ||
| 87 | - planGenerateFacade.generatePlan(planDto); | ||
| 88 | - return planDto; | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - //------------------------- 以下是还未服务话的功能 --------------------------// | ||
| 92 | - @Autowired | ||
| 93 | - private SchedulePlanService schedulePlanService; | ||
| 94 | - | ||
| 95 | - /** | ||
| 96 | - * 获取明天的一歌排班计划。 | ||
| 97 | - * @return | ||
| 98 | - * @throws Exception | ||
| 99 | - */ | ||
| 100 | - @RequestMapping(value = "/tommorw", method = RequestMethod.GET) | ||
| 101 | - public SchedulePlan getTommorwPlan() throws Exception { | ||
| 102 | - try { | ||
| 103 | - return schedulePlanService.findSchedulePlanTommorw(); | ||
| 104 | - } catch (Exception exp) { | ||
| 105 | - throw new Exception(exp.getCause()); | ||
| 106 | - } | ||
| 107 | - } | ||
| 108 | -} | 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.schedule.PlanDto; | ||
| 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.schedule.PlanServiceFacade; | ||
| 10 | +import com.bsth.control_v2.plan_module.common.service.schedule.validate.PlanPreValidateFacade; | ||
| 11 | +import com.bsth.controller.schedule.BController_facade; | ||
| 12 | +import com.bsth.entity.schedule.SchedulePlan; | ||
| 13 | +import com.bsth.service.schedule.SchedulePlanService; | ||
| 14 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 15 | +import org.springframework.context.annotation.Conditional; | ||
| 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.RestController; | ||
| 20 | + | ||
| 21 | +import java.util.Date; | ||
| 22 | +import java.util.HashMap; | ||
| 23 | +import java.util.Map; | ||
| 24 | + | ||
| 25 | +@RestController | ||
| 26 | +@Conditional(DubboConfigCondition.class) | ||
| 27 | +@RequestMapping("spc") | ||
| 28 | +public class SchedulePlanController_facade extends BController_facade<Long, PlanDto> { | ||
| 29 | + @Reference | ||
| 30 | + private PlanServiceFacade planServiceFacade; | ||
| 31 | + @Reference | ||
| 32 | + private PlanPreValidateFacade planPreValidateFacade; | ||
| 33 | + | ||
| 34 | + @Override | ||
| 35 | + protected BServiceFacade<Long, PlanDto> getBServiceFacade() { | ||
| 36 | + return planServiceFacade; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 创建指定线路,指定时间范围内的排班计划,使用的时刻表情况 | ||
| 41 | + * @param xlid 线路id | ||
| 42 | + * @param from 开始时间 | ||
| 43 | + * @param to 结束时间 | ||
| 44 | + * @return | ||
| 45 | + * @throws Exception | ||
| 46 | + */ | ||
| 47 | + @RequestMapping(value = "/valttinfo/{xlid}/{from}/{to}", method = RequestMethod.GET) | ||
| 48 | + public Map<String, Object> validateTTInfo( | ||
| 49 | + @PathVariable(value = "xlid") Integer xlid, | ||
| 50 | + @PathVariable(value = "from") Date from, | ||
| 51 | + @PathVariable(value = "to") Date to | ||
| 52 | + ) throws Exception { | ||
| 53 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 54 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 55 | + rtn.put("data", planPreValidateFacade.validateTTInfo(xlid, from, to)); | ||
| 56 | + return rtn; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * 验证排班计划时间范围内规则的正确性。 | ||
| 61 | + * @return | ||
| 62 | + * @throws Exception | ||
| 63 | + */ | ||
| 64 | + @RequestMapping(value = "/valttrule/{xlid}/{from}/{to}", method = RequestMethod.GET) | ||
| 65 | + public Map<String, Object> validateRule( | ||
| 66 | + @PathVariable(value = "xlid") Integer xlid, | ||
| 67 | + @PathVariable(value = "from") Date from, | ||
| 68 | + @PathVariable(value = "to") Date to | ||
| 69 | + ) throws Exception { | ||
| 70 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 71 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 72 | + rtn.put("data", planPreValidateFacade.validateRule(xlid, from, to)); | ||
| 73 | + return rtn; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @Override | ||
| 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); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @Override | ||
| 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); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + //------------------------- 以下是还未服务话的功能 --------------------------// | ||
| 95 | + @Autowired | ||
| 96 | + private SchedulePlanService schedulePlanService; | ||
| 97 | + | ||
| 98 | + /** | ||
| 99 | + * 获取明天的一歌排班计划。 | ||
| 100 | + * @return | ||
| 101 | + * @throws Exception | ||
| 102 | + */ | ||
| 103 | + @RequestMapping(value = "/tommorw", method = RequestMethod.GET) | ||
| 104 | + public SchedulePlan getTommorwPlan() throws Exception { | ||
| 105 | + try { | ||
| 106 | + return schedulePlanService.findSchedulePlanTommorw(); | ||
| 107 | + } catch (Exception exp) { | ||
| 108 | + throw new Exception(exp.getCause()); | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | +} |
src/main/java/com/bsth/controller/schedule/core/SchedulePlanInfoController_facade.java
| 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.dto.schedule.PlanInfoDto; | ||
| 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.PlanInfoServiceFacade; | ||
| 9 | -import com.bsth.control_v2.plan_module.common.utils.SystemInfoUtils; | ||
| 10 | -import com.bsth.controller.schedule.BController_facade; | ||
| 11 | -import org.springframework.web.bind.annotation.PathVariable; | ||
| 12 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 13 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 14 | -import org.springframework.web.bind.annotation.RestController; | ||
| 15 | - | ||
| 16 | -import java.util.Date; | ||
| 17 | -import java.util.HashMap; | ||
| 18 | -import java.util.Map; | ||
| 19 | - | ||
| 20 | -@RestController | ||
| 21 | -@RequestMapping("spic") | ||
| 22 | -public class SchedulePlanInfoController_facade extends BController_facade<Long, PlanInfoDto> { | ||
| 23 | - @Reference | ||
| 24 | - private PlanInfoServiceFacade planInfoServiceFacade; | ||
| 25 | - | ||
| 26 | - @Override | ||
| 27 | - protected BServiceFacade<Long, PlanInfoDto> getBServiceFacade() { | ||
| 28 | - return planInfoServiceFacade; | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | - @Override | ||
| 32 | - public void setCreateUserInfo(PlanInfoDto planInfoDto, Integer userId, Date createDate) { | ||
| 33 | - UserDto userDto = UserDto.getBuilder() | ||
| 34 | - .setId(userId) | ||
| 35 | - .build(); | ||
| 36 | - planInfoDto.setCreateBy(userDto); | ||
| 37 | - planInfoDto.setCreateDate(createDate); | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - @Override | ||
| 41 | - public void setUpdateUserInfo(PlanInfoDto planInfoDto, Integer userId, Date updateDate) { | ||
| 42 | - UserDto userDto = UserDto.getBuilder() | ||
| 43 | - .setId(userId) | ||
| 44 | - .build(); | ||
| 45 | - planInfoDto.setUpdateBy(userDto); | ||
| 46 | - planInfoDto.setUpdateDate(updateDate); | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - @Override | ||
| 50 | - protected boolean isUpdateExtend() { | ||
| 51 | - return true; | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - @Override | ||
| 55 | - protected PlanInfoDto updateExtend(PlanInfoDto planInfoDto) { | ||
| 56 | - return this.planInfoServiceFacade.updateInfo(planInfoDto, SystemInfoUtils.createClientSystemInfo()); | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - @RequestMapping(value = "/groupextinfos/{xlid}/{date}", method = RequestMethod.GET) | ||
| 60 | - public Map<String, Object> findGroupInfoExt( | ||
| 61 | - @PathVariable(value = "xlid") Integer xlid, | ||
| 62 | - @PathVariable(value = "date") Date scheduleDate) { | ||
| 63 | - Map<String, Object> resultMap = new HashMap<>(); | ||
| 64 | - try { | ||
| 65 | - resultMap.put("status", ResponseCode.SUCCESS); | ||
| 66 | - resultMap.put("data", this.planInfoServiceFacade.findPlanGroupInfo(xlid, scheduleDate)); | ||
| 67 | - | ||
| 68 | - } catch (Exception exp) { | ||
| 69 | - exp.printStackTrace(); | ||
| 70 | - resultMap.put("status", ResponseCode.ERROR); | ||
| 71 | - resultMap.put("msg", exp.getLocalizedMessage()); | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - return resultMap; | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | - @RequestMapping(value = "/lastestsd/{xlid}", method = RequestMethod.GET) | ||
| 78 | - public Map<String, Object> findLastestPlanDate( | ||
| 79 | - @PathVariable(value = "xlid") Integer xlid) { | ||
| 80 | - Map<String, Object> resultMap = new HashMap<>(); | ||
| 81 | - try { | ||
| 82 | - resultMap.put("status", ResponseCode.SUCCESS); | ||
| 83 | - resultMap.put("data", this.planInfoServiceFacade.findLastestPlanInfoDate(xlid)); | ||
| 84 | - | ||
| 85 | - } catch (Exception exp) { | ||
| 86 | - exp.printStackTrace(); | ||
| 87 | - resultMap.put("status", ResponseCode.ERROR); | ||
| 88 | - resultMap.put("msg", exp.getLocalizedMessage()); | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - return resultMap; | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - | ||
| 95 | -} | 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.schedule.PlanInfoDto; | ||
| 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.schedule.PlanInfoServiceFacade; | ||
| 10 | +import com.bsth.control_v2.plan_module.common.utils.SystemInfoUtils; | ||
| 11 | +import com.bsth.controller.schedule.BController_facade; | ||
| 12 | +import org.springframework.context.annotation.Conditional; | ||
| 13 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 14 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 15 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 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("spic") | ||
| 25 | +public class SchedulePlanInfoController_facade extends BController_facade<Long, PlanInfoDto> { | ||
| 26 | + @Reference | ||
| 27 | + private PlanInfoServiceFacade planInfoServiceFacade; | ||
| 28 | + | ||
| 29 | + @Override | ||
| 30 | + protected BServiceFacade<Long, PlanInfoDto> getBServiceFacade() { | ||
| 31 | + return planInfoServiceFacade; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + @Override | ||
| 35 | + public void setCreateUserInfo(PlanInfoDto planInfoDto, Integer userId, Date createDate) { | ||
| 36 | + UserDto userDto = UserDto.getBuilder() | ||
| 37 | + .setId(userId) | ||
| 38 | + .build(); | ||
| 39 | + planInfoDto.setCreateBy(userDto); | ||
| 40 | + planInfoDto.setCreateDate(createDate); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @Override | ||
| 44 | + public void setUpdateUserInfo(PlanInfoDto planInfoDto, Integer userId, Date updateDate) { | ||
| 45 | + UserDto userDto = UserDto.getBuilder() | ||
| 46 | + .setId(userId) | ||
| 47 | + .build(); | ||
| 48 | + planInfoDto.setUpdateBy(userDto); | ||
| 49 | + planInfoDto.setUpdateDate(updateDate); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + protected boolean isUpdateExtend() { | ||
| 54 | + return true; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @Override | ||
| 58 | + protected PlanInfoDto updateExtend(PlanInfoDto planInfoDto) { | ||
| 59 | + return this.planInfoServiceFacade.updateInfo(planInfoDto, SystemInfoUtils.createClientSystemInfo()); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @RequestMapping(value = "/groupextinfos/{xlid}/{date}", method = RequestMethod.GET) | ||
| 63 | + public Map<String, Object> findGroupInfoExt( | ||
| 64 | + @PathVariable(value = "xlid") Integer xlid, | ||
| 65 | + @PathVariable(value = "date") Date scheduleDate) { | ||
| 66 | + Map<String, Object> resultMap = new HashMap<>(); | ||
| 67 | + try { | ||
| 68 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 69 | + resultMap.put("data", this.planInfoServiceFacade.findPlanGroupInfo(xlid, scheduleDate)); | ||
| 70 | + | ||
| 71 | + } catch (Exception exp) { | ||
| 72 | + exp.printStackTrace(); | ||
| 73 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 74 | + resultMap.put("msg", exp.getLocalizedMessage()); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + return resultMap; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @RequestMapping(value = "/lastestsd/{xlid}", method = RequestMethod.GET) | ||
| 81 | + public Map<String, Object> findLastestPlanDate( | ||
| 82 | + @PathVariable(value = "xlid") Integer xlid) { | ||
| 83 | + Map<String, Object> resultMap = new HashMap<>(); | ||
| 84 | + try { | ||
| 85 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 86 | + resultMap.put("data", this.planInfoServiceFacade.findLastestPlanInfoDate(xlid)); | ||
| 87 | + | ||
| 88 | + } catch (Exception exp) { | ||
| 89 | + exp.printStackTrace(); | ||
| 90 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 91 | + resultMap.put("msg", exp.getLocalizedMessage()); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + return resultMap; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + | ||
| 98 | +} |
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; | ||
| 2 | - | ||
| 3 | -import com.alibaba.dubbo.config.annotation.Reference; | ||
| 4 | -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.service.BServiceFacade; | ||
| 7 | -import com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoBxDetailServiceFacade; | ||
| 8 | -import com.bsth.controller.schedule.BController_facade; | ||
| 9 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | -import org.springframework.web.bind.annotation.RestController; | ||
| 11 | - | ||
| 12 | -import java.util.Date; | ||
| 13 | - | ||
| 14 | -@RestController | ||
| 15 | -@RequestMapping("tibxdc") | ||
| 16 | -public class TTInfoBxDetailController_facade extends BController_facade<Long, TTInfoBxDetailDto> { | ||
| 17 | - @Reference | ||
| 18 | - private TTInfoBxDetailServiceFacade ttInfoBxDetailServiceFacade; | ||
| 19 | - | ||
| 20 | - @Override | ||
| 21 | - protected BServiceFacade<Long, TTInfoBxDetailDto> getBServiceFacade() { | ||
| 22 | - return ttInfoBxDetailServiceFacade; | ||
| 23 | - } | ||
| 24 | - | ||
| 25 | - @Override | ||
| 26 | - public void setCreateUserInfo(TTInfoBxDetailDto ttInfoBxDetailDto, Integer userId, Date createDate) { | ||
| 27 | - UserDto userDto = UserDto.getBuilder() | ||
| 28 | - .setId(userId) | ||
| 29 | - .build(); | ||
| 30 | - ttInfoBxDetailDto.setCreateBy(userDto); | ||
| 31 | - ttInfoBxDetailDto.setCreateDate(createDate); | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - @Override | ||
| 35 | - public void setUpdateUserInfo(TTInfoBxDetailDto ttInfoBxDetailDto, Integer userId, Date updateDate) { | ||
| 36 | - UserDto userDto = UserDto.getBuilder() | ||
| 37 | - .setId(userId) | ||
| 38 | - .build(); | ||
| 39 | - ttInfoBxDetailDto.setUpdateBy(userDto); | ||
| 40 | - ttInfoBxDetailDto.setUpdateDate(updateDate); | ||
| 41 | - } | ||
| 42 | -} | 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.timetable.TTInfoBxDetailDto; | ||
| 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.timetable.TTInfoBxDetailServiceFacade; | ||
| 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 | +@RestController | ||
| 17 | +@Conditional(DubboConfigCondition.class) | ||
| 18 | +@RequestMapping("tibxdc") | ||
| 19 | +public class TTInfoBxDetailController_facade extends BController_facade<Long, TTInfoBxDetailDto> { | ||
| 20 | + @Reference | ||
| 21 | + private TTInfoBxDetailServiceFacade ttInfoBxDetailServiceFacade; | ||
| 22 | + | ||
| 23 | + @Override | ||
| 24 | + protected BServiceFacade<Long, TTInfoBxDetailDto> getBServiceFacade() { | ||
| 25 | + return ttInfoBxDetailServiceFacade; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + @Override | ||
| 29 | + public void setCreateUserInfo(TTInfoBxDetailDto ttInfoBxDetailDto, Integer userId, Date createDate) { | ||
| 30 | + UserDto userDto = UserDto.getBuilder() | ||
| 31 | + .setId(userId) | ||
| 32 | + .build(); | ||
| 33 | + ttInfoBxDetailDto.setCreateBy(userDto); | ||
| 34 | + ttInfoBxDetailDto.setCreateDate(createDate); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @Override | ||
| 38 | + public void setUpdateUserInfo(TTInfoBxDetailDto ttInfoBxDetailDto, Integer userId, Date updateDate) { | ||
| 39 | + UserDto userDto = UserDto.getBuilder() | ||
| 40 | + .setId(userId) | ||
| 41 | + .build(); | ||
| 42 | + ttInfoBxDetailDto.setUpdateBy(userDto); | ||
| 43 | + ttInfoBxDetailDto.setUpdateDate(updateDate); | ||
| 44 | + } | ||
| 45 | +} |
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
| 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.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.service.BServiceFacade; | ||
| 8 | -import com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoDetailServiceFacade; | ||
| 9 | -import com.bsth.control_v2.plan_module.common.utils.SystemInfoUtils; | ||
| 10 | -import com.bsth.controller.schedule.BController_facade; | ||
| 11 | -import com.bsth.service.schedule.TTInfoDetailService; | ||
| 12 | -import com.bsth.service.schedule.datatools.TTInfoDetailForEdit; | ||
| 13 | -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; | ||
| 18 | - | ||
| 19 | -import java.util.Date; | ||
| 20 | -import java.util.HashMap; | ||
| 21 | -import java.util.List; | ||
| 22 | -import java.util.Map; | ||
| 23 | - | ||
| 24 | -@RestController | ||
| 25 | -@RequestMapping("tidc") | ||
| 26 | -public class TTInfoDetailController_facade extends BController_facade<Long, TTInfoDetailDto> { | ||
| 27 | - @Reference | ||
| 28 | - private TTInfoDetailServiceFacade ttInfoDetailServiceFacade; | ||
| 29 | - | ||
| 30 | - @Override | ||
| 31 | - protected BServiceFacade<Long, TTInfoDetailDto> getBServiceFacade() { | ||
| 32 | - return ttInfoDetailServiceFacade; | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - @Override | ||
| 36 | - public void setCreateUserInfo(TTInfoDetailDto ttInfoDetailDto, Integer userId, Date createDate) { | ||
| 37 | - UserDto userDto = UserDto.getBuilder() | ||
| 38 | - .setId(userId) | ||
| 39 | - .build(); | ||
| 40 | - ttInfoDetailDto.setCreateBy(userDto); | ||
| 41 | - ttInfoDetailDto.setCreateDate(createDate); | ||
| 42 | - } | ||
| 43 | - | ||
| 44 | - @Override | ||
| 45 | - public void setUpdateUserInfo(TTInfoDetailDto ttInfoDetailDto, Integer userId, Date updateDate) { | ||
| 46 | - UserDto userDto = UserDto.getBuilder() | ||
| 47 | - .setId(userId) | ||
| 48 | - .build(); | ||
| 49 | - ttInfoDetailDto.setUpdateBy(userDto); | ||
| 50 | - ttInfoDetailDto.setUpdateDate(updateDate); | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | - @Override | ||
| 54 | - protected boolean isSaveExtend() { | ||
| 55 | - return true; | ||
| 56 | - } | ||
| 57 | - @Override | ||
| 58 | - protected TTInfoDetailDto saveExtend(TTInfoDetailDto ttInfoDetailDto) { | ||
| 59 | - return ttInfoDetailServiceFacade.updateInfo(ttInfoDetailDto, SystemInfoUtils.createClientSystemInfo()); | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - @Override | ||
| 63 | - protected boolean isUpdateExtend() { | ||
| 64 | - return true; | ||
| 65 | - } | ||
| 66 | - @Override | ||
| 67 | - protected TTInfoDetailDto updateExtend(TTInfoDetailDto ttInfoDetailDto) { | ||
| 68 | - return ttInfoDetailServiceFacade.updateInfo(ttInfoDetailDto, SystemInfoUtils.createClientSystemInfo()); | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - @Override | ||
| 72 | - protected boolean isDeleteExtend() { | ||
| 73 | - return true; | ||
| 74 | - } | ||
| 75 | - @Override | ||
| 76 | - protected void deleteExtend(Long aLong) { | ||
| 77 | - ttInfoDetailServiceFacade.deleteInfo(aLong, SystemInfoUtils.createClientSystemInfo()); | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - //--------------- TODO:以下操作不属于BController_facade,暂时没用定义在TTInfoDetailServiceFacade中 ----------// | ||
| 81 | - @Autowired | ||
| 82 | - private TTInfoDetailService ttInfoDetailService; | ||
| 83 | - /** | ||
| 84 | - * 获取时刻表明细编辑信息。 | ||
| 85 | - * @param xlid 线路id | ||
| 86 | - * @param ttid 时刻表id | ||
| 87 | - * @return | ||
| 88 | - */ | ||
| 89 | - @RequestMapping(value = "/edit/{xlid}/{ttid}", method = RequestMethod.GET) | ||
| 90 | - public Map<String, Object> getEditInfo(@PathVariable("xlid") Integer xlid, | ||
| 91 | - @PathVariable("ttid") Long ttid) { | ||
| 92 | - | ||
| 93 | - // 获取最大的发车数,用于输出数据的数量 | ||
| 94 | - Long maxfcno = ttInfoDetailService.findMaxFcno(xlid, ttid); | ||
| 95 | - | ||
| 96 | - Map<String, Object> rtn = new HashMap<>(); | ||
| 97 | - try { | ||
| 98 | - TTInfoDetailForEdit.EditInfo editInfo = ttInfoDetailService.getEditInfo(xlid, ttid, maxfcno); | ||
| 99 | - rtn.put("status", ResponseCode.SUCCESS); | ||
| 100 | - rtn.put("data", editInfo); | ||
| 101 | - } catch (Exception exp) { | ||
| 102 | - rtn.put("status", ResponseCode.ERROR); | ||
| 103 | - rtn.put("msg", exp.getMessage()); | ||
| 104 | - } | ||
| 105 | - return rtn; | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - @RequestMapping(value = "/zd_tcc", method = RequestMethod.GET) | ||
| 109 | - public Map<String, Object> getZdAndTccInfo(Integer lineid, Integer xldir, Integer lineversion) { | ||
| 110 | - Map<String, Object> rtn = new HashMap<>(); | ||
| 111 | - try { | ||
| 112 | - List<Map<String, Object>> list = ttInfoDetailService.findZdAndTcc(lineid, xldir, lineversion); | ||
| 113 | - rtn.put("status", ResponseCode.SUCCESS); | ||
| 114 | - rtn.put("data", list); | ||
| 115 | - } catch (Exception exp) { | ||
| 116 | - rtn.put("status", ResponseCode.ERROR); | ||
| 117 | - rtn.put("msg", exp.getMessage()); | ||
| 118 | - } | ||
| 119 | - return rtn; | ||
| 120 | - } | ||
| 121 | -} | 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.schedule.timetable.TTInfoDetailDto; | ||
| 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.schedule.timetable.TTInfoDetailServiceFacade; | ||
| 10 | +import com.bsth.control_v2.plan_module.common.utils.SystemInfoUtils; | ||
| 11 | +import com.bsth.controller.schedule.BController_facade; | ||
| 12 | +import com.bsth.service.schedule.TTInfoDetailService; | ||
| 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; | ||
| 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.HttpServletResponse; | ||
| 26 | +import java.io.*; | ||
| 27 | +import java.util.*; | ||
| 28 | + | ||
| 29 | +@RestController | ||
| 30 | +@Conditional(DubboConfigCondition.class) | ||
| 31 | +@RequestMapping("tidc") | ||
| 32 | +public class TTInfoDetailController_facade extends BController_facade<Long, TTInfoDetailDto> { | ||
| 33 | + @Reference | ||
| 34 | + private TTInfoDetailServiceFacade ttInfoDetailServiceFacade; | ||
| 35 | + | ||
| 36 | + @Override | ||
| 37 | + protected BServiceFacade<Long, TTInfoDetailDto> getBServiceFacade() { | ||
| 38 | + return ttInfoDetailServiceFacade; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @Override | ||
| 42 | + public void setCreateUserInfo(TTInfoDetailDto ttInfoDetailDto, Integer userId, Date createDate) { | ||
| 43 | + UserDto userDto = UserDto.getBuilder() | ||
| 44 | + .setId(userId) | ||
| 45 | + .build(); | ||
| 46 | + ttInfoDetailDto.setCreateBy(userDto); | ||
| 47 | + ttInfoDetailDto.setCreateDate(createDate); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + @Override | ||
| 51 | + public void setUpdateUserInfo(TTInfoDetailDto ttInfoDetailDto, Integer userId, Date updateDate) { | ||
| 52 | + UserDto userDto = UserDto.getBuilder() | ||
| 53 | + .setId(userId) | ||
| 54 | + .build(); | ||
| 55 | + ttInfoDetailDto.setUpdateBy(userDto); | ||
| 56 | + ttInfoDetailDto.setUpdateDate(updateDate); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Override | ||
| 60 | + protected boolean isSaveExtend() { | ||
| 61 | + return true; | ||
| 62 | + } | ||
| 63 | + @Override | ||
| 64 | + protected TTInfoDetailDto saveExtend(TTInfoDetailDto ttInfoDetailDto) { | ||
| 65 | + return ttInfoDetailServiceFacade.updateInfo(ttInfoDetailDto, SystemInfoUtils.createClientSystemInfo()); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + protected boolean isUpdateExtend() { | ||
| 70 | + return true; | ||
| 71 | + } | ||
| 72 | + @Override | ||
| 73 | + protected TTInfoDetailDto updateExtend(TTInfoDetailDto ttInfoDetailDto) { | ||
| 74 | + return ttInfoDetailServiceFacade.updateInfo(ttInfoDetailDto, SystemInfoUtils.createClientSystemInfo()); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @Override | ||
| 78 | + protected boolean isDeleteExtend() { | ||
| 79 | + return true; | ||
| 80 | + } | ||
| 81 | + @Override | ||
| 82 | + protected void deleteExtend(Long aLong) { | ||
| 83 | + ttInfoDetailServiceFacade.deleteInfo(aLong, SystemInfoUtils.createClientSystemInfo()); | ||
| 84 | + } | ||
| 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 | + | ||
| 124 | + //--------------- TODO:以下操作不属于BController_facade,暂时没用定义在TTInfoDetailServiceFacade中 ----------// | ||
| 125 | + @Autowired | ||
| 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 | + | ||
| 155 | + /** | ||
| 156 | + * 获取时刻表明细编辑信息。 | ||
| 157 | + * @param xlid 线路id | ||
| 158 | + * @param ttid 时刻表id | ||
| 159 | + * @return | ||
| 160 | + */ | ||
| 161 | + @RequestMapping(value = "/edit/{xlid}/{ttid}", method = RequestMethod.GET) | ||
| 162 | + public Map<String, Object> getEditInfo(@PathVariable("xlid") Integer xlid, | ||
| 163 | + @PathVariable("ttid") Long ttid) { | ||
| 164 | + | ||
| 165 | + // 获取最大的发车数,用于输出数据的数量 | ||
| 166 | + Long maxfcno = ttInfoDetailService.findMaxFcno(xlid, ttid); | ||
| 167 | + | ||
| 168 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 169 | + try { | ||
| 170 | + TTInfoDetailForEdit.EditInfo editInfo = ttInfoDetailService.getEditInfo(xlid, ttid, maxfcno); | ||
| 171 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 172 | + rtn.put("data", editInfo); | ||
| 173 | + } catch (Exception exp) { | ||
| 174 | + rtn.put("status", ResponseCode.ERROR); | ||
| 175 | + rtn.put("msg", exp.getMessage()); | ||
| 176 | + } | ||
| 177 | + return rtn; | ||
| 178 | + } | ||
| 179 | + | ||
| 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) { | ||
| 197 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 198 | + try { | ||
| 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 | + | ||
| 212 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 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", "导入文件成功"); | ||
| 236 | + } catch (Exception exp) { | ||
| 237 | + rtn.put("status", ResponseCode.ERROR); | ||
| 238 | + rtn.put("msg", exp.getMessage()); | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + return rtn; | ||
| 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 | + | ||
| 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/data/gpsdata_v2/DataHandleProcess.java
| @@ -136,7 +136,7 @@ public class DataHandleProcess { | @@ -136,7 +136,7 @@ public class DataHandleProcess { | ||
| 136 | }); | 136 | }); |
| 137 | //发送邮件 | 137 | //发送邮件 |
| 138 | EmailBean mail = new EmailBean(); | 138 | EmailBean mail = new EmailBean(); |
| 139 | - mail.setSubject("线调GPS处理<br/>"); | 139 | + mail.setSubject("线调GPS处理"); |
| 140 | mail.setContent("GPS处理超时,检查线程栈文件信息<br/>"); | 140 | mail.setContent("GPS处理超时,检查线程栈文件信息<br/>"); |
| 141 | sendEmailController.sendMail("113252620@qq.com", mail); | 141 | sendEmailController.sendMail("113252620@qq.com", mail); |
| 142 | logger.info("DataHandlerProcess:邮件发送成功!"); | 142 | logger.info("DataHandlerProcess:邮件发送成功!"); |
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<CalcWaybill, Integ | @@ -66,7 +66,10 @@ public interface CalcWaybillRepository extends BaseRepository<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/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/schedule/TTInfoBxDetailService.java
0 → 100644
src/main/java/com/bsth/service/schedule/impl/TTInfoBxDetailServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.schedule.impl; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.schedule.TTInfoBxDetail; | ||
| 4 | +import com.bsth.service.schedule.TTInfoBxDetailService; | ||
| 5 | +import org.springframework.stereotype.Service; | ||
| 6 | +import org.springframework.transaction.annotation.Isolation; | ||
| 7 | +import org.springframework.transaction.annotation.Propagation; | ||
| 8 | +import org.springframework.transaction.annotation.Transactional; | ||
| 9 | + | ||
| 10 | +@Service | ||
| 11 | +@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) | ||
| 12 | +public class TTInfoBxDetailServiceImpl extends BServiceImpl<TTInfoBxDetail, Long> implements TTInfoBxDetailService { | ||
| 13 | + | ||
| 14 | +} |
src/main/resources/application-dev.properties
| @@ -13,8 +13,8 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy | @@ -13,8 +13,8 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy | ||
| 13 | spring.jpa.database= MYSQL | 13 | spring.jpa.database= MYSQL |
| 14 | spring.jpa.show-sql= true | 14 | spring.jpa.show-sql= true |
| 15 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver | 15 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 16 | -#spring.datasource.url= jdbc:mysql://127.0.0.1/test_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 17 | -spring.datasource.url= jdbc:mysql://192.168.168.222/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | 16 | +spring.datasource.url= jdbc:mysql://127.0.0.1/test_control?useUnicode=true&characterEncoding=utf-8&useSSL=false |
| 17 | +#spring.datasource.url= jdbc:mysql://192.168.168.222/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 18 | spring.datasource.username= root | 18 | spring.datasource.username= root |
| 19 | spring.datasource.password= | 19 | spring.datasource.password= |
| 20 | #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | 20 | #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false |
src/main/resources/application-prod.properties
| @@ -3,7 +3,7 @@ server.port=9088 | @@ -3,7 +3,7 @@ server.port=9088 | ||
| 3 | #management.address= 127.0.0.1 | 3 | #management.address= 127.0.0.1 |
| 4 | management.security.enabled=false | 4 | management.security.enabled=false |
| 5 | management.context-path=/manage | 5 | management.context-path=/manage |
| 6 | -dubbo.use=true | 6 | +dubbo.use=false |
| 7 | 7 | ||
| 8 | spring.jpa.hibernate.ddl-auto= update | 8 | spring.jpa.hibernate.ddl-auto= update |
| 9 | spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy | 9 | spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy |
src/main/resources/datatools/config-prod.properties
| @@ -5,11 +5,11 @@ datatools.kettle_properties=/datatools/kettle.properties | @@ -5,11 +5,11 @@ datatools.kettle_properties=/datatools/kettle.properties | ||
| 5 | # 2、ktr文件通用配置变量(数据库连接,根据不同的环境需要修正) | 5 | # 2、ktr文件通用配置变量(数据库连接,根据不同的环境需要修正) |
| 6 | 6 | ||
| 7 | #数据库ip地址 | 7 | #数据库ip地址 |
| 8 | -datatools.kvars_dbip=10.10.150.20 | 8 | +datatools.kvars_dbip=10.10.200.121 |
| 9 | #数据库用户名 | 9 | #数据库用户名 |
| 10 | datatools.kvars_dbuname=root | 10 | datatools.kvars_dbuname=root |
| 11 | #数据库密码 | 11 | #数据库密码 |
| 12 | -datatools.kvars_dbpwd=root2jsp@JSP | 12 | +datatools.kvars_dbpwd=root2jsp |
| 13 | #数据库库名 | 13 | #数据库库名 |
| 14 | datatools.kvars_dbdname=control | 14 | datatools.kvars_dbdname=control |
| 15 | 15 |
src/main/resources/dubbo/applicationContext_dubbo_consumer.xml deleted
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" | ||
| 3 | - xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
| 4 | - http://www.springframework.org/schema/beans/spring-beans.xsd | ||
| 5 | - http://code.alibabatech.com/schema/dubbo | ||
| 6 | - http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> | ||
| 7 | - | ||
| 8 | - <!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 --> | ||
| 9 | - <dubbo:application name="bsth_control_v2" /> | ||
| 10 | - | ||
| 11 | - <!-- 使用zookeeper注册中心暴露服务地址 --> | ||
| 12 | - <!-- 注册中心地址 --> | ||
| 13 | - <dubbo:registry protocol="zookeeper" address="127.0.0.1:2181" check="false" /> | ||
| 14 | - | ||
| 15 | - <!-- 时刻表班型明细服务 --> | ||
| 16 | - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoBxDetailServiceFacade" id="tTInfoBxDetailServiceFacadeImpl" check="false" /> | ||
| 17 | - <!-- 时刻表明细服务 --> | ||
| 18 | - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoDetailServiceFacade" id="tTInfoDetailServiceFacadeImpl" check="false" /> | ||
| 19 | - <!-- 日志服务 --> | ||
| 20 | - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.log.LogServiceFacade" id="logServiceFacadeImpl" check="false" /> | ||
| 21 | - | ||
| 22 | - <!-- TODO:还有其他排班计划服务 --> | ||
| 23 | - <!-- 排班计划查询服务 --> | ||
| 24 | - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.PlanServiceFacade" id="planServiceFacadeImpl" check="false" /> | ||
| 25 | - <!-- 排班明细查询服务 --> | ||
| 26 | - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.PlanInfoServiceFacade" id="planInfoServiceFacadeImpl" check="false" /> | ||
| 27 | - <!-- 排班前置验证服务 --> | ||
| 28 | - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.validate.PlanPreValidateFacade" id="planPreValidateFacadeImpl" check="false" /> | ||
| 29 | - <!-- 排班生成服务 --> | ||
| 30 | - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.PlanGenerateFacade" ref="planGenerateFacadeImpl" check="false" /> | ||
| 31 | - | ||
| 32 | -</beans> | ||
| 33 | \ No newline at end of file | 0 | \ No newline at end of file |
src/main/resources/dubbo/config-dev.properties
| 1 | -# application名字 | ||
| 2 | -spring.dubbo.application.name=bsth_control_v2 | ||
| 3 | -# zookeeper注册中心地址 | ||
| 4 | -spring.dubbo.registry=zookeeper://127.0.0.1:2181 | ||
| 5 | - | ||
| 6 | -#----------- dubbo:consumer 性能调优选项 -------------# | ||
| 7 | -# 远程服务调用超时时间,单位毫秒,这里设置30分钟 | ||
| 8 | -spring.dubbo.consumer.timeout=1800000 | ||
| 9 | -# 远程服务调用重试次数,0表示不需要重试 | ||
| 10 | -spring.dubbo.consumer.retries=0 | ||
| 11 | -#----------- dubbo:consumer 服务治理选项 -------------# | ||
| 12 | -# 启动不检查提供者是否存在 | ||
| 13 | -spring.dubbo.consumer.check=false | ||
| 14 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +# application名字 | ||
| 3 | +spring.dubbo.application.name=bsth_control_v_multi_service | ||
| 4 | +# zookeeper注册中心地址 | ||
| 5 | +spring.dubbo.registry=zookeeper://127.0.0.1:2181 | ||
| 6 | + | ||
| 7 | +#----------- dubbo:consumer 性能调优选项 -------------# | ||
| 8 | +# 远程服务调用超时时间,单位毫秒,这里设置30分钟 | ||
| 9 | +spring.dubbo.consumer.timeout=1800000 | ||
| 10 | +# 远程服务调用重试次数,0表示不需要重试 | ||
| 11 | +spring.dubbo.consumer.retries=0 | ||
| 12 | +#----------- dubbo:consumer 服务治理选项 -------------# | ||
| 13 | +# 启动不检查提供者是否存在 | ||
| 14 | +spring.dubbo.consumer.check=false |
src/main/resources/dubbo/config-prod.properties
| 1 | -# application名字 | ||
| 2 | -spring.dubbo.application.name=bsth_control_v2 | ||
| 3 | -# zookeeper注册中心地址 | ||
| 4 | -spring.dubbo.registry=zookeeper://127.0.0.1:2181 | ||
| 5 | - | ||
| 6 | -#----------- dubbo:consumer 性能调优选项 -------------# | ||
| 7 | -# 远程服务调用超时时间,单位毫秒,这里设置30分钟 | ||
| 8 | -spring.dubbo.consumer.timeout=1800000 | ||
| 9 | -# 远程服务调用重试次数,0表示不需要重试 | ||
| 10 | -spring.dubbo.consumer.retries=0 | ||
| 11 | -#----------- dubbo:consumer 服务治理选项 -------------# | ||
| 12 | -# 启动不检查提供者是否存在 | ||
| 13 | -spring.dubbo.consumer.check=false | 1 | +# application名字 |
| 2 | +spring.dubbo.application.name=bsth_control_v_multi_service | ||
| 3 | +# zookeeper注册中心地址 | ||
| 4 | +spring.dubbo.registry=zookeeper://127.0.0.1:2181 | ||
| 5 | + | ||
| 6 | +#----------- dubbo:consumer 性能调优选项 -------------# | ||
| 7 | +# 远程服务调用超时时间,单位毫秒,这里设置30分钟 | ||
| 8 | +spring.dubbo.consumer.timeout=1800000 | ||
| 9 | +# 远程服务调用重试次数,0表示不需要重试 | ||
| 10 | +spring.dubbo.consumer.retries=0 | ||
| 11 | +#----------- dubbo:consumer 服务治理选项 -------------# | ||
| 12 | +# 启动不检查提供者是否存在 | ||
| 13 | +spring.dubbo.consumer.check=false |
src/main/resources/static/pages/forms/calc/calcsingledata.html
| @@ -40,6 +40,14 @@ | @@ -40,6 +40,14 @@ | ||
| 40 | <span class="item-label" style="width: 80px;">线路: </span> | 40 | <span class="item-label" style="width: 80px;">线路: </span> |
| 41 | <select class="form-control" name="line" id="line" style="width: 140px;"></select> | 41 | <select class="form-control" name="line" id="line" style="width: 140px;"></select> |
| 42 | </div> | 42 | </div> |
| 43 | + <div style="display: inline-block; margin-left: 18px;" id="sfdcDiv"> | ||
| 44 | + <span class="item-label" style="width: 80px;">是否电车: </span> | ||
| 45 | + <select class="form-control form-filter " name="sfdc" id="sfdc"> | ||
| 46 | + <option value="">请选择...</option> | ||
| 47 | + <option value="0">否</option> | ||
| 48 | + <option value="1">是</option> | ||
| 49 | + </select> | ||
| 50 | + </div> | ||
| 43 | <div style="margin-top: 10px"></div> | 51 | <div style="margin-top: 10px"></div> |
| 44 | <div style="display: inline-block;margin-left: 3px;"> | 52 | <div style="display: inline-block;margin-left: 3px;"> |
| 45 | <span class="item-label" style="width: 140px;">开始时间: </span> | 53 | <span class="item-label" style="width: 140px;">开始时间: </span> |
| @@ -99,13 +107,10 @@ | @@ -99,13 +107,10 @@ | ||
| 99 | // 关闭左侧栏 | 107 | // 关闭左侧栏 |
| 100 | if (!$('body').hasClass('page-sidebar-closed')) | 108 | if (!$('body').hasClass('page-sidebar-closed')) |
| 101 | $('.menu-toggler.sidebar-toggler').click(); | 109 | $('.menu-toggler.sidebar-toggler').click(); |
| 102 | - | ||
| 103 | - $("#startDate,#endDate").datetimepicker({ | ||
| 104 | - format : 'YYYY-MM-DD', | ||
| 105 | - locale : 'zh-cn' | ||
| 106 | - }); | 110 | + |
| 107 | 111 | ||
| 108 | var d = new Date(); | 112 | var d = new Date(); |
| 113 | + d.setTime(d.getTime() - 4*1000*60*60*24); | ||
| 109 | var year = d.getFullYear(); | 114 | var year = d.getFullYear(); |
| 110 | var month = d.getMonth() + 1; | 115 | var month = d.getMonth() + 1; |
| 111 | var day = d.getDate(); | 116 | var day = d.getDate(); |
| @@ -113,7 +118,20 @@ | @@ -113,7 +118,20 @@ | ||
| 113 | month = "0" + month; | 118 | month = "0" + month; |
| 114 | if(day < 10) | 119 | if(day < 10) |
| 115 | day = "0" + day; | 120 | day = "0" + day; |
| 116 | - $("#startDate,#endDate").val(year + "-" + month + "-" + day); | 121 | + var dateTime = year + "-" + month + "-" + day; |
| 122 | + $("#startDate").datetimepicker({ | ||
| 123 | + format : 'YYYY-MM-DD', | ||
| 124 | + locale : 'zh-cn', | ||
| 125 | + maxDate : dateTime | ||
| 126 | + }); | ||
| 127 | + $("#endDate").datetimepicker({ | ||
| 128 | + format : 'YYYY-MM-DD', | ||
| 129 | + locale : 'zh-cn', | ||
| 130 | + maxDate : dateTime | ||
| 131 | + }); | ||
| 132 | + $("#startDate").val(dateTime); | ||
| 133 | + $("#endDate").val(dateTime); | ||
| 134 | + | ||
| 117 | 135 | ||
| 118 | var fage=false; | 136 | var fage=false; |
| 119 | var xlList; | 137 | var xlList; |
| @@ -193,6 +211,8 @@ | @@ -193,6 +211,8 @@ | ||
| 193 | } | 211 | } |
| 194 | }); | 212 | }); |
| 195 | 213 | ||
| 214 | + $("#sfdcDiv").hide(); | ||
| 215 | + | ||
| 196 | var cont = "驾驶员", cont1 = "", cont2 = "", cont3 = ""; | 216 | var cont = "驾驶员", cont1 = "", cont2 = "", cont3 = ""; |
| 197 | $("#tjtype").on("change",function(){ | 217 | $("#tjtype").on("change",function(){ |
| 198 | if(cont == "驾驶员"){ | 218 | if(cont == "驾驶员"){ |
| @@ -205,10 +225,13 @@ | @@ -205,10 +225,13 @@ | ||
| 205 | cont = $("#tjtype").val(); | 225 | cont = $("#tjtype").val(); |
| 206 | if($("#tjtype").val() == "驾驶员"){ | 226 | if($("#tjtype").val() == "驾驶员"){ |
| 207 | $("#cont").val(cont1); | 227 | $("#cont").val(cont1); |
| 228 | + $("#sfdcDiv").hide(); | ||
| 208 | } else if($("#tjtype").val() == "售票员"){ | 229 | } else if($("#tjtype").val() == "售票员"){ |
| 209 | $("#cont").val(cont2); | 230 | $("#cont").val(cont2); |
| 231 | + $("#sfdcDiv").hide(); | ||
| 210 | } else if($("#tjtype").val() == "车辆自编号"){ | 232 | } else if($("#tjtype").val() == "车辆自编号"){ |
| 211 | $("#cont").val(cont3); | 233 | $("#cont").val(cont3); |
| 234 | + $("#sfdcDiv").show(); | ||
| 212 | } | 235 | } |
| 213 | }); | 236 | }); |
| 214 | 237 | ||
| @@ -229,9 +252,10 @@ | @@ -229,9 +252,10 @@ | ||
| 229 | var fgsdmSing = $("#fgsdmSing").val(); | 252 | var fgsdmSing = $("#fgsdmSing").val(); |
| 230 | var tjtype=$("#tjtype").val(); | 253 | var tjtype=$("#tjtype").val(); |
| 231 | var cont=$("#cont").val(); | 254 | var cont=$("#cont").val(); |
| 255 | + var sfdc=$("#sfdc").val(); | ||
| 232 | var params = {}; | 256 | var params = {}; |
| 233 | var i = layer.load(2); | 257 | var i = layer.load(2); |
| 234 | - $get("/calc_mix/singledatatj",{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,cont:cont},function(result){ | 258 | + $get("/calc_mix/singledatatj",{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,cont:cont,sfdc:sfdc},function(result){ |
| 235 | layer.close(i); | 259 | layer.close(i); |
| 236 | var singledata = template('singledata',{list:result}); | 260 | var singledata = template('singledata',{list:result}); |
| 237 | // 把渲染好的模版html文本追加到表格中 | 261 | // 把渲染好的模版html文本追加到表格中 |
| @@ -247,11 +271,12 @@ | @@ -247,11 +271,12 @@ | ||
| 247 | var fgsdmSing = $("#fgsdmSing").val(); | 271 | var fgsdmSing = $("#fgsdmSing").val(); |
| 248 | var tjtype=$("#tjtype").val(); | 272 | var tjtype=$("#tjtype").val(); |
| 249 | var cont=$("#cont").val(); | 273 | var cont=$("#cont").val(); |
| 274 | + var sfdc=$("#sfdc").val(); | ||
| 250 | var lineName = $('#line option:selected').text(); | 275 | var lineName = $('#line option:selected').text(); |
| 251 | if(lineName == "全部线路") | 276 | if(lineName == "全部线路") |
| 252 | lineName = $('#fgsdmSing option:selected').text(); | 277 | lineName = $('#fgsdmSing option:selected').text(); |
| 253 | var i = layer.load(2); | 278 | var i = layer.load(2); |
| 254 | - $get('/calc_export/singledataExportTj',{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,cont:cont,type:'export',lineName:lineName},function(result){ | 279 | + $get('/calc_export/singledataExportTj',{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,cont:cont,sfdc:sfdc,type:'export',lineName:lineName},function(result){ |
| 255 | var dateTime = ""; | 280 | var dateTime = ""; |
| 256 | if(startDate == endDate){ | 281 | if(startDate == endDate){ |
| 257 | dateTime = moment(startDate).format("YYYYMMDD"); | 282 | dateTime = moment(startDate).format("YYYYMMDD"); |
src/main/resources/static/pages/home.html
| @@ -59,41 +59,13 @@ | @@ -59,41 +59,13 @@ | ||
| 59 | } | 59 | } |
| 60 | </style> | 60 | </style> |
| 61 | <div class="system_change_log"> | 61 | <div class="system_change_log"> |
| 62 | - <h2 style="text-indent: 35px;margin: 10px 0 5px;">2019-04-11 更新说明 Changelog</h2> | 62 | + <h2 style="text-indent: 35px;margin: 10px 0 5px;">2020-03-12 更新说明 Changelog</h2> |
| 63 | <br><br> | 63 | <br><br> |
| 64 | <ul > | 64 | <ul > |
| 65 | <li class="sub_title"><h6>权限管理</h6></li> | 65 | <li class="sub_title"><h6>权限管理</h6></li> |
| 66 | - <li><span class="label s_c_change">修复</span>1、编辑某一个员工,用户、角色和授权管理设置在同一界面。</li> | ||
| 67 | - <li><span class="label s_c_change">新增</span>2、用户增加一项状态,显示主调、监控和作废。</li> | 66 | + <li><span class="label s_c_change">修改</span>1、密码修改加入密码复杂度校验机制</li> |
| 68 | <li class="sub_title"><h6>线调</h6></li> | 67 | <li class="sub_title"><h6>线调</h6></li> |
| 69 | - <li><span class="label s_c_change">新增</span>1、少量班次对换完成用颜色标记为已换。</li> | ||
| 70 | - <li><span class="label s_c_change">新增</span>2、子任务可最小化。</li> | ||
| 71 | - <li><span class="label s_c_change">修复</span>3、修正子任务一个备注栏原因选择后其他子任务都会同步备注此原因。</li> | ||
| 72 | - <li><span class="label s_c_change">修复</span>4、轨迹回放只显示当前一段时间内的gps走向,已轨迹回放的走向自动不显示(只显示当前上下行的gps走向)。</li> | ||
| 73 | - <li><span class="label s_c_change">修复</span>5、轨迹回放播放速度添加更多倍速播放可选。</li> | ||
| 74 | - <li><span class="label s_c_change">新增</span>6、"线路配置"分割成"线路配置"、"翻班与自动执行",可独立授权。</li> | ||
| 75 | - <li><span class="label s_c_change">新增</span>7、添加设置,选择是否显示应到实到误差时间。</li> | ||
| 76 | - <li><span class="label s_c_change">修复</span>8、无发有到时间 为紫色完成状态,改为显眼颜色区分,用橙色区分。</li> | ||
| 77 | - <li><span class="label s_c_change">修复</span>9、轨迹回放中根据时间点切换线路版本信息。</li> | ||
| 78 | - <li><span class="label s_c_change">修复</span>10、路牌对调连续请求造成数据不一致,翻班时无法清楚前日的排班数据。</li> | ||
| 79 | - <li class="sub_title"><h6>计划调度</h6></li> | ||
| 80 | - <li><span class="label s_c_change">修复</span>1、车辆报废,释放设备编号后在设备管理里添加一条设备替换记录。</li> | ||
| 81 | - <li><span class="label s_c_change">修复</span>2、线路值勤日报,修改班次时,跨线路修改班次车提示报警。</li> | ||
| 82 | - <li><span class="label s_c_change">修复</span>3、增加公司,分公司查询条件,公司,分公司,线路都是跟登录用户权限的,导出的数据和查询条件一致。</li> | ||
| 83 | - <li><span class="label s_c_change">修复</span>4、排班时,页面添加规则逻辑判定。</li> | ||
| 84 | - <li><span class="label s_c_change">修复</span>5、车辆导出修正,导出内容和权限匹配,和搜索条件匹配。</li> | ||
| 85 | - <li><span class="label s_c_change">新增</span>6、所有的页面搜索添加排序选项功能。</li> | ||
| 86 | - <li><span class="label s_c_change">新增</span>7、新增计划排班预览功能。</li> | ||
| 87 | - <li class="sub_title"><h6>统计报表</h6></li> | ||
| 88 | - <li><span class="label s_c_change">新增</span>1、新增早高峰出车报表。</li> | ||
| 89 | - <li><span class="label s_c_change">新增</span>2、新增调度日报(待发对比) 报表。</li> | ||
| 90 | - <li><span class="label s_c_change">新增</span>3、新增路单数据统计报表。</li> | ||
| 91 | - <li><span class="label s_c_change">修复</span>4、修正班次车辆人员日报表中的售票员统计。</li> | ||
| 92 | - <li class="sub_title"><h6>基础信息</h6></li> | ||
| 93 | - <li><span class="label s_c_change">修复</span>1、线路版本:待更新状态增加删除功能,历史版本取消修改功能。</li> | ||
| 94 | - <li><span class="label s_c_change">修复</span>2、线路信息-站点详情列-详情页面-站点修改功能:站点修改多边形功能修改,站点中心点可以移动。</li> | ||
| 95 | - <li class="sub_title"><h6>用油管理</h6></li> | ||
| 96 | - <li><span class="label s_c_change">修复</span>1、修正加油人员不符保存后不在显示。</li> | 68 | + <li><span class="label s_c_change">新增</span>1、线调页面新增维修上报功能</li> |
| 97 | </ul> | 69 | </ul> |
| 98 | 70 | ||
| 99 | </div> | 71 | </div> |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/list.html
| @@ -135,14 +135,85 @@ | @@ -135,14 +135,85 @@ | ||
| 135 | 135 | ||
| 136 | </td> | 136 | </td> |
| 137 | <td> | 137 | <td> |
| 138 | - <a href="#" class="btn btn-success btn-sm" ng-if="info.planResult == 'ok'"> | 138 | + <a sweetalert |
| 139 | + sweet-options="{title: '排班信息',text: '线路:' + info.xl.name + | ||
| 140 | + '</br>开始时间:' + ctrl.toDateStr(info.scheduleFromTime) + | ||
| 141 | + '</br>结束时间:' + ctrl.toDateStr(info.scheduleToTime) + | ||
| 142 | + '</br>事务Id:' + ctrl.getPlanResultXid(info) + | ||
| 143 | + '</br>事务描述:' + ctrl.getPlanResultDesc(info), | ||
| 144 | + html: true, | ||
| 145 | + type: 'info'}" | ||
| 146 | + sweet-on-confirm="" | ||
| 147 | + class="btn btn-info btn-sm" | ||
| 148 | + ng-if="ctrl.isPlanGenerate_PREPARE(info)"> | ||
| 149 | + <span>准备中</span> | ||
| 150 | + <i class="fa fa-spinner" aria-hidden="true"></i> | ||
| 151 | + </a> | ||
| 152 | + | ||
| 153 | + <a sweetalert | ||
| 154 | + sweet-options="{title: '排班信息',text: '线路:' + info.xl.name + | ||
| 155 | + '</br>开始时间:' + ctrl.toDateStr(info.scheduleFromTime) + | ||
| 156 | + '</br>结束时间:' + ctrl.toDateStr(info.scheduleToTime) + | ||
| 157 | + '</br>事务Id:' + ctrl.getPlanResultXid(info) + | ||
| 158 | + '</br>事务描述:' + ctrl.getPlanResultDesc(info), | ||
| 159 | + html: true, | ||
| 160 | + type: 'info'}" | ||
| 161 | + sweet-on-confirm="" | ||
| 162 | + class="btn btn-primary btn-sm" | ||
| 163 | + ng-if="ctrl.isPlanGenerate_PROGRESS(info)"> | ||
| 164 | + <span>进行中</span> | ||
| 165 | + <i class="fa fa-spinner" aria-hidden="true"></i> | ||
| 166 | + </a> | ||
| 167 | + | ||
| 168 | + <a sweetalert | ||
| 169 | + sweet-options="{title: '排班信息',text: '线路:' + info.xl.name + | ||
| 170 | + '</br>开始时间:' + ctrl.toDateStr(info.scheduleFromTime) + | ||
| 171 | + '</br>结束时间:' + ctrl.toDateStr(info.scheduleToTime) + | ||
| 172 | + '</br>事务Id:' + ctrl.getPlanResultXid(info) + | ||
| 173 | + '</br>事务描述:' + ctrl.getPlanResultDesc(info), | ||
| 174 | + html: true, | ||
| 175 | + type: 'success'}" | ||
| 176 | + sweet-on-confirm="" | ||
| 177 | + class="btn btn-success btn-sm" | ||
| 178 | + ng-if="ctrl.isPlanGenerate_SUCCESS_ALL(info)"> | ||
| 139 | <span>成功</span> | 179 | <span>成功</span> |
| 180 | + <i class="fa fa-check" aria-hidden="true"></i> | ||
| 140 | </a> | 181 | </a> |
| 182 | + | ||
| 141 | <a sweetalert | 183 | <a sweetalert |
| 142 | - sweet-options="{title: '排班错误信息',text: '线路:' + info.xl.name + '</br>开始时间:' + ctrl.toDateStr(info.scheduleFromTime) + '</br>结束时间:' + ctrl.toDateStr(info.scheduleToTime) + '</br>' + info.planResult, html: true,type: 'warning',showCancelButton: true,confirmButtonColor: '#DD6B55',confirmButtonText: '是',cancelButtonText: '取消'}" | 184 | + sweet-options="{title: '排班信息',text: '线路:' + info.xl.name + |
| 185 | + '</br>开始时间:' + ctrl.toDateStr(info.scheduleFromTime) + | ||
| 186 | + '</br>结束时间:' + ctrl.toDateStr(info.scheduleToTime) + | ||
| 187 | + '</br>事务Id:' + ctrl.getPlanResultXid(info) + | ||
| 188 | + '</br>事务描述:排班成功,但是排班结果有异常,如下:</br>' + ctrl.getPlanResultDesc(info), | ||
| 189 | + html: true, | ||
| 190 | + type: 'warning', | ||
| 191 | + showCancelButton: true, | ||
| 192 | + confirmButtonColor: '#DD6B55', | ||
| 193 | + confirmButtonText: '是', | ||
| 194 | + cancelButtonText: '取消'}" | ||
| 195 | + sweet-on-confirm="" | ||
| 196 | + class="btn btn-warning btn-sm" | ||
| 197 | + ng-if="ctrl.isPlanGenerate_SUCCESS_NOT_ALL(info)"> | ||
| 198 | + <span>成功</span> | ||
| 199 | + <i class="fa fa-exclamation" aria-hidden="true"></i> | ||
| 200 | + </a> | ||
| 201 | + | ||
| 202 | + <a sweetalert | ||
| 203 | + sweet-options="{title: '排班信息',text: '线路:' + info.xl.name + | ||
| 204 | + '</br>开始时间:' + ctrl.toDateStr(info.scheduleFromTime) + | ||
| 205 | + '</br>结束时间:' + ctrl.toDateStr(info.scheduleToTime) + | ||
| 206 | + '</br>事务Id:' + ctrl.getPlanResultXid(info) + | ||
| 207 | + '</br>事务描述:' + ctrl.getPlanResultDesc(info), | ||
| 208 | + html: true, | ||
| 209 | + type: 'error'}" | ||
| 143 | sweet-on-confirm="" | 210 | sweet-on-confirm="" |
| 144 | class="btn btn-danger btn-sm" | 211 | class="btn btn-danger btn-sm" |
| 145 | - ng-if="info.planResult != 'ok'">点击查错</a> | 212 | + ng-if="ctrl.isPlanGenerate_FAILURE(info)"> |
| 213 | + <span>失败</span> | ||
| 214 | + <i class="fa fa-times" aria-hidden="true"></i> | ||
| 215 | + </a> | ||
| 216 | + | ||
| 146 | </td> | 217 | </td> |
| 147 | <td> | 218 | <td> |
| 148 | <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> | 219 | <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/module.js
| @@ -213,6 +213,68 @@ angular.module('ScheduleApp').controller( | @@ -213,6 +213,68 @@ angular.module('ScheduleApp').controller( | ||
| 213 | 213 | ||
| 214 | self.doPage(); | 214 | self.doPage(); |
| 215 | 215 | ||
| 216 | + //------------- 判断排班的完成状态及输出(以下)----------------// | ||
| 217 | + self.getPlanResultXid = function(info) { | ||
| 218 | + try { | ||
| 219 | + var result = angular.fromJson(info["planResult"]); | ||
| 220 | + return result["generateTransactionXID"]; | ||
| 221 | + } catch (err) { | ||
| 222 | + return ""; | ||
| 223 | + } | ||
| 224 | + }; | ||
| 225 | + self.getPlanResultDesc = function(info) { | ||
| 226 | + try { | ||
| 227 | + var result = angular.fromJson(info["planResult"]); | ||
| 228 | + return result["generateDesc"]; | ||
| 229 | + } catch (err) { | ||
| 230 | + return info["planResult"]; | ||
| 231 | + } | ||
| 232 | + }; | ||
| 233 | + self.isPlanGenerate_PREPARE = function(info) { | ||
| 234 | + try { | ||
| 235 | + var result = angular.fromJson(info["planResult"]); | ||
| 236 | + return result["generateStatus"] === 0 || result["generateStatus"] === 'PREPARE'; | ||
| 237 | + } catch (err) { | ||
| 238 | + return false; | ||
| 239 | + } | ||
| 240 | + }; | ||
| 241 | + self.isPlanGenerate_PROGRESS = function(info) { | ||
| 242 | + try { | ||
| 243 | + var result = angular.fromJson(info["planResult"]); | ||
| 244 | + return result["generateStatus"] === 1 || result["generateStatus"] === 'PROGRESS'; | ||
| 245 | + } catch (err) { | ||
| 246 | + return false; | ||
| 247 | + } | ||
| 248 | + }; | ||
| 249 | + self.isPlanGenerate_SUCCESS_ALL = function(info) { | ||
| 250 | + try { | ||
| 251 | + var result = angular.fromJson(info["planResult"]); | ||
| 252 | + return (result["generateStatus"] === 2 || result["generateStatus"] === 'SUCCESS') && result["generateDesc"] === "ok"; | ||
| 253 | + } catch (err) { | ||
| 254 | + return info["planResult"] === "ok"; | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + }; | ||
| 258 | + self.isPlanGenerate_SUCCESS_NOT_ALL = function(info) { | ||
| 259 | + try { | ||
| 260 | + var result = angular.fromJson(info["planResult"]); | ||
| 261 | + return (result["generateStatus"] === 2 || result["generateStatus"] === 'SUCCESS') && result["generateDesc"] !== "ok"; | ||
| 262 | + } catch (err) { | ||
| 263 | + return info["planResult"] !== "ok"; | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + }; | ||
| 267 | + self.isPlanGenerate_FAILURE = function(info) { | ||
| 268 | + try { | ||
| 269 | + var result = angular.fromJson(info["planResult"]); | ||
| 270 | + return result["generateStatus"] === 3 || result["generateStatus"] === 'FAILURE'; | ||
| 271 | + } catch (err) { | ||
| 272 | + return false; | ||
| 273 | + } | ||
| 274 | + }; | ||
| 275 | + | ||
| 276 | + //------------- 判断排班的完成状态(以上)----------------// | ||
| 277 | + | ||
| 216 | // 转换日期成str | 278 | // 转换日期成str |
| 217 | self.toDateStr = function(time) { | 279 | self.toDateStr = function(time) { |
| 218 | return $filter('date')(new Date(time), 'yyyy-MM-dd'); | 280 | return $filter('date')(new Date(time), 'yyyy-MM-dd'); |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/timeTableDetailManage_old.js
| @@ -159,6 +159,8 @@ angular.module('ScheduleApp').factory( | @@ -159,6 +159,8 @@ angular.module('ScheduleApp').factory( | ||
| 159 | // assign创建人时间 | 159 | // assign创建人时间 |
| 160 | editInfo.rowBxInfo[lp_bx_index].createBy = bxInfo_temp.createBy; | 160 | editInfo.rowBxInfo[lp_bx_index].createBy = bxInfo_temp.createBy; |
| 161 | editInfo.rowBxInfo[lp_bx_index].createDate = bxInfo_temp.createDate; | 161 | editInfo.rowBxInfo[lp_bx_index].createDate = bxInfo_temp.createDate; |
| 162 | + // assign版本号 | ||
| 163 | + editInfo.rowBxInfo[lp_bx_index].version = bxInfo_temp.version; | ||
| 162 | } | 164 | } |
| 163 | } | 165 | } |
| 164 | } | 166 | } |
| @@ -677,10 +679,15 @@ angular.module('ScheduleApp').controller( | @@ -677,10 +679,15 @@ angular.module('ScheduleApp').controller( | ||
| 677 | } | 679 | } |
| 678 | // 更新班型信息 | 680 | // 更新班型信息 |
| 679 | self.submit = function() { | 681 | self.submit = function() { |
| 682 | + // alert(self.bxInfo.id + "-" + self.bxInfo.version); | ||
| 680 | // assign线路版本 | 683 | // assign线路版本 |
| 681 | self.bxInfo.lineVersion = self.lineversion; | 684 | self.bxInfo.lineVersion = self.lineversion; |
| 682 | service.updateBXInfo(self.bxInfo).then( | 685 | service.updateBXInfo(self.bxInfo).then( |
| 683 | function(result) { | 686 | function(result) { |
| 687 | + // 设置id和version | ||
| 688 | + self.bxInfo.id = result.id; | ||
| 689 | + self.bxInfo.version = result.version; | ||
| 690 | + | ||
| 684 | // 跳转 | 691 | // 跳转 |
| 685 | $state.go("ttInfoDetailManage_edit3", { | 692 | $state.go("ttInfoDetailManage_edit3", { |
| 686 | xlid: self.xlid, | 693 | xlid: self.xlid, |