Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
e3bcc68a
Commit
e3bcc68a
authored
Mar 26, 2024
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加筛选项级联过滤
parent
78aac8fe
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
178 additions
and
107 deletions
+178
-107
IdxBizFanPointProcessVariableClassificationController.java
...dxBizFanPointProcessVariableClassificationController.java
+18
-2
IdxBizTableController.java
...ot/module/jxiop/biz/controller/IdxBizTableController.java
+37
-30
IdxBizTableMapper.java
...amos/boot/module/jxiop/biz/mapper2/IdxBizTableMapper.java
+2
-1
IIdxBizTableService.java
...os/boot/module/jxiop/biz/service/IIdxBizTableService.java
+1
-1
IdxBizTableServiceImpl.java
...module/jxiop/biz/service/impl/IdxBizTableServiceImpl.java
+113
-73
IdxBizTableMapper.xml
...z/src/main/resources/mapper/cluster/IdxBizTableMapper.xml
+7
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/IdxBizFanPointProcessVariableClassificationController.java
View file @
e3bcc68a
...
...
@@ -5,6 +5,9 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointProcessVariableClassificationDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizTableService
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanPointProcessVariableClassificationServiceImpl
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -15,6 +18,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -124,13 +129,24 @@ public class IdxBizFanPointProcessVariableClassificationController extends BaseC
* 列表全部数据查询
*
* @return
* @throws UnsupportedEncodingException
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表全部数据查询"
,
notes
=
"列表全部数据查询"
)
@GetMapping
(
value
=
"/selectParams"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
selectParams
(
String
tableName
,
String
column
,
@RequestParam
(
required
=
false
)
String
isFx
)
{
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
selectParams
()
throws
UnsupportedEncodingException
{
String
queryString
=
request
.
getQueryString
();
String
[]
paramPairs
=
queryString
.
split
(
"&"
);
Map
<
String
,
String
>
params
=
new
HashMap
<>();
for
(
String
paramPair
:
paramPairs
)
{
String
[]
keyValue
=
paramPair
.
split
(
"="
);
String
key
=
keyValue
[
0
];
String
value
=
keyValue
[
1
];
value
=
URLDecoder
.
decode
(
value
,
"utf-8"
);
params
.
put
(
key
,
value
);
}
// return ResponseHelper.buildResponse(idxBizFanPointProcessVariableClassificationServiceImpl.selectParams(column,tableName,isFx));
List
<
Map
<
String
,
Object
>>
selectOptions
=
idxBizTableService
.
getSelectOptions
(
tableName
,
column
,
null
,
null
,
null
,
isFx
);
List
<
Map
<
String
,
Object
>>
selectOptions
=
idxBizTableService
.
getSelectOptions
(
params
);
return
ResponseHelper
.
buildResponse
(
selectOptions
);
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/IdxBizTableController.java
View file @
e3bcc68a
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizTableService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -14,43 +15,49 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@RestController
@Api
(
tags
=
"idx业务前置接口"
)
@RequestMapping
(
value
=
"/idx"
)
public
class
IdxBizTableController
{
public
class
IdxBizTableController
extends
BaseController
{
@Autowired
IIdxBizTableService
idxBizTableService
;
@Autowired
IIdxBizTableService
idxBizTableService
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询业务事实表的数据"
,
notes
=
"分页查询业务事实表的数据-IDX前置接口"
)
@GetMapping
(
value
=
"/table/getPage"
)
public
ResponseModel
<
Page
<
Map
<
String
,
Object
>>>
getTablePage
(
@RequestParam
Map
<
String
,
Object
>
map
)
{
return
ResponseHelper
.
buildResponse
(
idxBizTableService
.
getPage
(
map
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询业务事实表的数据"
,
notes
=
"分页查询业务事实表的数据-IDX前置接口"
)
@GetMapping
(
value
=
"/table/getPageO"
)
public
ResponseModel
<
Page
<
Map
<
String
,
Object
>>>
getPageO
(
@RequestParam
Map
<
String
,
Object
>
map
)
{
return
ResponseHelper
.
buildResponse
(
idxBizTableService
.
getPageO
(
map
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询业务事实表的数据"
,
notes
=
"分页查询业务事实表的数据-IDX前置接口"
)
@GetMapping
(
value
=
"/table/getPage"
)
public
ResponseModel
<
Page
<
Map
<
String
,
Object
>>>
getTablePage
(
@RequestParam
Map
<
String
,
Object
>
map
)
{
return
ResponseHelper
.
buildResponse
(
idxBizTableService
.
getPage
(
map
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表下拉框选项数据"
,
notes
=
"列表下拉框选项数据"
)
@GetMapping
(
value
=
"/select-options"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
getSelectOptions
(
@RequestParam
(
value
=
"tableName"
)
String
tableName
,
@RequestParam
(
value
=
"column"
)
String
column
,
@RequestParam
(
value
=
"valueColumn"
,
required
=
false
)
String
valueColumn
,
@RequestParam
(
value
=
"conditionColumn"
,
required
=
false
)
String
conditionColumn
,
@RequestParam
(
value
=
"conditionValue"
,
required
=
false
)
String
conditionValue
,
@RequestParam
(
value
=
"isFx"
,
required
=
false
)
String
isFx
)
{
List
<
Map
<
String
,
Object
>>
selectOptions
=
idxBizTableService
.
getSelectOptions
(
tableName
,
column
,
valueColumn
,
conditionColumn
,
conditionValue
,
isFx
);
return
ResponseHelper
.
buildResponse
(
selectOptions
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询业务事实表的数据"
,
notes
=
"分页查询业务事实表的数据-IDX前置接口"
)
@GetMapping
(
value
=
"/table/getPageO"
)
public
ResponseModel
<
Page
<
Map
<
String
,
Object
>>>
getPageO
(
@RequestParam
Map
<
String
,
Object
>
map
)
{
return
ResponseHelper
.
buildResponse
(
idxBizTableService
.
getPageO
(
map
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表下拉框选项数据"
,
notes
=
"列表下拉框选项数据"
)
@GetMapping
(
value
=
"/select-options"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
getSelectOptions
()
throws
UnsupportedEncodingException
{
String
queryString
=
request
.
getQueryString
();
String
[]
paramPairs
=
queryString
.
split
(
"&"
);
Map
<
String
,
String
>
params
=
new
HashMap
<>();
for
(
String
paramPair
:
paramPairs
)
{
String
[]
keyValue
=
paramPair
.
split
(
"="
);
String
key
=
keyValue
[
0
];
String
value
=
keyValue
[
1
];
value
=
URLDecoder
.
decode
(
value
,
"utf-8"
);
params
.
put
(
key
,
value
);
}
List
<
Map
<
String
,
Object
>>
selectOptions
=
idxBizTableService
.
getSelectOptions
(
params
);
return
ResponseHelper
.
buildResponse
(
selectOptions
);
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/mapper2/IdxBizTableMapper.java
View file @
e3bcc68a
...
...
@@ -14,6 +14,7 @@ public interface IdxBizTableMapper extends BaseMapper {
@Param
(
"conditionColumn"
)
String
conditionColumn
,
@Param
(
"conditionValue"
)
String
conditionValue
,
@Param
(
"isFx"
)
String
isFx
,
@Param
(
"gatewayIds"
)
List
<
String
>
gatewayIds
@Param
(
"gatewayIds"
)
List
<
String
>
gatewayIds
,
@Param
(
"filters"
)
List
<
Map
<
String
,
String
>>
filters
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/IIdxBizTableService.java
View file @
e3bcc68a
...
...
@@ -30,5 +30,5 @@ public interface IIdxBizTableService {
* @param conditionValue 条件值
* @param isFx 是否是"分析变量"
*/
List
<
Map
<
String
,
Object
>>
getSelectOptions
(
String
tableName
,
String
column
,
String
valueColumn
,
String
conditionColumn
,
String
conditionValue
,
String
isFx
);
List
<
Map
<
String
,
Object
>>
getSelectOptions
(
Map
<
String
,
String
>
map
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/IdxBizTableServiceImpl.java
View file @
e3bcc68a
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jxiop.api.feign.IdxFeign
;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizTableMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizTableService
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
lombok.extern.slf4j.Slf4j
;
@Service
@Slf4j
public
class
IdxBizTableServiceImpl
implements
IIdxBizTableService
{
@Autowired
private
IPermissionService
permissionService
;
@Autowired
private
IPermissionService
permissionService
;
@Autowired
private
IdxBizTableMapper
idxBizTableMapper
;
@Autowired
private
IdxFeign
idxFeign
;
@Autowired
private
IdxBizTableMapper
idxBizTableMapper
;
private
static
Map
<
String
,
String
>
cmap
=
new
HashMap
<>();
private
static
String
[]
tableNames
=
{
"idx_biz_fan_point_process_variable_classification"
,
"idx_biz_pv_point_process_variable_classification"
};
@Autowired
private
IdxFeign
idxFeign
;
//初始化表列对应map
static
{
cmap
.
put
(
"area"
,
"ARAE"
);
cmap
.
put
(
"station"
,
"STATION"
);
cmap
.
put
(
"number"
,
"NUMBER"
);
cmap
.
put
(
"equipmentName"
,
"EQUIPMENT_NAME"
);
cmap
.
put
(
"subSystem"
,
"SUB_SYSTEM"
);
cmap
.
put
(
"pointName"
,
"ANALYSIS_POINT_NAME"
);
cmap
.
put
(
"subarray"
,
"SUBARRAY"
);
}
/**
* 分页查询业务事实表的数据-IDX(/idx/table/getPage)前置接口, 增加权限控制
*
* @param map 查询参数
*/
public
Page
<
Map
<
String
,
Object
>>
getPage
(
Map
<
String
,
Object
>
map
)
{
List
<
String
>
currentUserPermissions
=
permissionService
.
getCurrentUserPermissions
();
if
(
Objects
.
isNull
(
currentUserPermissions
))
{
currentUserPermissions
=
new
ArrayList
<>();
}
String
gatewayIds
=
String
.
join
(
","
,
currentUserPermissions
);
if
(!
gatewayIds
.
isEmpty
())
{
map
.
put
(
"GATEWAY_ID"
,
String
.
format
(
"[%s]"
,
gatewayIds
));
}
else
{
map
.
put
(
"GATEWAY_ID"
,
"[NULL]"
);
}
FeignClientResult
<
Page
<
Map
<
String
,
Object
>>>
page
=
idxFeign
.
getPage
(
map
);
return
page
.
getResult
();
}
/**
* 分页查询业务事实表的数据-IDX(/idx/table/getPage)前置接口, 增加权限控制
*
* @param map 查询参数
*/
public
Page
<
Map
<
String
,
Object
>>
getPage
(
Map
<
String
,
Object
>
map
)
{
List
<
String
>
currentUserPermissions
=
permissionService
.
getCurrentUserPermissions
();
if
(
Objects
.
isNull
(
currentUserPermissions
))
{
currentUserPermissions
=
new
ArrayList
<>();
}
String
gatewayIds
=
String
.
join
(
","
,
currentUserPermissions
);
if
(!
gatewayIds
.
isEmpty
())
{
map
.
put
(
"GATEWAY_ID"
,
String
.
format
(
"[%s]"
,
gatewayIds
));
}
else
{
map
.
put
(
"GATEWAY_ID"
,
"[NULL]"
);
}
FeignClientResult
<
Page
<
Map
<
String
,
Object
>>>
page
=
idxFeign
.
getPage
(
map
);
return
page
.
getResult
();
}
/**
* 分页查询业务事实表的数据-IDX(/idx/table/getPage)前置接口, 增加权限控制
*
* @param map 查询参数
*/
public
Page
<
Map
<
String
,
Object
>>
getPageO
(
Map
<
String
,
Object
>
map
)
{
List
<
String
>
currentUserPermissions
=
permissionService
.
getCurrentUserProjectOrgCodes
();
if
(
Objects
.
isNull
(
currentUserPermissions
))
{
currentUserPermissions
=
new
ArrayList
<>();
}
String
orgcodes
=
String
.
join
(
","
,
currentUserPermissions
);
if
(!
orgcodes
.
isEmpty
())
{
map
.
put
(
"ORG_CODE"
,
String
.
format
(
"[%s]"
,
orgcodes
));
}
else
{
map
.
put
(
"ORG_CODE"
,
"[NULL]"
);
}
FeignClientResult
<
Page
<
Map
<
String
,
Object
>>>
page
=
idxFeign
.
getPage
(
map
);
return
page
.
getResult
();
}
/**
* 分页查询业务事实表的数据-IDX(/idx/table/getPage)前置接口, 增加权限控制
*
* @param map 查询参数
*/
public
Page
<
Map
<
String
,
Object
>>
getPageO
(
Map
<
String
,
Object
>
map
)
{
List
<
String
>
currentUserPermissions
=
permissionService
.
getCurrentUserProjectOrgCodes
();
if
(
Objects
.
isNull
(
currentUserPermissions
))
{
currentUserPermissions
=
new
ArrayList
<>();
}
String
orgcodes
=
String
.
join
(
","
,
currentUserPermissions
);
if
(!
orgcodes
.
isEmpty
())
{
map
.
put
(
"ORG_CODE"
,
String
.
format
(
"[%s]"
,
orgcodes
));
}
else
{
map
.
put
(
"ORG_CODE"
,
"[NULL]"
);
}
FeignClientResult
<
Page
<
Map
<
String
,
Object
>>>
page
=
idxFeign
.
getPage
(
map
);
return
page
.
getResult
();
}
/**
* 获取下拉列表参数
*
* @param tableName 表名
* @param column 列名
* @param valueColumn 数据值列
* @param conditionColumn 条件列名
* @param conditionValue 条件值
* @param isFx 是否是"分析变量"
*/
@Override
public
List
<
Map
<
String
,
Object
>>
getSelectOptions
(
String
tableName
,
String
column
,
String
valueColumn
,
String
conditionColumn
,
String
conditionValue
,
String
isFx
)
{
// List<String> permissions = permissionService.getCurrentUserPermissions();
List
<
String
>
permissions
=
permissionService
.
getCurrentUserProjectOrgCodes
();
if
(
Objects
.
isNull
(
permissions
))
{
permissions
=
new
ArrayList
<>();
permissions
.
add
(
"NULL"
);
}
return
idxBizTableMapper
.
getSelectOptions
(
tableName
,
column
,
valueColumn
,
conditionColumn
,
conditionValue
,
isFx
,
permissions
);
}
/**
* 获取下拉列表参数
*
* @param tableName 表名
* @param column 列名
* @param valueColumn 数据值列
* @param conditionColumn 条件列名
* @param conditionValue 条件值
* @param isFx 是否是"分析变量"
*/
@Override
public
List
<
Map
<
String
,
Object
>>
getSelectOptions
(
Map
<
String
,
String
>
map
)
{
// List<String> permissions = permissionService.getCurrentUserPermissions();
String
tableName
=
map
.
get
(
"tableName"
);
map
.
remove
(
"tableName"
);
String
column
=
map
.
get
(
"column"
);
map
.
remove
(
"column"
);
String
valueColumn
=
map
.
get
(
"valueColumn"
);
map
.
remove
(
"valueColumn"
);
String
conditionColumn
=
map
.
get
(
"conditionColumn"
);
map
.
remove
(
"conditionColumn"
);
String
conditionValue
=
map
.
get
(
"conditionValue"
);
map
.
remove
(
"conditionValue"
);
String
isFx
=
map
.
get
(
"isFx"
);
map
.
remove
(
"isFx"
);
List
<
String
>
permissions
=
permissionService
.
getCurrentUserProjectOrgCodes
();
List
<
Map
<
String
,
String
>>
filters
=
new
ArrayList
<>();
map
.
forEach
((
key
,
value
)
->
{
Map
<
String
,
String
>
smap
=
new
HashMap
<>();
if
(
Arrays
.
asList
(
tableNames
).
contains
(
tableName
)&&
cmap
.
containsKey
(
key
))
{
key
=
cmap
.
get
(
key
);
}
smap
.
put
(
"column"
,
key
);
smap
.
put
(
"value"
,
value
);
filters
.
add
(
smap
);
});
if
(
Objects
.
isNull
(
permissions
))
{
permissions
=
new
ArrayList
<>();
permissions
.
add
(
"NULL"
);
}
return
idxBizTableMapper
.
getSelectOptions
(
tableName
,
column
,
valueColumn
,
conditionColumn
,
conditionValue
,
isFx
,
permissions
,
filters
);
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/cluster/IdxBizTableMapper.xml
View file @
e3bcc68a
...
...
@@ -31,6 +31,13 @@
AND 1 = 2
</if>
</if>
<if
test=
"filters != null"
>
<if
test=
"filters.size() > 0"
>
<foreach
collection=
"filters"
item=
"item"
>
AND ${item.column} = #{item.value}
</foreach>
</if>
</if>
GROUP BY
${column}
</select>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment