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
2b72e92e
Commit
2b72e92e
authored
Oct 11, 2022
by
dqq
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
7c5eec49
b028a163
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
368 additions
and
70 deletions
+368
-70
TzsAuthController.java
...mos/boot/module/tzs/biz/controller/TzsAuthController.java
+1
-1
TzsAuthServiceImpl.java
.../boot/module/tzs/biz/service/impl/TzsAuthServiceImpl.java
+7
-3
RegUnitInfoController.java
.../module/tzs/flc/biz/controller/RegUnitInfoController.java
+50
-19
RegUnitInfoServiceImpl.java
...dule/tzs/flc/biz/service/impl/RegUnitInfoServiceImpl.java
+28
-7
ProjectDto.java
.../com/yeejoin/amos/boot/module/ugp/api/dto/ProjectDto.java
+7
-0
ProjectInitiationDto.java
...in/amos/boot/module/ugp/api/dto/ProjectInitiationDto.java
+30
-0
Project.java
.../com/yeejoin/amos/boot/module/ugp/api/entity/Project.java
+12
-0
ProjectInitiation.java
...in/amos/boot/module/ugp/api/entity/ProjectInitiation.java
+30
-0
ProjectInitiationMapper.java
...s/boot/module/ugp/api/mapper/ProjectInitiationMapper.java
+8
-0
IProjectInitiationService.java
...oot/module/ugp/api/service/IProjectInitiationService.java
+19
-0
ProjectController.java
...mos/boot/module/ugp/biz/controller/ProjectController.java
+9
-1
ProjectInitiationController.java
...odule/ugp/biz/controller/ProjectInitiationController.java
+15
-6
ProjectInitiationServiceImpl.java
...le/ugp/biz/service/impl/ProjectInitiationServiceImpl.java
+145
-31
application.properties
...-module-ugp-biz/src/main/resources/application.properties
+2
-2
pom.xml
amos-boot-system-ugp/pom.xml
+5
-0
No files found.
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/TzsAuthController.java
View file @
2b72e92e
...
...
@@ -106,7 +106,7 @@ public class TzsAuthController extends BaseController {
}
map
.
put
(
"company"
,
company
.
getCompanyName
());
}
map
.
put
(
"user
n
ame"
,
result
.
getResult
().
getRealName
());
map
.
put
(
"user
N
ame"
,
result
.
getResult
().
getRealName
());
}
return
ResponseHelper
.
buildResponse
(
map
);
}
...
...
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/TzsAuthServiceImpl.java
View file @
2b72e92e
...
...
@@ -54,6 +54,9 @@ public class TzsAuthServiceImpl implements TzsAuthService {
*/
@Value
(
"${redis.cache.failure.time}"
)
private
Long
redisRegionTimeSecond
;
@Autowired
private
StartPlatformTokenService
startPlatformTokenService
;
@Override
...
...
@@ -75,7 +78,8 @@ public class TzsAuthServiceImpl implements TzsAuthService {
@Override
public
List
<
RegionModel
>
getUserReginTree
()
{
List
<
String
>
regionList
=
this
.
getUserRegionCode
();
AgencyUserModel
me
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
//AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
startPlatformTokenService
.
getToken
();
List
<
RegionModel
>
tree
=
(
List
<
RegionModel
>)
Systemctl
.
regionClient
.
queryForTree
(
null
).
getResult
();
// 循环list 将List 封装为 省市区 SET
Set
<
String
>
city
=
new
HashSet
<>();
...
...
@@ -128,8 +132,8 @@ public class TzsAuthServiceImpl implements TzsAuthService {
for
(
Map
.
Entry
<
String
,
RegionModel
>
entries
:
tempCityMap
.
entrySet
())
{
newCity
.
add
(
entries
.
getValue
());
}
start
.
setChildren
(
newCity
);
newTree
.
add
(
start
);
//
start.setChildren(newCity);
newTree
.
add
All
(
newCity
);
return
newTree
;
}
...
...
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/controller/RegUnitInfoController.java
View file @
2b72e92e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
controller
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Random
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpStatus
;
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.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
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
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.RegUnitInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.service.IRegUnitInfoService
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
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
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Random
;
/**
* 单位注册信息表
...
...
@@ -54,19 +72,32 @@ public class RegUnitInfoController extends BaseController {
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"单位注册"
,
notes
=
"单位注册"
)
public
ResponseModel
<
RegUnitInfoDto
>
save
(
@RequestBody
RegUnitInfoDto
model
)
{
model
=
iRegUnitInfoService
.
registerUnit
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
try
{
model
=
iRegUnitInfoService
.
registerUnit
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
catch
(
Exception
e
)
{
ResponseModel
<
RegUnitInfoDto
>
response
=
new
ResponseModel
<>();
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
response
.
setResult
(
null
);
response
.
setDevMessage
(
e
.
getMessage
());
response
.
setStatus
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
());
response
.
setTraceId
(
RequestContext
.
getTraceId
());
response
.
setPath
(
request
.
getServletPath
());
return
response
;
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/{unitCode}/check"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"单位注册校验"
,
notes
=
"单位注册校验"
)
public
ResponseModel
<
RegUnitInfoDto
>
unitCheck
(
@PathVariable
String
unitCode
,
@RequestParam
String
unitType
)
{
@RequestParam
String
unitType
,
@RequestParam
String
companyName
)
{
if
(
ValidationUtil
.
isEmpty
(
unitCode
))
{
throw
new
BadRequest
(
"单位编码不能为空"
);
}
RegUnitInfoDto
regUnitInfoDto
=
iRegUnitInfoService
.
unitCheck
(
unitCode
,
unitType
);
}
RegUnitInfoDto
regUnitInfoDto
=
iRegUnitInfoService
.
unitCheck
(
unitCode
,
unitType
,
companyName
);
return
ResponseHelper
.
buildResponse
(
regUnitInfoDto
);
}
...
...
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/service/impl/RegUnitInfoServiceImpl.java
View file @
2b72e92e
...
...
@@ -40,6 +40,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.BaseUnitLicenceDto;
import
com.yeejoin.amos.boot.module.tzs.api.entity.BaseUnitLicence
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.TzBaseEnterpriseInfo
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.BaseUnitLicenceServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzBaseEnterpriseInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzsAuthServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.RegUnitIcDto
;
...
...
@@ -87,7 +88,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
@Autowired
AccessFeignService
accessFeignService
;
@Autowired
StartPlatformTokenService
startPlatformTokenService
;
/**
* 使用单位的类型,数据来源:cb_data_dictionary code = 1232
*/
...
...
@@ -218,13 +221,31 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
}
@Override
public
RegUnitInfoDto
unitCheck
(
String
unitCode
,
String
unitType
)
{
public
RegUnitInfoDto
unitCheck
(
String
unitCode
,
String
unitType
,
String
companyName
)
{
if
(!
ValidationUtil
.
isEmpty
(
companyName
))
{
startPlatformTokenService
.
getToken
();
FeignClientResult
<
CompanyModel
>
result
=
Privilege
.
companyClient
.
queryByCompanyName
(
companyName
);
if
(
result
.
getResult
()!=
null
)
{
throw
new
BadRequest
(
"重复的公司名称"
);
}
}
if
(!
ValidationUtil
.
isEmpty
(
unitCode
))
{
startPlatformTokenService
.
getToken
();
FeignClientResult
<
CompanyModel
>
result
=
Privilege
.
companyClient
.
queryByCompanyCode
(
unitCode
);
if
(
result
.
getResult
()!=
null
)
{
throw
new
RuntimeException
(
"重复的公司编码"
);
}
}
// 1.校验重复性
RegUnitInfo
regUnitInfo
=
this
.
getOne
(
new
LambdaQueryWrapper
<
RegUnitInfo
>().
eq
(
RegUnitInfo:
:
getUnitCode
,
unitCode
));
if
(
regUnitInfo
!=
null
)
{
throw
new
RuntimeException
(
"该单位已注册,请联系企业管理员!"
);
}
//
RegUnitInfo regUnitInfo = this
//
.getOne(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode));
//
if (regUnitInfo != null) {
//
throw new RuntimeException("该单位已注册,请联系企业管理员!");
//
}
// 2.组织返回数据
RegUnitInfoDto
regUnitInfoDto
=
new
RegUnitInfoDto
();
if
(
USE_UNIT_TYPE_CODE
.
equals
(
unitType
)
||
PRODUCT_UNIT_TYPE_CODE
.
equals
(
unitType
)
||
FILLING_UNIT_TYPE_CODE
.
equals
(
unitType
))
{
...
...
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/dto/ProjectDto.java
View file @
2b72e92e
...
...
@@ -75,7 +75,14 @@ public class ProjectDto extends BaseDto {
@ApiModelProperty
(
value
=
"项目提交日期"
)
private
Date
submitDate
;
@ApiModelProperty
(
value
=
"流程id"
)
private
String
instanceId
;
@ApiModelProperty
(
value
=
"流程状态"
)
private
String
status
;
@ApiModelProperty
(
value
=
"备注"
)
private
String
remark
;
}
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/dto/ProjectInitiationDto.java
0 → 100644
View file @
2b72e92e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
api
.
dto
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
@Data
@ApiModel
(
value
=
"ProjectInitiationDto"
,
description
=
"项目立项流程日志表"
)
public
class
ProjectInitiationDto
extends
BaseDto
{
@TableField
(
"instance_id"
)
private
String
instanceId
;
@TableField
(
"task_id"
)
private
String
taskId
;
@TableField
(
"task_name"
)
private
String
taskName
;
@TableField
(
"executor"
)
private
String
executor
;
@TableField
(
"context"
)
private
String
context
;
}
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/entity/Project.java
View file @
2b72e92e
...
...
@@ -131,6 +131,18 @@ public class Project extends BaseEntity {
private
Date
submitDate
;
/**
* 流程id
*/
@TableField
(
"instance_id"
)
private
String
instanceId
;
/**
* 流程状态
*/
@TableField
(
"status"
)
private
String
status
;
/**
* 备注
*/
@TableField
(
"remark"
)
...
...
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/entity/ProjectInitiation.java
0 → 100644
View file @
2b72e92e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
api
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tz_ugp_project_initiation_log"
)
public
class
ProjectInitiation
extends
BaseEntity
{
@TableField
(
"instance_id"
)
private
String
instanceId
;
@TableField
(
"task_id"
)
private
String
taskId
;
@TableField
(
"task_name"
)
private
String
taskName
;
@TableField
(
"executor"
)
private
String
executor
;
@TableField
(
"context"
)
private
String
context
;
}
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/mapper/ProjectInitiationMapper.java
0 → 100644
View file @
2b72e92e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
api
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.ProjectInitiation
;
public
interface
ProjectInitiationMapper
extends
BaseMapper
<
ProjectInitiation
>
{
}
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/service/IProjectInitiationService.java
0 → 100644
View file @
2b72e92e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
api
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
public
interface
IProjectInitiationService
{
/**
* 流程启动
* @return 返回instanceId ,加入项目信息表中
* @throws Exception
*/
String
start
(
Object
objectd
);
/**
* 执行流程节点,并记录日志
*/
void
execute
(
String
instanceId
,
Object
object
,
String
option
);
}
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/controller/ProjectController.java
View file @
2b72e92e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
biz
.
controller
;
import
com.yeejoin.amos.boot.module.ugp.biz.service.impl.ProjectInitiationServiceImpl
;
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.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.util.Date
;
import
java.util.List
;
import
com.yeejoin.amos.boot.module.ugp.biz.service.impl.ProjectServiceImpl
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
...
...
@@ -30,6 +33,8 @@ public class ProjectController extends BaseController {
@Autowired
ProjectServiceImpl
projectServiceImpl
;
@Autowired
ProjectInitiationServiceImpl
projectInitiationService
;
/**
* 新增项目信息表
...
...
@@ -40,6 +45,8 @@ public class ProjectController extends BaseController {
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增项目信息表"
,
notes
=
"新增项目信息表"
)
public
ResponseModel
<
ProjectDto
>
save
(
@RequestBody
ProjectDto
model
)
{
model
.
setStartDate
(
new
Date
());
model
.
setSubmitDate
(
new
Date
());
model
=
projectServiceImpl
.
createWithModel
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
...
...
@@ -54,7 +61,8 @@ public class ProjectController extends BaseController {
@PutMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新项目信息表"
,
notes
=
"根据sequenceNbr更新项目信息表"
)
public
ResponseModel
<
ProjectDto
>
updateBySequenceNbrProject
(
@RequestBody
ProjectDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
model
.
setSequenceNbr
(
sequenceNbr
);
model
.
setRecDate
(
new
Date
());
model
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
projectServiceImpl
.
updateWithModel
(
model
));
}
...
...
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/controller/ProjectInitiationController.java
View file @
2b72e92e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
biz
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.ugp.biz.service.impl.ProjectInitiationServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ResponseHeader
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
@RestController
@Api
(
tags
=
"流程相关"
)
...
...
@@ -22,7 +23,15 @@ public class ProjectInitiationController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/start"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"流程启动"
,
notes
=
"流程启动"
)
public
void
start
()
throws
Exception
{
projectInitiationServiceImpl
.
start
();
public
ResponseModel
<
String
>
start
()
throws
Exception
{
return
ResponseHelper
.
buildResponse
(
projectInitiationServiceImpl
.
start
(
new
Object
()));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/execute/{instanceId}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"流程启动"
,
notes
=
"流程启动"
)
public
ResponseModel
<
String
>
execute
(
@PathVariable
(
"instanceId"
)
String
instanceId
,
Object
object
,
String
option
)
throws
Exception
{
projectInitiationServiceImpl
.
execute
(
instanceId
,
object
,
option
);
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/ProjectInitiationServiceImpl.java
View file @
2b72e92e
...
...
@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.google.common.collect.Maps
;
import
com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService
;
...
...
@@ -10,65 +12,177 @@ import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectInitiationEnum;
import
com.yeejoin.amos.boot.module.ugp.api.Util.CommonResponse
;
import
com.yeejoin.amos.boot.module.ugp.api.Util.HttpUtil
;
import
com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant
;
import
com.yeejoin.amos.boot.module.ugp.api.dto.ProjectInitiationDto
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.InstallNoticeMsg
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.ProjectInitiation
;
import
com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule
;
import
com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectInitiationMapper
;
import
com.yeejoin.amos.boot.module.ugp.api.service.IProjectInitiationService
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.client.AgencyUserClient
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.rule.model.IdxProjectModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.SmsRecordModel
;
import
com.yeejoin.amos.feign.workflow.Workflow
;
import
com.yeejoin.amos.feign.workflow.client.TaskClient
;
import
com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO
;
import
com.yeejoin.amos.feign.workflow.model.AjaxResult
;
import
com.yeejoin.amos.feign.workflow.model.TaskResultDTO
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.
Map
;
import
java.util.
*
;
@Service
public
class
ProjectInitiationServiceImpl
{
public
class
ProjectInitiationServiceImpl
extends
BaseService
<
ProjectInitiationDto
,
ProjectInitiation
,
ProjectInitiationMapper
>
implements
IProjectInitiationService
{
@Autowired
WorkflowExcuteServiceImpl
workflowExcuteService
;
@Autowired
WorkflowFeignService
workflowFeignService
;
@Autowired
InstallNoticeMsgServiceImpl
installNoticeMsgService
;
@Autowired
ProjectServiceImpl
projectServiceImpl
;
@Autowired
SuperviseRuleServiceImpl
superviseRuleServiceImpl
;
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ProjectInitiationServiceImpl
.
class
);
@Value
(
"${params.work.flow.processDefinitionKey}"
)
private
String
processDefinitionKey
;
public
ResponseModel
start
()
throws
Exception
{
String
instanceId
=
workflowExcuteService
.
startAndComplete
(
processDefinitionKey
,
null
);
JSONObject
jsonObject
=
workflowFeignService
.
getTask
(
instanceId
);
// workflowFeignService.completeByVariable(,)
return
CommonResponseUtil
.
success
();
private
static
String
SMSCODE
=
"SMS_UGP_0001"
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
start
(
Object
objectd
)
{
String
instanceId
=
null
;
try
{
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
processDefinitionKey
);
dto
.
setBusinessKey
(
"1"
);
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
startByVariable
(
dto
);
instanceId
=
((
Map
)
ajaxResult
.
get
(
"data"
)).
get
(
"id"
).
toString
();
ProjectInitiation
projectInitiation
=
new
ProjectInitiation
();
projectInitiation
.
setInstanceId
(
instanceId
);
projectInitiation
.
setTaskName
(
"流程启动!"
);
this
.
save
(
projectInitiation
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
out
.
println
(
"流程启动失败:"
+
e
.
getMessage
());
}
//审核条件
String
option
=
"0"
;
if
(
true
)
{
option
=
"1"
;
}
//执行审核流程
execute
(
instanceId
,
objectd
,
option
);
return
instanceId
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
execute
(
String
instanceId
,
Object
objectd
,
String
option
){
JSONObject
object
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
objectd
));
JSONObject
jsonObject
=
workflowFeignService
.
getTask
(
instanceId
);
ProjectInitiation
projectInitiation
=
new
ProjectInitiation
();
projectInitiation
.
setInstanceId
(
instanceId
);
projectInitiation
.
setContext
(
JSON
.
toJSONString
(
objectd
));
JSONObject
dataObject
=
jsonObject
.
getJSONObject
(
"data"
);
projectInitiation
.
setTaskId
(
dataObject
.
getString
(
"id"
));
projectInitiation
.
setTaskName
(
dataObject
.
getString
(
"name"
));
TaskResultDTO
dto
=
new
TaskResultDTO
();
dto
.
setResult
(
option
);
dto
.
setResultCode
(
"condition"
);
dto
.
setTaskId
(
projectInitiation
.
getTaskId
());
HashMap
<
String
,
Object
>
var
=
new
HashMap
<>();
var
.
put
(
"condition"
,
option
);
dto
.
setVariable
(
var
);
if
(
"平台审核"
.
equals
(
dataObject
.
getString
(
"name"
)))
{
System
.
out
.
println
();
}
if
(
"监检员审核"
.
equals
(
dataObject
.
getString
(
"name"
))){
if
(
"1"
.
equals
(
option
)){
projectInitiation
.
setTaskName
(
dataObject
.
getString
(
"name"
)+
"(流程结束!)"
);
}
}
if
(
"接受审查意见"
.
equals
(
dataObject
.
getString
(
"name"
))){
projectInitiation
.
setTaskName
(
dataObject
.
getString
(
"name"
)+
"(流程结束!)"
);
}
if
(
"告知申请"
.
equals
(
dataObject
.
getString
(
"name"
)))
{
if
(!
ValidationUtil
.
isEmpty
(
objectd
))
{
//设置短信发送的基本参数
HashMap
<
String
,
String
>
smsParams
=
new
HashMap
();
smsParams
.
put
(
"smsCode"
,
SMSCODE
);
smsParams
.
put
(
"companyName"
,
object
.
getString
(
"installationUnit"
));
smsParams
.
put
(
"projectName"
,
object
.
getString
(
"name"
));
//条件构造器 通过项目id查出来的项目详情信息中的区域代码,在监管区域规则表中拿到详细信息中的监察部门id,在使用监察部门id查找到该部门下的用户List。
QueryWrapper
<
SuperviseRule
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"admin_region_code"
,
projectServiceImpl
.
getById
(
object
.
getLong
(
"projectId"
)).
getInstallRegionCode
());
List
<
AgencyUserModel
>
agencyUserModelList
=
Privilege
.
agencyUserClient
.
queryByDepartmentId
(
superviseRuleServiceImpl
.
getOne
(
wrapper
).
getSuperviseDeptId
(),
null
,
null
,
null
).
getResult
();
//遍历用户List,拿到用户手机号、userId,来发短信、存短信日志。
for
(
AgencyUserModel
agencyUserModel
:
agencyUserModelList
)
{
SmsRecordModel
smsRecordModel
=
sendSmsMassage
(
SMSCODE
,
agencyUserModel
.
getMobile
(),
smsParams
);
InstallNoticeMsg
installNoticeMsg
=
new
InstallNoticeMsg
();
if
(
ValidationUtil
.
isEmpty
(
smsRecordModel
))
{
continue
;
}
installNoticeMsg
.
setContent
(
smsRecordModel
.
getSmsContent
());
installNoticeMsg
.
setInstallNoticeId
(
smsRecordModel
.
getSequenceNbr
());
installNoticeMsg
.
setTargetUnitId
(
Long
.
valueOf
(
smsRecordModel
.
getAgencyCode
()));
installNoticeMsg
.
setTargetPersonId
(
Long
.
valueOf
(
agencyUserModel
.
getUserId
()));
installNoticeMsg
.
setSendTime
(
smsRecordModel
.
getSendTime
());
installNoticeMsgService
.
save
(
installNoticeMsg
);
}
}
}
if
(
"监检科室分配"
.
equals
(
dataObject
.
getString
(
"name"
)))
{
}
if
(
"监检员分配"
.
equals
(
dataObject
.
getString
(
"name"
)))
{
}
if
(
"监检员审核"
.
equals
(
dataObject
.
getString
(
"name"
)))
{
// public JSONObject startNew(String processDefinitionKey) {
// String url = buildUrl(address, ProjectInitiationEnum.合并启动流程, null);
// Map<String, String> headerMap = Maps.newHashMap();
// headerMap.put(XJConstant.TOKEN_KEY, RequestContext.getToken());
// headerMap.put(XJConstant.PRODUCT, RequestContext.getProduct());
// headerMap.put(XJConstant.APPKEY, RequestContext.getAppKey());
// JSONObject body = new JSONObject();
// body.put("processDefinitionKey", processDefinitionKey);
// String resultStr = HttpUtil.sendHttpPostJsonWithHeader(url, body.toJSONString(), headerMap);
// logger.info("\r\n请求路径=======================>" + url + "\r\n请求参数=======================>" + body + "\r\n返回参数=======================>" + resultStr);
// return JSON.parseObject(resultStr);
// }
//
// private String buildUrl(String address, ProjectInitiationEnum projectInitiationEnum, Map<String, String> map) {
// String uri = projectInitiationEnum.getUri();
// String params = projectInitiationEnum.getParams();
// if (!StringUtils.isEmpty(params) && map != null) {
// String[] paramsArr = params.split(",");
// for (String param : paramsArr) {
// uri = uri.replace("{" + param + "}", map.get(param));
// }
// }
// return address + uri;
// }
}
try
{
Workflow
.
taskClient
.
completeByTask
(
projectInitiation
.
getTaskId
(),
dto
);
this
.
save
(
projectInitiation
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
out
.
println
(
"任务完成失败:"
+
e
.
getMessage
());
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
SmsRecordModel
sendSmsMassage
(
String
smsCode
,
String
mobile
,
HashMap
<
String
,
String
>
smsParams
){
SmsRecordModel
smsRecordModel
=
new
SmsRecordModel
();
if
(!
ValidationUtil
.
isEmpty
(
mobile
)){
smsParams
.
put
(
"smsCode"
,
smsCode
);
smsParams
.
put
(
"mobile"
,
mobile
);
smsRecordModel
=
Systemctl
.
smsClient
.
sendCommonSms
(
smsParams
).
getResult
();
}
return
smsRecordModel
;
}
}
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/resources/application.properties
View file @
2b72e92e
...
...
@@ -29,4 +29,4 @@ emqx.password=123456
fire-rescue
=
123
params.work.flow.processDefinitionKey
=
ceshi
\ No newline at end of file
params.work.flow.processDefinitionKey
=
xiangmulixiangliucheng
\ No newline at end of file
amos-boot-system-ugp/pom.xml
View file @
2b72e92e
...
...
@@ -19,6 +19,11 @@
<artifactId>
amos-boot-biz-common
</artifactId>
<version>
${amos-biz-boot.version}
</version>
</dependency>
<dependency>
<groupId>
com.yeejoin
</groupId>
<artifactId>
amos-feign-workflow
</artifactId>
<version>
1.7.9-SNAPSHOT
</version>
</dependency>
</dependencies>
</project>
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