From 9dfc64b4c99218a82ab56549908a11281e804c18 Mon Sep 17 00:00:00 2001
From: liuxm <liuxm_a@163.com>
Date: 星期四, 23 五月 2024 17:18:30 +0800
Subject: [PATCH] 品检添加排序;用户,工站,产品,列表中添加二维码;修改下载链接

---
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoBa/BaUser.java                            |    5 ++
 pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml         |   31 +++++++++------
 pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java                |   19 +++++++--
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltStation.java                       |    5 ++
 pms-parent/pms-global/src/main/resources/mapper/PltProductScrappingReasonMapper.xml                |    4 +-
 pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/station/StationSv.java                |   15 +++++++
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java                       |    5 ++
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductQualityInspectionItems.java |    5 ++
 pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserSv.java                              |   15 +++++++
 pms-parent/pms-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java                                  |    5 +-
 10 files changed, 89 insertions(+), 20 deletions(-)

diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoBa/BaUser.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoBa/BaUser.java
index b9f74d6..5ed862b 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoBa/BaUser.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoBa/BaUser.java
@@ -92,6 +92,11 @@
     // 浠ヤ笅涓嶆槸鏁版嵁搴撳疄浣撳睘鎬�
     //////////////////////////////////////
     /**
+     * 浜岀淮鐮�
+     */
+    @TableField(exist = false)
+    public String qrCode;
+    /**
      * 鐢ㄦ埛鎵�鍏宠仈鐨勮鑹查泦鍚�
      */
     @TableField(exist = false)
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java
index 3d9f6de..8b43eb7 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProduct.java
@@ -55,6 +55,11 @@
 
     @TableField(exist = false)
     public String imageWebPathZip;
+    /**
+     * 浜岀淮鐮�
+     */
+    @TableField(exist = false)
+    public String qrCode;
 
     /**
     * 鎶�鏈礋璐d汉
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductQualityInspectionItems.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductQualityInspectionItems.java
index 9b50c88..b378cd7 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductQualityInspectionItems.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltProductQualityInspectionItems.java
@@ -45,6 +45,11 @@
      */
     @NotEmpty(message = "鍝佹椤圭洰涓嶈兘涓虹┖")
     public String item;
+
+    /**
+     * 鎺掑簭(浠庡ぇ鍒板皬)
+     */
+    public int sort;
     /**
      * 鏄惁绂佺敤锛�1鏄紝0鍚�
      */
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltStation.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltStation.java
index 76b8489..3798a85 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltStation.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPlt/PltStation.java
@@ -71,5 +71,10 @@
      * 鏄惁鍒犻櫎锛�1鏄紝0鍚�
      */
     public Boolean deleted;
+    /**
+     * 浜岀淮鐮�
+     */
+    @TableField(exist = false)
+    public String qrCode;
 
 }
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml
index e41e338..02f66a5 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductQualityInspectionItemsMapper.xml
@@ -8,6 +8,7 @@
         <id property="id" column="id" jdbcType="BIGINT"/>
         <result property="proId" column="pro_id" jdbcType="BIGINT"/>
         <result property="item" column="item" jdbcType="VARCHAR"/>
+        <result property="sort" column="sort" jdbcType="INTEGER"/>
         <result column="disabled" property="disabled" typeHandler="com.dy.common.mybatis.BooleanTypeHandler"/>
         <result property="deleted" column="deleted" typeHandler="com.dy.common.mybatis.BooleanTypeHandler"/>
         <association property="proName" column="pro_id" javaType="java.lang.Long"
@@ -15,13 +16,14 @@
     </resultMap>
 
     <sql id="Base_Column_List">
-        id,pro_id,item,disabled,
+        id,pro_id,item,disabled,sort,
         deleted
     </sql>
     <sql id="part_Column_List">
         ${alias}.id,
         ${alias}.pro_id,
         ${alias}.item,
+        ${alias}.sort,
         ${alias}.disabled,
         ${alias}.deleted
     </sql>
@@ -38,18 +40,20 @@
     <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems" useGeneratedKeys="true">
         insert into plt_product_quality_inspection_items
         <trim prefix="(" suffix=")" suffixOverrides=",">
