Browse Source

送码入企功能

master
庄锐波 5 months ago
parent
commit
2a3c80a8bd
  1. 415
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/enterprise_pub_qrcode/enterprisePubQrcodeList.html
  2. 317
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnterprisePubQrcodeController.java
  3. 310
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/EnterprisePubQrcode.java
  4. 90
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/EnterprisePubQrcodeMapper.java
  5. 1043
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterprisePubQrcodeServiceImpl.java
  6. 83
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/utils/QRCodeUtil.java
  7. 189
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterprisePubQrcodeMapper.xml

415
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/enterprise_pub_qrcode/enterprisePubQrcodeList.html

@ -0,0 +1,415 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="zdxtInclude :: header('送码入企信息列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<p>企业名称:</p>
<input type="text" name="enterpriseName"/>
</li>
<li>
<p>统一社会信用代码:</p>
<input type="text" name="enterpriseNumber"/>
</li>
<li>
<p>所属区域名称:</p>
<input type="text" name="areaName"/>
</li>
<li>
<p>所属街道名称:</p>
<input type="text" name="streetName"/>
</li>
<li>
<p>匹配状态:</p>
<select name="matchingStatus">
<option value="">全部</option>
<option value="未匹配">未匹配</option>
<option value="已匹配">已匹配</option>
<option value="强制匹配">强制匹配</option>
<option value="匹配失败">匹配失败</option>
</select>
</li>
<li>
<p>下载情况:</p>
<select name="downloadStatus">
<option value="">全部</option>
<option value="未下载">未下载</option>
<option value="已下载">已下载</option>
</select>
</li>
<li>
<p>导入文件名:</p>
<input type="text" name="importFileName"/>
</li>
<li>
<p>备注:</p>
<input type="text" name="remark"/>
</li>
<li>
<a class="btn btn-success btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-reset btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="code:pubQrcode:add">
<i class="fa fa-plus"></i> 新增
</a>-->
<a class="btn btn-info" onclick="importData()" shiro:hasPermission="code:pubQrcode:add">
<i class="fa fa-upload"></i> 批量导入
</a>
<a class="btn btn-warning" onclick="matchData()" shiro:hasPermission="code:pubQrcode:edit">
<i class="fa fa-link"></i> 匹配
</a>
<a class="btn btn-primary" onclick="downloadData()" shiro:hasPermission="code:pubQrcode:edit">
<i class="fa fa-download"></i> 下载
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="code:pubQrcode:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-success" onclick="setDownloadStatus()" shiro:hasPermission="code:pubQrcode:edit">
<i class="fa fa-tag"></i> 设置下载状态
</a>
</div>
<div class="col-sm-12 select-table table-bordered">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="zdxtInclude :: footer" />
<script id="importTpl" type="text/template">
<form enctype="multipart/form-data" class="mt20 mb10">
<div class="col-xs-offset-1">
<input type="file" id="file" name="file"/>
<div class="mt10 pt5">
</div>
<font color="red" class="pull-left mt10">提示:仅允许导入“xls”或“xlsx”格式文件!</font>
</div>
</form>
</script>
<script th:inline="javascript">
var removeFlag = [[${@permission.hasPermi('code:pubQrcode:remove')}]];
var editFlag = [[${@permission.hasPermi('code:pubQrcode:edit')}]];
var prefix = ctx + "code/enterprisePubQrcode";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
modalName: "送码入企信息",
showHeader: false,
showFooter: false,
showColumns: false,
showRefresh: false,
showToggle: false,
pageSize: 100,
columns: [{
checkbox: true
},
{
field : 'id',
title : '主键ID',
visible: false
},
{
field : 'importRowNum',
title : '导入序号'
},
{
field : 'enterpriseName',
title : '企业名称'
},
{
field : 'enterpriseNumber',
title : '统一社会信用代码'
},
{
field : 'areaName',
title : '所属区域名称'
},
{
field : 'streetName',
title : '所属街道名称'
},
{
field : 'matchingStatus',
title : '匹配状态',
formatter: function(value, row, index) {
if (value == '匹配失败') {
return '<span style="color:red;text-decoration:underline;cursor:pointer;" title="' + (row.matchingMessage || '') + '">' + value + '</span>';
}
if ((value == '已匹配' || value == '强制匹配') && row.matchingMessage) {
return '<span style="color:blue;text-decoration:underline;cursor:pointer;" title="' + row.matchingMessage + '">' + value + '</span>';
}
return value;
}
},
{
field : 'downloadStatus',
title : '下载情况'
},
{
field : 'remark',
title : '备注'
},
{
field : 'importFileName',
title : '导入文件名'
},
{
field : 'importFileId',
title : '导入文件ID',
visible: false
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
//actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="downloadRow(\'' + row.id + '\')"><i class="fa fa-download"></i> 下载</a> ');
if (row.matchingStatus == '匹配失败') {
actions.push('<a class="btn btn-danger btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="forceMatch(\'' + row.id + '\')"><i class="fa fa-bolt"></i> 强制匹配</a> ');
}
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i> 删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
/** 导入数据 */
function importData() {
layer.open({
type: 1,
area: ['400px', '230px'],
fix: false,
maxmin: true,
shade: 0.3,
title: '导入送码入企数据',
content: $('#importTpl').html(),
btn: ['<i class="fa fa-download"></i> 导入', '<i class="fa fa-close"></i> 取消'],
shadeClose: true,
btn1: function(index, layero) {
var file = layero.find('#file').val();
if (file == '' || (!$.common.endWith(file, '.xls') && !$.common.endWith(file, '.xlsx'))) {
$.modal.msgWarning("请选择后缀为 \u201cxls\u201d或\u201cxlsx\u201d的文件。");
return false;
}
var loadIndex = layer.load(2, {shade: false});
var formData = new FormData(layero.find('form')[0]);
$.ajax({
url: prefix + "/importData",
data: formData,
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function(result) {
layer.close(loadIndex);
if (result.success) {
$.modal.closeAll();
$.modal.alertSuccess(result.message);
$.table.refresh();
} else {
$.modal.alertError(result.message);
}
},
error: function() {
layer.close(loadIndex);
$.modal.alertError("导入失败,请联系管理员!");
}
});
}
});
}
/** 下载导入模板 */
$.table.importTemplate = function() {
window.location.href = prefix + "/importTemplate";
}
/** 匹配数据 */
function matchData() {
var rows = $.table.selectColumns("id");
if (rows.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
$.modal.confirm("确认要对选中的" + rows.length + "条记录执行匹配操作吗?", function() {
var loadIndex = layer.load(2, {shade: false});
$.ajax({
url: prefix + "/matchSelectEnterprise",
type: "post",
data: { "ids": rows.join(",") },
dataType: "json",
success: function(result) {
layer.close(loadIndex);
if (result.success) {
$.modal.alertSuccess(result.message);
$.table.refresh();
} else {
$.modal.alertError(result.message);
}
},
error: function() {
layer.close(loadIndex);
$.modal.alertError("匹配失败,请联系管理员!");
}
});
});
}
/** 批量下载 */
function downloadData() {
var rows = $.table.selectColumns("id");
if (rows.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
var loadIndex = layer.msg('PDF生成中,请稍候...', {icon: 16, shade: [0.3, '#000'], time: 0});
$.ajax({
url: prefix + "/generatePdf",
type: "post",
data: { "ids": rows.join(",") },
dataType: "json",
success: function(result) {
layer.close(loadIndex);
if (result.success) {
layer.open({
type: 1,
title: '生成完成',
area: ['380px', '200px'],
shade: 0.3,
shadeClose: true,
content: '<div style="padding:30px;text-align:center;">' +
'<p style="margin-bottom:20px;font-size:14px;"><i class="fa fa-check-circle" style="color:#5cb85c;margin-right:6px;"></i>PDF文件已生成完成</p>' +
'<a href="' + result.data + '" class="btn btn-primary" target="_blank">' +
'<i class="fa fa-download"></i> 点击下载</a></div>',
btn: ['关闭'],
btn1: function(index) {
layer.close(index);
$.table.refresh();
},
cancel: function() {
$.table.refresh();
}
});
} else {
$.modal.alertError(result.message);
}
},
error: function() {
layer.close(loadIndex);
$.modal.alertError("生成失败,请联系管理员!");
}
});
}
/** 单条记录下载 */
function downloadRow(id) {
window.location.href = prefix + "/download?ids=" + id;
}
/** 强制匹配 */
function forceMatch(id) {
$.modal.confirm("确认要对该记录执行强制匹配吗?", function() {
var loadIndex = layer.load(2, {shade: false});
$.ajax({
url: prefix + "/forceMatch",
type: "post",
data: { "id": id },
dataType: "json",
success: function(result) {
layer.close(loadIndex);
if (result.success) {
$.modal.alertSuccess(result.message);
$.table.refresh();
} else {
$.modal.alertError(result.message);
}
},
error: function() {
layer.close(loadIndex);
$.modal.alertError("强制匹配失败,请联系管理员!");
}
});
});
}
/** 设置下载状态 */
function setDownloadStatus() {
var rows = $.table.selectColumns("id");
if (rows.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
var content = '<form class="form-horizontal mt20 mb10" style="overflow-x:hidden;">' +
'<div class="form-group">' +
' <label class="col-sm-3 control-label">下载:</label>' +
' <div class="col-sm-8">' +
' <select id="dlStatus" class="form-control">' +
' <option value="已下载">已下载</option>' +
' <option value="未下载">未下载</option>' +
' </select>' +
' </div>' +
'</div>' +
'<div class="form-group">' +
' <label class="col-sm-3 control-label">备注:</label>' +
' <div class="col-sm-8">' +
' <textarea id="dlRemark" class="form-control" rows="3" placeholder="请输入备注"></textarea>' +
' </div>' +
'</div>' +
'</form>';
layer.open({
type: 1,
area: ['480px', '340px'],
fix: false,
shade: 0.3,
title: '设置下载状态(已选' + rows.length + '条)',
content: content,
btn: ['<i class="fa fa-check"></i> 确认', '<i class="fa fa-close"></i> 取消'],
shadeClose: true,
btn1: function(index, layero) {
var downloadStatus = layero.find('#dlStatus').val();
var remark = layero.find('#dlRemark').val();
var loadIndex = layer.load(2, {shade: false});
$.ajax({
url: prefix + "/batchUpdateDownloadStatus",
type: "post",
data: { "ids": rows.join(","), "downloadStatus": downloadStatus, "remark": remark },
dataType: "json",
success: function(result) {
layer.close(loadIndex);
if (result.success) {
layer.close(index);
$.modal.alertSuccess(result.message);
$.table.refresh();
} else {
$.modal.alertError(result.message);
}
},
error: function() {
layer.close(loadIndex);
$.modal.alertError("设置失败,请联系管理员!");
}
});
}
});
}
</script>
</body>
</html>

317
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<EnterprisePubQrcode> list = enterprisePubQrcodeService.selectEnterprisePubQrcodeList(enterprisePubQrcode);
return getDataTable(list);
}
/**
* 查询送码入企信息列表
*/
@GetMapping("/queryList")
@ResponseBody
public ZDResponse queryList(EnterprisePubQrcode enterprisePubQrcode)
{
startPage();
List<EnterprisePubQrcode> 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(
("<script>alert('下载失败:" + e.getMessage() + "');history.back();</script>").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());
}
}
}

310
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();
}
}

