Commit 247ee6cdb2c61ea225b29c8bb79b7fdebc149fd9

Authored by ljq
2 parents c5ed71bd 7788ef69

Merge branch 'lingang' of http://192.168.168.245:8888/panzhaov5/control_service_…

…data_Interface into lingang
Showing 25 changed files with 2921 additions and 4395 deletions
src/main/java/com/bsth/entity/HInfo.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +
  4 +import org.springframework.format.annotation.DateTimeFormat;
  5 +
  6 +import javax.persistence.Entity;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +import java.io.Serializable;
  10 +import java.util.Date;
  11 +
  12 +/**
  13 + * 电量信息表
  14 + */
  15 +@Entity
  16 +@Table(name = "bsth_c_qlb")
  17 +public class HInfo implements Serializable {
  18 + @Id
  19 + private Integer id;
  20 + /**
  21 + * 日期
  22 + */
  23 + @DateTimeFormat(pattern = "yyyy-MM-dd")
  24 + private Date rq;
  25 + /**
  26 + * 内部编码
  27 + */
  28 + private String nbbm;
  29 + /**
  30 + * 驾驶员
  31 + */
  32 + private String jsy;
  33 + /**
  34 + * 充氢量
  35 + */
  36 + private Double jql;
  37 + /**
  38 + * 耗氢
  39 + */
  40 + private Double hn;
  41 +
  42 + @Override
  43 + public int hashCode() {
  44 + return this.toString().hashCode();
  45 + }
  46 +
  47 + @Override
  48 + public boolean equals(Object obj) {
  49 + return this.toString().equals(((HInfo)obj).toString());
  50 + }
  51 +
  52 + @Override
  53 + public String toString() {
  54 + return "hydrogen_" + this.id;
  55 + }
  56 +
  57 + public Integer getId() {
  58 + return id;
  59 + }
  60 +
  61 + public void setId(Integer id) {
  62 + this.id = id;
  63 + }
  64 +
  65 + public Date getRq() {
  66 + return rq;
  67 + }
  68 +
  69 + public void setRq(Date rq) {
  70 + this.rq = rq;
  71 + }
  72 +
  73 + public String getNbbm() {
  74 + return nbbm;
  75 + }
  76 +
  77 + public void setNbbm(String nbbm) {
  78 + this.nbbm = nbbm;
  79 + }
  80 +
  81 + public String getJsy() {
  82 + return jsy;
  83 + }
  84 +
  85 + public void setJsy(String jsy) {
  86 + this.jsy = jsy;
  87 + }
  88 +
  89 + public Double getJql() {
  90 + return jql;
  91 + }
  92 +
  93 + public void setJql(Double jql) {
  94 + this.jql = jql;
  95 + }
  96 +
  97 + public Double getHn() {
  98 + return hn;
  99 + }
  100 +
  101 + public void setHn(Double hn) {
  102 + this.hn = hn;
  103 + }
  104 +
  105 +}
src/main/java/com/bsth/entity/PasswordUser.java
1 -package com.bsth.entity;  
2 -  
3 -import javax.persistence.*;  
4 -import java.util.Date;  
5 -  
6 -/**  
7 - * 接口 密码 访问用户  
8 - * Created by panzhao on 2017/3/26.  
9 - */  
10 -@Entity  
11 -@Table(name = "interface_user")  
12 -public class PasswordUser {  
13 -  
14 - @Id  
15 - @GeneratedValue  
16 - private Integer id;  
17 -  
18 - /** 访问密码 */  
19 - private String pwd;  
20 -  
21 - /** 调用方名称 */  
22 - private String callName;  
23 -  
24 - /** 创建日期 */  
25 - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")  
26 - private Date createDate;  
27 -  
28 - /** 备注 */  
29 - private String remark;  
30 -  
31 - public Integer getId() {  
32 - return id;  
33 - }  
34 -  
35 - public void setId(Integer id) {  
36 - this.id = id;  
37 - }  
38 -  
39 - public String getPwd() {  
40 - return pwd;  
41 - }  
42 -  
43 - public void setPwd(String pwd) {  
44 - this.pwd = pwd;  
45 - }  
46 -  
47 - public String getCallName() {  
48 - return callName;  
49 - }  
50 -  
51 - public void setCallName(String callName) {  
52 - this.callName = callName;  
53 - }  
54 -  
55 - public String getRemark() {  
56 - return remark;  
57 - }  
58 -  
59 - public void setRemark(String remark) {  
60 - this.remark = remark;  
61 - }  
62 -  
63 - public Date getCreateDate() {  
64 - return createDate;  
65 - }  
66 -  
67 - public void setCreateDate(Date createDate) {  
68 - this.createDate = createDate;  
69 - }  
70 -} 1 +package com.bsth.entity;
  2 +
  3 +import javax.persistence.*;
  4 +import java.util.Date;
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * 接口 密码 访问用户
  9 + * Created by panzhao on 2017/3/26.
  10 + */
  11 +@Entity
  12 +@Table(name = "interface_user")
  13 +public class PasswordUser {
  14 +
  15 + @Id
  16 + @GeneratedValue
  17 + private Integer id;
  18 +
  19 + /** 访问密码 */
  20 + private String pwd;
  21 +
  22 + /** 调用方名称 */
  23 + private String callName;
  24 +
  25 + /** 创建日期 */
  26 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  27 + private Date createDate;
  28 +
  29 + /** 备注 */
  30 + private String remark;
  31 +
  32 + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
  33 + @JoinTable(name = "interface_users_resources",
  34 + joinColumns = @JoinColumn(name = "user_id"),
  35 + inverseJoinColumns = @JoinColumn(name = "resource_id"))
  36 + private List<Resource> resources;
  37 +
  38 + public Integer getId() {
  39 + return id;
  40 + }
  41 +
  42 + public void setId(Integer id) {
  43 + this.id = id;
  44 + }
  45 +
  46 + public String getPwd() {
  47 + return pwd;
  48 + }
  49 +
  50 + public void setPwd(String pwd) {
  51 + this.pwd = pwd;
  52 + }
  53 +
  54 + public String getCallName() {
  55 + return callName;
  56 + }
  57 +
  58 + public void setCallName(String callName) {
  59 + this.callName = callName;
  60 + }
  61 +
  62 + public String getRemark() {
  63 + return remark;
  64 + }
  65 +
  66 + public void setRemark(String remark) {
  67 + this.remark = remark;
  68 + }
  69 +
  70 + public Date getCreateDate() {
  71 + return createDate;
  72 + }
  73 +
  74 + public void setCreateDate(Date createDate) {
  75 + this.createDate = createDate;
  76 + }
  77 +
  78 + public List<Resource> getResources() {
  79 + return resources;
  80 + }
  81 +
  82 + public void setResources(List<Resource> resources) {
  83 + this.resources = resources;
  84 + }
  85 +}
src/main/java/com/bsth/entity/Resource.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import javax.persistence.*;
  4 +
  5 +/**
  6 + * @Author Hill
  7 + */
  8 +@Entity
  9 +@Table(name = "interface_resources")
  10 +public class Resource {
  11 +
  12 + @Id
  13 + @GeneratedValue
  14 + private Integer id;
  15 +
  16 + private String name;
  17 +
  18 + private String url;
  19 +
  20 + private String remark;
  21 +
  22 + public Integer getId() {
  23 + return id;
  24 + }
  25 +
  26 + public void setId(Integer id) {
  27 + this.id = id;
  28 + }
  29 +
  30 + public String getName() {
  31 + return name;
  32 + }
  33 +
  34 + public void setName(String name) {
  35 + this.name = name;
  36 + }
  37 +
  38 + public String getUrl() {
  39 + return url;
  40 + }
  41 +
  42 + public void setUrl(String url) {
  43 + this.url = url;
  44 + }
  45 +
  46 + public String getRemark() {
  47 + return remark;
  48 + }
  49 +
  50 + public void setRemark(String remark) {
  51 + this.remark = remark;
  52 + }
  53 +}
src/main/java/com/bsth/redis/HRedisService.java 0 → 100644
  1 +package com.bsth.redis;
  2 +
  3 +import com.bsth.Application;
  4 +import com.bsth.entity.HInfo;
  5 +import com.bsth.redis.util.RedisUtils;
  6 +import com.bsth.repository.HInfoRepository;
  7 +import com.bsth.util.ConfigUtil;
  8 +import com.bsth.util.ConvertUtil;
  9 +import com.google.common.collect.ArrayListMultimap;
  10 +import org.joda.time.DateTime;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.boot.CommandLineRunner;
  15 +import org.springframework.core.annotation.Order;
  16 +import org.springframework.data.redis.core.RedisTemplate;
  17 +import org.springframework.data.redis.serializer.StringRedisSerializer;
  18 +import org.springframework.stereotype.Component;
  19 +import org.springframework.stereotype.Service;
  20 +
  21 +import java.util.*;
  22 +import java.util.concurrent.TimeUnit;
  23 +
  24 +/**
  25 + * 油量数据Redis缓存
  26 + * Created by panzhao on 2017/3/19.
  27 + */
  28 +@Service
  29 +@Order(3)
  30 +public class HRedisService implements CommandLineRunner {
  31 +
  32 + @Autowired
  33 + private RedisTemplate redisTemplate;
  34 +
  35 + @Autowired
  36 + HInfoRepository hInfoRepository;
  37 +
  38 + @Autowired
  39 + RedisUtils redisUtils;
  40 +
  41 + static Logger logger = LoggerFactory.getLogger(HRedisService.class);
  42 +
  43 + private final static String REDIS_KEY_PREFIX = "hydrogen:";
  44 +
  45 + /**
  46 + * 将油量数据写入redis
  47 + *
  48 + * @param list
  49 + */
  50 + public void wirte(List<HInfo> list) {
  51 + ArrayListMultimap<String, HInfo> multimap;
  52 + try {
  53 + if (list.size() == 0)
  54 + return;
  55 + //按日期和线路分组数据
  56 + Class clazz = HInfo.class;
  57 + multimap = new ConvertUtil().groupMultiList(list, ":", clazz.getDeclaredField("nbbm"), clazz.getDeclaredField("rq"));
  58 +
  59 + //写入redis
  60 + Iterator<String> iterator = multimap.keySet().iterator();
  61 + String key;
  62 + while (iterator.hasNext()) {
  63 + key = iterator.next();
  64 + mergeData(key, multimap.get(key));
  65 + }
  66 + } catch (Exception e) {
  67 + logger.error("", e);
  68 + }
  69 + }
  70 +
  71 + /**
  72 + * 根据车辆和日期获取油耗数据,以 车辆_驾驶员 为key
  73 + *
  74 + * @param nbbmArray
  75 + * @param rq
  76 + * @return
  77 + */
  78 + public ArrayListMultimap findByNbbmGroup(Iterable<String> nbbmArray, String rq) {
  79 + ArrayListMultimap rs = ArrayListMultimap.create();
  80 +
  81 + rq = rq.replaceAll("-", "");
  82 + try {
  83 + List<HInfo> list = new ArrayList<>();
  84 + Set<String> nbbms = new HashSet<>();
  85 + for (String nbbm : nbbmArray) {
  86 + nbbm = nbbm.split("_")[1];
  87 + if (!nbbms.contains(nbbm)) {
  88 + nbbms.add(nbbm);
  89 + list.addAll(read(nbbm, rq));
  90 + }
  91 + }
  92 + Class clazz = HInfo.class;
  93 + rs = new ConvertUtil().groupMultiList(list, "_", clazz.getDeclaredField("nbbm"), clazz.getDeclaredField("jsy"));
  94 + } catch (Exception e) {
  95 + logger.error("", e);
  96 + }
  97 + return rs;
  98 + }
  99 +
  100 + /**
  101 + * 根据车辆和日期获取油耗数据,以 车辆 为key
  102 + *
  103 + * @param nbbmArray
  104 + * @param rq
  105 + * @return
  106 + */
  107 + public ArrayListMultimap findByNbbmGroup1(Iterable<String> nbbmArray, String rq) {
  108 + ArrayListMultimap rs = ArrayListMultimap.create();
  109 +
  110 + rq = rq.replaceAll("-", "");
  111 + try {
  112 + List<HInfo> list = new ArrayList<>();
  113 + Set<String> nbbms = new HashSet<>();
  114 + for (String nbbm : nbbmArray) {
  115 + if (!nbbms.contains(nbbm)) {
  116 + nbbms.add(nbbm);
  117 + list.addAll(read(nbbm, rq));
  118 + }
  119 + }
  120 + Class clazz = HInfo.class;
  121 + rs = new ConvertUtil().groupMultiList(list, "_", clazz.getDeclaredField("nbbm"));
  122 + } catch (Exception e) {
  123 + logger.error("", e);
  124 + }
  125 + return rs;
  126 + }
  127 +
  128 + public List<HInfo> read(String nbbm, String rq) {
  129 + return redisTemplate.opsForList().range(REDIS_KEY_PREFIX + nbbm + ":" + rq, 0, -1);
  130 + }
  131 +
  132 + /**
  133 + * 将 list 与redis里的数据合并
  134 + *
  135 + * @param key
  136 + * @param list
  137 + */
  138 + public void mergeData(String key, List<HInfo> list) {
  139 + key = REDIS_KEY_PREFIX + key;
  140 +
  141 + //更新 直接覆盖更新
  142 + redisTemplate.execute(redisUtils.getUpdateCallback(key, list));
  143 + }
  144 +
  145 + @Autowired
  146 + HRefreshThread hRefreshThread;
  147 +
  148 + @Override
  149 + public void run(String... strings) throws Exception {
  150 + Application.mainServices.schedule(new Runnable() {
  151 + @Override
  152 + public void run() {
  153 + //启动加载油耗缓存
  154 + synchData(null);
  155 + }
  156 + }, 30, TimeUnit.SECONDS);
  157 +
  158 +
  159 + //定时刷新油耗信息
  160 + Application.mainServices.scheduleWithFixedDelay(hRefreshThread, 60 * 40, 60 * 40, TimeUnit.SECONDS);
  161 + }
  162 +
  163 + /**
  164 + * 和数据库同步数据
  165 + */
  166 + public void synchData(Integer days) {
  167 + int cacheDays = Integer.parseInt(ConfigUtil.get("cache.days"));
  168 + if (null != days && days < cacheDays)
  169 + cacheDays = days;
  170 + //设置key 序列化器
  171 + redisTemplate.setKeySerializer(new StringRedisSerializer());
  172 +
  173 + DateTime dt = new DateTime();
  174 + dt = dt.withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0).minusDays(cacheDays);
  175 + List<HInfo> list = hInfoRepository.findByDateLT(dt.toDate());
  176 + //写入redis
  177 + wirte(list);
  178 + logger.info("刷新氢耗数据, days: " + cacheDays + " -size: " + list.size() + " -LT: " + dt.toString("yyyy-MM-dd"));
  179 + }
  180 +
  181 + @Component
  182 + public static class HRefreshThread extends Thread {
  183 +
  184 + @Autowired
  185 + HRedisService hRedisService;
  186 +
  187 + @Override
  188 + public void run() {
  189 + try {
  190 + hRedisService.synchData(5);
  191 + } catch (Exception e) {
  192 + logger.error("", e);
  193 + }
  194 + }
  195 + }
  196 +}
src/main/java/com/bsth/redis/PlanScheduleRedisService.java
1 -package com.bsth.redis;  
2 -  
3 -import com.bsth.Application;  
4 -import com.bsth.entity.SchedulePlanInfo;  
5 -import com.bsth.redis.util.DateUtils;  
6 -import com.bsth.redis.util.RedisUtils;  
7 -import com.bsth.repository.SchedulePlanInfoRepository;  
8 -import com.bsth.server_rs.base_info.line.Line;  
9 -import com.bsth.server_rs.base_info.line.buffer.LineBufferData;  
10 -import com.bsth.util.ConfigUtil;  
11 -import com.bsth.util.ConvertUtil;  
12 -import com.google.common.collect.ArrayListMultimap;  
13 -import org.joda.time.DateTime;  
14 -import org.slf4j.Logger;  
15 -import org.slf4j.LoggerFactory;  
16 -import org.springframework.beans.factory.annotation.Autowired;  
17 -import org.springframework.boot.CommandLineRunner;  
18 -import org.springframework.core.annotation.Order;  
19 -import org.springframework.data.redis.core.ListOperations;  
20 -import org.springframework.data.redis.core.RedisTemplate;  
21 -import org.springframework.data.redis.serializer.StringRedisSerializer;  
22 -import org.springframework.stereotype.Component;  
23 -import org.springframework.stereotype.Service;  
24 -  
25 -import java.util.ArrayList;  
26 -import java.util.Date;  
27 -import java.util.Iterator;  
28 -import java.util.List;  
29 -import java.util.concurrent.TimeUnit;  
30 -  
31 -/**  
32 - * 计调的 计划排班redis缓存  
33 - * Created by panzhao on 2017/3/27.  
34 - */  
35 -@Service  
36 -@Order(6)  
37 -public class PlanScheduleRedisService implements CommandLineRunner {  
38 -  
39 - @Autowired  
40 - private RedisTemplate redisTemplate;  
41 -  
42 - @Autowired  
43 - SchedulePlanInfoRepository planInfoRepository;  
44 -  
45 - @Autowired  
46 - RedisUtils redisUtils;  
47 -  
48 - static Logger logger = LoggerFactory.getLogger(PlanScheduleRedisService.class);  
49 -  
50 - private final static String REDIS_KEY_PREFIX = "plan:";  
51 -  
52 - /**  
53 - * 将一批计划写入redis  
54 - *  
55 - * @param list  
56 - */  
57 - public void wirte(List<SchedulePlanInfo> list) {  
58 - ArrayListMultimap<String, SchedulePlanInfo> multimap;  
59 - try {  
60 - if (list.size() == 0)  
61 - return;  
62 - //按日期和线路分组数据  
63 - Class clazz = SchedulePlanInfo.class;  
64 - multimap = new ConvertUtil().groupMultiList(list, ":", clazz.getDeclaredField("xlBm"), clazz.getDeclaredField("scheduleDate"));  
65 -  
66 - //写入redis  
67 - Iterator<String> iterator = multimap.keySet().iterator();  
68 - String key;  
69 - while (iterator.hasNext()) {  
70 - key = iterator.next();  
71 - replace(key, multimap.get(key));  
72 - }  
73 - } catch (Exception e) {  
74 - logger.error("", e);  
75 - }  
76 - }  
77 -  
78 - /**  
79 - * 将 list 与redis里的数据合并  
80 - *  
81 - * @param key  
82 - * @param list  
83 - */  
84 - public void mergeData(String key, List<SchedulePlanInfo> list) {  
85 - key = REDIS_KEY_PREFIX + key.replaceAll("-", "");  
86 -  
87 - ListOperations<String, SchedulePlanInfo> ops = redisTemplate.opsForList();  
88 - List<SchedulePlanInfo> cacheList = ops.range(key, 0, -1);  
89 -  
90 - for (SchedulePlanInfo plan : cacheList) {  
91 - if (!list.contains(plan))  
92 - list.add(plan);  
93 - }  
94 -  
95 - //更新  
96 - redisTemplate.execute(redisUtils.getUpdateCallback(key, list));  
97 - }  
98 -  
99 - /**  
100 - * 覆盖数据  
101 - *  
102 - * @param key  
103 - * @param list  
104 - */  
105 - public void replace(String key, List<SchedulePlanInfo> list) {  
106 - key = REDIS_KEY_PREFIX + key.replaceAll("-", "");  
107 - redisTemplate.execute(redisUtils.getUpdateCallback(key, list));  
108 - }  
109 -  
110 - /**  
111 - * 根据日期和线路编码从redis获取计划  
112 - *  
113 - * @param dateStr  
114 - * @param lineCode  
115 - * @return  
116 - */  
117 - public List<SchedulePlanInfo> read(String dateStr, String lineCode) {  
118 - return redisTemplate.opsForList().range(REDIS_KEY_PREFIX + lineCode + ":" + dateStr, 0, -1);  
119 - }  
120 -  
121 -  
122 - @Autowired  
123 - PlanClearThread planClearThread;  
124 -  
125 - @Override  
126 - public void run(String... strings) throws Exception {  
127 - Application.mainServices.schedule(new Runnable() {  
128 - @Override  
129 - public void run() {  
130 - int cacheDays = Integer.parseInt(ConfigUtil.get("cache.days"));  
131 - //设置key 序列化器  
132 - redisTemplate.setKeySerializer(new StringRedisSerializer());  
133 -  
134 - DateTime dt = new DateTime();  
135 - dt = dt.minusDays(cacheDays);  
136 - dt = dt.withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0).minusDays(cacheDays);  
137 - List<SchedulePlanInfo> list = planInfoRepository.findByDateRange(dt.toDate(), new Date());  
138 - //写入redis  
139 - wirte(list);  
140 - }  
141 - }, 60 * 5, TimeUnit.SECONDS);  
142 -  
143 -  
144 - //定时 00:05 分清理计划,并加载当天的计划  
145 - long diff = (DateUtils.getTimestamp() + 1000 * 60 * 5) - System.currentTimeMillis();  
146 - if (diff < 0)  
147 - diff += (1000 * 60 * 60 * 24);  
148 - Application.mainServices.scheduleAtFixedRate(planClearThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);  
149 - }  
150 -  
151 - public List<SchedulePlanInfo> findByMultiLine(List<String> lineArray, String rq) {  
152 - rq = rq.replaceAll("-", "");  
153 - List<SchedulePlanInfo> rs = new ArrayList<>();  
154 - for (String lineCode : lineArray) {  
155 - rs.addAll(read(rq, lineCode));  
156 - }  
157 - return rs;  
158 - }  
159 -  
160 - @Component  
161 - public static class PlanClearThread extends Thread {  
162 -  
163 - @Autowired  
164 - PlanScheduleRedisService planRedisService;  
165 - @Autowired  
166 - SchedulePlanInfoRepository planInfoRepository;  
167 -  
168 - @Override  
169 - public void run() {  
170 - try {  
171 - logger.info("redis -清理计划排班");  
172 -  
173 - int cacheDays = Integer.parseInt(ConfigUtil.get("cache.days"));  
174 - DateTime dt = new DateTime();  
175 - dt = dt.minusDays(cacheDays);  
176 - String rq = dt.toString("yyyy-MM-dd");  
177 -  
178 - List<Line> lines = LineBufferData.findAll();  
179 - for (Line line : lines) {  
180 - planRedisService.delete(line.getLineCode(), rq);  
181 - }  
182 -  
183 - //加载当天的计划  
184 - Date d = new Date();  
185 - Date s = new Date(d.getTime() - 1000 * 60 * 60 * 24);  
186 - List<SchedulePlanInfo> list = planInfoRepository.findByDateRange(s, d);  
187 - //写入redis  
188 - planRedisService.wirte(list);  
189 - } catch (Exception e) {  
190 - logger.error("", e);  
191 - }  
192 - }  
193 - }  
194 -  
195 - private void delete(String lineCode, String rq) {  
196 - String key = REDIS_KEY_PREFIX + (lineCode + ":" + rq).replaceAll("-", "");  
197 - redisTemplate.delete(key);  
198 - }  
199 -} 1 +package com.bsth.redis;
  2 +
  3 +import com.bsth.Application;
  4 +import com.bsth.entity.SchedulePlanInfo;
  5 +import com.bsth.redis.util.DateUtils;
  6 +import com.bsth.redis.util.RedisUtils;
  7 +import com.bsth.repository.SchedulePlanInfoRepository;
  8 +import com.bsth.server_rs.base_info.line.Line;
  9 +import com.bsth.server_rs.base_info.line.buffer.LineBufferData;
  10 +import com.bsth.util.ConfigUtil;
  11 +import com.bsth.util.ConvertUtil;
  12 +import com.google.common.collect.ArrayListMultimap;
  13 +import org.joda.time.DateTime;
  14 +import org.slf4j.Logger;
  15 +import org.slf4j.LoggerFactory;
  16 +import org.springframework.beans.factory.annotation.Autowired;
  17 +import org.springframework.boot.CommandLineRunner;
  18 +import org.springframework.core.annotation.Order;
  19 +import org.springframework.data.redis.core.ListOperations;
  20 +import org.springframework.data.redis.core.RedisTemplate;
  21 +import org.springframework.data.redis.serializer.StringRedisSerializer;
  22 +import org.springframework.stereotype.Component;
  23 +import org.springframework.stereotype.Service;
  24 +
  25 +import java.util.ArrayList;
  26 +import java.util.Date;
  27 +import java.util.Iterator;
  28 +import java.util.List;
  29 +import java.util.concurrent.TimeUnit;
  30 +
  31 +/**
  32 + * 计调的 计划排班redis缓存
  33 + * Created by panzhao on 2017/3/27.
  34 + */
  35 +@Service
  36 +@Order(6)
  37 +public class PlanScheduleRedisService implements CommandLineRunner {
  38 +
  39 + @Autowired
  40 + private RedisTemplate redisTemplate;
  41 +
  42 + @Autowired
  43 + SchedulePlanInfoRepository planInfoRepository;
  44 +
  45 + @Autowired
  46 + RedisUtils redisUtils;
  47 +
  48 + static Logger logger = LoggerFactory.getLogger(PlanScheduleRedisService.class);
  49 +
  50 + private final static String REDIS_KEY_PREFIX = "plan:";
  51 +
  52 + /**
  53 + * 将一批计划写入redis
  54 + *
  55 + * @param list
  56 + */
  57 + public void wirte(List<SchedulePlanInfo> list) {
  58 + ArrayListMultimap<String, SchedulePlanInfo> multimap;
  59 + try {
  60 + if (list.size() == 0)
  61 + return;
  62 + //按日期和线路分组数据
  63 + Class clazz = SchedulePlanInfo.class;
  64 + multimap = new ConvertUtil().groupMultiList(list, ":", clazz.getDeclaredField("xlBm"), clazz.getDeclaredField("scheduleDate"));
  65 +
  66 + //写入redis
  67 + Iterator<String> iterator = multimap.keySet().iterator();
  68 + String key;
  69 + while (iterator.hasNext()) {
  70 + key = iterator.next();
  71 + replace(key, multimap.get(key));
  72 + }
  73 + } catch (Exception e) {
  74 + logger.error("", e);
  75 + }
  76 + }
  77 +
  78 + /**
  79 + * 将 list 与redis里的数据合并
  80 + *
  81 + * @param key
  82 + * @param list
  83 + */
  84 + public void mergeData(String key, List<SchedulePlanInfo> list) {
  85 + key = REDIS_KEY_PREFIX + key.replaceAll("-", "");
  86 +
  87 + ListOperations<String, SchedulePlanInfo> ops = redisTemplate.opsForList();
  88 + List<SchedulePlanInfo> cacheList = ops.range(key, 0, -1);
  89 +
  90 + for (SchedulePlanInfo plan : cacheList) {
  91 + if (!list.contains(plan))
  92 + list.add(plan);
  93 + }
  94 +
  95 + //更新
  96 + redisTemplate.execute(redisUtils.getUpdateCallback(key, list));
  97 + }
  98 +
  99 + /**
  100 + * 覆盖数据
  101 + *
  102 + * @param key
  103 + * @param list
  104 + */
  105 + public void replace(String key, List<SchedulePlanInfo> list) {
  106 + key = REDIS_KEY_PREFIX + key.replaceAll("-", "");
  107 + redisTemplate.execute(redisUtils.getUpdateCallback(key, list));
  108 + }
  109 +
  110 + /**
  111 + * 根据日期和线路编码从redis获取计划
  112 + *
  113 + * @param dateStr
  114 + * @param lineCode
  115 + * @return
  116 + */
  117 + public List<SchedulePlanInfo> read(String dateStr, String lineCode) {
  118 + return redisTemplate.opsForList().range(REDIS_KEY_PREFIX + lineCode + ":" + dateStr, 0, -1);
  119 + }
  120 +
  121 +
  122 + @Autowired
  123 + PlanClearThread planClearThread;
  124 +
  125 + @Override
  126 + public void run(String... strings) throws Exception {
  127 + Application.mainServices.schedule(new Runnable() {
  128 + @Override
  129 + public void run() {
  130 + int cacheDays = Integer.parseInt(ConfigUtil.get("cache.days"));
  131 + //设置key 序列化器
  132 + redisTemplate.setKeySerializer(new StringRedisSerializer());
  133 +
  134 + DateTime dt = new DateTime();
  135 + dt = dt.withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0);
  136 + List<SchedulePlanInfo> list = planInfoRepository.findByDateRange(dt.minusDays(cacheDays).toDate(), dt.plusDays(1).toDate());
  137 + //写入redis
  138 + wirte(list);
  139 + }
  140 + }, 20, TimeUnit.SECONDS);
  141 +
  142 +
  143 + //定时 00:05 分清理计划,并加载当天的计划
  144 + long diff = (DateUtils.getTimestamp() + 1000 * 60 * 5) - System.currentTimeMillis();
  145 + if (diff < 0)
  146 + diff += (1000 * 60 * 60 * 24);
  147 + Application.mainServices.scheduleAtFixedRate(planClearThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
  148 + }
  149 +
  150 + public List<SchedulePlanInfo> findByMultiLine(List<String> lineArray, String rq) {
  151 + rq = rq.replaceAll("-", "");
  152 + List<SchedulePlanInfo> rs = new ArrayList<>();
  153 + for (String lineCode : lineArray) {
  154 + rs.addAll(read(rq, lineCode));
  155 + }
  156 + return rs;
  157 + }
  158 +
  159 + @Component
  160 + public static class PlanClearThread extends Thread {
  161 +
  162 + @Autowired
  163 + PlanScheduleRedisService planRedisService;
  164 + @Autowired
  165 + SchedulePlanInfoRepository planInfoRepository;
  166 +
  167 + @Override
  168 + public void run() {
  169 + try {
  170 + logger.info("redis -清理计划排班");
  171 +
  172 + int cacheDays = Integer.parseInt(ConfigUtil.get("cache.days"));
  173 + DateTime dt = new DateTime();
  174 + dt = dt.minusDays(cacheDays);
  175 + String rq = dt.toString("yyyy-MM-dd");
  176 +
  177 + List<Line> lines = LineBufferData.findAll();
  178 + for (Line line : lines) {
  179 + planRedisService.delete(line.getLineCode(), rq);
  180 + }
  181 +
  182 + //加载明天的计划
  183 + DateTime d = new DateTime();
  184 + d.withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0);
  185 + List<SchedulePlanInfo> list = planInfoRepository.findByDateRange(d.toDate(), d.plusDays(1).toDate());
  186 + //写入redis
  187 + planRedisService.wirte(list);
  188 + } catch (Exception e) {
  189 + logger.error("", e);
  190 + }
  191 + }
  192 + }
  193 +
  194 + private void delete(String lineCode, String rq) {
  195 + String key = REDIS_KEY_PREFIX + (lineCode + ":" + rq).replaceAll("-", "");
  196 + redisTemplate.delete(key);
  197 + }
  198 +}
src/main/java/com/bsth/repository/HInfoRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import com.bsth.entity.HInfo;
  4 +
  5 +import org.springframework.data.jpa.repository.Query;
  6 +import org.springframework.data.repository.PagingAndSortingRepository;
  7 +import org.springframework.stereotype.Repository;
  8 +
  9 +import java.util.Date;
  10 +import java.util.List;
  11 +
  12 +@Repository
  13 +public interface HInfoRepository extends PagingAndSortingRepository<HInfo, Long> {
  14 +
  15 +
  16 + @Query("select h from HInfo h where h.rq>?1")
  17 + List<HInfo> findByDateLT(Date rq);
  18 +}
src/main/java/com/bsth/server_rs/AuthorizeInterceptor_IN.java
1 package com.bsth.server_rs; 1 package com.bsth.server_rs;
2 2
3 import com.bsth.common.SystemParamKeys; 3 import com.bsth.common.SystemParamKeys;
  4 +import com.bsth.entity.PasswordUser;
  5 +import com.bsth.entity.Resource;
4 import com.bsth.server_rs.exception.AesException; 6 import com.bsth.server_rs.exception.AesException;
5 import com.bsth.service.SystemParamService; 7 import com.bsth.service.SystemParamService;
6 import com.bsth.service.UserService; 8 import com.bsth.service.UserService;
@@ -18,6 +20,8 @@ import org.springframework.beans.factory.InitializingBean; @@ -18,6 +20,8 @@ import org.springframework.beans.factory.InitializingBean;
18 import org.springframework.context.ApplicationContext; 20 import org.springframework.context.ApplicationContext;
19 import org.springframework.context.ApplicationContextAware; 21 import org.springframework.context.ApplicationContextAware;
20 import org.springframework.stereotype.Component; 22 import org.springframework.stereotype.Component;
  23 +import org.springframework.util.AntPathMatcher;
  24 +import org.springframework.util.PathMatcher;
21 25
22 import java.security.MessageDigest; 26 import java.security.MessageDigest;
23 import java.util.Arrays; 27 import java.util.Arrays;
@@ -45,6 +49,8 @@ public class AuthorizeInterceptor_IN extends AbstractPhaseInterceptor&lt;Message&gt; i @@ -45,6 +49,8 @@ public class AuthorizeInterceptor_IN extends AbstractPhaseInterceptor&lt;Message&gt; i
45 49
46 static Logger logger = LoggerFactory.getLogger(AuthorizeInterceptor_IN.class); 50 static Logger logger = LoggerFactory.getLogger(AuthorizeInterceptor_IN.class);
47 51
  52 + private static PathMatcher matcher = new AntPathMatcher();
  53 +
