From bb13945d43e45cd7e86f43d20a79fec9de98de61 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Sun, 24 Apr 2022 16:32:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E4=B8=8A=E6=9E=B6=20?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AbilityCenterController.java | 5 +- .../controller/ResourceMountController.java | 94 ++++++++++++++ .../activiti/service/ActModelService.java | 45 ++++--- .../listener/CorrectionListener.java | 6 +- .../listener/DataCenterListener.java | 5 +- .../TResourceMountApplyController.java | 119 ++++++++++++++++++ .../dao/TResourceMountApplyDao.java | 16 +++ .../dto/TResourceBatchMountApplyDTO.java | 42 +++++++ .../dto/TResourceMountApplyDTO.java | 45 +++++++ .../entity/TResourceMountApplyEntity.java | 65 ++++++++++ .../excel/TResourceMountApplyExcel.java | 41 ++++++ .../listener/ResourceOwnerListener.java | 74 +++++++++++ .../service/TResourceMountApplyService.java | 17 +++ .../impl/TResourceMountApplyServiceImpl.java | 35 ++++++ .../TResourceMountApplyDao.xml | 23 ++++ 15 files changed, 602 insertions(+), 30 deletions(-) create mode 100644 renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resourceMountApply/controller/TResourceMountApplyController.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resourceMountApply/dao/TResourceMountApplyDao.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceBatchMountApplyDTO.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceMountApplyDTO.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resourceMountApply/entity/TResourceMountApplyEntity.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resourceMountApply/excel/TResourceMountApplyExcel.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resourceMountApply/listener/ResourceOwnerListener.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resourceMountApply/service/TResourceMountApplyService.java create mode 100644 renren-admin/src/main/java/io/renren/modules/resourceMountApply/service/impl/TResourceMountApplyServiceImpl.java create mode 100644 renren-admin/src/main/resources/mapper/resourceMountApply/TResourceMountApplyDao.xml 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 12ce91f7..16b887b9 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 @@ -43,11 +43,12 @@ public class AbilityCenterController { private TAbilityApplicationService tAbilityApplicationService; @Autowired private ActRunningService actRunningService; + private static String key = "abilityprocess"; private static Map params = new HashMap() { { put("isLatestVersion", true); // 取最新版本 - put("key", "abilityprocess"); // 限定 + put("key", key); // 限定 } }; @@ -89,7 +90,7 @@ public class AbilityCenterController { // 仿照请求接口 /act/running/startOfBusinessKey ProcessStartDTO processStartDTO = new ProcessStartDTO(); processStartDTO.setBusinessKey(tAbilityApplicationDTO.getId().toString()); - processStartDTO.setProcessDefinitionKey("abilityprocess"); //限定 + processStartDTO.setProcessDefinitionKey(key); //限定 ObjectMapper oMapper = new ObjectMapper(); Map variables = oMapper.convertValue(tAbilityApplicationDTO, Map.class); processStartDTO.setVariables(variables); 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 new file mode 100644 index 00000000..46505231 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java @@ -0,0 +1,94 @@ +package io.renren.common.controller; + + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.crypto.SecureUtil; +import com.alibaba.fastjson.JSONObject; +import io.renren.common.page.PageData; +import io.renren.common.utils.Result; +import io.renren.common.validator.ValidatorUtils; +import io.renren.common.validator.group.AddGroup; +import io.renren.common.validator.group.DefaultGroup; +import io.renren.modules.activiti.dto.ProcessInstanceDTO; +import io.renren.modules.activiti.dto.ProcessStartDTO; +import io.renren.modules.activiti.service.ActProcessService; +import io.renren.modules.activiti.service.ActRunningService; +import io.renren.modules.resourceMountApply.dto.TResourceBatchMountApplyDTO; +import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO; +import io.renren.modules.resourceMountApply.service.TResourceMountApplyService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.codehaus.jackson.map.ObjectMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Api(tags = "资源上架") +@RestController +@RequestMapping("/resource/center") +public class ResourceMountController { + + @Autowired + private ActProcessService actProcessService; + @Autowired + private ActRunningService actRunningService; + @Autowired + private TResourceMountApplyService tResourceMountApplyService; + private static String key = "resourcemountapply"; + + private static Map params = new HashMap() { + { + put("isLatestVersion", true); // 取最新版本 + put("key", key); // 限定 能力资源上架 + } + }; + + + @PostMapping(value = "/apply") + @ApiOperation("批量进行能力上架申请") + public Result> apply(@RequestBody TResourceBatchMountApplyDTO tResourceBatchMountApplyDTO) { + // 仿照请求接口 /act/process/lastestPage + PageData> page = actProcessService.page(params); + if (page.getTotal() <= 0) { // + return new Result().error("联系管理员添加流程"); + } + tResourceBatchMountApplyDTO.getResourceDTO().stream().map(index -> { + TResourceMountApplyDTO tResourceMountApplyDTO = new TResourceMountApplyDTO(); + tResourceMountApplyDTO.setPhone(tResourceBatchMountApplyDTO.getPhone()); + 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.setResourceDTO(index); + + ValidatorUtils.validateEntity(tResourceMountApplyDTO, AddGroup.class, DefaultGroup.class); + tResourceMountApplyService.save(tResourceMountApplyDTO); // 保存单条资源申请记录 + if (tResourceMountApplyDTO.getId() == null) { + return null; + } + // 仿照请求接口 /act/running/startOfBusinessKey + ProcessStartDTO processStartDTO = new ProcessStartDTO(); + processStartDTO.setBusinessKey(tResourceMountApplyDTO.getId().toString()); + processStartDTO.setProcessDefinitionKey(key); // 限定资源上架 + ObjectMapper oMapper = new ObjectMapper(); + Map variables = oMapper.convertValue(tResourceMountApplyDTO, Map.class); + processStartDTO.setVariables(variables); + ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO); + + if (Long.valueOf(dto.getBusinessKey()) != null) { + // 仿照请求接口 /processForm/tabilityapplication/updateInstanceId + tResourceMountApplyService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey())); + } + + return tResourceMountApplyDTO; + }).filter(index -> ObjectUtil.isNotNull(index)); + return null; + } +} 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 c6cb32fb..db654be6 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 @@ -34,7 +34,6 @@ import java.util.Map; /** * 模型管理 - * */ @Service public class ActModelService { @@ -44,30 +43,30 @@ public class ActModelService { private ObjectMapper objectMapper; public PageData page(Map params) { - String key = (String)params.get("key"); - String name = (String)params.get("name"); + String key = (String) params.get("key"); + String name = (String) params.get("name"); //分页参数 int curPage = 1; int limit = 10; - if(params.get(Constant.PAGE) != null){ - curPage = Integer.parseInt((String)params.get(Constant.PAGE)); + if (params.get(Constant.PAGE) != null) { + curPage = Integer.parseInt((String) params.get(Constant.PAGE)); } - if(params.get(Constant.LIMIT) != null){ - limit = Integer.parseInt((String)params.get(Constant.LIMIT)); + if (params.get(Constant.LIMIT) != null) { + limit = Integer.parseInt((String) params.get(Constant.LIMIT)); } ModelQuery modelQuery = repositoryService.createModelQuery().latestVersion().orderByLastUpdateTime().desc(); - if(StringUtils.isNotEmpty(key)){ + if (StringUtils.isNotEmpty(key)) { modelQuery.modelKey(key); } - if(StringUtils.isNotEmpty(name)){ + if (StringUtils.isNotEmpty(name)) { modelQuery.modelName(name); } List list = modelQuery.listPage((curPage - 1) * limit, limit); - return new PageData<>(list, (int)modelQuery.count()); + return new PageData<>(list, (int) modelQuery.count()); } public void save(String name, String key, String description) throws UnsupportedEncodingException { @@ -103,19 +102,18 @@ public class ActModelService { BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode); BpmnXMLConverter xmlConverter = new BpmnXMLConverter(); byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel); - if(bpmnModel.getProcesses().isEmpty()){ + if (bpmnModel.getProcesses().isEmpty()) { throw new RenException(ErrorCode.ACT_DEPLOY_ERROR); } String processName = model.getName(); - if (!StringUtils.endsWith(processName, ".bpmn20.xml")){ + if (!StringUtils.endsWith(processName, ".bpmn20.xml")) { processName += ".bpmn20.xml"; } 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.size() == 0) { throw new RenException(ErrorCode.ACT_DEPLOY_ERROR); } } catch (Exception e) { @@ -147,17 +145,18 @@ public class ActModelService { /** * 删除模型 - * @param id 模型ID + * + * @param id 模型ID */ public void delete(String id) { repositoryService.deleteModel(id); } public void deployImage(String deploymentId, HttpServletResponse response) { - List names = repositoryService.getDeploymentResourceNames(deploymentId); + List names = repositoryService.getDeploymentResourceNames(deploymentId); String imageName = null; - for(String name: names){ - if(name.indexOf(".png")>=0){ + for (String name : names) { + if (name.indexOf(".png") >= 0) { imageName = name; break; } @@ -165,12 +164,12 @@ public class ActModelService { InputStream in = null; InputStream in1 = null; try { - if(StringUtils.isNotEmpty(imageName)){ - in = repositoryService.getResourceAsStream(deploymentId,imageName); + if (StringUtils.isNotEmpty(imageName)) { + in = repositoryService.getResourceAsStream(deploymentId, imageName); response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(imageName, "UTF-8")); - response.setHeader("Content-Type","image/png"); + response.setHeader("Content-Type", "image/png"); response.setHeader("Cache-Control", "no-store, no-cache"); - BufferedImage bufferedImage = ImageIO.read(in); + BufferedImage bufferedImage = ImageIO.read(in); ImageIO.write(bufferedImage, "png", response.getOutputStream()); } else { response.getWriter().println("No image Info!"); @@ -179,7 +178,7 @@ public class ActModelService { e.printStackTrace(); } finally { try { - if(null != in){ + if (null != in) { in.close(); } } catch (IOException e) { 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 43eb4cb9..f325ab65 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 @@ -31,10 +31,10 @@ import java.util.Map; public class CorrectionListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate { private static Logger logger = LoggerFactory.getLogger(CorrectionListener.class); - @Value("${big_date.assignee_role_name}") - private String roleName; @Value("${big_date.name}") - private String bigDateDeptName; + private String bigDateDeptName; // 大数据局名称 + @Value("${big_date.assignee_role_name}") + private String roleName; // 具备审批的角色名称 @Autowired private SysRoleService sysRoleService; 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 dce3431a..4e3da6d5 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 @@ -25,9 +25,9 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti private static Logger logger = LoggerFactory.getLogger(DataCenterListener.class); @Value("${big_date.name}") - private String bigDateDeptName; + private String bigDateDeptName; // 大数据局名称 @Value("${big_date.assignee_role_name}") - private String roleName; + private String roleName; // 具备审批的角色名称 @Autowired private SysRoleService sysRoleService; @@ -52,6 +52,7 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti @Override public void notify(DelegateTask delegateTask) { + logger.info("事件类型:" + delegateTask.getEventName()); logger.info("大数据局名称:" + bigDateDeptName); SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName); logger.info("deptDTOId:" + deptDTO.getId()); diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/controller/TResourceMountApplyController.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/controller/TResourceMountApplyController.java new file mode 100644 index 00000000..f9210281 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/controller/TResourceMountApplyController.java @@ -0,0 +1,119 @@ +package io.renren.modules.resourceMountApply.controller; + +import io.renren.common.annotation.LogOperation; +import io.renren.common.constant.Constant; +import io.renren.common.page.PageData; +import io.renren.common.utils.ExcelUtils; +import io.renren.common.utils.Result; +import io.renren.common.validator.AssertUtils; +import io.renren.common.validator.ValidatorUtils; +import io.renren.common.validator.group.AddGroup; +import io.renren.common.validator.group.DefaultGroup; +import io.renren.common.validator.group.UpdateGroup; +import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO; +import io.renren.modules.resourceMountApply.excel.TResourceMountApplyExcel; +import io.renren.modules.resourceMountApply.service.TResourceMountApplyService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * 资源挂载申请表单 + * + * @author wangliwen wangliwen2@hisense.com + * @since 3.0 2022-04-24 + */ +@RestController +@RequestMapping("resourceMountApply/tresourcemountapply") +@Api(tags = "资源挂载申请表单") +public class TResourceMountApplyController { + @Autowired + private TResourceMountApplyService tResourceMountApplyService; + + @GetMapping("page") + @ApiOperation("分页") + @ApiImplicitParams({ + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType = "int"), + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"), + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String") + }) +// @RequiresPermissions("resourceMountApply:tresourcemountapply:page") + public Result> page(@ApiIgnore @RequestParam Map params) { + PageData page = tResourceMountApplyService.page(params); + + return new Result>().ok(page); + } + + @GetMapping("{id}") + @ApiOperation("信息") +// @RequiresPermissions("resourceMountApply:tresourcemountapply:info") + public Result get(@PathVariable("id") Long id) { + TResourceMountApplyDTO data = tResourceMountApplyService.get(id); + + return new Result().ok(data); + } + + @PostMapping + @ApiOperation("保存") + @LogOperation("保存") +// @RequiresPermissions("resourceMountApply:tresourcemountapply:save") + public Result save(@RequestBody TResourceMountApplyDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + + tResourceMountApplyService.save(dto); + + Map map = new HashMap<>(); + map.put("businessKey", dto.getId().toString()); + + return new Result().ok(map); + } + + @PutMapping + @ApiOperation("修改") + @LogOperation("修改") +// @RequiresPermissions("resourceMountApply:tresourcemountapply:update") + public Result update(@RequestBody TResourceMountApplyDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + + tResourceMountApplyService.update(dto); + + return new Result(); + } + + @DeleteMapping + @ApiOperation("删除") + @LogOperation("删除") +// @RequiresPermissions("resourceMountApply:tresourcemountapply:delete") + public Result delete(@RequestBody Long[] ids) { + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + + tResourceMountApplyService.delete(ids); + + return new Result(); + } + + @GetMapping("export") + @ApiOperation("导出") + @LogOperation("导出") +// @RequiresPermissions("resourceMountApply:tresourcemountapply:export") + public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { + List list = tResourceMountApplyService.list(params); + + ExcelUtils.exportExcelToTarget(response, null, "资源挂载申请表单", list, TResourceMountApplyExcel.class); + } + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dao/TResourceMountApplyDao.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dao/TResourceMountApplyDao.java new file mode 100644 index 00000000..5ecd5492 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dao/TResourceMountApplyDao.java @@ -0,0 +1,16 @@ +package io.renren.modules.resourceMountApply.dao; + +import io.renren.common.dao.BaseDao; +import io.renren.modules.resourceMountApply.entity.TResourceMountApplyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 资源挂载申请表单 + * + * @author wangliwen wangliwen2@hisense.com + * @since 3.0 2022-04-24 + */ +@Mapper +public interface TResourceMountApplyDao extends BaseDao { + void updateInstanceId(String instanceId, Long id); +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceBatchMountApplyDTO.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceBatchMountApplyDTO.java new file mode 100644 index 00000000..5c0ad15d --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceBatchMountApplyDTO.java @@ -0,0 +1,42 @@ +package io.renren.modules.resourceMountApply.dto; + +import io.renren.modules.resource.dto.ResourceDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + + +@Data +@ApiModel(value = "批量资源挂载申请表单 前端录入用") +public class TResourceBatchMountApplyDTO implements Serializable { + private static final long serialVersionUID = 1L; + private Long id; + @ApiModelProperty(value = "上架申请人id") + private Integer userId; + @ApiModelProperty(value = "上架申请人名字") + private String userName; + @ApiModelProperty(value = "上架申请人电话") + private String phone; + @ApiModelProperty(value = "上架申请人部门") + private Long deptId; + @ApiModelProperty(value = "流程实例ID") + private String instanceId; + @ApiModelProperty(value = "删除标记:0:正常使用;1:已删除;9:其他") + private String delFlag; + @ApiModelProperty(value = "参数内容(挂载能力json参数) json字符串数组 <后端生成>") + private List parameterContent; + @ApiModelProperty(value = "参数内容 md5 <后端生成>") + private String parameterContentMd5; + @ApiModelProperty(value = "创建该条申请的时间") + private Date createtime; + @ApiModelProperty(value = "资源信息的信息") + private List resourceDTO; + + public TResourceBatchMountApplyDTO() { + this.createtime = new Date(); + } +} diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceMountApplyDTO.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceMountApplyDTO.java new file mode 100644 index 00000000..a035b6f9 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceMountApplyDTO.java @@ -0,0 +1,45 @@ +package io.renren.modules.resourceMountApply.dto; + +import io.renren.modules.resource.dto.ResourceDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +* 资源挂载申请表单 +* +* @author wangliwen wangliwen2@hisense.com +* @since 3.0 2022-04-24 +*/ +@Data +@ApiModel(value = "资源挂载申请表单") +public class TResourceMountApplyDTO implements Serializable { + private static final long serialVersionUID = 1L; + + private Long id; + @ApiModelProperty(value = "上架申请人id") + private Integer userId; + @ApiModelProperty(value = "上架申请人名字") + private String userName; + @ApiModelProperty(value = "上架申请人电话") + private String phone; + @ApiModelProperty(value = "上架申请人部门") + private Long deptId; + @ApiModelProperty(value = "流程实例ID") + private String instanceId; + @ApiModelProperty(value = "删除标记:0:正常使用;1:已删除;9:其他") + private String delFlag; + @ApiModelProperty(value = "参数内容(挂载能力json参数)") + private String parameterContent; + @ApiModelProperty(value = "参数内容 md5") + private String parameterContentMd5; + @ApiModelProperty(value = "创建该条申请的时间") + private Date createtime; + + @ApiModelProperty(value = "申请的资源信息") + private ResourceDTO resourceDTO; + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/entity/TResourceMountApplyEntity.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/entity/TResourceMountApplyEntity.java new file mode 100644 index 00000000..f6a2f022 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/entity/TResourceMountApplyEntity.java @@ -0,0 +1,65 @@ +package io.renren.modules.resourceMountApply.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.renren.common.entity.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 资源挂载申请表单 + * + * @author wangliwen wangliwen2@hisense.com + * @since 3.0 2022-04-24 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("t_resource_mount_apply") +public class TResourceMountApplyEntity extends BaseEntity { + private static final long serialVersionUID = 1L; + + @TableId + private Long id; + + /** + * 上架申请人id + */ + private Integer userId; + /** + * 上架申请人名字 + */ + private String userName; + /** + * 上架申请人电话 + */ + private String phone; + /** + * 上架申请人部门 + */ + @TableField(fill = FieldFill.INSERT) + private Long deptId; + /** + * 流程实例ID + */ + private String instanceId; + /** + * 删除标记:0:正常使用;1:已删除;9:其他 + */ + private String delFlag; + /** + * 参数内容(挂载能力json参数) + */ + private String parameterContent; + /** + * 参数内容 md5 + */ + private String parameterContentMd5; + /** + * 创建该条申请的时间 + */ + private Date createtime; +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/excel/TResourceMountApplyExcel.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/excel/TResourceMountApplyExcel.java new file mode 100644 index 00000000..296ed46d --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/excel/TResourceMountApplyExcel.java @@ -0,0 +1,41 @@ +package io.renren.modules.resourceMountApply.excel; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import lombok.Data; +import java.util.Date; + +/** + * 资源挂载申请表单 + * + * @author wangliwen wangliwen2@hisense.com + * @since 3.0 2022-04-24 + */ +@Data +@ContentRowHeight(20) +@HeadRowHeight(20) +@ColumnWidth(25) +public class TResourceMountApplyExcel { + @ExcelProperty(value = "Long", index = 0) + private Long id; + @ExcelProperty(value = "上架申请人id", index = 1) + private Integer userId; + @ExcelProperty(value = "上架申请人名字", index = 2) + private String userName; + @ExcelProperty(value = "上架申请人电话", index = 3) + private String phone; + @ExcelProperty(value = "上架申请人部门", index = 4) + private Long deptId; + @ExcelProperty(value = "流程实例ID", index = 5) + private String instanceId; + @ExcelProperty(value = "删除标记:0:正常使用;1:已删除;9:其他", index = 6) + private String delFlag; + @ExcelProperty(value = "参数内容(挂载能力json参数)", index = 7) + private String parameterContent; + @ExcelProperty(value = "参数内容 md5", index = 8) + private String parameterContentMd5; + @ExcelProperty(value = "创建该条申请的时间", index = 9) + private Date createtime; +} \ No newline at end of file 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 new file mode 100644 index 00000000..58406c9f --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/listener/ResourceOwnerListener.java @@ -0,0 +1,74 @@ +package io.renren.modules.resourceMountApply.listener; + +import io.renren.modules.sys.service.SysDeptService; +import io.renren.modules.sys.service.SysRoleService; +import io.renren.modules.sys.service.SysRoleUserService; +import io.renren.modules.sys.service.SysUserService; +import org.activiti.engine.TaskService; +import org.activiti.engine.delegate.*; +import org.activiti.engine.delegate.event.ActivitiEvent; +import org.activiti.engine.delegate.event.ActivitiEventListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * 资源所有者节点审批 + */ +@Component +public class ResourceOwnerListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate { + private static Logger logger = LoggerFactory.getLogger(ResourceOwnerListener.class); + + @Value("${big_date.name}") + private String bigDateDeptName; // 大数据局名称 + @Value("${big_date.assignee_role_name}") + private String roleName; // 具备审批的角色名称 + + @Autowired + private SysRoleService sysRoleService; + @Autowired + private TaskService taskService; + @Autowired + private SysUserService sysUserService; + @Autowired + private SysRoleUserService sysRoleUserService; + @Autowired + private SysDeptService sysDeptService; + + @Override + public void notify(DelegateExecution execution) throws Exception { + + } + + @Override + public void execute(DelegateExecution execution) throws Exception { + + } + + @Override + public void notify(DelegateTask delegateTask) { + logger.error("----------------------进入资源所有者节点---------------------------"); + logger.info("事件类型:" + delegateTask.getEventName()); + } + + /** + * Called when an event has been fired + * + * @param event the event + */ + @Override + public void onEvent(ActivitiEvent event) { + + } + + /** + * @return whether or not the current operation should fail when this listeners execution + * throws an exception. + */ + @Override + public boolean isFailOnException() { + return false; + } +} diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/service/TResourceMountApplyService.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/service/TResourceMountApplyService.java new file mode 100644 index 00000000..01dab150 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/service/TResourceMountApplyService.java @@ -0,0 +1,17 @@ +package io.renren.modules.resourceMountApply.service; + +import io.renren.common.service.CrudService; +import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO; +import io.renren.modules.resourceMountApply.entity.TResourceMountApplyEntity; + +/** + * 资源挂载申请表单 + * + * @author wangliwen wangliwen2@hisense.com + * @since 3.0 2022-04-24 + */ +public interface TResourceMountApplyService extends CrudService { + + void updateInstanceId(String instanceId, Long id); + +} \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/service/impl/TResourceMountApplyServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/service/impl/TResourceMountApplyServiceImpl.java new file mode 100644 index 00000000..84976a09 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/service/impl/TResourceMountApplyServiceImpl.java @@ -0,0 +1,35 @@ +package io.renren.modules.resourceMountApply.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.renren.common.service.impl.CrudServiceImpl; +import io.renren.modules.resourceMountApply.dao.TResourceMountApplyDao; +import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO; +import io.renren.modules.resourceMountApply.entity.TResourceMountApplyEntity; +import io.renren.modules.resourceMountApply.service.TResourceMountApplyService; +import org.springframework.stereotype.Service; + +import java.util.Map; + +/** + * 资源挂载申请表单 + * + * @author wangliwen wangliwen2@hisense.com + * @since 3.0 2022-04-24 + */ +@Service +public class TResourceMountApplyServiceImpl extends CrudServiceImpl implements TResourceMountApplyService { + + @Override + public QueryWrapper getWrapper(Map params) { + QueryWrapper wrapper = new QueryWrapper<>(); + + + return wrapper; + } + + + @Override + public void updateInstanceId(String instanceId, Long id) { + + } +} \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/resourceMountApply/TResourceMountApplyDao.xml b/renren-admin/src/main/resources/mapper/resourceMountApply/TResourceMountApplyDao.xml new file mode 100644 index 00000000..0dd84baf --- /dev/null +++ b/renren-admin/src/main/resources/mapper/resourceMountApply/TResourceMountApplyDao.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + update t_resource_mount_apply set instance_id = #{instanceId} where id = #{id}; + + + \ No newline at end of file