|
|
|
@ -99,7 +99,7 @@ public class PrintLabelRecordServiceImpl extends ServiceImpl<PrintLabelRecordMap |
|
|
|
// 判断是否需要打印SN |
|
|
|
Map<String,String> pictureMap = new HashMap<>(); |
|
|
|
if ("Hardware(Antenna)-Serials".equalsIgnoreCase(printLabelRecord.getCategory()) && "Y".equalsIgnoreCase(userEntity.getAutoSerialNumber())){ |
|
|
|
if (StringUtils.isEmpty(printLabelRecord.getTemplateNo())){ |
|
|
|
if (StringUtils.isEmpty(printLabelRecord.getTemplateNo()) && !Integer.valueOf(1).equals(printLabelRecord.getPrintLabelType())){ |
|
|
|
throw new RuntimeException("No template was selected"); |
|
|
|
} |
|
|
|
printLabelRecord.setCreateTime(new Date()); |
|
|
|
@ -201,41 +201,62 @@ public class PrintLabelRecordServiceImpl extends ServiceImpl<PrintLabelRecordMap |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public IPage<PrintLabelRecord> selectPrintLabelRecordPage(PrintLabelRecord printLabelRecord, Integer no, Integer size) { |
|
|
|
SysUserEntity userEntity = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
Page<PrintLabelRecord> page = new Page<>(no, size); |
|
|
|
printLabelRecord.setCreateBy(userEntity.getUsername()); |
|
|
|
IPage<PrintLabelRecord> iPage = baseMapper.selectPrintLabelRecordPage(page, printLabelRecord); |
|
|
|
// 获得当前登录用户 |
|
|
|
if ("Hardware(Antenna)-Serials".equalsIgnoreCase(printLabelRecord.getCategory()) && "Y".equalsIgnoreCase(userEntity.getAutoSerialNumber())){ |
|
|
|
for (PrintLabelRecord record : iPage.getRecords()) { |
|
|
|
if (!"Hardware(Antenna)-Serials".equals(record.getCategory())){ |
|
|
|
continue; |
|
|
|
} |
|
|
|
// 获取 认证 |
|
|
|
List<ExternalPartPicture> pictureList = externalPartPictureService.lambdaQuery() |
|
|
|
.eq(ExternalPartPicture::getPartNo, record.getPartNo()) |
|
|
|
.eq(ExternalPartPicture::getSite, record.getSite()) |
|
|
|
.eq(ExternalPartPicture::getTemplateNo, record.getTemplateNo()) |
|
|
|
.eq(ExternalPartPicture::getPictureClassify, "ProPicture") |
|
|
|
.list(); |
|
|
|
Map<String,String> pictureMap = new HashMap<>(); |
|
|
|
for (ExternalPartPicture picture : pictureList) { |
|
|
|
// 通过URL转Base64 |
|
|
|
String pictureUrl = picture.getPictureUrl(); |
|
|
|
// // 获得当前登录用户 |
|
|
|
// if ("Hardware(Antenna)-Serials".equalsIgnoreCase(printLabelRecord.getCategory()) && "Y".equalsIgnoreCase(userEntity.getAutoSerialNumber())){ |
|
|
|
// |
|
|
|
// } |
|
|
|
if (!"Y".equalsIgnoreCase(userEntity.getAutoSerialNumber())){ |
|
|
|
return iPage; |
|
|
|
} |
|
|
|
for (PrintLabelRecord record : iPage.getRecords()) { |
|
|
|
if (!"Hardware(Antenna)-Serials".equals(record.getCategory())){ |
|
|
|
continue; |
|
|
|
} |
|
|
|
// 获取 认证 |
|
|
|
List<ExternalPartPicture> pictureList = externalPartPictureService.lambdaQuery() |
|
|
|
.eq(ExternalPartPicture::getPartNo, record.getPartNo()) |
|
|
|
.eq(ExternalPartPicture::getSite, record.getSite()) |
|
|
|
.eq(ExternalPartPicture::getTemplateNo, record.getTemplateNo()) |
|
|
|
.eq(ExternalPartPicture::getPictureClassify, "ProPicture") |
|
|
|
.list(); |
|
|
|
Map<String,String> pictureMap = new HashMap<>(); |
|
|
|
pictureMap.put("P1",""); |
|
|
|
pictureMap.put("P2",""); |
|
|
|
pictureMap.put("P3",""); |
|
|
|
pictureMap.put("P4",""); |
|
|
|
pictureMap.put("P5",""); |
|
|
|
pictureMap.put("P6",""); |
|
|
|
pictureMap.put("P7",""); |
|
|
|
pictureMap.put("P8",""); |
|
|
|
pictureMap.put("P9",""); |
|
|
|
pictureMap.put("P10",""); |
|
|
|
pictureMap.put("P11",""); |
|
|
|
pictureMap.put("P12",""); |
|
|
|
pictureMap.put("P13",""); |
|
|
|
pictureMap.put("P14",""); |
|
|
|
pictureMap.put("P15",""); |
|
|
|
pictureMap.put("P16",""); |
|
|
|
for (ExternalPartPicture picture : pictureList) { |
|
|
|
// 通过URL转Base64 |
|
|
|
String pictureUrl = picture.getPictureUrl(); |
|
|
|
if (StringUtils.hasText(pictureUrl)){ |
|
|
|
if (StringUtils.hasText(pictureUrl)){ |
|
|
|
if (StringUtils.hasText(pictureUrl)){ |
|
|
|
File file = new File(pictureUrl); |
|
|
|
try { |
|
|
|
pictureMap.put(picture.getPicturePosition(),"data:image/png;base64,"+encodeFileToBase64(file)); |
|
|
|
} catch (IOException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
File file = new File(pictureUrl); |
|
|
|
try { |
|
|
|
pictureMap.put(picture.getPicturePosition(),"data:image/png;base64,"+encodeFileToBase64(file)); |
|
|
|
} catch (IOException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
record.setPictureMap(pictureMap); |
|
|
|
} |
|
|
|
record.setPictureMap(pictureMap); |
|
|
|
} |
|
|
|
return iPage; |
|
|
|
} |
|
|
|
|