资源上架 流程初始化
This commit is contained in:
parent
0d1036c3d7
commit
bb13945d43
|
@ -43,11 +43,12 @@ public class AbilityCenterController {
|
||||||
private TAbilityApplicationService tAbilityApplicationService;
|
private TAbilityApplicationService tAbilityApplicationService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ActRunningService actRunningService;
|
private ActRunningService actRunningService;
|
||||||
|
private static String key = "abilityprocess";
|
||||||
|
|
||||||
private static Map<String, Object> params = new HashMap<String, Object>() {
|
private static Map<String, Object> params = new HashMap<String, Object>() {
|
||||||
{
|
{
|
||||||
put("isLatestVersion", true); // 取最新版本
|
put("isLatestVersion", true); // 取最新版本
|
||||||
put("key", "abilityprocess"); // 限定
|
put("key", key); // 限定
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ public class AbilityCenterController {
|
||||||
// 仿照请求接口 /act/running/startOfBusinessKey
|
// 仿照请求接口 /act/running/startOfBusinessKey
|
||||||
ProcessStartDTO processStartDTO = new ProcessStartDTO();
|
ProcessStartDTO processStartDTO = new ProcessStartDTO();
|
||||||
processStartDTO.setBusinessKey(tAbilityApplicationDTO.getId().toString());
|
processStartDTO.setBusinessKey(tAbilityApplicationDTO.getId().toString());
|
||||||
processStartDTO.setProcessDefinitionKey("abilityprocess"); //限定
|
processStartDTO.setProcessDefinitionKey(key); //限定
|
||||||
ObjectMapper oMapper = new ObjectMapper();
|
ObjectMapper oMapper = new ObjectMapper();
|
||||||
Map<String, Object> variables = oMapper.convertValue(tAbilityApplicationDTO, Map.class);
|
Map<String, Object> variables = oMapper.convertValue(tAbilityApplicationDTO, Map.class);
|
||||||
processStartDTO.setVariables(variables);
|
processStartDTO.setVariables(variables);
|
||||||
|
|
|
@ -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<String, Object> params = new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("isLatestVersion", true); // 取最新版本
|
||||||
|
put("key", key); // 限定 能力资源上架
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping(value = "/apply")
|
||||||
|
@ApiOperation("批量进行能力上架申请")
|
||||||
|
public Result<List<ProcessInstanceDTO>> apply(@RequestBody TResourceBatchMountApplyDTO tResourceBatchMountApplyDTO) {
|
||||||
|
// 仿照请求接口 /act/process/lastestPage
|
||||||
|
PageData<Map<String, Object>> 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<String, Object> 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,7 +34,6 @@ import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模型管理
|
* 模型管理
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ActModelService {
|
public class ActModelService {
|
||||||
|
@ -44,30 +43,30 @@ public class ActModelService {
|
||||||
private ObjectMapper objectMapper;
|
private ObjectMapper objectMapper;
|
||||||
|
|
||||||
public PageData<Model> page(Map<String, Object> params) {
|
public PageData<Model> page(Map<String, Object> params) {
|
||||||
String key = (String)params.get("key");
|
String key = (String) params.get("key");
|
||||||
String name = (String)params.get("name");
|
String name = (String) params.get("name");
|
||||||
|
|
||||||
//分页参数
|
//分页参数
|
||||||
int curPage = 1;
|
int curPage = 1;
|
||||||
int limit = 10;
|
int limit = 10;
|
||||||
if(params.get(Constant.PAGE) != null){
|
if (params.get(Constant.PAGE) != null) {
|
||||||
curPage = Integer.parseInt((String)params.get(Constant.PAGE));
|
curPage = Integer.parseInt((String) params.get(Constant.PAGE));
|
||||||
}
|
}
|
||||||
if(params.get(Constant.LIMIT) != null){
|
if (params.get(Constant.LIMIT) != null) {
|
||||||
limit = Integer.parseInt((String)params.get(Constant.LIMIT));
|
limit = Integer.parseInt((String) params.get(Constant.LIMIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelQuery modelQuery = repositoryService.createModelQuery().latestVersion().orderByLastUpdateTime().desc();
|
ModelQuery modelQuery = repositoryService.createModelQuery().latestVersion().orderByLastUpdateTime().desc();
|
||||||
|
|
||||||
if(StringUtils.isNotEmpty(key)){
|
if (StringUtils.isNotEmpty(key)) {
|
||||||
modelQuery.modelKey(key);
|
modelQuery.modelKey(key);
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotEmpty(name)){
|
if (StringUtils.isNotEmpty(name)) {
|
||||||
modelQuery.modelName(name);
|
modelQuery.modelName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Model> list = modelQuery.listPage((curPage - 1) * limit, limit);
|
List<Model> 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 {
|
public void save(String name, String key, String description) throws UnsupportedEncodingException {
|
||||||
|
@ -103,19 +102,18 @@ public class ActModelService {
|
||||||
BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
|
BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
|
||||||
BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
|
BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
|
||||||
byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
|
byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
|
||||||
if(bpmnModel.getProcesses().isEmpty()){
|
if (bpmnModel.getProcesses().isEmpty()) {
|
||||||
throw new RenException(ErrorCode.ACT_DEPLOY_ERROR);
|
throw new RenException(ErrorCode.ACT_DEPLOY_ERROR);
|
||||||
}
|
}
|
||||||
String processName = model.getName();
|
String processName = model.getName();
|
||||||
if (!StringUtils.endsWith(processName, ".bpmn20.xml")){
|
if (!StringUtils.endsWith(processName, ".bpmn20.xml")) {
|
||||||
processName += ".bpmn20.xml";
|
processName += ".bpmn20.xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
|
ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
|
||||||
Deployment deployment = repositoryService.createDeployment().name(model.getName()).addInputStream(processName, in).deploy();
|
Deployment deployment = repositoryService.createDeployment().name(model.getName()).addInputStream(processName, in).deploy();
|
||||||
|
|
||||||
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
|
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
|
||||||
if (list.size() == 0){
|
if (list.size() == 0) {
|
||||||
throw new RenException(ErrorCode.ACT_DEPLOY_ERROR);
|
throw new RenException(ErrorCode.ACT_DEPLOY_ERROR);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -147,6 +145,7 @@ public class ActModelService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除模型
|
* 删除模型
|
||||||
|
*
|
||||||
* @param id 模型ID
|
* @param id 模型ID
|
||||||
*/
|
*/
|
||||||
public void delete(String id) {
|
public void delete(String id) {
|
||||||
|
@ -154,10 +153,10 @@ public class ActModelService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deployImage(String deploymentId, HttpServletResponse response) {
|
public void deployImage(String deploymentId, HttpServletResponse response) {
|
||||||
List <String> names = repositoryService.getDeploymentResourceNames(deploymentId);
|
List<String> names = repositoryService.getDeploymentResourceNames(deploymentId);
|
||||||
String imageName = null;
|
String imageName = null;
|
||||||
for(String name: names){
|
for (String name : names) {
|
||||||
if(name.indexOf(".png")>=0){
|
if (name.indexOf(".png") >= 0) {
|
||||||
imageName = name;
|
imageName = name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -165,10 +164,10 @@ public class ActModelService {
|
||||||
InputStream in = null;
|
InputStream in = null;
|
||||||
InputStream in1 = null;
|
InputStream in1 = null;
|
||||||
try {
|
try {
|
||||||
if(StringUtils.isNotEmpty(imageName)){
|
if (StringUtils.isNotEmpty(imageName)) {
|
||||||
in = repositoryService.getResourceAsStream(deploymentId,imageName);
|
in = repositoryService.getResourceAsStream(deploymentId, imageName);
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(imageName, "UTF-8"));
|
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");
|
response.setHeader("Cache-Control", "no-store, no-cache");
|
||||||
BufferedImage bufferedImage = ImageIO.read(in);
|
BufferedImage bufferedImage = ImageIO.read(in);
|
||||||
ImageIO.write(bufferedImage, "png", response.getOutputStream());
|
ImageIO.write(bufferedImage, "png", response.getOutputStream());
|
||||||
|
@ -179,7 +178,7 @@ public class ActModelService {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if(null != in){
|
if (null != in) {
|
||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -31,10 +31,10 @@ import java.util.Map;
|
||||||
public class CorrectionListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate {
|
public class CorrectionListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate {
|
||||||
private static Logger logger = LoggerFactory.getLogger(CorrectionListener.class);
|
private static Logger logger = LoggerFactory.getLogger(CorrectionListener.class);
|
||||||
|
|
||||||
@Value("${big_date.assignee_role_name}")
|
|
||||||
private String roleName;
|
|
||||||
@Value("${big_date.name}")
|
@Value("${big_date.name}")
|
||||||
private String bigDateDeptName;
|
private String bigDateDeptName; // 大数据局名称
|
||||||
|
@Value("${big_date.assignee_role_name}")
|
||||||
|
private String roleName; // 具备审批的角色名称
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRoleService sysRoleService;
|
private SysRoleService sysRoleService;
|
||||||
|
|
|
@ -25,9 +25,9 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
|
||||||
private static Logger logger = LoggerFactory.getLogger(DataCenterListener.class);
|
private static Logger logger = LoggerFactory.getLogger(DataCenterListener.class);
|
||||||
|
|
||||||
@Value("${big_date.name}")
|
@Value("${big_date.name}")
|
||||||
private String bigDateDeptName;
|
private String bigDateDeptName; // 大数据局名称
|
||||||
@Value("${big_date.assignee_role_name}")
|
@Value("${big_date.assignee_role_name}")
|
||||||
private String roleName;
|
private String roleName; // 具备审批的角色名称
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRoleService sysRoleService;
|
private SysRoleService sysRoleService;
|
||||||
|
@ -52,6 +52,7 @@ 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("大数据局名称:" + bigDateDeptName);
|
logger.info("大数据局名称:" + bigDateDeptName);
|
||||||
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
|
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
|
||||||
logger.info("deptDTOId:" + deptDTO.getId());
|
logger.info("deptDTOId:" + deptDTO.getId());
|
||||||
|
|
|
@ -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<PageData<TResourceMountApplyDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||||
|
PageData<TResourceMountApplyDTO> page = tResourceMountApplyService.page(params);
|
||||||
|
|
||||||
|
return new Result<PageData<TResourceMountApplyDTO>>().ok(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("{id}")
|
||||||
|
@ApiOperation("信息")
|
||||||
|
// @RequiresPermissions("resourceMountApply:tresourcemountapply:info")
|
||||||
|
public Result<TResourceMountApplyDTO> get(@PathVariable("id") Long id) {
|
||||||
|
TResourceMountApplyDTO data = tResourceMountApplyService.get(id);
|
||||||
|
|
||||||
|
return new Result<TResourceMountApplyDTO>().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<String, Object> 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<String, Object> params, HttpServletResponse response) throws Exception {
|
||||||
|
List<TResourceMountApplyDTO> list = tResourceMountApplyService.list(params);
|
||||||
|
|
||||||
|
ExcelUtils.exportExcelToTarget(response, null, "资源挂载申请表单", list, TResourceMountApplyExcel.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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<TResourceMountApplyEntity> {
|
||||||
|
void updateInstanceId(String instanceId, Long id);
|
||||||
|
}
|
|
@ -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<String> parameterContent;
|
||||||
|
@ApiModelProperty(value = "参数内容 md5 <后端生成>")
|
||||||
|
private String parameterContentMd5;
|
||||||
|
@ApiModelProperty(value = "创建该条申请的时间")
|
||||||
|
private Date createtime;
|
||||||
|
@ApiModelProperty(value = "资源信息的信息")
|
||||||
|
private List<ResourceDTO> resourceDTO;
|
||||||
|
|
||||||
|
public TResourceBatchMountApplyDTO() {
|
||||||
|
this.createtime = new Date();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<TResourceMountApplyEntity, TResourceMountApplyDTO> {
|
||||||
|
|
||||||
|
void updateInstanceId(String instanceId, Long id);
|
||||||
|
|
||||||
|
}
|
|
@ -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<TResourceMountApplyDao, TResourceMountApplyEntity, TResourceMountApplyDTO> implements TResourceMountApplyService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryWrapper<TResourceMountApplyEntity> getWrapper(Map<String, Object> params) {
|
||||||
|
QueryWrapper<TResourceMountApplyEntity> wrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
|
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateInstanceId(String instanceId, Long id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="io.renren.modules.resourceMountApply.dao.TResourceMountApplyDao">
|
||||||
|
|
||||||
|
<resultMap type="io.renren.modules.resourceMountApply.entity.TResourceMountApplyEntity" id="tResourceMountApplyMap">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="userName" column="user_name"/>
|
||||||
|
<result property="phone" column="phone"/>
|
||||||
|
<result property="deptId" column="dept_id"/>
|
||||||
|
<result property="instanceId" column="instance_id"/>
|
||||||
|
<result property="delFlag" column="del_flag"/>
|
||||||
|
<result property="parameterContent" column="parameter_content"/>
|
||||||
|
<result property="parameterContentMd5" column="parameter_content_md5"/>
|
||||||
|
<result property="createtime" column="createtime"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<update id="updateInstanceId">
|
||||||
|
update t_resource_mount_apply set instance_id = #{instanceId} where id = #{id};
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue