Commit 371f63f3f68bdb332b62e2876a18478d5933b082

Authored by 徐烜
2 parents 69d6081d a5718c4c

Merge branch 'pudong' of http://222.66.0.204:8090//panzhaov5/bsth_control into pudong

src/main/java/com/bsth/entity/schedule/log/ModuleOperatorLog.java
1   -package com.bsth.entity.schedule.log;
2   -
3   -import com.bsth.control_v2.plan_module.common.enums.log.ModuleOperatorType;
4   -import com.bsth.control_v2.plan_module.common.enums.log.ModuleType;
5   -import com.bsth.control_v2.plan_module.common.enums.log.OperatorType;
6   -import com.bsth.entity.schedule.log.convert.ModuleOperatorTypeConverter;
7   -import com.bsth.entity.schedule.log.convert.ModuleTypeConverter;
8   -import com.bsth.entity.schedule.log.convert.OperatorTypeConverter;
9   -
10   -import javax.persistence.*;
11   -import java.io.Serializable;
12   -import java.util.Date;
13   -
14   -/**
15   - * 模块业务操作日志。
16   - */
17   -@Entity
18   -@Table(name = "bsth_c_s_op_log")
19   -public class ModuleOperatorLog implements Serializable {
20   -
21   - /** 主键Id */
22   - @Id
23   - @GeneratedValue
24   - private Long id;
25   -
26   - /** 日志插入时间 */
27   - @Column(nullable = false)
28   - private Long timestmp;
29   -
30   - /** 模块类型 */
31   - @Column(nullable = false)
32   - @Convert(converter = ModuleTypeConverter.class)
33   - private ModuleType moduleType;
34   -
35   - @Column(nullable = false)
36   - @Convert(converter = OperatorTypeConverter.class)
37   - private OperatorType operatorType;
38   -
39   - /** 模块操作类型 */
40   - @Column(nullable = false)
41   - @Convert(converter = ModuleOperatorTypeConverter.class)
42   - private ModuleOperatorType moduleOperatorType;
43   -
44   - /** 日志描述 */
45   - @Column(nullable = false)
46   - private String message;
47   -
48   - /** 日志级别 */
49   - @Column(nullable = false)
50   - private String levelName;
51   - /** 模块业务操作开始时间 */
52   - @Column(nullable = false)
53   - private Date opStartTime;
54   - /** 模块业务操作结束时间 */
55   - @Column(nullable = false)
56   - private Date opEndTime;
57   - /** 模块业务操作人姓名 */
58   - @Column(nullable = false)
59   - private String opUserName;
60   - /** 模块业务操作人工号 */
61   - @Column(nullable = false)
62   - private String opUserCode;
63   - /** 关联的实体class名 */
64   - @Column(nullable = false)
65   - private String opEntityClass;
66   - /** 操作前的实体json */
67   - @Column(nullable = false)
68   - private String opBeforeJson;
69   - /** 操作后的实体json */
70   - @Column(nullable = false)
71   - private String opAfterJson;
72   -
73   - /** 备用-可选参数1 */
74   - private String optArg1;
75   - /** 备用-可选参数2 */
76   - private String optArg2;
77   - /** 备用-可选参数3 */
78   - private String optArg3;
79   -
80   - //------------- 客户端信息 -------------//
81   - /** 客户端Ip */
82   - private String clientIp;
83   - /** 客户端游览器 */
84   - private String clientBowser;
85   - /** 客户端主机信息 */
86   - private String clientSystem;
87   - /** 获取mac地址 */
88   - private String clientMacAddress;
89   -
90   - public Long getId() {
91   - return id;
92   - }
93   -
94   - public void setId(Long id) {
95   - this.id = id;
96   - }
97   -
98   - public Long getTimestmp() {
99   - return timestmp;
100   - }
101   -
102   - public void setTimestmp(Long timestmp) {
103   - this.timestmp = timestmp;
104   - }
105   -
106   - public ModuleType getModuleType() {
107   - return moduleType;
108   - }
109   -
110   - public void setModuleType(ModuleType moduleType) {
111   - this.moduleType = moduleType;
112   - }
113   -
114   - public OperatorType getOperatorType() {
115   - return operatorType;
116   - }
117   -
118   - public void setOperatorType(OperatorType operatorType) {
119   - this.operatorType = operatorType;
120   - }
121   -
122   - public ModuleOperatorType getModuleOperatorType() {
123   - return moduleOperatorType;
124   - }
125   -
126   - public void setModuleOperatorType(ModuleOperatorType moduleOperatorType) {
127   - this.moduleOperatorType = moduleOperatorType;
128   - }
129   -
130   - public String getMessage() {
131   - return message;
132   - }
133   -
134   - public void setMessage(String message) {
135   - this.message = message;
136   - }
137   -
138   - public String getLevelName() {
139   - return levelName;
140   - }
141   -
142   - public void setLevelName(String levelName) {
143   - this.levelName = levelName;
144   - }
145   -
146   - public Date getOpStartTime() {
147   - return opStartTime;
148   - }
149   -
150   - public void setOpStartTime(Date opStartTime) {
151   - this.opStartTime = opStartTime;
152   - }
153   -
154   - public Date getOpEndTime() {
155   - return opEndTime;
156   - }
157   -
158   - public void setOpEndTime(Date opEndTime) {
159   - this.opEndTime = opEndTime;
160   - }
161   -
162   - public String getOpUserName() {
163   - return opUserName;
164   - }
165   -
166   - public void setOpUserName(String opUserName) {
167   - this.opUserName = opUserName;
168   - }
169   -
170   - public String getOpUserCode() {
171   - return opUserCode;
172   - }
173   -
174   - public void setOpUserCode(String opUserCode) {
175   - this.opUserCode = opUserCode;
176   - }
177   -
178   - public String getOpEntityClass() {
179   - return opEntityClass;
180   - }
181   -
182   - public void setOpEntityClass(String opEntityClass) {
183   - this.opEntityClass = opEntityClass;
184   - }
185   -
186   - public String getOpBeforeJson() {
187   - return opBeforeJson;
188   - }
189   -
190   - public void setOpBeforeJson(String opBeforeJson) {
191   - this.opBeforeJson = opBeforeJson;
192   - }
193   -
194   - public String getOpAfterJson() {
195   - return opAfterJson;
196   - }
197   -
198   - public void setOpAfterJson(String opAfterJson) {
199   - this.opAfterJson = opAfterJson;
200   - }
201   -
202   - public String getOptArg1() {
203   - return optArg1;
204   - }
205   -
206   - public void setOptArg1(String optArg1) {
207   - this.optArg1 = optArg1;
208   - }
209   -
210   - public String getOptArg2() {
211   - return optArg2;
212   - }
213   -
214   - public void setOptArg2(String optArg2) {
215   - this.optArg2 = optArg2;
216   - }
217   -
218   - public String getOptArg3() {
219   - return optArg3;
220   - }
221   -
222   - public void setOptArg3(String optArg3) {
223   - this.optArg3 = optArg3;
224   - }
225   -
226   - public String getClientIp() {
227   - return clientIp;
228   - }
229   -
230   - public void setClientIp(String clientIp) {
231   - this.clientIp = clientIp;
232   - }
233   -
234   - public String getClientBowser() {
235   - return clientBowser;
236   - }
237   -
238   - public void setClientBowser(String clientBowser) {
239   - this.clientBowser = clientBowser;
240   - }
241   -
242   - public String getClientSystem() {
243   - return clientSystem;
244   - }
245   -
246   - public void setClientSystem(String clientSystem) {
247   - this.clientSystem = clientSystem;
248   - }
249   -
250   - public String getClientMacAddress() {
251   - return clientMacAddress;
252   - }
253   -
254   - public void setClientMacAddress(String clientMacAddress) {
255   - this.clientMacAddress = clientMacAddress;
256   - }
257   -}
  1 +package com.bsth.entity.schedule.log;
  2 +
  3 +import com.bsth.control_v2.plan_module.common.enums.log.ModuleOperatorType;
  4 +import com.bsth.control_v2.plan_module.common.enums.log.ModuleType;
  5 +import com.bsth.control_v2.plan_module.common.enums.log.OperatorType;
  6 +import com.bsth.entity.schedule.log.convert.ModuleOperatorTypeConverter;
  7 +import com.bsth.entity.schedule.log.convert.ModuleTypeConverter;
  8 +import com.bsth.entity.schedule.log.convert.OperatorTypeConverter;
  9 +
  10 +import javax.persistence.*;
  11 +import java.io.Serializable;
  12 +import java.util.Date;
  13 +
  14 +/**
  15 + * 模块业务操作日志。
  16 + */
  17 +@Entity
  18 +@Table(name = "bsth_c_s_op_log")
  19 +public class ModuleOperatorLog implements Serializable {
  20 +
  21 + /** 主键Id */
  22 + @Id
  23 + @GeneratedValue
  24 + private Long id;
  25 +
  26 + /** 日志插入时间 */
  27 + @Column(nullable = false)
  28 + private Long timestmp;
  29 +
  30 + /** 模块类型 */
  31 + @Column(nullable = false)
  32 + @Convert(converter = ModuleTypeConverter.class)
  33 + private ModuleType moduleType;
  34 +
  35 + @Column(nullable = false)
  36 + @Convert(converter = OperatorTypeConverter.class)
  37 + private OperatorType operatorType;
  38 +
  39 + /** 模块操作类型 */
  40 + @Column(nullable = false)
  41 + @Convert(converter = ModuleOperatorTypeConverter.class)
  42 + private ModuleOperatorType moduleOperatorType;
  43 +
  44 + /** 日志描述 */
  45 + @Column(nullable = false)
  46 + private String message;
  47 +
  48 + /** 日志级别 */
  49 + @Column(nullable = false)
  50 + private String levelName;
  51 + /** 模块业务操作开始时间 */
  52 + @Column(nullable = false)
  53 + private Date opStartTime;
  54 + /** 模块业务操作结束时间 */
  55 + @Column(nullable = false)
  56 + private Date opEndTime;
  57 + /** 模块业务操作人姓名 */
  58 + @Column(nullable = false)
  59 + private String opUserName;
  60 + /** 模块业务操作人工号 */
  61 + @Column(nullable = false)
  62 + private String opUserCode;
  63 + /** 关联的实体class名 */
  64 + @Column(nullable = false)
  65 + private String opEntityClass;
  66 + /** 操作前的实体json */
  67 + @Column(nullable = false)
  68 + private String opBeforeJson;
  69 + /** 操作后的实体json */
  70 + @Column(nullable = false)
  71 + private String opAfterJson;
  72 +
  73 + /** 备用-可选参数1 */
  74 + private String optArg1;
  75 + /** 备用-可选参数2 */
  76 + private String optArg2;
  77 + /** 备用-可选参数3 */
  78 + private String optArg3;
  79 +
  80 + //------------- 客户端信息 -------------//
  81 + /** 客户端Ip */
  82 + private String clientIp;
  83 + /** 客户端游览器 */
  84 + private String clientBowser;
  85 + /** 客户端主机信息 */
  86 + private String clientSystem;
  87 + /** 获取mac地址 */
  88 + private String clientMacAddress;
  89 +
  90 + public Long getId() {
  91 + return id;
  92 + }
  93 +
  94 + public void setId(Long id) {
  95 + this.id = id;
  96 + }
  97 +
  98 + public Long getTimestmp() {
  99 + return timestmp;
  100 + }
  101 +
  102 + public void setTimestmp(Long timestmp) {
  103 + this.timestmp = timestmp;
  104 + }
  105 +
  106 + public ModuleType getModuleType() {
  107 + return moduleType;
  108 + }
  109 +
  110 + public void setModuleType(ModuleType moduleType) {
  111 + this.moduleType = moduleType;
  112 + }
  113 +
  114 + public OperatorType getOperatorType() {
  115 + return operatorType;
  116 + }
  117 +
  118 + public void setOperatorType(OperatorType operatorType) {
  119 + this.operatorType = operatorType;
  120 + }
  121 +
  122 + public ModuleOperatorType getModuleOperatorType() {
  123 + return moduleOperatorType;
  124 + }
  125 +
  126 + public void setModuleOperatorType(ModuleOperatorType moduleOperatorType) {
  127 + this.moduleOperatorType = moduleOperatorType;
  128 + }
  129 +
  130 + public String getMessage() {
  131 + return message;
  132 + }
  133 +
  134 + public void setMessage(String message) {
  135 + this.message = message;
  136 + }
  137 +
  138 + public String getLevelName() {
  139 + return levelName;
  140 + }
  141 +
  142 + public void setLevelName(String levelName) {
  143 + this.levelName = levelName;
  144 + }
  145 +
  146 + public Date getOpStartTime() {
  147 + return opStartTime;
  148 + }
  149 +
  150 + public void setOpStartTime(Date opStartTime) {
  151 + this.opStartTime = opStartTime;
  152 + }
  153 +
  154 + public Date getOpEndTime() {
  155 + return opEndTime;
  156 + }
  157 +
  158 + public void setOpEndTime(Date opEndTime) {
  159 + this.opEndTime = opEndTime;
  160 + }
  161 +
  162 + public String getOpUserName() {
  163 + return opUserName;
  164 + }
  165 +
  166 + public void setOpUserName(String opUserName) {
  167 + this.opUserName = opUserName;
  168 + }
  169 +
  170 + public String getOpUserCode() {
  171 + return opUserCode;
  172 + }
  173 +
  174 + public void setOpUserCode(String opUserCode) {
  175 + this.opUserCode = opUserCode;
  176 + }
  177 +
  178 + public String getOpEntityClass() {
  179 + return opEntityClass;
  180 + }
  181 +
  182 + public void setOpEntityClass(String opEntityClass) {
  183 + this.opEntityClass = opEntityClass;
  184 + }
  185 +
  186 + public String getOpBeforeJson() {
  187 + return opBeforeJson;
  188 + }
  189 +
  190 + public void setOpBeforeJson(String opBeforeJson) {
  191 + this.opBeforeJson = opBeforeJson;
  192 + }
  193 +
  194 + public String getOpAfterJson() {
  195 + return opAfterJson;
  196 + }
  197 +
  198 + public void setOpAfterJson(String opAfterJson) {
  199 + this.opAfterJson = opAfterJson;
  200 + }
  201 +
  202 + public String getOptArg1() {
  203 + return optArg1;
  204 + }
  205 +
  206 + public void setOptArg1(String optArg1) {
  207 + this.optArg1 = optArg1;
  208 + }
  209 +
  210 + public String getOptArg2() {
  211 + return optArg2;
  212 + }
  213 +
  214 + public void setOptArg2(String optArg2) {
  215 + this.optArg2 = optArg2;
  216 + }
  217 +
  218 + public String getOptArg3() {
  219 + return optArg3;
  220 + }
  221 +
  222 + public void setOptArg3(String optArg3) {
  223 + this.optArg3 = optArg3;
  224 + }
  225 +
  226 + public String getClientIp() {
  227 + return clientIp;
  228 + }
  229 +
  230 + public void setClientIp(String clientIp) {
  231 + this.clientIp = clientIp;
  232 + }
  233 +
  234 + public String getClientBowser() {
  235 + return clientBowser;
  236 + }
  237 +
  238 + public void setClientBowser(String clientBowser) {
  239 + this.clientBowser = clientBowser;
  240 + }
  241 +
  242 + public String getClientSystem() {
  243 + return clientSystem;
  244 + }
  245 +
  246 + public void setClientSystem(String clientSystem) {
  247 + this.clientSystem = clientSystem;
  248 + }
  249 +
  250 + public String getClientMacAddress() {
  251 + return clientMacAddress;
  252 + }
  253 +
  254 + public void setClientMacAddress(String clientMacAddress) {
  255 + this.clientMacAddress = clientMacAddress;
  256 + }
  257 +}
