|  |  | 
 |  |  | import com.dy.pipIrrGlobal.voSe.VoOrders; | 
 |  |  | import com.dy.pipIrrGlobal.voSe.VoVcRecharge; | 
 |  |  | import com.dy.pipIrrGlobal.voSe.VoVirtualCard; | 
 |  |  |  | 
 |  |  | import com.dy.pipIrrSell.result.SellResultCode; | 
 |  |  | import com.dy.pipIrrSell.virtualCard.dto.DtoVcRecharge; | 
 |  |  | import com.dy.pipIrrSell.virtualCard.dto.DtoVirtualCard; | 
 |  |  | import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM; | 
 |  |  | import com.dy.pipIrrSell.virtualCard.enums.OrderStateENUM; | 
 |  |  |  | 
 |  |  | import com.dy.pipIrrWechat.virtualCard.dto.DtoVcRecharge; | 
 |  |  | import com.dy.pipIrrWechat.virtualCard.dto.DtoVirtualCard; | 
 |  |  | import com.dy.pipIrrWechat.virtualCard.enums.LastOperateENUM; | 
 |  |  | import com.dy.pipIrrWechat.virtualCard.enums.OrderStateENUM; | 
 |  |  | import com.dy.pipIrrWechat.result.WechatResultCode; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.apache.dubbo.common.utils.PojoUtils; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @author ZhuBaoMin | 
 |  |  |  * @date 2024-07-11 15:49 | 
 |  |  |  * @LastEditTime 2024-07-11 15:49 | 
 |  |  |  * @date 2024-07-15 9:39 | 
 |  |  |  * @LastEditTime 2024-07-15 9:39 | 
 |  |  |  * @Description | 
 |  |  |  */ | 
 |  |  |  | 
 |  |  | 
 |  |  |         // 验证该虚拟卡账户是否存在并取出当前账户余额 | 
 |  |  |         SeVirtualCard seVirtualCard = seVirtualCardMapper.selectByPrimaryKey(virtualId); | 
 |  |  |         if(seVirtualCard == null) { | 
 |  |  |             return BaseResponseUtils.buildFail(SellResultCode.NO_ACCOUNT.getMessage()); | 
 |  |  |             return BaseResponseUtils.buildFail(WechatResultCode.NO_ACCOUNT.getMessage()); | 
 |  |  |         } | 
 |  |  |         Double money = seVirtualCard.getMoney(); | 
 |  |  |  | 
 |  |  | 
 |  |  |         seVcRecharge.setOrderState(OrderStateENUM.NON_PAYMENT.getCode()); | 
 |  |  |         Integer rec = seVcRechargeMapper.insert(seVcRecharge); | 
 |  |  |         if(rec == null) { | 
 |  |  |             return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL.getMessage()); | 
 |  |  |             return BaseResponseUtils.buildFail(WechatResultCode.RECHARGE_FAIL.getMessage()); | 
 |  |  |         } | 
 |  |  |         return BaseResponseUtils.buildSuccess(true) ; | 
 |  |  |     } | 
 |  |  | 
 |  |  |     public BaseResponse<Boolean> updateVCRecharge(String orderNumber, Date rechargeTime) { | 
 |  |  |         SeVcRecharge seVcRecharge = seVcRechargeMapper.getVCRechargeByorderNumber(orderNumber); | 
 |  |  |         if(seVcRecharge == null) { | 
 |  |  |             return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_NOT_EXIST.getMessage()); | 
 |  |  |             return BaseResponseUtils.buildFail(WechatResultCode.RECHARGE_NOT_EXIST.getMessage()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         Long virtualId = seVcRecharge.getVcId(); | 
 |  |  | 
 |  |  |         seVcRecharge.setOrderState(OrderStateENUM.PAID.getCode()); | 
 |  |  |         Integer rec = seVcRechargeMapper.updateByPrimaryKeySelective(seVcRecharge); | 
 |  |  |         if(rec == null) { | 
 |  |  |             return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL.getMessage()); | 
 |  |  |             return BaseResponseUtils.buildFail(WechatResultCode.RECHARGE_FAIL.getMessage()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         SeVirtualCard seVirtualCard = seVirtualCardMapper.selectByPrimaryKey(virtualId); | 
 |  |  |         if(seVirtualCard == null) { | 
 |  |  |             return BaseResponseUtils.buildFail(SellResultCode.VIRTUAL_CARD_NOT_EXIST.getMessage()); | 
 |  |  |             return BaseResponseUtils.buildFail(WechatResultCode.VIRTUAL_CARD_NOT_EXIST.getMessage()); | 
 |  |  |         } | 
 |  |  |         seVirtualCard.setMoney(afterRrecharge); | 
 |  |  |         seVirtualCard.setLastOperate(LastOperateENUM.RECHARGE.getCode()); | 
 |  |  |         seVirtualCard.setLastOperateTime(new Date()); | 
 |  |  |         Integer rec2 = seVirtualCardMapper.updateByPrimaryKeySelective(seVirtualCard); | 
 |  |  |         if(rec2 == null) { | 
 |  |  |             return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL.getMessage()); | 
 |  |  |             return BaseResponseUtils.buildFail(WechatResultCode.RECHARGE_FAIL.getMessage()); | 
 |  |  |         } | 
 |  |  |         return BaseResponseUtils.buildSuccess(true) ; | 
 |  |  |     } | 
 |  |  | 
 |  |  |  | 
 |  |  |         return rsVo; | 
 |  |  |     } | 
 |  |  | } | 
 |  |  |  | 
 |  |  | } |