Commit 7f11e6479a1bd9df8dd9ec5a51242acfaa1b69de

Authored by 王通
1 parent 918d4e65

1.易被攻击代码修复

src/main/java/com/bsth/server_ws/park_station/CompanyServiceSoap.java
1   -package com.bsth.server_ws.park_station;
2   -
3   -import com.bsth.entity.OilInfo;
4   -import com.bsth.entity.SchedulePlanInfo;
5   -import com.bsth.entity.ScheduleRealInfo;
6   -import com.bsth.server_ws.util.Constants;
7   -import com.bsth.server_ws.util.ControlHttpUtils;
8   -import com.bsth.server_ws.util.WSDataConver;
9   -import org.slf4j.Logger;
10   -import org.slf4j.LoggerFactory;
11   -import org.springframework.beans.factory.annotation.Autowired;
12   -import org.springframework.jdbc.core.BeanPropertyRowMapper;
13   -import org.springframework.jdbc.core.JdbcTemplate;
14   -import org.springframework.stereotype.Component;
15   -
16   -import javax.jws.WebMethod;
17   -import javax.jws.WebService;
18   -import javax.xml.ws.Holder;
19   -import java.util.List;
20   -
21   -/**
22   - * 场站数据接口
23   - * BS调度系统webservice接口实现,完美兼容老系统接口格式
24   - * Created by panzhao on 2017/3/10.
25   - */
26   -@Component
27   -@WebService(
28   - name = "CompanyServiceSoap",
29   - portName = "CompanyServiceSoap",
30   - serviceName = "CompanyService",
31   - targetNamespace = "http://control.bsth.com/",
32   - endpointInterface = "com.bsth.server_ws.park_station.CompanyService")
33   -public class CompanyServiceSoap implements CompanyService {
34   -
35   -
36   - Logger logger = LoggerFactory.getLogger(this.getClass());
37   -
38   - @Autowired
39   - JdbcTemplate jdbcTemplate;
40   -
41   - @Override
42   - @WebMethod
43   - public boolean returnCCInfo(String password, String companyId, String rq, javax.xml.ws.Holder<String[]> result, javax.xml.ws.Holder<String> fError) {
44   - if(!password.equals(Constants.OLD_SYS_PASSWORD)){
45   - fError.value = "密码有误!";
46   - return false;
47   - }
48   -
49   - List<ScheduleRealInfo> list = null;
50   - try{
51   - //从调度系统获取数据
52   - list = ControlHttpUtils.returnJCCInfo(companyId, "out");
53   - }catch (Exception e){
54   - //访问调度系统异常,尝试从数据库获取
55   -
56   - }
57   - result.value = WSDataConver.to_returnJCCInfo(list);
58   -
59   - //不再代理老接口数据
60   - /*if(!WebServiceProxy.isAllNew(companyId)){
61   - String[] oldArray = OldWSClient.returnCCInfo(companyId, rq);
62   - //合并新老系统的数据
63   - result.value = WebServiceProxy.mergerJccData(result.value, oldArray, companyId);
64   - }*/
65   - return true;
66   - }
67   -
68   - @Override
69   - @WebMethod
70   - public boolean returnJCInfo(String password, String companyId, String rq, Holder<String[]> result, Holder<String> fError) {
71   - if(!password.equals(Constants.OLD_SYS_PASSWORD)){
72   - fError.value = "密码有误!";
73   - return false;
74   - }
75   -
76   - List<ScheduleRealInfo> list = null;
77   - try{
78   - //从调度系统获取数据
79   - list = ControlHttpUtils.returnJCCInfo(companyId, "in");
80   - }catch (Exception e){
81   - //访问调度系统异常,尝试从数据库获取
82   -
83   - }
84   - result.value = WSDataConver.to_returnJCCInfo(list);
85   -
86   - //不再代理老接口数据
87   - /*if(!WebServiceProxy.isAllNew(companyId)){
88   - String[] oldArray = OldWSClient.returnJCInfo(companyId, rq);
89   - //合并新老系统的数据
90   - result.value = WebServiceProxy.mergerJccData(result.value, oldArray, companyId);
91   - }*/
92   -
93   - return true;
94   - }
95   -
96   - @Override
97   - @WebMethod
98   - public boolean getCurrentDayPlan(String ip, String userName, String password, String workId, String company, Holder<String[]> result, Holder<String> fError) {
99   - try{
100   - logger.info("getCurrentDayPlan workId: " + workId);
101   - List<ScheduleRealInfo> list = null;
102   - try{
103   - //从调度系统获取数据
104   - list = ControlHttpUtils.getCurrentDayPlan(company, workId);
105   - logger.info("从调度系统获取到数据 size: " + list.size());
106   - }catch (Exception e){
107   - //访问调度系统异常,尝试从数据库获取
108   - logger.error("", e);
109   - }
110   - result.value = WSDataConver.to_getCurrentDayPlan(list);
111   - }catch(Exception e){
112   - fError.value = e.getMessage();
113   - logger.error("", e);
114   - }
115   - return false;
116   - }
117   -
118   - @Override
119   - public boolean getLSLC_PB(String ip, String userName, String password, String month, String workId, String company, Holder<String[]> result, Holder<String> fError) {
120   - try{
121   - //实际排班
122   - List<ScheduleRealInfo> schList =
123   - jdbcTemplate.query("select * from bsth_c_s_sp_info_real where gs_bm='"+company+"' and j_gh='"+workId+"' and schedule_date_str like '"+month+"-%'",
124   - BeanPropertyRowMapper.newInstance(ScheduleRealInfo.class));
125   -
126   - //计划排班
127   - List<SchedulePlanInfo> planList =
128   - jdbcTemplate.query("select * from bsth_c_s_sp_info where gs_bm='"+company+"' and j_gh='"+workId+"' and schedule_date>sysdate() and schedule_date like '"+month+"-%' order by bcs",
129   - BeanPropertyRowMapper.newInstance(SchedulePlanInfo.class));
130   -
131   - //油耗
132   - List<OilInfo> oilList =
133   - jdbcTemplate.query("select * from bsth_c_ylb where jsy='"+workId+"' and rq like '"+month+"-%'",
134   - BeanPropertyRowMapper.newInstance(OilInfo.class));
135   -
136   - result.value = WSDataConver.to_getLSLC_PB(month, schList, oilList, planList);
137   - }catch(Exception e){
138   - fError.value = e.getMessage();
139   - logger.error("", e);
140   - }
141   - return false;
142   - }
143   -}
  1 +package com.bsth.server_ws.park_station;
  2 +
  3 +import com.bsth.entity.OilInfo;
  4 +import com.bsth.entity.SchedulePlanInfo;
  5 +import com.bsth.entity.ScheduleRealInfo;
  6 +import com.bsth.server_ws.util.Constants;
  7 +import com.bsth.server_ws.util.ControlHttpUtils;
  8 +import com.bsth.server_ws.util.WSDataConver;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  13 +import org.springframework.jdbc.core.JdbcTemplate;
  14 +import org.springframework.stereotype.Component;
  15 +
  16 +import javax.jws.WebMethod;
  17 +import javax.jws.WebService;
  18 +import javax.xml.ws.Holder;
  19 +import java.util.List;
  20 +
  21 +/**
  22 + * 场站数据接口
  23 + * BS调度系统webservice接口实现,完美兼容老系统接口格式
  24 + * Created by panzhao on 2017/3/10.
  25 + */
  26 +@Component
  27 +@WebService(
  28 + name = "CompanyServiceSoap",
  29 + portName = "CompanyServiceSoap",
  30 + serviceName = "CompanyService",
  31 + targetNamespace = "http://control.bsth.com/",
  32 + endpointInterface = "com.bsth.server_ws.park_station.CompanyService")
  33 +public class CompanyServiceSoap implements CompanyService {
  34 +
  35 +
  36 + Logger logger = LoggerFactory.getLogger(this.getClass());
  37 +
  38 + @Autowired
  39 + JdbcTemplate jdbcTemplate;
  40 +
  41 + @Override
  42 + @WebMethod
  43 + public boolean returnCCInfo(String password, String companyId, String rq, javax.xml.ws.Holder<String[]> result, javax.xml.ws.Holder<String> fError) {
  44 + if(!password.equals(Constants.OLD_SYS_PASSWORD)){
  45 + fError.value = "无效密码";
  46 + return false;
  47 + }
  48 +
  49 + List<ScheduleRealInfo> list = null;
  50 + try{
  51 + //从调度系统获取数据
  52 + list = ControlHttpUtils.returnJCCInfo(companyId, "out");
  53 + }catch (Exception e){
  54 + //访问调度系统异常,尝试从数据库获取
  55 +
  56 + }
  57 + result.value = WSDataConver.to_returnJCCInfo(list);
  58 +
  59 + //不再代理老接口数据
  60 + /*if(!WebServiceProxy.isAllNew(companyId)){
  61 + String[] oldArray = OldWSClient.returnCCInfo(companyId, rq);
  62 + //合并新老系统的数据
  63 + result.value = WebServiceProxy.mergerJccData(result.value, oldArray, companyId);
  64 + }*/
  65 + return true;
  66 + }
  67 +
  68 + @Override
  69 + @WebMethod
  70 + public boolean returnJCInfo(String password, String companyId, String rq, Holder<String[]> result, Holder<String> fError) {
  71 + if(!password.equals(Constants.OLD_SYS_PASSWORD)){
  72 + fError.value = "无效密码";
  73 + return false;
  74 + }
  75 +
  76 + List<ScheduleRealInfo> list = null;
  77 + try{
  78 + //从调度系统获取数据
  79 + list = ControlHttpUtils.returnJCCInfo(companyId, "in");
  80 + }catch (Exception e){
  81 + //访问调度系统异常,尝试从数据库获取
  82 +
  83 + }
  84 + result.value = WSDataConver.to_returnJCCInfo(list);
  85 +
  86 + //不再代理老接口数据
  87 + /*if(!WebServiceProxy.isAllNew(companyId)){
  88 + String[] oldArray = OldWSClient.returnJCInfo(companyId, rq);
  89 + //合并新老系统的数据
  90 + result.value = WebServiceProxy.mergerJccData(result.value, oldArray, companyId);
  91 + }*/
  92 +
  93 + return true;
  94 + }
  95 +
  96 + @Override
  97 + @WebMethod
  98 + public boolean getCurrentDayPlan(String ip, String userName, String password, String workId, String company, Holder<String[]> result, Holder<String> fError) {
  99 + if(!password.equals(Constants.OLD_SYS_PASSWORD)){
  100 + fError.value = "无效密码";
  101 + return false;
  102 + }
  103 +
  104 + try{
  105 + logger.info("getCurrentDayPlan workId: " + workId);
  106 + List<ScheduleRealInfo> list = null;
  107 + try{
  108 + //从调度系统获取数据
  109 + list = ControlHttpUtils.getCurrentDayPlan(company, workId);
  110 + logger.info("从调度系统获取到数据 size: " + list.size());
  111 + }catch (Exception e){
  112 + //访问调度系统异常,尝试从数据库获取
  113 + logger.error("", e);
  114 + }
  115 + result.value = WSDataConver.to_getCurrentDayPlan(list);
  116 + }catch(Exception e){
  117 + fError.value = e.getMessage();
  118 + logger.error("", e);
  119 + }
  120 + return false;
  121 + }
  122 +
  123 + @Override
  124 + public boolean getLSLC_PB(String ip, String userName, String password, String month, String workId, String company, Holder<String[]> result, Holder<String> fError) {
  125 + if(!password.equals(Constants.OLD_SYS_PASSWORD)){
  126 + fError.value = "无效密码";
  127 + return false;
  128 + }
  129 +
  130 + try{
  131 + //实际排班
  132 + List<ScheduleRealInfo> schList =
  133 + jdbcTemplate.query("select * from bsth_c_s_sp_info_real where gs_bm= ? and j_gh= ? and schedule_date_str like concat(? '-%')", new Object[]{ company, workId, month },
  134 + BeanPropertyRowMapper.newInstance(ScheduleRealInfo.class));
  135 +
  136 + //计划排班
  137 + List<SchedulePlanInfo> planList =
  138 + jdbcTemplate.query("select * from bsth_c_s_sp_info where gs_bm= ? and j_gh= ? and schedule_date>sysdate() and schedule_date like concat(? '-%') order by bcs", new Object[]{ company, workId, month },
  139 + BeanPropertyRowMapper.newInstance(SchedulePlanInfo.class));
  140 +
  141 + //油耗
  142 + List<OilInfo> oilList =
  143 + jdbcTemplate.query("select * from bsth_c_ylb where jsy= ? and rq like concat(? '-%')", new Object[]{ workId, month },
  144 + BeanPropertyRowMapper.newInstance(OilInfo.class));
  145 +
  146 + result.value = WSDataConver.to_getLSLC_PB(month, schList, oilList, planList);
  147 + }catch(Exception e){
  148 + fError.value = e.getMessage();
  149 + logger.error("", e);
  150 + }
  151 + return false;
  152 + }
  153 +}
... ...
src/main/resources/ms-jdbc.properties
1   -#ms.mysql.driver= com.mysql.jdbc.Driver
2   -#ms.mysql.url= jdbc:mysql://127.0.0.1:3306/ms?useUnicode=true&characterEncoding=utf-8
3   -#ms.mysql.username= root
4   -#ms.mysql.password= panzhao
5   -
6   -ms.mysql.driver= com.mysql.jdbc.Driver
7   -ms.mysql.url= jdbc:mysql://10.10.200.226:3306/ms?useUnicode=true&characterEncoding=utf-8
8   -ms.mysql.username= root
  1 +#ms.mysql.driver= com.mysql.jdbc.Driver
  2 +#ms.mysql.url= jdbc:mysql://127.0.0.1:3306/ms?useUnicode=true&characterEncoding=utf-8
  3 +#ms.mysql.username= root
  4 +#ms.mysql.password= panzhao
  5 +
  6 +ms.mysql.driver= com.mysql.jdbc.Driver
  7 +ms.mysql.url= jdbc:mysql://192.170.100.63/ms?useUnicode=true&characterEncoding=utf-8
  8 +ms.mysql.username= root
9 9 ms.mysql.password= root2jsp
10 10 \ No newline at end of file
... ...