From a4500ca2bb49a4f35217d7ac1e121cc9029063ec Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 23 Jun 2022 09:25:29 +0800 Subject: [PATCH 01/26] =?UTF-8?q?=E8=A5=BF=E6=B5=B7=E5=B2=B8=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResourceServiceImpl.java | 248 ++++++++++-------- 1 file changed, 139 insertions(+), 109 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 16689f53..369c51b9 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -145,8 +145,7 @@ public class ResourceServiceImpl extends CrudServiceImpl wrapper = new QueryWrapper<>(); - wrapper.eq("data_resource_id", id) - .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()); + wrapper.eq("data_resource_id", id).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()); List attrEntities = attrDao.selectList(wrapper); resourceDTO.setInfoList(attrEntities == null ? new ArrayList<>() : attrEntities); // npe? return resourceDTO; @@ -257,88 +255,84 @@ public class ResourceServiceImpl extends CrudServiceImpl { // 云脑专网 - OkHttpClient client = new OkHttpClient(); - String url = String.format(tsingtao_xhaProperties.getCloudcam(), resourceDTO.getName(), pageNum, pageSize); - logger.info(url); - Request request = new Request.Builder().url(url).build(); - try (Response response = client.newCall(request).execute()) { - if (response.isSuccessful()) { - JSONObject jsonObject_ = JSON.parseObject(response.body().string()); - if (jsonObject_.containsKey("data")) { - if (jsonObject_.getJSONObject("data").containsKey("list")) { - resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total")); - resultPage.setRecords(jsonObject_.getJSONObject("data").getJSONArray("list").stream().map(index -> (JSONObject) JSON.toJSON(index)) - .map(index -> { - ResourceDTO resourceDTO1 = new ResourceDTO(); - resourceDTO1.setId(Long.valueOf(index.getString("id"))); - resourceDTO1.setDelFlag(index.getIntValue("delFlag")); - resourceDTO1.setLink(index.getString("cameraIndexCode")); - resourceDTO1.setName(index.getString("name")); - resourceDTO1.setType("基础设施"); - try { - resourceDTO1.setCreateDate(sdf.parse(index.getString("createdTime"))); - } catch (ParseException e) { - logger.error("时间异常"); - resourceDTO1.setCreateDate(new Date()); - } - return resourceDTO1; - }).collect(Collectors.toList())); - } else { - resultPage.setRecords(null); - resultPage.setTotal(0); + CompletableFuture cloud = CompletableFuture.runAsync(() -> { // 云脑专网 + OkHttpClient client = new OkHttpClient(); + String url = String.format(tsingtao_xhaProperties.getCloudcam(), resourceDTO.getName(), pageNum, pageSize); + logger.info(url); + Request request = new Request.Builder().url(url).build(); + try (Response response = client.newCall(request).execute()) { + if (response.isSuccessful()) { + JSONObject jsonObject_ = JSON.parseObject(response.body().string()); + if (jsonObject_.containsKey("data")) { + if (jsonObject_.getJSONObject("data").containsKey("list")) { + resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total")); + resultPage.setRecords(jsonObject_.getJSONObject("data").getJSONArray("list").stream().map(index -> (JSONObject) JSON.toJSON(index)).map(index -> { + ResourceDTO resourceDTO1 = new ResourceDTO(); + resourceDTO1.setId(Long.valueOf(index.getString("id"))); + resourceDTO1.setDelFlag(index.getIntValue("delFlag")); + resourceDTO1.setLink(index.getString("cameraIndexCode")); + resourceDTO1.setName(index.getString("name")); + resourceDTO1.setType("基础设施"); + try { + resourceDTO1.setCreateDate(sdf.parse(index.getString("createdTime"))); + } catch (ParseException e) { + logger.error("时间异常"); + resourceDTO1.setCreateDate(new Date()); } - - } + return resourceDTO1; + }).collect(Collectors.toList())); } else { - logger.error("获取失败"); + resultPage.setRecords(null); + resultPage.setTotal(0); } - } catch (Exception exception) { - logger.error("失败", exception); + } - }); - CompletableFuture local = - CompletableFuture.runAsync(() -> { // 金宏网 - OkHttpClient client = new OkHttpClient(); - String url = String.format(tsingtao_xhaProperties.getLocalcam(), resourceDTO.getName(), pageNum, pageSize); - logger.info(url); - Request request = new Request.Builder().url(url).build(); - try (Response response = client.newCall(request).execute()) { - if (response.isSuccessful()) { - JSONObject jsonObject_ = JSON.parseObject(response.body().string()); - if (jsonObject_.containsKey("data")) { - if (jsonObject_.getJSONObject("data").containsKey("list")) { - resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total")); - resultPage.setRecords(jsonObject_.getJSONObject("data").getJSONArray("list").stream().map(index -> (JSONObject) JSON.toJSON(index)) - .map(index -> { - ResourceDTO resourceDTO1 = new ResourceDTO(); - resourceDTO1.setId(Long.valueOf(index.getString("id"))); - resourceDTO1.setDelFlag(index.getIntValue("delFlag")); - resourceDTO1.setLink(index.getString("cameraIndexCode")); - resourceDTO1.setName(index.getString("name")); - resourceDTO1.setType("基础设施"); - try { - resourceDTO1.setCreateDate(sdf.parse(index.getString("createdTime"))); - } catch (ParseException e) { - logger.error("时间异常"); - resourceDTO1.setCreateDate(new Date()); - } - return resourceDTO1; - }).collect(Collectors.toList())); - } else { - resultPage.setRecords(null); - resultPage.setTotal(0); + } else { + logger.error("获取失败"); + } + } catch (Exception exception) { + logger.error("失败", exception); + } + }); + CompletableFuture local = CompletableFuture.runAsync(() -> { // 金宏网 + OkHttpClient client = new OkHttpClient(); + String url = String.format(tsingtao_xhaProperties.getLocalcam(), resourceDTO.getName(), pageNum, pageSize); + logger.info(url); + Request request = new Request.Builder().url(url).build(); + try (Response response = client.newCall(request).execute()) { + if (response.isSuccessful()) { + JSONObject jsonObject_ = JSON.parseObject(response.body().string()); + if (jsonObject_.containsKey("data")) { + if (jsonObject_.getJSONObject("data").containsKey("list")) { + resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total")); + resultPage.setRecords(jsonObject_.getJSONObject("data").getJSONArray("list").stream().map(index -> (JSONObject) JSON.toJSON(index)).map(index -> { + ResourceDTO resourceDTO1 = new ResourceDTO(); + resourceDTO1.setId(Long.valueOf(index.getString("id"))); + resourceDTO1.setDelFlag(index.getIntValue("delFlag")); + resourceDTO1.setLink(index.getString("cameraIndexCode")); + resourceDTO1.setName(index.getString("name")); + resourceDTO1.setType("基础设施"); + try { + resourceDTO1.setCreateDate(sdf.parse(index.getString("createdTime"))); + } catch (ParseException e) { + logger.error("时间异常"); + resourceDTO1.setCreateDate(new Date()); } - - } + return resourceDTO1; + }).collect(Collectors.toList())); } else { - logger.error("获取失败"); + resultPage.setRecords(null); + resultPage.setTotal(0); } - } catch (Exception exception) { - logger.error("失败", exception); + } - }); + } else { + logger.error("获取失败"); + } + } catch (Exception exception) { + logger.error("失败", exception); + } + }); CompletableFuture.allOf(cloud, local); } else { logger.info("西海岸基普通"); @@ -371,16 +365,70 @@ public class ResourceServiceImpl extends CrudServiceImpl selectAttrsByResourceId(Long resourceId) { QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("data_resource_id", resourceId) - .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()) - .orderByDesc("attr_type"); + wrapper.eq("data_resource_id", resourceId).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).orderByDesc("attr_type"); return attrDao.selectList(wrapper); } @Override public Object selectTotal() { HashMap resultMap = new HashMap<>(); - resultMap.put("total", resourceDao.selectTypeCount(null)); + List re = resourceDao.selectTypeCount(null); + switch (Constant.ProjectPlace.getByFlag(projectPlace)) { + case TSINGTAO_XHA: { // 青岛西海岸 + CompletableFuture allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目 + List result_ = new CopyOnWriteArrayList<>(); + CompletableFuture cloud = + CompletableFuture.runAsync(() -> { // 云脑专网 + OkHttpClient client = new OkHttpClient(); + String url = String.format(tsingtao_xhaProperties.getCloudcam(), "", 1, 10); + logger.info(url); + Request request = new Request.Builder().url(url).build(); + try (Response response = client.newCall(request).execute()) { + if (response.isSuccessful()) { + JSONObject jsonObject = JSON.parseObject(response.body().string()); + if (jsonObject.containsKey("data")) { + result_.add(jsonObject.getJSONObject("data").getLongValue("total")); + } + } else { + logger.error("青岛西海岸获取失败"); + } + } catch (Exception exception) { + logger.error("青岛西海岸失败", exception); + } + }); + CompletableFuture local = + CompletableFuture.runAsync(() -> { // 金宏网 + OkHttpClient client = new OkHttpClient(); + String url = String.format(tsingtao_xhaProperties.getLocalcam(), "", 1, 10); + logger.info(url); + Request request = new Request.Builder().url(url).build(); + try (Response response = client.newCall(request).execute()) { + if (response.isSuccessful()) { + JSONObject jsonObject = JSON.parseObject(response.body().string()); + if (jsonObject.containsKey("data")) { + result_.add(jsonObject.getJSONObject("data").getLongValue("total")); + } + } else { + logger.error("青岛西海岸获取失败"); + } + } catch (Exception exception) { + logger.error("青岛西海岸失败", exception); + } + }); + CompletableFuture.allOf(cloud, local); + return result_.stream().filter(index -> index != null).findAny().orElse(0l); + }).thenAccept(sum -> { + re.add(new HashMap() { + { + put("amount", sum); + put("type", "视频资源数量"); + } + }); + }); + allAmount.join(); + } + } + resultMap.put("total", re); return resultMap; } @@ -389,9 +437,7 @@ public class ResourceServiceImpl extends CrudServiceImpl page = new Page<>(jsonObject.getIntValue("pageNum"), jsonObject.getIntValue("pageSize")); QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type")) - .eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()) - .orderByDesc("create_date"); + queryWrapper.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type")).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).orderByDesc("create_date"); return resourceDao.selectPage(page, queryWrapper); } @@ -403,8 +449,7 @@ public class ResourceServiceImpl extends CrudServiceImpl resourceDTOS = resourceDao.selectMostPopular(selectMap); page.setRecords(resourceDTOS); QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()) - .eq("type", jsonObject.getString("type")); + queryWrapper.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).eq("type", jsonObject.getString("type")); Integer count = resourceDao.selectCount(queryWrapper); page.setTotal(count); return page; @@ -417,9 +462,7 @@ public class ResourceServiceImpl extends CrudServiceImpl updateWrapper = new UpdateWrapper<>(); - updateWrapper.lambda() - .eq(ResourceEntity::getId, resourceEntity.getId()) - .eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag()); + updateWrapper.lambda().eq(ResourceEntity::getId, resourceEntity.getId()).eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag()); resourceDao.update(entity, updateWrapper); ResourceBrowseEntity browseEntity = new ResourceBrowseEntity(); browseEntity.setResourceId(id); @@ -487,16 +530,14 @@ public class ResourceServiceImpl extends CrudServiceImpl resourceMap = new HashMap<>(); resourceMap.put("type", "全部能力目录"); QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("del_flag", 0) - .eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type")); + queryWrapper.eq("del_flag", 0).eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type")); resourceMap.put("total", resourceDao.selectCount(queryWrapper)); resultList.add(resourceMap); List> typeMapList = resourceDao.selectGroupByDeptId(jsonObject.getString("type")); if (typeMapList.isEmpty()) { return resultList; } - Map>> listMap = typeMapList.stream() - .collect(Collectors.groupingBy(m -> m.get("type").toString())); + Map>> listMap = typeMapList.stream().collect(Collectors.groupingBy(m -> m.get("type").toString())); //区级要根据行政区划多加一层结构 listMap.entrySet().stream().filter(index -> !"区级".equals(index.getKey())).forEach(item -> { HashMap map = new HashMap<>(); @@ -510,8 +551,7 @@ public class ResourceServiceImpl extends CrudServiceImpl>> areaList = Optional.ofNullable(listMap.get("区级")); - Optional>>> areaTypeList = Optional.ofNullable(areaList.orElse(new ArrayList<>()).stream() - .collect(Collectors.groupingBy(m -> m.get("districtName").toString()))); + Optional>>> areaTypeList = Optional.ofNullable(areaList.orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(m -> m.get("districtName").toString()))); HashMap areaMap = new HashMap<>(); areaMap.put("type", "区级"); Integer integer = resourceDao.selectTypeCountByDept("区级", jsonObject.getString("type")); @@ -707,9 +747,7 @@ public class ResourceServiceImpl extends CrudServiceImpl knowledgeUUID = - jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库' AND note1 IS NOT NULL FOR UPDATE;", String.class) - .stream().distinct().collect(Collectors.toList()); + final List knowledgeUUID = jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库' AND note1 IS NOT NULL FOR UPDATE;", String.class).stream().distinct().collect(Collectors.toList()); final int pageSize = 100; final OkHttpClient client = new OkHttpClient(); Arrays.stream(catalogIds).map(index -> { @@ -733,19 +771,11 @@ public class ResourceServiceImpl extends CrudServiceImpl Date: Thu, 23 Jun 2022 09:31:06 +0800 Subject: [PATCH 02/26] =?UTF-8?q?=E8=A5=BF=E6=B5=B7=E5=B2=B8=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=AE=BE=E6=96=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/resource/service/impl/ResourceServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 369c51b9..a143a22c 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -420,8 +420,8 @@ public class ResourceServiceImpl extends CrudServiceImpl { re.add(new HashMap() { { - put("amount", sum); - put("type", "视频资源数量"); + put("count", sum + ""); + put("type", "基础设施"); } }); }); From f35e726d541bfc92c9ddffca7d902d7bbb0b873c Mon Sep 17 00:00:00 2001 From: qiaosen Date: Thu, 23 Jun 2022 10:21:48 +0800 Subject: [PATCH 03/26] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TbProjectContribController.java | 116 ++++++++++++++++++ .../controller/TbProjectController.java | 116 ++++++++++++++++++ .../controller/TbProjectUseController.java | 116 ++++++++++++++++++ .../project/dao/TbProjectContribDao.java | 16 +++ .../modules/project/dao/TbProjectDao.java | 16 +++ .../modules/project/dao/TbProjectUseDao.java | 16 +++ .../project/dto/TbProjectContribDTO.java | 56 +++++++++ .../modules/project/dto/TbProjectDTO.java | 62 ++++++++++ .../modules/project/dto/TbProjectUseDTO.java | 56 +++++++++ .../entity/TbProjectContribEntity.java | 79 ++++++++++++ .../project/entity/TbProjectEntity.java | 91 ++++++++++++++ .../project/entity/TbProjectUseEntity.java | 79 ++++++++++++ .../project/excel/TbProjectContribExcel.java | 55 +++++++++ .../modules/project/excel/TbProjectExcel.java | 61 +++++++++ .../project/excel/TbProjectUseExcel.java | 55 +++++++++ .../service/TbProjectContribService.java | 15 +++ .../project/service/TbProjectService.java | 15 +++ .../project/service/TbProjectUseService.java | 15 +++ .../impl/TbProjectContribServiceImpl.java | 34 +++++ .../service/impl/TbProjectServiceImpl.java | 34 +++++ .../service/impl/TbProjectUseServiceImpl.java | 34 +++++ 21 files changed, 1137 insertions(+) create mode 100644 renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectContribController.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectController.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectUseController.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectContribDao.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectDao.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectUseDao.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectContribDTO.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectDTO.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectUseDTO.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectContribEntity.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectEntity.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectUseEntity.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectContribExcel.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectExcel.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectUseExcel.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/service/TbProjectContribService.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/service/TbProjectService.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/service/TbProjectUseService.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectContribServiceImpl.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectServiceImpl.java create mode 100644 renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectUseServiceImpl.java diff --git a/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectContribController.java b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectContribController.java new file mode 100644 index 00000000..e5b396ef --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectContribController.java @@ -0,0 +1,116 @@ +package io.renren.modules.project.controller; + +import io.renren.common.annotation.LogOperation; +import io.renren.common.constant.Constant; +import io.renren.common.page.PageData; +import io.renren.common.utils.ExcelUtils; +import io.renren.common.utils.Result; +import io.renren.common.validator.AssertUtils; +import io.renren.common.validator.ValidatorUtils; +import io.renren.common.validator.group.AddGroup; +import io.renren.common.validator.group.DefaultGroup; +import io.renren.common.validator.group.UpdateGroup; +import io.renren.modules.project.dto.TbProjectContribDTO; +import io.renren.modules.project.excel.TbProjectContribExcel; +import io.renren.modules.project.service.TbProjectContribService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** +* 项目贡献表 +* +* @author qs +* @since 3.0 2022-06-22 +*/ +@RestController +@RequestMapping("projectcontrib") +@Api(tags="项目贡献表") +public class TbProjectContribController { + @Autowired + private TbProjectContribService tbProjectContribService; + + @GetMapping("page") + @ApiOperation("分页") + @ApiImplicitParams({ + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") + }) + @RequiresPermissions("project:tbprojectcontrib:page") + public Result> page(@ApiIgnore @RequestParam Map params){ + PageData page = tbProjectContribService.page(params); + + return new Result>().ok(page); + } + + @GetMapping("{id}") + @ApiOperation("信息") + @RequiresPermissions("project:tbprojectcontrib:info") + public Result get(@PathVariable("id") Long id){ + TbProjectContribDTO data = tbProjectContribService.get(id); + + return new Result().ok(data); + } + + @PostMapping + @ApiOperation("保存") + @LogOperation("保存") + @RequiresPermissions("project:tbprojectcontrib:save") + public Result save(@RequestBody TbProjectContribDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + + tbProjectContribService.save(dto); + + return new Result(); + } + + @PutMapping + @ApiOperation("修改") + @LogOperation("修改") + @RequiresPermissions("project:tbprojectcontrib:update") + public Result update(@RequestBody TbProjectContribDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + + tbProjectContribService.update(dto); + + return new Result(); + } + + @DeleteMapping + @ApiOperation("删除") + @LogOperation("删除") + @RequiresPermissions("project:tbprojectcontrib:delete") + public Result delete(@RequestBody Long[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + + tbProjectContribService.delete(ids); + + return new Result(); + } + + @GetMapping("export") + @ApiOperation("导出") + @LogOperation("导出") + @RequiresPermissions("project:tbprojectcontrib:export") + public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { + List list = tbProjectContribService.list(params); + + ExcelUtils.exportExcelToTarget(response, null, "项目贡献表", list, TbProjectContribExcel.class); + } + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectController.java b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectController.java new file mode 100644 index 00000000..ba5812d0 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectController.java @@ -0,0 +1,116 @@ +package io.renren.modules.project.controller; + +import io.renren.common.annotation.LogOperation; +import io.renren.common.constant.Constant; +import io.renren.common.page.PageData; +import io.renren.common.utils.ExcelUtils; +import io.renren.common.utils.Result; +import io.renren.common.validator.AssertUtils; +import io.renren.common.validator.ValidatorUtils; +import io.renren.common.validator.group.AddGroup; +import io.renren.common.validator.group.DefaultGroup; +import io.renren.common.validator.group.UpdateGroup; +import io.renren.modules.project.dto.TbProjectDTO; +import io.renren.modules.project.excel.TbProjectExcel; +import io.renren.modules.project.service.TbProjectService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** +* 项目表 +* +* @author qiaosen +* @since 3.0 2022-06-22 +*/ +@RestController +@RequestMapping("project") +@Api(tags="项目表") +public class TbProjectController { + @Autowired + private TbProjectService tbProjectService; + + @GetMapping("page") + @ApiOperation("分页") + @ApiImplicitParams({ + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") + }) + @RequiresPermissions("project:tbproject:page") + public Result> page(@ApiIgnore @RequestParam Map params){ + PageData page = tbProjectService.page(params); + + return new Result>().ok(page); + } + + @GetMapping("{id}") + @ApiOperation("信息") + @RequiresPermissions("project:tbproject:info") + public Result get(@PathVariable("id") Long id){ + TbProjectDTO data = tbProjectService.get(id); + + return new Result().ok(data); + } + + @PostMapping + @ApiOperation("保存") + @LogOperation("保存") + @RequiresPermissions("project:tbproject:save") + public Result save(@RequestBody TbProjectDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + + tbProjectService.save(dto); + + return new Result(); + } + + @PutMapping + @ApiOperation("修改") + @LogOperation("修改") + @RequiresPermissions("project:tbproject:update") + public Result update(@RequestBody TbProjectDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + + tbProjectService.update(dto); + + return new Result(); + } + + @DeleteMapping + @ApiOperation("删除") + @LogOperation("删除") + @RequiresPermissions("project:tbproject:delete") + public Result delete(@RequestBody Long[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + + tbProjectService.delete(ids); + + return new Result(); + } + + @GetMapping("export") + @ApiOperation("导出") + @LogOperation("导出") + @RequiresPermissions("project:tbproject:export") + public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { + List list = tbProjectService.list(params); + + ExcelUtils.exportExcelToTarget(response, null, "项目表", list, TbProjectExcel.class); + } + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectUseController.java b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectUseController.java new file mode 100644 index 00000000..c943f87b --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectUseController.java @@ -0,0 +1,116 @@ +package io.renren.modules.project.controller; + +import io.renren.common.annotation.LogOperation; +import io.renren.common.constant.Constant; +import io.renren.common.page.PageData; +import io.renren.common.utils.ExcelUtils; +import io.renren.common.utils.Result; +import io.renren.common.validator.AssertUtils; +import io.renren.common.validator.ValidatorUtils; +import io.renren.common.validator.group.AddGroup; +import io.renren.common.validator.group.DefaultGroup; +import io.renren.common.validator.group.UpdateGroup; +import io.renren.modules.project.dto.TbProjectUseDTO; +import io.renren.modules.project.excel.TbProjectUseExcel; +import io.renren.modules.project.service.TbProjectUseService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** +* 项目使用表 +* +* @author qs sunlightcs@gmail.com +* @since 3.0 2022-06-22 +*/ +@RestController +@RequestMapping("projectuse") +@Api(tags="项目使用表") +public class TbProjectUseController { + @Autowired + private TbProjectUseService tbProjectUseService; + + @GetMapping("page") + @ApiOperation("分页") + @ApiImplicitParams({ + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") + }) + @RequiresPermissions("project:tbprojectuse:page") + public Result> page(@ApiIgnore @RequestParam Map params){ + PageData page = tbProjectUseService.page(params); + + return new Result>().ok(page); + } + + @GetMapping("{id}") + @ApiOperation("信息") + @RequiresPermissions("project:tbprojectuse:info") + public Result get(@PathVariable("id") Long id){ + TbProjectUseDTO data = tbProjectUseService.get(id); + + return new Result().ok(data); + } + + @PostMapping + @ApiOperation("保存") + @LogOperation("保存") + @RequiresPermissions("project:tbprojectuse:save") + public Result save(@RequestBody TbProjectUseDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + + tbProjectUseService.save(dto); + + return new Result(); + } + + @PutMapping + @ApiOperation("修改") + @LogOperation("修改") + @RequiresPermissions("project:tbprojectuse:update") + public Result update(@RequestBody TbProjectUseDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + + tbProjectUseService.update(dto); + + return new Result(); + } + + @DeleteMapping + @ApiOperation("删除") + @LogOperation("删除") + @RequiresPermissions("project:tbprojectuse:delete") + public Result delete(@RequestBody Long[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + + tbProjectUseService.delete(ids); + + return new Result(); + } + + @GetMapping("export") + @ApiOperation("导出") + @LogOperation("导出") + @RequiresPermissions("project:tbprojectuse:export") + public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { + List list = tbProjectUseService.list(params); + + ExcelUtils.exportExcelToTarget(response, null, "项目使用表", list, TbProjectUseExcel.class); + } + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectContribDao.java b/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectContribDao.java new file mode 100644 index 00000000..aae4739f --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectContribDao.java @@ -0,0 +1,16 @@ +package io.renren.modules.project.dao; + +import io.renren.common.dao.BaseDao; +import io.renren.modules.project.entity.TbProjectContribEntity; +import org.apache.ibatis.annotations.Mapper; + +/** +* 项目贡献表 +* +* @author qs +* @since 3.0 2022-06-22 +*/ +@Mapper +public interface TbProjectContribDao extends BaseDao { + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectDao.java b/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectDao.java new file mode 100644 index 00000000..3fd6505b --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectDao.java @@ -0,0 +1,16 @@ +package io.renren.modules.project.dao; + +import io.renren.common.dao.BaseDao; +import io.renren.modules.project.entity.TbProjectEntity; +import org.apache.ibatis.annotations.Mapper; + +/** +* 项目表 +* +* @author qiaosen +* @since 3.0 2022-06-22 +*/ +@Mapper +public interface TbProjectDao extends BaseDao { + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectUseDao.java b/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectUseDao.java new file mode 100644 index 00000000..fdff1c25 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/dao/TbProjectUseDao.java @@ -0,0 +1,16 @@ +package io.renren.modules.project.dao; + +import io.renren.common.dao.BaseDao; +import io.renren.modules.project.entity.TbProjectUseEntity; +import org.apache.ibatis.annotations.Mapper; + +/** +* 项目使用表 +* +* @author qs sunlightcs@gmail.com +* @since 3.0 2022-06-22 +*/ +@Mapper +public interface TbProjectUseDao extends BaseDao { + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectContribDTO.java b/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectContribDTO.java new file mode 100644 index 00000000..c2dc0422 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectContribDTO.java @@ -0,0 +1,56 @@ +package io.renren.modules.project.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* 项目贡献表 +* +* @author qs +* @since 3.0 2022-06-22 +*/ +@Data +@ApiModel(value = "项目贡献表") +public class TbProjectContribDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private Long id; + @ApiModelProperty(value = "项目名称") + private String projectName; + @ApiModelProperty(value = "应用名称") + private String resourceName; + @ApiModelProperty(value = "能力名称") + private String abilityName; + @ApiModelProperty(value = "能力类型") + private String abilityType; + @ApiModelProperty(value = "上架时间") + private Date applyTime; + @ApiModelProperty(value = "申请次数") + private String applyNum; + @ApiModelProperty(value = "浏览次数") + private String browseNum; + @ApiModelProperty(value = "创建人") + private Long creator; + @ApiModelProperty(value = "创建时间") + private Date createDate; + @ApiModelProperty(value = "修改人") + private Long updater; + @ApiModelProperty(value = "修改时间") + private Date updateDate; + @ApiModelProperty(value = "备用字段") + private String note1; + @ApiModelProperty(value = "备用字段") + private String note2; + @ApiModelProperty(value = "备用字段") + private String note3; + @ApiModelProperty(value = "备用字段") + private String note4; + @ApiModelProperty(value = "备用字段") + private String note5; + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectDTO.java b/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectDTO.java new file mode 100644 index 00000000..0af390ee --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectDTO.java @@ -0,0 +1,62 @@ +package io.renren.modules.project.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* 项目表 +* +* @author qiaosen +* @since 3.0 2022-06-22 +*/ +@Data +@ApiModel(value = "项目表") +public class TbProjectDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private Long id; + @ApiModelProperty(value = "项目名称") + private String projectName; + @ApiModelProperty(value = "申请单位") + private String applyDep; + @ApiModelProperty(value = "申请人") + private String applyUser; + @ApiModelProperty(value = "申请时间") + private Date applyTime; + @ApiModelProperty(value = "所属区市") + private String regionName; + @ApiModelProperty(value = "责任处室") + private String respDep; + @ApiModelProperty(value = "业务联系人") + private String businessUser; + @ApiModelProperty(value = "业务联系电话") + private String businessPhone; + @ApiModelProperty(value = "技术联系人") + private String techUser; + @ApiModelProperty(value = "技术联系电话") + private String techPhone; + @ApiModelProperty(value = "创建人") + private Long creator; + @ApiModelProperty(value = "创建时间") + private Date createDate; + @ApiModelProperty(value = "修改人") + private Long updater; + @ApiModelProperty(value = "修改时间") + private Date updateDate; + @ApiModelProperty(value = "备用字段") + private String note1; + @ApiModelProperty(value = "备用字段") + private String note2; + @ApiModelProperty(value = "备用字段") + private String note3; + @ApiModelProperty(value = "备用字段") + private String note4; + @ApiModelProperty(value = "备用字段") + private String note5; + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectUseDTO.java b/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectUseDTO.java new file mode 100644 index 00000000..21c9ae47 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/dto/TbProjectUseDTO.java @@ -0,0 +1,56 @@ +package io.renren.modules.project.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* 项目使用表 +* +* @author qs sunlightcs@gmail.com +* @since 3.0 2022-06-22 +*/ +@Data +@ApiModel(value = "项目使用表") +public class TbProjectUseDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "主键") + private Long id; + @ApiModelProperty(value = "项目名称") + private String projectName; + @ApiModelProperty(value = "应用名称") + private String resourceName; + @ApiModelProperty(value = "能力名称") + private String abilityName; + @ApiModelProperty(value = "能力类型") + private String abilityType; + @ApiModelProperty(value = "上架时间") + private Date applyTime; + @ApiModelProperty(value = "申请次数") + private String applyNum; + @ApiModelProperty(value = "浏览次数") + private String browseNum; + @ApiModelProperty(value = "创建人") + private Long creator; + @ApiModelProperty(value = "创建时间") + private Date createDate; + @ApiModelProperty(value = "修改人") + private Long updater; + @ApiModelProperty(value = "修改时间") + private Date updateDate; + @ApiModelProperty(value = "备用字段") + private String note1; + @ApiModelProperty(value = "备用字段") + private String note2; + @ApiModelProperty(value = "备用字段") + private String note3; + @ApiModelProperty(value = "备用字段") + private String note4; + @ApiModelProperty(value = "备用字段") + private String note5; + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectContribEntity.java b/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectContribEntity.java new file mode 100644 index 00000000..3ffb917b --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectContribEntity.java @@ -0,0 +1,79 @@ +package io.renren.modules.project.entity; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.*; +import java.util.Date; +import io.renren.common.entity.BaseEntity; + +/** + * 项目贡献表 + * + * @author qs + * @since 3.0 2022-06-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tb_project_contrib") +public class TbProjectContribEntity extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 项目名称 + */ + private String projectName; + /** + * 应用名称 + */ + private String resourceName; + /** + * 能力名称 + */ + private String abilityName; + /** + * 能力类型 + */ + private String abilityType; + /** + * 上架时间 + */ + private Date applyTime; + /** + * 申请次数 + */ + private String applyNum; + /** + * 浏览次数 + */ + private String browseNum; + /** + * 修改人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updater; + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateDate; + /** + * 备用字段 + */ + private String note1; + /** + * 备用字段 + */ + private String note2; + /** + * 备用字段 + */ + private String note3; + /** + * 备用字段 + */ + private String note4; + /** + * 备用字段 + */ + private String note5; +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectEntity.java b/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectEntity.java new file mode 100644 index 00000000..84c8eec4 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectEntity.java @@ -0,0 +1,91 @@ +package io.renren.modules.project.entity; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.*; +import java.util.Date; +import io.renren.common.entity.BaseEntity; + +/** + * 项目表 + * + * @author qiaosen + * @since 3.0 2022-06-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tb_project") +public class TbProjectEntity extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 项目名称 + */ + private String projectName; + /** + * 申请单位 + */ + private String applyDep; + /** + * 申请人 + */ + private String applyUser; + /** + * 申请时间 + */ + private Date applyTime; + /** + * 所属区市 + */ + private String regionName; + /** + * 责任处室 + */ + private String respDep; + /** + * 业务联系人 + */ + private String businessUser; + /** + * 业务联系电话 + */ + private String businessPhone; + /** + * 技术联系人 + */ + private String techUser; + /** + * 技术联系电话 + */ + private String techPhone; + /** + * 修改人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updater; + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateDate; + /** + * 备用字段 + */ + private String note1; + /** + * 备用字段 + */ + private String note2; + /** + * 备用字段 + */ + private String note3; + /** + * 备用字段 + */ + private String note4; + /** + * 备用字段 + */ + private String note5; +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectUseEntity.java b/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectUseEntity.java new file mode 100644 index 00000000..5ea696c6 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/entity/TbProjectUseEntity.java @@ -0,0 +1,79 @@ +package io.renren.modules.project.entity; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.*; +import java.util.Date; +import io.renren.common.entity.BaseEntity; + +/** + * 项目使用表 + * + * @author qs sunlightcs@gmail.com + * @since 3.0 2022-06-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tb_project_use") +public class TbProjectUseEntity extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 项目名称 + */ + private String projectName; + /** + * 应用名称 + */ + private String resourceName; + /** + * 能力名称 + */ + private String abilityName; + /** + * 能力类型 + */ + private String abilityType; + /** + * 上架时间 + */ + private Date applyTime; + /** + * 申请次数 + */ + private String applyNum; + /** + * 浏览次数 + */ + private String browseNum; + /** + * 修改人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updater; + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateDate; + /** + * 备用字段 + */ + private String note1; + /** + * 备用字段 + */ + private String note2; + /** + * 备用字段 + */ + private String note3; + /** + * 备用字段 + */ + private String note4; + /** + * 备用字段 + */ + private String note5; +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectContribExcel.java b/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectContribExcel.java new file mode 100644 index 00000000..b84b35ef --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectContribExcel.java @@ -0,0 +1,55 @@ +package io.renren.modules.project.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import lombok.Data; +import java.util.Date; + +/** + * 项目贡献表 + * + * @author qs + * @since 3.0 2022-06-22 + */ +@Data +@ContentRowHeight(20) +@HeadRowHeight(20) +@ColumnWidth(25) +public class TbProjectContribExcel { + @ExcelProperty(value = "主键", index = 0) + private Long id; + @ExcelProperty(value = "项目名称", index = 1) + private String projectName; + @ExcelProperty(value = "应用名称", index = 2) + private String resourceName; + @ExcelProperty(value = "能力名称", index = 3) + private String abilityName; + @ExcelProperty(value = "能力类型", index = 4) + private String abilityType; + @ExcelProperty(value = "上架时间", index = 5) + private Date applyTime; + @ExcelProperty(value = "申请次数", index = 6) + private String applyNum; + @ExcelProperty(value = "浏览次数", index = 7) + private String browseNum; + @ExcelProperty(value = "创建人", index = 8) + private Long creator; + @ExcelProperty(value = "创建时间", index = 9) + private Date createDate; + @ExcelProperty(value = "修改人", index = 10) + private Long updater; + @ExcelProperty(value = "修改时间", index = 11) + private Date updateDate; + @ExcelProperty(value = "备用字段", index = 12) + private String note1; + @ExcelProperty(value = "备用字段", index = 13) + private String note2; + @ExcelProperty(value = "备用字段", index = 14) + private String note3; + @ExcelProperty(value = "备用字段", index = 15) + private String note4; + @ExcelProperty(value = "备用字段", index = 16) + private String note5; +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectExcel.java b/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectExcel.java new file mode 100644 index 00000000..587aabef --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectExcel.java @@ -0,0 +1,61 @@ +package io.renren.modules.project.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import lombok.Data; +import java.util.Date; + +/** + * 项目表 + * + * @author qiaosen + * @since 3.0 2022-06-22 + */ +@Data +@ContentRowHeight(20) +@HeadRowHeight(20) +@ColumnWidth(25) +public class TbProjectExcel { + @ExcelProperty(value = "主键", index = 0) + private Long id; + @ExcelProperty(value = "项目名称", index = 1) + private String projectName; + @ExcelProperty(value = "申请单位", index = 2) + private String applyDep; + @ExcelProperty(value = "申请人", index = 3) + private String applyUser; + @ExcelProperty(value = "申请时间", index = 4) + private Date applyTime; + @ExcelProperty(value = "所属区市", index = 5) + private String regionName; + @ExcelProperty(value = "责任处室", index = 6) + private String respDep; + @ExcelProperty(value = "业务联系人", index = 7) + private String businessUser; + @ExcelProperty(value = "业务联系电话", index = 8) + private String businessPhone; + @ExcelProperty(value = "技术联系人", index = 9) + private String techUser; + @ExcelProperty(value = "技术联系电话", index = 10) + private String techPhone; + @ExcelProperty(value = "创建人", index = 11) + private Long creator; + @ExcelProperty(value = "创建时间", index = 12) + private Date createDate; + @ExcelProperty(value = "修改人", index = 13) + private Long updater; + @ExcelProperty(value = "修改时间", index = 14) + private Date updateDate; + @ExcelProperty(value = "备用字段", index = 15) + private String note1; + @ExcelProperty(value = "备用字段", index = 16) + private String note2; + @ExcelProperty(value = "备用字段", index = 17) + private String note3; + @ExcelProperty(value = "备用字段", index = 18) + private String note4; + @ExcelProperty(value = "备用字段", index = 19) + private String note5; +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectUseExcel.java b/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectUseExcel.java new file mode 100644 index 00000000..cd107882 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/excel/TbProjectUseExcel.java @@ -0,0 +1,55 @@ +package io.renren.modules.project.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import lombok.Data; +import java.util.Date; + +/** + * 项目使用表 + * + * @author qs sunlightcs@gmail.com + * @since 3.0 2022-06-22 + */ +@Data +@ContentRowHeight(20) +@HeadRowHeight(20) +@ColumnWidth(25) +public class TbProjectUseExcel { + @ExcelProperty(value = "主键", index = 0) + private Long id; + @ExcelProperty(value = "项目名称", index = 1) + private String projectName; + @ExcelProperty(value = "应用名称", index = 2) + private String resourceName; + @ExcelProperty(value = "能力名称", index = 3) + private String abilityName; + @ExcelProperty(value = "能力类型", index = 4) + private String abilityType; + @ExcelProperty(value = "上架时间", index = 5) + private Date applyTime; + @ExcelProperty(value = "申请次数", index = 6) + private String applyNum; + @ExcelProperty(value = "浏览次数", index = 7) + private String browseNum; + @ExcelProperty(value = "创建人", index = 8) + private Long creator; + @ExcelProperty(value = "创建时间", index = 9) + private Date createDate; + @ExcelProperty(value = "修改人", index = 10) + private Long updater; + @ExcelProperty(value = "修改时间", index = 11) + private Date updateDate; + @ExcelProperty(value = "备用字段", index = 12) + private String note1; + @ExcelProperty(value = "备用字段", index = 13) + private String note2; + @ExcelProperty(value = "备用字段", index = 14) + private String note3; + @ExcelProperty(value = "备用字段", index = 15) + private String note4; + @ExcelProperty(value = "备用字段", index = 16) + private String note5; +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectContribService.java b/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectContribService.java new file mode 100644 index 00000000..8f27e871 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectContribService.java @@ -0,0 +1,15 @@ +package io.renren.modules.project.service; + +import io.renren.common.service.CrudService; +import io.renren.modules.project.dto.TbProjectContribDTO; +import io.renren.modules.project.entity.TbProjectContribEntity; + +/** + * 项目贡献表 + * + * @author qs + * @since 3.0 2022-06-22 + */ +public interface TbProjectContribService extends CrudService { + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectService.java b/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectService.java new file mode 100644 index 00000000..21e47313 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectService.java @@ -0,0 +1,15 @@ +package io.renren.modules.project.service; + +import io.renren.common.service.CrudService; +import io.renren.modules.project.dto.TbProjectDTO; +import io.renren.modules.project.entity.TbProjectEntity; + +/** + * 项目表 + * + * @author qiaosen + * @since 3.0 2022-06-22 + */ +public interface TbProjectService extends CrudService { + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectUseService.java b/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectUseService.java new file mode 100644 index 00000000..bc334317 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/service/TbProjectUseService.java @@ -0,0 +1,15 @@ +package io.renren.modules.project.service; + +import io.renren.common.service.CrudService; +import io.renren.modules.project.dto.TbProjectUseDTO; +import io.renren.modules.project.entity.TbProjectUseEntity; + +/** + * 项目使用表 + * + * @author qs sunlightcs@gmail.com + * @since 3.0 2022-06-22 + */ +public interface TbProjectUseService extends CrudService { + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectContribServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectContribServiceImpl.java new file mode 100644 index 00000000..7047662d --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectContribServiceImpl.java @@ -0,0 +1,34 @@ +package io.renren.modules.project.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.renren.common.service.impl.CrudServiceImpl; +import io.renren.common.constant.Constant; +import io.renren.modules.project.dao.TbProjectContribDao; +import io.renren.modules.project.dto.TbProjectContribDTO; +import io.renren.modules.project.entity.TbProjectContribEntity; +import io.renren.modules.project.service.TbProjectContribService; +import io.renren.modules.security.user.SecurityUser; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.util.Map; + +/** + * 项目贡献表 + * + * @author qs + * @since 3.0 2022-06-22 + */ +@Service +public class TbProjectContribServiceImpl extends CrudServiceImpl implements TbProjectContribService { + + @Override + public QueryWrapper getWrapper(Map params){ + QueryWrapper wrapper = new QueryWrapper<>(); + + + return wrapper; + } + + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectServiceImpl.java new file mode 100644 index 00000000..064adc22 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectServiceImpl.java @@ -0,0 +1,34 @@ +package io.renren.modules.project.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.renren.common.service.impl.CrudServiceImpl; +import io.renren.common.constant.Constant; +import io.renren.modules.project.dao.TbProjectDao; +import io.renren.modules.project.dto.TbProjectDTO; +import io.renren.modules.project.entity.TbProjectEntity; +import io.renren.modules.project.service.TbProjectService; +import io.renren.modules.security.user.SecurityUser; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.util.Map; + +/** + * 项目表 + * + * @author qiaosen + * @since 3.0 2022-06-22 + */ +@Service +public class TbProjectServiceImpl extends CrudServiceImpl implements TbProjectService { + + @Override + public QueryWrapper getWrapper(Map params){ + QueryWrapper wrapper = new QueryWrapper<>(); + + + return wrapper; + } + + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectUseServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectUseServiceImpl.java new file mode 100644 index 00000000..24c6f6bb --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectUseServiceImpl.java @@ -0,0 +1,34 @@ +package io.renren.modules.project.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.renren.common.service.impl.CrudServiceImpl; +import io.renren.common.constant.Constant; +import io.renren.modules.project.dao.TbProjectUseDao; +import io.renren.modules.project.dto.TbProjectUseDTO; +import io.renren.modules.project.entity.TbProjectUseEntity; +import io.renren.modules.project.service.TbProjectUseService; +import io.renren.modules.security.user.SecurityUser; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.util.Map; + +/** + * 项目使用表 + * + * @author qs sunlightcs@gmail.com + * @since 3.0 2022-06-22 + */ +@Service +public class TbProjectUseServiceImpl extends CrudServiceImpl implements TbProjectUseService { + + @Override + public QueryWrapper getWrapper(Map params){ + QueryWrapper wrapper = new QueryWrapper<>(); + + + return wrapper; + } + + +} \ No newline at end of file From b140d7f4d60b52e6a5ac9d9aae64fc7edf90d531 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 23 Jun 2022 10:29:07 +0800 Subject: [PATCH 04/26] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=86=85=E4=B8=8D=E9=9C=80=E7=BB=9F=E8=AE=A1=E7=9A=84=E8=B5=84?= =?UTF-8?q?=E6=BA=90=20=E6=8E=92=E9=99=A4=E6=8E=A5=E5=8F=A3=E5=87=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/CensusController.java | 35 ++++++++----------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java index b9be86de..203125c1 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java @@ -59,35 +59,28 @@ public class CensusController { @ApiOperation("各类资源数目") public Result>> resourceAmount() { List> dbAmount = resourceService.getAmountGroupByType(); - List temp = dbAmount.stream().map(index -> index.get("type").toString()).collect(Collectors.toList()); + dbAmount = dbAmount.stream().filter(index -> Arrays.asList(censusTypes).contains(index.get("type").toString())).collect(Collectors.toList()); + List> finalDbAmount = dbAmount; + + List temp = finalDbAmount.stream().map(index -> index.get("type").toString()).collect(Collectors.toList()); Arrays.stream(censusTypes).filter(index -> !temp.contains(index)).forEach(index -> { // 数据库内不存在的资源类型 - if (index.equals("数据资源")) { - Map nullMap = new HashMap() { - { - put("amount", 10413); - put("type", "数据资源"); - } - }; - dbAmount.add(nullMap); - } else { - Map nullMap = new HashMap() { - { - put("amount", 0); - put("type", index); - } - }; - dbAmount.add(nullMap); - } + Map nullMap = new HashMap() { + { + put("amount", 0); + put("type", index); + } + }; + finalDbAmount.add(nullMap); }); - Long sum = dbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum(); + Long sum = finalDbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum(); Map sumMap = new HashMap() { { put("amount", sum); put("type", "资源汇聚总量"); } }; - dbAmount.add(sumMap); - return new Result>>().ok(dbAmount); + finalDbAmount.add(sumMap); + return new Result>>().ok(finalDbAmount); } @GetMapping(value = "/whole_amount") From 40ccd4e356a67b7ee2fe5de3b9f0902d91fe687c Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 23 Jun 2022 10:40:46 +0800 Subject: [PATCH 05/26] ... --- .../main/java/io/renren/common/controller/CensusController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java index 203125c1..f12ec310 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java @@ -95,7 +95,7 @@ public class CensusController { }).thenAccept(sum -> { result.add(new HashMap() { { - put("amount", sum + 10413 + 14); + put("amount", sum); put("type", "资源汇聚总量"); } }); From f6a8112a04f0e61c1844bfaf48cb84363f1ff8a7 Mon Sep 17 00:00:00 2001 From: qiaosen Date: Thu, 23 Jun 2022 10:45:46 +0800 Subject: [PATCH 06/26] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BB=BA=E8=A1=A8sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/db/V1.8__project_add_table.sql | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 renren-admin/src/main/resources/db/V1.8__project_add_table.sql diff --git a/renren-admin/src/main/resources/db/V1.8__project_add_table.sql b/renren-admin/src/main/resources/db/V1.8__project_add_table.sql new file mode 100644 index 00000000..979f95fb --- /dev/null +++ b/renren-admin/src/main/resources/db/V1.8__project_add_table.sql @@ -0,0 +1,77 @@ +CREATE TABLE `tb_project` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `project_name` varchar(128) DEFAULT NULL COMMENT '项目名称', + `apply_dep` varchar(128) DEFAULT NULL COMMENT '申请单位', + `apply_user` varchar(128) DEFAULT NULL COMMENT '申请人', + `apply_time` datetime DEFAULT NULL COMMENT '申请时间', + `region_name` varchar(128) DEFAULT NULL COMMENT '所属区市', + `resp_dep` varchar(128) DEFAULT NULL COMMENT '责任处室', + `business_user` varchar(128) DEFAULT NULL COMMENT '业务联系人', + `business_phone` varchar(32) DEFAULT NULL COMMENT '业务联系电话', + `tech_user` varchar(128) DEFAULT NULL COMMENT '技术联系人', + `tech_phone` varchar(32) DEFAULT NULL COMMENT '技术联系电话', + `creator` bigint(20) DEFAULT NULL COMMENT '创建人', + `create_date` datetime DEFAULT NULL COMMENT '创建时间', + `updater` bigint(20) DEFAULT NULL COMMENT '修改人', + `update_date` datetime DEFAULT NULL COMMENT '修改时间', + `note1` longtext COMMENT '备用字段', + `note2` varchar(200) DEFAULT NULL COMMENT '备用字段', + `note3` varchar(500) DEFAULT NULL COMMENT '备用字段', + `note4` varchar(1000) DEFAULT NULL COMMENT '备用字段', + `note5` varchar(2000) DEFAULT NULL COMMENT '备用字段', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='项目表'; + +CREATE TABLE `tb_project_contrib` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `project_name` varchar(128) DEFAULT NULL COMMENT '项目名称', + `resource_name` varchar(128) DEFAULT NULL COMMENT '应用名称', + `ability_name` varchar(128) DEFAULT NULL COMMENT '能力名称', + `ability_type` varchar(64) DEFAULT NULL COMMENT '能力类型', + `apply_time` datetime DEFAULT NULL COMMENT '上架时间', + `apply_num` varchar(10) DEFAULT NULL COMMENT '申请次数', + `browse_num` varchar(10) DEFAULT NULL COMMENT '浏览次数', + `creator` bigint(20) DEFAULT NULL COMMENT '创建人', + `create_date` datetime DEFAULT NULL COMMENT '创建时间', + `updater` bigint(20) DEFAULT NULL COMMENT '修改人', + `update_date` datetime DEFAULT NULL COMMENT '修改时间', + `note1` longtext COMMENT '备用字段', + `note2` varchar(200) DEFAULT NULL COMMENT '备用字段', + `note3` varchar(500) DEFAULT NULL COMMENT '备用字段', + `note4` varchar(1000) DEFAULT NULL COMMENT '备用字段', + `note5` varchar(2000) DEFAULT NULL COMMENT '备用字段', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='项目贡献表'; + +CREATE TABLE `tb_project_use` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `project_name` varchar(128) DEFAULT NULL COMMENT '项目名称', + `resource_name` varchar(128) DEFAULT NULL COMMENT '应用名称', + `ability_name` varchar(128) DEFAULT NULL COMMENT '能力名称', + `ability_type` varchar(64) DEFAULT NULL COMMENT '能力类型', + `apply_time` datetime DEFAULT NULL COMMENT '上架时间', + `apply_num` varchar(10) DEFAULT NULL COMMENT '申请次数', + `browse_num` varchar(10) DEFAULT NULL COMMENT '浏览次数', + `creator` bigint(20) DEFAULT NULL COMMENT '创建人', + `create_date` datetime DEFAULT NULL COMMENT '创建时间', + `updater` bigint(20) DEFAULT NULL COMMENT '修改人', + `update_date` datetime DEFAULT NULL COMMENT '修改时间', + `note1` longtext COMMENT '备用字段', + `note2` varchar(200) DEFAULT NULL COMMENT '备用字段', + `note3` varchar(500) DEFAULT NULL COMMENT '备用字段', + `note4` varchar(1000) DEFAULT NULL COMMENT '备用字段', + `note5` varchar(2000) DEFAULT NULL COMMENT '备用字段', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='项目使用表'; + +CREATE TABLE `tb_data_resource_rel` ( + `key_id` bigint(20) DEFAULT NULL COMMENT '应用资源id', + `reference_id` bigint(20) DEFAULT NULL COMMENT '关联id', + `del_flag` int(11) DEFAULT '0' COMMENT '删除标志:\r\n0:正常;\r\n1:已删除;\r\n2:待审核;\r\n3:审核中;\r\n9其他', + `creator` bigint(20) DEFAULT NULL COMMENT '创建人', + `create_date` datetime DEFAULT NULL COMMENT '创建时间', + `updater` bigint(20) DEFAULT NULL COMMENT '修改人', + `update_date` datetime DEFAULT NULL COMMENT '修改时间', + `id` bigint(20) NOT NULL COMMENT 'id', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='组件-应用资源关系表'; \ No newline at end of file From b5d084128c2fb1af6956c3d6d53f337792fd566b Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 23 Jun 2022 11:45:19 +0800 Subject: [PATCH 07/26] =?UTF-8?q?=E9=9C=80=E6=B1=82=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A0=E9=99=A4=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demandComment/dto/TDemandCommentDTO.java | 5 +- .../entity/TDemandCommentEntity.java | 86 ++++++++++--------- .../src/main/resources/application-dev.yml | 6 +- .../src/main/resources/application.yml | 1 + 4 files changed, 55 insertions(+), 43 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/demandComment/dto/TDemandCommentDTO.java b/renren-admin/src/main/java/io/renren/modules/demandComment/dto/TDemandCommentDTO.java index 1adf54c2..203b1081 100644 --- a/renren-admin/src/main/java/io/renren/modules/demandComment/dto/TDemandCommentDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/demandComment/dto/TDemandCommentDTO.java @@ -1,5 +1,6 @@ package io.renren.modules.demandComment.dto; +import io.renren.common.dto.AuditingBaseDTO; import io.renren.modules.demanData.dto.TDemandDataDTO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -16,7 +17,7 @@ import java.util.Date; */ @Data @ApiModel(value = "需求评论") -public class TDemandCommentDTO implements Serializable { +public class TDemandCommentDTO extends AuditingBaseDTO implements Serializable { private static final long serialVersionUID = 1L; private Long id; @@ -42,6 +43,8 @@ public class TDemandCommentDTO implements Serializable { private String note4; @ApiModelProperty(value = "备用字段") private String note5; + @ApiModelProperty(value = "删除标志:0:正常;1:已删除;2:待审核;3:审核中;9其他") + private Integer delFlag; @ApiModelProperty(value = "评论所属需求主题") private TDemandDataDTO demandDataDTO; diff --git a/renren-admin/src/main/java/io/renren/modules/demandComment/entity/TDemandCommentEntity.java b/renren-admin/src/main/java/io/renren/modules/demandComment/entity/TDemandCommentEntity.java index d7296d4a..062244dd 100644 --- a/renren-admin/src/main/java/io/renren/modules/demandComment/entity/TDemandCommentEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/demandComment/entity/TDemandCommentEntity.java @@ -1,10 +1,9 @@ package io.renren.modules.demandComment.entity; +import com.baomidou.mybatisplus.annotation.TableName; +import io.renren.common.entity.BaseEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import com.baomidou.mybatisplus.annotation.*; -import java.util.Date; -import io.renren.common.entity.BaseEntity; /** * 需求评论 @@ -13,45 +12,50 @@ import io.renren.common.entity.BaseEntity; * @since 1.0 2022-04-26 */ @Data -@EqualsAndHashCode(callSuper=false) +@EqualsAndHashCode(callSuper = false) @TableName("t_demand_comment") public class TDemandCommentEntity extends BaseEntity { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 评论人部门名称 - */ - private String createDeptName; - /** - * 评论人姓名 - */ - private String name; - /** - * 评论内容 - */ - private String comment; - /** - * 评论主题id - */ - private Long targetId; - /** - * 备用字段 - */ - private String note1; - /** - * 备用字段 - */ - private String note2; - /** - * 备用字段 - */ - private String note3; - /** - * 备用字段 - */ - private String note4; - /** - * 备用字段 - */ - private String note5; + /** + * 评论人部门名称 + */ + private String createDeptName; + /** + * 评论人姓名 + */ + private String name; + /** + * 评论内容 + */ + private String comment; + /** + * 评论主题id + */ + private Long targetId; + /** + * 备用字段 + */ + private String note1; + /** + * 备用字段 + */ + private String note2; + /** + * 备用字段 + */ + private String note3; + /** + * 备用字段 + */ + private String note4; + /** + * 备用字段 + */ + private String note5; + + /** + * 删除标志:0:正常;1:已删除;2:待审核;3:审核中;9其他 + */ + private Integer delFlag; } \ No newline at end of file diff --git a/renren-admin/src/main/resources/application-dev.yml b/renren-admin/src/main/resources/application-dev.yml index bf7332ea..d073d14c 100644 --- a/renren-admin/src/main/resources/application-dev.yml +++ b/renren-admin/src/main/resources/application-dev.yml @@ -51,7 +51,11 @@ spring: wall: config: multi-statement-allow: true - + flyway: + enabled: true + validate-on-migrate: false + # + out-of-order: true #上传的静态资源配置 resource: root_url: 15.2.21.238 diff --git a/renren-admin/src/main/resources/application.yml b/renren-admin/src/main/resources/application.yml index d7b7112e..3393c487 100644 --- a/renren-admin/src/main/resources/application.yml +++ b/renren-admin/src/main/resources/application.yml @@ -61,6 +61,7 @@ spring: locations: filesystem:config/db baseline-on-migrate: true baseline-version: 0 + validate-on-migrate: true fdfs: From 6f394a3f99e0be614343a2242f17068218d4413f Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 23 Jun 2022 11:48:28 +0800 Subject: [PATCH 08/26] ... --- renren-admin/src/main/resources/application-dev.yml | 2 +- renren-admin/src/main/resources/db/V1.9__comment_add_col.sql | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 renren-admin/src/main/resources/db/V1.9__comment_add_col.sql diff --git a/renren-admin/src/main/resources/application-dev.yml b/renren-admin/src/main/resources/application-dev.yml index d073d14c..9dc8663a 100644 --- a/renren-admin/src/main/resources/application-dev.yml +++ b/renren-admin/src/main/resources/application-dev.yml @@ -54,7 +54,7 @@ spring: flyway: enabled: true validate-on-migrate: false - # + # 允许乱序执行 out-of-order: true #上传的静态资源配置 resource: diff --git a/renren-admin/src/main/resources/db/V1.9__comment_add_col.sql b/renren-admin/src/main/resources/db/V1.9__comment_add_col.sql new file mode 100644 index 00000000..99342572 --- /dev/null +++ b/renren-admin/src/main/resources/db/V1.9__comment_add_col.sql @@ -0,0 +1 @@ +ALTER TABLE `t_demand_comment` ADD COLUMN `del_flag` int(11) NULL COMMENT '删除标志:\r\n0:正常;\r\n1:已删除;\r\n2:待审核;\r\n3:审核中;\r\n9其他'; \ No newline at end of file From a911fdeee9efe479048688abc5c7fd15a6e0bd74 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 23 Jun 2022 14:42:54 +0800 Subject: [PATCH 09/26] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AbilityCenterController.java | 11 +- .../common/controller/CommentController.java | 99 ++++++++++++ .../controller/TDemandCommentController.java | 5 +- .../listener/CommentListener.java | 143 ++++++++++++++++++ .../impl/TDemandCommentServiceImpl.java | 43 +++--- .../resources/db/V2.0__comment_add_col.sql | 1 + 6 files changed, 278 insertions(+), 24 deletions(-) create mode 100644 renren-admin/src/main/java/io/renren/common/controller/CommentController.java create mode 100644 renren-admin/src/main/java/io/renren/modules/demandComment/listener/CommentListener.java create mode 100644 renren-admin/src/main/resources/db/V2.0__comment_add_col.sql diff --git a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java index dd431592..9d166567 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterController.java @@ -29,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; @@ -109,10 +110,12 @@ public class AbilityCenterController { processStartDTO.setVariables(variables); ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO); - if (Long.valueOf(dto.getBusinessKey()) != null) { - // 仿照请求接口 /processForm/tabilityapplication/updateInstanceId - tAbilityApplicationService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey())); - } + // 仿照请求接口 /processForm/tabilityapplication/updateInstanceId + CompletableFuture.runAsync(() -> { + if (Long.valueOf(dto.getBusinessKey()) != null) { + tAbilityApplicationService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey())); + } + }); return dto; }).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList())); } diff --git a/renren-admin/src/main/java/io/renren/common/controller/CommentController.java b/renren-admin/src/main/java/io/renren/common/controller/CommentController.java new file mode 100644 index 00000000..eaacef34 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/common/controller/CommentController.java @@ -0,0 +1,99 @@ +package io.renren.common.controller; + + +import io.renren.common.page.PageData; +import io.renren.common.utils.Result; +import io.renren.modules.activiti.dto.ProcessInstanceDTO; +import io.renren.modules.activiti.dto.ProcessStartDTO; +import io.renren.modules.activiti.service.ActProcessService; +import io.renren.modules.activiti.service.ActRunningService; +import io.renren.modules.demandComment.dto.TDemandCommentDTO; +import io.renren.modules.demandComment.service.TDemandCommentService; +import io.renren.modules.processForm.service.TAbilityApplicationService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.codehaus.jackson.map.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@Api(tags = "") +@RestController +@RequestMapping("/comment/center") +public class CommentController { + + @Autowired + private ActProcessService actProcessService; + @Autowired + private TAbilityApplicationService tAbilityApplicationService; + @Autowired + private ActRunningService actRunningService; + @Autowired + private TDemandCommentService tDemandCommentService; + @Autowired + private JdbcTemplate jdbcTemplate; + private static Logger logger = LoggerFactory.getLogger(CommentController.class); + + private static String key = "comment_review"; + + private static Map params = new HashMap() { + { + put("isLatestVersion", true); // 取最新版本 + put("key", key); // 限定 + } + }; + + /** + * 批量进行批量能力申请 + * + * @param tDemandCommentDTO + * @return + */ + @PostMapping(value = "/apply") + @ApiOperation("批量进行评论审核申请") + public Result apply(@RequestBody TDemandCommentDTO tDemandCommentDTO) { + // 仿照请求接口 /act/process/lastestPage + PageData> page = actProcessService.page(params); + if (page.getTotal() <= 0) { // + return new Result().error("联系管理员添加流程"); + } + if (tDemandCommentDTO.getId() == null) { + return new Result().error("参数异常"); + } + tDemandCommentDTO = tDemandCommentService.get(tDemandCommentDTO.getId()); + if (tDemandCommentDTO.getId() == null) { + return new Result().error("该评论不存在"); + } + tDemandCommentDTO.setDelFlag(2); // 待审核 + tDemandCommentDTO.setCompleteEntry(Boolean.TRUE); + tDemandCommentService.update(tDemandCommentDTO); + + // 仿照请求接口 /act/running/startOfBusinessKey + ProcessStartDTO processStartDTO = new ProcessStartDTO(); + processStartDTO.setBusinessKey(tDemandCommentDTO.getId().toString()); + processStartDTO.setProcessDefinitionKey(key); //限定 + ObjectMapper oMapper = new ObjectMapper(); + Map variables = oMapper.convertValue(tDemandCommentDTO, Map.class); + processStartDTO.setVariables(variables); + ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO); + + tDemandCommentDTO.setDelFlag(3); // 审核中 + tDemandCommentService.update(tDemandCommentDTO); + + CompletableFuture.runAsync(() -> { + if (Long.valueOf(dto.getBusinessKey()) != null) { + jdbcTemplate.update(String.format("UPDATE t_demand_comment SET instance_id = '%s' WHERE id = %s", dto.getProcessInstanceId(), dto.getBusinessKey())); + } + }); + return new Result().ok(dto); + } +} diff --git a/renren-admin/src/main/java/io/renren/modules/demandComment/controller/TDemandCommentController.java b/renren-admin/src/main/java/io/renren/modules/demandComment/controller/TDemandCommentController.java index 310de68b..3e46677e 100644 --- a/renren-admin/src/main/java/io/renren/modules/demandComment/controller/TDemandCommentController.java +++ b/renren-admin/src/main/java/io/renren/modules/demandComment/controller/TDemandCommentController.java @@ -104,7 +104,7 @@ public class TDemandCommentController { @ApiOperation("保存") @LogOperation("保存") // @RequiresPermissions("demandComment:tdemandcomment:save") - public Result save(@RequestBody TDemandCommentDTO dto) { + public Result save(@RequestBody TDemandCommentDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); TDemandDataDTO dto1 = @@ -115,9 +115,10 @@ public class TDemandCommentController { if (dto1.getFlag() != 3) { return new Result().error("该评论主题未审批通过!"); } + dto.setDelFlag(1); tDemandCommentService.save(dto); - return new Result(); + return new Result().ok(dto); } @PutMapping diff --git a/renren-admin/src/main/java/io/renren/modules/demandComment/listener/CommentListener.java b/renren-admin/src/main/java/io/renren/modules/demandComment/listener/CommentListener.java new file mode 100644 index 00000000..ffcd2300 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/demandComment/listener/CommentListener.java @@ -0,0 +1,143 @@ +package io.renren.modules.demandComment.listener; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import io.renren.common.annotation.ActivitiNoticeOperation; +import io.renren.modules.demandComment.dto.TDemandCommentDTO; +import io.renren.modules.demandComment.service.TDemandCommentService; +import io.renren.modules.sys.dto.SysDeptDTO; +import io.renren.modules.sys.dto.SysRoleDTO; +import io.renren.modules.sys.dto.SysUserDTO; +import io.renren.modules.sys.service.SysDeptService; +import io.renren.modules.sys.service.SysRoleService; +import io.renren.modules.sys.service.SysRoleUserService; +import io.renren.modules.sys.service.SysUserService; +import org.activiti.engine.TaskService; +import org.activiti.engine.delegate.*; +import org.activiti.engine.delegate.event.ActivitiEvent; +import org.activiti.engine.delegate.event.ActivitiEventListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.Map; + +/** + * 大数据局动态审批人 + */ +@Component +public class CommentListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate { + private static Logger logger = LoggerFactory.getLogger(CommentListener.class); + + @Value("${big_date.name}") + private String bigDateDeptName; // 大数据局名称 + @Value("${big_date.assignee_role_name}") + private String roleName; // 具备审批的角色名称 + + @Autowired + private SysRoleService sysRoleService; + @Autowired + private TaskService taskService; + @Autowired + private SysUserService sysUserService; + @Autowired + private SysRoleUserService sysRoleUserService; + @Autowired + private SysDeptService sysDeptService; + @Autowired + private TDemandCommentService tDemandCommentService; + + @Override + public void notify(DelegateExecution delegateExecution) throws Exception { + logger.error("----------------------进入审批结束节点---------------------------"); + delegateExecution.getProcessBusinessKey(); + final String eventName = delegateExecution.getEventName(); + switch (eventName) { + case EVENTNAME_END: + endTake(delegateExecution.getVariables()); + break; + } + + } + + /** + * 结束审批 + * + * @param kv + */ + private void endTake(Map kv) { // 进入最后结束节点 + GsonBuilder builder = new GsonBuilder(); + builder.registerTypeAdapter(Date.class, (JsonDeserializer) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong())); + + Gson gson = builder.create(); + JsonElement jsonElement = gson.toJsonTree(kv); + TDemandCommentDTO tDemandCommentDTO = gson.fromJson(jsonElement, TDemandCommentDTO.class); + if (tDemandCommentDTO != null) { + if (tDemandCommentDTO.getReject() != null && tDemandCommentDTO.getReject() == Boolean.TRUE) { // 存在被拒绝的节点 + tDemandCommentDTO.setDelFlag(1); + tDemandCommentService.update(tDemandCommentDTO); + logger.error("评论审核不通过不通过!申请id:" + tDemandCommentDTO.getId()); + } else { + tDemandCommentDTO.setDelFlag(0); + tDemandCommentService.update(tDemandCommentDTO); + logger.error("审批通过!评论id:" + tDemandCommentDTO.getId()); + } + } + } + + @Override + public void execute(DelegateExecution delegateExecution) throws Exception { + + } + + @Override + @ActivitiNoticeOperation(value = "评论审核", process = "评论审核流程") + public void notify(DelegateTask delegateTask) { + logger.error("事件类型:" + delegateTask.getEventName()); + final String eventName = delegateTask.getEventName(); + switch (eventName) { + case EVENTNAME_CREATE: + createEvent(delegateTask); + break; + default: + logger.error("未处理该事件:" + eventName); + } + } + + @Override + public void onEvent(ActivitiEvent activitiEvent) { + + } + + @Override + public boolean isFailOnException() { + return false; + } + + /** + * 节点创建时动态分配大数据局审批人 + * + * @param delegateTask + */ + private void createEvent(DelegateTask delegateTask) { + logger.error("大数据局名称:" + bigDateDeptName); + SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName); + logger.error("deptDTOId:" + deptDTO.getId()); + SysRoleDTO roleDTO = sysRoleService.getByName(roleName); + logger.error("roleDTOId:" + roleDTO.getId()); + SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId()); + + if (userDTO != null) { + logger.error("审批人id:" + userDTO.getId()); + taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString()); + } else { + delegateTask.setAssignee("1516728698224427010"); + logger.error("未查到该部门对应 " + roleName); + } + } +} diff --git a/renren-admin/src/main/java/io/renren/modules/demandComment/service/impl/TDemandCommentServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/demandComment/service/impl/TDemandCommentServiceImpl.java index 5a720728..9253d0e9 100644 --- a/renren-admin/src/main/java/io/renren/modules/demandComment/service/impl/TDemandCommentServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/demandComment/service/impl/TDemandCommentServiceImpl.java @@ -76,23 +76,30 @@ public class TDemandCommentServiceImpl extends CrudServiceImpl { // 发起人 - Optional tDemandDataDTO = Optional.ofNullable(tDemandDataService.get(tDemandCommentDTO.getTargetId())); - Optional sysUserDTO = Optional.ofNullable(sysUserService.get(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator() : null)); - String content = "【评论】" + (sysUserDTO.isPresent() ? sysUserDTO.get().getRealName() : "") + "您发起的需求 " + tDemandDataDTO.orElse(new TDemandDataDTO()).getDemandSubject() + "有新的评论,请前往查看详情"; - SysNoticeDTO dto = new SysNoticeDTO(); - dto.setType(2); - dto.setTitle("需求评论系统通知"); - dto.setContent(content); // 通知内容 - dto.setReceiverType(1); - dto.setReceiverTypeIds(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator().toString() : ""); - dto.setStatus(NoticeStatusEnum.SEND.value()); - dto.setSenderName("流程系统"); - dto.setSenderDate(new Date()); - dto.setCreator(sysUserService.getByUsername("admin").getId()); - dto.setCreateDate(new Date()); - dto.setFrom("评论"); - sysNoticeService.save(dto); - }); + } + + @Override + public void update(TDemandCommentDTO tDemandCommentDTO) { + super.update(tDemandCommentDTO); + if (tDemandCommentDTO.getDelFlag() == 0) { + CompletableFuture.runAsync(() -> { // 发起人 + Optional tDemandDataDTO = Optional.ofNullable(tDemandDataService.get(tDemandCommentDTO.getTargetId())); + Optional sysUserDTO = Optional.ofNullable(sysUserService.get(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator() : null)); + String content = "【评论】" + (sysUserDTO.isPresent() ? sysUserDTO.get().getRealName() : "") + "您发起的需求 " + tDemandDataDTO.orElse(new TDemandDataDTO()).getDemandSubject() + "有新的评论,请前往查看详情"; + SysNoticeDTO dto = new SysNoticeDTO(); + dto.setType(2); + dto.setTitle("需求评论系统通知"); + dto.setContent(content); // 通知内容 + dto.setReceiverType(1); + dto.setReceiverTypeIds(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator().toString() : ""); + dto.setStatus(NoticeStatusEnum.SEND.value()); + dto.setSenderName("流程系统"); + dto.setSenderDate(new Date()); + dto.setCreator(sysUserService.getByUsername("admin").getId()); + dto.setCreateDate(new Date()); + dto.setFrom("评论"); + sysNoticeService.save(dto); + }); + } } } \ No newline at end of file diff --git a/renren-admin/src/main/resources/db/V2.0__comment_add_col.sql b/renren-admin/src/main/resources/db/V2.0__comment_add_col.sql new file mode 100644 index 00000000..9423b926 --- /dev/null +++ b/renren-admin/src/main/resources/db/V2.0__comment_add_col.sql @@ -0,0 +1 @@ +ALTER TABLE `t_demand_comment` ADD COLUMN `instance_id` varchar(64) NULL COMMENT '流程实例ID'; \ No newline at end of file From d0cca3951c26b055966f8eb4a4a083081d1c0b1b Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 23 Jun 2022 15:21:44 +0800 Subject: [PATCH 10/26] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/renren/common/aspect/ActivitiNoticeAspect.java | 2 ++ .../java/io/renren/common/controller/CommentController.java | 4 ++-- .../java/io/renren/modules/notice/entity/SysNoticeEntity.java | 2 ++ .../modules/notice/service/impl/SysNoticeServiceImpl.java | 4 +++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java b/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java index 0e607ce0..a579cd85 100644 --- a/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java +++ b/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java @@ -333,6 +333,7 @@ public class ActivitiNoticeAspect { dto.setSenderDate(new Date()); dto.setCreator(sysUserService.getByUsername("admin").getId()); dto.setCreateDate(new Date()); + dto.setFrom("通知"); sysNoticeService.save(dto); }).thenRunAsync(() -> { // 审批者 SysUserDTO owner = sysUserService.get(Long.valueOf(finalCreator)); @@ -348,6 +349,7 @@ public class ActivitiNoticeAspect { dto.setSenderDate(new Date()); dto.setCreator(sysUserService.getByUsername("admin").getId()); dto.setCreateDate(new Date()); + dto.setFrom("通知"); sysNoticeService.save(dto); }).thenRunAsync(() -> { // 防止重放 new Thread(() -> { diff --git a/renren-admin/src/main/java/io/renren/common/controller/CommentController.java b/renren-admin/src/main/java/io/renren/common/controller/CommentController.java index eaacef34..d1af1715 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CommentController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CommentController.java @@ -26,7 +26,7 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.CompletableFuture; -@Api(tags = "") +@Api(tags = "评论审核") @RestController @RequestMapping("/comment/center") public class CommentController { @@ -88,7 +88,7 @@ public class CommentController { tDemandCommentDTO.setDelFlag(3); // 审核中 tDemandCommentService.update(tDemandCommentDTO); - + CompletableFuture.runAsync(() -> { if (Long.valueOf(dto.getBusinessKey()) != null) { jdbcTemplate.update(String.format("UPDATE t_demand_comment SET instance_id = '%s' WHERE id = %s", dto.getProcessInstanceId(), dto.getBusinessKey())); diff --git a/renren-admin/src/main/java/io/renren/modules/notice/entity/SysNoticeEntity.java b/renren-admin/src/main/java/io/renren/modules/notice/entity/SysNoticeEntity.java index 1054c815..2d702bea 100644 --- a/renren-admin/src/main/java/io/renren/modules/notice/entity/SysNoticeEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/notice/entity/SysNoticeEntity.java @@ -40,6 +40,7 @@ public class SysNoticeEntity extends BaseEntity { /** * 发送状态 0:草稿 1:已发布 */ + @TableField(value = "`status`") private Integer status; /** * 发送者 @@ -68,5 +69,6 @@ public class SysNoticeEntity extends BaseEntity { /** * 通知来源 (通知、评论、其他) */ + @TableField(value = "`from`") private String from; } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java index d4e46ee1..9dd35d46 100644 --- a/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java @@ -86,7 +86,9 @@ public class SysNoticeServiceImpl extends CrudServiceImpl Date: Thu, 23 Jun 2022 17:59:22 +0800 Subject: [PATCH 11/26] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/renren/common/aspect/ActivitiNoticeAspect.java | 1 + .../modules/notice/service/impl/SysNoticeServiceImpl.java | 2 +- .../modules/resource/service/impl/ResourceServiceImpl.java | 2 +- renren-admin/src/main/resources/domain/tsingtao-xha.properties | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java b/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java index a579cd85..4ee455ac 100644 --- a/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java +++ b/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java @@ -322,6 +322,7 @@ public class ActivitiNoticeAspect { SysUserDTO assignee = sysUserService.get(Long.valueOf(delegateTask.getAssignee())); logger.error("审核人:" + assignee.getId()); String content = "【通知】您发起的流程 " + activitiNoticeOperation.process() + " 当前审核节点为:" + activitiNoticeOperation.value() + ";当前审核人为:\"" + assignee.getDeptName() + "\"审核负责人\"" + assignee.getRealName() + "\""; + logger.info("通知内容:" + content); SysNoticeDTO dto = new SysNoticeDTO(); dto.setType(2); dto.setTitle("流程流转系统通知"); diff --git a/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java index 9dd35d46..447934b7 100644 --- a/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/notice/service/impl/SysNoticeServiceImpl.java @@ -83,7 +83,7 @@ public class SysNoticeServiceImpl extends CrudServiceImpl()); resultPage.setTotal(0); } diff --git a/renren-admin/src/main/resources/domain/tsingtao-xha.properties b/renren-admin/src/main/resources/domain/tsingtao-xha.properties index ad5a9cf2..5d6ae796 100644 --- a/renren-admin/src/main/resources/domain/tsingtao-xha.properties +++ b/renren-admin/src/main/resources/domain/tsingtao-xha.properties @@ -4,4 +4,4 @@ tsingtao-xha.cloudcam=http://10.10.30.9:8001/hx-weather-warning/camera/getCamera tsingtao-xha.localcam=http://10.134.135.9:8001/hx-weather-warning/camera/getCameraListByName?name=%s&pageNo=%d&pageSize=%d tsingtao-xha.resourcecount=http://10.16.3.224:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=&type=&orderField=requestNum&orderType=desc&pageNum=1&pageSize=10&serviceType=data&rq=1655106309671.43 tsingtao-xha.resourceapplyinfo=http://10.134.135.24:30058/shareportal/platform/index/abilityMarket/count -tsingtao-xha.sjzy=http://10.16.3.224:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=%s&type=&orderField=%s&orderType=%s&pageNum=%s&pageSize=%s&serviceType=data&rq=1655106309671.43 +tsingtao-xha.sjzy=http://10.16.3.224:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=%s&type=&orderField=%s&orderType=%s&pageNum=%s&pageSize=%s&serviceType=data&rq=1655106309671.43 \ No newline at end of file From 5e536dc8122bd3dbe79746e0ed12a391504e5a90 Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Thu, 23 Jun 2022 18:43:58 +0800 Subject: [PATCH 12/26] =?UTF-8?q?=E4=B8=80=E3=80=81=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=8D=87=E7=BA=A7=EF=BC=9A=201.=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=AE=B0=E5=BD=95=E6=96=B0=E5=A2=9E=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E5=AD=97=E6=AE=B5=202.=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=A2=9E=E5=8A=A0=E6=94=AF=E6=8C=81=E6=8C=89?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E4=BA=BA=EF=BC=8C=E6=93=8D=E4=BD=9C=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=8F=8A=E6=93=8D=E4=BD=9C=E5=90=8D=E7=A7=B0=E6=9D=A5?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=203.=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=8E=A5=E5=8F=A3=EF=BC=88=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=88=A0=E9=99=A4=EF=BC=89=20=E4=BA=8C=E3=80=81=E7=BB=99?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=96=B9=E6=B3=95=E5=8A=A0=E4=B8=8A=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=B3=A8=E8=A7=A3=E8=AE=B0=E5=BD=95=E6=97=A5=E5=BF=97?= =?UTF-8?q?=20=E4=B8=89=E3=80=81=E6=97=A5=E5=BF=97=E8=A1=A8sql=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/aspect/LogOperationAspect.java | 8 ++++---- .../controller/SysLogOperationController.java | 20 +++++++++++++++++-- .../log/entity/SysLogOperationEntity.java | 4 ++++ .../impl/SysLogOperationServiceImpl.java | 9 ++++++++- .../controller/ResourceController.java | 3 +++ .../resource/entity/ResourceEntity.java | 1 - .../security/controller/LoginController.java | 3 +++ .../db/V2.0__sys_log_operation_add_col.sql | 1 + .../java/io/renren/common/utils/Result.java | 9 +++++++++ 9 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 renren-admin/src/main/resources/db/V2.0__sys_log_operation_add_col.sql diff --git a/renren-admin/src/main/java/io/renren/common/aspect/LogOperationAspect.java b/renren-admin/src/main/java/io/renren/common/aspect/LogOperationAspect.java index 84bd889f..648156e5 100644 --- a/renren-admin/src/main/java/io/renren/common/aspect/LogOperationAspect.java +++ b/renren-admin/src/main/java/io/renren/common/aspect/LogOperationAspect.java @@ -42,24 +42,23 @@ public class LogOperationAspect { try { //执行方法 Object result = point.proceed(); - //执行时长(毫秒) long time = System.currentTimeMillis() - beginTime; //保存日志 - saveLog(point, time, OperationStatusEnum.SUCCESS.value()); + saveLog(point, time, OperationStatusEnum.SUCCESS.value(), result); return result; }catch(Exception e) { //执行时长(毫秒) long time = System.currentTimeMillis() - beginTime; //保存日志 - saveLog(point, time, OperationStatusEnum.FAIL.value()); + saveLog(point, time, OperationStatusEnum.FAIL.value(), null); throw e; } } - private void saveLog(ProceedingJoinPoint joinPoint, long time, Integer status) throws Exception { + private void saveLog(ProceedingJoinPoint joinPoint, long time, Integer status, Object result) throws Exception { MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Method method = joinPoint.getTarget().getClass().getDeclaredMethod(signature.getName(), signature.getParameterTypes()); LogOperation annotation = method.getAnnotation(LogOperation.class); @@ -78,6 +77,7 @@ public class LogOperationAspect { log.setStatus(status); log.setRequestTime((int)time); + log.setResultData(JSON.toJSONString(result)); //请求相关信息 HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); diff --git a/renren-admin/src/main/java/io/renren/modules/log/controller/SysLogOperationController.java b/renren-admin/src/main/java/io/renren/modules/log/controller/SysLogOperationController.java index 2aca3abc..0e317de5 100644 --- a/renren-admin/src/main/java/io/renren/modules/log/controller/SysLogOperationController.java +++ b/renren-admin/src/main/java/io/renren/modules/log/controller/SysLogOperationController.java @@ -12,7 +12,6 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; -import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -44,7 +43,11 @@ public class SysLogOperationController { @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , - @ApiImplicitParam(name = "status", value = "状态 0:失败 1:成功", paramType = "query", dataType="int") + @ApiImplicitParam(name = "status", value = "状态 0:失败 1:成功", paramType = "query", dataType="int"), + @ApiImplicitParam(name = "creatorName", value = "操作人", paramType = "query", dataType="String"), + @ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType="String"), + @ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType="String"), + @ApiImplicitParam(name = "operation", value = "操作名称", paramType = "query", dataType="String") }) // @RequiresPermissions("sys:log:operation") public Result> page(@ApiIgnore @RequestParam Map params){ @@ -53,6 +56,19 @@ public class SysLogOperationController { return new Result>().ok(page); } + + @GetMapping("/deleteByIds") + @ApiOperation("/删除操作记录") + @LogOperation("/删除操作记录") + public Result deleteByIds(List ids) { + try { + sysLogOperationService.deleteBatchIds(ids); + return new Result().ok(null); + } catch (Exception e) { + return new Result().error(e.getMessage()); + } + } + @GetMapping("export") @ApiOperation("导出") @LogOperation("导出") diff --git a/renren-admin/src/main/java/io/renren/modules/log/entity/SysLogOperationEntity.java b/renren-admin/src/main/java/io/renren/modules/log/entity/SysLogOperationEntity.java index 3b7899ed..df34bb34 100644 --- a/renren-admin/src/main/java/io/renren/modules/log/entity/SysLogOperationEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/log/entity/SysLogOperationEntity.java @@ -52,4 +52,8 @@ public class SysLogOperationEntity extends BaseEntity { * 用户名 */ private String creatorName; + /** + * 返回结果 + */ + private String resultData; } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/log/service/impl/SysLogOperationServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/log/service/impl/SysLogOperationServiceImpl.java index a1390bc1..501496fc 100644 --- a/renren-admin/src/main/java/io/renren/modules/log/service/impl/SysLogOperationServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/log/service/impl/SysLogOperationServiceImpl.java @@ -45,9 +45,16 @@ public class SysLogOperationServiceImpl extends BaseServiceImpl getWrapper(Map params) { String status = (String) params.get("status"); + String creatorName = (String) params.get("creatorName"); + String operation = (String) params.get("operation"); + String startDate = (String) params.get("startDate"); + String endDate = (String) params.get("endDate"); QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(status), "status", status); + wrapper.eq(StringUtils.isNotBlank(status), "status", status) + .eq(StringUtils.isNotBlank(creatorName), "creator_name", creatorName) + .like(StringUtils.isNotBlank(operation), "operation", operation) + .between(StringUtils.isNotBlank(startDate), "", startDate, endDate); return wrapper; } diff --git a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java index 697be96d..daea105a 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java @@ -105,6 +105,7 @@ public class ResourceController { @GetMapping("/page") @ApiOperation("分页查询资源信息") + @LogOperation("分页查询资源信息") @ApiImplicitParams({ @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType = "int"), @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"), @@ -416,6 +417,8 @@ public class ResourceController { */ @GetMapping("/hls/getHls") + @ApiOperation("获取hls地址") + @LogOperation("获取hls地址") public Result getHls(String key) { Optional factory = VideoPreviewFactory.build(); if (factory.isPresent()) { diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java index 92100b79..f4c9ffc6 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java @@ -87,7 +87,6 @@ public class ResourceEntity extends BaseEntity { * 删除标志:0:正常;1:已删除;9其他 */ private Integer delFlag; - /** * 修改人 */ diff --git a/renren-admin/src/main/java/io/renren/modules/security/controller/LoginController.java b/renren-admin/src/main/java/io/renren/modules/security/controller/LoginController.java index a95f1438..43552c1e 100644 --- a/renren-admin/src/main/java/io/renren/modules/security/controller/LoginController.java +++ b/renren-admin/src/main/java/io/renren/modules/security/controller/LoginController.java @@ -1,5 +1,6 @@ package io.renren.modules.security.controller; +import io.renren.common.annotation.LogOperation; import io.renren.common.constant.Constant; import io.renren.common.exception.ErrorCode; import io.renren.common.exception.RenException; @@ -74,6 +75,7 @@ public class LoginController { @GetMapping("login") @ApiOperation(value = "登录") + @LogOperation("登录") @ApiImplicitParams({ @ApiImplicitParam(name = "username", value = "登录名称", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "password", value = "密码", paramType = "query", required = true, dataType = "String"), @@ -150,6 +152,7 @@ public class LoginController { @PostMapping("logout") @ApiOperation(value = "退出") + @LogOperation("/退出") public Result logout(HttpServletRequest request, HttpServletResponse response) { UserDetail user = SecurityUser.getUser(); diff --git a/renren-admin/src/main/resources/db/V2.0__sys_log_operation_add_col.sql b/renren-admin/src/main/resources/db/V2.0__sys_log_operation_add_col.sql new file mode 100644 index 00000000..f47b6408 --- /dev/null +++ b/renren-admin/src/main/resources/db/V2.0__sys_log_operation_add_col.sql @@ -0,0 +1 @@ +ALTER TABLE sys_log_operation ADD COLUMN result_data text NULL COMMENT '返回结果'; \ No newline at end of file diff --git a/renren-common/src/main/java/io/renren/common/utils/Result.java b/renren-common/src/main/java/io/renren/common/utils/Result.java index 80f92bf7..216fa5e2 100644 --- a/renren-common/src/main/java/io/renren/common/utils/Result.java +++ b/renren-common/src/main/java/io/renren/common/utils/Result.java @@ -86,4 +86,13 @@ public class Result implements Serializable { public void setData(T data) { this.data = data; } + + @Override + public String toString() { + return "Result{" + + "code=" + code + + ", msg='" + msg + '\'' + + ", data=" + data + + '}'; + } } From 8ade5042267172cd27ceb7febdf9b82976328cd8 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 23 Jun 2022 18:44:14 +0800 Subject: [PATCH 13/26] =?UTF-8?q?=E6=9C=AA=E9=80=9A=E8=BF=87=E7=9A=84?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TDemandCommentServiceImpl.java | 3 +++ .../resources/mapper/demandComment/TDemandCommentDao.xml | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/demandComment/service/impl/TDemandCommentServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/demandComment/service/impl/TDemandCommentServiceImpl.java index 9253d0e9..7188712a 100644 --- a/renren-admin/src/main/java/io/renren/modules/demandComment/service/impl/TDemandCommentServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/demandComment/service/impl/TDemandCommentServiceImpl.java @@ -63,6 +63,9 @@ public class TDemandCommentServiceImpl extends CrudServiceImpl \ No newline at end of file From 4ac7dfecd3b6ab8f518f642c7487a67f26681782 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 23 Jun 2022 18:46:03 +0800 Subject: [PATCH 14/26] =?UTF-8?q?=E3=80=82=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..._operation_add_col.sql => V2.1__sys_log_operation_add_col.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename renren-admin/src/main/resources/db/{V2.0__sys_log_operation_add_col.sql => V2.1__sys_log_operation_add_col.sql} (100%) diff --git a/renren-admin/src/main/resources/db/V2.0__sys_log_operation_add_col.sql b/renren-admin/src/main/resources/db/V2.1__sys_log_operation_add_col.sql similarity index 100% rename from renren-admin/src/main/resources/db/V2.0__sys_log_operation_add_col.sql rename to renren-admin/src/main/resources/db/V2.1__sys_log_operation_add_col.sql From 3fbe2ea2ffaf92bcbda725200273d6c8e1eed5ab Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 23 Jun 2022 19:12:45 +0800 Subject: [PATCH 15/26] =?UTF-8?q?=E8=A5=BF=E6=B5=B7=E5=B2=B8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resource/service/impl/ResourceServiceImpl.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 41db710e..707177bb 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -257,12 +257,14 @@ public class ResourceServiceImpl extends CrudServiceImpl { // 云脑专网 OkHttpClient client = new OkHttpClient(); - String url = String.format(tsingtao_xhaProperties.getCloudcam(), resourceDTO.getName(), pageNum, pageSize); + String url = String.format(tsingtao_xhaProperties.getCloudcam(), org.apache.commons.lang3.StringUtils.isNotEmpty(resourceDTO.getName()) ? resourceDTO.getName() : "", pageNum, pageSize); logger.info(url); Request request = new Request.Builder().url(url).build(); try (Response response = client.newCall(request).execute()) { if (response.isSuccessful()) { - JSONObject jsonObject_ = JSON.parseObject(response.body().string()); + String body = response.body().string(); + JSONObject jsonObject_ = JSON.parseObject(body); + logger.info("西海岸接口返回:{}" + body, url); if (jsonObject_.containsKey("data")) { if (jsonObject_.getJSONObject("data").containsKey("list")) { resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total")); @@ -296,12 +298,14 @@ public class ResourceServiceImpl extends CrudServiceImpl { // 金宏网 OkHttpClient client = new OkHttpClient(); - String url = String.format(tsingtao_xhaProperties.getLocalcam(), resourceDTO.getName(), pageNum, pageSize); + String url = String.format(tsingtao_xhaProperties.getLocalcam(), org.apache.commons.lang3.StringUtils.isNotEmpty(resourceDTO.getName()) ? resourceDTO.getName() : "", pageNum, pageSize); logger.info(url); Request request = new Request.Builder().url(url).build(); try (Response response = client.newCall(request).execute()) { if (response.isSuccessful()) { - JSONObject jsonObject_ = JSON.parseObject(response.body().string()); + String body = response.body().string(); + JSONObject jsonObject_ = JSON.parseObject(body); + logger.info("西海岸接口返回:{}" + body, url); if (jsonObject_.containsKey("data")) { if (jsonObject_.getJSONObject("data").containsKey("list")) { resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total")); From f3d482707e6851542e8cdfab3bef291689ad6728 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 23 Jun 2022 20:03:10 +0800 Subject: [PATCH 16/26] ... --- .../modules/resource/service/impl/ResourceServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 707177bb..783a1cc9 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -325,7 +325,7 @@ public class ResourceServiceImpl extends CrudServiceImpl()); resultPage.setTotal(0); } From da8340d41eed9f720f36943096dfad4798b4fde1 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Thu, 23 Jun 2022 20:05:23 +0800 Subject: [PATCH 17/26] npe --- .../demandComment/service/impl/TDemandCommentServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/modules/demandComment/service/impl/TDemandCommentServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/demandComment/service/impl/TDemandCommentServiceImpl.java index 7188712a..70123568 100644 --- a/renren-admin/src/main/java/io/renren/modules/demandComment/service/impl/TDemandCommentServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/demandComment/service/impl/TDemandCommentServiceImpl.java @@ -64,7 +64,7 @@ public class TDemandCommentServiceImpl extends CrudServiceImpl Date: Thu, 23 Jun 2022 20:33:03 +0800 Subject: [PATCH 18/26] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E7=9A=84=E5=BE=85?= =?UTF-8?q?=E5=8A=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/activiti/service/ActTaskService.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java index ca15894b..6a82fb4f 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java @@ -10,6 +10,8 @@ import io.renren.common.utils.MessageUtils; import io.renren.modules.activiti.dto.TaskDTO; import io.renren.modules.demanData.dto.TDemandDataDTO; import io.renren.modules.demanData.service.TDemandDataService; +import io.renren.modules.demandComment.dto.TDemandCommentDTO; +import io.renren.modules.demandComment.service.TDemandCommentService; import io.renren.modules.processForm.dto.TAbilityApplicationDTO; import io.renren.modules.processForm.service.TAbilityApplicationService; import io.renren.modules.resource.dto.ResourceDTO; @@ -62,6 +64,9 @@ public class ActTaskService extends BaseServiceImpl { public static String Task_HANDLE_STATE_BACK = "back"; //回退 public static String Task_HANDLE_STATE_STOP = "stop"; //终止 + @Autowired + private TDemandCommentService tDemandCommentService; + @Autowired protected TaskService taskService; @Autowired @@ -166,6 +171,16 @@ public class ActTaskService extends BaseServiceImpl { listDto.add(dto); continue; } + + TDemandCommentDTO tDemandCommentDTO = tDemandCommentService.get(Long.valueOf(dto.getBusinessKey())); + if (tDemandCommentDTO != null) { + Map variables = oMapper.convertValue(tDemandCommentDTO, Map.class); + processVariable.putAll(variables); + processVariable.putAll(task.getProcessVariables()); + dto.setParams(processVariable); + listDto.add(dto); + continue; + } } return new PageData<>(listDto, (int) taskQuery.count()); } From 628e22eedc4ce112ce8edb7ba164c16e2541cd7c Mon Sep 17 00:00:00 2001 From: wangliwen Date: Fri, 24 Jun 2022 09:01:09 +0800 Subject: [PATCH 19/26] =?UTF-8?q?=E8=A5=BF=E6=B5=B7=E5=B2=B8=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResourceServiceImpl.java | 157 +++++++++--------- .../TsingtaoXHAVideoPreviewService.java | 68 ++++---- 2 files changed, 110 insertions(+), 115 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 783a1cc9..5a0f6df4 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -255,89 +255,88 @@ public class ResourceServiceImpl extends CrudServiceImpl { // 云脑专网 - OkHttpClient client = new OkHttpClient(); - String url = String.format(tsingtao_xhaProperties.getCloudcam(), org.apache.commons.lang3.StringUtils.isNotEmpty(resourceDTO.getName()) ? resourceDTO.getName() : "", pageNum, pageSize); - logger.info(url); - Request request = new Request.Builder().url(url).build(); - try (Response response = client.newCall(request).execute()) { - if (response.isSuccessful()) { - String body = response.body().string(); - JSONObject jsonObject_ = JSON.parseObject(body); - logger.info("西海岸接口返回:{}" + body, url); - if (jsonObject_.containsKey("data")) { - if (jsonObject_.getJSONObject("data").containsKey("list")) { - resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total")); - resultPage.setRecords(jsonObject_.getJSONObject("data").getJSONArray("list").stream().map(index -> (JSONObject) JSON.toJSON(index)).map(index -> { - ResourceDTO resourceDTO1 = new ResourceDTO(); - resourceDTO1.setId(Long.valueOf(index.getString("id"))); - resourceDTO1.setDelFlag(index.getIntValue("delFlag")); - resourceDTO1.setLink(index.getString("cameraIndexCode")); - resourceDTO1.setName(index.getString("name")); - resourceDTO1.setType("基础设施"); - try { - resourceDTO1.setCreateDate(sdf.parse(index.getString("createdTime"))); - } catch (ParseException e) { - logger.error("时间异常"); - resourceDTO1.setCreateDate(new Date()); - } - return resourceDTO1; - }).collect(Collectors.toList())); - } else { - resultPage.setRecords(new ArrayList<>()); - resultPage.setTotal(0); - } - + OkHttpClient client = new OkHttpClient(); + String url = String.format(tsingtao_xhaProperties.getCloudcam(), org.apache.commons.lang3.StringUtils.isNotEmpty(resourceDTO.getName()) ? resourceDTO.getName() : "", pageNum, pageSize); + logger.info(url); + Request request = new Request.Builder().url(url).build(); + try (Response response = client.newCall(request).execute()) { + if (response.isSuccessful()) { + String body = response.body().string(); + JSONObject jsonObject_ = JSON.parseObject(body); + logger.info("西海岸接口返回:{}" + body, url); + if (jsonObject_.containsKey("data")) { + if (jsonObject_.getJSONObject("data").containsKey("list")) { + resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total")); + resultPage.setRecords(jsonObject_.getJSONObject("data").getJSONArray("list").stream().map(index -> (JSONObject) JSON.toJSON(index)).map(index -> { + ResourceDTO resourceDTO1 = new ResourceDTO(); + resourceDTO1.setId(Long.valueOf(index.getString("id"))); + resourceDTO1.setDelFlag(index.getIntValue("delFlag")); + resourceDTO1.setLink(index.getString("cameraIndexCode")); + resourceDTO1.setName(index.getString("name")); + resourceDTO1.setType("基础设施"); + try { + resourceDTO1.setCreateDate(sdf.parse(index.getString("createdTime"))); + } catch (ParseException e) { + logger.error("时间异常"); + resourceDTO1.setCreateDate(new Date()); + } + return resourceDTO1; + }).collect(Collectors.toList())); + } else { + resultPage.setRecords(new ArrayList<>()); + resultPage.setTotal(0); } - } else { - logger.error("获取失败"); - } - } catch (Exception exception) { - logger.error("失败", exception); - } - }); - CompletableFuture local = CompletableFuture.runAsync(() -> { // 金宏网 - OkHttpClient client = new OkHttpClient(); - String url = String.format(tsingtao_xhaProperties.getLocalcam(), org.apache.commons.lang3.StringUtils.isNotEmpty(resourceDTO.getName()) ? resourceDTO.getName() : "", pageNum, pageSize); - logger.info(url); - Request request = new Request.Builder().url(url).build(); - try (Response response = client.newCall(request).execute()) { - if (response.isSuccessful()) { - String body = response.body().string(); - JSONObject jsonObject_ = JSON.parseObject(body); - logger.info("西海岸接口返回:{}" + body, url); - if (jsonObject_.containsKey("data")) { - if (jsonObject_.getJSONObject("data").containsKey("list")) { - resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total")); - resultPage.setRecords(jsonObject_.getJSONObject("data").getJSONArray("list").stream().map(index -> (JSONObject) JSON.toJSON(index)).map(index -> { - ResourceDTO resourceDTO1 = new ResourceDTO(); - resourceDTO1.setId(Long.valueOf(index.getString("id"))); - resourceDTO1.setDelFlag(index.getIntValue("delFlag")); - resourceDTO1.setLink(index.getString("cameraIndexCode")); - resourceDTO1.setName(index.getString("name")); - resourceDTO1.setType("基础设施"); - try { - resourceDTO1.setCreateDate(sdf.parse(index.getString("createdTime"))); - } catch (ParseException e) { - logger.error("时间异常"); - resourceDTO1.setCreateDate(new Date()); - } - return resourceDTO1; - }).collect(Collectors.toList())); - } else { - resultPage.setRecords(new ArrayList<>()); - resultPage.setTotal(0); - } - } - } else { - logger.error("获取失败"); } - } catch (Exception exception) { - logger.error("失败", exception); + } else { + logger.error("获取失败"); } - }); - CompletableFuture.allOf(cloud, local); + } catch (Exception exception) { + logger.error("失败", exception); + } +// }); +// CompletableFuture local = CompletableFuture.runAsync(() -> { // 金宏网 +// OkHttpClient client = new OkHttpClient(); +// String url = String.format(tsingtao_xhaProperties.getLocalcam(), org.apache.commons.lang3.StringUtils.isNotEmpty(resourceDTO.getName()) ? resourceDTO.getName() : "", pageNum, pageSize); +// logger.info(url); +// Request request = new Request.Builder().url(url).build(); +// try (Response response = client.newCall(request).execute()) { +// if (response.isSuccessful()) { +// String body = response.body().string(); +// JSONObject jsonObject_ = JSON.parseObject(body); +// logger.info("西海岸接口返回:{}" + body, url); +// if (jsonObject_.containsKey("data")) { +// if (jsonObject_.getJSONObject("data").containsKey("list")) { +// resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total")); +// resultPage.setRecords(jsonObject_.getJSONObject("data").getJSONArray("list").stream().map(index -> (JSONObject) JSON.toJSON(index)).map(index -> { +// ResourceDTO resourceDTO1 = new ResourceDTO(); +// resourceDTO1.setId(Long.valueOf(index.getString("id"))); +// resourceDTO1.setDelFlag(index.getIntValue("delFlag")); +// resourceDTO1.setLink(index.getString("cameraIndexCode")); +// resourceDTO1.setName(index.getString("name")); +// resourceDTO1.setType("基础设施"); +// try { +// resourceDTO1.setCreateDate(sdf.parse(index.getString("createdTime"))); +// } catch (ParseException e) { +// logger.error("时间异常"); +// resourceDTO1.setCreateDate(new Date()); +// } +// return resourceDTO1; +// }).collect(Collectors.toList())); +// } else { +// resultPage.setRecords(new ArrayList<>()); +// resultPage.setTotal(0); +// } +// +// } +// } else { +// logger.error("获取失败"); +// } +// } catch (Exception exception) { +// logger.error("失败", exception); +// } +// }); +// CompletableFuture.allOf(cloud, local); } else { logger.info("西海岸基普通"); if (resourceDTO.getInfoList().isEmpty()) { diff --git a/renren-admin/src/main/java/io/renren/modules/resource/videoPreview/domain/TsingtaoXHAVideoPreviewService.java b/renren-admin/src/main/java/io/renren/modules/resource/videoPreview/domain/TsingtaoXHAVideoPreviewService.java index bb6b68fe..20faf60f 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/videoPreview/domain/TsingtaoXHAVideoPreviewService.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/videoPreview/domain/TsingtaoXHAVideoPreviewService.java @@ -12,7 +12,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.CopyOnWriteArrayList; @@ -36,41 +35,38 @@ public class TsingtaoXHAVideoPreviewService extends AbstractVideoPreviewService @Override public String getHls(String key) { List result = new CopyOnWriteArrayList<>(); - CompletableFuture cloud = - CompletableFuture.runAsync(() -> { // 云脑专网 - OkHttpClient client = new OkHttpClient(); - Request request = new Request.Builder().url(String.format(tsingtao_xhaProperties.getCloudhls(), key)).build(); - try (Response response = client.newCall(request).execute()) { - if (response.isSuccessful()) { - JSONObject jsonObject = JSON.parseObject(response.body().string()); - if (jsonObject.containsKey("data")) { - result.add(jsonObject.getString("data")); - } - } else { - logger.error("西海岸预览地址获取失败"); - } - } catch (Exception exception) { - logger.error("西海岸预览地址获取失败", exception); - } - }); - CompletableFuture local = - CompletableFuture.runAsync(() -> { // 金宏网 - OkHttpClient client = new OkHttpClient(); - Request request = new Request.Builder().url(String.format(tsingtao_xhaProperties.getLocalhls(), key)).build(); - try (Response response = client.newCall(request).execute()) { - if (response.isSuccessful()) { - JSONObject jsonObject = JSON.parseObject(response.body().string()); - if (jsonObject.containsKey("data")) { - result.add(jsonObject.getString("data")); - } - } else { - logger.error("西海岸预览地址获取失败"); - } - } catch (Exception exception) { - logger.error("西海案预览地址获取失败", exception); - } - }); - CompletableFuture.allOf(cloud, local); + + OkHttpClient client = new OkHttpClient(); + Request request = new Request.Builder().url(String.format(tsingtao_xhaProperties.getCloudhls(), key)).build(); + try (Response response = client.newCall(request).execute()) { + if (response.isSuccessful()) { + JSONObject jsonObject = JSON.parseObject(response.body().string()); + if (jsonObject.containsKey("data")) { + result.add(jsonObject.getString("data")); + } + } else { + logger.error("西海岸预览地址获取失败"); + } + } catch (Exception exception) { + logger.error("西海岸预览地址获取失败", exception); + } +// CompletableFuture local = +// CompletableFuture.runAsync(() -> { // 金宏网 +// OkHttpClient client = new OkHttpClient(); +// Request request = new Request.Builder().url(String.format(tsingtao_xhaProperties.getLocalhls(), key)).build(); +// try (Response response = client.newCall(request).execute()) { +// if (response.isSuccessful()) { +// JSONObject jsonObject = JSON.parseObject(response.body().string()); +// if (jsonObject.containsKey("data")) { +// result.add(jsonObject.getString("data")); +// } +// } else { +// logger.error("西海岸预览地址获取失败"); +// } +// } catch (Exception exception) { +// logger.error("西海案预览地址获取失败", exception); +// } +// }); return result.stream().filter(index -> StringUtils.isNotEmpty(index)).findAny().orElse(null); } } From 6f960da803ae598870a8f6623325745f62c79ec6 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Fri, 24 Jun 2022 09:20:34 +0800 Subject: [PATCH 20/26] =?UTF-8?q?=E3=80=82=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResourceServiceImpl.java | 43 ------------------- .../TsingtaoXHAVideoPreviewService.java | 17 -------- 2 files changed, 60 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 5a0f6df4..82999487 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -294,49 +294,6 @@ public class ResourceServiceImpl extends CrudServiceImpl { // 金宏网 -// OkHttpClient client = new OkHttpClient(); -// String url = String.format(tsingtao_xhaProperties.getLocalcam(), org.apache.commons.lang3.StringUtils.isNotEmpty(resourceDTO.getName()) ? resourceDTO.getName() : "", pageNum, pageSize); -// logger.info(url); -// Request request = new Request.Builder().url(url).build(); -// try (Response response = client.newCall(request).execute()) { -// if (response.isSuccessful()) { -// String body = response.body().string(); -// JSONObject jsonObject_ = JSON.parseObject(body); -// logger.info("西海岸接口返回:{}" + body, url); -// if (jsonObject_.containsKey("data")) { -// if (jsonObject_.getJSONObject("data").containsKey("list")) { -// resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total")); -// resultPage.setRecords(jsonObject_.getJSONObject("data").getJSONArray("list").stream().map(index -> (JSONObject) JSON.toJSON(index)).map(index -> { -// ResourceDTO resourceDTO1 = new ResourceDTO(); -// resourceDTO1.setId(Long.valueOf(index.getString("id"))); -// resourceDTO1.setDelFlag(index.getIntValue("delFlag")); -// resourceDTO1.setLink(index.getString("cameraIndexCode")); -// resourceDTO1.setName(index.getString("name")); -// resourceDTO1.setType("基础设施"); -// try { -// resourceDTO1.setCreateDate(sdf.parse(index.getString("createdTime"))); -// } catch (ParseException e) { -// logger.error("时间异常"); -// resourceDTO1.setCreateDate(new Date()); -// } -// return resourceDTO1; -// }).collect(Collectors.toList())); -// } else { -// resultPage.setRecords(new ArrayList<>()); -// resultPage.setTotal(0); -// } -// -// } -// } else { -// logger.error("获取失败"); -// } -// } catch (Exception exception) { -// logger.error("失败", exception); -// } -// }); -// CompletableFuture.allOf(cloud, local); } else { logger.info("西海岸基普通"); if (resourceDTO.getInfoList().isEmpty()) { diff --git a/renren-admin/src/main/java/io/renren/modules/resource/videoPreview/domain/TsingtaoXHAVideoPreviewService.java b/renren-admin/src/main/java/io/renren/modules/resource/videoPreview/domain/TsingtaoXHAVideoPreviewService.java index 20faf60f..0b97be63 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/videoPreview/domain/TsingtaoXHAVideoPreviewService.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/videoPreview/domain/TsingtaoXHAVideoPreviewService.java @@ -50,23 +50,6 @@ public class TsingtaoXHAVideoPreviewService extends AbstractVideoPreviewService } catch (Exception exception) { logger.error("西海岸预览地址获取失败", exception); } -// CompletableFuture local = -// CompletableFuture.runAsync(() -> { // 金宏网 -// OkHttpClient client = new OkHttpClient(); -// Request request = new Request.Builder().url(String.format(tsingtao_xhaProperties.getLocalhls(), key)).build(); -// try (Response response = client.newCall(request).execute()) { -// if (response.isSuccessful()) { -// JSONObject jsonObject = JSON.parseObject(response.body().string()); -// if (jsonObject.containsKey("data")) { -// result.add(jsonObject.getString("data")); -// } -// } else { -// logger.error("西海岸预览地址获取失败"); -// } -// } catch (Exception exception) { -// logger.error("西海案预览地址获取失败", exception); -// } -// }); return result.stream().filter(index -> StringUtils.isNotEmpty(index)).findAny().orElse(null); } } From 162e2ec97fa299a2bc196c94900306ebd49bad5f Mon Sep 17 00:00:00 2001 From: liyongbo2 Date: Fri, 24 Jun 2022 09:40:23 +0800 Subject: [PATCH 21/26] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E5=92=8C=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E4=B8=8E=E5=85=B6=E4=BB=96=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=85=B3=E8=81=94=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TbProjectContribController.java | 16 +- .../controller/TbProjectController.java | 18 ++- .../controller/TbProjectUseController.java | 16 +- .../impl/TbProjectContribServiceImpl.java | 6 + .../service/impl/TbProjectServiceImpl.java | 12 ++ .../service/impl/TbProjectUseServiceImpl.java | 6 + .../TbDataResourceRelController.java | 146 ++++++++++++++++++ .../resource/dao/TbDataResourceRelDao.java | 36 +++++ .../resource/dto/TbDataResourceRelDTO.java | 44 ++++++ .../entity/TbDataResourceRelEntity.java | 62 ++++++++ .../excel/TbDataResourceRelExcel.java | 37 +++++ .../service/TbDataResourceRelService.java | 23 +++ .../impl/TbDataResourceRelServiceImpl.java | 129 ++++++++++++++++ .../mapper/resource/TbDataResourceRelDao.xml | 106 +++++++++++++ 14 files changed, 636 insertions(+), 21 deletions(-) create mode 100644 renren-admin/src/main/java/io/renren/modules/resource/controller/TbDataResourceRelController.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resource/dao/TbDataResourceRelDao.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resource/dto/TbDataResourceRelDTO.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resource/entity/TbDataResourceRelEntity.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resource/excel/TbDataResourceRelExcel.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resource/service/TbDataResourceRelService.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resource/service/impl/TbDataResourceRelServiceImpl.java create mode 100644 renren-admin/src/main/resources/mapper/resource/TbDataResourceRelDao.xml diff --git a/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectContribController.java b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectContribController.java index e5b396ef..4ef98c37 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectContribController.java +++ b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectContribController.java @@ -46,9 +46,11 @@ public class TbProjectContribController { @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , - @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String"), + @ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType="String"), + @ApiImplicitParam(name = "resourceName", value = "应用名称", paramType = "query", dataType="String") }) - @RequiresPermissions("project:tbprojectcontrib:page") +// @RequiresPermissions("project:tbprojectcontrib:page") public Result> page(@ApiIgnore @RequestParam Map params){ PageData page = tbProjectContribService.page(params); @@ -57,7 +59,7 @@ public class TbProjectContribController { @GetMapping("{id}") @ApiOperation("信息") - @RequiresPermissions("project:tbprojectcontrib:info") +// @RequiresPermissions("project:tbprojectcontrib:info") public Result get(@PathVariable("id") Long id){ TbProjectContribDTO data = tbProjectContribService.get(id); @@ -67,7 +69,7 @@ public class TbProjectContribController { @PostMapping @ApiOperation("保存") @LogOperation("保存") - @RequiresPermissions("project:tbprojectcontrib:save") +// @RequiresPermissions("project:tbprojectcontrib:save") public Result save(@RequestBody TbProjectContribDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); @@ -80,7 +82,7 @@ public class TbProjectContribController { @PutMapping @ApiOperation("修改") @LogOperation("修改") - @RequiresPermissions("project:tbprojectcontrib:update") +// @RequiresPermissions("project:tbprojectcontrib:update") public Result update(@RequestBody TbProjectContribDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); @@ -93,7 +95,7 @@ public class TbProjectContribController { @DeleteMapping @ApiOperation("删除") @LogOperation("删除") - @RequiresPermissions("project:tbprojectcontrib:delete") +// @RequiresPermissions("project:tbprojectcontrib:delete") public Result delete(@RequestBody Long[] ids){ //效验数据 AssertUtils.isArrayEmpty(ids, "id"); @@ -106,7 +108,7 @@ public class TbProjectContribController { @GetMapping("export") @ApiOperation("导出") @LogOperation("导出") - @RequiresPermissions("project:tbprojectcontrib:export") +// @RequiresPermissions("project:tbprojectcontrib:export") public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { List list = tbProjectContribService.list(params); diff --git a/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectController.java b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectController.java index ba5812d0..17392c76 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectController.java +++ b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectController.java @@ -46,9 +46,13 @@ public class TbProjectController { @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , - @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String"), + @ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType="String"), + @ApiImplicitParam(name = "applyDep", value = "申请单位", paramType = "query", dataType="String"), + @ApiImplicitParam(name = "respDep", value = "责任处室", paramType = "query", dataType="String"), + @ApiImplicitParam(name = "applyTime", value = "申请日期", paramType = "query", dataType="String") }) - @RequiresPermissions("project:tbproject:page") +// @RequiresPermissions("project:tbproject:page") public Result> page(@ApiIgnore @RequestParam Map params){ PageData page = tbProjectService.page(params); @@ -57,7 +61,7 @@ public class TbProjectController { @GetMapping("{id}") @ApiOperation("信息") - @RequiresPermissions("project:tbproject:info") +// @RequiresPermissions("project:tbproject:info") public Result get(@PathVariable("id") Long id){ TbProjectDTO data = tbProjectService.get(id); @@ -67,7 +71,7 @@ public class TbProjectController { @PostMapping @ApiOperation("保存") @LogOperation("保存") - @RequiresPermissions("project:tbproject:save") +// @RequiresPermissions("project:tbproject:save") public Result save(@RequestBody TbProjectDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); @@ -80,7 +84,7 @@ public class TbProjectController { @PutMapping @ApiOperation("修改") @LogOperation("修改") - @RequiresPermissions("project:tbproject:update") +// @RequiresPermissions("project:tbproject:update") public Result update(@RequestBody TbProjectDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); @@ -93,7 +97,7 @@ public class TbProjectController { @DeleteMapping @ApiOperation("删除") @LogOperation("删除") - @RequiresPermissions("project:tbproject:delete") +// @RequiresPermissions("project:tbproject:delete") public Result delete(@RequestBody Long[] ids){ //效验数据 AssertUtils.isArrayEmpty(ids, "id"); @@ -106,7 +110,7 @@ public class TbProjectController { @GetMapping("export") @ApiOperation("导出") @LogOperation("导出") - @RequiresPermissions("project:tbproject:export") +// @RequiresPermissions("project:tbproject:export") public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { List list = tbProjectService.list(params); diff --git a/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectUseController.java b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectUseController.java index c943f87b..112317cc 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectUseController.java +++ b/renren-admin/src/main/java/io/renren/modules/project/controller/TbProjectUseController.java @@ -46,9 +46,11 @@ public class TbProjectUseController { @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , - @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String"), + @ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType="String"), + @ApiImplicitParam(name = "resourceName", value = "应用名称", paramType = "query", dataType="String") }) - @RequiresPermissions("project:tbprojectuse:page") +// @RequiresPermissions("project:tbprojectuse:page") public Result> page(@ApiIgnore @RequestParam Map params){ PageData page = tbProjectUseService.page(params); @@ -57,7 +59,7 @@ public class TbProjectUseController { @GetMapping("{id}") @ApiOperation("信息") - @RequiresPermissions("project:tbprojectuse:info") +// @RequiresPermissions("project:tbprojectuse:info") public Result get(@PathVariable("id") Long id){ TbProjectUseDTO data = tbProjectUseService.get(id); @@ -67,7 +69,7 @@ public class TbProjectUseController { @PostMapping @ApiOperation("保存") @LogOperation("保存") - @RequiresPermissions("project:tbprojectuse:save") +// @RequiresPermissions("project:tbprojectuse:save") public Result save(@RequestBody TbProjectUseDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); @@ -80,7 +82,7 @@ public class TbProjectUseController { @PutMapping @ApiOperation("修改") @LogOperation("修改") - @RequiresPermissions("project:tbprojectuse:update") +// @RequiresPermissions("project:tbprojectuse:update") public Result update(@RequestBody TbProjectUseDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); @@ -93,7 +95,7 @@ public class TbProjectUseController { @DeleteMapping @ApiOperation("删除") @LogOperation("删除") - @RequiresPermissions("project:tbprojectuse:delete") +// @RequiresPermissions("project:tbprojectuse:delete") public Result delete(@RequestBody Long[] ids){ //效验数据 AssertUtils.isArrayEmpty(ids, "id"); @@ -106,7 +108,7 @@ public class TbProjectUseController { @GetMapping("export") @ApiOperation("导出") @LogOperation("导出") - @RequiresPermissions("project:tbprojectuse:export") +// @RequiresPermissions("project:tbprojectuse:export") public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { List list = tbProjectUseService.list(params); diff --git a/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectContribServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectContribServiceImpl.java index 7047662d..310700f1 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectContribServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectContribServiceImpl.java @@ -26,6 +26,12 @@ public class TbProjectContribServiceImpl extends CrudServiceImpl getWrapper(Map params){ QueryWrapper wrapper = new QueryWrapper<>(); + if(params.containsKey("projectName") && StringUtils.isNotBlank(params.get("projectName").toString())){ + wrapper.like("project_name",params.get("projectName")); + } + if(params.containsKey("resourceName") && StringUtils.isNotBlank(params.get("resourceName").toString())){ + wrapper.like("resource_name",params.get("resourceName")); + } return wrapper; } diff --git a/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectServiceImpl.java index 064adc22..085f06a1 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectServiceImpl.java @@ -26,6 +26,18 @@ public class TbProjectServiceImpl extends CrudServiceImpl getWrapper(Map params){ QueryWrapper wrapper = new QueryWrapper<>(); + if(params.containsKey("projectName") && StringUtils.isNotBlank(params.get("projectName").toString())){ + wrapper.like("project_name",params.get("projectName")); + } + if(params.containsKey("applyDep") && StringUtils.isNotBlank(params.get("applyDep").toString())){ + wrapper.like("apply_dep",params.get("applyDep")); + } + if(params.containsKey("respDep") && StringUtils.isNotBlank(params.get("respDep").toString())){ + wrapper.like("resp_dep",params.get("respDep")); + } + if(params.containsKey("applyTime") && StringUtils.isNotBlank(params.get("applyTime").toString())){ + wrapper.apply("DATE_FORMAT(apply_time,'%Y-%m-%d') = {0}",params.get("applyTime").toString()); + } return wrapper; } diff --git a/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectUseServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectUseServiceImpl.java index 24c6f6bb..5b5f59ce 100644 --- a/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectUseServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/project/service/impl/TbProjectUseServiceImpl.java @@ -26,6 +26,12 @@ public class TbProjectUseServiceImpl extends CrudServiceImpl getWrapper(Map params){ QueryWrapper wrapper = new QueryWrapper<>(); + if(params.containsKey("projectName") && StringUtils.isNotBlank(params.get("projectName").toString())){ + wrapper.like("project_name",params.get("projectName")); + } + if(params.containsKey("resourceName") && StringUtils.isNotBlank(params.get("resourceName").toString())){ + wrapper.like("resource_name",params.get("resourceName")); + } return wrapper; } diff --git a/renren-admin/src/main/java/io/renren/modules/resource/controller/TbDataResourceRelController.java b/renren-admin/src/main/java/io/renren/modules/resource/controller/TbDataResourceRelController.java new file mode 100644 index 00000000..5b2b05ac --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resource/controller/TbDataResourceRelController.java @@ -0,0 +1,146 @@ +package io.renren.modules.resource.controller; + +import com.alibaba.fastjson.JSONObject; +import io.renren.common.annotation.LogOperation; +import io.renren.common.constant.Constant; +import io.renren.common.page.PageData; +import io.renren.common.utils.ExcelUtils; +import io.renren.common.utils.Result; +import io.renren.common.validator.AssertUtils; +import io.renren.common.validator.ValidatorUtils; +import io.renren.common.validator.group.AddGroup; +import io.renren.common.validator.group.DefaultGroup; +import io.renren.common.validator.group.UpdateGroup; +import io.renren.modules.resource.dto.TbDataResourceRelDTO; +import io.renren.modules.resource.excel.TbDataResourceRelExcel; +import io.renren.modules.resource.service.TbDataResourceRelService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** +* 组件-应用资源关系表 +* +* @author Mark sunlightcs@gmail.com +* @since 3.0 2022-06-21 +*/ +@RestController +@RequestMapping("/dataResourceRel") +@Api(tags="组件-应用资源关系表") +public class TbDataResourceRelController { + @Autowired + private TbDataResourceRelService tbDataResourceRelService; + + @GetMapping("/page") + @ApiOperation("分页") + @ApiImplicitParams({ + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") + }) +// @RequiresPermissions("dataResourceRel:tbdataresourcerel:page") + public Result> page(@ApiIgnore @RequestParam Map params){ + PageData page = tbDataResourceRelService.page(params); + + return new Result>().ok(page); + } + + @GetMapping("/select/{id}") + @ApiOperation("信息") +// @RequiresPermissions("dataResourceRel:tbdataresourcerel:info") + public Result get(@PathVariable("id") Long id){ + TbDataResourceRelDTO data = tbDataResourceRelService.get(id); + + return new Result().ok(data); + } + + @PostMapping("/insert") + @ApiOperation("保存") + @LogOperation("保存") +// @RequiresPermissions("dataResourceRel:tbdataresourcerel:save") + public Result save(@RequestBody TbDataResourceRelDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + + tbDataResourceRelService.save(dto); + + return new Result(); + } + + @PutMapping("/ubdate") + @ApiOperation("修改") + @LogOperation("修改") +// @RequiresPermissions("dataResourceRel:tbdataresourcerel:update") + public Result update(@RequestBody TbDataResourceRelDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + + tbDataResourceRelService.update(dto); + + return new Result(); + } + + @DeleteMapping("/delete") + @ApiOperation("删除") + @LogOperation("删除") +// @RequiresPermissions("dataResourceRel:tbdataresourcerel:delete") + public Result delete(@RequestBody Long[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + + tbDataResourceRelService.delete(ids); + + return new Result(); + } + + @GetMapping("/export") + @ApiOperation("导出") + @LogOperation("导出") +// @RequiresPermissions("dataResourceRel:tbdataresourcerel:export") + public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { + List list = tbDataResourceRelService.list(params); + + ExcelUtils.exportExcelToTarget(response, null, "组件-应用资源关系表", list, TbDataResourceRelExcel.class); + } + + @GetMapping("/queryApplicationRelByResourceId") + @ApiOperation("根据资源id查询应用关联情况") + @LogOperation("根据资源id查询应用关联情况") + public Result queryApplicationRelByResourceId(@RequestParam("referenceId") Long referenceId, + @RequestParam(value = "keyName",required = false) String keyName){ + Object data = tbDataResourceRelService.queryApplicationRelByResourceId(referenceId,keyName); + + return new Result().ok(data); + } + + @GetMapping("/queryResourceRelByKeyId") + @ApiOperation("根据应用id和资源类型查询资源管理情况") + @LogOperation("根据应用id和资源类型查询资源管理情况") + public Result queryResourceRelByKeyId(@RequestParam("keyId") Long keyId, + @RequestParam("type") String type, + @RequestParam(value = "referenceName" ,required = false) String referenceName){ + Object data = tbDataResourceRelService.queryResourceRelByKeyId(keyId,type,referenceName); + + return new Result().ok(data); + } + + @PostMapping("/saveDataResourceRel") + @ApiOperation("保存应用与组件的关联关系") + @LogOperation("保存应用与组件的关联关系") + public Result saveDataResourceRel(@RequestBody JSONObject param){ + Object data = tbDataResourceRelService.saveDataResourceRel(param); + + return new Result().ok(data); + } +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dao/TbDataResourceRelDao.java b/renren-admin/src/main/java/io/renren/modules/resource/dao/TbDataResourceRelDao.java new file mode 100644 index 00000000..f68d3530 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resource/dao/TbDataResourceRelDao.java @@ -0,0 +1,36 @@ +package io.renren.modules.resource.dao; + +import io.renren.common.dao.BaseDao; +import io.renren.modules.resource.entity.TbDataResourceRelEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** +* 组件-应用资源关系表 +* +* @author Mark sunlightcs@gmail.com +* @since 3.0 2022-06-21 +*/ +@Mapper +public interface TbDataResourceRelDao extends BaseDao { + + List getAlreadLinkedApplication(@Param("referenceId") Long referenceId,@Param("keyName") String keyName); + + List getNotLinkedApplication(@Param("referenceId")Long referenceId,@Param("keyName") String keyName); + + List getAlreadLinkedResource(@Param("keyId")Long keyId,@Param("type") String type,@Param("referenceName") String referenceName); + + List getNotLinkedResource(@Param("keyId")Long keyId,@Param("type") String type,@Param("referenceName") String referenceName); + + void deleteAllByKeyId(@Param("keyId")Long id, @Param("userId") Long userId,@Param("updateDate") Date updateDate); + + void deleteAllByreferenceId(@Param("referenceId")Long id, @Param("userId")Long userId,@Param("updateDate")Date updateDate); + + List getAlreadLinkedProject(@Param("keyId")Long keyId,@Param("projectName") String projectName); + + List getNotLinkedProject(@Param("keyId")Long keyId,@Param("projectName") String projectName); +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dto/TbDataResourceRelDTO.java b/renren-admin/src/main/java/io/renren/modules/resource/dto/TbDataResourceRelDTO.java new file mode 100644 index 00000000..9afca57a --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resource/dto/TbDataResourceRelDTO.java @@ -0,0 +1,44 @@ +package io.renren.modules.resource.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* 组件-应用资源关系表 +* +* @author Mark sunlightcs@gmail.com +* @since 3.0 2022-06-21 +*/ +@Data +@ApiModel(value = "组件-应用资源关系表") +public class TbDataResourceRelDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "应用资源id") + private Long keyId; + @ApiModelProperty(value = "关联id") + private Long referenceId; + @ApiModelProperty(value = "删除标志:0:正常;1:已删除;2:待审核;3:审核中;9其他") + private Integer delFlag; + @ApiModelProperty(value = "创建人") + private Long creator; + @ApiModelProperty(value = "创建时间") + private Date createDate; + @ApiModelProperty(value = "修改人") + private Long updater; + @ApiModelProperty(value = "修改时间") + private Date updateDate; + @ApiModelProperty(value = "id") + private Long id; + + //新增展示字段 + @ApiModelProperty(value = "应用资源名称") + private String keyName; + @ApiModelProperty(value = "关联资源名称") + private String referenceName; + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/TbDataResourceRelEntity.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/TbDataResourceRelEntity.java new file mode 100644 index 00000000..a948fc39 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/TbDataResourceRelEntity.java @@ -0,0 +1,62 @@ +package io.renren.modules.resource.entity; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.*; +import java.util.Date; + +/** + * 组件-应用资源关系表 + * + * @author Mark sunlightcs@gmail.com + * @since 3.0 2022-06-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tb_data_resource_rel") +public class TbDataResourceRelEntity { + private static final long serialVersionUID = 1L; + + /** + * 应用资源id + */ + private Long keyId; + /** + * 关联id + */ + private Long referenceId; + /** + * 删除标志: +0:正常; +1:已删除; +2:待审核; +3:审核中; +9其他 + */ + private Integer delFlag; + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + private Long creator; + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createDate; + /** + * 修改人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updater; + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateDate; + /** + * id + */ + @TableId + private Long id; +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/excel/TbDataResourceRelExcel.java b/renren-admin/src/main/java/io/renren/modules/resource/excel/TbDataResourceRelExcel.java new file mode 100644 index 00000000..c8a5e672 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resource/excel/TbDataResourceRelExcel.java @@ -0,0 +1,37 @@ +package io.renren.modules.resource.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import lombok.Data; +import java.util.Date; + +/** + * 组件-应用资源关系表 + * + * @author Mark sunlightcs@gmail.com + * @since 3.0 2022-06-21 + */ +@Data +@ContentRowHeight(20) +@HeadRowHeight(20) +@ColumnWidth(25) +public class TbDataResourceRelExcel { + @ExcelProperty(value = "应用资源id", index = 0) + private Long keyId; + @ExcelProperty(value = "关联id", index = 1) + private Long referenceId; + @ExcelProperty(value = "删除标志:0:正常;1:已删除;2:待审核;3:审核中;9其他", index = 2) + private Integer delFlag; + @ExcelProperty(value = "创建人", index = 3) + private Long creator; + @ExcelProperty(value = "创建时间", index = 4) + private Date createDate; + @ExcelProperty(value = "修改人", index = 5) + private Long updater; + @ExcelProperty(value = "修改时间", index = 6) + private Date updateDate; + @ExcelProperty(value = "id", index = 7) + private Long id; +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/TbDataResourceRelService.java b/renren-admin/src/main/java/io/renren/modules/resource/service/TbDataResourceRelService.java new file mode 100644 index 00000000..5b5a7f6b --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/TbDataResourceRelService.java @@ -0,0 +1,23 @@ +package io.renren.modules.resource.service; + +import com.alibaba.fastjson.JSONObject; +import io.renren.common.service.CrudService; +import io.renren.modules.resource.dto.TbDataResourceRelDTO; +import io.renren.modules.resource.entity.TbDataResourceRelEntity; + +import java.util.List; + +/** + * 组件-应用资源关系表 + * + * @author Mark sunlightcs@gmail.com + * @since 3.0 2022-06-21 + */ +public interface TbDataResourceRelService extends CrudService { + + Object queryApplicationRelByResourceId(Long referenceId, String keyName); + + Object queryResourceRelByKeyId(Long keyId, String type, String referenceName); + + Object saveDataResourceRel(JSONObject param); +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/TbDataResourceRelServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/TbDataResourceRelServiceImpl.java new file mode 100644 index 00000000..1b2d0408 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/TbDataResourceRelServiceImpl.java @@ -0,0 +1,129 @@ +package io.renren.modules.resource.service.impl; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.renren.common.service.impl.CrudServiceImpl; +import io.renren.common.constant.Constant; +import io.renren.modules.resource.dao.TbDataResourceRelDao; +import io.renren.modules.resource.dto.TbDataResourceRelDTO; +import io.renren.modules.resource.entity.TbDataResourceRelEntity; +import io.renren.modules.resource.service.TbDataResourceRelService; +import io.renren.modules.security.user.SecurityUser; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; + +/** + * 组件-应用资源关系表 + * + * @author Mark sunlightcs@gmail.com + * @since 3.0 2022-06-21 + */ +@Service +public class TbDataResourceRelServiceImpl extends CrudServiceImpl implements TbDataResourceRelService { + + @Autowired + private TbDataResourceRelDao tbDataResourceRelDao; + + + @Override + public QueryWrapper getWrapper(Map params){ + QueryWrapper wrapper = new QueryWrapper<>(); + + + return wrapper; + } + + + @Override + public Object queryApplicationRelByResourceId(Long referenceId, String keyName) { + Map result = new HashMap<>(); + //查询已关联的应用 + List alreadLinked = tbDataResourceRelDao.getAlreadLinkedApplication(referenceId,keyName); + + //查询未关联的应用 + List notLinked = tbDataResourceRelDao.getNotLinkedApplication(referenceId,keyName); + + result.put("alreadLinked",alreadLinked); + result.put("notLinked",notLinked); + return result; + } + + @Override + public Object queryResourceRelByKeyId(Long keyId, String type, String referenceName) { + Map result = new HashMap<>(); + //查询已关联的应用 + List alreadLinked = new ArrayList<>(); + //查询未关联的应用 + List notLinked = new ArrayList<>(); + switch (type){ + case "项目": + alreadLinked = tbDataResourceRelDao.getAlreadLinkedProject(keyId,referenceName); + notLinked = tbDataResourceRelDao.getNotLinkedProject(keyId,referenceName); + break; + default: + alreadLinked = tbDataResourceRelDao.getAlreadLinkedResource(keyId,type,referenceName); + notLinked = tbDataResourceRelDao.getNotLinkedResource(keyId,type,referenceName); + break; + } + + result.put("alreadLinked",alreadLinked); + result.put("notLinked",notLinked); + return result; + } + + @Override + @Transactional + public Object saveDataResourceRel(JSONObject param) { + //关联类型:1:应用资源关联其他资源;2:其他资源关联应用资源 + String linkType = param.getString("linkType"); + Long id = param.getLong("id"); + List referenceIds = JSONArray.parseArray(param.getString("referenceIds"),Long.class); + + Long userId = SecurityUser.getUser().getId(); + switch (linkType){ + case "1": + //应用资源关联其他资源 + //id为应用资源id,即表中的key_id;referenceIds中为表中的reference_id + //先删除所有已关联的内容 + tbDataResourceRelDao.deleteAllByKeyId(id,userId,new Date()); + //新增关联关系 + if(CollectionUtils.isNotEmpty(referenceIds)){ + List resourceRels = new ArrayList<>(); + for(Long referenceId:referenceIds){ + TbDataResourceRelEntity resourceRel = new TbDataResourceRelEntity(); + resourceRel.setKeyId(id); + resourceRel.setReferenceId(referenceId); + + tbDataResourceRelDao.insert(resourceRel); + } + } + break; + case "2": + //其他资源关联应用资源 + //id为其他资源id,即表中的reference_id,referenceIds中为表中的key_id + //先删除所有已关联的内容 + tbDataResourceRelDao.deleteAllByreferenceId(id,userId,new Date()); + //新增关联关系 + if(CollectionUtils.isNotEmpty(referenceIds)){ + List resourceRels = new ArrayList<>(); + for(Long referenceId:referenceIds){ + TbDataResourceRelEntity resourceRel = new TbDataResourceRelEntity(); + resourceRel.setKeyId(referenceId); + resourceRel.setReferenceId(id); + + tbDataResourceRelDao.insert(resourceRel); + } + } + break; + default: + return "关联类型参数错误,请检查关联类型参数"; + } + return null; + } +} \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/resource/TbDataResourceRelDao.xml b/renren-admin/src/main/resources/mapper/resource/TbDataResourceRelDao.xml new file mode 100644 index 00000000..c0a5fa22 --- /dev/null +++ b/renren-admin/src/main/resources/mapper/resource/TbDataResourceRelDao.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + update tb_data_resource_rel set del_flag = 1,updater = #{userId},update_date = #{updateDate} + where key_id = #{keyId} and del_flag = 0 + + + + update tb_data_resource_rel set del_flag = 1,updater = #{userId},update_date = #{updateDate} + where reference_id = #{referenceId} and del_flag = 0 + + + + + + \ No newline at end of file From aefa138f22904d78d34cb8a08af3ce930f46a486 Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Fri, 24 Jun 2022 10:29:34 +0800 Subject: [PATCH 22/26] =?UTF-8?q?=E5=B8=82=E5=B1=80=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/renren/common/controller/CensusControllerV2.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java index 32b9df0c..1268c4cb 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java @@ -432,8 +432,8 @@ public class CensusControllerV2 { GetDataResourceListDto getDataResourceListDto = new GetDataResourceListDto(); getDataResourceListDto.setPageNum(1); getDataResourceListDto.setPageSize(5); - JSONObject dataResource = (JSONObject) tsingtaoDataResourceService.getDataResource(getDataResourceListDto); - JSONObject data = dataResource.getJSONObject("data"); + HashMap dataResource = (HashMap) tsingtaoDataResourceService.getDataResource(getDataResourceListDto); + JSONObject data = JSON.parseObject(JSON.toJSONString(dataResource.get("data"))); result.add(new HashMap() { { put("amount", data.get("rows")); From ce43a9fcedd9083383908efe0dfd73bfba9459f6 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Fri, 24 Jun 2022 14:04:02 +0800 Subject: [PATCH 23/26] =?UTF-8?q?=E8=A5=BF=E6=B5=B7=E5=B2=B8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3ip=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/domain/tsingtao-xha.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/renren-admin/src/main/resources/domain/tsingtao-xha.properties b/renren-admin/src/main/resources/domain/tsingtao-xha.properties index 5d6ae796..bd3d41d2 100644 --- a/renren-admin/src/main/resources/domain/tsingtao-xha.properties +++ b/renren-admin/src/main/resources/domain/tsingtao-xha.properties @@ -2,6 +2,6 @@ tsingtao-xha.cloudhls=http://10.10.30.9:8001/hx-weatherwarning/camera/getCameraL tsingtao-xha.localhls=http://10.134.135.9:8001/hx-weatherwarning/camera/getCameraLiveStreamByCode?cameraCode=%s&protocol=hls tsingtao-xha.cloudcam=http://10.10.30.9:8001/hx-weather-warning/camera/getCameraListByName?name=%s&pageNo=%d&pageSize=%d tsingtao-xha.localcam=http://10.134.135.9:8001/hx-weather-warning/camera/getCameraListByName?name=%s&pageNo=%d&pageSize=%d -tsingtao-xha.resourcecount=http://10.16.3.224:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=&type=&orderField=requestNum&orderType=desc&pageNum=1&pageSize=10&serviceType=data&rq=1655106309671.43 +tsingtao-xha.resourcecount=http://10.10.30.24:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=&type=&orderField=requestNum&orderType=desc&pageNum=1&pageSize=10&serviceType=data&rq=1655106309671.43 tsingtao-xha.resourceapplyinfo=http://10.134.135.24:30058/shareportal/platform/index/abilityMarket/count -tsingtao-xha.sjzy=http://10.16.3.224:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=%s&type=&orderField=%s&orderType=%s&pageNum=%s&pageSize=%s&serviceType=data&rq=1655106309671.43 \ No newline at end of file +tsingtao-xha.sjzy=http://10.10.30.24:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=%s&type=&orderField=%s&orderType=%s&pageNum=%s&pageSize=%s&serviceType=data&rq=1655106309671.43 \ No newline at end of file From bb8e2e575954cda7e3f350a7b520c9379c1e3700 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Fri, 24 Jun 2022 15:01:40 +0800 Subject: [PATCH 24/26] =?UTF-8?q?=E8=A5=BF=E6=B5=B7=E5=B2=B8=E7=9A=84?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/CensusControllerV2.java | 59 ++++++------------- 1 file changed, 18 insertions(+), 41 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java index 1268c4cb..867ef7d2 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java @@ -291,11 +291,11 @@ public class CensusControllerV2 { }); }); CompletableFuture allKnowledgeVisitsAmount = CompletableFuture.supplyAsync(() -> { // 获取平台知识库浏览量 - return jdbcTemplate.queryForObject("SELECT SUM(visits)visits FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class); + return jdbcTemplate.queryForObject("SELECT SUM(visits) visits FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class); }).thenAccept(sum -> { result.add(new HashMap() { { - put("amount", sum); + put("amount", sum == null ? 0L : sum); put("type", "知识库总浏览量"); } }); @@ -336,45 +336,22 @@ public class CensusControllerV2 { case TSINGTAO_XHA: { // 青岛西海岸 allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目 List result_ = new CopyOnWriteArrayList<>(); - CompletableFuture cloud = - CompletableFuture.runAsync(() -> { // 云脑专网 - OkHttpClient client = new OkHttpClient(); - String url = String.format(tsingtao_xhaProperties.getCloudcam(), "", 1, 10); - logger.info(url); - Request request = new Request.Builder().url(url).build(); - try (Response response = client.newCall(request).execute()) { - if (response.isSuccessful()) { - JSONObject jsonObject = JSON.parseObject(response.body().string()); - if (jsonObject.containsKey("data")) { - result_.add(jsonObject.getJSONObject("data").getLongValue("total")); - } - } else { - logger.error("青岛西海岸获取失败"); - } - } catch (Exception exception) { - logger.error("青岛西海岸失败", exception); - } - }); - CompletableFuture local = - CompletableFuture.runAsync(() -> { // 金宏网 - OkHttpClient client = new OkHttpClient(); - String url = String.format(tsingtao_xhaProperties.getLocalcam(), "", 1, 10); - logger.info(url); - Request request = new Request.Builder().url(url).build(); - try (Response response = client.newCall(request).execute()) { - if (response.isSuccessful()) { - JSONObject jsonObject = JSON.parseObject(response.body().string()); - if (jsonObject.containsKey("data")) { - result_.add(jsonObject.getJSONObject("data").getLongValue("total")); - } - } else { - logger.error("青岛西海岸获取失败"); - } - } catch (Exception exception) { - logger.error("青岛西海岸失败", exception); - } - }); - CompletableFuture.allOf(cloud, local); + OkHttpClient client = new OkHttpClient(); + String url = String.format(tsingtao_xhaProperties.getCloudcam(), "", 1, 10); + logger.info(url); + Request request = new Request.Builder().url(url).build(); + try (Response response = client.newCall(request).execute()) { + if (response.isSuccessful()) { + JSONObject jsonObject = JSON.parseObject(response.body().string()); + if (jsonObject.containsKey("data")) { + result_.add(jsonObject.getJSONObject("data").getLongValue("total")); + } + } else { + logger.error("青岛西海岸获取失败"); + } + } catch (Exception exception) { + logger.error("青岛西海岸失败", exception); + } return result_.stream().filter(index -> index != null).findAny().orElse(0l); }).thenAccept(sum -> { result.add(new HashMap() { From 08423a1f8948540b138479e51ed6622b0b575da2 Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Fri, 24 Jun 2022 15:19:09 +0800 Subject: [PATCH 25/26] =?UTF-8?q?=E5=B8=82=E5=B1=80=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=B5=84=E6=BA=90=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/CensusControllerV2.java | 18 +++++++++++++----- .../controller/ResourceController.java | 7 ++++++- .../resource/dto/GetDataResourceListDto.java | 2 ++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java index 1268c4cb..760111a8 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java @@ -69,7 +69,8 @@ public class CensusControllerV2 { private String[] censusTypes; // 需要进行统计的资源类型 @GetMapping(value = "/whole_amount") - @ApiOperation("平台概览") + @ApiOperation("能力云图-平台概览") + @LogOperation("能力云图-平台概览") public Result>> wholeAmount() { List> result = new CopyOnWriteArrayList<>(); @@ -429,9 +430,7 @@ public class CensusControllerV2 { break; case TSINGTAO: { // TODO 青岛大数据局 TsingtaoDataResourceService tsingtaoDataResourceService = new TsingtaoDataResourceService(); - GetDataResourceListDto getDataResourceListDto = new GetDataResourceListDto(); - getDataResourceListDto.setPageNum(1); - getDataResourceListDto.setPageSize(5); + GetDataResourceListDto getDataResourceListDto = new GetDataResourceListDto().setPageNum(1).setPageSize(5); HashMap dataResource = (HashMap) tsingtaoDataResourceService.getDataResource(getDataResourceListDto); JSONObject data = JSON.parseObject(JSON.toJSONString(dataResource.get("data"))); result.add(new HashMap() { @@ -454,7 +453,16 @@ public class CensusControllerV2 { }); result.add(new HashMap() { { - put("resourceTop5", data.get("data")); + String ja = data.getString("data"); + List lists = JSON.parseArray(ja, Map.class); + ArrayList list = new ArrayList<>(); + lists.forEach(item -> { + list.add(new HashMap(){{ + put("服务名称", item.get("zyname")); + put("申请次数", item.get("syqk")); + }}); + }); + put("resourceTop5", list); } }); } diff --git a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java index daea105a..211545c0 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java @@ -130,7 +130,8 @@ public class ResourceController { } @GetMapping("/{id}") - @ApiOperation("信息") + @ApiOperation("查询能力资源详细信息") + @LogOperation("查询能力资源详细信息") public Result get(@PathVariable("id") Long id) { ResourceDTO data = resourceService.get(id); return new Result().ok(data); @@ -276,6 +277,7 @@ public class ResourceController { @GetMapping("ZywMessage") @ApiOperation("资源转发") + @LogOperation("资源转发") public Result ZywMessage() { String url = "http://15.72.158.81/zyjk/ZywMessage.asmx"; String parame = "\n" + @@ -303,6 +305,7 @@ public class ResourceController { @GetMapping("ZywMessage/list") @ApiOperation("资源列表转发") + @LogOperation("资源列表转发") public Result ZywMessageList(@ApiParam("页数") Integer page, @ApiParam("页大小") Integer size, @ApiParam("排序字段;fbrq(发布日期),syqk(申请数量)") String pxcol, @@ -355,6 +358,7 @@ public class ResourceController { @GetMapping("qdyjjWeather") @ApiOperation("青岛应急局-查询青岛市地区天气信息") + @LogOperation("青岛应急局-查询青岛市地区天气信息") public Result qdyjjWeather(String cityName) { String loginUrl = "http://" + ipAndPort + "/service-oauth/login"; String weatherUrl = "http://" + ipAndPort + "/service-map/qxWeather/getTodayWeatherInfo"; @@ -384,6 +388,7 @@ public class ResourceController { @GetMapping("knowledgeBase") @ApiOperation("对接知识库数据") + @LogOperation("对接知识库数据") public Result knowledgeBase() { resourceService.KnowledgeBase(); return new Result().ok("任务开启成功!"); diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dto/GetDataResourceListDto.java b/renren-admin/src/main/java/io/renren/modules/resource/dto/GetDataResourceListDto.java index 660df80d..f1693642 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dto/GetDataResourceListDto.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dto/GetDataResourceListDto.java @@ -1,11 +1,13 @@ package io.renren.modules.resource.dto; import lombok.Data; +import lombok.experimental.Accessors; /** * 数据资源查询参数对象 */ @Data +@Accessors(chain=true) public class GetDataResourceListDto { //名称,模糊查询 From b279459972849640c9650940eb5e4b71a8e984e6 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Fri, 24 Jun 2022 15:55:25 +0800 Subject: [PATCH 26/26] =?UTF-8?q?=E8=A5=BF=E6=B5=B7=E5=B2=B8=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E8=B0=83=E6=95=B4=E4=B8=BA=E7=8E=B0?= =?UTF-8?q?=E5=9C=BA=E6=AD=A3=E5=BC=8F=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/CensusControllerV2.java | 132 +++++++----------- .../resources/domain/tsingtao-xha.properties | 2 +- 2 files changed, 55 insertions(+), 79 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java index 867ef7d2..e9efe1a4 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java @@ -437,93 +437,69 @@ public class CensusControllerV2 { } break; case TSINGTAO_XHA: { // 青岛西海岸 - allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台数据资源总数目 - OkHttpClient client = new OkHttpClient(); - Long total = 0L; - Request request = new Request.Builder().url(tsingtao_xhaProperties.getResourcecount()).build(); - try (Response response = client.newCall(request).execute()) { - if (response.isSuccessful()) { - JSONObject jsonObject = JSON.parseObject(response.body().string()); - if (jsonObject.containsKey("data")) { - total = jsonObject.getJSONObject("data").getLongValue("total"); - } - } else { - logger.error("青岛西海岸获取失败"); + OkHttpClient client = new OkHttpClient(); + Long total = 0L; + Request request = new Request.Builder().url(tsingtao_xhaProperties.getResourcecount()).build(); + try (Response response = client.newCall(request).execute()) { + if (response.isSuccessful()) { + JSONObject jsonObject = JSON.parseObject(response.body().string()); + if (jsonObject.containsKey("data")) { + total = jsonObject.getJSONObject("data").getLongValue("total"); + Long finalTotal = total; + result.add(new HashMap() { + { + put("amount", finalTotal); + put("type", "总数据量"); + } + }); } - } catch (Exception exception) { - logger.error("青岛西海岸失败", exception); + } else { + logger.error("青岛西海岸获取失败"); } - return total; - }).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "总数据量"); - } - }); - }); // 处理总数目 + } catch (Exception exception) { + logger.error("青岛西海岸失败", exception); + } - applyInfo = CompletableFuture.runAsync(() -> { - OkHttpClient client = new OkHttpClient(); - Request request = new Request.Builder().url(tsingtao_xhaProperties.getResourceapplyinfo()).build(); - try (Response response = client.newCall(request).execute()) { - if (response.isSuccessful()) { - JSONObject jsonObject = JSON.parseObject(response.body().string()); - if (jsonObject.containsKey("data")) { - result.add(new HashMap() { - { - put("amount", jsonObject.getJSONObject("data").getLongValue("requestCount")); - put("type", "总申请次数"); - } - }); - result.add(new HashMap() { - { - put("amount", jsonObject.getJSONObject("data").getIntValue("satisfactionRate")); - put("type", "满足率"); - } - }); - result.add(new HashMap() { - { - put("resourceTop5", jsonObject.getJSONObject("data").getJSONArray("resourceTop5").stream().map(index -> (JSONObject) JSON.toJSON(index)).map(index -> new HashMap() { - { - put("服务名称", index.getString("service_name")); - put("申请次数", index.getLongValue("count")); - } - }).collect(Collectors.toList())); - } - }); - } - } else { - logger.error("青岛西海岸获取失败"); + OkHttpClient client1 = new OkHttpClient(); + Request request1 = new Request.Builder().url(tsingtao_xhaProperties.getResourceapplyinfo()).build(); + try (Response response = client1.newCall(request1).execute()) { + if (response.isSuccessful()) { + JSONObject jsonObject = JSON.parseObject(response.body().string()); + if (jsonObject.containsKey("data")) { + result.add(new HashMap() { + { + put("amount", jsonObject.getJSONObject("data").getLongValue("requestCount")); + put("type", "总申请次数"); + } + }); + result.add(new HashMap() { + { + put("amount", jsonObject.getJSONObject("data").getIntValue("satisfactionRate")); + put("type", "满足率"); + } + }); + result.add(new HashMap() { + { + put("resourceTop5", jsonObject.getJSONObject("data").getJSONArray("resourceTop5").stream().map(index -> (JSONObject) JSON.toJSON(index)).map(index -> new HashMap() { + { + put("服务名称", index.getString("service_name")); + put("申请次数", index.getLongValue("count")); + } + }).collect(Collectors.toList())); + } + }); + } - } catch (Exception exception) { - logger.error("青岛西海岸失败", exception); + } else { + logger.error("青岛西海岸获取失败"); } - }); + } catch (Exception exception) { + logger.error("青岛西海岸失败", exception); + } } break; } - if (allAmount == null) { - allAmount = CompletableFuture.runAsync(() -> { - try { - Thread.sleep(100l); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - }); - } - if (applyInfo == null) { - applyInfo = CompletableFuture.runAsync(() -> { - try { - Thread.sleep(100l); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - }); - } - CompletableFuture all = CompletableFuture.allOf(allAmount, applyInfo); - all.join(); return new Result().ok(result); } diff --git a/renren-admin/src/main/resources/domain/tsingtao-xha.properties b/renren-admin/src/main/resources/domain/tsingtao-xha.properties index bd3d41d2..25eef1ce 100644 --- a/renren-admin/src/main/resources/domain/tsingtao-xha.properties +++ b/renren-admin/src/main/resources/domain/tsingtao-xha.properties @@ -3,5 +3,5 @@ tsingtao-xha.localhls=http://10.134.135.9:8001/hx-weatherwarning/camera/getCamer tsingtao-xha.cloudcam=http://10.10.30.9:8001/hx-weather-warning/camera/getCameraListByName?name=%s&pageNo=%d&pageSize=%d tsingtao-xha.localcam=http://10.134.135.9:8001/hx-weather-warning/camera/getCameraListByName?name=%s&pageNo=%d&pageSize=%d tsingtao-xha.resourcecount=http://10.10.30.24:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=&type=&orderField=requestNum&orderType=desc&pageNum=1&pageSize=10&serviceType=data&rq=1655106309671.43 -tsingtao-xha.resourceapplyinfo=http://10.134.135.24:30058/shareportal/platform/index/abilityMarket/count +tsingtao-xha.resourceapplyinfo=http://10.10.30.24:30058/share-portal/platform/index/abilityMarket/count tsingtao-xha.sjzy=http://10.10.30.24:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=%s&type=&orderField=%s&orderType=%s&pageNum=%s&pageSize=%s&serviceType=data&rq=1655106309671.43 \ No newline at end of file