|
@@ -11,10 +11,13 @@ import com.ym.mec.biz.service.IndexBaseMonthDataService;
|
|
|
import com.ym.mec.biz.service.OrganizationService;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.tenant.TenantContextHolder;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.redisson.api.RBucket;
|
|
|
+import org.redisson.api.RedissonClient;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.ui.ModelMap;
|
|
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Api(tags = "首页")
|
|
@@ -51,6 +55,8 @@ public class IndexController extends BaseController {
|
|
|
private StudentPaymentOrderDao studentPaymentOrderDao;
|
|
|
@Autowired
|
|
|
private IndexBaseMonthDataService indexService;
|
|
|
+ @Autowired
|
|
|
+ private RedissonClient redissonClient;
|
|
|
|
|
|
@ApiOperation(value = "获取首页数据")
|
|
|
@GetMapping("/index")
|
|
@@ -106,7 +112,18 @@ public class IndexController extends BaseController {
|
|
|
|
|
|
@GetMapping("/hasIndexErrData")
|
|
|
public HttpResponseResult hasIndexErrData(String organId){
|
|
|
- return succeed(indexService.hasIndexErrData(organizationService.getEmployeeOrgan(organId)));
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("用户信息获取失败");
|
|
|
+ }
|
|
|
+ RBucket<Map<String, Boolean>> bucket = redissonClient.getBucket(sysUser.getId() + ":hasIndexErrData");
|
|
|
+ Map<String, Boolean> map = bucket.get();
|
|
|
+ if(map == null || map.size() == 0){
|
|
|
+ organId = organizationService.getEmployeeOrgan(sysUser.getId(),organId,sysUser.getIsSuperAdmin());
|
|
|
+ map = indexService.hasIndexErrData(organId);
|
|
|
+ bucket.set(map,10, TimeUnit.MINUTES);
|
|
|
+ }
|
|
|
+ return succeed(map);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/getIndexErrData")
|