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
67b0888c
Commit
67b0888c
authored
Oct 15, 2022
by
srx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备附件查看
parent
a192b998
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
3 deletions
+78
-3
EquipmentController.java
...s/boot/module/ugp/biz/controller/EquipmentController.java
+41
-3
EquipmentServiceImpl.java
...oot/module/ugp/biz/service/impl/EquipmentServiceImpl.java
+37
-0
No files found.
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/controller/EquipmentController.java
View file @
67b0888c
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
biz
.
controller
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
biz
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto
;
import
com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.Attachment
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.Equipment
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper
;
import
com.yeejoin.amos.boot.module.ugp.biz.service.impl.AttachmentServiceImpl
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -15,6 +21,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
...
@@ -15,6 +21,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
com.yeejoin.amos.boot.module.ugp.biz.service.impl.EquipmentServiceImpl
;
import
com.yeejoin.amos.boot.module.ugp.biz.service.impl.EquipmentServiceImpl
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -45,6 +52,9 @@ public class EquipmentController extends BaseController {
...
@@ -45,6 +52,9 @@ public class EquipmentController extends BaseController {
@Autowired
@Autowired
AttachmentMapper
attachmentMapper
;
AttachmentMapper
attachmentMapper
;
@Autowired
AttachmentServiceImpl
attachmentService
;
/**
/**
* 新增设备信息表
* 新增设备信息表
*
*
...
@@ -154,7 +164,7 @@ public class EquipmentController extends BaseController {
...
@@ -154,7 +164,7 @@ public class EquipmentController extends BaseController {
*/
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/saveIE"
)
@PostMapping
(
value
=
"/saveIE"
)
@ApiOperation
(
httpMethod
=
"P
ost
"
,
value
=
"新增设备+附件"
,
notes
=
"新增设备+附件"
)
@ApiOperation
(
httpMethod
=
"P
OST
"
,
value
=
"新增设备+附件"
,
notes
=
"新增设备+附件"
)
public
ResponseModel
<
EquipmentDto
>
saveEquipment
(
@RequestBody
JSONObject
object
)
{
public
ResponseModel
<
EquipmentDto
>
saveEquipment
(
@RequestBody
JSONObject
object
)
{
EquipmentDto
equipmentDto
=
equipmentServiceImpl
.
saveEI
(
object
);
EquipmentDto
equipmentDto
=
equipmentServiceImpl
.
saveEI
(
object
);
Long
sequenceNbr
=
equipmentDto
.
getSequenceNbr
();
Long
sequenceNbr
=
equipmentDto
.
getSequenceNbr
();
...
@@ -186,8 +196,13 @@ public class EquipmentController extends BaseController {
...
@@ -186,8 +196,13 @@ public class EquipmentController extends BaseController {
public
ResponseModel
<
JSONObject
>
selectIEOne
(
@PathVariable
Long
sequenceNbr
)
{
public
ResponseModel
<
JSONObject
>
selectIEOne
(
@PathVariable
Long
sequenceNbr
)
{
EquipmentDto
equipmentDto
=
equipmentServiceImpl
.
queryBySeq
(
sequenceNbr
);
EquipmentDto
equipmentDto
=
equipmentServiceImpl
.
queryBySeq
(
sequenceNbr
);
AttachmentDto
attachmentDto
=
attachmentMapper
.
selectAttBySeq
(
sequenceNbr
);
AttachmentDto
attachmentDto
=
null
;
try
{
attachmentDto
=
attachmentMapper
.
selectAttBySeq
(
sequenceNbr
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"name"
,
equipmentDto
.
getName
());
jsonObject
.
put
(
"name"
,
equipmentDto
.
getName
());
jsonObject
.
put
(
"type"
,
equipmentDto
.
getType
());
jsonObject
.
put
(
"type"
,
equipmentDto
.
getType
());
...
@@ -198,9 +213,32 @@ public class EquipmentController extends BaseController {
...
@@ -198,9 +213,32 @@ public class EquipmentController extends BaseController {
jsonObject
.
put
(
"inspectionDate"
,
equipmentDto
.
getInspectionDate
());
jsonObject
.
put
(
"inspectionDate"
,
equipmentDto
.
getInspectionDate
());
jsonObject
.
put
(
"useStatus"
,
equipmentDto
.
getUseStatus
());
jsonObject
.
put
(
"useStatus"
,
equipmentDto
.
getUseStatus
());
jsonObject
.
put
(
"verifyStatus"
,
equipmentDto
.
getVerifyStatus
());
jsonObject
.
put
(
"verifyStatus"
,
equipmentDto
.
getVerifyStatus
());
jsonObject
.
put
(
"subForm"
,
JSON
.
parseArray
(
attachmentDto
.
getInfo
()));
JSONArray
jsonArray
=
new
JSONArray
();
try
{
jsonArray
=
JSON
.
parseArray
(
attachmentDto
.
getInfo
());
}
catch
(
Exception
e
){
}
jsonObject
.
put
(
"subForm"
,
jsonArray
);
return
ResponseHelper
.
buildResponse
(
jsonObject
);
return
ResponseHelper
.
buildResponse
(
jsonObject
);
}
}
}
/**
* 根据sequenceNbr更新设备的附件
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"IE/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"根据sequenceNbr更新设备和附件"
,
notes
=
"根据sequenceNbr更新设备和附件"
)
public
ResponseModel
<
String
>
selectIEOne
(
@PathVariable
Long
sequenceNbr
,
@RequestBody
JSONObject
object
)
{
equipmentServiceImpl
.
updateEI
(
sequenceNbr
,
object
);
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
}
}
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/service/impl/EquipmentServiceImpl.java
View file @
67b0888c
...
@@ -7,8 +7,10 @@ import com.alibaba.fastjson.JSON;
...
@@ -7,8 +7,10 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto
;
import
com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.Attachment
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.Equipment
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.Equipment
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.Project
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.Project
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.AttachmentMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.service.IEquipmentService
;
import
com.yeejoin.amos.boot.module.ugp.api.service.IEquipmentService
;
...
@@ -93,6 +95,7 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
...
@@ -93,6 +95,7 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
public
void
saveAttachment
(
JSONObject
object
,
Long
SequenceNbr
){
public
void
saveAttachment
(
JSONObject
object
,
Long
SequenceNbr
){
AttachmentDto
attachmentDto
=
new
AttachmentDto
();
AttachmentDto
attachmentDto
=
new
AttachmentDto
();
JSONArray
subForm
=
object
.
getJSONArray
(
"subForm"
);
JSONArray
subForm
=
object
.
getJSONArray
(
"subForm"
);
if
(!
subForm
.
isEmpty
()){
for
(
Object
o:
subForm
){
for
(
Object
o:
subForm
){
JSONObject
jsonObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
o
));
JSONObject
jsonObject
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
o
));
jsonObject
.
getString
(
"Symbol_key"
);
jsonObject
.
getString
(
"Symbol_key"
);
...
@@ -115,6 +118,8 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
...
@@ -115,6 +118,8 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
}
}
}
}
}
@Override
@Override
public
EquipmentDto
saveEI
(
JSONObject
object
)
{
public
EquipmentDto
saveEI
(
JSONObject
object
)
{
EquipmentDto
model
=
new
EquipmentDto
();
EquipmentDto
model
=
new
EquipmentDto
();
...
@@ -131,4 +136,35 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
...
@@ -131,4 +136,35 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
return
result
;
return
result
;
}
}
/**
* 修改设备+附件信息
* @param sequenceNbr
* @param object
*/
public
void
updateEI
(
Long
sequenceNbr
,
JSONObject
object
){
Equipment
model
=
this
.
getById
(
sequenceNbr
);
LambdaQueryWrapper
<
Attachment
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
Attachment:
:
getSourceId
,
sequenceNbr
);
Attachment
attachment
=
attachmentServiceImpl
.
getOne
(
wrapper
);
// AttachmentDto attachmentDto = attachmentMapper.selectAttBySeq(sequenceNbr);
model
.
setName
(
object
.
getString
(
"name"
));
model
.
setType
(
object
.
getString
(
"type"
));
model
.
setCode
(
object
.
getString
(
"code"
));
model
.
setManufacturer
(
object
.
getString
(
"manufacturer"
));
model
.
setManufactureDate
(
object
.
getDate
(
"manufactureDate"
));
model
.
setServiceLife
(
object
.
getString
(
"serviceLife"
));
model
.
setInspectionDate
(
object
.
getDate
(
"inspectionDate"
));
model
.
setUseStatus
(
object
.
getString
(
"useStatus"
));
model
.
setVerifyStatus
(
object
.
getString
(
"verifyStatus"
));
updateById
(
model
);
JSONArray
subForm
=
object
.
getJSONArray
(
"subForm"
);
attachment
.
setInfo
(
JSON
.
toJSONString
(
subForm
));
// new Attachment();
// BeanUtils.copyProperties(attachmentDto,attachment);
attachmentServiceImpl
.
updateById
(
attachment
);
}
}
}
\ 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