package cc.mrbird.febs.mall.controller; import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; import cc.mrbird.febs.common.enumerates.GreenScoreEnum; import cc.mrbird.febs.mall.dto.*; import cc.mrbird.febs.mall.entity.DataDictionaryCustom; import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper; import cc.mrbird.febs.mall.service.IAgentService; import cc.mrbird.febs.mall.service.ICommonService; import cc.mrbird.febs.mall.service.IMemberProfitService; import cc.mrbird.febs.mall.service.ISystemService; import cc.mrbird.febs.rabbit.producter.AgentProducer; import cn.hutool.core.util.ObjectUtil; 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.math.BigDecimal; import java.util.Map; @Slf4j @Validated @RestController @RequiredArgsConstructor @RequestMapping(value = "/admin/system") public class AdminSystemController { private final ISystemService systemService; private final ICommonService commonService; private final AgentProducer agentProducer; private final DataDictionaryCustomMapper dataDictionaryCustomMapper; private final IAgentService agentService; @PostMapping(value = "/bonusSystemSetting") public FebsResponse bonusSystemSetting(@RequestBody Map 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, "提现设置"); commonService.updateDataDic( DataDictionaryEnum.BANK_TRANS_URL.getType(), DataDictionaryEnum.BANK_TRANS_URL.getCode(), cashOutSettingDto.getUrlStr()); commonService.updateDataDic( DataDictionaryEnum.BANK_TRANS_VERIFY_IP.getType(), DataDictionaryEnum.BANK_TRANS_VERIFY_IP.getCode(), cashOutSettingDto.getVerifyIp()); commonService.updateDataDic( DataDictionaryEnum.BANK_TRANS_VERIFY_PORT.getType(), DataDictionaryEnum.BANK_TRANS_VERIFY_PORT.getCode(), cashOutSettingDto.getVerifyPort()); commonService.updateDataDic( DataDictionaryEnum.BANK_TRANS_FKZH.getType(), DataDictionaryEnum.BANK_TRANS_FKZH.getCode(), cashOutSettingDto.getFkzh()); commonService.updateDataDic( DataDictionaryEnum.BANK_TRANS_customerId.getType(), DataDictionaryEnum.BANK_TRANS_customerId.getCode(), cashOutSettingDto.getCustomerId()); commonService.updateDataDic( DataDictionaryEnum.BANK_TRANS_softwareId.getType(), DataDictionaryEnum.BANK_TRANS_softwareId.getCode(), cashOutSettingDto.getSoftwareId()); return new FebsResponse().success(); } @PostMapping(value = "/scorePoor") public FebsResponse scorePoor(ScorePoorDto scorePoorDto) { commonService.addDataDic(DataDictionaryEnum.SCORE_POOR_RADIO.getType(), DataDictionaryEnum.SCORE_POOR_RADIO.getCode(), scorePoorDto, "积分池设置"); return new FebsResponse().success(); } @PostMapping(value = "/hlmScoreSet") public FebsResponse hlmScoreSet(HlmScoreSetDto hlmScoreSetDto) { commonService.updateDataDic( DataDictionaryEnum.SIGN_SCORE.getType(), DataDictionaryEnum.SIGN_SCORE.getCode(), hlmScoreSetDto.getSignScore()); commonService.updateDataDic( DataDictionaryEnum.SIGN_SCORE_DAYS.getType(), DataDictionaryEnum.SIGN_SCORE_DAYS.getCode(), hlmScoreSetDto.getSignScoreDays()); commonService.updateDataDic( DataDictionaryEnum.SIGN_SCORE_CNT.getType(), DataDictionaryEnum.SIGN_SCORE_CNT.getCode(), hlmScoreSetDto.getSignScoreCnt()); commonService.updateDataDic( DataDictionaryEnum.SCORE_PERCENT.getType(), DataDictionaryEnum.SCORE_PERCENT.getCode(), hlmScoreSetDto.getScorePercent()); commonService.updateDataDic( DataDictionaryEnum.SCORE_CHANGE.getType(), DataDictionaryEnum.SCORE_CHANGE.getCode(), hlmScoreSetDto.getScoreChange()); commonService.updateDataDic( DataDictionaryEnum.STAR_GET.getType(), DataDictionaryEnum.STAR_GET.getCode(), hlmScoreSetDto.getStarGet()); return new FebsResponse().success(); } @PostMapping(value = "/hlmBasicPerk") public FebsResponse hlmBasicPerk(HlmBasicPerkDto hlmBasicPerkDto) { commonService.updateDataDic( DataDictionaryEnum.SHARE_PERK.getType(), DataDictionaryEnum.SHARE_PERK.getCode(), hlmBasicPerkDto.getSharePerk()); commonService.updateDataDic( DataDictionaryEnum.TEAM_PERK.getType(), DataDictionaryEnum.TEAM_PERK.getCode(), hlmBasicPerkDto.getTeamPerk()); commonService.updateDataDic( DataDictionaryEnum.TEAM_EQUALS_PERK.getType(), DataDictionaryEnum.TEAM_EQUALS_PERK.getCode(), hlmBasicPerkDto.getTeamEqualsPerk()); commonService.updateDataDic( DataDictionaryEnum.OFFLINE_PERK.getType(), DataDictionaryEnum.OFFLINE_PERK.getCode(), hlmBasicPerkDto.getOffLinePerk()); commonService.updateDataDic( DataDictionaryEnum.AGENT_PERK.getType(), DataDictionaryEnum.AGENT_PERK.getCode(), hlmBasicPerkDto.getAgentPerk()); commonService.updateDataDic( DataDictionaryEnum.PERK_AGENT_ACHIEVE_TOTAL.getType(), DataDictionaryEnum.PERK_AGENT_ACHIEVE_TOTAL.getCode(), hlmBasicPerkDto.getPerkAgentAchieveTotal()); commonService.updateDataDic( DataDictionaryEnum.PERK_AGENT_ACHIEVE_PERCENT.getType(), DataDictionaryEnum.PERK_AGENT_ACHIEVE_PERCENT.getCode(), hlmBasicPerkDto.getPerkAgentAchievePercent()); return new FebsResponse().success(); } @PostMapping(value = "/hlmVoucherSet") public FebsResponse hlmVoucherSet(HlmVoucherSetDto hlmVoucherSetDto) { BigDecimal roleReleasePercent = new BigDecimal(hlmVoucherSetDto.getRoleReleasePercent()); if(roleReleasePercent.compareTo(BigDecimal.ZERO) <= 0 || roleReleasePercent.compareTo(new BigDecimal(1000)) >= 0){ return new FebsResponse().fail().message("请输入合理的比例"); } commonService.updateDataDic( GreenScoreEnum.ROLE_RELEASE_PERCENT.getType(), GreenScoreEnum.ROLE_RELEASE_PERCENT.getCode(), hlmVoucherSetDto.getRoleReleasePercent()); commonService.updateDataDic( GreenScoreEnum.ACHIEVE_RELEASE_PERCENT.getType(), GreenScoreEnum.ACHIEVE_RELEASE_PERCENT.getCode(), hlmVoucherSetDto.getAchieveReleasePercent()); commonService.updateDataDic( GreenScoreEnum.ACHIEVE_RELEASE.getType(), GreenScoreEnum.ACHIEVE_RELEASE.getCode(), hlmVoucherSetDto.getAchieveRelease()); commonService.updateDataDic( GreenScoreEnum.ACHIEVE_MAX.getType(), GreenScoreEnum.ACHIEVE_MAX.getCode(), hlmVoucherSetDto.getAchieveMax()); commonService.updateDataDic( GreenScoreEnum.ACHIEVE_MIN.getType(), GreenScoreEnum.ACHIEVE_MIN.getCode(), hlmVoucherSetDto.getAchieveMin()); commonService.updateDataDic( GreenScoreEnum.ROLE_ACHIEVE_PERCENT.getType(), GreenScoreEnum.ROLE_ACHIEVE_PERCENT.getCode(), hlmVoucherSetDto.getRoleAchievePercent()); commonService.updateDataDic( GreenScoreEnum.STAR_ACHIEVE_PERCENT.getType(), GreenScoreEnum.STAR_ACHIEVE_PERCENT.getCode(), hlmVoucherSetDto.getStarAchievePercent()); commonService.updateDataDic( GreenScoreEnum.LEVEL_ACHIEVE_PERCENT.getType(), GreenScoreEnum.LEVEL_ACHIEVE_PERCENT.getCode(), hlmVoucherSetDto.getLevelAchievePercent()); return new FebsResponse().success(); } @PostMapping(value = "/hlmVoucherButton") public FebsResponse hlmVoucherButton(HlmVoucherButtonDto hlmVoucherButtonDto) { BigDecimal scorePrice = new BigDecimal(hlmVoucherButtonDto.getScorePrice()); if(scorePrice.compareTo(BigDecimal.ZERO) <= 0){ return new FebsResponse().fail().message("请输入合理的价格"); } BigDecimal voucherPercent = new BigDecimal(hlmVoucherButtonDto.getVoucherPercent()); if(voucherPercent.compareTo(BigDecimal.ZERO) <= 0){ return new FebsResponse().fail().message("请输入合理的价格"); } commonService.updateDataDic( GreenScoreEnum.SCORE_PRICE.getType(), GreenScoreEnum.SCORE_PRICE.getCode(), hlmVoucherButtonDto.getScorePrice()); commonService.updateDataDic( GreenScoreEnum.VOUCHER_ON_OFF.getType(), GreenScoreEnum.VOUCHER_ON_OFF.getCode(), hlmVoucherButtonDto.getVoucherOnOff()); commonService.updateDataDic( GreenScoreEnum.VOUCHER_PERCENT.getType(), GreenScoreEnum.VOUCHER_PERCENT.getCode(), hlmVoucherButtonDto.getVoucherPercent()); return new FebsResponse().success(); } @PostMapping(value = "/selaHalfVoucher") public FebsResponse selaHalfVoucher() { DataDictionaryCustom scorePriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( GreenScoreEnum.SCORE_PRICE.getType(), GreenScoreEnum.SCORE_PRICE.getCode() ); agentProducer.sendForceVoucherSaleMsg(scorePriceDic.getValue()); return new FebsResponse().success(); } @PostMapping(value = "/hlmAchieveSet") public FebsResponse hlmAchieveSet(HlmVoucherButtonDto hlmVoucherButtonDto) { BigDecimal jobAchieveReleasePercent = new BigDecimal(hlmVoucherButtonDto.getJobAchieveReleasePercent()); if(jobAchieveReleasePercent.compareTo(BigDecimal.ZERO) <= 0){ return new FebsResponse().fail().message("请输入合理的数字"); } commonService.updateDataDic( GreenScoreEnum.JOB_ACHIEVE_RELEASE_PERCENT.getType(), GreenScoreEnum.JOB_ACHIEVE_RELEASE_PERCENT.getCode(), hlmVoucherButtonDto.getJobAchieveReleasePercent()); return new FebsResponse().success(); } @PostMapping(value = "/hlmAchieveButton") public FebsResponse hlmAchieveButton() { agentService.achieveReleasePercent(); return new FebsResponse().success(); } }