|
@@ -87,9 +87,6 @@ public class GenerateCodeConsumer {
|
|
@Autowired
|
|
@Autowired
|
|
private RedissonClient redissonClient;
|
|
private RedissonClient redissonClient;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private TableStorePlusUtils tableStorePlusUtils;
|
|
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private QrPackageBatchMapper qrPackageBatchMapper;
|
|
private QrPackageBatchMapper qrPackageBatchMapper;
|
|
|
|
|
|
@@ -99,9 +96,6 @@ public class GenerateCodeConsumer {
|
|
@Autowired
|
|
@Autowired
|
|
private BaseFactoryMapper baseFactoryMapper;
|
|
private BaseFactoryMapper baseFactoryMapper;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private QrBoxCodeFormatMapper boxCodeFormatMapper;
|
|
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private QrBoxCodeFormatSplitMapper qrBoxCodeFormatSplitMapper;
|
|
private QrBoxCodeFormatSplitMapper qrBoxCodeFormatSplitMapper;
|
|
|
|
|
|
@@ -144,12 +138,8 @@ public class GenerateCodeConsumer {
|
|
|
|
|
|
@SneakyThrows
|
|
@SneakyThrows
|
|
@RabbitHandler
|
|
@RabbitHandler
|
|
- @RabbitListener(queues = GenerateCodeConsumer.GENERATE_CODE_BY_REPERTORY_QUEUE)
|
|
|
|
- public void onMessage(String id, Message message, Channel channel) {
|
|
|
|
- // 手工ack
|
|
|
|
- Long deliveryTag = (Long)message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
|
|
|
|
- channel.basicAck(deliveryTag, false);
|
|
|
|
-
|
|
|
|
|
|
+ @RabbitListener(queues = GenerateCodeConsumer.GENERATE_CODE_BY_REPERTORY_QUEUE,ackMode = "AUTO")
|
|
|
|
+ public void onMessage(String id) {
|
|
//判断rabbit消息是否为空
|
|
//判断rabbit消息是否为空
|
|
if(StringUtils.isEmpty(id)){
|
|
if(StringUtils.isEmpty(id)){
|
|
throw new BusinessException("队列监听数据为空!");
|
|
throw new BusinessException("队列监听数据为空!");
|
|
@@ -177,10 +167,6 @@ public class GenerateCodeConsumer {
|
|
qrPackage.setId(Long.parseLong(id));
|
|
qrPackage.setId(Long.parseLong(id));
|
|
qrPackage.setGenerateStatus(QrPackageGenerateStatusEnum.GENERATE_FAIL.getCode());
|
|
qrPackage.setGenerateStatus(QrPackageGenerateStatusEnum.GENERATE_FAIL.getCode());
|
|
qrPackageService.failedRollback(qrPackage);
|
|
qrPackageService.failedRollback(qrPackage);
|
|
- } finally {
|
|
|
|
- // 手工ack
|
|
|
|
-// Long deliveryTag = (Long)message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
|
|
|
|
-// channel.basicAck(deliveryTag, false);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -189,6 +175,7 @@ public class GenerateCodeConsumer {
|
|
*/
|
|
*/
|
|
private void loopGenerateCode(Long qrPackageId) {
|
|
private void loopGenerateCode(Long qrPackageId) {
|
|
log.info("1 loopGenerateCode begin -->"+System.currentTimeMillis());
|
|
log.info("1 loopGenerateCode begin -->"+System.currentTimeMillis());
|
|
|
|
+ log.info("请求参数id为 -->{}",qrPackageId);
|
|
//0-查询码包,校验状态,标记生成中
|
|
//0-查询码包,校验状态,标记生成中
|
|
QrPackage qrPackage = qrPackageMapper.selectById(qrPackageId);
|
|
QrPackage qrPackage = qrPackageMapper.selectById(qrPackageId);
|
|
// 码数据已生成,return
|
|
// 码数据已生成,return
|
|
@@ -695,11 +682,8 @@ public class GenerateCodeConsumer {
|
|
if (groupSum < 0 || str.length() < groupSum){
|
|
if (groupSum < 0 || str.length() < groupSum){
|
|
result.add(str.toCharArray());
|
|
result.add(str.toCharArray());
|
|
}else {
|
|
}else {
|
|
-
|
|
|
|
int group = str.length() / groupSum ;
|
|
int group = str.length() / groupSum ;
|
|
-
|
|
|
|
int count = 0;
|
|
int count = 0;
|
|
-
|
|
|
|
while (true){
|
|
while (true){
|
|
if (result.size() + 1 == groupSum){
|
|
if (result.size() + 1 == groupSum){
|
|
result.add(str.substring(count * group).toCharArray());
|
|
result.add(str.substring(count * group).toCharArray());
|
|
@@ -708,9 +692,7 @@ public class GenerateCodeConsumer {
|
|
result.add(str.substring(count * group ,count * group + group ).toCharArray());
|
|
result.add(str.substring(count * group ,count * group + group ).toCharArray());
|
|
count ++ ;
|
|
count ++ ;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
}
|