This commit is contained in:
xbx 2024-04-09 14:23:14 +08:00
parent c70170b544
commit faf014d40b
15 changed files with 212 additions and 5 deletions

View File

@ -1,5 +1,5 @@
CREATE database if NOT EXISTS `jeecg-boot2` default character set utf8mb4 collate utf8mb4_unicode_ci;
USE `jeecg-boot2`;
CREATE database if NOT EXISTS `jeecg-boot-football` default character set utf8mb4 collate utf8mb4_unicode_ci;
USE `jeecg-boot-football`;
/*
Navicat Premium Data Transfer

View File

@ -176,7 +176,7 @@ public class SysUserController {
return result;
}
@RequiresPermissions("system:user:edit")
// @RequiresPermissions("system:user:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<SysUser> edit(@RequestBody JSONObject jsonObject) {
Result<SysUser> result = new Result<SysUser>();

View File

@ -48,6 +48,11 @@
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.3.1</version>
</dependency>
</dependencies>
<build>

View File

@ -2,6 +2,7 @@ package org.jeecg;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.oConvertUtils;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@ -18,7 +19,6 @@ import java.net.UnknownHostException;
*/
@Slf4j
@SpringBootApplication
//@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})
public class JeecgSystemApplication extends SpringBootServletInitializer {
@Override

View File

@ -0,0 +1,35 @@
package org.jeecg;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
public class Reptiles {
public static void main(String[] args) throws IOException {
//获取指定url的源码
URL url=new URL("https://dongqiudi.com/player/50000467.html");
HttpURLConnection connection=(HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setConnectTimeout(5000);
connection.setReadTimeout(5000);
//获取数据
int responseCode=connection.getResponseCode();
System.out.println(responseCode);
//获取数据
if(responseCode==200){
//流读取数据
BufferedReader reader=new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while((line=reader.readLine())!=null){
System.out.println(line);
}
reader.close();
}
}
}

View File

@ -0,0 +1,29 @@
package org.jeecg.modules.controller;
import com.alibaba.fastjson.JSONObject;
import org.jeecg.modules.service.impl.FBService;
import org.jeecg.common.api.vo.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
@RequestMapping("/football")
public class FBController {
@Resource
private FBService centerService;
@GetMapping(value = "/getMatch")
public Result<JSONObject> getMatch() throws InterruptedException {
//休眠时间
Thread.sleep(2000);
return centerService.getMatch();
}
@GetMapping(value = "/getPlayer")
public Result<JSONObject> getPlayer() throws InterruptedException {
//休眠时间
Thread.sleep(2000);
return centerService.getPlayer();
}
}

View File

@ -0,0 +1,13 @@
package org.jeecg.modules.entity;
import lombok.Data;
@Data
public class Fb_match {
private String nature;
private String date;
private String address;
private String result;
private String coach;
}

View File

@ -0,0 +1,19 @@
package org.jeecg.modules.entity;
import lombok.Data;
@Data
public class Fb_player {
private String name;
private String position;
private int age;
private String height;
private String weight;
private int speed;
private int shoot;
private int pass;
private int dribble;
private int defend;
private int power;
private int sum;
}

View File

@ -0,0 +1,2 @@
package org.jeecg.modules;public class main {
}

View File

@ -0,0 +1,9 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.Fb_match;
import org.mapstruct.Mapper;
@Mapper
public interface MatchMapper extends BaseMapper<Fb_match> {
}

View File

@ -0,0 +1,7 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.entity.Fb_player;
public interface PlayerMapper extends BaseMapper<Fb_player> {
}

View File

@ -0,0 +1,5 @@
<?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="org.jeecg.modules.mapper.MatchMapper">
</mapper>

View File

@ -0,0 +1,10 @@
package org.jeecg.modules.service;
import com.alibaba.fastjson.JSONObject;
import org.jeecg.common.api.vo.Result;
public interface IFBService {
Result<JSONObject> getMatch();
Result<JSONObject> getPlayer();
}

View File

@ -0,0 +1,72 @@
package org.jeecg.modules.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.Fb_match;
import org.jeecg.modules.entity.Fb_player;
import org.jeecg.modules.mapper.MatchMapper;
import org.jeecg.modules.mapper.PlayerMapper;
import org.jeecg.modules.service.IFBService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
public class FBService implements IFBService {
@Resource
private MatchMapper matchMapper;
@Resource
private PlayerMapper playerMapper;
@Override
public Result<JSONObject> getMatch() {
List<Fb_match> list = matchMapper.selectList(null);
JSONArray jsonArray = new JSONArray();
for(Fb_match i : list){
JSONObject fb = new JSONObject();
fb.put("nature",i.getNature());
fb.put("date",i.getDate());
fb.put("address",i.getAddress());
fb.put("result",i.getResult());
fb.put("coach",i.getCoach());
jsonArray.add(fb);
}
JSONObject result = new JSONObject();
result.put("data",jsonArray);
return Result.ok(result);
}
@Override
public Result<JSONObject> getPlayer() {
List<Fb_player> list = playerMapper.selectList(null);
JSONArray tableArray = new JSONArray();
// JSONArray chartArray = new JSONArray();
for(Fb_player i : list){
JSONObject Fbtable = new JSONObject();
List<Integer> Fbchart = new ArrayList<>();
Fbtable.put("name",i.getName());
Fbtable.put("position",i.getPosition());
Fbtable.put("age",i.getAge());
Fbtable.put("height",i.getHeight());
Fbtable.put("weight",i.getWeight());
Fbtable.put("sum",i.getSum());
Fbchart.add(i.getSpeed());
Fbchart.add(i.getShoot());
Fbchart.add(i.getPass());
Fbchart.add(i.getDribble());
Fbchart.add(i.getDefend());
Fbchart.add(i.getPower());
Fbtable.put("chart",Fbchart);
System.out.println(Fbtable);
tableArray.add(Fbtable);
}
JSONObject result = new JSONObject();
result.put("data",tableArray);
// result.put("chart",chartArray);
return Result.ok(result);
}
}

View File

@ -158,7 +158,7 @@ spring:
slow-sql-millis: 5000
datasource:
master:
url: jdbc:mysql://127.0.0.1:3306/jeecg-boot2?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
url: jdbc:mysql://127.0.0.1:3306/jeecg-boot-football?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
@ -174,6 +174,7 @@ spring:
host: 82.157.76.162
port: 6379
password: aB3cDeF9
#mybatis plus 设置
mybatis-plus:
mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml