zouxuan 2 years ago
parent
commit
8c211426ec

+ 6 - 2
cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsInformationServiceImpl.java

@@ -89,8 +89,12 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
 		if(!CollectionUtils.isEmpty(app.getRows()) && user != null && user.getId() != null){
 			for (SysNewsInformation row : app.getRows()) {
 				if(row.getTitle().equals("进阶课堂")){
-					//当前学员是否有可购买vip课
-					webFeignService.queryVipPracticeGroups(StudentVipGroupQueryInfo queryInfo);
+					try {
+						//当前学员是否有可购买vip课
+						row.setRedDot(webFeignService.queryVipPracticeGroups());
+					}catch (Exception e){
+						e.printStackTrace();
+					}
 				}
 			}
 		}

+ 9 - 0
mec-client-api/src/main/java/com/ym/mec/web/WebFeignService.java

@@ -1,11 +1,17 @@
 package com.ym.mec.web;
 
 import com.ym.mec.common.config.FeignConfiguration;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.web.fallback.WebFeignServiceFallback;
 import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import java.util.List;
+
 @FeignClient(name = "web-server", contextId = "WebFeignService", configuration = FeignConfiguration.class, fallback = WebFeignServiceFallback.class)
 public interface WebFeignService {
 
@@ -26,4 +32,7 @@ public interface WebFeignService {
 
 	@RequestMapping(value = "api/getTenantConfigValue")
 	String getTenantConfigValue(@RequestParam("tenantId") Integer tenantId, @RequestParam("paramName") String paramName);
+
+	@PostMapping(value = "api/queryVipPracticeGroups")
+    Boolean queryVipPracticeGroups();
 }

+ 9 - 0
mec-client-api/src/main/java/com/ym/mec/web/fallback/WebFeignServiceFallback.java

@@ -1,10 +1,14 @@
 package com.ym.mec.web.fallback;
 
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.page.QueryInfo;
 import org.springframework.stereotype.Component;
 
 import com.ym.mec.web.WebFeignService;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import java.util.List;
+
 @Component
 public class WebFeignServiceFallback implements WebFeignService {
 
@@ -37,4 +41,9 @@ public class WebFeignServiceFallback implements WebFeignService {
 	public String getTenantConfigValue(Integer tenantId,String paramName){
 		return null;
 	}
+
+	@Override
+	public Boolean queryVipPracticeGroups() {
+		return null;
+	}
 }

+ 24 - 4
mec-web/src/main/java/com/ym/mec/web/controller/APIController.java

@@ -1,11 +1,17 @@
 package com.ym.mec.web.controller;
 
-import com.ym.mec.biz.service.SysTenantConfigService;
+import com.ym.mec.biz.dal.dto.StudentVipGroupShowListDto;
+import com.ym.mec.biz.dal.page.StudentVipGroupQueryInfo;
+import com.ym.mec.biz.service.*;
+import com.ym.mec.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
 
+import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -17,11 +23,10 @@ import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.SysUserCashAccount;
 import com.ym.mec.biz.dal.entity.Teacher;
-import com.ym.mec.biz.service.ImGroupService;
-import com.ym.mec.biz.service.PracticeGroupService;
-import com.ym.mec.biz.service.PracticeLessonApplyService;
 import com.ym.mec.common.controller.BaseController;
 
+import java.util.List;
+
 @RequestMapping("api")
 @Api(tags = "对外接口")
 @RestController
@@ -43,6 +48,10 @@ public class APIController extends BaseController {
 	private SysUserFeignService sysUserFeignService;
 	@Autowired
 	private SysTenantConfigService sysTenantConfigService;
+	@Autowired
+	private SysUserService sysUserService;
+	@Autowired
+	private VipGroupService vipGroupService;
 
 	@GetMapping("/createCashAccount")
 	public Boolean createCashAccount(Integer userId,Integer tenantId) {
@@ -103,4 +112,15 @@ public class APIController extends BaseController {
 		return null;
 	}
 
+	@ApiOperation(value = "获取可购买vip、网管课列表")
+	@RequestMapping(value = "/queryVipPracticeGroups")
+	public Boolean queryVipPracticeGroups(){
+		SysUser sysUser = sysUserService.getUser();
+		StudentVipGroupQueryInfo queryInfo = new StudentVipGroupQueryInfo();
+		queryInfo.setOrganId(sysUser.getOrganId());
+		queryInfo.setUserId(sysUser.getId());
+		List<StudentVipGroupShowListDto> listDtos = vipGroupService.queryVipPracticeGroups(queryInfo);
+		return CollectionUtils.isEmpty(listDtos)?false:true;
+	}
+
 }