Merge remote-tracking branch 'origin/cc_20230520_partner' into cc_20230520_partner
This commit is contained in:
@@ -7,6 +7,7 @@ import com.cool.store.dto.enterprise.AuthScopeDTO;
|
||||
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||
import com.cool.store.dto.enterprise.SysDepartmentDTO;
|
||||
import com.cool.store.dto.login.UserIdInfoDTO;
|
||||
import com.cool.store.dto.message.SendCardMessageDTO;
|
||||
import com.cool.store.dto.response.ResultDTO;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
@@ -17,6 +18,7 @@ import com.cool.store.utils.RestTemplateUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -311,4 +313,23 @@ public class ISVHttpRequest {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送飞书卡片消息
|
||||
* @param param
|
||||
*/
|
||||
public void sendFeiShuCardMessage(SendCardMessageDTO param) throws ApiException{
|
||||
if(CollectionUtils.isEmpty(param.getUserIds()) || StringUtils.isAnyBlank(param.getTitle(), param.getContent(), param.getMessageUrl()) || Objects.isNull(param.getMessageType())){
|
||||
return;
|
||||
}
|
||||
String url = isvDomain + "/sendFeiShuCardMessage";
|
||||
ResultDTO responseEntity = null;
|
||||
try {
|
||||
responseEntity = httpRestTemplateService.postForObject(url, param, ResultDTO.class);
|
||||
log.info("url:{}, response:{}", url, JSONObject.toJSONString(responseEntity));
|
||||
} catch (Exception e) {
|
||||
log.info("调用isv出错{}", e);
|
||||
throw new ApiException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.cool.store.mq;
|
||||
|
||||
|
||||
import com.aliyun.openservices.ons.api.Constants;
|
||||
import com.aliyun.openservices.ons.api.Message;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.AfterReturning;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 切面处理类,操作日志异常日志记录处理
|
||||
* @author jiangjixiang
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
@Slf4j
|
||||
public class RocketMqLogAspect {
|
||||
|
||||
|
||||
/**
|
||||
* 设置操作异常切入点记录异常日志 扫描所有controller包下操作
|
||||
*/
|
||||
@Pointcut(value = "execution(public * com.cool.store.mq.consumer.listener..*.consume(..))")
|
||||
public void rocketMqMdc() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 正常返回通知,拦截用户操作日志,连接点正常执行完成后执行, 如果连接点抛出异常,则不会执行
|
||||
*
|
||||
* @param joinPoint 切入点
|
||||
* @param keys 返回结果
|
||||
*/
|
||||
@Before(value = "rocketMqMdc()")
|
||||
public void mqBeforeLog(JoinPoint joinPoint) {
|
||||
try {
|
||||
Object[] args = joinPoint.getArgs();
|
||||
Message message = (Message)args[0];
|
||||
String traceId = message.getMsgID() + Constants.TOPIC_PARTITION_SEPARATOR + message.getReconsumeTimes();
|
||||
Map<String, String> context = MDC.getCopyOfContextMap();
|
||||
if(Objects.isNull(context)){
|
||||
MDC.put(CommonConstants.REQUEST_ID, traceId);
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.info("MDC mqBeforeLog", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@AfterReturning(value = "rocketMqMdc()")
|
||||
public void doAfterReturning(JoinPoint joinPoint){
|
||||
try {
|
||||
MDC.clear();
|
||||
} catch (Exception e) {
|
||||
log.info("MDC doAfterReturning", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.dto.partner.DescribePhoneNumberDTO;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.vo.cuser.IdentityCardInfoVO;
|
||||
|
||||
/**
|
||||
@@ -23,6 +24,6 @@ public interface AliyunService {
|
||||
* @param faceImageUrl
|
||||
* @return
|
||||
*/
|
||||
IdentityCardInfoVO getIdentityCardInfo(String faceImageUrl);
|
||||
IdentityCardInfoVO getIdentityCardInfo(String faceImageUrl) throws ApiException;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,11 +6,10 @@ import com.aliyun.dytnsapi20200217.models.DescribePhoneNumberOperatorAttributeRe
|
||||
import com.aliyun.dytnsapi20200217.models.DescribePhoneNumberOperatorAttributeResponse;
|
||||
import com.aliyun.ocr20191230.models.RecognizeIdentityCardResponse;
|
||||
import com.aliyun.ocr20191230.models.RecognizeIdentityCardResponseBody;
|
||||
import com.aliyun.tea.TeaException;
|
||||
import com.aliyun.tea.TeaModel;
|
||||
import com.aliyun.teaopenapi.models.Config;
|
||||
import com.cool.store.dto.partner.DescribePhoneNumberDTO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.service.AliyunService;
|
||||
import com.cool.store.vo.cuser.IdentityCardInfoVO;
|
||||
@@ -62,7 +61,7 @@ public class AliyunServiceImpl implements AliyunService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IdentityCardInfoVO getIdentityCardInfo(String faceImageUrl) {
|
||||
public IdentityCardInfoVO getIdentityCardInfo(String faceImageUrl) throws ApiException {
|
||||
//todo zcb ak sk替换
|
||||
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
||||
.setAccessKeyId("LTAI5t9RaXvABZbHvoXjDFJ1")
|
||||
@@ -94,14 +93,17 @@ public class AliyunServiceImpl implements AliyunService {
|
||||
return result;
|
||||
} catch (com.aliyun.tea.TeaException e) {
|
||||
log.error("身份证解析报错TeaException:{}", e);
|
||||
throw new ApiException(e.getMessage());
|
||||
} catch (MalformedURLException e) {
|
||||
log.error("身份证解析报错MalformedURLException:{}", e);
|
||||
throw new ApiException(e.getMessage());
|
||||
} catch (IOException e) {
|
||||
log.error("身份证解析报错IOException:{}", e);
|
||||
throw new ApiException(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error("身份证解析报错Exception:{}", e);
|
||||
throw new ApiException(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String convertDate(String date, String format) {
|
||||
|
||||
Reference in New Issue
Block a user