Commit 97bd87ce0676014224801343ce8b0d9c7e583285

Authored by 王通
2 parents 3df97e6b 14977d1b

1.

src/main/java/com/bsth/entity/JdlReception.java
1   -package com.bsth.entity;
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   -
  1 +package com.bsth.entity;
  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 '车牌号',
  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 210 }
211 211 \ No newline at end of file
... ...
src/main/java/com/bsth/repository/JdlReceptionRepository.java
1 1 package com.bsth.repository;
2 2  
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.Query;
3 6 import org.springframework.data.repository.PagingAndSortingRepository;
4 7 import org.springframework.stereotype.Repository;
5 8  
... ... @@ -8,4 +11,7 @@ import com.bsth.entity.JdlReception;
8 11 @Repository
9 12 public interface JdlReceptionRepository extends PagingAndSortingRepository<JdlReception, Integer>{
10 13  
  14 + @Query("SELECT inside_code from bsth_c_cars where REPLACE(car_plate, '-', '') = ?1 and scrap_state = 0 order by create_date desc ")
  15 + List<Object[]> selectNbbmByPlate(String carPlate);
  16 +
11 17 }
... ...
src/main/java/com/bsth/server_rs/electric/ElectricService.java
... ... @@ -75,21 +75,26 @@ public class ElectricService {
75 75 String endTime = body.getString("endTime");
76 76  
77 77 JdlReception jdlReception = new JdlReception();
78   - jdlReception.setStationName(body.getString("stationName"));
79 78 jdlReception.setConnectorId(body.getString("connectorId"));
80   - jdlReception.setOrderNo(body.getString("orderNo"));
  79 + jdlReception.setOrderNo(body.getString("startChargeSeq"));
81 80 jdlReception.setStartTime(startTime);
82 81 jdlReception.setEndTime(endTime);
83   - jdlReception.setStartSoc(body.getDouble("startSoc"));
84   - jdlReception.setEndSoc(body.getDouble("endSoc"));
  82 + jdlReception.setChargeCapacity(body.getDouble("totalPower"));
  83 + jdlReception.setElectricCharge(body.getDouble("totalElecMoney"));
  84 + jdlReception.setServiceCharge(body.getDouble("totalSeviceMoney"));
  85 + jdlReception.setTotalAmount(body.getDouble("totalMoney"));
85 86 jdlReception.setStopReason(body.getString("stopReason"));
86   - jdlReception.setChargeCapacity(body.getDouble("chargeCapacity"));
87   - jdlReception.setElectricCharge(body.getDouble("electricCharge"));
88   - jdlReception.setServiceCharge(body.getDouble("serviceCharge"));
89   - jdlReception.setTotalAmount(body.getDouble("totalAmount"));
90   - jdlReception.setVinCode(body.getString("vinCode"));
91   - jdlReception.setCardNo(body.getString("cardNo"));
92   - jdlReception.setCarCode(body.getString("carCode"));
  87 + jdlReception.setStationName(body.getString("sumPeriod")); // 时段数
  88 + jdlReception.setVinCode(body.getString("vinCode")); // 车架号
  89 + jdlReception.setCardNo(body.getString("carPlate")); // 车牌号
  90 + List<Object[]> selectNbbmByPlate = jdlReceptionRepository.selectNbbmByPlate(jdlReception.getCardNo().replaceAll("-", ""));
  91 + if(selectNbbmByPlate.size() > 0){
  92 + jdlReception.setCarCode(selectNbbmByPlate.get(0)[0].toString()); // 车辆自编号
  93 + } else {
  94 + resMap.put("Status", 1);
  95 + resMap.put("Msg", "该车牌号在系统中找不到相应车辆");
  96 + return resMap;
  97 + }
93 98 jdlReception.setOrigin(0);
94 99 jdlReception.setCreateBy("接口接入");
95 100 jdlReception.setCreateDate(new Date());
... ...