Commit 19a651f6f85293d782798e21b943496c52b6b490

Authored by 娄高锋
1 parent a2699ffb

加油量加电量保留三位小数;充电量导入格式变更,不再覆盖,提供详细查询、批量删除功能;

# Conflicts:
#	src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
#	src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
#	src/main/resources/static/pages/electricity/jdl/list.html

Too many changes to show.

To preserve performance only 14 of 41 files are displayed.

src/main/java/com/bsth/controller/oil/JdlController.java
... ... @@ -2,6 +2,7 @@ package com.bsth.controller.oil;
2 2  
3 3 import java.io.File;
4 4 import java.util.HashMap;
  5 +import java.util.List;
5 6 import java.util.Map;
6 7  
7 8 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -17,6 +18,7 @@ import com.alibaba.fastjson.JSONArray;
17 18 import com.alibaba.fastjson.JSONObject;
18 19 import com.bsth.controller.BaseController;
19 20 import com.bsth.entity.oil.Jdl;
  21 +import com.bsth.entity.oil.JdlReception;
20 22 import com.bsth.service.oil.JdlService;
21 23 import com.google.common.io.Files;
22 24  
... ... @@ -46,9 +48,46 @@ public class JdlController extends BaseController<Jdl, Integer> {
46 48 return "{\"result\":" + "\""+result+"\"}";
47 49 }
48 50  
  51 + /** 24年12月工单更新电量导入 */
  52 + @RequestMapping(value = "/uploadFile_2412",method = RequestMethod.POST)
  53 + public String uploadFile_2412(MultipartFile file, String gsbm_, String gsName,
  54 + String fgsbm_, String fgsName) throws Exception{
  55 + File newFile = new File(
  56 + getDataImportClasspath() + File.separator +
  57 + file.getOriginalFilename());
  58 + Files.write(file.getBytes(), newFile);
  59 + String result = jdlService.importExcel_2412(newFile, gsbm_, gsName, fgsbm_, fgsName);
  60 + return "{\"result\":" + "\""+result+"\"}";
  61 + }
  62 +
49 63 @RequestMapping(value = "/query",method = RequestMethod.GET)
50 64 public Map<String, Object> query(@RequestParam Map<String, Object> map) throws Exception{
51 65 return jdlService.query(map);
52 66 }
53 67  
  68 + @RequestMapping(value = "/query_2412",method = RequestMethod.GET)
  69 + public Map<String, Object> query_2412(@RequestParam Map<String, Object> map) throws Exception{
  70 + return jdlService.query_2412(map);
  71 + }
  72 +
  73 + @RequestMapping(value = "/queryJdlReception",method = RequestMethod.GET)
  74 + public List<JdlReception> queryJdlReception(@RequestParam Map<String, Object> map) throws Exception{
  75 + return jdlService.queryJdlReception(map);
  76 + }
  77 +
  78 + @RequestMapping(value = "/queryJdlReceptionBatch",method = RequestMethod.GET)
  79 + public Map<String, Object> queryJdlReceptionBatch(@RequestParam Map<String, Object> map) throws Exception{
  80 + return jdlService.queryJdlReceptionBatch(map);
  81 + }
  82 +
  83 + @RequestMapping(value = "/queryJdlReceptionBatchData",method = RequestMethod.GET)
  84 + public List<JdlReception> queryJdlReceptionBatchData(@RequestParam Map<String, Object> map) throws Exception{
  85 + return jdlService.queryJdlReceptionBatchData(map);
  86 + }
  87 +
  88 + @RequestMapping(value = "/deleteJdlReceptionBatch",method = RequestMethod.POST)
  89 + public Map<String, Object> deleteJdlReceptionBatch(@RequestParam Map<String, Object> map) throws Exception{
  90 + return jdlService.deleteJdlReceptionBatch(map);
  91 + }
  92 +
54 93 }
... ...
src/main/java/com/bsth/data/directive/GatewayHttpUtils.java
1   -package com.bsth.data.directive;
2   -
3   -import com.alibaba.fastjson.JSONObject;
4   -import com.bsth.data.SystemParamCache;
5   -import org.apache.http.client.config.RequestConfig;
6   -import org.apache.http.client.methods.CloseableHttpResponse;
7   -import org.apache.http.client.methods.HttpPost;
8   -import org.apache.http.entity.StringEntity;
9   -import org.apache.http.impl.client.CloseableHttpClient;
10   -import org.apache.http.impl.client.HttpClients;
11   -import org.apache.http.util.EntityUtils;
12   -import org.slf4j.Logger;
13   -import org.slf4j.LoggerFactory;
14   -import org.springframework.beans.factory.InitializingBean;
15   -import org.springframework.stereotype.Component;
16   -
17   -/**
18   - * @author PanZhao
19   - * @ClassName: GatewayHttpUtils
20   - * @Description: TODO(和网关HTTP通讯工具类)
21   - * @date 2016年8月14日 下午9:50:46
22   - */
23   -@Component
24   -public class GatewayHttpUtils implements InitializingBean {
25   - static Logger logger = LoggerFactory.getLogger(GatewayHttpUtils.class);
26   -
27   - static String url;
28   - static CloseableHttpClient httpClient = null;
29   - static HttpPost post;
30   - static RequestConfig requestConfig;
31   - static CloseableHttpResponse response;
32   -
33   - public static int postJson(String jsonStr) {
34   - logger.info("send : " + jsonStr);
35   -
36   - int code = -1;
37   - try {
38   - post.setEntity(new StringEntity(jsonStr, "utf-8"));
39   -
40   - response = httpClient.execute(post);
41   -
42   - int statusCode = response.getStatusLine().getStatusCode();
43   - if(statusCode != 200){
44   - logger.error("http client status code: " + statusCode);
45   - }
46   -
47   - JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity()));
48   - if (null != json && json.getInteger("errCode") == 0)
49   - code = 0;
50   - else
51   - logger.error("和网关http通讯失败,rs: " + json);
52   -
53   - if (null != response)
54   - response.close();
55   - } catch (Exception e) {
56   - logger.error("", e);
57   - }
58   - return code;
59   - }
60   -
61   - @Override
62   - public void afterPropertiesSet() throws Exception {
63   - url = SystemParamCache.getUrlHttpDirective();
64   - httpClient = HttpClients.createDefault();
65   - post = new HttpPost(url);
66   - requestConfig = RequestConfig.custom()
67   - .setConnectTimeout(3000).setConnectionRequestTimeout(2000)
68   - .setSocketTimeout(3000).build();
69   - post.setConfig(requestConfig);
70   - }
71   -}
  1 +package com.bsth.data.directive;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.bsth.data.SystemParamCache;
  5 +import org.apache.http.client.config.RequestConfig;
  6 +import org.apache.http.client.methods.CloseableHttpResponse;
  7 +import org.apache.http.client.methods.HttpPost;
  8 +import org.apache.http.entity.StringEntity;
  9 +import org.apache.http.impl.client.CloseableHttpClient;
  10 +import org.apache.http.impl.client.HttpClients;
  11 +import org.apache.http.util.EntityUtils;
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.factory.InitializingBean;
  15 +import org.springframework.stereotype.Component;
  16 +
  17 +/**
  18 + * @author PanZhao
  19 + * @ClassName: GatewayHttpUtils
  20 + * @Description: TODO(和网关HTTP通讯工具类)
  21 + * @date 2016年8月14日 下午9:50:46
  22 + */
  23 +@Component
  24 +public class GatewayHttpUtils implements InitializingBean {
  25 + static Logger logger = LoggerFactory.getLogger(GatewayHttpUtils.class);
  26 +
  27 + static String url;
  28 + static CloseableHttpClient httpClient = null;
  29 + static HttpPost post;
  30 + static RequestConfig requestConfig;
  31 + static CloseableHttpResponse response;
  32 +
  33 + public static int postJson(String jsonStr) {
  34 + logger.info("send : " + jsonStr);
  35 +
  36 + int code = -1;
  37 + try {
  38 + post.setEntity(new StringEntity(jsonStr, "utf-8"));
  39 +
  40 + response = httpClient.execute(post);
  41 +
  42 + int statusCode = response.getStatusLine().getStatusCode();
  43 + if(statusCode != 200){
  44 + logger.error("http client status code: " + statusCode);
  45 + }
  46 +
  47 + JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity()));
  48 + if (null != json && json.getInteger("errCode") == 0)
  49 + code = 0;
  50 + else
  51 + logger.error("和网关http通讯失败,rs: " + json);
  52 +
  53 + if (null != response)
  54 + response.close();
  55 + } catch (Exception e) {
  56 + logger.error("", e);
  57 + }
  58 + return code;
  59 + }
  60 +
  61 + @Override
  62 + public void afterPropertiesSet() throws Exception {
  63 + url = SystemParamCache.getUrlHttpDirective();
  64 + httpClient = HttpClients.createDefault();
  65 + post = new HttpPost(url);
  66 + requestConfig = RequestConfig.custom()
  67 + .setConnectTimeout(3000).setConnectionRequestTimeout(2000)
  68 + .setSocketTimeout(3000).build();
  69 + post.setConfig(requestConfig);
  70 + }
  71 +}
