Commit 0ab5256aff7260aee73657ae4941de5aaad3b29d

Authored by 徐烜
1 parent b763a379

iss提交13:

1、修改SchedulePlanController_facade内部调用,使用暴露的tcc排班生成服务
2、删除application_dubbo_consumer.xml文件,已经使用了自定义auto config类了(bsth-control_v2-plan_module-common-config)
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.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.service.BServiceFacade;
8   -import com.bsth.control_v2.plan_module.common.service.schedule.PlanGenerateFacade;
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   - @Reference
34   - private PlanGenerateFacade planGenerateFacade;
35   -
36   - @Override
37   - protected BServiceFacade<Long, PlanDto> getBServiceFacade() {
38   - return planServiceFacade;
39   - }
40   -
41   - /**
42   - * 创建指定线路,指定时间范围内的排班计划,使用的时刻表情况
43   - * @param xlid 线路id
44   - * @param from 开始时间
45   - * @param to 结束时间
46   - * @return
47   - * @throws Exception
48   - */
49   - @RequestMapping(value = "/valttinfo/{xlid}/{from}/{to}", method = RequestMethod.GET)
50   - public Map<String, Object> validateTTInfo(
51   - @PathVariable(value = "xlid") Integer xlid,
52   - @PathVariable(value = "from") Date from,
53   - @PathVariable(value = "to") Date to
54   - ) throws Exception {
55   - Map<String, Object> rtn = new HashMap<>();
56   - rtn.put("status", ResponseCode.SUCCESS);
57   - rtn.put("data", planPreValidateFacade.validateTTInfo(xlid, from, to));
58   - return rtn;
59   - }
60   -
61   - /**
62   - * 验证排班计划时间范围内规则的正确性。
63   - * @return
64   - * @throws Exception
65   - */
66   - @RequestMapping(value = "/valttrule/{xlid}/{from}/{to}", method = RequestMethod.GET)
67   - public Map<String, Object> validateRule(
68   - @PathVariable(value = "xlid") Integer xlid,
69   - @PathVariable(value = "from") Date from,
70   - @PathVariable(value = "to") Date to
71   - ) throws Exception {
72   - Map<String, Object> rtn = new HashMap<>();
73   - rtn.put("status", ResponseCode.SUCCESS);
74   - rtn.put("data", planPreValidateFacade.validateRule(xlid, from, to));
75   - return rtn;
76   - }
77   -
78   - @Override
79   - protected boolean isSaveExtend() {
80   - return true;
81   - }
82   -
83   - /**
84   - * 生成排班计划。
85   - * @param planDto
86   - * @return
87   - */
88   - @Override
89   - protected PlanDto saveExtend(PlanDto planDto) {
90   -// planGenerateFacade.generatePlan(planDto);
91   - return planDto;
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   -}
  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.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.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 +
  31 + @Override
  32 + protected BServiceFacade<Long, PlanDto> getBServiceFacade() {
  33 + return planServiceFacade;
  34 + }
  35 +
  36 + /**
  37 + * 创建指定线路,指定时间范围内的排班计划,使用的时刻表情况
  38 + * @param xlid 线路id
  39 + * @param from 开始时间
  40 + * @param to 结束时间
  41 + * @return
  42 + * @throws Exception
  43 + */
  44 + @RequestMapping(value = "/valttinfo/{xlid}/{from}/{to}", method = RequestMethod.GET)
  45 + public Map<String, Object> validateTTInfo(
  46 + @PathVariable(value = "xlid") Integer xlid,
  47 + @PathVariable(value = "from") Date from,
  48 + @PathVariable(value = "to") Date to
  49 + ) throws Exception {
  50 + Map<String, Object> rtn = new HashMap<>();
  51 + rtn.put("status", ResponseCode.SUCCESS);
  52 + rtn.put("data", planPreValidateFacade.validateTTInfo(xlid, from, to));
  53 + return rtn;
  54 + }
  55 +
  56 + /**
  57 + * 验证排班计划时间范围内规则的正确性。
  58 + * @return
  59 + * @throws Exception
  60 + */
  61 + @RequestMapping(value = "/valttrule/{xlid}/{from}/{to}", method = RequestMethod.GET)
  62 + public Map<String, Object> validateRule(
  63 + @PathVariable(value = "xlid") Integer xlid,
  64 + @PathVariable(value = "from") Date from,
  65 + @PathVariable(value = "to") Date to
  66 + ) throws Exception {
  67 + Map<String, Object> rtn = new HashMap<>();
  68 + rtn.put("status", ResponseCode.SUCCESS);
  69 + rtn.put("data", planPreValidateFacade.validateRule(xlid, from, to));
  70 + return rtn;
  71 + }
  72 +
  73 + @Override
  74 + protected boolean isSaveExtend() {
  75 + return true;
  76 + }
  77 +
  78 + /**
  79 + * 生成排班计划。
  80 + * @param planDto
  81 + * @return
  82 + */
  83 + @Override
  84 + protected PlanDto saveExtend(PlanDto planDto) {
  85 + planServiceFacade.planSaveTCC_m(planDto);
  86 + return planDto;
  87 + }
  88 +
  89 + @Override
  90 + public void setCreateUserInfo(PlanDto planDto, Integer userId, Date createDate) {
  91 + UserDto userDto = UserDto.getBuilder()
  92 + .setId(userId)
  93 + .build();
  94 + planDto.setCreateBy(userDto);
  95 + planDto.setCreateDate(createDate);
  96 + }
  97 +
  98 + @Override
  99 + public void setUpdateUserInfo(PlanDto planDto, Integer userId, Date updateDate) {
  100 + UserDto userDto = UserDto.getBuilder()
  101 + .setId(userId)
  102 + .build();
  103 + planDto.setUpdateBy(userDto);
  104 + planDto.setUpdateDate(updateDate);
  105 + }
  106 +
  107 + //------------------------- 以下是还未服务话的功能 --------------------------//
  108 + @Autowired
  109 + private SchedulePlanService schedulePlanService;
  110 +
  111 + /**
  112 + * 获取明天的一歌排班计划。
  113 + * @return
  114 + * @throws Exception
  115 + */
  116 + @RequestMapping(value = "/tommorw", method = RequestMethod.GET)
  117 + public SchedulePlan getTommorwPlan() throws Exception {
  118 + try {
  119 + return schedulePlanService.findSchedulePlanTommorw();
  120 + } catch (Exception exp) {
  121 + throw new Exception(exp.getCause());
  122 + }
  123 + }
  124 +}