... ...
src/main/java/com/bsth/entity/schedule/log/convert/ModuleOperatorTypeConverter.java
1   -package com.bsth.entity.schedule.log.convert;
2   -
3   -import com.bsth.control_v2.plan_module.common.enums.log.ModuleOperatorType;
4   -
5   -import javax.persistence.AttributeConverter;
6   -import javax.persistence.Convert;
7   -
8   -@Convert
9   -public class ModuleOperatorTypeConverter implements AttributeConverter<ModuleOperatorType, String> {
10   - @Override
11   - public String convertToDatabaseColumn(ModuleOperatorType attribute) {
12   - return attribute.getDicDesc();
13   - }
14   -
15   - @Override
16   - public ModuleOperatorType convertToEntityAttribute(String dbData) {
17   - return ModuleOperatorType.fromDicDesc(dbData);
18   - }
19   -}
  1 +package com.bsth.entity.schedule.log.convert;
  2 +
  3 +import com.bsth.control_v2.plan_module.common.enums.log.ModuleOperatorType;
  4 +
  5 +import javax.persistence.AttributeConverter;
  6 +import javax.persistence.Convert;
  7 +
  8 +@Convert
  9 +public class ModuleOperatorTypeConverter implements AttributeConverter<ModuleOperatorType, String> {
  10 + @Override
  11 + public String convertToDatabaseColumn(ModuleOperatorType attribute) {
  12 + return attribute.getDicDesc();
  13 + }
  14 +
  15 + @Override
  16 + public ModuleOperatorType convertToEntityAttribute(String dbData) {
  17 + return ModuleOperatorType.fromDicDesc(dbData);
  18 + }
  19 +}
