|
@@ -0,0 +1,48 @@
|
|
|
+package com.huyi.service.common.companHandler;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.huyi.service.base.entity.SysUserCompanyRel;
|
|
|
+import com.huyi.service.base.service.ISysUserCompanyRelService;
|
|
|
+import com.tianhu.common.core.web.domain.AjaxResult;
|
|
|
+import com.tianhu.common.security.service.TokenService;
|
|
|
+import com.tianhu.system.api.domain.SysUser;
|
|
|
+import com.tianhu.system.api.model.LoginUser;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 查询当前用户是否是经办人
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/companyHandler")
|
|
|
+public class CompanyHandlerController {
|
|
|
+ @Autowired
|
|
|
+ private TokenService tokenService;
|
|
|
+ @Autowired
|
|
|
+ private ISysUserCompanyRelService iSysUserCompanyRelService;
|
|
|
+
|
|
|
+ @GetMapping("/list")
|
|
|
+ public AjaxResult list() {
|
|
|
+ //获取此操作员
|
|
|
+ LoginUser userInfo = tokenService.getLoginUser();
|
|
|
+ SysUser user = userInfo.getSysUser();
|
|
|
+ String userId = user.getUserId() + "";
|
|
|
+ String companyId = user.getCompanyId();
|
|
|
+ //查询当前用户是否是经办人
|
|
|
+ LambdaQueryWrapper<SysUserCompanyRel> companyRelWrapper = new LambdaQueryWrapper<>();
|
|
|
+ companyRelWrapper.eq(SysUserCompanyRel::getSucrUserId, userId);
|
|
|
+ companyRelWrapper.eq(SysUserCompanyRel::getSucrCompanyId, companyId);
|
|
|
+ companyRelWrapper.eq(SysUserCompanyRel::getSucrHandler, "1");
|
|
|
+ List<SysUserCompanyRel> list = iSysUserCompanyRelService.findSysUserCompanyRels(companyRelWrapper);
|
|
|
+ if (list.size() == 0) {
|
|
|
+ return AjaxResult.success(false);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ return AjaxResult.success(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|