Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
f407fb7e
Commit
f407fb7e
authored
Nov 23, 2023
by
guojx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据通用接口&指标
parent
237df35a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
258 additions
and
0 deletions
+258
-0
DataController.java
...gic/haoban/manage/web/controller/data/DataController.java
+107
-0
DataIndexExplainVO.java
...com/gic/haoban/manage/web/qo/data/DataIndexExplainVO.java
+64
-0
DataIndexQO.java
...n/java/com/gic/haoban/manage/web/qo/data/DataIndexQO.java
+42
-0
HandleQO.java
...main/java/com/gic/haoban/manage/web/qo/data/HandleQO.java
+44
-0
dubbo-haoban-manage-wx.xml
...ge3-wx/src/main/webapp/WEB-INF/dubbo-haoban-manage-wx.xml
+1
-0
No files found.
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/data/DataController.java
0 → 100644
View file @
f407fb7e
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
.
data
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.util.DataApiUtils
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.api.dto.data.DataIndexEvaluateLogDTO
;
import
com.gic.enterprise.api.dto.data.DataIndexExplainDTO
;
import
com.gic.enterprise.api.service.data.DataIndexApiService
;
import
com.gic.haoban.manage.web.qo.data.DataIndexExplainVO
;
import
com.gic.haoban.manage.web.qo.data.DataIndexQO
;
import
com.gic.haoban.manage.web.qo.data.HandleQO
;
import
com.gic.haoban.manage.web.utils.StoreAuthUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* 数据调用通用接口
* @Author guojx
* @Date 2023/11/14 10:56
*/
@RestController
@RequestMapping
(
"data"
)
@Slf4j
public
class
DataController
{
@Autowired
private
StoreAuthUtils
storeAuthUtils
;
@Autowired
private
DataIndexApiService
dataIndexApiService
;
/**
* 数据统一调用接口
* 参数与返回字段查询数据组的yapi的对应文档
* @param qo
* @return
*/
@RequestMapping
(
value
=
"handle"
)
public
RestResponse
handle
(
@RequestBody
HandleQO
qo
)
{
String
params
=
qo
.
getParams
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
params
);
if
(
jsonObject
==
null
)
{
jsonObject
=
new
JSONObject
();
}
if
(
StringUtils
.
isNotBlank
(
qo
.
getEnterpriseId
()))
{
jsonObject
.
put
(
"enterpriseId"
,
qo
.
getWxEnterpriseId
());
}
List
<
String
>
storeIdList
=
new
ArrayList
<>();
String
storeId
=
qo
.
getStoreId
();
if
(
StringUtils
.
isBlank
(
storeId
))
{
storeIdList
=
storeAuthUtils
.
queryClerkStoreIds
(
qo
.
getClerkId
(),
qo
.
getWxEnterpriseId
());
}
else
{
storeIdList
.
add
(
storeId
);
}
if
(
CollectionUtils
.
isNotEmpty
(
storeIdList
))
{
//区经有全部门店权限
jsonObject
.
put
(
"storeId"
,
storeIdList
.
stream
().
collect
(
Collectors
.
joining
(
","
)));
}
Map
<
String
,
Object
>
res
=
DataApiUtils
.
http
(
params
,
qo
.
getApolloKey
());
JSONObject
data
=
(
JSONObject
)
res
.
get
(
"data"
);
return
RestResponse
.
successResult
(
data
);
}
/**
* 指标字典列表
* @return
*/
@RequestMapping
(
"list-data-index-explain"
)
public
RestResponse
<
List
<
DataIndexExplainVO
>>
listDataIndexExplain
()
{
List
<
DataIndexExplainDTO
>
list
=
dataIndexApiService
.
listDataIndexExplain
();
return
RestResponse
.
successResult
(
EntityUtil
.
changeEntityListNew
(
DataIndexExplainVO
.
class
,
list
));
}
/**
* 评价指标
* @param qo
* @return
*/
@RequestMapping
(
"evaluate-data-index"
)
public
RestResponse
saveDataIndexEvaluate
(
@RequestBody
DataIndexQO
qo
)
{
DataIndexEvaluateLogDTO
log
=
EntityUtil
.
changeEntityNew
(
DataIndexEvaluateLogDTO
.
class
,
qo
);
log
.
setAccountId
(
qo
.
getClerkId
());
log
.
setSourceType
(
1
);
dataIndexApiService
.
saveDataIndexEvaluateLog
(
log
);
return
RestResponse
.
successResult
();
}
private
JSONObject
getTotalJson
(
JSONObject
param
,
String
apolloKey
)
{
Map
<
String
,
Object
>
totalRes
=
DataApiUtils
.
http
(
param
.
toJSONString
(),
apolloKey
);
List
<
JSONObject
>
totalList
=
DataApiUtils
.
getPageList
(
totalRes
);
if
(
CollectionUtils
.
isEmpty
(
totalList
))
{
return
null
;
}
JSONObject
total
=
totalList
.
get
(
0
);
return
total
;
}
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/qo/data/DataIndexExplainVO.java
0 → 100644
View file @
f407fb7e
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
.
data
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.Serializable
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @Author guojx
* @Date 2023/9/27 11:13
*/
@Data
public
class
DataIndexExplainVO
implements
Serializable
{
private
String
id
;
private
String
indexCode
;
private
String
indexName
;
private
String
indexExplain
;
/**
* 前端使用:指标说明:若指标注释中有需要说明的
*/
private
List
<
String
>
indexRemarkList
;
/**
* 前端使用:指标例子
*/
private
List
<
String
>
indexExampleList
;
/**
* 指标说明:若指标注释中有需要说明的,英文分号隔开,可能多个。
*/
private
String
indexRemark
;
/**
* 指标例子: 英文分号隔开,可能多个
*/
private
String
indexExample
;
/**
* yapi文档上的驼峰字段名称
*/
private
String
apiColName
;
public
List
<
String
>
getIndexRemarkList
()
{
if
(
StringUtils
.
isNotBlank
(
indexRemark
))
{
return
Arrays
.
stream
(
indexRemark
.
split
(
";"
)).
collect
(
Collectors
.
toList
());
}
return
indexRemarkList
;
}
public
List
<
String
>
getIndexExampleList
()
{
if
(
StringUtils
.
isNotBlank
(
indexExample
))
{
return
Arrays
.
stream
(
indexExample
.
split
(
";"
)).
collect
(
Collectors
.
toList
());
}
return
indexExampleList
;
}
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/qo/data/DataIndexQO.java
0 → 100644
View file @
f407fb7e
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
.
data
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Author guojx
* @Date 2023/9/27 11:06
*/
@Data
public
class
DataIndexQO
implements
Serializable
{
/**
* 指标code
*/
private
String
indexCode
;
/**
* 指标名称
*/
private
String
indexName
;
/**
* 0:不满意 1:满意
*/
private
Integer
indexEvaluate
;
/**
* 不满意原因
*/
private
String
reason
;
/**
* 自定义原因
*/
private
String
customReason
;
private
String
enterpriseId
;
private
String
clerkId
;
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/qo/data/HandleQO.java
0 → 100644
View file @
f407fb7e
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
.
data
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Author guojx
* @Date 2023/11/23 9:13
*/
@Data
public
class
HandleQO
implements
Serializable
{
/**
* 组装的参数,JSON字符串.数据组提供的yapi文档上有.
* 注:门店参数storeId根据storeSelect参数计算
*/
private
String
params
;
/**
* 数据组配置的接口key。数据组提供的yapi文档上有
*/
private
String
apolloKey
;
/**
* 门店查询参数. 区经可以为空,查询所有管辖门店
*/
private
String
storeId
;
/**
* 企业ID.
*/
private
String
enterpriseId
;
/**
* 微信企业
*/
private
String
wxEnterpriseId
;
/**
* 如果是区经,用于查询管辖门店权限
*/
private
String
clerkId
;
}
haoban-manage3-wx/src/main/webapp/WEB-INF/dubbo-haoban-manage-wx.xml
View file @
f407fb7e
...
...
@@ -161,4 +161,5 @@
<dubbo:reference
interface=
"com.gic.enterprise.api.service.content.ValueAddedServicesOrderApiService"
id=
"valueAddedServicesOrderApiService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
<dubbo:reference
id=
"dataIndexApiService"
interface=
"com.gic.enterprise.api.service.data.DataIndexApiService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
</beans>
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