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 5f003283..cd833fbe 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 @@ -46,6 +46,8 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti @Value("${big_date.name}") private String bigDateDeptName; // 大数据局名称 + @Value("${big_date.default_assignee_role_id}") + private String defaultAssigneeRoleId; // 当某部门未设置部门审批人时,将使用该用户审批 @Value("${big_date.assignee_role_name}") private String roleName; // 具备审批的角色名称 @@ -143,8 +145,8 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti assignee = userDTO.getId().toString(); } else { logger.error("未查到该部门对应的{} ", roleName); - taskService.setAssignee(delegateTask.getId(), "1516728698224427010"); - assignee = "1516728698224427010"; + taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId); + assignee = defaultAssigneeRoleId; } } else { // 填入大数据审批人 logger.error("大数据局名称:{}", bigDateDeptName); @@ -157,9 +159,9 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString()); assignee = userDTO.getId().toString(); } else { - taskService.setAssignee(delegateTask.getId(), "1516728698224427010"); + taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId); logger.error("未查到大数据部门对应 {}", roleName); - assignee = "1516728698224427010"; + assignee = defaultAssigneeRoleId; } } 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 c83c899b..5cea246b 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 @@ -38,6 +38,8 @@ public class CommentListener implements TaskListener, ExecutionListener, Activit @Value("${big_date.name}") private String bigDateDeptName; // 大数据局名称 + @Value("${big_date.default_assignee_role_id}") + private String defaultAssigneeRoleId; // 当某部门未设置部门审批人时,将使用该用户审批 @Value("${big_date.assignee_role_name}") private String roleName; // 具备审批的角色名称 @@ -137,9 +139,9 @@ public class CommentListener implements TaskListener, ExecutionListener, Activit taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString()); assignee = userDTO.getId().toString(); } else { - delegateTask.setAssignee("1516728698224427010"); + delegateTask.setAssignee(defaultAssigneeRoleId); logger.error("未查到该部门对应 {}", roleName); - assignee = "1516728698224427010"; + assignee = defaultAssigneeRoleId; } Map kv = delegateTask.getVariables(); diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java b/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java index cb44cf28..dcf69b61 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java @@ -126,7 +126,7 @@ public class TAbilityApplicationController { tAbilityApplicationService.getByInstanceId(inStanceId + ""); if (!dtos.isEmpty()) { dtos.stream() - .limit(1l) + .limit(1L) .forEach(dto -> { BeanUtils.copyProperties(dto, index); if (StringUtils.isNotEmpty(index.getCameraList())) { @@ -140,11 +140,11 @@ public class TAbilityApplicationController { }); } if (params.containsKey("ended")) { - index.setEnded(Boolean.valueOf(params.get("ended").toString())); + index.setEnded(Boolean.parseBoolean(params.get("ended").toString())); } else { String sql = String.format("SELECT IF(COUNT(id) >0 ,FALSE,TRUE) AS ended FROM t_ability_application WHERE apply_flag = '%s' AND EXISTS (SELECT 1 FROM t_ability_application t1 WHERE t1.apply_flag = t_ability_application.apply_flag AND approve_status = '审核中');", index.getApplyFlag()); Boolean ended = jdbcTemplate.queryForObject(sql, Boolean.class); - index.setEnded(ended); + index.setEnded(Boolean.TRUE.equals(ended)); } return index; }).collect(Collectors.toList()); @@ -160,7 +160,7 @@ public class TAbilityApplicationController { @GetMapping("deal") public Result test() { List> re = jdbcTemplate.queryForList("SELECT t_ability_application.id,t_ability_application.resource_id,tb_data_resource.dept_id from t_ability_application JOIN tb_data_resource ON t_ability_application.resource_id = tb_data_resource.id WHERE resource_owner_dept IS NULL;"); - re.stream().forEach(index -> { + re.forEach(index -> { SysDeptDTO sysDeptDTO = sysDeptService.get(Long.valueOf(index.get("dept_id").toString())); if (sysDeptDTO != null) { jdbcTemplate.update(String.format("UPDATE t_ability_application SET resource_owner_dept = '%s' WHERE id = %s", JSON.toJSONString(sysDeptDTO), index.get("id").toString())); diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java index e4289d45..a7cba492 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java @@ -43,10 +43,12 @@ import java.util.UUID; */ @Component public class CorrectionListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate { - private static Logger logger = LoggerFactory.getLogger(CorrectionListener.class); + private static final Logger logger = LoggerFactory.getLogger(CorrectionListener.class); @Value("${big_date.name}") private String bigDateDeptName; // 大数据局名称 + @Value("${big_date.default_assignee_role_id}") + private String defaultAssigneeRoleId; // 当某部门未设置部门审批人时,将使用该用户审批 @Value("${big_date.assignee_role_name}") private String roleName; // 具备审批的角色名称 @@ -93,17 +95,15 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti 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()); } } @Override public void onEvent(ActivitiEvent activitiEvent) { // 事件回调 - logger.error("事件类型:" + activitiEvent.getType().toString()); - logger.error("" + activitiEvent.getProcessDefinitionId()); + logger.error("事件类型:{}", activitiEvent.getType().toString()); + logger.error( activitiEvent.getProcessDefinitionId()); } @Override @@ -113,7 +113,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti @Override public void execute(DelegateExecution delegateExecution) throws Exception { - logger.error("异常", delegateExecution); + logger.error("异常{}", delegateExecution); } @@ -134,12 +134,12 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti abilityApplicationDTO.setDelFlag(0); abilityApplicationDTO.setApproveStatus("不通过"); tAbilityApplicationService.update(abilityApplicationDTO); - logger.error("审批不通过!申请id:" + abilityApplicationDTO.getId()); + logger.error("审批不通过!申请id:{}", abilityApplicationDTO.getId()); } else { abilityApplicationDTO.setDelFlag(0); abilityApplicationDTO.setApproveStatus("通过"); tAbilityApplicationService.update(abilityApplicationDTO); - logger.error("审批通过!申请id:" + abilityApplicationDTO.getId()); + logger.error("审批通过!申请id:{}", abilityApplicationDTO.getId()); jdbcTemplate.update("update tb_data_resource,\n" + "tb_data_resource_assignmark\n" + "SET tb_data_resource.total = round(tb_data_resource_assignmark.total) WHERE tb_data_resource.id =" + abilityApplicationDTO.getResourceId()); @@ -164,11 +164,11 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class); SysRoleDTO roleDTO = sysRoleService.getByName(roleName); - logger.error("roleDTOId:" + roleDTO.getId()); + logger.error("roleDTOId:{}", roleDTO.getId()); ResourceDTO resourceEntityDto = null; Long deptId = null; if (abilityApplicationDTO != null) { - logger.error("abilityApplicationDTO:" + abilityApplicationDTO.toString()); + logger.error("abilityApplicationDTO:{}", abilityApplicationDTO.toString()); resourceEntityDto = resourceService.get(Long.valueOf(abilityApplicationDTO.getResourceId())); } if (resourceEntityDto != null && resourceEntityDto.getDeptId() != null) { @@ -176,7 +176,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti SysDeptDTO deptDTO = sysDeptService.get(resourceEntityDto.getDeptId()); if (deptDTO != null && deptDTO.getName().equals(bigDateDeptName)) { - logger.error("第二级别审批仍然为 " + bigDateDeptName); + logger.error("第二级别审批仍然为 {}", bigDateDeptName); SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptId, roleDTO.getId()); // 搜出审批人 if (userDTO != null) { taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString()); @@ -187,10 +187,10 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti return; } } else { - logger.error("表单内单位名称:" + abilityApplicationDTO.getUnit()); + logger.error("表单内单位名称:{}", abilityApplicationDTO.getUnit()); SysDeptDTO deptDTO = sysDeptService.getByName(abilityApplicationDTO.getUnit()); if (deptDTO != null) { - logger.error("deptDTOId:" + deptDTO.getId()); + logger.error("deptDTOId:{}", deptDTO.getId()); deptId = deptDTO.getId(); } @@ -205,8 +205,8 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti assignee = userDTO.getId().toString(); } else { logger.error("未查到该部门对应的 " + roleName); - taskService.setAssignee(delegateTask.getId(), "1516728698224427010"); - assignee = "1516728698224427010"; + taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId); + assignee = defaultAssigneeRoleId; } mpComplete(abilityApplicationDTO, delegateTask, assignee); } diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java index 3545f91f..7b511222 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java @@ -40,6 +40,8 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti @Value("${big_date.name}") private String bigDateDeptName; // 大数据局名称 + @Value("${big_date.default_assignee_role_id}") + private String defaultAssigneeRoleId; // 当某部门未设置部门审批人时,将使用该用户审批 @Value("${big_date.assignee_role_name}") private String roleName; // 具备审批的角色名称 @@ -112,9 +114,9 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString()); assignee = userDTO.getId().toString(); } else { - delegateTask.setAssignee("1516728698224427010"); + delegateTask.setAssignee(defaultAssigneeRoleId); logger.error("未查到该部门对应 " + roleName); - assignee = "1516728698224427010"; + assignee = defaultAssigneeRoleId; } Map kv = delegateTask.getVariables(); diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/v2/CorrectionListenerV2.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/v2/CorrectionListenerV2.java index f28984c0..e7ca308c 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/v2/CorrectionListenerV2.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/v2/CorrectionListenerV2.java @@ -43,10 +43,12 @@ import java.util.stream.Collectors; */ @Component public class CorrectionListenerV2 implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate { - private static Logger logger = LoggerFactory.getLogger(CorrectionListenerV2.class); + private static final Logger logger = LoggerFactory.getLogger(CorrectionListenerV2.class); @Value("${big_date.name}") private String bigDateDeptName; // 大数据局名称 + @Value("${big_date.default_assignee_role_id}") + private String defaultAssigneeRoleId; // 当某部门未设置部门审批人时,将使用该用户审批 @Value("${big_date.assignee_role_name}") private String roleName; // 具备审批的角色名称 @@ -93,17 +95,15 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac logger.error("----------------------进入部门审批结束节点---------------------------"); delegateExecution.getProcessBusinessKey(); final String eventName = delegateExecution.getEventName(); - switch (eventName) { - case EVENTNAME_END: - endTake(delegateExecution); - break; + if (EVENTNAME_END.equals(eventName)) { + endTake(delegateExecution); } } @Override public void onEvent(ActivitiEvent activitiEvent) { // 事件回调 - logger.error("事件类型:" + activitiEvent.getType().toString()); - logger.error("" + activitiEvent.getProcessDefinitionId()); + logger.error("事件类型:{}", activitiEvent.getType().toString()); + logger.error(activitiEvent.getProcessDefinitionId()); } @Override @@ -113,7 +113,7 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac @Override public void execute(DelegateExecution delegateExecution) throws Exception { - logger.error("异常", delegateExecution); + logger.error("异常{}", delegateExecution); } @@ -165,13 +165,13 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac String assignee; Map kv = delegateTask.getVariables(); SysRoleDTO roleDTO = sysRoleService.getByName(roleName); - logger.error("roleDTOId:" + roleDTO.getId()); + logger.error("roleDTOId:{}", roleDTO.getId()); Long deptId; if (kv.containsKey("deptId")) { // 存在部门id deptId = Long.valueOf(kv.get("deptId").toString()); SysDeptDTO deptDTO = sysDeptService.get(deptId); if (deptDTO != null && deptDTO.getName().equals(bigDateDeptName)) { // 二级审批依然为大数据局,默认审核通过 - logger.error("第二级别审批仍然为 " + bigDateDeptName); + logger.error("第二级别审批仍然为 {}", bigDateDeptName); SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptId, roleDTO.getId()); // 搜出审批人 if (userDTO != null) { taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString()); @@ -186,13 +186,13 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac userDTO = sysUserService.getByDeptIdAndRoleId(deptId, 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, deptId); - taskService.setAssignee(delegateTask.getId(), "1516728698224427010"); - assignee = "1516728698224427010"; + logger.error("未查到该部门 {} 对应的 {}", deptId, roleName); + taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId); + assignee = defaultAssigneeRoleId; } if (kv.containsKey("tAbilityApplicationDTOList")) { List dtoList = (List) kv.get("tAbilityApplicationDTOList"); diff --git a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java index 290304e5..16ddcc66 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java @@ -41,6 +41,8 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis @Value("${big_date.name}") private String bigDateDeptName; // 大数据局名称 + @Value("${big_date.default_assignee_role_id}") + private String defaultAssigneeRoleId; // 当某部门未设置部门审批人时,将使用该用户审批 @Value("${big_date.assignee_role_name}") private String roleName; // 具备审批的角色名称 @@ -174,8 +176,8 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis assignee = userDTO.getId().toString(); } else { logger.error("未查到大数据部门对应 " + roleName); - taskService.setAssignee(taskId, "1516728698224427010"); - assignee = "1516728698224427010"; + taskService.setAssignee(taskId, defaultAssigneeRoleId); + assignee = defaultAssigneeRoleId; } return assignee; } diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/listener/ResourceOwnerListener.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/listener/ResourceOwnerListener.java index 133326dd..2303b2db 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/listener/ResourceOwnerListener.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/listener/ResourceOwnerListener.java @@ -41,6 +41,8 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A @Value("${big_date.name}") private String bigDateDeptName; // 大数据局名称 + @Value("${big_date.default_assignee_role_id}") + private String defaultAssigneeRoleId; // 当某部门未设置部门审批人时,将使用该用户审批 @Value("${big_date.assignee_role_name}") private String roleName; // 具备审批的角色名称 @@ -208,8 +210,8 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A assignee = userDTO.getId().toString(); } else { logger.error("未查到该部门对应的 " + roleName); - taskService.setAssignee(delegateTask.getId(), "1516728698224427010"); - assignee = "1516728698224427010"; + taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId); + assignee = defaultAssigneeRoleId; } } else if (resourceMountApplyDTO.getDeptId() != null) { SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(Long.valueOf(resourceMountApplyDTO.getDeptId()), roleDTO.getId()); @@ -218,9 +220,9 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString()); assignee = userDTO.getId().toString(); } else { - taskService.setAssignee(delegateTask.getId(), "1516728698224427010"); + taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId); logger.error("未查到部门对应 " + resourceMountApplyDTO.getDeptId()); - assignee = "1516728698224427010"; + assignee = defaultAssigneeRoleId; } } else { logger.error("大数据局名称:" + bigDateDeptName); @@ -233,9 +235,9 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString()); assignee = userDTO.getId().toString(); } else { - taskService.setAssignee(delegateTask.getId(), "1516728698224427010"); + taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId); logger.error("未查到大数据部门对应 " + roleName); - assignee = "1516728698224427010"; + assignee = defaultAssigneeRoleId; } } diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java index f95b9034..81240f41 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java @@ -229,7 +229,6 @@ public class SysUserServiceImpl extends BaseServiceImpl> iterator = lists.iterator(); //给pid pids赋值 if (lists.size() > 0) { lists.forEach(dept -> {//1.遍历每一个map @@ -241,10 +240,9 @@ public class SysUserServiceImpl extends BaseServiceImpl map = new HashMap<>(); if (dName.equals(lists.get(j).get("name").toString())) { String id = lists.get(j).get("id").toString(); - String pidsOld = dept.get("pids").toString() == "" ? "" : (dept.get("pids").toString() + ","); + String pidsOld = Objects.equals(dept.get("pids").toString(), "") ? "" : (dept.get("pids").toString() + ","); if (c == 1) { dept.put("pid", id); dept.put("pids", pidsOld + id); @@ -257,7 +255,7 @@ public class SysUserServiceImpl extends BaseServiceImpl maps = jhlDAPTool.readLdap(ldapContext); - if (maps.size() > 0) { + if (!maps.isEmpty()) { maps.forEach(m -> { //根据username判断 if (m.get(("username")) != null) { @@ -402,7 +400,7 @@ public class SysUserServiceImpl extends BaseServiceImpl