This commit is contained in:
lu7213 committed 2026-04-29 11:11:30 -04:00
1 parent da952a1103
commit d294ec17e0
11 files changed
+1191 -1

No files matched your search

@@ -0,0 +1,37 @@
package com.ruoyi.task;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.system.domain.DmPlayerentPlus;
import com.ruoyi.system.service.IDmPlayerentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
@Component("dmPlayerentOnlineStatusTask")
@Slf4j
public class DmPlayerentOnlineStatusTask {
@Autowired
private IDmPlayerentService dmPlayerentService;
@Scheduled(cron = "0/5 * * * * ?")
public void execute() {
LambdaQueryWrapper<DmPlayerentPlus> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DmPlayerentPlus::getOnlineStatus, "1");
List<DmPlayerentPlus> list = dmPlayerentService.list(queryWrapper);
for (DmPlayerentPlus playerent : list) {
Date updateTime = playerent.getUpdateTime();
if (updateTime != null) {
long diff = new Date().getTime() - updateTime.getTime();
if (diff > 60000) {
playerent.setOnlineStatus("0");
dmPlayerentService.updateById(playerent);
log.info("Update playerent online status to 0, id: {}", playerent.getId());
}
}
}
}
}
@@ -17,7 +17,7 @@ ruoyi:
copyrightYear: 2021
# 实例演示开关
demoEnabled: true
reqUrl: http://192.168.3.199:2020/profile
reqUrl: http://192.168.3.108:2020/profile
#http://127.0.0.1:2020/profile/upload/2024/05/15/1.jpeg
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
profile: D:/ruoyi/uploadPath
@@ -0,0 +1,129 @@
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.DmOperateVo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DmPlayerent;
import com.ruoyi.system.domain.DmPlayerentPlus;
import com.ruoyi.system.service.IDmPlayerentService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 大漠代理Controller
*
* @author luqj
* @date 2026-04-29
*/
@RestController
@RequestMapping("/system/playerent")
public class DmPlayerentController extends BaseController
{
@Autowired
private IDmPlayerentService dmPlayerentService;
@PreAuthorize("@ss.hasPermi('system:playerent:getByIds')")
@PostMapping("/getByIds")
public AjaxResult getByIds(@RequestBody Ids ids)
{
List<DmPlayerentPlus> list = dmPlayerentService.getByIds(ids.getLongIds(),DmPlayerentPlus::getName,DmPlayerentPlus::getId);
return AjaxResult.success(list);
}
@PreAuthorize("@ss.hasPermi('system:playerent:select')")
@GetMapping("/select")
public AjaxResult select(String keyword)
{
List<SelectItem> list = dmPlayerentService.select(keyword);
return AjaxResult.success(list);
}
/**
* 查询大漠代理列表
*/
@PreAuthorize("@ss.hasPermi('system:playerent:list')")
@GetMapping("/list")
public TableDataInfo list(DmPlayerent dmPlayerent)
{
startPage();
List<DmPlayerent> list = dmPlayerentService.selectDmPlayerentList(dmPlayerent);
return getDataTable(list);
}
/**
* 导出大漠代理列表
*/
@PreAuthorize("@ss.hasPermi('system:playerent:export')")
@Log(title = "大漠代理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(DmPlayerent dmPlayerent)
{
List<DmPlayerent> list = dmPlayerentService.selectDmPlayerentList(dmPlayerent);
ExcelUtil<DmPlayerent> util = new ExcelUtil<DmPlayerent>(DmPlayerent.class);
return util.exportExcel(list, "playerent");
}
/**
* 获取大漠代理详细信息
*/
@PreAuthorize("@ss.hasPermi('system:playerent:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(dmPlayerentService.selectDmPlayerentById(id));
}
/**
* 新增大漠代理
*/
@PreAuthorize("@ss.hasPermi('system:playerent:add')")
@Log(title = "大漠代理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DmPlayerent dmPlayerent)
{
return toAjax(dmPlayerentService.insertDmPlayerent(dmPlayerent));
}
/**
* 修改大漠代理
*/
@PreAuthorize("@ss.hasPermi('system:playerent:edit')")
@Log(title = "大漠代理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DmPlayerent dmPlayerent)
{
return toAjax(dmPlayerentService.updateDmPlayerent(dmPlayerent));
}
/**
* 删除大漠代理
*/
@PreAuthorize("@ss.hasPermi('system:playerent:remove')")
@Log(title = "大漠代理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(dmPlayerentService.deleteDmPlayerentByIds(ids));
}
@PreAuthorize("@ss.hasPermi('system:playerent:operate')")
@Log(title = "操作", businessType = BusinessType.INSERT)
@PostMapping("/operate")
public AjaxResult operate(@RequestBody DmOperateVo vo)
{
return toAjax(dmPlayerentService.operate(vo));
}
}
@@ -0,0 +1,14 @@
package com.ruoyi.system.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class DmOperateVo implements Serializable {
private static final long serialVersionUID = 1L;
private int action;
private String playerId;
private String winId;
private Integer operateType;
}
@@ -0,0 +1,235 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.io.Serializable;
/**
* 大漠代理对象 dm_playerent
*
* @author luqj
* @date 2026-04-29
*/
public class DmPlayerent extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 用户ID */
@Excel(name = "用户ID")
private Long accountid;
/** 名称 */
@Excel(name = "名称")
private String name;
/** 在线状态 */
@Excel(name = "在线状态")
private String onlineStatus;
/** 代理状态 */
@Excel(name = "代理状态")
private String playerStatus;
/** ip地址 */
@Excel(name = "ip地址")
private String ip;
/** http端口 */
@Excel(name = "http端口")
private String httpPort;
/** 窗口句柄 */
@Excel(name = "窗口句柄")
private Long winOneHwnd;
/** 窗口信息 */
@Excel(name = "窗口信息")
private String winOneInfo;
/** 窗口句柄 */
@Excel(name = "窗口句柄")
private Long winTwoHwnd;
/** 窗口信息 */
@Excel(name = "窗口信息")
private String winTwoInfo;
/** 截图地址 */
@Excel(name = "截图地址")
private String winTwoImgPath;
/** 截图地址 */
@Excel(name = "截图地址")
private String winOneImgPath;
/** 当前任务 */
@Excel(name = "当前任务")
private String winOneCurTask;
/** 当前任务 */
@Excel(name = "当前任务")
private String winTwoCurTask;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setAccountid(Long accountid)
{
this.accountid = accountid;
}
public Long getAccountid()
{
return accountid;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setOnlineStatus(String onlineStatus)
{
this.onlineStatus = onlineStatus;
}
public String getOnlineStatus()
{
return onlineStatus;
}
public void setPlayerStatus(String playerStatus)
{
this.playerStatus = playerStatus;
}
public String getPlayerStatus()
{
return playerStatus;
}
public void setIp(String ip)
{
this.ip = ip;
}
public String getIp()
{
return ip;
}
public void setHttpPort(String httpPort)
{
this.httpPort = httpPort;
}
public String getHttpPort()
{
return httpPort;
}
public void setWinOneHwnd(Long winOneHwnd)
{
this.winOneHwnd = winOneHwnd;
}
public Long getWinOneHwnd()
{
return winOneHwnd;
}
public void setWinOneInfo(String winOneInfo)
{
this.winOneInfo = winOneInfo;
}
public String getWinOneInfo()
{
return winOneInfo;
}
public void setWinTwoHwnd(Long winTwoHwnd)
{
this.winTwoHwnd = winTwoHwnd;
}
public Long getWinTwoHwnd()
{
return winTwoHwnd;
}
public void setWinTwoInfo(String winTwoInfo)
{
this.winTwoInfo = winTwoInfo;
}
public String getWinTwoInfo()
{
return winTwoInfo;
}
public void setWinTwoImgPath(String winTwoImgPath)
{
this.winTwoImgPath = winTwoImgPath;
}
public String getWinTwoImgPath()
{
return winTwoImgPath;
}
public void setWinOneImgPath(String winOneImgPath)
{
this.winOneImgPath = winOneImgPath;
}
public String getWinOneImgPath()
{
return winOneImgPath;
}
public void setWinOneCurTask(String winOneCurTask)
{
this.winOneCurTask = winOneCurTask;
}
public String getWinOneCurTask()
{
return winOneCurTask;
}
public void setWinTwoCurTask(String winTwoCurTask)
{
this.winTwoCurTask = winTwoCurTask;
}
public String getWinTwoCurTask()
{
return winTwoCurTask;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("accountid", getAccountid())
.append("name", getName())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("onlineStatus", getOnlineStatus())
.append("playerStatus", getPlayerStatus())
.append("ip", getIp())
.append("httpPort", getHttpPort())
.append("winOneHwnd", getWinOneHwnd())
.append("winOneInfo", getWinOneInfo())
.append("winTwoHwnd", getWinTwoHwnd())
.append("winTwoInfo", getWinTwoInfo())
.append("winTwoImgPath", getWinTwoImgPath())
.append("winOneImgPath", getWinOneImgPath())
.append("winOneCurTask", getWinOneCurTask())
.append("winTwoCurTask", getWinTwoCurTask())
.toString();
}
}
@@ -0,0 +1,245 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableName;
/**
* 大漠代理对象 dm_playerent
*
* @author luqj
* @date 2026-04-29
*/
@TableName(value = "dm_playerent")
public class DmPlayerentPlus implements Serializable
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 用户ID */
@Excel(name = "用户ID")
private Long accountid;
/** 名称 */
@Excel(name = "名称")
private String name;
/** 创建时间 */
private Date createTime;
/** 更新时间 */
private Date updateTime;
/** 在线状态 */
@Excel(name = "在线状态")
private String onlineStatus;
/** 代理状态 */
@Excel(name = "代理状态")
private String playerStatus;
/** ip地址 */
@Excel(name = "ip地址")
private String ip;
/** http端口 */
@Excel(name = "http端口")
private String httpPort;
/** 窗口句柄 */
@Excel(name = "窗口句柄")
private Long winOneHwnd;
/** 窗口信息 */
@Excel(name = "窗口信息")
private String winOneInfo;
/** 窗口句柄 */
@Excel(name = "窗口句柄")
private Long winTwoHwnd;
/** 窗口信息 */
@Excel(name = "窗口信息")
private String winTwoInfo;
/** 截图地址 */
@Excel(name = "截图地址")
private String winTwoImgPath;
/** 截图地址 */
@Excel(name = "截图地址")
private String winOneImgPath;
/** 当前任务 */
@Excel(name = "当前任务")
private String winOneCurTask;
/** 当前任务 */
@Excel(name = "当前任务")
private String winTwoCurTask;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setAccountid(Long accountid)
{
this.accountid = accountid;
}
public Long getAccountid()
{
return accountid;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
public Date getCreateTime()
{
return createTime;
}
public void setUpdateTime(Date updateTime)
{
this.updateTime = updateTime;
}
public Date getUpdateTime()
{
return updateTime;
}
public void setOnlineStatus(String onlineStatus)
{
this.onlineStatus = onlineStatus;
}
public String getOnlineStatus()
{
return onlineStatus;
}
public void setPlayerStatus(String playerStatus)
{
this.playerStatus = playerStatus;
}
public String getPlayerStatus()
{
return playerStatus;
}
public void setIp(String ip)
{
this.ip = ip;
}
public String getIp()
{
return ip;
}
public void setHttpPort(String httpPort)
{
this.httpPort = httpPort;
}
public String getHttpPort()
{
return httpPort;
}
public void setWinOneHwnd(Long winOneHwnd)
{
this.winOneHwnd = winOneHwnd;
}
public Long getWinOneHwnd()
{
return winOneHwnd;
}
public void setWinOneInfo(String winOneInfo)
{
this.winOneInfo = winOneInfo;
}
public String getWinOneInfo()
{
return winOneInfo;
}
public void setWinTwoHwnd(Long winTwoHwnd)
{
this.winTwoHwnd = winTwoHwnd;
}
public Long getWinTwoHwnd()
{
return winTwoHwnd;
}
public void setWinTwoInfo(String winTwoInfo)
{
this.winTwoInfo = winTwoInfo;
}
public String getWinTwoInfo()
{
return winTwoInfo;
}
public void setWinTwoImgPath(String winTwoImgPath)
{
this.winTwoImgPath = winTwoImgPath;
}
public String getWinTwoImgPath()
{
return winTwoImgPath;
}
public void setWinOneImgPath(String winOneImgPath)
{
this.winOneImgPath = winOneImgPath;
}
public String getWinOneImgPath()
{
return winOneImgPath;
}
public void setWinOneCurTask(String winOneCurTask)
{
this.winOneCurTask = winOneCurTask;
}
public String getWinOneCurTask()
{
return winOneCurTask;
}
public void setWinTwoCurTask(String winTwoCurTask)
{
this.winTwoCurTask = winTwoCurTask;
}
public String getWinTwoCurTask()
{
return winTwoCurTask;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("accountid", getAccountid())
.append("name", getName())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("onlineStatus", getOnlineStatus())
.append("playerStatus", getPlayerStatus())
.append("ip", getIp())
.append("httpPort", getHttpPort())
.append("winOneHwnd", getWinOneHwnd())
.append("winOneInfo", getWinOneInfo())
.append("winTwoHwnd", getWinTwoHwnd())
.append("winTwoInfo", getWinTwoInfo())
.append("winTwoImgPath", getWinTwoImgPath())
.append("winOneImgPath", getWinOneImgPath())
.append("winOneCurTask", getWinOneCurTask())
.append("winTwoCurTask", getWinTwoCurTask())
.toString();
}
}
@@ -0,0 +1,65 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.system.domain.DmPlayerent;
import com.ruoyi.system.domain.DmPlayerentPlus;
/**
* 大漠代理Mapper接口
*
* @author luqj
* @date 2026-04-29
*/
public interface DmPlayerentMapper extends BaseMapper<DmPlayerentPlus>
{
/**
* 查询大漠代理
*
* @param id 大漠代理ID
* @return 大漠代理
*/
public DmPlayerent selectDmPlayerentById(Long id);
/**
* 查询大漠代理列表
*
* @param dmPlayerent 大漠代理
* @return 大漠代理集合
*/
public List<DmPlayerent> selectDmPlayerentList(DmPlayerent dmPlayerent);
/**
* 新增大漠代理
*
* @param dmPlayerent 大漠代理
* @return 结果
*/
public int insertDmPlayerent(DmPlayerent dmPlayerent);
/**
* 修改大漠代理
*
* @param dmPlayerent 大漠代理
* @return 结果
*/
public int updateDmPlayerent(DmPlayerent dmPlayerent);
/**
* 删除大漠代理
*
* @param id 大漠代理ID
* @return 结果
*/
public int deleteDmPlayerentById(Long id);
/**
* 批量删除大漠代理
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteDmPlayerentByIds(Long[] ids);
}
@@ -0,0 +1,93 @@
package com.ruoyi.system.service;
import java.util.Map;
import java.util.List;
import com.ruoyi.system.domain.DmOperateVo;
import com.ruoyi.system.domain.DmPlayerent;
import com.ruoyi.system.domain.DmPlayerentPlus;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.ruoyi.common.select.SelectItem;
/**
* 大漠代理Service接口
*
* @author luqj
* @date 2026-04-29
*/
public interface IDmPlayerentService extends IService<DmPlayerentPlus>
{
List<SelectItem> select(String keyword);
/**
* 查询大漠代理
*
* @param id 大漠代理ID
* @return 大漠代理
*/
public DmPlayerent selectDmPlayerentById(Long id);
/**
* 查询大漠代理列表
*
* @param dmPlayerent 大漠代理
* @return 大漠代理集合
*/
public List<DmPlayerent> selectDmPlayerentList(DmPlayerent dmPlayerent);
/**
* 新增大漠代理
*
* @param dmPlayerent 大漠代理
* @return 结果
*/
public int insertDmPlayerent(DmPlayerent dmPlayerent);
public boolean operate(DmOperateVo vo);
/**
* 修改大漠代理
*
* @param dmPlayerent 大漠代理
* @return 结果
*/
public int updateDmPlayerent(DmPlayerent dmPlayerent);
/**
* 批量删除大漠代理
*
* @param ids 需要删除的大漠代理ID
* @return 结果
*/
public int deleteDmPlayerentByIds(Long[] ids);
/**
* 删除大漠代理信息
*
* @param id 大漠代理ID
* @return 结果
*/
public int deleteDmPlayerentById(Long id);
List<DmPlayerentPlus> getByIds(List<Long> ids, SFunction<DmPlayerentPlus, ?>... columns);
DmPlayerentPlus getById(Long id, SFunction<DmPlayerentPlus, ?>... columns);
Map<Long, DmPlayerentPlus> getMapByIds(List<Long> ids, SFunction<DmPlayerentPlus, ?>... columns);
List<DmPlayerentPlus> getByIds(List<Long> ids);
Map<Long, DmPlayerentPlus> getMapByIds(List<Long> ids);
/**
* @param field sum 字段
* @param where 条件
* @param tClass 返回类型
* @param <T>
* @return
*/
<T> T sum(String field, String where, Class<T> tClass);
Long count(String where);
<T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass);
}
@@ -0,0 +1,249 @@
package com.ruoyi.system.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.DmOperateVo;
import com.ruoyi.system.domain.DmPlayerent;
import com.ruoyi.system.domain.DmPlayerentPlus;
import com.ruoyi.system.mapper.DmPlayerentMapper;
import com.ruoyi.system.service.IDmPlayerentService;
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.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 大漠代理Service业务层处理
*
* @author luqj
* @date 2026-04-29
*/
@Service
public class DmPlayerentServiceImpl extends ServiceImpl<DmPlayerentMapper, DmPlayerentPlus> implements IDmPlayerentService {
private HttpHelper httpHelper = new HttpHelper();
@Autowired
private DmPlayerentMapper dmPlayerentMapper;
@Autowired
private JdbcTemplate jdbcTemplate;
@Value("${dm.server.ip:192.168.3.103}")
private String serverIp;
@Value("${dm.server.port:8080}")
private Integer serverPort;
@Override
public List<DmPlayerentPlus> getByIds(List<Long> ids, SFunction<DmPlayerentPlus, ?>... columns) {
LambdaQueryWrapper<DmPlayerentPlus> lambdaQueryWrapper = new LambdaQueryWrapper<DmPlayerentPlus>()
.select(columns).in(DmPlayerentPlus::getId, ids);
return this.list(lambdaQueryWrapper);
}
@Override
public List<SelectItem> select(String keyword) {
LambdaQueryWrapper<DmPlayerentPlus> lambdaQueryWrapper = new LambdaQueryWrapper<DmPlayerentPlus>()
.select(DmPlayerentPlus::getId, DmPlayerentPlus::getName)
.like(DmPlayerentPlus::getName, keyword);
List<DmPlayerentPlus> list = this.list(lambdaQueryWrapper);
List<SelectItem> result = new ArrayList<>();
for (DmPlayerentPlus item : list) {
SelectItem selectItem = new SelectItem();
selectItem.setName(item.getName());
selectItem.setId(item.getId());
result.add(selectItem);
}
return result;
}
@Override
public DmPlayerentPlus getById(Long id, SFunction<DmPlayerentPlus, ?>... columns) {
LambdaQueryWrapper<DmPlayerentPlus> lambdaQueryWrapper = new LambdaQueryWrapper<DmPlayerentPlus>()
.select(columns).eq(DmPlayerentPlus::getId, id);
return baseMapper.selectOne(lambdaQueryWrapper);
}
@Override
public Map<Long, DmPlayerentPlus> getMapByIds(List<Long> ids, SFunction<DmPlayerentPlus, ?>... columns) {
List<DmPlayerentPlus> list = this.getByIds(ids, columns);
Map<Long, DmPlayerentPlus> map = new HashMap<>();
for (DmPlayerentPlus item : list) {
map.put(item.getId(), item);
}
return map;
}
@Override
public Map<Long, DmPlayerentPlus> getMapByIds(List<Long> ids) {
List<DmPlayerentPlus> list = this.getByIds(ids);
Map<Long, DmPlayerentPlus> map = new HashMap<>();
for (DmPlayerentPlus item : list) {
map.put(item.getId(), item);
}
return map;
}
@Override
public List<DmPlayerentPlus> getByIds(List<Long> ids) {
LambdaQueryWrapper<DmPlayerentPlus> lambdaQueryWrapper = new LambdaQueryWrapper<DmPlayerentPlus>().in(DmPlayerentPlus::getId, ids);
return this.list(lambdaQueryWrapper);
}
public <T> T sum(String field, String where, Class<T> tClass) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("select ");
stringBuffer.append(" sum(" + field + ") as total ");
stringBuffer.append(" from dm_playerent ");
if (StringUtils.isNotBlank(where)) {
stringBuffer.append(" where ");
stringBuffer.append(where);
}
T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass);
return result;
}
public Long count(String where) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("select ");
stringBuffer.append(" count(1)");
stringBuffer.append(" from ");
stringBuffer.append(" dm_playerent ");
if (StringUtils.isNotBlank(where)) {
stringBuffer.append(" where ");
stringBuffer.append(where);
}
Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class);
return result;
}
public <T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("select ");
stringBuffer.append(select);
stringBuffer.append(" from ");
stringBuffer.append(" dm_playerent ");
if (StringUtils.isNotBlank(where)) {
stringBuffer.append(" where ");
stringBuffer.append(where);
}
stringBuffer.append(" group by ");
stringBuffer.append(groupby);
List result = jdbcTemplate.queryForList(stringBuffer.toString());
List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass);
return tList;
}
/**
* 查询大漠代理
*
* @param id 大漠代理ID
* @return 大漠代理
*/
@Override
public DmPlayerent selectDmPlayerentById(Long id) {
return dmPlayerentMapper.selectDmPlayerentById(id);
}
/**
* 查询大漠代理列表
*
* @param dmPlayerent 大漠代理
* @return 大漠代理
*/
@Override
public List<DmPlayerent> selectDmPlayerentList(DmPlayerent dmPlayerent) {
return dmPlayerentMapper.selectDmPlayerentList(dmPlayerent);
}
/**
* 新增大漠代理
*
* @param dmPlayerent 大漠代理
* @return 结果
*/
@Override
public int insertDmPlayerent(DmPlayerent dmPlayerent) {
dmPlayerent.setCreateTime(DateUtils.getNowDate());
return dmPlayerentMapper.insertDmPlayerent(dmPlayerent);
}
@Override
public boolean operate(DmOperateVo vo) {
JSONObject params = new JSONObject();
if (vo.getAction() == 5) { //截图
try {
params.put("winId",vo.getWinId());
params.put("playerId",vo.getPlayerId());
String result = httpHelper.getlHttpResult("http://"+ this.serverIp +":"+serverPort+ "?cmd=6&params="+ 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);
}
}else if(vo.getAction() == 6){
try {
params.put("winId",vo.getWinId());
params.put("playerId",vo.getPlayerId());
params.put("operateType",vo.getOperateType());
String result = httpHelper.getlHttpResult("http://"+ this.serverIp +":"+serverPort+ "?cmd=7&params="+ 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;
}
/**
* 修改大漠代理
*
* @param dmPlayerent 大漠代理
* @return 结果
*/
@Override
public int updateDmPlayerent(DmPlayerent dmPlayerent) {
dmPlayerent.setUpdateTime(DateUtils.getNowDate());
return dmPlayerentMapper.updateDmPlayerent(dmPlayerent);
}
/**
* 批量删除大漠代理
*
* @param ids 需要删除的大漠代理ID
* @return 结果
*/
@Override
public int deleteDmPlayerentByIds(Long[] ids) {
return dmPlayerentMapper.deleteDmPlayerentByIds(ids);
}
/**
* 删除大漠代理信息
*
* @param id 大漠代理ID
* @return 结果
*/
@Override
public int deleteDmPlayerentById(Long id) {
return dmPlayerentMapper.deleteDmPlayerentById(id);
}
}
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.DmPlayerentMapper">
<resultMap type="DmPlayerent" id="DmPlayerentResult">
<result property="id" column="id" />
<result property="accountid" column="accountId" />
<result property="name" column="name" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="onlineStatus" column="online_status" />
<result property="playerStatus" column="player_status" />
<result property="ip" column="ip" />
<result property="httpPort" column="http_port" />
<result property="winOneHwnd" column="win_one_hwnd" />
<result property="winOneInfo" column="win_one_info" />
<result property="winTwoHwnd" column="win_two_hwnd" />
<result property="winTwoInfo" column="win_two_info" />
<result property="winTwoImgPath" column="win_two_img_path" />
<result property="winOneImgPath" column="win_one_img_path" />
<result property="winOneCurTask" column="win_one_cur_task" />
<result property="winTwoCurTask" column="win_two_cur_task" />
</resultMap>
<sql id="selectDmPlayerentVo">
select id, accountId, name, create_time, update_time, online_status, player_status, ip, http_port, win_one_hwnd, win_one_info, win_two_hwnd, win_two_info, win_two_img_path, win_one_img_path, win_one_cur_task, win_two_cur_task from dm_playerent
</sql>
<select id="selectDmPlayerentList" parameterType="DmPlayerent" resultMap="DmPlayerentResult">
<include refid="selectDmPlayerentVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
<if test="playerStatus != null and playerStatus != ''"> and player_status = #{playerStatus}</if>
<if test="ip != null and ip != ''"> and ip like concat('%', #{ip}, '%')</if>
</where>
</select>
<select id="selectDmPlayerentById" parameterType="Long" resultMap="DmPlayerentResult">
<include refid="selectDmPlayerentVo"/>
where id = #{id}
</select>
<insert id="insertDmPlayerent" parameterType="DmPlayerent">
insert into dm_playerent
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="accountid != null">accountId,</if>
<if test="name != null">name,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="onlineStatus != null">online_status,</if>
<if test="playerStatus != null">player_status,</if>
<if test="ip != null">ip,</if>
<if test="httpPort != null">http_port,</if>
<if test="winOneHwnd != null">win_one_hwnd,</if>
<if test="winOneInfo != null">win_one_info,</if>
<if test="winTwoHwnd != null">win_two_hwnd,</if>
<if test="winTwoInfo != null">win_two_info,</if>
<if test="winTwoImgPath != null">win_two_img_path,</if>
<if test="winOneImgPath != null">win_one_img_path,</if>
<if test="winOneCurTask != null">win_one_cur_task,</if>
<if test="winTwoCurTask != null">win_two_cur_task,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="accountid != null">#{accountid},</if>
<if test="name != null">#{name},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="onlineStatus != null">#{onlineStatus},</if>
<if test="playerStatus != null">#{playerStatus},</if>
<if test="ip != null">#{ip},</if>
<if test="httpPort != null">#{httpPort},</if>
<if test="winOneHwnd != null">#{winOneHwnd},</if>
<if test="winOneInfo != null">#{winOneInfo},</if>
<if test="winTwoHwnd != null">#{winTwoHwnd},</if>
<if test="winTwoInfo != null">#{winTwoInfo},</if>
<if test="winTwoImgPath != null">#{winTwoImgPath},</if>
<if test="winOneImgPath != null">#{winOneImgPath},</if>
<if test="winOneCurTask != null">#{winOneCurTask},</if>
<if test="winTwoCurTask != null">#{winTwoCurTask},</if>
</trim>
</insert>
<update id="updateDmPlayerent" parameterType="DmPlayerent">
update dm_playerent
<trim prefix="SET" suffixOverrides=",">
<if test="accountid != null">accountId = #{accountid},</if>
<if test="name != null">name = #{name},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
<if test="playerStatus != null">player_status = #{playerStatus},</if>
<if test="ip != null">ip = #{ip},</if>
<if test="httpPort != null">http_port = #{httpPort},</if>
<if test="winOneHwnd != null">win_one_hwnd = #{winOneHwnd},</if>
<if test="winOneInfo != null">win_one_info = #{winOneInfo},</if>
<if test="winTwoHwnd != null">win_two_hwnd = #{winTwoHwnd},</if>
<if test="winTwoInfo != null">win_two_info = #{winTwoInfo},</if>
<if test="winTwoImgPath != null">win_two_img_path = #{winTwoImgPath},</if>
<if test="winOneImgPath != null">win_one_img_path = #{winOneImgPath},</if>
<if test="winOneCurTask != null">win_one_cur_task = #{winOneCurTask},</if>
<if test="winTwoCurTask != null">win_two_cur_task = #{winTwoCurTask},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDmPlayerentById" parameterType="Long">
delete from dm_playerent where id = #{id}
</delete>
<delete id="deleteDmPlayerentByIds" parameterType="String">
delete from dm_playerent where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
+2
View File
@@ -0,0 +1,2 @@
- 在ruoyi-admin模块com.ruoyi.task添加一个任务更新DmPlayerentPlus的在线状态,如果在线,且最后更新时间和当前时间大于60秒,则把在线状态更新为0