Commit 8f5c3b7e9b827752bd70483b6baed410e4876614
1 parent
bc0bc886
iss提交6:
1、添加使用carDevice服务的controller,把原来的controller放入legacy包中 2、在dubbo消费者配置文件中配置carDevice服务
Showing
3 changed files
with
89 additions
and
4 deletions
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.dto.baseinfo.CarDeviceDto; | |
| 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.baseinfo.CarDeviceServiceFacade; | |
| 9 | +import com.bsth.controller.schedule.BController_facade; | |
| 10 | +import org.joda.time.DateTime; | |
| 11 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 12 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 13 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 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(value = "carDeviceController_sc") | |
| 21 | +@RequestMapping("cde_sc") | |
| 22 | +public class CarDeviceController_facade extends BController_facade<Long, CarDeviceDto> { | |
| 23 | + @Override | |
| 24 | + public void setCreateUserInfo(CarDeviceDto carDeviceDto, Integer userId, Date createDate) { | |
| 25 | + UserDto userDto = UserDto.getBuilder() | |
| 26 | + .setId(userId) | |
| 27 | + .build(); | |
| 28 | + carDeviceDto.setCreateBy(userDto); | |
| 29 | + carDeviceDto.setCreateDate(createDate); | |
| 30 | + } | |
| 31 | + | |
| 32 | + @Override | |
| 33 | + public void setUpdateUserInfo(CarDeviceDto carDeviceDto, Integer userId, Date updateDate) { | |
| 34 | + UserDto userDto = UserDto.getBuilder() | |
| 35 | + .setId(userId) | |
| 36 | + .build(); | |
| 37 | + carDeviceDto.setUpdateBy(userDto); | |
| 38 | + carDeviceDto.setUpdateDate(updateDate); | |
| 39 | + } | |
| 40 | + | |
| 41 | + @Reference | |
| 42 | + private CarDeviceServiceFacade carDeviceServiceFacade; | |
| 43 | + | |
| 44 | + @Override | |
| 45 | + protected BServiceFacade<Long, CarDeviceDto> getBServiceFacade() { | |
| 46 | + return carDeviceServiceFacade; | |
| 47 | + } | |
| 48 | + @RequestMapping(value = "/validate_qyrq", method = RequestMethod.GET) | |
| 49 | + public Map<String, Object> validate_qyrq(@RequestParam Map<String, Object> param) { | |
| 50 | + Map<String, Object> rtn = new HashMap<>(); | |
| 51 | + | |
| 52 | + try { | |
| 53 | + // 启用日期验证 | |
| 54 | + // 计算日期 | |
| 55 | + Date qyrq_c = null; | |
| 56 | + if (param.get("qyrq_eq") != null) { | |
| 57 | + try { | |
| 58 | + qyrq_c = new Date(); | |
| 59 | + qyrq_c.setTime(Long.parseLong(param.get("qyrq_eq").toString())); | |
| 60 | + } catch (Exception exp) { | |
| 61 | + qyrq_c = new DateTime(param.get("qyrq_eq").toString()).toDate(); | |
| 62 | + } | |
| 63 | + } | |
| 64 | + | |
| 65 | + CarDeviceDto carDeviceDto = CarDeviceDto.getBuilder() | |
| 66 | + .setId(param.get("id_eq") == null ? | |
| 67 | + null : Long.valueOf(param.get("id_eq").toString())) | |
| 68 | + .setXl(param.get("xl_eq") == null ? | |
| 69 | + null : Integer.valueOf(param.get("xl_eq").toString())) | |
| 70 | + .setCl(param.get("cl_eq") == null ? | |
| 71 | + null : Integer.valueOf(param.get("cl_eq").toString())) | |
| 72 | + .setQyrq(qyrq_c) | |
| 73 | + .build(); | |
| 74 | + | |
| 75 | + this.carDeviceServiceFacade.validate_qyrq(carDeviceDto); | |
| 76 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 77 | + } catch (Exception exp) { | |
| 78 | + rtn.put("status", ResponseCode.ERROR); | |
| 79 | + rtn.put("msg", exp.getMessage()); | |
| 80 | + } | |
| 81 | + | |
| 82 | + return rtn; | |
| 83 | + } | |
| 84 | +} | ... | ... |
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 | 3 | import com.bsth.common.ResponseCode; |
| 4 | 4 | import com.bsth.controller.schedule.BController; |
| ... | ... | @@ -9,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
| 10 | 10 | import org.springframework.web.bind.annotation.RequestMethod; |
| 11 | 11 | import org.springframework.web.bind.annotation.RequestParam; |
| 12 | -import org.springframework.web.bind.annotation.RestController; | |
| 13 | 12 | |
| 14 | 13 | import java.util.HashMap; |
| 15 | 14 | import java.util.Map; |
| ... | ... | @@ -17,8 +16,8 @@ import java.util.Map; |
| 17 | 16 | /** |
| 18 | 17 | * Created by xu on 16/12/15. |
| 19 | 18 | */ |
| 20 | -@RestController(value = "carDeviceController_sc") | |
| 21 | -@RequestMapping("cde_sc") | |
| 19 | +//@RestController(value = "carDeviceController_sc") | |
| 20 | +//@RequestMapping("cde_sc") | |
| 22 | 21 | public class CarDeviceController extends BController<CarDevice, Long> { |
| 23 | 22 | @Autowired |
| 24 | 23 | private CarDeviceService carDeviceService; | ... | ... |
src/main/resources/dubbo/applicationContext_dubbo_consumer.xml
| ... | ... | @@ -14,6 +14,8 @@ |
| 14 | 14 | |
| 15 | 15 | <!-- 车辆信息服务 --> |
| 16 | 16 | <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.baseinfo.CarServiceFacade" id="carServiceFacadeImpl" check="false" /> |
| 17 | + <!-- 车辆设备信息服务 --> | |
| 18 | + <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.baseinfo.CarDeviceServiceFacade" id="carDeviceServiceFacadeImpl" check="false" /> | |
| 17 | 19 | |
| 18 | 20 | <!-- 时刻表班型明细服务 --> |
| 19 | 21 | <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoBxDetailServiceFacade" id="tTInfoBxDetailServiceFacadeImpl" check="false" /> | ... | ... |