|
|
|
@ -1,9 +1,18 @@
|
|
|
|
|
package com.aucma.report.service.impl;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import com.aucma.common.utils.DateUtils;
|
|
|
|
|
import com.aucma.common.utils.uuid.UUID;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import com.aucma.common.utils.StringUtils;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import com.aucma.report.domain.DetailElectricalinspection;
|
|
|
|
@ -13,50 +22,48 @@ import com.aucma.report.service.IRecordElectricalInspectionService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 电检数据记录Service业务层处理
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @author Yinq
|
|
|
|
|
* @date 2023-11-09
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
public class RecordElectricalInspectionServiceImpl implements IRecordElectricalInspectionService
|
|
|
|
|
{
|
|
|
|
|
public class RecordElectricalInspectionServiceImpl implements IRecordElectricalInspectionService {
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(RecordElectricalInspectionServiceImpl.class);
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RecordElectricalInspectionMapper recordElectricalInspectionMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询电检数据记录
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @param uuid 电检数据记录主键
|
|
|
|
|
* @return 电检数据记录
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public RecordElectricalInspection selectRecordElectricalInspectionByUuid(String uuid)
|
|
|
|
|
{
|
|
|
|
|
public RecordElectricalInspection selectRecordElectricalInspectionByUuid(String uuid) {
|
|
|
|
|
return recordElectricalInspectionMapper.selectRecordElectricalInspectionByUuid(uuid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询电检数据记录列表
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @param recordElectricalInspection 电检数据记录
|
|
|
|
|
* @return 电检数据记录
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<RecordElectricalInspection> selectRecordElectricalInspectionList(RecordElectricalInspection recordElectricalInspection)
|
|
|
|
|
{
|
|
|
|
|
public List<RecordElectricalInspection> selectRecordElectricalInspectionList(RecordElectricalInspection recordElectricalInspection) {
|
|
|
|
|
return recordElectricalInspectionMapper.selectRecordElectricalInspectionList(recordElectricalInspection);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增电检数据记录
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @param recordElectricalInspection 电检数据记录
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Transactional
|
|
|
|
|
@Override
|
|
|
|
|
public int insertRecordElectricalInspection(RecordElectricalInspection recordElectricalInspection)
|
|
|
|
|
{
|
|
|
|
|
public int insertRecordElectricalInspection(RecordElectricalInspection recordElectricalInspection) {
|
|
|
|
|
int rows = recordElectricalInspectionMapper.insertRecordElectricalInspection(recordElectricalInspection);
|
|
|
|
|
insertDetailElectricalinspection(recordElectricalInspection);
|
|
|
|
|
return rows;
|
|
|
|
@ -64,14 +71,13 @@ public class RecordElectricalInspectionServiceImpl implements IRecordElectricalI
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 修改电检数据记录
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @param recordElectricalInspection 电检数据记录
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Transactional
|
|
|
|
|
@Override
|
|
|
|
|
public int updateRecordElectricalInspection(RecordElectricalInspection recordElectricalInspection)
|
|
|
|
|
{
|
|
|
|
|
public int updateRecordElectricalInspection(RecordElectricalInspection recordElectricalInspection) {
|
|
|
|
|
recordElectricalInspectionMapper.deleteDetailElectricalinspectionByUuid(recordElectricalInspection.getUuid());
|
|
|
|
|
insertDetailElectricalinspection(recordElectricalInspection);
|
|
|
|
|
return recordElectricalInspectionMapper.updateRecordElectricalInspection(recordElectricalInspection);
|
|
|
|
@ -79,53 +85,99 @@ public class RecordElectricalInspectionServiceImpl implements IRecordElectricalI
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量删除电检数据记录
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @param uuids 需要删除的电检数据记录主键
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Transactional
|
|
|
|
|
@Override
|
|
|
|
|
public int deleteRecordElectricalInspectionByUuids(String[] uuids)
|
|
|
|
|
{
|
|
|
|
|
public int deleteRecordElectricalInspectionByUuids(String[] uuids) {
|
|
|
|
|
recordElectricalInspectionMapper.deleteDetailElectricalinspectionByUuids(uuids);
|
|
|
|
|
return recordElectricalInspectionMapper.deleteRecordElectricalInspectionByUuids(uuids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除电检数据记录信息
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @param uuid 电检数据记录主键
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Transactional
|
|
|
|
|
@Override
|
|
|
|
|
public int deleteRecordElectricalInspectionByUuid(String uuid)
|
|
|
|
|
{
|
|
|
|
|
public int deleteRecordElectricalInspectionByUuid(String uuid) {
|
|
|
|
|
recordElectricalInspectionMapper.deleteDetailElectricalinspectionByUuid(uuid);
|
|
|
|
|
return recordElectricalInspectionMapper.deleteRecordElectricalInspectionByUuid(uuid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增电检数据明细信息
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @param recordElectricalInspection 电检数据记录对象
|
|
|
|
|
*/
|
|
|
|
|
public void insertDetailElectricalinspection(RecordElectricalInspection recordElectricalInspection)
|
|
|
|
|
{
|
|
|
|
|
public void insertDetailElectricalinspection(RecordElectricalInspection recordElectricalInspection) {
|
|
|
|
|
List<DetailElectricalinspection> detailElectricalinspectionList = recordElectricalInspection.getDetailElectricalinspectionList();
|
|
|
|
|
String uuid = recordElectricalInspection.getUuid();
|
|
|
|
|
if (StringUtils.isNotNull(detailElectricalinspectionList))
|
|
|
|
|
{
|
|
|
|
|
if (StringUtils.isNotNull(detailElectricalinspectionList)) {
|
|
|
|
|
List<DetailElectricalinspection> list = new ArrayList<DetailElectricalinspection>();
|
|
|
|
|
for (DetailElectricalinspection detailElectricalinspection : detailElectricalinspectionList)
|
|
|
|
|
{
|
|
|
|
|
for (DetailElectricalinspection detailElectricalinspection : detailElectricalinspectionList) {
|
|
|
|
|
detailElectricalinspection.setUuid(uuid);
|
|
|
|
|
list.add(detailElectricalinspection);
|
|
|
|
|
}
|
|
|
|
|
if (list.size() > 0)
|
|
|
|
|
{
|
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
recordElectricalInspectionMapper.batchDetailElectricalinspection(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 解析电检数据接口
|
|
|
|
|
*
|
|
|
|
|
* @param paramMap
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public HashMap<String, String> analysisElectricalInspectionData(Map paramMap) {
|
|
|
|
|
HashMap<String, String> resultData = new HashMap<>();
|
|
|
|
|
RecordElectricalInspection inspection = new RecordElectricalInspection();
|
|
|
|
|
String uuid = String.valueOf(paramMap.get("uuid"));
|
|
|
|
|
try {
|
|
|
|
|
String result = String.valueOf(paramMap.get("result"));
|
|
|
|
|
String barcode = String.valueOf(paramMap.get("barcode"));
|
|
|
|
|
String testdata = String.valueOf(paramMap.get("testdata"));
|
|
|
|
|
String testtime = String.valueOf(paramMap.get("testtime"));
|
|
|
|
|
inspection.setUuid(UUID.randomUUID().toString());
|
|
|
|
|
inspection.setResult(result);
|
|
|
|
|
inspection.setBarcode(barcode);
|
|
|
|
|
if (StringUtils.isNull(testtime)) {
|
|
|
|
|
testtime = DateUtils.dateTime();
|
|
|
|
|
}
|
|
|
|
|
inspection.setTestTime(testtime);
|
|
|
|
|
inspection.setTestData(uuid);
|
|
|
|
|
inspection.setRecordTime(DateUtils.getNowDate());
|
|
|
|
|
recordElectricalInspectionMapper.insertRecordElectricalInspection(inspection);
|
|
|
|
|
String[] testDataEntries = testdata.split(";");
|
|
|
|
|
for (String testDataEntry : testDataEntries) {
|
|
|
|
|
String[] testDataParts = testDataEntry.split("\\|");
|
|
|
|
|
if (testDataParts.length == 5) {
|
|
|
|
|
DetailElectricalinspection testData = new DetailElectricalinspection();
|
|
|
|
|
testData.setUuid(uuid);
|
|
|
|
|
testData.setSerialnumber(Long.parseLong(testDataParts[0]));
|
|
|
|
|
testData.setProjectname(testDataParts[1]);
|
|
|
|
|
testData.setTestcondition(testDataParts[2]);
|
|
|
|
|
testData.setTestvalue(testDataParts[3]);
|
|
|
|
|
testData.setTestresult(testDataParts[4]);
|
|
|
|
|
testData.setRecordtime(DateUtils.getNowDate());
|
|
|
|
|
recordElectricalInspectionMapper.insertDetailElectricalinspection(testData);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("解析电检数据接口数据:" + paramMap.toString() + ";异常:" + e);
|
|
|
|
|
}
|
|
|
|
|
resultData.put("uuid", uuid);
|
|
|
|
|
resultData.put("answer", "OK");
|
|
|
|
|
return resultData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|