... ...
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_v_multi_service" />
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.baseinfo.PersonnelServiceFacade" id="personnelServiceFacadeImpl" check="false" />
17   - <!-- 车辆信息服务 -->
18   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.baseinfo.CarServiceFacade" id="carServiceFacadeImpl" check="false" />
19   - <!-- 车辆设备信息服务 -->
20   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.baseinfo.CarDeviceServiceFacade" id="carDeviceServiceFacadeImpl" check="false" />
21   -
22   - <!-- 车辆配置信息服务 -->
23   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.config.VehicleConfigServiceFacade" id="vehicleConfigServiceFacadeImpl" check="false" />
24   - <!-- 人员配置信息服务 -->
25   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.config.EmployeeConfigServiceFacade" id="employeeConfigServiceFacadeImpl" check="false" />
26   - <!-- 路牌配置信息服务 -->
27   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.config.LpConfigServiceFacade" id="lpConfigServiceFacadeImpl" check="false" />
28   - <!-- flat规则配置信息服务 -->
29   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.rule.FlatRuleConfigServiceFacade" id="flatRuleConfigServiceFacadeImpl" check="false" />
30   - <!-- rerun规则配置信息服务 -->
31   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.rule.RerunRuleConfigServiceFacade" id="rerunRuleConfigServiceFacadeImpl" check="false" />
32   -
33   - <!-- 时刻表班型明细服务 -->
34   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoBxDetailServiceFacade" id="tTInfoBxDetailServiceFacadeImpl" check="false" />
35   - <!-- 时刻表明细服务 -->
36   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoDetailServiceFacade" id="tTInfoDetailServiceFacadeImpl" check="false" />
37   - <!-- 时刻表服务 -->
38   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.timetable.TTInfoServiceFacade" id="tTInfoServiceFacadeImpl" check="false" />
39   - <!-- 日志服务 -->
40   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.log.LogServiceFacade" id="logServiceFacadeImpl" check="false" />
41   -
42   - <!-- 排班计划查询服务 -->
43   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.PlanServiceFacade" id="planServiceFacadeImpl" check="false" />
44   - <!-- 排班明细查询服务 -->
45   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.PlanInfoServiceFacade" id="planInfoServiceFacadeImpl" check="false" />
46   - <!-- 排班前置验证服务 -->
47   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.validate.PlanPreValidateFacade" id="planPreValidateFacadeImpl" check="false" />
48   - <!-- 排班生成服务 -->
49   - <dubbo:reference interface="com.bsth.control_v2.plan_module.common.service.schedule.PlanGenerateFacade" ref="planGenerateFacadeImpl" check="false" />
50   -
51   -</beans>