资源上架 申请功能

This commit is contained in:
wangliwen 2022-04-24 17:19:07 +08:00
parent 4c23160773
commit f059f2b76a
5 changed files with 22 additions and 30 deletions

View File

@ -19,6 +19,8 @@ import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -28,11 +30,13 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
@Api(tags = "资源上架") @Api(tags = "资源上架")
@RestController @RestController
@RequestMapping("/resource/center") @RequestMapping("/resource/center")
public class ResourceMountController { public class ResourceMountController {
private static Logger logger = LoggerFactory.getLogger(ResourceMountController.class);
@Autowired @Autowired
private ActProcessService actProcessService; private ActProcessService actProcessService;
@ -58,7 +62,10 @@ public class ResourceMountController {
if (page.getTotal() <= 0) { // if (page.getTotal() <= 0) { //
return new Result().error("联系管理员添加流程"); return new Result().error("联系管理员添加流程");
} }
tResourceBatchMountApplyDTO.getResourceDTO().stream().map(index -> { logger.info("---------------------------------------------------");
logger.info(JSONObject.toJSONString(tResourceBatchMountApplyDTO));
logger.info("####################################################");
return new Result().ok(tResourceBatchMountApplyDTO.getResourceDTO().stream().map(index -> {
TResourceMountApplyDTO tResourceMountApplyDTO = new TResourceMountApplyDTO(); TResourceMountApplyDTO tResourceMountApplyDTO = new TResourceMountApplyDTO();
tResourceMountApplyDTO.setPhone(tResourceBatchMountApplyDTO.getPhone()); tResourceMountApplyDTO.setPhone(tResourceBatchMountApplyDTO.getPhone());
tResourceMountApplyDTO.setDeptId(tResourceBatchMountApplyDTO.getDeptId()); tResourceMountApplyDTO.setDeptId(tResourceBatchMountApplyDTO.getDeptId());
@ -73,6 +80,7 @@ public class ResourceMountController {
if (tResourceMountApplyDTO.getId() == null) { if (tResourceMountApplyDTO.getId() == null) {
return null; return null;
} }
logger.info("-------------------1.保存申请表单成功--------------------------");
// 仿照请求接口 /act/running/startOfBusinessKey // 仿照请求接口 /act/running/startOfBusinessKey
ProcessStartDTO processStartDTO = new ProcessStartDTO(); ProcessStartDTO processStartDTO = new ProcessStartDTO();
processStartDTO.setBusinessKey(tResourceMountApplyDTO.getId().toString()); processStartDTO.setBusinessKey(tResourceMountApplyDTO.getId().toString());
@ -81,14 +89,17 @@ public class ResourceMountController {
Map<String, Object> variables = oMapper.convertValue(tResourceMountApplyDTO, Map.class); Map<String, Object> variables = oMapper.convertValue(tResourceMountApplyDTO, Map.class);
processStartDTO.setVariables(variables); processStartDTO.setVariables(variables);
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO); ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
logger.info("-------------------2.启动流程成功--------------------------");
logger.info("ProcessInstanceDTO.getBusinessKey:" + dto.getBusinessKey());
if (Long.valueOf(dto.getBusinessKey()) != null) { if (Long.valueOf(dto.getBusinessKey()) != null) {
// 仿照请求接口 /processForm/tabilityapplication/updateInstanceId // 仿照请求接口 /processForm/tabilityapplication/updateInstanceId
tResourceMountApplyService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey())); tResourceMountApplyService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey()));
logger.info("-------------------更新updateInstanceId.成功--------------------------");
logger.info("ProcessInstanceDTO.getProcessInstanceId:" + dto.getProcessInstanceId());
} }
return tResourceMountApplyDTO; return dto;
}).filter(index -> ObjectUtil.isNotNull(index)); }).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList()));
return null;
} }
} }

View File