... ...
src/main/java/com/bsth/entity/schedule/log/convert/ModuleTypeConverter.java
1   -package com.bsth.entity.schedule.log.convert;
2   -
3   -import com.bsth.control_v2.plan_module.common.enums.log.ModuleType;
4   -
5   -import javax.persistence.AttributeConverter;
6   -import javax.persistence.Convert;
7   -
8   -@Convert
9   -public class ModuleTypeConverter implements AttributeConverter<ModuleType, String> {
10   - @Override
11   - public String convertToDatabaseColumn(ModuleType attribute) {
12   - return attribute.getDicDesc();
13   - }
14   -
15   - @Override
16   - public ModuleType convertToEntityAttribute(String dbData) {
17   - return ModuleType.fromDicDesc(dbData);
18   - }
19   -}
  1 +package com.bsth.entity.schedule.log.convert;
  2 +
  3 +import com.bsth.control_v2.plan_module.common.enums.log.ModuleType;
  4 +
  5 +import javax.persistence.AttributeConverter;
  6 +import javax.persistence.Convert;
  7 +
  8 +@Convert
  9 +public class ModuleTypeConverter implements AttributeConverter<ModuleType, String> {
  10 + @Override
  11 + public String convertToDatabaseColumn(ModuleType attribute) {
  12 + return attribute.getDicDesc();
  13 + }
  14 +
  15 + @Override
  16 + public ModuleType convertToEntityAttribute(String dbData) {
  17 + return ModuleType.fromDicDesc(dbData);
  18 + }
  19 +}
