//package com.fzm.mall.server.admin.goods_center.controller;
//
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.fzm.mall.server.admin.annotation.AdminLog;
//import com.fzm.mall.server.admin.enums.log.OperateModuleEnum;
//import com.fzm.mall.server.admin.enums.log.OperateTypeEnum;
//import com.fzm.mall.server.admin.goods_center.entity.dto.IntegralDTO;
//import com.fzm.mall.server.admin.goods_center.entity.dto.OnOffDTO;
//import com.fzm.mall.server.admin.goods_center.entity.dto.StockDTO;
//import com.fzm.mall.server.admin.goods_center.entity.vo.IntegralExchangeVO;
//import com.fzm.mall.server.admin.goods_center.model.IntegralExchange;
//import com.fzm.mall.server.admin.goods_center.service.IIntegralExchangeService;
//import com.fzm.mall.server.admin.home_page.enums.type.AdminTypeEnum;
//import com.fzm.mall.server.admin.home_page.service.IAdminService;
//import com.fzm.mall.server.admin.repo.ResponseFactory;
//import com.fzm.mall.server.admin.repo.ResponseVO;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import lombok.RequiredArgsConstructor;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//
///**
// * @author wangp
// * @date 2021/5/27 10:51
// * @description 积分商品列表
// * @since JDK 1.8
// */
//@Api(tags = "商品中心-积分商品列表")
//@RestController
//@RequestMapping("/integralGoodsList")
//@RequiredArgsConstructor(onConstructor = @__(@Autowired))
//public class IntegralGoodsListController {
//
//    private final IIntegralExchangeService ieService;
//    private final IAdminService adminService;
//    private final ResponseFactory resFac;
//
//    @ApiOperation(value = "分页查询")
//    @GetMapping("/page")
//    public ResponseVO page(
//            @ApiParam(name = "goodsId", value = "商品编号")
//            @RequestParam(required = false) String goodsId,
//            @ApiParam(name = "goodsName", value = "商品名称")
//            @RequestParam(required = false) String goodsName,
//            @ApiParam(name = "addTimeHead", value = "开始时间")
//            @RequestParam(required = false) Long addTimeHead,
//            @ApiParam(name = "addTimeTail", value = "结束时间")
//            @RequestParam(required = false) Long addTimeTail,
//            @ApiParam(name = "pageNum", value = "当前页数")
//            @RequestParam Integer pageNum,
//            @ApiParam(name = "pageSize", value = "每页个数")
//            @RequestParam Integer pageSize,
//            @ApiParam(name = "adminId", value = "管理员id")
//            @RequestHeader String adminId) {
//        adminService.adminAuthCheck(adminId, AdminTypeEnum.PLATFORM_MERCHANT.getType());
//        String merchantId = adminService.getByAdminId(adminId).getMerchantId();
//        IPage<IntegralExchangeVO> page = ieService.page(merchantId, goodsId, goodsName,
//                addTimeHead, addTimeTail, pageNum, pageSize);
//        return resFac.getSuccessResponseWithData(page);
//    }
//
//    @ApiOperation(value = "上下架")
//    @AdminLog(description = "商品中心-积分兑换商品上下架", module = OperateModuleEnum.GOODS_CENTER, opType = OperateTypeEnum.ON_OFF)
//    @PutMapping("/onOff")
//    public ResponseVO onOff(@RequestBody OnOffDTO onOffDTO, @ApiParam(name = "adminId", value = "管理员id")
//    @RequestHeader String adminId) {
//        adminService.adminAuthCheck(adminId, AdminTypeEnum.PLATFORM_MERCHANT.getType());
//        ieService.onOff(onOffDTO);
//        return resFac.getSimpleSuccessResponse();
//    }
//
//    @ApiOperation(value = "修改库存")
//    @AdminLog(description = "商品中心-修改积分兑换商品库存", module = OperateModuleEnum.GOODS_CENTER, opType = OperateTypeEnum.REPAIR_INTEGRAL_STOCK)
//    @PutMapping("/repairStock")
//    public ResponseVO repairStock(@RequestBody StockDTO stockDTO, @ApiParam(name = "adminId", value = "管理员id")
//    @RequestHeader String adminId) {
//        adminService.adminAuthCheck(adminId, AdminTypeEnum.PLATFORM_MERCHANT.getType());
//        ieService.stock(stockDTO);
//        return resFac.getSimpleSuccessResponse();
//    }
//
//    @ApiOperation(value = "修改积分值")
//    @AdminLog(description = "商品中心-修改积分兑换商品积分值", module = OperateModuleEnum.GOODS_CENTER, opType = OperateTypeEnum.REPAIR_INTEGRAL_VALUE)
//    @PutMapping("/repairIntegral")
//    public ResponseVO repairIntegral(@RequestBody IntegralDTO integralDTO, @ApiParam(name = "adminId", value = "管理员id")
//    @RequestHeader String adminId) {
//        adminService.adminAuthCheck(adminId, AdminTypeEnum.PLATFORM_MERCHANT.getType());
//        ieService.integral(integralDTO);
//        return resFac.getSimpleSuccessResponse();
//    }
//
//    @ApiOperation(value = "删除")
//    @AdminLog(description = "商品中心-删除积分兑换商品", module = OperateModuleEnum.GOODS_CENTER, opType = OperateTypeEnum.DEFAULT_FIRST)
//    @DeleteMapping("/delete/{goodsId}")
//    public ResponseVO delete(@PathVariable String goodsId, @ApiParam(name = "adminId", value = "管理员id")
//    @RequestHeader String adminId) {
//        adminService.adminAuthCheck(adminId, AdminTypeEnum.PLATFORM_MERCHANT.getType());
//        ieService.delete(goodsId);
//        return resFac.getSimpleSuccessResponse();
//    }
//
//    @ApiOperation(value = "批量删除")
//    @AdminLog(description = "商品中心-批量删除积分兑换商品", module = OperateModuleEnum.GOODS_CENTER, opType = OperateTypeEnum.DEFAULT_FIRST)
//    @DeleteMapping("/deleteBatch")
//    public ResponseVO deleteBatch(@RequestBody List<String> goodsIds, @ApiParam(name = "adminId", value = "管理员id")
//    @RequestHeader String adminId) {
//        adminService.adminAuthCheck(adminId, AdminTypeEnum.PLATFORM_MERCHANT.getType());
//        ieService.deleteBatch(goodsIds);
//        return resFac.getSimpleSuccessResponse();
//    }
//
//    @ApiOperation(value = "商品描述")
//    @DeleteMapping("/describe/{goodsId}")
//    public ResponseVO describe(@PathVariable String goodsId, @ApiParam(name = "adminId", value = "管理员id")
//    @RequestHeader String adminId) {
//        adminService.adminAuthCheck(adminId, AdminTypeEnum.PLATFORM_MERCHANT.getType());
//        IntegralExchange exchange = ieService.getByGoodsId(goodsId);
//        return resFac.getSuccessResponseWithData(exchange.getDescription());
//    }
//}