... ...
src/main/java/com/bsth/data/gpsdata_v2/load/GatewayHttpLoader.java
1   -package com.bsth.data.gpsdata_v2.load;
2   -
3   -import com.alibaba.fastjson.JSON;
4   -import com.bsth.data.BasicData;
5   -import com.bsth.data.SystemParamCache;
6   -import com.bsth.data.gpsdata_v2.GpsRealData;
7   -import com.bsth.data.gpsdata_v2.entity.GpsEntity;
8   -import com.bsth.data.gpsdata_v2.utils.GpsDataUtils;
9   -import org.apache.commons.lang3.StringUtils;
10   -import org.apache.http.HttpEntity;
11   -import org.apache.http.client.config.RequestConfig;
12   -import org.apache.http.client.methods.CloseableHttpResponse;
13   -import org.apache.http.client.methods.HttpGet;
14   -import org.apache.http.impl.client.CloseableHttpClient;
15   -import org.apache.http.impl.client.HttpClients;
16   -import org.slf4j.Logger;
17   -import org.slf4j.LoggerFactory;
18   -import org.springframework.beans.BeansException;
19   -import org.springframework.beans.factory.InitializingBean;
20   -import org.springframework.context.ApplicationContext;
21   -import org.springframework.context.ApplicationContextAware;
22   -import org.springframework.stereotype.Component;
23   -
24   -import java.io.BufferedReader;
25   -import java.io.InputStreamReader;
26   -import java.util.ArrayList;
27   -import java.util.List;
28   -
29   -/**
30   - * 从网关http 接口加载数据
31   - * Created by panzhao on 2017/11/15.
32   - */
33   -@Component
34   -public class GatewayHttpLoader implements ApplicationContextAware, InitializingBean {
35   -
36   - static Logger logger = LoggerFactory.getLogger(GatewayHttpLoader.class);
37   -
38   - static String url;
39   - static List<GpsEntity> list;
40   - static CloseableHttpClient httpClient = null;
41   - static HttpGet get;
42   - static RequestConfig requestConfig;
43   - static CloseableHttpResponse response;
44   - static HttpEntity entity;
45   - static BufferedReader br;
46   -
47   - static GpsRealData gpsRealData;
48   -
49   - public static List<GpsEntity> load(){
50   - try{
51   - if(list.size() > 0)
52   - list.clear();
53   -
54   - response = httpClient.execute(get);
55   - entity = response.getEntity();
56   -
57   - logger.info("entity:" + entity + "get:" + get);
58   - if(null == entity)
59   - return list;
60   -
61   - br = new BufferedReader(new InputStreamReader(entity.getContent()));
62   -
63   - StringBuilder sb = new StringBuilder();
64   - String str;
65   - while ((str = br.readLine()) != null)
66   - sb.append(str);
67   -
68   - logger.debug("gps:" + sb.toString());
69   - list = JSON.parseArray(JSON.parseObject(sb.toString()).getString("data"), GpsEntity.class);
70   - //过滤掉无效的点位
71   - list = GpsDataUtils.clearInvalid(list);
72   -
73   - List<GpsEntity> ups = new ArrayList<>();
74   - String nbbm;
75   - for (GpsEntity gps : list) {
76   - if (StringUtils.isBlank(gps.getDeviceId()))
77   - continue;
78   -
79   - if (gps_equals(gpsRealData.get(gps.getDeviceId()), gps))
80   - continue;
81   -
82   - nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId());
83   - gps.setNbbm(nbbm);
84   - ups.add(gps);
85   - }
86   - list = ups;
87   -
88   - if (null != response)
89   - response.close();
90   - }catch (Exception e){
91   - logger.error("", e);
92   - }
93   - return list;
94   - }
95   -
96   -
97   - private static boolean gps_equals(GpsEntity old, GpsEntity gps){
98   - if(old != null &&
99   - old.getTimestamp().equals(gps.getTimestamp()) &&
100   - old.getLat().equals(gps.getLat()) &&
101   - old.getLon().equals(gps.getLon()))
102   - return true;
103   - return false;
104   - }
105   -
106   - @Override
107   - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
108   - gpsRealData = applicationContext.getBean(GpsRealData.class);
109   - }
110   -
111   - @Override
112   - public void afterPropertiesSet() throws Exception {
113   - url = SystemParamCache.getUrlHttpGpsReal();
114   - list = new ArrayList<>();
115   - httpClient = HttpClients.createDefault();
116   - get = new HttpGet(url);
117   - requestConfig = RequestConfig.custom()
118   - .setConnectTimeout(2500).setConnectionRequestTimeout(2000)
119   - .setSocketTimeout(2500).build();
120   - get.setConfig(requestConfig);
121   - }
122   -}
  1 +package com.bsth.data.gpsdata_v2.load;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.bsth.data.BasicData;
  5 +import com.bsth.data.SystemParamCache;
  6 +import com.bsth.data.gpsdata_v2.GpsRealData;
  7 +import com.bsth.data.gpsdata_v2.entity.GpsEntity;
  8 +import com.bsth.data.gpsdata_v2.utils.GpsDataUtils;
  9 +import org.apache.commons.lang3.StringUtils;
  10 +import org.apache.http.HttpEntity;
  11 +import org.apache.http.client.config.RequestConfig;
  12 +import org.apache.http.client.methods.CloseableHttpResponse;
  13 +import org.apache.http.client.methods.HttpGet;
  14 +import org.apache.http.impl.client.CloseableHttpClient;
  15 +import org.apache.http.impl.client.HttpClients;
  16 +import org.slf4j.Logger;
  17 +import org.slf4j.LoggerFactory;
  18 +import org.springframework.beans.BeansException;
  19 +import org.springframework.beans.factory.InitializingBean;
  20 +import org.springframework.context.ApplicationContext;
  21 +import org.springframework.context.ApplicationContextAware;
  22 +import org.springframework.stereotype.Component;
  23 +
  24 +import java.io.BufferedReader;
  25 +import java.io.InputStreamReader;
  26 +import java.util.ArrayList;
  27 +import java.util.List;
  28 +
  29 +/**
  30 + * 从网关http 接口加载数据
  31 + * Created by panzhao on 2017/11/15.
  32 + */
  33 +@Component
  34 +public class GatewayHttpLoader implements ApplicationContextAware, InitializingBean {
  35 +
  36 + static Logger logger = LoggerFactory.getLogger(GatewayHttpLoader.class);
  37 +
  38 + static String url;
  39 + static List<GpsEntity> list;
  40 + static CloseableHttpClient httpClient = null;
  41 + static HttpGet get;
  42 + static RequestConfig requestConfig;
  43 + static CloseableHttpResponse response;
  44 + static HttpEntity entity;
  45 + static BufferedReader br;
  46 +
  47 + static GpsRealData gpsRealData;
  48 +
  49 + public static List<GpsEntity> load(){
  50 + try{
  51 + if(list.size() > 0)
  52 + list.clear();
  53 +
  54 + response = httpClient.execute(get);
  55 + entity = response.getEntity();
  56 +
  57 + logger.info("entity:" + entity + "get:" + get);
  58 + if(null == entity)
  59 + return list;
  60 +
  61 + br = new BufferedReader(new InputStreamReader(entity.getContent()));
  62 +
  63 + StringBuilder sb = new StringBuilder();
  64 + String str;
  65 + while ((str = br.readLine()) != null)
  66 + sb.append(str);
  67 +
  68 + logger.debug("gps:" + sb.toString());
  69 + list = JSON.parseArray(JSON.parseObject(sb.toString()).getString("data"), GpsEntity.class);
  70 + //过滤掉无效的点位
  71 + list = GpsDataUtils.clearInvalid(list);
  72 +
  73 + List<GpsEntity> ups = new ArrayList<>();
  74 + String nbbm;
  75 + for (GpsEntity gps : list) {
  76 + if (StringUtils.isBlank(gps.getDeviceId()))
  77 + continue;
  78 +
  79 + if (gps_equals(gpsRealData.get(gps.getDeviceId()), gps))
  80 + continue;
  81 +
  82 + nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId());
  83 + gps.setNbbm(nbbm);
  84 + ups.add(gps);
  85 + }
  86 + list = ups;
  87 +
  88 + if (null != response)
  89 + response.close();
  90 + }catch (Exception e){
  91 + logger.error("", e);
  92 + }
  93 + return list;
  94 + }
  95 +
  96 +
  97 + private static boolean gps_equals(GpsEntity old, GpsEntity gps){
  98 + if(old != null &&
  99 + old.getTimestamp().equals(gps.getTimestamp()) &&
  100 + old.getLat().equals(gps.getLat()) &&
  101 + old.getLon().equals(gps.getLon()))
  102 + return true;
  103 + return false;
  104 + }
  105 +
  106 + @Override
  107 + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
  108 + gpsRealData = applicationContext.getBean(GpsRealData.class);
  109 + }
  110 +
  111 + @Override
  112 + public void afterPropertiesSet() throws Exception {
  113 + url = SystemParamCache.getUrlHttpGpsReal();
  114 + list = new ArrayList<>();
  115 + httpClient = HttpClients.createDefault();
  116 + get = new HttpGet(url);
  117 + requestConfig = RequestConfig.custom()
  118 + .setConnectTimeout(2500).setConnectionRequestTimeout(2000)
  119 + .setSocketTimeout(2500).build();
  120 + get.setConfig(requestConfig);
  121 + }
  122 +}
... ...
src/main/java/com/bsth/data/gpsdata_v2/load/SocketClientLoader.java
1   -package com.bsth.data.gpsdata_v2.load;
2   -
3   -import com.alibaba.fastjson.JSON;
4   -import com.bsth.data.BasicData;
5   -import com.bsth.data.SystemParamCache;
6   -import com.bsth.data.gpsdata_v2.entity.GpsEntity;
7   -import com.bsth.data.gpsdata_v2.utils.GpsDataUtils;
8   -import org.apache.http.HttpEntity;
9   -import org.apache.http.client.config.RequestConfig;
10   -import org.apache.http.client.methods.CloseableHttpResponse;
11   -import org.apache.http.client.methods.HttpGet;
12   -import org.apache.http.impl.client.CloseableHttpClient;
13   -import org.apache.http.impl.client.HttpClients;
14   -import org.slf4j.Logger;
15   -import org.slf4j.LoggerFactory;
16   -import org.springframework.beans.factory.InitializingBean;
17   -import org.springframework.stereotype.Component;
18   -
19   -import java.io.BufferedReader;
20   -import java.io.InputStreamReader;
21   -import java.util.ArrayList;
22   -import java.util.List;
23   -
24   -/**
25   - * 从专用的socket client 加载数据
26   - * Created by panzhao on 2017/11/15.
27   - */
28   -@Component
29   -public class SocketClientLoader implements InitializingBean {
30   -
31   - static Logger logger = LoggerFactory.getLogger(SocketClientLoader.class);
32   -
33   - static String url;
34   - static List<GpsEntity> list;
35   - static CloseableHttpClient httpClient = null;
36   - static HttpGet get;
37   - static RequestConfig requestConfig;
38   - static CloseableHttpResponse response;
39   - static HttpEntity entity;
40   - static BufferedReader br;
41   -
42   - public static List<GpsEntity> load(){
43   - try {
44   - if(list.size() > 0)
45   - list.clear();
46   - logger.info("load start...");
47   - response = httpClient.execute(get);
48   - entity = response.getEntity();
49   - if(null == entity)
50   - return list;
51   -
52   - br = new BufferedReader(new InputStreamReader(entity.getContent()));
53   - StringBuilder sb = new StringBuilder();
54   - String str;
55   - while ((str = br.readLine()) != null)
56   - sb.append(str);
57   -
58   - list = JSON.parseArray(sb.toString(), GpsEntity.class);
59   -
60   - logger.info("load end ! size: " + list.size());
61   - //过滤掉无效的点位
62   - list = GpsDataUtils.clearInvalid(list);
63   -
64   - for (GpsEntity gps : list) {
65   - gps.setNbbm(BasicData.deviceId2NbbmMap.get(gps.getDeviceId()));
66   - }
67   -
68   - if (null != response)
69   - response.close();
70   - } catch (Exception e) {
71   - logger.error("", e);
72   - }
73   -
74   - return list;
75   - }
76   -
77   - @Override
78   - public void afterPropertiesSet() throws Exception {
79   - url = SystemParamCache.getUrlHttpGpsRealCache();
80   - list = new ArrayList<>();
81   - httpClient = HttpClients.createDefault();
82   - get = new HttpGet(url);
83   - requestConfig = RequestConfig.custom()
84   - .setConnectTimeout(2500).setConnectionRequestTimeout(2000)
85   - .setSocketTimeout(2500).build();
86   - get.setConfig(requestConfig);
87   - }
88   -}
  1 +package com.bsth.data.gpsdata_v2.load;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.bsth.data.BasicData;
  5 +import com.bsth.data.SystemParamCache;
  6 +import com.bsth.data.gpsdata_v2.entity.GpsEntity;
  7 +import com.bsth.data.gpsdata_v2.utils.GpsDataUtils;
  8 +import org.apache.http.HttpEntity;
  9 +import org.apache.http.client.config.RequestConfig;
  10 +import org.apache.http.client.methods.CloseableHttpResponse;
  11 +import org.apache.http.client.methods.HttpGet;
  12 +import org.apache.http.impl.client.CloseableHttpClient;
  13 +import org.apache.http.impl.client.HttpClients;
  14 +import org.slf4j.Logger;
  15 +import org.slf4j.LoggerFactory;
  16 +import org.springframework.beans.factory.InitializingBean;
  17 +import org.springframework.stereotype.Component;
  18 +
  19 +import java.io.BufferedReader;
  20 +import java.io.InputStreamReader;
  21 +import java.util.ArrayList;
  22 +import java.util.List;
  23 +
  24 +/**
  25 + * 从专用的socket client 加载数据
  26 + * Created by panzhao on 2017/11/15.
  27 + */
  28 +@Component
  29 +public class SocketClientLoader implements InitializingBean {
  30 +
  31 + static Logger logger = LoggerFactory.getLogger(SocketClientLoader.class);
  32 +
  33 + static String url;
  34 + static List<GpsEntity> list;
  35 + static CloseableHttpClient httpClient = null;
  36 + static HttpGet get;
  37 + static RequestConfig requestConfig;
  38 + static CloseableHttpResponse response;
  39 + static HttpEntity entity;
  40 + static BufferedReader br;
  41 +
  42 + public static List<GpsEntity> load(){
  43 + try {
  44 + if(list.size() > 0)
  45 + list.clear();
  46 + logger.info("load start...");
  47 + response = httpClient.execute(get);
  48 + entity = response.getEntity();
  49 + if(null == entity)
  50 + return list;
  51 +
  52 + br = new BufferedReader(new InputStreamReader(entity.getContent()));
  53 + StringBuilder sb = new StringBuilder();
  54 + String str;
  55 + while ((str = br.readLine()) != null)
  56 + sb.append(str);
  57 +
  58 + list = JSON.parseArray(sb.toString(), GpsEntity.class);
  59 +
  60 + logger.info("load end ! size: " + list.size());
  61 + //过滤掉无效的点位
  62 + list = GpsDataUtils.clearInvalid(list);
  63 +
  64 + for (GpsEntity gps : list) {
  65 + gps.setNbbm(BasicData.deviceId2NbbmMap.get(gps.getDeviceId()));
  66 + }
  67 +
  68 + if (null != response)
  69 + response.close();
  70 + } catch (Exception e) {
  71 + logger.error("", e);
  72 + }
  73 +
  74 + return list;
  75 + }
  76 +
  77 + @Override
  78 + public void afterPropertiesSet() throws Exception {
  79 + url = SystemParamCache.getUrlHttpGpsRealCache();
  80 + list = new ArrayList<>();
  81 + httpClient = HttpClients.createDefault();
  82 + get = new HttpGet(url);
  83 + requestConfig = RequestConfig.custom()
  84 + .setConnectTimeout(2500).setConnectionRequestTimeout(2000)
  85 + .setSocketTimeout(2500).build();
  86 + get.setConfig(requestConfig);
  87 + }
  88 +}
