From f0e2074cb81056813fe8b34aa6b7d8a2419e1bdf Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 11 Nov 2021 20:49:06 +0800
Subject: [PATCH] 新增制证审核

---
 src/main/java/org/springblade/modules/accreditation/service/impl/AccreditationRecordsServiceImpl.java |    8 ++
 src/main/java/org/springblade/modules/accreditation/vo/AccreditationRecordsVo.java                    |   21 +++++++
 src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml             |   23 +++++++
 src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java    |   48 +++++++++++++++
 src/main/java/org/springblade/modules/system/excel/SecurityExcel.java                                 |    2 
 src/main/java/org/springblade/modules/accreditation/entity/AccreditationRecords.java                  |   30 ++++++++++
 6 files changed, 127 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java b/src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java
index 6ff5d45..c1ca392 100644
--- a/src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java
+++ b/src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java
@@ -11,6 +11,7 @@
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.FTP.FtpUtil;
 import org.springblade.modules.accreditation.excel.ExportSecurityPaperExcel;
 import org.springblade.modules.system.service.IUserService;
 import org.springblade.modules.accreditation.entity.AccreditationRecords;
@@ -21,6 +22,7 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 /**
@@ -72,9 +74,53 @@
 	}
 
 
+	/**
+	 * 审核
+	 * @param accreditationRecords 制证记录信息对象
+	 */
+	@PostMapping("/audit")
+	public R audit(@RequestBody AccreditationRecords accreditationRecords){
+		accreditationRecords.setAuditTime(new Date());
+		boolean b = accreditationRecordsService.updateById(accreditationRecords);
+		//内网同步
+		String s =
+			"update sys_accreditation_records set audit_status = " + accreditationRecords.getAuditStatus() + "" +
+				",audit_detail = " + accreditationRecords.getAuditDetail() + "" +
+				",audit_time = " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(accreditationRecords.getAuditTime()) + "" +
+				",audit_user = " + accreditationRecords.getAuditUser() + " " +
+				"where id = " + "'" + accreditationRecords.getId() + "'";
+		FtpUtil.sqlFileUpload(s);
+		//返回
+		return R.status(b);
+	}
 
 
-
+	/**
+	 * 批量审核
+	 * @param accreditationRecords 制证记录信息对象
+	 */
+	@PostMapping("/batchAudit")
+	public R batchAudit(@RequestBody AccreditationRecordsVo accreditationRecords){
+		//取出申请id
+		String ids = accreditationRecords.getIds();
+		List<String> list = Arrays.asList(ids.split(","));
+		//批量审核
+		list.forEach(id->{
+			accreditationRecords.setId(Long.parseLong(id));
+			accreditationRecords.setAuditTime(new Date());
+			accreditationRecordsService.updateById(accreditationRecords);
+			//内网同步
+			String s =
+				"update sys_accreditation_records set audit_status = " + accreditationRecords.getAuditStatus() + "" +
+					",audit_detail = " + accreditationRecords.getAuditDetail() + "" +
+					",audit_time = " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(accreditationRecords.getAuditTime()) + "" +
+					",audit_user = " + accreditationRecords.getAuditUser() + " " +
+					"where id = " + "'" + accreditationRecords.getId() + "'";
+			FtpUtil.sqlFileUpload(s);
+		});
+		//返回
+		return R.status(true);
+	}
 
 
 	/**
diff --git a/src/main/java/org/springblade/modules/accreditation/entity/AccreditationRecords.java b/src/main/java/org/springblade/modules/accreditation/entity/AccreditationRecords.java
index 6923361..4e1c28c 100644
--- a/src/main/java/org/springblade/modules/accreditation/entity/AccreditationRecords.java
+++ b/src/main/java/org/springblade/modules/accreditation/entity/AccreditationRecords.java
@@ -66,4 +66,34 @@
 	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 	private Date accreditationTime;
 
+	/**
+	 * 状态 1:上岗证  2:证书
+	 */
+	private Integer type;
+
+	/**
+	 * 审核状态  1:待审核   2:审核通过   3:审核不通过
+	 */
+	@TableField("audit_status")
+	private Integer auditStatus;
+
+	/**
+	 * 审核时间
+	 */
+	@TableField("audit_time")
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date auditTime;
+
+	/**
+	 * 审核详情
+	 */
+	@TableField("audit_detail")
+	private String auditDetail;
+
+	/**
+	 * 审核人员id
+	 */
+	@TableField("audit_user")
+	private Long auditUser;
 }
