From a2128bbba47602e6795f2667cf2948992f24bebe Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 10 Jan 2022 17:00:22 +0800
Subject: [PATCH] 1. 上岗证新增审核 2. 上岗证导出和证书打印记录时间

---
 src/main/java/org/springblade/modules/accreditation/service/impl/AccreditationRecordsServiceImpl.java |    2 +
 src/main/java/org/springblade/modules/jurisdiction/controller/JurisdictionController.java             |    2 +
 src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml             |    5 ++
 src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java    |   88 +++++++++++++++++++++++++++----------------
 src/main/java/org/springblade/modules/equipage/controller/fixed.java                                  |    1 
 src/main/java/org/springblade/modules/system/controller/UserController.java                           |    2 +
 src/main/java/org/springblade/modules/accreditation/entity/AccreditationRecords.java                  |    7 +++
 7 files changed, 73 insertions(+), 34 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 dc1f539..53c1dcc 100644
--- a/src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java
+++ b/src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java
@@ -140,22 +140,33 @@
 			//修改为未制证状态
 			AccreditationRecords records = accreditationRecordsService.getById(accreditationRecords);
 			User user = userService.getById(records.getUserId());
-			user.setUserType(7);
-			user.setUpdateTime(new Date());
-			//更新
-			userService.updateById(user);
+			if(accreditationRecords.getType()==2) {
+				user.setUserType(7);
+				user.setUpdateTime(new Date());
+				//更新
+				userService.updateById(user);
 
-			//内网同步
-			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() + "';" +
-				"update blade_user set user_type = " + user.getUserType() + "" +
-					",update_time = " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getUpdateTime()) + "" +
-					"where id = " + "'" + user.getId() + "'";
-			FtpUtil.sqlFileUpload(s);
+				//内网同步
+				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() + "';" +
+						"update blade_user set user_type = " + user.getUserType() + "" +
+						",update_time = " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getUpdateTime()) + "" +
+						"where id = " + "'" + user.getId() + "'";
+				FtpUtil.sqlFileUpload(s);
+			}else {
+				//内网同步
+				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);
+			}
 		}else {
 			//内网同步
 			String s =
@@ -187,25 +198,36 @@
 			accreditationRecordsService.updateById(accreditationRecords);
 			//审核通过
 			if (accreditationRecords.getAuditStatus()==2){
-				//修改为未制证状态
-				AccreditationRecords records = accreditationRecordsService.getById(id);
-				User user = userService.getById(records.getUserId());
-				user.setUserType(7);
-				user.setUpdateTime(new Date());
-				//更新
-				userService.updateById(user);
+				if (accreditationRecords.getType()==2) {
+					//修改为未制证状态
+					AccreditationRecords records = accreditationRecordsService.getById(id);
+					User user = userService.getById(records.getUserId());
+					user.setUserType(7);
+					user.setUpdateTime(new Date());
+					//更新
+					userService.updateById(user);
 
-				//内网同步
-				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() + "';" +
-					"update blade_user set user_type = " + user.getUserType() + "" +
-						",update_time = " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getUpdateTime()) + "" +
-						"where id = " + "'" + user.getId() + "'";
-				FtpUtil.sqlFileUpload(s);
+					//内网同步
+					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() + "';" +
+							"update blade_user set user_type = " + user.getUserType() + "" +
+							",update_time = " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getUpdateTime()) + "" +
+							"where id = " + "'" + user.getId() + "'";
+					FtpUtil.sqlFileUpload(s);
+				}else {
+					//内网同步
+					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);
+				}
 			}else {
 				//内网同步
 				String s =
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 4e1c28c..f002356 100644
--- a/src/main/java/org/springblade/modules/accreditation/entity/AccreditationRecords.java
+++ b/src/main/java/org/springblade/modules/accreditation/entity/AccreditationRecords.java
@@ -96,4 +96,11 @@
 	 */
 	@TableField("audit_user")
 	private Long auditUser;
+
+	/**
+	 * 证书打印时间
+	 */
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date paperTime;
 }
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 43fe24e..a79c897 100644
--- a/src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml
+++ b/src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml
@@ -128,7 +128,7 @@
     </select>
 
 
