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
96c8aad6
Commit
96c8aad6
authored
Sep 08, 2020
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
样品管理接口完成
parent
b615a9c7
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
443 additions
and
9 deletions
+443
-9
SampleController.java
.../wise/sc/cement/business/controller/SampleController.java
+90
-0
Sample.java
...c/main/java/cn/wise/sc/cement/business/entity/Sample.java
+31
-0
SampleMapper.java
.../java/cn/wise/sc/cement/business/mapper/SampleMapper.java
+11
-0
SampleMapper.xml
...va/cn/wise/sc/cement/business/mapper/xml/SampleMapper.xml
+27
-0
SampleManageQuery.java
...ise/sc/cement/business/model/query/SampleManageQuery.java
+36
-0
SampleManageVo.java
...a/cn/wise/sc/cement/business/model/vo/SampleManageVo.java
+80
-0
SampleVo.java
...in/java/cn/wise/sc/cement/business/model/vo/SampleVo.java
+36
-0
ISampleService.java
...va/cn/wise/sc/cement/business/service/ISampleService.java
+13
-0
EntrustServiceImpl.java
...e/sc/cement/business/service/impl/EntrustServiceImpl.java
+18
-9
SampleServiceImpl.java
...se/sc/cement/business/service/impl/SampleServiceImpl.java
+101
-0
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/controller/SampleController.java
0 → 100644
View file @
96c8aad6
package
cn
.
wise
.
sc
.
cement
.
business
.
controller
;
import
cn.wise.sc.cement.business.model.BaseResponse
;
import
cn.wise.sc.cement.business.model.PageQuery
;
import
cn.wise.sc.cement.business.model.query.SampleManageQuery
;
import
cn.wise.sc.cement.business.model.query.StandardQuery
;
import
cn.wise.sc.cement.business.service.ISampleService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
/**
* <p>
* 前端控制器
* </p>
*
* @author ztw
* @since 2020-09-04
*/
@Api
(
tags
=
"样品管理"
)
@RestController
@RequestMapping
(
"/business/sample"
)
public
class
SampleController
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
"SampleController"
);
@Autowired
private
ISampleService
sampleService
;
@ApiOperation
(
value
=
"样品分页列表"
)
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"sampleName"
,
value
=
"样品名称"
,
paramType
=
"query"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"cementCode"
,
value
=
"样品本所编号"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
@GetMapping
(
"/getPage"
)
public
BaseResponse
getPage
(
PageQuery
pageQuery
,
String
sampleName
,
String
cementCode
)
{
try
{
return
sampleService
.
getPage
(
pageQuery
,
sampleName
,
cementCode
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"样品分页列表{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"样品详情"
)
@GetMapping
(
"/{id}"
)
public
BaseResponse
getById
(
@PathVariable
Integer
id
){
try
{
return
sampleService
.
getDetail
(
id
);
}
catch
(
Exception
e
){
log
.
debug
(
"样品详情{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"样品登记"
)
@PostMapping
(
"/register"
)
public
BaseResponse
register
(
@RequestBody
SampleManageQuery
query
)
{
try
{
return
sampleService
.
register
(
query
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"样品登记{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"样品销毁"
)
@PostMapping
(
"/destruction/{}"
)
public
BaseResponse
destruction
(
@PathVariable
Integer
id
)
{
try
{
return
sampleService
.
destruction
(
id
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"样品销毁{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/entity/Sample.java
View file @
96c8aad6
...
@@ -3,6 +3,8 @@ package cn.wise.sc.cement.business.entity;
...
@@ -3,6 +3,8 @@ package cn.wise.sc.cement.business.entity;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -81,4 +83,33 @@ public class Sample implements Serializable {
...
@@ -81,4 +83,33 @@ public class Sample implements Serializable {
private
String
surfaceResult
;
private
String
surfaceResult
;
//样品管理列表信息
@ApiModelProperty
(
"样品登记操作人id"
)
private
Integer
operatorId
;
@ApiModelProperty
(
"样品登记时间"
)
private
LocalDateTime
registerTime
;
@ApiModelProperty
(
"处理提醒时间"
)
private
LocalDate
handleDate
;
@ApiModelProperty
(
"小样位置"
)
private
String
littlePosition
;
@ApiModelProperty
(
"原样位置"
)
private
String
originalPosition
;
@ApiModelProperty
(
"(0未领用,1已领用,2已销毁)"
)
private
Integer
status
;
@ApiModelProperty
(
"销毁时间"
)
private
LocalDateTime
destructionTime
;
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/SampleMapper.java
View file @
96c8aad6
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.vo.SampleManageVo
;
import
cn.wise.sc.cement.business.model.vo.SampleVo
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
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
java.util.Map
;
/**
/**
* <p>
* <p>
...
@@ -13,4 +20,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...
@@ -13,4 +20,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
*/
public
interface
SampleMapper
extends
BaseMapper
<
Sample
>
{
public
interface
SampleMapper
extends
BaseMapper
<
Sample
>
{
IPage
<
SampleVo
>
getPage
(
@Param
(
"page"
)
Page
page
,
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
SampleVo
getDetail
(
Integer
id
);
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/SampleMapper.xml
View file @
96c8aad6
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.wise.sc.cement.business.mapper.SampleMapper"
>
<mapper
namespace=
"cn.wise.sc.cement.business.mapper.SampleMapper"
>
<sql
id=
"where"
>
<where>
<if
test=
"params.sampleName != null and params.sampleName != ''"
>
and s.name like concat('%', #{params.sampleName}, '%')
</if>
<if
test=
"params.cementCode != null and params.cementCode != ''"
>
and s.cement_code = #{params.cementCode}
</if>
</where>
</sql>
<select
id=
"getPage"
resultType=
"cn.wise.sc.cement.business.model.vo.SampleVo"
>
select s.*, p.id as projectId, p.name as projectName, p.code as projectCode
from sample s
left join entrust e on e.id = s.entrust_id
left join project p on p.id = e.project_id
<include
refid=
"where"
/>
order by s.create_time desc
</select>
<select
id=
"getDetail"
resultType=
"cn.wise.sc.cement.business.model.vo.SampleVo"
>
select sm.*,s.name as sampleName, s.cement_code as cementCode, s.weight as weight
from sample s
left join entrust e on e.id = s.entrust_id
left join project p on p.id = e.project_id
where s.id = #{id}
</select>
</mapper>
</mapper>
cement-business/src/main/java/cn/wise/sc/cement/business/model/query/SampleManageQuery.java
0 → 100644
View file @
96c8aad6
package
cn
.
wise
.
sc
.
cement
.
business
.
model
.
query
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
/**
* @description:
* @author: ztw
* @create: 2020-09-07 15:42
**/
@Data
@ApiModel
(
"样品管理请求"
)
public
class
SampleManageQuery
{
@ApiModelProperty
(
"样品管理表id"
)
private
Integer
id
;
@ApiModelProperty
(
"处理提醒时间"
)
private
LocalDate
handleDate
;
@ApiModelProperty
(
"小样位置"
)
private
String
littlePosition
;
@ApiModelProperty
(
"原样位置"
)
private
String
originalPosition
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
}
cement-business/src/main/java/cn/wise/sc/cement/business/model/vo/SampleManageVo.java
0 → 100644
View file @
96c8aad6
package
cn
.
wise
.
sc
.
cement
.
business
.
model
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
* @description:
* @author: ztw
* @create: 2020-08-07 14:58
**/
@Data
@ApiModel
(
"样品管理Vo"
)
public
class
SampleManageVo
{
@ApiModelProperty
(
"样品管理表id"
)
private
Integer
id
;
@ApiModelProperty
(
"样品表d"
)
private
Integer
sampleId
;
@ApiModelProperty
(
"样品名称"
)
private
String
sampleName
;
@ApiModelProperty
(
"来样编号(样品编号)"
)
private
String
sampleCode
;
@ApiModelProperty
(
"样品本所编号"
)
private
String
cementCode
;
@ApiModelProperty
(
"样品重量(kg)"
)
private
BigDecimal
weight
;
@ApiModelProperty
(
"处理人id"
)
private
Integer
userId
;
@ApiModelProperty
(
"项目id"
)
private
Integer
projectId
;
@ApiModelProperty
(
"项目名称"
)
private
String
projectName
;
@ApiModelProperty
(
"项目编号"
)
private
String
projectCode
;
@ApiModelProperty
(
"处理方式(0,取回,1由本所统一处置)"
)
private
Integer
handleMethod
;
@ApiModelProperty
(
"处理提醒时间"
)
private
LocalDate
handleDate
;
@ApiModelProperty
(
"小样位置"
)
private
String
littlePosition
;
@ApiModelProperty
(
"原样位置"
)
private
String
originalPosition
;
@ApiModelProperty
(
"(0未领用,1已领用,2已销毁)"
)
private
Integer
status
;
@ApiModelProperty
(
"样品登记时间"
)
private
LocalDateTime
registerTime
;
@ApiModelProperty
(
"销毁时间"
)
private
LocalDateTime
destructionTime
;
@ApiModelProperty
(
"创建时间"
)
private
LocalDateTime
createTime
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
}
cement-business/src/main/java/cn/wise/sc/cement/business/model/vo/SampleVo.java
View file @
96c8aad6
...
@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -58,4 +60,38 @@ public class SampleVo {
...
@@ -58,4 +60,38 @@ public class SampleVo {
@ApiModelProperty
(
"检测项目列表"
)
@ApiModelProperty
(
"检测项目列表"
)
private
List
<
SampleDistributionTeamVo
>
sampleDistributionTeamVoList
;
private
List
<
SampleDistributionTeamVo
>
sampleDistributionTeamVoList
;
//样品管理列表信息
@ApiModelProperty
(
"样品登记操作人id"
)
private
Integer
operatorId
;
@ApiModelProperty
(
"样品登记时间"
)
private
LocalDateTime
registerTime
;
@ApiModelProperty
(
"处理提醒时间"
)
private
LocalDate
handleDate
;
@ApiModelProperty
(
"小样位置"
)
private
String
littlePosition
;
@ApiModelProperty
(
"原样位置"
)
private
String
originalPosition
;
@ApiModelProperty
(
"(0未领用,1已领用,2已销毁)"
)
private
Integer
status
;
@ApiModelProperty
(
"销毁时间"
)
private
LocalDateTime
destructionTime
;
@ApiModelProperty
(
"项目id"
)
private
Integer
projectId
;
@ApiModelProperty
(
"项目名称"
)
private
String
projectName
;
@ApiModelProperty
(
"项目编号"
)
private
String
projectCode
;
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/ISampleService.java
View file @
96c8aad6
package
cn
.
wise
.
sc
.
cement
.
business
.
service
;
package
cn
.
wise
.
sc
.
cement
.
business
.
service
;
import
cn.wise.sc.cement.business.entity.Sample
;
import
cn.wise.sc.cement.business.entity.Sample
;
import
cn.wise.sc.cement.business.model.BaseResponse
;
import
cn.wise.sc.cement.business.model.PageQuery
;
import
cn.wise.sc.cement.business.model.query.SampleManageQuery
;
import
cn.wise.sc.cement.business.model.vo.SampleVo
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
/**
...
@@ -13,4 +18,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
...
@@ -13,4 +18,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
*/
public
interface
ISampleService
extends
IService
<
Sample
>
{
public
interface
ISampleService
extends
IService
<
Sample
>
{
BaseResponse
<
IPage
<
SampleVo
>>
getPage
(
PageQuery
pageQuery
,
String
sampleName
,
String
cementCode
);
BaseResponse
<
SampleVo
>
getDetail
(
Integer
id
);
BaseResponse
<
String
>
register
(
SampleManageQuery
query
);
BaseResponse
<
String
>
destruction
(
Integer
id
);
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EntrustServiceImpl.java
View file @
96c8aad6
...
@@ -261,13 +261,14 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
...
@@ -261,13 +261,14 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if
(
query
.
getId
()
==
null
||
query
.
getIsAgree
()
==
null
){
if
(
query
.
getId
()
==
null
||
query
.
getIsAgree
()
==
null
){
return
BaseResponse
.
errorMsg
(
"参数错误"
);
return
BaseResponse
.
errorMsg
(
"参数错误"
);
}
}
Entrust
entrust
=
entrustMapper
.
selectById
(
query
.
getId
());
Entrust
Vo
entrustVo
=
entrustMapper
.
getDetail
(
query
.
getId
());
if
(
entrust
==
null
){
if
(
entrust
Vo
==
null
){
return
BaseResponse
.
errorMsg
(
"信息错误"
);
return
BaseResponse
.
errorMsg
(
"信息错误"
);
}
}
if
(
entrust
.
getStatus
()
!=
0
){
if
(
entrust
Vo
.
getStatus
()
!=
0
){
return
BaseResponse
.
errorMsg
(
"当前状态不允许评审"
);
return
BaseResponse
.
errorMsg
(
"当前状态不允许评审"
);
}
}
Entrust
entrust
=
entrustMapper
.
selectById
(
entrustVo
.
getId
());
if
(
query
.
getIsAgree
()
==
1
){
//通过
if
(
query
.
getIsAgree
()
==
1
){
//通过
if
(
StringUtils
.
isEmpty
(
query
.
getProjectType
())){
if
(
StringUtils
.
isEmpty
(
query
.
getProjectType
())){
...
@@ -280,11 +281,12 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
...
@@ -280,11 +281,12 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
for
(
SampleQuery
sampleQuery
:
query
.
getSampleList
()){
for
(
SampleQuery
sampleQuery
:
query
.
getSampleList
()){
Sample
sample
=
new
Sample
();
Sample
sample
=
new
Sample
();
BeanUtils
.
copyProperties
(
sampleQuery
,
sample
);
BeanUtils
.
copyProperties
(
sampleQuery
,
sample
);
sample
.
setId
(
null
).
setSampleId
(
sampleQuery
.
getId
()).
setCreateTime
(
LocalDateTime
.
now
());
sample
.
setId
(
null
)
.
setSampleId
(
sampleQuery
.
getId
())
.
setStatus
(
0
)
//样品状态为未领用状态
.
setCreateTime
(
LocalDateTime
.
now
());
if
(
sampleQuery
.
getIsParallel
()
==
1
){
//平行样
if
(
sampleQuery
.
getIsParallel
()
==
1
){
//平行样
//生成本所编号
//生成本所编号
String
cementCode
=
commonService
.
createNo
(
"BS"
,
nums
);
String
cementCode
=
commonService
.
createNo
(
"BS"
,
nums
);
String
cementCode2
=
commonService
.
createNo
(
"BS"
,
nums
+
1
);
String
cementCode2
=
commonService
.
createNo
(
"BS"
,
nums
+
1
);
sample
.
setCementCode
(
cementCode
);
sample
.
setCementCode
(
cementCode
);
...
@@ -481,8 +483,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
...
@@ -481,8 +483,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
entrust
.
setRemark
(
query
.
getRemark
());
entrust
.
setRemark
(
query
.
getRemark
());
if
(
query
.
getSampleDistributionQueryList
()
!=
null
&&
query
.
getSampleDistributionQueryList
().
size
()>
0
){
if
(
query
.
getSampleDistributionQueryList
()
!=
null
&&
query
.
getSampleDistributionQueryList
().
size
()>
0
){
List
<
SampleDistributionQuery
>
sampleDistributionQueryList
=
query
.
getSampleDistributionQueryList
();
List
<
SampleDistributionQuery
>
sampleDistributionQueryList
=
query
.
getSampleDistributionQueryList
();
List
<
SampleDistribution
>
sampleDistributionList
=
new
ArrayList
<>();
List
<
SampleDistribution
>
sampleDistributionList
=
new
ArrayList
<>();
List
<
Sample
>
sampleList
=
new
ArrayList
<>();
for
(
SampleDistributionQuery
distributionQuery
:
sampleDistributionQueryList
){
for
(
SampleDistributionQuery
distributionQuery
:
sampleDistributionQueryList
){
if
(
distributionQuery
==
null
||
distributionQuery
.
getSampleId
()
==
null
){
if
(
distributionQuery
==
null
||
distributionQuery
.
getSampleId
()
==
null
){
return
BaseResponse
.
errorMsg
(
"样品信息错误"
);
return
BaseResponse
.
errorMsg
(
"样品信息错误"
);
...
@@ -505,8 +507,15 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
...
@@ -505,8 +507,15 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
sampleDistributionList
.
add
(
sampleDistribution
);
sampleDistributionList
.
add
(
sampleDistribution
);
}
}
}
}
Sample
sample
=
sampleService
.
getById
(
distributionQuery
.
getSampleId
());
if
(
sample
==
null
){
return
BaseResponse
.
errorMsg
(
"样品信息错误"
);
}
sample
.
setStatus
(
1
);
//样品状态改成已领用状态
sampleList
.
add
(
sample
);
}
}
distributionService
.
saveBatch
(
sampleDistributionList
);
distributionService
.
saveBatch
(
sampleDistributionList
);
sampleService
.
updateBatchById
(
sampleList
);
}
}
entrust
.
setIsDistribution
(
1
);
entrust
.
setIsDistribution
(
1
);
entrustMapper
.
updateById
(
entrust
);
entrustMapper
.
updateById
(
entrust
);
...
@@ -584,10 +593,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
...
@@ -584,10 +593,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
if
(
distribution
==
null
){
if
(
distribution
==
null
){
return
BaseResponse
.
errorMsg
(
"信息错误"
);
return
BaseResponse
.
errorMsg
(
"信息错误"
);
}
}
if
(
distribution
.
getStatus
()
!=
0
){
if
(
distribution
.
getStatus
()
!=
1
){
return
BaseResponse
.
errorMsg
(
"状态错误"
);
return
BaseResponse
.
errorMsg
(
"状态错误"
);
}
}
distribution
.
setStatus
(
1
).
setAccept
Time
(
LocalDateTime
.
now
());
distribution
.
setStatus
(
2
).
setFinish
Time
(
LocalDateTime
.
now
());
distributionMapper
.
updateById
(
distribution
);
distributionMapper
.
updateById
(
distribution
);
Sample
sample
=
sampleService
.
getById
(
distribution
.
getSampleId
());
Sample
sample
=
sampleService
.
getById
(
distribution
.
getSampleId
());
if
(
sample
==
null
){
if
(
sample
==
null
){
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/SampleServiceImpl.java
View file @
96c8aad6
...
@@ -2,9 +2,23 @@ package cn.wise.sc.cement.business.service.impl;
...
@@ -2,9 +2,23 @@ package cn.wise.sc.cement.business.service.impl;
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.PageQuery
;
import
cn.wise.sc.cement.business.model.query.SampleManageQuery
;
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
;
import
cn.wise.sc.cement.business.service.ISysUserService
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
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.Transactional
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
/**
* <p>
* <p>
...
@@ -17,4 +31,91 @@ import org.springframework.stereotype.Service;
...
@@ -17,4 +31,91 @@ import org.springframework.stereotype.Service;
@Service
@Service
public
class
SampleServiceImpl
extends
ServiceImpl
<
SampleMapper
,
Sample
>
implements
ISampleService
{
public
class
SampleServiceImpl
extends
ServiceImpl
<
SampleMapper
,
Sample
>
implements
ISampleService
{
@Resource
private
SampleMapper
sampleMapper
;
@Autowired
private
ISysUserService
userService
;
/**
* 分页列表
* @param pageQuery
* @param sampleName
* @param cementCode
* @return
*/
@Override
public
BaseResponse
<
IPage
<
SampleVo
>>
getPage
(
PageQuery
pageQuery
,
String
sampleName
,
String
cementCode
){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"sampleName"
,
sampleName
);
params
.
put
(
"cementCode"
,
cementCode
);
Page
<
SampleVo
>
page
=
new
Page
<>(
pageQuery
.
getPageNo
(),
pageQuery
.
getPageSize
());
IPage
<
SampleVo
>
pages
=
sampleMapper
.
getPage
(
page
,
params
);
return
BaseResponse
.
okData
(
pages
);
}
/**
* 样品管理详情
* @param id
* @return
*/
@Override
public
BaseResponse
<
SampleVo
>
getDetail
(
Integer
id
){
SampleVo
sampleVo
=
sampleMapper
.
getDetail
(
id
);
if
(
sampleVo
==
null
){
return
BaseResponse
.
errorMsg
(
"信息错误!"
);
}
return
BaseResponse
.
okData
(
sampleVo
);
}
/**
* 样品登记
* @param query
* @return
*/
@Transactional
@Override
public
BaseResponse
<
String
>
register
(
SampleManageQuery
query
)
{
if
(
query
.
getId
()
==
null
)
{
return
BaseResponse
.
errorMsg
(
"参数错误!"
);
}
Sample
sample
=
sampleMapper
.
selectById
(
query
.
getId
());
if
(
sample
==
null
){
return
BaseResponse
.
errorMsg
(
"信息错误"
);
}
sample
.
setOperatorId
(
userService
.
getLoginUser
().
getId
())
.
setRegisterTime
(
LocalDateTime
.
now
())
.
setHandleDate
(
query
.
getHandleDate
())
.
setLittlePosition
(
query
.
getLittlePosition
())
.
setOriginalPosition
(
query
.
getOriginalPosition
())
.
setRemark
(
query
.
getRemark
());
return
BaseResponse
.
okData
(
"样品登记成功"
);
}
/**
* 样品销毁
* @param id
* @return
*/
@Transactional
@Override
public
BaseResponse
<
String
>
destruction
(
Integer
id
)
{
if
(
id
==
null
)
{
return
BaseResponse
.
errorMsg
(
"参数错误!"
);
}
Sample
sample
=
sampleMapper
.
selectById
(
id
);
if
(
sample
==
null
){
return
BaseResponse
.
errorMsg
(
"信息错误"
);
}
sample
.
setStatus
(
2
)
.
setDestructionTime
(
LocalDateTime
.
now
());
sampleMapper
.
updateById
(
sample
);
return
BaseResponse
.
okData
(
"样品已销毁"
);
}
}
}
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