From ebae0c1137ba96d38e5b2323577129d2c9ff2e6e Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 22 五月 2025 09:45:59 +0800
Subject: [PATCH] 1、优化配置文件; 2、优化ID生成器代码; 3、修改注释; 4、修改权限初始化时算法; 5、导出Excel文件功能归为一个新类; 6、工站数据库存入验空修改;
---
pms-parent/pms-common/src/main/java/com/dy/common/util/ConfigXml.java | 2
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/util/ExportExcelUtil.java | 61 ++++++++++
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/station/StationSv.java | 1
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java | 5
pms-parent/pms-common/src/main/java/com/dy/common/mybatis/AutoGenerateIdInterceptor.java | 29 ++--
pms-parent/pms-global/src/main/resources/application-global.yml | 4
pms-parent/pms-global/src/main/resources/mapper/PltStationMapper.xml | 18 +-
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/util/QrCodeUtil.java | 41 ------
pms-parent/pms-global/src/main/resources/mapper/BaPrivilegeMapper.xml | 5
pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java | 39 ++++-
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoBa/BaPrivilegeMapper.java | 4
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java | 29 ++++
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/station/StationCtrl.java | 26 +++
pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/MarkQrCode/MarkQrCodeCtrl.java | 3
pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml | 40 +++---
15 files changed, 199 insertions(+), 108 deletions(-)
diff --git a/pms-parent/pms-common/src/main/java/com/dy/common/mybatis/AutoGenerateIdInterceptor.java b/pms-parent/pms-common/src/main/java/com/dy/common/mybatis/AutoGenerateIdInterceptor.java
index 5c3b4e0..1f32602 100644
--- a/pms-parent/pms-common/src/main/java/com/dy/common/mybatis/AutoGenerateIdInterceptor.java
+++ b/pms-parent/pms-common/src/main/java/com/dy/common/mybatis/AutoGenerateIdInterceptor.java
@@ -53,20 +53,25 @@
invocation.getArgs()[PARAMETER_INDEX] = entity;
}else if(entity instanceof Map){
try {
- ((List)((Map<?, ?>) entity).get("list")).forEach(e -> {
- if (e instanceof BaseEntity) {
- Class<?> entityClass = e.getClass();
- Method setIdMt = null ;
- try{
- setIdMt = entityClass.getMethod(BASE_FIELD_SET_PRIMARY_KEY_FUNTION_NAME, Long.class) ;
- if(setIdMt != null){
- setIdMt.invoke(e, new IDLongGenerator().generate());
+ Map<?, ?> map = (Map)entity;
+ List list = (List)map.get("list") ;
+ if(list != null && list.size() > 0){
+ IDLongGenerator idg = new IDLongGenerator() ;
+ list.forEach(e -> {
+ if (e instanceof BaseEntity) {
+ Class<?> entityClass = e.getClass();
+ Method setIdMt = null ;
+ try{
+ setIdMt = entityClass.getMethod(BASE_FIELD_SET_PRIMARY_KEY_FUNTION_NAME, Long.class) ;
+ if(setIdMt != null){
+ setIdMt.invoke(e, idg.generate());
+ }
+ }catch (Exception e1){
+ //褰揺ntityClass娌℃湁setId鏂规硶鏃讹紝浼氭姏鍑哄紓甯�
}
- }catch (Exception e1){
- //褰揺ntityClass娌℃湁setId鏂规硶鏃讹紝浼氭姏鍑哄紓甯�
}
- }
- });
+ });
+ }
}catch (Exception e){
}
diff --git a/pms-parent/pms-common/src/main/java/com/dy/common/util/ConfigXml.java b/pms-parent/pms-common/src/main/java/com/dy/common/util/ConfigXml.java
index 624d230..e4c8141 100644
--- a/pms-parent/pms-common/src/main/java/com/dy/common/util/ConfigXml.java
+++ b/pms-parent/pms-common/src/main/java/com/dy/common/util/ConfigXml.java
@@ -106,7 +106,7 @@
}
/**
- * 妫�鏌ュ厓绱犳槸鍚﹀瓨鍦�
+ * 寰楀埌鍏冪礌
* @param doc doc瀵硅薄
* @param elementName 鍏冪礌鍚嶇О
* @return 杩斿洖缁撴灉 杩斿洖缁撴灉
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoBa/BaPrivilegeMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoBa/BaPrivilegeMapper.java
index 3836c35..8c090f6 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoBa/BaPrivilegeMapper.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoBa/BaPrivilegeMapper.java
@@ -38,7 +38,7 @@
* @param roleId 鐢ㄦ埛ID
* @return List<Integer>
*/
- List<Integer> selectPrivilegeByRoleId(@Param("roleId") Long roleId) ;
+ Long selectPrivilegeByRoleId(@Param("roleId") Long roleId) ;
int insert(BaPrivilege record);
@@ -50,4 +50,6 @@
int updateByPrimaryKey(BaPrivilege record);
int deleteByPrimaryKey(Long id);
+
+ int deleteAll();
}
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/util/ExportExcelUtil.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/util/ExportExcelUtil.java
new file mode 100644
index 0000000..863a12b
--- /dev/null
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/util/ExportExcelUtil.java
@@ -0,0 +1,61 @@
+package com.dy.pmsGlobal.util;
+
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.converters.Converter;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.extern.slf4j.Slf4j;
+
+import java.net.URLEncoder;
+import java.util.List;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2025/5/21 13:50
+ * @Description
+ */
+@Slf4j
+public class ExportExcelUtil {
+
+ public static void downloadExcel(HttpServletResponse response, String fileName, String sheetName, List<Converter> list){
+ if(CollectionUtils.isEmpty(list)){
+ return;
+ }
+ try{
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+ response.setCharacterEncoding("utf-8");
+ fileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
+ response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
+ EasyExcel.write(response.getOutputStream(), list.get(0).getClass()).sheet(sheetName).doWrite(list);
+ }catch (Exception e){
+ log.error("瀵煎嚭{}寮傚父", sheetName, e);
+ }
+ }
+ public static void downloadExcelSheets(HttpServletResponse response, String fileName, String sheetName, List<Converter> list){
+ if(CollectionUtils.isEmpty(list)){
+ return;
+ }
+ /*try(ExcelWriter excelWriter = EasyExcel.write(file).build()) {
+ WriteSheet writeSheet;
+ for (SheetInfoBean bean : sheetInfoList) {
+ // 鏋勫缓sheet瀵硅薄
+ writeSheet = EasyExcel.writerSheet(bean.getSheetName()).head(bean.getHeadClass()).build();
+ // 鍐欏嚭sheet鏁版嵁
+ excelWriter.write(bean.getDataList(), writeSheet);
+ }
+ // 鍏虫祦
+ excelWriter.finish();
+ } catch (Exception e) {
+ // do something you want
+ }*/
+ try{
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+ response.setCharacterEncoding("utf-8");
+ fileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
+ response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
+ EasyExcel.write(response.getOutputStream(), list.get(0).getClass()).sheet(sheetName).doWrite(list);
+ }catch (Exception e){
+ log.error("瀵煎嚭{}寮傚父",sheetName,e);
+ }
+ }
+}
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/util/QrCodeUtil.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/util/QrCodeUtil.java
index c259586..6c5e9a6 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/util/QrCodeUtil.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/util/QrCodeUtil.java
@@ -71,47 +71,6 @@
return "";
}
- public static void downloadExcel(HttpServletResponse response, String fileName, String sheetName, List<Converter> list){
- if(CollectionUtils.isEmpty(list)){
- return;
- }
- try{
- response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
- response.setCharacterEncoding("utf-8");
- fileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
- response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
- EasyExcel.write(response.getOutputStream(), list.get(0).getClass()).sheet(sheetName).doWrite(list);
- }catch (Exception e){
- log.error("瀵煎嚭{}寮傚父",sheetName,e);
- }
- }
- public static void downloadExcelSheets(HttpServletResponse response, String fileName, String sheetName, List<Converter> list){
- if(CollectionUtils.isEmpty(list)){
- return;
- }
- /*try(ExcelWriter excelWriter = EasyExcel.write(file).build()) {
- WriteSheet writeSheet;
- for (SheetInfoBean bean : sheetInfoList) {
- // 鏋勫缓sheet瀵硅薄
- writeSheet = EasyExcel.writerSheet(bean.getSheetName()).head(bean.getHeadClass()).build();
- // 鍐欏嚭sheet鏁版嵁
- excelWriter.write(bean.getDataList(), writeSheet);
- }
- // 鍏虫祦
- excelWriter.finish();
- } catch (Exception e) {
- // do something you want
- }*/
- try{
- response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
- response.setCharacterEncoding("utf-8");
- fileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
- response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
- EasyExcel.write(response.getOutputStream(), list.get(0).getClass()).sheet(sheetName).doWrite(list);
- }catch (Exception e){
- log.error("瀵煎嚭{}寮傚父",sheetName,e);
- }
- }
}
\ No newline at end of file
diff --git a/pms-parent/pms-global/src/main/resources/application-global.yml b/pms-parent/pms-global/src/main/resources/application-global.yml
index 4a882ce..2f85bd2 100644
--- a/pms-parent/pms-global/src/main/resources/application-global.yml
+++ b/pms-parent/pms-global/src/main/resources/application-global.yml
@@ -6,7 +6,7 @@
#浜戞湇鍔�203锛� D:/apps/pms/nginx-1.24.0/html/webfiles/
webFileAbsolutePath: D:/apps/pms/nginx-1.24.0/html/webfiles/
#杈撳嚭sql鏃ュ織寮�鍏筹紝鎺у埗PrintSqlInterceptor鎷︽埅鍣ㄦ槸鍚﹀姞杞�
- showSqlLog: false
+ showSqlLog: true
#鏄惁寮�鍙戦樁娈碉紝true鎴杅alse锛屽紑鍙戦樁娈典笉杩涜鐧诲綍楠岃瘉鍙婃潈闄愰獙璇�
isDev: false
spring:
@@ -130,7 +130,7 @@
#web鍒嗗竷寮忔枃浠剁郴缁�
dy:
- webFileAbsolutePath: E:/java/nginx-1.24.0/html/webfiles/
+ webFileAbsolutePath: ${pmsGl.webFileAbsolutePath}
photoZipWidth: 400 #缂╃暐鍥惧昂瀵�
webFile:
fmUrl: http://127.0.0.1:${pms.other.webPort}/other # fm鐨剋eb涓婁笅鏂� URL
diff --git a/pms-parent/pms-global/src/main/resources/mapper/BaPrivilegeMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/BaPrivilegeMapper.xml
index 9c480d2..803f50a 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/BaPrivilegeMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/BaPrivilegeMapper.xml
@@ -144,6 +144,11 @@
where id = #{id}
</delete>
+ <delete id="deleteAll">
+ <!--@mbg.generated-->
+ delete from ba_privilege
+ </delete>
+
<select id="selectByIds" parameterType="arraylist" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml
index b00a373..2f1a20d 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml
@@ -59,22 +59,22 @@
<if test="id != null">
id,
</if>
- <if test="code != null and code !=''">
+ <if test="code != null">
`code`,
</if>
- <if test="name != null and name !=''">
+ <if test="name != null">
`name`,
</if>
- <if test="type != null and type !=''">
+ <if test="type != null">
`type`,
</if>
- <if test="image!= null and image !=''">
+ <if test="image!= null">
image,
</if>
- <if test="director != null and director !=''">
+ <if test="director != null">
director,
</if>
- <if test="dMobile != null and dMobile !=''">
+ <if test="dMobile != null">
d_mobile,
</if>
<if test="deleted != null">
@@ -83,7 +83,7 @@
<if test="dt != null">
dt,
</if>
- <if test="remark != null and remark !=''">
+ <if test="remark != null">
remark,
</if>
</trim>
@@ -91,22 +91,22 @@
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
- <if test="code != null and code !=''">
+ <if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
- <if test="name != null and name !=''">
+ <if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
- <if test="type != null and type !=''">
+ <if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
- <if test="image!= null and image !=''">
+ <if test="image!= null">
#{image,jdbcType=BIGINT},
</if>
- <if test="director != null and director !=''">
+ <if test="director != null">
#{director,jdbcType=BIGINT},
</if>
- <if test="dMobile != null and dMobile !=''">
+ <if test="dMobile != null">
#{dMobile,jdbcType=VARCHAR},
</if>
<if test="deleted != null">
@@ -115,7 +115,7 @@
<if test="dt != null">
#{dt,jdbcType=TIMESTAMP},
</if>
- <if test="remark != null and remark !=''">
+ <if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
@@ -124,25 +124,25 @@
<!--@mbg.generated-->
update plt_product
<set>
- <if test="name != null and name !=''">
+ <if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
- <if test="type != null and type !=''">
+ <if test="type != null">
`type` = #{type,jdbcType=VARCHAR},
</if>
- <if test="image!= null and image !=''">
+ <if test="image!= null">
image = #{image,jdbcType=BIGINT},
</if>
- <if test="director != null and director !=''">
+ <if test="director != null">
director = #{director,jdbcType=BIGINT},
</if>
- <if test="dMobile != null and dMobile !=''">
+ <if test="dMobile != null">
d_mobile = #{dMobile,jdbcType=VARCHAR},
</if>
<if test="dt != null">
dt = #{dt,jdbcType=TIMESTAMP},
</if>
- <if test="remark != null and remark !=''">
+ <if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltStationMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltStationMapper.xml
index 30ed650..b412596 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PltStationMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PltStationMapper.xml
@@ -43,18 +43,18 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="lineId != null">line_id,</if>
- <if test="code != null and code !=''">code,</if>
- <if test="name != null and name !=''">name,</if>
- <if test="remark != null and remark !=''">remark,</if>
+ <if test="code != null">code,</if>
+ <if test="name != null">name,</if>
+ <if test="remark != null">remark,</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="lineId != null">#{lineId,jdbcType=VARCHAR},</if>
- <if test="code != null and code !=''">#{code,jdbcType=VARCHAR},</if>
- <if test="name != null and name !=''">#{name,jdbcType=VARCHAR},</if>
- <if test="remark != null and remark !=''">#{remark,jdbcType=VARCHAR},</if>
+ <if test="code != null">#{code,jdbcType=VARCHAR},</if>
+ <if test="name != null">#{name,jdbcType=VARCHAR},</if>
+ <if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
<if test="disabled != null">#{disabled,jdbcType=TINYINT},</if>
<if test="deleted != null">#{deleted,jdbcType=TINYINT},</if>
</trim>
@@ -62,16 +62,16 @@
<update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoPlt.PltStation">
update plt_station
<set>
- <if test="code != null and code !=''">
+ <if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="lineId != null">
line_id = #{lineId,jdbcType=BIGINT},
</if>
- <if test="name != null and name !=''">
+ <if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
- <if test="remark != null and remark !=''">
+ <if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="disabled != null">
diff --git a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/MarkQrCode/MarkQrCodeCtrl.java b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/MarkQrCode/MarkQrCodeCtrl.java
index 27d1652..da24ebb 100644
--- a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/MarkQrCode/MarkQrCodeCtrl.java
+++ b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/MarkQrCode/MarkQrCodeCtrl.java
@@ -7,6 +7,7 @@
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pmsGlobal.aop.Log;
+import com.dy.pmsGlobal.util.ExportExcelUtil;
import com.dy.pmsGlobal.util.QrCodeConstant;
import com.dy.pmsGlobal.util.QrCodeUtil;
import jakarta.servlet.http.HttpServletResponse;
@@ -68,6 +69,6 @@
vo.image = QrCodeUtil.genQrCode(vo.code);
list.add(vo) ;
}
- QrCodeUtil.downloadExcel(response, fileName, sheetName, list);
+ ExportExcelUtil.downloadExcel(response, fileName, sheetName, list);
}
}
diff --git a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java
index 3cb8c22..b12e7f1 100644
--- a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java
+++ b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java
@@ -1,13 +1,10 @@
package com.dy.pmsBase.util;
import com.dy.common.util.ConfigXml;
-import com.dy.common.util.MD5;
import com.dy.common.util.NumUtil;
import com.dy.common.webListener.ConfigListener;
import com.dy.pmsGlobal.daoBa.BaPrivilegeMapper;
-import com.dy.pmsGlobal.daoBa.BaPrivilegeMapper;
import com.dy.pmsGlobal.pojoBa.BaPrivilege;
-import com.dy.pmsGlobal.pojoBa.BaUser;
import org.jdom2.Document;
import org.jdom2.Element;
import org.springframework.beans.factory.annotation.Autowired;
@@ -48,9 +45,12 @@
} catch (InterruptedException e) {
e.printStackTrace();
}finally {
+ /*
if(!this.existPrivileges()){
this.init(event);
}
+ */
+ this.init(event);
}
}
@@ -76,12 +76,16 @@
if(prs != null){
List<Element> list = prs.getChildren() ;
if(list != null){
- for(Element ele : list){
- String num = ele.getAttributeValue("num") ;
- String name = ele.getAttributeValue("name") ;
- String type = ele.getAttributeValue("type") ;
- String typeName = ele.getAttributeValue("typeName") ;
- this.savePrivilege(num, name, type,typeName);
+ Long totalInDb = this.countTotalPrivileges() ;
+ if(list.size() != totalInDb){
+ this.deleteAllPrivilegesInDb();
+ for(Element ele : list){
+ String num = ele.getAttributeValue("num") ;
+ String name = ele.getAttributeValue("name") ;
+ String type = ele.getAttributeValue("type") ;
+ String typeName = ele.getAttributeValue("typeName") ;
+ this.savePrivilege(num, name, type,typeName);
+ }
}
}
}
@@ -90,7 +94,7 @@
/**
- * 鏁版嵁搴撲腑鏄惁瀛樺湪琛屾斂鍖哄垝鏁版嵁
+ * 鏁版嵁搴撲腑鏄惁瀛樺湪鐩稿叧鏁版嵁
* @return 瀛樺湪鍚�
*/
private boolean existPrivileges(){
@@ -98,7 +102,22 @@
return (total != null && total > 0) ;
}
+ /**
+ * 鏁版嵁搴撲腑鏄惁瀛樺湪鐩稿叧鏁版嵁
+ * @return 瀛樺湪鍚�
+ */
+ private Long countTotalPrivileges(){
+ return this.privilegeDao.selectCount() ;
+ }
+
+ /**
+ * 鏁版嵁搴撲腑鏄惁瀛樺湪鐩稿叧鏁版嵁
+ * @return 瀛樺湪鍚�
+ */
+ private void deleteAllPrivilegesInDb(){
+ this.privilegeDao.deleteAll() ;
+ }
/**
* 淇濆瓨鏉冮檺
* @param name 缂栫爜
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java
index 67e1afd..4626135 100644
--- a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductCtrl.java
@@ -7,6 +7,9 @@
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pmsGlobal.aop.Log;
import com.dy.pmsGlobal.pojoPlt.PltProduct;
+import com.dy.pmsGlobal.pojoPlt.PltStation;
+import com.dy.pmsGlobal.util.ExportExcelUtil;
+import com.dy.pmsGlobal.util.QrCodeConstant;
import com.dy.pmsGlobal.util.QrCodeUtil;
import com.google.zxing.WriterException;
import jakarta.servlet.http.HttpServletResponse;
@@ -137,7 +140,7 @@
*/
@GetMapping(path="getProduct")
@SsoPowerAop(power = "10300000")
- @Log("鍙牴鎹畂rderId鏌ヨ浜у搧")
+ @Log("鏍规嵁orderId鏌ヨ浜у搧")
public BaseResponse<List<PltProduct>> getProduct(Long orderId){
return BaseResponseUtils.buildSuccess(proSv.getProduct(orderId));
}
@@ -149,8 +152,25 @@
public void export(@RequestBody QueryVo queryVo, HttpServletResponse response){
List<Converter> list = new ArrayList<>() ;
- List<PltProduct> porList = proSv.selectAll(queryVo);
- // 浣跨敤骞惰娴佹彁楂樻�ц兘
+ List<PltProduct> products = proSv.selectAll(queryVo);
+ if(products != null){
+ for(PltProduct product : products){
+ ExcelVo vo = new ExcelVo();
+ vo.name = product.name;
+ vo.type = product.type;
+ vo.code = product.code;
+ try {
+ vo.qrCode = QrCodeUtil.genQrCode(product.code);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (WriterException e) {
+ e.printStackTrace();
+ }
+ list.add(vo);
+ }
+ }
+ // 浣跨敤骞惰娴佹彁楂樻�ц兘锛屼絾鐢熸垚鐨勭粨鏋滃彉鎴愭棤搴忕殑浜�
+ /*
porList.parallelStream().forEach(pro -> {
ExcelVo vo = new ExcelVo();
vo.name = pro.name;
@@ -165,7 +185,8 @@
}
list.add(vo);
});
- QrCodeUtil.downloadExcel(response, fileName,sheetName,list);
+ */
+ ExportExcelUtil.downloadExcel(response, fileName, sheetName, list);
}
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/station/StationCtrl.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/station/StationCtrl.java
index ece32c2..00c1890 100644
--- a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/station/StationCtrl.java
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/station/StationCtrl.java
@@ -9,6 +9,7 @@
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pmsGlobal.aop.Log;
import com.dy.pmsGlobal.pojoPlt.PltStation;
+import com.dy.pmsGlobal.util.ExportExcelUtil;
import com.dy.pmsGlobal.util.QrCodeConstant;
import com.dy.pmsGlobal.util.QrCodeUtil;
import com.google.zxing.WriterException;
@@ -17,7 +18,6 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
-import io.netty.channel.EventLoopGroup ;
import java.io.IOException;
import java.util.ArrayList;
@@ -150,11 +150,28 @@
List<Converter> list = new ArrayList<>() ;
List<PltStation> stations = sv.selectAll();
- // 浣跨敤骞惰娴佹彁楂樻�ц兘
+ if(stations != null){
+ for(PltStation station : stations){
+ ExcelVo vo = new ExcelVo();
+ vo.name = station.name;
+ //vo.code = "103"+station.id;
+ vo.lineName = station.lineName;
+ try {
+ vo.qrCode = QrCodeUtil.genQrCode(QrCodeConstant.TypeStation+station.id);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (WriterException e) {
+ e.printStackTrace();
+ }
+ list.add(vo);
+ }
+ }
+ // 浣跨敤骞惰娴佹彁楂樻�ц兘锛屼絾鐢熸垚鐨勭粨鏋滃彉鎴愭棤搴忕殑浜�
+ /*
stations.parallelStream().forEach(station -> {
ExcelVo vo = new ExcelVo();
vo.name = station.name;
-// vo.code = "103"+station.id;
+ //vo.code = "103"+station.id;
vo.lineName = station.lineName;
try {
vo.qrCode = QrCodeUtil.genQrCode(QrCodeConstant.TypeStation+station.id);
@@ -165,7 +182,8 @@
}
list.add(vo);
});
- QrCodeUtil.downloadExcel(response, fileName,sheetName,list);
+ */
+ ExportExcelUtil.downloadExcel(response, fileName, sheetName, list);
}
}
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 202121f..66591c9 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
@@ -71,7 +71,6 @@
}
private String getNextCode(){
- log.info("鑾峰彇宸ョ珯缂栧彿");
String maxCode = dao.selectMaxCode();
if (StringUtils.isBlank(maxCode)) {
return DEFAULT_CODE;
diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java
index 7dfb822..e33670b 100644
--- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java
+++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java
@@ -8,6 +8,7 @@
import com.dy.pmsGlobal.aop.Log;
import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan;
import com.dy.pmsGlobal.pojoPr.PrDevice;
+import com.dy.pmsGlobal.util.ExportExcelUtil;
import com.dy.pmsGlobal.util.QrCodeUtil;
import com.google.zxing.WriterException;
import jakarta.servlet.http.HttpServletResponse;
@@ -147,7 +148,7 @@
list.add(vo);
});
log.info("瀵煎嚭璁惧鍙峰強浜岀淮鐮佽�楁椂锛�"+(new Date().getTime()-start.getTime())+"ms");
- QrCodeUtil.downloadExcel(response, fileName,sheetName,list);
+ ExportExcelUtil.downloadExcel(response, fileName,sheetName,list);
log.info("瀵煎嚭璁惧鍙峰強浜岀淮鐮佽�楁椂锛�"+(new Date().getTime()-start.getTime())+"ms");
}
@GetMapping(path="exportDeviceNo")
@@ -168,7 +169,7 @@
PrAssemblyPlan plan = sv.selectByBatchId(batchId);
String fileNameStr = plan.name +"-"+ fileName;
log.info("瀵煎嚭璁惧鍙疯�楁椂锛�"+(new Date().getTime()-start.getTime())+"ms");
- QrCodeUtil.downloadExcel(response, fileNameStr,sheetName,list);
+ ExportExcelUtil.downloadExcel(response, fileNameStr,sheetName,list);
log.info("瀵煎嚭璁惧鍙疯�楁椂锛�"+(new Date().getTime()-start.getTime())+"ms");
}
}
--
Gitblit v1.8.0