This commit is contained in:
wangliwen 2022-04-25 09:58:12 +08:00
parent 453dc0a6d6
commit cd0aca28c8
6 changed files with 209 additions and 167 deletions

View File

@ -1,73 +1,74 @@
package io.renren.modules.demand.entity; package io.renren.modules.demand.entity;
import io.swagger.annotations.ApiModelProperty; import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.renren.common.entity.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date; import java.util.Date;
import io.renren.common.entity.BaseEntity;
/** /**
* 能力需求 * 能力需求
* *
* @author wxw * @author wxw
* @since 3.0 2022-01-11 * @since 3.0 2022-01-11
*/ */
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
@TableName("bs_demand") @TableName("bs_demand")
public class BsDemandEntity extends BaseEntity { public class BsDemandEntity extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 目录位置 * 目录位置
*/ */
private String pcode; private String pcode;
/** /**
* 名称 * 名称
*/ */
private String name; private String name;
/** /**
* 内容 * 内容
*/ */
private String context; private String context;
/** /**
* 建议 * 建议
*/
*/ private String suggest;
private String suggest; /**
/** * 描述
* 描述 */
*/ private String descripition;
private String descripition; /**
/** * 图片
* 图片 */
*/ private String images;
private String images; /**
/** * 0-未删除 1-删除 默认0
* 0-未删除 1-删除 默认0 */
*/ private String isDelete;
private String isDelete; /**
/** * 更新者
* 更新者 */
*/ @TableField(fill = FieldFill.INSERT_UPDATE)
@TableField(fill = FieldFill.INSERT_UPDATE) private String updater;
private String updater; /**
/** * 更新时间
* 更新时间 */
*/ @TableField(fill = FieldFill.INSERT_UPDATE)
@TableField(fill = FieldFill.INSERT_UPDATE) private Date updateDate;
private Date updateDate; /**
/** * 文件
* 文件 */
*/ private String files;
private String files; /**
/** * 状态
* 状态 */
* */ private String state;
private String state; /***
/*** * 审核意见
* 审核意见 */
*/ private String opinion;
private String opinion;
} }

View File

@ -53,6 +53,48 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
@Override @Override
public void notify(DelegateTask delegateTask) { public void notify(DelegateTask delegateTask) {
logger.error("-------------------------进入部门动态审批人流程-------------------------------"); logger.error("-------------------------进入部门动态审批人流程-------------------------------");
final String eventName = delegateTask.getEventName();
switch (eventName) {
case EVENTNAME_CREATE:
create(delegateTask);
break;
default:
}
logger.error("-------------------------结束部门动态审批人流程-------------------------------");
}
@Override
public void notify(DelegateExecution delegateExecution) throws Exception {
// logger.info("事件:" + delegateExecution.getEventName());
// delegateExecution.getVariableNames().stream().forEach(index -> logger.info("variable:" + index));
// delegateExecution.getVariables().values().stream().filter(index -> index != null).forEach(value -> logger.info(value.toString()));
// // taskService.setAssignee(delegateExecution.getProcessInstanceId(), "1516307964617076737");// 可以设置
//
// logger.info("修改审批人成功!" + delegateExecution.getCurrentActivityId() + " " + delegateExecution.getProcessInstanceId() + " " + delegateExecution.getProcessBusinessKey());
}
@Override
public void onEvent(ActivitiEvent activitiEvent) { // 事件回调
logger.info("事件类型:" + activitiEvent.getType().toString());
logger.info("" + activitiEvent.getProcessDefinitionId());
}
@Override
public boolean isFailOnException() {
return true;
}
@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
logger.info("异常", delegateExecution);
}
/**
* 节点创建时动态分配资源部门审核人
*
* @param delegateTask
*/
private void create(DelegateTask delegateTask) {
Map<String, Object> kv = delegateTask.getVariables(); Map<String, Object> kv = delegateTask.getVariables();
Gson gson = new Gson(); Gson gson = new Gson();
JsonElement jsonElement = gson.toJsonTree(kv); JsonElement jsonElement = gson.toJsonTree(kv);
@ -95,32 +137,5 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
logger.error("未查到该部门对应的 " + roleName); logger.error("未查到该部门对应的 " + roleName);
taskService.setAssignee(delegateTask.getId(), "1513432847327199233"); taskService.setAssignee(delegateTask.getId(), "1513432847327199233");
} }
logger.error("-------------------------结束部门动态审批人流程-------------------------------");
}
@Override
public void notify(DelegateExecution delegateExecution) throws Exception {
// logger.info("事件:" + delegateExecution.getEventName());
// delegateExecution.getVariableNames().stream().forEach(index -> logger.info("variable:" + index));
// delegateExecution.getVariables().values().stream().filter(index -> index != null).forEach(value -> logger.info(value.toString()));
// // taskService.setAssignee(delegateExecution.getProcessInstanceId(), "1516307964617076737");// 可以设置
//
// logger.info("修改审批人成功!" + delegateExecution.getCurrentActivityId() + " " + delegateExecution.getProcessInstanceId() + " " + delegateExecution.getProcessBusinessKey());
}
@Override
public void onEvent(ActivitiEvent activitiEvent) { // 事件回调
logger.info("事件类型:" + activitiEvent.getType().toString());
logger.info("" + activitiEvent.getProcessDefinitionId());
}
@Override
public boolean isFailOnException() {
return true;
}
@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
logger.info("异常", delegateExecution);
} }
} }

