This commit is contained in:
lu7213 committed 2026-05-10 06:53:27 -04:00
1 parent b77f5b0701
commit a19f0e8e46
1 file changed
+33 -35
@@ -1,29 +1,27 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.luqj.util.HttpHelper;
import com.ruoyi.common.select.SelectItem;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.DmPlayerConfig;
import com.ruoyi.system.domain.DmPlayerConfigPlus;
import com.ruoyi.system.mapper.DmPlayerConfigMapper;
import com.ruoyi.system.service.IDmPlayerConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.*; import java.util.*;
import com.luqj.util.HttpHelper;
import com.ruoyi.common.utils.StringUtils;
import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DmPlayerConfigMapper;
import com.ruoyi.system.domain.DmPlayerConfig;
import com.ruoyi.system.domain.DmPlayerConfigPlus;
import com.ruoyi.system.service.IDmPlayerConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import com.ruoyi.common.select.SelectItem;
/** /**
* 玩家配置Service业务层处理 * 玩家配置Service业务层处理
* *
@@ -32,8 +30,7 @@ import com.ruoyi.common.select.SelectItem;
*/ */
@Slf4j @Slf4j
@Service @Service
public class DmPlayerConfigServiceImpl extends ServiceImpl<DmPlayerConfigMapper, DmPlayerConfigPlus> implements IDmPlayerConfigService public class DmPlayerConfigServiceImpl extends ServiceImpl<DmPlayerConfigMapper, DmPlayerConfigPlus> implements IDmPlayerConfigService {
{
@Autowired @Autowired
private DmPlayerConfigMapper dmPlayerConfigMapper; private DmPlayerConfigMapper dmPlayerConfigMapper;
@Autowired @Autowired
@@ -43,12 +40,14 @@ public class DmPlayerConfigServiceImpl extends ServiceImpl<DmPlayerConfigMapper,
private String serverIp; private String serverIp;
@Value("${dm.server.port:8080}") @Value("${dm.server.port:8080}")
private Integer serverPort; private Integer serverPort;
@Override @Override
public List<DmPlayerConfigPlus> getByIds(List<Long> ids, SFunction<DmPlayerConfigPlus, ?>... columns) { public List<DmPlayerConfigPlus> getByIds(List<Long> ids, SFunction<DmPlayerConfigPlus, ?>... columns) {
LambdaQueryWrapper<DmPlayerConfigPlus> lambdaQueryWrapper = new LambdaQueryWrapper<DmPlayerConfigPlus>() LambdaQueryWrapper<DmPlayerConfigPlus> lambdaQueryWrapper = new LambdaQueryWrapper<DmPlayerConfigPlus>()
.select(columns).in(DmPlayerConfigPlus::getId, ids); .select(columns).in(DmPlayerConfigPlus::getId, ids);
return this.list(lambdaQueryWrapper); return this.list(lambdaQueryWrapper);
} }
@Override @Override
public List<SelectItem> select(String keyword) { public List<SelectItem> select(String keyword) {
LambdaQueryWrapper<DmPlayerConfigPlus> lambdaQueryWrapper = new LambdaQueryWrapper<DmPlayerConfigPlus>() LambdaQueryWrapper<DmPlayerConfigPlus> lambdaQueryWrapper = new LambdaQueryWrapper<DmPlayerConfigPlus>()
@@ -64,6 +63,7 @@ public class DmPlayerConfigServiceImpl extends ServiceImpl<DmPlayerConfigMapper,
} }
return result; return result;
} }
@Override @Override
public DmPlayerConfigPlus getById(Long id, SFunction<DmPlayerConfigPlus, ?>... columns) { public DmPlayerConfigPlus getById(Long id, SFunction<DmPlayerConfigPlus, ?>... columns) {
LambdaQueryWrapper<DmPlayerConfigPlus> lambdaQueryWrapper = new LambdaQueryWrapper<DmPlayerConfigPlus>() LambdaQueryWrapper<DmPlayerConfigPlus> lambdaQueryWrapper = new LambdaQueryWrapper<DmPlayerConfigPlus>()
@@ -102,6 +102,7 @@ public class DmPlayerConfigServiceImpl extends ServiceImpl<DmPlayerConfigMapper,
} }
return map; return map;
} }
@Override @Override
public List<DmPlayerConfigPlus> getByIds(List<Long> ids) { public List<DmPlayerConfigPlus> getByIds(List<Long> ids) {
LambdaQueryWrapper<DmPlayerConfigPlus> lambdaQueryWrapper = new LambdaQueryWrapper<DmPlayerConfigPlus>().in(DmPlayerConfigPlus::getId, ids); LambdaQueryWrapper<DmPlayerConfigPlus> lambdaQueryWrapper = new LambdaQueryWrapper<DmPlayerConfigPlus>().in(DmPlayerConfigPlus::getId, ids);
@@ -151,6 +152,7 @@ public class DmPlayerConfigServiceImpl extends ServiceImpl<DmPlayerConfigMapper,
List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass);
return tList; return tList;
} }
/** /**
* 查询玩家配置 * 查询玩家配置
* *
@@ -158,13 +160,12 @@ public class DmPlayerConfigServiceImpl extends ServiceImpl<DmPlayerConfigMapper,
* @return 玩家配置 * @return 玩家配置
*/ */
@Override @Override
public DmPlayerConfig selectDmPlayerConfigById(Long id) public DmPlayerConfig selectDmPlayerConfigById(Long id) {
{
return dmPlayerConfigMapper.selectDmPlayerConfigById(id); return dmPlayerConfigMapper.selectDmPlayerConfigById(id);
} }
@Override @Override
public DmPlayerConfig selectDmPlayerConfigByPlayerId(Long playerId) public DmPlayerConfig selectDmPlayerConfigByPlayerId(Long playerId) {
{
DmPlayerConfig dmPlayerConfig = dmPlayerConfigMapper.selectDmPlayerConfigByPlayerId(playerId); DmPlayerConfig dmPlayerConfig = dmPlayerConfigMapper.selectDmPlayerConfigByPlayerId(playerId);
if (dmPlayerConfig == null) { if (dmPlayerConfig == null) {
DmPlayerConfig playerConfigPlus = new DmPlayerConfig(); DmPlayerConfig playerConfigPlus = new DmPlayerConfig();
@@ -193,8 +194,7 @@ public class DmPlayerConfigServiceImpl extends ServiceImpl<DmPlayerConfigMapper,
* @return 玩家配置 * @return 玩家配置
*/ */
@Override @Override
public List<DmPlayerConfig> selectDmPlayerConfigList(DmPlayerConfig dmPlayerConfig) public List<DmPlayerConfig> selectDmPlayerConfigList(DmPlayerConfig dmPlayerConfig) {
{
return dmPlayerConfigMapper.selectDmPlayerConfigList(dmPlayerConfig); return dmPlayerConfigMapper.selectDmPlayerConfigList(dmPlayerConfig);
} }
@@ -205,8 +205,7 @@ public class DmPlayerConfigServiceImpl extends ServiceImpl<DmPlayerConfigMapper,
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertDmPlayerConfig(DmPlayerConfig dmPlayerConfig) public int insertDmPlayerConfig(DmPlayerConfig dmPlayerConfig) {
{
dmPlayerConfig.setCreateTime(DateUtils.getNowDate()); dmPlayerConfig.setCreateTime(DateUtils.getNowDate());
return dmPlayerConfigMapper.insertDmPlayerConfig(dmPlayerConfig); return dmPlayerConfigMapper.insertDmPlayerConfig(dmPlayerConfig);
} }
@@ -218,13 +217,14 @@ public class DmPlayerConfigServiceImpl extends ServiceImpl<DmPlayerConfigMapper,
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateDmPlayerConfig(DmPlayerConfig dmPlayerConfig) public int updateDmPlayerConfig(DmPlayerConfig dmPlayerConfig) {
{
dmPlayerConfig.setUpdateTime(DateUtils.getNowDate()); dmPlayerConfig.setUpdateTime(DateUtils.getNowDate());
int resutl = dmPlayerConfigMapper.updateDmPlayerConfig(dmPlayerConfig); int resutl = dmPlayerConfigMapper.updateDmPlayerConfig(dmPlayerConfig);
if (resutl > 0) { if (resutl > 0) {
try { try {
String result = httpHelper.getlHttpResult("http://" + this.serverIp + ":" + serverPort + "?cmd=8&params=" + URLEncoder.encode(JSONObject.toJSONString(dmPlayerConfig), "utf-8") JSONObject params = new JSONObject();
params.put("dates", Base64.getEncoder().encodeToString(JSONObject.toJSONString(dmPlayerConfig).getBytes()));
String result = httpHelper.getlHttpResult("http://" + this.serverIp + ":" + serverPort + "?cmd=8&params=" + URLEncoder.encode(JSONObject.toJSONString(params), "utf-8")
, "get", new HashMap<>(), new HashMap<>()); , "get", new HashMap<>(), new HashMap<>());
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONObject.parseObject(result);
if (jsonObject.getString("code").equals("1")) { if (jsonObject.getString("code").equals("1")) {
@@ -246,8 +246,7 @@ public class DmPlayerConfigServiceImpl extends ServiceImpl<DmPlayerConfigMapper,
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteDmPlayerConfigByIds(Long[] ids) public int deleteDmPlayerConfigByIds(Long[] ids) {
{
return dmPlayerConfigMapper.deleteDmPlayerConfigByIds(ids); return dmPlayerConfigMapper.deleteDmPlayerConfigByIds(ids);
} }
@@ -258,8 +257,7 @@ public class DmPlayerConfigServiceImpl extends ServiceImpl<DmPlayerConfigMapper,
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteDmPlayerConfigById(Long id) public int deleteDmPlayerConfigById(Long id) {
{
return dmPlayerConfigMapper.deleteDmPlayerConfigById(id); return dmPlayerConfigMapper.deleteDmPlayerConfigById(id);
} }
} }