Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
22e8d044
由
张雷
编写于
2024-11-25 15:38:31 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
设备台账导入功能
1 个父辈
b242b3bf
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
183 行增加
和
38 行删除
sk-module-biz/src/main/java/com/skua/modules/emergency/controller/EmergencyEventsController.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/controller/EquipmentController.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/service/IEquipmentInfoService.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/service/impl/EquipmentInfoServiceImpl.java
sk-module-system/src/main/java/com/skua/config/aspect/DictAspect.java
sk-module-system/src/main/java/com/skua/modules/system/controller/PipenetworkTubewellController.java
sk-module-system/src/main/java/com/skua/modules/system/service/ISysDictService.java
sk-module-system/src/main/java/com/skua/modules/system/service/impl/SysDictServiceImpl.java
sk-module-biz/src/main/java/com/skua/modules/emergency/controller/EmergencyEventsController.java
查看文件 @
22e8d04
...
...
@@ -312,7 +312,7 @@ public class EmergencyEventsController {
lastYearData
.
add
(
String
.
valueOf
(
lastYearMap
.
getOrDefault
(
type
,
"0"
)));
}
}
Map
<
String
,
String
>
eventType
=
sysDictService
.
getDictMap
(
"emergency_event_type"
).
get
(
"emergency_event_type"
);
Map
<
String
,
String
>
eventType
=
sysDictService
.
getDictMap
(
"emergency_event_type"
,
"export"
).
get
(
"emergency_event_type"
);
for
(
int
i
=
0
;
i
<
types
.
size
();
i
++)
{
types
.
set
(
i
,
eventType
.
getOrDefault
(
types
.
get
(
i
),
""
));
}
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/controller/EquipmentController.java
查看文件 @
22e8d04
...
...
@@ -671,6 +671,23 @@ public class EquipmentController {
@AutoLog
(
value
=
"设备台账-excel导入"
)
@ApiOperation
(
value
=
"设备台账-excel导入"
,
notes
=
"设备台账-excel导入"
)
@RequestMapping
(
value
=
"/importExcel"
,
method
=
RequestMethod
.
POST
)
public
Result
<?>
importExcel
(
String
departId
,
HttpServletRequest
request
)
{
MultipartHttpServletRequest
multipartRequest
=
(
MultipartHttpServletRequest
)
request
;
Map
<
String
,
MultipartFile
>
fileMap
=
multipartRequest
.
getFileMap
();
try
{
for
(
Map
.
Entry
<
String
,
MultipartFile
>
entity
:
fileMap
.
entrySet
())
{
MultipartFile
file
=
entity
.
getValue
();
// 获取上传文件对象
equipmentInfoService
.
importExcel
(
file
,
departId
);
}
return
Result
.
ok
(
"设备台账导入完成"
);
}
catch
(
Exception
e
)
{
return
Result
.
error
(
"设备台账导入失败"
);
}
}
@AutoLog
(
value
=
"设备台账-excel导入"
)
@ApiOperation
(
value
=
"设备台账-excel导入"
,
notes
=
"设备台账-excel导入"
)
@RequestMapping
(
value
=
"/importData"
,
method
=
RequestMethod
.
POST
)
public
Result
<?>
importExcel
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
MultipartHttpServletRequest
multipartRequest
=
(
MultipartHttpServletRequest
)
request
;
Map
<
String
,
MultipartFile
>
fileMap
=
multipartRequest
.
getFileMap
();
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/service/IEquipmentInfoService.java
查看文件 @
22e8d04
package
com
.
skua
.
modules
.
equipment
.
service
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -10,6 +11,7 @@ import com.skua.modules.equipment.dto.EquipmentDTO;
import
com.skua.modules.equipment.entity.EquipmentInfo
;
import
com.skua.modules.equipment.vo.EquipmentInfoForMonitorVO
;
import
com.skua.modules.equipment.vo.EquipmentVO
;
import
org.springframework.web.multipart.MultipartFile
;
/**
* 设备信息
...
...
@@ -22,7 +24,7 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
* @param result
* @param equipmentDTO
* @author Li Yuanyuan, 2022年6月27日 下午2:24:14
* @throws Exception
* @throws Exception
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
void
addData
(
Result
<
EquipmentVO
>
result
,
EquipmentDTO
equipmentDTO
)
throws
Exception
;
...
...
@@ -55,7 +57,7 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
* @param result
* @param equipmentDTO
* @author Li Yuanyuan, 2022年6月28日 上午10:00:31
* @throws Exception
* @throws Exception
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
void
editData
(
Result
<
EquipmentVO
>
result
,
EquipmentDTO
equipmentDTO
)
throws
Exception
;
...
...
@@ -64,7 +66,7 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
* 自定义查询
* </pre>
* @param pageList
* @param equipmentInfoVO
* @param equipmentInfo
ForMonitor
VO
* @return
* @author Li Yuanyuan, 2022年6月28日 下午3:30:33
* @Description: TODO(这里描述这个方法的需求变更情况)
...
...
@@ -78,4 +80,6 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
* @return
*/
List
<
Map
<
String
,
Object
>>
getEquipmentLifeTree
(
String
id
,
String
eventType
);
void
importExcel
(
MultipartFile
file
,
String
departId
)
throws
Exception
;
}
...
...
sk-module-equipment/src/main/java/com/skua/modules/equipment/service/impl/EquipmentInfoServiceImpl.java
查看文件 @
22e8d04
package
com
.
skua
.
modules
.
equipment
.
service
.
impl
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.skua.core.context.BaseContextHandler
;
import
com.skua.core.excel.CustomExcelUtil
;
import
com.skua.core.excel.CustomExcelUtil07
;
import
com.skua.core.excel.entity.HeadEntity
;
import
com.skua.modules.equipment.entity.EquipmentAsset
;
import
com.skua.modules.equipment.service.IEquipmentAssetService
;
import
com.skua.modules.system.service.ISysDictService
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.ss.usermodel.WorkbookFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.jdbc.core.JdbcTemplate
;
...
...
@@ -35,6 +47,9 @@ import com.skua.modules.equipment.vo.EquipmentInfoForMonitorVO;
import
com.skua.modules.equipment.vo.EquipmentVO
;
import
com.skua.tool.util.BeanExtUtils
;
import
com.skua.tool.util.JoinSqlUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
/**
* 设备信息
...
...
@@ -50,12 +65,16 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
private
ICrudSqlService
iCrudSqlService
;
@Autowired
private
IEquipmentInfoExtParamService
equipmentInfoExtParamService
;
@
Autowired
@
Resource
private
EquipmentInfoExtParamMapper
equipmentInfoExtParamMapper
;
@
Autowired
@
Resource
private
EquipmentInfoMapper
equipmentInfoMapper
;
@Autowired
private
ISysDictService
sysDictService
;
@Autowired
private
IEquipmentAssetService
equipmentAssetService
;
@Override
public
void
addData
(
Result
<
EquipmentVO
>
result
,
EquipmentDTO
equipmentDTO
)
throws
Exception
{
...
...
@@ -88,7 +107,7 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
equipmentVO
.
setEquipmentExts
(
equipmentInfoExtParamVOs
);
result
.
setResult
(
equipmentVO
);
}
public
String
createQrCode
(
String
id
)
{
// 生成二维码
Map
<
String
,
String
>
map
=
new
HashMap
<>();
...
...
@@ -108,7 +127,7 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
public
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
getExtField
(
String
categoryId
,
String
equipmentId
,
String
departId
)
{
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
map
=
new
HashMap
<
String
,
List
<
Map
<
String
,
Object
>>>();
List
<
Map
<
String
,
Object
>>
list
=
equipmentInfoExtParamMapper
.
getExtField
(
categoryId
,
equipmentId
,
departId
);
List
<
Map
<
String
,
Object
>>
paramList
=
new
ArrayList
<
Map
<
String
,
Object
>>();
List
<
Map
<
String
,
Object
>>
supplementList
=
new
ArrayList
<
Map
<
String
,
Object
>>();
for
(
Map
<
String
,
Object
>
extMap
:
list
)
{
...
...
@@ -127,20 +146,19 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
@Override
public
void
editData
(
Result
<
EquipmentVO
>
result
,
EquipmentDTO
equipmentDTO
)
throws
Exception
{
Equipment
equipment
=
EquipmentUtils
.
equipDTO2Entity
(
equipmentDTO
);
// 前端未传,特殊处理
equipment
.
getEquipmentInfo
().
setAssetId
(
equipment
.
getEquipmentAsset
().
getId
());
// 校验ID是否一致
JoinSqlUtils
.
checkSqlIdFunc
(
equipment
);
EquipmentInfo
equipmentInfo
=
equipment
.
getEquipmentInfo
();
equipmentInfo
.
setQrCode
(
createQrCode
(
equipmentInfo
.
getId
()));
if
(
StringUtils
.
isNotEmpty
(
equipmentInfo
.
getStartUseDate
())
&&
equipmentInfo
.
getLimitUseYear
()
!=
null
)
{
String
[]
items
=
equipmentInfo
.
getStartUseDate
().
split
(
"-"
);
equipmentInfo
.
setAdviceReplaceDate
(
Integer
.
parseInt
(
items
[
0
])
+
equipmentInfo
.
getLimitUseYear
()
+
"-"
+
items
[
1
]
+
"-"
+
items
[
2
]);
}
iCrudSqlService
.
update
(
equipment
);
EquipmentVO
equipmentVO
=
EquipmentUtils
.
equipEntity2VO
(
equipment
);
//更新设备扩展字段
//添加技术参数、补充信息
...
...
@@ -170,7 +188,7 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
public
Page
<
EquipmentInfoForMonitorVO
>
queryCustomPageList
(
Page
<
EquipmentInfoForMonitorVO
>
pageList
,
EquipmentInfoForMonitorVO
equipmentInfoForMonitorVO
)
{
return
pageList
.
setRecords
(
equipmentInfoMapper
.
queryCustomPageList
(
pageList
,
equipmentInfoForMonitorVO
));
}
@Override
public
List
<
Map
<
String
,
Object
>>
getEquipmentLifeTree
(
String
id
,
String
eventType
)
{
JdbcTemplate
masterDb
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"master"
);
...
...
@@ -202,4 +220,108 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
}
}
@Override
public
void
importExcel
(
MultipartFile
multipartFile
,
String
departId
)
throws
Exception
{
if
(
StringUtils
.
isEmpty
(
departId
))
{
departId
=
BaseContextHandler
.
getRealDepartId
();
}
InputStream
inputStream
=
multipartFile
.
getInputStream
();
Workbook
wb
=
WorkbookFactory
.
create
(
inputStream
);
//构造字典数据对象
Map
<
String
,
Map
<
String
,
String
>>
dictMap
=
new
HashMap
<
String
,
Map
<
String
,
String
>>();
//基础字典
dictMap
.
putAll
(
sysDictService
.
getDictMap
(
"spareTag"
,
"import"
));
//有无备用
dictMap
.
putAll
(
sysDictService
.
getDictMap
(
"equipment-equipment_level"
,
"import"
));
//设备级别
dictMap
.
putAll
(
sysDictService
.
getDictMap
(
"equipment-equipment_status"
,
"import"
));
//使用状况
//业务字典
dictMap
.
putAll
(
sysDictService
.
getBusinessMap
(
"id"
,
"sys_struct_dict"
,
"struct_name"
,
"import"
));
//构筑物
dictMap
.
putAll
(
sysDictService
.
getBusinessMap
(
"id"
,
"ajh_supplier_manage"
,
"supp_name"
,
"import"
));
//供应商
dictMap
.
putAll
(
sysDictService
.
getBusinessMap
(
"id"
,
"equipment_brand"
,
"brand_name"
,
"import"
));
//品牌
dictMap
.
putAll
(
sysDictService
.
getBusinessMap
(
"tree_path"
,
"equipment_category"
,
"tree_path_name"
,
"import"
));
//设备类别
//解析excel模板
List
<
HeadEntity
>
headEntityList
=
new
ArrayList
<
HeadEntity
>();
HeadEntity
headEntity0
=
CustomExcelUtil
.
createHeadEntity
(
"设备名称"
,
"equipmentName"
,
0
,
CustomExcelUtil
.
FieldType
.
INPUT
,
""
);
HeadEntity
headEntity1
=
CustomExcelUtil
.
createHeadEntity
(
"设备类别"
,
"equipmentTypeTreePath"
,
1
,
CustomExcelUtil
.
FieldType
.
BUSINESS_DICT
,
"equipment_category"
);
headEntity1
.
setDictArray
(
dictMap
.
get
(
"equipment_category"
).
values
().
toArray
(
new
String
[
0
]));
HeadEntity
headEntity2
=
CustomExcelUtil
.
createHeadEntity
(
"有无备用"
,
"spareTag"
,
2
,
CustomExcelUtil
.
FieldType
.
COMMON_DICT
,
"spareTag"
);
headEntity2
.
setDictArray
(
dictMap
.
get
(
"spareTag"
).
values
().
toArray
(
new
String
[
0
]));
HeadEntity
headEntity3
=
CustomExcelUtil
.
createHeadEntity
(
"设备编码"
,
"equipmentCode"
,
3
,
CustomExcelUtil
.
FieldType
.
INPUT
,
""
);
HeadEntity
headEntity4
=
CustomExcelUtil
.
createHeadEntity
(
"设备级别"
,
"equipmentLevel"
,
4
,
CustomExcelUtil
.
FieldType
.
COMMON_DICT
,
"equipment-equipment_level"
);
headEntity4
.
setDictArray
(
dictMap
.
get
(
"equipment-equipment_level"
).
values
().
toArray
(
new
String
[
0
]));
HeadEntity
headEntity5
=
CustomExcelUtil
.
createHeadEntity
(
"规格型号"
,
"productModel"
,
5
,
CustomExcelUtil
.
FieldType
.
INPUT
,
""
);
HeadEntity
headEntity6
=
CustomExcelUtil
.
createHeadEntity
(
"所属构筑物"
,
"structures"
,
6
,
CustomExcelUtil
.
FieldType
.
BUSINESS_DICT
,
"sys_struct_dict"
);
headEntity6
.
setDictArray
(
dictMap
.
get
(
"sys_struct_dict"
).
values
().
toArray
(
new
String
[
0
]));
HeadEntity
headEntity7
=
CustomExcelUtil
.
createHeadEntity
(
"使用年限(年)"
,
"workingLife"
,
7
,
CustomExcelUtil
.
FieldType
.
INPUT
,
""
);
HeadEntity
headEntity8
=
CustomExcelUtil
.
createHeadEntity
(
"使用状况"
,
"equipmentStatus"
,
8
,
CustomExcelUtil
.
FieldType
.
COMMON_DICT
,
"equipment-equipment_status"
);
headEntity8
.
setDictArray
(
dictMap
.
get
(
"equipment-equipment_status"
).
values
().
toArray
(
new
String
[
0
]));
HeadEntity
headEntity9
=
CustomExcelUtil
.
createHeadEntity
(
"供应商"
,
"manufacturer"
,
9
,
CustomExcelUtil
.
FieldType
.
BUSINESS_DICT
,
"ajh_supplier_manage"
);
headEntity9
.
setDictArray
(
dictMap
.
get
(
"ajh_supplier_manage"
).
values
().
toArray
(
new
String
[
0
]));
HeadEntity
headEntity10
=
CustomExcelUtil
.
createHeadEntity
(
"设备品牌"
,
"equipmentBrand"
,
10
,
CustomExcelUtil
.
FieldType
.
BUSINESS_DICT
,
"equipment_brand"
);
headEntity10
.
setDictArray
(
dictMap
.
get
(
"equipment_brand"
).
values
().
toArray
(
new
String
[
0
]));
HeadEntity
headEntity11
=
CustomExcelUtil
.
createHeadEntity
(
"生产日期"
,
"manufactureDate"
,
11
,
CustomExcelUtil
.
FieldType
.
INPUT
,
""
);
HeadEntity
headEntity12
=
CustomExcelUtil
.
createHeadEntity
(
"购置日期"
,
"intakeDate"
,
12
,
CustomExcelUtil
.
FieldType
.
INPUT
,
""
);
HeadEntity
headEntity13
=
CustomExcelUtil
.
createHeadEntity
(
"原购置价"
,
"originalValue"
,
13
,
CustomExcelUtil
.
FieldType
.
INPUT
,
""
);
HeadEntity
headEntity14
=
CustomExcelUtil
.
createHeadEntity
(
"安装日期"
,
"installDate"
,
14
,
CustomExcelUtil
.
FieldType
.
INPUT
,
""
);
HeadEntity
headEntity15
=
CustomExcelUtil
.
createHeadEntity
(
"移交日期"
,
"handoverDate"
,
15
,
CustomExcelUtil
.
FieldType
.
INPUT
,
""
);
HeadEntity
headEntity16
=
CustomExcelUtil
.
createHeadEntity
(
"报废日期"
,
"scrapDate"
,
16
,
CustomExcelUtil
.
FieldType
.
INPUT
,
""
);
headEntityList
.
add
(
headEntity0
);
headEntityList
.
add
(
headEntity1
);
headEntityList
.
add
(
headEntity2
);
headEntityList
.
add
(
headEntity3
);
headEntityList
.
add
(
headEntity4
);
headEntityList
.
add
(
headEntity5
);
headEntityList
.
add
(
headEntity6
);
headEntityList
.
add
(
headEntity7
);
headEntityList
.
add
(
headEntity8
);
headEntityList
.
add
(
headEntity9
);
headEntityList
.
add
(
headEntity10
);
headEntityList
.
add
(
headEntity11
);
headEntityList
.
add
(
headEntity12
);
headEntityList
.
add
(
headEntity13
);
headEntityList
.
add
(
headEntity14
);
headEntityList
.
add
(
headEntity15
);
headEntityList
.
add
(
headEntity16
);
List
<
EquipmentInfo
>
excelDataList
=
CustomExcelUtil07
.
readExcel
(
wb
,
"设备台账"
,
0
,
1
,
headEntityList
,
EquipmentInfo
.
class
,
dictMap
);
//新增设备
List
<
EquipmentInfo
>
addList
=
new
ArrayList
<
EquipmentInfo
>();
List
<
EquipmentAsset
>
assetAddList
=
new
ArrayList
<
EquipmentAsset
>();
//更新设备
List
<
EquipmentInfo
>
updateList
=
new
ArrayList
<
EquipmentInfo
>();
if
(
excelDataList
!=
null
&&
excelDataList
.
size
()>
0
)
{
QueryWrapper
<
EquipmentInfo
>
qw
=
null
;
for
(
EquipmentInfo
equipmentInfo
:
excelDataList
)
{
qw
=
new
QueryWrapper
<
EquipmentInfo
>();
String
equipmentCode
=
equipmentInfo
.
getEquipmentCode
();
qw
.
eq
(
"equipment_code"
,
equipmentCode
);
List
<
EquipmentInfo
>
checkList
=
this
.
list
(
qw
);
if
(
checkList
!=
null
&&
checkList
.
size
()>
0
)
{
//存在
equipmentInfo
.
setId
(
checkList
.
get
(
0
).
getId
());
String
equipmentTypeTreePath
=
equipmentInfo
.
getEquipmentTypeTreePath
();
if
(
StringUtils
.
isNotEmpty
(
equipmentTypeTreePath
))
{
String
[]
equipmentTypeArray
=
equipmentTypeTreePath
.
split
(
","
);
equipmentInfo
.
setEquipmentTopType
(
equipmentTypeArray
[
0
]);
equipmentInfo
.
setEquipmentType
(
equipmentTypeArray
[
equipmentTypeArray
.
length
-
1
]);
}
updateList
.
add
(
equipmentInfo
);
}
else
{
//不存在
String
equipmentTypeTreePath
=
equipmentInfo
.
getEquipmentTypeTreePath
();
if
(
StringUtils
.
isNotEmpty
(
equipmentTypeTreePath
))
{
String
[]
equipmentTypeArray
=
equipmentTypeTreePath
.
split
(
","
);
equipmentInfo
.
setEquipmentTopType
(
equipmentTypeArray
[
0
]);
equipmentInfo
.
setEquipmentType
(
equipmentTypeArray
[
equipmentTypeArray
.
length
-
1
]);
}
equipmentInfo
.
setDepartId
(
departId
);
//equipment_asset表添加相关数据
EquipmentAsset
equipmentAsset
=
new
EquipmentAsset
();
String
assetId
=
String
.
valueOf
(
sequenceService
.
nextId
());
equipmentAsset
.
setId
(
assetId
);
equipmentInfo
.
setAssetId
(
assetId
);
addList
.
add
(
equipmentInfo
);
assetAddList
.
add
(
equipmentAsset
);
}
}
}
if
(
addList
.
size
()>
0
)
{
//执行批量新增
this
.
saveOrUpdateBatch
(
addList
);
equipmentAssetService
.
saveOrUpdateBatch
(
assetAddList
);
}
if
(
updateList
.
size
()>
0
)
{
//执行批量修改
this
.
saveOrUpdateBatch
(
updateList
);
}
}
}
...
...
sk-module-system/src/main/java/com/skua/config/aspect/DictAspect.java
查看文件 @
22e8d04
...
...
@@ -105,7 +105,7 @@ public class DictAspect {
if
(!
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isBlank
(
table
)){
if
(!
businessMap
.
containsKey
(
table
)){
//获取table的集合
Map
<
String
,
Map
<
String
,
String
>>
map
=
dictService
.
getBusinessMap
(
code
,
table
,
text
);
Map
<
String
,
Map
<
String
,
String
>>
map
=
dictService
.
getBusinessMap
(
code
,
table
,
text
,
"export"
);
businessMap
.
putAll
(
map
);
}
...
...
@@ -120,7 +120,7 @@ public class DictAspect {
textValue
=
textValueStringBuilder
.
toString
().
replaceFirst
(
","
,
""
);
}
else
{
if
(!
dictMap
.
containsKey
(
code
)){
Map
<
String
,
Map
<
String
,
String
>>
map
=
dictService
.
getDictMap
(
code
);
Map
<
String
,
Map
<
String
,
String
>>
map
=
dictService
.
getDictMap
(
code
,
"export"
);
dictMap
.
putAll
(
map
);
}
String
[]
keys
=
key
.
split
(
","
);
...
...
sk-module-system/src/main/java/com/skua/modules/system/controller/PipenetworkTubewellController.java
查看文件 @
22e8d04
...
...
@@ -343,17 +343,13 @@ public class PipenetworkTubewellController {
/**
* 分页列表查询
*
* @param pipenetworkTubewell
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog
(
value
=
"排水管网-管井-获取所有管井数据"
)
@ApiOperation
(
value
=
"排水管网-管井-获取所有管井数据"
,
notes
=
"排水管网-管井--获取所有管井数据"
)
@GetMapping
(
value
=
"/queryAllList"
)
public
Result
<
List
<
PipenetworkTubewell
>>
queryAllList
(
HttpServletRequest
req
)
{
public
Result
<
List
<
PipenetworkTubewell
>>
queryAllList
(
HttpServletRequest
req
)
{
Result
<
List
<
PipenetworkTubewell
>>
result
=
new
Result
<
List
<
PipenetworkTubewell
>>();
QueryWrapper
<
PipenetworkTubewell
>
pipenetworkTubewell
=
new
QueryWrapper
<>();
pipenetworkTubewell
.
eq
(
"del_flag"
,
0
);
...
...
@@ -375,22 +371,19 @@ public class PipenetworkTubewellController {
}
private
Map
<
String
,
String
>
setDictText
(
String
table
)
{
Map
<
String
,
String
>
type
=
sysDictService
.
getDictMap
(
table
).
get
(
table
);
Map
<
String
,
String
>
type
=
sysDictService
.
getDictMap
(
table
,
"export"
).
get
(
table
);
return
type
;
}
/**
* 根据管径查询管线
*
* @param gjID[]
* @param req
* @param gjID
* @return
*/
@AutoLog
(
value
=
"排水管网-管线-分页列表查询"
)
@ApiOperation
(
value
=
"排水管网-管线-分页列表查询"
,
notes
=
"排水管网-管线-分页列表查询"
)
@GetMapping
(
value
=
"/queryPipelineBytubWells"
)
public
Result
<
List
<
PipenetworkPipeline
>>
queryPipelineBytubWells
(
String
[]
gjID
,
HttpServletRequest
req
)
{
public
Result
<
List
<
PipenetworkPipeline
>>
queryPipelineBytubWells
(
String
[]
gjID
)
{
Result
<
List
<
PipenetworkPipeline
>>
result
=
new
Result
<
List
<
PipenetworkPipeline
>>();
String
ids
=
""
;
for
(
String
id
:
gjID
)
{
...
...
sk-module-system/src/main/java/com/skua/modules/system/service/ISysDictService.java
查看文件 @
22e8d04
...
...
@@ -99,9 +99,9 @@ public interface ISysDictService extends IService<SysDict> {
<
T
>
List
<
JSONObject
>
translateListDictValue
(
List
<
T
>
list
);
Map
<
String
,
Map
<
String
,
String
>>
getDictMap
(
String
code
);
Map
<
String
,
Map
<
String
,
String
>>
getDictMap
(
String
code
,
String
type
);
Map
<
String
,
Map
<
String
,
String
>>
getBusinessMap
(
String
code
,
String
table
,
String
text
);
Map
<
String
,
Map
<
String
,
String
>>
getBusinessMap
(
String
code
,
String
table
,
String
text
,
String
type
);
String
queryDictIdByCode
(
String
code
);
...
...
sk-module-system/src/main/java/com/skua/modules/system/service/impl/SysDictServiceImpl.java
查看文件 @
22e8d04
...
...
@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.Resource
;
import
java.lang.reflect.Field
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -35,9 +36,9 @@ import java.util.stream.Collectors;
@Slf4j
public
class
SysDictServiceImpl
extends
ServiceImpl
<
SysDictMapper
,
SysDict
>
implements
ISysDictService
{
@
Autowired
@
Resource
private
SysDictMapper
sysDictMapper
;
@
Autowired
@
Resource
private
SysDictItemMapper
sysDictItemMapper
;
@Override
...
...
@@ -221,7 +222,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
@Override
public
Map
<
String
,
String
>
getDictMapByCode
(
String
code
)
{
return
this
.
getDictMap
(
code
).
get
(
code
);
return
this
.
getDictMap
(
code
,
"export"
).
get
(
code
);
}
@Override
public
<
T
>
List
<
JSONObject
>
translateListDictValue
(
List
<
T
>
list
)
{
...
...
@@ -250,13 +251,13 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
if
(!
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isBlank
(
table
))
{
if
(!
businessMap
.
containsKey
(
table
))
{
//获取table的集合
Map
<
String
,
Map
<
String
,
String
>>
map
=
getBusinessMap
(
code
,
table
,
text
);
Map
<
String
,
Map
<
String
,
String
>>
map
=
getBusinessMap
(
code
,
table
,
text
,
"export"
);
businessMap
.
putAll
(
map
);
}
textValue
=
businessMap
.
get
(
table
).
get
(
key
);
}
else
{
if
(!
dictMap
.
containsKey
(
code
))
{
Map
<
String
,
Map
<
String
,
String
>>
map
=
getDictMap
(
code
);
Map
<
String
,
Map
<
String
,
String
>>
map
=
getDictMap
(
code
,
"export"
);
dictMap
.
putAll
(
map
);
}
if
(!
StringUtils
.
isEmpty
(
key
)&&
key
.
split
(
","
).
length
>
1
)
{
...
...
@@ -291,24 +292,32 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
}
@Override
public
Map
<
String
,
Map
<
String
,
String
>>
getDictMap
(
String
code
)
{
public
Map
<
String
,
Map
<
String
,
String
>>
getDictMap
(
String
code
,
String
type
)
{
Map
<
String
,
Map
<
String
,
String
>>
dictMap
=
new
HashMap
<>();
List
<
Map
<
String
,
String
>>
listMap
=
sysDictMapper
.
getDictMapByCode
(
code
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
listMap
.
forEach
(
map1
->
{
map
.
put
(
map1
.
get
(
"item_value"
),
map1
.
get
(
"item_text"
));
if
(
"export"
.
equals
(
type
))
{
map
.
put
(
map1
.
get
(
"item_value"
),
map1
.
get
(
"item_text"
));
}
else
{
map
.
put
(
map1
.
get
(
"item_text"
),
map1
.
get
(
"item_value"
));
}
});
dictMap
.
put
(
code
,
map
);
return
dictMap
;
}
@Override
public
Map
<
String
,
Map
<
String
,
String
>>
getBusinessMap
(
String
code
,
String
table
,
String
text
)
{
public
Map
<
String
,
Map
<
String
,
String
>>
getBusinessMap
(
String
code
,
String
table
,
String
text
,
String
type
)
{
Map
<
String
,
Map
<
String
,
String
>>
businessMap
=
new
HashMap
<>();
List
<
Map
<
String
,
String
>>
listMap
=
sysDictMapper
.
getBusinessMapByTable
(
code
,
table
,
text
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
listMap
.
forEach
(
map1
->
{
map
.
put
(
String
.
valueOf
(
map1
.
get
(
code
)),
map1
.
get
(
text
));
if
(
"export"
.
equals
(
type
))
{
map
.
put
(
String
.
valueOf
(
map1
.
get
(
code
)),
map1
.
get
(
text
));
}
else
{
map
.
put
(
map1
.
get
(
text
),
String
.
valueOf
(
map1
.
get
(
code
)));
}
});
businessMap
.
put
(
table
,
map
);
return
businessMap
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论