1.添加获取用户ID字符串工具方法

master
x_z 2 years ago
parent 2826e138c0
commit d179dbbf49

@ -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());

@ -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<BasicBusTypePreEntity> 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();
}
}

@ -3,6 +3,6 @@
<mapper namespace="com.glxp.api.dao.basic.BasicBusTypePreDao">
<select id="selectList" resultType="com.glxp.api.entity.basic.BasicBusTypePreEntity">
select * from basic_bustype_pre
</select>
</mapper>
Loading…
Cancel
Save