|
@@ -1,29 +1,43 @@
|
|
|
package org.springblade.business.feignClient;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springblade.archive.dto.ArchiveTaskDTO;
|
|
|
+import org.springblade.archive.dto.SendsWebSocketArchiveDTO;
|
|
|
import org.springblade.archive.entity.ArchivesAuto;
|
|
|
+import org.springblade.archive.vo.ArchiveTaskPageVO;
|
|
|
import org.springblade.archive.vo.ArchivesAutoVO;
|
|
|
import org.springblade.business.entity.ArchiveFile;
|
|
|
import org.springblade.business.feign.ArchiveFileClient;
|
|
|
import org.springblade.business.mapper.ArchiveFileMapper;
|
|
|
import org.springblade.business.service.IArchiveFileService;
|
|
|
import org.springblade.business.service.ITaskService;
|
|
|
+import org.springblade.business.socket.WebSocket;
|
|
|
import org.springblade.business.vo.ArchiveFileVO;
|
|
|
+import org.springblade.business.vo.TaskQueryVO;
|
|
|
+import org.springblade.business.vo.TaskVO;
|
|
|
import org.springblade.common.utils.FileUtils;
|
|
|
import org.springblade.common.vo.FileSize;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
+import org.springblade.core.secure.utils.SecureUtil;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.manager.entity.ContractInfo;
|
|
|
import org.springblade.manager.feign.ContractClient;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
@@ -35,10 +49,12 @@ public class ArchiveFileClientImpl implements ArchiveFileClient {
|
|
|
|
|
|
private final ArchiveFileMapper fileMapper;
|
|
|
|
|
|
- private ContractClient contractClient;
|
|
|
+ private final ContractClient contractClient;
|
|
|
|
|
|
private final ITaskService iTaskService;
|
|
|
|
|
|
+ private final WebSocket webSocket;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public void saveArchiveFile(ArchiveFileVO vo) {
|
|
@@ -165,7 +181,7 @@ public class ArchiveFileClientImpl implements ArchiveFileClient {
|
|
|
System.out.println(type);
|
|
|
}
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
List<ArchivesAutoVO> autos = fileMapper.getAllArchiveAutoByContractType(projectId);
|
|
|
for (ArchivesAutoVO l : autos) {
|
|
|
String type = l.getContractType();
|
|
@@ -279,9 +295,9 @@ public class ArchiveFileClientImpl implements ArchiveFileClient {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean updateRectificationById(Long id,Integer rectification) {
|
|
|
+ public boolean updateRectificationById(Long id, Integer rectification) {
|
|
|
try {
|
|
|
- fileMapper.updateRectificationById(id,rectification);
|
|
|
+ fileMapper.updateRectificationById(id, rectification);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return false;
|
|
@@ -297,7 +313,7 @@ public class ArchiveFileClientImpl implements ArchiveFileClient {
|
|
|
|
|
|
@Override
|
|
|
public void addOrUpdateArchiveFileBusinessData(Long nodeId, Long keyId, Long contractId, String formDataId) {
|
|
|
- iTaskService.addOrUpdateArchiveFileBusinessData(nodeId,keyId,contractId,formDataId);
|
|
|
+ iTaskService.addOrUpdateArchiveFileBusinessData(nodeId, keyId, contractId, formDataId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -315,4 +331,30 @@ public class ArchiveFileClientImpl implements ArchiveFileClient {
|
|
|
return fileMapper.getListByContractId(contractId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void sendWebSocketArchiveMsg(SendsWebSocketArchiveDTO webSocketArchiveDTO) throws IOException {
|
|
|
+ Integer pageTotal = webSocketArchiveDTO.getPageTotal();
|
|
|
+ Integer type = webSocketArchiveDTO.getType();
|
|
|
+ ArchiveTaskDTO dto = webSocketArchiveDTO.getDto();
|
|
|
+ if (ObjectUtil.isEmpty(dto.getCurrentContractId())) {
|
|
|
+ //如果getCurrentContractId=null,那么表示是APP的待办查询(web端不为null)
|
|
|
+ dto.setCurrentContractId(dto.getContractIdValue());
|
|
|
+ }
|
|
|
+ if (type == 1) {
|
|
|
+ Map<String, String> stringMap = iTaskService.getTaskCountArchive(dto.getProjectIdValue().toString(), dto.getCurrentContractId().toString(), SecureUtil.getUserId().toString());
|
|
|
+ stringMap.put("taskCount", String.valueOf(pageTotal));
|
|
|
+ long messageCount = Long.parseLong(stringMap.get("messageCount"));
|
|
|
+ long taskCount = Long.parseLong(stringMap.get("taskCount"));
|
|
|
+ stringMap.put("allCount", String.valueOf(messageCount + taskCount));
|
|
|
+ webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
|
|
|
+ } else if (type == 2) {
|
|
|
+ Map<String, String> stringMap = iTaskService.getTaskCountArchive(dto.getProjectIdValue().toString(), dto.getCurrentContractId().toString(), SecureUtil.getUserId().toString());
|
|
|
+ stringMap.put("taskCount", "0");
|
|
|
+ long messageCount = Long.parseLong(stringMap.get("messageCount"));
|
|
|
+ long taskCount = Long.parseLong(stringMap.get("taskCount"));
|
|
|
+ stringMap.put("allCount", String.valueOf(messageCount + taskCount));
|
|
|
+ webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|