90
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<EnterprisePubQrcode> 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<EnterprisePubQrcode> 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);
}

1043
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterprisePubQrcodeServiceImpl.java

File diff suppressed because it is too large

83
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<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
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<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
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

189
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterprisePubQrcodeMapper.xml

@ -0,0 +1,189 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zdxt.code.mapper.EnterprisePubQrcodeMapper">
<resultMap type="EnterprisePubQrcode" id="EnterprisePubQrcodeResult">
<result property="id" column="id" />
<result property="enterpriseName" column="enterprise_name" />
<result property="enterpriseNumber" column="enterprise_number" />
<result property="areaName" column="area_name" />
<result property="areaId" column="area_id" />
<result property="streetName" column="street_name" />
<result property="streetId" column="street_id" />
<result property="matchingStatus" column="matching_status" />
<result property="matchingMessage" column="matching_message" />
<result property="downloadStatus" column="download_status" />
<result property="deptName" column="dept_name" />
<result property="deptId" column="dept_id" />
<result property="userName" column="user_name" />
<result property="userId" column="user_id" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="qrCodePath" column="qr_code_path" />
<result property="lastQrCodeTime" column="last_qr_code_time" />
<result property="importRowNum" column="import_row_num" />
<result property="importFileName" column="import_file_name" />
<result property="importFileId" column="import_file_id" />
<result property="remark" column="remark" />
<result property="matchingToType" column="matching_to_type" />
<result property="matchingToId" column="matching_to_id" />
</resultMap>
<sql id="selectEnterprisePubQrcodeVo">
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
</sql>
<select id="selectEnterprisePubQrcodeList" parameterType="EnterprisePubQrcode" resultMap="EnterprisePubQrcodeResult">
<include refid="selectEnterprisePubQrcodeVo"/>
<where>
<if test="enterpriseName != null and enterpriseName != ''"> and enterprise_name like concat('%', #{enterpriseName}, '%')</if>
<if test="enterpriseNumber != null and enterpriseNumber != ''"> and enterprise_number like concat('%', #{enterpriseNumber}, '%')</if>
<if test="areaName != null and areaName != ''"> and area_name = #{areaName}</if>
<if test="areaId != null and areaId != ''"> and area_id = #{areaId}</if>
<if test="streetName != null and streetName != ''"> and street_name = #{streetName}</if>
<if test="streetId != null and streetId != ''"> and street_id = #{streetId}</if>
<if test="matchingStatus != null and matchingStatus != ''"> and matching_status = #{matchingStatus}</if>
<if test="downloadStatus != null and downloadStatus != ''"> and download_status = #{downloadStatus}</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="importFileName != null and importFileName != ''"> and import_file_name like concat('%', #{importFileName}, '%')</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
</where>
order by create_time desc, import_row_num asc
</select>
<select id="selectEnterprisePubQrcodeById" parameterType="String" resultMap="EnterprisePubQrcodeResult">
<include refid="selectEnterprisePubQrcodeVo"/>
where id = #{id}
</select>
<select id="selectEnterprisePubQrcodeByEnterpriseNumber" parameterType="String" resultMap="EnterprisePubQrcodeResult">
<include refid="selectEnterprisePubQrcodeVo"/>
where enterprise_number = #{enterpriseNumber}
limit 1
</select>
<select id="selectEnterprisePubQrcodeByIds" resultMap="EnterprisePubQrcodeResult">
<include refid="selectEnterprisePubQrcodeVo"/>
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
order by import_row_num asc
</select>
<insert id="insertEnterprisePubQrcode" parameterType="EnterprisePubQrcode">
insert into enterprise_pub_qrcode
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">id,</if>
<if test="enterpriseName != null and enterpriseName != ''">enterprise_name,</if>
<if test="enterpriseNumber != null and enterpriseNumber != ''">enterprise_number,</if>
<if test="areaName != null and areaName != ''">area_name,</if>
<if test="areaId != null and areaId != ''">area_id,</if>
<if test="streetName != null and streetName != ''">street_name,</if>
<if test="streetId != null and streetId != ''">street_id,</if>
<if test="matchingStatus != null and matchingStatus != ''">matching_status,</if>
<if test="matchingMessage != null and matchingMessage != ''">matching_message,</if>
<if test="downloadStatus != null and downloadStatus != ''">download_status,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="deptId != null and deptId != ''">dept_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="userId != null">user_id,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="qrCodePath != null and qrCodePath != ''">qr_code_path,</if>
<if test="lastQrCodeTime != null">last_qr_code_time,</if>
<if test="importRowNum != null">import_row_num,</if>
<if test="importFileName != null and importFileName != ''">import_file_name,</if>
<if test="importFileId != null and importFileId != ''">import_file_id,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="matchingToType != null and matchingToType != ''">matching_to_type,</if>
<if test="matchingToId != null and matchingToId != ''">matching_to_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">#{id},</if>
<if test="enterpriseName != null and enterpriseName != ''">#{enterpriseName},</if>
<if test="enterpriseNumber != null and enterpriseNumber != ''">#{enterpriseNumber},</if>
<if test="areaName != null and areaName != ''">#{areaName},</if>
<if test="areaId != null and areaId != ''">#{areaId},</if>
<if test="streetName != null and streetName != ''">#{streetName},</if>
<if test="streetId != null and streetId != ''">#{streetId},</if>
<if test="matchingStatus != null and matchingStatus != ''">#{matchingStatus},</if>
<if test="matchingMessage != null and matchingMessage != ''">#{matchingMessage},</if>
<if test="downloadStatus != null and downloadStatus != ''">#{downloadStatus},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="userId != null">#{userId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="qrCodePath != null and qrCodePath != ''">#{qrCodePath},</if>
<if test="lastQrCodeTime != null">#{lastQrCodeTime},</if>
<if test="importRowNum != null">#{importRowNum},</if>
<if test="importFileName != null and importFileName != ''">#{importFileName},</if>
<if test="importFileId != null and importFileId != ''">#{importFileId},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="matchingToType != null and matchingToType != ''">#{matchingToType},</if>
<if test="matchingToId != null and matchingToId != ''">#{matchingToId},</if>
</trim>
</insert>
<update id="updateEnterprisePubQrcode" parameterType="EnterprisePubQrcode">
update enterprise_pub_qrcode
<trim prefix="SET" suffixOverrides=",">
<if test="enterpriseName != null and enterpriseName != ''">enterprise_name = #{enterpriseName},</if>
<if test="enterpriseNumber != null and enterpriseNumber != ''">enterprise_number = #{enterpriseNumber},</if>
<if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
<if test="areaId != null and areaId != ''">area_id = #{areaId},</if>
<if test="streetName != null and streetName != ''">street_name = #{streetName},</if>
<if test="streetId != null and streetId != ''">street_id = #{streetId},</if>
<if test="matchingStatus != null and matchingStatus != ''">matching_status = #{matchingStatus},</if>
<if test="matchingMessage != null and matchingMessage != ''">matching_message = #{matchingMessage},</if>
<if test="downloadStatus != null and downloadStatus != ''">download_status = #{downloadStatus},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="deptId != null and deptId != ''">dept_id = #{deptId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="qrCodePath != null and qrCodePath != ''">qr_code_path = #{qrCodePath},</if>
<if test="lastQrCodeTime != null">last_qr_code_time = #{lastQrCodeTime},</if>
<if test="importRowNum != null">import_row_num = #{importRowNum},</if>
<if test="importFileName != null and importFileName != ''">import_file_name = #{importFileName},</if>
<if test="importFileId != null and importFileId != ''">import_file_id = #{importFileId},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="matchingToType != null and matchingToType != ''">matching_to_type = #{matchingToType},</if>
<if test="matchingToId != null and matchingToId != ''">matching_to_id = #{matchingToId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEnterprisePubQrcodeById" parameterType="String">
delete from enterprise_pub_qrcode where id = #{id}
</delete>
<delete id="deleteEnterprisePubQrcodeByIds" parameterType="String">
delete from enterprise_pub_qrcode where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="batchUpdateDownloadStatus">
update enterprise_pub_qrcode
set download_status = #{downloadStatus},
remark = #{remark}
where id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>
Loading…
Cancel
Save