Просмотр исходного кода

Merge remote-tracking branch 'origin/branch-nt-2022-12-27' into branch-nt-2022-12-27

tongfeng 2 лет назад
Родитель
Сommit
a5ae1010db

+ 1 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/AdminOrderController.java

@@ -253,4 +253,5 @@ public class AdminOrderController {
 		return adminOrderService.faceCompare(BeanCopyUtils.convertObj(compareImageVo, CompareImageDto.class));
 	}
 
+
 }

+ 6 - 1
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/vo/NotaryOrderQueryReq.java

@@ -88,5 +88,10 @@ public class NotaryOrderQueryReq extends BaseRequest {
 	private String notaryUserName;
 	//当事人
 	private String name;
-	
+
+	//签发开始时间
+	private String issuedStartDate;
+	//签发结束时间
+	private String issuedEndDate;
+
 }

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

@@ -161,6 +161,8 @@ public class AdminOrderServiceImpl implements AdminOrderService {
         JSONObject json = new JSONObject();
         json.put("startDate", req.getStartDate());
         json.put("endDate", req.getEndDate());
+        json.put("issuedStartDate",req.getIssuedStartDate());
+        json.put("issuedEndDate",req.getIssuedEndDate());
         // 清楚
 
         order.setStartDate("");
@@ -180,6 +182,13 @@ public class AdminOrderServiceImpl implements AdminOrderService {
         } else {
             return null;
         }
+        if (org.apache.commons.lang3.StringUtils.isNotBlank(req.getIssuedStartDate())){
+            qw.ge("issued_time",req.getIssuedStartDate());
+        }else if(org.apache.commons.lang3.StringUtils.isNotBlank(req.getIssuedEndDate())){
+            qw.le("issued_time",req.getIssuedEndDate());
+        }else {
+            return null;
+        }
 
         return qw;
     }

+ 11 - 2
eladmin-system/src/main/java/me/zhengjie/base/file/AbstractFileHandle.java

