1、对外接口开放

beetlsql3-dev
陈沅 1 year ago
parent e1f24bef0a
commit 3e1dcd6c84

@ -7,6 +7,7 @@ import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
import java.util.Map;
// 实际可以不用加Repository注解调用的地方注入时候Idea会报红看着难受
@Repository
@ -15,20 +16,29 @@ public interface CoreUserDao extends BaseMapper<CoreUser> {
/**
*
*
* @param roleCode
* @return
*/
List<CoreUser> getUserByRole( String roleCode);
List<CoreUser> getUserByRole(String roleCode);
/**
*
*
* @param startDate
* @param endDate
* @param orgId ID
* @param startDate
* @param endDate
* @param orgId ID
* @return
*/
Long getSumLoginCount(Date startDate, Date endDate, Long orgId);
/**
*
*
* @param username
* @param pwd
* @return
*/
Map<String, Object> getUserByUsernameAndPwd(String username, String pwd);
}

@ -16,7 +16,6 @@ import java.util.Date;
*
*
*/
public class CoreUser extends BaseEntity implements AbstractToken {
private static final long serialVersionUID = -6531326861708584365L;

@ -24,6 +24,7 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
import java.util.Map;
import static cn.hutool.core.util.ObjectUtil.defaultIfBlank;
import static cn.hutool.core.util.ObjectUtil.defaultIfNull;
@ -246,5 +247,10 @@ public class CoreUserService extends CoreBaseService<CoreUser> {
// consumer.accept(id);
// return id;
// }
/**
*
*/
public Map<String,Object> getUserByUsernameAndPwd(String username,String password){
return coreUserDao.getUserByUsernameAndPwd(username,password);
}
}

@ -21,7 +21,31 @@ getSumLoginCount
@if(!isEmpty(orgId)) {
and t.org_id = #orgId#
@}
getUserByUsernameAndPwd
===
SELECT
core_user.ID AS userId,
core_user.NAME AS NAME,
core_role.NAME AS roleName,
universities_colleges.universities_colleges_id AS schoolId,
school_class.class_id AS classId,
university_system.university_system_id AS majorId,
university_system.university_system_name AS majorName,
school_class.class_name AS className,
universities_colleges.universities_colleges_name AS schoolName,
university_faculty.university_faculty_id AS collegeId,
university_faculty.university_faculty_name AS collegeName
FROM
core_user
JOIN student ON core_user.CODE = student.student_sn
JOIN universities_colleges ON core_user.ORG_ID = universities_colleges.org_id
JOIN school_class ON student.class_id = school_class.class_id
JOIN university_faculty ON school_class.university_faculty_id = university_faculty.university_faculty_id
JOIN university_system ON school_class.university_system_id = university_system.university_system_id
JOIN core_user_role ON core_user_role.USER_ID = core_user.ID
JOIN core_role ON core_user_role.ROLE_ID = core_role.ID
WHERE
core_user.CODE = #username#
AND PASSWORD = #pwd#

@ -35,15 +35,23 @@ import static com.ibeetl.admin.core.conf.MVCConf.DEFAULT_APP_NAME;
@SuppressWarnings("ALL")
public class InterceptorConfig implements WebMvcConfigurer, InitializingBean {
@Autowired private GetSCoreUser getSCoreUser;
@Autowired private GetFile getFile;
@Autowired private GetTStudent getTStudent;
@Autowired private GetTTeacher getTTeacher;
@Autowired private GetReferer getReferer;
@Autowired private GetIp getIp;
@Autowired
private GetSCoreUser getSCoreUser;
@Autowired
private GetFile getFile;
@Autowired
private GetTStudent getTStudent;
@Autowired
private GetTTeacher getTTeacher;
@Autowired
private GetReferer getReferer;
@Autowired
private GetIp getIp;
@Autowired private WebSessionInterceptor webSessionInterceptor;
@Autowired private AuthenticationInterceptor authenticationInterceptor;
@Autowired
private WebSessionInterceptor webSessionInterceptor;
@Autowired
private AuthenticationInterceptor authenticationInterceptor;
@Autowired
Environment environment;
@ -60,9 +68,9 @@ public class InterceptorConfig implements WebMvcConfigurer, InitializingBean {
static {
MVCConf.p = p;
try{
u = "/"+ResourceBundle.getBundle("application").getString("server.servlet.context-path");
}catch (Exception e){
try {
u = "/" + ResourceBundle.getBundle("application").getString("server.servlet.context-path");
} catch (Exception e) {
u = "";
}
}
@ -103,7 +111,8 @@ public class InterceptorConfig implements WebMvcConfigurer, InitializingBean {
// 对外暴露的接口,全部放开
"/**/externalApi/**",
"/wx",
"/test/**"
"/test/**",
"/account/**"
// "/upload/**"
)
.excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**").order(1);
@ -115,20 +124,20 @@ public class InterceptorConfig implements WebMvcConfigurer, InitializingBean {
//配置图片访问路径转换
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry){
log.info("路径1 "+p);
if(p.contains("file:")){
registry.addResourceHandler("/filesystem/courseInfo/**").addResourceLocations(p+"/filesystem/courseInfo/");
registry.addResourceHandler("/filesystem/temp/**").addResourceLocations(p+"/filesystem/temp/");
registry.addResourceHandler("/filesystem/zip/**").addResourceLocations(p+"/filesystem/zip/");
registry.addResourceHandler("/images/**").addResourceLocations(p+"/filesystem/product/images/");
registry.addResourceHandler("/**/MP*.txt").addResourceLocations(p+"/filesystem/temp/");
}else {
registry.addResourceHandler("/filesystem/courseInfo/**").addResourceLocations("file:/"+p+"/filesystem/courseInfo/");
registry.addResourceHandler("/filesystem/temp/**").addResourceLocations("file:/"+p+"/filesystem/temp/");
registry.addResourceHandler("/filesystem/zip/**").addResourceLocations("file:/"+p+"/filesystem/zip/");
registry.addResourceHandler("/images/**").addResourceLocations("file:/"+p+"/filesystem/product/images/");
registry.addResourceHandler("/**/MP*.txt").addResourceLocations("file:/"+p+"/filesystem/temp/");
public void addResourceHandlers(ResourceHandlerRegistry registry) {
log.info("路径1 " + p);
if (p.contains("file:")) {
registry.addResourceHandler("/filesystem/courseInfo/**").addResourceLocations(p + "/filesystem/courseInfo/");
registry.addResourceHandler("/filesystem/temp/**").addResourceLocations(p + "/filesystem/temp/");
registry.addResourceHandler("/filesystem/zip/**").addResourceLocations(p + "/filesystem/zip/");
registry.addResourceHandler("/images/**").addResourceLocations(p + "/filesystem/product/images/");
registry.addResourceHandler("/**/MP*.txt").addResourceLocations(p + "/filesystem/temp/");
} else {
registry.addResourceHandler("/filesystem/courseInfo/**").addResourceLocations("file:/" + p + "/filesystem/courseInfo/");
registry.addResourceHandler("/filesystem/temp/**").addResourceLocations("file:/" + p + "/filesystem/temp/");
registry.addResourceHandler("/filesystem/zip/**").addResourceLocations("file:/" + p + "/filesystem/zip/");
registry.addResourceHandler("/images/**").addResourceLocations("file:/" + p + "/filesystem/product/images/");
registry.addResourceHandler("/**/MP*.txt").addResourceLocations("file:/" + p + "/filesystem/temp/");
}
}
@ -170,9 +179,9 @@ public class InterceptorConfig implements WebMvcConfigurer, InitializingBean {
@Override
public void afterPropertiesSet() throws Exception {
Map<String, Object> var = new HashMap<>(5);
String appName = environment.getProperty("app.name");
if(appName==null) {
var.put("appName",DEFAULT_APP_NAME);
String appName = environment.getProperty("app.name");
if (appName == null) {
var.put("appName", DEFAULT_APP_NAME);
}
var.put("jsVer", System.currentTimeMillis());

@ -0,0 +1,46 @@
package com.ibeetl.jlw.web;
import com.ibeetl.admin.core.entity.CoreUser;
import com.ibeetl.admin.core.service.CoreUserService;
import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.jlw.entity.ResourcesApplication;
import com.ibeetl.jlw.service.ResourcesApplicationService;
import com.ibeetl.jlw.web.query.ResourcesApplicationQuery;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@Api(tags = "对外开放接口")
@RestController
@RequestMapping("account")
public class AccountController {
@Autowired
private ResourcesApplicationService resourcesApplicationService;
@Autowired
private CoreUserService userService;
@ApiOperation("查询应用信息")
@GetMapping("findApplications")
public JsonResult<ResourcesApplication> findApplications() {
ResourcesApplication info = resourcesApplicationService.getInfo(new ResourcesApplicationQuery());
resourcesApplicationService.makeApplicationLinkRealUrl(new ResourcesApplicationQuery(), new CoreUser(), info);
resourcesApplicationService.hiddenKey(new ResourcesApplicationQuery(), info);
// sysLogService.applicationLogPoint(info.getRealUrl());
return JsonResult.success(info);
}
@ApiOperation("对外提供接口--根据账号密码查询用户")
@PostMapping("findByUsernameAndPwd.json")
public JsonResult<Map<String, Object>> findByUsernameAndPwd(String username, String password) {
Map<String, Object> objectMap = userService.getUserByUsernameAndPwd(username, password);
return JsonResult.success(objectMap);
}
}
Loading…
Cancel
Save