-    <!--导出保安员证信息-->
+    <!--导出保安员证信息(上岗证)-->
     <select id="exportSecurityPaperList" resultType="org.springblade.modules.accreditation.vo.AccreditationRecordsVo">
         SELECT
         sar.*,
@@ -214,6 +214,9 @@
         <if test="accreditationRecords.isAvatar==2">
             and (bu.avatar is null or bu.avatar="")
         </if>
+        <if test="accreditationRecords.auditStatus!=null">
+            and sar.audit_status = #{accreditationRecords.auditStatus}
+        </if>
         <if test="accreditationRecords.startTime!=null and accreditationRecords.startTime!='' and accreditationRecords.startTime!='undefined'">
             and sar.create_time &gt;= #{accreditationRecords.startTime}
         </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 7afae75..d97cfe5 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
@@ -134,6 +134,8 @@
 				AccreditationRecords accreditationRecords1 = new AccreditationRecords();
 				accreditationRecords1.setId(accreditationRecordsVo.getId());
 				accreditationRecords1.setStatus(2);
+				//记录导出时间为制证时间
+				accreditationRecords1.setPaperTime(new Date());
 				//修改
 				this.updateById(accreditationRecords1);
 
diff --git a/src/main/java/org/springblade/modules/equipage/controller/fixed.java b/src/main/java/org/springblade/modules/equipage/controller/fixed.java
index b010abf..f6dd7b5 100644
--- a/src/main/java/org/springblade/modules/equipage/controller/fixed.java
+++ b/src/main/java/org/springblade/modules/equipage/controller/fixed.java
@@ -61,6 +61,7 @@
 			params.put("acc", equipmentCode);
 			String res = null;
 			res = HttpReqUtil.getInstance().doPost(url, params, null);
+			System.out.println("res = " + res);
 			JSONArray jsonArray = JSONArray.fromObject(res);
 			JSONArray sortedJsonArray = new JSONArray();
 			List<JSONObject> jsonValues = new ArrayList<JSONObject>();
diff --git a/src/main/java/org/springblade/modules/jurisdiction/controller/JurisdictionController.java b/src/main/java/org/springblade/modules/jurisdiction/controller/JurisdictionController.java
index 5b05a7f..b9108e6 100644
--- a/src/main/java/org/springblade/modules/jurisdiction/controller/JurisdictionController.java
+++ b/src/main/java/org/springblade/modules/jurisdiction/controller/JurisdictionController.java
@@ -105,6 +105,7 @@
 	@ApiOperationSupport(order = 4)
 	@ApiOperation(value = "树形结构", notes = "树形结构")
 	public R<List<JurisdictionVO>> tree(String tenantId, BladeUser bladeUser) {
+		tenantId = "000000";
 		List<JurisdictionVO> tree = jurisdictionService.tree(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()));
 		return R.data(tree);
 	}
@@ -116,6 +117,7 @@
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "懒加载树形结构", notes = "树形结构")
 	public R<List<JurisdictionVO>> lazyTree(String tenantId, Long parentId, BladeUser bladeUser) {
+		bladeUser.setTenantId("000000");
 		List<JurisdictionVO> tree = jurisdictionService.lazyTree(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()), parentId);
 		return R.data(tree);
 	}
diff --git a/src/main/java/org/springblade/modules/system/controller/UserController.java b/src/main/java/org/springblade/modules/system/controller/UserController.java
index 0beac1d..801cf3e 100644
--- a/src/main/java/org/springblade/modules/system/controller/UserController.java
+++ b/src/main/java/org/springblade/modules/system/controller/UserController.java
@@ -661,6 +661,8 @@
 			AccreditationRecords accreditationRecords1 = collect.get(0);
 			//修改为已制证状态
 			accreditationRecords1.setStatus(2);
+			//记录打印时间
+			accreditationRecords1.setPaperTime(new Date());
 			//更新
 			accreditationRecordsService.updateById(accreditationRecords1);
 			//同步

--
Gitblit v1.9.3