48 public AuthorizeInterceptor_IN() { 54 public AuthorizeInterceptor_IN() {
49 super(Phase.RECEIVE); 55 super(Phase.RECEIVE);
50 } 56 }
@@ -121,10 +127,17 @@ public class AuthorizeInterceptor_IN extends AbstractPhaseInterceptor&lt;Message&gt; i @@ -121,10 +127,17 @@ public class AuthorizeInterceptor_IN extends AbstractPhaseInterceptor&lt;Message&gt; i
121 } 127 }
122 128
123 private static void validate(Map<String, String> map, Message message) { 129 private static void validate(Map<String, String> map, Message message) {
124 - String limitPasswords = systemParamService.getValue(SystemParamKeys.LIMIT_PASSWORDS);  
125 - String limitUris = systemParamService.getValue(SystemParamKeys.LIMIT_URIS);  
126 - if (limitPasswords != null && limitPasswords.indexOf(String.format("%s,", map.get(PASSWORD))) > -1) {  
127 - if (limitUris != null && limitUris.indexOf(String.format("%s,", message.get(Message.REQUEST_URI))) == -1) { 130 + PasswordUser user = userService.get(map.get(PASSWORD));
  131 + if (user.getResources().size() > 0) {
  132 + boolean isMatch = false;
  133 + String uri = (String) message.get(Message.REQUEST_URI);
  134 + for (Resource resource : user.getResources()) {
  135 + if (matcher.match(resource.getUrl(), uri)) {
  136 + isMatch = true;
  137 + break;
  138 + }
  139 + }
  140 + if (!isMatch) {
128 throw new AesException(AesException.INVALID_URI); 141 throw new AesException(AesException.INVALID_URI);
129 } 142 }
130 } 143 }
src/main/java/com/bsth/server_rs/base_info/section/buffer/LD_SectionBufferData.java
1 -package com.bsth.server_rs.base_info.section.buffer;  
2 -  
3 -import com.bsth.Application;  
4 -import com.bsth.server_rs.base_info.line.Line;  
5 -import com.bsth.server_rs.base_info.line.buffer.LineBufferData;  
6 -import com.bsth.server_rs.base_info.section.entity.LD_Section;  
7 -import com.bsth.server_rs.base_info.section.entity.LD_SectionRoute;  
8 -import com.bsth.server_rs.base_info.section.entity.RoadSpeed;  
9 -import com.google.common.collect.ArrayListMultimap;  
10 -import org.slf4j.Logger;  
11 -import org.slf4j.LoggerFactory;  
12 -import org.springframework.beans.factory.annotation.Autowired;  
13 -import org.springframework.boot.CommandLineRunner;  
14 -import org.springframework.core.annotation.Order;  
15 -import org.springframework.jdbc.core.JdbcTemplate;  
16 -import org.springframework.stereotype.Component;  
17 -  
18 -import java.util.*;  
19 -import java.util.concurrent.ConcurrentHashMap;  
20 -import java.util.concurrent.TimeUnit;  
21 -  
22 -/**  
23 - * 站点数据缓存(自更新)  
24 - * Created by panzhao on 2017/3/27.  
25 - */  
26 -@Component  
27 -@Order(6)  
28 -public class LD_SectionBufferData implements CommandLineRunner {  
29 -  
30 -  
31 - private static List<LD_Section> data;  
32 - private static Map<String, LD_Section> codeMap;  
33 -  
34 - /**  
35 - * 线路名称和路段集合映射  
36 - */  
37 - private static Map<String, List<LD_SectionRoute>> name2sections = new ConcurrentHashMap<>();  
38 -  
39 - //路段限速缓存信息  
40 - private static List<RoadSpeed> roadSpeedList;  
41 -  
42 - @Autowired  
43 - JdbcTemplate jdbcTemplate;  
44 -  
45 - @Autowired  
46 - LD_SectionRefreshThread ld_sectionRefreshThread;  
47 -  
48 - Logger logger = LoggerFactory.getLogger(this.getClass());  
49 -  
50 - /**  
51 - 路由缓存  
52 - 线路编码_上下行 ——> 路由集合  
53 - */  
54 - private static ArrayListMultimap<String, LD_SectionRoute> routeListMap;  
55 -  
56 -  
57 - public static List<LD_Section> findAll(){  
58 - return data;  
59 - }  
60 -  
61 - public static Map<String, Collection<LD_SectionRoute>> findAllRoute(){  
62 - return routeListMap.asMap();  
63 - }  
64 -  
65 - public static LD_Section findOne(String code){  
66 - return codeMap.get(code);  
67 - }  
68 -  
69 - public static void replaceAll(List<LD_Section> newData){  
70 - data = newData;  
71 - Map<String, LD_Section> codeMapCopy = new HashMap<>();  
72 - for(LD_Section section : data){  
73 - codeMapCopy.put(section.getSectionCode(), section);  
74 - }  
75 -  
76 - codeMap = codeMapCopy;  
77 - }  
78 -  
79 - public static void putRoadSpeeds(List<RoadSpeed> list){  
80 - roadSpeedList = list;  
81 - }  
82 -  
83 - public static void replaceRoutes(List<LD_SectionRoute> list){  
84 - Collections.sort(list, new Comparator<LD_SectionRoute>() {  
85 - @Override  
86 - public int compare(LD_SectionRoute o1, LD_SectionRoute o2) {  
87 - return o1.getSectionrouteCode().compareTo(o2.getSectionrouteCode());  
88 - }  
89 - });  
90 -  
91 - ArrayListMultimap<String, LD_SectionRoute> routeListMapCopy = ArrayListMultimap.create();  
92 - for(LD_SectionRoute sr : list){  
93 - routeListMapCopy.put(sr.getLineCode()+"_" + sr.getDirections(), sr);  
94 - }  
95 -  
96 - routeListMap = routeListMapCopy;  
97 - }  
98 -  
99 - @Override  
100 - public void run(String... strings) throws Exception {  
101 - Application.mainServices.scheduleWithFixedDelay(ld_sectionRefreshThread, 10, 60 * 60, TimeUnit.SECONDS);  
102 - }  
103 -  
104 - public Map<String, Collection<LD_SectionRoute>> findRouteByCompany(String company) {  
105 - List<Line> lines = LineBufferData.findByCompany(company);  
106 -  
107 - ArrayListMultimap<String, LD_SectionRoute> listMap = ArrayListMultimap.create();  
108 -  
109 -  
110 - Set<String> ks = routeListMap.keySet();  
111 -  
112 - for(String k : ks){  
113 - if(include(lines, k)){  
114 - listMap.putAll(k, routeListMap.get(k));  
115 - }  
116 - }  
117 - return listMap.asMap();  
118 - }  
119 -  
120 - private static boolean include(List<Line> lines, String k){  
121 -  
122 - for(Line line : lines){  
123 - if(k.startsWith(line.getLineCode() + "_"))  
124 - return true;  
125 - }  
126 - return false;  
127 - }  
128 -  
129 - public List<RoadSpeed> roadSpeedList(String company) {  
130 - return roadSpeedList;  
131 - }  
132 -  
133 - public Map<String, Collection<LD_SectionRoute>> findByLineCode(String lineCode) {  
134 -  
135 - ArrayListMultimap<String, LD_SectionRoute> listMap = ArrayListMultimap.create();  
136 -  
137 - String k1 = lineCode + "_0";  
138 - String k2 = lineCode + "_1";  
139 -  
140 - listMap.putAll(k1, routeListMap.get(k1));  
141 - listMap.putAll(k2, routeListMap.get(k2));  
142 - return listMap.asMap();  
143 - }  
144 -  
145 - public static void putLastedRoute(Map<String, List<LD_SectionRoute>> map) {  
146 - name2sections = map;  
147 - }  
148 -  
149 - public List<LD_SectionRoute> findByLineName(String lineName) {  
150 - return name2sections.get(lineName);  
151 - }  
152 -} 1 +package com.bsth.server_rs.base_info.section.buffer;
  2 +
  3 +import com.bsth.Application;
  4 +import com.bsth.server_rs.base_info.line.Line;
  5 +import com.bsth.server_rs.base_info.line.buffer.LineBufferData;
  6 +import com.bsth.server_rs.base_info.section.entity.LD_Section;
  7 +import com.bsth.server_rs.base_info.section.entity.LD_SectionRoute;
  8 +import com.bsth.server_rs.base_info.section.entity.RoadSpeed;
  9 +import com.google.common.collect.ArrayListMultimap;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.boot.CommandLineRunner;
  14 +import org.springframework.core.annotation.Order;
  15 +import org.springframework.jdbc.core.JdbcTemplate;
  16 +import org.springframework.stereotype.Component;
  17 +
  18 +import java.util.*;
  19 +import java.util.concurrent.ConcurrentHashMap;
  20 +import java.util.concurrent.TimeUnit;
  21 +
  22 +/**
  23 + * 站点数据缓存(自更新)
  24 + * Created by panzhao on 2017/3/27.
  25 + */
  26 +@Component
  27 +@Order(6)
  28 +public class LD_SectionBufferData implements CommandLineRunner {
  29 +
  30 +
  31 + private static List<LD_Section> data;
  32 + private static Map<String, LD_Section> codeMap;
  33 +
  34 + /**
  35 + * 线路名称和路段集合映射
  36 + */
  37 + private static Map<String, List<LD_SectionRoute>> name2sections = new ConcurrentHashMap<>();
  38 +
  39 + //路段限速缓存信息
  40 + private static List<RoadSpeed> roadSpeedList = new ArrayList<>();
  41 +
  42 + @Autowired
  43 + JdbcTemplate jdbcTemplate;
  44 +
  45 + @Autowired
  46 + LD_SectionRefreshThread ld_sectionRefreshThread;
  47 +
  48 + Logger logger = LoggerFactory.getLogger(this.getClass());
  49 +
  50 + /**
  51 + 路由缓存
  52 + 线路编码_上下行 ——> 路由集合
  53 + */
  54 + private static ArrayListMultimap<String, LD_SectionRoute> routeListMap;
  55 +
  56 +
  57 + public static List<LD_Section> findAll(){
  58 + return data;
  59 + }
  60 +
  61 + public static Map<String, Collection<LD_SectionRoute>> findAllRoute(){
  62 + return routeListMap.asMap();
  63 + }
  64 +
  65 + public static LD_Section findOne(String code){
  66 + return codeMap.get(code);
  67 + }
  68 +
  69 + public static void replaceAll(List<LD_Section> newData){
  70 + data = newData;
  71 + Map<String, LD_Section> codeMapCopy = new HashMap<>();
  72 + for(LD_Section section : data){
  73 + codeMapCopy.put(section.getSectionCode(), section);
  74 + }
  75 +
  76 + codeMap = codeMapCopy;
  77 + }
  78 +
  79 + public static void putRoadSpeeds(List<RoadSpeed> list){
  80 + roadSpeedList = list;
  81 + }
  82 +
  83 + public static void replaceRoutes(List<LD_SectionRoute> list){
  84 + Collections.sort(list, new Comparator<LD_SectionRoute>() {
  85 + @Override
  86 + public int compare(LD_SectionRoute o1, LD_SectionRoute o2) {
  87 + return o1.getSectionrouteCode().compareTo(o2.getSectionrouteCode());
  88 + }
  89 + });
  90 +
  91 + ArrayListMultimap<String, LD_SectionRoute> routeListMapCopy = ArrayListMultimap.create();
  92 + for(LD_SectionRoute sr : list){
  93 + routeListMapCopy.put(sr.getLineCode()+"_" + sr.getDirections(), sr);
  94 + }
  95 +
  96 + routeListMap = routeListMapCopy;
  97 + }
  98 +
  99 + @Override
  100 + public void run(String... strings) throws Exception {
  101 + Application.mainServices.scheduleWithFixedDelay(ld_sectionRefreshThread, 10, 60 * 60, TimeUnit.SECONDS);
  102 + }
  103 +
  104 + public Map<String, Collection<LD_SectionRoute>> findRouteByCompany(String company) {
  105 + List<Line> lines = LineBufferData.findByCompany(company);
  106 +
  107 + ArrayListMultimap<String, LD_SectionRoute> listMap = ArrayListMultimap.create();
  108 +
  109 +
  110 + Set<String> ks = routeListMap.keySet();
  111 +
  112 + for(String k : ks){
  113 + if(include(lines, k)){
  114 + listMap.putAll(k, routeListMap.get(k));
  115 + }
  116 + }
  117 + return listMap.asMap();
  118 + }
  119 +
  120 + private static boolean include(List<Line> lines, String k){
  121 +
  122 + for(Line line : lines){
  123 + if(k.startsWith(line.getLineCode() + "_"))
  124 + return true;
  125 + }
  126 + return false;
  127 + }
  128 +
  129 + public List<RoadSpeed> roadSpeedList(String company) {
  130 + return roadSpeedList;
  131 + }
  132 +
  133 + public Map<String, Collection<LD_SectionRoute>> findByLineCode(String lineCode) {
  134 +
  135 + ArrayListMultimap<String, LD_SectionRoute> listMap = ArrayListMultimap.create();
  136 +
  137 + String k1 = lineCode + "_0";
  138 + String k2 = lineCode + "_1";
  139 +
  140 + listMap.putAll(k1, routeListMap.get(k1));
  141 + listMap.putAll(k2, routeListMap.get(k2));
  142 + return listMap.asMap();
  143 + }
  144 +
  145 + public static void putLastedRoute(Map<String, List<LD_SectionRoute>> map) {
  146 + name2sections = map;
  147 + }
  148 +
  149 + public List<LD_SectionRoute> findByLineName(String lineName) {
  150 + return name2sections.get(lineName);
  151 + }
  152 +}
src/main/java/com/bsth/server_rs/base_info/section/buffer/LD_SectionRefreshThread.java
1 -package com.bsth.server_rs.base_info.section.buffer;  
2 -  
3 -import com.bsth.server_rs.base_info.section.entity.LD_Section;  
4 -import com.bsth.server_rs.base_info.section.entity.LD_SectionRoute;  
5 -import com.bsth.server_rs.base_info.section.entity.RoadSpeed;  
6 -import org.slf4j.Logger;  
7 -import org.slf4j.LoggerFactory;  
8 -import org.springframework.beans.factory.annotation.Autowired;  
9 -import org.springframework.jdbc.core.BeanPropertyRowMapper;  
10 -import org.springframework.jdbc.core.JdbcTemplate;  
11 -import org.springframework.stereotype.Component;  
12 -  
13 -import java.util.ArrayList;  
14 -import java.util.HashMap;  
15 -import java.util.List;  
16 -import java.util.Map;  
17 -  
18 -/**  
19 - * Created by panzhao on 2017/3/27.  
20 - */  
21 -@Component  
22 -public class LD_SectionRefreshThread extends Thread{  
23 -  
24 - @Autowired  
25 - JdbcTemplate jdbcTemplate;  
26 -  
27 - Logger logger = LoggerFactory.getLogger(this.getClass());  
28 -  
29 - @Override  
30 - public void run() {  
31 -  
32 - try {  
33 -  
34 - //路段信息  
35 - List<LD_Section> sectionList = jdbcTemplate.query("select section_code,section_name,section_type,ST_AsText(gsection_vector) as gsection_vector,ST_AsText(bsection_vector) as bsection_vector,croses_road,versions from bsth_c_section ",  
36 - BeanPropertyRowMapper.newInstance(LD_Section.class));  
37 -  
38 - if(sectionList == null || sectionList.size() == 0)  
39 - return;  
40 -  
41 - LD_SectionBufferData.replaceAll(sectionList);  
42 -  
43 - //路段路由信息  
44 - List<LD_SectionRoute> routeList = jdbcTemplate.query("select line_code,section_code,directions,sectionroute_code,versions from bsth_c_sectionroute where destroy=0",  
45 - BeanPropertyRowMapper.newInstance(LD_SectionRoute.class));  
46 -  
47 - for(LD_SectionRoute sr : routeList){  
48 - sr.setSection(LD_SectionBufferData.findOne(sr.getSectionCode()));  
49 - }  
50 -  
51 - LD_SectionBufferData.replaceRoutes(routeList);  
52 -  
53 - //查询路段限速信息  
54 - List<RoadSpeed> roadSpeedList = jdbcTemplate.query("select id,name,ST_AsText(g_road_vector) as g_road_vector,speed,speed_start_date,speed_end_date,line,is_start,create_date,update_date from bsth_c_road_speed where is_start=0", BeanPropertyRowMapper.newInstance(RoadSpeed.class));  
55 - if(roadSpeedList.size() > 0)  
56 - LD_SectionBufferData.putRoadSpeeds(roadSpeedList);  
57 -  
58 - //查询最新版本路段信息  
59 - List<LD_SectionRoute> sectionRoutes = jdbcTemplate.query("select b.line_name,a.line_code,a.section_code,a.directions,a.sectionroute_code,a.versions from (select l.name line_name,l.line_code line_code,max(versions) versions from bsth_c_line l left join bsth_c_line_versions v on l.line_code = v.line_code where l.destroy = 0 group by l.name,l.line_code) b left join bsth_c_ls_sectionroute a on a.line_code = b.line_code and a.versions = b.versions where a.destroy = 0 order by a.line_code,a.directions,a.sectionroute_code", BeanPropertyRowMapper.newInstance(LD_SectionRoute.class));  
60 - Map<String, List<LD_SectionRoute>> name2sections = new HashMap<>();  
61 - List<LD_SectionRoute> routes = null;  
62 - String lastedLineName = "";  
63 - for (LD_SectionRoute sr : sectionRoutes) {  
64 - if ("".equals(lastedLineName) || !lastedLineName.equals(sr.getLineName())) {  
65 - name2sections.put(lastedLineName, routes);  
66 - lastedLineName = sr.getLineName();  
67 - routes = new ArrayList<>();  
68 - }  
69 - sr.setSection(LD_SectionBufferData.findOne(sr.getSectionCode()));  
70 - routes.add(sr);  
71 - }  
72 - LD_SectionBufferData.putLastedRoute(name2sections);  
73 - }catch (Exception e){  
74 - logger.error("", e);  
75 - }  
76 - }  
77 -} 1 +package com.bsth.server_rs.base_info.section.buffer;
  2 +
  3 +import com.bsth.server_rs.base_info.section.entity.LD_Section;
  4 +import com.bsth.server_rs.base_info.section.entity.LD_SectionRoute;
  5 +import com.bsth.server_rs.base_info.section.entity.RoadSpeed;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  10 +import org.springframework.jdbc.core.JdbcTemplate;
  11 +import org.springframework.stereotype.Component;
  12 +
  13 +import java.util.ArrayList;
  14 +import java.util.HashMap;
  15 +import java.util.List;
  16 +import java.util.Map;
  17 +
  18 +/**
  19 + * Created by panzhao on 2017/3/27.
  20 + */
  21 +@Component
  22 +public class LD_SectionRefreshThread extends Thread{
  23 +
  24 + @Autowired
  25 + JdbcTemplate jdbcTemplate;
  26 +
  27 + Logger logger = LoggerFactory.getLogger(this.getClass());
  28 +
  29 + @Override
  30 + public void run() {
  31 +
  32 + try {
  33 +
  34 + //路段信息
  35 + List<LD_Section> sectionList = jdbcTemplate.query("select section_code,section_name,section_type,ST_AsText(gsection_vector) as gsection_vector,ST_AsText(bsection_vector) as bsection_vector,croses_road,versions from bsth_c_section ",
  36 + BeanPropertyRowMapper.newInstance(LD_Section.class));
  37 +
  38 + if(sectionList == null || sectionList.size() == 0)
  39 + return;
  40 +
  41 + LD_SectionBufferData.replaceAll(sectionList);
  42 +
  43 + //路段路由信息
  44 + List<LD_SectionRoute> routeList = jdbcTemplate.query("select line_code,section_code,directions,sectionroute_code,versions from bsth_c_sectionroute where destroy=0",
  45 + BeanPropertyRowMapper.newInstance(LD_SectionRoute.class));
  46 +
  47 + for(LD_SectionRoute sr : routeList){
  48 + sr.setSection(LD_SectionBufferData.findOne(sr.getSectionCode()));
  49 + }
  50 +
  51 + LD_SectionBufferData.replaceRoutes(routeList);
  52 +
  53 + //查询路段限速信息
  54 + //List<RoadSpeed> roadSpeedList = jdbcTemplate.query("select id,name,ST_AsText(g_road_vector) as g_road_vector,speed,speed_start_date,speed_end_date,line,is_start,create_date,update_date from bsth_c_road_speed where is_start=0", BeanPropertyRowMapper.newInstance(RoadSpeed.class));
  55 + //if(roadSpeedList.size() > 0)
  56 + // LD_SectionBufferData.putRoadSpeeds(roadSpeedList);
  57 +
  58 + //查询最新版本路段信息
  59 + List<LD_SectionRoute> sectionRoutes = jdbcTemplate.query("select b.line_name,a.line_code,a.section_code,a.directions,a.sectionroute_code,a.versions from (select l.name line_name,l.line_code line_code,max(versions) versions from bsth_c_line l left join bsth_c_line_versions v on l.line_code = v.line_code where l.destroy = 0 group by l.name,l.line_code) b left join bsth_c_ls_sectionroute a on a.line_code = b.line_code and a.versions = b.versions where a.destroy = 0 order by a.line_code,a.directions,a.sectionroute_code", BeanPropertyRowMapper.newInstance(LD_SectionRoute.class));
  60 + Map<String, List<LD_SectionRoute>> name2sections = new HashMap<>();
  61 + List<LD_SectionRoute> routes = null;
  62 + String lastedLineName = "";
  63 + for (LD_SectionRoute sr : sectionRoutes) {
  64 + if ("".equals(lastedLineName) || !lastedLineName.equals(sr.getLineName())) {
  65 + name2sections.put(lastedLineName, routes);
  66 + lastedLineName = sr.getLineName();
  67 + routes = new ArrayList<>();
  68 + }
  69 + sr.setSection(LD_SectionBufferData.findOne(sr.getSectionCode()));
  70 + routes.add(sr);
  71 + }
  72 + LD_SectionBufferData.putLastedRoute(name2sections);
  73 + }catch (Exception e){
  74 + logger.error("", e);
  75 + }
  76 + }
  77 +}
src/main/java/com/bsth/server_rs/base_info/station/buffer/StationRefreshThread.java
1 -package com.bsth.server_rs.base_info.station.buffer;  
2 -  
3 -import com.bsth.server_rs.base_info.station.entity.Station;  
4 -import com.bsth.server_rs.base_info.station.entity.StationRotue;  
5 -import org.slf4j.Logger;  
6 -import org.slf4j.LoggerFactory;  
7 -import org.springframework.beans.factory.annotation.Autowired;  
8 -import org.springframework.jdbc.core.BeanPropertyRowMapper;  
9 -import org.springframework.jdbc.core.JdbcTemplate;  
10 -import org.springframework.stereotype.Component;  
11 -  
12 -import java.util.List;  
13 -  
14 -/**  
15 - * Created by panzhao on 2017/3/27.  
16 - */  
17 -@Component  
18 -public class StationRefreshThread extends Thread{  
19 -  
20 - @Autowired  
21 - JdbcTemplate jdbcTemplate;  
22 -  
23 - Logger logger = LoggerFactory.getLogger(this.getClass());  
24 -  
25 - @Override  
26 - public void run() {  
27 -  
28 - try {  
29 - //站点信息  
30 - List<Station> stationList = jdbcTemplate.query("SELECT station_cod AS station_code,station_name,g_lonx AS lon,g_laty AS lat,shapes_type,radius,ST_AsText(g_polygon_grid) AS polygon_grid,versions FROM bsth_c_station where destroy=0 ",  
31 - BeanPropertyRowMapper.newInstance(Station.class));  
32 -  
33 - if(stationList == null || stationList.size() == 0)  
34 - return;  
35 - StationBufferData.replaceAll(stationList);  
36 -  
37 - //站点路由信息  
38 - List<StationRotue> routeList = jdbcTemplate.query("select id, line, station_route_code, line_code,station_code,station_mark,distances, to_time,directions,station_name from bsth_c_stationroute where destroy=0",  
39 - BeanPropertyRowMapper.newInstance(StationRotue.class));  
40 -  
41 - for(StationRotue sr : routeList){  
42 - sr.setStation(StationBufferData.findOne(sr.getStationCode()));  
43 - }  
44 - StationBufferData.replaceRoutes(routeList);  
45 - }catch (Exception e){  
46 - logger.error("", e);  
47 - }  
48 - }  
49 -} 1 +package com.bsth.server_rs.base_info.station.buffer;
  2 +
  3 +import com.bsth.server_rs.base_info.station.entity.Station;
  4 +import com.bsth.server_rs.base_info.station.entity.StationRotue;
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  9 +import org.springframework.jdbc.core.JdbcTemplate;
  10 +import org.springframework.stereotype.Component;
  11 +
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * Created by panzhao on 2017/3/27.
  16 + */
  17 +@Component
  18 +public class StationRefreshThread extends Thread{
  19 +
  20 + @Autowired
  21 + JdbcTemplate jdbcTemplate;
  22 +
  23 + Logger logger = LoggerFactory.getLogger(this.getClass());
  24 +
  25 + @Override
  26 + public void run() {
  27 +
  28 + try {
  29 + //站点信息
  30 + List<Station> stationList = jdbcTemplate.query("SELECT station_code,station_name,ST_X(center_point_wgs) AS lon,ST_Y(center_point_wgs) AS lat,versions FROM bsth_c_station where destroy=0",
  31 + BeanPropertyRowMapper.newInstance(Station.class));
  32 +
  33 + if(stationList == null || stationList.size() == 0)
  34 + return;
  35 + StationBufferData.replaceAll(stationList);
  36 +
  37 + //站点路由信息
  38 + List<StationRotue> routeList = jdbcTemplate.query("select id, line, station_route_code, line_code,station_code,station_mark,distances, to_time,directions,station_name,shaped_type as shapes_type,radius,ST_AsText(buffer_polygon_wgs) AS polygon_grid from bsth_c_stationroute where destroy=0",
  39 + BeanPropertyRowMapper.newInstance(StationRotue.class));
  40 +
  41 + for(StationRotue sr : routeList){
  42 + sr.setStation(StationBufferData.findOne(sr.getStationCode()));
  43 + }
  44 + StationBufferData.replaceRoutes(routeList);
  45 + }catch (Exception e){
  46 + logger.error("", e);
  47 + }
  48 + }
  49 +}
src/main/java/com/bsth/server_rs/base_info/station/entity/Station.java
1 -package com.bsth.server_rs.base_info.station.entity;  
2 -  
3 -/**  
4 - * 站点信息  
5 - * Created by panzhao on 2017/8/31.  
6 - */  
7 -public class Station {  
8 -  
9 - /** 站点编码 */  
10 - private String stationCode;  
11 -  
12 - /** 站点名称 */  
13 - private String stationName;  
14 -  
15 - /** WGS 经度 */  
16 - private Float lon;  
17 -  
18 - /** WGS 纬度 */  
19 - private Float lat;  
20 -  
21 - /**  
22 - * 电子围栏类型  
23 - *  
24 - * ------ r:圆形  
25 - *  
26 - * ------ d:多边形  
27 - */  
28 - private String shapesType;  
29 -  
30 - /** 圆形半径 */  
31 - private Integer radius;  
32 -  
33 - /** 多边形 WGS 坐标 */  
34 - private String polygonGrid;  
35 -  
36 - /** 版本号 */  
37 - private Integer versions;  
38 -  
39 -  
40 - public String getStationName() {  
41 - return stationName;  
42 - }  
43 -  
44 - public void setStationName(String stationName) {  
45 - this.stationName = stationName;  
46 - }  
47 -  
48 - public String getShapesType() {  
49 - return shapesType;  
50 - }  
51 -  
52 - public void setShapesType(String shapesType) {  
53 - this.shapesType = shapesType;  
54 - }  
55 -  
56 - public Integer getRadius() {  
57 - return radius;  
58 - }  
59 -  
60 - public void setRadius(Integer radius) {  
61 - this.radius = radius;  
62 - }  
63 -  
64 -  
65 - public Integer getVersions() {  
66 - return versions;  
67 - }  
68 -  
69 - public void setVersions(Integer versions) {  
70 - this.versions = versions;  
71 - }  
72 -  
73 - public String getStationCode() {  
74 - return stationCode;  
75 - }  
76 -  
77 - public void setStationCode(String stationCode) {  
78 - this.stationCode = stationCode;  
79 - }  
80 -  
81 - public Float getLon() {  
82 - return lon;  
83 - }  
84 -  
85 - public void setLon(Float lon) {  
86 - this.lon = lon;  
87 - }  
88 -  
89 - public Float getLat() {  
90 - return lat;  
91 - }  
92 -  
93 - public void setLat(Float lat) {  
94 - this.lat = lat;  
95 - }  
96 -  
97 - public String getPolygonGrid() {  
98 - return polygonGrid;  
99 - }  
100 -  
101 - public void setPolygonGrid(String polygonGrid) {  
102 - this.polygonGrid = polygonGrid;  
103 - }  
104 -} 1 +package com.bsth.server_rs.base_info.station.entity;
  2 +
  3 +/**
  4 + * 站点信息
  5 + * Created by panzhao on 2017/8/31.
  6 + */
  7 +public class Station {
  8 +
  9 + /** 站点编码 */
  10 + private String stationCode;
  11 +
  12 + /** 站点名称 */
  13 + private String stationName;
  14 +
  15 + /** WGS 经度 */
  16 + private Float lon;
  17 +
  18 + /** WGS 纬度 */
  19 + private Float lat;
  20 +
  21 + /** 版本号 */
  22 + private Integer versions;
  23 +
  24 +
  25 + public String getStationName() {
  26 + return stationName;
  27 + }
  28 +
  29 + public void setStationName(String stationName) {
  30 + this.stationName = stationName;
  31 + }
  32 +
  33 + public Integer getVersions() {
  34 + return versions;
  35 + }
  36 +
  37 + public void setVersions(Integer versions) {
  38 + this.versions = versions;
  39 + }
  40 +
  41 + public String getStationCode() {
  42 + return stationCode;
  43 + }
  44 +
  45 + public void setStationCode(String stationCode) {
  46 + this.stationCode = stationCode;
  47 + }
  48 +
  49 + public Float getLon() {
  50 + return lon;
  51 + }
  52 +
  53 + public void setLon(Float lon) {
  54 + this.lon = lon;
  55 + }
  56 +
  57 + public Float getLat() {
  58 + return lat;
  59 + }
  60 +
  61 + public void setLat(Float lat) {
  62 + this.lat = lat;
  63 + }
  64 +}
src/main/java/com/bsth/server_rs/base_info/station/entity/StationRotue.java
1 -package com.bsth.server_rs.base_info.station.entity;  
2 -  
3 -/**  
4 - * Created by panzhao on 2017/8/31.  
5 - */  
6 -public class StationRotue {  
7 -  
8 - /** 线路编码 */  
9 - private String lineCode;  
10 -  
11 - /** 站点路由序号 */  
12 - private Integer stationRouteCode;  
13 -  
14 - private String stationCode;  
15 -  
16 - private String stationName;  
17 -  
18 - private Station station;  
19 -  
20 - /**  
21 - * 站点类型  
22 - * ------ B:起点站  
23 - * ------ Z:中途站  
24 - * ------ E:终点站  
25 - * ------ T:停车场  
26 - */  
27 - private String stationMark;  
28 -  
29 - /** 站点路由到站距离 */  
30 - private Double distances;  
31 -  
32 - /** 站点路由到站时间 */  
33 - private Double toTime;  
34 -  
35 - /** 首班时间 */  
36 - private String firstTime;  
37 -  
38 - /** 末班时间 */  
39 - private String endTime;  
40 -  
41 - /** 站点路由方向 */  
42 - private Integer directions;  
43 -  
44 - /** 版本号 */  
45 - private Integer versions;  
46 -  
47 - public String getLineCode() {  
48 - return lineCode;  
49 - }  
50 -  
51 - public void setLineCode(String lineCode) {  
52 - this.lineCode = lineCode;  
53 - }  
54 -  
55 - public Integer getStationRouteCode() {  
56 - return stationRouteCode;  
57 - }  
58 -  
59 - public void setStationRouteCode(Integer stationRouteCode) {  
60 - this.stationRouteCode = stationRouteCode;  
61 - }  
62 -  
63 - public Station getStation() {  
64 - return station;  
65 - }  
66 -  
67 - public void setStation(Station station) {  
68 - this.station = station;  
69 - }  
70 -  
71 - public String getStationMark() {  
72 - return stationMark;  
73 - }  
74 -  
75 - public void setStationMark(String stationMark) {  
76 - this.stationMark = stationMark;  
77 - }  
78 -  
79 - public Double getDistances() {  
80 - return distances;  
81 - }  
82 -  
83 - public void setDistances(Double distances) {  
84 - this.distances = distances;  
85 - }  
86 -  
87 - public Double getToTime() {  
88 - return toTime;  
89 - }  
90 -  
91 - public void setToTime(Double toTime) {  
92 - this.toTime = toTime;  
93 - }  
94 -  
95 - public String getFirstTime() {  
96 - return firstTime;  
97 - }  
98 -  
99 - public void setFirstTime(String firstTime) {  
100 - this.firstTime = firstTime;  
101 - }  
102 -  
103 - public String getEndTime() {  
104 - return endTime;  
105 - }  
106 -  
107 - public void setEndTime(String endTime) {  
108 - this.endTime = endTime;  
109 - }  
110 -  
111 - public Integer getDirections() {  
112 - return directions;  
113 - }  
114 -  
115 - public void setDirections(Integer directions) {  
116 - this.directions = directions;  
117 - }  
118 -  
119 - public Integer getVersions() {  
120 - return versions;  
121 - }  
122 -  
123 - public void setVersions(Integer versions) {  
124 - this.versions = versions;  
125 - }  
126 -  
127 - public String getStationCode() {  
128 - return stationCode;  
129 - }  
130 -  
131 - public void setStationCode(String stationCode) {  
132 - this.stationCode = stationCode;  
133 - }  
134 -  
135 - public String getStationName() {  
136 - return stationName;  
137 - }  
138 -  
139 - public void setStationName(String stationName) {  
140 - this.stationName = stationName;  
141 - }  
142 -} 1 +package com.bsth.server_rs.base_info.station.entity;
  2 +
  3 +/**
  4 + * Created by panzhao on 2017/8/31.
  5 + */
  6 +public class StationRotue {
  7 +
  8 + /** 线路编码 */
  9 + private String lineCode;
  10 +
  11 + /** 站点路由序号 */
  12 + private Integer stationRouteCode;
  13 +
  14 + private String stationCode;
  15 +
  16 + private String stationName;
  17 +
  18 + private Station station;
  19 +
  20 + /**
  21 + * 站点类型
  22 + * ------ B:起点站
  23 + * ------ Z:中途站
  24 + * ------ E:终点站
  25 + * ------ T:停车场
  26 + */
  27 + private String stationMark;
  28 +
  29 + /** 站点路由到站距离 */
  30 + private Double distances;
  31 +
  32 + /** 站点路由到站时间 */
  33 + private Double toTime;
  34 +
  35 + /** 首班时间 */
  36 + private String firstTime;
  37 +
  38 + /** 末班时间 */
  39 + private String endTime;
  40 +
  41 + /** 站点路由方向 */
  42 + private Integer directions;
  43 +
  44 + /** 版本号 */
  45 + private Integer versions;
  46 +
  47 + /**
  48 + * 电子围栏类型
  49 + *
  50 + * ------ r:圆形
  51 + *
  52 + * ------ d:多边形
  53 + */
  54 + private String shapesType;
  55 +
  56 + /** 圆形半径 */
  57 + private Integer radius;
  58 +
  59 + /** 多边形 WGS 坐标 */
  60 + private String polygonGrid;
  61 +
  62 + public String getLineCode() {
  63 + return lineCode;
  64 + }
  65 +
  66 + public void setLineCode(String lineCode) {
  67 + this.lineCode = lineCode;
  68 + }
  69 +
  70 + public Integer getStationRouteCode() {
  71 + return stationRouteCode;
  72 + }
  73 +
  74 + public void setStationRouteCode(Integer stationRouteCode) {
  75 + this.stationRouteCode = stationRouteCode;
  76 + }
  77 +
  78 + public Station getStation() {
  79 + return station;
  80 + }
  81 +
  82 + public void setStation(Station station) {
  83 + this.station = station;
  84 + }
  85 +
  86 + public String getStationMark() {
  87 + return stationMark;
  88 + }
  89 +
  90 + public void setStationMark(String stationMark) {
  91 + this.stationMark = stationMark;
  92 + }
  93 +
  94 + public Double getDistances() {
  95 + return distances;
  96 + }
  97 +
  98 + public void setDistances(Double distances) {
  99 + this.distances = distances;
  100 + }
  101 +
  102 + public Double getToTime() {
  103 + return toTime;
  104 + }
  105 +
  106 + public void setToTime(Double toTime) {
  107 + this.toTime = toTime;
  108 + }
  109 +
  110 + public String getFirstTime() {
  111 + return firstTime;
  112 + }
  113 +
  114 + public void setFirstTime(String firstTime) {
  115 + this.firstTime = firstTime;
  116 + }
  117 +
  118 + public String getEndTime() {
  119 + return endTime;
  120 + }
  121 +
  122 + public void setEndTime(String endTime) {
  123 + this.endTime = endTime;
  124 + }
  125 +
  126 + public Integer getDirections() {
  127 + return directions;
  128 + }
  129 +
  130 + public void setDirections(Integer directions) {
  131 + this.directions = directions;
  132 + }
  133 +
  134 + public Integer getVersions() {
  135 + return versions;
  136 + }
  137 +
  138 + public void setVersions(Integer versions) {
  139 + this.versions = versions;
  140 + }
  141 +
  142 + public String getStationCode() {
  143 + return stationCode;
  144 + }
  145 +
  146 + public void setStationCode(String stationCode) {
  147 + this.stationCode = stationCode;
  148 + }
  149 +
  150 + public String getStationName() {
  151 + return stationName;
  152 + }
  153 +
  154 + public void setStationName(String stationName) {
  155 + this.stationName = stationName;
  156 + }
  157 +
  158 + public String getShapesType() {
  159 + return shapesType;
  160 + }
  161 +
  162 + public void setShapesType(String shapesType) {
  163 + this.shapesType = shapesType;
  164 + }
  165 +
  166 + public Integer getRadius() {
  167 + return radius;
  168 + }
  169 +
  170 + public void setRadius(Integer radius) {
  171 + this.radius = radius;
  172 + }
  173 +
  174 + public String getPolygonGrid() {
  175 + return polygonGrid;
  176 + }
  177 +
  178 + public void setPolygonGrid(String polygonGrid) {
  179 + this.polygonGrid = polygonGrid;
  180 + }
  181 +}
src/main/java/com/bsth/server_rs/electric/ElectricService.java
1 package com.bsth.server_rs.electric; 1 package com.bsth.server_rs.electric;
2 2
  3 +import com.alibaba.fastjson.JSONObject;
3 import com.bsth.server_ws.electric_oil.entity.Electric; 4 import com.bsth.server_ws.electric_oil.entity.Electric;
4 import org.slf4j.Logger; 5 import org.slf4j.Logger;
5 import org.slf4j.LoggerFactory; 6 import org.slf4j.LoggerFactory;
@@ -8,12 +9,19 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper; @@ -8,12 +9,19 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
8 import org.springframework.jdbc.core.JdbcTemplate; 9 import org.springframework.jdbc.core.JdbcTemplate;
9 import org.springframework.stereotype.Component; 10 import org.springframework.stereotype.Component;
10 11
  12 +import javax.servlet.http.HttpServletRequest;
  13 +import javax.servlet.http.HttpServletResponse;
11 import javax.ws.rs.GET; 14 import javax.ws.rs.GET;
  15 +import javax.ws.rs.POST;
12 import javax.ws.rs.Path; 16 import javax.ws.rs.Path;
13 import javax.ws.rs.PathParam; 17 import javax.ws.rs.PathParam;
14 import javax.ws.rs.Produces; 18 import javax.ws.rs.Produces;
15 import javax.ws.rs.core.MediaType; 19 import javax.ws.rs.core.MediaType;
  20 +
  21 +import java.io.BufferedReader;
  22 +import java.io.InputStreamReader;
16 import java.util.List; 23 import java.util.List;
  24 +import java.util.Map;
17 25
18 /** 26 /**
19 * Created by panzhao on 2018/3/27. 27 * Created by panzhao on 2018/3/27.
@@ -36,11 +44,36 @@ public class ElectricService { @@ -36,11 +44,36 @@ public class ElectricService {
36 //从数据库查询 44 //从数据库查询
37 //list = jdbcTemplate.query("select fgs_bm,fgs_name,gs_bm,gs_name,jdl,jdz,remarks,rq,creater_date,nbbm,jsy from bsth_c_jdl where gs_bm="+company+" and rq='"+rq+"'" 45 //list = jdbcTemplate.query("select fgs_bm,fgs_name,gs_bm,gs_name,jdl,jdz,remarks,rq,creater_date,nbbm,jsy from bsth_c_jdl where gs_bm="+company+" and rq='"+rq+"'"
38 // , BeanPropertyRowMapper.newInstance(Electric.class)); 46 // , BeanPropertyRowMapper.newInstance(Electric.class));
39 - list = jdbcTemplate.query("select fgsdm as fgs_bm,c.business_name as fgs_name,ssgsdm as gs_bm,b.business_name as gs_name,cdl as jdl,'' as jdz,'' as remarks,rq,createtime as create_date,nbbm,'' as jsy from (select fgsdm,ssgsdm,sum(cdl * 1000) / 1000 as cdl,rq,max(createtime) as createtime,nbbm from bsth_c_dlb where rq = '" + rq + "' GROUP BY fgsdm,ssgsdm,rq,nbbm) a left join bsth_c_business b on a.ssgsdm = b.business_code LEFT JOIN bsth_c_business c on concat(a.ssgsdm, '_', a.fgsdm) = concat(c.up_code, '_', c.business_code) where ssgsdm="+company  
40 - , BeanPropertyRowMapper.newInstance(Electric.class)); 47 + list = jdbcTemplate.query("select fgsdm as fgs_bm,c.business_name as fgs_name,ssgsdm as gs_bm,b.business_name as gs_name,cdl as jdl,'' as jdz,'' as remarks,rq,createtime as create_date,nbbm,'' as jsy from (select fgsdm,ssgsdm,sum(cdl * 1000) / 1000 as cdl,rq,max(createtime) as createtime,nbbm from bsth_c_dlb where rq = ? GROUP BY fgsdm,ssgsdm,rq,nbbm) a left join bsth_c_business b on a.ssgsdm = b.business_code LEFT JOIN bsth_c_business c on concat(a.ssgsdm, '_', a.fgsdm) = concat(c.up_code, '_', c.business_code) where ssgsdm = ?"
  48 + , new Object[]{ rq, company }, BeanPropertyRowMapper.newInstance(Electric.class));
41 }catch (Exception e){ 49 }catch (Exception e){
42 logger.error("", e); 50 logger.error("", e);
43 } 51 }
44 return list; 52 return list;
45 } 53 }
  54 +
  55 + @POST
  56 + @Path("/charge")
  57 + public void charge(HttpServletRequest request, HttpServletResponse response){
  58 + try {
  59 + request.setCharacterEncoding("UTF-8");
  60 + response.setContentType("application/json; charset=UTF-8");
  61 + // 读取请求体
  62 + StringBuilder sb = new StringBuilder();
  63 + String line;
  64 + BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream()));
  65 + while ((line = reader.readLine()) != null) {
  66 + sb.append(line);
  67 + }
  68 + reader.close();
  69 + // 处理消息主体
  70 + String messageBody = sb.toString();
  71 + JSONObject body = JSONObject.parseObject(messageBody);
  72 +// JSONObject data = body.getJSONObject("Data");
  73 +
  74 + }catch (Exception e){
  75 + logger.error("", e);
  76 + }
  77 + }
  78 +
46 } 79 }
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/java/com/bsth/server_ws/util/WSDataConver.java
1 -package com.bsth.server_ws.util;  
2 -  
3 -import java.lang.reflect.Field;  
4 -import java.text.ParseException;  
5 -import java.text.SimpleDateFormat;  
6 -import java.util.ArrayList;  
7 -import java.util.Calendar;  
8 -import java.util.Collections;  
9 -import java.util.Comparator;  
10 -import java.util.Date;  
11 -import java.util.HashMap;  
12 -import java.util.HashSet;  
13 -import java.util.List;  
14 -import java.util.Map;  
15 -import java.util.Set;  
16 -  
17 -import org.apache.commons.lang3.StringUtils;  
18 -import org.apache.poi.ss.formula.functions.T;  
19 -import org.slf4j.Logger;  
20 -import org.slf4j.LoggerFactory;  
21 -  
22 -import com.bsth.entity.DutyEmployee;  
23 -import com.bsth.entity.ElecInfo;  
24 -import com.bsth.entity.OilInfo;  
25 -import com.bsth.entity.SchedulePlanInfo;  
26 -import com.bsth.entity.ScheduleRealInfo;  
27 -import com.bsth.server_ws.attendance.entity.Ssry_attendance;  
28 -import com.bsth.server_ws.attendance.entity.Jsy_attendance;  
29 -import com.bsth.server_ws.park_station.dto.LsLcPb;  
30 -import com.bsth.server_ws.waybill.entity.NH_waybill;  
31 -import com.bsth.server_ws.waybill.entity.NH_waybillItem;  
32 -import com.bsth.server_ws.waybill.entity.SN_lossMileage;  
33 -import com.bsth.server_ws.waybill.entity.SN_waybill;  
34 -import com.bsth.server_ws.waybill.entity.SN_waybillItem;  
35 -import com.bsth.util.Arith;  
36 -import com.bsth.util.ConvertUtil;  
37 -import com.google.common.collect.ArrayListMultimap;  
38 -  
39 -/**  
40 - * Created by panzhao on 2017/3/15.  
41 - */  
42 -public class WSDataConver {  
43 -  
44 - /**  
45 - * 格式编码和名称映射,与老系统保持一致  
46 - */  
47 - private static Map<String, String> gsMap;  
48 -  
49 - static Logger logger = LoggerFactory.getLogger(WSDataConver.class);  
50 -  
51 - static {  
52 - gsMap = new HashMap<>();  
53 - gsMap.put("55", "上南公司");  
54 - gsMap.put("55_4", "上南一分公司");  
55 - gsMap.put("55_3", "上南六分公司");  
56 - gsMap.put("55_1", "上南二分公司");  
57 - gsMap.put("55_2", "上南三分公司");  
58 - gsMap.put("22", "金高公司");  
59 - gsMap.put("22_2", "二分公司");  
60 - gsMap.put("22_1", "四分公司");  
61 - gsMap.put("22_3", "三分公司");  
62 - gsMap.put("22_5", "一分公司");  
63 - gsMap.put("05", "杨高公司");  
64 - gsMap.put("05_5", "杨高分公司");  
65 - gsMap.put("05_6", "周浦分公司");  
66 - gsMap.put("05_3", "芦潮港分公司");  
67 - gsMap.put("05_1", "川沙分公司");  
68 - gsMap.put("26", "南汇公司");  
69 - gsMap.put("26_3", "南汇三分");  
70 - gsMap.put("26_2", "南汇二分");  
71 - gsMap.put("26_1", "南汇一分");  
72 - gsMap.put("26_4", "南汇维修公司");  
73 - gsMap.put("77", "临港公交");  
74 - gsMap.put("77_1", "临港公交");  
75 - }  
76 -  
77 - /**  
78 - * 将班次list 转换成 getCurrentDayPlan 函数需要的格式  
79 - *  
80 - * @param list  
81 - * @return [0:日期,1:线路名称,2:路牌名称,3:车辆自编号,4:,5:,6:起点时间,7:终点时间,8:起点站名称,9:终点站名称,10:班次类型]  
82 - */  
83 - public static String[] to_getCurrentDayPlan(List<ScheduleRealInfo> list) {  
84 - if (list == null || list.size() == 0)  
85 - return new String[0];  
86 -  
87 - Map<String, String> bcTypeMap = new HashMap<>();  
88 - bcTypeMap.put("out", "出场");  
89 - bcTypeMap.put("in", "进场");  
90 -  
91 - String[] array = new String[list.size()];  
92 - StringBuilder sb;  
93 - ScheduleRealInfo sch;  
94 - int len = list.size();  
95 - for(int i = 0; i < len; i ++){  
96 - sb = new StringBuilder();  
97 - sch = list.get(i);  
98 - sb.append(sch.getScheduleDateStr() + ",");  
99 - sb.append(sch.getXlName() + ",");  
100 - sb.append(sch.getLpName() + ",");  
101 - sb.append(sch.getClZbh() + ",");  
102 - sb.append(",");  
103 - sb.append(",");  
104 - sb.append(sch.getDfsj() + ",");  
105 - sb.append(sch.getZdsj() + ",");  
106 - sb.append(sch.getQdzName() + ",");  
107 - sb.append(sch.getZdzName() + ",");  
108 - sb.append(bcTypeMap.containsKey(sch.getBcType())?bcTypeMap.get(sch.getBcType()):"");  
109 -  
110 - array[i] = sb.toString();  
111 - }  
112 - return array;  
113 - }  
114 -  
115 - /**  
116 - * 将班次list 转换成 returnCCInfo 和 returnJCInfo 函数需要的格式  
117 - *  
118 - * @param list  
119 - * @return [0: 日期, 1: 线路编码, 2: 线路名称, 3: 公司名称, 4: 分公司名称, 5: 路牌, 6: 起点站, 7: 起点计划时间,  
120 - * 8: 起点实际时间, 9: 终点站, 10: 终点计划时间, 11: 终点实际时间, 12: 计划里程, 13: 实际里程,  
121 - * 14: 驾驶员, 15: 售票员, 16: 车辆内部编码, 17: 状态(1 为出场。2为进场), 18: 驾驶员名称, 19: 进场顺序号]  
122 - */  
123 - public static String[] to_returnJCCInfo(List<ScheduleRealInfo> list) {  
124 - if(list == null)  
125 - return new String[0];  
126 -  
127 - int size = list.size();  
128 - String[] array = new String[size];  
129 -  
130 - ScheduleRealInfo sch;  
131 - StringBuffer sb;  
132 - for (int i = 0; i < size; i++) {  
133 - sb = new StringBuffer(",");  
134 -  
135 - sch = list.get(i);  
136 - sb.append(sch.getScheduleDateStr() + ",");  
137 - sb.append(sch.getXlBm() + ",");  
138 - sb.append(sch.getXlName() + ",");  
139 - sb.append(gsMap.get(sch.getGsBm()) + ",");  
140 - sb.append(gsMap.get(sch.getGsBm() + "_" + sch.getFgsBm()) + ",");  
141 - sb.append(sch.getLpName() + ",");  
142 - sb.append(sch.getQdzCode() + ",");  
143 - sb.append(sch.getDfsj() + ",");  
144 - sb.append(nvlGetVal(sch.getFcsjActual()) + ",");  
145 - sb.append(sch.getZdzCode() + ",");  
146 - sb.append(sch.getZdsj() + ",");  
147 - sb.append(nvlGetVal(sch.getZdsjActual()) + ",");  
148 - sb.append(nvlGetVal(sch.getJhlc()) + ",");  
149 - sb.append(nvlGetVal(sch.getJhlc()) + ",");  
150 - sb.append(sch.getjGh() + ",");  
151 - sb.append(nvlGetVal(sch.getsGh()) + ",");  
152 - sb.append(sch.getClZbh() + ",");  
153 - sb.append((sch.getBcType().equals("out") ? 1 : 2) + ",");  
154 - sb.append(sch.getjName() + ",");  
155 - //用ID替代老系统的出场顺序号  
156 - sb.append(sch.getId() + ",");  
157 -  
158 - array[i] = sb.substring(1).toString();  
159 - }  
160 - return array;  
161 - }  
162 -  
163 - public static String nvlGetVal(Object val) {  
164 - return val == null ? "" : val.toString();  
165 - }  
166 -  
167 - /**  
168 - * 将实际排班和油耗数据 转换成南汇路单需要的数据格式  
169 - *  
170 - * @param listMap  
171 - * @param oilInfoMap  
172 - * @return  
173 - */  
174 - public static NH_waybill[] to_waybill_NH(ArrayListMultimap<String, ScheduleRealInfo> listMap, ArrayListMultimap<String, OilInfo> oilInfoMap, ArrayListMultimap<String, ElecInfo> elecInfoMap, List<DutyEmployee> des) throws NoSuchFieldException {  
175 - List<String> nbbmArray = new ArrayList<>(listMap.keySet());  
176 -  
177 - NH_waybill[] rs = new NH_waybill[nbbmArray.size() + 1];  
178 - Field jGhField = ScheduleRealInfo.class.getDeclaredField("jGh");  
179 - //Field lpField = ScheduleRealInfo.class.getDeclaredField("lpName");  
180 -  
181 - List<ScheduleRealInfo> list;  
182 - ArrayListMultimap<String, ScheduleRealInfo> jGhListMap;  
183 - ScheduleRealInfo sch;  
184 - NH_waybill nh_waybill, total = new NH_waybill();  
185 - NH_waybillItem nh_waybillItem, totalItem = new NH_waybillItem();  
186 - List<OilInfo> oilInfo;  
187 - List<ElecInfo> elecInfo;  
188 - boolean isFirst = true;  
189 -  
190 - double jhlc = 0, sjjhlc = 0, cclc = 0, jclc = 0, yylc = 0, kslc = 0, cjlc = 0, lblc = 0, zjlc = 0, zlc = 0;  
191 - double yhTotal = 0;  
192 - for (int i = 0; i < nbbmArray.size(); i++) {  
193 - list = listMap.get(nbbmArray.get(i));  
194 - if (list.size() == 0)  
195 - continue;  
196 - //班次信息  
197 - nh_waybill = new NH_waybill();  
198 - sch = list.get(0);  
199 - //日期  
200 - nh_waybill.setM_strYYRQ(sch.getScheduleDateStr());  
201 - //车辆自编号  
202 - nh_waybill.setM_strNBBM(sch.getClZbh());  
203 - //线路编码  
204 - nh_waybill.setM_strXLBM(sch.getXlBm());  
205 - nh_waybill.setM_SubInfos(new ArrayList<NH_waybillItem>());  
206 - if (isFirst) {  
207 - total.setM_strYYRQ(sch.getScheduleDateStr());  
208 - total.setM_strNBBM("000-000");  
209 - total.setM_strXLBM("000000");  
210 - total.setM_SubInfos(new ArrayList<NH_waybillItem>());  
211 -  
212 - isFirst = false;  
213 - }  
214 -  
215 - //按 驾驶员 分组班次,构造路单子项  
216 - jGhListMap = new ConvertUtil<ScheduleRealInfo>().groupMultiList(list, "_", jGhField);  
217 - for (String jGh : jGhListMap.keySet()) {  
218 - list = jGhListMap.get(jGh);  
219 - nh_waybillItem = new NH_waybillItem();  
220 - //计划里程  
221 - nh_waybillItem.setM_dblJHLC(ScheduleCalculator.calcJHLC(list));  
222 - jhlc = Arith.add(jhlc, nh_waybillItem.getM_dblJHLC());  
223 - //实际计划公里  
224 - nh_waybillItem.setM_dblSJJHLC(ScheduleCalculator.calcSJLC(list));  
225 - sjjhlc = Arith.add(sjjhlc, nh_waybillItem.getM_dblSJJHLC());  
226 - //实际出场里程  
227 - nh_waybillItem.setM_dblCCLC(ScheduleCalculator.calcCCLC(list));  
228 - cclc = Arith.add(cclc, nh_waybillItem.getM_dblCCLC());  
229 - //实际进场里程  
230 - nh_waybillItem.setM_dblJCLC(ScheduleCalculator.calcJCLC(list));  
231 - jclc = Arith.add(jclc, nh_waybillItem.getM_dblJCLC());  
232 - //营业公里  
233 - nh_waybillItem.setM_dblYYLC(ScheduleCalculator.calcYYLC(list));  
234 - yylc = Arith.add(yylc, nh_waybillItem.getM_dblYYLC());  
235 - //空驶公里  
236 - nh_waybillItem.setM_dblKSLC(ScheduleCalculator.calcKSLC(list));  
237 - kslc = Arith.add(kslc, nh_waybillItem.getM_dblKSLC());  
238 - //抽减公里  
239 - nh_waybillItem.setM_dblCJLC(ScheduleCalculator.calcCJLC(list));  
240 - cjlc = Arith.add(cjlc, nh_waybillItem.getM_dblCJLC());  
241 - //烂班公里  
242 - nh_waybillItem.setM_dblLBLC(ScheduleCalculator.calcLBLC(list));  
243 - lblc = Arith.add(lblc, nh_waybillItem.getM_dblLBLC());  
244 - //增加公里  
245 - nh_waybillItem.setM_dblZJLC(ScheduleCalculator.calcZJLC(list));  
246 - zjlc = Arith.add(zjlc, nh_waybillItem.getM_dblZJLC());  
247 - //总公里  
248 - nh_waybillItem.setM_dblZLC(ScheduleCalculator.calcZLC(list));  
249 - zlc = Arith.add(zlc, nh_waybillItem.getM_dblZLC());  
250 - //烂班公里原因  
251 - nh_waybillItem.setM_strLBYY(ScheduleCalculator.joinLBYY(list));  
252 - //抽减公里原因  
253 - nh_waybillItem.setM_strCJYY(ScheduleCalculator.joinCJYY(list));  
254 - //计划班次  
255 - nh_waybillItem.setM_intJHBC(ScheduleCalculator.countJHBC(list));  
256 - //实际计划班次  
257 - nh_waybillItem.setM_intSJJHBC(ScheduleCalculator.countSJJHBC(list));  
258 - //实际班次 ————> 暂时和实际计划班次相同  
259 - nh_waybillItem.setM_intSJBC(ScheduleCalculator.countSJJHBC(list));  
260 - //增加班次  
261 - nh_waybillItem.setM_intZJBC(ScheduleCalculator.countZJBC(list));  
262 - //抽减班次  
263 - nh_waybillItem.setM_intCJBC(ScheduleCalculator.countCJBC(list));  
264 - //烂班工时  
265 - nh_waybillItem.setM_dblLBGS(ScheduleCalculator.calcLBGS(list));  
266 - //路牌  
267 - nh_waybillItem.setM_strLP(list.get(0).getLpName());  
268 - //驾驶员工号  
269 - nh_waybillItem.setM_strJSY(list.get(0).getjGh());  
270 - //售票员工号  
271 - nh_waybillItem.setM_strSPY("");  
272 - for (ScheduleRealInfo sri : list) {  
273 - if (StringUtils.isNotEmpty(sri.getsGh())) {  
274 - nh_waybillItem.setM_strSPY(sri.getsGh());  
275 - break;  
276 - }  
277 - }  
278 - //驾驶员考勤  
279 - nh_waybillItem.setM_strJSYKQ("");  
280 - //售票员考勤  
281 - nh_waybillItem.setM_strSPYKQ("");  
282 - //当班调度员  
283 - nh_waybillItem.setM_strDDY(ScheduleCalculator.calcDDY(list, des));  
284 - //营运状态  
285 - nh_waybillItem.setM_strYYZT("");  
286 - //备注  
287 - nh_waybillItem.setM_strBZ("");  
288 -  
289 - oilInfo = oilInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh());  
290 - if (oilInfo != null && oilInfo.size() > 0) {  
291 - Double czyl = 0., jzyl = 0., jzl = 0., ns = 0., yh = 0.;  
292 - String rylx = "";  
293 - for (OilInfo oi : oilInfo) {  
294 - if (oi.getXlbm().equals(sch.getXlBm())) {  
295 - czyl = Arith.add(czyl, oi.getCzyl());  
296 - jzyl = Arith.add(jzyl, oi.getJzyl());  
297 - jzl = Arith.add(jzl, oi.getJzl());  
298 - ns = Arith.add(ns, oi.getNs());  
299 - yh = Arith.add(yh, oi.getYh());  
300 - rylx = oi.getRylx();  
301 - }  
302 - }  
303 - //出场存油  
304 - nh_waybillItem.setM_dblCCCY(czyl);  
305 - //进场存油  
306 - nh_waybillItem.setM_dblJCCY(jzyl);  
307 - //加注量1  
308 - nh_waybillItem.setM_dblJZL1(jzl);  
309 - //加注量2  
310 - nh_waybillItem.setM_dblJZL2(0.0);  
311 - //尿素  
312 - nh_waybillItem.setM_dblNS(ns);  
313 - //消耗量  
314 - nh_waybillItem.setM_dblYH(yh);  
315 - yhTotal = Arith.add(yhTotal, yh);  
316 - //加油地点1  
317 - nh_waybillItem.setM_strJYD1("");  
318 - //加油地点2  
319 - nh_waybillItem.setM_strJYD2("");  
320 - //加油工工号1  
321 - nh_waybillItem.setM_strJYG1("");  
322 - //加油工工号1  
323 - nh_waybillItem.setM_strJYG2("");  
324 - //油耗类型1  
325 - nh_waybillItem.setM_strYHLX1(rylx);  
326 - //油耗类型2  
327 - nh_waybillItem.setM_strYHLX1("");  
328 - }  
329 -  
330 - /*elecInfo = elecInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh());  
331 - if (elecInfo != null && elecInfo.size() > 0) {  
332 - Double cdl = 0., hd = 0.;  
333 - for (ElecInfo ei : elecInfo) {  
334 - cdl = Arith.add(cdl, ei.getCdl());  
335 - hd = Arith.add(hd, ei.getHd());  
336 - }  
337 - //出场存油  
338 - nh_waybillItem.setM_dblCCCY(100.0);  
339 - //进场存油  
340 - nh_waybillItem.setM_dblJCCY(100.0);  
341 - //加注量1  
342 - nh_waybillItem.setM_dblJZL1(cdl);  
343 - //加注量2  
344 - nh_waybillItem.setM_dblJZL2(0.0);  
345 - //尿素  
346 - nh_waybillItem.setM_dblNS(0.0);  
347 - //消耗量  
348 - nh_waybillItem.setM_dblYH(hd);  
349 - yhTotal = Arith.add(yhTotal, hd);  
350 - //加油地点1  
351 - nh_waybillItem.setM_strJYD1("");  
352 - //加油地点2  
353 - nh_waybillItem.setM_strJYD2("");  
354 - //加油工工号1  
355 - nh_waybillItem.setM_strJYG1("");  
356 - //加油工工号1  
357 - nh_waybillItem.setM_strJYG2("");  
358 - //油耗类型1  
359 - nh_waybillItem.setM_strYHLX1("");  
360 - //油耗类型2  
361 - nh_waybillItem.setM_strYHLX1("");  
362 - }*/  
363 -  
364 - nh_waybill.getM_SubInfos().add(nh_waybillItem);  
365 - }  
366 -  
367 - rs[i] = nh_waybill;  
368 - }  
369 -  
370 - totalItem.setM_dblJHLC(jhlc);  
371 - totalItem.setM_dblSJJHLC(sjjhlc);  
372 - totalItem.setM_dblCCLC(cclc);  
373 - totalItem.setM_dblJCLC(jclc);  
374 - totalItem.setM_dblYYLC(yylc);  
375 - totalItem.setM_dblKSLC(kslc);  
376 - totalItem.setM_dblCJLC(cjlc);  
377 - totalItem.setM_dblLBLC(lblc);  
378 - totalItem.setM_dblZJLC(zjlc);  
379 - totalItem.setM_dblZLC(zlc);  
380 - totalItem.setM_strSPY("");  
381 - totalItem.setM_strJSYKQ("");  
382 - totalItem.setM_strSPYKQ("");  
383 - totalItem.setM_strYYZT("");  
384 - totalItem.setM_strBZ("");  
385 - totalItem.setM_dblYH(yhTotal);  
386 -  
387 - total.getM_SubInfos().add(totalItem);  
388 -  
389 - rs[rs.length - 1] = total;  
390 -  
391 - return rs;  
392 - }  
393 -  
394 - /**  
395 - * 将实际排班、油耗数据、电量数据 转换成南汇路单需要的数据格式  
396 - *  
397 - * @param listMap  
398 - * @param oilInfoMap  
399 - * @return  
400 - */  
401 - public static NH_waybill[] to_waybill_NH4TH(ArrayListMultimap<String, ScheduleRealInfo> listMap, ArrayListMultimap<String, OilInfo> oilInfoMap, ArrayListMultimap<String, ElecInfo> elecInfoMap, List<DutyEmployee> des) throws NoSuchFieldException {  
402 - // 返回值list形态(可转数组)  
403 - List<NH_waybill> result = new ArrayList<>();  
404 - List<String> nbbmArray = new ArrayList<>(listMap.keySet());  
405 -  
406 - Field xlbmField = ScheduleRealInfo.class.getDeclaredField("xlBm"), jGhField = ScheduleRealInfo.class.getDeclaredField("jGh");  
407 -  
408 - List<ScheduleRealInfo> list;  
409 - ArrayListMultimap<String, ScheduleRealInfo> xlBmListMap, jGhListMap;  
410 - ScheduleRealInfo sch;  
411 - NH_waybill nh_waybill;  
412 - NH_waybillItem nh_waybillItem;  
413 - List<OilInfo> oilInfo;  
414 - List<ElecInfo> elecInfo;  
415 - for (int i = 0; i < nbbmArray.size(); i++) {  
416 - list = listMap.get(nbbmArray.get(i));  
417 - if (list.size() == 0) {  
418 - continue;  
419 - }  
420 -  
421 - xlBmListMap = new ConvertUtil<ScheduleRealInfo>().groupMultiList(list, "_", xlbmField);  
422 - for (String xlBm : xlBmListMap.keySet()) {  
423 - list = xlBmListMap.get(xlBm);  
424 -  
425 - //班次信息  
426 - nh_waybill = new NH_waybill();  
427 - sch = list.get(0);  
428 - //日期  
429 - nh_waybill.setM_strYYRQ(sch.getScheduleDateStr());  
430 - //车辆自编号  
431 - nh_waybill.setM_strNBBM(sch.getClZbh());  
432 - //线路编码  
433 - nh_waybill.setM_strXLBM(sch.getXlBm());  
434 - nh_waybill.setM_SubInfos(new ArrayList<NH_waybillItem>());  
435 -  
436 - //按 驾驶员 分组班次,构造路单子项  
437 - jGhListMap = new ConvertUtil<ScheduleRealInfo>().groupMultiList(list, "_", jGhField);  
438 - for (String jGh : jGhListMap.keySet()) {  
439 - list = jGhListMap.get(jGh);  
440 - nh_waybillItem = new NH_waybillItem();  
441 - //计划里程  
442 - nh_waybillItem.setM_dblJHLC(ScheduleCalculator.calcJHLC(list));  
443 - //实际计划公里  
444 - nh_waybillItem.setM_dblSJJHLC(ScheduleCalculator.calcSJLC(list));  
445 - //实际出场里程  
446 - nh_waybillItem.setM_dblCCLC(ScheduleCalculator.calcCCLC(list));  
447 - //实际进场里程  
448 - nh_waybillItem.setM_dblJCLC(ScheduleCalculator.calcJCLC(list));  
449 - //营业公里  
450 - nh_waybillItem.setM_dblYYLC(ScheduleCalculator.calcYYLC(list));  
451 - //空驶公里  
452 - nh_waybillItem.setM_dblKSLC(ScheduleCalculator.calcKSLC(list));  
453 - //抽减公里  
454 - nh_waybillItem.setM_dblCJLC(ScheduleCalculator.calcCJLC(list));  
455 - //烂班公里  
456 - nh_waybillItem.setM_dblLBLC(ScheduleCalculator.calcLBLC(list));  
457 - //增加公里  
458 - nh_waybillItem.setM_dblZJLC(ScheduleCalculator.calcZJLC(list));  
459 - //总公里  
460 - nh_waybillItem.setM_dblZLC(ScheduleCalculator.calcZLC(list));  
461 - //烂班公里原因  
462 - nh_waybillItem.setM_strLBYY(ScheduleCalculator.joinLBYY(list));  
463 - //抽减公里原因  
464 - nh_waybillItem.setM_strCJYY(ScheduleCalculator.joinCJYY(list));  
465 - //计划班次  
466 - nh_waybillItem.setM_intJHBC(ScheduleCalculator.countJHBC(list));  
467 - //实际计划班次  
468 - nh_waybillItem.setM_intSJJHBC(ScheduleCalculator.countSJJHBC(list));  
469 - //实际班次 ————> 暂时和实际计划班次相同  
470 - nh_waybillItem.setM_intSJBC(ScheduleCalculator.countSJJHBC(list));  
471 - //增加班次  
472 - nh_waybillItem.setM_intZJBC(ScheduleCalculator.countZJBC(list));  
473 - //抽减班次  
474 - nh_waybillItem.setM_intCJBC(ScheduleCalculator.countCJBC(list));  
475 - //烂班工时  
476 - nh_waybillItem.setM_dblLBGS(ScheduleCalculator.calcLBGS(list));  
477 - //路牌  
478 - nh_waybillItem.setM_strLP(list.get(0).getLpName());  
479 - //驾驶员工号  
480 - nh_waybillItem.setM_strJSY(list.get(0).getjGh());  
481 - //售票员工号  
482 - nh_waybillItem.setM_strSPY("");  
483 - for (ScheduleRealInfo sri : list) {  
484 - if (StringUtils.isNotEmpty(sri.getsGh())) {  
485 - nh_waybillItem.setM_strSPY(sri.getsGh());  
486 - break;  
487 - }  
488 - }  
489 - //驾驶员考勤  
490 - nh_waybillItem.setM_strJSYKQ("");  
491 - //售票员考勤  
492 - nh_waybillItem.setM_strSPYKQ("");  
493 - //当班调度员  
494 - nh_waybillItem.setM_strDDY(ScheduleCalculator.calcDDY(list, des));  
495 - //营运状态  
496 - nh_waybillItem.setM_strYYZT("");  
497 - //备注  
498 - nh_waybillItem.setM_strBZ("");  
499 -  
500 - oilInfo = oilInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh());  
501 - if (oilInfo != null && oilInfo.size() > 0) {  
502 - Double czyl = 0., jzyl = 0., jzl = 0., ns = 0., yh = 0.;  
503 - String rylx = "";  
504 - for (OilInfo oi : oilInfo) {  
505 - if (oi.getXlbm().equals(sch.getXlBm())) {  
506 - czyl = Arith.add(czyl, oi.getCzyl());  
507 - jzyl = Arith.add(jzyl, oi.getJzyl());  
508 - jzl = Arith.add(jzl, oi.getJzl());  
509 - ns = Arith.add(ns, oi.getNs());  
510 - yh = Arith.add(yh, oi.getYh());  
511 - rylx = oi.getRylx();  
512 - }  
513 - }  
514 - //出场存油  
515 - nh_waybillItem.setM_dblCCCY(czyl);  
516 - //进场存油  
517 - nh_waybillItem.setM_dblJCCY(jzyl);  
518 - //加注量1  
519 - nh_waybillItem.setM_dblJZL1(jzl);  
520 - //加注量2  
521 - nh_waybillItem.setM_dblJZL2(0.0);  
522 - //尿素  
523 - nh_waybillItem.setM_dblNS(ns);  
524 - //消耗量  
525 - nh_waybillItem.setM_dblYH(yh);  
526 - //加油地点1  
527 - nh_waybillItem.setM_strJYD1("");  
528 - //加油地点2  
529 - nh_waybillItem.setM_strJYD2("");  
530 - //加油工工号1  
531 - nh_waybillItem.setM_strJYG1("");  
532 - //加油工工号1  
533 - nh_waybillItem.setM_strJYG2("");  
534 - //油耗类型1  
535 - nh_waybillItem.setM_strYHLX1(rylx);  
536 - //油耗类型2  
537 - nh_waybillItem.setM_strYHLX1("");  
538 - }  
539 -  
540 - elecInfo = elecInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh());  
541 - if (elecInfo != null && elecInfo.size() > 0) {  
542 - Double cdl = 0., hd = 0.;  
543 - for (ElecInfo ei : elecInfo) {  
544 - cdl = Arith.add(cdl, ei.getCdl());  
545 - hd = Arith.add(hd, ei.getHd());  
546 - }  
547 - //出场存油  
548 - nh_waybillItem.setM_dblCCCY(100.0);  
549 - //进场存油  
550 - nh_waybillItem.setM_dblJCCY(100.0);  
551 - //加注量1  
552 - nh_waybillItem.setM_dblJZL1(cdl);  
553 - //加注量2  
554 - nh_waybillItem.setM_dblJZL2(0.0);  
555 - //尿素  
556 - nh_waybillItem.setM_dblNS(0.0);  
557 - //消耗量  
558 - nh_waybillItem.setM_dblYH(hd);  
559 - //加油地点1  
560 - nh_waybillItem.setM_strJYD1("");  
561 - //加油地点2  
562 - nh_waybillItem.setM_strJYD2("");  
563 - //加油工工号1  
564 - nh_waybillItem.setM_strJYG1("");  
565 - //加油工工号1  
566 - nh_waybillItem.setM_strJYG2("");  
567 - //油耗类型1  
568 - nh_waybillItem.setM_strYHLX1("");  
569 - //油耗类型2  
570 - nh_waybillItem.setM_strYHLX1("");  
571 - }  
572 -  
573 - nh_waybill.getM_SubInfos().add(nh_waybillItem);  
574 - }  
575 -  
576 - result.add(nh_waybill);  
577 - }  
578 - }  
579 -  
580 - return result.toArray(new NH_waybill[result.size()]);  
581 - }  
582 -  
583 -  
584 - /**  
585 - * 将实际排班和油耗数据 转换成上南路单需要的数据格式  
586 - *  
587 - * @param listMap  
588 - * @param oilInfoMap  
589 - * @return  
590 - */  
591 - public static SN_waybill[] to_waybill_SN(ArrayListMultimap<String, ScheduleRealInfo> listMap, Map<String, OilInfo> oilInfoMap) throws NoSuchFieldException {  
592 -  
593 - List<String> nbbmArray = new ArrayList<>(listMap.keySet());  
594 - SN_waybill[] rs = new SN_waybill[nbbmArray.size()];  
595 - Field jGhField = ScheduleRealInfo.class.getDeclaredField("jGh");  
596 -  
597 - List<ScheduleRealInfo> list;  
598 - ArrayListMultimap<String, ScheduleRealInfo> jGhListMap;  
599 - ScheduleRealInfo sch;  
600 - SN_waybill sn_waybill;  
601 - SN_waybillItem sn_waybillItem;  
602 -  
603 - OilComp oilComp = new OilComp();  
604 - List<OilInfo> oilArray;  
605 - for (int i = 0; i < nbbmArray.size(); i++) {  
606 - list = listMap.get(nbbmArray.get(i));  
607 - if (list.size() == 0)  
608 - continue;  
609 -  
610 - sch = list.get(0);  
611 - sn_waybill = new SN_waybill();  
612 - sn_waybill.setLine_no(sch.getXlBm());  
613 - sn_waybill.setWork_date(sch.getScheduleDateStr());  
614 - sn_waybill.setComp_id(sch.getFgsBm());  
615 - sn_waybill.setGuidecard(sch.getLpName());  
616 - sn_waybill.setCar_id(sch.getClZbh());  
617 - //实际班次  
618 - sn_waybill.setAct_num(ScheduleCalculator.countSJJHBC(list));  
619 - //晚班实际班次  
620 - sn_waybill.setL_act_num(ScheduleCalculator.countSJJHBC(ScheduleCalculator.lastArray(list)));  
621 - //营业里程  
622 - sn_waybill.setWork_way(ScheduleCalculator.calcYYLC(list));  
623 - //空驶里程  
624 - sn_waybill.setLeisure_way(ScheduleCalculator.calcKSLC(list));  
625 - //总里程  
626 - sn_waybill.setCount_way(ScheduleCalculator.calcZLC(list));  
627 - //路单类型(0普通,1包车)  
628 - sn_waybill.setLd_type("0");  
629 - //油料类型(2、柴油 3、天然气 4、汽油柴油 5、液化气 6、液化气汽油 7、液化气柴油 8、天然气汽油 9、电)  
630 - //暂时全部柴油车  
631 - sn_waybill.setOil_type("2");  
632 -  
633 - //根据车辆获取油量信息  
634 - oilArray = likeGet(oilInfoMap, sch.getClZbh() + "_");  
635 - if (oilArray.size() > 0) {  
636 - Collections.sort(oilArray, oilComp);  
637 - //出厂存油  
638 - sn_waybill.setOut_oil(oilArray.get(0).getCzyl());  
639 - //油料加注  
640 - sn_waybill.setAdd_oil(sumAddOil(oilArray));  
641 - //进场存油  
642 - sn_waybill.setEnd_oil(oilArray.get(oilArray.size() - 1).getJzyl());  
643 - //油料消耗  
644 - sn_waybill.setExpend_oil(countOilExpend(oilArray));  
645 - //非营业用油类型 非营业用油类型(1.常规车2.包车3.加开包车)  
646 - sn_waybill.setNowork_oil_type("1");  
647 - //非营业用油  
648 - sn_waybill.setNowork_oil(0);  
649 - //非营业用油油耗量(保养用油)  
650 - sn_waybill.setNowork_oil1(0);  
651 - //非营业用油油耗量(票务用油)  
652 - sn_waybill.setNowork_oil2(0);  
653 - //非营业用油油耗量(其他用油)  
654 - sn_waybill.setNowork_oil3(0);  
655 - //营业用油  
656 - sn_waybill.setWork_oil(countOilExpend(oilArray));  
657 - //其他营业用油  
658 - sn_waybill.setQt_work_oil(0);  
659 - }  
660 - sn_waybill.setDriver_detail(new ArrayList<SN_waybillItem>());  
661 -  
662 - //按 驾驶员 分组班次,构造路单子项  
663 - jGhListMap = new ConvertUtil<ScheduleRealInfo>().groupMultiList(list, "_", jGhField);  
664 - for (String jGh : jGhListMap.keySet()) {  
665 - list = jGhListMap.get(jGh);  
666 - sn_waybillItem = new SN_waybillItem();  
667 - sch = list.get(0);  
668 - //司机编号  
669 - sn_waybillItem.setDriver_no(sch.getjGh());  
670 - //司机名称  
671 - sn_waybillItem.setDriver_name(sch.getjName());  
672 - //售票员编号  
673 - sn_waybillItem.setBusman_no(sch.getsGh());  
674 - //售票员名称  
675 - sn_waybillItem.setBusman_name(sch.getsName());  
676 - //行驶里程  
677 - sn_waybillItem.setDriver_way(ScheduleCalculator.calcYYLC(list));  
678 - //空驶公里  
679 - sn_waybillItem.setKs_way(ScheduleCalculator.calcKSLC(list));  
680 - //柴油加注量、电加注量同一字段  
681 - sn_waybillItem.setDo_oil_2(countOilExpend(oilArray, sch.getjGh()));  
682 -  
683 - sn_waybill.getDriver_detail().add(sn_waybillItem);  
684 - }  
685 -  
686 - rs[i] = sn_waybill;  
687 - }  
688 - return rs;  
689 - }  
690 -  
691 - /**  
692 - * 将实际排班转换成上南需要损失公里数据  
693 - *  
694 - * @param listMap  
695 - * @return  
696 - */  
697 - public static SN_lossMileage[] to_lossMileage_SN(ArrayListMultimap<String, ScheduleRealInfo> listMap) throws NoSuchFieldException {  
698 - List<String> lineArray = new ArrayList<>(listMap.keySet());  
699 - SN_lossMileage[] rs = new SN_lossMileage[lineArray.size()];  
700 -  
701 - List<ScheduleRealInfo> list;  
702 - ScheduleRealInfo sch;  
703 - for (int i = 0; i < lineArray.size(); i++) {  
704 - list = listMap.get(lineArray.get(i));  
705 -  
706 - sch = list.get(0);  
707 - SN_lossMileage lossMileage = new SN_lossMileage();  
708 - //线路编号  
709 - lossMileage.setLine_id(sch.getXlBm());  
710 - //营运日期  
711 - lossMileage.setWork_date(sch.getScheduleDateStr());  
712 - //分公司编号  
713 - lossMileage.setComp_id(sch.getFgsBm());  
714 - //少驶公里  
715 - lossMileage.setLoss_way(ScheduleCalculator.calcCJLC(list));  
716 - //实际公里  
717 - lossMileage.setAct_way(ScheduleCalculator.calcYYLC(list));  
718 - //计划公里  
719 - lossMileage.setJh_way(ScheduleCalculator.calcJHLC(list));  
720 -  
721 - //路阻损失公里  
722 - lossMileage.setLoss_lz(ScheduleCalculator.calcCJLC2(list, "路阻"));  
723 - //吊慢损失公里  
724 - lossMileage.setLoss_dm(ScheduleCalculator.calcCJLC2(list, "吊慢"));  
725 - //故障损失公里  
726 - lossMileage.setLoss_gz(ScheduleCalculator.calcCJLC2(list, "故障"));  
727 - //纠纷损失公里  
728 - lossMileage.setLoss_jf(ScheduleCalculator.calcCJLC2(list, "纠纷"));  
729 - //肇事损失公里  
730 - lossMileage.setLoss_zs(ScheduleCalculator.calcCJLC2(list, "肇事"));  
731 - //缺人损失公里  
732 - lossMileage.setLoss_qr(ScheduleCalculator.calcCJLC2(list, "缺人"));  
733 - //缺车损失公里  
734 - lossMileage.setLoss_qc(ScheduleCalculator.calcCJLC2(list, "缺车"));  
735 - //客稀损失公里  
736 - lossMileage.setLoss_kx(ScheduleCalculator.calcCJLC2(list, "客稀"));  
737 - //其他损失公里  
738 - lossMileage.setLoss_qt(ScheduleCalculator.calcCJLC2(list, "其他"));  
739 - //配车损失公里  
740 - lossMileage.setLoss_pc(ScheduleCalculator.calcCJLC2(list, "配车"));  
741 - //保养损失公里  
742 - lossMileage.setLoss_by(ScheduleCalculator.calcCJLC2(list, "保养"));  
743 - //气候损失公里  
744 - lossMileage.setLoss_qh(ScheduleCalculator.calcCJLC2(list, "气候"));  
745 - //援外损失公里  
746 - lossMileage.setLoss_yw(ScheduleCalculator.calcCJLC2(list, "援外"));  
747 - //抽减损失公里  
748 - lossMileage.setLoss_cj(ScheduleCalculator.calcCJLC2(list, "抽减"));  
749 -  
750 - //实际班次  
751 - lossMileage.setAct_num(ScheduleCalculator.countSJJHBC(list));  
752 - //早班班次  
753 - lossMileage.setEarly_num(ScheduleCalculator.countSJJHBC(ScheduleCalculator.earlyArray(list)));  
754 - //晚班班次  
755 - lossMileage.setLate_num(ScheduleCalculator.countSJJHBC(ScheduleCalculator.lastArray(list)));  
756 - //另加班次  
757 - lossMileage.setL_act_num(ScheduleCalculator.countZJBC(list));  
758 - //早班另加班次  
759 - lossMileage.setL_early_num(ScheduleCalculator.countZJBC(ScheduleCalculator.earlyArray(list)));  
760 - //晚班另加班次  
761 - lossMileage.setL_late_num(ScheduleCalculator.countZJBC(ScheduleCalculator.lastArray(list)));  
762 - //计划班次  
763 - lossMileage.setJ_act_num(ScheduleCalculator.countJHBC(list));  
764 - //早班计划班次  
765 - lossMileage.setJ_early_num(ScheduleCalculator.countJHBC(ScheduleCalculator.earlyArray(list)));  
766 - //晚班计划班次  
767 - lossMileage.setJ_late_num(ScheduleCalculator.countJHBC(ScheduleCalculator.lastArray(list)));  
768 - //放站班次  
769 - lossMileage.setF_act_bc(ScheduleCalculator.countEmpty(list));  
770 - //早班放站班次  
771 - lossMileage.setF_early_bc(ScheduleCalculator.countEmpty(ScheduleCalculator.earlyArray(list)));  
772 - //晚班放站班次  
773 - lossMileage.setF_late_bc(ScheduleCalculator.countEmpty(ScheduleCalculator.lastArray(list)));  
774 - //调头班次  
775 - lossMileage.setDt_act_bc(0);  
776 - //早班调头班次  
777 - lossMileage.setDt_early_bc(0);  
778 - //晚班调头班次  
779 - lossMileage.setDt_late_bc(0);  
780 - //大间隔班次  
781 - lossMileage.setD_act_num(ScheduleCalculator.countSpaceLg(list));  
782 - //早班大间隔班次  
783 - lossMileage.setD_early_num(ScheduleCalculator.countSpaceLg(ScheduleCalculator.earlyArray(list)));  
784 - //晚班大间隔班次  
785 - lossMileage.setD_late_num(ScheduleCalculator.countSpaceLg(ScheduleCalculator.lastArray(list)));  
786 - //最大间隔时间  
787 - lossMileage.setD_act_max(ScheduleCalculator.calcMaxSpace(list));  
788 - //故障分  
789 - lossMileage.setLoss_gzf(0);  
790 - //故障次数  
791 - lossMileage.setLoss_gzcs(0);  
792 -  
793 -  
794 - rs[i] = lossMileage;  
795 - }  
796 - return rs;  
797 - }  
798 -  
799 - private static double countOilExpend(List<OilInfo> oilArray) {  
800 - double sum = 0;  
801 - for (OilInfo oilInfo : oilArray) {  
802 - sum = Arith.add(sum, oilInfo.getYh());  
803 - }  
804 - return sum;  
805 - }  
806 -  
807 - private static double sumAddOil(List<OilInfo> oilArray) {  
808 - double sum = 0;  
809 - for (OilInfo oilInfo : oilArray) {  
810 - sum = Arith.add(sum, oilInfo.getJzl());  
811 - }  
812 - return sum;  
813 - }  
814 -  
815 - private static double countOilExpend(List<OilInfo> oilArray, String jGh) {  
816 - double sum = 0;  
817 - for (OilInfo oilInfo : oilArray) {  
818 - if (oilInfo.getJsy().equals(jGh))  
819 - sum = Arith.add(sum, oilInfo.getYh());  
820 - }  
821 - return sum;  
822 - }  
823 -  
824 - public static <T> List<T> likeGet(Map<String, T> map, String key) {  
825 - Set<String> ks = map.keySet();  
826 - List<T> list = new ArrayList<>();  
827 -  
828 - if (StringUtils.isEmpty(key))  
829 - return list;  
830 -  
831 - for (String k : ks) {  
832 - if (k.indexOf(key) != -1) {  
833 - list.add(map.get(k));  
834 - }  
835 - }  
836 - return list;  
837 - }  
838 -  
839 - /**  
840 - * 将数据转换成南汇工资系统需要的驾驶员考勤数据  
841 - *  
842 - * @param plans  
843 - * @param reals  
844 - * @param types  
845 - * @return  
846 - */  
847 - public static Jsy_attendance[] to_jsyAttendanceNH(List<SchedulePlanInfo> plans, List<ScheduleRealInfo> reals, Set<String> jsySet, Map<String, String> types, String rq) {  
848 - //List<String> ghArray = new ArrayList<>(types.keySet());  
849 - List<Jsy_attendance> rs = new ArrayList<Jsy_attendance>();  
850 - for (String jGh : jsySet) {  
851 - List<SchedulePlanInfo> tplans = searchByJsy(plans, jGh);  
852 - List<ScheduleRealInfo> treals = searchRealByJsy(reals, jGh);  
853 - Set<String> lines = new HashSet<String>();  
854 - for (SchedulePlanInfo p : tplans) {  
855 - lines.add(p.getXlBm());  
856 - }  
857 - for (ScheduleRealInfo r : treals) {  
858 - lines.add(r.getXlBm());  
859 - }  
860 - for (String line : lines) {  
861 - Jsy_attendance attendance = new Jsy_attendance();  
862 - SchedulePlanInfo plan = null;  
863 - ScheduleRealInfo real = null;  
864 - for (SchedulePlanInfo p : tplans) {  
865 - if (line.equals(p.getXlBm())) {  
866 - plan = p;  
867 - break;  
868 - }  
869 - }  
870 - for (ScheduleRealInfo r : treals) {  
871 - if (line.equals(r.getXlBm())) {  
872 - real = r;  
873 - break;  
874 - }  
875 - }  
876 - attendance.setRq(rq);  
877 - //考勤  
878 - attendance.setStatus((plan==null?"0":"1") + "," + (real==null?"0":"1"));  
879 - //班型  
880 - attendance.setPlanType(types.get(jGh)==null?"1":types.get(jGh));  
881 - //驾驶员工号  
882 - attendance.setjGh(jGh);  
883 - //早晚班类型  
884 - attendance.calcZybType(reals);  
885 -  
886 - //实际计划  
887 - if(real != null){  
888 - attendance.setXlBm(real.getXlBm());  
889 - attendance.setXlName(real.getXlName());  
890 - attendance.setjName(real.getjName());  
891 - attendance.setsGh(real.getsGh());  
892 - attendance.setsName(real.getsName());  
893 - attendance.setCompany(real.getGsBm());  
894 - attendance.setFgsCompany(real.getFgsBm());  
895 - attendance.addLpName(real.getLpName());  
896 - attendance.addCl(real.getClZbh());  
897 - }  
898 - //计划  
899 - else if(plan != null){  
900 - attendance.setXlBm(plan.getXlBm());  
901 - attendance.setXlName(plan.getXlName());  
902 - attendance.setjName(plan.getjName());  
903 - attendance.setsGh(plan.getsGh());  
904 - attendance.setsName(plan.getsName());  
905 - attendance.setCompany(plan.getGsBm());  
906 - attendance.setFgsCompany(plan.getFgsBm());  
907 - attendance.addLpName(plan.getLpName());  
908 - attendance.addCl(plan.getClZbh());  
909 - }  
910 -  
911 - rs.add(attendance);  
912 - }  
913 - }  
914 -  
915 - return rs.toArray(new Jsy_attendance[rs.size()]);  
916 - }  
917 -  
918 - /**  
919 - * 将数据转换成南汇工资系统需要的考勤数据(司/售) 版本2  
920 - *  
921 - * @param plans  
922 - * @param reals  
923 - * @param types  
924 - * @return  
925 - */  
926 - public static Ssry_attendance[] toAttendanceNH(List<SchedulePlanInfo> plans, List<ScheduleRealInfo> reals, Set<String> jsys, Set<String> spys, String rq) {  
927 - //List<String> ghArray = new ArrayList<>(types.keySet());  
928 - List<Ssry_attendance> rs = new ArrayList<Ssry_attendance>();  
929 - for (String jGh : jsys) {  
930 - List<SchedulePlanInfo> tplans = searchByGh(plans, jGh, 1);  
931 - List<ScheduleRealInfo> treals = searchRealByGh(reals, jGh, 1);  
932 - padding(reals, tplans, treals, jGh, rq, 1, rs);  
933 - }  
934 -  
935 - for (String sGh : spys) {  
936 - List<SchedulePlanInfo> tplans = searchByGh(plans, sGh, 2);  
937 - List<ScheduleRealInfo> treals = searchRealByGh(reals, sGh, 2);  
938 - padding(reals, tplans, treals, sGh, rq, 2, rs);  
939 - }  
940 -  
941 - return rs.toArray(new Ssry_attendance[rs.size()]);  
942 - }  
943 -  
944 - private static void padding(List<ScheduleRealInfo> reals, List<SchedulePlanInfo> tplans, List<ScheduleRealInfo> treals, String gh, String rq, int yglx, List<Ssry_attendance> rs) {  
945 - Set<String> lines = new HashSet<String>();  
946 - for (SchedulePlanInfo p : tplans) {  
947 - lines.add(p.getXlBm());  
948 - }  
949 - for (ScheduleRealInfo r : treals) {  
950 - lines.add(r.getXlBm());  
951 - }  
952 - for (String line : lines) {  
953 - Ssry_attendance attendance = new Ssry_attendance();  
954 - SchedulePlanInfo plan = null;  
955 - ScheduleRealInfo real = null;  
956 - Set<String> cls = new HashSet<String>(), lps = new HashSet<String>();  
957 - for (SchedulePlanInfo p : tplans) {  
958 - if (line.equals(p.getXlBm())) {  
959 - plan = p;  
960 - cls.add(p.getClZbh());  
961 - lps.add(p.getLpName());  
962 - }  
963 - }  
964 - for (ScheduleRealInfo r : treals) {  
965 - if (line.equals(r.getXlBm())) {  
966 - real = r;  
967 - cls.add(r.getClZbh());  
968 - lps.add(r.getLpName());  
969 - }  
970 - }  
971 - for (String cl : cls) {  
972 - attendance.addCl(cl);  
973 - }  
974 - for (String lp : lps) {  
975 - attendance.addLpName(lp);  
976 - }  
977 - attendance.setYglx(yglx);  
978 - attendance.setRq(rq);  
979 - //考勤  
980 - attendance.setStatus((plan==null?"0":"1") + "," + (real==null?"0":"1"));  
981 - //驾驶员工号  
982 - attendance.setGh(gh);  
983 - //早晚班类型  
984 - attendance.calcZybType(reals);  
985 -  
986 - String name = null;  
987 - //实际计划  
988 - if(real != null){  
989 - attendance.setXlBm(real.getXlBm());  
990 - attendance.setXlName(real.getXlName());  
991 - if (yglx == 1) {  
992 - name = real.getjName();  
993 - } else if (yglx == 2) {  
994 - name = real.getsName();  
995 - }  
996 - }  
997 - //计划  
998 - else if(plan != null){  
999 - attendance.setXlBm(plan.getXlBm());  
1000 - attendance.setXlName(plan.getXlName());  
1001 - if (yglx == 1) {  
1002 - name = plan.getjName();  
1003 - } else if (yglx == 2) {  
1004 - name = plan.getsName();  
1005 - }  
1006 - }  
1007 - attendance.setName(name);  
1008 -  
1009 - rs.add(attendance);  
1010 - }  
1011 - }  
1012 -  
1013 - public static List<SchedulePlanInfo> searchByJsy(List<SchedulePlanInfo> plans, String jGh){  
1014 - List<SchedulePlanInfo> rs = new ArrayList<SchedulePlanInfo>();  
1015 - String oldLineId = "0";  
1016 - for(SchedulePlanInfo plan : plans){  
1017 - if (plan.getjGh().equals(jGh) && !oldLineId.equals(plan.getXlBm())) {  
1018 - rs.add(plan);  
1019 - oldLineId = plan.getXlBm();  
1020 - }  
1021 - }  
1022 -  
1023 - return rs;  
1024 - }  
1025 -  
1026 - public static List<SchedulePlanInfo> searchByGh(List<SchedulePlanInfo> plans, String gh, int yglx){  
1027 - List<SchedulePlanInfo> rs = new ArrayList<SchedulePlanInfo>();  
1028 - for(SchedulePlanInfo plan : plans){  
1029 - String tgh = null;  
1030 - if (yglx == 1) {  
1031 - tgh = plan.getjGh();  
1032 - } else if (yglx == 2) {  
1033 - tgh = plan.getsGh();  
1034 - }  
1035 - if (gh.equals(tgh)) {  
1036 - rs.add(plan);  
1037 - }  
1038 - }  
1039 -  
1040 - return rs;  
1041 - }  
1042 -  
1043 - public static List<ScheduleRealInfo> searchRealByJsy(List<ScheduleRealInfo> reals, String jGh){  
1044 - List<ScheduleRealInfo> rs = new ArrayList<ScheduleRealInfo>();  
1045 - String oldLineId = "0";  
1046 - for(ScheduleRealInfo sch : reals){  
1047 - if (sch.getjGh().equals(jGh) && !oldLineId.equals(sch.getXlBm())) {  
1048 - rs.add(sch);  
1049 - oldLineId = sch.getXlBm();  
1050 - }  
1051 - }  
1052 -  
1053 - return rs;  
1054 - }  
1055 -  
1056 - public static List<ScheduleRealInfo> searchRealByGh(List<ScheduleRealInfo> reals, String gh, int yglx){  
1057 - List<ScheduleRealInfo> rs = new ArrayList<ScheduleRealInfo>();  
1058 - for(ScheduleRealInfo sch : reals){  
1059 - String tgh = null;  
1060 - if (yglx == 1) {  
1061 - tgh = sch.getjGh();  
1062 - } else if (yglx == 2) {  
1063 - tgh = sch.getsGh();  
1064 - }  
1065 - if (gh.equals(tgh)) {  
1066 - rs.add(sch);  
1067 - }  
1068 - }  
1069 -  
1070 - return rs;  
1071 - }  
1072 -  
1073 - /**  
1074 - * 将排班和油耗转换成综合查询需要的数据  
1075 - * @param schList  
1076 - * @param oilList  
1077 - * @return  
1078 - */  
1079 - public static String[] to_getLSLC_PB(String fdate, List<ScheduleRealInfo> schList, List<OilInfo> oilList, List<SchedulePlanInfo> planList) {  
1080 - String[] array = new String[0];  
1081 - try {  
1082 - //按日期分组数据  
1083 - ArrayListMultimap<String, ScheduleRealInfo> schMultimap =  
1084 - new ConvertUtil().groupMultiList(schList, "_", ScheduleRealInfo.class.getDeclaredField("scheduleDateStr"));  
1085 -  
1086 - ArrayListMultimap<String, OilInfo> oilMultimap =  
1087 - new ConvertUtil().groupMultiList(oilList, "_", OilInfo.class.getDeclaredField("rq"));  
1088 -  
1089 - ArrayListMultimap<String, SchedulePlanInfo> planMultimap =  
1090 - new ConvertUtil().groupMultiList(planList, "_", SchedulePlanInfo.class.getDeclaredField("scheduleDate"));  
1091 -  
1092 -  
1093 - //月份有多少天  
1094 - int year = Integer.parseInt(fdate.substring(0, 4));  
1095 - int month = Integer.parseInt(fdate.substring(5, 7));  
1096 - Calendar cal = Calendar.getInstance();  
1097 - cal.set(Calendar.YEAR,year);  
1098 - cal.set(Calendar.MONTH,month - 1);//从0开始  
1099 - int maxDate = cal.getActualMaximum(Calendar.DATE);  
1100 -  
1101 - List<LsLcPb> rs = new ArrayList<>();  
1102 - LsLcPb lcPb;  
1103 - List<ScheduleRealInfo> pbList;  
1104 - List<SchedulePlanInfo> jhList;  
1105 - List<OilInfo> yhList;  
1106 - String rq,rq2;  
1107 - SchedulePlanInfo outPlan;  
1108 - int currentDay = cal.get(Calendar.DAY_OF_MONTH);  
1109 - for(int i = 1; i <= maxDate; i++){  
1110 - lcPb = new LsLcPb();  
1111 - lcPb.setDay(i);  
1112 -  
1113 - rq = fdate + "-" + (i < 10?"0":"") + i;  
1114 - rq2 = rq.replaceAll("-", "");  
1115 -  
1116 - pbList = schMultimap.get(rq);  
1117 - yhList = oilMultimap.get(rq2);  
1118 - jhList = planMultimap.get(rq2);  
1119 -  
1120 - if(i < currentDay){  
1121 - if(pbList == null || pbList.size() == 0)  
1122 - lcPb.setType(4);//休息  
1123 - else{  
1124 - lcPb.setType(1);  
1125 - lcPb.setLckq("");  
1126 - if(yhList != null && yhList.size() > 0){  
1127 - lcPb.setLcyh(yhList.get(0).getYh());  
1128 - }  
1129 - lcPb.setLcyylc(ScheduleCalculator.calcYYLC(pbList));  
1130 - lcPb.setLcfyylc(ScheduleCalculator.calcKSLC(pbList));  
1131 - }  
1132 - }  
1133 - else if (i == currentDay)  
1134 - lcPb.setType(3);//今天  
1135 - else {  
1136 - if(jhList == null || jhList.size() == 0)  
1137 - lcPb.setType(4);//休息  
1138 - else{  
1139 - lcPb.setType(2);  
1140 - outPlan = getOutSch(jhList);  
1141 - if(null != outPlan){  
1142 - lcPb.setPbxl(outPlan.getXlName());  
1143 - lcPb.setPblp(outPlan.getLpName());  
1144 - lcPb.setPbbd(minusMinute(outPlan.getFcsj(), 15));  
1145 - lcPb.setPbyc(outPlan.getClZbh());  
1146 - }  
1147 - else  
1148 - lcPb.setType(4);//休息  
1149 - }  
1150 - }  
1151 -  
1152 - rs.add(lcPb);  
1153 - }  
1154 -  
1155 - //拼接成字符串数组  
1156 - array = new String[rs.size()];  
1157 - StringBuilder sb;  
1158 - for(int i = 0,len=rs.size(); i < len; i++){  
1159 - lcPb = rs.get(i);  
1160 - sb = new StringBuilder();  
1161 -  
1162 - sb.append(lcPb.getType());  
1163 -  
1164 - switch (lcPb.getType()){  
1165 - case 1:  
1166 - sb.append("," + lcPb.getLckq());  
1167 - sb.append("," + lcPb.getLcyh());  
1168 - sb.append("," + lcPb.getLcyylc());  
1169 - sb.append("," + lcPb.getLcfyylc());  
1170 - break;  
1171 - case 2:  
1172 - sb.append("," + lcPb.getPbxl());  
1173 - sb.append("," + lcPb.getPblp());  
1174 - sb.append("," + lcPb.getPbbd());  
1175 - sb.append("," + lcPb.getPbyc());  
1176 - break;  
1177 - }  
1178 - sb.append("," + lcPb.getDay());  
1179 - array[i] = sb.toString();  
1180 - }  
1181 - } catch (NoSuchFieldException e) {  
1182 - logger.error("", e);  
1183 - }  
1184 - return array;  
1185 - }  
1186 -  
1187 - /**  
1188 - * 将排班和油耗转换成综合查询需要的数据  
1189 - * @param schList  
1190 - * @param oilList  
1191 - * @return  
1192 - */  
1193 - public static List<LsLcPb> to_getLSLC_PB_list(String fdate, List<ScheduleRealInfo> schList, List<OilInfo> oilList, List<SchedulePlanInfo> planList) {  
1194 - List<LsLcPb> rs = new ArrayList<>();  
1195 - try {  
1196 - //按日期分组数据  
1197 - ArrayListMultimap<String, ScheduleRealInfo> schMultimap =  
1198 - new ConvertUtil().groupMultiList(schList, "_", ScheduleRealInfo.class.getDeclaredField("scheduleDateStr"));  
1199 -  
1200 - ArrayListMultimap<String, OilInfo> oilMultimap =  
1201 - new ConvertUtil().groupMultiList(oilList, "_", OilInfo.class.getDeclaredField("rq"));  
1202 -  
1203 - ArrayListMultimap<String, SchedulePlanInfo> planMultimap =  
1204 - new ConvertUtil().groupMultiList(planList, "_", SchedulePlanInfo.class.getDeclaredField("scheduleDate"));  
1205 -  
1206 -  
1207 - //月份有多少天  
1208 - int year = Integer.parseInt(fdate.substring(0, 4));  
1209 - int month = Integer.parseInt(fdate.substring(5, 7));  
1210 - Calendar cal = Calendar.getInstance();  
1211 - cal.set(Calendar.YEAR,year);  
1212 - cal.set(Calendar.MONTH,month - 1);//从0开始  
1213 - int maxDate = cal.getActualMaximum(Calendar.DATE);  
1214 -  
1215 - LsLcPb lcPb;  
1216 - List<ScheduleRealInfo> pbList;  
1217 - List<SchedulePlanInfo> jhList;  
1218 - List<OilInfo> yhList;  
1219 - String rq,rq2;  
1220 - SchedulePlanInfo outPlan;  
1221 - int currentDay = cal.get(Calendar.DAY_OF_MONTH);  
1222 - for(int i = 1; i <= maxDate; i++){  
1223 - lcPb = new LsLcPb();  
1224 - lcPb.setDay(i);  
1225 -  
1226 - rq = fdate + "-" + (i < 10?"0":"") + i;  
1227 - rq2 = rq.replaceAll("-", "");  
1228 -  
1229 - pbList = schMultimap.get(rq);  
1230 - yhList = oilMultimap.get(rq2);  
1231 - jhList = planMultimap.get(rq2);  
1232 -  
1233 - if(i < currentDay){  
1234 - if(pbList == null || pbList.size() == 0)  
1235 - lcPb.setType(4);//休息  
1236 - else{  
1237 - lcPb.setType(1);  
1238 - lcPb.setLckq("");  
1239 - if(yhList != null && yhList.size() > 0){  
1240 - lcPb.setLcyh(yhList.get(0).getYh());  
1241 - }  
1242 - lcPb.setLcyylc(ScheduleCalculator.calcYYLC(pbList));  
1243 - lcPb.setLcfyylc(ScheduleCalculator.calcKSLC(pbList));  
1244 - }  
1245 - }  
1246 - else if (i == currentDay)  
1247 - lcPb.setType(3);//今天  
1248 - else {  
1249 - if(jhList == null || jhList.size() == 0)  
1250 - lcPb.setType(4);//休息  
1251 - else{  
1252 - lcPb.setType(2);  
1253 - outPlan = getOutSch(jhList);  
1254 - if(null != outPlan){  
1255 - lcPb.setPbxl(outPlan.getXlName());  
1256 - lcPb.setPblp(outPlan.getLpName());  
1257 - lcPb.setPbbd(minusMinute(outPlan.getFcsj(), 15));  
1258 - lcPb.setPbyc(outPlan.getClZbh());  
1259 - }  
1260 - else  
1261 - lcPb.setType(4);//休息  
1262 - }  
1263 - }  
1264 -  
1265 - rs.add(lcPb);  
1266 - }  
1267 - } catch (NoSuchFieldException e) {  
1268 - logger.error("", e);  
1269 - }  
1270 - return rs;  
1271 - }  
1272 -  
1273 - /**  
1274 - * HH:mm 格式时间减分钟  
1275 - * @param dfsj  
1276 - * @param i  
1277 - * @return  
1278 - */  
1279 - private static String minusMinute(String hhmm, int i) {  
1280 - try {  
1281 - SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");  
1282 - long t = sdf.parse(hhmm).getTime();  
1283 -  
1284 - return sdf.format(new Date(t - (i * 60 * 1000)));  
1285 - } catch (ParseException e) {  
1286 - logger.error("", e);  
1287 - }  
1288 - return null;  
1289 - }  
1290 -  
1291 - private static SchedulePlanInfo getOutSch(List<SchedulePlanInfo> pbList) {  
1292 -  
1293 - for(SchedulePlanInfo sch : pbList){  
1294 - if(sch.getBcType().equals("out"))  
1295 - return sch;  
1296 - }  
1297 - return null;  
1298 - }  
1299 -  
1300 - public static class OilComp implements Comparator<OilInfo> {  
1301 -  
1302 - @Override  
1303 - public int compare(OilInfo o1, OilInfo o2) {  
1304 - return o1.getJcsx() - o2.getJcsx();  
1305 - }  
1306 - }  
1307 -  
1308 -  
1309 -} 1 +package com.bsth.server_ws.util;
  2 +
  3 +import java.lang.reflect.Field;
  4 +import java.text.ParseException;
  5 +import java.text.SimpleDateFormat;
  6 +import java.util.ArrayList;
  7 +import java.util.Calendar;
  8 +import java.util.Collections;
  9 +import java.util.Comparator;
  10 +import java.util.Date;
  11 +import java.util.HashMap;
  12 +import java.util.HashSet;
  13 +import java.util.List;
  14 +import java.util.Map;
  15 +import java.util.Set;
  16 +
  17 +import org.apache.commons.lang3.StringUtils;
  18 +import org.apache.poi.ss.formula.functions.T;
  19 +import org.slf4j.Logger;
  20 +import org.slf4j.LoggerFactory;
  21 +
  22 +import com.bsth.entity.DutyEmployee;
  23 +import com.bsth.entity.ElecInfo;
  24 +import com.bsth.entity.HInfo;
  25 +import com.bsth.entity.OilInfo;
  26 +import com.bsth.entity.SchedulePlanInfo;
  27 +import com.bsth.entity.ScheduleRealInfo;
  28 +import com.bsth.server_ws.attendance.entity.Ssry_attendance;
  29 +import com.bsth.server_ws.attendance.entity.Jsy_attendance;
  30 +import com.bsth.server_ws.park_station.dto.LsLcPb;
  31 +import com.bsth.server_ws.waybill.entity.NH_waybill;
  32 +import com.bsth.server_ws.waybill.entity.NH_waybillItem;
  33 +import com.bsth.server_ws.waybill.entity.SN_lossMileage;
  34 +import com.bsth.server_ws.waybill.entity.SN_waybill;
  35 +import com.bsth.server_ws.waybill.entity.SN_waybillItem;
  36 +import com.bsth.util.Arith;
  37 +import com.bsth.util.ConvertUtil;
  38 +import com.google.common.collect.ArrayListMultimap;
  39 +
  40 +/**
  41 + * Created by panzhao on 2017/3/15.
  42 + */
  43 +public class WSDataConver {
  44 +
  45 + /**
  46 + * 格式编码和名称映射,与老系统保持一致
  47 + */
  48 + private static Map<String, String> gsMap;
  49 +
  50 + static Logger logger = LoggerFactory.getLogger(WSDataConver.class);
  51 +
  52 + static {
  53 + gsMap = new HashMap<>();
  54 + gsMap.put("55", "上南公司");
  55 + gsMap.put("55_4", "上南一分公司");
  56 + gsMap.put("55_3", "上南六分公司");
  57 + gsMap.put("55_1", "上南二分公司");
  58 + gsMap.put("55_2", "上南三分公司");
  59 + gsMap.put("22", "金高公司");
  60 + gsMap.put("22_2", "二分公司");
  61 + gsMap.put("22_1", "四分公司");
  62 + gsMap.put("22_3", "三分公司");
  63 + gsMap.put("22_5", "一分公司");
  64 + gsMap.put("05", "杨高公司");
  65 + gsMap.put("05_5", "杨高分公司");
  66 + gsMap.put("05_6", "周浦分公司");
  67 + gsMap.put("05_3", "芦潮港分公司");
  68 + gsMap.put("05_1", "川沙分公司");
  69 + gsMap.put("26", "南汇公司");
  70 + gsMap.put("26_3", "南汇三分");
  71 + gsMap.put("26_2", "南汇二分");
  72 + gsMap.put("26_1", "南汇一分");
  73 + gsMap.put("26_4", "南汇维修公司");
  74 + gsMap.put("77", "临港公交");
  75 + gsMap.put("77_1", "临港公交");
  76 + }
  77 +
  78 + /**
  79 + * 将班次list 转换成 getCurrentDayPlan 函数需要的格式
  80 + *
  81 + * @param list
  82 + * @return [0:日期,1:线路名称,2:路牌名称,3:车辆自编号,4:,5:,6:起点时间,7:终点时间,8:起点站名称,9:终点站名称,10:班次类型]
  83 + */
  84 + public static String[] to_getCurrentDayPlan(List<ScheduleRealInfo> list) {
  85 + if (list == null || list.size() == 0)
  86 + return new String[0];
  87 +
  88 + Map<String, String> bcTypeMap = new HashMap<>();
  89 + bcTypeMap.put("out", "出场");
  90 + bcTypeMap.put("in", "进场");
  91 +
  92 + String[] array = new String[list.size()];
  93 + StringBuilder sb;
  94 + ScheduleRealInfo sch;
  95 + int len = list.size();
  96 + for(int i = 0; i < len; i ++){
  97 + sb = new StringBuilder();
  98 + sch = list.get(i);
  99 + sb.append(sch.getScheduleDateStr() + ",");
  100 + sb.append(sch.getXlName() + ",");
  101 + sb.append(sch.getLpName() + ",");
  102 + sb.append(sch.getClZbh() + ",");
  103 + sb.append(",");
  104 + sb.append(",");
  105 + sb.append(sch.getDfsj() + ",");
  106 + sb.append(sch.getZdsj() + ",");
  107 + sb.append(sch.getQdzName() + ",");
  108 + sb.append(sch.getZdzName() + ",");
  109 + sb.append(bcTypeMap.containsKey(sch.getBcType())?bcTypeMap.get(sch.getBcType()):"");
  110 +
  111 + array[i] = sb.toString();
  112 + }
  113 + return array;
  114 + }
  115 +
  116 + /**
  117 + * 将班次list 转换成 returnCCInfo 和 returnJCInfo 函数需要的格式
  118 + *
  119 + * @param list
  120 + * @return [0: 日期, 1: 线路编码, 2: 线路名称, 3: 公司名称, 4: 分公司名称, 5: 路牌, 6: 起点站, 7: 起点计划时间,
  121 + * 8: 起点实际时间, 9: 终点站, 10: 终点计划时间, 11: 终点实际时间, 12: 计划里程, 13: 实际里程,
  122 + * 14: 驾驶员, 15: 售票员, 16: 车辆内部编码, 17: 状态(1 为出场。2为进场), 18: 驾驶员名称, 19: 进场顺序号]
  123 + */
  124 + public static String[] to_returnJCCInfo(List<ScheduleRealInfo> list) {
  125 + if(list == null)
  126 + return new String[0];
  127 +
  128 + int size = list.size();
  129 + String[] array = new String[size];
  130 +
  131 + ScheduleRealInfo sch;
  132 + StringBuffer sb;
  133 + for (int i = 0; i < size; i++) {
  134 + sb = new StringBuffer(",");
  135 +
  136 + sch = list.get(i);
  137 + sb.append(sch.getScheduleDateStr() + ",");
  138 + sb.append(sch.getXlBm() + ",");
  139 + sb.append(sch.getXlName() + ",");
  140 + sb.append(gsMap.get(sch.getGsBm()) + ",");
  141 + sb.append(gsMap.get(sch.getGsBm() + "_" + sch.getFgsBm()) + ",");
  142 + sb.append(sch.getLpName() + ",");
  143 + sb.append(sch.getQdzCode() + ",");
  144 + sb.append(sch.getDfsj() + ",");
  145 + sb.append(nvlGetVal(sch.getFcsjActual()) + ",");
  146 + sb.append(sch.getZdzCode() + ",");
  147 + sb.append(sch.getZdsj() + ",");
  148 + sb.append(nvlGetVal(sch.getZdsjActual()) + ",");
  149 + sb.append(nvlGetVal(sch.getJhlc()) + ",");
  150 + sb.append(nvlGetVal(sch.getJhlc()) + ",");
  151 + sb.append(sch.getjGh() + ",");
  152 + sb.append(nvlGetVal(sch.getsGh()) + ",");
  153 + sb.append(sch.getClZbh() + ",");
  154 + sb.append((sch.getBcType().equals("out") ? 1 : 2) + ",");
  155 + sb.append(sch.getjName() + ",");
  156 + //用ID替代老系统的出场顺序号
  157 + sb.append(sch.getId() + ",");
  158 +
  159 + array[i] = sb.substring(1).toString();
  160 + }
  161 + return array;
  162 + }
  163 +
  164 + public static String nvlGetVal(Object val) {
  165 + return val == null ? "" : val.toString();
  166 + }
  167 +
  168 + /**
  169 + * 将实际排班和油耗数据 转换成南汇路单需要的数据格式
  170 + *
  171 + * @param listMap
  172 + * @param oilInfoMap
  173 + * @return
  174 + */
  175 + public static NH_waybill[] to_waybill_NH(ArrayListMultimap<String, ScheduleRealInfo> listMap, ArrayListMultimap<String, OilInfo> oilInfoMap, ArrayListMultimap<String, ElecInfo> elecInfoMap, ArrayListMultimap<String, HInfo> hInfoMap, List<DutyEmployee> des) throws NoSuchFieldException {
  176 + List<String> nbbmArray = new ArrayList<>(listMap.keySet());
  177 +
  178 + NH_waybill[] rs = new NH_waybill[nbbmArray.size() + 1];
  179 + Field jGhField = ScheduleRealInfo.class.getDeclaredField("jGh");
  180 + //Field lpField = ScheduleRealInfo.class.getDeclaredField("lpName");
  181 +
  182 + List<ScheduleRealInfo> list;
  183 + ArrayListMultimap<String, ScheduleRealInfo> jGhListMap;
  184 + ScheduleRealInfo sch;
  185 + NH_waybill nh_waybill, total = new NH_waybill();
  186 + NH_waybillItem nh_waybillItem, totalItem = new NH_waybillItem();
  187 + List<OilInfo> oilInfo;
  188 + List<ElecInfo> elecInfo;
  189 + List<HInfo> hInfo;
  190 + boolean isFirst = true;
  191 +
  192 + double jhlc = 0, sjjhlc = 0, cclc = 0, jclc = 0, yylc = 0, kslc = 0, cjlc = 0, lblc = 0, zjlc = 0, zlc = 0;
  193 + double yhTotal = 0;
  194 + for (int i = 0; i < nbbmArray.size(); i++) {
  195 + list = listMap.get(nbbmArray.get(i));
  196 + if (list.size() == 0)
  197 + continue;
  198 + //班次信息
  199 + nh_waybill = new NH_waybill();
  200 + sch = list.get(0);
  201 + //日期
  202 + nh_waybill.setM_strYYRQ(sch.getScheduleDateStr());
  203 + //车辆自编号
  204 + nh_waybill.setM_strNBBM(sch.getClZbh());
  205 + //线路编码
  206 + nh_waybill.setM_strXLBM(sch.getXlBm());
  207 + nh_waybill.setM_SubInfos(new ArrayList<NH_waybillItem>());
  208 + if (isFirst) {
  209 + total.setM_strYYRQ(sch.getScheduleDateStr());
  210 + total.setM_strNBBM("000-000");
  211 + total.setM_strXLBM("000000");
  212 + total.setM_SubInfos(new ArrayList<NH_waybillItem>());
  213 +
  214 + isFirst = false;
  215 + }
  216 +
  217 + //按 驾驶员 分组班次,构造路单子项
  218 + jGhListMap = new ConvertUtil<ScheduleRealInfo>().groupMultiList(list, "_", jGhField);
  219 + for (String jGh : jGhListMap.keySet()) {
  220 + list = jGhListMap.get(jGh);
  221 + nh_waybillItem = new NH_waybillItem();
  222 + //计划里程
  223 + nh_waybillItem.setM_dblJHLC(ScheduleCalculator.calcJHLC(list));
  224 + jhlc = Arith.add(jhlc, nh_waybillItem.getM_dblJHLC());
  225 + //实际计划公里
  226 + nh_waybillItem.setM_dblSJJHLC(ScheduleCalculator.calcSJLC(list));
  227 + sjjhlc = Arith.add(sjjhlc, nh_waybillItem.getM_dblSJJHLC());
  228 + //实际出场里程
  229 + nh_waybillItem.setM_dblCCLC(ScheduleCalculator.calcCCLC(list));
  230 + cclc = Arith.add(cclc, nh_waybillItem.getM_dblCCLC());
  231 + //实际进场里程
  232 + nh_waybillItem.setM_dblJCLC(ScheduleCalculator.calcJCLC(list));
  233 + jclc = Arith.add(jclc, nh_waybillItem.getM_dblJCLC());
  234 + //营业公里
  235 + nh_waybillItem.setM_dblYYLC(ScheduleCalculator.calcYYLC(list));
  236 + yylc = Arith.add(yylc, nh_waybillItem.getM_dblYYLC());
  237 + //空驶公里
  238 + nh_waybillItem.setM_dblKSLC(ScheduleCalculator.calcKSLC(list));
  239 + kslc = Arith.add(kslc, nh_waybillItem.getM_dblKSLC());
  240 + //抽减公里
  241 + nh_waybillItem.setM_dblCJLC(ScheduleCalculator.calcCJLC(list));
  242 + cjlc = Arith.add(cjlc, nh_waybillItem.getM_dblCJLC());
  243 + //烂班公里
  244 + nh_waybillItem.setM_dblLBLC(ScheduleCalculator.calcLBLC(list));
  245 + lblc = Arith.add(lblc, nh_waybillItem.getM_dblLBLC());
  246 + //增加公里
  247 + nh_waybillItem.setM_dblZJLC(ScheduleCalculator.calcZJLC(list));
  248 + zjlc = Arith.add(zjlc, nh_waybillItem.getM_dblZJLC());
  249 + //总公里
  250 + nh_waybillItem.setM_dblZLC(ScheduleCalculator.calcZLC(list));
  251 + zlc = Arith.add(zlc, nh_waybillItem.getM_dblZLC());
  252 + //烂班公里原因
  253 + nh_waybillItem.setM_strLBYY(ScheduleCalculator.joinLBYY(list));
  254 + //抽减公里原因
  255 + nh_waybillItem.setM_strCJYY(ScheduleCalculator.joinCJYY(list));
  256 + //计划班次
  257 + nh_waybillItem.setM_intJHBC(ScheduleCalculator.countJHBC(list));
  258 + //实际计划班次
  259 + nh_waybillItem.setM_intSJJHBC(ScheduleCalculator.countSJJHBC(list));
  260 + //实际班次 ————> 暂时和实际计划班次相同
  261 + nh_waybillItem.setM_intSJBC(ScheduleCalculator.countSJJHBC(list));
  262 + //增加班次
  263 + nh_waybillItem.setM_intZJBC(ScheduleCalculator.countZJBC(list));
  264 + //抽减班次
  265 + nh_waybillItem.setM_intCJBC(ScheduleCalculator.countCJBC(list));
  266 + //烂班工时
  267 + nh_waybillItem.setM_dblLBGS(ScheduleCalculator.calcLBGS(list));
  268 + //路牌
  269 + nh_waybillItem.setM_strLP(list.get(0).getLpName());
  270 + //驾驶员工号
  271 + nh_waybillItem.setM_strJSY(list.get(0).getjGh());
  272 + //售票员工号
  273 + nh_waybillItem.setM_strSPY("");
  274 + for (ScheduleRealInfo sri : list) {
  275 + if (StringUtils.isNotEmpty(sri.getsGh())) {
  276 + nh_waybillItem.setM_strSPY(sri.getsGh());
  277 + break;
  278 + }
  279 + }
  280 + //驾驶员考勤
  281 + nh_waybillItem.setM_strJSYKQ("");
  282 + //售票员考勤
  283 + nh_waybillItem.setM_strSPYKQ("");
  284 + //当班调度员
  285 + nh_waybillItem.setM_strDDY(ScheduleCalculator.calcDDY(list, des));
  286 + //营运状态
  287 + nh_waybillItem.setM_strYYZT("");
  288 + //备注
  289 + nh_waybillItem.setM_strBZ("");
  290 +
  291 + oilInfo = oilInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh());
  292 + if (oilInfo != null && oilInfo.size() > 0) {
  293 + Double czyl = 0., jzyl = 0., jzl = 0., ns = 0., yh = 0.;
  294 + String rylx = "";
  295 + for (OilInfo oi : oilInfo) {
  296 + if (oi.getXlbm().equals(sch.getXlBm())) {
  297 + czyl = Arith.add(czyl, oi.getCzyl());
  298 + jzyl = Arith.add(jzyl, oi.getJzyl());
  299 + jzl = Arith.add(jzl, oi.getJzl());
  300 + ns = Arith.add(ns, oi.getNs());
  301 + yh = Arith.add(yh, oi.getYh());
  302 + rylx = oi.getRylx();
  303 + }
  304 + }
  305 + //出场存油
  306 + nh_waybillItem.setM_dblCCCY(czyl);
  307 + //进场存油
  308 + nh_waybillItem.setM_dblJCCY(jzyl);
  309 + //加注量1
  310 + nh_waybillItem.setM_dblJZL1(jzl);
  311 + //加注量2
  312 + nh_waybillItem.setM_dblJZL2(0.0);
  313 + //尿素
  314 + nh_waybillItem.setM_dblNS(ns);
  315 + //消耗量
  316 + nh_waybillItem.setM_dblYH(yh);
  317 + yhTotal = Arith.add(yhTotal, yh);
  318 + //加油地点1
  319 + nh_waybillItem.setM_strJYD1("");
  320 + //加油地点2
  321 + nh_waybillItem.setM_strJYD2("");
  322 + //加油工工号1
  323 + nh_waybillItem.setM_strJYG1("");
  324 + //加油工工号1
  325 + nh_waybillItem.setM_strJYG2("");
  326 + //油耗类型1
  327 + nh_waybillItem.setM_strYHLX1(rylx);
  328 + //油耗类型2
  329 + nh_waybillItem.setM_strYHLX1("");
  330 + }
  331 +
  332 + elecInfo = elecInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh());
  333 + if (elecInfo != null && elecInfo.size() > 0) {
  334 + Double cdl = 0., hd = 0.;
  335 + for (ElecInfo ei : elecInfo) {
  336 + cdl = Arith.add(cdl, ei.getCdl());
  337 + hd = Arith.add(hd, ei.getHd());
  338 + }
  339 + //出场存油
  340 + nh_waybillItem.setM_dblCCCY(100.0);
  341 + //进场存油
  342 + nh_waybillItem.setM_dblJCCY(100.0);
  343 + //加注量1
  344 + nh_waybillItem.setM_dblJZL1(cdl);
  345 + //加注量2
  346 + nh_waybillItem.setM_dblJZL2(0.0);
  347 + //尿素
  348 + nh_waybillItem.setM_dblNS(0.0);
  349 + //消耗量
  350 + nh_waybillItem.setM_dblYH(hd);
  351 + yhTotal = Arith.add(yhTotal, hd);
  352 + //加油地点1
  353 + nh_waybillItem.setM_strJYD1("");
  354 + //加油地点2
  355 + nh_waybillItem.setM_strJYD2("");
  356 + //加油工工号1
  357 + nh_waybillItem.setM_strJYG1("");
  358 + //加油工工号1
  359 + nh_waybillItem.setM_strJYG2("");
  360 + //油耗类型1
  361 + nh_waybillItem.setM_strYHLX1("");
  362 + //油耗类型2
  363 + nh_waybillItem.setM_strYHLX1("");
  364 + }
  365 +
  366 + hInfo = hInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh());
  367 + if (hInfo != null && hInfo.size() > 0) {
  368 + Double cql = 0., hq = 0.;
  369 + for (HInfo h : hInfo) {
  370 + cql = Arith.add(cql, h.getJql());
  371 + hq = Arith.add(hq, h.getHn());
  372 + }
  373 + //出场存油
  374 + nh_waybillItem.setM_dblCCCY(100.0);
  375 + //进场存油
  376 + nh_waybillItem.setM_dblJCCY(100.0);
  377 + //加注量1
  378 + nh_waybillItem.setM_dblJZL1(cql);
  379 + //加注量2
  380 + nh_waybillItem.setM_dblJZL2(0.0);
  381 + //尿素
  382 + nh_waybillItem.setM_dblNS(0.0);
  383 + //消耗量
  384 + nh_waybillItem.setM_dblYH(hq);
  385 + yhTotal = Arith.add(yhTotal, hq);
  386 + //加油地点1
  387 + nh_waybillItem.setM_strJYD1("");
  388 + //加油地点2
  389 + nh_waybillItem.setM_strJYD2("");
  390 + //加油工工号1
  391 + nh_waybillItem.setM_strJYG1("");
  392 + //加油工工号1
  393 + nh_waybillItem.setM_strJYG2("");
  394 + //油耗类型1
  395 + nh_waybillItem.setM_strYHLX1("");
  396 + //油耗类型2
  397 + nh_waybillItem.setM_strYHLX1("");
  398 + }
  399 +
  400 + nh_waybill.getM_SubInfos().add(nh_waybillItem);
  401 + }
  402 +
  403 + rs[i] = nh_waybill;
  404 + }
  405 +
  406 + totalItem.setM_dblJHLC(jhlc);
  407 + totalItem.setM_dblSJJHLC(sjjhlc);
  408 + totalItem.setM_dblCCLC(cclc);
  409 + totalItem.setM_dblJCLC(jclc);
  410 + totalItem.setM_dblYYLC(yylc);
  411 + totalItem.setM_dblKSLC(kslc);
  412 + totalItem.setM_dblCJLC(cjlc);
  413 + totalItem.setM_dblLBLC(lblc);
  414 + totalItem.setM_dblZJLC(zjlc);
  415 + totalItem.setM_dblZLC(zlc);
  416 + totalItem.setM_strSPY("");
  417 + totalItem.setM_strJSYKQ("");
  418 + totalItem.setM_strSPYKQ("");
  419 + totalItem.setM_strYYZT("");
  420 + totalItem.setM_strBZ("");
  421 + totalItem.setM_dblYH(yhTotal);
  422 +
  423 + total.getM_SubInfos().add(totalItem);
  424 +
  425 + rs[rs.length - 1] = total;
  426 +
  427 + return rs;
  428 + }
  429 +
  430 + /**
  431 + * 将实际排班、油耗数据、电量数据 转换成南汇路单需要的数据格式
  432 + *
  433 + * @param listMap
  434 + * @param oilInfoMap
  435 + * @return
  436 + */
  437 + public static NH_waybill[] to_waybill_NH4TH(ArrayListMultimap<String, ScheduleRealInfo> listMap, ArrayListMultimap<String, OilInfo> oilInfoMap, ArrayListMultimap<String, ElecInfo> elecInfoMap, List<DutyEmployee> des) throws NoSuchFieldException {
  438 + // 返回值list形态(可转数组)
  439 + List<NH_waybill> result = new ArrayList<>();
  440 + List<String> nbbmArray = new ArrayList<>(listMap.keySet());
  441 +
  442 + Field xlbmField = ScheduleRealInfo.class.getDeclaredField("xlBm"), jGhField = ScheduleRealInfo.class.getDeclaredField("jGh");
  443 +
  444 + List<ScheduleRealInfo> list;
  445 + ArrayListMultimap<String, ScheduleRealInfo> xlBmListMap, jGhListMap;
  446 + ScheduleRealInfo sch;
  447 + NH_waybill nh_waybill;
  448 + NH_waybillItem nh_waybillItem;
  449 + List<OilInfo> oilInfo;
  450 + List<ElecInfo> elecInfo;
  451 + for (int i = 0; i < nbbmArray.size(); i++) {
  452 + list = listMap.get(nbbmArray.get(i));
  453 + if (list.size() == 0) {
  454 + continue;
  455 + }
  456 +
  457 + xlBmListMap = new ConvertUtil<ScheduleRealInfo>().groupMultiList(list, "_", xlbmField);
  458 + for (String xlBm : xlBmListMap.keySet()) {
  459 + list = xlBmListMap.get(xlBm);
  460 +
  461 + //班次信息
  462 + nh_waybill = new NH_waybill();
  463 + sch = list.get(0);
  464 + //日期
  465 + nh_waybill.setM_strYYRQ(sch.getScheduleDateStr());
  466 + //车辆自编号
  467 + nh_waybill.setM_strNBBM(sch.getClZbh());
  468 + //线路编码
  469 + nh_waybill.setM_strXLBM(sch.getXlBm());
  470 + nh_waybill.setM_SubInfos(new ArrayList<NH_waybillItem>());
  471 +
  472 + //按 驾驶员 分组班次,构造路单子项
  473 + jGhListMap = new ConvertUtil<ScheduleRealInfo>().groupMultiList(list, "_", jGhField);
  474 + for (String jGh : jGhListMap.keySet()) {
  475 + list = jGhListMap.get(jGh);
  476 + nh_waybillItem = new NH_waybillItem();
  477 + //计划里程
  478 + nh_waybillItem.setM_dblJHLC(ScheduleCalculator.calcJHLC(list));
  479 + //实际计划公里
  480 + nh_waybillItem.setM_dblSJJHLC(ScheduleCalculator.calcSJLC(list));
  481 + //实际出场里程
  482 + nh_waybillItem.setM_dblCCLC(ScheduleCalculator.calcCCLC(list));
  483 + //实际进场里程
  484 + nh_waybillItem.setM_dblJCLC(ScheduleCalculator.calcJCLC(list));
  485 + //营业公里
  486 + nh_waybillItem.setM_dblYYLC(ScheduleCalculator.calcYYLC(list));
  487 + //空驶公里
  488 + nh_waybillItem.setM_dblKSLC(ScheduleCalculator.calcKSLC(list));
  489 + //抽减公里
  490 + nh_waybillItem.setM_dblCJLC(ScheduleCalculator.calcCJLC(list));
  491 + //烂班公里
  492 + nh_waybillItem.setM_dblLBLC(ScheduleCalculator.calcLBLC(list));
  493 + //增加公里
  494 + nh_waybillItem.setM_dblZJLC(ScheduleCalculator.calcZJLC(list));
  495 + //总公里
  496 + nh_waybillItem.setM_dblZLC(ScheduleCalculator.calcZLC(list));
  497 + //烂班公里原因
  498 + nh_waybillItem.setM_strLBYY(ScheduleCalculator.joinLBYY(list));
  499 + //抽减公里原因
  500 + nh_waybillItem.setM_strCJYY(ScheduleCalculator.joinCJYY(list));
  501 + //计划班次
  502 + nh_waybillItem.setM_intJHBC(ScheduleCalculator.countJHBC(list));
  503 + //实际计划班次
  504 + nh_waybillItem.setM_intSJJHBC(ScheduleCalculator.countSJJHBC(list));
  505 + //实际班次 ————> 暂时和实际计划班次相同
  506 + nh_waybillItem.setM_intSJBC(ScheduleCalculator.countSJJHBC(list));
  507 + //增加班次
  508 + nh_waybillItem.setM_intZJBC(ScheduleCalculator.countZJBC(list));
  509 + //抽减班次
  510 + nh_waybillItem.setM_intCJBC(ScheduleCalculator.countCJBC(list));
  511 + //烂班工时
  512 + nh_waybillItem.setM_dblLBGS(ScheduleCalculator.calcLBGS(list));
  513 + //路牌
  514 + nh_waybillItem.setM_strLP(list.get(0).getLpName());
  515 + //驾驶员工号
  516 + nh_waybillItem.setM_strJSY(list.get(0).getjGh());
  517 + //售票员工号
  518 + nh_waybillItem.setM_strSPY("");
  519 + for (ScheduleRealInfo sri : list) {
  520 + if (StringUtils.isNotEmpty(sri.getsGh())) {
  521 + nh_waybillItem.setM_strSPY(sri.getsGh());
  522 + break;
  523 + }
  524 + }
  525 + //驾驶员考勤
  526 + nh_waybillItem.setM_strJSYKQ("");
  527 + //售票员考勤
  528 + nh_waybillItem.setM_strSPYKQ("");
  529 + //当班调度员
  530 + nh_waybillItem.setM_strDDY(ScheduleCalculator.calcDDY(list, des));
  531 + //营运状态
  532 + nh_waybillItem.setM_strYYZT("");
  533 + //备注
  534 + nh_waybillItem.setM_strBZ("");
  535 +
  536 + oilInfo = oilInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh());
  537 + if (oilInfo != null && oilInfo.size() > 0) {
  538 + Double czyl = 0., jzyl = 0., jzl = 0., ns = 0., yh = 0.;
  539 + String rylx = "";
  540 + for (OilInfo oi : oilInfo) {
  541 + if (oi.getXlbm().equals(sch.getXlBm())) {
  542 + czyl = Arith.add(czyl, oi.getCzyl());
  543 + jzyl = Arith.add(jzyl, oi.getJzyl());
  544 + jzl = Arith.add(jzl, oi.getJzl());
  545 + ns = Arith.add(ns, oi.getNs());
  546 + yh = Arith.add(yh, oi.getYh());
  547 + rylx = oi.getRylx();
  548 + }
  549 + }
  550 + //出场存油
  551 + nh_waybillItem.setM_dblCCCY(czyl);
  552 + //进场存油
  553 + nh_waybillItem.setM_dblJCCY(jzyl);
  554 + //加注量1
  555 + nh_waybillItem.setM_dblJZL1(jzl);
  556 + //加注量2
  557 + nh_waybillItem.setM_dblJZL2(0.0);
  558 + //尿素
  559 + nh_waybillItem.setM_dblNS(ns);
  560 + //消耗量
  561 + nh_waybillItem.setM_dblYH(yh);
  562 + //加油地点1
  563 + nh_waybillItem.setM_strJYD1("");
  564 + //加油地点2
  565 + nh_waybillItem.setM_strJYD2("");
  566 + //加油工工号1
  567 + nh_waybillItem.setM_strJYG1("");
  568 + //加油工工号1
  569 + nh_waybillItem.setM_strJYG2("");
  570 + //油耗类型1
  571 + nh_waybillItem.setM_strYHLX1(rylx);
  572 + //油耗类型2
  573 + nh_waybillItem.setM_strYHLX1("");
  574 + }
  575 +
  576 + elecInfo = elecInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh());
  577 + if (elecInfo != null && elecInfo.size() > 0) {
  578 + Double cdl = 0., hd = 0.;
  579 + for (ElecInfo ei : elecInfo) {
  580 + cdl = Arith.add(cdl, ei.getCdl());
  581 + hd = Arith.add(hd, ei.getHd());
  582 + }
  583 + //出场存油
  584 + nh_waybillItem.setM_dblCCCY(100.0);
  585 + //进场存油
  586 + nh_waybillItem.setM_dblJCCY(100.0);
  587 + //加注量1
  588 + nh_waybillItem.setM_dblJZL1(cdl);
  589 + //加注量2
  590 + nh_waybillItem.setM_dblJZL2(0.0);
  591 + //尿素
  592 + nh_waybillItem.setM_dblNS(0.0);
  593 + //消耗量
  594 + nh_waybillItem.setM_dblYH(hd);
  595 + //加油地点1
  596 + nh_waybillItem.setM_strJYD1("");
  597 + //加油地点2
  598 + nh_waybillItem.setM_strJYD2("");
  599 + //加油工工号1
  600 + nh_waybillItem.setM_strJYG1("");
  601 + //加油工工号1
  602 + nh_waybillItem.setM_strJYG2("");
  603 + //油耗类型1
  604 + nh_waybillItem.setM_strYHLX1("");
  605 + //油耗类型2
  606 + nh_waybillItem.setM_strYHLX1("");
  607 + }
  608 +
  609 + nh_waybill.getM_SubInfos().add(nh_waybillItem);
  610 + }
  611 +
  612 + result.add(nh_waybill);
  613 + }
  614 + }
  615 +
  616 + return result.toArray(new NH_waybill[result.size()]);
  617 + }
  618 +
  619 +
  620 + /**
  621 + * 将实际排班和油耗数据 转换成上南路单需要的数据格式
  622 + *
  623 + * @param listMap
  624 + * @param oilInfoMap
  625 + * @return
  626 + */
  627 + public static SN_waybill[] to_waybill_SN(ArrayListMultimap<String, ScheduleRealInfo> listMap, Map<String, OilInfo> oilInfoMap) throws NoSuchFieldException {
  628 +
  629 + List<String> nbbmArray = new ArrayList<>(listMap.keySet());
  630 + SN_waybill[] rs = new SN_waybill[nbbmArray.size()];
  631 + Field jGhField = ScheduleRealInfo.class.getDeclaredField("jGh");
  632 +
  633 + List<ScheduleRealInfo> list;
  634 + ArrayListMultimap<String, ScheduleRealInfo> jGhListMap;
  635 + ScheduleRealInfo sch;
  636 + SN_waybill sn_waybill;
  637 + SN_waybillItem sn_waybillItem;
  638 +
  639 + OilComp oilComp = new OilComp();
  640 + List<OilInfo> oilArray;
  641 + for (int i = 0; i < nbbmArray.size(); i++) {
  642 + list = listMap.get(nbbmArray.get(i));
  643 + if (list.size() == 0)
  644 + continue;
  645 +
  646 + sch = list.get(0);
  647 + sn_waybill = new SN_waybill();
  648 + sn_waybill.setLine_no(sch.getXlBm());
  649 + sn_waybill.setWork_date(sch.getScheduleDateStr());
  650 + sn_waybill.setComp_id(sch.getFgsBm());
  651 + sn_waybill.setGuidecard(sch.getLpName());
  652 + sn_waybill.setCar_id(sch.getClZbh());
  653 + //实际班次
  654 + sn_waybill.setAct_num(ScheduleCalculator.countSJJHBC(list));
  655 + //晚班实际班次
  656 + sn_waybill.setL_act_num(ScheduleCalculator.countSJJHBC(ScheduleCalculator.lastArray(list)));
  657 + //营业里程
  658 + sn_waybill.setWork_way(ScheduleCalculator.calcYYLC(list));
  659 + //空驶里程
  660 + sn_waybill.setLeisure_way(ScheduleCalculator.calcKSLC(list));
  661 + //总里程
  662 + sn_waybill.setCount_way(ScheduleCalculator.calcZLC(list));
  663 + //路单类型(0普通,1包车)
  664 + sn_waybill.setLd_type("0");
  665 + //油料类型(2、柴油 3、天然气 4、汽油柴油 5、液化气 6、液化气汽油 7、液化气柴油 8、天然气汽油 9、电)
  666 + //暂时全部柴油车
  667 + sn_waybill.setOil_type("2");
  668 +
  669 + //根据车辆获取油量信息
  670 + oilArray = likeGet(oilInfoMap, sch.getClZbh() + "_");
  671 + if (oilArray.size() > 0) {
  672 + Collections.sort(oilArray, oilComp);
  673 + //出厂存油
  674 + sn_waybill.setOut_oil(oilArray.get(0).getCzyl());
  675 + //油料加注
  676 + sn_waybill.setAdd_oil(sumAddOil(oilArray));
  677 + //进场存油
  678 + sn_waybill.setEnd_oil(oilArray.get(oilArray.size() - 1).getJzyl());
  679 + //油料消耗
  680 + sn_waybill.setExpend_oil(countOilExpend(oilArray));
  681 + //非营业用油类型 非营业用油类型(1.常规车2.包车3.加开包车)
  682 + sn_waybill.setNowork_oil_type("1");
  683 + //非营业用油
  684 + sn_waybill.setNowork_oil(0);
  685 + //非营业用油油耗量(保养用油)
  686 + sn_waybill.setNowork_oil1(0);
  687 + //非营业用油油耗量(票务用油)
  688 + sn_waybill.setNowork_oil2(0);
  689 + //非营业用油油耗量(其他用油)
  690 + sn_waybill.setNowork_oil3(0);
  691 + //营业用油
  692 + sn_waybill.setWork_oil(countOilExpend(oilArray));
  693 + //其他营业用油
  694 + sn_waybill.setQt_work_oil(0);
  695 + }
  696 + sn_waybill.setDriver_detail(new ArrayList<SN_waybillItem>());
  697 +
  698 + //按 驾驶员 分组班次,构造路单子项
  699 + jGhListMap = new ConvertUtil<ScheduleRealInfo>().groupMultiList(list, "_", jGhField);
  700 + for (String jGh : jGhListMap.keySet()) {
  701 + list = jGhListMap.get(jGh);
  702 + sn_waybillItem = new SN_waybillItem();
  703 + sch = list.get(0);
  704 + //司机编号
  705 + sn_waybillItem.setDriver_no(sch.getjGh());
  706 + //司机名称
  707 + sn_waybillItem.setDriver_name(sch.getjName());
  708 + //售票员编号
  709 + sn_waybillItem.setBusman_no(sch.getsGh());
  710 + //售票员名称
  711 + sn_waybillItem.setBusman_name(sch.getsName());
  712 + //行驶里程
  713 + sn_waybillItem.setDriver_way(ScheduleCalculator.calcYYLC(list));
  714 + //空驶公里
  715 + sn_waybillItem.setKs_way(ScheduleCalculator.calcKSLC(list));
  716 + //柴油加注量、电加注量同一字段
  717 + sn_waybillItem.setDo_oil_2(countOilExpend(oilArray, sch.getjGh()));
  718 +
  719 + sn_waybill.getDriver_detail().add(sn_waybillItem);
  720 + }
  721 +
  722 + rs[i] = sn_waybill;
  723 + }
  724 + return rs;
  725 + }
  726 +
  727 + /**
  728 + * 将实际排班转换成上南需要损失公里数据
  729 + *
  730 + * @param listMap
  731 + * @return
  732 + */
  733 + public static SN_lossMileage[] to_lossMileage_SN(ArrayListMultimap<String, ScheduleRealInfo> listMap) throws NoSuchFieldException {
  734 + List<String> lineArray = new ArrayList<>(listMap.keySet());
  735 + SN_lossMileage[] rs = new SN_lossMileage[lineArray.size()];
  736 +
  737 + List<ScheduleRealInfo> list;
  738 + ScheduleRealInfo sch;
  739 + for (int i = 0; i < lineArray.size(); i++) {
  740 + list = listMap.get(lineArray.get(i));
  741 +
  742 + sch = list.get(0);
  743 + SN_lossMileage lossMileage = new SN_lossMileage();
  744 + //线路编号
  745 + lossMileage.setLine_id(sch.getXlBm());
  746 + //营运日期
  747 + lossMileage.setWork_date(sch.getScheduleDateStr());
  748 + //分公司编号
  749 + lossMileage.setComp_id(sch.getFgsBm());
  750 + //少驶公里
  751 + lossMileage.setLoss_way(ScheduleCalculator.calcCJLC(list));
  752 + //实际公里
  753 + lossMileage.setAct_way(ScheduleCalculator.calcYYLC(list));
  754 + //计划公里
  755 + lossMileage.setJh_way(ScheduleCalculator.calcJHLC(list));
  756 +
  757 + //路阻损失公里
  758 + lossMileage.setLoss_lz(ScheduleCalculator.calcCJLC2(list, "路阻"));
  759 + //吊慢损失公里
  760 + lossMileage.setLoss_dm(ScheduleCalculator.calcCJLC2(list, "吊慢"));
  761 + //故障损失公里
  762 + lossMileage.setLoss_gz(ScheduleCalculator.calcCJLC2(list, "故障"));
  763 + //纠纷损失公里
  764 + lossMileage.setLoss_jf(ScheduleCalculator.calcCJLC2(list, "纠纷"));
  765 + //肇事损失公里
  766 + lossMileage.setLoss_zs(ScheduleCalculator.calcCJLC2(list, "肇事"));
  767 + //缺人损失公里
  768 + lossMileage.setLoss_qr(ScheduleCalculator.calcCJLC2(list, "缺人"));
  769 + //缺车损失公里
  770 + lossMileage.setLoss_qc(ScheduleCalculator.calcCJLC2(list, "缺车"));
  771 + //客稀损失公里
  772 + lossMileage.setLoss_kx(ScheduleCalculator.calcCJLC2(list, "客稀"));
  773 + //其他损失公里
  774 + lossMileage.setLoss_qt(ScheduleCalculator.calcCJLC2(list, "其他"));
  775 + //配车损失公里
  776 + lossMileage.setLoss_pc(ScheduleCalculator.calcCJLC2(list, "配车"));
  777 + //保养损失公里
  778 + lossMileage.setLoss_by(ScheduleCalculator.calcCJLC2(list, "保养"));
  779 + //气候损失公里
  780 + lossMileage.setLoss_qh(ScheduleCalculator.calcCJLC2(list, "气候"));
  781 + //援外损失公里
  782 + lossMileage.setLoss_yw(ScheduleCalculator.calcCJLC2(list, "援外"));
  783 + //抽减损失公里
  784 + lossMileage.setLoss_cj(ScheduleCalculator.calcCJLC2(list, "抽减"));
  785 +
  786 + //实际班次
  787 + lossMileage.setAct_num(ScheduleCalculator.countSJJHBC(list));
  788 + //早班班次
  789 + lossMileage.setEarly_num(ScheduleCalculator.countSJJHBC(ScheduleCalculator.earlyArray(list)));
  790 + //晚班班次
  791 + lossMileage.setLate_num(ScheduleCalculator.countSJJHBC(ScheduleCalculator.lastArray(list)));
  792 + //另加班次
  793 + lossMileage.setL_act_num(ScheduleCalculator.countZJBC(list));
  794 + //早班另加班次
  795 + lossMileage.setL_early_num(ScheduleCalculator.countZJBC(ScheduleCalculator.earlyArray(list)));
  796 + //晚班另加班次
  797 + lossMileage.setL_late_num(ScheduleCalculator.countZJBC(ScheduleCalculator.lastArray(list)));
  798 + //计划班次
  799 + lossMileage.setJ_act_num(ScheduleCalculator.countJHBC(list));
  800 + //早班计划班次
  801 + lossMileage.setJ_early_num(ScheduleCalculator.countJHBC(ScheduleCalculator.earlyArray(list)));
  802 + //晚班计划班次
  803 + lossMileage.setJ_late_num(ScheduleCalculator.countJHBC(ScheduleCalculator.lastArray(list)));
  804 + //放站班次
  805 + lossMileage.setF_act_bc(ScheduleCalculator.countEmpty(list));
  806 + //早班放站班次
  807 + lossMileage.setF_early_bc(ScheduleCalculator.countEmpty(ScheduleCalculator.earlyArray(list)));
  808 + //晚班放站班次
  809 + lossMileage.setF_late_bc(ScheduleCalculator.countEmpty(ScheduleCalculator.lastArray(list)));
  810 + //调头班次
  811 + lossMileage.setDt_act_bc(0);
  812 + //早班调头班次
  813 + lossMileage.setDt_early_bc(0);
  814 + //晚班调头班次
  815 + lossMileage.setDt_late_bc(0);
  816 + //大间隔班次
  817 + lossMileage.setD_act_num(ScheduleCalculator.countSpaceLg(list));
  818 + //早班大间隔班次
  819 + lossMileage.setD_early_num(ScheduleCalculator.countSpaceLg(ScheduleCalculator.earlyArray(list)));
  820 + //晚班大间隔班次
  821 + lossMileage.setD_late_num(ScheduleCalculator.countSpaceLg(ScheduleCalculator.lastArray(list)));
  822 + //最大间隔时间
  823 + lossMileage.setD_act_max(ScheduleCalculator.calcMaxSpace(list));
  824 + //故障分
  825 + lossMileage.setLoss_gzf(0);
  826 + //故障次数
  827 + lossMileage.setLoss_gzcs(0);
  828 +
  829 +
  830 + rs[i] = lossMileage;
  831 + }
  832 + return rs;
  833 + }
  834 +
  835 + private static double countOilExpend(List<OilInfo> oilArray) {
  836 + double sum = 0;
  837 + for (OilInfo oilInfo : oilArray) {
  838 + sum = Arith.add(sum, oilInfo.getYh());
  839 + }
  840 + return sum;
  841 + }
  842 +
  843 + private static double sumAddOil(List<OilInfo> oilArray) {
  844 + double sum = 0;
  845 + for (OilInfo oilInfo : oilArray) {
  846 + sum = Arith.add(sum, oilInfo.getJzl());
  847 + }
  848 + return sum;
  849 + }
  850 +
  851 + private static double countOilExpend(List<OilInfo> oilArray, String jGh) {
  852 + double sum = 0;
  853 + for (OilInfo oilInfo : oilArray) {
  854 + if (oilInfo.getJsy().equals(jGh))
  855 + sum = Arith.add(sum, oilInfo.getYh());
  856 + }
  857 + return sum;
  858 + }
  859 +
  860 + public static <T> List<T> likeGet(Map<String, T> map, String key) {
  861 + Set<String> ks = map.keySet();
  862 + List<T> list = new ArrayList<>();
  863 +
  864 + if (StringUtils.isEmpty(key))
  865 + return list;
  866 +
  867 + for (String k : ks) {
  868 + if (k.indexOf(key) != -1) {
  869 + list.add(map.get(k));
  870 + }
  871 + }
  872 + return list;
  873 + }
  874 +
  875 + /**
  876 + * 将数据转换成南汇工资系统需要的驾驶员考勤数据
  877 + *
  878 + * @param plans
  879 + * @param reals
  880 + * @param types
  881 + * @return
  882 + */
  883 + public static Jsy_attendance[] to_jsyAttendanceNH(List<SchedulePlanInfo> plans, List<ScheduleRealInfo> reals, Set<String> jsySet, Map<String, String> types, String rq) {
  884 + //List<String> ghArray = new ArrayList<>(types.keySet());
  885 + List<Jsy_attendance> rs = new ArrayList<Jsy_attendance>();
  886 + for (String jGh : jsySet) {
  887 + List<SchedulePlanInfo> tplans = searchByJsy(plans, jGh);
  888 + List<ScheduleRealInfo> treals = searchRealByJsy(reals, jGh);
  889 + Set<String> lines = new HashSet<String>();
  890 + for (SchedulePlanInfo p : tplans) {
  891 + lines.add(p.getXlBm());
  892 + }
  893 + for (ScheduleRealInfo r : treals) {
  894 + lines.add(r.getXlBm());
  895 + }
  896 + for (String line : lines) {
  897 + Jsy_attendance attendance = new Jsy_attendance();
  898 + SchedulePlanInfo plan = null;
  899 + ScheduleRealInfo real = null;
  900 + for (SchedulePlanInfo p : tplans) {
  901 + if (line.equals(p.getXlBm())) {
  902 + plan = p;
  903 + break;
  904 + }
  905 + }
  906 + for (ScheduleRealInfo r : treals) {
  907 + if (line.equals(r.getXlBm())) {
  908 + real = r;
  909 + break;
  910 + }
  911 + }
  912 + attendance.setRq(rq);
  913 + //考勤
  914 + attendance.setStatus((plan==null?"0":"1") + "," + (real==null?"0":"1"));
  915 + //班型
  916 + attendance.setPlanType(types.get(jGh)==null?"1":types.get(jGh));
  917 + //驾驶员工号
  918 + attendance.setjGh(jGh);
  919 + //早晚班类型
  920 + attendance.calcZybType(reals);
  921 +
  922 + //实际计划
  923 + if(real != null){
  924 + attendance.setXlBm(real.getXlBm());
  925 + attendance.setXlName(real.getXlName());
  926 + attendance.setjName(real.getjName());
  927 + attendance.setsGh(real.getsGh());
  928 + attendance.setsName(real.getsName());
  929 + attendance.setCompany(real.getGsBm());
  930 + attendance.setFgsCompany(real.getFgsBm());
  931 + attendance.addLpName(real.getLpName());
  932 + attendance.addCl(real.getClZbh());
  933 + }
  934 + //计划
  935 + else if(plan != null){
  936 + attendance.setXlBm(plan.getXlBm());
  937 + attendance.setXlName(plan.getXlName());
  938 + attendance.setjName(plan.getjName());
  939 + attendance.setsGh(plan.getsGh());
  940 + attendance.setsName(plan.getsName());
  941 + attendance.setCompany(plan.getGsBm());
  942 + attendance.setFgsCompany(plan.getFgsBm());
  943 + attendance.addLpName(plan.getLpName());
  944 + attendance.addCl(plan.getClZbh());
  945 + }
  946 +
  947 + rs.add(attendance);
  948 + }
  949 + }
  950 +
  951 + return rs.toArray(new Jsy_attendance[rs.size()]);
  952 + }
  953 +
  954 + /**
  955 + * 将数据转换成南汇工资系统需要的考勤数据(司/售) 版本2
  956 + *
  957 + * @param plans
  958 + * @param reals
  959 + * @param types
  960 + * @return
  961 + */
  962 + public static Ssry_attendance[] toAttendanceNH(List<SchedulePlanInfo> plans, List<ScheduleRealInfo> reals, Set<String> jsys, Set<String> spys, String rq) {
  963 + //List<String> ghArray = new ArrayList<>(types.keySet());
  964 + List<Ssry_attendance> rs = new ArrayList<Ssry_attendance>();
  965 + for (String jGh : jsys) {
  966 + List<SchedulePlanInfo> tplans = searchByGh(plans, jGh, 1);
  967 + List<ScheduleRealInfo> treals = searchRealByGh(reals, jGh, 1);
  968 + padding(reals, tplans, treals, jGh, rq, 1, rs);
  969 + }
  970 +
  971 + for (String sGh : spys) {
  972 + List<SchedulePlanInfo> tplans = searchByGh(plans, sGh, 2);
  973 + List<ScheduleRealInfo> treals = searchRealByGh(reals, sGh, 2);
  974 + padding(reals, tplans, treals, sGh, rq, 2, rs);
  975 + }
  976 +
  977 + return rs.toArray(new Ssry_attendance[rs.size()]);
  978 + }
  979 +
  980 + private static void padding(List<ScheduleRealInfo> reals, List<SchedulePlanInfo> tplans, List<ScheduleRealInfo> treals, String gh, String rq, int yglx, List<Ssry_attendance> rs) {
  981 + Set<String> lines = new HashSet<String>();
  982 + for (SchedulePlanInfo p : tplans) {
  983 + lines.add(p.getXlBm());
  984 + }
  985 + for (ScheduleRealInfo r : treals) {
  986 + lines.add(r.getXlBm());
  987 + }
  988 + for (String line : lines) {
  989 + Ssry_attendance attendance = new Ssry_attendance();
  990 + SchedulePlanInfo plan = null;
  991 + ScheduleRealInfo real = null;
  992 + Set<String> cls = new HashSet<String>(), lps = new HashSet<String>();
  993 + for (SchedulePlanInfo p : tplans) {
  994 + if (line.equals(p.getXlBm())) {
  995 + plan = p;
  996 + cls.add(p.getClZbh());
  997 + lps.add(p.getLpName());
  998 + }
  999 + }
  1000 + for (ScheduleRealInfo r : treals) {
  1001 + if (line.equals(r.getXlBm())) {
  1002 + real = r;
  1003 + cls.add(r.getClZbh());
  1004 + lps.add(r.getLpName());
  1005 + }
  1006 + }
  1007 + for (String cl : cls) {
  1008 + attendance.addCl(cl);
  1009 + }
  1010 + for (String lp : lps) {
  1011 + attendance.addLpName(lp);
  1012 + }
  1013 + attendance.setYglx(yglx);
  1014 + attendance.setRq(rq);
  1015 + //考勤
  1016 + attendance.setStatus((plan==null?"0":"1") + "," + (real==null?"0":"1"));
  1017 + //驾驶员工号
  1018 + attendance.setGh(gh);
  1019 + //早晚班类型
  1020 + attendance.calcZybType(reals);
  1021 +
  1022 + String name = null;
  1023 + //实际计划
  1024 + if(real != null){
  1025 + attendance.setXlBm(real.getXlBm());
  1026 + attendance.setXlName(real.getXlName());
  1027 + if (yglx == 1) {
  1028 + name = real.getjName();
  1029 + } else if (yglx == 2) {
  1030 + name = real.getsName();
  1031 + }
  1032 + }
  1033 + //计划
  1034 + else if(plan != null){
  1035 + attendance.setXlBm(plan.getXlBm());
  1036 + attendance.setXlName(plan.getXlName());
  1037 + if (yglx == 1) {
  1038 + name = plan.getjName();
  1039 + } else if (yglx == 2) {
  1040 + name = plan.getsName();
  1041 + }
  1042 + }
  1043 + attendance.setName(name);
  1044 +
  1045 + rs.add(attendance);
  1046 + }
  1047 + }
  1048 +
  1049 + public static List<SchedulePlanInfo> searchByJsy(List<SchedulePlanInfo> plans, String jGh){
  1050 + List<SchedulePlanInfo> rs = new ArrayList<SchedulePlanInfo>();
  1051 + String oldLineId = "0";
  1052 + for(SchedulePlanInfo plan : plans){
  1053 + if (plan.getjGh().equals(jGh) && !oldLineId.equals(plan.getXlBm())) {
  1054 + rs.add(plan);
  1055 + oldLineId = plan.getXlBm();
  1056 + }
  1057 + }
  1058 +
  1059 + return rs;
  1060 + }
  1061 +
  1062 + public static List<SchedulePlanInfo> searchByGh(List<SchedulePlanInfo> plans, String gh, int yglx){
  1063 + List<SchedulePlanInfo> rs = new ArrayList<SchedulePlanInfo>();
  1064 + for(SchedulePlanInfo plan : plans){
  1065 + String tgh = null;
  1066 + if (yglx == 1) {
  1067 + tgh = plan.getjGh();
  1068 + } else if (yglx == 2) {
  1069 + tgh = plan.getsGh();
  1070 + }
  1071 + if (gh.equals(tgh)) {
  1072 + rs.add(plan);
  1073 + }
  1074 + }
  1075 +
  1076 + return rs;
  1077 + }
  1078 +
  1079 + public static List<ScheduleRealInfo> searchRealByJsy(List<ScheduleRealInfo> reals, String jGh){
  1080 + List<ScheduleRealInfo> rs = new ArrayList<ScheduleRealInfo>();
  1081 + String oldLineId = "0";
  1082 + for(ScheduleRealInfo sch : reals){
  1083 + if (sch.getjGh().equals(jGh) && !oldLineId.equals(sch.getXlBm())) {
  1084 + rs.add(sch);
  1085 + oldLineId = sch.getXlBm();
  1086 + }
  1087 + }
  1088 +
  1089 + return rs;
  1090 + }
  1091 +
  1092 + public static List<ScheduleRealInfo> searchRealByGh(List<ScheduleRealInfo> reals, String gh, int yglx){
  1093 + List<ScheduleRealInfo> rs = new ArrayList<ScheduleRealInfo>();
  1094 + for(ScheduleRealInfo sch : reals){
  1095 + String tgh = null;
  1096 + if (yglx == 1) {
  1097 + tgh = sch.getjGh();
  1098 + } else if (yglx == 2) {
  1099 + tgh = sch.getsGh();
  1100 + }
  1101 + if (gh.equals(tgh)) {
  1102 + rs.add(sch);
  1103 + }
  1104 + }
  1105 +
  1106 + return rs;
  1107 + }
  1108 +
  1109 + /**
  1110 + * 将排班和油耗转换成综合查询需要的数据
  1111 + * @param schList
  1112 + * @param oilList
  1113 + * @return
  1114 + */
  1115 + public static String[] to_getLSLC_PB(String fdate, List<ScheduleRealInfo> schList, List<OilInfo> oilList, List<SchedulePlanInfo> planList) {
  1116 + String[] array = new String[0];
  1117 + try {
  1118 + //按日期分组数据
  1119 + ArrayListMultimap<String, ScheduleRealInfo> schMultimap =
  1120 + new ConvertUtil().groupMultiList(schList, "_", ScheduleRealInfo.class.getDeclaredField("scheduleDateStr"));
  1121 +
  1122 + ArrayListMultimap<String, OilInfo> oilMultimap =
  1123 + new ConvertUtil().groupMultiList(oilList, "_", OilInfo.class.getDeclaredField("rq"));
  1124 +
  1125 + ArrayListMultimap<String, SchedulePlanInfo> planMultimap =
  1126 + new ConvertUtil().groupMultiList(planList, "_", SchedulePlanInfo.class.getDeclaredField("scheduleDate"));
  1127 +
  1128 +
  1129 + //月份有多少天
  1130 + int year = Integer.parseInt(fdate.substring(0, 4));
  1131 + int month = Integer.parseInt(fdate.substring(5, 7));
  1132 + Calendar cal = Calendar.getInstance();
  1133 + cal.set(Calendar.YEAR,year);
  1134 + cal.set(Calendar.MONTH,month - 1);//从0开始
  1135 + int maxDate = cal.getActualMaximum(Calendar.DATE);
  1136 +
  1137 + List<LsLcPb> rs = new ArrayList<>();
  1138 + LsLcPb lcPb;
  1139 + List<ScheduleRealInfo> pbList;
  1140 + List<SchedulePlanInfo> jhList;
  1141 + List<OilInfo> yhList;
  1142 + String rq,rq2;
  1143 + SchedulePlanInfo outPlan;
  1144 + int currentDay = cal.get(Calendar.DAY_OF_MONTH);
  1145 + for(int i = 1; i <= maxDate; i++){
  1146 + lcPb = new LsLcPb();
  1147 + lcPb.setDay(i);
  1148 +
  1149 + rq = fdate + "-" + (i < 10?"0":"") + i;
  1150 + rq2 = rq.replaceAll("-", "");
  1151 +
  1152 + pbList = schMultimap.get(rq);
  1153 + yhList = oilMultimap.get(rq2);
  1154 + jhList = planMultimap.get(rq2);
  1155 +
  1156 + if(i < currentDay){
  1157 + if(pbList == null || pbList.size() == 0)
  1158 + lcPb.setType(4);//休息
  1159 + else{
  1160 + lcPb.setType(1);
  1161 + lcPb.setLckq("");
  1162 + if(yhList != null && yhList.size() > 0){
  1163 + lcPb.setLcyh(yhList.get(0).getYh());
  1164 + }
  1165 + lcPb.setLcyylc(ScheduleCalculator.calcYYLC(pbList));
  1166 + lcPb.setLcfyylc(ScheduleCalculator.calcKSLC(pbList));
  1167 + }
  1168 + }
  1169 + else if (i == currentDay)
  1170 + lcPb.setType(3);//今天
  1171 + else {
  1172 + if(jhList == null || jhList.size() == 0)
  1173 + lcPb.setType(4);//休息
  1174 + else{
  1175 + lcPb.setType(2);
  1176 + outPlan = getOutSch(jhList);
  1177 + if(null != outPlan){
  1178 + lcPb.setPbxl(outPlan.getXlName());
  1179 + lcPb.setPblp(outPlan.getLpName());
  1180 + lcPb.setPbbd(minusMinute(outPlan.getFcsj(), 15));
  1181 + lcPb.setPbyc(outPlan.getClZbh());
  1182 + }
  1183 + else
  1184 + lcPb.setType(4);//休息
  1185 + }
  1186 + }
  1187 +
  1188 + rs.add(lcPb);
  1189 + }
  1190 +
  1191 + //拼接成字符串数组
  1192 + array = new String[rs.size()];
  1193 + StringBuilder sb;
  1194 + for(int i = 0,len=rs.size(); i < len; i++){
  1195 + lcPb = rs.get(i);
  1196 + sb = new StringBuilder();
  1197 +
  1198 + sb.append(lcPb.getType());
  1199 +
  1200 + switch (lcPb.getType()){
  1201 + case 1:
  1202 + sb.append("," + lcPb.getLckq());
  1203 + sb.append("," + lcPb.getLcyh());
  1204 + sb.append("," + lcPb.getLcyylc());
  1205 + sb.append("," + lcPb.getLcfyylc());
  1206 + break;
  1207 + case 2:
  1208 + sb.append("," + lcPb.getPbxl());
  1209 + sb.append("," + lcPb.getPblp());
  1210 + sb.append("," + lcPb.getPbbd());
  1211 + sb.append("," + lcPb.getPbyc());
  1212 + break;
  1213 + }
  1214 + sb.append("," + lcPb.getDay());
  1215 + array[i] = sb.toString();
  1216 + }
  1217 + } catch (NoSuchFieldException e) {
  1218 + logger.error("", e);
  1219 + }
  1220 + return array;
  1221 + }
  1222 +
  1223 + /**
  1224 + * 将排班和油耗转换成综合查询需要的数据
  1225 + * @param schList
  1226 + * @param oilList
  1227 + * @return
  1228 + */
  1229 + public static List<LsLcPb> to_getLSLC_PB_list(String fdate, List<ScheduleRealInfo> schList, List<OilInfo> oilList, List<SchedulePlanInfo> planList) {
  1230 + List<LsLcPb> rs = new ArrayList<>();
  1231 + try {
  1232 + //按日期分组数据
  1233 + ArrayListMultimap<String, ScheduleRealInfo> schMultimap =
  1234 + new ConvertUtil().groupMultiList(schList, "_", ScheduleRealInfo.class.getDeclaredField("scheduleDateStr"));
  1235 +
  1236 + ArrayListMultimap<String, OilInfo> oilMultimap =
  1237 + new ConvertUtil().groupMultiList(oilList, "_", OilInfo.class.getDeclaredField("rq"));
  1238 +
  1239 + ArrayListMultimap<String, SchedulePlanInfo> planMultimap =
  1240 + new ConvertUtil().groupMultiList(planList, "_", SchedulePlanInfo.class.getDeclaredField("scheduleDate"));
  1241 +
  1242 +
  1243 + //月份有多少天
  1244 + int year = Integer.parseInt(fdate.substring(0, 4));
  1245 + int month = Integer.parseInt(fdate.substring(5, 7));
  1246 + Calendar cal = Calendar.getInstance();
  1247 + cal.set(Calendar.YEAR,year);
  1248 + cal.set(Calendar.MONTH,month - 1);//从0开始
  1249 + int maxDate = cal.getActualMaximum(Calendar.DATE);
  1250 +
  1251 + LsLcPb lcPb;
  1252 + List<ScheduleRealInfo> pbList;
  1253 + List<SchedulePlanInfo> jhList;
  1254 + List<OilInfo> yhList;
  1255 + String rq,rq2;
  1256 + SchedulePlanInfo outPlan;
  1257 + int currentDay = cal.get(Calendar.DAY_OF_MONTH);
  1258 + for(int i = 1; i <= maxDate; i++){
  1259 + lcPb = new LsLcPb();
  1260 + lcPb.setDay(i);
  1261 +
  1262 + rq = fdate + "-" + (i < 10?"0":"") + i;
  1263 + rq2 = rq.replaceAll("-", "");
  1264 +
  1265 + pbList = schMultimap.get(rq);
  1266 + yhList = oilMultimap.get(rq2);
  1267 + jhList = planMultimap.get(rq2);
  1268 +
  1269 + if(i < currentDay){
  1270 + if(pbList == null || pbList.size() == 0)
  1271 + lcPb.setType(4);//休息
  1272 + else{
  1273 + lcPb.setType(1);
  1274 + lcPb.setLckq("");
  1275 + if(yhList != null && yhList.size() > 0){
  1276 + lcPb.setLcyh(yhList.get(0).getYh());
  1277 + }
  1278 + lcPb.setLcyylc(ScheduleCalculator.calcYYLC(pbList));
  1279 + lcPb.setLcfyylc(ScheduleCalculator.calcKSLC(pbList));
  1280 + }
  1281 + }
  1282 + else if (i == currentDay)
  1283 + lcPb.setType(3);//今天
  1284 + else {
  1285 + if(jhList == null || jhList.size() == 0)
  1286 + lcPb.setType(4);//休息
  1287 + else{
  1288 + lcPb.setType(2);
  1289 + outPlan = getOutSch(jhList);
  1290 + if(null != outPlan){
  1291 + lcPb.setPbxl(outPlan.getXlName());
  1292 + lcPb.setPblp(outPlan.getLpName());
  1293 + lcPb.setPbbd(minusMinute(outPlan.getFcsj(), 15));
  1294 + lcPb.setPbyc(outPlan.getClZbh());
  1295 + }
  1296 + else
  1297 + lcPb.setType(4);//休息
  1298 + }
  1299 + }
  1300 +
  1301 + rs.add(lcPb);
  1302 + }
  1303 + } catch (NoSuchFieldException e) {
  1304 + logger.error("", e);
  1305 + }
  1306 + return rs;
  1307 + }
  1308 +
  1309 + /**
  1310 + * HH:mm 格式时间减分钟
  1311 + * @param dfsj
  1312 + * @param i
  1313 + * @return
  1314 + */
  1315 + private static String minusMinute(String hhmm, int i) {
  1316 + try {
  1317 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
  1318 + long t = sdf.parse(hhmm).getTime();
  1319 +
  1320 + return sdf.format(new Date(t - (i * 60 * 1000)));
  1321 + } catch (ParseException e) {
  1322 + logger.error("", e);
  1323 + }
  1324 + return null;
  1325 + }
  1326 +
  1327 + private static SchedulePlanInfo getOutSch(List<SchedulePlanInfo> pbList) {
  1328 +
  1329 + for(SchedulePlanInfo sch : pbList){
  1330 + if(sch.getBcType().equals("out"))
  1331 + return sch;
  1332 + }
  1333 + return null;
  1334 + }
  1335 +
  1336 + public static class OilComp implements Comparator<OilInfo> {
  1337 +
  1338 + @Override
  1339 + public int compare(OilInfo o1, OilInfo o2) {
  1340 + return o1.getJcsx() - o2.getJcsx();
  1341 + }
  1342 + }
  1343 +
  1344 +
  1345 +}