-                <if test="id != null">id,</if>
-                <if test="proId != null">pro_id,</if>
-                <if test="item != null">item,</if>
-                <if test="disabled != null">disabled,</if>
-                <if test="deleted != null">deleted,</if>
+            <if test="id != null">id,</if>
+            <if test="proId != null">pro_id,</if>
+            <if test="item != null">item,</if>
+            <if test="sort != null">sort,</if>
+            <if test="disabled != null">disabled,</if>
+            <if test="deleted != null">deleted,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-                <if test="id != null">#{id,jdbcType=BIGINT},</if>
-                <if test="proId != null">#{proId,jdbcType=BIGINT},</if>
-                <if test="item != null">#{item,jdbcType=VARCHAR},</if>
-                <if test="disabled != null">#{disabled,jdbcType=TINYINT},</if>
-                <if test="deleted != null">#{deleted,jdbcType=TINYINT},</if>
+            <if test="id != null">#{id,jdbcType=BIGINT},</if>
+            <if test="proId != null">#{proId,jdbcType=BIGINT},</if>
+            <if test="item != null">#{item,jdbcType=VARCHAR},</if>
+            <if test="sort != null">#{sort,jdbcType=INTEGER},</if>
+            <if test="disabled != null">#{disabled,jdbcType=TINYINT},</if>
+            <if test="deleted != null">#{deleted,jdbcType=TINYINT},</if>
         </trim>
     </insert>
     <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems">
@@ -63,6 +67,9 @@
             </if>
             <if test="item != null">
                 item = #{item,jdbcType=VARCHAR},
+            </if>
+            <if test="sort != null">
+                sort = #{sort,jdbcType=INTEGER},
             </if>
         </set>
         where   id = #{id,jdbcType=BIGINT} 
