Kaynağa Gözat

Merge branch 'mazq-jiekouyouhua-230523' into 'develop'

Mazq jiekouyouhua 230523

See merge request dcuc-tjdsj/auth-back!146
马志强 2 yıl önce
ebeveyn
işleme
9599f80e77

+ 53 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/auth/AuthRoleOrgController.java

@@ -0,0 +1,53 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.auth;
+
+import com.dragoninfo.dcuc.auth.auth.facade.IAuthRoleOrgRelFacade;
+import com.dragoninfo.dcuc.auth.auth.vo.roleorgauth.RoleOrgAuthSaveVo;
+import com.dragoninfo.dcuc.auth.auth.vo.roleorgauth.RoleOrgAuthVo;
+import com.dragoninfo.duceap.core.response.Result;
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * @author mazq
+ * @date 2023/6/6
+ */
+@Api(tags = "机构角色授权管理")
+@RestController
+@RequestMapping("authsvr/v2/role-org-auth")
+public class AuthRoleOrgController {
+
+    @Autowired
+    private IAuthRoleOrgRelFacade authRoleOrgRelFacade;
+
+    @ApiOperation(value = "机构角色授权分页查询")
+    @ApiImplicitParam(name = "searchable", value = "[orgId eq] [appId eq] [roleName like]")
+    @PostMapping("page")
+    public Result<List<RoleOrgAuthVo>> roleAuthPage(SearchDTO searchDTO) {
+        Page<RoleOrgAuthVo> page = authRoleOrgRelFacade.roleAuthPage(searchDTO);
+        return Result.success(page.getTotalElements(), page.getContent());
+    }
+
+    @ApiOperation(value = "机构角色授权保存")
+    @PostMapping("save")
+    public Result<Object> roleAuthSave(@Valid @RequestBody RoleOrgAuthSaveVo saveVo) {
+        ResponseStatus responseStatus = authRoleOrgRelFacade.roleAuthSave(saveVo);
+        return new Result<>(responseStatus.getStatusCode(), responseStatus.getMessage(), null, null);
+    }
+
+    @ApiOperation(value = "获取已授权的角色id")
+    @GetMapping("auth-role-ids")
+    public Result<List<String>> getAuthRoleIds(@RequestParam("orgId") String orgId) {
+        List<String> authRoleIds = authRoleOrgRelFacade.getAuthRoleIds(orgId);
+        return Result.success(authRoleIds);
+    }
+
+}

+ 0 - 49
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/statisics/ManageStatisicsController.java

@@ -1,49 +0,0 @@
-//package com.dragoninfo.dcuc.authweb.restcontroller.statisics;
-//
-//import com.dragoninfo.dcuc.auth.admin.facade.IManageInfoFacade;
-//import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
-//import com.dragonsoft.duceap.web.controller.BaseController;
-//import io.swagger.annotations.Api;
-//import io.swagger.annotations.ApiImplicitParam;
-//import io.swagger.annotations.ApiImplicitParams;
-//import io.swagger.annotations.ApiOperation;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.web.bind.annotation.GetMapping;
-//import org.springframework.web.bind.annotation.PathVariable;
-//import org.springframework.web.bind.annotation.RequestMapping;
-//import org.springframework.web.bind.annotation.RestController;
-//
-//import java.util.List;
-//import java.util.Map;
-//
-///**
-// * Created by liws on 2018/9/21.
-// */
-//@Api(tags = {"管理员统计"})
-//@RestController
-//@RequestMapping(value = "managesvr")
-//public class ManageStatisicsController extends BaseController {
-//    @Autowired
-//    private IOrgInfoFacade iOrgInfoFacade;
-//    @Autowired
-//    private IManageInfoFacade iManageInfoFacade;
-//
-//    /**
-//     * 获取管理员分布详情信息列表
-//     *
-//     * @param id
-//     * @return
-//     */
-//
-//    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true
-//            , example = "40288a8b699fc2500169a33b20540000")})
-//    @ApiOperation(value = "获取警员管理员统计列表")
-//    @GetMapping(value = "statisics/{id}")
-//    public List<Map<String, String>> getMgeSpreadDtlList(@PathVariable String id) {
-//        if (id.equals("null")) {
-//            id = "";
-//        }
-//        List<Map<String, String>> list = iManageInfoFacade.mgeSpreadDtlListForGD(id);
-//        return list;
-//    }
-//}

+ 0 - 158
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/statisics/UserStatisicsController.java

