mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-28 23:15:11 +08:00
Merge branch 'dev' into HuiFu
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
package com.jsowell.pile.domain;
|
||||
|
||||
import com.jsowell.common.annotation.Excel;
|
||||
import com.jsowell.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 站点白名单对象 pile_station_whitelist
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2023-04-19
|
||||
*/
|
||||
public class PileStationWhitelist extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 站点id
|
||||
*/
|
||||
@Excel(name = "站点id")
|
||||
private String stationId;
|
||||
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
@Excel(name = "会员id")
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Excel(name = "手机号")
|
||||
private String mobileNumber;
|
||||
|
||||
/**
|
||||
* 删除标识(0-正常;1-删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setStationId(String stationId) {
|
||||
this.stationId = stationId;
|
||||
}
|
||||
|
||||
public String getStationId() {
|
||||
return stationId;
|
||||
}
|
||||
|
||||
public void setMemberId(String memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public String getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public String getMobileNumber() {
|
||||
return mobileNumber;
|
||||
}
|
||||
|
||||
public void setMobileNumber(String mobileNumber) {
|
||||
this.mobileNumber = mobileNumber;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
|
||||
.append("id", getId())
|
||||
.append("stationId", getStationId())
|
||||
.append("memberId", getMemberId())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("delFlag", getDelFlag())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 联联平台请求设备认证
|
||||
*
|
||||
* @author JS-ZZA
|
||||
* @date 2023/4/19 10:08
|
||||
*/
|
||||
@Data
|
||||
public class QueryEquipmentDTO {
|
||||
/**
|
||||
* 设备认证流水号
|
||||
* 格式“运营商 ID+yyyyMMddHHmmss+4 位随机数”,
|
||||
* 27 字符
|
||||
*/
|
||||
@JsonProperty(value = "EquipAuthSeq")
|
||||
private String EquipAuthSeq;
|
||||
|
||||
/**
|
||||
* 充电设备接口编码
|
||||
*/
|
||||
@JsonProperty(value = "ConnectorID")
|
||||
private String ConnectorID;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 查询站点信息dto
|
||||
*
|
||||
* @author JS-ZZA
|
||||
* @date 2023/4/8 10:02
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class QueryStationInfoDTO {
|
||||
/**
|
||||
* 上次查询时间
|
||||
* 格式“yyyy-MM-dd HH:mm:ss”,可以为空,如果
|
||||
* 不填写,则查询所有的充电站信息
|
||||
*/
|
||||
@JsonProperty(value = "LastQueryTime")
|
||||
private String LastQueryTime;
|
||||
|
||||
/**
|
||||
* 查询页码
|
||||
* 不填写默认为 1
|
||||
*/
|
||||
@JsonProperty(value = "PageNo")
|
||||
private Integer PageNo;
|
||||
|
||||
/**
|
||||
* 每页数量
|
||||
* 不填写默认为 10
|
||||
*/
|
||||
@JsonProperty(value = "PageSize")
|
||||
private Integer PageSize;
|
||||
|
||||
|
||||
/**
|
||||
* 充电站 ID
|
||||
*/
|
||||
@JsonProperty(value = "StationID")
|
||||
private String StationID;
|
||||
|
||||
/**
|
||||
* 统计开始时间
|
||||
* 格式“yyyy-MM-dd”
|
||||
*/
|
||||
@JsonProperty(value = "StartTime")
|
||||
private String StartTime;
|
||||
|
||||
/**
|
||||
* 统计结束时间
|
||||
* 格式“yyyy-MM-dd”
|
||||
*/
|
||||
@JsonProperty(value = "EndTime")
|
||||
private String EndTime;
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import com.jsowell.pile.domain.OrderDetail;
|
||||
import com.jsowell.pile.dto.IndexQueryDTO;
|
||||
import com.jsowell.pile.dto.QueryOrderDTO;
|
||||
import com.jsowell.pile.dto.QueryPersonPileDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.OrderVO;
|
||||
import com.jsowell.pile.vo.uniapp.PersonPileConnectorSumInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.SendMessageVO;
|
||||
@@ -192,4 +194,15 @@ public interface OrderBasicInfoMapper {
|
||||
List<OrderBasicInfo> getAppointmentOrder(LocalDateTime dateTime);
|
||||
|
||||
List<OrderVO> getListByOrderCodes(@Param("orderCodes") List<String> orderCodes);
|
||||
|
||||
/**
|
||||
* 联联平台 获取累计数据用
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<AccumulativeInfoVO> getAccumulativeInfoForLianLian(QueryStationInfoDTO dto);
|
||||
|
||||
List<OrderDetail> queryElecAmountNullList();
|
||||
|
||||
int batchUpdateOrderDetail(@Param("list") List<OrderDetail> orderDetailList);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.jsowell.pile.mapper;
|
||||
|
||||
import com.jsowell.pile.domain.PileStationWhitelist;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站点白名单Mapper接口
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2023-04-19
|
||||
*/
|
||||
@Repository
|
||||
public interface PileStationWhitelistMapper {
|
||||
/**
|
||||
* 查询站点白名单
|
||||
*
|
||||
* @param id 站点白名单主键
|
||||
* @return 站点白名单
|
||||
*/
|
||||
public PileStationWhitelist selectPileStationWhitelistById(Long id);
|
||||
|
||||
/**
|
||||
* 查询站点白名单列表
|
||||
*
|
||||
* @param pileStationWhitelist 站点白名单
|
||||
* @return 站点白名单集合
|
||||
*/
|
||||
public List<PileStationWhitelist> selectPileStationWhitelistList(PileStationWhitelist pileStationWhitelist);
|
||||
|
||||
/**
|
||||
* 新增站点白名单
|
||||
*
|
||||
* @param pileStationWhitelist 站点白名单
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPileStationWhitelist(PileStationWhitelist pileStationWhitelist);
|
||||
|
||||
/**
|
||||
* 修改站点白名单
|
||||
*
|
||||
* @param pileStationWhitelist 站点白名单
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePileStationWhitelist(PileStationWhitelist pileStationWhitelist);
|
||||
|
||||
/**
|
||||
* 删除站点白名单
|
||||
*
|
||||
* @param id 站点白名单主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePileStationWhitelistById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除站点白名单
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePileStationWhitelistByIds(Long[] ids);
|
||||
|
||||
PileStationWhitelist queryWhitelistByMemberId(@Param("stationId") String stationId, @Param("memberId") String memberId);
|
||||
}
|
||||
@@ -4,10 +4,8 @@ import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.domain.OrderDetail;
|
||||
import com.jsowell.pile.dto.GenerateOrderDTO;
|
||||
import com.jsowell.pile.dto.IndexQueryDTO;
|
||||
import com.jsowell.pile.dto.QueryOrderDTO;
|
||||
import com.jsowell.pile.dto.QueryPersonPileDTO;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.OrderVO;
|
||||
import com.jsowell.pile.vo.uniapp.PersonPileConnectorSumInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.SendMessageVO;
|
||||
@@ -27,13 +25,6 @@ import java.util.Map;
|
||||
* @date 2022-09-30
|
||||
*/
|
||||
public interface IOrderBasicInfoService {
|
||||
/**
|
||||
* 查询订单
|
||||
*
|
||||
* @param id 订单主键
|
||||
* @return 订单
|
||||
*/
|
||||
OrderBasicInfo selectOrderBasicInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 条件查询订单基础信息
|
||||
@@ -128,6 +119,8 @@ public interface IOrderBasicInfoService {
|
||||
|
||||
List<OrderVO> getListByMemberIdAndOrderStatus(String memberId, List<String> orderStatusList, LocalDateTime dateTime);
|
||||
|
||||
void updateElecAmount();
|
||||
|
||||
/**
|
||||
* 结算订单退款和用户余额退款调这个方法
|
||||
*/
|
||||
@@ -222,4 +215,11 @@ public interface IOrderBasicInfoService {
|
||||
List<OrderBasicInfo> getAppointmentOrder(LocalDateTime dateTime);
|
||||
|
||||
Map<String, Object> generateOrderByCard(GenerateOrderDTO dto);
|
||||
|
||||
/**
|
||||
* 联联平台 获取累计数据用
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<AccumulativeInfoVO> getAccumulativeInfoForLianLian(QueryStationInfoDTO dto);
|
||||
}
|
||||
|
||||
@@ -132,4 +132,6 @@ public interface IPileConnectorInfoService {
|
||||
List<ConnectorInfoVO> getConnectorListForLianLian(Long stationId);
|
||||
|
||||
List<ConnectorInfoVO> selectConnectorInfoList(String pileSn);
|
||||
|
||||
PageResponse selectStationConnectorList(QueryConnectorListDTO dto);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.pile.domain.PileStationWhitelist;
|
||||
|
||||
/**
|
||||
* 站点白名单Service接口
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2023-04-19
|
||||
*/
|
||||
public interface IPileStationWhitelistService {
|
||||
/**
|
||||
* 查询站点白名单
|
||||
*
|
||||
* @param id 站点白名单主键
|
||||
* @return 站点白名单
|
||||
*/
|
||||
public PileStationWhitelist selectPileStationWhitelistById(Long id);
|
||||
|
||||
/**
|
||||
* 查询站点白名单列表
|
||||
*
|
||||
* @param pileStationWhitelist 站点白名单
|
||||
* @return 站点白名单集合
|
||||
*/
|
||||
public List<PileStationWhitelist> selectPileStationWhitelistList(PileStationWhitelist pileStationWhitelist);
|
||||
|
||||
/**
|
||||
* 新增站点白名单
|
||||
*
|
||||
* @param pileStationWhitelist 站点白名单
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPileStationWhitelist(PileStationWhitelist pileStationWhitelist);
|
||||
|
||||
/**
|
||||
* 修改站点白名单
|
||||
*
|
||||
* @param pileStationWhitelist 站点白名单
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePileStationWhitelist(PileStationWhitelist pileStationWhitelist);
|
||||
|
||||
/**
|
||||
* 批量删除站点白名单
|
||||
*
|
||||
* @param ids 需要删除的站点白名单主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePileStationWhitelistByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除站点白名单信息
|
||||
*
|
||||
* @param id 站点白名单主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePileStationWhitelistById(Long id);
|
||||
|
||||
PileStationWhitelist queryWhitelistByMemberId(String stationId, String memberId);
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.jsowell.pile.service.impl;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
@@ -35,11 +37,7 @@ import com.jsowell.pile.domain.PileAuthCard;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.WxpayCallbackRecord;
|
||||
import com.jsowell.pile.domain.WxpayRefundCallback;
|
||||
import com.jsowell.pile.dto.GenerateOrderDTO;
|
||||
import com.jsowell.pile.dto.IndexQueryDTO;
|
||||
import com.jsowell.pile.dto.QueryOrderDTO;
|
||||
import com.jsowell.pile.dto.QueryPersonPileDTO;
|
||||
import com.jsowell.pile.dto.RefundableWxPayOrderData;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.mapper.OrderBasicInfoMapper;
|
||||
import com.jsowell.pile.service.IMemberBasicInfoService;
|
||||
import com.jsowell.pile.service.IOrderAbnormalRecordService;
|
||||
@@ -55,6 +53,7 @@ import com.jsowell.pile.service.WxpayRefundCallbackService;
|
||||
import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
|
||||
import com.jsowell.pile.transaction.service.TransactionService;
|
||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.MemberVO;
|
||||
import com.jsowell.pile.vo.uniapp.OrderVO;
|
||||
import com.jsowell.pile.vo.uniapp.PersonPileConnectorSumInfoVO;
|
||||
@@ -145,17 +144,6 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
@Autowired
|
||||
private IPileAuthCardService pileAuthCardService;
|
||||
|
||||
/**
|
||||
* 查询订单
|
||||
*
|
||||
* @param id 订单主键
|
||||
* @return 订单
|
||||
*/
|
||||
@Override
|
||||
public OrderBasicInfo selectOrderBasicInfoById(Long id) {
|
||||
return orderBasicInfoMapper.selectOrderBasicInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件查询订单基本信息
|
||||
*
|
||||
@@ -608,9 +596,8 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
|
||||
// 更新订单详情
|
||||
try {
|
||||
// 总电费金额,总服务费金额
|
||||
// 总电费金额
|
||||
BigDecimal totalElectricityAmount = BigDecimal.ZERO;
|
||||
BigDecimal totalServiceAmount = BigDecimal.ZERO;
|
||||
|
||||
// 尖时段用电量
|
||||
String sharpUsedElectricity = data.getSharpUsedElectricity();
|
||||
@@ -697,6 +684,83 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateElecAmount() {
|
||||
// 查询 elecAmount为空的订单数据
|
||||
int pageNum = 1;
|
||||
int pageSize = 500;
|
||||
|
||||
int total = 0;
|
||||
int batch = 1;
|
||||
while (true) {
|
||||
// 分页处理
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<OrderDetail> list = orderBasicInfoMapper.queryElecAmountNullList();
|
||||
PageInfo<OrderDetail> pageInfo = new PageInfo<>(list);
|
||||
if (CollectionUtils.isEmpty(pageInfo.getList())) {
|
||||
break;
|
||||
}
|
||||
|
||||
// 计算电量总金额
|
||||
List<OrderDetail> orderDetailList = calculateData(pageInfo.getList());
|
||||
|
||||
// 更新数据库
|
||||
int i = orderBasicInfoMapper.batchUpdateOrderDetail(orderDetailList);
|
||||
total += i;
|
||||
logger.info("updateElecAmount==第{}批次更新完成", batch);
|
||||
batch += 1;
|
||||
}
|
||||
logger.info("updateElecAmount==共更新{}条数据", total);
|
||||
}
|
||||
|
||||
// 计算数据
|
||||
private List<OrderDetail> calculateData(List<OrderDetail> list) {
|
||||
for (OrderDetail orderDetail : list) {
|
||||
try {
|
||||
// 总电费金额
|
||||
BigDecimal totalElectricityAmount = BigDecimal.ZERO;
|
||||
|
||||
// 尖时段用电量
|
||||
BigDecimal sharpUsedElectricity = orderDetail.getSharpUsedElectricity();
|
||||
if (sharpUsedElectricity != null) {
|
||||
// 计算该时段电费
|
||||
BigDecimal multiply = orderDetail.getSharpElectricityPrice().multiply(sharpUsedElectricity).setScale(2,BigDecimal.ROUND_DOWN);
|
||||
totalElectricityAmount = totalElectricityAmount.add(multiply);
|
||||
}
|
||||
|
||||
// 峰时段用电量
|
||||
BigDecimal peakUsedElectricity = orderDetail.getPeakUsedElectricity();
|
||||
if (peakUsedElectricity != null) {
|
||||
// 计算该时段电费
|
||||
BigDecimal multiply = orderDetail.getPeakElectricityPrice().multiply(peakUsedElectricity).setScale(2,BigDecimal.ROUND_DOWN);
|
||||
totalElectricityAmount = totalElectricityAmount.add(multiply);
|
||||
}
|
||||
|
||||
// 平时段用电量
|
||||
BigDecimal flatUsedElectricity = orderDetail.getFlatUsedElectricity();
|
||||
if (flatUsedElectricity != null) {
|
||||
// 计算该时段电费
|
||||
BigDecimal multiply = orderDetail.getFlatElectricityPrice().multiply(flatUsedElectricity).setScale(2,BigDecimal.ROUND_DOWN);
|
||||
totalElectricityAmount = totalElectricityAmount.add(multiply);
|
||||
}
|
||||
|
||||
// 谷时段用电量
|
||||
BigDecimal valleyUsedElectricity = orderDetail.getValleyUsedElectricity();
|
||||
if (valleyUsedElectricity != null) {
|
||||
// 计算该时段电费
|
||||
BigDecimal multiply = orderDetail.getValleyElectricityPrice().multiply(valleyUsedElectricity).setScale(2,BigDecimal.ROUND_DOWN);
|
||||
totalElectricityAmount = totalElectricityAmount.add(multiply);
|
||||
}
|
||||
|
||||
orderDetail.setTotalElectricityAmount(totalElectricityAmount);
|
||||
orderDetail.setTotalServiceAmount(orderDetail.getTotalOrderAmount().subtract(totalElectricityAmount));
|
||||
}catch (Exception e) {
|
||||
logger.info("发生异常", e);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 余额支付 计算需要退回的金额
|
||||
*
|
||||
@@ -1327,4 +1391,14 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
resultMap.put("accountBalance", totalAccountAmount);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 联联平台 获取累计数据用
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<AccumulativeInfoVO> getAccumulativeInfoForLianLian(QueryStationInfoDTO dto) {
|
||||
return orderBasicInfoMapper.getAccumulativeInfoForLianLian(dto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,6 +361,16 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
|
||||
|
||||
PageInfo<PileConnectorInfoVO> pageInfo = new PageInfo<>(pileConnectorInfoList);
|
||||
|
||||
// 查询枪口当前订单
|
||||
for (PileConnectorInfoVO pileConnectorInfoVO : pageInfo.getList()) {
|
||||
String pileConnectorCode = pileConnectorInfoVO.getPileConnectorCode();
|
||||
pileConnectorInfoVO.setConnectorQrCodeUrl(getPileConnectorQrCodeUrl(pileConnectorCode)); // 枪口号二维码
|
||||
OrderBasicInfo order = orderBasicInfoService.queryChargingByPileConnectorCode(pileConnectorCode);
|
||||
if (order != null) {
|
||||
pileConnectorInfoVO.setOrderCode(order.getOrderCode());
|
||||
}
|
||||
}
|
||||
|
||||
queryRealTimeData(pageInfo.getList());
|
||||
|
||||
// 返回结果集
|
||||
@@ -423,6 +433,12 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
|
||||
return connectorInfoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResponse selectStationConnectorList(QueryConnectorListDTO dto) {
|
||||
PageResponse response = getUniAppConnectorInfoListByParams(dto);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电枪口的实时数据
|
||||
*/
|
||||
@@ -447,8 +463,8 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
|
||||
pileConnectorInfoVO.setChargingAmount(new BigDecimal(realTimeMonitorData.getChargingAmount()));
|
||||
pileConnectorInfoVO.setChargingDegree(new BigDecimal(realTimeMonitorData.getChargingDegree()));
|
||||
pileConnectorInfoVO.setGunLineTemperature(realTimeMonitorData.getGunLineTemperature()); // 枪线温度
|
||||
pileConnectorInfoVO.setTimeRemaining(realTimeMonitorData.getTimeRemaining());
|
||||
pileConnectorInfoVO.setChargingTime(realTimeMonitorData.getSumChargingTime());
|
||||
pileConnectorInfoVO.setTimeRemaining(realTimeMonitorData.getTimeRemaining()); // 剩余时间
|
||||
pileConnectorInfoVO.setChargingTime(realTimeMonitorData.getSumChargingTime()); // 已充时长
|
||||
// 计算实时功率(单位:kw)
|
||||
BigDecimal instantPowerTemp = outputVoltage.multiply(outputCurrent);
|
||||
BigDecimal instantPower = instantPowerTemp.divide(new BigDecimal(1000));
|
||||
|
||||
@@ -361,6 +361,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
|
||||
stationVO.setFastFree(fastFree);
|
||||
stationVO.setSlowTotal(slowTotal);
|
||||
stationVO.setSlowFree(slowFree);
|
||||
stationVO.setTotalFree(fastFree + slowFree);
|
||||
|
||||
// 查询当前时段电费
|
||||
CurrentTimePriceDetails currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetails(stationVO.getStationId());
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.MemberBasicInfo;
|
||||
import com.jsowell.pile.domain.PileStationWhitelist;
|
||||
import com.jsowell.pile.mapper.PileStationWhitelistMapper;
|
||||
import com.jsowell.pile.service.IMemberBasicInfoService;
|
||||
import com.jsowell.pile.service.IPileStationWhitelistService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 站点白名单Service业务层处理
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2023-04-19
|
||||
*/
|
||||
@Service
|
||||
public class PileStationWhitelistServiceImpl implements IPileStationWhitelistService {
|
||||
@Autowired
|
||||
private PileStationWhitelistMapper pileStationWhitelistMapper;
|
||||
|
||||
@Autowired
|
||||
private IMemberBasicInfoService memberBasicInfoService;
|
||||
|
||||
/**
|
||||
* 查询站点白名单
|
||||
*
|
||||
* @param id 站点白名单主键
|
||||
* @return 站点白名单
|
||||
*/
|
||||
@Override
|
||||
public PileStationWhitelist selectPileStationWhitelistById(Long id) {
|
||||
return pileStationWhitelistMapper.selectPileStationWhitelistById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询站点白名单列表
|
||||
*
|
||||
* @param pileStationWhitelist 站点白名单
|
||||
* @return 站点白名单
|
||||
*/
|
||||
@Override
|
||||
public List<PileStationWhitelist> selectPileStationWhitelistList(PileStationWhitelist pileStationWhitelist) {
|
||||
return pileStationWhitelistMapper.selectPileStationWhitelistList(pileStationWhitelist);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增站点白名单
|
||||
*
|
||||
* @param pileStationWhitelist 站点白名单
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertPileStationWhitelist(PileStationWhitelist pileStationWhitelist) {
|
||||
// pileStationWhitelist.setCreateTime(DateUtils.getNowDate());
|
||||
if (StringUtils.isBlank(pileStationWhitelist.getMobileNumber())) {
|
||||
return 0;
|
||||
}
|
||||
MemberBasicInfo info = memberBasicInfoService.selectInfoByMobileNumber(pileStationWhitelist.getMobileNumber());
|
||||
if (info == null) {
|
||||
return 0;
|
||||
}
|
||||
pileStationWhitelist.setMemberId(info.getMemberId());
|
||||
return pileStationWhitelistMapper.insertPileStationWhitelist(pileStationWhitelist);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改站点白名单
|
||||
*
|
||||
* @param pileStationWhitelist 站点白名单
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updatePileStationWhitelist(PileStationWhitelist pileStationWhitelist) {
|
||||
pileStationWhitelist.setUpdateTime(DateUtils.getNowDate());
|
||||
return pileStationWhitelistMapper.updatePileStationWhitelist(pileStationWhitelist);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除站点白名单
|
||||
*
|
||||
* @param ids 需要删除的站点白名单主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePileStationWhitelistByIds(Long[] ids) {
|
||||
return pileStationWhitelistMapper.deletePileStationWhitelistByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除站点白名单信息
|
||||
*
|
||||
* @param id 站点白名单主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePileStationWhitelistById(Long id) {
|
||||
return pileStationWhitelistMapper.deletePileStationWhitelistById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PileStationWhitelist queryWhitelistByMemberId(String stationId, String memberId) {
|
||||
if (StringUtils.isBlank(stationId) || StringUtils.isBlank(memberId)) {
|
||||
return null;
|
||||
}
|
||||
return pileStationWhitelistMapper.queryWhitelistByMemberId(stationId, memberId);
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,7 @@ public class TransactionService {
|
||||
@Autowired
|
||||
private MemberWalletInfoMapper memberWalletInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private IOrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
@@ -160,7 +161,11 @@ public class TransactionService {
|
||||
orderBasicInfoMapper.updateOrderDetail(dto.getOrderDetail());
|
||||
}
|
||||
// 清缓存
|
||||
orderBasicInfoService.cleanCacheByOrderCode(orderCode, transactionCode);
|
||||
try {
|
||||
orderBasicInfoService.cleanCacheByOrderCode(orderCode, transactionCode);
|
||||
} catch (Exception e) {
|
||||
log.error("清缓存异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,6 +75,11 @@ public class StationInfoVO {
|
||||
*/
|
||||
private int slowFree;
|
||||
|
||||
/**
|
||||
* 总空闲枪口数
|
||||
*/
|
||||
private int totalFree;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.jsowell.pile.vo.lianlian;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 对接联联平台 获取累计数据
|
||||
*
|
||||
* @author JS-ZZA
|
||||
* @date 2023/4/17 14:06
|
||||
*/
|
||||
@Data
|
||||
public class AccumulativeInfoVO {
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderCode;
|
||||
|
||||
/**
|
||||
* 枪口编号
|
||||
*/
|
||||
private String pileConnectorCode;
|
||||
|
||||
/**
|
||||
* 桩编码
|
||||
*/
|
||||
private String pileSn;
|
||||
|
||||
/**
|
||||
* 站点id
|
||||
*/
|
||||
private String stationId;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private String startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private String endTime;
|
||||
|
||||
/**
|
||||
* 枪口充电量
|
||||
*/
|
||||
private String connectorElectricity;
|
||||
}
|
||||
@@ -58,6 +58,11 @@ public class UniAppOrderVO {
|
||||
*/
|
||||
private String payAmount;
|
||||
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
private String payMode;
|
||||
|
||||
/**
|
||||
* 订单金额
|
||||
*/
|
||||
|
||||
@@ -102,6 +102,11 @@ public class PileConnectorInfoVO {
|
||||
*/
|
||||
private String chargingTime;
|
||||
|
||||
/**
|
||||
* 剩余时间
|
||||
*/
|
||||
private String timeRemaining;
|
||||
|
||||
/**
|
||||
* 电压
|
||||
*/
|
||||
@@ -152,8 +157,4 @@ public class PileConnectorInfoVO {
|
||||
*/
|
||||
private String ratedPower;
|
||||
|
||||
/**
|
||||
* 剩余时间
|
||||
*/
|
||||
private String timeRemaining;
|
||||
}
|
||||
|
||||
@@ -922,4 +922,56 @@
|
||||
#{orderCode,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getAccumulativeInfoForLianLian" resultType="com.jsowell.pile.vo.lianlian.AccumulativeInfoVO">
|
||||
SELECT
|
||||
t1.order_code as orderCode,
|
||||
t1.pile_connector_code as pileConnectorCode,
|
||||
t1.pile_sn as pileSn,
|
||||
t1.station_id as stationId,
|
||||
IFNULL(t2.total_used_electricity,0.00) as connectorElectricity
|
||||
FROM
|
||||
order_basic_info t1
|
||||
JOIN order_detail t2 ON t1.order_code = t2.order_code
|
||||
WHERE
|
||||
t1.del_flag = '0'
|
||||
AND t1.station_id = #{stationID,jdbcType=VARCHAR}
|
||||
AND t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
|
||||
AND t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryElecAmountNullList" resultMap="OrderDetailResult">
|
||||
select
|
||||
<include refid="Detail_Base_Column_List"/>
|
||||
from order_detail
|
||||
where del_flag = '0'
|
||||
and total_order_amount is not null
|
||||
AND total_order_amount > '0.00'
|
||||
and total_electricity_amount is null
|
||||
</select>
|
||||
|
||||
<update id="batchUpdateOrderDetail">
|
||||
update order_detail
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<trim prefix="total_electricity_amount =case" suffix="end,">
|
||||
<foreach collection="list" item="item" index="index">
|
||||
<if test="item.totalElectricityAmount!=null">
|
||||
when id=#{item.id} then #{item.totalElectricityAmount}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="total_service_amount =case" suffix="end,">
|
||||
<foreach collection="list" item="item" index="index">
|
||||
<if test="item.totalServiceAmount!=null">
|
||||
when id=#{item.id} then #{item.totalServiceAmount}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
</trim>
|
||||
where
|
||||
<foreach collection="list" separator="or" item="i" index="index" >
|
||||
id=#{i.id}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jsowell.pile.mapper.PileStationWhitelistMapper">
|
||||
|
||||
<resultMap type="com.jsowell.pile.domain.PileStationWhitelist" id="PileStationWhitelistResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="stationId" column="station_id" />
|
||||
<result property="memberId" column="member_id" />
|
||||
<result property="mobileNumber" column="mobile_number" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, station_id, member_id, mobile_number, create_time, create_by, update_time, update_by, del_flag
|
||||
</sql>
|
||||
|
||||
<sql id="selectPileStationWhitelistVo">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from pile_station_whitelist
|
||||
</sql>
|
||||
|
||||
<select id="selectPileStationWhitelistList" parameterType="com.jsowell.pile.domain.PileStationWhitelist" resultMap="PileStationWhitelistResult">
|
||||
<include refid="selectPileStationWhitelistVo"/>
|
||||
<where>
|
||||
<if test="stationId != null and stationId != ''"> and station_id = #{stationId}</if>
|
||||
<if test="memberId != null and memberId != ''"> and member_id = #{memberId}</if>
|
||||
<if test="mobileNumber != null and mobileNumber != ''"> and mobile_number = #{mobileNumber}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPileStationWhitelistById" parameterType="Long" resultMap="PileStationWhitelistResult">
|
||||
<include refid="selectPileStationWhitelistVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertPileStationWhitelist" parameterType="com.jsowell.pile.domain.PileStationWhitelist">
|
||||
insert into pile_station_whitelist
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="stationId != null">station_id,</if>
|
||||
<if test="memberId != null">member_id,</if>
|
||||
<if test="mobileNumber != null">mobile_number,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="stationId != null">#{stationId},</if>
|
||||
<if test="memberId != null">#{memberId},</if>
|
||||
<if test="mobileNumber != null">#{mobileNumber},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updatePileStationWhitelist" parameterType="com.jsowell.pile.domain.PileStationWhitelist">
|
||||
update pile_station_whitelist
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="stationId != null">station_id = #{stationId},</if>
|
||||
<if test="memberId != null">member_id = #{memberId},</if>
|
||||
<if test="mobileNumber != null">mobile_number = #{mobileNumber},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deletePileStationWhitelistById" parameterType="Long">
|
||||
delete from pile_station_whitelist where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePileStationWhitelistByIds" parameterType="String">
|
||||
delete from pile_station_whitelist where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="queryWhitelistByMemberId" resultMap="PileStationWhitelistResult">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from pile_station_whitelist
|
||||
where del_flag = '0'
|
||||
and member_id = #{memberId,jdbcType=VARCHAR}
|
||||
and station_id = #{stationId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user