I2新增查询功能
parent
fc1e415fb1
commit
4804848466
@ -0,0 +1,17 @@
|
|||||||
|
package com.shxy.i2.bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 常用API返回对象接口
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IErrorCode {
|
||||||
|
/**
|
||||||
|
* 返回码
|
||||||
|
*/
|
||||||
|
int getCode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回信息
|
||||||
|
*/
|
||||||
|
String getMessage();
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.shxy.i2.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压线路树状图列表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ListModel implements Serializable {
|
||||||
|
|
||||||
|
private List<Beans> list = new ArrayList<>();
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Beans {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private BigInteger history;//历史数据量
|
||||||
|
|
||||||
|
private BigInteger uploadnum;//已上传数据量
|
||||||
|
|
||||||
|
private BigInteger nownum;//今日数据量
|
||||||
|
|
||||||
|
private BigInteger nowuploadnum;//今日上传数据量
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,121 @@
|
|||||||
|
package com.shxy.i2.bean;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpStatus;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class ResponseReult<T> implements Serializable {
|
||||||
|
/**
|
||||||
|
* 返回对象
|
||||||
|
*/
|
||||||
|
private T data;
|
||||||
|
/**
|
||||||
|
* 返回状态码
|
||||||
|
*/
|
||||||
|
private int code;
|
||||||
|
/**
|
||||||
|
* 返回描述
|
||||||
|
*/
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public T getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(T data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code, String msg) {
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功消息
|
||||||
|
*
|
||||||
|
* @return 成功消息
|
||||||
|
*/
|
||||||
|
public static <T> ResponseReult<T> success(T obj) {
|
||||||
|
ResponseReult<T> success = ResponseReult.success();
|
||||||
|
if (obj != null) {
|
||||||
|
success.setData(obj);
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回成功消息
|
||||||
|
*
|
||||||
|
* @return 成功消息
|
||||||
|
*/
|
||||||
|
public static <T> ResponseReult<T> success() {
|
||||||
|
ResponseReult<T> response = new ResponseReult<>();
|
||||||
|
response.setCode(HttpStatus.HTTP_OK, "操作成功");
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败返回结果
|
||||||
|
*
|
||||||
|
* @param message 错误信息
|
||||||
|
*/
|
||||||
|
public static <T> ResponseReult<T> fail(String message) {
|
||||||
|
return ResponseReult.error(HttpStatus.HTTP_BAD_REQUEST, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ResponseReult<T> fail(int code, String msg) {
|
||||||
|
ResponseReult<T> response = new ResponseReult<>();
|
||||||
|
response.setCode(code, msg);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 返回失败消息
|
||||||
|
*
|
||||||
|
* @return 失败消息
|
||||||
|
*/
|
||||||
|
public static <T> ResponseReult<T> error(int code, String msg) {
|
||||||
|
ResponseReult<T> response = new ResponseReult<>();
|
||||||
|
response.setCode(code, msg);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败返回结果
|
||||||
|
*
|
||||||
|
* @param errorCode 错误码
|
||||||
|
*/
|
||||||
|
public static <T> ResponseReult<T> error(IErrorCode errorCode) {
|
||||||
|
return ResponseReult.error(errorCode.getCode(), errorCode.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败返回结果
|
||||||
|
*
|
||||||
|
* @param message 错误信息
|
||||||
|
*/
|
||||||
|
public static <T> ResponseReult<T> error(String message) {
|
||||||
|
return ResponseReult.error(HttpStatus.HTTP_INTERNAL_ERROR, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.shxy.i2.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* service服务请求返回
|
||||||
|
*
|
||||||
|
* @author 晶晶
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ServiceBody<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回体
|
||||||
|
*/
|
||||||
|
private T data;
|
||||||
|
/**
|
||||||
|
* 返回状态码
|
||||||
|
*/
|
||||||
|
private int code;
|
||||||
|
/**
|
||||||
|
* 错误描述
|
||||||
|
*/
|
||||||
|
private String msg;
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.shxy.i2.bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回状态码
|
||||||
|
*
|
||||||
|
* @author xzg
|
||||||
|
*/
|
||||||
|
public class ServiceStatus {
|
||||||
|
/**
|
||||||
|
* 操作成功
|
||||||
|
*/
|
||||||
|
public static final int SUCCESS = 200;
|
||||||
|
/**
|
||||||
|
* 操作失败
|
||||||
|
*/
|
||||||
|
public static final int ERROR = 400;
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.shxy.i2.controller;
|
||||||
|
|
||||||
|
import com.shxy.i2.bean.ListModel;
|
||||||
|
import com.shxy.i2.bean.ResponseReult;
|
||||||
|
import com.shxy.i2.bean.ServiceBody;
|
||||||
|
import com.shxy.i2.bean.ServiceStatus;
|
||||||
|
import com.shxy.i2.service.XydlI2Service;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
public class CheckController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
XydlI2Service xydlI2Service;
|
||||||
|
|
||||||
|
@RequestMapping("/list")
|
||||||
|
public ResponseReult<ListModel> list() {
|
||||||
|
ServiceBody<ListModel> serviceBody = xydlI2Service.list();
|
||||||
|
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
|
||||||
|
return ResponseReult.success(serviceBody.getData());
|
||||||
|
} else {
|
||||||
|
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -1,80 +1,76 @@
|
|||||||
package com.shxy.i2.timeTask;
|
//package com.shxy.i2.timeTask;
|
||||||
|
//
|
||||||
import com.shxy.i2.bean.AttrBean;
|
//import com.shxy.i2.service.Webservcies;
|
||||||
import com.shxy.i2.service.Webservcies;
|
//import com.shxy.i2.service.XydlI2Service;
|
||||||
import com.shxy.i2.service.XydlI2Service;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.apache.cxf.endpoint.Client;
|
//import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
//import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
//import org.springframework.stereotype.Component;
|
||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
//
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
///**
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
// * @author jingjing
|
||||||
import org.springframework.stereotype.Component;
|
// * @date 2023-11-16 15:06
|
||||||
|
// */
|
||||||
/**
|
//@Component
|
||||||
* @author jingjing
|
//@EnableScheduling
|
||||||
* @date 2023-11-16 15:06
|
//@Slf4j
|
||||||
*/
|
////@EnableAsync
|
||||||
@Component
|
//public class ScheduledTask {
|
||||||
@EnableScheduling
|
//
|
||||||
@Slf4j
|
// @Autowired
|
||||||
//@EnableAsync
|
// Webservcies webservcies;
|
||||||
public class ScheduledTask {
|
//
|
||||||
|
// @Autowired
|
||||||
@Autowired
|
// XydlI2Service xydlI2Service;
|
||||||
Webservcies webservcies;
|
//
|
||||||
|
// @Scheduled(fixedDelay = 60 * 60 * 1000)
|
||||||
@Autowired
|
// public void cacyspupload() {
|
||||||
XydlI2Service xydlI2Service;
|
// log.info("cacyspupload执行" );
|
||||||
|
// webservcies.uploadyspData();
|
||||||
@Scheduled(fixedDelay = 60 * 60 * 1000)
|
// }
|
||||||
public void cacyspupload() {
|
//
|
||||||
log.info("cacyspupload执行" );
|
// @Scheduled(fixedDelay = 1 * 30 * 1000)
|
||||||
webservcies.uploadyspData();
|
// public void cacjfjcupload() {
|
||||||
}
|
// log.info("cacjfjcupload执行" );
|
||||||
|
// webservcies.uploadjfjcData();
|
||||||
@Scheduled(fixedDelay = 1 * 30 * 1000)
|
// }
|
||||||
public void cacjfjcupload() {
|
//
|
||||||
log.info("cacjfjcupload执行" );
|
// @Scheduled(fixedDelay = 1 * 30 * 1000)
|
||||||
webservcies.uploadjfjcData();
|
// public void cacupload() {
|
||||||
}
|
// log.info("cacupload执行" );
|
||||||
|
// webservcies.uploadData();
|
||||||
@Scheduled(fixedDelay = 1 * 30 * 1000)
|
// }
|
||||||
public void cacupload() {
|
//
|
||||||
log.info("cacupload执行" );
|
// @Scheduled(fixedDelay = 1 * 30 * 1000)
|
||||||
webservcies.uploadData();
|
// public void cactxupload() {
|
||||||
}
|
// log.info("cactxupload执行" );
|
||||||
|
// webservcies.uploadtxData();
|
||||||
@Scheduled(fixedDelay = 1 * 30 * 1000)
|
// }
|
||||||
public void cactxupload() {
|
//
|
||||||
log.info("cactxupload执行" );
|
// @Scheduled(fixedDelay = 1 * 30 * 1000)
|
||||||
webservcies.uploadtxData();
|
// public void cacyxupload() {
|
||||||
}
|
// log.info("cacyxupload执行" );
|
||||||
|
// webservcies.uploadyxData();
|
||||||
@Scheduled(fixedDelay = 1 * 30 * 1000)
|
// }
|
||||||
public void cacyxupload() {
|
//
|
||||||
log.info("cacyxupload执行" );
|
// @Scheduled(fixedDelay = 1 * 30 * 1000)
|
||||||
webservcies.uploadyxData();
|
// public void cacdcywupload() {
|
||||||
}
|
// log.info("cacdcywupload执行" );
|
||||||
|
// webservcies.uploaddcywData();
|
||||||
@Scheduled(fixedDelay = 1 * 30 * 1000)
|
// }
|
||||||
public void cacdcywupload() {
|
//
|
||||||
log.info("cacdcywupload执行" );
|
// @Scheduled(fixedDelay = 1 * 30 * 1000)
|
||||||
webservcies.uploaddcywData();
|
// public void cacjsyhwjyjcupload() {
|
||||||
}
|
// log.info("cacjsyhwjyjcupload执行" );
|
||||||
|
// webservcies.uploadjsyhwjyjcData();
|
||||||
@Scheduled(fixedDelay = 1 * 30 * 1000)
|
// }
|
||||||
public void cacjsyhwjyjcupload() {
|
//
|
||||||
log.info("cacjsyhwjyjcupload执行" );
|
//
|
||||||
webservcies.uploadjsyhwjyjcData();
|
// @Scheduled(cron = "0 0 13 * * ?")
|
||||||
}
|
// public void clear() {
|
||||||
|
// log.info("clear" );
|
||||||
|
// xydlI2Service.clear_history();
|
||||||
@Scheduled(cron = "0 0 13 * * ?")
|
// }
|
||||||
public void clear() {
|
//
|
||||||
log.info("clear" );
|
//}
|
||||||
xydlI2Service.clear_history();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue