添加接口

This commit is contained in:
lu7213 committed 2026-08-12 05:20:52 -04:00
1 parent 9b78c4a8a5
commit f25ff6eb3b
5 files changed
+60 -1

No files matched your search

@@ -1,6 +1,8 @@
package com.ruoyi.system.service;
import java.util.Map;
import java.util.List;
import com.ruoyi.system.domain.DmGroupOperateVo;
import com.ruoyi.system.domain.DmPlayerTaskGroup;
import com.ruoyi.system.domain.DmPlayerTaskGroupPlus;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -86,4 +88,6 @@ public interface IDmPlayerTaskGroupService extends IService<DmPlayerTaskGroupPlu
Long count(String where);
<T> List<T> countByGroupBy(String select, String where, String groupby, Class<T> tClass);
boolean operate(DmGroupOperateVo vo);
}
@@ -1,18 +1,24 @@
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.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
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.DmGroupOperateVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DmPlayerTaskGroupMapper;
import com.ruoyi.system.domain.DmPlayerTaskGroup;
@@ -30,11 +36,15 @@ import com.ruoyi.common.select.SelectItem;
@Service
public class DmPlayerTaskGroupServiceImpl extends ServiceImpl<DmPlayerTaskGroupMapper, DmPlayerTaskGroupPlus> implements IDmPlayerTaskGroupService
{
private HttpHelper httpHelper = new HttpHelper();
@Autowired
private DmPlayerTaskGroupMapper dmPlayerTaskGroupMapper;
@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<DmPlayerTaskGroupPlus> getByIds(List<Long> ids, SFunction<DmPlayerTaskGroupPlus, ?>... columns) {
LambdaQueryWrapper<DmPlayerTaskGroupPlus> lambdaQueryWrapper = new LambdaQueryWrapper<DmPlayerTaskGroupPlus>()
@@ -132,6 +142,27 @@ public class DmPlayerTaskGroupServiceImpl extends ServiceImpl<DmPlayerTaskGroupM
List<T> tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass);
return tList;
}
@Override
public boolean operate(DmGroupOperateVo vo) {
JSONObject params = new JSONObject();
params.put("params", "{}");
try {
params.put("groupId", vo.getGroupId());
params.put("operateType", vo.getOperateType());
String result = httpHelper.getlHttpResult("http://" + this.serverIp + ":" + serverPort + "?cmd=11&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;
}
log.debug(result);
} catch (Exception e) {
throw new RuntimeException(e);
}
return false;
}
/**
* 查询大漠任务组
*