| package com.mzl.flower.web.customer; | 
|   | 
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
| import com.mzl.flower.base.BaseController; | 
| import com.mzl.flower.base.R; | 
| import com.mzl.flower.base.ReturnDataDTO; | 
| import com.mzl.flower.config.exception.ValidationException; | 
| import com.mzl.flower.config.security.SecurityUtils; | 
| import com.mzl.flower.dto.request.customer.BindPartnerDTO; | 
| import com.mzl.flower.dto.request.customer.ChangePartnerDTO; | 
| import com.mzl.flower.dto.request.customer.QueryCustomerDTO; | 
| import com.mzl.flower.dto.request.customer.UpdateCustomerDTO; | 
| import com.mzl.flower.dto.request.supplier.AuditSupplierDTO; | 
| import com.mzl.flower.dto.request.supplier.QuerySupplierDTO; | 
| import com.mzl.flower.dto.request.supplier.UpdateSupplierDTO; | 
| import com.mzl.flower.dto.response.customer.CustomerDTO; | 
| import com.mzl.flower.dto.response.supplier.SupplierDTO; | 
| import com.mzl.flower.service.customer.CustomerService; | 
| import io.swagger.annotations.Api; | 
| import io.swagger.annotations.ApiOperation; | 
| import lombok.extern.slf4j.Slf4j; | 
| import org.springframework.http.ResponseEntity; | 
| import org.springframework.validation.annotation.Validated; | 
| import org.springframework.web.bind.annotation.*; | 
|   | 
| import javax.validation.constraints.NotBlank; | 
|   | 
| @RestController | 
| @RequestMapping("/api/customer") | 
| @Api(value = "商户(花店)管理", tags = "商户(花店)管理") | 
| @Validated | 
| @Slf4j | 
| public class CustomerController extends BaseController { | 
|   | 
|     private final CustomerService customerService; | 
|   | 
|     public CustomerController(CustomerService customerService) { | 
|         this.customerService = customerService; | 
|     } | 
|   | 
|     @PostMapping("/addOrUpdate") | 
|     @ApiOperation(value = "商户(花店)信息登记、修改", notes = "商户(花店)信息登记、修改") | 
|     public ResponseEntity<ReturnDataDTO> addOrUpdateCustomer(@Validated @RequestBody UpdateCustomerDTO dto) { | 
|         customerService.addOrUpdateCustomer(dto); | 
|         return returnData(R.SUCCESS.getCode(),null); | 
|     } | 
|   | 
|     @GetMapping("/page") | 
|     @ApiOperation(value = "运营端-商户(花店)分页查询", notes = "运营端-商户(花店)分页查询") | 
|     public ResponseEntity<ReturnDataDTO<Page<CustomerDTO>>> queryCustomer(QueryCustomerDTO dto, Page page) { | 
|         return returnData(R.SUCCESS.getCode(),customerService.queryCustomer(dto,page)); | 
|     } | 
|   | 
|     @GetMapping("/page/detail/{id}") | 
|     @ApiOperation(value = "商户(花店)详情", notes = "商户(花店)详情") | 
|     public ResponseEntity<ReturnDataDTO<SupplierDTO>> findDetail(@PathVariable("id") Long id) { | 
|         return returnData(R.SUCCESS.getCode(),customerService.findDetail(id)); | 
|     } | 
|   | 
|   | 
|     @GetMapping("/partner/page") | 
|     @ApiOperation(value = "合伙人-商户(花店)分页查询", notes = "合伙人-商户(花店)分页查询") | 
|     public ResponseEntity<ReturnDataDTO<Page<CustomerDTO>>> queryPartnerCustomer(QueryCustomerDTO dto, Page page) { | 
|         dto.setPartnerUserId(SecurityUtils.getUserId()); | 
|         return returnData(R.SUCCESS.getCode(),customerService.queryCustomer(dto,page)); | 
|     } | 
|   | 
|   | 
|     @PostMapping("/change/partner") | 
|     @ApiOperation(value = "变更合伙人", notes = "变更合伙人") | 
|     public ResponseEntity<ReturnDataDTO> changeCustomerPartner(@Validated @RequestBody ChangePartnerDTO dto) { | 
|         customerService.changeCustomerPartner(dto); | 
|         return returnData(R.SUCCESS.getCode(),null); | 
|     } | 
|   | 
|     @PostMapping("/bind/partner") | 
|     @ApiOperation(value = "绑定合伙人", notes = "绑定合伙人") | 
|     public ResponseEntity<ReturnDataDTO> bindPartner(@Validated @RequestBody BindPartnerDTO dto) { | 
|         customerService.bindPartner(dto); | 
|         return returnData(R.SUCCESS.getCode(),null); | 
|     } | 
|   | 
|     @GetMapping("/partner/name") | 
|     @ApiOperation(value = "商户(花店)详情", notes = "商户(花店)详情") | 
|     public ResponseEntity<ReturnDataDTO<SupplierDTO>> getPartnerName(@NotBlank(message = "参数不能为空") String id) { | 
|         return returnData(R.SUCCESS.getCode(),customerService.getPartnerName(id)); | 
|     } | 
| } |