mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-05 18:40:14 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
# Conflicts: # jsowell-admin/src/test/java/SpringBootTestController.java # jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.api.uniapp;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
@@ -8,10 +9,13 @@ import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.dto.CreateReservedDTO;
|
||||
import com.jsowell.pile.dto.PileReservedDTO;
|
||||
import com.jsowell.pile.dto.PileMemberBindingDTO;
|
||||
import com.jsowell.pile.dto.QueryPersonPileDTO;
|
||||
import com.jsowell.pile.service.PileBasicInfoService;
|
||||
import com.jsowell.pile.service.PileMerchantInfoService;
|
||||
import com.jsowell.pile.vo.PileReservedVO;
|
||||
import com.jsowell.pile.vo.uniapp.PersonPileConnectorSumInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.PersonPileRealTimeVO;
|
||||
import com.jsowell.pile.vo.uniapp.PersonalPileInfoVO;
|
||||
@@ -251,24 +255,76 @@ public class PersonPileController extends BaseController {
|
||||
*/
|
||||
|
||||
/**
|
||||
* 取消预约
|
||||
* 添加预约充电
|
||||
* http://localhost:8080/uniapp/personalPile/createReserved
|
||||
*/
|
||||
public RestApiResponse<?> canal(HttpServletRequest request, @RequestBody QueryPersonPileDTO dto) {
|
||||
logger.info("取消预约params:{}", JSON.toJSONString(dto));
|
||||
@PostMapping("/createReserved")
|
||||
public RestApiResponse<?> createReserved(HttpServletRequest request, @RequestBody CreateReservedDTO dto) {
|
||||
// logger.info("修改预约充电状态params:{}", dto);
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String memberId = getMemberIdByAuthorization(request);
|
||||
dto.setMemberId(memberId);
|
||||
pileService.canalReserved(dto);
|
||||
response = new RestApiResponse<>();
|
||||
int reservedId = pileService.createReserved(dto);
|
||||
response = new RestApiResponse<>(ImmutableMap.of("reservedId", reservedId));
|
||||
} catch (BusinessException e) {
|
||||
logger.error("取消预约error", e);
|
||||
logger.error("添加预约充电error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("取消预约error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
logger.error("添加预约充电error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(ReturnCodeEnum.CODE_CREATE_RESERVED_ERROR);
|
||||
}
|
||||
logger.info("取消预约result:{}", response);
|
||||
logger.info("添加预约充电params:{}, result:{}", dto, response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询预约充电列表
|
||||
* http://localhost:8080/uniapp/personalPile/queryReservedList
|
||||
*/
|
||||
@PostMapping("/queryReservedList")
|
||||
public RestApiResponse<?> queryReservedList(HttpServletRequest request, @RequestBody PileReservedDTO dto) {
|
||||
// logger.info("修改预约充电状态params:{}", dto);
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String memberId = getMemberIdByAuthorization(request);
|
||||
dto.setMemberId(memberId);
|
||||
PageResponse pageResponse = pileService.queryReservedList(dto);
|
||||
response = new RestApiResponse<>(pageResponse);
|
||||
} catch (BusinessException e) {
|
||||
logger.error("查询预约列表error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("查询预约列表error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(ReturnCodeEnum.CODE_QUERY_RESERVED_LIST_ERROR);
|
||||
}
|
||||
logger.info("查询预约列表params:{}, result:{}", dto, response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改预约充电状态
|
||||
* http://localhost:8080/uniapp/personalPile/updateReservedStatus
|
||||
*/
|
||||
@PostMapping("/updateReservedStatus")
|
||||
public RestApiResponse<?> updateReservedStatus(HttpServletRequest request, @RequestBody PileReservedDTO dto) {
|
||||
// logger.info("修改预约充电状态params:{}", dto);
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String memberId = getMemberIdByAuthorization(request);
|
||||
dto.setMemberId(memberId);
|
||||
pileService.updateReservedStatus(dto);
|
||||
response = new RestApiResponse<>();
|
||||
} catch (BusinessException e) {
|
||||
logger.error("修改预约充电状态error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("修改预约充电状态error, params:{}", dto, e);
|
||||
response = new RestApiResponse<>(ReturnCodeEnum.CODE_UPDATE_RESERVED_STATUS_ERROR);
|
||||
}
|
||||
logger.info("修改预约充电状态params:{}, result:{}", dto, response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -16,21 +16,13 @@ import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.util.SnUtils;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.domain.MemberBasicInfo;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.PileConnectorInfo;
|
||||
import com.jsowell.pile.domain.PileMemberRelation;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.dto.BatchCreatePileDTO;
|
||||
import com.jsowell.pile.dto.MemberRegisterAndLoginDTO;
|
||||
import com.jsowell.pile.dto.PileMemberBindingDTO;
|
||||
import com.jsowell.pile.dto.QueryPersonPileDTO;
|
||||
import com.jsowell.pile.dto.QueryStationDTO;
|
||||
import com.jsowell.pile.transaction.dto.PileTransactionDTO;
|
||||
import com.jsowell.pile.transaction.service.TransactionService;
|
||||
import com.jsowell.pile.vo.PileReservedVO;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||
@@ -50,6 +42,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Time;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@@ -95,6 +88,9 @@ public class PileService {
|
||||
@Autowired
|
||||
private PileRemoteService pileRemoteService;
|
||||
|
||||
@Autowired
|
||||
private PileReservedInfoService pileReservedInfoService;
|
||||
|
||||
/**
|
||||
* 查询设备信息
|
||||
*
|
||||
@@ -562,10 +558,68 @@ public class PileService {
|
||||
|
||||
|
||||
/**
|
||||
* 取消预约充电
|
||||
* 修改预约充电状态
|
||||
* @param dto
|
||||
*/
|
||||
public void canalReserved(QueryPersonPileDTO dto) {
|
||||
public void updateReservedStatus(PileReservedDTO dto) {
|
||||
if (StringUtils.equals(dto.getStatus(), Constants.ZERO)) {
|
||||
// 停用
|
||||
pileReservedInfoService.deactivateReserved(dto);
|
||||
} else if (StringUtils.equals(dto.getStatus(), Constants.ONE)) {
|
||||
// 启用
|
||||
pileReservedInfoService.activateReserved(dto);
|
||||
}
|
||||
}
|
||||
|
||||
public int createReserved(CreateReservedDTO dto) {
|
||||
PileReservedInfo reservedInfo = new PileReservedInfo();
|
||||
reservedInfo.setMemberId(dto.getMemberId());
|
||||
reservedInfo.setPileSn(dto.getPileSn());
|
||||
reservedInfo.setPileConnectorCode(dto.getPileConnectorCode());
|
||||
reservedInfo.setStatus(Constants.ZERO); // 默认未生效
|
||||
// reservedInfo.setStartTime(DateUtils.parseDate(dto.getStartTime()));
|
||||
reservedInfo.setStartTime(Time.valueOf(dto.getStartTime()));
|
||||
// reservedInfo.setEndTime(DateUtils.parseDate(dto.getEndTime()));
|
||||
reservedInfo.setEndTime(Time.valueOf(dto.getEndTime()));
|
||||
if (StringUtils.isNotBlank(dto.getFreq())) {
|
||||
reservedInfo.setReservedType("recurring");
|
||||
reservedInfo.setFreq(dto.getFreq());
|
||||
} else {
|
||||
reservedInfo.setReservedType("single");
|
||||
reservedInfo.setFreq(null);
|
||||
}
|
||||
reservedInfo.setCreateBy(dto.getMemberId());
|
||||
pileReservedInfoService.insertSelective(reservedInfo);
|
||||
return reservedInfo.getId();
|
||||
}
|
||||
|
||||
public PageResponse queryReservedList(PileReservedDTO dto) {
|
||||
int pageNo = dto.getPageNo() == null ? Constants.one : dto.getPageNo();
|
||||
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
||||
PageHelper.startPage(pageNo, pageSize);
|
||||
List<PileReservedInfo> list = pileReservedInfoService.getReservationsByMemberIdAndPileSn(dto.getMemberId(), dto.getPileSn());
|
||||
PageInfo<PileReservedInfo> pageInfo = new PageInfo<>(list);
|
||||
|
||||
PageResponse pageResponse = new PageResponse();
|
||||
pageResponse.setPageNum(pageInfo.getPageNum());
|
||||
pageResponse.setPageSize(pageInfo.getPageSize());
|
||||
pageResponse.setPages(pageInfo.getPages());
|
||||
pageResponse.setTotal(pageInfo.getTotal());
|
||||
|
||||
List<PileReservedVO> resultList = Lists.newArrayList();
|
||||
for (PileReservedInfo reservedInfo : pageInfo.getList()) {
|
||||
resultList.add(
|
||||
PileReservedVO.builder()
|
||||
.reservedId(reservedInfo.getId() + "")
|
||||
.pileSn(reservedInfo.getPileSn())
|
||||
.startTime(reservedInfo.getStartTime().toString())
|
||||
.endTime(reservedInfo.getEndTime().toString())
|
||||
.freq(reservedInfo.getFreq())
|
||||
.status(reservedInfo.getStatus())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
pageResponse.setList(resultList);
|
||||
return pageResponse;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,12 +167,14 @@ adapay:
|
||||
rsaPrivateKey: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOl7qJyrkrks7FKnBPr/Sngub897Ni5Bkn5pEa81zfs+4LrYsuWZQ8G1n7Q8/rjH4G/T7vPX+So41vNU74Sqn6E1b3BpW+wWBULhs9p1JSPT7Kzima4FmPigUr80NLrlVKn5bW+V4/odpN+bJWvpxdd024edHAD8mXX1M1N1lU5ZAgMBAAECgYA+mxbiM6tbFe2kV/6g4vVv9luq0cn8az7BwKCqT44U8Y5G67ZElG0zsuTI6pYOrCHFOpnXLrE0HhudEchL1YiJqW/SDKaoC4oDZf5nybhh11kOR3N5maLqvUz/WxdNy17th/2XxqVfTTu752X9yeeoXDj89N5OxyMl0jmxlhWbgQJBAPeoitR7FCxcjKtcKsEyrtV3T0H2WtQ2Pbku7CGe6VCtL4+DJNeUentn7plBj4IhbH3EwNmyCYzNlfp0X2d8fWkCQQDxWONjt1vV/dyKQYRvSVw/SWQWlR7g2OnHZokU2SNeewiCX2umCdYKh0doN0JHbSTLOGG5IA3+6Vxam+9hzPtxAkEAjr+QHf8/Vn6V+mOqpSdgjNwzS/MC0ZTeKPI52vsswnrAkjjmMHh9zMnQRnf6juhTD38sJY6wYH9TdkRDhXPFGQJATiFYe4+AS2ZDXv6WwPAezN4VaLodpOyTwdmPxxAEQzHRL2N0levZPs9MbpB1BGpw3tkBycx2u28QVsTkWeTiAQJAGRsAVr6Rhhdaq2vTjt9orhMVwt6BCoSQ0zzHSYilv4PMOtSu1Pyt4K8BDv3gjEyAi1GtE7kkJ0dcbsvOGiLzqQ==
|
||||
appId: app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa
|
||||
wechatAppId: wxbb3e0d474569481d
|
||||
alipayAppId: 2021004145642756
|
||||
xixiao:
|
||||
apiKey: api_live_8690aad5-18df-4c94-ba8c-4f9499721c65
|
||||
mockApiKey: api_test_a2944395-e6ba-4d59-969a-f629b7a9e53e
|
||||
rsaPrivateKey: MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAJ608yEkr5Fxj3ID9fIzavuwW/orgjlD1SIrmZVTwLFzM+ljnr/iFMRRhjJZZGImO+ySj296N+VPujHiiQZqymgIACdORs3YyRvxOeWQoPKiik21mOiF7RRw2GIOQEzqo0MKeJ/qdK89FvwnAIZKRXl+ccH/VTTr68VGWuiLWEK3AgMBAAECgYACsMCaZDvRtGIhJa4KsBJ1N9UnVYt8mwjG7oRJAsV2fKR5pWWwjQ2bEmK7Acbw3wMPDKD/28uMyKA4bkWyZScPO5T2Mhvo28AVOfdsbBht70iKzBAXuqHhHd99+AEmQL9ZcoCYCvoP2JqV8cHp5sXGEvncm9VRsjs3iSTsBYu0WQJBANB6x0DCPnAFXYnKvtBcBmF4jU8pO0iIGtx/ZR/N0pRTbL7cIvh+z6ZqtWo880Xbcli6i1qwZl1ctWwV0yKArOsCQQDC4dN6e8/Gj3FubXLmyLfIrbq7BuHW8kg19t0/wmAXunpkBtFhAA2FD7FYGg+/l6/f6YqWX8nSUr6pFZQI0Z5lAkARvBANIzj6gIpXeWbIBLwKOJ4UuNYxMlrOnQu2K+UY9wvOJJ3Y87ioWHV8RxkOvT856wyFt3HNyWAphKXETpvnAkEAnIjJ1ktW9FXJtfph3bABt0acg5eelYmcqQP2aT1W9BhMMMYtLi3drjCRsYOVfL55fXBYajrcoHzoOmZjtsWw5QJBAM/Wpk6L7BLVi357icleuivPtKsP04Ix5afUpgiFmssEheiLAxr+Zs5/nk/HM6V4Pk8kA0ILaNbRqjfAF5ZnAvk=
|
||||
appId: app_7848ccb2-f7e7-4841-a968-fbf02cc265ad
|
||||
wechatAppId: wx20abc5210391649c
|
||||
alipayAppId: wx20abc5210391649c # 待修改为真正的支付宝小程序id
|
||||
|
||||
#高德地图相关配置
|
||||
aMap:
|
||||
|
||||
@@ -167,12 +167,14 @@ adapay:
|
||||
rsaPrivateKey: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOl7qJyrkrks7FKnBPr/Sngub897Ni5Bkn5pEa81zfs+4LrYsuWZQ8G1n7Q8/rjH4G/T7vPX+So41vNU74Sqn6E1b3BpW+wWBULhs9p1JSPT7Kzima4FmPigUr80NLrlVKn5bW+V4/odpN+bJWvpxdd024edHAD8mXX1M1N1lU5ZAgMBAAECgYA+mxbiM6tbFe2kV/6g4vVv9luq0cn8az7BwKCqT44U8Y5G67ZElG0zsuTI6pYOrCHFOpnXLrE0HhudEchL1YiJqW/SDKaoC4oDZf5nybhh11kOR3N5maLqvUz/WxdNy17th/2XxqVfTTu752X9yeeoXDj89N5OxyMl0jmxlhWbgQJBAPeoitR7FCxcjKtcKsEyrtV3T0H2WtQ2Pbku7CGe6VCtL4+DJNeUentn7plBj4IhbH3EwNmyCYzNlfp0X2d8fWkCQQDxWONjt1vV/dyKQYRvSVw/SWQWlR7g2OnHZokU2SNeewiCX2umCdYKh0doN0JHbSTLOGG5IA3+6Vxam+9hzPtxAkEAjr+QHf8/Vn6V+mOqpSdgjNwzS/MC0ZTeKPI52vsswnrAkjjmMHh9zMnQRnf6juhTD38sJY6wYH9TdkRDhXPFGQJATiFYe4+AS2ZDXv6WwPAezN4VaLodpOyTwdmPxxAEQzHRL2N0levZPs9MbpB1BGpw3tkBycx2u28QVsTkWeTiAQJAGRsAVr6Rhhdaq2vTjt9orhMVwt6BCoSQ0zzHSYilv4PMOtSu1Pyt4K8BDv3gjEyAi1GtE7kkJ0dcbsvOGiLzqQ==
|
||||
appId: app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa
|
||||
wechatAppId: wxbb3e0d474569481d
|
||||
alipayAppId: 2021004145642756
|
||||
xixiao:
|
||||
apiKey: api_live_8690aad5-18df-4c94-ba8c-4f9499721c65
|
||||
mockApiKey: api_test_a2944395-e6ba-4d59-969a-f629b7a9e53e
|
||||
rsaPrivateKey: MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAJ608yEkr5Fxj3ID9fIzavuwW/orgjlD1SIrmZVTwLFzM+ljnr/iFMRRhjJZZGImO+ySj296N+VPujHiiQZqymgIACdORs3YyRvxOeWQoPKiik21mOiF7RRw2GIOQEzqo0MKeJ/qdK89FvwnAIZKRXl+ccH/VTTr68VGWuiLWEK3AgMBAAECgYACsMCaZDvRtGIhJa4KsBJ1N9UnVYt8mwjG7oRJAsV2fKR5pWWwjQ2bEmK7Acbw3wMPDKD/28uMyKA4bkWyZScPO5T2Mhvo28AVOfdsbBht70iKzBAXuqHhHd99+AEmQL9ZcoCYCvoP2JqV8cHp5sXGEvncm9VRsjs3iSTsBYu0WQJBANB6x0DCPnAFXYnKvtBcBmF4jU8pO0iIGtx/ZR/N0pRTbL7cIvh+z6ZqtWo880Xbcli6i1qwZl1ctWwV0yKArOsCQQDC4dN6e8/Gj3FubXLmyLfIrbq7BuHW8kg19t0/wmAXunpkBtFhAA2FD7FYGg+/l6/f6YqWX8nSUr6pFZQI0Z5lAkARvBANIzj6gIpXeWbIBLwKOJ4UuNYxMlrOnQu2K+UY9wvOJJ3Y87ioWHV8RxkOvT856wyFt3HNyWAphKXETpvnAkEAnIjJ1ktW9FXJtfph3bABt0acg5eelYmcqQP2aT1W9BhMMMYtLi3drjCRsYOVfL55fXBYajrcoHzoOmZjtsWw5QJBAM/Wpk6L7BLVi357icleuivPtKsP04Ix5afUpgiFmssEheiLAxr+Zs5/nk/HM6V4Pk8kA0ILaNbRqjfAF5ZnAvk=
|
||||
appId: app_7848ccb2-f7e7-4841-a968-fbf02cc265ad
|
||||
wechatAppId: wx20abc5210391649c
|
||||
alipayAppId: wx20abc5210391649c # 待修改为真正的支付宝小程序id
|
||||
|
||||
#高德地图相关配置
|
||||
aMap:
|
||||
|
||||
@@ -170,12 +170,14 @@ adapay:
|
||||
rsaPrivateKey: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOl7qJyrkrks7FKnBPr/Sngub897Ni5Bkn5pEa81zfs+4LrYsuWZQ8G1n7Q8/rjH4G/T7vPX+So41vNU74Sqn6E1b3BpW+wWBULhs9p1JSPT7Kzima4FmPigUr80NLrlVKn5bW+V4/odpN+bJWvpxdd024edHAD8mXX1M1N1lU5ZAgMBAAECgYA+mxbiM6tbFe2kV/6g4vVv9luq0cn8az7BwKCqT44U8Y5G67ZElG0zsuTI6pYOrCHFOpnXLrE0HhudEchL1YiJqW/SDKaoC4oDZf5nybhh11kOR3N5maLqvUz/WxdNy17th/2XxqVfTTu752X9yeeoXDj89N5OxyMl0jmxlhWbgQJBAPeoitR7FCxcjKtcKsEyrtV3T0H2WtQ2Pbku7CGe6VCtL4+DJNeUentn7plBj4IhbH3EwNmyCYzNlfp0X2d8fWkCQQDxWONjt1vV/dyKQYRvSVw/SWQWlR7g2OnHZokU2SNeewiCX2umCdYKh0doN0JHbSTLOGG5IA3+6Vxam+9hzPtxAkEAjr+QHf8/Vn6V+mOqpSdgjNwzS/MC0ZTeKPI52vsswnrAkjjmMHh9zMnQRnf6juhTD38sJY6wYH9TdkRDhXPFGQJATiFYe4+AS2ZDXv6WwPAezN4VaLodpOyTwdmPxxAEQzHRL2N0levZPs9MbpB1BGpw3tkBycx2u28QVsTkWeTiAQJAGRsAVr6Rhhdaq2vTjt9orhMVwt6BCoSQ0zzHSYilv4PMOtSu1Pyt4K8BDv3gjEyAi1GtE7kkJ0dcbsvOGiLzqQ==
|
||||
appId: app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa
|
||||
wechatAppId: wxbb3e0d474569481d
|
||||
alipayAppId: 2021004145642756
|
||||
xixiao:
|
||||
apiKey: api_live_8690aad5-18df-4c94-ba8c-4f9499721c65
|
||||
mockApiKey: api_test_a2944395-e6ba-4d59-969a-f629b7a9e53e
|
||||
rsaPrivateKey: MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAJ608yEkr5Fxj3ID9fIzavuwW/orgjlD1SIrmZVTwLFzM+ljnr/iFMRRhjJZZGImO+ySj296N+VPujHiiQZqymgIACdORs3YyRvxOeWQoPKiik21mOiF7RRw2GIOQEzqo0MKeJ/qdK89FvwnAIZKRXl+ccH/VTTr68VGWuiLWEK3AgMBAAECgYACsMCaZDvRtGIhJa4KsBJ1N9UnVYt8mwjG7oRJAsV2fKR5pWWwjQ2bEmK7Acbw3wMPDKD/28uMyKA4bkWyZScPO5T2Mhvo28AVOfdsbBht70iKzBAXuqHhHd99+AEmQL9ZcoCYCvoP2JqV8cHp5sXGEvncm9VRsjs3iSTsBYu0WQJBANB6x0DCPnAFXYnKvtBcBmF4jU8pO0iIGtx/ZR/N0pRTbL7cIvh+z6ZqtWo880Xbcli6i1qwZl1ctWwV0yKArOsCQQDC4dN6e8/Gj3FubXLmyLfIrbq7BuHW8kg19t0/wmAXunpkBtFhAA2FD7FYGg+/l6/f6YqWX8nSUr6pFZQI0Z5lAkARvBANIzj6gIpXeWbIBLwKOJ4UuNYxMlrOnQu2K+UY9wvOJJ3Y87ioWHV8RxkOvT856wyFt3HNyWAphKXETpvnAkEAnIjJ1ktW9FXJtfph3bABt0acg5eelYmcqQP2aT1W9BhMMMYtLi3drjCRsYOVfL55fXBYajrcoHzoOmZjtsWw5QJBAM/Wpk6L7BLVi357icleuivPtKsP04Ix5afUpgiFmssEheiLAxr+Zs5/nk/HM6V4Pk8kA0ILaNbRqjfAF5ZnAvk=
|
||||
appId: app_7848ccb2-f7e7-4841-a968-fbf02cc265ad
|
||||
wechatAppId: wx20abc5210391649c
|
||||
alipayAppId: wx20abc5210391649c # 待修改为真正的支付宝小程序id
|
||||
|
||||
|
||||
#高德地图相关配置
|
||||
|
||||
@@ -262,6 +262,16 @@ public class SpringBootTestController {
|
||||
@Autowired
|
||||
private NotificationService notificationService;
|
||||
|
||||
@Test
|
||||
public void queryPaymentReverseTest2() {
|
||||
String paymentId = "002212024061717243610648707836701741056";
|
||||
try {
|
||||
adapayService.queryPaymentReverse(paymentId, wechatAppId1);
|
||||
} catch (BaseAdaPayException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createBalancePaymentRequestTest() {
|
||||
String outMemberId = "ACM40782726";
|
||||
@@ -895,6 +905,8 @@ public class SpringBootTestController {
|
||||
String jsonArrayString = "[" +
|
||||
"{\"orderCode\":\"C44529020684\", \"settleAmount\":\"15.67\", \"paymentId\":\"002212024050317243010632400358265659392\"}" +
|
||||
"{\"orderCode\":\"C63381134165\", \"settleAmount\":\"39.65\", \"paymentId\":\"002212024052518295510640389353916465152\"}" +
|
||||
"{\"orderCode\":\"C44778282947\", \"settleAmount\":\"8.38\", \"paymentId\":\"002212023101608315910559788773415297024\"}" +
|
||||
"{\"orderCode\":\"C44778282947\", \"settleAmount\":\"8.38\", \"paymentId\":\"002212023101608315910559788773415297024\"}" +
|
||||
"]";
|
||||
return JSONArray.parseArray(jsonArrayString);
|
||||
}
|
||||
@@ -930,8 +942,8 @@ public class SpringBootTestController {
|
||||
public void queryCreateConfirmReverse() throws BaseAdaPayException {
|
||||
List<String> paymentIdList = getPaymentIdList(); // 查询分账信息
|
||||
|
||||
List<String> unSplitList = Lists.newArrayList(); //
|
||||
List<String> splitList = Lists.newArrayList(); //
|
||||
List<String> unSplitList = Lists.newArrayList(); // 未分帐
|
||||
List<String> splitList = Lists.newArrayList(); // 已分帐
|
||||
|
||||
BigDecimal total = BigDecimal.ZERO;
|
||||
List<String> selfList = Lists.newArrayList();
|
||||
@@ -1734,6 +1746,255 @@ public class SpringBootTestController {
|
||||
list.add("002212024053119492410642583680556568576");
|
||||
list.add("002212024053120084110642588534245376000");
|
||||
list.add("002212024053120090610642588641829273600");
|
||||
list.add("002212024013008060410598195363803480064");
|
||||
list.add("002212024013008130010598197109908156416");
|
||||
list.add("002212024013019392410598369846177918976");
|
||||
list.add("002212024013108410410598566558256963584");
|
||||
list.add("002212024013108505610598569040739135488");
|
||||
list.add("002212024013110011810598586751293992960");
|
||||
list.add("002212024013112032710598617491298971648");
|
||||
list.add("002212024020108052910598919992595804160");
|
||||
list.add("002212024020108304410598926348483653632");
|
||||
list.add("002212024020108363910598927835231076352");
|
||||
list.add("002212024020111390410598973743414730752");
|
||||
list.add("002212024020114322110599017350088626176");
|
||||
list.add("002212024020114474410599021222320615424");
|
||||
list.add("002212024020115092510599026678041018368");
|
||||
list.add("002212024020119590210599099564427669504");
|
||||
list.add("002212024020207054910599267366398578688");
|
||||
list.add("002212024020208262510599287646486110208");
|
||||
list.add("002212024020214265010599378351836442624");
|
||||
list.add("002212024020215343210599395386694881280");
|
||||
list.add("002212024020307373210599637734226214912");
|
||||
list.add("002212024020316072110599766035400572928");
|
||||
list.add("002212024020322230010599860568206397440");
|
||||
list.add("002212024020408093410600008184035123200");
|
||||
list.add("002212024020409244810600027116138618880");
|
||||
list.add("002212024020508184010600372861536260096");
|
||||
list.add("002212024020514283510600465955553648640");
|
||||
list.add("002212024020517003910600504221174415360");
|
||||
list.add("002212024020521230310600570256004050944");
|
||||
list.add("002212024020608155210600734545404710912");
|
||||
list.add("002212024020608382510600740220346396672");
|
||||
list.add("002212024020608451110600741920730718208");
|
||||
list.add("002212024020609124110600748841333379072");
|
||||
list.add("002212024020614411210600831517739819008");
|
||||
list.add("002212024020708312310601100837498085376");
|
||||
list.add("002212024020714333610601191990266511360");
|
||||
list.add("002212024020808475610601467388114333696");
|
||||
list.add("002212024020810053710601486939065114624");
|
||||
list.add("002212024020811101310601503195798601728");
|
||||
list.add("002212024020813113610601533745412943872");
|
||||
list.add("002212024020908390010601827531082936320");
|
||||
list.add("002212024020910022910601848539790401536");
|
||||
list.add("002212024020910361810601857048976125952");
|
||||
list.add("002212024020914165310601912561811931136");
|
||||
list.add("002212024020914461510601919951398666240");
|
||||
list.add("002212024020918534910601982251957444608");
|
||||
list.add("002212024021120334410602732175872696320");
|
||||
list.add("002212024021122380810602763479644069888");
|
||||
list.add("002212024021214122510602998599363010560");
|
||||
list.add("002212024021315415910603383530189070336");
|
||||
list.add("002212024021400083110603511002905235456");
|
||||
list.add("002212024021416051710603751779179274240");
|
||||
list.add("002212024021423023410603856791162929152");
|
||||
list.add("002212024021511412210604047750442496000");
|
||||
list.add("002212024021514072810604084516702027776");
|
||||
list.add("002212024021515430710604108588191272960");
|
||||
list.add("002212024021523001310604218587504525312");
|
||||
list.add("002212024021608381110604364039677882368");
|
||||
list.add("002212024021623020310604581439817023488");
|
||||
list.add("002212024021722362610604937380427948032");
|
||||
list.add("002212024021808001010605079249543716864");
|
||||
list.add("002212024021808104810605081925655490560");
|
||||
list.add("002212024021808185910605083981192704000");
|
||||
list.add("002212024021810383210605119103427313664");
|
||||
list.add("002212024021908582810605456306802053120");
|
||||
list.add("002212024022109131310606184796175687680");
|
||||
list.add("002212024022119525210606345768395419648");
|
||||
list.add("002212024022218212410606685138835025920");
|
||||
list.add("002212024022307485310606888346055372800");
|
||||
list.add("002212024022308550410606905004268617728");
|
||||
list.add("002212024022408553910607267536671035392");
|
||||
list.add("002212024022517022910607752442171338752");
|
||||
list.add("002212024022521075910607814222629285888");
|
||||
list.add("002212024022609245810607999689369276416");
|
||||
list.add("002212024022708185910608345472558899200");
|
||||
list.add("002212024022808171110608707409136111616");
|
||||
list.add("002212024022808415410608713630598144000");
|
||||
list.add("002212024022908220310609071021906227200");
|
||||
list.add("002212024022908291710609072841400475648");
|
||||
list.add("002212024022908495410609078031603834880");
|
||||
list.add("002212024022908535210609079026622164992");
|
||||
list.add("002212024022920294410609254148826947584");
|
||||
list.add("002212024030108013710609428267015561216");
|
||||
list.add("002212024030108192710609432753644294144");
|
||||
list.add("002212024030109255810609449496542498816");
|
||||
list.add("002212024030110432610609468990032666624");
|
||||
list.add("002212024030114414110609528945117454336");
|
||||
list.add("002212024030200361910609678590595244032");
|
||||
list.add("002212024030300003710610031994312007680");
|
||||
list.add("002212024030408224710610520757550407680");
|
||||
list.add("002212024030408314410610523009898565632");
|
||||
list.add("002212024030422585110610741225040171008");
|
||||
list.add("002212024030508104110610880098894979072");
|
||||
list.add("002212024030508365710610886712358817792");
|
||||
list.add("002212024030508490010610889744259559424");
|
||||
list.add("002212024030521512910611086662637559808");
|
||||
list.add("002212024030608175710611244317067141120");
|
||||
list.add("002212024030708090510611604472871477248");
|
||||
list.add("002212024030708282910611609355581992960");
|
||||
list.add("002212024030708502610611614878784106496");
|
||||
list.add("002212024030709174810611621767196659712");
|
||||
list.add("002212024030719534010611781785478717440");
|
||||
list.add("002212024030807594010611964492124340224");
|
||||
list.add("002212024030822443910612187206556524544");
|
||||
list.add("002212024030906325510612305048975122432");
|
||||
list.add("002212024030907350010612320673259941888");
|
||||
list.add("002212024030915525410612445973697167360");
|
||||
list.add("002212024030916303810612455470245429248");
|
||||
list.add("002212024030921533110612536725873057792");
|
||||
list.add("002212024031017202310612830374738165760");
|
||||
list.add("002212024031020531910612883964449075200");
|
||||
list.add("002212024031023432510612926769309773824");
|
||||
list.add("002212024031108301510613059352027627520");
|
||||
list.add("002212024031109563110613081060800557056");
|
||||
list.add("002212024031114040910613143380055498752");
|
||||
list.add("002212024031208192510613419012528644096");
|
||||
list.add("002212024031208341810613422759090114560");
|
||||
list.add("002212024031208412810613424562076852224");
|
||||
list.add("002212024031308225010613782262091567104");
|
||||
list.add("002212024031308360610613785598963986432");
|
||||
list.add("002212024031308371210613785876779442176");
|
||||
list.add("002212024031308422110613787173562695680");
|
||||
list.add("002212024031408241810614145019098722304");
|
||||
list.add("002212024031508224410614507010081640448");
|
||||
list.add("002212024031508590910614516174918074368");
|
||||
list.add("002212024031509281210614523487750299648");
|
||||
list.add("002212024031510283910614538700956971008");
|
||||
list.add("002212024031515211110614612316401750016");
|
||||
list.add("002212024031520151910614686339450355712");
|
||||
list.add("002212024031609341910614887414428016640");
|
||||
list.add("002212024031718294510615384546949754880");
|
||||
list.add("002212024031808035610615589445707841536");
|
||||
list.add("002212024031808260710615595025820246016");
|
||||
list.add("002212024031815323210615702336330211328");
|
||||
list.add("002212024031815375110615703677041405952");
|
||||
list.add("002212024031911254310616002613799657472");
|
||||
list.add("002212024032008101710616315817846980608");
|
||||
list.add("002212024032011532310616371961915990016");
|
||||
list.add("002212024032108120110616678642146373632");
|
||||
list.add("002212024032108354410616684610730549248");
|
||||
list.add("002212024032108424510616686374340608000");
|
||||
list.add("002212024032114381810616775853463097344");
|
||||
list.add("002212024032208245610617044281046831104");
|
||||
list.add("002212024032208312010617045888861618176");
|
||||
list.add("002212024032208434810617049027454844928");
|
||||
list.add("002212024032323465610617638697148858368");
|
||||
list.add("002212024032402541210617685824652591104");
|
||||
list.add("002212024032508523610618138407486066688");
|
||||
list.add("002212024032520172810618310759024463872");
|
||||
list.add("002212024032608315810618495600729882624");
|
||||
list.add("002212024032608391310618497425932648448");
|
||||
list.add("002212024032608510410618500408262008832");
|
||||
list.add("002212024032708422710618860627711471616");
|
||||
list.add("002212024032714244610618946776453619712");
|
||||
list.add("002212024032808424210619223076450693120");
|
||||
list.add("002212024032814205310619308187015802880");
|
||||
list.add("002212024032907525410619572932763545600");
|
||||
list.add("002212024032908303010619582395874840576");
|
||||
list.add("002212024032908500610619587327303061504");
|
||||
list.add("002212024032911524710619633303216230400");
|
||||
list.add("002212024032923193810619806154641907712");
|
||||
list.add("002212024033016321410620066014643077120");
|
||||
list.add("002212024033016343310620066598362058752");
|
||||
list.add("002212024033020173810620122738665811968");
|
||||
list.add("002212024040108490910620674253468303360");
|
||||
list.add("002212024040109022110620677573939793920");
|
||||
list.add("002212024040208244810621030511414784000");
|
||||
list.add("002212024040308254910621393156197027840");
|
||||
list.add("002212024040308393710621396627855544320");
|
||||
list.add("002212024040308404410621396912069971968");
|
||||
list.add("002212024040309543710621415504291794944");
|
||||
list.add("002212024040311170810621436271049670656");
|
||||
list.add("002212024040323530210621626497573154816");
|
||||
list.add("002212024040402372510621667866323075072");
|
||||
list.add("002212024040408542210621762730175643648");
|
||||
list.add("002212024040415481010621866867580702720");
|
||||
list.add("002212024040512391510622181710707392512");
|
||||
list.add("002212024040516392110622242135366791168");
|
||||
list.add("002212024040614223510622570105679126528");
|
||||
list.add("002212024040623165710622704580477042688");
|
||||
list.add("002212024040809150910623217512072990720");
|
||||
list.add("002212024040811153710623247826547335168");
|
||||
list.add("002212024040908295510623568517415526400");
|
||||
list.add("002212024040908523110623574205092974592");
|
||||
list.add("002212024040911290310623613595104657408");
|
||||
list.add("002212024041009232810623944378227253248");
|
||||
list.add("002212024041107493210624283130019381248");
|
||||
list.add("002212024041108193110624290674609082368");
|
||||
list.add("002212024041208114810624651118629326848");
|
||||
list.add("002212024041208300810624655733583732736");
|
||||
list.add("002212024041209162410624667378518835200");
|
||||
list.add("002212024041210260110624684896674537472");
|
||||
list.add("002212024041214283110624745923243118592");
|
||||
list.add("002212024041420442210625565287085670400");
|
||||
list.add("002212024041507423510625730932126121984");
|
||||
list.add("002212024041508341410625743931251539968");
|
||||
list.add("002212024041521063510625933262427582464");
|
||||
list.add("002212024041609581110626127442457104384");
|
||||
list.add("002212024041707543510626458728699969536");
|
||||
list.add("002212024041708271210626466935588491264");
|
||||
list.add("002212024041708532810626473545384984576");
|
||||
list.add("002212024041808322310626830625628844032");
|
||||
list.add("002212024041808581710626837143647076352");
|
||||
list.add("002212024041810270010626859470992621568");
|
||||
list.add("002212024041810323510626860875480481792");
|
||||
list.add("002212024041816371210626952633348419584");
|
||||
list.add("002212024041820424210627014417214259200");
|
||||
list.add("002212024041908145410627188615932936192");
|
||||
list.add("002212024041908295410627192392017481728");
|
||||
list.add("002212024042012450810627619008926924800");
|
||||
list.add("002212024042012542310627621336262328320");
|
||||
list.add("002212024042023094310627776190762885120");
|
||||
list.add("002212024042109541010627938373800124416");
|
||||
list.add("002212024042207451110628268298934329344");
|
||||
list.add("002212024042220074210628455161424855040");
|
||||
list.add("002212024042307511610628632220004851712");
|
||||
list.add("002212024042308012110628634756814118912");
|
||||
list.add("002212024042308204710628639647745916928");
|
||||
list.add("002212024042309213010628654927362727936");
|
||||
list.add("002212024042407541510628995359758417920");
|
||||
list.add("002212024042419503110629175610779844608");
|
||||
list.add("002212024042507593310629359080569290752");
|
||||
list.add("002212024042508162210629363310436741120");
|
||||
list.add("002212024042508444810629370468299612160");
|
||||
list.add("002212024042510044010629390566508900352");
|
||||
list.add("002212024042608042610629722695250190336");
|
||||
list.add("002212024042608254110629728043720839168");
|
||||
list.add("002212024042608495310629734132524331008");
|
||||
list.add("002212024042613574610629811616614793216");
|
||||
list.add("002212024042808054110630447788521406464");
|
||||
list.add("002212024042809245110630467710966120448");
|
||||
list.add("002212024042823254410630679326345379840");
|
||||
list.add("002212024042907322310630801794375454720");
|
||||
list.add("002212024042913113810630887168829394944");
|
||||
list.add("002212024043008265210631177893526605824");
|
||||
list.add("002212024043008304710631178879007895552");
|
||||
list.add("002212024043008514610631184158888271872");
|
||||
list.add("002212024043008590110631185985480146944");
|
||||
list.add("002212024043009003010631186356933967872");
|
||||
list.add("002212024043010533110631214799365967872");
|
||||
list.add("002212024050107092310631520782677000192");
|
||||
list.add("002212024050107525610631531743152410624");
|
||||
list.add("002212024050416563310632755709779451904");
|
||||
list.add("002212024050515232310633094653215678464");
|
||||
list.add("002212024050520055610633165758466428928");
|
||||
list.add("002212024050520481310633176399665774592");
|
||||
list.add("002212024050607533110633343829061480448");
|
||||
list.add("002212024050607564510633344642827370496");
|
||||
list.add("002212024050608283810633352666908696576");
|
||||
list.add("002212024050608393610633355426893475840");
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,15 @@ public class CacheConstants {
|
||||
// 缓存时间 12小时
|
||||
public static final int cache_expire_time_12h = cache_expire_time_1h * 12;
|
||||
|
||||
// 缓存时间 24小时
|
||||
// 缓存时间 1天 24小时
|
||||
public static final int cache_expire_time_1d = cache_expire_time_1h * 24;
|
||||
|
||||
// 缓存时间 3天
|
||||
public static final int cache_expire_time_3d = cache_expire_time_1d * 3;
|
||||
|
||||
// 缓存时间 7天
|
||||
public static final int cache_expire_time_7d = cache_expire_time_1d * 7;
|
||||
|
||||
// 缓存时间 10天
|
||||
public static final int cache_expire_time_10d = cache_expire_time_1d * 10;
|
||||
|
||||
@@ -61,6 +67,9 @@ public class CacheConstants {
|
||||
// 平台测试员
|
||||
public static final String PLATFORM_TESTER = "platform_tester:";
|
||||
|
||||
// 枪口插枪状态 缓存前缀
|
||||
public static final String CHARGER_PLUGGED_IN_STATUS = "charger_plugged_in_status:";
|
||||
|
||||
// 查询桩型号信息
|
||||
public static final String GET_PILE_MODEL_INFO_BY_MODEL_ID = "get_pile_model_info_by_model_id:";
|
||||
|
||||
|
||||
@@ -167,6 +167,14 @@ public enum ReturnCodeEnum {
|
||||
|
||||
CODE_UNBIND_PILE_ERROR("00400012", "解绑个人桩异常!"),
|
||||
|
||||
CODE_CREATE_RESERVED_ERROR("00400013", "创建预约失败"),
|
||||
|
||||
CODE_UPDATE_RESERVED_STATUS_ERROR("00400014", "修改预约充电状态失败"),
|
||||
|
||||
CODE_QUERY_RESERVED_LIST_ERROR("00400015", "查询预约充电列表失败"),
|
||||
|
||||
CODE_UPDATE_RESERVED_STATUS_REFUSED("00400016", "时间与现有预订重叠"),
|
||||
|
||||
/* 个人桩 end */
|
||||
|
||||
CODE_THIS_CARNO_HAS_BEEN_BINDING("00500001", "当前车牌号已经绑定,请检查!"),
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.jsowell.common.response;
|
||||
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
@Data
|
||||
public class RestApiResponse<T> {
|
||||
@@ -40,4 +42,13 @@ public class RestApiResponse<T> {
|
||||
this.resCode = returnCodeEnum.getValue();
|
||||
this.msg = returnCodeEnum.getLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
|
||||
.append("resCode", resCode)
|
||||
.append("msg", msg)
|
||||
.append("obj", obj)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.sql.Time;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -44,6 +45,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
|
||||
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
public static String HH_MM = "HH:mm";
|
||||
|
||||
public static String RFC3339 = "yyyy-MM-dd'T'HH:mm:ssXXX";
|
||||
|
||||
private static String[] parsePatterns = {
|
||||
@@ -673,10 +676,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
// public static String date2HexStr(Date date) {
|
||||
// return Cp56Time2aUtil.date2HexStr(date);
|
||||
// }
|
||||
public static void main(String[] args) {
|
||||
List<String> allDatesInTheDateRange = getAllDatesInTheDateRange("2024-05-01", "2024-05-31");
|
||||
System.out.println(allDatesInTheDateRange);
|
||||
}
|
||||
/**
|
||||
* 获取两个时间的间隔时间
|
||||
*
|
||||
@@ -1033,4 +1032,54 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
return maxDate;
|
||||
}
|
||||
|
||||
public static LocalDateTime convertToLocalDateTime(String time, boolean isNextDay) {
|
||||
LocalTime localTime = LocalTime.parse(time, DateTimeFormatter.ofPattern("HH:mm:ss"));
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime dateTime = now.with(localTime);
|
||||
|
||||
if (isNextDay) {
|
||||
dateTime = dateTime.plusDays(1);
|
||||
}
|
||||
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换预约时间
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
public static LocalDateTime[] convertStartAndEndTime(String startTime, String endTime) {
|
||||
LocalTime startLocalTime = LocalTime.parse(startTime, DateTimeFormatter.ofPattern("HH:mm:ss"));
|
||||
LocalTime endLocalTime = LocalTime.parse(endTime, DateTimeFormatter.ofPattern("HH:mm:ss"));
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime startDateTime = now.with(startLocalTime);
|
||||
LocalDateTime endDateTime = now.with(endLocalTime);
|
||||
|
||||
// 如果结束时间比开始时间小或相同,则结束时间为第二天
|
||||
if (endLocalTime.isBefore(startLocalTime) || endLocalTime.equals(startLocalTime)) {
|
||||
endDateTime = endDateTime.plusDays(1);
|
||||
}
|
||||
|
||||
return new LocalDateTime[]{startDateTime, endDateTime};
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String startTime = "22:00:00";
|
||||
String endTime1 = "05:30:00";
|
||||
String endTime2 = "22:00:00";
|
||||
|
||||
LocalDateTime[] dateTime1 = convertStartAndEndTime(startTime, endTime1);
|
||||
LocalDateTime[] dateTime2 = convertStartAndEndTime(startTime, endTime2);
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
System.out.println("Start DateTime: " + dateTime1[0].format(formatter));
|
||||
System.out.println("End DateTime (Next Day): " + dateTime1[1].format(formatter));
|
||||
|
||||
System.out.println("Start DateTime: " + dateTime2[0].format(formatter));
|
||||
System.out.println("End DateTime (Same Day): " + dateTime2[1].format(formatter));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.jsowell.common.util.ServletUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.id.IdUtils;
|
||||
import com.jsowell.common.util.ip.IpUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
@@ -23,7 +24,7 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class FtpUtils {
|
||||
|
||||
@@ -59,7 +60,14 @@ public class FtpUtils {
|
||||
/** 3. 连接ftp服务器*/
|
||||
String ip = IpUtils.getIpFormDomainName(ftpConfig.getIp());
|
||||
ftp.connect(ip, ftpConfig.getPort());
|
||||
ftp.login(ftpConfig.getUsername(), ftpConfig.getPassword());
|
||||
boolean login = ftp.login(ftpConfig.getUsername(), ftpConfig.getPassword());
|
||||
if (login) {
|
||||
log.info("FTP登录成功");
|
||||
} else {
|
||||
log.info("FTP登录失败");
|
||||
}
|
||||
ftp.enterLocalPassiveMode(); // 设置为被动模式
|
||||
log.info("ftp连接信息, ip:{}, port:{}, 连接信息:{}", ip, ftpConfig.getPort(), ftp.getStatus());
|
||||
if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
|
||||
// 不合法时断开连接
|
||||
ftp.disconnect();
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.PileConnectorStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.YKCPileFaultReasonEnum;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||
@@ -37,303 +38,322 @@ import java.util.concurrent.TimeUnit;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class UploadRealTimeMonitorHandler extends AbstractHandler {
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_CODE.getBytes());
|
||||
private final String oldVersionType = YKCUtils.frameType2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_OLD_VERSION_CODE.getBytes());
|
||||
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_CODE.getBytes());
|
||||
private final String oldVersionType = YKCUtils.frameType2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_OLD_VERSION_CODE.getBytes());
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
YKCOperateFactory.register(type, this);
|
||||
YKCOperateFactory.register(oldVersionType, this);
|
||||
}
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
YKCOperateFactory.register(type, this);
|
||||
YKCOperateFactory.register(oldVersionType, this);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private PileBasicInfoService pileBasicInfoService;
|
||||
@Autowired
|
||||
private PileBasicInfoService pileBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
@Autowired
|
||||
private CommonService commonService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
||||
// log.info("[===获取桩上传的实时监测数据===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||
RealTimeMonitorData realTimeMonitorData = new RealTimeMonitorData();
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
||||
// log.info("[===获取桩上传的实时监测数据===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||
RealTimeMonitorData realTimeMonitorData = new RealTimeMonitorData();
|
||||
|
||||
// 获取消息体
|
||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||
// log.info("上传实时数据msgBody:{}", BytesUtil.bcd2Str(msgBody));
|
||||
int startIndex = 0;
|
||||
int length = 16;
|
||||
// 获取消息体
|
||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||
// log.info("上传实时数据msgBody:{}", BytesUtil.bcd2Str(msgBody));
|
||||
int startIndex = 0;
|
||||
int length = 16;
|
||||
|
||||
// 交易流水号
|
||||
byte[] orderCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String transactionCode = BytesUtil.bcd2Str(orderCodeByteArr);
|
||||
realTimeMonitorData.setTransactionCode(transactionCode);
|
||||
// 交易流水号
|
||||
byte[] orderCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String transactionCode = BytesUtil.bcd2Str(orderCodeByteArr);
|
||||
realTimeMonitorData.setTransactionCode(transactionCode);
|
||||
|
||||
// 桩编码
|
||||
startIndex += length;
|
||||
length = 7;
|
||||
byte[] pileSnByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
realTimeMonitorData.setPileSn(pileSn);
|
||||
// 桩编码
|
||||
startIndex += length;
|
||||
length = 7;
|
||||
byte[] pileSnByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
realTimeMonitorData.setPileSn(pileSn);
|
||||
|
||||
// 保存时间
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
// 保存时间
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] pileConnectorCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String connectorCode = BytesUtil.bcd2Str(pileConnectorCodeByteArr);
|
||||
realTimeMonitorData.setConnectorCode(connectorCode);
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] connectorCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String connectorCode = BytesUtil.bcd2Str(connectorCodeByteArr);
|
||||
realTimeMonitorData.setConnectorCode(connectorCode);
|
||||
|
||||
// 枪口编号
|
||||
String pileConnectorCode = pileSn + connectorCode;
|
||||
|
||||
// 枪口状态 0x00:离线 0x01:故障 0x02:空闲 0x03:充电 0x04 预约中
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] connectorStatusByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String connectorStatus = BytesUtil.bcd2Str(connectorStatusByteArr);
|
||||
realTimeMonitorData.setConnectorStatus(connectorStatus);
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] connectorStatusByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String connectorStatus = BytesUtil.bcd2Str(connectorStatusByteArr);
|
||||
realTimeMonitorData.setConnectorStatus(connectorStatus);
|
||||
|
||||
// 是否归位 0x00:否 0x01:是 0x02:未知(无法检测到枪是否插回枪座即 未知)
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] homingFlagByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String homingFlag = BytesUtil.bcd2Str(homingFlagByteArr);
|
||||
realTimeMonitorData.setHomingFlag(homingFlag);
|
||||
// 是否归位 0x00:否 0x01:是 0x02:未知(无法检测到枪是否插回枪座即 未知)
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] homingFlagByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String homingFlag = BytesUtil.bcd2Str(homingFlagByteArr);
|
||||
realTimeMonitorData.setHomingFlag(homingFlag);
|
||||
|
||||
// 是否插枪 0x00:否 0x01:是
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] putGunTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String putGunType = BytesUtil.bcd2Str(putGunTypeByteArr);
|
||||
realTimeMonitorData.setPutGunType(putGunType);
|
||||
// 是否插枪 0x00:否 0x01:是
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] isChargerPluggedInByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String isChargerPluggedIn = BytesUtil.bcd2Str(isChargerPluggedInByteArr);
|
||||
realTimeMonitorData.setPutGunType(isChargerPluggedIn);
|
||||
|
||||
// 输出电压 精确到小数点后一位;待机置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] outputVoltageByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String outputVoltage = YKCUtils.convertVoltageCurrent(outputVoltageByteArr);
|
||||
realTimeMonitorData.setOutputVoltage(outputVoltage);
|
||||
// 输出电压 精确到小数点后一位;待机置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] outputVoltageByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String outputVoltage = YKCUtils.convertVoltageCurrent(outputVoltageByteArr);
|
||||
realTimeMonitorData.setOutputVoltage(outputVoltage);
|
||||
|
||||
// 输出电流 精确到小数点后一位;待机置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] outputCurrentByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String outputCurrent = YKCUtils.convertVoltageCurrent(outputCurrentByteArr);
|
||||
realTimeMonitorData.setOutputCurrent(outputCurrent);
|
||||
// 输出电流 精确到小数点后一位;待机置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] outputCurrentByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String outputCurrent = YKCUtils.convertVoltageCurrent(outputCurrentByteArr);
|
||||
realTimeMonitorData.setOutputCurrent(outputCurrent);
|
||||
|
||||
// 枪线温度 整形, 偏移量-50;待机置零
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] gunLineTemperatureByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String gunLineTemperature = YKCUtils.transitionTemperature(gunLineTemperatureByteArr);
|
||||
realTimeMonitorData.setGunLineTemperature(gunLineTemperature);
|
||||
// 枪线温度 整形, 偏移量-50;待机置零
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] gunLineTemperatureByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String gunLineTemperature = YKCUtils.transitionTemperature(gunLineTemperatureByteArr);
|
||||
realTimeMonitorData.setGunLineTemperature(gunLineTemperature);
|
||||
|
||||
// 枪线编码 没有置零
|
||||
startIndex += length;
|
||||
length = 8;
|
||||
byte[] gunLineCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String gunLineCode = BytesUtil.bcd2Str(gunLineCodeByteArr);
|
||||
realTimeMonitorData.setGunLineCode(gunLineCode);
|
||||
// 枪线编码 没有置零
|
||||
startIndex += length;
|
||||
length = 8;
|
||||
byte[] gunLineCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String gunLineCode = BytesUtil.bcd2Str(gunLineCodeByteArr);
|
||||
realTimeMonitorData.setGunLineCode(gunLineCode);
|
||||
|
||||
// SOC 待机置零;交流桩置零
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] SOCByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String SOC = String.valueOf(SOCByteArr[0]);
|
||||
realTimeMonitorData.setSOC(SOC);
|
||||
// SOC 待机置零;交流桩置零
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] SOCByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String SOC = String.valueOf(SOCByteArr[0]);
|
||||
realTimeMonitorData.setSOC(SOC);
|
||||
|
||||
// 电池组最高温度 整形, 偏移量-50 ºC;待机置零; 交流桩置零
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] batteryMaxTemperatureByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String batteryMaxTemperature = YKCUtils.transitionTemperature(batteryMaxTemperatureByteArr);
|
||||
realTimeMonitorData.setBatteryMaxTemperature(batteryMaxTemperature);
|
||||
// 电池组最高温度 整形, 偏移量-50 ºC;待机置零; 交流桩置零
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] batteryMaxTemperatureByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String batteryMaxTemperature = YKCUtils.transitionTemperature(batteryMaxTemperatureByteArr);
|
||||
realTimeMonitorData.setBatteryMaxTemperature(batteryMaxTemperature);
|
||||
|
||||
// 累计充电时间 单位: min;待机置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] sumChargingTimeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
int sumChargingTime = BytesUtil.bytesToIntLittle(sumChargingTimeByteArr);
|
||||
realTimeMonitorData.setSumChargingTime(String.valueOf(sumChargingTime));
|
||||
// 累计充电时间 单位: min;待机置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] sumChargingTimeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
int sumChargingTime = BytesUtil.bytesToIntLittle(sumChargingTimeByteArr);
|
||||
realTimeMonitorData.setSumChargingTime(String.valueOf(sumChargingTime));
|
||||
|
||||
// 剩余时间 单位: min;待机置零、交流桩置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] timeRemainingByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
int timeRemaining = BytesUtil.bytesToIntLittle(timeRemainingByteArr);
|
||||
realTimeMonitorData.setTimeRemaining(String.valueOf(timeRemaining));
|
||||
// 剩余时间 单位: min;待机置零、交流桩置零
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] timeRemainingByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
int timeRemaining = BytesUtil.bytesToIntLittle(timeRemainingByteArr);
|
||||
realTimeMonitorData.setTimeRemaining(String.valueOf(timeRemaining));
|
||||
|
||||
// 充电度数 精确到小数点后四位;待机置零
|
||||
startIndex += length;
|
||||
length = 4;
|
||||
byte[] chargingDegreeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String chargingDegree = YKCUtils.convertDecimalPoint(chargingDegreeByteArr, 4);
|
||||
realTimeMonitorData.setChargingDegree(chargingDegree);
|
||||
// 充电度数 精确到小数点后四位;待机置零
|
||||
startIndex += length;
|
||||
length = 4;
|
||||
byte[] chargingDegreeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String chargingDegree = YKCUtils.convertDecimalPoint(chargingDegreeByteArr, 4);
|
||||
realTimeMonitorData.setChargingDegree(chargingDegree);
|
||||
|
||||
// 计损充电度数 精确到小数点后四位;待机置零 未设置计损比例时等于充电度数
|
||||
startIndex += length;
|
||||
length = 4;
|
||||
byte[] lossDegreeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String lossDegree = YKCUtils.convertDecimalPoint(lossDegreeByteArr, 4);
|
||||
realTimeMonitorData.setLossDegree(lossDegree);
|
||||
// 计损充电度数 精确到小数点后四位;待机置零 未设置计损比例时等于充电度数
|
||||
startIndex += length;
|
||||
length = 4;
|
||||
byte[] lossDegreeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String lossDegree = YKCUtils.convertDecimalPoint(lossDegreeByteArr, 4);
|
||||
realTimeMonitorData.setLossDegree(lossDegree);
|
||||
|
||||
// 已充金额 精确到小数点后四位;待机置零 (电费+服务费) *计损充电度数
|
||||
startIndex += length;
|
||||
length = 4;
|
||||
byte[] chargingAmountByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String chargingAmount = YKCUtils.convertDecimalPoint(chargingAmountByteArr, 4);
|
||||
realTimeMonitorData.setChargingAmount(chargingAmount);
|
||||
// 已充金额 精确到小数点后四位;待机置零 (电费+服务费) *计损充电度数
|
||||
startIndex += length;
|
||||
length = 4;
|
||||
byte[] chargingAmountByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String chargingAmount = YKCUtils.convertDecimalPoint(chargingAmountByteArr, 4);
|
||||
realTimeMonitorData.setChargingAmount(chargingAmount);
|
||||
|
||||
/**
|
||||
* 硬件故障
|
||||
*
|
||||
* Bit 位表示(0 否 1 是), 低位到高位顺序
|
||||
* Bit1:急停按钮动作故障;
|
||||
* Bit2:无可用整流模块;
|
||||
* Bit3:出风口温度过高;
|
||||
* Bit4:交流防雷故障;
|
||||
* Bit5:交直流模块 DC20 通信中断;
|
||||
* Bit6:绝缘检测模块 FC08 通信中断;
|
||||
* Bit7:电度表通信中断;
|
||||
* Bit8:读卡器通信中断;
|
||||
* Bit9: RC10 通信中断;
|
||||
* Bit10:风扇调速板故障;
|
||||
* Bit11:直流熔断器故障;
|
||||
* Bit12:高压接触器故障;
|
||||
* Bit13:门打开;
|
||||
*/
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] hardwareFaultTempByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String hardwareFaultTemp = BytesUtil.bcd2Str(hardwareFaultTempByteArr);
|
||||
String faultReason = "无";
|
||||
/**
|
||||
* 硬件故障
|
||||
*
|
||||
* Bit 位表示(0 否 1 是), 低位到高位顺序
|
||||
* Bit1:急停按钮动作故障;
|
||||
* Bit2:无可用整流模块;
|
||||
* Bit3:出风口温度过高;
|
||||
* Bit4:交流防雷故障;
|
||||
* Bit5:交直流模块 DC20 通信中断;
|
||||
* Bit6:绝缘检测模块 FC08 通信中断;
|
||||
* Bit7:电度表通信中断;
|
||||
* Bit8:读卡器通信中断;
|
||||
* Bit9: RC10 通信中断;
|
||||
* Bit10:风扇调速板故障;
|
||||
* Bit11:直流熔断器故障;
|
||||
* Bit12:高压接触器故障;
|
||||
* Bit13:门打开;
|
||||
*/
|
||||
startIndex += length;
|
||||
length = 2;
|
||||
byte[] hardwareFaultTempByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String hardwareFaultTemp = BytesUtil.bcd2Str(hardwareFaultTempByteArr);
|
||||
String faultReason = "无";
|
||||
|
||||
if (!StringUtils.equals(hardwareFaultTemp, "0000")) {
|
||||
// 不等于0000说明有故障
|
||||
StringBuffer sb = new StringBuffer(hardwareFaultTemp);
|
||||
String lowOrder = sb.substring(0, 2);
|
||||
String highOrder = sb.substring(2, 4);
|
||||
if (!StringUtils.equals(hardwareFaultTemp, "0000")) {
|
||||
// 不等于0000说明有故障
|
||||
StringBuffer sb = new StringBuffer(hardwareFaultTemp);
|
||||
String lowOrder = sb.substring(0, 2);
|
||||
String highOrder = sb.substring(2, 4);
|
||||
|
||||
// String hardwareFault = highOrder + lowOrder;
|
||||
byte[] hardwareFaultByteArr = BytesUtil.str2Bcd(highOrder + lowOrder);
|
||||
String binStr = BytesUtil.bytes2BinStr(hardwareFaultByteArr);
|
||||
// log.info("binStr:{}", binStr); // 0000 0000 0000 0001
|
||||
int faultCode = 0;
|
||||
for (int i = 0; i < binStr.length(); i++) {
|
||||
if (binStr.charAt(i) == '1') {
|
||||
faultCode = 15 - i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
faultReason = YKCPileFaultReasonEnum.getValueByCode(faultCode);
|
||||
// log.info("故障码:{}, 故障原因:{}", faultCode, faultReason);
|
||||
}
|
||||
realTimeMonitorData.setHardwareFault(faultReason);
|
||||
// String hardwareFault = highOrder + lowOrder;
|
||||
byte[] hardwareFaultByteArr = BytesUtil.str2Bcd(highOrder + lowOrder);
|
||||
String binStr = BytesUtil.bytes2BinStr(hardwareFaultByteArr);
|
||||
// log.info("binStr:{}", binStr); // 0000 0000 0000 0001
|
||||
int faultCode = 0;
|
||||
for (int i = 0; i < binStr.length(); i++) {
|
||||
if (binStr.charAt(i) == '1') {
|
||||
faultCode = 15 - i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
faultReason = YKCPileFaultReasonEnum.getValueByCode(faultCode);
|
||||
}
|
||||
realTimeMonitorData.setHardwareFault(faultReason);
|
||||
|
||||
// if (!StringUtils.equals(connectorStatus, "02")) {
|
||||
if (!StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FREE.getValue())) {
|
||||
log.info("0x13上传实时监测数据==交易流水号:{}, 桩编号:{}, 枪口号:{}, 枪口状态:{}, 枪口状态描述:{}, 枪是否归位(00-否;01-是;02-未知):{}, 是否插枪(00-否;01-是):{}, 输出电压:{}, 输出电流:{}, 枪线温度:{}, " +
|
||||
"枪线编码:{}, SOC:{}, 电池组最高温度:{}, 累计充电时间:{}, 剩余时间:{}, 充电度数:{}, 记损充电度数:{}, 已充金额:{}, " +
|
||||
"硬件故障:{}, 故障码转换结果:{}", transactionCode, pileSn, connectorCode, connectorStatus, PileConnectorStatusEnum.getLabelByValue(connectorStatus), homingFlag, putGunType, outputVoltage,
|
||||
outputCurrent, gunLineTemperature, gunLineCode, SOC, batteryMaxTemperature, sumChargingTime, timeRemaining,
|
||||
chargingDegree, lossDegree, chargingAmount, hardwareFaultTemp, faultReason
|
||||
);
|
||||
}
|
||||
if (!StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FREE.getValue())) {
|
||||
log.info("0x13上传实时监测数据==交易流水号:{}, 桩编号:{}, 枪口号:{}, 枪口状态:{}, 枪口状态描述:{}, 枪是否归位(00-否;01-是;02-未知):{}, 是否插枪(00-否;01-是):{}, 输出电压:{}, 输出电流:{}, 枪线温度:{}, " +
|
||||
"枪线编码:{}, SOC:{}, 电池组最高温度:{}, 累计充电时间:{}, 剩余时间:{}, 充电度数:{}, 记损充电度数:{}, 已充金额:{}, " +
|
||||
"硬件故障:{}, 故障码转换结果:{}", transactionCode, pileSn, connectorCode, connectorStatus, PileConnectorStatusEnum.getLabelByValue(connectorStatus), homingFlag, isChargerPluggedIn, outputVoltage,
|
||||
outputCurrent, gunLineTemperature, gunLineCode, SOC, batteryMaxTemperature, sumChargingTime, timeRemaining,
|
||||
chargingDegree, lossDegree, chargingAmount, hardwareFaultTemp, faultReason
|
||||
);
|
||||
}
|
||||
|
||||
// 公共方法修改状态
|
||||
pileBasicInfoService.updateStatus(BytesUtil.bcd2Str(ykcDataProtocol.getFrameType()), pileSn, connectorCode, connectorStatus, putGunType);
|
||||
// 插枪状态
|
||||
String plugRedisKey = CacheConstants.CHARGER_PLUGGED_IN_STATUS + pileConnectorCode;
|
||||
if (StringUtils.equals("01", isChargerPluggedIn)) {
|
||||
// 插枪状态
|
||||
if (redisCache.setnx(plugRedisKey, pileConnectorCode, CacheConstants.cache_expire_time_30d)) {
|
||||
log.info("时间:{}, 枪口号:{}, 首次插入充电枪", DateUtils.getDateTime(), pileConnectorCode);
|
||||
// 设置成功说明 第一次插枪
|
||||
pileBasicInfoService.firstPlugInCharger(pileConnectorCode);
|
||||
}
|
||||
} else {
|
||||
// 未插枪状态
|
||||
if (redisCache.hasKey(plugRedisKey) && redisCache.deleteObject(plugRedisKey)) {
|
||||
log.info("时间:{}, 枪口号:{}, 首次拔出充电枪", DateUtils.getDateTime(), pileConnectorCode);
|
||||
// redis有值,并且删除成功,说明首次拔枪
|
||||
pileBasicInfoService.firstUnplugCharger(pileConnectorCode);
|
||||
}
|
||||
}
|
||||
|
||||
// 01表示故障
|
||||
if (StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FAULT.getValue())) {
|
||||
// 故障原因存入缓存
|
||||
String redisKey = CacheConstants.PILE_HARDWARE_FAULT + pileSn + connectorCode;
|
||||
redisCache.setCacheObject(redisKey, faultReason, 5, TimeUnit.MINUTES);
|
||||
}
|
||||
// 公共方法修改状态
|
||||
pileBasicInfoService.updateStatus(BytesUtil.bcd2Str(ykcDataProtocol.getFrameType()), pileSn, connectorCode, connectorStatus, isChargerPluggedIn);
|
||||
|
||||
// 03表示充电中
|
||||
if (StringUtils.equals(connectorStatus, PileConnectorStatusEnum.OCCUPIED_CHARGING.getValue())) {
|
||||
// 默认保存到redis
|
||||
boolean saveRedisFlag = true;
|
||||
// 01表示故障
|
||||
if (StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FAULT.getValue())) {
|
||||
// 故障原因存入缓存
|
||||
String redisKey = CacheConstants.PILE_HARDWARE_FAULT + pileConnectorCode;
|
||||
redisCache.setCacheObject(redisKey, faultReason, 5, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
// 查询数据库中该订单当前信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
||||
if (Objects.nonNull(orderInfo)) {
|
||||
if (StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.ORDER_COMPLETE.getValue())
|
||||
|| StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.STAY_SETTLEMENT.getValue())) {
|
||||
// 在订单状态为 订单完成或待结算,不保存
|
||||
saveRedisFlag = false;
|
||||
}
|
||||
// 03表示充电中
|
||||
if (StringUtils.equals(connectorStatus, PileConnectorStatusEnum.OCCUPIED_CHARGING.getValue())) {
|
||||
// 默认保存到redis
|
||||
boolean saveRedisFlag = true;
|
||||
|
||||
boolean updateFlag = false;
|
||||
if (StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.NOT_START.getValue())
|
||||
|| StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.ABNORMAL.getValue())
|
||||
|| StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.STAY_SETTLEMENT.getValue())) {
|
||||
updateFlag = true;
|
||||
// 如果是未启动状态或者异常状态, 修改这个订单状态为充电中 2023年7月7日新增 如果是待结算状态,也改为充电中
|
||||
orderInfo.setOrderStatus(OrderStatusEnum.IN_THE_CHARGING.getValue());
|
||||
}
|
||||
// 查询数据库中该订单当前信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
||||
if (Objects.nonNull(orderInfo)) {
|
||||
if (StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.ORDER_COMPLETE.getValue())
|
||||
|| StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.STAY_SETTLEMENT.getValue())) {
|
||||
// 在订单状态为 订单完成或待结算,不保存
|
||||
saveRedisFlag = false;
|
||||
}
|
||||
|
||||
// 如果原来没有开始充电时间就保存当前时间为开始充电时间
|
||||
if (orderInfo.getChargeStartTime() == null) {
|
||||
updateFlag = true;
|
||||
orderInfo.setChargeStartTime(new Date());
|
||||
}
|
||||
boolean updateFlag = false;
|
||||
if (StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.NOT_START.getValue())
|
||||
|| StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.ABNORMAL.getValue())
|
||||
|| StringUtils.equals(orderInfo.getOrderStatus(), OrderStatusEnum.STAY_SETTLEMENT.getValue())) {
|
||||
updateFlag = true;
|
||||
// 如果是未启动状态或者异常状态, 修改这个订单状态为充电中 2023年7月7日新增 如果是待结算状态,也改为充电中
|
||||
orderInfo.setOrderStatus(OrderStatusEnum.IN_THE_CHARGING.getValue());
|
||||
}
|
||||
|
||||
if (updateFlag) {
|
||||
orderBasicInfoService.updateOrderBasicInfo(orderInfo);
|
||||
}
|
||||
}
|
||||
// 如果原来没有开始充电时间就保存当前时间为开始充电时间
|
||||
if (orderInfo.getChargeStartTime() == null) {
|
||||
updateFlag = true;
|
||||
orderInfo.setChargeStartTime(new Date());
|
||||
}
|
||||
|
||||
// 充电时保存实时数据到redis
|
||||
if (saveRedisFlag) {
|
||||
pileBasicInfoService.saveRealTimeMonitorData2Redis(realTimeMonitorData);
|
||||
}
|
||||
}
|
||||
if (updateFlag) {
|
||||
orderBasicInfoService.updateOrderBasicInfo(orderInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// 异步推送第三方平台实时数据
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
commonService.pushRealTimeInfo(pileSn, connectorCode, connectorStatus, realTimeMonitorData, transactionCode);
|
||||
} catch (Exception e) {
|
||||
log.error("统一推送第三方平台实时数据 error, ", e);
|
||||
}
|
||||
});
|
||||
// 充电时保存实时数据到redis
|
||||
if (saveRedisFlag) {
|
||||
pileBasicInfoService.saveRealTimeMonitorData2Redis(realTimeMonitorData);
|
||||
}
|
||||
}
|
||||
|
||||
// 异步推送第三方平台实时数据V2
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
commonService.pushRealTimeInfoV2(pileSn, connectorCode, connectorStatus, realTimeMonitorData, transactionCode);
|
||||
} catch (Exception e) {
|
||||
log.error("统一推送第三方平台实时数据V2 error, ", e);
|
||||
}
|
||||
});
|
||||
// 异步推送第三方平台实时数据
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
commonService.pushRealTimeInfo(pileSn, connectorCode, connectorStatus, realTimeMonitorData, transactionCode);
|
||||
} catch (Exception e) {
|
||||
log.error("统一推送第三方平台实时数据 error, ", e);
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
// 异步推送第三方平台实时数据V2
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
commonService.pushRealTimeInfoV2(pileSn, connectorCode, connectorStatus, realTimeMonitorData, transactionCode);
|
||||
} catch (Exception e) {
|
||||
log.error("统一推送第三方平台实时数据V2 error, ", e);
|
||||
}
|
||||
});
|
||||
|
||||
public static void main(String[] args) {
|
||||
StringBuffer sb = new StringBuffer("0100");
|
||||
String lowOrder = sb.substring(0, 2);
|
||||
String highOrder = sb.substring(2, 4);
|
||||
return null;
|
||||
}
|
||||
|
||||
// String hardwareFault = highOrder + lowOrder;
|
||||
byte[] hardwareFaultByteArr = BytesUtil.str2Bcd(highOrder + lowOrder);
|
||||
String binStr = BytesUtil.bytes2BinStr(hardwareFaultByteArr);
|
||||
// log.info("binStr:{}", binStr); // 0000 0000 0000 0001
|
||||
int faultCode = 0;
|
||||
for (int i = 0; i < binStr.length(); i++) {
|
||||
if (binStr.charAt(i) == '1') {
|
||||
faultCode = 16 - i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String faultReason = YKCPileFaultReasonEnum.getValueByCode(faultCode);
|
||||
System.out.println(faultReason);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
StringBuffer sb = new StringBuffer("0100");
|
||||
String lowOrder = sb.substring(0, 2);
|
||||
String highOrder = sb.substring(2, 4);
|
||||
|
||||
// String hardwareFault = highOrder + lowOrder;
|
||||
byte[] hardwareFaultByteArr = BytesUtil.str2Bcd(highOrder + lowOrder);
|
||||
String binStr = BytesUtil.bytes2BinStr(hardwareFaultByteArr);
|
||||
// log.info("binStr:{}", binStr); // 0000 0000 0000 0001
|
||||
int faultCode = 0;
|
||||
for (int i = 0; i < binStr.length(); i++) {
|
||||
if (binStr.charAt(i) == '1') {
|
||||
faultCode = 16 - i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String faultReason = YKCPileFaultReasonEnum.getValueByCode(faultCode);
|
||||
System.out.println(faultReason);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.pile.domain;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -31,6 +32,11 @@ public class PileReservedInfo {
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
/**
|
||||
* 充电桩枪口编号
|
||||
*/
|
||||
private String pileConnectorCode;
|
||||
|
||||
/**
|
||||
* 状态(0-未生效;1-生效)
|
||||
*/
|
||||
@@ -44,12 +50,12 @@ public class PileReservedInfo {
|
||||
/**
|
||||
* 预约开始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
private Time startTime;
|
||||
|
||||
/**
|
||||
* 预约结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
private Time endTime;
|
||||
|
||||
/**
|
||||
* 周期性预约的频率,对于单次预约,该字段可以为 NULL。可能的值包括 daily, weekly, monthly
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class CreateReservedDTO {
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 充电桩编号
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
/**
|
||||
* 充电桩枪口编号
|
||||
*/
|
||||
private String pileConnectorCode;
|
||||
|
||||
/**
|
||||
* 预约开始时间
|
||||
*/
|
||||
private String startTime;
|
||||
|
||||
/**
|
||||
* 预约结束时间
|
||||
*/
|
||||
private String endTime;
|
||||
|
||||
/**
|
||||
* 周期性预约的频率,对于单次预约,该字段可以为 NULL。可能的值包括 daily, weekly, monthly
|
||||
*/
|
||||
private String freq;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
|
||||
.append("memberId", memberId)
|
||||
.append("pileSn", pileSn)
|
||||
.append("startTime", startTime)
|
||||
.append("endTime", endTime)
|
||||
.append("freq", freq)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class PileReservedDTO {
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 预约id
|
||||
*/
|
||||
private String reservedId;
|
||||
|
||||
/**
|
||||
* 状态 (0-停用;1-启用)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 桩编号
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
private Integer pageNo;
|
||||
|
||||
private Integer pageSize;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
|
||||
.append("memberId", memberId)
|
||||
.append("reservedId", reservedId)
|
||||
.append("status", status)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -116,6 +116,16 @@ public interface PileBasicInfoService {
|
||||
*/
|
||||
List<PileDetailVO> selectPileListByStationIds(List<Long> stationIdList);
|
||||
|
||||
/**
|
||||
* 首次插枪
|
||||
*/
|
||||
public void firstPlugInCharger(String pileConnectorCode);
|
||||
|
||||
/**
|
||||
* 首次拔枪
|
||||
*/
|
||||
public void firstUnplugCharger(String pileConnectorCode);
|
||||
|
||||
/**
|
||||
* 通过桩编号查询站点id
|
||||
* @param sn 桩编号
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.jsowell.pile.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.pile.dto.PileReservedDTO;
|
||||
import com.jsowell.pile.domain.PileReservedInfo;
|
||||
|
||||
public interface PileReservedInfoService {
|
||||
@@ -31,9 +32,24 @@ public interface PileReservedInfoService {
|
||||
|
||||
List<PileReservedInfo> getReservationsByMemberIdAndPileSn(String memberId, String pileSn);
|
||||
|
||||
void activateReservation(int reservationId);
|
||||
/**
|
||||
* 启动预约
|
||||
* @param dto
|
||||
*/
|
||||
void activateReserved(PileReservedDTO dto);
|
||||
|
||||
void deactivateReservation(int reservationId);
|
||||
/**
|
||||
* 关闭预约
|
||||
* @param dto
|
||||
*/
|
||||
void deactivateReserved(PileReservedDTO dto);
|
||||
|
||||
/**
|
||||
* 根据充电枪口编号发送预约指令
|
||||
* @param pileConnectorCode
|
||||
*/
|
||||
void pushReservedByPileConnectorCode(String pileConnectorCode);
|
||||
|
||||
void cancelOneTimeReservation(String pileConnectorCode);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,18 +82,15 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
@Autowired
|
||||
private SimCardService simCardService;
|
||||
|
||||
@Autowired
|
||||
private PileSimInfoMapper pileSimInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private PileMerchantInfoMapper pileMerchantInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Value("${baseurl.prefix}")
|
||||
private String BASE_URL_PREFIX;
|
||||
|
||||
@Autowired
|
||||
private PileReservedInfoService pileReservedInfoService;
|
||||
|
||||
/**
|
||||
* 查询设备管理
|
||||
*
|
||||
@@ -460,6 +457,28 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
return pileInfoVOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 首次插枪
|
||||
*
|
||||
* @param pileConnectorCode
|
||||
*/
|
||||
@Override
|
||||
public void firstPlugInCharger(String pileConnectorCode) {
|
||||
// 下发预约指令
|
||||
pileReservedInfoService.pushReservedByPileConnectorCode(pileConnectorCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 首次拔枪
|
||||
*
|
||||
* @param pileConnectorCode
|
||||
*/
|
||||
@Override
|
||||
public void firstUnplugCharger(String pileConnectorCode) {
|
||||
// 关闭仅执行一次的预约
|
||||
pileReservedInfoService.cancelOneTimeReservation(pileConnectorCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* 用于登陆协议,心跳包协议,上传实时数据协议 更新状态的方法
|
||||
@@ -476,10 +495,10 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
* 7.上传实时数据,枪状态传0x03充电,设置为【3-占用(充电中)】
|
||||
*/
|
||||
@Override
|
||||
public void updateStatus(String frameType, String pileSn, String connectorCode, String status, String putGunType) {
|
||||
public void updateStatus(String frameType, String pileSn, String connectorCode, String status, String isChargerPluggedIn) {
|
||||
// 清缓存
|
||||
cleanRedisCache(pileSn);
|
||||
// log.info("updateStatus传参:帧类型:{}, 桩编号:{}, 枪口号:{}, 状态:{}, 插拔枪:{}", "0x" + frameType, pileSn, connectorCode, status, putGunType);
|
||||
// log.info("updateStatus传参:帧类型:{}, 桩编号:{}, 枪口号:{}, 状态:{}, 插拔枪:{}", "0x" + frameType, pileSn, connectorCode, status, isChargerPluggedIn);
|
||||
/*
|
||||
0x01 登陆认证
|
||||
登陆成功,把充电桩和枪口的状态都更新为【在线】
|
||||
@@ -522,7 +541,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
*/
|
||||
if (StringUtils.equals(frameType, BytesUtil.bcd2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_CODE.getBytes()))
|
||||
|| StringUtils.equals(frameType, BytesUtil.bcd2Str(YKCFrameTypeCode.UPLOAD_REAL_TIME_MONITOR_DATA_OLD_VERSION_CODE.getBytes()))) {
|
||||
// log.info("上传实时数据中的修改状态逻辑 桩号:{}, 枪号:{}, 枪状态{}, 是否插枪:{}", pileSn, connectorCode, status, putGunType);
|
||||
// log.info("上传实时数据中的修改状态逻辑 桩号:{}, 枪号:{}, 枪状态{}, 是否插枪:{}", pileSn, connectorCode, status, isChargerPluggedIn);
|
||||
/**
|
||||
* 更新枪状态
|
||||
* connectorStatus 桩传过来的枪口状态: 0x00:离线 0x01:故障 0x02:空闲 0x03:充电
|
||||
@@ -535,7 +554,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
statusDataBase = PileConnectorDataBaseStatusEnum.FAULT.getValue();
|
||||
} else if (StringUtils.equals(status, PileConnectorStatusEnum.FREE.getValue())) { // 空闲
|
||||
//是否插枪 0x00:否 0x01:是
|
||||
if (StringUtils.equals(putGunType, Constants.ZERO_ONE)) {
|
||||
if (StringUtils.equals(isChargerPluggedIn, Constants.ZERO_ONE)) {
|
||||
// 空闲并插枪 设置为【占用(未充电)】
|
||||
statusDataBase = PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue();
|
||||
} else {
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.dto.PileReservedDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.pile.mapper.PileReservedInfoMapper;
|
||||
@@ -81,32 +84,38 @@ public class PileReservedInfoServiceImpl implements PileReservedInfoService {
|
||||
|
||||
/**
|
||||
* 启用预约
|
||||
* @param reservationId
|
||||
*/
|
||||
@Override
|
||||
public void activateReservation(int reservationId) {
|
||||
PileReservedInfo pileReservedInfo = pileReservedInfoMapper.selectByPrimaryKey(reservationId);
|
||||
if (pileReservedInfo != null) {
|
||||
pileReservedInfo.setStatus(Constants.ONE);
|
||||
// pileReservedInfoMapper.updateByPrimaryKeySelective(pileReservedInfo);
|
||||
saveReservation(pileReservedInfo);
|
||||
public void activateReserved(PileReservedDTO dto) {
|
||||
PileReservedInfo pileReservedInfo = pileReservedInfoMapper.selectByPrimaryKey(Integer.parseInt(dto.getReservedId()));
|
||||
if (pileReservedInfo == null) {
|
||||
return;
|
||||
}
|
||||
if (!StringUtils.equals(dto.getMemberId(), pileReservedInfo.getMemberId())) {
|
||||
return;
|
||||
}
|
||||
pileReservedInfo.setStatus(Constants.ONE);
|
||||
// 保存之前,校验时间是否重叠
|
||||
saveReservation(pileReservedInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用预约
|
||||
* @param reservationId
|
||||
*/
|
||||
@Override
|
||||
public void deactivateReservation(int reservationId) {
|
||||
PileReservedInfo pileReservedInfo = pileReservedInfoMapper.selectByPrimaryKey(reservationId);
|
||||
if (pileReservedInfo != null) {
|
||||
pileReservedInfo.setStatus(Constants.ZERO);
|
||||
pileReservedInfoMapper.updateByPrimaryKeySelective(pileReservedInfo);
|
||||
public void deactivateReserved(PileReservedDTO dto) {
|
||||
PileReservedInfo pileReservedInfo = pileReservedInfoMapper.selectByPrimaryKey(Integer.parseInt(dto.getReservedId()));
|
||||
if (pileReservedInfo == null) {
|
||||
return;
|
||||
}
|
||||
if (!StringUtils.equals(dto.getMemberId(), pileReservedInfo.getMemberId())) {
|
||||
return;
|
||||
}
|
||||
// 校验通过可以修改预约
|
||||
pileReservedInfo.setStatus(Constants.ZERO);
|
||||
pileReservedInfoMapper.updateByPrimaryKeySelective(pileReservedInfo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验时间是否重叠
|
||||
* @param memberId
|
||||
@@ -116,17 +125,17 @@ public class PileReservedInfoServiceImpl implements PileReservedInfoService {
|
||||
* @param reservationId
|
||||
* @return
|
||||
*/
|
||||
public boolean isTimeSlotAvailable(String memberId, String pileSn, Date startTime, Date endTime, Integer reservationId) {
|
||||
public boolean isTimeSlotAvailable(String memberId, String pileSn, Time startTime, Time endTime, Integer reservationId) {
|
||||
List<PileReservedInfo> reservations = pileReservedInfoMapper.findByMemberIdAndPileSnAndStatus(memberId, pileSn, "1");
|
||||
LocalTime newStartTime = LocalTime.parse(DateUtils.formatDateTime(startTime));
|
||||
LocalTime newEndTime = LocalTime.parse(DateUtils.formatDateTime(endTime));
|
||||
LocalTime newStartTime = startTime.toLocalTime();
|
||||
LocalTime newEndTime = endTime.toLocalTime();
|
||||
|
||||
for (PileReservedInfo res : reservations) {
|
||||
if (res.getId().equals(reservationId)) {
|
||||
continue; // Skip the current reservation if updating
|
||||
}
|
||||
LocalTime existingStartTime = LocalTime.parse(DateUtils.formatDateTime(res.getStartTime()));
|
||||
LocalTime existingEndTime = LocalTime.parse(DateUtils.formatDateTime(res.getEndTime()));
|
||||
LocalTime existingStartTime = res.getStartTime().toLocalTime();
|
||||
LocalTime existingEndTime = res.getEndTime().toLocalTime();
|
||||
|
||||
if (newStartTime.isBefore(existingEndTime) && newEndTime.isAfter(existingStartTime)) {
|
||||
return false; // Time slot overlaps
|
||||
@@ -139,8 +148,17 @@ public class PileReservedInfoServiceImpl implements PileReservedInfoService {
|
||||
if (isTimeSlotAvailable(reservation.getMemberId(), reservation.getPileSn(), reservation.getStartTime(), reservation.getEndTime(), reservation.getId())) {
|
||||
this.updateByPrimaryKeySelective(reservation);
|
||||
} else {
|
||||
throw new RuntimeException("Time slot overlaps with an existing reservation.");
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_UPDATE_RESERVED_STATUS_REFUSED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据充电枪口编号发送指令
|
||||
* @param pileConnectorCode
|
||||
*/
|
||||
@Override
|
||||
public void pushReservedByPileConnectorCode(String pileConnectorCode) {
|
||||
// 根据充电枪口编号查询正在生效中的预约
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.jsowell.pile.vo;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class PileReservedVO {
|
||||
private String reservedId;
|
||||
|
||||
/**
|
||||
* 充电桩编号
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
/**
|
||||
* 预约开始时间
|
||||
*/
|
||||
private String startTime;
|
||||
|
||||
/**
|
||||
* 预约结束时间
|
||||
*/
|
||||
private String endTime;
|
||||
|
||||
/**
|
||||
* 周期性预约的频率,对于单次预约,该字段可以为 NULL。可能的值包括 daily, weekly, monthly
|
||||
*/
|
||||
private String freq;
|
||||
|
||||
/**
|
||||
* 状态(0-未生效;1-生效)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="member_id" jdbcType="VARCHAR" property="memberId" />
|
||||
<result column="pile_sn" jdbcType="VARCHAR" property="pileSn" />
|
||||
<result column="pile_connector_code" jdbcType="VARCHAR" property="pileConnectorCode" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="reserved_type" jdbcType="VARCHAR" property="reservedType" />
|
||||
<result column="start_time" jdbcType="TIME" property="startTime" />
|
||||
@@ -20,8 +21,8 @@
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, member_id, pile_sn, `status`, reserved_type, start_time, end_time, freq, create_by,
|
||||
create_time, update_by, update_time, del_flag
|
||||
id, member_id, pile_sn, pile_connector_code, `status`, reserved_type, start_time,
|
||||
end_time, freq, create_by, create_time, update_by, update_time, del_flag
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
<!--@mbg.generated-->
|
||||
@@ -37,16 +38,16 @@
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservedInfo" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into pile_reserved_info (member_id, pile_sn, `status`,
|
||||
reserved_type, start_time, end_time,
|
||||
freq, create_by, create_time,
|
||||
update_by, update_time, del_flag
|
||||
)
|
||||
values (#{memberId,jdbcType=VARCHAR}, #{pileSn,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
#{reservedType,jdbcType=VARCHAR}, #{startTime,jdbcType=TIME}, #{endTime,jdbcType=TIME},
|
||||
#{freq,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=CHAR}
|
||||
)
|
||||
insert into pile_reserved_info (member_id, pile_sn, pile_connector_code,
|
||||
`status`, reserved_type, start_time,
|
||||
end_time, freq, create_by,
|
||||
create_time, update_by, update_time,
|
||||
del_flag)
|
||||
values (#{memberId,jdbcType=VARCHAR}, #{pileSn,jdbcType=VARCHAR}, #{pileConnectorCode,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{reservedType,jdbcType=VARCHAR}, #{startTime,jdbcType=TIME},
|
||||
#{endTime,jdbcType=TIME}, #{freq,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
|
||||
#{delFlag,jdbcType=CHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservedInfo" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
@@ -58,6 +59,9 @@
|
||||
<if test="pileSn != null">
|
||||
pile_sn,
|
||||
</if>
|
||||
<if test="pileConnectorCode != null">
|
||||
pile_connector_code,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status`,
|
||||
</if>
|
||||
@@ -96,6 +100,9 @@
|
||||
<if test="pileSn != null">
|
||||
#{pileSn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="pileConnectorCode != null">
|
||||
#{pileConnectorCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -138,6 +145,9 @@
|
||||
<if test="pileSn != null">
|
||||
pile_sn = #{pileSn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="pileConnectorCode != null">
|
||||
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -176,6 +186,7 @@
|
||||
update pile_reserved_info
|
||||
set member_id = #{memberId,jdbcType=VARCHAR},
|
||||
pile_sn = #{pileSn,jdbcType=VARCHAR},
|
||||
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
reserved_type = #{reservedType,jdbcType=VARCHAR},
|
||||
start_time = #{startTime,jdbcType=TIME},
|
||||
@@ -202,6 +213,11 @@
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.pileSn,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="pile_connector_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.pileConnectorCode,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="`status` = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=VARCHAR}
|
||||
@@ -276,6 +292,13 @@
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="pile_connector_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.pileConnectorCode != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.pileConnectorCode,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="`status` = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.status != null">
|
||||
@@ -355,15 +378,15 @@
|
||||
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into pile_reserved_info
|
||||
(member_id, pile_sn, `status`, reserved_type, start_time, end_time, freq, create_by,
|
||||
create_time, update_by, update_time, del_flag)
|
||||
(member_id, pile_sn, pile_connector_code, `status`, reserved_type, start_time, end_time,
|
||||
freq, create_by, create_time, update_by, update_time, del_flag)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.memberId,jdbcType=VARCHAR}, #{item.pileSn,jdbcType=VARCHAR}, #{item.status,jdbcType=VARCHAR},
|
||||
#{item.reservedType,jdbcType=VARCHAR}, #{item.startTime,jdbcType=TIME}, #{item.endTime,jdbcType=TIME},
|
||||
#{item.freq,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
|
||||
#{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.delFlag,jdbcType=CHAR}
|
||||
)
|
||||
(#{item.memberId,jdbcType=VARCHAR}, #{item.pileSn,jdbcType=VARCHAR}, #{item.pileConnectorCode,jdbcType=VARCHAR},
|
||||
#{item.status,jdbcType=VARCHAR}, #{item.reservedType,jdbcType=VARCHAR}, #{item.startTime,jdbcType=TIME},
|
||||
#{item.endTime,jdbcType=TIME}, #{item.freq,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR},
|
||||
#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
|
||||
#{item.delFlag,jdbcType=CHAR})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.PileReservedInfo" useGeneratedKeys="true">
|
||||
@@ -375,6 +398,7 @@
|
||||
</if>
|
||||
member_id,
|
||||
pile_sn,
|
||||
pile_connector_code,
|
||||
`status`,
|
||||
reserved_type,
|
||||
start_time,
|
||||
@@ -393,6 +417,7 @@
|
||||
</if>
|
||||
#{memberId,jdbcType=VARCHAR},
|
||||
#{pileSn,jdbcType=VARCHAR},
|
||||
#{pileConnectorCode,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR},
|
||||
#{reservedType,jdbcType=VARCHAR},
|
||||
#{startTime,jdbcType=TIME},
|
||||
@@ -411,6 +436,7 @@
|
||||
</if>
|
||||
member_id = #{memberId,jdbcType=VARCHAR},
|
||||
pile_sn = #{pileSn,jdbcType=VARCHAR},
|
||||
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
reserved_type = #{reservedType,jdbcType=VARCHAR},
|
||||
start_time = #{startTime,jdbcType=TIME},
|
||||
@@ -436,6 +462,9 @@
|
||||
<if test="pileSn != null">
|
||||
pile_sn,
|
||||
</if>
|
||||
<if test="pileConnectorCode != null">
|
||||
pile_connector_code,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status`,
|
||||
</if>
|
||||
@@ -478,6 +507,9 @@
|
||||
<if test="pileSn != null">
|
||||
#{pileSn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="pileConnectorCode != null">
|
||||
#{pileConnectorCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -520,6 +552,9 @@
|
||||
<if test="pileSn != null">
|
||||
pile_sn = #{pileSn,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="pileConnectorCode != null">
|
||||
pile_connector_code = #{pileConnectorCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user