change - add电检web接口

master
yinq 9 months ago
parent fda109f122
commit 42877de7dd

@ -0,0 +1,43 @@
package com.aucma.api.controller;
import com.aucma.api.domain.dto.SAPPortDto;
import com.aucma.api.domain.dto.WERKSDto;
import com.aucma.base.domain.BaseMaterialInfo;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.report.service.IRecordElectricalInspectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author YinQ
* @create 2023-09-26 14:29
*/
@RestController
@RequestMapping("/webApi")
public class ElectricalInspectionController {
@Autowired
private IRecordElectricalInspectionService electricalInspectionService;
/**
*
* @param paramMap
* @return
*/
@PostMapping("/electricalInspection")
public HashMap<String, String> getSAPMaterialData(@RequestBody Map paramMap) {
return electricalInspectionService.analysisElectricalInspectionData(paramMap);
}
}

@ -125,6 +125,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.antMatchers(HttpMethod.GET, "/report/pdaRecord/getPdaRecord").permitAll()
.antMatchers(HttpMethod.GET, "/report/repairMeasures/getRepairMeasures").permitAll()
.antMatchers(HttpMethod.GET, "/base/teamMembers/**").permitAll()
.antMatchers(HttpMethod.POST, "/webApi/electricalInspection").permitAll()
.antMatchers(HttpMethod.POST, "/**/**/**").permitAll()
.antMatchers(HttpMethod.GET, "/**/**/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证

@ -35,9 +35,9 @@ public class ProductOffLine extends BaseEntity {
private String productSncode;
/**
*
* SAP
*/
@Excel(name = "工单号")
@Excel(name = "SAP计划编号")
private String productOrderNo;
/**

@ -79,7 +79,7 @@ public interface RecordElectricalInspectionMapper
* @return
*/
public int batchDetailElectricalinspection(List<DetailElectricalinspection> detailElectricalinspectionList);
/**
*
@ -88,4 +88,7 @@ public interface RecordElectricalInspectionMapper
* @return
*/
public int deleteDetailElectricalinspectionByUuid(String uuid);
public int insertDetailElectricalinspection(DetailElectricalinspection detailElectricalinspection);
}

@ -1,6 +1,9 @@
package com.aucma.report.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.aucma.report.domain.RecordElectricalInspection;
/**
@ -58,4 +61,11 @@ public interface IRecordElectricalInspectionService
* @return
*/
public int deleteRecordElectricalInspectionByUuid(String uuid);
/**
*
* @param paramMap
* @return
*/
HashMap<String, String> analysisElectricalInspectionData(Map paramMap);
}

@ -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;
}
}

@ -66,7 +66,8 @@
#{productFactoryCode}
</if>
<if test="productSncode != null and productSncode != ''">and po.product_sncode = #{productSncode}</if>
<if test="productOrderNo != null and productOrderNo != ''">and po.product_order_no = #{productOrderNo}</if>
<if test="productOrderNo != null and productOrderNo != ''">and po.product_order_no like concat(concat('%',
#{product_order_no}), '%')</if>
<if test="productSaleNo != null and productSaleNo != ''">and po.product_sale_no = #{productSaleNo}</if>
<if test="productSaleLineNo != null and productSaleLineNo != ''">and po.product_sale_line_no =
#{productSaleLineNo}

@ -137,4 +137,11 @@
</foreach>
SELECT 1 FROM DUAL
</insert>
<insert id="insertDetailElectricalinspection" parameterType="DetailElectricalinspection">
INSERT INTO detail_electricalinspection( uuid, serialnumber, projectname, testcondition, testvalue, testresult,
recordtime) values ( #{uuid}, #{serialnumber}, #{projectname}, #{testcondition},
#{testvalue}, #{testresult}, #{recordtime})
</insert>
</mapper>
Loading…
Cancel
Save