Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
e062bec7
由
康伟
编写于
2024-10-30 17:38:21 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
kangwei :设备运行时间报表接口
1 个父辈
a0c024ef
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
265 行增加
和
63 行删除
sk-module-biz/src/main/java/com/skua/modules/ajh/controller/AjhMeetingSendController.java
sk-module-biz/src/main/java/com/skua/modules/ajh/entity/AjhMeetingSend.java
sk-module-biz/src/main/java/com/skua/modules/erp/controller/TestMetricInfoController.java
sk-module-biz/src/main/java/com/skua/modules/erp/vo/MetricInfoVO.java
sk-module-biz/src/main/java/com/skua/modules/erp/vo/RealTimeHistoryDataVO.java
sk-module-equipment/src/main/java/com/skua/modules/equipment/controller/EquipmentController.java
sk-module-biz/src/main/java/com/skua/modules/ajh/controller/AjhMeetingSendController.java
查看文件 @
e062bec
...
...
@@ -22,9 +22,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.skua.modules.ajh.service.IAjhMeetingService
;
import
com.skua.modules.ajh.vo.AjhMeetingSendVO
;
import
com.skua.modules.system.entity.SysDepart
;
import
com.skua.modules.system.entity.SysUser
;
import
com.skua.modules.system.service.ISysDepartService
;
import
com.skua.modules.system.service.ISysUserService
;
import
com.skua.tool.util.QRCodeUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.jeecgframework.poi.excel.ExcelImportUtil
;
import
org.jeecgframework.poi.excel.def.NormalExcelConstants
;
import
org.jeecgframework.poi.excel.entity.ExportParams
;
...
...
@@ -61,6 +66,11 @@ public class AjhMeetingSendController {
@Value
(
"${skua.web-url}"
)
private
String
webUrl
;
@Autowired
private
ISysUserService
userService
;
@Autowired
private
ISysDepartService
departService
;
/**
* <pre>
* 分页列表查询
...
...
@@ -77,8 +87,8 @@ public class AjhMeetingSendController {
@ApiOperation
(
value
=
"会议记录-分页列表查询"
,
notes
=
"会议记录-分页列表查询"
)
@GetMapping
(
value
=
"/list"
)
public
Result
<
IPage
<
AjhMeetingSend
>>
queryPageList
(
AjhMeetingSend
ajhMeetingSend
,
@RequestParam
(
name
=
"pageNo"
,
defaultValue
=
"1"
)
Integer
pageNo
,
@RequestParam
(
name
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
)
{
@RequestParam
(
name
=
"pageNo"
,
defaultValue
=
"1"
)
Integer
pageNo
,
@RequestParam
(
name
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
)
{
Result
<
IPage
<
AjhMeetingSend
>>
result
=
new
Result
<
IPage
<
AjhMeetingSend
>>();
refreshMeetStatus
();
//刷新会议状态
QueryWrapper
<
AjhMeetingSend
>
queryWrapper
=
new
QueryWrapper
<>();
...
...
@@ -336,6 +346,17 @@ public class AjhMeetingSendController {
public
Result
<
AjhMeetingSend
>
queryById
(
@RequestParam
(
name
=
"id"
,
required
=
true
)
String
id
)
{
Result
<
AjhMeetingSend
>
result
=
new
Result
<
AjhMeetingSend
>();
AjhMeetingSend
ajhMeetingSend
=
ajhMeetingSendService
.
getById
(
id
);
if
(
ajhMeetingSend
!=
null
){
if
(
StringUtils
.
isNotEmpty
(
ajhMeetingSend
.
getMeetCompere
())){
SysUser
sysUser
=
userService
.
getById
(
ajhMeetingSend
.
getMeetCompere
());
ajhMeetingSend
.
setMeetCompereName
(
sysUser
.
getRealname
());
}
if
(
StringUtils
.
isNotEmpty
(
ajhMeetingSend
.
getDepartId
())
&&
StringUtils
.
isEmpty
(
ajhMeetingSend
.
getDepartName
())){
SysDepart
depart
=
departService
.
getById
(
ajhMeetingSend
.
getDepartId
());
ajhMeetingSend
.
setDepartName
(
depart
.
getDepartName
());
}
}
if
(
ajhMeetingSend
==
null
)
{
result
.
error500
(
"未找到对应实体"
);
}
else
{
...
...
@@ -345,7 +366,7 @@ public class AjhMeetingSendController {
return
result
;
}
/**
/**
* <pre>
* 导出excel
* </pre>
...
...
@@ -356,33 +377,33 @@ public class AjhMeetingSendController {
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@RequestMapping
(
value
=
"/exportXls"
)
public
ModelAndView
exportXls
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
// Step.1 组装查询条件
QueryWrapper
<
AjhMeetingSend
>
queryWrapper
=
null
;
try
{
String
paramsStr
=
request
.
getParameter
(
"paramsStr"
);
if
(
ConvertUtils
.
isNotEmpty
(
paramsStr
))
{
String
deString
=
URLDecoder
.
decode
(
paramsStr
,
"UTF-8"
);
AjhMeetingSend
ajhMeetingSend
=
JSON
.
parseObject
(
deString
,
AjhMeetingSend
.
class
);
queryWrapper
=
QueryGenerator
.
initQueryWrapper
(
ajhMeetingSend
,
request
.
getParameterMap
());
}
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
//Step.2 AutoPoi 导出Excel
ModelAndView
mv
=
new
ModelAndView
(
new
JeecgEntityExcelView
());
List
<
AjhMeetingSend
>
pageList
=
ajhMeetingSendService
.
list
(
queryWrapper
);
//导出文件名称
mv
.
addObject
(
NormalExcelConstants
.
FILE_NAME
,
"会议记录列表"
);
mv
.
addObject
(
NormalExcelConstants
.
CLASS
,
AjhMeetingSend
.
class
);
mv
.
addObject
(
NormalExcelConstants
.
PARAMS
,
new
ExportParams
(
"会议记录列表数据"
,
""
,
"会议记录列表"
));
mv
.
addObject
(
NormalExcelConstants
.
DATA_LIST
,
pageList
);
return
mv
;
}
/**
@RequestMapping
(
value
=
"/exportXls"
)
public
ModelAndView
exportXls
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
// Step.1 组装查询条件
QueryWrapper
<
AjhMeetingSend
>
queryWrapper
=
null
;
try
{
String
paramsStr
=
request
.
getParameter
(
"paramsStr"
);
if
(
ConvertUtils
.
isNotEmpty
(
paramsStr
))
{
String
deString
=
URLDecoder
.
decode
(
paramsStr
,
"UTF-8"
);
AjhMeetingSend
ajhMeetingSend
=
JSON
.
parseObject
(
deString
,
AjhMeetingSend
.
class
);
queryWrapper
=
QueryGenerator
.
initQueryWrapper
(
ajhMeetingSend
,
request
.
getParameterMap
());
}
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
//Step.2 AutoPoi 导出Excel
ModelAndView
mv
=
new
ModelAndView
(
new
JeecgEntityExcelView
());
List
<
AjhMeetingSend
>
pageList
=
ajhMeetingSendService
.
list
(
queryWrapper
);
//导出文件名称
mv
.
addObject
(
NormalExcelConstants
.
FILE_NAME
,
"会议记录列表"
);
mv
.
addObject
(
NormalExcelConstants
.
CLASS
,
AjhMeetingSend
.
class
);
mv
.
addObject
(
NormalExcelConstants
.
PARAMS
,
new
ExportParams
(
"会议记录列表数据"
,
""
,
"会议记录列表"
));
mv
.
addObject
(
NormalExcelConstants
.
DATA_LIST
,
pageList
);
return
mv
;
}
/**
* <pre>
* 通过excel导入数据
* </pre>
...
...
@@ -392,33 +413,33 @@ public class AjhMeetingSendController {
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@RequestMapping
(
value
=
"/importExcel"
,
method
=
RequestMethod
.
POST
)
public
Result
<?>
importExcel
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
MultipartHttpServletRequest
multipartRequest
=
(
MultipartHttpServletRequest
)
request
;
Map
<
String
,
MultipartFile
>
fileMap
=
multipartRequest
.
getFileMap
();
for
(
Map
.
Entry
<
String
,
MultipartFile
>
entity
:
fileMap
.
entrySet
())
{
MultipartFile
file
=
entity
.
getValue
();
// 获取上传文件对象
ImportParams
params
=
new
ImportParams
();
params
.
setTitleRows
(
2
);
params
.
setHeadRows
(
1
);
params
.
setNeedSave
(
true
);
try
{
List
<
AjhMeetingSend
>
listAjhMeetingSends
=
ExcelImportUtil
.
importExcel
(
file
.
getInputStream
(),
AjhMeetingSend
.
class
,
params
);
ajhMeetingSendService
.
saveBatch
(
listAjhMeetingSends
);
return
Result
.
ok
(
"文件导入成功!数据行数:"
+
listAjhMeetingSends
.
size
());
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
Result
.
error
(
"文件导入失败:"
+
e
.
getMessage
());
}
finally
{
try
{
file
.
getInputStream
().
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
Result
.
ok
(
"文件导入失败!"
);
}
@RequestMapping
(
value
=
"/importExcel"
,
method
=
RequestMethod
.
POST
)
public
Result
<?>
importExcel
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
MultipartHttpServletRequest
multipartRequest
=
(
MultipartHttpServletRequest
)
request
;
Map
<
String
,
MultipartFile
>
fileMap
=
multipartRequest
.
getFileMap
();
for
(
Map
.
Entry
<
String
,
MultipartFile
>
entity
:
fileMap
.
entrySet
())
{
MultipartFile
file
=
entity
.
getValue
();
// 获取上传文件对象
ImportParams
params
=
new
ImportParams
();
params
.
setTitleRows
(
2
);
params
.
setHeadRows
(
1
);
params
.
setNeedSave
(
true
);
try
{
List
<
AjhMeetingSend
>
listAjhMeetingSends
=
ExcelImportUtil
.
importExcel
(
file
.
getInputStream
(),
AjhMeetingSend
.
class
,
params
);
ajhMeetingSendService
.
saveBatch
(
listAjhMeetingSends
);
return
Result
.
ok
(
"文件导入成功!数据行数:"
+
listAjhMeetingSends
.
size
());
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
Result
.
error
(
"文件导入失败:"
+
e
.
getMessage
());
}
finally
{
try
{
file
.
getInputStream
().
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
Result
.
ok
(
"文件导入失败!"
);
}
/**
* 导出doc文件
...
...
sk-module-biz/src/main/java/com/skua/modules/ajh/entity/AjhMeetingSend.java
查看文件 @
e062bec
...
...
@@ -130,6 +130,11 @@ public class AjhMeetingSend {
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"机构名称"
)
private
java
.
lang
.
String
departName
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"主持人"
)
private
java
.
lang
.
String
meetCompereName
;
/**邀请人数*/
@Excel
(
name
=
"邀请人数"
,
width
=
15
,
orderNum
=
"7"
)
@TableField
(
exist
=
false
)
...
...
@@ -146,8 +151,5 @@ public class AjhMeetingSend {
@ApiModelProperty
(
value
=
"会议内容"
)
private
String
meetContentHtml
;
public
String
getMeetContentHtml
()
{
meetContentHtml
=
BaseUtil
.
delHTMLTag
(
this
.
getMeetContent
());
return
meetContentHtml
;
}
}
...
...
sk-module-biz/src/main/java/com/skua/modules/erp/controller/TestMetricInfoController.java
0 → 100644
查看文件 @
e062bec
package
com
.
skua
.
modules
.
erp
.
controller
;
import
cn.hutool.core.util.RandomUtil
;
import
com.skua.common.util.ChineseInital
;
import
com.skua.core.api.vo.Result
;
import
com.skua.core.aspect.annotation.AutoLog
;
import
com.skua.core.context.SpringContextUtils
;
import
com.skua.core.service.IFactoryInfoService
;
import
com.skua.core.util.ConvertUtils
;
import
com.skua.core.util.DateUtils
;
import
com.skua.modules.equipment.vo.EquipmentRealTimeVO
;
import
com.skua.modules.erp.vo.MetricInfoVO
;
import
com.skua.modules.erp.vo.RealTimeHistoryDataVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.jdbc.core.BeanPropertyRowMapper
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.*
;
@Api
(
tags
=
"设备-设备运行台时报表"
)
@RestController
@RequestMapping
(
"/test/metricInfo"
)
public
class
TestMetricInfoController
{
@Autowired
private
IFactoryInfoService
iFactoryInfoService
;
@AutoLog
(
value
=
"设备-设备运行台时报表"
)
@ApiOperation
(
value
=
"设备-设备运行台时报表"
,
notes
=
"设备-设备运行台时报表"
)
@GetMapping
(
value
=
"/realTimeHistoryData"
)
public
Result
<
RealTimeHistoryDataVO
>
equipRealTimeHistoryDataCtrl
(
@RequestParam
(
value
=
"departId"
)
String
departId
,
@RequestParam
(
value
=
"startTime"
)
String
startTime
,
@RequestParam
(
value
=
"endTime"
)
String
endTime
)
{
Result
<
RealTimeHistoryDataVO
>
result
=
new
Result
<>();
RealTimeHistoryDataVO
realTimeHistoryDataVO
=
new
RealTimeHistoryDataVO
();
//String fields = "TCSWSCLC_PLC300_Tag182,TCSWSCLC_PLC300_Tag185";
JdbcTemplate
masterDB
=
(
JdbcTemplate
)
SpringContextUtils
.
getBean
(
"master"
);
String
metricInfoSql
=
"select ei.equipment_name , t.metric_express1 'gzExpress' , t.metric_express2 'yxExpress' ,t.metric_express3 'tzExpress' from sys_monitor_metric_info t "
;
metricInfoSql
+=
" left join equipment_info ei on ei.id = t.equipment_code "
;
metricInfoSql
+=
" where t.metric_type = 1 and t.depart_id = '"
+
departId
+
"' and t.equipment_code > 0 "
;
List
<
MetricInfoVO
>
metricInfoVOList
=
masterDB
.
query
(
metricInfoSql
,
new
BeanPropertyRowMapper
<
MetricInfoVO
>(
MetricInfoVO
.
class
));
//StringBuffer fields= new StringBuffer();
String
fields
=
""
;
if
(
metricInfoVOList
!=
null
){
for
(
MetricInfoVO
metricInfoVO
:
metricInfoVOList
){
String
equipmentName
=
metricInfoVO
.
getEquipmentName
().
replaceAll
(
"[^\\u4e00-\\u9fa5]"
,
""
);
String
equipmentCode
=
ChineseInital
.
getAllFirstLetter
(
equipmentName
)+
"_"
+
RandomUtil
.
randomNumbers
(
2
);
metricInfoVO
.
setEquipmentName
(
equipmentName
);
metricInfoVO
.
setEquipmentCode
(
equipmentCode
);
if
(
StringUtils
.
isNotEmpty
(
metricInfoVO
.
getGzExpress
())){
fields
+=
metricInfoVO
.
getGzExpress
()+
","
;
}
if
(
StringUtils
.
isNotEmpty
(
metricInfoVO
.
getYxExpress
())){
fields
+=
metricInfoVO
.
getYxExpress
()+
","
;
}
if
(
StringUtils
.
isNotEmpty
(
metricInfoVO
.
getTzExpress
())){
fields
+=
metricInfoVO
.
getTzExpress
()+
","
;
}
}
}
if
(
fields
.
endsWith
(
","
))
{
fields
=
fields
.
substring
(
0
,
fields
.
length
()
-
1
);
}
List
<
Map
<
String
,
Object
>>
pgDataList
=
iFactoryInfoService
.
queryFactoryInfos
(
departId
,
fields
,
startTime
,
endTime
,
"1"
);
List
<
Map
<
String
,
Object
>>
dataList
=
null
;
if
(
pgDataList
!=
null
)
{
dataList
=
new
ArrayList
<>(
pgDataList
.
size
());
Map
<
String
,
Object
>
dataMap
=
null
;
//elect ts as time,nm as monitorId,v as monitorValue
String
equipmentCode
=
null
;
for
(
Map
<
String
,
Object
>
paramMap
:
pgDataList
)
{
dataMap
=
new
HashMap
<>();
dataMap
.
put
(
"time"
,
DateUtils
.
formatTime
(
Long
.
parseLong
(
paramMap
.
get
(
"time"
)
+
"000"
))
);
for
(
MetricInfoVO
metricInfoVO
:
metricInfoVOList
){
dataMap
.
put
(
metricInfoVO
.
getEquipmentCode
()+
"_YX"
,
ConvertUtils
.
getString
(
paramMap
.
get
(
metricInfoVO
.
getYxExpress
())));
//运行
dataMap
.
put
(
metricInfoVO
.
getEquipmentCode
()+
"_GZ"
,
ConvertUtils
.
getString
(
paramMap
.
get
(
metricInfoVO
.
getGzExpress
())));
//故障
dataMap
.
put
(
metricInfoVO
.
getEquipmentCode
()+
"_ZT"
,
60
-
ConvertUtils
.
getDouble
(
paramMap
.
get
(
metricInfoVO
.
getYxExpress
()),
0
)
-
ConvertUtils
.
getDouble
(
paramMap
.
get
(
metricInfoVO
.
getGzExpress
())
,
0
)
);
//暂停
}
dataList
.
add
(
dataMap
);
}
}
/* //拼装数据
Map<String, Map<String,String>> linkedHashMap = new LinkedHashMap<String, Map<String,String>>();//返回数据结果
String timeTemp = null;
Map<String,String> dataMap = null;
if(pgDataList != null ){
//elect ts as time,nm as monitorId,v as monitorValue
for( Map<String, Object> paramMap : pgDataList){
timeTemp = DateUtils.formatTime(Long.parseLong(paramMap.get("time") + "000"));
dataMap = linkedHashMap.get(timeTemp);
if(dataMap == null ){
dataMap = new HashMap<>();
dataMap.put("time",timeTemp);
for (Map.Entry<String, String> entry : nameMap.entrySet()) {
dataMap.put(entry.getKey(),"0");
}
}
// 使用For-Each迭代entries,通过Map.entrySet遍历key和value
for (Map.Entry<String, String> entry : nameMap.entrySet()) {
System.out.println("entry.getKey()" +entry.getKey()+ "****"+"paramMap.get() = "+paramMap.get(entry.getKey()));
if(entry.getKey().equals( ConvertUtils.getString(paramMap.get(entry.getKey())) )){
dataMap.put( entry.getValue() , ConvertUtils.getString(paramMap.get(entry.getKey())));
}
}
linkedHashMap.put(timeTemp,dataMap);
}
}*/
realTimeHistoryDataVO
.
setHeadList
(
metricInfoVOList
);
realTimeHistoryDataVO
.
setDataList
(
dataList
);
result
.
setResult
(
realTimeHistoryDataVO
);
return
result
;
}
}
sk-module-biz/src/main/java/com/skua/modules/erp/vo/MetricInfoVO.java
0 → 100644
查看文件 @
e062bec
package
com
.
skua
.
modules
.
erp
.
vo
;
import
cn.hutool.core.util.RandomUtil
;
import
com.skua.common.util.ChineseInital
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"sys_monitor_metric_info对象"
,
description
=
"数据项管理"
)
public
class
MetricInfoVO
{
@ApiModelProperty
(
value
=
"名称"
)
private
String
equipmentName
;
//
@ApiModelProperty
(
value
=
"设备编码"
)
private
java
.
lang
.
String
equipmentCode
;
@ApiModelProperty
(
value
=
"故障表达式"
)
private
String
gzExpress
;
@ApiModelProperty
(
value
=
"运行表达式"
)
private
String
yxExpress
;
@ApiModelProperty
(
value
=
"停止编码"
)
private
String
tzExpress
;
}
sk-module-biz/src/main/java/com/skua/modules/erp/vo/RealTimeHistoryDataVO.java
0 → 100644
查看文件 @
e062bec
package
com
.
skua
.
modules
.
erp
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
import
java.util.Map
;
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"设备运行台时报表对象"
,
description
=
"设备运行台时报表对象"
)
public
class
RealTimeHistoryDataVO
{
@ApiModelProperty
(
value
=
"表头集合"
)
private
List
<
MetricInfoVO
>
headList
;
@ApiModelProperty
(
value
=
"列表集合数据"
)
private
List
<
Map
<
String
,
Object
>>
dataList
;
}
sk-module-equipment/src/main/java/com/skua/modules/equipment/controller/EquipmentController.java
查看文件 @
e062bec
...
...
@@ -110,8 +110,6 @@ public class EquipmentController {
@Autowired
private
ISysStructDictService
sysStructDictService
;
@Autowired
private
ISysMetricDictService
sysMetricDictService
;
@Autowired
private
IFactoryInfoService
iFactoryInfoService
;
@Autowired
private
IPgQueryService
pgQueryService
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论