package com.mzl.flower.web.flower; 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.base.annotation.OperationLog; import com.mzl.flower.dto.request.flower.*; import com.mzl.flower.dto.response.flower.*; import com.mzl.flower.entity.log.OperationRecord; import com.mzl.flower.service.flower.FlowerMarkupPsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.io.IOException; @RestController @RequestMapping("/api/flower/markup/ps") @Api(value = "平台二次加价管理", tags = "平台二次加价管理") @Validated @Slf4j public class FlowerMarkupPsController extends BaseController { @Autowired private FlowerMarkupPsService psService; @PostMapping("/list/new") @OperationLog(value = "新增合伙人配置", type = "markup_s_p") @ApiOperation(value = "新增合伙人配置") public ResponseEntity saveMarkupPs(@RequestBody FlowerMarkupPsSaveDTO dto) { String content = "新增合伙人配置:合伙人id:【" + dto.getPartnerId() + "】"; OperationRecord operationRecord = getOperationRecord(content); return returnData(R.SUCCESS.getCode(), psService.saveMarkupPs(dto), operationRecord); } @GetMapping("/list") @ApiOperation(value = "获取合伙人配置列表") public ResponseEntity>> selectMarkupPsList(Page page, FlowerMarkupPsQueryDTO dto){ return returnData(R.SUCCESS.getCode(), psService.selectMarkupPsList(page, dto)); } @GetMapping("/list/delete") @OperationLog(value = "删除合伙人配置", type = "markup_s_p") @ApiOperation(value = "删除合伙人配置") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "String", paramType = "query") }) public ResponseEntity> deleteMarkupPs(Long id){ psService.deleteMarkupPs(id); String content = "删除合伙人配置id:【" + id+ "】"; OperationRecord operationRecord = getOperationRecord(content); return returnData(R.SUCCESS.getCode(), null, operationRecord); } @PostMapping("/spcg/list/save/batch") @OperationLog(value = "批量新增商品分类加价", type = "markup_s_p") @ApiOperation(value = "批量新增商品分类加价") public ResponseEntity saveMarkupSpCgBatch(@RequestBody FlowerMarkupPsSpCgBatchSaveDTO dto, HttpServletRequest request) throws IOException { psService.saveMarkupSpCgBatch(dto,request); String content = "批量新增商品分类加价:商品分类Id:【" + dto.getCategoryId() + "】,A级:【"+dto.getLevelA()+"】,B级:【" + dto.getLevelB() + "】,C级:【" + dto.getLevelC() + "】" + ",D级:【"+dto.getLevelD()+"】,E级:【" + dto.getLevelE() + "】,O级:【" + dto.getLevelO() + "】"; OperationRecord operationRecord = getOperationRecord(content); return returnData(R.SUCCESS.getCode(), null,operationRecord); } @PostMapping("/spcg/list/save") @ApiOperation(value = "新增商品分类加价") public ResponseEntity saveMarkupSpCg(@RequestBody FlowerMarkupPsSpCgSaveDTO dto,HttpServletRequest request) throws IOException { psService.saveMarkupSpCg(dto,request); return returnData(R.SUCCESS.getCode(), null); } @GetMapping("/spcg/list/view") @ApiOperation(value = "查询商品分类加价详情") @ApiImplicitParams({ @ApiImplicitParam(name = "partnerId", value = "合伙人id", required = true, dataType = "Long", paramType = "query"), @ApiImplicitParam(name = "categoryId", value = "商品分类id", required = true, dataType = "Long", paramType = "query"), }) public ResponseEntity> getMarkupSpCg(Long partnerId, Long categoryId){ return returnData(R.SUCCESS.getCode(), psService.getMarkupSpCg(partnerId, categoryId)); } @GetMapping("/spcg/list") @ApiOperation(value = "获取商品分类加价列表") public ResponseEntity>> selectMarkupSpCgList(Page page , FlowerMarkupPsSpCgQueryDTO dto){ return returnData(R.SUCCESS.getCode(), psService.selectMarkupSpCgList(page, dto)); } @GetMapping("/spcg/list/delete") @OperationLog(value = "删除商品分类加价", type = "markup_s_p") @ApiOperation(value = "删除商品分类加价") @ApiImplicitParams({ @ApiImplicitParam(name = "partnerId", value = "合伙人id", required = true, dataType = "Long", paramType = "query"), @ApiImplicitParam(name = "categoryId", value = "商品分类id", required = true, dataType = "Long", paramType = "query") }) public ResponseEntity> deleteMarkupSpCg(Long partnerId, Long categoryId){ psService.deleteMarkupSpCg(partnerId, categoryId); String content = "删除商品分类加价:合伙人id:【" + partnerId + "】,商品分类id:【"+categoryId+"】"; OperationRecord operationRecord = getOperationRecord(content); return returnData(R.SUCCESS.getCode(), null,operationRecord); } @PostMapping("/sp/list/save") @ApiOperation(value = "新增商品加价") public ResponseEntity saveMarkupSp(@RequestBody FlowerMarkupPsSpSaveDTO dto,HttpServletRequest request) throws IOException { psService.saveMarkupSp(dto,request); return returnData(R.SUCCESS.getCode(), null); } @GetMapping("/sp/list/view") @ApiOperation(value = "查询商品加价详情") @ApiImplicitParams({ @ApiImplicitParam(name = "partnerId", value = "合伙人id", required = true, dataType = "Long", paramType = "query"), @ApiImplicitParam(name = "flowerId", value = "商品id", required = true, dataType = "Long", paramType = "query") }) public ResponseEntity> getMarkupSp(Long partnerId, Long flowerId){ return returnData(R.SUCCESS.getCode(), psService.getMarkupSp(partnerId, flowerId)); } @GetMapping("/sp/list") @ApiOperation(value = "获取商品加价列表") public ResponseEntity>> selectMarkupSpList(Page page, FlowerMarkupPsSpQueryDTO dto){ return returnData(R.SUCCESS.getCode(), psService.selectMarkupSpList(page, dto)); } @GetMapping("/sp/list/delete") @OperationLog(value = "删除商品加价", type = "markup_s_p") @ApiOperation(value = "删除商品加价") @ApiImplicitParams({ @ApiImplicitParam(name = "partnerId", value = "合伙人id", required = true, dataType = "Long", paramType = "query"), @ApiImplicitParam(name = "flowerId", value = "商品id", required = true, dataType = "Long", paramType = "query") }) public ResponseEntity> deleteMarkupSp(Long partnerId, Long flowerId){ psService.deleteMarkupSp(partnerId, flowerId); String content = "删除商品加价:合伙人id:【" + partnerId + "】,商品id:【"+flowerId+"】"; OperationRecord operationRecord = getOperationRecord(content); return returnData(R.SUCCESS.getCode(), null,operationRecord); } }