From 104c27539efc337a9721fd6fa6b7cf30f3cd8142 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Tue, 13 Jun 2023 17:08:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/auth/LoginController.java | 12 +++++-- .../controller/sup/UserComanyController.java | 5 +++ .../controller/sup/UserOnLineController.java | 2 ++ .../controller/trace/TraceTaskController.java | 1 + .../controller/trace/UdiTraceController.java | 12 ++++--- .../com/glxp/api/req/auth/LoginRequest.java | 3 ++ .../api/req/trace/TraceRecordRequest.java | 33 ++++++++++--------- src/main/resources/application-dev.yml | 4 +-- 8 files changed, 48 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/auth/LoginController.java b/src/main/java/com/glxp/api/controller/auth/LoginController.java index 4daf6b7..71735b6 100644 --- a/src/main/java/com/glxp/api/controller/auth/LoginController.java +++ b/src/main/java/com/glxp/api/controller/auth/LoginController.java @@ -10,6 +10,8 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; @@ -59,7 +61,7 @@ import springfox.documentation.annotations.ApiIgnore; * 登录相关 */ -@ApiIgnore +@Api(tags = "用户登录接口") @RestController @Slf4j public class LoginController extends BaseController { @@ -86,6 +88,7 @@ public class LoginController extends BaseController { * * @return */ + @ApiOperation("系统用户登录") @PostMapping(value = "/login") public BaseResponse index(@RequestBody @Valid LoginRequest loginRequest, BindingResult bindingResult, @@ -150,6 +153,7 @@ public class LoginController extends BaseController { * * @return */ + @ApiIgnore @PostMapping(value = "/pc/login") public BaseResponse pcLogin(@RequestBody @Valid PCLoginRequest loginRequest, BindingResult bindingResult, @@ -217,6 +221,7 @@ public class LoginController extends BaseController { @Resource ISysRoleService sysRoleService; + @ApiIgnore @AuthRuleAnnotation("") @GetMapping("/getInfo") public BaseResponse getUserInfo(HttpServletRequest request) { @@ -228,7 +233,7 @@ public class LoginController extends BaseController { CompanyEntity companyEntity = companyService.findCompany(); loginUserInfoResponse.setCompanyName(companyEntity.getName()); loginUserInfoResponse.setLocDeptName(deptService.getInvName(loginUserInfoResponse.getLocDeptCode())); - // 角色集合 + // 角色集合 Set roles = sysPermissionService.getRolePermission(authAdmin); List sysRoles = sysRoleService.selectRolesByUserId(id); @@ -245,6 +250,7 @@ public class LoginController extends BaseController { @Resource ISysMenuService menuService; + @ApiIgnore @GetMapping("/spms/getRouters") public BaseResponse getRouters() { AuthAdmin authAdmin = getUser(); @@ -257,6 +263,7 @@ public class LoginController extends BaseController { * * @return */ + @ApiOperation("系统用户登出") @PostMapping("/admin/auth/login/out") public BaseResponse out() { return ResultVOUtils.success(); @@ -267,6 +274,7 @@ public class LoginController extends BaseController { * * @return */ + @ApiIgnore @AuthRuleAnnotation("") // 需要登录验证,但是不需要权限验证时,value 值填空字符串 @PostMapping("/admin/auth/login/password") public BaseResponse password(@RequestBody @Valid UpdatePasswordRequest updatePasswordRequest, diff --git a/src/main/java/com/glxp/api/controller/sup/UserComanyController.java b/src/main/java/com/glxp/api/controller/sup/UserComanyController.java index c46b685..9785ca2 100644 --- a/src/main/java/com/glxp/api/controller/sup/UserComanyController.java +++ b/src/main/java/com/glxp/api/controller/sup/UserComanyController.java @@ -74,6 +74,11 @@ public class UserComanyController extends BaseController { @Resource UserCompanyOnlineService userCompanyOnlineService; + /** + * 查询企业账号列表,包含客户端在线状态 + * @param filterUserComapanyRequest + * @return + */ @AuthRuleAnnotation("") @GetMapping("udi/auth/user/comapny/status/filter") public BaseResponse filterCompanyStaus(FilterUserComapanyRequest filterUserComapanyRequest) { diff --git a/src/main/java/com/glxp/api/controller/sup/UserOnLineController.java b/src/main/java/com/glxp/api/controller/sup/UserOnLineController.java index 1a83861..d9b87ef 100644 --- a/src/main/java/com/glxp/api/controller/sup/UserOnLineController.java +++ b/src/main/java/com/glxp/api/controller/sup/UserOnLineController.java @@ -6,6 +6,7 @@ import com.glxp.api.entity.sup.UserCompanyOnlineEntity; import com.glxp.api.req.sup.UserCompanyOnlineRequest; import com.glxp.api.service.sup.UserCompanyOnlineService; import com.glxp.api.util.BeanCopyUtils; +import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +@Api(tags = "心跳任务接口") @RestController @Slf4j public class UserOnLineController { diff --git a/src/main/java/com/glxp/api/controller/trace/TraceTaskController.java b/src/main/java/com/glxp/api/controller/trace/TraceTaskController.java index 64917dc..619b881 100644 --- a/src/main/java/com/glxp/api/controller/trace/TraceTaskController.java +++ b/src/main/java/com/glxp/api/controller/trace/TraceTaskController.java @@ -12,6 +12,7 @@ import com.glxp.api.res.trace.TraceTaskDlResponse; import com.glxp.api.service.trace.TraceTaskService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.GetMapping; diff --git a/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java b/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java index 965c4ce..80003c9 100644 --- a/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java +++ b/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java @@ -17,7 +17,10 @@ import com.glxp.api.entity.basic.UdiEntity; import com.glxp.api.entity.sup.UserCompanyEntity; import com.glxp.api.entity.trace.*; import com.glxp.api.req.basic.FilterUdiRelRequest; -import com.glxp.api.req.trace.*; +import com.glxp.api.req.trace.TraceManuDetailRequest; +import com.glxp.api.req.trace.TraceManuOrderUploadRequest; +import com.glxp.api.req.trace.TraceOrderUploadRequest; +import com.glxp.api.req.trace.TraceRecordRequest; import com.glxp.api.res.basic.BasicUdiRelResponse; import com.glxp.api.res.trace.TraceSearchReponse; import com.glxp.api.service.basic.BasicUdiRelService; @@ -84,9 +87,10 @@ public class UdiTraceController extends BaseController { @Resource private final RabbitTemplate rabbitTemplate; - @PostMapping("/udi/trace/source/message") - public BaseResponse sendMessage(@RequestBody MqTraceMessage mqTraceMessage) { - String messageJson = JSON.toJSONString(mqTraceMessage); + @ApiIgnore + @GetMapping("/udi/trace/source/sendUDI") + public BaseResponse sendUdi(@RequestBody TraceRecordRequest traceRecordRequest) { + String messageJson = JSON.toJSONString(traceRecordRequest); System.out.println(messageJson); rabbitTemplate.convertAndSend("trace.topic.exchange", TopicRabbitConfig.common, messageJson); return ResultVOUtils.success("发送成功"); diff --git a/src/main/java/com/glxp/api/req/auth/LoginRequest.java b/src/main/java/com/glxp/api/req/auth/LoginRequest.java index 0a24eca..af7952c 100644 --- a/src/main/java/com/glxp/api/req/auth/LoginRequest.java +++ b/src/main/java/com/glxp/api/req/auth/LoginRequest.java @@ -1,5 +1,6 @@ package com.glxp.api.req.auth; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotEmpty; @@ -10,9 +11,11 @@ import javax.validation.constraints.NotEmpty; @Data public class LoginRequest { + @ApiModelProperty(value = "用户账号", required = true) @NotEmpty(message = "用户名不能为空") private String username; + @ApiModelProperty(value = "用户密码", required = true) @NotEmpty(message = "密码不能为空") private String password; diff --git a/src/main/java/com/glxp/api/req/trace/TraceRecordRequest.java b/src/main/java/com/glxp/api/req/trace/TraceRecordRequest.java index 8e15362..5804c13 100644 --- a/src/main/java/com/glxp/api/req/trace/TraceRecordRequest.java +++ b/src/main/java/com/glxp/api/req/trace/TraceRecordRequest.java @@ -11,91 +11,92 @@ import java.util.Date; @ApiModel("追踪记录请求") public class TraceRecordRequest extends ListPageRequest { - @ApiModelProperty(value = "主键") + @ApiModelProperty(hidden = true) private Long id; /** * 查询记录号 */ - @ApiModelProperty(value = "查询记录号") + @ApiModelProperty(hidden = true) private String recordCode; /** * 查询来源 */ - @ApiModelProperty(value = "查询来源") + @ApiModelProperty(value = "查询来源:1.网页;2:小程序", required = true) private Integer fromType; /** * 查询者 */ - @ApiModelProperty(value = "查询者") + @ApiModelProperty(value = "查询者", required = true) private String createUser; /** * 查询记录时间 */ - @ApiModelProperty(value = "查询记录时间") + @ApiModelProperty(hidden = true) private Date createTime; /** * 更新时间 */ - @ApiModelProperty(value = "更新时间") + @ApiModelProperty(hidden = true) private Date updateTime; /** * 查询方式(1:源头查询;2:现在检查查询) */ - @ApiModelProperty(value = "查询方式(1:源头查询;2:现在检查查询)") + @ApiModelProperty(hidden = true) private Integer traceSource; /** * 查询方案(按UDI码查询/按批次号查询) */ - @ApiModelProperty(value = "查询方案(按UDI码查询/按批次号查询)") + @ApiModelProperty(value = "查询方案(按UDI码查询/按批次号查询)", required = true) private Integer traceType; /** * UDI码 */ - @ApiModelProperty(value = "UDI码") + @ApiModelProperty(value = "UDI码", required = true) private String udiCode; /** * 社会信用号 */ - @ApiModelProperty(value = "社会信用号") + @ApiModelProperty(value = "社会信用号", required = true) private String creditNum; /** * 注册备案人 */ - @ApiModelProperty(value = "注册备案人") + @ApiModelProperty(value = "注册备案人", required = true) private String ylqxzcrbarmc; /** * 产品主DI标识 */ - @ApiModelProperty(value = "产品主DI标识") + @ApiModelProperty(value = "产品主DI标识", required = true) private String nameCode; /** * 产品通用名 */ - @ApiModelProperty(value = "产品通用名") + @ApiModelProperty(value = "产品通用名", required = true) private String cpmctymc; /** * 规格型号 */ - @ApiModelProperty(value = "规格型号") + @ApiModelProperty(value = "规格型号", required = true) private String ggxh; /** * 生产批次号 */ - @ApiModelProperty(value = "生产批次号") + @ApiModelProperty(value = "生产批次号", required = true) private String batchNo; - @ApiModelProperty(value = "企业id") + + @ApiModelProperty(value = "注册企业ID", required = true) private Long companyId; diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 8b65c9e..36de819 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -4,9 +4,9 @@ server: spring: datasource: driver-class-name: com.p6spy.engine.spy.P6SpyDriver - jdbc-url: jdbc:p6spy:mysql://192.168.0.66:3364/udi_cpt?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true + jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_cpt?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true username: root - password: Glxp@6066 + password: 123456 hikari: connection-timeout: 60000 maximum-pool-size: 20