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
74475bca
Commit
74475bca
authored
Oct 12, 2020
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化校核接口 返回json串
parent
072f1fa2
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
189 additions
and
3 deletions
+189
-3
EquipmentController.java
...se/sc/cement/business/controller/EquipmentController.java
+18
-0
StandardController.java
...ise/sc/cement/business/controller/StandardController.java
+11
-0
EquipmentMapper.java
...va/cn/wise/sc/cement/business/mapper/EquipmentMapper.java
+2
-0
StandardMapper.java
...ava/cn/wise/sc/cement/business/mapper/StandardMapper.java
+4
-0
EquipmentMapper.xml
...cn/wise/sc/cement/business/mapper/xml/EquipmentMapper.xml
+16
-0
StandardMapper.xml
.../cn/wise/sc/cement/business/mapper/xml/StandardMapper.xml
+35
-0
IEquipmentService.java
...cn/wise/sc/cement/business/service/IEquipmentService.java
+2
-0
IStandardService.java
.../cn/wise/sc/cement/business/service/IStandardService.java
+3
-0
EntrustServiceImpl.java
...e/sc/cement/business/service/impl/EntrustServiceImpl.java
+3
-3
EquipmentServiceImpl.java
...sc/cement/business/service/impl/EquipmentServiceImpl.java
+45
-0
StandardServiceImpl.java
.../sc/cement/business/service/impl/StandardServiceImpl.java
+50
-0
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/controller/EquipmentController.java
View file @
74475bca
...
...
@@ -69,6 +69,24 @@ public class EquipmentController {
}
}
@ApiOperation
(
"设备检定列表导出"
)
@PostMapping
(
"/exportTest"
)
public
void
exportTest
(
String
brand
,
Integer
supplierId
,
String
name
,
String
fileName
,
HttpServletResponse
response
)
{
try
{
equipmentService
.
exportTest
(
brand
,
supplierId
,
name
,
fileName
,
response
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"设备检定列表导出{}"
,
e
);
}
}
@ApiOperation
(
value
=
"新增设备"
)
@PostMapping
(
"/create"
)
public
BaseResponse
create
(
@RequestBody
EquipmentQuery
query
)
{
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/controller/StandardController.java
View file @
74475bca
...
...
@@ -19,6 +19,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
...
...
@@ -56,6 +57,16 @@ public class StandardController {
}
@ApiOperation
(
"标样信息列表导出"
)
@PostMapping
(
"/export"
)
public
void
export
(
String
name
,
String
supplierName
,
String
fileName
,
HttpServletResponse
response
)
{
try
{
standardService
.
export
(
name
,
supplierName
,
fileName
,
response
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"标样信息列表导出{}"
,
e
);
}
}
@ApiOperation
(
value
=
"新增标样"
)
@PostMapping
(
"/create"
)
public
BaseResponse
create
(
@RequestBody
StandardQuery
query
)
{
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/EquipmentMapper.java
View file @
74475bca
...
...
@@ -25,5 +25,7 @@ public interface EquipmentMapper extends BaseMapper<Equipment> {
List
<
Map
<
String
,
Object
>>
exportList
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
List
<
Map
<
String
,
Object
>>
exportTestList
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
EquipmentVo
getDetail
(
Integer
id
);
}
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/StandardMapper.java
View file @
74475bca
...
...
@@ -3,8 +3,10 @@ package cn.wise.sc.cement.business.mapper;
import
cn.wise.sc.cement.business.entity.Standard
;
import
cn.wise.sc.cement.business.model.vo.StandardValueVo
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
...
...
@@ -17,4 +19,6 @@ import java.util.List;
public
interface
StandardMapper
extends
BaseMapper
<
Standard
>
{
List
<
StandardValueVo
>
getStandardDetaulList
();
List
<
Map
<
String
,
Object
>>
exportList
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
}
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/EquipmentMapper.xml
View file @
74475bca
...
...
@@ -40,6 +40,22 @@
<include
refid=
"where"
/>
</select>
<select
id=
"exportTestList"
resultType=
"java.util.HashMap"
>
SELECT
(@i:=@i+1) as 序号,
t.name as 设备名称,
t.code as 设备编号,
t.model as '规格/型号',
IF(ISNULL(t.test_cycle),'',t.test_cycle) as '检/校周期',
IF(ISNULL(t.test_date),'',t.test_date) as 检定日期,
IF(ISNULL(t.check_date),'',t.check_date) as 校检日期 ,
IF(ISNULL(t.period_date),'',t.period_date) as 期间核查日期,
IF(ISNULL(t.try_result),'',t.try_result) as 实施结果
FROM equipment t
,(select @i:=0)t
<include
refid=
"where"
/>
</select>
<select
id=
"getDetail"
resultType=
"cn.wise.sc.cement.business.model.vo.EquipmentVo"
>
SELECT t.*, s.name as supplierName
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/xml/StandardMapper.xml
View file @
74475bca
...
...
@@ -9,4 +9,39 @@
(SELECT id FROM standard) s
ON sv.standard_id = s.id
</select>
<sql
id=
"where"
>
<where>
<if
test=
"params.supplierName != null and params.supplierName != ''"
>
and t.supplier_name = #{params.supplierName}
</if>
<if
test=
"params.name != null and params.name != ''"
>
and t.name like concat('%', #{params.name}, '%')
</if>
</where>
</sql>
<select
id=
"exportList"
resultType=
"java.util.HashMap"
>
SELECT
(@i:=@i+1) as 序号,
t.name as 标样名称,
t.code as 标物代号,
t.supplier_name as 经销单位,
t.position as 存放位置,
t.purchase_date as 进样日期,
t.valid_date as 有效日期,
t.stock_num as 剩余库存,
(
CASE t.status
WHEN 0 THEN '已作废'
WHEN 1 THEN '启用中'
ELSE NULL
END
) as 状态
FROM standard t ,(select @i:=0)t
<include
refid=
"where"
/>
ORDER BY t.id DESC
</select>
</mapper>
cement-business/src/main/java/cn/wise/sc/cement/business/service/IEquipmentService.java
View file @
74475bca
...
...
@@ -24,6 +24,8 @@ public interface IEquipmentService extends IService<Equipment> {
void
export
(
String
brand
,
Integer
supplierId
,
String
name
,
String
fileName
,
HttpServletResponse
response
);
void
exportTest
(
String
brand
,
Integer
supplierId
,
String
name
,
String
fileName
,
HttpServletResponse
response
);
BaseResponse
<
Equipment
>
create
(
EquipmentQuery
query
);
BaseResponse
<
Equipment
>
update
(
EquipmentQuery
query
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/IStandardService.java
View file @
74475bca
...
...
@@ -11,6 +11,7 @@ import cn.wise.sc.cement.business.model.vo.StandardVo;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
...
...
@@ -25,6 +26,8 @@ public interface IStandardService extends IService<Standard> {
BaseResponse
<
IPage
<
Standard
>>
getPage
(
PageQuery
pageQuery
,
String
name
,
String
supplierName
);
void
export
(
String
name
,
String
supplierName
,
String
fileName
,
HttpServletResponse
response
);
BaseResponse
<
Standard
>
create
(
StandardQuery
query
);
BaseResponse
<
Standard
>
update
(
StandardQuery
query
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EntrustServiceImpl.java
View file @
74475bca
...
...
@@ -1782,7 +1782,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
.
setCementCode
(
sctQuery
.
getCementCode
())
.
setTeamGroupId
(
sctQuery
.
getTeamGroupId
())
.
setTeamGroupName
(
sctQuery
.
getTeamGroupName
())
.
setCountResult
(
sctQuery
.
getEndResult
().
toString
(
))
.
setCountResult
(
JSON
.
toJSONString
(
sctQuery
.
getEndResult
()
))
.
setIsParallel
(
sctQuery
.
getIsParallel
())
.
setCreateTime
(
LocalDateTime
.
now
());
sampleCheckMapper
.
insert
(
check
);
...
...
@@ -1796,7 +1796,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
.
setUserId
(
sctQuery
.
getMainUserId
())
.
setEquipmentId
(
sctQuery
.
getMainEquipmentId
())
.
setEquipmentName
(
sctQuery
.
getMainEquipmentName
())
.
setInputResult
(
sctQuery
.
getMainResult
().
toString
(
))
.
setInputResult
(
JSON
.
toJSONString
(
sctQuery
.
getMainResult
()
))
.
setCreateTime
(
LocalDateTime
.
now
());
sampleCheckTeamMapper
.
insert
(
sampleCheckTeam
);
//添加设备使用记录 设备使用记录表 equipment_use
...
...
@@ -1821,7 +1821,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
.
setUserId
(
sctQuery
.
getSecondaryUserId
())
.
setEquipmentId
(
sctQuery
.
getSecondaryEquipmentId
())
.
setEquipmentName
(
sctQuery
.
getSecondaryEquipmentName
())
.
setInputResult
(
sctQuery
.
getSecondaryResult
().
toString
(
))
.
setInputResult
(
JSON
.
toJSONString
(
sctQuery
.
getSecondaryResult
()
))
.
setCreateTime
(
sampleCheckTeam
.
getCreateTime
());
sampleCheckTeamMapper
.
insert
(
sampleCheckTeam2
);
//添加设备使用记录 设备使用记录表 equipment_use
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/EquipmentServiceImpl.java
View file @
74475bca
...
...
@@ -116,6 +116,51 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
}
}
/**
* 设备检定列表导出
* @param brand
* @param supplierId
* @param name
* @param fileName
* @param response
*/
@Override
public
void
exportTest
(
String
brand
,
Integer
supplierId
,
String
name
,
String
fileName
,
HttpServletResponse
response
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"brand"
,
brand
);
params
.
put
(
"supplierId"
,
supplierId
);
List
<
Map
<
String
,
Object
>>
list
=
equipmentMapper
.
exportTestList
(
params
);
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
]
=
"实施结果"
;
List
<
Object
[]>
datas
=
new
ArrayList
<>(
list
.
size
());
for
(
Map
<
String
,
Object
>
m
:
list
)
{
Object
[]
objects
=
new
Object
[
headers
.
length
];
for
(
int
j
=
0
;
j
<
headers
.
length
;
j
++)
{
String
obj
=
m
.
get
(
headers
[
j
]).
toString
();
if
(
j
==
0
){
obj
=
obj
.
split
(
"\\."
)[
0
];
}
objects
[
j
]
=
obj
;
}
datas
.
add
(
objects
);
}
ExcelUtil
.
excelExport
(
fileName
==
null
||
fileName
.
trim
().
length
()
<=
0
?
"设备检定列表"
:
fileName
,
headers
,
datas
,
response
);
}
}
/**
* 新增设备
* @param query
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/StandardServiceImpl.java
View file @
74475bca
...
...
@@ -14,10 +14,12 @@ import cn.wise.sc.cement.business.service.IStandardEnterService;
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.util.ExcelUtil
;
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.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -27,9 +29,12 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
...
...
@@ -78,6 +83,51 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
return
BaseResponse
.
okData
(
page
);
}
/**
* 标样信息列表导出
* @param name
* @param supplierName
* @param fileName
* @param response
*/
@Override
public
void
export
(
String
name
,
String
supplierName
,
String
fileName
,
HttpServletResponse
response
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"supplierName"
,
supplierName
);
params
.
put
(
"name"
,
name
);
List
<
Map
<
String
,
Object
>>
list
=
standardMapper
.
exportList
(
params
);
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
]
=
"状态"
;
List
<
Object
[]>
datas
=
new
ArrayList
<>(
list
.
size
());
for
(
Map
<
String
,
Object
>
m
:
list
)
{
Object
[]
objects
=
new
Object
[
headers
.
length
];
for
(
int
j
=
0
;
j
<
headers
.
length
;
j
++)
{
String
obj
=
m
.
get
(
headers
[
j
]).
toString
();
if
(
j
==
0
){
obj
=
obj
.
split
(
"\\."
)[
0
];
}
objects
[
j
]
=
obj
;
}
datas
.
add
(
objects
);
}
ExcelUtil
.
excelExport
(
fileName
==
null
||
fileName
.
trim
().
length
()
<=
0
?
"标样信息"
:
fileName
,
headers
,
datas
,
response
);
}
}
/**
* 新增标样
...
...
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