From 19f40c8e0649ae81b3f0183a6f4c8aa6c3db39bc Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 18 Nov 2021 17:54:37 +0800
Subject: [PATCH] 证书打印信息导出修改,已过考试的,系统每天凌晨1点定时清理,标记为缺考,并生成缺考记录,保安员导入新增年龄判断,超过60岁的不能导入

---
 src/main/java/org/springblade/modules/accreditation/service/impl/AccreditationRecordsServiceImpl.java |   76 ++++++++++++++++++++++++++++++++------
 1 files changed, 64 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/springblade/modules/accreditation/service/impl/AccreditationRecordsServiceImpl.java b/src/main/java/org/springblade/modules/accreditation/service/impl/AccreditationRecordsServiceImpl.java
index 783f4d0..97f5bcb 100644
--- a/src/main/java/org/springblade/modules/accreditation/service/impl/AccreditationRecordsServiceImpl.java
+++ b/src/main/java/org/springblade/modules/accreditation/service/impl/AccreditationRecordsServiceImpl.java
@@ -6,6 +6,7 @@
 import lombok.AllArgsConstructor;
 import org.springblade.common.utils.QRCodeUtil;
 import org.springblade.modules.FTP.FtpUtil;
+import org.springblade.modules.accreditation.excel.ExportSecurityBookPaperExcel;
 import org.springblade.modules.accreditation.excel.ExportSecurityPaperExcel;
 import org.springblade.modules.accreditation.entity.AccreditationRecords;
 import org.springblade.modules.accreditation.mapper.AccreditationRecordsMapper;
@@ -60,19 +61,47 @@
 			records.setAuditStatus(1);
 			records.setType(accreditationRecords.getType());
 			records.setUserId(Long.parseLong(id));
-			//新增
-			this.save(records);
+			//判断类型,如果是上岗证则判断是否有申请,有申请的不在新增记录
+			if (accreditationRecords.getType()==1){
+				//查询当前人员是否有申请记录
+				int count  = baseMapper.getAccreditationRecordsByUserIdCount(id);
+				if (count<1){
+					//新增
+					this.save(records);
 
-			//内网新增
-			String s = "insert into sys_accreditation_records(id,user_id,create_time,create_user,status,type,audit_status) " +
-				"values(" + "'" + records.getId() + "'" + ","
-				+ "'" + records.getUserId() + "'" + ","
-				+ "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(records.getCreateTime()) + "'" + ","
-				+ "'" + records.getCreateUser() +"'" + ","
-				+ "'" + records.getStatus() +"'" + ","
-				+ "'" + records.getType() +"'" + ","
-				+"'" + records.getAuditStatus() + "'" + ")";
-			FtpUtil.sqlFileUpload(s);
+					//内网新增
+					String s = "insert into sys_accreditation_records(id,user_id,create_time,create_user,status,type,audit_status) " +
+						"values(" + "'" + records.getId() + "'" + ","
+						+ "'" + records.getUserId() + "'" + ","
+						+ "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(records.getCreateTime()) + "'" + ","
+						+ "'" + records.getCreateUser() +"'" + ","
+						+ "'" + records.getStatus() +"'" + ","
+						+ "'" + records.getType() +"'" + ","
+						+"'" + records.getAuditStatus() + "'" + ")";
+					FtpUtil.sqlFileUpload(s);
+				}
+			}
+			//判断类型,如果是证书的,审核未通过的可以再次申请,审核通过的,暂时不给于新增记录
+			if (accreditationRecords.getType()==2){
+				//查询当前人员是否有待审核和审核通过的记录数
+				int count  = baseMapper.getAccreditationRecordsByUserIdAuditCount(id);
+				if (count<1){
+					//新增
+					this.save(records);
+
+					//内网新增
+					String s = "insert into sys_accreditation_records(id,user_id,create_time,create_user,status,type,audit_status) " +
+						"values(" + "'" + records.getId() + "'" + ","
+						+ "'" + records.getUserId() + "'" + ","
+						+ "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(records.getCreateTime()) + "'" + ","
+						+ "'" + records.getCreateUser() +"'" + ","
+						+ "'" + records.getStatus() +"'" + ","
+						+ "'" + records.getType() +"'" + ","
+						+"'" + records.getAuditStatus() + "'" + ")";
+					FtpUtil.sqlFileUpload(s);
+				}
+			}
+
 		});
 		return true;
 	}
@@ -139,4 +168,27 @@
 		}
 		return null;
 	}
+
+	/**
+	 * 导出证书制证信息
+	 * @param accreditationRecords
+	 * @return
+	 */
+	@Override
+	public List<ExportSecurityBookPaperExcel> exportSecurityBookPaper(AccreditationRecordsVo accreditationRecords) {
+		//查询数据
+		List<ExportSecurityBookPaperExcel> accreditationRecordsVos = baseMapper.exportSecurityBookPaper(accreditationRecords);
+		return accreditationRecordsVos;
+	}
+
+	/**
+	 * 导出证书制证信息(包含照片)
+	 */
+	@Override
+	public List<AccreditationRecordsVo> exportSecurityBookPapers(AccreditationRecordsVo accreditationRecords) {
+		//查询数据
+		List<AccreditationRecordsVo> accreditationRecordsVos = baseMapper.exportSecurityBookPapers(accreditationRecords);
+		System.out.println("accreditationRecordsVos = " + accreditationRecordsVos.size());
+		return accreditationRecordsVos;
+	}
 }

--
Gitblit v1.9.3