Commit 2ca2c50b97f17bab99d67d6453ed73e2d05518c9
Merge branch 'dev' of http://gitlab1.renniting.cn/JCSS/urbanops into dev
# Conflicts: # urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/ErrorCodeConstants.java
Showing
279 changed files
with
10850 additions
and
810 deletions
Too many changes.
To preserve performance only 100 of 279 files are displayed.
.gitignore
| ... | ... | @@ -53,3 +53,15 @@ application-my.yaml |
| 53 | 53 | /urbanops-ui-app/unpackage/ |
| 54 | 54 | **/.DS_Store |
| 55 | 55 | old/ |
| 56 | +/.claudeignore | |
| 57 | +/docs/all_test.html | |
| 58 | +/docs/ppt-assets/animations.css | |
| 59 | +/docs/ppt-assets/base.css | |
| 60 | +/CLAUDE.md | |
| 61 | +/urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/ErrorCodeConstants_手动操作.java | |
| 62 | +/docs/ppt-assets/fonts.css | |
| 63 | +/docs/ppt-assets/runtime.js | |
| 64 | +/.claude/settings.local.json | |
| 65 | +/docs/ppt-assets/style.css | |
| 66 | +/docs/urbanops-architecture-ppt.html | |
| 67 | +/docs/urbanops-tech-sharing.html | ... | ... |
pom.xml
| ... | ... | @@ -49,6 +49,7 @@ |
| 49 | 49 | <spring.boot.version>3.5.5</spring.boot.version> |
| 50 | 50 | <mapstruct.version>1.6.3</mapstruct.version> |
| 51 | 51 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 52 | + <maven.build.timestamp.format>yyyyMMdd-HHmm</maven.build.timestamp.format> | |
| 52 | 53 | </properties> |
| 53 | 54 | |
| 54 | 55 | <dependencyManagement> | ... | ... |
sql/mysql/garden_problem_type-fix.sql
0 → 100644
| 1 | +-- ================================================= | |
| 2 | +-- garden_problem_type 表结构补全 | |
| 3 | +-- 原因:BaseDO 包含 create_time/update_time/creator/updater/deleted | |
| 4 | +-- MyBatis Plus @TableLogic 自动 WHERE deleted=0 | |
| 5 | +-- 缺少这些列会导致 SQL 报错或无数据返回 | |
| 6 | +-- ================================================= | |
| 7 | + | |
| 8 | +-- 如果表已存在数据,先备份 | |
| 9 | +-- CREATE TABLE garden_problem_type_bak AS SELECT * FROM garden_problem_type; | |
| 10 | + | |
| 11 | +-- 方案1:删表重建(无重要数据时) | |
| 12 | +DROP TABLE IF EXISTS `garden_problem_type`; | |
| 13 | +CREATE TABLE `garden_problem_type` ( | |
| 14 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID', | |
| 15 | + `type_code` varchar(32) NOT NULL COMMENT '问题类型编码', | |
| 16 | + `type_name` varchar(64) NOT NULL COMMENT '问题类型名称', | |
| 17 | + `level` tinyint NOT NULL COMMENT '层级:1一级 2二级 3三级', | |
| 18 | + `parent_code` varchar(32) DEFAULT NULL COMMENT '父级类型编码', | |
| 19 | + `sort` int DEFAULT 0 COMMENT '排序序号', | |
| 20 | + `status` tinyint DEFAULT 1 COMMENT '状态 1启用 0禁用', | |
| 21 | + `creator` varchar(64) DEFAULT '' COMMENT '创建者', | |
| 22 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 23 | + `updater` varchar(64) DEFAULT '' COMMENT '更新者', | |
| 24 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 25 | + `deleted` tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除 0正常 1删除', | |
| 26 | + PRIMARY KEY (`id`), | |
| 27 | + UNIQUE KEY `uk_type_code` (`type_code`) | |
| 28 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='问题类型三级分类表'; | |
| 29 | + | |
| 30 | +-- 方案2:已有数据时,用 ALTER 补齐缺失列(按需执行) | |
| 31 | +-- ALTER TABLE garden_problem_type ADD COLUMN `creator` varchar(64) DEFAULT '' COMMENT '创建者' AFTER `status`; | |
| 32 | +-- ALTER TABLE garden_problem_type ADD COLUMN `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间' AFTER `creator`; | |
| 33 | +-- ALTER TABLE garden_problem_type ADD COLUMN `updater` varchar(64) DEFAULT '' COMMENT '更新者' AFTER `create_time`; | |
| 34 | +-- ALTER TABLE garden_problem_type ADD COLUMN `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' AFTER `updater`; | |
| 35 | +-- ALTER TABLE garden_problem_type ADD COLUMN `deleted` tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除' AFTER `update_time`; | ... | ... |
sql/mysql/problem-type-menu-auto.sql
0 → 100644
| 1 | +-- ================================================= | |
| 2 | +-- 问题类型配置 - 菜单与权限 SQL(自动查找父菜单ID) | |
| 3 | +-- 直接执行即可,自动从「工单管理」下挂载菜单 | |
| 4 | +-- ================================================= | |
| 5 | + | |
| 6 | +-- 查询当前最大 ID 作为起始值 | |
| 7 | +SET @maxId = (SELECT IFNULL(MAX(id), 5000) FROM system_menu); | |
| 8 | + | |
| 9 | +-- 查询工单管理 菜单ID | |
| 10 | +SET @parentId = (SELECT id FROM system_menu WHERE name = '工单管理' AND type = 1 LIMIT 1); | |
| 11 | + | |
| 12 | +-- 如果找不到工单管理,尝试匹配 workorder 关键字 | |
| 13 | +-- SET @parentId = (SELECT id FROM system_menu WHERE (name LIKE '%工单%' OR path LIKE '%workorder%') AND type = 1 LIMIT 1); | |
| 14 | + | |
| 15 | +-- 1. 二级菜单:问题类型 | |
| 16 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) | |
| 17 | +VALUES (@maxId + 1, '问题类型', '', 2, 10, @parentId, 'problem-type', 'ep:list', 'garden/problemType/index', 'ProblemType', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'); | |
| 18 | + | |
| 19 | +-- 2. 按钮:查询 | |
| 20 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) | |
| 21 | +VALUES (@maxId + 2, '问题类型查询', 'garden:problem-type:query', 3, 1, @maxId + 1, '', '', '', '', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'); | |
| 22 | + | |
| 23 | +-- 3. 按钮:创建 | |
| 24 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) | |
| 25 | +VALUES (@maxId + 3, '问题类型创建', 'garden:problem-type:create', 3, 2, @maxId + 1, '', '', '', '', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'); | |
| 26 | + | |
| 27 | +-- 4. 按钮:更新 | |
| 28 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) | |
| 29 | +VALUES (@maxId + 4, '问题类型更新', 'garden:problem-type:update', 3, 3, @maxId + 1, '', '', '', '', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'); | |
| 30 | + | |
| 31 | +-- 5. 按钮:删除 | |
| 32 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) | |
| 33 | +VALUES (@maxId + 5, '问题类型删除', 'garden:problem-type:delete', 3, 4, @maxId + 1, '', '', '', '', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'); | ... | ... |
sql/mysql/problem-type-menu.sql
0 → 100644
| 1 | +-- ================================================= | |
| 2 | +-- 问题类型配置 - 菜单与权限 SQL | |
| 3 | +-- 说明: | |
| 4 | +-- 1. 请先查询「工单管理」的菜单 ID,替换下面 @parentId 为实际值 | |
| 5 | +-- 查询语句:SELECT id FROM system_menu WHERE name = '工单管理' AND type = 1; | |
| 6 | +-- 2. 修改下面 @menuId 为可用的起始 ID(确保不与已有菜单 ID 冲突) | |
| 7 | +-- 查询最大ID:SELECT MAX(id) FROM system_menu; | |
| 8 | +-- 3. 执行前请备份 system_menu 表 | |
| 9 | +-- ================================================= | |
| 10 | + | |
| 11 | +-- 请根据实际情况替换以下变量值: | |
| 12 | +-- SET @parentId = (SELECT id FROM system_menu WHERE name = '工单管理' AND type = 1); | |
| 13 | +-- SET @menuId = (SELECT IFNULL(MAX(id), 0) + 1 FROM system_menu); | |
| 14 | + | |
| 15 | +-- 示例:假设工单管理 parent_id = 2000,起始 menu_id = 5100 | |
| 16 | + | |
| 17 | +-- 1. 二级菜单:问题类型 | |
| 18 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) | |
| 19 | +VALUES (@menuId, '问题类型', '', 2, 10, @parentId, 'problem-type', 'ep:list', 'garden/problemType/index', 'ProblemType', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'); | |
| 20 | + | |
| 21 | +-- 2. 按钮权限:查询 | |
| 22 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) | |
| 23 | +VALUES (@menuId + 1, '问题类型查询', 'garden:problem-type:query', 3, 1, @menuId, '', '', '', '', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'); | |
| 24 | + | |
| 25 | +-- 3. 按钮权限:创建 | |
| 26 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) | |
| 27 | +VALUES (@menuId + 2, '问题类型创建', 'garden:problem-type:create', 3, 2, @menuId, '', '', '', '', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'); | |
| 28 | + | |
| 29 | +-- 4. 按钮权限:更新 | |
| 30 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) | |
| 31 | +VALUES (@menuId + 3, '问题类型更新', 'garden:problem-type:update', 3, 3, @menuId, '', '', '', '', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'); | |
| 32 | + | |
| 33 | +-- 5. 按钮权限:删除 | |
| 34 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) | |
| 35 | +VALUES (@menuId + 4, '问题类型删除', 'garden:problem-type:delete', 3, 4, @menuId, '', '', '', '', 0, b'1', b'1', b'1', '1', NOW(), '1', NOW(), b'0'); | ... | ... |
urbanops-dependencies/pom.xml
| ... | ... | @@ -76,6 +76,7 @@ |
| 76 | 76 | <jimureport.version>2.1.1</jimureport.version> |
| 77 | 77 | <jimubi.version>2.1.0</jimubi.version> |
| 78 | 78 | <weixin-java.version>4.7.7-20250808.182223</weixin-java.version> |
| 79 | + <maven.build.timestamp.format>yyyyMMdd-HHmm</maven.build.timestamp.format> | |
| 79 | 80 | </properties> |
| 80 | 81 | |
| 81 | 82 | <dependencyManagement> | ... | ... |
urbanops-framework/urbanops-common/src/main/java/com/zteits/urbanops/framework/common/pojo/PageParam.java
| ... | ... | @@ -72,7 +72,8 @@ public class PageParam implements Serializable { |
| 72 | 72 | public void setOrderByColumn(String orderByColumn) { |
| 73 | 73 | if (!StringUtils.hasText(orderByColumn)) { |
| 74 | 74 | this.orderByColumn = "id"; |
| 75 | - return; | |
| 75 | + } else { | |
| 76 | + this.orderByColumn = orderByColumn; | |
| 76 | 77 | } |
| 77 | 78 | |
| 78 | 79 | } | ... | ... |
urbanops-framework/urbanops-common/src/main/java/com/zteits/urbanops/framework/common/util/date/DateUtils.java
| ... | ... | @@ -3,6 +3,7 @@ package com.zteits.urbanops.framework.common.util.date; |
| 3 | 3 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 4 | 4 | |
| 5 | 5 | import java.time.*; |
| 6 | +import java.time.format.DateTimeFormatter; | |
| 6 | 7 | import java.util.Calendar; |
| 7 | 8 | import java.util.Date; |
| 8 | 9 | |
| ... | ... | @@ -18,6 +19,9 @@ public class DateUtils { |
| 18 | 19 | */ |
| 19 | 20 | public static final String TIME_ZONE_DEFAULT = "GMT+8"; |
| 20 | 21 | |
| 22 | + public static final ZoneId DEFAULT_ZONE = ZoneId.of("GMT+8"); // 东八区 | |
| 23 | + | |
| 24 | + | |
| 21 | 25 | /** |
| 22 | 26 | * 秒转换成毫秒 |
| 23 | 27 | */ |
| ... | ... | @@ -27,6 +31,10 @@ public class DateUtils { |
| 27 | 31 | |
| 28 | 32 | public static final String FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "yyyy-MM-dd HH:mm:ss"; |
| 29 | 33 | |
| 34 | + public static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); | |
| 35 | + public static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); | |
| 36 | + | |
| 37 | + | |
| 30 | 38 | /** |
| 31 | 39 | * 将 LocalDateTime 转换成 Date |
| 32 | 40 | * | ... | ... |
urbanops-framework/urbanops-common/src/main/java/com/zteits/urbanops/framework/common/util/validation/ValidationUtils.java
| ... | ... | @@ -18,8 +18,9 @@ import java.util.regex.Pattern; |
| 18 | 18 | */ |
| 19 | 19 | public class ValidationUtils { |
| 20 | 20 | |
| 21 | - private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[0,1,4-9])|(?:5[0-3,5-9])|(?:6[2,5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[0-3,5-9]))\\d{8}$"); | |
| 22 | - | |
| 21 | + //private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[0,1,4-9])|(?:5[0-3,5-9])|(?:6[2,5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[0-3,5-9]))\\d{8}$"); | |
| 22 | + //add by wq 20260327 手机号码校验覆盖全号段 | |
| 23 | + private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:\\+86|0086)?1[3-9]\\d{9}$"); | |
| 23 | 24 | private static final Pattern PATTERN_URL = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"); |
| 24 | 25 | |
| 25 | 26 | private static final Pattern PATTERN_XML_NCNAME = Pattern.compile("[a-zA-Z_][\\-_.0-9_a-zA-Z$]*"); |
| ... | ... | @@ -51,5 +52,4 @@ public class ValidationUtils { |
| 51 | 52 | throw new ConstraintViolationException(constraintViolations); |
| 52 | 53 | } |
| 53 | 54 | } |
| 54 | - | |
| 55 | 55 | } | ... | ... |
urbanops-framework/urbanops-spring-boot-starter-excel/src/main/java/com/zteits/urbanops/framework/excel/core/convert/BusinessLineConvert.java
0 → 100644
| 1 | +package com.zteits.urbanops.framework.excel.core.convert; | |
| 2 | + | |
| 3 | +import cn.idev.excel.converters.Converter; | |
| 4 | +import cn.idev.excel.enums.CellDataTypeEnum; | |
| 5 | +import cn.idev.excel.metadata.GlobalConfiguration; | |
| 6 | +import cn.idev.excel.metadata.data.ReadCellData; | |
| 7 | +import cn.idev.excel.metadata.data.WriteCellData; | |
| 8 | +import cn.idev.excel.metadata.property.ExcelContentProperty; | |
| 9 | +import lombok.extern.slf4j.Slf4j; | |
| 10 | + | |
| 11 | +@Slf4j | |
| 12 | +public class BusinessLineConvert implements Converter<Object> { | |
| 13 | + | |
| 14 | + @Override | |
| 15 | + public Class<?> supportJavaTypeKey() { | |
| 16 | + throw new UnsupportedOperationException("暂不支持,也不需要"); | |
| 17 | + } | |
| 18 | + | |
| 19 | + @Override | |
| 20 | + public CellDataTypeEnum supportExcelTypeKey() { | |
| 21 | + throw new UnsupportedOperationException("暂不支持,也不需要"); | |
| 22 | + } | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 导入:业务线名称(园林,市政) → 编码(yl,sz) | |
| 26 | + */ | |
| 27 | + @Override | |
| 28 | + public Object convertToJavaData(ReadCellData<?> readCellData, ExcelContentProperty contentProperty, | |
| 29 | + GlobalConfiguration globalConfiguration) { | |
| 30 | + String cellValue = readCellData.getStringValue(); | |
| 31 | + if (cellValue == null || cellValue.isBlank()) { | |
| 32 | + return null; | |
| 33 | + } | |
| 34 | + | |
| 35 | + try { | |
| 36 | + // 按逗号切割 | |
| 37 | + String[] lineArray = cellValue.split(","); | |
| 38 | + StringBuilder codeSb = new StringBuilder(); | |
| 39 | + | |
| 40 | + for (String line : lineArray) { | |
| 41 | + String code = convertLineToCode(line.trim()); | |
| 42 | + if (codeSb.length() > 0) { | |
| 43 | + codeSb.append(","); | |
| 44 | + } | |
| 45 | + codeSb.append(code); | |
| 46 | + } | |
| 47 | + | |
| 48 | + return codeSb.toString(); | |
| 49 | + } catch (Exception e) { | |
| 50 | + log.error("[convertToJavaData][业务线转换异常] {}", cellValue, e); | |
| 51 | + return null; | |
| 52 | + } | |
| 53 | + } | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 导出:业务线编码(yl,sz) → 名称(园林,市政) | |
| 57 | + */ | |
| 58 | + @Override | |
| 59 | + public WriteCellData<?> convertToExcelData(Object value, ExcelContentProperty contentProperty, | |
| 60 | + GlobalConfiguration globalConfiguration) { | |
| 61 | + if (value == null) { | |
| 62 | + return new WriteCellData<>(""); | |
| 63 | + } | |
| 64 | + | |
| 65 | + try { | |
| 66 | + String codeValue = String.valueOf(value); | |
| 67 | + String[] codeArray = codeValue.split(","); | |
| 68 | + StringBuilder nameSb = new StringBuilder(); | |
| 69 | + | |
| 70 | + for (String code : codeArray) { | |
| 71 | + String name = convertCodeToLine(code.trim()); | |
| 72 | + if (nameSb.length() > 0) { | |
| 73 | + nameSb.append(","); | |
| 74 | + } | |
| 75 | + nameSb.append(name); | |
| 76 | + } | |
| 77 | + | |
| 78 | + return new WriteCellData<>(nameSb.toString()); | |
| 79 | + } catch (Exception e) { | |
| 80 | + log.error("[convertToExcelData][业务线转换异常] {}", value, e); | |
| 81 | + return new WriteCellData<>(""); | |
| 82 | + } | |
| 83 | + } | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 名称 → 编码 | |
| 87 | + */ | |
| 88 | + private String convertLineToCode(String line) { | |
| 89 | + return switch (line) { | |
| 90 | + case "园林" -> "yl"; | |
| 91 | + case "市政" -> "sz"; | |
| 92 | + case "物业" -> "wy"; | |
| 93 | + case "秩序管理" -> "zx"; | |
| 94 | + case "环境卫生" -> "hj"; | |
| 95 | + default -> ""; | |
| 96 | + }; | |
| 97 | + } | |
| 98 | + | |
| 99 | + /** | |
| 100 | + * 编码 → 名称 | |
| 101 | + */ | |
| 102 | + private String convertCodeToLine(String code) { | |
| 103 | + return switch (code) { | |
| 104 | + case "yl" -> "园林"; | |
| 105 | + case "sz" -> "市政"; | |
| 106 | + case "wy" -> "物业"; | |
| 107 | + case "zx" -> "秩序管理"; | |
| 108 | + case "hj" -> "环境卫生"; | |
| 109 | + default -> ""; | |
| 110 | + }; | |
| 111 | + } | |
| 112 | +} | ... | ... |
urbanops-framework/urbanops-spring-boot-starter-excel/src/main/java/com/zteits/urbanops/framework/excel/core/convert/ImageListConverter.java
0 → 100644
| 1 | +package com.zteits.urbanops.framework.excel.core.convert; | |
| 2 | + | |
| 3 | +import cn.idev.excel.converters.Converter; | |
| 4 | +import cn.idev.excel.enums.CellDataTypeEnum; | |
| 5 | +import cn.idev.excel.metadata.GlobalConfiguration; | |
| 6 | +import cn.idev.excel.metadata.data.ImageData; | |
| 7 | +import cn.idev.excel.metadata.data.ReadCellData; | |
| 8 | +import cn.idev.excel.metadata.data.WriteCellData; | |
| 9 | +import cn.idev.excel.metadata.property.ExcelContentProperty; | |
| 10 | +import cn.idev.excel.util.FileUtils; | |
| 11 | +import cn.idev.excel.util.ListUtils; | |
| 12 | +import lombok.extern.slf4j.Slf4j; | |
| 13 | +import org.springframework.util.StringUtils; | |
| 14 | + | |
| 15 | +import java.io.ByteArrayOutputStream; | |
| 16 | +import java.io.File; | |
| 17 | +import java.io.InputStream; | |
| 18 | +import java.net.HttpURLConnection; | |
| 19 | +import java.net.URL; | |
| 20 | +import java.util.List; | |
| 21 | + | |
| 22 | +@Slf4j | |
| 23 | +public class ImageListConverter implements Converter<List<String>> { | |
| 24 | + | |
| 25 | + // 横向排列:每张图片宽度 + 间距 | |
| 26 | + private static final int IMAGE_WIDTH = 120; | |
| 27 | + private static final int IMAGE_GAP = 15; | |
| 28 | + private static final int MAX_IMAGE_SIZE = 10 * 1024 * 1024; | |
| 29 | + private static final int CONNECT_TIMEOUT = 5000; | |
| 30 | + private static final int READ_TIMEOUT = 10000; | |
| 31 | + | |
| 32 | + @Override | |
| 33 | + public Class<?> supportJavaTypeKey() { | |
| 34 | + return List.class; | |
| 35 | + } | |
| 36 | + | |
| 37 | + @Override | |
| 38 | + public CellDataTypeEnum supportExcelTypeKey() { | |
| 39 | + return CellDataTypeEnum.EMPTY; | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + public List<String> convertToJavaData(ReadCellData readCellData, ExcelContentProperty contentProperty, | |
| 44 | + GlobalConfiguration globalConfiguration) { | |
| 45 | + return null; | |
| 46 | + } | |
| 47 | + | |
| 48 | + @Override | |
| 49 | + public WriteCellData<?> convertToExcelData(List<String> imageList, ExcelContentProperty contentProperty, | |
| 50 | + GlobalConfiguration globalConfiguration) { | |
| 51 | + try { | |
| 52 | + if (imageList == null || imageList.isEmpty()) { | |
| 53 | + return new WriteCellData<>("无图片"); | |
| 54 | + } | |
| 55 | + | |
| 56 | + List<ImageData> imageDataList = ListUtils.newArrayList(); | |
| 57 | + int leftOffset = 0; // 横向偏移量 | |
| 58 | + | |
| 59 | + for (String path : imageList) { | |
| 60 | + if (!StringUtils.hasText(path)) continue; | |
| 61 | + | |
| 62 | + byte[] imageBytes = path.startsWith("http") ? loadNetworkImage(path) : loadLocalImage(path); | |
| 63 | + if (imageBytes == null || imageBytes.length == 0 || imageBytes.length > MAX_IMAGE_SIZE) { | |
| 64 | + log.warn("跳过无效图片:{}", path); | |
| 65 | + continue; | |
| 66 | + } | |
| 67 | + | |
| 68 | + ImageData imageData = new ImageData(); | |
| 69 | + imageData.setImage(imageBytes); | |
| 70 | + imageData.setImageType(ImageData.ImageType.PICTURE_TYPE_PNG); | |
| 71 | + | |
| 72 | + // ====================== 核心:横向偏移 ====================== | |
| 73 | + imageData.setLeft(leftOffset); | |
| 74 | + // ============================================================= | |
| 75 | + | |
| 76 | + imageDataList.add(imageData); | |
| 77 | + leftOffset += IMAGE_WIDTH + IMAGE_GAP; | |
| 78 | + } | |
| 79 | + | |
| 80 | + if (imageDataList.isEmpty()) { | |
| 81 | + return new WriteCellData<>("无有效图片"); | |
| 82 | + } | |
| 83 | + | |
| 84 | + WriteCellData<?> writeCellData = new WriteCellData<>(); | |
| 85 | + writeCellData.setType(CellDataTypeEnum.EMPTY); | |
| 86 | + writeCellData.setImageDataList(imageDataList); | |
| 87 | + | |
| 88 | + return writeCellData; | |
| 89 | + | |
| 90 | + } catch (Exception e) { | |
| 91 | + log.error("图片导出失败", e); | |
| 92 | + return new WriteCellData<>("图片加载失败"); | |
| 93 | + } | |
| 94 | + } | |
| 95 | + | |
| 96 | + private byte[] loadLocalImage(String imagePath) throws Exception { | |
| 97 | + File file = new File(imagePath); | |
| 98 | + if (!file.exists() || !file.isFile()) { | |
| 99 | + log.warn("本地图片不存在:{}", imagePath); | |
| 100 | + return null; | |
| 101 | + } | |
| 102 | + return FileUtils.readFileToByteArray(file); | |
| 103 | + } | |
| 104 | + | |
| 105 | + private byte[] loadNetworkImage(String imageUrl) throws Exception { | |
| 106 | + URL url = new URL(imageUrl); | |
| 107 | + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); | |
| 108 | + conn.setConnectTimeout(CONNECT_TIMEOUT); | |
| 109 | + conn.setReadTimeout(READ_TIMEOUT); | |
| 110 | + try { | |
| 111 | + if (conn.getResponseCode() != 200) return null; | |
| 112 | + try (InputStream in = conn.getInputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream()) { | |
| 113 | + byte[] buffer = new byte[4096]; | |
| 114 | + int len; | |
| 115 | + while ((len = in.read(buffer)) != -1) out.write(buffer, 0, len); | |
| 116 | + return out.toByteArray(); | |
| 117 | + } | |
| 118 | + } finally { | |
| 119 | + conn.disconnect(); | |
| 120 | + } | |
| 121 | + } | |
| 122 | +} | ... | ... |
urbanops-framework/urbanops-spring-boot-starter-excel/src/main/java/com/zteits/urbanops/framework/excel/core/convert/ListToStringConverter.java
0 → 100644
| 1 | +package com.zteits.urbanops.framework.excel.core.convert; | |
| 2 | +import cn.idev.excel.converters.Converter; | |
| 3 | +import cn.hutool.core.collection.CollectionUtil; | |
| 4 | +import cn.idev.excel.enums.CellDataTypeEnum; | |
| 5 | +import cn.idev.excel.metadata.GlobalConfiguration; | |
| 6 | +import cn.idev.excel.metadata.data.WriteCellData; | |
| 7 | +import cn.idev.excel.metadata.property.ExcelContentProperty; | |
| 8 | + | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * List 转 Excel 字符串转换器(将List用逗号拼接成字符串) | |
| 13 | + */ | |
| 14 | +public class ListToStringConverter implements Converter<List<?>> { | |
| 15 | + | |
| 16 | + @Override | |
| 17 | + public Class<?> supportJavaTypeKey() { | |
| 18 | + // 声明支持的Java类型:List | |
| 19 | + return List.class; | |
| 20 | + } | |
| 21 | + | |
| 22 | + @Override | |
| 23 | + public CellDataTypeEnum supportExcelTypeKey() { | |
| 24 | + // Excel单元格类型:字符串 | |
| 25 | + return CellDataTypeEnum.STRING; | |
| 26 | + } | |
| 27 | + | |
| 28 | + @Override | |
| 29 | + public WriteCellData<?> convertToExcelData(List<?> value, ExcelContentProperty contentProperty, | |
| 30 | + GlobalConfiguration globalConfiguration) { | |
| 31 | + // 核心转换逻辑:List为空返回空字符串,否则用逗号拼接 | |
| 32 | + if (CollectionUtil.isEmpty(value)) { | |
| 33 | + return new WriteCellData<>(""); | |
| 34 | + } | |
| 35 | + String joinStr = String.join(",", value.stream() | |
| 36 | + .map(Object::toString) | |
| 37 | + .toArray(String[]::new)); | |
| 38 | + return new WriteCellData<>(joinStr); | |
| 39 | + } | |
| 40 | +} | |
| 0 | 41 | \ No newline at end of file | ... | ... |
urbanops-framework/urbanops-spring-boot-starter-excel/src/main/java/com/zteits/urbanops/framework/excel/core/handler/ImageColumnWidthHandler.java
0 → 100644
| 1 | +package com.zteits.urbanops.framework.excel.core.handler; | |
| 2 | + | |
| 3 | +import cn.idev.excel.write.handler.SheetWriteHandler; | |
| 4 | +import cn.idev.excel.write.handler.context.SheetWriteHandlerContext; | |
| 5 | +import lombok.RequiredArgsConstructor; | |
| 6 | +import org.apache.poi.ss.usermodel.Sheet; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 图片列自动加宽处理器 | |
| 10 | + */ | |
| 11 | +@RequiredArgsConstructor | |
| 12 | +public class ImageColumnWidthHandler implements SheetWriteHandler { | |
| 13 | + | |
| 14 | + // 需要加宽的列索引(从0开始),比如你的图片列在第3列,就传2 | |
| 15 | + private final int imageColumnIndex; | |
| 16 | + // 加宽后的列宽(单位:字符宽度,Excel默认1个字符宽度≈256像素) | |
| 17 | + private final int columnWidth; | |
| 18 | + | |
| 19 | + @Override | |
| 20 | + public void afterSheetCreate(SheetWriteHandlerContext context) { | |
| 21 | + Sheet sheet = context.getWriteSheetHolder().getSheet(); | |
| 22 | + // 设置指定列的宽度 | |
| 23 | + sheet.setColumnWidth(imageColumnIndex, columnWidth); | |
| 24 | + } | |
| 25 | +} | ... | ... |
urbanops-framework/urbanops-spring-boot-starter-excel/src/main/java/com/zteits/urbanops/framework/excel/core/util/ExcelUtils.java
| ... | ... | @@ -44,9 +44,27 @@ public class ExcelUtils { |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public static <T> List<T> read(MultipartFile file, Class<T> head) throws IOException { |
| 47 | - return FastExcelFactory.read(file.getInputStream(), head, null) | |
| 48 | - .autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理 | |
| 49 | - .doReadAllSync(); | |
| 47 | + List<T> list = FastExcelFactory.read(file.getInputStream(), head, null) | |
| 48 | + .autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理 | |
| 49 | + .doReadAllSync(); | |
| 50 | + | |
| 51 | + // 过滤:对象不为 null + 不是全字段 null | |
| 52 | + if (list != null) { | |
| 53 | + list.removeIf(item -> { | |
| 54 | + if (item == null) return true; | |
| 55 | + // 判断所有字段是否都为 null | |
| 56 | + for (java.lang.reflect.Field field : item.getClass().getDeclaredFields()) { | |
| 57 | + field.setAccessible(true); | |
| 58 | + try { | |
| 59 | + if (field.get(item) != null) { | |
| 60 | + return false; | |
| 61 | + } | |
| 62 | + } catch (Exception e) { } | |
| 63 | + } | |
| 64 | + return true; | |
| 65 | + }); | |
| 66 | + } | |
| 67 | + return list; | |
| 50 | 68 | } |
| 51 | 69 | |
| 52 | 70 | public static <T> List<T> read(MultipartFile file, Class<T> head, Integer startIndex) throws IOException { | ... | ... |
urbanops-module-api/urbanops-module-garden-api/src/main/java/com/zteits/urbanops/module/garden/dto/material/MaterialInventoryOutDto.java
| ... | ... | @@ -17,6 +17,9 @@ public class MaterialInventoryOutDto { |
| 17 | 17 | @Schema(description = "入库ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18713") |
| 18 | 18 | private Long id; |
| 19 | 19 | |
| 20 | + @Schema(description = "库存ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "111") | |
| 21 | + private Long inventoryId; | |
| 22 | + | |
| 20 | 23 | @Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14541") |
| 21 | 24 | @NotNull(message = "物料ID不能为空") |
| 22 | 25 | private Long materialId; | ... | ... |
urbanops-module-api/urbanops-module-garden-api/src/main/java/com/zteits/urbanops/module/garden/dto/road/RoadReqDTO.java
urbanops-module-bpm/src/main/java/com/zteits/urbanops/module/bpm/api/task/BpmTaskApiImpl.java
| ... | ... | @@ -15,6 +15,7 @@ import org.springframework.util.StringUtils; |
| 15 | 15 | import org.springframework.validation.annotation.Validated; |
| 16 | 16 | |
| 17 | 17 | import java.util.*; |
| 18 | +import java.util.stream.Collectors; | |
| 18 | 19 | import java.util.stream.Stream; |
| 19 | 20 | |
| 20 | 21 | import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.convertSetByFlatMap; |
| ... | ... | @@ -69,8 +70,13 @@ public class BpmTaskApiImpl implements BpmTaskApi{ |
| 69 | 70 | Set<Long> userIds = convertSetByFlatMap(taskList, task -> |
| 70 | 71 | Stream.of(NumberUtils.parseLong(task.getAssignee()), NumberUtils.parseLong(task.getOwner()))); |
| 71 | 72 | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds); |
| 73 | + | |
| 74 | + // 过滤掉所有deleteReason = MI_END的任务,再进行遍历 | |
| 75 | + List<HistoricTaskInstance> nonMIEndTaskList = taskList.stream() | |
| 76 | + .filter(task -> !"MI_END".equals(task.getDeleteReason())) | |
| 77 | + .collect(Collectors.toList()); | |
| 72 | 78 | // 5. 按任务结束时间倒序→创建时间倒序排序,确保取到最新任务 |
| 73 | - HistoricTaskInstance lastTask = taskList.stream() | |
| 79 | + HistoricTaskInstance lastTask = nonMIEndTaskList.stream() | |
| 74 | 80 | .reduce((first, last) -> last) // 遍历到最后一个元素 |
| 75 | 81 | .orElse(null); // 空列表返回null |
| 76 | 82 | // 存储最后一个任务,后续封装VO | ... | ... |
urbanops-module-bpm/src/main/java/com/zteits/urbanops/module/bpm/controller/admin/task/BpmProcessInstanceController.java
| ... | ... | @@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.Operation; |
| 23 | 23 | import io.swagger.v3.oas.annotations.Parameter; |
| 24 | 24 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 25 | 25 | import jakarta.annotation.Resource; |
| 26 | +import jakarta.annotation.security.PermitAll; | |
| 26 | 27 | import jakarta.validation.Valid; |
| 27 | 28 | import org.flowable.engine.history.HistoricProcessInstance; |
| 28 | 29 | import org.flowable.engine.repository.ProcessDefinition; |
| ... | ... | @@ -173,7 +174,8 @@ public class BpmProcessInstanceController { |
| 173 | 174 | @GetMapping("/get-approval-detail") |
| 174 | 175 | @Operation(summary = "获得审批详情") |
| 175 | 176 | @Parameter(name = "id", description = "流程实例的编号", required = true) |
| 176 | - @PreAuthorize("@ss.hasPermission('bpm:process-instance:query')") | |
| 177 | + //@PreAuthorize("@ss.hasPermission('bpm:process-instance:query')") | |
| 178 | + @PermitAll | |
| 177 | 179 | @SuppressWarnings("unchecked") |
| 178 | 180 | public CommonResult<BpmApprovalDetailRespVO> getApprovalDetail(@Valid BpmApprovalDetailReqVO reqVO) { |
| 179 | 181 | if (StrUtil.isNotEmpty(reqVO.getProcessVariablesStr())) { | ... | ... |
urbanops-module-bpm/src/main/java/com/zteits/urbanops/module/bpm/controller/admin/task/BpmTaskController.java
| ... | ... | @@ -20,6 +20,7 @@ import io.swagger.v3.oas.annotations.Operation; |
| 20 | 20 | import io.swagger.v3.oas.annotations.Parameter; |
| 21 | 21 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 22 | 22 | import jakarta.annotation.Resource; |
| 23 | +import jakarta.annotation.security.PermitAll; | |
| 23 | 24 | import jakarta.validation.Valid; |
| 24 | 25 | import org.flowable.bpmn.model.UserTask; |
| 25 | 26 | import org.flowable.engine.history.HistoricProcessInstance; |
| ... | ... | @@ -124,7 +125,8 @@ public class BpmTaskController { |
| 124 | 125 | @GetMapping("/list-by-process-instance-id") |
| 125 | 126 | @Operation(summary = "获得指定流程实例的任务列表", description = "包括完成的、未完成的") |
| 126 | 127 | @Parameter(name = "processInstanceId", description = "流程实例的编号", required = true) |
| 127 | - @PreAuthorize("@ss.hasPermission('bpm:task:query')") | |
| 128 | + //@PreAuthorize("@ss.hasPermission('bpm:task:query')") | |
| 129 | + @PermitAll | |
| 128 | 130 | public CommonResult<List<BpmTaskRespVO>> getTaskListByProcessInstanceId( |
| 129 | 131 | @RequestParam("processInstanceId") String processInstanceId) { |
| 130 | 132 | List<HistoricTaskInstance> taskList = taskService.getTaskListByProcessInstanceId(processInstanceId, true); | ... | ... |
urbanops-module-bpm/src/main/java/com/zteits/urbanops/module/bpm/service/task/BpmTaskServiceImpl.java
| ... | ... | @@ -286,7 +286,14 @@ public class BpmTaskServiceImpl implements BpmTaskService { |
| 286 | 286 | || task.getCreateTime().before(DateUtils.of(pageVO.getCreateTime()[0])) |
| 287 | 287 | || task.getCreateTime().after(DateUtils.of(pageVO.getCreateTime()[1]))); |
| 288 | 288 | } |
| 289 | - return new PageResult<>(tasks, count); | |
| 289 | + | |
| 290 | + // 过滤掉所有deleteReason = MI_END的任务,再进行遍历 解决管理端 或签任务展示 系统自动取消的问题 | |
| 291 | + List<HistoricTaskInstance> nonMIEndTaskList = tasks.stream() | |
| 292 | + .filter(task -> !"MI_END".equals(task.getDeleteReason())) | |
| 293 | + .collect(Collectors.toList()); | |
| 294 | + | |
| 295 | + | |
| 296 | + return new PageResult<>(nonMIEndTaskList, count); | |
| 290 | 297 | } |
| 291 | 298 | |
| 292 | 299 | @Override | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/api/road/RoadApiImpl.java
| ... | ... | @@ -14,6 +14,7 @@ import jakarta.annotation.Resource; |
| 14 | 14 | import lombok.extern.slf4j.Slf4j; |
| 15 | 15 | import org.springframework.beans.factory.annotation.Value; |
| 16 | 16 | import org.springframework.stereotype.Service; |
| 17 | +import org.springframework.util.StringUtils; | |
| 17 | 18 | |
| 18 | 19 | import java.util.ArrayList; |
| 19 | 20 | import java.util.HashMap; |
| ... | ... | @@ -44,9 +45,12 @@ public class RoadApiImpl implements RoadApi { |
| 44 | 45 | param.put("companyCode", reqDTO.getBusiLine()); |
| 45 | 46 | param.put("longitude", reqDTO.getLongitude()); |
| 46 | 47 | param.put("latitude", reqDTO.getLatitude()); |
| 48 | + if (StringUtils.hasText(reqDTO.getRoadName())) { | |
| 49 | + param.put("roadName", reqDTO.getRoadName()); | |
| 50 | + } | |
| 47 | 51 | |
| 48 | 52 | String responseBody = HttpUtils.post(roadInfoUrl, null, JSON.toJSONString(param)); |
| 49 | - log.info("获取道路信息接口,系统:{},经度:{},维度:{},返回结果:{}", reqDTO.getBusiLine(), reqDTO.getLongitude(), reqDTO.getLatitude(), responseBody); | |
| 53 | + log.info("获取道路信息接口,系统:{},经度:{},维度:{},roadName:{},返回结果:{}", reqDTO.getBusiLine(), reqDTO.getLongitude(), reqDTO.getLatitude(), reqDTO.getRoadName(), responseBody); | |
| 50 | 54 | JSONObject response = JSONUtil.parseObj(responseBody); |
| 51 | 55 | if (response.getInt("code") != 200) { |
| 52 | 56 | return new ArrayList<>(); | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/assigntasks/AssignTasksController.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.assigntasks; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 4 | -import cn.hutool.core.util.StrUtil; | |
| 5 | 4 | import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; |
| 6 | 5 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 7 | 6 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 8 | 7 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 9 | 8 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 10 | 9 | import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; |
| 11 | -import com.zteits.urbanops.framework.translate.core.TranslateUtils; | |
| 12 | 10 | import com.zteits.urbanops.module.garden.controller.admin.assigntasks.vo.AssignTasksPageReqVO; |
| 13 | 11 | import com.zteits.urbanops.module.garden.controller.admin.assigntasks.vo.AssignTasksRespVO; |
| 14 | 12 | import com.zteits.urbanops.module.garden.controller.admin.assigntasks.vo.AssignTasksSaveReqVO; |
| 13 | +import com.zteits.urbanops.module.garden.controller.admin.unitintegraltotal.vo.UnitIntegralRespVO; | |
| 14 | +import com.zteits.urbanops.module.garden.convert.AssignTaskConvert; | |
| 15 | 15 | import com.zteits.urbanops.module.garden.dal.dataobject.assigntasks.AssignTasksDO; |
| 16 | 16 | import com.zteits.urbanops.module.garden.dal.dataobject.assigntasksinfo.AssignTasksInfoDO; |
| 17 | 17 | import com.zteits.urbanops.module.garden.service.assigntasks.AssignTasksService; |
| 18 | 18 | import com.zteits.urbanops.module.garden.service.assigntasksinfo.AssignTasksInfoService; |
| 19 | +import com.zteits.urbanops.module.garden.service.unitintegraltotal.UnitIntegralService; | |
| 19 | 20 | import io.swagger.v3.oas.annotations.Operation; |
| 20 | 21 | import io.swagger.v3.oas.annotations.Parameter; |
| 21 | 22 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -46,6 +47,9 @@ public class AssignTasksController { |
| 46 | 47 | @Resource |
| 47 | 48 | private AssignTasksInfoService asignTasksInfoService; |
| 48 | 49 | |
| 50 | + @Resource | |
| 51 | + private UnitIntegralService unitIntegralService; | |
| 52 | + | |
| 49 | 53 | @PostMapping("/create") |
| 50 | 54 | @Operation(summary = "创建派单任务主表(记录派单任务基本信息)") |
| 51 | 55 | @PreAuthorize("@ss.hasPermission('garden:assign-tasks:create')") |
| ... | ... | @@ -90,7 +94,13 @@ public class AssignTasksController { |
| 90 | 94 | } |
| 91 | 95 | AssignTasksRespVO assignTasksRespVO = BeanUtils.toBean(assignTasks, AssignTasksRespVO.class); |
| 92 | 96 | List<AssignTasksInfoDO> assignTaskInfoList = asignTasksInfoService.getAssignTasksInfos(assignTasks.getId()); |
| 93 | - assignTasksRespVO.setAssignTaskInfoList(assignTaskInfoList); | |
| 97 | + //add by 20260307 convert 转换获取任务积分 | |
| 98 | + List<Long> taskIds = assignTaskInfoList.stream() | |
| 99 | + .map(AssignTasksInfoDO::getId) | |
| 100 | + .distinct() // 去重重复的taskId | |
| 101 | + .collect(Collectors.toList()); | |
| 102 | + List<UnitIntegralRespVO> unitIntegralList = unitIntegralService.queryIntegralByRelatedTaskIds(taskIds); | |
| 103 | + assignTasksRespVO.setAssignTaskInfoList(AssignTaskConvert.INSTANCE.buildTaskInfo(assignTaskInfoList, unitIntegralList)); | |
| 94 | 104 | //获取单位集合 |
| 95 | 105 | List<Long> companyIds = CollectionUtil.isEmpty(assignTaskInfoList) |
| 96 | 106 | ? Collections.emptyList() | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/assigntasks/vo/AssignTasksRespVO.java
| ... | ... | @@ -3,8 +3,7 @@ package com.zteits.urbanops.module.garden.controller.admin.assigntasks.vo; |
| 3 | 3 | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | 4 | import cn.idev.excel.annotation.ExcelProperty; |
| 5 | 5 | import com.fasterxml.jackson.annotation.JsonFormat; |
| 6 | -import com.fhs.core.trans.vo.VO; | |
| 7 | -import com.zteits.urbanops.module.garden.dal.dataobject.assigntasksinfo.AssignTasksInfoDO; | |
| 6 | +import com.zteits.urbanops.module.garden.controller.admin.assigntasksinfo.vo.AssignTasksInfoRespVO; | |
| 8 | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | 8 | import lombok.Data; |
| 10 | 9 | |
| ... | ... | @@ -12,6 +11,7 @@ import java.util.Date; |
| 12 | 11 | import java.util.List; |
| 13 | 12 | |
| 14 | 13 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 14 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT; | |
| 15 | 15 | |
| 16 | 16 | @Schema(description = "管理后台 - 派单任务主表(记录派单任务基本信息) Response VO") |
| 17 | 17 | @Data |
| ... | ... | @@ -38,12 +38,12 @@ public class AssignTasksRespVO { |
| 38 | 38 | |
| 39 | 39 | @Schema(description = "任务创建时间(派单时间)", requiredMode = Schema.RequiredMode.REQUIRED) |
| 40 | 40 | @ExcelProperty("派达时间") |
| 41 | - @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 41 | + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT ) | |
| 42 | 42 | private Date createTime; |
| 43 | 43 | |
| 44 | 44 | @Schema(description = "任务截止时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 45 | 45 | @ExcelProperty("任务截止时间") |
| 46 | - @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 46 | + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) | |
| 47 | 47 | private Date deadline; |
| 48 | 48 | |
| 49 | 49 | @Schema(description = "任务备注(如:特殊要求、注意事项等)") |
| ... | ... | @@ -64,7 +64,7 @@ public class AssignTasksRespVO { |
| 64 | 64 | private String updater; |
| 65 | 65 | |
| 66 | 66 | private List<Long> companyIds; |
| 67 | - private List<AssignTasksInfoDO> assignTaskInfoList; | |
| 67 | + private List<AssignTasksInfoRespVO> assignTaskInfoList; | |
| 68 | 68 | |
| 69 | 69 | public void setParentFinish(Integer parentFinish) { |
| 70 | 70 | this.parentFinish = parentFinish; | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/assigntasks/vo/AssignTasksSaveReqVO.java
| ... | ... | @@ -43,7 +43,11 @@ public class AssignTasksSaveReqVO { |
| 43 | 43 | private Integer parentFinish; |
| 44 | 44 | |
| 45 | 45 | @Schema(description = "整体完成时间(仅当parent_finish=1时有值)") |
| 46 | - @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 46 | + @JsonFormat( | |
| 47 | + pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, | |
| 48 | + timezone = "GMT+8", | |
| 49 | + shape = JsonFormat.Shape.STRING | |
| 50 | + ) | |
| 47 | 51 | private Date finishTime; |
| 48 | 52 | |
| 49 | 53 | @Schema(description = "任务备注(如:特殊要求、注意事项等)") | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/assigntasksinfo/AssignTasksInfoController.java
| ... | ... | @@ -10,11 +10,14 @@ import com.zteits.urbanops.module.garden.controller.admin.assigntasksinfo.vo.Ass |
| 10 | 10 | import com.zteits.urbanops.module.garden.controller.admin.assigntasksinfo.vo.AssignTasksInfoRespVO; |
| 11 | 11 | import com.zteits.urbanops.module.garden.controller.admin.assigntasksinfo.vo.AssignTasksInfoSaveReqVO; |
| 12 | 12 | import com.zteits.urbanops.module.garden.controller.admin.assigntasksinfo.vo.AssignTasksInfoUpdReqVO; |
| 13 | +import com.zteits.urbanops.module.garden.controller.admin.unitintegraltotal.vo.UnitIntegralRespVO; | |
| 13 | 14 | import com.zteits.urbanops.module.garden.convert.AssignTaskConvert; |
| 14 | 15 | import com.zteits.urbanops.module.garden.dal.dataobject.assigntasks.AssignTasksDO; |
| 15 | 16 | import com.zteits.urbanops.module.garden.dal.dataobject.assigntasksinfo.AssignTasksInfoDO; |
| 16 | 17 | import com.zteits.urbanops.module.garden.service.assigntasks.AssignTasksService; |
| 17 | 18 | import com.zteits.urbanops.module.garden.service.assigntasksinfo.AssignTasksInfoService; |
| 19 | +import com.zteits.urbanops.module.garden.service.assigntasksinfo.QuartzRemindService; | |
| 20 | +import com.zteits.urbanops.module.garden.service.unitintegraltotal.UnitIntegralService; | |
| 18 | 21 | import io.swagger.v3.oas.annotations.Operation; |
| 19 | 22 | import io.swagger.v3.oas.annotations.Parameter; |
| 20 | 23 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -26,7 +29,12 @@ import org.springframework.validation.annotation.Validated; |
| 26 | 29 | import org.springframework.web.bind.annotation.*; |
| 27 | 30 | |
| 28 | 31 | import java.io.IOException; |
| 32 | +import java.time.LocalDateTime; | |
| 33 | +import java.time.ZoneId; | |
| 34 | +import java.util.ArrayList; | |
| 35 | +import java.util.Date; | |
| 29 | 36 | import java.util.List; |
| 37 | +import java.util.stream.Collectors; | |
| 30 | 38 | |
| 31 | 39 | import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| 32 | 40 | import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; |
| ... | ... | @@ -42,6 +50,8 @@ public class AssignTasksInfoController { |
| 42 | 50 | private AssignTasksInfoService assignTasksInfoService; |
| 43 | 51 | @Resource |
| 44 | 52 | private AssignTasksService assignTasksService; |
| 53 | + @Resource | |
| 54 | + private UnitIntegralService unitIntegralService; | |
| 45 | 55 | |
| 46 | 56 | @PostMapping("/create") |
| 47 | 57 | @Operation(summary = "创建派单任务-单位关联表(记录单位接收派单后的执行详情)") |
| ... | ... | @@ -83,7 +93,11 @@ public class AssignTasksInfoController { |
| 83 | 93 | public CommonResult<AssignTasksInfoRespVO> getAssignTasksInfo(@RequestParam("id") Long id) { |
| 84 | 94 | AssignTasksInfoDO assignTasksInfo = assignTasksInfoService.getAssignTasksInfo(id); |
| 85 | 95 | AssignTasksDO tasksDO = assignTasksService.getAssignTasks(assignTasksInfo.getTaskId()); |
| 86 | - return success(AssignTaskConvert.INSTANCE.buildTask(assignTasksInfo, tasksDO)); | |
| 96 | + //add by 20260307 convert 转换获取任务积分 | |
| 97 | + List<Long> taskIds = new ArrayList<>(); | |
| 98 | + taskIds.add(assignTasksInfo.getId()); | |
| 99 | + List<UnitIntegralRespVO> unitIntegralList = unitIntegralService.queryIntegralByRelatedTaskIds(taskIds); | |
| 100 | + return success(AssignTaskConvert.INSTANCE.buildTask(assignTasksInfo, tasksDO, unitIntegralList)); | |
| 87 | 101 | //return success(BeanUtils.toBean(assignTasksInfo, AssignTasksInfoRespVO.class)); |
| 88 | 102 | } |
| 89 | 103 | |
| ... | ... | @@ -93,26 +107,16 @@ public class AssignTasksInfoController { |
| 93 | 107 | public CommonResult<PageResult<AssignTasksInfoRespVO>> getAssignTasksInfoPage(@Valid AssignTasksInfoPageReqVO pageReqVO) { |
| 94 | 108 | pageReqVO.setCompanyId(getCompanyId()); |
| 95 | 109 | PageResult<AssignTasksInfoDO> pageResult = assignTasksInfoService.getAssignTasksInfoPage(pageReqVO); |
| 96 | -// if (pageResult == null || pageResult.getList() == null || pageResult.getList().isEmpty()) { | |
| 97 | -// return success(BeanUtils.toBean(pageResult, AssignTasksInfoRespVO.class)); | |
| 98 | -// } | |
| 99 | -// List<Long> assignIds = pageResult.getList().stream() | |
| 100 | -// .map(AssignTasksInfoDO::getTaskId) | |
| 101 | -// .distinct() | |
| 102 | -// .collect(Collectors.toList()); | |
| 103 | -// List<AssignTasksDO> taskList = assignTasksService.getAssignTasksList(assignIds); | |
| 104 | -// if (CollectionUtils.isNotEmpty(taskList)) { | |
| 105 | -// Map<Long, AssignTasksDO> taskMap = taskList.stream() | |
| 106 | -// .collect(Collectors.toMap( | |
| 107 | -// AssignTasksDO::getId, // Key:任务ID | |
| 108 | -// task -> task, | |
| 109 | -// (existing, replacement) -> replacement | |
| 110 | -// )); | |
| 111 | -// return success(AssignTaskConvert.INSTANCE.buildTaskPage(pageResult, taskMap)); | |
| 112 | -// } else { | |
| 113 | -// return CommonResult.error(BAD_REQUEST.getCode(), "派单数据异常"); | |
| 114 | -// } | |
| 115 | - return success(BeanUtils.toBean(pageResult, AssignTasksInfoRespVO.class)); | |
| 110 | + if (pageResult == null || pageResult.getList() == null || pageResult.getList().isEmpty()) { | |
| 111 | + return success(BeanUtils.toBean(pageResult, AssignTasksInfoRespVO.class)); | |
| 112 | + } | |
| 113 | + //add by 20260307 convert 转换获取任务积分 | |
| 114 | + List<Long> taskIds = pageResult.getList().stream() | |
| 115 | + .map(AssignTasksInfoDO::getId) | |
| 116 | + .distinct() // 去重重复的taskId | |
| 117 | + .collect(Collectors.toList()); | |
| 118 | + List<UnitIntegralRespVO> unitIntegralList = unitIntegralService.queryIntegralByRelatedTaskIds(taskIds); | |
| 119 | + return success(AssignTaskConvert.INSTANCE.buildTaskPage(pageResult, unitIntegralList)); | |
| 116 | 120 | } |
| 117 | 121 | @GetMapping("/list") |
| 118 | 122 | @Operation(summary = "获得派单任务-单位关联表(记录单位接收派单后的执行详情)分页") |
| ... | ... | @@ -120,26 +124,13 @@ public class AssignTasksInfoController { |
| 120 | 124 | public CommonResult<PageResult<AssignTasksInfoRespVO>> list(@Valid AssignTasksInfoPageReqVO pageReqVO) { |
| 121 | 125 | pageReqVO.setCompanyId(getCompanyId()); |
| 122 | 126 | PageResult<AssignTasksInfoDO> pageResult = assignTasksInfoService.getAssignTasksInfoPage(pageReqVO); |
| 123 | -// if (pageResult == null || pageResult.getList() == null || pageResult.getList().isEmpty()) { | |
| 124 | -// return success(BeanUtils.toBean(pageResult, AssignTasksInfoRespVO.class)); | |
| 125 | -// } | |
| 126 | -// List<Long> assignIds = pageResult.getList().stream() | |
| 127 | -// .map(AssignTasksInfoDO::getTaskId) | |
| 128 | -// .distinct() | |
| 129 | -// .collect(Collectors.toList()); | |
| 130 | -// List<AssignTasksDO> taskList = assignTasksService.getAssignTasksList(assignIds); | |
| 131 | -// if (CollectionUtils.isNotEmpty(taskList)) { | |
| 132 | -// Map<Long, AssignTasksDO> taskMap = taskList.stream() | |
| 133 | -// .collect(Collectors.toMap( | |
| 134 | -// AssignTasksDO::getId, // Key:任务ID | |
| 135 | -// task -> task, | |
| 136 | -// (existing, replacement) -> replacement | |
| 137 | -// )); | |
| 138 | -// return success(AssignTaskConvert.INSTANCE.buildTaskPage(pageResult, taskMap)); | |
| 139 | -// } else { | |
| 140 | -// return CommonResult.error(BAD_REQUEST.getCode(), "派单数据异常"); | |
| 141 | -// } | |
| 142 | - return success(BeanUtils.toBean(pageResult, AssignTasksInfoRespVO.class)); | |
| 127 | + //add by 20260307 convert 转换获取任务积分 | |
| 128 | + List<Long> taskIds = pageResult.getList().stream() | |
| 129 | + .map(AssignTasksInfoDO::getId) | |
| 130 | + .distinct() // 去重重复的taskId | |
| 131 | + .collect(Collectors.toList()); | |
| 132 | + List<UnitIntegralRespVO> unitIntegralList = unitIntegralService.queryIntegralByRelatedTaskIds(taskIds); | |
| 133 | + return success(AssignTaskConvert.INSTANCE.buildTaskPage(pageResult, unitIntegralList)); | |
| 143 | 134 | } |
| 144 | 135 | @GetMapping("/export-excel") |
| 145 | 136 | @Operation(summary = "导出派单任务-单位关联表(记录单位接收派单后的执行详情) Excel") |
| ... | ... | @@ -179,4 +170,28 @@ public class AssignTasksInfoController { |
| 179 | 170 | public CommonResult feedback(@RequestBody AssignTasksInfoUpdReqVO assignTaskCompany) { |
| 180 | 171 | return success(assignTasksInfoService.feedbackAssignTaskCompany(assignTaskCompany)); |
| 181 | 172 | } |
| 173 | + | |
| 174 | + | |
| 175 | + @Resource | |
| 176 | + private QuartzRemindService quartzRemindService; | |
| 177 | + | |
| 178 | + @Operation(summary = "到期提醒") | |
| 179 | + @GetMapping(value = "/createDeadlineRemind") | |
| 180 | + public void deadlineRemindTest(@RequestParam("id") Long id) { | |
| 181 | + // 2. 注册Quartz任务:到期前3小时触发 | |
| 182 | + try { | |
| 183 | + LocalDateTime now = LocalDateTime.now(); | |
| 184 | + LocalDateTime triggerTime = now.plusHours(3).plusMinutes(3); // 现在往后推3小时3分钟 | |
| 185 | + Date triggerDate = Date.from( | |
| 186 | + triggerTime.atZone(ZoneId.systemDefault()) // 绑定时区 | |
| 187 | + .toInstant() // 转为Instant(含时区的时间戳) | |
| 188 | + ); | |
| 189 | + //quartzRemindService.registerRemindJob(id, triggerDate); | |
| 190 | + | |
| 191 | + unitIntegralService.resetUnitIntegralTotal(); | |
| 192 | + } catch (Exception e) { | |
| 193 | + throw new RuntimeException("任务创建失败"); | |
| 194 | + } | |
| 195 | + } | |
| 196 | + | |
| 182 | 197 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/assigntasksinfo/vo/AssignTasksInfoRespVO.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/costfee/CostFeeController.java
| ... | ... | @@ -5,16 +5,24 @@ import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; |
| 5 | 5 | import com.zteits.urbanops.module.garden.controller.admin.costfee.vo.WaterFeeImport; |
| 6 | 6 | import com.zteits.urbanops.module.garden.enums.TemplateEnum; |
| 7 | 7 | import com.zteits.urbanops.module.garden.service.costfee.CostFeeService; |
| 8 | +import com.zteits.urbanops.module.system.api.dept.DeptApi; | |
| 9 | +import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO; | |
| 8 | 10 | import io.swagger.v3.oas.annotations.Operation; |
| 9 | 11 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 12 | +import jakarta.annotation.security.PermitAll; | |
| 10 | 13 | import jakarta.servlet.http.HttpServletResponse; |
| 11 | 14 | import lombok.AllArgsConstructor; |
| 12 | 15 | import lombok.Data; |
| 13 | 16 | import lombok.extern.slf4j.Slf4j; |
| 17 | +import org.apache.poi.ss.usermodel.*; | |
| 18 | +import org.apache.poi.ss.util.CellRangeAddressList; | |
| 19 | +import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |
| 14 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | 21 | import org.springframework.beans.factory.annotation.Value; |
| 16 | -import org.springframework.core.io.ClassPathResource; | |
| 22 | +import org.springframework.core.io.Resource; | |
| 23 | +import org.springframework.core.io.ResourceLoader; | |
| 17 | 24 | import org.springframework.util.CollectionUtils; |
| 25 | +import org.springframework.util.StringUtils; | |
| 18 | 26 | import org.springframework.web.bind.annotation.*; |
| 19 | 27 | import org.springframework.web.multipart.MultipartFile; |
| 20 | 28 | |
| ... | ... | @@ -23,7 +31,6 @@ import java.io.InputStream; |
| 23 | 31 | import java.io.OutputStream; |
| 24 | 32 | import java.lang.reflect.Method; |
| 25 | 33 | import java.net.URLEncoder; |
| 26 | -import java.nio.charset.StandardCharsets; | |
| 27 | 34 | import java.util.*; |
| 28 | 35 | |
| 29 | 36 | import static com.zteits.urbanops.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; |
| ... | ... | @@ -49,6 +56,12 @@ public class CostFeeController{ |
| 49 | 56 | @Value("${static.resource.server.enable}") |
| 50 | 57 | private Boolean staticResourceServerenable; |
| 51 | 58 | |
| 59 | + @Autowired | |
| 60 | + private ResourceLoader resourceLoader; | |
| 61 | + | |
| 62 | + @jakarta.annotation.Resource | |
| 63 | + private DeptApi deptApi; | |
| 64 | + | |
| 52 | 65 | // Excel文件校验相关 |
| 53 | 66 | private static final List<String> ALLOWED_EXCEL_SUFFIX = Arrays.asList(".xlsx", ".xlsm"); |
| 54 | 67 | private static final String EXCEL_MIME_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; |
| ... | ... | @@ -59,6 +72,7 @@ public class CostFeeController{ |
| 59 | 72 | */ |
| 60 | 73 | @GetMapping("/get-import-template") |
| 61 | 74 | @Operation(summary = "获得导入用户模板") |
| 75 | + @PermitAll | |
| 62 | 76 | public void importTemplate(HttpServletResponse response, |
| 63 | 77 | @RequestParam("templateName") String templateName) throws IOException { |
| 64 | 78 | // 参数校验 |
| ... | ... | @@ -74,29 +88,150 @@ public class CostFeeController{ |
| 74 | 88 | return; |
| 75 | 89 | } |
| 76 | 90 | |
| 77 | - if (staticResourceServerenable) { | |
| 78 | - // 构建完整的静态服务器URL(确保路径正确) | |
| 79 | - String serverUrl = staticResourceServerUrl; | |
| 80 | - if (serverUrl != null && !serverUrl.endsWith("/")) { | |
| 81 | - serverUrl += "/"; // 确保URL以/结尾,避免拼接错误 | |
| 82 | - } | |
| 91 | + writeAndModifyTemplate(response, template.getName(), template.getStartIndex()); | |
| 92 | + } | |
| 93 | + | |
| 94 | + private void writeAndModifyTemplate(HttpServletResponse response, | |
| 95 | + String downloadFileName, | |
| 96 | + int startIndexRow) throws IOException { | |
| 97 | + | |
| 98 | + // 拼接模板路径 | |
| 99 | + String serverUrl = staticResourceServerUrl; | |
| 100 | + if (serverUrl != null && !serverUrl.endsWith("/")) { | |
| 101 | + serverUrl += "/"; | |
| 102 | + } | |
| 103 | + String fullPath = serverUrl + downloadFileName; | |
| 104 | + fullPath = fullPath.replace("\\", "/"); | |
| 105 | + | |
| 106 | + Resource resource = resourceLoader.getResource(fullPath); | |
| 107 | + | |
| 108 | + // 检查文件是否存在 | |
| 109 | + if (!resource.exists()) { | |
| 110 | + response.sendError(HttpServletResponse.SC_NOT_FOUND, "模板文件不存在"); | |
| 111 | + return; | |
| 112 | + } | |
| 113 | + | |
| 114 | + // 设置下载响应头 | |
| 115 | + response.reset(); | |
| 116 | + response.setContentType(EXCEL_MIME_TYPE); | |
| 117 | + // response.setCharacterEncoding("UTF-8"); | |
| 118 | + String encodedName = URLEncoder.encode(downloadFileName, "UTF-8"); | |
| 119 | + // 标准文件名编码(Chrome / Edge / Firefox 全兼容) | |
| 120 | + response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''" + encodedName); | |
| 121 | + // 浏览器缓存配置(必须) | |
| 122 | + response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); | |
| 123 | + response.setHeader("Pragma", "no-cache"); | |
| 124 | + response.setHeader("Expires", "0"); | |
| 125 | + | |
| 126 | + | |
| 127 | + try (InputStream in = resource.getInputStream(); | |
| 128 | + XSSFWorkbook workbook = new XSSFWorkbook(in); | |
| 129 | + OutputStream out = response.getOutputStream()) { | |
| 83 | 130 | |
| 84 | - String encodedFileName = URLEncoder.encode(template.getName().split("\\.")[0], StandardCharsets.UTF_8.name()); | |
| 131 | + Sheet sheet = workbook.getSheetAt(0); | |
| 85 | 132 | |
| 86 | - String templateFileName = encodedFileName + "." + template.getName().split("\\.")[1]; | |
| 133 | + // ============================================== | |
| 134 | + // 获取最新单位列表 | |
| 135 | + // ============================================== | |
| 136 | + List<DeptRespDTO> companyList = deptApi.getSubDeptList(); | |
| 137 | + List<String> newUnits = companyList.stream() | |
| 138 | + .map(DeptRespDTO::getName) | |
| 139 | + .filter(Objects::nonNull) | |
| 140 | + .toList(); | |
| 87 | 141 | |
| 88 | - String templateUrl = serverUrl + templateFileName; // 包含templates目录 | |
| 142 | + log.info("加载到单位列表:{},共{}条", newUnits, newUnits.size()); | |
| 89 | 143 | |
| 90 | - // 方式1:重定向到静态资源服务器 | |
| 91 | - response.sendRedirect(templateUrl); | |
| 92 | - } else { | |
| 93 | - String templateFileName = templateName + "." + template.getName().split("\\.")[1]; | |
| 144 | + // ============================================== | |
| 145 | + // 生成新下拉 + 自动赋值 | |
| 146 | + // ============================================== | |
| 147 | + createDropdownAndSetValue(sheet, newUnits, startIndexRow); | |
| 148 | + | |
| 149 | + // 写入并强制刷新 | |
| 150 | + workbook.write(out); | |
| 151 | + out.flush(); | |
| 94 | 152 | |
| 95 | - // 写入模板文件到响应 | |
| 96 | - writeTemplateToResponse(response, template.getName(), templateFileName); | |
| 153 | + } catch (Exception e) { | |
| 154 | + log.error("模板处理失败", e); | |
| 155 | + throw new IOException("文件处理失败", e); | |
| 97 | 156 | } |
| 98 | 157 | } |
| 99 | 158 | |
| 159 | + /** | |
| 160 | + * 创建下拉框 + 给单元格赋值 | |
| 161 | + */ | |
| 162 | + private void createDropdownAndSetValue(Sheet sheet, List<String> options, int startRow) { | |
| 163 | + if (options.isEmpty()) { | |
| 164 | + log.error("下拉选项为空,不创建"); | |
| 165 | + return; | |
| 166 | + } | |
| 167 | + | |
| 168 | + // 获取表头行 | |
| 169 | + Row headerRow = sheet.getRow(startRow - 1); | |
| 170 | + if (headerRow == null) { | |
| 171 | + log.error("表头行不存在:{}", startRow - 1); | |
| 172 | + return; | |
| 173 | + } | |
| 174 | + | |
| 175 | + // 查找“所属单位”列 | |
| 176 | + int targetCol = -1; | |
| 177 | + for (Cell cell : headerRow) { | |
| 178 | + if (cell != null && cell.getCellType() == CellType.STRING) { | |
| 179 | + String val = cell.getStringCellValue().trim(); | |
| 180 | + if (val.contains("所属单位") || val.contains("所属公司") ) { | |
| 181 | + targetCol = cell.getColumnIndex(); | |
| 182 | + break; | |
| 183 | + } | |
| 184 | + } | |
| 185 | + } | |
| 186 | + | |
| 187 | + if (targetCol == -1) { | |
| 188 | + log.error("未找到【所属单位】列表头"); | |
| 189 | + return; | |
| 190 | + } | |
| 191 | + | |
| 192 | + // 取消列隐藏 | |
| 193 | + sheet.setColumnHidden(targetCol, false); | |
| 194 | + | |
| 195 | + // ============================================== | |
| 196 | + // 遍历行:清空原有内容 + 设置默认值 | |
| 197 | + // ============================================== | |
| 198 | + int endRow = 100; | |
| 199 | + for (int r = startRow; r <= endRow; r++) { | |
| 200 | + Row row = sheet.getRow(r); | |
| 201 | + if (row == null) { | |
| 202 | + row = sheet.createRow(r); | |
| 203 | + } | |
| 204 | + | |
| 205 | + Cell cell = row.getCell(targetCol); | |
| 206 | + if (cell == null) { | |
| 207 | + cell = row.createCell(targetCol); | |
| 208 | + } | |
| 209 | + String unit = cell.getStringCellValue(); | |
| 210 | + // 默认赋值【第一个单位】,你可以根据业务改成其他值 | |
| 211 | + if (!StringUtils.isEmpty(unit)) { | |
| 212 | + cell.setCellValue(options.get(0)); | |
| 213 | + } | |
| 214 | + } | |
| 215 | + | |
| 216 | + // ============================================== | |
| 217 | + // 创建下拉框(作用范围:startRow ~ 1000行) | |
| 218 | + // ============================================== | |
| 219 | + CellRangeAddressList regions = new CellRangeAddressList(startRow, endRow, targetCol, targetCol); | |
| 220 | + DataValidationHelper helper = sheet.getDataValidationHelper(); | |
| 221 | + DataValidationConstraint constraint = helper.createExplicitListConstraint( | |
| 222 | + options.toArray(new String[0]) | |
| 223 | + ); | |
| 224 | + DataValidation validation = helper.createValidation(constraint, regions); | |
| 225 | + // 下拉框基础配置 | |
| 226 | + validation.setEmptyCellAllowed(true); | |
| 227 | + validation.setSuppressDropDownArrow(true); // 显示箭头 | |
| 228 | + validation.setShowErrorBox(true); | |
| 229 | + validation.setShowPromptBox(true); // 启用点击弹出提示 | |
| 230 | + sheet.addValidationData(validation); | |
| 231 | + | |
| 232 | + log.info("【成功】为列{}添加下拉并赋值,行{}~{},选项数:{}", | |
| 233 | + targetCol, startRow, endRow, options.size()); | |
| 234 | + } | |
| 100 | 235 | |
| 101 | 236 | /** |
| 102 | 237 | * Excel文件上传预览 |
| ... | ... | @@ -214,31 +349,6 @@ public class CostFeeController{ |
| 214 | 349 | } |
| 215 | 350 | |
| 216 | 351 | /** |
| 217 | - * 写入模板文件到响应流 | |
| 218 | - */ | |
| 219 | - private void writeTemplateToResponse(HttpServletResponse response, String filename, String templatePath) throws IOException { | |
| 220 | - // 设置响应头 | |
| 221 | - response.setContentType(EXCEL_MIME_TYPE); | |
| 222 | - response.setCharacterEncoding("UTF-8"); | |
| 223 | - String encodedFileName = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20"); | |
| 224 | - response.setHeader("Content-Disposition", "attachment;filename=" + encodedFileName); | |
| 225 | - response.setHeader("Cache-Control", "no-store"); // 禁止缓存 | |
| 226 | - | |
| 227 | - // 读取模板文件并写入响应 | |
| 228 | - try (InputStream in = new ClassPathResource("template/" + templatePath).getInputStream(); | |
| 229 | - OutputStream out = response.getOutputStream()) { | |
| 230 | - | |
| 231 | - byte[] buffer = new byte[4096]; | |
| 232 | - int bytesRead; | |
| 233 | - while ((bytesRead = in.read(buffer)) != -1) { | |
| 234 | - out.write(buffer, 0, bytesRead); | |
| 235 | - } | |
| 236 | - out.flush(); | |
| 237 | - } | |
| 238 | - } | |
| 239 | - | |
| 240 | - | |
| 241 | - /** | |
| 242 | 352 | * 校验Excel文件有效性(后缀+MIME类型) |
| 243 | 353 | */ |
| 244 | 354 | private boolean isValidExcelFile(MultipartFile file) { | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/costfee/vo/MaterialInventoryInImport.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.costfee.vo; | |
| 2 | + | |
| 3 | +import cn.idev.excel.annotation.ExcelProperty; | |
| 4 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
| 5 | +import jakarta.validation.constraints.NotEmpty; | |
| 6 | +import jakarta.validation.constraints.NotNull; | |
| 7 | +import jakarta.validation.constraints.Positive; | |
| 8 | +import lombok.AllArgsConstructor; | |
| 9 | +import lombok.Builder; | |
| 10 | +import lombok.Data; | |
| 11 | +import lombok.NoArgsConstructor; | |
| 12 | + | |
| 13 | +import java.math.BigDecimal; | |
| 14 | +import java.time.LocalDate; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * @Classname MaterialInventoryInImport | |
| 18 | + * @Description 物料批量入库 | |
| 19 | + * @Date 2026/1/15 22:22 | |
| 20 | + * @Created by wangqian | |
| 21 | + */ | |
| 22 | +@Data | |
| 23 | +@Builder | |
| 24 | +@AllArgsConstructor | |
| 25 | +@NoArgsConstructor | |
| 26 | +public class MaterialInventoryInImport { | |
| 27 | + | |
| 28 | + | |
| 29 | + @ExcelProperty(index = 1) | |
| 30 | + @NotEmpty(message = "物料名称不能为空") | |
| 31 | + private String materialName; | |
| 32 | + | |
| 33 | + @NotEmpty(message = "耗材类型不能为空") | |
| 34 | + @ExcelProperty(index = 2) | |
| 35 | + private String materialTypeName; | |
| 36 | + | |
| 37 | + @NotEmpty(message = "类别名称不能为空") | |
| 38 | + @ExcelProperty(index = 3) | |
| 39 | + private String typeName; | |
| 40 | + | |
| 41 | + | |
| 42 | + @NotEmpty(message = "类别明细不能为空") | |
| 43 | + @ExcelProperty(index = 4) | |
| 44 | + private String typeDetailName; | |
| 45 | + | |
| 46 | + @NotEmpty(message = "物料规格不能为空") | |
| 47 | + @ExcelProperty(index = 5) | |
| 48 | + private String specifications; | |
| 49 | + | |
| 50 | + @NotEmpty(message = "物料单位不能为空") | |
| 51 | + @ExcelProperty(index = 6) | |
| 52 | + private String unitName; | |
| 53 | + | |
| 54 | + @NotNull(message = "单价不能为空") | |
| 55 | + @ExcelProperty(index = 7) | |
| 56 | + private BigDecimal materialPrice; | |
| 57 | + | |
| 58 | + @NotNull(message = "入库数量不能为空") | |
| 59 | + @ExcelProperty(index = 8) | |
| 60 | + @Positive(message = "数量必须为正整数") | |
| 61 | + private Long inInventoryNum; | |
| 62 | + | |
| 63 | + @NotNull(message = "采购日期不能为空") | |
| 64 | + @ExcelProperty(index = 9) | |
| 65 | + @JsonFormat(pattern = "yyyy-MM-dd") | |
| 66 | + private LocalDate buyDate; | |
| 67 | + | |
| 68 | + @NotEmpty(message = "供应商名称不能为空") | |
| 69 | + @ExcelProperty(index = 10) | |
| 70 | + private String supplierName; | |
| 71 | + | |
| 72 | + @NotEmpty(message = "联系人不能为空") | |
| 73 | + @ExcelProperty(index = 11) | |
| 74 | + private String contactsName; | |
| 75 | + | |
| 76 | + @NotEmpty(message = "联系电话不能为空") | |
| 77 | + @ExcelProperty(index = 12) | |
| 78 | + private String contactsPhone; | |
| 79 | + | |
| 80 | + @NotEmpty(message = "归属公司不能为空") | |
| 81 | + @ExcelProperty(index = 13) | |
| 82 | + private String belongCompanyName; | |
| 83 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/costfee/vo/MaterialInventoryOutImport.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.costfee.vo; | |
| 2 | + | |
| 3 | +import cn.idev.excel.annotation.ExcelProperty; | |
| 4 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import jakarta.validation.constraints.NotEmpty; | |
| 7 | +import jakarta.validation.constraints.NotNull; | |
| 8 | +import jakarta.validation.constraints.Positive; | |
| 9 | +import lombok.AllArgsConstructor; | |
| 10 | +import lombok.Builder; | |
| 11 | +import lombok.Data; | |
| 12 | +import lombok.NoArgsConstructor; | |
| 13 | + | |
| 14 | +import java.math.BigDecimal; | |
| 15 | +import java.time.LocalDate; | |
| 16 | +import java.time.LocalDateTime; | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * @Classname MaterialInventoryOutImport | |
| 20 | + * @Description 物料批量出库 | |
| 21 | + * @Date 2026/1/15 22:22 | |
| 22 | + * @Created by wangqian | |
| 23 | + */ | |
| 24 | +@Data | |
| 25 | +@Builder | |
| 26 | +@AllArgsConstructor | |
| 27 | +@NoArgsConstructor | |
| 28 | +public class MaterialInventoryOutImport { | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + @ExcelProperty(index = 1) | |
| 33 | + @NotEmpty(message = "物料名称不能为空") | |
| 34 | + private String materialName; | |
| 35 | + | |
| 36 | + @NotEmpty(message = "耗材类型不能为空") | |
| 37 | + @ExcelProperty(index = 2) | |
| 38 | + private String materialTypeName; | |
| 39 | + | |
| 40 | + @NotEmpty(message = "类别名称不能为空") | |
| 41 | + @ExcelProperty(index = 3) | |
| 42 | + private String typeName; | |
| 43 | + | |
| 44 | + @NotEmpty(message = "类别明细不能为空") | |
| 45 | + @ExcelProperty(index = 4) | |
| 46 | + private String typeDetailName; | |
| 47 | + | |
| 48 | + @NotEmpty(message = "物料规格不能为空") | |
| 49 | + @ExcelProperty(index = 5) | |
| 50 | + private String specifications; | |
| 51 | + | |
| 52 | + @NotEmpty(message = "物料单位不能为空") | |
| 53 | + @ExcelProperty(index = 6) | |
| 54 | + private String unitName; | |
| 55 | + | |
| 56 | + @ExcelProperty(index = 7) | |
| 57 | + @NotNull(message = "出库数量不能为空") | |
| 58 | + @Positive(message = "数量必须为正整数") | |
| 59 | + private Long outInventoryNum; | |
| 60 | + | |
| 61 | + @NotNull(message = "出库日期不能为空") | |
| 62 | + @ExcelProperty(index = 8) | |
| 63 | + @JsonFormat(pattern = "yyyy-MM-dd") | |
| 64 | + private LocalDate outDate; | |
| 65 | + | |
| 66 | + @NotEmpty(message = "归属公司不能为空") | |
| 67 | + @ExcelProperty(index = 9) | |
| 68 | + private String belongCompanyName; | |
| 69 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/costfee/vo/MechanicalCostImport.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/device/DeviceClockRecordController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.device; | |
| 2 | + | |
| 3 | +import org.springframework.web.bind.annotation.*; | |
| 4 | +import jakarta.annotation.Resource; | |
| 5 | +import org.springframework.validation.annotation.Validated; | |
| 6 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 7 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 8 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 9 | +import io.swagger.v3.oas.annotations.Operation; | |
| 10 | + | |
| 11 | +import jakarta.validation.constraints.*; | |
| 12 | +import jakarta.validation.*; | |
| 13 | +import jakarta.servlet.http.*; | |
| 14 | +import java.util.*; | |
| 15 | +import java.io.IOException; | |
| 16 | + | |
| 17 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 18 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 19 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 20 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 21 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 22 | + | |
| 23 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | |
| 24 | + | |
| 25 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 26 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | |
| 27 | + | |
| 28 | +import com.zteits.urbanops.module.garden.controller.admin.device.vo.*; | |
| 29 | +import com.zteits.urbanops.module.garden.dal.dataobject.device.DeviceClockRecordDO; | |
| 30 | +import com.zteits.urbanops.module.garden.service.device.DeviceClockRecordService; | |
| 31 | + | |
| 32 | +@Tag(name = "管理后台 - 员工打卡记录") | |
| 33 | +@RestController | |
| 34 | +@RequestMapping("/garden/device-clock-record") | |
| 35 | +@Validated | |
| 36 | +public class DeviceClockRecordController { | |
| 37 | + | |
| 38 | + @Resource | |
| 39 | + private DeviceClockRecordService deviceClockRecordService; | |
| 40 | + | |
| 41 | + @PostMapping("/create") | |
| 42 | + @Operation(summary = "创建员工打卡记录") | |
| 43 | + @PreAuthorize("@ss.hasPermission('garden:device-clock-record:create')") | |
| 44 | + public CommonResult<Integer> createDeviceClockRecord(@Valid @RequestBody DeviceClockRecordSaveReqVO createReqVO) { | |
| 45 | + return success(deviceClockRecordService.createDeviceClockRecord(createReqVO)); | |
| 46 | + } | |
| 47 | + | |
| 48 | + @PutMapping("/update") | |
| 49 | + @Operation(summary = "更新员工打卡记录") | |
| 50 | + @PreAuthorize("@ss.hasPermission('garden:device-clock-record:update')") | |
| 51 | + public CommonResult<Boolean> updateDeviceClockRecord(@Valid @RequestBody DeviceClockRecordSaveReqVO updateReqVO) { | |
| 52 | + deviceClockRecordService.updateDeviceClockRecord(updateReqVO); | |
| 53 | + return success(true); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @DeleteMapping("/delete") | |
| 57 | + @Operation(summary = "删除员工打卡记录") | |
| 58 | + @Parameter(name = "id", description = "编号", required = true) | |
| 59 | + @PreAuthorize("@ss.hasPermission('garden:device-clock-record:delete')") | |
| 60 | + public CommonResult<Boolean> deleteDeviceClockRecord(@RequestParam("id") Integer id) { | |
| 61 | + deviceClockRecordService.deleteDeviceClockRecord(id); | |
| 62 | + return success(true); | |
| 63 | + } | |
| 64 | + | |
| 65 | + @DeleteMapping("/delete-list") | |
| 66 | + @Parameter(name = "ids", description = "编号", required = true) | |
| 67 | + @Operation(summary = "批量删除员工打卡记录") | |
| 68 | + @PreAuthorize("@ss.hasPermission('garden:device-clock-record:delete')") | |
| 69 | + public CommonResult<Boolean> deleteDeviceClockRecordList(@RequestParam("ids") List<Integer> ids) { | |
| 70 | + deviceClockRecordService.deleteDeviceClockRecordListByIds(ids); | |
| 71 | + return success(true); | |
| 72 | + } | |
| 73 | + | |
| 74 | + @GetMapping("/get") | |
| 75 | + @Operation(summary = "获得员工打卡记录") | |
| 76 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 77 | + @PreAuthorize("@ss.hasPermission('garden:device-clock-record:query')") | |
| 78 | + public CommonResult<DeviceClockRecordRespVO> getDeviceClockRecord(@RequestParam("id") Integer id) { | |
| 79 | + DeviceClockRecordDO deviceClockRecord = deviceClockRecordService.getDeviceClockRecord(id); | |
| 80 | + return success(BeanUtils.toBean(deviceClockRecord, DeviceClockRecordRespVO.class)); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @GetMapping("/page") | |
| 84 | + @Operation(summary = "获得员工打卡记录分页") | |
| 85 | + @PreAuthorize("@ss.hasPermission('garden:device-clock-record:query')") | |
| 86 | + public CommonResult<PageResult<DeviceClockRecordRespVO>> getDeviceClockRecordPage(@Valid DeviceClockRecordPageReqVO pageReqVO) { | |
| 87 | + PageResult<DeviceClockRecordDO> pageResult = deviceClockRecordService.getDeviceClockRecordPage(pageReqVO); | |
| 88 | + return success(BeanUtils.toBean(pageResult, DeviceClockRecordRespVO.class)); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @GetMapping("/export-excel") | |
| 92 | + @Operation(summary = "导出员工打卡记录 Excel") | |
| 93 | + @PreAuthorize("@ss.hasPermission('garden:device-clock-record:export')") | |
| 94 | + @ApiAccessLog(operateType = EXPORT) | |
| 95 | + public void exportDeviceClockRecordExcel(@Valid DeviceClockRecordPageReqVO pageReqVO, | |
| 96 | + HttpServletResponse response) throws IOException { | |
| 97 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 98 | + List<DeviceClockRecordDO> list = deviceClockRecordService.getDeviceClockRecordPage(pageReqVO).getList(); | |
| 99 | + // 导出 Excel | |
| 100 | + ExcelUtils.write(response, "员工打卡记录.xls", "数据", DeviceClockRecordRespVO.class, | |
| 101 | + BeanUtils.toBean(list, DeviceClockRecordRespVO.class)); | |
| 102 | + } | |
| 103 | + | |
| 104 | +} | |
| 0 | 105 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/device/vo/DeviceClockRecordPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.device.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 7 | +import java.math.BigDecimal; | |
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 9 | +import java.time.LocalDateTime; | |
| 10 | + | |
| 11 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 12 | + | |
| 13 | +@Schema(description = "管理后台 - 员工打卡记录分页 Request VO") | |
| 14 | +@Data | |
| 15 | +public class DeviceClockRecordPageReqVO extends PageParam { | |
| 16 | + | |
| 17 | + @Schema(description = "设备编码") | |
| 18 | + private String deviceCode; | |
| 19 | + | |
| 20 | + @Schema(description = "设备名称", example = "李四") | |
| 21 | + private String deviceName; | |
| 22 | + | |
| 23 | + @Schema(description = "打卡类型:上班/下班", example = "2") | |
| 24 | + private String punchType; | |
| 25 | + | |
| 26 | + @Schema(description = "高德GCJ02坐标系纬度") | |
| 27 | + private BigDecimal latGcj02; | |
| 28 | + | |
| 29 | + @Schema(description = "高德GCJ02坐标系经度") | |
| 30 | + private BigDecimal lngGcj02; | |
| 31 | + | |
| 32 | + @Schema(description = "详细地址") | |
| 33 | + private String address; | |
| 34 | + | |
| 35 | + @Schema(description = "84坐标经度") | |
| 36 | + private BigDecimal lng; | |
| 37 | + | |
| 38 | + @Schema(description = "84坐标纬度") | |
| 39 | + private BigDecimal lat; | |
| 40 | + | |
| 41 | + @Schema(description = "状态位") | |
| 42 | + private Integer statusBit; | |
| 43 | + | |
| 44 | + @Schema(description = "警告位") | |
| 45 | + private Integer warnBit; | |
| 46 | + | |
| 47 | + @Schema(description = "提交人用户ID", example = "20708") | |
| 48 | + private Long userId; | |
| 49 | + | |
| 50 | + @Schema(description = "用户昵称", example = "张三") | |
| 51 | + private String nickname; | |
| 52 | + | |
| 53 | + @Schema(description = "归属(一级部门id)", example = "10917") | |
| 54 | + private Long companyId; | |
| 55 | + | |
| 56 | + @Schema(description = "部门ID", example = "126") | |
| 57 | + private Long deptId; | |
| 58 | + | |
| 59 | + @Schema(description = "业务线: yl-园林;wy-物业:sz-市政;例如:yl,wy") | |
| 60 | + private String busiLine; | |
| 61 | + | |
| 62 | + @Schema(description = "创建时间") | |
| 63 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 64 | + private LocalDateTime[] createTime; | |
| 65 | + | |
| 66 | +} | |
| 0 | 67 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/device/vo/DeviceClockRecordRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.device.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import java.math.BigDecimal; | |
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | +import cn.idev.excel.annotation.*; | |
| 10 | + | |
| 11 | +@Schema(description = "管理后台 - 员工打卡记录 Response VO") | |
| 12 | +@Data | |
| 13 | +@ExcelIgnoreUnannotated | |
| 14 | +public class DeviceClockRecordRespVO { | |
| 15 | + | |
| 16 | + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10971") | |
| 17 | + @ExcelProperty("主键ID") | |
| 18 | + private Integer id; | |
| 19 | + | |
| 20 | + @Schema(description = "设备编码", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 21 | + @ExcelProperty("设备编码") | |
| 22 | + private String deviceCode; | |
| 23 | + | |
| 24 | + @Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | |
| 25 | + @ExcelProperty("设备名称") | |
| 26 | + private String deviceName; | |
| 27 | + | |
| 28 | + @Schema(description = "打卡类型:上班/下班", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 29 | + @ExcelProperty("打卡类型:上班/下班") | |
| 30 | + private String punchType; | |
| 31 | + | |
| 32 | + @Schema(description = "高德GCJ02坐标系纬度") | |
| 33 | + @ExcelProperty("高德GCJ02坐标系纬度") | |
| 34 | + private BigDecimal latGcj02; | |
| 35 | + | |
| 36 | + @Schema(description = "高德GCJ02坐标系经度") | |
| 37 | + @ExcelProperty("高德GCJ02坐标系经度") | |
| 38 | + private BigDecimal lngGcj02; | |
| 39 | + | |
| 40 | + @Schema(description = "详细地址") | |
| 41 | + @ExcelProperty("详细地址") | |
| 42 | + private String address; | |
| 43 | + | |
| 44 | + @Schema(description = "84坐标经度") | |
| 45 | + @ExcelProperty("84坐标经度") | |
| 46 | + private BigDecimal lng; | |
| 47 | + | |
| 48 | + @Schema(description = "84坐标纬度") | |
| 49 | + @ExcelProperty("84坐标纬度") | |
| 50 | + private BigDecimal lat; | |
| 51 | + | |
| 52 | + @Schema(description = "状态位") | |
| 53 | + @ExcelProperty("状态位") | |
| 54 | + private Integer statusBit; | |
| 55 | + | |
| 56 | + @Schema(description = "警告位") | |
| 57 | + @ExcelProperty("警告位") | |
| 58 | + private Integer warnBit; | |
| 59 | + | |
| 60 | + @Schema(description = "提交人用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20708") | |
| 61 | + @ExcelProperty("提交人用户ID") | |
| 62 | + private Long userId; | |
| 63 | + | |
| 64 | + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | |
| 65 | + @ExcelProperty("用户昵称") | |
| 66 | + private String nickname; | |
| 67 | + | |
| 68 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "10917") | |
| 69 | + @ExcelProperty("归属(一级部门id)") | |
| 70 | + private Long companyId; | |
| 71 | + | |
| 72 | + @Schema(description = "部门ID", example = "126") | |
| 73 | + @ExcelProperty("部门ID") | |
| 74 | + private Long deptId; | |
| 75 | + | |
| 76 | + @Schema(description = "业务线: yl-园林;wy-物业:sz-市政;例如:yl,wy", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 77 | + @ExcelProperty("业务线: yl-园林;wy-物业:sz-市政;例如:yl,wy") | |
| 78 | + private String busiLine; | |
| 79 | + | |
| 80 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 81 | + @ExcelProperty("创建时间") | |
| 82 | + private LocalDateTime createTime; | |
| 83 | + | |
| 84 | +} | |
| 0 | 85 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/device/vo/DeviceClockRecordSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.device.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import jakarta.validation.constraints.*; | |
| 7 | +import java.math.BigDecimal; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - 员工打卡记录新增/修改 Request VO") | |
| 10 | +@Data | |
| 11 | +public class DeviceClockRecordSaveReqVO { | |
| 12 | + | |
| 13 | + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10971") | |
| 14 | + private Integer id; | |
| 15 | + | |
| 16 | + @Schema(description = "设备编码", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 17 | + @NotEmpty(message = "设备编码不能为空") | |
| 18 | + private String deviceCode; | |
| 19 | + | |
| 20 | + @Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | |
| 21 | + @NotEmpty(message = "设备名称不能为空") | |
| 22 | + private String deviceName; | |
| 23 | + | |
| 24 | + @Schema(description = "打卡类型:上班/下班", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 25 | + @NotEmpty(message = "打卡类型:上班/下班不能为空") | |
| 26 | + private String punchType; | |
| 27 | + | |
| 28 | + @Schema(description = "高德GCJ02坐标系纬度") | |
| 29 | + private BigDecimal latGcj02; | |
| 30 | + | |
| 31 | + @Schema(description = "高德GCJ02坐标系经度") | |
| 32 | + private BigDecimal lngGcj02; | |
| 33 | + | |
| 34 | + @Schema(description = "详细地址") | |
| 35 | + private String address; | |
| 36 | + | |
| 37 | + @Schema(description = "84坐标经度") | |
| 38 | + private BigDecimal lng; | |
| 39 | + | |
| 40 | + @Schema(description = "84坐标纬度") | |
| 41 | + private BigDecimal lat; | |
| 42 | + | |
| 43 | + @Schema(description = "状态位") | |
| 44 | + private Integer statusBit; | |
| 45 | + | |
| 46 | + @Schema(description = "警告位") | |
| 47 | + private Integer warnBit; | |
| 48 | + | |
| 49 | + @Schema(description = "提交人用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20708") | |
| 50 | + @NotNull(message = "提交人用户ID不能为空") | |
| 51 | + private Long userId; | |
| 52 | + | |
| 53 | + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | |
| 54 | + @NotEmpty(message = "用户昵称不能为空") | |
| 55 | + private String nickname; | |
| 56 | + | |
| 57 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "10917") | |
| 58 | + @NotNull(message = "归属(一级部门id)不能为空") | |
| 59 | + private Long companyId; | |
| 60 | + | |
| 61 | + @Schema(description = "部门ID", example = "126") | |
| 62 | + private Long deptId; | |
| 63 | + | |
| 64 | + @Schema(description = "业务线: yl-园林;wy-物业:sz-市政;例如:yl,wy", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 65 | + @NotEmpty(message = "业务线: yl-园林;wy-物业:sz-市政;例如:yl,wy不能为空") | |
| 66 | + private String busiLine; | |
| 67 | + | |
| 68 | +} | |
| 0 | 69 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/deviceuser/DeviceUserController.java
| ... | ... | @@ -40,25 +40,32 @@ public class DeviceUserController { |
| 40 | 40 | |
| 41 | 41 | @PostMapping("/create") |
| 42 | 42 | @Operation(summary = "创建设备用户关系") |
| 43 | - @PreAuthorize("@ss.hasPermission('garden:device-user:create')") | |
| 43 | + // @PreAuthorize("@ss.hasPermission('garden:device-user:create')") | |
| 44 | 44 | public CommonResult<Long> createDeviceUser(@Valid @RequestBody DeviceUserSaveReqVO createReqVO) { |
| 45 | 45 | return success(deviceUserService.createDeviceUser(createReqVO)); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - @PutMapping("/update") | |
| 48 | + @PutMapping("/update/device") | |
| 49 | 49 | @Operation(summary = "更新设备用户关系") |
| 50 | - @PreAuthorize("@ss.hasPermission('garden:device-user:update')") | |
| 51 | - public CommonResult<Boolean> updateDeviceUser(@Valid @RequestBody DeviceUserSaveReqVO updateReqVO) { | |
| 52 | - deviceUserService.updateDeviceUser(updateReqVO); | |
| 50 | + //@PreAuthorize("@ss.hasPermission('garden:device-user:update')") | |
| 51 | + public CommonResult<Boolean> updateDevice(@Valid @RequestBody DeviceUserUpdateReqVO updateReqVO) { | |
| 52 | + deviceUserService.updateDevice(updateReqVO); | |
| 53 | 53 | return success(true); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | + @GetMapping("/get/device_no") | |
| 57 | + @Operation(summary = "通过设备编码获取设备绑定信息") | |
| 58 | + public CommonResult<DeviceUserRespVO> getDeviceUserByDeviceNo(@RequestParam("deviceNo") @NotBlank String deviceNo) { | |
| 59 | + DeviceUserRespVO deviceUser = deviceUserService.getDeviceUserByDeviceNo(deviceNo); | |
| 60 | + return success(deviceUser); | |
| 61 | + } | |
| 62 | + | |
| 56 | 63 | @DeleteMapping("/delete") |
| 57 | 64 | @Operation(summary = "删除设备用户关系") |
| 58 | 65 | @Parameter(name = "id", description = "编号", required = true) |
| 59 | 66 | @PreAuthorize("@ss.hasPermission('garden:device-user:delete')") |
| 60 | - public CommonResult<Boolean> deleteDeviceUser(@RequestParam("user_id") @NotNull Long userId, | |
| 61 | - @RequestParam("device_no") @NotBlank String deviceNo) { | |
| 67 | + public CommonResult<Boolean> deleteDeviceUser(@RequestParam("userId") @NotNull Long userId, | |
| 68 | + @RequestParam("deviceNo") @NotBlank String deviceNo) { | |
| 62 | 69 | deviceUserService.deleteDeviceUser(userId, deviceNo); |
| 63 | 70 | return success(true); |
| 64 | 71 | } |
| ... | ... | @@ -85,8 +92,8 @@ public class DeviceUserController { |
| 85 | 92 | @Operation(summary = "获得设备用户关系分页") |
| 86 | 93 | //@PreAuthorize("@ss.hasPermission('garden:device-user:query')") |
| 87 | 94 | public CommonResult<PageResult<DeviceUserRespVO>> getDeviceUserPage(@Valid DeviceUserPageReqVO pageReqVO) { |
| 88 | - PageResult<DeviceUserDO> pageResult = deviceUserService.getDeviceUserPage(pageReqVO); | |
| 89 | - return success(BeanUtils.toBean(pageResult, DeviceUserRespVO.class)); | |
| 95 | + PageResult<DeviceUserRespVO> pageResult = deviceUserService.getDeviceUserPage(pageReqVO); | |
| 96 | + return success(pageResult); | |
| 90 | 97 | } |
| 91 | 98 | |
| 92 | 99 | @GetMapping("/export-excel") |
| ... | ... | @@ -96,10 +103,20 @@ public class DeviceUserController { |
| 96 | 103 | public void exportDeviceUserExcel(@Valid DeviceUserPageReqVO pageReqVO, |
| 97 | 104 | HttpServletResponse response) throws IOException { |
| 98 | 105 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| 99 | - List<DeviceUserDO> list = deviceUserService.getDeviceUserPage(pageReqVO).getList(); | |
| 106 | + List<DeviceUserRespVO> list = deviceUserService.getDeviceUserPage(pageReqVO).getList(); | |
| 100 | 107 | // 导出 Excel |
| 101 | 108 | ExcelUtils.write(response, "设备用户关系.xls", "数据", DeviceUserRespVO.class, |
| 102 | - BeanUtils.toBean(list, DeviceUserRespVO.class)); | |
| 109 | + list); | |
| 103 | 110 | } |
| 104 | 111 | |
| 112 | + @PostMapping("/findDeviceDeptTree") | |
| 113 | + @Operation(summary = "获取IOT设备tree") | |
| 114 | + //@PreAuthorize("@ss.hasPermission('garden:device-user:query')") | |
| 115 | + public CommonResult<DeviceDeptTreeRespVO> findDeviceDeptTree(@Valid @RequestBody DeviceDeptTreeReqVO reqVO) { | |
| 116 | + DeviceDeptTreeRespVO deviceUser = deviceUserService.findDeviceDeptTree(reqVO); | |
| 117 | + return success(deviceUser); | |
| 118 | + } | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 105 | 122 | } |
| 106 | 123 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/deviceuser/vo/DeviceDeptTreeReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.deviceuser.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +@Schema(description = "管理后台 - IOT设备") | |
| 7 | +@Data | |
| 8 | +public class DeviceDeptTreeReqVO { | |
| 9 | + | |
| 10 | + /** | |
| 11 | + * 设备编码 精确查询 | |
| 12 | + */ | |
| 13 | + private String deviceCode; | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * 设备名称 模糊查询 | |
| 17 | + */ | |
| 18 | + private String deviceName; | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * 设备归属部门名称 模糊查询 | |
| 22 | + */ | |
| 23 | + private String deviceDeptName; | |
| 24 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/deviceuser/vo/DeviceDeptTreeRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.deviceuser.vo; | |
| 2 | + | |
| 3 | + | |
| 4 | +import lombok.Data; | |
| 5 | +import java.util.Date; | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 设备部门树响应数据 | |
| 10 | + * | |
| 11 | + * @author your-name | |
| 12 | + * @since 2023-xx-xx | |
| 13 | + */ | |
| 14 | +@Data | |
| 15 | +public class DeviceDeptTreeRespVO { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 编码 | |
| 19 | + */ | |
| 20 | + private String code; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 名称 | |
| 24 | + */ | |
| 25 | + private String name; | |
| 26 | + /** | |
| 27 | + * 父编码 | |
| 28 | + */ | |
| 29 | + private String parentCode; | |
| 30 | + /** | |
| 31 | + * 显示顺序 | |
| 32 | + */ | |
| 33 | + private Integer orderNum; | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 部门状态(0正常 1停用) | |
| 37 | + */ | |
| 38 | + private String status; | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 设备数量 | |
| 42 | + */ | |
| 43 | + private Integer deviceCount; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 创建时间 | |
| 47 | + */ | |
| 48 | + private Date createTime; | |
| 49 | + /** | |
| 50 | + * 节点类型:1部门 3设备 | |
| 51 | + */ | |
| 52 | + private Integer nodeType; | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 节点类型为设备时,该值有值 | |
| 56 | + * 产品名称 | |
| 57 | + */ | |
| 58 | + private String productName; | |
| 59 | + /** | |
| 60 | + * 节点类型为设备时,该值有值 | |
| 61 | + * 产品编码 | |
| 62 | + */ | |
| 63 | + private String productCode; | |
| 64 | + /** | |
| 65 | + * 子节点,和当前一样的结构 | |
| 66 | + */ | |
| 67 | + private List<DeviceDeptTreeRespVO> children; | |
| 68 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/deviceuser/vo/DeviceUserRespVO.java
| ... | ... | @@ -57,5 +57,12 @@ public class DeviceUserRespVO { |
| 57 | 57 | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 58 | 58 | private LocalDateTime createTime; |
| 59 | 59 | |
| 60 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "20800") | |
| 61 | + @ExcelProperty("归属(一级部门id)") | |
| 62 | + private String companyName; | |
| 63 | + | |
| 64 | + @ExcelProperty("部门(道路负责部门)") | |
| 65 | + private String deptName; | |
| 66 | + | |
| 60 | 67 | |
| 61 | 68 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/deviceuser/vo/DeviceUserSaveReqVO.java
| ... | ... | @@ -35,8 +35,10 @@ public class DeviceUserSaveReqVO { |
| 35 | 35 | |
| 36 | 36 | @Data |
| 37 | 37 | public static class DeviceInfoDO { |
| 38 | + | |
| 39 | + private String productCode; | |
| 40 | + | |
| 38 | 41 | @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") |
| 39 | - @NotEmpty(message = "产品名称不能为空") | |
| 40 | 42 | private String productName; |
| 41 | 43 | |
| 42 | 44 | @Schema(description = "设备标识", requiredMode = Schema.RequiredMode.REQUIRED) | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/deviceuser/vo/DeviceUserUpdateReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.deviceuser.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import jakarta.validation.Valid; | |
| 5 | +import jakarta.validation.constraints.NotEmpty; | |
| 6 | +import jakarta.validation.constraints.NotNull; | |
| 7 | +import jakarta.validation.constraints.Size; | |
| 8 | +import lombok.Data; | |
| 9 | + | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - 设备用户关系新增/修改 Request VO") | |
| 13 | +@Data | |
| 14 | +public class DeviceUserUpdateReqVO { | |
| 15 | + | |
| 16 | + @Schema(description = "设备信息") | |
| 17 | + @NotNull | |
| 18 | + @Size(min = 1, message = "道路信息不能为空") | |
| 19 | + @Valid | |
| 20 | + private List<DeviceUserSaveReqVO.DeviceInfoDO> deviceInfoList; | |
| 21 | + | |
| 22 | + @Data | |
| 23 | + public static class DeviceInfoDO { | |
| 24 | + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | |
| 25 | + @NotEmpty(message = "产品名称不能为空") | |
| 26 | + private String productName; | |
| 27 | + | |
| 28 | + @Schema(description = "设备标识", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 29 | + @NotEmpty(message = "设备标识不能为空") | |
| 30 | + private String deviceNo; | |
| 31 | + | |
| 32 | + @Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | |
| 33 | + @NotEmpty(message = "设备名称不能为空") | |
| 34 | + private String deviceName; | |
| 35 | + | |
| 36 | + @Schema(description = "连接状态 : 在线:ONLINE || 离线:OFFLINE || 未连接:INIT", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 37 | + @NotEmpty(message = "连接状态 : 在线:ONLINE || 离线:OFFLINE || 未连接:INIT") | |
| 38 | + private String deviceState; | |
| 39 | + | |
| 40 | + } | |
| 41 | + | |
| 42 | +} | |
| 0 | 43 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/EmergencyTaskController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask; | |
| 2 | + | |
| 3 | +import com.zteits.urbanops.framework.common.biz.system.dict.dto.DictDataRespDTO; | |
| 4 | +import org.springframework.util.CollectionUtils; | |
| 5 | +import org.springframework.web.bind.annotation.*; | |
| 6 | +import jakarta.annotation.Resource; | |
| 7 | +import org.springframework.validation.annotation.Validated; | |
| 8 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 9 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 10 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 11 | +import io.swagger.v3.oas.annotations.Operation; | |
| 12 | + | |
| 13 | +import jakarta.validation.*; | |
| 14 | +import jakarta.servlet.http.*; | |
| 15 | +import java.util.*; | |
| 16 | +import java.io.IOException; | |
| 17 | +import java.util.stream.Collectors; | |
| 18 | + | |
| 19 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 20 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 21 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 22 | + | |
| 23 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 24 | + | |
| 25 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | |
| 26 | + | |
| 27 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 28 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | |
| 29 | + | |
| 30 | +import com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo.*; | |
| 31 | +import com.zteits.urbanops.module.garden.service.emergencytask.EmergencyTaskService; | |
| 32 | + | |
| 33 | +@Tag(name = "管理后台 - 抢险任务主") | |
| 34 | +@RestController | |
| 35 | +@RequestMapping("/garden/emergency-task") | |
| 36 | +@Validated | |
| 37 | +public class EmergencyTaskController { | |
| 38 | + | |
| 39 | + @Resource | |
| 40 | + private EmergencyTaskService emergencyTaskService; | |
| 41 | + | |
| 42 | + @PostMapping("/create") | |
| 43 | + @Operation(summary = "创建抢险任务主") | |
| 44 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:create')") | |
| 45 | + public CommonResult<Long> createEmergencyTask(@Valid @RequestBody EmergencyTaskSaveReqVO createReqVO) { | |
| 46 | + return success(emergencyTaskService.createEmergencyTask(createReqVO, true)); | |
| 47 | + } | |
| 48 | + | |
| 49 | + @PutMapping("/update") | |
| 50 | + @Operation(summary = "更新抢险任务主") | |
| 51 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:update')") | |
| 52 | + public CommonResult<Boolean> updateEmergencyTask(@Valid @RequestBody EmergencyTaskSaveReqVO updateReqVO) { | |
| 53 | + emergencyTaskService.updateEmergencyTask(updateReqVO); | |
| 54 | + return success(true); | |
| 55 | + } | |
| 56 | + | |
| 57 | + @PostMapping("/approval") | |
| 58 | + @Operation(summary = "抢险任务审批") | |
| 59 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:approval')") | |
| 60 | + public CommonResult<Integer> approvalEmergencyTask(@Valid @RequestBody EmergencyTaskApprovalReqVO createReqVO) { | |
| 61 | + return success(emergencyTaskService.approvalEmergencyTask(createReqVO)); | |
| 62 | + } | |
| 63 | + | |
| 64 | + @DeleteMapping("/delete/task_no") | |
| 65 | + @Operation(summary = "删除抢险任务主") | |
| 66 | + @Parameter(name = "task_no", description = "编号", required = true) | |
| 67 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:delete')") | |
| 68 | + public CommonResult<Boolean> deleteEmergencyTask(@RequestParam("task_no") String taskNo) { | |
| 69 | + emergencyTaskService.deleteEmergencyTaskByTaskNo(taskNo); | |
| 70 | + return success(true); | |
| 71 | + } | |
| 72 | + | |
| 73 | + @DeleteMapping("/delete-list") | |
| 74 | + @Parameter(name = "ids", description = "编号", required = true) | |
| 75 | + @Operation(summary = "批量删除抢险任务主") | |
| 76 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:delete')") | |
| 77 | + public CommonResult<Boolean> deleteEmergencyTaskList(@RequestParam("ids") List<Long> ids) { | |
| 78 | + emergencyTaskService.deleteEmergencyTaskListByIds(ids); | |
| 79 | + return success(true); | |
| 80 | + } | |
| 81 | + | |
| 82 | + @GetMapping("/get/task_no") | |
| 83 | + @Operation(summary = "获得抢险任务主") | |
| 84 | + @Parameter(name = "task_no", description = "编号", required = true, example = "1024") | |
| 85 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:query')") | |
| 86 | + public CommonResult<EmergencyTaskRespVO> getEmergencyTask(@RequestParam("task_no") String taskNo) { | |
| 87 | + EmergencyTaskRespVO emergencyTask = emergencyTaskService.getEmergencyTaskByTaskNo(taskNo); | |
| 88 | + return success(emergencyTask); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @GetMapping("/page") | |
| 92 | + @Operation(summary = "获得抢险任务主分页") | |
| 93 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:query')") | |
| 94 | + public CommonResult<PageResult<EmergencyTaskRespVO>> getEmergencyTaskPage(@Valid EmergencyTaskPageReqVO pageReqVO) { | |
| 95 | + PageResult<EmergencyTaskRespVO> pageResult = emergencyTaskService.getEmergencyTaskPage(pageReqVO); | |
| 96 | + return success(pageResult); | |
| 97 | + } | |
| 98 | + | |
| 99 | + @GetMapping("/export-excel") | |
| 100 | + @Operation(summary = "导出抢险任务主 Excel") | |
| 101 | + @PreAuthorize("@ss.hasPermission('garden:emergency-task:export')") | |
| 102 | + @ApiAccessLog(operateType = EXPORT) | |
| 103 | + public void exportEmergencyTaskExcel(@Valid EmergencyTaskPageReqVO pageReqVO, | |
| 104 | + HttpServletResponse response) throws IOException { | |
| 105 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 106 | + List<EmergencyTaskRespVO> list = emergencyTaskService.getEmergencyTaskPage(pageReqVO).getList(); | |
| 107 | + List<EmergencyTaskExcleRespVO> respList = new ArrayList<>(); | |
| 108 | + | |
| 109 | + //险情类型 1:树木倒伏 2:树木折枝 | |
| 110 | + List<DictDataRespDTO> dictDataList = emergencyTaskService.getDictDataList("hazard_type"); | |
| 111 | + | |
| 112 | + //险情危害 1:砸车 2:砸房 3:砸人 4:无 | |
| 113 | + List<DictDataRespDTO> hazardRiskList = emergencyTaskService.getDictDataList("hazard_risk"); | |
| 114 | + //树木权属 1:专业权属 2:街道权属 3:其他 | |
| 115 | + List<DictDataRespDTO> treePermissionsList = emergencyTaskService.getDictDataList("tree_permissions"); | |
| 116 | + //机械类型 1:三轮车;2:货车;3:挖掘机 | |
| 117 | + List<DictDataRespDTO> mechanicalTypeNameList = emergencyTaskService.getDictDataList("mechanical_type_name"); | |
| 118 | + | |
| 119 | + //案件状态 1-待提交 2-待审核 3-驳回 | |
| 120 | + List<DictDataRespDTO> rescueStatusList = emergencyTaskService.getDictDataList("rescue_status"); | |
| 121 | + | |
| 122 | + | |
| 123 | + list.forEach(emergencyTask -> { | |
| 124 | + EmergencyTaskExcleRespVO emergencyTaskExcleRespVO = new EmergencyTaskExcleRespVO(); | |
| 125 | + emergencyTaskExcleRespVO.setTaskNo(emergencyTask.getTaskNo()); | |
| 126 | + emergencyTaskExcleRespVO.setDiscoveryTime(emergencyTask.getDiscoveryTime()); | |
| 127 | + emergencyTaskExcleRespVO.setEmergencyTypeName(getLabel(dictDataList, emergencyTask.getEmergencyTypeId())); | |
| 128 | + emergencyTaskExcleRespVO.setEmergencyHarmName(getLabel(hazardRiskList, emergencyTask.getEmergencyHarmId())); | |
| 129 | + emergencyTaskExcleRespVO.setTreeOwnershipName(getLabel(treePermissionsList, emergencyTask.getTreeOwnershipId())); | |
| 130 | + emergencyTaskExcleRespVO.setEmergencyLocation(emergencyTask.getEmergencyLocation()); | |
| 131 | + emergencyTaskExcleRespVO.setReporter(emergencyTask.getReporter()); | |
| 132 | + emergencyTaskExcleRespVO.setContactPhone(emergencyTask.getContactPhone()); | |
| 133 | + emergencyTaskExcleRespVO.setEmergencyImg(emergencyTask.getEmergencyImg()); | |
| 134 | + emergencyTaskExcleRespVO.setTreeSpecies(emergencyTask.getTreeSpecies()); | |
| 135 | + emergencyTaskExcleRespVO.setTreeSpec(emergencyTask.getTreeSpec()); | |
| 136 | + emergencyTaskExcleRespVO.setRescueStartTime(emergencyTask.getRescueStartTime()); | |
| 137 | + emergencyTaskExcleRespVO.setRescueCompleteTime(emergencyTask.getRescueCompleteTime()); | |
| 138 | + emergencyTaskExcleRespVO.setPersonnelCount(emergencyTask.getPersonnelCount()); | |
| 139 | + emergencyTaskExcleRespVO.setEmergencyEndImg(emergencyTask.getEmergencyEndImg()); | |
| 140 | + emergencyTaskExcleRespVO.setRemarks(emergencyTask.getRemarks()); | |
| 141 | + emergencyTaskExcleRespVO.setBusiStatus(getLabel(rescueStatusList, emergencyTask.getBusiStatus())); | |
| 142 | + emergencyTaskExcleRespVO.setCompanyName(emergencyTask.getCompanyName()); | |
| 143 | + emergencyTaskExcleRespVO.setApprovalUserName(emergencyTask.getApprovalUserName()); | |
| 144 | + emergencyTaskExcleRespVO.setApprovalRemarks(emergencyTask.getApprovalRemarks()); | |
| 145 | + emergencyTaskExcleRespVO.setCreatorName(emergencyTask.getCreatorName()); | |
| 146 | + emergencyTaskExcleRespVO.setCreateTime(emergencyTask.getCreateTime()); | |
| 147 | + emergencyTaskExcleRespVO.setUpdaterName(emergencyTask.getUpdaterName()); | |
| 148 | + List<String> machineryList = new ArrayList<>(); | |
| 149 | + if(CollectionUtils.isEmpty(emergencyTask.getEmergencyMachineryList())){ | |
| 150 | + emergencyTaskExcleRespVO.setMachineryInfo(Collections.emptyList()); | |
| 151 | + }else{ | |
| 152 | + emergencyTask.getEmergencyMachineryList().forEach(emergencyMachinery -> { | |
| 153 | + String machineryName = getLabel(mechanicalTypeNameList, emergencyMachinery.getMachineryNameId()); | |
| 154 | + Integer machineryCount = emergencyMachinery.getMachineryCount(); | |
| 155 | + machineryList.add(machineryName + ":" + machineryCount); | |
| 156 | + }); | |
| 157 | + emergencyTaskExcleRespVO.setMachineryInfo(machineryList); | |
| 158 | + } | |
| 159 | + respList.add(emergencyTaskExcleRespVO); | |
| 160 | + }); | |
| 161 | + | |
| 162 | + | |
| 163 | + // 导出 Excel | |
| 164 | + ExcelUtils.write(response, "抢险任务主.xls", "数据", EmergencyTaskExcleRespVO.class, respList); | |
| 165 | + } | |
| 166 | + | |
| 167 | + private String getLabel(List<DictDataRespDTO> dictDataList, Integer id){ | |
| 168 | + if(CollectionUtils.isEmpty(dictDataList)){ | |
| 169 | + return ""; | |
| 170 | + } | |
| 171 | + Map<String, String> nameMap = dictDataList.stream() | |
| 172 | + .collect(Collectors.toMap( | |
| 173 | + DictDataRespDTO::getValue, // Key=id | |
| 174 | + DictDataRespDTO::getLabel // Value=name | |
| 175 | + )); | |
| 176 | + | |
| 177 | + return nameMap.get(String.valueOf( id)); | |
| 178 | + } | |
| 179 | + | |
| 180 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyMachineryPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - 抢险机械子分页 Request VO") | |
| 13 | +@Data | |
| 14 | +public class EmergencyMachineryPageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @Schema(description = "关联任务主表ID", example = "24066") | |
| 17 | + private Long taskId; | |
| 18 | + | |
| 19 | + @Schema(description = "机械名称(如:三轮车)", example = "21485") | |
| 20 | + private Integer machineryNameId; | |
| 21 | + | |
| 22 | + @Schema(description = "机械数量", example = "28764") | |
| 23 | + private Integer machineryCount; | |
| 24 | + | |
| 25 | + @Schema(description = "创建者", example = "李四") | |
| 26 | + private String creatorName; | |
| 27 | + | |
| 28 | + @Schema(description = "创建时间") | |
| 29 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 30 | + private LocalDateTime[] createTime; | |
| 31 | + | |
| 32 | + @Schema(description = "更新者", example = "张三") | |
| 33 | + private String updaterName; | |
| 34 | + | |
| 35 | +} | |
| 0 | 36 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyMachineryRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | +import cn.idev.excel.annotation.*; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - 抢险机械子 Response VO") | |
| 11 | +@Data | |
| 12 | +@ExcelIgnoreUnannotated | |
| 13 | +public class EmergencyMachineryRespVO { | |
| 14 | + | |
| 15 | + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1541") | |
| 16 | + @ExcelProperty("主键ID") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "关联任务主表ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24066") | |
| 20 | + @ExcelProperty("关联任务主表ID") | |
| 21 | + private Long taskId; | |
| 22 | + | |
| 23 | + @Schema(description = "机械名称(如:三轮车)", requiredMode = Schema.RequiredMode.REQUIRED, example = "21485") | |
| 24 | + @ExcelProperty("机械名称(如:三轮车)") | |
| 25 | + private Integer machineryNameId; | |
| 26 | + | |
| 27 | + @Schema(description = "机械数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "28764") | |
| 28 | + @ExcelProperty("机械数量") | |
| 29 | + private Integer machineryCount; | |
| 30 | + | |
| 31 | + @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | |
| 32 | + @ExcelProperty("创建者") | |
| 33 | + private String creatorName; | |
| 34 | + | |
| 35 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 36 | + @ExcelProperty("创建时间") | |
| 37 | + private LocalDateTime createTime; | |
| 38 | + | |
| 39 | + @Schema(description = "更新者", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | |
| 40 | + @ExcelProperty("更新者") | |
| 41 | + private String updaterName; | |
| 42 | + | |
| 43 | +} | |
| 0 | 44 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyMachinerySaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import jakarta.validation.constraints.*; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - 抢险机械子新增/修改 Request VO") | |
| 9 | +@Data | |
| 10 | +public class EmergencyMachinerySaveReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "机械名称(如:三轮车)", requiredMode = Schema.RequiredMode.REQUIRED, example = "21485") | |
| 13 | + @NotNull(message = "机械名称(如:三轮车)不能为空") | |
| 14 | + private Integer machineryNameId; | |
| 15 | + | |
| 16 | + @Schema(description = "机械数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "28764") | |
| 17 | + @NotNull(message = "机械数量不能为空") | |
| 18 | + private Integer machineryCount; | |
| 19 | + | |
| 20 | +} | |
| 0 | 21 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyTaskApprovalReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import jakarta.validation.constraints.*; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 7 | +@Schema(description = "管理后台 - 抢险任务主新增/修改 Request VO") | |
| 8 | +@Data | |
| 9 | +public class EmergencyTaskApprovalReqVO { | |
| 10 | + | |
| 11 | + @Schema(description = "任务编号(唯一标识,如生成规则:TASK+时间戳)", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 12 | + @NotEmpty(message = "任务编号(唯一标识,如生成规则:TASK+时间戳)不能为空") | |
| 13 | + private String taskNo; | |
| 14 | + | |
| 15 | + | |
| 16 | + @Schema(description = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 17 | + @NotNull(message = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结 不能为空") | |
| 18 | + @Min(value = 1, message = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结不能小于 1") | |
| 19 | + @Max(value = 5, message = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结不能大于 5") | |
| 20 | + private Integer busiStatus; | |
| 21 | + | |
| 22 | + @Schema(description = "审批备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "审批备注") | |
| 23 | + private String approvalRemarks; | |
| 24 | + | |
| 25 | +} | |
| 0 | 26 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyTaskExcleRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo; | |
| 2 | + | |
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | |
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | |
| 5 | +import cn.idev.excel.annotation.write.style.ColumnWidth; | |
| 6 | +import com.zteits.urbanops.framework.excel.core.convert.ImageListConverter; | |
| 7 | +import com.zteits.urbanops.framework.excel.core.convert.ListToStringConverter; | |
| 8 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 9 | +import lombok.Data; | |
| 10 | + | |
| 11 | +import java.time.LocalDateTime; | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +@Schema(description = "管理后台 - 抢险任务主 Response VO") | |
| 15 | +@Data | |
| 16 | +@ExcelIgnoreUnannotated | |
| 17 | +public class EmergencyTaskExcleRespVO { | |
| 18 | + | |
| 19 | + @Schema(description = "任务编号(唯一标识,如生成规则:TASK+时间戳)", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 20 | + @ExcelProperty("案件编号") | |
| 21 | + private String taskNo; | |
| 22 | + | |
| 23 | + @Schema(description = "发现险情时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 24 | + @ExcelProperty("发现险情时间") | |
| 25 | + private LocalDateTime discoveryTime; | |
| 26 | + | |
| 27 | + @Schema(description = "险情类型(如:树木倒伏)", requiredMode = Schema.RequiredMode.REQUIRED, example = "5209") | |
| 28 | + @ExcelProperty("险情类型") | |
| 29 | + private String emergencyTypeName; | |
| 30 | + | |
| 31 | + @Schema(description = "险情危害(如:无)", requiredMode = Schema.RequiredMode.REQUIRED, example = "16325") | |
| 32 | + @ExcelProperty("险情危害") | |
| 33 | + private String emergencyHarmName; | |
| 34 | + | |
| 35 | + @Schema(description = "树木权属(如:专业权属)", requiredMode = Schema.RequiredMode.REQUIRED, example = "19498") | |
| 36 | + @ExcelProperty("树木权属") | |
| 37 | + private String treeOwnershipName; | |
| 38 | + | |
| 39 | + @Schema(description = "险情地点", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 40 | + @ExcelProperty("险情地点") | |
| 41 | + private String emergencyLocation; | |
| 42 | + | |
| 43 | + @Schema(description = "上报人", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 44 | + @ExcelProperty("上报人") | |
| 45 | + private String reporter; | |
| 46 | + | |
| 47 | + @Schema(description = "联系电话", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 48 | + @ExcelProperty("联系电话") | |
| 49 | + private String contactPhone; | |
| 50 | + | |
| 51 | + @Schema(description = "抢险开始时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 52 | + @ExcelProperty("抢险开始时间") | |
| 53 | + private LocalDateTime rescueStartTime; | |
| 54 | + | |
| 55 | + @Schema(description = "抢险中照片", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 56 | + //@ExcelProperty(value="抢险中照片", converter = ListToStringConverter.class) | |
| 57 | + @ExcelProperty(value = "抢险中照片", converter = ImageListConverter.class) | |
| 58 | + @ColumnWidth(70) | |
| 59 | + private List<String> emergencyImg; | |
| 60 | + | |
| 61 | + @Schema(description = "树种(如:国槐)") | |
| 62 | + @ExcelProperty("树种") | |
| 63 | + private String treeSpecies; | |
| 64 | + | |
| 65 | + @Schema(description = "树木规格") | |
| 66 | + @ExcelProperty("树木规格") | |
| 67 | + private String treeSpec; | |
| 68 | + | |
| 69 | + @Schema(description = "抢险完成时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 70 | + @ExcelProperty("抢险完成时间") | |
| 71 | + private LocalDateTime rescueCompleteTime; | |
| 72 | + | |
| 73 | + @Schema(description = "出动人员数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "3371") | |
| 74 | + @ExcelProperty("出动人员数量") | |
| 75 | + private Integer personnelCount; | |
| 76 | + | |
| 77 | + @Schema(description = "抢险结束照片", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 78 | + //@ExcelProperty(value="抢险结束照片", converter = ListToStringConverter.class) | |
| 79 | + @ExcelProperty(value = "抢险结束照片", converter = ImageListConverter.class) | |
| 80 | + @ColumnWidth(70) | |
| 81 | + private List<String> emergencyEndImg; | |
| 82 | + | |
| 83 | + @Schema(description = "备注") | |
| 84 | + @ExcelProperty("备注") | |
| 85 | + private String remarks; | |
| 86 | + | |
| 87 | + @Schema(description = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 88 | + @ExcelProperty("案件状态") | |
| 89 | + private String busiStatus; | |
| 90 | + | |
| 91 | + @Schema(description = "审批人", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 92 | + @ExcelProperty("审批人") | |
| 93 | + private String approvalUserName; | |
| 94 | + | |
| 95 | + @Schema(description = "审批备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "审批备注") | |
| 96 | + @ExcelProperty("审批备注") | |
| 97 | + private String approvalRemarks; | |
| 98 | + | |
| 99 | + | |
| 100 | + @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 101 | + @ExcelProperty("创建者") | |
| 102 | + private String creatorName; | |
| 103 | + | |
| 104 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 105 | + @ExcelProperty("创建时间") | |
| 106 | + private LocalDateTime createTime; | |
| 107 | + | |
| 108 | + @Schema(description = "更新者", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | |
| 109 | + @ExcelProperty("更新者") | |
| 110 | + private String updaterName; | |
| 111 | + | |
| 112 | + @ExcelProperty(value="机械信息", converter = ListToStringConverter.class) | |
| 113 | + private List<String> machineryInfo; | |
| 114 | + | |
| 115 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "20800") | |
| 116 | + @ExcelProperty("归属公司") | |
| 117 | + private String companyName; | |
| 118 | + | |
| 119 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyTaskPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | + | |
| 5 | +import java.time.LocalDate; | |
| 6 | +import java.util.*; | |
| 7 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 8 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 9 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 10 | +import java.time.LocalDateTime; | |
| 11 | + | |
| 12 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; | |
| 13 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 14 | + | |
| 15 | +@Schema(description = "管理后台 - 抢险任务主分页 Request VO") | |
| 16 | +@Data | |
| 17 | +public class EmergencyTaskPageReqVO extends PageParam { | |
| 18 | + | |
| 19 | + @Schema(description = "任务编号(唯一标识,如生成规则:TASK+时间戳)") | |
| 20 | + private String taskNo; | |
| 21 | + | |
| 22 | + @Schema(description = "险情类型(如:树木倒伏)", example = "5209") | |
| 23 | + private Integer emergencyTypeId; | |
| 24 | + | |
| 25 | + @Schema(description = "险情危害(如:无)", example = "16325") | |
| 26 | + private Integer emergencyHarmId; | |
| 27 | + | |
| 28 | + @Schema(description = "树木权属(如:专业权属)", example = "19498") | |
| 29 | + private Integer treeOwnershipId; | |
| 30 | + | |
| 31 | + @Schema(description = "险情地点") | |
| 32 | + private String emergencyLocation; | |
| 33 | + | |
| 34 | + @Schema(description = "抢险开始时间") | |
| 35 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) | |
| 36 | + private LocalDate startTime; | |
| 37 | + | |
| 38 | + @Schema(description = "抢险结束时间") | |
| 39 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) | |
| 40 | + private LocalDate endTime; | |
| 41 | + | |
| 42 | + | |
| 43 | + @Schema(description = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结", example = "1") | |
| 44 | + private Integer busiStatus; | |
| 45 | + | |
| 46 | + @Schema(description = "归属(一级部门id)", example = "6353") | |
| 47 | + private Long companyId; | |
| 48 | + | |
| 49 | + | |
| 50 | + private List<Integer> busiStatusList; | |
| 51 | + | |
| 52 | +} | |
| 0 | 53 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyTaskRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo; | |
| 2 | + | |
| 3 | +import com.zteits.urbanops.framework.excel.core.convert.ListToStringConverter; | |
| 4 | +import com.zteits.urbanops.module.garden.dal.dataobject.emergencytask.EmergencyMachineryDO; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import lombok.*; | |
| 7 | +import java.util.*; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | +import cn.idev.excel.annotation.*; | |
| 10 | + | |
| 11 | +@Schema(description = "管理后台 - 抢险任务主 Response VO") | |
| 12 | +@Data | |
| 13 | +@ExcelIgnoreUnannotated | |
| 14 | +public class EmergencyTaskRespVO { | |
| 15 | + | |
| 16 | + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10092") | |
| 17 | + @ExcelProperty("主键ID") | |
| 18 | + private Long id; | |
| 19 | + | |
| 20 | + @Schema(description = "任务编号(唯一标识,如生成规则:TASK+时间戳)", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 21 | + @ExcelProperty("任务编号(唯一标识,如生成规则:TASK+时间戳)") | |
| 22 | + private String taskNo; | |
| 23 | + | |
| 24 | + @Schema(description = "发现险情时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 25 | + @ExcelProperty("发现险情时间") | |
| 26 | + private LocalDateTime discoveryTime; | |
| 27 | + | |
| 28 | + @Schema(description = "险情类型(如:树木倒伏)", requiredMode = Schema.RequiredMode.REQUIRED, example = "5209") | |
| 29 | + @ExcelProperty("险情类型:1:树木倒伏 2:树木折枝") | |
| 30 | + private Integer emergencyTypeId; | |
| 31 | + | |
| 32 | + @Schema(description = "险情危害(如:无)", requiredMode = Schema.RequiredMode.REQUIRED, example = "16325") | |
| 33 | + @ExcelProperty("险情危害(如:无)") | |
| 34 | + private Integer emergencyHarmId; | |
| 35 | + | |
| 36 | + @Schema(description = "树木权属(如:专业权属)", requiredMode = Schema.RequiredMode.REQUIRED, example = "19498") | |
| 37 | + @ExcelProperty("树木权属 1:砸车 2:砸房 3:砸人 4:无") | |
| 38 | + private Integer treeOwnershipId; | |
| 39 | + | |
| 40 | + @Schema(description = "险情地点", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 41 | + @ExcelProperty("险情地点") | |
| 42 | + private String emergencyLocation; | |
| 43 | + | |
| 44 | + @Schema(description = "上报人", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 45 | + @ExcelProperty("上报人") | |
| 46 | + private String reporter; | |
| 47 | + | |
| 48 | + @Schema(description = "联系电话", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 49 | + @ExcelProperty("联系电话") | |
| 50 | + private String contactPhone; | |
| 51 | + | |
| 52 | + @Schema(description = "抢险开始时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 53 | + @ExcelProperty("抢险开始时间") | |
| 54 | + private LocalDateTime rescueStartTime; | |
| 55 | + | |
| 56 | + @Schema(description = "抢险中照片", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 57 | + @ExcelProperty(value="抢险中照片", converter = ListToStringConverter.class) | |
| 58 | + private List<String> emergencyImg; | |
| 59 | + | |
| 60 | + @Schema(description = "树种(如:国槐)") | |
| 61 | + @ExcelProperty("树种(如:国槐)") | |
| 62 | + private String treeSpecies; | |
| 63 | + | |
| 64 | + @Schema(description = "树木规格(如:胸径20厘米)") | |
| 65 | + @ExcelProperty("树木规格(如:胸径20厘米)") | |
| 66 | + private String treeSpec; | |
| 67 | + | |
| 68 | + @Schema(description = "抢险完成时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 69 | + @ExcelProperty("抢险完成时间") | |
| 70 | + private LocalDateTime rescueCompleteTime; | |
| 71 | + | |
| 72 | + @Schema(description = "出动人员数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "3371") | |
| 73 | + @ExcelProperty("出动人员数量") | |
| 74 | + private Integer personnelCount; | |
| 75 | + | |
| 76 | + @Schema(description = "抢险结束照片", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 77 | + @ExcelProperty(value="抢险结束照片", converter = ListToStringConverter.class) | |
| 78 | + private List<String> emergencyEndImg; | |
| 79 | + | |
| 80 | + @Schema(description = "备注") | |
| 81 | + @ExcelProperty("备注") | |
| 82 | + private String remarks; | |
| 83 | + | |
| 84 | + @Schema(description = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 85 | + @ExcelProperty("案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结") | |
| 86 | + private Integer busiStatus; | |
| 87 | + | |
| 88 | + @Schema(description = "工作流审批状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 89 | + @ExcelProperty("工作流审批状态") | |
| 90 | + private Integer status; | |
| 91 | + | |
| 92 | + @Schema(description = "流程实例的编号", example = "30197") | |
| 93 | + @ExcelProperty("流程实例的编号") | |
| 94 | + private String processInstanceId; | |
| 95 | + | |
| 96 | + @Schema(description = "审批人ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20789") | |
| 97 | + @ExcelProperty("审批人ID") | |
| 98 | + private String approvalUserId; | |
| 99 | + | |
| 100 | + @Schema(description = "审批人", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 101 | + @ExcelProperty("审批人") | |
| 102 | + private String approvalUserName; | |
| 103 | + | |
| 104 | + @Schema(description = "审批备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "审批备注") | |
| 105 | + @ExcelProperty("审批备注") | |
| 106 | + private String approvalRemarks; | |
| 107 | + | |
| 108 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "6353") | |
| 109 | + @ExcelProperty("归属(一级部门id)") | |
| 110 | + private Long companyId; | |
| 111 | + | |
| 112 | + @Schema(description = "部门ID(道路负责部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "27559") | |
| 113 | + @ExcelProperty("部门ID(道路负责部门id)") | |
| 114 | + private Long deptId; | |
| 115 | + | |
| 116 | + @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 117 | + @ExcelProperty("创建者") | |
| 118 | + private String creatorName; | |
| 119 | + | |
| 120 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 121 | + @ExcelProperty("创建时间") | |
| 122 | + private LocalDateTime createTime; | |
| 123 | + | |
| 124 | + @Schema(description = "更新者", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | |
| 125 | + @ExcelProperty("更新者") | |
| 126 | + private String updaterName; | |
| 127 | + | |
| 128 | + @ExcelProperty(value="机械信息", converter = ListToStringConverter.class) | |
| 129 | + private List<EmergencyMachineryDO> emergencyMachineryList; | |
| 130 | + | |
| 131 | + @Schema(description = "归属(一级部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "20800") | |
| 132 | + @ExcelProperty("归属(一级部门id)") | |
| 133 | + private String companyName; | |
| 134 | + | |
| 135 | + @Schema(description = "部门(道路负责部门id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "12055") | |
| 136 | + @ExcelProperty("部门") | |
| 137 | + private String deptName; | |
| 138 | + | |
| 139 | +} | |
| 0 | 140 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/emergencytask/vo/EmergencyTaskSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.emergencytask.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import jakarta.validation.constraints.*; | |
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - 抢险任务主新增/修改 Request VO") | |
| 11 | +@Data | |
| 12 | +public class EmergencyTaskSaveReqVO { | |
| 13 | + | |
| 14 | + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30197") | |
| 15 | + private String taskNo; | |
| 16 | + | |
| 17 | + @Schema(description = "发现险情时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 18 | + @NotNull(message = "发现险情时间不能为空") | |
| 19 | + private LocalDateTime discoveryTime; | |
| 20 | + | |
| 21 | + @Schema(description = "险情类型(如:树木倒伏)", requiredMode = Schema.RequiredMode.REQUIRED, example = "5209") | |
| 22 | + @NotNull(message = "险情类型(如:树木倒伏)不能为空") | |
| 23 | + private Integer emergencyTypeId; | |
| 24 | + | |
| 25 | + @Schema(description = "险情危害(如:无)", requiredMode = Schema.RequiredMode.REQUIRED, example = "16325") | |
| 26 | + @NotNull(message = "险情危害(如:无)不能为空") | |
| 27 | + private Integer emergencyHarmId; | |
| 28 | + | |
| 29 | + @Schema(description = "树木权属(如:专业权属)", requiredMode = Schema.RequiredMode.REQUIRED, example = "19498") | |
| 30 | + @NotNull(message = "树木权属(如:专业权属)不能为空") | |
| 31 | + private Integer treeOwnershipId; | |
| 32 | + | |
| 33 | + @Schema(description = "险情地点", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 34 | + @NotEmpty(message = "险情地点不能为空") | |
| 35 | + @Size(max = 100, message = "险情地点长度不能超过 100 个字符") | |
| 36 | + private String emergencyLocation; | |
| 37 | + | |
| 38 | + @Schema(description = "上报人", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 39 | + private String reporter; | |
| 40 | + | |
| 41 | + @Schema(description = "联系电话", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 42 | + @NotEmpty(message = "联系电话不能为空") | |
| 43 | + @Pattern(regexp = "^1[3-9]\\d{9}$", message = "联系电话格式不正确,应为 11 位手机号") | |
| 44 | + private String contactPhone; | |
| 45 | + | |
| 46 | + @Schema(description = "抢险开始时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 47 | + @NotNull(message = "抢险开始时间不能为空") | |
| 48 | + private LocalDateTime rescueStartTime; | |
| 49 | + | |
| 50 | + @Schema(description = "抢险中照片", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 51 | + @NotNull(message = "抢险中照片不能为空") | |
| 52 | + @Size(min = 1, message = "抢险中照片最少1张") | |
| 53 | + private List<String> emergencyImg; | |
| 54 | + | |
| 55 | + @Schema(description = "树种(如:国槐)") | |
| 56 | + @Size(max = 100, message = "险情地点长度不能超过 255 个字符") | |
| 57 | + private String treeSpecies; | |
| 58 | + | |
| 59 | + @Schema(description = "树木规格(如:胸径20厘米)") | |
| 60 | + @Size(max = 100, message = "树木规格100个字符") | |
| 61 | + private String treeSpec; | |
| 62 | + | |
| 63 | + @Schema(description = "抢险完成时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 64 | + @NotNull(message = "抢险完成时间不能为空") | |
| 65 | + private LocalDateTime rescueCompleteTime; | |
| 66 | + | |
| 67 | + @Schema(description = "出动人员数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "3371") | |
| 68 | + @NotNull(message = "出动人员数量不能为空") | |
| 69 | + private Integer personnelCount; | |
| 70 | + | |
| 71 | + @Schema(description = "抢险结束照片", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 72 | + private List<String> emergencyEndImg; | |
| 73 | + | |
| 74 | + @Schema(description = "备注") | |
| 75 | + private String remarks; | |
| 76 | + | |
| 77 | + @Schema(description = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 78 | + @NotNull(message = "案件状态 1-待提交 2-待审核 3-驳回 4-关闭;5-完结不能为空") | |
| 79 | + private Integer busiStatus; | |
| 80 | + | |
| 81 | + @Schema(description = "工作流审批状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 82 | + @NotNull(message = "工作流审批状态不能为空") | |
| 83 | + private Integer status; | |
| 84 | + | |
| 85 | + @Schema(description = "流程实例的编号", example = "30197") | |
| 86 | + private String processInstanceId; | |
| 87 | + | |
| 88 | + @Schema(description = "审批人ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20789") | |
| 89 | + @NotEmpty(message = "审批人ID不能为空") | |
| 90 | + private String approvalUserId; | |
| 91 | + | |
| 92 | + @Schema(description = "审批人", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 93 | + @NotEmpty(message = "审批人不能为空") | |
| 94 | + private String approvalUserName; | |
| 95 | + | |
| 96 | + @Schema(description = "使用机械", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 97 | + private List<EmergencyMachinerySaveReqVO> emergencyMachineryList; | |
| 98 | + | |
| 99 | +} | |
| 0 | 100 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/homepage/vo/CommitTaskStatisticsRespVo.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/homepage/vo/WorkOrderTrendRespVo.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/InspectionPlanCommitController.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.inspectionplan; |
| 2 | 2 | |
| 3 | +import com.zteits.urbanops.framework.common.biz.system.permission.dto.DeptDataPermissionRespDTO; | |
| 4 | +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; | |
| 5 | +import com.zteits.urbanops.module.system.api.permission.PermissionApi; | |
| 3 | 6 | import org.springframework.web.bind.annotation.*; |
| 4 | 7 | import jakarta.annotation.Resource; |
| 5 | 8 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -37,6 +40,9 @@ public class InspectionPlanCommitController { |
| 37 | 40 | @Resource |
| 38 | 41 | private InspectionPlanCommitService inspectionPlanCommitService; |
| 39 | 42 | |
| 43 | + @Resource | |
| 44 | + private PermissionApi permissionApi; | |
| 45 | + | |
| 40 | 46 | @PostMapping("/create") |
| 41 | 47 | @Operation(summary = "创建巡检计划提交明细") |
| 42 | 48 | @PreAuthorize("@ss.hasPermission('garden:inspection-plan-commit:create')") |
| ... | ... | @@ -83,6 +89,9 @@ public class InspectionPlanCommitController { |
| 83 | 89 | @Operation(summary = "获得巡检计划提交明细分页") |
| 84 | 90 | @PreAuthorize("@ss.hasPermission('garden:inspection-plan-commit:query')") |
| 85 | 91 | public CommonResult<PageResult<InspectionPlanCommitRespVO>> getInspectionPlanCommitPage(@Valid InspectionPlanCommitPageReqVO pageReqVO) { |
| 92 | + //获取登录人权限 | |
| 93 | + DeptDataPermissionRespDTO deptDataPermission = permissionApi.getDeptDataPermission(SecurityFrameworkUtils.getLoginUserId()); | |
| 94 | + pageReqVO.setDeptIds(deptDataPermission.getDeptIds()); | |
| 86 | 95 | PageResult<InspectionPlanCommitRespVO> pageResult = inspectionPlanCommitService.getInspectionPlanCommitPage(pageReqVO); |
| 87 | 96 | return success(BeanUtils.toBean(pageResult, InspectionPlanCommitRespVO.class)); |
| 88 | 97 | } |
| ... | ... | @@ -100,4 +109,4 @@ public class InspectionPlanCommitController { |
| 100 | 109 | BeanUtils.toBean(list, InspectionPlanCommitRespVO.class)); |
| 101 | 110 | } |
| 102 | 111 | |
| 103 | -} | |
| 104 | 112 | \ No newline at end of file |
| 113 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/InspectionPlanController.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.inspectionplan; |
| 2 | 2 | |
| 3 | 3 | import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; |
| 4 | +import com.zteits.urbanops.framework.common.biz.system.permission.dto.DeptDataPermissionRespDTO; | |
| 4 | 5 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 5 | 6 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 6 | 7 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 7 | 8 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 9 | +import com.zteits.urbanops.framework.datapermission.core.annotation.DataPermission; | |
| 8 | 10 | import com.zteits.urbanops.framework.datapermission.core.util.DataPermissionUtils; |
| 9 | 11 | import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; |
| 10 | 12 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; |
| ... | ... | @@ -40,6 +42,7 @@ import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.PLAN_RA |
| 40 | 42 | @RequestMapping("/garden/inspection-plan") |
| 41 | 43 | @Validated |
| 42 | 44 | @Slf4j |
| 45 | +@DataPermission(enable = false) | |
| 43 | 46 | public class InspectionPlanController { |
| 44 | 47 | |
| 45 | 48 | @Resource |
| ... | ... | @@ -123,14 +126,22 @@ public class InspectionPlanController { |
| 123 | 126 | @Operation(summary = "获得巡检计划汇总分页") |
| 124 | 127 | @PreAuthorize("@ss.hasPermission('garden:inspection-plan:query')") |
| 125 | 128 | public CommonResult<PageResult<InspectionPlanRespVO>> getInspectionPlanPage(@Valid InspectionPlanPageReqVO pageReqVO) { |
| 126 | - Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); | |
| 127 | - if(pageReqVO.getCompanyId() == null){ | |
| 128 | - if(permissionApi.hasAnyRoles(loginUserId, "super_admin")){ | |
| 129 | - pageReqVO.setCompanyId( null); | |
| 130 | - }else{ | |
| 131 | - pageReqVO.setCompanyId(SecurityFrameworkUtils.getCompanyId()); | |
| 132 | - } | |
| 133 | - } | |
| 129 | +// Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); | |
| 130 | +// if(pageReqVO.getCompanyId() == null){ | |
| 131 | +// if(permissionApi.hasAnyRoles(loginUserId, "super_admin")){ | |
| 132 | +// pageReqVO.setCompanyId( null); | |
| 133 | +// }else{ | |
| 134 | +// Long companyId = SecurityFrameworkUtils.getCompanyId(); | |
| 135 | +// if(null == companyId || companyId == 0L || companyId == 100L){ | |
| 136 | +// companyId = null; | |
| 137 | +// } | |
| 138 | +// pageReqVO.setCompanyId(companyId); | |
| 139 | +// } | |
| 140 | +// } | |
| 141 | + | |
| 142 | + //获取登录人权限 | |
| 143 | + DeptDataPermissionRespDTO deptDataPermission = permissionApi.getDeptDataPermission(SecurityFrameworkUtils.getLoginUserId()); | |
| 144 | + pageReqVO.setDeptIds(deptDataPermission.getDeptIds()); | |
| 134 | 145 | PageResult<InspectionPlanRespVO> pageResult = inspectionPlanService.getInspectionPlanPage(pageReqVO); |
| 135 | 146 | return success(pageResult); |
| 136 | 147 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanCommitPageReqVO.java
| ... | ... | @@ -4,6 +4,7 @@ import lombok.*; |
| 4 | 4 | |
| 5 | 5 | import java.time.LocalDate; |
| 6 | 6 | import java.util.List; |
| 7 | +import java.util.Set; | |
| 7 | 8 | |
| 8 | 9 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | 10 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| ... | ... | @@ -71,4 +72,6 @@ public class InspectionPlanCommitPageReqVO extends PageParam { |
| 71 | 72 | @Schema(description = "创建结束时间") |
| 72 | 73 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) |
| 73 | 74 | private LocalDate createTimeEnd; |
| 74 | -} | |
| 75 | 75 | \ No newline at end of file |
| 76 | + | |
| 77 | + private Set<Long> deptIds; | |
| 78 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/vo/InspectionPlanPageReqVO.java
| ... | ... | @@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | 5 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 6 | 6 | import org.springframework.format.annotation.DateTimeFormat; |
| 7 | 7 | import java.time.LocalDateTime; |
| 8 | +import java.util.Set; | |
| 8 | 9 | |
| 9 | 10 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 10 | 11 | |
| ... | ... | @@ -52,4 +53,5 @@ public class InspectionPlanPageReqVO extends PageParam { |
| 52 | 53 | @Schema(description = "完成状态 : 1:未完成;2:已完成") |
| 53 | 54 | private Integer finishState; |
| 54 | 55 | |
| 55 | -} | |
| 56 | 56 | \ No newline at end of file |
| 57 | + private Set<Long> deptIds; | |
| 58 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/MaintainPlanCommitController.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.maintainplan; |
| 2 | 2 | |
| 3 | +import com.zteits.urbanops.framework.common.biz.system.permission.dto.DeptDataPermissionRespDTO; | |
| 4 | +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; | |
| 5 | +import com.zteits.urbanops.module.system.api.permission.PermissionApi; | |
| 3 | 6 | import org.springframework.web.bind.annotation.*; |
| 4 | 7 | import jakarta.annotation.Resource; |
| 5 | 8 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -37,6 +40,10 @@ public class MaintainPlanCommitController { |
| 37 | 40 | @Resource |
| 38 | 41 | private MaintainPlanCommitService maintainPlanCommitService; |
| 39 | 42 | |
| 43 | + @Resource | |
| 44 | + private PermissionApi permissionApi; | |
| 45 | + | |
| 46 | + | |
| 40 | 47 | @PostMapping("/create") |
| 41 | 48 | @Operation(summary = "创建养护计划明细") |
| 42 | 49 | @PreAuthorize("@ss.hasPermission('garden:maintain-plan-commit:create')") |
| ... | ... | @@ -92,6 +99,9 @@ public class MaintainPlanCommitController { |
| 92 | 99 | @Operation(summary = "获得养护计划明细分页") |
| 93 | 100 | @PreAuthorize("@ss.hasPermission('garden:maintain-plan-commit:query')") |
| 94 | 101 | public CommonResult<PageResult<MaintainPlanCommitRespVO>> getMaintainPlanCommitPage(@Valid MaintainPlanCommitPageReqVO pageReqVO) { |
| 102 | + //获取登录人权限 | |
| 103 | + DeptDataPermissionRespDTO deptDataPermission = permissionApi.getDeptDataPermission(SecurityFrameworkUtils.getLoginUserId()); | |
| 104 | + pageReqVO.setDeptIds(deptDataPermission.getDeptIds()); | |
| 95 | 105 | PageResult<MaintainPlanCommitRespVO> pageResult = maintainPlanCommitService.getMaintainPlanCommitPage(pageReqVO); |
| 96 | 106 | return success(pageResult); |
| 97 | 107 | } |
| ... | ... | @@ -109,4 +119,4 @@ public class MaintainPlanCommitController { |
| 109 | 119 | BeanUtils.toBean(list, MaintainPlanCommitRespVO.class)); |
| 110 | 120 | } |
| 111 | 121 | |
| 112 | -} | |
| 113 | 122 | \ No newline at end of file |
| 123 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/MaintainPlanController.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.maintainplan; |
| 2 | 2 | |
| 3 | 3 | import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; |
| 4 | +import com.zteits.urbanops.framework.common.biz.system.permission.dto.DeptDataPermissionRespDTO; | |
| 4 | 5 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 5 | 6 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 6 | 7 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 7 | 8 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 9 | +import com.zteits.urbanops.framework.datapermission.core.annotation.DataPermission; | |
| 8 | 10 | import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; |
| 9 | 11 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; |
| 10 | 12 | import com.zteits.urbanops.module.garden.controller.admin.maintainplan.vo.MaintainPlanPageReqVO; |
| ... | ... | @@ -39,6 +41,7 @@ import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.PLAN_RA |
| 39 | 41 | @RequestMapping("/garden/maintain-plan") |
| 40 | 42 | @Validated |
| 41 | 43 | @Slf4j |
| 44 | +@DataPermission(enable = false) | |
| 42 | 45 | public class MaintainPlanController { |
| 43 | 46 | |
| 44 | 47 | @Resource |
| ... | ... | @@ -122,14 +125,21 @@ public class MaintainPlanController { |
| 122 | 125 | @Operation(summary = "获得养护计划汇总分页") |
| 123 | 126 | @PreAuthorize("@ss.hasPermission('garden:maintain-plan:query')") |
| 124 | 127 | public CommonResult<PageResult<MaintainPlanRespVO>> getMaintainPlanPage(@Valid MaintainPlanPageReqVO pageReqVO) { |
| 125 | - if(pageReqVO.getCompanyId() == null){ | |
| 126 | - Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); | |
| 127 | - if(permissionApi.hasAnyRoles(loginUserId, "super_admin")){ | |
| 128 | - pageReqVO.setCompanyId( null); | |
| 129 | - }else{ | |
| 130 | - pageReqVO.setCompanyId(SecurityFrameworkUtils.getCompanyId()); | |
| 131 | - } | |
| 132 | - } | |
| 128 | +// if(pageReqVO.getCompanyId() == null){ | |
| 129 | +// Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); | |
| 130 | +// if(permissionApi.hasAnyRoles(loginUserId, "super_admin")){ | |
| 131 | +// pageReqVO.setCompanyId( null); | |
| 132 | +// }else{ | |
| 133 | +// Long companyId = SecurityFrameworkUtils.getCompanyId(); | |
| 134 | +// if(null == companyId || companyId == 0L || companyId == 100L){ | |
| 135 | +// companyId = null; | |
| 136 | +// } | |
| 137 | +// pageReqVO.setCompanyId(companyId); | |
| 138 | +// } | |
| 139 | +// } | |
| 140 | + //获取登录人权限 | |
| 141 | + DeptDataPermissionRespDTO deptDataPermission = permissionApi.getDeptDataPermission(SecurityFrameworkUtils.getLoginUserId()); | |
| 142 | + pageReqVO.setDeptIds(deptDataPermission.getDeptIds()); | |
| 133 | 143 | PageResult<MaintainPlanRespVO> pageResult = maintainPlanService.getMaintainPlanPage(pageReqVO); |
| 134 | 144 | return success(pageResult); |
| 135 | 145 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/vo/MaintainPlanCommitPageReqVO.java
| ... | ... | @@ -7,6 +7,7 @@ import io.swagger.v3.oas.annotations.media.Schema; |
| 7 | 7 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 8 | 8 | import org.springframework.format.annotation.DateTimeFormat; |
| 9 | 9 | import java.util.List; |
| 10 | +import java.util.Set; | |
| 10 | 11 | |
| 11 | 12 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; |
| 12 | 13 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| ... | ... | @@ -68,4 +69,5 @@ public class MaintainPlanCommitPageReqVO extends PageParam { |
| 68 | 69 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) |
| 69 | 70 | private LocalDate createTimeEnd; |
| 70 | 71 | |
| 72 | + private Set<Long> deptIds; | |
| 71 | 73 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/vo/MaintainPlanPageReqVO.java
| ... | ... | @@ -7,6 +7,7 @@ import io.swagger.v3.oas.annotations.media.Schema; |
| 7 | 7 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 8 | 8 | import org.springframework.format.annotation.DateTimeFormat; |
| 9 | 9 | import java.time.LocalDateTime; |
| 10 | +import java.util.Set; | |
| 10 | 11 | |
| 11 | 12 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 12 | 13 | |
| ... | ... | @@ -53,4 +54,6 @@ public class MaintainPlanPageReqVO extends PageParam { |
| 53 | 54 | @Schema(description = "完成状态 : 1:未完成;2:已完成") |
| 54 | 55 | private Integer finishState; |
| 55 | 56 | |
| 56 | -} | |
| 57 | 57 | \ No newline at end of file |
| 58 | + private Set<Long> deptIds; | |
| 59 | + | |
| 60 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/material/vo/MaterialSaveReqVO.java
| ... | ... | @@ -69,7 +69,6 @@ public class MaterialSaveReqVO { |
| 69 | 69 | private String unitName; |
| 70 | 70 | |
| 71 | 71 | @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便") |
| 72 | - @NotEmpty(message = "备注不能为空") | |
| 73 | 72 | private String remark; |
| 74 | 73 | |
| 75 | 74 | @Schema(description = "是否关联工单:0-否,1-是") | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialinventory/vo/MaterialInventoryPageReqVO.java
| ... | ... | @@ -71,4 +71,6 @@ public class MaterialInventoryPageReqVO extends PageParam { |
| 71 | 71 | @Schema(description = "部门ID", example = "11349") |
| 72 | 72 | private Long deptId; |
| 73 | 73 | |
| 74 | -} | |
| 75 | 74 | \ No newline at end of file |
| 75 | + @Schema(description = "出库查询", example = "0") | |
| 76 | + private Integer outInventoryQuery; | |
| 77 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialinventoryout/vo/MaterialInventoryOutSaveReqVO.java
| ... | ... | @@ -13,6 +13,9 @@ public class MaterialInventoryOutSaveReqVO { |
| 13 | 13 | |
| 14 | 14 | @Schema(description = "入库ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18713") |
| 15 | 15 | private Long id; |
| 16 | + @Schema(description = "库存ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 17 | + @NotNull(message = "库存ID不能为空") | |
| 18 | + private Long inventoryId; | |
| 16 | 19 | |
| 17 | 20 | @Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14541") |
| 18 | 21 | @NotNull(message = "物料ID不能为空") | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialname/MaterialNameController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialname; | |
| 2 | + | |
| 3 | +import org.springframework.web.bind.annotation.*; | |
| 4 | +import jakarta.annotation.Resource; | |
| 5 | +import org.springframework.validation.annotation.Validated; | |
| 6 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 7 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 8 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 9 | +import io.swagger.v3.oas.annotations.Operation; | |
| 10 | + | |
| 11 | +import jakarta.validation.constraints.*; | |
| 12 | +import jakarta.validation.*; | |
| 13 | +import jakarta.servlet.http.*; | |
| 14 | +import java.util.*; | |
| 15 | +import java.io.IOException; | |
| 16 | + | |
| 17 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 18 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 19 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 20 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 21 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 22 | + | |
| 23 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | |
| 24 | + | |
| 25 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 26 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | |
| 27 | + | |
| 28 | +import com.zteits.urbanops.module.garden.controller.admin.materialname.vo.*; | |
| 29 | +import com.zteits.urbanops.module.garden.dal.dataobject.materialname.MaterialNameDO; | |
| 30 | +import com.zteits.urbanops.module.garden.service.materialname.MaterialNameService; | |
| 31 | + | |
| 32 | +@Tag(name = "管理后台 - 物料名称") | |
| 33 | +@RestController | |
| 34 | +@RequestMapping("/garden/material-name") | |
| 35 | +@Validated | |
| 36 | +public class MaterialNameController { | |
| 37 | + | |
| 38 | + @Resource | |
| 39 | + private MaterialNameService materialNameService; | |
| 40 | + | |
| 41 | + @PostMapping("/create") | |
| 42 | + @Operation(summary = "创建物料名称") | |
| 43 | + @PreAuthorize("@ss.hasPermission('garden:material-name:create')") | |
| 44 | + public CommonResult<Long> createMaterialName(@Valid @RequestBody MaterialNameSaveReqVO createReqVO) { | |
| 45 | + return success(materialNameService.createMaterialName(createReqVO)); | |
| 46 | + } | |
| 47 | + | |
| 48 | + @PutMapping("/update") | |
| 49 | + @Operation(summary = "更新物料名称") | |
| 50 | + @PreAuthorize("@ss.hasPermission('garden:material-name:update')") | |
| 51 | + public CommonResult<Boolean> updateMaterialName(@Valid @RequestBody MaterialNameSaveReqVO updateReqVO) { | |
| 52 | + materialNameService.updateMaterialName(updateReqVO); | |
| 53 | + return success(true); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @DeleteMapping("/delete") | |
| 57 | + @Operation(summary = "删除物料名称") | |
| 58 | + @Parameter(name = "id", description = "编号", required = true) | |
| 59 | + @PreAuthorize("@ss.hasPermission('garden:material-name:delete')") | |
| 60 | + public CommonResult<Boolean> deleteMaterialName(@RequestParam("id") Long id) { | |
| 61 | + materialNameService.deleteMaterialName(id); | |
| 62 | + return success(true); | |
| 63 | + } | |
| 64 | + | |
| 65 | + @DeleteMapping("/delete-list") | |
| 66 | + @Parameter(name = "ids", description = "编号", required = true) | |
| 67 | + @Operation(summary = "批量删除物料名称") | |
| 68 | + @PreAuthorize("@ss.hasPermission('garden:material-name:delete')") | |
| 69 | + public CommonResult<Boolean> deleteMaterialNameList(@RequestParam("ids") List<Long> ids) { | |
| 70 | + materialNameService.deleteMaterialNameListByIds(ids); | |
| 71 | + return success(true); | |
| 72 | + } | |
| 73 | + | |
| 74 | + @GetMapping("/get") | |
| 75 | + @Operation(summary = "获得物料名称") | |
| 76 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 77 | + @PreAuthorize("@ss.hasPermission('garden:material-name:query')") | |
| 78 | + public CommonResult<MaterialNameRespVO> getMaterialName(@RequestParam("id") Long id) { | |
| 79 | + MaterialNameDO materialName = materialNameService.getMaterialName(id); | |
| 80 | + return success(BeanUtils.toBean(materialName, MaterialNameRespVO.class)); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @GetMapping("/page") | |
| 84 | + @Operation(summary = "获得物料名称分页") | |
| 85 | + @PreAuthorize("@ss.hasPermission('garden:material-name:query')") | |
| 86 | + public CommonResult<PageResult<MaterialNameRespVO>> getMaterialNamePage(@Valid MaterialNamePageReqVO pageReqVO) { | |
| 87 | + PageResult<MaterialNameDO> pageResult = materialNameService.getMaterialNamePage(pageReqVO); | |
| 88 | + return success(BeanUtils.toBean(pageResult, MaterialNameRespVO.class)); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @GetMapping("/list") | |
| 92 | + @Operation(summary = "获得物料名称列表(支持模糊搜索)") | |
| 93 | + @PreAuthorize("@ss.hasPermission('garden:material-name:query')") | |
| 94 | + public CommonResult<List<MaterialNameRespVO>> getMaterialNameList( | |
| 95 | + @RequestParam(value = "materialName", required = false) String materialName) { | |
| 96 | + // 构建查询条件 | |
| 97 | + MaterialNamePageReqVO pageReqVO = new MaterialNamePageReqVO(); | |
| 98 | + pageReqVO.setMaterialName(materialName); | |
| 99 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 100 | + | |
| 101 | + // 查询数据 | |
| 102 | + List<MaterialNameDO> list = materialNameService.getMaterialNamePage(pageReqVO).getList(); | |
| 103 | + return success(BeanUtils.toBean(list, MaterialNameRespVO.class)); | |
| 104 | + } | |
| 105 | + | |
| 106 | + @GetMapping("/export-excel") | |
| 107 | + @Operation(summary = "导出物料名称 Excel") | |
| 108 | + @PreAuthorize("@ss.hasPermission('garden:material-name:export')") | |
| 109 | + @ApiAccessLog(operateType = EXPORT) | |
| 110 | + public void exportMaterialNameExcel(@Valid MaterialNamePageReqVO pageReqVO, | |
| 111 | + HttpServletResponse response) throws IOException { | |
| 112 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 113 | + List<MaterialNameDO> list = materialNameService.getMaterialNamePage(pageReqVO).getList(); | |
| 114 | + // 导出 Excel | |
| 115 | + ExcelUtils.write(response, "物料名称.xls", "数据", MaterialNameRespVO.class, | |
| 116 | + BeanUtils.toBean(list, MaterialNameRespVO.class)); | |
| 117 | + } | |
| 118 | + | |
| 119 | +} | |
| 0 | 120 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialname/vo/MaterialNamePageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialname.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - 物料名称分页 Request VO") | |
| 13 | +@Data | |
| 14 | +public class MaterialNamePageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @Schema(description = "物料名称ID", example = "14631") | |
| 17 | + private Long materialId; | |
| 18 | + | |
| 19 | + @Schema(description = "物料名称", example = "张三") | |
| 20 | + private String materialName; | |
| 21 | + | |
| 22 | + @Schema(description = "备注", example = "你猜") | |
| 23 | + private String remark; | |
| 24 | + | |
| 25 | + @Schema(description = "创建时间") | |
| 26 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 27 | + private LocalDateTime[] createTime; | |
| 28 | + | |
| 29 | + @Schema(description = "部门ID", example = "23084") | |
| 30 | + private Long deptId; | |
| 31 | + | |
| 32 | +} | |
| 0 | 33 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialname/vo/MaterialNameRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialname.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | +import cn.idev.excel.annotation.*; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - 物料名称 Response VO") | |
| 11 | +@Data | |
| 12 | +@ExcelIgnoreUnannotated | |
| 13 | +public class MaterialNameRespVO { | |
| 14 | + | |
| 15 | + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32592") | |
| 16 | + @ExcelProperty("自增主键") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "物料名称ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14631") | |
| 20 | + @ExcelProperty("物料名称ID") | |
| 21 | + private Long materialId; | |
| 22 | + | |
| 23 | + @Schema(description = "物料名称", example = "张三") | |
| 24 | + @ExcelProperty("物料名称") | |
| 25 | + private String materialName; | |
| 26 | + | |
| 27 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") | |
| 28 | + @ExcelProperty("备注") | |
| 29 | + private String remark; | |
| 30 | + | |
| 31 | + @Schema(description = "创建时间") | |
| 32 | + @ExcelProperty("创建时间") | |
| 33 | + private LocalDateTime createTime; | |
| 34 | + | |
| 35 | + @Schema(description = "部门ID", example = "23084") | |
| 36 | + @ExcelProperty("部门ID") | |
| 37 | + private Long deptId; | |
| 38 | + | |
| 39 | +} | |
| 0 | 40 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialname/vo/MaterialNameSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialname.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import jakarta.validation.constraints.*; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - 物料名称新增/修改 Request VO") | |
| 9 | +@Data | |
| 10 | +public class MaterialNameSaveReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32592") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "物料名称ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14631") | |
| 16 | + private Long materialId; | |
| 17 | + | |
| 18 | + @NotEmpty(message = "物料名称不能为空") | |
| 19 | + @Schema(description = "物料名称", example = "张三") | |
| 20 | + private String materialName; | |
| 21 | + | |
| 22 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") | |
| 23 | + private String remark; | |
| 24 | + | |
| 25 | + @Schema(description = "部门ID", example = "23084") | |
| 26 | + private Long deptId; | |
| 27 | + | |
| 28 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialspecification/MaterialSpecificationController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialspecification; | |
| 2 | + | |
| 3 | +import org.springframework.web.bind.annotation.*; | |
| 4 | +import jakarta.annotation.Resource; | |
| 5 | +import org.springframework.validation.annotation.Validated; | |
| 6 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 7 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 8 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 9 | +import io.swagger.v3.oas.annotations.Operation; | |
| 10 | + | |
| 11 | +import jakarta.validation.constraints.*; | |
| 12 | +import jakarta.validation.*; | |
| 13 | +import jakarta.servlet.http.*; | |
| 14 | +import java.util.*; | |
| 15 | +import java.io.IOException; | |
| 16 | + | |
| 17 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 18 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 19 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 20 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 21 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 22 | + | |
| 23 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | |
| 24 | + | |
| 25 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 26 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | |
| 27 | + | |
| 28 | +import com.zteits.urbanops.module.garden.controller.admin.materialspecification.vo.*; | |
| 29 | +import com.zteits.urbanops.module.garden.dal.dataobject.materialspecification.MaterialSpecificationDO; | |
| 30 | +import com.zteits.urbanops.module.garden.service.materialspecification.MaterialSpecificationService; | |
| 31 | + | |
| 32 | +@Tag(name = "管理后台 - 物料规格") | |
| 33 | +@RestController | |
| 34 | +@RequestMapping("/garden/material-specification") | |
| 35 | +@Validated | |
| 36 | +public class MaterialSpecificationController { | |
| 37 | + | |
| 38 | + @Resource | |
| 39 | + private MaterialSpecificationService materialSpecificationService; | |
| 40 | + | |
| 41 | + @PostMapping("/create") | |
| 42 | + @Operation(summary = "创建物料规格") | |
| 43 | + @PreAuthorize("@ss.hasPermission('garden:material-specification:create')") | |
| 44 | + public CommonResult<Long> createMaterialSpecification(@Valid @RequestBody MaterialSpecificationSaveReqVO createReqVO) { | |
| 45 | + return success(materialSpecificationService.createMaterialSpecification(createReqVO)); | |
| 46 | + } | |
| 47 | + | |
| 48 | + @PutMapping("/update") | |
| 49 | + @Operation(summary = "更新物料规格") | |
| 50 | + @PreAuthorize("@ss.hasPermission('garden:material-specification:update')") | |
| 51 | + public CommonResult<Boolean> updateMaterialSpecification(@Valid @RequestBody MaterialSpecificationSaveReqVO updateReqVO) { | |
| 52 | + materialSpecificationService.updateMaterialSpecification(updateReqVO); | |
| 53 | + return success(true); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @DeleteMapping("/delete") | |
| 57 | + @Operation(summary = "删除物料规格") | |
| 58 | + @Parameter(name = "id", description = "编号", required = true) | |
| 59 | + @PreAuthorize("@ss.hasPermission('garden:material-specification:delete')") | |
| 60 | + public CommonResult<Boolean> deleteMaterialSpecification(@RequestParam("id") Long id) { | |
| 61 | + materialSpecificationService.deleteMaterialSpecification(id); | |
| 62 | + return success(true); | |
| 63 | + } | |
| 64 | + | |
| 65 | + @DeleteMapping("/delete-list") | |
| 66 | + @Parameter(name = "ids", description = "编号", required = true) | |
| 67 | + @Operation(summary = "批量删除物料规格") | |
| 68 | + @PreAuthorize("@ss.hasPermission('garden:material-specification:delete')") | |
| 69 | + public CommonResult<Boolean> deleteMaterialSpecificationList(@RequestParam("ids") List<Long> ids) { | |
| 70 | + materialSpecificationService.deleteMaterialSpecificationListByIds(ids); | |
| 71 | + return success(true); | |
| 72 | + } | |
| 73 | + | |
| 74 | + @GetMapping("/get") | |
| 75 | + @Operation(summary = "获得物料规格") | |
| 76 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 77 | + @PreAuthorize("@ss.hasPermission('garden:material-specification:query')") | |
| 78 | + public CommonResult<MaterialSpecificationRespVO> getMaterialSpecification(@RequestParam("id") Long id) { | |
| 79 | + MaterialSpecificationDO materialSpecification = materialSpecificationService.getMaterialSpecification(id); | |
| 80 | + return success(BeanUtils.toBean(materialSpecification, MaterialSpecificationRespVO.class)); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @GetMapping("/page") | |
| 84 | + @Operation(summary = "获得物料规格分页") | |
| 85 | + @PreAuthorize("@ss.hasPermission('garden:material-specification:query')") | |
| 86 | + public CommonResult<PageResult<MaterialSpecificationRespVO>> getMaterialSpecificationPage(@Valid MaterialSpecificationPageReqVO pageReqVO) { | |
| 87 | + PageResult<MaterialSpecificationDO> pageResult = materialSpecificationService.getMaterialSpecificationPage(pageReqVO); | |
| 88 | + return success(BeanUtils.toBean(pageResult, MaterialSpecificationRespVO.class)); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @GetMapping("/list") | |
| 92 | + @Operation(summary = "获得物料规格列表(支持模糊搜索)") | |
| 93 | + @PreAuthorize("@ss.hasPermission('garden:material-specification:query')") | |
| 94 | + public CommonResult<List<MaterialSpecificationRespVO>> getMaterialSpecificationList( | |
| 95 | + @RequestParam(value = "specifications", required = false) String specifications) { | |
| 96 | + // 构建查询条件 | |
| 97 | + MaterialSpecificationPageReqVO pageReqVO = new MaterialSpecificationPageReqVO(); | |
| 98 | + pageReqVO.setSpecifications(specifications); | |
| 99 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 100 | + | |
| 101 | + // 查询数据 | |
| 102 | + List<MaterialSpecificationDO> list = materialSpecificationService.getMaterialSpecificationPage(pageReqVO).getList(); | |
| 103 | + return success(BeanUtils.toBean(list, MaterialSpecificationRespVO.class)); | |
| 104 | + } | |
| 105 | + | |
| 106 | + @GetMapping("/export-excel") | |
| 107 | + @Operation(summary = "导出物料规格 Excel") | |
| 108 | + @PreAuthorize("@ss.hasPermission('garden:material-specification:export')") | |
| 109 | + @ApiAccessLog(operateType = EXPORT) | |
| 110 | + public void exportMaterialSpecificationExcel(@Valid MaterialSpecificationPageReqVO pageReqVO, | |
| 111 | + HttpServletResponse response) throws IOException { | |
| 112 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 113 | + List<MaterialSpecificationDO> list = materialSpecificationService.getMaterialSpecificationPage(pageReqVO).getList(); | |
| 114 | + // 导出 Excel | |
| 115 | + ExcelUtils.write(response, "物料规格.xls", "数据", MaterialSpecificationRespVO.class, | |
| 116 | + BeanUtils.toBean(list, MaterialSpecificationRespVO.class)); | |
| 117 | + } | |
| 118 | + | |
| 119 | +} | |
| 0 | 120 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialspecification/vo/MaterialSpecificationPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialspecification.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - 物料规格分页 Request VO") | |
| 13 | +@Data | |
| 14 | +public class MaterialSpecificationPageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @Schema(description = "规格编码") | |
| 17 | + private String specCode; | |
| 18 | + | |
| 19 | + @Schema(description = "规格名称") | |
| 20 | + private String specifications; | |
| 21 | + | |
| 22 | + @Schema(description = "备注", example = "你猜") | |
| 23 | + private String remark; | |
| 24 | + | |
| 25 | + @Schema(description = "创建时间") | |
| 26 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 27 | + private LocalDateTime[] createTime; | |
| 28 | + | |
| 29 | + @Schema(description = "部门ID", example = "18158") | |
| 30 | + private Long deptId; | |
| 31 | + | |
| 32 | +} | |
| 0 | 33 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialspecification/vo/MaterialSpecificationRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialspecification.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | +import cn.idev.excel.annotation.*; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - 物料规格 Response VO") | |
| 11 | +@Data | |
| 12 | +@ExcelIgnoreUnannotated | |
| 13 | +public class MaterialSpecificationRespVO { | |
| 14 | + | |
| 15 | + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "15081") | |
| 16 | + @ExcelProperty("自增主键") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "规格编码") | |
| 20 | + @ExcelProperty("规格编码") | |
| 21 | + private String specCode; | |
| 22 | + | |
| 23 | + @Schema(description = "规格名称", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 24 | + @ExcelProperty("规格名称") | |
| 25 | + private String specifications; | |
| 26 | + | |
| 27 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") | |
| 28 | + @ExcelProperty("备注") | |
| 29 | + private String remark; | |
| 30 | + | |
| 31 | + @Schema(description = "创建时间") | |
| 32 | + @ExcelProperty("创建时间") | |
| 33 | + private LocalDateTime createTime; | |
| 34 | + | |
| 35 | + @Schema(description = "部门ID", example = "18158") | |
| 36 | + @ExcelProperty("部门ID") | |
| 37 | + private Long deptId; | |
| 38 | + | |
| 39 | +} | |
| 0 | 40 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialspecification/vo/MaterialSpecificationSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialspecification.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import jakarta.validation.constraints.*; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - 物料规格新增/修改 Request VO") | |
| 9 | +@Data | |
| 10 | +public class MaterialSpecificationSaveReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "15081") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "规格编码") | |
| 16 | + private String specCode; | |
| 17 | + | |
| 18 | + @Schema(description = "规格名称", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 19 | + @NotEmpty(message = "规格名称不能为空") | |
| 20 | + private String specifications; | |
| 21 | + | |
| 22 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") | |
| 23 | + private String remark; | |
| 24 | + | |
| 25 | + @Schema(description = "部门ID", example = "18158") | |
| 26 | + private Long deptId; | |
| 27 | + | |
| 28 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialunit/MaterialUnitController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialunit; | |
| 2 | + | |
| 3 | +import org.springframework.web.bind.annotation.*; | |
| 4 | +import jakarta.annotation.Resource; | |
| 5 | +import org.springframework.validation.annotation.Validated; | |
| 6 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 7 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 8 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 9 | +import io.swagger.v3.oas.annotations.Operation; | |
| 10 | + | |
| 11 | +import jakarta.validation.constraints.*; | |
| 12 | +import jakarta.validation.*; | |
| 13 | +import jakarta.servlet.http.*; | |
| 14 | +import java.util.*; | |
| 15 | +import java.io.IOException; | |
| 16 | + | |
| 17 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 18 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 19 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 20 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 21 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 22 | + | |
| 23 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | |
| 24 | + | |
| 25 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 26 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | |
| 27 | + | |
| 28 | +import com.zteits.urbanops.module.garden.controller.admin.materialunit.vo.*; | |
| 29 | +import com.zteits.urbanops.module.garden.dal.dataobject.materialunit.MaterialUnitDO; | |
| 30 | +import com.zteits.urbanops.module.garden.service.materialunit.MaterialUnitService; | |
| 31 | + | |
| 32 | +@Tag(name = "管理后台 - 物料单位") | |
| 33 | +@RestController | |
| 34 | +@RequestMapping("/garden/material-unit") | |
| 35 | +@Validated | |
| 36 | +public class MaterialUnitController { | |
| 37 | + | |
| 38 | + @Resource | |
| 39 | + private MaterialUnitService materialUnitService; | |
| 40 | + | |
| 41 | + @PostMapping("/create") | |
| 42 | + @Operation(summary = "创建物料单位") | |
| 43 | + @PreAuthorize("@ss.hasPermission('garden:material-unit:create')") | |
| 44 | + public CommonResult<Long> createMaterialUnit(@Valid @RequestBody MaterialUnitSaveReqVO createReqVO) { | |
| 45 | + return success(materialUnitService.createMaterialUnit(createReqVO)); | |
| 46 | + } | |
| 47 | + | |
| 48 | + @PutMapping("/update") | |
| 49 | + @Operation(summary = "更新物料单位") | |
| 50 | + @PreAuthorize("@ss.hasPermission('garden:material-unit:update')") | |
| 51 | + public CommonResult<Boolean> updateMaterialUnit(@Valid @RequestBody MaterialUnitSaveReqVO updateReqVO) { | |
| 52 | + materialUnitService.updateMaterialUnit(updateReqVO); | |
| 53 | + return success(true); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @DeleteMapping("/delete") | |
| 57 | + @Operation(summary = "删除物料单位") | |
| 58 | + @Parameter(name = "id", description = "编号", required = true) | |
| 59 | + @PreAuthorize("@ss.hasPermission('garden:material-unit:delete')") | |
| 60 | + public CommonResult<Boolean> deleteMaterialUnit(@RequestParam("id") Long id) { | |
| 61 | + materialUnitService.deleteMaterialUnit(id); | |
| 62 | + return success(true); | |
| 63 | + } | |
| 64 | + | |
| 65 | + @DeleteMapping("/delete-list") | |
| 66 | + @Parameter(name = "ids", description = "编号", required = true) | |
| 67 | + @Operation(summary = "批量删除物料单位") | |
| 68 | + @PreAuthorize("@ss.hasPermission('garden:material-unit:delete')") | |
| 69 | + public CommonResult<Boolean> deleteMaterialUnitList(@RequestParam("ids") List<Long> ids) { | |
| 70 | + materialUnitService.deleteMaterialUnitListByIds(ids); | |
| 71 | + return success(true); | |
| 72 | + } | |
| 73 | + | |
| 74 | + @GetMapping("/get") | |
| 75 | + @Operation(summary = "获得物料单位") | |
| 76 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 77 | + @PreAuthorize("@ss.hasPermission('garden:material-unit:query')") | |
| 78 | + public CommonResult<MaterialUnitRespVO> getMaterialUnit(@RequestParam("id") Long id) { | |
| 79 | + MaterialUnitDO materialUnit = materialUnitService.getMaterialUnit(id); | |
| 80 | + return success(BeanUtils.toBean(materialUnit, MaterialUnitRespVO.class)); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @GetMapping("/page") | |
| 84 | + @Operation(summary = "获得物料单位分页") | |
| 85 | + @PreAuthorize("@ss.hasPermission('garden:material-unit:query')") | |
| 86 | + public CommonResult<PageResult<MaterialUnitRespVO>> getMaterialUnitPage(@Valid MaterialUnitPageReqVO pageReqVO) { | |
| 87 | + PageResult<MaterialUnitDO> pageResult = materialUnitService.getMaterialUnitPage(pageReqVO); | |
| 88 | + return success(BeanUtils.toBean(pageResult, MaterialUnitRespVO.class)); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @GetMapping("/list") | |
| 92 | + @Operation(summary = "获得物料单位列表(支持模糊搜索)") | |
| 93 | + @PreAuthorize("@ss.hasPermission('garden:material-unit:query')") | |
| 94 | + public CommonResult<List<MaterialUnitRespVO>> getMaterialUnitList( | |
| 95 | + @RequestParam(value = "unitName", required = false) String unitName) { | |
| 96 | + // 构建查询条件 | |
| 97 | + MaterialUnitPageReqVO pageReqVO = new MaterialUnitPageReqVO(); | |
| 98 | + pageReqVO.setUnitName(unitName); | |
| 99 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 100 | + | |
| 101 | + // 查询数据 | |
| 102 | + List<MaterialUnitDO> list = materialUnitService.getMaterialUnitPage(pageReqVO).getList(); | |
| 103 | + return success(BeanUtils.toBean(list, MaterialUnitRespVO.class)); | |
| 104 | + } | |
| 105 | + | |
| 106 | + @GetMapping("/export-excel") | |
| 107 | + @Operation(summary = "导出物料单位 Excel") | |
| 108 | + @PreAuthorize("@ss.hasPermission('garden:material-unit:export')") | |
| 109 | + @ApiAccessLog(operateType = EXPORT) | |
| 110 | + public void exportMaterialUnitExcel(@Valid MaterialUnitPageReqVO pageReqVO, | |
| 111 | + HttpServletResponse response) throws IOException { | |
| 112 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 113 | + List<MaterialUnitDO> list = materialUnitService.getMaterialUnitPage(pageReqVO).getList(); | |
| 114 | + // 导出 Excel | |
| 115 | + ExcelUtils.write(response, "物料单位.xls", "数据", MaterialUnitRespVO.class, | |
| 116 | + BeanUtils.toBean(list, MaterialUnitRespVO.class)); | |
| 117 | + } | |
| 118 | + | |
| 119 | +} | |
| 0 | 120 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialunit/vo/MaterialUnitPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialunit.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - 物料单位分页 Request VO") | |
| 13 | +@Data | |
| 14 | +public class MaterialUnitPageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @Schema(description = "单位ID", example = "22342") | |
| 17 | + private Long unitId; | |
| 18 | + | |
| 19 | + @Schema(description = "单位名称", example = "张三") | |
| 20 | + private String unitName; | |
| 21 | + | |
| 22 | + @Schema(description = "备注", example = "你说的对") | |
| 23 | + private String remark; | |
| 24 | + | |
| 25 | + @Schema(description = "创建时间") | |
| 26 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 27 | + private LocalDateTime[] createTime; | |
| 28 | + | |
| 29 | + @Schema(description = "部门ID", example = "8809") | |
| 30 | + private Long deptId; | |
| 31 | + | |
| 32 | +} | |
| 0 | 33 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialunit/vo/MaterialUnitRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialunit.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | +import cn.idev.excel.annotation.*; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - 物料单位 Response VO") | |
| 11 | +@Data | |
| 12 | +@ExcelIgnoreUnannotated | |
| 13 | +public class MaterialUnitRespVO { | |
| 14 | + | |
| 15 | + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "8413") | |
| 16 | + @ExcelProperty("自增主键") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "单位ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22342") | |
| 20 | + @ExcelProperty("单位ID") | |
| 21 | + private Long unitId; | |
| 22 | + | |
| 23 | + @Schema(description = "单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | |
| 24 | + @ExcelProperty("单位名称") | |
| 25 | + private String unitName; | |
| 26 | + | |
| 27 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") | |
| 28 | + @ExcelProperty("备注") | |
| 29 | + private String remark; | |
| 30 | + | |
| 31 | + @Schema(description = "创建时间") | |
| 32 | + @ExcelProperty("创建时间") | |
| 33 | + private LocalDateTime createTime; | |
| 34 | + | |
| 35 | + @Schema(description = "部门ID", example = "8809") | |
| 36 | + @ExcelProperty("部门ID") | |
| 37 | + private Long deptId; | |
| 38 | + | |
| 39 | +} | |
| 0 | 40 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialunit/vo/MaterialUnitSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialunit.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import jakarta.validation.constraints.*; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - 物料单位新增/修改 Request VO") | |
| 9 | +@Data | |
| 10 | +public class MaterialUnitSaveReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "8413") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "单位ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22342") | |
| 16 | + private Long unitId; | |
| 17 | + | |
| 18 | + @Schema(description = "单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | |
| 19 | + @NotEmpty(message = "单位名称不能为空") | |
| 20 | + private String unitName; | |
| 21 | + | |
| 22 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") | |
| 23 | + private String remark; | |
| 24 | + | |
| 25 | + @Schema(description = "部门ID", example = "8809") | |
| 26 | + private Long deptId; | |
| 27 | + | |
| 28 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/mechanicalcost/vo/MechanicalCostPageReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.mechanicalcost.vo; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; | |
| 4 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
| 3 | 5 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 6 | +import com.zteits.urbanops.module.garden.dal.dataobject.mechanicalcost.MechanicalCostDO; | |
| 4 | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | +import jakarta.validation.constraints.AssertTrue; | |
| 5 | 9 | import lombok.Data; |
| 6 | 10 | import org.springframework.format.annotation.DateTimeFormat; |
| 7 | 11 | |
| ... | ... | @@ -9,6 +13,7 @@ import java.math.BigDecimal; |
| 9 | 13 | import java.time.LocalDate; |
| 10 | 14 | import java.time.LocalDateTime; |
| 11 | 15 | import java.util.List; |
| 16 | +import java.util.Map; | |
| 12 | 17 | |
| 13 | 18 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 14 | 19 | |
| ... | ... | @@ -44,14 +49,16 @@ public class MechanicalCostPageReqVO extends PageParam { |
| 44 | 49 | private String vehicleType; |
| 45 | 50 | |
| 46 | 51 | @Schema(description = "开始使用时间") |
| 47 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 52 | + @JsonFormat(pattern = "yyyy-MM-dd", shape = JsonFormat.Shape.STRING) | |
| 53 | + @DateTimeFormat(pattern = "yyyy-MM-dd") | |
| 48 | 54 | private LocalDate[] startUseTime; |
| 49 | 55 | |
| 50 | 56 | @Schema(description = "使用年限") |
| 51 | 57 | private Long serviceLife; |
| 52 | 58 | |
| 53 | 59 | @Schema(description = "结束使用时间") |
| 54 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 60 | + @JsonFormat(pattern = "yyyy-MM-dd", shape = JsonFormat.Shape.STRING) | |
| 61 | + @DateTimeFormat(pattern = "yyyy-MM-dd") | |
| 55 | 62 | private LocalDate[] endUseTime; |
| 56 | 63 | |
| 57 | 64 | @Schema(description = "归属公司", example = "张三") |
| ... | ... | @@ -67,6 +74,16 @@ public class MechanicalCostPageReqVO extends PageParam { |
| 67 | 74 | private String remark; |
| 68 | 75 | |
| 69 | 76 | @Schema(description = "创建时间") |
| 70 | - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 71 | 77 | private LocalDateTime[] createTime; |
| 78 | + | |
| 79 | + //对应前端排序字段 | |
| 80 | + public static final Map<String, SFunction<MechanicalCostDO, ?>> SORT_FIELD_MAP = Map.of( | |
| 81 | + "id", MechanicalCostDO::getId, | |
| 82 | + "unitPrice", MechanicalCostDO::getUnitPrice, | |
| 83 | + "quantity", MechanicalCostDO::getQuantity, | |
| 84 | + "serviceLife", MechanicalCostDO::getServiceLife, | |
| 85 | + "startUseTime", MechanicalCostDO::getStartUseTime, | |
| 86 | + "endUseTime" , MechanicalCostDO::getEndUseTime | |
| 87 | + ); | |
| 88 | + | |
| 72 | 89 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/mechanicaldepreciation/vo/MechanicalDepreciationPageReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.mechanicaldepreciation.vo; |
| 2 | 2 | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | 3 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 7 | -import java.math.BigDecimal; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 8 | 6 | import org.springframework.format.annotation.DateTimeFormat; |
| 7 | + | |
| 8 | +import java.math.BigDecimal; | |
| 9 | 9 | import java.time.LocalDateTime; |
| 10 | 10 | |
| 11 | 11 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| ... | ... | @@ -51,4 +51,4 @@ public class MechanicalDepreciationPageReqVO extends PageParam { |
| 51 | 51 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 52 | 52 | private LocalDateTime[] createTime; |
| 53 | 53 | |
| 54 | -} | |
| 55 | 54 | \ No newline at end of file |
| 55 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/personalcost/vo/PersonalCostPageReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.personalcost.vo; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; | |
| 3 | 4 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 5 | +import com.zteits.urbanops.module.garden.dal.dataobject.personalcost.PersonalCostDO; | |
| 4 | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | 7 | import lombok.Data; |
| 6 | 8 | import org.springframework.format.annotation.DateTimeFormat; |
| ... | ... | @@ -8,6 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat; |
| 8 | 10 | import java.math.BigDecimal; |
| 9 | 11 | import java.time.LocalDateTime; |
| 10 | 12 | import java.util.List; |
| 13 | +import java.util.Map; | |
| 11 | 14 | |
| 12 | 15 | import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 13 | 16 | |
| ... | ... | @@ -46,4 +49,11 @@ public class PersonalCostPageReqVO extends PageParam { |
| 46 | 49 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 47 | 50 | private LocalDateTime[] createTime; |
| 48 | 51 | |
| 52 | + public static final Map<String, SFunction<PersonalCostDO, ?>> SORT_FIELD_MAP = Map.of( | |
| 53 | + "id", PersonalCostDO::getId, | |
| 54 | + "salaryMonth", PersonalCostDO::getSalaryMonth, | |
| 55 | + "salaryAmount", PersonalCostDO::getSalaryAmount, | |
| 56 | + "createTime", PersonalCostDO::getCreateTime | |
| 57 | + ); | |
| 58 | + | |
| 49 | 59 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/PlanRateController.java
| ... | ... | @@ -119,8 +119,7 @@ public class PlanRateController { |
| 119 | 119 | @Operation(summary = "获得计划频次分页") |
| 120 | 120 | @PreAuthorize("@ss.hasPermission('garden:plan-rate:query')") |
| 121 | 121 | public CommonResult<PageResult<PlanRateRespVO>> getPlanRatePage(@Valid PlanRatePageReqVO pageReqVO) { |
| 122 | - PageResult<PlanRateDO> pageResult = planRateService.getPlanRatePage(pageReqVO); | |
| 123 | - return success(BeanUtils.toBean(pageResult, PlanRateRespVO.class)); | |
| 122 | + return success(planRateService.getPlanRatePage(pageReqVO)); | |
| 124 | 123 | } |
| 125 | 124 | |
| 126 | 125 | @GetMapping("/export-excel") |
| ... | ... | @@ -130,7 +129,7 @@ public class PlanRateController { |
| 130 | 129 | public void exportPlanRateExcel(@Valid PlanRatePageReqVO pageReqVO, |
| 131 | 130 | HttpServletResponse response) throws IOException { |
| 132 | 131 | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| 133 | - List<PlanRateDO> list = planRateService.getPlanRatePage(pageReqVO).getList(); | |
| 132 | + List<PlanRateRespVO> list = planRateService.getPlanRatePage(pageReqVO).getList(); | |
| 134 | 133 | // 导出 Excel |
| 135 | 134 | ExcelUtils.write(response, "计划频次.xls", "数据", PlanRateRespVO.class, |
| 136 | 135 | BeanUtils.toBean(list, PlanRateRespVO.class)); | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/PlanRateDetailController.java
| ... | ... | @@ -82,8 +82,9 @@ public class PlanRateDetailController { |
| 82 | 82 | @PreAuthorize("@ss.hasPermission('garden:plan-rate-detail:query')") |
| 83 | 83 | public CommonResult<PlanRateDetailRespVO> getPlanRateValue(@RequestParam("busi_Line") @NotBlank String busiLine, |
| 84 | 84 | @RequestParam("plan_type_id") @NotNull Integer planTypeId, |
| 85 | - @RequestParam("level_id") @NotNull Integer levelId) { | |
| 86 | - return success(planRateDetailService.getPlanRateValue(busiLine, planTypeId, levelId)); | |
| 85 | + @RequestParam("level_id") @NotNull Integer levelId, | |
| 86 | + @RequestParam("company_id") Long companyId) { | |
| 87 | + return success(planRateDetailService.getPlanRateValue(busiLine, planTypeId, levelId, companyId)); | |
| 87 | 88 | } |
| 88 | 89 | |
| 89 | 90 | @GetMapping("/page") | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/vo/PlanRatePageReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.planrate.vo; |
| 2 | 2 | |
| 3 | +import io.swagger.v3.oas.annotations.Hidden; | |
| 3 | 4 | import jakarta.validation.constraints.NotNull; |
| 4 | 5 | import lombok.*; |
| 5 | 6 | import java.util.*; |
| ... | ... | @@ -30,4 +31,8 @@ public class PlanRatePageReqVO extends PageParam { |
| 30 | 31 | @NotNull(message = "类型:1:养护;2:巡查不能为空") |
| 31 | 32 | private Integer type; |
| 32 | 33 | |
| 34 | + @Schema(description = "公司ID", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 35 | + @Hidden | |
| 36 | + private Long companyId; | |
| 37 | + | |
| 33 | 38 | } |
| 34 | 39 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/vo/PlanRateRespVO.java
| ... | ... | @@ -36,4 +36,10 @@ public class PlanRateRespVO { |
| 36 | 36 | @ExcelProperty("创建时间") |
| 37 | 37 | private LocalDateTime createTime; |
| 38 | 38 | |
| 39 | + @Schema(description = "公司ID", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 40 | + private Long companyId; | |
| 41 | + | |
| 42 | + @Schema(description = "公司", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 43 | + private String companyName; | |
| 44 | + | |
| 39 | 45 | } |
| 40 | 46 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/vo/PlanRateSaveReqVO.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/problemtype/GardenProblemTypeController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.problemtype; | |
| 2 | + | |
| 3 | +import com.zteits.urbanops.module.garden.controller.admin.problemtype.vo.ProblemTypePageReqVO; | |
| 4 | +import com.zteits.urbanops.module.garden.controller.admin.problemtype.vo.ProblemTypeRespVO; | |
| 5 | +import com.zteits.urbanops.module.garden.controller.admin.problemtype.vo.ProblemTypeSaveReqVO; | |
| 6 | +import org.springframework.web.bind.annotation.*; | |
| 7 | +import jakarta.annotation.Resource; | |
| 8 | +import org.springframework.validation.annotation.Validated; | |
| 9 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 10 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 11 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 12 | +import io.swagger.v3.oas.annotations.Operation; | |
| 13 | + | |
| 14 | +import jakarta.validation.*; | |
| 15 | +import java.util.*; | |
| 16 | + | |
| 17 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 18 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 19 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 20 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 21 | + | |
| 22 | +import com.zteits.urbanops.module.garden.dal.dataobject.problemtype.GardenProblemTypeDO; | |
| 23 | +import com.zteits.urbanops.module.garden.dal.mysql.problemtype.GardenProblemTypeMapper; | |
| 24 | +import com.zteits.urbanops.module.garden.service.problemtype.GardenProblemTypeService; | |
| 25 | + | |
| 26 | +@Tag(name = "管理后台 - 问题类型配置") | |
| 27 | +@RestController | |
| 28 | +@RequestMapping("/garden/problem-type") | |
| 29 | +@Validated | |
| 30 | +public class GardenProblemTypeController { | |
| 31 | + | |
| 32 | + @Resource | |
| 33 | + private GardenProblemTypeService gardenProblemTypeService; | |
| 34 | + | |
| 35 | + @Resource | |
| 36 | + private GardenProblemTypeMapper gardenProblemTypeMapper; | |
| 37 | + | |
| 38 | + @PostMapping("/create") | |
| 39 | + @Operation(summary = "创建问题类型(二级/三级)") | |
| 40 | + @PreAuthorize("@ss.hasPermission('garden:problem-type:create')") | |
| 41 | + public CommonResult<Long> createProblemType(@Valid @RequestBody ProblemTypeSaveReqVO createReqVO) { | |
| 42 | + return success(gardenProblemTypeService.createProblemType(createReqVO)); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @PutMapping("/update") | |
| 46 | + @Operation(summary = "更新问题类型(二级/三级)") | |
| 47 | + @PreAuthorize("@ss.hasPermission('garden:problem-type:update')") | |
| 48 | + public CommonResult<Boolean> updateProblemType(@Valid @RequestBody ProblemTypeSaveReqVO updateReqVO) { | |
| 49 | + gardenProblemTypeService.updateProblemType(updateReqVO); | |
| 50 | + return success(true); | |
| 51 | + } | |
| 52 | + | |
| 53 | + @DeleteMapping("/delete") | |
| 54 | + @Operation(summary = "删除问题类型") | |
| 55 | + @Parameter(name = "id", description = "编号", required = true) | |
| 56 | + @PreAuthorize("@ss.hasPermission('garden:problem-type:delete')") | |
| 57 | + public CommonResult<Boolean> deleteProblemType(@RequestParam("id") Long id) { | |
| 58 | + gardenProblemTypeService.deleteProblemType(id); | |
| 59 | + return success(true); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @GetMapping("/get") | |
| 63 | + @Operation(summary = "获得问题类型") | |
| 64 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 65 | + @PreAuthorize("@ss.hasPermission('garden:problem-type:query')") | |
| 66 | + public CommonResult<ProblemTypeRespVO> getProblemType(@RequestParam("id") Long id) { | |
| 67 | + GardenProblemTypeDO problemType = gardenProblemTypeService.getProblemType(id); | |
| 68 | + ProblemTypeRespVO respVO = BeanUtils.toBean(problemType, ProblemTypeRespVO.class); | |
| 69 | + fillParentNames(Arrays.asList(respVO)); | |
| 70 | + return success(respVO); | |
| 71 | + } | |
| 72 | + | |
| 73 | + @GetMapping("/page") | |
| 74 | + @Operation(summary = "获得问题类型分页") | |
| 75 | + @PreAuthorize("@ss.hasPermission('garden:problem-type:query')") | |
| 76 | + public CommonResult<PageResult<ProblemTypeRespVO>> getProblemTypePage(@Valid ProblemTypePageReqVO pageReqVO) { | |
| 77 | + PageResult<GardenProblemTypeDO> pageResult = gardenProblemTypeService.getProblemTypePage(pageReqVO); | |
| 78 | + PageResult<ProblemTypeRespVO> voPageResult = BeanUtils.toBean(pageResult, ProblemTypeRespVO.class); | |
| 79 | + fillParentNames(voPageResult.getList()); | |
| 80 | + return success(voPageResult); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @GetMapping("/list-by-parent") | |
| 84 | + @Operation(summary = "根据父级编码和层级查询子类型列表(级联下拉用)") | |
| 85 | + @PreAuthorize("@ss.hasPermission('garden:problem-type:query')") | |
| 86 | + public CommonResult<List<ProblemTypeRespVO>> getProblemTypeListByParent( | |
| 87 | + @RequestParam(value = "parentCode", required = false) String parentCode, | |
| 88 | + @RequestParam("level") Integer level) { | |
| 89 | + List<GardenProblemTypeDO> list = gardenProblemTypeService.getProblemTypeByParentCode(parentCode, level); | |
| 90 | + return success(BeanUtils.toBean(list, ProblemTypeRespVO.class)); | |
| 91 | + } | |
| 92 | + | |
| 93 | + @GetMapping("/generate-next-code") | |
| 94 | + @Operation(summary = "根据父级编码生成下一个类型编码") | |
| 95 | + @PreAuthorize("@ss.hasPermission('garden:problem-type:create')") | |
| 96 | + public CommonResult<String> generateNextCode(@RequestParam("parentCode") String parentCode) { | |
| 97 | + return success(gardenProblemTypeService.generateNextCode(parentCode)); | |
| 98 | + } | |
| 99 | + | |
| 100 | + @PostMapping("/sync-level-one") | |
| 101 | + @Operation(summary = "从字典表同步一级类型") | |
| 102 | + @PreAuthorize("@ss.hasPermission('garden:problem-type:create')") | |
| 103 | + public CommonResult<Integer> syncLevelOne() { | |
| 104 | + return success(gardenProblemTypeService.syncLevelOneFromDict()); | |
| 105 | + } | |
| 106 | + | |
| 107 | + /** | |
| 108 | + * 填充每个记录的层级名称: | |
| 109 | + * level 1 → levelOneName = 自身 typeName | |
| 110 | + * level 2 → levelTwoName = 自身 typeName, levelOneName = 父级 typeName | |
| 111 | + * level 3 → levelOneName = 祖父 typeName, levelTwoName = 父级 typeName | |
| 112 | + */ | |
| 113 | + private void fillParentNames(List<ProblemTypeRespVO> list) { | |
| 114 | + if (list == null || list.isEmpty()) { | |
| 115 | + return; | |
| 116 | + } | |
| 117 | + for (ProblemTypeRespVO vo : list) { | |
| 118 | + if (vo.getLevel() == null) continue; | |
| 119 | + if (vo.getLevel() == 1) { | |
| 120 | + vo.setLevelOneName(vo.getTypeName()); | |
| 121 | + } else if (vo.getLevel() == 2) { | |
| 122 | + vo.setLevelTwoName(vo.getTypeName()); | |
| 123 | + if (vo.getParentCode() != null) { | |
| 124 | + GardenProblemTypeDO parent = gardenProblemTypeMapper.selectByTypeCode(vo.getParentCode()); | |
| 125 | + if (parent != null) { | |
| 126 | + vo.setLevelOneName(parent.getTypeName()); | |
| 127 | + } | |
| 128 | + } | |
| 129 | + } else if (vo.getLevel() == 3) { | |
| 130 | + if (vo.getParentCode() != null) { | |
| 131 | + GardenProblemTypeDO parent = gardenProblemTypeMapper.selectByTypeCode(vo.getParentCode()); | |
| 132 | + if (parent != null) { | |
| 133 | + vo.setLevelTwoName(parent.getTypeName()); | |
| 134 | + if (parent.getParentCode() != null) { | |
| 135 | + GardenProblemTypeDO grandParent = gardenProblemTypeMapper | |
| 136 | + .selectByTypeCode(parent.getParentCode()); | |
| 137 | + if (grandParent != null) { | |
| 138 | + vo.setLevelOneName(grandParent.getTypeName()); | |
| 139 | + } | |
| 140 | + } | |
| 141 | + } | |
| 142 | + } | |
| 143 | + } | |
| 144 | + } | |
| 145 | + } | |
| 146 | + | |
| 147 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/problemtype/vo/ProblemTypePageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.problemtype.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 6 | + | |
| 7 | +@Schema(description = "管理后台 - 问题类型分页 Request VO") | |
| 8 | +@Data | |
| 9 | +public class ProblemTypePageReqVO extends PageParam { | |
| 10 | + | |
| 11 | + @Schema(description = "问题类型编码", example = "PT001") | |
| 12 | + private String typeCode; | |
| 13 | + | |
| 14 | + @Schema(description = "问题类型名称", example = "树木倒伏") | |
| 15 | + private String typeName; | |
| 16 | + | |
| 17 | + @Schema(description = "层级:1一级 2二级 3三级", example = "2") | |
| 18 | + private Integer level; | |
| 19 | + | |
| 20 | + @Schema(description = "父级类型编码", example = "BIZ_GARDEN") | |
| 21 | + private String parentCode; | |
| 22 | + | |
| 23 | + @Schema(description = "一级类型编码(级联筛选)", example = "yl") | |
| 24 | + private String levelOneCode; | |
| 25 | + | |
| 26 | + @Schema(description = "状态 1启用 0禁用", example = "1") | |
| 27 | + private Integer status; | |
| 28 | + | |
| 29 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/problemtype/vo/ProblemTypeRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.problemtype.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import cn.idev.excel.annotation.*; | |
| 6 | + | |
| 7 | +@Schema(description = "管理后台 - 问题类型 Response VO") | |
| 8 | +@Data | |
| 9 | +@ExcelIgnoreUnannotated | |
| 10 | +public class ProblemTypeRespVO { | |
| 11 | + | |
| 12 | + @Schema(description = "主键ID", example = "1") | |
| 13 | + @ExcelProperty("主键ID") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @Schema(description = "问题类型编码", example = "PT001") | |
| 17 | + @ExcelProperty("问题类型编码") | |
| 18 | + private String typeCode; | |
| 19 | + | |
| 20 | + @Schema(description = "问题类型名称", example = "树木倒伏") | |
| 21 | + @ExcelProperty("问题类型名称") | |
| 22 | + private String typeName; | |
| 23 | + | |
| 24 | + @Schema(description = "层级:1一级 2二级 3三级", example = "2") | |
| 25 | + @ExcelProperty("层级") | |
| 26 | + private Integer level; | |
| 27 | + | |
| 28 | + @Schema(description = "父级类型编码", example = "BIZ_GARDEN") | |
| 29 | + @ExcelProperty("父级类型编码") | |
| 30 | + private String parentCode; | |
| 31 | + | |
| 32 | + @Schema(description = "排序序号", example = "1") | |
| 33 | + @ExcelProperty("排序序号") | |
| 34 | + private Integer sort; | |
| 35 | + | |
| 36 | + @Schema(description = "状态 1启用 0禁用", example = "1") | |
| 37 | + @ExcelProperty("状态") | |
| 38 | + private Integer status; | |
| 39 | + | |
| 40 | + @Schema(description = "一级类型名称") | |
| 41 | + private String levelOneName; | |
| 42 | + | |
| 43 | + @Schema(description = "二级类型名称") | |
| 44 | + private String levelTwoName; | |
| 45 | + | |
| 46 | + @Schema(description = "创建者") | |
| 47 | + @ExcelProperty("创建者") | |
| 48 | + private String creator; | |
| 49 | + | |
| 50 | + @Schema(description = "创建时间") | |
| 51 | + @ExcelProperty("创建时间") | |
| 52 | + private String createTime; | |
| 53 | + | |
| 54 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/problemtype/vo/ProblemTypeSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.problemtype.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | +import jakarta.validation.constraints.*; | |
| 6 | + | |
| 7 | +@Schema(description = "管理后台 - 问题类型新增/修改 Request VO") | |
| 8 | +@Data | |
| 9 | +public class ProblemTypeSaveReqVO { | |
| 10 | + | |
| 11 | + @Schema(description = "主键ID", example = "1") | |
| 12 | + private Long id; | |
| 13 | + | |
| 14 | + @Schema(description = "问题类型编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "PT001") | |
| 15 | + @NotEmpty(message = "问题类型编码不能为空") | |
| 16 | + private String typeCode; | |
| 17 | + | |
| 18 | + @Schema(description = "问题类型名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "树木倒伏") | |
| 19 | + @NotEmpty(message = "问题类型名称不能为空") | |
| 20 | + private String typeName; | |
| 21 | + | |
| 22 | + @Schema(description = "层级:1一级 2二级 3三级", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 23 | + @NotNull(message = "层级不能为空") | |
| 24 | + private Integer level; | |
| 25 | + | |
| 26 | + @Schema(description = "父级类型编码", example = "BIZ_GARDEN") | |
| 27 | + private String parentCode; | |
| 28 | + | |
| 29 | + @Schema(description = "排序序号", example = "1") | |
| 30 | + private Integer sort; | |
| 31 | + | |
| 32 | + @Schema(description = "状态 1启用 0禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 33 | + @NotNull(message = "状态不能为空") | |
| 34 | + private Integer status; | |
| 35 | + | |
| 36 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/rentalmechanicalcost/vo/RentalMechanicalCostPageReqVO.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.rentalmechanicalcost.vo; |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; |
| 4 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
| 4 | 5 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 5 | 6 | import com.zteits.urbanops.module.garden.dal.dataobject.rentalmechanicalcost.RentalMechanicalCostDO; |
| 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | +import jakarta.validation.constraints.AssertTrue; | |
| 7 | 9 | import lombok.Data; |
| 8 | 10 | import org.springframework.format.annotation.DateTimeFormat; |
| 9 | 11 | |
| ... | ... | @@ -25,14 +27,17 @@ public class RentalMechanicalCostPageReqVO extends PageParam { |
| 25 | 27 | @Schema(description = "租赁总价格", example = "316") |
| 26 | 28 | private BigDecimal rentalTotalPriceMax; |
| 27 | 29 | @Schema(description = "开始使用时间") |
| 30 | + @JsonFormat(pattern = "yyyy-MM-dd", shape = JsonFormat.Shape.STRING) | |
| 28 | 31 | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| 29 | - private Date startUseTime; | |
| 32 | + private LocalDate[] startUseTime; | |
| 30 | 33 | |
| 31 | 34 | @Schema(description = "使用时长(天)") |
| 32 | 35 | private Integer useDuration; |
| 33 | 36 | |
| 34 | 37 | @Schema(description = "结束日期") |
| 35 | - private LocalDate endUseTime; | |
| 38 | + @JsonFormat(pattern = "yyyy-MM-dd", shape = JsonFormat.Shape.STRING) | |
| 39 | + @DateTimeFormat(pattern = "yyyy-MM-dd") | |
| 40 | + private LocalDate[] endUseTime; | |
| 36 | 41 | |
| 37 | 42 | @Schema(description = "数量") |
| 38 | 43 | private Integer quantity; |
| ... | ... | @@ -42,9 +47,11 @@ public class RentalMechanicalCostPageReqVO extends PageParam { |
| 42 | 47 | |
| 43 | 48 | public static final Map<String, SFunction<RentalMechanicalCostDO, ?>> SORT_FIELD_MAP = Map.of( |
| 44 | 49 | "id", RentalMechanicalCostDO::getId, |
| 50 | + "rentalTotalPrice",RentalMechanicalCostDO::getRentalTotalPrice, | |
| 45 | 51 | "quantity", RentalMechanicalCostDO::getQuantity, |
| 46 | 52 | "useDuration", RentalMechanicalCostDO::getUseDuration, |
| 47 | 53 | "startUseTime", RentalMechanicalCostDO::getStartUseTime, |
| 48 | 54 | "endUseTime", RentalMechanicalCostDO::getEndUseTime |
| 49 | 55 | ); |
| 56 | + | |
| 50 | 57 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/RoadController.java
| ... | ... | @@ -2,6 +2,9 @@ package com.zteits.urbanops.module.garden.controller.admin.road; |
| 2 | 2 | |
| 3 | 3 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; |
| 4 | 4 | import com.zteits.urbanops.module.system.api.permission.PermissionApi; |
| 5 | +import jakarta.annotation.security.PermitAll; | |
| 6 | +import org.slf4j.Logger; | |
| 7 | +import org.slf4j.LoggerFactory; | |
| 5 | 8 | import org.springframework.web.bind.annotation.*; |
| 6 | 9 | import jakarta.annotation.Resource; |
| 7 | 10 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -36,6 +39,7 @@ import com.zteits.urbanops.module.garden.service.road.RoadService; |
| 36 | 39 | @RequestMapping("/garden/road") |
| 37 | 40 | @Validated |
| 38 | 41 | public class RoadController { |
| 42 | + private static final Logger log = LoggerFactory.getLogger(RoadController.class); | |
| 39 | 43 | |
| 40 | 44 | @Resource |
| 41 | 45 | private RoadService roadService; |
| ... | ... | @@ -93,7 +97,11 @@ public class RoadController { |
| 93 | 97 | if(permissionApi.hasAnyRoles(loginUserId, "super_admin")){ |
| 94 | 98 | pageReqVO.setCompanyId( null); |
| 95 | 99 | }else{ |
| 96 | - pageReqVO.setCompanyId(SecurityFrameworkUtils.getCompanyId()); | |
| 100 | + Long companyId = SecurityFrameworkUtils.getCompanyId(); | |
| 101 | + if(null == companyId || companyId == 0L || companyId == 100L){ | |
| 102 | + companyId = null; | |
| 103 | + } | |
| 104 | + pageReqVO.setCompanyId(companyId); | |
| 97 | 105 | } |
| 98 | 106 | } |
| 99 | 107 | PageResult<RoadRespVO> pageResult = roadService.getRoadPage(pageReqVO); |
| ... | ... | @@ -124,19 +132,30 @@ public class RoadController { |
| 124 | 132 | |
| 125 | 133 | @Operation(summary = "物联网查询道路") |
| 126 | 134 | @GetMapping("/queryAllRoadList") |
| 127 | - public CommonResult<List<SysRoadRespVO>> queryAllRoadList(@RequestParam(required = false)String roadName,@RequestParam(required = false)String deptCode,@RequestParam(required = false)String companyCode) { | |
| 135 | + @PermitAll | |
| 136 | + public Map<String, Object> queryAllRoadList(@RequestParam(required = false) String roadName, @RequestParam(required = false) String deptCode, @RequestParam(required = false) String companyCode) { | |
| 137 | + log.info("物联网查询道路:companyCode:{},roadName:{},deptCode:{}",companyCode,roadName,deptCode); | |
| 128 | 138 | RoadListReqVO reqVO = new RoadListReqVO(); |
| 129 | 139 | reqVO.setRoadName(roadName); |
| 130 | - reqVO.setCompanyId(Long.valueOf(deptCode)); | |
| 140 | + // 处理deptCode为空的情况 | |
| 141 | + if (deptCode != null && !deptCode.isEmpty()) { | |
| 142 | + reqVO.setDeptId(Long.valueOf(deptCode)); | |
| 143 | + } | |
| 131 | 144 | reqVO.setBusiLine(companyCode); |
| 132 | 145 | List<RoadDO> roadList = roadService.getRoadList(reqVO); |
| 133 | - List<SysRoadRespVO> deptResps = roadList.stream().map(manager -> { | |
| 134 | - SysRoadRespVO sysDeptResp = new SysRoadRespVO(); | |
| 135 | - sysDeptResp.setRoadCode(manager.getId()+""); | |
| 136 | - sysDeptResp.setRoadName(manager.getRoadName()); | |
| 137 | - return sysDeptResp; | |
| 146 | + List<Map<String, Object>> roadResps = roadList.stream().map(manager -> { | |
| 147 | + Map<String, Object> roadMap = new HashMap<>(); | |
| 148 | + roadMap.put("roadCode", manager.getId() + ""); | |
| 149 | + roadMap.put("roadName", manager.getRoadName()); | |
| 150 | + return roadMap; | |
| 138 | 151 | }).collect(Collectors.toList()); |
| 139 | - return success(deptResps); | |
| 152 | + | |
| 153 | + // 构建返回格式 | |
| 154 | + Map<String, Object> result = new HashMap<>(); | |
| 155 | + result.put("msg", "操作成功"); | |
| 156 | + result.put("code", 200); | |
| 157 | + result.put("data", roadResps); | |
| 158 | + return result; | |
| 140 | 159 | } |
| 141 | 160 | |
| 142 | 161 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/vo/RoadListReqVO.java
| ... | ... | @@ -26,8 +26,11 @@ public class RoadListReqVO { |
| 26 | 26 | @NotNull(message = "归属(一级部门id)不能为空") |
| 27 | 27 | private Long companyId; |
| 28 | 28 | |
| 29 | + @Schema(description = "部门ID", example = "126") | |
| 30 | + private Long deptId; | |
| 31 | + | |
| 29 | 32 | @Schema(description = "业务看", example = "yl") |
| 30 | 33 | @NotEmpty(message = "创建者不能为空") |
| 31 | 34 | private String busiLine; |
| 32 | 35 | |
| 33 | -} | |
| 34 | 36 | \ No newline at end of file |
| 37 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/unitintegraladd/UnitIntegralAddController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.unitintegraladd; | |
| 2 | + | |
| 3 | +import org.springframework.web.bind.annotation.*; | |
| 4 | +import jakarta.annotation.Resource; | |
| 5 | +import org.springframework.validation.annotation.Validated; | |
| 6 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 7 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 8 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 9 | +import io.swagger.v3.oas.annotations.Operation; | |
| 10 | + | |
| 11 | +import jakarta.validation.constraints.*; | |
| 12 | +import jakarta.validation.*; | |
| 13 | +import jakarta.servlet.http.*; | |
| 14 | +import java.util.*; | |
| 15 | +import java.io.IOException; | |
| 16 | + | |
| 17 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 18 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 19 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 20 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 21 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 22 | + | |
| 23 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | |
| 24 | + | |
| 25 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 26 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | |
| 27 | + | |
| 28 | +import com.zteits.urbanops.module.garden.controller.admin.unitintegraladd.vo.*; | |
| 29 | +import com.zteits.urbanops.module.garden.dal.dataobject.unitintegraladd.UnitIntegralAddDO; | |
| 30 | +import com.zteits.urbanops.module.garden.service.unitintegraladd.UnitIntegralAddService; | |
| 31 | + | |
| 32 | +@Tag(name = "管理后台 - 积分增加记录") | |
| 33 | +@RestController | |
| 34 | +@RequestMapping("/garden/unit-integral-add") | |
| 35 | +@Validated | |
| 36 | +public class UnitIntegralAddController { | |
| 37 | + | |
| 38 | + @Resource | |
| 39 | + private UnitIntegralAddService unitIntegralAddService; | |
| 40 | + | |
| 41 | + @PostMapping("/create") | |
| 42 | + @Operation(summary = "创建积分增加记录") | |
| 43 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-add:create')") | |
| 44 | + public CommonResult<Long> createUnitIntegralAdd(@Valid @RequestBody UnitIntegralAddSaveReqVO createReqVO) { | |
| 45 | + return success(unitIntegralAddService.createUnitIntegralAdd(createReqVO)); | |
| 46 | + } | |
| 47 | + | |
| 48 | + @PutMapping("/update") | |
| 49 | + @Operation(summary = "更新积分增加记录") | |
| 50 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-add:update')") | |
| 51 | + public CommonResult<Boolean> updateUnitIntegralAdd(@Valid @RequestBody UnitIntegralAddSaveReqVO updateReqVO) { | |
| 52 | + unitIntegralAddService.updateUnitIntegralAdd(updateReqVO); | |
| 53 | + return success(true); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @DeleteMapping("/delete") | |
| 57 | + @Operation(summary = "删除积分增加记录") | |
| 58 | + @Parameter(name = "id", description = "编号", required = true) | |
| 59 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-add:delete')") | |
| 60 | + public CommonResult<Boolean> deleteUnitIntegralAdd(@RequestParam("id") Long id) { | |
| 61 | + unitIntegralAddService.deleteUnitIntegralAdd(id); | |
| 62 | + return success(true); | |
| 63 | + } | |
| 64 | + | |
| 65 | + @DeleteMapping("/delete-list") | |
| 66 | + @Parameter(name = "ids", description = "编号", required = true) | |
| 67 | + @Operation(summary = "批量删除积分增加记录") | |
| 68 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-add:delete')") | |
| 69 | + public CommonResult<Boolean> deleteUnitIntegralAddList(@RequestParam("ids") List<Long> ids) { | |
| 70 | + unitIntegralAddService.deleteUnitIntegralAddListByIds(ids); | |
| 71 | + return success(true); | |
| 72 | + } | |
| 73 | + | |
| 74 | + @GetMapping("/get") | |
| 75 | + @Operation(summary = "获得积分增加记录") | |
| 76 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 77 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-add:query')") | |
| 78 | + public CommonResult<UnitIntegralAddRespVO> getUnitIntegralAdd(@RequestParam("id") Long id) { | |
| 79 | + UnitIntegralAddDO unitIntegralAdd = unitIntegralAddService.getUnitIntegralAdd(id); | |
| 80 | + return success(BeanUtils.toBean(unitIntegralAdd, UnitIntegralAddRespVO.class)); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @GetMapping("/page") | |
| 84 | + @Operation(summary = "获得积分增加记录分页") | |
| 85 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-add:query')") | |
| 86 | + public CommonResult<PageResult<UnitIntegralAddRespVO>> getUnitIntegralAddPage(@Valid UnitIntegralAddPageReqVO pageReqVO) { | |
| 87 | + PageResult<UnitIntegralAddDO> pageResult = unitIntegralAddService.getUnitIntegralAddPage(pageReqVO); | |
| 88 | + return success(BeanUtils.toBean(pageResult, UnitIntegralAddRespVO.class)); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @GetMapping("/export-excel") | |
| 92 | + @Operation(summary = "导出积分增加记录 Excel") | |
| 93 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-add:export')") | |
| 94 | + @ApiAccessLog(operateType = EXPORT) | |
| 95 | + public void exportUnitIntegralAddExcel(@Valid UnitIntegralAddPageReqVO pageReqVO, | |
| 96 | + HttpServletResponse response) throws IOException { | |
| 97 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 98 | + List<UnitIntegralAddDO> list = unitIntegralAddService.getUnitIntegralAddPage(pageReqVO).getList(); | |
| 99 | + // 导出 Excel | |
| 100 | + ExcelUtils.write(response, "积分增加记录.xls", "数据", UnitIntegralAddRespVO.class, | |
| 101 | + BeanUtils.toBean(list, UnitIntegralAddRespVO.class)); | |
| 102 | + } | |
| 103 | + | |
| 104 | +} | |
| 0 | 105 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/unitintegraladd/vo/UnitIntegralAddPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.unitintegraladd.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - 积分增加记录分页 Request VO") | |
| 13 | +@Data | |
| 14 | +public class UnitIntegralAddPageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @Schema(description = "来源类型 01:派单", example = "1") | |
| 17 | + private String sourceType; | |
| 18 | + | |
| 19 | + @Schema(description = "单位类型:01:公司 02:班组 03:个人", example = "1") | |
| 20 | + private String unitType; | |
| 21 | + | |
| 22 | + @Schema(description = "单位ID(部门表 id)", example = "26490") | |
| 23 | + private String unitId; | |
| 24 | + | |
| 25 | + @Schema(description = "单位名称(冗余,避免联表查询)", example = "芋艿") | |
| 26 | + private String unitName; | |
| 27 | + | |
| 28 | + @Schema(description = "关联ID(关联业务表主键)", example = "24947") | |
| 29 | + private Long relatedTaskId; | |
| 30 | + | |
| 31 | + @Schema(description = "业务名称(冗余)", example = "张三") | |
| 32 | + private String relatedTaskName; | |
| 33 | + | |
| 34 | + @Schema(description = "本次增加积分(正数)") | |
| 35 | + private Integer addIntegral; | |
| 36 | + | |
| 37 | + @Schema(description = "增加原因(如:到期前上报奖励、到期后上报奖励等)", example = "不好") | |
| 38 | + private String addReason; | |
| 39 | + | |
| 40 | + @Schema(description = "增加前总积分(对账用)") | |
| 41 | + private Integer beforeIntegral; | |
| 42 | + | |
| 43 | + @Schema(description = "增加后总积分(对账用)") | |
| 44 | + private Integer afterIntegral; | |
| 45 | + | |
| 46 | + @Schema(description = "工单号") | |
| 47 | + private String workNo; | |
| 48 | + | |
| 49 | + @Schema(description = "备注(补充积分增加的特殊说明)", example = "你说的对") | |
| 50 | + private String remark; | |
| 51 | + | |
| 52 | + @Schema(description = "积分增加操作时间") | |
| 53 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 54 | + private LocalDateTime[] createTime; | |
| 55 | + | |
| 56 | +} | |
| 0 | 57 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/unitintegraladd/vo/UnitIntegralAddRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.unitintegraladd.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | +import cn.idev.excel.annotation.*; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - 积分增加记录 Response VO") | |
| 11 | +@Data | |
| 12 | +@ExcelIgnoreUnannotated | |
| 13 | +public class UnitIntegralAddRespVO { | |
| 14 | + | |
| 15 | + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12471") | |
| 16 | + @ExcelProperty("主键ID") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "来源类型 01:派单", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 20 | + @ExcelProperty("来源类型 01:派单") | |
| 21 | + private String sourceType; | |
| 22 | + | |
| 23 | + @Schema(description = "单位类型:01:公司 02:班组 03:个人", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 24 | + @ExcelProperty("单位类型:01:公司 02:班组 03:个人") | |
| 25 | + private String unitType; | |
| 26 | + | |
| 27 | + @Schema(description = "单位ID(部门表 id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "26490") | |
| 28 | + @ExcelProperty("单位ID(部门表 id)") | |
| 29 | + private String unitId; | |
| 30 | + | |
| 31 | + @Schema(description = "单位名称(冗余,避免联表查询)", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | |
| 32 | + @ExcelProperty("单位名称(冗余,避免联表查询)") | |
| 33 | + private String unitName; | |
| 34 | + | |
| 35 | + @Schema(description = "关联ID(关联业务表主键)", requiredMode = Schema.RequiredMode.REQUIRED, example = "24947") | |
| 36 | + @ExcelProperty("关联ID(关联业务表主键)") | |
| 37 | + private Long relatedTaskId; | |
| 38 | + | |
| 39 | + @Schema(description = "业务名称(冗余)", example = "张三") | |
| 40 | + @ExcelProperty("业务名称(冗余)") | |
| 41 | + private String relatedTaskName; | |
| 42 | + | |
| 43 | + @Schema(description = "本次增加积分(正数)", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 44 | + @ExcelProperty("本次增加积分(正数)") | |
| 45 | + private Integer addIntegral; | |
| 46 | + | |
| 47 | + @Schema(description = "增加原因(如:到期前上报奖励、到期后上报奖励等)", requiredMode = Schema.RequiredMode.REQUIRED, example = "不好") | |
| 48 | + @ExcelProperty("增加原因(如:到期前上报奖励、到期后上报奖励等)") | |
| 49 | + private String addReason; | |
| 50 | + | |
| 51 | + @Schema(description = "增加前总积分(对账用)") | |
| 52 | + @ExcelProperty("增加前总积分(对账用)") | |
| 53 | + private Integer beforeIntegral; | |
| 54 | + | |
| 55 | + @Schema(description = "增加后总积分(对账用)") | |
| 56 | + @ExcelProperty("增加后总积分(对账用)") | |
| 57 | + private Integer afterIntegral; | |
| 58 | + | |
| 59 | + @Schema(description = "工单号") | |
| 60 | + @ExcelProperty("工单号") | |
| 61 | + private String workNo; | |
| 62 | + | |
| 63 | + @Schema(description = "备注(补充积分增加的特殊说明)", example = "你说的对") | |
| 64 | + @ExcelProperty("备注(补充积分增加的特殊说明)") | |
| 65 | + private String remark; | |
| 66 | + | |
| 67 | + @Schema(description = "积分增加操作时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 68 | + @ExcelProperty("积分增加操作时间") | |
| 69 | + private LocalDateTime createTime; | |
| 70 | + | |
| 71 | +} | |
| 0 | 72 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/unitintegraladd/vo/UnitIntegralAddSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.unitintegraladd.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import jakarta.validation.constraints.*; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - 积分增加记录新增/修改 Request VO") | |
| 9 | +@Data | |
| 10 | +public class UnitIntegralAddSaveReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "12471") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "来源类型 01:派单", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 16 | + @NotEmpty(message = "来源类型 01:派单不能为空") | |
| 17 | + private String sourceType; | |
| 18 | + | |
| 19 | + @Schema(description = "单位类型:01:公司 02:班组 03:个人", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 20 | + @NotEmpty(message = "单位类型:01:公司 02:班组 03:个人不能为空") | |
| 21 | + private String unitType; | |
| 22 | + | |
| 23 | + @Schema(description = "单位ID(部门表 id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "26490") | |
| 24 | + @NotEmpty(message = "单位ID(部门表 id)不能为空") | |
| 25 | + private String unitId; | |
| 26 | + | |
| 27 | + @Schema(description = "单位名称(冗余,避免联表查询)", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | |
| 28 | + @NotEmpty(message = "单位名称(冗余,避免联表查询)不能为空") | |
| 29 | + private String unitName; | |
| 30 | + | |
| 31 | + @Schema(description = "关联ID(关联业务表主键)", requiredMode = Schema.RequiredMode.REQUIRED, example = "24947") | |
| 32 | + @NotNull(message = "关联ID(关联业务表主键)不能为空") | |
| 33 | + private Long relatedTaskId; | |
| 34 | + | |
| 35 | + @Schema(description = "业务名称(冗余)", example = "张三") | |
| 36 | + private String relatedTaskName; | |
| 37 | + | |
| 38 | + @Schema(description = "本次增加积分(正数)", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 39 | + @NotNull(message = "本次增加积分(正数)不能为空") | |
| 40 | + private Integer addIntegral; | |
| 41 | + | |
| 42 | + @Schema(description = "增加原因(如:到期前上报奖励、到期后上报奖励等)", requiredMode = Schema.RequiredMode.REQUIRED, example = "不好") | |
| 43 | + @NotEmpty(message = "增加原因(如:到期前上报奖励、到期后上报奖励等)不能为空") | |
| 44 | + private String addReason; | |
| 45 | + | |
| 46 | + @Schema(description = "增加前总积分(对账用)") | |
| 47 | + private Integer beforeIntegral; | |
| 48 | + | |
| 49 | + @Schema(description = "增加后总积分(对账用)") | |
| 50 | + private Integer afterIntegral; | |
| 51 | + | |
| 52 | + @Schema(description = "工单号") | |
| 53 | + private String workNo; | |
| 54 | + | |
| 55 | + @Schema(description = "备注(补充积分增加的特殊说明)", example = "你说的对") | |
| 56 | + private String remark; | |
| 57 | + | |
| 58 | +} | |
| 0 | 59 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/unitintegralsub/UnitIntegralSubController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.unitintegralsub; | |
| 2 | + | |
| 3 | +import org.springframework.web.bind.annotation.*; | |
| 4 | +import jakarta.annotation.Resource; | |
| 5 | +import org.springframework.validation.annotation.Validated; | |
| 6 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 7 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 8 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 9 | +import io.swagger.v3.oas.annotations.Operation; | |
| 10 | + | |
| 11 | +import jakarta.validation.constraints.*; | |
| 12 | +import jakarta.validation.*; | |
| 13 | +import jakarta.servlet.http.*; | |
| 14 | +import java.util.*; | |
| 15 | +import java.io.IOException; | |
| 16 | + | |
| 17 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 18 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 19 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 20 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 21 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 22 | + | |
| 23 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | |
| 24 | + | |
| 25 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 26 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | |
| 27 | + | |
| 28 | +import com.zteits.urbanops.module.garden.controller.admin.unitintegralsub.vo.*; | |
| 29 | +import com.zteits.urbanops.module.garden.dal.dataobject.unitintegralsub.UnitIntegralSubDO; | |
| 30 | +import com.zteits.urbanops.module.garden.service.unitintegralsub.UnitIntegralSubService; | |
| 31 | + | |
| 32 | +@Tag(name = "管理后台 - 积分扣减记录") | |
| 33 | +@RestController | |
| 34 | +@RequestMapping("/garden/unit-integral-sub") | |
| 35 | +@Validated | |
| 36 | +public class UnitIntegralSubController { | |
| 37 | + | |
| 38 | + @Resource | |
| 39 | + private UnitIntegralSubService unitIntegralSubService; | |
| 40 | + | |
| 41 | + @PostMapping("/create") | |
| 42 | + @Operation(summary = "创建积分扣减记录") | |
| 43 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-sub:create')") | |
| 44 | + public CommonResult<Long> createUnitIntegralSub(@Valid @RequestBody UnitIntegralSubSaveReqVO createReqVO) { | |
| 45 | + return success(unitIntegralSubService.createUnitIntegralSub(createReqVO)); | |
| 46 | + } | |
| 47 | + | |
| 48 | + @PutMapping("/update") | |
| 49 | + @Operation(summary = "更新积分扣减记录") | |
| 50 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-sub:update')") | |
| 51 | + public CommonResult<Boolean> updateUnitIntegralSub(@Valid @RequestBody UnitIntegralSubSaveReqVO updateReqVO) { | |
| 52 | + unitIntegralSubService.updateUnitIntegralSub(updateReqVO); | |
| 53 | + return success(true); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @DeleteMapping("/delete") | |
| 57 | + @Operation(summary = "删除积分扣减记录") | |
| 58 | + @Parameter(name = "id", description = "编号", required = true) | |
| 59 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-sub:delete')") | |
| 60 | + public CommonResult<Boolean> deleteUnitIntegralSub(@RequestParam("id") Long id) { | |
| 61 | + unitIntegralSubService.deleteUnitIntegralSub(id); | |
| 62 | + return success(true); | |
| 63 | + } | |
| 64 | + | |
| 65 | + @DeleteMapping("/delete-list") | |
| 66 | + @Parameter(name = "ids", description = "编号", required = true) | |
| 67 | + @Operation(summary = "批量删除积分扣减记录") | |
| 68 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-sub:delete')") | |
| 69 | + public CommonResult<Boolean> deleteUnitIntegralSubList(@RequestParam("ids") List<Long> ids) { | |
| 70 | + unitIntegralSubService.deleteUnitIntegralSubListByIds(ids); | |
| 71 | + return success(true); | |
| 72 | + } | |
| 73 | + | |
| 74 | + @GetMapping("/get") | |
| 75 | + @Operation(summary = "获得积分扣减记录") | |
| 76 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 77 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-sub:query')") | |
| 78 | + public CommonResult<UnitIntegralSubRespVO> getUnitIntegralSub(@RequestParam("id") Long id) { | |
| 79 | + UnitIntegralSubDO unitIntegralSub = unitIntegralSubService.getUnitIntegralSub(id); | |
| 80 | + return success(BeanUtils.toBean(unitIntegralSub, UnitIntegralSubRespVO.class)); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @GetMapping("/page") | |
| 84 | + @Operation(summary = "获得积分扣减记录分页") | |
| 85 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-sub:query')") | |
| 86 | + public CommonResult<PageResult<UnitIntegralSubRespVO>> getUnitIntegralSubPage(@Valid UnitIntegralSubPageReqVO pageReqVO) { | |
| 87 | + PageResult<UnitIntegralSubDO> pageResult = unitIntegralSubService.getUnitIntegralSubPage(pageReqVO); | |
| 88 | + return success(BeanUtils.toBean(pageResult, UnitIntegralSubRespVO.class)); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @GetMapping("/export-excel") | |
| 92 | + @Operation(summary = "导出积分扣减记录 Excel") | |
| 93 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-sub:export')") | |
| 94 | + @ApiAccessLog(operateType = EXPORT) | |
| 95 | + public void exportUnitIntegralSubExcel(@Valid UnitIntegralSubPageReqVO pageReqVO, | |
| 96 | + HttpServletResponse response) throws IOException { | |
| 97 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 98 | + List<UnitIntegralSubDO> list = unitIntegralSubService.getUnitIntegralSubPage(pageReqVO).getList(); | |
| 99 | + // 导出 Excel | |
| 100 | + ExcelUtils.write(response, "积分扣减记录.xls", "数据", UnitIntegralSubRespVO.class, | |
| 101 | + BeanUtils.toBean(list, UnitIntegralSubRespVO.class)); | |
| 102 | + } | |
| 103 | + | |
| 104 | +} | |
| 0 | 105 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/unitintegralsub/vo/UnitIntegralSubPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.unitintegralsub.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - 积分扣减记录分页 Request VO") | |
| 13 | +@Data | |
| 14 | +public class UnitIntegralSubPageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @Schema(description = "来源类型 01:派单", example = "1") | |
| 17 | + private String sourceType; | |
| 18 | + | |
| 19 | + @Schema(description = "单位类型:01:公司 02:班组 03:个人", example = "1") | |
| 20 | + private String unitType; | |
| 21 | + | |
| 22 | + @Schema(description = "单位ID(部门表 id)", example = "13254") | |
| 23 | + private String unitId; | |
| 24 | + | |
| 25 | + @Schema(description = "单位名称(冗余,避免联表查询)", example = "芋艿") | |
| 26 | + private String unitName; | |
| 27 | + | |
| 28 | + @Schema(description = "关联任务ID(外键,关联业务表主键)", example = "21804") | |
| 29 | + private Long relatedTaskId; | |
| 30 | + | |
| 31 | + @Schema(description = "业务名称(冗余)", example = "芋艿") | |
| 32 | + private String relatedTaskName; | |
| 33 | + | |
| 34 | + @Schema(description = "本次扣减积分(正数,存储扣减数值)") | |
| 35 | + private Integer subIntegral; | |
| 36 | + | |
| 37 | + @Schema(description = "扣减原因(如:任务打回等)", example = "不香") | |
| 38 | + private String subReason; | |
| 39 | + | |
| 40 | + @Schema(description = "扣减前总积分(对账用)") | |
| 41 | + private Integer beforeIntegral; | |
| 42 | + | |
| 43 | + @Schema(description = "扣减后总积分(对账用)") | |
| 44 | + private Integer afterIntegral; | |
| 45 | + | |
| 46 | + @Schema(description = "工单号") | |
| 47 | + private String workNo; | |
| 48 | + | |
| 49 | + @Schema(description = "备注(补充扣减的特殊说明)", example = "随便") | |
| 50 | + private String remark; | |
| 51 | + | |
| 52 | + @Schema(description = "积分扣减操作时间") | |
| 53 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 54 | + private LocalDateTime[] createTime; | |
| 55 | + | |
| 56 | +} | |
| 0 | 57 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/unitintegralsub/vo/UnitIntegralSubRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.unitintegralsub.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | +import cn.idev.excel.annotation.*; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - 积分扣减记录 Response VO") | |
| 11 | +@Data | |
| 12 | +@ExcelIgnoreUnannotated | |
| 13 | +public class UnitIntegralSubRespVO { | |
| 14 | + | |
| 15 | + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "499") | |
| 16 | + @ExcelProperty("主键ID") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "来源类型 01:派单", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 20 | + @ExcelProperty("来源类型 01:派单") | |
| 21 | + private String sourceType; | |
| 22 | + | |
| 23 | + @Schema(description = "单位类型:01:公司 02:班组 03:个人", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 24 | + @ExcelProperty("单位类型:01:公司 02:班组 03:个人") | |
| 25 | + private String unitType; | |
| 26 | + | |
| 27 | + @Schema(description = "单位ID(部门表 id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "13254") | |
| 28 | + @ExcelProperty("单位ID(部门表 id)") | |
| 29 | + private String unitId; | |
| 30 | + | |
| 31 | + @Schema(description = "单位名称(冗余,避免联表查询)", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | |
| 32 | + @ExcelProperty("单位名称(冗余,避免联表查询)") | |
| 33 | + private String unitName; | |
| 34 | + | |
| 35 | + @Schema(description = "关联任务ID(外键,关联业务表主键)", requiredMode = Schema.RequiredMode.REQUIRED, example = "21804") | |
| 36 | + @ExcelProperty("关联任务ID(外键,关联业务表主键)") | |
| 37 | + private Long relatedTaskId; | |
| 38 | + | |
| 39 | + @Schema(description = "业务名称(冗余)", example = "芋艿") | |
| 40 | + @ExcelProperty("业务名称(冗余)") | |
| 41 | + private String relatedTaskName; | |
| 42 | + | |
| 43 | + @Schema(description = "本次扣减积分(正数,存储扣减数值)", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 44 | + @ExcelProperty("本次扣减积分(正数,存储扣减数值)") | |
| 45 | + private Integer subIntegral; | |
| 46 | + | |
| 47 | + @Schema(description = "扣减原因(如:任务打回等)", requiredMode = Schema.RequiredMode.REQUIRED, example = "不香") | |
| 48 | + @ExcelProperty("扣减原因(如:任务打回等)") | |
| 49 | + private String subReason; | |
| 50 | + | |
| 51 | + @Schema(description = "扣减前总积分(对账用)") | |
| 52 | + @ExcelProperty("扣减前总积分(对账用)") | |
| 53 | + private Integer beforeIntegral; | |
| 54 | + | |
| 55 | + @Schema(description = "扣减后总积分(对账用)") | |
| 56 | + @ExcelProperty("扣减后总积分(对账用)") | |
| 57 | + private Integer afterIntegral; | |
| 58 | + | |
| 59 | + @Schema(description = "工单号") | |
| 60 | + @ExcelProperty("工单号") | |
| 61 | + private String workNo; | |
| 62 | + | |
| 63 | + @Schema(description = "备注(补充扣减的特殊说明)", example = "随便") | |
| 64 | + @ExcelProperty("备注(补充扣减的特殊说明)") | |
| 65 | + private String remark; | |
| 66 | + | |
| 67 | + @Schema(description = "积分扣减操作时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 68 | + @ExcelProperty("积分扣减操作时间") | |
| 69 | + private LocalDateTime createTime; | |
| 70 | + | |
| 71 | +} | |
| 0 | 72 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/unitintegralsub/vo/UnitIntegralSubSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.unitintegralsub.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import jakarta.validation.constraints.*; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - 积分扣减记录新增/修改 Request VO") | |
| 9 | +@Data | |
| 10 | +public class UnitIntegralSubSaveReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "499") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "来源类型 01:派单", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 16 | + @NotEmpty(message = "来源类型 01:派单不能为空") | |
| 17 | + private String sourceType; | |
| 18 | + | |
| 19 | + @Schema(description = "单位类型:01:公司 02:班组 03:个人", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 20 | + @NotEmpty(message = "单位类型:01:公司 02:班组 03:个人不能为空") | |
| 21 | + private String unitType; | |
| 22 | + | |
| 23 | + @Schema(description = "单位ID(部门表 id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "13254") | |
| 24 | + @NotEmpty(message = "单位ID(部门表 id)不能为空") | |
| 25 | + private String unitId; | |
| 26 | + | |
| 27 | + @Schema(description = "单位名称(冗余,避免联表查询)", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | |
| 28 | + @NotEmpty(message = "单位名称(冗余,避免联表查询)不能为空") | |
| 29 | + private String unitName; | |
| 30 | + | |
| 31 | + @Schema(description = "关联任务ID(外键,关联业务表主键)", requiredMode = Schema.RequiredMode.REQUIRED, example = "21804") | |
| 32 | + @NotNull(message = "关联任务ID(外键,关联业务表主键)不能为空") | |
| 33 | + private Long relatedTaskId; | |
| 34 | + | |
| 35 | + @Schema(description = "业务名称(冗余)", example = "芋艿") | |
| 36 | + private String relatedTaskName; | |
| 37 | + | |
| 38 | + @Schema(description = "本次扣减积分(正数,存储扣减数值)", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 39 | + @NotNull(message = "本次扣减积分(正数,存储扣减数值)不能为空") | |
| 40 | + private Integer subIntegral; | |
| 41 | + | |
| 42 | + @Schema(description = "扣减原因(如:任务打回等)", requiredMode = Schema.RequiredMode.REQUIRED, example = "不香") | |
| 43 | + @NotEmpty(message = "扣减原因(如:任务打回等)不能为空") | |
| 44 | + private String subReason; | |
| 45 | + | |
| 46 | + @Schema(description = "扣减前总积分(对账用)") | |
| 47 | + private Integer beforeIntegral; | |
| 48 | + | |
| 49 | + @Schema(description = "扣减后总积分(对账用)") | |
| 50 | + private Integer afterIntegral; | |
| 51 | + | |
| 52 | + @Schema(description = "工单号") | |
| 53 | + private String workNo; | |
| 54 | + | |
| 55 | + @Schema(description = "备注(补充扣减的特殊说明)", example = "随便") | |
| 56 | + private String remark; | |
| 57 | + | |
| 58 | +} | |
| 0 | 59 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/unitintegraltotal/UnitIntegralTotalController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.unitintegraltotal; | |
| 2 | + | |
| 3 | +import com.zteits.urbanops.module.garden.service.unitintegraltotal.UnitIntegralService; | |
| 4 | +import org.springframework.web.bind.annotation.*; | |
| 5 | +import jakarta.annotation.Resource; | |
| 6 | +import org.springframework.validation.annotation.Validated; | |
| 7 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 8 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 9 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 10 | +import io.swagger.v3.oas.annotations.Operation; | |
| 11 | + | |
| 12 | +import jakarta.validation.constraints.*; | |
| 13 | +import jakarta.validation.*; | |
| 14 | +import jakarta.servlet.http.*; | |
| 15 | +import java.util.*; | |
| 16 | +import java.io.IOException; | |
| 17 | + | |
| 18 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 19 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 20 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 21 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 22 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 23 | + | |
| 24 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | |
| 25 | + | |
| 26 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 27 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | |
| 28 | + | |
| 29 | +import com.zteits.urbanops.module.garden.controller.admin.unitintegraltotal.vo.*; | |
| 30 | +import com.zteits.urbanops.module.garden.dal.dataobject.unitintegraltotal.UnitIntegralTotalDO; | |
| 31 | +import com.zteits.urbanops.module.garden.service.unitintegraltotal.UnitIntegralTotalService; | |
| 32 | + | |
| 33 | +@Tag(name = "管理后台 - 单位积分累计") | |
| 34 | +@RestController | |
| 35 | +@RequestMapping("/garden/unit-integral-total") | |
| 36 | +@Validated | |
| 37 | +public class UnitIntegralTotalController { | |
| 38 | + | |
| 39 | + @Resource | |
| 40 | + private UnitIntegralTotalService unitIntegralTotalService; | |
| 41 | + | |
| 42 | + @Resource | |
| 43 | + private UnitIntegralService unitIntegralService; | |
| 44 | + | |
| 45 | + @PostMapping("/create") | |
| 46 | + @Operation(summary = "创建单位积分累计") | |
| 47 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-total:create')") | |
| 48 | + public CommonResult<Long> createUnitIntegralTotal(@Valid @RequestBody UnitIntegralTotalSaveReqVO createReqVO) { | |
| 49 | + return success(unitIntegralTotalService.createUnitIntegralTotal(createReqVO)); | |
| 50 | + } | |
| 51 | + | |
| 52 | + @PutMapping("/update") | |
| 53 | + @Operation(summary = "更新单位积分累计") | |
| 54 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-total:update')") | |
| 55 | + public CommonResult<Boolean> updateUnitIntegralTotal(@Valid @RequestBody UnitIntegralTotalSaveReqVO updateReqVO) { | |
| 56 | + unitIntegralTotalService.updateUnitIntegralTotal(updateReqVO); | |
| 57 | + return success(true); | |
| 58 | + } | |
| 59 | + | |
| 60 | + @DeleteMapping("/delete") | |
| 61 | + @Operation(summary = "删除单位积分累计") | |
| 62 | + @Parameter(name = "id", description = "编号", required = true) | |
| 63 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-total:delete')") | |
| 64 | + public CommonResult<Boolean> deleteUnitIntegralTotal(@RequestParam("id") Long id) { | |
| 65 | + unitIntegralTotalService.deleteUnitIntegralTotal(id); | |
| 66 | + return success(true); | |
| 67 | + } | |
| 68 | + | |
| 69 | + @DeleteMapping("/delete-list") | |
| 70 | + @Parameter(name = "ids", description = "编号", required = true) | |
| 71 | + @Operation(summary = "批量删除单位积分累计") | |
| 72 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-total:delete')") | |
| 73 | + public CommonResult<Boolean> deleteUnitIntegralTotalList(@RequestParam("ids") List<Long> ids) { | |
| 74 | + unitIntegralTotalService.deleteUnitIntegralTotalListByIds(ids); | |
| 75 | + return success(true); | |
| 76 | + } | |
| 77 | + | |
| 78 | + @GetMapping("/get") | |
| 79 | + @Operation(summary = "获得单位积分累计") | |
| 80 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 81 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-total:query')") | |
| 82 | + public CommonResult<UnitIntegralTotalRespVO> getUnitIntegralTotal(@RequestParam("id") Long id) { | |
| 83 | + UnitIntegralTotalDO unitIntegralTotal = unitIntegralTotalService.getUnitIntegralTotal(id); | |
| 84 | + return success(BeanUtils.toBean(unitIntegralTotal, UnitIntegralTotalRespVO.class)); | |
| 85 | + } | |
| 86 | + | |
| 87 | + @GetMapping("/page") | |
| 88 | + @Operation(summary = "获得单位积分累计分页") | |
| 89 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-total:query')") | |
| 90 | + public CommonResult<PageResult<UnitIntegralTotalRespVO>> getUnitIntegralTotalPage(@Valid UnitIntegralTotalPageReqVO pageReqVO) { | |
| 91 | + PageResult<UnitIntegralTotalDO> pageResult = unitIntegralTotalService.getUnitIntegralTotalPage(pageReqVO); | |
| 92 | + return success(BeanUtils.toBean(pageResult, UnitIntegralTotalRespVO.class)); | |
| 93 | + } | |
| 94 | + | |
| 95 | + @GetMapping("/export-excel") | |
| 96 | + @Operation(summary = "导出单位积分累计 Excel") | |
| 97 | + @PreAuthorize("@ss.hasPermission('garden:unit-integral-total:export')") | |
| 98 | + @ApiAccessLog(operateType = EXPORT) | |
| 99 | + public void exportUnitIntegralTotalExcel(@Valid UnitIntegralTotalPageReqVO pageReqVO, | |
| 100 | + HttpServletResponse response) throws IOException { | |
| 101 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 102 | + List<UnitIntegralTotalDO> list = unitIntegralTotalService.getUnitIntegralTotalPage(pageReqVO).getList(); | |
| 103 | + // 导出 Excel | |
| 104 | + ExcelUtils.write(response, "单位积分累计.xls", "数据", UnitIntegralTotalRespVO.class, | |
| 105 | + BeanUtils.toBean(list, UnitIntegralTotalRespVO.class)); | |
| 106 | + } | |
| 107 | + | |
| 108 | + @PostMapping ("/unitIntegralCreate") | |
| 109 | + public void testCreate() { | |
| 110 | + unitIntegralService.createUnitIntegral("01", "200", "测试"); | |
| 111 | + } | |
| 112 | + | |
| 113 | + @PostMapping ("/unitIntegralAdd") | |
| 114 | + public void testAdd() { | |
| 115 | + UnitIntegralSaveReqVO updateReqVO = new UnitIntegralSaveReqVO(); | |
| 116 | + updateReqVO.setTotalIntegral(100); | |
| 117 | + updateReqVO.setUnitType("01"); | |
| 118 | + updateReqVO.setUnitId("100"); | |
| 119 | + updateReqVO.setUnitName("西城园林"); | |
| 120 | + updateReqVO.setSourceType("01"); | |
| 121 | + updateReqVO.setReason("测试"); | |
| 122 | + updateReqVO.setRelatedTaskId(11111111111L); | |
| 123 | + updateReqVO.setRelatedTaskName("任务派发"); | |
| 124 | + | |
| 125 | + unitIntegralService.addUnitIntegral(updateReqVO); | |
| 126 | + } | |
| 127 | + @PostMapping ("/unitIntegralSub") | |
| 128 | + public void testSub() { | |
| 129 | + UnitIntegralSaveReqVO updateReqVO = new UnitIntegralSaveReqVO(); | |
| 130 | + updateReqVO.setTotalIntegral(100); | |
| 131 | + updateReqVO.setUnitType("01"); | |
| 132 | + updateReqVO.setUnitId("100"); | |
| 133 | + updateReqVO.setUnitName("西城园林"); | |
| 134 | + updateReqVO.setSourceType("01"); | |
| 135 | + updateReqVO.setReason("测试"); | |
| 136 | + updateReqVO.setRelatedTaskId(11111111112L); | |
| 137 | + updateReqVO.setRelatedTaskName("任务派发"); | |
| 138 | + | |
| 139 | + unitIntegralService.subUnitIntegral(updateReqVO); | |
| 140 | + } | |
| 141 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/unitintegraltotal/vo/UnitIntegralRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.unitintegraltotal.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +@Schema(description = "管理后台 - 单位积分累计新增/修改 Request VO") | |
| 7 | +@Data | |
| 8 | +public class UnitIntegralRespVO { | |
| 9 | + @Schema(description = "来源类型 01:派单", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 10 | + private String sourceType; | |
| 11 | + | |
| 12 | + @Schema(description = "关联ID(关联业务表主键)", requiredMode = Schema.RequiredMode.REQUIRED, example = "24947") | |
| 13 | + private Long relatedTaskId; | |
| 14 | + | |
| 15 | + @Schema(description = "当前总积分") | |
| 16 | + private Integer totalIntegral; | |
| 17 | + | |
| 18 | + | |
| 19 | +} | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/unitintegraltotal/vo/UnitIntegralSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.unitintegraltotal.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import jakarta.validation.constraints.NotEmpty; | |
| 5 | +import jakarta.validation.constraints.NotNull; | |
| 6 | +import lombok.Data; | |
| 7 | +import org.apache.commons.lang3.StringUtils; | |
| 8 | + | |
| 9 | +import java.time.LocalDate; | |
| 10 | +import java.time.format.DateTimeFormatter; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - 单位积分累计新增/修改 Request VO") | |
| 13 | +@Data | |
| 14 | +public class UnitIntegralSaveReqVO { | |
| 15 | + @Schema(description = "查询日期", requiredMode = Schema.RequiredMode.REQUIRED, example = "yyyy") | |
| 16 | + private String statDate; | |
| 17 | + | |
| 18 | + @Schema(description = "单位类型:01:公司 02:班组 03:个人", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 19 | + @NotEmpty(message = "单位类型:01:公司 02:班组 03:个人不能为空") | |
| 20 | + private String unitType; | |
| 21 | + | |
| 22 | + @Schema(description = "单位ID(部门表 id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "22785") | |
| 23 | + @NotEmpty(message = "单位ID(部门表 id)不能为空") | |
| 24 | + private String unitId; | |
| 25 | + | |
| 26 | + @Schema(description = "单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "西城") | |
| 27 | + @NotEmpty(message = "单位名称不能为空") | |
| 28 | + private String unitName; | |
| 29 | + | |
| 30 | + @Schema(description = "当前总积分") | |
| 31 | + private Integer totalIntegral; | |
| 32 | + | |
| 33 | + @Schema(description = "来源类型 01:派单", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 34 | + @NotEmpty(message = "来源类型 01:派单不能为空") | |
| 35 | + private String sourceType; | |
| 36 | + | |
| 37 | + @Schema(description = "关联ID(关联业务表主键)", requiredMode = Schema.RequiredMode.REQUIRED, example = "24947") | |
| 38 | + @NotNull(message = "关联ID(关联业务表主键)不能为空") | |
| 39 | + private Long relatedTaskId; | |
| 40 | + | |
| 41 | + @Schema(description = "业务名称(冗余)", example = "张三") | |
| 42 | + private String relatedTaskName; | |
| 43 | + | |
| 44 | + @Schema(description = "原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "不好") | |
| 45 | + private String reason; | |
| 46 | + | |
| 47 | + @Schema(description = "工单号") | |
| 48 | + private String workNo; | |
| 49 | + | |
| 50 | + public String getStatDate() { | |
| 51 | + if (StringUtils.isBlank(statDate)) { | |
| 52 | + // 获取当前年份,转为字符串(如 2026) | |
| 53 | + return LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy")); | |
| 54 | + } | |
| 55 | + // 2. 若有值,直接返回(兼容传入的年份) | |
| 56 | + return statDate; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public void setStatDate(String statDate) { | |
| 60 | + this.statDate = statDate; | |
| 61 | + } | |
| 62 | +} | ... | ... |