fix: 统一追溯码并修正天河链存证跳转
This commit is contained in:
@@ -71,7 +71,7 @@ export class QueryTraceCodeDto extends PaginationDto {
|
||||
@IsInt()
|
||||
groupId?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: '关键词(追溯码/完整编码/档案号/作品名称)' })
|
||||
@ApiPropertyOptional({ description: '关键词(追溯码/档案号/作品名称)' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
keyword?: string;
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import { Processor, WorkerHost } from '@nestjs/bullmq';
|
||||
import { Logger } from '@nestjs/common';
|
||||
import { Job } from 'bullmq';
|
||||
import { customAlphabet } from 'nanoid';
|
||||
import { BatchStatus, JobStatus, QUEUE_NAMES } from '@artveris/shared';
|
||||
import { PrismaService } from '../prisma/prisma.service';
|
||||
import { JobsService } from '../jobs/jobs.service';
|
||||
import { TraceCodeService } from './trace-code.service';
|
||||
import { TraceCodeGeneratorService } from './trace-code-generator.service';
|
||||
|
||||
const ALPHABET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
||||
const codeId = customAlphabet(ALPHABET, 18);
|
||||
|
||||
interface GenJobData {
|
||||
batchId: number;
|
||||
artworkId: number;
|
||||
@@ -45,7 +41,6 @@ export class GenCodeProcessor extends WorkerHost {
|
||||
const shortCodes = await this.generator.generate(n);
|
||||
const rows = shortCodes.map((shortCode) => {
|
||||
return {
|
||||
code: codeId(),
|
||||
shortCode,
|
||||
artworkId,
|
||||
batchId,
|
||||
|
||||
@@ -409,7 +409,6 @@ export class TraceCodeService {
|
||||
and.push({
|
||||
OR: [
|
||||
{ shortCode: { contains: query.keyword } },
|
||||
{ code: { contains: query.keyword } },
|
||||
{ url: { contains: query.keyword } },
|
||||
{ remark: { contains: query.keyword } },
|
||||
{ artwork: { archiveNo: { contains: query.keyword } } },
|
||||
@@ -508,7 +507,6 @@ export class TraceCodeService {
|
||||
{ header: '批次编号', key: 'batchNo', width: 22 },
|
||||
{ header: '分组', key: 'group', width: 14 },
|
||||
{ header: '追溯码', key: 'shortCode', width: 16 },
|
||||
{ header: '完整编码', key: 'code', width: 24 },
|
||||
{ header: '链接', key: 'url', width: 40 },
|
||||
{ header: '二维码', key: 'qr', width: 18 },
|
||||
{ header: '生成时间', key: 'createdAt', width: 22 },
|
||||
@@ -525,7 +523,6 @@ export class TraceCodeService {
|
||||
title: c.artwork?.title ?? '',
|
||||
batchNo: c.batch?.batchNo ?? '',
|
||||
group: c.group?.name ?? '',
|
||||
code: c.code,
|
||||
shortCode: c.shortCode,
|
||||
url: { text: url, hyperlink: url },
|
||||
qr: '',
|
||||
@@ -540,7 +537,7 @@ export class TraceCodeService {
|
||||
qrImages.push({ name: `images/${c.shortCode}.png`, buffer: qr });
|
||||
const imageId = wb.addImage({ buffer: qr as unknown as ExcelJS.Buffer, extension: 'png' });
|
||||
ws.addImage(imageId, {
|
||||
tl: { col: 7.15, row: row.number - 0.9 },
|
||||
tl: { col: 6.15, row: row.number - 0.9 },
|
||||
ext: { width: 84, height: 84 },
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user