工具发布流程和使用申请流程细节优化
This commit is contained in:
parent
0e18f96534
commit
a230a1c2d8
@ -4,24 +4,26 @@ import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
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.BizExceptionCodeEnum;
|
||||
import com.rzdata.common.enums.BusinessType;
|
||||
import com.rzdata.common.enums.RecordStatusEnum;
|
||||
import com.rzdata.common.exception.RestException;
|
||||
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.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;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -40,6 +42,12 @@ public class ToolController extends BaseController
|
||||
@Autowired
|
||||
private WorkflowService workflowService;
|
||||
|
||||
@Autowired
|
||||
private IUseApplyService iUseApplyService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService iSysDeptService;
|
||||
|
||||
/**
|
||||
* 查询工具信息列表
|
||||
*/
|
||||
@ -48,6 +56,17 @@ public class ToolController extends BaseController
|
||||
{
|
||||
startPage();
|
||||
List<Tool> list = toolService.selectToolList(tool);
|
||||
//前端传传参开启下载权限验证
|
||||
if (BooleanUtil.isTrue(tool.getDownloadCheck())) {
|
||||
String userId = SecurityUtils.getUserId().toString();
|
||||
for (Tool vo:list) {
|
||||
//已发布的工具 是创建人 或者 配置了下载权限 或者 通过了使用申请的
|
||||
vo.setDownloadStatus(RecordStatusEnum.DONE.getCode().equals(vo.getRecordStatus())&&
|
||||
(userId.equals(vo.getCreateBy())||
|
||||
SecurityUtils.hasPermi(Constants.DOWNLOAD_TOOL_PERMISSION)||
|
||||
iUseApplyService.checkUseApply(vo.getToolId(),userId)));
|
||||
}
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -60,7 +79,7 @@ public class ToolController extends BaseController
|
||||
{
|
||||
List<Tool> list = toolService.selectToolList(tTool);
|
||||
ExcelUtil<Tool> util = new ExcelUtil<Tool>(Tool.class);
|
||||
util.exportExcel(response, list, "工具信息数据");
|
||||
util.exportExcel(response, list, "工具信息数据",tTool.getExcludeFields());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,7 +97,9 @@ public class ToolController extends BaseController
|
||||
@GetMapping(value = "/bpmc/{bpmcId}")
|
||||
public AjaxResult getInfoByBpmcId(@PathVariable("bpmcId") String bpmcId)
|
||||
{
|
||||
return success(toolService.getInfoByBpmcId(bpmcId));
|
||||
Tool tool= toolService.getInfoByBpmcId(bpmcId);
|
||||
tool.setToolRespDeptName(iSysDeptService.getDeptName(tool.getToolRespDept()));
|
||||
return success(tool);
|
||||
}
|
||||
|
||||
@ApiOperation("判断文件名称是否存在 true 存在 false 不存在")
|
||||
|
@ -129,8 +129,8 @@ public class UseApplyController extends BaseController
|
||||
useApplyItemService.updateItemList(useApply.getItemList(),useApply.getId());
|
||||
}else {
|
||||
UseApply updateStatus = new UseApply();
|
||||
useApply.setId(useApply.getId());
|
||||
useApply.setRecordStatus(useApply.getRecordStatus());
|
||||
updateStatus.setId(useApply.getId());
|
||||
updateStatus.setRecordStatus(useApply.getRecordStatus());
|
||||
useApplyService.updateUseApply(updateStatus);
|
||||
}
|
||||
return AjaxResult.success("操作成功",processInstanceModel);
|
||||
|
@ -9,6 +9,8 @@ import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工具信息对象 t_tool
|
||||
*
|
||||
@ -24,70 +26,64 @@ public class Tool extends BaseEntity
|
||||
private String toolId;
|
||||
|
||||
/** 工具编号 */
|
||||
@Excel(name = "工具编号")
|
||||
private String toolCode;
|
||||
|
||||
/** 工具名称 */
|
||||
@Excel(name = "工具名称")
|
||||
@Excel(name = "工具名称",sort=1)
|
||||
private String toolName;
|
||||
|
||||
/** 工具类别 */
|
||||
@Excel(name = "工具类别")
|
||||
@Excel(name = "工具类别",dictType="tool_type",sort=2)
|
||||
private String toolType;
|
||||
|
||||
/** 来源 */
|
||||
@Excel(name = "来源")
|
||||
@Excel(name = "工具来源",sort=3)
|
||||
private String toolSource;
|
||||
|
||||
/** 用途 */
|
||||
@Excel(name = "用途")
|
||||
@Excel(name = "工具用途",sort=7)
|
||||
private String toolUse;
|
||||
|
||||
/** 测试情况 */
|
||||
@Excel(name = "测试情况")
|
||||
@Excel(name = "测评情况",sort=8)
|
||||
private String testSituation;
|
||||
|
||||
/** 功能描述 */
|
||||
@Excel(name = "功能描述")
|
||||
@Excel(name = "功能描述",sort=9)
|
||||
private String functionDesc;
|
||||
|
||||
/** 适用条件 */
|
||||
@Excel(name = "适用条件")
|
||||
@Excel(name = "适用条件",sort=10)
|
||||
private String applyCondition;
|
||||
|
||||
/** 操作说明 */
|
||||
@Excel(name = "操作说明")
|
||||
@Excel(name = "操作说明",sort=11)
|
||||
private String operateExplain;
|
||||
|
||||
/** 负责人 */
|
||||
@Excel(name = "负责人")
|
||||
private String toolPrincipals;
|
||||
|
||||
/** 负责人名称 */
|
||||
@Excel(name = "负责人")
|
||||
@Excel(name = "负责人",sort=4)
|
||||
private String toolPrincipalsName;
|
||||
|
||||
/** 归属单位 */
|
||||
@Excel(name = "归属单位")
|
||||
private String toolRespDept;
|
||||
|
||||
@Excel(name = "归属单位",sort=5)
|
||||
private String toolRespDeptName;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
@Excel(name = "状态",dictType="sys_normal_disable",sort=6)
|
||||
private String status;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注",sort=12)
|
||||
private String remark;
|
||||
|
||||
/** 发布时间 */
|
||||
private String releaseTime;
|
||||
|
||||
/** 部门对象 */
|
||||
@Excels({
|
||||
@Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT),
|
||||
@Excel(name = "部门负责人", targetAttr = "leader", type = Excel.Type.EXPORT)
|
||||
})
|
||||
private SysDept dept;
|
||||
|
||||
private BpmClientInputModelBo bpmClientInputModel;
|
||||
|
||||
private String recordStatus;
|
||||
@ -95,4 +91,14 @@ public class Tool extends BaseEntity
|
||||
private Boolean editStatus;
|
||||
|
||||
private String procInstId;
|
||||
|
||||
private Boolean permissionCheck;
|
||||
|
||||
private Boolean permission;
|
||||
|
||||
private Boolean downloadCheck;
|
||||
|
||||
private Boolean downloadStatus;
|
||||
|
||||
private List<String> excludeFields;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.rzdata.web.mapper;
|
||||
import java.util.List;
|
||||
import com.rzdata.web.domain.UseApply;
|
||||
import com.rzdata.web.domain.Tool;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 使用申请Mapper接口
|
||||
@ -61,4 +62,6 @@ public interface UseApplyMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUseApplyByIds(String[] ids);
|
||||
|
||||
int checkUseApply(@Param("toolId") String toolId, @Param("userId") String userId);
|
||||
}
|
||||
|
@ -61,4 +61,6 @@ public interface IUseApplyService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUseApplyById(String id);
|
||||
|
||||
boolean checkUseApply(String toolId, String userId);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.rzdata.web.service.impl;
|
||||
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.rzdata.common.constant.Constants;
|
||||
import com.rzdata.common.utils.DateUtils;
|
||||
import com.rzdata.common.utils.SecurityUtils;
|
||||
import com.rzdata.web.domain.Tool;
|
||||
@ -49,6 +51,9 @@ public class ToolServiceImpl implements IToolService
|
||||
@Override
|
||||
public List<Tool> selectToolList(Tool tool)
|
||||
{
|
||||
if (BooleanUtil.isTrue(tool.getPermissionCheck())) {
|
||||
tool.setPermission(SecurityUtils.hasPermi(Constants.VIEW_TOOL_PERMISSION));
|
||||
}
|
||||
return toolMapper.selectToolList(tool);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import com.rzdata.common.utils.DateUtils;
|
||||
import com.rzdata.common.utils.SecurityUtils;
|
||||
import com.rzdata.web.domain.Tool;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.rzdata.web.mapper.UseApplyMapper;
|
||||
@ -101,4 +102,8 @@ public class UseApplyServiceImpl implements IUseApplyService
|
||||
{
|
||||
return useApplyMapper.deleteUseApplyById(id);
|
||||
}
|
||||
|
||||
public boolean checkUseApply(String toolId, String userId){
|
||||
return useApplyMapper.checkUseApply(toolId, userId)>0;
|
||||
}
|
||||
}
|
||||
|
@ -130,5 +130,5 @@ xss:
|
||||
|
||||
bpmc:
|
||||
tenantId: TLTC_SYS
|
||||
serviceUrl: http://192.168.2.20:8081/ebpm-process-rest/
|
||||
serviceUrl: http://192.168.2.18:8081/ebpm-process-rest/
|
||||
uniteWorkUrl: http://localhost/tool-tech/workflowRouter
|
||||
|
@ -18,6 +18,7 @@
|
||||
<result property="toolPrincipals" column="tool_principals" />
|
||||
<result property="toolPrincipalsName" column="tool_principals_name" />
|
||||
<result property="toolRespDept" column="tool_resp_dept" />
|
||||
<result property="toolRespDeptName" column="tool_resp_dept_name" />
|
||||
<result property="status" column="status" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
@ -26,7 +27,6 @@
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="procInstId" column="proc_inst_id" />
|
||||
<result property="recordStatus" column="record_status" />
|
||||
<association property="dept" javaType="SysDept" resultMap="deptResult" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="deptResult" type="SysDept">
|
||||
@ -142,7 +142,7 @@
|
||||
|
||||
<select id="selectToolList" parameterType="Tool" resultMap="ToolResult">
|
||||
select u.tool_id, u.tool_code, u.tool_name, u.tool_type, u.tool_source, u.tool_use, u.test_situation, u.function_desc, u.apply_condition, u.operate_explain,u.record_status,u.proc_inst_id,
|
||||
u.tool_principals, u.tool_principals_name, u.tool_resp_dept, u.status, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from t_tool u
|
||||
u.tool_principals, u.tool_principals_name, u.tool_resp_dept, u.status, u.create_by, u.create_time, u.remark, d.dept_name as tool_resp_dept_name from t_tool u
|
||||
left join sys_dept d on u.tool_resp_dept = d.dept_id
|
||||
where 1=1
|
||||
and u.record_status != 'cancel'
|
||||
@ -167,7 +167,7 @@
|
||||
<if test="toolRespDept != null and toolRespDept != ''">
|
||||
AND u.tool_resp_dept = #{toolRespDept}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
<if test="createBy != null and createBy != '' and permission != true">
|
||||
AND (u.create_by = #{createBy} or u.record_status = 'done')
|
||||
</if>
|
||||
order by create_time desc
|
||||
|
@ -101,4 +101,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="checkUseApply" resultType="int">
|
||||
SELECT count(*) FROM `t_use_apply_item` uai
|
||||
left join `t_use_apply` ua on uai.apply_id = ua.id
|
||||
WHERE ua.record_status = 'done'
|
||||
and uai.tool_id = #{toolId}
|
||||
and ua.user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -170,4 +170,16 @@ public class Constants
|
||||
*/
|
||||
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
||||
"org.springframework", "org.apache", "com.rzdata.common.utils.file", "com.rzdata.common.config", "com.rzdata.generator" };
|
||||
|
||||
/**
|
||||
* 查看审批中的工具权限
|
||||
*/
|
||||
public static final String VIEW_TOOL_PERMISSION = "view:doing:tool";
|
||||
|
||||
/**
|
||||
* 查看审批中的工具权限
|
||||
*/
|
||||
public static final String DOWNLOAD_TOOL_PERMISSION = "download:done:tool";
|
||||
|
||||
|
||||
}
|
||||
|
@ -210,9 +210,11 @@ public class ExcelUtil<T>
|
||||
* @param fields 列属性名 示例[单个"name"/多个"id","name"]
|
||||
* @throws Exception
|
||||
*/
|
||||
public void hideColumn(String... fields)
|
||||
public void hideColumn(List<String> fields)
|
||||
{
|
||||
this.excludeFields = fields;
|
||||
if (fields!=null) {
|
||||
this.excludeFields = fields.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public void init(List<T> list, String sheetName, String title, Type type)
|
||||
@ -543,6 +545,20 @@ public class ExcelUtil<T>
|
||||
exportExcel(response, list, sheetName, StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对list数据源将其里面的数据导入到excel表单
|
||||
*
|
||||
* @param response 返回数据
|
||||
* @param list 导出数据集合
|
||||
* @param sheetName 工作表的名称
|
||||
* @return 结果
|
||||
*/
|
||||
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName,List<String> excludeFields)
|
||||
{
|
||||
hideColumn(excludeFields);
|
||||
exportExcel(response, list, sheetName, StringUtils.EMPTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对list数据源将其里面的数据导入到excel表单
|
||||
*
|
||||
|
@ -115,4 +115,6 @@ public interface SysDeptMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptById(Long deptId);
|
||||
|
||||
String getDeptNameByDeptId(String deptId);
|
||||
}
|
||||
|
@ -121,4 +121,6 @@ public interface ISysDeptService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeptById(Long deptId);
|
||||
|
||||
String getDeptName(String deptId);
|
||||
}
|
||||
|
@ -335,4 +335,9 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
{
|
||||
return getChildList(list, t).size() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDeptName(String deptId){
|
||||
return deptMapper.getDeptNameByDeptId(deptId);
|
||||
}
|
||||
}
|
||||
|
@ -156,4 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update sys_dept set del_flag = '2' where dept_id = #{deptId}
|
||||
</delete>
|
||||
|
||||
<select id="getDeptNameByDeptId" resultType="string" >
|
||||
select dept_name from sys_dept where dept_id = #{deptId}
|
||||
</select>
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user