瀏覽代碼

修改盖章位置

humuyu 3 年之前
父節點
當前提交
91147e3486

+ 1 - 209
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/CochainLogServiceImpl.java

@@ -49,212 +49,4 @@ import me.zhengjie.dao.mybatis.mapper.OrderRoomIdMapper;
  */
 @Service
 @Slf4j
-public class CochainLogServiceImpl extends ServiceImpl<ICochainLogDao, CochainLogEntity> implements CochainLogService {
-
-	@Autowired
-	OrderCochainService orderCochainService;
-
-	@Autowired
-	AdminOrderService adminOrderService;
-	@Autowired
-	CochainService cochainService;
-	@Autowired
-	CochainLogService cochainLogService;
-	@Autowired
-	OrderFileMapper orderFileMapper;
-	@Autowired
-	OrderRoomIdMapper orderRoomIdMapper;
-	@Autowired
-	ContractOrderMapper contractOrderMapper;
-
-	private static String UPLOAD_FILE_PATH;
-
-	@PostConstruct
-	public void init() {
-		new Thread(new Runnable() {
-
-			@Override
-			public void run() {
-				try {
-					Thread.sleep(1000l);
-				} catch (InterruptedException e) {
-					e.printStackTrace();
-				}
-				try {
-					chainEvidence();
-				} catch (Exception e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-			}
-		}).start();
-		// t.set
-
-	}
-
-	private void initCochainPath(String path) {
-		// 得到文件的临时目录
-		String applicationDir = FileUploadUtil.getApplicationTempDir();
-		String downloadPath = applicationDir + "/" + path + "/";
-		UPLOAD_FILE_PATH = downloadPath;
-	}
-
-	private void chainEvidence() throws Exception {
-
-		QueryWrapper<OrderCochainEntity> qw = new QueryWrapper<>();
-		qw = qw.in("status", 0, 2).orderByAsc("create_time").last("limit 1");
-
-		OrderCochainEntity cochainEntity = orderCochainService.getOne(qw);
-
-		if (cochainEntity == null) {
-			log.info("没有上链数据:");
-			return;
-		}
-		// 业务编码
-		String businessNo = cochainEntity.getBusinessNo();
-		initCochainPath(businessNo);
-		List<File> zipList = new ArrayList<>();
-		QueryWrapper<ContractOrderEntity> orderqw = new QueryWrapper<>();
-		orderqw.eq("business_no", businessNo);
-		ContractOrderEntity contractOrder = contractOrderMapper.selectOne(orderqw);
-		// 查询数据
-		log.info("【开始】调用上链业务编号:" + businessNo);
-		// 查询所有上传的图片
-		Map<String, FileInfoEntity> map = adminOrderService.getUploadFile(businessNo);
-		// 身份证正面idcard_front_pic
-		download(contractOrder.getIdcardFrontPic(), map, "身份证正面", zipList);
-		// 身份证反面
-		download(contractOrder.getIdcardBackPic(), map, "身份证反面", zipList);
-		// 合同contract_attachment
-		download(contractOrder.getContractAttachment(), map, "合同", zipList);
-		// 抵押物 mortgage_pic
-		download(contractOrder.getMortgagePic(), map, "抵押物", zipList);
-		// 结婚证
-		download(contractOrder.getMarragePic(), map, "结婚证", zipList);
-		// 其他上传
-		download(contractOrder.getOtherUpload(), map, "其他上传", zipList);
-		// 户口本
-		download(contractOrder.getHkbPic(), map, "户口本", zipList);
-		// 配偶身份证正面照片
-		download(contractOrder.getJointIdcardFrontPic(), map, "共同借款身份证正面", zipList);
-		// 配偶身份证反面照片
-		download(contractOrder.getJointIdcardBackPic(), map, "共同借款身份证反面照片", zipList);
-
-		// 带有盖章的pdf
-		QueryWrapper<OrderFileEntity> wrapper = new QueryWrapper<>();
-		wrapper.eq("business_no", businessNo);
-		// 这里处理,如果没有盖章的就把签名的pdf上传
-		List<OrderFileEntity> orderFiles = orderFileMapper.selectList(wrapper);
-		for (OrderFileEntity orderFile : orderFiles) {
-			if (StringUtils.isNotBlank(orderFile.getSignedPdfUrl())) {
-				downloadByPath(orderFile.getSignedPdfUrl(), map, orderFile.getFileName(), zipList);
-			} else {
-				downloadByPath(orderFile.getPdfUrl(), map, orderFile.getFileName(), zipList);
-			}
-		}
-		// 处理视频
-		QueryWrapper<OrderRoomIdEntity> queryWrapper = new QueryWrapper<>();
-		queryWrapper.eq("business_no", businessNo);
-		queryWrapper.orderByDesc("create_time");
-		List<OrderRoomIdEntity> orderRoomList = orderRoomIdMapper.selectList(queryWrapper);
-		if (orderRoomList != null && orderRoomList.size() > 0) {
-			OrderRoomIdEntity orderRoomId = orderRoomList.get(0);
-			downloadByPath(orderRoomId.getAppVideoUrl(), map, "APP视频", zipList);
-			downloadByPath(orderRoomId.getPcVideoUrl(), map, "PC视频", zipList);
-		}
-		String fileName = businessNo + ".zip";
-		// 对文件进行压缩
-		File targetFile = new File(UPLOAD_FILE_PATH + fileName);
-		ZipUtil.zip(targetFile, Charset.forName("utf-8"), false, ArrayUtil.toArray(zipList, File.class));
-		// 将压缩完成的文件上传到文件服务器
-		String contentType = "application/x-zip-compressed";
-		String uploadPath = businessNo + "/" + fileName;
-
-		FileUploadUtil.uploadFile(uploadPath, contentType, targetFile);
-		// 删除本地的所有文件
-		FileUtils.forceDelete(targetFile.getParentFile());
-		log.info("【结束】调用上链业务编号:" + businessNo);
-	}
-
-	/**
-	 * 调用第三方上链接口
-	 */
-	@XxlJob("cochain")
-	public void jobCochain() {
-		// chainEvidence();
-	}
-
-	/**
-	 * 通过文件路径上传
-	 * 
-	 * @param businessNo
-	 * @param orderId
-	 * @param filePath
-	 * @param logs
-	 * @param cochainLogs
-	 * @throws Exception
-	 */
-	public void downloadByPath(String filePath, Map<String, FileInfoEntity> map, String fileName, List<File> list)
-			throws Exception {
-		if (StringUtils.isNotBlank(filePath)) {
-			InputStream input = null;
-			try {
-				input = FileUploadUtil.getInputStream(filePath);
-				int index = filePath.lastIndexOf(".");
-				String suffix = filePath.substring(index);
-				String destFile = UPLOAD_FILE_PATH + fileName + suffix;
-				File file = new File(destFile);
-				FileUtils.copyInputStreamToFile(input, file);
-				list.add(file);
-			} catch (Exception e) {
-				throw e;
-			} finally {
-				if (input != null) {
-					input.close();
-				}
-			}
-		}
-	}
-
-	public void download(String fileId, Map<String, FileInfoEntity> map, String fileName, List<File> list)
-			throws Exception {
-		if (StringUtils.isBlank(fileId)) {
-			return;
-		}
-		// 先初始化
-		String[] fileIds = { fileId };
-		if (fileId.contains(",")) {
-			fileIds = fileId.split(",");
-		}
-		int i = 1;
-		for (String key : fileIds) {
-			// 计算是否已经包含了插入数据
-			FileInfoEntity fileInfo = map.get(key);
-			InputStream input = null;
-			try {
-				String filePath = fileInfo.getPath();
-				input = FileUploadUtil.getInputStream(filePath);
-				int index = filePath.lastIndexOf(".");
-				String suffix = filePath.substring(index);
-				String destFile = UPLOAD_FILE_PATH + fileName + (i++) + suffix;
-				File file = new File(destFile);
-				FileUtils.copyInputStreamToFile(input, file);
-				list.add(file);
-			} catch (Exception e) {
-				throw e;
-			} finally {
-				if (input != null) {
-					input.close();
-				}
-			}
-
-		}
-
-	}
-
-	public static void main(String[] args) {
-		String path = "b13f8c4a31034286962c7c7d985b64d8_1.jpeg";
-		int index = path.lastIndexOf(".");
-		System.out.println(path.substring(index));
-	}
-}
+public class CochainLogServiceImpl extends ServiceImpl<ICochainLogDao, CochainLogEntity> implements CochainLogService {}

+ 239 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/OrderCochainServiceImpl.java

@@ -1,10 +1,39 @@
 package me.zhengjie.application.admin.service.impl;
 
+import java.io.File;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+
+import org.apache.commons.io.FileUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.xxl.job.core.handler.annotation.XxlJob;
+
+import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.core.util.ZipUtil;
+import lombok.extern.slf4j.Slf4j;
+import me.zhengjie.application.admin.service.AdminOrderService;
 import me.zhengjie.application.admin.service.OrderCochainService;
+import me.zhengjie.base.chain.CochainService;
 import me.zhengjie.base.plus.AbstractServiceImpl;
+import me.zhengjie.base.util.FileUploadUtil;
+import me.zhengjie.dao.mybatis.entity.ContractOrderEntity;
+import me.zhengjie.dao.mybatis.entity.FileInfoEntity;
 import me.zhengjie.dao.mybatis.entity.OrderCochainEntity;
+import me.zhengjie.dao.mybatis.entity.OrderFileEntity;
+import me.zhengjie.dao.mybatis.entity.OrderRoomIdEntity;
+import me.zhengjie.dao.mybatis.mapper.ContractOrderMapper;
 import me.zhengjie.dao.mybatis.mapper.IOrderCochainDao;
+import me.zhengjie.dao.mybatis.mapper.OrderFileMapper;
+import me.zhengjie.dao.mybatis.mapper.OrderRoomIdMapper;
 
 /**
  * <p>
@@ -14,7 +43,217 @@ import me.zhengjie.dao.mybatis.mapper.IOrderCochainDao;
  * @author humuyu
  * @since 2022-07-25
  */
+@Slf4j
 @Service
 public class OrderCochainServiceImpl extends AbstractServiceImpl<IOrderCochainDao, OrderCochainEntity>
 		implements OrderCochainService {
+
+	@Autowired
+	OrderCochainService orderCochainService;
+	@Autowired
+	AdminOrderService adminOrderService;
+	@Autowired
+	CochainService cochainService;
+
+	@Autowired
+	OrderFileMapper orderFileMapper;
+	@Autowired
+	OrderRoomIdMapper orderRoomIdMapper;
+	@Autowired
+	ContractOrderMapper contractOrderMapper;
+
+	private static String UPLOAD_FILE_PATH;
+
+	@PostConstruct
+	public void init() {
+		new Thread(new Runnable() {
+
+			@Override
+			public void run() {
+				try {
+					Thread.sleep(1000l);
+				} catch (InterruptedException e) {
+					e.printStackTrace();
+				}
+				try {
+					chainEvidence();
+				} catch (Exception e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+		}).start();
+		// t.set
+
+	}
+
+	private void initCochainPath(String path) {
+		// 得到文件的临时目录
+		String applicationDir = FileUploadUtil.getApplicationTempDir();
+		String downloadPath = applicationDir + "/" + path + "/";
+		UPLOAD_FILE_PATH = downloadPath;
+	}
+
+	private void chainEvidence() throws Exception {
+
+		QueryWrapper<OrderCochainEntity> qw = new QueryWrapper<>();
+		qw = qw.in("status", 0, 2).orderByAsc("create_time").last("limit 1");
+
+		OrderCochainEntity cochainEntity = orderCochainService.getOne(qw);
+
+		if (cochainEntity == null) {
+			log.info("没有上链数据:");
+			return;
+		}
+		// 业务编码
+		String businessNo = cochainEntity.getBusinessNo();
+		initCochainPath(businessNo);
+		List<File> zipList = new ArrayList<>();
+		QueryWrapper<ContractOrderEntity> orderqw = new QueryWrapper<>();
+		orderqw.eq("business_no", businessNo);
+		ContractOrderEntity contractOrder = contractOrderMapper.selectOne(orderqw);
+		// 查询数据
+		log.info("【开始】调用上链业务编号:" + businessNo);
+		// 查询所有上传的图片
+		Map<String, FileInfoEntity> map = adminOrderService.getUploadFile(businessNo);
+		// 身份证正面idcard_front_pic
+		download(contractOrder.getIdcardFrontPic(), map, "身份证正面", zipList);
+		// 身份证反面
+		download(contractOrder.getIdcardBackPic(), map, "身份证反面", zipList);
+		// 合同contract_attachment
+		download(contractOrder.getContractAttachment(), map, "合同", zipList);
+		// 抵押物 mortgage_pic
+		download(contractOrder.getMortgagePic(), map, "抵押物", zipList);
+		// 结婚证
+		download(contractOrder.getMarragePic(), map, "结婚证", zipList);
+		// 其他上传
+		download(contractOrder.getOtherUpload(), map, "其他上传", zipList);
+		// 户口本
+		download(contractOrder.getHkbPic(), map, "户口本", zipList);
+		// 配偶身份证正面照片
+		download(contractOrder.getJointIdcardFrontPic(), map, "共同借款身份证正面", zipList);
+		// 配偶身份证反面照片
+		download(contractOrder.getJointIdcardBackPic(), map, "共同借款身份证反面照片", zipList);
+
+		// 带有盖章的pdf
+		QueryWrapper<OrderFileEntity> wrapper = new QueryWrapper<>();
+		wrapper.eq("business_no", businessNo);
+		// 这里处理,如果没有盖章的就把签名的pdf上传
+		List<OrderFileEntity> orderFiles = orderFileMapper.selectList(wrapper);
+		for (OrderFileEntity orderFile : orderFiles) {
+			if (StringUtils.isNotBlank(orderFile.getSignedPdfUrl())) {
+				downloadByPath(orderFile.getSignedPdfUrl(), map, orderFile.getFileName(), zipList);
+			} else {
+				downloadByPath(orderFile.getPdfUrl(), map, orderFile.getFileName(), zipList);
+			}
+		}
+		// 处理视频
+		QueryWrapper<OrderRoomIdEntity> queryWrapper = new QueryWrapper<>();
+		queryWrapper.eq("business_no", businessNo);
+		queryWrapper.orderByDesc("create_time");
+		List<OrderRoomIdEntity> orderRoomList = orderRoomIdMapper.selectList(queryWrapper);
+		if (orderRoomList != null && orderRoomList.size() > 0) {
+			OrderRoomIdEntity orderRoomId = orderRoomList.get(0);
+			downloadByPath(orderRoomId.getAppVideoUrl(), map, "APP视频", zipList);
+			downloadByPath(orderRoomId.getPcVideoUrl(), map, "PC视频", zipList);
+		}
+		String fileName = businessNo + ".zip";
+		// 对文件进行压缩
+		File targetFile = new File(UPLOAD_FILE_PATH + fileName);
+		ZipUtil.zip(targetFile, Charset.forName("utf-8"), false, ArrayUtil.toArray(zipList, File.class));
+		// 将压缩完成的文件上传到文件服务器
+		String contentType = "application/x-zip-compressed";
+		String uploadPath = businessNo + "/" + fileName;
+
+		FileUploadUtil.uploadFile(uploadPath, contentType, targetFile);
+	
+		log.info("【结束】调用上链业务编号:" + businessNo);
+		// 修改数据库的值
+		OrderCochainEntity orderCochain = new OrderCochainEntity();
+		orderCochain.setBusinessNo(businessNo);
+		orderCochain.setStatus("1");
+		orderCochainService.update(orderCochain, OrderCochainEntity::getBusinessNo);
+		//调用区块
+		
+		// 删除本地的所有文件
+		FileUtils.forceDelete(targetFile.getParentFile());
+	}
+
+	/**
+	 * 调用第三方上链接口
+	 */
+	@XxlJob("cochain")
+	public void jobCochain() {
+		// chainEvidence();
+	}
+
+	/**
+	 * 通过文件路径上传
+	 * 
+	 * @param businessNo
+	 * @param orderId
+	 * @param filePath
+	 * @param logs
+	 * @param cochainLogs
+	 * @throws Exception
+	 */
+	public void downloadByPath(String filePath, Map<String, FileInfoEntity> map, String fileName, List<File> list)
+			throws Exception {
+		if (StringUtils.isNotBlank(filePath)) {
+			InputStream input = null;
+			try {
+				input = FileUploadUtil.getInputStream(filePath);
+				int index = filePath.lastIndexOf(".");
+				String suffix = filePath.substring(index);
+				String destFile = UPLOAD_FILE_PATH + fileName + suffix;
+				File file = new File(destFile);
+				FileUtils.copyInputStreamToFile(input, file);
+				list.add(file);
+			} catch (Exception e) {
+				throw e;
+			} finally {
+				if (input != null) {
+					input.close();
+				}
+			}
+		}
+	}
+
+	public void download(String fileId, Map<String, FileInfoEntity> map, String fileName, List<File> list)
+			throws Exception {
+		if (StringUtils.isBlank(fileId)) {
+			return;
+		}
+		// 先初始化
+		String[] fileIds = { fileId };
+		if (fileId.contains(",")) {
+			fileIds = fileId.split(",");
+		}
+		int i = 1;
+		for (String key : fileIds) {
+			// 计算是否已经包含了插入数据
+			FileInfoEntity fileInfo = map.get(key);
+			InputStream input = null;
+			try {
+				String filePath = fileInfo.getPath();
+				input = FileUploadUtil.getInputStream(filePath);
+				int index = filePath.lastIndexOf(".");
+				String suffix = filePath.substring(index);
+				String destFile = UPLOAD_FILE_PATH + fileName + (i++) + suffix;
+				File file = new File(destFile);
+				FileUtils.copyInputStreamToFile(input, file);
+				list.add(file);
+			} catch (Exception e) {
+				throw e;
+			} finally {
+				if (input != null) {
+					input.close();
+				}
+			}
+
+		}
+
+	}
+
+
 }

+ 43 - 13
eladmin-system/src/main/java/me/zhengjie/base/chain/CochainService.java

@@ -1,6 +1,9 @@
 package me.zhengjie.base.chain;
 
+import java.nio.charset.StandardCharsets;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.springframework.stereotype.Component;
 
@@ -10,6 +13,7 @@ import com.alibaba.fastjson.JSONObject;
 import cn.hutool.core.codec.Base64;
 import cn.hutool.crypto.digest.HMac;
 import cn.hutool.crypto.digest.HmacAlgorithm;
+import cn.hutool.http.HttpRequest;
 import cn.hutool.http.HttpUtil;
 import lombok.extern.slf4j.Slf4j;
 import me.zhengjie.base.util.UUIDGenerator;
@@ -18,8 +22,13 @@ import me.zhengjie.dao.mybatis.entity.CochainLogEntity;
 @Slf4j
 @Component
 public class CochainService {
-	public static final String APP_ID = "testid";
-	public static final String APP_SECRET = "80f9b2133b240c193f09fa1842ab8ef425ac735afdf9ada10f06ca33cc7e8ca7";
+	// appid: ntgzcycb01
+	// appsecret: caf91ca41ef87e8acaad5cc16390c5eeb4ddbb8ab70eec8703c621b9e5ee4e98
+	public static final String APP_ID = "ntgzcycb01";
+	public static final String APP_SECRET = "caf91ca41ef87e8acaad5cc16390c5eeb4ddbb8ab70eec8703c621b9e5ee4e98";
+	public static final String PRODUCE = "http://58.240.76.108:9080/produce";
+
+	public static final String COCHAIN = "http://58.240.76.108:9080/cochain";
 
 	public static String sha1_HMAC(String message) {
 		HMac mac = new HMac(HmacAlgorithm.HmacSHA1, APP_SECRET.getBytes());
@@ -27,7 +36,33 @@ public class CochainService {
 		return macHex1;
 	}
 
+//{"code":"0","data":{"key":"d220a49e284dfb207e94595a2cbdb3a0d0b58602","taskId":"11111"},"msg":"操作成功"}
+	public String getKey(String taskId) {
+		Map<String, String> params = new HashMap<>();
+		params.put("app_id", APP_ID);
+		params.put("task_id", "11111");
+		String json = JSON.toJSONString(params);
+		System.out.print(json);
+		String base64 = Base64.encode(json.getBytes(StandardCharsets.UTF_8));
+		System.out.print(base64);
+		String my = sha1_HMAC(base64);
+		System.out.print(my);
+		Map<String, String> dict = new HashMap<>();
+		dict.put("content", base64);
+		dict.put("signature", my);
+		String raw = JSON.toJSONString(dict);
+		HttpRequest request = HttpRequest.post(PRODUCE);
+		request.header("Content-Type", "application/json; charset=utf-8");
+		String produce = request.body(raw).execute().body();
+		return produce;
+
+	}
+
 	public static void main(String[] args) {
+
+		if (1 == 1)
+
+			return;
 //	    data = {
 //	            "app_id": APP_ID,
 //	            "key": APP_ID,
@@ -57,8 +92,6 @@ public class CochainService {
 		data.put("app_id", APP_ID);
 		data.put("key", UUIDGenerator.uuid());
 		data.put("value", value);
-		// 请求接口地址
-		String url = "http://221.6.10.202:10119/cochain";
 		try {
 			// 使用基本编码
 			String json = JSON.toJSONString(data);
@@ -68,7 +101,7 @@ public class CochainService {
 			JSONObject content = new JSONObject();
 			content.put("content", base64encodedString);
 			content.put("signature", sha);
-			String body = HttpUtil.createPost(url).contentType("application/json").body(content.toJSONString())
+			String body = HttpUtil.createPost(COCHAIN).contentType("application/json").body(content.toJSONString())
 					.execute().body();
 			System.out.println(body);
 		} catch (Exception e) {
@@ -78,7 +111,7 @@ public class CochainService {
 
 	}
 
-	public String sendRequest(CochainLogEntity chainLog, String size) {
+	public String sendRequest(CochainLogEntity chainLog, String key, String size) {
 
 //	    data = {
 //	            "app_id": APP_ID,
@@ -105,14 +138,11 @@ public class CochainService {
 		value.put("length", size);
 		value.put("time", String.valueOf(new Date().getTime()));
 		value.put("supply", new Object());
-		String key=UUIDGenerator.uuid();
+
 		data.put("app_id", APP_ID);
-		data.put("key",key);
+		data.put("key", key);
 		chainLog.setSha1Code(key);
 		data.put("value", value);
-		// 请求接口地址
-		String url = "http://221.6.10.202:10119/cochain";
-
 		// 使用基本编码
 		String json = JSON.toJSONString(data);
 		chainLog.setReqParam(json);
@@ -122,8 +152,8 @@ public class CochainService {
 		JSONObject content = new JSONObject();
 		content.put("content", base64encodedString);
 		content.put("signature", sha);
-		String body = HttpUtil.createPost(url).contentType("application/json").body(content.toJSONString()).execute()
-				.body();
+		String body = HttpUtil.createPost(COCHAIN).contentType("application/json").body(content.toJSONString())
+				.execute().body();
 		chainLog.setResContent(body);
 		// 判断状态
 		JSONObject jsonObj = JSONObject.parseObject(body);

+ 48 - 124
eladmin-system/src/main/java/me/zhengjie/base/plus/AbstractService.java

@@ -1,12 +1,17 @@
 package me.zhengjie.base.plus;
 
+import java.lang.reflect.Field;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.ibatis.reflection.property.PropertyNamer;
+
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.LambdaUtils;
+import com.baomidou.mybatisplus.core.toolkit.support.LambdaMeta;
 import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -42,7 +47,7 @@ public interface AbstractService<T> extends IService<T> {
 	 * @throws SecurityException
 	 * @throws NoSuchFieldException
 	 */
-	default boolean update(T entity, SFunction<T, ?> column, String value) {
+	default boolean update(T entity, SFunction<T, ?> column, Object value) {
 		try {
 			UpdateWrapper<T> updateWrapper = new UpdateWrapper<>();
 			// 这里使用反射得到字段,
@@ -54,21 +59,49 @@ public interface AbstractService<T> extends IService<T> {
 		}
 		return false;
 	}
+	/**
+	 * 根据 whereEntity 条件,更新记录
+	 *
+	 * @param entity        实体对象
+	 * @param updateWrapper 实体对象封装操作类
+	 *                      {@link com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper}
+	 * @throws SecurityException
+	 * @throws NoSuchFieldException
+	 */
+	default boolean update(T entity, String column, Object value) {
+		try {
+			UpdateWrapper<T> updateWrapper = new UpdateWrapper<>();
+			updateWrapper.eq(column, value);
+			return update(entity, updateWrapper);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return false;
+	}
+	default boolean update(T entity, SFunction<T, ?> column) throws Exception {
+		// 这里是反射,通过反射来得到
+
+//		Field startRange = clazz.getDeclaredField(attribute[0]);
+//		startRange.setAccessible(true);
+//		Object val = startRange.get(obj);
+		String columnName = columnToString(column);
+		String fieldName = getFieldName(column);
+		Class<?> clazz = entity.getClass();
+		Field field = clazz.getDeclaredField(fieldName);
+		// 抑制Java对修饰符的检查
+		field.setAccessible(true);
+		Object value = field.get(entity);
+		field.set(entity, null);
+		return update(entity, columnName, value);
 
-//	default String getConditions(T entity, SFunction<T, ?> column) throws Exception {
-//		// 这里是反射,通过反射来得到
-//		try {
-//			String columnName = columnToString(column);
-//			Class<?> clazz = entity.getClass();
-//			Field field = clazz.getDeclaredField(columnName);
-//			field.setAccessible(true);
-//			TableField tableField = field.getAnnotation(TableField.class);
-//			return tableField.value();
-//		} catch (Exception e) {
-//			throw e;
-//		}
-//
-//	}
+	}
+
+	default String getFieldName(SFunction<T, ?> column) {
+		LambdaMeta meta = LambdaUtils.extract(column);
+		String fieldName = PropertyNamer.methodToProperty(meta.getImplMethodName());
+		return fieldName;
+
+	}
 
 	default boolean update(T entity, SFunction<T, ?> column, Collection<?> coll) {
 		UpdateWrapper<T> updateWrapper = new UpdateWrapper<>();
@@ -171,113 +204,4 @@ public interface AbstractService<T> extends IService<T> {
 		return null;
 	}
 
-//	/**
-//	 * 拼接查询条件
-//	 *
-//	 * @param queryWrapper 条件对象
-//	 * @param obj          数据实体
-//	 * @return void 返回参数说明
-//	 * @exception/throws
-//	 */
-//	 default QueryWrapper<T> convertQuery(T obj) {
-//
-//		QueryWrapper<T> queryWrapper = new QueryWrapper<>();
-//		Class<?> clazz = obj.getClass();
-//		try {
-//			// 反射遍历属性
-//			for (Field field : clazz.getDeclaredFields()) {
-//				// 获取属性名
-//				String fieldname = field.getName();
-//				// 抑制Java对修饰符的检查
-//				field.setAccessible(true);
-//				// 获取属性值
-//				Object fieldValue = field.get(obj);
-////            String fieldValue = getFieldValue(obj ,field.getName()).toString();
-//				TableField tableField = AnnotationUtils.getAnnotation(field, TableField.class);
-//				// 字段没有TableField这个注解和有这个主机上false的
-//				if (ObjectUtils.isEmpty(tableField) || !tableField.exist()) {
-//					continue;
-//				}
-//				String fieldName = tableField.value();
-//				// 默认是相等
-//				QueryWapper queryWapperAnnotation = AnnotationUtils.getAnnotation(field, QueryWapper.class);
-//
-//				if (ObjectUtils.isEmpty(queryWapperAnnotation)) {
-//					queryWrapper.eq(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-//				} else {
-//					// 获取枚举
-//					QueryKeyword queryWapperEnum = queryWapperAnnotation.value();
-//					// 拼接查询条件
-//					switch (queryWapperEnum) {
-//					case NE:
-//						queryWrapper.ne(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-//						break;
-//					// 这里需要,修改为集合
-//					case IN:
-//						if (fieldValue != null && fieldValue.toString().contains(",")) {
-//							List<String> result = Arrays.asList(fieldValue.toString().split(","));
-//							queryWrapper.in(!ObjectUtils.isEmpty(fieldValue), fieldName, result);
-//						}
-//						break;
-//					case GT:
-//						queryWrapper.gt(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-//						break;
-//					case GE:
-//						queryWrapper.ge(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-//						break;
-//					case LT:
-//						queryWrapper.lt(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-//						break;
-//					case LE:
-//						queryWrapper.le(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-//						break;
-//					case LIKE:
-//						queryWrapper.like(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-//						break;
-//					case NOT_LIKE:
-//						queryWrapper.notLike(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-//						break;
-//					case LIKE_LEFT:
-//						queryWrapper.likeLeft(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-//						break;
-//					case LIKE_RIGHT:
-//						queryWrapper.likeRight(!ObjectUtils.isEmpty(fieldValue), fieldName, fieldValue);
-//						break;
-//					case DESC:
-//						queryWrapper.orderByDesc(fieldName);
-//						break;
-//					case ASC:
-//						queryWrapper.orderByAsc(fieldName);
-//						break;
-//					case RANGE:
-//						// 设置开始的值和结束的值
-//						String[] attribute = queryWapperAnnotation.attribute();
-//						// 得到开始的属性值,通过反射设置属性值
-//						Field startRange = clazz.getDeclaredField(attribute[0]);
-//						startRange.setAccessible(true);
-//						Object val = startRange.get(obj);
-//						if (!ObjectUtils.isEmpty(val)) {
-//							queryWrapper.ge(fieldName, fieldValue);
-//						}
-//						// 结束的属性值,通过反射设置属性值
-//						Field endRange = clazz.getDeclaredField(attribute[1]);
-//						endRange.setAccessible(true);
-//						val = endRange.get(obj);
-//						if (!ObjectUtils.isEmpty(val)) {
-//							queryWrapper.le(fieldName, val);
-//						}
-//						break;
-//					default:
-//						break;
-//					}
-//				}
-//
-//			}
-//		} catch (Exception e) {
-//			e.printStackTrace();
-//		}
-//		return queryWrapper;
-//
-//	}
-
 }

+ 8 - 6
eladmin-system/src/main/java/me/zhengjie/base/util/CFCACertUtil.java

@@ -27,6 +27,8 @@ public class CFCACertUtil {
 	private static final String PROJECT_CODE = "004";
 	private static final String AUTH_MODE = "公安部";
 	public static boolean proxySwitchOn = false;
+	
+	
 
 	/**
 	 * 注册安心签企业用户
@@ -261,9 +263,9 @@ public class CFCACertUtil {
 	 */
 	public static String uploadSignContract(UploadSignInfoVO notaryUser, UploadSignInfoVO notaryOffice,
 			InputStream file, String fileName) throws Exception {
-		SignKeywordVO keywordNotaryUser = getSignKeywork("公证员", "70", "0", "160", "60");
+		SignKeywordVO keywordNotaryUser = getSignKeywork(Constants.signed, "70", "0", "160", "60");
 		setSignInfoDefault(notaryUser, keywordNotaryUser);
-		SignKeywordVO keywordNotaryOffice = getSignKeywork("签章", "0", "0", "150", "150");
+		SignKeywordVO keywordNotaryOffice = getSignKeywork(Constants.stamp , "0", "0", "150", "150");
 		setSignInfoDefault(notaryOffice, keywordNotaryOffice);
 
 		UploadSignInfoVO[] signInfos = { notaryUser, notaryOffice };
@@ -298,7 +300,7 @@ public class CFCACertUtil {
 	 * @throws Exception
 	 */
 	public static String uploadSignContract(UploadSignInfoVO user, InputStream file, String fileName) throws Exception {
-		SignKeywordVO keywordUser = getSignKeywork("签名:", "70", "0", "160", "60");
+		SignKeywordVO keywordUser = getSignKeywork(Constants.signed, "70", "0", "160", "60");
 		setSignInfoDefault(user, keywordUser);
 
 		UploadSignInfoVO[] signInfos = { user };
@@ -441,18 +443,18 @@ public class CFCACertUtil {
 		for (UploadSignInfoVO user : notaryUserInfos) {
 			String x = String.valueOf(10 + i * 70);
 			i++;
-			SignKeywordVO keywordNotaryUser = CFCACertUtil.getSignKeywork("signature", x, "0", "80", "40");
+			SignKeywordVO keywordNotaryUser = CFCACertUtil.getSignKeywork(Constants.signature, x, "0", "80", "40");
 			CFCACertUtil.setSignInfoDefault(user, keywordNotaryUser);
 		}
 		//公证员签名
 		if (notaryUser != null) {
-			SignKeywordVO keywordNotaryUser = getSignKeywork("signed", "70", "0", "160", "60");
+			SignKeywordVO keywordNotaryUser = getSignKeywork(Constants.signed, "70", "0", "160", "60");
 			setSignInfoDefault(notaryUser, keywordNotaryUser);
 			notaryUserInfos.add(notaryUser);
 		}
 		//盖章
 		if (seal != null) {
-			SignKeywordVO keywordNotaryOffice = getSignKeywork("签章", "0", "0", "150", "150");
+			SignKeywordVO keywordNotaryOffice = getSignKeywork(Constants.stamp, "0", "0", "150", "150");
 			setSignInfoDefault(seal, keywordNotaryOffice);
 			notaryUserInfos.add(seal);
 		}

+ 6 - 0
eladmin-system/src/main/java/me/zhengjie/base/util/Constants.java

@@ -1,6 +1,12 @@
 package me.zhengjie.base.util;
 
 public class Constants {
+	//当事人
+   public static final String signature="signature";
+   // signed 公证员签名   
+   public static final String signed="signed";
+   //盖章
+   public static final String stamp="signed"; 
 	// 文件类型
 	public enum UploadFileType {
 		BANK(9, "bank", "银行头像上传"),