src/main/java/com/bsth/server_ws/waybill/LD_ServiceSoap.java
1 -package com.bsth.server_ws.waybill;  
2 -  
3 -import java.util.List;  
4 -import java.util.Map;  
5 -  
6 -import javax.jws.WebService;  
7 -import javax.xml.ws.Holder;  
8 -  
9 -import com.fasterxml.jackson.databind.ObjectMapper;  
10 -import org.joda.time.format.DateTimeFormat;  
11 -import org.joda.time.format.DateTimeFormatter;  
12 -import org.slf4j.Logger;  
13 -import org.slf4j.LoggerFactory;  
14 -import org.springframework.beans.BeansException;  
15 -import org.springframework.context.ApplicationContext;  
16 -import org.springframework.context.ApplicationContextAware;  
17 -import org.springframework.stereotype.Component;  
18 -  
19 -import com.bsth.entity.DutyEmployee;  
20 -import com.bsth.entity.ElecInfo;  
21 -import com.bsth.entity.OilInfo;  
22 -import com.bsth.entity.ScheduleRealInfo;  
23 -import com.bsth.redis.ElecRedisService;  
24 -import com.bsth.redis.OilRedisService;  
25 -import com.bsth.redis.ScheduleRedisService;  
26 -import com.bsth.repository.DutyEmployeeRepository;  
27 -import com.bsth.server_ws.util.WSDataConver;  
28 -import com.bsth.server_ws.waybill.entity.NH_waybill;  
29 -import com.bsth.server_ws.waybill.entity.SN_lossMileage;  
30 -import com.bsth.server_ws.waybill.entity.SN_waybill;  
31 -import com.bsth.service.UserService;  
32 -import com.google.common.collect.ArrayListMultimap;  
33 -  
34 -/**  
35 - * Created by panzhao on 2017/3/17.  
36 - */  
37 -@Component  
38 -@WebService(  
39 - name = "LD_ServiceSoap",  
40 - portName = "LD_ServiceSoap",  
41 - serviceName = "LD_Service",  
42 - targetNamespace = "http://control.bsth.com/",  
43 - endpointInterface = "com.bsth.server_ws.waybill.LD_Service")  
44 -public class LD_ServiceSoap implements LD_Service, ApplicationContextAware {  
45 -  
46 - static OilRedisService oilRedisService;  
47 - static ElecRedisService elecRedisService;  
48 - static ScheduleRedisService scheduleRedisService;  
49 - static DutyEmployeeRepository dutyEmployeeRepository;  
50 -  
51 - static UserService userService;  
52 -  
53 - Logger logger = LoggerFactory.getLogger(this.getClass());  
54 -  
55 - private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"),  
56 - fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");  
57 -  
58 - @Override  
59 - public boolean waybill_NH(String password, String rq, String companyId, Holder<NH_waybill[]> result, Holder<String> fError) {  
60 - try {  
61 - if(userService.get(password) == null){  
62 - fError.value = "无效的密码!";  
63 - return false;  
64 - }  
65 - //日期减一天,老接口是这样的  
66 - //rq = fmtyyyyMMdd.print(fmtyyyyMMdd.parseDateTime(rq).minusDays(1));  
67 - String prveRq = fmtyyyyMMdd.print(fmtyyyyMMdd.parseDateTime(rq).minusDays(1));  
68 -  
69 - //实际排班  
70 - ArrayListMultimap<String, ScheduleRealInfo> listMap = scheduleRedisService.findByDateAndGroupByNbbm(prveRq, companyId);  
71 - //油耗信息  
72 - ArrayListMultimap<String, OilInfo> oilInfoMap = oilRedisService.findByNbbmGroup(listMap.keySet(), prveRq);  
73 - //电耗信息  
74 - ArrayListMultimap<String, ElecInfo> elecInfoMap = elecRedisService.findByNbbmGroup(listMap.keySet(), prveRq);  
75 - //当班调派  
76 - long st = fmtyyyyMMddHHmm.parseMillis(prveRq + "00:00"), et = fmtyyyyMMddHHmm.parseMillis(prveRq + "23:59");  
77 - List<DutyEmployee> des = dutyEmployeeRepository.findByTime(st, et);  
78 - //转换成南汇路单需要的格式  
79 - NH_waybill[] array = WSDataConver.to_waybill_NH(listMap, oilInfoMap, elecInfoMap, des);  
80 - result.value = array;  
81 -  
82 - //不再代理老接口数据  
83 - /*if(companyId.equals("26") && !WebServiceProxy.isAllNew(companyId)){  
84 - ClsLDInfo[] oldArray = OldWSClient.getNH_LD(companyId, rq);  
85 - //合并新老系统的数据  
86 - result.value = WebServiceProxy.mergerData(result.value, oldArray, companyId);  
87 - }*/  
88 - } catch (Exception e) {  
89 - logger.error("", e);  
90 - fError.value = "服务器出现异常!";  
91 - return false;  
92 - }  
93 - return true;  
94 - }  
95 -  
96 - @Override  
97 - public boolean waybill_NH4TH(String password, String rq, String companyId, Holder<NH_waybill[]> result, Holder<String> fError) {  
98 - try {  
99 - if(userService.get(password) == null){  
100 - fError.value = "无效的密码!";  
101 - return false;  
102 - }  
103 - //日期减一天,老接口是这样的  
104 - //rq = fmtyyyyMMdd.print(fmtyyyyMMdd.parseDateTime(rq).minusDays(1));  
105 - String prveRq = fmtyyyyMMdd.print(fmtyyyyMMdd.parseDateTime(rq).minusDays(1));  
106 -  
107 - //实际排班  
108 - ArrayListMultimap<String, ScheduleRealInfo> listMap = scheduleRedisService.findByDateAndGroupByNbbm(prveRq, companyId);  
109 - //油耗信息  
110 - ArrayListMultimap<String, OilInfo> oilInfoMap = oilRedisService.findByNbbmGroup(listMap.keySet(), prveRq);  
111 - //电耗信息  
112 - ArrayListMultimap<String, ElecInfo> elecInfoMap = elecRedisService.findByNbbmGroup(listMap.keySet(), prveRq);  
113 - //当班调派  
114 - long st = fmtyyyyMMddHHmm.parseMillis(prveRq + "00:00"), et = fmtyyyyMMddHHmm.parseMillis(prveRq + "23:59");  
115 - List<DutyEmployee> des = dutyEmployeeRepository.findByTime(st, et);  
116 - //转换成南汇路单需要的格式  
117 - NH_waybill[] array = WSDataConver.to_waybill_NH4TH(listMap, oilInfoMap, elecInfoMap, des);  
118 - result.value = array;  
119 -  
120 - //不再代理老接口数据  
121 - /*if(companyId.equals("26") && !WebServiceProxy.isAllNew(companyId)){  
122 - ClsLDInfo[] oldArray = OldWSClient.getNH_LD(companyId, rq);  
123 - //合并新老系统的数据  
124 - result.value = WebServiceProxy.mergerData(result.value, oldArray, companyId);  
125 - }*/  
126 - } catch (Exception e) {  
127 - logger.error("", e);  
128 - fError.value = "服务器出现异常!";  
129 - return false;  
130 - }  
131 - return true;  
132 - }  
133 -  
134 - @Override  
135 - public boolean waybill_SN(String password, String rq, String companyId, Holder<SN_waybill[]> result, Holder<String> fError) {  
136 - try {  
137 - if(userService.get(password) == null){  
138 - fError.value = "无效的密码!";  
139 - return false;  
140 - }  
141 -  
142 - //实际排班  
143 - ArrayListMultimap<String, ScheduleRealInfo> listMap = scheduleRedisService.findByDateAndGroupByNbbm(rq, companyId);  
144 - //油耗信息  
145 - Map<String, OilInfo> oilInfoMap = oilRedisService.findByNbbmGroupRaw(listMap.keySet(), rq);  
146 - //转换成上南路单需要的格式  
147 - SN_waybill[] array = WSDataConver.to_waybill_SN(listMap, oilInfoMap);  
148 - result.value = array;  
149 - } catch (Exception e) {  
150 - logger.error("", e);  
151 - fError.value = "服务器出现异常!";  
152 - return false;  
153 - }  
154 - return true;  
155 - }  
156 -  
157 - @Override  
158 - public boolean lossMileage(String password, String rq, String companyId, Holder<SN_lossMileage[]> result, Holder<String> fError) {  
159 - try {  
160 - if(userService.get(password) == null){  
161 - fError.value = "无效的密码!";  
162 - return false;  
163 - }  
164 -  
165 - //按线路分组的实际排班  
166 - ArrayListMultimap<String, ScheduleRealInfo> listMap = scheduleRedisService.findByDateAndGroupByLine(rq, companyId);  
167 - //转换成上南需要的损失公里数据  
168 - SN_lossMileage[] array = WSDataConver.to_lossMileage_SN(listMap);  
169 - result.value = array;  
170 - } catch (Exception e) {  
171 - logger.error("", e);  
172 - fError.value = "服务器出现异常!";  
173 - return false;  
174 - }  
175 - return false;  
176 - }  
177 -  
178 -  
179 - @Override  
180 - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {  
181 - oilRedisService = applicationContext.getBean(OilRedisService.class);  
182 - elecRedisService = applicationContext.getBean(ElecRedisService.class);  
183 - scheduleRedisService = applicationContext.getBean(ScheduleRedisService.class);  
184 - dutyEmployeeRepository = applicationContext.getBean(DutyEmployeeRepository.class);  
185 - userService = applicationContext.getBean(UserService.class);  
186 - }  
187 -} 1 +package com.bsth.server_ws.waybill;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import javax.jws.WebService;
  7 +import javax.xml.ws.Holder;
  8 +
  9 +import com.fasterxml.jackson.databind.ObjectMapper;
  10 +import org.joda.time.format.DateTimeFormat;
  11 +import org.joda.time.format.DateTimeFormatter;
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.BeansException;
  15 +import org.springframework.context.ApplicationContext;
  16 +import org.springframework.context.ApplicationContextAware;
  17 +import org.springframework.stereotype.Component;
  18 +
  19 +import com.bsth.entity.DutyEmployee;
  20 +import com.bsth.entity.ElecInfo;
  21 +import com.bsth.entity.HInfo;
  22 +import com.bsth.entity.OilInfo;
  23 +import com.bsth.entity.ScheduleRealInfo;
  24 +import com.bsth.redis.ElecRedisService;
  25 +import com.bsth.redis.HRedisService;
  26 +import com.bsth.redis.OilRedisService;
  27 +import com.bsth.redis.ScheduleRedisService;
  28 +import com.bsth.repository.DutyEmployeeRepository;
  29 +import com.bsth.server_ws.util.WSDataConver;
  30 +import com.bsth.server_ws.waybill.entity.NH_waybill;
  31 +import com.bsth.server_ws.waybill.entity.SN_lossMileage;
  32 +import com.bsth.server_ws.waybill.entity.SN_waybill;
  33 +import com.bsth.service.UserService;
  34 +import com.google.common.collect.ArrayListMultimap;
  35 +
  36 +/**
  37 + * Created by panzhao on 2017/3/17.
  38 + */
  39 +@Component
  40 +@WebService(
  41 + name = "LD_ServiceSoap",
  42 + portName = "LD_ServiceSoap",
  43 + serviceName = "LD_Service",
  44 + targetNamespace = "http://control.bsth.com/",
  45 + endpointInterface = "com.bsth.server_ws.waybill.LD_Service")
  46 +public class LD_ServiceSoap implements LD_Service, ApplicationContextAware {
  47 +
  48 + static OilRedisService oilRedisService;
  49 + static ElecRedisService elecRedisService;
  50 + static HRedisService hRedisService;
  51 + static ScheduleRedisService scheduleRedisService;
  52 + static DutyEmployeeRepository dutyEmployeeRepository;
  53 +
  54 + static UserService userService;
  55 +
  56 + Logger logger = LoggerFactory.getLogger(this.getClass());
  57 +
  58 + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"),
  59 + fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
  60 +
  61 + @Override
  62 + public boolean waybill_NH(String password, String rq, String companyId, Holder<NH_waybill[]> result, Holder<String> fError) {
  63 + try {
  64 + if(userService.get(password) == null){
  65 + fError.value = "无效的密码!";
  66 + return false;
  67 + }
  68 + //日期减一天,老接口是这样的
  69 + //rq = fmtyyyyMMdd.print(fmtyyyyMMdd.parseDateTime(rq).minusDays(1));
  70 + String prveRq = fmtyyyyMMdd.print(fmtyyyyMMdd.parseDateTime(rq).minusDays(1));
  71 +
  72 + //实际排班
  73 + ArrayListMultimap<String, ScheduleRealInfo> listMap = scheduleRedisService.findByDateAndGroupByNbbm(prveRq, companyId);
  74 + //油耗信息
  75 + ArrayListMultimap<String, OilInfo> oilInfoMap = oilRedisService.findByNbbmGroup(listMap.keySet(), prveRq);
  76 + //电耗信息
  77 + ArrayListMultimap<String, ElecInfo> elecInfoMap = elecRedisService.findByNbbmGroup(listMap.keySet(), prveRq);
  78 + //氢耗信息
  79 + ArrayListMultimap<String, HInfo> hInfoMap = hRedisService.findByNbbmGroup(listMap.keySet(), prveRq);
  80 + //当班调派
  81 + long st = fmtyyyyMMddHHmm.parseMillis(prveRq + "00:00"), et = fmtyyyyMMddHHmm.parseMillis(prveRq + "23:59");
  82 + List<DutyEmployee> des = dutyEmployeeRepository.findByTime(st, et);
  83 + //转换成南汇路单需要的格式
  84 + NH_waybill[] array = WSDataConver.to_waybill_NH(listMap, oilInfoMap, elecInfoMap, hInfoMap, des);
  85 + result.value = array;
  86 +
  87 + //不再代理老接口数据
  88 + /*if(companyId.equals("26") && !WebServiceProxy.isAllNew(companyId)){
  89 + ClsLDInfo[] oldArray = OldWSClient.getNH_LD(companyId, rq);
  90 + //合并新老系统的数据
  91 + result.value = WebServiceProxy.mergerData(result.value, oldArray, companyId);
  92 + }*/
  93 + } catch (Exception e) {
  94 + logger.error("", e);
  95 + fError.value = "服务器出现异常!";
  96 + return false;
  97 + }
  98 + return true;
  99 + }
  100 +
  101 + @Override
  102 + public boolean waybill_NH4TH(String password, String rq, String companyId, Holder<NH_waybill[]> result, Holder<String> fError) {
  103 + try {
  104 + if(userService.get(password) == null){
  105 + fError.value = "无效的密码!";
  106 + return false;
  107 + }
  108 + //日期减一天,老接口是这样的
  109 + //rq = fmtyyyyMMdd.print(fmtyyyyMMdd.parseDateTime(rq).minusDays(1));
  110 + String prveRq = fmtyyyyMMdd.print(fmtyyyyMMdd.parseDateTime(rq).minusDays(1));
  111 +
  112 + //实际排班
  113 + ArrayListMultimap<String, ScheduleRealInfo> listMap = scheduleRedisService.findByDateAndGroupByNbbm(prveRq, companyId);
  114 + //油耗信息
  115 + ArrayListMultimap<String, OilInfo> oilInfoMap = oilRedisService.findByNbbmGroup(listMap.keySet(), prveRq);
  116 + //电耗信息
  117 + ArrayListMultimap<String, ElecInfo> elecInfoMap = elecRedisService.findByNbbmGroup(listMap.keySet(), prveRq);
  118 + //当班调派
  119 + long st = fmtyyyyMMddHHmm.parseMillis(prveRq + "00:00"), et = fmtyyyyMMddHHmm.parseMillis(prveRq + "23:59");
  120 + List<DutyEmployee> des = dutyEmployeeRepository.findByTime(st, et);
  121 + //转换成南汇路单需要的格式
  122 + NH_waybill[] array = WSDataConver.to_waybill_NH4TH(listMap, oilInfoMap, elecInfoMap, des);
  123 + result.value = array;
  124 +
  125 + //不再代理老接口数据
  126 + /*if(companyId.equals("26") && !WebServiceProxy.isAllNew(companyId)){
  127 + ClsLDInfo[] oldArray = OldWSClient.getNH_LD(companyId, rq);
  128 + //合并新老系统的数据
  129 + result.value = WebServiceProxy.mergerData(result.value, oldArray, companyId);
  130 + }*/
  131 + } catch (Exception e) {
  132 + logger.error("", e);
  133 + fError.value = "服务器出现异常!";
  134 + return false;
  135 + }
  136 + return true;
  137 + }
  138 +
  139 + @Override
  140 + public boolean waybill_SN(String password, String rq, String companyId, Holder<SN_waybill[]> result, Holder<String> fError) {
  141 + try {
  142 + if(userService.get(password) == null){
  143 + fError.value = "无效的密码!";
  144 + return false;
  145 + }
  146 +
  147 + //实际排班
  148 + ArrayListMultimap<String, ScheduleRealInfo> listMap = scheduleRedisService.findByDateAndGroupByNbbm(rq, companyId);
  149 + //油耗信息
  150 + Map<String, OilInfo> oilInfoMap = oilRedisService.findByNbbmGroupRaw(listMap.keySet(), rq);
  151 + //转换成上南路单需要的格式
  152 + SN_waybill[] array = WSDataConver.to_waybill_SN(listMap, oilInfoMap);
  153 + result.value = array;
  154 + } catch (Exception e) {
  155 + logger.error("", e);
  156 + fError.value = "服务器出现异常!";
  157 + return false;
  158 + }
  159 + return true;
  160 + }
  161 +
  162 + @Override
  163 + public boolean lossMileage(String password, String rq, String companyId, Holder<SN_lossMileage[]> result, Holder<String> fError) {
  164 + try {
  165 + if(userService.get(password) == null){
  166 + fError.value = "无效的密码!";
  167 + return false;
  168 + }
  169 +
  170 + //按线路分组的实际排班
  171 + ArrayListMultimap<String, ScheduleRealInfo> listMap = scheduleRedisService.findByDateAndGroupByLine(rq, companyId);
  172 + //转换成上南需要的损失公里数据
  173 + SN_lossMileage[] array = WSDataConver.to_lossMileage_SN(listMap);
  174 + result.value = array;
  175 + } catch (Exception e) {
  176 + logger.error("", e);
  177 + fError.value = "服务器出现异常!";
  178 + return false;
  179 + }
  180 + return false;
  181 + }
  182 +
  183 +
  184 + @Override
  185 + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
  186 + oilRedisService = applicationContext.getBean(OilRedisService.class);
  187 + elecRedisService = applicationContext.getBean(ElecRedisService.class);
  188 + hRedisService = applicationContext.getBean(HRedisService.class);
  189 + scheduleRedisService = applicationContext.getBean(ScheduleRedisService.class);
  190 + dutyEmployeeRepository = applicationContext.getBean(DutyEmployeeRepository.class);
  191 + userService = applicationContext.getBean(UserService.class);
  192 + }
  193 +}
