commit
19f671613a
150 changed files with 9720 additions and 0 deletions
@ -0,0 +1,116 @@ |
|||
# ---> Java |
|||
# Compiled class file |
|||
*.class |
|||
|
|||
# Log file |
|||
*.log |
|||
|
|||
# BlueJ files |
|||
*.ctxt |
|||
|
|||
# Mobile Tools for Java (J2ME) |
|||
.mtj.tmp/ |
|||
|
|||
# Package Files # |
|||
*.jar |
|||
*.war |
|||
*.nar |
|||
*.ear |
|||
*.zip |
|||
*.tar.gz |
|||
*.rar |
|||
|
|||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml |
|||
hs_err_pid* |
|||
|
|||
# ---> Maven |
|||
target/ |
|||
pom.xml.tag |
|||
pom.xml.releaseBackup |
|||
pom.xml.versionsBackup |
|||
pom.xml.next |
|||
release.properties |
|||
dependency-reduced-pom.xml |
|||
buildNumber.properties |
|||
.mvn/timing.properties |
|||
# https://github.com/takari/maven-wrapper#usage-without-binary-jar |
|||
.mvn/wrapper/maven-wrapper.jar |
|||
|
|||
# ---> JetBrains |
|||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider |
|||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 |
|||
|
|||
# User-specific stuff |
|||
.idea/**/workspace.xml |
|||
.idea/**/tasks.xml |
|||
.idea/**/usage.statistics.xml |
|||
.idea/**/dictionaries |
|||
.idea/**/shelf |
|||
|
|||
# AWS User-specific |
|||
.idea/**/aws.xml |
|||
|
|||
# Generated files |
|||
.idea/**/contentModel.xml |
|||
|
|||
# Sensitive or high-churn files |
|||
.idea/**/dataSources/ |
|||
.idea/**/dataSources.ids |
|||
.idea/**/dataSources.local.xml |
|||
.idea/**/sqlDataSources.xml |
|||
.idea/**/dynamic.xml |
|||
.idea/**/uiDesigner.xml |
|||
.idea/**/dbnavigator.xml |
|||
|
|||
# Gradle |
|||
.idea/**/gradle.xml |
|||
.idea/**/libraries |
|||
|
|||
# Gradle and Maven with auto-import |
|||
# When using Gradle or Maven with auto-import, you should exclude module files, |
|||
# since they will be recreated, and may cause churn. Uncomment if using |
|||
# auto-import. |
|||
# .idea/artifacts |
|||
# .idea/compiler.xml |
|||
# .idea/jarRepositories.xml |
|||
# .idea/modules.xml |
|||
# .idea/*.iml |
|||
# .idea/modules |
|||
# *.iml |
|||
# *.ipr |
|||
|
|||
# CMake |
|||
cmake-build-*/ |
|||
|
|||
# Mongo Explorer plugin |
|||
.idea/**/mongoSettings.xml |
|||
|
|||
# File-based project format |
|||
*.iws |
|||
|
|||
# IntelliJ |
|||
out/ |
|||
|
|||
# mpeltonen/sbt-idea plugin |
|||
.idea_modules/ |
|||
|
|||
# JIRA plugin |
|||
atlassian-ide-plugin.xml |
|||
|
|||
# Cursive Clojure plugin |
|||
.idea/replstate.xml |
|||
|
|||
# Crashlytics plugin (for Android Studio and IntelliJ) |
|||
com_crashlytics_export_strings.xml |
|||
crashlytics.properties |
|||
crashlytics-build.properties |
|||
fabric.properties |
|||
|
|||
# Editor-based Rest Client |
|||
.idea/httpRequests |
|||
|
|||
# Android studio 3.1+ serialized cache file |
|||
.idea/caches/build_file_checksums.ser |
|||
|
|||
**/.idea/ |
|||
**/logs/ |
@ -0,0 +1,92 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<parent> |
|||
<artifactId>share-store</artifactId> |
|||
<groupId>com.yxt</groupId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
</parent> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<groupId>com.yxt.gateway</groupId> |
|||
<artifactId>gateway</artifactId> |
|||
|
|||
<properties> |
|||
<maven.compiler.source>8</maven.compiler.source> |
|||
<maven.compiler.target>8</maven.compiler.target> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
</properties> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>io.jsonwebtoken</groupId> |
|||
<artifactId>jjwt</artifactId> |
|||
<version>0.9.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-gateway</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.alibaba.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.projectlombok</groupId> |
|||
<artifactId>lombok</artifactId> |
|||
<version>1.18.24</version> |
|||
<optional>true</optional> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework</groupId> |
|||
<artifactId>spring-webmvc</artifactId> |
|||
</dependency> |
|||
<!--引入redis--> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-data-redis</artifactId> |
|||
<exclusions> |
|||
<exclusion> |
|||
<groupId>io.lettuce</groupId> |
|||
<artifactId>lettuce-core</artifactId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>redis.clients</groupId> |
|||
<artifactId>jedis</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.alibaba</groupId> |
|||
<artifactId>fastjson</artifactId> |
|||
</dependency> |
|||
|
|||
|
|||
</dependencies> |
|||
|
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-maven-plugin</artifactId> |
|||
<version>2.5.6</version> |
|||
<executions> |
|||
<execution> |
|||
<goals> |
|||
<goal>repackage</goal> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
<resources> |
|||
<resource> |
|||
<directory>src/main/resources</directory> |
|||
<includes> |
|||
<include>**/*.yml</include> |
|||
</includes> |
|||
<filtering>false</filtering> |
|||
</resource> |
|||
</resources> |
|||
</build> |
|||
</project> |
@ -0,0 +1,124 @@ |
|||
package com.yxt.wms; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.yxt.wms.utils.*; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.cloud.gateway.filter.GatewayFilterChain; |
|||
import org.springframework.cloud.gateway.filter.GlobalFilter; |
|||
import org.springframework.core.Ordered; |
|||
import org.springframework.core.io.buffer.DataBufferFactory; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.http.server.reactive.ServerHttpRequest; |
|||
import org.springframework.http.server.reactive.ServerHttpResponse; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.web.server.ServerWebExchange; |
|||
import reactor.core.publisher.Mono; |
|||
|
|||
import static com.yxt.wms.utils.HttpStatus.OVERDUE; |
|||
|
|||
/** |
|||
* @author dimengzhe |
|||
* @date 2020/12/2 9:52 |
|||
* @description 网关鉴权 |
|||
* 1.某些接口不需要不进行登录验证,如登录,注册,获取验证码等接口。(uri白名单) |
|||
* 2.某些接口需要登录验证,但是不需要刷新token有效时间,如客户端轮询请求的接口。 |
|||
* 3.特定场景下IP黑、白名单。 |
|||
* 4.处于安全考虑的接口流量控制。 |
|||
*/ |
|||
@Component |
|||
public class AuthFilter implements GlobalFilter, Ordered { |
|||
|
|||
private static final Logger log = LoggerFactory.getLogger(AuthFilter.class); |
|||
//过期时间设置为4小时
|
|||
private final static long EXPIRE_TIME = Constants.TOKEN_EXPIRE * 60; |
|||
private final static long EXPIRE_TIME_APP = Constants.TOKEN_EXPIRE_APP * 60; |
|||
|
|||
// 排除过滤的 uri 地址,nacos自行添加
|
|||
@Autowired |
|||
private IgnoreWhiteProperties ignoreWhite; |
|||
@Autowired |
|||
private RedisUtil redisUtil; |
|||
/* |
|||
redis中数据存储结构为两个键值对 |
|||
键为用户ID,值为用户token,可以通过用户ID查询用户token,实现立刻失效用户token功能。 |
|||
键为用户token,值为用户数据,实现token有效性,用户数据缓存功能。 |
|||
*/ |
|||
|
|||
@Override |
|||
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { |
|||
String url = exchange.getRequest().getURI().getPath(); |
|||
//1.uri白名单。 跳过不需要验证的路径
|
|||
if (StringUtils.matches(url, ignoreWhite.getWhites())) { |
|||
return chain.filter(exchange); |
|||
} else if (StringUtils.matchesTwo(url, ignoreWhite.getWhitesTwo())) { |
|||
return chain.filter(exchange); |
|||
} |
|||
//2.验证有无令牌。 从请求的header中获取token
|
|||
String token = getToken(exchange.getRequest()); |
|||
if (StringUtils.isBlank(token)) { |
|||
return setUnauthorizedResponse(exchange, "令牌不能为空"); |
|||
} |
|||
//3.验证token是否有效。(a.验证token是否合法 b.验证token是否过期)
|
|||
//从redis缓存中获取key对应的内容
|
|||
String userName = redisUtil.get(token); |
|||
|
|||
if (StringUtils.isBlank(userName)) { |
|||
|
|||
return setUnauthorizedResponse(exchange, "登录状态已过期"); |
|||
} |
|||
//验签:需要验证token中的签名是否与用户sid一致,后台用密钥+userSid+token除签名以外的内容,重新生成签名,与token中的签名进行比较
|
|||
|
|||
//刷新token过期日期
|
|||
if (token.contains("App")) { |
|||
redisUtil.expire(token, EXPIRE_TIME_APP); |
|||
} else { |
|||
redisUtil.expire(token, EXPIRE_TIME); |
|||
} |
|||
|
|||
// 在请求中增加用户信息
|
|||
ServerHttpRequest mutableReq = exchange.getRequest().mutate() |
|||
.header(CacheConstants.DETAILS_USERNAME, userName).build(); |
|||
ServerWebExchange mutableExchange = exchange.mutate().request(mutableReq).build(); |
|||
return chain.filter(mutableExchange); |
|||
} |
|||
|
|||
/** |
|||
* 鉴权异常处理 |
|||
* |
|||
* @param exchange |
|||
* @param msg |
|||
* @return |
|||
*/ |
|||
private Mono<Void> setUnauthorizedResponse(ServerWebExchange exchange, String msg) { |
|||
ServerHttpResponse response = exchange.getResponse(); |
|||
response.getHeaders().setContentType(MediaType.APPLICATION_JSON); |
|||
response.setStatusCode(HttpStatus.OK); |
|||
|
|||
log.error("[鉴权异常处理]请求路径:{}", exchange.getRequest().getPath()); |
|||
|
|||
return response.writeWith(Mono.fromSupplier(() -> { |
|||
DataBufferFactory bufferFactory = response.bufferFactory(); |
|||
// return bufferFactory.wrap(JSON.toJSONBytes(com.yxt.anrui.utils.HttpStatus.OVERDUE));
|
|||
return bufferFactory.wrap(JSON.toJSONBytes(ResultBean.fireFail().setCode(OVERDUE).setMsg(msg))); |
|||
})); |
|||
} |
|||
|
|||
/** |
|||
* 获取请求token |
|||
*/ |
|||
private String getToken(ServerHttpRequest request) { |
|||
String token = request.getHeaders().getFirst(CacheConstants.HEADER); |
|||
// if (StringUtils.isNotEmpty(token) && token.startsWith(CacheConstants.TOKEN_PREFIX)) {
|
|||
// token = token.replace(CacheConstants.TOKEN_PREFIX, "");
|
|||
// }
|
|||
return token; |
|||
} |
|||
|
|||
@Override |
|||
public int getOrder() { |
|||
return 0; |
|||
} |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.yxt.wms; |
|||
|
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
|||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date ${DATE} ${TIME} |
|||
*/ |
|||
|
|||
@EnableDiscoveryClient |
|||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) |
|||
public class GatewayApplication { |
|||
public static void main(String[] args) { |
|||
SpringApplication.run(GatewayApplication.class, args); |
|||
}} |
@ -0,0 +1,300 @@ |
|||
package com.yxt.wms; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.dao.DataAccessException; |
|||
import org.springframework.data.redis.connection.RedisConnection; |
|||
import org.springframework.data.redis.connection.RedisStringCommands; |
|||
import org.springframework.data.redis.core.*; |
|||
import org.springframework.data.redis.core.types.Expiration; |
|||
import org.springframework.data.redis.serializer.RedisSerializer; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
import java.util.Set; |
|||
import java.util.concurrent.TimeUnit; |
|||
|
|||
/** |
|||
* @author dimengzhe |
|||
* @date 2020/9/9 17:35 |
|||
* @description redis工具类 |
|||
*/ |
|||
@Service |
|||
public class RedisUtil { |
|||
|
|||
@Autowired |
|||
private RedisTemplate redisTemplate; |
|||
|
|||
|
|||
/** |
|||
* 字符串类型:根据key设置value值,如果key中的value存在,那么返回false |
|||
* |
|||
* @param key |
|||
* @param value |
|||
* @return |
|||
*/ |
|||
public Boolean setnx(final String key, final String value, final long expration, final TimeUnit timeUnit) { |
|||
return (Boolean) redisTemplate.execute(new RedisCallback<Boolean>() { |
|||
@Override |
|||
public Boolean doInRedis(RedisConnection redisConnection) throws DataAccessException { |
|||
RedisSerializer<String> redisSerializer = redisTemplate.getStringSerializer(); |
|||
byte keys[] = redisSerializer.serialize(key); |
|||
byte values[] = redisSerializer.serialize(value); |
|||
return redisConnection.set(keys, values, Expiration.from(expration, timeUnit), RedisStringCommands.SetOption.SET_IF_ABSENT); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 写入缓存 |
|||
* |
|||
* @param key |
|||
* @param value |
|||
* @return |
|||
*/ |
|||
public boolean set(final String key, final String value) { |
|||
|
|||
boolean result = (boolean) redisTemplate.execute(new RedisCallback<Boolean>() { |
|||
@Override |
|||
public Boolean doInRedis(RedisConnection connection) throws DataAccessException { |
|||
RedisSerializer<String> serializer = redisTemplate.getStringSerializer(); |
|||
connection.set(serializer.serialize(key), serializer.serialize(value)); |
|||
return true; |
|||
} |
|||
}); |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 写入缓存设置时效时间 |
|||
* |
|||
* @param key |
|||
* @param value |
|||
* @return |
|||
*/ |
|||
public boolean set(final String key, Object value, Long expireTime) { |
|||
boolean result = false; |
|||
try { |
|||
ValueOperations<Serializable, Object> operations = redisTemplate.opsForValue(); |
|||
operations.set(key, value); |
|||
redisTemplate.expire(key, expireTime, TimeUnit.SECONDS); |
|||
result = true; |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return result; |
|||
} |
|||
/** |
|||
* 刷新缓存到期时间 |
|||
* @param key |
|||
* @param expire |
|||
* @return |
|||
*/ |
|||
public boolean expire(String key, long expire) { |
|||
return redisTemplate.expire(key, expire, TimeUnit.SECONDS); |
|||
} |
|||
|
|||
/** |
|||
* 读取缓存 |
|||
* |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
public String get(final String key) { |
|||
String result = (String) redisTemplate.execute(new RedisCallback<String>() { |
|||
@Override |
|||
public String doInRedis(RedisConnection connection) throws DataAccessException { |
|||
RedisSerializer<String> serializer = redisTemplate.getStringSerializer(); |
|||
byte[] value = connection.get(serializer.serialize(key)); |
|||
return serializer.deserialize(value); |
|||
} |
|||
}); |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 正则获取key集合 |
|||
* |
|||
* @param pattern |
|||
* @return |
|||
*/ |
|||
public Set<String> keys(String pattern) { |
|||
Set<String> keys = redisTemplate.keys(pattern); |
|||
return keys; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 批量删除对应的value |
|||
* |
|||
* @param keys |
|||
*/ |
|||
public void remove(final String... keys) { |
|||
for (String key : keys) { |
|||
remove(key); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 批量删除key |
|||
* |
|||
* @param pattern |
|||
*/ |
|||
public void removePattern(final String pattern) { |
|||
Set<Serializable> keys = redisTemplate.keys(pattern); |
|||
if (keys.size() > 0) { |
|||
redisTemplate.delete(keys); |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
public Long remove(final String key) { |
|||
return (Long) redisTemplate.execute(new RedisCallback<Long>() { |
|||
@Override |
|||
public Long doInRedis(RedisConnection redisConnection) throws DataAccessException { |
|||
RedisSerializer<String> serializer = redisTemplate.getStringSerializer(); |
|||
byte keys[] = serializer.serialize(key); |
|||
return redisConnection.del(keys); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 判断缓存中是否有对应的value |
|||
* |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
public boolean exists(final String key) { |
|||
return redisTemplate.hasKey(key); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 哈希 添加 |
|||
* |
|||
* @param key |
|||
* @param hashKey |
|||
* @param value |
|||
*/ |
|||
public void hmSet(String key, Object hashKey, Object value) { |
|||
HashOperations<String, Object, Object> hash = redisTemplate.opsForHash(); |
|||
hash.put(key, hashKey, value); |
|||
} |
|||
|
|||
/** |
|||
* 哈希获取数据 |
|||
* |
|||
* @param key |
|||
* @param hashKey |
|||
* @return |
|||
*/ |
|||
public String hmGet(String key, Object hashKey) { |
|||
HashOperations<String, String, String> hash = redisTemplate.opsForHash(); |
|||
return hash.get(key, hashKey); |
|||
} |
|||
|
|||
/** |
|||
* 获取哈希 keys |
|||
* |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
public Set<String> hmGetKeys(String key) { |
|||
HashOperations<String, String, String> hash = redisTemplate.opsForHash(); |
|||
return hash.keys(key); |
|||
} |
|||
|
|||
/** |
|||
* 删除集合中的key |
|||
* |
|||
* @param key |
|||
* @param hashKey |
|||
*/ |
|||
public void hmDelete(String key, Object hashKey) { |
|||
HashOperations<String, Object, Object> hash = redisTemplate.opsForHash(); |
|||
hash.delete(key, hashKey); |
|||
} |
|||
|
|||
/** |
|||
* 列表添加 |
|||
* |
|||
* @param k |
|||
* @param v |
|||
*/ |
|||
public void lPush(String k, Object v) { |
|||
ListOperations<String, Object> list = redisTemplate.opsForList(); |
|||
list.rightPush(k, v); |
|||
} |
|||
|
|||
/** |
|||
* 列表获取 |
|||
* |
|||
* @param k |
|||
* @param l |
|||
* @param l1 |
|||
* @return |
|||
*/ |
|||
public List<Object> lRange(String k, long l, long l1) { |
|||
ListOperations<String, Object> list = redisTemplate.opsForList(); |
|||
return list.range(k, l, l1); |
|||
} |
|||
|
|||
/** |
|||
* 集合添加 |
|||
* |
|||
* @param key |
|||
* @param value |
|||
*/ |
|||
public void add(String key, Object value) { |
|||
SetOperations<String, Object> set = redisTemplate.opsForSet(); |
|||
set.add(key, value); |
|||
} |
|||
|
|||
/** |
|||
* 集合获取 |
|||
* |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
public Set<Object> setMembers(String key) { |
|||
SetOperations<String, Object> set = redisTemplate.opsForSet(); |
|||
return set.members(key); |
|||
} |
|||
|
|||
/** |
|||
* 有序集合添加 |
|||
* |
|||
* @param key |
|||
* @param value |
|||
* @param scoure |
|||
*/ |
|||
public void zAdd(String key, Object value, double scoure) { |
|||
ZSetOperations<String, Object> zset = redisTemplate.opsForZSet(); |
|||
zset.add(key, value, scoure); |
|||
} |
|||
|
|||
/** |
|||
* 有序集合获取 |
|||
* |
|||
* @param key |
|||
* @param scoure |
|||
* @param scoure1 |
|||
* @return |
|||
*/ |
|||
public Set<Object> rangeByScore(String key, double scoure, double scoure1) { |
|||
ZSetOperations<String, Object> zset = redisTemplate.opsForZSet(); |
|||
return zset.rangeByScore(key, scoure, scoure1); |
|||
} |
|||
|
|||
/** |
|||
* 实现命令:TTL key 以秒为单位,返回给定key的剩余生存时间 |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
public long ttl(String key) { |
|||
return redisTemplate.getExpire(key); |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.yxt.wms.utils; |
|||
|
|||
/** |
|||
* @author dimengzhe |
|||
* @date 2020/12/2 9:58 |
|||
* @description 缓存的key 常量 |
|||
*/ |
|||
|
|||
public class CacheConstants { |
|||
|
|||
/** |
|||
* 令牌自定义标识 |
|||
*/ |
|||
public static final String HEADER = "token"; |
|||
|
|||
/** |
|||
* 令牌前缀 |
|||
*/ |
|||
public static final String TOKEN_PREFIX = "Bearer "; |
|||
|
|||
/** |
|||
* 用户名字段 |
|||
*/ |
|||
public static final String DETAILS_USERNAME = "userName"; |
|||
} |
@ -0,0 +1,86 @@ |
|||
package com.yxt.wms.utils; |
|||
|
|||
import java.nio.charset.Charset; |
|||
import java.nio.charset.StandardCharsets; |
|||
|
|||
/** |
|||
* @author dimengzhe |
|||
* @date 2020/12/2 10:02 |
|||
* @description |
|||
*/ |
|||
|
|||
public class CharsetKit { |
|||
|
|||
/** ISO-8859-1 */ |
|||
public static final String ISO_8859_1 = "ISO-8859-1"; |
|||
/** UTF-8 */ |
|||
public static final String UTF_8 = "UTF-8"; |
|||
/** GBK */ |
|||
public static final String GBK = "GBK"; |
|||
|
|||
/** ISO-8859-1 */ |
|||
public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1); |
|||
/** UTF-8 */ |
|||
public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8); |
|||
/** GBK */ |
|||
public static final Charset CHARSET_GBK = Charset.forName(GBK); |
|||
|
|||
/** |
|||
* 转换为Charset对象 |
|||
* |
|||
* @param charset 字符集,为空则返回默认字符集 |
|||
* @return Charset |
|||
*/ |
|||
public static Charset charset(String charset) |
|||
{ |
|||
return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset); |
|||
} |
|||
|
|||
/** |
|||
* 转换字符串的字符集编码 |
|||
* |
|||
* @param source 字符串 |
|||
* @param srcCharset 源字符集,默认ISO-8859-1 |
|||
* @param destCharset 目标字符集,默认UTF-8 |
|||
* @return 转换后的字符集 |
|||
*/ |
|||
public static String convert(String source, String srcCharset, String destCharset) |
|||
{ |
|||
return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); |
|||
} |
|||
|
|||
/** |
|||
* 转换字符串的字符集编码 |
|||
* |
|||
* @param source 字符串 |
|||
* @param srcCharset 源字符集,默认ISO-8859-1 |
|||
* @param destCharset 目标字符集,默认UTF-8 |
|||
* @return 转换后的字符集 |
|||
*/ |
|||
public static String convert(String source, Charset srcCharset, Charset destCharset) |
|||
{ |
|||
if (null == srcCharset) |
|||
{ |
|||
srcCharset = StandardCharsets.ISO_8859_1; |
|||
} |
|||
|
|||
if (null == destCharset) |
|||
{ |
|||
destCharset = StandardCharsets.UTF_8; |
|||
} |
|||
|
|||
if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) |
|||
{ |
|||
return source; |
|||
} |
|||
return new String(source.getBytes(srcCharset), destCharset); |
|||
} |
|||
|
|||
/** |
|||
* @return 系统字符集编码 |
|||
*/ |
|||
public static String systemCharset() |
|||
{ |
|||
return Charset.defaultCharset().name(); |
|||
} |
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.yxt.wms.utils; |
|||
|
|||
/** |
|||
* @author dimengzhe |
|||
* @date 2020/12/2 9:56 |
|||
* @description 通用常量信息 |
|||
*/ |
|||
|
|||
public class Constants { |
|||
|
|||
/** |
|||
* 成功标记 |
|||
*/ |
|||
public static final Integer SUCCESS = 200; |
|||
|
|||
/** |
|||
* 失败标记 |
|||
*/ |
|||
public static final Integer FAIL = 5000; |
|||
|
|||
public static final boolean fail = false; |
|||
public static final boolean success = true; |
|||
|
|||
/** |
|||
* 令牌有效期(分钟) |
|||
*/ |
|||
public final static long TOKEN_EXPIRE = 4*60; |
|||
public final static long TOKEN_EXPIRE_APP = 15*24*60; |
|||
} |
@ -0,0 +1,999 @@ |
|||
package com.yxt.wms.utils; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.math.BigInteger; |
|||
import java.nio.ByteBuffer; |
|||
import java.nio.charset.Charset; |
|||
import java.text.NumberFormat; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @author dimengzhe |
|||
* @date 2020/12/2 10:01 |
|||
* @description |
|||
*/ |
|||
|
|||
public class Convert { |
|||
|
|||
/** |
|||
* 转换为字符串<br> |
|||
* 如果给定的值为null,或者转换失败,返回默认值<br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @param defaultValue 转换错误时的默认值 |
|||
* @return 结果 |
|||
*/ |
|||
public static String toStr(Object value, String defaultValue) |
|||
{ |
|||
if (null == value) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
if (value instanceof String) |
|||
{ |
|||
return (String) value; |
|||
} |
|||
return value.toString(); |
|||
} |
|||
|
|||
/** |
|||
* 转换为字符串<br> |
|||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static String toStr(Object value) |
|||
{ |
|||
return toStr(value, null); |
|||
} |
|||
|
|||
/** |
|||
* 转换为字符<br> |
|||
* 如果给定的值为null,或者转换失败,返回默认值<br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @param defaultValue 转换错误时的默认值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Character toChar(Object value, Character defaultValue) |
|||
{ |
|||
if (null == value) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
if (value instanceof Character) |
|||
{ |
|||
return (Character) value; |
|||
} |
|||
|
|||
final String valueStr = toStr(value, null); |
|||
return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0); |
|||
} |
|||
|
|||
/** |
|||
* 转换为字符<br> |
|||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Character toChar(Object value) |
|||
{ |
|||
return toChar(value, null); |
|||
} |
|||
|
|||
/** |
|||
* 转换为byte<br> |
|||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @param defaultValue 转换错误时的默认值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Byte toByte(Object value, Byte defaultValue) |
|||
{ |
|||
if (value == null) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
if (value instanceof Byte) |
|||
{ |
|||
return (Byte) value; |
|||
} |
|||
if (value instanceof Number) |
|||
{ |
|||
return ((Number) value).byteValue(); |
|||
} |
|||
final String valueStr = toStr(value, null); |
|||
if (StringUtils.isEmpty(valueStr)) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
try |
|||
{ |
|||
return Byte.parseByte(valueStr); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 转换为byte<br> |
|||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Byte toByte(Object value) |
|||
{ |
|||
return toByte(value, null); |
|||
} |
|||
|
|||
/** |
|||
* 转换为Short<br> |
|||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @param defaultValue 转换错误时的默认值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Short toShort(Object value, Short defaultValue) |
|||
{ |
|||
if (value == null) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
if (value instanceof Short) |
|||
{ |
|||
return (Short) value; |
|||
} |
|||
if (value instanceof Number) |
|||
{ |
|||
return ((Number) value).shortValue(); |
|||
} |
|||
final String valueStr = toStr(value, null); |
|||
if (StringUtils.isEmpty(valueStr)) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
try |
|||
{ |
|||
return Short.parseShort(valueStr.trim()); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 转换为Short<br> |
|||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Short toShort(Object value) |
|||
{ |
|||
return toShort(value, null); |
|||
} |
|||
|
|||
/** |
|||
* 转换为Number<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @param defaultValue 转换错误时的默认值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Number toNumber(Object value, Number defaultValue) |
|||
{ |
|||
if (value == null) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
if (value instanceof Number) |
|||
{ |
|||
return (Number) value; |
|||
} |
|||
final String valueStr = toStr(value, null); |
|||
if (StringUtils.isEmpty(valueStr)) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
try |
|||
{ |
|||
return NumberFormat.getInstance().parse(valueStr); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 转换为Number<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Number toNumber(Object value) |
|||
{ |
|||
return toNumber(value, null); |
|||
} |
|||
|
|||
/** |
|||
* 转换为int<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @param defaultValue 转换错误时的默认值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Integer toInt(Object value, Integer defaultValue) |
|||
{ |
|||
if (value == null) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
if (value instanceof Integer) |
|||
{ |
|||
return (Integer) value; |
|||
} |
|||
if (value instanceof Number) |
|||
{ |
|||
return ((Number) value).intValue(); |
|||
} |
|||
final String valueStr = toStr(value, null); |
|||
if (StringUtils.isEmpty(valueStr)) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
try |
|||
{ |
|||
return Integer.parseInt(valueStr.trim()); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 转换为int<br> |
|||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Integer toInt(Object value) |
|||
{ |
|||
return toInt(value, null); |
|||
} |
|||
|
|||
/** |
|||
* 转换为Integer数组<br> |
|||
* |
|||
* @param str 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Integer[] toIntArray(String str) |
|||
{ |
|||
return toIntArray(",", str); |
|||
} |
|||
|
|||
/** |
|||
* 转换为Long数组<br> |
|||
* |
|||
* @param str 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Long[] toLongArray(String str) |
|||
{ |
|||
return toLongArray(",", str); |
|||
} |
|||
|
|||
/** |
|||
* 转换为Integer数组<br> |
|||
* |
|||
* @param split 分隔符 |
|||
* @param split 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Integer[] toIntArray(String split, String str) |
|||
{ |
|||
if (StringUtils.isEmpty(str)) |
|||
{ |
|||
return new Integer[] {}; |
|||
} |
|||
String[] arr = str.split(split); |
|||
final Integer[] ints = new Integer[arr.length]; |
|||
for (int i = 0; i < arr.length; i++) |
|||
{ |
|||
final Integer v = toInt(arr[i], 0); |
|||
ints[i] = v; |
|||
} |
|||
return ints; |
|||
} |
|||
|
|||
/** |
|||
* 转换为Long数组<br> |
|||
* |
|||
* @param split 分隔符 |
|||
* @param str 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Long[] toLongArray(String split, String str) |
|||
{ |
|||
if (StringUtils.isEmpty(str)) |
|||
{ |
|||
return new Long[] {}; |
|||
} |
|||
String[] arr = str.split(split); |
|||
final Long[] longs = new Long[arr.length]; |
|||
for (int i = 0; i < arr.length; i++) |
|||
{ |
|||
final Long v = toLong(arr[i], null); |
|||
longs[i] = v; |
|||
} |
|||
return longs; |
|||
} |
|||
|
|||
/** |
|||
* 转换为String数组<br> |
|||
* |
|||
* @param str 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static String[] toStrArray(String str) |
|||
{ |
|||
return toStrArray(",", str); |
|||
} |
|||
|
|||
/** |
|||
* 转换为String数组<br> |
|||
* |
|||
* @param split 分隔符 |
|||
* @param split 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static String[] toStrArray(String split, String str) |
|||
{ |
|||
return str.split(split); |
|||
} |
|||
|
|||
/** |
|||
* 转换为long<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @param defaultValue 转换错误时的默认值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Long toLong(Object value, Long defaultValue) |
|||
{ |
|||
if (value == null) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
if (value instanceof Long) |
|||
{ |
|||
return (Long) value; |
|||
} |
|||
if (value instanceof Number) |
|||
{ |
|||
return ((Number) value).longValue(); |
|||
} |
|||
final String valueStr = toStr(value, null); |
|||
if (StringUtils.isEmpty(valueStr)) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
try |
|||
{ |
|||
// 支持科学计数法
|
|||
return new BigDecimal(valueStr.trim()).longValue(); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 转换为long<br> |
|||
* 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Long toLong(Object value) |
|||
{ |
|||
return toLong(value, null); |
|||
} |
|||
|
|||
/** |
|||
* 转换为double<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @param defaultValue 转换错误时的默认值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Double toDouble(Object value, Double defaultValue) |
|||
{ |
|||
if (value == null) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
if (value instanceof Double) |
|||
{ |
|||
return (Double) value; |
|||
} |
|||
if (value instanceof Number) |
|||
{ |
|||
return ((Number) value).doubleValue(); |
|||
} |
|||
final String valueStr = toStr(value, null); |
|||
if (StringUtils.isEmpty(valueStr)) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
try |
|||
{ |
|||
// 支持科学计数法
|
|||
return new BigDecimal(valueStr.trim()).doubleValue(); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 转换为double<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Double toDouble(Object value) |
|||
{ |
|||
return toDouble(value, null); |
|||
} |
|||
|
|||
/** |
|||
* 转换为Float<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @param defaultValue 转换错误时的默认值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Float toFloat(Object value, Float defaultValue) |
|||
{ |
|||
if (value == null) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
if (value instanceof Float) |
|||
{ |
|||
return (Float) value; |
|||
} |
|||
if (value instanceof Number) |
|||
{ |
|||
return ((Number) value).floatValue(); |
|||
} |
|||
final String valueStr = toStr(value, null); |
|||
if (StringUtils.isEmpty(valueStr)) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
try |
|||
{ |
|||
return Float.parseFloat(valueStr.trim()); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 转换为Float<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Float toFloat(Object value) |
|||
{ |
|||
return toFloat(value, null); |
|||
} |
|||
|
|||
/** |
|||
* 转换为boolean<br> |
|||
* String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @param defaultValue 转换错误时的默认值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Boolean toBool(Object value, Boolean defaultValue) |
|||
{ |
|||
if (value == null) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
if (value instanceof Boolean) |
|||
{ |
|||
return (Boolean) value; |
|||
} |
|||
String valueStr = toStr(value, null); |
|||
if (StringUtils.isEmpty(valueStr)) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
valueStr = valueStr.trim().toLowerCase(); |
|||
switch (valueStr) |
|||
{ |
|||
case "true": |
|||
return true; |
|||
case "false": |
|||
return false; |
|||
case "yes": |
|||
return true; |
|||
case "ok": |
|||
return true; |
|||
case "no": |
|||
return false; |
|||
case "1": |
|||
return true; |
|||
case "0": |
|||
return false; |
|||
default: |
|||
return defaultValue; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 转换为boolean<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static Boolean toBool(Object value) |
|||
{ |
|||
return toBool(value, null); |
|||
} |
|||
|
|||
/** |
|||
* 转换为Enum对象<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<br> |
|||
* |
|||
* @param clazz Enum的Class |
|||
* @param value 值 |
|||
* @param defaultValue 默认值 |
|||
* @return Enum |
|||
*/ |
|||
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue) |
|||
{ |
|||
if (value == null) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
if (clazz.isAssignableFrom(value.getClass())) |
|||
{ |
|||
@SuppressWarnings("unchecked") |
|||
E myE = (E) value; |
|||
return myE; |
|||
} |
|||
final String valueStr = toStr(value, null); |
|||
if (StringUtils.isEmpty(valueStr)) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
try |
|||
{ |
|||
return Enum.valueOf(clazz, valueStr); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 转换为Enum对象<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
|||
* |
|||
* @param clazz Enum的Class |
|||
* @param value 值 |
|||
* @return Enum |
|||
*/ |
|||
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) |
|||
{ |
|||
return toEnum(clazz, value, null); |
|||
} |
|||
|
|||
/** |
|||
* 转换为BigInteger<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @param defaultValue 转换错误时的默认值 |
|||
* @return 结果 |
|||
*/ |
|||
public static BigInteger toBigInteger(Object value, BigInteger defaultValue) |
|||
{ |
|||
if (value == null) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
if (value instanceof BigInteger) |
|||
{ |
|||
return (BigInteger) value; |
|||
} |
|||
if (value instanceof Long) |
|||
{ |
|||
return BigInteger.valueOf((Long) value); |
|||
} |
|||
final String valueStr = toStr(value, null); |
|||
if (StringUtils.isEmpty(valueStr)) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
try |
|||
{ |
|||
return new BigInteger(valueStr); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 转换为BigInteger<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static BigInteger toBigInteger(Object value) |
|||
{ |
|||
return toBigInteger(value, null); |
|||
} |
|||
|
|||
/** |
|||
* 转换为BigDecimal<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @param defaultValue 转换错误时的默认值 |
|||
* @return 结果 |
|||
*/ |
|||
public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) |
|||
{ |
|||
if (value == null) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
if (value instanceof BigDecimal) |
|||
{ |
|||
return (BigDecimal) value; |
|||
} |
|||
if (value instanceof Long) |
|||
{ |
|||
return new BigDecimal((Long) value); |
|||
} |
|||
if (value instanceof Double) |
|||
{ |
|||
return new BigDecimal((Double) value); |
|||
} |
|||
if (value instanceof Integer) |
|||
{ |
|||
return new BigDecimal((Integer) value); |
|||
} |
|||
final String valueStr = toStr(value, null); |
|||
if (StringUtils.isEmpty(valueStr)) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
try |
|||
{ |
|||
return new BigDecimal(valueStr); |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
return defaultValue; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 转换为BigDecimal<br> |
|||
* 如果给定的值为空,或者转换失败,返回默认值<br> |
|||
* 转换失败不会报错 |
|||
* |
|||
* @param value 被转换的值 |
|||
* @return 结果 |
|||
*/ |
|||
public static BigDecimal toBigDecimal(Object value) |
|||
{ |
|||
return toBigDecimal(value, null); |
|||
} |
|||
|
|||
/** |
|||
* 将对象转为字符串<br> |
|||
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 |
|||
* |
|||
* @param obj 对象 |
|||
* @return 字符串 |
|||
*/ |
|||
public static String utf8Str(Object obj) |
|||
{ |
|||
return str(obj, CharsetKit.CHARSET_UTF_8); |
|||
} |
|||
|
|||
/** |
|||
* 将对象转为字符串<br> |
|||
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 |
|||
* |
|||
* @param obj 对象 |
|||
* @param charsetName 字符集 |
|||
* @return 字符串 |
|||
*/ |
|||
public static String str(Object obj, String charsetName) |
|||
{ |
|||
return str(obj, Charset.forName(charsetName)); |
|||
} |
|||
|
|||
/** |
|||
* 将对象转为字符串<br> |
|||
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 |
|||
* |
|||
* @param obj 对象 |
|||
* @param charset 字符集 |
|||
* @return 字符串 |
|||
*/ |
|||
public static String str(Object obj, Charset charset) |
|||
{ |
|||
if (null == obj) |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
if (obj instanceof String) |
|||
{ |
|||
return (String) obj; |
|||
} |
|||
else if (obj instanceof byte[] || obj instanceof Byte[]) |
|||
{ |
|||
return str((Byte[]) obj, charset); |
|||
} |
|||
else if (obj instanceof ByteBuffer) |
|||
{ |
|||
return str((ByteBuffer) obj, charset); |
|||
} |
|||
return obj.toString(); |
|||
} |
|||
|
|||
/** |
|||
* 将byte数组转为字符串 |
|||
* |
|||
* @param bytes byte数组 |
|||
* @param charset 字符集 |
|||
* @return 字符串 |
|||
*/ |
|||
public static String str(byte[] bytes, String charset) |
|||
{ |
|||
return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset)); |
|||
} |
|||
|
|||
/** |
|||
* 解码字节码 |
|||
* |
|||
* @param data 字符串 |
|||
* @param charset 字符集,如果此字段为空,则解码的结果取决于平台 |
|||
* @return 解码后的字符串 |
|||
*/ |
|||
public static String str(byte[] data, Charset charset) |
|||
{ |
|||
if (data == null) |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
if (null == charset) |
|||
{ |
|||
return new String(data); |
|||
} |
|||
return new String(data, charset); |
|||
} |
|||
|
|||
/** |
|||
* 将编码的byteBuffer数据转换为字符串 |
|||
* |
|||
* @param data 数据 |
|||
* @param charset 字符集,如果为空使用当前系统字符集 |
|||
* @return 字符串 |
|||
*/ |
|||
public static String str(ByteBuffer data, String charset) |
|||
{ |
|||
if (data == null) |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
return str(data, Charset.forName(charset)); |
|||
} |
|||
|
|||
/** |
|||
* 将编码的byteBuffer数据转换为字符串 |
|||
* |
|||
* @param data 数据 |
|||
* @param charset 字符集,如果为空使用当前系统字符集 |
|||
* @return 字符串 |
|||
*/ |
|||
public static String str(ByteBuffer data, Charset charset) |
|||
{ |
|||
if (null == charset) |
|||
{ |
|||
charset = Charset.defaultCharset(); |
|||
} |
|||
return charset.decode(data).toString(); |
|||
} |
|||
|
|||
// ----------------------------------------------------------------------- 全角半角转换
|
|||
/** |
|||
* 半角转全角 |
|||
* |
|||
* @param input String. |
|||
* @return 全角字符串. |
|||
*/ |
|||
public static String toSBC(String input) |
|||
{ |
|||
return toSBC(input, null); |
|||
} |
|||
|
|||
/** |
|||
* 半角转全角 |
|||
* |
|||
* @param input String |
|||
* @param notConvertSet 不替换的字符集合 |
|||
* @return 全角字符串. |
|||
*/ |
|||
public static String toSBC(String input, Set<Character> notConvertSet) |
|||
{ |
|||
char c[] = input.toCharArray(); |
|||
for (int i = 0; i < c.length; i++) |
|||
{ |
|||
if (null != notConvertSet && notConvertSet.contains(c[i])) |
|||
{ |
|||
// 跳过不替换的字符
|
|||
continue; |
|||
} |
|||
|
|||
if (c[i] == ' ') |
|||
{ |
|||
c[i] = '\u3000'; |
|||
} |
|||
else if (c[i] < '\177') |
|||
{ |
|||
c[i] = (char) (c[i] + 65248); |
|||
|
|||
} |
|||
} |
|||
return new String(c); |
|||
} |
|||
|
|||
/** |
|||
* 全角转半角 |
|||
* |
|||
* @param input String. |
|||
* @return 半角字符串 |
|||
*/ |
|||
public static String toDBC(String input) |
|||
{ |
|||
return toDBC(input, null); |
|||
} |
|||
|
|||
/** |
|||
* 替换全角为半角 |
|||
* |
|||
* @param text 文本 |
|||
* @param notConvertSet 不替换的字符集合 |
|||
* @return 替换后的字符 |
|||
*/ |
|||
public static String toDBC(String text, Set<Character> notConvertSet) |
|||
{ |
|||
char c[] = text.toCharArray(); |
|||
for (int i = 0; i < c.length; i++) |
|||
{ |
|||
if (null != notConvertSet && notConvertSet.contains(c[i])) |
|||
{ |
|||
// 跳过不替换的字符
|
|||
continue; |
|||
} |
|||
|
|||
if (c[i] == '\u3000') |
|||
{ |
|||
c[i] = ' '; |
|||
} |
|||
else if (c[i] > '\uFF00' && c[i] < '\uFF5F') |
|||
{ |
|||
c[i] = (char) (c[i] - 65248); |
|||
} |
|||
} |
|||
String returnString = new String(c); |
|||
|
|||
return returnString; |
|||
} |
|||
|
|||
/** |
|||
* 数字金额大写转换 先写个完整的然后将如零拾替换成零 |
|||
* |
|||
* @param n 数字 |
|||
* @return 中文大写数字 |
|||
*/ |
|||
public static String digitUppercase(double n) |
|||
{ |
|||
String[] fraction = { "角", "分" }; |
|||
String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; |
|||
String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } }; |
|||
|
|||
String head = n < 0 ? "负" : ""; |
|||
n = Math.abs(n); |
|||
|
|||
String s = ""; |
|||
for (int i = 0; i < fraction.length; i++) |
|||
{ |
|||
s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); |
|||
} |
|||
if (s.length() < 1) |
|||
{ |
|||
s = "整"; |
|||
} |
|||
int integerPart = (int) Math.floor(n); |
|||
|
|||
for (int i = 0; i < unit[0].length && integerPart > 0; i++) |
|||
{ |
|||
String p = ""; |
|||
for (int j = 0; j < unit[1].length && n > 0; j++) |
|||
{ |
|||
p = digit[integerPart % 10] + unit[1][j] + p; |
|||
integerPart = integerPart / 10; |
|||
} |
|||
s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s; |
|||
} |
|||
return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整"); |
|||
} |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.yxt.wms.utils; |
|||
|
|||
/** |
|||
* @author dimengzhe |
|||
* @date 2021/6/16 10:50 |
|||
* @description |
|||
*/ |
|||
|
|||
public class HttpStatus { |
|||
|
|||
/** |
|||
* 操作成功 |
|||
*/ |
|||
public static final int SUCCESS = 200; |
|||
|
|||
/** |
|||
* 系统内部错误 |
|||
*/ |
|||
public static final int ERROR = 500; |
|||
|
|||
public static final String OVERDUE = "5000"; |
|||
|
|||
} |
@ -0,0 +1,167 @@ |
|||
package com.yxt.wms.utils; |
|||
|
|||
import org.apache.http.Consts; |
|||
import org.apache.http.HttpEntity; |
|||
import org.apache.http.NameValuePair; |
|||
import org.apache.http.client.entity.UrlEncodedFormEntity; |
|||
import org.apache.http.client.methods.CloseableHttpResponse; |
|||
import org.apache.http.client.methods.HttpGet; |
|||
import org.apache.http.client.methods.HttpPost; |
|||
import org.apache.http.entity.StringEntity; |
|||
import org.apache.http.impl.client.CloseableHttpClient; |
|||
import org.apache.http.impl.client.HttpClients; |
|||
import org.apache.http.message.BasicNameValuePair; |
|||
import org.apache.http.util.EntityUtils; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
public class HttpUtils { |
|||
private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); |
|||
private static final CloseableHttpClient httpclient = HttpClients.createDefault(); |
|||
private static final String userAgent = "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.87 Safari/537.36"; |
|||
|
|||
/** |
|||
* 发送HttpGet请求 * * @param url * 请求地址 * @return 返回字符串 |
|||
*/ |
|||
public static String sendGet(String url, String token) { |
|||
String result = null; |
|||
CloseableHttpResponse response = null; |
|||
try { |
|||
HttpGet httpGet = new HttpGet(url); |
|||
httpGet.setHeader("User-Agent", userAgent); |
|||
httpGet.setHeader("Authorization", "token " + token); |
|||
response = httpclient.execute(httpGet); |
|||
HttpEntity entity = response.getEntity(); |
|||
if (entity != null) { |
|||
result = EntityUtils.toString(entity); |
|||
} |
|||
} catch (Exception e) { |
|||
log.error("处理失败 {}" + e); |
|||
e.printStackTrace(); |
|||
} finally { |
|||
if (response != null) { |
|||
try { |
|||
response.close(); |
|||
} catch (IOException e) { |
|||
log.error(e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 发送HttpPost请求,参数为map * * @param url * 请求地址 * @param map * 请求参数 * @return 返回字符串 |
|||
*/ |
|||
public static String sendPost(String url, Map<String, String> map) { |
|||
// 设置参数
|
|||
List<NameValuePair> formparams = new ArrayList<NameValuePair>(); |
|||
for (Map.Entry<String, String> entry : map.entrySet()) { |
|||
formparams.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); |
|||
} |
|||
// 编码
|
|||
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(formparams, Consts.UTF_8); |
|||
// 取得HttpPost对象
|
|||
HttpPost httpPost = new HttpPost(url); |
|||
// 防止被当成攻击添加的
|
|||
httpPost.setHeader("User-Agent", userAgent); |
|||
// 参数放入Entity
|
|||
httpPost.setEntity(formEntity); |
|||
CloseableHttpResponse response = null; |
|||
String result = null; |
|||
try { |
|||
// 执行post请求
|
|||
response = httpclient.execute(httpPost); |
|||
// 得到entity
|
|||
HttpEntity entity = response.getEntity(); |
|||
// 得到字符串
|
|||
result = EntityUtils.toString(entity); |
|||
} catch (IOException e) { |
|||
log.error(e.getMessage()); |
|||
} finally { |
|||
if (response != null) { |
|||
try { |
|||
response.close(); |
|||
} catch (IOException e) { |
|||
log.error(e.getMessage()); |
|||
} |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 发送HttpPost请求,参数为json字符串 * * @param url * @param jsonStr * @return |
|||
*/ |
|||
public static String sendPost(String url, String jsonStr) { |
|||
String result = null; |
|||
// 字符串编码
|
|||
StringEntity entity = new StringEntity(jsonStr, Consts.UTF_8); |
|||
// 设置content-type
|
|||
entity.setContentType("application/json"); |
|||
HttpPost httpPost = new HttpPost(url); |
|||
// 防止被当成攻击添加的
|
|||
httpPost.setHeader("User-Agent", userAgent); |
|||
// 接收参数设置
|
|||
httpPost.setHeader("Accept", "application/json"); |
|||
httpPost.setEntity(entity); |
|||
CloseableHttpResponse response = null; |
|||
try { |
|||
response = httpclient.execute(httpPost); |
|||
HttpEntity httpEntity = response.getEntity(); |
|||
result = EntityUtils.toString(httpEntity); |
|||
} catch (IOException e) { |
|||
log.error(e.getMessage()); |
|||
} finally { |
|||
// 关闭CloseableHttpResponse
|
|||
if (response != null) { |
|||
try { |
|||
response.close(); |
|||
} catch (IOException e) { |
|||
log.error(e.getMessage()); |
|||
} |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 发送不带参数的HttpPost请求 * * @param url * @return |
|||
*/ |
|||
public static String sendPost(String url) { |
|||
String result = null; |
|||
// 得到一个HttpPost对象
|
|||
HttpPost httpPost = new HttpPost(url); |
|||
// 防止被当成攻击添加的
|
|||
httpPost.setHeader("User-Agent", userAgent); |
|||
CloseableHttpResponse response = null; |
|||
try { |
|||
// 执行HttpPost请求,并得到一个CloseableHttpResponse
|
|||
response = httpclient.execute(httpPost); |
|||
// 从CloseableHttpResponse中拿到HttpEntity
|
|||
HttpEntity entity = response.getEntity(); |
|||
// 将HttpEntity转换为字符串
|
|||
result = EntityUtils.toString(entity); |
|||
} catch (IOException e) { |
|||
log.error(e.getMessage()); |
|||
} finally { |
|||
// 关闭CloseableHttpResponse
|
|||
if (response != null) { |
|||
try { |
|||
response.close(); |
|||
} catch (IOException e) { |
|||
log.error(e.getMessage()); |
|||
} |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
/********************************************************* |
|||
********************************************************* |
|||
******************** ******************* |
|||
************* ************ |
|||
******* _oo0oo_ ******* |
|||
*** o8888888o *** |
|||
* 88" . "88 * |
|||
* (| -_- |) * |
|||
* 0\ = /0 * |
|||
* ___/`---'\___ * |
|||
* .' \\| |// '. *
|
|||
* / \\||| : |||// \ *
|
|||
* / _||||| -:- |||||- \ * |
|||
* | | \\\ - /// | | *
|
|||
* | \_| ''\---/'' |_/ | * |
|||
* \ .-\__ '-' ___/-. / * |
|||
* ___'. .' /--.--\ `. .'___ * |
|||
* ."" '< `.___\_<|>_/___.' >' "". * |
|||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | * |
|||
* \ \ `_. \_ __\ /__ _/ .-` / / * |
|||
* =====`-.____`.___ \_____/___.-`___.-'===== * |
|||
* `=---=' * |
|||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * |
|||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__********* |
|||
*********************************************************/ |
|||
package com.yxt.wms.utils; |
|||
|
|||
/** |
|||
* Project: yxt-common <br/> |
|||
* File: IResultCodeMsg.java <br/> |
|||
* Class: com.yxt.common.core.result.IResultCodeMsg <br/> |
|||
* Description: <描述类的功能>. <br/> |
|||
* Copyright: Copyright (c) 2011 <br/> |
|||
* Company: https://gitee.com/liuzp315 <br/>
|
|||
* Makedate: 2021/9/11 下午11:00 <br/> |
|||
* |
|||
* @author popo |
|||
* @version 1.0 |
|||
* @since 1.0 |
|||
*/ |
|||
public interface IResultCodeMsg { |
|||
String getCode(); |
|||
String getMsg(); |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.yxt.wms.utils; |
|||
|
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.cloud.context.config.annotation.RefreshScope; |
|||
import org.springframework.context.annotation.Configuration; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author dimengzhe |
|||
* @date 2020/12/2 9:54 |
|||
* @description 放行白名单配置 |
|||
*/ |
|||
@Configuration |
|||
@RefreshScope |
|||
@ConfigurationProperties(prefix = "ignore") |
|||
public class IgnoreWhiteProperties { |
|||
|
|||
/** |
|||
* 放行白名单配置,网关不校验此处的白名单 |
|||
*/ |
|||
private List<String> whites = new ArrayList<>(); |
|||
|
|||
public List<String> getWhites() { |
|||
return whites; |
|||
} |
|||
|
|||
public void setWhites(List<String> whites) { |
|||
this.whites = whites; |
|||
} |
|||
|
|||
private List<String> whitesTwo = new ArrayList<>(); |
|||
|
|||
public List<String> getWhitesTwo() { |
|||
return whitesTwo; |
|||
} |
|||
|
|||
public void setWhitesTwo(List<String> whitesTwo) { |
|||
this.whitesTwo = whitesTwo; |
|||
} |
|||
} |
@ -0,0 +1,191 @@ |
|||
package com.yxt.wms.utils; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* Project: yxt-common-core <br/> |
|||
* File: ResultBean.java <br/> |
|||
* Class: com.yxt.common.core.result.ResultBean <br/> |
|||
* Description: 通过接口、Rest、逻辑处理执行后的结果信息. <br/> |
|||
* Copyright: Copyright (c) 2011 <br/> |
|||
* Company: https://gitee.com/liuzp315 <br/>
|
|||
* Makedate: 2020/8/4 0:51 <br/> |
|||
* |
|||
* @author liupopo |
|||
* @version 1.0 |
|||
* @since 1.0 |
|||
*/ |
|||
public class ResultBean<T> implements Serializable { |
|||
private static final long serialVersionUID = 4529658978692424234L; |
|||
|
|||
private long timestamp = System.currentTimeMillis(); |
|||
|
|||
public long getTimestamp() { |
|||
return timestamp; |
|||
} |
|||
|
|||
// 是否成功
|
|||
private boolean success; |
|||
|
|||
// 消息 返回结果的说明
|
|||
private String msg; |
|||
|
|||
// 结果状态码
|
|||
private String code; |
|||
|
|||
// 数据
|
|||
private T data; |
|||
|
|||
private String message; |
|||
|
|||
public String getMessage() { |
|||
return message; |
|||
} |
|||
|
|||
public ResultBean<T> setMessage(String message) { |
|||
this.message = message; |
|||
return this; |
|||
} |
|||
|
|||
public ResultBean() { |
|||
} |
|||
|
|||
public ResultBean(boolean success) { |
|||
this.success = success; |
|||
} |
|||
|
|||
public ResultBean(boolean success, String msg) { |
|||
this.success = success; |
|||
this.msg = msg; |
|||
} |
|||
|
|||
public ResultBean(boolean success, String msg, String code) { |
|||
this.success = success; |
|||
this.msg = msg; |
|||
this.code = code; |
|||
} |
|||
|
|||
public ResultBean(T data) { |
|||
this.success = true; |
|||
this.data = data; |
|||
} |
|||
|
|||
public ResultBean(String code, T data) { |
|||
this.success = true; |
|||
this.code = code; |
|||
this.data = data; |
|||
} |
|||
|
|||
public ResultBean(String code, String msg, T data) { |
|||
this.success = true; |
|||
this.code = code; |
|||
this.msg = msg; |
|||
this.data = data; |
|||
} |
|||
|
|||
public boolean getSuccess() { |
|||
return success; |
|||
} |
|||
|
|||
public ResultBean<T> setSuccess(boolean success) { |
|||
this.success = success; |
|||
return this; |
|||
} |
|||
|
|||
public String getMsg() { |
|||
return msg; |
|||
} |
|||
|
|||
public ResultBean<T> setMsg(String msg) { |
|||
this.msg = msg; |
|||
return this; |
|||
} |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public ResultBean<T> setCode(String code) { |
|||
this.code = code; |
|||
return this; |
|||
} |
|||
|
|||
public T getData() { |
|||
return data; |
|||
} |
|||
|
|||
public ResultBean<T> setData(T data) { |
|||
this.data = data; |
|||
return this; |
|||
} |
|||
|
|||
public ResultBean<T> successOne() { |
|||
this.setSuccess(true); |
|||
this.setCode("0"); |
|||
this.setMessage("成功!"); |
|||
return this; |
|||
} |
|||
|
|||
public ResultBean<T> failOne() { |
|||
this.setSuccess(false); |
|||
this.setCode(String.valueOf(HttpStatus.ERROR)); |
|||
this.setMessage("操作失败!"); |
|||
return this; |
|||
} |
|||
|
|||
public ResultBean<T> success() { |
|||
this.setSuccess(true); |
|||
this.setCode(String.valueOf(HttpStatus.SUCCESS)); |
|||
this.setMsg("操作成功!"); |
|||
return this; |
|||
} |
|||
|
|||
public ResultBean<T> fail() { |
|||
this.setSuccess(false); |
|||
this.setCode(String.valueOf(HttpStatus.ERROR)); |
|||
this.setMsg("操作失败!"); |
|||
return this; |
|||
} |
|||
|
|||
public static <T> ResultBean<T> fireSuccess() { |
|||
ResultBean<T> rb = new ResultBean<T>(); |
|||
rb.setSuccess(true); |
|||
rb.setCode(String.valueOf(HttpStatus.SUCCESS)); |
|||
rb.setMsg("操作成功!"); |
|||
return rb; |
|||
} |
|||
|
|||
public static <T> ResultBean<T> fireFail() { |
|||
ResultBean<T> rb = new ResultBean<T>(); |
|||
rb.setSuccess(false); |
|||
rb.setCode(String.valueOf(HttpStatus.ERROR)); |
|||
rb.setMsg("操作失败!"); |
|||
return rb; |
|||
} |
|||
|
|||
/** |
|||
* 设置返回code及msg |
|||
* |
|||
* @param codeMsg Code和Msg的枚举 |
|||
* @return |
|||
*/ |
|||
public ResultBean<T> setCode(IResultCodeMsg codeMsg) { |
|||
this.code = codeMsg.getCode(); |
|||
this.msg = codeMsg.getMsg(); |
|||
return this; |
|||
} |
|||
|
|||
/** |
|||
* 返回失败信息,并指定结果code |
|||
* |
|||
* @param codeMsg Code和Msg的枚举 |
|||
* @return |
|||
*/ |
|||
public ResultBean<T> fail(IResultCodeMsg codeMsg) { |
|||
this.setSuccess(false); |
|||
this.code = codeMsg.getCode(); |
|||
this.msg = codeMsg.getMsg(); |
|||
return this; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,91 @@ |
|||
package com.yxt.wms.utils; |
|||
|
|||
/** |
|||
* @author dimengzhe |
|||
* @date 2020/12/2 10:00 |
|||
* @description |
|||
*/ |
|||
|
|||
public class StrFormatter { |
|||
|
|||
public static final String EMPTY_JSON = "{}"; |
|||
public static final char C_BACKSLASH = '\\'; |
|||
public static final char C_DELIM_START = '{'; |
|||
public static final char C_DELIM_END = '}'; |
|||
|
|||
/** |
|||
* 格式化字符串<br> |
|||
* 此方法只是简单将占位符 {} 按照顺序替换为参数<br> |
|||
* 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br> |
|||
* 例:<br> |
|||
* 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br> |
|||
* 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br> |
|||
* 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br> |
|||
* |
|||
* @param strPattern 字符串模板 |
|||
* @param argArray 参数列表 |
|||
* @return 结果 |
|||
*/ |
|||
public static String format(final String strPattern, final Object... argArray) |
|||
{ |
|||
if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) |
|||
{ |
|||
return strPattern; |
|||
} |
|||
final int strPatternLength = strPattern.length(); |
|||
|
|||
// 初始化定义好的长度以获得更好的性能
|
|||
StringBuilder sbuf = new StringBuilder(strPatternLength + 50); |
|||
|
|||
int handledPosition = 0; |
|||
int delimIndex;// 占位符所在位置
|
|||
for (int argIndex = 0; argIndex < argArray.length; argIndex++) |
|||
{ |
|||
delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition); |
|||
if (delimIndex == -1) |
|||
{ |
|||
if (handledPosition == 0) |
|||
{ |
|||
return strPattern; |
|||
} |
|||
else |
|||
{ // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
|
|||
sbuf.append(strPattern, handledPosition, strPatternLength); |
|||
return sbuf.toString(); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) |
|||
{ |
|||
if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) |
|||
{ |
|||
// 转义符之前还有一个转义符,占位符依旧有效
|
|||
sbuf.append(strPattern, handledPosition, delimIndex - 1); |
|||
sbuf.append(Convert.utf8Str(argArray[argIndex])); |
|||
handledPosition = delimIndex + 2; |
|||
} |
|||
else |
|||
{ |
|||
// 占位符被转义
|
|||
argIndex--; |
|||
sbuf.append(strPattern, handledPosition, delimIndex - 1); |
|||
sbuf.append(C_DELIM_START); |
|||
handledPosition = delimIndex + 1; |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
// 正常占位符
|
|||
sbuf.append(strPattern, handledPosition, delimIndex); |
|||
sbuf.append(Convert.utf8Str(argArray[argIndex])); |
|||
handledPosition = delimIndex + 2; |
|||
} |
|||
} |
|||
} |
|||
// 加入最后一个占位符后所有的字符
|
|||
sbuf.append(strPattern, handledPosition, strPattern.length()); |
|||
|
|||
return sbuf.toString(); |
|||
} |
|||
} |
@ -0,0 +1,526 @@ |
|||
package com.yxt.wms.utils; |
|||
|
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author dimengzhe |
|||
* @date 2020/12/2 9:59 |
|||
* @description |
|||
*/ |
|||
|
|||
public class StringUtils extends org.apache.commons.lang3.StringUtils { |
|||
|
|||
/** |
|||
* 空字符串 |
|||
*/ |
|||
private static final String NULLSTR = ""; |
|||
|
|||
/** |
|||
* 下划线 |
|||
*/ |
|||
private static final char SEPARATOR = '_'; |
|||
|
|||
/** |
|||
* 星号 |
|||
*/ |
|||
private static final String START = "*"; |
|||
|
|||
/** |
|||
* 获取参数不为空值 |
|||
* |
|||
* @param value defaultValue 要判断的value |
|||
* @return value 返回值 |
|||
*/ |
|||
public static <T> T nvl(T value, T defaultValue) { |
|||
return value != null ? value : defaultValue; |
|||
} |
|||
|
|||
/** |
|||
* * 判断一个Collection是否为空, 包含List,Set,Queue |
|||
* |
|||
* @param coll 要判断的Collection |
|||
* @return true:为空 false:非空 |
|||
*/ |
|||
public static boolean isEmpty(Collection<?> coll) { |
|||
return isNull(coll) || coll.isEmpty(); |
|||
} |
|||
|
|||
/** |
|||
* * 判断一个Collection是否非空,包含List,Set,Queue |
|||
* |
|||
* @param coll 要判断的Collection |
|||
* @return true:非空 false:空 |
|||
*/ |
|||
public static boolean isNotEmpty(Collection<?> coll) { |
|||
return !isEmpty(coll); |
|||
} |
|||
|
|||
/** |
|||
* * 判断一个对象数组是否为空 |
|||
* |
|||
* @param objects 要判断的对象数组 |
|||
* * @return true:为空 false:非空 |
|||
*/ |
|||
public static boolean isEmpty(Object[] objects) { |
|||
return isNull(objects) || (objects.length == 0); |
|||
} |
|||
|
|||
/** |
|||
* * 判断一个对象数组是否非空 |
|||
* |
|||
* @param objects 要判断的对象数组 |
|||
* @return true:非空 false:空 |
|||
*/ |
|||
public static boolean isNotEmpty(Object[] objects) { |
|||
return !isEmpty(objects); |
|||
} |
|||
|
|||
/** |
|||
* * 判断一个Map是否为空 |
|||
* |
|||
* @param map 要判断的Map |
|||
* @return true:为空 false:非空 |
|||
*/ |
|||
public static boolean isEmpty(Map<?, ?> map) { |
|||
return isNull(map) || map.isEmpty(); |
|||
} |
|||
|
|||
/** |
|||
* * 判断一个Map是否为空 |
|||
* |
|||
* @param map 要判断的Map |
|||
* @return true:非空 false:空 |
|||
*/ |
|||
public static boolean isNotEmpty(Map<?, ?> map) { |
|||
return !isEmpty(map); |
|||
} |
|||
|
|||
/** |
|||
* * 判断一个字符串是否为空串 |
|||
* |
|||
* @param str String |
|||
* @return true:为空 false:非空 |
|||
*/ |
|||
public static boolean isEmpty(String str) { |
|||
return isNull(str) || NULLSTR.equals(str.trim()); |
|||
} |
|||
|
|||
/** |
|||
* * 判断一个字符串是否为非空串 |
|||
* |
|||
* @param str String |
|||
* @return true:非空串 false:空串 |
|||
*/ |
|||
public static boolean isNotEmpty(String str) { |
|||
return !isEmpty(str); |
|||
} |
|||
|
|||
/** |
|||
* * 判断一个对象是否为空 |
|||
* |
|||
* @param object Object |
|||
* @return true:为空 false:非空 |
|||
*/ |
|||
public static boolean isNull(Object object) { |
|||
return object == null; |
|||
} |
|||
|
|||
/** |
|||
* * 判断一个对象是否非空 |
|||
* |
|||
* @param object Object |
|||
* @return true:非空 false:空 |
|||
*/ |
|||
public static boolean isNotNull(Object object) { |
|||
return !isNull(object); |
|||
} |
|||
|
|||
/** |
|||
* * 判断一个对象是否是数组类型(Java基本型别的数组) |
|||
* |
|||
* @param object 对象 |
|||
* @return true:是数组 false:不是数组 |
|||
*/ |
|||
public static boolean isArray(Object object) { |
|||
return isNotNull(object) && object.getClass().isArray(); |
|||
} |
|||
|
|||
/** |
|||
* 去空格 |
|||
*/ |
|||
public static String trim(String str) { |
|||
return (str == null ? "" : str.trim()); |
|||
} |
|||
|
|||
/** |
|||
* 截取字符串 |
|||
* |
|||
* @param str 字符串 |
|||
* @param start 开始 |
|||
* @return 结果 |
|||
*/ |
|||
public static String substring(final String str, int start) { |
|||
if (str == null) { |
|||
return NULLSTR; |
|||
} |
|||
|
|||
if (start < 0) { |
|||
start = str.length() + start; |
|||
} |
|||
|
|||
if (start < 0) { |
|||
start = 0; |
|||
} |
|||
if (start > str.length()) { |
|||
return NULLSTR; |
|||
} |
|||
|
|||
return str.substring(start); |
|||
} |
|||
|
|||
/** |
|||
* 截取字符串 |
|||
* |
|||
* @param str 字符串 |
|||
* @param start 开始 |
|||
* @param end 结束 |
|||
* @return 结果 |
|||
*/ |
|||
public static String substring(final String str, int start, int end) { |
|||
if (str == null) { |
|||
return NULLSTR; |
|||
} |
|||
|
|||
if (end < 0) { |
|||
end = str.length() + end; |
|||
} |
|||
if (start < 0) { |
|||
start = str.length() + start; |
|||
} |
|||
|
|||
if (end > str.length()) { |
|||
end = str.length(); |
|||
} |
|||
|
|||
if (start > end) { |
|||
return NULLSTR; |
|||
} |
|||
|
|||
if (start < 0) { |
|||
start = 0; |
|||
} |
|||
if (end < 0) { |
|||
end = 0; |
|||
} |
|||
|
|||
return str.substring(start, end); |
|||
} |
|||
|
|||
/** |
|||
* 格式化文本, {} 表示占位符<br> |
|||
* 此方法只是简单将占位符 {} 按照顺序替换为参数<br> |
|||
* 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br> |
|||
* 例:<br> |
|||
* 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br> |
|||
* 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br> |
|||
* 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br> |
|||
* |
|||
* @param template 文本模板,被替换的部分用 {} 表示 |
|||
* @param params 参数值 |
|||
* @return 格式化后的文本 |
|||
*/ |
|||
public static String format(String template, Object... params) { |
|||
if (isEmpty(params) || isEmpty(template)) { |
|||
return template; |
|||
} |
|||
return StrFormatter.format(template, params); |
|||
} |
|||
|
|||
/** |
|||
* 下划线转驼峰命名 |
|||
*/ |
|||
public static String toUnderScoreCase(String str) { |
|||
if (str == null) { |
|||
return null; |
|||
} |
|||
StringBuilder sb = new StringBuilder(); |
|||
// 前置字符是否大写
|
|||
boolean preCharIsUpperCase = true; |
|||
// 当前字符是否大写
|
|||
boolean curreCharIsUpperCase = true; |
|||
// 下一字符是否大写
|
|||
boolean nexteCharIsUpperCase = true; |
|||
for (int i = 0; i < str.length(); i++) { |
|||
char c = str.charAt(i); |
|||
if (i > 0) { |
|||
preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1)); |
|||
} else { |
|||
preCharIsUpperCase = false; |
|||
} |
|||
|
|||
curreCharIsUpperCase = Character.isUpperCase(c); |
|||
|
|||
if (i < (str.length() - 1)) { |
|||
nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1)); |
|||
} |
|||
|
|||
if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) { |
|||
sb.append(SEPARATOR); |
|||
} else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) { |
|||
sb.append(SEPARATOR); |
|||
} |
|||
sb.append(Character.toLowerCase(c)); |
|||
} |
|||
|
|||
return sb.toString(); |
|||
} |
|||
|
|||
/** |
|||
* 是否包含字符串 |
|||
* |
|||
* @param str 验证字符串 |
|||
* @param strs 字符串组 |
|||
* @return 包含返回true |
|||
*/ |
|||
public static boolean inStringIgnoreCase(String str, String... strs) { |
|||
if (str != null && strs != null) { |
|||
for (String s : strs) { |
|||
if (str.equalsIgnoreCase(trim(s))) { |
|||
return true; |
|||
} |
|||
} |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
/** |
|||
* 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld |
|||
* |
|||
* @param name 转换前的下划线大写方式命名的字符串 |
|||
* @return 转换后的驼峰式命名的字符串 |
|||
*/ |
|||
public static String convertToCamelCase(String name) { |
|||
StringBuilder result = new StringBuilder(); |
|||
// 快速检查
|
|||
if (name == null || name.isEmpty()) { |
|||
// 没必要转换
|
|||
return ""; |
|||
} else if (!name.contains("_")) { |
|||
// 不含下划线,仅将首字母大写
|
|||
return name.substring(0, 1).toUpperCase() + name.substring(1); |
|||
} |
|||
// 用下划线将原始字符串分割
|
|||
String[] camels = name.split("_"); |
|||
for (String camel : camels) { |
|||
// 跳过原始字符串中开头、结尾的下换线或双重下划线
|
|||
if (camel.isEmpty()) { |
|||
continue; |
|||
} |
|||
// 首字母大写
|
|||
result.append(camel.substring(0, 1).toUpperCase()); |
|||
result.append(camel.substring(1).toLowerCase()); |
|||
} |
|||
return result.toString(); |
|||
} |
|||
|
|||
/** |
|||
* 驼峰式命名法 例如:user_name->userName |
|||
*/ |
|||
public static String toCamelCase(String s) { |
|||
if (s == null) { |
|||
return null; |
|||
} |
|||
s = s.toLowerCase(); |
|||
StringBuilder sb = new StringBuilder(s.length()); |
|||
boolean upperCase = false; |
|||
for (int i = 0; i < s.length(); i++) { |
|||
char c = s.charAt(i); |
|||
|
|||
if (c == SEPARATOR) { |
|||
upperCase = true; |
|||
} else if (upperCase) { |
|||
sb.append(Character.toUpperCase(c)); |
|||
upperCase = false; |
|||
} else { |
|||
sb.append(c); |
|||
} |
|||
} |
|||
return sb.toString(); |
|||
} |
|||
|
|||
/** |
|||
* 查找指定字符串是否匹配指定字符串列表中的任意一个字符串 |
|||
* |
|||
* @param str 指定字符串 |
|||
* @param strs 需要检查的字符串数组 |
|||
* @return 是否匹配 |
|||
*/ |
|||
public static boolean matchesTwo(String str, List<String> strs) { |
|||
if (isEmpty(str) || isEmpty(strs)) { |
|||
return false; |
|||
} |
|||
for (String testStr : strs) { |
|||
if (matchesTwo(str, testStr)) { |
|||
return true; |
|||
} |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
public static boolean matches(String str, List<String> strs) { |
|||
if (isEmpty(str) || isEmpty(strs)) { |
|||
return false; |
|||
} |
|||
for (String testStr : strs) { |
|||
if (matches(str, testStr)) { |
|||
return true; |
|||
} |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
/** |
|||
* 查找指定字符串是否匹配指定字符串数组中的任意一个字符串 |
|||
* |
|||
* @param str 指定字符串 |
|||
* @param strs 需要检查的字符串数组 |
|||
* @return 是否匹配 |
|||
*/ |
|||
public static boolean matches(String str, String... strs) { |
|||
if (isEmpty(str) || isEmpty(strs)) { |
|||
return false; |
|||
} |
|||
for (String testStr : strs) { |
|||
if (matches(str, testStr)) { |
|||
return true; |
|||
} |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
public static boolean matches(String str, String pattern) { |
|||
if (isEmpty(pattern) || isEmpty(str)) { |
|||
return false; |
|||
} |
|||
|
|||
pattern = pattern.replaceAll("\\s*", ""); // 替换空格
|
|||
int beginOffset = 0; // pattern截取开始位置
|
|||
int formerStarOffset = -1; // 前星号的偏移位置
|
|||
int latterStarOffset = -1; // 后星号的偏移位置
|
|||
|
|||
String remainingURI = str; |
|||
String prefixPattern = ""; |
|||
String suffixPattern = ""; |
|||
|
|||
boolean result = false; |
|||
do { |
|||
formerStarOffset = indexOf(pattern, START, beginOffset); |
|||
prefixPattern = substring(pattern, beginOffset, formerStarOffset > -1 ? formerStarOffset : pattern.length()); |
|||
|
|||
// 匹配前缀Pattern
|
|||
result = remainingURI.equals(prefixPattern); |
|||
// 已经没有星号,直接返回
|
|||
if (formerStarOffset == -1) { |
|||
return result; |
|||
} |
|||
|
|||
// 匹配失败,直接返回
|
|||
if (!result){ |
|||
return false; |
|||
} |
|||
if (!isEmpty(prefixPattern)) { |
|||
remainingURI = substringAfter(str, prefixPattern); |
|||
} |
|||
|
|||
// 匹配后缀Pattern
|
|||
latterStarOffset = indexOf(pattern, START, formerStarOffset + 1); |
|||
suffixPattern = substring(pattern, formerStarOffset + 1, latterStarOffset > -1 ? latterStarOffset : pattern.length()); |
|||
|
|||
result = remainingURI.equals(suffixPattern); |
|||
// 匹配失败,直接返回
|
|||
if (!result){ |
|||
return false; |
|||
} |
|||
if (!isEmpty(suffixPattern)) { |
|||
remainingURI = substringAfter(str, suffixPattern); |
|||
} |
|||
|
|||
// 移动指针
|
|||
beginOffset = latterStarOffset + 1; |
|||
|
|||
} |
|||
while (!isEmpty(suffixPattern) && !isEmpty(remainingURI)); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
/** |
|||
* 查找指定字符串是否匹配 |
|||
* |
|||
* @param str 指定字符串 |
|||
* @param pattern 需要检查的字符串 |
|||
* @return 是否匹配 |
|||
*/ |
|||
public static boolean matchesTwo(String str, String pattern) { |
|||
if (isEmpty(pattern) || isEmpty(str)) { |
|||
return false; |
|||
} |
|||
|
|||
pattern = pattern.replaceAll("\\s*", ""); // 替换空格
|
|||
int beginOffset = 0; // pattern截取开始位置
|
|||
int formerStarOffset = -1; // 前星号的偏移位置
|
|||
int latterStarOffset = -1; // 后星号的偏移位置
|
|||
|
|||
String remainingURI = str; |
|||
String prefixPattern = ""; |
|||
String suffixPattern = ""; |
|||
|
|||
boolean result = false; |
|||
do { |
|||
formerStarOffset = indexOf(pattern, START, beginOffset); |
|||
prefixPattern = substring(pattern, beginOffset, formerStarOffset > -1 ? formerStarOffset : pattern.length()); |
|||
|
|||
// 匹配前缀Pattern
|
|||
result = remainingURI.contains(prefixPattern); |
|||
// 已经没有星号,直接返回
|
|||
if (formerStarOffset == -1) { |
|||
return result; |
|||
} |
|||
|
|||
// 匹配失败,直接返回
|
|||
if (!result){ |
|||
return false; |
|||
} |
|||
if (!isEmpty(prefixPattern)) { |
|||
remainingURI = substringAfter(str, prefixPattern); |
|||
} |
|||
|
|||
// 匹配后缀Pattern
|
|||
latterStarOffset = indexOf(pattern, START, formerStarOffset + 1); |
|||
suffixPattern = substring(pattern, formerStarOffset + 1, latterStarOffset > -1 ? latterStarOffset : pattern.length()); |
|||
|
|||
result = remainingURI.contains(suffixPattern); |
|||
// 匹配失败,直接返回
|
|||
if (!result){ |
|||
return false; |
|||
} |
|||
if (!isEmpty(suffixPattern)) { |
|||
remainingURI = substringAfter(str, suffixPattern); |
|||
} |
|||
|
|||
// 移动指针
|
|||
beginOffset = latterStarOffset + 1; |
|||
|
|||
} |
|||
while (!isEmpty(suffixPattern) && !isEmpty(remainingURI)); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
@SuppressWarnings("unchecked") |
|||
public static <T> T cast(Object obj) { |
|||
return (T) obj; |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
spring: |
|||
resources: |
|||
static-locations: file:D://supervise |
|||
cloud: |
|||
nacos: |
|||
discovery: |
|||
# namespace: supervise |
|||
server-addr: 127.0.0.1:8848 |
|||
redis: |
|||
database: 3 # Redis数据库索引(默认为0) |
|||
host: 127.0.0.1 |
|||
jedis: |
|||
pool: |
|||
max-active: -1 #连接池最大连接数(使用负值表示没有限制) |
|||
max-idle: 8 #连接池中的最大空闲连接 |
|||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) |
|||
min-idle: 0 # 连接池中的最小空闲连接 |
|||
password: |
|||
port: 6379 |
|||
timeout: 0 # 连接超时时间(毫秒) |
@ -0,0 +1,20 @@ |
|||
spring: |
|||
resources: |
|||
static-locations: file:D://supervise |
|||
cloud: |
|||
nacos: |
|||
discovery: |
|||
# namespace: supervise |
|||
server-addr: 127.0.0.1:8848 |
|||
redis: |
|||
database: 3 # Redis数据库索引(默认为0) |
|||
host: 127.0.0.1 |
|||
jedis: |
|||
pool: |
|||
max-active: -1 #连接池最大连接数(使用负值表示没有限制) |
|||
max-idle: 8 #连接池中的最大空闲连接 |
|||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) |
|||
min-idle: 0 # 连接池中的最小空闲连接 |
|||
password: |
|||
port: 6379 |
|||
timeout: 0 # 连接超时时间(毫秒) |
@ -0,0 +1 @@ |
|||
|
@ -0,0 +1,36 @@ |
|||
hystrix: |
|||
command: |
|||
default: |
|||
execution: |
|||
isolation: |
|||
strategy: SEMAPHORE |
|||
thread: |
|||
timeoutInMilliseconds: 300000 |
|||
server: |
|||
port: 8111 |
|||
spring: |
|||
application: |
|||
name: gateway |
|||
profiles: |
|||
active: dev |
|||
# active: pro |
|||
cloud: |
|||
gateway: |
|||
routes: |
|||
- id: wms-biz |
|||
predicates: |
|||
- Path= /wms/** |
|||
uri: lb://wms-biz |
|||
filters: |
|||
- StripPrefix=1 |
|||
|
|||
ignore: |
|||
whites: |
|||
- /wms/apiadmin/sysuser/login #pc端登录 |
|||
- /wms/apiadmin/sysuser/register #pc端登录 |
|||
|
|||
|
|||
|
|||
|
|||
whitesTwo: #包含所有 |
|||
- /upload/** |
@ -0,0 +1,404 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<groupId>com.yxt</groupId> |
|||
<artifactId>share-store</artifactId> |
|||
<packaging>pom</packaging> |
|||
<version>1.0-SNAPSHOT</version> |
|||
<modules> |
|||
<module>gateway</module> |
|||
<module>wms-biz</module> |
|||
</modules> |
|||
|
|||
|
|||
<properties> |
|||
<!-- 使用的JAVA版本号 --> |
|||
<java.version>1.8</java.version> |
|||
<!-- 项目构建编码 --> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
<!-- 项目输出编码 --> |
|||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
|||
<maven.compiler.source>1.8</maven.compiler.source> |
|||
<maven.compiler.target>1.8</maven.compiler.target> |
|||
|
|||
<!-- Spring相关组件 --> |
|||
<!-- SpringBoot 依赖配置 --> |
|||
<spring-boot.version>2.2.9.RELEASE</spring-boot.version> |
|||
<!-- SpringCloud 微服务 --> |
|||
<spring-cloud.version>Hoxton.SR6</spring-cloud.version> |
|||
<!-- SpringCloud Alibaba 微服务 --> |
|||
<spring-cloud-alibaba.version>2.2.1.RELEASE</spring-cloud-alibaba.version> |
|||
<!-- nacos客户端 --> |
|||
<nacos.version>1.3.0</nacos.version> |
|||
|
|||
<!-- 公共的基础组件 --> |
|||
<!-- io常用工具类 --> |
|||
<commons.io.version>2.5</commons.io.version> |
|||
<commons-codec.version>1.14</commons-codec.version> |
|||
<!--Bean工具 --> |
|||
<commons.beanutils.version>1.9.3</commons.beanutils.version> |
|||
<!-- 线程池工具 --> |
|||
<common-pool.version>2.6.2</common-pool.version> |
|||
<!-- mybatis,mybatis-plus已经引用 |
|||
<spring-boot.mybatis>2.1.2</spring-boot.mybatis>--> |
|||
<!-- mybatis-plus --> |
|||
<mybatis-plus.version>3.4.0</mybatis-plus.version> |
|||
<!-- JSON 解析器和生成器 --> |
|||
<fastjson.version>1.2.73</fastjson.version> |
|||
<!--Token生成与解析 --> |
|||
<jjwt.version>0.9.1</jjwt.version> |
|||
|
|||
<!-- 辅助组件 --> |
|||
<!-- Swagger 依赖配置 --> |
|||
<swagger.fox.version>2.9.2</swagger.fox.version> |
|||
<knife4j-Swagger>2.0.5</knife4j-Swagger> |
|||
<!-- excel工具 --> |
|||
<poi.version>3.17</poi.version> |
|||
<!-- 验证码 --> |
|||
<kaptcha.version>2.3.2</kaptcha.version> |
|||
<!-- 解析客户端操作系统、浏览器等 --> |
|||
<bitwalker.version>1.19</bitwalker.version> |
|||
<!-- velocity模板引擎 --> |
|||
<velocity.version>1.7</velocity.version> |
|||
<!-- Hutool组件 --> |
|||
<hutool.version>5.4.0</hutool.version> |
|||
<hibernate-validator.version>6.0.20.Final</hibernate-validator.version> |
|||
<lombok.version>1.18.24</lombok.version> |
|||
<jedis.version>3.1.0</jedis.version> |
|||
<java-jwt.version>3.10.1</java-jwt.version> |
|||
<redis.version>2.2.9.RELEASE</redis.version> |
|||
<poi-tl.version>1.8.1</poi-tl.version> |
|||
<poi.version>4.1.2</poi.version> |
|||
<flowable.version>6.5.0</flowable.version> |
|||
<pdfbox.version>2.0.25</pdfbox.version> |
|||
</properties> |
|||
|
|||
<!-- 依赖声明 --> |
|||
<dependencyManagement> |
|||
<dependencies> |
|||
<!-- SpringBoot 依赖配置 --> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-dependencies</artifactId> |
|||
<version>${spring-boot.version}</version> |
|||
<type>pom</type> |
|||
<scope>import</scope> |
|||
</dependency> |
|||
<!-- SpringCloud 微服务 --> |
|||
<dependency> |
|||
<groupId>org.springframework.cloud</groupId> |
|||
<artifactId>spring-cloud-dependencies</artifactId> |
|||
<version>${spring-cloud.version}</version> |
|||
<type>pom</type> |
|||
<scope>import</scope> |
|||
</dependency> |
|||
<!-- SpringCloud Alibaba 微服务 --> |
|||
<dependency> |
|||
<groupId>com.alibaba.cloud</groupId> |
|||
<artifactId>spring-cloud-alibaba-dependencies</artifactId> |
|||
<version>${spring-cloud-alibaba.version}</version> |
|||
<type>pom</type> |
|||
<scope>import</scope> |
|||
</dependency> |
|||
<!-- Alibaba Nacos 配置 --> |
|||
<dependency> |
|||
<groupId>com.alibaba.nacos</groupId> |
|||
<artifactId>nacos-client</artifactId> |
|||
<version>${nacos.version}</version> |
|||
</dependency> |
|||
<!--Redis配置--> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-data-redis</artifactId> |
|||
<version>${redis.version}</version> |
|||
<exclusions> |
|||
<exclusion> |
|||
<groupId>io.lettuce</groupId> |
|||
<artifactId>lettuce-core</artifactId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
<!-- https://mvnrepository.com/artifact/com.auth0/java-jwt --> |
|||
<dependency> |
|||
<groupId>com.auth0</groupId> |
|||
<artifactId>java-jwt</artifactId> |
|||
<version>${java-jwt.version}</version> |
|||
</dependency> |
|||
<!-- https://mvnrepository.com/artifact/redis.clients/jedis --> |
|||
<dependency> |
|||
<groupId>redis.clients</groupId> |
|||
<artifactId>jedis</artifactId> |
|||
<version>${jedis.version}</version> |
|||
</dependency> |
|||
<!-- io常用工具类 --> |
|||
<dependency> |
|||
<groupId>commons-io</groupId> |
|||
<artifactId>commons-io</artifactId> |
|||
<version>${commons.io.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>commons-codec</groupId> |
|||
<artifactId>commons-codec</artifactId> |
|||
<version>${commons-codec.version}</version> |
|||
</dependency> |
|||
<!--Bean工具 --> |
|||
<dependency> |
|||
<groupId>commons-beanutils</groupId> |
|||
<artifactId>commons-beanutils</artifactId> |
|||
<version>${commons.beanutils.version}</version> |
|||
</dependency> |
|||
<!-- 公共资源池 --> |
|||
<dependency> |
|||
<groupId>org.apache.commons</groupId> |
|||
<artifactId>commons-pool2</artifactId> |
|||
<version>${common-pool.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.baomidou</groupId> |
|||
<artifactId>mybatis-plus-boot-starter</artifactId> |
|||
<version>${mybatis-plus.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.baomidou</groupId> |
|||
<artifactId>mybatis-plus-annotation</artifactId> |
|||
<version>${mybatis-plus.version}</version> |
|||
</dependency> |
|||
<!-- JSON 解析器和生成器 --> |
|||
<dependency> |
|||
<groupId>com.alibaba</groupId> |
|||
<artifactId>fastjson</artifactId> |
|||
<version>${fastjson.version}</version> |
|||
</dependency> |
|||
<!--Token生成与解析 --> |
|||
<dependency> |
|||
<groupId>io.jsonwebtoken</groupId> |
|||
<artifactId>jjwt</artifactId> |
|||
<version>${jjwt.version}</version> |
|||
</dependency> |
|||
|
|||
<!-- Swagger 依赖配置 --> |
|||
<dependency> |
|||
<groupId>io.springfox</groupId> |
|||
<artifactId>springfox-swagger2</artifactId> |
|||
<version>${swagger.fox.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>io.springfox</groupId> |
|||
<artifactId>springfox-swagger-ui</artifactId> |
|||
<version>${swagger.fox.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.github.xiaoymin</groupId> |
|||
<artifactId>knife4j-dependencies</artifactId> |
|||
<version>${knife4j-Swagger}</version> |
|||
<type>pom</type> |
|||
<scope>import</scope> |
|||
</dependency> |
|||
<!-- excel工具 --> |
|||
<dependency> |
|||
<groupId>org.apache.poi</groupId> |
|||
<artifactId>poi-ooxml</artifactId> |
|||
<version>${poi.version}</version> |
|||
</dependency> |
|||
<!-- 验证码 --> |
|||
<dependency> |
|||
<groupId>com.github.penggle</groupId> |
|||
<artifactId>kaptcha</artifactId> |
|||
<version>${kaptcha.version}</version> |
|||
</dependency> |
|||
<!-- 解析客户端操作系统、浏览器等 --> |
|||
<dependency> |
|||
<groupId>eu.bitwalker</groupId> |
|||
<artifactId>UserAgentUtils</artifactId> |
|||
<version>${bitwalker.version}</version> |
|||
</dependency> |
|||
<!-- 代码生成使用模板 --> |
|||
<dependency> |
|||
<groupId>org.apache.velocity</groupId> |
|||
<artifactId>velocity</artifactId> |
|||
<version>${velocity.version}</version> |
|||
</dependency> |
|||
|
|||
<!-- hutool所有模块 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-all</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 核心,包括Bean操作、日期、各种Util等 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-core</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 基于HttpUrlConnection的Http客户端封装 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-http</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 加密解密模块,提供对称、非对称和摘要算法封装 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-crypto</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 简单缓存实现 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-cache</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 图片验证码实现 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-captcha</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 针对POI中Excel和Word的封装 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-poi</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool JSON实现 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-json</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 定时任务模块,提供类Crontab表达式的定时任务 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-cron</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 系统参数调用封装(JVM信息等) --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-system</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 功能更强大的Setting配置文件和Properties封装 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-setting</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 扩展模块,对第三方封装(模板引擎、邮件、Servlet、二维码、Emoji、FTP、分词等) --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-extra</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool JDK动态代理封装,提供非IOC下的切面支持 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-aop</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 布隆过滤,提供一些Hash算法的布隆过滤 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-bloomFilter</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool JDBC封装后的数据操作,基于ActiveRecord思想 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-db</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 自动识别日志实现的日志门面 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-log</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 基于Java的NIO和AIO的Socket封装 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-socket</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 基于DFA模型的多关键字查找 --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-dfa</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<!-- hutool 脚本执行封装,例如Javascript --> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-script</artifactId> |
|||
<version>${hutool.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.hibernate.validator</groupId> |
|||
<artifactId>hibernate-validator</artifactId> |
|||
<version>${hibernate-validator.version}</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.projectlombok</groupId> |
|||
<artifactId>lombok</artifactId> |
|||
<optional>true</optional> |
|||
<version>${lombok.version}</version> |
|||
</dependency> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/com.deepoove/poi-tl --> |
|||
<dependency> |
|||
<groupId>com.deepoove</groupId> |
|||
<artifactId>poi-tl</artifactId> |
|||
<version>${poi-tl.version}</version> |
|||
</dependency> |
|||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi --> |
|||
<dependency> |
|||
<groupId>org.apache.poi</groupId> |
|||
<artifactId>poi</artifactId> |
|||
<version>${poi.version}</version> |
|||
</dependency> |
|||
<!--flowable组件--> |
|||
<dependency> |
|||
<groupId>org.flowable</groupId> |
|||
<artifactId>flowable-engine</artifactId> |
|||
<version>${flowable.version}</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.flowable</groupId> |
|||
<artifactId>flowable-spring-boot-starter-basic</artifactId> |
|||
<version>${flowable.version}</version> |
|||
<exclusions><!-- 需要排除flowable的mybatis依赖,不然会跟mybatis-plus冲突 --> |
|||
<exclusion> |
|||
<groupId>org.mybatis</groupId> |
|||
<artifactId>mybatis</artifactId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.apache.pdfbox</groupId> |
|||
<artifactId>pdfbox</artifactId> |
|||
<version>${pdfbox.version}</version> |
|||
</dependency> |
|||
|
|||
</dependencies> |
|||
</dependencyManagement> |
|||
|
|||
<distributionManagement> |
|||
<repository> |
|||
<id>nexus-releases</id> |
|||
<url>http://nexus3.yyundong.com/repository/yxt-mvn-releases/</url> |
|||
</repository> |
|||
<snapshotRepository> |
|||
<id>nexus-snapshots</id> |
|||
<url>http://nexus3.yyundong.com/repository/yxt-mvn-snapshot/</url> |
|||
</snapshotRepository> |
|||
</distributionManagement> |
|||
|
|||
</project> |
@ -0,0 +1,168 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<parent> |
|||
<artifactId>share-store</artifactId> |
|||
<groupId>com.yxt</groupId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
</parent> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<groupId>com.yxt.share</groupId> |
|||
<artifactId>wms-biz</artifactId> |
|||
|
|||
<properties> |
|||
<maven.compiler.source>8</maven.compiler.source> |
|||
<maven.compiler.target>8</maven.compiler.target> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
</properties> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>com.alibaba</groupId> |
|||
<artifactId>easyexcel</artifactId> |
|||
<version>3.3.2</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.yxt</groupId> |
|||
<artifactId>yxt-common-base</artifactId> |
|||
<version>0.0.1</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.alibaba.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-openfeign</artifactId> |
|||
</dependency> |
|||
<!--mysql--> |
|||
<dependency> |
|||
<groupId>mysql</groupId> |
|||
<artifactId>mysql-connector-java</artifactId> |
|||
<scope>runtime</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.baomidou</groupId> |
|||
<artifactId>mybatis-plus-boot-starter</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.baomidou</groupId> |
|||
<artifactId>mybatis-plus-annotation</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.projectlombok</groupId> |
|||
<artifactId>lombok</artifactId> |
|||
<version>1.18.24</version> |
|||
<optional>true</optional> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.yxt</groupId> |
|||
<artifactId>yxt-common-base</artifactId> |
|||
<version>0.0.1</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-web</artifactId> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.alibaba.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-openfeign</artifactId> |
|||
</dependency> |
|||
|
|||
<!--mysql--> |
|||
<dependency> |
|||
<groupId>mysql</groupId> |
|||
<artifactId>mysql-connector-java</artifactId> |
|||
<scope>runtime</scope> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.baomidou</groupId> |
|||
<artifactId>mybatis-plus-boot-starter</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.baomidou</groupId> |
|||
<artifactId>mybatis-plus-annotation</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>junit</groupId> |
|||
<artifactId>junit</artifactId> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.projectlombok</groupId> |
|||
<artifactId>lombok</artifactId> |
|||
<optional>true</optional> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-test</artifactId> |
|||
<scope>test</scope> |
|||
</dependency> |
|||
|
|||
<!-- Sa-Token 权限认证,在线文档:https://sa-token.cc --> |
|||
<dependency> |
|||
<groupId>cn.dev33</groupId> |
|||
<artifactId>sa-token-spring-boot-starter</artifactId> |
|||
<version>1.37.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-all</artifactId> |
|||
<version>5.8.23</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-core</artifactId> |
|||
<version>5.8.23</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.google.zxing</groupId> |
|||
<artifactId>core</artifactId> |
|||
<version>3.5.2</version> |
|||
</dependency> |
|||
|
|||
</dependencies> |
|||
|
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-maven-plugin</artifactId> |
|||
<version>2.5.6</version> |
|||
<executions> |
|||
<execution> |
|||
<goals> |
|||
<goal>repackage</goal> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
<resources> |
|||
<resource> |
|||
<directory>src/main/java</directory> |
|||
<includes> |
|||
<include>**/*Mapper.xml</include> |
|||
</includes> |
|||
</resource> |
|||
<resource> |
|||
<directory>src/main/resources</directory> |
|||
<includes> |
|||
<include>**/*.*</include> |
|||
</includes> |
|||
<filtering>false</filtering> |
|||
</resource> |
|||
</resources> |
|||
</build> |
|||
</project> |
@ -0,0 +1,24 @@ |
|||
package com.yxt.wms; |
|||
|
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
|||
import org.springframework.cloud.openfeign.EnableFeignClients; |
|||
import org.springframework.scheduling.annotation.EnableScheduling; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date ${DATE} ${TIME} |
|||
*/ |
|||
@SpringBootApplication(scanBasePackages = { |
|||
"com.yxt.common.base.config", |
|||
"com.yxt.wms" |
|||
}) |
|||
@EnableDiscoveryClient |
|||
@EnableScheduling |
|||
@EnableFeignClients |
|||
public class WmsApplication { |
|||
public static void main(String[] args) { |
|||
SpringApplication.run(WmsApplication.class, args); |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.yxt.wms.apiadmin; |
|||
|
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController("com.yxt.wms.apiadmin.AdminHomeRest") |
|||
@RequestMapping("/apiadmin/home") |
|||
public class AdminHomeRest { |
|||
|
|||
} |
@ -0,0 +1,66 @@ |
|||
package com.yxt.wms.apiadmin; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.wms.biz.basebrandinfo.BaseBrandInfoService; |
|||
import com.yxt.wms.biz.basebrandinfo.BaseBrandInfo; |
|||
import com.yxt.wms.biz.basebrandinfo.BaseBrandInfoDto; |
|||
import com.yxt.wms.biz.basebrandinfo.BaseBrandInfoQuery; |
|||
import com.yxt.wms.biz.basebrandinfo.BaseBrandInfoVo; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 15:49 |
|||
*/ |
|||
@Api(tags = "商品品牌") |
|||
@RestController |
|||
@RequestMapping("/apiadmin/base/basegoodsbrand") |
|||
public class BaseGoodsBrandRest { |
|||
|
|||
@Autowired |
|||
BaseBrandInfoService baseBrandInfoService; |
|||
|
|||
@ApiOperation("分页列表") |
|||
@PostMapping("/listPage") |
|||
public ResultBean<PagerVo<BaseBrandInfoVo>> listPage(@RequestBody PagerQuery<BaseBrandInfoQuery> pq) { |
|||
return baseBrandInfoService.listPage(pq); |
|||
} |
|||
|
|||
@ApiOperation("查询所有的品牌") |
|||
@GetMapping("/listAll") |
|||
public ResultBean<List<BaseBrandInfo>> listAll() { |
|||
return baseBrandInfoService.listAll(); |
|||
} |
|||
|
|||
@ApiOperation("保存修改") |
|||
@PostMapping("/saveOrUpdate") |
|||
public ResultBean<String> saveOrUpdate(@RequestBody BaseBrandInfoDto dto) { |
|||
return baseBrandInfoService.saveOrUpdate(dto); |
|||
} |
|||
|
|||
@ApiOperation("初始化") |
|||
@GetMapping("/initialization/{sid}") |
|||
public ResultBean<BaseBrandInfoVo> initialization(@PathVariable("sid") String sid) { |
|||
return baseBrandInfoService.initialization(sid); |
|||
} |
|||
|
|||
@ApiOperation("删除") |
|||
@DeleteMapping("/delete/{sid}") |
|||
public ResultBean delete(@PathVariable("sid") String sid) { |
|||
return baseBrandInfoService.delete(sid); |
|||
} |
|||
|
|||
|
|||
@ApiOperation("更改可用状态") |
|||
@GetMapping("/updateIsEnable/{sid}/{isEnable}") |
|||
public ResultBean updateIsEnable(@PathVariable("sid") String sid,@PathVariable("isEnable")String isEnable) { |
|||
return baseBrandInfoService.updateIsEnable(sid,isEnable); |
|||
} |
|||
} |
@ -0,0 +1,74 @@ |
|||
package com.yxt.wms.apiadmin; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.wms.biz.basegoodsspu.BaseGoodsSpuService; |
|||
import com.yxt.wms.biz.basegoodsspu.BaseGoodsSpuDto; |
|||
import com.yxt.wms.biz.basegoodsspu.BaseGoodsSpuQuery; |
|||
import com.yxt.wms.biz.basegoodsspu.BaseGoodsSpuVo; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.IOException; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/4/12 11:20 |
|||
*/ |
|||
@RestController() |
|||
@RequestMapping("/apiadmin/base/basegoodsspu") |
|||
public class BaseGoodsSpuRest { |
|||
|
|||
|
|||
@Autowired |
|||
BaseGoodsSpuService baseGoodsSpuService; |
|||
|
|||
@ApiOperation("分页列表") |
|||
@PostMapping("/listPage") |
|||
public ResultBean<PagerVo<BaseGoodsSpuVo>> listPage(@RequestBody PagerQuery<BaseGoodsSpuQuery> pq) { |
|||
return baseGoodsSpuService.listPage(pq); |
|||
} |
|||
|
|||
@ApiOperation("保存修改") |
|||
@PostMapping("/saveOrUpdate") |
|||
public ResultBean<String> saveOrUpdate(@RequestBody BaseGoodsSpuDto dto) { |
|||
return baseGoodsSpuService.saveOrUpdate(dto); |
|||
} |
|||
// @ApiOperation("保存商品信息及sku")
|
|||
// @PostMapping("/save")
|
|||
// public ResultBean<String> save(@RequestBody BaseGoodsSpuDto dto) {
|
|||
// return baseGoodsSpuService.save(dto);
|
|||
// }
|
|||
@ApiOperation("初始化") |
|||
@GetMapping("/initialization/{sid}") |
|||
public ResultBean<BaseGoodsSpuVo> initialization(@PathVariable("sid") String sid) { |
|||
return baseGoodsSpuService.initialization(sid); |
|||
} |
|||
|
|||
@ApiOperation("删除") |
|||
@DeleteMapping("/delete/{sid}") |
|||
public ResultBean delete(@PathVariable("sid") String sid) { |
|||
return baseGoodsSpuService.delete(sid); |
|||
} |
|||
|
|||
@ApiOperation("更改可用状态") |
|||
@GetMapping("/updateIsEnable/{sid}/{isEnable}") |
|||
public ResultBean updateIsEnable(@PathVariable("sid") String sid,@PathVariable("isEnable")String isEnable) { |
|||
return baseGoodsSpuService.updateIsEnable(sid,isEnable); |
|||
} |
|||
@ApiOperation("下载模版") |
|||
@PostMapping("/download") |
|||
public void download(HttpServletRequest request, HttpServletResponse response) { |
|||
baseGoodsSpuService.download(request, response); |
|||
} |
|||
@ApiOperation("导入excel") |
|||
@PostMapping("/importExcel") |
|||
public ResultBean importExcel(@RequestParam("file")MultipartFile file) throws IOException { |
|||
return baseGoodsSpuService.importExcel(file); |
|||
} |
|||
} |
@ -0,0 +1,61 @@ |
|||
package com.yxt.wms.apiadmin; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.wms.biz.basegoodstype.*; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:44 |
|||
*/ |
|||
@Api(tags = "商品类型") |
|||
@RestController |
|||
@RequestMapping("/apiadmin/base/basegoodstype") |
|||
public class BaseGoodsTypeRest { |
|||
@Autowired |
|||
BaseGoodsTypeService baseGoodsTypeService; |
|||
|
|||
|
|||
@ApiOperation("分页列表") |
|||
@PostMapping("/listPage") |
|||
public ResultBean<PagerVo<BaseGoodsTypeVo>> listPage(@RequestBody PagerQuery<BaseGoodsTypeQuery> pq) { |
|||
return baseGoodsTypeService.listPage(pq); |
|||
} |
|||
@ApiOperation("查询所有的类别") |
|||
@GetMapping("/listAll") |
|||
public ResultBean<List<BaseGoodsType>> listAll() { |
|||
return baseGoodsTypeService.listAll(); |
|||
} |
|||
|
|||
@ApiOperation("保存修改") |
|||
@PostMapping("/saveOrUpdate") |
|||
public ResultBean<String> saveOrUpdate(@RequestBody BaseGoodsTypeDto dto) { |
|||
return baseGoodsTypeService.saveOrUpdate(dto); |
|||
} |
|||
|
|||
@ApiOperation("初始化") |
|||
@GetMapping("/initialization/{sid}") |
|||
public ResultBean<BaseGoodsTypeVo> initialization(@PathVariable("sid") String sid) { |
|||
return baseGoodsTypeService.initialization(sid); |
|||
} |
|||
|
|||
@ApiOperation("删除") |
|||
@DeleteMapping("/delete/{sid}") |
|||
public ResultBean delete(@PathVariable("sid") String sid) { |
|||
return baseGoodsTypeService.delete(sid); |
|||
} |
|||
|
|||
|
|||
@ApiOperation("更改可用状态") |
|||
@GetMapping("/updateIsEnable/{sid}/{isEnable}") |
|||
public ResultBean updateIsEnable(@PathVariable("sid") String sid,@PathVariable("isEnable")String isEnable) { |
|||
return baseGoodsTypeService.updateIsEnable(sid,isEnable); |
|||
} |
|||
} |
@ -0,0 +1,61 @@ |
|||
package com.yxt.wms.apiadmin; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.wms.biz.basegoodsunit.*; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/3/8 9:19 |
|||
*/ |
|||
@Api(tags = "商品类型") |
|||
@RestController |
|||
@RequestMapping("/apiadmin/base/basegoodsunit") |
|||
public class BaseGoodsUnitRest { |
|||
@Autowired |
|||
BaseGoodsUnitService baseGoodsUnitService; |
|||
|
|||
|
|||
@ApiOperation("分页列表") |
|||
@PostMapping("/listPage") |
|||
public ResultBean<PagerVo<BaseGoodsUnitVo>> listPage(@RequestBody PagerQuery<BaseGoodsUnitQuery> pq) { |
|||
return baseGoodsUnitService.listPage(pq); |
|||
} |
|||
@ApiOperation("查询所有的类别") |
|||
@GetMapping("/listAll") |
|||
public ResultBean<List<BaseGoodsUnit>> listAll() { |
|||
return baseGoodsUnitService.listAll(); |
|||
} |
|||
|
|||
@ApiOperation("保存修改") |
|||
@PostMapping("/saveOrUpdate") |
|||
public ResultBean<String> saveOrUpdate(@RequestBody BaseGoodsUnitDto dto) { |
|||
return baseGoodsUnitService.saveOrUpdate(dto); |
|||
} |
|||
|
|||
@ApiOperation("初始化") |
|||
@GetMapping("/initialization/{sid}") |
|||
public ResultBean<BaseGoodsUnitVo> initialization(@PathVariable("sid") String sid) { |
|||
return baseGoodsUnitService.initialization(sid); |
|||
} |
|||
|
|||
@ApiOperation("删除") |
|||
@DeleteMapping("/delete/{sid}") |
|||
public ResultBean delete(@PathVariable("sid") String sid) { |
|||
return baseGoodsUnitService.delete(sid); |
|||
} |
|||
|
|||
|
|||
@ApiOperation("更改可用状态") |
|||
@GetMapping("/updateIsEnable/{sid}/{isEnable}") |
|||
public ResultBean updateIsEnable(@PathVariable("sid") String sid,@PathVariable("isEnable")String isEnable) { |
|||
return baseGoodsUnitService.updateIsEnable(sid,isEnable); |
|||
} |
|||
} |
@ -0,0 +1,69 @@ |
|||
package com.yxt.wms.apiadmin; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.wms.biz.basemanufacturer.*; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/27 13:56 |
|||
*/ |
|||
@Api(tags = "厂家信息") |
|||
@RestController |
|||
@RequestMapping("/apiadmin/base/basemanufacturer") |
|||
public class BaseManufacturerRest { |
|||
|
|||
@Autowired |
|||
BaseManufacturerService baseManufacturerService; |
|||
|
|||
@ApiOperation("分页列表") |
|||
@PostMapping("/listPage") |
|||
public ResultBean<PagerVo<BaseManufacturerVo>> listPage(@RequestBody PagerQuery<BaseManufacturerQuery> pq) { |
|||
return baseManufacturerService.listPage(pq); |
|||
} |
|||
|
|||
@ApiOperation("查询所有的厂家") |
|||
@GetMapping("/listAll") |
|||
public ResultBean<List<BaseManufacturer>> listAll() { |
|||
return baseManufacturerService.listAll(); |
|||
} |
|||
|
|||
@ApiOperation("保存修改") |
|||
@PostMapping("/saveOrUpdate") |
|||
public ResultBean<String> saveOrUpdate(@RequestBody BaseManufacturerDto dto) { |
|||
return baseManufacturerService.saveOrUpdate(dto); |
|||
} |
|||
|
|||
@ApiOperation("初始化") |
|||
@GetMapping("/initialization/{sid}") |
|||
public ResultBean<BaseManufacturerVo> initialization(@PathVariable("sid") String sid) { |
|||
return baseManufacturerService.initialization(sid); |
|||
} |
|||
|
|||
@ApiOperation("删除") |
|||
@DeleteMapping("/delete/{sid}") |
|||
public ResultBean delete(@PathVariable("sid") String sid) { |
|||
return baseManufacturerService.delete(sid); |
|||
} |
|||
|
|||
|
|||
@ApiOperation("更改可用状态") |
|||
@GetMapping("/updateIsEnable/{sid}/{isEnable}") |
|||
public ResultBean updateIsEnable(@PathVariable("sid") String sid, @PathVariable("isEnable") String isEnable) { |
|||
return baseManufacturerService.updateIsEnable(sid, isEnable); |
|||
} |
|||
|
|||
@ApiOperation("查询分公司下所有的厂家") |
|||
@GetMapping("/getAllTypeByUseOrgSid") |
|||
public ResultBean<List<BaseManufacturerVo>> getAllTypeByUseOrgSid(@RequestParam("useOrgSid") String useOrgSid) { |
|||
return baseManufacturerService.getAllTypeByUseOrgSid(useOrgSid); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,92 @@ |
|||
/********************************************************* |
|||
********************************************************* |
|||
******************** ******************* |
|||
************* ************ |
|||
******* _oo0oo_ ******* |
|||
*** o8888888o *** |
|||
* 88" . "88 * |
|||
* (| -_- |) * |
|||
* 0\ = /0 * |
|||
* ___/`---'\___ * |
|||
* .' \\| |// '. *
|
|||
* / \\||| : |||// \ *
|
|||
* / _||||| -:- |||||- \ * |
|||
* | | \\\ - /// | | *
|
|||
* | \_| ''\---/'' |_/ | * |
|||
* \ .-\__ '-' ___/-. / * |
|||
* ___'. .' /--.--\ `. .'___ * |
|||
* ."" '< `.___\_<|>_/___.' >' "". * |
|||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | * |
|||
* \ \ `_. \_ __\ /__ _/ .-` / / * |
|||
* =====`-.____`.___ \_____/___.-`___.-'===== * |
|||
* `=---=' * |
|||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * |
|||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__********* |
|||
*********************************************************/ |
|||
package com.yxt.wms.apiadmin; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.wms.biz.basesupplierinfo.*; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* Project: yxt-base(仓储基础信息供应商) <br/> |
|||
* File: BaseSupplierInfoFeignFallback.java <br/> |
|||
* Class: com.yxt.anrui.as.biz.basesupplierinfo.BaseSupplierInfoRest <br/> |
|||
* Description: 供应商信息. <br/> |
|||
* Copyright: Copyright (c) 2011 <br/> |
|||
* Company: https://gitee.com/liuzp315 <br/>
|
|||
* Makedate: 2024-03-13 16:51:56 <br/> |
|||
* |
|||
* @author liupopo |
|||
* @version 1.0 |
|||
* @since 1.0 |
|||
*/ |
|||
@Api(tags = "供应商信息") |
|||
@RestController |
|||
@RequestMapping("/apiadmin/base/basesupplierinfo") |
|||
public class BaseSupplierInfoRest { |
|||
|
|||
@Autowired |
|||
private BaseSupplierInfoService baseSupplierInfoService; |
|||
|
|||
@ApiOperation("根据条件分页查询数据的列表") |
|||
@PostMapping("/listPage") |
|||
public ResultBean<PagerVo<BaseSupplierInfoVo>> listPage(@RequestBody PagerQuery<BaseSupplierInfoQuery> pq){ |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseSupplierInfoService.listPageVo(pq); |
|||
} |
|||
|
|||
@ApiOperation("新增或修改") |
|||
@PostMapping("/save") |
|||
public ResultBean save(@RequestBody BaseSupplierInfoDto dto){ |
|||
return baseSupplierInfoService.saveOrUpdateDto(dto); |
|||
} |
|||
|
|||
@ApiOperation("根据sid批量删除") |
|||
@DeleteMapping("/delBySids") |
|||
public ResultBean delBySids(@RequestBody String[] sids){ |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
baseSupplierInfoService.delAll(sids); |
|||
return rb.success(); |
|||
} |
|||
|
|||
@ApiOperation("根据SID获取一条记录") |
|||
@GetMapping("/fetchDetailsBySid/{sid}") |
|||
public ResultBean< BaseSupplierInfoDetailsVo> fetchDetailsBySid(@PathVariable("sid") String sid){ |
|||
return baseSupplierInfoService.fetchDetailsVoBySid(sid); |
|||
} |
|||
|
|||
@ApiOperation("选择供应商") |
|||
@PostMapping("/choiceSupplierInfo") |
|||
public ResultBean<List<BaseSupplierInfoChoice>> choiceSupplierInfo(@RequestParam("createOrgSid") String createOrgSid){ |
|||
return baseSupplierInfoService.choiceSupplierInfo(createOrgSid); |
|||
} |
|||
} |
@ -0,0 +1,63 @@ |
|||
package com.yxt.wms.apiadmin; |
|||
|
|||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.wms.biz.sysuser.SysUserService; |
|||
import com.yxt.wms.feign.user.sysuser.SysUserDto; |
|||
import com.yxt.wms.feign.user.sysuser.SysUserQuery; |
|||
import com.yxt.wms.feign.user.sysuser.SysUserVo; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/5/6 10:29 |
|||
*/ |
|||
@Api(tags = "供应商信息") |
|||
@RestController |
|||
@RequestMapping("/apiadmin/sysuser") |
|||
public class SysUserRest { |
|||
@Autowired |
|||
SysUserService sysUserService; |
|||
|
|||
|
|||
@PostMapping("/login") |
|||
@ResponseBody |
|||
@ApiOperation(value = "3、登录") |
|||
@ApiOperationSupport(order = 30) |
|||
public ResultBean<SysUserVo> login(@RequestBody SysUserQuery userQuery){ |
|||
return sysUserService.login(userQuery); |
|||
} |
|||
@PostMapping("/register") |
|||
@ResponseBody |
|||
@ApiOperation(value = "3、注册") |
|||
@ApiOperationSupport(order = 30) |
|||
public ResultBean register(@RequestBody SysUserDto dto){ |
|||
return sysUserService.register(dto); |
|||
} |
|||
@PostMapping("/loginDetails") |
|||
@ResponseBody |
|||
@ApiOperation(value = "获取登录人") |
|||
@ApiOperationSupport(order = 30) |
|||
public ResultBean<SysUserVo> loginDetails(HttpServletRequest httpServletRequest){ |
|||
return sysUserService.loginDetails(httpServletRequest); |
|||
} |
|||
@PostMapping("/sendMessageCode") |
|||
@ResponseBody |
|||
@ApiOperation(value = "3、获取注册码") |
|||
@ApiOperationSupport(order = 30) |
|||
public ResultBean sendMessageCode(String mobile){ |
|||
return sysUserService.sendMessageCode(mobile); |
|||
} |
|||
@PostMapping("/sendMessageLogin") |
|||
@ResponseBody |
|||
@ApiOperation(value = "3、获取登录码") |
|||
@ApiOperationSupport(order = 30) |
|||
public ResultBean sendMessageLogin(String mobile){ |
|||
return sysUserService.sendMessageLogin(mobile); |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.yxt.wms.apiwx; |
|||
|
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController("com.yxt.wms.apiwx.WxHomeRest") |
|||
@RequestMapping("/apiwx/home") |
|||
public class WxHomeRest { |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.yxt.wms.biz.basebrandinfo; |
|||
|
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:36 |
|||
*/ |
|||
@Data |
|||
public class BaseBrandInfo extends BaseEntity { |
|||
|
|||
private String brandName;//品牌代码
|
|||
private String brandCode;//品牌名称
|
|||
private String image;//品牌图片url地址
|
|||
private String letter;//品牌的首字母大写
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
|
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.yxt.wms.biz.basebrandinfo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.dto.Dto; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:38 |
|||
*/ |
|||
@Data |
|||
public class BaseBrandInfoDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String brandName;//品牌代码
|
|||
private String brandCode;//品牌名称
|
|||
private String image;//品牌图片url地址
|
|||
private String letter;//品牌的首字母大写
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.yxt.wms.biz.basebrandinfo; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Mapper |
|||
public interface BaseBrandInfoMapper extends BaseMapper<BaseBrandInfo> { |
|||
|
|||
IPage<BaseBrandInfoVo> listPage(IPage<BaseBrandInfo> page, @Param(Constants.WRAPPER) QueryWrapper<BaseBrandInfo> qw); |
|||
} |
@ -0,0 +1,15 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.wms.biz.basebrandinfo.BaseBrandInfoMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
<select id="listPage" resultType="com.yxt.wms.biz.basebrandinfo.BaseBrandInfoVo"> |
|||
select |
|||
* |
|||
from base_brand_info |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,13 @@ |
|||
package com.yxt.wms.biz.basebrandinfo; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseBrandInfoQuery implements Query { |
|||
private String name; |
|||
} |
@ -0,0 +1,57 @@ |
|||
package com.yxt.wms.biz.basebrandinfo; |
|||
|
|||
import com.yxt.common.base.config.component.FileUploadComponent; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.wms.feign.base.basebrandinfo.*; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Service |
|||
public class BaseBrandInfoService extends MybatisBaseService<BaseBrandInfoMapper, BaseBrandInfo> { |
|||
@Autowired |
|||
private FileUploadComponent fileUploadComponent; |
|||
@Autowired |
|||
BaseBrandInfoFeign baseBrandInfoFeign; |
|||
|
|||
public ResultBean<PagerVo<BaseBrandInfoVo>> listPage(PagerQuery<BaseBrandInfoQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseBrandInfoFeign.listPage(pq); |
|||
} |
|||
public ResultBean<List<BaseBrandInfo>> listAll() { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
|
|||
return baseBrandInfoFeign.listAll(); |
|||
} |
|||
public ResultBean<String> saveOrUpdate(BaseBrandInfoDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
|
|||
return baseBrandInfoFeign.saveOrUpdate(dto); |
|||
} |
|||
|
|||
public ResultBean<BaseBrandInfoVo> initialization(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
|
|||
return baseBrandInfoFeign.initialization(sid); |
|||
} |
|||
|
|||
|
|||
|
|||
public ResultBean delete(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
public ResultBean updateIsEnable(String sid,String isEnable) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseBrandInfoFeign.updateIsEnable(sid,isEnable); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.yxt.wms.biz.basebrandinfo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseBrandInfoVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
private String lockVersion; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date modifyTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String state; |
|||
private String isDelete; |
|||
private String brandName;//品牌代码
|
|||
private String brandCode;//品牌名称
|
|||
private String image;//品牌图片url地址
|
|||
private String letter;//品牌的首字母大写
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.yxt.wms.biz.basegoodssku; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:36 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSku extends BaseEntity { |
|||
private String goodsSkuCode;//商品Sku代码
|
|||
private String title;//商品标题
|
|||
private String goodsSpuSid;//商品基础信息Sid
|
|||
private String externalCode;//外部编码
|
|||
private String indexes;//特有规格属性在spu表中special_spec字段对应每个参数值数组下标的组合,如0_0_0,1_0_0,相当于SKU这条记录的编码。
|
|||
@TableField(value = "own_spec") |
|||
private String ownSpec;//sku的特有规格参数键值对,json格式,反序列化时请使用linkedHashMap,保证有序
|
|||
|
|||
} |
@ -0,0 +1,69 @@ |
|||
package com.yxt.wms.biz.basegoodssku; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/3/19 |
|||
**/ |
|||
@Data |
|||
public class BaseGoodsSkuDetailsVo { |
|||
|
|||
@ApiModelProperty("商品代码") |
|||
private String goodsCode; |
|||
@ApiModelProperty("条形码") |
|||
private String barCode; |
|||
@ApiModelProperty("商品名称") |
|||
private String goodsName; |
|||
@ApiModelProperty("副标题") |
|||
private String subTitle; |
|||
@ApiModelProperty("拼音缩写") |
|||
private String goodsPY; |
|||
@ApiModelProperty("商品简称") |
|||
private String goodsShortName; |
|||
@ApiModelProperty("商品分类sid") |
|||
private String goodsTypeSid; |
|||
@ApiModelProperty("品牌sid") |
|||
private String brandSid; |
|||
@ApiModelProperty("厂家sid") |
|||
private String manufacturersid; |
|||
@ApiModelProperty("商品单位sid") |
|||
private String goodsUnitSid; |
|||
@ApiModelProperty("商品单位名称") |
|||
private String goodsUnitName; |
|||
|
|||
@ApiModelProperty("商品Sku代码") |
|||
private String goodsSkuCode; |
|||
@ApiModelProperty("商品标题") |
|||
private String title; |
|||
@ApiModelProperty("是否一品一码(goodID),0否,1是") |
|||
@JsonProperty("isGoodsID") |
|||
private int isGoodsID; |
|||
|
|||
//=================================
|
|||
|
|||
//商品名称
|
|||
//零件号
|
|||
//拼音
|
|||
//条形码
|
|||
//计量单位
|
|||
//商品类别
|
|||
private String goodsTypeName;//商品类别名称
|
|||
//厂家
|
|||
//规格
|
|||
//品牌
|
|||
//车型
|
|||
//原厂标志
|
|||
//产地
|
|||
//锁定售价
|
|||
//备注
|
|||
//上限数量
|
|||
//下限数量
|
|||
//积分商品
|
|||
//所需积分
|
|||
|
|||
|
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.yxt.wms.biz.basegoodssku; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.dto.Dto; |
|||
import com.yxt.wms.biz.basegoodsskuextend.BaseGoodsSkuExtendDto; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:38 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSkuDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String goodsSkuCode;//商品Sku代码
|
|||
private String title;//商品标题
|
|||
private String goodsSpuSid;//商品基础信息Sid
|
|||
private String externalCode;//外部编码
|
|||
private String indexes;//特有规格属性在spu表中special_spec字段对应每个参数值数组下标的组合,如0_0_0,1_0_0,相当于SKU这条记录的编码。
|
|||
@TableField(value = "own_spec") |
|||
private String ownSpec;//sku的特有规格参数键值对,json格式,反序列化时请使用linkedHashMap,保证有序
|
|||
private BaseGoodsSkuExtendDto baseGoodsSkuExtend;//sku扩展
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.yxt.wms.biz.basegoodssku; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Mapper |
|||
public interface BaseGoodsSkuMapper extends BaseMapper<BaseGoodsSku> { |
|||
|
|||
IPage<BaseGoodsSkuVo> listPage(IPage<BaseGoodsSku> page, @Param(Constants.WRAPPER) QueryWrapper<BaseGoodsSku> qw); |
|||
List<BaseGoodsSkuVo> getSkusBySpuSid(@Param("spuSid")String spuSid); |
|||
BaseGoodsSkuVo getSkuBySid(@Param("sid")String sid); |
|||
|
|||
IPage<BaseGoodsSkuSelectList> getSelectList(IPage<BaseGoodsSku> page, @Param(Constants.WRAPPER)QueryWrapper<BaseGoodsSku> qw); |
|||
|
|||
IPage<BaseGoodsSkuPurSelectList> purGoodsListPage(IPage<BaseGoodsSku> page, @Param(Constants.WRAPPER) QueryWrapper<BaseGoodsSku> qw); |
|||
} |
@ -0,0 +1,64 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.wms.biz.basegoodssku.BaseGoodsSkuMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
<select id="listPage" resultType="com.yxt.wms.biz.basegoodssku.BaseGoodsSkuVo"> |
|||
select s.*,s.own_spec as ownSpec,a.goodsName |
|||
from base_goods_sku s |
|||
left join base_goods_spu a on a.sid=s.goodsSpuSid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="getSkusBySpuSid" resultType="com.yxt.wms.biz.basegoodssku.BaseGoodsSkuVo"> |
|||
select s.*, |
|||
s.own_spec as ownSpec |
|||
from base_goods_sku s |
|||
where s.goodsSpuSid = #{spuSid} |
|||
</select> |
|||
<select id="getSkuBySid" resultType="com.yxt.wms.biz.basegoodssku.BaseGoodsSkuVo"> |
|||
select *, |
|||
s.own_spec as ownSpec |
|||
from base_goods_sku s |
|||
where s.sid = #{sid} |
|||
</select> |
|||
|
|||
<select id="getSelectList" resultType="com.yxt.wms.biz.basegoodssku.BaseGoodsSkuSelectList"> |
|||
select sku.sid goodsSkuSid, |
|||
spu.sid as goodsSpuSid, |
|||
spu.goodsName goodsSpuName, |
|||
sku.goodsSkuCode, |
|||
sku.title as goodsSkuTitle, |
|||
spu.goodsUnitSid, |
|||
spu.goodsUnitName |
|||
from base_goods_sku sku |
|||
left join base_goods_spu spu on spu.sid = sku.goodsSpuSid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="purGoodsListPage" resultType="com.yxt.wms.biz.basegoodssku.BaseGoodsSkuPurSelectList"> |
|||
SELECT |
|||
s.sid, |
|||
s.goodsSkuCode, |
|||
s.title, |
|||
s.own_spec AS ownSpec, |
|||
a.goodsName, |
|||
a.goodsPY, |
|||
a.goodsShortName, |
|||
a.goodsTypeSid, |
|||
a.brandSid, |
|||
a.manufacturerSid, |
|||
a.goodsUnitName |
|||
FROM |
|||
base_goods_sku s |
|||
LEFT JOIN base_goods_spu a |
|||
ON a.sid = s.goodsSpuSid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,35 @@ |
|||
package com.yxt.wms.biz.basegoodssku; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/3/21 |
|||
**/ |
|||
@Data |
|||
public class BaseGoodsSkuPurSelectList { |
|||
|
|||
//sid
|
|||
private String sid; |
|||
//零件号
|
|||
private String goodsSkuCode; |
|||
//规格
|
|||
private String title; |
|||
//商品名称
|
|||
private String goodsName; |
|||
//商品拼音
|
|||
private String goodsPY; |
|||
//商品简称
|
|||
private String goodsShortName; |
|||
//商品类别sid
|
|||
private String goodsTypeSid; |
|||
//品牌sid
|
|||
private String brandSid; |
|||
//厂家sid
|
|||
private String manufacturerSid; |
|||
//商品单位名称
|
|||
private String goodsUnitName; |
|||
//sku特有规格参数键值对
|
|||
private String ownSpec; |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.yxt.wms.biz.basegoodssku; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/3/21 |
|||
**/ |
|||
@Data |
|||
public class BaseGoodsSkuPurSelectQuery implements Query { |
|||
|
|||
//组织sid
|
|||
private String orgSid; |
|||
//商品名称
|
|||
private String goodsName; |
|||
//商品类别sid
|
|||
private String goodsTypeSid; |
|||
//商品拼音
|
|||
private String goodsPY; |
|||
//品牌sid
|
|||
private String brandSid; |
|||
//零件号
|
|||
private String goodsSkuCode; |
|||
//规格
|
|||
private String title; |
|||
//其他查询条件
|
|||
private String otherQuery; |
|||
} |
@ -0,0 +1,13 @@ |
|||
package com.yxt.wms.biz.basegoodssku; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSkuQuery implements Query { |
|||
private String name; |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.yxt.wms.biz.basegoodssku; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/3/21 |
|||
**/ |
|||
@Data |
|||
public class BaseGoodsSkuSelectList { |
|||
|
|||
//商品名称
|
|||
private String goodsSpuSid; |
|||
private String goodsSpuName; |
|||
//商品sid
|
|||
private String goodsSkuSid; |
|||
//商品编码
|
|||
private String goodsSkuCode; |
|||
//规格/型号
|
|||
private String goodsSkuTitle; |
|||
//计量单位
|
|||
private String goodsUnitSid; |
|||
private String goodsUnitName; |
|||
//仓库名称
|
|||
//货位
|
|||
//单位成本(进货价)
|
|||
//数量
|
|||
//税额
|
|||
//含税价
|
|||
//金额
|
|||
//销售价1
|
|||
//销售价2
|
|||
//操作时间
|
|||
//操作人
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.yxt.wms.biz.basegoodssku; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @description: |
|||
* @author: dimengzhe |
|||
* @date: 2024/3/21 |
|||
**/ |
|||
@Data |
|||
public class BaseGoodsSkuSelectQuery implements Query { |
|||
|
|||
private String goodsSkuCode; |
|||
} |
@ -0,0 +1,175 @@ |
|||
package com.yxt.wms.biz.basegoodssku; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.date.DateTime; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.yxt.common.base.config.component.FileUploadComponent; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.PagerUtil; |
|||
import com.yxt.common.base.utils.StringUtils; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Service |
|||
public class BaseGoodsSkuService extends MybatisBaseService<BaseGoodsSkuMapper, BaseGoodsSku> { |
|||
@Autowired |
|||
private FileUploadComponent fileUploadComponent; |
|||
// @Autowired
|
|||
// BaseGoodsSpuDetailService baseGoodsSpuDetailService;
|
|||
// @Autowired
|
|||
// BaseGoodsSkuExtendService baseGoodsSkuExtendService;
|
|||
// @Autowired
|
|||
// private BaseGoodsSpuService baseGoodsSpuService;
|
|||
// @Autowired
|
|||
// BaseGoodsTypeService baseGoodsTypeService;
|
|||
|
|||
public ResultBean<PagerVo<BaseGoodsSkuVo>> listPage(PagerQuery<BaseGoodsSkuQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSkuQuery query = pq.getParams(); |
|||
QueryWrapper<BaseGoodsSku> qw = new QueryWrapper<>(); |
|||
if (StringUtils.isNotBlank(query.getName())) { |
|||
qw.like("goodsName", query.getName()); |
|||
} |
|||
IPage<BaseGoodsSku> page = PagerUtil.queryToPage(pq); |
|||
IPage<BaseGoodsSkuVo> pagging = baseMapper.listPage(page, qw); |
|||
PagerVo<BaseGoodsSkuVo> p = PagerUtil.pageToVo(pagging, null); |
|||
return rb.success().setData(p); |
|||
} |
|||
@Transactional |
|||
public ResultBean<String> saveOrUpdate(BaseGoodsSkuDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
|
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
@Transactional |
|||
public ResultBean<String> saveOrUpdate(List<BaseGoodsSkuDto> dtos) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
for (BaseGoodsSkuDto dto : dtos) { |
|||
BaseGoodsSku sku=baseMapper.selectOne(new QueryWrapper<BaseGoodsSku>().eq("sid",dto.getSid())); |
|||
String sid = ""; |
|||
if (null!=sku) { |
|||
sid = dto.getSid(); |
|||
BaseGoodsSku wmsGoods = fetchBySid(dto.getSid()); |
|||
BeanUtil.copyProperties(dto, wmsGoods); |
|||
wmsGoods.setModifyTime(new Date()); |
|||
baseMapper.updateById(wmsGoods); |
|||
dto.getBaseGoodsSkuExtend().setGoodsSkuSid(wmsGoods.getSid()); |
|||
// baseGoodsSkuExtendService.saveOrUpdate(dto.getBaseGoodsSkuExtend());
|
|||
} else { |
|||
BaseGoodsSku wmsGoods = new BaseGoodsSku(); |
|||
BeanUtil.copyProperties(dto, wmsGoods); |
|||
wmsGoods.setCreateTime(new DateTime()); |
|||
baseMapper.insert(wmsGoods); |
|||
dto.getBaseGoodsSkuExtend().setGoodsSkuSid(wmsGoods.getSid()); |
|||
// baseGoodsSkuExtendService.saveOrUpdate(dto.getBaseGoodsSkuExtend());
|
|||
} |
|||
} |
|||
|
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
|
|||
public ResultBean<BaseGoodsSkuVo> initialization(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSkuVo vo = baseMapper.getSkuBySid(sid); |
|||
// BaseGoodsSkuExtendVo vo1=baseGoodsSkuExtendService.getExtendBySkuSid(vo.getSid()).getData();
|
|||
// if(vo1==null){
|
|||
// vo.setBaseGoodsSkuExtend(new BaseGoodsSkuExtendVo());
|
|||
// }
|
|||
// vo.setBaseGoodsSkuExtend(vo1);
|
|||
return rb.success().setData(vo); |
|||
} |
|||
|
|||
public ResultBean<List<BaseGoodsSkuVo>> getSkusBySpuSid(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
List<BaseGoodsSkuVo> vo = baseMapper.getSkusBySpuSid(sid); |
|||
return rb.success().setData(vo); |
|||
} |
|||
|
|||
|
|||
public ResultBean delete(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSku wmsGoods = fetchBySid(sid); |
|||
if (null != wmsGoods) { |
|||
baseMapper.deleteById(wmsGoods.getId()); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
|
|||
public ResultBean updateIsEnable(String sid, String isEnable) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSku wmsGoods = fetchBySid(sid); |
|||
if (null != wmsGoods) { |
|||
wmsGoods.setIsEnable(Integer.parseInt(isEnable)); |
|||
baseMapper.updateById(wmsGoods); |
|||
} |
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
|
|||
public ResultBean<BaseGoodsSkuDetailsVo> getDetails(String sid) { |
|||
ResultBean<BaseGoodsSkuDetailsVo> rb = ResultBean.fireFail(); |
|||
BaseGoodsSkuDetailsVo baseGoodsSkuDetailsVo = new BaseGoodsSkuDetailsVo(); |
|||
BaseGoodsSku baseGoodsSku = fetchBySid(sid); |
|||
return rb.success().setData(baseGoodsSkuDetailsVo); |
|||
} |
|||
|
|||
public PagerVo<BaseGoodsSkuSelectList> getSelectList(PagerQuery<BaseGoodsSkuSelectQuery> pagerQuery) { |
|||
BaseGoodsSkuSelectQuery query = pagerQuery.getParams(); |
|||
QueryWrapper<BaseGoodsSku> qw = new QueryWrapper<>(); |
|||
if (query != null) { |
|||
//商品编码
|
|||
if (StringUtils.isNotBlank(query.getGoodsSkuCode())) { |
|||
qw.like("sku.goodsSkuCode", query.getGoodsSkuCode()); |
|||
} |
|||
} |
|||
IPage<BaseGoodsSku> page = PagerUtil.queryToPage(pagerQuery); |
|||
IPage<BaseGoodsSkuSelectList> pagging = baseMapper.getSelectList(page, qw); |
|||
PagerVo<BaseGoodsSkuSelectList> p = PagerUtil.pageToVo(pagging, null); |
|||
return p; |
|||
} |
|||
|
|||
public ResultBean<PagerVo<BaseGoodsSkuPurSelectList>> purGoodsListPage(PagerQuery<BaseGoodsSkuPurSelectQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSkuPurSelectQuery query = pq.getParams(); |
|||
QueryWrapper<BaseGoodsSku> qw = new QueryWrapper<>(); |
|||
if (StringUtils.isNotBlank(query.getOrgSid())){ |
|||
qw.eq("s.createOrgSid",query.getOrgSid()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getGoodsName())) { |
|||
qw.like("a.goodsName", query.getGoodsName()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getGoodsTypeSid())) { |
|||
qw.eq("a.goodsTypeSid", query.getGoodsTypeSid()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getGoodsPY())) { |
|||
qw.like("a.goodsPY", query.getGoodsPY()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getBrandSid())) { |
|||
qw.like("a.brandSid", query.getBrandSid()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getGoodsSkuCode())) { |
|||
qw.like("s.goodsSkuCode", query.getGoodsSkuCode()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getTitle())) { |
|||
qw.like("s.title", query.getTitle()); |
|||
} |
|||
if (org.apache.commons.lang3.StringUtils.isNotBlank(query.getOtherQuery())){ |
|||
qw.and(wrapper -> wrapper.like("a.goodsName", query.getOtherQuery()).or().like("s.goodsSkuCode", query.getOtherQuery()).or().like("a.goodsPY",query.getOtherQuery())); |
|||
} |
|||
IPage<BaseGoodsSku> page = PagerUtil.queryToPage(pq); |
|||
IPage<BaseGoodsSkuPurSelectList> pagging = baseMapper.purGoodsListPage(page, qw); |
|||
PagerVo<BaseGoodsSkuPurSelectList> p = PagerUtil.pageToVo(pagging, null); |
|||
return rb.success().setData(p); |
|||
} |
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.yxt.wms.biz.basegoodssku; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import com.yxt.wms.biz.basegoodsskuextend.BaseGoodsSkuExtendVo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSkuVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
private String lockVersion; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date modifyTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String state; |
|||
private String isDelete; |
|||
private String goodsSkuCode;//商品Sku代码
|
|||
private String title;//商品标题
|
|||
private String goodsSpuSid;//商品基础信息Sid
|
|||
private String externalCode;//外部编码
|
|||
private String indexes;//特有规格属性在spu表中special_spec字段对应每个参数值数组下标的组合,如0_0_0,1_0_0,相当于SKU这条记录的编码。
|
|||
@TableField(value = "own_spec") |
|||
private String ownSpec;//sku的特有规格参数键值对,json格式,反序列化时请使用linkedHashMap,保证有序
|
|||
private String goodsName; |
|||
private BaseGoodsSkuExtendVo baseGoodsSkuExtend; |
|||
|
|||
} |
@ -0,0 +1,34 @@ |
|||
package com.yxt.wms.biz.basegoodsskuextend; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:36 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSkuExtend extends BaseEntity { |
|||
private String goodsSkuSid;//商品Sku代码
|
|||
private String finalPurchasePrice;//最后采购价
|
|||
private String safetyStockDays;//安全库存天数
|
|||
private String isOriginalFactory;//是否原厂
|
|||
private String isInventoryAlert;//是否库存警戒
|
|||
@TableField(value = "InventoryAlertUpperLimit") |
|||
private String inventoryAlertUpperLimit;//库存警戒上线
|
|||
@TableField(value = "InventoryAlertLowerLimit") |
|||
private String inventoryAlertLowerLimit;//库存警戒下线
|
|||
private String costPrice;//成本价
|
|||
private String tagPrice;//吊牌价
|
|||
private String salesPrice;//销售单价
|
|||
private String standardPurchasePrice;//标准进价
|
|||
private String agencyPrice;//代理价
|
|||
private String discount;//折扣
|
|||
private String minimumSalesPrice;//最低零售价
|
|||
private String isLockingSalesPrice;//是否锁定销售价
|
|||
private String isIntegralExchange;//是否可以积分兑换
|
|||
private String integralAmount;//积分数量
|
|||
private String sortNo;//排序
|
|||
private String picUrl;//商品的图片,多个图片以‘,’分割
|
|||
} |
@ -0,0 +1,46 @@ |
|||
package com.yxt.wms.biz.basegoodsskuextend; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.dto.Dto; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:38 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSkuExtendDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String goodsSkuSid;//商品Sku代码
|
|||
private String finalPurchasePrice;//最后采购价
|
|||
private String safetyStockDays;//安全库存天数
|
|||
private String isOriginalFactory;//是否原厂
|
|||
private String isInventoryAlert;//是否库存警戒
|
|||
@TableField(value = "InventoryAlertUpperLimit") |
|||
private String inventoryAlertUpperLimit;//库存警戒上线
|
|||
@TableField(value = "InventoryAlertLowerLimit") |
|||
private String inventoryAlertLowerLimit;//库存警戒下线
|
|||
private String costPrice;//成本价
|
|||
private String tagPrice;//吊牌价
|
|||
private String salesPrice;//销售单价
|
|||
private String standardPurchasePrice;//标准进价
|
|||
private String agencyPrice;//代理价
|
|||
private String discount;//折扣
|
|||
private String minimumSalesPrice;//最低零售价
|
|||
private String isLockingSalesPrice;//是否锁定销售价
|
|||
private String isIntegralExchange;//是否可以积分兑换
|
|||
private String integralAmount;//积分数量
|
|||
private String sortNo;//排序
|
|||
private String picUrl;//商品的图片,多个图片以‘,’分割
|
|||
// private String [] Urls={};//图片数组
|
|||
private List<UrlsVo> urls;//图片数组
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.yxt.wms.biz.basegoodsskuextend; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Mapper |
|||
public interface BaseGoodsSkuExtendMapper extends BaseMapper<BaseGoodsSkuExtend> { |
|||
|
|||
IPage<BaseGoodsSkuExtendVo> listPage(IPage<BaseGoodsSkuExtend> page, @Param(Constants.WRAPPER) QueryWrapper<BaseGoodsSkuExtend> qw); |
|||
BaseGoodsSkuExtendVo getExtendBySkuSid(@Param("skuSid")String skuSid); |
|||
BaseGoodsSkuExtendVo getExtendBySid(@Param("sid")String sid); |
|||
} |
@ -0,0 +1,28 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.wms.biz.basegoodsskuextend.BaseGoodsSkuExtendMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
<select id="listPage" resultType="com.yxt.wms.biz.basegoodsskuextend.BaseGoodsSkuExtendVo"> |
|||
select |
|||
s.*,a.title |
|||
from base_goods_sku_extend s |
|||
left join base_goods_sku a on a.sid=s.goodsSkuSid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="getExtendBySkuSid" resultType="com.yxt.wms.biz.basegoodsskuextend.BaseGoodsSkuExtendVo"> |
|||
select |
|||
s.*,s.InventoryAlertUpperLimit as inventoryAlertUpperLimit,s.InventoryAlertLowerLimit as inventoryAlertLowerLimit |
|||
from base_goods_sku_extend s |
|||
where s.goodsSkuSid=#{skuSid} |
|||
</select> |
|||
<select id="getExtendBySid" resultType="com.yxt.wms.biz.basegoodsskuextend.BaseGoodsSkuExtendVo"> |
|||
select |
|||
s.*,s.InventoryAlertUpperLimit as inventoryAlertUpperLimit,s.InventoryAlertLowerLimit as inventoryAlertLowerLimit |
|||
from base_goods_sku_extend s |
|||
where s.sid=#{sid} |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,13 @@ |
|||
package com.yxt.wms.biz.basegoodsskuextend; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSkuExtendQuery implements Query { |
|||
private String name; |
|||
} |
@ -0,0 +1,135 @@ |
|||
package com.yxt.wms.biz.basegoodsskuextend; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.date.DateTime; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.yxt.common.base.config.component.FileUploadComponent; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.PagerUtil; |
|||
import com.yxt.common.base.utils.StringUtils; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Collections; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Service |
|||
public class BaseGoodsSkuExtendService extends MybatisBaseService<BaseGoodsSkuExtendMapper, BaseGoodsSkuExtend> { |
|||
@Autowired |
|||
private FileUploadComponent fileUploadComponent; |
|||
// @Autowired
|
|||
// private BaseBrandInfoService baseBrandInfoService;
|
|||
// @Autowired
|
|||
// private BaseGoodsTypeService baseGoodsTypeService;
|
|||
// @Autowired
|
|||
// private BaseManufacturerService baseManufacturerService;
|
|||
// @Autowired
|
|||
// BaseGoodsSpuDetailService baseGoodsSpuDetailService;
|
|||
|
|||
public ResultBean<PagerVo<BaseGoodsSkuExtendVo>> listPage(PagerQuery<BaseGoodsSkuExtendQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSkuExtendQuery query = pq.getParams(); |
|||
QueryWrapper<BaseGoodsSkuExtend> qw = new QueryWrapper<>(); |
|||
if(StringUtils.isNotBlank(query.getName())){ |
|||
qw.like("goodsName",query.getName()); |
|||
} |
|||
IPage<BaseGoodsSkuExtend> page = PagerUtil.queryToPage(pq); |
|||
IPage<BaseGoodsSkuExtendVo> pagging = baseMapper.listPage(page, qw); |
|||
PagerVo<BaseGoodsSkuExtendVo> p = PagerUtil.pageToVo(pagging, null); |
|||
List<BaseGoodsSkuExtendVo> records = pagging.getRecords(); |
|||
records.removeAll(Collections.singleton(null)); |
|||
// if (!records.isEmpty()) {
|
|||
// for (BaseGoodsSpuVo record : records) {
|
|||
// if (StringUtils.isNotBlank(record.getPicUrl())) {
|
|||
// record.setPicUrl(fileUploadComponent.getUrlPrefix() + record.getPicUrl());
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
return rb.success().setData(p); |
|||
} |
|||
@Transactional |
|||
public ResultBean<String> saveOrUpdate(BaseGoodsSkuExtendDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
String sid = ""; |
|||
BaseGoodsSkuExtend extend=baseMapper.selectOne(new QueryWrapper<BaseGoodsSkuExtend>().eq("sid",dto.getSid())); |
|||
if (null!=extend) { |
|||
sid = dto.getSid(); |
|||
BaseGoodsSkuExtend wmsGoods = fetchBySid(dto.getSid()); |
|||
BeanUtil.copyProperties(dto, wmsGoods); |
|||
wmsGoods.setModifyTime(new Date()); |
|||
for (UrlsVo url : dto.getUrls()) { |
|||
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|||
String path = url.getUrl().substring(urlPrefix.length()); |
|||
if(StringUtils.isBlank(dto.getPicUrl())){ |
|||
wmsGoods.setPicUrl(path); |
|||
}else{ |
|||
wmsGoods.setPicUrl(wmsGoods.getPicUrl()+","+path); |
|||
} |
|||
} |
|||
if (StringUtils.isNotBlank(dto.getPicUrl())) { |
|||
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|||
String path = dto.getPicUrl().substring(urlPrefix.length()); |
|||
wmsGoods.setPicUrl(path); |
|||
} |
|||
baseMapper.updateById(wmsGoods); |
|||
|
|||
} else { |
|||
BaseGoodsSkuExtend wmsGoods = new BaseGoodsSkuExtend(); |
|||
sid = wmsGoods.getSid(); |
|||
BeanUtil.copyProperties(dto, wmsGoods); |
|||
wmsGoods.setCreateTime(new DateTime()); |
|||
for (UrlsVo url : dto.getUrls()) { |
|||
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|||
String path = url.getUrl().substring(urlPrefix.length()); |
|||
if(StringUtils.isBlank(dto.getPicUrl())){ |
|||
wmsGoods.setPicUrl(path); |
|||
}else{ |
|||
wmsGoods.setPicUrl(wmsGoods.getPicUrl()+","+path); |
|||
} |
|||
} |
|||
baseMapper.insert(wmsGoods); |
|||
} |
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
|
|||
public ResultBean<BaseGoodsSkuExtendVo> initialization(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSkuExtendVo vo = baseMapper.getExtendBySid(sid); |
|||
return rb.success().setData(vo); |
|||
} |
|||
|
|||
public ResultBean<BaseGoodsSkuExtendVo> getExtendBySkuSid(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSkuExtendVo vo = baseMapper.getExtendBySkuSid(sid); |
|||
return rb.success().setData(vo); |
|||
} |
|||
|
|||
public ResultBean delete(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSkuExtend wmsGoods = fetchBySid(sid); |
|||
if (null != wmsGoods) { |
|||
baseMapper.deleteById(wmsGoods.getId()); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
|
|||
public ResultBean updateIsEnable(String sid,String isEnable) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSkuExtend wmsGoods = fetchBySid(sid); |
|||
if (null != wmsGoods) { |
|||
wmsGoods.setIsEnable(Integer.parseInt(isEnable)); |
|||
baseMapper.updateById(wmsGoods); |
|||
} |
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
} |
@ -0,0 +1,53 @@ |
|||
package com.yxt.wms.biz.basegoodsskuextend; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSkuExtendVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
private String lockVersion; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date modifyTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String state; |
|||
private String isDelete; |
|||
private String goodsSkuSid;//商品Skusid
|
|||
private String finalPurchasePrice;//最后采购价
|
|||
private String safetyStockDays;//安全库存天数
|
|||
private String isOriginalFactory;//是否原厂
|
|||
private String isInventoryAlert;//是否库存警戒
|
|||
@TableField(value = "InventoryAlertUpperLimit") |
|||
private String inventoryAlertUpperLimit;//库存警戒上线
|
|||
@TableField(value = "InventoryAlertLowerLimit") |
|||
private String inventoryAlertLowerLimit;//库存警戒下线
|
|||
private String costPrice;//成本价
|
|||
private String tagPrice;//吊牌价
|
|||
private String salesPrice;//销售单价
|
|||
private String standardPurchasePrice;//标准进价
|
|||
private String agencyPrice;//代理价
|
|||
private String discount;//折扣
|
|||
private String minimumSalesPrice;//最低零售价
|
|||
private String isLockingSalesPrice;//是否锁定销售价
|
|||
private String isIntegralExchange;//是否可以积分兑换
|
|||
private String integralAmount;//积分数量
|
|||
private String sortNo;//排序
|
|||
private String picUrl;//商品的图片,多个图片以‘,’分割
|
|||
// private String [] Urls={};//图片数组
|
|||
private List<UrlsVo> urls;//图片数组
|
|||
private String title;//sku标题
|
|||
|
|||
} |
@ -0,0 +1,12 @@ |
|||
package com.yxt.wms.biz.basegoodsskuextend; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/3/22 10:20 |
|||
*/ |
|||
@Data |
|||
public class UrlsVo { |
|||
private String url; |
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.yxt.wms.biz.basegoodsspu; |
|||
|
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:36 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSpu extends BaseEntity { |
|||
private String goodsCode;//商品代码
|
|||
private String barCode;//条形码
|
|||
private String goodsName;//商品名称
|
|||
private String subTitle;//商品名称
|
|||
private String goodsPY;//拼音缩写
|
|||
private String goodsShortName;//商品简称
|
|||
private String goodsTypeSid;//商品分类sid
|
|||
private String brandSid;//品牌sid
|
|||
private String manufacturerSid;//厂家sid
|
|||
private String goodsUnitSid;//商品单位sid
|
|||
private String goodsUnitName;//商品单位名称
|
|||
private String taxRate;//税率
|
|||
private String shelfLife;//保质期天
|
|||
private String nationalStandardCode;//国标码
|
|||
private String sortNo;//排序
|
|||
private String externalCode;//外部编码
|
|||
private String factoryCode;//厂家货号
|
|||
private String isListed;//是否上架
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
} |
@ -0,0 +1,47 @@ |
|||
package com.yxt.wms.biz.basegoodsspu; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.dto.Dto; |
|||
import com.yxt.wms.biz.basegoodssku.BaseGoodsSkuDto; |
|||
import com.yxt.wms.biz.basegoodsspudetail.BaseGoodsSpuDetailDto; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:38 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSpuDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String goodsCode;//商品代码
|
|||
private String barCode;//条形码
|
|||
private String goodsName;//商品名称
|
|||
private String subTitle;//副标题
|
|||
private String goodsPY;//拼音缩写
|
|||
private String goodsShortName;//商品简称
|
|||
private String goodsTypeSid;//商品分类sid
|
|||
private String brandSid;//品牌sid
|
|||
private String manufacturerSid;//厂家sid
|
|||
private String goodsUnitSid;//商品单位sid
|
|||
private String goodsUnitName;//商品单位名称
|
|||
private String taxRate;//税率
|
|||
private String shelfLife;//保质期天
|
|||
private String nationalStandardCode;//国标码
|
|||
private String sortNo;//排序
|
|||
private String externalCode;//外部编码
|
|||
private String factoryCode;//厂家货号
|
|||
private String isListed;//是否上架
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
private BaseGoodsSpuDetailDto baseGoodsSpuDetail;//商品spu详情
|
|||
private List<BaseGoodsSkuDto> baseGoodsSkus;//商品sku
|
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.yxt.wms.biz.basegoodsspu; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Mapper |
|||
public interface BaseGoodsSpuMapper extends BaseMapper<BaseGoodsSpu> { |
|||
|
|||
IPage<BaseGoodsSpuVo> listPage(IPage<BaseGoodsSpu> page, @Param(Constants.WRAPPER) QueryWrapper<BaseGoodsSpu> qw); |
|||
BaseGoodsSpuVo initialization(@Param("sid")String sid); |
|||
} |
@ -0,0 +1,27 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.wms.biz.basegoodsspu.BaseGoodsSpuMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
<select id="listPage" resultType="com.yxt.wms.biz.basegoodsspu.BaseGoodsSpuVo"> |
|||
select |
|||
s.*,a.goodsTypeName as typeName,b.brandName as brandName,c.manufacturerName as manufacturerName |
|||
from base_goods_spu s |
|||
left join base_goods_type a on a.sid=s.goodsTypeSid |
|||
left join base_brand_info b on b.sid=s.brandSid |
|||
left join base_manufacturer c on c.sid=s.manufacturerSid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="initialization" resultType="com.yxt.wms.biz.basegoodsspu.BaseGoodsSpuVo"> |
|||
select |
|||
s.*,a.goodsTypeName as typeName,b.brandName as brandName,c.manufacturerName as manufacturerName |
|||
from base_goods_spu s |
|||
left join base_goods_type a on a.sid=s.goodsTypeSid |
|||
left join base_brand_info b on b.sid=s.brandSid |
|||
left join base_manufacturer c on c.sid=s.manufacturerSid |
|||
where s.sid=#{sid} |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,13 @@ |
|||
package com.yxt.wms.biz.basegoodsspu; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSpuQuery implements Query { |
|||
private String name; |
|||
} |
@ -0,0 +1,383 @@ |
|||
package com.yxt.wms.biz.basegoodsspu; |
|||
|
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.StringUtils; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.wms.apiadmin.BaseGoodsBrandRest; |
|||
import com.yxt.wms.biz.basebrandinfo.BaseBrandInfo; |
|||
import com.yxt.wms.biz.basegoodssku.BaseGoodsSku; |
|||
import com.yxt.wms.biz.basegoodssku.BaseGoodsSkuDto; |
|||
import com.yxt.wms.biz.basegoodsskuextend.BaseGoodsSkuExtend; |
|||
import com.yxt.wms.biz.basegoodsskuextend.BaseGoodsSkuExtendDto; |
|||
import com.yxt.wms.biz.basegoodsspudetail.BaseGoodsSpuDetail; |
|||
import com.yxt.wms.biz.basegoodsspudetail.BaseGoodsSpuDetailDto; |
|||
import com.yxt.wms.biz.basegoodstype.BaseGoodsType; |
|||
import com.yxt.wms.biz.basegoodsunit.BaseGoodsUnit; |
|||
import com.yxt.wms.biz.basemanufacturer.BaseManufacturer; |
|||
import com.yxt.wms.feign.base.basebrandinfo.BaseBrandInfoFeign; |
|||
import com.yxt.wms.feign.base.basegoodsspu.*; |
|||
import com.yxt.wms.feign.base.basegoodstype.BaseGoodsTypeFeign; |
|||
import com.yxt.wms.feign.base.basegoodsunit.BaseGoodsUnitFeign; |
|||
import com.yxt.wms.feign.base.basemanufacturer.BaseManufacturerFeign; |
|||
import com.yxt.wms.utils.ExcelUtil; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.*; |
|||
import java.math.BigDecimal; |
|||
import java.net.URLEncoder; |
|||
import java.util.*; |
|||
import java.util.concurrent.ConcurrentHashMap; |
|||
import java.util.function.Function; |
|||
import java.util.function.Predicate; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Service |
|||
public class BaseGoodsSpuService extends MybatisBaseService<BaseGoodsSpuMapper, BaseGoodsSpu> { |
|||
// @Autowired
|
|||
// private FileUploadComponent fileUploadComponent;
|
|||
@Autowired |
|||
BaseGoodsTypeFeign baseGoodsTypeFeign; |
|||
@Autowired |
|||
BaseBrandInfoFeign baseBrandInfoFeign; |
|||
@Autowired |
|||
BaseManufacturerFeign baseManufacturerFeign; |
|||
@Autowired |
|||
BaseGoodsUnitFeign baseGoodsUnitFeign; |
|||
@Value("${image.upload.path:http://127.0.0.1:8080/upload/}") |
|||
String path; |
|||
@Autowired |
|||
BaseGoodsSpuFeign baseGoodsSpuFeign; |
|||
|
|||
|
|||
public ResultBean<PagerVo<BaseGoodsSpuVo>> listPage(PagerQuery<BaseGoodsSpuQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseGoodsSpuFeign.listPage(pq); |
|||
} |
|||
|
|||
@Transactional |
|||
public ResultBean<String> saveOrUpdate(BaseGoodsSpuDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseGoodsSpuFeign.saveOrUpdate(dto); |
|||
} |
|||
|
|||
public ResultBean<BaseGoodsSpuVo> initialization(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseGoodsSpuFeign.initialization(sid); |
|||
} |
|||
|
|||
|
|||
public ResultBean delete(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSpu wmsGoods = fetchBySid(sid); |
|||
if (null != wmsGoods) { |
|||
baseMapper.deleteById(wmsGoods.getId()); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
|
|||
public ResultBean updateIsEnable(String sid, String isEnable) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseGoodsSpuFeign.updateIsEnable(sid, isEnable); |
|||
} |
|||
|
|||
public void download(HttpServletRequest request, HttpServletResponse response) { |
|||
|
|||
// 指定要下载的文件路径
|
|||
String filePath = path + "商品导入模板.xls"; |
|||
String fileName = new File(filePath).getName(); |
|||
String encodedFileName = null; |
|||
try { |
|||
encodedFileName = URLEncoder.encode(fileName, "UTF-8"); |
|||
} catch (UnsupportedEncodingException e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
// 设置响应头信息
|
|||
response.setHeader("Content-Disposition", "attachment; filename=\"" + encodedFileName + "\""); |
|||
// 获取文件名
|
|||
response.setContentType("application/octet-stream"); |
|||
// 读取文件并将其写入响应输出流
|
|||
try (InputStream in = new FileInputStream(filePath); |
|||
OutputStream out = response.getOutputStream()) { |
|||
byte[] buffer = new byte[4096]; |
|||
int bytesRead; |
|||
while ((bytesRead = in.read(buffer)) != -1) { |
|||
out.write(buffer, 0, bytesRead); |
|||
} |
|||
} catch (FileNotFoundException e) { |
|||
throw new RuntimeException(e); |
|||
} catch (IOException e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
} |
|||
|
|||
public ResultBean importExcel(MultipartFile file) throws IOException { |
|||
// return baseGoodsSpuFeign.importExcel(file);
|
|||
ResultBean rb=new ResultBean().fail(); |
|||
//檢查excel
|
|||
ExcelUtil.checkFile(file); |
|||
//解析excel
|
|||
List<String[]> list = ExcelUtil.readExcel(file); |
|||
if (!list.isEmpty()) { |
|||
List tt = new ArrayList(); |
|||
List<BaseGoodsSpuDto> tt1 = new ArrayList(); |
|||
for (int i = 0; i < list.size(); i++) { |
|||
BaseGoodsSpuDto dto =new BaseGoodsSpuDto(); |
|||
String taxRate = StringUtils.isEmpty(list.get(i)[10]) ? null : list.get(i)[10]; |
|||
if(StringUtils.isNotBlank(taxRate)){ |
|||
if(!taxRate.contains(".")){ |
|||
return rb.setMsg("第" + (i + 1) + "行税率格式不正确!"); |
|||
} |
|||
if(taxRate.length()>4){ |
|||
return rb.setMsg("第" + (i + 1) + "行税率长度不正确!"); |
|||
} |
|||
} |
|||
|
|||
dto = this.packaging(list.get(i),dto); |
|||
if (null == dto) { |
|||
return rb.setMsg("导入失败,第" + (i + 1) + "行数据错误!"); |
|||
} else { |
|||
tt.add(dto); |
|||
} |
|||
} |
|||
tt1=a(tt); |
|||
for (BaseGoodsSpuDto baseGoodsSpuDto : tt1) { |
|||
String goodsTypeSid = StringUtils.isEmpty(baseGoodsSpuDto.getGoodsTypeSid()) ? null : baseGoodsSpuDto.getGoodsTypeSid(); |
|||
if (StringUtils.isNotBlank(goodsTypeSid)) { |
|||
BaseGoodsType baseGoodsType = baseGoodsTypeFeign.getTypeByName(goodsTypeSid).getData(); |
|||
if (null != baseGoodsType) { |
|||
baseGoodsSpuDto.setGoodsTypeSid(baseGoodsType.getSid()); |
|||
} else { |
|||
return rb.setMsg("商品分类:" + goodsTypeSid + "不存在,请先添加"); |
|||
} |
|||
} |
|||
|
|||
String brandSid = StringUtils.isEmpty(baseGoodsSpuDto.getBrandSid()) ? null : baseGoodsSpuDto.getBrandSid(); |
|||
if (StringUtils.isNotBlank(brandSid)) { |
|||
BaseBrandInfo brand = baseBrandInfoFeign.getBrandByName(brandSid).getData(); |
|||
if (null != brand) { |
|||
baseGoodsSpuDto.setBrandSid(brand.getSid()); |
|||
} else { |
|||
return rb.setMsg("商品品牌:" + brandSid + "不存在,请先添加"); |
|||
} |
|||
} |
|||
|
|||
String manufacturerSid = StringUtils.isEmpty(baseGoodsSpuDto.getManufacturerSid()) ? null : baseGoodsSpuDto.getManufacturerSid(); |
|||
if (StringUtils.isNotBlank(manufacturerSid)) { |
|||
BaseManufacturer baseManufacturer = baseManufacturerFeign.getManufacturerByName(manufacturerSid).getData(); |
|||
if (null != baseManufacturer) { |
|||
baseGoodsSpuDto.setManufacturerSid(baseManufacturer.getSid()); |
|||
} else { |
|||
return rb.setMsg("商品厂家:" + manufacturerSid + "不存在,请先添加"); |
|||
} |
|||
} |
|||
|
|||
String goodsUnitSid = StringUtils.isEmpty(baseGoodsSpuDto.getGoodsUnitName()) ? null : baseGoodsSpuDto.getGoodsUnitName(); |
|||
if (StringUtils.isNotBlank(goodsUnitSid)) { |
|||
BaseGoodsUnit baseGoodsUnit = baseGoodsUnitFeign.getUnitByName(goodsUnitSid).getData(); |
|||
if (null != baseGoodsUnit) { |
|||
baseGoodsSpuDto.setGoodsUnitSid(baseGoodsUnit.getSid()); |
|||
} else { |
|||
return rb.setMsg("商品单位:" + goodsUnitSid + "不存在,请先添加"); |
|||
} |
|||
} |
|||
} |
|||
baseGoodsSpuFeign.batchSave(tt1); |
|||
return rb.success().setMsg("导入成功"); |
|||
|
|||
} else { |
|||
return rb.setMsg("导入文件没有有效数据"); |
|||
} |
|||
} |
|||
|
|||
public List<BaseGoodsSpuDto> a(List<BaseGoodsSpuDto> dtos) { |
|||
ResultBean rb=new ResultBean().fail(); |
|||
List<BaseGoodsSpuDto> spus = new ArrayList<>();//spu list
|
|||
int goodsCode =dtos.stream().filter(b->StringUtils.isEmpty(b.getGoodsCode())).collect(Collectors.toList()).size(); |
|||
if(goodsCode==0){ |
|||
spus = dtos.stream().filter(distinctByKey(BaseGoodsSpuDto::getGoodsCode)).collect(Collectors.toList()); |
|||
}else{ |
|||
spus = dtos.stream().filter(distinctByKey(BaseGoodsSpuDto::getGoodsName)).collect(Collectors.toList()); |
|||
} |
|||
for (BaseGoodsSpuDto baseGoodsSpuDto : spus) { |
|||
BaseGoodsSpuDetailDto spuDetail = new BaseGoodsSpuDetailDto(); |
|||
List<BaseGoodsSkuDto> skus = new ArrayList<>(); |
|||
String sid = UUID.randomUUID().toString(); |
|||
baseGoodsSpuDto.setSid(sid); |
|||
List<BaseGoodsSpuDto> dtos1=new ArrayList<>(); |
|||
if(goodsCode==0){ |
|||
dtos1 = dtos.stream().filter(d -> d.getGoodsCode().equals(baseGoodsSpuDto.getGoodsCode())).collect(Collectors.toList()); |
|||
}else{ |
|||
dtos1 = dtos.stream().filter(d -> d.getGoodsName().equals(baseGoodsSpuDto.getGoodsName())).collect(Collectors.toList()); |
|||
} |
|||
spuDetail.setGoodsExplain(dtos1.get(0).getBaseGoodsSpuDetail().getGoodsExplain()); |
|||
spuDetail.setGoodsDescription(dtos1.get(0).getBaseGoodsSpuDetail().getGoodsDescription()); |
|||
spuDetail.setSid(UUID.randomUUID().toString()); |
|||
spuDetail.setGoodSpuSid(baseGoodsSpuDto.getSid()); |
|||
for (BaseGoodsSpuDto dto : dtos1) { |
|||
BaseGoodsSkuDto sku = new BaseGoodsSkuDto(); |
|||
String skuSid = UUID.randomUUID().toString(); |
|||
sku.setGoodsSkuCode(dto.getBaseGoodsSkus().get(0).getGoodsSkuCode()); |
|||
sku.setTitle(dto.getBaseGoodsSkus().get(0).getTitle()); |
|||
sku.setExternalCode(dto.getBaseGoodsSkus().get(0).getExternalCode()); |
|||
sku.setGoodsSpuSid(sid); |
|||
sku.setSid(skuSid); |
|||
BaseGoodsSkuExtendDto skuExtend = new BaseGoodsSkuExtendDto(); |
|||
skuExtend.setSid(UUID.randomUUID().toString()); |
|||
skuExtend.setGoodsSkuSid(skuSid); |
|||
skuExtend.setSortNo("1"); |
|||
skuExtend.setFinalPurchasePrice(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getFinalPurchasePrice()); |
|||
skuExtend.setSafetyStockDays(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getSafetyStockDays()); |
|||
skuExtend.setIsOriginalFactory(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getIsOriginalFactory()); |
|||
skuExtend.setIsInventoryAlert(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getIsInventoryAlert()); |
|||
skuExtend.setInventoryAlertUpperLimit(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getInventoryAlertUpperLimit()); |
|||
skuExtend.setInventoryAlertLowerLimit(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getInventoryAlertLowerLimit()); |
|||
skuExtend.setCostPrice(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getCostPrice()); |
|||
skuExtend.setTagPrice(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getTagPrice()); |
|||
skuExtend.setSalesPrice(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getSalesPrice()); |
|||
skuExtend.setStandardPurchasePrice(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getStandardPurchasePrice()); |
|||
skuExtend.setAgencyPrice(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getAgencyPrice()); |
|||
skuExtend.setDiscount(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getDiscount()); |
|||
skuExtend.setMinimumSalesPrice(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getMinimumSalesPrice()); |
|||
skuExtend.setIsLockingSalesPrice(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getIsLockingSalesPrice()); |
|||
skuExtend.setIsIntegralExchange(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getIsIntegralExchange()); |
|||
skuExtend.setIntegralAmount(dto.getBaseGoodsSkus().get(0).getBaseGoodsSkuExtend().getIntegralAmount()); |
|||
sku.setBaseGoodsSkuExtend(skuExtend); |
|||
skus.add(sku); |
|||
} |
|||
baseGoodsSpuDto.setBaseGoodsSkus(skus); |
|||
baseGoodsSpuDto.setBaseGoodsSpuDetail(spuDetail); |
|||
} |
|||
return spus; |
|||
} |
|||
|
|||
private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) { |
|||
Set<Object> seen = ConcurrentHashMap.newKeySet(); |
|||
return t -> seen.add(keyExtractor.apply(t)); |
|||
} |
|||
|
|||
private BaseGoodsSpuDto packaging(String[] arr, BaseGoodsSpuDto baseGoodsSpuDto) { |
|||
Map<String, Object> result = new HashMap<>(); |
|||
//0四电名称1四电类别2规格3数量4单价5总价6单位7备注
|
|||
// BaseGoodsSpuDto baseGoodsSpuDto =null;
|
|||
try { |
|||
String goodsCode = StringUtils.isEmpty(arr[0]) ? "" : arr[0];//
|
|||
String barCode = StringUtils.isEmpty(arr[1]) ? "" : arr[1];//
|
|||
String goodsName = StringUtils.isEmpty(arr[2]) ? "" : arr[2];//
|
|||
String subTitle = StringUtils.isEmpty(arr[3]) ? "" : arr[3]; |
|||
String goodsPY = StringUtils.isEmpty(arr[4]) ? "": arr[4]; |
|||
String goodsShortName = StringUtils.isEmpty(arr[5]) ? "" :arr[5]; |
|||
String goodsTypeSid = StringUtils.isEmpty(arr[6]) ? "" : arr[6]; |
|||
String brandSid = StringUtils.isEmpty(arr[7]) ? "" : arr[7]; |
|||
String manufacturerSid = StringUtils.isEmpty(arr[8]) ? "" : arr[8]; |
|||
// String goodsUnitSid = StringUtils.isEmpty(arr[9]) ? null : arr[9];
|
|||
String goodsUnitName = StringUtils.isEmpty(arr[9]) ? "" : arr[9]; |
|||
String taxRate = StringUtils.isEmpty(arr[10]) ? "0" : arr[10]; |
|||
String shelfLife = StringUtils.isEmpty(arr[11]) ? "0" : arr[11]; |
|||
String nationalStandardCode = StringUtils.isEmpty(arr[12]) ? "" : arr[12]; |
|||
String externalCode = StringUtils.isEmpty(arr[13]) ? "" : arr[13]; |
|||
String factoryCode = StringUtils.isEmpty(arr[14]) ? "" : arr[14]; |
|||
String isListed = (StringUtils.isEmpty(arr[15]) ? "1" : arr[15].equals("是")? "1":"2"); |
|||
String useOrgSid = StringUtils.isEmpty(arr[16]) ? "" : arr[16]; |
|||
String createOrgSid = StringUtils.isEmpty(arr[17]) ? "" : arr[17]; |
|||
|
|||
// String goodSpuSid = StringUtils.isEmpty(arr[19]) ? null : arr[19];
|
|||
String goodsExplain = StringUtils.isEmpty(arr[18]) ? "" : arr[18]; |
|||
String goodsDescription = StringUtils.isEmpty(arr[19]) ? "" : arr[19]; |
|||
|
|||
String goodsSkuSid = ""; |
|||
String goodsSkuCode = StringUtils.isEmpty(arr[20]) ? "" : arr[20]; |
|||
String title = StringUtils.isEmpty(arr[21]) ? "" : arr[21]; |
|||
String skuExternalCode = StringUtils.isEmpty(arr[22]) ? "" : arr[22]; |
|||
|
|||
String finalPurchasePrice = StringUtils.isEmpty(arr[23]) ? "" : arr[23]; |
|||
String safetyStockDays = StringUtils.isEmpty(arr[24]) ? "" : arr[24]; |
|||
String isOriginalFactory = (StringUtils.isEmpty(arr[25]) ? "1" : arr[25].equals("是")? "1":"2"); |
|||
String isInventoryAlert = (StringUtils.isEmpty(arr[26]) ? "1" : arr[26].equals("是")? "1":"2"); |
|||
String inventoryAlertUpperLimit = StringUtils.isEmpty(arr[27]) ? "0" : arr[27]; |
|||
String inventoryAlertLowerLimit = StringUtils.isEmpty(arr[28]) ? "0" : arr[28]; |
|||
String costPrice = StringUtils.isEmpty(arr[29]) ? "0" : arr[29]; |
|||
String tagPrice = StringUtils.isEmpty(arr[30]) ? "0" : arr[30]; |
|||
String salesPrice = StringUtils.isEmpty(arr[31]) ? "0" : arr[31]; |
|||
String standardPurchasePrice = StringUtils.isEmpty(arr[32]) ? "0" : arr[32]; |
|||
String agencyPrice = StringUtils.isEmpty(arr[33]) ? "0" : arr[33]; |
|||
String discount = StringUtils.isEmpty(arr[34]) ? "0" : arr[34]; |
|||
String minimumSalesPrice = StringUtils.isEmpty(arr[35]) ? "0" : arr[35]; |
|||
String isLockingSalesPrice = (StringUtils.isEmpty(arr[36]) ? "1" : arr[36].equals("是")? "1":"2"); |
|||
String isIntegralExchange = (StringUtils.isEmpty(arr[37]) ? "1" : arr[37].equals("是")? "1":"2"); |
|||
String integralAmount = StringUtils.isEmpty(arr[38]) ? "0" : arr[38]; |
|||
|
|||
//excel表中物资类别保存的是分类编号,插入数据库时 根据分类编号查询基础数据中 物资类别表的id
|
|||
|
|||
baseGoodsSpuDto.setSortNo("1"); |
|||
baseGoodsSpuDto.setGoodsCode(goodsCode); |
|||
baseGoodsSpuDto.setBarCode(barCode);//物资类别 保存物资类别表id
|
|||
baseGoodsSpuDto.setGoodsName(goodsName); |
|||
baseGoodsSpuDto.setSubTitle(subTitle); |
|||
baseGoodsSpuDto.setGoodsPY(goodsPY); |
|||
baseGoodsSpuDto.setGoodsShortName(goodsShortName); |
|||
|
|||
baseGoodsSpuDto.setGoodsTypeSid(goodsTypeSid); |
|||
baseGoodsSpuDto.setBrandSid(brandSid); |
|||
baseGoodsSpuDto.setManufacturerSid(manufacturerSid); |
|||
// baseGoodsSpuDto.setGoodsUnitSid(goodsUnitSid);
|
|||
baseGoodsSpuDto.setGoodsUnitName(goodsUnitName); |
|||
baseGoodsSpuDto.setTaxRate(taxRate); |
|||
baseGoodsSpuDto.setShelfLife(shelfLife); |
|||
baseGoodsSpuDto.setNationalStandardCode(nationalStandardCode); |
|||
baseGoodsSpuDto.setExternalCode(externalCode); |
|||
baseGoodsSpuDto.setFactoryCode(factoryCode); |
|||
baseGoodsSpuDto.setIsListed(isListed); |
|||
baseGoodsSpuDto.setUseOrgSid(useOrgSid); |
|||
baseGoodsSpuDto.setCreateOrgSid(createOrgSid); |
|||
BaseGoodsSpuDetailDto dto=new BaseGoodsSpuDetailDto(); |
|||
dto.setGoodsExplain(goodsExplain); |
|||
dto.setGoodsDescription(goodsDescription); |
|||
baseGoodsSpuDto.setBaseGoodsSpuDetail(dto); |
|||
List<BaseGoodsSkuDto> dtos=new ArrayList<>(); |
|||
BaseGoodsSkuDto dto1=new BaseGoodsSkuDto(); |
|||
dto1.setGoodsSkuCode(goodsSkuCode); |
|||
dto1.setTitle(title); |
|||
dto1.setExternalCode(skuExternalCode); |
|||
BaseGoodsSkuExtendDto dto2=new BaseGoodsSkuExtendDto(); |
|||
dto2.setSortNo("1"); |
|||
dto2.setFinalPurchasePrice(finalPurchasePrice); |
|||
dto2.setSafetyStockDays(safetyStockDays); |
|||
dto2.setIsOriginalFactory(isOriginalFactory); |
|||
dto2.setIsInventoryAlert(isInventoryAlert); |
|||
dto2.setInventoryAlertUpperLimit(inventoryAlertUpperLimit); |
|||
dto2.setInventoryAlertLowerLimit(inventoryAlertLowerLimit); |
|||
dto2.setCostPrice(costPrice); |
|||
dto2.setTagPrice(tagPrice); |
|||
dto2.setSalesPrice(salesPrice); |
|||
dto2.setStandardPurchasePrice(standardPurchasePrice); |
|||
dto2.setAgencyPrice(agencyPrice); |
|||
dto2.setDiscount(discount); |
|||
dto2.setMinimumSalesPrice(minimumSalesPrice); |
|||
dto2.setIsLockingSalesPrice(isLockingSalesPrice); |
|||
dto2.setIsIntegralExchange(isIntegralExchange); |
|||
dto2.setIntegralAmount(integralAmount); |
|||
dto1.setBaseGoodsSkuExtend(dto2); |
|||
dtos.add(dto1); |
|||
baseGoodsSpuDto.setBaseGoodsSkus(dtos); |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return null; |
|||
} |
|||
return baseGoodsSpuDto; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.yxt.wms.biz.basegoodsspu; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import com.yxt.wms.biz.basegoodssku.BaseGoodsSkuVo; |
|||
import com.yxt.wms.biz.basegoodsspudetail.BaseGoodsSpuDetailVo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSpuVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
private String lockVersion; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date modifyTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String state; |
|||
private String isDelete; |
|||
private String goodsCode;//商品代码
|
|||
private String barCode;//条形码
|
|||
private String goodsName;//商品名称
|
|||
private String subTitle;//商品名称
|
|||
private String goodsPY;//拼音缩写
|
|||
private String goodsShortName;//商品简称
|
|||
private String goodsTypeSid;//商品分类sid
|
|||
private String brandSid;//品牌sid
|
|||
private String manufacturerSid;//厂家sid
|
|||
private String goodsUnitSid;//商品单位sid
|
|||
private String goodsUnitName;//商品单位名称
|
|||
private String taxRate;//税率
|
|||
private String shelfLife;//保质期天
|
|||
private String nationalStandardCode;//国标码
|
|||
private String sortNo;//排序
|
|||
private String externalCode;//外部编码
|
|||
private String factoryCode;//厂家货号
|
|||
private String isListed;//是否上架
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
private BaseGoodsSpuDetailVo baseGoodsSpuDetail; |
|||
private List<BaseGoodsSkuVo> baseGoodsSkus; |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.yxt.wms.biz.basegoodsspudetail; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:36 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSpuDetail extends BaseEntity { |
|||
private String goodSpuSid;//商品基础信息Sid
|
|||
private String goodsExplain;//商品详细说明
|
|||
private String goodsDescription;//商品描述
|
|||
@TableField(value = "generic_spec") |
|||
private String genericSpec;//通用规格参数及数据,json格式(规格参数id,规格参数值的键值对)
|
|||
@TableField(value = "special_spec") |
|||
private String specialSpec;//特有规格参数及可选值信息,json格式(特有规格参数id,[可选参数值])
|
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.yxt.wms.biz.basegoodsspudetail; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.dto.Dto; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:38 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSpuDetailDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String goodSpuSid;//商品基础信息Sid
|
|||
private String goodsExplain;//商品详细说明
|
|||
private String goodsDescription;//商品描述
|
|||
@TableField(value = "generic_spec") |
|||
private String genericSpec;//通用规格参数及数据,json格式(规格参数id,规格参数值的键值对)
|
|||
@TableField(value = "special_spec") |
|||
private String specialSpec;//特有规格参数及可选值信息,json格式(特有规格参数id,[可选参数值])
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.yxt.wms.biz.basegoodsspudetail; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Mapper |
|||
public interface BaseGoodsSpuDetailMapper extends BaseMapper<BaseGoodsSpuDetail> { |
|||
|
|||
IPage<BaseGoodsSpuDetailVo> listPage(IPage<BaseGoodsSpuDetail> page, @Param(Constants.WRAPPER) QueryWrapper<BaseGoodsSpuDetail> qw); |
|||
|
|||
BaseGoodsSpuDetailVo getSpuDetailsBySpuSid (@Param("skuSid")String skuSid); |
|||
} |
@ -0,0 +1,24 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.wms.biz.basegoodsspudetail.BaseGoodsSpuDetailMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
<select id="listPage" resultType="com.yxt.wms.biz.basegoodsspudetail.BaseGoodsSpuDetailVo"> |
|||
select |
|||
s.*,a.goodsName |
|||
from base_goods_spu_detail s |
|||
left join base_goods_spu a on a.sid=s.goodSpuSid |
|||
|
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="getSpuDetailsBySpuSid" resultType="com.yxt.wms.biz.basegoodsspudetail.BaseGoodsSpuDetailVo"> |
|||
select |
|||
s.*,s.generic_spec as genericSpec,s.special_spec as specialSpec |
|||
from base_goods_spu_detail s |
|||
where s.goodSpuSid=#{skuSid} |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,13 @@ |
|||
package com.yxt.wms.biz.basegoodsspudetail; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSpuDetailQuery implements Query { |
|||
private String name; |
|||
} |
@ -0,0 +1,102 @@ |
|||
package com.yxt.wms.biz.basegoodsspudetail; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.date.DateTime; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.yxt.common.base.config.component.FileUploadComponent; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.PagerUtil; |
|||
import com.yxt.common.base.utils.StringUtils; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Service |
|||
public class BaseGoodsSpuDetailService extends MybatisBaseService<BaseGoodsSpuDetailMapper, BaseGoodsSpuDetail> { |
|||
@Autowired |
|||
private FileUploadComponent fileUploadComponent; |
|||
// @Autowired
|
|||
// private BaseBrandInfoService baseBrandInfoService;
|
|||
// @Autowired
|
|||
// private BaseGoodsTypeService baseGoodsTypeService;
|
|||
// @Autowired
|
|||
// private BaseManufacturerService wmsManufacturerService;
|
|||
public ResultBean<PagerVo<BaseGoodsSpuDetailVo>> listPage(PagerQuery<BaseGoodsSpuDetailQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSpuDetailQuery query = pq.getParams(); |
|||
QueryWrapper<BaseGoodsSpuDetail> qw = new QueryWrapper<>(); |
|||
if(StringUtils.isNotBlank(query.getName())){ |
|||
qw.like("goodsName",query.getName()); |
|||
} |
|||
IPage<BaseGoodsSpuDetail> page = PagerUtil.queryToPage(pq); |
|||
IPage<BaseGoodsSpuDetailVo> pagging = baseMapper.listPage(page, qw); |
|||
PagerVo<BaseGoodsSpuDetailVo> p = PagerUtil.pageToVo(pagging, null); |
|||
return rb.success().setData(p); |
|||
} |
|||
|
|||
public ResultBean<String> saveOrUpdate(BaseGoodsSpuDetailDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSpuDetail detail=baseMapper.selectOne(new QueryWrapper<BaseGoodsSpuDetail>().eq("sid",dto.getSid())); |
|||
String sid = ""; |
|||
if (null!=detail) { |
|||
sid = dto.getSid(); |
|||
BaseGoodsSpuDetail baseGoodsSpuDetail = fetchBySid(dto.getSid()); |
|||
BeanUtil.copyProperties(dto, baseGoodsSpuDetail); |
|||
baseGoodsSpuDetail.setModifyTime(new Date()); |
|||
baseMapper.updateById(baseGoodsSpuDetail); |
|||
} else { |
|||
|
|||
BaseGoodsSpuDetail baseGoodsSpuDetail = new BaseGoodsSpuDetail(); |
|||
sid = baseGoodsSpuDetail.getSid(); |
|||
BeanUtil.copyProperties(dto, baseGoodsSpuDetail); |
|||
baseGoodsSpuDetail.setCreateTime(new DateTime()); |
|||
|
|||
baseMapper.insert(baseGoodsSpuDetail); |
|||
} |
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
|
|||
public ResultBean<BaseGoodsSpuDetailVo> initialization(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSpuDetailVo vo = new BaseGoodsSpuDetailVo(); |
|||
BaseGoodsSpuDetail wmsGoods = fetchBySid(sid); |
|||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|||
BeanUtil.copyProperties(wmsGoods, vo); |
|||
return rb.success().setData(vo); |
|||
} |
|||
public ResultBean<BaseGoodsSpuDetailVo> getSpuDetailsBySpuSid(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSpuDetailVo vo = baseMapper.getSpuDetailsBySpuSid(sid); |
|||
return rb.success().setData(vo); |
|||
} |
|||
|
|||
|
|||
public ResultBean delete(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSpuDetail wmsGoods = fetchBySid(sid); |
|||
if (null != wmsGoods) { |
|||
baseMapper.deleteById(wmsGoods.getId()); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
|
|||
public ResultBean updateIsEnable(String sid,String isEnable) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsSpuDetail wmsGoods = fetchBySid(sid); |
|||
if (null != wmsGoods) { |
|||
wmsGoods.setIsEnable(Integer.parseInt(isEnable)); |
|||
baseMapper.updateById(wmsGoods); |
|||
} |
|||
return rb.success().setMsg("成功"); |
|||
} |
|||
} |
@ -0,0 +1,35 @@ |
|||
package com.yxt.wms.biz.basegoodsspudetail; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsSpuDetailVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
private String lockVersion; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date modifyTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String state; |
|||
private String isDelete; |
|||
private String goodSpuSid;//商品基础信息Sid
|
|||
private String goodsExplain;//商品详细说明
|
|||
private String goodsDescription;//商品描述
|
|||
@TableField(value = "generic_spec") |
|||
private String genericSpec;//通用规格参数及数据,json格式(规格参数id,规格参数值的键值对)
|
|||
@TableField(value = "special_spec") |
|||
private String specialSpec;//特有规格参数及可选值信息,json格式(特有规格参数id,[可选参数值])
|
|||
private String goodsName; |
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.yxt.wms.biz.basegoodstype; |
|||
|
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:36 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsType extends BaseEntity { |
|||
private String goodsTypeName;//商品类别名称
|
|||
private String goodsTypeCode;//类别编码
|
|||
private String percentageRate;//提成比例
|
|||
private String percentageAmount;//提成金额
|
|||
private String pSid;//父级sid
|
|||
private String isParent;//是否为父节点,0为否,1为是,0标识为叶子节点
|
|||
private String isGoodsID;//是否一品一码 0 否 1是
|
|||
private String sortNo;//排序
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
} |
@ -0,0 +1,33 @@ |
|||
package com.yxt.wms.biz.basegoodstype; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.dto.Dto; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:38 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsTypeDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String goodsTypeName;//商品类别名称
|
|||
private String goodsTypeCode;//类别编码
|
|||
private String percentageRate;//提成比例
|
|||
private String percentageAmount;//提成金额
|
|||
private String pSid;//父级sid
|
|||
private String isParent;//是否为父节点,0为否,1为是,0标识为叶子节点
|
|||
private String isGoodsID;//是否一品一码 0 否 1是
|
|||
private String sortNo;//排序
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
private String pName;//创建组织sid
|
|||
private String sids;//父级sid
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.yxt.wms.biz.basegoodstype; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Mapper |
|||
public interface BaseGoodsTypeMapper extends BaseMapper<BaseGoodsType> { |
|||
IPage<BaseGoodsTypeVo> listPage(IPage<BaseGoodsType> page, @Param(Constants.WRAPPER) QueryWrapper<BaseGoodsType> qw); |
|||
} |
@ -0,0 +1,15 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.wms.biz.basegoodstype.BaseGoodsTypeMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
<select id="listPage" resultType="com.yxt.wms.biz.basegoodstype.BaseGoodsTypeVo"> |
|||
select |
|||
* |
|||
from base_goods_type |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,13 @@ |
|||
package com.yxt.wms.biz.basegoodstype; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsTypeQuery implements Query { |
|||
private String name; |
|||
} |
@ -0,0 +1,56 @@ |
|||
package com.yxt.wms.biz.basegoodstype; |
|||
|
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.wms.feign.base.basegoodstype.BaseGoodsTypeFeign; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Service |
|||
public class BaseGoodsTypeService extends MybatisBaseService<BaseGoodsTypeMapper, BaseGoodsType> { |
|||
|
|||
@Autowired |
|||
BaseGoodsTypeFeign baseGoodsTypeFeign; |
|||
|
|||
public ResultBean<PagerVo<BaseGoodsTypeVo>> listPage(PagerQuery<BaseGoodsTypeQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseGoodsTypeFeign.listPage(pq); |
|||
} |
|||
public ResultBean<List<BaseGoodsType>> listAll() { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseGoodsTypeFeign.listAll(); |
|||
} |
|||
|
|||
public ResultBean<String> saveOrUpdate(BaseGoodsTypeDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseGoodsTypeFeign.saveOrUpdate(dto); |
|||
} |
|||
|
|||
public ResultBean<BaseGoodsTypeVo> initialization(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseGoodsTypeFeign.initialization(sid); |
|||
} |
|||
|
|||
|
|||
|
|||
public ResultBean delete(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsType wmsGoodsType = fetchBySid(sid); |
|||
if (null != wmsGoodsType) { |
|||
baseMapper.deleteById(wmsGoodsType.getId()); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
public ResultBean updateIsEnable(String sid,String isEnable) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseGoodsTypeFeign.updateIsEnable(sid, isEnable); |
|||
} |
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.yxt.wms.biz.basegoodstype; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsTypeVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
private String lockVersion; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date modifyTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String state; |
|||
private String isDelete; |
|||
private String goodsTypeName;//商品类别名称
|
|||
private String goodsTypeCode;//类别编码
|
|||
private String percentageRate;//提成比例
|
|||
private String percentageAmount;//提成金额
|
|||
private String pSid;//父级sid
|
|||
private String pName;//父级sid
|
|||
private String isParent="1";//是否为父节点,0为否,1为是,0标识为叶子节点
|
|||
private String isGoodsID="1";//是否一品一码 0 否 1是
|
|||
private String sortNo;//排序
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
private String sids;//创建组织sid
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.yxt.wms.biz.basegoodsunit; |
|||
|
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:36 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsUnit extends BaseEntity { |
|||
|
|||
private String unitName;//单位名称
|
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.yxt.wms.biz.basegoodsunit; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.dto.Dto; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:38 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsUnitDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
private String lockVersion; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date modifyTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String state; |
|||
private String isDelete; |
|||
private String unitName;//单位名称
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.yxt.wms.biz.basegoodsunit; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Mapper |
|||
public interface BaseGoodsUnitMapper extends BaseMapper<BaseGoodsUnit> { |
|||
IPage<BaseGoodsUnitVo> listPage(IPage<BaseGoodsUnit> page, @Param(Constants.WRAPPER) QueryWrapper<BaseGoodsUnit> qw); |
|||
} |
@ -0,0 +1,15 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.wms.biz.basegoodsunit.BaseGoodsUnitMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
<select id="listPage" resultType="com.yxt.wms.biz.basegoodsunit.BaseGoodsUnitVo"> |
|||
select |
|||
* |
|||
from base_goods_unit |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,13 @@ |
|||
package com.yxt.wms.biz.basegoodsunit; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsUnitQuery implements Query { |
|||
private String name; |
|||
} |
@ -0,0 +1,56 @@ |
|||
package com.yxt.wms.biz.basegoodsunit; |
|||
|
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.wms.feign.base.basegoodsunit.BaseGoodsUnitFeign; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Service |
|||
public class BaseGoodsUnitService extends MybatisBaseService<BaseGoodsUnitMapper, BaseGoodsUnit> { |
|||
|
|||
@Autowired |
|||
BaseGoodsUnitFeign baseGoodsUnitFeign; |
|||
|
|||
public ResultBean<PagerVo<BaseGoodsUnitVo>> listPage(PagerQuery<BaseGoodsUnitQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseGoodsUnitFeign.listPage(pq); |
|||
} |
|||
public ResultBean<List<BaseGoodsUnit>> listAll() { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseGoodsUnitFeign.listAll(); |
|||
} |
|||
|
|||
public ResultBean<String> saveOrUpdate(BaseGoodsUnitDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseGoodsUnitFeign.saveOrUpdate(dto); |
|||
} |
|||
|
|||
public ResultBean<BaseGoodsUnitVo> initialization(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseGoodsUnitFeign.initialization(sid); |
|||
} |
|||
|
|||
|
|||
|
|||
public ResultBean delete(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseGoodsUnit wmsGoodsType = fetchBySid(sid); |
|||
if (null != wmsGoodsType) { |
|||
baseMapper.deleteById(wmsGoodsType.getId()); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
public ResultBean updateIsEnable(String sid,String isEnable) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseGoodsUnitFeign.updateIsEnable(sid, isEnable); |
|||
} |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.yxt.wms.biz.basegoodsunit; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseGoodsUnitVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
private String lockVersion; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date modifyTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String state; |
|||
private String isDelete; |
|||
private String unitName;//单位名称
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.yxt.wms.biz.basemanufacturer; |
|||
|
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:36 |
|||
*/ |
|||
@Data |
|||
public class BaseManufacturer extends BaseEntity { |
|||
private String manufacturerName;//厂家名称
|
|||
private String manufacturerCode;//厂家编码
|
|||
private String address;//地址
|
|||
private String telephone;//电话
|
|||
private String contacts;//联系人
|
|||
private String sortNo;//排序
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
} |
@ -0,0 +1,35 @@ |
|||
package com.yxt.wms.biz.basemanufacturer; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.dto.Dto; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:38 |
|||
*/ |
|||
@Data |
|||
public class BaseManufacturerDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
private String lockVersion; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date modifyTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String state; |
|||
private String isDelete; |
|||
|
|||
private String manufacturerName;//厂家名称
|
|||
private String manufacturerCode;//厂家编码
|
|||
private String address;//地址
|
|||
private String telephone;//电话
|
|||
private String contacts;//联系人
|
|||
private String sortNo;//排序
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.yxt.wms.biz.basemanufacturer; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Mapper |
|||
public interface BaseManufacturerMapper extends BaseMapper<BaseManufacturer> { |
|||
IPage<BaseManufacturerVo> listPage(IPage<BaseManufacturer> page, @Param(Constants.WRAPPER) QueryWrapper<BaseManufacturer> qw); |
|||
|
|||
List<BaseManufacturerVo> getAllTypeByUseOrgSid(@Param("useOrgSid") String useOrgSid); |
|||
} |
@ -0,0 +1,20 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.wms.biz.basemanufacturer.BaseManufacturerMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
|
|||
<select id="listPage" resultType="com.yxt.wms.biz.basemanufacturer.BaseManufacturerVo"> |
|||
select |
|||
* |
|||
from base_manufacturer |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
<select id="getAllTypeByUseOrgSid" resultType="com.yxt.wms.biz.basemanufacturer.BaseManufacturerVo"> |
|||
select * |
|||
from base_manufacturer |
|||
where useOrgSid = #{useOrgSid} |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,13 @@ |
|||
package com.yxt.wms.biz.basemanufacturer; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseManufacturerQuery implements Query { |
|||
private String name; |
|||
} |
@ -0,0 +1,60 @@ |
|||
package com.yxt.wms.biz.basemanufacturer; |
|||
|
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.wms.feign.base.basemanufacturer.BaseManufacturerFeign; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:40 |
|||
*/ |
|||
@Service |
|||
public class BaseManufacturerService extends MybatisBaseService<BaseManufacturerMapper, BaseManufacturer> { |
|||
@Autowired |
|||
BaseManufacturerFeign baseManufacturerFeign; |
|||
|
|||
public ResultBean<PagerVo<BaseManufacturerVo>> listPage(PagerQuery<BaseManufacturerQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseManufacturerFeign.listPage(pq); |
|||
} |
|||
public ResultBean<List<BaseManufacturer>> listAll() { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseManufacturerFeign.listAll(); |
|||
} |
|||
|
|||
public ResultBean<String> saveOrUpdate(BaseManufacturerDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseManufacturerFeign.saveOrUpdate(dto); |
|||
} |
|||
|
|||
public ResultBean<BaseManufacturerVo> initialization(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseManufacturerFeign.initialization(sid); |
|||
} |
|||
|
|||
|
|||
|
|||
public ResultBean delete(String sid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
BaseManufacturer wmsManufacturer = fetchBySid(sid); |
|||
if (null != wmsManufacturer) { |
|||
baseMapper.deleteById(wmsManufacturer.getId()); |
|||
} |
|||
return rb.success(); |
|||
} |
|||
public ResultBean updateIsEnable(String sid,String isEnable) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseManufacturerFeign.updateIsEnable(sid, isEnable); |
|||
} |
|||
|
|||
public ResultBean<List<BaseManufacturerVo>> getAllTypeByUseOrgSid(String useOrgSid) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
return baseManufacturerFeign.getAllTypeByUseOrgSid(useOrgSid); |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.yxt.wms.biz.basemanufacturer; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2024/2/26 13:37 |
|||
*/ |
|||
@Data |
|||
public class BaseManufacturerVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
private String lockVersion; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date modifyTime; |
|||
private String remarks; |
|||
private String isEnable; |
|||
private String state; |
|||
private String isDelete; |
|||
private String createBySid; |
|||
private String updateBySid; |
|||
private String manufacturerName;//厂家名称
|
|||
private String manufacturerCode;//厂家编码
|
|||
private String address;//地址
|
|||
private String telephone;//电话
|
|||
private String contacts;//联系人
|
|||
private String sortNo;//排序
|
|||
private String useOrgSid;//使用组织sid
|
|||
private String createOrgSid;//创建组织sid
|
|||
} |
@ -0,0 +1,76 @@ |
|||
/********************************************************* |
|||
********************************************************* |
|||
******************** ******************* |
|||
************* ************ |
|||
******* _oo0oo_ ******* |
|||
*** o8888888o *** |
|||
* 88" . "88 * |
|||
* (| -_- |) * |
|||
* 0\ = /0 * |
|||
* ___/`---'\___ * |
|||
* .' \\| |// '. *
|
|||
* / \\||| : |||// \ *
|
|||
* / _||||| -:- |||||- \ * |
|||
* | | \\\ - /// | | *
|
|||
* | \_| ''\---/'' |_/ | * |
|||
* \ .-\__ '-' ___/-. / * |
|||
* ___'. .' /--.--\ `. .'___ * |
|||
* ."" '< `.___\_<|>_/___.' >' "". * |
|||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | * |
|||
* \ \ `_. \_ __\ /__ _/ .-` / / * |
|||
* =====`-.____`.___ \_____/___.-`___.-'===== * |
|||
* `=---=' * |
|||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * |
|||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__********* |
|||
*********************************************************/ |
|||
package com.yxt.wms.biz.basesupplierBank; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* Project: yxt-base(供应商管理) <br/> |
|||
* File: BaseSupplierBank.java <br/> |
|||
* Class: com.yxt.base.api.basesupplierbank.BaseSupplierBank <br/> |
|||
* Description: 供应商开户行信息. <br/> |
|||
* Copyright: Copyright (c) 2011 <br/> |
|||
* Company: https://gitee.com/liuzp315 <br/>
|
|||
* Makedate: 2024-03-18 13:33:13 <br/> |
|||
* |
|||
* @author liupopo |
|||
* @version 1.0 |
|||
* @since 1.0 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "供应商开户行信息", description = "供应商开户行信息") |
|||
@TableName("base_supplier_bank") |
|||
public class BaseSupplierBank extends BaseEntity { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@ApiModelProperty("供应商sid") |
|||
private String supplierSid; // 供应商sid
|
|||
@ApiModelProperty("开户行") |
|||
private String bankName; // 开户行
|
|||
@ApiModelProperty("开户行帐号") |
|||
private String bankAccount; // 开户行帐号
|
|||
@ApiModelProperty("账户名称") |
|||
private String accountName; // 账户名称
|
|||
@ApiModelProperty("账户类型key") |
|||
private String dueBankKey; // 账户类型key
|
|||
@ApiModelProperty("账户类型value") |
|||
private String dueBankValue; // 账户类型value
|
|||
@ApiModelProperty("银行网点") |
|||
private String bankingOutlets; // 银行网点
|
|||
@ApiModelProperty("开户行地址") |
|||
private String bankAddress; // 开户行地址
|
|||
@ApiModelProperty("联行号") |
|||
private String paymentLines; // 联行号
|
|||
@ApiModelProperty("银行代码") |
|||
private String swiftCode; // 银行代码
|
|||
@ApiModelProperty("币种") |
|||
private String currency; // 币种
|
|||
|
|||
} |
@ -0,0 +1,76 @@ |
|||
/********************************************************* |
|||
********************************************************* |
|||
******************** ******************* |
|||
************* ************ |
|||
******* _oo0oo_ ******* |
|||
*** o8888888o *** |
|||
* 88" . "88 * |
|||
* (| -_- |) * |
|||
* 0\ = /0 * |
|||
* ___/`---'\___ * |
|||
* .' \\| |// '. *
|
|||
* / \\||| : |||// \ *
|
|||
* / _||||| -:- |||||- \ * |
|||
* | | \\\ - /// | | *
|
|||
* | \_| ''\---/'' |_/ | * |
|||
* \ .-\__ '-' ___/-. / * |
|||
* ___'. .' /--.--\ `. .'___ * |
|||
* ."" '< `.___\_<|>_/___.' >' "". * |
|||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | * |
|||
* \ \ `_. \_ __\ /__ _/ .-` / / * |
|||
* =====`-.____`.___ \_____/___.-`___.-'===== * |
|||
* `=---=' * |
|||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * |
|||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__********* |
|||
*********************************************************/ |
|||
package com.yxt.wms.biz.basesupplierBank; |
|||
|
|||
|
|||
import com.yxt.common.core.vo.Vo; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* Project: yxt-base(供应商管理) <br/> |
|||
* File: BaseSupplierBankVo.java <br/> |
|||
* Class: com.yxt.base.api.basesupplierbank.BaseSupplierBankVo <br/> |
|||
* Description: 供应商开户行信息 视图数据对象. <br/> |
|||
* Copyright: Copyright (c) 2011 <br/> |
|||
* Company: https://gitee.com/liuzp315 <br/>
|
|||
* Makedate: 2024-03-18 13:33:13 <br/> |
|||
* |
|||
* @author liupopo |
|||
* @version 1.0 |
|||
* @since 1.0 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "供应商开户行信息 视图数据详情", description = "供应商开户行信息 视图数据详情") |
|||
public class BaseSupplierBankDetailsVo implements Vo { |
|||
|
|||
private String sid; // sid
|
|||
|
|||
@ApiModelProperty("供应商sid") |
|||
private String supplierSid; // 供应商sid
|
|||
@ApiModelProperty("开户行") |
|||
private String bankName; // 开户行
|
|||
@ApiModelProperty("开户行帐号") |
|||
private String bankAccount; // 开户行帐号
|
|||
@ApiModelProperty("账户名称") |
|||
private String accountName; // 账户名称
|
|||
@ApiModelProperty("账户类型key") |
|||
private String dueBankKey; // 账户类型key
|
|||
@ApiModelProperty("账户类型value") |
|||
private String dueBankValue; // 账户类型value
|
|||
@ApiModelProperty("银行网点") |
|||
private String bankingOutlets; // 银行网点
|
|||
@ApiModelProperty("开户行地址") |
|||
private String bankAddress; // 开户行地址
|
|||
@ApiModelProperty("联行号") |
|||
private String paymentLines; // 联行号
|
|||
@ApiModelProperty("银行代码") |
|||
private String swiftCode; // 银行代码
|
|||
@ApiModelProperty("币种") |
|||
private String currency; // 币种
|
|||
|
|||
} |
@ -0,0 +1,76 @@ |
|||
/********************************************************* |
|||
********************************************************* |
|||
******************** ******************* |
|||
************* ************ |
|||
******* _oo0oo_ ******* |
|||
*** o8888888o *** |
|||
* 88" . "88 * |
|||
* (| -_- |) * |
|||
* 0\ = /0 * |
|||
* ___/`---'\___ * |
|||
* .' \\| |// '. *
|
|||
* / \\||| : |||// \ *
|
|||
* / _||||| -:- |||||- \ * |
|||
* | | \\\ - /// | | *
|
|||
* | \_| ''\---/'' |_/ | * |
|||
* \ .-\__ '-' ___/-. / * |
|||
* ___'. .' /--.--\ `. .'___ * |
|||
* ."" '< `.___\_<|>_/___.' >' "". * |
|||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | * |
|||
* \ \ `_. \_ __\ /__ _/ .-` / / * |
|||
* =====`-.____`.___ \_____/___.-`___.-'===== * |
|||
* `=---=' * |
|||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * |
|||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__********* |
|||
*********************************************************/ |
|||
package com.yxt.wms.biz.basesupplierBank; |
|||
|
|||
|
|||
import com.yxt.common.core.dto.Dto; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* Project: yxt-base(供应商管理) <br/> |
|||
* File: BaseSupplierBankDto.java <br/> |
|||
* Class: com.yxt.base.api.basesupplierbank.BaseSupplierBankDto <br/> |
|||
* Description: 供应商开户行信息 数据传输对象. <br/> |
|||
* Copyright: Copyright (c) 2011 <br/> |
|||
* Company: https://gitee.com/liuzp315 <br/>
|
|||
* Makedate: 2024-03-18 13:33:13 <br/> |
|||
* |
|||
* @author liupopo |
|||
* @version 1.0 |
|||
* @since 1.0 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "供应商开户行信息 数据传输对象", description = "供应商开户行信息 数据传输对象") |
|||
public class BaseSupplierBankDto implements Dto { |
|||
|
|||
private String sid; // sid
|
|||
|
|||
@ApiModelProperty("供应商sid") |
|||
private String supplierSid; // 供应商sid
|
|||
@ApiModelProperty("开户行") |
|||
private String bankName; // 开户行
|
|||
@ApiModelProperty("开户行帐号") |
|||
private String bankAccount; // 开户行帐号
|
|||
@ApiModelProperty("账户名称") |
|||
private String accountName; // 账户名称
|
|||
@ApiModelProperty("账户类型key") |
|||
private String dueBankKey; // 账户类型key
|
|||
@ApiModelProperty("账户类型value") |
|||
private String dueBankValue; // 账户类型value
|
|||
@ApiModelProperty("银行网点") |
|||
private String bankingOutlets; // 银行网点
|
|||
@ApiModelProperty("开户行地址") |
|||
private String bankAddress; // 开户行地址
|
|||
@ApiModelProperty("联行号") |
|||
private String paymentLines; // 联行号
|
|||
@ApiModelProperty("银行代码") |
|||
private String swiftCode; // 银行代码
|
|||
@ApiModelProperty("币种") |
|||
private String currency; // 币种
|
|||
|
|||
} |
@ -0,0 +1,67 @@ |
|||
/********************************************************* |
|||
********************************************************* |
|||
******************** ******************* |
|||
************* ************ |
|||
******* _oo0oo_ ******* |
|||
*** o8888888o *** |
|||
* 88" . "88 * |
|||
* (| -_- |) * |
|||
* 0\ = /0 * |
|||
* ___/`---'\___ * |
|||
* .' \\| |// '. *
|
|||
* / \\||| : |||// \ *
|
|||
* / _||||| -:- |||||- \ * |
|||
* | | \\\ - /// | | *
|
|||
* | \_| ''\---/'' |_/ | * |
|||
* \ .-\__ '-' ___/-. / * |
|||
* ___'. .' /--.--\ `. .'___ * |
|||
* ."" '< `.___\_<|>_/___.' >' "". * |
|||
* | | : `- \`.;`\ _ /`;.`/ - ` : | | * |
|||
* \ \ `_. \_ __\ /__ _/ .-` / / * |
|||
* =====`-.____`.___ \_____/___.-`___.-'===== * |
|||
* `=---=' * |
|||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * |
|||
*********__佛祖保佑__永无BUG__验收通过__钞票多多__********* |
|||
*********************************************************/ |
|||
package com.yxt.wms.biz.basesupplierBank; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import org.apache.ibatis.annotations.Delete; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* Project: yxt-base(供应商管理) <br/> |
|||
* File: BaseSupplierBankMapper.java <br/> |
|||
* Class: com.yxt.base.biz.basesupplierbank.BaseSupplierBankMapper <br/> |
|||
* Description: 供应商开户行信息. <br/> |
|||
* Copyright: Copyright (c) 2011 <br/> |
|||
* Company: https://gitee.com/liuzp315 <br/>
|
|||
* Makedate: 2024-03-18 13:33:13 <br/> |
|||
* |
|||
* @author liupopo |
|||
* @version 1.0 |
|||
* @since 1.0 |
|||
*/ |
|||
@Mapper |
|||
public interface BaseSupplierBankMapper extends BaseMapper<BaseSupplierBank> { |
|||
|
|||
IPage<BaseSupplierBankVo> selectPageVo(IPage<BaseSupplierBank> page, @Param(Constants.WRAPPER) Wrapper<BaseSupplierBank> qw); |
|||
|
|||
List<BaseSupplierBankVo> selectListAllVo(@Param(Constants.WRAPPER) Wrapper<BaseSupplierBank> qw); |
|||
|
|||
@Select("select * from base_supplier_bank") |
|||
List<BaseSupplierBankVo> selectListVo(); |
|||
|
|||
@Delete("delete from base_supplier_bank where supplierSid = #{supplierSid}") |
|||
int deleteBySupplierSid(String supplierSid); |
|||
|
|||
@Select("select * from base_supplier_bank where supplierSid = #{supplierSid}") |
|||
List<BaseSupplierBankDetailsVo> selectBySupplierSid(String supplierSid); |
|||
} |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.yxt.wms.biz.basesupplierBank.BaseSupplierBankMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
<select id="selectPageVo" resultType="com.yxt.wms.biz.basesupplierBank.BaseSupplierBankVo"> |
|||
SELECT * FROM base_supplier_bank <where> ${ew.sqlSegment} </where> |
|||
</select> |
|||
|
|||
<select id="selectListAllVo" resultType="com.yxt.wms.biz.basesupplierBank.BaseSupplierBankVo"> |
|||
SELECT * FROM base_supplier_bank <where> ${ew.sqlSegment} </where> |
|||
</select> |
|||
</mapper> |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue