Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a179b2f704
36
pom.xml
36
pom.xml
@ -81,11 +81,11 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringBoot 监控客户端 -->
|
<!-- SpringBoot 监控客户端 -->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>de.codecentric</groupId>
|
<!-- <groupId>de.codecentric</groupId>-->
|
||||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
<!-- <artifactId>spring-boot-admin-starter-client</artifactId>-->
|
||||||
<version>${spring-boot-admin.version}</version>
|
<!-- <version>${spring-boot-admin.version}</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- FastDFS 分布式文件系统 -->
|
<!-- FastDFS 分布式文件系统 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -264,18 +264,18 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<!-- <build>-->
|
||||||
<plugins>
|
<!-- <plugins>-->
|
||||||
<plugin>
|
<!-- <plugin>-->
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<!-- <groupId>org.apache.maven.plugins</groupId>-->
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<!-- <artifactId>maven-compiler-plugin</artifactId>-->
|
||||||
<configuration>
|
<!-- <configuration>-->
|
||||||
<source>${java.version}</source>
|
<!-- <source>${java.version}</source>-->
|
||||||
<target>${java.version}</target>
|
<!-- <target>${java.version}</target>-->
|
||||||
<encoding>${project.build.sourceEncoding}</encoding>
|
<!-- <encoding>${project.build.sourceEncoding}</encoding>-->
|
||||||
</configuration>
|
<!-- </configuration>-->
|
||||||
</plugin>
|
<!-- </plugin>-->
|
||||||
</plugins>
|
<!-- </plugins>-->
|
||||||
</build>
|
<!-- </build>-->
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -14,10 +14,10 @@ spring:
|
|||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.24.137.203:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.24.137.203:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|||||||
@ -16,10 +16,10 @@ spring:
|
|||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.24.137.203:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.24.137.203:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
@ -35,7 +35,7 @@ spring:
|
|||||||
datasource:
|
datasource:
|
||||||
ds1:
|
ds1:
|
||||||
nacos:
|
nacos:
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.24.137.203:8848
|
||||||
dataId: sentinel-ruoyi-gateway
|
dataId: sentinel-ruoyi-gateway
|
||||||
groupId: DEFAULT_GROUP
|
groupId: DEFAULT_GROUP
|
||||||
data-type: json
|
data-type: json
|
||||||
|
|||||||
@ -14,10 +14,10 @@ spring:
|
|||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.24.137.203:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 118.24.137.203:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|||||||
@ -218,4 +218,11 @@ public interface XhpcChargingStationMapper {
|
|||||||
*/
|
*/
|
||||||
Set<String> getXchargingPileList(@Param("chargingStationId")Long chargingStationId);
|
Set<String> getXchargingPileList(@Param("chargingStationId")Long chargingStationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按照没30分钟为一段进行分组
|
||||||
|
* @param chargingStationId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Map<String,Object>> getXhpcRateTimeNumber(@Param("chargingStationId")Long chargingStationId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
package com.xhpc.charging.station.service;
|
package com.xhpc.charging.station.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.BetweenFormatter;
|
||||||
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.xhpc.common.api.PowerPileService;
|
import com.xhpc.common.api.PowerPileService;
|
||||||
import com.xhpc.common.api.dto.ChargingPileDto;
|
import com.xhpc.common.api.dto.ChargingPileDto;
|
||||||
|
import com.xhpc.common.core.domain.R;
|
||||||
import com.xhpc.common.core.utils.DateUtils;
|
import com.xhpc.common.core.utils.DateUtils;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
|
import com.xhpc.common.data.redis.CacheRateModel;
|
||||||
import com.xhpc.common.domain.XhpcChargingStation;
|
import com.xhpc.common.domain.XhpcChargingStation;
|
||||||
import com.xhpc.common.domain.XhpcRate;
|
import com.xhpc.common.domain.XhpcRate;
|
||||||
import com.xhpc.common.domain.XhpcRateModel;
|
import com.xhpc.common.domain.XhpcRateModel;
|
||||||
@ -20,6 +24,7 @@ import org.springframework.data.annotation.Version;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -244,6 +249,13 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
|||||||
}
|
}
|
||||||
if(xhpcChargingStationDto.getXhpcRateTimeList() ==null && xhpcChargingStationDto.getXhpcRateTimeList().size()==0){
|
if(xhpcChargingStationDto.getXhpcRateTimeList() ==null && xhpcChargingStationDto.getXhpcRateTimeList().size()==0){
|
||||||
return AjaxResult.error(1001,"费率时段不能为空");
|
return AjaxResult.error(1001,"费率时段不能为空");
|
||||||
|
}else{
|
||||||
|
for (int i = 0; i < xhpcChargingStationDto.getXhpcRateTimeList().size(); i++) {
|
||||||
|
String id = xhpcChargingStationDto.getXhpcRateTimeList().get(i).getId();
|
||||||
|
if("00".equals(id)||"01".equals(id)||"02".equals(id)||"03".equals(id)){}else{
|
||||||
|
return AjaxResult.error("1003","费率id格式不对");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
List<XhpcRateTimeDto> xhpcRateTimeList = xhpcChargingStationDto.getXhpcRateTimeList();
|
List<XhpcRateTimeDto> xhpcRateTimeList = xhpcChargingStationDto.getXhpcRateTimeList();
|
||||||
|
|
||||||
@ -251,10 +263,15 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
|||||||
XhpcRateTimeDto xhpcRateTime = xhpcRateTimeList.get(i);
|
XhpcRateTimeDto xhpcRateTime = xhpcRateTimeList.get(i);
|
||||||
String start = xhpcRateTime.getStartTime();
|
String start = xhpcRateTime.getStartTime();
|
||||||
String end = xhpcRateTime.getEndTime();
|
String end = xhpcRateTime.getEndTime();
|
||||||
|
String id = xhpcRateTime.getId();
|
||||||
//检查格式,正则验证 【[0-2][0-9]:[0-6][0]:[0]{2}】
|
//检查格式,正则验证 【[0-2][0-9]:[0-6][0]:[0]{2}】
|
||||||
String pattern ="^([0-2][0-9]:([0]|[3])[0]:[0][0])";
|
String pattern ="^([0-2][0-9]:([0]|[3])[0]:[0][0])";
|
||||||
Pattern compile = Pattern.compile(pattern);
|
Pattern compile = Pattern.compile(pattern);
|
||||||
Matcher m =compile.matcher(start);
|
Matcher m =compile.matcher(start);
|
||||||
|
|
||||||
|
if("00".equals(id)||"01".equals(id)||"02".equals(id)||"03".equals(id)){}else{
|
||||||
|
return AjaxResult.error("1003","费率id格式不对");
|
||||||
|
}
|
||||||
boolean isMatch = m.matches();
|
boolean isMatch = m.matches();
|
||||||
if(!isMatch){
|
if(!isMatch){
|
||||||
return AjaxResult.error("1003","时间格式不对");
|
return AjaxResult.error("1003","时间格式不对");
|
||||||
@ -339,6 +356,9 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
|||||||
}
|
}
|
||||||
//默认费率类型值
|
//默认费率类型值
|
||||||
String rateValue =xhpcChargingStationDto.getDefaultPeriodId();
|
String rateValue =xhpcChargingStationDto.getDefaultPeriodId();
|
||||||
|
|
||||||
|
String[] tfPricesSeq = new String[48];
|
||||||
|
int number =0;
|
||||||
int sort =1;
|
int sort =1;
|
||||||
for (int k = 0; k < list.size(); k++) {
|
for (int k = 0; k < list.size(); k++) {
|
||||||
XhpcRateTimeDto xhpcRateTimeDto = list.get(k);
|
XhpcRateTimeDto xhpcRateTimeDto = list.get(k);
|
||||||
@ -351,34 +371,137 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
|||||||
if(!"00:00:00".equals(xhpcRateTimeDto.getStartTime())){
|
if(!"00:00:00".equals(xhpcRateTimeDto.getStartTime())){
|
||||||
//添加一条默认费率时段
|
//添加一条默认费率时段
|
||||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,"00:00:00",startTime,sort,2,rateValue);
|
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,"00:00:00",startTime,sort,2,rateValue);
|
||||||
|
//时间差
|
||||||
|
long betweenDay = DateUtil.between(DateUtil.parse("00:00:00"), DateUtil.parse(startTime), DateUnit.SECOND);
|
||||||
|
int day1 = Math.toIntExact(betweenDay / 1800);
|
||||||
|
for (int l = 0; l < day1; l++) {
|
||||||
|
tfPricesSeq[number] =rateValue;
|
||||||
|
number=number+1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//并把本条数据也添加上
|
//并把本条数据也添加上
|
||||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues);
|
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues);
|
||||||
|
//时间差
|
||||||
|
long betweenDay = DateUtil.between(DateUtil.parse(startTime), DateUtil.parse(endTime), DateUnit.SECOND);
|
||||||
|
int day2 = Math.toIntExact(betweenDay / 1800);
|
||||||
|
for (int l = 0; l < day2; l++) {
|
||||||
|
tfPricesSeq[number] =rateValues;
|
||||||
|
number=number+1;
|
||||||
|
}
|
||||||
}else if(k<list.size()){
|
}else if(k<list.size()){
|
||||||
//判断上条数据的结束时间是否等于现在这条数据的开始时间,不等于添加一条默认费率时段
|
//判断上条数据的结束时间是否等于现在这条数据的开始时间,不等于添加一条默认费率时段
|
||||||
String endTimeK = list.get(k - 1).getEndTime();
|
String endTimeK = list.get(k - 1).getEndTime();
|
||||||
if(!endTimeK.equals(startTime)){
|
if(!endTimeK.equals(startTime)){
|
||||||
//添加一条默认费率时段
|
//添加一条默认费率时段
|
||||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,endTimeK,startTime,sort,2,rateValue);
|
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,endTimeK,startTime,sort,2,rateValue);
|
||||||
|
//时间差
|
||||||
|
long betweenDay = DateUtil.between(DateUtil.parse(endTimeK), DateUtil.parse(startTime), DateUnit.SECOND);
|
||||||
|
int day3 = Math.toIntExact(betweenDay / 1800);
|
||||||
|
for (int l = 0; l < day3; l++) {
|
||||||
|
tfPricesSeq[number] =rateValue;
|
||||||
|
number=number+1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//并把本条数据也添加上
|
//并把本条数据也添加上
|
||||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues);
|
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues);
|
||||||
|
//时间差
|
||||||
|
long betweenDay = DateUtil.between(DateUtil.parse(startTime), DateUtil.parse(endTime), DateUnit.SECOND);
|
||||||
|
int day4 = Math.toIntExact(betweenDay / 1800);
|
||||||
|
for (int l = 0; l < day4; l++) {
|
||||||
|
tfPricesSeq[number] =rateValues;
|
||||||
|
number=number+1;
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
String endTimeK = list.get(k - 1).getEndTime();
|
String endTimeK = list.get(k - 1).getEndTime();
|
||||||
if(!endTimeK.equals(startTime)){
|
if(!endTimeK.equals(startTime)){
|
||||||
//添加一条默认费率时段
|
//添加一条默认费率时段
|
||||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,endTimeK,startTime,sort,2,rateValue);
|
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,endTimeK,startTime,sort,2,rateValue);
|
||||||
|
//时间差
|
||||||
|
long betweenDay = DateUtil.between(DateUtil.parse(endTimeK), DateUtil.parse(startTime), DateUnit.SECOND);
|
||||||
|
int day5 = Math.toIntExact(betweenDay / 1800);
|
||||||
|
for (int l = 0; l < day5; l++) {
|
||||||
|
tfPricesSeq[number] =rateValue;
|
||||||
|
number=number+1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//并把本条数据也添加上
|
//并把本条数据也添加上
|
||||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues);
|
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues);
|
||||||
|
//时间差
|
||||||
|
long betweenDay1 = DateUtil.between(DateUtil.parse(startTime), DateUtil.parse(endTime), DateUnit.SECOND);
|
||||||
|
int day6 = Math.toIntExact(betweenDay1 / 1800);
|
||||||
|
for (int l = 0; l < day6; l++) {
|
||||||
|
tfPricesSeq[number] =rateValues;
|
||||||
|
number=number+1;
|
||||||
|
}
|
||||||
if(!endTime.equals("24:00:00")){
|
if(!endTime.equals("24:00:00")){
|
||||||
//添加一条默认费率时段
|
//添加一条默认费率时段
|
||||||
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,startTime,"24:00:00",sort,2,rateValue);
|
sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,startTime,"24:00:00",sort,2,rateValue);
|
||||||
|
//时间差
|
||||||
|
long betweenDay3 = DateUtil.between(DateUtil.parse(startTime), DateUtil.parse("24:00:00"), DateUnit.SECOND);
|
||||||
|
int day7 = Math.toIntExact(betweenDay3 / 1800);
|
||||||
|
for (int l = 0; l < day7; l++) {
|
||||||
|
tfPricesSeq[number] =rateValue;
|
||||||
|
number=number+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置费率模型
|
||||||
|
CacheRateModel cacheRateModel = new CacheRateModel();
|
||||||
|
cacheRateModel.setLossRate(0);
|
||||||
|
BigDecimal valueSec =new BigDecimal(100000);
|
||||||
|
boolean t1 =true;
|
||||||
|
boolean t2 =true;
|
||||||
|
boolean t3 =true;
|
||||||
|
boolean t4 =true;
|
||||||
|
for (XhpcRateDto xhpcRateDto:xhpcRateList) {
|
||||||
|
BigDecimal powerFee=xhpcRateDto.getPowerFee();
|
||||||
|
BigDecimal serviceFee=xhpcRateDto.getServiceFee();
|
||||||
|
String id =xhpcRateDto.getId();
|
||||||
|
int i1 = powerFee.multiply(valueSec).intValue();
|
||||||
|
int i2 = serviceFee.multiply(valueSec).intValue();
|
||||||
|
if("00".equals(id)){
|
||||||
|
cacheRateModel.setT1Price(i1);
|
||||||
|
cacheRateModel.setT1SvcPrice(i2);
|
||||||
|
t1=false;
|
||||||
|
}else if("01".equals(id)){
|
||||||
|
cacheRateModel.setT2Price(i1);
|
||||||
|
cacheRateModel.setT2SvcPrice(i2);
|
||||||
|
t2=false;
|
||||||
|
}else if("02".equals(id)){
|
||||||
|
cacheRateModel.setT3Price(i1);
|
||||||
|
cacheRateModel.setT3SvcPrice(i2);
|
||||||
|
t3=false;
|
||||||
|
}else if("03".equals(id)){
|
||||||
|
cacheRateModel.setT4Price(i1);
|
||||||
|
cacheRateModel.setT4SvcPrice(i2);
|
||||||
|
t4=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(t1){
|
||||||
|
cacheRateModel.setT1Price(0);
|
||||||
|
cacheRateModel.setT1SvcPrice(0);
|
||||||
|
}
|
||||||
|
if(t2){
|
||||||
|
cacheRateModel.setT2Price(0);
|
||||||
|
cacheRateModel.setT2SvcPrice(0);
|
||||||
|
}
|
||||||
|
if(t3){
|
||||||
|
cacheRateModel.setT3Price(0);
|
||||||
|
cacheRateModel.setT3SvcPrice(0);
|
||||||
|
}
|
||||||
|
if(t4){
|
||||||
|
cacheRateModel.setT4Price(0);
|
||||||
|
cacheRateModel.setT4SvcPrice(0);
|
||||||
|
}
|
||||||
|
cacheRateModel.setTfPricesSeq(tfPricesSeq);
|
||||||
|
|
||||||
|
R r = powerPileService.setStationRateModel(chargingStationId, rateModelId, cacheRateModel);
|
||||||
|
System.out.println(r.toString());
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 场站详情接口
|
* 场站详情接口
|
||||||
* @param chargingStationId
|
* @param chargingStationId
|
||||||
@ -429,7 +552,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
|||||||
xhpcRateTime.setType(type);
|
xhpcRateTime.setType(type);
|
||||||
xhpcRateTime.setRateValue(rateValue);
|
xhpcRateTime.setRateValue(rateValue);
|
||||||
xhpcChargingStationMapper.addXhpcRateTime(xhpcRateTime);
|
xhpcChargingStationMapper.addXhpcRateTime(xhpcRateTime);
|
||||||
sort++;
|
sort=sort+1;
|
||||||
return sort;
|
return sort;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -747,4 +870,14 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
//时间差
|
||||||
|
long betweenDay = DateUtil.between(DateUtil.parse("00:00:00"), DateUtil.parse("10:00:00"), DateUnit.SECOND);
|
||||||
|
|
||||||
|
System.out.println("betweenDay:"+betweenDay);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -293,6 +293,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
te.name as name,
|
te.name as name,
|
||||||
cp.power as power,
|
cp.power as power,
|
||||||
cp.auxiliary_power_supply as auxiliaryPowerSupply,
|
cp.auxiliary_power_supply as auxiliaryPowerSupply,
|
||||||
|
cp.serial_number as serialNumber,
|
||||||
cp.input_voltage as inputVoltage
|
cp.input_voltage as inputVoltage
|
||||||
from xhpc_terminal as te
|
from xhpc_terminal as te
|
||||||
left join xhpc_charging_pile as cp on cp.charging_pile_id = te.charging_pile_id
|
left join xhpc_charging_pile as cp on cp.charging_pile_id = te.charging_pile_id
|
||||||
@ -679,9 +680,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
select
|
select
|
||||||
power_fee as powerFee,
|
power_fee as powerFee,
|
||||||
service_fee as serviceFee,
|
service_fee as serviceFee,
|
||||||
name as name
|
name as name,
|
||||||
|
rate_value as rateValue
|
||||||
from xhpc_rate
|
from xhpc_rate
|
||||||
where charging_station_id=#{chargingStationId} and del_flag =0
|
where charging_station_id=#{chargingStationId} and del_flag =0
|
||||||
|
GROUP BY rate_value
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getXhpcRateTimeTypeList" resultType="java.util.Map">
|
<select id="getXhpcRateTimeTypeList" resultType="java.util.Map">
|
||||||
@ -732,4 +735,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
from xhpc_charging_pile
|
from xhpc_charging_pile
|
||||||
where charging_station_id=#{chargingStationId} and del_flag =0 and status =0
|
where charging_station_id=#{chargingStationId} and del_flag =0 and status =0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getXhpcRateTimeNumber" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
CAST(((UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(start_time))/1800) AS SIGNED) as number,
|
||||||
|
rate_value as rateValue
|
||||||
|
FROM
|
||||||
|
xhpc_rate_time
|
||||||
|
where charging_station_id=#{chargingStationId}
|
||||||
|
order by sort
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -255,6 +255,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
ter.name as terminalName,
|
ter.name as terminalName,
|
||||||
ter.serial_number as serialNumber,
|
ter.serial_number as serialNumber,
|
||||||
cp.power as power,
|
cp.power as power,
|
||||||
|
cp.type as type,
|
||||||
cp.max_voltage as maxVoltage,
|
cp.max_voltage as maxVoltage,
|
||||||
cp.auxiliary_power_supply as auxiliaryPowerSupply,
|
cp.auxiliary_power_supply as auxiliaryPowerSupply,
|
||||||
ct.parking_instructions as parkingInstructions,
|
ct.parking_instructions as parkingInstructions,
|
||||||
|
|||||||
@ -1,55 +1,44 @@
|
|||||||
package com.xhpc;
|
package com.xhpc;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
|
||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
|
||||||
import org.springframework.boot.jackson.JsonComponent;
|
import org.springframework.boot.jackson.JsonComponent;
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.TimeZone;
|
|
||||||
|
|
||||||
@JsonComponent
|
@JsonComponent
|
||||||
public class DateFormatConfig {
|
public class DateFormatConfig {
|
||||||
|
//
|
||||||
@Value("${spring.jackson.date-format:yyyy-MM-dd HH:mm:ss}")
|
// @Value("${spring.jackson.date-format:yyyy-MM-dd HH:mm:ss}")
|
||||||
private String pattern;
|
// private String pattern;
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @author xiaofu
|
// * @author xiaofu
|
||||||
* @description date 类型全局时间格式化
|
// * @description date 类型全局时间格式化
|
||||||
* @date 2020/8/31 18:22
|
// * @date 2020/8/31 18:22
|
||||||
*/
|
// */
|
||||||
@Bean
|
// @Bean
|
||||||
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilder() {
|
// public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilder() {
|
||||||
|
//
|
||||||
return builder -> {
|
// return builder -> {
|
||||||
TimeZone tz = TimeZone.getTimeZone("UTC");
|
// TimeZone tz = TimeZone.getTimeZone("UTC");
|
||||||
DateFormat df = new SimpleDateFormat(pattern);
|
// DateFormat df = new SimpleDateFormat(pattern);
|
||||||
df.setTimeZone(tz);
|
// df.setTimeZone(tz);
|
||||||
builder.failOnEmptyBeans(false)
|
// builder.failOnEmptyBeans(false)
|
||||||
.failOnUnknownProperties(false)
|
// .failOnUnknownProperties(false)
|
||||||
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
// .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
||||||
.dateFormat(df);
|
// .dateFormat(df);
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @author xiaofu
|
// * @author xiaofu
|
||||||
* @description LocalDate 类型全局时间格式化
|
// * @description LocalDate 类型全局时间格式化
|
||||||
* @date 2020/8/31 18:22
|
// * @date 2020/8/31 18:22
|
||||||
*/
|
// */
|
||||||
@Bean
|
// @Bean
|
||||||
public LocalDateTimeSerializer localDateTimeDeserializer() {
|
// public LocalDateTimeSerializer localDateTimeDeserializer() {
|
||||||
return new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(pattern));
|
// return new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(pattern));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Bean
|
// @Bean
|
||||||
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer(LocalDateTimeSerializer localDateTimeDeserializer) {
|
// public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer(LocalDateTimeSerializer localDateTimeDeserializer) {
|
||||||
return builder -> builder.serializerByType(LocalDateTime.class, localDateTimeDeserializer);
|
// return builder -> builder.serializerByType(LocalDateTime.class, localDateTimeDeserializer);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
@ -6,6 +6,7 @@ import com.xhpc.common.core.domain.R;
|
|||||||
import com.xhpc.common.api.factory.PowerPileFallbackFactory;
|
import com.xhpc.common.api.factory.PowerPileFallbackFactory;
|
||||||
import com.xhpc.common.data.down.StartChargingData;
|
import com.xhpc.common.data.down.StartChargingData;
|
||||||
import com.xhpc.common.data.redis.CacheRateModel;
|
import com.xhpc.common.data.redis.CacheRateModel;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
@ -28,6 +29,6 @@ public interface PowerPileService {
|
|||||||
R deletePileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set<String> pileNoSet);
|
R deletePileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set<String> pileNoSet);
|
||||||
|
|
||||||
@PostMapping("/station/rateModel/{stationId}/{rateModelId}")
|
@PostMapping("/station/rateModel/{stationId}/{rateModelId}")
|
||||||
R setStationRateModel(@PathVariable("stationId") Long stationId, @PathVariable("rateModelId") Long rateModelId, @RequestBody CacheRateModel rateModel);
|
R setStationRateModel(@PathVariable("stationId") @Param("stationId") Long stationId, @PathVariable("rateModelId") @Param("rateModelId") Long rateModelId, @RequestBody @Param("rateModel") CacheRateModel rateModel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,7 +89,7 @@ public class ChargingController {
|
|||||||
clientHandler.sendClientBinary(msg);
|
clientHandler.sendClientBinary(msg);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
log.error("send message failed. " + e.getMessage(), e);
|
||||||
return R.fail(e.getMessage());
|
return R.fail(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static com.xhpc.pp.server.ChargingPileServer.REDIS;
|
import static com.xhpc.pp.server.ChargingPileServer.REDIS;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -18,12 +20,16 @@ public class StationController {
|
|||||||
|
|
||||||
String skey = "station:".concat(stationId.toString());
|
String skey = "station:".concat(stationId.toString());
|
||||||
ChargingStationDto cacheStation = REDIS.getCacheObject(skey);
|
ChargingStationDto cacheStation = REDIS.getCacheObject(skey);
|
||||||
|
if (cacheStation==null) cacheStation = new ChargingStationDto();
|
||||||
cacheStation.setRateModelId(rateModelId);
|
cacheStation.setRateModelId(rateModelId);
|
||||||
REDIS.setCacheObject(skey, cacheStation);
|
REDIS.setCacheObject(skey, cacheStation);
|
||||||
String rkey = "rateModel:".concat(rateModelId.toString());
|
String rkey = "rateModel:".concat(rateModelId.toString());
|
||||||
REDIS.setCacheObject(rkey, rateModel);
|
REDIS.setCacheObject(rkey, rateModel);
|
||||||
String rmskey = "rateModelStation:".concat(stationId.toString());
|
String rmskey = "rateModelStation:".concat(stationId.toString());
|
||||||
REDIS.setCacheSet(rmskey, cacheStation.getPiles());
|
Set<String> piles = cacheStation.getPiles();
|
||||||
|
if (piles!=null) {
|
||||||
|
REDIS.setCacheSet(rmskey, piles);
|
||||||
|
}
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user