diff --git a/src/main/java/com/gaotao/modules/label/service/impl/PrintLabelRecordServiceImpl.java b/src/main/java/com/gaotao/modules/label/service/impl/PrintLabelRecordServiceImpl.java index f2b44be..2d41c28 100644 --- a/src/main/java/com/gaotao/modules/label/service/impl/PrintLabelRecordServiceImpl.java +++ b/src/main/java/com/gaotao/modules/label/service/impl/PrintLabelRecordServiceImpl.java @@ -99,7 +99,7 @@ public class PrintLabelRecordServiceImpl extends ServiceImpl 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 selectPrintLabelRecordPage(PrintLabelRecord printLabelRecord, Integer no, Integer size) { SysUserEntity userEntity = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); Page page = new Page<>(no, size); printLabelRecord.setCreateBy(userEntity.getUsername()); IPage 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 pictureList = externalPartPictureService.lambdaQuery() - .eq(ExternalPartPicture::getPartNo, record.getPartNo()) - .eq(ExternalPartPicture::getSite, record.getSite()) - .eq(ExternalPartPicture::getTemplateNo, record.getTemplateNo()) - .eq(ExternalPartPicture::getPictureClassify, "ProPicture") - .list(); - Map 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 pictureList = externalPartPictureService.lambdaQuery() + .eq(ExternalPartPicture::getPartNo, record.getPartNo()) + .eq(ExternalPartPicture::getSite, record.getSite()) + .eq(ExternalPartPicture::getTemplateNo, record.getTemplateNo()) + .eq(ExternalPartPicture::getPictureClassify, "ProPicture") + .list(); + Map 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; } diff --git a/src/main/resources/mapper/label/PrintLabelRecordMapper.xml b/src/main/resources/mapper/label/PrintLabelRecordMapper.xml index 13f312c..8b36a78 100644 --- a/src/main/resources/mapper/label/PrintLabelRecordMapper.xml +++ b/src/main/resources/mapper/label/PrintLabelRecordMapper.xml @@ -150,6 +150,6 @@ \ No newline at end of file diff --git a/src/main/resources/mapper/label/PrintRollLabelRecordMapper.xml b/src/main/resources/mapper/label/PrintRollLabelRecordMapper.xml index 9f7ff12..cba2fae 100644 --- a/src/main/resources/mapper/label/PrintRollLabelRecordMapper.xml +++ b/src/main/resources/mapper/label/PrintRollLabelRecordMapper.xml @@ -109,6 +109,6 @@ - order by plr.id desc + order by plr.id \ No newline at end of file