@@ -1,158 +0,0 @@
-//package com.dragoninfo.dcuc.authweb.restcontroller.statisics;
-//
-//import com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.org.OrgTreeNodeVo;
-//import com.dragoninfo.dcuc.duceap.enums.UserTypeEnum;
-//import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
-//import com.dragoninfo.dcuc.org.vo.OrgTreeNode;
-//import com.dragonsoft.duceap.commons.util.string.StringUtils;
-//import com.dragonsoft.duceap.web.controller.BaseController;
-//import io.swagger.annotations.Api;
-//import io.swagger.annotations.ApiImplicitParam;
-//import io.swagger.annotations.ApiImplicitParams;
-//import io.swagger.annotations.ApiOperation;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.web.bind.annotation.GetMapping;
-//import org.springframework.web.bind.annotation.PathVariable;
-//import org.springframework.web.bind.annotation.RequestMapping;
-//import org.springframework.web.bind.annotation.RestController;
-//
-//import java.util.ArrayList;
-//import java.util.List;
-//
-///**
-// * Created by liws on 2018/9/21.
-// */
-//@Api(tags = {"用户统计"})
-//@RestController
-//@RequestMapping(value = "usersvr")
-//public class UserStatisicsController extends BaseController {
-//    @Autowired
-//    private IUserInfoFacade iUserInfoFacade;
-//    @Autowired
-//    private IOrgInfoFacade iOrgInfoFacade;
-//
-//    /**
-//     * 完整树
-//     *
-//     * @param id 节点机构id
-//     * @return
-//     */
-//    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", name = "id", value = "机构ID", required = true
-//            , example = "40288a8b699fc2500169a33b20540000")})
-//    @ApiOperation(value = "获取完整树下各用户数量")
-//    @GetMapping(value = "statisics/{id}")
-//    public List<OrgTreeNodeVo> treeGrid(@PathVariable String id) {
-//        if (StringUtils.isEmpty(id) || id.equals("null")) {
-//            id = iOrgInfoFacade.getRootOrgId();
-//            OrgTreeNode orgTreeNode = iOrgInfoFacade.getOrgTreeNode(id);
-//            int orgCount = iOrgInfoFacade.allOrgNum();
-//            int userCount = iUserInfoFacade.allUserNum();
-//            orgTreeNode.setCount(orgCount);
-//            int policeNum = iUserInfoFacade.allUserTypeNum(UserTypeEnum.POLICE.getValue());
-//            orgTreeNode.setPoliceNum(policeNum);
-//            int helperNum = iUserInfoFacade.allUserTypeNum(UserTypeEnum.HELPER.getValue());
-//            orgTreeNode.setAuxiliaryNum(helperNum);
-//            int externalNum = iUserInfoFacade.allUserTypeNum(UserTypeEnum.EXTERNAL.getValue());
-//            orgTreeNode.setExternalNum(externalNum);
-//            orgTreeNode.setUserNum(userCount);
-//            List<OrgTreeNode> resultList = new ArrayList<OrgTreeNode>();
-//            resultList.add(orgTreeNode);
-//            List<OrgTreeNodeVo> orgTreeNodeVos = this.treeNodeToVo(resultList);
-//            return orgTreeNodeVos;
-//        } else {
-//            List<OrgTreeNode> resultList = iOrgInfoFacade.countChildOrgTreeNode(id);
-//            List<OrgTreeNodeVo> orgTreeNodeVos = this.treeNodeToVo(resultList);
-//            return orgTreeNodeVos;
-//        }
-//    }
-//
-////
-////    @RequestMapping(value = "provinces")
-////    @ResponseBody
-////    public List provinces() {
-////        Searchable searchable = Searchable.newSearchable();
-////        searchable.addSearchFilter("ranged",SearchOperator.eq,dcucWebConfig.getStatisticsRange());
-////        SearchDTO searchDTO = searchable.toSearchDTO();
-////        searchDTO.setSize("100");
-////        searchDTO.setPage("1");
-////        List<Map<String, String>> result = new ArrayList<Map<String, String>>();
-////        Page<AreaInfo> page = iOrgInfoFacade.areaMap(searchDTO);
-////        List<AreaInfo> areas = page.getContent();
-////        for (AreaInfo area : areas) {
-////            Map<String, String> countMap = null;
-////            if (dcucWebConfig.getStatisticsRange().equals(UserAreaEnum.HZ_AREA.getValue())) {
-////                String areacode = area.getCode().substring(0, 2);
-////                countMap = iUserInfoFacade.countUserByArea(areacode, false, true);
-////            } else if (dcucWebConfig.getStatisticsRange().equals(UserAreaEnum.GD_AREA.getValue())) {
-////                String areacode = area.getCode().substring(0, 4);
-////                countMap = iUserInfoFacade.countUserByArea(areacode, false, false);
-////            }
-////            countMap.put("area", area.getName());
-////            result.add(countMap);
-////        }
-////        return result;
-////    }
-////
-////    /**
-////     * 导出列表
-////     *
-////     * @param searchDTO
-////     * @param request
-////     */
-////    @RequestMapping(value = "excel")
-////    public void listExport(Searchable searchable, HttpServletRequest request, HttpServletResponse response) {
-////        try {
-////            searchable.addSearchFilter("ranged",SearchOperator.eq,dcucWebConfig.getStatisticsRange());
-////            SearchDTO searchDTO = searchable.toSearchDTO();
-////            searchDTO.setSize(searchDTO.getTotal());
-////            searchDTO.setPage("1");
-////            List<Map<String, String>> result = new ArrayList<Map<String, String>>();
-////            Page<AreaInfo> page = iOrgInfoFacade.areaMap(searchDTO);
-////            List<AreaInfo> areas = page.getContent();
-////            for (AreaInfo area : areas) {
-////                String areacode = area.getCode().substring(0, 2);
-////                Map<String, String> countMap = iUserInfoFacade.countUserByArea(areacode, true, true);
-////                countMap.put("area", area.getName());
-////                result.add(countMap);
-////            }
-////            Map<String, String> countMap = iUserInfoFacade.countUserByArea(null, true, true);
-////            countMap.put("area", "总计");
-////            result.add(countMap);
-////            exportExcel("全国治安用户建设情况", result, Searchable.toSearchable(searchDTO).getMetaData(), request, response);
-////        } catch (IOException e) {
-////            logger.error(e.getMessage(), e);
-////            throw new ApplicationException(300, "导出失败", e);
-////        }
-////    }
-//
-//
-//
-//    /**
-//     * 组装树节点
-//     *
-//     * @param nodeList
-//     * @return
-//     */
-//    private List<OrgTreeNodeVo> treeNodeToVo(List<OrgTreeNode> nodeList) {
-//        List<OrgTreeNodeVo> result = new ArrayList<>();
-//        for (OrgTreeNode orgTreeNode : nodeList) {
-//            OrgTreeNodeVo orgTreeNodeVo = new OrgTreeNodeVo();
-//            orgTreeNodeVo.setId(orgTreeNode.getValue());
-//            orgTreeNodeVo.setCode( orgTreeNode.getCode());
-//            orgTreeNodeVo.setName(orgTreeNode.getLabel());
-//            orgTreeNodeVo.setPid(orgTreeNode.getPid());
-//            orgTreeNodeVo.setOrgNum(orgTreeNode.getCount());
-//            orgTreeNodeVo.setUserNum(orgTreeNode.getUserNum());
-//            orgTreeNodeVo.setPoliceUserCount(orgTreeNode.getPoliceNum());
-//            orgTreeNodeVo.setAuxiliUserCount(orgTreeNode.getAuxiliaryNum());
-//            orgTreeNodeVo.setExtcerUserCount(orgTreeNode.getExternalNum());
-//            if (orgTreeNode.getChildIds() != null && orgTreeNode.getChildIds().size() > 0) {
-//                orgTreeNodeVo.setIsParent(true);
-//            } else {
-//                orgTreeNodeVo.setIsParent(false);
-//            }
-//            result.add(orgTreeNodeVo);
-//        }
-//        return result;
-//    }
-//}

