最新代码提交

dev
wj 2 years ago
parent 2e0faa0aad
commit 4cdc5c3475

@ -37,10 +37,14 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<!--让配置文件有提示-->
@ -79,7 +83,7 @@
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.9</version>
<version>3.0.3</version>
</dependency>
<!--数据库相关-->
@ -308,6 +312,13 @@
<artifactId>sa-token-dao-redis-jackson</artifactId>
<version>1.34.0</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.6.7</version>
</dependency>
</dependencies>
<build>

@ -1,19 +1,37 @@
package com.glxp.udi.admin.config;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.boot.actuate.autoconfigure.endpoint.web.CorsEndpointProperties;
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementPortType;
import org.springframework.boot.actuate.endpoint.ExposableEndpoint;
import org.springframework.boot.actuate.endpoint.web.*;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@Profile({"test", "dev"})
@EnableKnife4j
@Configuration
@EnableSwagger2WebMvc
@EnableSwagger2
@Import(BeanValidatorPluginsConfiguration.class)
public class Knife4jConfiguration {
@ -32,9 +50,25 @@ public class Knife4jConfiguration {
.build())
.select()
//这里指定Controller扫描包路径
.apis(RequestHandlerSelectors.basePackage("com.glxp.api.admin.controller"))
.apis(RequestHandlerSelectors.basePackage("com.glxp.udi.admin.controller"))
.paths(PathSelectors.any())
.build();
return docket;
}
@Bean
public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(
WebEndpointsSupplier webEndpointsSupplier, ServletEndpointsSupplier servletEndpointsSupplier,
ControllerEndpointsSupplier controllerEndpointsSupplier, EndpointMediaTypes endpointMediaTypes,
CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties, Environment environment) {
List<ExposableEndpoint<?>> allEndpoints = new ArrayList<>();
Collection<ExposableWebEndpoint> webEndpoints = webEndpointsSupplier.getEndpoints();
allEndpoints.addAll(webEndpoints);
allEndpoints.addAll(servletEndpointsSupplier.getEndpoints());
allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints());
String basePath = webEndpointProperties.getBasePath();
EndpointMapping endpointMapping = new EndpointMapping(basePath);
boolean shouldRegisterLinksMapping = webEndpointProperties.getDiscovery().isEnabled() &&
(org.springframework.util.StringUtils.hasText(basePath) || ManagementPortType.get(environment).equals(ManagementPortType.DIFFERENT));
return new WebMvcEndpointHandlerMapping(endpointMapping, webEndpoints, endpointMediaTypes, corsProperties.toCorsConfiguration(), new EndpointLinksResolver(allEndpoints, basePath), shouldRegisterLinksMapping, null);
}
}

