|
|
|
@ -1,11 +1,13 @@
|
|
|
|
|
package hw.tagApi.service.service.impl;
|
|
|
|
|
|
|
|
|
|
import hw.tagApi.common.exception.ServiceException;
|
|
|
|
|
import hw.tagApi.common.utils.uuid.IdGenerator;
|
|
|
|
|
import hw.tagApi.service.service.IHwTagRecordService;
|
|
|
|
|
import hw.tagApi.service.service.IKDocsService;
|
|
|
|
|
import hw.tagApi.service.utils.TagExcelUtil;
|
|
|
|
|
import hw.tagApi.service.utils.httpClientUtils;
|
|
|
|
|
|
|
|
|
|
import java.rmi.server.ServerCloneException;
|
|
|
|
|
import java.time.Duration;
|
|
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -15,6 +17,7 @@ import java.io.*;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import hw.tagApi.service.constant.ApiConstants;
|
|
|
|
|
import hw.tagApi.service.domain.HwTagRecord;
|
|
|
|
@ -26,6 +29,8 @@ import hw.tagApi.service.domain.ApiContent;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import static hw.tagApi.service.utils.TagExcelUtil.startsWithCheck;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 云文档服务实现类
|
|
|
|
|
*
|
|
|
|
@ -76,7 +81,7 @@ public class KDocsServiceImpl implements IKDocsService {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("导入任务执行失败: {}", e.getMessage(), e);
|
|
|
|
|
Map<String, Object> errorFields = new HashMap<>();
|
|
|
|
|
errorFields.put(ApiConstants.IMPORT_STATUS, "系统错误");
|
|
|
|
|
errorFields.put(ApiConstants.IMPORT_STATUS, "导入失败");
|
|
|
|
|
errorFields.put(ApiConstants.DESCRIPTION, "导入任务执行失败: " + e.getMessage());
|
|
|
|
|
resContent.setFields(errorFields);
|
|
|
|
|
}
|
|
|
|
@ -127,9 +132,16 @@ public class KDocsServiceImpl implements IKDocsService {
|
|
|
|
|
String fileUrl = String.valueOf(fields.get("文件链接"));
|
|
|
|
|
String fileName = String.valueOf(fields.getOrDefault("文件名", ""));
|
|
|
|
|
String TIDCheck = String.valueOf(fields.getOrDefault("TID校验", ""));
|
|
|
|
|
int charCount = TIDCheck.length();
|
|
|
|
|
String EPCCheck = String.valueOf(fields.getOrDefault("EPC校验", ""));
|
|
|
|
|
String EPCNumberCheck = String.valueOf(fields.getOrDefault("EPC位数校验", "0"));
|
|
|
|
|
int EPCNumberCheckLength = Integer.parseInt(EPCNumberCheck);
|
|
|
|
|
int tidCharCount = TIDCheck.length();
|
|
|
|
|
int epcCharCount = EPCCheck.length();
|
|
|
|
|
List<HwTagRecord> batchList = new ArrayList<>();
|
|
|
|
|
Map<String, Object> resFields = new HashMap<>();
|
|
|
|
|
List<String> errorMessages = new ArrayList<>();
|
|
|
|
|
int successCount = 0;
|
|
|
|
|
int failCount = 0;
|
|
|
|
|
apiContent.setFields(resFields);
|
|
|
|
|
try {
|
|
|
|
|
log.info("开始处理文件,URL: {}", fileUrl);
|
|
|
|
@ -157,72 +169,138 @@ public class KDocsServiceImpl implements IKDocsService {
|
|
|
|
|
List<Map<String, String>> tagList = (List<Map<String, String>>) excelResult.get("tagList");
|
|
|
|
|
// 批量处理标签数据
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
for (Map<String, String> tagData : tagList) {
|
|
|
|
|
String tid = tagData.get("TID").replace("-", "");
|
|
|
|
|
String epc = tagData.get("EPC").replace("-", "");
|
|
|
|
|
if (tid.length() != 24) {
|
|
|
|
|
String errorMsg = String.format("TID长度校验失败!预期长度:24,实际长度:%d,TID值:%s", tid.length(), tid);
|
|
|
|
|
log.error("TID长度校验异常 - {}", errorMsg);
|
|
|
|
|
resFields.put(ApiConstants.IMPORT_STATUS, "导入失败");
|
|
|
|
|
resFields.put(ApiConstants.DESCRIPTION, "TID长度不符合要求:" + errorMsg);
|
|
|
|
|
return apiContent;
|
|
|
|
|
}
|
|
|
|
|
if (charCount > 0 && !startsWithCheck(tid, TIDCheck)) {
|
|
|
|
|
String errorMsg = String.format("TID校验失败!TID校验:%s,实际TID:%s", TIDCheck, tid);
|
|
|
|
|
log.error("TID校验异常 - {}", errorMsg);
|
|
|
|
|
resFields.put(ApiConstants.IMPORT_STATUS, "导入失败");
|
|
|
|
|
resFields.put(ApiConstants.DESCRIPTION, "TID校验不符合要求:" + errorMsg);
|
|
|
|
|
return apiContent;
|
|
|
|
|
}
|
|
|
|
|
HwTagRecord record = new HwTagRecord();
|
|
|
|
|
record.setOrderCode(orderInfo.get("orderNo"));
|
|
|
|
|
record.setBatchNumber(orderInfo.get("batchNo"));
|
|
|
|
|
record.setOperatorId(orderInfo.get("operatorId"));
|
|
|
|
|
record.setProcessingTime(sdf.parse(orderInfo.get("processTime")));
|
|
|
|
|
record.setTotalQuantity(Long.valueOf(orderInfo.get("totalCount")));
|
|
|
|
|
// 设置标签数据
|
|
|
|
|
record.setModelCode(model);
|
|
|
|
|
record.setTagSequence(tagData.get("序号"));
|
|
|
|
|
record.setTId(tid);
|
|
|
|
|
record.setEpc(epc);
|
|
|
|
|
record.setPassword(tagData.get("密码"));
|
|
|
|
|
record.setTestResult(tagData.get("测试结果"));
|
|
|
|
|
record.setTestValue(tagData.get("测试值"));
|
|
|
|
|
record.setReferenceValue(tagData.get("参考值"));
|
|
|
|
|
record.setTestingTime(sdf.parse(tagData.get("测试时间")));
|
|
|
|
|
record.setFileName(fileName);
|
|
|
|
|
|
|
|
|
|
// 达到批量大小时执行插入
|
|
|
|
|
if ("更新".equals(importMode)) {
|
|
|
|
|
tagRecordService.updateHwTagRecordByTID(record);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
//校验tId唯一
|
|
|
|
|
HwTagRecord tagRecord = tagRecordService.selectHwTagRecordByTID(record.getTId());
|
|
|
|
|
if (tagRecord != null) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
record.setRId(IdGenerator.nextId());
|
|
|
|
|
// 添加到批处理列表
|
|
|
|
|
batchList.add(record);
|
|
|
|
|
if (batchList.size() >= BATCH_SIZE) {
|
|
|
|
|
tagRecordService.batchInsertHwTagRecord(batchList);
|
|
|
|
|
log.info("批量插入{}条数据成功", batchList.size());
|
|
|
|
|
batchList.clear();
|
|
|
|
|
// 如果不是更新模式,先批量查询所有TID
|
|
|
|
|
Set<String> existingTids = new HashSet<>();
|
|
|
|
|
boolean tIdFlag = ApiConstants.MODE_ADD.equals(importMode) || ApiConstants.MODE_ADD_NO_CHECK.equals(importMode);
|
|
|
|
|
if (tIdFlag) {
|
|
|
|
|
List<String> allTids = tagList.stream()
|
|
|
|
|
.map(tag -> tag.get("TID").replace("-", ""))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
existingTids = tagRecordService.selectExistingTids(allTids);
|
|
|
|
|
}
|
|
|
|
|
// 如果不是更新模式,批量查询所有EPC
|
|
|
|
|
Set<String> existingEpcs = new HashSet<>();
|
|
|
|
|
boolean epcCheckFlag = ApiConstants.MODE_ADD.equals(importMode) || ApiConstants.MODE_UPDATE.equals(importMode);
|
|
|
|
|
if (epcCheckFlag) {
|
|
|
|
|
List<String> allEpcs = tagList.stream()
|
|
|
|
|
.map(tag -> tag.get("EPC").replace("-", ""))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
existingEpcs = tagRecordService.selectExistingEpcs(allEpcs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Map<String, String> tagData : tagList) {
|
|
|
|
|
try {
|
|
|
|
|
String tid = tagData.get("TID").replace("-", "");
|
|
|
|
|
String epc = tagData.get("EPC").replace("-", "");
|
|
|
|
|
if (tid.length() != ApiConstants.TE_LENGTH || (EPCNumberCheckLength > 0 && epc.length() != EPCNumberCheckLength)) {
|
|
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
|
|
if (tid.length() != ApiConstants.TE_LENGTH) {
|
|
|
|
|
String errorMsg = String.format("TID长度校验失败!预期长度:24,实际长度:%d,TID值:%s", tid.length(), tid);
|
|
|
|
|
builder.append(errorMsg);
|
|
|
|
|
log.error("异常 - {}", errorMsg);
|
|
|
|
|
}
|
|
|
|
|
if (EPCNumberCheckLength > 0 && epc.length() != EPCNumberCheckLength) {
|
|
|
|
|
String errorMsg = String.format("EPC长度校验失败!预期长度:24,实际长度:%d,EPC值:%s", epc.length(), epc);
|
|
|
|
|
builder.append(errorMsg);
|
|
|
|
|
log.error("EPC长度校验异常 - {}", errorMsg);
|
|
|
|
|
}
|
|
|
|
|
errorMessages.add(builder.toString());
|
|
|
|
|
failCount++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (tidCharCount > 0 && !startsWithCheck(tid, TIDCheck)) {
|
|
|
|
|
String errorMsg = String.format("TID校验失败!TID校验:%s,实际TID:%s", TIDCheck, tid);
|
|
|
|
|
log.error("TID校验异常 - {}", errorMsg);
|
|
|
|
|
errorMessages.add(errorMsg);
|
|
|
|
|
failCount++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (epcCharCount > 0 && !startsWithCheck(epc, EPCCheck)) {
|
|
|
|
|
String errorMsg = String.format("EPC校验失败!EPC校验:%s,实际EPC:%s", EPCCheck, epc);
|
|
|
|
|
log.error("EPC校验异常 - {}", errorMsg);
|
|
|
|
|
errorMessages.add(errorMsg);
|
|
|
|
|
failCount++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
HwTagRecord record = new HwTagRecord();
|
|
|
|
|
record.setOrderCode(orderInfo.get("orderNo"));
|
|
|
|
|
record.setBatchNumber(orderInfo.get("batchNo"));
|
|
|
|
|
record.setOperatorId(orderInfo.get("operatorId"));
|
|
|
|
|
record.setProcessingTime(sdf.parse(orderInfo.get("processTime")));
|
|
|
|
|
record.setTotalQuantity(Long.valueOf(orderInfo.get("totalCount")));
|
|
|
|
|
// 设置标签数据
|
|
|
|
|
record.setModelCode(model);
|
|
|
|
|
record.setTagSequence(tagData.get("序号"));
|
|
|
|
|
record.setTId(tid);
|
|
|
|
|
record.setEpc(epc);
|
|
|
|
|
record.setPassword(tagData.get("密码"));
|
|
|
|
|
record.setTestResult(tagData.get("测试结果"));
|
|
|
|
|
record.setTestValue(tagData.get("测试值"));
|
|
|
|
|
record.setReferenceValue(tagData.get("参考值"));
|
|
|
|
|
record.setTestingTime(sdf.parse(tagData.get("测试时间")));
|
|
|
|
|
record.setFileName(fileName);
|
|
|
|
|
|
|
|
|
|
//校验tId唯一
|
|
|
|
|
if (tIdFlag && existingTids.contains(tid)) {
|
|
|
|
|
String errorMsg = String.format("TID已存在:%s", tid);
|
|
|
|
|
log.error(errorMsg);
|
|
|
|
|
errorMessages.add(errorMsg);
|
|
|
|
|
failCount++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
//校验EPC唯一
|
|
|
|
|
if (epcCheckFlag && existingEpcs.contains(epc)) {
|
|
|
|
|
String errorMsg = String.format("EPC已存在:%s", epc);
|
|
|
|
|
log.error(errorMsg);
|
|
|
|
|
errorMessages.add(errorMsg);
|
|
|
|
|
failCount++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// 更新方法
|
|
|
|
|
if ((ApiConstants.MODE_UPDATE.equals(importMode) || ApiConstants.MODE_UPDATE_NO_CHECK.equals(importMode)) && failCount == 0) {
|
|
|
|
|
tagRecordService.updateHwTagRecordByTID(record);
|
|
|
|
|
successCount++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
record.setRId(IdGenerator.nextId());
|
|
|
|
|
// 添加到批处理列表
|
|
|
|
|
batchList.add(record);
|
|
|
|
|
// 达到批量大小时执行插入
|
|
|
|
|
if (batchList.size() >= BATCH_SIZE && failCount == 0) {
|
|
|
|
|
tagRecordService.batchInsertHwTagRecord(batchList);
|
|
|
|
|
log.info("批量插入{}条数据成功", batchList.size());
|
|
|
|
|
successCount += batchList.size();
|
|
|
|
|
batchList.clear();
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
String errorMsg = String.format("处理数据失败:%s", e.getMessage());
|
|
|
|
|
log.error(errorMsg);
|
|
|
|
|
errorMessages.add(errorMsg);
|
|
|
|
|
failCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 处理剩余的数据
|
|
|
|
|
if (!batchList.isEmpty()) {
|
|
|
|
|
if (!batchList.isEmpty() && failCount == 0) {
|
|
|
|
|
tagRecordService.batchInsertHwTagRecord(batchList);
|
|
|
|
|
log.info("批量插入剩余{}条数据成功", batchList.size());
|
|
|
|
|
successCount += batchList.size();
|
|
|
|
|
batchList.clear();
|
|
|
|
|
}
|
|
|
|
|
resFields.put(ApiConstants.IMPORT_STATUS, "导入完成");
|
|
|
|
|
|
|
|
|
|
// 设置导入结果
|
|
|
|
|
if (failCount > 0) {
|
|
|
|
|
throw new ServiceException(String.format(importMode + "失败:%d条。失败原因:%s",
|
|
|
|
|
failCount, String.join("; ", errorMessages)));
|
|
|
|
|
} else {
|
|
|
|
|
resFields.put(ApiConstants.IMPORT_STATUS, "导入成功");
|
|
|
|
|
resFields.put(ApiConstants.DESCRIPTION, String.format("成功导入%d条数据", successCount));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("处理文件失败: {}", e.getMessage(), e);
|
|
|
|
|
resFields.put(ApiConstants.IMPORT_STATUS, "系统错误");
|
|
|
|
|
resFields.put(ApiConstants.IMPORT_STATUS, "导入失败");
|
|
|
|
|
resFields.put(ApiConstants.DESCRIPTION, e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -275,8 +353,8 @@ public class KDocsServiceImpl implements IKDocsService {
|
|
|
|
|
// 检查查询条件
|
|
|
|
|
if (!fields.containsKey("TID") && !fields.containsKey("EPC")) {
|
|
|
|
|
log.warn("查询条件错误 - ID: {}, 缺少必要的查询参数(TID或EPC)", queryId);
|
|
|
|
|
response.getFields().put("搜索状态", "查询条件错误");
|
|
|
|
|
response.getFields().put("情况说明", "查询条件必须包含TID或EPC");
|
|
|
|
|
response.getFields().put(ApiConstants.SELECT_STATUS, "系统错误");
|
|
|
|
|
response.getFields().put(ApiConstants.DESCRIPTION, "查询条件必须包含TID或EPC");
|
|
|
|
|
result.add(response);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -310,7 +388,12 @@ public class KDocsServiceImpl implements IKDocsService {
|
|
|
|
|
if (data != null) {
|
|
|
|
|
log.info("查询成功 - ID: {}, TID: {}, EPC: {}", queryId, data.getTId(), data.getEpc());
|
|
|
|
|
// 查询成功
|
|
|
|
|
response.getFields().put("搜索状态", "搜索成功");
|
|
|
|
|
if (data.getQueryResultsNumber() > 1){
|
|
|
|
|
response.getFields().put(ApiConstants.SELECT_STATUS, "系统错误");
|
|
|
|
|
response.getFields().put(ApiConstants.DESCRIPTION, "存在多个记录,请使用数据导出功能");
|
|
|
|
|
} else {
|
|
|
|
|
response.getFields().put(ApiConstants.SELECT_STATUS, "搜索成功");
|
|
|
|
|
}
|
|
|
|
|
response.getFields().put("TID", data.getTId());
|
|
|
|
|
response.getFields().put("EPC", data.getEpc());
|
|
|
|
|
response.getFields().put("标签序号", data.getTagSequence());
|
|
|
|
@ -327,15 +410,15 @@ public class KDocsServiceImpl implements IKDocsService {
|
|
|
|
|
} else {
|
|
|
|
|
log.info("未找到记录 - ID: {}", queryId);
|
|
|
|
|
// 未找到记录
|
|
|
|
|
response.getFields().put("搜索状态", "未找到记录");
|
|
|
|
|
response.getFields().put(ApiConstants.SELECT_STATUS, "未找到记录");
|
|
|
|
|
if (fields.containsKey("搜索日期起点") && fields.containsKey("搜索日期终点")) {
|
|
|
|
|
String message = String.format("已遍历整个数据库,生产日期从%s到%s,未查询到该TID。",
|
|
|
|
|
String message = String.format("已遍历整个数据库,生产日期从%s到%s,未找到匹配的记录。",
|
|
|
|
|
fields.get("搜索日期起点"), fields.get("搜索日期终点"));
|
|
|
|
|
response.getFields().put("情况说明", message);
|
|
|
|
|
response.getFields().put(ApiConstants.DESCRIPTION, message);
|
|
|
|
|
log.debug("未找到记录详情 - ID: {}, 日期范围: {} - {}",
|
|
|
|
|
queryId, fields.get("搜索日期起点"), fields.get("搜索日期终点"));
|
|
|
|
|
} else {
|
|
|
|
|
response.getFields().put("情况说明", "未找到匹配的记录");
|
|
|
|
|
response.getFields().put(ApiConstants.DESCRIPTION, "未找到匹配的记录");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -364,8 +447,8 @@ public class KDocsServiceImpl implements IKDocsService {
|
|
|
|
|
ApiContent response = new ApiContent();
|
|
|
|
|
response.setId(condition.getId());
|
|
|
|
|
Map<String, Object> responseFields = new HashMap<>();
|
|
|
|
|
responseFields.put("导出状态", "导出中");
|
|
|
|
|
responseFields.put("情况说明", "预计需要3分钟");
|
|
|
|
|
responseFields.put(ApiConstants.EXPORT_STATUS, "导出中");
|
|
|
|
|
responseFields.put(ApiConstants.DESCRIPTION, "预计需要3分钟");
|
|
|
|
|
response.setFields(responseFields);
|
|
|
|
|
result.add(response);
|
|
|
|
|
}
|
|
|
|
@ -432,19 +515,19 @@ public class KDocsServiceImpl implements IKDocsService {
|
|
|
|
|
Date futureDate = new Date(endTime + ApiConstants.PASS_TIME);
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
|
|
|
|
log.info("数据库导出完成 - ID: {}, 记录数: {}, 耗时: {}分{}秒", condition.getId(), records.size(), minutes, seconds);
|
|
|
|
|
responseFields.put("导出状态", "导出成功");
|
|
|
|
|
responseFields.put("情况说明", "耗时: " + minutes + "分" + seconds + "秒");
|
|
|
|
|
responseFields.put(ApiConstants.EXPORT_STATUS, "导出成功");
|
|
|
|
|
responseFields.put(ApiConstants.DESCRIPTION, "耗时: " + minutes + "分" + seconds + "秒");
|
|
|
|
|
responseFields.put("文件路径", filePath);
|
|
|
|
|
responseFields.put("链接有效期", sdf.format(futureDate));
|
|
|
|
|
log.info("导出文件生成成功 - ID: {}, 路径: {}", condition.getId(), filePath);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("生成导出文件失败 - ID: {}", condition.getId(), e);
|
|
|
|
|
responseFields.put("导出状态", "导出失败");
|
|
|
|
|
responseFields.put("情况说明", "生成导出文件失败: " + e.getMessage());
|
|
|
|
|
responseFields.put(ApiConstants.EXPORT_STATUS, "导出失败");
|
|
|
|
|
responseFields.put(ApiConstants.DESCRIPTION, "生成导出文件失败: " + e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
responseFields.put("导出状态", "未找到记录");
|
|
|
|
|
responseFields.put("情况说明", "未找到符合条件的记录");
|
|
|
|
|
responseFields.put(ApiConstants.EXPORT_STATUS, "未找到记录");
|
|
|
|
|
responseFields.put(ApiConstants.DESCRIPTION, "未找到符合条件的记录");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
response.setFields(responseFields);
|
|
|
|
@ -453,8 +536,8 @@ public class KDocsServiceImpl implements IKDocsService {
|
|
|
|
|
log.error("处理导出任务失败 - ID: {}", condition.getId(), e);
|
|
|
|
|
response.setId(condition.getId());
|
|
|
|
|
Map<String, Object> responseFields = new HashMap<>();
|
|
|
|
|
responseFields.put("导出状态", "导出失败");
|
|
|
|
|
responseFields.put("情况说明", "处理导出任务失败: " + e.getMessage());
|
|
|
|
|
responseFields.put(ApiConstants.EXPORT_STATUS, "导出失败");
|
|
|
|
|
responseFields.put(ApiConstants.DESCRIPTION, "处理导出任务失败: " + e.getMessage());
|
|
|
|
|
response.setFields(responseFields);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -467,19 +550,7 @@ public class KDocsServiceImpl implements IKDocsService {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static boolean startsWithCheck(String tid, String TIDCheck) {
|
|
|
|
|
if (tid == null || TIDCheck == null || tid.length() < TIDCheck.length()) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
char[] tidChars = tid.toCharArray();
|
|
|
|
|
char[] checkChars = TIDCheck.toCharArray();
|
|
|
|
|
for (int i = 0; i < checkChars.length; i++) {
|
|
|
|
|
if (tidChars[i] != checkChars[i]) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|