1
This commit is contained in:
1 parent
a14741aec7
commit
1365ef660b
4 files changed
+64
-5
No files matched your search
+12
-1
@@ -2,6 +2,8 @@ package com.ruoyi.system.controller;
|
||||
import com.ruoyi.common.select.Ids;
|
||||
import com.ruoyi.common.select.SelectItem;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.system.domain.DmVersionUpdateVo;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -93,7 +95,16 @@ public class DmPlayerVersionController extends BaseController
|
||||
{
|
||||
return toAjax(dmPlayerVersionService.insertDmPlayerVersion(dmPlayerVersion));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增版本信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dmversion:playerent-update')")
|
||||
@Log(title = "版本信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping("playerent-update")
|
||||
public AjaxResult playerentUpdate(@RequestBody DmVersionUpdateVo vo)
|
||||
{
|
||||
return toAjax(dmPlayerVersionService.playerentUpdate(vo));
|
||||
}
|
||||
/**
|
||||
* 修改版本信息
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DmVersionUpdateVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long id;
|
||||
|
||||
private List<Long> playerIds;
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import com.ruoyi.system.domain.DmPlayerVersionPlus;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.ruoyi.common.select.SelectItem;
|
||||
import com.ruoyi.system.domain.DmVersionUpdateVo;
|
||||
|
||||
/**
|
||||
* 版本信息Service接口
|
||||
*
|
||||
@@ -40,6 +42,8 @@ public interface IDmPlayerVersionService extends IService<DmPlayerVersionPlus>
|
||||
*/
|
||||
public int insertDmPlayerVersion(DmPlayerVersion dmPlayerVersion);
|
||||
|
||||
|
||||
public boolean playerentUpdate(DmVersionUpdateVo vo);
|
||||
/**
|
||||
* 修改版本信息
|
||||
*
|
||||
|
||||
+34
-4
@@ -1,18 +1,21 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
|
||||
import com.luqj.util.HttpHelper;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.DmVersionUpdateVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.DmPlayerVersionMapper;
|
||||
import com.ruoyi.system.domain.DmPlayerVersion;
|
||||
@@ -30,6 +33,11 @@ import com.ruoyi.common.select.SelectItem;
|
||||
@Service
|
||||
public class DmPlayerVersionServiceImpl extends ServiceImpl<DmPlayerVersionMapper, DmPlayerVersionPlus> implements IDmPlayerVersionService
|
||||
{
|
||||
@Value("${dm.server.ip:192.168.3.103}")
|
||||
private String serverIp;
|
||||
@Value("${dm.server.port:8080}")
|
||||
private Integer serverPort;
|
||||
private HttpHelper httpHelper = new HttpHelper();
|
||||
@Autowired
|
||||
private DmPlayerVersionMapper dmPlayerVersionMapper;
|
||||
@Autowired
|
||||
@@ -169,6 +177,28 @@ public class DmPlayerVersionServiceImpl extends ServiceImpl<DmPlayerVersionMappe
|
||||
return dmPlayerVersionMapper.insertDmPlayerVersion(dmPlayerVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerentUpdate(DmVersionUpdateVo vo) {
|
||||
DmPlayerVersion dmPlayerVersion = this.selectDmPlayerVersionById(vo.getId());
|
||||
for(Long playerId : vo.getPlayerIds()){
|
||||
try {
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("playerId", playerId);
|
||||
params.put("versionInfo", Base64.getEncoder().encodeToString(JSONObject.toJSONString(dmPlayerVersion).getBytes()));
|
||||
String result = httpHelper.getlHttpResult("http://" + this.serverIp + ":" + serverPort + "?cmd=9¶ms=" + URLEncoder.encode(JSONObject.toJSONString(params), "utf-8")
|
||||
, "get", new HashMap<>(), new HashMap<>());
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if (jsonObject.getString("code").equals("1")) {
|
||||
return true;
|
||||
}
|
||||
System.out.println(result);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改版本信息
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user