|
|
|
|
@ -16,6 +16,8 @@ import org.springblade.desk.quality.service.IIotThicknessService; |
|
|
|
|
import org.springblade.desk.quality.service.IQcWithstandVoltageIotService; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Slf4j |
|
|
|
|
@RestController |
|
|
|
|
@ -32,6 +34,31 @@ public class IotWebApiController { |
|
|
|
|
private final IQcHardnessIotService qcHardnessIotService; |
|
|
|
|
private final IQcWithstandVoltageIotService qcWithstandVoltageIotService; |
|
|
|
|
|
|
|
|
|
@PostMapping("/saveLargeEquipment") |
|
|
|
|
@Operation(summary = "大设备数据转换并保存产线电量") |
|
|
|
|
public R saveLargeEquipment(@RequestBody JSONObject data) { |
|
|
|
|
if (data == null || data.isEmpty()) { |
|
|
|
|
throw new ServiceException("参数传递异常!"); |
|
|
|
|
} |
|
|
|
|
JSONObject largeEquipment = data.getJSONObject("largeEquipment"); |
|
|
|
|
if (largeEquipment == null) { |
|
|
|
|
throw new ServiceException("largeEquipment参数异常!"); |
|
|
|
|
} |
|
|
|
|
String bathListenStr = largeEquipment.getString("bathListen"); |
|
|
|
|
if (bathListenStr == null || bathListenStr.isEmpty()) { |
|
|
|
|
return R.success(); |
|
|
|
|
} |
|
|
|
|
log.info("大设备数据转换: deviceCode={}, bathListen={}", data.getString("deviceCode"), bathListenStr); |
|
|
|
|
|
|
|
|
|
JSONObject ahmData = new JSONObject(); |
|
|
|
|
ahmData.put("pushTm", new Date()); |
|
|
|
|
ahmData.put("deviceId", data.getString("deviceCode")); |
|
|
|
|
ahmData.put("ahmItems", JSONArray.parseArray(bathListenStr)); |
|
|
|
|
|
|
|
|
|
lineElectricService.saveDeviceAhm(ahmData); |
|
|
|
|
return R.success(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Operation(summary = "产线电量信息调用接口") |
|
|
|
|
@RequestMapping(value = "/saveDeviceAhm", method = RequestMethod.POST) |
|
|
|
|
public R saveDeviceAhm(@RequestBody JSONObject data) throws Exception { |
|
|
|
|
|