|
|
@@ -4,12 +4,16 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
+import com.sckw.core.model.enums.SystemTypeEnum;
|
|
|
+import com.sckw.core.model.page.PageHelperUtil;
|
|
|
import com.sckw.core.model.page.PageResult;
|
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
|
import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
+import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.excel.utils.DateUtil;
|
|
|
import com.sckw.manage.dao.KwmLineFreightRateMapper;
|
|
|
import com.sckw.manage.model.entity.KwmAddress;
|
|
|
@@ -20,6 +24,7 @@ import com.sckw.manage.model.vo.res.LineFreightRateExport;
|
|
|
import com.sckw.manage.model.vo.res.LineFreightRateFindListResVO;
|
|
|
import com.sckw.manage.model.vo.res.LineFreightRateListResVO;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
+import com.sckw.system.api.RemoteUserService;
|
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -44,6 +49,9 @@ public class KwmLineFreightRateService {
|
|
|
private final KwmLineFreightRateMapper lineFreightRateMapper;
|
|
|
private final KwmAddressService addressService;
|
|
|
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
|
|
|
+ RemoteUserService remoteUserService;
|
|
|
+
|
|
|
/**
|
|
|
* @param addLineFreightRateParam
|
|
|
* @return void
|
|
|
@@ -152,7 +160,20 @@ public class KwmLineFreightRateService {
|
|
|
* @date 2024/3/1 16:27
|
|
|
*/
|
|
|
public PageResult select(SelectLineFreightRateParam params) {
|
|
|
- LambdaQueryWrapper<KwmLineFreightRate> wrapper = buildWrapper(BeanUtil.copyProperties(params, ExportLineFreightRateParam.class));
|
|
|
+ //新增客户经理权限过滤
|
|
|
+ List<Long> authEntIdList = new ArrayList<>();
|
|
|
+ if (SystemTypeEnum.MANAGE.getCode().equals(LoginUserHolder.getSystemType())) {
|
|
|
+ if (CollectionUtils.isEmpty(authEntIdList)) {
|
|
|
+ List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
|
|
|
+ if (CollectionUtils.isEmpty(ids)){
|
|
|
+ return PageResult.build(params.getPage(), params.getPageSize(), 0L, Collections.emptyList());
|
|
|
+ }
|
|
|
+ authEntIdList.addAll(ids);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ authEntIdList.add(LoginUserHolder.getEntId());
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<KwmLineFreightRate> wrapper = buildWrapper(BeanUtil.copyProperties(params, ExportLineFreightRateParam.class), authEntIdList);
|
|
|
Page<KwmLineFreightRate> page = new Page<>(params.getPage(), params.getPageSize());
|
|
|
Page<KwmLineFreightRate> ipage = lineFreightRateMapper.selectPage(page, wrapper);
|
|
|
List<KwmLineFreightRate> list = ipage.getRecords();
|
|
|
@@ -179,7 +200,20 @@ public class KwmLineFreightRateService {
|
|
|
* @date 2024/3/1 16:40
|
|
|
*/
|
|
|
public List<LineFreightRateExport> export(ExportLineFreightRateParam params) {
|
|
|
- LambdaQueryWrapper<KwmLineFreightRate> wrapper = buildWrapper(params);
|
|
|
+ //新增客户经理权限过滤
|
|
|
+ List<Long> authEntIdList = new ArrayList<>();
|
|
|
+ if (SystemTypeEnum.MANAGE.getCode().equals(LoginUserHolder.getSystemType())) {
|
|
|
+ if (CollectionUtils.isEmpty(authEntIdList)) {
|
|
|
+ List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
|
|
|
+ if (CollectionUtils.isEmpty(ids)){
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ authEntIdList.addAll(ids);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ authEntIdList.add(LoginUserHolder.getEntId());
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<KwmLineFreightRate> wrapper = buildWrapper(params, authEntIdList);
|
|
|
List<KwmLineFreightRate> list = lineFreightRateMapper.selectList(wrapper);
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
return Collections.emptyList();
|
|
|
@@ -208,7 +242,9 @@ public class KwmLineFreightRateService {
|
|
|
* @author yzc
|
|
|
* @date 2024/3/1 16:40
|
|
|
*/
|
|
|
- private LambdaQueryWrapper<KwmLineFreightRate> buildWrapper(ExportLineFreightRateParam params) {
|
|
|
+ private LambdaQueryWrapper<KwmLineFreightRate>
|
|
|
+
|
|
|
+ buildWrapper(ExportLineFreightRateParam params, List<Long> authEntIdList) {
|
|
|
LambdaQueryWrapper<KwmLineFreightRate> wrapper = new LambdaQueryWrapper<>();
|
|
|
if (Objects.nonNull(params.getStartCreateTime())) {
|
|
|
wrapper.ge(KwmLineFreightRate::getCreateTime, params.getStartCreateTime());
|
|
|
@@ -222,14 +258,17 @@ public class KwmLineFreightRateService {
|
|
|
if (Objects.nonNull(params.getEndMileage())) {
|
|
|
wrapper.le(KwmLineFreightRate::getTransportMileage, params.getEndMileage());
|
|
|
}
|
|
|
+ if (CollectionUtils.isNotEmpty(authEntIdList)) {
|
|
|
+ wrapper.in(KwmLineFreightRate::getEntId, authEntIdList);
|
|
|
+ }
|
|
|
+
|
|
|
String keywords = params.getKeywords();
|
|
|
if (StringUtils.isNotBlank(keywords)) {
|
|
|
wrapper.and(e -> e.like(KwmLineFreightRate::getName, keywords)
|
|
|
.or().like(KwmLineFreightRate::getLoadName, keywords)
|
|
|
.or().like(KwmLineFreightRate::getUnloadName, keywords));
|
|
|
}
|
|
|
- wrapper.eq(KwmLineFreightRate::getEntId, LoginUserHolder.getEntId())
|
|
|
- .eq(KwmLineFreightRate::getDelFlag, Global.NO)
|
|
|
+ wrapper.eq(KwmLineFreightRate::getDelFlag, Global.NO)
|
|
|
.orderByDesc(KwmLineFreightRate::getCreateTime);
|
|
|
return wrapper;
|
|
|
}
|