From 41bb19f2af5d32cffb8b177fed8bbbf76a3def75 Mon Sep 17 00:00:00 2001 From: zhizhi wu <2377881365@qq.com> Date: Thu, 23 Dec 2021 17:18:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=A1=B9=E7=9B=AE=E8=AF=A6?= =?UTF-8?q?=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yanyuan/api/tall/ProjectController.java | 9 ++-- .../yanyuan/api/tall/RoleController.java | 3 +- .../yanyuan/api/tall/TaskController.java | 3 +- .../ccsens/yanyuan/service/IYRoleService.java | 13 ++++++ .../ccsens/yanyuan/service/RoleService.java | 44 +++++++++++++++++++ .../ccsens/yanyuan/util/YanYuanConstant.java | 2 +- 6 files changed, 68 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/ccsens/yanyuan/api/tall/ProjectController.java b/src/main/java/com/ccsens/yanyuan/api/tall/ProjectController.java index 774eb82..5a99701 100644 --- a/src/main/java/com/ccsens/yanyuan/api/tall/ProjectController.java +++ b/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 findProjectById(@ApiParam @Validated @RequestBody QueryDto 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 = "查询子项目") diff --git a/src/main/java/com/ccsens/yanyuan/api/tall/RoleController.java b/src/main/java/com/ccsens/yanyuan/api/tall/RoleController.java index a07c8e1..6db6d42 100644 --- a/src/main/java/com/ccsens/yanyuan/api/tall/RoleController.java +++ b/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 queryByProjectId(@ApiParam @Validated @RequestBody QueryDto 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); } diff --git a/src/main/java/com/ccsens/yanyuan/api/tall/TaskController.java b/src/main/java/com/ccsens/yanyuan/api/tall/TaskController.java index fb26e98..8108e1f 100644 --- a/src/main/java/com/ccsens/yanyuan/api/tall/TaskController.java +++ b/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> queryRegularTask(@ApiParam @Validated @RequestBody QueryDto params) { -// List queryTasks = taskService.queryRegularTask(params.getParam(), params.getUserId()); + log.info("查找定期任务:{}", params); List queryTasks = yTaskService.queryRegularTask(params.getParam(), params.getUserId()); + log.info("查找定期任务结束:{}", queryTasks); return JsonResponse.newInstance().ok(queryTasks); } diff --git a/src/main/java/com/ccsens/yanyuan/service/IYRoleService.java b/src/main/java/com/ccsens/yanyuan/service/IYRoleService.java index f8bdb57..0460170 100644 --- a/src/main/java/com/ccsens/yanyuan/service/IYRoleService.java +++ b/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); } diff --git a/src/main/java/com/ccsens/yanyuan/service/RoleService.java b/src/main/java/com/ccsens/yanyuan/service/RoleService.java index 9f55e65..ca86c28 100644 --- a/src/main/java/com/ccsens/yanyuan/service/RoleService.java +++ b/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 visibleList = new ArrayList<>(); List 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; } diff --git a/src/main/java/com/ccsens/yanyuan/util/YanYuanConstant.java b/src/main/java/com/ccsens/yanyuan/util/YanYuanConstant.java index eda7d2b..67f551d 100644 --- a/src/main/java/com/ccsens/yanyuan/util/YanYuanConstant.java +++ b/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; }