Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jyzb_platformV2
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
赵剑炜
jyzb_platformV2
Commits
b310d3f2
Commit
b310d3f2
authored
Jan 16, 2024
by
李小惠
Browse files
Options
Browse Files
Download
Plain Diff
1
parents
fb8d3d78
799d72f8
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
145 行增加
和
60 行删除
+145
-60
EquipmentCountSummaryMapper.java
jyzb-biz/src/main/java/com/junmp/jyzb/mapper/EquipmentCountSummaryMapper.java
+7
-2
TjServiceImpl.java
jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/TjServiceImpl.java
+50
-8
EquipmentCountSummaryMapper.xml
jyzb-biz/src/main/resources/mapper/EquipmentCountSummaryMapper.xml
+88
-50
没有找到文件。
jyzb-biz/src/main/java/com/junmp/jyzb/mapper/EquipmentCountSummaryMapper.java
View file @
b310d3f2
...
...
@@ -19,13 +19,18 @@ public interface EquipmentCountSummaryMapper extends BaseMapper<EquipmentCountSu
void
addInfo
(
@Param
(
"sql"
)
String
sql
);
TjOrgCountDto
TjOrgCount
(
@Param
(
"orgId"
)
String
orgId
,
TjOrgCountDto
TjOrgCount
(
@Param
(
"orgId"
)
String
orgId
,
@Param
(
"typeIdsList"
)
List
<
String
>
typeIdsList
,
@Param
(
"sizeNameList"
)
List
<
String
>
sizeNameList
,
@Param
(
"year"
)
Integer
year
,
@Param
(
"typeParentId"
)
String
typeParentId
,
@Param
(
"monthList"
)
List
<
Integer
>
monthList
);
List
<
TjOrgCountDto
>
TjOrgCount1
(
@Param
(
"orgIdList"
)
List
<
String
>
orgId
,
@Param
(
"typeIdsList"
)
List
<
String
>
typeIdsList
,
@Param
(
"sizeNameList"
)
List
<
String
>
sizeNameList
,
@Param
(
"year"
)
Integer
year
,
@Param
(
"typeParentId"
)
String
typeParentId
,
@Param
(
"monthList"
)
List
<
Integer
>
monthList
);
TjOrgCountDto
TjOrgCountleve4
(
@Param
(
"orgId"
)
Long
orgId
,
@Param
(
"typeIdsList"
)
List
<
String
>
typeIdsList
,
@Param
(
"sizeNameList"
)
List
<
String
>
sizeNameList
,
...
...
jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/TjServiceImpl.java
View file @
b310d3f2
...
...
@@ -32,6 +32,8 @@ import javax.servlet.http.HttpServletResponse;
import
java.lang.reflect.Field
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ExecutionException
;
import
java.util.stream.Collectors
;
@Service
...
...
@@ -641,14 +643,54 @@ public class TjServiceImpl implements TjService {
PubOrg
pubOrg
=
pubOrgService
.
PubOrgExist
(
req
.
getOrgId
());
List
<
String
>
orgList
=
inventorySummaryMapper
.
getTotalData
(
String
.
valueOf
(
req
.
getOrgId
()));
List
<
TjOrgCountDto
>
tjOrgCountList
=
new
ArrayList
<>();
for
(
String
orgId:
orgList
)
{
TjOrgCountDto
orgData
=
equipmentCountSummaryMapper
.
TjOrgCount
(
orgId
,
req
.
getTypeIdsList
(),
req
.
getSizeNameList
(),
req
.
getYear
(),
req
.
getTypeParentId
(),
req
.
getMonthList
());
orgData
.
setNumber
(
ObjectUtil
.
isNull
(
orgData
.
getNumber
())?
0
:
orgData
.
getNumber
());
orgData
.
setUseCount
(
ObjectUtil
.
isNull
(
orgData
.
getUseCount
())?
0
:
orgData
.
getUseCount
());
orgData
.
setFixCount
(
ObjectUtil
.
isNull
(
orgData
.
getFixCount
())?
0
:
orgData
.
getFixCount
());
tjOrgCountList
.
add
(
orgData
);
}
// tjOrgCountList =equipmentCountSummaryMapper.TjOrgCount1(orgList,
// req.getTypeIdsList(),req.getSizeNameList(),req.getYear(),req.getTypeParentId(),req.getMonthList());
// for (String orgId:orgList) {
// TjOrgCountDto orgData =equipmentCountSummaryMapper.TjOrgCount(orgId,
// req.getTypeIdsList(),req.getSizeNameList(),req.getYear(),req.getTypeParentId(),req.getMonthList());
//
//
// if (orgData!=null)
// {
// orgData.setNumber(ObjectUtil.isNull(orgData.getNumber())?0:orgData.getNumber());
// orgData.setUseCount(ObjectUtil.isNull(orgData.getUseCount())?0:orgData.getUseCount());
// orgData.setFixCount(ObjectUtil.isNull(orgData.getFixCount())?0:orgData.getFixCount());
// tjOrgCountList.add(orgData);
// }
//
// }
List
<
CompletableFuture
<
TjOrgCountDto
>>
futures
=
orgList
.
stream
()
.
map
(
orgId
->
CompletableFuture
.
supplyAsync
(()
->
equipmentCountSummaryMapper
.
TjOrgCount
(
orgId
,
req
.
getTypeIdsList
(),
req
.
getSizeNameList
(),
req
.
getYear
(),
req
.
getTypeParentId
(),
req
.
getMonthList
()))
)
.
collect
(
Collectors
.
toList
());
// 等待所有 CompletableFuture 完成
CompletableFuture
<
Void
>
allOf
=
CompletableFuture
.
allOf
(
futures
.
toArray
(
new
CompletableFuture
[
0
])
);
// 处理每个 CompletableFuture 的结果
allOf
.
thenRun
(()
->
{
for
(
CompletableFuture
<
TjOrgCountDto
>
future
:
futures
)
{
try
{
TjOrgCountDto
orgData
=
future
.
get
();
// 获取 CompletableFuture 的结果
if
(
orgData
!=
null
)
{
orgData
.
setNumber
(
ObjectUtil
.
isNull
(
orgData
.
getNumber
())
?
0
:
orgData
.
getNumber
());
orgData
.
setUseCount
(
ObjectUtil
.
isNull
(
orgData
.
getUseCount
())
?
0
:
orgData
.
getUseCount
());
orgData
.
setFixCount
(
ObjectUtil
.
isNull
(
orgData
.
getFixCount
())
?
0
:
orgData
.
getFixCount
());
tjOrgCountList
.
add
(
orgData
);
}
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
// 处理异常
}
}
});
// 等待所有 CompletableFuture 完成
allOf
.
join
();
if
(
req
.
getOrgId
()!=
1369509498032808905L
){
TjOrgCountDto
orgData
=
equipmentCountSummaryMapper
.
TjOrgCountleve4
(
req
.
getOrgId
(),
req
.
getTypeIdsList
(),
req
.
getSizeNameList
(),
req
.
getYear
(),
req
.
getTypeParentId
(),
...
...
jyzb-biz/src/main/resources/mapper/EquipmentCountSummaryMapper.xml
View file @
b310d3f2
...
...
@@ -58,54 +58,6 @@
{call AddEquipmentCountSummary(#{sql,mode=IN})}
</insert>
<select
id=
"TjOrgCount"
resultType=
"com.junmp.jyzb.api.bean.dto.TjDto.TjOrgCountDto"
>
<!-- select t1.org_id,t1.org_code,t1.org_name,t1.d_name,t2.year,t2.use_count,t2.fix_count,t2.number-->
<!-- FROM(-->
<!-- SELECT-->
<!-- `org_id`, `org_code`, `org_name`, `d_name`-->
<!-- FROM `pub_org`-->
<!-- WHERE org_id=#{orgId}-->
<!-- ) as t1-->
<!-- CROSS JOIN (-->
<!-- SELECT-->
<!-- MAX(t.`year`) AS `year`,-->
<!-- SUM(t.use_count) AS use_count,-->
<!-- SUM(t.fix_count) AS fix_count,-->
<!-- sum(CASE WHEN t.month = MONTH(CURRENT_DATE()) THEN t.number ELSE 0 END) AS number-->
<!-- FROM (-->
<!-- SELECT-->
<!-- vecs.`year`,-->
<!-- vecs.`month`,-->
<!-- SUM(vecs.use_count) AS use_count,-->
<!-- SUM(vecs.fix_count) AS fix_count,-->
<!-- sum(vecs.number) as number-->
<!-- FROM vie_equipment_count_summary vecs-->
<!-- left join pub_org po on vecs.org_id_int=po.org_id-->
<!-- where vecs.`year`= #{year} and po.del_flag=1 and (po.org_id=#{orgId} or po.org_parent_ids like CONCAT('%',#{orgId}, '%'))-->
<!-- <if test="typeIdsList!=null and typeIdsList.size() > 0">-->
<!-- and vecs.type_id in-->
<!-- <foreach collection="typeIdsList" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="typeParentId != null and typeParentId !=''">-->
<!-- and vecs.type_parent_id=#{typeParentId}-->
<!-- </if>-->
<!-- <if test="sizeNameList!=null and sizeNameList.size() > 0">-->
<!-- AND-->
<!-- <foreach collection="sizeNameList " item="item" open="(" separator="or" close=")">-->
<!-- vecs.size_name like CONCAT('%', #{item}, '%')-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="monthList != null and monthList.size()>0">-->
<!-- and vecs.month in-->
<!-- <foreach collection="monthList" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- GROUP BY `year`,month-->
<!-- ) AS t-->
<!-- )as t2-->
SELECT
(SELECT `org_id` FROM `pub_org` WHERE org_id=#{orgId}) as org_id,
(SELECT `org_code` FROM `pub_org` WHERE org_id=#{orgId}) as org_code,
...
...
@@ -146,8 +98,94 @@
#{item}
</foreach>
</if>
GROUP BY `year`,month
) as t
GROUP BY `year`,month) as t
<!-- SELECT-->
<!-- MAX(vecs.org_id) as org_id,-->
<!-- MAX(vecs.org_code) as org_code,-->
<!-- MAX(vecs.org_name) as org_name,-->
<!-- MAX(vecs.d_name) as d_name,-->
<!-- vecs.`year`,-->
<!-- vecs.`month`,-->
<!-- SUM(vecs.use_count) AS use_count,-->
<!-- SUM(vecs.fix_count) AS fix_count,-->
<!-- sum(vecs.number) as number-->
<!-- FROM view_org_use vecs-->
<!-- WHERE vecs.`year`= #{year}-->
<!-- AND (-->
<!-- <foreach collection="orgIdList" item="orgId" separator=" OR " open="(" close=")">-->
<!-- vecs.org_id = #{orgId}-->
<!-- OR vecs.org_parent_ids LIKE CONCAT('%',#{orgId}, '%')-->
<!-- </foreach>-->
<!-- )-->
<!-- <if test="typeIdsList!=null and typeIdsList.size() > 0">–>-->
<!-- and vecs.type_id in-->
<!-- <foreach collection="typeIdsList" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="typeParentId != null and typeParentId !=''">-->
<!-- and vecs.type_parent_id=#{typeParentId}-->
<!-- </if>-->
<!-- <if test="sizeNameList!=null and sizeNameList.size() > 0">-->
<!-- AND-->
<!-- <foreach collection="sizeNameList " item="item" open="(" separator="or" close=")">-->
<!-- vecs.size_name like CONCAT('%', #{item}, '%')-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="monthList != null and monthList.size()>0">-->
<!-- and vecs.month in-->
<!-- <foreach collection="monthList" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- GROUP BY `year`,month-->
</select>
<select
id=
"TjOrgCount1"
resultType=
"com.junmp.jyzb.api.bean.dto.TjDto.TjOrgCountDto"
>
<foreach
collection=
"orgIdList"
item=
"orgId"
separator=
"UNION ALL"
>
SELECT
MAX(vecs.org_id) as org_id,
MAX(vecs.org_code) as org_code,
MAX(vecs.org_name) as org_name,
MAX(vecs.d_name) as d_name,
vecs.`year`,
vecs.`month`,
SUM(vecs.use_count) AS use_count,
SUM(vecs.fix_count) AS fix_count,
SUM(vecs.number) as number
FROM view_org_use vecs
WHERE vecs.`year`= #{year}
AND (
vecs.org_id = #{orgId}
OR vecs.org_parent_ids LIKE CONCAT('%', #{orgId}, '%')
)
<if
test=
"typeIdsList!=null and typeIdsList.size() > 0"
>
AND vecs.type_id IN
<foreach
collection=
"typeIdsList"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"typeParentId != null and typeParentId !=''"
>
AND vecs.type_parent_id=#{typeParentId}
</if>
<if
test=
"sizeNameList!=null and sizeNameList.size() > 0"
>
AND
<foreach
collection=
"sizeNameList "
item=
"item"
open=
"("
separator=
"or"
close=
")"
>
vecs.size_name LIKE CONCAT('%', #{item}, '%')
</foreach>
</if>
<if
test=
"monthList != null and monthList.size()>0"
>
AND vecs.month IN
<foreach
collection=
"monthList"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
GROUP BY `year`, month
</foreach>
</select>
<select
id=
"TjOrgCountSum"
resultType=
"com.junmp.jyzb.api.bean.dto.TjDto.FinalTjOrgCountDto"
>
<!-- select sum(use_count) as use_count,sum(fix_count) as fix_count,sum(number) as number FROM (-->
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论