From 7a8a84577894b766a95c6cbfa5ac7b51e54ac242 Mon Sep 17 00:00:00 2001
From: zhai <1528081232@qq.com>
Date: 星期三, 17 九月 2025 09:06:54 +0800
Subject: [PATCH] 1、获取文件大写修改 2、提交jdbc连接地质
---
src/main/java/com/zbooksoft/gdmis/controller/CatYswjxxController.java | 108 ++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 81 insertions(+), 27 deletions(-)
diff --git a/src/main/java/com/zbooksoft/gdmis/controller/CatYswjxxController.java b/src/main/java/com/zbooksoft/gdmis/controller/CatYswjxxController.java
index 7b0c754..e4863fd 100644
--- a/src/main/java/com/zbooksoft/gdmis/controller/CatYswjxxController.java
+++ b/src/main/java/com/zbooksoft/gdmis/controller/CatYswjxxController.java
@@ -12,7 +12,7 @@
import com.ruili.wcp.service.config.ViewService;
import com.ruili.wcp.web.model.AjaxResponse;
import com.ruili.wcp.web.model.ErrorInfo;
-import com.zbooksoft.gdmis.common.PdfUtil;
+import com.zbooksoft.gdmis.common.*;
import com.zbooksoft.gdmis.data.entity.CatYswjxx;
import com.zbooksoft.gdmis.data.entity.PackingManage;
import com.zbooksoft.gdmis.service.CatCheckService;
@@ -123,8 +123,8 @@
String cgSql = "select NVL(max(BGBH), 0) BGBH FROM CAT_ITEM_CGWJXX";
Map<String, Object> stringMap = jdbcTemplate.queryForMap(cgSql);
int maxDH = Integer.parseInt(stringMap.get("BGBH").toString());
+ int newDH = maxDH + 1;
for (int i = 0; i < ids.size(); i++) {
- int newDH = maxDH + 1 + i;
String newDhString = String.format("%04d", newDH);
String sql = "select * from CAT_ITEM_YSWJXX where id = " + ids.get(i);
Map<String, Object> stringObjectMap = jdbcTemplate.queryForMap(sql);
@@ -260,30 +260,35 @@
String timestamp = Long.toString(System.currentTimeMillis());
try {
+ //1193266555786362880,1193266555916386304,1193266556004466688,1193266556105129984,1193266556193210368,1193266556277096448,1193266556377759744,1193266556474228736,1193266556545531904 鍙樻垚list
+ String[] idList = ids.split(",");
+
// 璇诲彇鏂囦欢瀛樻斁璺緞
SystemConfig config = SystemConfig.getInstance();
filePath = config.getAttachUploadPath() + "dataPack" + File.separator + userName + "_" + timestamp + File.separator;
// for (int i = 0; i < idList.length; i++) {
- String wjljSql = "SELECT WJLJ FROM CAT_ITEM_YSWJXX WHERE ID = " + ids;
- List<Map<String, Object>> wjljList = jdbcTemplate.queryForList(wjljSql);
- if (wjljList.size() > 0) {
- String newSavePath = filePath;
- if (wjljList.get(0).get("WJLJ") != null) {
- String cddzwjlj = wjljList.get(0).get("WJLJ").toString();
- File file = new File(cddzwjlj);
- String name = file.getName();
- if (name.contains(".pdf") || name.contains(".PDF")) {
- String parent = file.getParent();
- String newName = "tmp_" + name;
- String newCddzwjlj = parent + File.separator + newName;
- PdfUtil.addBlankPageAtBeginning(cddzwjlj, newCddzwjlj);
- cddzwjlj = newCddzwjlj;
+ for (int i = 0; i < idList.length; i++) {
+ String wjljSql = "SELECT WJLJ,WJTM FROM CAT_ITEM_YSWJXX WHERE ID = " + idList[i];
+ List<Map<String, Object>> wjljList = jdbcTemplate.queryForList(wjljSql);
+ if (wjljList.size() > 0) {
+ String newSavePath = filePath;
+ if (wjljList.get(0).get("WJLJ") != null) {
+ String cddzwjlj = wjljList.get(0).get("WJLJ").toString();
+ String wjm = wjljList.get(0).get("WJTM").toString();
+ File file = new File(cddzwjlj);
+ String name = file.getName();
+ if (name.contains(".pdf") || name.contains(".PDF")) {
+ String parent = file.getParent();
+ String newName = "tmp_" + name;
+ String newCddzwjlj = parent + File.separator + newName;
+ PdfUtil.addBlankPageAtBeginning(cddzwjlj, newCddzwjlj, wjm);
+ cddzwjlj = newCddzwjlj;
+ }
+ copyFile(cddzwjlj, newSavePath + File.separator + name);
}
- copyFile(cddzwjlj, newSavePath + File.separator + name);
- }
+ }
}
-// }
// 鍘嬬缉鏂囦欢
generatePath = zipFile(new File(filePath), "rar");
} catch (Exception ex) {
@@ -304,8 +309,7 @@
// 寰幆鍙栧嚭娴佷腑鐨勬暟鎹�
byte[] b = new byte[100];
int len;
- while ((len = inStream.read(b)) > 0)
- response.getOutputStream().write(b, 0, len);
+ while ((len = inStream.read(b)) > 0) response.getOutputStream().write(b, 0, len);
inStream.close();
} catch (Exception e) {
e.printStackTrace();
@@ -350,7 +354,6 @@
* 瀵煎叆椤甸潰
*
* @param type 0:浠庤浆瀛斿熀鏈俊鎭繘鍏� 1:浠庨捇瀛斿浘骞呰繘鍏�
- * @return
*/
@RequestMapping({"/updateFileTypeIndex"})
@RequiresUser
@@ -358,6 +361,61 @@
ModelAndView mv = new ModelAndView("gh/catAjjxx/updateFileTypeIndex");
return mv;
}
+
+ /**
+ * @param type 0 鏄垚鏋� 1 鏄師濮�
+ * @return
+ */
+ @RequestMapping({"/printLabelIndex"})
+ @RequiresUser
+ public ModelAndView printLabelIndex(Integer type) {
+ ModelAndView mv = new ModelAndView("gh/catAjjxx/printLabelIndex");
+ mv.addObject("type", type);
+ return mv;
+ }
+
+ /**
+ * @param fileType 鎵撳嵃绫诲瀷 0鏄洅瀛� 1鏄枃浠�
+ * @param type 璧勬枡绫诲瀷 0鎴愭灉鎶ュ憡 1鍘熷璧勬枡
+ * @param idList
+ * @return
+ */
+ @RequestMapping(value = "/printLabel")
+ @ResponseBody
+ @RequiresUser
+ public Object printLabel(String fileType, Integer type, @RequestBody List<Long> idList) {
+ try {
+ //鎵撳嵃鐩掑瓙
+ if ("鐩掑瓙".equals(fileType)) {
+ if (type == 0) {
+
+ }
+ if (type == 1) {
+
+ UsbSyncExampleWindows usbSyncExampleWindows = new UsbSyncExampleWindows();
+ usbSyncExampleWindows.printFileLabel(idList);
+// ZT411RFIDPrintService zt411RFIDPrintService = new ZT411RFIDPrintService();
+// zt411RFIDPrintService.printRFIDLabel(idList);
+ }
+ }
+ //鎵撳嵃鏂囦欢
+ if ("鏂囦欢".equals(fileType)) {
+ if (type == 0) {
+ UsbSyncExampleWindowsItemCg usbSyncExampleWindowsItemCg = new UsbSyncExampleWindowsItemCg();
+ usbSyncExampleWindowsItemCg.printItemLabelCg(idList);
+ }
+ if (type == 1) {
+ UsbSyncExampleWindowsItem usbSyncExampleWindowsItem = new UsbSyncExampleWindowsItem();
+ usbSyncExampleWindowsItem.printItemLabel(idList);
+ }
+ }
+ return new AjaxResponse(true);
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return new AjaxResponse(new ErrorInfo(e.getMessage()), false);
+ }
+ }
+
/**
* 鑾峰彇鏂囦欢绫诲瀷
@@ -408,10 +466,6 @@
}
}
- public static void main(String[] args) {
- String fileType = "瑙�/G";
- String substring = fileType.substring(fileType.indexOf("/") + 1);
- System.out.println(substring);
- }
+
}
--
Gitblit v1.9.1