增加归档后台功能

This commit is contained in:
wanggeng 2022-05-14 00:40:15 +08:00
parent 58a3a6b1d2
commit 8169e50be7
12 changed files with 1449 additions and 20 deletions

View File

@ -0,0 +1,102 @@
package ink.wgink.module.activiti.dao.oa;
import ink.wgink.exceptions.RemoveException;
import ink.wgink.exceptions.SaveException;
import ink.wgink.exceptions.SearchException;
import ink.wgink.interfaces.init.IInitBaseTable;
import ink.wgink.module.activiti.pojo.dtos.oa.OaOnFileDTO;
import ink.wgink.module.activiti.pojo.pos.oa.OaOnFilePO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @ClassName: IOaOnFileDao
* @Description: 归档
* @Author: wanggeng
* @Date: 2022/5/13 09:49
* @Version: 1.0
*/
@Repository
public interface IOaOnFileDao extends IInitBaseTable {
/**
* 新增
*
* @param params
* @throws SaveException
*/
void save(Map<String, Object> params) throws SaveException;
/**
* 删除
*
* @param params
* @throws RemoveException
*/
void remove(Map<String, Object> params) throws RemoveException;
/**
* 删除物理
*
* @param params
* @throws RemoveException
*/
void delete(Map<String, Object> params) throws RemoveException;
/**
* 列表
*
* @param params
* @return
*/
OaOnFileDTO get(Map<String, Object> params);
/**
* 列表
*
* @param params
* @return
*/
OaOnFilePO getPO(Map<String, Object> params);
/**
* 列表
*
* @param params
* @return
* @throws SearchException
*/
List<OaOnFilePO> listPO(Map<String, Object> params) throws SearchException;
/**
* 列表
*
* @param params
* @return
* @throws SearchException
*/
List<OaOnFileDTO> list(Map<String, Object> params) throws SearchException;
/**
* 未归档的流程实例ID列表
*
* @param params
* @return
* @throws SearchException
*/
List<String> listUnOnFileProcessInstanceId(Map<String, Object> params) throws SearchException;
/**
* 统计
*
* @param params
* @return
* @throws SearchException
*/
Integer count(Map<String, Object> params) throws SearchException;
}

View File