@@ -11,18 +11,27 @@ import me.zhengjie.base.util.FileUploadUtil;
 public abstract class AbstractFileHandle implements FileHandle, ApplicationContextAware {
 
 	//图片预览
-	@Value("${app.minio.preview}")
+	@Value("${app.minio.preview:https://fqgz.flowbb.cn}")
 	protected String appMinioPreview;
 
+	private static final String APPMINIOPREVIEW = "https://fqgz.flowbb.cn";
+
 	ApplicationContext applicationContext;
 
 	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
 		this.applicationContext = applicationContext;
 		// 设置应用
-		FileHandle fileHandle = applicationContext.getBean(FileHandle.class);
+		FileHandle fileHandle=null;
+		if (APPMINIOPREVIEW.equals(appMinioPreview)){
+			fileHandle = applicationContext.getBean(FaceMinioFileHandle.class);
+		}else {
+			fileHandle = applicationContext.getBean(MinioFileHandle.class);
+		}
+
 		FileUploadUtil.setFileHandle(fileHandle);
 	}
 	/**
+	/**
 	 * 对图片预览的统一处理
 	 * @param keyName
 	 * @return

+ 0 - 2
eladmin-system/src/main/java/me/zhengjie/base/plus/QueryWrapperUtil.java

@@ -145,7 +145,6 @@ public class QueryWrapperUtil {
 //							Field startRange = clazz.getDeclaredField(attribute[0]);
 //							startRange.setAccessible(true);
 //							Object val = startRange.get(obj);
-
 							// 结束的属性值,通过反射设置属性值
 							String endRange = attribute[1];
 							getMethod = getMethod(endRange);
@@ -164,7 +163,6 @@ public class QueryWrapperUtil {
 							if (!ObjectUtils.isEmpty(val)) {
 								queryWrapper.ge(fieldName, val);
 							}
-
 							// 然后通过参数查询
 							val = param.get(attribute[1]);
 							if (!ObjectUtils.isEmpty(val)) {

+ 20 - 4
eladmin-system/src/main/java/me/zhengjie/dao/mybatis/ContractOrderRepository.java

@@ -195,11 +195,11 @@ public class ContractOrderRepository {
                 "o.business_no=f.business_no and f.code=10 ";
 
         if (!TextUtils.isEmpty(req.getStartDate())) {
-            sql += "and o.issued_time>= ? ";
+            sql += "and o.create_time>= ? ";
             mList.add(req.getStartDate());
         }
         if (!TextUtils.isEmpty(req.getEndDate())) {
-            sql += "and o.issued_time <=? ";
+            sql += "and o.create_time <=? ";
             mList.add(req.getEndDate());
         }
         if (!TextUtils.isEmpty(req.getIdCard())) {
@@ -234,6 +234,14 @@ public class ContractOrderRepository {
             sql += "and o.prod_id =? ";
             mList.add(req.getProdId());
         }
+        if (!TextUtils.isEmpty(req.getIssuedStartDate())) {
+            sql += "and o.issued_time>= ? ";
+            mList.add(req.getIssuedStartDate());
+        }
+        if (!TextUtils.isEmpty(req.getIssuedEndDate())) {
+            sql += "and o.issued_time <=? ";
+            mList.add(req.getIssuedEndDate());
+        }
         sql += "ORDER BY o.issued_time desc";
         Object[] arr = mList.toArray();
         List<Map<String, String>> query = jdbcTemplate.query(sql, arr, new RowMapper<Map<String, String>>() {
@@ -283,13 +291,21 @@ public class ContractOrderRepository {
                 "from contract_order o,order_file f  where o.status=3 and " +
                 "o.business_no=f.business_no and f.code=10 ";
         if (!TextUtils.isEmpty(req.getStartDate())) {
-            sql += "and o.issued_time>= ? ";
+            sql += "and o.create_time>= ? ";
             mList.add(req.getStartDate());
         }
         if (!TextUtils.isEmpty(req.getEndDate())) {
-            sql += "and o.issued_time <=?";
+            sql += "and o.create_time <=?";
             mList.add(req.getEndDate());
         }
+        if (!TextUtils.isEmpty(req.getIssuedStartDate())) {
+            sql += "and o.issued_time>= ? ";
+            mList.add(req.getIssuedStartDate());
+        }
+        if (!TextUtils.isEmpty(req.getIssuedEndDate())) {
+            sql += "and o.issued_time <=?";
+            mList.add(req.getIssuedEndDate());
+        }
         if (!TextUtils.isEmpty(req.getIdCard())) {
             sql += "and o.id_card LIKE ? ";
             mList.add("%"+req.getIdCard()+"%");

+ 1 - 0
eladmin-system/src/main/java/me/zhengjie/dao/mybatis/entity/ContractOrderEntity.java

@@ -168,6 +168,7 @@ public class ContractOrderEntity implements Serializable {
 
     @TableField("creator")
     private String creator;
+
     @QueryWapper(value = {QueryKeyword.RANGE,QueryKeyword.DESC}, attribute = { "startDate", "endDate" })
     @TableField(value="create_time", fill = FieldFill.INSERT)
     private Date createTime;

+ 18 - 35
eladmin-system/src/main/java/me/zhengjie/domain/notary/impl/NotaryDomainImpl.java

@@ -8,6 +8,7 @@ import com.arcsoft.face.toolkit.ImageInfo;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.base.ResultCode;
+import me.zhengjie.base.file.FaceMinioFileHandle;
 import me.zhengjie.base.file.FileHandleVo;
 import me.zhengjie.base.file.MinioFileHandle;
 import me.zhengjie.base.util.JuheServiceUtil;
@@ -18,22 +19,16 @@ import me.zhengjie.dao.mybatis.entity.UserAXQInfoEntity;
 import me.zhengjie.dao.mybatis.mapper.FileInfoMapper;
 import me.zhengjie.dao.mybatis.mapper.SysUserMapper;
 import me.zhengjie.dao.mybatis.mapper.UserAXQInfoMapper;
-import me.zhengjie.domain.Jvhe.JuheDomain;
-import me.zhengjie.domain.Jvhe.ResultDomain;
 import me.zhengjie.domain.img.CompareImageDomain;
 import me.zhengjie.domain.notary.NotaryDomain;
-import me.zhengjie.sign.converter.JsonObjectMapper;
 import me.zhengjie.utils.RedisUtils;
 import org.springframework.stereotype.Component;
 import org.springframework.util.ObjectUtils;
 
 import java.io.File;
 import java.io.IOException;
-import java.math.BigDecimal;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 import static com.arcsoft.face.toolkit.ImageFactory.getRGBData;
@@ -44,13 +39,18 @@ public class NotaryDomainImpl implements NotaryDomain {
 
     private final SysUserMapper userMapper;
     private final UserAXQInfoMapper userAXQInfoMapper;
-    private final MinioFileHandle minioFileHandle;
+    private final FaceMinioFileHandle minioFileHandle;
     private final FileInfoMapper fileInfoMapper;
     private final RedisUtils redis;
-    private static final String APPID = "6F5JVsCCeSEbBSLSXWVwPki71yK5Y4Jf7oUjA4Y3mLtu";
-    private static final String SDKKEY = "5qKM4a9oNSXNhXdwd7Ycrvnxdw2JXjcyeccYmb4zND7S";
-    private static final String LIBPATH = "/home/tom/nt-test/lib/so";
-    //private static final String LIBPATH = "D:\\arcsoft_lib";
+    //以下为测试部署环境
+//    private static final String APPID = "6F5JVsCCeSEbBSLSXWVwPki71yK5Y4Jf7oUjA4Y3mLtu";
+//    private static final String SDKKEY = "5qKM4a9oNSXNhXdwd7Ycrvnxdw2JXjcyeccYmb4zND7S";
+//    private static final String LIBPATH = "/home/tom/nt-test/lib/so";
+
+    //以下为本地测试
+    private static final String APPID = "H6Er8ksqAcKc7Dk4Yum9Rkz4g9Gm77ZXAEMgvenjkTQQ";
+    private static final String SDKKEY = "Abd9D8xZQUqG8vDtU2a1tEkdfThkK1tZppjXzydGwEd6";
+    private static final String LIBPATH = "D:\\arcsoft_lib";
 
     /**
      * 照片比对
@@ -157,25 +157,10 @@ public class NotaryDomainImpl implements NotaryDomain {
         if (!ObjectUtils.isEmpty(userAXQInfoEntity)) {
             id = userAXQInfoEntity.getCompareImgId();
         }
-        Integer fileId = compareImage(base, id,redisCount,count);
-        if (fileId == null) {
+        if (! compareImage(base, id,redisCount,count)) {
             System.err.println("人脸比对失败");
             return ResultCode.LIVE_VIDEO_INVALID;
         }
-        if (!ObjectUtils.isEmpty(sysUserEntity)) {
-            SysUserEntity user = new SysUserEntity();
-            user.setUserId(sysUserEntity.getUserId());
-            user.setCompareImgId(fileId);
-            userMapper.updateById(user);
-            System.err.println("客户经理认证成功");
-        }
-        if (!ObjectUtils.isEmpty(userAXQInfoEntity)) {
-            UserAXQInfoEntity user = new UserAXQInfoEntity();
-            user.setId(userAXQInfoEntity.getId());
-            user.setCompareImgId(fileId);
-            userAXQInfoMapper.updateById(user);
-            System.err.println("当事人认证成功");
-        }
         if (count != null) {
             redis.del(redisCount);
         }
@@ -190,7 +175,7 @@ public class NotaryDomainImpl implements NotaryDomain {
      * @param count redis当中的次数
      * @return
      */
