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
1ee21614
Commit
1ee21614
authored
Jul 11, 2023
by
xixinzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
注册相关代码
parent
187ef6d5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
351 additions
and
13 deletions
+351
-13
UnitInfoDto.java
...om/yeejoin/amos/boot/module/hygf/api/dto/UnitInfoDto.java
+27
-0
UnitRegisterDto.java
...eejoin/amos/boot/module/hygf/api/dto/UnitRegisterDto.java
+20
-0
UnitInfo.java
...om/yeejoin/amos/boot/module/hygf/api/entity/UnitInfo.java
+55
-0
PrivilegeFeginService.java
...mos/boot/module/hygf/api/fegin/PrivilegeFeginService.java
+38
-0
IUnitInfoService.java
...n/amos/boot/module/hygf/api/service/IUnitInfoService.java
+7
-0
UnitInfoController.java
...s/boot/module/hygf/biz/controller/UnitInfoController.java
+192
-12
UnitInfoServiceImpl.java
...oot/module/hygf/biz/service/impl/UnitInfoServiceImpl.java
+0
-0
application-dev.properties
...le-hygf-biz/src/main/resources/application-dev.properties
+7
-1
application.properties
...module-hygf-biz/src/main/resources/application.properties
+5
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/UnitInfoDto.java
View file @
1ee21614
...
...
@@ -48,6 +48,9 @@ public class UnitInfoDto extends BaseDto {
@ApiModelProperty
(
value
=
"管理员账户名"
)
private
String
adminLoginName
;
@ApiModelProperty
(
value
=
"管理员账户名"
)
private
String
adminUserName
;
@ApiModelProperty
(
value
=
"管理员电话"
)
private
String
adminPhone
;
...
...
@@ -66,4 +69,28 @@ public class UnitInfoDto extends BaseDto {
@ApiModelProperty
(
value
=
"角色id"
)
private
String
roleId
;
@ApiModelProperty
(
value
=
"注册地址省-市-区"
)
private
String
registerPcd
;
@ApiModelProperty
(
value
=
"工作地址省-市-区"
)
private
String
workPcd
;
@ApiModelProperty
(
value
=
"注册地址省-市-区code"
)
private
String
registerPcdCode
;
@ApiModelProperty
(
value
=
"工作地址省-市-区code"
)
private
String
workPcdCode
;
@ApiModelProperty
(
value
=
"单位类型"
)
private
String
unitType
;
@ApiModelProperty
(
value
=
"单位类型code"
)
private
String
unitTypeCode
;
@ApiModelProperty
(
value
=
"管辖机构"
)
private
String
managementUnit
;
@ApiModelProperty
(
value
=
"管辖单位id"
)
private
String
managementUnitId
;
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/UnitRegisterDto.java
0 → 100644
View file @
1ee21614
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* @author DELL
*/
@Data
@ApiModel
(
value
=
"UnitRegisterDto"
,
description
=
"单位注册"
)
public
class
UnitRegisterDto
{
@ApiModelProperty
(
value
=
"企业名称"
)
private
UnitInfoDto
unitInfoDto
;
@ApiModelProperty
(
value
=
"企业名称"
)
private
CommerceInfoDto
commerceInfoDto
;
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/entity/UnitInfo.java
View file @
1ee21614
...
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.hygf.api.entity;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
...
...
@@ -112,4 +113,58 @@ public class UnitInfo extends BaseEntity {
@TableField
(
"role_id"
)
private
String
roleId
;
/**
* 管理员账户名
*/
@TableField
(
"admin_user_name"
)
private
String
adminUserName
;
/**
* 注册地址省-市-区
*/
@TableField
(
"register_pcd"
)
private
String
registerPcd
;
/**
* 工作地址省-市-区
*/
@TableField
(
"work_Pcd"
)
private
String
workPcd
;
/**
* 注册地址省-市-区code
*/
@TableField
(
"register_pcd_code"
)
private
String
registerPcdCode
;
/**
* 工作地址省-市-区code
*/
@TableField
(
"work_pcd_code"
)
private
String
workPcdCode
;
/**
* 单位类型
*/
@TableField
(
"unit_type"
)
private
String
unitType
;
/**
* 单位类型code
*/
@TableField
(
"unit_type_code"
)
private
String
unitTypeCode
;
/**
* 管辖机构
*/
@TableField
(
"management_unit"
)
private
String
managementUnit
;
/**
* 管辖单位id
*/
@TableField
(
"management_unit_id"
)
private
String
managementUnitId
;
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/fegin/PrivilegeFeginService.java
0 → 100644
View file @
1ee21614
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
fegin
;
import
com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration
;
import
com.yeejoin.amos.component.feign.config.InnerInvokException
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.VerifyCodeAuthModel
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
@FeignClient
(
value
=
"AMOS-API-PRIVILEGE"
,
configuration
=
{
FeignConfiguration
.
class
})
public
interface
PrivilegeFeginService
{
@RequestMapping
(
value
=
"/privilege/v1/agencyuser/me"
,
method
=
RequestMethod
.
GET
)
ResponseModel
<
AgencyUserModel
>
getMe
();
//获取单位树
@RequestMapping
(
value
=
"/privilege/v1/company/tree"
,
method
=
RequestMethod
.
GET
)
FeignClientResult
tree
(
@RequestHeader
(
"token"
)
String
token
,
@RequestHeader
(
"appKey"
)
String
appKey
,
@RequestHeader
(
"product"
)
String
product
);
//获取省级行政区划
@RequestMapping
(
value
=
"systemctl/v1/region/level"
,
method
=
RequestMethod
.
GET
)
FeignClientResult
getProvince
(
@RequestParam
String
level
);
//获取行政区划树
@RequestMapping
(
value
=
"systemctl/v1/region/tree"
,
method
=
RequestMethod
.
GET
)
FeignClientResult
getTree
();
/**
* 手机号验证码登录
*/
@RequestMapping
(
value
=
"/privilege/v1/auth/mobile/verifycode"
,
method
=
RequestMethod
.
POST
)
FeignClientResult
mobileVerifyCode
(
@RequestBody
VerifyCodeAuthModel
model
)
throws
InnerInvokException
;
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/service/IUnitInfoService.java
View file @
1ee21614
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
service
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.UnitRegisterDto
;
import
java.util.Collection
;
/**
* 经销商人员信息接口类
*
...
...
@@ -9,4 +13,7 @@ package com.yeejoin.amos.boot.module.hygf.api.service;
*/
public
interface
IUnitInfoService
{
Collection
getManagementUnitTree
(
String
orgCode
);
UnitRegisterDto
registerUnit
(
UnitRegisterDto
model
);
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/UnitInfoController.java
View file @
1ee21614
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
controller
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.UnitRegisterDto
;
import
com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
io.swagger.annotations.ApiParam
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpStatus
;
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.List
;
import
java.util.*
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.UnitInfoServiceImpl
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -24,25 +46,28 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
* @date 2023-07-07
*/
@RestController
@Api
(
tags
=
"经销商
人员
信息Api"
)
@Api
(
tags
=
"经销商
单位
信息Api"
)
@RequestMapping
(
value
=
"/unit-info"
)
public
class
UnitInfoController
extends
BaseController
{
@Autowired
UnitInfoServiceImpl
unitInfoServiceImpl
;
@Autowired
AmosRequestContext
requestContext
;
@Autowired
RedisUtils
redisUtil
;
@Value
(
"${hygf.sms.tempCode}"
)
private
String
smsTempCode
;
public
static
final
String
HYGF_USER_TEL
=
"hygf_tel_"
;
/**
* 新增经销商人员信息
*
* @return
* 验证码过期时间
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增经销商人员信息"
,
notes
=
"新增经销商人员信息"
)
public
ResponseModel
<
UnitInfoDto
>
save
(
@RequestBody
UnitInfoDto
model
)
{
model
=
unitInfoServiceImpl
.
createWithModel
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
private
long
time
=
600
l
;
/**
* 根据sequenceNbr更新
...
...
@@ -113,4 +138,159 @@ public class UnitInfoController extends BaseController {
public
ResponseModel
<
List
<
UnitInfoDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
queryForUnitInfoList
());
}
/**
* 管理员身份证图片上传 无token
*
* @return
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/uploadFile"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"管理员身份证图片上传 无token"
,
notes
=
"管理员身份证图片上传 无token"
)
public
ResponseModel
<
String
>
uploadFile
(
@ApiParam
(
value
=
"文件"
,
required
=
true
)
@RequestParam
MultipartFile
file
)
{
if
(
ValidationUtil
.
isEmpty
(
file
)){
throw
new
BadRequest
(
"参数校验失败."
);
}
RequestContext
.
setAppKey
(
"AMOS_STUDIO"
);
RequestContext
.
setProduct
(
"AMOS_STUDIO_WEB"
);
RequestContext
.
setToken
(
requestContext
.
getToken
());
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
=
"/region/tree"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取组织机构树"
,
notes
=
"获取组织机构树"
)
public
ResponseModel
<
Collection
<
RegionModel
>>
getRegionTree
()
{
RequestContext
.
setAppKey
(
"AMOS_STUDIO"
);
RequestContext
.
setProduct
(
"AMOS_STUDIO_WEB"
);
RequestContext
.
setToken
(
requestContext
.
getToken
());
return
ResponseHelper
.
buildResponse
(
Systemctl
.
regionClient
.
queryForTree
(
null
).
getResult
());
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/management-unit/tree"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"管辖机构树"
,
notes
=
"管辖机构树"
)
public
ResponseModel
<
Collection
>
managementUnitTree
(
@RequestParam
(
required
=
false
)
String
orgCode
)
{
RequestContext
.
setAppKey
(
"AMOS_STUDIO"
);
RequestContext
.
setProduct
(
"AMOS_STUDIO_WEB"
);
RequestContext
.
setToken
(
requestContext
.
getToken
());
Collection
result
=
unitInfoServiceImpl
.
getManagementUnitTree
(
orgCode
);
return
ResponseHelper
.
buildResponse
(
result
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/unitRegister"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"单位注册"
,
notes
=
"单位注册"
)
public
ResponseModel
<
UnitRegisterDto
>
save
(
@RequestBody
UnitRegisterDto
model
)
{
try
{
RequestContext
.
setAppKey
(
"AMOS_STUDIO"
);
RequestContext
.
setProduct
(
"AMOS_STUDIO_WEB"
);
RequestContext
.
setToken
(
requestContext
.
getToken
());
model
=
unitInfoServiceImpl
.
registerUnit
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
catch
(
Exception
e
)
{
ResponseModel
<
UnitRegisterDto
>
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
;
}
}
/**
* 判断用户号码是否存在
*
* @return
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/hasExistPhone/{phone}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"判断用户号码是否存在"
,
notes
=
"判断用户号码是否存在"
)
public
ResponseModel
hasExistPhone
(
@PathVariable
(
value
=
"phone"
)
String
phone
)
{
try
{
return
CommonResponseUtil
.
success
(
Privilege
.
agencyUserClient
.
checkLoginId
(
phone
).
getResult
());
}
catch
(
Exception
e
)
{
return
CommonResponseUtil
.
failure
(
"该手机号已经注册"
);
}
}
/**
* 发送手机号验证码
*
* @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
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
String
type
)
{
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 保存到缓存中
redisUtil
.
set
(
HYGF_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
adminTel
,
@PathVariable
(
value
=
"code"
)
String
code
)
{
Boolean
flag
=
false
;
if
(
ValidationUtil
.
isEmpty
(
adminTel
)
||
ValidationUtil
.
isEmpty
(
code
))
{
throw
new
BadRequest
(
"参数校验失败."
);
}
if
(
redisUtil
.
hasKey
(
HYGF_USER_TEL
+
adminTel
))
{
String
redisCode
=
redisUtil
.
get
(
HYGF_USER_TEL
+
adminTel
).
toString
();
if
(
code
.
equals
(
redisCode
))
{
flag
=
true
;
}
}
return
ResponseHelper
.
buildResponse
(
flag
);
}
private
String
getRandomCode
(){
String
code
=
""
;
Random
random
=
new
Random
();
for
(
int
i
=
0
;
i
<
6
;
i
++)
{
int
r
=
random
.
nextInt
(
10
);
code
=
code
+
r
;
}
return
code
;
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/UnitInfoServiceImpl.java
View file @
1ee21614
This diff is collapsed.
Click to expand it.
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/resources/application-dev.properties
View file @
1ee21614
## DB properties:
spring.datasource.url
=
jdbc:mysql://172.16.10.220:3306/
production
?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.url
=
jdbc:mysql://172.16.10.220:3306/
hygf_database
?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username
=
root
spring.datasource.password
=
Yeejoin@2020
## eureka properties:
...
...
@@ -85,3 +85,9 @@ spring.activemq.user=admin
spring.activemq.password
=
admin
spring.jms.pub-sub-domain
=
false
myqueue
=
amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
regulator.unit.code
=
86*258
# Ӧcode
dealer.appcode
=
studio_normalapp_5133538
hygf.sms.tempCode
=
SMS_TZS_0001
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/resources/application.properties
View file @
1ee21614
...
...
@@ -60,3 +60,8 @@ spring.http.encoding.force=true
privilege.fegin.name
=
AMOS-API-PRIVILEGE
feign.client.config.default.connect-timeout
=
20000
feign.client.config.default.read-timeout
=
20000
amos.system.user.user-name
=
hygf_admin
amos.system.user.password
=
a1234567
amos.system.user.product
=
AMOS_STUDIO_WEB
amos.system.user.app-key
=
AMOS_STUDIO
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