... ...
src/main/java/com/bsth/data/maintenance_plan/MtPlanDataLoadThread.java
1   -package com.bsth.data.maintenance_plan;
2   -
3   -import com.bsth.data.SystemParamCache;
4   -import com.fasterxml.jackson.databind.ObjectMapper;
5   -import org.apache.http.HttpEntity;
6   -import org.apache.http.client.config.RequestConfig;
7   -import org.apache.http.client.methods.CloseableHttpResponse;
8   -import org.apache.http.client.methods.HttpGet;
9   -import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
10   -import org.apache.http.impl.client.CloseableHttpClient;
11   -import org.apache.http.impl.client.HttpClients;
12   -import org.joda.time.DateTime;
13   -import org.slf4j.Logger;
14   -import org.slf4j.LoggerFactory;
15   -import org.springframework.beans.factory.InitializingBean;
16   -import org.springframework.beans.factory.annotation.Autowired;
17   -import org.springframework.beans.factory.annotation.Value;
18   -import org.springframework.stereotype.Component;
19   -
20   -import javax.net.ssl.*;
21   -import java.io.BufferedReader;
22   -import java.io.InputStreamReader;
23   -import java.security.cert.CertificateException;
24   -import java.security.cert.X509Certificate;
25   -import java.util.List;
26   -import java.util.Map;
27   -
28   -/**
29   - * 维修保养计划
30   - * @author Hill
31   - */
32   -@Component
33   -public class MtPlanDataLoadThread extends Thread implements InitializingBean {
34   -
35   - private Logger logger = LoggerFactory.getLogger(this.getClass());
36   -
37   - private String url = SystemParamCache.getUrlHttpMaintenance();
38   - private CloseableHttpClient httpClient;
39   - private RequestConfig requestConfig;
40   - private CloseableHttpResponse response;
41   - private HttpEntity entity;
42   - private BufferedReader br;
43   -
44   - private final static String HTTPS = "https://";
45   -
46   - private SSLConnectionSocketFactory sslConnectionSocketFactory;
47   -
48   - @Autowired
49   - private ObjectMapper objectMapper;
50   -
51   - public CloseableHttpClient defaultHttpClient(String url) {
52   - if (url.startsWith(HTTPS)) {
53   - return HttpClients.custom().setSSLSocketFactory(sslConnectionSocketFactory).build();
54   - }
55   - return HttpClients.createDefault();
56   - }
57   -
58   - @Override
59   - public void run() {
60   - logger.warn("维修保养计划获取数据开始");
61   - List<MaintenancePlan> list;
62   - StringBuilder sb = new StringBuilder(url);
63   - try {
64   - HttpGet get = new HttpGet(sb.append("?date=").append(new DateTime().toString("yyyy-MM-dd")).toString());
65   - get.setConfig(requestConfig);
66   - response = httpClient.execute(get);
67   -
68   - int statusCode = response.getStatusLine().getStatusCode();
69   - if(statusCode != 200){
70   - logger.error("http client status code: " + statusCode);
71   - }
72   -
73   - entity = response.getEntity();
74   - if (null != entity) {
75   - br = new BufferedReader(new InputStreamReader(entity.getContent()));
76   - StringBuffer stringBuffer = new StringBuffer();
77   - String str = "";
78   - while ((str = br.readLine()) != null) {
79   - stringBuffer.append(str);
80   - }
81   -
82   - //stringBuffer = new StringBuffer("{\"result\": [{\"gsmc\": \"杨高公司\", \"zbh\": \"S01-002\", \"bysj\": 1663171200000, \"bydj\": \"一级保养\", \"bydd\": \"成山路\"}], \"msg\": \"成功\", \"code\": \"200\", \"success\": true}");
83   - Map map = objectMapper.readValue(stringBuffer.toString(), Map.class);
84   - list = objectMapper.readValue(objectMapper.writeValueAsString(map.get("result")), objectMapper.getTypeFactory().constructParametricType(List.class, MaintenancePlan.class));
85   -
86   - for (MaintenancePlan sd : list) {
87   - MtPlanCenter.put(sd);
88   - }
89   - }
90   -
91   - if (null != response)
92   - response.close();
93   - } catch (Exception e) {
94   - logger.error("维修保养计划接口报错了", e);
95   - }
96   - logger.warn("维修保养计划获取数据结束");
97   - }
98   -
99   - @Override
100   - public void afterPropertiesSet() throws Exception {
101   - try {
102   - SSLContext sslCtx = SSLContext.getInstance("TLSv1.2");
103   - sslCtx.init(null, new TrustManager[] {
104   - new X509TrustManager() {
105   - @Override
106   - public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
107   - }
108   -
109   - @Override
110   - public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
111   - }
112   -
113   - @Override
114   - public X509Certificate[] getAcceptedIssuers() {
115   - return null;
116   - }
117   - }
118   - }, null);
119   - sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslCtx, new HostnameVerifier() {
120   -
121   - @Override
122   - public boolean verify(String hostname, SSLSession session) {
123   - // TODO Auto-generated method stub
124   - return true;
125   - }
126   - });
127   - } catch (Exception e) {
128   - logger.error("SSL context set fail: {}", e);
129   - }
130   -
131   - httpClient = defaultHttpClient(url);
132   -
133   - requestConfig = RequestConfig.custom()
134   - .setConnectTimeout(5500).setConnectionRequestTimeout(5000)
135   - .setSocketTimeout(5500).build();
136   - }
137   -}
  1 +package com.bsth.data.maintenance_plan;
  2 +
  3 +import com.bsth.data.SystemParamCache;
  4 +import com.fasterxml.jackson.databind.ObjectMapper;
  5 +import org.apache.http.HttpEntity;
  6 +import org.apache.http.client.config.RequestConfig;
  7 +import org.apache.http.client.methods.CloseableHttpResponse;
  8 +import org.apache.http.client.methods.HttpGet;
  9 +import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
  10 +import org.apache.http.impl.client.CloseableHttpClient;
  11 +import org.apache.http.impl.client.HttpClients;
  12 +import org.joda.time.DateTime;
  13 +import org.slf4j.Logger;
  14 +import org.slf4j.LoggerFactory;
  15 +import org.springframework.beans.factory.InitializingBean;
  16 +import org.springframework.beans.factory.annotation.Autowired;
  17 +import org.springframework.beans.factory.annotation.Value;
  18 +import org.springframework.stereotype.Component;
  19 +
  20 +import javax.net.ssl.*;
  21 +import java.io.BufferedReader;
  22 +import java.io.InputStreamReader;
  23 +import java.security.cert.CertificateException;
  24 +import java.security.cert.X509Certificate;
  25 +import java.util.List;
  26 +import java.util.Map;
  27 +
  28 +/**
  29 + * 维修保养计划
  30 + * @author Hill
  31 + */
  32 +@Component
  33 +public class MtPlanDataLoadThread extends Thread implements InitializingBean {
  34 +
  35 + private Logger logger = LoggerFactory.getLogger(this.getClass());
  36 +
  37 + private String url = SystemParamCache.getUrlHttpMaintenance();
  38 + private CloseableHttpClient httpClient;
  39 + private RequestConfig requestConfig;
  40 + private CloseableHttpResponse response;
  41 + private HttpEntity entity;
  42 + private BufferedReader br;
  43 +
  44 + private final static String HTTPS = "https://";
  45 +
  46 + private SSLConnectionSocketFactory sslConnectionSocketFactory;
  47 +
  48 + @Autowired
  49 + private ObjectMapper objectMapper;
  50 +
  51 + public CloseableHttpClient defaultHttpClient(String url) {
  52 + if (url.startsWith(HTTPS)) {
  53 + return HttpClients.custom().setSSLSocketFactory(sslConnectionSocketFactory).build();
  54 + }
  55 + return HttpClients.createDefault();
  56 + }
  57 +
  58 + @Override
  59 + public void run() {
  60 + logger.warn("维修保养计划获取数据开始");
  61 + List<MaintenancePlan> list;
  62 + StringBuilder sb = new StringBuilder(url);
  63 + try {
  64 + HttpGet get = new HttpGet(sb.append("?date=").append(new DateTime().toString("yyyy-MM-dd")).toString());
  65 + get.setConfig(requestConfig);
  66 + response = httpClient.execute(get);
  67 +
  68 + int statusCode = response.getStatusLine().getStatusCode();
  69 + if(statusCode != 200){
  70 + logger.error("http client status code: " + statusCode);
  71 + }
  72 +
  73 + entity = response.getEntity();
  74 + if (null != entity) {
  75 + br = new BufferedReader(new InputStreamReader(entity.getContent()));
  76 + StringBuffer stringBuffer = new StringBuffer();
  77 + String str = "";
  78 + while ((str = br.readLine()) != null) {
  79 + stringBuffer.append(str);
  80 + }
  81 +
  82 + //stringBuffer = new StringBuffer("{\"result\": [{\"gsmc\": \"杨高公司\", \"zbh\": \"S01-002\", \"bysj\": 1663171200000, \"bydj\": \"一级保养\", \"bydd\": \"成山路\"}], \"msg\": \"成功\", \"code\": \"200\", \"success\": true}");
  83 + Map map = objectMapper.readValue(stringBuffer.toString(), Map.class);
  84 + list = objectMapper.readValue(objectMapper.writeValueAsString(map.get("result")), objectMapper.getTypeFactory().constructParametricType(List.class, MaintenancePlan.class));
  85 +
  86 + for (MaintenancePlan sd : list) {
  87 + MtPlanCenter.put(sd);
  88 + }
  89 + }
  90 +
  91 + if (null != response)
  92 + response.close();
  93 + } catch (Exception e) {
  94 + logger.error("维修保养计划接口报错了", e);
  95 + }
  96 + logger.warn("维修保养计划获取数据结束");
  97 + }
  98 +
  99 + @Override
  100 + public void afterPropertiesSet() throws Exception {
  101 + try {
  102 + SSLContext sslCtx = SSLContext.getInstance("TLSv1.2");
  103 + sslCtx.init(null, new TrustManager[] {
  104 + new X509TrustManager() {
  105 + @Override
  106 + public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
  107 + }
  108 +
  109 + @Override
  110 + public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
  111 + }
  112 +
  113 + @Override
  114 + public X509Certificate[] getAcceptedIssuers() {
  115 + return null;
  116 + }
  117 + }
  118 + }, null);
  119 + sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslCtx, new HostnameVerifier() {
  120 +
  121 + @Override
  122 + public boolean verify(String hostname, SSLSession session) {
  123 + // TODO Auto-generated method stub
  124 + return true;
  125 + }
  126 + });
  127 + } catch (Exception e) {
  128 + logger.error("SSL context set fail: {}", e);
  129 + }
  130 +
  131 + httpClient = defaultHttpClient(url);
  132 +
  133 + requestConfig = RequestConfig.custom()
  134 + .setConnectTimeout(5500).setConnectionRequestTimeout(5000)
  135 + .setSocketTimeout(5500).build();
  136 + }
  137 +}
