|
|
@@ -1,37 +1,42 @@
|
|
|
package com.ydtech.modules.order.aop.aspect;
|
|
|
|
|
|
|
|
|
+import com.ydtech.constants.sys.SystemConstant;
|
|
|
import com.ydtech.modules.base.controller.BaseController;
|
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
|
|
|
import com.ydtech.modules.protocol.service.PtlAgreementDeptService;
|
|
|
import com.ydtech.utils.StringUtils;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.aspectj.lang.JoinPoint;
|
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
|
import org.aspectj.lang.annotation.Before;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
+
|
|
|
@Slf4j
|
|
|
@Aspect
|
|
|
@Component
|
|
|
+@RequiredArgsConstructor
|
|
|
public class QuoteVerificationAspect {
|
|
|
|
|
|
private final PtlAgreementDeptService ptlAgreementDeptService;
|
|
|
|
|
|
- public QuoteVerificationAspect(PtlAgreementDeptService ptlAgreementDeptService) {
|
|
|
- this.ptlAgreementDeptService = ptlAgreementDeptService;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
@Before("@annotation(com.ydtech.modules.order.aop.QuoteVerification)")
|
|
|
public void doBefore(JoinPoint point) {
|
|
|
Object[] args = point.getArgs();
|
|
|
for (Object arg : args) {
|
|
|
if (arg instanceof BaseQuoteVo) {
|
|
|
String agreementId = ((BaseQuoteVo<?>) arg).getAgreementId();
|
|
|
- String deptId=((BaseQuoteVo<?>) arg).getDeptId();
|
|
|
+ String deptId = ((BaseQuoteVo<?>) arg).getDeptId();
|
|
|
+
|
|
|
+ if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(deptId)) { //团队长可查询下面所有人员订单
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 判断协议是否可以报价(代客录单时,机构需要传过来 没传为空时,为车险录单进来的 直接取登录用户机构即可)
|
|
|
- if(StringUtils.isEmpty(deptId)){
|
|
|
+ if (StringUtils.isEmpty(deptId)) {
|
|
|
deptId = new BaseController().getDeptId();
|
|
|
}
|
|
|
ptlAgreementDeptService.agreementIsAuthorized(deptId, agreementId);
|