New file |
| | |
| | | package com.oying.modules.pc.store.rest; |
| | | |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import com.oying.utils.R; |
| | | import com.oying.modules.pc.store.domain.StoreQualification; |
| | | import com.oying.modules.pc.store.domain.dto.StoreQualificationQueryCriteria; |
| | | import com.oying.modules.pc.store.service.StoreQualificationService; |
| | | import com.oying.modules.pc.store.view.CustomerStoreQualificationView; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author lzp |
| | | * @date 2025-04-23 |
| | | * |
| | | */ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "店铺资质(客户端)") |
| | | @RequestMapping("/api/pc/customer/store/{storeId}/qualification") |
| | | public class StoreQualificationCustomerController { |
| | | |
| | | private final StoreQualificationService storeQualificationService; |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation("查询店铺资质") |
| | | //@PreAuthorize("@el.check('customer:storeQualification:list')") |
| | | public ResponseEntity<?> getList(@PathVariable Long storeId) { |
| | | if (ObjUtil.isEmpty(storeId)) { |
| | | return ResponseEntity.ok(R.success(ListUtil.empty())); |
| | | } |
| | | StoreQualificationQueryCriteria criteria = new StoreQualificationQueryCriteria(); |
| | | criteria.setStoreId(storeId); |
| | | List<StoreQualification> qualificationList = storeQualificationService.queryAll(criteria); |
| | | List<CustomerStoreQualificationView> viewList = Optional.ofNullable(qualificationList).orElse(ListUtil.empty()).stream().map(i -> { |
| | | CustomerStoreQualificationView view = new CustomerStoreQualificationView(); |
| | | BeanUtils.copyProperties(i, view); |
| | | view.setType(i.getQualificationType()); |
| | | view.setName(i.getQualificationName()); |
| | | view.setImageUrl(""); |
| | | return view; |
| | | }).collect(Collectors.toList()); |
| | | return ResponseEntity.ok(R.success(viewList)); |
| | | } |
| | | } |