... ...
src/main/java/com/bsth/entity/oil/Dlb.java
1   -package com.bsth.entity.oil;
2   -
3   -import java.text.DecimalFormat;
4   -import java.util.Date;
5   -
6   -import javax.persistence.*;
7   -
8   -import org.springframework.format.annotation.DateTimeFormat;
9   -
10   -import com.bsth.data.BasicData;
11   -
12   -@Entity
13   -@Table(name = "bsth_c_dlb")
14   -public class Dlb {
15   - @Id
16   - @GeneratedValue(strategy = GenerationType.IDENTITY)
17   - private Integer id;
18   - @DateTimeFormat(pattern="yyyy-MM-dd")
19   - private Date rq;
20   - private String xlbm;
21   - private String linename;
22   - private String ssgsdm;
23   - private String fgsdm;
24   - private String nbbm;
25   - private String jsy;
26   - private Double czlc=0.0;
27   - private Double jzlc=0.0;
28   - //出站存电
29   - private Double czcd=0.0;
30   - //进站存电
31   - private Double jzcd=0.0;
32   - //充电量
33   - private Double cdl;
34   - private int sfkt;
35   - private String jhsj;
36   - //耗电
37   - private Double hd=0.0;
38   - private Double sh=0.0;
39   - private String shyy;
40   - private Double zlc=0.0;
41   - private int yhlx;
42   -
43   - private Double ns=0.0;
44   - private Double fyylc=0.0;
45   - private Double jhzlc=0.0;
46   - private Double jhfyylc=0.0;
47   - private int jhzbc;
48   - private int jhbc;
49   - private int sjzbc;
50   - private int sjbc;
51   - private String edituser;
52   - private Date edittime;
53   - private Date createtime;
54   - private Date updatetime;
55   - private int nylx;
56   - //进场顺序(根据最先出场和最后进场来关联车辆的存电量)
57   - private int jcsx;
58   -
59   - private String jname;
60   - @Transient
61   - private String name;
62   - @Transient
63   - private String bglyh;
64   -
65   - @Transient
66   - private String xlname;
67   -
68   - @Transient
69   - private String gsname;
70   -
71   - @Transient
72   - private String fgsname;
73   -
74   -
75   -
76   - private String lp;
77   -
78   - public Integer getId() {
79   - return id;
80   - }
81   -
82   - public void setId(Integer id) {
83   - this.id = id;
84   - }
85   -
86   - public Date getRq() {
87   - return rq;
88   - }
89   -
90   - public void setRq(Date rq) {
91   - this.rq = rq;
92   - }
93   -
94   - public String getXlbm() {
95   - return xlbm;
96   - }
97   -
98   - public void setXlbm(String xlbm) {
99   - this.xlbm = xlbm;
100   - }
101   -
102   - public String getLinename() {
103   - return linename;
104   - }
105   -
106   - public void setLinename(String linename) {
107   - this.linename = linename;
108   - }
109   -
110   - public String getSsgsdm() {
111   - return ssgsdm;
112   - }
113   -
114   - public void setSsgsdm(String ssgsdm) {
115   - this.ssgsdm = ssgsdm;
116   - }
117   -
118   - public String getFgsdm() {
119   - return fgsdm;
120   - }
121   -
122   - public void setFgsdm(String fgsdm) {
123   - this.fgsdm = fgsdm;
124   - }
125   -
126   - public String getNbbm() {
127   - return nbbm;
128   - }
129   -
130   - public void setNbbm(String nbbm) {
131   - this.nbbm = nbbm;
132   - }
133   -
134   - public String getJsy() {
135   - return jsy;
136   - }
137   -
138   - public void setJsy(String jsy) {
139   - this.jsy = jsy;
140   - }
141   -
142   - public Double getCzlc() {
143   - return czlc;
144   - }
145   -
146   - public void setCzlc(Double czlc) {
147   - this.czlc = czlc;
148   - }
149   -
150   - public Double getJzlc() {
151   - return jzlc;
152   - }
153   -
154   - public void setJzlc(Double jzlc) {
155   - this.jzlc = jzlc;
156   - }
157   -
158   - public Double getCzcd() {
159   - return czcd;
160   - }
161   -
162   - public void setCzcd(Double czcd) {
163   - this.czcd = czcd;
164   - }
165   -
166   - public Double getJzcd() {
167   - return jzcd;
168   - }
169   -
170   - public void setJzcd(Double jzcd) {
171   - this.jzcd = jzcd;
172   - }
173   -
174   - public Double getCdl() {
175   - return cdl;
176   - }
177   -
178   - public void setCdl(Double cdl) {
179   - this.cdl = cdl;
180   - }
181   -
182   - public int getSfkt() {
183   - return sfkt;
184   - }
185   -
186   - public void setSfkt(int sfkt) {
187   - this.sfkt = sfkt;
188   - }
189   -
190   - public String getJhsj() {
191   - return jhsj;
192   - }
193   -
194   - public void setJhsj(String jhsj) {
195   - this.jhsj = jhsj;
196   - }
197   -
198   - public Double getHd() {
199   - return hd;
200   - }
201   -
202   - public void setHd(Double hd) {
203   - this.hd = hd;
204   - }
205   -
206   - public Double getSh() {
207   - return sh;
208   - }
209   -
210   - public void setSh(Double sh) {
211   - this.sh = sh;
212   - }
213   -
214   - public String getShyy() {
215   - return shyy;
216   - }
217   -
218   - public void setShyy(String shyy) {
219   - this.shyy = shyy;
220   - }
221   -
222   - public Double getZlc() {
223   - return zlc;
224   - }
225   -
226   - public void setZlc(Double zlc) {
227   - this.zlc = zlc;
228   - }
229   -
230   - public int getYhlx() {
231   - return yhlx;
232   - }
233   -
234   - public void setYhlx(int yhlx) {
235   - this.yhlx = yhlx;
236   - }
237   -
238   - public Double getNs() {
239   - return ns;
240   - }
241   -
242   - public void setNs(Double ns) {
243   - this.ns = ns;
244   - }
245   -
246   - public Double getFyylc() {
247   - return fyylc;
248   - }
249   -
250   - public void setFyylc(Double fyylc) {
251   - this.fyylc = fyylc;
252   - }
253   -
254   - public Double getJhzlc() {
255   - return jhzlc;
256   - }
257   -
258   - public void setJhzlc(Double jhzlc) {
259   - this.jhzlc = jhzlc;
260   - }
261   -
262   - public Double getJhfyylc() {
263   - return jhfyylc;
264   - }
265   -
266   - public void setJhfyylc(Double jhfyylc) {
267   - this.jhfyylc = jhfyylc;
268   - }
269   -
270   - public int getJhzbc() {
271   - return jhzbc;
272   - }
273   -
274   - public void setJhzbc(int jhzbc) {
275   - this.jhzbc = jhzbc;
276   - }
277   -
278   - public int getJhbc() {
279   - return jhbc;
280   - }
281   -
282   - public void setJhbc(int jhbc) {
283   - this.jhbc = jhbc;
284   - }
285   -
286   - public int getSjzbc() {
287   - return sjzbc;
288   - }
289   -
290   - public void setSjzbc(int sjzbc) {
291   - this.sjzbc = sjzbc;
292   - }
293   -
294   - public int getSjbc() {
295   - return sjbc;
296   - }
297   -
298   - public void setSjbc(int sjbc) {
299   - this.sjbc = sjbc;
300   - }
301   -
302   - public String getEdituser() {
303   - return edituser;
304   - }
305   -
306   - public void setEdituser(String edituser) {
307   - this.edituser = edituser;
308   - }
309   -
310   - public Date getEdittime() {
311   - return edittime;
312   - }
313   -
314   - public void setEdittime(Date edittime) {
315   - this.edittime = edittime;
316   - }
317   -
318   - public Date getCreatetime() {
319   - return createtime;
320   - }
321   -
322   - public void setCreatetime(Date createtime) {
323   - this.createtime = createtime;
324   - }
325   -
326   - public int getNylx() {
327   - return nylx;
328   - }
329   -
330   - public void setNylx(int nylx) {
331   - this.nylx = nylx;
332   - }
333   -
334   - public int getJcsx() {
335   - return jcsx;
336   - }
337   -
338   - public void setJcsx(int jcsx) {
339   - this.jcsx = jcsx;
340   - }
341   -
342   - public String getBglyh() {
343   - if(this.getZlc()==0){
344   - return "0";
345   - }else{
346   - DecimalFormat df = new DecimalFormat("0.00");
347   - return df.format(this.getHd()/this.getZlc()*100);
348   - }
349   - }
350   -
351   - public void setBglyh(String bglyh) {
352   - this.bglyh = bglyh;
353   - }
354   -
355   - public String getXlname() {
356   - return BasicData.lineCodeAllNameMap.get(this.xlbm);
357   - }
358   -
359   - public void setXlname(String xlname) {
360   - this.xlname = xlname;
361   - }
362   -
363   - public String getGsname() {
364   - return BasicData.businessCodeNameMap.get(this.ssgsdm);
365   - }
366   -
367   - public void setGsname(String gsname) {
368   - this.gsname = gsname;
369   - }
370   -
371   - public String getName() {
372   - return BasicData.allPerson.get(this.ssgsdm+"-"+this.jsy);
373   - }
374   -
375   - public void setName(String name) {
376   - this.name = name;
377   - }
378   -
379   - public String getFgsname() {
380   - return BasicData.businessFgsCodeNameMap.get(this.fgsdm+"_"+this.ssgsdm);
381   - }
382   -
383   - public void setFgsname(String fgsname) {
384   - this.fgsname = fgsname;
385   - }
386   -
387   - public Date getUpdatetime() {
388   - return updatetime;
389   - }
390   -
391   - public void setUpdatetime(Date updatetime) {
392   - this.updatetime = updatetime;
393   - }
394   -
395   - public String getLp() {
396   - return lp;
397   - }
398   -
399   - public void setLp(String lp) {
400   - this.lp = lp;
401   - }
402   -
403   - public String getJname() {
404   - return jname;
405   - }
406   -
407   - public void setJname(String jname) {
408   - this.jname = jname;
409   - }
410   -
411   -
412   -
413   -}
  1 +package com.bsth.entity.oil;
  2 +
  3 +import java.text.DecimalFormat;
  4 +import java.util.Date;
  5 +
  6 +import javax.persistence.*;
  7 +
  8 +import org.springframework.format.annotation.DateTimeFormat;
  9 +
  10 +import com.bsth.data.BasicData;
  11 +
  12 +@Entity
  13 +@Table(name = "bsth_c_dlb")
  14 +public class Dlb {
  15 + @Id
  16 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  17 + private Integer id;
  18 + @DateTimeFormat(pattern="yyyy-MM-dd")
  19 + private Date rq;
  20 + private String xlbm;
  21 + private String linename;
  22 + private String ssgsdm;
  23 + private String fgsdm;
  24 + private String nbbm;
  25 + private String jsy;
  26 + private Double czlc=0.0;
  27 + private Double jzlc=0.0;
  28 + //出站存电
  29 + private Double czcd=0.0;
  30 + //进站存电
  31 + private Double jzcd=0.0;
  32 + //充电量
  33 + private Double cdl;
  34 + private int sfkt;
  35 + private String jhsj;
  36 + //耗电
  37 + private Double hd=0.0;
  38 + private Double sh=0.0;
  39 + private String shyy;
  40 + private Double zlc=0.0;
  41 + private int yhlx;
  42 +
  43 + private Double ns=0.0;
  44 + private Double fyylc=0.0;
  45 + private Double jhzlc=0.0;
  46 + private Double jhfyylc=0.0;
  47 + private int jhzbc;
  48 + private int jhbc;
  49 + private int sjzbc;
  50 + private int sjbc;
  51 + private String edituser;
  52 + private Date edittime;
  53 + private Date createtime;
  54 + private Date updatetime;
  55 + private int nylx;
  56 + //进场顺序(根据最先出场和最后进场来关联车辆的存电量)
  57 + private int jcsx;
  58 +
  59 + private String jname;
  60 + @Transient
  61 + private String name;
  62 + @Transient
  63 + private String bglyh;
  64 +
  65 + @Transient
  66 + private String xlname;
  67 +
  68 + @Transient
  69 + private String gsname;
  70 +
  71 + @Transient
  72 + private String fgsname;
  73 +
  74 +
  75 +
  76 + private String lp;
  77 +
  78 + public Integer getId() {
  79 + return id;
  80 + }
  81 +
  82 + public void setId(Integer id) {
  83 + this.id = id;
  84 + }
  85 +
  86 + public Date getRq() {
  87 + return rq;
  88 + }
  89 +
  90 + public void setRq(Date rq) {
  91 + this.rq = rq;
  92 + }
  93 +
  94 + public String getXlbm() {
  95 + return xlbm;
  96 + }
  97 +
  98 + public void setXlbm(String xlbm) {
  99 + this.xlbm = xlbm;
  100 + }
  101 +
  102 + public String getLinename() {
  103 + return linename;
  104 + }
  105 +
  106 + public void setLinename(String linename) {
  107 + this.linename = linename;
  108 + }
  109 +
  110 + public String getSsgsdm() {
  111 + return ssgsdm;
  112 + }
  113 +
  114 + public void setSsgsdm(String ssgsdm) {
  115 + this.ssgsdm = ssgsdm;
  116 + }
  117 +
  118 + public String getFgsdm() {
  119 + return fgsdm;
  120 + }
  121 +
  122 + public void setFgsdm(String fgsdm) {
  123 + this.fgsdm = fgsdm;
  124 + }
  125 +
  126 + public String getNbbm() {
  127 + return nbbm;
  128 + }
  129 +
  130 + public void setNbbm(String nbbm) {
  131 + this.nbbm = nbbm;
  132 + }
  133 +
  134 + public String getJsy() {
  135 + return jsy;
  136 + }
  137 +
  138 + public void setJsy(String jsy) {
  139 + this.jsy = jsy;
  140 + }
  141 +
  142 + public Double getCzlc() {
  143 + return czlc;
  144 + }
  145 +
  146 + public void setCzlc(Double czlc) {
  147 + this.czlc = czlc;
  148 + }
  149 +
  150 + public Double getJzlc() {
  151 + return jzlc;
  152 + }
  153 +
  154 + public void setJzlc(Double jzlc) {
  155 + this.jzlc = jzlc;
  156 + }
  157 +
  158 + public Double getCzcd() {
  159 + return czcd;
  160 + }
  161 +
  162 + public void setCzcd(Double czcd) {
  163 + this.czcd = czcd;
  164 + }
  165 +
  166 + public Double getJzcd() {
  167 + return jzcd;
  168 + }
  169 +
  170 + public void setJzcd(Double jzcd) {
  171 + this.jzcd = jzcd;
  172 + }
  173 +
  174 + public Double getCdl() {
  175 + return cdl;
  176 + }
  177 +
  178 + public void setCdl(Double cdl) {
  179 + this.cdl = cdl;
  180 + }
  181 +
  182 + public int getSfkt() {
  183 + return sfkt;
  184 + }
  185 +
  186 + public void setSfkt(int sfkt) {
  187 + this.sfkt = sfkt;
  188 + }
  189 +
  190 + public String getJhsj() {
  191 + return jhsj;
  192 + }
  193 +
  194 + public void setJhsj(String jhsj) {
  195 + this.jhsj = jhsj;
  196 + }
  197 +
  198 + public Double getHd() {
  199 + return hd;
  200 + }
  201 +
  202 + public void setHd(Double hd) {
  203 + this.hd = hd;
  204 + }
  205 +
  206 + public Double getSh() {
  207 + return sh;
  208 + }
  209 +
  210 + public void setSh(Double sh) {
  211 + this.sh = sh;
  212 + }
  213 +
  214 + public String getShyy() {
  215 + return shyy;
  216 + }
  217 +
  218 + public void setShyy(String shyy) {
  219 + this.shyy = shyy;
  220 + }
  221 +
  222 + public Double getZlc() {
  223 + return zlc;
  224 + }
  225 +
  226 + public void setZlc(Double zlc) {
  227 + this.zlc = zlc;
  228 + }
  229 +
  230 + public int getYhlx() {
  231 + return yhlx;
  232 + }
  233 +
  234 + public void setYhlx(int yhlx) {
  235 + this.yhlx = yhlx;
  236 + }
  237 +
  238 + public Double getNs() {
  239 + return ns;
  240 + }
  241 +
  242 + public void setNs(Double ns) {
  243 + this.ns = ns;
  244 + }
  245 +
  246 + public Double getFyylc() {
  247 + return fyylc;
  248 + }
  249 +
  250 + public void setFyylc(Double fyylc) {
  251 + this.fyylc = fyylc;
  252 + }
  253 +
  254 + public Double getJhzlc() {
  255 + return jhzlc;
  256 + }
  257 +
  258 + public void setJhzlc(Double jhzlc) {
  259 + this.jhzlc = jhzlc;
  260 + }
  261 +
  262 + public Double getJhfyylc() {
  263 + return jhfyylc;
  264 + }
  265 +
  266 + public void setJhfyylc(Double jhfyylc) {
  267 + this.jhfyylc = jhfyylc;
  268 + }
  269 +
  270 + public int getJhzbc() {
  271 + return jhzbc;
  272 + }
  273 +
  274 + public void setJhzbc(int jhzbc) {
  275 + this.jhzbc = jhzbc;
  276 + }
  277 +
  278 + public int getJhbc() {
  279 + return jhbc;
  280 + }
  281 +
  282 + public void setJhbc(int jhbc) {
  283 + this.jhbc = jhbc;
  284 + }
  285 +
  286 + public int getSjzbc() {
  287 + return sjzbc;
  288 + }
  289 +
  290 + public void setSjzbc(int sjzbc) {
  291 + this.sjzbc = sjzbc;
  292 + }
  293 +
  294 + public int getSjbc() {
  295 + return sjbc;
  296 + }
  297 +
  298 + public void setSjbc(int sjbc) {
  299 + this.sjbc = sjbc;
  300 + }
  301 +
  302 + public String getEdituser() {
  303 + return edituser;
  304 + }
  305 +
  306 + public void setEdituser(String edituser) {
  307 + this.edituser = edituser;
  308 + }
  309 +
  310 + public Date getEdittime() {
  311 + return edittime;
  312 + }
  313 +
  314 + public void setEdittime(Date edittime) {
  315 + this.edittime = edittime;
  316 + }
  317 +
  318 + public Date getCreatetime() {
  319 + return createtime;
  320 + }
  321 +
  322 + public void setCreatetime(Date createtime) {
  323 + this.createtime = createtime;
  324 + }
  325 +
  326 + public int getNylx() {
  327 + return nylx;
  328 + }
  329 +
  330 + public void setNylx(int nylx) {
  331 + this.nylx = nylx;
  332 + }
  333 +
  334 + public int getJcsx() {
  335 + return jcsx;
  336 + }
  337 +
  338 + public void setJcsx(int jcsx) {
  339 + this.jcsx = jcsx;
  340 + }
  341 +
  342 + public String getBglyh() {
  343 + if(this.getZlc()==0){
  344 + return "0";
  345 + }else{
  346 + DecimalFormat df = new DecimalFormat("0.000");
  347 + return df.format(this.getHd()/this.getZlc()*100);
  348 + }
  349 + }
  350 +
  351 + public void setBglyh(String bglyh) {
  352 + this.bglyh = bglyh;
  353 + }
  354 +
  355 + public String getXlname() {
  356 + return BasicData.lineCodeAllNameMap.get(this.xlbm);
  357 + }
  358 +
  359 + public void setXlname(String xlname) {
  360 + this.xlname = xlname;
  361 + }
  362 +
  363 + public String getGsname() {
  364 + return BasicData.businessCodeNameMap.get(this.ssgsdm);
  365 + }
  366 +
  367 + public void setGsname(String gsname) {
  368 + this.gsname = gsname;
  369 + }
  370 +
  371 + public String getName() {
  372 + return BasicData.allPerson.get(this.ssgsdm+"-"+this.jsy);
  373 + }
  374 +
  375 + public void setName(String name) {
  376 + this.name = name;
  377 + }
  378 +
  379 + public String getFgsname() {
  380 + return BasicData.businessFgsCodeNameMap.get(this.fgsdm+"_"+this.ssgsdm);
  381 + }
  382 +
  383 + public void setFgsname(String fgsname) {
  384 + this.fgsname = fgsname;
  385 + }
  386 +
  387 + public Date getUpdatetime() {
  388 + return updatetime;
  389 + }
  390 +
  391 + public void setUpdatetime(Date updatetime) {
  392 + this.updatetime = updatetime;
  393 + }
  394 +
  395 + public String getLp() {
  396 + return lp;
  397 + }
  398 +
  399 + public void setLp(String lp) {
  400 + this.lp = lp;
  401 + }
  402 +
  403 + public String getJname() {
  404 + return jname;
  405 + }
  406 +
  407 + public void setJname(String jname) {
  408 + this.jname = jname;
  409 + }
  410 +
  411 +
  412 +
  413 +}
