Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
tianjin-cement
Project
Project
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
竹天卫
tianjin-cement
Commits
aecd115f
Commit
aecd115f
authored
Sep 22, 2020
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
校核开始按照整理的公式 写计算接口
parent
9c1bd401
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
86 additions
and
86 deletions
+86
-86
EntrustMapper.java
...java/cn/wise/sc/cement/business/mapper/EntrustMapper.java
+1
-0
SampleHandleMapper.java
...cn/wise/sc/cement/business/mapper/SampleHandleMapper.java
+6
-0
EntrustMapper.xml
...a/cn/wise/sc/cement/business/mapper/xml/EntrustMapper.xml
+1
-1
StandardQuery.java
...cn/wise/sc/cement/business/model/query/StandardQuery.java
+1
-1
StandardValueQuery.java
...se/sc/cement/business/model/query/StandardValueQuery.java
+4
-3
EntrustVo.java
...n/java/cn/wise/sc/cement/business/model/vo/EntrustVo.java
+5
-2
CommonServiceImpl.java
...se/sc/cement/business/service/impl/CommonServiceImpl.java
+0
-13
EntrustServiceImpl.java
...e/sc/cement/business/service/impl/EntrustServiceImpl.java
+31
-39
StandardServiceImpl.java
.../sc/cement/business/service/impl/StandardServiceImpl.java
+13
-2
CheckCountUtil.java
.../java/cn/wise/sc/cement/business/util/CheckCountUtil.java
+24
-25
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/EntrustMapper.java
View file @
aecd115f
...
...
@@ -34,4 +34,5 @@ public interface EntrustMapper extends BaseMapper<Entrust> {
IPage
<
EntrustVo
>
getCheckPage
(
@Param
(
"page"
)
Page
page
,
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
}
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/SampleHandleMapper.java
View file @
aecd115f
...
...
@@ -7,7 +7,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
org.apache.tomcat.jni.Local
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -26,4 +29,7 @@ public interface SampleHandleMapper extends BaseMapper<SampleHandle> {
SampleHandleVo
getDetail
(
Integer
id
);
@Select
(
"select MIN(accept_time) from sample_handle where sample_id = #{sampleId} and status>0"
)
LocalDateTime
getNo1AcceptTime
(
Integer
sampleId
);
}
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/EntrustMapper.xml
View file @
aecd115f
...
...
@@ -81,7 +81,7 @@
<select
id=
"getSampleHandlePage"
resultType=
"cn.wise.sc.cement.business.model.vo.EntrustVo"
>
select e.id as id, e.sample_num as sampleNum,
select e.id as id, e.sample_num as sampleNum,
e.entrust_date as entrustDate,
(
CASE e.status
WHEN 0 THEN '未评审'
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/model/query/StandardQuery.java
View file @
aecd115f
...
...
@@ -15,7 +15,7 @@ import java.util.List;
* @create: 2020-08-07 14:58
**/
@Data
@ApiModel
(
"
职务
请求"
)
@ApiModel
(
"
标样
请求"
)
public
class
StandardQuery
{
private
Integer
id
;
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/model/query/StandardValueQuery.java
View file @
aecd115f
package
cn
.
wise
.
sc
.
cement
.
business
.
model
.
query
;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModel
;
...
...
@@ -19,11 +20,11 @@ import java.time.LocalDateTime;
@ApiModel
(
"标样管理-标准值请求"
)
public
class
StandardValueQuery
{
@ApiModelProperty
(
"元素名称"
)
@ApiModelProperty
(
"元素名称
(元素1 元素2 ......)
"
)
private
String
elementName
;
@ApiModelProperty
(
"元素各项值 json串"
)
private
String
elementValue
;
@ApiModelProperty
(
"元素各项值 json串
例子:[{\"name\": \"标准值\",\"value\": \"1\"},{\"name\": \"误差值\",\"value\": \"2\"},{\"数据组数\": \"钠元素\",\"value\": \"3\"}]
"
)
private
JSONArray
elementValue
;
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/model/vo/EntrustVo.java
View file @
aecd115f
...
...
@@ -114,10 +114,13 @@ public class EntrustVo {
@ApiModelProperty
(
"所有样品名称"
)
private
String
sampleNames
;
@ApiModelProperty
(
"所有处理项名称"
)
private
String
handleNames
;
@ApiModelProperty
(
"检测依据编号 只显示第一个样品的"
)
private
String
checkMethodNumber
;
@ApiModelProperty
(
"任务接受时间"
)
private
LocalDateTime
acceptTime
;
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/CommonServiceImpl.java
View file @
aecd115f
...
...
@@ -221,19 +221,6 @@ public class CommonServiceImpl {
//输出检测项第三次循环
for
(
String
name
:
checkResutlList
){
if
(
name
.
equals
(
"MadBE"
)){
BigDecimal
countMadBE
=
CheckCountUtil
.
countMadBE
(
countMap
);
countMap
.
put
(
name
,
countMadBE
);
}
}
return
countMap
;
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EntrustServiceImpl.java
View file @
aecd115f
...
...
@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
sun.print.BackgroundServiceLookup
;
import
sun.security.provider.SHA
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
...
...
@@ -565,29 +566,38 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if
(
list
!=
null
&&
list
.
size
()>
0
){
for
(
EntrustVo
entrustVo
:
list
){
List
<
Sample
>
sampleList
=
sampleMapper
.
getSampleList
(
entrustVo
.
getId
());
//
检测项目
名称
//
样品名称
名称
String
sampleNames
=
""
;
//处理项名称
String
handleNames
=
""
;
if
(
sampleList
!=
null
&&
sampleList
.
size
()>
0
){
//样品名称 列表中的拼接
for
(
Sample
sample
:
sampleList
){
sampleNames
=
sampleNames
.
equals
(
""
)?
sample
.
getName
():(
sampleNames
+
"、"
+
sample
.
getName
());
}
//
检测项 和检测依据 列
表里只显示第一个样品的
//
处理项
表里只显示第一个样品的
Sample
sample
=
sampleList
.
get
(
0
);
String
teamIds
=
sample
.
getTeamIds
();
String
checkTeam
=
""
;
if
(
teamIds
!=
null
){
String
[]
teamIdS
=
teamIds
.
split
(
"、"
);
for
(
String
teamId
:
teamIdS
){
Team
team
=
teamMapper
.
selectById
(
Integer
.
valueOf
(
teamId
));
if
(
team
!=
null
){
checkTeam
=
checkTeam
.
equals
(
""
)?
team
.
getName
():(
checkTeam
+
"、"
+
team
.
getName
());
QueryWrapper
<
SampleHandle
>
shWrapper
=
new
QueryWrapper
<>();
shWrapper
.
eq
(
"sample_id"
,
sample
.
getId
());
List
<
SampleHandle
>
shList
=
sampleHandleMapper
.
selectList
(
shWrapper
);
if
(
shList
!=
null
&&
shList
.
size
()>
0
){
for
(
SampleHandle
sampleHandle
:
shList
){
if
(
sampleHandle
.
getContent
()
!=
null
){
String
[]
handleIdS
=
sampleHandle
.
getContent
().
split
(
"、"
);
for
(
String
handelId
:
handleIdS
){
Handle
handle
=
handleMapper
.
selectById
(
Integer
.
valueOf
(
handelId
));
if
(
handle
!=
null
){
handleNames
=
handleNames
.
equals
(
""
)?
handle
.
getName
():(
handleNames
+
"、"
+
handle
.
getName
());
}
}
}
}
}
entrustVo
.
setCheckTeam
(
checkTeam
);
entrustVo
.
setCheckMethodNumber
(
sample
.
getMethodNumbers
());
//第一个样品的最早接受时间
LocalDateTime
acceptTime
=
sampleHandleMapper
.
getNo1AcceptTime
(
sample
.
getId
());
entrustVo
.
setAcceptTime
(
acceptTime
);
}
entrustVo
.
setHandleNames
(
handleNames
);
entrustVo
.
setSampleNames
(
sampleNames
);
}
}
...
...
@@ -938,47 +948,29 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if
(
entrust
==
null
){
return
BaseResponse
.
errorMsg
(
"信息错误"
);
}
QueryWrapper
<
Sample
>
sampleWrapper
=
new
QueryWrapper
<>();
sampleWrapper
.
eq
(
"entrust_id"
,
id
);
sampleWrapper
.
orderByAsc
(
"id"
);
List
<
Sample
>
sampleList
=
sampleService
.
list
(
sampleWrapper
);
List
<
Sample
>
sampleList
=
sampleMapper
.
getSampleList
(
id
);
List
<
SampleVo
>
sampleVoList
=
new
ArrayList
<>();
Integer
distributionStatus
=
null
;
if
(
sampleList
!=
null
&&
sampleList
.
size
()>
0
){
for
(
Sample
sample
:
sampleList
){
SampleVo
sampleVo
=
new
SampleVo
();
BeanUtils
.
copyProperties
(
sample
,
sampleVo
);
String
teamIds
=
sample
.
getTeamIds
();
String
teamName
=
""
;
List
<
SampleDistributionTeamVo
>
sampleNoDistributionTeamVoList
=
new
ArrayList
<>();
if
(
teamIds
!=
null
){
String
[]
teamIdS
=
teamIds
.
split
(
"、"
);
for
(
String
teamId
:
teamIdS
){
TeamVo
teamVo
=
teamMapper
.
getDetail
(
Integer
.
valueOf
(
teamId
));
if
(
teamVo
!=
null
){
teamName
=
teamName
.
equals
(
""
)?
teamVo
.
getName
():(
teamName
+
"、"
+
teamVo
.
getName
());
SampleDistributionTeamVo
distributionTeamVo
=
new
SampleDistributionTeamVo
();
distributionTeamVo
.
setTeamGroupId
(
teamVo
.
getGroupId
());
distributionTeamVo
.
setTeamGroupName
(
teamVo
.
getGroupName
());
distributionTeamVo
.
setTeamId
(
teamVo
.
getId
());
distributionTeamVo
.
setTeamName
(
teamVo
.
getName
());
sampleNoDistributionTeamVoList
.
add
(
distributionTeamVo
);
}
}
}
sampleVo
.
setTeamName
(
teamName
);
//检测人员只能看到自己则的检测内容
List
<
SampleDistributionTeamVo
>
sampleDistributionTeamVoList
=
distributionMapper
.
getDistributionTeamList
(
sample
.
getId
(),
loginUser
.
getId
());
if
(
sampleDistributionTeamVoList
!=
null
&&
sampleDistributionTeamVoList
.
size
()>
0
)
{
sampleVo
.
setSampleDistributionTeamVoList
(
sampleDistributionTeamVoList
);
}
else
{
sampleVo
.
setSampleDistributionTeamVoList
(
sampleNoDistributionTeamVoList
);
for
(
SampleDistributionTeamVo
sdVo
:
sampleDistributionTeamVoList
){
if
(
distributionStatus
!=
null
&&
distributionStatus
!=
sdVo
.
getStatus
()){
return
BaseResponse
.
errorMsg
(
"接受或完成的状态信息错误"
);
}
distributionStatus
=
sdVo
.
getStatus
()==
1
?
1
:(
sdVo
.
getStatus
()==
2
?
2
:
0
);
}
}
sampleVoList
.
add
(
sampleVo
);
}
}
entrust
.
setIsDistribution
(
distributionStatus
);
//0显示接受按钮,1显示完成按钮(可以上传附件),2和null不显示按钮
map
.
put
(
"entrust"
,
entrust
);
map
.
put
(
"sampleVoList"
,
sampleVoList
);
return
BaseResponse
.
okData
(
map
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/StandardServiceImpl.java
View file @
aecd115f
...
...
@@ -14,6 +14,7 @@ import cn.wise.sc.cement.business.service.IStandardService;
import
cn.wise.sc.cement.business.service.IStandardValueService
;
import
cn.wise.sc.cement.business.service.ISysUserService
;
import
cn.wise.sc.cement.business.wrapper.page.Query
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -107,8 +108,13 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
StandardValue
standardValue
=
new
StandardValue
();
standardValue
.
setStandardId
(
standard
.
getId
())
.
setElementName
(
standardValueQuery
.
getElementName
())
.
setElementValue
(
standardValueQuery
.
getElementValue
())
.
setCreateTime
(
LocalDateTime
.
now
());
if
(
standardValueQuery
.
getElementValue
()
!=
null
&&
standardValueQuery
.
getElementValue
().
size
()>
0
){
String
elementValue
=
JSON
.
toJSON
(
standardValueQuery
.
getElementValue
()).
toString
();
standardValue
.
setElementValue
(
elementValue
);
}
else
{
standardValue
.
setElementValue
(
null
);
}
standardValueList
.
add
(
standardValue
);
}
standardValueService
.
saveBatch
(
standardValueList
);
...
...
@@ -165,8 +171,13 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
StandardValue
standardValue
=
new
StandardValue
();
standardValue
.
setStandardId
(
standard
.
getId
())
.
setElementName
(
standardValueQuery
.
getElementName
())
.
setElementValue
(
standardValueQuery
.
getElementValue
())
.
setCreateTime
(
LocalDateTime
.
now
());
if
(
standardValueQuery
.
getElementValue
()
!=
null
&&
standardValueQuery
.
getElementValue
().
size
()>
0
){
String
elementValue
=
JSON
.
toJSON
(
standardValueQuery
.
getElementValue
()).
toString
();
standardValue
.
setElementValue
(
elementValue
);
}
else
{
standardValue
.
setElementValue
(
null
);
}
standardValueList
.
add
(
standardValue
);
}
standardValueService
.
saveBatch
(
standardValueList
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/util/CheckCountUtil.java
View file @
aecd115f
...
...
@@ -24,7 +24,7 @@ public class CheckCountUtil {
public
final
static
BigDecimal
param10
=
new
BigDecimal
(
10.00
);
public
final
static
BigDecimal
param100
=
new
BigDecimal
(
100.00
);
public
final
static
BigDecimal
param1000
=
new
BigDecimal
(
1000.00
);
public
final
static
BigDecimal
param10000
=
new
BigDecimal
(
10000.00
);
//object 转成 BigDecimal
public
static
BigDecimal
getBigDecimal
(
Object
value
)
{
...
...
@@ -156,6 +156,20 @@ public class CheckCountUtil {
}
else
{
endResult
=
countResult
.
subtract
(
new
BigDecimal
(
0.00000000001
)).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
}
else
if
(
name
.
equals
(
"MnO"
)){
BigDecimal
CNa2O
=
getBigDecimal
(
resultMap
.
get
(
"CNa2O"
));
BigDecimal
V
=
getBigDecimal
(
resultMap
.
get
(
"V"
));
BigDecimal
ANa2O
=
getBigDecimal
(
resultMap
.
get
(
"ANa2O"
));
BigDecimal
mR20
=
getBigDecimal
(
resultMap
.
get
(
"样重R2O"
));
//计算的核心公式结果
BigDecimal
countResult
=
CNa2O
.
multiply
(
V
).
multiply
(
ANa2O
).
divide
(
mR20
).
divide
(
param10000
);
BigDecimal
result1
=
countResult
.
multiply
(
param100
);
int
resultInt1
=
result1
.
setScale
(
0
,
BigDecimal
.
ROUND_DOWN
).
intValue
();
if
((
resultInt1
&
1
)
==
1
){
//如果结果为奇数
endResult
=
countResult
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
else
{
endResult
=
countResult
.
subtract
(
new
BigDecimal
(
0.00000000001
)).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
}
else
if
(
name
.
equals
(
"Mad1"
)){
BigDecimal
YZ_M1
=
getBigDecimal
(
resultMap
.
get
(
"样重M1"
));
BigDecimal
MZ_M1
=
getBigDecimal
(
resultMap
.
get
(
"⽫重M1"
));
...
...
@@ -172,9 +186,6 @@ public class CheckCountUtil {
endResult
=
countResult
.
multiply
(
param100
);
}
return
endResult
;
}
...
...
@@ -275,33 +286,25 @@ public class CheckCountUtil {
}
/**
* 求Mad (Mad1 + Mad2 )/ 2
* 求Mad (Mad1 + Mad2 )/ 2
结果奇偶数判断后的结果
* @param countMap
* @return
*/
public
static
BigDecimal
countMad
(
Map
<
String
,
Object
>
countMap
)
{
BigDecimal
Mad1
=
getBigDecimal
(
countMap
.
get
(
"Mad1"
));
BigDecimal
Mad2
=
getBigDecimal
(
countMap
.
get
(
"Mad2"
));
BigDecimal
Mad
=
Mad1
.
add
(
Mad2
).
divide
(
new
BigDecimal
(
2
));
return
Mad
;
}
/**
* 求Mad BE列 :Mad*100
* @param countMap
* @return
*/
public
static
BigDecimal
countMadBE
(
Map
<
String
,
Object
>
countMap
)
{
BigDecimal
Mad
=
getBigDecimal
(
countMap
.
get
(
"Mad"
));
BigDecimal
result1
=
Mad
.
multiply
(
param100
);
//计算Mad1 和 Mad2 的平均值
BigDecimal
MadAve
=
Mad1
.
add
(
Mad2
).
divide
(
new
BigDecimal
(
2
));
//判断奇偶数的最终值
BigDecimal
result1
=
MadAve
.
multiply
(
param100
);
int
resultInt1
=
result1
.
setScale
(
0
,
BigDecimal
.
ROUND_DOWN
).
intValue
();
BigDecimal
Mad
BE
=
null
;
BigDecimal
Mad
=
null
;
if
((
resultInt1
&
1
)
==
1
){
//如果结果为奇数
Mad
BE
=
Mad
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
Mad
=
MadAve
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
else
{
Mad
BE
=
Mad
.
subtract
(
new
BigDecimal
(
0.00000000001
)).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
Mad
=
MadAve
.
subtract
(
new
BigDecimal
(
0.00000000001
)).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
return
Mad
BE
;
return
Mad
;
}
...
...
@@ -315,10 +318,6 @@ public class CheckCountUtil {
}
...
...
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