package cc.mrbird.febs.mall.controller;
|
|
import cc.mrbird.febs.common.entity.FebsResponse;
|
import cc.mrbird.febs.common.enumerates.DataDictionaryEnum;
|
import cc.mrbird.febs.mall.dto.AdminAgentAmountDto;
|
import cc.mrbird.febs.mall.dto.CashOutSettingDto;
|
import cc.mrbird.febs.mall.entity.DataDictionaryCustom;
|
import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper;
|
import cc.mrbird.febs.mall.service.ICommonService;
|
import cc.mrbird.febs.mall.service.ISystemService;
|
import cn.hutool.core.util.ObjectUtil;
|
import com.alibaba.fastjson.JSONObject;
|
import lombok.RequiredArgsConstructor;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.Map;
|
|
@Slf4j
|
@Validated
|
@RestController
|
@RequiredArgsConstructor
|
@RequestMapping(value = "/admin/system")
|
public class AdminSystemController {
|
|
@Autowired
|
private ISystemService systemService;
|
|
private final ICommonService commonService;
|
private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
|
|
@PostMapping(value = "/bonusSystemSetting")
|
public FebsResponse bonusSystemSetting(@RequestBody Map<String, Object> map) {
|
systemService.bonusSystemSetting(map);
|
return new FebsResponse().success().message("设置成功");
|
}
|
|
@PostMapping(value = "/cashOutSetting")
|
public FebsResponse cashOutSetting(CashOutSettingDto cashOutSettingDto) {
|
commonService.addDataDic(DataDictionaryEnum.CASHOUT_SETTING.getType(), DataDictionaryEnum.CASHOUT_SETTING.getCode(), cashOutSettingDto, "提现设置");
|
return new FebsResponse().success();
|
}
|
|
@PostMapping(value = "/agentAmountSetSetting")
|
public FebsResponse agentAmountSetSetting(AdminAgentAmountDto adminAgentAmountDto) {
|
DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
|
DataDictionaryEnum.PRICE_AMOUNT.getType(), DataDictionaryEnum.PRICE_AMOUNT.getCode()
|
);
|
|
if(ObjectUtil.isEmpty(dic)){
|
return new FebsResponse().fail().message("请刷新页面重试");
|
}
|
dic.setValue(adminAgentAmountDto.getAgentAmountValue());
|
dataDictionaryCustomMapper.updateById(dic);
|
return new FebsResponse().success();
|
}
|
}
|