... ...
src/main/java/com/bsth/entity/oil/JdlReception.java 0 → 100644
  1 +package com.bsth.entity.oil;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.GenerationType;
  8 +import javax.persistence.Id;
  9 +import javax.persistence.Table;
  10 +
  11 +import org.springframework.format.annotation.DateTimeFormat;
  12 +
  13 +/**
  14 +--------------------------------------------------------
  15 + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  16 + `station_name` varchar(255) DEFAULT NULL COMMENT '站点名称',
  17 + `connector_id` varchar(255) DEFAULT NULL COMMENT '枪编号',
  18 + `order_no` varchar(255) DEFAULT NULL COMMENT '订单编号',
  19 + `start_time` varchar(255) DEFAULT NULL COMMENT '充电开始时间',
  20 + `end_time` varchar(255) DEFAULT NULL COMMENT '充电结束时间',
  21 + `start_soc` double(11,2) DEFAULT NULL COMMENT '开始 SOC(%)',
  22 + `end_soc` double(11,2) DEFAULT NULL COMMENT '结束 SOC(%)',
  23 + `stop_reason` varchar(255) DEFAULT NULL COMMENT '终止原因',
  24 + `charge_capacity` double(11,3) DEFAULT NULL COMMENT '充电量,单位:度',
  25 + `electric_charge` double(11,2) DEFAULT NULL COMMENT '电费,单位:元',
  26 + `service_charge` double(11,2) DEFAULT NULL COMMENT '服务费,单位:元',
  27 + `total_amount` double(11,2) DEFAULT NULL COMMENT '总费用,单位:元',
  28 + `vin_code` varchar(255) DEFAULT NULL COMMENT '卡号',
  29 + `card_no` varchar(255) DEFAULT NULL COMMENT 'VIN,车架号',
  30 + `car_code` varchar(255) DEFAULT NULL COMMENT '车牌号',
  31 + `date_str` varchar(255) DEFAULT NULL COMMENT '营运日期',
  32 + `origin` int(2) NOT NULL DEFAULT '0' COMMENT '数据源(0:接口获取;1:导入)',
  33 + `sum_time` bigint(11) DEFAULT NULL COMMENT '总计充电时间(分钟)',
  34 + `create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
  35 + `create_date` datetime DEFAULT NULL COMMENT '创建时间',
  36 + `update_by` varchar(255) DEFAULT NULL COMMENT '修改人',
  37 + `update_date` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  38 +*/
  39 +@Entity
  40 +@Table(name = "bsth_c_jdl_reception")
  41 +public class JdlReception {
  42 + @Id
  43 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  44 + private Long id;
  45 + private String stationName;
  46 + private String connectorId;
  47 + private String orderNo;
  48 + private String startTime;
  49 + private String endTime;
  50 + private Double startSoc;
  51 + private Double endSoc;
  52 + private String stopReason;
  53 + private Double chargeCapacity;
  54 + private Double electricCharge;
  55 + private Double serviceCharge;
  56 + private Double totalAmount;
  57 + private String vinCode;
  58 + private String cardNo;
  59 + private String carCode;
  60 + private String dateStr;
  61 + private Integer origin;
  62 + private Integer sumTime;
  63 + private String createBy;
  64 + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
  65 + private Date createDate;
  66 + private String updateBy;
  67 + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
  68 + private Date updateDate;
  69 +
  70 +
  71 + public Long getId() {
  72 + return id;
  73 + }
  74 + public void setId(Long id) {
  75 + this.id = id;
  76 + }
  77 + public String getStationName() {
  78 + return stationName;
  79 + }
  80 + public void setStationName(String stationName) {
  81 + this.stationName = stationName;
  82 + }
  83 + public String getConnectorId() {
  84 + return connectorId;
  85 + }
  86 + public void setConnectorId(String connectorId) {
  87 + this.connectorId = connectorId;
  88 + }
  89 + public String getOrderNo() {
  90 + return orderNo;
  91 + }
  92 + public void setOrderNo(String orderNo) {
  93 + this.orderNo = orderNo;
  94 + }
  95 + public String getStartTime() {
  96 + return startTime;
  97 + }
  98 + public void setStartTime(String startTime) {
  99 + this.startTime = startTime;
  100 + }
  101 + public String getEndTime() {
  102 + return endTime;
  103 + }
  104 + public void setEndTime(String endTime) {
  105 + this.endTime = endTime;
  106 + }
  107 + public Double getStartSoc() {
  108 + return startSoc;
  109 + }
  110 + public void setStartSoc(Double startSoc) {
  111 + this.startSoc = startSoc;
  112 + }
  113 + public Double getEndSoc() {
  114 + return endSoc;
  115 + }
  116 + public void setEndSoc(Double endSoc) {
  117 + this.endSoc = endSoc;
  118 + }
  119 + public String getStopReason() {
  120 + return stopReason;
  121 + }
  122 + public void setStopReason(String stopReason) {
  123 + this.stopReason = stopReason;
  124 + }
  125 + public Double getChargeCapacity() {
  126 + return chargeCapacity;
  127 + }
  128 + public void setChargeCapacity(Double chargeCapacity) {
  129 + this.chargeCapacity = chargeCapacity;
  130 + }
  131 + public Double getElectricCharge() {
  132 + return electricCharge;
  133 + }
  134 + public void setElectricCharge(Double electricCharge) {
  135 + this.electricCharge = electricCharge;
  136 + }
  137 + public Double getServiceCharge() {
  138 + return serviceCharge;
  139 + }
  140 + public void setServiceCharge(Double serviceCharge) {
  141 + this.serviceCharge = serviceCharge;
  142 + }
  143 + public Double getTotalAmount() {
  144 + return totalAmount;
  145 + }
  146 + public void setTotalAmount(Double totalAmount) {
  147 + this.totalAmount = totalAmount;
  148 + }
  149 + public String getVinCode() {
  150 + return vinCode;
  151 + }
  152 + public void setVinCode(String vinCode) {
  153 + this.vinCode = vinCode;
  154 + }
  155 + public String getCardNo() {
  156 + return cardNo;
  157 + }
  158 + public void setCardNo(String cardNo) {
  159 + this.cardNo = cardNo;
  160 + }
  161 + public String getCarCode() {
  162 + return carCode;
  163 + }
  164 + public void setCarCode(String carCode) {
  165 + this.carCode = carCode;
  166 + }
  167 + public String getDateStr() {
  168 + return dateStr;
  169 + }
  170 + public void setDateStr(String dateStr) {
  171 + this.dateStr = dateStr;
  172 + }
  173 + public Integer getOrigin() {
  174 + return origin;
  175 + }
  176 + public void setOrigin(Integer origin) {
  177 + this.origin = origin;
  178 + }
  179 + public Integer getSumTime() {
  180 + return sumTime;
  181 + }
  182 + public void setSumTime(Integer sumTime) {
  183 + this.sumTime = sumTime;
  184 + }
  185 + public String getCreateBy() {
  186 + return createBy;
  187 + }
  188 + public void setCreateBy(String createBy) {
  189 + this.createBy = createBy;
  190 + }
  191 + public Date getCreateDate() {
  192 + return createDate;
  193 + }
  194 + public void setCreateDate(Date createDate) {
  195 + this.createDate = createDate;
  196 + }
  197 + public String getUpdateBy() {
  198 + return updateBy;
  199 + }
  200 + public void setUpdateBy(String updateBy) {
  201 + this.updateBy = updateBy;
  202 + }
  203 + public Date getUpdateDate() {
  204 + return updateDate;
  205 + }
  206 + public void setUpdateDate(Date updateDate) {
  207 + this.updateDate = updateDate;
  208 + }
  209 +
  210 +}
