update
This commit is contained in:
@@ -0,0 +1,175 @@
|
||||
package com.rzdata.web.controller.tool;
|
||||
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.blueland.bpmclient.model.BpmClientInputModel;
|
||||
import com.blueland.bpmclient.model.ProcessInstanceModel;
|
||||
import com.rzdata.common.annotation.Log;
|
||||
import com.rzdata.common.constant.Constants;
|
||||
import com.rzdata.common.core.controller.BaseController;
|
||||
import com.rzdata.common.core.domain.AjaxResult;
|
||||
import com.rzdata.common.core.page.TableDataInfo;
|
||||
import com.rzdata.common.enums.BusinessType;
|
||||
import com.rzdata.common.enums.RecordStatusEnum;
|
||||
import com.rzdata.common.utils.DateUtils;
|
||||
import com.rzdata.common.utils.StringUtils;
|
||||
import com.rzdata.common.utils.poi.ExcelUtil;
|
||||
import com.rzdata.web.domain.ToolApply;
|
||||
import com.rzdata.web.domain.bo.BpmClientInputModelBo;
|
||||
import com.rzdata.web.service.IToolApplyService;
|
||||
import com.rzdata.web.service.IUseApplyItemService;
|
||||
import com.rzdata.web.service.WorkflowService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 申请Controller
|
||||
*
|
||||
* @author ja
|
||||
* @date 2024-08-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tool/apply")
|
||||
public class ToolApplyController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IToolApplyService toolApplyService;
|
||||
|
||||
@Autowired
|
||||
private WorkflowService workflowService;
|
||||
|
||||
@Autowired
|
||||
private IUseApplyItemService useApplyItemService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询使用申请列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:apply:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ToolApply toolApply)
|
||||
{
|
||||
startPage();
|
||||
List<ToolApply> list = toolApplyService.selectToolApplyList(toolApply);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工具信息详细信息
|
||||
*/
|
||||
@GetMapping(value = "/bpmc/{bpmcId}")
|
||||
public AjaxResult getInfoByBpmcId(@PathVariable("bpmcId") String bpmcId)
|
||||
{
|
||||
return success(toolApplyService.getInfoByBpmcId(bpmcId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出使用申请列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:apply:export')")
|
||||
@Log(title = "使用申请", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ToolApply toolApply)
|
||||
{
|
||||
List<ToolApply> list = toolApplyService.selectToolApplyList(toolApply);
|
||||
ExcelUtil<ToolApply> util = new ExcelUtil<ToolApply>(ToolApply.class);
|
||||
util.exportExcel(response, list, "使用申请数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取使用申请详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:apply:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(toolApplyService.selectToolApplyById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增使用申请
|
||||
*/
|
||||
@Log(title = "使用申请", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ToolApply toolApply)
|
||||
{
|
||||
boolean add = false;
|
||||
if (StringUtils.isEmpty(toolApply.getId())) {
|
||||
toolApply.setId(IdUtil.simpleUUID());
|
||||
add = true;
|
||||
}
|
||||
ProcessInstanceModel processInstanceModel = null;
|
||||
try {
|
||||
if(StringUtils.equals(toolApply.getRecordStatus(), RecordStatusEnum.DRAFT.getCode())){
|
||||
processInstanceModel = workflowService.saveExecute(toolApply.getBpmClientInputModel(), toolApply.getId());
|
||||
}else if (StringUtils.equals(toolApply.getRecordStatus(), RecordStatusEnum.CANCEL.getCode())){
|
||||
processInstanceModel = workflowService.cancelExecute(toolApply.getBpmClientInputModel(), toolApply.getId());
|
||||
}else{
|
||||
processInstanceModel = workflowService.nextExecute(toolApply.getBpmClientInputModel(), toolApply.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (processInstanceModel != null && StringUtils.isNotEmpty(processInstanceModel.getProcInstId())) {
|
||||
if (add) {
|
||||
BpmClientInputModelBo bpmClientInputModelBo = toolApply.getBpmClientInputModel();
|
||||
if(null != bpmClientInputModelBo){
|
||||
BpmClientInputModel bpmClientInputModel = bpmClientInputModelBo.getModel();
|
||||
toolApply.setProcTitle(StrUtil.isNotEmpty(bpmClientInputModel.getWf_procTitle()) ? bpmClientInputModel.getWf_procTitle() : "");
|
||||
}
|
||||
if(toolApply.getItemList().size() > 0){
|
||||
toolApply.setToolId(toolApply.getItemList().get(0).getToolId());
|
||||
}
|
||||
toolApply.setApplyType(Constants.TOOL_APPLY_TYPE_USE);
|
||||
toolApply.setProcInstId(processInstanceModel.getProcInstId());
|
||||
toolApplyService.insertToolApply(toolApply);
|
||||
useApplyItemService.updateItemList(toolApply.getItemList(), toolApply.getId());
|
||||
}else if (BooleanUtil.isTrue(toolApply.getEditStatus())){
|
||||
toolApplyService.updateToolApply(toolApply);
|
||||
useApplyItemService.updateItemList(toolApply.getItemList(), toolApply.getId());
|
||||
}else {
|
||||
ToolApply updateStatus = new ToolApply();
|
||||
updateStatus.setId(toolApply.getId());
|
||||
updateStatus.setRecordStatus(toolApply.getRecordStatus());
|
||||
if("done".equals(toolApply.getRecordStatus())){
|
||||
toolApply.setEndTime(DateUtils.getNowDate());
|
||||
}
|
||||
toolApplyService.updateToolApply(updateStatus);
|
||||
}
|
||||
//办结
|
||||
if(RecordStatusEnum.DONE.getCode().equals(toolApply)){
|
||||
//给消息中心发送消息
|
||||
toolApplyService.sendTzMessage(toolApply);
|
||||
}
|
||||
return AjaxResult.success("操作成功",processInstanceModel);
|
||||
}else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改使用申请
|
||||
*/
|
||||
@Log(title = "使用申请", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody ToolApply toolApply)
|
||||
{
|
||||
return toAjax(toolApplyService.updateToolApply(toolApply));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除使用申请
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:apply:remove')")
|
||||
@Log(title = "使用申请", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(toolApplyService.deleteToolApplyByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.rzdata.web.controller.tool;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.blueland.bpmclient.model.ProcessInstanceModel;
|
||||
@@ -10,14 +11,16 @@ import com.rzdata.common.core.domain.AjaxResult;
|
||||
import com.rzdata.common.core.page.TableDataInfo;
|
||||
import com.rzdata.common.enums.BusinessType;
|
||||
import com.rzdata.common.enums.RecordStatusEnum;
|
||||
import com.rzdata.common.utils.DateUtils;
|
||||
import com.rzdata.common.utils.SecurityUtils;
|
||||
import com.rzdata.common.utils.StringUtils;
|
||||
import com.rzdata.common.utils.poi.ExcelUtil;
|
||||
import com.rzdata.system.service.ISysDeptService;
|
||||
import com.rzdata.web.domain.Tool;
|
||||
import com.rzdata.web.domain.ToolApply;
|
||||
import com.rzdata.web.service.IDocumentService;
|
||||
import com.rzdata.web.service.IToolApplyService;
|
||||
import com.rzdata.web.service.IToolService;
|
||||
import com.rzdata.web.service.IUseApplyService;
|
||||
import com.rzdata.web.service.WorkflowService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -45,15 +48,17 @@ public class ToolController extends BaseController
|
||||
private WorkflowService workflowService;
|
||||
|
||||
@Autowired
|
||||
private IUseApplyService iUseApplyService;
|
||||
private IToolApplyService iToolApplyService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService iSysDeptService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IDocumentService iDocumentService;
|
||||
|
||||
@Autowired
|
||||
private IToolApplyService toolApplyService;
|
||||
|
||||
/**
|
||||
* 查询工具信息列表
|
||||
*/
|
||||
@@ -71,7 +76,7 @@ public class ToolController extends BaseController
|
||||
vo.setDownloadStatus(RecordStatusEnum.DONE.getCode().equals(vo.getRecordStatus())&&
|
||||
(userId.equals(vo.getCreateBy())||
|
||||
SecurityUtils.hasPermi(Constants.DOWNLOAD_TOOL_PERMISSION)||
|
||||
iUseApplyService.checkUseApply(vo.getToolId(),userId)));
|
||||
iToolApplyService.checkToolApply(vo.getToolId(),userId)));
|
||||
}
|
||||
}
|
||||
return getDataTable(list);
|
||||
@@ -139,22 +144,31 @@ public class ToolController extends BaseController
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (processInstanceModel!=null&&StringUtils.isNotEmpty(processInstanceModel.getProcInstId())) {
|
||||
if (processInstanceModel != null && StringUtils.isNotEmpty(processInstanceModel.getProcInstId())) {
|
||||
if (add) {
|
||||
tTool.setProcInstId(processInstanceModel.getProcInstId());
|
||||
toolService.insertTool(tTool);
|
||||
//保存文档和附件
|
||||
toolService.addDocAndAtt(tTool);
|
||||
}else if (BooleanUtil.isTrue(tTool.getEditStatus())){
|
||||
|
||||
//记录申请数据
|
||||
toolService.recordToolApply(tTool);
|
||||
} else if (BooleanUtil.isTrue(tTool.getEditStatus())){
|
||||
toolService.updateTool(tTool);
|
||||
//删除文档和附件
|
||||
toolService.deleteDocAndAtt(tTool);
|
||||
//保存文档和附件
|
||||
toolService.addDocAndAtt(tTool);
|
||||
}else {
|
||||
} else {
|
||||
Tool tool = new Tool();
|
||||
tool.setToolId(tTool.getToolId());
|
||||
tool.setRecordStatus(tTool.getRecordStatus());
|
||||
if("done".equals(tTool.getRecordStatus())){
|
||||
ToolApply toolApply = toolApplyService.getInfoByBpmcId(tTool.getProcInstId());
|
||||
toolApply.setRecordStatus(tTool.getRecordStatus());
|
||||
toolApply.setEndTime(DateUtils.getNowDate());
|
||||
toolApplyService.updateToolApply(toolApply);
|
||||
}
|
||||
toolService.updateTool(tool);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
package com.rzdata.web.controller.tool;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.blueland.bpmclient.model.ProcessInstanceModel;
|
||||
import com.rzdata.common.enums.RecordStatusEnum;
|
||||
import com.rzdata.common.utils.DateUtils;
|
||||
import com.rzdata.common.utils.StringUtils;
|
||||
import com.rzdata.web.domain.Tool;
|
||||
import com.rzdata.web.service.IUseApplyItemService;
|
||||
import com.rzdata.web.service.WorkflowService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.rzdata.common.annotation.Log;
|
||||
import com.rzdata.common.core.controller.BaseController;
|
||||
import com.rzdata.common.core.domain.AjaxResult;
|
||||
import com.rzdata.common.enums.BusinessType;
|
||||
import com.rzdata.web.domain.UseApply;
|
||||
import com.rzdata.web.service.IUseApplyService;
|
||||
import com.rzdata.common.utils.poi.ExcelUtil;
|
||||
import com.rzdata.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 使用申请Controller
|
||||
*
|
||||
* @author ja
|
||||
* @date 2024-08-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/use/apply")
|
||||
public class UseApplyController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUseApplyService useApplyService;
|
||||
|
||||
@Autowired
|
||||
private WorkflowService workflowService;
|
||||
|
||||
@Autowired
|
||||
private IUseApplyItemService useApplyItemService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询使用申请列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:apply:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UseApply useApply)
|
||||
{
|
||||
startPage();
|
||||
List<UseApply> list = useApplyService.selectUseApplyList(useApply);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工具信息详细信息
|
||||
*/
|
||||
@GetMapping(value = "/bpmc/{bpmcId}")
|
||||
public AjaxResult getInfoByBpmcId(@PathVariable("bpmcId") String bpmcId)
|
||||
{
|
||||
return success(useApplyService.getInfoByBpmcId(bpmcId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出使用申请列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:apply:export')")
|
||||
@Log(title = "使用申请", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, UseApply useApply)
|
||||
{
|
||||
List<UseApply> list = useApplyService.selectUseApplyList(useApply);
|
||||
ExcelUtil<UseApply> util = new ExcelUtil<UseApply>(UseApply.class);
|
||||
util.exportExcel(response, list, "使用申请数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取使用申请详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:apply:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(useApplyService.selectUseApplyById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增使用申请
|
||||
*/
|
||||
@Log(title = "使用申请", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody UseApply useApply)
|
||||
{
|
||||
boolean add = false;
|
||||
if (StringUtils.isEmpty(useApply.getId())) {
|
||||
useApply.setId(IdUtil.simpleUUID());
|
||||
add = true;
|
||||
}
|
||||
ProcessInstanceModel processInstanceModel = null;
|
||||
try {
|
||||
if(StringUtils.equals(useApply.getRecordStatus(), RecordStatusEnum.DRAFT.getCode())){
|
||||
processInstanceModel = workflowService.saveExecute(useApply.getBpmClientInputModel(), useApply.getId());
|
||||
}else if (StringUtils.equals(useApply.getRecordStatus(), RecordStatusEnum.CANCEL.getCode())){
|
||||
processInstanceModel = workflowService.cancelExecute(useApply.getBpmClientInputModel(), useApply.getId());
|
||||
}else{
|
||||
processInstanceModel = workflowService.nextExecute(useApply.getBpmClientInputModel(), useApply.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (processInstanceModel!=null&&StringUtils.isNotEmpty(processInstanceModel.getProcInstId())) {
|
||||
if (add) {
|
||||
useApply.setProcInstId(processInstanceModel.getProcInstId());
|
||||
useApplyService.insertUseApply(useApply);
|
||||
useApplyItemService.updateItemList(useApply.getItemList(),useApply.getId());
|
||||
}else if (BooleanUtil.isTrue(useApply.getEditStatus())){
|
||||
useApplyService.updateUseApply(useApply);
|
||||
useApplyItemService.updateItemList(useApply.getItemList(),useApply.getId());
|
||||
}else {
|
||||
UseApply updateStatus = new UseApply();
|
||||
updateStatus.setId(useApply.getId());
|
||||
updateStatus.setRecordStatus(useApply.getRecordStatus());
|
||||
useApplyService.updateUseApply(updateStatus);
|
||||
}
|
||||
//办结
|
||||
if(RecordStatusEnum.DONE.getCode().equals(useApply)){
|
||||
//给消息中心发送消息
|
||||
useApplyService.sendTzMessage(useApply);
|
||||
}
|
||||
return AjaxResult.success("操作成功",processInstanceModel);
|
||||
}else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改使用申请
|
||||
*/
|
||||
@Log(title = "使用申请", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody UseApply useApply)
|
||||
{
|
||||
return toAjax(useApplyService.updateUseApply(useApply));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除使用申请
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:apply:remove')")
|
||||
@Log(title = "使用申请", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(useApplyService.deleteUseApplyByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.rzdata.web.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.rzdata.common.annotation.Excel;
|
||||
import com.rzdata.common.core.domain.BaseEntity;
|
||||
import com.rzdata.web.domain.bo.BpmClientInputModelBo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -14,7 +16,7 @@ import java.util.List;
|
||||
* @date 2024-08-21
|
||||
*/
|
||||
@Data
|
||||
public class UseApply extends BaseEntity
|
||||
public class ToolApply extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -25,6 +27,15 @@ public class UseApply extends BaseEntity
|
||||
@Excel(name = "申请人id")
|
||||
private String userId;
|
||||
|
||||
@Excel(name = "工具ID")
|
||||
private String toolId;
|
||||
|
||||
@Excel(name = "流程标题")
|
||||
private String procTitle;
|
||||
|
||||
@Excel(name = "申请类型")
|
||||
private String applyType;
|
||||
|
||||
@Excel(name = "申请人名称")
|
||||
private String nickName;
|
||||
|
||||
@@ -39,6 +50,9 @@ public class UseApply extends BaseEntity
|
||||
@Excel(name = "申请理由")
|
||||
private String reason;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
|
||||
private BpmClientInputModelBo bpmClientInputModel;
|
||||
|
||||
private String recordStatus;
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.rzdata.web.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.rzdata.web.domain.UseApply;
|
||||
import com.rzdata.web.domain.Tool;
|
||||
import com.rzdata.web.domain.ToolApply;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 使用申请Mapper接口
|
||||
*
|
||||
* @author ja
|
||||
* @date 2024-08-21
|
||||
*/
|
||||
public interface UseApplyMapper
|
||||
public interface ToolApplyMapper
|
||||
{
|
||||
/**
|
||||
* 查询使用申请
|
||||
@@ -19,33 +19,33 @@ public interface UseApplyMapper
|
||||
* @param id 使用申请主键
|
||||
* @return 使用申请
|
||||
*/
|
||||
public UseApply selectUseApplyById(String id);
|
||||
public ToolApply selectToolApplyById(String id);
|
||||
|
||||
UseApply getInfoByBpmcId(String bpmcId);
|
||||
ToolApply getInfoByBpmcId(String bpmcId);
|
||||
|
||||
/**
|
||||
* 查询使用申请列表
|
||||
*
|
||||
* @param useApply 使用申请
|
||||
* @param toolApply 使用申请
|
||||
* @return 使用申请集合
|
||||
*/
|
||||
public List<UseApply> selectUseApplyList(UseApply useApply);
|
||||
public List<ToolApply> selectToolApplyList(ToolApply toolApply);
|
||||
|
||||
/**
|
||||
* 新增使用申请
|
||||
*
|
||||
* @param useApply 使用申请
|
||||
* @param toolApply 使用申请
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUseApply(UseApply useApply);
|
||||
public int insertToolApply(ToolApply toolApply);
|
||||
|
||||
/**
|
||||
* 修改使用申请
|
||||
*
|
||||
* @param useApply 使用申请
|
||||
* @param toolApply 使用申请
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUseApply(UseApply useApply);
|
||||
public int updateToolApply(ToolApply toolApply);
|
||||
|
||||
/**
|
||||
* 删除使用申请
|
||||
@@ -53,7 +53,7 @@ public interface UseApplyMapper
|
||||
* @param id 使用申请主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUseApplyById(String id);
|
||||
public int deleteToolApplyById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除使用申请
|
||||
@@ -61,7 +61,7 @@ public interface UseApplyMapper
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUseApplyByIds(String[] ids);
|
||||
public int deleteToolApplyByIds(String[] ids);
|
||||
|
||||
int checkUseApply(@Param("toolId") String toolId, @Param("userId") String userId);
|
||||
int checkToolApply(@Param("toolId") String toolId, @Param("userId") String userId);
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.rzdata.web.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.rzdata.web.domain.UseApply;
|
||||
import com.rzdata.web.domain.Tool;
|
||||
import com.rzdata.web.domain.ToolApply;
|
||||
|
||||
/**
|
||||
* 使用申请Service接口
|
||||
@@ -10,7 +9,7 @@ import com.rzdata.web.domain.Tool;
|
||||
* @author ja
|
||||
* @date 2024-08-21
|
||||
*/
|
||||
public interface IUseApplyService
|
||||
public interface IToolApplyService
|
||||
{
|
||||
/**
|
||||
* 查询使用申请
|
||||
@@ -18,33 +17,33 @@ public interface IUseApplyService
|
||||
* @param id 使用申请主键
|
||||
* @return 使用申请
|
||||
*/
|
||||
public UseApply selectUseApplyById(String id);
|
||||
public ToolApply selectToolApplyById(String id);
|
||||
|
||||
UseApply getInfoByBpmcId(String bpmcId);
|
||||
ToolApply getInfoByBpmcId(String bpmcId);
|
||||
|
||||
/**
|
||||
* 查询使用申请列表
|
||||
*
|
||||
* @param useApply 使用申请
|
||||
* @param toolApply 使用申请
|
||||
* @return 使用申请集合
|
||||
*/
|
||||
public List<UseApply> selectUseApplyList(UseApply useApply);
|
||||
public List<ToolApply> selectToolApplyList(ToolApply toolApply);
|
||||
|
||||
/**
|
||||
* 新增使用申请
|
||||
*
|
||||
* @param useApply 使用申请
|
||||
* @param toolApply 使用申请
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUseApply(UseApply useApply);
|
||||
public int insertToolApply(ToolApply toolApply);
|
||||
|
||||
/**
|
||||
* 修改使用申请
|
||||
*
|
||||
* @param useApply 使用申请
|
||||
* @param toolApply 使用申请
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUseApply(UseApply useApply);
|
||||
public int updateToolApply(ToolApply toolApply);
|
||||
|
||||
/**
|
||||
* 批量删除使用申请
|
||||
@@ -52,7 +51,7 @@ public interface IUseApplyService
|
||||
* @param ids 需要删除的使用申请主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUseApplyByIds(String[] ids);
|
||||
public int deleteToolApplyByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除使用申请信息
|
||||
@@ -60,9 +59,9 @@ public interface IUseApplyService
|
||||
* @param id 使用申请主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUseApplyById(String id);
|
||||
public int deleteToolApplyById(String id);
|
||||
|
||||
boolean checkUseApply(String toolId, String userId);
|
||||
boolean checkToolApply(String toolId, String userId);
|
||||
|
||||
void sendTzMessage(UseApply useApply);
|
||||
void sendTzMessage(ToolApply toolApply);
|
||||
}
|
||||
@@ -77,6 +77,8 @@ public interface IToolService
|
||||
*/
|
||||
public void addDocAndAtt(Tool tool);
|
||||
|
||||
void recordToolApply(Tool tool);
|
||||
|
||||
void updateDocPushStatus(Tool tTool);
|
||||
|
||||
void sendTzMessage(Tool tTool);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.rzdata.web.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
@@ -10,10 +8,12 @@ import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.blueland.bpmclient.BpmClient;
|
||||
import com.blueland.bpmclient.model.*;
|
||||
import com.rzdata.common.core.domain.entity.SysUser;
|
||||
import com.rzdata.common.utils.SecurityUtils;
|
||||
import com.rzdata.common.utils.StringUtils;
|
||||
import com.rzdata.system.service.ISysConfigService;
|
||||
import com.rzdata.system.service.ISysDeptService;
|
||||
import com.rzdata.system.service.ISysUserService;
|
||||
import com.rzdata.web.core.config.BpmcConfig;
|
||||
import com.rzdata.web.domain.WorkFlowInfo;
|
||||
import com.rzdata.web.domain.bo.BpmClientInputModelBo;
|
||||
@@ -23,9 +23,10 @@ import org.apache.commons.compress.utils.Lists;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.rmi.ServerException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service("workflowService")
|
||||
@@ -48,6 +49,9 @@ public class WorkflowService {
|
||||
@Autowired
|
||||
ISysDeptService sysDeptService;
|
||||
|
||||
@Autowired
|
||||
ISysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
IWorkflowLogService iWorkflowLogService;
|
||||
private final static String CUR_ACT_DEF_KEY = "curActDef";
|
||||
@@ -359,6 +363,16 @@ public class WorkflowService {
|
||||
pageVo.setPageNumber(pageResultModel.getThisPageNumber());
|
||||
pageVo.setTotalCount(pageResultModel.getTotalCount());
|
||||
List<WorkFlowInfo> workFlowInfos = JSONUtil.toList(JSONUtil.toJsonStr(pageResultModel.getResult()), WorkFlowInfo.class);
|
||||
for(WorkFlowInfo workFlowInfo : workFlowInfos){
|
||||
SysUser startSysUser = sysUserService.selectUserByUserName(workFlowInfo.getStartUserId());
|
||||
if(null != startSysUser){
|
||||
workFlowInfo.setStartUserName(startSysUser.getUserName());
|
||||
}
|
||||
SysUser sendSysUser = sysUserService.selectUserByUserName(workFlowInfo.getSendUserId());
|
||||
if(null != sendSysUser){
|
||||
workFlowInfo.setSendUserName(sendSysUser.getUserName());
|
||||
}
|
||||
}
|
||||
pageVo.setResult(workFlowInfos);
|
||||
return pageVo;
|
||||
} catch (Exception ex) {
|
||||
|
||||
@@ -8,8 +8,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.rzdata.common.constant.Constants;
|
||||
import com.rzdata.common.core.domain.entity.SysDictData;
|
||||
import com.rzdata.common.core.domain.entity.SysUser;
|
||||
import com.rzdata.common.core.domain.model.LoginUser;
|
||||
import com.rzdata.common.enums.RecordStatusEnum;
|
||||
import com.rzdata.common.utils.DateUtils;
|
||||
import com.rzdata.common.utils.SecurityUtils;
|
||||
import com.rzdata.system.service.ISysDictTypeService;
|
||||
@@ -18,7 +16,7 @@ import com.rzdata.web.domain.Document;
|
||||
import com.rzdata.web.domain.Tool;
|
||||
import com.rzdata.web.mapper.DocumentMapper;
|
||||
import com.rzdata.web.service.IDocumentService;
|
||||
import com.rzdata.web.service.IUseApplyService;
|
||||
import com.rzdata.web.service.IToolApplyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -43,7 +41,7 @@ public class DocumentServiceImpl implements IDocumentService
|
||||
private ToolServiceImpl toolService;
|
||||
|
||||
@Autowired
|
||||
private IUseApplyService iUseApplyService;
|
||||
private IToolApplyService iUseApplyService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictTypeService sysDictTypeService;
|
||||
@@ -115,7 +113,7 @@ public class DocumentServiceImpl implements IDocumentService
|
||||
boolean downStatus = false;
|
||||
if(SecurityUtils.hasPermi(Constants.DOC_DOWNLOAD_PERMISSION) || userId.equals(dc.getCreateById()) || SysUser.isAdmin(SecurityUtils.getUserId())){
|
||||
downStatus = true;
|
||||
}else if(StrUtil.isNotBlank(dc.getToolId()) && iUseApplyService.checkUseApply(dc.getToolId(),userId)){
|
||||
}else if(StrUtil.isNotBlank(dc.getToolId()) && iUseApplyService.checkToolApply(dc.getToolId(),userId)){
|
||||
downStatus = true;
|
||||
}
|
||||
dc.setDownloadStatus(downStatus);
|
||||
|
||||
@@ -5,20 +5,17 @@ import com.rzdata.common.core.domain.entity.SysUser;
|
||||
import com.rzdata.common.utils.DateUtils;
|
||||
import com.rzdata.common.utils.SecurityUtils;
|
||||
import com.rzdata.system.service.ISysUserService;
|
||||
import com.rzdata.web.domain.ToolApply;
|
||||
import com.rzdata.web.domain.TzMessage;
|
||||
import com.rzdata.web.domain.UseApply;
|
||||
import com.rzdata.web.domain.UseApplyItem;
|
||||
import com.rzdata.web.mapper.UseApplyMapper;
|
||||
import com.rzdata.web.mapper.ToolApplyMapper;
|
||||
import com.rzdata.web.service.IToolApplyService;
|
||||
import com.rzdata.web.service.ITzMessageService;
|
||||
import com.rzdata.web.service.IUseApplyService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 使用申请Service业务层处理
|
||||
@@ -28,10 +25,10 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class UseApplyServiceImpl implements IUseApplyService
|
||||
public class ToolApplyServiceImpl implements IToolApplyService
|
||||
{
|
||||
@Autowired
|
||||
private UseApplyMapper useApplyMapper;
|
||||
private ToolApplyMapper toolApplyMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
@@ -52,53 +49,53 @@ public class UseApplyServiceImpl implements IUseApplyService
|
||||
* @return 使用申请
|
||||
*/
|
||||
@Override
|
||||
public UseApply selectUseApplyById(String id)
|
||||
public ToolApply selectToolApplyById(String id)
|
||||
{
|
||||
return useApplyMapper.selectUseApplyById(id);
|
||||
return toolApplyMapper.selectToolApplyById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UseApply getInfoByBpmcId(String bpmcId){
|
||||
return useApplyMapper.getInfoByBpmcId(bpmcId);
|
||||
public ToolApply getInfoByBpmcId(String bpmcId){
|
||||
return toolApplyMapper.getInfoByBpmcId(bpmcId);
|
||||
}
|
||||
/**
|
||||
* 查询使用申请列表
|
||||
*
|
||||
* @param useApply 使用申请
|
||||
* @param toolApply 使用申请
|
||||
* @return 使用申请
|
||||
*/
|
||||
@Override
|
||||
public List<UseApply> selectUseApplyList(UseApply useApply)
|
||||
public List<ToolApply> selectToolApplyList(ToolApply toolApply)
|
||||
{
|
||||
return useApplyMapper.selectUseApplyList(useApply);
|
||||
return toolApplyMapper.selectToolApplyList(toolApply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增使用申请
|
||||
*
|
||||
* @param useApply 使用申请
|
||||
* @param toolApply 使用申请
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertUseApply(UseApply useApply)
|
||||
public int insertToolApply(ToolApply toolApply)
|
||||
{
|
||||
useApply.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
useApply.setCreateTime(DateUtils.getNowDate());
|
||||
return useApplyMapper.insertUseApply(useApply);
|
||||
toolApply.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
toolApply.setCreateTime(DateUtils.getNowDate());
|
||||
return toolApplyMapper.insertToolApply(toolApply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改使用申请
|
||||
*
|
||||
* @param useApply 使用申请
|
||||
* @param toolApply 使用申请
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUseApply(UseApply useApply)
|
||||
public int updateToolApply(ToolApply toolApply)
|
||||
{
|
||||
useApply.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
useApply.setUpdateTime(DateUtils.getNowDate());
|
||||
return useApplyMapper.updateUseApply(useApply);
|
||||
toolApply.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
toolApply.setUpdateTime(DateUtils.getNowDate());
|
||||
return toolApplyMapper.updateToolApply(toolApply);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,9 +105,9 @@ public class UseApplyServiceImpl implements IUseApplyService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUseApplyByIds(String[] ids)
|
||||
public int deleteToolApplyByIds(String[] ids)
|
||||
{
|
||||
return useApplyMapper.deleteUseApplyByIds(ids);
|
||||
return toolApplyMapper.deleteToolApplyByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,21 +117,21 @@ public class UseApplyServiceImpl implements IUseApplyService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUseApplyById(String id)
|
||||
public int deleteToolApplyById(String id)
|
||||
{
|
||||
return useApplyMapper.deleteUseApplyById(id);
|
||||
return toolApplyMapper.deleteToolApplyById(id);
|
||||
}
|
||||
|
||||
public boolean checkUseApply(String toolId, String userId){
|
||||
return useApplyMapper.checkUseApply(toolId, userId)>0;
|
||||
public boolean checkToolApply(String toolId, String userId){
|
||||
return toolApplyMapper.checkToolApply(toolId, userId)>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendTzMessage(UseApply useApply) {
|
||||
public void sendTzMessage(ToolApply toolApply) {
|
||||
try{
|
||||
SysUser sysUser = sysUserService.selectUserById(Long.valueOf(useApply.getUserId()));
|
||||
SysUser sysUser = sysUserService.selectUserById(Long.valueOf(toolApply.getUserId()));
|
||||
|
||||
UseApplyItem useApplyItem = useApply.getItemList().get(0);
|
||||
UseApplyItem useApplyItem = toolApply.getItemList().get(0);
|
||||
String toolName = useApplyItem.getToolName();
|
||||
|
||||
String content = toolName + "下载权限已通过";
|
||||
@@ -4,24 +4,25 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.blueland.bpmclient.model.BpmClientInputModel;
|
||||
import com.rzdata.common.annotation.DataScope;
|
||||
import com.rzdata.common.constant.Constants;
|
||||
import com.rzdata.common.core.domain.entity.SysDept;
|
||||
import com.rzdata.common.core.domain.entity.SysDictData;
|
||||
import com.rzdata.common.core.domain.entity.SysUser;
|
||||
import com.rzdata.common.utils.DateUtils;
|
||||
import com.rzdata.common.utils.SecurityUtils;
|
||||
import com.rzdata.system.service.ISysDictDataService;
|
||||
import com.rzdata.system.service.ISysDeptService;
|
||||
import com.rzdata.system.service.ISysDictTypeService;
|
||||
import com.rzdata.system.service.ISysUserService;
|
||||
import com.rzdata.web.domain.Document;
|
||||
import com.rzdata.web.domain.Tool;
|
||||
import com.rzdata.web.domain.ToolApply;
|
||||
import com.rzdata.web.domain.TzMessage;
|
||||
import com.rzdata.web.domain.UseApplyItem;
|
||||
import com.rzdata.web.domain.bo.BpmClientInputModelBo;
|
||||
import com.rzdata.web.mapper.ToolMapper;
|
||||
import com.rzdata.web.service.IAttachmentService;
|
||||
import com.rzdata.web.service.IDocumentService;
|
||||
import com.rzdata.web.service.IToolService;
|
||||
import com.rzdata.web.service.ITzMessageService;
|
||||
import com.rzdata.web.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -68,6 +69,12 @@ public class ToolServiceImpl implements IToolService
|
||||
private ISysDictTypeService sysDictTypeService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IToolApplyService toolApplyService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService sysDeptService;
|
||||
|
||||
/**
|
||||
* 查询工具信息
|
||||
*
|
||||
@@ -167,6 +174,34 @@ public class ToolServiceImpl implements IToolService
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void recordToolApply(Tool tool) {
|
||||
ToolApply toolApply = new ToolApply();
|
||||
toolApply.setId(IdUtil.simpleUUID());
|
||||
toolApply.setApplyType(Constants.TOOL_APPLY_TYPE_PUBLISH);
|
||||
toolApply.setToolId(tool.getToolId());
|
||||
toolApply.setDeptId(String.valueOf(SecurityUtils.getDeptId()));
|
||||
toolApply.setProcInstId(tool.getProcInstId());
|
||||
toolApply.setRecordStatus(tool.getRecordStatus());
|
||||
toolApply.setUserId(String.valueOf(SecurityUtils.getUserId()));
|
||||
|
||||
BpmClientInputModelBo bpmClientInputModelBo = tool.getBpmClientInputModel();
|
||||
if(null != bpmClientInputModelBo){
|
||||
BpmClientInputModel bpmClientInputModel = bpmClientInputModelBo.getModel();
|
||||
toolApply.setProcTitle(StrUtil.isNotEmpty(bpmClientInputModel.getWf_procTitle()) ? bpmClientInputModel.getWf_procTitle() : "");
|
||||
}
|
||||
SysDept sysDept = sysDeptService.selectDeptById(SecurityUtils.getDeptId());
|
||||
if(null != sysDept){
|
||||
toolApply.setDeptName(sysDept.getDeptName());
|
||||
}
|
||||
SysUser sysUser = sysUserService.selectUserById(SecurityUtils.getUserId());
|
||||
if(null != sysUser){
|
||||
toolApply.setNickName(sysUser.getNickName());
|
||||
}
|
||||
toolApplyService.insertToolApply(toolApply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除工具信息
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user