feat:肇庆提交加锁

master
WenYongbin 3 weeks ago
parent 28a28d9d0d
commit 9637d26170

@ -34,6 +34,7 @@ import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.locks.ReentrantLock;
/** /**
* *
@ -60,8 +61,11 @@ public class ZqBusinessServiceImpl implements ZqBusinessService {
@Resource @Resource
private IdService idService; private IdService idService;
private final ReentrantLock SUBMIT_LOCK = new ReentrantLock();
@Override @Override
public MessageResponse recordSubmitHandle(Message message) { public MessageResponse recordSubmitHandle(Message message) {
SUBMIT_LOCK.lock();
try { try {
CollectTaskConfig.TaskConfig taskConfig = CollectTaskConfig.getTaskConfig("WS_RECORD_SUBMIT"); CollectTaskConfig.TaskConfig taskConfig = CollectTaskConfig.getTaskConfig("WS_RECORD_SUBMIT");
if (taskConfig == null || Func.isEmpty(taskConfig.getCollectorIds())) { if (taskConfig == null || Func.isEmpty(taskConfig.getCollectorIds())) {
@ -101,11 +105,14 @@ public class ZqBusinessServiceImpl implements ZqBusinessService {
MessageResponse response = new MessageResponse(ResultCode.FAILED.getCode(), fail("系统错误")); MessageResponse response = new MessageResponse(ResultCode.FAILED.getCode(), fail("系统错误"));
response.setRetry(1); response.setRetry(1);
return response; return response;
}finally {
SUBMIT_LOCK.unlock();
} }
} }
@Override @Override
public MessageResponse wsNurseSubmitHandle(Message message) { public MessageResponse wsNurseSubmitHandle(Message message) {
SUBMIT_LOCK.lock();
try { try {
CollectTaskConfig.TaskConfig taskConfig = CollectTaskConfig.getTaskConfig("WS_NURS_SUBMIT"); CollectTaskConfig.TaskConfig taskConfig = CollectTaskConfig.getTaskConfig("WS_NURS_SUBMIT");
if (taskConfig == null || Func.isEmpty(taskConfig.getCollectorIds())) { if (taskConfig == null || Func.isEmpty(taskConfig.getCollectorIds())) {
@ -150,6 +157,8 @@ public class ZqBusinessServiceImpl implements ZqBusinessService {
MessageResponse response = new MessageResponse(ResultCode.FAILED.getCode(), fail("系统错误")); MessageResponse response = new MessageResponse(ResultCode.FAILED.getCode(), fail("系统错误"));
response.setRetry(1); response.setRetry(1);
return response; return response;
}finally {
SUBMIT_LOCK.unlock();
} }
} }

@ -14,7 +14,9 @@ import com.docus.server.message.result.ResultUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import sun.misc.BASE64Encoder;
import java.io.FileInputStream;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -99,6 +101,24 @@ public class UnifyMessageServiceImpl implements UnifyMessageService {
return responseLis.get(0).getRespMessage(); return responseLis.get(0).getRespMessage();
} }
public static void main(String[] args) throws Exception {
String path="F:\\xiamen-jiashi\\pdf\\interface.pdf";
BASE64Encoder encoder = new BASE64Encoder();
FileInputStream inputStream2 = new FileInputStream(path);
System.out.println(inputStream2.available());
byte[] bytes2 = new byte[inputStream2.available()];
inputStream2.read(bytes2, 0, inputStream2.available());
inputStream2.close();
String base642 = encoder.encode(bytes2);
System.out.println(base642);
}
private UnifyMessage saveMessage(String method, String message) { private UnifyMessage saveMessage(String method, String message) {
UnifyMessage unifyMessage = new UnifyMessage(); UnifyMessage unifyMessage = new UnifyMessage();
unifyMessage.setId(idService.getDateSeq()); unifyMessage.setId(idService.getDateSeq());

Loading…
Cancel
Save