0 211 \ No newline at end of file
... ...
src/main/java/com/bsth/entity/oil/Qlb.java
... ... @@ -348,7 +348,7 @@ public class Qlb {
348 348 if(this.getZlc()==0){
349 349 return "0";
350 350 }else{
351   - DecimalFormat df = new DecimalFormat("0.00");
  351 + DecimalFormat df = new DecimalFormat("0.000");
352 352 return df.format(this.getHn()/this.getZlc()*100);
353 353 }
354 354 }
... ...
src/main/java/com/bsth/entity/oil/Ylb.java
1   -package com.bsth.entity.oil;
2   -
3   -import java.text.DecimalFormat;
4   -import java.util.Date;
5   -
6   -import javax.persistence.*;
7   -
8   -import org.springframework.format.annotation.DateTimeFormat;
9   -
10   -import com.bsth.data.BasicData;
11   -
12   -@Entity
13   -@Table(name = "bsth_c_ylb")
14   -public class Ylb {
15   - @Id
16   - @GeneratedValue(strategy = GenerationType.IDENTITY)
17   - private Integer id;
18   - @DateTimeFormat(pattern="yyyy-MM-dd")
19   - private Date rq;
20   - private String xlbm;
21   - private String linename;
22   - private String ssgsdm;
23   - private String fgsdm;
24   - private String nbbm;
25   - private String jsy;
26   - private String jname;
27   - private Double czlc=0.0;
28   - private Double jzlc=0.0;
29   - private Double czyl=0.0;
30   - private Double jzyl=0.0;
31   - private Double jzl=0.0;
32   - private int sfkt;
33   - private String jhsj;
34   - private Double yh=0.0;
35   - private Double sh=0.0;
36   - private String shyy;
37   - private Double zlc=0.0;
38   - private int yhlx;
39   - private String rylx="0";
40   - private Double ns=0.0;
41   - private Double fyylc=0.0;
42   - private Double jhzlc=0.0;
43   - private Double jhfyylc=0.0;
44   - private int jhzbc;
45   - private int jhbc;
46   - private int sjzbc;
47   - private int sjbc;
48   - private String edituser;
49   - private Date edittime;
50   - private Date updatetime;
51   - private Date createtime;
52   -
53   - private int nylx;
54   - //进场顺序(根据最先出场和最后进场来关联车辆的存油量)
55   - private int jcsx;
56   -
57   - private String lp;
58   - @Transient
59   - private String bglyh;
60   -
61   - @Transient
62   - private String xlname;
63   -
64   - @Transient
65   - private String gsname;
66   -
67   - @Transient
68   - private String fgsname;
69   -
70   - @Transient
71   - private String name;
72   -
73   - public Integer getId() {
74   - return id;
75   - }
76   -
77   - public void setId(Integer id) {
78   - this.id = id;
79   - }
80   - public Date getRq() {
81   - return rq;
82   - }
83   -
84   - public void setRq(Date rq) {
85   - this.rq = rq;
86   - }
87   -
88   - public String getXlbm() {
89   - return xlbm;
90   - }
91   -
92   - public void setXlbm(String xlbm) {
93   - this.xlbm = xlbm;
94   - }
95   -
96   - public String getLinename() {
97   - return linename;
98   - }
99   -
100   - public void setLinename(String linename) {
101   - this.linename = linename;
102   - }
103   -
104   - public String getSsgsdm() {
105   - return ssgsdm;
106   - }
107   - public void setSsgsdm(String ssgsdm) {
108   - this.ssgsdm = ssgsdm;
109   - }
110   - public String getFgsdm() {
111   - return fgsdm;
112   - }
113   - public void setFgsdm(String fgsdm) {
114   - this.fgsdm = fgsdm;
115   - }
116   - public String getNbbm() {
117   - return nbbm;
118   - }
119   - public void setNbbm(String nbbm) {
120   - this.nbbm = nbbm;
121   - }
122   - public String getJsy() {
123   - return jsy;
124   - }
125   - public void setJsy(String jsy) {
126   - this.jsy = jsy;
127   - }
128   - public Double getCzlc() {
129   - return czlc;
130   - }
131   - public void setCzlc(Double czlc) {
132   - this.czlc = czlc;
133   - }
134   - public Double getJzlc() {
135   - return jzlc;
136   - }
137   - public void setJzlc(Double jzlc) {
138   - this.jzlc = jzlc;
139   - }
140   - public Double getCzyl() {
141   - return czyl;
142   - }
143   - public void setCzyl(Double czyl) {
144   - this.czyl = czyl;
145   - }
146   - public Double getJzyl() {
147   - return jzyl;
148   - }
149   - public void setJzyl(Double jzyl) {
150   - this.jzyl = jzyl;
151   - }
152   - public Double getJzl() {
153   - return jzl;
154   - }
155   - public void setJzl(Double jzl) {
156   - this.jzl = jzl;
157   - }
158   - public int getSfkt() {
159   - return sfkt;
160   - }
161   - public void setSfkt(int sfkt) {
162   - this.sfkt = sfkt;
163   - }
164   - public String getJhsj() {
165   - return jhsj;
166   - }
167   - public void setJhsj(String jhsj) {
168   - this.jhsj = jhsj;
169   - }
170   - public Double getYh() {
171   - return yh;
172   - }
173   - public void setYh(Double yh) {
174   - this.yh = yh;
175   - }
176   - public Double getSh() {
177   - return sh;
178   - }
179   - public void setSh(Double sh) {
180   - this.sh = sh;
181   - }
182   - public String getShyy() {
183   - return shyy;
184   - }
185   - public void setShyy(String shyy) {
186   - this.shyy = shyy;
187   - }
188   - public Double getZlc() {
189   - return zlc;
190   - }
191   - public void setZlc(Double zlc) {
192   - this.zlc = zlc;
193   - }
194   - public int getYhlx() {
195   - return yhlx;
196   - }
197   - public void setYhlx(int yhlx) {
198   - this.yhlx = yhlx;
199   - }
200   - public String getRylx() {
201   - return rylx;
202   - }
203   - public void setRylx(String rylx) {
204   - this.rylx = rylx;
205   - }
206   - public Double getNs() {
207   - return ns;
208   - }
209   - public void setNs(Double ns) {
210   - this.ns = ns;
211   - }
212   - public Double getFyylc() {
213   - return fyylc;
214   - }
215   - public void setFyylc(Double fyylc) {
216   - this.fyylc = fyylc;
217   - }
218   - public Double getJhzlc() {
219   - return jhzlc;
220   - }
221   - public void setJhzlc(Double jhzlc) {
222   - this.jhzlc = jhzlc;
223   - }
224   - public Double getJhfyylc() {
225   - return jhfyylc;
226   - }
227   - public void setJhfyylc(Double jhfyylc) {
228   - this.jhfyylc = jhfyylc;
229   - }
230   - public int getJhzbc() {
231   - return jhzbc;
232   - }
233   - public void setJhzbc(int jhzbc) {
234   - this.jhzbc = jhzbc;
235   - }
236   - public int getJhbc() {
237   - return jhbc;
238   - }
239   - public void setJhbc(int jhbc) {
240   - this.jhbc = jhbc;
241   - }
242   - public int getSjzbc() {
243   - return sjzbc;
244   - }
245   - public void setSjzbc(int sjzbc) {
246   - this.sjzbc = sjzbc;
247   - }
248   - public int getSjbc() {
249   - return sjbc;
250   - }
251   - public void setSjbc(int sjbc) {
252   - this.sjbc = sjbc;
253   - }
254   - public String getEdituser() {
255   - return edituser;
256   - }
257   - public void setEdituser(String edituser) {
258   - this.edituser = edituser;
259   - }
260   - public Date getEdittime() {
261   - return edittime;
262   - }
263   - public void setEdittime(Date edittime) {
264   - this.edittime = edittime;
265   - }
266   - public Date getCreatetime() {
267   - return createtime;
268   - }
269   - public void setCreatetime(Date createtime) {
270   - this.createtime = createtime;
271   - }
272   - public int getNylx() {
273   - return nylx;
274   - }
275   - public void setNylx(int nylx) {
276   - this.nylx = nylx;
277   - }
278   -
279   - public int getJcsx(){
280   - return jcsx;
281   - }
282   -
283   - public void setJcsx(int jcsx){
284   - this.jcsx=jcsx;
285   - }
286   -
287   - public String getBglyh() {
288   - if(this.getZlc()==0){
289   - return "0";
290   - }else{
291   - DecimalFormat df = new DecimalFormat("0.00");
292   - return df.format(this.getYh()/this.getZlc()*100);
293   - }
294   - }
295   -
296   - public void setBglyh(String bglyh) {
297   - this.bglyh = bglyh;
298   - }
299   -
300   - public String getXlname() {
301   - return BasicData.lineCodeAllNameMap.get(this.xlbm);
302   - }
303   -
304   - public void setXlname(String xlname) {
305   - this.xlname = xlname;
306   - }
307   -
308   - public String getGsname() {
309   - return BasicData.businessCodeNameMap.get(this.ssgsdm);
310   - }
311   -
312   - public void setGsname(String gsname) {
313   - this.gsname = gsname;
314   - }
315   -
316   -
317   - public String getFgsname() {
318   - return BasicData.businessFgsCodeNameMap.get(this.fgsdm+"_"+this.ssgsdm);
319   - }
320   -
321   - public void setFgsname(String fgsname) {
322   - this.fgsname = fgsname;
323   - }
324   -
325   - public String getName() {
326   - return BasicData.allPerson.get(this.ssgsdm+"-"+this.jsy);
327   - }
328   -
329   - public void setName(String name) {
330   - this.name = name;
331   - }
332   -
333   -
334   - public Date getUpdatetime() {
335   - return updatetime;
336   - }
337   -
338   - public void setUpdatetime(Date updatetime) {
339   - this.updatetime = updatetime;
340   - }
341   -
342   - public String getLp() {
343   - return lp;
344   - }
345   -
346   - public void setLp(String lp) {
347   - this.lp = lp;
348   - }
349   -
350   - public String getJname() {
351   - return jname;
352   - }
353   -
354   - public void setJname(String jname) {
355   - this.jname = jname;
356   - }
357   -
358   -
359   -}
  1 +package com.bsth.entity.oil;
  2 +
  3 +import java.text.DecimalFormat;
  4 +import java.util.Date;
  5 +
  6 +import javax.persistence.*;
  7 +
  8 +import org.springframework.format.annotation.DateTimeFormat;
  9 +
  10 +import com.bsth.data.BasicData;
  11 +
  12 +@Entity
  13 +@Table(name = "bsth_c_ylb")
  14 +public class Ylb {
  15 + @Id
  16 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  17 + private Integer id;
  18 + @DateTimeFormat(pattern="yyyy-MM-dd")
  19 + private Date rq;
  20 + private String xlbm;
  21 + private String linename;
  22 + private String ssgsdm;
  23 + private String fgsdm;
  24 + private String nbbm;
  25 + private String jsy;
  26 + private String jname;
  27 + private Double czlc=0.0;
  28 + private Double jzlc=0.0;
  29 + private Double czyl=0.0;
  30 + private Double jzyl=0.0;
  31 + private Double jzl=0.0;
  32 + private int sfkt;
  33 + private String jhsj;
  34 + private Double yh=0.0;
  35 + private Double sh=0.0;
  36 + private String shyy;
  37 + private Double zlc=0.0;
  38 + private int yhlx;
  39 + private String rylx="0";
  40 + private Double ns=0.0;
  41 + private Double fyylc=0.0;
  42 + private Double jhzlc=0.0;
  43 + private Double jhfyylc=0.0;
  44 + private int jhzbc;
  45 + private int jhbc;
  46 + private int sjzbc;
  47 + private int sjbc;
  48 + private String edituser;
  49 + private Date edittime;
  50 + private Date updatetime;
  51 + private Date createtime;
  52 +
  53 + private int nylx;
  54 + //进场顺序(根据最先出场和最后进场来关联车辆的存油量)
  55 + private int jcsx;
  56 +
  57 + private String lp;
  58 + @Transient
  59 + private String bglyh;
  60 +
  61 + @Transient
  62 + private String xlname;
  63 +
  64 + @Transient
  65 + private String gsname;
  66 +
  67 + @Transient
  68 + private String fgsname;
  69 +
  70 + @Transient
  71 + private String name;
  72 +
  73 + public Integer getId() {
  74 + return id;
  75 + }
  76 +
  77 + public void setId(Integer id) {
  78 + this.id = id;
  79 + }
  80 + public Date getRq() {
  81 + return rq;
  82 + }
  83 +
  84 + public void setRq(Date rq) {
  85 + this.rq = rq;
  86 + }
  87 +
  88 + public String getXlbm() {
  89 + return xlbm;
  90 + }
  91 +
  92 + public void setXlbm(String xlbm) {
  93 + this.xlbm = xlbm;
  94 + }
  95 +
  96 + public String getLinename() {
  97 + return linename;
  98 + }
  99 +
  100 + public void setLinename(String linename) {
  101 + this.linename = linename;
  102 + }
  103 +
  104 + public String getSsgsdm() {
  105 + return ssgsdm;
  106 + }
  107 + public void setSsgsdm(String ssgsdm) {
  108 + this.ssgsdm = ssgsdm;
  109 + }
  110 + public String getFgsdm() {
  111 + return fgsdm;
  112 + }
  113 + public void setFgsdm(String fgsdm) {
  114 + this.fgsdm = fgsdm;
  115 + }
  116 + public String getNbbm() {
  117 + return nbbm;
  118 + }
  119 + public void setNbbm(String nbbm) {
  120 + this.nbbm = nbbm;
  121 + }
  122 + public String getJsy() {
  123 + return jsy;
  124 + }
  125 + public void setJsy(String jsy) {
  126 + this.jsy = jsy;
  127 + }
  128 + public Double getCzlc() {
  129 + return czlc;
  130 + }
  131 + public void setCzlc(Double czlc) {
  132 + this.czlc = czlc;
  133 + }
  134 + public Double getJzlc() {
  135 + return jzlc;
  136 + }
  137 + public void setJzlc(Double jzlc) {
  138 + this.jzlc = jzlc;
  139 + }
  140 + public Double getCzyl() {
  141 + return czyl;
  142 + }
  143 + public void setCzyl(Double czyl) {
  144 + this.czyl = czyl;
  145 + }
  146 + public Double getJzyl() {
  147 + return jzyl;
  148 + }
  149 + public void setJzyl(Double jzyl) {
  150 + this.jzyl = jzyl;
  151 + }
  152 + public Double getJzl() {
  153 + return jzl;
  154 + }
  155 + public void setJzl(Double jzl) {
  156 + this.jzl = jzl;
  157 + }
  158 + public int getSfkt() {
  159 + return sfkt;
  160 + }
  161 + public void setSfkt(int sfkt) {
  162 + this.sfkt = sfkt;
  163 + }
  164 + public String getJhsj() {
  165 + return jhsj;
  166 + }
  167 + public void setJhsj(String jhsj) {
  168 + this.jhsj = jhsj;
  169 + }
  170 + public Double getYh() {
  171 + return yh;
  172 + }
  173 + public void setYh(Double yh) {
  174 + this.yh = yh;
  175 + }
  176 + public Double getSh() {
  177 + return sh;
  178 + }
  179 + public void setSh(Double sh) {
  180 + this.sh = sh;
  181 + }
  182 + public String getShyy() {
  183 + return shyy;
  184 + }
  185 + public void setShyy(String shyy) {
  186 + this.shyy = shyy;
  187 + }
  188 + public Double getZlc() {
  189 + return zlc;
  190 + }
  191 + public void setZlc(Double zlc) {
  192 + this.zlc = zlc;
  193 + }
  194 + public int getYhlx() {
  195 + return yhlx;
  196 + }
  197 + public void setYhlx(int yhlx) {
  198 + this.yhlx = yhlx;
  199 + }
  200 + public String getRylx() {
  201 + return rylx;
  202 + }
  203 + public void setRylx(String rylx) {
  204 + this.rylx = rylx;
  205 + }
  206 + public Double getNs() {
  207 + return ns;
  208 + }
  209 + public void setNs(Double ns) {
  210 + this.ns = ns;
  211 + }
  212 + public Double getFyylc() {
  213 + return fyylc;
  214 + }
  215 + public void setFyylc(Double fyylc) {
  216 + this.fyylc = fyylc;
  217 + }
  218 + public Double getJhzlc() {
  219 + return jhzlc;
  220 + }
  221 + public void setJhzlc(Double jhzlc) {
  222 + this.jhzlc = jhzlc;
  223 + }
  224 + public Double getJhfyylc() {
  225 + return jhfyylc;
  226 + }
  227 + public void setJhfyylc(Double jhfyylc) {
  228 + this.jhfyylc = jhfyylc;
  229 + }
  230 + public int getJhzbc() {
  231 + return jhzbc;
  232 + }
  233 + public void setJhzbc(int jhzbc) {
  234 + this.jhzbc = jhzbc;
  235 + }
  236 + public int getJhbc() {
  237 + return jhbc;
  238 + }
  239 + public void setJhbc(int jhbc) {
  240 + this.jhbc = jhbc;
  241 + }
  242 + public int getSjzbc() {
  243 + return sjzbc;
  244 + }
  245 + public void setSjzbc(int sjzbc) {
  246 + this.sjzbc = sjzbc;
  247 + }
  248 + public int getSjbc() {
  249 + return sjbc;
  250 + }
  251 + public void setSjbc(int sjbc) {
  252 + this.sjbc = sjbc;
  253 + }
  254 + public String getEdituser() {
  255 + return edituser;
  256 + }
  257 + public void setEdituser(String edituser) {
  258 + this.edituser = edituser;
  259 + }
  260 + public Date getEdittime() {
  261 + return edittime;
  262 + }
  263 + public void setEdittime(Date edittime) {
  264 + this.edittime = edittime;
  265 + }
  266 + public Date getCreatetime() {
  267 + return createtime;
  268 + }
  269 + public void setCreatetime(Date createtime) {
  270 + this.createtime = createtime;
  271 + }
  272 + public int getNylx() {
  273 + return nylx;
  274 + }
  275 + public void setNylx(int nylx) {
  276 + this.nylx = nylx;
  277 + }
  278 +
  279 + public int getJcsx(){
  280 + return jcsx;
  281 + }
  282 +
  283 + public void setJcsx(int jcsx){
  284 + this.jcsx=jcsx;
  285 + }
  286 +
  287 + public String getBglyh() {
  288 + if(this.getZlc()==0){
  289 + return "0";
  290 + }else{
  291 + DecimalFormat df = new DecimalFormat("0.000");
  292 + return df.format(this.getYh()/this.getZlc()*100);
  293 + }
  294 + }
  295 +
  296 + public void setBglyh(String bglyh) {
  297 + this.bglyh = bglyh;
  298 + }
  299 +
  300 + public String getXlname() {
  301 + return BasicData.lineCodeAllNameMap.get(this.xlbm);
  302 + }
  303 +
  304 + public void setXlname(String xlname) {
  305 + this.xlname = xlname;
  306 + }
  307 +
  308 + public String getGsname() {
  309 + return BasicData.businessCodeNameMap.get(this.ssgsdm);
  310 + }
  311 +
  312 + public void setGsname(String gsname) {
  313 + this.gsname = gsname;
  314 + }
  315 +
  316 +
  317 + public String getFgsname() {
  318 + return BasicData.businessFgsCodeNameMap.get(this.fgsdm+"_"+this.ssgsdm);
  319 + }
  320 +
  321 + public void setFgsname(String fgsname) {
  322 + this.fgsname = fgsname;
  323 + }
  324 +
  325 + public String getName() {
  326 + return BasicData.allPerson.get(this.ssgsdm+"-"+this.jsy);
  327 + }
  328 +
  329 + public void setName(String name) {
  330 + this.name = name;
  331 + }
  332 +
  333 +
  334 + public Date getUpdatetime() {
  335 + return updatetime;
  336 + }
  337 +
  338 + public void setUpdatetime(Date updatetime) {
  339 + this.updatetime = updatetime;
  340 + }
  341 +
  342 + public String getLp() {
  343 + return lp;
  344 + }
  345 +
  346 + public void setLp(String lp) {
  347 + this.lp = lp;
  348 + }
  349 +
  350 + public String getJname() {
  351 + return jname;
  352 + }
  353 +
  354 + public void setJname(String jname) {
  355 + this.jname = jname;
  356 + }
  357 +
  358 +
  359 +}
