package cc.mrbird.febs.dapp.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.DataDicEnum;
|
import cc.mrbird.febs.common.utils.RedisUtils;
|
import cc.mrbird.febs.dapp.dto.ZhiyaAddDto;
|
import cc.mrbird.febs.dapp.entity.DappCoinPrice;
|
import cc.mrbird.febs.dapp.entity.DappHdRecord;
|
import cc.mrbird.febs.dapp.entity.DappMemberEntity;
|
import cc.mrbird.febs.dapp.entity.PlatformBanner;
|
import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper;
|
import cc.mrbird.febs.dapp.service.DappSystemService;
|
import cc.mrbird.febs.dapp.service.IAdminBannerService;
|
import cc.mrbird.febs.dapp.vo.CoinSetVo;
|
import cc.mrbird.febs.rabbit.producer.ChainProducer;
|
import lombok.RequiredArgsConstructor;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.validation.Valid;
|
import javax.validation.constraints.NotNull;
|
import java.math.BigDecimal;
|
import java.util.Map;
|
|
@Slf4j
|
@Validated
|
@RestController
|
@RequiredArgsConstructor
|
@RequestMapping(value = "/admin/banner")
|
public class AdminBannerController extends BaseController {
|
|
private final IAdminBannerService iAdminBannerService;
|
private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
|
private final RedisUtils redisUtils;
|
private final DappSystemService dappSystemService;
|
private final ChainProducer chainProducer;
|
|
/**
|
* 质押恢复
|
*/
|
@PostMapping("zhiyaAddNew")
|
@ControllerEndpoint(operation = "质押恢复", exceptionMessage = "操作失败")
|
public FebsResponse zhiyaAddNew() {
|
return iAdminBannerService.zhiyaAddNew();
|
}
|
|
/**
|
* 质押恢复
|
*/
|
@PostMapping("zhiyaAdd")
|
@ControllerEndpoint(operation = "质押恢复", exceptionMessage = "操作失败")
|
public FebsResponse zhiyaAdd(@Valid ZhiyaAddDto zhiyaAddDto) {
|
return iAdminBannerService.zhiyaAdd(zhiyaAddDto);
|
}
|
|
/**
|
* 邀请---列表
|
*/
|
@GetMapping("inviteList")
|
public FebsResponse inviteList(DappMemberEntity dappMemberEntity, QueryRequest request) {
|
Map<String, Object> data = getDataTable(iAdminBannerService.inviteList(dappMemberEntity, request));
|
return new FebsResponse().success().data(data);
|
}
|
|
/**
|
* 价格---列表
|
*/
|
@GetMapping("coinPrice")
|
public FebsResponse coinPrice(DappCoinPrice dappCoinPrice, QueryRequest request) {
|
Map<String, Object> data = getDataTable(iAdminBannerService.findCoinPriceInPage(dappCoinPrice, request));
|
return new FebsResponse().success().data(data);
|
}
|
|
/**
|
* 价格---列表
|
*/
|
@GetMapping("hdRecord")
|
public FebsResponse hdRecord(DappHdRecord dappHdRecord, QueryRequest request) {
|
Map<String, Object> data = getDataTable(iAdminBannerService.findHdRecordInPage(dappHdRecord, request));
|
return new FebsResponse().success().data(data);
|
}
|
|
/**
|
* 价格---新增
|
* @return
|
*/
|
@GetMapping("coinPriceAdd/{price}")
|
@ControllerEndpoint(operation = "价格---新增", exceptionMessage = "操作失败")
|
public FebsResponse coinPriceAdd(@NotNull(message = "{required}") @PathVariable String price) {
|
return iAdminBannerService.coinPriceAdd(price);
|
}
|
|
/**
|
* 轮播图---列表
|
*/
|
@GetMapping("platformBanner")
|
public FebsResponse platformBanner(PlatformBanner platformBannerEntity, QueryRequest request) {
|
Map<String, Object> data = getDataTable(iAdminBannerService.findPlatformBannerInPage(platformBannerEntity, request));
|
return new FebsResponse().success().data(data);
|
}
|
|
/**
|
* 轮播图---确认
|
* @return
|
*/
|
@PostMapping("platformBannerConfirm")
|
@ControllerEndpoint(operation = "轮播图---确认", exceptionMessage = "设置失败")
|
public FebsResponse platformBannerConfirm(@Valid PlatformBanner platformBannerEntity) {
|
return iAdminBannerService.platformBannerConfirm(platformBannerEntity);
|
}
|
|
/**
|
* 轮播图---删除
|
* @return
|
*/
|
@GetMapping("platformBannerDelete/{id}")
|
@ControllerEndpoint(operation = "轮播图---删除", exceptionMessage = "删除失败")
|
public FebsResponse platformBannerDelete(@NotNull(message = "{required}") @PathVariable Long id) {
|
return iAdminBannerService.platformBannerDelete(id);
|
}
|
|
/**
|
* 轮播图---新增
|
*/
|
@PostMapping("platformBannerAdds")
|
@ControllerEndpoint(operation = "轮播图---新增", exceptionMessage = "新增失败")
|
public FebsResponse platformBannerAdds(@Valid PlatformBanner platformBannerEntity) {
|
iAdminBannerService.platformBannerAdd(platformBannerEntity);
|
return new FebsResponse().success();
|
}
|
|
@PostMapping(value = "/hdSubmit")
|
@ControllerEndpoint(operation = "滑点释放", exceptionMessage = "操作失败")
|
public FebsResponse hdSubmit() {
|
log.info("滑点奖励");
|
BigDecimal usdtAmount = new BigDecimal(
|
redisUtils.getString(DataDicEnum.GFA_HUA_DIAN_WALLET_USDT_AMOUNT.getValue())
|
).setScale(2,BigDecimal.ROUND_DOWN);
|
BigDecimal coinAmount = new BigDecimal(
|
redisUtils.getString(DataDicEnum.GFA_HUA_DIAN_WALLET_COIN_AMOUNT.getValue())
|
).setScale(2,BigDecimal.ROUND_DOWN);
|
if(BigDecimal.ZERO.compareTo(usdtAmount) > 0){
|
return new FebsResponse().fail().message("请设置钱包USDT");
|
}
|
if(BigDecimal.ZERO.compareTo(coinAmount) > 0){
|
return new FebsResponse().fail().message("请设置钱包GFA");
|
}
|
// dappSystemService.tradeProfitDistribute(1L);
|
return new FebsResponse().success().message("操作成功");
|
}
|
|
@PostMapping(value = "/cashOutSetting")
|
@ControllerEndpoint(operation = "轮播图---新增", exceptionMessage = "新增失败")
|
public FebsResponse cashOutSetting(CoinSetVo coinSetVo) {
|
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_BUY_MIN_AMOUNT.getValue(),
|
DataDicEnum.GFA_BUY_MIN_AMOUNT.getValue(),
|
coinSetVo.getMinAmount()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_BUY_MAX_AMOUNT.getValue(),
|
DataDicEnum.GFA_BUY_MAX_AMOUNT.getValue(),
|
coinSetVo.getMaxAmount()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_ACHIEVE_RELEASE.getValue(),
|
DataDicEnum.GFA_ACHIEVE_RELEASE.getValue(),
|
coinSetVo.getAchieveRelease()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_ACHIEVE_OUT.getValue(),
|
DataDicEnum.GFA_ACHIEVE_OUT.getValue(),
|
coinSetVo.getAchieveOut()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_TUAN_DUI_PERCENT.getValue(),
|
DataDicEnum.GFA_TUAN_DUI_PERCENT.getValue(),
|
coinSetVo.getTdPercent()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_TUAN_DUI_LEVEL.getValue(),
|
DataDicEnum.GFA_TUAN_DUI_LEVEL.getValue(),
|
coinSetVo.getTdLevel()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_TUAN_DUI_LEVEL_YI.getValue(),
|
DataDicEnum.GFA_TUAN_DUI_LEVEL_YI.getValue(),
|
coinSetVo.getTdLevelYi()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_TUAN_DUI_LEVEL_ER.getValue(),
|
DataDicEnum.GFA_TUAN_DUI_LEVEL_ER.getValue(),
|
coinSetVo.getTdLevelEr()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_TUAN_DUI_LEVEL_SAN.getValue(),
|
DataDicEnum.GFA_TUAN_DUI_LEVEL_SAN.getValue(),
|
coinSetVo.getTdLevelSan()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_TUAN_DUI_LEVEL_SI.getValue(),
|
DataDicEnum.GFA_TUAN_DUI_LEVEL_SI.getValue(),
|
coinSetVo.getTdLevelSi()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_TUAN_DUI_LEVEL_WU.getValue(),
|
DataDicEnum.GFA_TUAN_DUI_LEVEL_WU.getValue(),
|
coinSetVo.getTdLevelWu()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_ZHUAN_ZHANG_KAI_GUAN.getValue(),
|
DataDicEnum.GFA_ZHUAN_ZHANG_KAI_GUAN.getValue(),
|
coinSetVo.getZzkg()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.SYSTEM_START_FLAG.getValue(),
|
DataDicEnum.SYSTEM_START_FLAG.getValue(),
|
coinSetVo.getSsf()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_HUA_DIAN_WALLET_USDT_AMOUNT.getValue(),
|
DataDicEnum.GFA_HUA_DIAN_WALLET_USDT_AMOUNT.getValue(),
|
coinSetVo.getUsdtAmount()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_HUA_DIAN_WALLET_COIN_AMOUNT.getValue(),
|
DataDicEnum.GFA_HUA_DIAN_WALLET_COIN_AMOUNT.getValue(),
|
coinSetVo.getCoinAmount()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_HUA_DIAN_SELF.getValue(),
|
DataDicEnum.GFA_HUA_DIAN_SELF.getValue(),
|
coinSetVo.getHdSelf()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_HUA_DIAN_TEAM.getValue(),
|
DataDicEnum.GFA_HUA_DIAN_TEAM.getValue(),
|
coinSetVo.getHdTeam()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_HUA_DIAN_WORK.getValue(),
|
DataDicEnum.GFA_HUA_DIAN_WORK.getValue(),
|
coinSetVo.getHdWork()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_HUA_DIAN_LEVEL.getValue(),
|
DataDicEnum.GFA_HUA_DIAN_LEVEL.getValue(),
|
coinSetVo.getHdLevel()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.GFA_DAYS.getValue(),
|
DataDicEnum.GFA_DAYS.getValue(),
|
coinSetVo.getGfaDays()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.MEMBER_ZHIYA_TIME.getValue(),
|
DataDicEnum.MEMBER_ZHIYA_TIME.getValue(),
|
coinSetVo.getZhiyaTime()
|
);
|
dataDictionaryCustomMapper.updateDicValueByTypeAndCode(
|
DataDicEnum.MEMBER_ZHIYA_AMOUNT.getValue(),
|
DataDicEnum.MEMBER_ZHIYA_AMOUNT.getValue(),
|
coinSetVo.getZhiyaAmount()
|
);
|
return new FebsResponse().success();
|
}
|
}
|