|
|
@ -1,9 +1,18 @@
|
|
|
|
package com.aucma.report.service.impl;
|
|
|
|
package com.aucma.report.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
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.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
import com.aucma.common.utils.StringUtils;
|
|
|
|
import com.aucma.common.utils.StringUtils;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import com.aucma.report.domain.DetailElectricalinspection;
|
|
|
|
import com.aucma.report.domain.DetailElectricalinspection;
|
|
|
@ -18,8 +27,9 @@ import com.aucma.report.service.IRecordElectricalInspectionService;
|
|
|
|
* @date 2023-11-09
|
|
|
|
* @date 2023-11-09
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
public class RecordElectricalInspectionServiceImpl implements IRecordElectricalInspectionService
|
|
|
|
public class RecordElectricalInspectionServiceImpl implements IRecordElectricalInspectionService {
|
|
|
|
{
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(RecordElectricalInspectionServiceImpl.class);
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private RecordElectricalInspectionMapper recordElectricalInspectionMapper;
|
|
|
|
private RecordElectricalInspectionMapper recordElectricalInspectionMapper;
|
|
|
|
|
|
|
|
|
|
|
@ -30,8 +40,7 @@ public class RecordElectricalInspectionServiceImpl implements IRecordElectricalI
|
|
|
|
* @return 电检数据记录
|
|
|
|
* @return 电检数据记录
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public RecordElectricalInspection selectRecordElectricalInspectionByUuid(String uuid)
|
|
|
|
public RecordElectricalInspection selectRecordElectricalInspectionByUuid(String uuid) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return recordElectricalInspectionMapper.selectRecordElectricalInspectionByUuid(uuid);
|
|
|
|
return recordElectricalInspectionMapper.selectRecordElectricalInspectionByUuid(uuid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -42,8 +51,7 @@ public class RecordElectricalInspectionServiceImpl implements IRecordElectricalI
|
|
|
|
* @return 电检数据记录
|
|
|
|
* @return 电检数据记录
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<RecordElectricalInspection> selectRecordElectricalInspectionList(RecordElectricalInspection recordElectricalInspection)
|
|
|
|
public List<RecordElectricalInspection> selectRecordElectricalInspectionList(RecordElectricalInspection recordElectricalInspection) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return recordElectricalInspectionMapper.selectRecordElectricalInspectionList(recordElectricalInspection);
|
|
|
|
return recordElectricalInspectionMapper.selectRecordElectricalInspectionList(recordElectricalInspection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -55,8 +63,7 @@ public class RecordElectricalInspectionServiceImpl implements IRecordElectricalI
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int insertRecordElectricalInspection(RecordElectricalInspection recordElectricalInspection)
|
|
|
|
public int insertRecordElectricalInspection(RecordElectricalInspection recordElectricalInspection) {
|
|
|
|
{
|
|
|
|
|
|
|
|
int rows = recordElectricalInspectionMapper.insertRecordElectricalInspection(recordElectricalInspection);
|
|
|
|
int rows = recordElectricalInspectionMapper.insertRecordElectricalInspection(recordElectricalInspection);
|
|
|
|
insertDetailElectricalinspection(recordElectricalInspection);
|
|
|
|
insertDetailElectricalinspection(recordElectricalInspection);
|
|
|
|
return rows;
|
|
|
|
return rows;
|
|
|
@ -70,8 +77,7 @@ public class RecordElectricalInspectionServiceImpl implements IRecordElectricalI
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int updateRecordElectricalInspection(RecordElectricalInspection recordElectricalInspection)
|
|
|
|
public int updateRecordElectricalInspection(RecordElectricalInspection recordElectricalInspection) {
|
|
|
|
{
|
|
|
|
|
|
|
|
recordElectricalInspectionMapper.deleteDetailElectricalinspectionByUuid(recordElectricalInspection.getUuid());
|
|
|
|
recordElectricalInspectionMapper.deleteDetailElectricalinspectionByUuid(recordElectricalInspection.getUuid());
|
|
|
|
insertDetailElectricalinspection(recordElectricalInspection);
|
|
|
|
insertDetailElectricalinspection(recordElectricalInspection);
|
|
|
|
return recordElectricalInspectionMapper.updateRecordElectricalInspection(recordElectricalInspection);
|
|
|
|
return recordElectricalInspectionMapper.updateRecordElectricalInspection(recordElectricalInspection);
|
|
|
@ -85,8 +91,7 @@ public class RecordElectricalInspectionServiceImpl implements IRecordElectricalI
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int deleteRecordElectricalInspectionByUuids(String[] uuids)
|
|
|
|
public int deleteRecordElectricalInspectionByUuids(String[] uuids) {
|
|
|
|
{
|
|
|
|
|
|
|
|
recordElectricalInspectionMapper.deleteDetailElectricalinspectionByUuids(uuids);
|
|
|
|
recordElectricalInspectionMapper.deleteDetailElectricalinspectionByUuids(uuids);
|
|
|
|
return recordElectricalInspectionMapper.deleteRecordElectricalInspectionByUuids(uuids);
|
|
|
|
return recordElectricalInspectionMapper.deleteRecordElectricalInspectionByUuids(uuids);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -99,33 +104,80 @@ public class RecordElectricalInspectionServiceImpl implements IRecordElectricalI
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int deleteRecordElectricalInspectionByUuid(String uuid)
|
|
|
|
public int deleteRecordElectricalInspectionByUuid(String uuid) {
|
|
|
|
{
|
|
|
|
|
|
|
|
recordElectricalInspectionMapper.deleteDetailElectricalinspectionByUuid(uuid);
|
|
|
|
recordElectricalInspectionMapper.deleteDetailElectricalinspectionByUuid(uuid);
|
|
|
|
return recordElectricalInspectionMapper.deleteRecordElectricalInspectionByUuid(uuid);
|
|
|
|
return recordElectricalInspectionMapper.deleteRecordElectricalInspectionByUuid(uuid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 新增电检数据明细信息
|
|
|
|
* 新增电检数据明细信息
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param recordElectricalInspection 电检数据记录对象
|
|
|
|
* @param recordElectricalInspection 电检数据记录对象
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void insertDetailElectricalinspection(RecordElectricalInspection recordElectricalInspection)
|
|
|
|
public void insertDetailElectricalinspection(RecordElectricalInspection recordElectricalInspection) {
|
|
|
|
{
|
|
|
|
|
|
|
|
List<DetailElectricalinspection> detailElectricalinspectionList = recordElectricalInspection.getDetailElectricalinspectionList();
|
|
|
|
List<DetailElectricalinspection> detailElectricalinspectionList = recordElectricalInspection.getDetailElectricalinspectionList();
|
|
|
|
String uuid = recordElectricalInspection.getUuid();
|
|
|
|
String uuid = recordElectricalInspection.getUuid();
|
|
|
|
if (StringUtils.isNotNull(detailElectricalinspectionList))
|
|
|
|
if (StringUtils.isNotNull(detailElectricalinspectionList)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
List<DetailElectricalinspection> list = new ArrayList<DetailElectricalinspection>();
|
|
|
|
List<DetailElectricalinspection> list = new ArrayList<DetailElectricalinspection>();
|
|
|
|
for (DetailElectricalinspection detailElectricalinspection : detailElectricalinspectionList)
|
|
|
|
for (DetailElectricalinspection detailElectricalinspection : detailElectricalinspectionList) {
|
|
|
|
{
|
|
|
|
|
|
|
|
detailElectricalinspection.setUuid(uuid);
|
|
|
|
detailElectricalinspection.setUuid(uuid);
|
|
|
|
list.add(detailElectricalinspection);
|
|
|
|
list.add(detailElectricalinspection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (list.size() > 0)
|
|
|
|
if (list.size() > 0) {
|
|
|
|
{
|
|
|
|
|
|
|
|
recordElectricalInspectionMapper.batchDetailElectricalinspection(list);
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|