Merge remote-tracking branch 'origin/master'
正在显示
12 个修改的文件
包含
93 行增加
和
30 行删除
sk-base-common/src/main/java/com/skua/modules/system/datestandard/service/ISysStructDictService.java
... | @@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService; | ... | @@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService; |
5 | import com.skua.modules.system.datestandard.entity.SysStructDict; | 5 | import com.skua.modules.system.datestandard.entity.SysStructDict; |
6 | import com.skua.modules.system.datestandard.vo.SysStructDictVO; | 6 | import com.skua.modules.system.datestandard.vo.SysStructDictVO; |
7 | 7 | ||
8 | import java.util.Map; | ||
9 | |||
8 | /** | 10 | /** |
9 | * 构筑物字典表 | 11 | * 构筑物字典表 |
10 | */ | 12 | */ |
... | @@ -12,8 +14,10 @@ public interface ISysStructDictService extends IService<SysStructDict> { | ... | @@ -12,8 +14,10 @@ public interface ISysStructDictService extends IService<SysStructDict> { |
12 | /** | 14 | /** |
13 | * 自定义查询逻辑 | 15 | * 自定义查询逻辑 |
14 | * @param pageList | 16 | * @param pageList |
15 | * @param sysMonitorMetricInfoVO | 17 | * @param sysStructDict |
16 | * @return | 18 | * @return |
17 | */ | 19 | */ |
18 | Page<SysStructDictVO> queryCustomPageList(Page<SysStructDictVO> pageList, SysStructDict sysStructDict); | 20 | Page<SysStructDictVO> queryCustomPageList(Page<SysStructDictVO> pageList, SysStructDict sysStructDict); |
21 | |||
22 | Map<String, Map<String, String>> getListByDepart(String departId); | ||
19 | } | 23 | } | ... | ... |
1 | package com.skua.modules.system.datestandard.service.impl; | 1 | package com.skua.modules.system.datestandard.service.impl; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
3 | import com.skua.modules.system.datestandard.entity.SysStructDict; | 4 | import com.skua.modules.system.datestandard.entity.SysStructDict; |
4 | import com.skua.modules.system.datestandard.mapper.SysMonitorMetricInfoMapper; | 5 | import com.skua.modules.system.datestandard.mapper.SysMonitorMetricInfoMapper; |
5 | import com.skua.modules.system.datestandard.mapper.SysStructDictMapper; | 6 | import com.skua.modules.system.datestandard.mapper.SysStructDictMapper; |
... | @@ -12,16 +13,40 @@ import org.springframework.stereotype.Service; | ... | @@ -12,16 +13,40 @@ import org.springframework.stereotype.Service; |
12 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 13 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
13 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 14 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
14 | 15 | ||
16 | import javax.annotation.Resource; | ||
17 | import java.util.ArrayList; | ||
18 | import java.util.HashMap; | ||
19 | import java.util.List; | ||
20 | import java.util.Map; | ||
21 | |||
15 | /** | 22 | /** |
16 | * 构筑物字典表 | 23 | * 构筑物字典表 |
17 | */ | 24 | */ |
18 | @Service | 25 | @Service |
19 | public class SysStructDictServiceImpl extends ServiceImpl<SysStructDictMapper, SysStructDict> implements ISysStructDictService { | 26 | public class SysStructDictServiceImpl extends ServiceImpl<SysStructDictMapper, SysStructDict> implements ISysStructDictService { |
20 | @Autowired | 27 | |
28 | @Resource | ||
21 | private SysStructDictMapper sysStructDictMapper; | 29 | private SysStructDictMapper sysStructDictMapper; |
30 | |||
22 | @Override | 31 | @Override |
23 | public Page<SysStructDictVO> queryCustomPageList(Page<SysStructDictVO> pageList, SysStructDict sysStructDict) { | 32 | public Page<SysStructDictVO> queryCustomPageList(Page<SysStructDictVO> pageList, SysStructDict sysStructDict) { |
24 | return pageList.setRecords(sysStructDictMapper.queryCustomPageList(pageList,sysStructDict)); | 33 | return pageList.setRecords(sysStructDictMapper.queryCustomPageList(pageList,sysStructDict)); |
25 | } | 34 | } |
26 | 35 | ||
36 | @Override | ||
37 | public Map<String, Map<String, String>> getListByDepart(String departId) { | ||
38 | Map<String, Map<String, String>> map = new HashMap<>(); | ||
39 | Map<String, String> structMap = new HashMap<>(); | ||
40 | LambdaQueryWrapper<SysStructDict> queryWrapper = new LambdaQueryWrapper<SysStructDict>(); | ||
41 | queryWrapper.eq(SysStructDict::getDepartId, departId); | ||
42 | List<SysStructDict> list = sysStructDictMapper.selectList(queryWrapper); | ||
43 | if(list.size()>0){ | ||
44 | for (SysStructDict structDict : list) { | ||
45 | structMap.put(structDict.getStructName(),structDict.getId()); | ||
46 | } | ||
47 | } | ||
48 | map.put("sys_struct_dict",structMap); | ||
49 | return map; | ||
50 | } | ||
51 | |||
27 | } | 52 | } | ... | ... |
... | @@ -35,6 +35,7 @@ | ... | @@ -35,6 +35,7 @@ |
35 | <orderEntry type="library" name="Maven: com.belerweb:pinyin4j:2.5.1" level="project" /> | 35 | <orderEntry type="library" name="Maven: com.belerweb:pinyin4j:2.5.1" level="project" /> |
36 | <orderEntry type="module" module-name="sk-module-datafill" /> | 36 | <orderEntry type="module" module-name="sk-module-datafill" /> |
37 | <orderEntry type="module" module-name="sk-module-equipment" /> | 37 | <orderEntry type="module" module-name="sk-module-equipment" /> |
38 | <orderEntry type="library" name="Maven: org.springframework:spring-test:5.1.5.RELEASE" level="project" /> | ||
38 | <orderEntry type="module" module-name="sk-module-expert" /> | 39 | <orderEntry type="module" module-name="sk-module-expert" /> |
39 | <orderEntry type="library" name="Maven: com.kingtroldata:expert:2.0.0" level="project" /> | 40 | <orderEntry type="library" name="Maven: com.kingtroldata:expert:2.0.0" level="project" /> |
40 | <orderEntry type="module" module-name="sk-module-inspection" /> | 41 | <orderEntry type="module" module-name="sk-module-inspection" /> |
... | @@ -255,7 +256,6 @@ | ... | @@ -255,7 +256,6 @@ |
255 | <orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" /> | 256 | <orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" /> |
256 | <orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.5.RELEASE" level="project" /> | 257 | <orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.5.RELEASE" level="project" /> |
257 | <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.5.RELEASE" level="project" /> | 258 | <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.5.RELEASE" level="project" /> |
258 | <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.1.5.RELEASE" level="project" /> | ||
259 | <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.2" level="project" /> | 259 | <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.2" level="project" /> |
260 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.1.3.RELEASE" level="project" /> | 260 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.1.3.RELEASE" level="project" /> |
261 | <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.5.RELEASE" level="project" /> | 261 | <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.5.RELEASE" level="project" /> | ... | ... |
... | @@ -83,12 +83,23 @@ | ... | @@ -83,12 +83,23 @@ |
83 | <select id="getYhylqs" resultType="java.util.HashMap"> | 83 | <select id="getYhylqs" resultType="java.util.HashMap"> |
84 | SELECT | 84 | SELECT |
85 | LEFT( v3.time, 7 ) time, | 85 | LEFT( v3.time, 7 ) time, |
86 | (SUM( v3.NACLO ) + SUM( v3.PFS ) + SUM( v3.FHTY ) + SUM( v3.RYXNJ ) + SUM( v3.YWL ) + SUM( v3.GXCLJ ) + SUM( v3.CH3COONA ) | 86 | ROUND(SUM( IFNULL( v3.PAMZ, 0 ) )+SUM( IFNULL( v3.PAMF, 0 ) )+SUM( IFNULL( v3.PAMRJ, 0 ) )+ |
87 | + SUM( v3.HXT ) + SUM( v3.FECL3 ) + SUM( v3.SH ) + SUM( v3.CH3COOH ) + SUM( v3.FESO4G ) + SUM( v3.FESO4Y ) + SUM( v3.H2O2 ) ) AS zyl, | 87 | SUM( IFNULL( v3.SCLPAMZ, 0 ) )+SUM( IFNULL( v3.SCLPAMF, 0 ) )+ |
88 | v2.clsl, | 88 | SUM( IFNULL( v3.NACLO, 0 ) )+SUM( IFNULL( v3.PACGT, 0 ) )+SUM( IFNULL( v3.PACYT, 0 ) )+ |
89 | ROUND((SUM( v3.NACLO ) + SUM( v3.PFS ) + SUM( v3.FHTY ) + SUM( v3.RYXNJ ) + SUM( v3.YWL ) + SUM( v3.GXCLJ ) + SUM( v3.CH3COONA ) | 89 | SUM( IFNULL( v3.PFS, 0 ) )+SUM( IFNULL( v3.FHTY, 0 ) )+SUM( IFNULL( v3.RYXNJ, 0 ) )+ |
90 | + SUM( v3.HXT ) + SUM( v3.FECL3 ) + SUM( v3.SH ) + SUM( v3.CH3COOH ) + SUM( v3.FESO4G ) + SUM( v3.FESO4Y ) | 90 | SUM( IFNULL( v3.YWL, 0 ) )+SUM( IFNULL( v3.GXCLJ, 0 ) )+SUM( IFNULL( v3.CH3COONA, 0 ) )+ |
91 | + SUM( v3.H2O2 ) ) / v2.clsl, 4 ) AS dsyh | 91 | SUM( IFNULL( v3.HXT, 0 ) )+SUM( IFNULL( v3.FECL3, 0 ) )+SUM( IFNULL( v3.SH, 0 ) )+ |
92 | SUM( IFNULL( v3.CH3COOH, 0 ) )+SUM( IFNULL( v3.FESO4G, 0 ) )+SUM( IFNULL( v3.FESO4Y, 0 ) )+ | ||
93 | SUM( IFNULL( v3.H2O2, 0 ) ),4) AS zyl, | ||
94 | ROUND(v2.clsl,2) AS clsl, | ||
95 | ROUND((SUM( IFNULL( v3.PAMZ, 0 ) )+SUM( IFNULL( v3.PAMF, 0 ) )+SUM( IFNULL( v3.PAMRJ, 0 ) )+ | ||
96 | SUM( IFNULL( v3.SCLPAMZ, 0 ) )+SUM( IFNULL( v3.SCLPAMF, 0 ) )+ | ||
97 | SUM( IFNULL( v3.NACLO, 0 ) )+SUM( IFNULL( v3.PACGT, 0 ) )+SUM( IFNULL( v3.PACYT, 0 ) )+ | ||
98 | SUM( IFNULL( v3.PFS, 0 ) )+SUM( IFNULL( v3.FHTY, 0 ) )+SUM( IFNULL( v3.RYXNJ, 0 ) )+ | ||
99 | SUM( IFNULL( v3.YWL, 0 ) )+SUM( IFNULL( v3.GXCLJ, 0 ) )+SUM( IFNULL( v3.CH3COONA, 0 ) )+ | ||
100 | SUM( IFNULL( v3.HXT, 0 ) )+SUM( IFNULL( v3.FECL3, 0 ) )+SUM( IFNULL( v3.SH, 0 ) )+ | ||
101 | SUM( IFNULL( v3.CH3COOH, 0 ) )+SUM( IFNULL( v3.FESO4G, 0 ) )+SUM( IFNULL( v3.FESO4Y, 0 ) )+ | ||
102 | SUM( IFNULL( v3.H2O2, 0 ) ))/v2.clsl,4) AS dsyh | ||
92 | FROM | 103 | FROM |
93 | ${dataViewName3a24} v3 | 104 | ${dataViewName3a24} v3 |
94 | LEFT JOIN | 105 | LEFT JOIN | ... | ... |
... | @@ -89,13 +89,13 @@ spring: | ... | @@ -89,13 +89,13 @@ spring: |
89 | connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 | 89 | connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 |
90 | datasource: | 90 | datasource: |
91 | master: | 91 | master: |
92 | url: jdbc:mysql://47.104.179.187:6003/sk-zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false&connectTimeout=60000&socketTimeout=1800 | 92 | url: jdbc:mysql://47.104.179.187:6003/sk-zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false |
93 | username: root | 93 | username: root |
94 | password: jkauto@123 | 94 | password: jkauto@123 |
95 | driver-class-name: com.mysql.jdbc.Driver | 95 | driver-class-name: com.mysql.jdbc.Driver |
96 | # 恩菲数据同步 | 96 | # 恩菲数据同步 |
97 | nf-db: | 97 | nf-db: |
98 | url: jdbc:mysql://113.249.91.27:3306/zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false&connectTimeout=60000&socketTimeout=1800 | 98 | url: jdbc:mysql://113.249.91.27:3306/zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false |
99 | username: root | 99 | username: root |
100 | password: jkauto@123 | 100 | password: jkauto@123 |
101 | driver-class-name: com.mysql.jdbc.Driver | 101 | driver-class-name: com.mysql.jdbc.Driver | ... | ... |
... | @@ -89,13 +89,13 @@ spring: | ... | @@ -89,13 +89,13 @@ spring: |
89 | connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 | 89 | connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 |
90 | datasource: | 90 | datasource: |
91 | master: | 91 | master: |
92 | url: jdbc:mysql://113.249.91.27:3306/sk-zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false&connectTimeout=60000&socketTimeout=1800 | 92 | url: jdbc:mysql://113.249.91.27:3306/sk-zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false |
93 | username: root | 93 | username: root |
94 | password: jkauto@123 | 94 | password: jkauto@123 |
95 | driver-class-name: com.mysql.jdbc.Driver | 95 | driver-class-name: com.mysql.jdbc.Driver |
96 | # 恩菲数据同步 | 96 | # 恩菲数据同步 |
97 | nf-db: | 97 | nf-db: |
98 | url: jdbc:mysql://113.249.91.27:3306/zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false&connectTimeout=60000&socketTimeout=1800 | 98 | url: jdbc:mysql://113.249.91.27:3306/zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false |
99 | username: root | 99 | username: root |
100 | password: jkauto@123 | 100 | password: jkauto@123 |
101 | driver-class-name: com.mysql.jdbc.Driver | 101 | driver-class-name: com.mysql.jdbc.Driver | ... | ... |
... | @@ -89,13 +89,13 @@ spring: | ... | @@ -89,13 +89,13 @@ spring: |
89 | connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 | 89 | connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 |
90 | datasource: | 90 | datasource: |
91 | master: | 91 | master: |
92 | url: jdbc:mysql://47.104.179.187:6003/sk-zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false&connectTimeout=60000&socketTimeout=1800 | 92 | url: jdbc:mysql://47.104.179.187:6003/sk-zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false |
93 | username: root | 93 | username: root |
94 | password: jkauto@123 | 94 | password: jkauto@123 |
95 | driver-class-name: com.mysql.jdbc.Driver | 95 | driver-class-name: com.mysql.jdbc.Driver |
96 | # 恩菲数据同步 | 96 | # 恩菲数据同步 |
97 | nf-db: | 97 | nf-db: |
98 | url: jdbc:mysql://47.104.179.187:6003/sk-zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false&connectTimeout=60000&socketTimeout=1800 | 98 | url: jdbc:mysql://47.104.179.187:6003/sk-zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false |
99 | username: root | 99 | username: root |
100 | password: jkauto@123 | 100 | password: jkauto@123 |
101 | driver-class-name: com.mysql.jdbc.Driver | 101 | driver-class-name: com.mysql.jdbc.Driver | ... | ... |
... | @@ -23,7 +23,11 @@ | ... | @@ -23,7 +23,11 @@ |
23 | <artifactId>sk-module-system</artifactId> | 23 | <artifactId>sk-module-system</artifactId> |
24 | <version>1.0.0</version> | 24 | <version>1.0.0</version> |
25 | </dependency> | 25 | </dependency> |
26 | <dependency> | ||
27 | <groupId>org.springframework</groupId> | ||
28 | <artifactId>spring-test</artifactId> | ||
29 | </dependency> | ||
26 | </dependencies> | 30 | </dependencies> |
27 | 31 | ||
28 | 32 | ||
29 | </project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
33 | </project> | ... | ... |
... | @@ -33,6 +33,9 @@ | ... | @@ -33,6 +33,9 @@ |
33 | <orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" /> | 33 | <orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" /> |
34 | <orderEntry type="library" name="Maven: com.belerweb:pinyin4j:2.5.1" level="project" /> | 34 | <orderEntry type="library" name="Maven: com.belerweb:pinyin4j:2.5.1" level="project" /> |
35 | <orderEntry type="module" module-name="sk-module-system" /> | 35 | <orderEntry type="module" module-name="sk-module-system" /> |
36 | <orderEntry type="library" name="Maven: org.springframework:spring-test:5.1.5.RELEASE" level="project" /> | ||
37 | <orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.5.RELEASE" level="project" /> | ||
38 | <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.5.RELEASE" level="project" /> | ||
36 | <orderEntry type="library" name="Maven: com.kingtroldata:core:2.0.3" level="project" /> | 39 | <orderEntry type="library" name="Maven: com.kingtroldata:core:2.0.3" level="project" /> |
37 | <orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.0.1" level="project" /> | 40 | <orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.0.1" level="project" /> |
38 | <orderEntry type="library" name="Maven: org.lz4:lz4-java:1.4.1" level="project" /> | 41 | <orderEntry type="library" name="Maven: org.lz4:lz4-java:1.4.1" level="project" /> |
... | @@ -199,9 +202,6 @@ | ... | @@ -199,9 +202,6 @@ |
199 | <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" /> | 202 | <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" /> |
200 | <orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" /> | 203 | <orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" /> |
201 | <orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" /> | 204 | <orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" /> |
202 | <orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.5.RELEASE" level="project" /> | ||
203 | <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.5.RELEASE" level="project" /> | ||
204 | <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.1.5.RELEASE" level="project" /> | ||
205 | <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.2" level="project" /> | 205 | <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.2" level="project" /> |
206 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.1.3.RELEASE" level="project" /> | 206 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.1.3.RELEASE" level="project" /> |
207 | <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.5.RELEASE" level="project" /> | 207 | <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.5.RELEASE" level="project" /> | ... | ... |
1 | package com.skua.modules.equipment.controller; | 1 | package com.skua.modules.equipment.controller; |
2 | 2 | ||
3 | import java.io.File; | 3 | import java.io.*; |
4 | import java.io.InputStream; | ||
5 | import java.io.OutputStream; | ||
6 | import java.time.LocalDate; | 4 | import java.time.LocalDate; |
7 | import java.time.format.DateTimeFormatter; | 5 | import java.time.format.DateTimeFormatter; |
8 | import java.util.ArrayList; | 6 | import java.util.ArrayList; |
... | @@ -11,13 +9,8 @@ import java.util.HashMap; | ... | @@ -11,13 +9,8 @@ import java.util.HashMap; |
11 | import java.util.LinkedHashMap; | 9 | import java.util.LinkedHashMap; |
12 | import java.util.List; | 10 | import java.util.List; |
13 | import java.util.Map; | 11 | import java.util.Map; |
14 | import java.util.stream.Collectors; | ||
15 | |||
16 | import javax.servlet.http.HttpServletRequest; | 12 | import javax.servlet.http.HttpServletRequest; |
17 | import javax.servlet.http.HttpServletResponse; | 13 | import javax.servlet.http.HttpServletResponse; |
18 | |||
19 | import com.skua.modules.system.datestandard.entity.SysMetricDict; | ||
20 | import com.skua.modules.system.datestandard.service.ISysMetricDictService; | ||
21 | import org.apache.commons.lang.StringUtils; | 14 | import org.apache.commons.lang.StringUtils; |
22 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; | 15 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
23 | import org.apache.poi.ss.usermodel.Sheet; | 16 | import org.apache.poi.ss.usermodel.Sheet; |
... | @@ -26,6 +19,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; | ... | @@ -26,6 +19,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
26 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
27 | import org.springframework.core.io.ClassPathResource; | 20 | import org.springframework.core.io.ClassPathResource; |
28 | import org.springframework.core.io.Resource; | 21 | import org.springframework.core.io.Resource; |
22 | import org.springframework.mock.web.MockMultipartFile; | ||
29 | import org.springframework.transaction.TransactionStatus; | 23 | import org.springframework.transaction.TransactionStatus; |
30 | import org.springframework.transaction.support.TransactionCallbackWithoutResult; | 24 | import org.springframework.transaction.support.TransactionCallbackWithoutResult; |
31 | import org.springframework.transaction.support.TransactionTemplate; | 25 | import org.springframework.transaction.support.TransactionTemplate; |
... | @@ -679,12 +673,29 @@ public class EquipmentController { | ... | @@ -679,12 +673,29 @@ public class EquipmentController { |
679 | MultipartFile file = entity.getValue();// 获取上传文件对象 | 673 | MultipartFile file = entity.getValue();// 获取上传文件对象 |
680 | equipmentInfoService.importExcel(file,departId); | 674 | equipmentInfoService.importExcel(file,departId); |
681 | } | 675 | } |
676 | // String filePath = "D:\\app\\file\\files\\equipment.xls"; | ||
677 | // String fileName = "equipment.xls"; | ||
678 | // String contentType = "application/vnd.ms-excel"; | ||
679 | // MultipartFile file = toMultipartFile(filePath, fileName, contentType); | ||
680 | // equipmentInfoService.importExcel(file,departId); | ||
682 | return Result.ok("设备台账导入完成"); | 681 | return Result.ok("设备台账导入完成"); |
683 | } catch (Exception e) { | 682 | } catch (Exception e) { |
684 | return Result.error("设备台账导入失败"); | 683 | return Result.error("设备台账导入失败"); |
685 | } | 684 | } |
686 | } | 685 | } |
687 | 686 | ||
687 | public static MultipartFile toMultipartFile(String filePath, String fileName, String contentType) throws IOException { | ||
688 | FileInputStream inputStream = new FileInputStream(filePath); | ||
689 | InputStream resourceInputStream = inputStream; | ||
690 | try { | ||
691 | return new MockMultipartFile(fileName, fileName, contentType, resourceInputStream); | ||
692 | } finally { | ||
693 | if (inputStream != null) { | ||
694 | inputStream.close(); | ||
695 | } | ||
696 | } | ||
697 | } | ||
698 | |||
688 | @AutoLog(value = "设备台账-excel导入") | 699 | @AutoLog(value = "设备台账-excel导入") |
689 | @ApiOperation(value = "设备台账-excel导入", notes = "设备台账-excel导入") | 700 | @ApiOperation(value = "设备台账-excel导入", notes = "设备台账-excel导入") |
690 | @RequestMapping(value = "/importData", method = RequestMethod.POST) | 701 | @RequestMapping(value = "/importData", method = RequestMethod.POST) | ... | ... |
... | @@ -16,6 +16,8 @@ import com.skua.core.excel.CustomExcelUtil07; | ... | @@ -16,6 +16,8 @@ import com.skua.core.excel.CustomExcelUtil07; |
16 | import com.skua.core.excel.entity.HeadEntity; | 16 | import com.skua.core.excel.entity.HeadEntity; |
17 | import com.skua.modules.equipment.entity.EquipmentAsset; | 17 | import com.skua.modules.equipment.entity.EquipmentAsset; |
18 | import com.skua.modules.equipment.service.IEquipmentAssetService; | 18 | import com.skua.modules.equipment.service.IEquipmentAssetService; |
19 | import com.skua.modules.system.datestandard.mapper.SysStructDictMapper; | ||
20 | import com.skua.modules.system.datestandard.service.ISysStructDictService; | ||
19 | import com.skua.modules.system.service.ISysDictService; | 21 | import com.skua.modules.system.service.ISysDictService; |
20 | import org.apache.commons.lang.StringUtils; | 22 | import org.apache.commons.lang.StringUtils; |
21 | import org.apache.poi.ss.usermodel.Workbook; | 23 | import org.apache.poi.ss.usermodel.Workbook; |
... | @@ -63,6 +65,8 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E | ... | @@ -63,6 +65,8 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E |
63 | private ISequenceService sequenceService; | 65 | private ISequenceService sequenceService; |
64 | @Autowired | 66 | @Autowired |
65 | private ICrudSqlService iCrudSqlService; | 67 | private ICrudSqlService iCrudSqlService; |
68 | @Resource | ||
69 | private ISysStructDictService sysStructDictService; | ||
66 | @Autowired | 70 | @Autowired |
67 | private IEquipmentInfoExtParamService equipmentInfoExtParamService; | 71 | private IEquipmentInfoExtParamService equipmentInfoExtParamService; |
68 | @Resource | 72 | @Resource |
... | @@ -229,12 +233,14 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E | ... | @@ -229,12 +233,14 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E |
229 | Workbook wb= WorkbookFactory.create(inputStream); | 233 | Workbook wb= WorkbookFactory.create(inputStream); |
230 | //构造字典数据对象 | 234 | //构造字典数据对象 |
231 | Map<String, Map<String, String>> dictMap = new HashMap<String,Map<String,String>>(); | 235 | Map<String, Map<String, String>> dictMap = new HashMap<String,Map<String,String>>(); |
236 | Map<String, Map<String, String>> structMap = new HashMap<String,Map<String,String>>(); | ||
237 | structMap = sysStructDictService.getListByDepart(departId); | ||
232 | //基础字典 | 238 | //基础字典 |
233 | dictMap.putAll(sysDictService.getDictMap("spareTag","import"));//有无备用 | 239 | dictMap.putAll(sysDictService.getDictMap("spareTag","import"));//有无备用 |
234 | dictMap.putAll(sysDictService.getDictMap("equipment-equipment_level","import"));//设备级别 | 240 | dictMap.putAll(sysDictService.getDictMap("equipment-equipment_level","import"));//设备级别 |
235 | dictMap.putAll(sysDictService.getDictMap("equipment-equipment_status","import"));//使用状况 | 241 | dictMap.putAll(sysDictService.getDictMap("equipment-equipment_status","import"));//使用状况 |
236 | //业务字典 | 242 | //业务字典 |
237 | dictMap.putAll(sysDictService.getBusinessMap("id", "sys_struct_dict", "struct_name","import"));//构筑物 | 243 | dictMap.putAll(structMap);//构筑物 |
238 | dictMap.putAll(sysDictService.getBusinessMap("id", "ajh_supplier_manage", "supp_name","import"));//供应商 | 244 | dictMap.putAll(sysDictService.getBusinessMap("id", "ajh_supplier_manage", "supp_name","import"));//供应商 |
239 | dictMap.putAll(sysDictService.getBusinessMap("id", "equipment_brand", "brand_name","import"));//品牌 | 245 | dictMap.putAll(sysDictService.getBusinessMap("id", "equipment_brand", "brand_name","import"));//品牌 |
240 | dictMap.putAll(sysDictService.getBusinessMap("tree_path", "equipment_category", "tree_path_name","import"));//设备类别 | 246 | dictMap.putAll(sysDictService.getBusinessMap("tree_path", "equipment_category", "tree_path_name","import"));//设备类别 |
... | @@ -255,7 +261,7 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E | ... | @@ -255,7 +261,7 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E |
255 | HeadEntity headEntity7 = CustomExcelUtil.createHeadEntity("使用年限(年)", "workingLife", 7, CustomExcelUtil.FieldType.INPUT, ""); | 261 | HeadEntity headEntity7 = CustomExcelUtil.createHeadEntity("使用年限(年)", "workingLife", 7, CustomExcelUtil.FieldType.INPUT, ""); |
256 | HeadEntity headEntity8 = CustomExcelUtil.createHeadEntity("使用状况", "equipmentStatus", 8, CustomExcelUtil.FieldType.COMMON_DICT, "equipment-equipment_status"); | 262 | HeadEntity headEntity8 = CustomExcelUtil.createHeadEntity("使用状况", "equipmentStatus", 8, CustomExcelUtil.FieldType.COMMON_DICT, "equipment-equipment_status"); |
257 | headEntity8.setDictArray(dictMap.get("equipment-equipment_status").values().toArray(new String[0])); | 263 | headEntity8.setDictArray(dictMap.get("equipment-equipment_status").values().toArray(new String[0])); |
258 | HeadEntity headEntity9 = CustomExcelUtil.createHeadEntity("供应商", "manufacturer", 9, CustomExcelUtil.FieldType.BUSINESS_DICT, "ajh_supplier_manage"); | 264 | HeadEntity headEntity9 = CustomExcelUtil.createHeadEntity("厂家", "manufacturer", 9, CustomExcelUtil.FieldType.BUSINESS_DICT, "ajh_supplier_manage"); |
259 | headEntity9.setDictArray(dictMap.get("ajh_supplier_manage").values().toArray(new String[0])); | 265 | headEntity9.setDictArray(dictMap.get("ajh_supplier_manage").values().toArray(new String[0])); |
260 | HeadEntity headEntity10 = CustomExcelUtil.createHeadEntity("设备品牌", "equipmentBrand", 10, CustomExcelUtil.FieldType.BUSINESS_DICT, "equipment_brand"); | 266 | HeadEntity headEntity10 = CustomExcelUtil.createHeadEntity("设备品牌", "equipmentBrand", 10, CustomExcelUtil.FieldType.BUSINESS_DICT, "equipment_brand"); |
261 | headEntity10.setDictArray(dictMap.get("equipment_brand").values().toArray(new String[0])); | 267 | headEntity10.setDictArray(dictMap.get("equipment_brand").values().toArray(new String[0])); |
... | @@ -265,11 +271,12 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E | ... | @@ -265,11 +271,12 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E |
265 | HeadEntity headEntity14 = CustomExcelUtil.createHeadEntity("安装日期", "installDate", 14, CustomExcelUtil.FieldType.INPUT, ""); | 271 | HeadEntity headEntity14 = CustomExcelUtil.createHeadEntity("安装日期", "installDate", 14, CustomExcelUtil.FieldType.INPUT, ""); |
266 | HeadEntity headEntity15 = CustomExcelUtil.createHeadEntity("移交日期", "handoverDate", 15, CustomExcelUtil.FieldType.INPUT, ""); | 272 | HeadEntity headEntity15 = CustomExcelUtil.createHeadEntity("移交日期", "handoverDate", 15, CustomExcelUtil.FieldType.INPUT, ""); |
267 | HeadEntity headEntity16 = CustomExcelUtil.createHeadEntity("报废日期", "scrapDate", 16, CustomExcelUtil.FieldType.INPUT, ""); | 273 | HeadEntity headEntity16 = CustomExcelUtil.createHeadEntity("报废日期", "scrapDate", 16, CustomExcelUtil.FieldType.INPUT, ""); |
274 | HeadEntity headEntity17 = CustomExcelUtil.createHeadEntity("技术参数", "technicalParameter", 17, CustomExcelUtil.FieldType.INPUT, ""); | ||
268 | 275 | ||
269 | headEntityList.add(headEntity0);headEntityList.add(headEntity1);headEntityList.add(headEntity2);headEntityList.add(headEntity3);headEntityList.add(headEntity4); | 276 | headEntityList.add(headEntity0);headEntityList.add(headEntity1);headEntityList.add(headEntity2);headEntityList.add(headEntity3);headEntityList.add(headEntity4); |
270 | headEntityList.add(headEntity5);headEntityList.add(headEntity6);headEntityList.add(headEntity7); headEntityList.add(headEntity8);headEntityList.add(headEntity9); | 277 | headEntityList.add(headEntity5);headEntityList.add(headEntity6);headEntityList.add(headEntity7); headEntityList.add(headEntity8);headEntityList.add(headEntity9); |
271 | headEntityList.add(headEntity10);headEntityList.add(headEntity11);headEntityList.add(headEntity12);headEntityList.add(headEntity13);headEntityList.add(headEntity14); | 278 | headEntityList.add(headEntity10);headEntityList.add(headEntity11);headEntityList.add(headEntity12);headEntityList.add(headEntity13);headEntityList.add(headEntity14); |
272 | headEntityList.add(headEntity15);headEntityList.add(headEntity16); | 279 | headEntityList.add(headEntity15);headEntityList.add(headEntity16);headEntityList.add(headEntity17); |
273 | 280 | ||
274 | List<EquipmentInfo> excelDataList = CustomExcelUtil07.readExcel(wb, "设备台账", 0, 1, headEntityList, EquipmentInfo.class, dictMap); | 281 | List<EquipmentInfo> excelDataList = CustomExcelUtil07.readExcel(wb, "设备台账", 0, 1, headEntityList, EquipmentInfo.class, dictMap); |
275 | //新增设备 | 282 | //新增设备 | ... | ... |
... | @@ -145,6 +145,7 @@ public class ShiroConfig { | ... | @@ -145,6 +145,7 @@ public class ShiroConfig { |
145 | filterChainDefinitionMap.put("/jmeter/**", "anon"); | 145 | filterChainDefinitionMap.put("/jmeter/**", "anon"); |
146 | filterChainDefinitionMap.put("/jmReport/**", "anon"); | 146 | filterChainDefinitionMap.put("/jmReport/**", "anon"); |
147 | filterChainDefinitionMap.put("/v1/operate/**", "anon"); | 147 | filterChainDefinitionMap.put("/v1/operate/**", "anon"); |
148 | // filterChainDefinitionMap.put("/equipment/importExcel", "anon"); | ||
148 | 149 | ||
149 | //哈工大报表填报数据 | 150 | //哈工大报表填报数据 |
150 | filterChainDefinitionMap.put("/harbinTechnology/fillReport/**", "anon"); //哈工大报表填报数据 | 151 | filterChainDefinitionMap.put("/harbinTechnology/fillReport/**", "anon"); //哈工大报表填报数据 | ... | ... |
-
请 注册 或 登录 后发表评论