|
@@ -1,21 +1,6 @@
|
|
|
-/*
|
|
|
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
|
|
- *
|
|
|
- * Redistribution and use in source and binary forms, with or without
|
|
|
- * modification, are permitted provided that the following conditions are met:
|
|
|
- *
|
|
|
- * Redistributions of source code must retain the above copyright notice,
|
|
|
- * this list of conditions and the following disclaimer.
|
|
|
- * Redistributions in binary form must reproduce the above copyright
|
|
|
- * notice, this list of conditions and the following disclaimer in the
|
|
|
- * documentation and/or other materials provided with the distribution.
|
|
|
- * Neither the name of the dreamlu.net developer nor the names of its
|
|
|
- * contributors may be used to endorse or promote products derived from
|
|
|
- * this software without specific prior written permission.
|
|
|
- * Author: Chill 庄骞 (smallchill@163.com)
|
|
|
- */
|
|
|
package org.springblade.business.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -23,7 +8,6 @@ import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.http.client.utils.DateUtils;
|
|
|
import org.springblade.business.entity.UserOpinion;
|
|
|
import org.springblade.business.entity.UserOpinionFile;
|
|
|
-import org.springblade.business.entity.UserOpinionFlow;
|
|
|
import org.springblade.business.service.IUserOpinionCommentsService;
|
|
|
import org.springblade.business.service.IUserOpinionFileService;
|
|
|
import org.springblade.business.service.IUserOpinionFlowService;
|
|
@@ -32,17 +16,18 @@ import org.springblade.business.vo.UserOpinionFlowVO;
|
|
|
import org.springblade.business.vo.UserOpinionVO;
|
|
|
import org.springblade.business.mapper.UserOpinionMapper;
|
|
|
import org.springblade.business.service.IUserOpinionService;
|
|
|
+import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
+import org.springblade.core.mp.support.Condition;
|
|
|
+import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.secure.BladeUser;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Iterator;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -64,16 +49,26 @@ public class UserOpinionServiceImpl extends BaseServiceImpl<UserOpinionMapper, U
|
|
|
private final IUserClient userClient;
|
|
|
|
|
|
@Override
|
|
|
- public List<BusinessUserOpinionVO> queryBusinessUserOpinionList(String currentUserId) {
|
|
|
+ public IPage<BusinessUserOpinionVO> queryBusinessUserOpinionListAll(Query query) {
|
|
|
+ return this.queryBusinessUserOpinionList(null, query);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IPage<BusinessUserOpinionVO> queryBusinessUserOpinionList(String currentUserId, Query query) {
|
|
|
//获取分配给当前用户的工单
|
|
|
List<BusinessUserOpinionVO> businessUserOpinionVOS = this.baseMapper.queryManageUserOpinionList(currentUserId);
|
|
|
if(businessUserOpinionVOS != null && businessUserOpinionVOS.size() > 0){
|
|
|
+ //先分组
|
|
|
+ List<List<BusinessUserOpinionVO>> resultList = CommonUtil.getBatchSize(businessUserOpinionVOS, query.getSize());
|
|
|
+ //获取具体页数下的数据
|
|
|
+ List<BusinessUserOpinionVO> finalResult = resultList.get(query.getCurrent() - 1);
|
|
|
+
|
|
|
//获取得到的工单所关联的所有附件
|
|
|
- List<Long> userOpinionKeys = businessUserOpinionVOS.stream().map(BusinessUserOpinionVO::getUserOpinionId).distinct().collect(Collectors.toList());
|
|
|
+ List<Long> userOpinionKeys = finalResult.stream().map(BusinessUserOpinionVO::getUserOpinionId).distinct().collect(Collectors.toList());
|
|
|
List<UserOpinionFile> allFile = this.userOpinionFileService.selectUserOpinionFileByUserOpinionKeys(userOpinionKeys);
|
|
|
|
|
|
//设置附件信息
|
|
|
- businessUserOpinionVOS.forEach(vo -> {
|
|
|
+ finalResult.forEach(vo -> {
|
|
|
List<String> imageUrls = new ArrayList<>();
|
|
|
if(allFile != null && allFile.size() > 0){
|
|
|
//处理附件信息
|
|
@@ -88,13 +83,8 @@ public class UserOpinionServiceImpl extends BaseServiceImpl<UserOpinionMapper, U
|
|
|
}
|
|
|
//设置附件信息
|
|
|
vo.setImageUrl(imageUrls);
|
|
|
- //设置当前用户操作权限(如果当前用户的流程次数和主表次数一致,认为可以操作)
|
|
|
- vo.setOperation(vo.getNumber().equals(vo.getNewNumber()));
|
|
|
|
|
|
//获取当前工单最新状态
|
|
|
- if(new Long("4336330718665349716").equals(vo.getUserOpinionId())){
|
|
|
- int i = 0;
|
|
|
- }
|
|
|
List<UserOpinionFlowVO> newFlow = this.userOpinionFlowService.queryCurrentUserOpinionFlowByUserOpinionId(String.valueOf(vo.getUserOpinionId()), vo.getNewNumber());
|
|
|
if(newFlow != null && newFlow.size() > 0){
|
|
|
//获取退后阶段
|
|
@@ -105,6 +95,16 @@ public class UserOpinionServiceImpl extends BaseServiceImpl<UserOpinionMapper, U
|
|
|
//如果有权限则获取当前正在进行的操作环节
|
|
|
for(UserOpinionFlowVO flowVo : newFlow){
|
|
|
//依次找到正在执行的环节
|
|
|
+ if(new Integer("2").equals(flowVo.getSort())){
|
|
|
+ //设置当前用户操作权限(如果当前用户的流程次数和主表次数一致,认为可以操作)
|
|
|
+ if(StringUtils.isNotEmpty(currentUserId)){
|
|
|
+ vo.setOperation(vo.getNumber().equals(vo.getNewNumber()));
|
|
|
+ } else {
|
|
|
+ Long userId = AuthUtil.getUser().getUserId();
|
|
|
+ vo.setOperation(StringUtils.isNotEmpty(String.valueOf(userId)) && flowVo.getManageUser().equals(userId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if(new Integer("1").equals(flowVo.getIsCurrent())){
|
|
|
vo.setCurrentLinkId(flowVo.getId());
|
|
|
vo.setCurrentLink(flowVo.getSort());
|
|
@@ -113,8 +113,38 @@ public class UserOpinionServiceImpl extends BaseServiceImpl<UserOpinionMapper, U
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //获取当前时间以判断距离结束时间还剩多少分钟
|
|
|
+ try{
|
|
|
+ if(vo.getCurrentLinkId() == null || vo.getCurrentLink() == null || vo.getCurrentLinkId() == -1 || vo.getCurrentLink() == -1){
|
|
|
+ //说明已处理
|
|
|
+ vo.setTimeRemaining("已处理");
|
|
|
+ } else {
|
|
|
+ //未处理
|
|
|
+ Date manageDate = DateUtil.parseDate(vo.getManageTime()), nowDate = new Date();
|
|
|
+ long between = manageDate.getTime() - nowDate.getTime();
|
|
|
+ if(between > 0){
|
|
|
+ long day = between / (24 * 60 * 60 * 1000);
|
|
|
+ long hour = (between - (day * 24 * 60 * 60 * 1000)) / ( 60 * 60 * 1000);
|
|
|
+ long minute = (between - (day * 24 * 60 * 60 * 1000) - hour * 60 * 60 * 1000) / ( 60 * 1000);
|
|
|
+
|
|
|
+ vo.setTimeRemaining(day + "天" + hour + "小时" + minute + "分");
|
|
|
+ } else {
|
|
|
+ vo.setTimeRemaining("已超时");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
});
|
|
|
- return businessUserOpinionVOS;
|
|
|
+
|
|
|
+ //设置分页信息及结果数据
|
|
|
+ IPage<BusinessUserOpinionVO> page = Condition.getPage(query);
|
|
|
+ page.setTotal(businessUserOpinionVOS.size());
|
|
|
+ page.setRecords(finalResult);
|
|
|
+
|
|
|
+ return page;
|
|
|
}
|
|
|
|
|
|
return null;
|