-    public Integer compareImage(File base, Integer id,String redisCount,Integer count) {
+    public boolean compareImage(File base, Integer id,String redisCount,Integer count) {
         //从官网获取
         FaceEngine faceEngine = new FaceEngine(LIBPATH);
         //激活引擎
@@ -243,7 +228,7 @@ public class NotaryDomainImpl implements NotaryDomain {
         if (pitch > 10 || yaw > 10) {
             //照片不符合标准
             System.err.println("图片不符合标准");
-            return null;
+            return false;
         }
         //特征提取
         FaceFeature faceFeature = new FaceFeature();
@@ -277,9 +262,7 @@ public class NotaryDomainImpl implements NotaryDomain {
         if (faceSimilar.getScore() > 0.8) {
             FileInfoEntity fileInfo = saveCompareImage(base);
             fileInfoMapper.insert(fileInfo);
-            return fileInfo.getId();
-        }else {
-            System.out.println("特征值不符合");
+            return true;
         }
         if (count == null) {
             redis.set(redisCount, 1, 30, TimeUnit.MINUTES);
@@ -287,13 +270,13 @@ public class NotaryDomainImpl implements NotaryDomain {
             redis.set(redisCount, count + 1, 30, TimeUnit.MINUTES);
         }
         System.err.println("人脸照片比对未通过");
-        return null;
+        return false;
     }
 
     private FileInfoEntity saveCompareImage(File base) {
         FileHandleVo fileHandleVo = new FileHandleVo();
         fileHandleVo.setFilePath(base.getPath());
-        fileHandleVo.setSourceFilePath("/compareImage/" + base.getName());
+        fileHandleVo.setSourceFilePath("/face/" + base.getName());
         fileHandleVo.setContentType("JPEG");
         try {
             minioFileHandle.uploadfilePath(fileHandleVo);
@@ -301,7 +284,7 @@ public class NotaryDomainImpl implements NotaryDomain {
             throw new RuntimeException("照片保存到minio异常");
         }
         FileInfoEntity fileInfo = new FileInfoEntity();
-        fileInfo.setLoanNo("compareImage");
+        fileInfo.setLoanNo("face");
         fileInfo.setFileName(base.getName());
         fileInfo.setPath(fileInfo.getLoanNo() + "/" + base.getName());
         return fileInfo;