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 60b2cc70..5600249a 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 @@ -5,7 +5,6 @@ import io.renren.common.annotation.ActivitiNoticeOperation; import io.renren.modules.notice.dto.SysNoticeDTO; import io.renren.modules.notice.enums.NoticeStatusEnum; import io.renren.modules.notice.service.SysNoticeService; -import io.renren.modules.resource.dto.ResourceDTO; import io.renren.modules.resource.service.ResourceService; import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysRoleDTO; @@ -127,7 +126,7 @@ public class ActivitiNoticeAspect { */ private void task_complete_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) { Map kv = delegateTask.getVariables(); - LOGGER.error("表单:" + JSON.toJSONString(kv)); + LOGGER.error("表单:{}", JSON.toJSONString(kv)); if (work.contains(TaskListener.EVENTNAME_COMPLETE + kv.get("id").toString())) { LOGGER.error("------------出现重放------------"); return; @@ -145,25 +144,21 @@ public class ActivitiNoticeAspect { try { String result; Boolean termination = Boolean.valueOf(kv.get("termination") != null ? kv.get("termination").toString() : Boolean.FALSE.toString()); // 直接终结 + Boolean endByUser = Boolean.valueOf(kv.get("endByUser") != null ? kv.get("endByUser").toString() : Boolean.FALSE.toString()); // 用户终止 Boolean reject = Boolean.valueOf(kv.get("reject") != null ? kv.get("reject").toString() : Boolean.FALSE.toString()); // 被拒绝 - if (termination) { - result = "终止被拒"; + if (Boolean.TRUE.equals(endByUser)) { + result = " 发起者终止"; + } else if (Boolean.TRUE.equals(termination)) { + result = " 终止被拒"; } else if (reject) { - result = "被拒"; + result = " 被拒"; } else { - result = "通过"; + result = " 通过"; } String finalCreator = creator; String finalResult = result; CompletableFuture.runAsync(() -> { // 发起人 SysUserDTO userDTO = sysUserService.get(Long.valueOf(finalCreator)); - Long resourceId = null; - if (kv.containsKey("resourceId")) { - resourceId = Long.valueOf(kv.get("resourceId").toString()); - } else if (kv.containsKey("id")) { - resourceId = Long.valueOf(kv.get("id").toString()); - } - Optional resourceDTO = Optional.ofNullable(resourceService.get(resourceId)); kv.get("resourceId"); kv.get("id"); String content = "【通知】" + userDTO.getRealName() + ",您发起的" + activitiNoticeOperation.process() + " " + activitiNoticeOperation.value() + "节点" + finalResult; @@ -205,7 +200,7 @@ public class ActivitiNoticeAspect { */ private void end_notice(final DelegateExecution execution, final ActivitiNoticeOperation activitiNoticeOperation) { Map kv = execution.getVariables(); - LOGGER.error("表单:" + JSON.toJSONString(kv)); + LOGGER.error("表单:{}", JSON.toJSONString(kv)); if (work.contains(ExecutionListener.EVENTNAME_END + kv.get("id").toString())) { LOGGER.error("------------出现重放------------"); return; @@ -223,25 +218,19 @@ public class ActivitiNoticeAspect { try { String result; Boolean termination = Boolean.valueOf(kv.get("termination") != null ? kv.get("termination").toString() : Boolean.FALSE.toString()); // 直接终结 + Boolean endByUser = Boolean.valueOf(kv.get("endByUser") != null ? kv.get("endByUser").toString() : Boolean.FALSE.toString()); // 用户终止 Boolean reject = Boolean.valueOf(kv.get("reject") != null ? kv.get("reject").toString() : Boolean.FALSE.toString()); // 被拒绝 - if (termination) { + if (Boolean.TRUE.equals(endByUser)) { + result = " 发起者终止"; + } else if (Boolean.TRUE.equals(termination)) { result = "终止被拒"; - } else if (reject) { + } else if (Boolean.TRUE.equals(reject)) { result = "被拒"; } else { result = "通过"; } String finalCreator = creator; String finalResult = result; - Long resourceId = null; - if (kv.containsKey("resourceId") && kv.get("resourceId") != null) { - resourceId = Long.valueOf(kv.get("resourceId").toString()); - } else if (kv.containsKey("id") && kv.get("id") != null && !kv.get("id").toString().contains("-")) { - resourceId = Long.valueOf(kv.get("id").toString()); - } else { - resourceId = 0L; - } - Optional resourceDTO = Optional.ofNullable(resourceService.get(resourceId)); CompletableFuture.runAsync(() -> { // 发起人 SysUserDTO userDTO = sysUserService.get(Long.valueOf(finalCreator)); kv.get("resourceId"); @@ -261,11 +250,11 @@ public class ActivitiNoticeAspect { dto.setFrom("通知"); sysNoticeService.save(dto); }, EXECUTOR).thenRunAsync(() -> { - LOGGER.error("大数据局名称:" + bigDateDeptName); + LOGGER.error("大数据局名称:{}", bigDateDeptName); SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName); - LOGGER.error("deptDTOId:" + deptDTO.getId()); + LOGGER.error("deptDTOId:{}", deptDTO.getId()); SysRoleDTO roleDTO = sysRoleService.getByName(roleName); - LOGGER.error("roleDTOId:" + roleDTO.getId()); + LOGGER.error("roleDTOId:{}", roleDTO.getId()); Optional userDTO = Optional.ofNullable(sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId())); userDTO.ifPresent(user -> { SysUserDTO creatorDTO = sysUserService.get(Long.valueOf(finalCreator)); @@ -310,7 +299,7 @@ public class ActivitiNoticeAspect { */ private void assignment_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) { Map kv = delegateTask.getVariables(); - LOGGER.error("表单:" + JSON.toJSONString(kv)); + LOGGER.error("表单:{}", JSON.toJSONString(kv)); if (work.contains(TaskListener.EVENTNAME_ASSIGNMENT + kv.get("id").toString())) { LOGGER.error("------------出现重放------------"); return; @@ -330,9 +319,9 @@ public class ActivitiNoticeAspect { CompletableFuture.runAsync(() -> { // 发起人 try { SysUserDTO assignee = sysUserService.get(Long.valueOf(delegateTask.getAssignee())); - LOGGER.error("审核人:" + assignee.getId()); + LOGGER.error("审核人:{}", assignee.getId()); String content = "【通知】您发起的流程 " + activitiNoticeOperation.process() + " 当前审核节点为:" + activitiNoticeOperation.value() + ";当前审核人为:\"" + assignee.getDeptName() + "\"审核负责人\"" + assignee.getRealName() + "\""; - LOGGER.info("通知内容:" + content); + LOGGER.info("通知内容:{}", content); SysNoticeDTO dto = new SysNoticeDTO(); dto.setType(2); dto.setTitle("流程流转系统通知"); diff --git a/renren-admin/src/main/java/io/renren/common/aspect/DataFilterAspect.java b/renren-admin/src/main/java/io/renren/common/aspect/DataFilterAspect.java index c0bcf7fb..aa0b1c20 100644 --- a/renren-admin/src/main/java/io/renren/common/aspect/DataFilterAspect.java +++ b/renren-admin/src/main/java/io/renren/common/aspect/DataFilterAspect.java @@ -36,7 +36,7 @@ public class DataFilterAspect { @Before("dataFilterCut()") public void dataFilter(JoinPoint point) { Object params = point.getArgs()[0]; - if(params != null && params instanceof Map){ + if(params instanceof Map){ UserDetail user = SecurityUser.getUser(); //如果是超级管理员,则不进行数据过滤 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 3afb2a5e..5ec31c40 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 @@ -33,7 +33,6 @@ public class LogOperationAspect { @Pointcut("@annotation(io.renren.common.annotation.LogOperation)") public void logPointCut() { - } @Around("logPointCut()") diff --git a/renren-admin/src/main/java/io/renren/common/config/MybatisPlusConfig.java b/renren-admin/src/main/java/io/renren/common/config/MybatisPlusConfig.java index 9a3fc2e9..4215d09e 100644 --- a/renren-admin/src/main/java/io/renren/common/config/MybatisPlusConfig.java +++ b/renren-admin/src/main/java/io/renren/common/config/MybatisPlusConfig.java @@ -34,15 +34,5 @@ public class MybatisPlusConfig { return new PaginationInterceptor(); } -// @Bean -// @Order(0) -// public MybatisPlusInterceptor mybatisPlusInterceptor(){ -// MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); -// //添加分页插件 -// interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); -// //添加乐观锁插件 -// interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor()); -// return interceptor; -// } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/common/config/RestTemplateConfig.java b/renren-admin/src/main/java/io/renren/common/config/RestTemplateConfig.java index 34ffd370..a4004984 100644 --- a/renren-admin/src/main/java/io/renren/common/config/RestTemplateConfig.java +++ b/renren-admin/src/main/java/io/renren/common/config/RestTemplateConfig.java @@ -31,10 +31,6 @@ public class RestTemplateConfig { factory.setReadTimeout(30 * 000);//单位为ms factory.setConnectTimeout(5 * 1000);//单位为ms factory.setOutputStreaming(false); - -// SocketAddress address = new InetSocketAddress("127.0.0.1", 8888); -// Proxy proxy = new Proxy(Proxy.Type.HTTP, address); -// factory.setProxy(proxy); return factory; } } 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 a1376531..13ecf605 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 @@ -62,12 +62,12 @@ public class AbilityCenterController { private final CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance(); - private static final String key = "abilityprocess"; + private static final String KEY = "abilityprocess"; - private static Map params = new HashMap() { + private static final Map params = new HashMap() { { put("isLatestVersion", true); // 取最新版本 - put("key", key); // 限定 + put("key", KEY); // 限定 } }; @@ -87,7 +87,6 @@ public class AbilityCenterController { if (page.getTotal() <= 0) { // return new Result().error("联系管理员添加流程"); } -// String applyNumber = codeGenerationUtils.getApplyNumber("NLSY"); return new Result().ok(abilityBatchApplicationDTO.getSystem().stream().map(index -> { if (index.get("resourceId") == null) { logger.error("未携带资源id"); @@ -98,7 +97,6 @@ public class AbilityCenterController { return null; } TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO(); -// tAbilityApplicationDTO.setApplyNumber(applyNumber); tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea()); tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment()); tAbilityApplicationDTO.setBasis(abilityBatchApplicationDTO.getBasis()); @@ -121,13 +119,13 @@ public class AbilityCenterController { if (tAbilityApplicationDTO.getId() == null) { return null; } - codeGenerationUtils.setApplyNumber("NLSY", Arrays.asList(tAbilityApplicationDTO.getId()), jdbcTemplate); + codeGenerationUtils.setApplyNumber("NLSY", Collections.singletonList(tAbilityApplicationDTO.getId()), jdbcTemplate); tAbilityApplicationDTO.setCompleteEntry(Boolean.TRUE); // 仿照请求接口 /act/running/startOfBusinessKey ProcessStartDTO processStartDTO = new ProcessStartDTO(); processStartDTO.setBusinessKey(tAbilityApplicationDTO.getId().toString()); - processStartDTO.setProcessDefinitionKey(key); //限定 + processStartDTO.setProcessDefinitionKey(KEY); //限定 Map variables = oMapper.convertValue(tAbilityApplicationDTO, Map.class); processStartDTO.setVariables(variables); ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO); @@ -139,7 +137,7 @@ public class AbilityCenterController { } }, executor); return dto; - }).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList())); + }).filter(ObjectUtil::isNotNull).collect(Collectors.toList())); } diff --git a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java index f8f2bb26..650d2d08 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java +++ b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java @@ -75,12 +75,12 @@ public class AbilityCenterControllerV2 { @Value("${big_date.name}") private String bigDateDeptName; // 大数据局名称 - private static final String key = "abilityprocess_v2"; + private static final String KEY = "abilityprocess_v2"; - private static Map params = new HashMap() { + private static final Map params = new HashMap() { { put("isLatestVersion", true); // 取最新版本 - put("key", key); // 限定 + put("key", KEY); // 限定 } }; @@ -184,7 +184,7 @@ public class AbilityCenterControllerV2 { codeGenerationUtils.setApplyNumber("NLSY", tAbilityApplicationDTOList.stream().map(TAbilityApplicationDTO::getId).collect(Collectors.toList()), jdbcTemplate); Map> temp = tAbilityApplicationDTOList.stream() - .filter(index -> index != null) + .filter(Objects::nonNull) .filter(index -> StringUtils.isNotEmpty(index.getResourceId())) .collect(Collectors.groupingBy(t -> { ResourceDTO resourceDTO = resourceService.get(Long.valueOf(t.getResourceId())); @@ -207,12 +207,12 @@ public class AbilityCenterControllerV2 { List dtoList = temp.get(deptId); CompletableFuture.runAsync(() -> { - String[] sqls_ = dtoList.stream().map(index -> String.format("UPDATE t_ability_application SET resource_owner_dept = '%s' WHERE id = %s", JSON.toJSONString(sysDeptDTO), index.getId())).collect(Collectors.toList()).toArray(new String[dtoList.size()]); - jdbcTemplate.batchUpdate(sqls_); // 批量更新资源所属部门信息 + String[] sqls = dtoList.stream().map(index -> String.format("UPDATE t_ability_application SET resource_owner_dept = '%s' WHERE id = %s", JSON.toJSONString(sysDeptDTO), index.getId())).collect(Collectors.toList()).toArray(new String[dtoList.size()]); + jdbcTemplate.batchUpdate(sqls); // 批量更新资源所属部门信息 logger.info("批量更新申请的资源的部门信息完成"); }, executor); - Boolean basic_facilities = dtoList.stream().map(index -> { + Boolean basicFacilities = dtoList.stream().map(index -> { Optional resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(index.getResourceId()))); if (!resourceDTOOptional.isPresent()) { // 从本库内查不到 视为其它平台的基础设施资源 return true; @@ -222,14 +222,14 @@ public class AbilityCenterControllerV2 { } return false; }).filter(index -> index).findAny().orElse(Boolean.FALSE); - logger.error("--------------------是否全是基础设施{}----------------------------------------------", basic_facilities); + logger.error("--------------------是否全是基础设施{}----------------------------------------------", basicFacilities); final List ids = dtoList.stream().map(TAbilityApplicationDTO::getId).collect(Collectors.toList()); // 发起申请的表单id // 仿照请求接口 /act/running/startOfBusinessKey ProcessStartDTO processStartDTO = new ProcessStartDTO(); - processStartDTO.setBusinessKey(basic_facilities ? tAbilityApplicationDTOList.stream().filter(index -> StringUtils.isNotEmpty(index.getResourceId())) + processStartDTO.setBusinessKey(Boolean.TRUE.equals(basicFacilities) ? tAbilityApplicationDTOList.stream().filter(index -> StringUtils.isNotEmpty(index.getResourceId())) .map(TAbilityApplicationDTO::getResourceId).findFirst().orElse(null) : JSON.toJSONString(ids.stream().limit(5).collect(Collectors.toList()))); // 申请的id列表 json字符 做businesskey - processStartDTO.setProcessDefinitionKey(key); //限定 + processStartDTO.setProcessDefinitionKey(KEY); //限定 AuditingBaseDTO auditingBaseDTO = new AuditingBaseDTO(); auditingBaseDTO.setCompleteEntry(Boolean.TRUE); // 首次录入 @@ -244,7 +244,7 @@ public class AbilityCenterControllerV2 { put("id", applyFlag); //申请id put("creator", user == null ? null : user.getId().toString()); // 创建人 put("userId", user == null ? null : user.getId().toString()); // 创建人 - put("basic_facilities", basic_facilities); // 是否为基础设施 + put("basic_facilities", basicFacilities); // 是否为基础设施 } }); 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 9b8183a4..a6f61edf 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 @@ -35,8 +35,8 @@ import java.util.stream.Collectors; @RequestMapping("/census/center") public class CensusController { private static final Logger logger = LoggerFactory.getLogger(CensusController.class); - private static Integer cpuNUm = Runtime.getRuntime().availableProcessors(); - private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm); + private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors(); + private static final ExecutorService executor = Executors.newFixedThreadPool(CPUNUM); @Autowired private ResourceService resourceService; @@ -80,7 +80,7 @@ public class CensusController { }; finalDbAmount.add(nullMap); }); - Long sum = finalDbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum(); + Long sum = finalDbAmount.stream().mapToLong(index -> Long.parseLong(index.get("amount").toString())).sum(); Map sumMap = new HashMap() { { put("amount", sum); @@ -100,59 +100,48 @@ public class CensusController { CompletableFuture resourceAmount = CompletableFuture.supplyAsync(() -> { // 获取资源汇聚总量 Map map = (Map) resourceService.selectTotal(); List> dbAmount = (List>) map.get("total"); - Long sum = dbAmount.stream().mapToLong(index -> Long.parseLong(index.get("count").toString())).sum(); - return sum; - }, executor).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "资源汇聚总量"); - } - }); - }); + return dbAmount.stream().mapToLong(index -> Long.parseLong(index.get("count").toString())).sum(); + }, executor).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "资源汇聚总量"); + } + })); CompletableFuture userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数 return sysUserService.countAllUser(); - }, executor).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "用户量"); - } - }); - }); + }, executor).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "用户量"); + } + })); CompletableFuture applyAmount = CompletableFuture.supplyAsync(() -> { // 资源申请量 return tAbilityApplicationService.countApplyAll(); - }, executor).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "资源申请量"); - } - }); - }); + }, executor).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "资源申请量"); + } + })); CompletableFuture deptAmount = CompletableFuture.supplyAsync(() -> { // 覆盖部门量 return resourceService.countAllDept(); - }, executor).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "覆盖部门量"); - } - }); - }); + }, executor).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "覆盖部门量"); + } + })); CompletableFuture pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量 return resourceService.countAllVisits(); - }, executor).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "平台访问量"); - } - }); - }); + }, executor).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "平台访问量"); + } + })); CompletableFuture all = CompletableFuture.allOf(resourceAmount, userAmount, applyAmount, deptAmount, pvAmount); all.join(); result.sort(Comparator.comparing(x -> x.get("type").toString())); @@ -204,7 +193,7 @@ public class CensusController { List temp = resourceService.selectDeptProvideCount(n == null ? 24 : n); List> result = Collections.synchronizedList(new ArrayList<>()); List completableFutures = - temp.stream().mapToLong(index -> Long.valueOf(index.get("dept_id").toString())).mapToObj(deptId -> { + temp.stream().mapToLong(index -> Long.parseLong(index.get("dept_id").toString())).mapToObj(deptId -> { CompletableFuture task = CompletableFuture.supplyAsync(() -> { // 获取部门提供能力 List db = resourceService.selectDeptProvide(deptId); @@ -240,7 +229,7 @@ public class CensusController { throw new RuntimeException(e); } } - ).reversed().thenComparing(i -> i.toString())); + ).reversed().thenComparing(Object::toString)); return new Result>>().ok(result); } @@ -279,7 +268,7 @@ public class CensusController { List temp = tAbilityApplicationService.selectDeptApplyCount(n == null ? 24 : n); List> result = Collections.synchronizedList(new ArrayList<>()); List completableFutures = - temp.stream().mapToLong(index -> Long.valueOf(index.get("dept_id").toString())).mapToObj(deptId -> { + temp.stream().mapToLong(index -> Long.parseLong(index.get("dept_id").toString())).mapToObj(deptId -> { CompletableFuture task = CompletableFuture.supplyAsync(() -> { // 获取资源汇聚总量 List db = tAbilityApplicationService.selectDeptApply(deptId); 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 ac89202f..29c0d84b 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 @@ -1,6 +1,5 @@ package io.renren.common.controller; - import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.fasterxml.jackson.core.JsonProcessingException; @@ -37,7 +36,6 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; - /** * 2022.6.19 版本 */ @@ -46,11 +44,11 @@ import java.util.stream.Collectors; @RequestMapping("/census/center/v2") public class CensusControllerV2 { - private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors(); + private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors(); private static final OkHttpClient client = new OkHttpClient().newBuilder() .connectTimeout(1, TimeUnit.MINUTES) .readTimeout(1, TimeUnit.MINUTES) - .connectionPool(new ConnectionPool(cpuNUm * 2, 2, TimeUnit.MINUTES)) + .connectionPool(new ConnectionPool(CPUNUM * 2, 2, TimeUnit.MINUTES)) .retryOnConnectionFailure(false) .build(); @@ -88,25 +86,21 @@ public class CensusControllerV2 { CompletableFuture userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数 return sysUserService.countAllUser(); - }).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "用户量"); - } - }); - }); + }).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "用户量"); + } + })); CompletableFuture pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量 return resourceService.countAllVisits(); - }).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "平台访问量"); - } - }); - }); + }).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "平台访问量"); + } + })); CompletableFuture all = CompletableFuture.allOf(userAmount, pvAmount); all.join(); result.sort(Comparator.comparing(x -> x.get("type").toString())); @@ -135,14 +129,12 @@ public class CensusControllerV2 { CompletableFuture allApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总应用数目 return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='应用资源' AND del_flag = 0;", Long.class); - }).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "总应用数"); - } - }); - }); + }).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "总应用数"); + } + })); CompletableFuture buildingApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台建设中数目 return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT data_resource_id) FROM tb_data_attr WHERE EXISTS ( SELECT id FROM tb_data_resource WHERE tb_data_resource.id = tb_data_attr.data_resource_id AND tb_data_resource.del_flag = 0 ) AND attr_type = '应用状态' AND attr_value = '建设中';", Long.class); }).thenAccept(sum -> { @@ -155,14 +147,12 @@ public class CensusControllerV2 { }); CompletableFuture endApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台建设中数目 return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT data_resource_id) FROM tb_data_attr WHERE EXISTS ( SELECT id FROM tb_data_resource WHERE tb_data_resource.id = tb_data_attr.data_resource_id AND tb_data_resource.del_flag = 0 ) AND attr_type = '应用状态' AND attr_value = '停用';", Long.class); - }).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "停用应用数"); - } - }); - }); + }).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "停用应用数"); + } + })); CompletableFuture all = CompletableFuture.allOf(allApplicationAmount, buildingApplicationAmount, endApplicationAmount); all.join(); return new Result().ok(result); @@ -213,7 +203,7 @@ public class CensusControllerV2 { re.put("deptName", sysDeptService.get(Long.valueOf(index)).getName()); re.put("count", i.get(index).stream().mapToLong(index_ -> index_.values().stream().mapToLong(count_ -> count_).sum()).sum()); return re; - }).filter(index -> ObjectUtils.allNotNull(index)).collect(Collectors.toList()); + }).filter(ObjectUtils::allNotNull).collect(Collectors.toList()); result.sort(Comparator.comparing(x -> { ObjectMapper mapper = new ObjectMapper(); try { @@ -235,58 +225,48 @@ public class CensusControllerV2 { List> result = new CopyOnWriteArrayList<>(); CompletableFuture allAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总组件服务数目 return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='组件服务' AND del_flag = 0;", Long.class); - }).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "上架总数"); - } - }); - }); + }).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "上架总数"); + } + })); String sqlFormat = "SELECT COUNT( tda.data_resource_id ) FROM tb_data_attr tda JOIN tb_data_resource tdr ON tda.data_resource_id = tdr.id AND MATCH ( tda.attr_value) AGAINST ( '%s' IN BOOLEAN MODE) AND tda.attr_type = '组件类型' AND tda.del_flag = 0 AND tdr.del_flag = 0;"; CompletableFuture aiAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台智能算法组件服务数目 return jdbcTemplate.queryForObject(String.format(sqlFormat, "智能算法"), Long.class); - }).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "智能算法"); - } - }); - }); + }).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "智能算法"); + } + })); CompletableFuture gisAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台图层服务组件服务数目 return jdbcTemplate.queryForObject(String.format(sqlFormat, "图层服务"), Long.class); - }).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "图层服务"); - } - }); - }); + }).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "图层服务"); + } + })); CompletableFuture busAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台业务组件组件服务数目 return jdbcTemplate.queryForObject(String.format(sqlFormat, "业务组件"), Long.class); - }).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "业务组件"); - } - }); - }); + }).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "业务组件"); + } + })); CompletableFuture devAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台业务组件组件服务数目 return jdbcTemplate.queryForObject(String.format(sqlFormat, "开发组件"), Long.class); - }).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "开发组件"); - } - }); - }); + }).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "开发组件"); + } + })); CompletableFuture all = CompletableFuture.allOf(allAssemblyAmount, aiAssemblyAmount, gisAssemblyAmount, busAssemblyAmount, devAssemblyAmount); all.join(); return new Result().ok(result); @@ -299,24 +279,20 @@ public class CensusControllerV2 { List> result = new CopyOnWriteArrayList<>(); CompletableFuture allKnowledgeAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总知识库数目 return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class); - }).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum); - put("type", "知识库上架总量"); - } - }); - }); + }).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum); + put("type", "知识库上架总量"); + } + })); CompletableFuture allKnowledgeVisitsAmount = CompletableFuture.supplyAsync(() -> { // 获取平台知识库浏览量 return jdbcTemplate.queryForObject("SELECT IFNULL(SUM(visits),0) visits FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class); - }).thenAccept(sum -> { - result.add(new HashMap() { - { - put("amount", sum == null ? 0L : sum); - put("type", "知识库总浏览量"); - } - }); - }); + }).thenAccept(sum -> result.add(new HashMap() { + { + put("amount", sum == null ? 0L : sum); + put("type", "知识库总浏览量"); + } + })); CompletableFuture all = CompletableFuture.allOf(allKnowledgeAmount, allKnowledgeVisitsAmount); all.join(); return new Result().ok(result); @@ -400,8 +376,6 @@ public class CensusControllerV2 { @LogOperation("能力云图-数据资源简况") public Result>> dataResourceInfo() { List> result = new CopyOnWriteArrayList<>(); - CompletableFuture allAmount = null; - CompletableFuture applyInfo = null; // 申请情况 switch (Constant.ProjectPlace.getByFlag(projectPlace)) { case BAOTOU: { // TODO 包头 result.add(new HashMap() { diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java index a5a79c98..abc318ec 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java @@ -77,7 +77,6 @@ public class CensusControllerV3 { } String type = params.get("resourceType").toString(); - List> list = new ArrayList<>(); switch (type) { case "组件服务": @@ -87,10 +86,12 @@ public class CensusControllerV3 { PageData> pageData1 = resourceService.resourceApplicationDetails(params); return new Result>>().ok(pageData1); case "基础设施": - PageData> pageData2 = resourceService.resourceInfrastructureDetails(params); + //PageData> pageData2 = resourceService.resourceInfrastructureDetails(params); + PageData> pageData2 = resourceService.resourceInstallationOrDataResourceDetails(params); return new Result>>().ok(pageData2); case "数据资源": - PageData> pageData3 = resourceService.resourceDatasDetails(params); + //PageData> pageData3 = resourceService.resourceDatasDetails(params); + PageData> pageData3 = resourceService.resourceInstallationOrDataResourceDetails(params); return new Result>>().ok(pageData3); case "知识库": PageData> pageData4 = resourceService.resourceKnowledgeDetails(params); @@ -124,22 +125,15 @@ public class CensusControllerV3 { } String type = params.get("resourceType").toString(); - List> list = new ArrayList<>(); switch (type) { case "组件服务": PageData> pageData = resourceService.resourceBusinessUseDetails(params); return new Result>>().ok(pageData); - case "应用资源": - return null; case "基础设施": + case "数据资源": PageData> pageData1 = resourceService.resourceDatasUseDetails(params); return new Result>>().ok(pageData1); - case "数据资源": - PageData> pageData2 = resourceService.resourceDatasUseDetails(params); - return new Result>>().ok(pageData2); - case "知识库": - return null; default: return null; } @@ -429,7 +423,7 @@ public class CensusControllerV3 { @LogOperation("知识库分布情况") @ApiImplicitParam(name = "id", value = "行政部门编号", paramType = "query", dataType = "Long") public Result>> knowledgeBaseDistriDetail(Long id) { - List> result = new ArrayList<>(); + List> result; Object[] ps = {id, id}; result = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS num,a.attr_value FROM tb_data_attr a INNER JOIN tb_data_resource b ON a.data_resource_id = b.id\n" + "INNER JOIN sys_dept c on b.dept_id = c.id WHERE a.attr_type = '文件类型' AND a.del_flag = 0 AND b.type = '知识库' AND b.del_flag = 0 AND \n" + 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 33c9ef84..78a4a18b 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 @@ -1,6 +1,5 @@ package io.renren.common.controller; - import io.renren.common.annotation.LogOperation; import io.renren.common.page.PageData; import io.renren.common.utils.CodeGenerationUtils; @@ -35,8 +34,8 @@ import java.util.concurrent.Executors; @RestController @RequestMapping("/comment/center") public class CommentController { - private static Integer cpuNUm = Runtime.getRuntime().availableProcessors(); - private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm); + private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors(); + private static final ExecutorService executor = Executors.newFixedThreadPool(CPUNUM); private static final ObjectMapper oMapper = new ObjectMapper(); @Autowired @@ -54,12 +53,12 @@ public class CommentController { private static final Logger logger = LoggerFactory.getLogger(CommentController.class); - private static final String key = "comment_review"; + private static final String KEY = "comment_review"; private static Map params = new HashMap() { { put("isLatestVersion", true); // 取最新版本 - put("key", key); // 限定 + put("key", KEY); // 限定 } }; @@ -85,7 +84,6 @@ public class CommentController { if (tDemandCommentDTO.getId() == null) { return new Result().error("该评论不存在"); } -// tDemandCommentDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("XQPL")); tDemandCommentDTO.setDelFlag(2); // 待审核 tDemandCommentDTO.setCompleteEntry(Boolean.TRUE); tDemandCommentService.update(tDemandCommentDTO); @@ -94,7 +92,7 @@ public class CommentController { // 仿照请求接口 /act/running/startOfBusinessKey ProcessStartDTO processStartDTO = new ProcessStartDTO(); processStartDTO.setBusinessKey(tDemandCommentDTO.getId().toString()); - processStartDTO.setProcessDefinitionKey(key); //限定 + processStartDTO.setProcessDefinitionKey(KEY); //限定 Map variables = oMapper.convertValue(tDemandCommentDTO, Map.class); processStartDTO.setVariables(variables); diff --git a/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java b/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java index 46b23e1f..fb103716 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/DemandDataController.java @@ -1,6 +1,6 @@ package io.renren.common.controller; - +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import io.renren.common.annotation.LogOperation; import io.renren.common.page.PageData; @@ -51,12 +51,12 @@ public class DemandDataController { private final CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance(); - private static final String key = "abilitydemandapply"; + private static final String KEY = "abilitydemandapply"; private static Map params = new HashMap() { { put("isLatestVersion", true); // 取最新版本 - put("key", key); // 限定 能力资源上架 + put("key", KEY); // 限定 能力资源上架 } }; @@ -67,13 +67,12 @@ public class DemandDataController { // 仿照请求接口 /act/process/lastestPage PageData> page = actProcessService.page(params); if (page.getTotal() <= 0) { // - return new Result().error("联系管理员添加流程:" + key); + return new Result().error("联系管理员添加流程:" + KEY); } logger.info("---------------------------------------------------"); - logger.info(JSONObject.toJSONString(tDemandDataDTO)); + logger.info(JSON.toJSONString(tDemandDataDTO)); logger.info("####################################################"); tDemandDataDTO.setFlag(TDemandDataEntityFlag.UNDER_REVIEW.getFlag()); -// tDemandDataDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("NLXQ")); ValidatorUtils.validateEntity(tDemandDataDTO, AddGroup.class, DefaultGroup.class); tDemandDataService.save(tDemandDataDTO); @@ -86,18 +85,18 @@ public class DemandDataController { // 仿照请求接口 /act/running/startOfBusinessKey ProcessStartDTO processStartDTO = new ProcessStartDTO(); processStartDTO.setBusinessKey(tDemandDataDTO.getId().toString()); - processStartDTO.setProcessDefinitionKey(key); // 限定资源上架 + processStartDTO.setProcessDefinitionKey(KEY); // 限定资源上架 Map variables = oMapper.convertValue(tDemandDataDTO, Map.class); processStartDTO.setVariables(variables); ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO); logger.info("-------------------2.启动流程成功--------------------------"); - logger.info("ProcessInstanceDTO.getBusinessKey:" + dto.getBusinessKey()); + logger.info("ProcessInstanceDTO.getBusinessKey:{}", dto.getBusinessKey()); if (Long.valueOf(dto.getBusinessKey()) != null) { // 仿照请求接口 /processForm/tabilityapplication/updateInstanceId tDemandDataService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey())); logger.info("-------------------更新updateInstanceId.成功--------------------------"); - logger.info("ProcessInstanceDTO.getProcessInstanceId:" + dto.getProcessInstanceId()); + logger.info("ProcessInstanceDTO.getProcessInstanceId:{}", dto.getProcessInstanceId()); } return new Result().ok(dto); diff --git a/renren-admin/src/main/java/io/renren/common/controller/FileUploadController.java b/renren-admin/src/main/java/io/renren/common/controller/FileUploadController.java index f110293b..035a05dd 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/FileUploadController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/FileUploadController.java @@ -27,13 +27,13 @@ public class FileUploadController { @Value("${resource.path}") private String uploadPath; @Value("${resource.root_url}") - private String root_url; + private String rootUrl; @Value("${server.servlet.context-path}") - private String context_path; + private String contextPath; private static final Logger logger = LoggerFactory.getLogger(FileUploadController.class); - private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd/"); + private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd/"); @PostMapping("/upload") @ApiOperation("文件上传") @@ -43,8 +43,8 @@ public class FileUploadController { }) public Result upload(@RequestParam("file") MultipartFile uploadFile, HttpServletRequest request) { - logger.info("上传文件:" + uploadFile.getOriginalFilename()); - String format = sdf.format(new Date()); + logger.info("上传文件:{}", uploadFile.getOriginalFilename()); + String format = SIMPLE_DATE_FORMAT.format(new Date()); File folder = new File(uploadPath + "upload" + File.separator + format); logger.info(uploadPath + format); if (!folder.isDirectory()) { @@ -52,15 +52,15 @@ public class FileUploadController { } // 对上传的文件重命名,避免文件重名 String oldName = uploadFile.getOriginalFilename(); - String newName = UUID.randomUUID().toString() - + oldName.substring(oldName.lastIndexOf("."), oldName.length()); + String newName = UUID.randomUUID() + + oldName.substring(oldName.lastIndexOf(".")); try { // 文件保存 uploadFile.transferTo(new File(folder, newName)); // 返回上传文件的访问路径 - String filePath = request.getScheme() + "://" + root_url - + ":" + request.getServerPort() + context_path + "/upload/" + format + newName; + String filePath = request.getScheme() + "://" + rootUrl + + ":" + request.getServerPort() + contextPath + "/upload/" + format + newName; return new Result().ok(filePath); } catch (IOException e) { return new Result().error(e.getMessage()); diff --git a/renren-admin/src/main/java/io/renren/common/controller/RejectController.java b/renren-admin/src/main/java/io/renren/common/controller/RejectController.java index 4173c3ee..46892259 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/RejectController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/RejectController.java @@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicReference; @RestController @RequestMapping("/reject/center") public class RejectController { - private static Logger logger = LoggerFactory.getLogger(RejectController.class); + private static final Logger logger = LoggerFactory.getLogger(RejectController.class); @Autowired protected TaskService taskService; @Autowired @@ -45,7 +45,6 @@ public class RejectController { Optional taskOptional = Optional.ofNullable(taskService.createTaskQuery().taskId(taskId).includeProcessVariables().singleResult()); taskOptional.ifPresent(task -> { Map combineResultMap = new LinkedHashMap<>(); -// combineResultMap.putAll(task.getProcessVariables()); combineResultMap.putAll(params); if (combineResultMap.containsKey("parameterContent")) { // 上架申请特殊处理 combineResultMap.remove("parameterContent"); @@ -55,7 +54,7 @@ public class RejectController { taskService.removeVariable(task.getId(), "parameterContent"); taskService.removeVariable(task.getId(), "resourceDTO"); taskService.setVariables(task.getId(), combineResultMap); // 更新 - logger.error("-----------" + JSON.toJSONString(combineResultMap)); + logger.error("-----------{}", JSON.toJSONString(combineResultMap)); taskService.setVariable(task.getId(), "backToFirst", Boolean.FALSE); // 标识驳回标签false taskService.setVariable(task.getId(), "completeEntry", Boolean.FALSE); // 标志为非首次录入 taskService.setVariable(task.getId(), "reject", Boolean.FALSE); // 标识流程中是否存在拒绝false @@ -65,7 +64,7 @@ public class RejectController { String name = userDTOOptional.isPresent() ? userDTOOptional.get().getRealName() : ""; actTaskService.completeTask(task.getId(), name + "重新发起审核"); result.set(new Result().ok(name + "重新发起审核成功")); - logger.error(name + "重新发起审核成功"); + logger.error("{}重新发起审核成功", name); }); return result.get(); } diff --git a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java index 268a1b3f..84280e3f 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java @@ -1,8 +1,8 @@ package io.renren.common.controller; - import cn.hutool.core.util.ObjectUtil; import cn.hutool.crypto.SecureUtil; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import io.renren.common.annotation.LogOperation; import io.renren.common.page.PageData; @@ -23,17 +23,21 @@ import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO; import io.renren.modules.resourceMountApply.dto.TResourceUndercarriageApplyDTO; import io.renren.modules.resourceMountApply.service.TResourceMountApplyService; import io.renren.modules.security.user.SecurityUser; +import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysUserDTO; +import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.activiti.engine.TaskService; import org.activiti.engine.task.Task; import org.activiti.engine.task.TaskQuery; +import org.apache.commons.lang3.StringUtils; import org.codehaus.jackson.map.ObjectMapper; 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.jdbc.core.JdbcTemplate; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -65,22 +69,27 @@ public class ResourceMountController { protected TaskService taskService; @Autowired private JdbcTemplate jdbcTemplate; + @Autowired + private SysDeptService sysDeptService; - private static final String apply_key = "resourcemountapply"; // 资源上架 + @Value("${big_date.name}") + private String bigDateDeptName; // 大数据局名称 - private static final String undercarriage_key = "resourcundercarriageapply"; // 资源下架 + private static final String APPLY_KEY = "resourcemountapply"; // 资源上架 + + private static final String UNDERCARRIAGE_KEY = "resourcundercarriageapply"; // 资源下架 private static final Map apply_params = new HashMap() { { put("isLatestVersion", true); // 取最新版本 - put("key", apply_key); // 限定 能力资源上架 + put("key", APPLY_KEY); // 限定 能力资源上架 } }; private static final Map undercarriage_params = new HashMap() { { put("isLatestVersion", true); // 取最新版本 - put("key", undercarriage_key); // 限定 资源下架 + put("key", UNDERCARRIAGE_KEY); // 限定 资源下架 } }; @@ -103,17 +112,26 @@ public class ResourceMountController { tResourceMountApplyDTO.setDeptId(tResourceBatchMountApplyDTO.getDeptId()); tResourceMountApplyDTO.setUserId(tResourceBatchMountApplyDTO.getUserId()); tResourceMountApplyDTO.setUserName(tResourceBatchMountApplyDTO.getUserName()); - tResourceMountApplyDTO.setParameterContent(JSONObject.toJSONString(index)); - tResourceMountApplyDTO.setParameterContentMd5(SecureUtil.md5(JSONObject.toJSONString(index))); + tResourceMountApplyDTO.setParameterContent(JSON.toJSONString(index)); + tResourceMountApplyDTO.setParameterContentMd5(SecureUtil.md5(JSON.toJSONString(index))); tResourceMountApplyDTO.setResourceDTO(index); tResourceMountApplyDTO.setEnclosure(index.getEnclosure()); -// tResourceMountApplyDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("NLSJ")); try { tResourceMountApplyDTO.setResourceId(tResourceMountApplyDTO.getResourceDTO().getId()); } catch (Exception e) { logger.error("资源上架异常", e); } + if (StringUtils.isEmpty(tResourceBatchMountApplyDTO.getDeptId())) { + Optional userDTO = Optional.ofNullable(sysUserService.get(Long.valueOf(tResourceBatchMountApplyDTO.getUserId()))); + userDTO.ifPresent(user -> { + if (user.getSuperAdmin() == 1) { + SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName); + tResourceMountApplyDTO.setDeptId(deptDTO.getId().toString()); + } + }); + } + ValidatorUtils.validateEntity(tResourceMountApplyDTO, AddGroup.class, DefaultGroup.class); tResourceMountApplyService.save(tResourceMountApplyDTO); // 保存单条资源申请记录 if (tResourceMountApplyDTO.getId() == null) { @@ -132,22 +150,22 @@ public class ResourceMountController { // 仿照请求接口 /act/running/startOfBusinessKey ProcessStartDTO processStartDTO = new ProcessStartDTO(); processStartDTO.setBusinessKey(tResourceMountApplyDTO.getId().toString()); - processStartDTO.setProcessDefinitionKey(apply_key); // 限定资源上架 + processStartDTO.setProcessDefinitionKey(APPLY_KEY); // 限定资源上架 Map variables = oMapper.convertValue(tResourceMountApplyDTO, Map.class); processStartDTO.setVariables(variables); ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO); logger.info("-------------------2.启动流程成功--------------------------"); - logger.info("ProcessInstanceDTO.getBusinessKey:" + dto.getBusinessKey()); + logger.info("ProcessInstanceDTO.getBusinessKey:{}", dto.getBusinessKey()); if (Long.valueOf(dto.getBusinessKey()) != null) { // 仿照请求接口 /processForm/tabilityapplication/updateInstanceId tResourceMountApplyService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey())); logger.info("-------------------更新updateInstanceId.成功--------------------------"); - logger.info("ProcessInstanceDTO.getProcessInstanceId:" + dto.getProcessInstanceId()); + logger.info("ProcessInstanceDTO.getProcessInstanceId:{}", dto.getProcessInstanceId()); } return dto; - }).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList())); + }).filter(ObjectUtil::isNotNull).collect(Collectors.toList())); } @PostMapping(value = "/undercarriage") @@ -168,7 +186,7 @@ public class ResourceMountController { Optional resourceDTO = Optional.ofNullable(resourceService.get(resourceId)); if (resourceDTO.isPresent()) { TaskQuery taskQuery = taskService.createTaskQuery(); - long task = taskQuery.active().processDefinitionKey(undercarriage_key).processInstanceBusinessKey(resourceId.toString()).count(); + long task = taskQuery.active().processDefinitionKey(UNDERCARRIAGE_KEY).processInstanceBusinessKey(resourceId.toString()).count(); return task > 0; } else { return true; @@ -180,11 +198,10 @@ public class ResourceMountController { return new Result().ok(tResourceUndercarriageApplyDTO.getResource().stream().map(index -> { List dtoList = new ArrayList<>(); Long resourceId = Long.valueOf(index.get("resourceId")); -// String resourceName = index.get("resourceName"); Optional resourceDTO = Optional.ofNullable(resourceService.get(resourceId)); resourceDTO.ifPresent(dto -> { TaskQuery taskQuery = taskService.createTaskQuery(); - long task = taskQuery.active().processDefinitionKey(undercarriage_key).processInstanceBusinessKey(resourceId.toString()).count(); + long task = taskQuery.active().processDefinitionKey(UNDERCARRIAGE_KEY).processInstanceBusinessKey(resourceId.toString()).count(); if (task > 0) { logger.error("该资源已发起下架"); throw new RuntimeException("该资源已发起下架"); @@ -207,13 +224,13 @@ public class ResourceMountController { // 仿照请求接口 /act/running/startOfBusinessKey ProcessStartDTO processStartDTO = new ProcessStartDTO(); processStartDTO.setBusinessKey(resourceId.toString()); - processStartDTO.setProcessDefinitionKey(undercarriage_key); // 限定资源下架 + processStartDTO.setProcessDefinitionKey(UNDERCARRIAGE_KEY); // 限定资源下架 Map variables = oMapper.convertValue(dto, Map.class); processStartDTO.setVariables(variables); ProcessInstanceDTO index_ = actRunningService.startOfBusinessKey(processStartDTO); logger.info("-------------------2.启动流程成功--------------------------"); - logger.info("ProcessInstanceDTO.getBusinessKey:" + index_.getBusinessKey()); + logger.info("ProcessInstanceDTO.getBusinessKey:{}", index_.getBusinessKey()); dtoList.add(index_); }); return dtoList.stream().findAny().orElse(null); diff --git a/renren-admin/src/main/java/io/renren/common/domain/BaoTouProperties.java b/renren-admin/src/main/java/io/renren/common/domain/BaoTouProperties.java index ba42981b..ecb3e82e 100644 --- a/renren-admin/src/main/java/io/renren/common/domain/BaoTouProperties.java +++ b/renren-admin/src/main/java/io/renren/common/domain/BaoTouProperties.java @@ -1,12 +1,10 @@ package io.renren.common.domain; - import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; - /** * 包头区域配置项 */ diff --git a/renren-admin/src/main/java/io/renren/common/domain/TsingtaoProperties.java b/renren-admin/src/main/java/io/renren/common/domain/TsingtaoProperties.java index e00d2ff9..6bd7a177 100644 --- a/renren-admin/src/main/java/io/renren/common/domain/TsingtaoProperties.java +++ b/renren-admin/src/main/java/io/renren/common/domain/TsingtaoProperties.java @@ -1,6 +1,5 @@ package io.renren.common.domain; - import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.PropertySource; diff --git a/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java b/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java index 4ca445b3..202ddf1e 100644 --- a/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java +++ b/renren-admin/src/main/java/io/renren/common/dto/AuditingBaseDTO.java @@ -9,6 +9,8 @@ import java.io.Serializable; */ @Data public class AuditingBaseDTO implements Serializable { + + private static final long serialVersionUID = -6612029904210773020L; /** * 流程中是否存在拒绝? */ @@ -34,4 +36,9 @@ public class AuditingBaseDTO implements Serializable { */ private Boolean backPreviousTask = null; + /** + * 发起者主动终止流程 + */ + private Boolean endByUser = null; + } diff --git a/renren-admin/src/main/java/io/renren/common/handler/FieldMetaObjectHandler.java b/renren-admin/src/main/java/io/renren/common/handler/FieldMetaObjectHandler.java index 73ec0c3d..84cbbbc7 100644 --- a/renren-admin/src/main/java/io/renren/common/handler/FieldMetaObjectHandler.java +++ b/renren-admin/src/main/java/io/renren/common/handler/FieldMetaObjectHandler.java @@ -14,11 +14,11 @@ import java.util.Date; */ @Component public class FieldMetaObjectHandler implements MetaObjectHandler { - private final static String CREATE_DATE = "createDate"; - private final static String CREATOR = "creator"; - private final static String UPDATE_DATE = "updateDate"; - private final static String UPDATER = "updater"; - private final static String DEPT_ID = "deptId"; + private static final String CREATE_DATE = "createDate"; + private static final String CREATOR = "creator"; + private static final String UPDATE_DATE = "updateDate"; + private static final String UPDATER = "updater"; + private static final String DEPT_ID = "deptId"; @Override public void insertFill(MetaObject metaObject) { diff --git a/renren-admin/src/main/java/io/renren/common/listener/InitiatorDataEntryListener.java b/renren-admin/src/main/java/io/renren/common/listener/InitiatorDataEntryListener.java index 35878a58..bc7507ea 100644 --- a/renren-admin/src/main/java/io/renren/common/listener/InitiatorDataEntryListener.java +++ b/renren-admin/src/main/java/io/renren/common/listener/InitiatorDataEntryListener.java @@ -30,18 +30,16 @@ public class InitiatorDataEntryListener implements TaskListener { @Override public void notify(DelegateTask delegateTask) { logger.error("----------------------流程发起人录入表单节点---------------------------"); - logger.error("事件类型:" + delegateTask.getEventName()); + logger.error("事件类型:{}", delegateTask.getEventName()); final String eventName = delegateTask.getEventName(); - switch (eventName) { - case EVENTNAME_CREATE: - create(delegateTask); - break; + if (EVENTNAME_CREATE.equals(eventName)) { + create(delegateTask); } } private void create(DelegateTask delegateTask) { Map kv = delegateTask.getVariables(); - logger.error("录入表单:" + kv.toString()); + logger.error("录入表单:{}", kv.toString()); if (kv.containsKey("creator")) { // 表单存在创建者 taskService.setAssignee(delegateTask.getId(), kv.get("creator").toString()); taskService.setOwner(delegateTask.getId(), kv.get("creator").toString()); // 指定流程所有人 @@ -58,13 +56,12 @@ public class InitiatorDataEntryListener implements TaskListener { if (auditingBaseDTO.getBackToFirst() != null && auditingBaseDTO.getBackToFirst()) { logger.error("被驳回,需修改后重新提交"); } else { - if (auditingBaseDTO.getCompleteEntry()) { + if (Boolean.TRUE.equals(auditingBaseDTO.getCompleteEntry())) { taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "完成申请提交"); taskService.complete(delegateTask.getId(), delegateTask.getVariables()); logger.error("首次录入,自动审核通过!"); } } logger.error("----------完成录入表单-----------"); - return; } } diff --git a/renren-admin/src/main/java/io/renren/common/utils/CodeGenerationUtils.java b/renren-admin/src/main/java/io/renren/common/utils/CodeGenerationUtils.java index 7d89bdb5..74e3514d 100644 --- a/renren-admin/src/main/java/io/renren/common/utils/CodeGenerationUtils.java +++ b/renren-admin/src/main/java/io/renren/common/utils/CodeGenerationUtils.java @@ -31,7 +31,7 @@ public class CodeGenerationUtils { */ enum CodeGenerationUtilsEnum { INSTANCE; - private CodeGenerationUtils codeGenerationUtils; + private final CodeGenerationUtils codeGenerationUtils; CodeGenerationUtilsEnum() { codeGenerationUtils = new CodeGenerationUtils(); @@ -86,6 +86,8 @@ public class CodeGenerationUtils { case "NLXJ": tableName = "tb_data_resource"; break; + default: + break; } lock.lock(); String sql = "SELECT SUBSTR(apply_number, 5) FROM " + tableName + @@ -99,7 +101,6 @@ public class CodeGenerationUtils { String s = jdbcTemplate.queryForObject(sql, String.class); no = applyNumberPattern.substring(0, 4) + (Long.parseLong(s) + 1); } catch (Exception e) { - logger.error("流水号生成失败", e); no = applyNumberPattern + "0001"; } finally { try { diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/config/ProcessEngineConfig.java b/renren-admin/src/main/java/io/renren/modules/activiti/config/ProcessEngineConfig.java index 6474d469..ebdfce32 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/config/ProcessEngineConfig.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/config/ProcessEngineConfig.java @@ -20,7 +20,5 @@ public class ProcessEngineConfig implements ProcessEngineConfigurationConfigurer processEngineConfiguration.setJobExecutorActivate(false); processEngineConfiguration.setAsyncExecutorEnabled(false); - //自定义流程图样式 - //processEngineConfiguration.setProcessDiagramGenerator(customProcessDiagramGenerator); } } diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActProcessController.java b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActProcessController.java index 04498ea0..531b66db 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActProcessController.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActProcessController.java @@ -18,7 +18,6 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -145,9 +144,9 @@ public class ActProcessController { InputStream resourceAsStream = actProcessService.getResourceAsStream(deploymentId, resourceName); String[] fileNames = resourceName.split("\\."); if(fileNames.length>1){ - if(fileNames[fileNames.length-1].toLowerCase().equals("png")){ + if(fileNames[fileNames.length-1].equalsIgnoreCase("png")){ response.setHeader("Content-Type","image/png"); - } else if(fileNames[fileNames.length-1].toLowerCase().equals("xml")){ + } else if(fileNames[fileNames.length-1].equalsIgnoreCase("xml")){ response.setHeader("Content-Type", "text/xml"); response.setHeader("Content-Disposition", "attachment; filename=" + java.net.URLEncoder.encode(resourceName, "UTF-8")); } diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActRunningController.java b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActRunningController.java index 7cdfb174..3c68f73c 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActRunningController.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActRunningController.java @@ -11,34 +11,39 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.activiti.engine.RuntimeService; +import org.activiti.engine.runtime.ProcessInstance; +import org.activiti.engine.runtime.ProcessInstanceQuery; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; +import java.util.List; import java.util.Map; /** * 运行中的流程 - * */ @RestController @RequestMapping("/act/running") -@Api(tags="运行中的流程") +@Api(tags = "运行中的流程") public class ActRunningController { @Autowired private ActRunningService actRunningService; + @Autowired + private RuntimeService runtimeService; @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") , - @ApiImplicitParam(name = "id", value = "实例ID", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "definitionKey", value = "definitionKey", paramType = "query", dataType="String") + @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 = "id", value = "实例ID", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "definitionKey", value = "definitionKey", paramType = "query", dataType = "String") }) // @RequiresPermissions("sys:running:all") - public Result>> page(@ApiIgnore @RequestParam Map params){ + public Result>> page(@ApiIgnore @RequestParam Map params) { PageData> page = actRunningService.page(params); return new Result>>().ok(page); @@ -48,18 +53,29 @@ public class ActRunningController { @ApiOperation("删除运行中的流程") @LogOperation("删除运行中的流程") // @RequiresPermissions("sys:running:all") - @ApiImplicitParam(name = "id", value = "ID", paramType = "query", dataType="String") + @ApiImplicitParam(name = "id", value = "ID", paramType = "query", dataType = "String") public Result deleteInstance(@PathVariable("id") String id) { actRunningService.delete(id); return new Result(); } + + @GetMapping("deleteAllInstance") + public Result deleteAllInstance() { + ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery(); + List processInstanceList = processInstanceQuery.list(); + processInstanceList.stream().forEach(index -> { + actRunningService.delete(index.getId()); + }); + return new Result(); + } + @PostMapping("start") @ApiOperation("启动流程实例,依据流程定义KEY,启动流程实例") @LogOperation("启动流程实例,依据流程定义KEY,启动流程实例") - @ApiImplicitParam(name = "key", value = "流程定义标识key", paramType = "query", dataType="String") + @ApiImplicitParam(name = "key", value = "流程定义标识key", paramType = "query", dataType = "String") // @RequiresPermissions("sys:running:all") - public Result start(String key){ + public Result start(String key) { ProcessInstanceDTO dto = actRunningService.startProcess(key); return new Result().ok(dto); } @@ -68,7 +84,7 @@ public class ActRunningController { @ApiOperation("启动流程实例,依据流程定义ID和业务唯一标示启动实例") @LogOperation("启动流程实例,依据流程定义ID和业务唯一标示启动实例") // @RequiresPermissions("sys:running:all") - public Result startOfBusinessKey(@RequestBody ProcessStartDTO processStartDTO){ + public Result startOfBusinessKey(@RequestBody ProcessStartDTO processStartDTO) { ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO); return new Result().ok(dto); } diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java index 1388fd00..e3fcf86a 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java @@ -65,7 +65,7 @@ public class ActTaskController { */ @GetMapping("myToDoTaskPage") @ApiOperation("我的待办列表") - @LogOperation("我的待办列表查询") +// @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"), @@ -290,11 +290,18 @@ public class ActTaskController { @LogOperation("终止流程(直接全拒绝)") @ApiImplicitParams({ @ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "instanceId", value = "实例ID", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "comment", value = "终止审核意见", paramType = "query", dataType = "String") }) // @RequiresPermissions("sys:task:all") - public Result endProcess(String taskId, String comment) { - actTaskService.endProcess(taskId, comment); + public Result endProcess(String taskId, String instanceId, String comment) { +// final UserDetail user = SecurityUser.getUser(); + if (!StringUtils.isEmpty(taskId)) { // 存在taskId + actTaskService.endProcess(taskId, comment); + } + if (StringUtils.isEmpty(taskId) && !StringUtils.isEmpty(instanceId)) { // 通过实例id + actTaskService.endProcessInstanceId(instanceId, comment); + } return new Result(); } diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/org/activiti/rest/editor/model/ModelSaveRestResource.java b/renren-admin/src/main/java/io/renren/modules/activiti/org/activiti/rest/editor/model/ModelSaveRestResource.java index e3f850d7..f95a1351 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/org/activiti/rest/editor/model/ModelSaveRestResource.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/org/activiti/rest/editor/model/ModelSaveRestResource.java @@ -20,6 +20,7 @@ import javax.servlet.http.HttpServletRequest; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.nio.charset.StandardCharsets; /** * Model Rest @@ -56,9 +57,9 @@ public class ModelSaveRestResource implements ModelDataJsonConstants { repositoryService.saveModel(model); - repositoryService.addModelEditorSource(model.getId(), jsonXml.getBytes("utf-8")); + repositoryService.addModelEditorSource(model.getId(), jsonXml.getBytes(StandardCharsets.UTF_8)); - InputStream svgStream = new ByteArrayInputStream(svgXml.getBytes("utf-8")); + InputStream svgStream = new ByteArrayInputStream(svgXml.getBytes(StandardCharsets.UTF_8)); TranscoderInput input = new TranscoderInput(svgStream); PNGTranscoder transcoder = new PNGTranscoder(); diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java index 0f65712c..381f95d9 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java @@ -204,9 +204,9 @@ public class ActHistoryService { query.processDefinitionId((String) params.get("processDefinitionId")); } if (StringUtils.isNotEmpty((String) params.get("ended"))) { - if ("true".equals((String) params.get("ended"))) { + if ("true".equals(params.get("ended"))) { query.finished(); - } else if ("false".equals((String) params.get("ended"))) { + } else if ("false".equals(params.get("ended"))) { query.unfinished(); } } @@ -231,7 +231,7 @@ public class ActHistoryService { if (!list.isEmpty()) { this.converHistoricProcessInstance(list, listInstance); } - return new PageData(listInstance, (int) query.count()); + return new PageData<>(listInstance, (int) query.count()); } private void converHistoricProcessInstance(List list, List listInstance) { @@ -324,9 +324,7 @@ public class ActHistoryService { dto.setResourceId(null); dto.setDemandCommentFlag(tDemandCommentDTO.getDelFlag()); Optional tDemandCommentEntityDelFlag = Optional.ofNullable(TDemandCommentEntityDelFlag.getByFlag(tDemandCommentDTO.getDelFlag())); - if (tDemandCommentEntityDelFlag.isPresent()) { - dto.setDemandCommentFlagTip(tDemandCommentEntityDelFlag.get().getTip()); - } + tDemandCommentEntityDelFlag.ifPresent(demandCommentEntityDelFlag -> dto.setDemandCommentFlagTip(demandCommentEntityDelFlag.getTip())); dto.setApplyNumber(tDemandCommentDTO.getApplyNumber()); } else { TDemandDataDTO tDemandDataDTO = tDemandDataService.get(Long.valueOf(dto.getBusinessKey())); @@ -335,9 +333,7 @@ public class ActHistoryService { dto.setResourceId(null); dto.setDemandFlag(tDemandDataDTO.getFlag()); Optional tDemandCommentEntityDelFlag = Optional.ofNullable(TDemandDataEntityFlag.getByFlag(tDemandDataDTO.getFlag())); - if (tDemandCommentEntityDelFlag.isPresent()) { - dto.setDemandFlagTip(tDemandCommentEntityDelFlag.get().getTip()); - } + tDemandCommentEntityDelFlag.ifPresent(tDemandDataEntityFlag -> dto.setDemandFlagTip(tDemandDataEntityFlag.getTip())); dto.setApplyNumber(tDemandDataDTO.getApplyNumber()); } } diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActModelService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActModelService.java index 0cd8dd97..ef558dc8 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActModelService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActModelService.java @@ -113,7 +113,7 @@ public class ActModelService { ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes); Deployment deployment = repositoryService.createDeployment().name(model.getName()).addInputStream(processName, in).deploy(); List list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list(); - if (list.size() == 0) { + if (list.isEmpty()) { throw new RenException(ErrorCode.ACT_DEPLOY_ERROR); } } catch (Exception e) { @@ -156,7 +156,7 @@ public class ActModelService { List names = repositoryService.getDeploymentResourceNames(deploymentId); String imageName = null; for (String name : names) { - if (name.indexOf(".png") >= 0) { + if (name.contains(".png")) { imageName = name; break; } diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActProcessService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActProcessService.java index d475726a..0c53c7df 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActProcessService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActProcessService.java @@ -123,7 +123,7 @@ public class ActProcessService { if("zip".equalsIgnoreCase(extension) || "bar".equalsIgnoreCase(extension)) { ZipInputStream zip = new ZipInputStream(file.getInputStream()); repositoryService.createDeployment().addZipInputStream(zip).deploy(); - }else if(fileName.indexOf("bpmn20.xml") != -1){ + }else if(fileName.contains("bpmn20.xml")){ repositoryService.createDeployment().addInputStream(fileName, file.getInputStream()).deploy(); }else if("bpmn".equalsIgnoreCase(extension)){ repositoryService.createDeployment().addInputStream(fileName, file.getInputStream()).deploy(); @@ -197,9 +197,7 @@ public class ActProcessService { * @param resourceName 资源名称 */ public InputStream getResourceAsStream(String deploymentId, String resourceName) { - InputStream resourceAsStream = repositoryService.getResourceAsStream(deploymentId, resourceName); - - return resourceAsStream; + return repositoryService.getResourceAsStream(deploymentId, resourceName); } } 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 8e85a94e..526f991a 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 @@ -1,5 +1,7 @@ package io.renren.modules.activiti.service; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.renren.common.constant.Constant; @@ -71,8 +73,8 @@ public class ActTaskService extends BaseServiceImpl { private static final Logger logger = LoggerFactory.getLogger(ActTaskService.class); private static final ObjectMapper oMapper = new ObjectMapper(); - private static Integer cpuNUm = Runtime.getRuntime().availableProcessors(); - private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm); + private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors(); + private static final ExecutorService executor = Executors.newFixedThreadPool(CPUNUM); public static String Task_HANDLE_STATE = "handleState"; //任务节点处理状态key public static String Task_HANDLE_STATE_AGREE = "agree"; //同意 @@ -128,7 +130,7 @@ public class ActTaskService extends BaseServiceImpl { taskQuery.taskAssignee(userId); } if (StringUtils.isNotEmpty((String) params.get("taskName"))) { - taskQuery.taskNameLike("%" + (String) params.get("taskName") + "%"); + taskQuery.taskNameLike("%" + params.get("taskName") + "%"); } if (StringUtils.isNotEmpty((String) params.get("processDefinitionKey"))) { // 流程定义key taskQuery.processDefinitionKey((String) params.get("processDefinitionKey")); @@ -186,20 +188,18 @@ public class ActTaskService extends BaseServiceImpl { return completableFuture; }).collect(Collectors.toList()); CompletableFuture.allOf(completableFutureList.toArray(new CompletableFuture[completableFutureList.size()])).join(); - Page page = new Page(curPage, limit); + Page page = new Page<>(curPage, limit); if (taskDtoList.isEmpty()) { page.setRecords(null); page.setTotal(0); } else { - ArrayList recordLists = new ArrayList<>(); - recordLists.addAll(taskDtoList.stream() + ArrayList recordLists = new ArrayList<>(taskDtoList.stream() .distinct() .sorted(Comparator.comparing(TaskDTO::getCreateTime).reversed()) .limit(limit) - .collect(Collectors.toList()) - ); + .collect(Collectors.toList())); page.setRecords(recordLists); - page.setTotal(count.stream().mapToLong(index -> index.longValue()).sum()); + page.setTotal(count.stream().mapToLong(Long::longValue).sum()); } return page; } @@ -210,6 +210,17 @@ public class ActTaskService extends BaseServiceImpl { TaskDTO dto = new TaskDTO(); this.convertTaskInfo(task, dto); Map processVariable = new LinkedHashMap<>(); + if (task.getProcessVariables().containsKey("tAbilityApplicationDTOList")) { + processVariable.putAll(task.getProcessVariables()); + dto.setParams(processVariable); + List dtoList = (List) task.getProcessVariables().get("tAbilityApplicationDTOList"); + JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(dtoList.get(0))); + if (jsonObject != null) { + dto.setUserName(jsonObject.containsKey("user") ? jsonObject.getString("user") : ""); + } + listDto.add(dto); + continue; + } if (dto.getBusinessKey().startsWith("{") || dto.getBusinessKey().startsWith("[")) { // 为json内容 (特殊处理批量) processVariable.putAll(task.getProcessVariables()); @@ -430,6 +441,31 @@ public class ActTaskService extends BaseServiceImpl { return flag; } + private boolean isMultiInstanceByInstanceId(String instanceId) { + boolean flag = false; + Task task = taskService.createTaskQuery().processInstanceId(instanceId).list().stream().sorted( + Comparator.comparing(x -> { + Task index = (Task) x; + return index.getCreateTime(); + }).reversed() + ).limit(1).findAny().orElse(null); + if (task != null) { + // 获取流程定义id + String processDefinitionId = task.getProcessDefinitionId(); + ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) repositoryService.getProcessDefinition(processDefinitionId); + // 根据活动id获取活动实例 + ActivityImpl activityImpl = processDefinitionEntity.findActivity(task.getTaskDefinitionKey()); + if ((activityImpl).getActivityBehavior() instanceof ParallelMultiInstanceBehavior) { + ParallelMultiInstanceBehavior behavior = (ParallelMultiInstanceBehavior) activityImpl.getActivityBehavior(); + if (behavior != null && behavior.getCollectionExpression() != null) { + flag = true; + } + } + } + + return flag; + } + /** * 删除任务下的所有变量 * @@ -443,10 +479,10 @@ public class ActTaskService extends BaseServiceImpl { public void deleteTaskVariable(String taskId, String variableName, String scope) { if (StringUtils.isNotEmpty(scope)) { - if ("global".equals(scope.toLowerCase())) { + if ("global".equalsIgnoreCase(scope)) { Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); runtimeService.removeVariable(task.getExecutionId(), variableName); - } else if ("local".equals(scope.toLowerCase())) { + } else if ("local".equalsIgnoreCase(scope)) { taskService.removeVariable(taskId, variableName); } } else { @@ -462,7 +498,7 @@ public class ActTaskService extends BaseServiceImpl { */ @Transactional(rollbackFor = Exception.class) public void doBackPreviousTask(String taskId, String comment) { - Map variables = null; + Map variables; HistoricTaskInstance currTask = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult(); if (this.isMultiInstance(taskId)) { throw new RenException(ErrorCode.BACK_PROCESS_PARALLEL_ERROR); @@ -476,11 +512,8 @@ public class ActTaskService extends BaseServiceImpl { if (canBackActivitys.isEmpty()) { throw new RenException(ErrorCode.SUPERIOR_NOT_EXIST); } - List originPvmTransitionList = new ArrayList(); List pvmTransitionList = currActivity.getOutgoingTransitions(); - for (PvmTransition pvmTransition : pvmTransitionList) { - originPvmTransitionList.add(pvmTransition); - } + List originPvmTransitionList = new ArrayList<>(pvmTransitionList); pvmTransitionList.clear(); List historicActivityInstances = historyService .createHistoricActivityInstanceQuery().activityType("userTask") @@ -595,12 +628,9 @@ public class ActTaskService extends BaseServiceImpl { taskService.complete(taskId); } else { ActivityImpl currActivity = findActivitiImpl(taskId, null); - List oriPvmTransitionList = new ArrayList(); List pvmTransitionList = currActivity .getOutgoingTransitions(); - for (PvmTransition pvmTransition : pvmTransitionList) { - oriPvmTransitionList.add(pvmTransition); - } + List oriPvmTransitionList = new ArrayList<>(pvmTransitionList); pvmTransitionList.clear(); TransitionImpl newTransition = currActivity.createOutgoingTransition(); ActivityImpl pointActivity = findActivitiImpl(taskId, endActivity.getId()); @@ -617,9 +647,64 @@ public class ActTaskService extends BaseServiceImpl { pointActivity.getIncomingTransitions().remove(newTransition); List pvmTransitionListC = currActivity.getOutgoingTransitions(); pvmTransitionListC.clear(); - for (PvmTransition pvmTransition : oriPvmTransitionList) { - pvmTransitionListC.add(pvmTransition); + pvmTransitionListC.addAll(oriPvmTransitionList); + } + + } + + @Transactional(rollbackFor = Exception.class) + public void endProcessInstanceId(String instanceId, String comment) { + if (isMultiInstanceByInstanceId(instanceId)) { + throw new RenException(ErrorCode.END_PROCESS_PARALLEL_ERROR); + } + Task task = taskService.createTaskQuery().processInstanceId(instanceId).active().list().stream().sorted( + Comparator.comparing(x -> { + Task index = (Task) x; + return index.getCreateTime(); + }).reversed() + ).limit(1).findAny().orElse(null); + if (task == null) { + logger.error("查不到流程对应task"); + return; + } + List tasks = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()).active() + .taskDefinitionKey(task.getTaskDefinitionKey()).active().list(); + if (tasks.size() > 1) { + throw new RenException(ErrorCode.END_PROCESS_HANDLEING_ERROR); + } + ActivityImpl endActivity = findActivitiImplByInstanceId(instanceId, "end"); + if (endActivity == null) { + return; + } + if (StringUtils.isEmpty(endActivity.getId())) { + if (!StringUtils.isEmpty(task.getOwner())) { + taskService.resolveTask(task.getId()); } + taskService.addComment(task.getId(), task.getProcessInstanceId(), comment); + taskService.complete(task.getId()); + } else { + ActivityImpl currActivity = findActivitiImplByInstanceId(instanceId, null); + List pvmTransitionList = currActivity + .getOutgoingTransitions(); + List oriPvmTransitionList = new ArrayList<>(pvmTransitionList); + pvmTransitionList.clear(); + TransitionImpl newTransition = currActivity.createOutgoingTransition(); + ActivityImpl pointActivity = findActivitiImplByInstanceId(instanceId, endActivity.getId()); + newTransition.setDestination(pointActivity); + if (StringUtils.isNotEmpty(task.getOwner())) { + taskService.resolveTask(task.getId()); + } + String message = MessageUtils.getMessage(ErrorCode.END_PROCESS_MESSAGE); + comment = message + "[" + comment + "]"; + taskService.addComment(task.getId(), task.getProcessInstanceId(), comment); + taskService.setVariable(task.getId(), Task_HANDLE_STATE, Task_HANDLE_STATE_STOP); + taskService.setVariable(task.getId(), "endByUser", Boolean.TRUE); // 主动终止流程 + taskService.setVariable(task.getId(), "reject", Boolean.TRUE); // 存在被拒绝的批示 + taskService.complete(task.getId()); + pointActivity.getIncomingTransitions().remove(newTransition); + List pvmTransitionListC = currActivity.getOutgoingTransitions(); + pvmTransitionListC.clear(); + pvmTransitionListC.addAll(oriPvmTransitionList); } } @@ -636,7 +721,7 @@ public class ActTaskService extends BaseServiceImpl { if (StringUtils.isEmpty(activityId)) { activityId = task.getTaskDefinitionKey(); } - if ("END".equals(activityId.toUpperCase())) { + if ("END".equalsIgnoreCase(activityId)) { for (ActivityImpl activityImpl : processDefinition.getActivities()) { String type = (String) activityImpl.getProperty("type"); if ("endEvent".equals(type)) { @@ -644,8 +729,30 @@ public class ActTaskService extends BaseServiceImpl { } } } - ActivityImpl activityImpl = processDefinition.findActivity(activityId); - return activityImpl; + return processDefinition.findActivity(activityId); + } + + private ActivityImpl findActivitiImplByInstanceId(String instanceId, String activityId) { + Task task = taskService.createTaskQuery().processInstanceId(instanceId).list().stream().findAny().orElse(null); + if (task == null) { + return null; + } + ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(task.getProcessDefinitionId()); + if (processDefinition == null) { + throw new RenException(ErrorCode.NONE_EXIST_PROCESS); + } + if (StringUtils.isEmpty(activityId)) { + activityId = task.getTaskDefinitionKey(); + } + if ("END".equalsIgnoreCase(activityId)) { + for (ActivityImpl activityImpl : processDefinition.getActivities()) { + String type = (String) activityImpl.getProperty("type"); + if ("endEvent".equals(type)) { + return activityImpl; + } + } + } + return processDefinition.findActivity(activityId); } /** @@ -685,7 +792,7 @@ public class ActTaskService extends BaseServiceImpl { if (this.isMultiInstance(taskId)) { throw new RenException(ErrorCode.REJECT_PROCESS_PARALLEL_ERROR); } - Map variables = null; + Map variables; HistoricTaskInstance currTask = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult(); ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(currTask.getProcessInstanceId()).singleResult(); ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService) @@ -699,18 +806,15 @@ public class ActTaskService extends BaseServiceImpl { throw new RenException(ErrorCode.REJECT_PROCESS_HANDLEING_ERROR); } ActivityImpl currActivity = processDefinitionEntity.findActivity(currTask.getTaskDefinitionKey()); - List originPvmTransitionList = new ArrayList<>(); List pvmTransitionList = currActivity.getOutgoingTransitions(); - for (PvmTransition pvmTransition : pvmTransitionList) { - originPvmTransitionList.add(pvmTransition); - } + List originPvmTransitionList = new ArrayList<>(pvmTransitionList); pvmTransitionList.clear(); List historicActivityInstances = historyService .createHistoricActivityInstanceQuery().activityType("userTask") .processInstanceId(processInstance.getId()) .finished().orderByHistoricActivityInstanceEndTime().asc().list(); - TransitionImpl transitionImpl = null; - if (historicActivityInstances.size() > 0) { + TransitionImpl transitionImpl; + if (!historicActivityInstances.isEmpty()) { ActivityImpl lastActivity = processDefinitionEntity.findActivity(historicActivityInstances.get(0).getActivityId()); transitionImpl = currActivity.createOutgoingTransition(); transitionImpl.setDestination(lastActivity); @@ -729,9 +833,7 @@ public class ActTaskService extends BaseServiceImpl { } currActivity.getOutgoingTransitions().remove(transitionImpl); - for (PvmTransition pvmTransition : originPvmTransitionList) { - pvmTransitionList.add(pvmTransition); - } + pvmTransitionList.addAll(originPvmTransitionList); } public void completeTaskByVariables(TaskDTO taskDTO) { diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/impl/ProcessBizRouteServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/impl/ProcessBizRouteServiceImpl.java index 825f56ec..b8726324 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/impl/ProcessBizRouteServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/impl/ProcessBizRouteServiceImpl.java @@ -19,8 +19,7 @@ public class ProcessBizRouteServiceImpl extends BaseServiceImpl get(@PathVariable("id") Long id) { TDemandDataDTO data = tDemandDataService.get(id); - data.setCommentCount(tDemandCommentService.commentCount(id)); + if (data != null) { + data.setCommentCount(tDemandCommentService.commentCount(id)); + } return new Result().ok(data); } diff --git a/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java b/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java index 65624750..5f003283 100644 --- a/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java +++ b/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java @@ -1,5 +1,6 @@ package io.renren.modules.demanData.listener; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -40,7 +41,7 @@ import java.util.Optional; */ @Component public class DemandDataListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate { - private static Logger logger = LoggerFactory.getLogger(DemandDataListener.class); + private static final Logger logger = LoggerFactory.getLogger(DemandDataListener.class); private static final ObjectMapper oMapper = new ObjectMapper(); @Value("${big_date.name}") @@ -69,9 +70,7 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti logger.error("----------------------进入能力需求受理者结束节点---------------------------"); execution.getProcessBusinessKey(); final String eventName = execution.getEventName(); - switch (eventName) { - case EVENTNAME_END: - break; + if (EVENTNAME_END.equals(eventName)) { } } @@ -84,9 +83,9 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti @ActivitiNoticeOperation(value = "需求部门审批", process = "能力需求申请") public void notify(DelegateTask delegateTask) { logger.error("----------------------进入能力需求受理者1节点---------------------------"); - logger.error("事件类型:" + delegateTask.getEventName()); + logger.error("事件类型:{}", delegateTask.getEventName()); SysRoleDTO roleDTO = sysRoleService.getByName(roleName); - logger.error("roleDTOId:" + roleDTO.getId()); + logger.error("roleDTOId:{}", roleDTO.getId()); final String eventName = delegateTask.getEventName(); switch (eventName) { case EVENTNAME_CREATE: // 进入节点 @@ -96,7 +95,7 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti complete(delegateTask); break; default: - logger.error("未处理该事件:" + eventName); + logger.error("未处理该事件:{}", eventName); } logger.error("----------------------结束能力需求受理者1节点---------------------------"); } @@ -131,7 +130,7 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti TDemandDataDTO demandDataDTO = gson.fromJson(jsonElement, TDemandDataDTO.class); if (demandDataDTO != null && demandDataDTO.getApplyUserDeptId() != null) { - logger.error(JSONObject.toJSONString(demandDataDTO)); + logger.error(JSON.toJSONString(demandDataDTO)); SysDeptDTO deptDTO = sysDeptService.get(Long.valueOf(demandDataDTO.getApplyUserDeptId())); SysUserDTO userDTO = null; @@ -139,27 +138,27 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId()); // 搜出审批人 } if (userDTO != null) { - logger.error("审批人id:" + userDTO.getId()); + logger.error("审批人id:{}", userDTO.getId()); taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString()); assignee = userDTO.getId().toString(); } else { - logger.error("未查到该部门对应的 " + roleName); + logger.error("未查到该部门对应的{} ", roleName); taskService.setAssignee(delegateTask.getId(), "1516728698224427010"); assignee = "1516728698224427010"; } } else { // 填入大数据审批人 - logger.error("大数据局名称:" + bigDateDeptName); + logger.error("大数据局名称:{}", bigDateDeptName); SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName); - logger.error("roleDTOId:" + roleDTO.getId()); + logger.error("roleDTOId:{}", roleDTO.getId()); SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId()); if (userDTO != null) { - logger.error("大数据审批人id:" + userDTO.getId()); + logger.error("大数据审批人id:{}", userDTO.getId()); taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString()); assignee = userDTO.getId().toString(); } else { taskService.setAssignee(delegateTask.getId(), "1516728698224427010"); - logger.error("未查到大数据部门对应 " + roleName); + logger.error("未查到大数据部门对应 {}", roleName); assignee = "1516728698224427010"; } } @@ -186,7 +185,7 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti TDemandDataDTO demandDataDTO = gson.fromJson(jsonElement, TDemandDataDTO.class); if (demandDataDTO != null) { - logger.error(JSONObject.toJSONString(demandDataDTO)); + logger.error(JSON.toJSONString(demandDataDTO)); SysUserDTO userDTO = sysUserService.get(Long.valueOf(delegateTask.getAssignee())); if (demandDataDTO.getReject() != null && demandDataDTO.getReject() == Boolean.TRUE) { // 拒绝 demandDataDTO.setFlag(TDemandDataEntityFlag.REJECT.getFlag()); @@ -214,7 +213,7 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti demandDataDTO.setApprovalOpinions(comment.isPresent() ? comment.get().getFullMessage() : ""); logger.error("---------------------------更新状态为已通过---------------------------------"); } - logger.error("demandDataDTO:" + demandDataDTO); + logger.error("demandDataDTO:{}", demandDataDTO); Map combineResultMap = new HashMap<>(); Map variables = oMapper.convertValue(demandDataDTO, Map.class); diff --git a/renren-admin/src/main/java/io/renren/modules/demanData/service/impl/TDemandDataServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/demanData/service/impl/TDemandDataServiceImpl.java index fa9ba0a4..63e2bb44 100644 --- a/renren-admin/src/main/java/io/renren/modules/demanData/service/impl/TDemandDataServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/demanData/service/impl/TDemandDataServiceImpl.java @@ -9,7 +9,6 @@ import io.renren.modules.demanData.entity.TDemandDataEntity; import io.renren.modules.demanData.entity.TDemandDataEntityFlag; import io.renren.modules.demanData.service.TDemandDataService; import io.renren.modules.security.user.SecurityUser; -import io.renren.modules.sys.dao.SysDeptDao; import io.renren.modules.sys.service.SysDeptService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -49,6 +48,8 @@ public class TDemandDataServiceImpl extends CrudServiceImpl list = baseDao.selectFlagCountByDepts(deptList); - list.forEach(temp -> { - temp.put("flag", TDemandDataEntityFlag.getByFlag(Integer.parseInt(temp.get("flag").toString())).getTip()); - }); + list.forEach(temp -> temp.put("flag", TDemandDataEntityFlag.getByFlag(Integer.parseInt(temp.get("flag").toString())).getTip())); resultMap.put("total", list); return resultMap; } 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 1cf50309..818d0912 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 @@ -27,7 +27,6 @@ import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.stream.Collectors; 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 index b60a738c..c83c899b 100644 --- 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 @@ -34,7 +34,7 @@ import java.util.Map; */ @Component public class CommentListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate { - private static Logger logger = LoggerFactory.getLogger(CommentListener.class); + private static final Logger logger = LoggerFactory.getLogger(CommentListener.class); @Value("${big_date.name}") private String bigDateDeptName; // 大数据局名称 @@ -60,10 +60,8 @@ public class CommentListener implements TaskListener, ExecutionListener, Activit logger.error("----------------------进入审批结束节点---------------------------"); delegateExecution.getProcessBusinessKey(); final String eventName = delegateExecution.getEventName(); - switch (eventName) { - case EVENTNAME_END: - endTake(delegateExecution.getVariables()); - break; + if (EVENTNAME_END.equals(eventName)) { + endTake(delegateExecution.getVariables()); } } @@ -84,11 +82,11 @@ public class CommentListener implements TaskListener, ExecutionListener, Activit if (tDemandCommentDTO.getReject() != null && tDemandCommentDTO.getReject() == Boolean.TRUE) { // 存在被拒绝的节点 tDemandCommentDTO.setDelFlag(1); tDemandCommentService.update(tDemandCommentDTO); - logger.error("评论审核不通过不通过!申请id:" + tDemandCommentDTO.getId()); + logger.error("评论审核不通过不通过!申请id:{}", tDemandCommentDTO.getId()); } else { tDemandCommentDTO.setDelFlag(0); tDemandCommentService.update(tDemandCommentDTO); - logger.error("审批通过!评论id:" + tDemandCommentDTO.getId()); + logger.error("审批通过!评论id:{}", tDemandCommentDTO.getId()); } } } @@ -101,14 +99,12 @@ public class CommentListener implements TaskListener, ExecutionListener, Activit @Override @ActivitiNoticeOperation(value = "评论审核", process = "评论审核流程") public void notify(DelegateTask delegateTask) { - logger.error("事件类型:" + delegateTask.getEventName()); + logger.error("事件类型: {}", delegateTask.getEventName()); final String eventName = delegateTask.getEventName(); - switch (eventName) { - case EVENTNAME_CREATE: - createEvent(delegateTask); - break; - default: - logger.error("未处理该事件:" + eventName); + if (EVENTNAME_CREATE.equals(eventName)) { + createEvent(delegateTask); + } else { + logger.error("未处理该事件:{}", eventName); } } @@ -129,20 +125,20 @@ public class CommentListener implements TaskListener, ExecutionListener, Activit */ private void createEvent(DelegateTask delegateTask) { String assignee; - logger.error("大数据局名称:" + bigDateDeptName); + logger.error("大数据局名称:{}", bigDateDeptName); SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName); - logger.error("deptDTOId:" + deptDTO.getId()); + logger.error("deptDTOId:{}", deptDTO.getId()); SysRoleDTO roleDTO = sysRoleService.getByName(roleName); - logger.error("roleDTOId:" + roleDTO.getId()); + logger.error("roleDTOId:{}", roleDTO.getId()); SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId()); if (userDTO != null) { - logger.error("审批人id:" + userDTO.getId()); + logger.error("审批人id:{}", userDTO.getId()); taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString()); assignee = userDTO.getId().toString(); } else { delegateTask.setAssignee("1516728698224427010"); - logger.error("未查到该部门对应 " + roleName); + logger.error("未查到该部门对应 {}", roleName); assignee = "1516728698224427010"; } 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 f057c9fa..161b24e4 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 @@ -36,8 +36,8 @@ import java.util.stream.Collectors; */ @Service public class TDemandCommentServiceImpl extends CrudServiceImpl implements TDemandCommentService { - private static Integer cpuNUm = Runtime.getRuntime().availableProcessors(); - private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm); + private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors(); + private static final ExecutorService executor = Executors.newFixedThreadPool(CPUNUM); @Autowired private TDemandDataService tDemandDataService; @Autowired @@ -64,7 +64,7 @@ public class TDemandCommentServiceImpl extends CrudServiceImpl index_.getId()).collect(Collectors.toList()).toArray()) // 需求主题 + }).stream().map(TDemandDataDTO::getId).collect(Collectors.toList()).toArray()) // 需求主题 .or().like("comment", params.get(Constant.SEARCHKEY).toString()); // 评论内容 } break; @@ -94,7 +94,7 @@ 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)); + Optional sysUserDTO = Optional.ofNullable(sysUserService.get(tDemandDataDTO.map(TDemandDataDTO::getCreator).orElse(null))); String content = "【评论】" + (sysUserDTO.isPresent() ? sysUserDTO.get().getRealName() : "") + " 您发起的需求 " + tDemandDataDTO.orElse(new TDemandDataDTO()).getDemandSubject() + " 有新的评论"; SysNoticeDTO dto = new SysNoticeDTO(); @@ -102,7 +102,7 @@ public class TDemandCommentServiceImpl extends CrudServiceImpl demandDataDTO.getCreator().toString()).orElse("")); dto.setStatus(NoticeStatusEnum.SEND.value()); dto.setSenderName("流程系统"); dto.setSenderDate(new Date()); diff --git a/renren-admin/src/main/java/io/renren/modules/developmentGuide/controller/DevelopmentGuideController.java b/renren-admin/src/main/java/io/renren/modules/developmentGuide/controller/DevelopmentGuideController.java index bc97b74c..fce1b095 100644 --- a/renren-admin/src/main/java/io/renren/modules/developmentGuide/controller/DevelopmentGuideController.java +++ b/renren-admin/src/main/java/io/renren/modules/developmentGuide/controller/DevelopmentGuideController.java @@ -34,7 +34,6 @@ public class DevelopmentGuideController { developmentGuideService.getDevelopmentFile(request, response); } catch (Exception e) { e.printStackTrace(); - new Result<>().error(500, "文件获取失败!"); } } @@ -46,12 +45,12 @@ public class DevelopmentGuideController { @ApiImplicitParam(name = "fileName", value = "文件名称", paramType = "query", dataType = "String", required = true), @ApiImplicitParam(name = "type", value = "能力类型", paramType = "query", dataType = "String", required = true), }) - public Result uploadDevelopmentFile(@RequestParam("file") MultipartFile uploadFile, HttpServletRequest request) { + public Result uploadDevelopmentFile(@RequestParam("file") MultipartFile uploadFile, HttpServletRequest request) { try { String s = developmentGuideService.uploadDevelopmentFile(uploadFile, request); - return new Result().ok(s); + return new Result().ok(s); }catch (Exception e) { - return new Result().error(e.getMessage()); + return new Result().error(e.getMessage()); } } diff --git a/renren-admin/src/main/java/io/renren/modules/developmentGuide/service/impl/DevelopmentGuideServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/developmentGuide/service/impl/DevelopmentGuideServiceImpl.java index 2e8e17cd..7d97a149 100644 --- a/renren-admin/src/main/java/io/renren/modules/developmentGuide/service/impl/DevelopmentGuideServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/developmentGuide/service/impl/DevelopmentGuideServiceImpl.java @@ -21,11 +21,7 @@ public class DevelopmentGuideServiceImpl implements DevelopmentGuideService { @Value("${resource.devModelFilePath}") private String devModelFilePath; - @Value("${resource.root_url}") - private String root_url; - @Value("${server.servlet.context-path}") - private String context_path; private static final Logger logger = LoggerFactory.getLogger(FileUploadController.class); @@ -33,14 +29,14 @@ public class DevelopmentGuideServiceImpl implements DevelopmentGuideService { public void getDevelopmentFile(HttpServletRequest request, HttpServletResponse response) throws Exception { logger.info("----------------------------------获取开发指南--------------------------------------------------"); String type = request.getParameter("type"); - String resourceId = request.getParameter("resourceId").toString(); - logger.info("读取文件类型及能力ID:" + type + ";" + resourceId); + String resourceId = request.getParameter("resourceId"); + logger.info("读取文件类型及能力ID:{};{}", type , resourceId); String url = devModelFilePath + File.separator + type + File.separator + resourceId + ".md"; String filePath = devModelFilePath + File.separator + type; File file = new File(url); //开发指南未保存过获取默认模板文件 - logger.info("文件夹路径---------------------->>>" + filePath); - logger.info("文件--------------------------->>>" + url); + logger.info("文件夹路径--->{}", filePath); + logger.info("文件--->{}", url); if (new File(filePath).exists()) { if (! file.exists()) { @@ -73,7 +69,7 @@ public class DevelopmentGuideServiceImpl implements DevelopmentGuideService { logger.info("----------------------------------开始上传开发指南--------------------------------------------------"); String type = request.getParameter("type"); String fileName = request.getParameter("fileName"); - logger.info("读取文件类型及文件名:" + type + ";" + fileName); + logger.info("读取文件类型及文件名:{};{}", type , fileName); File folder = new File(devModelFilePath + File.separator + type + File.separator + fileName); File path = new File(devModelFilePath + File.separator + type + File.separator); //文件保存过删除后重新保存 @@ -92,7 +88,7 @@ public class DevelopmentGuideServiceImpl implements DevelopmentGuideService { return type + File.separator + fileName; } catch (IOException e) { logger.info("----------------------------------文件上传失败--------------------------------------"); - logger.info("异常描述" + e.getMessage()); + logger.info("异常描述{}", e.getMessage()); throw e; } } diff --git a/renren-admin/src/main/java/io/renren/modules/devtools/service/impl/GeneratorServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/devtools/service/impl/GeneratorServiceImpl.java index 9e76b0f0..7745e8cd 100644 --- a/renren-admin/src/main/java/io/renren/modules/devtools/service/impl/GeneratorServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/devtools/service/impl/GeneratorServiceImpl.java @@ -202,7 +202,7 @@ public class GeneratorServiceImpl implements GeneratorService { //导入的包列表 Set imports = fieldTypeService.getPackageListByTableId(tableInfo.getId()); //过滤为空的数据 - imports = imports.stream().filter(i -> StringUtils.isNotBlank(i)).collect(Collectors.toSet()); + imports = imports.stream().filter(StringUtils::isNotBlank).collect(Collectors.toSet()); dataModel.put("imports", imports); //基类 diff --git a/renren-admin/src/main/java/io/renren/modules/eventListTest/controller/EventListController.java b/renren-admin/src/main/java/io/renren/modules/eventListTest/controller/EventListController.java index 015a6204..ac84e70a 100644 --- a/renren-admin/src/main/java/io/renren/modules/eventListTest/controller/EventListController.java +++ b/renren-admin/src/main/java/io/renren/modules/eventListTest/controller/EventListController.java @@ -26,7 +26,6 @@ import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; - /** * test * diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java b/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java index be37b1e0..98e68094 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java @@ -1,7 +1,5 @@ package io.renren.modules.fuse.controller; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; import io.renren.common.annotation.LogOperation; import io.renren.common.constant.Constant; import io.renren.common.page.PageData; diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java index a541dfe4..7f4f2c2e 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; import io.renren.common.constant.Constant; import io.renren.common.page.PageData; import io.renren.common.service.impl.CrudServiceImpl; -import io.renren.common.utils.Result; import io.renren.modules.fuse.dao.TbFuseAttrDao; import io.renren.modules.fuse.dao.TbFuseDao; import io.renren.modules.fuse.dao.TbFuseResourceDao; @@ -27,7 +26,6 @@ import io.renren.modules.resource.service.impl.ResourceServiceImpl; import io.renren.modules.resourceCollection.dao.ResourceCollectionDao; import io.renren.modules.security.user.SecurityUser; import io.renren.modules.sys.service.SysDeptService; -import org.apache.commons.lang3.ObjectUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; @@ -95,6 +93,8 @@ public class TbFuseServiceImpl extends CrudServiceImpl dataMap = (Map) factory.get().getDataResource(dto); if (dataMap != null) { List> list = (List>) dataMap.get("data"); - list.stream().forEach(map -> { + list.forEach(map -> { if (map.containsKey("zyname")) { result.put(map.get("guid").toString(), map); } else { diff --git a/renren-admin/src/main/java/io/renren/modules/gateway/controller/MonitorController.java b/renren-admin/src/main/java/io/renren/modules/gateway/controller/MonitorController.java index 7b5a0c65..1a5dac6c 100644 --- a/renren-admin/src/main/java/io/renren/modules/gateway/controller/MonitorController.java +++ b/renren-admin/src/main/java/io/renren/modules/gateway/controller/MonitorController.java @@ -188,7 +188,7 @@ public class MonitorController { } } - if (results.size() > 0) { + if (!results.isEmpty()) { LambdaQueryWrapper queryWrapper = new QueryWrapper().lambda(); queryWrapper .select(ResourceEntity::getId, @@ -258,7 +258,7 @@ public class MonitorController { } } - if (results.size() > 0) { + if (!results.isEmpty()) { LambdaQueryWrapper queryWrapper = new QueryWrapper().lambda(); queryWrapper.select(SysDeptEntity::getName,SysDeptEntity::getId) .in(SysDeptEntity::getId, abilityIds); diff --git a/renren-admin/src/main/java/io/renren/modules/log/controller/SysLogErrorController.java b/renren-admin/src/main/java/io/renren/modules/log/controller/SysLogErrorController.java index 7df43e40..71f21a25 100644 --- a/renren-admin/src/main/java/io/renren/modules/log/controller/SysLogErrorController.java +++ b/renren-admin/src/main/java/io/renren/modules/log/controller/SysLogErrorController.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; @@ -24,7 +23,6 @@ import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; - /** * 异常日志 * diff --git a/renren-admin/src/main/java/io/renren/modules/log/controller/SysLogLoginController.java b/renren-admin/src/main/java/io/renren/modules/log/controller/SysLogLoginController.java index 8a99496f..e29cca30 100644 --- a/renren-admin/src/main/java/io/renren/modules/log/controller/SysLogLoginController.java +++ b/renren-admin/src/main/java/io/renren/modules/log/controller/SysLogLoginController.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; @@ -24,7 +23,6 @@ import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; - /** * 登录日志 * 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 0cb50f9d..953f4e19 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 @@ -23,7 +23,6 @@ import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; - /** * 操作日志 * 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 1cbd10ad..a3007ca4 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 @@ -74,9 +74,7 @@ public class SysLogOperationServiceImpl extends BaseServiceImpl { - insert(entity); - }); + CompletableFuture.runAsync(() -> insert(entity)); } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/log/task/ClearLogTask.java b/renren-admin/src/main/java/io/renren/modules/log/task/ClearLogTask.java index c1a3304d..4d63dbec 100644 --- a/renren-admin/src/main/java/io/renren/modules/log/task/ClearLogTask.java +++ b/renren-admin/src/main/java/io/renren/modules/log/task/ClearLogTask.java @@ -38,7 +38,7 @@ public class ClearLogTask implements ITask { logger.info("---------------------开始清理日志表数据---------------------"); int offset = -Integer.parseInt(params); DateTime offsetDay = DateUtil.offsetDay(new Date(), offset); - logger.info("日志保留开始日期-------->" + offsetDay); + logger.info("日志保留开始日期-------->{}", offsetDay); sysLogOperationDao.clearLog(offsetDay); sysLogErrorDao.clearLog(offsetDay); logger.info("---------------------结束清理日志表数据---------------------"); diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/controller/Controller.java b/renren-admin/src/main/java/io/renren/modules/monitor/controller/Controller.java index 0ff053d5..9479ddde 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/controller/Controller.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/controller/Controller.java @@ -631,26 +631,6 @@ public class Controller { return monitorService.selectChannelNumByRegion(); } - /** - * 保存区域信息 - */ - @GetMapping("/saveOrgenization") - public Result saveOrgenization() { - List orgenizationByPage = monitorService.getOrgenization(new ArrayList<>()); - List maps = JSON.parseArray(JSON.toJSONString(orgenizationByPage), Map.class); - if(!maps.isEmpty()){ - List> lists = Lists.partition(maps,100); - lists.forEach(list-> cameraOrgenMapper.batchSaveOrgenization(list)); - - //修改path 信息 - List maps2 = cameraOrgenMapper.testAll(); - maps2.forEach(map-> monitorService.setOrganizationPath(map,map.get("parent_id").toString())); - - maps2.forEach(m-> cameraOrgenMapper.updateOrganizationPaht(m.get("path").toString(),m.get("id").toString())); - } - - return Result.success(); - } /** * 事件版的保存区域组织信息 diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/eventListen/saveOrgenizationEndEvent/SaveOrgenizationEndEvent.java b/renren-admin/src/main/java/io/renren/modules/monitor/eventListen/saveOrgenizationEndEvent/SaveOrgenizationEndEvent.java index ed169aeb..2623413c 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/eventListen/saveOrgenizationEndEvent/SaveOrgenizationEndEvent.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/eventListen/saveOrgenizationEndEvent/SaveOrgenizationEndEvent.java @@ -4,6 +4,7 @@ import lombok.extern.log4j.Log4j2; import org.springframework.context.ApplicationEvent; /** + * 保存视频资源组织表cache成功事件 * @author ytl * @Date 2022/7/27 15:13 **/ diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BoothMapper.java b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BoothMapper.java index 3ba580fd..ae5941f9 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BoothMapper.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BoothMapper.java @@ -1,6 +1,5 @@ package io.renren.modules.monitor.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import io.renren.common.dao.BaseDao; import io.renren.modules.monitor.entity.Booth; import org.apache.ibatis.annotations.Mapper; diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingRecordsMapper.java b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingRecordsMapper.java index 464c2552..d5823d88 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingRecordsMapper.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingRecordsMapper.java @@ -1,11 +1,9 @@ package io.renren.modules.monitor.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import io.renren.common.dao.BaseDao; import io.renren.modules.monitor.entity.BuildingRecords; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; import java.util.List; import java.util.Map; @@ -19,6 +17,6 @@ import java.util.Map; */ @Mapper public interface BuildingRecordsMapper extends BaseDao { - public void batchSave(@Param("list") List list); + void batchSave(@Param("list") List list); } diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingSiteMapper.java b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingSiteMapper.java index 3980f3d7..d10c3984 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingSiteMapper.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/BuildingSiteMapper.java @@ -1,6 +1,5 @@ package io.renren.modules.monitor.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import io.renren.common.dao.BaseDao; import io.renren.modules.monitor.entity.BuildingSite; import org.apache.ibatis.annotations.Mapper; diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java index 34d087a0..41375fb7 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/mapper/CameraChannelMapper.java @@ -11,7 +11,6 @@ import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; -import org.springframework.security.core.parameters.P; import java.util.List; import java.util.Map; @@ -31,8 +30,6 @@ public interface CameraChannelMapper extends BaseDao { @Select("select c.* from t_camera_channel c where channel_code in " + "(select b.channel_code from t_channel_mtm_label b where b.label_code = #{labelCode}) ") List selectLabel(@Param("labelCode") String labelCode); - //@Update("update t_camera_channel set state = list") - void updateState(@Param("list") List list); @Select("select * from t_label") List