Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
O
on-site-service
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
external
on-site-service
Commits
7dc7bc51
Commit
7dc7bc51
authored
Jul 13, 2022
by
lining
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: admin维修工和估价员接口小bug修复
parent
6d5edcf3
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
71 additions
and
54 deletions
+71
-54
pom.xml
admin/pom.xml
+5
-0
ServiceValuatorController.java
...e/admin/controller/service/ServiceValuatorController.java
+1
-1
ServiceWorkerController.java
...ice/admin/controller/service/ServiceWorkerController.java
+1
-1
SaveServiceValuatorDTO.java
.../admin/controller/service/dto/SaveServiceValuatorDTO.java
+4
-9
SaveServiceWorkerDTO.java
...ce/admin/controller/service/dto/SaveServiceWorkerDTO.java
+3
-7
UpdateServiceValuatorDTO.java
...dmin/controller/service/dto/UpdateServiceValuatorDTO.java
+9
-14
UpdateServiceWorkerDTO.java
.../admin/controller/service/dto/UpdateServiceWorkerDTO.java
+4
-8
ServiceWorkerVO.java
...eservice/admin/controller/service/vo/ServiceWorkerVO.java
+1
-1
ServiceValuatorService.java
...service/admin/service/service/ServiceValuatorService.java
+4
-4
ServiceWorkerService.java
...teservice/admin/service/service/ServiceWorkerService.java
+4
-4
application.yaml
admin/src/main/resources/application.yaml
+1
-1
AdminJwtTest.java
...n/src/test/java/com/onsiteservice/admin/AdminJwtTest.java
+30
-0
BizCodeEnum.java
...in/java/com/onsiteservice/constant/enums/BizCodeEnum.java
+1
-1
ServiceWorker.java
.../java/com/onsiteservice/entity/service/ServiceWorker.java
+1
-1
ServiceOrderController.java
...vice/miniapp/controller/order/ServiceOrderController.java
+1
-1
MiniAppJwtTest.java
test/src/main/java/com/onsiteservice/MiniAppJwtTest.java
+1
-1
No files found.
admin/pom.xml
View file @
7dc7bc51
...
...
@@ -24,6 +24,11 @@
<groupId>
com.github.binarywang
</groupId>
<artifactId>
wx-java-miniapp-spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
...
...
admin/src/main/java/com/onsiteservice/admin/controller/service/ServiceValuatorController.java
View file @
7dc7bc51
...
...
@@ -58,7 +58,7 @@ public class ServiceValuatorController {
@ApiOperation
(
value
=
"修改"
)
@PutMapping
(
"update"
)
public
Result
saveOrU
pdate
(
@RequestBody
@NonNull
@Validated
UpdateServiceValuatorDTO
dto
,
@CurrentUserId
Long
userId
)
{
public
Result
u
pdate
(
@RequestBody
@NonNull
@Validated
UpdateServiceValuatorDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceValuatorService
.
update
(
dto
,
userId
)
==
1
?
success
()
:
fail
(
"修改失败"
);
}
...
...
admin/src/main/java/com/onsiteservice/admin/controller/service/ServiceWorkerController.java
View file @
7dc7bc51
...
...
@@ -73,7 +73,7 @@ public class ServiceWorkerController {
}
@ApiOperation
(
value
=
"维修工种类"
)
@
Pos
tMapping
(
"kind"
)
@
Ge
tMapping
(
"kind"
)
public
Result
<
List
<
ServiceWorkerKindVO
>>
kind
()
{
return
success
(
serviceWorkerService
.
kind
());
}
...
...
admin/src/main/java/com/onsiteservice/admin/controller/service/dto/SaveServiceValuatorDTO.java
View file @
7dc7bc51
...
...
@@ -6,6 +6,7 @@ import lombok.Data;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.Pattern
;
/**
* <P></P>
...
...
@@ -19,21 +20,15 @@ import javax.validation.constraints.NotEmpty;
public
class
SaveServiceValuatorDTO
{
@ApiModelProperty
(
"姓名"
)
@NotBlank
(
message
=
"请输入
维修工
姓名"
)
@NotBlank
(
message
=
"请输入
估价员
姓名"
)
private
String
name
;
/**
* 手机号
*/
@ApiModelProperty
(
"手机号"
)
@NotBlank
(
message
=
"请输入维修工手机"
)
@NotBlank
(
message
=
"请输入估价员手机"
)
@Pattern
(
regexp
=
"^1[3456789]\\d{9}$"
,
message
=
"手机号格式不正确"
)
private
String
phone
;
/**
* 维修工类型
*/
@ApiModelProperty
(
"维修工类型"
)
@NotEmpty
(
message
=
"请选择工种"
)
private
Boolean
kind
;
}
admin/src/main/java/com/onsiteservice/admin/controller/service/dto/SaveServiceWorkerDTO.java
View file @
7dc7bc51
...
...
@@ -6,6 +6,8 @@ import lombok.Data;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Pattern
;
/**
* <P></P>
...
...
@@ -27,13 +29,7 @@ public class SaveServiceWorkerDTO {
*/
@ApiModelProperty
(
"手机号"
)
@NotBlank
(
message
=
"请输入维修工手机"
)
@Pattern
(
regexp
=
"^1[3456789]\\d{9}$"
,
message
=
"手机号格式不正确"
)
private
String
phone
;
/**
* 维修工类型
*/
@ApiModelProperty
(
"维修工类型"
)
@NotEmpty
(
message
=
"请选择工种"
)
private
Boolean
kind
;
}
admin/src/main/java/com/onsiteservice/admin/controller/service/dto/UpdateServiceValuatorDTO.java
View file @
7dc7bc51
...
...
@@ -5,7 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Pattern
;
/**
* <P></P>
...
...
@@ -18,26 +19,20 @@ import javax.validation.constraints.NotEmpty;
@Data
public
class
UpdateServiceValuatorDTO
{
@ApiModelProperty
(
"
维修工
id"
)
@Not
Empty
(
message
=
"请输入维修工
id"
)
@ApiModelProperty
(
"
估价员
id"
)
@Not
Null
(
message
=
"请输入估价员
id"
)
private
Long
id
;
@ApiModelProperty
(
"姓名"
)
@NotBlank
(
message
=
"请输入
维修工
姓名"
)
@ApiModelProperty
(
"
估价员
姓名"
)
@NotBlank
(
message
=
"请输入
估价员
姓名"
)
private
String
name
;
/**
* 手机号
*/
@ApiModelProperty
(
"手机号"
)
@NotBlank
(
message
=
"请输入维修工手机"
)
@ApiModelProperty
(
"估价员手机号"
)
@NotBlank
(
message
=
"请输入估价员手机"
)
@Pattern
(
regexp
=
"^1[3456789]\\d{9}$"
,
message
=
"手机号格式不正确"
)
private
String
phone
;
/**
* 维修工类型
*/
@ApiModelProperty
(
"维修工类型"
)
@NotEmpty
(
message
=
"请选择工种"
)
private
Boolean
kind
;
}
admin/src/main/java/com/onsiteservice/admin/controller/service/dto/UpdateServiceWorkerDTO.java
View file @
7dc7bc51
...
...
@@ -6,6 +6,8 @@ import lombok.Data;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Pattern
;
/**
* <P></P>
...
...
@@ -19,7 +21,7 @@ import javax.validation.constraints.NotEmpty;
public
class
UpdateServiceWorkerDTO
{
@ApiModelProperty
(
"维修工id"
)
@Not
Empty
(
message
=
"请输入维修工id"
)
@Not
Null
(
message
=
"请输入维修工id"
)
private
Long
id
;
@ApiModelProperty
(
"姓名"
)
...
...
@@ -31,13 +33,7 @@ public class UpdateServiceWorkerDTO {
*/
@ApiModelProperty
(
"手机号"
)
@NotBlank
(
message
=
"请输入维修工手机"
)
@Pattern
(
regexp
=
"^1[3456789]\\d{9}$"
,
message
=
"手机号格式不正确"
)
private
String
phone
;
/**
* 维修工类型
*/
@ApiModelProperty
(
"维修工类型"
)
@NotEmpty
(
message
=
"请选择工种"
)
private
Boolean
kind
;
}
admin/src/main/java/com/onsiteservice/admin/controller/service/vo/ServiceWorkerVO.java
View file @
7dc7bc51
...
...
@@ -13,7 +13,7 @@ public class ServiceWorkerVO {
private
String
phone
;
private
Boolean
kind
;
private
Integer
kind
;
private
Date
createTime
;
...
...
admin/src/main/java/com/onsiteservice/admin/service/service/ServiceValuatorService.java
View file @
7dc7bc51
...
...
@@ -75,12 +75,12 @@ public class ServiceValuatorService extends AbstractMapper<ServiceValuator> {
public
int
save
(
SaveServiceValuatorDTO
dto
,
Long
userId
)
{
log
.
info
(
"valuator save dto: {}, userId: {}"
,
dto
,
userId
);
checkAuth
(
userId
);
//
checkAuth(userId);
Condition
c
=
new
Condition
(
ServiceWorker
.
class
);
c
.
createCriteria
().
andEqualTo
(
"phone"
,
dto
.
getPhone
());
List
<
ServiceValuator
>
serviceValuatorList
=
this
.
selectByCondition
(
c
);
if
(
CollectionUtils
.
isEmpty
(
serviceValuatorList
))
{
if
(
!
CollectionUtils
.
isEmpty
(
serviceValuatorList
))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_VALUATOR_HAS_EXIST
);
}
...
...
@@ -91,7 +91,7 @@ public class ServiceValuatorService extends AbstractMapper<ServiceValuator> {
public
int
update
(
UpdateServiceValuatorDTO
dto
,
Long
userId
)
{
log
.
info
(
"valuator update dto: {}, userId: {}"
,
dto
,
userId
);
checkAuth
(
userId
);
//
checkAuth(userId);
return
this
.
updateByPrimaryKeySelective
(
AttrCopyUtils
.
copy
(
dto
,
new
ServiceValuator
()));
}
...
...
@@ -100,7 +100,7 @@ public class ServiceValuatorService extends AbstractMapper<ServiceValuator> {
public
int
delete
(
Long
id
,
Long
userId
)
{
log
.
info
(
"valuator delete id: {}, userId: {}"
,
id
,
userId
);
checkAuth
(
userId
);
//
checkAuth(userId);
return
this
.
deleteByPrimaryKey
(
id
);
}
...
...
admin/src/main/java/com/onsiteservice/admin/service/service/ServiceWorkerService.java
View file @
7dc7bc51
...
...
@@ -73,12 +73,12 @@ public class ServiceWorkerService extends AbstractMapper<ServiceWorker> {
public
int
save
(
SaveServiceWorkerDTO
dto
,
Long
userId
)
{
log
.
info
(
"worker save dto: {}, userId: {}"
,
dto
,
userId
);
checkAuth
(
userId
);
//
checkAuth(userId);
Condition
c
=
new
Condition
(
ServiceWorker
.
class
);
c
.
createCriteria
().
andEqualTo
(
"phone"
,
dto
.
getPhone
());
List
<
ServiceWorker
>
serviceWorkerList
=
this
.
selectByCondition
(
c
);
if
(
CollectionUtils
.
isEmpty
(
serviceWorkerList
))
{
if
(
!
CollectionUtils
.
isEmpty
(
serviceWorkerList
))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_WORKER_HAS_EXIST
);
}
...
...
@@ -88,7 +88,7 @@ public class ServiceWorkerService extends AbstractMapper<ServiceWorker> {
public
int
update
(
UpdateServiceWorkerDTO
dto
,
Long
userId
)
{
log
.
info
(
"worker update dto: {}, userId: {}"
,
dto
,
userId
);
checkAuth
(
userId
);
//
checkAuth(userId);
return
this
.
updateByPrimaryKeySelective
(
AttrCopyUtils
.
copy
(
dto
,
new
ServiceWorker
()));
}
...
...
@@ -96,7 +96,7 @@ public class ServiceWorkerService extends AbstractMapper<ServiceWorker> {
public
int
delete
(
Long
id
,
Long
userId
)
{
log
.
info
(
"worker delete id: {}, userId: {}"
,
id
,
userId
);
checkAuth
(
userId
);
//
checkAuth(userId);
return
this
.
deleteByPrimaryKey
(
id
);
}
...
...
admin/src/main/resources/application.yaml
View file @
7dc7bc51
...
...
@@ -13,7 +13,7 @@ project:
enabled
:
true
# 是否开启jwt拦截
secret
:
b25zaXRlLXNlcnZpY2UtYWRtaW4tYmFzZTY0LXNlY3JldA==
issuer
:
onsite-service-admin
expires-time
:
86400
# 1天有效期 秒
expires-time
:
86400
00
# 1天有效期 秒
# 无需授权url资源
ant-paths
:
"
/error,/websocket/**,/api,/token/base,/monitor/**,/dict,/login,/doc.html,/webjars/**,/swagger**,
/swagger-resources/configuration/ui,/**/v2/api-docs"
...
...
admin/src/test/java/com/onsiteservice/admin/AdminJwtTest.java
0 → 100644
View file @
7dc7bc51
package
com
.
onsiteservice
.
admin
;
import
com.onsiteservice.core.security.jwt.JwtManager
;
import
lombok.extern.log4j.Log4j2
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.util.Map
;
/**
* <P></P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/8 09:58
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
OnSiteServiceAdminApplication
.
class
)
@Log4j2
public
class
AdminJwtTest
{
@Test
public
void
testGenerateJetToken
()
{
System
.
out
.
println
(
JwtManager
.
createToken
(
Map
.
of
(
JwtManager
.
USER_ID
,
1
,
JwtManager
.
USER_NAME
,
"admin"
)));
}
}
constant/src/main/java/com/onsiteservice/constant/enums/BizCodeEnum.java
View file @
7dc7bc51
...
...
@@ -40,7 +40,7 @@ public enum BizCodeEnum {
* 维修工模块
*/
SERVICE_WORKER_NOT_EXIST
(
"维修工不存在"
),
SERVICE_WORKER_HAS_EXIST
(
"该手机号对应
维修工
已存在"
),
SERVICE_WORKER_HAS_EXIST
(
"该手机号对应
工作人员
已存在"
),
/**
* 估价员模块
...
...
entity/src/main/java/com/onsiteservice/entity/service/ServiceWorker.java
View file @
7dc7bc51
...
...
@@ -36,7 +36,7 @@ public class ServiceWorker implements Serializable {
* 维修工类型
*/
@ApiModelProperty
(
"维修工类型"
)
private
Boolean
kind
;
private
Integer
kind
;
/**
* 创建时间
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/ServiceOrderController.java
View file @
7dc7bc51
...
...
@@ -125,7 +125,7 @@ public class ServiceOrderController {
}
@ApiOperation
(
value
=
"订单流程图"
)
@GetMapping
(
"process/
id
"
)
@GetMapping
(
"process/
{id}
"
)
public
Result
<
List
<
ServiceOrderLogVO
>>
process
(
@ApiParam
(
name
=
"id"
,
value
=
"订单id"
)
@PathVariable
@Positive
Long
id
,
@CurrentUserId
Long
userId
)
{
return
success
(
serviceOrderService
.
process
(
id
,
userId
));
}
...
...
test/src/main/java/com/onsiteservice/JwtTest.java
→
test/src/main/java/com/onsiteservice/
MiniApp
JwtTest.java
View file @
7dc7bc51
...
...
@@ -20,7 +20,7 @@ import java.util.Map;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
MiniAppApplication
.
class
)
@Log4j2
public
class
JwtTest
{
public
class
MiniApp
JwtTest
{
@Test
...
...
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