@ -6,7 +6,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import java.util.List; import java.util.List;
@ -16,13 +15,13 @@ public class TResourceBatchMountApplyDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Long id; private Long id;
@ApiModelProperty(value = "上架申请人id") @ApiModelProperty(value = "上架申请人id")
private Integer userId; private String userId;
@ApiModelProperty(value = "上架申请人名字") @ApiModelProperty(value = "上架申请人名字")
private String userName; private String userName;
@ApiModelProperty(value = "上架申请人电话") @ApiModelProperty(value = "上架申请人电话")
private String phone; private String phone;
@ApiModelProperty(value = "上架申请人部门") @ApiModelProperty(value = "上架申请人部门")
private Long deptId; private String deptId;
@ApiModelProperty(value = "流程实例ID") @ApiModelProperty(value = "流程实例ID")
private String instanceId; private String instanceId;
@ApiModelProperty(value = "删除标记0:正常使用1:已删除9:其他") @ApiModelProperty(value = "删除标记0:正常使用1:已删除9:其他")
@ -31,12 +30,7 @@ public class TResourceBatchMountApplyDTO implements Serializable {
private List<String> parameterContent; private List<String> parameterContent;
@ApiModelProperty(value = "参数内容 md5 <后端生成>") @ApiModelProperty(value = "参数内容 md5 <后端生成>")
private String parameterContentMd5; private String parameterContentMd5;
@ApiModelProperty(value = "创建该条申请的时间")
private Date createtime;
@ApiModelProperty(value = "资源信息的信息") @ApiModelProperty(value = "资源信息的信息")
private List<ResourceDTO> resourceDTO; private List<ResourceDTO> resourceDTO;
public TResourceBatchMountApplyDTO() {
this.createtime = new Date();
}
} }

View File

@ -6,7 +6,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* 资源挂载申请表单 * 资源挂载申请表单
@ -21,13 +20,13 @@ public class TResourceMountApplyDTO implements Serializable {
private Long id; private Long id;
@ApiModelProperty(value = "上架申请人id") @ApiModelProperty(value = "上架申请人id")
private Integer userId; private String userId;
@ApiModelProperty(value = "上架申请人名字") @ApiModelProperty(value = "上架申请人名字")
private String userName; private String userName;
@ApiModelProperty(value = "上架申请人电话") @ApiModelProperty(value = "上架申请人电话")
private String phone; private String phone;
@ApiModelProperty(value = "上架申请人部门") @ApiModelProperty(value = "上架申请人部门")
private Long deptId; private String deptId;
@ApiModelProperty(value = "流程实例ID") @ApiModelProperty(value = "流程实例ID")
private String instanceId; private String instanceId;
@ApiModelProperty(value = "删除标记0:正常使用1:已删除9:其他") @ApiModelProperty(value = "删除标记0:正常使用1:已删除9:其他")
@ -36,8 +35,6 @@ public class TResourceMountApplyDTO implements Serializable {
private String parameterContent; private String parameterContent;
@ApiModelProperty(value = "参数内容 md5") @ApiModelProperty(value = "参数内容 md5")
private String parameterContentMd5; private String parameterContentMd5;
@ApiModelProperty(value = "创建该条申请的时间")
private Date createtime;
@ApiModelProperty(value = "申请的资源信息") @ApiModelProperty(value = "申请的资源信息")
private ResourceDTO resourceDTO; private ResourceDTO resourceDTO;

View File

@ -2,14 +2,11 @@ package io.renren.modules.resourceMountApply.entity;
import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.renren.common.entity.BaseEntity; import io.renren.common.entity.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date;
/** /**
* 资源挂载申请表单 * 资源挂载申请表单
* *
@ -22,13 +19,10 @@ import java.util.Date;
public class TResourceMountApplyEntity extends BaseEntity { public class TResourceMountApplyEntity extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId
private Long id;
/** /**
* 上架申请人id * 上架申请人id
*/ */
private Integer userId; private String userId;
/** /**
* 上架申请人名字 * 上架申请人名字
*/ */
@ -41,7 +35,7 @@ public class TResourceMountApplyEntity extends BaseEntity {
* 上架申请人部门 * 上架申请人部门
*/ */
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
private Long deptId; private String deptId;
/** /**
* 流程实例ID * 流程实例ID
*/ */
@ -58,8 +52,4 @@ public class TResourceMountApplyEntity extends BaseEntity {
* 参数内容 md5 * 参数内容 md5
*/ */
private String parameterContentMd5; private String parameterContentMd5;
/**
* 创建该条申请的时间
*/
private Date createtime;
} }

View File

@ -30,6 +30,6 @@ public class TResourceMountApplyServiceImpl extends CrudServiceImpl<TResourceMou
@Override @Override
public void updateInstanceId(String instanceId, Long id) { public void updateInstanceId(String instanceId, Long id) {
baseDao.updateInstanceId(instanceId, id);
} }
} }