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
9ccfa0a0
Commit
9ccfa0a0
authored
Oct 24, 2023
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改权重接口
parent
7b142008
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
152 additions
and
83 deletions
+152
-83
IdxBizFanWeightController.java
...odule/jxiop/biz/controller/IdxBizFanWeightController.java
+63
-29
IdxBizPvWeightController.java
...module/jxiop/biz/controller/IdxBizPvWeightController.java
+89
-54
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/IdxBizFanWeightController.java
View file @
9ccfa0a0
...
@@ -18,7 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -18,7 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
@@ -131,6 +130,7 @@ public class IdxBizFanWeightController extends BaseController {
...
@@ -131,6 +130,7 @@ public class IdxBizFanWeightController extends BaseController {
qu1
.
in
(!
list1
.
isEmpty
(),
IdxBizFanWeight:
:
getSequenceNbr
,
list1
);
qu1
.
in
(!
list1
.
isEmpty
(),
IdxBizFanWeight:
:
getSequenceNbr
,
list1
);
List
<
IdxBizFanWeight
>
list
=
idxBizFanWeightMapper
.
selectList
(
qu1
);
List
<
IdxBizFanWeight
>
list
=
idxBizFanWeightMapper
.
selectList
(
qu1
);
IdxBizFanWeight
reviewDto
=
list
.
get
(
0
);
IdxBizFanWeight
reviewDto
=
list
.
get
(
0
);
LambdaQueryWrapper
<
IdxBizFanWeight
>
qu
=
new
LambdaQueryWrapper
<>();
//获取所属,同类指标
//获取所属,同类指标
// Float list= map.get("data");
// Float list= map.get("data");
...
@@ -142,80 +142,114 @@ public class IdxBizFanWeightController extends BaseController {
...
@@ -142,80 +142,114 @@ public class IdxBizFanWeightController extends BaseController {
switch
(
reviewDto
.
getType
())
{
switch
(
reviewDto
.
getType
())
{
case
"1"
:
case
"1"
:
flagtype
=
idxBizFanWeight
.
getArae
()
;
//
flagtype = idxBizFanWeight.getArae() ;
break
;
break
;
case
"2"
:
case
"2"
:
flagtype
=
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
;
flagtype
=
idxBizFanWeight
.
getArae
();
break
;
break
;
case
"3"
:
case
"3"
:
flagtype
=
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
;
flagtype
=
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
();
break
;
break
;
case
"4"
:
case
"4"
:
flagtype
=
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
+
idxBizFanWeight
.
getSubarray
()
;
flagtype
=
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
();
break
;
break
;
case
"5"
:
case
"5"
:
flagtype
=
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
+
idxBizFanWeight
.
getSubarray
()
+
idxBizFanWeight
.
getPointName
()
;
flagtype
=
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
+
idxBizFanWeight
.
getSubarray
();
break
;
break
;
}
}
}
else
{
}
else
{
switch
(
reviewDto
.
getType
())
{
switch
(
reviewDto
.
getType
())
{
case
"1"
:
case
"1"
:
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
))
{
//
if (!flagtype.equals(idxBizFanWeight.getArae() )) {
throw
new
BadRequest
(
"配置权重必须是同一个层级的数据"
);
//
throw new BadRequest("配置权重必须是同一个层级的数据");
}
//
}
break
;
break
;
case
"2"
:
case
"2"
:
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
))
{
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()))
{
throw
new
BadRequest
(
"配置权重必须是同一个层级的数据"
);
throw
new
RuntimeException
(
"配置权重必须是同一个层级的数据"
);
}
}
break
;
break
;
case
"3"
:
case
"3"
:
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
))
{
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()))
{
throw
new
BadRequest
(
"配置权重必须是同一个层级的数据"
);
throw
new
RuntimeException
(
"配置权重必须是同一个层级的数据"
);
}
}
break
;
break
;
case
"4"
:
case
"4"
:
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
+
idxBizFanWeight
.
getSubarray
()
))
{
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()))
{
throw
new
BadRequest
(
"配置权重必须是同一个层级的数据"
);
throw
new
RuntimeException
(
"配置权重必须是同一个层级的数据"
);
}
}
break
;
break
;
case
"5"
:
case
"5"
:
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
+
idxBizFanWeight
.
getSubarray
()
+
idxBizFanWeight
.
getPointName
()
))
{
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
+
idxBizFanWeight
.
getSubarray
()))
{
throw
new
BadRequest
(
"配置权重必须是同一个层级的数据"
);
throw
new
RuntimeException
(
"配置权重必须是同一个层级的数据"
);
}
}
break
;
break
;
}
}
}
}
}
Float
valued
=
list
.
size
()
*
Float
.
valueOf
(
value
.
get
(
"data"
).
toString
());
Float
valued
=
list
.
size
()
*
Float
.
valueOf
(
value
.
get
(
"data"
).
toString
());
LambdaQueryWrapper
<
IdxBizFanWeight
>
qu
=
new
LambdaQueryWrapper
<>();
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getType
()),
IdxBizFanWeight:
:
getType
,
reviewDto
.
getType
());
switch
(
reviewDto
.
getType
())
{
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getArae
()),
IdxBizFanWeight:
:
getArae
,
reviewDto
.
getArae
());
case
"1"
:
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getStation
()),
IdxBizFanWeight:
:
getStation
,
reviewDto
.
getStation
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getType
()),
IdxBizFanWeight:
:
getType
,
reviewDto
.
getType
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getSubarray
()),
IdxBizFanWeight:
:
getSubarray
,
reviewDto
.
getSubarray
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getEquipmentName
()),
IdxBizFanWeight:
:
getEquipmentName
,
reviewDto
.
getEquipmentName
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getPointName
()),
IdxBizFanWeight:
:
getPointName
,
reviewDto
.
getPointName
());
break
;
case
"2"
:
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getType
()),
IdxBizFanWeight:
:
getType
,
reviewDto
.
getType
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getArae
()),
IdxBizFanWeight:
:
getArae
,
reviewDto
.
getArae
());
break
;
case
"3"
:
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getType
()),
IdxBizFanWeight:
:
getType
,
reviewDto
.
getType
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getArae
()),
IdxBizFanWeight:
:
getArae
,
reviewDto
.
getArae
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getStation
()),
IdxBizFanWeight:
:
getStation
,
reviewDto
.
getStation
());
break
;
case
"4"
:
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getType
()),
IdxBizFanWeight:
:
getType
,
reviewDto
.
getType
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getArae
()),
IdxBizFanWeight:
:
getArae
,
reviewDto
.
getArae
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getStation
()),
IdxBizFanWeight:
:
getStation
,
reviewDto
.
getStation
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getSubarray
()),
IdxBizFanWeight:
:
getSubarray
,
reviewDto
.
getSubarray
());
break
;
case
"5"
:
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getType
()),
IdxBizFanWeight:
:
getType
,
reviewDto
.
getType
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getArae
()),
IdxBizFanWeight:
:
getArae
,
reviewDto
.
getArae
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getStation
()),
IdxBizFanWeight:
:
getStation
,
reviewDto
.
getStation
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getSubarray
()),
IdxBizFanWeight:
:
getSubarray
,
reviewDto
.
getSubarray
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getEquipmentName
()),
IdxBizFanWeight:
:
getEquipmentName
,
reviewDto
.
getEquipmentName
());
break
;
}
// qu.eq(!StringUtils.isEmpty(reviewDto.getType()), IdxBizFanWeight::getType, reviewDto.getType());
// qu.eq(!StringUtils.isEmpty(reviewDto.getArae()), IdxBizFanWeight::getArae, reviewDto.getArae());
// qu.eq(!StringUtils.isEmpty(reviewDto.getStation()), IdxBizFanWeight::getStation, reviewDto.getStation());
// qu.eq(!StringUtils.isEmpty(reviewDto.getSubarray()), IdxBizFanWeight::getSubarray, reviewDto.getSubarray());
// qu.eq(!StringUtils.isEmpty(reviewDto.getEquipmentName()), IdxBizFanWeight::getEquipmentName, reviewDto.getEquipmentName());
// qu.eq(!StringUtils.isEmpty(reviewDto.getPointName()), IdxBizFanWeight::getPointName, reviewDto.getPointName());
List
<
IdxBizFanWeight
>
listdata
=
idxBizFanWeightMapper
.
selectList
(
qu
);
List
<
IdxBizFanWeight
>
listdata
=
idxBizFanWeightMapper
.
selectList
(
qu
);
//设置权重值,
//设置权重值,
int
num
=
listdata
.
size
()
-
list
.
size
();
int
num
=
listdata
.
size
()
-
list
.
size
();
if
(
num
==
0
)
{
if
(
num
==
0
)
{
if
(
valued
!=
1
)
{
if
(
valued
!=
1
)
{
throw
new
BadRequest
(
"超出权重最大值限制,层级下权重等级总和为1"
);
throw
new
RuntimeException
(
"超出权重最大值限制,层级下权重等级总和为1"
);
}
}
}
}
//值不能大于1
//值不能大于1
if
(
valued
>
1
)
{
if
(
valued
>
1
)
{
throw
new
BadRequest
(
"超出权重最大值限制,层级下权重等级总和为1"
);
throw
new
RuntimeException
(
"超出权重最大值限制,层级下权重等级总和为1"
);
}
}
if
(
valued
!=
1
&&
num
!
=
0
)
{
if
(
valued
!=
1
&&
num
=
=
0
)
{
throw
new
BadRequest
(
"超出权重最大值限制,层级下权重等级总和为1"
);
throw
new
RuntimeException
(
"超出权重最大值限制,层级下权重等级总和为1"
);
}
}
//剩余权重值
//剩余权重值
...
@@ -234,7 +268,7 @@ public class IdxBizFanWeightController extends BaseController {
...
@@ -234,7 +268,7 @@ public class IdxBizFanWeightController extends BaseController {
idxBizFanWeightMapper
.
updateById
(
listdatum
);
idxBizFanWeightMapper
.
updateById
(
listdatum
);
}
}
}
}
}
return
ResponseHelper
.
buildResponse
(
null
);
return
ResponseHelper
.
buildResponse
(
null
);
}
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/IdxBizPvWeightController.java
View file @
9ccfa0a0
...
@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
...
@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBiz3yudDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBiz3yudDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWeight
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWeight
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWeight
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWeight
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWeight
;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvWeightMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvWeightMapper
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -20,7 +21,6 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -20,7 +21,6 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
@@ -146,6 +146,7 @@ public class IdxBizPvWeightController extends BaseController {
...
@@ -146,6 +146,7 @@ public class IdxBizPvWeightController extends BaseController {
qu1
.
in
(!
list1
.
isEmpty
(),
IdxBizPvWeight:
:
getSequenceNbr
,
list1
);
qu1
.
in
(!
list1
.
isEmpty
(),
IdxBizPvWeight:
:
getSequenceNbr
,
list1
);
List
<
IdxBizPvWeight
>
list
=
idxBizPvWeightMapper
.
selectList
(
qu1
);
List
<
IdxBizPvWeight
>
list
=
idxBizPvWeightMapper
.
selectList
(
qu1
);
IdxBizPvWeight
reviewDto
=
list
.
get
(
0
);
IdxBizPvWeight
reviewDto
=
list
.
get
(
0
);
LambdaQueryWrapper
<
IdxBizPvWeight
>
qu
=
new
LambdaQueryWrapper
<>();
//获取所属,同类指标
//获取所属,同类指标
// Float list= map.get("data");
// Float list= map.get("data");
...
@@ -157,99 +158,133 @@ public class IdxBizPvWeightController extends BaseController {
...
@@ -157,99 +158,133 @@ public class IdxBizPvWeightController extends BaseController {
switch
(
reviewDto
.
getType
())
{
switch
(
reviewDto
.
getType
())
{
case
"1"
:
case
"1"
:
flagtype
=
idxBizFanWeight
.
getArae
()
;
//
flagtype = idxBizFanWeight.getArae() ;
break
;
break
;
case
"2"
:
case
"2"
:
flagtype
=
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
;
flagtype
=
idxBizFanWeight
.
getArae
();
break
;
break
;
case
"3"
:
case
"3"
:
flagtype
=
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
;
flagtype
=
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
();
break
;
break
;
case
"4"
:
case
"4"
:
flagtype
=
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
+
idxBizFanWeight
.
getSubarray
()
;
flagtype
=
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
();
break
;
break
;
case
"5"
:
case
"5"
:
flagtype
=
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
+
idxBizFanWeight
.
getSubarray
()
+
idxBizFanWeight
.
getPointName
()
;
flagtype
=
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
+
idxBizFanWeight
.
getSubarray
();
break
;
break
;
}
}
}
else
{
}
else
{
switch
(
reviewDto
.
getType
())
{
switch
(
reviewDto
.
getType
())
{
case
"1"
:
case
"1"
:
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
))
{
//
if (!flagtype.equals(idxBizFanWeight.getArae() )) {
throw
new
BadRequest
(
"配置权重必须是同一个层级的数据"
);
//
throw new BadRequest("配置权重必须是同一个层级的数据");
}
//
}
break
;
break
;
case
"2"
:
case
"2"
:
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
))
{
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()))
{
throw
new
BadRequest
(
"配置权重必须是同一个层级的数据"
);
throw
new
RuntimeException
(
"配置权重必须是同一个层级的数据"
);
}
}
break
;
break
;
case
"3"
:
case
"3"
:
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
))
{
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()))
{
throw
new
BadRequest
(
"配置权重必须是同一个层级的数据"
);
throw
new
RuntimeException
(
"配置权重必须是同一个层级的数据"
);
}
}
break
;
break
;
case
"4"
:
case
"4"
:
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
+
idxBizFanWeight
.
getSubarray
()
))
{
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()))
{
throw
new
BadRequest
(
"配置权重必须是同一个层级的数据"
);
throw
new
RuntimeException
(
"配置权重必须是同一个层级的数据"
);
}
}
break
;
break
;
case
"5"
:
case
"5"
:
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
+
idxBizFanWeight
.
getSubarray
()
+
idxBizFanWeight
.
getPointName
()
))
{
if
(!
flagtype
.
equals
(
idxBizFanWeight
.
getArae
()
+
idxBizFanWeight
.
getStation
()
+
idxBizFanWeight
.
getEquipmentName
()
+
idxBizFanWeight
.
getSubarray
()))
{
throw
new
BadRequest
(
"配置权重必须是同一个层级的数据"
);
throw
new
RuntimeException
(
"配置权重必须是同一个层级的数据"
);
}
}
break
;
break
;
}
}
}
}
Float
valued
=
list
.
size
()
*
Float
.
valueOf
(
value
.
get
(
"data"
).
toString
());
}
Float
valued
=
list
.
size
()
*
Float
.
valueOf
(
value
.
get
(
"data"
).
toString
());
LambdaQueryWrapper
<
IdxBizPvWeight
>
qu
=
new
LambdaQueryWrapper
<>();
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getType
()),
IdxBizPvWeight:
:
getType
,
reviewDto
.
getType
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getArae
()),
IdxBizPvWeight:
:
getArae
,
reviewDto
.
getArae
());
switch
(
reviewDto
.
getType
())
{
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getStation
()),
IdxBizPvWeight:
:
getStation
,
reviewDto
.
getStation
());
case
"1"
:
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getSubarray
()),
IdxBizPvWeight:
:
getSubarray
,
reviewDto
.
getSubarray
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getType
()),
IdxBizPvWeight:
:
getType
,
reviewDto
.
getType
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getEquipmentName
()),
IdxBizPvWeight:
:
getEquipmentName
,
reviewDto
.
getEquipmentName
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getPointName
()),
IdxBizPvWeight:
:
getPointName
,
reviewDto
.
getPointName
());
List
<
IdxBizPvWeight
>
listdata
=
idxBizPvWeightMapper
.
selectList
(
qu
);
break
;
case
"2"
:
//设置权重值,
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getType
()),
IdxBizPvWeight:
:
getType
,
reviewDto
.
getType
());
int
num
=
listdata
.
size
()
-
list
.
size
();
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getArae
()),
IdxBizPvWeight:
:
getArae
,
reviewDto
.
getArae
());
if
(
num
==
0
)
{
if
(
valued
!=
1
)
{
break
;
throw
new
BadRequest
(
"超出权重最大值限制,层级下权重等级总和为1"
);
case
"3"
:
}
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getType
()),
IdxBizPvWeight:
:
getType
,
reviewDto
.
getType
());
}
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getArae
()),
IdxBizPvWeight:
:
getArae
,
reviewDto
.
getArae
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getStation
()),
IdxBizPvWeight:
:
getStation
,
reviewDto
.
getStation
());
break
;
case
"4"
:
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getType
()),
IdxBizPvWeight:
:
getType
,
reviewDto
.
getType
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getArae
()),
IdxBizPvWeight:
:
getArae
,
reviewDto
.
getArae
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getStation
()),
IdxBizPvWeight:
:
getStation
,
reviewDto
.
getStation
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getSubarray
()),
IdxBizPvWeight:
:
getSubarray
,
reviewDto
.
getSubarray
());
break
;
case
"5"
:
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getType
()),
IdxBizPvWeight:
:
getType
,
reviewDto
.
getType
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getArae
()),
IdxBizPvWeight:
:
getArae
,
reviewDto
.
getArae
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getStation
()),
IdxBizPvWeight:
:
getStation
,
reviewDto
.
getStation
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getSubarray
()),
IdxBizPvWeight:
:
getSubarray
,
reviewDto
.
getSubarray
());
qu
.
eq
(!
StringUtils
.
isEmpty
(
reviewDto
.
getEquipmentName
()),
IdxBizPvWeight:
:
getEquipmentName
,
reviewDto
.
getEquipmentName
());
break
;
}
//值不能大于1
// qu.eq(!StringUtils.isEmpty(reviewDto.getType()), IdxBizFanWeight::getType, reviewDto.getType());
if
(
valued
>
1
)
{
// qu.eq(!StringUtils.isEmpty(reviewDto.getArae()), IdxBizFanWeight::getArae, reviewDto.getArae());
throw
new
BadRequest
(
"超出权重最大值限制,层级下权重等级总和为1"
);
// qu.eq(!StringUtils.isEmpty(reviewDto.getStation()), IdxBizFanWeight::getStation, reviewDto.getStation());
}
// qu.eq(!StringUtils.isEmpty(reviewDto.getSubarray()), IdxBizFanWeight::getSubarray, reviewDto.getSubarray());
if
(
valued
!=
1
&&
num
!=
0
)
{
// qu.eq(!StringUtils.isEmpty(reviewDto.getEquipmentName()), IdxBizFanWeight::getEquipmentName, reviewDto.getEquipmentName());
throw
new
BadRequest
(
"超出权重最大值限制,层级下权重等级总和为1"
);
// qu.eq(!StringUtils.isEmpty(reviewDto.getPointName()), IdxBizFanWeight::getPointName, reviewDto.getPointName());
List
<
IdxBizPvWeight
>
listdata
=
idxBizPvWeightMapper
.
selectList
(
qu
);
//设置权重值,
int
num
=
listdata
.
size
()
-
list
.
size
();
if
(
num
==
0
)
{
if
(
valued
!=
1
)
{
throw
new
RuntimeException
(
"超出权重最大值限制,层级下权重等级总和为1"
);
}
}
}
//剩余权重值
float
formattedNum
=
num
!=
0
?
Float
.
parseFloat
(
new
DecimalFormat
(
"0.0000000000"
).
format
((
1
-
valued
)
/
num
))
:
0
;
for
(
IdxBizPvWeight
listdatum
:
listdata
)
{
//值不能大于1
for
(
IdxBizPvWeight
idxBizPvWeight
:
list
)
{
if
(
valued
>
1
)
{
if
(
idxBizPvWeight
.
getSequenceNbr
().
equals
(
listdatum
.
getSequenceNbr
()))
{
throw
new
RuntimeException
(
"超出权重最大值限制,层级下权重等级总和为1"
);
listdatum
.
setValue
(
idxBizPvWeight
.
getValue
());
}
break
;
if
(
valued
!=
1
&&
num
==
0
)
{
}
else
{
throw
new
RuntimeException
(
"超出权重最大值限制,层级下权重等级总和为1"
);
listdatum
.
setValue
(
formattedNum
);
}
break
;
}
//剩余权重值
float
formattedNum
=
num
!=
0
?
Float
.
parseFloat
(
new
DecimalFormat
(
"0.0000000000"
).
format
((
1
-
valued
)
/
num
))
:
0
;
for
(
IdxBizPvWeight
listdatum
:
listdata
)
{
for
(
IdxBizPvWeight
idxBizPvWeight
:
list
)
{
if
(
idxBizPvWeight
.
getSequenceNbr
().
equals
(
listdatum
.
getSequenceNbr
()))
{
listdatum
.
setValue
(
idxBizPvWeight
.
getValue
());
break
;
}
else
{
listdatum
.
setValue
(
formattedNum
);
break
;
}
}
idxBizPvWeightMapper
.
updateById
(
listdatum
);
}
}
idxBizPvWeightMapper
.
updateById
(
listdatum
);
}
}
}
}
return
ResponseHelper
.
buildResponse
(
null
);
return
ResponseHelper
.
buildResponse
(
null
);
}
}
...
...
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