Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
skboot-zhongye
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
6e01484c
由
张雷
编写于
2024-12-12 17:25:12 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
月度生产数据报表开发
1 个父辈
72643557
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
208 行增加
和
3 行删除
sk-base-common/src/main/java/com/skua/common/constant/ReportConstant.java
sk-module-datafill/src/main/java/com/skua/modules/custom/handle/impl/ScybReportHandle.java
sk-module-datafill/src/main/java/com/skua/modules/custom/mapper/FCustomReportDatasetMapper.java
sk-module-datafill/src/main/java/com/skua/modules/custom/mapper/xml/FCustomReportDatasetMapper.xml
sk-module-datafill/src/main/java/com/skua/modules/custom/service/IFCustomReportDatasetService.java
sk-module-datafill/src/main/java/com/skua/modules/custom/service/impl/FCustomReportDatasetServiceImpl.java
sk-module-datafill/src/main/java/com/skua/modules/custom/service/impl/FCustomReportInfoServiceImpl.java
sk-module-datafill/src/main/java/com/skua/modules/report/controller/ReportDataController.java
sk-module-datafill/src/main/java/com/skua/modules/report/service/IReportDataService.java
sk-module-datafill/src/main/java/com/skua/modules/report/service/impl/ReportDataServiceImpl.java
sk-base-common/src/main/java/com/skua/common/constant/ReportConstant.java
查看文件 @
6e01484
...
...
@@ -11,7 +11,7 @@ public interface ReportConstant {
public
static
final
String
view3a24
=
"3a243d5715b9e1a3753c180872ca0df9"
;
//上产月报
public
static
final
String
view4411
=
"4411ed3d78634bcdcd700f6e33724025"
;
//化验日报
...
...
sk-module-datafill/src/main/java/com/skua/modules/custom/handle/impl/ScybReportHandle.java
0 → 100644
查看文件 @
6e01484
package
com
.
skua
.
modules
.
custom
.
handle
.
impl
;
import
com.skua.common.constant.ReportConstant
;
import
com.skua.common.report.ReportViewUtil
;
import
com.skua.common.report.entity.ValueEntity
;
import
com.skua.core.util.ConvertUtils
;
import
com.skua.modules.common.service.ICommonSqlService
;
import
com.skua.modules.common.vo.DepartVO
;
import
com.skua.modules.custom.handle.ICustomHandle
;
import
com.skua.modules.custom.service.IFCustomReportDatasetService
;
import
com.skua.modules.custom.vo.FCustomReportDatasetVO
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
/**
* <pre>
* 生产月报自定义逻辑
* </pre>
* @author zhanglei
* @version V0.1, 2024年12月17日 上午9:40:17
*/
@Component
(
"scybReportHandle"
)
public
class
ScybReportHandle
implements
ICustomHandle
{
@Autowired
private
IFCustomReportDatasetService
fCustomReportDatasetService
;
@Autowired
private
ICommonSqlService
commonSqlService
;
@Override
public
Map
<
String
,
List
<
Map
<
String
,
ValueEntity
>>>
buildDataMap
(
String
reportId
,
String
startTime
,
String
endTime
,
String
departId
,
String
indexCode
)
{
String
departIds
=
""
;
List
<
DepartVO
>
departList
=
commonSqlService
.
getChildDepartList
(
departId
);
for
(
DepartVO
departVO
:
departList
)
{
departIds
=
departVO
.
getDepartId
()
+
","
+
departIds
;
}
String
month
=
startTime
.
split
(
"-"
)[
0
]
+
"-"
+
startTime
.
split
(
"-"
)[
1
];
Map
<
String
,
List
<
Map
<
String
,
ValueEntity
>>>
resMap
=
new
HashMap
<
String
,
List
<
Map
<
String
,
ValueEntity
>>>();
Map
<
String
,
List
<
Map
<
String
,
ValueEntity
>>>
dataMap
=
new
HashMap
<
String
,
List
<
Map
<
String
,
ValueEntity
>>>();
//获取填报数据及报表数据项信息,组装报表所需数据机构
List
<
Map
<
String
,
ValueEntity
>>
list
=
new
ArrayList
<
Map
<
String
,
ValueEntity
>>();
//根据数据集id获取数据项及填报数据
List
<
FCustomReportDatasetVO
>
dataFieldList
=
fCustomReportDatasetService
.
getDataField
(
ReportConstant
.
view4411
);
Map
<
String
,
String
>
dataFieldDict
=
new
HashMap
<
String
,
String
>();
for
(
FCustomReportDatasetVO
dataField
:
dataFieldList
)
{
dataFieldDict
.
put
(
dataField
.
getDatasetId
(),
dataField
.
getDatasetName
());
}
//添加厂站、时间字段
dataFieldDict
.
put
(
"depart_name"
,
"厂站名称"
);
dataFieldDict
.
put
(
"time"
,
"时间"
);
dataFieldDict
.
put
(
"paramDepart"
,
"参数机构"
);
dataFieldDict
.
put
(
"depart_id"
,
"厂站编码"
);
//获取填报数据
String
dataViewName4411
=
ReportViewUtil
.
buildViewLike
(
ReportConstant
.
view4411
,
""
,
departIds
,
month
);
//结果集
List
<
Map
<
String
,
Object
>>
nhMapList
=
fCustomReportDatasetService
.
queryScybReport
(
dataViewName4411
,
month
,
departIds
);
list
=
changeDataList
(
nhMapList
,
list
,
startTime
,
dataFieldDict
);
dataMap
.
put
(
"生产数据报表"
,
list
);
List
<
Map
<
String
,
ValueEntity
>>
dList
=
new
ArrayList
<>();
for
(
DepartVO
departVO
:
departList
)
{
String
departStr
=
departVO
.
getDepartId
();
Map
<
String
,
ValueEntity
>
newDataMap
=
new
HashMap
<>();
ValueEntity
codeEntity
=
new
ValueEntity
();
codeEntity
.
setValue
(
departStr
);
newDataMap
.
put
(
"厂站编码"
,
codeEntity
);
ValueEntity
nameEntity
=
new
ValueEntity
();
nameEntity
.
setValue
(
departVO
.
getDepartName
());
newDataMap
.
put
(
"厂站名称"
,
nameEntity
);
for
(
Map
.
Entry
<
String
,
List
<
Map
<
String
,
ValueEntity
>>>
entry
:
dataMap
.
entrySet
())
{
List
<
Map
<
String
,
ValueEntity
>>
dataList
=
entry
.
getValue
();
for
(
Map
<
String
,
ValueEntity
>
dMap:
dataList
)
{
if
(
departStr
.
equals
(
dMap
.
get
(
"厂站编码"
).
getValue
())){
newDataMap
.
putAll
(
dMap
);
}
}
}
dList
.
add
(
newDataMap
);
}
resMap
.
put
(
"月度生产数据报表"
,
dList
);
return
resMap
;
}
@Override
public
String
buildWaterQualityAlarmValue
(
String
reportId
,
String
departId
,
String
json
)
{
return
json
;
}
/**
* 构造LIST
* @param szMapList
* @param list
* @param startTime
* @param dataFieldDict
* @return
*/
private
List
<
Map
<
String
,
ValueEntity
>>
changeDataList
(
List
<
Map
<
String
,
Object
>>
szMapList
,
List
<
Map
<
String
,
ValueEntity
>>
list
,
String
startTime
,
Map
<
String
,
String
>
dataFieldDict
)
{
for
(
Map
<
String
,
Object
>
valueMap
:
szMapList
)
{
Map
<
String
,
ValueEntity
>
handleMap
=
new
HashMap
<
String
,
ValueEntity
>();
//添加时间参数
ValueEntity
startTimeValueEntity
=
new
ValueEntity
();
startTimeValueEntity
.
setValue
(
startTime
);
handleMap
.
put
(
"参数机构"
,
startTimeValueEntity
);
Set
<
String
>
keySet
=
valueMap
.
keySet
();
for
(
String
key
:
keySet
)
{
if
(!
StringUtils
.
isEmpty
(
dataFieldDict
.
get
(
key
)))
{
ValueEntity
valueEntity
=
new
ValueEntity
();
valueEntity
.
setValue
(
ConvertUtils
.
getString
(
valueMap
.
get
(
key
)));
handleMap
.
put
(
dataFieldDict
.
get
(
key
),
valueEntity
);
}
}
list
.
add
(
handleMap
);
}
return
list
;
}
}
sk-module-datafill/src/main/java/com/skua/modules/custom/mapper/FCustomReportDatasetMapper.java
查看文件 @
6e01484
...
...
@@ -148,4 +148,7 @@ public interface FCustomReportDatasetMapper extends BaseMapper<FCustomReportData
List
<
Map
<
String
,
Object
>>
queryHyReport
(
@Param
(
value
=
"dataViewName9bff"
)
String
dataViewName9bff
,
@Param
(
value
=
"startTime"
)
String
startTime
,
@Param
(
value
=
"endTime"
)
String
endTime
,
@Param
(
value
=
"departId"
)
String
departId
);
List
<
Map
<
String
,
Object
>>
queryScybReport
(
@Param
(
value
=
"dataViewName4411"
)
String
dataViewName4411
,
@Param
(
value
=
"month"
)
String
month
,
@Param
(
value
=
"departId"
)
String
departId
);
}
...
...
sk-module-datafill/src/main/java/com/skua/modules/custom/mapper/xml/FCustomReportDatasetMapper.xml
查看文件 @
6e01484
...
...
@@ -808,4 +808,45 @@
AND v.time
<
= #{endTime}
GROUP BY v.depart_id
</select>
<select
id=
"queryScybReport"
resultType=
"java.util.HashMap"
>
SELECT
d.depart_name,
#{month} AS time,
d.id AS depart_id,
v4.ysjsl,
v4.tqysjsl,
v4.sjsldbbhl,
v4.ysjsldyqntqyy,
v4.qntqsfsl,
v4.ysfsl,
v4.sfsldbbhl,
v4.ndslmb,
v4.yslwcbl,
v4.sldyyqyy,
v4.qntqdh,
v4.ydh,
v4.dhdbbhl,
v4.dhgyqntqyy,
v4.qntqyh,
v4.yyf,
v4.yyh,
v4.yhdbbhl,
v4.yhgyqntqyy,
v4.bndhmb,
v4.bnsjdh,
v4.dhcmbzyy,
v4.bnyhmb,
v4.bnsjyh,
v4.yhcyqyy
FROM
sys_depart d
LEFT JOIN ( SELECT * FROM ${dataViewName4411} v WHERE v.time = #{month} ) v4 ON v4.depart_id = d.id
WHERE
d.id IN
<foreach
item=
"item"
index=
"index"
collection=
"departId.split(',')"
open=
"("
separator=
","
close=
")"
>
'${item}'
</foreach>
ORDER BY
v4.time DESC,d.depart_order ASC
</select>
</mapper>
...
...
sk-module-datafill/src/main/java/com/skua/modules/custom/service/IFCustomReportDatasetService.java
查看文件 @
6e01484
...
...
@@ -142,4 +142,6 @@ public interface IFCustomReportDatasetService extends IService<FCustomReportData
List
<
Map
<
String
,
Object
>>
queryNhYyrbReport
(
String
dataViewName3a24
,
String
startTime
,
String
endTime
,
String
departId
);
List
<
Map
<
String
,
Object
>>
queryHyReport
(
String
dataViewName9bff
,
String
startTime
,
String
endTime
,
String
departIds
);
List
<
Map
<
String
,
Object
>>
queryScybReport
(
String
dataViewName4411
,
String
month
,
String
departIds
);
}
...
...
sk-module-datafill/src/main/java/com/skua/modules/custom/service/impl/FCustomReportDatasetServiceImpl.java
查看文件 @
6e01484
...
...
@@ -472,6 +472,12 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
return
list
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryScybReport
(
String
dataViewName4411
,
String
month
,
String
departIds
)
{
List
<
Map
<
String
,
Object
>>
list
=
mapper
.
queryScybReport
(
dataViewName4411
,
month
,
departIds
);
return
list
;
}
/**转换为Map<部门编号,JnhbReportData> */
private
Map
<
String
,
JnhbReportData
>
convertJnhbReportDataMap
(
List
<
JnhbReportData
>
dataList
){
// Map<部门编号,JnhbReportData>
Map
<
String
,
JnhbReportData
>
dataMap
=
new
HashMap
<>();
...
...
sk-module-datafill/src/main/java/com/skua/modules/custom/service/impl/FCustomReportInfoServiceImpl.java
查看文件 @
6e01484
...
...
@@ -54,10 +54,10 @@ public class FCustomReportInfoServiceImpl extends ServiceImpl<FCustomReportInfoM
startTime
=
startTime
+
"-01"
;
endTime
=
endTime
+
"-31"
;
}
else
if
(
"2"
.
equals
(
reportInfo
.
getReportTimeQueryType
())){
//月
if
(
"1"
.
equals
(
reportInfo
.
getReportType
())){
startTime
=
startTime
+
"-01"
;
endTime
=
endTime
+
"-31"
;
}
else
{
//无需转换时间
}
}
String
customService
=
reportInfo
.
getCustomService
();
//锁定行号
...
...
sk-module-datafill/src/main/java/com/skua/modules/report/controller/ReportDataController.java
查看文件 @
6e01484
...
...
@@ -57,6 +57,10 @@ public class ReportDataController {
String
time
=
ConvertUtils
.
getString
(
data
.
get
(
"time"
));
reportDataService
.
insertOrUpdateReportData
(
departId
,
time
,
data
,
reportId
);
}
//同步修改生产运营月报
if
(
dataList
.
size
()
>
0
){
reportDataService
.
syncUpdateScybData
(
dataList
.
get
(
0
).
get
(
"departId"
),
dataList
.
get
(
0
).
get
(
"time"
));
}
return
Result
.
ok
(
"报表批量添加成功"
);
}
...
...
sk-module-datafill/src/main/java/com/skua/modules/report/service/IReportDataService.java
查看文件 @
6e01484
...
...
@@ -9,4 +9,5 @@ public interface IReportDataService {
void
insertOrUpdateReportData
(
String
departId
,
String
time
,
Map
<
String
,
String
>
data
,
String
reportId
);
void
syncUpdateScybData
(
String
departId
,
String
time
);
}
...
...
sk-module-datafill/src/main/java/com/skua/modules/report/service/impl/ReportDataServiceImpl.java
查看文件 @
6e01484
package
com
.
skua
.
modules
.
report
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.skua.core.util.ConvertUtils
;
import
com.skua.modules.custom.service.IFCustomReportDatasetService
;
import
com.skua.modules.report.entity.FReportItem
;
import
com.skua.modules.report.entity.FReportItemv
;
import
com.skua.modules.report.service.IReportDataService
;
import
com.skua.modules.report.service.IFReportItemService
;
import
com.skua.modules.report.service.IFReportItemvService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
...
...
@@ -21,6 +24,8 @@ public class ReportDataServiceImpl implements IReportDataService {
private
IFReportItemvService
fReportItemvService
;
@Resource
private
IFReportItemService
fReportItemService
;
@Autowired
private
IFCustomReportDatasetService
fCustomReportDatasetService
;
@Override
public
void
insertOrUpdateReportData
(
String
departId
,
String
dataTime
,
Map
<
String
,
String
>
dataMap
,
String
reportId
)
{
...
...
@@ -88,6 +93,28 @@ public class ReportDataServiceImpl implements IReportDataService {
}
}
@Override
public
void
syncUpdateScybData
(
String
departId
,
String
dataTime
)
{
String
year
=
dataTime
.
split
(
"-"
)[
0
];
List
<
Map
<
String
,
Object
>>
valueList
=
fCustomReportDatasetService
.
getDataFromHY
(
year
,
departId
);
List
<
Map
<
String
,
String
>>
list
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
map
:
valueList
)
{
Map
<
String
,
String
>
newMap
=
new
HashMap
<>();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
map
.
entrySet
())
{
String
key
=
entry
.
getKey
();
Object
value
=
entry
.
getValue
();
String
valueAsString
=
value
!=
null
?
value
.
toString
()
:
""
;
newMap
.
put
(
key
,
valueAsString
);
}
list
.
add
(
newMap
);
}
for
(
Map
<
String
,
String
>
data
:
list
)
{
String
reportId
=
ConvertUtils
.
getString
(
data
.
get
(
"reportId"
));
String
time
=
ConvertUtils
.
getString
(
data
.
get
(
"time"
));
insertOrUpdateReportData
(
departId
,
time
,
data
,
reportId
);
}
}
//生成ID
private
static
String
generateUniqueId
()
{
long
timestamp
=
System
.
currentTimeMillis
();
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论