123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- package com.winhc.repal.controller;
- import com.winhc.common.base.BeanResponse;
- import com.winhc.common.enums.CodeMsg;
- import com.winhc.common.model.base.VOPage;
- import com.winhc.repal.common.BaseController;
- import com.winhc.repal.enums.Dict;
- import com.winhc.repal.model.dto.*;
- import com.winhc.repal.model.vo.*;
- import com.winhc.repal.service.RepalBillService;
- import com.winhc.repal.service.RepalCustomerService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- /**
- * @author Aaron
- * @date 2022/4/19 13:08
- * @description
- */
- @Api(tags = "回款宝 客户/供应 商管理")
- @RestController
- @RequestMapping(value = "/repalCustomer")
- public class RepalCustomerController extends BaseController {
- @Autowired
- private RepalCustomerService repalCustomerService;
- @Autowired
- private RepalBillService repalBillService;
- @ApiOperation("客户/供应商下拉框")
- @GetMapping(value = "/list")
- public BeanResponse<List<RepalCustomerSimpleVO>> getCustList(@ApiParam("1客户 2供应商") @RequestParam("custType")Integer custType){
- return BeanResponse.success(CodeMsg.SUCCESS,repalCustomerService.getCustList(custType));
- }
- @ApiOperation("分页查询客户")
- @GetMapping(value = "/cust/page")
- public BeanResponse<VOPage<RepalCustomerInfoVO>> getRepalCustPage(RepalCustomerQueryDTO dto){
- return BeanResponse.success(CodeMsg.SUCCESS,repalCustomerService.find(dto.setCustType(Dict.custTypeEnum.客户.getCode()),getUser()));
- }
- @ApiOperation("添加客户")
- @PostMapping("/cust")
- public BeanResponse<RepalCustomerDetailVO> addCustomer(@RequestBody RepalCustomerDTO dto){
- return BeanResponse.success(CodeMsg.SUCCESS,repalCustomerService.addCustomer(dto.setCustType(Dict.custTypeEnum.客户.getCode()),getUser()));
- }
- @ApiOperation("修改客户")
- @PostMapping("/cust/modify")
- public BeanResponse<RepalCustomerDetailVO> modifyCustomer(@RequestBody RepalCustomerUpdateDTO dto){
- return BeanResponse.success(CodeMsg.SUCCESS,repalCustomerService.updateCustomer(dto.setCustType(Dict.custTypeEnum.客户.getCode()),getUser()));
- }
- @ApiOperation("客户详情")
- @GetMapping(value = "/cust/{custId}")
- public BeanResponse<RepalCustomerDetailVO> getRepalCustomerDetail(@PathVariable("custId")Long custId){
- return BeanResponse.success(CodeMsg.SUCCESS,repalCustomerService.getDetailById(custId,getUser(),Dict.custTypeEnum.客户.getCode()));
- }
- @ApiOperation("分页查询供应商")
- @GetMapping(value = "/supply/page")
- public BeanResponse<VOPage<RepalCustomerInfoVO>> getRepalSupplyPage(RepalCustomerQueryDTO dto){
- return BeanResponse.success(CodeMsg.SUCCESS,repalCustomerService.find(dto.setCustType(Dict.custTypeEnum.供应商.getCode()),getUser()));
- }
- @ApiOperation("添加供应商")
- @PostMapping("/supply")
- public BeanResponse<RepalCustomerDetailVO> addSupply(@RequestBody RepalCustomerDTO dto){
- return BeanResponse.success(CodeMsg.SUCCESS,repalCustomerService.addCustomer(dto.setCustType(Dict.custTypeEnum.客户.getCode()),getUser()));
- }
- @ApiOperation("修改供应商")
- @PostMapping("/supply/modify")
- public BeanResponse<RepalCustomerDetailVO> modifySupply(@RequestBody RepalCustomerUpdateDTO dto){
- return BeanResponse.success(CodeMsg.SUCCESS,repalCustomerService.updateCustomer(dto.setCustType(Dict.custTypeEnum.供应商.getCode()),getUser()));
- }
- @ApiOperation("供应商详情")
- @GetMapping(value = "/supply/{custId}")
- public BeanResponse<RepalCustomerDetailVO> getRepalSupplyDetail(@PathVariable("custId")Long custId){
- return BeanResponse.success(CodeMsg.SUCCESS,repalCustomerService.getDetailById(custId,getUser(),Dict.custTypeEnum.供应商.getCode()));
- }
- @ApiOperation("删除客户/供应商")
- @DeleteMapping("/{custId}")
- public BeanResponse<Boolean> deleteCustomer(@PathVariable("custId")Long custId){
- return BeanResponse.success(CodeMsg.SUCCESS,repalCustomerService.deleteCustomer(custId,getUser()));
- }
- @ApiOperation("获取客户下的账款列表(应收or应付)")
- @RequestMapping(value = "/page/cust", method = RequestMethod.GET)
- public BeanResponse<VOPage<RepalBillPageVO>> getCustRepalBillPage(@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum,
- @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
- @RequestParam("custId")Long custId) {
- return BeanResponse.success(CodeMsg.SUCCESS, repalBillService.getCustRepalBillPage(pageNum,pageSize,custId));
- }
- @ApiOperation("查询客户联系人列表")
- @GetMapping("/link")
- public BeanResponse<List<RepalLinkVO>> queryLink(@RequestParam("custId")Long custId){
- return BeanResponse.success(CodeMsg.SUCCESS,repalCustomerService.queryLink(custId));
- }
- @ApiOperation("添加(修改)联系人")
- @PostMapping("/link")
- public BeanResponse<RepalLinkVO> updateLink(@RequestBody RepalLinkUpdateDTO dto){
- return BeanResponse.success(CodeMsg.SUCCESS,repalCustomerService.updateLink(dto));
- }
- }
|