修改数据权限、修改BMS电流计算问题
This commit is contained in:
parent
b20365948e
commit
f5b70781bd
@ -1,4 +1,4 @@
|
||||
# Tomcat 9009 不走推送 name: evcs 9099走推送 name: jp 120.26.46.180:8858
|
||||
# Tomcat 9009 不走推送 name: evcs 9099走推送 name: jp mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server:
|
||||
port: 9099
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -16,10 +16,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
@ -35,7 +35,7 @@ spring:
|
||||
datasource:
|
||||
ds1:
|
||||
nacos:
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
dataId: sentinel-ruoyi-gateway
|
||||
groupId: DEFAULT_GROUP
|
||||
data-type: json
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -146,5 +146,7 @@ public class XhpcWorkStationDomain implements Serializable {
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
private Long chargingStationId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -18,7 +18,12 @@ import com.xhpc.common.api.SmsService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.exception.CustomException;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.system.api.domain.SysUser;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -53,10 +58,33 @@ public class WorkOrderServiceImpl implements WorkOrderService {
|
||||
WorkUserService workUserService;
|
||||
@Resource
|
||||
WorkTypeService typeService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Override
|
||||
public List<Map<String, Object>> getOrderPage(Map<String, Object> params) {
|
||||
return orderMapper.findOrderListByParams(params);
|
||||
LoginUser loginUser = tokenService.getLoginUser();
|
||||
Long sysUserId = loginUser.getUserid();
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
//获取登陆用户
|
||||
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
|
||||
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
params.put("type", 1);
|
||||
params.put("userId", logOperatorId);
|
||||
|
||||
//运营商看自己的场站
|
||||
return deviceMapper.selectStationGunDeviceListByParams(params);
|
||||
}else{
|
||||
params.put("type", 2);
|
||||
params.put("userId", sysUserId);
|
||||
//查询赋值的场站
|
||||
return deviceMapper.selectStationGunDeviceListByParams(params);
|
||||
}
|
||||
}else{
|
||||
params.put("type", 0);
|
||||
params.put("userId", sysUserId);
|
||||
return deviceMapper.selectStationGunDeviceListByParams(params);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -3,6 +3,7 @@ package com.xhpc.activity.service.impl;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.xhpc.common.core.exception.CustomException;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.web.service.BaseService;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.activity.domain.XhpcStationDeviceDomain;
|
||||
import com.xhpc.activity.domain.XhpcWorkStationDomain;
|
||||
@ -10,10 +11,16 @@ import com.xhpc.activity.mapper.XhpcStationDeviceMapper;
|
||||
import com.xhpc.activity.mapper.XhpcWorkStationMapper;
|
||||
import com.xhpc.activity.service.WorkStationService;
|
||||
import com.xhpc.activity.vo.XhpcStationDeviceVo;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.system.api.domain.SysUser;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -21,7 +28,7 @@ import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class WorkStationServiceImpl implements WorkStationService {
|
||||
public class WorkStationServiceImpl extends BaseService implements WorkStationService {
|
||||
|
||||
@Resource
|
||||
XhpcStationDeviceMapper deviceMapper;
|
||||
@ -31,7 +38,8 @@ public class WorkStationServiceImpl implements WorkStationService {
|
||||
|
||||
@Resource
|
||||
RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
private int getTerminalStatus(String serialNumber) {
|
||||
//0离线 1故障 2空闲 3充电 4 已插枪 5未知
|
||||
@ -65,8 +73,30 @@ public class WorkStationServiceImpl implements WorkStationService {
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getStationDevice(Map<String, Object> params){
|
||||
LoginUser loginUser = tokenService.getLoginUser();
|
||||
Long sysUserId = loginUser.getUserid();
|
||||
List<Map<String, Object>> deviceList = new ArrayList<>();
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
//获取登陆用户
|
||||
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
|
||||
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
params.put("type", 1);
|
||||
params.put("userId", logOperatorId);
|
||||
|
||||
List<Map<String, Object>> deviceList = deviceMapper.selectStationGunDeviceListByParams(params);
|
||||
//运营商看自己的场站
|
||||
deviceList =deviceMapper.selectStationGunDeviceListByParams(params);
|
||||
}else{
|
||||
params.put("type", 2);
|
||||
params.put("userId", sysUserId);
|
||||
//查询赋值的场站
|
||||
deviceList=deviceMapper.selectStationGunDeviceListByParams(params);
|
||||
}
|
||||
}else{
|
||||
params.put("type", 0);
|
||||
params.put("userId", sysUserId);
|
||||
deviceList=deviceMapper.selectStationGunDeviceListByParams(params);
|
||||
}
|
||||
for(Map<String, Object> map : deviceList){
|
||||
//状态
|
||||
int pileSerialNumber = getTerminalStatus(map.get("gunSerialNumber").toString());
|
||||
@ -84,7 +114,30 @@ public class WorkStationServiceImpl implements WorkStationService {
|
||||
|
||||
@Override
|
||||
public List<XhpcWorkStationDomain> getStationList(Map<String, Object> params){
|
||||
LoginUser loginUser = tokenService.getLoginUser();
|
||||
Long sysUserId = loginUser.getUserid();
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
//获取登陆用户
|
||||
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
|
||||
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
params.put("type", 1);
|
||||
params.put("userId", logOperatorId);
|
||||
|
||||
//运营商看自己的场站
|
||||
return stationMapper.selectListByParams(params);
|
||||
}else{
|
||||
params.put("type", 2);
|
||||
params.put("userId", sysUserId);
|
||||
//查询赋值的场站
|
||||
return stationMapper.selectListByParams(params);
|
||||
}
|
||||
}else{
|
||||
params.put("type", 0);
|
||||
params.put("userId", sysUserId);
|
||||
return stationMapper.selectListByParams(params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -177,16 +177,23 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc
|
||||
domain.setStatus(99);
|
||||
checkoutMapper.insert(domain);
|
||||
|
||||
executorService.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (StringUtils.isEmpty(domain.getClearingOrderIds())) {
|
||||
asyncService.updateCheckoutByOperatorAsync(domain.getOperatorId(), domain.getClearingCheckoutId());
|
||||
} else {
|
||||
asyncService.updateCheckoutByOrderIdsAsync(domain.getClearingOrderIds(), domain.getClearingCheckoutId());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// executorService.execute(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// if (StringUtils.isEmpty(domain.getClearingOrderIds())) {
|
||||
// asyncService.updateCheckoutByOperatorAsync(domain.getOperatorId(), domain.getClearingCheckoutId());
|
||||
// } else {
|
||||
// asyncService.updateCheckoutByOrderIdsAsync(domain.getClearingOrderIds(), domain.getClearingCheckoutId());
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -108,21 +108,21 @@ public class XhpcClearingHistoryOrderServiceImpl extends BaseService implements
|
||||
params.put("chargingPileId", orderVo.getChargingPileId());
|
||||
params.put("terminalId", orderVo.getTerminalId());
|
||||
|
||||
// List<XhpcClearingHistoryOrderDomain> orderDomainList = historyOrderMapper.getListPage(params);
|
||||
// String orderIds = orderDomainList.stream().map(n -> n.getClearingOrderId().toString()).collect(Collectors.joining(","));
|
||||
//
|
||||
// if (StringUtils.isNotEmpty(orderIds)){
|
||||
// asyncService.updateCheckStatusAsync(orderIds, orderVo.getStatus(), orderVo.getCheckBy());
|
||||
List<XhpcClearingHistoryOrderDomain> orderDomainList = historyOrderMapper.getListPage(params);
|
||||
String orderIds = orderDomainList.stream().map(n -> n.getClearingOrderId().toString()).collect(Collectors.joining(","));
|
||||
|
||||
if (StringUtils.isNotEmpty(orderIds)){
|
||||
asyncService.updateCheckStatusAsync(orderIds, orderVo.getStatus(), orderVo.getCheckBy());
|
||||
}
|
||||
// executorService.execute(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// String clearingOrderIds = historyOrderMapper.getClearingOrderIds(params);
|
||||
// if (StringUtils.isNotEmpty(clearingOrderIds)){
|
||||
// asyncService.updateCheckStatusAsync(clearingOrderIds, orderVo.getStatus(), orderVo.getCheckBy());
|
||||
// }
|
||||
executorService.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String clearingOrderIds = historyOrderMapper.getClearingOrderIds(params);
|
||||
if (StringUtils.isNotEmpty(clearingOrderIds)){
|
||||
asyncService.updateCheckStatusAsync(clearingOrderIds, orderVo.getStatus(), orderVo.getCheckBy());
|
||||
}
|
||||
}
|
||||
});
|
||||
// }
|
||||
// });
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -1,13 +1,17 @@
|
||||
package com.xhpc.activity.task;
|
||||
|
||||
|
||||
import com.xhpc.common.util.DateUtil;
|
||||
import com.xhpc.activity.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.common.util.DateUtil;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
|
||||
@Component
|
||||
public class AutoClearDataTask {
|
||||
@ -22,8 +26,29 @@ public class AutoClearDataTask {
|
||||
@Scheduled(cron = "0 0 5 * * ?")
|
||||
private void autoClearDeviceMessageData(){
|
||||
|
||||
String date = DateUtil.date2String(DateUtil.addDay(new Date(), -7), "yyyy-MM-dd");
|
||||
String date = DateUtil.date2String(DateUtil.addDay(new Date(), -3), "yyyy-MM-dd");
|
||||
messageMapper.deleteMessageByDate(date);
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0/10 * * * ? ")
|
||||
private void getNotificationPlaceholderOrderInfo(){
|
||||
String orderKey = "notificationPlaceholderOrderInfo:*";
|
||||
|
||||
Collection<String> orderKeys = REDIS.keys(orderKey);
|
||||
for (String okey : orderKeys) {
|
||||
REDIS.deleteObject(okey);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String substring = "notificationPlaceholderOrderInfo:80836000010001012505142200439549".substring(49, 57);
|
||||
|
||||
System.out.println("substring="+substring);
|
||||
|
||||
String format = cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetDay(new Date(), -3), "yyMMdd");
|
||||
|
||||
System.out.println("format="+format);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ public class SyncHistoryOrderTask {
|
||||
@Scheduled(cron = "0 0 0/1 * * ?")
|
||||
@Transactional
|
||||
@GetMapping("/syncTask")
|
||||
void ExpiredTenantStatusTask() {
|
||||
public void ExpiredTenantStatusTask() {
|
||||
System.out.println(" ============== 自动同步订单到清分 开始 ==========================");
|
||||
|
||||
try {
|
||||
|
||||
@ -19,10 +19,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -67,6 +67,12 @@
|
||||
<if test="params.tenantId!=null and params.tenantId!=''">
|
||||
and s.tenant_id=#{params.tenantId}
|
||||
</if>
|
||||
<if test="params.type==1">
|
||||
and s.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{params.userId})
|
||||
</if>
|
||||
<if test="params.type==2">
|
||||
and s.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{params.userId})
|
||||
</if>
|
||||
GROUP BY d2.device_id
|
||||
order by s.work_station_id, d1.device_type,d1.device_id, d1.sorted, d2.device_type,d2.device_id, d2.sorted
|
||||
</select>
|
||||
|
||||
@ -29,13 +29,14 @@
|
||||
<result column="service_tel" jdbcType="VARCHAR" property="serviceTel" />
|
||||
<result column="park_nums" jdbcType="INTEGER" property="parkNums" />
|
||||
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
|
||||
<result column="charging_station_id" jdbcType="VARCHAR" property="chargingStationId" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
work_station_id, `name`, operator_id, `type`, construction_site, service_facilities,
|
||||
periphery_facilities, address, detailed_address, longitude, latitude, parking_instructions,
|
||||
serial_number, `status`, del_flag, create_time, create_by, update_time, update_by,
|
||||
remark, business_instructions, reminder_instructions, img_id, station_type, service_tel,
|
||||
park_nums, tenant_id
|
||||
park_nums, tenant_id,charging_station_id
|
||||
</sql>
|
||||
|
||||
<select id="selectListByParams" resultType="com.xhpc.activity.domain.XhpcWorkStationDomain">
|
||||
@ -46,6 +47,12 @@
|
||||
<if test="params.name != null and params.name !=''">
|
||||
and name like concat('%', #{params.name}, '%')
|
||||
</if>
|
||||
<if test="params.type==1">
|
||||
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{params.userId})
|
||||
</if>
|
||||
<if test="params.type==2">
|
||||
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{params.userId})
|
||||
</if>
|
||||
<if test="params.tenantId!=null and params.tenantId!=''">
|
||||
and tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
@ -112,7 +119,7 @@
|
||||
create_by, update_time, update_by,
|
||||
remark, business_instructions, reminder_instructions,
|
||||
img_id, station_type, service_tel,
|
||||
park_nums, tenant_id)
|
||||
park_nums, tenant_id,charging_station_id)
|
||||
values (#{name,jdbcType=VARCHAR}, #{operatorId,jdbcType=BIGINT}, #{type,jdbcType=INTEGER},
|
||||
#{constructionSite,jdbcType=SMALLINT}, #{serviceFacilities,jdbcType=VARCHAR}, #{peripheryFacilities,jdbcType=VARCHAR},
|
||||
#{address,jdbcType=VARCHAR}, #{detailedAddress,jdbcType=VARCHAR}, #{longitude,jdbcType=VARCHAR},
|
||||
@ -121,7 +128,7 @@
|
||||
#{createBy,jdbcType=VARCHAR}, sysdate(), #{updateBy,jdbcType=VARCHAR},
|
||||
#{remark,jdbcType=VARCHAR}, #{businessInstructions,jdbcType=VARCHAR}, #{reminderInstructions,jdbcType=VARCHAR},
|
||||
#{imgId,jdbcType=VARCHAR}, #{stationType,jdbcType=SMALLINT}, #{serviceTel,jdbcType=VARCHAR},
|
||||
#{parkNums,jdbcType=INTEGER}, #{tenantId,jdbcType=VARCHAR})
|
||||
#{parkNums,jdbcType=INTEGER}, #{tenantId,jdbcType=VARCHAR}, #{chargingStationId,jdbcType=BIGINT})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="work_station_id" keyProperty="workStationId" parameterType="com.xhpc.activity.domain.XhpcWorkStationDomain" useGeneratedKeys="true">
|
||||
insert into xhpc_work_station
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -147,7 +147,7 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha
|
||||
}else{
|
||||
Map<String, Object> map = (Map<String, Object>)r1.getData();
|
||||
if(map !=null){
|
||||
if(!map.get("stationPileQuote").equals("-1")){
|
||||
if(!map.get("stationPileQuote").toString().equals("-1")){
|
||||
int count = xhpcChargingPileMapper.getCountXhpcChargingPile(chargingStationId,loginUser.getTenantId());
|
||||
if(Integer.parseInt(map.get("stationPileQuote").toString())<count){
|
||||
return AjaxResult.error(1001, "桩已达到限额,如要在创建桩请联系管理员");
|
||||
|
||||
@ -271,7 +271,7 @@ public class XhpcPlaceholderServiceImpl extends BaseService implements IXhpcPlac
|
||||
addXhpcPlaceholderTime("00:00:00",start,price,placeholderId,chargingStationId);
|
||||
}
|
||||
addXhpcPlaceholderTime(start,end,rateValue,placeholderId,chargingStationId);
|
||||
if(!endTime.equals("24:00:00")) {
|
||||
if(!("24:00:00").equals(xhpcPlaceholderTimeDto.getEndTime())) {
|
||||
if(rateValue ==null || "".equals(rateValue)){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return R.fail("1004", "请填写默认时间段费率");
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -622,7 +622,7 @@
|
||||
<select id="getPlaceholderTimeMassage" resultType="map">
|
||||
select
|
||||
start_time as startTime,
|
||||
replace(end_time, '00:00:00', '24:00:00') as endTime,
|
||||
replace(end_time, '00:00:00', '23:59:59') as endTime,
|
||||
price as price
|
||||
from xhpc_placeholder_time
|
||||
where charging_station_id=#{chargingStationId} and del_flag =0
|
||||
@ -632,11 +632,11 @@
|
||||
select
|
||||
price as placeholderPrice,
|
||||
start_time as placeholderStartTime,
|
||||
end_time as placeholderEndTime
|
||||
replace(end_time, '00:00:00', '23:59:59') as placeholderEndTime
|
||||
from xhpc_placeholder_time
|
||||
where charging_station_id = #{datchargingStationId}
|
||||
and start_time <= #{date}
|
||||
and replace(end_time, '00:00:00', '24:00:00') >= #{date}
|
||||
and replace(end_time, '00:00:00', '23:59:59') >= #{date}
|
||||
and del_flag = 0
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
@ -365,7 +365,6 @@
|
||||
cp.auxiliary_power_supply as auxiliaryPowerSupply,
|
||||
ct.parking_instructions as parkingInstructions,
|
||||
ct.create_time as createTime,
|
||||
xp.content as content,
|
||||
xp.max_fee as maxFee,
|
||||
xp.free_time as freeTime,
|
||||
ter.charging_station_id as chargingStationId
|
||||
@ -437,11 +436,11 @@
|
||||
select
|
||||
price as placeholderPrice,
|
||||
start_time as placeholderStartTime,
|
||||
end_time as placeholderEndTime
|
||||
replace(end_time, '00:00:00', '23:59:59') as placeholderEndTime
|
||||
from xhpc_placeholder_time
|
||||
where charging_station_id = #{datchargingStationId}
|
||||
and start_time <= #{date}
|
||||
and replace(end_time, '00:00:00', '24:00:00') >= #{date}
|
||||
and replace(end_time, '00:00:00', '23:59:59') >= #{date}
|
||||
and del_flag = 0
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
package com.xhpc.pp.utils;
|
||||
|
||||
/**
|
||||
* 电流算法
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-06-06 11:02
|
||||
*/
|
||||
public class BMSCurrentParser {
|
||||
/**
|
||||
* 解析BMS电流需求值
|
||||
* @param hexString 2字节十六进制字符串(小端序),如"18FC"
|
||||
* @return 电流值(单位:A)
|
||||
*/
|
||||
public static double parseBmsCurrent(String hexString,int number) {
|
||||
// 验证输入格式
|
||||
if (hexString == null || hexString.length() != 4) {
|
||||
throw new IllegalArgumentException("输入必须是4位十六进制字符串");
|
||||
}
|
||||
|
||||
try {
|
||||
// 解析低字节(前2位字符)
|
||||
int lowByte = Integer.parseInt(hexString.substring(0, 2), 16);
|
||||
// 解析高字节(后2位字符)
|
||||
int highByte = Integer.parseInt(hexString.substring(2, 4), 16);
|
||||
|
||||
// 组合为16位无符号整数(小端序)
|
||||
int unsignedValue = (highByte << 8) | lowByte;
|
||||
|
||||
// 转换为有符号16位整数
|
||||
int signedValue = unsignedValue;
|
||||
if (unsignedValue >= 32768) {
|
||||
signedValue = unsignedValue - 65536;
|
||||
}
|
||||
|
||||
// 应用单位换算和偏移量
|
||||
return (signedValue * 0.1) - number;
|
||||
} catch (NumberFormatException e) {
|
||||
throw new IllegalArgumentException("无效的十六进制格式");
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -86,7 +86,7 @@ public class XhpcPlaceholderOrderController extends BaseController {
|
||||
}
|
||||
|
||||
//定时任务,查询状态
|
||||
@Scheduled(cron = "0/30 * * * * ? ")
|
||||
//@Scheduled(cron = "0/30 * * * * ? ")
|
||||
public void getxhpcPlaceholderOrderTime() {
|
||||
xhpcPlaceholderOrderService.getTimingPriceTime();
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.service.BaseService;
|
||||
import com.xhpc.common.domain.XhpcPlaceholderTime;
|
||||
import com.xhpc.common.enums.StopReasonEnum;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
@ -38,7 +39,7 @@ import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
* @Date 2025-05-06 10:07
|
||||
*/
|
||||
@Service
|
||||
public class XhpcPlaceholderOrderServiceImpl implements IXhpcPlaceholderOrderService {
|
||||
public class XhpcPlaceholderOrderServiceImpl extends BaseService implements IXhpcPlaceholderOrderService {
|
||||
|
||||
@Resource
|
||||
XhpcPlaceholderOrderMapper xhpcPlaceholderOrderMapper;
|
||||
@ -75,7 +76,9 @@ public class XhpcPlaceholderOrderServiceImpl implements IXhpcPlaceholderOrderSer
|
||||
|
||||
String start = DateUtil.formatTime(startTime);
|
||||
String end = DateUtil.formatTime(endTime);
|
||||
long betweenDay = DateUtil.between(endTime, startTime, DateUnit.DAY);
|
||||
DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd");
|
||||
DateTime parse1 = DateUtil.parse(DateUtil.format(endTime, "yyyy-MM-dd"), "yyyy-MM-dd");
|
||||
long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY);
|
||||
long between = DateUtil.between(endTime, startTime, DateUnit.MINUTE);
|
||||
xhpcPlaceholderOrder.setEndTime(endTime);
|
||||
xhpcPlaceholderOrder.setTotalTimeSpan((int) between);
|
||||
@ -86,6 +89,8 @@ public class XhpcPlaceholderOrderServiceImpl implements IXhpcPlaceholderOrderSer
|
||||
} else {
|
||||
between = between - freeTime;
|
||||
if (betweenDay > 0) {
|
||||
for (int m = 0; m <= betweenDay; m++) {
|
||||
if(m==0){
|
||||
List<XhpcPlaceholderTime> xhpcPlaceholderTimeOne = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime(start, "23:59:59", xhpcPlaceholderOrder.getPlaceholderId());
|
||||
for (int i = 0; i < xhpcPlaceholderTimeOne.size(); i++) {
|
||||
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i);
|
||||
@ -135,10 +140,60 @@ public class XhpcPlaceholderOrderServiceImpl implements IXhpcPlaceholderOrderSer
|
||||
xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto);
|
||||
|
||||
}
|
||||
}else if(m>0 && m<betweenDay){
|
||||
List<XhpcPlaceholderTime> xhpcPlaceholderTimeOne = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime("00:00:00", "23:59:59", xhpcPlaceholderOrder.getPlaceholderId());
|
||||
for (int i = 0; i < xhpcPlaceholderTimeOne.size(); i++) {
|
||||
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i);
|
||||
BigDecimal price = xhpcPlaceholderTime.getPrice();
|
||||
String pattern = "HH:mm:ss";
|
||||
Long startOne = DateUtil.parse("00:00:00", pattern).getTime();
|
||||
Long endOne = DateUtil.parse("23:59:59", pattern).getTime();
|
||||
|
||||
String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern);
|
||||
String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern);
|
||||
|
||||
Long time1 = DateUtil.parse(format1, pattern).getTime();
|
||||
Long time2 = DateUtil.parse(format2, pattern).getTime();
|
||||
XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto();
|
||||
if (startOne < time1) {
|
||||
startOne = time1;
|
||||
placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime());
|
||||
}else{
|
||||
placeholderTimeOrderDto.setStartTime(DateUtil.parse("00:00:00", pattern));
|
||||
}
|
||||
if (endOne > time2) {
|
||||
endOne = time2;
|
||||
placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime());
|
||||
}else{
|
||||
placeholderTimeOrderDto.setEndTime(DateUtil.parse("23:59:59", pattern));
|
||||
}
|
||||
long betweOne = (endOne - startOne) / 60000;
|
||||
int i1 = (int) (betweOne);
|
||||
|
||||
if (freeTime - i1 > 0) {
|
||||
freeTime = freeTime - i1;
|
||||
;
|
||||
i1 = 0;
|
||||
} else {
|
||||
i1 = i1 - freeTime;
|
||||
freeTime = 0;
|
||||
|
||||
}
|
||||
|
||||
BigDecimal multiply = new BigDecimal(i1).multiply(price);
|
||||
totalMoney = totalMoney.add(multiply);
|
||||
|
||||
placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId());
|
||||
placeholderTimeOrderDto.setPrice(price);
|
||||
placeholderTimeOrderDto.setTotalMoney(multiply);
|
||||
placeholderTimeOrderDto.setTotalTimeSpan(i1);
|
||||
xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto);
|
||||
|
||||
}
|
||||
}else{
|
||||
List<XhpcPlaceholderTime> xhpcPlaceholderTimeTwo = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime("00:00:00", end, xhpcPlaceholderOrder.getPlaceholderId());
|
||||
for (int i = 0; i < xhpcPlaceholderTimeTwo.size(); i++) {
|
||||
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i);
|
||||
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeTwo.get(i);
|
||||
BigDecimal price = xhpcPlaceholderTime.getPrice();
|
||||
String pattern = "HH:mm:ss";
|
||||
Long startOne = DateUtil.parse("00:00:00", pattern).getTime();
|
||||
@ -184,7 +239,9 @@ public class XhpcPlaceholderOrderServiceImpl implements IXhpcPlaceholderOrderSer
|
||||
placeholderTimeOrderDto.setTotalTimeSpan(i1);
|
||||
xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}else {
|
||||
List<XhpcPlaceholderTime> xhpcPlaceholderTimeOne = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime(start, end, xhpcPlaceholderOrder.getPlaceholderId());
|
||||
for (int i = 0; i < xhpcPlaceholderTimeOne.size(); i++) {
|
||||
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i);
|
||||
@ -235,6 +292,9 @@ public class XhpcPlaceholderOrderServiceImpl implements IXhpcPlaceholderOrderSer
|
||||
}
|
||||
}
|
||||
|
||||
if(totalMoney.compareTo(new BigDecimal(50)) == 1){
|
||||
totalMoney = new BigDecimal(50);
|
||||
}
|
||||
xhpcPlaceholderOrder.setTotalMoney(totalMoney);
|
||||
if (new BigDecimal(0).compareTo(new BigDecimal(between)) == 1) {
|
||||
xhpcPlaceholderOrder.setOvertimePrice(totalMoney.divide(new BigDecimal(between), 2, BigDecimal.ROUND_HALF_UP));
|
||||
@ -299,6 +359,7 @@ public class XhpcPlaceholderOrderServiceImpl implements IXhpcPlaceholderOrderSer
|
||||
//桩的统计、该时段金额
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
if (!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())) {
|
||||
startPage();
|
||||
if (UserTypeUtil.SYS_SUPER_TYPE_ONE.equals(loginUser.getSuperType())) {
|
||||
tenantId = loginUser.getTenantId();
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
@ -312,6 +373,7 @@ public class XhpcPlaceholderOrderServiceImpl implements IXhpcPlaceholderOrderSer
|
||||
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
|
||||
}
|
||||
} else {
|
||||
startPage();
|
||||
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
|
||||
|
||||
}
|
||||
|
||||
@ -1633,17 +1633,18 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
placeholderOrder.setStartTime(xhpcHistoryOrder.getEndTime());
|
||||
placeholderOrder.setCreateTime(new Date());
|
||||
placeholderOrder.setTenantId(xhpcHistoryOrder.getTenantId());
|
||||
placeholderOrder.setPlateNum(xhpcChargeOrder.getPlateNum());
|
||||
placeholderOrderService.insertXhpcPlaceholderOrder(placeholderOrder);
|
||||
logger.info("<<<<<<<<<<<<<<getPlaceholderOrderId>>>>>>>>>>>>>>>>"+placeholderOrder.getPlaceholderOrderId());
|
||||
String gunkey = "placeholderOrder:"+substring+":"+xhpcHistoryOrder.getSerialNumber();
|
||||
Map<String, Object> cacheGun =new HashMap<>();
|
||||
cacheGun.put("source",xhpcHistoryOrder.getSource());
|
||||
cacheGun.put("placeholderOrderId",placeholderOrder.getPlaceholderOrderId());
|
||||
cacheGun.put("status",0);
|
||||
cacheGun.put("serialNumber",xhpcHistoryOrder.getSerialNumber());
|
||||
cacheGun.put("internetSerialNumber",xhpcHistoryOrder.getInternetSerialNumber());
|
||||
cacheGun.put("startTime",DateUtil.format(xhpcHistoryOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
REDIS.setCacheMap(gunkey, cacheGun);
|
||||
// String gunkey = "placeholderOrder:"+substring+":"+xhpcHistoryOrder.getSerialNumber();
|
||||
// Map<String, Object> cacheGun =new HashMap<>();
|
||||
// cacheGun.put("source",xhpcHistoryOrder.getSource());
|
||||
// cacheGun.put("placeholderOrderId",placeholderOrder.getPlaceholderOrderId());
|
||||
// cacheGun.put("status",0);
|
||||
// cacheGun.put("serialNumber",xhpcHistoryOrder.getSerialNumber());
|
||||
// cacheGun.put("internetSerialNumber",xhpcHistoryOrder.getInternetSerialNumber());
|
||||
// cacheGun.put("startTime",DateUtil.format(xhpcHistoryOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
//REDIS.setCacheMap(gunkey, cacheGun);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -35,6 +35,9 @@
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="charging_capacity" property="chargingCapacity"/>
|
||||
<result column="suncha_status" property="sunchaStatus"/>
|
||||
<result column="Plate_num" property="plateNum"/>
|
||||
<result column="driver_id" property="driverId"/>
|
||||
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcTerminal">
|
||||
@ -473,7 +476,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getSerialNumberMessage" resultMap="XhpcChargeOrderResult">
|
||||
select *,Plate_num as PlateNum
|
||||
select *,Plate_num as plateNum
|
||||
from xhpc_charge_order
|
||||
where serial_number = #{serialNumber}
|
||||
limit 1
|
||||
|
||||
@ -255,7 +255,7 @@
|
||||
<select id="getXhpcPlaceholderTime" resultType="com.xhpc.common.domain.XhpcPlaceholderTime">
|
||||
select
|
||||
start_time as startTime,
|
||||
end_time as endTime,
|
||||
replace(end_time, '00:00:00', '23:59:59') as endTime,
|
||||
price as price
|
||||
from xhpc_placeholder_time
|
||||
where placeholder_time_id in (
|
||||
@ -458,6 +458,7 @@
|
||||
select
|
||||
ho.placeholder_order_id as placeholderOrderId,
|
||||
ho.serial_number as serialNumber,
|
||||
ho.placeholder_id as placeholderId,
|
||||
ct.name as chargingStationName,
|
||||
ter.pile_serial_number as pileSerialNumber,
|
||||
ter.name as terminalName,
|
||||
@ -533,7 +534,7 @@
|
||||
|
||||
<select id="getXhpcPlaceholderTimeOrder" resultType="map">
|
||||
select
|
||||
concat(start_time,"-",end_time) as time,
|
||||
concat(start_time,"-",replace(end_time, '00:00:00', '23:59:59')) as time,
|
||||
price as price,
|
||||
total_money as totalMoney,
|
||||
total_time_span as totalTimeSpan
|
||||
@ -626,12 +627,6 @@
|
||||
<if test="null != tenantId ">
|
||||
#{tenantId},
|
||||
</if>
|
||||
<if test="null != chargingMode and '' != chargingMode">
|
||||
#{chargingMode},
|
||||
</if>
|
||||
<if test="null != driverId and '' != driverId">
|
||||
#{driverId},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
</mapper>
|
||||
|
||||
@ -1481,6 +1481,15 @@
|
||||
</if>
|
||||
GROUP BY xcs.charging_station_id) us on us.charging_station_id = xcs.charging_station_id
|
||||
where xcs.del_flag =0
|
||||
<if test="status==1">
|
||||
and xcs.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{logOperatorId})
|
||||
</if>
|
||||
<if test="status==2">
|
||||
and xcs.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{logOperatorId})
|
||||
</if>
|
||||
<if test="status==3">
|
||||
and find_in_set (xcs.charging_station_id,(select station_ids from xhpc_work_user where work_user_id=#{logOperatorId}))
|
||||
</if>
|
||||
GROUP BY xcs.charging_station_id
|
||||
order by xcs.charging_station_id
|
||||
</select>
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -418,7 +418,7 @@ public class ChargingController {
|
||||
|
||||
String pileNo = startChargingData.getPileNo();
|
||||
String pkey = "pile:".concat(pileNo);
|
||||
log.info("==================pkey======================"+pkey);
|
||||
//log.info("==================pkey======================"+pkey);
|
||||
Map<String, Object> cachePile = REDIS.getCacheMap(pkey);
|
||||
R<Object> r = checkPile(cachePile);
|
||||
if (r.getCode() == 200) {
|
||||
|
||||
@ -11,6 +11,7 @@ import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
import com.xhpc.pp.utils.BMSCurrentParser;
|
||||
import com.xhpc.pp.utils.HexUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -49,20 +50,20 @@ public class BmsReqChargerOutputDataLogic implements ServiceLogic {
|
||||
int bmsVoltageRequest = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//BMS 电压需求
|
||||
|
||||
idxStart = 4 + idxStart;
|
||||
|
||||
int bmsCurrentRequest = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//BMS 电流需求
|
||||
double bmsCurrentRequest = BMSCurrentParser.parseBmsCurrent(hex.substring(idxStart, 4 + idxStart),400);
|
||||
//int bmsCurrentRequest = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//BMS 电流需求
|
||||
idxStart = 6 + idxStart;
|
||||
|
||||
int bmsChargingVolt = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//BMS 充电电压测量值
|
||||
idxStart = 4 + idxStart;
|
||||
int bmsChargingCurrent = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//BMS 充电电流测量值
|
||||
|
||||
|
||||
double bmsChargingCurrent = BMSCurrentParser.parseBmsCurrent(hex.substring(idxStart, 4 + idxStart),400);
|
||||
idxStart = 88;
|
||||
|
||||
int pileVoltageOutput = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//电桩电压输出值
|
||||
idxStart = 4 + idxStart;
|
||||
int pileCurrentOutput = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//电桩电流输出值
|
||||
|
||||
double pileCurrentOutput = BMSCurrentParser.parseBmsCurrent(hex.substring(idxStart, 4 + idxStart),400);//电桩电流输出值
|
||||
|
||||
String orderNo = (String) req.get("orderNo");
|
||||
String orderKey = "order:".concat(orderNo).concat(".bms");
|
||||
@ -85,43 +86,45 @@ public class BmsReqChargerOutputDataLogic implements ServiceLogic {
|
||||
cacheBmsReqChargerOutputData.setPileNo(orderData.getPileNo());
|
||||
cacheBmsReqChargerOutputData.setGunId(orderData.getGunId());
|
||||
cacheBmsReqChargerOutputData.setBmsVoltageRequest(new BigDecimal(bmsVoltageRequest).divide(new BigDecimal(10),BigDecimal.ROUND_DOWN).doubleValue());
|
||||
try{
|
||||
BigDecimal subtract1 = new BigDecimal(bmsCurrentRequest).divide(new BigDecimal(10), BigDecimal.ROUND_DOWN).subtract(new BigDecimal(400));
|
||||
if(subtract1.compareTo(new BigDecimal(0))<0){
|
||||
subtract1 =subtract1.abs();
|
||||
}
|
||||
cacheBmsReqChargerOutputData.setBmsCurrentRequest(subtract1.doubleValue());
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
// try{
|
||||
// BigDecimal subtract1 = new BigDecimal(bmsCurrentRequest).divide(new BigDecimal(10), BigDecimal.ROUND_DOWN).subtract(new BigDecimal(400));
|
||||
// if(subtract1.compareTo(new BigDecimal(0))<0){
|
||||
// subtract1 =subtract1.abs();
|
||||
// }
|
||||
// cacheBmsReqChargerOutputData.setBmsCurrentRequest(subtract1.doubleValue());
|
||||
// }catch (Exception e){
|
||||
//
|
||||
// }
|
||||
cacheBmsReqChargerOutputData.setBmsCurrentRequest(new BigDecimal(orderData.getBmsCurrentRequest()).abs().setScale(2,RoundingMode.DOWN).doubleValue());
|
||||
cacheBmsReqChargerOutputData.setBmsChargingMod(HexUtils.reverseHexInt(orderData.getBmsChargingMod()));
|
||||
cacheBmsReqChargerOutputData.setBmsChargingVolt(new BigDecimal(bmsChargingVolt).divide(new BigDecimal(10),BigDecimal.ROUND_DOWN).doubleValue());
|
||||
|
||||
try{
|
||||
BigDecimal subtract2 = new BigDecimal(bmsChargingCurrent).divide(new BigDecimal(10), BigDecimal.ROUND_DOWN).subtract(new BigDecimal(400));
|
||||
if(subtract2.compareTo(new BigDecimal(0))<0){
|
||||
subtract2 =subtract2.abs();
|
||||
}
|
||||
cacheBmsReqChargerOutputData.setBmsChargingCurrent(subtract2.doubleValue());
|
||||
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
// try{
|
||||
// BigDecimal subtract2 = new BigDecimal(bmsChargingCurrent).divide(new BigDecimal(10), BigDecimal.ROUND_DOWN).subtract(new BigDecimal(400));
|
||||
// if(subtract2.compareTo(new BigDecimal(0))<0){
|
||||
// subtract2 =subtract2.abs();
|
||||
// }
|
||||
// cacheBmsReqChargerOutputData.setBmsChargingCurrent(subtract2.doubleValue());
|
||||
//
|
||||
// }catch (Exception e){
|
||||
//
|
||||
// }
|
||||
cacheBmsReqChargerOutputData.setBmsChargingCurrent(new BigDecimal(orderData.getBmsChargingCurrent()).abs().setScale(2,RoundingMode.DOWN).doubleValue());
|
||||
cacheBmsReqChargerOutputData.setMonoBatteryVolt(convertDouble(Integer.parseInt(orderData.getMonoBatteryVoltGroupId().substring(0, 3), 16) * 0.01));
|
||||
cacheBmsReqChargerOutputData.setSoc(HexUtils.reverseHexInt(orderData.getSoc()));
|
||||
cacheBmsReqChargerOutputData.setBmsEstRemainingTime(HexUtils.reverseHexInt(orderData.getBmsEstRemainingTime()));
|
||||
cacheBmsReqChargerOutputData.setPileVoltageOutput(new BigDecimal(pileVoltageOutput).divide(new BigDecimal(10),BigDecimal.ROUND_DOWN).doubleValue());
|
||||
try{
|
||||
|
||||
BigDecimal subtract = new BigDecimal(pileCurrentOutput).divide(new BigDecimal(10), BigDecimal.ROUND_DOWN).subtract(new BigDecimal(400));
|
||||
if(subtract.compareTo(new BigDecimal(0))<0){
|
||||
subtract =subtract.abs();
|
||||
}
|
||||
cacheBmsReqChargerOutputData.setPileCurrentOutput(subtract.doubleValue());
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
// try{
|
||||
//
|
||||
// BigDecimal subtract = new BigDecimal(pileCurrentOutput).divide(new BigDecimal(10), BigDecimal.ROUND_DOWN).subtract(new BigDecimal(400));
|
||||
// if(subtract.compareTo(new BigDecimal(0))<0){
|
||||
// subtract =subtract.abs();
|
||||
// }
|
||||
// cacheBmsReqChargerOutputData.setPileCurrentOutput(subtract.doubleValue());
|
||||
// }catch (Exception e){
|
||||
//
|
||||
// }
|
||||
cacheBmsReqChargerOutputData.setPileCurrentOutput(new BigDecimal(orderData.getPileCurrentOutput()).abs().setScale(2,RoundingMode.DOWN).doubleValue());
|
||||
cacheBmsReqChargerOutputData.setChargingTimeSummary(HexUtils.reverseHexInt(orderData.getChargingTimeSummary()));
|
||||
cacheBmsReqChargerOutputData.setMonoBatteryVoltGroupId(Integer.parseInt(orderData.getMonoBatteryVoltGroupId().substring(3), 16));
|
||||
cacheBmsReqChargerOutputData.setHex(orderData.getHex());
|
||||
@ -211,18 +214,18 @@ public class BmsReqChargerOutputDataLogic implements ServiceLogic {
|
||||
int idxStart = 60;
|
||||
|
||||
int bmsVoltageRequest = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//BMS 电压需求
|
||||
System.out.println("===================bmsVoltageRequest========================="+bmsVoltageRequest);
|
||||
// System.out.println("===================bmsVoltageRequest========================="+bmsVoltageRequest);
|
||||
|
||||
idxStart =idxStart+4;
|
||||
int bmsCurrentRequest = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//BMS 电流需求
|
||||
System.out.println("===================bmsCurrentRequest========================="+bmsCurrentRequest);
|
||||
//System.out.println("===================bmsCurrentRequest========================="+bmsCurrentRequest);
|
||||
idxStart = 88;
|
||||
|
||||
int pileVoltageOutput = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//电桩电压输出值
|
||||
System.out.println("===================pileVoltageOutput========================="+pileVoltageOutput);
|
||||
// System.out.println("===================pileVoltageOutput========================="+pileVoltageOutput);
|
||||
idxStart = 4 + idxStart;
|
||||
int pileCurrentOutput = HexUtils.reverseHexInt(hex.substring(idxStart, 4 + idxStart));//电桩电流输出值
|
||||
System.out.println("===================pileCurrentOutput========================="+pileCurrentOutput);
|
||||
// System.out.println("===================pileCurrentOutput========================="+pileCurrentOutput);
|
||||
|
||||
|
||||
|
||||
@ -230,11 +233,17 @@ public class BmsReqChargerOutputDataLogic implements ServiceLogic {
|
||||
if(subtract1.compareTo(new BigDecimal(0))<0){
|
||||
subtract1 =subtract1.abs();
|
||||
}
|
||||
System.out.println("===================subtract1========================="+subtract1);
|
||||
// System.out.println("===================subtract1========================="+subtract1);
|
||||
BigDecimal subtract = new BigDecimal(2905).divide(new BigDecimal(10), BigDecimal.ROUND_DOWN).subtract(new BigDecimal(400));
|
||||
if(subtract.compareTo(new BigDecimal(0))<0){
|
||||
subtract =subtract.abs();
|
||||
}
|
||||
System.out.println("===================subtract========================="+subtract);
|
||||
// System.out.println("===================subtract========================="+subtract);
|
||||
|
||||
|
||||
String bmsData = "800C"; // 从BMS获取的实际数据
|
||||
double current = BMSCurrentParser.parseBmsCurrent(bmsData,400);
|
||||
System.out.println("BMS电流需求: " + current + " A");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,9 +57,9 @@ public class OrderDataLogic implements ServiceLogic {
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
Map<String, Object> req = sp.getParameters();
|
||||
log.info("================订单结束报文==============================");
|
||||
log.info("================订单结束报文================req=============="+req.toString());
|
||||
log.info("================订单结束报文==============================");
|
||||
//log.info("================订单结束报文==============================");
|
||||
//log.info("================订单结束报文================req=============="+req.toString());
|
||||
//log.info("================订单结束报文==============================");
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
OrderData orderData = objectMapper.convertValue(req, OrderData.class);
|
||||
String orderNo = orderData.getOrderNo();
|
||||
|
||||
@ -134,6 +134,18 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
cacheGun.put("orderkey","order:"+orderNo);
|
||||
final String orderstarttime = DateUtil.format(Calendar.getInstance().getTime(), NORM_DATETIME_FORMAT);
|
||||
cacheGun.put("pileStartTime", orderstarttime);
|
||||
|
||||
// String key = "placeholderOrder:"+terminalId+":*";
|
||||
// Collection<String> orderKeys = REDIS.keys(key);
|
||||
// for (String okey : orderKeys) {
|
||||
// Map<String, Object> cacheGunYu = REDIS.getCacheMap(okey);
|
||||
// if(cacheGunYu !=null && "0".equals(cacheGunYu.get("status").toString()) && !okey.equals("placeholderOrder:"+terminalId+":"+orderNo)){
|
||||
// cacheGunYu.put("status",1);
|
||||
// cacheGunYu.put("endTime",DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
||||
// REDIS.setCacheMap(okey, cacheGunYu);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
List<CacheRealtimeData> realtimeDataList = (List<CacheRealtimeData>) cacheOrder.get("realtimeDataList");
|
||||
@ -298,20 +310,20 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
public void run() {
|
||||
REDIS.setCacheObject("cdjgpc:realTime:"+orderNo,orderNo);
|
||||
//插枪状态发生变化进行判断是否收停车费
|
||||
String vehicleGunStatus = pvgstable[Integer.parseInt(realtimeData.getVehicleGunStatus())];
|
||||
if("否".equals(vehicleGunStatus)){
|
||||
String gunkey = "placeholderOrder:"+terminalId+":*";
|
||||
// String vehicleGunStatus = pvgstable[Integer.parseInt(realtimeData.getVehicleGunStatus())];
|
||||
// if("否".equals(vehicleGunStatus)){
|
||||
// String gunkey = "placeholderOrder:"+terminalId+":*";
|
||||
// Collection<String> orderKeys = REDIS.keys(gunkey);
|
||||
// for (String okey : orderKeys) {
|
||||
// Map<String, Object> cacheGun = REDIS.getCacheMap(okey);
|
||||
// if(cacheGun !=null && "0".equals(cacheGun.get("status").toString())){
|
||||
// cacheGun.put("status",1);
|
||||
// cacheGun.put("endTime",DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
||||
// REDIS.setCacheMap(okey, cacheGun);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
Collection<String> orderKeys = REDIS.keys(gunkey);
|
||||
for (String okey : orderKeys) {
|
||||
Map<String, Object> cacheGun = REDIS.getCacheMap(okey);
|
||||
if(cacheGun !=null && "0".equals(cacheGun.get("status").toString())){
|
||||
cacheGun.put("status",1);
|
||||
cacheGun.put("endTime",DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
||||
REDIS.setCacheMap(okey, cacheGun);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return new ServiceResult(false);
|
||||
|
||||
@ -52,7 +52,7 @@ public class HBCheckTask {
|
||||
String pkey = "pile:".concat(pileId);
|
||||
Map<String, Object> cachePile = REDIS.getCacheMap(pkey);
|
||||
String stationId = cachePile.get("stationId").toString();
|
||||
System.out.println("================gunkey===="+gunkey+"======pileId========"+pileId+"========stationId==="+stationId);
|
||||
// System.out.println("================gunkey===="+gunkey+"======pileId========"+pileId+"========stationId==="+stationId);
|
||||
if(1==Integer.parseInt(gunkey.substring(gunkey.length() - 1))){
|
||||
deviceMessageMapper.insertChargingPileStatus(gunkey.substring(gunkey.lastIndexOf(":") + 1),pileId,stationId,"A枪");
|
||||
}else{
|
||||
|
||||
@ -18,10 +18,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -16,10 +16,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 120.26.46.180:8858
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user