|
@@ -5,8 +5,13 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.pj.constants.RoleEnum;
|
|
|
+import com.pj.constants.UserTypeEnum;
|
|
|
+import com.pj.current.satoken.StpUserUtil;
|
|
|
import com.pj.project.relation_type_item.RelationTypeItem;
|
|
|
import com.pj.project.relation_type_item.RelationTypeItemService;
|
|
|
+import com.pj.project.tb_costomer.TbCostomer;
|
|
|
+import com.pj.project.tb_costomer.TbCostomerService;
|
|
|
import com.pj.project.tb_item.TbItem;
|
|
|
import com.pj.project.tb_item.TbItemService;
|
|
|
import com.pj.utils.so.SoMap;
|
|
@@ -35,6 +40,9 @@ public class TbItemTypeService extends ServiceImpl<TbItemTypeMapper, TbItemType>
|
|
|
@Resource
|
|
|
private RelationTypeItemService relationTypeItemService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private TbCostomerService tbCostomerService;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 删
|
|
@@ -56,14 +64,26 @@ public class TbItemTypeService extends ServiceImpl<TbItemTypeMapper, TbItemType>
|
|
|
* 查集合 - 根据条件(参数为空时代表忽略指定条件)
|
|
|
*/
|
|
|
List<TbItemType> getList(SoMap so) {
|
|
|
- return tbItemTypeMapper.getList(so);
|
|
|
+ List<TbItemType> list = tbItemTypeMapper.getList(so);
|
|
|
+ String customerId = StpUserUtil.getCustomerId();
|
|
|
+ if (!UserTypeEnum.PLATFORM_ADMIN.getCustomerId().equals(customerId)) {
|
|
|
+ TbCostomer tbCostomer = tbCostomerService.getById(customerId);
|
|
|
+ if (!TbCostomer.CustomerEnum.BUSINESS_TYPE.getType().equals(tbCostomer.getType())) {
|
|
|
+ list = list.stream().filter(tbItemType -> {
|
|
|
+ List<TbItem> items = tbItemService.getItemTypeById(tbItemType.getId());
|
|
|
+ List<String> businessTypeList = items.stream().map(TbItem::getBusinessType).collect(Collectors.toList());
|
|
|
+ return businessTypeList.contains(tbCostomer.getType());
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
|
|
|
public TbItemType getItemTypeById(String id) {
|
|
|
TbItemType tbItemType = super.getById(id);
|
|
|
- List<TbItem>items= tbItemService.getItemTypeById(id);
|
|
|
- tbItemType.setItems(items);
|
|
|
+ List<TbItem> items = tbItemService.getItemTypeById(id);
|
|
|
+ tbItemType.setItems(items);
|
|
|
return tbItemType;
|
|
|
}
|
|
|
}
|