地图节点舰队列表完成
This commit is contained in:
parent
b6f56db524
commit
83613ae630
@ -1,7 +1,8 @@
|
|||||||
package com.yutou.Data;
|
package com.yutou.Data;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -56,15 +57,15 @@ public class Ship {
|
|||||||
public static Ship getInstance(JSONObject json){
|
public static Ship getInstance(JSONObject json){
|
||||||
try {
|
try {
|
||||||
Ship ship=new Ship();
|
Ship ship=new Ship();
|
||||||
ship.setLevel(json.getInt("level"));
|
ship.setLevel(json.getInteger("level"));
|
||||||
ship.setShipCid(json.getInt("shipCid"));
|
ship.setShipCid(json.getInteger("shipCid"));
|
||||||
ship.setTitle(json.getString("title"));
|
ship.setTitle(json.getString("title"));
|
||||||
ship.setType(json.getInt("type"));
|
ship.setType(json.getInteger("type"));
|
||||||
List<String> equipment=new ArrayList<>();
|
List<String> equipment=new ArrayList<>();
|
||||||
JSONArray equip=json.getJSONArray("equipment");
|
JSONArray equip=json.getJSONArray("equipment");
|
||||||
for (int i = 0; i < equip.length(); i++) {
|
for (int i = 0; i < equip.size(); i++) {
|
||||||
try{
|
try{
|
||||||
equipment.add(equip.getInt(i)+"");
|
equipment.add(equip.getInteger(i)+"");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
equipment.add(equip.getString(i));
|
equipment.add(equip.getString(i));
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,138 @@
|
|||||||
|
package com.yutou.controller.MapTop;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.yutou.enums.UserEnum;
|
||||||
|
import com.yutou.maptop.Bean.MapTop;
|
||||||
|
import com.yutou.maptop.Bean.UserTeam;
|
||||||
|
import com.yutou.maptop.services.MapTopService;
|
||||||
|
import com.yutou.maptop.services.UserTeamService;
|
||||||
|
import com.yutou.utlis.Tools;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class AndroidMapController {
|
||||||
|
@Resource
|
||||||
|
UserTeamService userTeamService;
|
||||||
|
@Resource
|
||||||
|
MapTopService mapTopService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全部数据
|
||||||
|
*/
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/android/map/all.do")
|
||||||
|
public String getMapTop(HttpServletRequest request,int limit){
|
||||||
|
|
||||||
|
JSONObject json=new JSONObject();
|
||||||
|
if(Tools.getUidOfToken(request)<=0){
|
||||||
|
json.put("msg",UserEnum.LOGIN_NOT_LOGIN.msg);
|
||||||
|
json.put("code", UserEnum.LOGIN_NOT_LOGIN.code);
|
||||||
|
return json.toString();
|
||||||
|
}
|
||||||
|
int count=100;
|
||||||
|
|
||||||
|
List<MapTop> list=mapTopService.selectMap(limit,count);
|
||||||
|
json.put("count",list.size());
|
||||||
|
json.put("data", JSONArray.toJSON(list));
|
||||||
|
if(list.size()==count){
|
||||||
|
json.put("next",true);
|
||||||
|
}else{
|
||||||
|
json.put("next",false);
|
||||||
|
}
|
||||||
|
return json.toJSONString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/android/map/mid.do")
|
||||||
|
public String getMapId(HttpServletRequest request,int id,int limit){
|
||||||
|
JSONObject json=new JSONObject();
|
||||||
|
if(Tools.getUidOfToken(request)<=0){
|
||||||
|
json.put("msg",UserEnum.LOGIN_NOT_LOGIN.msg);
|
||||||
|
json.put("code", UserEnum.LOGIN_NOT_LOGIN.code);
|
||||||
|
return json.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
int count=100;
|
||||||
|
List<MapTop> list=mapTopService.selectMapByMapId(id,limit,count);
|
||||||
|
json.put("count",list.size());
|
||||||
|
json.put("data", JSONArray.toJSON(list));
|
||||||
|
if(list.size()==count){
|
||||||
|
json.put("next",true);
|
||||||
|
}else{
|
||||||
|
json.put("next",false);
|
||||||
|
}
|
||||||
|
return json.toJSONString();
|
||||||
|
}
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/android/map/team/node.do")
|
||||||
|
public String getTeamByMapNode(HttpServletRequest request,int node,int limit){
|
||||||
|
JSONObject json=new JSONObject();
|
||||||
|
if(Tools.getUidOfToken(request)<=0){
|
||||||
|
json.put("msg",UserEnum.LOGIN_NOT_LOGIN.msg);
|
||||||
|
json.put("code", UserEnum.LOGIN_NOT_LOGIN.code);
|
||||||
|
return json.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
int count=100;
|
||||||
|
List<UserTeam> list=userTeamService.searchMapNode(node,limit,count);
|
||||||
|
json.put("count",list.size());
|
||||||
|
json.put("data", JSONArray.toJSON(list));
|
||||||
|
if(list.size()==count){
|
||||||
|
json.put("next",true);
|
||||||
|
}else{
|
||||||
|
json.put("next",false);
|
||||||
|
}
|
||||||
|
return json.toJSONString();
|
||||||
|
}
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/android/map/team/nodeAndLike.do")
|
||||||
|
public String getTeamByMapNodeAndLike(HttpServletRequest request,int node,int limit,String likeArray){
|
||||||
|
JSONObject json=new JSONObject();
|
||||||
|
if(Tools.getUidOfToken(request)<=0){
|
||||||
|
json.put("msg",UserEnum.LOGIN_NOT_LOGIN.msg);
|
||||||
|
json.put("code", UserEnum.LOGIN_NOT_LOGIN.code);
|
||||||
|
return json.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
int count=100;
|
||||||
|
JSONArray array=new JSONArray();
|
||||||
|
array.addAll(Arrays.asList(likeArray.split(",")));
|
||||||
|
List<UserTeam> list=userTeamService.searchType(node,array,limit,count);
|
||||||
|
json.put("count",list.size());
|
||||||
|
json.put("data", JSONArray.toJSON(list));
|
||||||
|
if(list.size()==count){
|
||||||
|
json.put("next",true);
|
||||||
|
}else{
|
||||||
|
json.put("next",false);
|
||||||
|
}
|
||||||
|
return json.toJSONString();
|
||||||
|
}
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping("/android/map/team/topid.do")
|
||||||
|
public String getTeamByMapTop(HttpServletRequest request,int id,int limit){
|
||||||
|
JSONObject json=new JSONObject();
|
||||||
|
if(Tools.getUidOfToken(request)<=0){
|
||||||
|
json.put("msg",UserEnum.LOGIN_NOT_LOGIN.msg);
|
||||||
|
json.put("code", UserEnum.LOGIN_NOT_LOGIN.code);
|
||||||
|
return json.toString();
|
||||||
|
}
|
||||||
|
int count=100;
|
||||||
|
List<UserTeam> list=userTeamService.selectByMapTopId(id,limit,count);
|
||||||
|
json.put("count",list.size());
|
||||||
|
json.put("data", JSONArray.toJSON(list));
|
||||||
|
if(list.size()==count){
|
||||||
|
json.put("next",true);
|
||||||
|
}else{
|
||||||
|
json.put("next",false);
|
||||||
|
}
|
||||||
|
return json.toJSONString();
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package com.yutou.controller.MapTop;
|
package com.yutou.controller.MapTop;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.yutou.Data.Ship;
|
import com.yutou.enums.UserEnum;
|
||||||
import com.yutou.jianrdb.Bean.GameInfoLog;
|
import com.yutou.jianrdb.Bean.GameInfoLog;
|
||||||
import com.yutou.jianrdb.Mapper.GameInfoLogService;
|
import com.yutou.jianrdb.Mapper.GameInfoLogService;
|
||||||
import com.yutou.maptop.Bean.MapTop;
|
import com.yutou.maptop.Bean.MapTop;
|
||||||
@ -9,13 +9,19 @@ import com.yutou.maptop.Bean.UserTeam;
|
|||||||
import com.yutou.maptop.services.MapTopService;
|
import com.yutou.maptop.services.MapTopService;
|
||||||
import com.yutou.maptop.services.UserTeamService;
|
import com.yutou.maptop.services.UserTeamService;
|
||||||
import com.yutou.utlis.JianrDataTools;
|
import com.yutou.utlis.JianrDataTools;
|
||||||
import org.json.JSONObject;
|
import com.yutou.utlis.Tools;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class MapTopController {
|
public class MapTopController {
|
||||||
@ -28,35 +34,40 @@ public class MapTopController {
|
|||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping("/map/update.do")
|
@RequestMapping("/map/update.do")
|
||||||
public String updateMapTop() {
|
public String updateMapTop(String key) {
|
||||||
updateMap(1);
|
if(!"2LwK8xlmMXiMR22ru6WriR9eBllePWWYUVqrS4G5jOPWg8jGtt76gsZPi41yUTpe".equals(key)){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
updateMap();
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMap(int limit) {
|
|
||||||
List<GameInfoLog> list = gameInfoLogService.getGameInfoLogByType("DealNode", limit, 500);
|
private void updateMap() {
|
||||||
|
List<GameInfoLog> list = gameInfoLogService.getGameInfoLogByType("DealNode", 1, 500);
|
||||||
tcapprocessData(list);
|
tcapprocessData(list);
|
||||||
if (list.size() == 500) {
|
Tools.getHTTPUrlString("https://sc.ftqq.com/SCU64034T5adf5c5940dcecc016e0e9d0cf9b1e725da126ff47475.send?text=盒子更新MAP数据&desp=成功更新500条数据"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA).format(new Date()));
|
||||||
updateMap(limit + 500);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tcapprocessData(List<GameInfoLog> list) {
|
private void tcapprocessData(List<GameInfoLog> list) {
|
||||||
for (GameInfoLog gameInfoLog : list) {
|
for (GameInfoLog gameInfoLog : list) {
|
||||||
try {
|
try {
|
||||||
if (!userTeamService.checkData(gameInfoLog.getUsername(), JianrDataTools.getMapNode(gameInfoLog.getExt()), JianrDataTools.getShip(new JSONObject(gameInfoLog.getMessage()),JianrDataTools.SHIP_TITLE))) {
|
if(!JSONObject.parseObject(gameInfoLog.getExt()).getString("s").equals("pve")){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!userTeamService.checkData(gameInfoLog.getUsername(), JianrDataTools.getMapNode(gameInfoLog.getExt()), JianrDataTools.getShip(JSONObject.parseObject(gameInfoLog.getMessage()),JianrDataTools.SHIP_TITLE))) {
|
||||||
MapTop map = new MapTop();
|
MapTop map = new MapTop();
|
||||||
map.setMapid(JianrDataTools.getMapId(gameInfoLog.getExt()));
|
map.setMapid(JianrDataTools.getMapId(gameInfoLog.getExt()));
|
||||||
map.setMapNode(JianrDataTools.getMapNode(gameInfoLog.getExt()));
|
map.setMapNode(JianrDataTools.getMapNode(gameInfoLog.getExt()));
|
||||||
map.setShipTeam(JianrDataTools.getShip(new JSONObject(gameInfoLog.getMessage()),JianrDataTools.SHIP_TYPE));
|
map.setShipTeam(JianrDataTools.getShip(JSONObject.parseObject(gameInfoLog.getMessage()),JianrDataTools.SHIP_TYPE));
|
||||||
int id=mapTopService.insertMapTop(map);
|
int id=mapTopService.insertMapTop(map);
|
||||||
System.out.println(">>>>>>ID="+id);
|
System.out.println(">>>>>>ID="+id+" ---> "+JSONObject.parseObject(gameInfoLog.getExt()).getInteger("n")+" "+gameInfoLog.getId());
|
||||||
UserTeam team=new UserTeam();
|
UserTeam team=new UserTeam();
|
||||||
team.setMid(id);
|
team.setMid(id);
|
||||||
team.setMapNode(map.getMapNode());
|
team.setMapNode(map.getMapNode());
|
||||||
team.setUname(gameInfoLog.getUsername());
|
team.setUname(gameInfoLog.getUsername());
|
||||||
team.setEquipment(JSONArray.toJSONString(Ship.getInstance(new JSONObject(gameInfoLog.getMessage())).getEquipment()));
|
team.setShip(JianrDataTools.getShip(JSONObject.parseObject(gameInfoLog.getMessage())).toString());
|
||||||
team.setShip(JianrDataTools.getShip(new JSONObject(gameInfoLog.getMessage()),JianrDataTools.SHIP_TITLE));
|
team.setTitle(JianrDataTools.getShip(JSONObject.parseObject(gameInfoLog.getMessage()),JianrDataTools.SHIP_TITLE));
|
||||||
team.setCreateTime(gameInfoLog.getClient_time());
|
team.setCreateTime(gameInfoLog.getClient_time());
|
||||||
userTeamService.insertTeam(team);
|
userTeamService.insertTeam(team);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,6 @@ import java.util.List;
|
|||||||
@Qualifier("db2SqlSessionTemplate")
|
@Qualifier("db2SqlSessionTemplate")
|
||||||
public interface GameInfoLogDao {
|
public interface GameInfoLogDao {
|
||||||
|
|
||||||
@Select("select * from game_info_log where type=#{type} limit #{limit},#{count}")
|
@Select("select * from game_info_log where type=#{type} order by id desc limit #{limit},#{count}")
|
||||||
List<GameInfoLog> getAllByType(@Param("type")String type,@Param("limit")int limit,@Param("count")int count);
|
List<GameInfoLog> getAllByType(@Param("type")String type,@Param("limit")int limit,@Param("count")int count);
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ public class UserTeam {
|
|||||||
private int mid;
|
private int mid;
|
||||||
private int mapNode;
|
private int mapNode;
|
||||||
private String uname;
|
private String uname;
|
||||||
private String equipment;
|
|
||||||
private String ship;
|
private String ship;
|
||||||
|
private String title;
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
@ -59,11 +59,11 @@ public class UserTeam {
|
|||||||
this.mapNode = mapNode;
|
this.mapNode = mapNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEquipment() {
|
public String getTitle() {
|
||||||
return equipment;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEquipment(String equipment) {
|
public void setTitle(String title) {
|
||||||
this.equipment = equipment;
|
this.title = title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,11 @@ import org.apache.ibatis.annotations.*;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface MapDao {
|
public interface MapDao {
|
||||||
@Select("select * from maptop where mapId=#{mapId} limit #{limit},#{count}")
|
/**
|
||||||
|
根据mapid来查询
|
||||||
|
接口
|
||||||
|
*/
|
||||||
|
@Select("select * from maptop where mapId=#{mapId} order by mapNode limit #{limit},#{count}")
|
||||||
List<MapTop> selectMapByMapId(@Param("mapId")int mapId,@Param("limit") int limit,@Param("count")int count);
|
List<MapTop> selectMapByMapId(@Param("mapId")int mapId,@Param("limit") int limit,@Param("count")int count);
|
||||||
|
|
||||||
@Insert("insert into maptop(mapId,mapNode,shipTeam) values(#{mapId},#{mapNode},#{shipTeam})")
|
@Insert("insert into maptop(mapId,mapNode,shipTeam) values(#{mapId},#{mapNode},#{shipTeam})")
|
||||||
@ -19,6 +23,16 @@ public interface MapDao {
|
|||||||
@Select("select id from maptop order by id desc limit 1,1")
|
@Select("select id from maptop order by id desc limit 1,1")
|
||||||
int getDescId();
|
int getDescId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取完全条件
|
||||||
|
*/
|
||||||
@Select("select * from maptop where mapId=#{mapId} and mapNode=#{mapNode} and shipTeam=#{shipTeam}")
|
@Select("select * from maptop where mapId=#{mapId} and mapNode=#{mapNode} and shipTeam=#{shipTeam}")
|
||||||
MapTop selectMapByData(@Param("mapId")int mapId,@Param("mapNode")int mapNode,@Param("shipTeam")String shipTeam);
|
MapTop selectMapByData(@Param("mapId")int mapId,@Param("mapNode")int mapNode,@Param("shipTeam")String shipTeam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全部数据
|
||||||
|
*/
|
||||||
|
@Select("select * from maptop order by mapNode limit #{limit},#{count}")
|
||||||
|
List<MapTop> selectMap(@Param("limit") int limit,@Param("count")int count);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,26 @@ import org.apache.ibatis.annotations.*;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface UserTeamDao {
|
public interface UserTeamDao {
|
||||||
@Select("select * from userTeam where id=#{id}")
|
/**
|
||||||
List<UserTeam> selectTeamById(@Param("id") int id);
|
* 根据具体节点来查询详细列表
|
||||||
|
* @param mapNode 具体节点
|
||||||
|
*/
|
||||||
|
@Select("select userTeam.* from userTeam INNER join maptop as map on userTeam.mid=map.id where map.mapNode=#{mapid} order by id desc limit #{limit},#{count}")
|
||||||
|
List<UserTeam> selectTeamByMapId(@Param("mapid") int mapNode,@Param("limit") int limit,@Param("count")int count);
|
||||||
|
|
||||||
@Insert("insert into userTeam(uname,ship,createTime,mid,mapNode,equipment) values(#{uname},#{ship},#{createTime},#{mid},#{mapNode},#{equipment})")
|
/**
|
||||||
|
* 根据具体节点及筛选包含类型列表
|
||||||
|
*/
|
||||||
|
@Select("select userTeam.* from userTeam INNER join maptop as map on userTeam.mid=map.id where map.mapNode=#{mapnode} and map.shipTeam like #{llike} or shipTeam like #{like} or shipTeam like #{rlike} order by id desc limit #{limit},#{count}")
|
||||||
|
List<UserTeam> selectByMapIdAndTeamLike(@Param("mapnode")int mapnode,@Param("llike")String llike,@Param("like")String like,@Param("rlike")String rlike,@Param("limit") int limit,@Param("count")int count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据mapTop的id来获取列表
|
||||||
|
*/
|
||||||
|
@Select(" select userTeam.* from userTeam INNER join maptop as map on userTeam.mid=map.id where map.id=#{id} order by id desc limit #{limit},#{count}")
|
||||||
|
List<UserTeam> selectByMapTopId(@Param("id")int id,@Param("limit") int limit,@Param("count")int count);
|
||||||
|
|
||||||
|
@Insert("insert into userTeam(uname,ship,createTime,mid,mapNode,title) values(#{uname},#{ship},#{createTime},#{mid},#{mapNode},#{title})")
|
||||||
void insertTeam( UserTeam param);
|
void insertTeam( UserTeam param);
|
||||||
|
|
||||||
@Select("select count(id) from userTeam where uname=#{uname} and ship=#{ship} and mapNode=#{mapNode}")
|
@Select("select count(id) from userTeam where uname=#{uname} and ship=#{ship} and mapNode=#{mapNode}")
|
||||||
@ -20,4 +36,6 @@ public interface UserTeamDao {
|
|||||||
void deleteData();
|
void deleteData();
|
||||||
@Delete("DELETE FROM sqlite_sequence WHERE name = 'userTeam'")
|
@Delete("DELETE FROM sqlite_sequence WHERE name = 'userTeam'")
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.yutou.maptop.services;
|
package com.yutou.maptop.services;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.yutou.maptop.Bean.MapTop;
|
import com.yutou.maptop.Bean.MapTop;
|
||||||
import com.yutou.maptop.Dao.MapDao;
|
import com.yutou.maptop.Dao.MapDao;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -16,24 +17,28 @@ public class MapTopService {
|
|||||||
return mapDao.selectMapByMapId(mapId, limit, count);
|
return mapDao.selectMapByMapId(mapId, limit, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<MapTop> selectMap(int limit,int count){
|
||||||
|
return mapDao.selectMap(limit, count);
|
||||||
|
}
|
||||||
|
|
||||||
public int insertMapTop(MapTop top) {
|
public int insertMapTop(MapTop top) {
|
||||||
int id=0;
|
int id=0;
|
||||||
MapTop old=mapDao.selectMapByData(top.getMapid(),top.getMapNode(),top.getShipTeam());
|
MapTop old=mapDao.selectMapByData(top.getMapid(),top.getMapNode(),top.getShipTeam());
|
||||||
if(old!=null){//检测到有对应的map数据,返回id
|
if(old!=null){//检测到有对应的map数据,返回id
|
||||||
return old.getId();
|
return old.getId();
|
||||||
}else{
|
}else{
|
||||||
|
mapDao.insertMapTop(top);
|
||||||
try {
|
try {
|
||||||
id=mapDao.getDescId();//获取最后的id
|
id=mapDao.getDescId();//获取最后的id
|
||||||
}catch (Exception ignored){
|
}catch (Exception ignored){
|
||||||
|
|
||||||
}
|
}
|
||||||
mapDao.insertMapTop(top);
|
|
||||||
id++;
|
id+=1;
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int checkMap(MapTop top) {
|
|
||||||
return mapDao.checkMap(top);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.yutou.maptop.services;
|
package com.yutou.maptop.services;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.yutou.maptop.Bean.UserTeam;
|
import com.yutou.maptop.Bean.UserTeam;
|
||||||
import com.yutou.maptop.Dao.UserTeamDao;
|
import com.yutou.maptop.Dao.UserTeamDao;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -30,4 +31,18 @@ public class UserTeamService {
|
|||||||
dao.deleteData();
|
dao.deleteData();
|
||||||
dao.clear();
|
dao.clear();
|
||||||
}
|
}
|
||||||
|
public List<UserTeam> searchType(int mapnode, JSONArray like, int limit, int count){
|
||||||
|
String likesql="";
|
||||||
|
for (Object o : like) {
|
||||||
|
likesql+=(String)o+",";
|
||||||
|
}
|
||||||
|
likesql=likesql.substring(0,likesql.length()-1)+"";
|
||||||
|
return dao.selectByMapIdAndTeamLike(mapnode,"["+likesql+",%","%,"+likesql+",%","%,"+likesql+"]",limit,count);
|
||||||
|
}
|
||||||
|
public List<UserTeam> searchMapNode(int mapnode, int limit, int count){
|
||||||
|
return dao.selectTeamByMapId(mapnode,limit,count);
|
||||||
|
}
|
||||||
|
public List<UserTeam> selectByMapTopId(int id, int limit, int count){
|
||||||
|
return dao.selectByMapTopId(id,limit,count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.yutou.utlis;
|
package com.yutou.utlis;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.yutou.Data.Ship;
|
import com.yutou.Data.Ship;
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -14,12 +14,12 @@ public class JianrDataTools {
|
|||||||
|
|
||||||
public static String getShip(JSONObject message, int type) {
|
public static String getShip(JSONObject message, int type) {
|
||||||
String ship = null;
|
String ship = null;
|
||||||
if(message.isNull("warReport")){
|
if(message.getJSONObject("warReport")==null){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
JSONArray array = message.getJSONObject("warReport").getJSONArray("selfShips");
|
JSONArray array = message.getJSONObject("warReport").getJSONArray("selfShips");
|
||||||
ship = "[";
|
ship = "[";
|
||||||
for (int i = 0; i < array.length(); i++) {
|
for (int i = 0; i < array.size(); i++) {
|
||||||
Ship sp = Ship.getInstance(array.getJSONObject(i));
|
Ship sp = Ship.getInstance(array.getJSONObject(i));
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SHIP_CID:
|
case SHIP_CID:
|
||||||
@ -38,14 +38,29 @@ public class JianrDataTools {
|
|||||||
return ship;
|
return ship;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static JSONArray getShip(JSONObject message){
|
||||||
|
JSONArray equipment = new JSONArray();
|
||||||
|
if(message.getJSONObject("warReport").isEmpty()){
|
||||||
|
return equipment;
|
||||||
|
}
|
||||||
|
JSONArray array = message.getJSONObject("warReport").getJSONArray("selfShips");
|
||||||
|
for (int i = 0; i < array.size(); i++) {
|
||||||
|
Ship sp = Ship.getInstance(array.getJSONObject(i));
|
||||||
|
JSONObject item=new JSONObject();
|
||||||
|
item.put("cid",sp.getShipCid());
|
||||||
|
item.put("equipment", com.alibaba.fastjson.JSONArray.toJSON(sp.getEquipment()));
|
||||||
|
item.put("level",sp.getLevel());
|
||||||
|
equipment.add(item);
|
||||||
|
}
|
||||||
|
return equipment;
|
||||||
|
}
|
||||||
public static int getMapId(String ext) {
|
public static int getMapId(String ext) {
|
||||||
JSONObject json = new JSONObject(ext);
|
JSONObject json = JSONObject.parseObject(ext);
|
||||||
return json.getInt("n") / 100;
|
return json.getInteger("n") / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getMapNode(String ext) {
|
public static int getMapNode(String ext) {
|
||||||
JSONObject json = new JSONObject(ext);
|
JSONObject json = JSONObject.parseObject(ext);
|
||||||
return json.getInt("n");
|
return json.getInteger("n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,6 @@ public class Tools {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 设置Cookie
|
* 设置Cookie
|
||||||
* @param request
|
|
||||||
* @param response
|
* @param response
|
||||||
* @param key
|
* @param key
|
||||||
* @param value
|
* @param value
|
||||||
@ -521,12 +520,11 @@ public class Tools {
|
|||||||
if(reJson.getString("msg").equals("注册成功")) {
|
if(reJson.getString("msg").equals("注册成功")) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int uid = reJson.getInt("uid");
|
return reJson.getInt("uid");
|
||||||
return uid;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
}
|
}
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
public static boolean getUserBen(UUserdata udata) {
|
public static boolean getUserBen(UUserdata udata) {
|
||||||
if(udata.getUnbeantime()!=null) {
|
if(udata.getUnbeantime()!=null) {
|
||||||
|
Reference in New Issue
Block a user