@@ -19,10 +19,8 @@ import com.jsowell.common.util.id.IdUtils;
import com.jsowell.pile.domain.* ;
import com.jsowell.pile.domain.* ;
import com.jsowell.pile.dto.* ;
import com.jsowell.pile.dto.* ;
import com.jsowell.pile.service.* ;
import com.jsowell.pile.service.* ;
import com.jsowell.pile.transaction.dto.OrderTransactionDTO ;
import com.jsowell.pile.transaction.service.TransactionService ;
import com.jsowell.pile.transaction.service.TransactionService ;
import com.jsowell.pile.vo.uniapp.MemberVO ;
import com.jsowell.pile.vo.uniapp.MemberVO ;
import com.jsowell.pile.vo.uniapp.PileConnectorDetailVO ;
import com.jsowell.pile.vo.web.* ;
import com.jsowell.pile.vo.web.* ;
import com.jsowell.wxpay.dto.WechatSendMsgDTO ;
import com.jsowell.wxpay.dto.WechatSendMsgDTO ;
import com.jsowell.wxpay.service.WxAppletRemoteService ;
import com.jsowell.wxpay.service.WxAppletRemoteService ;
@@ -297,30 +295,30 @@ public abstract class AbstractProgramLogic implements InitializingBean {
*
*
* @param dto
* @param dto
*/
*/
protected void analysisPileParameter( BasicPileDTO dto ) {
// protected void analysisPileParameter( BasicPileDTO dto) {
if ( StringUtils. isBlank( dto . getPileSn ( ) ) | | StringUtils. isBlank( dto . getConnectorCode( ) ) ) {
// if ( StringUtils. isBlank(dto.getPileSn()) || StringUtils. isBlank(dto. getConnectorCode())) {
// 从pileConnectorCode解析
// // 从pileConnectorCode解析
String pileConnectorCode = dto . getPileConnectorCode( ) ;
// String pileConnectorCode = dto. getPileConnectorCode() ;
if ( StringUtils. isNotEmpty( pileConnectorCode) & & pileConnectorCode. length( ) = = Constants. PILE_CONNECTOR_CODE_LENGTH) {
// if ( StringUtils. isNotEmpty( pileConnectorCode) && pileConnectorCode. length() == Constants. PILE_CONNECTOR_CODE_LENGTH) {
dto. setPileSn( StringUtils. substring( pileConnectorCode, 0 , pileConnectorCode. length( ) - 2 ) ) ;
// dto. setPileSn( StringUtils. substring( pileConnectorCode, 0, pileConnectorCode. length() - 2)) ;
dto. setConnectorCode( StringUtils. substring( pileConnectorCode, pileConnectorCode. length( ) - 2 , pileConnectorCode. length( ) ) ) ;
// dto. setConnectorCode( StringUtils. substring( pileConnectorCode, pileConnectorCode. length() - 2, pileConnectorCode. length())) ;
} else {
// } else {
throw new BusinessException( ReturnCodeEnum. CODE_DATA_LENGTH_ERROR) ;
// throw new BusinessException( ReturnCodeEnum. CODE_DATA_LENGTH_ERROR) ;
}
// }
} else {
// } else {
// 说明pileSn 和 connectorCode前端传了, 那就校验一下长度
// // 说明pileSn 和 connectorCode前端传了, 那就校验一下长度
if ( dto . getPileSn ( ) . length ( ) ! = Constants. PILE_SN_LENGTH | | dto . getConnectorCode ( ) . length ( ) ! = Constants. CONNECTOR_CODE_LENGTH) {
// if (dto.getPileSn().length() != Constants. PILE_SN_LENGTH || dto.getConnectorCode().length() != Constants. CONNECTOR_CODE_LENGTH) {
throw new BusinessException( ReturnCodeEnum. CODE_DATA_LENGTH_ERROR) ;
// throw new BusinessException( ReturnCodeEnum. CODE_DATA_LENGTH_ERROR) ;
}
// }
}
// }
}
// }
/**
/**
* 校验充电桩相关的信息
* 校验充电桩相关的信息
*
*
* @param dto
* @param dto
*/
*/
protected void checkPileInfo( GenerateOrderDTO dto ) {
/* protected void checkPileInfo( GenerateOrderDTO dto) {
// 查询充电桩状态 是否空闲 枪口是否占用
// 查询充电桩状态 是否空闲 枪口是否占用
PileConnectorDetailVO pileConnector = pileBasicInfoService.queryPileConnectorDetail(dto.getPileSn() + dto.getConnectorCode());
PileConnectorDetailVO pileConnector = pileBasicInfoService.queryPileConnectorDetail(dto.getPileSn() + dto.getConnectorCode());
if (pileConnector == null) {
if (pileConnector == null) {
@@ -358,7 +356,7 @@ public abstract class AbstractProgramLogic implements InitializingBean {
}
}
dto.setPileConnector(pileConnector);
dto.setPileConnector(pileConnector);
dto.setBillingTemplate(billingTemplateVO);
dto.setBillingTemplate(billingTemplateVO);
}
}*/
@@ -734,96 +732,96 @@ public abstract class AbstractProgramLogic implements InitializingBean {
* @param dto
* @param dto
* @return
* @return
*/
*/
protected OrderBasicInfo saveOrder2Database( GenerateOrderDTO dto ) throws ParseException {
// protected OrderBasicInfo saveOrder2Database( GenerateOrderDTO dto) throws ParseException {
String orderCode = generateNewOrderCode( ) ;
// String orderCode = generateNewOrderCode() ;
String transactionCode = IdUtils. generateTransactionCode( dto . getPileSn ( ) , dto . getConnectorCode( ) ) ;
// String transactionCode = IdUtils. generateTransactionCode(dto.getPileSn(), dto. getConnectorCode()) ;
//
if ( StringUtils. isBlank( dto . getStartType ( ) ) ) {
// if ( StringUtils. isBlank(dto.getStartType())) {
dto. setStartType( StartTypeEnum. NOW . getValue ( ) ) ;
// dto. setStartType( StartTypeEnum.NOW.getValue()) ;
}
// }
//
String stationId = dto . getPileConnector( ) . getStationId( ) ;
// String stationId = dto. getPileConnector(). getStationId() ;
// 查询站点信息
// // 查询站点信息
PileStationInfo pileStationInfo = pileStationInfoService. selectPileStationInfoById( Long . valueOf( stationId) ) ;
// PileStationInfo pileStationInfo = pileStationInfoService. selectPileStationInfoById(Long. valueOf( stationId)) ;
String merchantId = pileStationInfo ! = null ? String. valueOf( pileStationInfo. getMerchantId( ) ) : " " ;
// String merchantId = pileStationInfo != null ? String. valueOf( pileStationInfo. getMerchantId()) : "" ;
String plateNumber = dto . getPlateNumber ( ) ! = null ? dto . getPlateNumber ( ) : " " ;
// String plateNumber = dto.getPlateNumber() != null ? dto.getPlateNumber() : "" ;
// 订单基本信息
// // 订单基本信息
OrderBasicInfo orderBasicInfo = OrderBasicInfo. builder( )
// OrderBasicInfo orderBasicInfo = OrderBasicInfo. builder( )
. orderCode( orderCode )
// . orderCode( orderCode)
. transactionCode( transactionCode )
// . transactionCode( transactionCode)
. orderStatus( OrderStatusEnum. NOT_START. getValue( ) )
// . orderStatus( OrderStatusEnum. NOT_START. getValue() )
. memberId( dto . getMemberId( ) )
// . memberId(dto. getMemberId() )
. stationId( stationId )
// . stationId( stationId)
. merchantId( merchantId )
// . merchantId( merchantId)
. pileSn( dto . getPileSn( ) )
// . pileSn(dto. getPileSn() )
. connectorCode( dto . getConnectorCode( ) )
// . connectorCode(dto. getConnectorCode() )
. pileConnectorCode( dto . getPileSn ( ) + dto . getConnectorCode( ) )
// . pileConnectorCode(dto.getPileSn() + dto. getConnectorCode() )
. startMode( dto . getStartMode( ) )
// . startMode(dto. getStartMode() )
. payStatus( Constants. ZERO )
// . payStatus( Constants. ZERO)
. payAmount( dto . getChargeAmount( ) )
// . payAmount(dto. getChargeAmount() )
. payMode( dto . getPayMode( ) )
// . payMode(dto. getPayMode() )
. plateNumber( plateNumber )
// . plateNumber( plateNumber)
. orderAmount( BigDecimal. ZERO )
// . orderAmount( BigDecimal. ZERO)
. virtualAmount( BigDecimal. ZERO )
// . virtualAmount( BigDecimal. ZERO)
. settleAmount( BigDecimal. ZERO )
// . settleAmount( BigDecimal. ZERO)
. startType( dto . getStartType( ) )
// . startType(dto. getStartType() )
. build ( ) ;
// .build() ;
if ( StringUtils. equals( dto . getStartMode ( ) , StartModeEnum. AUTH_CARD. getValue( ) ) ) {
// if ( StringUtils. equals(dto.getStartMode(), StartModeEnum. AUTH_CARD. getValue())) {
// 鉴权卡启动
// // 鉴权卡启动
orderBasicInfo. setLogicCard( dto . getPileAuthCardInfo( ) . getLogicCard( ) ) ;
// orderBasicInfo. setLogicCard(dto. getPileAuthCardInfo(). getLogicCard()) ;
}
// }
if ( StringUtils. equals( dto . getStartMode ( ) , StartModeEnum. VIN_CODE. getValue( ) ) ) {
// if ( StringUtils. equals(dto.getStartMode(), StartModeEnum. VIN_CODE. getValue())) {
// vin启动
// // vin启动
MemberPlateNumberRelation memberPlateNumberRelation = dto . getMemberPlateNumberRelation( ) ;
// MemberPlateNumberRelation memberPlateNumberRelation = dto. getMemberPlateNumberRelation() ;
if ( memberPlateNumberRelation ! = null ) {
// if ( memberPlateNumberRelation != null) {
if ( StringUtils. isNotBlank( memberPlateNumberRelation. getVinCode( ) ) ) {
// if ( StringUtils. isNotBlank( memberPlateNumberRelation. getVinCode())) {
orderBasicInfo. setVinCode( memberPlateNumberRelation. getVinCode( ) ) ;
// orderBasicInfo. setVinCode( memberPlateNumberRelation. getVinCode()) ;
}
// }
if ( StringUtils. isNotBlank( memberPlateNumberRelation. getLicensePlateNumber( ) ) ) {
// if ( StringUtils. isNotBlank( memberPlateNumberRelation. getLicensePlateNumber())) {
orderBasicInfo. setPlateNumber( memberPlateNumberRelation. getLicensePlateNumber( ) ) ;
// orderBasicInfo. setPlateNumber( memberPlateNumberRelation. getLicensePlateNumber()) ;
}
// }
}
// }
}
// }
//
if ( StringUtils. equals( dto . getStartType ( ) , StartTypeEnum. APPOINTMENT. getValue( ) ) ) {
// if ( StringUtils. equals(dto.getStartType(), StartTypeEnum. APPOINTMENT. getValue())) {
orderBasicInfo. setAppointmentTime( DateUtils. parseDate( dto . getAppointmentTime( ) , DateUtils. YYYY_MM_DD_HH_MM_SS) ) ;
// orderBasicInfo. setAppointmentTime( DateUtils. parseDate(dto. getAppointmentTime(), DateUtils. YYYY_MM_DD_HH_MM_SS)) ;
}
// }
//
// 订单详情
// // 订单详情
BillingTemplateVO billingTemplate = dto . getBillingTemplate( ) ;
// BillingTemplateVO billingTemplate = dto. getBillingTemplate() ;
logger. info ( " 订单使用的计费模板-orderCode:{}, billingTemplate:{}" , orderCode, JSONObject. toJSONString( billingTemplate) ) ;
// logger.info(" 订单使用的计费模板-orderCode:{}, billingTemplate:{}", orderCode, JSONObject. toJSONString( billingTemplate)) ;
BigDecimal sharpElectricityPrice = billingTemplate. getSharpElectricityPrice( ) ! = null ? billingTemplate. getSharpElectricityPrice( ) : BigDecimal. ZERO ;
// BigDecimal sharpElectricityPrice = billingTemplate. getSharpElectricityPrice() != null ? billingTemplate. getSharpElectricityPrice() : BigDecimal. ZERO;
BigDecimal sharpServicePrice = billingTemplate. getSharpServicePrice( ) ! = null ? billingTemplate. getSharpServicePrice( ) : BigDecimal. ZERO ;
// BigDecimal sharpServicePrice = billingTemplate. getSharpServicePrice() != null ? billingTemplate. getSharpServicePrice() : BigDecimal. ZERO;
BigDecimal peakElectricityPrice = billingTemplate. getPeakElectricityPrice( ) ! = null ? billingTemplate. getPeakElectricityPrice( ) : BigDecimal. ZERO ;
// BigDecimal peakElectricityPrice = billingTemplate. getPeakElectricityPrice() != null ? billingTemplate. getPeakElectricityPrice() : BigDecimal. ZERO;
BigDecimal peakServicePrice = billingTemplate. getPeakServicePrice( ) ! = null ? billingTemplate. getPeakServicePrice( ) : BigDecimal. ZERO ;
// BigDecimal peakServicePrice = billingTemplate. getPeakServicePrice() != null ? billingTemplate. getPeakServicePrice() : BigDecimal. ZERO;
BigDecimal flatElectricityPrice = billingTemplate. getFlatElectricityPrice( ) ! = null ? billingTemplate. getFlatElectricityPrice( ) : BigDecimal. ZERO ;
// BigDecimal flatElectricityPrice = billingTemplate. getFlatElectricityPrice() != null ? billingTemplate. getFlatElectricityPrice() : BigDecimal. ZERO;
BigDecimal flatServicePrice = billingTemplate. getFlatServicePrice( ) ! = null ? billingTemplate. getFlatServicePrice( ) : BigDecimal. ZERO ;
// BigDecimal flatServicePrice = billingTemplate. getFlatServicePrice() != null ? billingTemplate. getFlatServicePrice() : BigDecimal. ZERO;
BigDecimal valleyElectricityPrice = billingTemplate. getValleyElectricityPrice( ) ! = null ? billingTemplate. getValleyElectricityPrice( ) : BigDecimal. ZERO ;
// BigDecimal valleyElectricityPrice = billingTemplate. getValleyElectricityPrice() != null ? billingTemplate. getValleyElectricityPrice() : BigDecimal. ZERO;
BigDecimal valleyServicePrice = billingTemplate. getValleyServicePrice( ) ! = null ? billingTemplate. getValleyServicePrice( ) : BigDecimal. ZERO ;
// BigDecimal valleyServicePrice = billingTemplate. getValleyServicePrice() != null ? billingTemplate. getValleyServicePrice() : BigDecimal. ZERO;
//
OrderDetail orderDetail = OrderDetail. builder( )
// OrderDetail orderDetail = OrderDetail. builder( )
. orderCode( orderCode )
// . orderCode( orderCode)
. sharpPrice( sharpElectricityPrice. add ( sharpServicePrice) )
// . sharpPrice( sharpElectricityPrice.add( sharpServicePrice) )
. sharpElectricityPrice( sharpElectricityPrice )
// . sharpElectricityPrice( sharpElectricityPrice)
. sharpServicePrice( sharpServicePrice )
// . sharpServicePrice( sharpServicePrice)
. peakPrice( peakElectricityPrice. add ( peakServicePrice) )
// . peakPrice( peakElectricityPrice.add( peakServicePrice) )
. peakElectricityPrice( peakElectricityPrice )
// . peakElectricityPrice( peakElectricityPrice)
. peakServicePrice( peakServicePrice )
// . peakServicePrice( peakServicePrice)
. flatPrice( flatElectricityPrice. add ( flatServicePrice) )
// . flatPrice( flatElectricityPrice.add( flatServicePrice) )
. flatElectricityPrice( flatElectricityPrice )
// . flatElectricityPrice( flatElectricityPrice)
. flatServicePrice( flatServicePrice )
// . flatServicePrice( flatServicePrice)
. valleyPrice( valleyElectricityPrice. add ( valleyServicePrice) )
// . valleyPrice( valleyElectricityPrice.add( valleyServicePrice) )
. valleyElectricityPrice( valleyElectricityPrice )
// . valleyElectricityPrice( valleyElectricityPrice)
. valleyServicePrice( valleyServicePrice )
// . valleyServicePrice( valleyServicePrice)
. build ( ) ;
// .build() ;
//
OrderTransactionDTO createOrderTransactionDTO = OrderTransactionDTO. builder( )
// OrderTransactionDTO createOrderTransactionDTO = OrderTransactionDTO. builder( )
. orderBasicInfo( orderBasicInfo )
// . orderBasicInfo( orderBasicInfo)
. orderDetail( orderDetail )
// . orderDetail( orderDetail)
. build ( ) ;
// .build() ;
transactionService. doCreateOrder( createOrderTransactionDTO) ;
// transactionService. doCreateOrder( createOrderTransactionDTO) ;
return orderBasicInfo ;
// return orderBasicInfo;
}
// }
/**
/**
* 计算订单折扣
* 计算订单折扣