|
|
@@ -28,6 +28,7 @@ import com.sckw.order.model.dto.WantBuyExport;
|
|
|
import com.sckw.order.model.vo.req.*;
|
|
|
import com.sckw.order.model.vo.res.*;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
+import com.sckw.system.api.RemoteUserService;
|
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
@@ -50,6 +51,8 @@ import java.util.stream.Collectors;
|
|
|
public class KwpWantBuyService {
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
private RemoteSystemService remoteSystemService;
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
|
|
|
+ RemoteUserService remoteUserService;
|
|
|
private final KwpWantBuyMapper kwpWantBuyMapper;
|
|
|
private final KwpWantBuyTradingMapper kwpWantBuyTradingMapper;
|
|
|
private final KwpWantBuyAddressMapper kwpWantBuyAddressMapper;
|
|
|
@@ -155,11 +158,32 @@ public class KwpWantBuyService {
|
|
|
List<String> goodsTypes = goodsTypeHandle(wantBuySelectParam);
|
|
|
wantBuySelectParam.setGoodsTypeValueSearch(goodsTypes);
|
|
|
}
|
|
|
- wantBuySelectParam.setEntId(!Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode()) ? LoginUserHolder.getEntId() : null);
|
|
|
+// wantBuySelectParam.setEntId(!Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode()) ? LoginUserHolder.getEntId() : null);
|
|
|
+
|
|
|
+ /**新增客户经理权限过滤*/
|
|
|
+ List<Long> authEntIdList = new ArrayList<>();
|
|
|
+ if (!Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode())) {
|
|
|
+ authEntIdList.add(LoginUserHolder.getEntId());
|
|
|
+ } else {
|
|
|
+ List<Long> authEntIdList1 = LoginUserHolder.getAuthEntIdList();
|
|
|
+ if (CollectionUtils.isEmpty(authEntIdList1)) {
|
|
|
+ List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
|
|
|
+ if (CollectionUtils.isEmpty(ids)) {
|
|
|
+ return new PageRes<>();
|
|
|
+ }
|
|
|
+ authEntIdList.addAll(ids);
|
|
|
+ } else {
|
|
|
+ authEntIdList.addAll(authEntIdList1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(authEntIdList)) {
|
|
|
+ authEntIdList = authEntIdList.stream().distinct().collect(Collectors.toList());
|
|
|
+ }
|
|
|
wantBuySelectParam.setSystemType(LoginUserHolder.getSystemType());
|
|
|
|
|
|
PageHelper.startPage(wantBuySelectParam.getPage(), wantBuySelectParam.getPageSize());
|
|
|
- List<WantBuySelectRes> wantBuyDto = kwpWantBuyMapper.pageSelect(wantBuySelectParam);
|
|
|
+// List<WantBuySelectRes> wantBuyDto = kwpWantBuyMapper.pageSelect(wantBuySelectParam);
|
|
|
+ List<WantBuySelectRes> wantBuyDto = kwpWantBuyMapper.pageSelectAllByManager(wantBuySelectParam,authEntIdList);
|
|
|
if (CollectionUtils.isEmpty(wantBuyDto)) {
|
|
|
return new PageRes<>();
|
|
|
}
|
|
|
@@ -504,10 +528,30 @@ public class KwpWantBuyService {
|
|
|
List<String> goodsTypes = goodsTypeHandle(params);
|
|
|
params.setGoodsTypeValueSearch(goodsTypes);
|
|
|
}
|
|
|
- params.setEntId(!Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode()) ? LoginUserHolder.getEntId() : null);
|
|
|
+// params.setEntId(!Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode()) ? LoginUserHolder.getEntId() : null);
|
|
|
+ /**新增客户经理权限过滤*/
|
|
|
+ List<Long> authEntIdList = new ArrayList<>();
|
|
|
+ if (!Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode())) {
|
|
|
+ authEntIdList.add(LoginUserHolder.getEntId());
|
|
|
+ } else {
|
|
|
+ List<Long> authEntIdList1 = LoginUserHolder.getAuthEntIdList();
|
|
|
+ if (CollectionUtils.isEmpty(authEntIdList1)) {
|
|
|
+ List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
|
|
|
+ if (CollectionUtils.isEmpty(ids)) {
|
|
|
+ return getDefaultTops(res);
|
|
|
+ }
|
|
|
+ authEntIdList.addAll(ids);
|
|
|
+ } else {
|
|
|
+ authEntIdList.addAll(authEntIdList1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(authEntIdList)) {
|
|
|
+ authEntIdList = authEntIdList.stream().distinct().collect(Collectors.toList());
|
|
|
+ }
|
|
|
params.setSystemType(LoginUserHolder.getSystemType());
|
|
|
|
|
|
- List<WantBuySelectRes> result = kwpWantBuyMapper.pageSelect(params);
|
|
|
+// List<WantBuySelectRes> result = kwpWantBuyMapper.pageSelect(params);
|
|
|
+ List<WantBuySelectRes> result = kwpWantBuyMapper.pageSelectAllByManager(params,authEntIdList);
|
|
|
Map<Integer, List<WantBuySelectRes>> map = result.stream().collect(Collectors.groupingBy(WantBuySelectRes::getStatus));
|
|
|
List<TableTop> tableTops = new ArrayList<>();
|
|
|
TableTop all = new TableTop();
|
|
|
@@ -532,6 +576,24 @@ public class KwpWantBuyService {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ private TableStatisticRes getDefaultTops(TableStatisticRes res) {
|
|
|
+ List<TableTop> tableTops = new ArrayList<>();
|
|
|
+ TableTop all = new TableTop();
|
|
|
+ all.setName("全部").setTotal(0);
|
|
|
+ tableTops.add(all);
|
|
|
+ List<WantBuyStatusEnum> enums = WantBuyStatusEnum.getSortList();
|
|
|
+ enums.forEach(e -> {
|
|
|
+ Integer value = e.getCode();
|
|
|
+ TableTop tableTop = new TableTop();
|
|
|
+ tableTop.setName(e.getMsg()).setValue(value).setTotal(0);
|
|
|
+ tableTops.add(tableTop);
|
|
|
+ });
|
|
|
+ TableBottom tableBottom = new TableBottom();
|
|
|
+ tableBottom.setTotal(0);
|
|
|
+ res.setTableTops(tableTops).setTableBottom(tableBottom);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
public List<WantBuyExport> export(WantBuySelectParam param) {
|
|
|
WantBuySelectParam selectParam = new WantBuySelectParam();
|
|
|
if (StringUtils.isNotBlank(param.getIds())) {
|
|
|
@@ -549,10 +611,31 @@ public class KwpWantBuyService {
|
|
|
selectParam.setGoodsTypeValueSearch(goodsTypes);
|
|
|
}
|
|
|
}
|
|
|
- selectParam.setEntId(!Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode()) ? LoginUserHolder.getEntId() : null);
|
|
|
+// selectParam.setEntId(!Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode()) ? LoginUserHolder.getEntId() : null);
|
|
|
+
|
|
|
+ /**新增客户经理权限过滤*/
|
|
|
+ List<Long> authEntIdList = new ArrayList<>();
|
|
|
+ if (!Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode())) {
|
|
|
+ authEntIdList.add(LoginUserHolder.getEntId());
|
|
|
+ } else {
|
|
|
+ List<Long> authEntIdList1 = LoginUserHolder.getAuthEntIdList();
|
|
|
+ if (CollectionUtils.isEmpty(authEntIdList1)) {
|
|
|
+ List<Long> ids = remoteUserService.findEnterpriseIdsByUserIdIsMain(LoginUserHolder.getUserId());
|
|
|
+ if (CollectionUtils.isEmpty(ids)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+ authEntIdList.addAll(ids);
|
|
|
+ } else {
|
|
|
+ authEntIdList.addAll(authEntIdList1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(authEntIdList)) {
|
|
|
+ authEntIdList = authEntIdList.stream().distinct().collect(Collectors.toList());
|
|
|
+ }
|
|
|
selectParam.setSystemType(LoginUserHolder.getSystemType());
|
|
|
|
|
|
- List<WantBuySelectRes> wantBuyDto = kwpWantBuyMapper.pageSelect(selectParam);
|
|
|
+// List<WantBuySelectRes> wantBuyDto = kwpWantBuyMapper.pageSelect(selectParam);
|
|
|
+ List<WantBuySelectRes> wantBuyDto = kwpWantBuyMapper.pageSelectAllByManager(selectParam,authEntIdList);
|
|
|
if (CollectionUtils.isEmpty(wantBuyDto)) {
|
|
|
return Collections.emptyList();
|
|
|
}
|