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
88c3a58b
Commit
88c3a58b
authored
Dec 17, 2021
by
kongfm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备接口调整 新增告知书-设备相关接口
parent
f45bde86
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
280 additions
and
76 deletions
+280
-76
InformEquipmentDto.java
.../amos/boot/module/tzs/flc/api/dto/InformEquipmentDto.java
+18
-0
InformEquipment.java
.../amos/boot/module/tzs/flc/api/entity/InformEquipment.java
+5
-0
IEquipmentInformService.java
...t/module/tzs/flc/api/service/IEquipmentInformService.java
+1
-0
IInformEquipmentService.java
...t/module/tzs/flc/api/service/IInformEquipmentService.java
+11
-0
EquipmentController.java
...ot/module/tzs/flc/biz/controller/EquipmentController.java
+2
-2
EquipmentInformController.java
...ule/tzs/flc/biz/controller/EquipmentInformController.java
+8
-1
InformEquipmentController.java
...ule/tzs/flc/biz/controller/InformEquipmentController.java
+78
-73
EquipmentInformServiceImpl.java
.../tzs/flc/biz/service/impl/EquipmentInformServiceImpl.java
+16
-0
InformEquipmentServiceImpl.java
.../tzs/flc/biz/service/impl/InformEquipmentServiceImpl.java
+141
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/dto/InformEquipmentDto.java
View file @
88c3a58b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
dto
;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* 告知申请-设备信息表
...
...
@@ -90,4 +95,17 @@ public class InformEquipmentDto extends BaseDto {
@ApiModelProperty
(
value
=
"告知单id"
)
private
Long
informId
;
@ApiModelProperty
(
value
=
"原设备id"
)
private
Long
sourceEquipmentId
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"附件"
)
@TableField
(
exist
=
false
)
private
Map
<
String
,
List
<
AttachmentDto
>>
attachments
;
@ApiModelProperty
(
value
=
"设备参数"
)
private
List
<
EquipmentIndexDto
>
equipmentIndex
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/entity/InformEquipment.java
View file @
88c3a58b
...
...
@@ -160,4 +160,9 @@ public class InformEquipment extends BaseEntity {
@TableField
(
"inform_id"
)
private
Long
informId
;
/**
* 原设备id
*/
@TableField
(
"source_equipment_id"
)
private
Long
sourceEquipmentId
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/service/IEquipmentInformService.java
View file @
88c3a58b
...
...
@@ -12,4 +12,5 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
public
interface
IEquipmentInformService
{
EquipmentInformDto
createEquipmentInform
(
EquipmentInformDto
model
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/service/IInformEquipmentService.java
View file @
88c3a58b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
service
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto
;
import
java.util.List
;
/**
* 告知申请-设备信息表接口类
*
...
...
@@ -9,4 +13,11 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.service;
*/
public
interface
IInformEquipmentService
{
InformEquipmentDto
saveInformEquipment
(
InformEquipmentDto
model
);
InformEquipmentDto
getEquipmentById
(
Long
sequenceNbr
);
List
<
InformEquipmentDto
>
getEquipListByInformId
(
Long
sequenceNbr
);
InformEquipmentDto
updateEquipment
(
InformEquipmentDto
model
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/controller/EquipmentController.java
View file @
88c3a58b
...
...
@@ -94,9 +94,9 @@ public class EquipmentController extends BaseController {
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/
{sequenceNbr}
"
)
@PutMapping
(
value
=
"/
updateEquipment
"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新装备信息表"
,
notes
=
"根据sequenceNbr更新装备信息表"
)
public
ResponseModel
<
EquipmentDto
>
updateBySequenceNbrEquipment
(
@RequestBody
EquipmentDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
public
ResponseModel
<
EquipmentDto
>
updateBySequenceNbrEquipment
(
@RequestBody
EquipmentDto
model
)
{
if
(
ValidationUtil
.
isEmpty
(
model
)
||
ValidationUtil
.
isEmpty
(
model
.
getSequenceNbr
()))
{
throw
new
BadRequest
(
"参数校验失败."
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/controller/EquipmentInformController.java
View file @
88c3a58b
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -10,6 +11,8 @@ import org.springframework.web.bind.annotation.RestController;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.util.List
;
import
com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentInformServiceImpl
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -45,7 +48,7 @@ public class EquipmentInformController extends BaseController {
public
ResponseModel
<
String
>
getInformCode
(
@PathVariable
String
regionCode
)
{
// 行政编码 + 年月 + 顺序号
String
code
=
regionCode
+
DateUtils
.
getDateNowShortNumber
();
int
number
=
equipmentInformServiceImpl
.
count
(
new
LambdaQueryWrapper
<
EquipmentInform
>().
like
(
EquipmentInform:
:
getProductCode
,
c
ode
));
int
number
=
equipmentInformServiceImpl
.
count
(
new
LambdaQueryWrapper
<
EquipmentInform
>().
like
(
EquipmentInform:
:
getProductCode
,
regionC
ode
));
String
numberStr
=
String
.
format
(
"%04d"
,
number
);
code
+=
numberStr
;
return
ResponseHelper
.
buildResponse
(
code
);
...
...
@@ -133,4 +136,8 @@ public class EquipmentInformController extends BaseController {
public
ResponseModel
<
List
<
EquipmentInformDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
equipmentInformServiceImpl
.
queryForEquipmentInformList
());
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/controller/InformEquipmentController.java
View file @
88c3a58b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.util.List
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.InformEquipment
;
import
com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.InformEquipmentServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
java.util.List
;
/**
* 告知申请-设备信息表
...
...
@@ -31,31 +43,65 @@ public class InformEquipmentController extends BaseController {
@Autowired
InformEquipmentServiceImpl
informEquipmentServiceImpl
;
/**
* 新增告知申请-设备信息表
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增告知
申请-设备信息表"
,
notes
=
"新增告知申请-设备信息表
"
)
/**
* 新增告知书设备
* @param model
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save
InformEquipment
"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增告知
书设备"
,
notes
=
"新增告知书设备
"
)
public
ResponseModel
<
InformEquipmentDto
>
save
(
@RequestBody
InformEquipmentDto
model
)
{
model
=
informEquipmentServiceImpl
.
createWithModel
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
if
(
ValidationUtil
.
isEmpty
(
model
.
getSourceEquipmentId
())
||
ValidationUtil
.
isEmpty
(
model
.
getInformId
()))
{
throw
new
BadRequest
(
"参数校验失败."
);
}
model
=
informEquipmentServiceImpl
.
saveInformEquipment
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个装备信息"
,
notes
=
"根据sequenceNbr查询单个装备信息"
)
public
ResponseModel
<
InformEquipmentDto
>
selectOne
(
@PathVariable
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
informEquipmentServiceImpl
.
getEquipmentById
(
sequenceNbr
));
}
/**
* 根据告知书id 查询相关设备信息
* @param sequenceNbr
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新告知申请-设备信息表"
,
notes
=
"根据sequenceNbr更新告知申请-设备信息表"
)
public
ResponseModel
<
InformEquipmentDto
>
updateBySequenceNbrInformEquipment
(
@RequestBody
InformEquipmentDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
model
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
informEquipmentServiceImpl
.
updateWithModel
(
model
));
@GetMapping
(
value
=
"/getEquipListByInformId/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据告知书id 查询相关设备信息"
,
notes
=
"根据告知书id 查询相关设备信息"
)
public
ResponseModel
<
List
<
InformEquipmentDto
>>
getEquipListByInformId
(
@PathVariable
Long
sequenceNbr
)
{
List
<
InformEquipmentDto
>
result
=
informEquipmentServiceImpl
.
getEquipListByInformId
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
result
);
}
/**
* 根据sequenceNbr更新
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/updateEquipment"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新装备信息表"
,
notes
=
"根据sequenceNbr更新装备信息表"
)
public
ResponseModel
<
InformEquipmentDto
>
updateBySequenceNbrEquipment
(
@RequestBody
InformEquipmentDto
model
)
{
if
(
ValidationUtil
.
isEmpty
(
model
)
||
ValidationUtil
.
isEmpty
(
model
.
getSequenceNbr
()))
{
throw
new
BadRequest
(
"参数校验失败."
);
}
model
=
informEquipmentServiceImpl
.
updateEquipment
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
/**
...
...
@@ -68,49 +114,8 @@ public class InformEquipmentController extends BaseController {
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除告知申请-设备信息表"
,
notes
=
"根据sequenceNbr删除告知申请-设备信息表"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
){
return
ResponseHelper
.
buildResponse
(
informEquipmentServiceImpl
.
removeById
(
sequenceNbr
));
return
ResponseHelper
.
buildResponse
(
informEquipmentServiceImpl
.
update
(
new
LambdaUpdateWrapper
<
InformEquipment
>().
eq
(
InformEquipment:
:
getSequenceNbr
,
sequenceNbr
).
set
(
InformEquipment:
:
getIsDelete
,
true
)
));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个告知申请-设备信息表"
,
notes
=
"根据sequenceNbr查询单个告知申请-设备信息表"
)
public
ResponseModel
<
InformEquipmentDto
>
selectOne
(
@PathVariable
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
informEquipmentServiceImpl
.
queryBySeq
(
sequenceNbr
));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"告知申请-设备信息表分页查询"
,
notes
=
"告知申请-设备信息表分页查询"
)
public
ResponseModel
<
Page
<
InformEquipmentDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
Page
<
InformEquipmentDto
>
page
=
new
Page
<
InformEquipmentDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
informEquipmentServiceImpl
.
queryForInformEquipmentPage
(
page
));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"告知申请-设备信息表列表全部数据查询"
,
notes
=
"告知申请-设备信息表列表全部数据查询"
)
@GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<
InformEquipmentDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
informEquipmentServiceImpl
.
queryForInformEquipmentList
());
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/service/impl/EquipmentInformServiceImpl.java
View file @
88c3a58b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.OrgUsr
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentIndexDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentIndex
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.enums.EquipmentInformStatusEnum
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.enums.EquipmentStatusEnum
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EquipmentInformMapper
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.service.IEquipmentInformService
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.service.IInformEquipmentService
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -23,6 +30,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* 设备告知单服务实现类
...
...
@@ -37,10 +45,18 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
SourceFileServiceImpl
sourceFileService
;
@Autowired
EquipmentServiceImpl
equipmentServiceImpl
;
@Autowired
OrgUsrServiceImpl
iOrgUsrService
;
@Autowired
EquipmentIndexServiceImpl
equipmentIndexServiceImpl
;
@Autowired
InformEquipmentServiceImpl
informEquipmentServiceImpl
;
/**
* 分页查询
*/
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/service/impl/InformEquipmentServiceImpl.java
View file @
88c3a58b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentIndexDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentIndex
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.InformEquipment
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.mapper.InformEquipmentMapper
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.service.IInformEquipmentService
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* 告知申请-设备信息表服务实现类
...
...
@@ -17,6 +33,58 @@ import java.util.List;
*/
@Service
public
class
InformEquipmentServiceImpl
extends
BaseService
<
InformEquipmentDto
,
InformEquipment
,
InformEquipmentMapper
>
implements
IInformEquipmentService
{
@Autowired
SourceFileServiceImpl
sourceFileService
;
@Autowired
EquipmentIndexServiceImpl
equipmentIndexServiceImpl
;
@Autowired
EquipmentServiceImpl
equipmentServiceImpl
;
@Transactional
@Override
public
InformEquipmentDto
saveInformEquipment
(
InformEquipmentDto
model
)
{
// 首先获取设备基本信息并复制
Equipment
sourceEquip
=
equipmentServiceImpl
.
getById
(
model
.
getSourceEquipmentId
());
BeanUtils
.
copyProperties
(
sourceEquip
,
model
);
model
.
setSequenceNbr
(
null
);
model
.
setRecDate
(
new
Date
());
model
.
setRecUserId
(
null
);
model
.
setRecUserName
(
null
);
this
.
createWithModel
(
model
);
// 保存设备参数信息
List
<
EquipmentIndex
>
indexList
=
equipmentIndexServiceImpl
.
list
(
new
LambdaQueryWrapper
<
EquipmentIndex
>().
eq
(
EquipmentIndex:
:
getEquipmentId
,
model
.
getSourceEquipmentId
()).
eq
(
EquipmentIndex:
:
getIsDelete
,
false
));
if
(
indexList
!=
null
&&
indexList
.
size
()>
0
)
{
for
(
EquipmentIndex
t
:
indexList
)
{
EquipmentIndexDto
temp
=
new
EquipmentIndexDto
();
BeanUtils
.
copyProperties
(
t
,
temp
);
temp
.
setSequenceNbr
(
null
);
temp
.
setEquipmentId
(
model
.
getSequenceNbr
());
temp
.
setEquipmentName
(
model
.
getName
());
equipmentIndexServiceImpl
.
createWithModel
(
temp
);
}
}
// 获取设备附件信息 保存附件信息
// 原附件信息
Map
<
String
,
List
<
AttachmentDto
>>
sourceAttach
=
sourceFileService
.
getAttachments
(
sourceEquip
.
getSequenceNbr
());
for
(
Map
.
Entry
<
String
,
List
<
AttachmentDto
>>
m
:
sourceAttach
.
entrySet
())
{
List
<
AttachmentDto
>
tempList
=
m
.
getValue
();
tempList
.
stream
().
forEach
(
l
->
{
l
.
setSequenceNbr
(
null
);
});
}
if
(
sourceAttach
!=
null
)
{
sourceFileService
.
saveAttachments
(
model
.
getSequenceNbr
(),
sourceAttach
);
}
return
model
;
}
/**
* 分页查询
*/
...
...
@@ -30,4 +98,76 @@ public class InformEquipmentServiceImpl extends BaseService<InformEquipmentDto,I
public
List
<
InformEquipmentDto
>
queryForInformEquipmentList
()
{
return
this
.
queryForList
(
""
,
false
);
}
@Override
public
InformEquipmentDto
getEquipmentById
(
Long
sequenceNbr
)
{
// 获取基本信息
InformEquipment
equipment
=
this
.
getById
(
sequenceNbr
);
InformEquipmentDto
result
=
new
InformEquipmentDto
();
BeanUtils
.
copyProperties
(
equipment
,
result
);
// 封装附件
result
.
setAttachments
(
sourceFileService
.
getAttachments
(
equipment
.
getSequenceNbr
()));
// 封装详细参数
List
<
EquipmentIndex
>
indexList
=
equipmentIndexServiceImpl
.
list
(
new
LambdaQueryWrapper
<
EquipmentIndex
>().
eq
(
EquipmentIndex:
:
getEquipmentId
,
equipment
.
getSequenceNbr
()));
List
<
EquipmentIndexDto
>
dtoList
=
new
ArrayList
<>();
indexList
.
stream
().
forEach
(
t
->
{
EquipmentIndexDto
temp
=
new
EquipmentIndexDto
();
BeanUtils
.
copyProperties
(
t
,
temp
);
dtoList
.
add
(
temp
);
});
result
.
setEquipmentIndex
(
dtoList
);
return
result
;
}
@Override
public
InformEquipmentDto
updateEquipment
(
InformEquipmentDto
model
)
{
this
.
updateWithModel
(
model
);
saveSourceFile
(
model
);
// 先删除参数信息 再添加新的参数信息
equipmentIndexServiceImpl
.
remove
(
new
LambdaQueryWrapper
<
EquipmentIndex
>().
eq
(
EquipmentIndex:
:
getEquipmentId
,
model
.
getSequenceNbr
()));
// 保存设备参数信息
List
<
EquipmentIndexDto
>
equipmentIndex
=
model
.
getEquipmentIndex
();
if
(
equipmentIndex
!=
null
&&
equipmentIndex
.
size
()>
0
)
{
for
(
EquipmentIndexDto
t
:
equipmentIndex
)
{
t
.
setEquipmentId
(
model
.
getSequenceNbr
());
t
.
setEquipmentName
(
model
.
getName
());
equipmentIndexServiceImpl
.
createWithModel
(
t
);
}
}
Bean
.
copyExistPropertis
(
this
.
queryBySeq
(
model
.
getSequenceNbr
()),
model
);
return
model
;
}
@Override
public
List
<
InformEquipmentDto
>
getEquipListByInformId
(
Long
sequenceNbr
)
{
List
<
InformEquipment
>
list
=
this
.
list
(
new
LambdaQueryWrapper
<
InformEquipment
>().
eq
(
InformEquipment:
:
getIsDelete
,
false
).
eq
(
InformEquipment:
:
getInformId
,
sequenceNbr
));
List
<
InformEquipmentDto
>
result
=
new
ArrayList
<>();
list
.
stream
().
forEach
(
t
->
{
InformEquipmentDto
tempDto
=
new
InformEquipmentDto
();
BeanUtils
.
copyProperties
(
t
,
tempDto
);
// 封装附件
tempDto
.
setAttachments
(
sourceFileService
.
getAttachments
(
t
.
getSequenceNbr
()));
// 封装详细参数
List
<
EquipmentIndex
>
indexList
=
equipmentIndexServiceImpl
.
list
(
new
LambdaQueryWrapper
<
EquipmentIndex
>().
eq
(
EquipmentIndex:
:
getEquipmentId
,
t
.
getSequenceNbr
()));
List
<
EquipmentIndexDto
>
dtoList
=
new
ArrayList
<>();
indexList
.
stream
().
forEach
(
i
->
{
EquipmentIndexDto
temp
=
new
EquipmentIndexDto
();
BeanUtils
.
copyProperties
(
i
,
temp
);
dtoList
.
add
(
temp
);
});
tempDto
.
setEquipmentIndex
(
dtoList
);
result
.
add
(
tempDto
);
});
return
result
;
}
// 保存附件信息
public
void
saveSourceFile
(
InformEquipmentDto
model
)
{
if
(
model
.
getAttachments
()
!=
null
)
{
sourceFileService
.
saveAttachments
(
model
.
getSequenceNbr
(),
model
.
getAttachments
());
}
}
}
\ No newline at end of file
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