From 1a8bffc97af1eaf85812d4d524b8b9df0dfd928e Mon Sep 17 00:00:00 2001 From: LokerL Date: Tue, 10 Sep 2024 14:04:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20feat:=20=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E7=BB=84=E4=BB=B6=E6=B7=BB=E5=8A=A0=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E4=BA=8C=E6=AC=A1=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/components/DeptTree/index.vue | 34 ++++++++++++++++--- .../dataStatistics/realtime/search-bar.vue | 34 +++++++------------ 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/ruoyi-ui/src/components/DeptTree/index.vue b/ruoyi-ui/src/components/DeptTree/index.vue index feb707f..0578f4b 100644 --- a/ruoyi-ui/src/components/DeptTree/index.vue +++ b/ruoyi-ui/src/components/DeptTree/index.vue @@ -8,6 +8,11 @@ placeholder="请选择组织部门" @select="handleDeptSelect" /> + + + {{ child.deptName }} + + @@ -15,18 +20,25 @@ import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import to from "@/utils/await-to.js"; -import { listDept} from "@/api/system/dept"; +import { listDept } from "@/api/system/dept"; export default { name: "DeptTree", components: { Treeselect, }, + props: { + showQuickGroup: { + type: Boolean, + default: false, + }, + }, data() { return { deptId: "", // 部门树数据 deptList: [], + firstChildList: [], normalizer(node) { return { id: node.deptId, @@ -56,11 +68,14 @@ export default { // this.$message.error("默认企业配置错误,请配置sys.user.defaultFactoryId"); // } // }, + quickSelect(child) { + this.deptId = child.deptId; + this.$emit("deptChange", child); + }, async initDeptList() { const [err, response] = await to( listDept({ deptName: undefined, - }) ); if (err) { @@ -71,7 +86,8 @@ export default { if (response.code === 200) { this.deptList = this.handleTree(response.data, "deptId"); this.deptId = this.deptList[0].deptId; - this.$emit("deptChange", this.deptList[0]); + this.firstChildList = this.deptList[0].children; + this.$emit("deptChange", this.deptList[0]); } else { console.error(response); this.$message.error(response.msg); @@ -85,4 +101,14 @@ export default { }; - + diff --git a/ruoyi-ui/src/views/dataStatistics/realtime/search-bar.vue b/ruoyi-ui/src/views/dataStatistics/realtime/search-bar.vue index 382aba6..2ce708e 100644 --- a/ruoyi-ui/src/views/dataStatistics/realtime/search-bar.vue +++ b/ruoyi-ui/src/views/dataStatistics/realtime/search-bar.vue @@ -1,24 +1,21 @@ @@ -36,13 +33,6 @@ export default { // chooseDept:null, deptId: "", dateValue: [], - normalizer(node) { - return { - id: node.deptId, - label: node.deptName, - children: node.children, - }; - }, }; }, mounted() { @@ -64,8 +54,8 @@ export default { ]; }, handleRadioDeptChange(value) { - this.deptId = value - this.emitChange(); + this.deptId = value; + this.emitChange(); }, handleDeptChange(value) { this.deptId = value.deptId; From 3af5658a0ea4d24d32c5ac6457385a4a0aac78d2 Mon Sep 17 00:00:00 2001 From: LokerL Date: Tue, 10 Sep 2024 14:05:37 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=9C=88=E5=BA=A6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=8A=9F=E8=83=BD=E6=A8=A1=E5=9D=97=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monthData/create-report.vue | 62 +++++++++++++++++++ .../dataStatistics/monthData/data-detail.vue | 23 +++++++ .../monthData/data-overview.vue | 23 +++++++ .../views/dataStatistics/monthData/index.vue | 59 ++++++++++++++++++ 4 files changed, 167 insertions(+) create mode 100644 ruoyi-ui/src/views/dataStatistics/monthData/create-report.vue create mode 100644 ruoyi-ui/src/views/dataStatistics/monthData/data-detail.vue create mode 100644 ruoyi-ui/src/views/dataStatistics/monthData/data-overview.vue create mode 100644 ruoyi-ui/src/views/dataStatistics/monthData/index.vue diff --git a/ruoyi-ui/src/views/dataStatistics/monthData/create-report.vue b/ruoyi-ui/src/views/dataStatistics/monthData/create-report.vue new file mode 100644 index 0000000..4053f19 --- /dev/null +++ b/ruoyi-ui/src/views/dataStatistics/monthData/create-report.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/ruoyi-ui/src/views/dataStatistics/monthData/data-detail.vue b/ruoyi-ui/src/views/dataStatistics/monthData/data-detail.vue new file mode 100644 index 0000000..fc939fc --- /dev/null +++ b/ruoyi-ui/src/views/dataStatistics/monthData/data-detail.vue @@ -0,0 +1,23 @@ + + + + + diff --git a/ruoyi-ui/src/views/dataStatistics/monthData/data-overview.vue b/ruoyi-ui/src/views/dataStatistics/monthData/data-overview.vue new file mode 100644 index 0000000..6d31b59 --- /dev/null +++ b/ruoyi-ui/src/views/dataStatistics/monthData/data-overview.vue @@ -0,0 +1,23 @@ + + + + + diff --git a/ruoyi-ui/src/views/dataStatistics/monthData/index.vue b/ruoyi-ui/src/views/dataStatistics/monthData/index.vue new file mode 100644 index 0000000..b51688d --- /dev/null +++ b/ruoyi-ui/src/views/dataStatistics/monthData/index.vue @@ -0,0 +1,59 @@ + + + + + From f0bcc70eb3f3f27f1e60de232cd260b9ba4317cc Mon Sep 17 00:00:00 2001 From: LokerL Date: Wed, 11 Sep 2024 16:51:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=9C=88=E5=BA=A6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE-=E6=8A=A5=E8=A1=A8=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=89=8D=E5=90=8E=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OilStatisticsController.java | 27 ++- .../oil/domain/ThDeviceReportMonth.java | 125 ++++++++++++ .../oil/mapper/ThDeviceReportMonthMapper.java | 32 ++++ .../service/ThDeviceReportMonthService.java | 24 +++ .../impl/ThDeviceReportMonthServiceImpl.java | 60 ++++++ .../mybatis/oil/ThDeviceReportMonthMapper.xml | 58 ++++++ ruoyi-ui/src/api/statistics/monthData.js | 17 ++ .../monthData/create-report.vue | 179 +++++++++++++++++- 8 files changed, 508 insertions(+), 14 deletions(-) create mode 100644 RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/ThDeviceReportMonth.java create mode 100644 RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceReportMonthMapper.java create mode 100644 RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/ThDeviceReportMonthService.java create mode 100644 RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/ThDeviceReportMonthServiceImpl.java create mode 100644 RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMonthMapper.xml create mode 100644 ruoyi-ui/src/api/statistics/monthData.js diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilStatisticsController.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilStatisticsController.java index 0050a1b..9acc17b 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilStatisticsController.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilStatisticsController.java @@ -7,14 +7,13 @@ import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; +import com.ruoyi.project.oil.domain.ThDeviceReportMonth; import com.ruoyi.project.oil.domain.monitor.ThDevice; import com.ruoyi.project.oil.domain.monitor.ThDeviceReport; import com.ruoyi.project.oil.service.IOilThDeviceService; +import com.ruoyi.project.oil.service.ThDeviceReportMonthService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.time.LocalDate; import java.time.format.DateTimeFormatter; @@ -30,6 +29,9 @@ public class OilStatisticsController extends BaseController { @Autowired private IOilThDeviceService oilThDeviceService; + @Autowired + private ThDeviceReportMonthService thDeviceReportMonthService; + @GetMapping(value = "/getDeviceList/{id}") public TableDataInfo getDeviceList(@PathVariable("id") Long id) { startPage(); @@ -95,4 +97,21 @@ public class OilStatisticsController extends BaseController { LocalDate lastMonthDate = date.minus(1, ChronoUnit.MONTHS); return lastMonthDate.format(formatter); } + + @GetMapping("/getDeviceReportMonthList") + public TableDataInfo getDeviceReportMonthList(Long deptId, String year, String month, int pageNum, int pageSize) { + Page page = PageHelper.startPage(pageNum, pageSize); + List> result = thDeviceReportMonthService.selectThDeviceReportMonthList(deptId, year, month); + TableDataInfo rspData = new TableDataInfo(); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setRows(result); + rspData.setMsg("查询成功"); + rspData.setTotal(page.getTotal()); + return rspData; + } + + @PostMapping("/updateDeviceReportMonth") + public AjaxResult updateDeviceReportMonth(@RequestBody ThDeviceReportMonth thDeviceReportMonth) { + return toAjax(thDeviceReportMonthService.updateThDeviceReportMonth(thDeviceReportMonth)); + } } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/ThDeviceReportMonth.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/ThDeviceReportMonth.java new file mode 100644 index 0000000..429e1ed --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/ThDeviceReportMonth.java @@ -0,0 +1,125 @@ +package com.ruoyi.project.oil.domain; + +import java.io.Serializable; + +/** + * 设备月表 + * @TableName TH_DEVICE_REPORT_MONTH1 + */ +public class ThDeviceReportMonth implements Serializable { + /** + * 设备编号 + */ + private String sn; + + /** + * + */ + private Long id; + + /** + * + */ + private Long deptId; + + /** + * + */ + private String year; + + /** + * + */ + private String month; + + /** + * 设备平均值 + */ + private String avgValue; + + private static final long serialVersionUID = 1L; + + /** + * 设备编号 + */ + public String getSn() { + return sn; + } + + /** + * 设备编号 + */ + public void setSn(String sn) { + this.sn = sn; + } + + /** + * + */ + public Long getId() { + return id; + } + + /** + * + */ + public void setId(Long id) { + this.id = id; + } + + /** + * + */ + public Long getDeptId() { + return deptId; + } + + /** + * + */ + public void setDeptId(Long deptId) { + this.deptId = deptId; + } + + /** + * + */ + public String getYear() { + return year; + } + + /** + * + */ + public void setYear(String year) { + this.year = year; + } + + /** + * + */ + public String getMonth() { + return month; + } + + /** + * + */ + public void setMonth(String month) { + this.month = month; + } + + /** + * 设备平均值 + */ + public String getAvgValue() { + return avgValue; + } + + /** + * 设备平均值 + */ + public void setAvgValue(String avgValue) { + this.avgValue = avgValue; + } +} \ No newline at end of file diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceReportMonthMapper.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceReportMonthMapper.java new file mode 100644 index 0000000..18ba25a --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceReportMonthMapper.java @@ -0,0 +1,32 @@ +package com.ruoyi.project.oil.mapper; + + +import com.ruoyi.project.oil.domain.ThDeviceReportMonth; +import org.apache.ibatis.annotations.MapKey; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** +* @author Lenovo +* @description 针对表【TH_DEVICE_REPORT_MONTH(设备月表)】的数据库操作Mapper +* @createDate 2024-09-11 13:44:21 +* @Entity com.ruoyi.project.oil.domain.ThDeviceReportMonth +*/ +public interface ThDeviceReportMonthMapper { + /** + * 查询列表 + */ + @MapKey("deptId") + List> selectThDeviceReportMonthList(@Param("deptId") Long deptId, @Param("year") String year, @Param("month") String month); + + /** + * 更新 + */ + int updateThDeviceReportMonth(ThDeviceReportMonth thDeviceReportMonth); +} + + + + diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/ThDeviceReportMonthService.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/ThDeviceReportMonthService.java new file mode 100644 index 0000000..991a009 --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/ThDeviceReportMonthService.java @@ -0,0 +1,24 @@ +package com.ruoyi.project.oil.service; + + +import com.ruoyi.project.oil.domain.ThDeviceReportMonth; + +import java.util.List; +import java.util.Map; + +/** +* @author Lenovo +* @description 针对表【TH_DEVICE_REPORT_MONTH1(设备月表)】的数据库操作Service +* @createDate 2024-09-11 13:44:21 +*/ +public interface ThDeviceReportMonthService { + /** + * 查询列表 + */ + List> selectThDeviceReportMonthList(Long deptId, String year, String month); + + /** + * 更新 + */ + int updateThDeviceReportMonth(ThDeviceReportMonth thDeviceReportMonth); +} diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/ThDeviceReportMonthServiceImpl.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/ThDeviceReportMonthServiceImpl.java new file mode 100644 index 0000000..1dae0ed --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/ThDeviceReportMonthServiceImpl.java @@ -0,0 +1,60 @@ +package com.ruoyi.project.oil.service.impl; + +import com.ruoyi.project.oil.domain.ThDeviceReportMonth; +import com.ruoyi.project.oil.mapper.ThDeviceReportMonthMapper; +import com.ruoyi.project.oil.service.ThDeviceReportMonthService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** +* @author Lenovo +* @description 针对表【TH_DEVICE_REPORT_MONTH1(设备月表)】的数据库操作Service实现 +* @createDate 2024-09-11 13:44:21 +*/ +@Service +public class ThDeviceReportMonthServiceImpl implements ThDeviceReportMonthService { + + @Autowired + private ThDeviceReportMonthMapper thDeviceReportMonthMapper; + + @Override + public List> selectThDeviceReportMonthList(Long deptId, String year, String month) { +// return thDeviceReportMonthMapper.selectThDeviceReportMonthList(deptId, year, month); + List> result = new ArrayList<>(); + List> list = thDeviceReportMonthMapper.selectThDeviceReportMonthList(deptId, year, month); + for (Map map : list) { + Map lowerCaseMap = new HashMap<>(); + for (String key : map.keySet()) { + lowerCaseMap.put(toLowerCaseCamelCase(key.toLowerCase()), map.get(key)); + } + result.add(lowerCaseMap); + } + return result; + } + + @Override + public int updateThDeviceReportMonth(ThDeviceReportMonth thDeviceReportMonth) { + return thDeviceReportMonthMapper.updateThDeviceReportMonth(thDeviceReportMonth); + } + + + public static String toLowerCaseCamelCase(String input) { + StringBuilder output = new StringBuilder(); + String[] words = input.split("_"); + output.append(words[0]); + for (int i = 1; i < words.length; i++) { + output.append(Character.toUpperCase(words[i].charAt(0))); + output.append(words[i].substring(1).toLowerCase()); + } + return output.toString(); + } +} + + + + diff --git a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMonthMapper.xml b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMonthMapper.xml new file mode 100644 index 0000000..bbc2981 --- /dev/null +++ b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMonthMapper.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + select m.sn, + m.id, + m.dept_id, + m.year, + m.month, + m.avg_value, + p.dept_name, + p.ancestors, + pp.dept_name as "gangqu" + from th_device_report_month1 m + left join sys_dept p on m.dept_id = p.dept_id + left join sys_dept pp on p.parent_id = pp.dept_id + + + + + + update th_device_report_month1 + + avg_value = #{avgValue}, + + where id = #{id} + + diff --git a/ruoyi-ui/src/api/statistics/monthData.js b/ruoyi-ui/src/api/statistics/monthData.js new file mode 100644 index 0000000..083eba4 --- /dev/null +++ b/ruoyi-ui/src/api/statistics/monthData.js @@ -0,0 +1,17 @@ +import request from '@/utils/request' + +export function getDeviceReportMonthList(params) { + return request({ + url: '/statistics/getDeviceReportMonthList', + params: params, + method: 'get', + }) +} + +export function updateDeviceReportMonth(params) { + return request({ + url: '/statistics/updateDeviceReportMonth', + data: params, + method: 'post', + }) +} diff --git a/ruoyi-ui/src/views/dataStatistics/monthData/create-report.vue b/ruoyi-ui/src/views/dataStatistics/monthData/create-report.vue index 4053f19..e680b86 100644 --- a/ruoyi-ui/src/views/dataStatistics/monthData/create-report.vue +++ b/ruoyi-ui/src/views/dataStatistics/monthData/create-report.vue @@ -5,24 +5,74 @@ - + + + + + + + + + + + + +
+ + +
+