From 2a3c80a8bd6eea76a14be03929f65dfebf117f95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BA=84=E9=94=90=E6=B3=A2?=
<10549902+zhuangruibo@user.noreply.gitee.com>
Date: Tue, 14 Apr 2026 16:10:12 +0800
Subject: [PATCH] =?UTF-8?q?=E9=80=81=E7=A0=81=E5=85=A5=E4=BC=81=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../enterprisePubQrcodeList.html | 415 +++++++
.../EnterprisePubQrcodeController.java | 317 +++++
.../zdxt/code/domain/EnterprisePubQrcode.java | 310 +++++
.../mapper/EnterprisePubQrcodeMapper.java | 90 ++
.../impl/EnterprisePubQrcodeServiceImpl.java | 1043 +++++++++++++++++
.../java/com/zdxt/code/utils/QRCodeUtil.java | 83 ++
.../mapper/EnterprisePubQrcodeMapper.xml | 189 +++
7 files changed, 2447 insertions(+)
create mode 100644 lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/enterprise_pub_qrcode/enterprisePubQrcodeList.html
create mode 100644 lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnterprisePubQrcodeController.java
create mode 100644 lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/EnterprisePubQrcode.java
create mode 100644 lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/EnterprisePubQrcodeMapper.java
create mode 100644 lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterprisePubQrcodeServiceImpl.java
create mode 100644 lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterprisePubQrcodeMapper.xml
diff --git a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/enterprise_pub_qrcode/enterprisePubQrcodeList.html b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/enterprise_pub_qrcode/enterprisePubQrcodeList.html
new file mode 100644
index 00000000..627874f6
--- /dev/null
+++ b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/enterprise_pub_qrcode/enterprisePubQrcodeList.html
@@ -0,0 +1,415 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnterprisePubQrcodeController.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnterprisePubQrcodeController.java
new file mode 100644
index 00000000..f95aab55
--- /dev/null
+++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnterprisePubQrcodeController.java
@@ -0,0 +1,317 @@
+package com.zdxt.code.controller;
+
+import java.io.IOException;
+import java.util.List;
+
+import com.zdxt.common.ZDResponse;
+import com.zdxt.common.controller.BaseController;
+import com.zdxt.common.util.TableDataInfo;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.zdxt.code.domain.EnterprisePubQrcode;
+import com.zdxt.code.service.IEnterprisePubQrcodeService;
+
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * 送码入企信息Controller
+ *
+ * @author chenrui
+ * @date 2026-04-10
+ */
+@Controller
+@RequestMapping("/code/enterprisePubQrcode")
+public class EnterprisePubQrcodeController extends BaseController
+{
+ private static final Logger log = LoggerFactory.getLogger(EnterprisePubQrcodeController.class);
+
+ private String prefix = "project/code/enterprise_pub_qrcode";
+
+ @Autowired
+ private IEnterprisePubQrcodeService enterprisePubQrcodeService;
+
+ @RequiresPermissions("code:pubQrcode:view")
+ @GetMapping()
+ public String pubQrcode()
+ {
+ return prefix + "/enterprisePubQrcodeList";
+ }
+
+ /**
+ * 查询送码入企信息列表
+ */
+ @RequiresPermissions("code:pubQrcode:list")
+ @PostMapping("/list")
+ @ResponseBody
+ public TableDataInfo list(EnterprisePubQrcode enterprisePubQrcode)
+ {
+ startPage();
+ List list = enterprisePubQrcodeService.selectEnterprisePubQrcodeList(enterprisePubQrcode);
+ return getDataTable(list);
+ }
+
+ /**
+ * 查询送码入企信息列表
+ */
+ @GetMapping("/queryList")
+ @ResponseBody
+ public ZDResponse queryList(EnterprisePubQrcode enterprisePubQrcode)
+ {
+ startPage();
+ List list = enterprisePubQrcodeService.selectEnterprisePubQrcodeList(enterprisePubQrcode);
+ return ZDResponse.success("查询成功", list);
+ }
+
+ /**
+ * 新增送码入企信息
+ */
+ @GetMapping("/add")
+ public String add()
+ {
+ return prefix + "/add";
+ }
+
+ /**
+ * 新增保存送码入企信息
+ */
+ @RequiresPermissions("code:pubQrcode:add")
+ @PostMapping("/add")
+ @ResponseBody
+ public ZDResponse addSave(EnterprisePubQrcode enterprisePubQrcode)
+ {
+ return enterprisePubQrcodeService.insertEnterprisePubQrcode(enterprisePubQrcode) > 0
+ ? ZDResponse.success("新增成功") : ZDResponse.error("新增失败");
+ }
+
+ /**
+ * 修改送码入企信息
+ */
+ @GetMapping("/edit/{id}")
+ public String edit(@PathVariable("id") String id, ModelMap mmap)
+ {
+ EnterprisePubQrcode enterprisePubQrcode = enterprisePubQrcodeService.selectEnterprisePubQrcodeById(id);
+ mmap.put("enterprisePubQrcode", enterprisePubQrcode);
+ return prefix + "/edit";
+ }
+
+ /**
+ * 修改保存送码入企信息
+ */
+ @RequiresPermissions("code:pubQrcode:edit")
+ @PostMapping("/edit")
+ @ResponseBody
+ public ZDResponse editSave(EnterprisePubQrcode enterprisePubQrcode)
+ {
+ return enterprisePubQrcodeService.updateEnterprisePubQrcode(enterprisePubQrcode) > 0
+ ? ZDResponse.success("修改成功") : ZDResponse.error("修改失败");
+ }
+
+ /**
+ * 删除送码入企信息
+ */
+ @RequiresPermissions("code:pubQrcode:remove")
+ @PostMapping("/remove")
+ @ResponseBody
+ public ZDResponse remove(String ids)
+ {
+ return enterprisePubQrcodeService.deleteEnterprisePubQrcodeByIds(ids) > 0
+ ? ZDResponse.success("删除成功") : ZDResponse.error("删除失败");
+ }
+
+ /**
+ * 获取送码入企信息详情
+ */
+ @RequiresPermissions("code:pubQrcode:detail")
+ @GetMapping("/detail")
+ @ResponseBody
+ public ZDResponse detail(String id)
+ {
+ return ZDResponse.success("查询成功",
+ enterprisePubQrcodeService.selectEnterprisePubQrcodeById(id));
+ }
+
+ /**
+ * 下载导入模板
+ */
+ @GetMapping("/importTemplate")
+ public void importTemplate(HttpServletResponse response)
+ {
+ try
+ {
+ // 创建模板Excel
+ Workbook workbook = new XSSFWorkbook();
+ Sheet sheet = workbook.createSheet("送码入企数据");
+ // 创建表头
+ Row headerRow = sheet.createRow(0);
+ headerRow.createCell(0).setCellValue("序号");
+ headerRow.createCell(1).setCellValue("企业名称");
+ headerRow.createCell(2).setCellValue("统一社会信用代码");
+ headerRow.createCell(3).setCellValue("归属区域");
+ headerRow.createCell(4).setCellValue("归属街道");
+ // 设置列宽
+ sheet.setColumnWidth(0, 2000);
+ sheet.setColumnWidth(1, 8000);
+ sheet.setColumnWidth(2, 6000);
+ sheet.setColumnWidth(3, 5000);
+ sheet.setColumnWidth(4, 5000);
+
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+ response.setHeader("Content-Disposition", "attachment;filename=enterprise_pub_qrcode_template.xlsx");
+ workbook.write(response.getOutputStream());
+ workbook.close();
+ }
+ catch (Exception e)
+ {
+ log.error("下载导入模板失败", e);
+ }
+ }
+
+ /**
+ * 导入送码入企数据
+ */
+ @RequiresPermissions("code:pubQrcode:add")
+ @PostMapping("/importData")
+ @ResponseBody
+ public ZDResponse importData(MultipartFile file)
+ {
+ try
+ {
+ String message = enterprisePubQrcodeService.importEnterprisePubQrcode(file);
+ return ZDResponse.success(message);
+ }
+ catch (Exception e)
+ {
+ log.error("导入送码入企数据失败", e);
+ return ZDResponse.error(e.getMessage());
+ }
+ }
+
+ /**
+ * 批量匹配送码入企数据
+ */
+ @RequiresPermissions("code:pubQrcode:edit")
+ @PostMapping("/matchSelectEnterprise")
+ @ResponseBody
+ public ZDResponse matchSelectEnterprise(String ids)
+ {
+ try
+ {
+ String message = enterprisePubQrcodeService.matchSelectEnterprise(ids);
+ return ZDResponse.success(message);
+ }
+ catch (Exception e)
+ {
+ log.error("批量匹配送码入企数据失败", e);
+ return ZDResponse.error(e.getMessage());
+ }
+ }
+
+ /**
+ * 强制匹配送码入企数据
+ */
+ @RequiresPermissions("code:pubQrcode:edit")
+ @PostMapping("/forceMatch")
+ @ResponseBody
+ public ZDResponse forceMatch(String id)
+ {
+ try
+ {
+ String message = enterprisePubQrcodeService.forceMatch(id);
+ return ZDResponse.success(message);
+ }
+ catch (Exception e)
+ {
+ log.error("强制匹配失败", e);
+ return ZDResponse.error(e.getMessage());
+ }
+ }
+
+ /**
+ * 下载送码入企PDF
+ */
+ @RequiresPermissions("code:pubQrcode:edit")
+ @GetMapping("/download")
+ public void download(String ids, HttpServletResponse response)
+ {
+ try
+ {
+ enterprisePubQrcodeService.downloadPdf(ids, response);
+ }
+ catch (Exception e)
+ {
+ log.error("下载PDF失败", e);
+ if (response.isCommitted())
+ {
+ log.warn("响应已提交,无法输出错误页面,客户端可能已断开连接");
+ return;
+ }
+ try
+ {
+ response.reset();
+ response.setContentType("text/html;charset=utf-8");
+ response.getOutputStream().write(
+ ("").getBytes("utf-8"));
+ response.getOutputStream().flush();
+ }
+ catch (IOException ex)
+ {
+ log.warn("输出错误响应失败,客户端可能已断开连接: {}", ex.getMessage());
+ }
+ catch (Exception ex)
+ {
+ log.error("输出错误响应失败", ex);
+ }
+ }
+ }
+
+ /**
+ * 生成送码入企PDF文件(落盘后返回下载地址)
+ */
+ @RequiresPermissions("code:pubQrcode:edit")
+ @PostMapping("/generatePdf")
+ @ResponseBody
+ public ZDResponse generatePdf(String ids)
+ {
+ try
+ {
+ String downloadUrl = enterprisePubQrcodeService.generatePdfFile(ids);
+ return ZDResponse.success("生成完成", downloadUrl);
+ }
+ catch (Exception e)
+ {
+ log.error("生成PDF失败", e);
+ return ZDResponse.error(e.getMessage());
+ }
+ }
+
+ /**
+ * 批量设置下载状态
+ */
+ @RequiresPermissions("code:pubQrcode:edit")
+ @PostMapping("/batchUpdateDownloadStatus")
+ @ResponseBody
+ public ZDResponse batchUpdateDownloadStatus(String ids, String downloadStatus, String remark)
+ {
+ try
+ {
+ int rows = enterprisePubQrcodeService.batchUpdateDownloadStatus(ids, downloadStatus, remark);
+ return rows > 0 ? ZDResponse.success("更新成功,共更新" + rows + "条记录") : ZDResponse.error("更新失败");
+ }
+ catch (Exception e)
+ {
+ log.error("批量设置下载状态失败", e);
+ return ZDResponse.error(e.getMessage());
+ }
+ }
+}
diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/EnterprisePubQrcode.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/EnterprisePubQrcode.java
new file mode 100644
index 00000000..80876d8e
--- /dev/null
+++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/EnterprisePubQrcode.java
@@ -0,0 +1,310 @@
+package com.zdxt.code.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zdxt.common.BaseDomain;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.Date;
+
+/**
+ * 送码入企信息对象 enterprise_pub_qrcode
+ *
+ * @author chenrui
+ * @date 2026-04-10
+ */
+public class EnterprisePubQrcode extends BaseDomain
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 主键ID */
+ private String id;
+
+ /** 企业名称 */
+ private String enterpriseName;
+
+ /** 企业纳税识别号 */
+ private String enterpriseNumber;
+
+ /** 归属区域名称 */
+ private String areaName;
+
+ /** 归属区域id */
+ private String areaId;
+
+ /** 归属街道名称 */
+ private String streetName;
+
+ /** 归属街道id */
+ private String streetId;
+
+ /** 匹配状态 */
+ private String matchingStatus;
+
+ /** 匹配消息 */
+ private String matchingMessage;
+
+ /** 下载情况 */
+ private String downloadStatus;
+
+ /** 上传单位名称 */
+ private String deptName;
+
+ /** 上传用户名称 */
+ private String userName;
+
+ /** 二维码存储路径 */
+ private String qrCodePath;
+
+ /** 上一次二维码生成时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date lastQrCodeTime;
+
+ /** 导入序号 */
+ private Integer importRowNum;
+
+ /** 导入文件名 */
+ private String importFileName;
+
+ /** 导入文件id */
+ private String importFileId;
+
+ /** 备注 */
+ private String remark;
+
+ /** 匹配到的目标类型 */
+ private String matchingToType;
+
+ /** 匹配到的目标id */
+ private String matchingToId;
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setEnterpriseName(String enterpriseName)
+ {
+ this.enterpriseName = enterpriseName;
+ }
+
+ public String getEnterpriseName()
+ {
+ return enterpriseName;
+ }
+
+ public void setEnterpriseNumber(String enterpriseNumber)
+ {
+ this.enterpriseNumber = enterpriseNumber;
+ }
+
+ public String getEnterpriseNumber()
+ {
+ return enterpriseNumber;
+ }
+
+ public void setAreaName(String areaName)
+ {
+ this.areaName = areaName;
+ }
+
+ public String getAreaName()
+ {
+ return areaName;
+ }
+
+ public void setAreaId(String areaId)
+ {
+ this.areaId = areaId;
+ }
+
+ public String getAreaId()
+ {
+ return areaId;
+ }
+
+ public void setStreetName(String streetName)
+ {
+ this.streetName = streetName;
+ }
+
+ public String getStreetName()
+ {
+ return streetName;
+ }
+
+ public void setStreetId(String streetId)
+ {
+ this.streetId = streetId;
+ }
+
+ public String getStreetId()
+ {
+ return streetId;
+ }
+
+ public void setMatchingStatus(String matchingStatus)
+ {
+ this.matchingStatus = matchingStatus;
+ }
+
+ public String getMatchingStatus()
+ {
+ return matchingStatus;
+ }
+
+ public void setMatchingMessage(String matchingMessage)
+ {
+ this.matchingMessage = matchingMessage;
+ }
+
+ public String getMatchingMessage()
+ {
+ return matchingMessage;
+ }
+
+ public void setDownloadStatus(String downloadStatus)
+ {
+ this.downloadStatus = downloadStatus;
+ }
+
+ public String getDownloadStatus()
+ {
+ return downloadStatus;
+ }
+
+ public void setDeptName(String deptName)
+ {
+ this.deptName = deptName;
+ }
+
+ public String getDeptName()
+ {
+ return deptName;
+ }
+
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ public void setQrCodePath(String qrCodePath)
+ {
+ this.qrCodePath = qrCodePath;
+ }
+
+ public String getQrCodePath()
+ {
+ return qrCodePath;
+ }
+
+ public void setLastQrCodeTime(Date lastQrCodeTime)
+ {
+ this.lastQrCodeTime = lastQrCodeTime;
+ }
+
+ public Date getLastQrCodeTime()
+ {
+ return lastQrCodeTime;
+ }
+
+ public void setImportRowNum(Integer importRowNum)
+ {
+ this.importRowNum = importRowNum;
+ }
+
+ public Integer getImportRowNum()
+ {
+ return importRowNum;
+ }
+
+ public void setImportFileName(String importFileName)
+ {
+ this.importFileName = importFileName;
+ }
+
+ public String getImportFileName()
+ {
+ return importFileName;
+ }
+
+ public void setImportFileId(String importFileId)
+ {
+ this.importFileId = importFileId;
+ }
+
+ public String getImportFileId()
+ {
+ return importFileId;
+ }
+
+ public void setRemark(String remark)
+ {
+ this.remark = remark;
+ }
+
+ public String getRemark()
+ {
+ return remark;
+ }
+
+ public void setMatchingToType(String matchingToType)
+ {
+ this.matchingToType = matchingToType;
+ }
+
+ public String getMatchingToType()
+ {
+ return matchingToType;
+ }
+
+ public void setMatchingToId(String matchingToId)
+ {
+ this.matchingToId = matchingToId;
+ }
+
+ public String getMatchingToId()
+ {
+ return matchingToId;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("enterpriseName", getEnterpriseName())
+ .append("enterpriseNumber", getEnterpriseNumber())
+ .append("areaName", getAreaName())
+ .append("areaId", getAreaId())
+ .append("streetName", getStreetName())
+ .append("streetId", getStreetId())
+ .append("matchingStatus", getMatchingStatus())
+ .append("matchingMessage", getMatchingMessage())
+ .append("downloadStatus", getDownloadStatus())
+ .append("deptName", getDeptName())
+ .append("deptId", getDeptId())
+ .append("userName", getUserName())
+ .append("userId", getUserId())
+ .append("createTime", getCreateTime())
+ .append("createBy", getCreateBy())
+ .append("qrCodePath", getQrCodePath())
+ .append("lastQrCodeTime", getLastQrCodeTime())
+ .append("importRowNum", getImportRowNum())
+ .append("importFileName", getImportFileName())
+ .append("importFileId", getImportFileId())
+ .append("remark", getRemark())
+ .append("matchingToType", getMatchingToType())
+ .append("matchingToId", getMatchingToId())
+ .toString();
+ }
+}
diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/EnterprisePubQrcodeMapper.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/EnterprisePubQrcodeMapper.java
new file mode 100644
index 00000000..97ab8e77
--- /dev/null
+++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/EnterprisePubQrcodeMapper.java
@@ -0,0 +1,90 @@
+package com.zdxt.code.mapper;
+
+import com.zdxt.code.domain.EnterprisePubQrcode;
+
+import java.util.List;
+
+/**
+ * 送码入企信息Mapper接口
+ *
+ * @author chenrui
+ * @date 2026-04-10
+ */
+public interface EnterprisePubQrcodeMapper
+{
+ /**
+ * 查询送码入企信息
+ *
+ * @param id 送码入企信息ID
+ * @return 送码入企信息
+ */
+ EnterprisePubQrcode selectEnterprisePubQrcodeById(String id);
+
+ /**
+ * 查询送码入企信息列表
+ *
+ * @param enterprisePubQrcode 送码入企信息
+ * @return 送码入企信息集合
+ */
+ List selectEnterprisePubQrcodeList(EnterprisePubQrcode enterprisePubQrcode);
+
+ /**
+ * 新增送码入企信息
+ *
+ * @param enterprisePubQrcode 送码入企信息
+ * @return 结果
+ */
+ int insertEnterprisePubQrcode(EnterprisePubQrcode enterprisePubQrcode);
+
+ /**
+ * 修改送码入企信息
+ *
+ * @param enterprisePubQrcode 送码入企信息
+ * @return 结果
+ */
+ int updateEnterprisePubQrcode(EnterprisePubQrcode enterprisePubQrcode);
+
+ /**
+ * 删除送码入企信息
+ *
+ * @param id 送码入企信息ID
+ * @return 结果
+ */
+ int deleteEnterprisePubQrcodeById(String id);
+
+ /**
+ * 批量删除送码入企信息
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ int deleteEnterprisePubQrcodeByIds(String[] ids);
+
+ /**
+ * 根据统一社会信用代码查询送码入企信息
+ *
+ * @param enterpriseNumber 统一社会信用代码
+ * @return 送码入企信息
+ */
+ EnterprisePubQrcode selectEnterprisePubQrcodeByEnterpriseNumber(String enterpriseNumber);
+
+ /**
+ * 根据ID数组批量查询送码入企信息
+ *
+ * @param ids ID数组
+ * @return 送码入企信息集合
+ */
+ List selectEnterprisePubQrcodeByIds(String[] ids);
+
+ /**
+ * 批量更新下载状态和备注
+ *
+ * @param ids 需要更新的ID数组
+ * @param downloadStatus 下载状态
+ * @param remark 备注
+ * @return 结果
+ */
+ int batchUpdateDownloadStatus(@org.apache.ibatis.annotations.Param("ids") String[] ids,
+ @org.apache.ibatis.annotations.Param("downloadStatus") String downloadStatus,
+ @org.apache.ibatis.annotations.Param("remark") String remark);
+}
diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterprisePubQrcodeServiceImpl.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterprisePubQrcodeServiceImpl.java
new file mode 100644
index 00000000..d1be1f3d
--- /dev/null
+++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterprisePubQrcodeServiceImpl.java
@@ -0,0 +1,1043 @@
+package com.zdxt.code.service.impl;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.regex.Pattern;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.lowagie.text.Document;
+import com.lowagie.text.Element;
+import com.lowagie.text.Image;
+import com.lowagie.text.PageSize;
+import com.lowagie.text.Paragraph;
+import com.lowagie.text.Phrase;
+import com.lowagie.text.pdf.BaseFont;
+import com.lowagie.text.pdf.PdfAction;
+import com.lowagie.text.pdf.PdfDestination;
+import com.lowagie.text.pdf.PdfOutline;
+import com.lowagie.text.pdf.PdfPCell;
+import com.lowagie.text.pdf.PdfPTable;
+import com.lowagie.text.pdf.PdfWriter;
+import com.zdxt.auth.dto.UserBean;
+import com.zdxt.auth.feign.FileUploadApi;
+import com.zdxt.auth.feign.UserApi;
+import com.zdxt.auth.project.system.dept.service.IDeptService;
+import com.zdxt.code.domain.EnterpriseInformation;
+import com.zdxt.code.mapper.EnterpriseInformationMapper;
+import com.zdxt.code.service.ISsztJbxx110497Service;
+import com.zdxt.code.service.IQrCodeGenerateHistoryService;
+import com.zdxt.code.domain.QrCodeGenerateHistory;
+import com.zdxt.common.config.RuoYiConfig;
+import com.zdxt.common.util.Constants;
+import com.zdxt.common.util.DateUtils;
+import com.zdxt.common.util.StringUtils;
+import com.zdxt.domain.auth.Dept;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+import com.zdxt.code.mapper.EnterprisePubQrcodeMapper;
+import com.zdxt.code.domain.EnterprisePubQrcode;
+import com.zdxt.code.service.IEnterprisePubQrcodeService;
+import com.zdxt.code.utils.PasswordTools;
+import com.zdxt.code.utils.QRCodeUtil;
+
+/**
+ * 送码入企信息Service业务层处理
+ *
+ * @author chenrui
+ * @date 2026-04-10
+ */
+@Service
+public class EnterprisePubQrcodeServiceImpl implements IEnterprisePubQrcodeService
+{
+ private static final Logger log = LoggerFactory.getLogger(EnterprisePubQrcodeServiceImpl.class);
+
+ /** 统一社会信用代码正则:18位,由数字和大写字母组成(不含 I、O、Z、S、V) */
+ private static final Pattern CREDIT_CODE_PATTERN = Pattern.compile("^[0-9A-HJ-NP-RTUW-Y]{2}\\d{6}[0-9A-HJ-NP-RTUW-Y]{10}$");
+
+ /** 企业名称正则:2-100个字符,允许中文、英文、数字、括号、破折号等 */
+ private static final Pattern ENTERPRISE_NAME_PATTERN = Pattern.compile("^[\\u4e00-\\u9fa5a-zA-Z0-9()()\\-·]{2,100}$");
+
+ /** 背景图片classpath路径 */
+ private static final String BG_IMAGE_PATH = "images/enterprise_pub_qrcode_bg.jpg";
+
+ private static final String AES_KEY = "zdxt-ec-enterprise-qrcd!";
+
+ @Autowired
+ private UserApi userApi;
+
+ @Autowired
+ private EnterprisePubQrcodeMapper enterprisePubQrcodeMapper;
+
+ @Autowired
+ private IDeptService deptService;
+
+ @Autowired
+ private ISsztJbxx110497Service ssztJbxx110497Service;
+
+ @Autowired
+ private EnterpriseInformationMapper enterpriseInformationMapper;
+
+ @Autowired
+ private IQrCodeGenerateHistoryService iQrCodeGenerateHistoryService;
+
+ @Autowired
+ private FileUploadApi fileUploadApi;
+
+ @Value("${ruoyi.profile}")
+ private String filePath;
+
+ public static String symmetricRQValidateCodeEncrypt(String content) {
+ try {
+ javax.crypto.spec.SecretKeySpec secretKey = new javax.crypto.spec.SecretKeySpec(AES_KEY.getBytes(), "AES");
+ javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance("AES/ECB/PKCS5Padding");
+ cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, secretKey);
+ byte[] encrypted = cipher.doFinal(content.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ return java.util.Base64.getEncoder().encodeToString(encrypted);
+ } catch (Exception e) {
+ throw new RuntimeException("AES加密失败", e);
+ }
+ //return SecureUtil.aes(AES_KEY.getBytes()).encryptBase64(content);
+ }
+
+ /**
+ * 查询送码入企信息
+ *
+ * @param id 送码入企信息ID
+ * @return 送码入企信息
+ */
+ @Override
+ public EnterprisePubQrcode selectEnterprisePubQrcodeById(String id)
+ {
+ return enterprisePubQrcodeMapper.selectEnterprisePubQrcodeById(id);
+ }
+
+ /**
+ * 查询送码入企信息列表
+ *
+ * @param enterprisePubQrcode 送码入企信息
+ * @return 送码入企信息
+ */
+ @Override
+ public List selectEnterprisePubQrcodeList(EnterprisePubQrcode enterprisePubQrcode)
+ {
+ return enterprisePubQrcodeMapper.selectEnterprisePubQrcodeList(enterprisePubQrcode);
+ }
+
+ /**
+ * 新增送码入企信息
+ *
+ * @param enterprisePubQrcode 送码入企信息
+ * @return 结果
+ */
+ @Override
+ public int insertEnterprisePubQrcode(EnterprisePubQrcode enterprisePubQrcode)
+ {
+ enterprisePubQrcode.setCreateTime(DateUtils.getNowDate());
+ return enterprisePubQrcodeMapper.insertEnterprisePubQrcode(enterprisePubQrcode);
+ }
+
+ /**
+ * 修改送码入企信息
+ *
+ * @param enterprisePubQrcode 送码入企信息
+ * @return 结果
+ */
+ @Override
+ public int updateEnterprisePubQrcode(EnterprisePubQrcode enterprisePubQrcode)
+ {
+ return enterprisePubQrcodeMapper.updateEnterprisePubQrcode(enterprisePubQrcode);
+ }
+
+ /**
+ * 删除送码入企信息对象
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ @Override
+ public int deleteEnterprisePubQrcodeByIds(String ids)
+ {
+ return enterprisePubQrcodeMapper.deleteEnterprisePubQrcodeByIds(Convert.toStrArray(ids));
+ }
+
+ /**
+ * 删除送码入企信息信息
+ *
+ * @param id 送码入企信息ID
+ * @return 结果
+ */
+ @Override
+ public int deleteEnterprisePubQrcodeById(String id)
+ {
+ return enterprisePubQrcodeMapper.deleteEnterprisePubQrcodeById(id);
+ }
+
+ /**
+ * 导入送码入企信息Excel
+ *
+ * @param file Excel文件
+ * @return 导入结果消息
+ * @throws Exception 异常
+ */
+ @Override
+ public String importEnterprisePubQrcode(MultipartFile file) throws Exception
+ {
+ UserBean currentUser = userApi.getCurrentUser();
+ // 1.解析Excel文件
+ List dataList = parseExcelToList(file);
+ if (dataList == null || dataList.isEmpty())
+ {
+ throw new Exception("导入数据不能为空!");
+ }
+
+ // 2.验证数据
+ StringBuilder errorMsg = new StringBuilder();
+ String importFileId = UUID.randomUUID().toString().replace("-", "");
+ String importFileName = file.getOriginalFilename();
+
+ for (int i = 0; i < dataList.size(); i++)
+ {
+ EnterprisePubQrcode item = dataList.get(i);
+ int rowNum = i + 2; // Excel行号(第1行为表头,数据从第2行开始)
+
+ // 验证企业名称
+ if (StrUtil.isBlank(item.getEnterpriseName()))
+ {
+ errorMsg.append("第").append(rowNum).append("行,企业名称不能为空;");
+ }
+ else if (!ENTERPRISE_NAME_PATTERN.matcher(item.getEnterpriseName().trim()).matches())
+ {
+ errorMsg.append("第").append(rowNum).append("行,企业名称格式不正确(应为2-100个中英文、数字或括号组合);");
+ }
+
+ // 验证统一社会信用代码
+ if (StrUtil.isBlank(item.getEnterpriseNumber()))
+ {
+ errorMsg.append("第").append(rowNum).append("行,统一社会信用代码不能为空;");
+ }
+ else if (!CREDIT_CODE_PATTERN.matcher(item.getEnterpriseNumber().trim().toUpperCase()).matches())
+ {
+ errorMsg.append("第").append(rowNum).append("行,统一社会信用代码格式不正确(应为18位数字和大写字母组合);");
+ }
+
+ // 验证归属区域
+ if (StrUtil.isBlank(item.getAreaName()))
+ {
+ errorMsg.append("第").append(rowNum).append("行,归属区域不能为空;");
+ }
+ else
+ {
+ Dept areaDept=deptService.selectDeptByDeptName2(item.getAreaName().trim());
+ if (areaDept == null)
+ {
+ errorMsg.append("第").append(rowNum).append("行,归属区域\"").append(item.getAreaName()).append("\"在系统中未找到;");
+ }
+ else
+ {
+ item.setAreaId(areaDept.getDeptId());
+ }
+ }
+
+ // 验证归属街道
+ if (StrUtil.isBlank(item.getStreetName()))
+ {
+ errorMsg.append("第").append(rowNum).append("行,归属街道不能为空;");
+ }
+ else
+ {
+ List deptList=deptService.selectDeptByDeptName(item.getStreetName().trim());
+ if (deptList == null || deptList.isEmpty())
+ {
+ errorMsg.append("第").append(rowNum).append("行,归属街道\"").append(item.getStreetName()).append("\"在系统中未找到;");
+ }
+ else
+ {
+ Dept streetDept = deptList.get(0);
+ item.setStreetId(streetDept.getDeptId());
+ }
+ }
+
+ // 设置导入相关信息
+ item.setImportFileName(importFileName);
+ item.setImportFileId(importFileId);
+ }
+
+ // 3.如果有错误,取消导入
+ if (errorMsg.length() > 0)
+ {
+ throw new Exception("导入失败:" + errorMsg.toString());
+ }
+
+ // 4.批量导入数据(根据EnterpriseNumber判断新增或更新)
+ int insertCount = 0;
+ int updateCount = 0;
+ for (EnterprisePubQrcode item : dataList)
+ {
+ EnterprisePubQrcode existing = enterprisePubQrcodeMapper.selectEnterprisePubQrcodeByEnterpriseNumber(item.getEnterpriseNumber().trim());
+ if (existing != null)
+ {
+ // 已存在,更新记录并重置状态
+ existing.setEnterpriseName(item.getEnterpriseName());
+ existing.setEnterpriseNumber(item.getEnterpriseNumber());
+ existing.setAreaName(item.getAreaName());
+ existing.setAreaId(item.getAreaId());
+ existing.setStreetName(item.getStreetName());
+ existing.setStreetId(item.getStreetId());
+ existing.setImportRowNum(item.getImportRowNum());
+ existing.setImportFileName(item.getImportFileName());
+ existing.setImportFileId(item.getImportFileId());
+ // 重置匹配状态、匹配消息、下载情况
+ existing.setMatchingStatus("未匹配");
+ existing.setMatchingMessage("");
+ existing.setDownloadStatus("未下载");
+ enterprisePubQrcodeMapper.updateEnterprisePubQrcode(existing);
+ updateCount++;
+ }
+ else
+ {
+ // 不存在,新增记录
+ item.setId(UUID.randomUUID().toString().replace("-", ""));
+ Calendar cal = Calendar.getInstance();
+ cal.set(Calendar.MINUTE, 0);
+ cal.set(Calendar.SECOND, 0);
+ cal.set(Calendar.MILLISECOND, 0);
+ item.setCreateTime(cal.getTime());
+ item.setMatchingStatus("未匹配");
+ item.setDownloadStatus("未下载");
+
+ item.setUserName(currentUser.getUserName());
+ item.setUserId(currentUser.getUserId());
+ item.setCreateBy(currentUser.getUserName());
+ item.setDeptName(currentUser.getDeptName());
+ item.setDeptId(currentUser.getDeptId());
+ enterprisePubQrcodeMapper.insertEnterprisePubQrcode(item);
+ insertCount++;
+ }
+ }
+
+ return "成功导入" + dataList.size() + "条数据,其中新增" + insertCount + "条,更新" + updateCount + "条";
+ }
+
+ /**
+ * 批量匹配送码入企信息
+ *
+ * @param ids 选中的记录ID,逗号分隔
+ * @return 匹配结果消息
+ * @throws Exception 异常
+ */
+ @Override
+ public String matchSelectEnterprise(String ids) throws Exception
+ {
+ String[] idArray = Convert.toStrArray(ids);
+ int matchedCount = 0;
+ int failedCount = 0;
+ int insertedCount = 0;
+
+ for (String id : idArray)
+ {
+ EnterprisePubQrcode record = enterprisePubQrcodeMapper.selectEnterprisePubQrcodeById(id);
+ if (record == null)
+ {
+ continue;
+ }
+
+ String enterpriseNumber = record.getEnterpriseNumber();
+ // 同时检索两个数据源
+ EnterpriseInformation existingInfo = enterpriseInformationMapper.selectEnterpriseInformationByNum(enterpriseNumber);
+ EnterpriseInformation sjInfo = ssztJbxx110497Service.selectSsztJbxx110497ByCode(enterpriseNumber);
+
+ if (existingInfo != null)
+ {
+ // 深i企存在该企业,优先使用深i企数据
+ if (record.getEnterpriseName().equals(existingInfo.getEnterpriseName()))
+ {
+ // 企业名称一致
+ record.setMatchingStatus("已匹配");
+ }
+ else
+ {
+ // 企业名称不一致,以深i企为准
+ record.setMatchingStatus("已匹配");
+ record.setMatchingMessage("企业名称与本地的数据源不一致,以本地库的为准,导入名称为" + record.getEnterpriseName() + ",本地库企业名称为:" + existingInfo.getEnterpriseName() + ",本地库的数据源主要来源为深i企");
+ record.setEnterpriseName(existingInfo.getEnterpriseName());
+ }
+ // 生成并存储蓝色二维码
+ try
+ {
+ generateAndStoreBlueQrCode(record, existingInfo);
+ }
+ catch (Exception e)
+ {
+ log.error("生成二维码失败,企业:" + record.getEnterpriseName(), e);
+ }
+
+ record.setMatchingToType("本地数据源");
+ record.setMatchingToId(existingInfo.getId());
+ enterprisePubQrcodeMapper.updateEnterprisePubQrcode(record);
+ matchedCount++;
+ }
+ else if (sjInfo != null)
+ {
+ // 深i企不存在,使用市监数据
+ if (record.getEnterpriseName().equals(sjInfo.getEnterpriseName()))
+ {
+ // 企业名称一致
+ record.setMatchingStatus("已匹配");
+ }
+ else
+ {
+ // 企业名称不一致,以市监为准
+ record.setMatchingStatus("已匹配");
+ record.setMatchingMessage("企业名称于市监的数据源不一致,以市监的为准,导入名称为" + record.getEnterpriseName() + ",市监企业名为:" + sjInfo.getEnterpriseName());
+ record.setEnterpriseName(sjInfo.getEnterpriseName());
+ }
+ // 市监匹配成功且深i企不存在,先写入enterprise_information表
+ sjInfo.setId(IdUtil.simpleUUID());
+ String salt = PasswordTools.encrypt(enterpriseNumber);
+ sjInfo.setSalt(salt);
+ sjInfo.setIsUnsubscribe(0);
+ sjInfo.setIsDelete(0);
+ sjInfo.setCreateTime(DateUtils.getNowDate());
+ sjInfo.setEnterpriseType("送码入企");
+ enterpriseInformationMapper.insertEnterpriseInformation(sjInfo);
+ insertedCount++;
+
+ // 生成并存储蓝色二维码
+ try
+ {
+ generateAndStoreBlueQrCode(record, sjInfo);
+ }
+ catch (Exception e)
+ {
+ log.error("生成二维码失败,企业:" + record.getEnterpriseName(), e);
+ }
+
+ record.setMatchingToType("市监数据源");
+ record.setMatchingToId(sjInfo.getId());
+ enterprisePubQrcodeMapper.updateEnterprisePubQrcode(record);
+ matchedCount++;
+ }
+ else
+ {
+ // 两个数据源都不存在该企业
+ record.setMatchingStatus("匹配失败");
+ record.setMatchingMessage("市监与本地的数据源中不存在该信用代码的企业");
+ enterprisePubQrcodeMapper.updateEnterprisePubQrcode(record);
+ failedCount++;
+ }
+ }
+
+ return "匹配完成,共" + idArray.length + "条记录,已匹配" + matchedCount + "条,匹配失败" + failedCount + "条,新增企业信息" + insertedCount + "条";
+ }
+
+ /**
+ * 强制匹配送码入企信息
+ *
+ * @param id 记录ID
+ * @return 匹配结果消息
+ * @throws Exception 异常
+ */
+ @Override
+ public String forceMatch(String id) throws Exception
+ {
+ EnterprisePubQrcode record = enterprisePubQrcodeMapper.selectEnterprisePubQrcodeById(id);
+ if (record == null)
+ {
+ throw new Exception("记录不存在");
+ }
+
+ // 设置状态为强制匹配
+ record.setMatchingStatus("强制匹配");
+ String enterpriseNumber = record.getEnterpriseNumber();
+ EnterpriseInformation existingInfo = enterpriseInformationMapper.selectEnterpriseInformationByNum(enterpriseNumber);
+ EnterpriseInformation targetInfo;
+ String resultMsg;
+
+ if (existingInfo == null)
+ {
+ // 不存在则插入企业数据
+ EnterpriseInformation newInfo = new EnterpriseInformation();
+ newInfo.setId(IdUtil.simpleUUID());
+ newInfo.setEnterpriseName(record.getEnterpriseName());
+ newInfo.setEnterpriseNumber(enterpriseNumber);
+ String salt = PasswordTools.encrypt(enterpriseNumber);
+ newInfo.setSalt(salt);
+ newInfo.setIsUnsubscribe(0);
+ newInfo.setIsDelete(0);
+ newInfo.setCreateTime(DateUtils.getNowDate());
+ newInfo.setEnterpriseType("送码入企");
+ enterpriseInformationMapper.insertEnterpriseInformation(newInfo);
+ targetInfo = newInfo;
+ resultMsg = "强制匹配成功,已新增企业信息";
+ }
+ else
+ {
+ targetInfo = existingInfo;
+ resultMsg = "强制匹配成功";
+ }
+
+ // 生成并存储蓝色二维码
+ try
+ {
+ generateAndStoreBlueQrCode(record, targetInfo);
+ }
+ catch (Exception e)
+ {
+ log.error("生成二维码失败,企业:" + record.getEnterpriseName(), e);
+ }
+
+ record.setMatchingToType("本地数据源");
+ record.setMatchingToId(targetInfo.getId());
+ enterprisePubQrcodeMapper.updateEnterprisePubQrcode(record);
+ return resultMsg;
+ }
+
+ /**
+ * 解析Excel文件为List
+ *
+ * @param file Excel文件
+ * @return 数据列表
+ * @throws Exception 异常
+ */
+ private List parseExcelToList(MultipartFile file) throws Exception
+ {
+ String fileName = file.getOriginalFilename();
+ if (fileName == null || (!fileName.endsWith(".xls") && !fileName.endsWith(".xlsx")))
+ {
+ throw new Exception("文件格式不正确,仅支持xls和xlsx格式!");
+ }
+
+ InputStream is = file.getInputStream();
+ Workbook workbook;
+ if (fileName.endsWith(".xlsx"))
+ {
+ workbook = new XSSFWorkbook(is);
+ }
+ else
+ {
+ workbook = new HSSFWorkbook(is);
+ }
+
+ Sheet sheet = workbook.getSheetAt(0);
+ if (sheet == null)
+ {
+ workbook.close();
+ throw new Exception("Excel文件中没有工作表!");
+ }
+
+ // 验证表头(第一行)
+ Row headerRow = sheet.getRow(0);
+ if (headerRow == null)
+ {
+ workbook.close();
+ throw new Exception("Excel表头不能为空!");
+ }
+
+ // 解析数据行
+ List dataList = new ArrayList<>();
+ int lastRowNum = sheet.getLastRowNum();
+ for (int i = 1; i <= lastRowNum; i++)
+ {
+ Row row = sheet.getRow(i);
+ if (row == null)
+ {
+ continue;
+ }
+
+ // 判断是否为空行
+ boolean isEmptyRow = true;
+ for (int j = 0; j < 5; j++)
+ {
+ String cellValue = getCellStringValue(row.getCell(j));
+ if (StrUtil.isNotBlank(cellValue))
+ {
+ isEmptyRow = false;
+ break;
+ }
+ }
+ if (isEmptyRow)
+ {
+ continue;
+ }
+
+ EnterprisePubQrcode item = new EnterprisePubQrcode();
+ // 序号(第1列,必须为正整数)
+ String seqNo = getCellStringValue(row.getCell(0));
+ if (StrUtil.isBlank(seqNo) || !seqNo.matches("^[1-9]\\d*$"))
+ {
+ throw new Exception("第" + (i + 1) + "行,序号必须为正整数!");
+ }
+ item.setImportRowNum(Integer.valueOf(seqNo));
+ // 企业名称(第2列)
+ item.setEnterpriseName(getCellStringValue(row.getCell(1)));
+ // 统一社会信用代码(第3列)
+ item.setEnterpriseNumber(getCellStringValue(row.getCell(2)));
+ // 归属区域(第4列)
+ item.setAreaName(getCellStringValue(row.getCell(3)));
+ // 归属街道(第5列)
+ item.setStreetName(getCellStringValue(row.getCell(4)));
+
+ dataList.add(item);
+ }
+
+ workbook.close();
+ // 按序号升序排序
+ dataList.sort((a, b) -> a.getImportRowNum().compareTo(b.getImportRowNum()));
+ return dataList;
+ }
+
+ /**
+ * 获取单元格字符串值
+ *
+ * @param cell 单元格
+ * @return 字符串值
+ */
+ private String getCellStringValue(Cell cell)
+ {
+ if (cell == null)
+ {
+ return "";
+ }
+ cell.setCellType(CellType.STRING);
+ return cell.getStringCellValue().trim();
+ }
+
+ /**
+ * 下载送码入企PDF(生成蓝色二维码并嵌入PDF)
+ * PDF结构:汇总信息页(含成功/失败分表) -> 各企业二维码页(含PDF书签导航)
+ *
+ * @param ids 记录ID,逗号分隔
+ * @param response HTTP响应
+ * @throws Exception 异常
+ */
+ @Override
+ public void downloadPdf(String ids, HttpServletResponse response) throws Exception
+ {
+ byte[] pdfBytes = buildPdfBytes(ids);
+
+ String fileName = "执法监督码_批量下载.pdf";
+ String[] idArray = Convert.toStrArray(ids);
+ if (idArray.length == 1)
+ {
+ EnterprisePubQrcode singleRecord = enterprisePubQrcodeMapper.selectEnterprisePubQrcodeById(idArray[0]);
+ if (singleRecord != null && ("已匹配".equals(singleRecord.getMatchingStatus()) || "强制匹配".equals(singleRecord.getMatchingStatus())))
+ {
+ fileName = singleRecord.getEnterpriseName() + "_执法监督码.pdf";
+ }
+ }
+
+ response.setContentType("application/pdf");
+ response.setHeader("Content-Disposition", "attachment;filename=" + java.net.URLEncoder.encode(fileName, "UTF-8"));
+ response.setContentLength(pdfBytes.length);
+ response.getOutputStream().write(pdfBytes);
+ response.getOutputStream().flush();
+ }
+
+ @Override
+ public String generatePdfFile(String ids) throws Exception
+ {
+ byte[] pdfBytes = buildPdfBytes(ids);
+
+ String datePath = DateUtils.datePath();
+ String pdfDir = RuoYiConfig.getProfile() + "/pdf/" + datePath;
+ java.io.File dir = new java.io.File(pdfDir);
+ if (!dir.exists())
+ {
+ dir.mkdirs();
+ }
+
+ String pdfFileName = IdUtil.simpleUUID() + ".pdf";
+ java.io.File pdfFile = new java.io.File(pdfDir, pdfFileName);
+ try (java.io.FileOutputStream fos = new java.io.FileOutputStream(pdfFile))
+ {
+ fos.write(pdfBytes);
+ fos.flush();
+ }
+
+ return Constants.RESOURCE_PREFIX + "/pdf/" + datePath + "/" + pdfFileName;
+ }
+
+ /**
+ * 生成PDF字节内容(公共逻辑)
+ */
+ private byte[] buildPdfBytes(String ids) throws Exception
+ {
+ String[] idArray = Convert.toStrArray(ids);
+
+ // 1. 一次性批量查询所有选中记录
+ List allRecords = enterprisePubQrcodeMapper.selectEnterprisePubQrcodeByIds(idArray);
+ if (allRecords == null || allRecords.isEmpty())
+ {
+ throw new Exception("未找到对应的记录");
+ }
+
+ // 2. 分类记录:匹配成功和匹配失败
+ List matchedRecords = new ArrayList<>();
+ List unmatchedRecords = new ArrayList<>();
+ for (EnterprisePubQrcode record : allRecords)
+ {
+ if ("已匹配".equals(record.getMatchingStatus()) || "强制匹配".equals(record.getMatchingStatus()))
+ {
+ matchedRecords.add(record);
+ }
+ else
+ {
+ unmatchedRecords.add(record);
+ }
+ }
+
+ // 3. 加载中文字体
+ BaseFont bfChinese = loadChineseBaseFont();
+ com.lowagie.text.Font titleFont = new com.lowagie.text.Font(bfChinese, 18, com.lowagie.text.Font.BOLD);
+ com.lowagie.text.Font subTitleFont = new com.lowagie.text.Font(bfChinese, 14, com.lowagie.text.Font.BOLD);
+ com.lowagie.text.Font normalFont = new com.lowagie.text.Font(bfChinese, 12, com.lowagie.text.Font.NORMAL);
+ com.lowagie.text.Font tableHeaderFont = new com.lowagie.text.Font(bfChinese, 10, com.lowagie.text.Font.BOLD);
+ com.lowagie.text.Font tableCellFont = new com.lowagie.text.Font(bfChinese, 9, com.lowagie.text.Font.NORMAL);
+
+ // 4. 创建PDF文档(带边距,用于汇总页)
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ Document document = new Document(PageSize.A4, 36, 36, 36, 36);
+ PdfWriter writer = PdfWriter.getInstance(document, baos);
+ document.open();
+
+ // === 第一部分:批量生成信息汇总页 ===
+ Paragraph title = new Paragraph("批量生成信息汇总", titleFont);
+ title.setAlignment(Element.ALIGN_CENTER);
+ title.setSpacingAfter(20);
+ document.add(title);
+
+ Paragraph summaryText = new Paragraph(
+ "本次共选择 " + allRecords.size() + " 家企业,成功生成 " + matchedRecords.size() + " 家,失败 " + unmatchedRecords.size() + " 家",
+ normalFont);
+ summaryText.setSpacingAfter(15);
+ document.add(summaryText);
+
+ // 表格列头
+ String[] headers = {"导入序号", "企业名称", "区名称", "街道名称", "信用代码", "匹配状态"};
+
+ // --- 生成成功企业表格 ---
+ Paragraph successTitle = new Paragraph("生成成功企业(" + matchedRecords.size() + " 家)", subTitleFont);
+ successTitle.setSpacingAfter(10);
+ document.add(successTitle);
+
+ PdfPTable successTable = new PdfPTable(6);
+ successTable.setWidthPercentage(100);
+ successTable.setWidths(new float[]{8, 25, 12, 12, 25, 10});
+ addTableHeaders(successTable, headers, tableHeaderFont);
+ for (EnterprisePubQrcode record : matchedRecords)
+ {
+ addRecordRow(successTable, record, tableCellFont);
+ }
+ document.add(successTable);
+
+ // --- 生成失败企业表格 ---
+ if (!unmatchedRecords.isEmpty())
+ {
+ Paragraph failTitle = new Paragraph("生成失败企业(" + unmatchedRecords.size() + " 家)", subTitleFont);
+ failTitle.setSpacingBefore(15);
+ failTitle.setSpacingAfter(10);
+ document.add(failTitle);
+
+ PdfPTable failTable = new PdfPTable(6);
+ failTable.setWidthPercentage(100);
+ failTable.setWidths(new float[]{8, 25, 12, 12, 25, 10});
+ addTableHeaders(failTable, headers, tableHeaderFont);
+ for (EnterprisePubQrcode record : unmatchedRecords)
+ {
+ addRecordRow(failTable, record, tableCellFont);
+ }
+ document.add(failTable);
+ }
+
+ // 获取PDF书签根节点
+ PdfOutline rootOutline = writer.getDirectContent().getRootOutline();
+
+ // 书签:0.首页 -> 指向第一页
+ new PdfOutline(rootOutline, PdfAction.gotoLocalPage(1, new PdfDestination(PdfDestination.FITH), writer), "0.首页");
+
+ // === 第三部分:各企业二维码页(仅当有匹配成功的记录时) ===
+ if (!matchedRecords.isEmpty())
+ {
+ // 读取背景图片模板
+ InputStream bgStream = EnterprisePubQrcodeServiceImpl.class.getClassLoader()
+ .getResourceAsStream(BG_IMAGE_PATH);
+ if (bgStream == null)
+ {
+ throw new Exception("背景图片不存在");
+ }
+ BufferedImage bgTemplate = ImageIO.read(bgStream);
+ bgStream.close();
+
+ // 加载AWT中文字体(用于图片上绘制文字)
+ java.awt.Font chineseAwtFont = loadChineseAwtFont();
+
+ // 预创建可复用的合成画布,避免每次循环重新分配内存
+ BufferedImage compositeImage = new BufferedImage(
+ bgTemplate.getWidth(), bgTemplate.getHeight(), BufferedImage.TYPE_INT_RGB);
+
+ // 预获取JPEG写入器(循环外复用)
+ javax.imageio.ImageWriter jpgWriter = ImageIO.getImageWritersByFormatName("jpg").next();
+ javax.imageio.ImageWriteParam jpgParam = jpgWriter.getDefaultWriteParam();
+ jpgParam.setCompressionMode(javax.imageio.ImageWriteParam.MODE_EXPLICIT);
+ jpgParam.setCompressionQuality(0.95f);
+
+ for (int i = 0; i < matchedRecords.size(); i++)
+ {
+ EnterprisePubQrcode record = matchedRecords.get(i);
+
+ // 切换为无边距并新建页面
+ document.setMargins(0, 0, 0, 0);
+ document.newPage();
+
+ // 添加PDF书签导航
+ String bookmarkTitle = (i + 1) + ". " + record.getEnterpriseName();
+ new PdfOutline(rootOutline, new PdfDestination(PdfDestination.FITH), bookmarkTitle);
+
+ // 优先使用匹配阶段预生成的蓝色二维码
+ BufferedImage qrImage = null;
+ if (StrUtil.isNotBlank(record.getQrCodePath()))
+ {
+ // 将Web路径转换为物理路径:/profile/xxx -> {ruoyi.profile}/xxx
+ String physicalPath = record.getQrCodePath().replaceFirst(Constants.RESOURCE_PREFIX, RuoYiConfig.getProfile());
+ java.io.File qrFile = new java.io.File(physicalPath);
+ if (qrFile.exists())
+ {
+ qrImage = ImageIO.read(qrFile);
+ }
+ }
+
+ if (qrImage == null){
+ throw new Exception("二维码不存在");
+ }
+
+ // 在复用画布上合成(先绘制背景覆盖上一次内容)
+ Graphics2D g2d = compositeImage.createGraphics();
+ g2d.drawImage(bgTemplate, 0, 0, null);
+ g2d.drawImage(qrImage, 266, 645, null);
+ g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+ g2d.setColor(new java.awt.Color(0x333333));
+ g2d.setFont(chineseAwtFont);
+ java.awt.FontMetrics fm = g2d.getFontMetrics();
+ int textWidth = fm.stringWidth(record.getEnterpriseName());
+ int textX = (bgTemplate.getWidth() - textWidth) / 2;
+ g2d.drawString(record.getEnterpriseName(), textX, 1240);
+ g2d.dispose();
+
+ // 使用JPEG 95%质量代替PNG:编码更快,体积更小
+ ByteArrayOutputStream imageBytes = new ByteArrayOutputStream();
+ javax.imageio.stream.ImageOutputStream ios = ImageIO.createImageOutputStream(imageBytes);
+ jpgWriter.setOutput(ios);
+ jpgWriter.write(null, new javax.imageio.IIOImage(compositeImage, null, null), jpgParam);
+ ios.close();
+
+ // 添加合成图片到PDF,缩放适配A4页面
+ Image pdfImage = Image.getInstance(imageBytes.toByteArray());
+ pdfImage.scaleToFit(PageSize.A4.getWidth(), PageSize.A4.getHeight());
+ pdfImage.setAlignment(Image.ALIGN_CENTER);
+ document.add(pdfImage);
+ }
+
+ jpgWriter.dispose();
+ }
+
+ document.close();
+ writer.close();
+
+ return baos.toByteArray();
+ }
+
+ /**
+ * 批量设置下载状态和备注
+ *
+ * @param ids 记录ID,逗号分隔
+ * @param downloadStatus 下载状态
+ * @param remark 备注
+ * @return 更新结果
+ */
+ @Override
+ public int batchUpdateDownloadStatus(String ids, String downloadStatus, String remark)
+ {
+ String[] idArray = Convert.toStrArray(ids);
+ return enterprisePubQrcodeMapper.batchUpdateDownloadStatus(idArray, downloadStatus, remark);
+ }
+
+ /**
+ * 生成并存储蓝色二维码(带LOGO),同时写入qr_code_generate_history表
+ *
+ * @param record 送码入企记录(生成后会设置qrCodePath和lastQrCodeTime)
+ * @param enterpriseInfo 企业信息(包含salt和id)
+ */
+ private void generateAndStoreBlueQrCode(EnterprisePubQrcode record, EnterpriseInformation enterpriseInfo) throws Exception
+ {
+ String enterpriseNumber = record.getEnterpriseNumber();
+
+ // 检查qr_code_generate_history表中是否已存在该企业由送码入企生成的有效二维码记录
+ QrCodeGenerateHistory existingHistory = iQrCodeGenerateHistoryService.selectQrCodeGenerateHistoryByNewest(enterpriseNumber);
+ if (existingHistory != null && existingHistory.getStatus() != null && existingHistory.getStatus() == 0
+ && "送码入企".equals(existingHistory.getReasonsChange()))
+ {
+ // 已有送码入企生成的有效记录,复用已有二维码路径
+ record.setQrCodePath(existingHistory.getQrCodeUrl());
+ record.setLastQrCodeTime(existingHistory.getGenerateTime());
+ return;
+ }
+
+ String salt = enterpriseInfo.getSalt();
+ String enterpriseId = enterpriseInfo.getId();
+
+ String codeId = IdUtil.simpleUUID();
+ Map jsonMap = new HashMap<>();
+ jsonMap.put("salt", salt);
+ jsonMap.put("codeId", codeId);
+ jsonMap.put("type", "zfjd");
+ jsonMap.put("enterpriseId", enterpriseId);
+ jsonMap.put("enterpriseNumber", enterpriseNumber);
+ jsonMap.put("vaCode", symmetricRQValidateCodeEncrypt(enterpriseNumber));
+ jsonMap.put("formModule","EntPubQrcodeService");
+ jsonMap.put("createDate", DateUtils.getTime());
+ jsonMap.put("eprqId",record.getId());
+ String qrContent = JSON.toJSONString(jsonMap);
+
+ BufferedImage qrImage = QRCodeUtil.createBlueQrCodeWithLogo(qrContent, 460);
+
+ // 将BufferedImage写入临时文件,再通过fileUploadApi上传
+ java.io.File tempFile = java.io.File.createTempFile("qrcode_" + codeId, ".png");
+ tempFile.deleteOnExit();
+ ImageIO.write(qrImage, "PNG", tempFile);
+ MultipartFile multipartFile = QRCodeUtil.getMultipartFile(tempFile);
+ String upload = fileUploadApi.upload(multipartFile);
+ tempFile.delete();
+
+ QrCodeGenerateHistory history = new QrCodeGenerateHistory();
+ history.setId(codeId);
+ history.setGenerateTime(DateUtils.getNowDate());
+ history.setQrCodeUrl(upload);
+ history.setEnterpriseNumber(enterpriseNumber);
+ history.setEnterpriseName(record.getEnterpriseName());
+ history.setReasonsChange("送码入企");
+ iQrCodeGenerateHistoryService.insertQrCodeGenerateHistory(history);
+
+ record.setQrCodePath(upload);
+ record.setLastQrCodeTime(DateUtils.getNowDate());
+ }
+
+ /**
+ * 加载中文BaseFont(用于PDF文本元素)
+ */
+ private BaseFont loadChineseBaseFont() throws Exception
+ {
+ if (!StringUtils.isWindows())
+ {
+ return BaseFont.createFont("/home/zdxt/font/simsun.ttc,0", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
+ }
+ else
+ {
+ InputStream fontStream = EnterprisePubQrcodeServiceImpl.class.getClassLoader()
+ .getResourceAsStream("font/simsun.ttc");
+ if (fontStream != null)
+ {
+ java.io.File tempFile = java.io.File.createTempFile("simsun", ".ttc");
+ tempFile.deleteOnExit();
+ java.nio.file.Files.copy(fontStream, tempFile.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING);
+ fontStream.close();
+ return BaseFont.createFont(tempFile.getAbsolutePath() + ",0", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
+ }
+ else
+ {
+ return BaseFont.createFont("C:/Windows/Fonts/simsun.ttc,0", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
+ }
+ }
+ }
+
+ /**
+ * 加载中文AWT字体(用于图片上绘制文字)
+ */
+ private java.awt.Font loadChineseAwtFont() throws Exception
+ {
+ if (!StringUtils.isWindows())
+ {
+ return java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT,
+ new java.io.File("/home/zdxt/font/simsun.ttc"))
+ .deriveFont(java.awt.Font.BOLD, 28f);
+ }
+ else
+ {
+ InputStream fontStream = EnterprisePubQrcodeServiceImpl.class.getClassLoader()
+ .getResourceAsStream("font/simsun.ttc");
+ if (fontStream != null)
+ {
+ java.awt.Font font = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT, fontStream)
+ .deriveFont(java.awt.Font.BOLD, 28f);
+ fontStream.close();
+ return font;
+ }
+ else
+ {
+ return new java.awt.Font("SimSun", java.awt.Font.BOLD, 28);
+ }
+ }
+ }
+
+ /**
+ * 向PDF表格添加列头
+ */
+ private void addTableHeaders(PdfPTable table, String[] headers, com.lowagie.text.Font font)
+ {
+ for (String header : headers)
+ {
+ PdfPCell cell = new PdfPCell(new Phrase(header, font));
+ cell.setHorizontalAlignment(Element.ALIGN_CENTER);
+ cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
+ cell.setBackgroundColor(new java.awt.Color(0xDD, 0xDD, 0xDD));
+ cell.setPadding(5);
+ table.addCell(cell);
+ }
+ }
+
+ /**
+ * 向PDF表格添加一行企业记录
+ */
+ private void addRecordRow(PdfPTable table, EnterprisePubQrcode record, com.lowagie.text.Font font)
+ {
+ addTableCell(table, record.getImportRowNum() != null ? String.valueOf(record.getImportRowNum()) : "", font, Element.ALIGN_CENTER);
+ addTableCell(table, record.getEnterpriseName() != null ? record.getEnterpriseName() : "", font, Element.ALIGN_LEFT);
+ addTableCell(table, record.getAreaName() != null ? record.getAreaName() : "", font, Element.ALIGN_CENTER);
+ addTableCell(table, record.getStreetName() != null ? record.getStreetName() : "", font, Element.ALIGN_CENTER);
+ addTableCell(table, record.getEnterpriseNumber() != null ? record.getEnterpriseNumber() : "", font, Element.ALIGN_LEFT);
+ addTableCell(table, record.getMatchingStatus() != null ? record.getMatchingStatus() : "", font, Element.ALIGN_CENTER);
+ }
+
+ /**
+ * 向PDF表格添加单元格
+ */
+ private void addTableCell(PdfPTable table, String text, com.lowagie.text.Font font, int alignment)
+ {
+ PdfPCell cell = new PdfPCell(new Phrase(text, font));
+ cell.setHorizontalAlignment(alignment);
+ cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
+ cell.setPadding(4);
+ table.addCell(cell);
+ }
+}
diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/utils/QRCodeUtil.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/utils/QRCodeUtil.java
index fbced049..346bf01a 100644
--- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/utils/QRCodeUtil.java
+++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/utils/QRCodeUtil.java
@@ -386,6 +386,89 @@ public class QRCodeUtil {
return image;
}
+ // 蓝色二维码前景色
+ private static final int BLUE_FOREGROUND_COLOR = 0xFF003399;
+
+ // classpath中的LOGO图片路径
+ private static final String EMBEDDED_LOGO_PATH = "images/enterprise_pub_qrcode_logo.jpg";
+
+ /**
+ * 生成蓝色二维码并在中间插入自定义图片,返回BufferedImage
+ *
+ * @param content 二维码内容
+ * @param imgPath 中间图片地址(为空则不插入图片)
+ * @param needCompress 是否压缩中间图片
+ * @return BufferedImage
+ * @throws Exception
+ */
+ public static BufferedImage createBlueQrCode(String content, String imgPath,
+ boolean needCompress) throws Exception {
+ Hashtable hints = new Hashtable();
+ hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
+ hints.put(EncodeHintType.CHARACTER_SET, CHARSET);
+ hints.put(EncodeHintType.MARGIN, 1);
+ BitMatrix bitMatrix = new MultiFormatWriter().encode(content,
+ BarcodeFormat.QR_CODE, QRCODE_SIZE, QRCODE_SIZE, hints);
+ int width = bitMatrix.getWidth();
+ int height = bitMatrix.getHeight();
+ BufferedImage image = new BufferedImage(width, height,
+ BufferedImage.TYPE_INT_RGB);
+ for (int x = 0; x < width; x++) {
+ for (int y = 0; y < height; y++) {
+ image.setRGB(x, y, bitMatrix.get(x, y) ? BLUE_FOREGROUND_COLOR
+ : 0xFFFFFFFF);
+ }
+ }
+ if (imgPath != null && !"".equals(imgPath)) {
+ insertImage(image, imgPath, needCompress);
+ }
+ return image;
+ }
+
+ /**
+ * 生成蓝色二维码并在中间插入classpath中的LOGO图片,返回BufferedImage
+ *
+ * @param content 二维码内容
+ * @return BufferedImage
+ * @throws Exception
+ */
+ public static BufferedImage createBlueQrCodeWithLogo(String content,int size) throws Exception {
+ Hashtable hints = new Hashtable();
+ hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
+ hints.put(EncodeHintType.CHARACTER_SET, CHARSET);
+ hints.put(EncodeHintType.MARGIN, 1);
+ BitMatrix bitMatrix = new MultiFormatWriter().encode(content,
+ BarcodeFormat.QR_CODE, size, size, hints);
+ int width = bitMatrix.getWidth();
+ int height = bitMatrix.getHeight();
+ BufferedImage image = new BufferedImage(width, height,
+ BufferedImage.TYPE_INT_RGB);
+ for (int x = 0; x < width; x++) {
+ for (int y = 0; y < height; y++) {
+ image.setRGB(x, y, bitMatrix.get(x, y) ? BLUE_FOREGROUND_COLOR
+ : 0xFFFFFFFF);
+ }
+ }
+ // 从classpath读取LOGO图片并插入二维码中间
+ InputStream logoStream = QRCodeUtil.class.getClassLoader().getResourceAsStream(EMBEDDED_LOGO_PATH);
+ if (logoStream != null) {
+ Image logo = ImageIO.read(logoStream);
+ logoStream.close();
+ int logoWidth = Math.min(logo.getWidth(null), 100);
+ int logoHeight = Math.min(logo.getHeight(null), 100);
+ Image scaledLogo = logo.getScaledInstance(logoWidth, logoHeight, Image.SCALE_SMOOTH);
+ Graphics2D graph = image.createGraphics();
+ int x = (size - logoWidth) / 2;
+ int y = (size - logoHeight) / 2;
+ graph.drawImage(scaledLogo, x, y, logoWidth, logoHeight, null);
+ Shape shape = new RoundRectangle2D.Float(x, y, logoWidth, logoHeight, 6, 6);
+ graph.setStroke(new BasicStroke(3f));
+ graph.draw(shape);
+ graph.dispose();
+ }
+ return image;
+ }
+
public static MultipartFile getMultipartFile(File file) {
FileItem item = new DiskFileItemFactory().createItem("file"
, MediaType.MULTIPART_FORM_DATA_VALUE
diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterprisePubQrcodeMapper.xml b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterprisePubQrcodeMapper.xml
new file mode 100644
index 00000000..7b59b3d1
--- /dev/null
+++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterprisePubQrcodeMapper.xml
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select id, enterprise_name, enterprise_number, area_name, area_id, street_name, street_id,
+ matching_status, matching_message, download_status, dept_name, dept_id, user_name, user_id,
+ create_time, create_by, qr_code_path, last_qr_code_time,
+ import_row_num, import_file_name, import_file_id, remark,
+ matching_to_type, matching_to_id
+ from enterprise_pub_qrcode
+
+
+
+
+
+
+
+
+
+
+
+ insert into enterprise_pub_qrcode
+
+ id,
+ enterprise_name,
+ enterprise_number,
+ area_name,
+ area_id,
+ street_name,
+ street_id,
+ matching_status,
+ matching_message,
+ download_status,
+ dept_name,
+ dept_id,
+ user_name,
+ user_id,
+ create_time,
+ create_by,
+ qr_code_path,
+ last_qr_code_time,
+ import_row_num,
+ import_file_name,
+ import_file_id,
+ remark,
+ matching_to_type,
+ matching_to_id,
+
+
+ #{id},
+ #{enterpriseName},
+ #{enterpriseNumber},
+ #{areaName},
+ #{areaId},
+ #{streetName},
+ #{streetId},
+ #{matchingStatus},
+ #{matchingMessage},
+ #{downloadStatus},
+ #{deptName},
+ #{deptId},
+ #{userName},
+ #{userId},
+ #{createTime},
+ #{createBy},
+ #{qrCodePath},
+ #{lastQrCodeTime},
+ #{importRowNum},
+ #{importFileName},
+ #{importFileId},
+ #{remark},
+ #{matchingToType},
+ #{matchingToId},
+
+
+
+
+ update enterprise_pub_qrcode
+
+ enterprise_name = #{enterpriseName},
+ enterprise_number = #{enterpriseNumber},
+ area_name = #{areaName},
+ area_id = #{areaId},
+ street_name = #{streetName},
+ street_id = #{streetId},
+ matching_status = #{matchingStatus},
+ matching_message = #{matchingMessage},
+ download_status = #{downloadStatus},
+ dept_name = #{deptName},
+ dept_id = #{deptId},
+ user_name = #{userName},
+ user_id = #{userId},
+ create_time = #{createTime},
+ create_by = #{createBy},
+ qr_code_path = #{qrCodePath},
+ last_qr_code_time = #{lastQrCodeTime},
+ import_row_num = #{importRowNum},
+ import_file_name = #{importFileName},
+ import_file_id = #{importFileId},
+ remark = #{remark},
+ matching_to_type = #{matchingToType},
+ matching_to_id = #{matchingToId},
+
+ where id = #{id}
+
+
+
+ delete from enterprise_pub_qrcode where id = #{id}
+
+
+
+ delete from enterprise_pub_qrcode where id in
+
+ #{id}
+
+
+
+
+ update enterprise_pub_qrcode
+ set download_status = #{downloadStatus},
+ remark = #{remark}
+ where id in
+
+ #{id}
+
+
+