Commit 93fe73785bce56ec00d25615eb5d71ca60d4f14a
1 parent
c3407cd0
iss提交11:
1、修改时刻表相关facade控制机器,添加新的服务方法
Showing
5 changed files
with
523 additions
and
131 deletions
src/main/java/com/bsth/controller/schedule/core/GuideboardInfoController_facade.java
| 1 | 1 | package com.bsth.controller.schedule.core; |
| 2 | 2 | |
| 3 | +import com.alibaba.dubbo.config.annotation.Reference; | |
| 3 | 4 | import com.bsth.common.ResponseCode; |
| 4 | 5 | import com.bsth.control_v2.plan_module.common.dto.baseinfo.LineDto; |
| 5 | 6 | import com.bsth.control_v2.plan_module.common.dto.schedule.config.LpConfigDto; |
| 6 | 7 | import com.bsth.control_v2.plan_module.common.dto.sys.UserDto; |
| 7 | -import com.bsth.control_v2.plan_module.common.exception.PlanModuleException; | |
| 8 | 8 | import com.bsth.control_v2.plan_module.common.service.BServiceFacade; |
| 9 | 9 | import com.bsth.control_v2.plan_module.common.service.schedule.config.LpConfigServiceFacade; |
| 10 | 10 | import com.bsth.controller.schedule.BController_facade; |
| 11 | -import com.bsth.entity.schedule.GuideboardInfo; | |
| 12 | 11 | import com.bsth.service.schedule.GuideboardInfoService; |
| 13 | -import com.bsth.service.schedule.exception.ScheduleException; | |
| 14 | 12 | import com.bsth.service.schedule.utils.DataToolsFile; |
| 15 | 13 | import org.apache.commons.lang3.StringUtils; |
| 16 | 14 | import org.apache.poi.ss.usermodel.Workbook; |
| ... | ... | @@ -46,7 +44,7 @@ public class GuideboardInfoController_facade extends BController_facade<Long, Lp |
| 46 | 44 | lpConfigDto.setUpdateDate(updateDate); |
| 47 | 45 | } |
| 48 | 46 | |
| 49 | - @Autowired | |
| 47 | + @Reference | |
| 50 | 48 | private LpConfigServiceFacade lpConfigServiceFacade; |
| 51 | 49 | |
| 52 | 50 | @Override | ... | ... |
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.dto.baseinfo.LineDto; | |
| 6 | +import com.bsth.control_v2.plan_module.common.dto.schedule.timetable.TTInfoDto; | |
| 7 | +import com.bsth.control_v2.plan_module.common.dto.sys.UserDto; | |
| 8 | +import com.bsth.control_v2.plan_module.common.exception.PlanModuleException; | |
| 9 | +import com.bsth.control_v2.plan_module.common.service.BServiceFacade; | |
| 10 | +import com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoServiceFacade; | |
| 11 | +import com.bsth.controller.schedule.BController_facade; | |
| 12 | +import org.springframework.web.bind.annotation.*; | |
| 13 | + | |
| 14 | +import java.util.Date; | |
| 15 | +import java.util.HashMap; | |
| 16 | +import java.util.Map; | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * Created by xu on 16/12/20. | |
| 20 | + */ | |
| 21 | +@RestController(value = "tTInfoController_ec") | |
| 22 | +@RequestMapping(value = "tic_ec") | |
| 23 | +public class TTInfoController_facade extends BController_facade<Long, TTInfoDto> { | |
| 24 | + @Override | |
| 25 | + public void setCreateUserInfo(TTInfoDto ttInfoDto, Integer userId, Date createDate) { | |
| 26 | + UserDto userDto = UserDto.getBuilder() | |
| 27 | + .setId(userId) | |
| 28 | + .build(); | |
| 29 | + ttInfoDto.setCreateBy(userDto); | |
| 30 | + ttInfoDto.setCreateDate(createDate); | |
| 31 | + } | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public void setUpdateUserInfo(TTInfoDto ttInfoDto, Integer userId, Date updateDate) { | |
| 35 | + UserDto userDto = UserDto.getBuilder() | |
| 36 | + .setId(userId) | |
| 37 | + .build(); | |
| 38 | + ttInfoDto.setUpdateBy(userDto); | |
| 39 | + ttInfoDto.setUpdateDate(updateDate); | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Reference | |
| 43 | + private TTInfoServiceFacade ttInfoServiceFacade; | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + protected BServiceFacade<Long, TTInfoDto> getBServiceFacade() { | |
| 47 | + return ttInfoServiceFacade; | |
| 48 | + } | |
| 49 | + | |
| 50 | + @RequestMapping(value = "/stationroute/{lineid}", method = RequestMethod.GET) | |
| 51 | + public Map<String, Object> getLineStationRouteVersions(@PathVariable(value = "lineid") Integer lineid) { | |
| 52 | + Map<String, Object> rtn = new HashMap<>(); | |
| 53 | + try { | |
| 54 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 55 | + rtn.put("data", ttInfoServiceFacade.getLineStationRouteVersions(lineid)); | |
| 56 | + | |
| 57 | + } catch (Exception exp) { | |
| 58 | + rtn.put("status", ResponseCode.ERROR); | |
| 59 | + rtn.put("msg", exp.getMessage()); | |
| 60 | + } | |
| 61 | + | |
| 62 | + return rtn; | |
| 63 | + | |
| 64 | + } | |
| 65 | + | |
| 66 | + @RequestMapping(value = "/versiondesc/{lineid}/{version}") | |
| 67 | + public Map<String, Object> getLineVersionDesc( | |
| 68 | + @PathVariable(value = "lineid") Integer lineid, | |
| 69 | + @PathVariable(value = "version") Integer version) { | |
| 70 | + Map<String, Object> rtn = new HashMap<>(); | |
| 71 | + try { | |
| 72 | + Map<String, String> desc = new HashMap<>(); | |
| 73 | + desc.put("desc", ttInfoServiceFacade.getLineVersionDesc(lineid, version)); | |
| 74 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 75 | + rtn.put("data", desc); | |
| 76 | + | |
| 77 | + } catch (Exception exp) { | |
| 78 | + rtn.put("status", ResponseCode.ERROR); | |
| 79 | + rtn.put("msg", exp.getMessage()); | |
| 80 | + } | |
| 81 | + | |
| 82 | + return rtn; | |
| 83 | + } | |
| 84 | + | |
| 85 | + @RequestMapping(value = "/versiondesc2/{lineid}/{status}") | |
| 86 | + public Map<String, Object> getLineVersionDesc2( | |
| 87 | + @PathVariable(value = "lineid") Integer lineid, | |
| 88 | + @PathVariable(value = "status") Integer status) { | |
| 89 | + Map<String, Object> rtn = new HashMap<>(); | |
| 90 | + try { | |
| 91 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 92 | + rtn.put("data", ttInfoServiceFacade.getLineVersions(lineid, status)); | |
| 93 | + | |
| 94 | + } catch (Exception exp) { | |
| 95 | + rtn.put("status", ResponseCode.ERROR); | |
| 96 | + rtn.put("msg", exp.getMessage()); | |
| 97 | + } | |
| 98 | + | |
| 99 | + return rtn; | |
| 100 | + } | |
| 101 | + | |
| 102 | + @RequestMapping(value = "/validate_name", method = RequestMethod.GET) | |
| 103 | + public Map<String, Object> validate_name(@RequestParam Map<String, Object> param) { | |
| 104 | + Map<String, Object> rtn = new HashMap<>(); | |
| 105 | + try { | |
| 106 | + // 名字重复验证 | |
| 107 | + TTInfoDto ttInfoDto = TTInfoDto.getBuilder() | |
| 108 | + .setId(param.get("id_eq") == null ? null : Long.valueOf(param.get("id_eq").toString())) | |
| 109 | + .setXl(param.get("xl.id_eq") == null ? null : ( | |
| 110 | + LineDto.getBuilder() | |
| 111 | + .setId(Integer.valueOf(param.get("xl.id_eq").toString())) | |
| 112 | + .build() | |
| 113 | + )) | |
| 114 | + .setName(param.get("name_eq") == null ? null : param.get("name_eq").toString()) | |
| 115 | + .setRule_days(param.get("rule_days_eq") == null ? null : param.get("rule_days_eq").toString()) | |
| 116 | + .setSpecial_days(param.get("special_days_eq") == null ? null : param.get("special_days_eq").toString()) | |
| 117 | + .build(); | |
| 118 | + ttInfoServiceFacade.validate_name_duplicate(ttInfoDto); | |
| 119 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 120 | + } catch (PlanModuleException exp) { | |
| 121 | + rtn.put("status", ResponseCode.ERROR); | |
| 122 | + rtn.put("msg", exp.getMessage()); | |
| 123 | + } | |
| 124 | + | |
| 125 | + return rtn; | |
| 126 | + } | |
| 127 | + | |
| 128 | + @RequestMapping(value = "/validate_n_d", method = RequestMethod.GET) | |
| 129 | + public Map<String, Object> validate_n_d(@RequestParam Map<String, Object> param) { | |
| 130 | + Map<String, Object> rtn = new HashMap<>(); | |
| 131 | + try { | |
| 132 | + // 常规有效日重复验证 | |
| 133 | + TTInfoDto ttInfoDto = TTInfoDto.getBuilder() | |
| 134 | + .setId(param.get("id_eq") == null ? null : Long.valueOf(param.get("id_eq").toString())) | |
| 135 | + .setXl(param.get("xl.id_eq") == null ? null : ( | |
| 136 | + LineDto.getBuilder() | |
| 137 | + .setId(Integer.valueOf(param.get("xl.id_eq").toString())) | |
| 138 | + .build() | |
| 139 | + )) | |
| 140 | + .setName(param.get("name_eq") == null ? null : param.get("name_eq").toString()) | |
| 141 | + .setRule_days(param.get("rule_days_eq") == null ? null : param.get("rule_days_eq").toString()) | |
| 142 | + .setSpecial_days(param.get("special_days_eq") == null ? null : param.get("special_days_eq").toString()) | |
| 143 | + .build(); | |
| 144 | + ttInfoServiceFacade.validate_normal_day_duplicate(ttInfoDto); | |
| 145 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 146 | + } catch (PlanModuleException exp) { | |
| 147 | + rtn.put("status", ResponseCode.ERROR); | |
| 148 | + rtn.put("msg", exp.getMessage()); | |
| 149 | + } | |
| 150 | + return rtn; | |
| 151 | + } | |
| 152 | + | |
| 153 | + @RequestMapping(value = "/validate_s_d", method = RequestMethod.GET) | |
| 154 | + public Map<String, Object> validate_s_d(@RequestParam Map<String, Object> param) { | |
| 155 | + Map<String, Object> rtn = new HashMap<>(); | |
| 156 | + try { | |
| 157 | + // 特殊有效日重复判定 | |
| 158 | + TTInfoDto ttInfoDto = TTInfoDto.getBuilder() | |
| 159 | + .setId(param.get("id_eq") == null ? null : Long.valueOf(param.get("id_eq").toString())) | |
| 160 | + .setXl(param.get("xl.id_eq") == null ? null : ( | |
| 161 | + LineDto.getBuilder() | |
| 162 | + .setId(Integer.valueOf(param.get("xl.id_eq").toString())) | |
| 163 | + .build() | |
| 164 | + )) | |
| 165 | + .setName(param.get("name_eq") == null ? null : param.get("name_eq").toString()) | |
| 166 | + .setRule_days(param.get("rule_days_eq") == null ? null : param.get("rule_days_eq").toString()) | |
| 167 | + .setSpecial_days(param.get("special_days_eq") == null ? null : param.get("special_days_eq").toString()) | |
| 168 | + .build(); | |
| 169 | + ttInfoServiceFacade.validate_special_day_duplicate(ttInfoDto); | |
| 170 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 171 | + } catch (PlanModuleException exp) { | |
| 172 | + rtn.put("status", ResponseCode.ERROR); | |
| 173 | + rtn.put("msg", exp.getMessage()); | |
| 174 | + } | |
| 175 | + return rtn; | |
| 176 | + } | |
| 177 | + | |
| 178 | + @RequestMapping(value = "/backup/{ttinfo}", method = RequestMethod.GET) | |
| 179 | + public Map<String, Object> backup(@PathVariable(value = "ttinfo") Long ttInfoId) { | |
| 180 | + Map<String, Object> rtn = new HashMap<>(); | |
| 181 | + try { | |
| 182 | + // 备份时刻表 | |
| 183 | + this.ttInfoServiceFacade.backUp(ttInfoId); | |
| 184 | + } catch (PlanModuleException exp) { | |
| 185 | + rtn.put("status", ResponseCode.ERROR); | |
| 186 | + rtn.put("msg", exp.getMessage()); | |
| 187 | + } | |
| 188 | + | |
| 189 | + return rtn; | |
| 190 | + } | |
| 191 | + | |
| 192 | +} | |
| 0 | 193 | \ 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.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 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.List; | |
| 24 | -import java.util.Map; | |
| 25 | - | |
| 26 | -@RestController | |
| 27 | -@Conditional(DubboConfigCondition.class) | |
| 28 | -@RequestMapping("tidc") | |
| 29 | -public class TTInfoDetailController_facade extends BController_facade<Long, TTInfoDetailDto> { | |
| 30 | - @Reference | |
| 31 | - private TTInfoDetailServiceFacade ttInfoDetailServiceFacade; | |
| 32 | - | |
| 33 | - @Override | |
| 34 | - protected BServiceFacade<Long, TTInfoDetailDto> getBServiceFacade() { | |
| 35 | - return ttInfoDetailServiceFacade; | |
| 36 | - } | |
| 37 | - | |
| 38 | - @Override | |
| 39 | - public void setCreateUserInfo(TTInfoDetailDto ttInfoDetailDto, Integer userId, Date createDate) { | |
| 40 | - UserDto userDto = UserDto.getBuilder() | |
| 41 | - .setId(userId) | |
| 42 | - .build(); | |
| 43 | - ttInfoDetailDto.setCreateBy(userDto); | |
| 44 | - ttInfoDetailDto.setCreateDate(createDate); | |
| 45 | - } | |
| 46 | - | |
| 47 | - @Override | |
| 48 | - public void setUpdateUserInfo(TTInfoDetailDto ttInfoDetailDto, Integer userId, Date updateDate) { | |
| 49 | - UserDto userDto = UserDto.getBuilder() | |
| 50 | - .setId(userId) | |
| 51 | - .build(); | |
| 52 | - ttInfoDetailDto.setUpdateBy(userDto); | |
| 53 | - ttInfoDetailDto.setUpdateDate(updateDate); | |
| 54 | - } | |
| 55 | - | |
| 56 | - @Override | |
| 57 | - protected boolean isSaveExtend() { | |
| 58 | - return true; | |
| 59 | - } | |
| 60 | - @Override | |
| 61 | - protected TTInfoDetailDto saveExtend(TTInfoDetailDto ttInfoDetailDto) { | |
| 62 | - return ttInfoDetailServiceFacade.updateInfo(ttInfoDetailDto, SystemInfoUtils.createClientSystemInfo()); | |
| 63 | - } | |
| 64 | - | |
| 65 | - @Override | |
| 66 | - protected boolean isUpdateExtend() { | |
| 67 | - return true; | |
| 68 | - } | |
| 69 | - @Override | |
| 70 | - protected TTInfoDetailDto updateExtend(TTInfoDetailDto ttInfoDetailDto) { | |
| 71 | - return ttInfoDetailServiceFacade.updateInfo(ttInfoDetailDto, SystemInfoUtils.createClientSystemInfo()); | |
| 72 | - } | |
| 73 | - | |
| 74 | - @Override | |
| 75 | - protected boolean isDeleteExtend() { | |
| 76 | - return true; | |
| 77 | - } | |
| 78 | - @Override | |
| 79 | - protected void deleteExtend(Long aLong) { | |
| 80 | - ttInfoDetailServiceFacade.deleteInfo(aLong, SystemInfoUtils.createClientSystemInfo()); | |
| 81 | - } | |
| 82 | - | |
| 83 | - //--------------- TODO:以下操作不属于BController_facade,暂时没用定义在TTInfoDetailServiceFacade中 ----------// | |
| 84 | - @Autowired | |
| 85 | - private TTInfoDetailService ttInfoDetailService; | |
| 86 | - /** | |
| 87 | - * 获取时刻表明细编辑信息。 | |
| 88 | - * @param xlid 线路id | |
| 89 | - * @param ttid 时刻表id | |
| 90 | - * @return | |
| 91 | - */ | |
| 92 | - @RequestMapping(value = "/edit/{xlid}/{ttid}", method = RequestMethod.GET) | |
| 93 | - public Map<String, Object> getEditInfo(@PathVariable("xlid") Integer xlid, | |
| 94 | - @PathVariable("ttid") Long ttid) { | |
| 95 | - | |
| 96 | - // 获取最大的发车数,用于输出数据的数量 | |
| 97 | - Long maxfcno = ttInfoDetailService.findMaxFcno(xlid, ttid); | |
| 98 | - | |
| 99 | - Map<String, Object> rtn = new HashMap<>(); | |
| 100 | - try { | |
| 101 | - TTInfoDetailForEdit.EditInfo editInfo = ttInfoDetailService.getEditInfo(xlid, ttid, maxfcno); | |
| 102 | - rtn.put("status", ResponseCode.SUCCESS); | |
| 103 | - rtn.put("data", editInfo); | |
| 104 | - } catch (Exception exp) { | |
| 105 | - rtn.put("status", ResponseCode.ERROR); | |
| 106 | - rtn.put("msg", exp.getMessage()); | |
| 107 | - } | |
| 108 | - return rtn; | |
| 109 | - } | |
| 110 | - | |
| 111 | - @RequestMapping(value = "/zd_tcc", method = RequestMethod.GET) | |
| 112 | - public Map<String, Object> getZdAndTccInfo(Integer lineid, Integer xldir, Integer lineversion) { | |
| 113 | - Map<String, Object> rtn = new HashMap<>(); | |
| 114 | - try { | |
| 115 | - List<Map<String, Object>> list = ttInfoDetailService.findZdAndTcc(lineid, xldir, lineversion); | |
| 116 | - rtn.put("status", ResponseCode.SUCCESS); | |
| 117 | - rtn.put("data", list); | |
| 118 | - } catch (Exception exp) { | |
| 119 | - rtn.put("status", ResponseCode.ERROR); | |
| 120 | - rtn.put("msg", exp.getMessage()); | |
| 121 | - } | |
| 122 | - return rtn; | |
| 123 | - } | |
| 124 | -} | |
| 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 com.bsth.service.schedule.datatools.TTinfoDetailDynamicData; | |
| 14 | +import com.bsth.service.schedule.timetable.ExcelFormatType; | |
| 15 | +import com.bsth.service.schedule.utils.DataToolsFile; | |
| 16 | +import com.bsth.service.schedule.utils.DataToolsFileType; | |
| 17 | +import org.apache.commons.lang3.StringUtils; | |
| 18 | +import org.apache.poi.ss.usermodel.Workbook; | |
| 19 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 20 | +import org.springframework.web.bind.annotation.*; | |
| 21 | +import org.springframework.web.multipart.MultipartFile; | |
| 22 | + | |
| 23 | +import javax.servlet.http.HttpServletResponse; | |
| 24 | +import java.io.*; | |
| 25 | +import java.util.*; | |
| 26 | + | |
| 27 | +@RestController | |
| 28 | +@RequestMapping("tidc") | |
| 29 | +public class TTInfoDetailController_facade extends BController_facade<Long, TTInfoDetailDto> { | |
| 30 | + @Reference | |
| 31 | + private TTInfoDetailServiceFacade ttInfoDetailServiceFacade; | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + protected BServiceFacade<Long, TTInfoDetailDto> getBServiceFacade() { | |
| 35 | + return ttInfoDetailServiceFacade; | |
| 36 | + } | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public void setCreateUserInfo(TTInfoDetailDto ttInfoDetailDto, Integer userId, Date createDate) { | |
| 40 | + UserDto userDto = UserDto.getBuilder() | |
| 41 | + .setId(userId) | |
| 42 | + .build(); | |
| 43 | + ttInfoDetailDto.setCreateBy(userDto); | |
| 44 | + ttInfoDetailDto.setCreateDate(createDate); | |
| 45 | + } | |
| 46 | + | |
| 47 | + @Override | |
| 48 | + public void setUpdateUserInfo(TTInfoDetailDto ttInfoDetailDto, Integer userId, Date updateDate) { | |
| 49 | + UserDto userDto = UserDto.getBuilder() | |
| 50 | + .setId(userId) | |
| 51 | + .build(); | |
| 52 | + ttInfoDetailDto.setUpdateBy(userDto); | |
| 53 | + ttInfoDetailDto.setUpdateDate(updateDate); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @Override | |
| 57 | + protected boolean isSaveExtend() { | |
| 58 | + return true; | |
| 59 | + } | |
| 60 | + @Override | |
| 61 | + protected TTInfoDetailDto saveExtend(TTInfoDetailDto ttInfoDetailDto) { | |
| 62 | + return ttInfoDetailServiceFacade.updateInfo(ttInfoDetailDto, SystemInfoUtils.createClientSystemInfo()); | |
| 63 | + } | |
| 64 | + | |
| 65 | + @Override | |
| 66 | + protected boolean isUpdateExtend() { | |
| 67 | + return true; | |
| 68 | + } | |
| 69 | + @Override | |
| 70 | + protected TTInfoDetailDto updateExtend(TTInfoDetailDto ttInfoDetailDto) { | |
| 71 | + return ttInfoDetailServiceFacade.updateInfo(ttInfoDetailDto, SystemInfoUtils.createClientSystemInfo()); | |
| 72 | + } | |
| 73 | + | |
| 74 | + @Override | |
| 75 | + protected boolean isDeleteExtend() { | |
| 76 | + return true; | |
| 77 | + } | |
| 78 | + @Override | |
| 79 | + protected void deleteExtend(Long aLong) { | |
| 80 | + ttInfoDetailServiceFacade.deleteInfo(aLong, SystemInfoUtils.createClientSystemInfo()); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @RequestMapping(value = "/bcdetail", method = RequestMethod.GET) | |
| 84 | + public List<TTInfoDetailDto> findBcdetails(Integer xlId, Long ttinfoId, Long lpId) { | |
| 85 | + return ttInfoDetailServiceFacade.findBcdetails(xlId, ttinfoId, lpId); | |
| 86 | + } | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * 验证关联的线路标准信息(以后放到规则引擎里去做)。 | |
| 90 | + * @param lineinfoid | |
| 91 | + * @return | |
| 92 | + */ | |
| 93 | + @RequestMapping(value = "/validate/lineinfo", method = RequestMethod.GET) | |
| 94 | + public Map<String, Object> validate_lineInfo(Integer lineinfoid) { | |
| 95 | + Map<String, Object> rtn = new HashMap<>(); | |
| 96 | + try { | |
| 97 | + ttInfoDetailServiceFacade.validateAssoLineInfo(lineinfoid); | |
| 98 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 99 | + } catch (Exception exp) { | |
| 100 | + rtn.put("status", ResponseCode.ERROR); | |
| 101 | + rtn.put("msg", exp.getMessage()); | |
| 102 | + } | |
| 103 | + return rtn; | |
| 104 | + } | |
| 105 | + | |
| 106 | + @RequestMapping(value = "/zd_tcc", method = RequestMethod.GET) | |
| 107 | + public Map<String, Object> getZdAndTccInfo(Integer lineid, Integer xldir, Integer lineversion) { | |
| 108 | + Map<String, Object> rtn = new HashMap<>(); | |
| 109 | + try { | |
| 110 | + List<Map<String, Object>> list = ttInfoDetailServiceFacade.findZdAndTcc(lineid, xldir, lineversion); | |
| 111 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 112 | + rtn.put("data", list); | |
| 113 | + } catch (Exception exp) { | |
| 114 | + rtn.put("status", ResponseCode.ERROR); | |
| 115 | + rtn.put("msg", exp.getMessage()); | |
| 116 | + } | |
| 117 | + return rtn; | |
| 118 | + } | |
| 119 | + | |
| 120 | + | |
| 121 | + //--------------- TODO:以下操作不属于BController_facade,暂时没用定义在TTInfoDetailServiceFacade中 ----------// | |
| 122 | + @Autowired | |
| 123 | + private TTInfoDetailService ttInfoDetailService; | |
| 124 | + | |
| 125 | + /** | |
| 126 | + * 验证sheet(以后放到规则引擎里去做)。 | |
| 127 | + * @param filename excel文件全路径名 | |
| 128 | + * @param sheetname sheet名字 | |
| 129 | + * @param lineid 线路id | |
| 130 | + * @param linename 线路名称 | |
| 131 | + * @param lineversion 线路版本 | |
| 132 | + * @return | |
| 133 | + */ | |
| 134 | + @RequestMapping(value = "/validate/sheet", method = RequestMethod.POST) | |
| 135 | + public Map<String, Object> validate_sheet( | |
| 136 | + String filename, String sheetname, Integer lineid, String linename, Integer lineversion, String excelFormatType) { | |
| 137 | + Map<String, Object> rtn = new HashMap<>(); | |
| 138 | + try { | |
| 139 | + if (lineversion == null) { | |
| 140 | + throw new Exception("线路版本未知"); | |
| 141 | + } | |
| 142 | + ttInfoDetailService.validateExcelSheet(filename, sheetname, lineid, linename, lineversion, | |
| 143 | + ExcelFormatType.getEnum(excelFormatType)); | |
| 144 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 145 | + } catch (Exception exp) { | |
| 146 | + rtn.put("status", ResponseCode.ERROR); | |
| 147 | + rtn.put("msg", exp.getMessage()); | |
| 148 | + } | |
| 149 | + return rtn; | |
| 150 | + } | |
| 151 | + | |
| 152 | + /** | |
| 153 | + * 获取时刻表明细编辑信息。 | |
| 154 | + * @param xlid 线路id | |
| 155 | + * @param ttid 时刻表id | |
| 156 | + * @return | |
| 157 | + */ | |
| 158 | + @RequestMapping(value = "/edit/{xlid}/{ttid}", method = RequestMethod.GET) | |
| 159 | + public Map<String, Object> getEditInfo(@PathVariable("xlid") Integer xlid, | |
| 160 | + @PathVariable("ttid") Long ttid) { | |
| 161 | + | |
| 162 | + // 获取最大的发车数,用于输出数据的数量 | |
| 163 | + Long maxfcno = ttInfoDetailService.findMaxFcno(xlid, ttid); | |
| 164 | + | |
| 165 | + Map<String, Object> rtn = new HashMap<>(); | |
| 166 | + try { | |
| 167 | + TTInfoDetailForEdit.EditInfo editInfo = ttInfoDetailService.getEditInfo(xlid, ttid, maxfcno); | |
| 168 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 169 | + rtn.put("data", editInfo); | |
| 170 | + } catch (Exception exp) { | |
| 171 | + rtn.put("status", ResponseCode.ERROR); | |
| 172 | + rtn.put("msg", exp.getMessage()); | |
| 173 | + } | |
| 174 | + return rtn; | |
| 175 | + } | |
| 176 | + | |
| 177 | + /** | |
| 178 | + * 时刻表明细批量插入 | |
| 179 | + * | |
| 180 | + * @param entities | |
| 181 | + * | |
| 182 | + * @return | |
| 183 | + */ | |
| 184 | + @RequestMapping(value = "/skbDetailMxSave" ,method = RequestMethod.POST) | |
| 185 | + public Map<String, Object> skbDetailMxSave(@RequestParam Map<String, Object> entities){ | |
| 186 | + return ttInfoDetailService.skbDetailMxSave(entities); | |
| 187 | + } | |
| 188 | + | |
| 189 | + //------------------ TODO:导入导出逻辑,之后会服务化 -----------------// | |
| 190 | + | |
| 191 | + // 上传excel文件 | |
| 192 | + @RequestMapping(value = "/uploadFile", method = RequestMethod.POST) | |
| 193 | + public Map<String, Object> uploadFile(MultipartFile file) { | |
| 194 | + Map<String, Object> rtn = new HashMap<>(); | |
| 195 | + try { | |
| 196 | + DataToolsFile dataToolsFile = ttInfoDetailService.uploadFile(file.getOriginalFilename(), file.getBytes()); | |
| 197 | + // excel文件名 | |
| 198 | + String fileName = dataToolsFile.getFile().getAbsolutePath(); | |
| 199 | + Workbook wb = dataToolsFile.getFileType().getWorkBook(dataToolsFile.getFile()); | |
| 200 | + | |
| 201 | + // excel文件sheet | |
| 202 | + List<String> sheetnames = new ArrayList<>(); | |
| 203 | + for (int i = 0; i < wb.getNumberOfSheets(); i ++) { | |
| 204 | + sheetnames.add(wb.getSheetAt(i).getSheetName()); | |
| 205 | + } | |
| 206 | + | |
| 207 | + wb.close(); | |
| 208 | + | |
| 209 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 210 | + rtn.put("filename", fileName); | |
| 211 | + rtn.put("sheetnames", StringUtils.join(sheetnames, ",")); | |
| 212 | + } catch (Exception exp) { | |
| 213 | + exp.printStackTrace(); | |
| 214 | + rtn.put("status", ResponseCode.ERROR); | |
| 215 | + rtn.put("msg", exp.getMessage()); | |
| 216 | + } | |
| 217 | + return rtn; | |
| 218 | + } | |
| 219 | + // 导入excel文件 | |
| 220 | + @RequestMapping(value = "/importFile", method = RequestMethod.POST) | |
| 221 | + public Map<String, Object> importFile(@RequestParam Map<String, Object> params) { | |
| 222 | + Map<String, Object> rtn = new HashMap<>(); | |
| 223 | + | |
| 224 | + try { | |
| 225 | + File file = new File(String.valueOf(params.get("filename"))); | |
| 226 | + if (!file.exists()) { | |
| 227 | + throw new Exception("导入文件不存在!"); | |
| 228 | + } | |
| 229 | + ttInfoDetailService.importData(file, params); | |
| 230 | + | |
| 231 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 232 | + rtn.put("msg", "导入文件成功"); | |
| 233 | + } catch (Exception exp) { | |
| 234 | + rtn.put("status", ResponseCode.ERROR); | |
| 235 | + rtn.put("msg", exp.getMessage()); | |
| 236 | + } | |
| 237 | + | |
| 238 | + return rtn; | |
| 239 | + } | |
| 240 | + // 上传并导入excel文件 | |
| 241 | + @RequestMapping(value = "/uploadAndImportFile", method = RequestMethod.POST) | |
| 242 | + public Map<String, Object> uploadAndImportFile(MultipartFile file) { | |
| 243 | + Map<String, Object> rtn = new HashMap<>(); | |
| 244 | + | |
| 245 | + try { | |
| 246 | + DataToolsFile dataToolsFile = ttInfoDetailService.uploadFile(file.getOriginalFilename(), file.getBytes()); | |
| 247 | + Map<String, Object> params = new HashMap<>(); | |
| 248 | + ttInfoDetailService.importData(dataToolsFile.getFile(), params); | |
| 249 | + | |
| 250 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 251 | + rtn.put("msg", "上传&导入文件成功"); | |
| 252 | + } catch (Exception exp) { | |
| 253 | + exp.printStackTrace(); | |
| 254 | + rtn.put("status", ResponseCode.ERROR); | |
| 255 | + rtn.put("msg", exp.getMessage()); | |
| 256 | + } | |
| 257 | + | |
| 258 | + return rtn; | |
| 259 | + } | |
| 260 | + | |
| 261 | + // 导出数据到xls文件 | |
| 262 | + @RequestMapping(value = "/exportFile", method = RequestMethod.GET) | |
| 263 | + public void exportFile(HttpServletResponse response, | |
| 264 | + @RequestParam Map<String, Object> params) throws Exception { | |
| 265 | + DataToolsFile dataToolsFile = ttInfoDetailService.exportData(params); | |
| 266 | + // 流输出导出文件 | |
| 267 | + response.setHeader("content-type", "application/octet-stream"); | |
| 268 | + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName()); | |
| 269 | + response.setContentType("application/octet-stream"); | |
| 270 | + | |
| 271 | + OutputStream os = response.getOutputStream(); | |
| 272 | + BufferedOutputStream bos = new BufferedOutputStream(os); | |
| 273 | + | |
| 274 | + InputStream is = new FileInputStream(dataToolsFile.getFile()); | |
| 275 | + BufferedInputStream bis = new BufferedInputStream(is); | |
| 276 | + | |
| 277 | + int length = 0; | |
| 278 | + byte[] temp = new byte[1 * 1024 * 10]; | |
| 279 | + while ((length = bis.read(temp)) != -1) { | |
| 280 | + bos.write(temp, 0, length); | |
| 281 | + } | |
| 282 | + bos.flush(); | |
| 283 | + bis.close(); | |
| 284 | + bos.close(); | |
| 285 | + is.close(); | |
| 286 | + } | |
| 287 | + | |
| 288 | + @RequestMapping(value = "/exportDTDFile/{type}", method = RequestMethod.POST) | |
| 289 | + public void exportFile( | |
| 290 | + @RequestBody TTinfoDetailDynamicData.DTInfos dtInfos, @PathVariable("type") String type, | |
| 291 | + HttpServletResponse response) throws Exception { | |
| 292 | + DataToolsFile dataToolsFile = null; | |
| 293 | + if ("xls".equals(type)) { | |
| 294 | + dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos, DataToolsFileType.XLS); | |
| 295 | + } else if ("xlsx".equals(type)) { | |
| 296 | + dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos, DataToolsFileType.XLSX); | |
| 297 | + } else { | |
| 298 | + throw new Exception("未知的导出格式==>" + type); | |
| 299 | + } | |
| 300 | + | |
| 301 | + // 流输出导出文件 | |
| 302 | + response.setHeader("content-type", "application/octet-stream"); | |
| 303 | + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName()); | |
| 304 | + response.setContentType("application/octet-stream"); | |
| 305 | + | |
| 306 | + OutputStream os = response.getOutputStream(); | |
| 307 | + BufferedOutputStream bos = new BufferedOutputStream(os); | |
| 308 | + | |
| 309 | + InputStream is = new FileInputStream(dataToolsFile.getFile()); | |
| 310 | + BufferedInputStream bis = new BufferedInputStream(is); | |
| 311 | + | |
| 312 | + int length = 0; | |
| 313 | + byte[] temp = new byte[1 * 1024 * 10]; | |
| 314 | + while ((length = bis.read(temp)) != -1) { | |
| 315 | + bos.write(temp, 0, length); | |
| 316 | + } | |
| 317 | + bos.flush(); | |
| 318 | + bis.close(); | |
| 319 | + bos.close(); | |
| 320 | + is.close(); | |
| 321 | + } | |
| 322 | + | |
| 323 | + | |
| 324 | +} | ... | ... |
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 | 3 | import com.bsth.common.ResponseCode; |
| 4 | 4 | import com.bsth.controller.schedule.BController; |
| ... | ... | @@ -14,8 +14,8 @@ import java.util.Map; |
| 14 | 14 | /** |
| 15 | 15 | * Created by xu on 16/12/20. |
| 16 | 16 | */ |
| 17 | -@RestController(value = "tTInfoController_ec") | |
| 18 | -@RequestMapping(value = "tic_ec") | |
| 17 | +//@RestController(value = "tTInfoController_ec") | |
| 18 | +//@RequestMapping(value = "tic_ec") | |
| 19 | 19 | public class TTInfoController extends BController<TTInfo, Long> { |
| 20 | 20 | @Autowired |
| 21 | 21 | private TTInfoService ttInfoService; | ... | ... |
src/main/resources/dubbo/applicationContext_dubbo_consumer.xml
| ... | ... | @@ -30,6 +30,8 @@ |
| 30 | 30 | <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoBxDetailServiceFacade" id="tTInfoBxDetailServiceFacadeImpl" check="false" /> |
| 31 | 31 | <!-- 时刻表明细服务 --> |
| 32 | 32 | <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoDetailServiceFacade" id="tTInfoDetailServiceFacadeImpl" check="false" /> |
| 33 | + <!-- 时刻表服务 --> | |
| 34 | + <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoServiceFacade" id="tTInfoServiceFacadeImpl" check="false" /> | |
| 33 | 35 | <!-- 日志服务 --> |
| 34 | 36 | <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.log.LogServiceFacade" id="logServiceFacadeImpl" check="false" /> |
| 35 | 37 | ... | ... |