... ...
src/main/java/com/bsth/entity/schedule/log/convert/OperatorTypeConverter.java
1   -package com.bsth.entity.schedule.log.convert;
2   -
3   -import com.bsth.control_v2.plan_module.common.enums.log.OperatorType;
4   -
5   -import javax.persistence.AttributeConverter;
6   -import javax.persistence.Convert;
7   -
8   -@Convert
9   -public class OperatorTypeConverter implements AttributeConverter<OperatorType, String> {
10   - @Override
11   - public String convertToDatabaseColumn(OperatorType attribute) {
12   - return attribute.getDicDesc();
13   - }
14   -
15   - @Override
16   - public OperatorType convertToEntityAttribute(String dbData) {
17   - return OperatorType.fromDicDesc(dbData);
18   - }
19   -}
  1 +package com.bsth.entity.schedule.log.convert;
  2 +
  3 +import com.bsth.control_v2.plan_module.common.enums.log.OperatorType;
  4 +
  5 +import javax.persistence.AttributeConverter;
  6 +import javax.persistence.Convert;
  7 +
  8 +@Convert
  9 +public class OperatorTypeConverter implements AttributeConverter<OperatorType, String> {
  10 + @Override
  11 + public String convertToDatabaseColumn(OperatorType attribute) {
  12 + return attribute.getDicDesc();
  13 + }
  14 +
  15 + @Override
  16 + public OperatorType convertToEntityAttribute(String dbData) {
  17 + return OperatorType.fromDicDesc(dbData);
  18 + }
  19 +}
... ...
src/main/java/com/bsth/service/calc/impl/CalcToolServiceImpl.java
... ... @@ -358,7 +358,6 @@ public class CalcToolServiceImpl implements CalcToolService {
358 358 t_.setDtbc(0);
359 359 t_.setDtbczgf(0);
360 360 t_.setDtbcwgf(0);
361   - list.add(t_);
362 361 list2.add(t_);
363 362 }
364 363 }
... ...
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
... ... @@ -12,6 +12,7 @@ import com.bsth.data.pilot80.PilotReport;
12 12 import com.bsth.data.safe_driv.SafeDriv;
13 13 import com.bsth.data.safe_driv.SafeDrivCenter;
14 14 import com.bsth.data.schedule.DayOfSchedule;
  15 +import com.bsth.entity.Line;
