Bladeren bron

修改发送短信

humuyu 2 jaren geleden
bovenliggende
commit
2494efbe35

+ 27 - 13
eladmin-system/src/main/java/me/zhengjie/application/bank/controller/BankNotarizeController.java

@@ -101,7 +101,7 @@ public class BankNotarizeController extends BaseController {
 		if (!result.isSuccess()) {
 			return result;
 		}
-	
+
 		JSONObject str = SdkTest.getFaceId(faceVerify.getBankWebankAppId(), faceVerify.getBankSecret(),
 				faceVerify.getBankKeyLicence(), userName, idCard, businessNo);
 		return ResponseDTO.success(str);
@@ -225,8 +225,9 @@ public class BankNotarizeController extends BaseController {
 		errorCode = faceEngine.unInit();
 		return ResponseDTO.success();
 	}
+
 	@RequestMapping("/isFaceCompare")
-	public ResponseDTO<?> isFaceCompare(@RequestBody String json){
+	public ResponseDTO<?> isFaceCompare(@RequestBody String json) {
 		// 这里需要先判断公证员是否在线
 		JSONObject jsonObj = JSONObject.parseObject(json);
 		String userName = jsonObj.getString("userName");
@@ -235,35 +236,48 @@ public class BankNotarizeController extends BaseController {
 		if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(idCard)) {
 			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
 		}
-		//这里是判断公证员是否在线
+		// 这里是判断公证员是否在线
 		ResponseDTO<?> result = bankNotarizeService.onlineNotary(businessNo);
-	
-		if (!result.isSuccess()) {	
+
+		if (!result.isSuccess()) {
 			// 4---开始公证(待公证) -- 2个公证员,发送短信
-		    smsTemplateService.startNotarize(businessNo);
+			smsTemplateService.startNotarize(businessNo);
 			return result;
 		}
-		//判断传入的当事人 是否做过人脸核身
+		// 判断传入的当事人 是否做过人脸核身
 		QueryWrapper<FaceCompareEntity> thirdPartyInterfaceEntityQueryWrapper = new QueryWrapper<>();
-		thirdPartyInterfaceEntityQueryWrapper.eq("name",userName).eq("id_card",idCard);
+		thirdPartyInterfaceEntityQueryWrapper.eq("name", userName).eq("id_card", idCard);
 		List<FaceCompareEntity> list = thirdPartyInterfaceRepository.getList(thirdPartyInterfaceEntityQueryWrapper);
-		if (CollectionUtil.isEmpty(list)){
+		if (CollectionUtil.isEmpty(list)) {
 			return ResponseDTO.error(ResultCode.RESULT_DATA_NONE);
 		}
 		return ResponseDTO.success();
 	}
 
+	@RequestMapping("/startNotarize")
+	public ResponseDTO<?> startNotarize(@RequestBody String json) {
+		JSONObject jsonObj = JSONObject.parseObject(json);
+		String businessNo = jsonObj.getString("businessNo");
+		if (StringUtils.isEmpty(businessNo)) {
+			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
+		}
+		// 4---开始公证(待公证) -- 2个公证员,发送短信
+		smsTemplateService.startNotarize(businessNo);
+		return ResponseDTO.success();
+	}
 
 	/**
 	 * 银行客户经理的人脸照片比对
+	 * 
 	 * @param compareImageVo
 	 * @return
 	 */
-	//@RequestMapping("/face-compare")
+	// @RequestMapping("/face-compare")
 	@AnonymousPostMapping("/face-compare")
-	public ResponseDTO<?> faceCompare(@RequestBody CompareImageVo compareImageVo){
-		ResponseDTO<?> result = bankNotarizeService.appFaceCompare(BeanCopyUtils.convertObj(compareImageVo, CompareImageDto.class));
-	 
+	public ResponseDTO<?> faceCompare(@RequestBody CompareImageVo compareImageVo) {
+		ResponseDTO<?> result = bankNotarizeService
+				.appFaceCompare(BeanCopyUtils.convertObj(compareImageVo, CompareImageDto.class));
+
 		return result;
 	}
 }

+ 17 - 8
eladmin-system/src/main/java/me/zhengjie/base/chain/CochainService.java

@@ -5,6 +5,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import com.alibaba.fastjson.JSON;
@@ -16,6 +17,7 @@ import cn.hutool.crypto.digest.HmacAlgorithm;
 import cn.hutool.http.HttpRequest;
 import cn.hutool.http.HttpUtil;
 import lombok.extern.slf4j.Slf4j;
+import me.zhengjie.application.admin.service.DictDetailService;
 import me.zhengjie.base.util.UUIDGenerator;
 
 import me.zhengjie.dao.mybatis.entity.OrderCochainEntity;
@@ -25,28 +27,35 @@ import me.zhengjie.dao.mybatis.entity.OrderCochainEntity;
 public class CochainService {
 	// 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";
+	@Autowired
+	DictDetailService dictDetailService;
 
-	public static final String COCHAIN = "http://221.6.10.202:8051/cochain";
+	public static String APP_ID;
+	public static String APP_SECRET;
+	public static String PRODUCE;
+
+	public static String COCHAIN;
+
+	public String sha1_HMAC(String message) {
 
-	public static String sha1_HMAC(String message) {
 		HMac mac = new HMac(HmacAlgorithm.HmacSHA1, APP_SECRET.getBytes());
 		String macHex1 = mac.digestHex(message);
 		return macHex1;
 	}
 
 	public String getKey(String taskId) {
+		Map<String, String> dictMap = dictDetailService.getValueByName("cochain");
+		PRODUCE = dictMap.get("produce");
+		APP_SECRET = dictMap.get("app_secret");
+		APP_ID = dictMap.get("app_id");
+		COCHAIN = dictMap.get("cochain_url");
 		Map<String, String> params = new HashMap<>();
 		params.put("app_id", APP_ID);
 		params.put("task_id", taskId);
 		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);
@@ -94,7 +103,7 @@ public class CochainService {
 			String json = JSON.toJSONString(data);
 			String base64encodedString = Base64.encode(json);
 			System.out.println("Base64 编码字符串(基本):" + base64encodedString);
-			String sha = sha1_HMAC(base64encodedString);
+			String sha = "";// sha1_HMAC(base64encodedString);
 			JSONObject content = new JSONObject();
 			content.put("content", base64encodedString);
 			content.put("signature", sha);

+ 0 - 2
eladmin-system/src/main/java/me/zhengjie/domain/notary/impl/NotaryDomainImpl.java

@@ -132,8 +132,6 @@ public class NotaryDomainImpl implements NotaryDomain {
                 if (ObjectUtil.isNotEmpty(base)){
                     base.delete();
                 }
-            	// 4---开始公证(待公证) -- 2个公证员,发送短信
-    		    smsTemplateService.startNotarize(businessNo);
                 return ResultCode.SUCCESS;
             }
             if (ObjectUtil.isNotEmpty(base)){

+ 4 - 0
eladmin-system/src/main/resources/config/application-xz.yml

@@ -184,6 +184,10 @@ tencent:
   ttlsig:
     sdkappid: 1400743315
     key: 3b8f5b1a04511a8e9f40a90b61bc8312452226416c5e533e81cbbf52e9b0e351
+baidu:
+  account:
+    apiKey: OeKT7rg9AH0qPrfp8kulMzNu
+    secretKey: GNcPCbtLPTDFzZIVPcC6IGSbfEkzXKNG    
 xxl:
   job:
     accessToken: Easd123%&$@#kllsdfPO[JasdfF