View File

@ -53,6 +53,32 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
@Override @Override
public void notify(DelegateTask delegateTask) { public void notify(DelegateTask delegateTask) {
logger.info("事件类型:" + delegateTask.getEventName()); logger.info("事件类型:" + delegateTask.getEventName());
final String eventName = delegateTask.getEventName();
switch (eventName) {
case EVENTNAME_CREATE:
createEvent(delegateTask);
break;
default:
logger.info("未处理该事件:" + eventName);
}
}
@Override
public void onEvent(ActivitiEvent activitiEvent) {
}
@Override
public boolean isFailOnException() {
return false;
}
/**
* 节点创建时动态分配大数据局审批人
*
* @param delegateTask
*/
private void createEvent(DelegateTask delegateTask) {
logger.info("大数据局名称:" + bigDateDeptName); logger.info("大数据局名称:" + bigDateDeptName);
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName); SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
logger.info("deptDTOId:" + deptDTO.getId()); logger.info("deptDTOId:" + deptDTO.getId());
@ -68,14 +94,4 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
logger.info("未查到该部门对应 " + roleName); logger.info("未查到该部门对应 " + roleName);
} }
} }
@Override
public void onEvent(ActivitiEvent activitiEvent) {
}
@Override
public boolean isFailOnException() {
return false;
}
} }

View File