... ...
src/main/java/com/bsth/repository/oil/JdlReceptionRepository.java 0 → 100644
  1 +package com.bsth.repository.oil;
  2 +
  3 +import java.util.Date;
  4 +import java.util.List;
  5 +
  6 +import org.springframework.data.jpa.repository.Modifying;
  7 +import org.springframework.data.jpa.repository.Query;
  8 +import org.springframework.stereotype.Repository;
  9 +import org.springframework.transaction.annotation.Transactional;
  10 +
  11 +import com.bsth.entity.oil.JdlReception;
  12 +import com.bsth.repository.BaseRepository;
  13 +
  14 +@Repository
  15 +public interface JdlReceptionRepository extends BaseRepository<JdlReception, Integer>{
  16 +
  17 + @Query(value="SELECT date_str, car_code, sum(CAST(charge_capacity AS DECIMAL(10, 3))) charge_capacity FROM bsth_c_jdl_reception where date_str = ?1 and car_code like %?2% group by date_str, car_code order by date_str" ,nativeQuery=true)
  18 + List<Object[]> querySum(String rq, String nbbm);
  19 +
  20 + @Query(value="SELECT * FROM bsth_c_jdl_reception where date_str = ?1 and car_code like %?2% " ,nativeQuery=true)
  21 + List<JdlReception> query(String rq, String nbbm);
  22 +
  23 + @Query(value="SELECT create_by, DATE_FORMAT(create_date, '%Y-%m-%d %H:%i:%s') create_date FROM bsth_c_jdl_reception where DATE_FORMAT(create_date, '%Y-%m-%d') = ?1 and origin = 1 group by create_by, create_date order by create_date" ,nativeQuery=true)
  24 + List<Object[]> queryBatch(String rq);
  25 +
  26 + @Query(value="SELECT * FROM bsth_c_jdl_reception where create_by = ?1 and DATE_FORMAT(create_date, '%Y-%m-%d %H:%i:%s') = ?2 and origin = 1 " ,nativeQuery=true)
  27 + List<JdlReception> queryBatchData(String createBy, String createDate);
  28 +
  29 + @Modifying
  30 + @Transactional
  31 + @Query(value = "delete JdlReception j where createBy = ?1 and DATE_FORMAT(createDate, '%Y-%m-%d %H:%i:%s') = ?2 and origin = 1")
  32 + void deleteBatch(String createBy, String createDate);
  33 +
  34 +}
... ...
src/main/java/com/bsth/service/oil/JdlService.java
1 1 package com.bsth.service.oil;
2 2  
3 3 import java.io.File;
  4 +import java.util.List;
4 5 import java.util.Map;
5 6  
6 7 import com.bsth.entity.oil.Jdl;
  8 +import com.bsth.entity.oil.JdlReception;
7 9 import com.bsth.service.BaseService;
8 10  
9 11 public interface JdlService extends BaseService<Jdl, Integer> {
10 12  
11 13 public String importExcel(File file, String gsbm_, String gsName, String fgsbm, String fgsName);
  14 +
  15 + /** 24年12月工单更新电量导入 */
  16 + public String importExcel_2412(File file, String gsbm_, String gsName, String fgsbm, String fgsName);
12 17  
13 18 public Map<String, Object> query(Map<String, Object> map);
  19 +
  20 + public Map<String, Object> query_2412(Map<String, Object> map);
  21 +
  22 + public List<JdlReception> queryJdlReception(Map<String, Object> map);
  23 +
  24 + public Map<String, Object> queryJdlReceptionBatch(Map<String, Object> map);
  25 +
  26 + public List<JdlReception> queryJdlReceptionBatchData(Map<String, Object> map);
  27 +
  28 + public Map<String, Object> deleteJdlReceptionBatch(Map<String, Object> map);
  29 +
  30 + /**
  31 + * 查询车辆充电量,以jdl表格式返回
  32 + * @param rq 营运日期
  33 + * @param nbbm 车辆自编号(为‘’时查询全部车辆)
  34 + * @return
  35 + */
  36 + public List<Jdl> queryJdlByJdlReception(String rq, String nbbm);
14 37  
15 38 }
... ...
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
... ... @@ -39,12 +39,14 @@ import com.bsth.entity.sys.SysUser;
39 39 import com.bsth.repository.CarsRepository;
40 40 import com.bsth.repository.oil.CdlRepository;
41 41 import com.bsth.repository.oil.DlbRepository;
  42 +import com.bsth.repository.oil.JdlReceptionRepository;
42 43 import com.bsth.repository.oil.JdlRepository;
43 44 import com.bsth.repository.oil.NylogRepository;
44 45 import com.bsth.repository.oil.YlxxbRepository;
45 46 import com.bsth.security.util.SecurityUtils;
46 47 import com.bsth.service.impl.BaseServiceImpl;
47 48 import com.bsth.service.oil.DlbService;
  49 +import com.bsth.service.oil.JdlService;
48 50 import com.bsth.service.realcontrol.ScheduleRealInfoService;
49 51 import com.bsth.util.Arith;
50 52 import com.bsth.util.BatchSaveUtils;
... ... @@ -67,6 +69,8 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
67 69  
68 70 @Autowired
69 71 ScheduleRealInfoService scheduleRealInfoService;
  72 + @Autowired
  73 + JdlService jdlService;
70 74  
71 75 @Autowired
72 76 JdbcTemplate jdbcTemplate;
... ... @@ -95,13 +99,13 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
95 99 // String rq="2017-11-02";
96 100 String line="";
97 101 //保留两位小数
98   - DecimalFormat df = new DecimalFormat("#.00");
  102 + DecimalFormat df = new DecimalFormat("#.000");
99 103 // TODO Auto-generated method stub
100 104 Map<String, Object> newMap=new HashMap<String,Object>();
101 105 //当天DLB信息
102 106 List<Dlb> dlList=repository.obtainDl(rq, "", "", line, "", "nbbm");
103 107 //当天加电信息表
104   - List<Jdl> jdlList=jdlRepository.JdlList(rq);
  108 + List<Jdl> jdlList = jdlService.queryJdlByJdlReception(rq, "");
105 109 //前一天所有车辆最后进场班次信息
106 110 // List<Dlb> dlListBe=repository.obtainYlbefore(rq, "", "", "", "");
107 111 List<Cdl> cdyList=cdlRepository.obtainCdl();
... ... @@ -240,7 +244,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
240 244 }
241 245 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
242 246 // 保留两位小数
243   - DecimalFormat df = new DecimalFormat("#.00");
  247 + DecimalFormat df = new DecimalFormat("#.000");
244 248 // TODO Auto-generated method stub
245 249 // 当天DLB信息
246 250 List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm");
... ... @@ -261,19 +265,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
261 265 }
262 266 }
263 267  
264   -// Map<String, Double> shMap=new HashMap<String,Double>();
265   -// for (int i = 0; i < dlList.size(); i++) {
266   -// Dlb dlb=dlList.get(i);
267   -// String cl=dlb.getNbbm();
268   -// if(shMap.get(cl)==null){
269   -// shMap.put(cl, dlb.getSh());
270   -// }else{
271   -// double sh=shMap.get(cl);
272   -// shMap.remove(cl);
273   -// shMap.put(cl, Arith.add(sh, dlb.getSh()));
274   -// }
275   -// }
276   - List<Jdl> jdlList=jdlRepository.JdlList(rq);
  268 + List<Jdl> jdlList = jdlService.queryJdlByJdlReception(rq, "");
