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
49ff0532
Commit
49ff0532
authored
Oct 10, 2022
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加重复公司校验
parent
7e3728d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
18 deletions
+60
-18
TzsAuthController.java
...mos/boot/module/tzs/biz/controller/TzsAuthController.java
+1
-1
RegUnitInfoController.java
.../module/tzs/flc/biz/controller/RegUnitInfoController.java
+59
-17
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 @
49ff0532
...
...
@@ -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/flc/biz/controller/RegUnitInfoController.java
View file @
49ff0532
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
;
/**
* 单位注册信息表
...
...
@@ -48,24 +66,48 @@ public class RegUnitInfoController extends BaseController {
@Value
(
"${flc.sms.timeout:600}"
)
private
int
timeout
;
@Autowired
StartPlatformTokenService
startPlatformTokenService
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@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
(
"单位编码不能为空"
);
}
if
(!
ValidationUtil
.
isEmpty
(
companyName
))
{
startPlatformTokenService
.
getToken
();
FeignClientResult
<
CompanyModel
>
result
=
Privilege
.
companyClient
.
queryByCompanyName
(
companyName
);
if
(
result
.
getResult
()!=
null
)
{
throw
new
BadRequest
(
"重复的公司名称"
);
}
}
RegUnitInfoDto
regUnitInfoDto
=
iRegUnitInfoService
.
unitCheck
(
unitCode
,
unitType
);
return
ResponseHelper
.
buildResponse
(
regUnitInfoDto
);
}
...
...
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