更新本地js
This commit is contained in:
150
src/main/java/com/mini/capi/api/biz/bizController.java
Normal file
150
src/main/java/com/mini/capi/api/biz/bizController.java
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
package com.mini.capi.api.biz;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.mini.capi.biz.domain.*;
|
||||||
|
import com.mini.capi.biz.service.*;
|
||||||
|
import com.mini.capi.config.TokenBean;
|
||||||
|
import com.mini.capi.model.ApiResult;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/bizApi")
|
||||||
|
public class bizController {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BizProvinceService bizProvinceService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BizCitiesService bizCitiesService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BizCompanyService bizCompanyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BizDbConfigService bizDbConfigService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BizProjectInfoService bizProjectInfoService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BizProjectReportService bizProjectReportService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BizResumeEmployeeService bizResumeEmployeeService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ErpAccountService erpAccountService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ErpCategoryService erpCategoryService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TokenBean vToken;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务列表
|
||||||
|
*/
|
||||||
|
@GetMapping("getBizList")
|
||||||
|
public ApiResult<?> getBizList(String token, String tableName) {
|
||||||
|
if (vToken.isValidToken(token)) {
|
||||||
|
switch (tableName) {
|
||||||
|
case "BizProvince":
|
||||||
|
List<BizProvince> provinces = bizProvinceService.list();
|
||||||
|
List<BizProvince> sortedProvinces = provinces.stream()
|
||||||
|
.sorted(Comparator.nullsLast(
|
||||||
|
Comparator.comparing(BizProvince::getCreateTime).reversed()
|
||||||
|
))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return ApiResult.success(sortedProvinces);
|
||||||
|
case "BizCities":
|
||||||
|
List<BizCities> cities = bizCitiesService.list();
|
||||||
|
List<BizCities> sortedCities = cities.stream()
|
||||||
|
.sorted(Comparator.nullsLast(
|
||||||
|
Comparator.comparing(BizCities::getCreateTime).reversed()
|
||||||
|
))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return ApiResult.success(sortedCities);
|
||||||
|
case "BizCompany":
|
||||||
|
List<BizCompany> companies = bizCompanyService.list();
|
||||||
|
List<BizCompany> sortedCompanies = companies.stream()
|
||||||
|
.sorted(Comparator.nullsLast(
|
||||||
|
Comparator.comparing(BizCompany::getCreateTime).reversed()
|
||||||
|
))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return ApiResult.success(sortedCompanies);
|
||||||
|
case "BizDbConfig":
|
||||||
|
List<BizDbConfig> dbConfigs = bizDbConfigService.list();
|
||||||
|
List<BizDbConfig> sortedDbConfigs = dbConfigs.stream()
|
||||||
|
.sorted(Comparator.nullsLast(
|
||||||
|
Comparator.comparing(BizDbConfig::getCreateTime).reversed()
|
||||||
|
))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return ApiResult.success(sortedDbConfigs);
|
||||||
|
case "BizProjectInfo":
|
||||||
|
List<BizProjectInfo> projectInfos = bizProjectInfoService.list();
|
||||||
|
List<BizProjectInfo> sortedProjectInfos = projectInfos.stream()
|
||||||
|
.sorted(Comparator.nullsLast(
|
||||||
|
Comparator.comparing(BizProjectInfo::getCreateTime).reversed()
|
||||||
|
))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return ApiResult.success(sortedProjectInfos);
|
||||||
|
case "BizProjectReport":
|
||||||
|
List<BizProjectReport> projectReports = bizProjectReportService.list();
|
||||||
|
List<BizProjectReport> sortedProjectReports = projectReports.stream()
|
||||||
|
.sorted(Comparator.nullsLast(
|
||||||
|
Comparator.comparing(BizProjectReport::getCreateTime).reversed()
|
||||||
|
))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return ApiResult.success(sortedProjectReports);
|
||||||
|
case "BizResumeEmployee":
|
||||||
|
List<BizResumeEmployee> employees = bizResumeEmployeeService.list();
|
||||||
|
List<BizResumeEmployee> sortedEmployees = employees.stream()
|
||||||
|
.sorted(Comparator.nullsLast(
|
||||||
|
Comparator.comparing(BizResumeEmployee::getCreateTime).reversed()
|
||||||
|
))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return ApiResult.success(sortedEmployees);
|
||||||
|
default:
|
||||||
|
return ApiResult.success(List.of());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ApiResult.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易账号
|
||||||
|
*/
|
||||||
|
@GetMapping("getErpAccount")
|
||||||
|
public ApiResult<?> getErpAccount(String token) {
|
||||||
|
if (vToken.isValidToken(token)) {
|
||||||
|
List<ErpAccount> erpAccounts = erpAccountService.list();
|
||||||
|
return ApiResult.success(erpAccounts);
|
||||||
|
}
|
||||||
|
return ApiResult.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账单分类列表
|
||||||
|
*/
|
||||||
|
@GetMapping("getErpCategory")
|
||||||
|
public ApiResult<?> getErpCategory(String token, String categoryType) {
|
||||||
|
if (vToken.isValidToken(token)) {
|
||||||
|
QueryWrapper<ErpCategory> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("category_type", categoryType);
|
||||||
|
List<ErpCategory> categories = erpCategoryService.list(queryWrapper);
|
||||||
|
return ApiResult.success(categories);
|
||||||
|
}
|
||||||
|
return ApiResult.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,6 @@ public class TokenBean {
|
|||||||
private String defaultToken;
|
private String defaultToken;
|
||||||
|
|
||||||
public boolean isValidToken(String token) {
|
public boolean isValidToken(String token) {
|
||||||
return !defaultToken.equals(token);
|
return defaultToken.equals(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|||||||
"/images/**", // 放行images目录
|
"/images/**", // 放行images目录
|
||||||
"/v1/**", // 放行v1目录
|
"/v1/**", // 放行v1目录
|
||||||
"/v2/**",
|
"/v2/**",
|
||||||
|
"/bizApi/**",
|
||||||
"/erpApi/**",
|
"/erpApi/**",
|
||||||
"/appApi/**",
|
"/appApi/**",
|
||||||
"/jobApi/**"
|
"/jobApi/**"
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.mini.capi.utils;
|
|
||||||
|
|
||||||
import com.mini.capi.config.TokenBean;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
|
|
||||||
public class vToken {
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private TokenBean tokenConfig;
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isValidToken(String token) {
|
|
||||||
|
|
||||||
return tokenConfig.isValidToken(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user