Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
46ff2465
Commit
46ff2465
authored
May 22, 2024
by
张森
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
备品备件问题需求开发
parent
0c82698a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
570 additions
and
1 deletion
+570
-1
Equipment.java
...java/com/yeejoin/equipmanage/common/entity/Equipment.java
+9
-0
EquipmentCategory.java
.../yeejoin/equipmanage/common/entity/EquipmentCategory.java
+25
-0
WlSpareEquipment.java
...m/yeejoin/equipmanage/common/entity/WlSpareEquipment.java
+132
-0
WlSpareEquipmentExportVo.java
...quipmanage/common/entity/vo/WlSpareEquipmentExportVo.java
+66
-0
BillContentEnum.java
...com/yeejoin/equipmanage/common/enums/BillContentEnum.java
+2
-1
SingleEnum.java
...java/com/yeejoin/equipmanage/common/enums/SingleEnum.java
+22
-0
EquipmentDate.java
...java/com/yeejoin/equipmanage/common/vo/EquipmentDate.java
+11
-0
EquipmentController.java
...m/yeejoin/equipmanage/controller/EquipmentController.java
+12
-0
EquipmentDetailController.java
...oin/equipmanage/controller/EquipmentDetailController.java
+8
-0
WlSpareEquipmentController.java
...in/equipmanage/controller/WlSpareEquipmentController.java
+175
-0
WlSpareEquipmentMapper.java
...om/yeejoin/equipmanage/mapper/WlSpareEquipmentMapper.java
+12
-0
IEquipmentService.java
...va/com/yeejoin/equipmanage/service/IEquipmentService.java
+3
-0
WlSpareEquipmentService.java
.../yeejoin/equipmanage/service/WlSpareEquipmentService.java
+32
-0
EquipmentServiceImpl.java
...eejoin/equipmanage/service/impl/EquipmentServiceImpl.java
+37
-0
WlSpareEquipmentServiceImpl.java
...equipmanage/service/impl/WlSpareEquipmentServiceImpl.java
+0
-0
WlSpareEquipmentMapper.xml
...quip/src/main/resources/mapper/WlSpareEquipmentMapper.xml
+24
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/Equipment.java
View file @
46ff2465
...
...
@@ -110,4 +110,13 @@ public class Equipment extends BaseEntity {
*/
@TableField
(
value
=
"clean_type"
)
private
String
cleanType
=
"0"
;
@TableField
(
exist
=
false
)
private
Long
equipCategoryId
;
// 装备分类id
@TableField
(
exist
=
false
)
private
String
equipCategoryName
;
// 装备分类名称
@TableField
(
exist
=
false
)
private
String
equipCategoryCode
;
// 装备分类编码
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/EquipmentCategory.java
View file @
46ff2465
...
...
@@ -100,4 +100,29 @@ public class EquipmentCategory extends BaseEntity implements TreeNode<EquipmentC
public
int
compareTo
(
EquipmentCategory
o
)
{
return
getId
().
compareTo
(
o
.
getId
());
}
public
void
addCountToParent
()
{
if
(
parentId
!=
0
)
{
EquipmentCategory
parent
=
findParent
(
this
);
if
(
parent
!=
null
)
{
parent
.
setCount
(
parent
.
getCount
()
+
this
.
getCount
());
parent
.
addCountToParent
();
}
}
}
private
EquipmentCategory
findParent
(
EquipmentCategory
node
)
{
for
(
EquipmentCategory
child
:
children
)
{
if
(
child
.
getId
().
equals
(
node
.
getParentId
()))
{
return
child
;
}
else
{
EquipmentCategory
parent
=
findParent
(
child
);
if
(
parent
!=
null
)
{
return
parent
;
}
}
}
return
null
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/WlSpareEquipment.java
0 → 100644
View file @
46ff2465
package
com
.
yeejoin
.
equipmanage
.
common
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.yeejoin.equipmanage.common.entity.publics.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"wl_spare_equipment"
)
@ApiModel
(
value
=
"WlSpareEquipment对象"
,
description
=
"设备平台备品备件管理"
)
public
class
WlSpareEquipment
extends
BaseEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@TableField
(
"name"
)
private
String
name
;
// 装备名称
@TableField
(
"equip_model_id"
)
private
Long
equipModelId
;
// 装备定义id
@TableField
(
"equip_model_name"
)
private
String
equipModelName
;
// 装备定义名称
@TableField
(
"equip_model_code"
)
private
String
equipModelCode
;
// 装备定义编码
@TableField
(
"equip_category_id"
)
private
Long
equipCategoryId
;
// 装备分类id
@TableField
(
"equip_category_name"
)
private
String
equipCategoryName
;
// 装备分类名称
@TableField
(
"equip_category_code"
)
private
String
equipCategoryCode
;
// 装备分类编码
@TableField
(
"stock_num"
)
private
Float
stockNum
;
// 库存数量
@TableField
(
"manufacturer"
)
private
String
manufacturer
;
// 生产厂家
@TableField
(
"manufacturer_id"
)
private
Long
manufacturerId
;
// 生产厂家id
@TableField
(
"standard"
)
private
String
standard
;
// 规格
@TableField
(
"brand"
)
private
String
brand
;
// 品牌
@TableField
(
"production_date"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
productionDate
;
// 生产日期
@TableField
(
"purchase_date"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
purchaseDate
;
// 采购日期
@TableField
(
"warehouse_structure_id"
)
private
Long
warehouseStructureId
;
// 存储位置id
@TableField
(
"warehouse_structure_code"
)
private
String
warehouseStructureCode
;
// 存储位置code
@TableField
(
"warehouse_structure"
)
private
String
warehouseStructure
;
// 存储位置
@TableField
(
"position"
)
private
String
position
;
// 存储位置详情描述
@TableField
(
"unit"
)
private
String
unit
;
// 计量单位
@TableField
(
"unit_id"
)
private
Long
unitId
;
// 计量单位id
@TableField
(
"remark"
)
private
String
remark
;
// 备注
@TableField
(
"biz_org_name"
)
private
String
bizOrgName
;
// 机构名称
@TableField
(
"biz_org_code"
)
private
String
bizOrgCode
;
// 机构编码
@TableField
(
"single"
)
private
Integer
single
;
// 管理方式(默认单件)
@TableField
(
"is_delete"
)
private
Boolean
isDelete
=
false
;
// 是否删除 0-否 1-是
@TableField
(
exist
=
false
)
private
List
<
UploadFile
>
img
;
@TableField
(
exist
=
false
)
private
List
<
UploadFile
>
video
;
@TableField
(
exist
=
false
)
private
List
<
UploadFile
>
certification
;
@TableField
(
exist
=
false
)
private
List
<
UploadFile
>
instruction
;
@TableField
(
exist
=
false
)
private
List
<
EquProperty
>
equPropertyList
;
@TableField
(
exist
=
false
)
private
List
<
UploadFile
>
quality
;
@TableField
(
exist
=
false
)
private
List
<
UploadFile
>
operation
;
@TableField
(
exist
=
false
)
private
String
agencyId
;
@TableField
(
exist
=
false
)
private
Integer
pageNum
;
@TableField
(
exist
=
false
)
private
Integer
pageSize
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/vo/WlSpareEquipmentExportVo.java
0 → 100644
View file @
46ff2465
package
com
.
yeejoin
.
equipmanage
.
common
.
entity
.
vo
;
import
cn.afterturn.easypoi.excel.annotation.Excel
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
WlSpareEquipmentExportVo
{
@Excel
(
name
=
"装备名称"
)
@ExcelProperty
(
value
=
"装备名称"
,
index
=
0
)
private
String
name
;
// 装备名称
@Excel
(
name
=
"装备编码(从装备定义中获取)"
)
@ExcelProperty
(
value
=
"装备编码(从装备定义中获取)"
,
index
=
1
)
private
String
equipModelCode
;
@Excel
(
name
=
"管理方式(单项管理/批量管理)"
)
@ExcelProperty
(
value
=
"管理方式(单项管理/批量管理)"
,
index
=
2
)
private
String
single
;
@Excel
(
name
=
"数量"
)
@ExcelProperty
(
value
=
"数量"
,
index
=
3
)
private
Float
stockNum
;
// 库存数量
@Excel
(
name
=
"计量单位"
)
@ExcelProperty
(
value
=
"计量单位"
,
index
=
4
)
private
String
unit
;
// 计量单位
@Excel
(
name
=
"规格型号"
)
@ExcelProperty
(
value
=
"规格型号"
,
index
=
5
)
private
String
standard
;
// 规格型号
@Excel
(
name
=
"品牌"
)
@ExcelProperty
(
value
=
"品牌"
,
index
=
6
)
private
String
brand
;
// 品牌
@Excel
(
name
=
"生产厂家名称"
)
@ExcelProperty
(
value
=
"生产厂家名称"
,
index
=
7
)
private
String
manufacturer
;
// 生产厂家
@Excel
(
name
=
"存放位置(建筑或房间编码)"
)
@ExcelProperty
(
value
=
"存放位置(建筑或房间编码)"
,
index
=
8
)
private
String
warehouseStructure
;
// 存储位置
@Excel
(
name
=
"位置信息"
)
@ExcelProperty
(
value
=
"位置信息"
,
index
=
9
)
private
String
position
;
// 存储位置详情描述
@Excel
(
name
=
"生产日期"
)
@ExcelProperty
(
value
=
"生产日期"
,
index
=
10
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
productionDate
;
// 生产日期
@Excel
(
name
=
"采购日期"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@ExcelProperty
(
value
=
"采购日期"
,
index
=
11
)
private
Date
purchaseDate
;
// 采购日期
@Excel
(
name
=
"备注"
)
@ExcelProperty
(
value
=
"备注"
,
index
=
12
)
private
String
remark
;
// 备注
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/BillContentEnum.java
View file @
46ff2465
...
...
@@ -4,7 +4,8 @@ public enum BillContentEnum {
ZB
(
"1"
,
"装备"
,
"equipment"
),
CL
(
"2"
,
"车辆"
,
"car"
),
MHYJ
(
"3"
,
"灭火药剂"
,
"extinguishing "
),
RY
(
"4"
,
"人员"
,
"people"
);
RY
(
"4"
,
"人员"
,
"people"
),
BPBJ
(
"1"
,
"备品备件"
,
"spareEquipment"
);
private
String
name
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/enums/SingleEnum.java
0 → 100644
View file @
46ff2465
package
com
.
yeejoin
.
equipmanage
.
common
.
enums
;
public
enum
SingleEnum
{
PLGL
(
"批量管理"
,
0
),
DXGL
(
"单项管理"
,
1
);
SingleEnum
(
String
name
,
Integer
key
)
{
this
.
name
=
name
;
this
.
key
=
key
;
}
private
String
name
;
private
Integer
key
;
public
String
getName
()
{
return
name
;
}
public
Integer
getKey
()
{
return
key
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/vo/EquipmentDate.java
View file @
46ff2465
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.common.vo;
import
com.yeejoin.equipmanage.common.entity.EquipmentDetail
;
import
com.yeejoin.equipmanage.common.entity.EquipmentSpecific
;
import
com.yeejoin.equipmanage.common.entity.WlSpareEquipment
;
/**
* 消防设备
...
...
@@ -13,6 +14,16 @@ public class EquipmentDate {
private
EquipmentDetail
equipmentDetail
;
private
WlSpareEquipment
spareEquipment
;
public
WlSpareEquipment
getSpareEquipment
()
{
return
spareEquipment
;
}
public
void
setSpareEquipment
(
WlSpareEquipment
spareEquipment
)
{
this
.
spareEquipment
=
spareEquipment
;
}
public
EquipmentSpecific
getEquipmentSpecific
()
{
return
equipmentSpecific
;
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EquipmentController.java
View file @
46ff2465
...
...
@@ -599,6 +599,18 @@ public class EquipmentController extends AbstractBaseController {
return
iEquipmentService
.
listByCategoryId
(
categoryId
);
}
/**
* 装备分类定义数据API【全量】
*
* @return
*/
@RequestMapping
(
value
=
"/equipList"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"装备分类定义数据API【全量】"
,
notes
=
"装备分类定义数据API【全量】"
)
public
List
<
Equipment
>
categoryList
()
{
return
iEquipmentService
.
categoryList
();
}
@RequestMapping
(
value
=
"/listLike/{code}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json;charset=UTF-8"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EquipmentDetailController.java
View file @
46ff2465
package
com
.
yeejoin
.
equipmanage
.
controller
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
...
...
@@ -127,6 +128,9 @@ public class EquipmentDetailController extends AbstractBaseController {
@Value
(
"${iot.code.prefix.have.used:20210003,20210004,20210005}"
)
private
String
haveUsedIotPrefix
;
@Autowired
private
WlSpareEquipmentService
wlSpareEquipmentService
;
/**
* 新增
*
...
...
@@ -190,6 +194,10 @@ public class EquipmentDetailController extends AbstractBaseController {
}
EquipmentDetailController
controllerProxy
=
SpringUtils
.
getBean
(
EquipmentDetailController
.
class
);
controllerProxy
.
refreshCount
(
vo
.
getBizOrgCode
());
WlSpareEquipment
spareEquipment
=
equipmentDate
.
getSpareEquipment
();
if
(
ObjectUtil
.
isNotEmpty
(
spareEquipment
)
&&
ObjectUtil
.
isNotEmpty
(
spareEquipment
.
getId
()))
{
wlSpareEquipmentService
.
subtractNum
(
spareEquipment
.
getId
(),
Float
.
valueOf
(
vo
.
getNum
()));
}
return
date
;
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/WlSpareEquipmentController.java
0 → 100644
View file @
46ff2465
package
com
.
yeejoin
.
equipmanage
.
controller
;
import
cn.afterturn.easypoi.excel.ExcelImportUtil
;
import
cn.afterturn.easypoi.excel.entity.ImportParams
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.excel.ExcelUtil
;
import
com.yeejoin.equipmanage.common.entity.WlSpareEquipment
;
import
com.yeejoin.equipmanage.common.entity.vo.WlSpareEquipmentExportVo
;
import
com.yeejoin.equipmanage.common.enums.SingleEnum
;
import
com.yeejoin.equipmanage.common.utils.CommonResponseUtil
;
import
com.yeejoin.equipmanage.mapper.WlSpareEquipmentMapper
;
import
com.yeejoin.equipmanage.service.WlSpareEquipmentService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.util.UriUtils
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.List
;
@RestController
@Api
(
tags
=
"设备平台备品备件管理api"
)
@RequestMapping
(
value
=
"/wl-spare-equipment"
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
class
WlSpareEquipmentController
extends
BaseController
{
@Autowired
WlSpareEquipmentService
wlSpareEquipmentService
;
@Autowired
WlSpareEquipmentMapper
wlSpareEquipmentMapper
;
@RequestMapping
(
value
=
"/saveOrUpdateSpareEquipment"
,
method
=
RequestMethod
.
POST
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增/编辑"
,
notes
=
"新增/编辑"
)
public
ResponseModel
<
WlSpareEquipment
>
saveOrUpdateSpareEquipment
(
@RequestBody
WlSpareEquipment
wlSpareEquipment
)
{
WlSpareEquipment
data
=
wlSpareEquipmentService
.
saveOrUpdateSpareEquipment
(
wlSpareEquipment
,
getSelectedOrgInfo
());
return
CommonResponseUtil
.
success
(
data
);
}
@RequestMapping
(
value
=
"/deleteByIds"
,
method
=
RequestMethod
.
DELETE
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"删除"
,
notes
=
"删除"
)
public
ResponseModel
deleteByIds
(
@RequestBody
List
<
Long
>
ids
)
{
wlSpareEquipmentService
.
deleteByIds
(
ids
);
return
CommonResponseUtil
.
success
();
}
@RequestMapping
(
value
=
"/getById"
,
method
=
RequestMethod
.
GET
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"详情"
,
notes
=
"详情"
)
public
ResponseModel
<
WlSpareEquipment
>
getById
(
@RequestParam
Long
id
)
{
ReginParams
selectedOrgInfo
=
getSelectedOrgInfo
();
WlSpareEquipment
wlSpareEquipment
=
wlSpareEquipmentService
.
getById
(
id
);
wlSpareEquipment
.
setAgencyId
(
selectedOrgInfo
.
getPersonIdentity
().
getCompanyId
());
return
CommonResponseUtil
.
success
(
wlSpareEquipment
);
}
@RequestMapping
(
value
=
"/listByPage"
,
method
=
RequestMethod
.
POST
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
public
ResponseModel
<
Page
<
WlSpareEquipment
>>
listByPage
(
@RequestBody
WlSpareEquipment
wlSpareEquipment
)
{
Page
<
WlSpareEquipment
>
wlSpareEquipmentPage
=
wlSpareEquipmentService
.
listByPage
(
wlSpareEquipment
,
new
Page
<>(
wlSpareEquipment
.
getPageNum
(),
wlSpareEquipment
.
getPageSize
()));
return
CommonResponseUtil
.
success
(
wlSpareEquipmentPage
);
}
/**
* 下载模板
*
* @return
* @Since 2021-3-10
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/downTemplate"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"下载模板"
,
notes
=
"下载模板"
)
public
void
downTemplate
(
HttpServletResponse
response
)
{
// 使用ClassPathResource加载模板文件
try
(
InputStream
inputStream
=
new
ClassPathResource
(
"template/消防装备备品备件导入模板.xlsx"
).
getInputStream
())
{
// 对文件名进行URL编码
String
encodedFilename
=
UriUtils
.
encode
(
"消防装备备品备件导入模板.xlsx"
,
StandardCharsets
.
UTF_8
);
// 设置响应的内容类型为Excel文件的MIME类型
response
.
setContentType
(
String
.
valueOf
(
MediaType
.
parseMediaType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
)));
// 设置Content-Disposition头信息,指定文件名
response
.
setHeader
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment; filename="
+
encodedFilename
);
// 将输入流的内容复制到响应的输出流
byte
[]
buffer
=
new
byte
[
1024
];
int
bytesRead
;
while
((
bytesRead
=
inputStream
.
read
(
buffer
))
!=
-
1
)
{
response
.
getOutputStream
().
write
(
buffer
,
0
,
bytesRead
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"数据导出"
,
notes
=
"数据导出"
)
@PostMapping
(
value
=
"/export"
)
public
void
export
(
HttpServletResponse
response
,
@RequestBody
WlSpareEquipment
dto
)
{
LambdaQueryWrapper
<
WlSpareEquipment
>
lambda
=
new
LambdaQueryWrapper
<>();
lambda
.
eq
(
WlSpareEquipment:
:
getIsDelete
,
false
);
lambda
.
ne
(
WlSpareEquipment:
:
getStockNum
,
0
);
List
<
WlSpareEquipment
>
wlSpareEquipments
=
wlSpareEquipmentMapper
.
selectList
(
lambda
);
List
<
WlSpareEquipmentExportVo
>
exportList
=
new
ArrayList
<>();
wlSpareEquipments
.
forEach
(
item
->
{
WlSpareEquipmentExportVo
exportVo
=
new
WlSpareEquipmentExportVo
();
BeanUtils
.
copyProperties
(
item
,
exportVo
,
"single"
);
exportVo
.
setSingle
(
SingleEnum
.
DXGL
.
getKey
().
equals
(
item
.
getSingle
())
?
"单项管理"
:
"批量管理"
);
exportList
.
add
(
exportVo
);
});
ExcelUtil
.
createTemplate
(
response
,
"消防装备备品备件"
,
"备品备件信息"
,
exportList
,
WlSpareEquipmentExportVo
.
class
,
null
,
false
);
}
/**
* 设备信息导入
*
* @return
*/
@PostMapping
(
value
=
"/uploadList"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"导入"
,
notes
=
"导入"
)
public
ResponseModel
uploadList
(
MultipartFile
file
)
{
try
{
// 设置导入参数
ImportParams
params
=
new
ImportParams
();
params
.
setTitleRows
(
0
);
// 标题行数
params
.
setHeadRows
(
1
);
// 表头行数
// 导入数据
List
<
WlSpareEquipmentExportVo
>
list
=
ExcelImportUtil
.
importExcel
(
file
.
getInputStream
(),
WlSpareEquipmentExportVo
.
class
,
params
);
// 处理导入的数据,例如保存到数据库中
wlSpareEquipmentService
.
saveImportBatch
(
list
,
getSelectedOrgInfo
());
// JSON.toJSONString(list)
return
CommonResponseUtil
.
success
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
CommonResponseUtil
.
failure
(
"导入失败"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
CommonResponseUtil
.
success
();
}
/**
* 获取装备类型和统计值
*
* @throws Exception
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"获取装备类型和统计值"
,
notes
=
"获取装备类型和统计值"
)
@GetMapping
(
value
=
"/getEquipmentTypeAndCount/tree"
)
public
ResponseModel
getEquipmentTypeAndCount
(
@RequestParam
(
required
=
false
)
String
bizOrgCode
)
throws
Exception
{
if
(
StrUtil
.
isEmpty
(
bizOrgCode
))
{
bizOrgCode
=
getSelectedOrgInfo
().
getPersonIdentity
().
getCompanyBizOrgCode
();
}
return
CommonResponseUtil
.
success
(
wlSpareEquipmentService
.
getEquipmentTypeAndCount
(
bizOrgCode
));
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/WlSpareEquipmentMapper.java
0 → 100644
View file @
46ff2465
package
com
.
yeejoin
.
equipmanage
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.equipmanage.common.entity.WlSpareEquipment
;
import
org.apache.ibatis.annotations.Param
;
public
interface
WlSpareEquipmentMapper
extends
BaseMapper
<
WlSpareEquipment
>
{
Page
<
WlSpareEquipment
>
listByPage
(
@Param
(
"page"
)
Page
page
,
@Param
(
"dto"
)
WlSpareEquipment
dto
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IEquipmentService.java
View file @
46ff2465
...
...
@@ -128,4 +128,7 @@ public interface IEquipmentService extends IService<Equipment> {
EquipmentVo
getEquipBySpecific
(
Long
equipmentSpecificId
);
List
<
Equipment
>
getAllByCode
(
String
id
);
List
<
Equipment
>
categoryList
();
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/WlSpareEquipmentService.java
0 → 100644
View file @
46ff2465
package
com
.
yeejoin
.
equipmanage
.
service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.equipmanage.common.entity.EquipmentCategory
;
import
com.yeejoin.equipmanage.common.entity.WlSpareEquipment
;
import
com.yeejoin.equipmanage.common.entity.vo.WlSpareEquipmentExportVo
;
import
com.yeejoin.equipmanage.common.vo.EquipmentDate
;
import
java.util.List
;
public
interface
WlSpareEquipmentService
{
/**
* 新增/编辑
*/
WlSpareEquipment
saveOrUpdateSpareEquipment
(
WlSpareEquipment
wlSpareEquipment
,
ReginParams
reginParams
);
/**
* 删除
*/
int
deleteByIds
(
List
<
Long
>
ids
);
WlSpareEquipment
getById
(
Long
id
);
Page
<
WlSpareEquipment
>
listByPage
(
WlSpareEquipment
dto
,
Page
page
);
void
saveImportBatch
(
List
<
WlSpareEquipmentExportVo
>
list
,
ReginParams
reginParams
);
void
subtractNum
(
Long
id
,
Float
num
);
List
<
EquipmentCategory
>
getEquipmentTypeAndCount
(
String
bizOrgCode
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentServiceImpl.java
View file @
46ff2465
package
com
.
yeejoin
.
equipmanage
.
service
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
...
...
@@ -18,6 +19,7 @@ import com.yeejoin.equipmanage.service.IEquipmentDetailService;
import
com.yeejoin.equipmanage.service.IEquipmentIndexService
;
import
com.yeejoin.equipmanage.service.IEquipmentService
;
import
com.yeejoin.equipmanage.service.IUnitService
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.RandomStringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -347,6 +349,41 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
}
@Override
public
List
<
Equipment
>
categoryList
()
{
List
<
Equipment
>
list
=
this
.
list
();
Map
<
String
,
List
<
EquipmentIndex
>>
equipmentIndexMap
=
iEquipmentIndexService
.
list
().
stream
()
.
collect
(
Collectors
.
groupingBy
(
EquipmentIndex:
:
getEquipmentId
));
Map
<
Long
,
Unit
>
unitMap
=
iUnitService
.
list
().
stream
().
collect
(
Collectors
.
toMap
(
Unit:
:
getId
,
t
->
t
));
Map
<
Long
,
EquipmentCategory
>
categoryMap
=
equipmentCategoryMapper
.
selectList
(
null
).
stream
().
collect
(
Collectors
.
toMap
(
EquipmentCategory:
:
getId
,
t
->
t
));
for
(
Equipment
equipment
:
list
)
{
List
<
EquipmentIndex
>
quotaList
=
equipmentIndexMap
.
get
(
equipment
.
getId
().
toString
());
List
<
EquProperty
>
properList
=
new
ArrayList
<
EquProperty
>();
if
(
CollUtil
.
isNotEmpty
(
quotaList
))
{
for
(
EquipmentIndex
equipmentIndex
:
quotaList
)
{
EquProperty
equProperty
=
new
EquProperty
();
equProperty
.
setEquipmentIndexId
(
equipmentIndex
.
getId
());
equProperty
.
setPerfQuotaName
(
equipmentIndex
.
getPerfQuotaName
());
equProperty
.
setEquipmentIndexName
(
equipmentIndex
.
getPerfQuotaName
());
equProperty
.
setGroupName
(
equipmentIndex
.
getGroupName
());
equProperty
.
setValue
(
equipmentIndex
.
getPerfValue
());
equProperty
.
setUnitName
(
equipmentIndex
.
getUnitName
());
equProperty
.
setEquipmentIndexKey
(
equipmentIndex
.
getPerfQuotaDefinitionId
());
properList
.
add
(
equProperty
);
}
}
EquipmentCategory
equipmentCategory
=
categoryMap
.
get
(
equipment
.
getCategoryId
());
if
(
ObjectUtils
.
isNotEmpty
(
equipmentCategory
))
{
equipment
.
setEquipCategoryId
(
equipmentCategory
.
getId
());
equipment
.
setEquipCategoryCode
(
equipmentCategory
.
getCode
());
equipment
.
setEquipCategoryName
(
equipmentCategory
.
getName
());
}
equipment
.
setEquPropertyList
(
properList
);
equipment
.
setUnit
(
unitMap
.
get
(
equipment
.
getUnitId
()));
}
return
list
;
}
@Override
public
EquipmentAppVO
getEquipmentAppMessage
(
String
qrCode
)
{
EquipmentAppVO
equipmentApp
=
new
EquipmentAppVO
();
//设备信息参数
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/WlSpareEquipmentServiceImpl.java
0 → 100644
View file @
46ff2465
This diff is collapsed.
Click to expand it.
amos-boot-system-equip/src/main/resources/mapper/WlSpareEquipmentMapper.xml
0 → 100644
View file @
46ff2465
<?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">
<mapper
namespace=
"com.yeejoin.equipmanage.mapper.WlSpareEquipmentMapper"
>
<select
id=
"listByPage"
resultType=
"com.yeejoin.equipmanage.common.entity.WlSpareEquipment"
>
SELECT
*
FROM wl_spare_equipment
<where>
is_delete = 0
AND stock_num > 0
<if
test=
"dto.bizOrgCode != null and dto.bizOrgCode != ''"
>
AND `biz_org_code` LIKE concat(#{dto.bizOrgCode}, '%')
</if>
<if
test=
"dto.name != null and dto.name != ''"
>
AND `name` LIKE CONCAT('%', #{dto.name}, '%')
</if>
<if
test=
"dto.position != null and dto.position != ''"
>
AND `position` LIKE concat(#{dto.position}, '%')
</if>
</where>
ORDER BY create_date DESC
</select>
</mapper>
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