Commit e4f44f12 authored by sml's avatar sml

数据开发相关代码提交

parent 4fba45b1
package com.jz.common.bean; package com.jz.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**分页信息封装 /**分页信息封装
* @author ybz * @author ybz
* *
*/ */
@ApiModel(value = "分页信息", description = "分页信息封装")
public class BasePageBean { public class BasePageBean {
@ApiModelProperty(value = "当前页码")
private int pageNum = 1; private int pageNum = 1;
@ApiModelProperty(value = "每页显示记录数")
private int pageSize = 10; private int pageSize = 10;
public int getPageNum() { public int getPageNum() {
return pageNum; return pageNum;
} }
......
package com.jz.common.bean; package com.jz.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/** /**
* @author ybz * @author ybz
* *
*/ */
@ApiModel(value = "响应码封装实体", description = "响应码封装实体")
public class BaseResponse { public class BaseResponse {
//错误码 //错误码
@ApiModelProperty(value = "错误码")
private String code; private String code;
//错误消息 //错误消息
@ApiModelProperty(value = "错误消息")
private String message; private String message;
public BaseResponse() {} public BaseResponse() {}
......
...@@ -9,6 +9,7 @@ import org.springframework.security.core.userdetails.UserDetails; ...@@ -9,6 +9,7 @@ import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import com.jz.dmp.modules.model.DmpMember; import com.jz.dmp.modules.model.DmpMember;
import com.jz.dmp.modules.model.DmpPermission; import com.jz.dmp.modules.model.DmpPermission;
...@@ -55,6 +56,15 @@ public class CustomUserService implements UserDetailsService { ...@@ -55,6 +56,15 @@ public class CustomUserService implements UserDetailsService {
//设置用户在当前默认项目的资源 //设置用户在当前默认项目的资源
List<DmpPermission> memberProjPermissions = dmpPermissionService.findPermissionByRoles(memberProjectRoles); List<DmpPermission> memberProjPermissions = dmpPermissionService.findPermissionByRoles(memberProjectRoles);
user.setMemberProjectPermissionList(memberProjPermissions); user.setMemberProjectPermissionList(memberProjPermissions);
//设置用户资源
List<DmpPermission> permissions = new ArrayList<DmpPermission>();
if (!CollectionUtils.isEmpty(memberPermissions)) {
permissions.addAll(memberPermissions);
}
if (!CollectionUtils.isEmpty(memberProjPermissions)) {
permissions.addAll(memberProjPermissions);
}
user.setPermissionList(permissions);
List<GrantedAuthority> grantedAuthorities = new ArrayList<>(); List<GrantedAuthority> grantedAuthorities = new ArrayList<>();
//List<DmpPermission> permissions = permissionDao.getDmpDefaultPermission(); //List<DmpPermission> permissions = permissionDao.getDmpDefaultPermission();
......
package com.jz.dmp.modules.controller; package com.jz.dmp.modules.controller;
import com.jz.dmp.modules.service.DmpDevelopTaskService; import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.StatuConstant;
import com.jz.dmp.modules.controller.bean.DmpDevelopTaskDto;
import com.jz.dmp.modules.controller.bean.DmpDevelopTaskRequest;
import com.jz.dmp.modules.service.DmpDevelopTaskService;
import io.swagger.annotations.ApiOperation;
/** /**
* 任务开发(DmpDevelopTask)表控制层 * 任务开发(DmpDevelopTask)表控制层
* *
...@@ -19,6 +30,24 @@ public class DmpDevelopTaskController { ...@@ -19,6 +30,24 @@ public class DmpDevelopTaskController {
*/ */
@Autowired @Autowired
private DmpDevelopTaskService dmpDevelopTaskService; private DmpDevelopTaskService dmpDevelopTaskService;
/**列表查询任务开发
* @param dmpDevelopTaskRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/findListWithPage")
@ApiOperation(value = "分頁列表查询任务开发", notes = "分頁列表查询任务开发")
public PageInfoResponse<DmpDevelopTaskDto> findListWithPage(@RequestBody DmpDevelopTaskRequest dmpDevelopTaskRequest, HttpServletRequest httpRequest){
PageInfoResponse<DmpDevelopTaskDto> pageInfo = new PageInfoResponse<DmpDevelopTaskDto>();
try {
pageInfo = dmpDevelopTaskService.findListWithPage(dmpDevelopTaskRequest, httpRequest);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return pageInfo;
}
} }
\ No newline at end of file
package com.jz.dmp.modules.controller; package com.jz.dmp.modules.controller;
import com.jz.dmp.modules.model.DmpNavigationTree; import javax.servlet.http.HttpServletRequest;
import com.jz.dmp.modules.service.DmpNavigationTreeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; 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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.constant.StatuConstant;
import com.jz.dmp.modules.controller.bean.DmpNavigationTreeDto;
import com.jz.dmp.modules.controller.bean.DmpNavigationTreeRequest;
import com.jz.dmp.modules.model.DmpNavigationTree;
import com.jz.dmp.modules.service.DmpNavigationTreeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/** /**
* DMP资源导航树(DmpNavigationTree)表控制层 * DMP资源导航树(DmpNavigationTree)表控制层
...@@ -38,5 +46,46 @@ public class DmpNavigationTreeController { ...@@ -38,5 +46,46 @@ public class DmpNavigationTreeController {
public DmpNavigationTree selectOne(Integer id) { public DmpNavigationTree selectOne(Integer id) {
return this.dmpNavigationTreeService.queryById(id); return this.dmpNavigationTreeService.queryById(id);
} }
/**列表查询DMP资源导航树
* @param dmpNavigationTreeRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/findList")
@ApiOperation(value = "列表查询DMP资源导航树", notes = "列表查询DMP资源导航树")
public BaseBeanResponse<DmpNavigationTreeDto> findList(@RequestBody DmpNavigationTreeRequest dmpNavigationTreeRequest, HttpServletRequest httpRequest){
BaseBeanResponse<DmpNavigationTreeDto> baseBeanResponse = new BaseBeanResponse<DmpNavigationTreeDto>();
try {
baseBeanResponse = dmpNavigationTreeService.findList(dmpNavigationTreeRequest, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("查询失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**新增DMP资源导航树
* @param dmpNavigationTreeRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/add")
@ApiOperation(value = "新增DMP资源导航树", notes = "新增DMP资源导航树")
public BaseBeanResponse<DmpNavigationTree> add(@RequestBody DmpNavigationTree dmpNavigationTree, HttpServletRequest httpRequest){
BaseBeanResponse<DmpNavigationTree> baseBeanResponse = new BaseBeanResponse<DmpNavigationTree>();
try {
DmpNavigationTree dmpNavigationTreeDb = dmpNavigationTreeService.insert(dmpNavigationTree);
baseBeanResponse.setCode(StatuConstant.CODE_SUCCESS);
baseBeanResponse.setMessage("新增成功");
baseBeanResponse.setData(dmpNavigationTreeDb);
} catch (Exception e) {
baseBeanResponse.setMessage("新增失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
} }
\ No newline at end of file
...@@ -25,6 +25,7 @@ import com.jz.dmp.modules.service.sys.DmpPermissionService; ...@@ -25,6 +25,7 @@ import com.jz.dmp.modules.service.sys.DmpPermissionService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
/** /**
...@@ -161,12 +162,15 @@ public class DmpPermissionController { ...@@ -161,12 +162,15 @@ public class DmpPermissionController {
*/ */
@RequestMapping(method = RequestMethod.POST, value = "/findListByParentCode") @RequestMapping(method = RequestMethod.POST, value = "/findListByParentCode")
@ApiOperation(value = "获取当前用户指定资源", notes = "根据父级资源编码,获取当前登录用户所有资源") @ApiOperation(value = "获取当前用户指定资源", notes = "根据父级资源编码,获取当前登录用户所有资源")
@ApiImplicitParam(name = "parentCode", value = "父资源编码") @ApiImplicitParams({
public BaseBeanResponse<DmpPermissionDto> findListByParentCode(@RequestParam(name = "parentCode", required = true) String parentCode, HttpServletRequest httpRequest){ @ApiImplicitParam(name = "parentCode", value = "父资源编码"),
@ApiImplicitParam(name = "type", value = "请求类型:0:用户项目下资源;1:用户系统级别资源")
})
public BaseBeanResponse<DmpPermissionDto> findListByParentCode(@RequestParam(name = "parentCode", required = true) String parentCode, @RequestParam(name = "type", required = true) String type, HttpServletRequest httpRequest){
BaseBeanResponse<DmpPermissionDto> baseBeanResponse = new BaseBeanResponse<DmpPermissionDto>(); BaseBeanResponse<DmpPermissionDto> baseBeanResponse = new BaseBeanResponse<DmpPermissionDto>();
try { try {
baseBeanResponse = dmpPermissionService.findListByParentCode(parentCode, httpRequest); baseBeanResponse = dmpPermissionService.findListByParentCode(parentCode, type, httpRequest);
} catch (Exception e) { } catch (Exception e) {
baseBeanResponse.setMessage("查询失败"); baseBeanResponse.setMessage("查询失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE); baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
......
...@@ -4,6 +4,7 @@ import java.util.ArrayList; ...@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import com.jz.dmp.modules.model.DmpPermission; import com.jz.dmp.modules.model.DmpPermission;
...@@ -30,9 +31,11 @@ public class MyDmpPermissionConverter { ...@@ -30,9 +31,11 @@ public class MyDmpPermissionConverter {
public List<DmpPermissionDto> domain2dto(List<DmpPermission> dmpPermissions) { public List<DmpPermissionDto> domain2dto(List<DmpPermission> dmpPermissions) {
List<DmpPermissionDto> dmpPermissionDtos = new ArrayList<DmpPermissionDto>(); List<DmpPermissionDto> dmpPermissionDtos = new ArrayList<DmpPermissionDto>();
dmpPermissions.stream().forEach(x -> { if (!CollectionUtils.isEmpty(dmpPermissions)) {
dmpPermissionDtos.add(domain2dto(x)); dmpPermissions.stream().forEach(x -> {
}); dmpPermissionDtos.add(domain2dto(x));
});
}
return dmpPermissionDtos; return dmpPermissionDtos;
} }
...@@ -46,9 +49,12 @@ public class MyDmpPermissionConverter { ...@@ -46,9 +49,12 @@ public class MyDmpPermissionConverter {
public List<DmpPermission> dto2domain(List<DmpPermissionDto> dmpPermissionDtos) { public List<DmpPermission> dto2domain(List<DmpPermissionDto> dmpPermissionDtos) {
List<DmpPermission> dmpPermissions = new ArrayList<DmpPermission>(); List<DmpPermission> dmpPermissions = new ArrayList<DmpPermission>();
dmpPermissionDtos.stream().forEach(x -> {
dmpPermissions.add(domain2dto(x)); if (!CollectionUtils.isEmpty(dmpPermissionDtos)) {
}); dmpPermissionDtos.stream().forEach(x -> {
dmpPermissions.add(domain2dto(x));
});
}
return dmpPermissions; return dmpPermissions;
} }
......
package com.jz.dmp.modules.dao; package com.jz.dmp.modules.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.jz.dmp.modules.controller.bean.DmpDevelopTaskDto;
import com.jz.dmp.modules.controller.dataOperation.bean.DataDevTaskListDto; import com.jz.dmp.modules.controller.dataOperation.bean.DataDevTaskListDto;
import com.jz.dmp.modules.controller.dataOperation.bean.DataDevTaskListReq; import com.jz.dmp.modules.controller.dataOperation.bean.DataDevTaskListReq;
import com.jz.dmp.modules.model.DmpDevelopTask; import com.jz.dmp.modules.model.DmpDevelopTask;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface DmpDevelopTaskDao { public interface DmpDevelopTaskDao {
...@@ -34,4 +36,12 @@ public interface DmpDevelopTaskDao { ...@@ -34,4 +36,12 @@ public interface DmpDevelopTaskDao {
* @since 2021-01-13 * @since 2021-01-13
*/ */
List<DataDevTaskListDto> queryDevTaskListPage(DataDevTaskListReq req) throws Exception; List<DataDevTaskListDto> queryDevTaskListPage(DataDevTaskListReq req) throws Exception;
/**条件查询任务开发
* @param param
* @return
* @throws Exception
*/
public List<DmpDevelopTask> findList(Map<String, Object> param)throws Exception;
} }
...@@ -127,6 +127,9 @@ public class DmpMember implements UserDetails{ ...@@ -127,6 +127,9 @@ public class DmpMember implements UserDetails{
@ApiModelProperty(value = "用户当前项目资源") @ApiModelProperty(value = "用户当前项目资源")
private List<DmpPermission> memberProjectPermissionList; private List<DmpPermission> memberProjectPermissionList;
@ApiModelProperty(value = "用户资源")
private List<DmpPermission> permissionList;
@ApiModelProperty(value = "权限") @ApiModelProperty(value = "权限")
private List<? extends GrantedAuthority> authorities; private List<? extends GrantedAuthority> authorities;
...@@ -290,6 +293,14 @@ public class DmpMember implements UserDetails{ ...@@ -290,6 +293,14 @@ public class DmpMember implements UserDetails{
this.memberProjectPermissionList = memberProjectPermissionList; this.memberProjectPermissionList = memberProjectPermissionList;
} }
public List<DmpPermission> getPermissionList() {
return permissionList;
}
public void setPermissionList(List<DmpPermission> permissionList) {
this.permissionList = permissionList;
}
public void setAuthorities(List<? extends GrantedAuthority> authorities) { public void setAuthorities(List<? extends GrantedAuthority> authorities) {
this.authorities = authorities; this.authorities = authorities;
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<!-- 封装用户项目角色信息 --> <!-- 封装用户项目角色信息 -->
<select id="getRoleNamesByUserid" resultType="java.lang.String"> <select id="getRoleNamesByUserid" resultType="java.lang.String">
select role.role_name select DISTINCT role.role_name
from dmp_member_project_role mprole left join dmp_role role on mprole.role_id = role.role_id from dmp_member_project_role mprole left join dmp_role role on mprole.role_id = role.role_id
where mprole.user_id=#{userId,jdbcType=INTEGER} where mprole.user_id=#{userId,jdbcType=INTEGER}
</select> </select>
......
...@@ -301,7 +301,7 @@ ...@@ -301,7 +301,7 @@
<!-- 项目角色用户人数统计 --> <!-- 项目角色用户人数统计 -->
<select id="projRoleStat" resultType="map"> <select id="projRoleStat" resultType="map">
select select
role.role_code AS roleCode,role.role_name AS roleName,COUNT(1) AS statCount role.role_code AS roleCode,role.role_name AS roleName,COUNT(DISTINCT member.user_id) AS statCount
from dmp_member_project_role mprole from dmp_member_project_role mprole
left join dmp_role role on mprole.role_id=role.role_id left join dmp_role role on mprole.role_id=role.role_id
left join dmp_member member on mprole.user_id=member.user_id left join dmp_member member on mprole.user_id=member.user_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment