puzhibing
2024-10-18 458998ebe0ea5acdd96d342f7c75f4eeeffa6dc7
Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile

# Conflicts:
# ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java
3个文件已修改
104 ■■■■ 已修改文件
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java 96 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java
@@ -6,6 +6,9 @@
import com.ruoyi.chargingPile.api.dto.TChargingGunDTO;
import com.ruoyi.chargingPile.api.feignClient.SiteClient;
import com.ruoyi.chargingPile.api.model.Site;
import com.ruoyi.chargingPile.api.model.TAccountingStrategy;
import com.ruoyi.chargingPile.api.feignClient.SiteClient;
import com.ruoyi.chargingPile.api.model.Site;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.chargingPile.api.query.TChargingGunQuery;
@@ -13,6 +16,7 @@
import com.ruoyi.chargingPile.domain.SiteMenu;
import com.ruoyi.chargingPile.mapper.TChargingGunMapper;
import com.ruoyi.chargingPile.service.IPartnerService;
import com.ruoyi.chargingPile.service.TAccountingStrategyService;
import com.ruoyi.chargingPile.service.TChargingGunService;
import com.ruoyi.chargingPile.service.TChargingPileService;
import com.ruoyi.common.core.enums.status.ChargingGunModeEnum;
@@ -71,7 +75,7 @@
    @Resource
    private SiteClient siteClient;
    
    
    @Override
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -318,6 +318,8 @@
    @Override
    public List<MyChargingOrderList> getNoInvoicedOrder(GetNoInvoicedOrder query) {
        Long appUserId = tokenService.getLoginUserApplet().getUserId();
        query.setPageCurr((query.getPageCurr() - 1) * query.getPageSize());
        List<TChargingOrder> orderList = this.baseMapper.getNoInvoicedOrder(appUserId, query.getMonth(), query.getPageCurr(), query.getPageSize());
        List<MyChargingOrderList> list = new ArrayList<>();
        for (TChargingOrder tChargingOrder : orderList) {
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java
@@ -413,58 +413,56 @@
    @Override
    @GlobalTransactional(rollbackFor = Exception.class)//分布式事务
    public AjaxResult cancelShoppingOrderWxRefund(String out_refund_no, String refund_id, String refund_status, String success_time) {
        if("SUCCESS".equals(refund_status)){
            TShoppingOrderRefund one = shoppingOrderRefundService.getOne(new LambdaQueryWrapper<TShoppingOrderRefund>().eq(TShoppingOrderRefund::getRefundCode, out_refund_no));
            one.setRefundStatus(2);
            one.setRefundSerialNumber(refund_id);
            one.setRefundTime(LocalDateTime.parse(success_time, DateTimeFormatter.ofPattern("yyyy-MM-DDTHH:mm:ss+TIMEZONE")));
            shoppingOrderRefundService.updateById(one);
            //判断是否需要回退库存
            TShoppingOrder shoppingOrder = this.getById(one.getShoppingOrderId());
            shoppingOrder.setStatus(4);
            shoppingOrder.setRefundCode(one.getRefundSerialNumber());
            shoppingOrder.setRefundAmount(one.getRefundAmount());
            shoppingOrder.setRefundStatus(2);
            shoppingOrder.setRefundTime(one.getRefundTime());
            this.updateById(shoppingOrder);
            //商品
            if(shoppingOrder.getOrderType() == 1){
                //redis锁 和支付使用同一个锁
                RedisLock redisLock = new RedisLock(redisTemplate, "SHOPPING_GOODS_LOCK", 5, 30000);
                try {
                    redisLock.lock();
                    TGoods goods = goodsClient.getGoodsById(shoppingOrder.getGoodsId()).getData();
                    Integer inventory = goods.getInventory();
                    if(-1 != inventory){
                        goods.setInventory(inventory + shoppingOrder.getPurchaseQuantity());
                        goodsClient.updateGoods(goods);
                    }
                }catch (Exception e){
                    e.printStackTrace();
                }finally {
                    //解锁
                    redisLock.unlock();
        TShoppingOrderRefund one = shoppingOrderRefundService.getOne(new LambdaQueryWrapper<TShoppingOrderRefund>().eq(TShoppingOrderRefund::getRefundCode, out_refund_no));
        one.setRefundStatus(2);
        one.setRefundSerialNumber(refund_id);
        one.setRefundTime(LocalDateTime.now());
        shoppingOrderRefundService.updateById(one);
        //判断是否需要回退库存
        TShoppingOrder shoppingOrder = this.getById(one.getShoppingOrderId());
        shoppingOrder.setStatus(4);
        shoppingOrder.setRefundCode(one.getRefundSerialNumber());
        shoppingOrder.setRefundAmount(one.getRefundAmount());
        shoppingOrder.setRefundStatus(2);
        shoppingOrder.setRefundTime(one.getRefundTime());
        this.updateById(shoppingOrder);
        //商品
        if(shoppingOrder.getOrderType() == 1){
            //redis锁 和支付使用同一个锁
            RedisLock redisLock = new RedisLock(redisTemplate, "SHOPPING_GOODS_LOCK", 5, 30000);
            try {
                redisLock.lock();
                TGoods goods = goodsClient.getGoodsById(shoppingOrder.getGoodsId()).getData();
                Integer inventory = goods.getInventory();
                if(-1 != inventory){
                    goods.setInventory(inventory + shoppingOrder.getPurchaseQuantity());
                    goodsClient.updateGoods(goods);
                }
            }catch (Exception e){
                e.printStackTrace();
            }finally {
                //解锁
                redisLock.unlock();
            }
            //优惠券
            if(shoppingOrder.getOrderType() == 2){
                //redis锁 和支付使用同一个锁
                RedisLock redisLock = new RedisLock(redisTemplate, "SHOPPING_COUPON_LOCK", 5, 30000);
                try {
                    redisLock.lock();
                    TCoupon coupon = couponClient.getCouponById1(shoppingOrder.getCouponId()).getData();
                    Integer inventory = coupon.getInventoryQuantity();
                    if(-1 != inventory){
                        coupon.setInventoryQuantity(inventory + shoppingOrder.getPurchaseQuantity());
                        couponClient.updateCoupon(coupon);
                    }
                }catch (Exception e){
                    e.printStackTrace();
                }finally {
                    //解锁
                    redisLock.unlock();
        }
        //优惠券
        if(shoppingOrder.getOrderType() == 2){
            //redis锁 和支付使用同一个锁
            RedisLock redisLock = new RedisLock(redisTemplate, "SHOPPING_COUPON_LOCK", 5, 30000);
            try {
                redisLock.lock();
                TCoupon coupon = couponClient.getCouponById1(shoppingOrder.getCouponId()).getData();
                Integer inventory = coupon.getInventoryQuantity();
                if(-1 != inventory){
                    coupon.setInventoryQuantity(inventory + shoppingOrder.getPurchaseQuantity());
                    couponClient.updateCoupon(coupon);
                }
            }catch (Exception e){
                e.printStackTrace();
            }finally {
                //解锁
                redisLock.unlock();
            }
        }
        return AjaxResult.success();