From 8853292babb2ad94de4a3207966f1e83b767cd2d Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Sun, 17 Sep 2023 16:38:34 +0800
Subject: [PATCH] 新增流程节点进程查询接口

---
 src/main/java/org/springblade/modules/accreditation/service/impl/AccreditationRecordsServiceImpl.java |   71 +++++++++++++++++++++++------------
 1 files changed, 47 insertions(+), 24 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 c763ebb..5e91913 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
@@ -4,6 +4,7 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.AllArgsConstructor;
+import org.springblade.common.config.QrcodeConfig;
 import org.springblade.common.utils.QRCodeUtil;
 import org.springblade.modules.FTP.FtpUtil;
 import org.springblade.modules.accreditation.excel.ExportSecurityBookPaperExcel;
@@ -12,6 +13,8 @@
 import org.springblade.modules.accreditation.mapper.AccreditationRecordsMapper;
 import org.springblade.modules.accreditation.service.AccreditationRecordsService;
 import org.springblade.modules.accreditation.vo.AccreditationRecordsVo;
+import org.springblade.modules.system.service.MyAsyncService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.net.MalformedURLException;
@@ -25,15 +28,18 @@
 
 /**
  * 制证记录服务实现类
+ *
  * @author zhongrj
  */
 @Service
 @AllArgsConstructor
 public class AccreditationRecordsServiceImpl extends ServiceImpl<AccreditationRecordsMapper, AccreditationRecords> implements AccreditationRecordsService {
-
+	@Autowired
+	private MyAsyncService myAsyncService;
 
 	/**
 	 * 自定义分页
+	 *
 	 * @param page
 	 * @param accreditationRecords
 	 * @return
@@ -46,6 +52,7 @@
 
 	/**
 	 * 制证申请(批量)
+	 *
 	 * @param accreditationRecords 制证记录信息对象
 	 */
 	@Override
@@ -53,7 +60,7 @@
 		//读取ids
 		List<String> list = Arrays.asList(accreditationRecords.getIds().split(","));
 		//遍历
-		list.forEach(id->{
+		list.forEach(id -> {
 			AccreditationRecords records = new AccreditationRecords();
 			records.setCreateTime(new Date());
 			records.setCreateUser(accreditationRecords.getCreateUser());
@@ -62,10 +69,10 @@
 			records.setType(accreditationRecords.getType());
 			records.setUserId(Long.parseLong(id));
 			//判断类型,如果是上岗证则判断是否有申请,有申请的不在新增记录
-			if (accreditationRecords.getType()==1){
+			if (accreditationRecords.getType() == 1) {
 				//查询当前人员是否有申请记录
-				int count  = baseMapper.getAccreditationRecordsByUserIdCount(id);
-				if (count<1){
+				int count = baseMapper.getAccreditationRecordsByUserIdCount(id);
+				if (count < 1) {
 					//新增
 					this.save(records);
 
@@ -74,18 +81,19 @@
 						"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);
+						+ "'" + records.getCreateUser() + "'" + ","
+						+ "'" + records.getStatus() + "'" + ","
+						+ "'" + records.getType() + "'" + ","
+						+ "'" + records.getAuditStatus() + "'" + ")";
+					//FtpUtil.sqlFileUpload(s);
+					myAsyncService.dataSync(s);
 				}
 			}
 			//判断类型,如果是证书的,审核未通过的可以再次申请,审核通过的,暂时不给于新增记录
-			if (accreditationRecords.getType()==2){
+			if (accreditationRecords.getType() == 2) {
 				//查询当前人员是否有待审核和审核通过的记录数
-				int count  = baseMapper.getAccreditationRecordsByUserIdAuditCount(id,2);
-				if (count<1){
+				int count = baseMapper.getAccreditationRecordsByUserIdAuditCount(id, 2);
+				if (count < 1) {
 					//新增
 					this.save(records);
 
@@ -94,11 +102,12 @@
 						"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);
+						+ "'" + records.getCreateUser() + "'" + ","
+						+ "'" + records.getStatus() + "'" + ","
+						+ "'" + records.getType() + "'" + ","
+						+ "'" + records.getAuditStatus() + "'" + ")";
+					//FtpUtil.sqlFileUpload(s);
+					myAsyncService.dataSync(s);
 				}
 			}
 
@@ -108,6 +117,7 @@
 
 	/**
 	 * 自定义详情信息
+	 *
 	 * @param accreditationRecords
 	 * @return
 	 */
@@ -118,6 +128,7 @@
 
 	/**
 	 * 导出保安员证信息
+	 *
 	 * @param accreditationRecords
 	 * @return
 	 */
@@ -125,19 +136,28 @@
 	public List<ExportSecurityPaperExcel> exportSecurityPaperList(AccreditationRecordsVo accreditationRecords) {
 		//查询数据
 		List<AccreditationRecordsVo> accreditationRecordsVos = baseMapper.exportSecurityPaperList(accreditationRecords);
-		if (accreditationRecordsVos.size()>0) {
+		if (accreditationRecordsVos.size() > 0) {
 			//返回的集合数据
 			List<ExportSecurityPaperExcel> list = new ArrayList<>();
 			//遍历
 			accreditationRecordsVos.forEach(accreditationRecordsVo -> {
+				//导出即修改为已制证状态
+				AccreditationRecords accreditationRecords1 = new AccreditationRecords();
+				accreditationRecords1.setId(accreditationRecordsVo.getId());
+				accreditationRecords1.setStatus(2);
+				//记录导出时间为制证时间
+				accreditationRecords1.setPaperTime(new Date());
+				//修改
+				this.updateById(accreditationRecords1);
+
 				ExportSecurityPaperExcel excel = new ExportSecurityPaperExcel();
 				//数据转换封装
 				excel.setRealName(accreditationRecordsVo.getRealName());
 				excel.setIdCardNo(accreditationRecordsVo.getIdCardNo());
 				excel.setDeptName(accreditationRecordsVo.getDeptName());
-				if (accreditationRecordsVo.getSex().equals("1")){
+				if (accreditationRecordsVo.getSex().equals("1")) {
 					excel.setSex("男");
-				}else {
+				} else {
 					excel.setSex("女");
 				}
 				excel.setPaperTime(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
@@ -154,7 +174,7 @@
 				//如果保安证编号不为空
 				if (null != accreditationRecordsVo.getSecurityNumber() && accreditationRecordsVo.getSecurityNumber() != "") {
 					//去生成二维码
-					String url = "http://223.82.109.183:2080/securityInfo.html";
+					String url = QrcodeConfig.baseUrl + "securityInfo.html";
 					String encoded = null;
 					try {
 						encoded = URLEncoder.encode(accreditationRecordsVo.getSecurityNumber(), "UTF-8");
@@ -177,6 +197,7 @@
 
 	/**
 	 * 导出证书制证信息
+	 *
 	 * @param accreditationRecords
 	 * @return
 	 */
@@ -200,6 +221,7 @@
 
 	/**
 	 * 批量修改为已制证
+	 *
 	 * @param accreditationRecords 制证记录信息对象
 	 */
 	@Override
@@ -207,7 +229,7 @@
 		//读取ids
 		List<String> list = Arrays.asList(accreditationRecords.getIds().split(","));
 		//遍历
-		list.forEach(id->{
+		list.forEach(id -> {
 			AccreditationRecords records = new AccreditationRecords();
 			records.setStatus(2);
 			records.setId(Long.parseLong(id));
@@ -218,7 +240,8 @@
 			String s =
 				"update sys_accreditation_records set status = " + accreditationRecords.getStatus() + "" +
 					"where id = " + "'" + accreditationRecords.getId() + "'";
-			FtpUtil.sqlFileUpload(s);
+			//FtpUtil.sqlFileUpload(s);
+			myAsyncService.dataSync(s);
 		});
 		return true;
 	}

--
Gitblit v1.9.3