package cc.mrbird.febs.mall.controller; import cc.mrbird.febs.common.annotation.ControllerEndpoint; import cc.mrbird.febs.common.controller.BaseController; import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.common.entity.QueryRequest; import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; import cc.mrbird.febs.common.enumerates.ProductEnum; import cc.mrbird.febs.mall.dto.*; import cc.mrbird.febs.mall.entity.*; import cc.mrbird.febs.mall.mapper.MallMemberSpeakMapper; import cc.mrbird.febs.mall.mapper.MallProductNftMapper; import cc.mrbird.febs.mall.service.ICommonService; import cc.mrbird.febs.mall.service.IMallNewsInfoService; import cc.mrbird.febs.mall.vo.AdminMallProductNftVo; import cc.mrbird.febs.mall.vo.AdminMallProductSellPickVo; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.management.Query; import javax.validation.Valid; import javax.validation.constraints.NotNull; import java.util.List; import java.util.Map; /** * @author wzy * @date 2022-05-13 **/ @Slf4j @Validated @RestController @RequiredArgsConstructor @RequestMapping(value = "/admin/news") public class AdminNewsInfoController extends BaseController { private final IMallNewsInfoService mallNewsInfoService; private final MallProductNftMapper mallProductNftMapper; private final MallMemberSpeakMapper mallMemberSpeakMapper; private final ICommonService commonService; /** * 用户留言 */ @GetMapping("getSpeakList") public FebsResponse getSpeakList(MallMemberSpeak mallMemberSpeak, QueryRequest request) { Map data = getDataTable(mallNewsInfoService.getSpeakList(mallMemberSpeak, request)); return new FebsResponse().success().data(data); } /** * 用户留言 * @param id * @return */ @PostMapping(value = "/speakState/{id}") public FebsResponse speakState(@PathVariable Long id) { MallMemberSpeak mallMemberSpeak = mallMemberSpeakMapper.selectById(id); mallMemberSpeak.setState(ProductEnum.SPEAK_DEAL.getValue()); mallMemberSpeakMapper.updateById(mallMemberSpeak); return new FebsResponse().success(); } /** * NFT预约产品 */ @GetMapping("getProductNFTList") public FebsResponse getProductNFTList(MallProductNft mallProductNft, QueryRequest request) { Map data = getDataTable(mallNewsInfoService.getProductNFTList(mallProductNft, request)); return new FebsResponse().success().data(data); } /** * NFT预约产品-新增 */ @PostMapping("addProductNFT") @ControllerEndpoint(operation = "NFT预约产品-新增", exceptionMessage = "操作失败") public FebsResponse addProductNFT(@Valid AdminMallProductNftDto adminMallProductNftDto) { return mallNewsInfoService.addProductNFT(adminMallProductNftDto); } @PostMapping(value = "/upNFT/{id}") public FebsResponse upNFT(@PathVariable Long id) { MallProductNft mallProductNft = mallProductNftMapper.selectById(id); mallProductNft.setState(ProductEnum.PRODUCT_NFT_OPEN.getValue()); mallProductNftMapper.updateById(mallProductNft); return new FebsResponse().success(); } @PostMapping(value = "/unUpNFT/{id}") public FebsResponse unUpNFT(@PathVariable Long id) { MallProductNft mallProductNft = mallProductNftMapper.selectById(id); mallProductNft.setState(ProductEnum.PRODUCT_NFT_CLOSE.getValue()); mallProductNftMapper.updateById(mallProductNft); return new FebsResponse().success(); } /** * NFT预约产品-删除 */ @GetMapping("delNFT/{id}") @ControllerEndpoint(operation = " 新闻中心-删除", exceptionMessage = "操作失败") public FebsResponse delNFT(@NotNull(message = "{required}") @PathVariable Long id) { return mallNewsInfoService.delNFT(id); } /** * NFT预约产品-更新 */ @PostMapping("nftInfoUpdate") @ControllerEndpoint(operation = "NFT预约产品-更新", exceptionMessage = "操作失败") public FebsResponse nftInfoUpdate(@Valid MallProductNft mallProductNft) { return mallNewsInfoService.nftInfoUpdate(mallProductNft); } /** * 用户NFT预约列表 */ @GetMapping("getBuyList") public FebsResponse getBuyList(MallProductBuy mallProductBuy, QueryRequest request) { Map data = getDataTable(mallNewsInfoService.getBuyList(mallProductBuy, request)); return new FebsResponse().success().data(data); } /** * 用户NFT预约子记录列表 */ @GetMapping("getBuyRecordList") public FebsResponse getBuyRecordList(MallProductBuy mallProductBuy, QueryRequest request) { Map data = getDataTable(mallNewsInfoService.getBuyRecordList(mallProductBuy, request)); return new FebsResponse().success().data(data); } /** * 用户NFT提现列表 */ @GetMapping("getSellList") public FebsResponse getSellList(MallProductSell mallProductSell, QueryRequest request) { Map data = getDataTable(mallNewsInfoService.getSellList(mallProductSell, request)); return new FebsResponse().success().data(data); } /** * 用户NFT提现-匹配提现用户列表 * @return */ @GetMapping(value = "findSellList") public FebsResponse findSellList() { List categories = mallNewsInfoService.findSellList(); return new FebsResponse().success().data(categories); } /** * 用户NFT提现-手动分配 */ @PostMapping("pickSellRecord") @ControllerEndpoint(operation = "用户NFT提现-手动分配", exceptionMessage = "操作失败") public FebsResponse pickSellRecord(@Valid AdminPickSellRecordDtoDto pickSellRecordDto) { return mallNewsInfoService.pickSellRecord(pickSellRecordDto); } /** * 用户NFT提现-取消 */ @GetMapping("buyRecordCancel/{id}") @ControllerEndpoint(operation = " 用户NFT提现-取消", exceptionMessage = "操作失败") public FebsResponse buyRecordCancel(@NotNull(message = "{required}") @PathVariable Long id) { return mallNewsInfoService.buyRecordCancel(id); } /** * 用户NFT提现-确认支付 */ @PostMapping("buyRecordPay") @ControllerEndpoint(operation = "用户NFT提现-确认支付", exceptionMessage = "操作失败") public FebsResponse buyRecordPay(@Valid AdminBuyRecordPayDto buyRecordPayDto) { return mallNewsInfoService.buyRecordPay(buyRecordPayDto); } /** * 用户NFT提现-确认收款 */ @GetMapping("buyRecordConfirm/{id}") @ControllerEndpoint(operation = " 用户NFT提现-确认收款", exceptionMessage = "操作失败") public FebsResponse buyRecordConfirm(@NotNull(message = "{required}") @PathVariable Long id) { return mallNewsInfoService.buyRecordConfirm(id); } /** * 基础设置 * @param gfaBasicSetDto * @return */ @PostMapping(value = "/gfaBasicSet") public FebsResponse gfaBasicSet(AdminGfaBasicSetDto gfaBasicSetDto) { commonService.updateDataDic( DataDictionaryEnum.YU_YUE_START_TIME.getType(), DataDictionaryEnum.YU_YUE_START_TIME.getCode(), gfaBasicSetDto.getStartTime()); commonService.updateDataDic( DataDictionaryEnum.YU_YUE_END_TIME.getType(), DataDictionaryEnum.YU_YUE_END_TIME.getCode(), gfaBasicSetDto.getEndTime()); commonService.updateDataDic( DataDictionaryEnum.MEMBER_FROZEN_FCM_CNT.getType(), DataDictionaryEnum.MEMBER_FROZEN_FCM_CNT.getCode(), gfaBasicSetDto.getFrozenFcmCnt()); commonService.updateDataDic( DataDictionaryEnum.OUT_FCM_FEE.getType(), DataDictionaryEnum.OUT_FCM_FEE.getCode(), gfaBasicSetDto.getOutFcmFee()); commonService.updateDataDic( DataDictionaryEnum.INSURE_END_MINUTE.getType(), DataDictionaryEnum.INSURE_END_MINUTE.getCode(), gfaBasicSetDto.getMinuteCnt()); // commonService.updateDataDic( // DataDictionaryEnum.FCM_PRICE.getType(), // DataDictionaryEnum.FCM_PRICE.getCode(), // gfaBasicSetDto.getFcmPrice()); // commonService.updateDataDic( // DataDictionaryEnum.FCM_DESTORY_CNT.getType(), // DataDictionaryEnum.FCM_DESTORY_CNT.getCode(), // gfaBasicSetDto.getFcmDesToryCnt()); // commonService.updateDataDic( // DataDictionaryEnum.FCM_DESTORY_TOTAL.getType(), // DataDictionaryEnum.FCM_DESTORY_TOTAL.getCode(), // gfaBasicSetDto.getFcmDesToryTotal()); commonService.updateDataDic( DataDictionaryEnum.NFT_FEE.getType(), DataDictionaryEnum.NFT_FEE.getCode(), gfaBasicSetDto.getNftFee()); commonService.updateDataDic( DataDictionaryEnum.OUT_FCM_MIN.getType(), DataDictionaryEnum.OUT_FCM_MIN.getCode(), gfaBasicSetDto.getOutFcmMin()); commonService.updateDataDic( DataDictionaryEnum.NFT_MIN.getType(), DataDictionaryEnum.NFT_MIN.getCode(), gfaBasicSetDto.getNftMin()); return new FebsResponse().success(); } /** * 新闻中心-列表 * @param mallNewsInfo * @param request * @return */ @GetMapping("getNewInfoList") public FebsResponse getNewInfoList(MallNewsInfo mallNewsInfo, QueryRequest request) { Map data = getDataTable(mallNewsInfoService.getNewInfoList(mallNewsInfo, request)); return new FebsResponse().success().data(data); } /** * 新闻中心-新增 */ @PostMapping("addNewsInfo") @ControllerEndpoint(operation = " 新闻中心-新增", exceptionMessage = "操作失败") public FebsResponse addNewsInfo(@Valid MallNewsInfoDto mallNewsInfoDto) { return mallNewsInfoService.addNewsInfo(mallNewsInfoDto); } /** * 新闻中心-删除 */ @GetMapping("delNewsInfo/{id}") @ControllerEndpoint(operation = " 新闻中心-删除", exceptionMessage = "操作失败") public FebsResponse delNewsInfo(@NotNull(message = "{required}") @PathVariable Long id) { return mallNewsInfoService.delNewsInfo(id); } /** * 新闻中心-更新 */ @PostMapping("updateNewsInfo") @ControllerEndpoint(operation = "新闻中心-更新", exceptionMessage = "操作失败") public FebsResponse updateNewsInfo(@Valid MallNewsInfoDto mallNewsInfoDto) { return mallNewsInfoService.updateNewsInfo(mallNewsInfoDto); } @GetMapping("findNewsCategoryList") @ControllerEndpoint(operation = "新闻分类列表", exceptionMessage = "获取失败") public FebsResponse findNewsCategoryList(MallNewsCategory mallNewsCategory, QueryRequest request) { return new FebsResponse().success().data(getDataTable(mallNewsInfoService.findNewsCategoryInPage(mallNewsCategory, request))); } @PostMapping("addOrModifyNewsCategory") @ControllerEndpoint(operation = "新闻分类", exceptionMessage = "新增失败") public FebsResponse addOrModifyNewsCategory(MallNewsCategory mallNewsCategory) { mallNewsInfoService.addOrModifyNewsCategory(mallNewsCategory); return new FebsResponse().success().message("新增成功"); } /** * 新闻分类-删除 */ @GetMapping("delNewsCategoryInfo/{id}") @ControllerEndpoint(operation = "新闻分类-删除", exceptionMessage = "操作失败") public FebsResponse delNewsCategoryInfo(@NotNull(message = "{required}") @PathVariable Long id) { return mallNewsInfoService.delNewsCategoryInfo(id); } @GetMapping(value = "findAllCategoryList") public FebsResponse findAllCategoryList() { List categories = mallNewsInfoService.findAllCategory(); return new FebsResponse().success().data(categories); } @PostMapping(value = "/topNews/{id}") public FebsResponse topNews(@PathVariable Long id) { MallNewsInfo mallNewsInfo = new MallNewsInfo(); mallNewsInfo.setIsTop(1); mallNewsInfo.setId(id); mallNewsInfoService.updateById(mallNewsInfo); return new FebsResponse().success(); } @PostMapping(value = "/unTopNews/{id}") public FebsResponse unTopNews(@PathVariable Long id) { MallNewsInfo mallNewsInfo = new MallNewsInfo(); mallNewsInfo.setIsTop(2); mallNewsInfo.setId(id); mallNewsInfoService.updateById(mallNewsInfo); return new FebsResponse().success(); } }