|
@@ -100,14 +100,17 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(sopNo, crmNo);
|
|
|
Optional.ofNullable(crmProjectResult).orElseThrow(ExceptionResultEnum.CRM_NO_NO_DATA::exception);
|
|
|
|
|
|
- List<String> sysUserRoleList = sysUserRoleService.listByServiceId(crmProjectResult.getServiceUnitId(), sysUser.getId(), sopNo);
|
|
|
+ List<String> sysUserRoleList = sysUserRoleService.listByServiceId(crmProjectResult.getServiceUnitId(),
|
|
|
+ sysUser.getId(), sopNo);
|
|
|
List<String> approveUserIds = new ArrayList<>(sysUserRoleList);
|
|
|
- FlowApproveParam flowApproveParam = new FlowApproveParam(tbDingApply.getFlowDeploymentId(), FlowApprovePassEnum.START, approveUserIds, crmNo);
|
|
|
+ FlowApproveParam flowApproveParam = new FlowApproveParam(tbDingApply.getFlowDeploymentId(),
|
|
|
+ FlowApprovePassEnum.START, approveUserIds, crmNo);
|
|
|
flowApproveParam.setApproveRemark(FlowApprovePassEnum.START.getTitle());
|
|
|
Map<String, Object> map = activitiService.taskApprove(flowApproveParam);
|
|
|
TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.FLOW_ENTITY);
|
|
|
if (!CollectionUtils.isEmpty(tbDingApply.getAttachmentIdList())) {
|
|
|
- List<BasicAttachment> basicAttachmentList = basicAttachmentService.listByIds(tbDingApply.getAttachmentIdList());
|
|
|
+ List<BasicAttachment> basicAttachmentList = basicAttachmentService.listByIds(
|
|
|
+ tbDingApply.getAttachmentIdList());
|
|
|
List<String> paths = new ArrayList<>(basicAttachmentList.size());
|
|
|
for (BasicAttachment b : basicAttachmentList) {
|
|
|
paths.add(basicAttachmentService.filePreview(b));
|
|
@@ -135,25 +138,33 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public IPage<DingApplyUnDoneResult> flowTaskUnDoneList(IPage<Map> iPage, Long serviceId, String name, Long supplierId, String customName, Long startTime, Long endTime, Long applyStartTime, Long applyEndTime) throws Exception {
|
|
|
+ public IPage<DingApplyUnDoneResult> flowTaskUnDoneList(IPage<Map> iPage, Long serviceId, String name,
|
|
|
+ Long supplierId, String customName, Long startTime, Long endTime, Long applyStartTime, Long applyEndTime)
|
|
|
+ throws Exception {
|
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
|
|
|
if (dpr.getHasThirdPmo()) {
|
|
|
// 乙方PMO
|
|
|
Long userSupplierId = requestUser.getSupplierId();
|
|
|
if (userSupplierId == null || userSupplierId == 0) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("请先在用户管理中绑定[%s]对应的供应商",RoleTypeEnum.THIRD_PMO.getDesc()));
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(
|
|
|
+ String.format("请先在用户管理中绑定[%s]对应的供应商", RoleTypeEnum.THIRD_PMO.getDesc()));
|
|
|
}
|
|
|
supplierId = userSupplierId;
|
|
|
}
|
|
|
- IPage<DingApplyUnDoneResult> dingApplyUnDoneResultIPage = this.baseMapper.flowTaskUnDoneList(iPage, serviceId, name, supplierId, customName, startTime, endTime, applyStartTime, applyEndTime, dpr);
|
|
|
- if (Objects.nonNull(dingApplyUnDoneResultIPage) && !CollectionUtils.isEmpty(dingApplyUnDoneResultIPage.getRecords())) {
|
|
|
+ IPage<DingApplyUnDoneResult> dingApplyUnDoneResultIPage = this.baseMapper.flowTaskUnDoneList(iPage, serviceId,
|
|
|
+ name, supplierId, customName, startTime, endTime, applyStartTime, applyEndTime, dpr);
|
|
|
+ if (Objects.nonNull(dingApplyUnDoneResultIPage) && !CollectionUtils.isEmpty(
|
|
|
+ dingApplyUnDoneResultIPage.getRecords())) {
|
|
|
for (DingApplyUnDoneResult d : dingApplyUnDoneResultIPage.getRecords()) {
|
|
|
TFFlowLog tfFlowLog = tfFlowLogService.findByLastFlowLog(d.getFlowId());
|
|
|
if (Objects.nonNull(tfFlowLog) && Objects.nonNull(tfFlowLog.getPendApproveId())) {
|
|
|
- List<String> userList = Arrays.asList(tfFlowLog.getPendApproveId().split(SystemConstant.LIST_JOIN_SPLIT));
|
|
|
- List<OrgUserNameDto> orgUserNameDtoList = sysUserService.findOrgUserName(userList.stream().map(s -> Long.parseLong(s)).collect(Collectors.toList()));
|
|
|
- List<String> userName = orgUserNameDtoList.stream().map(s -> s.getOrgUserName()).collect(Collectors.toList());
|
|
|
+ List<String> userList = Arrays.asList(
|
|
|
+ tfFlowLog.getPendApproveId().split(SystemConstant.LIST_JOIN_SPLIT));
|
|
|
+ List<OrgUserNameDto> orgUserNameDtoList = sysUserService.findOrgUserName(
|
|
|
+ userList.stream().map(s -> Long.parseLong(s)).collect(Collectors.toList()));
|
|
|
+ List<String> userName = orgUserNameDtoList.stream().map(s -> s.getOrgUserName())
|
|
|
+ .collect(Collectors.toList());
|
|
|
d.setApproveUserName(StringUtils.join(userName, SystemConstant.LIST_JOIN_SPLIT));
|
|
|
}
|
|
|
String taskIds = d.getTaskIdArray();
|
|
@@ -174,7 +185,8 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
}
|
|
|
} else if (Objects.nonNull(taskIds)) {
|
|
|
Task task = taskService.createTaskQuery().taskId(taskIds).singleResult();
|
|
|
- if (Objects.nonNull(task.getAssignee()) && task.getAssignee().equals(requestUser.getId().toString())) {
|
|
|
+ if (Objects.nonNull(task.getAssignee()) && task.getAssignee()
|
|
|
+ .equals(requestUser.getId().toString())) {
|
|
|
d.setMyself(true);
|
|
|
} else {
|
|
|
List<IdentityLink> identityLinkList = taskService.getIdentityLinksForTask(task.getId());
|
|
@@ -209,25 +221,33 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public IPage<DingApplyDoneResult> flowTaskDoneList(IPage<Map> iPage, Long serviceId, String name, Long supplierId, DingExceptionApproveEnum dingExceptionApprove, String customName, Long startTime, Long endTime, Long applyStartTime, Long applyEndTime) throws Exception {
|
|
|
+ public IPage<DingApplyDoneResult> flowTaskDoneList(IPage<Map> iPage, Long serviceId, String name, Long supplierId,
|
|
|
+ DingExceptionApproveEnum dingExceptionApprove, String customName, Long startTime, Long endTime,
|
|
|
+ Long applyStartTime, Long applyEndTime) throws Exception {
|
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
|
|
|
if (dpr.getHasThirdPmo()) {
|
|
|
// 乙方PMO
|
|
|
Long userSupplierId = requestUser.getSupplierId();
|
|
|
if (userSupplierId == null || userSupplierId == 0) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("请先在用户管理中绑定[%s]对应的供应商",RoleTypeEnum.THIRD_PMO.getDesc()));
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(
|
|
|
+ String.format("请先在用户管理中绑定[%s]对应的供应商", RoleTypeEnum.THIRD_PMO.getDesc()));
|
|
|
}
|
|
|
supplierId = userSupplierId;
|
|
|
}
|
|
|
- IPage<DingApplyDoneResult> dingApplyDoneResultIPage = this.baseMapper.flowTaskDoneList(iPage, serviceId, name, supplierId, Objects.nonNull(dingExceptionApprove) ? dingExceptionApprove.name() : null, customName, startTime, endTime, applyStartTime, applyEndTime, dpr);
|
|
|
- if (Objects.nonNull(dingApplyDoneResultIPage) && !CollectionUtils.isEmpty(dingApplyDoneResultIPage.getRecords())) {
|
|
|
+ IPage<DingApplyDoneResult> dingApplyDoneResultIPage = this.baseMapper.flowTaskDoneList(iPage, serviceId, name,
|
|
|
+ supplierId, Objects.nonNull(dingExceptionApprove) ? dingExceptionApprove.name() : null, customName,
|
|
|
+ startTime, endTime, applyStartTime, applyEndTime, dpr);
|
|
|
+ if (Objects.nonNull(dingApplyDoneResultIPage) && !CollectionUtils.isEmpty(
|
|
|
+ dingApplyDoneResultIPage.getRecords())) {
|
|
|
for (DingApplyDoneResult d : dingApplyDoneResultIPage.getRecords()) {
|
|
|
String string = tfFlowLogService.findByLastFlowLogApproveUser(d.getFlowId());
|
|
|
if (Objects.nonNull(string)) {
|
|
|
List<String> userList = Arrays.asList(string.split(SystemConstant.LIST_JOIN_SPLIT));
|
|
|
- List<OrgUserNameDto> orgUserNameDtoList = sysUserService.findOrgUserName(userList.stream().map(s -> Long.parseLong(s)).collect(Collectors.toList()));
|
|
|
- List<String> userName = orgUserNameDtoList.stream().map(s -> s.getOrgUserName()).collect(Collectors.toList());
|
|
|
+ List<OrgUserNameDto> orgUserNameDtoList = sysUserService.findOrgUserName(
|
|
|
+ userList.stream().map(s -> Long.parseLong(s)).collect(Collectors.toList()));
|
|
|
+ List<String> userName = orgUserNameDtoList.stream().map(s -> s.getOrgUserName())
|
|
|
+ .collect(Collectors.toList());
|
|
|
d.setApproveUsersName(StringUtils.join(userName, SystemConstant.LIST_JOIN_SPLIT));
|
|
|
}
|
|
|
if (Objects.nonNull(d.getApproveInfo())) {
|
|
@@ -252,7 +272,8 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Boolean flowApprove(Long taskId, DingExceptionApproveEnum dingExceptionApprove, Long userId) throws InterruptedException {
|
|
|
+ public Boolean flowApprove(Long taskId, DingExceptionApproveEnum dingExceptionApprove, Long userId)
|
|
|
+ throws InterruptedException {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
userId = Objects.nonNull(sysUser) ? sysUser.getId() : userId;
|
|
|
TBDingApplyService tbDingApplyService = SpringContextHolder.getBean(TBDingApplyService.class);
|
|
@@ -270,8 +291,15 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
@Transactional
|
|
|
public Boolean updateDingExceptionTime(TBDingApply tbDingApply, DingExceptionApproveEnum dingExceptionApprove) {
|
|
|
if (dingExceptionApprove == DingExceptionApproveEnum.PASS) {
|
|
|
- TBDing tbDing = tbDingService.getById(tbDingApply.getDingId());
|
|
|
+ TBDing tbDing = null;
|
|
|
+ if (Objects.isNull(tbDingApply.getDingId())) {
|
|
|
+ tbDing = tbDingService.getOne(
|
|
|
+ new QueryWrapper<TBDing>().lambda().eq(TBDing::getSopNo, tbDingApply.getSopNo()));
|
|
|
+ } else {
|
|
|
+ tbDing = tbDingService.getById(tbDingApply.getDingId());
|
|
|
+ }
|
|
|
if (Objects.nonNull(tbDing)) {
|
|
|
+ tbDingApply.setDingId(tbDing.getId());
|
|
|
if (tbDingApply.getType() == InOutTypeEnum.IN) {
|
|
|
tbDing.setSignInTime(tbDingApply.getApplyTime());
|
|
|
tbDing.setSignInAddress("(补卡)");
|
|
@@ -281,7 +309,8 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
}
|
|
|
tbDingService.updateById(tbDing);
|
|
|
} else {
|
|
|
- TBCrm tbCrm = tbCrmService.getOne(new QueryWrapper<TBCrm>().lambda().eq(TBCrm::getCrmNo, tbDingApply.getCrmNo()));
|
|
|
+ TBCrm tbCrm = tbCrmService.getOne(
|
|
|
+ new QueryWrapper<TBCrm>().lambda().eq(TBCrm::getCrmNo, tbDingApply.getCrmNo()));
|
|
|
Optional.ofNullable(tbCrm).orElseThrow(ExceptionResultEnum.CRM_NO_NO_DATA::exception);
|
|
|
|
|
|
SysUser sysUser = sysUserService.getById(tbDingApply.getCreateId());
|
|
@@ -291,13 +320,20 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
if (CollectionUtils.isEmpty(sysRoleList)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("用户角色不存在");
|
|
|
}
|
|
|
- TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, tbDingApply.getSopNo()));
|
|
|
+ TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
|
|
|
+ new QueryWrapper<TFCustomFlowEntity>().lambda()
|
|
|
+ .eq(TFCustomFlowEntity::getCode, tbDingApply.getSopNo()));
|
|
|
Optional.ofNullable(tfCustomFlowEntity).orElseThrow(ExceptionResultEnum.FLOW_ENTITY_NO_DATA::exception);
|
|
|
|
|
|
- TBUserArchives tbUserArchives = tbUserArchivesService.getOne(new QueryWrapper<TBUserArchives>().lambda().eq(TBUserArchives::getMobileNumber, sysUser.getMobileNumber()));
|
|
|
- tbDing = new TBDing(tbDingApply.getSopNo(), tbDingApply.getCrmNo(), tbCrm.getServiceId(), tbUserArchives.getId(), sysRoleList.get(0).getType(), sysUser.getId(), tfCustomFlowEntity.getFlowId());
|
|
|
- tbDing.setSignDate(DateFormatUtils.format(tbDingApply.getApplyTime(), SystemConstant.DEFAULT_DATE_DAY_PATTERN));
|
|
|
- tbDing.setSignYear(DateFormatUtils.format(tbDingApply.getApplyTime(), SystemConstant.DEFAULT_DATE_YEAR_PATTERN));
|
|
|
+ TBUserArchives tbUserArchives = tbUserArchivesService.getOne(new QueryWrapper<TBUserArchives>().lambda()
|
|
|
+ .eq(TBUserArchives::getMobileNumber, sysUser.getMobileNumber()));
|
|
|
+ tbDing = new TBDing(tbDingApply.getSopNo(), tbDingApply.getCrmNo(), tbCrm.getServiceId(),
|
|
|
+ tbUserArchives.getId(), sysRoleList.get(0).getType(), sysUser.getId(),
|
|
|
+ tfCustomFlowEntity.getFlowId());
|
|
|
+ tbDing.setSignDate(
|
|
|
+ DateFormatUtils.format(tbDingApply.getApplyTime(), SystemConstant.DEFAULT_DATE_DAY_PATTERN));
|
|
|
+ tbDing.setSignYear(
|
|
|
+ DateFormatUtils.format(tbDingApply.getApplyTime(), SystemConstant.DEFAULT_DATE_YEAR_PATTERN));
|
|
|
if (tbDingApply.getType() == InOutTypeEnum.IN) {
|
|
|
tbDing.setSignInTime(tbDingApply.getApplyTime());
|
|
|
tbDing.setSignInAddress("(补卡)");
|
|
@@ -324,7 +360,8 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Boolean flowBatchApprove(List<Long> taskIds, DingExceptionApproveEnum dingExceptionApprove, Long userId) throws InterruptedException {
|
|
|
+ public Boolean flowBatchApprove(List<Long> taskIds, DingExceptionApproveEnum dingExceptionApprove, Long userId)
|
|
|
+ throws InterruptedException {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
userId = Objects.nonNull(sysUser) ? sysUser.getId() : userId;
|
|
|
TBDingApplyService tbDingApplyService = SpringContextHolder.getBean(TBDingApplyService.class);
|
|
@@ -344,7 +381,8 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
* @throws InterruptedException
|
|
|
*/
|
|
|
@Override
|
|
|
- public Boolean taskApprove(Long taskId, Long userId, DingExceptionApproveEnum dingExceptionApprove) throws InterruptedException {
|
|
|
+ public Boolean taskApprove(Long taskId, Long userId, DingExceptionApproveEnum dingExceptionApprove)
|
|
|
+ throws InterruptedException {
|
|
|
Optional.ofNullable(taskId).orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_ID_IS_NULL.exception());
|
|
|
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
@@ -352,24 +390,33 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_NO_DATA.exception());
|
|
|
|
|
|
List<String> taskApproveUserList = activitiService.getTaskApprove(task);
|
|
|
- if (!CollectionUtils.isEmpty(taskApproveUserList) && !taskApproveUserList.contains(sysUser.getId().toString())) {
|
|
|
+ if (!CollectionUtils.isEmpty(taskApproveUserList) && !taskApproveUserList.contains(
|
|
|
+ sysUser.getId().toString())) {
|
|
|
throw ExceptionResultEnum.FLOW_DATA_NOT_ME.exception();
|
|
|
}
|
|
|
|
|
|
- TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getFlowId, Long.parseLong(task.getProcessInstanceId())));
|
|
|
+ TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
|
|
|
+ new QueryWrapper<TFCustomFlowEntity>().lambda()
|
|
|
+ .eq(TFCustomFlowEntity::getFlowId, Long.parseLong(task.getProcessInstanceId())));
|
|
|
Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
|
|
|
|
|
|
- TBDingApply tbDingApply = this.getOne(new QueryWrapper<TBDingApply>().lambda().eq(TBDingApply::getDingExceptionNo, tfCustomFlowEntity.getCode()));
|
|
|
+ TBDingApply tbDingApply = this.getOne(new QueryWrapper<TBDingApply>().lambda()
|
|
|
+ .eq(TBDingApply::getDingExceptionNo, tfCustomFlowEntity.getCode()));
|
|
|
Optional.ofNullable(tbDingApply).orElseThrow(() -> ExceptionResultEnum.DING_APPLY_NO_DATA.exception());
|
|
|
|
|
|
- CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tfCustomFlowEntity.getCode(), tfCustomFlowEntity.getCrmNo());
|
|
|
+ CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tfCustomFlowEntity.getCode(),
|
|
|
+ tfCustomFlowEntity.getCrmNo());
|
|
|
Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
- Optional.ofNullable(crmProjectResult.getRegionCoordinatorId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("crm区域协调人数据为空"));
|
|
|
+ Optional.ofNullable(crmProjectResult.getRegionCoordinatorId())
|
|
|
+ .orElseThrow(() -> ExceptionResultEnum.ERROR.exception("crm区域协调人数据为空"));
|
|
|
|
|
|
- List<String> sysUserRoleList = sysUserRoleService.listByServiceId(crmProjectResult.getServiceUnitId(), tbDingApply.getCreateId(), tbDingApply.getSopNo());
|
|
|
+ List<String> sysUserRoleList = sysUserRoleService.listByServiceId(crmProjectResult.getServiceUnitId(),
|
|
|
+ tbDingApply.getCreateId(), tbDingApply.getSopNo());
|
|
|
List<String> approveUserIds = new ArrayList<>();
|
|
|
approveUserIds.addAll(sysUserRoleList);
|
|
|
- activitiService.taskApprove(new FlowApproveParam(taskId, FlowApprovePassEnum.PASS, approveUserIds, tfCustomFlowEntity.getCrmNo(), dingExceptionApprove.getTitle()));
|
|
|
+ activitiService.taskApprove(
|
|
|
+ new FlowApproveParam(taskId, FlowApprovePassEnum.PASS, approveUserIds, tfCustomFlowEntity.getCrmNo(),
|
|
|
+ dingExceptionApprove.getTitle()));
|
|
|
|
|
|
TBDingApplyService tbDingApplyService = SpringContextHolder.getBean(TBDingApplyService.class);
|
|
|
return tbDingApplyService.updateDingExceptionTime(tbDingApply, dingExceptionApprove);
|
|
@@ -386,14 +433,18 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
TBDingApply tbDingApply = this.getById(id);
|
|
|
Optional.ofNullable(tbDingApply).orElseThrow(() -> ExceptionResultEnum.DING_APPLY_NO_DATA.exception());
|
|
|
|
|
|
- CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tbDingApply.getSopNo(), tbDingApply.getCrmNo());
|
|
|
+ CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(tbDingApply.getSopNo(),
|
|
|
+ tbDingApply.getCrmNo());
|
|
|
Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
|
|
|
|
|
|
- TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, tbDingApply.getDingExceptionNo()));
|
|
|
+ TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
|
|
|
+ new QueryWrapper<TFCustomFlowEntity>().lambda()
|
|
|
+ .eq(TFCustomFlowEntity::getCode, tbDingApply.getDingExceptionNo()));
|
|
|
Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
|
|
|
|
|
|
//获取当前流程节点
|
|
|
- TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda().eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
|
|
|
+ TFFlowApprove tfFlowApprove = tfFlowApproveService.getOne(new QueryWrapper<TFFlowApprove>().lambda()
|
|
|
+ .eq(TFFlowApprove::getFlowId, tfCustomFlowEntity.getFlowId()));
|
|
|
Optional.ofNullable(tfFlowApprove).orElseThrow(() -> ExceptionResultEnum.FLOW_APPROVE_NO_DATA.exception());
|
|
|
|
|
|
FlowResult flowResult = JSONObject.parseObject(tfCustomFlowEntity.getFlowProcessVar(), FlowResult.class);
|
|
@@ -407,8 +458,10 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
Map<Integer, Integer> approveSetupMap = new HashMap<>();
|
|
|
List<TFFlowLogResult> tfFlowLogResultList = tfFlowLogService.findByObjectId(tfCustomFlowEntity.getId());
|
|
|
if (!CollectionUtils.isEmpty(tfFlowLogResultList)) {
|
|
|
- flowApproveHistoryList = GsonUtil.fromJson(GsonUtil.toJson(tfFlowLogResultList), new TypeToken<List<TFFlowViewLogResult>>() {
|
|
|
- }.getType());
|
|
|
+ flowApproveHistoryList = GsonUtil.fromJson(GsonUtil.toJson(tfFlowLogResultList),
|
|
|
+ new TypeToken<List<TFFlowViewLogResult>>() {
|
|
|
+
|
|
|
+ }.getType());
|
|
|
for (TFFlowViewLogResult t : flowApproveHistoryList) {
|
|
|
t.setMessageType(FlowMsgTypeEnum.STANDARD);
|
|
|
approveSetupMap.put(t.getApproveSetup(), t.getApproveSetup());
|
|
@@ -421,14 +474,18 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
FlowTaskResult flowTaskResult = GsonUtil.fromJson(GsonUtil.toJson(entry.getValue()), FlowTaskResult.class);
|
|
|
if (flowTaskResult.getSetup() > 0) {
|
|
|
//正在审批的表单
|
|
|
- if (Objects.nonNull(tfFlowApprove.getSetup()) && flowTaskResult.getSetup().intValue() == tfFlowApprove.getSetup().intValue()) {
|
|
|
+ if (Objects.nonNull(tfFlowApprove.getSetup())
|
|
|
+ && flowTaskResult.getSetup().intValue() == tfFlowApprove.getSetup().intValue()) {
|
|
|
currFlowTaskResult = flowTaskResult;
|
|
|
- List<Task> taskList = taskService.createTaskQuery().processInstanceId(String.valueOf(tfCustomFlowEntity.getFlowId())).list();
|
|
|
+ List<Task> taskList = taskService.createTaskQuery()
|
|
|
+ .processInstanceId(String.valueOf(tfCustomFlowEntity.getFlowId())).list();
|
|
|
if (!CollectionUtils.isEmpty(taskList)) {
|
|
|
taskIdList = taskList.stream().map(s -> Long.parseLong(s.getId())).collect(Collectors.toList());
|
|
|
}
|
|
|
} else if (approveSetupMap.containsKey(flowTaskResult.getSetup())) {//已经审批过的表单
|
|
|
- flowTaskHistoryList = CollectionUtils.isEmpty(flowTaskHistoryList) ? new ArrayList<>(approveSetupMap.size()) : flowTaskHistoryList;
|
|
|
+ flowTaskHistoryList = CollectionUtils.isEmpty(flowTaskHistoryList) ?
|
|
|
+ new ArrayList<>(approveSetupMap.size()) :
|
|
|
+ flowTaskHistoryList;
|
|
|
flowTaskHistoryList.add(flowTaskResult);
|
|
|
}
|
|
|
}
|
|
@@ -436,14 +493,17 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
|
TFFlowLog tfFlowLog = tfFlowLogService.findByLastFlowLog(tfFlowApprove.getFlowId());
|
|
|
if (Objects.nonNull(tfFlowLog) && Objects.nonNull(tfFlowLog.getPendApproveId())) {
|
|
|
List<String> userList = Arrays.asList(tfFlowLog.getPendApproveId().split(SystemConstant.LIST_JOIN_SPLIT));
|
|
|
- List<OrgUserNameDto> orgUserNameDtoList = sysUserService.findOrgUserName(userList.stream().map(s -> Long.parseLong(s)).collect(Collectors.toList()));
|
|
|
- List<String> userName = orgUserNameDtoList.stream().map(s -> s.getOrgUserName()).collect(Collectors.toList());
|
|
|
+ List<OrgUserNameDto> orgUserNameDtoList = sysUserService.findOrgUserName(
|
|
|
+ userList.stream().map(s -> Long.parseLong(s)).collect(Collectors.toList()));
|
|
|
+ List<String> userName = orgUserNameDtoList.stream().map(s -> s.getOrgUserName())
|
|
|
+ .collect(Collectors.toList());
|
|
|
tbDingApply.setApproveUserName(StringUtils.join(userName, SystemConstant.LIST_JOIN_SPLIT));
|
|
|
}
|
|
|
TBDing tbDing = tbDingService.getById(tbDingApply.getDingId());
|
|
|
if (Objects.nonNull(tbDing)) {
|
|
|
tbDingApply.setExceptionTime(tbDing.getSignDate());
|
|
|
}
|
|
|
- return new TBDingApplyViewResult(crmProjectResult, tbDingApply, taskIdList, flowTaskHistoryList, currFlowTaskResult, flowApproveHistoryList);
|
|
|
+ return new TBDingApplyViewResult(crmProjectResult, tbDingApply, taskIdList, flowTaskHistoryList,
|
|
|
+ currFlowTaskResult, flowApproveHistoryList);
|
|
|
}
|
|
|
}
|