From 575cab9590bda15577cd90ba7692d7bbc2cbc048 Mon Sep 17 00:00:00 2001 From: yuyang Date: Wed, 26 Jan 2022 15:01:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=85=E7=94=B5=E5=BE=85=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=B8=80=E6=9D=A1=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=EF=BC=8C=E4=BF=AE=E6=94=B9=E7=A4=BE=E5=8C=BA?= =?UTF-8?q?=E5=85=85=E5=80=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/XhpcCardServiceImpl.java | 4 +-- .../impl/XhpcChargeOrderServiceImpl.java | 30 +++++++++++++++++-- .../controller/AlipayPaymentController.java | 2 +- .../controller/WxPaymentController.java | 2 +- .../com/xhpc/user/mapper/MechanismMapper.java | 3 +- .../service/impl/IMechanismServiceImpl.java | 10 ++++--- .../impl/XhpcCommunityServiceImpl.java | 12 ++++++-- .../impl/XhpcCustomersServiceImpl.java | 2 +- .../main/resources/mapper/MechanismMapper.xml | 16 ++++++---- 9 files changed, 62 insertions(+), 19 deletions(-) diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java index 8efae80c..4c0d9762 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java @@ -121,8 +121,8 @@ public class XhpcCardServiceImpl implements IXhpcCardService { Long userId=xhpcIcCardInfo.getUserId(); Integer userType=xhpcIcCardInfo.getUserType(); String tenantId=xhpcIcCardInfo.getTenantId(); - Integer type =1; - String grantOperator=xhpcIcCardInfo.getGrantOperatorId(); + Integer type =1;//改成卡授权的类型 + String grantOperator=xhpcIcCardInfo.getGrantOperatorId();//改成卡授权的运营商 return cardHistoryOrderService.cardStartup(userId, serialNumber, userType,tenantId,type,grantOperator,rateModelId); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java index 27dbe81d..0bcecfd1 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java @@ -292,6 +292,8 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar xhpcChargeOrder.setType(40); xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder); + //插一帧实时数据 + extracted(xhpcChargeOrder); return AjaxResult.success(); }else{ @@ -423,8 +425,6 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar return xhpcChargeOrderMapper.getXhpcChargeOrderStatus(status, source); } - - @Override @Transactional public R startUpBy3rd(String internetSerialNumber, String driverId, Integer chargingAmt, String plateNum, Integer status, String connectorId) { @@ -731,6 +731,9 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar xhpcChargeOrder.setType(40); xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder); + //插一帧实时数据 + extracted(xhpcChargeOrder); + Map map =new HashMap<>(); map.put("balance",userMessage.get("balance")); map.put("serialNumber",orderNo); @@ -819,4 +822,27 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar } } + private void extracted(XhpcChargeOrder xhpcChargeOrder) { + try{ + XhpcRealTimeOrder xhpcRealTimeOrder = new XhpcRealTimeOrder(); + String orderNo = xhpcChargeOrder.getSerialNumber(); + xhpcRealTimeOrder.setChargingOrderId(xhpcChargeOrder.getChargeOrderId()); + xhpcRealTimeOrder.setTransactionNumber(orderNo); + xhpcRealTimeOrder.setPileNumber(orderNo.substring(0,14)); + xhpcRealTimeOrder.setGunNumber(orderNo.substring(15,16)); + xhpcRealTimeOrder.setPileGunStatus(0); + xhpcRealTimeOrder.setVehicleGunStatus(0); + xhpcRealTimeOrder.setSoc("0"); + xhpcRealTimeOrder.setChargingTime("0分"); + xhpcRealTimeOrder.setChargingDegree(new BigDecimal(0)); + xhpcRealTimeOrder.setStatus(3); + xhpcRealTimeOrder.setCreateTime(Calendar.getInstance().getTime()); + xhpcRealTimeOrder.setUserId(xhpcChargeOrder.getUserId()); + Long chargingStationId = xhpcChargeOrder.getChargingStationId(); + xhpcRealTimeOrder.setChargingStationId(chargingStationId); + xhpcRealTimeOrderService.addXhpcRealTimeOrder(xhpcRealTimeOrder); + }catch (Exception e){ + + } + } } diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/AlipayPaymentController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/AlipayPaymentController.java index 9c18eb43..07342952 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/AlipayPaymentController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/AlipayPaymentController.java @@ -311,7 +311,7 @@ public class AlipayPaymentController { xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement); }else{ //增加用户余额 - userTypeService.insertUserBalance(money,userId,source,tenantId,UserTypeUtil.RECHARGE_ZHB,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId()); + userTypeService.insertUserBalance(xhpcRechargeOrder.getAmount(),userId,source,tenantId,UserTypeUtil.RECHARGE_ZHB,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId()); } } } diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java index 6b73492f..505f61c4 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java @@ -417,7 +417,7 @@ public class WxPaymentController { xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement); }else{ //增加用户余额 - userTypeService.insertUserBalance(money,userId,source,tenantId, UserTypeUtil.RECHARGE_WX,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId()); + userTypeService.insertUserBalance(xhpcRechargeOrder.getAmount(),userId,source,tenantId, UserTypeUtil.RECHARGE_WX,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId()); } } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/MechanismMapper.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/MechanismMapper.java index 361e8768..f2b86737 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/MechanismMapper.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/MechanismMapper.java @@ -4,6 +4,7 @@ import com.xhpc.common.domain.XhpcRechargeOrder; import org.apache.ibatis.annotations.Param; import java.math.BigDecimal; +import java.util.Date; import java.util.List; import java.util.Map; @@ -77,5 +78,5 @@ public interface MechanismMapper { int insertRechargeOrder(XhpcRechargeOrder xhpcRechargeOrder); - int insertUserAccount(@Param("userId")Long userId,@Param("amount")BigDecimal amount,@Param("remainingSum")BigDecimal remainingSum,@Param("chargeOrderId")Long chargeOrderId,@Param("rechargeOrderId")Long rechargeOrderId,@Param("refundOrderId")Long refundOrderId,@Param("type")Integer type,@Param("tenantId")String tenantId,@Param("source")Integer source); + int insertUserAccount(@Param("userId")Long userId,@Param("amount")BigDecimal amount,@Param("remainingSum")BigDecimal remainingSum,@Param("chargeOrderId")Long chargeOrderId,@Param("rechargeOrderId")Long rechargeOrderId,@Param("refundOrderId")Long refundOrderId,@Param("type")Integer type,@Param("tenantId")String tenantId,@Param("source")Integer source,@Param("createTime") Date createTime); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/IMechanismServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/IMechanismServiceImpl.java index b83ca544..c59a9f8f 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/IMechanismServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/IMechanismServiceImpl.java @@ -4,9 +4,7 @@ import cn.hutool.core.date.DateUtil; import com.xhpc.common.core.constant.StatusConstants; import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.utils.StringUtils; -import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.domain.XhpcRechargeOrder; -import com.xhpc.common.domain.XhpcRefundOrder; import com.xhpc.common.util.UserTypeUtil; import com.xhpc.user.dto.MechanismDto; import com.xhpc.user.mapper.MechanismMapper; @@ -15,7 +13,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; /** * @author yuyang @@ -101,7 +102,8 @@ public class IMechanismServiceImpl implements IMechanismService { */ @Override public int insertUserAccount(Long userId,BigDecimal amount,BigDecimal remainingSum,Long chargeOrderId,Long rechargeOrderId,Long refundOrderId,Integer type,String tenantId,Integer source) { - return mechanismMapper.insertUserAccount(userId, amount, remainingSum, chargeOrderId, rechargeOrderId, refundOrderId, type, tenantId, source); + + return mechanismMapper.insertUserAccount(userId, amount, remainingSum, chargeOrderId, rechargeOrderId, refundOrderId, type, tenantId, source,new Date()); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java index 463ac272..7437a10a 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCommunityServiceImpl.java @@ -12,6 +12,8 @@ import com.xhpc.user.domain.XhpcCommunityPersonnel; import com.xhpc.user.mapper.XhpcCommunityMapper; import com.xhpc.user.service.IMechanismService; import com.xhpc.user.service.IXhpcCommunityService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -37,6 +39,8 @@ public class XhpcCommunityServiceImpl extends BaseService implements IXhpcCommun @Autowired private TokenService tokenService; + private static final Logger logger = LoggerFactory.getLogger(XhpcCommunityServiceImpl.class); + @Override public List> list(HttpServletRequest request, String name) { Long userId = SecurityUtils.getUserId(); @@ -211,15 +215,19 @@ public class XhpcCommunityServiceImpl extends BaseService implements IXhpcCommun @Transactional public AjaxResult addRecharge(XhpcCommunityPersonnel xhpcCommunityPersonnel) { + //充值金额 BigDecimal rechargeMoney = xhpcCommunityPersonnel.getRechargeMoney(); + logger.info("<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>"+rechargeMoney); Long communityPersonnelId = xhpcCommunityPersonnel.getCommunityPersonnelId(); if(rechargeMoney !=null &&new BigDecimal(0).compareTo(rechargeMoney)==-1){ //增加社区用户的剩余金额 Map communityPersonnelById = xhpcCommunityMapper.getCommunityPersonnelById(communityPersonnelId, null, null, 1); if(communityPersonnelById !=null){ BigDecimal surplusMoney = new BigDecimal(communityPersonnelById.get("surplusMoney").toString()); + //原本充值金额 BigDecimal rechargeMoney1 = new BigDecimal(communityPersonnelById.get("rechargeMoney").toString()); - + logger.info("<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>"+surplusMoney); + logger.info("<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>"+rechargeMoney1); XhpcCommunityPersonnel xhpcCommunityPersonnel1=new XhpcCommunityPersonnel(); xhpcCommunityPersonnel1.setCommunityPersonnelId(communityPersonnelId); BigDecimal remainingSum = surplusMoney.add(rechargeMoney); @@ -230,7 +238,7 @@ public class XhpcCommunityServiceImpl extends BaseService implements IXhpcCommun Long rechargeOrderId=null; if(UserTypeUtil.RECHARGE_PT.equals(xhpcCommunityPersonnel.getRechargeType())){ //增加充值记录 - rechargeOrderId = mechanismService.addRechargeOrder(communityPersonnelId, UserTypeUtil.COMMUNIT_TYPE, rechargeMoney, remainingSum, xhpcCommunityPersonnel1.getRechargeType()); + rechargeOrderId = mechanismService.addRechargeOrder(communityPersonnelId, UserTypeUtil.COMMUNIT_TYPE, rechargeMoney, remainingSum, xhpcCommunityPersonnel.getRechargeType()); }else{ rechargeOrderId=xhpcCommunityPersonnel.getMoneyOrderId(); } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java index 7819d836..1bf33324 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcCustomersServiceImpl.java @@ -234,7 +234,7 @@ public class XhpcCustomersServiceImpl extends BaseService implements IXhpcCustom Long rechargeOrderId=null; if(UserTypeUtil.RECHARGE_PT.equals(xhpcCustomersPersonnel.getRechargeType())){ //增加充值记录 - rechargeOrderId =mechanismService.addRechargeOrder(customersPersonnelId, UserTypeUtil.CUSTOMERS_TYPE,rechargeMoney,remainingSum,xhpcCustomersPersonnel1.getRechargeType()); + rechargeOrderId =mechanismService.addRechargeOrder(customersPersonnelId, UserTypeUtil.CUSTOMERS_TYPE,rechargeMoney,remainingSum,xhpcCustomersPersonnel.getRechargeType()); }else{ rechargeOrderId= xhpcCustomersPersonnel.getMoneyOrderId(); } diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml index b1c3105a..174384bc 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/MechanismMapper.xml @@ -143,7 +143,7 @@ keyProperty="rechargeOrderId"> INSERT INTO xhpc_recharge_order - + user_id, @@ -167,7 +167,7 @@ del_flag, - + create_time, @@ -187,7 +187,7 @@ - + #{userId}, @@ -211,8 +211,8 @@ #{delFlag}, - - #{createTime}, + + #{createTime,jdbcType=TIMESTAMP}, #{createBy}, @@ -266,6 +266,9 @@ source, + + create_time, + @@ -295,6 +298,9 @@ #{source}, + + #{createTime,jdbcType=TIMESTAMP}, +