mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
Merge branch 'dev' into HuiFu
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 请求启动充电DTO
|
||||
*
|
||||
* @author JS-ZZA
|
||||
* @date 2023/4/24 14:04
|
||||
*/
|
||||
@Data
|
||||
public class QueryStartChargeDTO {
|
||||
/**
|
||||
* 充电订单号
|
||||
*/
|
||||
@JsonProperty(value = "StartChargeSeq")
|
||||
private String StartChargeSeq;
|
||||
|
||||
/**
|
||||
* 充电设备接口编码
|
||||
*/
|
||||
@JsonProperty(value = "ConnectorID")
|
||||
private String ConnectorID;
|
||||
|
||||
/**
|
||||
* 二维码
|
||||
*/
|
||||
@JsonProperty(value = "QRCode")
|
||||
private String QRCode;
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
@JsonProperty(value = "PhoneNum")
|
||||
private String PhoneNum;
|
||||
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
@JsonProperty(value = "PlateNum")
|
||||
private String PlateNum;
|
||||
}
|
||||
@@ -222,4 +222,11 @@ public interface IOrderBasicInfoService {
|
||||
* @return
|
||||
*/
|
||||
List<AccumulativeInfoVO> getAccumulativeInfoForLianLian(QueryStationInfoDTO dto);
|
||||
|
||||
/**
|
||||
* 联联平台生成订单
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> generateOrderForLianLian(QueryStartChargeDTO dto);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,13 @@ 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.*;
|
||||
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.QueryStartChargeDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.dto.RefundableWxPayOrderData;
|
||||
import com.jsowell.pile.mapper.OrderBasicInfoMapper;
|
||||
import com.jsowell.pile.service.IMemberBasicInfoService;
|
||||
import com.jsowell.pile.service.IOrderAbnormalRecordService;
|
||||
@@ -84,6 +90,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -377,11 +384,14 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
public int updateOrderBasicInfo(OrderBasicInfo orderBasicInfo) {
|
||||
// 清缓存
|
||||
this.cleanCacheByOrderCode(orderBasicInfo.getOrderCode(), orderBasicInfo.getTransactionCode());
|
||||
return orderBasicInfoMapper.updateOrderBasicInfo(orderBasicInfo);
|
||||
int i = orderBasicInfoMapper.updateOrderBasicInfo(orderBasicInfo);
|
||||
CompletableFuture.runAsync(() -> this.cleanCacheByOrderCode(orderBasicInfo.getOrderCode(), orderBasicInfo.getTransactionCode()));
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanCacheByOrderCode(String orderCode, String transactionCode) {
|
||||
logger.debug("清除订单缓存 orderCode:{}, transactionCode:{}", orderCode, transactionCode);
|
||||
List<String> keys = Lists.newArrayList();
|
||||
if (StringUtils.isNotBlank(orderCode)) {
|
||||
keys.add(CacheConstants.GET_ORDER_INFO_BY_ORDER_CODE + orderCode);
|
||||
@@ -982,7 +992,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
if (StringUtils.isBlank(transactionCode)) {
|
||||
return resultList;
|
||||
}
|
||||
logger.info("transactionCode:{}", transactionCode);
|
||||
// logger.info("transactionCode:{}", transactionCode);
|
||||
String pileConnectorCode = transactionCode.substring(0, 16);
|
||||
String redisKey = CacheConstants.PILE_REAL_TIME_MONITOR_DATA + pileConnectorCode + "_" + transactionCode;
|
||||
// 拿到所有数据
|
||||
@@ -1348,7 +1358,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
.connectorCode(connectorCode)
|
||||
.pileConnectorCode(pileSn + connectorCode)
|
||||
.logicCard(pileAuthCardInfo.getLogicCard())
|
||||
.startMode(StartModeEnum.CARD.getValue())
|
||||
.startMode(StartModeEnum.AUTH_CARD.getValue())
|
||||
.payStatus(Constants.ONE)
|
||||
.payAmount(totalAccountAmount)
|
||||
.payTime(new Date())
|
||||
@@ -1401,4 +1411,76 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
public List<AccumulativeInfoVO> getAccumulativeInfoForLianLian(QueryStationInfoDTO dto) {
|
||||
return orderBasicInfoMapper.getAccumulativeInfoForLianLian(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 联联平台生成订单
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> generateOrderForLianLian(QueryStartChargeDTO dto) {
|
||||
// 联联平台生成订单
|
||||
String orderCode = dto.getStartChargeSeq();
|
||||
String pileConnectorCode = dto.getConnectorID();
|
||||
String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||
String connectorCode = StringUtils.substring(pileConnectorCode, 14, 16);
|
||||
|
||||
|
||||
String transactionCode = IdUtils.generateTransactionCode(pileSn, connectorCode);
|
||||
|
||||
// 通过桩号查询所属站点
|
||||
PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn);
|
||||
Long stationId = pileBasicInfo.getStationId();
|
||||
|
||||
|
||||
// 将此订单信息存入订单表
|
||||
// 订单基本信息
|
||||
OrderBasicInfo orderBasicInfo = OrderBasicInfo.builder()
|
||||
.orderCode(orderCode)
|
||||
.transactionCode(transactionCode)
|
||||
.orderStatus(OrderStatusEnum.NOT_START.getValue())
|
||||
// .memberId(memberVO.getMemberId()) // 会员memberId
|
||||
.stationId(String.valueOf(stationId))
|
||||
.pileSn(pileSn)
|
||||
.connectorCode(connectorCode)
|
||||
.pileConnectorCode(pileConnectorCode)
|
||||
// .logicCard(pileAuthCardInfo.getLogicCard()) // 卡号
|
||||
.startMode(StartModeEnum.LIAN_LIAN.getValue())
|
||||
.payStatus(Constants.ONE)
|
||||
// .payAmount(totalAccountAmount) // 支付金额
|
||||
.payTime(new Date())
|
||||
// .payMode(PayModeEnum.PAYMENT_OF_BALANCE.getValue()) // 支付方式
|
||||
.orderAmount(BigDecimal.ZERO)
|
||||
.build();
|
||||
// 根据桩编码查询当前计费模板
|
||||
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
|
||||
// 订单详情
|
||||
OrderDetail orderDetail = OrderDetail.builder()
|
||||
.orderCode(orderCode)
|
||||
.sharpElectricityPrice(billingTemplateVO.getSharpElectricityPrice())
|
||||
.sharpServicePrice(billingTemplateVO.getSharpServicePrice())
|
||||
.peakElectricityPrice(billingTemplateVO.getPeakElectricityPrice())
|
||||
.peakServicePrice(billingTemplateVO.getPeakServicePrice())
|
||||
.flatElectricityPrice(billingTemplateVO.getFlatElectricityPrice())
|
||||
.flatServicePrice(billingTemplateVO.getFlatServicePrice())
|
||||
.valleyElectricityPrice(billingTemplateVO.getValleyElectricityPrice())
|
||||
.valleyServicePrice(billingTemplateVO.getValleyServicePrice())
|
||||
.build();
|
||||
|
||||
OrderTransactionDTO createOrderTransactionDTO = OrderTransactionDTO.builder()
|
||||
.orderBasicInfo(orderBasicInfo)
|
||||
.orderDetail(orderDetail)
|
||||
.build();
|
||||
pileTransactionService.doCreateOrder(createOrderTransactionDTO);
|
||||
|
||||
// 组装结果集
|
||||
Map<String, Object> resultMap = Maps.newHashMap();
|
||||
resultMap.put("orderCode", orderBasicInfo.getOrderCode());
|
||||
resultMap.put("transactionCode", orderBasicInfo.getTransactionCode());
|
||||
resultMap.put("orderBasicInfo", orderBasicInfo);
|
||||
resultMap.put("orderDetail", orderDetail);
|
||||
// resultMap.put("accountBalance", totalAccountAmount);
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,10 @@ import com.jsowell.common.core.domain.entity.SysDept;
|
||||
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.util.*;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.DistanceUtils;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.ip.AddressUtils;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.dto.FastCreateStationDTO;
|
||||
@@ -29,6 +32,8 @@ import com.jsowell.system.service.SysDeptService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
@@ -129,6 +134,10 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
|
||||
// vo.setOrganizationCode(pileStationInfo.getor);
|
||||
vo.setPublicFlag(pileStationInfo.getPublicFlag());
|
||||
vo.setOpenFlag(pileStationInfo.getOpenFlag());
|
||||
if (StringUtils.isNotBlank(pileStationInfo.getPictures())) {
|
||||
vo.setPictures(pileStationInfo.getPictures());
|
||||
vo.setPictureList(Lists.newArrayList(pileStationInfo.getPictures().split(",")));
|
||||
}
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
@@ -193,6 +202,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
|
||||
public int fastCreateStation(FastCreateStationDTO dto) {
|
||||
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(dto.getMerchantId());
|
||||
if (merchantInfo == null) {
|
||||
@@ -229,8 +239,6 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
|
||||
}
|
||||
pileStationInfo.setCreateBy(SecurityUtils.getUsername());
|
||||
int i = pileStationInfoMapper.insertPileStationInfo(pileStationInfo);
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,18 @@ public class OrderDetailInfoVO {
|
||||
|
||||
private RealTimeMonitorData lastMonitorData;
|
||||
|
||||
// billingDetails
|
||||
// 收费明细
|
||||
private List<ChargeDetail> chargeDetails;
|
||||
|
||||
@Data
|
||||
public static class ChargeDetail{
|
||||
private String periodType; // 时段类型
|
||||
private BigDecimal usedElectricity; // 用电量
|
||||
private BigDecimal electricityPrice; // 电费单价
|
||||
private BigDecimal servicePrice; // 服务费单价
|
||||
private BigDecimal electricityAmount; // 电费金额
|
||||
private BigDecimal serviceAmount; // 服务费金额
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class BillingDetails{
|
||||
|
||||
@@ -142,6 +142,8 @@ public class PileStationVO {
|
||||
*/
|
||||
private String pictures;
|
||||
|
||||
private List<String> pictureList;
|
||||
|
||||
/**
|
||||
* 电费
|
||||
*/
|
||||
|
||||
@@ -158,7 +158,6 @@
|
||||
and merchant_id = #{merchantId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
order by create_time DESC, update_time DESC
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectInfoByMemberId" resultMap="MemberBasicInfoResult">
|
||||
@@ -190,7 +189,7 @@
|
||||
t2.gift_balance as giftBalance
|
||||
FROM
|
||||
member_basic_info t1
|
||||
JOIN member_wallet_info t2 ON t1.member_id = t2.member_id
|
||||
left JOIN member_wallet_info t2 ON t1.member_id = t2.member_id
|
||||
where t1.del_flag = '0'
|
||||
and t1.member_id = #{memberId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
@@ -208,7 +207,7 @@
|
||||
JOIN member_wallet_info t2 ON t1.member_id = t2.member_id
|
||||
where t1.del_flag = '0'
|
||||
<if test="mobileNumber != null and mobileNumber != ''">and mobile_number like '%${mobileNumber}%'</if>
|
||||
<if test="nickName != null and mobileNumber != ''">and nick_name like '%${nickName}%'</if>
|
||||
<if test="nickName != null and nickName != ''">and nick_name like '%${nickName}%'</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user