|
@@ -2,6 +2,7 @@ package org.jeecg.modules.system.app.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.google.gson.JsonObject;
|
|
|
import com.google.gson.JsonParser;
|
|
@@ -24,6 +25,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
import static org.jeecg.modules.hikiot.HikiotTool.*;
|
|
@@ -74,7 +76,6 @@ public class AppDeviceController extends JeecgController<AppDevice, IAppDeviceSe
|
|
|
/**
|
|
|
* 添加
|
|
|
*
|
|
|
- * @param AppDevice
|
|
|
* @return
|
|
|
*/
|
|
|
@AutoLog(value = "nm_device-添加")
|
|
@@ -82,13 +83,19 @@ public class AppDeviceController extends JeecgController<AppDevice, IAppDeviceSe
|
|
|
@RequiresPermissions("com:nm_device:add")
|
|
|
@PostMapping(value = "/add")
|
|
|
@Transactional
|
|
|
- public Result<String> add(@RequestBody AppDevice AppDevice){
|
|
|
- AppDeviceService.save(AppDevice);
|
|
|
+ public Result<String> add(@RequestBody AppDevice appDevice){
|
|
|
+ if(AppDeviceService.getOne(Wrappers.<AppDevice>lambdaQuery()
|
|
|
+ .eq(AppDevice::getDeviceSerial,appDevice.getDeviceSerial())
|
|
|
+ .eq(AppDevice::getDeviceNo,appDevice.getDeviceNo())
|
|
|
+ .eq(AppDevice::getDeviceType,appDevice.getDeviceType())) != null) {
|
|
|
+ return Result.error("设备已存在!");
|
|
|
+ }
|
|
|
+ AppDeviceService.save(appDevice);
|
|
|
try {
|
|
|
- if(AppDevice.getDeviceSerial() != null && AppDevice.getValidateCode() != null){
|
|
|
- String addDevice = addDevice(AppDevice.getDeviceSerial(), AppDevice.getValidateCode());
|
|
|
- String userWeekPlan = addUserWeekPlan(AppDevice.getDeviceSerial());
|
|
|
- String userPlanTemplate = addUserPlanTemplate(AppDevice.getDeviceSerial());
|
|
|
+ if(appDevice.getDeviceSerial() != null && appDevice.getValidateCode() != null){
|
|
|
+ String addDevice = addDevice(appDevice.getDeviceSerial(), appDevice.getValidateCode());
|
|
|
+ String userWeekPlan = addUserWeekPlan(appDevice.getDeviceSerial());
|
|
|
+ String userPlanTemplate = addUserPlanTemplate(appDevice.getDeviceSerial());
|
|
|
JsonObject deviceJson = JsonParser.parseString(addDevice).getAsJsonObject();
|
|
|
JsonObject userWeekPlanJson = JsonParser.parseString(userWeekPlan).getAsJsonObject();
|
|
|
JsonObject userPlanTemplateJson = JsonParser.parseString(userPlanTemplate).getAsJsonObject();
|
|
@@ -194,4 +201,18 @@ public class AppDeviceController extends JeecgController<AppDevice, IAppDeviceSe
|
|
|
return super.importExcel(request, response, AppDevice.class);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @Author SheepHy
|
|
|
+ * @Description 分页查询开门记录
|
|
|
+ * @Date 10:53 2025/8/25
|
|
|
+ **/
|
|
|
+ @Operation(summary="分页查询开门记录")
|
|
|
+ @GetMapping(value = "/listOpenDoor")
|
|
|
+ public Result<String> listOpenDoor(@RequestParam String employeeNos,
|
|
|
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize) throws IOException, InterruptedException {
|
|
|
+ return Result.OK(queryOpenDoorRecord(pageNo, pageSize, employeeNos));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|