Browse Source

仓库增加到期、临期分类,PDA查看二维码值

visual
汤建军 6 months ago
parent
commit
62b7ba7f44
  1. 71
      blade-biz-common/src/main/java/org/springblade/common/utils/QRCodeUtil.java
  2. 2
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/vo/BasicdataWarehouseVO.java
  3. 6
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java
  4. 3
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataWarehouseDTO.java
  5. 20
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.java
  6. 23
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.xml
  7. 3
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataWarehouseService.java
  8. 26
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataWarehouseServiceImpl.java
  9. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml
  10. 14
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java

71
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<EncodeHintType, Object> 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 {

2
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/vo/BasicdataWarehouseVO.java

@ -49,4 +49,6 @@ public class BasicdataWarehouseVO extends BasicdataWarehouseEntity {
}

6
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<IPage<BasicdataWarehouseVO>> page(BasicdataWarehouseVO warehouseWarehouse, Query query) {
IPage<BasicdataWarehouseVO> pages = warehouseService.selectWarehouseWarehousePage(Condition.getPage(query), warehouseWarehouse);
return R.data(pages);
public R page(BasicdataWarehouseDTO warehouseWarehouse, Query query) {
IPage<BasicdataWarehouseVO> basicdataWarehouseVOIPage = warehouseService.selectWarehouseWarehousePage(Condition.getPage(query), warehouseWarehouse);
return R.data(basicdataWarehouseVOIPage);
}
/**

3
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;
}

20
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<BasicdataWarehouseE
* @param warehouseWarehouse
* @return
*/
List<BasicdataWarehouseVO> selectWarehouseWarehousePage(IPage page, BasicdataWarehouseVO warehouseWarehouse);
IPage<BasicdataWarehouseVO> selectWarehouseWarehousePage(IPage page,@Param("param") BasicdataWarehouseDTO warehouseWarehouse);
/**
@ -81,4 +82,21 @@ public interface BasicdataWarehouseMapper extends BaseMapper<BasicdataWarehouseE
Integer removeWarehouse(Long id);
List<BasicdataWarehouseEntity> findWarehouseList(@Param("warehouseName") String warehouseName);
/**
* 查询到期仓库
* @param page
* @param warehouseWarehouse
* @return
*/
IPage<BasicdataWarehouseVO> selectExpireWarehouseWarehousePage(IPage<BasicdataWarehouseVO> page,@Param("param") BasicdataWarehouseDTO warehouseWarehouse);
/**
* 查询临期仓库
* @param page
* @param warehouseWarehouse
* @return
*/
IPage<BasicdataWarehouseVO> selectDeadlineWarehouseWarehousePage(IPage<BasicdataWarehouseVO> page,@Param("param") BasicdataWarehouseDTO warehouseWarehouse);
}

23
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}
</update>
<sql id="WarehousePageSql">
select * from logpm_warehouse_warehouse
</sql>
<select id="selectWarehouseWarehousePage" resultMap="warehouseWarehouseResultMap">
select * from logpm_warehouse_warehouse where is_deleted = 0
select * from logpm_warehouse_warehouse
<where>
is_deleted = 0
</where>
</select>
<select id="exportWarehouseWarehouse" resultType="com.logpm.basicdata.excel.BasicdataWarehouseExcel">
SELECT * FROM logpm_warehouse_warehouse ${ew.customSqlSegment}
</select>
@ -140,5 +145,19 @@
</if>
limit 10
</select>
<select id="selectExpireWarehouseWarehousePage" resultType="com.logpm.basicdata.vo.BasicdataWarehouseVO">
select * from logpm_warehouse_warehouse
<where>
is_deleted = 0
AND DATEDIFF(DATE_FORMAT(end_date,'%y%m%d'),DATE_FORMAT(NOW(),'%y%m%d')) &lt;= 0
</where>
</select>
<select id="selectDeadlineWarehouseWarehousePage" resultType="com.logpm.basicdata.vo.BasicdataWarehouseVO">
select * from logpm_warehouse_warehouse
<where>
is_deleted = 0
AND DATEDIFF(DATE_FORMAT(end_date,'%y%m%d'),DATE_FORMAT(NOW(),'%y%m%d')) BETWEEN 1 AND 90
</where>
</select>
</mapper>

3
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<BasicdataWarehou
* @param warehouseWarehouse
* @return
*/
IPage<BasicdataWarehouseVO> selectWarehouseWarehousePage(IPage<BasicdataWarehouseVO> page, BasicdataWarehouseVO warehouseWarehouse);
IPage<BasicdataWarehouseVO> selectWarehouseWarehousePage(IPage<BasicdataWarehouseVO> page, BasicdataWarehouseDTO warehouseWarehouse);
/**

26
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<BasicdataWare
@Override
public IPage<BasicdataWarehouseVO> selectWarehouseWarehousePage(IPage<BasicdataWarehouseVO> page, BasicdataWarehouseVO warehouseWarehouse) {
return page.setRecords(baseMapper.selectWarehouseWarehousePage(page, warehouseWarehouse));
public IPage<BasicdataWarehouseVO> selectWarehouseWarehousePage(IPage<BasicdataWarehouseVO> page, BasicdataWarehouseDTO warehouseWarehouse) {
Integer pageType = 0;
if (!Objects.isNull(warehouseWarehouse.getPageType())){
pageType = warehouseWarehouse.getPageType();
}
switch (pageType){
case 1:
IPage<BasicdataWarehouseVO> basicdataWarehouseVOS = baseMapper.selectWarehouseWarehousePage(page, warehouseWarehouse);
return basicdataWarehouseVOS;
case 2:
IPage<BasicdataWarehouseVO> basicdataDeadlineWarehouseVOS = baseMapper.selectDeadlineWarehouseWarehousePage(page, warehouseWarehouse);
//临期
return basicdataDeadlineWarehouseVOS;
case 3:
IPage<BasicdataWarehouseVO> basicdataExpireWarehouseVOS = baseMapper.selectExpireWarehouseWarehousePage(page, warehouseWarehouse);
return basicdataExpireWarehouseVOS;
default:
log.error("未知的pageType>>>>>>>>>>>>>>>");
}
//查询全部列表
//查询已到期列表
//查询临期列表
return null;
}

1
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

14
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<Distribut
@Override
public Map<String, Object> findOrderInfoByOrderPackageCode(String orderPackageCode, Long warehouseId) {
return baseMapper.findOrderInfoByOrderPackageCode(orderPackageCode,warehouseId);
Map<String, Object> 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;
}
}

Loading…
Cancel
Save