+ 39 - 0
src/main/java/com/dragoninfo/dcuc/authweb/restcontroller/statistics/StatisticsController.java

@@ -0,0 +1,39 @@
+package com.dragoninfo.dcuc.authweb.restcontroller.statistics;
+
+import com.dragoninfo.dcuc.auth.statistics.IStatisticsFacade;
+import com.dragoninfo.dcuc.auth.statistics.ObjStatisticsVo;
+import com.dragoninfo.dcuc.auth.statistics.StatisticsReqVo;
+import com.dragoninfo.dcuc.auth.statistics.SubStatisticsVo;
+import com.dragoninfo.duceap.core.response.Result;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author mazq
+ * @date 2023/6/7
+ */
+@Api(tags = "主客体统计")
+@RestController
+@RequestMapping("/statistics/v2/")
+public class StatisticsController {
+
+    @Autowired
+    private IStatisticsFacade statisticsFacade;
+
+    @ApiOperation(value = "主体统计")
+    @PostMapping("sub-statistics")
+    public Result<SubStatisticsVo> subStatistics(@RequestBody StatisticsReqVo reqVo) {
+        SubStatisticsVo subStatisticsVo = statisticsFacade.subStatistics(reqVo);
+        return Result.success(subStatisticsVo);
+    }
+
+    @ApiOperation(value = "客体统计")
+    @PostMapping("obj-statistics")
+    public Result<ObjStatisticsVo> objStatistics(@RequestBody StatisticsReqVo reqVo) {
+        ObjStatisticsVo objStatisticsVo = statisticsFacade.objStatistics(reqVo);
+        return Result.success(objStatisticsVo);
+    }
+
+}