Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/feature-2022.07.29' into feature-2022.07.29

sakuya 3 rokov pred
rodič
commit
b2a3c6a2cb

+ 62 - 117
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/TencentPushController.java

@@ -34,11 +34,14 @@ public class TencentPushController {
 	@ResponseBody
 	public Map<String, Object> tencentpush(@RequestBody Map<String, String> json) throws Exception {
 
+		log.info("推送信息:" + JSON.toJSON(json));
+
 		String channelId = json.get("channel_id");
 
-		Map<String, String> map = split(json.get("stream_param"));
 		if (channelId.contains("share")) {
+			log.info("pc端的推送信息:" + JSON.toJSON(json));
 			// 转成json形式
+			Map<String, String> map = split(json.get("stream_param"));
 			String fileId = (String) json.get("file_id");
 			PushDataEntity pushData = new PushDataEntity();
 			pushData.setFileId(fileId);
@@ -47,7 +50,6 @@ public class TencentPushController {
 			pushData.setData(JSON.toJSONString(json));
 			pushData.setPath(json.get("video_url"));
 			pushDataMapper.insert(pushData);
-			log.info("pc端的推送信息:" + JSON.toJSON(json));
 			// 文件fileId
 			String roomId = map.get("groupid");
 			QueryWrapper<OrderRoomIdEntity> orderRoomQuery = new QueryWrapper<>();
@@ -68,6 +70,8 @@ public class TencentPushController {
 			}
 		}
 		if (channelId.contains("aux")) {
+			log.info("app的视频推送:" + JSON.toJSON(json));
+			Map<String, String> map = split(json.get("stream_param"));
 			// 转成json形式
 			String fileId = (String) json.get("file_id");
 			PushDataEntity pushData = new PushDataEntity();
@@ -77,7 +81,7 @@ public class TencentPushController {
 			pushData.setData(JSON.toJSONString(json));
 			pushData.setPath(json.get("video_url"));
 			pushDataMapper.insert(pushData);
-			log.info("app的视频推送:" + JSON.toJSON(json));
+
 			// 文件fileId
 			String roomId = map.get("groupid");
 			QueryWrapper<OrderRoomIdEntity> orderRoomQuery = new QueryWrapper<>();
@@ -103,126 +107,67 @@ public class TencentPushController {
 		return result;
 	}
 
-//	@AnonymousPostMapping("/apppush")
+	@AnonymousPostMapping("/nt")
 	@ResponseBody
-	public Map<String, Object> apppush(@RequestBody JSONObject json) throws Exception {
+	public Map<String, Object> nt(@RequestBody JSONObject json) throws Exception {
 		Object data = JSON.toJSON(json);
-		log.info("app的视频推送start######################################################################################");
-		log.info("app的视频推送:" + data);
-		log.info("app的视频推送end########################################################################################");
-		// pushData.set
-		String eventType = json.getString("EventType");
-		if (eventType != null && eventType.equalsIgnoreCase("ProcedureStateChanged")) {
-			JSONObject procedureState = json.getJSONObject("ProcedureStateChangeEvent");
-			if (procedureState != null) {
-				JSONArray mediaProcess = procedureState.getJSONArray("MediaProcessResultSet");
-
-				for (int i = 0; i < mediaProcess.size(); i++) {
-					JSONObject map = mediaProcess.getJSONObject(i);
-					if (map.get("Type") != null && map.getString("Type").equalsIgnoreCase("Transcode")) {
-						JSONObject videoUrl = map.getJSONObject("TranscodeTask").getJSONObject("Output");
-						// 通过id查询房间号码
-						String fileId = procedureState.getString("FileId");
-						QueryWrapper<PushDataEntity> query = new QueryWrapper<>();
-						query.eq("file_id", fileId);
-						query.eq("push_type", "app");
-						query.eq("type_name", "live");
-						List<PushDataEntity> file = pushDataMapper.selectList(query);
-						if (file != null && file.size() > 0) {
-							String pushData = file.get(0).getData();
-							JSONObject jsonObj = JSONObject.parseObject(pushData);
-							String streamParam = jsonObj.getString("stream_param");
-							Map<String, String> param = split(streamParam);
-							String roomId = param.get("roomId");
-							OrderRoomIdEntity orderRoomId = new OrderRoomIdEntity();
-							orderRoomId.setAppFileId(fileId);
-
-							String filePath = orderRoomId.getBusinessNo() + "/";
-							String fileName = filePath + "/APP" + fileId + ".mp4";
-							DownloadUtils.downloadFile(videoUrl.get("Url").toString(), fileName);
-							orderRoomId.setAppVideoUrl(fileName);
-							//
-							UpdateWrapper<OrderRoomIdEntity> updateQw = new UpdateWrapper<>();
-							updateQw.eq("roomId", roomId);
-							orderRoomIdMapper.update(orderRoomId, updateQw);
-							PushDataEntity pushDataEntity = new PushDataEntity();
-							pushDataEntity.setFileId(fileId);
-							pushDataEntity.setPushType("app");
-							pushDataEntity.setData(JSON.toJSONString(json));
-							pushDataEntity.setPath(videoUrl.get("Url").toString());
-							pushDataEntity.setTypeName("ProcedureStateChangeEvent");
-							pushDataMapper.insert(pushDataEntity);
-						} else {
-							Map<String, Object> result = new HashMap<>();
-							result.put("success", false);
-							result.put("code", 100);
-							return result;
-						}
-					}
-				}
-			}
-		} else if (eventType != null && eventType.equalsIgnoreCase("NewFileUpload")) {
-			// FileUploadEvent
-			JSONObject jsonObject = json.getJSONObject("FileUploadEvent");
-			String fileId = jsonObject.getString("FileId");
-			JSONObject mediaBasicInfo = jsonObject.getJSONObject("MediaBasicInfo");
-			String path = mediaBasicInfo.getString("MediaUrl");
-			// 这里判断
-			String name = mediaBasicInfo.getString("Name");
-			if (name.contains("aux")) {
-				JSONObject sourceInfo = mediaBasicInfo.getJSONObject("SourceInfo");
-				String sourceContext = sourceInfo.getString("SourceContext");
-				Map<String, String> map = split(sourceContext);
-				String roomId = map.get("groupid");
-				QueryWrapper<OrderRoomIdEntity> orderRoomQuery = new QueryWrapper<>();
-				orderRoomQuery.eq("roomId", roomId);
-				orderRoomQuery.orderByDesc("create_time");
-				List<OrderRoomIdEntity> orderRoomId = orderRoomIdMapper.selectList(orderRoomQuery);
+		log.info("############################推送信息[start]##############################################");
+		log.info("推送信息:" + JSON.toJSON(data));
+		log.info("############################推送信息[end]##############################################");
+
+		JSONObject jsonObj = json.getJSONObject("EventInfo");
+		String roomId = jsonObj.getString("RoomId");
+		jsonObj = jsonObj.getJSONObject("Payload");
+
+		jsonObj = jsonObj.getJSONObject("TencentVod");
+		if (jsonObj == null) {
+			Map<String, Object> result = new HashMap<>();
+			result.put("success", false);
+			result.put("msg", "视频不完整");
+			result.put("code", 201);
+			return result;
+		}
+		String mediaId = jsonObj.getString("MediaId");
 
-				if (orderRoomId != null && orderRoomId.size() > 0) {
-					OrderRoomIdEntity orderRoomIdEntity = orderRoomId.get(0);
+		String fileId = jsonObj.getString("FileId");
+		String videoUrl = jsonObj.getString("VideoUrl");
 
-					String filePath = orderRoomIdEntity.getBusinessNo() + "/";
-					String fileName = filePath + "/APP" + fileId + ".mp4";
-					DownloadUtils.downloadFile(path, fileName);
-					OrderRoomIdEntity update = new OrderRoomIdEntity();
-					update.setPcFileId(fileId);
-					update.setAppVideoUrl(fileName);
-					update.setId(orderRoomIdEntity.getId());
-					orderRoomIdMapper.updateById(update);
-				}
+		String userId = jsonObj.getString("UserId");
+		// app的推送
+		if (mediaId.contains("aux")) {
+			QueryWrapper<OrderRoomIdEntity> orderRoomQuery = new QueryWrapper<>();
+			orderRoomQuery.eq("roomId", roomId);
+			orderRoomQuery.orderByDesc("create_time");
+			List<OrderRoomIdEntity> orderRoomId = orderRoomIdMapper.selectList(orderRoomQuery);
+			// 这里通过订单查询相关信息
+			if (orderRoomId != null && orderRoomId.size() > 0) {
+				OrderRoomIdEntity orderRoomIdEntity = orderRoomId.get(0);
+				String filePath = orderRoomIdEntity.getBusinessNo();
+				String fileName = filePath + "/APP" + fileId + ".mp4";
+				DownloadUtils.downloadFile(videoUrl, fileName);
+				OrderRoomIdEntity update = new OrderRoomIdEntity();
+				update.setAppFileId(fileId);
+				update.setAppVideoUrl(fileName);
+				update.setId(orderRoomIdEntity.getId());
+				orderRoomIdMapper.updateById(update);
 			}
-
-			PushDataEntity PushDataEntity = new PushDataEntity();
-			PushDataEntity.setFileId(fileId);
-			PushDataEntity.setTypeName(eventType);
-			PushDataEntity.setPushType("app");
-			PushDataEntity.setData(JSON.toJSONString(json));
-			PushDataEntity.setPath(path);
-			PushDataEntity.setTypeName(eventType);
-			pushDataMapper.insert(PushDataEntity);
-			// 保存推送过来的视频
-
-		} else {
-			// 处理"appname": "live",
-			String live = json.getString("appname");
-			if (live.equalsIgnoreCase("live")) {
-				PushDataEntity pushDataEntity = new PushDataEntity();
-				pushDataEntity.setFileId(json.getString("file_id"));
-				pushDataEntity.setPushType("app");
-				pushDataEntity.setData(JSON.toJSONString(json));
-				pushDataEntity.setPath(json.getString("video_url"));
-				pushDataEntity.setTypeName(json.getString("appname"));
-				pushDataMapper.insert(pushDataEntity);
-			} else {
-				PushDataEntity pushDataEntity = new PushDataEntity();
-				pushDataEntity.setFileId("");
-				pushDataEntity.setPushType("app");
-				pushDataEntity.setData(JSON.toJSONString(json));
-				pushDataEntity.setPath("");
-				pushDataMapper.insert(pushDataEntity);
+		} else if (userId.contains("share")) {
+			QueryWrapper<OrderRoomIdEntity> orderRoomQuery = new QueryWrapper<>();
+			orderRoomQuery.eq("roomId", roomId);
+			orderRoomQuery.orderByDesc("create_time");
+			List<OrderRoomIdEntity> orderRoomId = orderRoomIdMapper.selectList(orderRoomQuery);
+			// 这里通过订单查询相关信息
+			if (orderRoomId != null && orderRoomId.size() > 0) {
+				OrderRoomIdEntity orderRoomIdEntity = orderRoomId.get(0);
+				String filePath = orderRoomIdEntity.getBusinessNo();
+				String fileName = filePath + "/PC" + fileId + ".mp4";
+				DownloadUtils.downloadFile(videoUrl, fileName);
+				OrderRoomIdEntity update = new OrderRoomIdEntity();
+				update.setPcFileId(fileId);
+				update.setPcVideoUrl(fileName);
+				update.setId(orderRoomIdEntity.getId());
+				orderRoomIdMapper.updateById(update);
 			}
-
 		}
 		Map<String, Object> result = new HashMap<>();
 		result.put("success", true);

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

@@ -429,6 +429,8 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 		// 流程走完之后需要把数据插入到order_cochain
 		OrderCochainEntity orderCochain = new OrderCochainEntity();
 		orderCochain.setStatus("0");
+		//设置次数为0
+		orderCochain.setCount(0);
 		orderCochain.setBusinessNo(businessNo);
 		orderCochain.setCreateTime(LocalDateTime.now());
 		orderCochain.setUpdateTime(LocalDateTime.now());

+ 45 - 22
eladmin-system/src/main/java/me/zhengjie/application/bank/service/impl/UserAXQInfoServiceImpl.java

@@ -162,40 +162,64 @@ public class UserAXQInfoServiceImpl implements UserAXQInfoService {
 	}
 
 	/**
-	 * 公证文书签名
+	 * 公证文书签名,pdf合并,
 	 *
 	 * @param signInfoList
 	 * @param businessNo
 	 * @throws Exception
 	 */
-	private void signContract(List<UploadSignInfoVO> signInfoList, String businessNo) throws Exception {
-		String[] codes = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
-		List<OrderFileEntity> orderFileList = orderFileRepository.getOrderFileListWithCodes(businessNo, codes);
-		// 取出所有的二进制流
-		List<InputStream> list = new ArrayList<>();
-		String fileName = "";
-		for (OrderFileEntity orderFile : orderFileList) {
-			if(StringUtils.isNotBlank(fileName)) {
-				fileName = FileUploadUtil.getFileName(orderFile.getPdfUrl());
-			}
-			InputStream inputStream = FileUploadUtil.getInputStream(orderFile.getPdfUrl());
-			list.add(inputStream);
-		}
-		byte[] b = PdfUtils.mergePdf(list);
-		//将所有需要签名的pdf进行合并
-		InputStream input = new ByteArrayInputStream(b);
-		String axqContractNo = CFCACertUtil.uploadMultiSignContract(signInfoList, null, null, input, fileName);
-		String path = businessNo + "/signed-doc/";
-		String filePath = CFCACertUtil.download(path, axqContractNo);
+//	private void signContract(List<UploadSignInfoVO> signInfoList, String businessNo) throws Exception {
+//		String[] codes = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+//		List<OrderFileEntity> orderFileList = orderFileRepository.getOrderFileListWithCodes(businessNo, codes);
+//		// 取出所有的二进制流
+//		List<InputStream> list = new ArrayList<>();
+//		String fileName = "";
+//		for (OrderFileEntity orderFile : orderFileList) {
+//			if(StringUtils.isNotBlank(fileName)) {
+//				fileName = FileUploadUtil.getFileName(orderFile.getPdfUrl());
+//			}
+//			InputStream inputStream = FileUploadUtil.getInputStream(orderFile.getPdfUrl());
+//			list.add(inputStream);
+//		}
+//		byte[] b = PdfUtils.mergePdf(list);
+//		//将所有需要签名的pdf进行合并
+//		InputStream input = new ByteArrayInputStream(b);
+//		String axqContractNo = CFCACertUtil.uploadMultiSignContract(signInfoList, null, null, input, fileName);
+//		String path = businessNo + "/signed-doc/";
+//		String filePath = CFCACertUtil.download(path, axqContractNo);
+//		for (OrderFileEntity orderFile : orderFileList) {
+//			OrderFileEntity updateOrderFile = new OrderFileEntity();
+//			updateOrderFile.setId(orderFile.getId());
+//			updateOrderFile.setUpdateTime(new Date());
+//			updateOrderFile.setUpdaterId(-1l);
+//			try {
+//				updateOrderFile.setAxqContractNo(axqContractNo);
+//				updateOrderFile.setAxqSignedTime(new Date());
+//				//设置签名的pdf
+//				updateOrderFile.setSignedPdfUrl(filePath);
+//			} catch (Exception e) {
+//				e.printStackTrace();
+//			}
+//			orderFileMapper.updateById(updateOrderFile);
+//		}
+//	}
+	private void signContract(List<UploadSignInfoVO> signInfoList, String businessNo) {
+		List<OrderFileEntity> orderFileList = orderFileRepository.getOrderFileListWithCodes(businessNo, "1,2,3,4,5,6,7,8,9".split(","));
+		CFCACertUtil.proxySwitchOn = "dev".equals(systemEnv);
 		for (OrderFileEntity orderFile : orderFileList) {
+			String path = businessNo + "/signed-doc-" + orderFile.getId() + "/";
 			OrderFileEntity updateOrderFile = new OrderFileEntity();
 			updateOrderFile.setId(orderFile.getId());
 			updateOrderFile.setUpdateTime(new Date());
 			updateOrderFile.setUpdaterId(-1l);
 			try {
+				InputStream inputStream = FileUploadUtil.getInputStream(orderFile.getPdfUrl());
+				String fileName = FileUploadUtil.getFileName(orderFile.getPdfUrl());
+				String axqContractNo = CFCACertUtil.uploadMultiSignContract(signInfoList, null, null, inputStream, fileName);
 				updateOrderFile.setAxqContractNo(axqContractNo);
 				updateOrderFile.setAxqSignedTime(new Date());
-				//设置签名的pdf
+				//
+				String filePath = CFCACertUtil.download(path, axqContractNo);
 				updateOrderFile.setSignedPdfUrl(filePath);
 			} catch (Exception e) {
 				e.printStackTrace();
@@ -203,7 +227,6 @@ public class UserAXQInfoServiceImpl implements UserAXQInfoService {
 			orderFileMapper.updateById(updateOrderFile);
 		}
 	}
-
 	@Override
 	public ResponseDTO<?> getAuthStatus(String idCard) {
 		QueryWrapper<UserAXQInfoEntity> userQw = new QueryWrapper<>();

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

@@ -134,8 +134,8 @@ public class MinioFileHandle extends AbstractFileHandle {
 			if (!uploadPath.endsWith("/")) {
 				uploadPath = uploadPath + "/";
 			}
-			filePath = uploadPath + filePath;
-			FileUtils.writeByteArrayToFile(new File(filePath), b);
+			String transferFilePath = uploadPath + filePath;
+			FileUtils.writeByteArrayToFile(new File(transferFilePath), b);
 			return appMinioPreview + filePath;
 		} catch (Exception e) {
 			log.error("图片预览失败:" + e.getLocalizedMessage());

+ 1 - 1
eladmin-system/src/main/resources/config/application-nt.yml

@@ -168,7 +168,7 @@ app:
     secretkey: ntgzc123@!p
     url: http://127.0.0.1:9000
     bucketName: fqgz
-    preview: https://fqgz.ntgzc.com
+    preview: https://fqgz.ntgzc.com/image/
 tencent:
   client:
     webankAppId: TIDAdW8e