[修改] 标签回显

This commit is contained in:
bupengxiang
2023-05-09 14:15:40 +08:00
parent 8df19abcef
commit a06a6e93f1
28 changed files with 180 additions and 45 deletions
@@ -18,6 +18,7 @@ import com.adc.da.report.vo.ReportVo;
import com.adc.da.util.http.ResponseMessage;
import com.adc.da.util.http.Result;
import com.adc.da.util.utils.FileUtil;
import com.adc.da.util.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
@@ -469,13 +470,15 @@ public class ReportManageConroller {
} catch (Exception ex) {
log.info(ex.getMessage(),ex);
}
ReportLogBook reportLog = new ReportLogBook();
reportLog.setId(UUID.randomUUID().toString().replaceAll("-",""));
reportLog.setReportId(repostId);
reportLog.setType(2);
reportLog.setUpdateTime(new Date());
reportLog.setUserId(UserUtils.getUserId());
reportLogBookDao.insert(reportLog);
if (StringUtils.isNotEmpty(repostId)){
ReportLogBook reportLog = new ReportLogBook();
reportLog.setId(UUID.randomUUID().toString().replaceAll("-",""));
reportLog.setReportId(repostId);
reportLog.setType(2);
reportLog.setUpdateTime(new Date());
reportLog.setUserId(UserUtils.getUserId());
reportLogBookDao.insert(reportLog);
}
}
@@ -3,6 +3,8 @@ package com.adc.da.report.dao.mysql;
import com.adc.da.report.eo.TreeLabelEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* @author ThinkBook
* @description 针对表【ts_tree_label】的数据库操作Mapper
@@ -17,6 +19,8 @@ public interface TreeLabelDao extends BaseMapper<TreeLabelEntity> {
* @return
*/
double getMaxNum(String parentId);
List<String> selectIdByReport(String reportId);
}
@@ -125,6 +125,4 @@ public class TtReportManageAct {
@TableField(exist = false)
private List<String> labelList;
@TableField(exist = false)
private List<LabelEntity> labelEOList;
}
@@ -93,4 +93,5 @@ public class TtReportManageActPageVO extends BasePageVO {
private Integer delFlag;
private List<PowerApplyActPageVO> powerList;
}
@@ -19,10 +19,10 @@
<insert id="saveReportAct">
insert into TT_REPORT_MANAGE (<include refid="BaseColumnList"/>)
value (
#{Vo.dataId},#{Vo.name},#{Vo.keycontent},#{Vo.maincontent},#{Vo.department},#{Vo.year},#{Vo.fileId},
#{Vo.dataId},#{Vo.name},#{Vo.keyContent},#{Vo.mainContent},#{Vo.department},#{Vo.year},#{Vo.fileId},
#{Vo.confidentialLevel},#{Vo.privacyLevel},
#{Vo.createUserId},
#{Vo.createDate},#{Vo.updateDate},#{Vo.del_flag},
#{Vo.createDate},#{Vo.updateDate},#{Vo.delFlag},
#{Vo.secrecyLast})
</insert>
@@ -18,4 +18,9 @@
from ts_tree_label t
where t.parent_id = #{parentId}
</select>
<select id="selectIdByReport" resultType="java.lang.String">
select lab.id from ts_tree_label lab
LEFT JOIN ts_report_label rl on lab.id = rl.label_id
where rl.report_id = #{reportId}
</select>
</mapper>
@@ -22,10 +22,6 @@
<result column="del_flag" property="delFlag" />
<result column="secrecy_last" property="secrecyLast" />
<result column="file_name" property="fileName" />
<collection property="labelEOList" ofType="com.adc.da.report.eo.LabelEntity">
<id column="lableId" property="id"/>
<result column="lableName" property="name"/>
</collection>
</resultMap>
<!--表名信息-->
@@ -129,10 +125,7 @@
a.id,
task_id, prc_id, data_id, name, keycontent, maincontent, department, year, fileId, confidentialLevel, privacyLevel, createUserId, createDate, updateDate, del_flag
,secrecy_last,file_name
,label.label as lableName,label.id as labelId
FROM <include refid="TableName"/> a
LEFT JOIN ts_report_label rl on rl.report_id = a.data_id
LEFT JOIN ts_tree_label label on rl.label_id = label.id
<where>
data_id = #{dataId}
</where>
@@ -142,10 +135,7 @@
a.id,
task_id, prc_id, data_id, name, keycontent, maincontent, department, year, fileId, confidentialLevel, privacyLevel, createUserId, createDate, updateDate, del_flag
,secrecy_last,file_name
,label.label as lableName,label.id as labelId
FROM <include refid="TableName"/> a
LEFT JOIN ts_report_label rl on rl.report_id = a.data_id
LEFT JOIN ts_tree_label label on rl.label_id = label.id
<where>
prc_id = #{prcId}
</where>
@@ -19,10 +19,10 @@
<insert id="saveReportAct">
insert into TT_REPORT_MANAGE (<include refid="BaseColumnList"/>)
value (
#{Vo.dataId},#{Vo.name},#{Vo.keycontent},#{Vo.maincontent},#{Vo.department},#{Vo.year},#{Vo.fileId},
#{Vo.dataId},#{Vo.name},#{Vo.keyContent},#{Vo.mainContent},#{Vo.department},#{Vo.year},#{Vo.fileId},
#{Vo.confidentialLevel},#{Vo.privacyLevel},
#{Vo.createUserId},
#{Vo.createDate},#{Vo.updateDate},#{Vo.del_flag},
#{Vo.createDate},#{Vo.updateDate},#{Vo.delFlag},
#{Vo.secrecyLast})
</insert>
@@ -229,4 +229,22 @@
</select>
<select id="reportDetail" resultType="com.adc.da.report.vo.ReportDetailVo">
SELECT
rm.id AS id,
rm.name AS `name`,
rm.createUserId AS createUserId,
u.USNAME AS uploaderName,
rm.keycontent AS keycontent,
rm.maincontent AS maincontent,
rm.department AS departmentName,
rm.`year` AS `year`,
rm.fileId AS fileId,
rm.confidentialLevel AS confidentialLevel,
rm.privacyLevel AS privacyLevel
FROM `tt_report_manage` AS rm
INNER JOIN ts_user AS u ON u.USID = rm.createUserId
WHERE rm.id = #{reportId}
AND rm.del_flag = 0
</select>
</mapper>
@@ -18,4 +18,9 @@
from ts_tree_label t
where t.parent_id = #{parentId}
</select>
<select id="selectIdByReport" resultType="java.lang.String">
select lab.id from ts_tree_label lab
LEFT JOIN ts_report_label rl on lab.id = rl.label_id
where rl.report_id = #{reportId}
</select>
</mapper>
@@ -22,10 +22,6 @@
<result column="del_flag" property="delFlag" />
<result column="secrecy_last" property="secrecyLast" />
<result column="file_name" property="fileName" />
<collection property="labelEOList" ofType="com.adc.da.report.eo.LabelEntity">
<id column="lableId" property="id"/>
<result column="lableName" property="name"/>
</collection>
</resultMap>
<!--表名信息-->
@@ -129,10 +125,7 @@
a.id,
task_id, prc_id, data_id, name, keycontent, maincontent, department, year, fileId, confidentialLevel, privacyLevel, createUserId, createDate, updateDate, del_flag
,secrecy_last,file_name
,label.label as lableName,label.id as labelId
FROM <include refid="TableName"/> a
LEFT JOIN ts_report_label rl on rl.report_id = a.data_id
LEFT JOIN ts_tree_label label on rl.label_id = label.id
<where>
data_id = #{dataId}
</where>
@@ -142,10 +135,7 @@
a.id,
task_id, prc_id, data_id, name, keycontent, maincontent, department, year, fileId, confidentialLevel, privacyLevel, createUserId, createDate, updateDate, del_flag
,secrecy_last,file_name
,label.label as lableName,label.id as labelId
FROM <include refid="TableName"/> a
LEFT JOIN ts_report_label rl on rl.report_id = a.data_id
LEFT JOIN ts_tree_label label on rl.label_id = label.id
<where>
prc_id = #{prcId}
</where>
@@ -8,6 +8,7 @@ import com.adc.da.wkflow.business_activiti.service.ActivitDefineService;
import com.adc.da.wkflow.business_main.entity.BusProcessName;
import com.adc.da.wkflow.business_main.service.IBusProcessApproveService;
import com.adc.da.wkflow.business_main.service.IBusProcessNameService;
import com.adc.da.wkflow.dto.StartProcessEO;
import com.adc.da.wkflow.enums.SubmitStatusEnum;
import com.adc.da.wkflow.util.ImpulseSenderUtils;
import com.adc.da.wkflow.util.activiti.ActivitiTools;
@@ -143,13 +144,7 @@ public class ActivitDefineController {
Map<String, Object> prcNameAndPrcNum = createPrcNameAndPrcNum(prcType);
jsonObject.put("id",prcNameAndPrcNum.get("id"));
/**
* String id,
* String userId,
* String bpnId,
* String prcType,
* String msg
*/
String id = jsonObject.getString("id");
String userId = jsonObject.getString("loginUserId");
String bpnId = jsonObject.getString("bpnId");
@@ -225,7 +220,100 @@ public class ActivitDefineController {
log.info("启动流程实例,获取id-->{},实例名称-->{}", pi.getId(), pd.getName());
return WrapMapper.ok(task.getId());
}
@ApiOperation(value = "启动流程-以流程定义id")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "流程定义Id"),
@ApiImplicitParam(name = "userId", value = "流程发起人Id"),
@ApiImplicitParam(name = "bpnId", value = "流程表单ID"),
@ApiImplicitParam(name = "prcType", value = "流程类型"),
@ApiImplicitParam(name = "prcName", value = "流程名称"),
})
@PostMapping("/batchStartProcess")
public Wrapper<String> batchStartProcess(@RequestBody List<StartProcessEO> startProcessEOList) {
List<BusProcessName> busProcessNames = new ArrayList<>();
StringBuilder stringBuilder = new StringBuilder();
for (StartProcessEO startProcessEO : startProcessEOList) {
startProcessEO.setLoginUserId(UserUtils.getUserId());
if(com.adc.da.util.utils.StringUtils.isNotEmpty(startProcessEO.getId())){
startProcessEO.setBpnId(startProcessEO.getId());
}
String prcType = startProcessEO.getPrcType();
Map<String, Object> prcNameAndPrcNum = createPrcNameAndPrcNum(prcType);
startProcessEO.setId((String) prcNameAndPrcNum.get("id"));
String id = startProcessEO.getId();
String userId = startProcessEO.getUserId();
String bpnId = startProcessEO.getBpnId();
// 创建查询对象
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
// 使用流程定义的名称模糊查询
long total = processDefinitionQuery.count();
List<ProcessDefinition> list = processDefinitionQuery.orderByProcessDefinitionKey().asc().list();
List<Map<String, Object>> definitions = ActivitiTools.turnProcessDefinitions(list);
String pid = "";
for(Map<String, Object> map:definitions){
if(map.get("key").toString().equals(id)){
pid = map.get("id").toString();
}
}
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(pid).singleResult();
ProcessInstance pi = runtimeService.startProcessInstanceById(pid);
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
task.setAssignee(userId);
taskService.saveTask(task);
stringBuilder.append(","+task.getId());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if(StringUtils.isEmpty(bpnId)) {
BusProcessName busProcessName = new BusProcessName();
busProcessName.setPrcId(pi.getId());
busProcessName.setCreatTime(sdf.format(new Date()));
busProcessName.setCreatUser(userId);
UserEO byId = userEoService.getUserById(userId);
busProcessName.setCreatUserName(byId.getUsname());
busProcessName.setPrcNum((String) prcNameAndPrcNum.get("prcNum"));
busProcessName.setPrcType(prcType);
// String data = JSON.toJSONString(dataMsg, SerializerFeature.DisableCircularReferenceDetect);
// String dateId = activitDefineService.saveOrUpdateDate(prcType,data,task.getId(),pi.getId(),reportId);
// busProcessName.setDataId(dateId);
// busProcessName.setPrcName((String) prcNameAndPrcNum.get("prcName"));
busProcessName.setPrcName(startProcessEO.getPrcName());
busProcessName.setSubmitStatus(SubmitStatusEnum.SUBMIT.getValue());
busProcessNames.add(busProcessName);
}else{
// 删除重新增加的目的是为了留下历史的流程编号,方便发号器生成
QueryWrapper<BusProcessName> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("ID", bpnId);
BusProcessName one = ibusprocessnameService.getOne(queryWrapper);
one.setSubmitStatus(SubmitStatusEnum.DELETE.getValue());
ibusprocessnameService.saveOrUpdate(one);
String newId = UUID.randomUUID().toString().replace("-", "");
one.setId(newId);
one.setPrcNum((String) prcNameAndPrcNum.get("prcNum"));
// one.setPrcName((String) prcNameAndPrcNum.get("prcName"));
one.setPrcName(startProcessEO.getPrcName());
one.setPrcId(pi.getId());
one.setSubmitStatus(SubmitStatusEnum.SUBMIT.getValue());
one.setCreatTime(sdf.format(new Date()));
// String data = JSON.toJSONString(dataMsg, SerializerFeature.DisableCircularReferenceDetect);
// String dateId = activitDefineService.saveOrUpdateDate(prcType,data,task.getId(),pi.getId(),reportId);
// one.setDataId(dateId);
busProcessNames.add(one);
}
log.info("启动流程实例,获取id-->{},实例名称-->{}", pi.getId(), pd.getName());
}
ibusprocessnameService.saveBatch(busProcessNames);
String substring = stringBuilder.toString().substring(1, stringBuilder.length() - 1);
return WrapMapper.ok(substring);
}
@ApiOperation(value = "判断流程定义key的唯一性")
@GetMapping("/check_define_key")
@@ -9,6 +9,7 @@ import com.adc.da.report.eo.TtReportManageAct;
import com.adc.da.report.service.IPowerApplyActService;
import com.adc.da.report.service.IReportLabelService;
import com.adc.da.report.service.ITtReportManageActService;
import com.adc.da.util.utils.CollectionUtils;
import com.adc.da.util.utils.StringUtils;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
@@ -69,11 +70,13 @@ public class ActivitDefineService {
//插入报表标签关系表
//修改报表标签关系表(先删后增)
iReportLabelService.deleteReportLabelByReportId(new String[]{reportId});
ttReportManageAct.getLabelList().forEach((label) -> {
ReportLabelEntity reportLabelEntity = new ReportLabelEntity(com.adc.da.util.utils.UUID.randomUUID10()
,ttReportManageAct.getDataId(), label);
reportLabelDao.insert(reportLabelEntity);
});
if (CollectionUtils.isNotEmpty(ttReportManageAct.getLabelList())){
ttReportManageAct.getLabelList().forEach((label) -> {
ReportLabelEntity reportLabelEntity = new ReportLabelEntity(com.adc.da.util.utils.UUID.randomUUID10()
,ttReportManageAct.getDataId(), label);
reportLabelDao.insert(reportLabelEntity);
});
}
}
return reportId;
}
@@ -3,6 +3,7 @@ package com.adc.da.wkflow.business_activiti.task;
import cn.hutool.core.util.StrUtil;
import com.adc.da.login.util.UserUtils;
import com.adc.da.report.dao.mysql.PowerApplyActDao;
import com.adc.da.report.dao.mysql.TreeLabelDao;
import com.adc.da.report.dao.mysql.TtReportManageActDao;
import com.adc.da.report.eo.TtReportManageAct;
import com.adc.da.report.vo.PowerApplyActPageVO;
@@ -114,6 +115,9 @@ public class TodoTaskController {
@Autowired
private TtReportManageActDao ttReportManageActDao;
@Autowired
private TreeLabelDao treeLableDao;
@ApiOperation(value = "我的待办任务列表")
@ApiImplicitParams({@ApiImplicitParam(name = "name", value = "名称"),
@ApiImplicitParam(name = "current", value = "当前页"),
@@ -478,6 +482,8 @@ public class TodoTaskController {
}else {
ttReportManageAct = ttReportManageActDao.selectByPrcId(pId);
}
List<String> labelList = treeLableDao.selectIdByReport(ttReportManageAct.getDataId());
ttReportManageAct.setLabelList(labelList);
String string = JSONArray.toJSONString(ttReportManageAct);
//去对应的 数据表查数据
busProcessNewVO.setDataJson(string);
@@ -0,0 +1,24 @@
package com.adc.da.wkflow.dto;
import com.alibaba.fastjson.JSON;
import lombok.Data;
@Data
public class StartProcessEO {
private String prcName;
private String prcType;
private String userId;
private JSON approveData;
private JSON dataMsg;
private String loginUserId;
private String bpnId;
private String id;
}