区、市监听器:修改表单字段获取逻辑
This commit is contained in:
parent
738208ba2e
commit
e1d1d964ab
|
@ -1,12 +1,8 @@
|
||||||
package io.renren.modules.processForm.listener.v3;
|
package io.renren.modules.processForm.listener.v3;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.google.gson.JsonDeserializer;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
|
||||||
import io.renren.modules.sys.dao.SysUserDao;
|
import io.renren.modules.sys.dao.SysUserDao;
|
||||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||||
|
@ -75,34 +71,41 @@ public class ApplyDistrictListener implements TaskListener, ExecutionListener, A
|
||||||
private void create(DelegateTask delegateTask) {
|
private void create(DelegateTask delegateTask) {
|
||||||
String assignee;
|
String assignee;
|
||||||
Map<String, Object> kv = delegateTask.getVariables();
|
Map<String, Object> kv = delegateTask.getVariables();
|
||||||
GsonBuilder builder = new GsonBuilder();
|
if(kv.containsKey("userId")){
|
||||||
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
Long applyUserId = Long.valueOf(kv.get("userId").toString());
|
||||||
|
SysDeptDTO deptDTO = sysDeptService.get(sysUserService.get(applyUserId).getDeptId());
|
||||||
|
|
||||||
Gson gson = builder.create();
|
String userId = null;
|
||||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
if (deptDTO.getDistrict() != null) {
|
||||||
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
SysRegionEntity regionEntity = sysRegionService.getByLevel(deptDTO.getDistrict(), RegionLevelEnum.THREE);
|
||||||
|
logger.error("regionEntityId:" + regionEntity.getId());
|
||||||
|
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||||
|
logger.error("roleDTOId:" + roleDTO.getId());
|
||||||
|
|
||||||
SysDeptDTO deptDTO = sysDeptService.get(sysUserService.get(Long.parseLong(abilityApplicationDTO.getUserId())).getDeptId());
|
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
||||||
|
Optional<SysUserEntity> userEntityOptional = userList.stream()
|
||||||
SysRegionEntity regionEntity = sysRegionService.getByLevel(deptDTO.getDistrict(), RegionLevelEnum.THREE);
|
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.THREE).getId())).findFirst();
|
||||||
logger.error("regionEntityId:" + regionEntity.getId());
|
if (userEntityOptional.isPresent()) {
|
||||||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
userId = userEntityOptional.get().getId().toString();
|
||||||
logger.error("roleDTOId:" + roleDTO.getId());
|
}
|
||||||
|
}
|
||||||
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
if (userId != null) {
|
||||||
Optional<SysUserEntity> userEntityOptional = userList.stream()
|
logger.error("审批人id:" + userId);
|
||||||
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.THREE).getId())).findFirst();
|
taskService.setAssignee(delegateTask.getId(), userId);
|
||||||
|
assignee = userId;
|
||||||
if (userEntityOptional.isPresent()) {
|
} else {
|
||||||
logger.error("审批人id:" + userEntityOptional.get().getId());
|
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
||||||
taskService.setAssignee(delegateTask.getId(), userEntityOptional.get().getId().toString());
|
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
||||||
assignee = userEntityOptional.get().getId().toString();
|
assignee = defaultAssigneeRoleId;
|
||||||
} else {
|
}
|
||||||
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
logger.error("分配的用户id为:{}", assignee);
|
||||||
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
}else{
|
||||||
assignee = defaultAssigneeRoleId;
|
try {
|
||||||
|
logger.error("流程参数异常" + JSON.toJSONString(kv));
|
||||||
|
} catch (Exception exception) {
|
||||||
|
logger.error("流程参数异常", exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
logger.error("分配的用户id为:{}", assignee);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
package io.renren.modules.processForm.listener.v3;
|
package io.renren.modules.processForm.listener.v3;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.google.gson.JsonDeserializer;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
|
||||||
import io.renren.modules.sys.dao.SysUserDao;
|
import io.renren.modules.sys.dao.SysUserDao;
|
||||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||||
|
@ -75,34 +71,42 @@ public class CityListener implements TaskListener, ExecutionListener, ActivitiEv
|
||||||
private void create(DelegateTask delegateTask) {
|
private void create(DelegateTask delegateTask) {
|
||||||
String assignee;
|
String assignee;
|
||||||
Map<String, Object> kv = delegateTask.getVariables();
|
Map<String, Object> kv = delegateTask.getVariables();
|
||||||
GsonBuilder builder = new GsonBuilder();
|
|
||||||
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
|
||||||
|
|
||||||
Gson gson = builder.create();
|
if (kv.containsKey("userId")) {
|
||||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
Long applyUserId = Long.valueOf(kv.get("userId").toString());
|
||||||
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
SysDeptDTO deptDTO = sysDeptService.get(sysUserService.get(applyUserId).getDeptId());
|
||||||
|
|
||||||
SysDeptDTO deptDTO = sysDeptService.get(sysUserService.get(Long.parseLong(abilityApplicationDTO.getUserId())).getDeptId());
|
String userId = null;
|
||||||
|
if (deptDTO.getDistrict() != null) {
|
||||||
|
SysRegionEntity regionEntity = sysRegionService.getByLevel(deptDTO.getDistrict(), RegionLevelEnum.TWO);
|
||||||
|
logger.error("regionEntityId:" + regionEntity.getId());
|
||||||
|
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||||
|
logger.error("roleDTOId:" + roleDTO.getId());
|
||||||
|
|
||||||
SysRegionEntity regionEntity = sysRegionService.getByLevel(deptDTO.getDistrict(), RegionLevelEnum.TWO);
|
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
||||||
logger.error("regionEntityId:" + regionEntity.getId());
|
Optional<SysUserEntity> userEntityOptional = userList.stream()
|
||||||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.TWO).getId())).findFirst();
|
||||||
logger.error("roleDTOId:" + roleDTO.getId());
|
if (userEntityOptional.isPresent()) {
|
||||||
|
userId = userEntityOptional.get().getId().toString();
|
||||||
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
}
|
||||||
Optional<SysUserEntity> userEntityOptional = userList.stream()
|
}
|
||||||
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.TWO).getId())).findFirst();
|
if (userId != null) {
|
||||||
|
logger.error("审批人id:" + userId);
|
||||||
if (userEntityOptional.isPresent()) {
|
taskService.setAssignee(delegateTask.getId(), userId);
|
||||||
logger.error("审批人id:" + userEntityOptional.get().getId());
|
assignee = userId;
|
||||||
taskService.setAssignee(delegateTask.getId(), userEntityOptional.get().getId().toString());
|
} else {
|
||||||
assignee = userEntityOptional.get().getId().toString();
|
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
||||||
|
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
||||||
|
assignee = defaultAssigneeRoleId;
|
||||||
|
}
|
||||||
|
logger.error("分配的用户id为:{}", assignee);
|
||||||
} else {
|
} else {
|
||||||
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
try {
|
||||||
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
logger.error("流程参数异常" + JSON.toJSONString(kv));
|
||||||
assignee = defaultAssigneeRoleId;
|
} catch (Exception exception) {
|
||||||
|
logger.error("流程参数异常", exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
logger.error("分配的用户id为:{}", assignee);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
package io.renren.modules.processForm.listener.v3;
|
package io.renren.modules.processForm.listener.v3;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.google.gson.JsonDeserializer;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import io.renren.common.annotation.ActivitiNoticeOperation;
|
import io.renren.common.annotation.ActivitiNoticeOperation;
|
||||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
|
||||||
import io.renren.modules.sys.dao.SysUserDao;
|
import io.renren.modules.sys.dao.SysUserDao;
|
||||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||||
import io.renren.modules.sys.dto.SysRoleDTO;
|
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||||
|
@ -72,34 +68,41 @@ public class OwnerDistrictListener implements TaskListener, ExecutionListener, A
|
||||||
private void create(DelegateTask delegateTask) {
|
private void create(DelegateTask delegateTask) {
|
||||||
String assignee;
|
String assignee;
|
||||||
Map<String, Object> kv = delegateTask.getVariables();
|
Map<String, Object> kv = delegateTask.getVariables();
|
||||||
GsonBuilder builder = new GsonBuilder();
|
|
||||||
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
|
||||||
|
|
||||||
Gson gson = builder.create();
|
if (kv.containsKey("deptId")) { // 存在部门id
|
||||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
Long deptId = Long.valueOf(kv.get("deptId").toString());
|
||||||
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
SysDeptDTO deptDTO = sysDeptService.get(deptId);
|
||||||
|
|
||||||
SysDeptDTO deptDTO = abilityApplicationDTO.getResourceOwnerDept();
|
String userId = null;
|
||||||
|
if (deptDTO.getDistrict() != null) {
|
||||||
SysRegionEntity regionEntity = sysRegionService.getByLevel(deptDTO.getDistrict(), RegionLevelEnum.THREE);
|
SysRegionEntity regionEntity = sysRegionService.getByLevel(deptDTO.getDistrict(), RegionLevelEnum.THREE);
|
||||||
logger.error("regionEntityId:" + regionEntity.getId());
|
logger.error("regionEntityId:" + regionEntity.getId());
|
||||||
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||||
logger.error("roleDTOId:" + roleDTO.getId());
|
logger.error("roleDTOId:" + roleDTO.getId());
|
||||||
|
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
||||||
List<SysUserEntity> userList = sysUserDao.getList(ImmutableMap.of("role_id", roleDTO.getId()));
|
Optional<SysUserEntity> userEntityOptional = userList.stream()
|
||||||
Optional<SysUserEntity> userEntityOptional = userList.stream()
|
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.THREE).getId())).findFirst();
|
||||||
.filter(user -> Objects.equals(regionEntity.getId(), sysRegionService.getByLevel(sysDeptService.get(user.getDeptId()).getDistrict(), RegionLevelEnum.THREE).getId())).findFirst();
|
if (userEntityOptional.isPresent()) {
|
||||||
|
userId = userEntityOptional.get().getId().toString();
|
||||||
if (userEntityOptional.isPresent()) {
|
}
|
||||||
logger.error("审批人id:" + userEntityOptional.get().getId());
|
}
|
||||||
taskService.setAssignee(delegateTask.getId(), userEntityOptional.get().getId().toString());
|
if (userId != null) {
|
||||||
assignee = userEntityOptional.get().getId().toString();
|
logger.error("审批人id:" + userId);
|
||||||
|
taskService.setAssignee(delegateTask.getId(), userId);
|
||||||
|
assignee = userId;
|
||||||
|
} else {
|
||||||
|
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
||||||
|
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
||||||
|
assignee = defaultAssigneeRoleId;
|
||||||
|
}
|
||||||
|
logger.error("分配的用户id为:{}", assignee);
|
||||||
} else {
|
} else {
|
||||||
logger.error("未查到 {} 对应 " + roleName, deptDTO.getName());
|
try {
|
||||||
taskService.setAssignee(delegateTask.getId(), defaultAssigneeRoleId);
|
logger.error("流程参数异常" + JSON.toJSONString(kv));
|
||||||
assignee = defaultAssigneeRoleId;
|
} catch (Exception exception) {
|
||||||
|
logger.error("流程参数异常", exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
logger.error("分配的用户id为:{}", assignee);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue