Commit 7dc7bc51 authored by lining's avatar lining

fix: admin维修工和估价员接口小bug修复

parent 6d5edcf3
...@@ -24,6 +24,11 @@ ...@@ -24,6 +24,11 @@
<groupId>com.github.binarywang</groupId> <groupId>com.github.binarywang</groupId>
<artifactId>wx-java-miniapp-spring-boot-starter</artifactId> <artifactId>wx-java-miniapp-spring-boot-starter</artifactId>
</dependency> </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -58,7 +58,7 @@ public class ServiceValuatorController { ...@@ -58,7 +58,7 @@ public class ServiceValuatorController {
@ApiOperation(value = "修改") @ApiOperation(value = "修改")
@PutMapping("update") @PutMapping("update")
public Result saveOrUpdate(@RequestBody @NonNull @Validated UpdateServiceValuatorDTO dto, @CurrentUserId Long userId) { public Result update(@RequestBody @NonNull @Validated UpdateServiceValuatorDTO dto, @CurrentUserId Long userId) {
return serviceValuatorService.update(dto, userId) == 1 ? success() : fail("修改失败"); return serviceValuatorService.update(dto, userId) == 1 ? success() : fail("修改失败");
} }
......
...@@ -73,7 +73,7 @@ public class ServiceWorkerController { ...@@ -73,7 +73,7 @@ public class ServiceWorkerController {
} }
@ApiOperation(value = "维修工种类") @ApiOperation(value = "维修工种类")
@PostMapping("kind") @GetMapping("kind")
public Result<List<ServiceWorkerKindVO>> kind() { public Result<List<ServiceWorkerKindVO>> kind() {
return success(serviceWorkerService.kind()); return success(serviceWorkerService.kind());
} }
......
...@@ -6,6 +6,7 @@ import lombok.Data; ...@@ -6,6 +6,7 @@ import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
/** /**
* <P></P> * <P></P>
...@@ -19,21 +20,15 @@ import javax.validation.constraints.NotEmpty; ...@@ -19,21 +20,15 @@ import javax.validation.constraints.NotEmpty;
public class SaveServiceValuatorDTO { public class SaveServiceValuatorDTO {
@ApiModelProperty("姓名") @ApiModelProperty("姓名")
@NotBlank(message = "请输入维修工姓名") @NotBlank(message = "请输入估价员姓名")
private String name; private String name;
/** /**
* 手机号 * 手机号
*/ */
@ApiModelProperty("手机号") @ApiModelProperty("手机号")
@NotBlank(message = "请输入维修工手机") @NotBlank(message = "请输入估价员手机")
@Pattern(regexp = "^1[3456789]\\d{9}$", message = "手机号格式不正确")
private String phone; private String phone;
/**
* 维修工类型
*/
@ApiModelProperty("维修工类型")
@NotEmpty(message = "请选择工种")
private Boolean kind;
} }
...@@ -6,6 +6,8 @@ import lombok.Data; ...@@ -6,6 +6,8 @@ import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
/** /**
* <P></P> * <P></P>
...@@ -27,13 +29,7 @@ public class SaveServiceWorkerDTO { ...@@ -27,13 +29,7 @@ public class SaveServiceWorkerDTO {
*/ */
@ApiModelProperty("手机号") @ApiModelProperty("手机号")
@NotBlank(message = "请输入维修工手机") @NotBlank(message = "请输入维修工手机")
@Pattern(regexp = "^1[3456789]\\d{9}$", message = "手机号格式不正确")
private String phone; private String phone;
/**
* 维修工类型
*/
@ApiModelProperty("维修工类型")
@NotEmpty(message = "请选择工种")
private Boolean kind;
} }
...@@ -5,7 +5,8 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,7 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
/** /**
* <P></P> * <P></P>
...@@ -18,26 +19,20 @@ import javax.validation.constraints.NotEmpty; ...@@ -18,26 +19,20 @@ import javax.validation.constraints.NotEmpty;
@Data @Data
public class UpdateServiceValuatorDTO { public class UpdateServiceValuatorDTO {
@ApiModelProperty("维修工id") @ApiModelProperty("估价员id")
@NotEmpty(message = "请输入维修工id") @NotNull(message = "请输入估价员id")
private Long id; private Long id;
@ApiModelProperty("姓名") @ApiModelProperty("估价员姓名")
@NotBlank(message = "请输入维修工姓名") @NotBlank(message = "请输入估价员姓名")
private String name; private String name;
/** /**
* 手机号 * 手机号
*/ */
@ApiModelProperty("手机号") @ApiModelProperty("估价员手机号")
@NotBlank(message = "请输入维修工手机") @NotBlank(message = "请输入估价员手机")
@Pattern(regexp = "^1[3456789]\\d{9}$", message = "手机号格式不正确")
private String phone; private String phone;
/**
* 维修工类型
*/
@ApiModelProperty("维修工类型")
@NotEmpty(message = "请选择工种")
private Boolean kind;
} }
...@@ -6,6 +6,8 @@ import lombok.Data; ...@@ -6,6 +6,8 @@ import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
/** /**
* <P></P> * <P></P>
...@@ -19,7 +21,7 @@ import javax.validation.constraints.NotEmpty; ...@@ -19,7 +21,7 @@ import javax.validation.constraints.NotEmpty;
public class UpdateServiceWorkerDTO { public class UpdateServiceWorkerDTO {
@ApiModelProperty("维修工id") @ApiModelProperty("维修工id")
@NotEmpty(message = "请输入维修工id") @NotNull(message = "请输入维修工id")
private Long id; private Long id;
@ApiModelProperty("姓名") @ApiModelProperty("姓名")
...@@ -31,13 +33,7 @@ public class UpdateServiceWorkerDTO { ...@@ -31,13 +33,7 @@ public class UpdateServiceWorkerDTO {
*/ */
@ApiModelProperty("手机号") @ApiModelProperty("手机号")
@NotBlank(message = "请输入维修工手机") @NotBlank(message = "请输入维修工手机")
@Pattern(regexp = "^1[3456789]\\d{9}$", message = "手机号格式不正确")
private String phone; private String phone;
/**
* 维修工类型
*/
@ApiModelProperty("维修工类型")
@NotEmpty(message = "请选择工种")
private Boolean kind;
} }
...@@ -13,7 +13,7 @@ public class ServiceWorkerVO { ...@@ -13,7 +13,7 @@ public class ServiceWorkerVO {
private String phone; private String phone;
private Boolean kind; private Integer kind;
private Date createTime; private Date createTime;
......
...@@ -75,12 +75,12 @@ public class ServiceValuatorService extends AbstractMapper<ServiceValuator> { ...@@ -75,12 +75,12 @@ public class ServiceValuatorService extends AbstractMapper<ServiceValuator> {
public int save(SaveServiceValuatorDTO dto, Long userId) { public int save(SaveServiceValuatorDTO dto, Long userId) {
log.info("valuator save dto: {}, userId: {}", dto, userId); log.info("valuator save dto: {}, userId: {}", dto, userId);
checkAuth(userId); // checkAuth(userId);
Condition c = new Condition(ServiceWorker.class); Condition c = new Condition(ServiceWorker.class);
c.createCriteria().andEqualTo("phone", dto.getPhone()); c.createCriteria().andEqualTo("phone", dto.getPhone());
List<ServiceValuator> serviceValuatorList = this.selectByCondition(c); List<ServiceValuator> serviceValuatorList = this.selectByCondition(c);
if (CollectionUtils.isEmpty(serviceValuatorList)) { if (!CollectionUtils.isEmpty(serviceValuatorList)) {
throw new ServiceException(BizCodeEnum.SERVICE_VALUATOR_HAS_EXIST); throw new ServiceException(BizCodeEnum.SERVICE_VALUATOR_HAS_EXIST);
} }
...@@ -91,7 +91,7 @@ public class ServiceValuatorService extends AbstractMapper<ServiceValuator> { ...@@ -91,7 +91,7 @@ public class ServiceValuatorService extends AbstractMapper<ServiceValuator> {
public int update(UpdateServiceValuatorDTO dto, Long userId) { public int update(UpdateServiceValuatorDTO dto, Long userId) {
log.info("valuator update dto: {}, userId: {}", dto, userId); log.info("valuator update dto: {}, userId: {}", dto, userId);
checkAuth(userId); // checkAuth(userId);
return this.updateByPrimaryKeySelective(AttrCopyUtils.copy(dto, new ServiceValuator())); return this.updateByPrimaryKeySelective(AttrCopyUtils.copy(dto, new ServiceValuator()));
} }
...@@ -100,7 +100,7 @@ public class ServiceValuatorService extends AbstractMapper<ServiceValuator> { ...@@ -100,7 +100,7 @@ public class ServiceValuatorService extends AbstractMapper<ServiceValuator> {
public int delete(Long id, Long userId) { public int delete(Long id, Long userId) {
log.info("valuator delete id: {}, userId: {}", id, userId); log.info("valuator delete id: {}, userId: {}", id, userId);
checkAuth(userId); // checkAuth(userId);
return this.deleteByPrimaryKey(id); return this.deleteByPrimaryKey(id);
} }
......
...@@ -73,12 +73,12 @@ public class ServiceWorkerService extends AbstractMapper<ServiceWorker> { ...@@ -73,12 +73,12 @@ public class ServiceWorkerService extends AbstractMapper<ServiceWorker> {
public int save(SaveServiceWorkerDTO dto, Long userId) { public int save(SaveServiceWorkerDTO dto, Long userId) {
log.info("worker save dto: {}, userId: {}", dto, userId); log.info("worker save dto: {}, userId: {}", dto, userId);
checkAuth(userId); // checkAuth(userId);
Condition c = new Condition(ServiceWorker.class); Condition c = new Condition(ServiceWorker.class);
c.createCriteria().andEqualTo("phone", dto.getPhone()); c.createCriteria().andEqualTo("phone", dto.getPhone());
List<ServiceWorker> serviceWorkerList = this.selectByCondition(c); List<ServiceWorker> serviceWorkerList = this.selectByCondition(c);
if (CollectionUtils.isEmpty(serviceWorkerList)) { if (!CollectionUtils.isEmpty(serviceWorkerList)) {
throw new ServiceException(BizCodeEnum.SERVICE_WORKER_HAS_EXIST); throw new ServiceException(BizCodeEnum.SERVICE_WORKER_HAS_EXIST);
} }
...@@ -88,7 +88,7 @@ public class ServiceWorkerService extends AbstractMapper<ServiceWorker> { ...@@ -88,7 +88,7 @@ public class ServiceWorkerService extends AbstractMapper<ServiceWorker> {
public int update(UpdateServiceWorkerDTO dto, Long userId) { public int update(UpdateServiceWorkerDTO dto, Long userId) {
log.info("worker update dto: {}, userId: {}", dto, userId); log.info("worker update dto: {}, userId: {}", dto, userId);
checkAuth(userId); // checkAuth(userId);
return this.updateByPrimaryKeySelective(AttrCopyUtils.copy(dto, new ServiceWorker())); return this.updateByPrimaryKeySelective(AttrCopyUtils.copy(dto, new ServiceWorker()));
} }
...@@ -96,7 +96,7 @@ public class ServiceWorkerService extends AbstractMapper<ServiceWorker> { ...@@ -96,7 +96,7 @@ public class ServiceWorkerService extends AbstractMapper<ServiceWorker> {
public int delete(Long id, Long userId) { public int delete(Long id, Long userId) {
log.info("worker delete id: {}, userId: {}", id, userId); log.info("worker delete id: {}, userId: {}", id, userId);
checkAuth(userId); // checkAuth(userId);
return this.deleteByPrimaryKey(id); return this.deleteByPrimaryKey(id);
} }
......
...@@ -13,7 +13,7 @@ project: ...@@ -13,7 +13,7 @@ project:
enabled: true # 是否开启jwt拦截 enabled: true # 是否开启jwt拦截
secret: b25zaXRlLXNlcnZpY2UtYWRtaW4tYmFzZTY0LXNlY3JldA== secret: b25zaXRlLXNlcnZpY2UtYWRtaW4tYmFzZTY0LXNlY3JldA==
issuer: onsite-service-admin issuer: onsite-service-admin
expires-time: 86400 # 1天有效期 秒 expires-time: 8640000 # 1天有效期 秒
# 无需授权url资源 # 无需授权url资源
ant-paths: "/error,/websocket/**,/api,/token/base,/monitor/**,/dict,/login,/doc.html,/webjars/**,/swagger**, ant-paths: "/error,/websocket/**,/api,/token/base,/monitor/**,/dict,/login,/doc.html,/webjars/**,/swagger**,
/swagger-resources/configuration/ui,/**/v2/api-docs" /swagger-resources/configuration/ui,/**/v2/api-docs"
......
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")));
}
}
...@@ -40,7 +40,7 @@ public enum BizCodeEnum { ...@@ -40,7 +40,7 @@ public enum BizCodeEnum {
* 维修工模块 * 维修工模块
*/ */
SERVICE_WORKER_NOT_EXIST("维修工不存在"), SERVICE_WORKER_NOT_EXIST("维修工不存在"),
SERVICE_WORKER_HAS_EXIST("该手机号对应维修工已存在"), SERVICE_WORKER_HAS_EXIST("该手机号对应工作人员已存在"),
/** /**
* 估价员模块 * 估价员模块
......
...@@ -36,7 +36,7 @@ public class ServiceWorker implements Serializable { ...@@ -36,7 +36,7 @@ public class ServiceWorker implements Serializable {
* 维修工类型 * 维修工类型
*/ */
@ApiModelProperty("维修工类型") @ApiModelProperty("维修工类型")
private Boolean kind; private Integer kind;
/** /**
* 创建时间 * 创建时间
......
...@@ -125,7 +125,7 @@ public class ServiceOrderController { ...@@ -125,7 +125,7 @@ public class ServiceOrderController {
} }
@ApiOperation(value = "订单流程图") @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) { public Result<List<ServiceOrderLogVO>> process(@ApiParam(name = "id", value = "订单id") @PathVariable @Positive Long id, @CurrentUserId Long userId) {
return success(serviceOrderService.process(id, userId)); return success(serviceOrderService.process(id, userId));
} }
......
...@@ -20,7 +20,7 @@ import java.util.Map; ...@@ -20,7 +20,7 @@ import java.util.Map;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = MiniAppApplication.class) @SpringBootTest(classes = MiniAppApplication.class)
@Log4j2 @Log4j2
public class JwtTest { public class MiniAppJwtTest {
@Test @Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment