ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppCouponClient.java
@@ -9,6 +9,7 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.page.PageInfo; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -25,15 +26,15 @@ * 管理后台远程调用 根据优惠券ids 查询对应的发放数量 * @return 优惠券ids 查询每个优惠券的发放数量 */ @PostMapping("/t-app-coupon/getCountByCouponIds") public R<List<Integer>> getCountByCouponIds(String couponIds); @PostMapping("/t-app-coupon/getCountByCouponIds/{couponIds}") public R<List<Integer>> getCountByCouponIds(@PathVariable("couponIds") String couponIds); /** * 管理后台远程调用 根据优惠券id 查询对应的使用数量 * @param couponId * @return */ @PostMapping("/t-app-coupon/getUseCountByCouponId") public R<Integer> getUseCountByCouponId(Integer couponId); @PostMapping("/t-app-coupon/getUseCountByCouponId/{couponId}") public R<Integer> getUseCountByCouponId(@PathVariable("couponId")Integer couponId); /** * 后台远程调用 根据优惠券id 查询领取记录 * @param couponId ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingPileFallbackFactory.java
@@ -41,6 +41,11 @@ public R<SiteInfoVO> getSiteInfoByNumber(String number) { return R.fail("通过桩编号获取电站信息失败:"+throwable.getMessage()); } @Override public R<TChargingPile> getChargingPileById(Integer id) { return R.fail(throwable.getMessage()); } }; } } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TRoleSite.java
@@ -24,7 +24,7 @@ @EqualsAndHashCode(callSuper = false) @TableName("t_role_site") @ApiModel(value="TRoleSite对象", description="") public class TRoleSite extends BasePojo { public class TRoleSite { private static final long serialVersionUID = 1L; ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -21,6 +21,7 @@ import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.query.GetSysUserList; import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysUserRoleService; import com.ruoyi.system.service.ISysUserService; import org.slf4j.Logger; @@ -86,6 +87,9 @@ @Resource private SiteClient siteClient; @Resource private ISysRoleService sysRoleService; @@ -578,18 +582,27 @@ for (SysUser sysUser : list) { List<SysUserRole> list1 = sysUserRoleService.list(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, sysUser.getUserId())); List<Integer> data1 = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); if(null == data1){ data1 = new ArrayList<>(); } for (SysUserRole sysUserRole : list1) { List<Integer> data = roleSiteClient.getSiteIds(sysUserRole.getRoleId()).getData(); if (null == data){ continue; } data1.addAll(data); } Set<Integer> siteIds = new HashSet<>(data1); List<Site> data = siteClient.getSiteByIds(siteIds.stream().collect(Collectors.toList())).getData(); List<String> siteNames = data.stream().map(Site::getName).collect(Collectors.toList()); sysUser.setSiteNames(siteNames); Set<Long> collect = list1.stream().map(SysUserRole::getRoleId).collect(Collectors.toSet()); List<SysRole> sysRoles = roleMapper.selectBatchIds(collect); List<String> roleNames = sysRoles.stream().map(SysRole::getRoleName).collect(Collectors.toList()); if(null != data){ List<String> siteNames = data.stream().map(Site::getName).collect(Collectors.toList()); sysUser.setSiteNames(siteNames); } List<String> roleNames = new ArrayList<>(); for (SysUserRole sysUserRole : list1) { SysRole sysRole = sysRoleService.selectRoleById(sysUserRole.getRoleId()); roleNames.add(sysRole.getRoleName()); } sysUser.setRoleNames(roleNames); } return pageInfo.setRecords(list); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppCouponController.java
@@ -144,8 +144,8 @@ * 管理后台远程调用 根据优惠券ids 查询对应的发放数量 * @return 优惠券ids 查询每个优惠券的发放数量 */ @PostMapping("/getCountByCouponIds") public R<List<Integer>> getCountByCouponIds( String couponIds) { @PostMapping("/getCountByCouponIds/{couponIds}") public R<List<Integer>> getCountByCouponIds(@PathVariable("couponIds")String couponIds) { // 最终结果 和优惠券id一一对应 List<Integer> res = new ArrayList<>(); String[] split = couponIds.split(","); @@ -164,8 +164,8 @@ * @param couponId * @return */ @PostMapping("/getUseCountByCouponId") public R<Integer> getUseCountByCouponId(Integer couponId){ @PostMapping("/getUseCountByCouponId/{couponId}") public R<Integer> getUseCountByCouponId(@PathVariable("couponId") Integer couponId){ return R.ok(tAppCouponService.list(new QueryWrapper<TAppCoupon>() .eq("coupon_id", couponId) .eq("status",2)).size());