@ -2,14 +2,21 @@ package com.glxp.udi.admin.config.saToken;
import cn.dev33.satoken.config.SaTokenConfig;
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.exception.NotLoginException;
import cn.dev33.satoken.exception.NotPermissionException;
import cn.dev33.satoken.filter.SaServletFilter;
import cn.dev33.satoken.router.SaRouter;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;
import cn.hutool.http.ContentType;
import cn.hutool.json.JSONUtil;
import com.glxp.udi.admin.common.enums.ResultEnum;
import com.glxp.udi.admin.common.util.ResultVOUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
@ -29,7 +36,8 @@ public class SaTokenConfigure {
config.setTimeout(24 * 60 * 60); // token有效期单位s 默认1天
config.setActivityTimeout(30 * 60); // token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
config.setIsConcurrent(false); // 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
config.setIsShare(true); // 在多人登录同一账号时是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
config.setMaxLoginCount(5); //同一账号最大登录数量,-1代表不限 (只有在 isConcurrent=true, isShare=false 时此配置才有效)
config.setIsShare(false); // 在多人登录同一账号时是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
config.setTokenStyle("simple-uuid"); // token风格
config.setIsLog(false); // 是否输出操作日志
config.setIsReadCookie(false);
@ -51,17 +59,20 @@ public class SaTokenConfigure {
// 指定 拦截路由 与 放行路由
.addInclude("/**")
.addExclude("/favicon.ico") /* 排除掉 /favicon.ico */
.addExclude("/favicon.ico","/","/actuator","/actuator/**","/v2/api-docs","/doc.html","/webjars/**","/swagger-resources") /* 排除掉 /favicon.ico */
// 认证函数: 每次请求执行
.setAuth(obj -> {
// 登录认证 -- 拦截所有路由,并排除白名单 用于开放登录
// SaRouter.match("/**", String.valueOf(whiteList), () -> StpUtil.checkLogin());
SaRouter.match("/**").notMatch(whiteList).check(() -> StpUtil.checkLogin());
})
// 异常处理函数:每次认证函数发生异常时执行此函数
.setError(e -> {
// SaHolder.getResponse().setHeader("Content-Type", ContentType.JSON.getValue() + ";charset=utf-8");
SaHolder.getResponse().setHeader("Content-Type", ContentType.build(ContentType.JSON, StandardCharsets.UTF_8));
if (e instanceof NotPermissionException) {
return JSONUtil.toJsonStr(ResultVOUtils.error(ResultEnum.AUTH_FAILED.getCode(), "没有权限"));
} else if (e instanceof NotLoginException) {
return JSONUtil.toJsonStr(ResultVOUtils.error(ResultEnum.LOGIN_VERIFY_FALL));
}
return SaResult.error(e.getMessage());
})

@ -24,7 +24,6 @@ public class StpInterfaceImpl implements StpInterface {
@Override
public List<String> getPermissionList(Object loginId, String loginType) {
List<String> list = authLoginService.listRuleByAdminId(NumberUtil.parseLong(loginId.toString()));
System.out.println(list);
return list;
}

@ -128,7 +128,11 @@ public class LoginController {
// 登录成功后获取权限,这里面会设置到缓存
List<String> list = authLoginService.listRuleByAdminId(authAdmin.getId());
StpUtil.login(authAdmin.getId());
String terminal = "PC";
if (StrUtil.isNotEmpty(loginRequest.getImei())) {
terminal = "IMEI";
}
StpUtil.login(authAdmin.getId(), terminal);
SaTokenInfo tokenInfo = StpUtil.getTokenInfo();
// Map<String, Object> claims = new HashMap<>();
// claims.put("admin_id", authAdmin.getId());

@ -2,6 +2,7 @@ package com.glxp.udi.admin.controller.info;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.glxp.udi.admin.annotation.AuthRuleAnnotation;
@ -38,7 +39,7 @@ public class PlatformController {
@Resource
private UnitMaintainService unitMaintainService;
@PostMapping("/udims/platform/remove")
public BaseResponse remove(@RequestBody PlatformEntity platformEntity) {
if (platformService.remove(platformEntity.getId()) > 0) {
@ -48,7 +49,6 @@ public class PlatformController {
}
@PostMapping("/udims/platform/update")
public BaseResponse update(@RequestBody PlatformEntity platformEntity) {
if (StrUtil.isBlank(platformEntity.getName()) || StrUtil.isBlank(platformEntity.getHost())) {
@ -57,7 +57,7 @@ public class PlatformController {
return platformService.update(platformEntity);
}
@GetMapping("/udims/platform/list")
public BaseResponse list(@RequestParam Map<String, Object> params) {
IPage<PlatformEntity> page = platformService.list(params);
@ -72,7 +72,7 @@ public class PlatformController {
*
* @return
*/
@PostMapping("/udims/platform/testUserInfo")
public BaseResponse testUserInfo(@RequestBody PlatformUserInfoRequest platformUserInfoRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
@ -102,10 +102,11 @@ public class PlatformController {
if (!String.valueOf(object.get("code")).equals(ResultEnum.SUCCESS.getCode().toString())) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, String.valueOf(object.get("message")));
}
return ResultVOUtils.success();
// return ResultVOUtils.success(JSON.parseObject(object.get("data").toString(), Map.class).get("invList"));
return ResultVOUtils.success(object.get("data"));
}
@PostMapping("/udims/platform/link")
public BaseResponse update(@RequestBody PlatformLinkRequest platformLinkRequest) {
//判断此数据是否重复
@ -136,6 +137,7 @@ public class PlatformController {
if (object != null && object.get("data") != null) {
Map<String, Object> data = JSON.parseObject(JSON.toJSONString(object.get("data")), Map.class);
log.error(JSON.toJSONString(object.get("data")));
data = JSON.parseObject(JSONUtil.toJsonStr(data.get("license")));
if (data.get("appid") != null) {
platformLinkRequest.setAppid(data.get("appid").toString());
if (data.get("apiKey") != null) {
@ -164,7 +166,7 @@ public class PlatformController {
/**
*
*/
@GetMapping("/udims/platform/getLinkPlatformList")
public BaseResponse getLinkPlatformList(PlatformLinkRequest platformLinkRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
@ -183,7 +185,7 @@ public class PlatformController {
* @param corpId
* @return
*/
@PostMapping("/udims/platform/unbind")
public BaseResponse unbindPlatform(DeleteRequest deleteRequest) {
if (StrUtil.isBlank(deleteRequest.getId())) {
@ -198,7 +200,7 @@ public class PlatformController {
*
* @return
*/
@GetMapping("/udims/platform/getTargetActions")
public BaseResponse getTargetActions(String platformId, String invSubCode) {
if (StrUtil.isBlank(platformId)) {
@ -208,7 +210,6 @@ public class PlatformController {
}
@GetMapping("/udims/platform/getTargetInv")
public BaseResponse getTargetInv(String platformId) {
if (StrUtil.isBlank(platformId)) {
@ -218,7 +219,6 @@ public class PlatformController {
}
@GetMapping("/udims/platform/getTargetSubInv")
public BaseResponse getTargetSubInv(String platformId, String invCode) {
if (StrUtil.isBlank(platformId)) {
@ -233,7 +233,7 @@ public class PlatformController {
* @param host
* @return
*/
@GetMapping("udims/platform/testPlatformConnection")
public BaseResponse testPlatformConnection(String host) {
if (StrUtil.isBlank(host)) {

@ -9,7 +9,6 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.glxp.udi.admin.annotation.AuthRuleAnnotation;
import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.constant.ConstantStatus;
import com.glxp.udi.admin.dao.inventory.InvWarehouseDao;
@ -328,7 +327,7 @@ public class OrderController {
BeanUtils.copyProperties(orderEntity, orderBean);
orderBean.setAction(unitMaintainPlatform.getTargetAction());
orderBean.setInvStorageCode(unitMaintainPlatform.getInvCode());
orderBean.setInvWarehouseCode(unitMaintainPlatform.getInvSubCode());
orderBean.setDeptCode(unitMaintainPlatform.getInvSubCode());
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setOrderId(orderEntity.getOrderId());
List<WarehouseEntity> warehouseEntities = warehouseService.filterWarehouse(warehouseQueryRequest);

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate;
@Data
@TableName("io_order_detail")
@ -107,6 +108,6 @@ public class OrderDetailEntity {
/**
*
*/
private String invoiceDate;
private LocalDate invoiceDate;
}

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
/**
@ -11,7 +12,7 @@ import lombok.Data;
*/
@Data
@TableName(value = "io_unit_maintain_platform")
public class UnitMaintainPlatform {
public class UnitMaintainPlatform extends Model<UnitMaintainPlatform> {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ -75,26 +76,4 @@ public class UnitMaintainPlatform {
*/
@TableField(value = "apiKey")
private String apiKey;
public static final String COL_ID = "id";
public static final String COL_UNITID = "unitId";
public static final String COL_CUSTOMERID = "customerId";
public static final String COL_PLATFORMID = "platformId";
public static final String COL_SOURCEACTION = "sourceAction";
public static final String COL_TARGETACTION = "targetAction";
public static final String COL_INVCODE = "invCode";
public static final String COL_INVSUBCODE = "invSubCode";
public static final String COL_APPID = "appid";
public static final String COL_APIKEY = "apiKey";
public static final String COL_SECRETKEY = "secretKey";
}

@ -3,6 +3,7 @@ package com.glxp.udi.admin.req.inout;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate;
/**
* udims
@ -29,7 +30,7 @@ public class PostUdimsOrderDetailRequest {
private String secSalesListNo;
//开票日期
private String invoiceDate;
private LocalDate invoiceDate;
}

@ -23,7 +23,7 @@ public class PostUdimsOrderRequest {
private String fromCorp;
private String remark;
private String invStorageCode;
private String invWarehouseCode;
private String deptCode;
private List<PostUdimsOrderDetailRequest> orderDetails;
private List<CodeBean> codes;

@ -39,7 +39,7 @@ public class AuthLoginService {
List<String> authRules = new ArrayList<>();
// 超级管理员
if (adminId.equals(1L)) {
authRules.add("admin/**");
authRules.add("*");
authRules.add("admin");
return authRules;
}

@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -256,17 +257,17 @@ public class PlatformService {
* @return
*/
public String verifyUnitMaintainPlatform(PlatformLinkRequest platformLinkRequest) {
QueryWrapper<UnitMaintainPlatform> wrapper = new QueryWrapper<>();
wrapper.eq(StrUtil.isNotBlank(platformLinkRequest.getUnitId()), UnitMaintainPlatform.COL_UNITID, platformLinkRequest.getUnitId())
.eq(null != platformLinkRequest.getCustomerId(), UnitMaintainPlatform.COL_CUSTOMERID, platformLinkRequest.getCustomerId())
.eq(StrUtil.isNotBlank(platformLinkRequest.getPlatformId()), UnitMaintainPlatform.COL_PLATFORMID, platformLinkRequest.getPlatformId())
.eq(StrUtil.isNotBlank(platformLinkRequest.getSourceAction()), UnitMaintainPlatform.COL_SOURCEACTION, platformLinkRequest.getSourceAction())
.eq(StrUtil.isNotBlank(platformLinkRequest.getTargetAction()), UnitMaintainPlatform.COL_TARGETACTION, platformLinkRequest.getTargetAction())
.eq(StrUtil.isNotBlank(platformLinkRequest.getInvCode()), UnitMaintainPlatform.COL_INVCODE, platformLinkRequest.getInvCode())
.eq(StrUtil.isNotBlank(platformLinkRequest.getInvSubCode()), UnitMaintainPlatform.COL_INVSUBCODE, platformLinkRequest.getInvSubCode())
.eq(StrUtil.isNotBlank(platformLinkRequest.getAppid()), UnitMaintainPlatform.COL_APPID, platformLinkRequest.getAppid())
.eq(StrUtil.isNotBlank(platformLinkRequest.getApiKey()), UnitMaintainPlatform.COL_APIKEY, platformLinkRequest.getApiKey())
.eq(StrUtil.isNotBlank(platformLinkRequest.getSecretKey()), UnitMaintainPlatform.COL_SECRETKEY, platformLinkRequest.getSecretKey());
LambdaQueryWrapper<UnitMaintainPlatform> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(StrUtil.isNotBlank(platformLinkRequest.getUnitId()), UnitMaintainPlatform::getUnitId, platformLinkRequest.getUnitId())
.eq(null != platformLinkRequest.getCustomerId(), UnitMaintainPlatform::getCustomerId, platformLinkRequest.getCustomerId())
.eq(StrUtil.isNotBlank(platformLinkRequest.getPlatformId()), UnitMaintainPlatform::getPlatformId, platformLinkRequest.getPlatformId())
.eq(StrUtil.isNotBlank(platformLinkRequest.getSourceAction()), UnitMaintainPlatform::getSourceAction, platformLinkRequest.getSourceAction())
.eq(StrUtil.isNotBlank(platformLinkRequest.getTargetAction()), UnitMaintainPlatform::getTargetAction, platformLinkRequest.getTargetAction())
.eq(StrUtil.isNotBlank(platformLinkRequest.getInvCode()), UnitMaintainPlatform::getInvCode, platformLinkRequest.getInvCode())
// .eq(StrUtil.isNotBlank(platformLinkRequest.getInvSubCode()), UnitMaintainPlatform::getInvSubCode, platformLinkRequest.getInvSubCode())
.eq(StrUtil.isNotBlank(platformLinkRequest.getAppid()), UnitMaintainPlatform::getAppid, platformLinkRequest.getAppid())
.eq(StrUtil.isNotBlank(platformLinkRequest.getApiKey()), UnitMaintainPlatform::getApiKey, platformLinkRequest.getApiKey())
.eq(StrUtil.isNotBlank(platformLinkRequest.getSecretKey()), UnitMaintainPlatform::getSecretKey, platformLinkRequest.getSecretKey());
List<UnitMaintainPlatform> list = unitMaintainPlatformDao.selectList(wrapper);
if (CollUtil.isEmpty(list)) {
return "success";

@ -17,6 +17,15 @@ spring:
max-wait: -1
max-idle: 8
min-idle: 0
boot:
admin:
client:
username: admin
password: admin
url: http://localhost:8888
instance:
prefer-ip: true
logging:
level:
com.glxp.udi.admin.dao: debug
@ -32,4 +41,15 @@ UDI_SERVER:
file_path: D:/1s/udims
UDI_KEY: 6b137c66-6286-46c6-8efa-c2f5dd9237df
UDI_KEY: 6b137c66-6286-46c6-8efa-c2f5dd9237df
management:
endpoint:
health:
show-details: always
logfile:
external-file: ../logs/UDIC_UDI_Server/web_debug.log
endpoints:
web:
exposure:
include: "*"

@ -2,6 +2,8 @@ server:
port: 9995
spring:
application:
name: @artifactId@
profiles:
active: dev
servlet:

@ -6,7 +6,7 @@
SELECT *
FROM auth_user
<where>
userName = #{userName}
binary userName = #{userName}
</where>
LIMIT 1
</select>

Loading…
Cancel
Save