游戏薪资官方提现方式配置
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
package com.accompany.admin.service.guildgame;
|
||||
|
||||
import com.accompany.admin.service.system.AdminUserService;
|
||||
import com.accompany.admin.vo.guild.GuildUsdWithdrawAccountConfigAdminVo;
|
||||
import com.accompany.business.constant.CountryEnum;
|
||||
import com.accompany.business.constant.guild.GuildWithdrawAccountTypeEnum;
|
||||
import com.accompany.business.model.guildgame.GameUsdWithdrawAccountConfig;
|
||||
import com.accompany.business.service.guildgame.GameUsdWithdrawAccountConfigService;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
import com.accompany.core.enumeration.PartitionEnum;
|
||||
import com.accompany.core.exception.AdminServiceException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class GameUsdWithdrawAccountConfigAdminService {
|
||||
|
||||
@Autowired
|
||||
private GameUsdWithdrawAccountConfigService service;
|
||||
@Autowired
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
public Page<GuildUsdWithdrawAccountConfigAdminVo> page(Integer partitionId, String accountType, String country, int pageNo, int pageSize) {
|
||||
Page<GuildUsdWithdrawAccountConfigAdminVo> voPage = new Page<>(pageNo, pageSize);
|
||||
|
||||
Page<GameUsdWithdrawAccountConfig> page = new Page<>(pageNo, pageSize);
|
||||
LambdaQueryWrapper<GameUsdWithdrawAccountConfig> queryWrapper = new LambdaQueryWrapper<GameUsdWithdrawAccountConfig>()
|
||||
.eq(null != partitionId, GameUsdWithdrawAccountConfig::getPartitionId, partitionId)
|
||||
.eq(StringUtils.hasText(accountType), GameUsdWithdrawAccountConfig::getAccountType, accountType)
|
||||
.eq(StringUtils.hasText(country), GameUsdWithdrawAccountConfig::getCountry, country)
|
||||
.orderByAsc(GameUsdWithdrawAccountConfig::getSeq);
|
||||
service.page(page, queryWrapper);
|
||||
|
||||
if (CollectionUtils.isEmpty(page.getRecords())){
|
||||
return voPage;
|
||||
}
|
||||
|
||||
Map<Integer, String> adminNameMap = adminUserService.adminUserMap();
|
||||
|
||||
List<GuildUsdWithdrawAccountConfigAdminVo> voList = page.getRecords().stream().map(po->{
|
||||
GuildUsdWithdrawAccountConfigAdminVo vo = new GuildUsdWithdrawAccountConfigAdminVo();
|
||||
vo.setPartitionId(po.getPartitionId());
|
||||
vo.setPartitionDesc(PartitionEnum.getByPartitionId(po.getPartitionId()).getDesc());
|
||||
|
||||
vo.setAccountType(po.getAccountType());
|
||||
vo.setAccountTypeDesc(GuildWithdrawAccountTypeEnum.valueOf(po.getAccountType()).getType());
|
||||
|
||||
vo.setCountry(po.getCountry());
|
||||
vo.setCountryDesc(CountryEnum.valueOf(po.getCountry()).getName());
|
||||
|
||||
vo.setCurrency(po.getCurrency());
|
||||
vo.setUsdRatio(po.getUsdRatio());
|
||||
vo.setFeeRate(po.getFeeRate());
|
||||
vo.setEnable(po.getEnable());
|
||||
vo.setSeq(po.getSeq());
|
||||
|
||||
vo.setUpdateTime(DateTimeUtil.convertDateTime(po.getUpdateTime()));
|
||||
|
||||
vo.setAdminId(po.getAdminId());
|
||||
vo.setAdminName(adminNameMap.get(po.getAdminId()));
|
||||
|
||||
return vo;
|
||||
}).toList();
|
||||
|
||||
voPage.setRecords(voList);
|
||||
voPage.setTotal(page.getTotal());
|
||||
return voPage;
|
||||
}
|
||||
|
||||
public void save(Integer partitionId, String accountType, String country,
|
||||
BigDecimal usdRatio, BigDecimal withdrawRate,
|
||||
Boolean enable, Integer seq, int adminId) {
|
||||
GameUsdWithdrawAccountConfig config = service.lambdaQuery()
|
||||
.eq(GameUsdWithdrawAccountConfig::getPartitionId, partitionId)
|
||||
.eq(GameUsdWithdrawAccountConfig::getAccountType, accountType)
|
||||
.eq(GameUsdWithdrawAccountConfig::getCountry, country)
|
||||
.one();
|
||||
if (null == config){
|
||||
throw new AdminServiceException(BusiStatus.PARAMERROR);
|
||||
}
|
||||
|
||||
service.lambdaUpdate()
|
||||
.eq(GameUsdWithdrawAccountConfig::getPartitionId, partitionId)
|
||||
.eq(GameUsdWithdrawAccountConfig::getAccountType, accountType)
|
||||
.eq(GameUsdWithdrawAccountConfig::getCountry, country)
|
||||
.set(GameUsdWithdrawAccountConfig::getUsdRatio, usdRatio)
|
||||
.set(GameUsdWithdrawAccountConfig::getFeeRate, withdrawRate)
|
||||
.set(GameUsdWithdrawAccountConfig::getEnable, enable)
|
||||
.set(GameUsdWithdrawAccountConfig::getSeq, seq)
|
||||
.set(GameUsdWithdrawAccountConfig::getUpdateTime, new Date())
|
||||
.set(GameUsdWithdrawAccountConfig::getAdminId, adminId)
|
||||
.update();
|
||||
}
|
||||
}
|
@@ -0,0 +1,107 @@
|
||||
package com.accompany.admin.controller.guildgame;
|
||||
|
||||
import com.accompany.admin.controller.BaseController;
|
||||
import com.accompany.admin.service.guildgame.GameUsdWithdrawAccountConfigAdminService;
|
||||
import com.accompany.admin.vo.guild.GuildUsdWithdrawAccountConfigAdminVo;
|
||||
import com.accompany.business.constant.guild.GuildWithdrawAccountTypeEnum;
|
||||
import com.accompany.business.vo.guild.AgencyWithdrawExamineVo;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.core.exception.AdminServiceException;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin/gameUsdWithdrawAccountConfig")
|
||||
public class GameUsdWithdrawAccountConfigController extends BaseController {
|
||||
@Autowired
|
||||
private GameUsdWithdrawAccountConfigAdminService service;
|
||||
|
||||
@ApiOperation("渠道列表")
|
||||
@GetMapping("/listAccountType")
|
||||
public BusiResult<List<Map<String, Object>>> listAccountType() {
|
||||
List<Map<String, Object>> voList = Arrays.stream(GuildWithdrawAccountTypeEnum.values())
|
||||
.map(typeEnum ->
|
||||
Map.of("value", typeEnum.name(), "name", typeEnum.getType(), "partitionFlag", typeEnum.getPartitionFlag(), "country", typeEnum.getCountry())
|
||||
).toList();
|
||||
return BusiResult.success(voList);
|
||||
}
|
||||
|
||||
@ApiOperation("列表")
|
||||
@GetMapping("/page")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "partitionId", value = "分区id"),
|
||||
@ApiImplicitParam(name = "accountType", value = "渠道账户类型"),
|
||||
@ApiImplicitParam(name = "country", value = "国家代码"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "页码", required = true),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页长", required = true),
|
||||
})
|
||||
public BusiResult<Page<GuildUsdWithdrawAccountConfigAdminVo>> page(Integer partitionId,
|
||||
String accountType,
|
||||
String country,
|
||||
int pageNo, int pageSize) {
|
||||
Page<GuildUsdWithdrawAccountConfigAdminVo> page = service.page(partitionId, accountType, country, pageNo, pageSize);
|
||||
return BusiResult.success(page);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@ApiOperation("导出")
|
||||
@PostMapping("/export")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "partitionId", value = "分区id"),
|
||||
@ApiImplicitParam(name = "accountType", value = "渠道账户类型"),
|
||||
@ApiImplicitParam(name = "country", value = "国家代码"),
|
||||
})
|
||||
public void export(HttpServletResponse response,
|
||||
Integer partitionId, String accountType, String country) {
|
||||
Page<GuildUsdWithdrawAccountConfigAdminVo> page = service.page(partitionId, accountType, country, 1, -1);
|
||||
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码
|
||||
String excelName = URLEncoder.encode("游戏usd官方提现渠道配置", StandardCharsets.UTF_8);
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + excelName + ExcelTypeEnum.XLSX.getValue());
|
||||
EasyExcel.write(response.getOutputStream(), AgencyWithdrawExamineVo.class).sheet("游戏usd官方提现渠道配置").doWrite(page.getRecords());
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@GetMapping("/save")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "partitionId", value = "分区id", required = true),
|
||||
@ApiImplicitParam(name = "accountType", value = "渠道账户类型", required = true),
|
||||
@ApiImplicitParam(name = "country", value = "国家代码", required = true),
|
||||
@ApiImplicitParam(name = "usdRatio", value = "美元汇率", required = true),
|
||||
@ApiImplicitParam(name = "withdrawRate", value = "提现手续费", required = true),
|
||||
@ApiImplicitParam(name = "seq", value = "顺序", required = true),
|
||||
})
|
||||
public BusiResult<Void> save(Integer partitionId, String accountType, String country,
|
||||
BigDecimal usdRatio, BigDecimal withdrawRate, Boolean enable, Integer seq) {
|
||||
if (null == partitionId ||
|
||||
!StringUtils.hasText(accountType) || !StringUtils.hasText(country) ||
|
||||
null == usdRatio || null == withdrawRate || null == seq){
|
||||
throw new AdminServiceException(BusiStatus.PARAMERROR);
|
||||
}
|
||||
int adminId = getAdminId();
|
||||
service.save(partitionId, accountType, country, usdRatio, withdrawRate, enable, seq, adminId);
|
||||
return BusiResult.success();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user