rev:优化物料查询。

This commit is contained in:
2023-03-31 11:29:32 +08:00
parent a4886fe4bf
commit 428c57a28f
5 changed files with 227 additions and 15 deletions

View File

@@ -22,10 +22,10 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
/**
* 海亮缓存线手持服务
* 返回数据CommonResult,code,desc,result是因为原有对接文档给前端返回格式要求保留所以就包了一层。
*
* @author gbx
* @since 2023/3/22
@@ -39,36 +39,47 @@ import java.util.Map;
public class CacheLineHandController{
private final CacheLineHandService cacheLineHandService;
@PostMapping("/materialQuery")
@PostMapping("/queryMaterial")
@Log("物料查询")
@ApiOperation("物料查询")
public ResponseEntity<List<MaterialDto>> queryMaterial(@RequestBody JSONObject form) {
log.info("海亮缓存线手持服务 [查询物料] 接口被请求, 请求参数-{}", form);
String params = form.getString("search_bar");
if(StringUtils.isNotEmpty(params)) {
//限制查询参数过短,模糊力度大
int length = params.getBytes().length;
if(length < 4) {
throw new BizCoreException("输入条件所查询的内容过多请输入大于3个字的查询条件。");
}
}
//checkLength(params);
return new ResponseEntity<>(cacheLineHandService.queryMaterial(params), HttpStatus.OK);
}
@PostMapping("/queryMaterial")
@PostMapping("/materialQuery")
@Log("物料模糊查询")
@ApiOperation("物料模糊查询")
public ResponseEntity<JSONArray> materialQuery(@RequestBody JSONObject form) {
log.info("海亮缓存线手持服务 [查询物料] 接口被请求, 请求参数-{}", form);
String params = form.getString("search_bar");
//checkLength(params);
return new ResponseEntity<>(cacheLineHandService.materialQuery(form.getString("search_bar")), HttpStatus.OK);
}
/**
* 输入搜索条件校验,限制查询参数过短,模糊力度大
*/
private void checkLength(String params) {
if(StringUtils.isNotEmpty(params)) {
//限制查询参数过短,模糊力度大
int length = params.getBytes().length;
if(length < 4) {
//限制查询参数过短,模糊力度大
if(Pattern.compile("[0-9a-zA-Z]+").matcher(params).matches() || Pattern.compile("\\d+").matcher(params).matches()) {
if(length < 5) {
throw new BizCoreException("输入条件所查询的内容过多请输入大于4个字的查询条件。");
}
}
else if(Pattern.compile("[\u4e00-\u9fa5]+").matcher(params).matches()) {
if(length < 9) {
throw new BizCoreException("输入条件所查询的内容过多请输入大于3个字的查询条件。");
}
}
else if(length < 4) {
throw new BizCoreException("输入条件所查询的内容过多请输入大于3个字的查询条件。");
}
}
return new ResponseEntity<>(cacheLineHandService.materialQuery(form.getString("search_bar")), HttpStatus.OK);
}
@PostMapping("/semiMaterialSpecQuery")

View File

@@ -679,6 +679,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
//2.绑定新料箱条码(入满箱或者入空箱),设置缓存线点位不为空
vehiobj.put("vehicle_code", vehicle_code);
vehiobj.put("is_empty", "0");
//非雪花算法生产的ID为主键数据更新下需要拼接条件
positionTab.update(vehiobj, "position_code = '" + position_code + "'");
//3.删除入料箱之前的所有关联信息,包括物料,工序,生产区域
ivtTab.delete("vehicle_code = '" + vehicle_code + "'");

View File

@@ -154,9 +154,8 @@
OR mb.material_code LIKE CONCAT ('%', 输入.condition, '%')
OR mb.material_spec LIKE CONCAT ('%', 输入.condition, '%')
OR class.class_name LIKE CONCAT ('%', 输入.condition, '%')
ORDER BY
mb.material_id desc
ENDOPTION
ORDER BY mb.material_id desc limit 1000
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -0,0 +1,201 @@
server:
port: 8011
#配置数据源
spring:
data:
elasticsearch:
repositories:
enabled: true
client:
reactive:
#endpoints: 172.31.185.110:9200,172.31.154.9:9200 #内网
# endpoints: 47.96.133.178:8200 #外网
endpoints: http://47.96.133.178:8200 #外网
elasticsearch:
rest:
#uris: 172.31.185.110:9200,172.31.154.9:9200 #内网
# uris: 47.96.133.178:8200 #外网
uris: http://47.96.133.178:8200 #外网
username: elastic
password: 123456
datasource:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
#url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
username: ${DB_USER:shenhua}
#password: ${DB_PWD:P@ssw0rd}
#password: ${DB_PWD:root}
#password: ${DB_PWD:Root.123456}
password: ${DB_PWD:123456789}
# 初始连接数
initial-size: 5
# 最小连接数
min-idle: 15
# 最大连接数
max-active: 30
# 是否自动回收超时连接
remove-abandoned: true
# 超时时间(以秒数为单位)
remove-abandoned-timeout: 180
# 获取连接超时时间
max-wait: 3000
# 连接有效性检测时间
time-between-eviction-runs-millis: 60000
# 连接在池中最小生存的时间
min-evictable-idle-time-millis: 300000
# 连接在池中最大生存的时间
max-evictable-idle-time-millis: 900000
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
test-while-idle: true
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
test-on-borrow: true
# 是否在归还到池中前进行检验
test-on-return: false
# 检测连接是否有效
validation-query: select 1
# 配置监控统计
webStatFilter:
enabled: true
stat-view-servlet:
enabled: true
url-pattern: /druid/*
reset-enable: false
filters:
DruidFilter,stat
redis:
#数据库索引
database: ${REDIS_DB:1}
#host: ${REDIS_HOST:127.0.0.1}
host: ${REDIS_HOST:localhost}
port: ${REDIS_PORT:6379}
password: ${REDIS_PWD:}
#连接超时时间
timeout: 5000
redisson:
config: |
threads: 4
nettyThreads: 4
singleServerConfig:
connectionMinimumIdleSize: 8
connectionPoolSize: 8
address: redis://127.0.0.1:6379
idleConnectionTimeout: 10000
timeout: 3000
# 登录相关配置
login:
# 登录缓存
cache-enable: true
# 是否限制单用户登录
single-login: false
# 验证码
login-code:
# 验证码类型配置 查看 LoginProperties 类
code-type: arithmetic
# 登录图形验证码有效时间/分钟
expiration: 2
# 验证码高度
width: 111
# 验证码宽度
heigth: 36
# 内容长度
length: 2
# 字体名称,为空则使用默认字体
font-name:
# 字体大小
font-size: 25
#jwt
jwt:
header: Authorization
# 令牌前缀
token-start-with: Bearer
# 必须使用最少88位的Base64对该令牌进行编码
base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI=
# 令牌过期时间 此处单位/毫秒 默认4小时可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
token-validity-in-seconds: 14400000
# 在线用户key
online-key: online-token-
# 验证码
code-key: code-key-
# token 续期检查时间范围默认30分钟单位毫秒在token即将过期的一段时间内用户操作了则给用户的token续期
detect: 1800000
# 续期时间范围默认1小时单位毫秒
renew: 3600000
#是否允许生成代码生产环境设置为false
generator:
enabled: true
#是否开启 swagger-ui
swagger:
enabled: true
# IP 本地解析
ip:
local-parsing: true
# 文件存储路径
file:
mac:
path: ~/file/
avatar: ~/avatar/
linux:
path: /home/eladmin/file/
avatar: /home/eladmin/avatar/
windows:
path: C:\eladmin\file\
avatar: C:\eladmin\avatar\
# 文件大小 /M
maxSize: 100
avatarMaxSize: 5
sa-token:
# token 名称 (同时也是cookie名称)
token-name: Authorization
# token 有效期单位s 默认30天, -1代表永不过期
timeout: 2592000
# token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
activity-timeout: -1
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
is-share: false
# token风格
token-style: random-128
# 是否输出操作日志
is-log: false
jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq
# token 前缀
token-prefix:
cookie:
# 配置 Cookie 作用域:根据二级域名实现sso登入如lms.sso.com;acs.sso.com
domain:
#jetcache:
# defaultCacheType: LOCAL
# statIntervalMinutes: 15
# areaInCacheName: false
# hiddenPackages: com.yb
# local:
# default:
# type: caffeine
# limit: 100
# keyConvertor: fastjson
# expireAfterWriteInMillis: 60000
# remote:
# default:
# type: redis.lettuce
# keyConvertor: fastjson
# valueEncoder: kryo
# valueDecoder: kryo
# poolConfig:
# minIdle: 5
# maxIdle: 200
# maxTotal: 1000
# uri:
# - redis://127.0.0.1:6379
es:
index: mes_log