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
554c846d
Commit
554c846d
authored
Nov 18, 2020
by
qinhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.样品处置列表
2.产值加急3倍 3.质量控制样品历史记录
parent
5dc6af87
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
540 additions
and
215 deletions
+540
-215
PrecipriceController.java
...e/sc/cement/business/controller/PrecipriceController.java
+1
-1
SampleController.java
.../wise/sc/cement/business/controller/SampleController.java
+6
-0
StandardController.java
...ise/sc/cement/business/controller/StandardController.java
+2
-2
GroupStandard.java
...java/cn/wise/sc/cement/business/entity/GroupStandard.java
+5
-0
Preciprice.java
...in/java/cn/wise/sc/cement/business/entity/Preciprice.java
+4
-0
SampleMapper.java
.../java/cn/wise/sc/cement/business/mapper/SampleMapper.java
+3
-0
SampleMapper.xml
...va/cn/wise/sc/cement/business/mapper/xml/SampleMapper.xml
+25
-0
StandardMapper.xml
.../cn/wise/sc/cement/business/mapper/xml/StandardMapper.xml
+1
-1
SampleSaveDto.java
.../java/cn/wise/sc/cement/business/model/SampleSaveDto.java
+30
-0
IPrecipriceService.java
...n/wise/sc/cement/business/service/IPrecipriceService.java
+27
-23
ISampleService.java
...va/cn/wise/sc/cement/business/service/ISampleService.java
+6
-0
IStandardService.java
.../cn/wise/sc/cement/business/service/IStandardService.java
+1
-1
EntrustServiceImpl.java
...e/sc/cement/business/service/impl/EntrustServiceImpl.java
+2
-2
PrecipriceServiceImpl.java
...c/cement/business/service/impl/PrecipriceServiceImpl.java
+16
-11
SampleServiceImpl.java
...se/sc/cement/business/service/impl/SampleServiceImpl.java
+232
-173
StandardServiceImpl.java
.../sc/cement/business/service/impl/StandardServiceImpl.java
+82
-1
ExcelUtil.java
.../main/java/cn/wise/sc/cement/business/util/ExcelUtil.java
+97
-0
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/controller/PrecipriceController.java
View file @
554c846d
...
@@ -57,7 +57,7 @@ public class PrecipriceController {
...
@@ -57,7 +57,7 @@ public class PrecipriceController {
@GetMapping
(
"/ddd"
)
@GetMapping
(
"/ddd"
)
@ApiOperation
(
"aaa"
)
@ApiOperation
(
"aaa"
)
public
void
add
(){
public
void
add
(){
iNormProductionService
.
createPreciprice
(
1
,
1
,
1
,
1
,
1
);
iNormProductionService
.
createPreciprice
(
1
,
1
,
1
,
1
,
1
,
true
);
}
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/controller/SampleController.java
View file @
554c846d
...
@@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
...
@@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.imageio.ImageIO
;
import
javax.imageio.ImageIO
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
...
@@ -211,5 +212,10 @@ public class SampleController {
...
@@ -211,5 +212,10 @@ public class SampleController {
return
BaseResponse
.
errorMsg
(
"失败!"
);
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
}
@ApiOperation
(
"下载样品处理记录"
)
@PostMapping
(
"/uploadSampleSaveList"
)
public
void
upload
(
HttpServletResponse
response
){
sampleService
.
upload
(
response
);
}
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/controller/StandardController.java
View file @
554c846d
...
@@ -187,9 +187,9 @@ public class StandardController {
...
@@ -187,9 +187,9 @@ public class StandardController {
@ApiOperation
(
"按检测组获取标样信息"
)
@ApiOperation
(
"按检测组获取标样信息"
)
@GetMapping
(
"/list/byGroup"
)
@GetMapping
(
"/list/byGroup"
)
public
BaseResponse
<
List
<
GroupStandard
>>
getStandards
()
{
public
BaseResponse
<
List
<
GroupStandard
>>
getStandards
(
String
name
)
{
return
BaseResponse
.
okData
(
standardService
.
getStandards
());
return
BaseResponse
.
okData
(
standardService
.
getStandards
(
name
));
}
}
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/entity/GroupStandard.java
View file @
554c846d
...
@@ -19,6 +19,11 @@ public class GroupStandard implements Serializable {
...
@@ -19,6 +19,11 @@ public class GroupStandard implements Serializable {
*/
*/
private
String
groupName
;
private
String
groupName
;
/**
* 本所编号
*/
private
String
cementCode
;
/**
/**
* 标准样品key:value
* 标准样品key:value
*/
*/
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/entity/Preciprice.java
View file @
554c846d
...
@@ -140,4 +140,8 @@ public class Preciprice implements Serializable {
...
@@ -140,4 +140,8 @@ public class Preciprice implements Serializable {
* 检测组名
* 检测组名
*/
*/
private
String
groupTeamName
;
private
String
groupTeamName
;
/**
* 是否加急 0:不加急 1:加急
*/
private
Integer
isUrgent
;
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/SampleMapper.java
View file @
554c846d
package
cn
.
wise
.
sc
.
cement
.
business
.
mapper
;
package
cn
.
wise
.
sc
.
cement
.
business
.
mapper
;
import
cn.wise.sc.cement.business.entity.Sample
;
import
cn.wise.sc.cement.business.entity.Sample
;
import
cn.wise.sc.cement.business.model.SampleSaveDto
;
import
cn.wise.sc.cement.business.model.vo.SampleManageVo
;
import
cn.wise.sc.cement.business.model.vo.SampleManageVo
;
import
cn.wise.sc.cement.business.model.vo.SampleVo
;
import
cn.wise.sc.cement.business.model.vo.SampleVo
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
...
@@ -55,4 +56,6 @@ public interface SampleMapper extends BaseMapper<Sample> {
...
@@ -55,4 +56,6 @@ public interface SampleMapper extends BaseMapper<Sample> {
@Select
(
"select * from sample where entrust_id = #{entrustId} order by id asc"
)
@Select
(
"select * from sample where entrust_id = #{entrustId} order by id asc"
)
List
<
Sample
>
getSampleCheckList
(
Integer
entrustId
);
List
<
Sample
>
getSampleCheckList
(
Integer
entrustId
);
List
<
SampleSaveDto
>
getSampleSaveList
();
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/SampleMapper.xml
View file @
554c846d
...
@@ -61,4 +61,29 @@
...
@@ -61,4 +61,29 @@
</select>
</select>
<select
id=
"getSampleSaveList"
resultType=
"cn.wise.sc.cement.business.model.SampleSaveDto"
>
SELECT
s.id,
s.entrust_id,
s.`name`,
s.`sample_form`,
s.cement_code,
s.sample_code,
s.little_position,
DATE_FORMAT(s.register_time,'%Y/%m/%d') as register_time,
DATE_FORMAT(s.destruction_time,'%Y/%m/%d') as destruction_time,
s.operator_id,
s.remark,
e.project_name,
e.project_code,
su.`name` as user_name
FROM
`sample` s
LEFT JOIN entrust e
ON s.entrust_id = e.id
LEFT JOIN sys_user su
ON su.id = s.operator_id
</select>
</mapper>
</mapper>
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/StandardMapper.xml
View file @
554c846d
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
select s.id as group_id,s.`name` as group_name,sv.element_name,sv.element_value FROM standard s
select s.id as group_id,s.`name` as group_name,sv.element_name,sv.element_value FROM standard s
INNER JOIN
INNER JOIN
(SELECT * FROM standard_value) sv
(SELECT * FROM standard_value) sv
ON s.id = sv.standard_id
AND s.`status` = 1
ON s.id = sv.standard_id
</select>
</select>
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/model/SampleSaveDto.java
0 → 100644
View file @
554c846d
package
cn
.
wise
.
sc
.
cement
.
business
.
model
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @description:
* @author: qh
* @create: 2020-11-18 17:13
**/
@Data
public
class
SampleSaveDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
42L
;
private
String
id
;
private
String
entrustId
;
private
String
name
;
private
String
userName
;
private
String
projectName
;
private
String
sampleForm
;
private
String
cementCode
;
private
String
sampleCode
;
private
String
littlePosition
;
private
String
registerTime
;
private
String
destructionTime
;
private
String
operatorId
;
private
String
remark
;
private
String
projectCode
;
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/IPrecipriceService.java
View file @
554c846d
...
@@ -7,14 +7,13 @@ import cn.wise.sc.cement.business.model.BaseResponse;
...
@@ -7,14 +7,13 @@ import cn.wise.sc.cement.business.model.BaseResponse;
import
cn.wise.sc.cement.business.model.vo.ProductionVo
;
import
cn.wise.sc.cement.business.model.vo.ProductionVo
;
import
cn.wise.sc.cement.business.model.vo.WorkloadStatisticsVo
;
import
cn.wise.sc.cement.business.model.vo.WorkloadStatisticsVo
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
* <p>
* <p>
*
服务类
* 服务类
* </p>
* </p>
*
*
* @author ztw
* @author ztw
...
@@ -22,16 +21,16 @@ import java.util.List;
...
@@ -22,16 +21,16 @@ import java.util.List;
*/
*/
public
interface
IPrecipriceService
extends
IService
<
Preciprice
>
{
public
interface
IPrecipriceService
extends
IService
<
Preciprice
>
{
boolean
createPreciprice
(
final
Integer
userId
,
final
Integer
entrustId
,
boolean
createPreciprice
(
final
Integer
userId
,
final
Integer
entrustId
,
final
Integer
targetId
,
final
Integer
type
,
final
Integer
targetId
,
final
Integer
type
,
final
Integer
sampleId
);
final
Integer
sampleId
,
boolean
isUrgent
);
/**
/**
* 标准产值统计
* 标准产值统计
*
*
* @param start 开始时间
* @param start
开始时间
* @param end 结束时间
* @param end
结束时间
* @param groupId
部门id
* @param groupId 部门id
* @return BaseResponse
* @return BaseResponse
*/
*/
BaseResponse
<
List
<
NormProductionStatistics
>>
normProductionStatistics
(
Long
start
,
Long
end
,
String
name
,
Integer
groupId
);
BaseResponse
<
List
<
NormProductionStatistics
>>
normProductionStatistics
(
Long
start
,
Long
end
,
String
name
,
Integer
groupId
);
...
@@ -50,53 +49,58 @@ public interface IPrecipriceService extends IService<Preciprice> {
...
@@ -50,53 +49,58 @@ public interface IPrecipriceService extends IService<Preciprice> {
/**
/**
* 总产值统计
* 总产值统计
*
*
* @param name 用户
* @param name
用户
* @param start
开始时间
* @param start 开始时间
* @param end
结束时间
* @param end 结束时间
* @return 详细信息
* @return 详细信息
*/
*/
List
<
ProductionVo
>
production
(
String
name
,
Long
start
,
Long
end
,
Integer
groupId
);
List
<
ProductionVo
>
production
(
String
name
,
Long
start
,
Long
end
,
Integer
groupId
);
/**
/**
* 导出标准统计
* 导出标准统计
* @param start 开始时间
*
* @param end 结束时间
* @param start 开始时间
* @param name 人员名字
* @param end 结束时间
* @param name 人员名字
* @param groupId 部门id
* @param groupId 部门id
* @param response 响应体
* @param response 响应体
*/
*/
void
exportNormProductionStatistics
(
Long
start
,
Long
end
,
String
name
,
Integer
groupId
,
HttpServletResponse
response
);
void
exportNormProductionStatistics
(
Long
start
,
Long
end
,
String
name
,
Integer
groupId
,
HttpServletResponse
response
);
/**
/**
* 导出个人标准产值详情列表
* 导出个人标准产值详情列表
* @param userId 用户id
*
* @param userId 用户id
* @param startTime 开始时间
* @param startTime 开始时间
* @param endTime 结束时间
* @param endTime
结束时间
* @param response 响应体
* @param response
响应体
*/
*/
void
exportNormProductionDetail
(
Integer
userId
,
Long
startTime
,
Long
endTime
,
HttpServletResponse
response
);
void
exportNormProductionDetail
(
Integer
userId
,
Long
startTime
,
Long
endTime
,
HttpServletResponse
response
);
/**
/**
* 导出产值总统计列表
* 导出产值总统计列表
* @param name 名字检索
*
* @param name 名字检索
* @param startTime 开始时间
* @param startTime 开始时间
* @param endTime 结束时间
* @param endTime
结束时间
* @param response 响应体
* @param response 响应体
*/
*/
void
exportProduction
(
String
name
,
Long
startTime
,
Long
endTime
,
Integer
groupId
,
HttpServletResponse
response
);
void
exportProduction
(
String
name
,
Long
startTime
,
Long
endTime
,
Integer
groupId
,
HttpServletResponse
response
);
/**
/**
* 统计工作量
* 统计工作量
*
* @param startTime 开始时间
* @param startTime 开始时间
* @param endTime 结束时间
* @param endTime
结束时间
* @return 统计对象
* @return 统计对象
*/
*/
List
<
WorkloadStatisticsVo
>
workloadStatistics
(
Date
startTime
,
Date
endTime
,
Integer
userId
);
List
<
WorkloadStatisticsVo
>
workloadStatistics
(
Date
startTime
,
Date
endTime
,
Integer
userId
);
/**
/**
* 根据报告id更新
* 根据报告id更新
*
* @param entrustId
* @param entrustId
* @return
* @return
*/
*/
boolean
updateStatusByEntrustId
(
Integer
entrustId
);
boolean
updateStatusByEntrustId
(
Integer
entrustId
);
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/ISampleService.java
View file @
554c846d
...
@@ -46,4 +46,10 @@ public interface ISampleService extends IService<Sample> {
...
@@ -46,4 +46,10 @@ public interface ISampleService extends IService<Sample> {
* @return 复查成功与否
* @return 复查成功与否
*/
*/
BaseResponse
<
Boolean
>
ampleReview
(
Integer
id
);
BaseResponse
<
Boolean
>
ampleReview
(
Integer
id
);
/**
* 下载样品存储信息
* @param response 响应体
*/
void
upload
(
HttpServletResponse
response
);
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/IStandardService.java
View file @
554c846d
...
@@ -52,5 +52,5 @@ public interface IStandardService extends IService<Standard> {
...
@@ -52,5 +52,5 @@ public interface IStandardService extends IService<Standard> {
* 按检测组获取标样信息
* 按检测组获取标样信息
* @return GroupStandard
* @return GroupStandard
*/
*/
List
<
GroupStandard
>
getStandards
();
List
<
GroupStandard
>
getStandards
(
String
name
);
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EntrustServiceImpl.java
View file @
554c846d
...
@@ -1348,7 +1348,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
...
@@ -1348,7 +1348,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
//计算产值
//计算产值
if
(
sampleHandle
.
getHandleId
()
!=
null
)
{
if
(
sampleHandle
.
getHandleId
()
!=
null
)
{
try
{
try
{
iPrecipriceService
.
createPreciprice
(
sampleHandle
.
getUserId
(),
entrust
.
getId
(),
sampleHandle
.
getHandleId
(),
0
,
sample
.
getId
());
iPrecipriceService
.
createPreciprice
(
sampleHandle
.
getUserId
(),
entrust
.
getId
(),
sampleHandle
.
getHandleId
(),
0
,
sample
.
getId
()
,
true
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
System
.
out
.
println
(
e
.
getMessage
());
System
.
out
.
println
(
e
.
getMessage
());
return
BaseResponse
.
errorMsg
(
e
.
getMessage
());
return
BaseResponse
.
errorMsg
(
e
.
getMessage
());
...
@@ -1719,7 +1719,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
...
@@ -1719,7 +1719,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if
(
sampleDistributionTeamGroupVoList
!=
null
&&
sampleDistributionTeamGroupVoList
.
size
()
>
0
)
{
if
(
sampleDistributionTeamGroupVoList
!=
null
&&
sampleDistributionTeamGroupVoList
.
size
()
>
0
)
{
for
(
SampleDistributionTeamVo
sdVo
:
sampleDistributionTeamGroupVoList
)
{
for
(
SampleDistributionTeamVo
sdVo
:
sampleDistributionTeamGroupVoList
)
{
try
{
try
{
iPrecipriceService
.
createPreciprice
(
sdVo
.
getUserId
(),
entrust
.
getId
(),
sdVo
.
getTeamGroupId
(),
1
,
sample
.
getId
());
iPrecipriceService
.
createPreciprice
(
sdVo
.
getUserId
(),
entrust
.
getId
(),
sdVo
.
getTeamGroupId
(),
1
,
sample
.
getId
()
,
true
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
return
BaseResponse
.
errorMsg
(
e
.
getMessage
());
return
BaseResponse
.
errorMsg
(
e
.
getMessage
());
}
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/PrecipriceServiceImpl.java
View file @
554c846d
...
@@ -37,17 +37,14 @@ import cn.wise.sc.cement.business.service.ISysPostService;
...
@@ -37,17 +37,14 @@ import cn.wise.sc.cement.business.service.ISysPostService;
import
cn.wise.sc.cement.business.service.ISysUserService
;
import
cn.wise.sc.cement.business.service.ISysUserService
;
import
cn.wise.sc.cement.business.service.ITeamGroupService
;
import
cn.wise.sc.cement.business.service.ITeamGroupService
;
import
cn.wise.sc.cement.business.util.ExcelUtil
;
import
cn.wise.sc.cement.business.util.ExcelUtil
;
import
cn.wise.sc.cement.business.wrapper.page.Query
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
...
@@ -132,7 +129,7 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
...
@@ -132,7 +129,7 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
NESTED
)
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
NESTED
)
public
boolean
createPreciprice
(
final
Integer
userId
,
final
Integer
entrustId
,
public
boolean
createPreciprice
(
final
Integer
userId
,
final
Integer
entrustId
,
final
Integer
targetId
,
final
Integer
type
,
final
Integer
targetId
,
final
Integer
type
,
final
Integer
sampleId
)
{
final
Integer
sampleId
,
boolean
isUrgent
)
{
Assert
.
notNull
(
userId
,
"用户id不能为空!"
);
Assert
.
notNull
(
userId
,
"用户id不能为空!"
);
Assert
.
notNull
(
entrustId
,
"项目id不能为空!"
);
Assert
.
notNull
(
entrustId
,
"项目id不能为空!"
);
...
@@ -146,11 +143,10 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
...
@@ -146,11 +143,10 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
throw
new
IllegalArgumentException
(
"无效的项目id!"
);
throw
new
IllegalArgumentException
(
"无效的项目id!"
);
}
}
Preciprice
preciprice
=
new
Preciprice
();
Preciprice
preciprice
=
new
Preciprice
();
preciprice
.
setEntrustId
(
entrust
.
getId
());
preciprice
.
setEntrustId
(
entrust
.
getId
());
preciprice
.
setEntrustCode
(
entrust
.
getEntrustCode
());
preciprice
.
setEntrustCode
(
entrust
.
getEntrustCode
());
preciprice
.
setEntrustName
(
entrust
.
getProjectName
());
preciprice
.
setEntrustName
(
entrust
.
getProjectName
());
preciprice
.
setIsUrgent
(
isUrgent
?
1
:
0
);
//获取样品信息
//获取样品信息
Sample
sample
=
iSampleService
.
getById
(
sampleId
);
Sample
sample
=
iSampleService
.
getById
(
sampleId
);
if
(
BeanUtil
.
isEmpty
(
sample
))
{
if
(
BeanUtil
.
isEmpty
(
sample
))
{
...
@@ -181,9 +177,17 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
...
@@ -181,9 +177,17 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
preciprice
.
setSeparateRate
(
BigDecimal
.
valueOf
(
normProduction
.
getSeparateRate
()));
preciprice
.
setSeparateRate
(
BigDecimal
.
valueOf
(
normProduction
.
getSeparateRate
()));
preciprice
.
setQuotaDay
(
BigDecimal
.
valueOf
(
normProduction
.
getQuotaDay
()));
preciprice
.
setQuotaDay
(
BigDecimal
.
valueOf
(
normProduction
.
getQuotaDay
()));
if
(
type
==
1
)
{
if
(
type
==
1
)
{
preciprice
.
setPreciprice
(
calculateWorkTimeCoefficient
(
normProduction
,
normProduction
.
getAnalyseRate
()));
if
(
isUrgent
)
{
preciprice
.
setPreciprice
(
new
BigDecimal
(
3
).
subtract
(
calculateWorkTimeCoefficient
(
normProduction
,
normProduction
.
getAnalyseRate
())));
}
else
{
preciprice
.
setPreciprice
(
calculateWorkTimeCoefficient
(
normProduction
,
normProduction
.
getAnalyseRate
()));
}
}
else
{
}
else
{
preciprice
.
setPreciprice
(
calculateWorkTimeCoefficient
(
normProduction
,
normProduction
.
getAnalyseRate
()));
if
(
isUrgent
)
{
preciprice
.
setPreciprice
(
new
BigDecimal
(
3
).
subtract
(
calculateWorkTimeCoefficient
(
normProduction
,
normProduction
.
getAnalyseRate
())));
}
else
{
preciprice
.
setPreciprice
(
calculateWorkTimeCoefficient
(
normProduction
,
normProduction
.
getAnalyseRate
()));
}
}
}
//获取用户职位和账号
//获取用户职位和账号
SysUser
sysUser
=
iSysUserService
.
getById
(
userId
);
SysUser
sysUser
=
iSysUserService
.
getById
(
userId
);
...
@@ -325,6 +329,7 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
...
@@ -325,6 +329,7 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
qw
.
like
(
"user_id"
,
userId
);
qw
.
like
(
"user_id"
,
userId
);
}
}
qw
.
eq
(
"status"
,
1
);
qw
.
eq
(
"status"
,
1
);
qw
.
orderByDesc
(
"create_time"
);
List
<
Preciprice
>
list
=
this
.
list
(
qw
);
List
<
Preciprice
>
list
=
this
.
list
(
qw
);
List
<
NormProduction
.
NormProductionDetail
>
rts
=
new
ArrayList
<>(
list
.
size
());
List
<
NormProduction
.
NormProductionDetail
>
rts
=
new
ArrayList
<>(
list
.
size
());
for
(
Preciprice
preciprice
:
list
)
{
for
(
Preciprice
preciprice
:
list
)
{
...
@@ -347,7 +352,7 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
...
@@ -347,7 +352,7 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
}
}
//非标准产值
//非标准产值
List
<
NonStandardValue
>
nonStandardValues
=
iNonStandardValueService
.
nonValue
(
startDate
,
endDate
,
groupId
,
name
).
getData
();
List
<
NonStandardValue
>
nonStandardValues
=
iNonStandardValueService
.
nonValue
(
startDate
,
endDate
,
groupId
,
name
).
getData
();
//标准产值
//标准产值
List
<
NormProductionStatistics
>
productionStatistics
=
this
.
normProductionStatistics
(
start
,
end
,
name
,
groupId
).
getData
();
List
<
NormProductionStatistics
>
productionStatistics
=
this
.
normProductionStatistics
(
start
,
end
,
name
,
groupId
).
getData
();
//以userId找关系
//以userId找关系
...
@@ -588,12 +593,12 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
...
@@ -588,12 +593,12 @@ public class PrecipriceServiceImpl extends ServiceImpl<PrecipriceMapper, Precipr
@Override
@Override
public
boolean
updateStatusByEntrustId
(
Integer
entrustId
)
{
public
boolean
updateStatusByEntrustId
(
Integer
entrustId
)
{
cn
.
hutool
.
core
.
lang
.
Assert
.
notNull
(
entrustId
,
"报告id不能为空!"
);
cn
.
hutool
.
core
.
lang
.
Assert
.
notNull
(
entrustId
,
"报告id不能为空!"
);
try
{
try
{
precipriceMapper
.
updateStatusByEntrustId
(
entrustId
);
precipriceMapper
.
updateStatusByEntrustId
(
entrustId
);
return
true
;
return
true
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"更新产值状态失败!"
);
log
.
error
(
"更新产值状态失败!"
);
return
false
;
return
false
;
}
}
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/SampleServiceImpl.java
View file @
554c846d
package
cn
.
wise
.
sc
.
cement
.
business
.
service
.
impl
;
package
cn
.
wise
.
sc
.
cement
.
business
.
service
.
impl
;
import
cn.hutool.core.util.StrUtil
;
import
cn.wise.sc.cement.business.entity.Sample
;
import
cn.wise.sc.cement.business.entity.Sample
;
import
cn.wise.sc.cement.business.mapper.SampleMapper
;
import
cn.wise.sc.cement.business.mapper.SampleMapper
;
import
cn.wise.sc.cement.business.model.BaseResponse
;
import
cn.wise.sc.cement.business.model.BaseResponse
;
import
cn.wise.sc.cement.business.model.PageQuery
;
import
cn.wise.sc.cement.business.model.PageQuery
;
import
cn.wise.sc.cement.business.model.SampleSaveDto
;
import
cn.wise.sc.cement.business.model.query.SampleManageQuery
;
import
cn.wise.sc.cement.business.model.query.SampleManageQuery
;
import
cn.wise.sc.cement.business.model.vo.SampleVo
;
import
cn.wise.sc.cement.business.model.vo.SampleVo
;
import
cn.wise.sc.cement.business.service.ISampleService
;
import
cn.wise.sc.cement.business.service.ISampleService
;
...
@@ -37,178 +39,235 @@ import java.util.Map;
...
@@ -37,178 +39,235 @@ import java.util.Map;
@Service
@Service
public
class
SampleServiceImpl
extends
ServiceImpl
<
SampleMapper
,
Sample
>
implements
ISampleService
{
public
class
SampleServiceImpl
extends
ServiceImpl
<
SampleMapper
,
Sample
>
implements
ISampleService
{
@Resource
@Resource
private
SampleMapper
sampleMapper
;
private
SampleMapper
sampleMapper
;
private
final
ISysUserService
userService
;
private
final
ISysUserService
userService
;
public
SampleServiceImpl
(
ISysUserService
userService
)
{
public
SampleServiceImpl
(
ISysUserService
userService
)
{
this
.
userService
=
userService
;
this
.
userService
=
userService
;
}
}
/**
/**
* 分页列表
* 分页列表
*
*
* @param pageQuery
* @param pageQuery
* @param sampleName
* @param sampleName
* @param cementCode
* @param cementCode
* @return
* @return
*/
*/
@Override
@Override
public
BaseResponse
<
IPage
<
SampleVo
>>
getPage
(
PageQuery
pageQuery
,
String
sampleName
,
String
cementCode
)
{
public
BaseResponse
<
IPage
<
SampleVo
>>
getPage
(
PageQuery
pageQuery
,
String
sampleName
,
String
cementCode
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"sampleName"
,
sampleName
);
params
.
put
(
"sampleName"
,
sampleName
);
params
.
put
(
"cementCode"
,
cementCode
);
params
.
put
(
"cementCode"
,
cementCode
);
Page
<
SampleVo
>
page
=
new
Page
<>(
pageQuery
.
getPageNo
(),
pageQuery
.
getPageSize
());
Page
<
SampleVo
>
page
=
new
Page
<>(
pageQuery
.
getPageNo
(),
pageQuery
.
getPageSize
());
IPage
<
SampleVo
>
pages
=
sampleMapper
.
getPage
(
page
,
params
);
IPage
<
SampleVo
>
pages
=
sampleMapper
.
getPage
(
page
,
params
);
return
BaseResponse
.
okData
(
pages
);
return
BaseResponse
.
okData
(
pages
);
}
}
/**
/**
* 样品管理详情
* 样品管理详情
*
*
* @param id
* @param id
* @return
* @return
*/
*/
@Override
@Override
public
BaseResponse
<
SampleVo
>
getDetail
(
Integer
id
)
{
public
BaseResponse
<
SampleVo
>
getDetail
(
Integer
id
)
{
SampleVo
sampleVo
=
sampleMapper
.
getDetail
(
id
);
SampleVo
sampleVo
=
sampleMapper
.
getDetail
(
id
);
if
(
sampleVo
==
null
)
{
if
(
sampleVo
==
null
)
{
return
BaseResponse
.
errorMsg
(
"信息错误!"
);
return
BaseResponse
.
errorMsg
(
"信息错误!"
);
}
}
return
BaseResponse
.
okData
(
sampleVo
);
return
BaseResponse
.
okData
(
sampleVo
);
}
}
/**
/**
* 样品登记
* 样品登记
*
*
* @param query
* @param query
* @return
* @return
*/
*/
@Transactional
@Transactional
@Override
@Override
public
BaseResponse
<
String
>
register
(
SampleManageQuery
query
)
{
public
BaseResponse
<
String
>
register
(
SampleManageQuery
query
)
{
if
(
query
.
getId
()
==
null
)
{
if
(
query
.
getId
()
==
null
)
{
return
BaseResponse
.
errorMsg
(
"参数错误!"
);
return
BaseResponse
.
errorMsg
(
"参数错误!"
);
}
}
Sample
sample
=
sampleMapper
.
selectById
(
query
.
getId
());
Sample
sample
=
sampleMapper
.
selectById
(
query
.
getId
());
if
(
sample
==
null
)
{
if
(
sample
==
null
)
{
return
BaseResponse
.
errorMsg
(
"信息错误"
);
return
BaseResponse
.
errorMsg
(
"信息错误"
);
}
}
sample
.
setOperatorId
(
userService
.
getLoginUser
().
getId
())
sample
.
setOperatorId
(
userService
.
getLoginUser
().
getId
())
.
setRegisterTime
(
LocalDateTime
.
now
())
.
setRegisterTime
(
LocalDateTime
.
now
())
.
setHandleDate
(
query
.
getHandleDate
())
.
setHandleDate
(
query
.
getHandleDate
())
.
setLittlePosition
(
query
.
getLittlePosition
())
.
setLittlePosition
(
query
.
getLittlePosition
())
.
setOriginalPosition
(
query
.
getOriginalPosition
())
.
setOriginalPosition
(
query
.
getOriginalPosition
())
.
setRemark
(
query
.
getRemark
());
.
setRemark
(
query
.
getRemark
());
sampleMapper
.
updateById
(
sample
);
sampleMapper
.
updateById
(
sample
);
return
BaseResponse
.
okData
(
"样品登记成功"
);
return
BaseResponse
.
okData
(
"样品登记成功"
);
}
}
/**
/**
* 样品销毁
* 样品销毁
*
*
* @param id
* @param id
* @return
* @return
*/
*/
@Transactional
@Transactional
@Override
@Override
public
BaseResponse
<
String
>
destruction
(
Integer
id
)
{
public
BaseResponse
<
String
>
destruction
(
Integer
id
)
{
if
(
id
==
null
)
{
if
(
id
==
null
)
{
return
BaseResponse
.
errorMsg
(
"参数错误!"
);
return
BaseResponse
.
errorMsg
(
"参数错误!"
);
}
}
Sample
sample
=
sampleMapper
.
selectById
(
id
);
Sample
sample
=
sampleMapper
.
selectById
(
id
);
if
(
sample
==
null
)
{
if
(
sample
==
null
)
{
return
BaseResponse
.
errorMsg
(
"信息错误"
);
return
BaseResponse
.
errorMsg
(
"信息错误"
);
}
}
sample
.
setStatus
(
2
)
sample
.
setStatus
(
2
)
.
setDestructionTime
(
LocalDateTime
.
now
());
.
setDestructionTime
(
LocalDateTime
.
now
());
sampleMapper
.
updateById
(
sample
);
sampleMapper
.
updateById
(
sample
);
return
BaseResponse
.
okData
(
"样品已销毁"
);
return
BaseResponse
.
okData
(
"样品已销毁"
);
}
}
/**
/**
* 样品列表导出
* 样品列表导出
*
*
* @param sampleName
* @param sampleName
* @param cementCode
* @param cementCode
* @param fileName
* @param fileName
* @param response
* @param response
*/
*/
public
void
export
(
String
sampleName
,
String
cementCode
,
public
void
export
(
String
sampleName
,
String
cementCode
,
String
fileName
,
HttpServletResponse
response
)
{
String
fileName
,
HttpServletResponse
response
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"sampleName"
,
sampleName
);
params
.
put
(
"sampleName"
,
sampleName
);
params
.
put
(
"cementCode"
,
cementCode
);
params
.
put
(
"cementCode"
,
cementCode
);
List
<
Map
<
String
,
Object
>>
list
=
sampleMapper
.
exportList
(
params
);
List
<
Map
<
String
,
Object
>>
list
=
sampleMapper
.
exportList
(
params
);
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
Map
<
String
,
Object
>
map
=
list
.
get
(
0
);
Map
<
String
,
Object
>
map
=
list
.
get
(
0
);
String
[]
headers
=
new
String
[
map
.
size
()];
String
[]
headers
=
new
String
[
map
.
size
()];
headers
[
0
]
=
"序号"
;
headers
[
0
]
=
"序号"
;
headers
[
1
]
=
"样品名称"
;
headers
[
1
]
=
"样品名称"
;
headers
[
2
]
=
"样品本所编号"
;
headers
[
2
]
=
"样品本所编号"
;
headers
[
3
]
=
"所属项目"
;
headers
[
3
]
=
"所属项目"
;
headers
[
4
]
=
"小样信息"
;
headers
[
4
]
=
"小样信息"
;
headers
[
5
]
=
"原样存储"
;
headers
[
5
]
=
"原样存储"
;
headers
[
6
]
=
"样品重量(kg)"
;
headers
[
6
]
=
"样品重量(kg)"
;
headers
[
7
]
=
"是否为平行样"
;
headers
[
7
]
=
"是否为平行样"
;
headers
[
8
]
=
"状态"
;
headers
[
8
]
=
"状态"
;
List
<
Object
[]>
datas
=
new
ArrayList
<>(
headers
.
length
);
List
<
Object
[]>
datas
=
new
ArrayList
<>(
headers
.
length
);
for
(
Map
<
String
,
Object
>
m
:
list
)
{
for
(
Map
<
String
,
Object
>
m
:
list
)
{
Object
[]
objects
=
new
Object
[
headers
.
length
];
Object
[]
objects
=
new
Object
[
headers
.
length
];
for
(
int
j
=
0
;
j
<
headers
.
length
;
j
++)
{
for
(
int
j
=
0
;
j
<
headers
.
length
;
j
++)
{
String
obj
=
m
.
get
(
headers
[
j
]).
toString
();
String
obj
=
m
.
get
(
headers
[
j
]).
toString
();
//如果序号带小数点 去除.0,保留整数
//如果序号带小数点 去除.0,保留整数
if
(
j
==
0
)
{
if
(
j
==
0
)
{
obj
=
obj
.
split
(
"\\."
)[
0
];
obj
=
obj
.
split
(
"\\."
)[
0
];
}
}
objects
[
j
]
=
obj
;
objects
[
j
]
=
obj
;
}
}
datas
.
add
(
objects
);
datas
.
add
(
objects
);
}
}
ExcelUtil
.
excelExport
(
ExcelUtil
.
excelExport
(
fileName
==
null
||
fileName
.
trim
().
length
()
<=
0
?
"样品列表"
:
fileName
,
headers
,
fileName
==
null
||
fileName
.
trim
().
length
()
<=
0
?
"样品列表"
:
fileName
,
headers
,
datas
,
response
);
datas
,
response
);
}
}
}
}
@Override
@Override
public
BaseResponse
<
String
>
bindSavePosition
(
SampleManageQuery
query
)
{
public
BaseResponse
<
String
>
bindSavePosition
(
SampleManageQuery
query
)
{
if
(
query
.
getId
()
==
null
)
{
if
(
query
.
getId
()
==
null
)
{
return
BaseResponse
.
errorMsg
(
""
);
return
BaseResponse
.
errorMsg
(
""
);
}
}
Sample
sample
=
this
.
getById
(
query
.
getId
());
Sample
sample
=
this
.
getById
(
query
.
getId
());
sample
.
setStatus
(
1
);
sample
.
setStatus
(
1
);
sample
.
setDestructionTime
(
LocalDateTime
.
now
());
sample
.
setDestructionTime
(
LocalDateTime
.
now
());
sample
.
setHandleDate
(
LocalDate
.
now
());
sample
.
setHandleDate
(
LocalDate
.
now
());
sample
.
setLittlePosition
(
query
.
getLittlePosition
());
sample
.
setLittlePosition
(
query
.
getLittlePosition
());
sample
.
setOriginalPosition
(
query
.
getOriginalPosition
());
sample
.
setOriginalPosition
(
query
.
getOriginalPosition
());
boolean
b
=
this
.
updateById
(
sample
);
boolean
b
=
this
.
updateById
(
sample
);
if
(
b
)
{
if
(
b
)
{
return
BaseResponse
.
okData
(
"更新成功!"
);
return
BaseResponse
.
okData
(
"更新成功!"
);
}
else
{
}
else
{
return
BaseResponse
.
errorMsg
(
"更新失败,可以重新尝试!"
);
return
BaseResponse
.
errorMsg
(
"更新失败,可以重新尝试!"
);
}
}
}
}
@Override
@Override
public
BaseResponse
<
Boolean
>
ampleReview
(
Integer
id
)
{
public
BaseResponse
<
Boolean
>
ampleReview
(
Integer
id
)
{
if
(
id
==
null
)
{
if
(
id
==
null
)
{
log
.
debug
(
"样品复查失败!没有指定样品id!"
);
log
.
debug
(
"样品复查失败!没有指定样品id!"
);
return
BaseResponse
.
errorMsg
(
"请指定样品id"
);
return
BaseResponse
.
errorMsg
(
"请指定样品id"
);
}
}
Sample
sample
=
this
.
getById
(
id
);
Sample
sample
=
this
.
getById
(
id
);
sample
.
setStatus
(
3
);
sample
.
setStatus
(
3
);
boolean
b
=
this
.
updateById
(
sample
);
boolean
b
=
this
.
updateById
(
sample
);
if
(
b
)
{
if
(
b
)
{
return
BaseResponse
.
okData
(
true
);
return
BaseResponse
.
okData
(
true
);
}
}
return
BaseResponse
.
okData
(
false
);
return
BaseResponse
.
okData
(
false
);
}
}
@Override
public
void
upload
(
HttpServletResponse
response
)
{
List
<
SampleSaveDto
>
saveDtos
=
sampleMapper
.
getSampleSaveList
();
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
saveDtos
.
forEach
(
arg
->
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"项目名称"
,
arg
.
getId
());
map
.
put
(
"项目编号"
,
arg
.
getCementCode
());
map
.
put
(
"样品名称"
,
arg
.
getName
());
map
.
put
(
"样品状态"
,
arg
.
getSampleForm
());
map
.
put
(
"来样编号"
,
arg
.
getSampleCode
());
map
.
put
(
"本所编号"
,
arg
.
getCementCode
());
map
.
put
(
"小样保存位置"
,
arg
.
getLittlePosition
());
map
.
put
(
"保存日期"
,
arg
.
getRegisterTime
());
map
.
put
(
"销毁日期"
,
arg
.
getDestructionTime
());
map
.
put
(
"批准人"
,
arg
.
getUserName
());
map
.
put
(
"备注"
,
arg
.
getRemark
());
list
.
add
(
map
);
});
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
Map
<
String
,
Object
>
map
=
list
.
get
(
0
);
String
[]
headers
=
new
String
[
map
.
size
()];
headers
[
0
]
=
"项目名称"
;
headers
[
1
]
=
"项目编号"
;
headers
[
2
]
=
"样品名称"
;
headers
[
3
]
=
"样品状态"
;
headers
[
4
]
=
"来样编号"
;
headers
[
5
]
=
"本所编号"
;
headers
[
6
]
=
"小样保存位置"
;
headers
[
7
]
=
"保存日期"
;
headers
[
8
]
=
"销毁日期"
;
headers
[
9
]
=
"批准人"
;
headers
[
10
]
=
"备注"
;
List
<
Object
[]>
datas
=
new
ArrayList
<>(
headers
.
length
);
for
(
Map
<
String
,
Object
>
m
:
list
)
{
Object
[]
objects
=
new
Object
[
headers
.
length
];
for
(
int
j
=
0
;
j
<
headers
.
length
;
j
++)
{
String
obj
;
if
(
j
<
7
)
{
obj
=
m
.
get
(
headers
[
j
])
==
null
?
"—"
:
m
.
get
(
headers
[
j
]).
toString
();
}
else
{
obj
=
m
.
get
(
headers
[
j
])
==
null
?
""
:
m
.
get
(
headers
[
j
]).
toString
();
}
//如果序号带小数点 去除.0,保留整数
if
(
j
==
0
)
{
obj
=
obj
.
split
(
"\\."
)[
0
];
}
objects
[
j
]
=
obj
;
}
datas
.
add
(
objects
);
}
ExcelUtil
.
excelExportNew
(
"样品处置列表"
,
headers
,
datas
,
response
);
}
}
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/StandardServiceImpl.java
View file @
554c846d
package
cn
.
wise
.
sc
.
cement
.
business
.
service
.
impl
;
package
cn
.
wise
.
sc
.
cement
.
business
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.wise.sc.cement.business.entity.*
;
import
cn.wise.sc.cement.business.entity.*
;
import
cn.wise.sc.cement.business.mapper.EntityEnclosureMapper
;
import
cn.wise.sc.cement.business.mapper.EntityEnclosureMapper
;
import
cn.wise.sc.cement.business.mapper.StandardEnterMapper
;
import
cn.wise.sc.cement.business.mapper.StandardEnterMapper
;
...
@@ -11,6 +13,7 @@ import cn.wise.sc.cement.business.model.PageQuery;
...
@@ -11,6 +13,7 @@ import cn.wise.sc.cement.business.model.PageQuery;
import
cn.wise.sc.cement.business.model.query.*
;
import
cn.wise.sc.cement.business.model.query.*
;
import
cn.wise.sc.cement.business.model.vo.StandardValueVo
;
import
cn.wise.sc.cement.business.model.vo.StandardValueVo
;
import
cn.wise.sc.cement.business.model.vo.StandardVo
;
import
cn.wise.sc.cement.business.model.vo.StandardVo
;
import
cn.wise.sc.cement.business.service.ISampleCheckService
;
import
cn.wise.sc.cement.business.service.IStandardService
;
import
cn.wise.sc.cement.business.service.IStandardService
;
import
cn.wise.sc.cement.business.service.IStandardValueService
;
import
cn.wise.sc.cement.business.service.IStandardValueService
;
import
cn.wise.sc.cement.business.service.ISysUserService
;
import
cn.wise.sc.cement.business.service.ISysUserService
;
...
@@ -27,8 +30,11 @@ import org.springframework.beans.BeanUtils;
...
@@ -27,8 +30,11 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -36,6 +42,8 @@ import java.util.HashSet;
...
@@ -36,6 +42,8 @@ import java.util.HashSet;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.function.BiFunction
;
import
java.util.stream.Collectors
;
/**
/**
* <p>
* <p>
...
@@ -60,6 +68,8 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
...
@@ -60,6 +68,8 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
private
IStandardValueService
standardValueService
;
private
IStandardValueService
standardValueService
;
@Autowired
@Autowired
private
CommonServiceImpl
commonService
;
private
CommonServiceImpl
commonService
;
@Autowired
private
ISampleCheckService
iSampleCheckService
;
/**
/**
* 分页查询
* 分页查询
...
@@ -412,18 +422,22 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
...
@@ -412,18 +422,22 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
}
}
@Override
@Override
public
List
<
GroupStandard
>
getStandards
()
{
public
List
<
GroupStandard
>
getStandards
(
String
name
)
{
//获取标样信息
List
<
StandardGroupDto
>
list
=
standardMapper
.
getStandardsByGroup
();
List
<
StandardGroupDto
>
list
=
standardMapper
.
getStandardsByGroup
();
List
<
GroupStandard
>
rts
=
new
ArrayList
<>(
list
.
size
());
List
<
GroupStandard
>
rts
=
new
ArrayList
<>(
list
.
size
());
Set
<
Integer
>
standardIds
=
new
HashSet
<>();
Set
<
Integer
>
standardIds
=
new
HashSet
<>();
for
(
StandardGroupDto
tmp
:
list
)
{
for
(
StandardGroupDto
tmp
:
list
)
{
//将每个标准值根据GroupId(样品id)分组
if
(!
standardIds
.
contains
(
tmp
.
getGroupId
()))
{
if
(!
standardIds
.
contains
(
tmp
.
getGroupId
()))
{
standardIds
.
add
(
tmp
.
getGroupId
());
standardIds
.
add
(
tmp
.
getGroupId
());
//样品标样Vo
GroupStandard
groupStandard
=
new
GroupStandard
();
GroupStandard
groupStandard
=
new
GroupStandard
();
groupStandard
.
setGroupName
(
tmp
.
getGroupName
());
groupStandard
.
setGroupName
(
tmp
.
getGroupName
());
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
List
<
KeyValueMap
>
keyValueMaps
=
ObjUtils
.
str2Obj
(
tmp
.
getElementValue
());
List
<
KeyValueMap
>
keyValueMaps
=
ObjUtils
.
str2Obj
(
tmp
.
getElementValue
());
//将标样元素添加进样品标样
keyValueMaps
keyValueMaps
.
stream
()
.
stream
()
.
filter
(
arg
->
"标准值"
.
equals
(
arg
.
getName
()))
.
filter
(
arg
->
"标准值"
.
equals
(
arg
.
getName
()))
...
@@ -450,7 +464,74 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
...
@@ -450,7 +464,74 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
}
}
}
}
//获取历史样品信息
List
<
SampleCheck
>
sampleChecks
=
iSampleCheckService
.
list
();
if
(
CollectionUtil
.
isEmpty
(
sampleChecks
))
{
return
rts
;
}
Set
<
String
>
cementCodes
=
sampleChecks
.
stream
()
.
map
(
SampleCheck:
:
getCementCode
).
collect
(
Collectors
.
toSet
());
//根据cementCodes和team_group_id计算多个平行样的平均值
for
(
String
cementCode
:
cementCodes
)
{
List
<
SampleCheck
>
collect
=
sampleChecks
.
stream
()
.
filter
(
arg
->
arg
.
getCementCode
().
equals
(
cementCode
)).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isEmpty
(
collect
))
{
continue
;
}
Set
<
Integer
>
groupIds
=
collect
.
stream
()
.
map
(
SampleCheck:
:
getTeamGroupId
).
collect
(
Collectors
.
toSet
());
//根据groupI处理team检测值
for
(
Integer
groupId
:
groupIds
)
{
List
<
SampleCheck
>
checkGroups
=
collect
.
stream
()
.
filter
(
arg
->
arg
.
getTeamGroupId
().
intValue
()
==
groupId
)
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isEmpty
(
checkGroups
))
{
continue
;
}
//将每个元素组的所有元素的标准值累加
Map
<
String
,
BigDecimal
>
elementMap
=
new
HashMap
<>();
checkGroups
.
forEach
(
arg
->
{
List
<
KeyValueMap
>
keyValueMaps
=
ObjUtils
.
str2Obj
(
arg
.
getCountResults
());
//将样品的输入值添加到map中
keyValueMaps
.
forEach
(
opt
->
{
if
(
elementMap
.
containsKey
(
opt
.
getName
()))
{
elementMap
.
get
(
opt
.
getName
()).
add
(
new
BigDecimal
(
StrUtil
.
isEmpty
(
opt
.
getValue
())
?
"0"
:
opt
.
getValue
()));
}
else
{
elementMap
.
put
(
opt
.
getName
(),
new
BigDecimal
(
StrUtil
.
isEmpty
(
opt
.
getValue
())
?
"0"
:
opt
.
getValue
()));
}
});
});
//求平均
GroupStandard
groupStandard
=
new
GroupStandard
();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
groupStandard
.
setMap
(
map
);
groupStandard
.
setCementCode
(
cementCode
);
groupStandard
.
setGroupName
(
checkGroups
.
get
(
0
).
getTeamGroupName
()
+
"|"
+
cementCode
);
if
(
CollectionUtil
.
isEmpty
(
elementMap
))
{
continue
;
}
elementMap
.
keySet
().
forEach
(
opt
->
{
BigDecimal
avg
=
elementMap
.
get
(
opt
)
.
divide
(
new
BigDecimal
(
checkGroups
.
size
()))
.
setScale
(
2
,
RoundingMode
.
HALF_DOWN
);
map
.
put
(
opt
,
avg
.
toString
());
});
rts
.
add
(
groupStandard
);
}
}
if
(!
StrUtil
.
isEmpty
(
name
))
{
return
rts
.
stream
()
.
filter
(
opt
->
opt
.
getGroupName
().
contains
(
name
)
||
name
.
equals
(
opt
.
getCementCode
()))
.
collect
(
Collectors
.
toList
());
}
return
rts
;
return
rts
;
}
}
public
static
void
main
(
String
[]
args
)
{
BigDecimal
bigDecimal
=
new
BigDecimal
(
111
);
System
.
out
.
println
(
bigDecimal
.
toString
());
}
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/util/ExcelUtil.java
View file @
554c846d
...
@@ -16,6 +16,7 @@ import org.apache.poi.ss.usermodel.Font;
...
@@ -16,6 +16,7 @@ import org.apache.poi.ss.usermodel.Font;
import
org.apache.poi.ss.usermodel.HorizontalAlignment
;
import
org.apache.poi.ss.usermodel.HorizontalAlignment
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.VerticalAlignment
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.ss.usermodel.Workbook
;
/**
/**
...
@@ -113,7 +114,42 @@ public class ExcelUtil {
...
@@ -113,7 +114,42 @@ public class ExcelUtil {
}
}
}
}
}
}
public
static
void
excelExportNew
(
String
fileName
,
String
[]
headers
,
List
<
Object
[]>
datas
,
HttpServletResponse
response
)
{
Workbook
workbook
=
getWorkbookNew
(
headers
,
datas
);
if
(
workbook
!=
null
)
{
ByteArrayOutputStream
byteArrayOutputStream
=
null
;
try
{
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
workbook
.
write
(
byteArrayOutputStream
);
String
suffix
=
".xls"
;
response
.
setContentType
(
"application/vnd.ms-excel;charset=utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
new
String
((
fileName
+
suffix
).
getBytes
(),
"iso-8859-1"
));
OutputStream
outputStream
=
response
.
getOutputStream
();
outputStream
.
write
(
byteArrayOutputStream
.
toByteArray
());
outputStream
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
byteArrayOutputStream
!=
null
)
{
byteArrayOutputStream
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
try
{
workbook
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
/**
/**
* @param headers 列头
* @param headers 列头
* @param datas 数据
* @param datas 数据
...
@@ -176,4 +212,65 @@ public class ExcelUtil {
...
@@ -176,4 +212,65 @@ public class ExcelUtil {
return
workbook
;
return
workbook
;
}
}
public
static
Workbook
getWorkbookNew
(
String
[]
headers
,
List
<
Object
[]>
datas
)
{
Workbook
workbook
=
new
HSSFWorkbook
();
Sheet
sheet
=
workbook
.
createSheet
();
workbook
.
setSheetName
(
0
,
"样品处置记录"
);
Row
row
=
null
;
Cell
cell
=
null
;
Font
font
=
workbook
.
createFont
();
int
line
=
0
,
maxColumn
=
0
;
if
(
headers
!=
null
&&
headers
.
length
>
0
)
{
// 设置列头
CellStyle
style
=
workbook
.
createCellStyle
();
style
.
setAlignment
(
HorizontalAlignment
.
CENTER_SELECTION
);
style
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
row
=
sheet
.
createRow
(
line
++);
row
.
setHeightInPoints
(
23
);
font
.
setFontHeightInPoints
((
short
)
12
);
font
.
setFontName
(
"宋体"
);
style
.
setFont
(
font
);
maxColumn
=
headers
.
length
;
for
(
int
i
=
0
;
i
<
maxColumn
;
i
++)
{
cell
=
row
.
createCell
(
i
);
cell
.
setCellValue
(
headers
[
i
]);
cell
.
setCellStyle
(
style
);
}
}
if
(
datas
!=
null
&&
datas
.
size
()
>
0
)
{
// 渲染数据
CellStyle
style
=
workbook
.
createCellStyle
();
for
(
int
index
=
0
,
size
=
datas
.
size
();
index
<
size
;
index
++)
{
Object
[]
data
=
datas
.
get
(
index
);
if
(
data
!=
null
&&
data
.
length
>
0
)
{
row
=
sheet
.
createRow
(
line
++);
row
.
setHeightInPoints
(
20
);
int
length
=
data
.
length
;
if
(
length
>
maxColumn
)
{
maxColumn
=
length
;
}
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
style
.
setWrapText
(
true
);
//关键
style
.
setFont
(
font
);
cell
=
row
.
createCell
(
i
);
cell
.
setCellValue
(
data
[
i
]
==
null
?
null
:
data
[
i
].
toString
());
cell
.
setCellStyle
(
style
);
style
.
setAlignment
(
HorizontalAlignment
.
CENTER_SELECTION
);
}
}
}
}
for
(
int
i
=
0
;
i
<
maxColumn
;
i
++)
{
sheet
.
autoSizeColumn
(
i
);
}
return
workbook
;
}
}
}
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