diff --git a/blade-biz-common/src/main/java/org/springblade/common/utils/QRCodeUtil.java b/blade-biz-common/src/main/java/org/springblade/common/utils/QRCodeUtil.java index 454d59cd9..f805613a5 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/utils/QRCodeUtil.java +++ b/blade-biz-common/src/main/java/org/springblade/common/utils/QRCodeUtil.java @@ -16,10 +16,8 @@ import javax.imageio.ImageIO; import javax.servlet.http.HttpServletResponse; import javax.swing.filechooser.FileSystemView; import java.awt.image.BufferedImage; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; +import java.util.Base64; import java.util.HashMap; import java.util.Map; import java.util.UUID; @@ -105,6 +103,40 @@ public class QRCodeUtil { return null; } + + public static String createCodeToBase64(String content) throws IOException { + FileInputStream inputFile = null; + try { + + String imgPath = CommonConstant.SYSTEMFILEPATH+"qrCodeImg/"; + File codeImgFileSaveDir = new File(imgPath); + //1. 使用UUID重新生成文件名,防止文件名称重复造成文件覆盖 + String fileName = UUID.randomUUID() + "." +FileFormat; + content = content.trim(); + if (codeImgFileSaveDir==null || codeImgFileSaveDir.isFile()) { + //二维码图片存在目录为空,默认放在桌面... + codeImgFileSaveDir = FileSystemView.getFileSystemView().getHomeDirectory(); + } + if (!codeImgFileSaveDir.exists()) { + //二维码图片存在目录不存在,开始创建... + codeImgFileSaveDir.mkdirs(); + } + //核心代码-生成二维码 + BufferedImage bufferedImage = getBufferedImage(content); + File codeImgFile = new File(codeImgFileSaveDir, fileName); + ImageIO.write(bufferedImage, FileFormat, codeImgFile); + inputFile = new FileInputStream(codeImgFile); + byte[] bytes = new byte[(int) codeImgFile.length()]; + inputFile.read(bytes); + return Base64.getEncoder().encodeToString(bytes).replaceAll("\r|\n", ""); + } catch (Exception e) { + e.printStackTrace(); + }finally { + inputFile.close(); + } + return null; + } + /** * 条形码 * @param content @@ -183,6 +215,37 @@ public class QRCodeUtil { } } return bufferedImage; + } + + + public static String getBufferedImageToBase64(String content) throws WriterException, IOException { + + //com.google.zxing.EncodeHintType:编码提示类型,枚举类型 + Map hints = new HashMap(); + + //EncodeHintType.CHARACTER_SET:设置字符编码类型 + hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); + + //EncodeHintType.ERROR_CORRECTION:设置误差校正 + //ErrorCorrectionLevel:误差校正等级,L = ~7% correction、M = ~15% correction、Q = ~25% correction、H = ~30% correction + //不设置时,默认为 L 等级,等级不一样,生成的图案不同,但扫描的结果是一样的 + hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); + + //EncodeHintType.MARGIN:设置二维码边距,单位像素,值越小,二维码距离四周越近 + hints.put(EncodeHintType.MARGIN, 0); + + MultiFormatWriter multiFormatWriter = new MultiFormatWriter(); + BitMatrix bitMatrix = multiFormatWriter.encode(content, BarcodeFormat.QR_CODE, CODE_WIDTH, CODE_HEIGHT, hints); + BufferedImage bufferedImage = new BufferedImage(CODE_WIDTH, CODE_HEIGHT, BufferedImage.TYPE_INT_BGR); + for (int x = 0; x < CODE_WIDTH; x++) { + for (int y = 0; y < CODE_HEIGHT; y++) { + bufferedImage.setRGB(x, y, bitMatrix.get(x, y) ? FRONT_COLOR : BACKGROUND_COLOR); + } + } + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ImageIO.write(bufferedImage,".png",bos); + byte[] byteArray = bos.toByteArray(); + return Base64.getEncoder().encodeToString(byteArray); } //核心代码-生成二维码 public static BufferedImage getBufferedImageMatrix(String content) throws WriterException { diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/vo/BasicdataWarehouseVO.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/vo/BasicdataWarehouseVO.java index d0c851b9f..81a2844fb 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/vo/BasicdataWarehouseVO.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/vo/BasicdataWarehouseVO.java @@ -49,4 +49,6 @@ public class BasicdataWarehouseVO extends BasicdataWarehouseEntity { + + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java index 58214a486..6d8de23e5 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java @@ -187,9 +187,9 @@ public class BasicdataWarehouseController extends BladeController { @GetMapping("/page") @ApiOperationSupport(order = 3) @ApiOperation(value = "分页", notes = "传入warehouseWarehouse") - public R> page(BasicdataWarehouseVO warehouseWarehouse, Query query) { - IPage pages = warehouseService.selectWarehouseWarehousePage(Condition.getPage(query), warehouseWarehouse); - return R.data(pages); + public R page(BasicdataWarehouseDTO warehouseWarehouse, Query query) { + IPage basicdataWarehouseVOIPage = warehouseService.selectWarehouseWarehousePage(Condition.getPage(query), warehouseWarehouse); + return R.data(basicdataWarehouseVOIPage); } /** diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataWarehouseDTO.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataWarehouseDTO.java index feecdd6e4..6936405f6 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataWarehouseDTO.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataWarehouseDTO.java @@ -31,4 +31,7 @@ import lombok.EqualsAndHashCode; public class BasicdataWarehouseDTO extends BasicdataWarehouseEntity { private static final long serialVersionUID = 1L; + private Integer pageType; + + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.java index cf0418d9a..80f974094 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.java @@ -19,6 +19,7 @@ package com.logpm.basicdata.mapper; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.logpm.basicdata.dto.BasicdataWarehouseDTO; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.excel.BasicdataWarehouseExcel; import com.logpm.basicdata.vo.BasicdataWarehouseVO; @@ -41,7 +42,7 @@ public interface BasicdataWarehouseMapper extends BaseMapper selectWarehouseWarehousePage(IPage page, BasicdataWarehouseVO warehouseWarehouse); + IPage selectWarehouseWarehousePage(IPage page,@Param("param") BasicdataWarehouseDTO warehouseWarehouse); /** @@ -81,4 +82,21 @@ public interface BasicdataWarehouseMapper extends BaseMapper findWarehouseList(@Param("warehouseName") String warehouseName); + + /** + * 查询到期仓库 + * @param page + * @param warehouseWarehouse + * @return + */ + IPage selectExpireWarehouseWarehousePage(IPage page,@Param("param") BasicdataWarehouseDTO warehouseWarehouse); + + /** + * 查询临期仓库 + * @param page + * @param warehouseWarehouse + * @return + */ + IPage selectDeadlineWarehouseWarehousePage(IPage page,@Param("param") BasicdataWarehouseDTO warehouseWarehouse); + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.xml index 1a52649a3..e4f2fc929 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.xml +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.xml @@ -65,13 +65,18 @@ NOT EXISTS ( SELECT b.id FROM logpm_warehouse_goods_area b WHERE b.warehouse_id = #{id} AND b.is_deleted = 0) AND id = #{id} + + select * from logpm_warehouse_warehouse + - @@ -140,5 +145,19 @@ limit 10 + + diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataWarehouseService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataWarehouseService.java index 16b4bc240..acf741f48 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataWarehouseService.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataWarehouseService.java @@ -20,6 +20,7 @@ package com.logpm.basicdata.service; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.logpm.basicdata.dto.BasicdataWarehouseDTO; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.excel.BasicdataWarehouseExcel; import com.logpm.basicdata.vo.BasicdataWarehouseVO; @@ -42,7 +43,7 @@ public interface IBasicdataWarehouseService extends BaseService selectWarehouseWarehousePage(IPage page, BasicdataWarehouseVO warehouseWarehouse); + IPage selectWarehouseWarehousePage(IPage page, BasicdataWarehouseDTO warehouseWarehouse); /** diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataWarehouseServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataWarehouseServiceImpl.java index f9c84e03c..6715f7d0a 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataWarehouseServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataWarehouseServiceImpl.java @@ -25,6 +25,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.logpm.basicdata.dto.BasicdataWarehouseDTO; import com.logpm.basicdata.entity.BasicdataClientUserEntity; import com.logpm.basicdata.entity.BasicdataStorageServicesEntity; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; @@ -87,8 +88,29 @@ public class BasicdataWarehouseServiceImpl extends BaseServiceImpl selectWarehouseWarehousePage(IPage page, BasicdataWarehouseVO warehouseWarehouse) { - return page.setRecords(baseMapper.selectWarehouseWarehousePage(page, warehouseWarehouse)); + public IPage selectWarehouseWarehousePage(IPage page, BasicdataWarehouseDTO warehouseWarehouse) { + Integer pageType = 0; + if (!Objects.isNull(warehouseWarehouse.getPageType())){ + pageType = warehouseWarehouse.getPageType(); + } + switch (pageType){ + case 1: + IPage basicdataWarehouseVOS = baseMapper.selectWarehouseWarehousePage(page, warehouseWarehouse); + return basicdataWarehouseVOS; + case 2: + IPage basicdataDeadlineWarehouseVOS = baseMapper.selectDeadlineWarehouseWarehousePage(page, warehouseWarehouse); + //临期 + return basicdataDeadlineWarehouseVOS; + case 3: + IPage basicdataExpireWarehouseVOS = baseMapper.selectExpireWarehouseWarehousePage(page, warehouseWarehouse); + return basicdataExpireWarehouseVOS; + default: + log.error("未知的pageType>>>>>>>>>>>>>>>"); + } + //查询全部列表 + //查询已到期列表 + //查询临期列表 + return null; } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml index ac672100e..6d293e3eb 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml @@ -1935,6 +1935,7 @@ ldsa.customer_address as customerAddress, ldpl.material_name as materialName, ldpl.third_product as thirdProduct, + ldpl.order_package_code as orderPackageCode, ldsa.mall_name as mallName FROM logpm_distribution_stock_article ldsa diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java index aa40e3172..484658927 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java @@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.zxing.WriterException; import com.logpm.basic.entity.BasicMaterialEntity; import com.logpm.basic.feign.IBasicMaterialClient; import com.logpm.basicdata.entity.BasicdataClientEntity; @@ -75,6 +76,7 @@ import org.springblade.common.constant.reservation.ReservationPackageStatusConst import org.springblade.common.exception.CustomerException; import org.springblade.common.node.PackageNode; import org.springblade.common.utils.CommonUtil; +import org.springblade.common.utils.QRCodeUtil; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.secure.BladeUser; @@ -94,6 +96,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import java.awt.image.BufferedImage; +import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -1472,6 +1476,14 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl findOrderInfoByOrderPackageCode(String orderPackageCode, Long warehouseId) { - return baseMapper.findOrderInfoByOrderPackageCode(orderPackageCode,warehouseId); + Map orderInfoByOrderPackageCode = baseMapper.findOrderInfoByOrderPackageCode(orderPackageCode, warehouseId); + String packageCode = (String) orderInfoByOrderPackageCode.get("orderPackageCode"); + try { + String bufferedImageToBase64 = QRCodeUtil.createCodeToBase64(packageCode); + orderInfoByOrderPackageCode.put("imageToBase64","data:image/png;base64,"+bufferedImageToBase64); + } catch ( IOException e) { + throw new RuntimeException(e); + } + return orderInfoByOrderPackageCode; } }