From d179dbbf49304ca56392f3277c7bf84bcc507b57 Mon Sep 17 00:00:00 2001 From: x_z Date: Wed, 11 Jan 2023 16:05:01 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96=E7=94=A8?= =?UTF-8?q?=E6=88=B7ID=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/glxp/api/service/auth/CustomerService.java | 14 ++++++++++++-- .../basic/impl/BasicBusTypePreServiceImpl.java | 14 ++++++++++++++ .../mybatis/mapper/basic/BasicBusTypePreDao.xml | 2 +- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/glxp/api/service/auth/CustomerService.java b/src/main/java/com/glxp/api/service/auth/CustomerService.java index 07b485c2..7d58d638 100644 --- a/src/main/java/com/glxp/api/service/auth/CustomerService.java +++ b/src/main/java/com/glxp/api/service/auth/CustomerService.java @@ -1,14 +1,13 @@ package com.glxp.api.service.auth; +import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.exception.JsonException; -import com.glxp.api.common.enums.ResultEnum; import org.springframework.stereotype.Service; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; -import javax.naming.Name; import javax.servlet.http.HttpServletRequest; @Service @@ -34,6 +33,17 @@ public class CustomerService { return Integer.parseInt(userId); } + public String getUserIdStr() { + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + + if (attributes == null) { + throw new JsonException(ResultEnum.NOT_NETWORK); + } + HttpServletRequest request = attributes.getRequest(); + String userId = request.getHeader("ADMIN_ID"); + return userId; + } + public String getUserName() { Integer userId = getUserId(); AuthAdmin authAdmin = authAdminService.findById(userId.longValue()); diff --git a/src/main/java/com/glxp/api/service/basic/impl/BasicBusTypePreServiceImpl.java b/src/main/java/com/glxp/api/service/basic/impl/BasicBusTypePreServiceImpl.java index c6e0319a..4867a06c 100644 --- a/src/main/java/com/glxp/api/service/basic/impl/BasicBusTypePreServiceImpl.java +++ b/src/main/java/com/glxp/api/service/basic/impl/BasicBusTypePreServiceImpl.java @@ -4,12 +4,14 @@ import com.github.pagehelper.PageHelper; import com.glxp.api.dao.basic.BasicBusTypePreDao; import com.glxp.api.entity.basic.BasicBusTypePreEntity; import com.glxp.api.req.basic.FilterBusTypeChangeRequest; +import com.glxp.api.service.auth.CustomerService; import com.glxp.api.service.basic.IBasicBusTypePreService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.Date; import java.util.List; @Slf4j @@ -19,6 +21,8 @@ public class BasicBusTypePreServiceImpl implements IBasicBusTypePreService { @Resource private BasicBusTypePreDao basicBusTypePreDao; + @Resource + private CustomerService customerService; @Override public List filterAll(FilterBusTypeChangeRequest busTypeChangeFilterRequest) { @@ -47,4 +51,14 @@ public class BasicBusTypePreServiceImpl implements IBasicBusTypePreService { public boolean insertBusChangeType(BasicBusTypePreEntity basicBusTypePreEntity) { return false; } + + /** + * 设置创建/更新信息 + * + * @param basicBusTypePreEntity + */ + private void setUpdateInfo(BasicBusTypePreEntity basicBusTypePreEntity) { + Date now = new Date(); + + } } diff --git a/src/main/resources/mybatis/mapper/basic/BasicBusTypePreDao.xml b/src/main/resources/mybatis/mapper/basic/BasicBusTypePreDao.xml index 751597f9..a58a8356 100644 --- a/src/main/resources/mybatis/mapper/basic/BasicBusTypePreDao.xml +++ b/src/main/resources/mybatis/mapper/basic/BasicBusTypePreDao.xml @@ -3,6 +3,6 @@ \ No newline at end of file