充电待启动,增加一条实时数据,修改社区充值问题

This commit is contained in:
yuyang 2022-01-26 15:01:51 +08:00
parent b6b2dc6058
commit 575cab9590
9 changed files with 62 additions and 19 deletions

View File

@ -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);
}

View File

@ -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<String,Object> 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){
}
}
}

View File

@ -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());
}
}
}

View File

@ -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());
}
}

View File

@ -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);
}

View File

@ -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());
}

View File

@ -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<Map<String, Object>> 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>>>>>>>>>>>>>>>>>"+rechargeMoney);
Long communityPersonnelId = xhpcCommunityPersonnel.getCommunityPersonnelId();
if(rechargeMoney !=null &&new BigDecimal(0).compareTo(rechargeMoney)==-1){
//增加社区用户的剩余金额
Map<String, Object> 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>>>>>>>>>>>>>>>>>"+surplusMoney);
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<rechargeMoney1>>>>>>>>>>>>>>>>>"+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();
}

View File

@ -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();
}

View File

@ -143,7 +143,7 @@
keyProperty="rechargeOrderId">
INSERT INTO xhpc_recharge_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != userId and '' != userId">
<if test="null != userId">
user_id,
</if>
<if test="null != rechargeOrderNumber and '' != rechargeOrderNumber">
@ -187,7 +187,7 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != userId and '' != userId">
<if test="null != userId">
#{userId},
</if>
<if test="null != rechargeOrderNumber and '' != rechargeOrderNumber">
@ -212,7 +212,7 @@
#{delFlag},
</if>
<if test="null != createTime">
#{createTime},
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
@ -266,6 +266,9 @@
<if test="null != source">
source,
</if>
<if test="null != createTime">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != userId">
@ -295,6 +298,9 @@
<if test="null != source">
#{source},
</if>
<if test="null != createTime">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
</mapper>