ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysOperlogController.java
@@ -55,7 +55,7 @@ if(null != query.getStartTime() && null != query.getEndTime()){ wrapper.between(SysOperLog::getOperTime, query.getStartTime(), query.getEndTime()); } PageInfo<SysOperLog> page = operLogService.page(pageInfo, wrapper); PageInfo<SysOperLog> page = operLogService.page(pageInfo, wrapper.orderByDesc(SysOperLog::getOperTime)); return AjaxResult.success(page); } ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -537,11 +537,11 @@ data1.addAll(data); } Set<Integer> siteIds = new HashSet<>(data1); sysUser.setSiteIds(siteIds.stream().collect(Collectors.toList())); List<Site> data = siteClient.getSiteByIds(siteIds.stream().collect(Collectors.toList())).getData(); if (null != data) { List<String> siteNames = data.stream().map(Site::getName).collect(Collectors.toList()); sysUser.setSiteNames(siteNames); sysUser.setSiteIds(data.stream().map(Site::getId).collect(Collectors.toList())); } List<String> roleNames = new ArrayList<>(); for (SysUserRole sysUserRole : list1) { ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java
@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.model.TChargingGun; import com.ruoyi.chargingPile.api.model.TChargingPile; import com.ruoyi.chargingPile.api.query.TChargingGunQuery; @@ -11,6 +14,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; @@ -65,6 +69,9 @@ @Resource private SendMessageClient sendMessageClient; @Resource private SiteClient siteClient; @@ -99,6 +106,10 @@ tChargingGunVO.setAuthQueryInfo(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_QUERY_INFO)); tChargingGunVO.setAuthUpdate(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_UPDATE)); tChargingGunVO.setAuthViewRates(roleType == 1 ? true : partnerService.authMenu(objectId, siteId, SiteMenu.CHARGING_GUN_VIEW_RATES)); if(null == tChargingGunVO.getAccountingStrategyId()){ Site site = siteClient.getSiteByIds(Arrays.asList(tChargingGunVO.getSiteId())).getData().get(0); tChargingGunVO.setAccountingStrategyId(site.getAccountingStrategyId()); } } pageInfo.setRecords(list); return pageInfo; ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -205,6 +205,7 @@ Map<String, Object> map = new HashMap<>(); int size = this.baseMapper.getMyChargingOrderList(appUserId, 1, null, null).size(); map.put("number", size); query.setPageCurr((query.getPageCurr() - 1) * query.getPageSize()); List<TChargingOrder> list = this.baseMapper.getMyChargingOrderList(appUserId, query.getType(), query.getPageCurr(), query.getPageSize()); List<MyChargingOrderList> orderLists = new ArrayList<>(); for (TChargingOrder tChargingOrder : list) { @@ -317,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();