15 16 import com.bsth.entity.LineVersions;
16 17 import com.bsth.entity.directive.D80;
17 18 import com.bsth.entity.realcontrol.ScheduleRealInfo;
... ... @@ -252,14 +253,19 @@ public class GpsServiceImpl implements GpsService {
252 253 for(Map<String, Object> rs : dataList){
253 254 int index=dataList.indexOf(rs);
254 255 if (index< dataList.size()-1&&!map_get_str( rs,"LINE_ID").equals(map_get_str( dataList.get(index+1),"LINE_ID"))){
  256 +
  257 + Line cLine =lineRepository.findOne(Integer.valueOf(map_get_str( rs,"LINE_ID")));
  258 + Line nextLine =lineRepository.findOne(Integer.valueOf(map_get_str( dataList.get(index+1),"LINE_ID")));
  259 + if (cLine!=null&&nextLine!=null){
255 260 Map<String,Object> LSmap=new HashMap<>();
256   - String name=lineRepository.findOne(Integer.valueOf(map_get_str( rs,"LINE_ID"))).getName();
257   - String NextName=lineRepository.findOne(Integer.valueOf(map_get_str( dataList.get(index+1),"LINE_ID"))).getName();
  261 + String name=cLine.getName();
  262 + String NextName=nextLine.getName();
258 263 LSmap.put("abnormalType","linesSwitch");
259 264 LSmap.put("line_line",name+"-->"+NextName);
260 265 LSmap.put("st",map_get_long(rs, "TS"));
261 266 LSmap.put("et",index== dataList.size()-1?map_get_long(rs, "TS"):map_get_long( dataList.get(index+1), "TS"));
262 267 lineSwitch.add(LSmap);
  268 + }
263 269 }
264 270 serviceState = map_get_long(rs, "SERVICE_STATE");
265 271 if(getGpsValid(serviceState) == 1){
... ...
src/main/java/com/bsth/service/schedule/log/ModuleOperatorDbAppender.java
1   -package com.bsth.service.schedule.log;
2   -
3   -import ch.qos.logback.classic.spi.ILoggingEvent;
4   -import ch.qos.logback.core.db.DBAppenderBase;
5   -import ch.qos.logback.core.db.DBHelper;
6   -import com.bsth.control_v2.plan_module.common.exception.PlanModuleException;
7   -import com.bsth.entity.schedule.log.ModuleOperatorLog;
8   -
9   -import java.lang.reflect.Method;
10   -import java.sql.Connection;
11   -import java.sql.Date;
12   -import java.sql.PreparedStatement;
13   -
14   -/**
15   - * 自定义模块业务操作日志logback自定义appender。
16   - */
17   -public class ModuleOperatorDbAppender extends DBAppenderBase<ILoggingEvent> {
18   - /** JDBC3.0中的绑定表自增的主键值,获取result需要此方法 */
19   - protected static final Method GET_GENERATED_KEYS_METHOD;
20   - /** 插入日志sql */
21   - protected static final String INSERT_SQL;
22   -
23   - @Override
24   - public void start() {
25   - super.start();
26   - }
27   -
28   - @Override
29   - protected Method getGeneratedKeysMethod() {
30   - return GET_GENERATED_KEYS_METHOD;
31   - }
32   -
33   - @Override
34   - protected String getInsertSQL() {
35   - return INSERT_SQL;
36   - }
37   -
38   - @Override
39   - protected void subAppend(ILoggingEvent iLoggingEvent, Connection connection, PreparedStatement insertStatement) throws Throwable {
40   - // 参数判定,第一个参数必须是ModuleOperatorLog,后续的参数最多取3个
41   - if (iLoggingEvent.getArgumentArray().length == 0) {
42   - throw new PlanModuleException(iLoggingEvent.getLoggerName() + "日志参数必须大于1");
43   - } else {
44   - Object arg1 = iLoggingEvent.getArgumentArray()[0];
45   - if (!(arg1 instanceof ModuleOperatorLog)) {
46   - throw new PlanModuleException(iLoggingEvent.getLoggerName() + "日志第一个参数必须是ModuleOperatorLog类型");
47   - } else {
48   - ModuleOperatorLog arg1_log = (ModuleOperatorLog) arg1;
49   - // insertStatement设定ModuleOperatorLog关联数据
50   - insertStatement.setLong(1, iLoggingEvent.getTimeStamp());
51   - insertStatement.setString(2, arg1_log.getModuleType().getDicDesc());
52   - insertStatement.setString(3, arg1_log.getOperatorType().getDicDesc());
53   - insertStatement.setString(4, arg1_log.getModuleOperatorType().getDicDesc());
54   - insertStatement.setString(5, arg1_log.getMessage());
55   - insertStatement.setString(6, iLoggingEvent.getLevel().levelStr);
56   - insertStatement.setDate(7, new Date(arg1_log.getOpStartTime().getTime()));
57   - insertStatement.setDate(8, new Date(arg1_log.getOpEndTime().getTime()));
58   - insertStatement.setString(9, arg1_log.getOpUserName());
59   - insertStatement.setString(10, arg1_log.getOpUserCode());
60   - insertStatement.setString(11, arg1_log.getOpEntityClass());
61   - insertStatement.setString(12, arg1_log.getOpBeforeJson());
62   - insertStatement.setString(13, arg1_log.getOpAfterJson());
63   - insertStatement.setString(14, "");
64   - insertStatement.setString(15, "");
65   - insertStatement.setString(16, "");
66   -
67   - for (int i = 1; i < iLoggingEvent.getArgumentArray().length; i++) {
68   - if (i == 1) {
69   - insertStatement.setString(14, iLoggingEvent.getArgumentArray()[i].toString());
70   - } else if (i == 2) {
71   - insertStatement.setString(15, iLoggingEvent.getArgumentArray()[i].toString());
72   - } else if (i == 3) {
73   - insertStatement.setString(16, iLoggingEvent.getArgumentArray()[i].toString());
74   - } else {
75   - break;
76   - }
77   - }
78   -
79   - int updateCount = insertStatement.executeUpdate();
80   - if (updateCount != 1) {
81   - addWarn("Failed to insert loggingEvent");
82   - }
83   - }
84   - }
85   -
86   - }
87   -
88   - @Override
89   - protected void secondarySubAppend(ILoggingEvent iLoggingEvent, Connection connection, long l) throws Throwable {
90   - // TODO:
91   - }
92   -
93   - @Override
94   - public void append(ILoggingEvent eventObject) {
95   - Connection connection = null;
96   - PreparedStatement insertStatement = null;
97   - try {
98   - connection = this.connectionSource.getConnection();
99   - connection.setAutoCommit(false);
100   - insertStatement = connection.prepareStatement(INSERT_SQL);
101   - synchronized (this) {
102   - subAppend(eventObject, connection, insertStatement);
103   - }
104   - // TODO:可能以后需要secondarySubAppend
105   -
106   - connection.commit();
107   - } catch (Throwable exp) {
108   - exp.printStackTrace();
109   - this.addError("problem appending event", exp);
110   - } finally {
111   - DBHelper.closeStatement(insertStatement);
112   - DBHelper.closeConnection(connection);
113   - }
114   - }
115   -
116   - static {
117   - StringBuilder sql = new StringBuilder();
118   - sql.append("insert into bsth_c_s_op_log (");
119   - sql.append("timestmp, ");
120   - sql.append("module_type, ");
121   - sql.append("operator_type, ");
122   - sql.append("module_operator_type, ");
123   - sql.append("message, ");
124   - sql.append("level_name, ");
125   - sql.append("op_start_time, ");
126   - sql.append("op_end_time, ");
127   - sql.append("op_user_name, ");
128   - sql.append("op_user_code, ");
129   - sql.append("op_entity_class, ");
130   - sql.append("op_before_json, ");
131   - sql.append("op_after_json, ");
132   - sql.append("opt_arg1, ");
133   - sql.append("opt_arg2, ");
134   - sql.append("opt_arg3) ");
135   - sql.append(" values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
136   - INSERT_SQL = sql.toString();
137   -
138   - Method getGeneratedKeysMethod;
139   - try {
140   - getGeneratedKeysMethod = PreparedStatement.class.getMethod("getGeneratedKeys", (Class[])null);
141   - } catch (Exception exp) {
142   - getGeneratedKeysMethod = null;
143   - }
144   -
145   - GET_GENERATED_KEYS_METHOD = getGeneratedKeysMethod;
146   - }
147   -}
  1 +package com.bsth.service.schedule.log;
  2 +
  3 +import ch.qos.logback.classic.spi.ILoggingEvent;
  4 +import ch.qos.logback.core.db.DBAppenderBase;
  5 +import ch.qos.logback.core.db.DBHelper;
  6 +import com.bsth.control_v2.plan_module.common.exception.PlanModuleException;
  7 +import com.bsth.entity.schedule.log.ModuleOperatorLog;
  8 +
  9 +import java.lang.reflect.Method;
  10 +import java.sql.Connection;
  11 +import java.sql.Date;
  12 +import java.sql.PreparedStatement;
  13 +
  14 +/**
  15 + * 自定义模块业务操作日志logback自定义appender。
  16 + */
  17 +public class ModuleOperatorDbAppender extends DBAppenderBase<ILoggingEvent> {
  18 + /** JDBC3.0中的绑定表自增的主键值,获取result需要此方法 */
  19 + protected static final Method GET_GENERATED_KEYS_METHOD;
  20 + /** 插入日志sql */
  21 + protected static final String INSERT_SQL;
  22 +
  23 + @Override
  24 + public void start() {
  25 + super.start();
  26 + }
  27 +
  28 + @Override
  29 + protected Method getGeneratedKeysMethod() {
  30 + return GET_GENERATED_KEYS_METHOD;
  31 + }
  32 +
  33 + @Override
  34 + protected String getInsertSQL() {
  35 + return INSERT_SQL;
  36 + }
  37 +
  38 + @Override
  39 + protected void subAppend(ILoggingEvent iLoggingEvent, Connection connection, PreparedStatement insertStatement) throws Throwable {
  40 + // 参数判定,第一个参数必须是ModuleOperatorLog,后续的参数最多取3个
  41 + if (iLoggingEvent.getArgumentArray().length == 0) {
  42 + throw new PlanModuleException(iLoggingEvent.getLoggerName() + "日志参数必须大于1");
  43 + } else {
  44 + Object arg1 = iLoggingEvent.getArgumentArray()[0];
  45 + if (!(arg1 instanceof ModuleOperatorLog)) {
  46 + throw new PlanModuleException(iLoggingEvent.getLoggerName() + "日志第一个参数必须是ModuleOperatorLog类型");
  47 + } else {
  48 + ModuleOperatorLog arg1_log = (ModuleOperatorLog) arg1;
  49 + // insertStatement设定ModuleOperatorLog关联数据
  50 + insertStatement.setLong(1, iLoggingEvent.getTimeStamp());
  51 + insertStatement.setString(2, arg1_log.getModuleType().getDicDesc());
  52 + insertStatement.setString(3, arg1_log.getOperatorType().getDicDesc());
  53 + insertStatement.setString(4, arg1_log.getModuleOperatorType().getDicDesc());
  54 + insertStatement.setString(5, arg1_log.getMessage());
  55 + insertStatement.setString(6, iLoggingEvent.getLevel().levelStr);
  56 + insertStatement.setDate(7, new Date(arg1_log.getOpStartTime().getTime()));
  57 + insertStatement.setDate(8, new Date(arg1_log.getOpEndTime().getTime()));
  58 + insertStatement.setString(9, arg1_log.getOpUserName());
  59 + insertStatement.setString(10, arg1_log.getOpUserCode());
  60 + insertStatement.setString(11, arg1_log.getOpEntityClass());
  61 + insertStatement.setString(12, arg1_log.getOpBeforeJson());
  62 + insertStatement.setString(13, arg1_log.getOpAfterJson());
  63 + insertStatement.setString(14, "");
  64 + insertStatement.setString(15, "");
  65 + insertStatement.setString(16, "");
  66 +
  67 + for (int i = 1; i < iLoggingEvent.getArgumentArray().length; i++) {
  68 + if (i == 1) {
  69 + insertStatement.setString(14, iLoggingEvent.getArgumentArray()[i].toString());
  70 + } else if (i == 2) {
  71 + insertStatement.setString(15, iLoggingEvent.getArgumentArray()[i].toString());
  72 + } else if (i == 3) {
  73 + insertStatement.setString(16, iLoggingEvent.getArgumentArray()[i].toString());
  74 + } else {
  75 + break;
  76 + }
  77 + }
  78 +
  79 + int updateCount = insertStatement.executeUpdate();
  80 + if (updateCount != 1) {
  81 + addWarn("Failed to insert loggingEvent");
  82 + }
  83 + }
  84 + }
  85 +
  86 + }
  87 +
  88 + @Override
  89 + protected void secondarySubAppend(ILoggingEvent iLoggingEvent, Connection connection, long l) throws Throwable {
  90 + // TODO:
  91 + }
  92 +
  93 + @Override
  94 + public void append(ILoggingEvent eventObject) {
  95 + Connection connection = null;
  96 + PreparedStatement insertStatement = null;
  97 + try {
  98 + connection = this.connectionSource.getConnection();
  99 + connection.setAutoCommit(false);
  100 + insertStatement = connection.prepareStatement(INSERT_SQL);
  101 + synchronized (this) {
  102 + subAppend(eventObject, connection, insertStatement);
  103 + }
  104 + // TODO:可能以后需要secondarySubAppend
  105 +
  106 + connection.commit();
  107 + } catch (Throwable exp) {
  108 + exp.printStackTrace();
  109 + this.addError("problem appending event", exp);
  110 + } finally {
  111 + DBHelper.closeStatement(insertStatement);
  112 + DBHelper.closeConnection(connection);
  113 + }
  114 + }
  115 +
  116 + static {
  117 + StringBuilder sql = new StringBuilder();
  118 + sql.append("insert into bsth_c_s_op_log (");
  119 + sql.append("timestmp, ");
  120 + sql.append("module_type, ");
  121 + sql.append("operator_type, ");
  122 + sql.append("module_operator_type, ");
  123 + sql.append("message, ");
  124 + sql.append("level_name, ");
  125 + sql.append("op_start_time, ");
  126 + sql.append("op_end_time, ");
  127 + sql.append("op_user_name, ");
  128 + sql.append("op_user_code, ");
  129 + sql.append("op_entity_class, ");
  130 + sql.append("op_before_json, ");
  131 + sql.append("op_after_json, ");
  132 + sql.append("opt_arg1, ");
  133 + sql.append("opt_arg2, ");
  134 + sql.append("opt_arg3) ");
  135 + sql.append(" values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
  136 + INSERT_SQL = sql.toString();
  137 +
  138 + Method getGeneratedKeysMethod;
  139 + try {
  140 + getGeneratedKeysMethod = PreparedStatement.class.getMethod("getGeneratedKeys", (Class[])null);
  141 + } catch (Exception exp) {
  142 + getGeneratedKeysMethod = null;
  143 + }
  144 +
  145 + GET_GENERATED_KEYS_METHOD = getGeneratedKeysMethod;
  146 + }
  147 +}
... ...
src/main/java/com/bsth/service/schedule/log/PlanLogger.java
1   -package com.bsth.service.schedule.log;
2   -
3   -import com.bsth.control_v2.plan_module.common.dto.schedule.PlanInfoDto;
4   -import com.bsth.control_v2.plan_module.common.enums.log.ModuleOperatorType;
5   -import com.bsth.control_v2.plan_module.common.enums.log.ModuleType;
6   -import com.bsth.control_v2.plan_module.common.enums.log.OperatorType;
7   -import com.bsth.entity.schedule.SchedulePlan;
8   -import com.bsth.entity.schedule.log.ModuleOperatorLog;
9   -import org.slf4j.Logger;
10   -import org.slf4j.LoggerFactory;
11   -import org.springframework.stereotype.Service;
12   -
13   -import java.util.Date;
14   -
15   -/**
16   - * 排班计划日志。
17   - */
18   -@Service
19   -public class PlanLogger {
20   - /** 日志记录器 */
21   - private static final Logger LOGGER = LoggerFactory.getLogger(PlanLogger.class);
22   -
23   - /**
24   - * 生成排班计划日志。
25   - * @param startTime 操作开始时间
26   - * @param endTime 操作结束时间
27   - */
28   - public void createLog(Date startTime, Date endTime) {
29   - ModuleOperatorLog moduleOperatorLog = new ModuleOperatorLog();
30   - moduleOperatorLog.setMessage("排班生成!");
31   - moduleOperatorLog.setModuleType(ModuleType.SCHEDULE);
32   - moduleOperatorLog.setOperatorType(OperatorType.NEW);
33   - moduleOperatorLog.setModuleOperatorType(ModuleOperatorType.SCHEDULE_NEW);
34   - moduleOperatorLog.setOpStartTime(startTime);
35   - moduleOperatorLog.setOpEndTime(endTime);
36   - moduleOperatorLog.setOpUserName("root");
37   - moduleOperatorLog.setOpUserCode("root");
38   - moduleOperatorLog.setOpEntityClass(SchedulePlan.class.getName());
39   - moduleOperatorLog.setOpBeforeJson("{}");
40   - moduleOperatorLog.setOpAfterJson("{}");
41   -
42   - // 如果需要opArg1,opArg2,opArg3,从第2个参数加起,如:LOGGER.info("", {moduleOperatorLog}, {opArg1}, {opArg2})
43   - LOGGER.info("排班计划生成日志:{}", moduleOperatorLog);
44   - }
45   -
46   - /**
47   - * 修改排班计划明细日志。
48   - * @param startTime 操作开始时间
49   - * @param beforeData 修改前数据
50   - * @param endTime 操作结束时间
51   - * @param afterData 修改后数据
52   - */
53   - public void modifyInfoLog(Date startTime, PlanInfoDto beforeData, Date endTime, PlanInfoDto afterData) {
54   - // TODO:
55   - }
56   -}
  1 +package com.bsth.service.schedule.log;
  2 +
  3 +import com.bsth.control_v2.plan_module.common.dto.schedule.PlanInfoDto;
  4 +import com.bsth.control_v2.plan_module.common.enums.log.ModuleOperatorType;
  5 +import com.bsth.control_v2.plan_module.common.enums.log.ModuleType;
  6 +import com.bsth.control_v2.plan_module.common.enums.log.OperatorType;
  7 +import com.bsth.entity.schedule.SchedulePlan;
  8 +import com.bsth.entity.schedule.log.ModuleOperatorLog;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +import java.util.Date;
  14 +
  15 +/**
  16 + * 排班计划日志。
  17 + */
  18 +@Service
  19 +public class PlanLogger {
  20 + /** 日志记录器 */
  21 + private static final Logger LOGGER = LoggerFactory.getLogger(PlanLogger.class);
  22 +
  23 + /**
  24 + * 生成排班计划日志。
  25 + * @param startTime 操作开始时间
  26 + * @param endTime 操作结束时间
  27 + */
  28 + public void createLog(Date startTime, Date endTime) {
  29 + ModuleOperatorLog moduleOperatorLog = new ModuleOperatorLog();
  30 + moduleOperatorLog.setMessage("排班生成!");
  31 + moduleOperatorLog.setModuleType(ModuleType.SCHEDULE);
  32 + moduleOperatorLog.setOperatorType(OperatorType.NEW);
  33 + moduleOperatorLog.setModuleOperatorType(ModuleOperatorType.SCHEDULE_NEW);
  34 + moduleOperatorLog.setOpStartTime(startTime);
  35 + moduleOperatorLog.setOpEndTime(endTime);
  36 + moduleOperatorLog.setOpUserName("root");
  37 + moduleOperatorLog.setOpUserCode("root");
  38 + moduleOperatorLog.setOpEntityClass(SchedulePlan.class.getName());
  39 + moduleOperatorLog.setOpBeforeJson("{}");
  40 + moduleOperatorLog.setOpAfterJson("{}");
  41 +
  42 + // 如果需要opArg1,opArg2,opArg3,从第2个参数加起,如:LOGGER.info("", {moduleOperatorLog}, {opArg1}, {opArg2})
  43 + LOGGER.info("排班计划生成日志:{}", moduleOperatorLog);
  44 + }
  45 +
  46 + /**
  47 + * 修改排班计划明细日志。
  48 + * @param startTime 操作开始时间
  49 + * @param beforeData 修改前数据
  50 + * @param endTime 操作结束时间
  51 + * @param afterData 修改后数据
  52 + */
  53 + public void modifyInfoLog(Date startTime, PlanInfoDto beforeData, Date endTime, PlanInfoDto afterData) {
  54 + // TODO:
  55 + }
  56 +}
... ...
src/main/java/com/bsth/service/schedule/log/TimetableLogger.java
1   -package com.bsth.service.schedule.log;
2   -
3   -import com.bsth.control_v2.plan_module.common.dto.schedule.timetable.TTInfoDetailDto;
4   -import com.bsth.control_v2.plan_module.common.dto.schedule.timetable.TTInfoDto;
5   -import org.slf4j.Logger;
6   -import org.slf4j.LoggerFactory;
7   -import org.springframework.stereotype.Service;
8   -
9   -import java.util.Date;
10   -
11   -/**
12   - * 时刻表日志。
13   - */
14   -@Service
15   -public class TimetableLogger {
16   - /** 日志记录器 */
17   - private static final Logger LOGGER = LoggerFactory.getLogger(TimetableLogger.class);
18   -
19   - /**
20   - * 生成时刻表模版日志。
21   - * @param startTime 操作开始时间
22   - * @param endTime 操作结束时间
23   - */
24   - public void createTTLog(Date startTime, Date endTime) {
25   - // TODO:
26   - }
27   -
28   - /**
29   - * 修改时刻表模版日志。
30   - * @param startTime 操作开始时间
31   - * @param beforeData 修改前数据
32   - * @param endTime 操作结束时间
33   - * @param afterData 修改后数据
34   - */
35   - public void modifyTTLog(Date startTime, TTInfoDto beforeData, Date endTime, TTInfoDto afterData) {
36   - // TODO:
37   - }
38   -
39   - /**
40   - * 导入时刻表明细日志。
41   - * @param startTime 操作开始时间
42   - * @param endTime 操作结束时间
43   - */
44   - public void importTTDLog(Date startTime, Date endTime) {
45   - // TODO:导入前备份一次,导入后备份一次,备份前后的id放入before和after中
46   - }
47   -
48   - /**
49   - * 修改时刻表明细日志。
50   - * @param startTime 操作开始时间
51   - * @param beforeData 修改前数据
52   - * @param endTime 操作结束时间
53   - * @param afterData 修改后数据
54   - */
55   - public void modifyTTDLog(Date startTime, TTInfoDetailDto beforeData, Date endTime, TTInfoDetailDto afterData) {
56   - // TODO:
57   - }
58   -}
  1 +package com.bsth.service.schedule.log;
  2 +
  3 +import com.bsth.control_v2.plan_module.common.dto.schedule.timetable.TTInfoDetailDto;
  4 +import com.bsth.control_v2.plan_module.common.dto.schedule.timetable.TTInfoDto;
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +import java.util.Date;
  10 +
  11 +/**
  12 + * 时刻表日志。
  13 + */
  14 +@Service
  15 +public class TimetableLogger {
  16 + /** 日志记录器 */
  17 + private static final Logger LOGGER = LoggerFactory.getLogger(TimetableLogger.class);
  18 +
  19 + /**
  20 + * 生成时刻表模版日志。
  21 + * @param startTime 操作开始时间
  22 + * @param endTime 操作结束时间
  23 + */
  24 + public void createTTLog(Date startTime, Date endTime) {
  25 + // TODO:
  26 + }
  27 +
  28 + /**
  29 + * 修改时刻表模版日志。
  30 + * @param startTime 操作开始时间
  31 + * @param beforeData 修改前数据
  32 + * @param endTime 操作结束时间
  33 + * @param afterData 修改后数据
  34 + */
  35 + public void modifyTTLog(Date startTime, TTInfoDto beforeData, Date endTime, TTInfoDto afterData) {
  36 + // TODO:
  37 + }
  38 +
  39 + /**
  40 + * 导入时刻表明细日志。
  41 + * @param startTime 操作开始时间
  42 + * @param endTime 操作结束时间
  43 + */
  44 + public void importTTDLog(Date startTime, Date endTime) {
  45 + // TODO:导入前备份一次,导入后备份一次,备份前后的id放入before和after中
  46 + }
  47 +
  48 + /**
  49 + * 修改时刻表明细日志。
  50 + * @param startTime 操作开始时间
  51 + * @param beforeData 修改前数据
  52 + * @param endTime 操作结束时间
  53 + * @param afterData 修改后数据
  54 + */
  55 + public void modifyTTDLog(Date startTime, TTInfoDetailDto beforeData, Date endTime, TTInfoDetailDto afterData) {
  56 + // TODO:
  57 + }
  58 +}
... ...
src/main/resources/static/real_control_v2/css/line_schedule.css
... ... @@ -566,6 +566,12 @@ dl.relevance-active.intimity dd.tl-qrlb{
566 566 color: #f8e9cd;
567 567 }
568 568  
  569 +dl.relevance-active dd.tl-wfyd,
  570 +dl.relevance-active.intimity dd.tl-wfyd{
  571 + background: linear-gradient(to right, rgb( 246,193,10), rgb(226, 226, 168), #8baabf) !important;
  572 + color: #f8e9cd;
  573 +}
  574 +
569 575 dl.relevance-active dd.tl-wd,
570 576 dl.relevance-active.intimity dd.tl-wd{
571 577 background: linear-gradient(to right, #ffff00, rgb(226, 226, 168), rgb(139, 170, 191)) !important;
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/layout.html
... ... @@ -39,6 +39,7 @@
39 39 <span class="tl-xxfc">消息发出</span>
40 40 <span class="tl-xxsd">消息收到</span>
41 41 <span class="tl-xxrd">消息阅读</span>
  42 + <span class="tl-wfyd">无发有到</span>
42 43 </div>
43 44 </div>
44 45 </script>
... ...
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
... ... @@ -186,7 +186,7 @@ var gb_schedule_table = (function () {
186 186 };
187 187 //无发有到时间
188 188 var wfydcolor=function (sch) {
189   - if (sch.qdzArrDatesj!=''&&sch.qdzArrDatesj!=null&&sch.fcsjActual==null) {
  189 + if (sch.fcsjActual==null&&sch.zdsjActual!=null&&sch.zdsjActual!=''&&sch.status!=-1) {//sch.qdzArrDatesj!=''&&sch.qdzArrDatesj!=null&&
190 190 sch.status=4;
191 191 }
192 192 }
... ... @@ -274,7 +274,6 @@ var gb_schedule_table = (function () {
274 274 * @param lineCode
275 275 */
276 276 var reLoadAndRefresh = function (lineCode) {
277   - debugger
278 277 $.get('/realSchedule/lines', {
279 278 lines: lineCode + ','
280 279 }, function (rs) {
... ... @@ -387,8 +386,8 @@ var gb_schedule_table = (function () {
387 386 else
388 387 $(dds[8]).html('');
389 388 if (sch.lpChange==1) {
390   - var d8html=$(dds[8]).html();
391   - $(dds[8]).html(d8html+'<span class="uk-badge uk-badge-success out">换</span>');
  389 + var d8html=$(dds[5]).html();
  390 + $(dds[5]).html(d8html+'<span class="uk-badge uk-badge-success out">换</span>');
392 391 }
393 392  
394 393 //信号状态标记
... ...