通过应用ID查询授权的课程

beetlsql3-dev
Mlxa0324
parent 09a65c7b02
commit 33fa7e63b1

@ -100,9 +100,8 @@ public class InterceptorConfig implements WebMvcConfigurer, InitializingBean {
"/plugins/**",
"/filesystem/**",
"/wx/**",
// 资金账户列表和修改操作子系统调用鉴权在接口中拿到的token来鉴权。
"/api/studentAccountAssetAllocation/getByApplicationToken.do",
"/api/studentAccountAssetAllocation/updateByApplicationToken.do",
// 对外暴露的接口,全部放开
"/**/externalApi/**",
"/wx"
// "/upload/**"
).order(1);

@ -32,6 +32,7 @@ import org.apache.poi.xwpf.usermodel.*;
import org.beetl.sql.core.SqlId;
import org.beetl.sql.core.engine.PageQuery;
import org.beetl.sql.core.query.LambdaQuery;
import org.beetl.sql.core.query.interfacer.StrongValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Lazy;
@ -54,6 +55,7 @@ import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUserId;
import static java.lang.Math.min;
import static java.math.BigDecimal.ROUND_HALF_UP;
import static java.math.BigDecimal.ZERO;
import static java.util.Collections.emptyList;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.joining;
@ -1473,4 +1475,19 @@ public class CourseInfoService extends CoreBaseService<CourseInfo>{
public PageQuery<CourseInfo> examCourseQuestionDO(PageQuery<CourseInfoQuery> pageQuery) {
return courseInfoDao.examCourseQuestionDO(pageQuery);
}
/**
*
* @return
*/
public List<CourseInfo> getByIds(String courseInfoIds) {
if (StrUtil.isBlank(courseInfoIds)) {
return emptyList();
}
return courseInfoDao.createLambdaQuery()
.andIn(CourseInfo::getCourseInfoId, Arrays.asList(courseInfoIds.split(",")))
.andEq(CourseInfo::getCourseInfoStatus, 1).select();
}
}

@ -12,9 +12,8 @@ import com.ibeetl.admin.core.util.PlatformException;
import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.admin.core.web.JsonReturnCode;
import com.ibeetl.jlw.dao.StudentAccountAssetAllocationDao;
import com.ibeetl.jlw.entity.LoginTodo;
import com.ibeetl.jlw.entity.ResourcesApplication;
import com.ibeetl.jlw.entity.StudentAccountAssetAllocation;
import com.ibeetl.jlw.entity.*;
import com.ibeetl.jlw.web.query.ResourcesApplicationCourseQuery;
import com.ibeetl.jlw.web.query.StudentAccountAssetAllocationQuery;
import org.apache.commons.lang3.StringUtils;
import org.beetl.sql.core.SqlId;
@ -32,6 +31,8 @@ import java.util.ArrayList;
import java.util.List;
import static cn.hutool.core.collection.IterUtil.getFirst;
import static com.ibeetl.admin.core.util.StreamUtils.listJoin;
import static java.util.Collections.emptyList;
/**
* Service
@ -46,6 +47,10 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
@Autowired private StudentAccountAssetAllocationDao studentAccountAssetAllocationDao;
@Autowired private LoginTodoService loginTodoService;
@Autowired private ResourcesApplicationService resourcesApplicationService;
@Autowired
private ResourcesApplicationCourseService resourcesApplicationCourseService;
@Autowired
private CourseInfoService courseInfoService;
public PageQuery<StudentAccountAssetAllocation>queryByCondition(PageQuery query){
PageQuery ret = studentAccountAssetAllocationDao.queryByCondition(query);
@ -310,4 +315,30 @@ public class StudentAccountAssetAllocationService extends CoreBaseService<Studen
updateTemplate(updatePO);
}
/**
* : <br>
* token
*
* @param applicationToken token
* @return {@link List< CourseInfo>}
* @Author: lx
* @Date: 2023/3/22 21:24
*/
public List<CourseInfo> getApplicationBindCourseInfo(String applicationToken) {
LoginTodo loginTodo = validateAndGetLoginTodo(applicationToken);
String applicationId = loginTodo.getApplicationId();
if (StrUtil.isBlank(applicationId)) {
return emptyList();
}
ResourcesApplicationCourseQuery query = new ResourcesApplicationCourseQuery();
query.setResourcesApplicationId(Long.valueOf(applicationId));
List<ResourcesApplicationCourse> list = resourcesApplicationCourseService.getValuesByQueryNotWithPermission(query);
String courseInfoIds = listJoin(list, ResourcesApplicationCourse::getCourseInfoId);
return courseInfoService.getByIds(courseInfoIds);
}
}

@ -7,6 +7,7 @@ import com.ibeetl.admin.core.annotation.Function;
import com.ibeetl.admin.core.entity.CoreUser;
import com.ibeetl.admin.core.file.FileService;
import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.jlw.entity.CourseInfo;
import com.ibeetl.jlw.entity.StudentAccountAssetAllocation;
import com.ibeetl.jlw.service.StudentAccountAssetAllocationService;
import com.ibeetl.jlw.web.query.StudentAccountAssetAllocationQuery;
@ -84,7 +85,7 @@ public class StudentAccountAssetAllocationController{
* @param param
* @return
*/
@PostMapping(API + "/updateByApplicationToken.do")
@PostMapping(API + "/externalApi/updateByApplicationToken.do")
@ResponseBody
public JsonResult updateByApplicationToken(@RequestParam("applicationToken") String applicationToken,
@RequestBody StudentAccountAssetAllocationQuery param) {
@ -92,7 +93,6 @@ public class StudentAccountAssetAllocationController{
return JsonResult.success();
}
/**
*
* token
@ -100,13 +100,25 @@ public class StudentAccountAssetAllocationController{
* @param param
* @return
*/
@PostMapping(API + "/getByApplicationToken.do")
@PostMapping(API + "/externalApi/getByApplicationToken.do")
@ResponseBody
public JsonResult<List<StudentAccountAssetAllocation>> getByApplicationToken(@RequestParam("applicationToken") String applicationToken,
@RequestBody StudentAccountAssetAllocationQuery param) {
return JsonResult.success(studentAccountAssetAllocationService.getByApplicationToken(applicationToken, param));
}
/**
*
* token
* @param applicationToken token
* @return
*/
@PostMapping(API + "/externalApi/getApplicationBindCourseInfo.do")
@ResponseBody
public JsonResult<List<CourseInfo>> getApplicationBindCourseInfo(@RequestParam("applicationToken") String applicationToken) {
return JsonResult.success(studentAccountAssetAllocationService.getApplicationBindCourseInfo(applicationToken));
}
/* 后台页面 */

Loading…
Cancel
Save