@ -0,0 +1,99 @@
package ink.wgink.module.activiti.pojo.dtos.oa;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
/**
* @ClassName: OaOnFilePO
* @Description: 归档
* @Author: wanggeng
* @Date: 2022/5/13 09:51
* @Version: 1.0
*/
@ApiModel
public class OaOnFileDTO implements Serializable {
private static final long serialVersionUID = 8758404155432312142L;
private String onFileId;
private String formCode;
private Integer formVersion;
private String processInstanceId;
private String reportUid;
private String mainTitle;
private String processDefinitionName;
private String processStartTime;
private String processEndTime;
public String getOnFileId() {
return onFileId == null ? "" : onFileId.trim();
}
public void setOnFileId(String onFileId) {
this.onFileId = onFileId;
}
public String getFormCode() {
return formCode == null ? "" : formCode.trim();
}
public void setFormCode(String formCode) {
this.formCode = formCode;
}
public Integer getFormVersion() {
return formVersion == null ? 0 : formVersion;
}
public void setFormVersion(Integer formVersion) {
this.formVersion = formVersion;
}
public String getProcessInstanceId() {
return processInstanceId == null ? "" : processInstanceId.trim();
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public String getReportUid() {
return reportUid == null ? "" : reportUid.trim();
}
public void setReportUid(String reportUid) {
this.reportUid = reportUid;
}
public String getMainTitle() {
return mainTitle == null ? "" : mainTitle.trim();
}
public void setMainTitle(String mainTitle) {
this.mainTitle = mainTitle;
}
public String getProcessDefinitionName() {
return processDefinitionName == null ? "" : processDefinitionName.trim();
}
public void setProcessDefinitionName(String processDefinitionName) {
this.processDefinitionName = processDefinitionName;
}
public String getProcessStartTime() {
return processStartTime == null ? "" : processStartTime.trim();
}
public void setProcessStartTime(String processStartTime) {
this.processStartTime = processStartTime;
}
public String getProcessEndTime() {
return processEndTime == null ? "" : processEndTime.trim();
}
public void setProcessEndTime(String processEndTime) {
this.processEndTime = processEndTime;
}
}

View File

@ -0,0 +1,122 @@
package ink.wgink.module.activiti.pojo.pos.oa;
import java.io.Serializable;
/**
* @ClassName: OaOnFilePO
* @Description: 归档
* @Author: wanggeng
* @Date: 2022/5/13 09:51
* @Version: 1.0
*/
public class OaOnFilePO implements Serializable {
private Long id;
private String onFileId;
private String formCode;
private Integer formVersion;
private String processInstanceId;
private String reportUid;
private String mainTitle;
private String creator;
private String gmtCreate;
private String modifier;
private String gmtModified;
private Integer isDelete;
public Long getId() {
return id == null ? 0 : id;
}
public void setId(Long id) {
this.id = id;
}
public String getOnFileId() {
return onFileId == null ? "" : onFileId.trim();
}
public void setOnFileId(String onFileId) {
this.onFileId = onFileId;
}
public String getFormCode() {
return formCode == null ? "" : formCode.trim();
}
public void setFormCode(String formCode) {
this.formCode = formCode;
}
public Integer getFormVersion() {
return formVersion == null ? 0 : formVersion;
}
public void setFormVersion(Integer formVersion) {
this.formVersion = formVersion;
}
public String getProcessInstanceId() {
return processInstanceId == null ? "" : processInstanceId.trim();
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public String getReportUid() {
return reportUid == null ? "" : reportUid.trim();
}
public void setReportUid(String reportUid) {
this.reportUid = reportUid;
}
public String getMainTitle() {
return mainTitle == null ? "" : mainTitle.trim();
}
public void setMainTitle(String mainTitle) {
this.mainTitle = mainTitle;
}
public String getCreator() {
return creator == null ? "" : creator.trim();
}
public void setCreator(String creator) {
this.creator = creator;
}
public String getGmtCreate() {
return gmtCreate == null ? "" : gmtCreate.trim();
}
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
public String getModifier() {
return modifier == null ? "" : modifier.trim();
}
public void setModifier(String modifier) {
this.modifier = modifier;
}
public String getGmtModified() {
return gmtModified == null ? "" : gmtModified.trim();
}
public void setGmtModified(String gmtModified) {
this.gmtModified = gmtModified;
}
public Integer getIsDelete() {
return isDelete == null ? 0 : isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
}

View File

@ -0,0 +1,73 @@
package ink.wgink.module.activiti.pojo.vos.oa;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @ClassName: OaOnFilePO
* @Description: 归档
* @Author: wanggeng
* @Date: 2022/5/13 09:51
* @Version: 1.0
*/
@ApiModel
public class OaOnFileVO implements Serializable {
@ApiModelProperty(name = "formCode", value = "表单编码")
private String formCode;
@ApiModelProperty(name = "formVersion", value = "表单版本")
private Integer formVersion;
@ApiModelProperty(name = "processInstanceId", value = "实例ID")
private String processInstanceId;
@ApiModelProperty(name = "reportUid", value = "上报ID")
private String reportUid;
public String getFormCode() {
return formCode == null ? "" : formCode.trim();
}
public void setFormCode(String formCode) {
this.formCode = formCode;
}
public Integer getFormVersion() {
return formVersion == null ? 0 : formVersion;
}
public void setFormVersion(Integer formVersion) {
this.formVersion = formVersion;
}
public String getProcessInstanceId() {
return processInstanceId == null ? "" : processInstanceId.trim();
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public String getReportUid() {
return reportUid == null ? "" : reportUid.trim();
}
public void setReportUid(String reportUid) {
this.reportUid = reportUid;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"formCode\":\"")
.append(formCode).append('\"');
sb.append(",\"formVersion\":")
.append(formVersion);
sb.append(",\"processInstanceId\":\"")
.append(processInstanceId).append('\"');
sb.append(",\"reportUid\":\"")
.append(reportUid).append('\"');
sb.append('}');
return sb.toString();
}
}

View File

@ -19,6 +19,7 @@ public interface IOaFormReportService {
String KEY_FORM_CODE = "formCode";
String KEY_FORM_VERSION = "formVersion";
String KEY_REPORT_UID = "reportUid";
String KEY_MAIN_TITLE = "MAIN_TITLE";
String KEY_ASSIGNEE_USER = "assigneeUser";
String KEY_ASSIGNEE_USER_NAME = "assigneeUserName";
String KEY_START_ASSIGNEE_USER = "startAssigneeUser";

View File

@ -0,0 +1,297 @@
package ink.wgink.module.activiti.service.oa;
import ink.wgink.module.activiti.pojo.dtos.oa.OaOnFileDTO;
import ink.wgink.module.activiti.pojo.pos.oa.OaOnFilePO;
import ink.wgink.module.activiti.pojo.vos.oa.OaOnFileVO;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultList;
import java.util.List;
import java.util.Map;
/**
* @ClassName: IOaOnFileService
* @Description: oa归档
* @Author: wanggeng
* @Date: 2022/5/13 09:58
* @Version: 1.0
*/
public interface IOaOnFileService {
/**
* 已完成
*/
String KEY_FINISHED = "finished";
/**
* 未完成
*/
String KEY_UN_FINISHED = "unFinished";
/**
* 新增
*
* @param oaOnFileVO
*/
void save(OaOnFileVO oaOnFileVO);
/**
* 新增
*
* @param oaOnFileVO
* @return
*/
String saveAndReturnId(OaOnFileVO oaOnFileVO);
/**
* 删除
*
* @param ids
*/
void remove(List<String> ids);
/**
* 删除物理
*
* @param ids
*/
void delete(List<String> ids);
/**
* 详情
*
* @param params
* @return
*/
OaOnFileDTO get(Map<String, Object> params);
/**
* 详情
*
* @param onFileId
* @return
*/
OaOnFileDTO getById(String onFileId);
/**
* 详情
*
* @param processInstanceId
* @return
*/
OaOnFileDTO getByProcessInstanceId(String processInstanceId);
/**
* 详情
*
* @param reportUid
* @return
*/
OaOnFileDTO getByReportUid(String reportUid);
/**
* 详情
*
* @param params
* @return
*/
OaOnFilePO getPO(Map<String, Object> params);
/**
* 详情
*
* @param onFileId
* @return
*/
OaOnFilePO getPOById(String onFileId);
/**
* 详情
*
* @param processInstanceId
* @return
*/
OaOnFilePO getPOByProcessInstanceId(String processInstanceId);
/**
* 详情
*
* @param reportUid
* @return
*/
OaOnFilePO getPOByReportUid(String reportUid);
/**
* 列表
*
* @param params
* @return
*/
List<OaOnFilePO> listPO(Map<String, Object> params);
/**
* 列表
*
* @param onFileIds
* @return
*/
List<OaOnFilePO> listPOByIds(List<String> onFileIds);
/**
* 列表
*
* @param formCode
* @param formVersion
* @return
*/
List<OaOnFilePO> listPOByFormCodeAndFormVersion(String formCode, Integer formVersion);
/**
* 列表
*
* @param processInstanceIds
* @return
*/
List<OaOnFilePO> listPOByProcessInstanceIds(List<String> processInstanceIds);
/**
* 列表
*
* @param reportUids
* @return
*/
List<OaOnFilePO> listPOByReportUids(List<String> reportUids);
/**
* 列表
*
* @param params
* @return
*/
List<OaOnFileDTO> list(Map<String, Object> params);
/**
* 列表
*
* @param onFileIds
* @return
*/
List<OaOnFileDTO> listByIds(List<String> onFileIds);
/**
* 列表
*
* @param formCode
* @param formVersion
* @return
*/
List<OaOnFileDTO> listByFormCodeAndFormVersion(String formCode, Integer formVersion);
/**
* 列表
*
* @param processInstanceIds
* @return
*/
List<OaOnFileDTO> listByProcessInstanceIds(List<String> processInstanceIds);
/**
* 列表
*
* @param reportUids
* @return
*/
List<OaOnFileDTO> listByReportUids(List<String> reportUids);
/**
* 未归档
*
* @return
*/
List<OaOnFileDTO> listUnOnFile();
/**
* 未完成且未归档
*
* @return
*/
List<OaOnFileDTO> listUnFinishedUnOnFile();
/**
* 已完成且未归档
*
* @return
*/
List<OaOnFileDTO> listFinishedUnOnFile();
/**
* 分页列表
*
* @param page
* @return
*/
SuccessResultList<List<OaOnFileDTO>> listPage(ListPage page);
/**
* 分页列表
*
* @param onFileIds
* @param page
* @return
*/
SuccessResultList<List<OaOnFileDTO>> listPageByIds(List<String> onFileIds, ListPage page);
/**
* 分页列表
*
* @param formCode
* @param formVersion
* @param page
* @return
*/
SuccessResultList<List<OaOnFileDTO>> listPageByFormCodeAndFormVersion(String formCode, Integer formVersion, ListPage page);
/**
* 分页列表
*
* @param processInstanceIds
* @param page
* @return
*/
SuccessResultList<List<OaOnFileDTO>> listPageByProcessInstanceIds(List<String> processInstanceIds, ListPage page);
/**
* 分页列表
*
* @param reportUids
* @param page
* @return
*/
SuccessResultList<List<OaOnFileDTO>> listPageByReportUids(List<String> reportUids, ListPage page);
/**
* 未归档分页
*
* @param page
* @return
*/
SuccessResultList<List<OaOnFileDTO>> listPageUnOnFile(ListPage page);
/**
* 未完成且未归档分页列表
*
* @param page
* @return
*/
SuccessResultList<List<OaOnFileDTO>> listPageUnFinishedUnOnFile(ListPage page);
/**
* 已完成且未归档分页列表
*
* @param page
* @return
*/
SuccessResultList<List<OaOnFileDTO>> listPageFinishedUnOnFile(ListPage page);
}

View File

@ -10,12 +10,14 @@ import ink.wgink.module.activiti.pojo.pos.oa.OaCcPO;
import ink.wgink.module.activiti.pojo.vos.oa.OaCcVO;
import ink.wgink.module.activiti.service.oa.IOaCcService;
import ink.wgink.module.form.service.design.IFormDesignService;
import ink.wgink.module.form.service.report.IFormReportService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.dtos.user.UserDTO;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.util.ArrayListUtil;
import ink.wgink.util.UUIDUtil;
import ink.wgink.util.map.HashMapUtil;
import org.activiti.engine.HistoryService;
import org.activiti.engine.history.HistoricProcessInstance;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -37,7 +39,7 @@ public class OaCcServiceImpl extends DefaultBaseService implements IOaCcService
@Autowired
private IUserBaseService userBaseService;
@Autowired
private IFormReportService formReportService;
private HistoryService historyService;
@Override
@ -154,25 +156,29 @@ public class OaCcServiceImpl extends DefaultBaseService implements IOaCcService
/**
* 设置主标题
*
* @param oaCcDTOS
* @param oaCcDTOs
*/
private void setMainTitle(List<OaCcDTO> oaCcDTOS) {
if (oaCcDTOS.isEmpty()) {
private void setMainTitle(List<OaCcDTO> oaCcDTOs) {
if (oaCcDTOs.isEmpty()) {
return;
}
oaCcDTOS.forEach(oaCcDTO -> {
Map<String, Object> reportMap = formReportService.get(oaCcDTO.getFormCode(), oaCcDTO.getFormVersion(), oaCcDTO.getReportUid());
Object mainTitleObj = reportMap.get(IFormDesignService.FIELD_MAIN_TITLE);
if (mainTitleObj == null) {
oaCcDTO.setMainTitle("您有一条待阅内容");
return;
List<String> processInstanceIds = ArrayListUtil.listBeanStringIdValue(oaCcDTOs, "processInstanceId", OaCcDTO.class);
List<HistoricProcessInstance> processInstances = historyService.createHistoricProcessInstanceQuery()
.processInstanceIds(new HashSet<>(processInstanceIds))
.includeProcessVariables().list();
oaCcDTOs.forEach(oaCcDTO -> {
for (HistoricProcessInstance processInstance : processInstances) {
if (StringUtils.equals(oaCcDTO.getProcessInstanceId(), processInstance.getId())) {
Map<String, Object> processVariables = processInstance.getProcessVariables();
String mainTitle = (String) processVariables.get(IFormDesignService.FIELD_MAIN_TITLE);
if (StringUtils.isBlank(mainTitle)) {
oaCcDTO.setMainTitle("您有一条待阅内容");
} else {
oaCcDTO.setMainTitle(mainTitle);
}
break;
}
}
String mainTitle = mainTitleObj.toString();
if (StringUtils.isBlank(mainTitle)) {
oaCcDTO.setMainTitle("您有一条待阅内容");
return;
}
oaCcDTO.setMainTitle(mainTitle);
});
}

View File

@ -17,6 +17,7 @@ import ink.wgink.module.activiti.pojo.vos.oa.UpdateTaskAssigneeVO;
import ink.wgink.module.activiti.service.activiti.IActivitiModelService;
import ink.wgink.module.activiti.service.oa.IOaCcService;
import ink.wgink.module.activiti.service.oa.IOaFormReportService;
import ink.wgink.module.form.service.design.IFormDesignService;
import ink.wgink.module.form.service.design.IFormFieldService;
import ink.wgink.module.form.service.report.IFormReportService;
import ink.wgink.pojo.ListPage;
@ -446,7 +447,7 @@ public class OaFormReportServiceImpl extends DefaultBaseService implements IOaFo
public Map<String, Object> get(String formCode, Integer formVersion, String uid) {
Map<String, Object> detail = formReportService.get(formCode, formVersion, uid);
// 查询会签列表
String processInstanceId = detail.get("process_instance_id").toString();
String processInstanceId = detail.get(IFormDesignService.PROCESS_INSTANCE_ID).toString();
LOG.debug("设置签批内容(流程变量)");
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().includeProcessVariables().processInstanceId(processInstanceId).singleResult();
if (historicProcessInstance == null) {

View File

@ -0,0 +1,409 @@
package ink.wgink.module.activiti.service.oa.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.module.activiti.dao.oa.IOaOnFileDao;
import ink.wgink.module.activiti.pojo.dtos.oa.OaOnFileDTO;
import ink.wgink.module.activiti.pojo.pos.oa.OaOnFilePO;
import ink.wgink.module.activiti.pojo.vos.oa.OaOnFileVO;
import ink.wgink.module.activiti.service.oa.IOaFormReportService;
import ink.wgink.module.activiti.service.oa.IOaOnFileService;
import ink.wgink.module.form.service.design.IFormDesignService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.util.ArrayListUtil;
import ink.wgink.util.UUIDUtil;
import ink.wgink.util.date.DateUtil;
import ink.wgink.util.map.HashMapUtil;
import org.activiti.engine.HistoryService;
import org.activiti.engine.history.HistoricProcessInstance;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* @ClassName: OaOnFileServiceImpl
* @Description: OA归档
* @Author: wanggeng
* @Date: 2022/5/13 09:58
* @Version: 1.0
*/
@Service
public class OaOnFileServiceImpl extends DefaultBaseService implements IOaOnFileService {
@Autowired
private IOaOnFileDao oaOnFileDao;
@Autowired
private HistoryService historyService;
@Override
public void save(OaOnFileVO oaOnFileVO) {
saveAndReturnId(oaOnFileVO);
}
@Override
public String saveAndReturnId(OaOnFileVO oaOnFileVO) {
String onFileId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(oaOnFileVO);
params.put("onFileId", onFileId);
// setSaveInfo(params);
params.put("isDelete", 0);
oaOnFileDao.save(params);
return onFileId;
}
@Override
public void remove(List<String> ids) {
Map<String, Object> params = getHashMap(2);
params.put("onFileIds", ids);
setUpdateInfo(params);
oaOnFileDao.remove(params);
}
@Override
public void delete(List<String> ids) {
Map<String, Object> params = getHashMap(2);
params.put("onFileIds", ids);
oaOnFileDao.delete(params);
}
@Override
public OaOnFileDTO get(Map<String, Object> params) {
params = params == null ? getHashMap(0) : params;
return oaOnFileDao.get(params);
}
@Override
public OaOnFileDTO getById(String onFileId) {
Map<String, Object> params = getHashMap(2);
params.put("onFileId", onFileId);
return get(params);
}
@Override
public OaOnFileDTO getByProcessInstanceId(String processInstanceId) {
Map<String, Object> params = getHashMap(2);
params.put(IFormDesignService.PARAM_PROCESS_INSTANCE_ID, processInstanceId);
return get(params);
}
@Override
public OaOnFileDTO getByReportUid(String reportUid) {
Map<String, Object> params = getHashMap(2);
params.put(IOaFormReportService.KEY_REPORT_UID, reportUid);
return get(params);
}
@Override
public OaOnFilePO getPO(Map<String, Object> params) {
params = params == null ? getHashMap(0) : params;
return oaOnFileDao.getPO(params);
}
@Override
public OaOnFilePO getPOById(String onFileId) {
Map<String, Object> params = getHashMap(2);
params.put("onFileId", onFileId);
return getPO(params);
}
@Override
public OaOnFilePO getPOByProcessInstanceId(String processInstanceId) {
Map<String, Object> params = getHashMap(2);
params.put(IFormDesignService.PARAM_PROCESS_INSTANCE_ID, processInstanceId);
return getPO(params);
}
@Override
public OaOnFilePO getPOByReportUid(String reportUid) {
Map<String, Object> params = getHashMap(2);
params.put(IOaFormReportService.KEY_REPORT_UID, reportUid);
return getPO(params);
}
@Override
public List<OaOnFilePO> listPO(Map<String, Object> params) {
params = params == null ? getHashMap(0) : params;
return oaOnFileDao.listPO(params);
}
@Override
public List<OaOnFilePO> listPOByIds(List<String> onFileIds) {
if (onFileIds == null || onFileIds.isEmpty()) {
return new ArrayList<>();
}
Map<String, Object> params = getHashMap(2);
params.put("onFileIds", onFileIds);
return listPO(params);
}
@Override
public List<OaOnFilePO> listPOByFormCodeAndFormVersion(String formCode, Integer formVersion) {
if (StringUtils.isBlank(formCode) || formVersion == null) {
return new ArrayList<>();
}
Map<String, Object> params = getHashMap(4);
params.put(IFormDesignService.PARAM_FORM_CODE, formCode);
params.put(IFormDesignService.PARAM_FORM_VERSION, formVersion);
return listPO(params);
}
@Override
public List<OaOnFilePO> listPOByProcessInstanceIds(List<String> processInstanceIds) {
if (processInstanceIds == null || processInstanceIds.isEmpty()) {
return new ArrayList<>();
}
Map<String, Object> params = getHashMap(2);
params.put("processInstanceIds", processInstanceIds);
return listPO(params);
}
@Override
public List<OaOnFilePO> listPOByReportUids(List<String> reportUids) {
if (reportUids == null || reportUids.isEmpty()) {
return new ArrayList<>();
}
Map<String, Object> params = getHashMap(2);
params.put("reportUids", reportUids);
return listPO(params);
}
@Override
public List<OaOnFileDTO> list(Map<String, Object> params) {
params = params == null ? getHashMap(0) : params;
List<OaOnFileDTO> oaOnFileDTOs = oaOnFileDao.list(params);
setProcessInstanceParams(oaOnFileDTOs);
return oaOnFileDTOs;
}
@Override
public List<OaOnFileDTO> listByIds(List<String> onFileIds) {
if (onFileIds == null || onFileIds.isEmpty()) {
return new ArrayList<>();
}
Map<String, Object> params = getHashMap(2);
params.put("onFileIds", onFileIds);
return list(params);
}
@Override
public List<OaOnFileDTO> listByFormCodeAndFormVersion(String formCode, Integer formVersion) {
if (StringUtils.isBlank(formCode) || formVersion == null) {
return new ArrayList<>();
}
Map<String, Object> params = getHashMap(4);
params.put(IFormDesignService.PARAM_FORM_CODE, formCode);
params.put(IFormDesignService.PARAM_FORM_VERSION, formVersion);
return list(params);
}
@Override
public List<OaOnFileDTO> listByProcessInstanceIds(List<String> processInstanceIds) {
if (processInstanceIds == null || processInstanceIds.isEmpty()) {
return new ArrayList<>();
}
Map<String, Object> params = getHashMap(2);
params.put("processInstanceIds", processInstanceIds);
return list(params);
}
@Override
public List<OaOnFileDTO> listByReportUids(List<String> reportUids) {
if (reportUids == null || reportUids.isEmpty()) {
return new ArrayList<>();
}
Map<String, Object> params = getHashMap(2);
params.put("reportUids", reportUids);
return list(params);
}
@Override
public List<OaOnFileDTO> listUnOnFile() {
Map<String, Object> params = getHashMap(0);
List<String> processInstanceIds = oaOnFileDao.listUnOnFileProcessInstanceId(params);
return listUnOnFile(new HashSet<>(processInstanceIds));
}
@Override
public List<OaOnFileDTO> listUnFinishedUnOnFile() {
Map<String, Object> params = getHashMap(2);
params.put(KEY_UN_FINISHED, ISystemConstant.IS_TRUE);
List<String> processInstanceIds = oaOnFileDao.listUnOnFileProcessInstanceId(params);
return listUnFinishedUnOnFile(new HashSet<>(processInstanceIds));
}
@Override
public List<OaOnFileDTO> listFinishedUnOnFile() {
Map<String, Object> params = getHashMap(2);
params.put(KEY_FINISHED, ISystemConstant.IS_TRUE);
List<String> processInstanceIds = oaOnFileDao.listUnOnFileProcessInstanceId(params);
return listFinishedUnOnFile(new HashSet<>(processInstanceIds));
}
@Override
public SuccessResultList<List<OaOnFileDTO>> listPage(ListPage page) {
PageHelper.startPage(page.getPage(), page.getRows());
List<OaOnFileDTO> oaOnFileDTOs = oaOnFileDao.list(page.getParams());
PageInfo<OaOnFileDTO> pageInfo = new PageInfo<>(oaOnFileDTOs);
setProcessInstanceParams(oaOnFileDTOs);
return new SuccessResultList<>(oaOnFileDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public SuccessResultList<List<OaOnFileDTO>> listPageByIds(List<String> onFileIds, ListPage page) {
page.getParams().put("onFileIds", onFileIds);
return listPage(page);
}
@Override
public SuccessResultList<List<OaOnFileDTO>> listPageByFormCodeAndFormVersion(String formCode, Integer formVersion, ListPage page) {
page.getParams().put(IFormDesignService.PARAM_FORM_CODE, formCode);
page.getParams().put(IFormDesignService.PARAM_FORM_VERSION, formVersion);
return listPage(page);
}
@Override
public SuccessResultList<List<OaOnFileDTO>> listPageByProcessInstanceIds(List<String> processInstanceIds, ListPage page) {
page.getParams().put("processInstanceIds", processInstanceIds);
return listPage(page);
}
@Override
public SuccessResultList<List<OaOnFileDTO>> listPageByReportUids(List<String> reportUids, ListPage page) {
page.getParams().put("reportUids", reportUids);
return listPage(page);
}
@Override
public SuccessResultList<List<OaOnFileDTO>> listPageUnOnFile(ListPage page) {
Map<String, Object> params = getHashMap(2);
PageHelper.startPage(page.getPage(), page.getRows());
List<String> processInstanceIds = oaOnFileDao.listUnOnFileProcessInstanceId(params);
PageInfo<String> pageInfo = new PageInfo<>(processInstanceIds);
List<OaOnFileDTO> oaOnFileDTOs = listUnOnFile(new HashSet<>(processInstanceIds));
return new SuccessResultList<>(oaOnFileDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public SuccessResultList<List<OaOnFileDTO>> listPageUnFinishedUnOnFile(ListPage page) {
Map<String, Object> params = getHashMap(2);
params.put(KEY_UN_FINISHED, ISystemConstant.IS_TRUE);
PageHelper.startPage(page.getPage(), page.getRows());
List<String> processInstanceIds = oaOnFileDao.listUnOnFileProcessInstanceId(params);
PageInfo<String> pageInfo = new PageInfo<>(processInstanceIds);
List<OaOnFileDTO> oaOnFileDTOs = listUnFinishedUnOnFile(new HashSet<>(processInstanceIds));
return new SuccessResultList<>(oaOnFileDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public SuccessResultList<List<OaOnFileDTO>> listPageFinishedUnOnFile(ListPage page) {
Map<String, Object> params = getHashMap(2);
params.put(KEY_FINISHED, ISystemConstant.IS_TRUE);
PageHelper.startPage(page.getPage(), page.getRows());
List<String> processInstanceIds = oaOnFileDao.listUnOnFileProcessInstanceId(params);
PageInfo<String> pageInfo = new PageInfo<>(processInstanceIds);
List<OaOnFileDTO> oaOnFileDTOs = listFinishedUnOnFile(new HashSet<>(processInstanceIds));
return new SuccessResultList<>(oaOnFileDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
/**
* 设置流程参数
*
* @param oaOnFileDTOs
*/
private void setProcessInstanceParams(List<OaOnFileDTO> oaOnFileDTOs) {
List<String> processInstanceIds = ArrayListUtil.listBeanStringIdValue(oaOnFileDTOs, "processInstanceId", OaOnFileDTO.class);
List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery()
.processInstanceIds(new HashSet<>(processInstanceIds))
.includeProcessVariables()
.list();
for (OaOnFileDTO oaOnFileDTO : oaOnFileDTOs) {
for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) {
if (StringUtils.equals(oaOnFileDTO.getProcessInstanceId(), historicProcessInstance.getId())) {
Map<String, Object> processVariables = historicProcessInstance.getProcessVariables();
String mainTitle = (String) processVariables.get(IOaFormReportService.KEY_MAIN_TITLE);
oaOnFileDTO.setProcessDefinitionName(historicProcessInstance.getProcessDefinitionName());
oaOnFileDTO.setProcessStartTime(DateUtil.getDateTime(historicProcessInstance.getStartTime()));
if (historicProcessInstance.getEndTime() != null) {
oaOnFileDTO.setProcessEndTime(DateUtil.getDateTime(historicProcessInstance.getEndTime()));
}
oaOnFileDTO.setMainTitle(mainTitle);
break;
}
}
}
}
/**
* 未归档列表
*
* @param processInstanceIdSet
* @return
*/
private List<OaOnFileDTO> listUnOnFile(Set<String> processInstanceIdSet) {
return historyService.createHistoricProcessInstanceQuery()
.processInstanceIds(processInstanceIdSet)
.includeProcessVariables()
.list()
.stream().map(historicProcessInstance -> getOnFileDTO(historicProcessInstance)).collect(Collectors.toList());
}
/**
* 未完成的未归档列表
*
* @param processInstanceIdSet
* @return
*/
private List<OaOnFileDTO> listUnFinishedUnOnFile(Set<String> processInstanceIdSet) {
if (processInstanceIdSet.isEmpty()) {
return new ArrayList<>();
}
return historyService.createHistoricProcessInstanceQuery()
.processInstanceIds(new HashSet<>(processInstanceIdSet))
.unfinished()
.includeProcessVariables()
.list()
.stream().map(historicProcessInstance -> getOnFileDTO(historicProcessInstance)).collect(Collectors.toList());
}
/**
* 已完成的未归档列表
*
* @param processInstanceIdSet
* @return
*/
private List<OaOnFileDTO> listFinishedUnOnFile(Set<String> processInstanceIdSet) {
return historyService.createHistoricProcessInstanceQuery()
.processInstanceIds(new HashSet<>(processInstanceIdSet))
.finished()
.includeProcessVariables()
.list()
.stream().map(historicProcessInstance -> getOnFileDTO(historicProcessInstance)).collect(Collectors.toList());
}
private OaOnFileDTO getOnFileDTO(HistoricProcessInstance historicProcessInstance) {
Map<String, Object> processVariables = historicProcessInstance.getProcessVariables();
String formCode = (String) processVariables.get(IOaFormReportService.KEY_FORM_CODE);
Integer formVersion = (Integer) processVariables.get(IOaFormReportService.KEY_FORM_VERSION);
String reportUid = (String) processVariables.get(IOaFormReportService.KEY_REPORT_UID);
String mainTitle = (String) processVariables.get(IOaFormReportService.KEY_MAIN_TITLE);
OaOnFileDTO oaOnFileDTO = new OaOnFileDTO();
oaOnFileDTO.setFormCode(formCode);
oaOnFileDTO.setFormVersion(formVersion);
oaOnFileDTO.setProcessInstanceId(historicProcessInstance.getId());
oaOnFileDTO.setProcessDefinitionName(historicProcessInstance.getProcessDefinitionName());
oaOnFileDTO.setProcessStartTime(DateUtil.getDateTime(historicProcessInstance.getStartTime()));
if (historicProcessInstance.getEndTime() != null) {
oaOnFileDTO.setProcessEndTime(DateUtil.getDateTime(historicProcessInstance.getEndTime()));
}
oaOnFileDTO.setReportUid(reportUid);
oaOnFileDTO.setMainTitle(mainTitle);
return oaOnFileDTO;
}
}

View File

@ -0,0 +1,319 @@
<?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="ink.wgink.module.activiti.dao.oa.IOaOnFileDao">
<resultMap id="oaOnFilePO" type="ink.wgink.module.activiti.pojo.pos.oa.OaOnFilePO">
<id column="id" property="id"/>
<result column="on_file_id" property="onFileId"/>
<result column="form_code" property="formCode"/>
<result column="form_version" property="formVersion"/>
<result column="process_instance_id" property="processInstanceId"/>
<result column="report_uid" property="reportUid"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="oaOnFileDTO" type="ink.wgink.module.activiti.pojo.dtos.oa.OaOnFileDTO">
<id column="on_file_id" property="onFileId"/>
<result column="form_code" property="formCode"/>
<result column="form_version" property="formVersion"/>
<result column="process_instance_id" property="processInstanceId"/>
<result column="report_uid" property="reportUid"/>
</resultMap>
<!-- 建表 -->
<update id="createTable">
CREATE TABLE IF NOT EXISTS `oa_on_file` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`on_file_id` char(36) DEFAULT NULL,
`form_code` varchar(255) DEFAULT NULL COMMENT '表单编码',
`form_version` int(11) DEFAULT NULL COMMENT '表单版本',
`process_instance_id` char(36) DEFAULT NULL COMMENT '流程实例ID',
`report_uid` char(36) DEFAULT NULL COMMENT '上报ID',
`creator` char(36) DEFAULT NULL COMMENT '创建人',
`gmt_create` date DEFAULT NULL COMMENT '创建时间',
`is_delete` int(1) DEFAULT NULL COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `on_file_id` (`on_file_id`),
KEY `form_code` (`form_code`,`form_version`),
KEY `process_instance_id` (`process_instance_id`),
KEY `report_uid` (`report_uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='OA归档';
</update>
<!-- 新增 -->
<insert id="save" parameterType="map">
INSERT INTO oa_on_file(
on_file_id,
form_code,
form_version,
process_instance_id,
report_uid,
gmt_create,
creator,
gmt_modified,
modifier,
is_delete
) VALUES(
#{onFileId},
#{formCode},
#{formVersion},
#{processInstanceId},
#{reportUid},
#{gmtCreate},
#{creator},
#{gmtModified},
#{modifier},
#{isDelete}
)
</insert>
<!-- 删除 -->
<update id="remove" parameterType="map">
UPDATE
oa_on_file
SET
is_delete = 0,
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
<if test="oaFileIds != null and oaFileIds.size > 0">
oa_file_id IN
<foreach collection="oaFileIds" index="index" open="(" separator="," close=")">
#{oaFileIds[${index}]}
</foreach>
</if>
</update>
<!-- 删除(物理) -->
<delete id="delete" parameterType="map">
DELETE FROM
oa_on_file
WHERE
<if test="oaFileIds != null and oaFileIds.size > 0">
oa_file_id IN
<foreach collection="oaFileIds" index="index" open="(" separator="," close=")">
#{oaFileIds[${index}]}
</foreach>
</if>
</delete>
<!-- 详情 -->
<select id="getPO" parameterType="map" resultMap="oaOnFilePO">
SELECT
on_file_id,
form_code,
form_version,
process_instance_id,
report_uid,
gmt_create,
creator,
gmt_modified,
modifier,
is_delete
FROM
oa_on_file
WHERE
is_delete = 0
<if test="oaFileId != null and oaFileId != ''">
AND
oa_file_id = #{oaFileId}
</if>
<if test="processInstanceId != null and processInstanceId != ''">
AND
process_instance_id = #{processInstanceId}
</if>
<if test="reportUid != null and reportUid != ''">
AND
report_uid = #{reportUid}
</if>
</select>
<!-- 详情 -->
<select id="get" parameterType="map" resultMap="oaOnFileDTO">
SELECT
on_file_id,
form_code,
form_version,
process_instance_id,
report_uid,
gmt_create,
creator,
gmt_modified,
modifier,
is_delete
FROM
oa_on_file
WHERE
is_delete = 0
<if test="oaFileId != null and oaFileId != ''">
AND
oa_file_id = #{oaFileId}
</if>
<if test="processInstanceId != null and processInstanceId != ''">
AND
process_instance_id = #{processInstanceId}
</if>
<if test="reportUid != null and reportUid != ''">
AND
report_uid = #{reportUid}
</if>
</select>
<!-- 列表 -->
<select id="listPO" parameterType="map" resultMap="oaOnFilePO">
SELECT
on_file_id,
form_code,
form_version,
process_instance_id,
report_uid,
gmt_create,
creator,
gmt_modified,
modifier,
is_delete
FROM
oa_on_file
WHERE
is_delete = 0
<if test="formCode != null and formCode != ''">
AND
form_code = #{formCode}
</if>
<if test="formVersion != null">
AND
form_version = #{formVersion}
</if>
<if test="processInstanceId != null and processInstanceId != ''">
AND
process_instance_id = #{processInstanceId}
</if>
<if test="reportUid != null and reportUid != ''">
AND
report_uid = #{reportUid}
</if>
<if test="processInstanceIds != null and processInstanceIds.size > 0">
AND
process_instance_id IN
<foreach collection="processInstanceIds" index="index" open="(" separator="," close=")">
#{processInstanceIds[${index}]}
</foreach>
</if>
<if test="reportUids != null and reportUids.size > 0">
AND
report_uid IN
<foreach collection="reportUids" index="index" open="(" separator="," close=")">
#{reportUids[${index}]}
</foreach>
</if>
<if test="sort != null and (sort == 'gmtCreate')">
ORDER BY
<if test="sort == 'gmtCreate'">
gmt_create ${order}
</if>
</if>
</select>
<!-- 列表 -->
<select id="list" parameterType="map" resultMap="oaOnFileDTO">
SELECT
on_file_id,
form_code,
form_version,
process_instance_id,
report_uid
FROM
oa_on_file
WHERE
is_delete = 0
<if test="formCode != null and formCode != ''">
AND
form_code = #{formCode}
</if>
<if test="formVersion != null">
AND
form_version = #{formVersion}
</if>
<if test="processInstanceId != null and processInstanceId != ''">
AND
process_instance_id = #{processInstanceId}
</if>
<if test="processInstanceIds != null and processInstanceIds.size > 0">
AND
process_instance_id IN
<foreach collection="processInstanceIds" index="index" open="(" separator="," close=")">
#{processInstanceIds[${index}]}
</foreach>
</if>
<if test="reportUid != null and reportUid != ''">
AND
report_uid = #{reportUid}
</if>
<if test="reportUids != null and reportUids.size > 0">
AND
report_uid IN
<foreach collection="reportUids" index="index" open="(" separator="," close=")">
#{reportUids[${index}]}
</foreach>
</if>
<if test="sort != null and (sort == 'gmtCreate')">
ORDER BY
<if test="sort == 'gmtCreate'">
gmt_create ${order}
</if>
</if>
</select>
<!-- 未完成的流程实例列表 -->
<select id="listUnOnFileProcessInstanceId" parameterType="map" resultType="java.lang.String">
SELECT
t1.PROC_INST_ID_
FROM
act_hi_procinst t1
WHERE
t1.PROC_INST_ID_ NOT IN (
SELECT
st1.process_instance_id
FROM
oa_on_file st1
WHERE
st1.is_delete = 0
)
<if test="unFinished != null and unFinished == 'true'">
AND (
t1.END_TIME_ IS NULL
OR
t1.END_TIME_ = ''
)
</if>
<if test="finished != null and finished == 'true'">
AND (
t1.END_TIME_ IS NOT NULL
AND
t1.END_TIME_ != ''
)
</if>
</select>
<!-- 统计 -->
<select id="count" parameterType="map" resultType="java.lang.Integer">
SELECT
COUNT(*)
FROM
oa_on_file
<where>
<if test="formCode != null and formCode != ''">
form_code = #{formCode}
</if>
<if test="formVersion != null">
AND
form_version = #{formVersion}
</if>
</where>
</select>
</mapper>

View File

@ -93,7 +93,7 @@
return rowData;
}
},
{field: 'form', width: 100, title: '操作', align:'center',
{field: 'form', width: 100, title: '操作', align:'center', fixed: 'right',
templet: function(row) {
return '<div class="layui-btn-group">' +
'<button class="layui-btn layui-btn-xs layui-btn-primary" lay-event="readEvent">查看</button>'+

View File

@ -84,7 +84,7 @@
return rowData;
}
},
{field: 'form', width: 100, title: '操作', align:'center',
{field: 'form', width: 100, title: '操作', align:'center', fixed: 'right',
templet: function(row) {
return '<div class="layui-btn-group">' +
'<button class="layui-btn layui-btn-xs layui-btn-primary" lay-event="readEvent">查看</button>'+