|
@@ -1,10 +1,22 @@
|
|
|
package com.kxs.system.biz.controller.kxsapp;
|
|
package com.kxs.system.biz.controller.kxsapp;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.kxs.common.core.constant.CacheConstants;
|
|
import com.kxs.common.core.constant.CacheConstants;
|
|
|
|
|
+import com.kxs.common.core.constant.CommonConstants;
|
|
|
|
|
+import com.kxs.common.core.constant.SecurityConstants;
|
|
|
|
|
+import com.kxs.common.core.constant.enums.ErrorTypeEnum;
|
|
|
|
|
+import com.kxs.common.core.exception.GlobalCustomerException;
|
|
|
import com.kxs.common.core.util.R;
|
|
import com.kxs.common.core.util.R;
|
|
|
|
|
+import com.kxs.common.core.util.RetOps;
|
|
|
|
|
+import com.kxs.common.security.util.SecurityUtils;
|
|
|
|
|
+import com.kxs.system.api.model.KxsAppModal;
|
|
|
import com.kxs.system.api.model.KxsBanner;
|
|
import com.kxs.system.api.model.KxsBanner;
|
|
|
import com.kxs.system.api.vo.kxsapp.banner.BannerListVO;
|
|
import com.kxs.system.api.vo.kxsapp.banner.BannerListVO;
|
|
|
|
|
+import com.kxs.system.biz.service.KxsAppModalService;
|
|
|
import com.kxs.system.biz.service.KxsBannerService;
|
|
import com.kxs.system.biz.service.KxsBannerService;
|
|
|
|
|
+import com.kxs.user.api.feign.RemoteKxsUserService;
|
|
|
|
|
+import com.kxs.user.api.model.KxsUser;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -12,7 +24,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 首页(Banner)控制层
|
|
* 首页(Banner)控制层
|
|
@@ -30,6 +44,10 @@ public class BannerController {
|
|
|
*/
|
|
*/
|
|
|
private final KxsBannerService kxsBannerService;
|
|
private final KxsBannerService kxsBannerService;
|
|
|
|
|
|
|
|
|
|
+ private final KxsAppModalService kxsAppModalService;
|
|
|
|
|
+
|
|
|
|
|
+ private final RemoteKxsUserService remoteKxsUserService;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 首页-广告管理
|
|
* 首页-广告管理
|
|
|
*
|
|
*
|
|
@@ -53,5 +71,41 @@ public class BannerController {
|
|
|
return R.ok(kxsBannerService.getById(id));
|
|
return R.ok(kxsBannerService.getById(id));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @GetMapping("/appModal")
|
|
|
|
|
+ public R appModal() {
|
|
|
|
|
+
|
|
|
|
|
+ Long userId = SecurityUtils.getUser().getId();
|
|
|
|
|
+ R<KxsUser> kxsUserR = remoteKxsUserService.loadUserById(userId, SecurityConstants.FROM_IN);
|
|
|
|
|
+ KxsUser user = RetOps.of(kxsUserR)
|
|
|
|
|
+ .getData()
|
|
|
|
|
+ .orElseThrow(() -> new GlobalCustomerException(ErrorTypeEnum.USER_NOT_FOUND.getDescription()));
|
|
|
|
|
+
|
|
|
|
|
+ List<KxsAppModal> list = kxsAppModalService.list(Wrappers.<KxsAppModal>lambdaQuery()
|
|
|
|
|
+ .eq(KxsAppModal::getStatus, CommonConstants.SUCCESS));
|
|
|
|
|
+
|
|
|
|
|
+ List<KxsAppModal> appModals = list.stream().filter(item -> {
|
|
|
|
|
+ if (Objects.equals(item.getIsAssign(), CommonConstants.SUCCESS)) {
|
|
|
|
|
+ String userCodes = item.getUserCodes();
|
|
|
|
|
+ if(StrUtil.isBlank(userCodes)){
|
|
|
|
|
+ return Boolean.TRUE;
|
|
|
|
|
+ }
|
|
|
|
|
+ String[] split = userCodes.split(StrUtil.COMMA);
|
|
|
|
|
+ //如果未包含删除该条数据
|
|
|
|
|
+ return Arrays.asList(split).contains(user.getUserCode());
|
|
|
|
|
+ }
|
|
|
|
|
+ return Boolean.TRUE;
|
|
|
|
|
+ }).toList();
|
|
|
|
|
+
|
|
|
|
|
+ return R.ok(appModals);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|