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
4548321e
Commit
4548321e
authored
Nov 17, 2021
by
kongfm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新FLC相关代码
parent
182fe054
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
947 additions
and
173 deletions
+947
-173
DataDictionaryController.java
.../boot/biz/common/controller/DataDictionaryController.java
+25
-0
RedisKey.java
...java/com/yeejoin/amos/boot/biz/common/utils/RedisKey.java
+3
-0
TzsCommonParam.java
...eejoin/amos/boot/module/tzs/api/enums/TzsCommonParam.java
+7
-0
UnitInfoChangeDto.java
...n/amos/boot/module/tzs/flc/api/dto/UnitInfoChangeDto.java
+3
-0
UnitInfoDto.java
...yeejoin/amos/boot/module/tzs/flc/api/dto/UnitInfoDto.java
+36
-4
UnitInfo.java
...yeejoin/amos/boot/module/tzs/flc/api/entity/UnitInfo.java
+21
-8
UnitInfoChange.java
...n/amos/boot/module/tzs/flc/api/entity/UnitInfoChange.java
+14
-8
IUnitInfoService.java
...mos/boot/module/tzs/flc/api/service/IUnitInfoService.java
+11
-0
TzsAuthServiceImpl.java
.../boot/module/tzs/biz/service/impl/TzsAuthServiceImpl.java
+112
-44
VoiceRecordLogServiceImpl.java
...odule/tzs/biz/service/impl/VoiceRecordLogServiceImpl.java
+5
-25
BeanDtoVoUtils.java
...eejoin/amos/boot/module/tzs/biz/utils/BeanDtoVoUtils.java
+35
-0
UnitInfoApproveController.java
...ule/tzs/flc/biz/controller/UnitInfoApproveController.java
+9
-24
UnitInfoController.java
...oot/module/tzs/flc/biz/controller/UnitInfoController.java
+304
-49
UnitInfoServiceImpl.java
.../module/tzs/flc/biz/service/impl/UnitInfoServiceImpl.java
+357
-11
application-dev.properties
...-system-tzs/src/main/resources/application-dev.properties
+3
-0
application-qa.properties
...t-system-tzs/src/main/resources/application-qa.properties
+2
-0
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/controller/DataDictionaryController.java
View file @
4548321e
...
@@ -349,4 +349,29 @@ public class DataDictionaryController extends BaseController {
...
@@ -349,4 +349,29 @@ public class DataDictionaryController extends BaseController {
return
ResponseHelper
.
buildResponse
(
type
);
return
ResponseHelper
.
buildResponse
(
type
);
}
}
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/gwmcDataDictionaryNotoken/{type}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据字典类型查询字典不验证token"
,
notes
=
"根据字典类型查询字典不验证token"
)
public
ResponseModel
<
Object
>
gwmcDataDictionaryNotoken
(
@PathVariable
String
type
)
throws
Exception
{
// 数据字典生成树方法 原先通过getCode做主键 现修改为 getSequenceNbr 后期数据字典parent字段保存id 而不要保存code by
// kongfm 2021-09-08
// 数据字典还原 by kongfm 2021-09-09
QueryWrapper
<
DataDictionary
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
type
);
queryWrapper
.
orderByAsc
(
"sort_num"
);
if
(
redisUtils
.
hasKey
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
);
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
Menu
>
menus
=
TreeParser
.
getTree
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
,
null
);
redisUtils
.
set
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
,
JSON
.
toJSON
(
menus
),
time
);
return
ResponseHelper
.
buildResponse
(
menus
);
}
}
}
}
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/RedisKey.java
View file @
4548321e
...
@@ -40,6 +40,9 @@ public class RedisKey {
...
@@ -40,6 +40,9 @@ public class RedisKey {
/**联通CTIuser token */
/**联通CTIuser token */
public
static
final
String
CTI_USER_TOKEN
=
"cti_user_token"
;
public
static
final
String
CTI_USER_TOKEN
=
"cti_user_token"
;
/** 企业用户注册前缀 */
public
static
final
String
FLC_USER_TEL
=
"flc_tel_"
;
/** 驼峰转下划线(简单写法,效率低于 ) */
/** 驼峰转下划线(简单写法,效率低于 ) */
public
static
String
humpToLine
(
String
str
)
{
public
static
String
humpToLine
(
String
str
)
{
return
str
.
replaceAll
(
"[A-Z]"
,
"_$0"
).
toLowerCase
();
return
str
.
replaceAll
(
"[A-Z]"
,
"_$0"
).
toLowerCase
();
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/enums/TzsCommonParam.java
View file @
4548321e
...
@@ -37,4 +37,11 @@ public class TzsCommonParam {
...
@@ -37,4 +37,11 @@ public class TzsCommonParam {
public
static
final
String
APPJJ
=
"APPJJ"
;
public
static
final
String
APPJJ
=
"APPJJ"
;
public
static
final
String
DD
=
"DD"
;
public
static
final
String
DD
=
"DD"
;
public
static
final
String
JC
=
"JC"
;
public
static
final
String
JC
=
"JC"
;
public
static
final
String
LICENCE_PIC
=
"licencePic"
;
public
static
final
String
ADMIN_LICENSE_PIC
=
"adminLicensePic"
;
public
static
final
String
QR_CODE
=
"qrCode"
;
public
static
final
String
UNIT_TYPE
=
"UNIT_TYPE"
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/dto/UnitInfoChangeDto.java
View file @
4548321e
...
@@ -36,6 +36,9 @@ public class UnitInfoChangeDto extends BaseDto {
...
@@ -36,6 +36,9 @@ public class UnitInfoChangeDto extends BaseDto {
@ApiModelProperty
(
value
=
"单位类型code"
)
@ApiModelProperty
(
value
=
"单位类型code"
)
private
String
unitTypeCode
;
private
String
unitTypeCode
;
@ApiModelProperty
(
value
=
"组织机构编码"
)
private
String
organizationCode
;
@ApiModelProperty
(
value
=
"主管部门"
)
@ApiModelProperty
(
value
=
"主管部门"
)
private
String
comptentDept
;
private
String
comptentDept
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/dto/UnitInfoDto.java
View file @
4548321e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
dto
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
dto
;
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.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* 企业信息表
* 企业信息表
...
@@ -25,10 +28,13 @@ public class UnitInfoDto extends BaseDto {
...
@@ -25,10 +28,13 @@ public class UnitInfoDto extends BaseDto {
private
String
orgName
;
private
String
orgName
;
@ApiModelProperty
(
value
=
"证照类型"
)
@ApiModelProperty
(
value
=
"证照类型"
)
private
String
licen
s
eType
;
private
String
licen
c
eType
;
@ApiModelProperty
(
value
=
"证照类型code"
)
@ApiModelProperty
(
value
=
"证照类型code"
)
private
String
licenseTypeCode
;
private
String
licenceTypeCode
;
@ApiModelProperty
(
value
=
"组织机构编码"
)
private
String
organizationCode
;
@ApiModelProperty
(
value
=
"单位类型"
)
@ApiModelProperty
(
value
=
"单位类型"
)
private
String
unitType
;
private
String
unitType
;
...
@@ -94,10 +100,10 @@ public class UnitInfoDto extends BaseDto {
...
@@ -94,10 +100,10 @@ public class UnitInfoDto extends BaseDto {
private
Date
createTime
;
private
Date
createTime
;
@ApiModelProperty
(
value
=
"单位法人"
)
@ApiModelProperty
(
value
=
"单位法人"
)
private
String
leg
e
lPerson
;
private
String
leg
a
lPerson
;
@ApiModelProperty
(
value
=
"法人电话"
)
@ApiModelProperty
(
value
=
"法人电话"
)
private
String
leg
e
lPersonTel
;
private
String
leg
a
lPersonTel
;
@ApiModelProperty
(
value
=
"单位联系人"
)
@ApiModelProperty
(
value
=
"单位联系人"
)
private
String
contactPerson
;
private
String
contactPerson
;
...
@@ -126,4 +132,30 @@ public class UnitInfoDto extends BaseDto {
...
@@ -126,4 +132,30 @@ public class UnitInfoDto extends BaseDto {
@ApiModelProperty
(
value
=
"审批状态 0 审批中 1 审批结束 2 驳回"
)
@ApiModelProperty
(
value
=
"审批状态 0 审批中 1 审批结束 2 驳回"
)
private
Integer
unitStatus
;
private
Integer
unitStatus
;
@ApiModelProperty
(
value
=
"证照图片"
)
private
List
<
AttachmentDto
>
licencePic
;
@ApiModelProperty
(
value
=
"管理员身份证"
)
private
List
<
AttachmentDto
>
adminLicensePic
;
@ApiModelProperty
(
value
=
"是否变更 0 未变更 1 变更中"
)
private
Boolean
isChange
;
@ApiModelProperty
(
value
=
"提交时间开始"
)
private
Date
submitTimeStart
;
@ApiModelProperty
(
value
=
"接警时间结束"
)
private
Date
submitTimeEnd
;
@ApiModelProperty
(
value
=
"分类名称"
)
private
String
typeStr
;
@ApiModelProperty
(
value
=
"状态名称"
)
private
String
statusStr
;
@ApiModelProperty
(
value
=
"企业二维码"
)
private
List
<
AttachmentDto
>
qrcode
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/entity/UnitInfo.java
View file @
4548321e
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.entity;
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.entity;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
...
@@ -31,14 +32,20 @@ public class UnitInfo extends BaseEntity {
...
@@ -31,14 +32,20 @@ public class UnitInfo extends BaseEntity {
/**
/**
* 证照类型
* 证照类型
*/
*/
@TableField
(
"licen
s
e_type"
)
@TableField
(
"licen
c
e_type"
)
private
String
licen
s
eType
;
private
String
licen
c
eType
;
/**
/**
* 证照类型code
* 证照类型code
*/
*/
@TableField
(
"license_type_code"
)
@TableField
(
"licence_type_code"
)
private
String
licenseTypeCode
;
private
String
licenceTypeCode
;
/**
* 组织机构编码
*/
@TableField
(
"organization_code"
)
private
String
organizationCode
;
/**
/**
* 单位类型
* 单位类型
...
@@ -169,14 +176,14 @@ public class UnitInfo extends BaseEntity {
...
@@ -169,14 +176,14 @@ public class UnitInfo extends BaseEntity {
/**
/**
* 单位法人
* 单位法人
*/
*/
@TableField
(
"leg
e
l_person"
)
@TableField
(
"leg
a
l_person"
)
private
String
leg
e
lPerson
;
private
String
leg
a
lPerson
;
/**
/**
* 法人电话
* 法人电话
*/
*/
@TableField
(
"leg
e
l_person_tel"
)
@TableField
(
"leg
a
l_person_tel"
)
private
String
leg
e
lPersonTel
;
private
String
leg
a
lPersonTel
;
/**
/**
* 单位联系人
* 单位联系人
...
@@ -232,4 +239,10 @@ public class UnitInfo extends BaseEntity {
...
@@ -232,4 +239,10 @@ public class UnitInfo extends BaseEntity {
@TableField
(
"unit_status"
)
@TableField
(
"unit_status"
)
private
Integer
unitStatus
;
private
Integer
unitStatus
;
/**
* 是否变更 0 未变更 1 变更中
*/
@TableField
(
value
=
"is_change"
)
private
Boolean
isChange
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/entity/UnitInfoChange.java
View file @
4548321e
...
@@ -31,14 +31,20 @@ public class UnitInfoChange extends BaseEntity {
...
@@ -31,14 +31,20 @@ public class UnitInfoChange extends BaseEntity {
/**
/**
* 证照类型
* 证照类型
*/
*/
@TableField
(
"licen
s
e_type"
)
@TableField
(
"licen
c
e_type"
)
private
String
licen
s
eType
;
private
String
licen
c
eType
;
/**
/**
* 证照类型code
* 证照类型code
*/
*/
@TableField
(
"license_type_code"
)
@TableField
(
"licence_type_code"
)
private
String
licenseTypeCode
;
private
String
licenceTypeCode
;
/**
* 组织机构编码
*/
@TableField
(
"organization_code"
)
private
String
organizationCode
;
/**
/**
* 单位类型
* 单位类型
...
@@ -169,14 +175,14 @@ public class UnitInfoChange extends BaseEntity {
...
@@ -169,14 +175,14 @@ public class UnitInfoChange extends BaseEntity {
/**
/**
* 单位法人
* 单位法人
*/
*/
@TableField
(
"leg
e
l_person"
)
@TableField
(
"leg
a
l_person"
)
private
String
leg
e
lPerson
;
private
String
leg
a
lPerson
;
/**
/**
* 法人电话
* 法人电话
*/
*/
@TableField
(
"leg
e
l_person_tel"
)
@TableField
(
"leg
a
l_person_tel"
)
private
String
leg
e
lPersonTel
;
private
String
leg
a
lPersonTel
;
/**
/**
* 单位联系人
* 单位联系人
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/service/IUnitInfoService.java
View file @
4548321e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
service
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
api
.
service
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoApproveDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto
;
/**
/**
* 企业信息表接口类
* 企业信息表接口类
*
*
...
@@ -9,4 +12,12 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.service;
...
@@ -9,4 +12,12 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.service;
*/
*/
public
interface
IUnitInfoService
{
public
interface
IUnitInfoService
{
/**
* 审批企业注册信息
* @param approveDto
* @return
*/
UnitInfoDto
approve
(
UnitInfoApproveDto
approveDto
);
UnitInfoDto
getDtoById
(
Long
sequenceNbr
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/TzsAuthServiceImpl.java
View file @
4548321e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONArray
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.bo.DepartmentBo
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.biz.common.bo.RoleBo
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Maps
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto
;
import
com.yeejoin.amos.boot.module.common.api.service.ISourceFileService
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledObjsDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledRecordDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertHandlerDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertHandlerInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.DutySeatDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.FormValue
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBusinessListDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBussinessDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.DispatchTask
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.Elevator
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.AlertStageEnums
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.DispatchPaperEnums
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.TzsCommonParam
;
import
com.yeejoin.amos.boot.module.tzs.api.mapper.AlertCalledMapper
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IAlertCalledService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.TzsAuthService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.TzsAuthService
;
import
com.yeejoin.amos.
boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.
component.feign.config.TokenOperation
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
import
com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
com.yeejoin.amos.feign.privilege.util.DesUtil
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
/**
/**
* 特种设备权限服务实现类
* 特种设备权限服务实现类
...
@@ -70,6 +39,22 @@ import java.util.stream.Collectors;
...
@@ -70,6 +39,22 @@ import java.util.stream.Collectors;
@Service
@Service
public
class
TzsAuthServiceImpl
implements
TzsAuthService
{
public
class
TzsAuthServiceImpl
implements
TzsAuthService
{
@Autowired
RedisUtils
redisUtils
;
@Value
(
"${cti.user.name}"
)
private
String
ctiUserName
;
@Value
(
"${cti.user.pwd}"
)
private
String
ctiUserPwd
;
/**
* saveUserRedis设置过期时间
*/
@Value
(
"${redis.cache.failure.time}"
)
private
Long
redisRegionTimeSecond
;
@Override
@Override
public
List
<
String
>
getUserRegionCode
()
{
public
List
<
String
>
getUserRegionCode
()
{
...
@@ -154,4 +139,86 @@ public class TzsAuthServiceImpl implements TzsAuthService {
...
@@ -154,4 +139,86 @@ public class TzsAuthServiceImpl implements TzsAuthService {
}
}
}
}
private
void
loginCtiUser
()
{
String
passwd
=
DesUtil
.
encode
(
ctiUserPwd
,
"qaz"
);
IdPasswordAuthModel
loninData
=
new
IdPasswordAuthModel
();
loninData
.
setLoginId
(
ctiUserName
);
loninData
.
setPassword
(
passwd
);
FeignClientResult
loginResult
=
Privilege
.
authClient
.
idpassword
(
loninData
);
if
(
loginResult
.
getStatus
()
==
200
)
{
HashMap
resultMap
=
(
HashMap
)
loginResult
.
getResult
();
redisUtils
.
set
(
RedisKey
.
CTI_USER_TOKEN
,
resultMap
.
get
(
"token"
).
toString
(),
redisRegionTimeSecond
);
}
}
public
void
setRequestContext
()
{
// 需要登录后台账号
RequestContext
.
setAppKey
(
"AMOS_STUDIO"
);
RequestContext
.
setProduct
(
"AMOS_STUDIO_WEB"
);
if
(
redisUtils
.
hasKey
(
RedisKey
.
CTI_USER_TOKEN
))
{
// 验证token
boolean
validToken
=
TokenOperation
.
refresh
(
redisUtils
.
get
(
RedisKey
.
CTI_USER_TOKEN
).
toString
());
if
(!
validToken
)
{
// 登陆
this
.
loginCtiUser
();
}
}
else
{
// 登陆
this
.
loginCtiUser
();
}
String
ctiToken
=
redisUtils
.
get
(
RedisKey
.
CTI_USER_TOKEN
).
toString
();
RequestContext
.
setToken
(
ctiToken
);
try
{
FeignClientResult
<
AgencyUserModel
>
agencyUserModel
=
Privilege
.
agencyUserClient
.
queryByUserName
(
ctiUserName
);
AgencyUserModel
userModel
=
agencyUserModel
.
getResult
();
RequestContext
.
setExeUserId
(
userModel
.
getUserId
());
if
(
userModel
==
null
)
{
throw
new
Exception
(
"无法获取用户信息"
);
}
saveUserRedis
(
userModel
,
ctiToken
);
}
catch
(
Exception
e
)
{
//删除失效token缓存
throw
new
RuntimeException
(
e
.
getMessage
());
}
}
private
void
saveUserRedis
(
AgencyUserModel
user
,
String
token
)
{
String
authToken
=
RedisKey
.
buildReginKey
(
user
.
getUserId
(),
token
);
if
(
redisUtils
.
hasKey
(
authToken
))
{
return
;
}
CompanyBo
company
=
new
CompanyBo
();
DepartmentBo
department
=
new
DepartmentBo
();
RoleBo
role
=
new
RoleBo
();
CompanyModel
companyM
=
user
.
getCompanys
()
!=
null
?
user
.
getCompanys
().
get
(
0
)
:
null
;
Bean
.
copyExistPropertis
(
companyM
,
company
);
Map
<
Long
,
List
<
DepartmentModel
>>
mapDepartments
=
user
.
getCompanyDepartments
();
DepartmentModel
departmentM
=
companyM
!=
null
?
mapDepartments
.
get
(
companyM
.
getSequenceNbr
()).
get
(
0
)
:
null
;
Bean
.
copyExistPropertis
(
departmentM
,
department
);
Map
<
Long
,
List
<
RoleModel
>>
roles
=
user
.
getOrgRoles
();
Long
sequenceNbr
;
if
(
departmentM
==
null
)
{
sequenceNbr
=
null
;
}
else
{
sequenceNbr
=
departmentM
.
getSequenceNbr
();
}
RoleModel
roleM
=
null
;
if
(
sequenceNbr
==
null
)
{
roleM
=
companyM
!=
null
?
roles
.
get
(
companyM
.
getSequenceNbr
()).
get
(
0
)
:
null
;
}
else
{
roleM
=
roles
.
get
(
sequenceNbr
).
get
(
0
);
}
Bean
.
copyExistPropertis
(
roleM
,
role
);
ReginParams
reginParams
=
new
ReginParams
();
reginParams
.
setCompany
(
company
);
reginParams
.
setRole
(
role
);
reginParams
.
setDepartment
(
department
);
reginParams
.
setUserModel
(
user
);
redisUtils
.
set
(
authToken
,
JSONObject
.
toJSONString
(
reginParams
),
redisRegionTimeSecond
);
}
}
}
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/VoiceRecordLogServiceImpl.java
View file @
4548321e
...
@@ -73,22 +73,13 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi
...
@@ -73,22 +73,13 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi
@Autowired
@Autowired
private
VoiceRecordFileServiceImpl
voiceRecordFileServiceImpl
;
private
VoiceRecordFileServiceImpl
voiceRecordFileServiceImpl
;
@Autowired
private
TzsAuthServiceImpl
tzsAuthServiceImpl
;
@Scheduled
(
fixedDelay
=
ONE_Minute
)
@Scheduled
(
fixedDelay
=
ONE_Minute
)
public
void
fixedDelayJob
(){
public
void
fixedDelayJob
(){
// 需要登录后台账号
// 设置token
RequestContext
.
setAppKey
(
"AMOS_STUDIO"
);
tzsAuthServiceImpl
.
setRequestContext
();
RequestContext
.
setProduct
(
"AMOS_STUDIO_WEB"
);
if
(
redisUtils
.
hasKey
(
RedisKey
.
CTI_USER_TOKEN
))
{
// 验证token
boolean
validToken
=
TokenOperation
.
refresh
(
redisUtils
.
get
(
RedisKey
.
CTI_USER_TOKEN
).
toString
());
if
(!
validToken
)
{
// 登陆
loginCtiUser
();
}
}
else
{
// 登陆
loginCtiUser
();
}
String
ctiToken
=
redisUtils
.
get
(
RedisKey
.
CTI_USER_TOKEN
).
toString
();
RequestContext
.
setToken
(
ctiToken
);
// 首先查找未完成 且失败次数少于5 的 记录
// 首先查找未完成 且失败次数少于5 的 记录
List
<
VoiceRecordLog
>
logList
=
this
.
list
(
new
LambdaQueryWrapper
<
VoiceRecordLog
>().
eq
(
VoiceRecordLog:
:
getIsDeal
,
false
).
lt
(
VoiceRecordLog:
:
getDealTimes
,
5
));
List
<
VoiceRecordLog
>
logList
=
this
.
list
(
new
LambdaQueryWrapper
<
VoiceRecordLog
>().
eq
(
VoiceRecordLog:
:
getIsDeal
,
false
).
lt
(
VoiceRecordLog:
:
getDealTimes
,
5
));
if
(
logList
!=
null
&&
logList
.
size
()
>
0
)
{
if
(
logList
!=
null
&&
logList
.
size
()
>
0
)
{
...
@@ -176,17 +167,6 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi
...
@@ -176,17 +167,6 @@ public class VoiceRecordLogServiceImpl extends BaseService<VoiceRecordLogDto,Voi
}
}
private
void
loginCtiUser
()
{
String
passwd
=
DesUtil
.
encode
(
ctiUserPwd
,
"qaz"
);
IdPasswordAuthModel
loninData
=
new
IdPasswordAuthModel
();
loninData
.
setLoginId
(
ctiUserName
);
loninData
.
setPassword
(
passwd
);
FeignClientResult
loginResult
=
Privilege
.
authClient
.
idpassword
(
loninData
);
if
(
loginResult
.
getStatus
()
==
200
)
{
HashMap
resultMap
=
(
HashMap
)
loginResult
.
getResult
();
redisUtils
.
set
(
RedisKey
.
CTI_USER_TOKEN
,
resultMap
.
get
(
"token"
).
toString
(),
25920000
l
);
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/utils/BeanDtoVoUtils.java
View file @
4548321e
...
@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto;
...
@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto;
import
com.yeejoin.amos.boot.module.tzs.api.dto.MaintenanceUnitDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.MaintenanceUnitDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.Elevator
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.Elevator
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.MaintenanceUnit
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.MaintenanceUnit
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -237,4 +239,36 @@ public class BeanDtoVoUtils {
...
@@ -237,4 +239,36 @@ public class BeanDtoVoUtils {
}
}
});
});
}
}
/**
* 将企业注册实体类转换为Vo
*
* @param page 原分页对象
* @return 转换后的分页对象
*/
public
static
IPage
<
UnitInfoDto
>
unitInfoIPageDto
(
IPage
<
UnitInfo
>
page
)
{
return
page
.
convert
(
item
->
{
try
{
UnitInfoDto
target
=
new
UnitInfoDto
();
// 把原对象数据拷贝到新对象
BeanUtils
.
copyProperties
(
item
,
target
);
if
(
item
.
getIsChange
())
{
target
.
setTypeStr
(
"变更"
);
}
else
{
target
.
setTypeStr
(
"注册"
);
}
if
(
0
==
item
.
getUnitStatus
())
{
target
.
setStatusStr
(
"审批中"
);
}
else
if
(
1
==
item
.
getUnitStatus
())
{
target
.
setStatusStr
(
"审批结束"
);
}
else
if
(
2
==
item
.
getUnitStatus
())
{
target
.
setStatusStr
(
"已驳回"
);
}
return
target
;
}
catch
(
Exception
e
)
{
return
null
;
}
});
}
}
}
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/controller/UnitInfoApproveController.java
View file @
4548321e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
controller
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.AlertBeanDtoVoUtils
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoApproveDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoApproveDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.UnitInfoApproveServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.UnitInfoApproveServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
@@ -66,19 +73,6 @@ public class UnitInfoApproveController extends BaseController {
...
@@ -66,19 +73,6 @@ public class UnitInfoApproveController extends BaseController {
}
}
/**
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除企业信息审批意见表"
,
notes
=
"根据sequenceNbr删除企业信息审批意见表"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
unitInfoApproveServiceImpl
.
removeById
(
sequenceNbr
));
}
/**
* 根据sequenceNbr查询
* 根据sequenceNbr查询
*
*
* @param sequenceNbr 主键
* @param sequenceNbr 主键
...
@@ -109,15 +103,6 @@ public class UnitInfoApproveController extends BaseController {
...
@@ -109,15 +103,6 @@ public class UnitInfoApproveController extends BaseController {
return
ResponseHelper
.
buildResponse
(
unitInfoApproveServiceImpl
.
queryForFlcUnitInfoApprovePage
(
page
));
return
ResponseHelper
.
buildResponse
(
unitInfoApproveServiceImpl
.
queryForFlcUnitInfoApprovePage
(
page
));
}
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"企业信息审批意见表列表全部数据查询"
,
notes
=
"企业信息审批意见表列表全部数据查询"
)
@GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<
UnitInfoApproveDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
unitInfoApproveServiceImpl
.
queryForFlcUnitInfoApproveList
());
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/controller/UnitInfoController.java
View file @
4548321e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
controller
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
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.TzsAuthServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoApproveDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo
;
import
io.swagger.annotations.ApiOperation
;
import
com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.UnitInfoServiceImpl
;
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
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
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.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.UnitInfoServiceImpl
;
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.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
java
x.servlet.http.HttpServletRequest
;
import
java
.util.Collection
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.HashMap
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.util.Iterator
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
java.util.Map
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
java.util.Random
;
/**
/**
* 企业信息表
* 企业信息表
...
@@ -29,46 +58,183 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
...
@@ -29,46 +58,183 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
public
class
UnitInfoController
extends
BaseController
{
public
class
UnitInfoController
extends
BaseController
{
@Autowired
@Autowired
RedisUtils
redisUtils
;
/**
* token 过期时间,wechat 系统为7200 ,tzs 系统小于7200 防止获取到无效token
*/
private
long
time
=
600
l
;
@Autowired
UnitInfoServiceImpl
unitInfoServiceImpl
;
UnitInfoServiceImpl
unitInfoServiceImpl
;
@Value
(
"${flc.sms.tempCode}"
)
private
String
smsTempCode
;
@Autowired
private
TzsAuthServiceImpl
tzsAuthServiceImpl
;
/**
/**
* 新增企业信息表
* 获取组织机构树
*
*
* @return
* @return
*/
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@GetMapping
(
value
=
"/region/tree"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增企业信息表"
,
notes
=
"新增企业信息表"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取组织机构树"
,
notes
=
"获取组织机构树"
)
public
ResponseModel
<
UnitInfoDto
>
save
(
@RequestBody
UnitInfoDto
model
)
{
public
ResponseModel
<
Collection
<
RegionModel
>>
getRegionTree
(
@RequestParam
(
value
=
"parentId"
,
required
=
false
)
Long
parentId
)
{
model
=
unitInfoServiceImpl
.
createWithModel
(
model
);
tzsAuthServiceImpl
.
setRequestContext
();
return
ResponseHelper
.
buildResponse
(
model
);
Collection
<
RegionModel
>
result
=
null
;
if
(
parentId
==
null
)
{
result
=
Systemctl
.
regionClient
.
queryForTree
(
null
).
getResult
();
}
else
{
result
=
Systemctl
.
regionClient
.
querySubAgencyTree
(
parentId
).
getResult
();
}
return
ResponseHelper
.
buildResponse
(
result
);
}
}
/**
/**
* 根据sequenceNbr更新
* 获取管辖单位树
*
*
* @param sequenceNbr 主键
* @return
* @return
*/
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/{sequenceNbr}"
)
@GetMapping
(
value
=
"/managerment/tree"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新企业信息表"
,
notes
=
"根据sequenceNbr更新企业信息表"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取管辖单位树"
,
notes
=
"获取管辖单位树"
)
public
ResponseModel
<
UnitInfoDto
>
updateBySequenceNbrFlcUnitInfo
(
@RequestBody
UnitInfoDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
public
ResponseModel
<
Collection
<
CompanyModel
>>
getManagermentTree
()
{
model
.
setSequenceNbr
(
sequenceNbr
);
Collection
<
CompanyModel
>
result
=
null
;
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
updateWithModel
(
model
));
result
=
Privilege
.
companyClient
.
companyTreeWithoutAuth
().
getResult
();
return
ResponseHelper
.
buildResponse
(
result
);
}
}
/**
/**
* 根据sequenceNbr删除
* 企业信息图片上传 无token
*
*
* @param sequenceNbr 主键
* @return
* @return
*/
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
@PostMapping
(
value
=
"/uploadFile"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除企业信息表"
,
notes
=
"根据sequenceNbr删除企业信息表"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"企业信息图片上传 无token"
,
notes
=
"企业信息图片上传 无token"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
){
public
ResponseModel
<
String
>
uploadFile
(
@ApiParam
(
value
=
"文件"
,
required
=
true
)
@RequestParam
MultipartFile
file
)
{
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
removeById
(
sequenceNbr
));
if
(
ValidationUtil
.
isEmpty
(
file
)){
throw
new
BadRequest
(
"参数校验失败."
);
}
tzsAuthServiceImpl
.
setRequestContext
();
FeignClientResult
<
Map
<
String
,
String
>>
date
=
Systemctl
.
fileStorageClient
.
updateCommonFile
(
file
);
String
urlString
=
""
;
if
(
date
!=
null
)
{
Map
<
String
,
String
>
map
=
date
.
getResult
();
Iterator
<
String
>
it
=
map
.
keySet
().
iterator
();
while
(
it
.
hasNext
())
{
urlString
=
it
.
next
();
}
}
return
ResponseHelper
.
buildResponse
(
urlString
);
}
/**
* 判断组织机构是否存在
*
* @return
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/hasExistUnit/{organizationCode}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"判断组织机构是否存在"
,
notes
=
"判断组织机构是否存在"
)
public
ResponseModel
<
Boolean
>
hasExistUnit
(
@PathVariable
(
value
=
"organizationCode"
)
String
organizationCode
)
{
Boolean
flag
=
false
;
UnitInfo
temp
=
unitInfoServiceImpl
.
getOne
(
new
LambdaQueryWrapper
<
UnitInfo
>().
eq
(
UnitInfo:
:
getIsDelete
,
false
).
eq
(
UnitInfo:
:
getOrganizationCode
,
organizationCode
));
if
(
temp
!=
null
)
{
flag
=
true
;
}
return
ResponseHelper
.
buildResponse
(
flag
);
}
/**
* 判断用户是否存在
*
* @return
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/hasExistUser/{userName}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"判断用户是否存在"
,
notes
=
"判断用户是否存在"
)
public
ResponseModel
<
Boolean
>
hasExistUser
(
@PathVariable
(
value
=
"userName"
)
String
userName
)
{
Boolean
flag
=
false
;
AgencyUserModel
user
=
Privilege
.
agencyUserClient
.
queryByUserName
(
userName
).
getResult
();
if
(
user
!=
null
)
{
flag
=
true
;
}
return
ResponseHelper
.
buildResponse
(
flag
);
}
/**
* 发送手机号验证码
*
* @return
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/sendTelCode/{tel}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"发送手机号验证码"
,
notes
=
"发送手机号验证码"
)
public
ResponseModel
<
Boolean
>
sendTelCode
(
@PathVariable
(
value
=
"tel"
)
String
tel
)
{
if
(
ValidationUtil
.
isEmpty
(
tel
))
{
throw
new
BadRequest
(
"参数校验失败."
);
}
Boolean
flag
=
false
;
HashMap
<
String
,
String
>
params
=
new
HashMap
<>();
String
code
=
this
.
getRandomCode
();
params
.
put
(
"code"
,
code
);
params
.
put
(
"mobile"
,
tel
);
params
.
put
(
"smsCode"
,
smsTempCode
);
try
{
Systemctl
.
smsClient
.
sendCommonSms
(
params
).
getResult
();
flag
=
true
;
}
catch
(
Exception
e
)
{
throw
new
BadRequest
(
"发送短信失败:"
+
e
.
getMessage
());
}
// code 保存到缓存中
redisUtils
.
set
(
RedisKey
.
FLC_USER_TEL
+
tel
,
code
,
time
);
return
ResponseHelper
.
buildResponse
(
flag
);
}
/**
* 验证手机号验证码是否成功
*
* @return
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/verifyTelCode/{tel}/{code}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"验证手机号验证码是否成功"
,
notes
=
"验证手机号验证码是否成功"
)
public
ResponseModel
<
Boolean
>
verifyTelCode
(
@PathVariable
(
value
=
"tel"
)
String
tel
,
@PathVariable
(
value
=
"code"
)
String
code
)
{
Boolean
flag
=
false
;
if
(
ValidationUtil
.
isEmpty
(
tel
)
||
ValidationUtil
.
isEmpty
(
code
))
{
throw
new
BadRequest
(
"参数校验失败."
);
}
if
(
redisUtils
.
hasKey
(
RedisKey
.
FLC_USER_TEL
+
tel
))
{
String
redisCode
=
redisUtils
.
get
(
RedisKey
.
FLC_USER_TEL
+
tel
).
toString
();
if
(
code
.
equals
(
redisCode
))
{
flag
=
true
;
}
}
return
ResponseHelper
.
buildResponse
(
flag
);
}
/**
* 新增企业信息表
*
* @return
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增企业信息表"
,
notes
=
"新增企业信息表"
)
public
ResponseModel
<
UnitInfoDto
>
save
(
@RequestBody
UnitInfoDto
model
)
{
model
=
unitInfoServiceImpl
.
saveUnitInfo
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
}
/**
/**
...
@@ -81,36 +247,125 @@ public class UnitInfoController extends BaseController {
...
@@ -81,36 +247,125 @@ public class UnitInfoController extends BaseController {
@GetMapping
(
value
=
"/{sequenceNbr}"
)
@GetMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个企业信息表"
,
notes
=
"根据sequenceNbr查询单个企业信息表"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个企业信息表"
,
notes
=
"根据sequenceNbr查询单个企业信息表"
)
public
ResponseModel
<
UnitInfoDto
>
selectOne
(
@PathVariable
Long
sequenceNbr
)
{
public
ResponseModel
<
UnitInfoDto
>
selectOne
(
@PathVariable
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
queryBySeq
(
sequenceNbr
));
if
(
ValidationUtil
.
isEmpty
(
sequenceNbr
)
)
{
throw
new
BadRequest
(
"参数校验失败."
);
}
}
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
getDtoById
(
sequenceNbr
));
}
/**
/**
* 列表分页查询
* 列表分页查询
*
*
* @param current
当前页
* @param pageNum
当前页
* @param current
每页大小
* @param pageSize
每页大小
* @return
* @return
*/
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@GetMapping
(
value
=
"/list"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"企业信息表分页查询"
,
notes
=
"企业信息表分页查询"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"企业审核列表查询"
,
notes
=
"企业审核列表查询"
)
public
ResponseModel
<
Page
<
UnitInfoDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
public
ResponseModel
<
IPage
<
UnitInfoDto
>>
queryForPage
(
String
pageNum
,
String
pageSize
,
String
sort
,
UnitInfoDto
unitInfoDto
)
{
(
value
=
"size"
)
int
size
)
{
// UnitInfo unitInfo = BeanDtoVoUtils.convert(unitInfoDto, UnitInfo.class);
Page
<
UnitInfoDto
>
page
=
new
Page
<
UnitInfoDto
>();
Page
<
UnitInfo
>
pageBean
;
page
.
setCurrent
(
current
);
IPage
<
UnitInfo
>
page
;
page
.
setSize
(
size
);
QueryWrapper
<
UnitInfo
>
unitInfoQueryWrapper
=
new
QueryWrapper
<
UnitInfo
>();
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
queryForFlcUnitInfoPage
(
page
));
setQueryWrapper
(
unitInfoQueryWrapper
,
unitInfoDto
,
sort
);
if
(
StringUtils
.
isBlank
(
pageNum
)
||
StringUtils
.
isBlank
(
pageSize
))
{
pageBean
=
new
Page
<>(
0
,
Long
.
MAX_VALUE
);
}
else
{
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
unitInfoServiceImpl
.
page
(
pageBean
,
unitInfoQueryWrapper
);
int
num
=
unitInfoServiceImpl
.
count
(
unitInfoQueryWrapper
);
pageBean
.
setTotal
(
num
);
IPage
<
UnitInfoDto
>
unitInfoVoIPage
=
BeanDtoVoUtils
.
unitInfoIPageDto
(
page
);
return
ResponseHelper
.
buildResponse
(
unitInfoVoIPage
);
}
private
QueryWrapper
<
UnitInfo
>
setQueryWrapper
(
QueryWrapper
<
UnitInfo
>
queryWrapper
,
UnitInfoDto
unitInfoDto
,
String
sort
)
{
queryWrapper
.
eq
(
"is_delete"
,
false
);
if
(
sort
!=
null
)
{
// 排序失效
String
[]
date
=
sort
.
split
(
","
);
if
(
date
[
1
].
equals
(
"ascend"
))
{
queryWrapper
.
orderByAsc
(
RedisKey
.
humpToLine
(
date
[
0
]));
}
else
{
queryWrapper
.
orderByDesc
(
RedisKey
.
humpToLine
(
date
[
0
]));
}
}
else
{
queryWrapper
.
orderByDesc
(
"rec_date"
);
}
}
if
(!
ValidationUtil
.
isEmpty
(
unitInfoDto
.
getIsChange
()))
{
// 分类 注册 / 信息变更 0 注册 1 变更
queryWrapper
.
eq
(
"is_change"
,
unitInfoDto
.
getIsChange
());
}
if
(!
ValidationUtil
.
isEmpty
(
unitInfoDto
.
getSubmitTimeStart
()))
{
// 提交时间
queryWrapper
.
ge
(
"rec_date"
,
unitInfoDto
.
getSubmitTimeStart
());
}
if
(!
ValidationUtil
.
isEmpty
(
unitInfoDto
.
getSubmitTimeEnd
()))
{
// 提交时间
queryWrapper
.
le
(
"rec_date"
,
unitInfoDto
.
getSubmitTimeEnd
());
}
if
(!
ValidationUtil
.
isEmpty
(
unitInfoDto
.
getUnitTypeCode
()))
{
// 单位类型
queryWrapper
.
like
(
"unit_type_code"
,
unitInfoDto
.
getUnitTypeCode
());
}
if
(!
ValidationUtil
.
isEmpty
(
unitInfoDto
.
getOrgName
()))
{
// 单位名称
queryWrapper
.
like
(
"org_name"
,
unitInfoDto
.
getOrgName
());
}
if
(!
ValidationUtil
.
isEmpty
(
unitInfoDto
.
getOrganizationCode
()))
{
// 组织机构代码/统一信用代码
queryWrapper
.
like
(
"organization_code"
,
unitInfoDto
.
getOrganizationCode
());
}
if
(!
ValidationUtil
.
isEmpty
(
unitInfoDto
.
getAdminName
()))
{
// 管理员
queryWrapper
.
like
(
"admin_name"
,
unitInfoDto
.
getAdminName
());
}
if
(!
ValidationUtil
.
isEmpty
(
unitInfoDto
.
getAdminTel
()))
{
// 管理员电话
queryWrapper
.
like
(
"admin_tel"
,
unitInfoDto
.
getAdminTel
());
}
if
(!
ValidationUtil
.
isEmpty
(
unitInfoDto
.
getUnitStatus
()))
{
// 审核状态
queryWrapper
.
like
(
"unit_status"
,
unitInfoDto
.
getUnitStatus
());
}
return
queryWrapper
;
}
private
String
getRandomCode
(){
String
code
=
""
;
Random
random
=
new
Random
();
for
(
int
i
=
0
;
i
<
6
;
i
++)
{
int
r
=
random
.
nextInt
(
10
);
//每次随机出一个数字(0-9)
code
=
code
+
r
;
//把每次随机出的数字拼在一起
}
return
code
;
}
/**
/**
*
列表全部数据查询
*
审批企业注册
*
*
* @return
* @return
*/
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"企业信息表列表全部数据查询"
,
notes
=
"企业信息表列表全部数据查询"
)
@PostMapping
(
value
=
"/approve"
)
@GetMapping
(
value
=
"/list"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"审批企业注册"
,
notes
=
"审批企业注册"
)
public
ResponseModel
<
List
<
UnitInfoDto
>>
selectForList
()
{
public
ResponseModel
<
UnitInfoDto
>
approve
(
@RequestBody
UnitInfoApproveDto
approveDto
)
{
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
queryForFlcUnitInfoList
());
if
(
ValidationUtil
.
isEmpty
(
approveDto
.
getUnitId
())
||
ValidationUtil
.
isEmpty
(
approveDto
.
getApproveStatus
()))
{
throw
new
BadRequest
(
"参数校验失败."
);
}
UnitInfoDto
model
=
unitInfoServiceImpl
.
approve
(
approveDto
);
return
ResponseHelper
.
buildResponse
(
model
);
}
}
}
}
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/UnitInfoServiceImpl.java
View file @
4548321e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
flc
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.constants.CommonConstant
;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.utils.QRCodeUtil
;
import
com.yeejoin.amos.boot.biz.common.utils.TreeParser
;
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.api.service.ISourceFileService
;
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.api.enums.TzsCommonParam
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzsAuthServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoApproveDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfoChange
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.mapper.UnitInfoMapper
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.mapper.UnitInfoMapper
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.service.IUnitInfoService
;
import
com.yeejoin.amos.boot.module.tzs.flc.api.service.IUnitInfoService
;
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.privilege.model.RoleModel
;
import
com.yeejoin.amos.feign.privilege.util.DesUtil
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.mock.web.MockMultipartFile
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/**
/**
* 企业信息表服务实现类
* 企业信息表服务实现类
...
@@ -18,17 +54,326 @@ import java.util.List;
...
@@ -18,17 +54,326 @@ import java.util.List;
*/
*/
@Service
@Service
public
class
UnitInfoServiceImpl
extends
BaseService
<
UnitInfoDto
,
UnitInfo
,
UnitInfoMapper
>
implements
IUnitInfoService
{
public
class
UnitInfoServiceImpl
extends
BaseService
<
UnitInfoDto
,
UnitInfo
,
UnitInfoMapper
>
implements
IUnitInfoService
{
/**
* 分页查询
private
final
Logger
logger
=
LogManager
.
getLogger
(
UnitInfoServiceImpl
.
class
);
*/
public
Page
<
UnitInfoDto
>
queryForFlcUnitInfoPage
(
Page
<
UnitInfoDto
>
page
)
{
@Autowired
return
this
.
queryForPage
(
page
,
null
,
false
);
private
TzsAuthServiceImpl
tzsAuthServiceImpl
;
@Autowired
ISourceFileService
ISourceFileService
;
@Autowired
DataDictionaryServiceImpl
iDataDictionaryService
;
@Autowired
UnitInfoChangeServiceImpl
iUnitInfoChangeServiceImpl
;
@Autowired
UnitInfoApproveServiceImpl
iUnitInfoApproveServiceImpl
;
@Autowired
OrgUsrServiceImpl
iOrgUsrService
;
@Autowired
UnitInfoChangeServiceImpl
unitInfoChangeServiceImpl
;
@Autowired
SourceFileServiceImpl
sourceFileService
;
@Transactional
public
UnitInfoDto
saveUnitInfo
(
UnitInfoDto
model
)
{
tzsAuthServiceImpl
.
setRequestContext
();
model
.
setUnitStatus
(
0
);
// 设置为待审核状态
model
.
setIsChange
(
false
);
// 新增状态不是变更状态
// 处理单位类型
String
unitTypeCode
=
model
.
getUnitTypeCode
();
String
[]
unitTypeCodes
=
unitTypeCode
.
split
(
","
);
String
unitType
=
""
;
for
(
String
t
:
unitTypeCodes
)
{
LambdaQueryWrapper
<
DataDictionary
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
DataDictionary:
:
getType
,
TzsCommonParam
.
UNIT_TYPE
).
eq
(
DataDictionary:
:
getCode
,
t
);
DataDictionary
temp
=
iDataDictionaryService
.
getOne
(
queryWrapper
);
unitType
+=
","
+
temp
.
getName
();
}
if
(
unitType
.
length
()
>
0
)
{
unitType
=
unitType
.
substring
(
1
);
model
.
setUnitType
(
unitType
);
}
}
/**
// 处理密码信息
* 列表查询 示例
String
oldPwd
=
model
.
getAdminLoginPwd
();
*/
String
newPwd
=
DesUtil
.
encode
(
oldPwd
,
"qaz"
);
public
List
<
UnitInfoDto
>
queryForFlcUnitInfoList
()
{
model
.
setAdminLoginPwd
(
newPwd
);
return
this
.
queryForList
(
""
,
false
);
UnitInfo
entity
=
this
.
prepareEntity
(
model
);
if
(
this
.
save
(
entity
))
{
// 处理图片信息
Map
<
String
,
List
<
AttachmentDto
>>
resultPicMap
=
new
HashMap
<>();
resultPicMap
.
put
(
TzsCommonParam
.
LICENCE_PIC
,
model
.
getLicencePic
());
resultPicMap
.
put
(
TzsCommonParam
.
ADMIN_LICENSE_PIC
,
model
.
getAdminLicensePic
());
ISourceFileService
.
saveAttachments
(
entity
.
getSequenceNbr
(),
resultPicMap
);
}
return
Bean
.
toModel
(
entity
,
model
);
}
@Transactional
@Override
public
UnitInfoDto
approve
(
UnitInfoApproveDto
approveDto
)
{
UnitInfoDto
result
=
null
;
// 如果不存在审批意见 则 默认 通过 / 驳回
// 通过unitid 查找企业信息表 如果不存在则查找 变更表 都不存在返回未找到企业审核表单
String
content
=
approveDto
.
getContent
();
// 审批意见
UnitInfo
sourceUnit
=
this
.
getById
(
approveDto
.
getUnitId
());
UnitInfoChange
changeUnit
=
null
;
if
(
sourceUnit
==
null
)
{
changeUnit
=
iUnitInfoChangeServiceImpl
.
getById
(
approveDto
.
getUnitId
());
if
(
changeUnit
==
null
)
{
throw
new
BadRequest
(
"未找到企业审核表单."
);
}
sourceUnit
=
this
.
getById
(
changeUnit
.
getSourceId
());
}
if
(
sourceUnit
.
getUnitStatus
()
!=
0
)
{
// 无论变更单还是新建单 原始单状态都应该为审核中
throw
new
BadRequest
(
"表单未处于审核状态中.请确认后操作"
);
}
Integer
approveStatus
=
approveDto
.
getApproveStatus
();
// 0通过 1驳回
Boolean
changeFlag
=
false
;
if
(
changeUnit
!=
null
)
{
changeFlag
=
true
;
approveDto
.
setUnitId
(
changeUnit
.
getSequenceNbr
());
approveDto
.
setApproveType
(
1
);
// 0 注册审批 1 变更审批
}
else
{
approveDto
.
setApproveType
(
0
);
// 0 注册审批 1 变更审批
}
approveDto
.
setSourceId
(
sourceUnit
.
getSequenceNbr
());
if
(
0
==
approveStatus
)
{
// 审核通过生成二维码
this
.
saveUnitInfoQrCode
(
sourceUnit
);
if
(
StringUtils
.
isEmpty
(
content
))
{
content
=
"通过"
;
}
sourceUnit
.
setUnitStatus
(
1
);
if
(
changeFlag
)
{
// 如果是变更单 需要把 变更数据覆盖到原单子 预留(确定字段)
}
else
{
// 如果是审批单 创建用户 创建组织机构 赋权等
// 创建用户 创建组织机构 平台组织机构及 org_user表中 赋权
String
adminUserName
=
sourceUnit
.
getAdminName
();
String
loginName
=
sourceUnit
.
getAdminLoginName
();
String
pwd
=
sourceUnit
.
getAdminLoginPwd
();
String
adminTel
=
sourceUnit
.
getAdminTel
();
CompanyModel
companyInfo
=
new
CompanyModel
();
companyInfo
.
setAddress
(
sourceUnit
.
getProvince
()
+
sourceUnit
.
getCity
()
+
sourceUnit
.
getDistrict
()
+
sourceUnit
.
getStree
()
+
sourceUnit
.
getCommunity
()
+
sourceUnit
.
getAddress
());
companyInfo
.
setAgencyCode
(
"tzs"
);
companyInfo
.
setParentId
(
sourceUnit
.
getManagementUnitId
());
companyInfo
.
setLevel
(
"headquarter"
);
companyInfo
.
setCompanyName
(
sourceUnit
.
getOrgName
());
companyInfo
.
setContact
(
sourceUnit
.
getUnitTel
());
FeignClientResult
<
CompanyModel
>
companyResult
=
Privilege
.
companyClient
.
create
(
companyInfo
);
if
(
companyResult
==
null
||
companyResult
.
getResult
()
==
null
)
{
throw
new
BadRequest
(
"单位注册失败"
);
}
companyInfo
=
companyResult
.
getResult
();
AgencyUserModel
agencyUserModel
=
new
AgencyUserModel
();
agencyUserModel
.
setUserName
(
loginName
);
agencyUserModel
.
setRealName
(
adminUserName
);
agencyUserModel
.
setLockStatus
(
"UNLOCK"
);
agencyUserModel
.
setPassword
(
pwd
);
agencyUserModel
.
setRePassword
(
pwd
);
agencyUserModel
.
setAgencyCode
(
"tzs"
);
agencyUserModel
.
setMobile
(
adminTel
);
// 根据unitTypeCode 获取应用和 角色
String
unitTypeCode
=
sourceUnit
.
getUnitTypeCode
();
String
[]
unitTypeCodes
=
unitTypeCode
.
split
(
","
);
Set
<
String
>
roleNameSet
=
new
HashSet
<>();
Set
<
String
>
appCodesSet
=
new
HashSet
<>();
Map
<
Long
,
List
<
Long
>>
roleSeqsMap
=
new
HashMap
<>();
for
(
String
code
:
unitTypeCodes
)
{
DataDictionary
unitType
=
iDataDictionaryService
.
getOne
(
new
LambdaQueryWrapper
<
DataDictionary
>().
eq
(
DataDictionary:
:
getCode
,
code
));
String
appCode
=
unitType
.
getTypeDesc
();
String
[]
appCodes
=
appCode
.
split
(
","
);
for
(
String
tempCode
:
appCodes
)
{
appCodesSet
.
add
(
tempCode
);
}
roleNameSet
.
add
(
unitType
.
getName
());
}
List
<
RoleModel
>
userRoleList
=
new
ArrayList
<>();
// 全部角色筛选
// 获取角色
FeignClientResult
<
List
<
RoleModel
>>
roleListResult
=
Privilege
.
roleClient
.
queryRoleList
(
null
,
null
);
List
<
RoleModel
>
allRoleList
=
roleListResult
.
getResult
();
allRoleList
.
stream
().
forEach
(
t
->
{
if
(
roleNameSet
.
contains
(
t
.
getRoleName
()))
{
userRoleList
.
add
(
t
);
}
});
List
<
Long
>
roleIds
=
new
ArrayList
<>();
userRoleList
.
stream
().
forEach
(
r
->
{
roleIds
.
add
(
r
.
getSequenceNbr
());
});
roleSeqsMap
.
put
(
companyInfo
.
getSequenceNbr
(),
roleIds
);
List
<
String
>
appCodes
=
new
ArrayList
<>(
appCodesSet
);
agencyUserModel
.
setAppCodes
(
appCodes
);
Map
<
Long
,
List
<
RoleModel
>>
orgRoles
=
new
HashMap
<>();
orgRoles
.
put
(
companyInfo
.
getSequenceNbr
(),
userRoleList
);
agencyUserModel
.
setOrgRoles
(
orgRoles
);
agencyUserModel
.
setOrgRoleSeqs
(
roleSeqsMap
);
FeignClientResult
<
AgencyUserModel
>
userResult
=
Privilege
.
agencyUserClient
.
create
(
agencyUserModel
);
if
(
userResult
==
null
||
userResult
.
getResult
()
==
null
)
{
throw
new
BadRequest
(
"注册失败"
);
}
// org_user 创建组织机构
OrgUsr
org
=
new
OrgUsr
();
TreeParser
.
genTreeCode
();
org
.
setBizOrgCode
(
TreeParser
.
genTreeCode
());
org
.
setBizOrgType
(
CommonConstant
.
BIZ_ORG_TYPE_COMPANY
);
org
.
setBizOrgName
(
sourceUnit
.
getOrgName
());
if
(!
iOrgUsrService
.
save
(
org
))
{
throw
new
BadRequest
(
"org单位注册失败"
);
}
sourceUnit
.
setOrgUserId
(
org
.
getSequenceNbr
());
}
}
else
if
(
1
==
approveStatus
)
{
if
(
StringUtils
.
isEmpty
(
content
))
{
content
=
"驳回"
;
}
sourceUnit
.
setUnitStatus
(
2
);
}
approveDto
.
setContent
(
content
);
iUnitInfoApproveServiceImpl
.
createWithModel
(
approveDto
);
if
(
this
.
updateById
(
sourceUnit
))
{
if
(
changeFlag
&&
1
==
approveStatus
)
{
// 变更不通过返回变更表数据 其他情况返回原数据
result
=
unitChangeInfoToDto
(
changeUnit
);
}
else
{
result
=
unitInfoToDto
(
sourceUnit
);
}
}
return
result
;
}
@Override
public
UnitInfoDto
getDtoById
(
Long
sequenceNbr
)
{
UnitInfo
unitInfo
=
this
.
getById
(
sequenceNbr
);
UnitInfoDto
result
=
null
;
// 如果是变更单 同时为 审批中,默认展示变更表中最新数据
if
(
unitInfo
.
getIsChange
()
&&
unitInfo
.
getUnitStatus
()
==
0
)
{
List
<
UnitInfoChange
>
changeList
=
unitInfoChangeServiceImpl
.
list
(
new
LambdaQueryWrapper
<
UnitInfoChange
>().
eq
(
UnitInfoChange:
:
getIsDelete
,
false
).
eq
(
UnitInfoChange:
:
getSourceId
,
sequenceNbr
).
orderByDesc
(
UnitInfoChange:
:
getRecDate
));
UnitInfoChange
temp
=
changeList
.
get
(
0
);
result
=
unitChangeInfoToDto
(
temp
);
}
else
{
result
=
unitInfoToDto
(
unitInfo
);
}
return
result
;
}
private
UnitInfoDto
unitInfoToDto
(
UnitInfo
source
)
{
UnitInfoDto
target
=
new
UnitInfoDto
();
// 把原对象数据拷贝到新对象
BeanUtils
.
copyProperties
(
source
,
target
);
if
(
source
.
getIsChange
())
{
target
.
setTypeStr
(
"变更"
);
}
else
{
target
.
setTypeStr
(
"注册"
);
}
if
(
0
==
source
.
getUnitStatus
())
{
target
.
setStatusStr
(
"审批中"
);
}
else
if
(
1
==
source
.
getUnitStatus
())
{
target
.
setStatusStr
(
"审批结束"
);
}
else
if
(
2
==
source
.
getUnitStatus
())
{
target
.
setStatusStr
(
"已驳回"
);
}
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
=
sourceFileService
.
getAttachments
(
source
.
getSequenceNbr
());
// 获取企业二维码
if
(
attachmentMap
!=
null
)
{
if
(
attachmentMap
.
get
(
TzsCommonParam
.
QR_CODE
)
!=
null
)
{
target
.
setQrcode
(
attachmentMap
.
get
(
TzsCommonParam
.
QR_CODE
));
}
if
(
attachmentMap
.
get
(
TzsCommonParam
.
LICENCE_PIC
)
!=
null
)
{
target
.
setLicencePic
(
attachmentMap
.
get
(
TzsCommonParam
.
LICENCE_PIC
));
}
if
(
attachmentMap
.
get
(
TzsCommonParam
.
ADMIN_LICENSE_PIC
)
!=
null
)
{
target
.
setAdminLicensePic
(
attachmentMap
.
get
(
TzsCommonParam
.
ADMIN_LICENSE_PIC
));
}
}
return
target
;
}
private
UnitInfoDto
unitChangeInfoToDto
(
UnitInfoChange
source
)
{
UnitInfoDto
target
=
new
UnitInfoDto
();
// 把原对象数据拷贝到新对象
BeanUtils
.
copyProperties
(
source
,
target
);
if
(
0
==
source
.
getUnitStatus
())
{
target
.
setStatusStr
(
"审批中"
);
}
else
if
(
1
==
source
.
getUnitStatus
())
{
target
.
setStatusStr
(
"审批结束"
);
}
else
if
(
2
==
source
.
getUnitStatus
())
{
target
.
setStatusStr
(
"已驳回"
);
}
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
=
sourceFileService
.
getAttachments
(
source
.
getSourceId
());
// 获取附件信息
if
(
attachmentMap
!=
null
)
{
if
(
attachmentMap
.
get
(
TzsCommonParam
.
QR_CODE
)
!=
null
)
{
target
.
setQrcode
(
attachmentMap
.
get
(
TzsCommonParam
.
QR_CODE
));
}
if
(
attachmentMap
.
get
(
TzsCommonParam
.
LICENCE_PIC
)
!=
null
)
{
target
.
setLicencePic
(
attachmentMap
.
get
(
TzsCommonParam
.
LICENCE_PIC
));
}
if
(
attachmentMap
.
get
(
TzsCommonParam
.
ADMIN_LICENSE_PIC
)
!=
null
)
{
target
.
setAdminLicensePic
(
attachmentMap
.
get
(
TzsCommonParam
.
ADMIN_LICENSE_PIC
));
}
}
return
target
;
}
private
String
saveUnitInfoQrCode
(
UnitInfo
sourceUnit
)
{
// 二维码生成规则
String
qrString
=
"企业统一信用代码: "
+
sourceUnit
.
getOrganizationCode
()
+
"\n\r"
;
qrString
+=
"管理人: "
+
sourceUnit
.
getAdminName
()
+
"\n\r"
;
qrString
+=
"管理人电话: "
+
sourceUnit
.
getAdminTel
()
+
"\n\r"
;
byte
[]
bytes
=
QRCodeUtil
.
generateQRCodeImageByteData
(
qrString
,
480
);
MultipartFile
file
=
new
MockMultipartFile
(
"unitInfo_"
+
sourceUnit
.
getSequenceNbr
()
+
".png"
,
"unitInfo_"
+
sourceUnit
.
getSequenceNbr
()
+
".png"
,
"application/octet-stream"
,
bytes
);
FeignClientResult
<
Map
<
String
,
String
>>
result
=
Systemctl
.
fileStorageClient
.
updateCommonFile
(
file
);
Map
<
String
,
String
>
map
=
result
.
getResult
();
if
(
map
.
isEmpty
())
{
logger
.
error
(
"未生成二维码文件"
);
throw
new
BadRequest
(
"未生成二维码文件"
);
}
String
filePath
=
""
;
for
(
Map
.
Entry
<
String
,
String
>
fileResult
:
map
.
entrySet
())
{
filePath
=
fileResult
.
getKey
();
}
// 保存qrCode
List
<
AttachmentDto
>
qrCode
=
new
ArrayList
<>();
AttachmentDto
temp
=
new
AttachmentDto
();
temp
.
setName
(
"unitInfo_"
+
sourceUnit
.
getSequenceNbr
()
+
".png"
);
temp
.
setType
(
"image"
);
temp
.
setUrl
(
filePath
);
qrCode
.
add
(
temp
);
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
=
new
HashMap
<>();
attachmentMap
.
put
(
TzsCommonParam
.
QR_CODE
,
qrCode
);
sourceFileService
.
saveAttachments
(
sourceUnit
.
getSequenceNbr
(),
attachmentMap
);
return
filePath
;
}
}
}
}
\ No newline at end of file
amos-boot-system-tzs/src/main/resources/application-dev.properties
View file @
4548321e
...
@@ -76,3 +76,5 @@ mqtt.topic.cti.push=/cti/record
...
@@ -76,3 +76,5 @@ mqtt.topic.cti.push=/cti/record
cti.user.name
=
tzs_cti
cti.user.name
=
tzs_cti
cti.user.pwd
=
a1234567
cti.user.pwd
=
a1234567
flc.sms.tempCode
=
SMS_TZS_0001
\ No newline at end of file
amos-boot-system-tzs/src/main/resources/application-qa.properties
View file @
4548321e
...
@@ -81,3 +81,5 @@ mqtt.topic.cti.push=/cti/record
...
@@ -81,3 +81,5 @@ mqtt.topic.cti.push=/cti/record
cti.user.name
=
tzs_cti
cti.user.name
=
tzs_cti
cti.user.pwd
=
a1234567
cti.user.pwd
=
a1234567
flc.sms.tempCode
=
SMS_TZS_0001
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