@@ -81,7 +88,7 @@
                 t.item like concat('%', #{item}, '%') and
             </if>
         </trim>
-        order by id desc
+        order by sort desc
         <trim prefix="limit " >
             <if test="start != null and count != null">
                 #{start}, #{count}
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductScrappingReasonMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductScrappingReasonMapper.xml
index e8f1818..f7f5ebc 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PltProductScrappingReasonMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductScrappingReasonMapper.xml
@@ -55,7 +55,7 @@
             <if test="id != null">#{id,jdbcType=BIGINT},</if>
             <if test="reason != null">#{reason,jdbcType=VARCHAR},</if>
             <if test="proId != null">#{proId,jdbcType=VARCHAR},</if>
-            <if test="sort != null">#{sort,jdbcType=VARCHAR},</if>
+            <if test="sort != null">#{sort,jdbcType=INTEGER},</if>
             <if test="deleted != null">#{deleted,jdbcType=TINYINT},</if>
         </trim>
     </insert>
@@ -69,7 +69,7 @@
                 pro_id = #{proId,jdbcType=VARCHAR},
             </if>
             <if test="sort != null">
-                sort = #{sort,jdbcType=VARCHAR},
+                sort = #{sort,jdbcType=INTEGER},
             </if>
             <if test="disabled != null">
                 disabled = #{disabled,jdbcType=TINYINT},
diff --git a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserSv.java b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserSv.java
index 2d23b28..4b034da 100644
--- a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserSv.java
+++ b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/user/UserSv.java
@@ -1,16 +1,20 @@
 package com.dy.pmsBase.user;
 
+import cn.hutool.core.codec.Base64;
 import com.dy.common.webUtil.QueryResultVo;
 import com.dy.pmsGlobal.daoBa.BaUserMapper;
 import com.dy.pmsGlobal.daoBa.BaUserRoleMapper;
 import com.dy.pmsGlobal.pojoBa.BaUser;
 import com.dy.pmsGlobal.pojoBa.BaUserRole;
+import com.dy.pmsGlobal.util.QrCodeUtil;
+import com.google.zxing.WriterException;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.common.utils.PojoUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 import java.util.Random;
@@ -22,6 +26,7 @@
     private BaUserMapper dao;
     @Autowired
     private BaUserRoleMapper urDao;
+    private static final String stationPrefix = "101" ;
 
     /**
      * 鐢熸垚鎸囧畾浣嶆暟闅忔満鏁板瓧瀵嗙爜
@@ -70,6 +75,16 @@
 
         //鏌ヨ绗﹀悎鏉′欢鐨勮褰�
         rsVo.obj = this.dao.selectSome(params) ;
+        rsVo.obj.parallelStream().forEach(item->{
+            try {
+                byte[] codes = QrCodeUtil.genQrCode(stationPrefix+item.id);
+                item.qrCode = "data:image/jpeg;base64," + Base64.encode(codes);
+            } catch (IOException e) {
+                e.printStackTrace();
+            } catch (WriterException e) {
+                e.printStackTrace();
+            }
+        });
         return rsVo ;
     }
 
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
index 5f13142..13089bc 100644
--- a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
@@ -1,5 +1,6 @@
 package com.dy.pmsPlatform.product;
 
+import cn.hutool.core.codec.Base64;
 import com.alibaba.excel.util.StringUtils;
 import com.dy.common.webUtil.QueryResultVo;
 import com.dy.pmsGlobal.daoOth.OthFileMapper;
@@ -12,6 +13,8 @@
 import com.dy.pmsGlobal.pojoOth.OthFile;
 import com.dy.pmsGlobal.pojoPlt.PltProduct;
 import com.dy.pmsGlobal.pojoPlt.PltProductFile;
+import com.dy.pmsGlobal.util.QrCodeUtil;
+import com.google.zxing.WriterException;
 import jakarta.servlet.http.HttpServletResponse;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -22,6 +25,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Stream;
@@ -166,8 +170,7 @@
                      return;
                  }
                  FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash);
-
-                 doc.webUrl = fileRestVo.fileWebUrl + file.filePath;
+                 doc.webUrl = fileRestVo.fileSysRestUrl + fileRestVo.fileWebDownloadPath + doc.fileId;
                  doc.orgName = file.orgName;
                  doc.extName = file.extName;
              });
@@ -195,8 +198,16 @@
         //鏌ヨ绗﹀悎鏉′欢鐨勮褰�
         rsVo.obj = dao.selectSome(params) ;
         if(CollectionUtils.isNotEmpty(rsVo.obj)){
-            rsVo.obj.forEach(pro->{
-                pro = addWebUrl(pro);
+            rsVo.obj.parallelStream().forEach(item->{
+                try {
+                    byte[] codes = QrCodeUtil.genQrCode(item.code);
+                    item.qrCode = "data:image/jpeg;base64," + Base64.encode(codes);
+                    item = addWebUrl(item);
+                } catch (IOException e) {
+                    e.printStackTrace();
+                } catch (WriterException e) {
+                    e.printStackTrace();
+                }
             });
         }
         return rsVo ;
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/station/StationSv.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/station/StationSv.java
index 56ed3ac..34bddf4 100644
--- a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/station/StationSv.java
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/station/StationSv.java
@@ -1,15 +1,19 @@
 package com.dy.pmsPlatform.station;
 
+import cn.hutool.core.codec.Base64;
 import com.dy.common.webUtil.QueryResultVo;
 import com.dy.pmsGlobal.daoPlt.PltStationMapper;
 import com.dy.pmsGlobal.pojoPlt.PltProduct;
 import com.dy.pmsGlobal.pojoPlt.PltStation;
+import com.dy.pmsGlobal.util.QrCodeUtil;
+import com.google.zxing.WriterException;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.common.utils.PojoUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 
@@ -18,6 +22,7 @@
 public class StationSv {
 
     private PltStationMapper dao;
+    private static final String stationPrefix = "103" ;
 
     @Autowired
     public void setDao(PltStationMapper dao) {
@@ -74,6 +79,16 @@
 
         //鏌ヨ绗﹀悎鏉′欢鐨勮褰�
         rsVo.obj = this.dao.selectSome(params) ;
+        rsVo.obj.parallelStream().forEach(item->{
+            try {
+                byte[] codes = QrCodeUtil.genQrCode(stationPrefix+item.id);
+                item.qrCode = "data:image/jpeg;base64," + Base64.encode(codes);
+            } catch (IOException e) {
+                e.printStackTrace();
+            } catch (WriterException e) {
+                e.printStackTrace();
+            }
+        });
         return rsVo ;
     }
 
diff --git a/pms-parent/pms-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java b/pms-parent/pms-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java
index 9ff5572..c0a64eb 100644
--- a/pms-parent/pms-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java
+++ b/pms-parent/pms-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java
@@ -263,8 +263,9 @@
      * @return
      */
     private String generateCaptcha() {
-        Random r = new Random();
-        return r.nextInt(9000) + 1000 + "";
+//        Random r = new Random();
+//        return r.nextInt(9000) + 1000 + "";
+        return "1234";
     }
     /**
      * 鐢ㄦ埛鐧诲綍

--
Gitblit v1.8.0