Browse Source

查询项目详情

master
zhizhi wu 4 years ago
parent
commit
41bb19f2af
  1. 9
      src/main/java/com/ccsens/yanyuan/api/tall/ProjectController.java
  2. 3
      src/main/java/com/ccsens/yanyuan/api/tall/RoleController.java
  3. 3
      src/main/java/com/ccsens/yanyuan/api/tall/TaskController.java
  4. 13
      src/main/java/com/ccsens/yanyuan/service/IYRoleService.java
  5. 44
      src/main/java/com/ccsens/yanyuan/service/RoleService.java
  6. 2
      src/main/java/com/ccsens/yanyuan/util/YanYuanConstant.java

9
src/main/java/com/ccsens/yanyuan/api/tall/ProjectController.java

@ -6,6 +6,7 @@ import com.ccsens.util.JsonResponse;
import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.yanyuan.bean.dto.ProjectDto;
import com.ccsens.yanyuan.bean.vo.ProjectVo;
import com.ccsens.yanyuan.service.IYRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -28,13 +29,15 @@ import javax.annotation.Resource;
public class ProjectController {
@Resource
private IProjectService projectService;
private IYRoleService yRoleService;
@ApiOperation(value = "根据id查询项目信息", notes = "根据id查询项目信息")
@RequestMapping(value = "/findProjectById", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<ProjectVo.ProjectInformation> findProjectById(@ApiParam @Validated @RequestBody QueryDto<ProjectDto.ProjectById> params) throws Exception{
CProjectVo.ProjectInfo projectById = projectService.findProjectById(params.getParam(), params.getUserId());
return JsonResponse.newInstance().ok(projectById);
log.info("根据id查询项目信息:{}", params);
ProjectVo.ProjectInformation info = yRoleService.findProjectById(params.getParam(), params.getUserId());
log.info("根据id查询项目信息结果:{}", info);
return JsonResponse.newInstance().ok(info);
}
// @ApiOperation(value = "查询子项目", notes = "查询子项目")

3
src/main/java/com/ccsens/yanyuan/api/tall/RoleController.java

@ -39,8 +39,9 @@ public class RoleController {
@ApiOperation(value = "根据项目id查找角色", notes = "")
@RequestMapping(value = "/show", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<RoleVo.QueryRole> queryByProjectId(@ApiParam @Validated @RequestBody QueryDto<RoleDto.QueryRoleById> params) {
// CRoleVo.QueryRole queryRole = roleService.queryShowRole(params.getParam(), params.getUserId());
log.info("根据项目id查找角色:{}", params);
CRoleVo.QueryRole queryRole = yRoleService.queryShowRole(params.getParam(), params.getUserId());
log.info("查询角色结果:{}", queryRole);
return JsonResponse.newInstance().ok(queryRole);
}

3
src/main/java/com/ccsens/yanyuan/api/tall/TaskController.java

@ -54,8 +54,9 @@ public class TaskController {
@ApiOperation(value = "查找定期任务", notes = "")
@RequestMapping(value = "/regular", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<TaskVo.QueryTask>> queryRegularTask(@ApiParam @Validated @RequestBody QueryDto<TaskDto.QueryRegularTask> params) {
// List<CTaskVo.QueryTask> queryTasks = taskService.queryRegularTask(params.getParam(), params.getUserId());
log.info("查找定期任务:{}", params);
List<TaskVo.QueryTask> queryTasks = yTaskService.queryRegularTask(params.getParam(), params.getUserId());
log.info("查找定期任务结束:{}", queryTasks);
return JsonResponse.newInstance().ok(queryTasks);
}

13
src/main/java/com/ccsens/yanyuan/service/IYRoleService.java

@ -1,8 +1,13 @@
package com.ccsens.yanyuan.service;
import com.ccsens.common.bean.vo.CRoleVo;
import com.ccsens.yanyuan.bean.dto.ProjectDto;
import com.ccsens.yanyuan.bean.dto.RoleDto;
import com.ccsens.yanyuan.bean.vo.ProjectVo;
/**
* @author whj
*/
public interface IYRoleService {
/**
* 燕园查询角色列表
@ -11,4 +16,12 @@ public interface IYRoleService {
* @return 角色列表
*/
CRoleVo.QueryRole queryShowRole(RoleDto.QueryRoleById param, Long userId);
/**
* 根据项目ID查询项目信息
* @param param 项目ID和模板
* @param userId 用户ID
* @return 项目信息
*/
ProjectVo.ProjectInformation findProjectById(ProjectDto.ProjectById param, Long userId);
}

44
src/main/java/com/ccsens/yanyuan/service/RoleService.java

@ -2,8 +2,13 @@ package com.ccsens.yanyuan.service;
import com.ccsens.common.bean.dto.CRoleDto;
import com.ccsens.common.bean.vo.CRoleVo;
import com.ccsens.util.PropUtil;
import com.ccsens.yanyuan.bean.dto.ProjectDto;
import com.ccsens.yanyuan.bean.dto.RoleDto;
import com.ccsens.yanyuan.bean.vo.ProjectVo;
import com.ccsens.yanyuan.bean.vo.RoleVo;
import com.ccsens.yanyuan.bean.vo.ToolVo;
import com.ccsens.yanyuan.persist.dao.TraineeDao;
import com.ccsens.yanyuan.persist.dao.UserRelationDao;
import com.ccsens.yanyuan.util.YanYuanConstant;
import lombok.extern.slf4j.Slf4j;
@ -21,6 +26,8 @@ import java.util.List;
public class RoleService implements IYRoleService {
@Resource
private UserRelationDao userRelationDao;
@Resource
private TraineeDao traineeDao;
@Override
public RoleVo.QueryRole queryShowRole(RoleDto.QueryRoleById param, Long userId) {
@ -31,7 +38,42 @@ public class RoleService implements IYRoleService {
return new RoleVo.QueryRole();
}
@Override
public ProjectVo.ProjectInformation findProjectById(ProjectDto.ProjectById param, Long userId) {
switch (param.getTemplateCode()) {
case YanYuanConstant.Project.TEMPLATE_USER: return getUserProject(param.getProjectId(), userId);
}
return new ProjectVo.ProjectInformation();
}
/**
* 查询项目信息
* @param projectId
* @param userId
* @return
*/
private ProjectVo.ProjectInformation getUserProject(Long projectId, Long userId) {
ToolVo.UserInfoSimple simple = traineeDao.getSimpleByKeyId(projectId);
if (simple == null) {
return null;
}
ProjectVo.ProjectInformation information = new ProjectVo.ProjectInformation();
information.setId(simple.getKeyUserId());
information.setName( simple.getUserName() + "智能训练");
information.setUrl(PropUtil.domain);
return information;
}
/**
* 查询项目角色
* @param projectId 项目ID
* @param userId 用户ID
* @return 角色
*/
private RoleVo.QueryRole getUserRole(Long projectId, Long userId) {
log.info("查询用户角色:{},{}", projectId, userId);
RoleVo.QueryRole queryRole = new RoleVo.QueryRole();
List<CRoleVo.RoleInfo> visibleList = new ArrayList<>();
List<CRoleVo.RoleInfo> invisibleList = new ArrayList<>();
@ -42,10 +84,12 @@ public class RoleService implements IYRoleService {
BeanUtils.copyProperties(YanYuanConstant.YanYuanRole.Setting, setting);
// 查询待审核的用户信息
int num = userRelationDao.getWaitAuditNum(projectId, userId);
log.info("待审核用户信息:{}", num);
setting.setRemindNum(num);
visibleList.add(setting);
queryRole.setVisibleList(visibleList);
queryRole.setInvisibleList(invisibleList);
log.info("角色:{}", queryRole);
return queryRole;
}

2
src/main/java/com/ccsens/yanyuan/util/YanYuanConstant.java

@ -191,7 +191,7 @@ public class YanYuanConstant {
public static final class ModBus {
public final static byte[] START = {(byte) 0XFF, (byte) 0XFE};
public final static byte WRITE_MORE = 0X10;
public final static byte[] AUDIO_ADDR = {(byte)00, (byte) 03};
public final static byte[] AUDIO_ADDR = {(byte)00, (byte) 04};
public final static byte TALKING_PEN_ADDR = 0x01;
}

Loading…
Cancel
Save