diff --git a/src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml b/src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml
index 5728425..5d289ab 100644
--- a/src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml
+++ b/src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml
@@ -11,7 +11,11 @@
             bu.sex,bu.cardid idCardNo,
             bu.securitynumber securityNumber,
             bu.avatar,
-            ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING( bu.cardid,7,4),0) age
+            ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING( bu.cardid,7,4),0) age,
+            bu1.real_name applyName,
+            bt1.dept_name applyUnit,
+            bu.registered,
+            bu.user_type userType
         FROM
             sys_accreditation_records sar
         left join
@@ -22,6 +26,14 @@
             blade_dept bt
         ON
             bu.dept_id = bt.id
+        left join
+        blade_user bu1
+        on
+        sar.create_user = bu1.id
+        LEFT JOIN
+        blade_dept bt1
+        ON
+        bu1.dept_id = bt1.id
         WHERE
             1=1
         and bu.status = 1
@@ -35,12 +47,21 @@
         <if test="accreditationRecords.idCardNo!=null and  accreditationRecords.idCardNo!=''">
             and bu.cardid like concat('%', #{accreditationRecords.idCardNo},'%')
         </if>
+        <if test="accreditationRecords.applyUnit!=null and  accreditationRecords.applyUnit!=''">
+            and bt1.dept_name like concat('%', #{accreditationRecords.applyUnit},'%')
+        </if>
         <if test="accreditationRecords.securityNumber!=null and  accreditationRecords.securityNumber!=''">
             and bu.securitynumber like concat('%', #{accreditationRecords.securityNumber},'%')
         </if>
         <if test="accreditationRecords.status!=null">
             and sar.status = #{accreditationRecords.status}
         </if>
+        <if test="accreditationRecords.type!=null">
+            and sar.type = #{accreditationRecords.type}
+        </if>
+        <if test="accreditationRecords.auditStatus!=null">
+            and sar.audit_status = #{accreditationRecords.auditStatus}
+        </if>
         <if test="accreditationRecords.isAvatar==1">
             and bu.avatar is not null and bu.avatar!=""
         </if>
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 73306df..783f4d0 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
@@ -57,17 +57,21 @@
 			records.setCreateTime(new Date());
 			records.setCreateUser(accreditationRecords.getCreateUser());
 			records.setStatus(1);
+			records.setAuditStatus(1);
+			records.setType(accreditationRecords.getType());
 			records.setUserId(Long.parseLong(id));
 			//新增
 			this.save(records);
 
 			//内网新增
-			String s = "insert into sys_apply(id,user_id,create_time,create_user,status) " +
+			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.getStatus() +"'" + ","
+				+ "'" + records.getType() +"'" + ","
+				+"'" + records.getAuditStatus() + "'" + ")";
 			FtpUtil.sqlFileUpload(s);
 		});
 		return true;
diff --git a/src/main/java/org/springblade/modules/accreditation/vo/AccreditationRecordsVo.java b/src/main/java/org/springblade/modules/accreditation/vo/AccreditationRecordsVo.java
index 79e01b5..8bc81b0 100644
--- a/src/main/java/org/springblade/modules/accreditation/vo/AccreditationRecordsVo.java
+++ b/src/main/java/org/springblade/modules/accreditation/vo/AccreditationRecordsVo.java
@@ -75,4 +75,25 @@
 	 * 是否有头像  1:有  2:没有上传
 	 */
 	private Integer isAvatar;
+
+	/**
+	 * 申请人姓名
+	 */
+	private String applyName;
+
+	/**
+	 * 申请人单位
+	 */
+	private String applyUnit;
+
+	/**
+	 * 身份证地址
+	 */
+	private String registered;
+
+
+	/**
+	 * 是否制证  6:是  7:否
+	 */
+	private Integer userType;
 }
diff --git a/src/main/java/org/springblade/modules/system/excel/SecurityExcel.java b/src/main/java/org/springblade/modules/system/excel/SecurityExcel.java
index a9ca871..759626b 100644
--- a/src/main/java/org/springblade/modules/system/excel/SecurityExcel.java
+++ b/src/main/java/org/springblade/modules/system/excel/SecurityExcel.java
@@ -60,7 +60,7 @@
 	@ColumnWidth(10)
 	private String nation;
 
-	@ExcelProperty("住址*")
+	@ExcelProperty("身份证住址*")
 	private String registered;
 
 	@ExcelProperty("是否持证*")

--
Gitblit v1.9.3