From f43604d86a221ef05a13a615f9d5ded6cf058f28 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Wed, 16 Oct 2024 20:22:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84iot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/IotMachineBindController.java | 35 +++++++++--------- .../iot/controller/IotMachineController.java | 35 +++++++++--------- .../bonus/material/iot/domain/IotMachine.java | 5 ++- .../material/iot/domain/IotMachineBind.java | 5 ++- .../iot/mapper/IotMachineBindMapper.java | 5 ++- .../material/iot/mapper/IotMachineMapper.java | 5 ++- .../iot/service/IIotMachineBindService.java | 5 ++- .../iot/service/IIotMachineService.java | 5 ++- .../impl/IotMachineBindServiceImpl.java | 36 ++++++++++--------- .../service/impl/IotMachineServiceImpl.java | 36 ++++++++++--------- 10 files changed, 86 insertions(+), 86 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/controller/IotMachineBindController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/controller/IotMachineBindController.java index 61403b76..35c9f663 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/controller/IotMachineBindController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/controller/IotMachineBindController.java @@ -28,13 +28,12 @@ import com.bonus.common.core.web.page.TableDataInfo; * 设备类型绑定Controller * * @author xsheng - * @date 2024-09-27 + * @date 2024-10-16 */ @Api(tags = "设备类型绑定接口") @RestController @RequestMapping("/iot_machine_bind") -public class IotMachineBindController extends BaseController -{ +public class IotMachineBindController extends BaseController { @Autowired private IIotMachineBindService iotMachineBindService; @@ -44,8 +43,7 @@ public class IotMachineBindController extends BaseController @ApiOperation(value = "查询设备类型绑定列表") @RequiresPermissions("iot:bind:list") @GetMapping("/list") - public TableDataInfo list(IotMachineBind iotMachineBind) - { + public TableDataInfo list(IotMachineBind iotMachineBind) { startPage(); List list = iotMachineBindService.selectIotMachineBindList(iotMachineBind); return getDataTable(list); @@ -59,8 +57,7 @@ public class IotMachineBindController extends BaseController @RequiresPermissions("iot:bind:export") @SysLog(title = "设备类型绑定", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出设备类型绑定") @PostMapping("/export") - public void export(HttpServletResponse response, IotMachineBind iotMachineBind) - { + public void export(HttpServletResponse response, IotMachineBind iotMachineBind) { List list = iotMachineBindService.selectIotMachineBindList(iotMachineBind); ExcelUtil util = new ExcelUtil(IotMachineBind.class); util.exportExcel(response, list, "设备类型绑定数据"); @@ -72,8 +69,7 @@ public class IotMachineBindController extends BaseController @ApiOperation(value = "获取设备类型绑定详细信息") @RequiresPermissions("iot:bind:query") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { + public AjaxResult getInfo(@PathVariable("id") Long id) { return success(iotMachineBindService.selectIotMachineBindById(id)); } @@ -85,9 +81,12 @@ public class IotMachineBindController extends BaseController @RequiresPermissions("iot:bind:add") @SysLog(title = "设备类型绑定", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增设备类型绑定") @PostMapping - public AjaxResult add(@RequestBody IotMachineBind iotMachineBind) - { - return toAjax(iotMachineBindService.insertIotMachineBind(iotMachineBind)); + public AjaxResult add(@RequestBody IotMachineBind iotMachineBind) { + try { + return toAjax(iotMachineBindService.insertIotMachineBind(iotMachineBind)); + } catch (Exception e) { + return error("系统错误, " + e.getMessage()); + } } /** @@ -98,9 +97,12 @@ public class IotMachineBindController extends BaseController @RequiresPermissions("iot:bind:edit") @SysLog(title = "设备类型绑定", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改设备类型绑定") @PutMapping - public AjaxResult edit(@RequestBody IotMachineBind iotMachineBind) - { - return toAjax(iotMachineBindService.updateIotMachineBind(iotMachineBind)); + public AjaxResult edit(@RequestBody IotMachineBind iotMachineBind) { + try { + return toAjax(iotMachineBindService.updateIotMachineBind(iotMachineBind)); + } catch (Exception e) { + return error("系统错误, " + e.getMessage()); + } } /** @@ -111,8 +113,7 @@ public class IotMachineBindController extends BaseController @RequiresPermissions("iot:bind:remove") @SysLog(title = "设备类型绑定", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除设备类型绑定") @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { + public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(iotMachineBindService.deleteIotMachineBindByIds(ids)); } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/controller/IotMachineController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/controller/IotMachineController.java index 680e1c89..d77c8a8e 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/controller/IotMachineController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/controller/IotMachineController.java @@ -28,13 +28,12 @@ import com.bonus.common.core.web.page.TableDataInfo; * 设备管理Controller * * @author xsheng - * @date 2024-09-27 + * @date 2024-10-16 */ @Api(tags = "设备管理接口") @RestController @RequestMapping("/iot_machine") -public class IotMachineController extends BaseController -{ +public class IotMachineController extends BaseController { @Autowired private IIotMachineService iotMachineService; @@ -44,8 +43,7 @@ public class IotMachineController extends BaseController @ApiOperation(value = "查询设备管理列表") @RequiresPermissions("iot:machine:list") @GetMapping("/list") - public TableDataInfo list(IotMachine iotMachine) - { + public TableDataInfo list(IotMachine iotMachine) { startPage(); List list = iotMachineService.selectIotMachineList(iotMachine); return getDataTable(list); @@ -59,8 +57,7 @@ public class IotMachineController extends BaseController @RequiresPermissions("iot:machine:export") @SysLog(title = "设备管理", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出设备管理") @PostMapping("/export") - public void export(HttpServletResponse response, IotMachine iotMachine) - { + public void export(HttpServletResponse response, IotMachine iotMachine) { List list = iotMachineService.selectIotMachineList(iotMachine); ExcelUtil util = new ExcelUtil(IotMachine.class); util.exportExcel(response, list, "设备管理数据"); @@ -72,8 +69,7 @@ public class IotMachineController extends BaseController @ApiOperation(value = "获取设备管理详细信息") @RequiresPermissions("iot:machine:query") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { + public AjaxResult getInfo(@PathVariable("id") Long id) { return success(iotMachineService.selectIotMachineById(id)); } @@ -85,9 +81,12 @@ public class IotMachineController extends BaseController @RequiresPermissions("iot:machine:add") @SysLog(title = "设备管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增设备管理") @PostMapping - public AjaxResult add(@RequestBody IotMachine iotMachine) - { - return toAjax(iotMachineService.insertIotMachine(iotMachine)); + public AjaxResult add(@RequestBody IotMachine iotMachine) { + try { + return toAjax(iotMachineService.insertIotMachine(iotMachine)); + } catch (Exception e) { + return error("系统错误, " + e.getMessage()); + } } /** @@ -98,9 +97,12 @@ public class IotMachineController extends BaseController @RequiresPermissions("iot:machine:edit") @SysLog(title = "设备管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改设备管理") @PutMapping - public AjaxResult edit(@RequestBody IotMachine iotMachine) - { - return toAjax(iotMachineService.updateIotMachine(iotMachine)); + public AjaxResult edit(@RequestBody IotMachine iotMachine) { + try { + return toAjax(iotMachineService.updateIotMachine(iotMachine)); + } catch (Exception e) { + return error("系统错误, " + e.getMessage()); + } } /** @@ -111,8 +113,7 @@ public class IotMachineController extends BaseController @RequiresPermissions("iot:machine:remove") @SysLog(title = "设备管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除设备管理") @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { + public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(iotMachineService.deleteIotMachineByIds(ids)); } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/domain/IotMachine.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/domain/IotMachine.java index e0a65e0b..7a72fa71 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/domain/IotMachine.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/domain/IotMachine.java @@ -10,14 +10,13 @@ import com.bonus.common.core.web.domain.BaseEntity; * 设备管理对象 iot_machine * * @author xsheng - * @date 2024-09-27 + * @date 2024-10-16 */ @Data @ToString -public class IotMachine extends BaseEntity -{ +public class IotMachine extends BaseEntity { private static final long serialVersionUID = 1L; /** iot设备id */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/domain/IotMachineBind.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/domain/IotMachineBind.java index ae58cc84..f3c72e9d 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/domain/IotMachineBind.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/domain/IotMachineBind.java @@ -12,14 +12,13 @@ import com.bonus.common.core.web.domain.BaseEntity; * 设备类型绑定对象 iot_machine_bind * * @author xsheng - * @date 2024-09-27 + * @date 2024-10-16 */ @Data @ToString -public class IotMachineBind extends BaseEntity -{ +public class IotMachineBind extends BaseEntity { private static final long serialVersionUID = 1L; /** 主键id */ diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/mapper/IotMachineBindMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/mapper/IotMachineBindMapper.java index ddf32b20..8494ad67 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/mapper/IotMachineBindMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/mapper/IotMachineBindMapper.java @@ -7,10 +7,9 @@ import com.bonus.material.iot.domain.IotMachineBind; * 设备类型绑定Mapper接口 * * @author xsheng - * @date 2024-09-27 + * @date 2024-10-16 */ -public interface IotMachineBindMapper -{ +public interface IotMachineBindMapper { /** * 查询设备类型绑定 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/mapper/IotMachineMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/mapper/IotMachineMapper.java index 5020552a..04cb1001 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/mapper/IotMachineMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/mapper/IotMachineMapper.java @@ -7,10 +7,9 @@ import com.bonus.material.iot.domain.IotMachine; * 设备管理Mapper接口 * * @author xsheng - * @date 2024-09-27 + * @date 2024-10-16 */ -public interface IotMachineMapper -{ +public interface IotMachineMapper { /** * 查询设备管理 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/IIotMachineBindService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/IIotMachineBindService.java index 4256451d..71b567ae 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/IIotMachineBindService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/IIotMachineBindService.java @@ -7,10 +7,9 @@ import com.bonus.material.iot.domain.IotMachineBind; * 设备类型绑定Service接口 * * @author xsheng - * @date 2024-09-27 + * @date 2024-10-16 */ -public interface IIotMachineBindService -{ +public interface IIotMachineBindService { /** * 查询设备类型绑定 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/IIotMachineService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/IIotMachineService.java index f6e369b7..bb3f78cc 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/IIotMachineService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/IIotMachineService.java @@ -7,10 +7,9 @@ import com.bonus.material.iot.domain.IotMachine; * 设备管理Service接口 * * @author xsheng - * @date 2024-09-27 + * @date 2024-10-16 */ -public interface IIotMachineService -{ +public interface IIotMachineService { /** * 查询设备管理 * diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/impl/IotMachineBindServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/impl/IotMachineBindServiceImpl.java index b263fd3f..72600200 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/impl/IotMachineBindServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/impl/IotMachineBindServiceImpl.java @@ -1,6 +1,7 @@ package com.bonus.material.iot.service.impl; import java.util.List; +import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -12,11 +13,10 @@ import com.bonus.material.iot.service.IIotMachineBindService; * 设备类型绑定Service业务层处理 * * @author xsheng - * @date 2024-09-27 + * @date 2024-10-16 */ @Service -public class IotMachineBindServiceImpl implements IIotMachineBindService -{ +public class IotMachineBindServiceImpl implements IIotMachineBindService { @Autowired private IotMachineBindMapper iotMachineBindMapper; @@ -27,8 +27,7 @@ public class IotMachineBindServiceImpl implements IIotMachineBindService * @return 设备类型绑定 */ @Override - public IotMachineBind selectIotMachineBindById(Long id) - { + public IotMachineBind selectIotMachineBindById(Long id) { return iotMachineBindMapper.selectIotMachineBindById(id); } @@ -39,8 +38,7 @@ public class IotMachineBindServiceImpl implements IIotMachineBindService * @return 设备类型绑定 */ @Override - public List selectIotMachineBindList(IotMachineBind iotMachineBind) - { + public List selectIotMachineBindList(IotMachineBind iotMachineBind) { return iotMachineBindMapper.selectIotMachineBindList(iotMachineBind); } @@ -51,10 +49,13 @@ public class IotMachineBindServiceImpl implements IIotMachineBindService * @return 结果 */ @Override - public int insertIotMachineBind(IotMachineBind iotMachineBind) - { + public int insertIotMachineBind(IotMachineBind iotMachineBind) { iotMachineBind.setCreateTime(DateUtils.getNowDate()); - return iotMachineBindMapper.insertIotMachineBind(iotMachineBind); + try { + return iotMachineBindMapper.insertIotMachineBind(iotMachineBind); + } catch (Exception e) { + throw new ServiceException("错误信息描述"); + } } /** @@ -64,10 +65,13 @@ public class IotMachineBindServiceImpl implements IIotMachineBindService * @return 结果 */ @Override - public int updateIotMachineBind(IotMachineBind iotMachineBind) - { + public int updateIotMachineBind(IotMachineBind iotMachineBind) { iotMachineBind.setUpdateTime(DateUtils.getNowDate()); - return iotMachineBindMapper.updateIotMachineBind(iotMachineBind); + try { + return iotMachineBindMapper.updateIotMachineBind(iotMachineBind); + } catch (Exception e) { + throw new ServiceException("错误信息描述"); + } } /** @@ -77,8 +81,7 @@ public class IotMachineBindServiceImpl implements IIotMachineBindService * @return 结果 */ @Override - public int deleteIotMachineBindByIds(Long[] ids) - { + public int deleteIotMachineBindByIds(Long[] ids) { return iotMachineBindMapper.deleteIotMachineBindByIds(ids); } @@ -89,8 +92,7 @@ public class IotMachineBindServiceImpl implements IIotMachineBindService * @return 结果 */ @Override - public int deleteIotMachineBindById(Long id) - { + public int deleteIotMachineBindById(Long id) { return iotMachineBindMapper.deleteIotMachineBindById(id); } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/impl/IotMachineServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/impl/IotMachineServiceImpl.java index 1926cd52..cc0cbc9c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/impl/IotMachineServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/iot/service/impl/IotMachineServiceImpl.java @@ -1,6 +1,7 @@ package com.bonus.material.iot.service.impl; import java.util.List; +import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -12,11 +13,10 @@ import com.bonus.material.iot.service.IIotMachineService; * 设备管理Service业务层处理 * * @author xsheng - * @date 2024-09-27 + * @date 2024-10-16 */ @Service -public class IotMachineServiceImpl implements IIotMachineService -{ +public class IotMachineServiceImpl implements IIotMachineService { @Autowired private IotMachineMapper iotMachineMapper; @@ -27,8 +27,7 @@ public class IotMachineServiceImpl implements IIotMachineService * @return 设备管理 */ @Override - public IotMachine selectIotMachineById(Long id) - { + public IotMachine selectIotMachineById(Long id) { return iotMachineMapper.selectIotMachineById(id); } @@ -39,8 +38,7 @@ public class IotMachineServiceImpl implements IIotMachineService * @return 设备管理 */ @Override - public List selectIotMachineList(IotMachine iotMachine) - { + public List selectIotMachineList(IotMachine iotMachine) { return iotMachineMapper.selectIotMachineList(iotMachine); } @@ -51,10 +49,13 @@ public class IotMachineServiceImpl implements IIotMachineService * @return 结果 */ @Override - public int insertIotMachine(IotMachine iotMachine) - { + public int insertIotMachine(IotMachine iotMachine) { iotMachine.setCreateTime(DateUtils.getNowDate()); - return iotMachineMapper.insertIotMachine(iotMachine); + try { + return iotMachineMapper.insertIotMachine(iotMachine); + } catch (Exception e) { + throw new ServiceException("错误信息描述"); + } } /** @@ -64,10 +65,13 @@ public class IotMachineServiceImpl implements IIotMachineService * @return 结果 */ @Override - public int updateIotMachine(IotMachine iotMachine) - { + public int updateIotMachine(IotMachine iotMachine) { iotMachine.setUpdateTime(DateUtils.getNowDate()); - return iotMachineMapper.updateIotMachine(iotMachine); + try { + return iotMachineMapper.updateIotMachine(iotMachine); + } catch (Exception e) { + throw new ServiceException("错误信息描述"); + } } /** @@ -77,8 +81,7 @@ public class IotMachineServiceImpl implements IIotMachineService * @return 结果 */ @Override - public int deleteIotMachineByIds(Long[] ids) - { + public int deleteIotMachineByIds(Long[] ids) { return iotMachineMapper.deleteIotMachineByIds(ids); } @@ -89,8 +92,7 @@ public class IotMachineServiceImpl implements IIotMachineService * @return 结果 */ @Override - public int deleteIotMachineById(Long id) - { + public int deleteIotMachineById(Long id) { return iotMachineMapper.deleteIotMachineById(id); } }