@ -31,14 +31,14 @@ import java.io.IOException;
import java.util.Map; import java.util.Map;
/** /**
* 资源表 * 资源表
* *
* @author dg * @author dg
* @since 1.0 2022-04-13 * @since 1.0 2022-04-13
*/ */
@RestController @RestController
@RequestMapping("/resource") @RequestMapping("/resource")
@Api(tags="资源表") @Api(tags = "资源表")
public class ResourceController { public class ResourceController {
@Value("${resource.devModelFilePath}") @Value("${resource.devModelFilePath}")
@ -52,15 +52,15 @@ public class ResourceController {
@GetMapping("/page") @GetMapping("/page")
@ApiOperation("分页查询资源信息") @ApiOperation("分页查询资源信息")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = "type", value = "类型", paramType = "query",required = true, dataType="String") , @ApiImplicitParam(name = "type", value = "类型", paramType = "query", required = true, dataType = "String"),
//@ApiImplicitParam(name = "name", value = "资源名称", paramType = "query", dataType="String") , //@ApiImplicitParam(name = "name", value = "资源名称", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")
}) })
//@RequiresPermissions("resource:resource:page") //@RequiresPermissions("resource:resource:page")
public Result<PageData<ResourceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<ResourceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
//ResourceDTO resourceDTO = JSON.toJavaObject(jsonObject, ResourceDTO.class); //ResourceDTO resourceDTO = JSON.toJavaObject(jsonObject, ResourceDTO.class);
//resourceService.pageWithAttrs(resourceDTO); //resourceService.pageWithAttrs(resourceDTO);
PageData<ResourceDTO> page = resourceService.page(params); PageData<ResourceDTO> page = resourceService.page(params);
@ -73,7 +73,7 @@ public class ResourceController {
@PostMapping("/pageWithAttrs") @PostMapping("/pageWithAttrs")
@ApiOperation("分页查询资源信息2") @ApiOperation("分页查询资源信息2")
@LogOperation("分页查询资源信息2") @LogOperation("分页查询资源信息2")
public Result pageWithAttrs(@RequestBody JSONObject jsonObject){ public Result pageWithAttrs(@RequestBody JSONObject jsonObject) {
return new Result<>().ok(resourceService.pageWithAttrs(jsonObject)); return new Result<>().ok(resourceService.pageWithAttrs(jsonObject));
} }
@ -81,7 +81,7 @@ public class ResourceController {
@ApiOperation("查询资源详细信息") @ApiOperation("查询资源详细信息")
@LogOperation("查询资源详细信息") @LogOperation("查询资源详细信息")
//@RequiresPermissions("resource:resource:info") //@RequiresPermissions("resource:resource:info")
public Result<ResourceDTO> get(@PathVariable("id") Long id){ public Result<ResourceDTO> get(@PathVariable("id") Long id) {
ResourceDTO data = resourceService.selectWithAttrs(id); ResourceDTO data = resourceService.selectWithAttrs(id);
return new Result<ResourceDTO>().ok(data); return new Result<ResourceDTO>().ok(data);
} }
@ -89,21 +89,21 @@ public class ResourceController {
@GetMapping("/selectTotal") @GetMapping("/selectTotal")
@ApiOperation("查询系统及本部门已汇聚能力") @ApiOperation("查询系统及本部门已汇聚能力")
@LogOperation("查询系统及本部门已汇聚能力") @LogOperation("查询系统及本部门已汇聚能力")
public Result selectTotal(){ public Result selectTotal() {
return new Result<>().ok(resourceService.selectTotal()); return new Result<>().ok(resourceService.selectTotal());
} }
@GetMapping("/selectNewest") @GetMapping("/selectNewest")
@ApiOperation("查询最新上架能力") @ApiOperation("查询最新上架能力")
@LogOperation("查询最新上架能力") @LogOperation("查询最新上架能力")
public Result selectNewest(@RequestBody JSONObject jsonObject){ public Result selectNewest(@RequestBody JSONObject jsonObject) {
return new Result<>().ok(resourceService.selectNewest(jsonObject)); return new Result<>().ok(resourceService.selectNewest(jsonObject));
} }
@GetMapping("/selectMostPopular") @GetMapping("/selectMostPopular")
@ApiOperation("查询热门能力") @ApiOperation("查询热门能力")
@LogOperation("查询热门能力") @LogOperation("查询热门能力")
public Result selectMostPopular(@RequestBody JSONObject jsonObject){ public Result selectMostPopular(@RequestBody JSONObject jsonObject) {
return new Result<>().ok(resourceService.selectMostPopular(jsonObject)); return new Result<>().ok(resourceService.selectMostPopular(jsonObject));
} }
@ -122,20 +122,20 @@ public class ResourceController {
@ApiOperation("保存") @ApiOperation("保存")
@LogOperation("保存") @LogOperation("保存")
//@RequiresPermissions("resource:resource:save") //@RequiresPermissions("resource:resource:save")
public Result save(@RequestBody ResourceDTO dto){ public Result save(@RequestBody ResourceDTO dto) {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
resourceService.insertWithAttrs(dto); resourceService.insertWithAttrs(dto);
return new Result(); return new Result().ok(dto.getId() == null ? "" : dto.getId());
} }
@PutMapping("/update") @PutMapping("/update")
@ApiOperation("修改") @ApiOperation("修改")
@LogOperation("修改") @LogOperation("修改")
//@RequiresPermissions("resource:resource:update") //@RequiresPermissions("resource:resource:update")
public Result update(@RequestBody ResourceDTO dto){ public Result update(@RequestBody ResourceDTO dto) {
////效验数据 ////效验数据
//ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); //ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -148,7 +148,7 @@ public class ResourceController {
@ApiOperation("删除") @ApiOperation("删除")
@LogOperation("删除") @LogOperation("删除")
//@RequiresPermissions("resource:resource:delete") //@RequiresPermissions("resource:resource:delete")
public Result delete(@RequestBody JSONObject jsonObject){ public Result delete(@RequestBody JSONObject jsonObject) {
resourceService.deleteWithAttrs(jsonObject); resourceService.deleteWithAttrs(jsonObject);
@ -159,16 +159,16 @@ public class ResourceController {
@ApiOperation("获取开发指南") @ApiOperation("获取开发指南")
@LogOperation("获取开发指南") @LogOperation("获取开发指南")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "类型", paramType = "query",required = true, dataType="String") , @ApiImplicitParam(name = "type", value = "类型", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "resourceId", value = "能力ID", paramType = "query",required = false, dataType="Long") , @ApiImplicitParam(name = "resourceId", value = "能力ID", paramType = "query", required = false, dataType = "Long"),
}) })
public void getDevelopmentFile(@ApiIgnore HttpServletRequest request, @ApiIgnore HttpServletResponse response){ public void getDevelopmentFile(@ApiIgnore HttpServletRequest request, @ApiIgnore HttpServletResponse response) {
try { try {
resourceService.getDevelopmentFile(request, response); resourceService.getDevelopmentFile(request, response);
} catch (Exception e) { } catch (Exception e) {
System.err.println(e.getMessage()); System.err.println(e.getMessage());
e.printStackTrace(); e.printStackTrace();
new Result<>().error(500,"文件获取失败!"); new Result<>().error(500, "文件获取失败!");
} }
} }
@ -178,7 +178,7 @@ public class ResourceController {
@ApiImplicitParam(name = "file", value = "开发指南文件", paramType = "file", dataType = "file", required = true) @ApiImplicitParam(name = "file", value = "开发指南文件", paramType = "file", dataType = "file", required = true)
}) })
public Result upload(@RequestParam("file") MultipartFile uploadFile, public Result upload(@RequestParam("file") MultipartFile uploadFile,
HttpServletRequest request) { HttpServletRequest request) {
logger.info("上传文件:" + uploadFile.getOriginalFilename()); logger.info("上传文件:" + uploadFile.getOriginalFilename());
File folder = new File(devModelFilePath); File folder = new File(devModelFilePath);
if (!folder.isDirectory()) { if (!folder.isDirectory()) {

View File

@ -41,7 +41,7 @@ import java.util.Map;
/** /**
* 资源表 * 资源表
* *
* @author dg * @author dg
* @since 1.0 2022-04-13 * @since 1.0 2022-04-13
*/ */
@Service @Service
@ -61,7 +61,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
private AttrDao attrDao; private AttrDao attrDao;
@Override @Override
public QueryWrapper<ResourceEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<ResourceEntity> getWrapper(Map<String, Object> params) {
QueryWrapper<ResourceEntity> wrapper = new QueryWrapper<>(); QueryWrapper<ResourceEntity> wrapper = new QueryWrapper<>();
wrapper.eq("type", params.get("type").toString()) wrapper.eq("type", params.get("type").toString())
.eq("del_flag", 0) .eq("del_flag", 0)
@ -80,7 +80,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resourceEntity.setDelFlag(0); resourceEntity.setDelFlag(0);
resourceDao.insert(resourceEntity); resourceDao.insert(resourceEntity);
List<AttrEntity> attrEntities= dto.getInfoList(); BeanUtils.copyProperties(resourceEntity, dto); // 将entity id 写入 dto
List<AttrEntity> attrEntities = dto.getInfoList();
attrEntities.forEach(item -> { attrEntities.forEach(item -> {
item.setDelFlag(0); item.setDelFlag(0);
item.setDataResourceId(resourceID); item.setDataResourceId(resourceID);
@ -106,7 +108,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
ArrayList<Long> list = new ArrayList<>(); ArrayList<Long> list = new ArrayList<>();
list.add(resourceEntity.getId()); list.add(resourceEntity.getId());
attrDao.delete4Resource(list); attrDao.delete4Resource(list);
List<AttrEntity> attrEntities= dto.getInfoList(); List<AttrEntity> attrEntities = dto.getInfoList();
attrEntities.forEach(item -> { attrEntities.forEach(item -> {
item.setDelFlag(0); item.setDelFlag(0);
attrDao.insert(item); attrDao.insert(item);
@ -141,8 +143,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("del_flag", 0) queryWrapper.eq("del_flag", 0)
.like(StringUtils.isNotBlank(resourceDTO.getName()), "name", resourceDTO.getName()) .like(StringUtils.isNotBlank(resourceDTO.getName()), "name", resourceDTO.getName())
.eq(ObjectUtil.isNotNull(resourceDTO.getDistrictId()),"district_id", resourceDTO.getDistrictId()) .eq(ObjectUtil.isNotNull(resourceDTO.getDistrictId()), "district_id", resourceDTO.getDistrictId())
.eq(ObjectUtil.isNotNull(resourceDTO.getDeptId()),"dept_id", resourceDTO.getDeptId()) .eq(ObjectUtil.isNotNull(resourceDTO.getDeptId()), "dept_id", resourceDTO.getDeptId())
.eq("type", resourceDTO.getType()); .eq("type", resourceDTO.getType());
Page<ResourceEntity> entityPage = resourceDao.selectPage(page, queryWrapper); Page<ResourceEntity> entityPage = resourceDao.selectPage(page, queryWrapper);
ArrayList<ResourceDTO> list = new ArrayList<>(); ArrayList<ResourceDTO> list = new ArrayList<>();
@ -163,7 +165,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resultPage.setTotal(0); resultPage.setTotal(0);
} else { } else {
ArrayList<ResourceDTO> recordLists = new ArrayList<>(); ArrayList<ResourceDTO> recordLists = new ArrayList<>();
for (int i = (pageNum - 1 ) * pageSize; i < j; i++) { for (int i = (pageNum - 1) * pageSize; i < j; i++) {
recordLists.add(resourceDTOS.get(i)); recordLists.add(resourceDTOS.get(i));
} }
resultPage.setRecords(recordLists); resultPage.setRecords(recordLists);
@ -237,7 +239,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public Object selectNewest(JSONObject jsonObject) { public Object selectNewest(JSONObject jsonObject) {
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("create_date") queryWrapper.orderByDesc("create_date")
.eq(StringUtils.isNotBlank(jsonObject.getString("type")),"type", jsonObject.getString("type")); .eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"));
return resourceDao.selectList(queryWrapper); return resourceDao.selectList(queryWrapper);
} }

View File

@ -66,43 +66,8 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
final String eventName = delegateTask.getEventName(); final String eventName = delegateTask.getEventName();
switch (eventName) { switch (eventName) {
case EVENTNAME_CREATE: // 创建当前审批节点事件 case EVENTNAME_CREATE: // 创建当前审批节点事件
{ create(delegateTask, roleDTO);
Map<String, Object> kv = delegateTask.getVariables(); break;
Gson gson = new Gson();
JsonElement jsonElement = gson.toJsonTree(kv);
TResourceMountApplyDTO resourceMountApplyDTO = gson.fromJson(jsonElement, TResourceMountApplyDTO.class);
logger.info(JSONObject.toJSONString(resourceMountApplyDTO));
ResourceDTO re = resourceMountApplyDTO.getResourceDTO();
if (re.getDeptId() != null) {
SysDeptDTO deptDTO =
sysDeptService.get(re.getDeptId());
SysUserDTO userDTO = null;
if (deptDTO.getId() != null) {
userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId()); // 搜出审批人
}
if (userDTO != null) {
logger.error("审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
} else {
logger.error("未查到该部门对应的 " + roleName);
taskService.setAssignee(delegateTask.getId(), "1513432847327199233");
}
} else {
logger.info("大数据局名称:" + bigDateDeptName);
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
logger.info("roleDTOId:" + roleDTO.getId());
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId());
if (userDTO != null) {
logger.info("大数据审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
} else {
delegateTask.setAssignee("1513432847327199233");
logger.info("未查到大数据部门对应 " + roleName);
}
}
}
break;
default: default:
logger.info("未处理该事件:" + eventName); logger.info("未处理该事件:" + eventName);
} }
@ -126,4 +91,47 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
public boolean isFailOnException() { public boolean isFailOnException() {
return false; return false;
} }
/**
* 节点创建时动态分配资源部门审核人
*
* @param delegateTask
* @param roleDTO
*/
private void create(DelegateTask delegateTask, final SysRoleDTO roleDTO) {
Map<String, Object> kv = delegateTask.getVariables();
Gson gson = new Gson();
JsonElement jsonElement = gson.toJsonTree(kv);
TResourceMountApplyDTO resourceMountApplyDTO = gson.fromJson(jsonElement, TResourceMountApplyDTO.class);
logger.info(JSONObject.toJSONString(resourceMountApplyDTO));
ResourceDTO re = resourceMountApplyDTO.getResourceDTO();
if (re.getDeptId() != null) {
SysDeptDTO deptDTO =
sysDeptService.get(re.getDeptId());
SysUserDTO userDTO = null;
if (deptDTO.getId() != null) {
userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId()); // 搜出审批人
}
if (userDTO != null) {
logger.error("审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
} else {
logger.error("未查到该部门对应的 " + roleName);
taskService.setAssignee(delegateTask.getId(), "1513432847327199233");
}
} else {
logger.info("大数据局名称:" + bigDateDeptName);
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
logger.info("roleDTOId:" + roleDTO.getId());
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId());
if (userDTO != null) {
logger.info("大数据审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
} else {
taskService.setAssignee(delegateTask.getId(), "1513432847327199233");
logger.info("未查到大数据部门对应 " + roleName);
}
}
}
} }