From 4bf8db5a3d574e5175f8e08a76d08effd3b31a9e Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期五, 06 十月 2023 14:02:25 +0800
Subject: [PATCH] 厂区介绍
---
ard-work/src/main/java/com/ruoyi/statistical/service/StatisticalService.java | 2 ++
ard-work/src/main/java/com/ruoyi/statistical/controller/StatisticalController.java | 17 +++++++++++------
ard-work/src/main/java/com/ruoyi/statistical/service/impl/StatisticalServiceImpl.java | 40 ++++++++++++++++++++--------------------
3 files changed, 33 insertions(+), 26 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/statistical/controller/StatisticalController.java b/ard-work/src/main/java/com/ruoyi/statistical/controller/StatisticalController.java
index 79c72dc..6e1307c 100644
--- a/ard-work/src/main/java/com/ruoyi/statistical/controller/StatisticalController.java
+++ b/ard-work/src/main/java/com/ruoyi/statistical/controller/StatisticalController.java
@@ -5,10 +5,7 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Map;
@@ -27,11 +24,19 @@
/**
* 鍘傚尯浠嬬粛瀛樺偍
*/
- @PreAuthorize("@ss.hasPermi('minio:event:export')")
- @ApiOperation("鏍规嵁鏉冮檺鑾峰彇璁惧鍒楄〃")
+ @ApiOperation("鍘傚尯浠嬬粛瀛樺偍")
@PostMapping("factory/save")
public Results factorySave(@RequestBody Map<String,String> map){
return statisticalService.factorySave(map);
}
+ /**
+ * 鍘傚尯浠嬬粛鏌ヨ
+ */
+ @ApiOperation("鍘傚尯浠嬬粛鏌ヨ")
+ @GetMapping("factory/select")
+ public Results factorySelect(){
+ return statisticalService.factorySelect();
+ }
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/statistical/service/StatisticalService.java b/ard-work/src/main/java/com/ruoyi/statistical/service/StatisticalService.java
index 578b2c4..bde8b35 100644
--- a/ard-work/src/main/java/com/ruoyi/statistical/service/StatisticalService.java
+++ b/ard-work/src/main/java/com/ruoyi/statistical/service/StatisticalService.java
@@ -10,4 +10,6 @@
*/
public interface StatisticalService {
Results factorySave(Map<String,String> map);
+
+ Results factorySelect();
}
diff --git a/ard-work/src/main/java/com/ruoyi/statistical/service/impl/StatisticalServiceImpl.java b/ard-work/src/main/java/com/ruoyi/statistical/service/impl/StatisticalServiceImpl.java
index 7b0e13a..a5fd639 100644
--- a/ard-work/src/main/java/com/ruoyi/statistical/service/impl/StatisticalServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/statistical/service/impl/StatisticalServiceImpl.java
@@ -1,5 +1,6 @@
package com.ruoyi.statistical.service.impl;
+import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper;
@@ -11,6 +12,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.util.List;
import java.util.Map;
/**
@@ -69,26 +71,24 @@
}
}
}
- //璁板綍well琛ㄤ腑oil_production涓烘娊娌规満鐨勬暟鎹湁澶氬皯鏉�
- QueryWrapper<ArdAlarmpointsWell> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("oil_production","鎶芥补鏈�");
- int num = wellMapper.selectCount(queryWrapper);
- SysConfig sysConfigUpd = sysConfigMapper.checkConfigKeyUnique("well");
- if(sysConfigUpd!=null){
- sysConfigUpd.setConfigValue(String.valueOf(num));
- sysConfigUpd.setUpdateBy(SecurityUtils.getUsername());
- sysConfigMapper.updateConfig(sysConfigUpd);
- }else {
- SysConfig sysConfig = new SysConfig();
- int randomNum = (int) (Math.random() * (1000 - 1 + 1)) + 1;
- sysConfig.setConfigId((long) randomNum);
- sysConfig.setConfigType("Y");
- sysConfig.setConfigName("鎶芥按浜�");
- sysConfig.setConfigKey("well");
- sysConfig.setConfigValue(String.valueOf(num));
- sysConfig.setCreateBy(SecurityUtils.getUsername());
- sysConfigMapper.insertConfig(sysConfig);
- }
return Results.succeed("娣诲姞鎴愬姛锛�");
}
+
+ @Override
+ public Results factorySelect() {
+ JSONObject jsonObject = new JSONObject();
+ QueryWrapper<SysConfig> queryWrapper = new QueryWrapper<>();
+ queryWrapper.in("config_key","area","store","people","well","depot","unit");
+ List<SysConfig> list = sysConfigMapper.selectList(queryWrapper);
+ for (int i = 0; i < list.size(); i++) {
+ SysConfig sysConfig = list.get(i);
+ jsonObject.put(sysConfig.getConfigKey(),sysConfig.getConfigValue());
+ }
+ //璁板綍well琛ㄤ腑oil_production涓烘娊娌规満鐨勬暟鎹湁澶氬皯鏉�
+ QueryWrapper<ArdAlarmpointsWell> queryWrapperWell = new QueryWrapper<>();
+ queryWrapperWell.eq("oil_production","鎶芥补鏈�");
+ int num = wellMapper.selectCount(queryWrapperWell);
+ jsonObject.put("well",String.valueOf(num));
+ return Results.succeed(jsonObject);
+ }
}
--
Gitblit v1.9.3