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/pdaRecord/getPdaRecord").permitAll()
.antMatchers(HttpMethod.GET, "/report/repairMeasures/getRepairMeasures").permitAll() .antMatchers(HttpMethod.GET, "/report/repairMeasures/getRepairMeasures").permitAll()
.antMatchers(HttpMethod.GET, "/base/teamMembers/**").permitAll() .antMatchers(HttpMethod.GET, "/base/teamMembers/**").permitAll()
.antMatchers(HttpMethod.POST, "/webApi/electricalInspection").permitAll()
.antMatchers(HttpMethod.POST, "/**/**/**").permitAll() .antMatchers(HttpMethod.POST, "/**/**/**").permitAll()
.antMatchers(HttpMethod.GET, "/**/**/**").permitAll() .antMatchers(HttpMethod.GET, "/**/**/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证 // 除上面外的所有请求全部需要鉴权认证

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

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

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

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

@ -66,7 +66,8 @@
#{productFactoryCode} #{productFactoryCode}
</if> </if>
<if test="productSncode != null and productSncode != ''">and po.product_sncode = #{productSncode}</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="productSaleNo != null and productSaleNo != ''">and po.product_sale_no = #{productSaleNo}</if>
<if test="productSaleLineNo != null and productSaleLineNo != ''">and po.product_sale_line_no = <if test="productSaleLineNo != null and productSaleLineNo != ''">and po.product_sale_line_no =
#{productSaleLineNo} #{productSaleLineNo}

@ -137,4 +137,11 @@
</foreach> </foreach>
SELECT 1 FROM DUAL SELECT 1 FROM DUAL
</insert> </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> </mapper>
Loading…
Cancel
Save