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
a9eb8221
Commit
a9eb8221
authored
Oct 09, 2020
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
委托详情接口
parent
f040d952
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
238 additions
and
4 deletions
+238
-4
EntityEnclosureController.java
...cement/business/controller/EntityEnclosureController.java
+7
-0
EntrustController.java
...wise/sc/cement/business/controller/EntrustController.java
+31
-0
SampleMapper.java
.../java/cn/wise/sc/cement/business/mapper/SampleMapper.java
+3
-0
EntrustMapper.xml
...a/cn/wise/sc/cement/business/mapper/xml/EntrustMapper.xml
+1
-1
SampleMapper.xml
...va/cn/wise/sc/cement/business/mapper/xml/SampleMapper.xml
+3
-3
IEntrustService.java
...a/cn/wise/sc/cement/business/service/IEntrustService.java
+12
-0
EntrustServiceImpl.java
...e/sc/cement/business/service/impl/EntrustServiceImpl.java
+181
-0
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/controller/EntityEnclosureController.java
View file @
a9eb8221
...
...
@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
import
sun.misc.BASE64Encoder
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -158,6 +159,9 @@ public class EntityEnclosureController {
byte
[]
by
=
FastDFSUtils
.
fileDownload
(
fileUrl
);
out
.
write
(
by
);
out
.
close
();
// BASE64Encoder encoder = new BASE64Encoder();
// String data = encoder.encode(by);
// return BaseResponse.okMsg(data);
}
else
{
return
BaseResponse
.
errorMsg
(
"登录信息失效"
);
}
...
...
@@ -168,6 +172,9 @@ public class EntityEnclosureController {
return
BaseResponse
.
errorMsg
(
"失败"
);
}
@ApiOperation
(
value
=
"app扫描二维码下载"
)
@GetMapping
(
"/appDownload"
)
public
BaseResponse
appDownload
(
String
fileUrl
){
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/controller/EntrustController.java
View file @
a9eb8221
...
...
@@ -258,6 +258,37 @@ public class EntrustController {
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"详情-基本信息"
)
@GetMapping
(
"/getBaseDtail/{id}"
)
public
BaseResponse
getBaseDtail
(
@PathVariable
Integer
id
){
try
{
return
entrustService
.
getBaseDtail
(
id
);
}
catch
(
Exception
e
){
log
.
debug
(
"详情-基本信息{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"详情-样品处理信息"
)
@GetMapping
(
"/getSampleHandleDtail/{id}"
)
public
BaseResponse
getSampleHandleDtail
(
@PathVariable
Integer
id
){
try
{
return
entrustService
.
getSampleHandleDtail
(
id
);
}
catch
(
Exception
e
){
log
.
debug
(
"详情-样品处理信息{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"详情-检测任务信息"
)
@GetMapping
(
"/getSampleCheckDtail/{id}"
)
public
BaseResponse
getSampleCheckDtail
(
@PathVariable
Integer
id
){
try
{
return
entrustService
.
getSampleCheckDtail
(
id
);
}
catch
(
Exception
e
){
log
.
debug
(
"详情-检测任务信息{}"
,
e
);
}
return
BaseResponse
.
errorMsg
(
"失败!"
);
}
@ApiOperation
(
value
=
"接受检测项目任务"
)
@PostMapping
(
"/acceptDistribution"
)
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/SampleMapper.java
View file @
a9eb8221
...
...
@@ -52,4 +52,7 @@ public interface SampleMapper extends BaseMapper<Sample> {
@Select
(
"select * from sample where entrust_id = #{entrustId} and cement_code = #{cementCode}"
)
List
<
Sample
>
getByCementCode
(
@Param
(
"entrustId"
)
Integer
entrustId
,
@Param
(
"cementCode"
)
String
cementCode
);
@Select
(
"select * from sample where entrust_id = #{entrustId} order by id asc"
)
List
<
Sample
>
getSampleCheckList
(
Integer
entrustId
);
}
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/EntrustMapper.xml
View file @
a9eb8221
...
...
@@ -33,7 +33,7 @@
</sql>
<select
id=
"getPage"
resultType=
"cn.wise.sc.cement.business.model.vo.EntrustVo"
>
select e.*,
p.name as projectName,
c.name as clientName, su.name as userName,
select e.*, c.name as clientName, su.name as userName,
(
CASE e.status
WHEN 0 THEN '未评审'
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/SampleMapper.xml
View file @
a9eb8221
...
...
@@ -3,7 +3,7 @@
<mapper
namespace=
"cn.wise.sc.cement.business.mapper.SampleMapper"
>
<sql
id=
"where"
>
<where>
and
and
s.parallel_code = s.cement_code
<if
test=
"params.sampleName != null and params.sampleName != ''"
>
and s.name like concat('%', #{params.sampleName}, '%')
</if>
...
...
@@ -14,7 +14,7 @@
</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
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
...
...
@@ -24,7 +24,7 @@
<select
id=
"getDetail"
resultType=
"cn.wise.sc.cement.business.model.vo.SampleVo"
>
select s
m
.*,s.name as sampleName, s.cement_code as cementCode, s.weight as weight
select s.*,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
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/IEntrustService.java
View file @
a9eb8221
...
...
@@ -98,4 +98,16 @@ public interface IEntrustService extends IService<Entrust> {
void
export
(
String
startDate
,
String
endDate
,
Integer
status
,
Integer
clientId
,
String
projectName
,
String
projectCode
,
String
fileName
,
HttpServletResponse
response
);
BaseResponse
<
EntrustVo
>
getBaseDtail
(
Integer
id
);
BaseResponse
<
List
<
SampleHandleVo
>>
getSampleHandleDtail
(
Integer
id
);
BaseResponse
<
List
<
SampleVo
>>
getSampleCheckDtail
(
Integer
id
);
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EntrustServiceImpl.java
View file @
a9eb8221
...
...
@@ -358,6 +358,177 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return
BaseResponse
.
okData
(
entrustVo
);
}
/**
* 详情-基本信息
* @param id
* @return
*/
public
BaseResponse
<
EntrustVo
>
getBaseDtail
(
Integer
id
)
{
LoginUser
loginUser
=
userService
.
getLoginUser
();
if
(
loginUser
==
null
)
{
return
BaseResponse
.
errorMsg
(
"请登录账号"
);
}
Integer
approvalId
=
sysApprovalMapper
.
getApprovalId
(
"委托评审"
);
if
(
approvalId
==
null
)
{
return
BaseResponse
.
errorMsg
(
"委托评审信息错误"
);
}
if
(
loginUser
.
getId
()
!=
approvalId
)
{
return
BaseResponse
.
errorMsg
(
"权限不足"
);
}
if
(
id
==
null
)
{
return
BaseResponse
.
errorMsg
(
"参数错误"
);
}
EntrustVo
entrustVo
=
entrustMapper
.
getDetail
(
id
);
if
(
entrustVo
.
getStatus
()
!=
0
)
{
QueryWrapper
<
Sample
>
sampleWrapper
=
new
QueryWrapper
<>();
sampleWrapper
.
eq
(
"entrust_id"
,
entrustVo
.
getId
());
sampleWrapper
.
orderByAsc
(
"id"
);
List
<
Sample
>
sampleList
=
sampleService
.
list
(
sampleWrapper
);
List
<
SampleVo
>
sampleVoList
=
new
ArrayList
<>();
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
);
sampleVoList
.
add
(
sampleVo
);
}
}
entrustVo
.
setSampleList
(
sampleVoList
);
//样品列表(展示平行样样品)
}
return
BaseResponse
.
okData
(
entrustVo
);
}
/**
* 详情-样品处理信息
* @param id
* @return
*/
public
BaseResponse
<
List
<
SampleHandleVo
>>
getSampleHandleDtail
(
Integer
id
)
{
LoginUser
loginUser
=
userService
.
getLoginUser
();
if
(
loginUser
==
null
)
{
return
BaseResponse
.
errorMsg
(
"请登录账号"
);
}
Integer
approvalId
=
sysApprovalMapper
.
getApprovalId
(
"委托评审"
);
if
(
approvalId
==
null
)
{
return
BaseResponse
.
errorMsg
(
"委托评审信息错误"
);
}
if
(
loginUser
.
getId
()
!=
approvalId
)
{
return
BaseResponse
.
errorMsg
(
"权限不足"
);
}
if
(
id
==
null
)
{
return
BaseResponse
.
errorMsg
(
"参数错误"
);
}
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"id"
,
id
);
List
<
SampleHandleVo
>
sampleHandleList
=
sampleHandleMapper
.
getSampleHandleList
(
params
);
Integer
handleStatus
=
null
;
if
(
sampleHandleList
!=
null
&&
sampleHandleList
.
size
()
>
0
)
{
for
(
SampleHandleVo
shVo
:
sampleHandleList
)
{
if
(
handleStatus
!=
null
&&
handleStatus
!=
shVo
.
getStatus
())
{
return
BaseResponse
.
errorMsg
(
"接受或完成的状态信息错误"
);
}
handleStatus
=
shVo
.
getStatus
()
==
1
?
1
:
(
shVo
.
getStatus
()
==
2
?
2
:
0
);
String
contentName
=
""
;
if
(
shVo
.
getContent
()
!=
null
)
{
String
[]
handIdS
=
shVo
.
getContent
().
split
(
"、"
);
List
<
SampleHandleEnclosure
>
sampleHandleEnclosureList
=
new
ArrayList
<>();
for
(
String
handleId
:
handIdS
)
{
Handle
handle
=
handleMapper
.
selectById
(
Integer
.
valueOf
(
handleId
));
if
(
handle
==
null
)
{
return
BaseResponse
.
errorMsg
(
"选择的处理项信息有误"
);
}
contentName
=
contentName
.
equals
(
""
)
?
handle
.
getName
()
:
contentName
+
"、"
+
handle
.
getName
();
}
}
shVo
.
setContentName
(
contentName
);
}
}
return
BaseResponse
.
okData
(
sampleHandleList
);
}
/**
* 详情-检测任务信息
* @param id
* @return
*/
public
BaseResponse
<
List
<
SampleVo
>>
getSampleCheckDtail
(
Integer
id
)
{
LoginUser
loginUser
=
userService
.
getLoginUser
();
if
(
loginUser
==
null
)
{
return
BaseResponse
.
errorMsg
(
"请登录账号"
);
}
Integer
approvalId
=
sysApprovalMapper
.
getApprovalId
(
"委托评审"
);
if
(
approvalId
==
null
)
{
return
BaseResponse
.
errorMsg
(
"委托评审信息错误"
);
}
if
(
loginUser
.
getId
()
!=
approvalId
)
{
return
BaseResponse
.
errorMsg
(
"权限不足"
);
}
if
(
id
==
null
)
{
return
BaseResponse
.
errorMsg
(
"参数错误"
);
}
Entrust
entrust
=
entrustMapper
.
selectById
(
id
);
if
(
entrust
==
null
)
{
return
BaseResponse
.
errorMsg
(
"信息错误"
);
}
List
<
Sample
>
sampleList
=
sampleMapper
.
getSampleCheckList
(
id
);
List
<
SampleVo
>
sampleVoList
=
new
ArrayList
<>();
if
(
sampleList
!=
null
&&
sampleList
.
size
()
>
0
)
{
for
(
Sample
sample
:
sampleList
)
{
SampleVo
sampleVo
=
new
SampleVo
();
BeanUtils
.
copyProperties
(
sample
,
sampleVo
);
//判断是否为平行样
List
<
SampleDistributionTeamVo
>
sampleDistributionTeamVoList
=
null
;
if
(
sample
.
getIsParallel
()
==
0
)
{
//检测人员只能看到自己则的检测内容
sampleDistributionTeamVoList
=
distributionMapper
.
getDistributionTeamList
(
sample
.
getId
(),
null
,
null
);
}
else
if
(
sample
.
getIsParallel
()
==
1
)
{
List
<
Sample
>
sampleList1
=
sampleMapper
.
getByCementCode
(
entrust
.
getId
(),
sample
.
getCementCode
());
//检测人员只能看到自己则的检测内容
if
(
sampleList1
.
size
()
==
2
)
{
sampleDistributionTeamVoList
=
distributionMapper
.
getDistributionTeamList
(
sampleList1
.
get
(
0
).
getId
(),
sampleList1
.
get
(
1
).
getId
(),
null
);
}
else
{
sampleDistributionTeamVoList
=
distributionMapper
.
getDistributionTeamList
(
sample
.
getId
(),
null
,
null
);
}
}
if
(
sampleDistributionTeamVoList
!=
null
&&
sampleDistributionTeamVoList
.
size
()
>
0
)
{
sampleVo
.
setSampleDistributionTeamVoList
(
sampleDistributionTeamVoList
);
}
sampleVoList
.
add
(
sampleVo
);
}
}
return
BaseResponse
.
okData
(
sampleVoList
);
}
/**
* 获取样品表里最大的平行样编号
*
...
...
@@ -408,6 +579,16 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return
BaseResponse
.
errorMsg
(
"当前状态不允许评审"
);
}
Entrust
entrust
=
entrustMapper
.
selectById
(
entrustVo
.
getId
());
//如果项目id或者项目编号为空,根据项目名称获取项目信息
if
(
StringUtils
.
isEmpty
(
entrust
.
getProjectCode
())){
ProjectVo
projectVo
=
projectMapper
.
getByName
(
entrust
.
getProjectName
());
if
(
projectVo
==
null
){
return
BaseResponse
.
errorMsg
(
"请添加项目信息"
);
}
entrust
.
setProjectId
(
projectVo
.
getId
())
.
setProjectCode
(
projectVo
.
getCode
())
.
setProjectName
(
projectVo
.
getName
());
}
if
(
query
.
getIsAgree
()
==
1
)
{
//通过
if
(
StringUtils
.
isEmpty
(
query
.
getProjectType
()))
{
return
BaseResponse
.
errorMsg
(
"请选择项目类型"
);
...
...
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