277 269 String sxtj=map2.get("sxtj").toString();
278 270 if(sxtj.equals("0")){
279 271 listpb=listpbs;
... ... @@ -330,21 +322,15 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
330 322 double zlc =lcMap.get(map_.get("clZbh").toString());
331 323 //车辆总加电量
332 324 double zjzl = 0.0;
  325 +
  326 + // 2022年12月20号要求不按车队导入,这之后导入的加注量将覆盖原加注量
333 327 for (int i = 0; i < jdlList.size(); i++) {
334 328 Jdl jdl=jdlList.get(i);
335   - if(map_.get("clZbh").toString().equals(jdl.getNbbm())
336   - &&map_.get("company").toString().equals(jdl.getGsBm())
337   - &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){
338   - zjzl = Arith.add(zjzl,jdl.getJdl());
  329 + if(map_.get("clZbh").toString().equals(jdl.getNbbm())){
  330 + zjzl = Arith.add(zjzl, jdl.getJdl());
339 331 }
340 332 }
341   -// double clsh=0.0;
342   -// if(shMap.get(map_.get("clZbh").toString())==null){
343   -// clsh=0.0;
344   -// }else{
345   -// clsh=shMap.get(map_.get("clZbh").toString());
346   -// }
347   -// zjzl =Arith.sub(zjzl, clsh);
  333 +
348 334 Double nextJzyl = 0.0;
349 335 for (int i = 0; i < listpb.size(); i++) {
350 336 Map<String, Object> map = listpb.get(i);
... ... @@ -1026,7 +1012,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
1026 1012 Map<String, List<Dlb>> mapList=new HashMap<String,List<Dlb>>();
1027 1013 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
1028 1014 // 保留两位小数
1029   - DecimalFormat df = new DecimalFormat("#.00");
  1015 + DecimalFormat df = new DecimalFormat("#.000");
1030 1016 List<Dlb> dlbList=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm");
1031 1017 List<Dlb> dlbList_upd=new ArrayList<Dlb>();
1032 1018 List<Dlb> dlbList_del=new ArrayList<Dlb>();
... ... @@ -1082,7 +1068,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
1082 1068 shMap.put(cl, Arith.add(sh, dlb.getSh()));
1083 1069 }
1084 1070 }
1085   - List<Jdl> jdlList=jdlRepository.JdlList(date);
  1071 + List<Jdl> jdlList = jdlService.queryJdlByJdlReception(date, "");
1086 1072 Map<String, Object> newMap_=new HashMap<String,Object>();
1087 1073 Map<String, Object> cMap=new HashMap<String, Object>();
1088 1074 List<Map<String, Object>> listpb_=listpbDc;
... ... @@ -1099,10 +1085,8 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
1099 1085 double zjzl = 0.0;
1100 1086 for (int i = 0; i < jdlList.size(); i++) {
1101 1087 Jdl jdl=jdlList.get(i);
1102   - if(map_.get("clZbh").toString().equals(jdl.getNbbm())
1103   - &&map_.get("company").toString().equals(jdl.getGsBm())
1104   - &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){
1105   - zjzl = Arith.add(zjzl,jdl.getJdl());
  1088 + if(map_.get("clZbh").toString().equals(jdl.getNbbm())){
  1089 + zjzl = Arith.add(zjzl, jdl.getJdl());
1106 1090 }
1107 1091 }
1108 1092 double clsh=0.0;
... ...
src/main/java/com/bsth/service/oil/impl/JdlServiceImpl.java
... ... @@ -3,6 +3,7 @@ package com.bsth.service.oil.impl;
3 3 import java.io.File;
4 4 import java.io.FileInputStream;
5 5 import java.text.DecimalFormat;
  6 +import java.text.ParseException;
6 7 import java.text.SimpleDateFormat;
7 8 import java.util.ArrayList;
8 9 import java.util.Date;
... ... @@ -19,8 +20,13 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem;
19 20 import org.springframework.beans.factory.annotation.Autowired;
20 21 import org.springframework.stereotype.Service;
21 22  
  23 +import com.bsth.common.ResponseCode;
22 24 import com.bsth.entity.oil.Jdl;
  25 +import com.bsth.entity.oil.JdlReception;
  26 +import com.bsth.entity.sys.SysUser;
  27 +import com.bsth.repository.oil.JdlReceptionRepository;
23 28 import com.bsth.repository.oil.JdlRepository;
  29 +import com.bsth.security.util.SecurityUtils;
24 30 import com.bsth.service.impl.BaseServiceImpl;
25 31 import com.bsth.service.oil.JdlService;
26 32 import com.bsth.util.ReportUtils;
... ... @@ -30,6 +36,9 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
30 36  
31 37 @Autowired
32 38 JdlRepository repository;
  39 +
  40 + @Autowired
  41 + JdlReceptionRepository jdlReceptionRepository;
33 42  
34 43 @Override
35 44 public String importExcel(File file, String gsbm, String gsName, String fgsbm, String fgsName) {
... ... @@ -152,5 +161,240 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
152 161 }
153 162 return modelMap;
154 163 }
  164 +
  165 + @Override
  166 + public String importExcel_2412(File file, String gsbm, String gsName, String fgsbm, String fgsName) {
  167 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  168 + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  169 + SimpleDateFormat ddFormat = new SimpleDateFormat("dd");
  170 + DecimalFormat df = new DecimalFormat("######0.00");
  171 + SysUser user = SecurityUtils.getCurrentUser();
  172 + Date currDate = new Date();
  173 + List<String> textList = new ArrayList<String>();
  174 + try {
  175 + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file));
  176 + HSSFWorkbook wb = new HSSFWorkbook(fs);
  177 + HSSFSheet sheet = wb.getSheetAt(0);
  178 + // 取得总行数
  179 + int rowNum = sheet.getLastRowNum() + 1;
  180 + // 取得总列数
  181 + int cellNum = sheet.getRow(0).getLastCellNum();
  182 + HSSFRow row = null;
  183 + HSSFCell cell = null;
  184 + for(int i = 3; i < rowNum; i++){
  185 + row = sheet.getRow(i);
  186 + if (row == null){
  187 + continue;
  188 + }
  189 + String text = "";
  190 + for(int j = 0; j < cellNum; j++){
  191 + cell = row.getCell(j);
  192 + if(cell == null){
  193 + text += ",";
  194 + continue;
  195 + }
  196 + text += String.valueOf(cell) + ",";
  197 + }
  198 + String[] split = (text+";").split(",");
  199 + String str = "";
  200 + for(int j = 0; j < split.length && j < 12; j++){
  201 + str += split[j];
  202 + }
  203 + if(str.trim().length() == 0)
  204 + continue;
  205 + textList.add(text + ";");
  206 + }
  207 + List<JdlReception> list = new ArrayList<JdlReception>();
  208 + for(int i = 0; i < textList.size(); i++){
  209 + String text = textList.get(i);
  210 + String[] split = text.split(",");
  211 + if(split[1] != null && split[1].trim().length() > 0){
  212 + Integer dd = Integer.valueOf(split[1].trim().split("\\.")[0]); // 日期
  213 + String zh = split[2].trim(); // 桩号
  214 + String nbbm = split[3].trim(); // 车号
  215 + String startTime = split[4].trim(); // 开始时间
  216 + String endTime = split[5].trim(); // 结束时间
  217 + String sumTime = split[6].trim(); // 总计(分钟)
  218 + String startSoc = split[7].trim(); // 起始电量SOC%
  219 + String endSoc = split[8].trim(); // 结束电量SOC%
  220 + String jdl = split[9].trim(); // 充电度数
  221 + String lc = split[10].trim(); // 里程度数
  222 + String stopReason = split[11].trim(); // 一次不能正常充电记录
  223 + JdlReception jdlRe = new JdlReception();
  224 + Date date = sd.parse(startTime);
  225 + if(!(dd == Integer.valueOf(ddFormat.format(date)))){
  226 + date.setTime(date.getTime() - 1l*1000*60*60*24);
  227 + }
  228 + jdlRe.setDateStr(sdf.format(date));
  229 + jdlRe.setConnectorId(zh);
  230 + jdlRe.setCarCode(nbbm);
  231 + jdlRe.setStartTime(startTime);
  232 + jdlRe.setEndTime(endTime);
  233 + jdlRe.setSumTime(Integer.valueOf(sumTime.split("\\.")[0]));
  234 + jdlRe.setStartSoc(Double.valueOf(startSoc));
  235 + jdlRe.setEndSoc(Double.valueOf(endSoc));
  236 + jdlRe.setChargeCapacity(Double.valueOf(jdl));
  237 + jdlRe.setStopReason(stopReason);
  238 + jdlRe.setCreateBy(user.getUserName());
  239 + jdlRe.setCreateDate(currDate);
  240 + jdlRe.setOrigin(1);
  241 + list.add(jdlRe);
  242 + }
  243 + }
  244 + jdlReceptionRepository.saveAll(list);
  245 + wb.close();
  246 + fs.close();
  247 + } catch (Exception e) {
  248 + // TODO Auto-generated catch block
  249 + e.printStackTrace();
  250 + return "文件导入失败";
  251 + } finally {
  252 + file.delete();
  253 + }
  254 + return "文件导入成功";
  255 + }
  256 +
  257 + @Override
  258 + public Map<String, Object> query_2412(Map<String, Object> map) {
  259 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  260 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  261 + Map<String, Object> modelMap = new HashMap<String, Object>();
  262 + String rq = map.get("rq").toString();
  263 + String nbbm = map.get("nbbm").toString();
  264 + Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0");
  265 + List<Jdl> query = new ArrayList<Jdl>();
  266 +
  267 + List<Object[]> querySum = jdlReceptionRepository.querySum(rq, nbbm);
  268 +
  269 + try {
  270 + for(Object[] j : querySum){
  271 + Jdl jdl = new Jdl();
  272 + jdl.setRq(sdfMonth.parse(j[0].toString()));
  273 + jdl.setNbbm(j[1].toString());
  274 + jdl.setJdl(Double.valueOf(j[2].toString()));
  275 + jdl.setJdz("");
  276 + jdl.setRemarks("");
  277 + query.add(jdl);
  278 + }
  279 + } catch (Exception e) {
  280 + // TODO Auto-generated catch block
  281 + e.printStackTrace();
  282 + }
  283 +
  284 + if(!map.containsKey("type")){
  285 +
  286 + int end = (page+1)*10>query.size()?query.size():(page+1)*10;
  287 + modelMap.put("dataList", query.subList(page*10, end));
  288 + modelMap.put("totalPages", query.size()%10>0?query.size()/10+1:query.size()/10);
  289 +
  290 + } else if(map.get("type").toString().equals("export")){
  291 +
  292 + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
  293 + for(Jdl jdl : query){
  294 + Map<String, Object> m = new HashMap<String, Object>();
  295 + m.put("rq", sdfMonth.format(jdl.getRq()));
  296 + m.put("nbbm", jdl.getNbbm());
  297 + m.put("jdl", jdl.getJdl());
  298 + m.put("jdz", jdl.getJdz());
  299 + m.put("remarks", jdl.getRemarks());
  300 + list.add(m);
  301 + }
  302 +
  303 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  304 + Map<String, Object> m = new HashMap<String, Object>();
  305 + ReportUtils ee = new ReportUtils();
  306 + try {
  307 + listI.add(list.iterator());
  308 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  309 + ee.excelReplace(listI, new Object[] { m }, path+"mould/export_Jdl.xls",
  310 + path+"export/车辆充电量" + sdfSimple.format(sdfMonth.parse(rq)) + ".xls");
  311 + } catch (Exception e) {
  312 + // TODO: handle exception
  313 + e.printStackTrace();
  314 + }
  315 + }
  316 + return modelMap;
  317 + }
  318 +
  319 + @Override
  320 + public List<JdlReception> queryJdlReception(Map<String, Object> map) {
  321 + String rq = map.get("rq").toString();
  322 + String nbbm = map.get("nbbm").toString();
  323 + List<JdlReception> query = jdlReceptionRepository.query(rq, nbbm);
  324 + return query;
  325 + }
  326 +
  327 + @Override
  328 + public Map<String, Object> queryJdlReceptionBatch(Map<String, Object> map) {
  329 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd");
  330 + Map<String, Object> modelMap = new HashMap<String, Object>();
  331 + String rq = map.get("rq").toString();
  332 + Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0");
  333 + List<Map<String, Object>> query = new ArrayList<Map<String, Object>>();
  334 +
  335 + List<Object[]> queryBatch = jdlReceptionRepository.queryBatch(rq);
  336 +
  337 + try {
  338 + for(Object[] j : queryBatch){
  339 + Map<String, Object> m = new HashMap<String, Object>();
  340 + m.put("createBy", j[0]);
  341 + m.put("createDate", j[1]);
  342 + query.add(m);
  343 + }
  344 + } catch (Exception e) {
  345 + // TODO Auto-generated catch block
  346 + e.printStackTrace();
  347 + }
  348 +
  349 + int end = (page+1)*10>query.size()?query.size():(page+1)*10;
  350 + modelMap.put("dataList", query.subList(page*10, end));
  351 + modelMap.put("totalPages", query.size()%10>0?query.size()/10+1:query.size()/10);
  352 +
  353 + return modelMap;
  354 + }
  355 +
  356 + @Override
  357 + public List<JdlReception> queryJdlReceptionBatchData(Map<String, Object> map) {
  358 + String createBy = map.get("createBy").toString();
  359 + String createDate = map.get("createDate").toString();
  360 + List<JdlReception> query = jdlReceptionRepository.queryBatchData(createBy, createDate);
  361 + return query;
  362 + }
  363 +
  364 + @Override
  365 + public Map<String, Object> deleteJdlReceptionBatch(Map<String, Object> map) {
  366 + Map<String, Object> resMap = new HashMap<>();
  367 + try{
  368 + String createBy = map.get("createBy").toString();
  369 + String createDate = map.get("createDate").toString();
  370 + jdlReceptionRepository.deleteBatch(createBy, createDate);
  371 + resMap.put("status", ResponseCode.SUCCESS);
  372 + }catch (Exception e){
  373 + resMap.put("status", ResponseCode.ERROR);
  374 + resMap.put("msg", e.getMessage());
  375 + }
  376 + return resMap;
  377 + }
  378 +
  379 + @Override
  380 + public List<Jdl> queryJdlByJdlReception(String rq, String nbbm) {
  381 + List<Jdl> list = new ArrayList<Jdl>();
  382 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  383 + List<JdlReception> query = jdlReceptionRepository.query(rq, nbbm);
  384 + for(JdlReception jr : query){
  385 + try {
  386 + Jdl jdl = new Jdl();
  387 + jdl.setFgsBm("-1");
  388 + jdl.setRq(sdf.parse(jr.getDateStr()));
  389 + jdl.setJdl(jr.getChargeCapacity());
  390 + jdl.setNbbm(jr.getCarCode());
  391 + list.add(jdl);
  392 + } catch (Exception e) {
  393 + // TODO Auto-generated catch block
  394 + e.printStackTrace();
  395 + }
  396 + }
  397 + return list;
  398 + }
155 399  
156 400 }
... ...
src/main/java/com/bsth/service/oil/impl/QlbServiceImpl.java
... ... @@ -91,7 +91,7 @@ public class QlbServiceImpl extends BaseServiceImpl&lt;Qlb,Integer&gt; implements QlbS
91 91 // String rq="2017-11-02";
92 92 String line="";
93 93 //保留两位小数
94   - DecimalFormat df = new DecimalFormat("#.00");
  94 + DecimalFormat df = new DecimalFormat("#.000");
95 95 // TODO Auto-generated method stub
96 96 Map<String, Object> newMap=new HashMap<String,Object>();
97 97 //当天QLB信息
... ... @@ -227,7 +227,7 @@ public class QlbServiceImpl extends BaseServiceImpl&lt;Qlb,Integer&gt; implements QlbS
227 227 }
228 228 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
229 229 // 保留两位小数
230   - DecimalFormat df = new DecimalFormat("#.00");
  230 + DecimalFormat df = new DecimalFormat("#.000");
231 231 // TODO Auto-generated method stub
232 232 // 当天QLB信息
233 233 List<Qlb> qlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm");
... ... @@ -980,7 +980,7 @@ public class QlbServiceImpl extends BaseServiceImpl&lt;Qlb,Integer&gt; implements QlbS
980 980 Map<String, List<Qlb>> mapList=new HashMap<String,List<Qlb>>();
981 981 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
982 982 // 保留两位小数
983   - DecimalFormat df = new DecimalFormat("#.00");
  983 + DecimalFormat df = new DecimalFormat("#.000");
984 984 List<Qlb> qlbList=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm");
985 985 List<Qlb> qlbList_upd=new ArrayList<Qlb>();
986 986 List<Qlb> qlbList_del=new ArrayList<Qlb>();
... ...