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
2bb54d36
Commit
2bb54d36
authored
Dec 14, 2023
by
xixinzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
告知单修改
parent
a1047513
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
72 deletions
+75
-72
pom.xml
...m-tzs/amos-boot-module-jg/amos-boot-module-jg-api/pom.xml
+5
-0
IJgInstallationNoticeService.java
...t/module/jg/api/service/IJgInstallationNoticeService.java
+5
-2
JgInstallationNoticeController.java
...ule/jg/biz/controller/JgInstallationNoticeController.java
+13
-7
JgInstallationNoticeServiceImpl.java
.../jg/biz/service/impl/JgInstallationNoticeServiceImpl.java
+52
-63
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/pom.xml
View file @
2bb54d36
...
...
@@ -23,6 +23,11 @@
</dependency>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-module-tcm-api
</artifactId>
<version>
1.0.0
</version>
</dependency>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-module-common-api
</artifactId>
<version>
${amos-biz-boot.version}
</version>
</dependency>
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/service/IJgInstallationNoticeService.java
View file @
2bb54d36
...
...
@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.jg.api.service;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto
;
import
java.util.Map
;
/**
* 接口类
*
...
...
@@ -13,7 +15,8 @@ public interface IJgInstallationNoticeService {
/**
* 保存安装告知单
* @param model
* @param model 数据
* @param submitType 保存类型
*/
void
saveNotice
(
JgInstallationNoticeDto
model
);
void
saveNotice
(
String
submitType
,
Map
<
String
,
JgInstallationNoticeDto
>
model
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgInstallationNoticeController.java
View file @
2bb54d36
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
controller
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice
;
import
org.omg.PortableInterceptor.SUCCESSFUL
;
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.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto
;
...
...
@@ -19,6 +24,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
/**
...
...
@@ -41,12 +47,12 @@ public class JgInstallationNoticeController extends BaseController {
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增安装告知"
,
notes
=
"新增安装告知"
)
public
ResponseModel
<
JgInstallationNoticeDto
>
save
(
@RequestBody
JgInstallationNoticeDto
model
)
{
jgInstallationNoticeServiceImpl
.
saveNotice
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增安装告知"
,
notes
=
"新增安装告知"
)
public
ResponseModel
<
String
>
save
(
@RequestParam
String
submitType
,
@RequestBody
Map
<
String
,
JgInstallationNoticeDto
>
model
)
{
jgInstallationNoticeServiceImpl
.
saveNotice
(
submitType
,
model
);
return
ResponseHelper
.
buildResponse
(
""
);
}
/**
* 根据sequenceNbr更新
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgInstallationNoticeServiceImpl.java
View file @
2bb54d36
...
...
@@ -9,12 +9,19 @@ import com.yeejoin.amos.boot.module.jg.api.enums.FlowStatusEnum;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgRelationEquipMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto
;
import
com.yeejoin.amos.boot.module.tcm.api.enums.ApplicationFormTypeEnum
;
import
com.yeejoin.amos.boot.module.tcm.api.service.ICreateCodeService
;
import
com.yeejoin.amos.feign.workflow.Workflow
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO
;
import
com.yeejoin.amos.feign.workflow.model.AjaxResult
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICommonService
;
import
com.yeejoin.amos.feign.workflow.Workflow
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO
;
import
com.yeejoin.amos.feign.workflow.model.AjaxResult
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -33,63 +40,18 @@ import java.util.stream.Collectors;
@Service
public
class
JgInstallationNoticeServiceImpl
extends
BaseService
<
JgInstallationNoticeDto
,
JgInstallationNotice
,
JgInstallationNoticeMapper
>
implements
IJgInstallationNoticeService
{
@Autowired
JgRelationEquipMapper
jgRelationEquipMapper
;
@Autowired
private
JgInstallationNoticeMapper
jgInstallationNoticeMapper
;
@Autowired
private
ICommonService
commonService
;
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return 安装告知
*/
public
Map
<
String
,
Map
<
String
,
Object
>>
queryBySequenceNbr
(
Long
sequenceNbr
)
{
// 安装告知信息
JgInstallationNotice
notice
=
jgInstallationNoticeMapper
.
selectById
(
sequenceNbr
);
Map
<
String
,
Object
>
installationInfo
=
BeanUtil
.
beanToMap
(
notice
);
public
static
final
String
SUBMIT_TYPE_FLOW
=
"1"
;
public
static
final
String
PROCESS_DEFINITION_KEY
=
"installationNotification"
;
public
static
final
String
TABLE_PAGE_ID
=
"1734141426742095873"
;
installationInfo
.
put
(
"province"
,
notice
.
getProvince
()
+
"_"
+
notice
.
getProvinceName
());
installationInfo
.
put
(
"city"
,
notice
.
getCity
()
+
"_"
+
notice
.
getCityName
());
installationInfo
.
put
(
"county"
,
notice
.
getCounty
()
+
"_"
+
notice
.
getCountyName
());
// 设备信息
List
<
Map
<
String
,
Object
>>
equipmentInfos
=
jgInstallationNoticeMapper
.
queryEquipInformation
(
sequenceNbr
);
return
new
HashMap
<
String
,
Map
<
String
,
Object
>>()
{{
this
.
put
(
"installationInfo"
,
installationInfo
);
this
.
put
(
"equipmentInfo"
,
equipmentInfos
.
get
(
0
));
}};
}
/**
* 更新安装告知
*
* @param noticeDto 安装告知
*/
@SuppressWarnings
(
"rawtypes"
)
public
JgInstallationNoticeDto
updateInstallationNotice
(
JgInstallationNoticeDto
noticeDto
)
{
this
.
convertField
(
noticeDto
);
@Autowired
private
JgInstallationNoticeMapper
jgInstallationNoticeMapper
;
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
"installationNotification"
);
dto
.
setBusinessKey
(
"1"
);
AjaxResult
ajaxResult
;
try
{
ajaxResult
=
Workflow
.
taskClient
.
startByVariable
(
dto
);
String
instanceId
=
((
Map
)
ajaxResult
.
get
(
"data"
)).
get
(
"id"
).
toString
();
noticeDto
.
setInstanceId
(
instanceId
);
noticeDto
.
setStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
JgInstallationNotice
bean
=
new
JgInstallationNotice
();
BeanUtils
.
copyProperties
(
noticeDto
,
bean
);
jgInstallationNoticeMapper
.
updateById
(
bean
);
}
catch
(
Exception
e
)
{
log
.
error
(
"提交失败:{}"
,
e
);
}
return
noticeDto
;
}
@Autowired
private
ICreateCodeService
iCreateCodeService
;
@Autowired
JgRelationEquipMapper
jgRelationEquipMapper
;
/**
* 分页查询
...
...
@@ -143,19 +105,40 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
@Override
public
void
saveNotice
(
JgInstallationNoticeDto
model
)
{
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveNotice
(
String
submitType
,
Map
<
String
,
JgInstallationNoticeDto
>
jgInstallationNoticeDtoMap
)
{
JgInstallationNoticeDto
model
=
jgInstallationNoticeDtoMap
.
get
(
TABLE_PAGE_ID
);
// 字段转换
convertField
(
model
);
// 获取告知设备列表
List
<
Map
<
String
,
Object
>>
deviceList
=
model
.
getDeviceList
();
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
return
;
}
// 获取告知单号
// 调用方法
List
<
String
>
applyNoList
=
new
ArrayList
<>();
Random
random
=
new
Random
();
for
(
int
i
=
0
;
i
<
deviceList
.
size
();
i
++)
{
applyNoList
.
add
(
String
.
valueOf
(
random
.
nextInt
()));
List
<
String
>
applyNoList
=
iCreateCodeService
.
createApplicationFormCode
(
ApplicationFormTypeEnum
.
GZ
.
getCode
(),
deviceList
.
size
());
if
(
CollectionUtils
.
isEmpty
(
applyNoList
))
{
return
;
}
// 判断当前是否为提交
List
<
String
>
instanceIdList
=
new
ArrayList
<>();
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 发起流程
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
for
(
int
i
=
0
;
i
<
deviceList
.
size
();
i
++)
{
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
AjaxResult
ajaxResult
=
null
;
try
{
ajaxResult
=
Workflow
.
taskClient
.
startByVariable
(
dto
);
String
instanceId
=
((
Map
)
ajaxResult
.
get
(
"data"
)).
get
(
"id"
).
toString
();
instanceIdList
.
add
(
instanceId
);
}
catch
(
Exception
e
)
{
log
.
error
(
"流程启动失败:{}"
,
e
);
}
}
}
List
<
JgInstallationNotice
>
list
=
new
ArrayList
<>();
...
...
@@ -167,10 +150,16 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
int
i
=
deviceList
.
indexOf
(
obj
);
String
applyNo
=
applyNoList
.
get
(
i
);
dto
.
setApplyNo
(
applyNo
);
dto
.
setEquList
(
String
.
valueOf
(
obj
.
get
(
"
sequenceNbr
"
)));
jgRelationEquip
.
setEquipId
(
String
.
valueOf
(
obj
.
get
(
"
sequenceNbr
"
)));
dto
.
setEquList
(
String
.
valueOf
(
obj
.
get
(
"
SEQUENCE_NBR
"
)));
jgRelationEquip
.
setEquipId
(
String
.
valueOf
(
obj
.
get
(
"
SEQUENCE_NBR
"
)));
jgRelationEquip
.
setApplyNo
(
applyNo
);
jgRelationEquip
.
setBusinessType
(
"GZ"
);
if
(!
CollectionUtils
.
isEmpty
(
instanceIdList
))
{
dto
.
setInstanceId
(
instanceIdList
.
get
(
i
));
dto
.
setStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
}
else
{
dto
.
setStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_SUBMITTED
.
getCode
()));
}
list
.
add
(
dto
);
equipList
.
add
(
jgRelationEquip
);
});
...
...
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