src/main/resources/static/38876A3F404F7051776B6717C83B581B.html deleted 100644 → 0
1 -<!DOCTYPE html>  
2 -<html>  
3 -<head>  
4 -<title>调度系统营运数据接口</title>  
5 -<meta charset="utf-8">  
6 -<meta http-equiv="Expires" content="0">  
7 -<meta http-equiv="Pragma" content="no-cache">  
8 -<meta http-equiv="Cache-control" content="no-cache">  
9 -<meta http-equiv="Cache" content="no-cache">  
10 -<link rel="stylesheet"  
11 - href="http://apps.bdimg.com/libs/bootstrap/3.2.0/css/bootstrap.min.css">  
12 -<link rel="stylesheet" href="/simple_switch/simple.switch.three.css">  
13 -<style>  
14 -.table-wrap {  
15 - height: 500px;  
16 - overflow: auto;  
17 -}  
18 -  
19 -#line2SysListTable .Switch_FlatRadius .SwitchLine:before {  
20 - content: "老系统";  
21 -}  
22 -  
23 -#line2SysListTable .Switch_FlatRadius .SwitchLine:after {  
24 - content: "新系统";  
25 -}  
26 -  
27 -#line2SysListTable .Switch_FlatRadius {  
28 - width: 118px;  
29 -}  
30 -  
31 -#line2SysListTable .Switch_FlatRadius .SwitchButton {  
32 - width: 52px;  
33 -}  
34 -  
35 -#line2SysListTable .Switch_FlatRadius .SwitchButton:before {  
36 - left: 18px;  
37 -}  
38 -  
39 -#line2SysListTable .Switch_FlatRadius .SwitchButton:after {  
40 - left: 30px;  
41 -}  
42 -  
43 -#line2SysListTable .Switch_FlatRadius.On .SwitchButton {  
44 - left: 60px;  
45 -}  
46 -</style>  
47 -</head>  
48 -  
49 -<body>  
50 -  
51 - <div class="row" style="margin: 15px;">  
52 - <div class="col-md-12 well">  
53 - <h4>  
54 - Available SOAP services: <a href="/webservice" target="_blank">/webservice</a>  
55 - </h4>  
56 - <h4>  
57 - WSDL: <a href="/webservice/CompanyService?wsdl" target="_blank">/webservice/CompanyService?wsdl</a>  
58 - </h4>  
59 - </div>  
60 -  
61 - <div class="col-lg-4 col-md-6 col-sm-12">  
62 - <div class="bs-example"  
63 - data-example-id="panel-without-body-with-table">  
64 - <div class="panel panel-default">  
65 - <!-- Default panel contents -->  
66 - <div class="panel-heading">线路清单</div>  
67 - <div class="panel-body">  
68 - <p style="color: #ff2727;">屏蔽新老系统的底层数据差异,对外提供统一的数据输出</p>  
69 - <p>1、使用员工号查询数据时,系统将参考 “线路人员配置” 以确定人员所在线路。</p>  
70 - <p>2、使用公司编码查询数据时,系统将参考 “线路基础信息” 里的公司编码。</p>  
71 - </div>  
72 - <div class="table-wrap">  
73 - <table class="table" id="line2SysListTable">  
74 - <thead>  
75 - <tr>  
76 - <th>线路编码</th>  
77 - <th>线路名称</th>  
78 - <th>数据来源</th>  
79 - </tr>  
80 - </thead>  
81 - <tbody>  
82 - </tbody>  
83 - </table>  
84 - </div>  
85 - </div>  
86 - </div>  
87 - </div>  
88 -  
89 - <div class="col-lg-8 col-md-6 col-sm-12">  
90 - <div class="bs-example">  
91 - <div class="panel panel-default">  
92 - <div class="panel-heading">接口调试工具</div>  
93 - <div style="padding: 15px; margin-top: 15px;">  
94 - <form class="form-inline">  
95 - <div class="form-group">  
96 - <label>函数</label> <select class="form-control">  
97 - <option value="returnCCInfo">returnCCInfo(获取出场班次信息)</option>  
98 - <option value="returnJCInfo">returnJCInfo(获取进场班次信息)</option>  
99 - </select>  
100 - </div>  
101 - &nbsp;  
102 - <div class="form-group">  
103 - <label>公司编码</label> <select class="form-control">  
104 - <option value="55">55(上南)</option>  
105 - <option value="22">22(金高)</option>  
106 - <option value="05">05(杨高)</option>  
107 - <option value="26">26(南汇)</option>  
108 - </select>  
109 - </div>  
110 - &nbsp;  
111 - <div class="form-group">  
112 - <label>日期</label> <input type="date" class="form-control"  
113 - style="width: 150px;" required>  
114 - </div>  
115 - <button type="submit" class="btn btn-primary">获取数据</button>  
116 -  
117 - <textarea class="form-control" rows="25"  
118 - style="width: 100%; margin-top: 25px;"></textarea>  
119 - </form>  
120 -  
121 - </div>  
122 - </div>  
123 - </div>  
124 - </div>  
125 - </div>  
126 -  
127 - <script id="line2sys-table-list-temp" type="text/html">  
128 - {{each list as obj i}}  
129 - <tr data-id="{{obj.lineCode}}" data-name="{{obj.lineName}}" {{if obj.new}}class="warning" {{/if}} >  
130 - <td>{{obj.lineCode}}</td>  
131 - <td>{{obj.lineName}}</td>  
132 - <td>  
133 - <input type="checkbox" {{if obj.new}}checked{{/if}} />  
134 - </td>  
135 - </tr>  
136 - {{/each}}  
137 -</script>  
138 -  
139 - <script src="http://apps.bdimg.com/libs/jquery/1.8.3/jquery.min.js"></script>  
140 - <script  
141 - src="http://apps.bdimg.com/libs/bootstrap/3.2.0/js/bootstrap.min.js"></script>  
142 - <script src="/assets/js/template.js"></script>  
143 - <script src="/simple_switch/simple.switch.min.js"></script>  
144 -  
145 - <script>  
146 -  
147 - //线路清单  
148 - !function () {  
149 - var f = arguments.callee;  
150 -/* $.get('/line2System/all', function (list) {  
151 - list.sort(function (a, b) {  
152 - return b.new - a.new;  
153 - });  
154 - var htmlStr = template('line2sys-table-list-temp', {list: list});  
155 - $('#line2SysListTable tbody').html(htmlStr);  
156 -  
157 - $('input[type=checkbox]').simpleSwitch({  
158 - "theme": "FlatRadius"  
159 - });  
160 -  
161 - $('input[type=checkbox]').on('change', function () {  
162 - var $tr = $(this).parents('tr');  
163 - var data = {  
164 - lineCode: $tr.data('id'),  
165 - lineName: $tr.data('name'),  
166 - new: this.checked  
167 - }  
168 -  
169 - $.post('/line2System/update', data, function (rs) {  
170 - var $tr = $('#line2SysListTable tr[data-id=' + rs.lineCode + ']');  
171 - $tr.attr('class', rs.new ? 'warning' : '');  
172 - });  
173 - });  
174 - });*/  
175 - }();  
176 -  
177 -</script>  
178 -</body>  
179 -</html>  
180 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/assets/js/template.js deleted 100644 → 0
1 -/*!art-template - Template Engine | http://aui.github.com/artTemplate/*/  
2 -!function(){function a(a){return a.replace(t,"").replace(u,",").replace(v,"").replace(w,"").replace(x,"").split(y)}function b(a){return"'"+a.replace(/('|\\)/g,"\\$1").replace(/\r/g,"\\r").replace(/\n/g,"\\n")+"'"}function c(c,d){function e(a){return m+=a.split(/\n/).length-1,k&&(a=a.replace(/\s+/g," ").replace(/<!--[\w\W]*?-->/g,"")),a&&(a=s[1]+b(a)+s[2]+"\n"),a}function f(b){var c=m;if(j?b=j(b,d):g&&(b=b.replace(/\n/g,function(){return m++,"$line="+m+";"})),0===b.indexOf("=")){var e=l&&!/^=[=#]/.test(b);if(b=b.replace(/^=[=#]?|[\s;]*$/g,""),e){var f=b.replace(/\s*\([^\)]+\)/,"");n[f]||/^(include|print)$/.test(f)||(b="$escape("+b+")")}else b="$string("+b+")";b=s[1]+b+s[2]}return g&&(b="$line="+c+";"+b),r(a(b),function(a){if(a&&!p[a]){var b;b="print"===a?u:"include"===a?v:n[a]?"$utils."+a:o[a]?"$helpers."+a:"$data."+a,w+=a+"="+b+",",p[a]=!0}}),b+"\n"}var g=d.debug,h=d.openTag,i=d.closeTag,j=d.parser,k=d.compress,l=d.escape,m=1,p={$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1},q="".trim,s=q?["$out='';","$out+=",";","$out"]:["$out=[];","$out.push(",");","$out.join('')"],t=q?"$out+=text;return $out;":"$out.push(text);",u="function(){var text=''.concat.apply('',arguments);"+t+"}",v="function(filename,data){data=data||$data;var text=$utils.$include(filename,data,$filename);"+t+"}",w="'use strict';var $utils=this,$helpers=$utils.$helpers,"+(g?"$line=0,":""),x=s[0],y="return new String("+s[3]+");";r(c.split(h),function(a){a=a.split(i);var b=a[0],c=a[1];1===a.length?x+=e(b):(x+=f(b),c&&(x+=e(c)))});var z=w+x+y;g&&(z="try{"+z+"}catch(e){throw {filename:$filename,name:'Render Error',message:e.message,line:$line,source:"+b(c)+".split(/\\n/)[$line-1].replace(/^\\s+/,'')};}");try{var A=new Function("$data","$filename",z);return A.prototype=n,A}catch(B){throw B.temp="function anonymous($data,$filename) {"+z+"}",B}}var d=function(a,b){return"string"==typeof b?q(b,{filename:a}):g(a,b)};d.version="3.0.0",d.config=function(a,b){e[a]=b};var e=d.defaults={openTag:"<%",closeTag:"%>",escape:!0,cache:!0,compress:!1,parser:null},f=d.cache={};d.render=function(a,b){return q(a,b)};var g=d.renderFile=function(a,b){var c=d.get(a)||p({filename:a,name:"Render Error",message:"Template not found"});return b?c(b):c};d.get=function(a){var b;if(f[a])b=f[a];else if("object"==typeof document){var c=document.getElementById(a);if(c){var d=(c.value||c.innerHTML).replace(/^\s*|\s*$/g,"");b=q(d,{filename:a})}}return b};var h=function(a,b){return"string"!=typeof a&&(b=typeof a,"number"===b?a+="":a="function"===b?h(a.call(a)):""),a},i={"<":"&#60;",">":"&#62;",'"':"&#34;","'":"&#39;","&":"&#38;"},j=function(a){return i[a]},k=function(a){return h(a).replace(/&(?![\w#]+;)|[<>"']/g,j)},l=Array.isArray||function(a){return"[object Array]"==={}.toString.call(a)},m=function(a,b){var c,d;if(l(a))for(c=0,d=a.length;d>c;c++)b.call(a,a[c],c,a);else for(c in a)b.call(a,a[c],c)},n=d.utils={$helpers:{},$include:g,$string:h,$escape:k,$each:m};d.helper=function(a,b){o[a]=b};var o=d.helpers=n.$helpers;d.onerror=function(a){var b="Template Error\n\n";for(var c in a)b+="<"+c+">\n"+a[c]+"\n\n";"object"==typeof console&&console.error(b)};var p=function(a){return d.onerror(a),function(){return"{Template Error}"}},q=d.compile=function(a,b){function d(c){try{return new i(c,h)+""}catch(d){return b.debug?p(d)():(b.debug=!0,q(a,b)(c))}}b=b||{};for(var g in e)void 0===b[g]&&(b[g]=e[g]);var h=b.filename;try{var i=c(a,b)}catch(j){return j.filename=h||"anonymous",j.name="Syntax Error",p(j)}return d.prototype=i.prototype,d.toString=function(){return i.toString()},h&&b.cache&&(f[h]=d),d},r=n.$each,s="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined",t=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g,u=/[^\w$]+/g,v=new RegExp(["\\b"+s.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),w=/^\d[^,]*|,\d[^,]*/g,x=/^,+|,+$/g,y=/^$|,+/;e.openTag="{{",e.closeTag="}}";var z=function(a,b){var c=b.split(":"),d=c.shift(),e=c.join(":")||"";return e&&(e=", "+e),"$helpers."+d+"("+a+e+")"};e.parser=function(a){a=a.replace(/^\s/,"");var b=a.split(" "),c=b.shift(),e=b.join(" ");switch(c){case"if":a="if("+e+"){";break;case"else":b="if"===b.shift()?" if("+b.join(" ")+")":"",a="}else"+b+"{";break;case"/if":a="}";break;case"each":var f=b[0]||"$data",g=b[1]||"as",h=b[2]||"$value",i=b[3]||"$index",j=h+","+i;"as"!==g&&(f="[]"),a="$each("+f+",function("+j+"){";break;case"/each":a="});";break;case"echo":a="print("+e+");";break;case"print":case"include":a=c+"("+b.join(",")+");";break;default:if(/^\s*\|\s*[\w\$]/.test(e)){var k=!0;0===a.indexOf("#")&&(a=a.substr(1),k=!1);for(var l=0,m=a.split("|"),n=m.length,o=m[l++];n>l;l++)o=z(o,m[l]);a=(k?"=":"=#")+o}else a=d.helpers[c]?"=#"+c+"("+b.join(",")+");":"="+a}return a},"function"==typeof define?define(function(){return d}):"undefined"!=typeof exports?module.exports=d:this.template=d}();  
3 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/bootstrap-switch/css/bootstrap3/bootstrap-switch.css deleted 100644 → 0
1 -/**  
2 - * bootstrap-switch - Turn checkboxes and radio buttons into toggle switches.  
3 - *  
4 - * @version v3.3.4  
5 - * @homepage https://bttstrp.github.io/bootstrap-switch  
6 - * @author Mattia Larentis <mattia@larentis.eu> (http://larentis.eu)  
7 - * @license Apache-2.0  
8 - */  
9 -.bootstrap-switch {  
10 - display: inline-block;  
11 - direction: ltr;  
12 - cursor: pointer;  
13 - border-radius: 4px;  
14 - border: 1px solid;  
15 - border-color: #ccc;  
16 - position: relative;  
17 - text-align: left;  
18 - overflow: hidden;  
19 - line-height: 8px;  
20 - z-index: 0;  
21 - -webkit-user-select: none;  
22 - -moz-user-select: none;  
23 - -ms-user-select: none;  
24 - user-select: none;  
25 - vertical-align: middle;  
26 - -webkit-transition: border-color ease-in-out .15s, box-shadow  
27 - ease-in-out .15s;  
28 - -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out  
29 - .15s;  
30 - transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;  
31 -}  
32 -  
33 -.bootstrap-switch .bootstrap-switch-container {  
34 - display: inline-block;  
35 - top: 0;  
36 - border-radius: 4px;  
37 - -webkit-transform: translate3d(0, 0, 0);  
38 - transform: translate3d(0, 0, 0);  
39 -}  
40 -  
41 -.bootstrap-switch .bootstrap-switch-handle-on, .bootstrap-switch .bootstrap-switch-handle-off,  
42 - .bootstrap-switch .bootstrap-switch-label {  
43 - -webkit-box-sizing: border-box;  
44 - -moz-box-sizing: border-box;  
45 - box-sizing: border-box;  
46 - cursor: pointer;  
47 - display: table-cell;  
48 - vertical-align: middle;  
49 - padding: 6px 12px;  
50 - font-size: 14px;  
51 - line-height: 20px;  
52 -}  
53 -  
54 -.bootstrap-switch .bootstrap-switch-handle-on, .bootstrap-switch .bootstrap-switch-handle-off  
55 - {  
56 - text-align: center;  
57 - z-index: 1;  
58 -}  
59 -  
60 -.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary,  
61 - .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary  
62 - {  
63 - color: #fff;  
64 - background: #337ab7;  
65 -}  
66 -  
67 -.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info,  
68 - .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info {  
69 - color: #fff;  
70 - background: #5bc0de;  
71 -}  
72 -  
73 -.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success,  
74 - .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success  
75 - {  
76 - color: #fff;  
77 - background: #5cb85c;  
78 -}  
79 -  
80 -.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning,  
81 - .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning  
82 - {  
83 - background: #f0ad4e;  
84 - color: #fff;  
85 -}  
86 -  
87 -.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger,  
88 - .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger  
89 - {  
90 - color: #fff;  
91 - background: #d9534f;  
92 -}  
93 -  
94 -.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default,  
95 - .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default  
96 - {  
97 - color: #000;  
98 - background: #eeeeee;  
99 -}  
100 -  
101 -.bootstrap-switch .bootstrap-switch-label {  
102 - text-align: center;  
103 - margin-top: -1px;  
104 - margin-bottom: -1px;  
105 - z-index: 100;  
106 - color: #333;  
107 - background: #fff;  
108 -}  
109 -  
110 -.bootstrap-switch span::before {  
111 - content: "\200b";  
112 -}  
113 -  
114 -.bootstrap-switch .bootstrap-switch-handle-on {  
115 - border-bottom-left-radius: 3px;  
116 - border-top-left-radius: 3px;  
117 -}  
118 -  
119 -.bootstrap-switch .bootstrap-switch-handle-off {  
120 - border-bottom-right-radius: 3px;  
121 - border-top-right-radius: 3px;  
122 -}  
123 -  
124 -.bootstrap-switch input[type='radio'], .bootstrap-switch input[type='checkbox']  
125 - {  
126 - position: absolute !important;  
127 - top: 0;  
128 - left: 0;  
129 - margin: 0;  
130 - z-index: -1;  
131 - opacity: 0;  
132 - filter: alpha(opacity = 0);  
133 - visibility: hidden;  
134 -}  
135 -  
136 -.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on,  
137 - .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off,  
138 - .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label {  
139 - padding: 1px 5px;  
140 - font-size: 12px;  
141 - line-height: 1.5;  
142 -}  
143 -  
144 -.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on,  
145 - .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off,  
146 - .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label {  
147 - padding: 5px 10px;  
148 - font-size: 12px;  
149 - line-height: 1.5;  
150 -}  
151 -  
152 -.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on,  
153 - .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off,  
154 - .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label {  
155 - padding: 6px 16px;  
156 - font-size: 18px;  
157 - line-height: 1.3333333;  
158 -}  
159 -  
160 -.bootstrap-switch.bootstrap-switch-disabled, .bootstrap-switch.bootstrap-switch-readonly,  
161 - .bootstrap-switch.bootstrap-switch-indeterminate {  
162 - cursor: default !important;  
163 -}  
164 -  
165 -.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,  
166 - .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,  
167 - .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,  
168 - .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,  
169 - .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,  
170 - .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,  
171 - .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,  
172 - .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label,  
173 - .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label  
174 - {  
175 - opacity: 0.5;  
176 - filter: alpha(opacity = 50);  
177 - cursor: default !important;  
178 -}  
179 -  
180 -.bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container {  
181 - -webkit-transition: margin-left 0.5s;  
182 - -o-transition: margin-left 0.5s;  
183 - transition: margin-left 0.5s;  
184 -}  
185 -  
186 -.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on {  
187 - border-bottom-left-radius: 0;  
188 - border-top-left-radius: 0;  
189 - border-bottom-right-radius: 3px;  
190 - border-top-right-radius: 3px;  
191 -}  
192 -  
193 -.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off  
194 - {  
195 - border-bottom-right-radius: 0;  
196 - border-top-right-radius: 0;  
197 - border-bottom-left-radius: 3px;  
198 - border-top-left-radius: 3px;  
199 -}  
200 -  
201 -.bootstrap-switch.bootstrap-switch-focused {  
202 - border-color: #66afe9;  
203 - outline: 0;  
204 - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px  
205 - rgba(102, 175, 233, 0.6);  
206 - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px  
207 - rgba(102, 175, 233, 0.6);  
208 -}  
209 -  
210 -.bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label,  
211 - .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label  
212 - {  
213 - border-bottom-right-radius: 3px;  
214 - border-top-right-radius: 3px;  
215 -}  
216 -  
217 -.bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label,  
218 - .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label  
219 - {  
220 - border-bottom-left-radius: 3px;  
221 - border-top-left-radius: 3px;  
222 -}  
223 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/bootstrap-switch/css/bootstrap3/bootstrap-switch.min.css deleted 100644 → 0
1 -/**  
2 - * bootstrap-switch - Turn checkboxes and radio buttons into toggle switches.  
3 - *  
4 - * @version v3.3.4  
5 - * @homepage https://bttstrp.github.io/bootstrap-switch  
6 - * @author Mattia Larentis <mattia@larentis.eu> (http://larentis.eu)  
7 - * @license Apache-2.0  
8 - */  
9 -.bootstrap-switch {  
10 - display: inline-block;  
11 - direction: ltr;  
12 - cursor: pointer;  
13 - border-radius: 4px;  
14 - border: 1px solid #ccc;  
15 - position: relative;  
16 - text-align: left;  
17 - overflow: hidden;  
18 - line-height: 8px;  
19 - z-index: 0;  
20 - -webkit-user-select: none;  
21 - -moz-user-select: none;  
22 - -ms-user-select: none;  
23 - user-select: none;  
24 - vertical-align: middle;  
25 - -webkit-transition: border-color ease-in-out .15s, box-shadow  
26 - ease-in-out .15s;  
27 - -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out  
28 - .15s;  
29 - transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s  
30 -}  
31 -  
32 -.bootstrap-switch .bootstrap-switch-container {  
33 - display: inline-block;  
34 - top: 0;  
35 - border-radius: 4px;  
36 - -webkit-transform: translate3d(0, 0, 0);  
37 - transform: translate3d(0, 0, 0)  
38 -}  
39 -  
40 -.bootstrap-switch .bootstrap-switch-handle-off, .bootstrap-switch .bootstrap-switch-handle-on,  
41 - .bootstrap-switch .bootstrap-switch-label {  
42 - -webkit-box-sizing: border-box;  
43 - -moz-box-sizing: border-box;  
44 - box-sizing: border-box;  
45 - cursor: pointer;  
46 - display: table-cell;  
47 - vertical-align: middle;  
48 - padding: 6px 12px;  
49 - font-size: 14px;  
50 - line-height: 20px  
51 -}  
52 -  
53 -.bootstrap-switch .bootstrap-switch-handle-off, .bootstrap-switch .bootstrap-switch-handle-on  
54 - {  
55 - text-align: center;  
56 - z-index: 1  
57 -}  
58 -  
59 -.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary,  
60 - .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary  
61 - {  
62 - color: #fff;  
63 - background: #337ab7  
64 -}  
65 -  
66 -.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info,  
67 - .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info {  
68 - color: #fff;  
69 - background: #5bc0de  
70 -}  
71 -  
72 -.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success,  
73 - .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success  
74 - {  
75 - color: #fff;  
76 - background: #5cb85c  
77 -}  
78 -  
79 -.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning,  
80 - .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning  
81 - {  
82 - background: #f0ad4e;  
83 - color: #fff  
84 -}  
85 -  
86 -.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger,  
87 - .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger {  
88 - color: #fff;  
89 - background: #d9534f  
90 -}  
91 -  
92 -.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default,  
93 - .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default  
94 - {  
95 - color: #000;  
96 - background: #eee  
97 -}  
98 -  
99 -.bootstrap-switch .bootstrap-switch-label {  
100 - text-align: center;  
101 - margin-top: -1px;  
102 - margin-bottom: -1px;  
103 - z-index: 100;  
104 - color: #333;  
105 - background: #fff  
106 -}  
107 -  
108 -.bootstrap-switch span::before {  
109 - content: "\200b"  
110 -}  
111 -  
112 -.bootstrap-switch .bootstrap-switch-handle-on {  
113 - border-bottom-left-radius: 3px;  
114 - border-top-left-radius: 3px  
115 -}  
116 -  
117 -.bootstrap-switch .bootstrap-switch-handle-off {  
118 - border-bottom-right-radius: 3px;  
119 - border-top-right-radius: 3px  
120 -}  
121 -  
122 -.bootstrap-switch input[type=radio], .bootstrap-switch input[type=checkbox]  
123 - {  
124 - position: absolute !important;  
125 - top: 0;  
126 - left: 0;  
127 - margin: 0;  
128 - z-index: -1;  
129 - opacity: 0;  
130 - filter: alpha(opacity = 0);  
131 - visibility: hidden  
132 -}  
133 -  
134 -.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off,  
135 - .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on,  
136 - .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label {  
137 - padding: 1px 5px;  
138 - font-size: 12px;  
139 - line-height: 1.5  
140 -}  
141 -  
142 -.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off,  
143 - .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on,  
144 - .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label {  
145 - padding: 5px 10px;  
146 - font-size: 12px;  
147 - line-height: 1.5  
148 -}  
149 -  
150 -.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off,  
151 - .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on,  
152 - .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label {  
153 - padding: 6px 16px;  
154 - font-size: 18px;  
155 - line-height: 1.3333333  
156 -}  
157 -  
158 -.bootstrap-switch.bootstrap-switch-disabled, .bootstrap-switch.bootstrap-switch-indeterminate,  
159 - .bootstrap-switch.bootstrap-switch-readonly {  
160 - cursor: default !important  
161 -}  
162 -  
163 -.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,  
164 - .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,  
165 - .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,  
166 - .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,  
167 - .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,  
168 - .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label,  
169 - .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,  
170 - .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,  
171 - .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label {  
172 - opacity: .5;  
173 - filter: alpha(opacity = 50);  
174 - cursor: default !important  
175 -}  
176 -  
177 -.bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container {  
178 - -webkit-transition: margin-left .5s;  
179 - -o-transition: margin-left .5s;  
180 - transition: margin-left .5s  
181 -}  
182 -  
183 -.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on {  
184 - border-radius: 0 3px 3px 0  
185 -}  
186 -  
187 -.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off  
188 - {  
189 - border-radius: 3px 0 0 3px  
190 -}  
191 -  
192 -.bootstrap-switch.bootstrap-switch-focused {  
193 - border-color: #66afe9;  
194 - outline: 0;  
195 - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px  
196 - rgba(102, 175, 233, .6);  
197 - box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px  
198 - rgba(102, 175, 233, .6)  
199 -}  
200 -  
201 -.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label,  
202 - .bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label {  
203 - border-bottom-right-radius: 3px;  
204 - border-top-right-radius: 3px  
205 -}  
206 -  
207 -.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label,  
208 - .bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label {  
209 - border-bottom-left-radius: 3px;  
210 - border-top-left-radius: 3px  
211 -}  
212 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/bootstrap-switch/js/bootstrap-switch.js deleted 100644 → 0
1 -/**  
2 - * bootstrap-switch - Turn checkboxes and radio buttons into toggle switches.  
3 - *  
4 - * @version v3.3.4  
5 - * @homepage https://bttstrp.github.io/bootstrap-switch  
6 - * @author Mattia Larentis <mattia@larentis.eu> (http://larentis.eu)  
7 - * @license Apache-2.0  
8 - */  
9 -  
10 -(function (global, factory) {  
11 - if (typeof define === "function" && define.amd) {  
12 - define(['jquery'], factory);  
13 - } else if (typeof exports !== "undefined") {  
14 - factory(require('jquery'));  
15 - } else {  
16 - var mod = {  
17 - exports: {}  
18 - };  
19 - factory(global.jquery);  
20 - global.bootstrapSwitch = mod.exports;  
21 - }  
22 -})(this, function (_jquery) {  
23 - 'use strict';  
24 -  
25 - var _jquery2 = _interopRequireDefault(_jquery);  
26 -  
27 - function _interopRequireDefault(obj) {  
28 - return obj && obj.__esModule ? obj : {  
29 - default: obj  
30 - };  
31 - }  
32 -  
33 - var _extends = Object.assign || function (target) {  
34 - for (var i = 1; i < arguments.length; i++) {  
35 - var source = arguments[i];  
36 -  
37 - for (var key in source) {  
38 - if (Object.prototype.hasOwnProperty.call(source, key)) {  
39 - target[key] = source[key];  
40 - }  
41 - }  
42 - }  
43 -  
44 - return target;  
45 - };  
46 -  
47 - function _classCallCheck(instance, Constructor) {  
48 - if (!(instance instanceof Constructor)) {  
49 - throw new TypeError("Cannot call a class as a function");  
50 - }  
51 - }  
52 -  
53 - var _createClass = function () {  
54 - function defineProperties(target, props) {  
55 - for (var i = 0; i < props.length; i++) {  
56 - var descriptor = props[i];  
57 - descriptor.enumerable = descriptor.enumerable || false;  
58 - descriptor.configurable = true;  
59 - if ("value" in descriptor) descriptor.writable = true;  
60 - Object.defineProperty(target, descriptor.key, descriptor);  
61 - }  
62 - }  
63 -  
64 - return function (Constructor, protoProps, staticProps) {  
65 - if (protoProps) defineProperties(Constructor.prototype, protoProps);  
66 - if (staticProps) defineProperties(Constructor, staticProps);  
67 - return Constructor;  
68 - };  
69 - }();  
70 -  
71 - var $ = _jquery2.default || window.jQuery || window.$;  
72 -  
73 - var BootstrapSwitch = function () {  
74 - function BootstrapSwitch(element) {  
75 - var _this = this;  
76 -  
77 - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};  
78 -  
79 - _classCallCheck(this, BootstrapSwitch);  
80 -  
81 - this.$element = $(element);  
82 - this.options = $.extend({}, $.fn.bootstrapSwitch.defaults, this._getElementOptions(), options);  
83 - this.prevOptions = {};  
84 - this.$wrapper = $('<div>', {  
85 - class: function _class() {  
86 - var classes = [];  
87 - classes.push(_this.options.state ? 'on' : 'off');  
88 - if (_this.options.size) {  
89 - classes.push(_this.options.size);  
90 - }  
91 - if (_this.options.disabled) {  
92 - classes.push('disabled');  
93 - }  
94 - if (_this.options.readonly) {  
95 - classes.push('readonly');  
96 - }  
97 - if (_this.options.indeterminate) {  
98 - classes.push('indeterminate');  
99 - }  
100 - if (_this.options.inverse) {  
101 - classes.push('inverse');  
102 - }  
103 - if (_this.$element.attr('id')) {  
104 - classes.push('id-' + _this.$element.attr('id'));  
105 - }  
106 - return classes.map(_this._getClass.bind(_this)).concat([_this.options.baseClass], _this._getClasses(_this.options.wrapperClass)).join(' ');  
107 - }  
108 - });  
109 - this.$container = $('<div>', { class: this._getClass('container') });  
110 - this.$on = $('<span>', {  
111 - html: this.options.onText,  
112 - class: this._getClass('handle-on') + ' ' + this._getClass(this.options.onColor)  
113 - });  
114 - this.$off = $('<span>', {  
115 - html: this.options.offText,  
116 - class: this._getClass('handle-off') + ' ' + this._getClass(this.options.offColor)  
117 - });  
118 - this.$label = $('<span>', {  
119 - html: this.options.labelText,  
120 - class: this._getClass('label')  
121 - });  
122 -  
123 - this.$element.on('init.bootstrapSwitch', this.options.onInit.bind(this, element));  
124 - this.$element.on('switchChange.bootstrapSwitch', function () {  
125 - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {  
126 - args[_key] = arguments[_key];  
127 - }  
128 -  
129 - if (_this.options.onSwitchChange.apply(element, args) === false) {  
130 - if (_this.$element.is(':radio')) {  
131 - $('[name="' + _this.$element.attr('name') + '"]').trigger('previousState.bootstrapSwitch', true);  
132 - } else {  
133 - _this.$element.trigger('previousState.bootstrapSwitch', true);  
134 - }  
135 - }  
136 - });  
137 -  
138 - this.$container = this.$element.wrap(this.$container).parent();  
139 - this.$wrapper = this.$container.wrap(this.$wrapper).parent();  
140 - this.$element.before(this.options.inverse ? this.$off : this.$on).before(this.$label).before(this.options.inverse ? this.$on : this.$off);  
141 -  
142 - if (this.options.indeterminate) {  
143 - this.$element.prop('indeterminate', true);  
144 - }  
145 -  
146 - this._init();  
147 - this._elementHandlers();  
148 - this._handleHandlers();  
149 - this._labelHandlers();  
150 - this._formHandler();  
151 - this._externalLabelHandler();  
152 - this.$element.trigger('init.bootstrapSwitch', this.options.state);  
153 - }  
154 -  
155 - _createClass(BootstrapSwitch, [{  
156 - key: 'setPrevOptions',  
157 - value: function setPrevOptions() {  
158 - this.prevOptions = _extends({}, this.options);  
159 - }  
160 - }, {  
161 - key: 'state',  
162 - value: function state(value, skip) {  
163 - if (typeof value === 'undefined') {  
164 - return this.options.state;  
165 - }  
166 - if (this.options.disabled || this.options.readonly || this.options.state && !this.options.radioAllOff && this.$element.is(':radio')) {  
167 - return this.$element;  
168 - }  
169 - if (this.$element.is(':radio')) {  
170 - $('[name="' + this.$element.attr('name') + '"]').trigger('setPreviousOptions.bootstrapSwitch');  
171 - } else {  
172 - this.$element.trigger('setPreviousOptions.bootstrapSwitch');  
173 - }  
174 - if (this.options.indeterminate) {  
175 - this.indeterminate(false);  
176 - }  
177 - this.$element.prop('checked', Boolean(value)).trigger('change.bootstrapSwitch', skip);  
178 - return this.$element;  
179 - }  
180 - }, {  
181 - key: 'toggleState',  
182 - value: function toggleState(skip) {  
183 - if (this.options.disabled || this.options.readonly) {  
184 - return this.$element;  
185 - }  
186 - if (this.options.indeterminate) {  
187 - this.indeterminate(false);  
188 - return this.state(true);  
189 - } else {  
190 - return this.$element.prop('checked', !this.options.state).trigger('change.bootstrapSwitch', skip);  
191 - }  
192 - }  
193 - }, {  
194 - key: 'size',  
195 - value: function size(value) {  
196 - if (typeof value === 'undefined') {  
197 - return this.options.size;  
198 - }  
199 - if (this.options.size != null) {  
200 - this.$wrapper.removeClass(this._getClass(this.options.size));  
201 - }  
202 - if (value) {  
203 - this.$wrapper.addClass(this._getClass(value));  
204 - }  
205 - this._width();  
206 - this._containerPosition();  
207 - this.options.size = value;  
208 - return this.$element;  
209 - }  
210 - }, {  
211 - key: 'animate',  
212 - value: function animate(value) {  
213 - if (typeof value === 'undefined') {  
214 - return this.options.animate;  
215 - }  
216 - if (this.options.animate === Boolean(value)) {  
217 - return this.$element;  
218 - }  
219 - return this.toggleAnimate();  
220 - }  
221 - }, {  
222 - key: 'toggleAnimate',  
223 - value: function toggleAnimate() {  
224 - this.options.animate = !this.options.animate;  
225 - this.$wrapper.toggleClass(this._getClass('animate'));  
226 - return this.$element;  
227 - }  
228 - }, {  
229 - key: 'disabled',  
230 - value: function disabled(value) {  
231 - if (typeof value === 'undefined') {  
232 - return this.options.disabled;  
233 - }  
234 - if (this.options.disabled === Boolean(value)) {  
235 - return this.$element;  
236 - }  
237 - return this.toggleDisabled();  
238 - }  
239 - }, {  
240 - key: 'toggleDisabled',  
241 - value: function toggleDisabled() {  
242 - this.options.disabled = !this.options.disabled;  
243 - this.$element.prop('disabled', this.options.disabled);  
244 - this.$wrapper.toggleClass(this._getClass('disabled'));  
245 - return this.$element;  
246 - }  
247 - }, {  
248 - key: 'readonly',  
249 - value: function readonly(value) {  
250 - if (typeof value === 'undefined') {  
251 - return this.options.readonly;  
252 - }  
253 - if (this.options.readonly === Boolean(value)) {  
254 - return this.$element;  
255 - }  
256 - return this.toggleReadonly();  
257 - }  
258 - }, {  
259 - key: 'toggleReadonly',  
260 - value: function toggleReadonly() {  
261 - this.options.readonly = !this.options.readonly;  
262 - this.$element.prop('readonly', this.options.readonly);  
263 - this.$wrapper.toggleClass(this._getClass('readonly'));  
264 - return this.$element;  
265 - }  
266 - }, {  
267 - key: 'indeterminate',  
268 - value: function indeterminate(value) {  
269 - if (typeof value === 'undefined') {  
270 - return this.options.indeterminate;  
271 - }  
272 - if (this.options.indeterminate === Boolean(value)) {  
273 - return this.$element;  
274 - }  
275 - return this.toggleIndeterminate();  
276 - }  
277 - }, {  
278 - key: 'toggleIndeterminate',  
279 - value: function toggleIndeterminate() {  
280 - this.options.indeterminate = !this.options.indeterminate;  
281 - this.$element.prop('indeterminate', this.options.indeterminate);  
282 - this.$wrapper.toggleClass(this._getClass('indeterminate'));  
283 - this._containerPosition();  
284 - return this.$element;  
285 - }  
286 - }, {  
287 - key: 'inverse',  
288 - value: function inverse(value) {  
289 - if (typeof value === 'undefined') {  
290 - return this.options.inverse;  
291 - }  
292 - if (this.options.inverse === Boolean(value)) {  
293 - return this.$element;  
294 - }  
295 - return this.toggleInverse();  
296 - }  
297 - }, {  
298 - key: 'toggleInverse',  
299 - value: function toggleInverse() {  
300 - this.$wrapper.toggleClass(this._getClass('inverse'));  
301 - var $on = this.$on.clone(true);  
302 - var $off = this.$off.clone(true);  
303 - this.$on.replaceWith($off);  
304 - this.$off.replaceWith($on);  
305 - this.$on = $off;  
306 - this.$off = $on;  
307 - this.options.inverse = !this.options.inverse;  
308 - return this.$element;  
309 - }  
310 - }, {  
311 - key: 'onColor',  
312 - value: function onColor(value) {  
313 - if (typeof value === 'undefined') {  
314 - return this.options.onColor;  
315 - }  
316 - if (this.options.onColor) {  
317 - this.$on.removeClass(this._getClass(this.options.onColor));  
318 - }  
319 - this.$on.addClass(this._getClass(value));  
320 - this.options.onColor = value;  
321 - return this.$element;  
322 - }  
323 - }, {  
324 - key: 'offColor',  
325 - value: function offColor(value) {  
326 - if (typeof value === 'undefined') {  
327 - return this.options.offColor;  
328 - }  
329 - if (this.options.offColor) {  
330 - this.$off.removeClass(this._getClass(this.options.offColor));  
331 - }  
332 - this.$off.addClass(this._getClass(value));  
333 - this.options.offColor = value;  
334 - return this.$element;  
335 - }  
336 - }, {  
337 - key: 'onText',  
338 - value: function onText(value) {  
339 - if (typeof value === 'undefined') {  
340 - return this.options.onText;  
341 - }  
342 - this.$on.html(value);  
343 - this._width();  
344 - this._containerPosition();  
345 - this.options.onText = value;  
346 - return this.$element;  
347 - }  
348 - }, {  
349 - key: 'offText',  
350 - value: function offText(value) {  
351 - if (typeof value === 'undefined') {  
352 - return this.options.offText;  
353 - }  
354 - this.$off.html(value);  
355 - this._width();  
356 - this._containerPosition();  
357 - this.options.offText = value;  
358 - return this.$element;  
359 - }  
360 - }, {  
361 - key: 'labelText',  
362 - value: function labelText(value) {  
363 - if (typeof value === 'undefined') {  
364 - return this.options.labelText;  
365 - }  
366 - this.$label.html(value);  
367 - this._width();  
368 - this.options.labelText = value;  
369 - return this.$element;  
370 - }  
371 - }, {  
372 - key: 'handleWidth',  
373 - value: function handleWidth(value) {  
374 - if (typeof value === 'undefined') {  
375 - return this.options.handleWidth;  
376 - }  
377 - this.options.handleWidth = value;  
378 - this._width();  
379 - this._containerPosition();  
380 - return this.$element;  
381 - }  
382 - }, {  
383 - key: 'labelWidth',  
384 - value: function labelWidth(value) {  
385 - if (typeof value === 'undefined') {  
386 - return this.options.labelWidth;  
387 - }  
388 - this.options.labelWidth = value;  
389 - this._width();  
390 - this._containerPosition();  
391 - return this.$element;  
392 - }  
393 - }, {  
394 - key: 'baseClass',  
395 - value: function baseClass(value) {  
396 - return this.options.baseClass;  
397 - }  
398 - }, {  
399 - key: 'wrapperClass',  
400 - value: function wrapperClass(value) {  
401 - if (typeof value === 'undefined') {  
402 - return this.options.wrapperClass;  
403 - }  
404 - if (!value) {  
405 - value = $.fn.bootstrapSwitch.defaults.wrapperClass;  
406 - }  
407 - this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(' '));  
408 - this.$wrapper.addClass(this._getClasses(value).join(' '));  
409 - this.options.wrapperClass = value;  
410 - return this.$element;  
411 - }  
412 - }, {  
413 - key: 'radioAllOff',  
414 - value: function radioAllOff(value) {  
415 - if (typeof value === 'undefined') {  
416 - return this.options.radioAllOff;  
417 - }  
418 - var val = Boolean(value);  
419 - if (this.options.radioAllOff === val) {  
420 - return this.$element;  
421 - }  
422 - this.options.radioAllOff = val;  
423 - return this.$element;  
424 - }  
425 - }, {  
426 - key: 'onInit',  
427 - value: function onInit(value) {  
428 - if (typeof value === 'undefined') {  
429 - return this.options.onInit;  
430 - }  
431 - if (!value) {  
432 - value = $.fn.bootstrapSwitch.defaults.onInit;  
433 - }  
434 - this.options.onInit = value;  
435 - return this.$element;  
436 - }  
437 - }, {  
438 - key: 'onSwitchChange',  
439 - value: function onSwitchChange(value) {  
440 - if (typeof value === 'undefined') {  
441 - return this.options.onSwitchChange;  
442 - }  
443 - if (!value) {  
444 - value = $.fn.bootstrapSwitch.defaults.onSwitchChange;  
445 - }  
446 - this.options.onSwitchChange = value;  
447 - return this.$element;  
448 - }  
449 - }, {  
450 - key: 'destroy',  
451 - value: function destroy() {  
452 - var $form = this.$element.closest('form');  
453 - if ($form.length) {  
454 - $form.off('reset.bootstrapSwitch').removeData('bootstrap-switch');  
455 - }  
456 - this.$container.children().not(this.$element).remove();  
457 - this.$element.unwrap().unwrap().off('.bootstrapSwitch').removeData('bootstrap-switch');  
458 - return this.$element;  
459 - }  
460 - }, {  
461 - key: '_getElementOptions',  
462 - value: function _getElementOptions() {  
463 - return {  
464 - state: this.$element.is(':checked'),  
465 - size: this.$element.data('size'),  
466 - animate: this.$element.data('animate'),  
467 - disabled: this.$element.is(':disabled'),  
468 - readonly: this.$element.is('[readonly]'),  
469 - indeterminate: this.$element.data('indeterminate'),  
470 - inverse: this.$element.data('inverse'),  
471 - radioAllOff: this.$element.data('radio-all-off'),  
472 - onColor: this.$element.data('on-color'),  
473 - offColor: this.$element.data('off-color'),  
474 - onText: this.$element.data('on-text'),  
475 - offText: this.$element.data('off-text'),  
476 - labelText: this.$element.data('label-text'),  
477 - handleWidth: this.$element.data('handle-width'),  
478 - labelWidth: this.$element.data('label-width'),  
479 - baseClass: this.$element.data('base-class'),  
480 - wrapperClass: this.$element.data('wrapper-class')  
481 - };  
482 - }  
483 - }, {  
484 - key: '_width',  
485 - value: function _width() {  
486 - var _this2 = this;  
487 -  
488 - var $handles = this.$on.add(this.$off).add(this.$label).css('width', '');  
489 - var handleWidth = this.options.handleWidth === 'auto' ? Math.round(Math.max(this.$on.width(), this.$off.width())) : this.options.handleWidth;  
490 - $handles.width(handleWidth);  
491 - this.$label.width(function (index, width) {  
492 - if (_this2.options.labelWidth !== 'auto') {  
493 - return _this2.options.labelWidth;  
494 - }  
495 - if (width < handleWidth) {  
496 - return handleWidth;  
497 - }  
498 - return width;  
499 - });  
500 - this._handleWidth = this.$on.outerWidth();  
501 - this._labelWidth = this.$label.outerWidth();  
502 - this.$container.width(this._handleWidth * 2 + this._labelWidth);  
503 - return this.$wrapper.width(this._handleWidth + this._labelWidth);  
504 - }  
505 - }, {  
506 - key: '_containerPosition',  
507 - value: function _containerPosition() {  
508 - var _this3 = this;  
509 -  
510 - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.state;  
511 - var callback = arguments[1];  
512 -  
513 - this.$container.css('margin-left', function () {  
514 - var values = [0, '-' + _this3._handleWidth + 'px'];  
515 - if (_this3.options.indeterminate) {  
516 - return '-' + _this3._handleWidth / 2 + 'px';  
517 - }  
518 - if (state) {  
519 - if (_this3.options.inverse) {  
520 - return values[1];  
521 - } else {  
522 - return values[0];  
523 - }  
524 - } else {  
525 - if (_this3.options.inverse) {  
526 - return values[0];  
527 - } else {  
528 - return values[1];  
529 - }  
530 - }  
531 - });  
532 - }  
533 - }, {  
534 - key: '_init',  
535 - value: function _init() {  
536 - var _this4 = this;  
537 -  
538 - var init = function init() {  
539 - _this4.setPrevOptions();  
540 - _this4._width();  
541 - _this4._containerPosition();  
542 - setTimeout(function () {  
543 - if (_this4.options.animate) {  
544 - return _this4.$wrapper.addClass(_this4._getClass('animate'));  
545 - }  
546 - }, 50);  
547 - };  
548 - if (this.$wrapper.is(':visible')) {  
549 - init();  
550 - return;  
551 - }  
552 - var initInterval = window.setInterval(function () {  
553 - if (_this4.$wrapper.is(':visible')) {  
554 - init();  
555 - return window.clearInterval(initInterval);  
556 - }  
557 - }, 50);  
558 - }  
559 - }, {  
560 - key: '_elementHandlers',  
561 - value: function _elementHandlers() {  
562 - var _this5 = this;  
563 -  
564 - return this.$element.on({  
565 - 'setPreviousOptions.bootstrapSwitch': this.setPrevOptions.bind(this),  
566 -  
567 - 'previousState.bootstrapSwitch': function previousStateBootstrapSwitch() {  
568 - _this5.options = _this5.prevOptions;  
569 - if (_this5.options.indeterminate) {  
570 - _this5.$wrapper.addClass(_this5._getClass('indeterminate'));  
571 - }  
572 - _this5.$element.prop('checked', _this5.options.state).trigger('change.bootstrapSwitch', true);  
573 - },  
574 -  
575 - 'change.bootstrapSwitch': function changeBootstrapSwitch(event, skip) {  
576 - event.preventDefault();  
577 - event.stopImmediatePropagation();  
578 - var state = _this5.$element.is(':checked');  
579 - _this5._containerPosition(state);  
580 - if (state === _this5.options.state) {  
581 - return;  
582 - }  
583 - _this5.options.state = state;  
584 - _this5.$wrapper.toggleClass(_this5._getClass('off')).toggleClass(_this5._getClass('on'));  
585 - if (!skip) {  
586 - if (_this5.$element.is(':radio')) {  
587 - $('[name="' + _this5.$element.attr('name') + '"]').not(_this5.$element).prop('checked', false).trigger('change.bootstrapSwitch', true);  
588 - }  
589 - _this5.$element.trigger('switchChange.bootstrapSwitch', [state]);  
590 - }  
591 - },  
592 -  
593 - 'focus.bootstrapSwitch': function focusBootstrapSwitch(event) {  
594 - event.preventDefault();  
595 - _this5.$wrapper.addClass(_this5._getClass('focused'));  
596 - },  
597 -  
598 - 'blur.bootstrapSwitch': function blurBootstrapSwitch(event) {  
599 - event.preventDefault();  
600 - _this5.$wrapper.removeClass(_this5._getClass('focused'));  
601 - },  
602 -  
603 - 'keydown.bootstrapSwitch': function keydownBootstrapSwitch(event) {  
604 - if (!event.which || _this5.options.disabled || _this5.options.readonly) {  
605 - return;  
606 - }  
607 - if (event.which === 37 || event.which === 39) {  
608 - event.preventDefault();  
609 - event.stopImmediatePropagation();  
610 - _this5.state(event.which === 39);  
611 - }  
612 - }  
613 - });  
614 - }  
615 - }, {  
616 - key: '_handleHandlers',  
617 - value: function _handleHandlers() {  
618 - var _this6 = this;  
619 -  
620 - this.$on.on('click.bootstrapSwitch', function (event) {  
621 - event.preventDefault();  
622 - event.stopPropagation();  
623 - _this6.state(false);  
624 - return _this6.$element.trigger('focus.bootstrapSwitch');  
625 - });  
626 - return this.$off.on('click.bootstrapSwitch', function (event) {  
627 - event.preventDefault();  
628 - event.stopPropagation();  
629 - _this6.state(true);  
630 - return _this6.$element.trigger('focus.bootstrapSwitch');  
631 - });  
632 - }  
633 - }, {  
634 - key: '_labelHandlers',  
635 - value: function _labelHandlers() {  
636 - var _this7 = this;  
637 -  
638 - var handlers = {  
639 - click: function click(event) {  
640 - event.stopPropagation();  
641 - },  
642 -  
643 -  
644 - 'mousedown.bootstrapSwitch touchstart.bootstrapSwitch': function mousedownBootstrapSwitchTouchstartBootstrapSwitch(event) {  
645 - if (_this7._dragStart || _this7.options.disabled || _this7.options.readonly) {  
646 - return;  
647 - }  
648 - event.preventDefault();  
649 - event.stopPropagation();  
650 - _this7._dragStart = (event.pageX || event.originalEvent.touches[0].pageX) - parseInt(_this7.$container.css('margin-left'), 10);  
651 - if (_this7.options.animate) {  
652 - _this7.$wrapper.removeClass(_this7._getClass('animate'));  
653 - }  
654 - _this7.$element.trigger('focus.bootstrapSwitch');  
655 - },  
656 -  
657 - 'mousemove.bootstrapSwitch touchmove.bootstrapSwitch': function mousemoveBootstrapSwitchTouchmoveBootstrapSwitch(event) {  
658 - if (_this7._dragStart == null) {  
659 - return;  
660 - }  
661 - var difference = (event.pageX || event.originalEvent.touches[0].pageX) - _this7._dragStart;  
662 - event.preventDefault();  
663 - if (difference < -_this7._handleWidth || difference > 0) {  
664 - return;  
665 - }  
666 - _this7._dragEnd = difference;  
667 - _this7.$container.css('margin-left', _this7._dragEnd + 'px');  
668 - },  
669 -  
670 - 'mouseup.bootstrapSwitch touchend.bootstrapSwitch': function mouseupBootstrapSwitchTouchendBootstrapSwitch(event) {  
671 - if (!_this7._dragStart) {  
672 - return;  
673 - }  
674 - event.preventDefault();  
675 - if (_this7.options.animate) {  
676 - _this7.$wrapper.addClass(_this7._getClass('animate'));  
677 - }  
678 - if (_this7._dragEnd) {  
679 - var state = _this7._dragEnd > -(_this7._handleWidth / 2);  
680 - _this7._dragEnd = false;  
681 - _this7.state(_this7.options.inverse ? !state : state);  
682 - } else {  
683 - _this7.state(!_this7.options.state);  
684 - }  
685 - _this7._dragStart = false;  
686 - },  
687 -  
688 - 'mouseleave.bootstrapSwitch': function mouseleaveBootstrapSwitch() {  
689 - _this7.$label.trigger('mouseup.bootstrapSwitch');  
690 - }  
691 - };  
692 - this.$label.on(handlers);  
693 - }  
694 - }, {  
695 - key: '_externalLabelHandler',  
696 - value: function _externalLabelHandler() {  
697 - var _this8 = this;  
698 -  
699 - var $externalLabel = this.$element.closest('label');  
700 - $externalLabel.on('click', function (event) {  
701 - event.preventDefault();  
702 - event.stopImmediatePropagation();  
703 - if (event.target === $externalLabel[0]) {  
704 - _this8.toggleState();  
705 - }  
706 - });  
707 - }  
708 - }, {  
709 - key: '_formHandler',  
710 - value: function _formHandler() {  
711 - var $form = this.$element.closest('form');  
712 - if ($form.data('bootstrap-switch')) {  
713 - return;  
714 - }  
715 - $form.on('reset.bootstrapSwitch', function () {  
716 - window.setTimeout(function () {  
717 - $form.find('input').filter(function () {  
718 - return $(this).data('bootstrap-switch');  
719 - }).each(function () {  
720 - return $(this).bootstrapSwitch('state', this.checked);  
721 - });  
722 - }, 1);  
723 - }).data('bootstrap-switch', true);  
724 - }  
725 - }, {  
726 - key: '_getClass',  
727 - value: function _getClass(name) {  
728 - return this.options.baseClass + '-' + name;  
729 - }  
730 - }, {  
731 - key: '_getClasses',  
732 - value: function _getClasses(classes) {  
733 - if (!$.isArray(classes)) {  
734 - return [this._getClass(classes)];  
735 - }  
736 - return classes.map(this._getClass.bind(this));  
737 - }  
738 - }]);  
739 -  
740 - return BootstrapSwitch;  
741 - }();  
742 -  
743 - $.fn.bootstrapSwitch = function (option) {  
744 - for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {  
745 - args[_key2 - 1] = arguments[_key2];  
746 - }  
747 -  
748 - function reducer(ret, next) {  
749 - var $this = $(next);  
750 - var existingData = $this.data('bootstrap-switch');  
751 - var data = existingData || new BootstrapSwitch(next, option);  
752 - if (!existingData) {  
753 - $this.data('bootstrap-switch', data);  
754 - }  
755 - if (typeof option === 'string') {  
756 - return data[option].apply(data, args);  
757 - }  
758 - return ret;  
759 - }  
760 - return Array.prototype.reduce.call(this, reducer, this);  
761 - };  
762 - $.fn.bootstrapSwitch.Constructor = BootstrapSwitch;  
763 - $.fn.bootstrapSwitch.defaults = {  
764 - state: true,  
765 - size: null,  
766 - animate: true,  
767 - disabled: false,  
768 - readonly: false,  
769 - indeterminate: false,  
770 - inverse: false,  
771 - radioAllOff: false,  
772 - onColor: 'primary',  
773 - offColor: 'default',  
774 - onText: 'ON',  
775 - offText: 'OFF',  
776 - labelText: '&nbsp',  
777 - handleWidth: 'auto',  
778 - labelWidth: 'auto',  
779 - baseClass: 'bootstrap-switch',  
780 - wrapperClass: 'wrapper',  
781 - onInit: function onInit() {},  
782 - onSwitchChange: function onSwitchChange() {}  
783 - };  
784 -});  
src/main/resources/static/bootstrap-switch/js/bootstrap-switch.min.js deleted 100644 → 0
1 -/**  
2 - * bootstrap-switch - Turn checkboxes and radio buttons into toggle switches.  
3 - *  
4 - * @version v3.3.4  
5 - * @homepage https://bttstrp.github.io/bootstrap-switch  
6 - * @author Mattia Larentis <mattia@larentis.eu> (http://larentis.eu)  
7 - * @license Apache-2.0  
8 - */  
9 -  
10 -(function(a,b){if('function'==typeof define&&define.amd)define(['jquery'],b);else if('undefined'!=typeof exports)b(require('jquery'));else{b(a.jquery),a.bootstrapSwitch={exports:{}}.exports}})(this,function(a){'use strict';function c(j,k){if(!(j instanceof k))throw new TypeError('Cannot call a class as a function')}var d=function(j){return j&&j.__esModule?j:{default:j}}(a),e=Object.assign||function(j){for(var l,k=1;k<arguments.length;k++)for(var m in l=arguments[k],l)Object.prototype.hasOwnProperty.call(l,m)&&(j[m]=l[m]);return j},f=function(){function j(k,l){for(var n,m=0;m<l.length;m++)n=l[m],n.enumerable=n.enumerable||!1,n.configurable=!0,'value'in n&&(n.writable=!0),Object.defineProperty(k,n.key,n)}return function(k,l,m){return l&&j(k.prototype,l),m&&j(k,m),k}}(),g=d.default||window.jQuery||window.$,h=function(){function j(k){var l=this,m=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};c(this,j),this.$element=g(k),this.options=g.extend({},g.fn.bootstrapSwitch.defaults,this._getElementOptions(),m),this.prevOptions={},this.$wrapper=g('<div>',{class:function(){var o=[];return o.push(l.options.state?'on':'off'),l.options.size&&o.push(l.options.size),l.options.disabled&&o.push('disabled'),l.options.readonly&&o.push('readonly'),l.options.indeterminate&&o.push('indeterminate'),l.options.inverse&&o.push('inverse'),l.$element.attr('id')&&o.push('id-'+l.$element.attr('id')),o.map(l._getClass.bind(l)).concat([l.options.baseClass],l._getClasses(l.options.wrapperClass)).join(' ')}}),this.$container=g('<div>',{class:this._getClass('container')}),this.$on=g('<span>',{html:this.options.onText,class:this._getClass('handle-on')+' '+this._getClass(this.options.onColor)}),this.$off=g('<span>',{html:this.options.offText,class:this._getClass('handle-off')+' '+this._getClass(this.options.offColor)}),this.$label=g('<span>',{html:this.options.labelText,class:this._getClass('label')}),this.$element.on('init.bootstrapSwitch',this.options.onInit.bind(this,k)),this.$element.on('switchChange.bootstrapSwitch',function(){for(var n=arguments.length,o=Array(n),p=0;p<n;p++)o[p]=arguments[p];!1===l.options.onSwitchChange.apply(k,o)&&(l.$element.is(':radio')?g('[name="'+l.$element.attr('name')+'"]').trigger('previousState.bootstrapSwitch',!0):l.$element.trigger('previousState.bootstrapSwitch',!0))}),this.$container=this.$element.wrap(this.$container).parent(),this.$wrapper=this.$container.wrap(this.$wrapper).parent(),this.$element.before(this.options.inverse?this.$off:this.$on).before(this.$label).before(this.options.inverse?this.$on:this.$off),this.options.indeterminate&&this.$element.prop('indeterminate',!0),this._init(),this._elementHandlers(),this._handleHandlers(),this._labelHandlers(),this._formHandler(),this._externalLabelHandler(),this.$element.trigger('init.bootstrapSwitch',this.options.state)}return f(j,[{key:'setPrevOptions',value:function(){this.prevOptions=e({},this.options)}},{key:'state',value:function(l,m){return'undefined'==typeof l?this.options.state:this.options.disabled||this.options.readonly||this.options.state&&!this.options.radioAllOff&&this.$element.is(':radio')?this.$element:(this.$element.is(':radio')?g('[name="'+this.$element.attr('name')+'"]').trigger('setPreviousOptions.bootstrapSwitch'):this.$element.trigger('setPreviousOptions.bootstrapSwitch'),this.options.indeterminate&&this.indeterminate(!1),this.$element.prop('checked',!!l).trigger('change.bootstrapSwitch',m),this.$element)}},{key:'toggleState',value:function(l){return this.options.disabled||this.options.readonly?this.$element:this.options.indeterminate?(this.indeterminate(!1),this.state(!0)):this.$element.prop('checked',!this.options.state).trigger('change.bootstrapSwitch',l)}},{key:'size',value:function(l){return'undefined'==typeof l?this.options.size:(null!=this.options.size&&this.$wrapper.removeClass(this._getClass(this.options.size)),l&&this.$wrapper.addClass(this._getClass(l)),this._width(),this._containerPosition(),this.options.size=l,this.$element)}},{key:'animate',value:function(l){return'undefined'==typeof l?this.options.animate:this.options.animate===!!l?this.$element:this.toggleAnimate()}},{key:'toggleAnimate',value:function(){return this.options.animate=!this.options.animate,this.$wrapper.toggleClass(this._getClass('animate')),this.$element}},{key:'disabled',value:function(l){return'undefined'==typeof l?this.options.disabled:this.options.disabled===!!l?this.$element:this.toggleDisabled()}},{key:'toggleDisabled',value:function(){return this.options.disabled=!this.options.disabled,this.$element.prop('disabled',this.options.disabled),this.$wrapper.toggleClass(this._getClass('disabled')),this.$element}},{key:'readonly',value:function(l){return'undefined'==typeof l?this.options.readonly:this.options.readonly===!!l?this.$element:this.toggleReadonly()}},{key:'toggleReadonly',value:function(){return this.options.readonly=!this.options.readonly,this.$element.prop('readonly',this.options.readonly),this.$wrapper.toggleClass(this._getClass('readonly')),this.$element}},{key:'indeterminate',value:function(l){return'undefined'==typeof l?this.options.indeterminate:this.options.indeterminate===!!l?this.$element:this.toggleIndeterminate()}},{key:'toggleIndeterminate',value:function(){return this.options.indeterminate=!this.options.indeterminate,this.$element.prop('indeterminate',this.options.indeterminate),this.$wrapper.toggleClass(this._getClass('indeterminate')),this._containerPosition(),this.$element}},{key:'inverse',value:function(l){return'undefined'==typeof l?this.options.inverse:this.options.inverse===!!l?this.$element:this.toggleInverse()}},{key:'toggleInverse',value:function(){this.$wrapper.toggleClass(this._getClass('inverse'));var l=this.$on.clone(!0),m=this.$off.clone(!0);return this.$on.replaceWith(m),this.$off.replaceWith(l),this.$on=m,this.$off=l,this.options.inverse=!this.options.inverse,this.$element}},{key:'onColor',value:function(l){return'undefined'==typeof l?this.options.onColor:(this.options.onColor&&this.$on.removeClass(this._getClass(this.options.onColor)),this.$on.addClass(this._getClass(l)),this.options.onColor=l,this.$element)}},{key:'offColor',value:function(l){return'undefined'==typeof l?this.options.offColor:(this.options.offColor&&this.$off.removeClass(this._getClass(this.options.offColor)),this.$off.addClass(this._getClass(l)),this.options.offColor=l,this.$element)}},{key:'onText',value:function(l){return'undefined'==typeof l?this.options.onText:(this.$on.html(l),this._width(),this._containerPosition(),this.options.onText=l,this.$element)}},{key:'offText',value:function(l){return'undefined'==typeof l?this.options.offText:(this.$off.html(l),this._width(),this._containerPosition(),this.options.offText=l,this.$element)}},{key:'labelText',value:function(l){return'undefined'==typeof l?this.options.labelText:(this.$label.html(l),this._width(),this.options.labelText=l,this.$element)}},{key:'handleWidth',value:function(l){return'undefined'==typeof l?this.options.handleWidth:(this.options.handleWidth=l,this._width(),this._containerPosition(),this.$element)}},{key:'labelWidth',value:function(l){return'undefined'==typeof l?this.options.labelWidth:(this.options.labelWidth=l,this._width(),this._containerPosition(),this.$element)}},{key:'baseClass',value:function(){return this.options.baseClass}},{key:'wrapperClass',value:function(l){return'undefined'==typeof l?this.options.wrapperClass:(l||(l=g.fn.bootstrapSwitch.defaults.wrapperClass),this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(' ')),this.$wrapper.addClass(this._getClasses(l).join(' ')),this.options.wrapperClass=l,this.$element)}},{key:'radioAllOff',value:function(l){if('undefined'==typeof l)return this.options.radioAllOff;var m=!!l;return this.options.radioAllOff===m?this.$element:(this.options.radioAllOff=m,this.$element)}},{key:'onInit',value:function(l){return'undefined'==typeof l?this.options.onInit:(l||(l=g.fn.bootstrapSwitch.defaults.onInit),this.options.onInit=l,this.$element)}},{key:'onSwitchChange',value:function(l){return'undefined'==typeof l?this.options.onSwitchChange:(l||(l=g.fn.bootstrapSwitch.defaults.onSwitchChange),this.options.onSwitchChange=l,this.$element)}},{key:'destroy',value:function(){var l=this.$element.closest('form');return l.length&&l.off('reset.bootstrapSwitch').removeData('bootstrap-switch'),this.$container.children().not(this.$element).remove(),this.$element.unwrap().unwrap().off('.bootstrapSwitch').removeData('bootstrap-switch'),this.$element}},{key:'_getElementOptions',value:function(){return{state:this.$element.is(':checked'),size:this.$element.data('size'),animate:this.$element.data('animate'),disabled:this.$element.is(':disabled'),readonly:this.$element.is('[readonly]'),indeterminate:this.$element.data('indeterminate'),inverse:this.$element.data('inverse'),radioAllOff:this.$element.data('radio-all-off'),onColor:this.$element.data('on-color'),offColor:this.$element.data('off-color'),onText:this.$element.data('on-text'),offText:this.$element.data('off-text'),labelText:this.$element.data('label-text'),handleWidth:this.$element.data('handle-width'),labelWidth:this.$element.data('label-width'),baseClass:this.$element.data('base-class'),wrapperClass:this.$element.data('wrapper-class')}}},{key:'_width',value:function(){var l=this,m=this.$on.add(this.$off).add(this.$label).css('width',''),n='auto'===this.options.handleWidth?Math.round(Math.max(this.$on.width(),this.$off.width())):this.options.handleWidth;return m.width(n),this.$label.width(function(o,p){return'auto'===l.options.labelWidth?p<n?n:p:l.options.labelWidth}),this._handleWidth=this.$on.outerWidth(),this._labelWidth=this.$label.outerWidth(),this.$container.width(2*this._handleWidth+this._labelWidth),this.$wrapper.width(this._handleWidth+this._labelWidth)}},{key:'_containerPosition',value:function(){var l=this,m=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.options.state,n=arguments[1];this.$container.css('margin-left',function(){var o=[0,'-'+l._handleWidth+'px'];return l.options.indeterminate?'-'+l._handleWidth/2+'px':m?l.options.inverse?o[1]:o[0]:l.options.inverse?o[0]:o[1]})}},{key:'_init',value:function(){var l=this,m=function(){l.setPrevOptions(),l._width(),l._containerPosition(),setTimeout(function(){if(l.options.animate)return l.$wrapper.addClass(l._getClass('animate'))},50)};if(this.$wrapper.is(':visible'))return void m();var n=window.setInterval(function(){if(l.$wrapper.is(':visible'))return m(),window.clearInterval(n)},50)}},{key:'_elementHandlers',value:function(){var l=this;return this.$element.on({'setPreviousOptions.bootstrapSwitch':this.setPrevOptions.bind(this),'previousState.bootstrapSwitch':function(){l.options=l.prevOptions,l.options.indeterminate&&l.$wrapper.addClass(l._getClass('indeterminate')),l.$element.prop('checked',l.options.state).trigger('change.bootstrapSwitch',!0)},'change.bootstrapSwitch':function(n,o){n.preventDefault(),n.stopImmediatePropagation();var p=l.$element.is(':checked');l._containerPosition(p),p===l.options.state||(l.options.state=p,l.$wrapper.toggleClass(l._getClass('off')).toggleClass(l._getClass('on')),!o&&(l.$element.is(':radio')&&g('[name="'+l.$element.attr('name')+'"]').not(l.$element).prop('checked',!1).trigger('change.bootstrapSwitch',!0),l.$element.trigger('switchChange.bootstrapSwitch',[p])))},'focus.bootstrapSwitch':function(n){n.preventDefault(),l.$wrapper.addClass(l._getClass('focused'))},'blur.bootstrapSwitch':function(n){n.preventDefault(),l.$wrapper.removeClass(l._getClass('focused'))},'keydown.bootstrapSwitch':function(n){!n.which||l.options.disabled||l.options.readonly||(37===n.which||39===n.which)&&(n.preventDefault(),n.stopImmediatePropagation(),l.state(39===n.which))}})}},{key:'_handleHandlers',value:function(){var l=this;return this.$on.on('click.bootstrapSwitch',function(m){return m.preventDefault(),m.stopPropagation(),l.state(!1),l.$element.trigger('focus.bootstrapSwitch')}),this.$off.on('click.bootstrapSwitch',function(m){return m.preventDefault(),m.stopPropagation(),l.state(!0),l.$element.trigger('focus.bootstrapSwitch')})}},{key:'_labelHandlers',value:function(){var l=this;this.$label.on({click:function(o){o.stopPropagation()},'mousedown.bootstrapSwitch touchstart.bootstrapSwitch':function(o){l._dragStart||l.options.disabled||l.options.readonly||(o.preventDefault(),o.stopPropagation(),l._dragStart=(o.pageX||o.originalEvent.touches[0].pageX)-parseInt(l.$container.css('margin-left'),10),l.options.animate&&l.$wrapper.removeClass(l._getClass('animate')),l.$element.trigger('focus.bootstrapSwitch'))},'mousemove.bootstrapSwitch touchmove.bootstrapSwitch':function(o){if(null!=l._dragStart){var p=(o.pageX||o.originalEvent.touches[0].pageX)-l._dragStart;o.preventDefault(),p<-l._handleWidth||0<p||(l._dragEnd=p,l.$container.css('margin-left',l._dragEnd+'px'))}},'mouseup.bootstrapSwitch touchend.bootstrapSwitch':function(o){if(l._dragStart){if(o.preventDefault(),l.options.animate&&l.$wrapper.addClass(l._getClass('animate')),l._dragEnd){var p=l._dragEnd>-(l._handleWidth/2);l._dragEnd=!1,l.state(l.options.inverse?!p:p)}else l.state(!l.options.state);l._dragStart=!1}},'mouseleave.bootstrapSwitch':function(){l.$label.trigger('mouseup.bootstrapSwitch')}})}},{key:'_externalLabelHandler',value:function(){var l=this,m=this.$element.closest('label');m.on('click',function(n){n.preventDefault(),n.stopImmediatePropagation(),n.target===m[0]&&l.toggleState()})}},{key:'_formHandler',value:function(){var l=this.$element.closest('form');l.data('bootstrap-switch')||l.on('reset.bootstrapSwitch',function(){window.setTimeout(function(){l.find('input').filter(function(){return g(this).data('bootstrap-switch')}).each(function(){return g(this).bootstrapSwitch('state',this.checked)})},1)}).data('bootstrap-switch',!0)}},{key:'_getClass',value:function(l){return this.options.baseClass+'-'+l}},{key:'_getClasses',value:function(l){return g.isArray(l)?l.map(this._getClass.bind(this)):[this._getClass(l)]}}]),j}();g.fn.bootstrapSwitch=function(j){for(var l=arguments.length,m=Array(1<l?l-1:0),n=1;n<l;n++)m[n-1]=arguments[n];return Array.prototype.reduce.call(this,function(o,p){var q=g(p),r=q.data('bootstrap-switch'),s=r||new h(p,j);return r||q.data('bootstrap-switch',s),'string'==typeof j?s[j].apply(s,m):o},this)},g.fn.bootstrapSwitch.Constructor=h,g.fn.bootstrapSwitch.defaults={state:!0,size:null,animate:!0,disabled:!1,readonly:!1,indeterminate:!1,inverse:!1,radioAllOff:!1,onColor:'primary',offColor:'default',onText:'ON',offText:'OFF',labelText:'&nbsp',handleWidth:'auto',labelWidth:'auto',baseClass:'bootstrap-switch',wrapperClass:'wrapper',onInit:function(){},onSwitchChange:function(){}}});  
src/main/resources/static/favicon.ico deleted 100644 → 0
No preview for this file type
src/main/resources/static/simple_switch/simple.switch.min.js deleted 100644 → 0
1 -/*!  
2 - * Copyright 2015, Lu Kang  
3 - * WeChat:lukangdaye  
4 - * https://github.com/1029131145/Simple-Switch  
5 - */  
6 -  
7 -(function($){var Switch_Num=0;$.extend($.fn,{simpleSwitch:function(ATTR){var _ATTR={"id":$.simpleSwitch.Id,"theme":$.simpleSwitch.Theme,"end":$.simpleSwitch.End};$.extend(_ATTR,ATTR);var _ALL=$(this),a=_ATTR,_NUM=Switch_Num,_ID=a["id"],_THEME=a["theme"];_ALL.each(function(){var _THIS=$(this);_THIS.hide();_THIS.attr("simpleSwitch",_NUM);_THIS.after('<div class="'+_ID+" "+_ID+"_"+_THEME+'" id="'+_ID+_NUM+'"><div class="SwitchLine"></div><span class="SwitchButton"></span></div>');var _CONTAINER=$("#"+_ID+_NUM);var _type=_THIS.attr("type");var _name=_THIS.attr("name");if(_type=="radio"){_CONTAINER.attr("type",_type+_name)}$.simpleSwitch.Init(this,_CONTAINER);_THIS.change(function(){$.simpleSwitch.Change(this,_CONTAINER,_type,_name)});_CONTAINER.click(function(){$.simpleSwitch.Click(this,_THIS)});_NUM++;a["end"](_THIS,_CONTAINER)});Switch_Num=_NUM}}),$.simpleSwitch=function(){return !0},$.extend($.simpleSwitch,{Id:"Switch",Theme:"Flat",Result:"Result",setTheme:function(theme){$.extend(this.Theme,theme)  
8 -},setDisabled:function(o,i){if(i){$(o).attr("disabled","disabled");$(o).next(".Switch").addClass("Disabled")}else{$(o).removeAttr("disabled");$(o).next(".Switch").removeClass("Disabled")}},Click:function(t,input){input.click()},Change:function(t,cont,type,name){var $T=$(t);var $type=cont.attr("type");if(type){$("div[type='"+$type+"']").removeClass("On");$("input[type='"+type+"'][name='"+name+"']").attr(this.Result,"false")}var checked=$T.attr("checked");if(checked){cont.addClass("On");$T.attr(this.Result,"true")}else{cont.removeClass("On");$T.attr(this.Result,"false")}},Init:function(t,cont){var $T=$(t);var checked=$T.attr("checked");if(checked){cont.addClass("On");$T.attr(this.Result,"true")}else{cont.removeClass("On");$T.attr(this.Result,"false")}if($T.attr("disabled")){cont.addClass("Disabled")}},End:function(t,c){}})})(jQuery);  
9 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/simple_switch/simple.switch.three.css deleted 100644 → 0
1 -* {  
2 - box-sizing: border-box !important;  
3 -}  
4 -  
5 -.Switch, .Switch * {  
6 - -webkit-transition-property: all;  
7 - -moz-transition-property: all;  
8 - -o-transition-property: all;  
9 - transition-property: all;  
10 - -webkit-transition-duration: 0.2s;  
11 - -moz-transition-duration: 0.2s;  
12 - -o-transition-duration: 0.2s;  
13 - transition-duration: 0.2s;  
14 - -webkit-transition-delay: 0s;  
15 - -moz-transition-delay: 0s;  
16 - -o-transition-delay: 0s;  
17 - transition-delay: 0s;  
18 -}  
19 -  
20 -/*  
21 -Default  
22 -*/  
23 -.Switch_Default {  
24 - position: relative;  
25 - width: 64px;  
26 - height: 32px;  
27 - cursor: pointer;  
28 - display: inline-block;  
29 - vertical-align: middle;  
30 -}  
31 -  
32 -.Switch_Default .SwitchLine {  
33 - position: absolute;  
34 - width: 60px;  
35 - height: 4px;  
36 - left: 2px;  
37 - top: 14px;  
38 - z-index: 1;  
39 - background-color: #dadada;  
40 -}  
41 -  
42 -.Switch_Default .SwitchButton {  
43 - position: absolute;  
44 - width: 32px;  
45 - height: 32px;  
46 - left: 0;  
47 - top: 0;  
48 - z-index: 2;  
49 - background-color: #dadada;  
50 - border-radius: 32px;  
51 -}  
52 -  
53 -.Switch_Default.On .SwitchLine {  
54 - background-color: #00c0ff;  
55 -}  
56 -  
57 -.Switch_Default.On .SwitchButton {  
58 - left: 32px;  
59 - background-color: #00c0ff;  
60 -}  
61 -  
62 -.Switch_Default.On .SwitchButton {  
63 - left: 32px;  
64 - background-color: #00c0ff;  
65 -}  
66 -  
67 -.Switch_Default.Disabled {  
68 - opacity: 0.3;  
69 -}  
70 -  
71 -.Switch_Default.Disabled .SwitchButton {  
72 - /*opacity:0.5;*/  
73 -  
74 -}  
75 -  
76 -.Switch_Default.On.Disabled .SwitchLine {  
77 - /*opacity:0.5;*/  
78 -  
79 -}  
80 -  
81 -/* DefaultMin */  
82 -.Switch_DefaultMin {  
83 - position: relative;  
84 - width: 48px;  
85 - height: 24px;  
86 - cursor: pointer;  
87 - display: inline-block;  
88 - vertical-align: middle;  
89 -}  
90 -  
91 -.Switch_DefaultMin .SwitchLine {  
92 - position: absolute;  
93 - width: 44px;  
94 - height: 2px;  
95 - left: 2px;  
96 - top: 11px;  
97 - z-index: 1;  
98 - background-color: #dadada;  
99 -}  
100 -  
101 -.Switch_DefaultMin .SwitchButton {  
102 - position: absolute;  
103 - width: 24px;  
104 - height: 24px;  
105 - left: 0;  
106 - top: 0;  
107 - z-index: 2;  
108 - background-color: #dadada;  
109 - border-radius: 24px;  
110 -}  
111 -  
112 -.Switch_DefaultMin.On .SwitchLine {  
113 - background-color: #00c0ff;  
114 -}  
115 -  
116 -.Switch_DefaultMin.On .SwitchButton {  
117 - left: 24px;  
118 - background-color: #00c0ff;  
119 -}  
120 -  
121 -.Switch_DefaultMin.Disabled {  
122 - opacity: 0.3;  
123 -}  
124 -  
125 -.Switch_DefaultMin.Disabled .SwitchButton {  
126 - /*opacity:0.5;*/  
127 -  
128 -}  
129 -  
130 -.Switch_DefaultMin.On.Disabled .SwitchLine {  
131 - /*opacity:0.5;*/  
132 -  
133 -}  
134 -  
135 -/* Flat */  
136 -.Switch_Flat {  
137 - position: relative;  
138 - width: 100px;  
139 - height: 40px;  
140 - cursor: pointer;  
141 - display: inline-block;  
142 - vertical-align: middle;  
143 - background-color: #f5a5a6;  
144 -}  
145 -  
146 -.Switch_Flat .SwitchLine:before {  
147 - position: absolute;  
148 - content: "OFF";  
149 - color: #fff;  
150 - left: 60px;  
151 - top: 9px;  
152 -}  
153 -  
154 -.Switch_Flat .SwitchLine:after {  
155 - position: absolute;  
156 - content: "ON";  
157 - color: #fff;  
158 - left: 15px;  
159 - top: 9px;  
160 -}  
161 -  
162 -.Switch_Flat .SwitchButton {  
163 - position: absolute;  
164 - width: 45px;  
165 - height: 30px;  
166 - left: 5px;  
167 - top: 5px;  
168 - z-index: 2;  
169 - background-color: #fff;  
170 -}  
171 -  
172 -.Switch_Flat .SwitchButton:before {  
173 - position: absolute;  
174 - content: "";  
175 - width: 4px;  
176 - height: 16px;  
177 - left: 15px;  
178 - top: 7px;  
179 - background-color: #f5a5a6;  
180 -}  
181 -  
182 -.Switch_Flat .SwitchButton:after {  
183 - position: absolute;  
184 - content: "";  
185 - width: 4px;  
186 - height: 16px;  
187 - left: 26px;  
188 - top: 7px;  
189 - background-color: #f5a5a6;  
190 -}  
191 -  
192 -.Switch_Flat.On {  
193 - background-color: #a7cce9;  
194 -}  
195 -  
196 -.Switch_Flat.On .SwitchLine {  
197 -  
198 -}  
199 -  
200 -.Switch_Flat.On .SwitchButton {  
201 - left: 50px;  
202 -}  
203 -  
204 -.Switch_Flat.On .SwitchButton:after, .Switch_Flat.On .SwitchButton:before  
205 - {  
206 - background-color: #a7cce9;  
207 -}  
208 -  
209 -.Switch_Flat.Disabled {  
210 - opacity: 0.3;  
211 -}  
212 -  
213 -.Switch_Flat.Disabled .SwitchButton {  
214 - /*opacity:0.5;*/  
215 -  
216 -}  
217 -  
218 -.Switch_Flat.On.Disabled .SwitchLine {  
219 - /*opacity:0.5;*/  
220 -  
221 -}  
222 -  
223 -/* FlatRadius */  
224 -.Switch_FlatRadius {  
225 - position: relative;  
226 - width: 100px;  
227 - height: 40px;  
228 - cursor: pointer;  
229 - display: inline-block;  
230 - vertical-align: middle;  
231 - background-color: #f5a5a6;  
232 - border-radius: 4px;  
233 -}  
234 -  
235 -.Switch_FlatRadius .SwitchLine:before {  
236 - position: absolute;  
237 - content: "OFF";  
238 - color: #fff;  
239 - left: 60px;  
240 - top: 9px;  
241 -}  
242 -  
243 -.Switch_FlatRadius .SwitchLine:after {  
244 - position: absolute;  
245 - content: "ON";  
246 - color: #fff;  
247 - left: 15px;  
248 - top: 9px;  
249 -}  
250 -  
251 -.Switch_FlatRadius .SwitchButton {  
252 - position: absolute;  
253 - width: 45px;  
254 - height: 30px;  
255 - left: 5px;  
256 - top: 5px;  
257 - z-index: 2;  
258 - background-color: #fff;  
259 - border-radius: 4px;  
260 -}  
261 -  
262 -.Switch_FlatRadius .SwitchButton:before {  
263 - position: absolute;  
264 - content: "";  
265 - width: 4px;  
266 - height: 16px;  
267 - left: 15px;  
268 - top: 7px;  
269 - background-color: #f5a5a6;  
270 -}  
271 -  
272 -.Switch_FlatRadius .SwitchButton:after {  
273 - position: absolute;  
274 - content: "";  
275 - width: 4px;  
276 - height: 16px;  
277 - left: 26px;  
278 - top: 7px;  
279 - background-color: #f5a5a6;  
280 -}  
281 -  
282 -.Switch_FlatRadius.On {  
283 - background-color: #a7cce9;  
284 -}  
285 -  
286 -.Switch_FlatRadius.On .SwitchLine {  
287 -  
288 -}  
289 -  
290 -.Switch_FlatRadius.On .SwitchButton {  
291 - left: 50px;  
292 -}  
293 -  
294 -.Switch_FlatRadius.On .SwitchButton:after, .Switch_FlatRadius.On .SwitchButton:before  
295 - {  
296 - background-color: #a7cce9;  
297 -}  
298 -  
299 -.Switch_FlatRadius.Disabled {  
300 - opacity: 0.3;  
301 -}  
302 -  
303 -.Switch_FlatRadius.Disabled .SwitchButton {  
304 - /*opacity:0.5;*/  
305 -  
306 -}  
307 -  
308 -.Switch_FlatRadius.On.Disabled .SwitchLine {  
309 - /*opacity:0.5;*/  
310 -  
311 -}  
312 -  
313 -/* FlatCircular */  
314 -.Switch_FlatCircular {  
315 - position: relative;  
316 - width: 100px;  
317 - height: 40px;  
318 - cursor: pointer;  
319 - display: inline-block;  
320 - vertical-align: middle;  
321 - background-color: #f5a5a6;  
322 - border-radius: 20px;  
323 -}  
324 -  
325 -.Switch_FlatCircular .SwitchLine:before {  
326 - position: absolute;  
327 - content: "OFF";  
328 - color: #fff;  
329 - left: 60px;  
330 - top: 9px;  
331 -}  
332 -  
333 -.Switch_FlatCircular .SwitchLine:after {  
334 - position: absolute;  
335 - content: "ON";  
336 - color: #fff;  
337 - left: 15px;  
338 - top: 9px;  
339 -}  
340 -  
341 -.Switch_FlatCircular .SwitchButton {  
342 - position: absolute;  
343 - width: 46px;  
344 - height: 46px;  
345 - left: -3px;  
346 - top: -3px;  
347 - z-index: 2;  
348 - background-color: #fff;  
349 - border-radius: 45px;  
350 - border: 1px solid #f5a5a6;  
351 -}  
352 -  
353 -.Switch_FlatCircular.On {  
354 - background-color: #a7cce9;  
355 -}  
356 -  
357 -.Switch_FlatCircular.On .SwitchLine {  
358 -  
359 -}  
360 -  
361 -.Switch_FlatCircular.On .SwitchButton {  
362 - border: 1px solid #a7cce9;  
363 - left: 57px;  
364 -}  
365 -  
366 -.Switch_FlatCircular.On .SwitchButton:after, .Switch_FlatCircular.On .SwitchButton:before  
367 - {  
368 - background-color: #a7cce9;  
369 -}  
370 -  
371 -.Switch_FlatCircular.Disabled {  
372 - opacity: 0.3;  
373 -}  
374 -  
375 -.Switch_FlatCircular.Disabled .SwitchButton {  
376 - /*opacity:0.5;*/  
377 -  
378 -}  
379 -  
380 -.Switch_FlatCircular.On.Disabled .SwitchLine {  
381 - /*opacity:0.5;*/  
382 -  
383 -}  
384 -  
385 -/* Green */  
386 -.Switch_Green {  
387 - position: relative;  
388 - width: 100px;  
389 - height: 40px;  
390 - cursor: pointer;  
391 - display: inline-block;  
392 - vertical-align: middle;  
393 - background-color: #b4aa9f;  
394 - border-radius: 20px;  
395 -}  
396 -  
397 -.Switch_Green .SwitchLine:before {  
398 - position: absolute;  
399 - content: "\f00d";  
400 - color: #fff3e3;  
401 - left: 62px;  
402 - top: 8px;  
403 - /*font-awesome*/  
404 - font: normal normal normal 14px/1 FontAwesome !important;  
405 - font-size: 25px !important;  
406 -}  
407 -  
408 -.Switch_Green .SwitchLine:after {  
409 - position: absolute;  
410 - content: "\f00c";  
411 - color: #fff3e3;  
412 - left: 15px;  
413 - top: 8px;  
414 - /*font-awesome*/  
415 - font: normal normal normal 14px/1 FontAwesome !important;  
416 - font-size: 25px !important;  
417 -}  
418 -  
419 -.Switch_Green .SwitchButton {  
420 - position: absolute;  
421 - width: 46px;  
422 - height: 46px;  
423 - left: -3px;  
424 - top: -3px;  
425 - z-index: 2;  
426 - background-color: #fff3e3;  
427 - border-radius: 45px;  
428 - border: 3px solid #b4aa9f;  
429 -}  
430 -  
431 -.Switch_Green.On {  
432 - background-color: #6ebf5f;  
433 -}  
434 -  
435 -.Switch_Green.On .SwitchLine {  
436 -  
437 -}  
438 -  
439 -.Switch_Green.On .SwitchButton {  
440 - border: 3px solid #6ebf5f;  
441 - left: 57px;  
442 -}  
443 -  
444 -.Switch_Green.On .SwitchButton:after, .Switch_Green.On .SwitchButton:before  
445 - {  
446 - background-color: #a7cce9;  
447 -}  
448 -  
449 -.Switch_Green.Disabled {  
450 - opacity: 0.3;  
451 -}  
452 -  
453 -.Switch_Green.Disabled .SwitchButton {  
454 - /*opacity:0.5;*/  
455 -  
456 -}  
457 -  
458 -.Switch_Green.On.Disabled .SwitchLine {  
459 - /*opacity:0.5;*/  
460 -  
461 -}  
462 -  
463 -/* Icon */  
464 -.Switch_Icon {  
465 - position: relative;  
466 - width: 90px;  
467 - height: 50px;  
468 - cursor: pointer;  
469 - display: inline-block;  
470 - vertical-align: middle;  
471 - border-radius: 30px;  
472 - border: 6px solid #fff;  
473 - margin: 0 38px;  
474 -}  
475 -  
476 -.Switch_Icon .SwitchLine:before {  
477 - position: absolute;  
478 - content: "\f1e3";  
479 - color: #1b5a95;  
480 - left: 96px;  
481 - top: 8px;  
482 - /*font-awesome*/  
483 - font: normal normal normal 14px/1 FontAwesome !important;  
484 - font-size: 25px !important;  
485 -}  
486 -  
487 -.Switch_Icon .SwitchLine:after {  
488 - position: absolute;  
489 - content: "\f1db";  
490 - color: #fff;  
491 - left: -42px;  
492 - top: 8px;  
493 - /*font-awesome*/  
494 - font: normal normal normal 14px/1 FontAwesome !important;  
495 - font-size: 25px !important;  
496 -}  
497 -  
498 -.Switch_Icon .SwitchButton {  
499 - position: absolute;  
500 - width: 26px;  
501 - height: 26px;  
502 - left: 6px;  
503 - top: 6px;  
504 - z-index: 2;  
505 - background-color: #fff;  
506 - border-radius: 26px;  
507 -}  
508 -  
509 -.Switch_Icon.On {  
510 -  
511 -}  
512 -  
513 -.Switch_Icon.On .SwitchLine {  
514 -  
515 -}  
516 -  
517 -.Switch_Icon.On .SwitchButton {  
518 - left: 48px;  
519 -}  
520 -  
521 -.Switch_Icon.On .SwitchLine:after {  
522 - color: #1b5a95;  
523 -}  
524 -  
525 -.Switch_Icon.On .SwitchLine:before {  
526 - color: #fff;  
527 -}  
528 -  
529 -.Switch_Icon.Disabled {  
530 - opacity: 0.3;  
531 -}  
532 -  
533 -.Switch_Icon.Disabled .SwitchButton {  
534 - /*opacity:0.5;*/  
535 -  
536 -}  
537 -  
538 -.Switch_Icon.On.Disabled .SwitchLine {  
539 - /*opacity:0.5;*/  
540 -  
541 -}  
542 \ No newline at end of file 0 \ No newline at end of file