添加电子标签的扫码捡选和按钮确认功能
This commit is contained in:
parent
10680d7fec
commit
9013364d84
|
|
@ -5,3 +5,18 @@
|
||||||
+ 入库任务处理:
|
+ 入库任务处理:
|
||||||
|
|
||||||
若起点为空则解析成单个堆垛机任务,此时若经过托盘线扫码则更新起点到组合入库任务,同时删除解析好的任务,重新解析。
|
若起点为空则解析成单个堆垛机任务,此时若经过托盘线扫码则更新起点到组合入库任务,同时删除解析好的任务,重新解析。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**电子标签**
|
||||||
|
|
||||||
|
+ 扫描字符串码:``^user$`` 后 扫描的条码视为绑定这个区域的操作者;
|
||||||
|
+ 扫描字符串码:``$user^`` 解绑用户;
|
||||||
|
|
||||||
|
电子标签联动输送线逻辑:输送线扫码时检查该捡选站台对应的电子标签货位是否有任务,若有则弹出;此处<span style="color:#F56789">需要正确在电子标签货位表填写站台号</span>
|
||||||
|
|
||||||
|
电子标签状态:已经激活的直接定时任务点亮,未激活的要扫码触发
|
||||||
|
|
@ -3,13 +3,30 @@ package org.wcs.business.etag;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.wcs.business.pub.ReportStandard;
|
||||||
import org.wcs.business.redis.EtagRedis;
|
import org.wcs.business.redis.EtagRedis;
|
||||||
|
import org.wcs.config.EtagConfig;
|
||||||
|
import org.wcs.constant.ConstantData;
|
||||||
import org.wcs.constant.enums.database.ETagTypeEnum;
|
import org.wcs.constant.enums.database.ETagTypeEnum;
|
||||||
|
import org.wcs.constant.enums.database.EtagBusinessTypeEnum;
|
||||||
|
import org.wcs.constant.enums.database.EtagTaskStatusEnum;
|
||||||
|
import org.wcs.constant.enums.etag.EtagSubCommandEnum;
|
||||||
|
import org.wcs.constant.enums.etag.LedBlinkingEnum;
|
||||||
|
import org.wcs.constant.enums.etag.LedColorEnum;
|
||||||
|
import org.wcs.mapper.intf.AppEtagTagInfoService;
|
||||||
|
import org.wcs.mapper.intf.AppEtagTaskService;
|
||||||
|
import org.wcs.model.bo.etag.EtagLightParams;
|
||||||
import org.wcs.model.bo.etag.EtagReturnInfo;
|
import org.wcs.model.bo.etag.EtagReturnInfo;
|
||||||
|
import org.wcs.model.bo.tuple.Tuple2;
|
||||||
import org.wcs.model.po.app.AppEtagTagInfo;
|
import org.wcs.model.po.app.AppEtagTagInfo;
|
||||||
|
import org.wcs.model.po.app.AppEtagTask;
|
||||||
import org.wcs.plugin.tcp.model.SocketDataItem;
|
import org.wcs.plugin.tcp.model.SocketDataItem;
|
||||||
|
import org.wcs.utils.AppStringUtils;
|
||||||
import org.wcs.utils.AppThreadUtils;
|
import org.wcs.utils.AppThreadUtils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -20,8 +37,16 @@ import java.util.Objects;
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class EtagDataHandler {
|
public class EtagDataHandler {
|
||||||
|
|
||||||
|
// 电子标签操作类
|
||||||
|
private final EtagAtopOperation etagAtopOperation;
|
||||||
// 电子标签 redis 操作类
|
// 电子标签 redis 操作类
|
||||||
private final EtagRedis etagRedis;
|
private final EtagRedis etagRedis;
|
||||||
|
// 电子标签操作类
|
||||||
|
private final EtagConfig etagConfig;
|
||||||
|
// 电子标签信息服务类
|
||||||
|
private final AppEtagTagInfoService etagInfoService;
|
||||||
|
// 电子标签任务服务类
|
||||||
|
private final AppEtagTaskService etagTaskService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接收字节数据并解析,主要是解析电子标签扫码器扫描的数据和标签按下确认的数据
|
* 接收字节数据并解析,主要是解析电子标签扫码器扫描的数据和标签按下确认的数据
|
||||||
|
|
@ -91,22 +116,281 @@ public class EtagDataHandler {
|
||||||
}
|
}
|
||||||
Integer tagType = appEtagTagInfo.getTagType();
|
Integer tagType = appEtagTagInfo.getTagType();
|
||||||
if(Objects.equals(tagType, ETagTypeEnum.SCAN.getCode())) {
|
if(Objects.equals(tagType, ETagTypeEnum.SCAN.getCode())) {
|
||||||
handScanCode(etagReturnInfo);
|
handScanCode(appEtagTagInfo, etagReturnInfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(ETagTypeEnum.buttonTagList().contains(ETagTypeEnum.getByCode(tagType))) {
|
if(ETagTypeEnum.buttonTagList().contains(ETagTypeEnum.getByCode(tagType))) {
|
||||||
handleTagConfirm(etagReturnInfo);
|
handleTagConfirm(appEtagTagInfo, etagReturnInfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理扫码标签
|
||||||
|
* @param appEtagTagInfo 标签信息
|
||||||
|
* @param etagReturnInfo 扫码标签返回信息
|
||||||
|
*/
|
||||||
|
private void handScanCode(AppEtagTagInfo appEtagTagInfo, EtagReturnInfo etagReturnInfo) {
|
||||||
|
if(etagReturnInfo.getSubCommand().equals(EtagSubCommandEnum.CONFIRM_COMMAND.getCode())) {
|
||||||
|
// ---- 正确提交
|
||||||
|
String user = etagRedis.getEtagAreaUser(appEtagTagInfo.getAreaId());
|
||||||
|
/* 用户相关 */
|
||||||
|
boolean isUserBind = bindOrUnbindUser(appEtagTagInfo.getAreaId(), etagReturnInfo.getData(), user);
|
||||||
|
if(isUserBind) {
|
||||||
|
return; // 如果是用户绑定相关的功能则单独处理,此处返回
|
||||||
|
}
|
||||||
|
/* 扫描条码相关 */
|
||||||
|
// 检查是否有任务
|
||||||
|
List<Integer> taskStatusList = List.of(EtagTaskStatusEnum.NOT_ACTIVATED.getCode());
|
||||||
|
List<AppEtagTask> appEtagTaskList = etagTaskService.queryByTagAreaIdAndVehicleAndStatus(appEtagTagInfo.getAreaId(), etagReturnInfo.getData(), taskStatusList);
|
||||||
|
if(appEtagTaskList == null) {
|
||||||
|
log.info("电子标签区域: {} 扫码: {},任务检索失败", appEtagTagInfo.getAreaId(), etagReturnInfo.getData());
|
||||||
|
EtagLightParams lightParams = EtagLightParams.builder()
|
||||||
|
.tagName(appEtagTagInfo.getTagName())
|
||||||
|
.tagId(appEtagTagInfo.getTagId().byteValue())
|
||||||
|
.tagValue("")
|
||||||
|
.tagString("任务检索异常")
|
||||||
|
.ledBlinking(LedBlinkingEnum.BLINKING_0_25)
|
||||||
|
.ledColor(LedColorEnum.RED)
|
||||||
|
.build();
|
||||||
|
lightAreaSummaryTag(appEtagTagInfo.getAreaId(), lightParams);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(appEtagTaskList.isEmpty()) {
|
||||||
|
log.info("电子标签区域: {} 扫码: {},无电子标签任务", appEtagTagInfo.getAreaId(), etagReturnInfo.getData());
|
||||||
|
EtagLightParams lightParams = EtagLightParams.builder()
|
||||||
|
.tagName(appEtagTagInfo.getTagName())
|
||||||
|
.tagId(appEtagTagInfo.getTagId().byteValue())
|
||||||
|
.tagValue("0")
|
||||||
|
.tagString("任务完成")
|
||||||
|
.ledBlinking(LedBlinkingEnum.LED_ON)
|
||||||
|
.ledColor(LedColorEnum.GREEN)
|
||||||
|
.build();
|
||||||
|
lightAreaSummaryTag(appEtagTagInfo.getAreaId(), lightParams);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log.info("电子标签区域: {} 扫码: {},电子标签任务数量:{}", appEtagTagInfo.getAreaId(), etagReturnInfo.getData(), appEtagTaskList.size());
|
||||||
|
EtagLightParams lightParams = EtagLightParams.builder()
|
||||||
|
.tagName(appEtagTagInfo.getTagName())
|
||||||
|
.tagId(appEtagTagInfo.getTagId().byteValue())
|
||||||
|
.tagValue(String.valueOf(appEtagTaskList.size()))
|
||||||
|
.tagString("正在捡货:" + etagReturnInfo.getData())
|
||||||
|
.ledBlinking(LedBlinkingEnum.LED_ON)
|
||||||
|
.ledColor(LedColorEnum.ORANGE)
|
||||||
|
.build();
|
||||||
|
lightAreaSummaryTag(appEtagTagInfo.getAreaId(), lightParams);
|
||||||
|
etagRedis.setEtagAreaVehicle(appEtagTagInfo.getAreaId(), etagReturnInfo.getData()); // 将扫码条码存储
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EtagSubCommandEnum subCommandEnum = EtagSubCommandEnum.getByCode(etagReturnInfo.getSubCommand());
|
||||||
|
String desc = subCommandEnum == null ? String.valueOf(etagReturnInfo.getSubCommand()) : subCommandEnum.getDesc();
|
||||||
|
log.info("电子标签扫码器 {},返回非正常提交类型:{}", etagReturnInfo, desc);
|
||||||
|
}
|
||||||
|
|
||||||
private void handScanCode(EtagReturnInfo etagReturnInfo) {
|
/**
|
||||||
|
* 区域用户绑定或解绑
|
||||||
|
* @param areaId 区域ID
|
||||||
|
* @param data 数据
|
||||||
|
* @param user 用户
|
||||||
|
* @return 是否处理成功
|
||||||
|
*/
|
||||||
|
private boolean bindOrUnbindUser(String areaId, String data, String user) {
|
||||||
|
// 判断区域用户绑定
|
||||||
|
if(data.equals(etagConfig.getAreaUserUnbind())) {
|
||||||
|
etagRedis.setEtagAreaUser(areaId, "");
|
||||||
|
log.info("电子标签区域 {} 解绑用户", areaId);
|
||||||
|
EtagLightParams lightParams = EtagLightParams.builder()
|
||||||
|
.tagValue(user)
|
||||||
|
.tagString("解绑用户")
|
||||||
|
.ledBlinking(LedBlinkingEnum.BLINKING_0_25)
|
||||||
|
.ledColor(LedColorEnum.RED)
|
||||||
|
.build();
|
||||||
|
lightAreaSummaryTag(areaId, lightParams);
|
||||||
|
AppThreadUtils.sleep(1500); // 点亮标签 1.5秒
|
||||||
|
EtagLightParams offParams = EtagLightParams.builder()
|
||||||
|
.tagValue(user)
|
||||||
|
.tagString("解绑用户")
|
||||||
|
.ledBlinking(LedBlinkingEnum.LED_OFF)
|
||||||
|
.ledColor(LedColorEnum.RED)
|
||||||
|
.build();
|
||||||
|
lightAreaSummaryTag(areaId, offParams);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(data.equals(etagConfig.getAreaUserPrefix())) {
|
||||||
|
etagRedis.setEtagAreaUser(areaId, etagConfig.getAreaUserPrefix());
|
||||||
|
log.info("电子标签区域 {} 准备绑定用户", areaId);
|
||||||
|
EtagLightParams lightParams = EtagLightParams.builder()
|
||||||
|
.tagValue("888")
|
||||||
|
.tagString("请扫描用户码")
|
||||||
|
.ledBlinking(LedBlinkingEnum.BLINKING_0_25)
|
||||||
|
.ledColor(LedColorEnum.GREEN)
|
||||||
|
.build();
|
||||||
|
lightAreaSummaryTag(areaId, lightParams);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(user != null && user.equals(etagConfig.getAreaUserPrefix())) {
|
||||||
|
etagRedis.setEtagAreaUser(areaId, data);
|
||||||
|
log.info("电子标签区域 {} 绑定用户:{}", areaId, data);
|
||||||
|
EtagLightParams lightParams = EtagLightParams.builder()
|
||||||
|
.tagValue(user)
|
||||||
|
.tagString("绑定成功")
|
||||||
|
.ledBlinking(LedBlinkingEnum.LED_ON)
|
||||||
|
.ledColor(LedColorEnum.PINK)
|
||||||
|
.build();
|
||||||
|
lightAreaSummaryTag(areaId, lightParams);
|
||||||
|
AppThreadUtils.sleep(1500); // 点亮标签 1.5秒
|
||||||
|
EtagLightParams offParams = EtagLightParams.builder()
|
||||||
|
.tagValue(user)
|
||||||
|
.tagString("绑定成功")
|
||||||
|
.ledBlinking(LedBlinkingEnum.LED_OFF)
|
||||||
|
.ledColor(LedColorEnum.PINK)
|
||||||
|
.build();
|
||||||
|
lightAreaSummaryTag(areaId, offParams);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void handleTagConfirm(EtagReturnInfo etagReturnInfo) {
|
/**
|
||||||
|
* 点亮区域标签
|
||||||
|
* @param areaId 区域
|
||||||
|
* @param lightParams 点亮标签参数
|
||||||
|
*/
|
||||||
|
private void lightAreaSummaryTag(String areaId, EtagLightParams lightParams) {
|
||||||
|
AppEtagTagInfo querySummaryTag = new AppEtagTagInfo();
|
||||||
|
querySummaryTag.setAreaId(areaId);
|
||||||
|
querySummaryTag.setBusinessType(EtagBusinessTypeEnum.AREA.getCode());
|
||||||
|
List<AppEtagTagInfo> tagInfos = etagInfoService.queryIgnoreNull(querySummaryTag);
|
||||||
|
if(tagInfos == null || tagInfos.isEmpty()) {
|
||||||
|
log.warn("电子标签区域 {} 无汇总标签", areaId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (AppEtagTagInfo tagInfo : tagInfos) {
|
||||||
|
EtagLightParams tagLightParams = EtagLightParams.builder()
|
||||||
|
.tagName(tagInfo.getTagName())
|
||||||
|
.tagId(tagInfo.getTagId().byteValue())
|
||||||
|
.tagValue(lightParams.getTagValue())
|
||||||
|
.tagString(lightParams.getTagString())
|
||||||
|
.ledColor(lightParams.getLedColor())
|
||||||
|
.ledBlinking(lightParams.getLedBlinking())
|
||||||
|
.build();
|
||||||
|
String lightTagResult = etagAtopOperation.lightTag(tagLightParams);
|
||||||
|
log.info("点亮电子标签: {},点亮参数:{},点亮结果:{}", tagInfo, tagLightParams, lightTagResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理标签按下确认
|
||||||
|
* @param appEtagTagInfo 标签信息
|
||||||
|
* @param etagReturnInfo 标签按下确认返回信息
|
||||||
|
*/
|
||||||
|
private void handleTagConfirm(AppEtagTagInfo appEtagTagInfo, EtagReturnInfo etagReturnInfo) {
|
||||||
|
if(Objects.equals(appEtagTagInfo.getBusinessType(), EtagBusinessTypeEnum.AREA.getCode())) {
|
||||||
|
// 区域总标签按下
|
||||||
|
handleSummaryTagConfirm(appEtagTagInfo, etagReturnInfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(Objects.equals(appEtagTagInfo.getBusinessType(), EtagBusinessTypeEnum.NORMAL.getCode())) {
|
||||||
|
// 普通标签按下
|
||||||
|
handleNormalTagConfirm(appEtagTagInfo, etagReturnInfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log.info("未知业务标签发来确认:{};{}", appEtagTagInfo, etagReturnInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理区域总标签按下
|
||||||
|
* @param appEtagTagInfo 标签信息
|
||||||
|
* @param etagReturnInfo 标签按下确认返回信息
|
||||||
|
*/
|
||||||
|
private void handleSummaryTagConfirm(AppEtagTagInfo appEtagTagInfo, EtagReturnInfo etagReturnInfo) {
|
||||||
|
if(etagReturnInfo.getSubCommand().equals(EtagSubCommandEnum.CONFIRM_COMMAND.getCode())) {
|
||||||
|
// 按下确认键 ---- 区域标签按下时检查是否还有没捡选任务,若有则再次点亮标签
|
||||||
|
String vehicleNo = etagRedis.getEtagAreaVehicle(appEtagTagInfo.getAreaId());
|
||||||
|
if(AppStringUtils.isEmpty(vehicleNo)) {
|
||||||
|
log.info("电子标签区域: {} 区域标签按下,载具编号未绑定", appEtagTagInfo.getAreaId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 检查是否有任务
|
||||||
|
List<Integer> taskStatusList = List.of(EtagTaskStatusEnum.NOT_ACTIVATED.getCode(), EtagTaskStatusEnum.LIGHTING.getCode());
|
||||||
|
List<AppEtagTask> appEtagTaskList = etagTaskService.queryByTagAreaIdAndVehicleAndStatus(appEtagTagInfo.getAreaId(), vehicleNo, taskStatusList);
|
||||||
|
if(appEtagTaskList == null) {
|
||||||
|
log.info("电子标签区域: {} 区域标签按下: {},任务检索失败", appEtagTagInfo.getAreaId(), vehicleNo);
|
||||||
|
EtagLightParams lightParams = EtagLightParams.builder()
|
||||||
|
.tagName(appEtagTagInfo.getTagName())
|
||||||
|
.tagId(appEtagTagInfo.getTagId().byteValue())
|
||||||
|
.tagValue("")
|
||||||
|
.tagString("任务检索异常")
|
||||||
|
.ledBlinking(LedBlinkingEnum.BLINKING_0_25)
|
||||||
|
.ledColor(LedColorEnum.RED)
|
||||||
|
.build();
|
||||||
|
lightAreaSummaryTag(appEtagTagInfo.getAreaId(), lightParams);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(appEtagTaskList.isEmpty()) {
|
||||||
|
log.info("电子标签区域: {} 区域标签按下: {},无电子标签任务", appEtagTagInfo.getAreaId(), vehicleNo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log.info("电子标签区域: {} 区域标签按下: {},电子标签任务数量:{}", appEtagTagInfo.getAreaId(), vehicleNo, appEtagTaskList.size());
|
||||||
|
EtagLightParams lightParams = EtagLightParams.builder()
|
||||||
|
.tagName(appEtagTagInfo.getTagName())
|
||||||
|
.tagId(appEtagTagInfo.getTagId().byteValue())
|
||||||
|
.tagValue(String.valueOf(appEtagTaskList.size()))
|
||||||
|
.tagString("还需捡货:" + vehicleNo)
|
||||||
|
.ledBlinking(LedBlinkingEnum.LED_ON)
|
||||||
|
.ledColor(LedColorEnum.ORANGE)
|
||||||
|
.build();
|
||||||
|
lightAreaSummaryTag(appEtagTagInfo.getAreaId(), lightParams);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EtagSubCommandEnum subCommandEnum = EtagSubCommandEnum.getByCode(etagReturnInfo.getSubCommand());
|
||||||
|
String desc = subCommandEnum == null ? String.valueOf(etagReturnInfo.getSubCommand()) : subCommandEnum.getDesc();
|
||||||
|
log.info("电子标签区域标签 {},返回非正常提交类型:{}", etagReturnInfo, desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理普通标签按下
|
||||||
|
* @param appEtagTagInfo 标签信息
|
||||||
|
* @param etagReturnInfo 标签按下确认返回信息
|
||||||
|
*/
|
||||||
|
private void handleNormalTagConfirm(AppEtagTagInfo appEtagTagInfo, EtagReturnInfo etagReturnInfo) {
|
||||||
|
log.info("电子标签普通标签 {},返回确认信息:{}", appEtagTagInfo.getTagName(), etagReturnInfo.getData());
|
||||||
|
if(etagReturnInfo.getSubCommand().equals(EtagSubCommandEnum.CONFIRM_COMMAND.getCode())) {
|
||||||
|
// 按下确认键
|
||||||
|
AppEtagTask etagTagTask = etagRedis.getEtagTagTask(appEtagTagInfo.getTagName());
|
||||||
|
if(etagTagTask == null) {
|
||||||
|
log.info("电子标签普通标签 {},未检索到任务", appEtagTagInfo.getTagName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 更新确认数量和确认人
|
||||||
|
String user = etagRedis.getEtagAreaUser(appEtagTagInfo.getAreaId()); // 确认人
|
||||||
|
int confirmNum = AppStringUtils.forceToInt(etagReturnInfo.getData());
|
||||||
|
AppEtagTask updateEtagTagTask = new AppEtagTask();
|
||||||
|
updateEtagTagTask.setTaskId(etagTagTask.getTaskId());
|
||||||
|
updateEtagTagTask.setTaskStatus(EtagTaskStatusEnum.CONFIRM.getCode());
|
||||||
|
updateEtagTagTask.setConfirmTime(LocalDateTime.now());
|
||||||
|
updateEtagTagTask.setCompletedTime(LocalDateTime.now());
|
||||||
|
updateEtagTagTask.setConfirmNum(BigDecimal.valueOf(confirmNum));
|
||||||
|
updateEtagTagTask.setConfirmPerson(user);
|
||||||
|
Integer result = etagTaskService.updateIgnoreNull(updateEtagTagTask).result();
|
||||||
|
log.info("电子标签普通标签 {},更新任务:{},结果:{}", appEtagTagInfo.getTagName(), etagTagTask.getTaskId(), result);
|
||||||
|
// 上报电子标签任务
|
||||||
|
if(etagTagTask.getTaskSource().equals(ConstantData.SYSTEM_NAME)) {
|
||||||
|
return; // 自己创建的不需要上报
|
||||||
|
}
|
||||||
|
Tuple2<String, String> reportResult = ReportStandard.etagTaskReport(etagTagTask, confirmNum, user);
|
||||||
|
if(AppStringUtils.isEmpty(reportResult.item1)) {
|
||||||
|
log.info("电子标签普通标签 {},任务号:{},上报任务失败:{}", appEtagTagInfo.getTagName(), etagTagTask.getTaskId(), reportResult.item1);
|
||||||
|
} else {
|
||||||
|
log.info("电子标签普通标签 {},任务号:{},上报任务结果:{}", appEtagTagInfo.getTagName(), etagTagTask.getTaskId(), reportResult.item2);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EtagSubCommandEnum subCommandEnum = EtagSubCommandEnum.getByCode(etagReturnInfo.getSubCommand());
|
||||||
|
String desc = subCommandEnum == null ? String.valueOf(etagReturnInfo.getSubCommand()) : subCommandEnum.getDesc();
|
||||||
|
log.info("电子标签小标签 {},返回非正常提交类型:{}", etagReturnInfo, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ import org.wcs.model.po.app.AppEtagTagLocation;
|
||||||
import org.wcs.model.po.app.AppEtagTask;
|
import org.wcs.model.po.app.AppEtagTask;
|
||||||
import org.wcs.utils.AppStringUtils;
|
import org.wcs.utils.AppStringUtils;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -41,6 +43,8 @@ public class EtagRedis {
|
||||||
private static final String ETAG_TAG_COLOR_KEY = ConstantData.SYSTEM_NAME + ":Etag:TagColor";
|
private static final String ETAG_TAG_COLOR_KEY = ConstantData.SYSTEM_NAME + ":Etag:TagColor";
|
||||||
// 电子标签小标签闪烁信息 ---- 存储上次的闪烁信息,防止重复发送闪烁命令
|
// 电子标签小标签闪烁信息 ---- 存储上次的闪烁信息,防止重复发送闪烁命令
|
||||||
private static final String ETAG_TAG_BLINKING_KEY = ConstantData.SYSTEM_NAME + ":Etag:TagBlinking";
|
private static final String ETAG_TAG_BLINKING_KEY = ConstantData.SYSTEM_NAME + ":Etag:TagBlinking";
|
||||||
|
// 电子标签绑定的当前载具编号
|
||||||
|
private static final String ETAG_AREA_VEHICLE_KEY = ConstantData.SYSTEM_NAME + ":Etag:AreaVehicle";
|
||||||
|
|
||||||
|
|
||||||
/* ******************** 电子标签小标签信息 *********************** */
|
/* ******************** 电子标签小标签信息 *********************** */
|
||||||
|
|
@ -255,5 +259,63 @@ public class EtagRedis {
|
||||||
return LedBlinkingEnum.getByCode(Integer.valueOf(ledBlinking));
|
return LedBlinkingEnum.getByCode(Integer.valueOf(ledBlinking));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ******************** 电子标签区域绑定的载具信息 *********************** */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置电子标签区域绑定的载具信息
|
||||||
|
* @param areaId 区域ID
|
||||||
|
* @param vehicleNo 载具编号
|
||||||
|
*/
|
||||||
|
public void setEtagAreaVehicle(String areaId, String vehicleNo) {
|
||||||
|
stringRedisTemplate.opsForValue().set(ETAG_AREA_VEHICLE_KEY + ":" + areaId, vehicleNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取电子标签区域绑定的载具信息
|
||||||
|
* @param areaId 区域ID
|
||||||
|
* @return 载具编号
|
||||||
|
*/
|
||||||
|
public String getEtagAreaVehicle(String areaId) {
|
||||||
|
String vehicleNo = stringRedisTemplate.opsForValue().get(ETAG_AREA_VEHICLE_KEY + ":" + areaId);
|
||||||
|
if(AppStringUtils.isEmpty(vehicleNo)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return vehicleNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空电子标签区域绑定的载具信息
|
||||||
|
*/
|
||||||
|
public void clearEtagAreaVehicle() {
|
||||||
|
Set<String> keys = stringRedisTemplate.keys(ETAG_AREA_VEHICLE_KEY + ":*");
|
||||||
|
stringRedisTemplate.delete(keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空电子标签区域绑定的载具信息
|
||||||
|
* @param areaId 区域ID
|
||||||
|
*/
|
||||||
|
public void clearEtagAreaVehicle(String areaId) {
|
||||||
|
Set<String> keys = stringRedisTemplate.keys(ETAG_AREA_VEHICLE_KEY + ":" + areaId);
|
||||||
|
stringRedisTemplate.delete(keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取电子标签区域绑定的载具信息
|
||||||
|
* @return < 区域号,载具编号 >
|
||||||
|
*/
|
||||||
|
public Map<String, String> getEtagAreaVehicleAll() {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
Set<String> keys = stringRedisTemplate.keys(ETAG_AREA_VEHICLE_KEY + ":*");
|
||||||
|
for (String key : keys) {
|
||||||
|
String vehicleNo = stringRedisTemplate.opsForValue().get(key);
|
||||||
|
String[] KeySplitList = key.split(":");
|
||||||
|
map.put(KeySplitList[KeySplitList.length - 1], vehicleNo);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
25
wcs/src/main/java/org/wcs/config/EtagConfig.java
Normal file
25
wcs/src/main/java/org/wcs/config/EtagConfig.java
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
package org.wcs.config;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "wcs.etag")
|
||||||
|
public class EtagConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子标签扫码绑定用户前扫码的字符串
|
||||||
|
*/
|
||||||
|
private String areaUserPrefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子标签解绑用户
|
||||||
|
*/
|
||||||
|
private String areaUserUnbind;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package org.wcs.constant.enums.database;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子标签业务类型枚举
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum EtagBusinessTypeEnum {
|
||||||
|
|
||||||
|
NORMAL(0, "普通"),
|
||||||
|
AREA(1, "区域标签"),
|
||||||
|
TUNNEL_LIGHT(2, "巷道灯");
|
||||||
|
|
||||||
|
private final Integer code;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
EtagBusinessTypeEnum(Integer code, String desc) {
|
||||||
|
this.code = code;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,12 +14,23 @@ public enum EtagSubCommandEnum {
|
||||||
BUTTON_STUCK(13, "按键卡死"),
|
BUTTON_STUCK(13, "按键卡死"),
|
||||||
ERR_INSTRUCTION(12, "指令错误");
|
ERR_INSTRUCTION(12, "指令错误");
|
||||||
|
|
||||||
private Integer code;
|
private final Integer code;
|
||||||
private String desc;
|
private final String desc;
|
||||||
|
|
||||||
EtagSubCommandEnum(Integer code, String desc) {
|
EtagSubCommandEnum(Integer code, String desc) {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.desc = desc;
|
this.desc = desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static EtagSubCommandEnum getByCode(Integer code) {
|
||||||
|
for (EtagSubCommandEnum value : values()) {
|
||||||
|
if (value.code.equals(code)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
package org.wcs.mapper;
|
package org.wcs.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.wcs.model.po.app.AppEtagTask;
|
import org.wcs.model.po.app.AppEtagTask;
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface AppEtagTaskMapper extends BaseMapper<AppEtagTask> {
|
public interface AppEtagTaskMapper extends MPJBaseMapper<AppEtagTask> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,30 @@ public class AppEtagTagInfoDao extends ServiceImpl<AppEtagTagInfoMapper, AppEtag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略null参数查询
|
||||||
|
* @param appEtagTagInfo 查询参数
|
||||||
|
* @return 响应
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<AppEtagTagInfo> queryIgnoreNull(AppEtagTagInfo appEtagTagInfo) {
|
||||||
|
try {
|
||||||
|
LambdaQueryWrapper<AppEtagTagInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(appEtagTagInfo.getTagName() != null, AppEtagTagInfo::getTagName, appEtagTagInfo.getTagName());
|
||||||
|
queryWrapper.eq(appEtagTagInfo.getControllerId() != null, AppEtagTagInfo::getControllerId, appEtagTagInfo.getControllerId());
|
||||||
|
queryWrapper.eq(appEtagTagInfo.getTagId() != null, AppEtagTagInfo::getTagId, appEtagTagInfo.getTagId());
|
||||||
|
queryWrapper.eq(appEtagTagInfo.getTagType() != null, AppEtagTagInfo::getTagType, appEtagTagInfo.getTagType());
|
||||||
|
queryWrapper.eq(appEtagTagInfo.getBusinessType() != null, AppEtagTagInfo::getBusinessType, appEtagTagInfo.getBusinessType());
|
||||||
|
queryWrapper.eq(appEtagTagInfo.getAreaId() != null, AppEtagTagInfo::getAreaId, appEtagTagInfo.getAreaId());
|
||||||
|
queryWrapper.eq(appEtagTagInfo.getTunnelNo() != null, AppEtagTagInfo::getTunnelNo, appEtagTagInfo.getTunnelNo());
|
||||||
|
queryWrapper.eq(appEtagTagInfo.getRemark() != null, AppEtagTagInfo::getRemark, appEtagTagInfo.getRemark());
|
||||||
|
return baseMapper.selectList(queryWrapper);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加电子标签小标签信息
|
* 添加电子标签小标签信息
|
||||||
* @param appEtagTagInfo 添加参数
|
* @param appEtagTagInfo 添加参数
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.yulichang.query.MPJLambdaQueryWrapper;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.ibatis.executor.BatchResult;
|
import org.apache.ibatis.executor.BatchResult;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -12,6 +14,8 @@ import org.wcs.mapper.intf.AppEtagTaskService;
|
||||||
import org.wcs.model.bo.db.DataBaseActionResult;
|
import org.wcs.model.bo.db.DataBaseActionResult;
|
||||||
import org.wcs.model.bo.tuple.Tuple2;
|
import org.wcs.model.bo.tuple.Tuple2;
|
||||||
import org.wcs.model.dto.serve.etagTask.EtagTaskQueryReq;
|
import org.wcs.model.dto.serve.etagTask.EtagTaskQueryReq;
|
||||||
|
import org.wcs.model.po.app.AppEtagTagInfo;
|
||||||
|
import org.wcs.model.po.app.AppEtagTagLocation;
|
||||||
import org.wcs.model.po.app.AppEtagTask;
|
import org.wcs.model.po.app.AppEtagTask;
|
||||||
import org.wcs.utils.AppStringUtils;
|
import org.wcs.utils.AppStringUtils;
|
||||||
|
|
||||||
|
|
@ -155,4 +159,33 @@ public class AppEtagTaskDao extends ServiceImpl<AppEtagTaskMapper, AppEtagTask>
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据标签区域ID和状态查询任务
|
||||||
|
* @param areaId 标签区域ID
|
||||||
|
* @param vehicleNo 载具
|
||||||
|
* @param status 状态列表
|
||||||
|
* @return 任务列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<AppEtagTask> queryByTagAreaIdAndVehicleAndStatus(String areaId, String vehicleNo, List<Integer> status) {
|
||||||
|
if (AppStringUtils.isEmpty(areaId) || status == null || status.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MPJLambdaWrapper<AppEtagTask> queryWrapper = new MPJLambdaWrapper<>();
|
||||||
|
queryWrapper.selectAll(AppEtagTask.class);
|
||||||
|
queryWrapper.leftJoin(AppEtagTagLocation.class,
|
||||||
|
q -> q.eq(AppEtagTask::getLocation, AppEtagTagLocation::getLocation));
|
||||||
|
queryWrapper.leftJoin(AppEtagTagInfo.class,
|
||||||
|
q -> q.eq(AppEtagTagLocation::getTagName, AppEtagTagInfo::getTagName));
|
||||||
|
queryWrapper.eq(AppEtagTagInfo::getAreaId, areaId)
|
||||||
|
.eq(AppEtagTask::getVehicleNo, vehicleNo)
|
||||||
|
.in(AppEtagTask::getTaskStatus, status);
|
||||||
|
queryWrapper.orderByAsc(AppEtagTask::getCreateTime);
|
||||||
|
try {
|
||||||
|
return super.baseMapper.selectJoinList(AppEtagTask.class, queryWrapper);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ public interface AppEtagTagInfoService extends IService<AppEtagTagInfo> {
|
||||||
Tuple2<Long, List<AppEtagTagInfo>> queryEtagTagInfo(EtagTagInfoQueryReq request, Integer pageSize, Integer pageIndex);
|
Tuple2<Long, List<AppEtagTagInfo>> queryEtagTagInfo(EtagTagInfoQueryReq request, Integer pageSize, Integer pageIndex);
|
||||||
List<AppEtagTagInfo> queryEtagTagInfoByTagName(String tagName); // 通过标签名称查询
|
List<AppEtagTagInfo> queryEtagTagInfoByTagName(String tagName); // 通过标签名称查询
|
||||||
List<AppEtagTagInfo> queryAll(); // 查询所有
|
List<AppEtagTagInfo> queryAll(); // 查询所有
|
||||||
|
List<AppEtagTagInfo> queryIgnoreNull(AppEtagTagInfo appEtagTagInfo); // 忽略空字段查询
|
||||||
DataBaseActionResult<Integer> insert(AppEtagTagInfo appEtagTagInfo); // 添加电子标签小标签基础信息
|
DataBaseActionResult<Integer> insert(AppEtagTagInfo appEtagTagInfo); // 添加电子标签小标签基础信息
|
||||||
DataBaseActionResult<Integer> update(AppEtagTagInfo appEtagTagInfo); // 修改电子标签小标签基础信息
|
DataBaseActionResult<Integer> update(AppEtagTagInfo appEtagTagInfo); // 修改电子标签小标签基础信息
|
||||||
DataBaseActionResult<Integer> deleteByTagName(String tagName); // 删除电子标签小标签基础信息
|
DataBaseActionResult<Integer> deleteByTagName(String tagName); // 删除电子标签小标签基础信息
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,5 @@ public interface AppEtagTaskService extends IService<AppEtagTask> {
|
||||||
DataBaseActionResult<Integer> insert(List<AppEtagTask> appEtagTaskList); // 插入新数据
|
DataBaseActionResult<Integer> insert(List<AppEtagTask> appEtagTaskList); // 插入新数据
|
||||||
DataBaseActionResult<Integer> updateIgnoreNull(AppEtagTask appEtagTask); // 更新数据,忽略Null值
|
DataBaseActionResult<Integer> updateIgnoreNull(AppEtagTask appEtagTask); // 更新数据,忽略Null值
|
||||||
List<AppEtagTask> queryByTaskId(String taskId); // 通过任务ID查询
|
List<AppEtagTask> queryByTaskId(String taskId); // 通过任务ID查询
|
||||||
|
List<AppEtagTask> queryByTagAreaIdAndVehicleAndStatus(String areaId, String vehicleNo, List<Integer> status); // 通过标签区域ID和载具号和状态查询
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.wcs.model.bo.etag;
|
package org.wcs.model.bo.etag;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.wcs.constant.enums.etag.LedBlinkingEnum;
|
import org.wcs.constant.enums.etag.LedBlinkingEnum;
|
||||||
|
|
@ -9,6 +10,7 @@ import org.wcs.constant.enums.etag.LedColorEnum;
|
||||||
* 点亮标签参数
|
* 点亮标签参数
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
|
@Builder
|
||||||
public class EtagLightParams {
|
public class EtagLightParams {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -25,100 +27,27 @@ public class EtagLightParams {
|
||||||
/**
|
/**
|
||||||
* 标签值
|
* 标签值
|
||||||
*/
|
*/
|
||||||
private String tagValue;
|
@Builder.Default
|
||||||
|
private String tagValue = "888";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示标签字符串
|
* 显示标签字符串
|
||||||
*/
|
*/
|
||||||
private String tagString;
|
@Builder.Default
|
||||||
|
private String tagString = "未设置文本";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 闪烁频率
|
* 闪烁频率
|
||||||
*/
|
*/
|
||||||
private LedBlinkingEnum ledBlinking;
|
@Builder.Default
|
||||||
|
private LedBlinkingEnum ledBlinking = LedBlinkingEnum.BLINKING_0_25;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 灯颜色
|
* 灯颜色
|
||||||
*/
|
*/
|
||||||
private LedColorEnum ledColor;
|
@Builder.Default
|
||||||
|
private LedColorEnum ledColor = LedColorEnum.GREEN;
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建开始
|
|
||||||
* @return 新实例
|
|
||||||
*/
|
|
||||||
public static EtagLightParams buildStart() {
|
|
||||||
return new EtagLightParams();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置标签名称
|
|
||||||
* @param tagName 标签名称
|
|
||||||
* @return 设置结果
|
|
||||||
*/
|
|
||||||
public EtagLightParams tagName(String tagName) {
|
|
||||||
this.tagName = tagName;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置标签值
|
|
||||||
* @param tagValue 标签值
|
|
||||||
* @return 设置结果
|
|
||||||
*/
|
|
||||||
public EtagLightParams tagValue(String tagValue) {
|
|
||||||
this.tagValue = tagValue;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示标签字符串
|
|
||||||
* @param tagString 标签字符串
|
|
||||||
* @return 设置结果
|
|
||||||
*/
|
|
||||||
public EtagLightParams tagString(String tagString) {
|
|
||||||
this.tagString = tagString;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 闪烁频率
|
|
||||||
* @param ledBlinking 闪烁频率
|
|
||||||
* @return 设置结果
|
|
||||||
*/
|
|
||||||
public EtagLightParams ledBlinking(LedBlinkingEnum ledBlinking) {
|
|
||||||
this.ledBlinking = ledBlinking;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 灯颜色
|
|
||||||
* @param ledColor led颜色
|
|
||||||
* @return 设置结果
|
|
||||||
*/
|
|
||||||
public EtagLightParams ledColor(LedColorEnum ledColor) {
|
|
||||||
this.ledColor = ledColor;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建结束
|
|
||||||
* @return 构建结果
|
|
||||||
*/
|
|
||||||
public EtagLightParams buildEnd() {
|
|
||||||
if(this.tagValue == null) {
|
|
||||||
this.tagValue = "888";
|
|
||||||
}
|
|
||||||
if(this.tagString == null) {
|
|
||||||
this.tagString = "未设置文本";
|
|
||||||
}
|
|
||||||
if(this.ledBlinking == null) {
|
|
||||||
this.ledBlinking = LedBlinkingEnum.BLINKING_0_25;
|
|
||||||
}
|
|
||||||
if(this.ledColor == null) {
|
|
||||||
this.ledColor = LedColorEnum.GREEN;
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电子标签小标签基础信息
|
* 电子标签小标签基础信息
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@ToString
|
||||||
@TableName("t_app_etag_tag_info")
|
@TableName("t_app_etag_tag_info")
|
||||||
public class AppEtagTagInfo {
|
public class AppEtagTagInfo {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
package org.wcs.utils;
|
package org.wcs.utils;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
import org.springframework.transaction.TransactionDefinition;
|
import org.springframework.transaction.TransactionDefinition;
|
||||||
import org.springframework.transaction.TransactionStatus;
|
import org.springframework.transaction.TransactionStatus;
|
||||||
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||||
|
import org.wcs.utils.function.RunnableThrowEx;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AppDataBaseTransUtils {
|
public class AppDataBaseTransUtils {
|
||||||
|
|
@ -18,7 +21,7 @@ public class AppDataBaseTransUtils {
|
||||||
* @param baseTran 事务类
|
* @param baseTran 事务类
|
||||||
* @return 执行结果
|
* @return 执行结果
|
||||||
*/
|
*/
|
||||||
public boolean useTran(Runnable baseTran) {
|
public boolean useTran(RunnableThrowEx baseTran) {
|
||||||
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
||||||
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
|
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
|
||||||
TransactionStatus status = transactionManager.getTransaction(def);
|
TransactionStatus status = transactionManager.getTransaction(def);
|
||||||
|
|
@ -28,6 +31,7 @@ public class AppDataBaseTransUtils {
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
transactionManager.rollback(status);
|
transactionManager.rollback(status);
|
||||||
|
log.error("事务执行失败", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
package org.wcs.utils.function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支持异常抛出的函数
|
||||||
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface RunnableThrowEx {
|
||||||
|
void run() throws Exception;
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
wcs:
|
||||||
|
etag:
|
||||||
|
area-user-prefix: ^user$
|
||||||
|
area-user-unbind: $user^
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: wcs
|
name: wcs
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user