|
@@ -83,6 +83,7 @@ import com.fjhx.tenant.service.dict.DictTenantDataService;
|
|
|
import com.ruoyi.common.core.domain.BaseIdPo;
|
|
|
import com.ruoyi.common.core.domain.BasePo;
|
|
|
import com.ruoyi.common.core.domain.BaseSelectDto;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.PageUtils;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
@@ -90,6 +91,7 @@ import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import com.ruoyi.common.utils.wrapper.SqlField;
|
|
|
import com.ruoyi.framework.config.ThreadPoolConfig;
|
|
|
+import com.ruoyi.system.service.ISysUserService;
|
|
|
import com.ruoyi.system.utils.UserUtil;
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -130,6 +132,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
private CustomerService customerService;
|
|
|
|
|
|
@Autowired
|
|
|
+ private ISysUserService iSysUserService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private CorporationService corporationService;
|
|
|
|
|
|
@Autowired
|
|
@@ -231,17 +236,21 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
*/
|
|
|
@Override
|
|
|
public Page<ContractVo> getPage(ContractSelectDto dto) {
|
|
|
-
|
|
|
- List<Long> authIdList = customerService.getAuthIdList();
|
|
|
-
|
|
|
- if (authIdList.size() == 0) {
|
|
|
- return new Page<>();
|
|
|
- }
|
|
|
-
|
|
|
IWrapper<Contract> wrapper = getWrapper();
|
|
|
- wrapper.in("t1", Contract::getBuyCorporationId, authIdList);
|
|
|
- wrapper.ne("t1", Contract::getIsShow, 1);
|
|
|
- return pageCommon(dto, wrapper);
|
|
|
+ SysUser sysUser = iSysUserService.getById(SecurityUtils.getUserId());
|
|
|
+ if(ObjectUtil.isEmpty(sysUser)){
|
|
|
+ throw new ServiceException("用户异常");
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(sysUser.getUserCode())){//不是业务员看所有
|
|
|
+ return pageCommon(dto, wrapper);
|
|
|
+ }else{//是业务员
|
|
|
+ List<Long> authIdList = customerService.getAuthIdList();
|
|
|
+ if (authIdList.size() == 0) {
|
|
|
+ return new Page<>();
|
|
|
+ }
|
|
|
+ wrapper.in("t1", Contract::getBuyCorporationId, authIdList);
|
|
|
+ return pageCommon(dto, wrapper);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1262,9 +1271,20 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
ContractDocumentaryBo bo = selectData.toJavaObject(ContractDocumentaryBo.class);
|
|
|
|
|
|
IWrapper<Contract> wrapper = IWrapper.getWrapper();
|
|
|
- //销售跟单权限过滤
|
|
|
- List<Long> authUserIdList = UserUtil.getAuthUserIdList();
|
|
|
- wrapper.in(Contract::getCreateUser, authUserIdList);
|
|
|
+ SysUser sysUser = iSysUserService.getById(SecurityUtils.getUserId());
|
|
|
+ if(ObjectUtil.isEmpty(sysUser)){
|
|
|
+ throw new ServiceException("用户异常");
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(sysUser.getUserCode())){//是业务员
|
|
|
+ List<Long> authIdList = customerService.getAuthIdList();
|
|
|
+ if (authIdList.size() == 0) {
|
|
|
+ return new Page<>();
|
|
|
+ }
|
|
|
+ wrapper.in( Contract::getBuyCorporationId, authIdList);
|
|
|
+ }
|
|
|
+// //销售跟单权限过滤
|
|
|
+// List<Long> authUserIdList = UserUtil.getAuthUserIdList();
|
|
|
+// wrapper.in(Contract::getCreateUser, authUserIdList);
|
|
|
|
|
|
wrapper.like(Contract::getCode, bo.getCode());
|
|
|
wrapper.eq(Contract::getCreateUser, bo.getUserId());
|