|
|
@@ -1,24 +1,32 @@
|
|
|
package com.template.controller;
|
|
|
|
|
|
+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.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
import com.template.annotation.DESRespondSecret;
|
|
|
import com.template.annotation.PassToken;
|
|
|
import com.template.api.DriverStockControllerAPI;
|
|
|
+import com.template.common.utils.TimeExchange;
|
|
|
import com.template.model.pojo.SmartUser;
|
|
|
import com.template.model.pojo.SmartWarning;
|
|
|
import com.template.model.result.CommonResult;
|
|
|
import com.template.model.result.PageUtils;
|
|
|
-import com.template.model.tongji.Tj;
|
|
|
-import com.template.model.tongji.TjFloat;
|
|
|
+import com.template.model.tongji.*;
|
|
|
import com.template.services.DriverStockService;
|
|
|
import com.template.services.SmartUserService;
|
|
|
import com.template.services.SmartWarningService;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Calendar;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Controller
|
|
|
@@ -78,4 +86,91 @@ public class DriverStockController implements DriverStockControllerAPI {
|
|
|
return CommonResult.ok(list);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @PassToken
|
|
|
+ @DESRespondSecret(validated = false)
|
|
|
+ public CommonResult getEnergyMonth(Integer type) {
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
|
|
|
+ List<JSONObject> jList = new ArrayList<>();
|
|
|
+ for (int i=-5; i<=0; i++) {
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.add(Calendar.MONTH, i);
|
|
|
+ String date = simpleDateFormat.format(calendar.getTime());
|
|
|
+ List<TjFloat> list = driverStockService.getEnergyMonth(date,type);
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("month", date);
|
|
|
+ jsonObject.put("data", list);
|
|
|
+ jList.add(jsonObject);
|
|
|
+ }
|
|
|
+ return CommonResult.ok(jList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @PassToken
|
|
|
+ @DESRespondSecret(validated = false)
|
|
|
+ public CommonResult getDeviceT(){
|
|
|
+ List<JSONObject> list = new ArrayList<>();
|
|
|
+ JSONObject jsonObject1 = new JSONObject();
|
|
|
+ List<TjFloat> allList = driverStockService.getTotalDevice();
|
|
|
+ jsonObject1.put("name", "总设备数");
|
|
|
+ jsonObject1.put("data", allList);
|
|
|
+ list.add(jsonObject1);
|
|
|
+ List<TjFloat> onlineList = driverStockService.getOnlineDevice(TimeExchange.getDate());
|
|
|
+ JSONObject jsonObject2 = new JSONObject();
|
|
|
+ jsonObject2.put("name", "在线设备数");
|
|
|
+ jsonObject2.put("data", onlineList);
|
|
|
+ list.add(jsonObject2);
|
|
|
+ return CommonResult.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @PassToken
|
|
|
+ @DESRespondSecret(validated = false)
|
|
|
+ public CommonResult getMeterPage(int currentPage, int pageCount,Integer meterType) {
|
|
|
+ PageHelper.startPage(currentPage, pageCount);
|
|
|
+ PageInfo<MeterPage> list = driverStockService.getMeterDetail(meterType);
|
|
|
+ return CommonResult.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @PassToken
|
|
|
+ @DESRespondSecret(validated = false)
|
|
|
+ public CommonResult getUserComp() {
|
|
|
+ List<Tj> list = driverStockService.getUserComp();
|
|
|
+ return CommonResult.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @PassToken
|
|
|
+ @DESRespondSecret(validated = false)
|
|
|
+ public CommonResult getUserPage(int currentPage, int pageCount,String key,Integer identityId){
|
|
|
+ PageHelper.startPage(currentPage, pageCount);
|
|
|
+ PageInfo<userPage> list = driverStockService.getUserPage(key,identityId);
|
|
|
+ return CommonResult.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @PassToken
|
|
|
+ @DESRespondSecret(validated = false)
|
|
|
+ public CommonResult getScorePer(String examName,String updateUser){
|
|
|
+ List<Tj> list = driverStockService.getScorePer(examName,updateUser);
|
|
|
+ return CommonResult.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @PassToken
|
|
|
+ @DESRespondSecret(validated = false)
|
|
|
+ public CommonResult getExamName(){
|
|
|
+ List<Tj> list = driverStockService.getExamName();
|
|
|
+ return CommonResult.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @PassToken
|
|
|
+ @DESRespondSecret(validated = false)
|
|
|
+ public CommonResult getTeacherExam(String cardNo){
|
|
|
+ Tj list = driverStockService.getTeacherExam(cardNo);
|
|
|
+ return CommonResult.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
}
|