diff --git a/xinda-common/src/main/java/com/xinda/common/core/domain/entity/SysDept.java b/xinda-common/src/main/java/com/xinda/common/core/domain/entity/SysDept.java index ea64cae..e896c01 100644 --- a/xinda-common/src/main/java/com/xinda/common/core/domain/entity/SysDept.java +++ b/xinda-common/src/main/java/com/xinda/common/core/domain/entity/SysDept.java @@ -114,6 +114,8 @@ public class SysDept extends BaseEntity */ private String deptUserName; + private String url; + public String getDeptUserName() { return deptUserName; } @@ -288,6 +290,14 @@ public class SysDept extends BaseEntity this.children = children; } + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/xinda-gateway/xinda-mq/src/main/java/com/xinda/mq/ruleEngine/SceneContext.java b/xinda-gateway/xinda-mq/src/main/java/com/xinda/mq/ruleEngine/SceneContext.java index d49607e..89fc578 100644 --- a/xinda-gateway/xinda-mq/src/main/java/com/xinda/mq/ruleEngine/SceneContext.java +++ b/xinda-gateway/xinda-mq/src/main/java/com/xinda/mq/ruleEngine/SceneContext.java @@ -391,7 +391,7 @@ public class SceneContext { alertLog.setSerialNumber(deviceNum); alertLog.setStatus(2); alertLog.setCreateBy(sceneId.toString()); - Long count = alertLogService.selectAlertLogListCount(alertLog); + Long count = alertLogService.selectSceneAlertLogListCount(alertLog); // 查询设备告警对应的场景是否有未处理告警 if (count > 0) { return true; diff --git a/xinda-gateway/xinda-mq/src/main/java/com/xinda/mq/service/impl/DeviceOtherMsgHandler.java b/xinda-gateway/xinda-mq/src/main/java/com/xinda/mq/service/impl/DeviceOtherMsgHandler.java index fe44b11..d2e596b 100644 --- a/xinda-gateway/xinda-mq/src/main/java/com/xinda/mq/service/impl/DeviceOtherMsgHandler.java +++ b/xinda-gateway/xinda-mq/src/main/java/com/xinda/mq/service/impl/DeviceOtherMsgHandler.java @@ -69,6 +69,12 @@ public class DeviceOtherMsgHandler { data.setRuleEngine(true); dataHandler.reportData(data); break; +// case FUNCTION_POST: +// data.setShadow(false); +// data.setType(2); +// data.setRuleEngine(true); +// dataHandler.reportData(data); +// break; case EVENT_POST: data.setType(3); data.setRuleEngine(true); diff --git a/xinda-gateway/xinda-mq/src/main/java/com/xinda/mq/service/impl/RuleEngineHandler.java b/xinda-gateway/xinda-mq/src/main/java/com/xinda/mq/service/impl/RuleEngineHandler.java index 25b8523..6845f92 100644 --- a/xinda-gateway/xinda-mq/src/main/java/com/xinda/mq/service/impl/RuleEngineHandler.java +++ b/xinda-gateway/xinda-mq/src/main/java/com/xinda/mq/service/impl/RuleEngineHandler.java @@ -84,7 +84,6 @@ public class RuleEngineHandler implements IRuleEngine { for(Script script : list) { requestId = requestId + "/" + script.getScriptId(); } -// String requestId = "scene/" + scene.getChainName(); flowExecutor.execute2FutureWithRid(scene.getChainName(), null, requestId, context); } } diff --git a/xinda-open-api/pom.xml b/xinda-open-api/pom.xml index 64bcb7c..8d5115a 100644 --- a/xinda-open-api/pom.xml +++ b/xinda-open-api/pom.xml @@ -34,6 +34,10 @@ xinda-ruleEngine 3.8.5 + + com.xinda + xinda-scada + diff --git a/xinda-open-api/src/main/java/com/xinda/data/controller/AlertController.java b/xinda-open-api/src/main/java/com/xinda/data/controller/AlertController.java index b28c6c2..0b43756 100644 --- a/xinda-open-api/src/main/java/com/xinda/data/controller/AlertController.java +++ b/xinda-open-api/src/main/java/com/xinda/data/controller/AlertController.java @@ -112,6 +112,21 @@ public class AlertController extends BaseController return toAjax(alertService.insertAlert(alert)); } + @Log(title = "设备告警", businessType = BusinessType.INSERT) + @PostMapping("/addCfg") + public AjaxResult addCfg(@RequestBody Alert alert) + { + // 查询所属机构 + SysUser user = getLoginUser().getUser(); + if (null != user.getDeptId()) { + alert.setTenantId(user.getDept().getDeptUserId()); + alert.setTenantName(user.getDept().getDeptUserName()); + } + return toAjax(alertService.insertCfgAlert(alert)); + } + + + /** * 修改设备告警 */ diff --git a/xinda-open-api/src/main/java/com/xinda/data/controller/AlertLogController.java b/xinda-open-api/src/main/java/com/xinda/data/controller/AlertLogController.java index a1cb26c..dcf9141 100644 --- a/xinda-open-api/src/main/java/com/xinda/data/controller/AlertLogController.java +++ b/xinda-open-api/src/main/java/com/xinda/data/controller/AlertLogController.java @@ -60,6 +60,15 @@ public class AlertLogController extends BaseController return getDataTable(list); } + @GetMapping("/snList") + public TableDataInfo snList(AlertLog alertLog) + { + startPage(); + List list = alertLogService.selectAlertLogSnList(alertLog); + return getDataTable(list); + } + + /** * 导出设备告警列表 */ diff --git a/xinda-open-api/src/main/java/com/xinda/data/controller/DeviceController.java b/xinda-open-api/src/main/java/com/xinda/data/controller/DeviceController.java index b55fe35..a38fed4 100644 --- a/xinda-open-api/src/main/java/com/xinda/data/controller/DeviceController.java +++ b/xinda-open-api/src/main/java/com/xinda/data/controller/DeviceController.java @@ -4,6 +4,7 @@ import com.xinda.common.annotation.Log; import com.xinda.common.constant.HttpStatus; import com.xinda.common.core.controller.BaseController; import com.xinda.common.core.domain.AjaxResult; +import com.xinda.common.core.domain.entity.SysDept; import com.xinda.common.core.domain.entity.SysRole; import com.xinda.common.core.domain.model.LoginUser; import com.xinda.common.core.page.TableDataInfo; @@ -14,16 +15,24 @@ import com.xinda.common.utils.SecurityUtils; import com.xinda.common.utils.StringUtils; import com.xinda.common.utils.poi.ExcelUtil; import com.xinda.iot.domain.Device; -import com.xinda.iot.model.DeviceAssignmentVO; -import com.xinda.iot.model.DeviceImportVO; -import com.xinda.iot.model.DeviceRelateUserInput; -import com.xinda.iot.model.SerialNumberVO; + +import com.xinda.iot.domain.Product; +import com.xinda.iot.model.*; import com.xinda.iot.service.IDeviceService; +import com.xinda.iot.service.IProductService; import com.xinda.mq.service.IMqttMessagePublish; import com.xinda.iot.model.dto.ThingsModelDTO; import com.xinda.iot.service.IDeviceService; import com.xinda.mq.service.IMqttMessagePublish; import com.github.pagehelper.PageInfo; +import com.xinda.scada.domain.Scada; +import com.xinda.scada.domain.ScadaDeviceBind; +import com.xinda.scada.service.IScadaDeviceBindService; +import com.xinda.scada.service.IScadaService; +import com.xinda.sip.domain.SipDeviceChannel; +import com.xinda.sip.service.ISipDeviceChannelService; + +import com.xinda.system.service.ISysDeptService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.CollectionUtils; @@ -37,6 +46,7 @@ import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.UUID; import java.util.stream.Collectors; /** @@ -53,10 +63,25 @@ public class DeviceController extends BaseController @Autowired private IDeviceService deviceService; + @Autowired + private ISysDeptService sysDeptService; + + @Autowired + private ISipDeviceChannelService sipDeviceChannelService; + // @Lazy @Autowired private IMqttMessagePublish messagePublish; + @Autowired + private IProductService productService; + + @Autowired + private IScadaService scadaService; + + @Autowired + private IScadaDeviceBindService scadaDeviceBindService; + /** * 查询设备列表 */ @@ -162,6 +187,57 @@ public class DeviceController extends BaseController return getDataTable(deviceService.selectDeviceShortList(device)); } + @PreAuthorize("@ss.hasPermi('iot:device:list')") + @GetMapping("/shortListWg") + @ApiOperation("设备分页简短列表") + public TableDataInfo shortListWg(Device device) + { + startPage(); + LoginUser loginUser = getLoginUser(); + if (null == loginUser.getDeptId()) { + // 终端用户查询设备 + device.setTenantId(loginUser.getUserId()); + return getDataTable(deviceService.listTerminalUser(device)); + } + if (null == device.getDeptId()) { + device.setDeptId(getLoginUser().getDeptId()); + } + if (Objects.isNull(device.getTenantId())){ + device.setTenantId(getLoginUser().getUserId()); + } + if (null == device.getShowChild()) { + device.setShowChild(false); + } + return getDataTable(deviceService.selectDeviceShortGwList(device)); + } + + /** + * 查询设备简短列表,主页列表数据 + */ + @PreAuthorize("@ss.hasPermi('iot:device:list')") + @GetMapping("/shortTreeList") + @ApiOperation("设备分页简短列表") + public List shortTreeList(Device device) + { + startPage(); + if (null == device.getDeptId()) { + device.setDeptId(getLoginUser().getDeptId()); + } + if (Objects.isNull(device.getTenantId())){ + device.setTenantId(getLoginUser().getUserId()); + } + if (null == device.getShowChild()) { + device.setShowChild(false); + } + List shortOutputs = deviceService.selectDeviceShortTreeList(device); + for(DeviceShortOutput shortOutput :shortOutputs){ + List sipDevices = deviceService.selectCamDeviceListByDeviceId(shortOutput.getDeviceId()); + shortOutput.setSipList(sipDevices); + } + + return shortOutputs; + } + /** * 查询所有设备简短列表 */ @@ -271,7 +347,24 @@ public class DeviceController extends BaseController @ApiOperation("添加设备") public AjaxResult add(@RequestBody Device device) { - return AjaxResult.success(deviceService.insertDevice(device)); + Product product = productService.selectProductByProductId(device.getProductId()); + //复制组态信息 + if(StringUtils.isNotEmpty(product.getGuid())){ + Scada scada = scadaService.selectScadaByGuid(product.getGuid()); + UUID uuid = UUID.randomUUID(); + scada.setGuid(uuid.toString()); + scadaService.insertScada(scada); + device.setGuid(uuid.toString()); + } + deviceService.insertDevice(device); + //复制组态信息 + if(StringUtils.isNotEmpty(product.getGuid())){ + ScadaDeviceBind scadaDeviceBind = new ScadaDeviceBind(); + scadaDeviceBind.setScadaGuid(device.getGuid()); + scadaDeviceBind.setSerialNumber(device.getSerialNumber()); + scadaDeviceBindService.insertScadaDeviceBind(scadaDeviceBind); + } + return AjaxResult.success(); } /** @@ -302,6 +395,25 @@ public class DeviceController extends BaseController @ApiOperation("修改设备") public AjaxResult edit(@RequestBody Device device) { + if(null != device.getAgenciesId()) { + SysDept sysDept = sysDeptService.selectDeptById(device.getAgenciesId()); + Long deptUserId = sysDept.getDeptUserId(); + if (null == deptUserId) { + deptUserId = sysDeptService.selectDeptById(sysDept.getParentId()).getDeptUserId(); + } + if(device.getDeviceType()==3){ + SipDeviceChannel sipDeviceChannel = new SipDeviceChannel(); + sipDeviceChannel.setDeviceSipId(device.getSerialNumber()); + List list = sipDeviceChannelService.selectSipDeviceChannelList(sipDeviceChannel); + List newList = new ArrayList<>(); + if (list != null && list.size() > 0) { + for (SipDeviceChannel channel : list) { + channel.setTenantId(deptUserId); + sipDeviceChannelService.updateSipDeviceChannel(channel); + } + } + } + } return deviceService.updateDevice(device); } @@ -327,6 +439,12 @@ public class DeviceController extends BaseController @DeleteMapping("/{deviceIds}") @ApiOperation("批量删除设备") public AjaxResult remove(@PathVariable Long[] deviceIds) throws SchedulerException { + for(Long deviceId:deviceIds){ + Device device=deviceService.selectDeviceByDeviceId(deviceId); + if(StringUtils.isNotEmpty(device.getGuid())){ + scadaService.deleteScadaByGuid(device.getGuid()); + } + } return deviceService.deleteDeviceByDeviceId(deviceIds[0]); } diff --git a/xinda-open-api/src/main/java/com/xinda/data/controller/DocController.java b/xinda-open-api/src/main/java/com/xinda/data/controller/DocController.java new file mode 100644 index 0000000..5ebc48f --- /dev/null +++ b/xinda-open-api/src/main/java/com/xinda/data/controller/DocController.java @@ -0,0 +1,113 @@ +package com.xinda.data.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.xinda.common.utils.StringUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.xinda.common.annotation.Log; +import com.xinda.common.core.controller.BaseController; +import com.xinda.common.core.domain.AjaxResult; +import com.xinda.common.enums.BusinessType; +import com.xinda.iot.domain.Doc; +import com.xinda.iot.service.IDocService; +import com.xinda.common.utils.poi.ExcelUtil; +import com.xinda.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; + +/** + * 档案管理Controller + * + * @author leo + * @date 2025-04-04 + */ +@RestController +@RequestMapping("/iot/doc") +@Api(tags = "档案管理") +public class DocController extends BaseController +{ + @Autowired + private IDocService docService; + +/** + * 查询档案管理列表 + */ +@PreAuthorize("@ss.hasPermi('iot:doc:list')") +@GetMapping("/list") +@ApiOperation("查询档案管理列表") + public TableDataInfo list(Doc doc) + { + startPage(); + List list = docService.selectDocList(doc); + return getDataTable(list); + } + + /** + * 导出档案管理列表 + */ + @ApiOperation("导出档案管理列表") + @PreAuthorize("@ss.hasPermi('iot:doc:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, Doc doc) + { + List list = docService.selectDocList(doc); + ExcelUtil util = new ExcelUtil(Doc.class); + util.exportExcel(response, list, "档案管理数据"); + } + + /** + * 获取档案管理详细信息 + */ + @PreAuthorize("@ss.hasPermi('iot:doc:query')") + @GetMapping(value = "/{id}") + @ApiOperation("获取档案管理详细信息") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(docService.selectDocById(id)); + } + + /** + * 新增档案管理 + */ + @PreAuthorize("@ss.hasPermi('iot:doc:add')") + @PostMapping + @ApiOperation("新增档案管理") + public AjaxResult add(@RequestBody Doc doc) + { + return toAjax(docService.insertDoc(doc)); + } + + /** + * 修改档案管理 + */ + @PreAuthorize("@ss.hasPermi('iot:doc:edit')") + @PutMapping + @ApiOperation("修改档案管理") + public AjaxResult edit(@RequestBody Doc doc) + { + return toAjax(docService.updateDoc(doc)); + } + + /** + * 删除档案管理 + */ + @PreAuthorize("@ss.hasPermi('iot:doc:remove')") + @DeleteMapping("/{ids}") + @ApiOperation("删除档案管理") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(docService.deleteDocByIds(ids)); + } + +} diff --git a/xinda-open-api/src/main/java/com/xinda/data/controller/ProductController.java b/xinda-open-api/src/main/java/com/xinda/data/controller/ProductController.java index 46de6e7..1981555 100644 --- a/xinda-open-api/src/main/java/com/xinda/data/controller/ProductController.java +++ b/xinda-open-api/src/main/java/com/xinda/data/controller/ProductController.java @@ -48,23 +48,44 @@ public class ProductController extends BaseController public TableDataInfo list(Product product) { startPage(); - SysUser user = getLoginUser().getUser(); - if (null == user.getDeptId()) { - product.setTenantId(user.getUserId()); - return getDataTable(productService.selectTerminalUserProduct(product)); - } +// SysUser user = getLoginUser().getUser(); +// if (null == user.getDeptId()) { +// product.setTenantId(user.getUserId()); +// return getDataTable(productService.selectTerminalUserProduct(product)); +// } Boolean showSenior = product.getShowSenior(); if (Objects.isNull(showSenior)){ //默认展示上级产品 product.setShowSenior(true); } - Long deptUserId = getLoginUser().getUser().getDept().getDeptUserId(); - product.setAdmin(SecurityUtils.isAdmin(deptUserId)); - product.setDeptId(getLoginUser().getDeptId()); - product.setTenantId(deptUserId); + if(product.getDeptId()==null){ + Long deptUserId = getLoginUser().getUser().getDept().getDeptUserId(); +// product.setAdmin(SecurityUtils.isAdmin(deptUserId)); + product.setDeptId(getLoginUser().getDeptId()); + product.setTenantId(deptUserId); + } + return getDataTable(productService.selectProductList(product)); } + @GetMapping("/longList") + @ApiOperation("产品分页列表") + public List longList(Product product) + { + Boolean showSenior = product.getShowSenior(); + if (Objects.isNull(showSenior)){ + //默认展示上级产品 + product.setShowSenior(true); + } + if(product.getDeptId()==null){ + Long deptUserId = getLoginUser().getUser().getDept().getDeptUserId(); + product.setDeptId(getLoginUser().getDeptId()); + product.setTenantId(deptUserId); + } + + return productService.selectProductList(product); + } + /** * 查询产品简短列表 */ diff --git a/xinda-open-api/src/main/java/com/xinda/data/controller/ThingsModelStandardController.java b/xinda-open-api/src/main/java/com/xinda/data/controller/ThingsModelStandardController.java index 57c433a..6102206 100644 --- a/xinda-open-api/src/main/java/com/xinda/data/controller/ThingsModelStandardController.java +++ b/xinda-open-api/src/main/java/com/xinda/data/controller/ThingsModelStandardController.java @@ -35,7 +35,6 @@ public class ThingsModelStandardController extends BaseController { /** * 查询通用物模型列表 */ - @PreAuthorize("@ss.hasPermi('iot:standard:list')") @GetMapping("/list") @ApiOperation("通用物模型分页列表") public TableDataInfo list(ThingsModelStandard thingsModelStandard) { @@ -46,7 +45,7 @@ public class ThingsModelStandardController extends BaseController { /** * 导出通用物模型列表 */ - @PreAuthorize("@ss.hasPermi('iot:standard:export')") + @Log(title = "通用物模型", businessType = BusinessType.EXPORT) @PostMapping("/export") @ApiOperation("导出通用物模型") @@ -59,7 +58,7 @@ public class ThingsModelStandardController extends BaseController { /** * 获取通用物模型详细信息 */ - @PreAuthorize("@ss.hasPermi('iot:standard:query')") + @GetMapping(value = "/{templateId}") @ApiOperation("获取通用物模型详情") public AjaxResult getInfo(@PathVariable("templateId") Long templateId) { @@ -69,7 +68,6 @@ public class ThingsModelStandardController extends BaseController { /** * 新增通用物模型 */ - @PreAuthorize("@ss.hasPermi('iot:standard:add')") @Log(title = "通用物模型", businessType = BusinessType.INSERT) @PostMapping @ApiOperation("添加通用物模型") @@ -99,7 +97,7 @@ public class ThingsModelStandardController extends BaseController { /** * 删除通用物模型 */ - @PreAuthorize("@ss.hasPermi('iot:standard:remove')") + @Log(title = "通用物模型", businessType = BusinessType.DELETE) @DeleteMapping("/{templateIds}") @ApiOperation("批量删除通用物模型") @@ -125,7 +123,7 @@ public class ThingsModelStandardController extends BaseController { /** * 导入采集点 */ - @PreAuthorize("@ss.hasPermi('iot:standard:add')") + @ApiOperation(value = "采集点导入") @PostMapping(value = "/importData") public AjaxResult importData(MultipartFile file, String tempSlaveId) throws Exception { diff --git a/xinda-plugs/xinda-mqtt-client/src/main/java/com/xinda/mqttclient/PubMqttCallBack.java b/xinda-plugs/xinda-mqtt-client/src/main/java/com/xinda/mqttclient/PubMqttCallBack.java index 64059dd..655178b 100644 --- a/xinda-plugs/xinda-mqtt-client/src/main/java/com/xinda/mqttclient/PubMqttCallBack.java +++ b/xinda-plugs/xinda-mqtt-client/src/main/java/com/xinda/mqttclient/PubMqttCallBack.java @@ -97,13 +97,6 @@ public class PubMqttCallBack implements MqttCallbackExtended { log.info("MQTT内部客户端已经连接!"); System.out.print("" + " * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n" + - " * _⚲_⚲_ ______ _ ____ * \n" + - " * | / \\ | | ____| | | | _ \\ * \n" + - " * | | | ● | | | | |__ __ _ ___| |_ | |_) | ___ ___ * \n" + - " * | \\ / | | __/ _` / __| __| | _ < / _ \\/ _ \\ * \n" + - " * \\ / | | | (_| \\__ \\ |_ | |_) | __/ __/ * \n" + - " * V |_| \\__,_|___/\\__| |____/ \\___|\\___| * \n" + - " * * \n" + " * * * * * * * * * * * * XinDa物联网平台[✔启动成功] * * * * * * * * * * * * \n"); //连接后订阅, enable为false表示使用emq diff --git a/xinda-protocol/xinda-protocol-collect/src/main/java/com/xinda/gkb/IECF6113ProtocolService.java b/xinda-protocol/xinda-protocol-collect/src/main/java/com/xinda/gkb/IECF6113ProtocolService.java index 33cd54e..cd77ba4 100644 --- a/xinda-protocol/xinda-protocol-collect/src/main/java/com/xinda/gkb/IECF6113ProtocolService.java +++ b/xinda-protocol/xinda-protocol-collect/src/main/java/com/xinda/gkb/IECF6113ProtocolService.java @@ -36,7 +36,7 @@ import java.util.stream.Collectors; */ @Slf4j @Component -@SysProtocol(name = "IECF6113-JSON协议",protocolCode = XinDaConstant.PROTOCOL.IECF6113,description = "IECF6113-JSON协议") +@SysProtocol(name = "IECF6113-JSON协议", protocolCode = XinDaConstant.PROTOCOL.IECF6113, description = "IECF6113-JSON协议") public class IECF6113ProtocolService implements IProtocol { @@ -49,67 +49,67 @@ public class IECF6113ProtocolService implements IProtocol { /** * 上报数据格式:

- * { - * "AD6": 0.27333333333333, - * "AD15": 0.27333333333333, - * "AD14": 0.27333333333333, - * "AD7": 0.27333333333333, - * "AD11": 0.26, - * "AD1": 0.27333333333333, - * "AD4": 0.26, - * "AD3": 0.26, - * "AD10": 0.27333333333333, - * "AD8": 0.26, - * "AD16": 0.27333333333333, - * "AD12": 0.26, - * "AD13": 0.27333333333333, - * "AD9": 0.27333333333333, - * "AD2": 0.27333333333333, - * "AD5": 0.27333333333333 - * } - * * { - * "I0.1": 0, - * "I0.3": 0, - * "I0.4": 0, - * "I0.6": 0, - * "I0.5": 0, - * "I0.2": 0 + * "AD6": 0.27333333333333, + * "AD15": 0.27333333333333, + * "AD14": 0.27333333333333, + * "AD7": 0.27333333333333, + * "AD11": 0.26, + * "AD1": 0.27333333333333, + * "AD4": 0.26, + * "AD3": 0.26, + * "AD10": 0.27333333333333, + * "AD8": 0.26, + * "AD16": 0.27333333333333, + * "AD12": 0.26, + * "AD13": 0.27333333333333, + * "AD9": 0.27333333333333, + * "AD2": 0.27333333333333, + * "AD5": 0.27333333333333 * } - * + *

* { - * "lng": "104.0902886", - * "lat": "030.8176553" + * "I0.1": 0, + * "I0.3": 0, + * "I0.4": 0, + * "I0.6": 0, + * "I0.5": 0, + * "I0.2": 0 * } - * + *

* { - * "PAD": 3905 + * "lng": "104.0902886", + * "lat": "030.8176553" * } - * - * - * + *

+ * { + * "PAD": 3905 + * } + *

+ *

+ *

* 下发报文格式

* device 从机编号

* name 标识符

* value 值

* serNo 流水号

* { - * "device": 1, - * "name": "template", - * "value": 111, - * "serNo": "213245489543789" + * "device": 1, + * "name": "template", + * "value": 111, + * "serNo": "213245489543789" * } *

- * + *

* 下发指令回复格式

* serNo 平台的流水号,用于对应回复消息

* ack 下发指令状态 0是失败 1是成功

- * { - * "serNo": "213245489543789", - * "ack": 1 + * { + * "serNo": "213245489543789", + * "ack": 1 * } *

- * + *

* {"AD6":0.20666666666667,"AD15":0.22,"AD14":0.22,"AD7":0.20666666666667,"AD11":0.20666666666667, * "AD1":18.886666666667,"AD4":0.22,"AD3":0.22,"AD10":0.22,"AD8":15.526666666667,"AD16":0.22,"AD12":0.22, * "AD13":0.22,"AD9":0.20666666666667,"AD2":0.22,"AD5":0.22} @@ -118,58 +118,103 @@ public class IECF6113ProtocolService implements IProtocol { * {"lng":"104.1536100","lat":"030.8336398","PAD":4185,"CSQ":28} */ private static final Set EXCLUDE_KEYS = new HashSet<>(Arrays.asList( - "AD1", "AD2", "AD3","AD4", "AD5", "AD6","AD7", "AD8", "AD9","AD10", "AD11", "AD12", - "AD13", "AD14", "AD15","AD16", "I0.1", "I0.2","I0.3", "I0.4", "I0.5","I0.6","lng", "lat", "PAD", "CSQ", - "K0", "K1", "温度","温度1", "标况流量", "工况流量", "压力" + "AD1", "AD2", "AD3", "AD4", "AD5", "AD6", "AD7", "AD8", "AD9", "AD10", "AD11", "AD12", + "AD13", "AD14", "AD15", "AD16", "I0.1", "I0.2", "I0.3", "I0.4", "I0.5", "I0.6", "lng", "lat", "PAD", "CSQ", + "K0", "K1", "温度", "温度1", "标况流量", "工况流量", "压力" )); + @Override public DeviceReport decode(DeviceData deviceData, String clientId) { try { DeviceReport reportMessage = new DeviceReport(); - String data = new String(deviceData.getData(),StandardCharsets.UTF_8); + String data = new String(deviceData.getData(), StandardCharsets.UTF_8); List result = new ArrayList<>(); - if(data.trim().equals("ok")||data.trim().equals("ERROR")){ + if (data.trim().equals("ok") || data.trim().equals("ERROR")) { log.info(data); - }else{ - Map values = JSON.parseObject(data, Map.class); + } else { + Map values = JSON.parseObject(data, Map.class); // if (values.containsKey("AD1") || values.containsKey("lng") || values.containsKey("I0.1")||values.containsKey("PAD")||values.containsKey("K1")){ - // 初始化纬度变量,使用BigDecimal来存储高精度值 - BigDecimal latitude = new BigDecimal("39.9042"); - // 初始化经度变量,同样使用BigDecimal - BigDecimal longitude = new BigDecimal("116.4074"); - for (Map.Entry entry : values.entrySet()) { + // 初始化纬度变量,使用BigDecimal来存储高精度值 + BigDecimal latitude = new BigDecimal("39.9042"); + // 初始化经度变量,同样使用BigDecimal + BigDecimal longitude = new BigDecimal("116.4074"); + String volt = ""; + Integer rssi = 0; + String sd = ""; + String pd = ""; + String imei = ""; + String iccid = ""; + Device device = new Device(); + for (Map.Entry entry : values.entrySet()) { // if (EXCLUDE_KEYS.contains(entry.getKey())){ - ThingsModelSimpleItem simpleItem = new ThingsModelSimpleItem(); - simpleItem.setTs(DateUtils.getNowDate()); - simpleItem.setId(entry.getKey()); - simpleItem.setValue(entry.getValue()+""); - result.add(simpleItem); - if(values.containsKey("lng")) { - if (entry.getKey().equals("lng")) { - longitude = new BigDecimal(entry.getValue() + ""); + ThingsModelSimpleItem simpleItem = new ThingsModelSimpleItem(); + simpleItem.setTs(DateUtils.getNowDate()); + simpleItem.setId(entry.getKey()); + simpleItem.setValue(entry.getValue() + ""); + result.add(simpleItem); + if (entry.getKey().equals("lng")) { + longitude = new BigDecimal(entry.getValue() + ""); + device.setLongitude(longitude); - } - if (entry.getKey().equals("lat")) { - latitude = new BigDecimal(entry.getValue() + ""); - - } - //更新设备经纬度信息 - Device device = new Device(); - device.setSerialNumber(deviceData.getSerialNumber()); - device.setLongitude(longitude); - device.setLatitude(latitude); - deviceService.updateDeviceStatus(device); - } -// } } -// } + if (entry.getKey().equals("lat")) { + latitude = new BigDecimal(entry.getValue() + ""); + device.setLatitude(latitude); + + } + if (entry.getKey().equals("PAD")) { +// volt = entry.getValue() + ""; + BigDecimal num = new BigDecimal( entry.getValue() + ""); + volt = num.divide(new BigDecimal("1000"), 2, BigDecimal.ROUND_HALF_UP).toPlainString(); + device.setVolt(volt); + } + if (entry.getKey().equals("CSQ")) { + rssi = Integer.parseInt(entry.getValue() + ""); + device.setRssi(rssi); + } + + if (entry.getKey().equals("SD")) { + BigDecimal num1 = new BigDecimal( entry.getValue() + ""); + sd = num1.divide(new BigDecimal("1000"), 3, BigDecimal.ROUND_HALF_UP).toPlainString(); + device.setSd(sd); + + } + if (entry.getKey().equals("BD")) { + BigDecimal num2 = new BigDecimal( entry.getValue() + ""); + pd = num2.divide(new BigDecimal("1000"), 3, BigDecimal.ROUND_HALF_UP).toPlainString(); + device.setPd(pd); + } + if (entry.getKey().equals("ICCID")) { + iccid = entry.getValue() + ""; + device.setIccid(iccid); + } + if (entry.getKey().equals("IMEI")) { + imei = entry.getValue() + ""; + device.setImei(imei); + } +// } + } + if (values.containsKey("lng")) { + //更新设备经纬度信息 +// Device device = new Device(); + device.setSerialNumber(deviceData.getSerialNumber()); +// device.setLongitude(longitude); +// device.setLatitude(latitude); +// device.setVolt(volt); +// device.setRssi(rssi); +// device.setSd(sd); +// device.setPd(pd); + deviceService.updateDeviceStatus(device); + } + + } reportMessage.setThingsModelSimpleItem(result); reportMessage.setClientId(clientId); reportMessage.setSerialNumber(clientId); return reportMessage; - }catch (Exception e){ - throw new ServiceException("数据解析异常"+e.getMessage()); + } catch (Exception e) { + throw new ServiceException("数据解析异常" + e.getMessage()); } } @@ -180,7 +225,8 @@ public class IECF6113ProtocolService implements IProtocol { * 4.更改上报时间 GKB29810,JCZ,{"TIME":20} * 5.通 信 控制 GKB29810,MODBUS, {"KO":12} * 6.开关量输出控制 GKB29810,OUT,{"Q0.1":0,"Q0.2":0,"Q0.3":0,"Q0.4":0,"Q0.5":0,"Q0.6":0} - * GKB29810,0UT,{"Q0.1":1 ,"Q0.2":1,"Q0.3":1,"Q0.4":1,"Q0.5":1 "Q0.6":1) + * GKB29810,0UT,{"Q0.1":1 ,"Q0.2":1,"Q0.3":1,"Q0.4":1,"Q0.5":1 "Q0.6":1) + * * @param message * @return */ @@ -238,21 +284,21 @@ public class IECF6113ProtocolService implements IProtocol { callBack.setMessage(msg.toString().getBytes()); } - if(params.containsKey("select")) { - String msg = params.get("select") + ""; - callBack.setSources(msg); - callBack.setMessage(msg.getBytes()); - } - if(params.containsKey("OUT")){ - String msg = params.get("OUT") + ""; - callBack.setSources(msg); - callBack.setMessage(msg.getBytes()); - } - if(params.containsKey("TIME")){ - String msg = "GKB29810,JCZ,{\"TIME\":" + params.get("TIME")+ "}"; - callBack.setSources(msg); - callBack.setMessage(msg.getBytes()); - } + if (params.containsKey("select")) { + String msg = params.get("select") + ""; + callBack.setSources(msg); + callBack.setMessage(msg.getBytes()); + } + if (params.containsKey("OUT")) { + String msg = params.get("OUT") + ""; + callBack.setSources(msg); + callBack.setMessage(msg.getBytes()); + } + if (params.containsKey("TIME")) { + String msg = "GKB29810,JCZ,{\"TIME\":" + params.get("TIME") + "}"; + callBack.setSources(msg); + callBack.setMessage(msg.getBytes()); + } // 调用方法检查并获取以前缀开头的键和值 Map result = getKeysAndValuesWithPrefix(params, "Q0."); // 输出结果 diff --git a/xinda-scada/src/main/java/com/xinda/scada/controller/ScadaController.java b/xinda-scada/src/main/java/com/xinda/scada/controller/ScadaController.java index a93016e..e324684 100644 --- a/xinda-scada/src/main/java/com/xinda/scada/controller/ScadaController.java +++ b/xinda-scada/src/main/java/com/xinda/scada/controller/ScadaController.java @@ -7,10 +7,12 @@ import com.xinda.common.config.RuoYiConfig; import com.xinda.common.constant.HttpStatus; import com.xinda.common.core.controller.BaseController; import com.xinda.common.core.domain.AjaxResult; +import com.xinda.common.core.domain.entity.SysUser; import com.xinda.common.core.page.TableDataInfo; import com.xinda.common.enums.BusinessType; import com.xinda.common.exception.ServiceException; import com.xinda.common.exception.file.InvalidExtensionException; +import com.xinda.common.utils.MessageUtils; import com.xinda.common.utils.StringUtils; import com.xinda.common.utils.file.MimeTypeUtils; import com.xinda.common.utils.poi.ExcelUtil; @@ -23,15 +25,13 @@ import com.xinda.iot.service.IDeviceService; import com.xinda.scada.domain.Scada; import com.xinda.scada.domain.ScadaDeviceBind; import com.xinda.scada.domain.ScadaGallery; +import com.xinda.scada.enums.ScadaTypeEnum; import com.xinda.scada.service.IScadaDeviceBindService; import com.xinda.scada.service.IScadaService; import com.xinda.scada.utils.ScadaCollectionUtils; import com.xinda.scada.utils.ScadaFileUploadUtils; import com.xinda.scada.utils.ScadaFileUtils; -import com.xinda.scada.vo.DeviceRealDataVO; -import com.xinda.scada.vo.FavoritesVO; -import com.xinda.scada.vo.ScadaDeviceBindDTO; -import com.xinda.scada.vo.ThingsModelHistoryParam; +import com.xinda.scada.vo.*; import com.github.pagehelper.PageInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -115,9 +115,9 @@ public class ScadaController extends BaseController @PreAuthorize("@ss.hasPermi('scada:center:add')") @Log(title = "组态中心", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody Scada scada) + public AjaxResult add(@RequestBody ScadaVO scadaVO) { - return scadaService.insertScada(scada); + return scadaService.insertScada(scadaVO); } /** @@ -127,9 +127,9 @@ public class ScadaController extends BaseController @PreAuthorize("@ss.hasPermi('scada:center:edit')") @Log(title = "组态中心", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody Scada scada) + public AjaxResult edit(@RequestBody ScadaVO scadaVO) { - return toAjax(scadaService.updateScada(scada)); + return toAjax(scadaService.updateScada(scadaVO)); } /** @@ -164,32 +164,43 @@ public class ScadaController extends BaseController @Log(title = "组态中心", businessType = BusinessType.INSERT) @PreAuthorize("@ss.hasPermi('scada:center:edit')") @PostMapping("/save") - public AjaxResult save(@RequestBody Scada scada) + public AjaxResult save(@RequestBody ScadaVO scadaVO) { - if (StringUtils.isEmpty(scada.getGuid())) { - return AjaxResult.error("guid不能为空"); + if (StringUtils.isEmpty(scadaVO.getGuid())) { + return AjaxResult.error(MessageUtils.message("scada.guid.cannot.empty")); + } + if (null == scadaVO.getType()) { + scadaVO.setType(ScadaTypeEnum.PUBLIC.getType()); } Scada scadaQuery = new Scada(); - scadaQuery.setGuid(scada.getGuid()); - List scadaList = scadaService.selectScadaList(scadaQuery); - if (StringUtils.isNotEmpty(scada.getBase64())) { - MultipartFile multipartFile = ScadaFileUtils.base64toMultipartFile(scada.getBase64()); + scadaQuery.setGuid(scadaVO.getGuid()); + List scadaVOList = scadaService.listScadaVO(scadaQuery); + if (StringUtils.isNotEmpty(scadaVO.getBase64())) { + MultipartFile multipartFile = ScadaFileUtils.base64toMultipartFile(scadaVO.getBase64()); String url; try { url = ScadaFileUploadUtils.upload(RuoYiConfig.getUploadPath(), multipartFile, MimeTypeUtils.IMAGE_EXTENSION); } catch (IOException | InvalidExtensionException e) { - throw new ServiceException("修改组态base64转图片异常" + e.getMessage()); + throw new ServiceException(StringUtils.format(MessageUtils.message("scada.base64.change.image.exception"), e.getMessage())); } - scada.setPageImage(url); + scadaVO.setPageImage(url); } - if (CollectionUtils.isNotEmpty(scadaList)) { - Scada updateScada = scadaList.get(0); - updateScada.setScadaData(scada.getScadaData()); - updateScada.setPageImage(scada.getPageImage()); - scadaService.updateScada(updateScada); + if (CollectionUtils.isNotEmpty(scadaVOList)) { + ScadaVO updateScadaVO = scadaVOList.get(0); + updateScadaVO.setScadaData(scadaVO.getScadaData()); + updateScadaVO.setPageImage(scadaVO.getPageImage()); + scadaService.updateScada(updateScadaVO); } else { - scadaService.insertScada(scada); -// scadaDeviceBindService.insertScadaDeviceBind() + // 多租户版本使用 + SysUser user = getLoginUser().getUser(); + if (null != user.getDeptId()) { + scadaVO.setTenantId(user.getDept().getDeptUserId()); + scadaVO.setTenantName(user.getDept().getDeptUserName()); + } else { + scadaVO.setTenantId(user.getUserId()); + scadaVO.setTenantName(user.getUserName()); + } + scadaService.insertScada(scadaVO); } return AjaxResult.success(); } @@ -374,39 +385,7 @@ public class ScadaController extends BaseController // @PreAuthorize("@ss.hasPermi('scada:center:add')") @PostMapping("/importJson") public AjaxResult importJson(MultipartFile file, String guid) throws IOException { - InputStream inputStream = file.getInputStream(); - if(file.isEmpty()){ - return AjaxResult.error("无效的配置文件"); - } - if(file.getOriginalFilename().indexOf("json")==-1){ - return AjaxResult.error("无效的配置文件"); - } - Scada scada = new Scada(); - try { - scada = JSON.parseObject(inputStream, Scada.class); - }catch (Exception e){ - return AjaxResult.error("无效的配置文件"); - }finally { - inputStream.close(); - } - Scada oldScada = new Scada(); - if (StringUtils.isNotEmpty(guid)) { - Scada queryScada = new Scada(); - queryScada.setGuid(guid); - List scadaList = scadaService.selectScadaList(queryScada); - if (CollectionUtils.isNotEmpty(scadaList)) { - oldScada = scadaList.get(0); - } - } - if (oldScada == null) { - guid= UUID.randomUUID().toString(); - scada.setGuid(guid); - scadaService.insertScada(scada); - } else { - scada.setId(oldScada.getId()); - scadaService.updateScada(scada); - } - return AjaxResult.success("导入成功"); + return scadaService.importJson(file, guid); } /** diff --git a/xinda-scada/src/main/java/com/xinda/scada/convert/ScadaConvert.java b/xinda-scada/src/main/java/com/xinda/scada/convert/ScadaConvert.java new file mode 100644 index 0000000..aad18f8 --- /dev/null +++ b/xinda-scada/src/main/java/com/xinda/scada/convert/ScadaConvert.java @@ -0,0 +1,70 @@ +package com.xinda.scada.convert; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.xinda.scada.domain.Scada; +import com.xinda.scada.vo.ScadaVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 组态页面Convert转换类 + * + * @author zhuangpeng.li + * @date 2024-12-04 + */ +@Mapper +public interface ScadaConvert +{ + + ScadaConvert INSTANCE = Mappers.getMapper(ScadaConvert.class); + + /** + * 实体类转换为VO类 + * + * @param scada + * @return 组态页面集合 + */ + ScadaVO convertScadaVO(Scada scada); + + /** + * VO类转换为实体类集合 + * + * @param scadaVO + * @return 组态页面集合 + */ + Scada convertScada(ScadaVO scadaVO); + + /** + * 实体类转换为VO类集合 + * + * @param scadaList + * @return 组态页面集合 + */ + List convertScadaVOList(List scadaList); + + /** + * VO类转换为实体类 + * + * @param scadaVOList + * @return 组态页面集合 + */ + List convertScadaList(List scadaVOList); + + /** + * 实体类转换为VO类分页 + * + * @param scadaPage + * @return 组态页面分页 + */ + Page convertScadaVOPage(Page scadaPage); + + /** + * VO类转换为实体类 + * + * @param scadaVOPage + * @return 组态页面分页 + */ + Page convertScadaPage(Page scadaVOPage); +} diff --git a/xinda-scada/src/main/java/com/xinda/scada/domain/Scada.java b/xinda-scada/src/main/java/com/xinda/scada/domain/Scada.java index 613f80f..7b79223 100644 --- a/xinda-scada/src/main/java/com/xinda/scada/domain/Scada.java +++ b/xinda-scada/src/main/java/com/xinda/scada/domain/Scada.java @@ -4,6 +4,7 @@ import com.xinda.common.annotation.Excel; import com.xinda.common.core.domain.BaseEntity; import com.xinda.scada.vo.ScadaBindDeviceSimVO; import com.xinda.scada.vo.ScadaDeviceBindVO; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -70,6 +71,8 @@ public class Scada extends BaseEntity @Excel(name = "页面图片") private String pageImage; + private Long deptId; + /** 租户id */ @Excel(name = "租户id") private Long tenantId; @@ -83,6 +86,10 @@ public class Scada extends BaseEntity private String base64; + /** 组态类型 1- 模板组态 2- 场景组态 3-公共组态 */ + @ApiModelProperty("组态类型 1- 模板组态 2- 场景组态 3-公共组态") + private Integer type; + private List bindDeviceList; } diff --git a/xinda-scada/src/main/java/com/xinda/scada/enums/ScadaTypeEnum.java b/xinda-scada/src/main/java/com/xinda/scada/enums/ScadaTypeEnum.java new file mode 100644 index 0000000..9013aad --- /dev/null +++ b/xinda-scada/src/main/java/com/xinda/scada/enums/ScadaTypeEnum.java @@ -0,0 +1,38 @@ +package com.xinda.scada.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; +import java.util.List; + +/** + * 组态类型枚举 + * @author fastb + * @date 2024-05-22 10:01 + * @version 1.0 + */ +@Getter +@AllArgsConstructor +public enum ScadaTypeEnum { + + PRODUCT_TEMPLATE(1, "模版组态"), + SCENE_MODEL(2, "场景组态"), + PUBLIC(3, "公共组态"); + + + + private final Integer type; + + private final String name; + + public static ScadaTypeEnum getByType(Integer type) { + for (ScadaTypeEnum scadaTypeEnum : ScadaTypeEnum.values()) { + if (scadaTypeEnum.getType().equals(type)) { + return scadaTypeEnum; + } + } + return null; + } + +} diff --git a/xinda-scada/src/main/java/com/xinda/scada/mapper/ScadaDeviceBindMapper.java b/xinda-scada/src/main/java/com/xinda/scada/mapper/ScadaDeviceBindMapper.java index 146c7a7..47fe9e6 100644 --- a/xinda-scada/src/main/java/com/xinda/scada/mapper/ScadaDeviceBindMapper.java +++ b/xinda-scada/src/main/java/com/xinda/scada/mapper/ScadaDeviceBindMapper.java @@ -69,4 +69,6 @@ public interface ScadaDeviceBindMapper * @return java.util.List */ List listDeviceSimByGuid(String guid); + + List selectScadaDeviceBindListByIds(List guidList); } diff --git a/xinda-scada/src/main/java/com/xinda/scada/mapper/ScadaMapper.java b/xinda-scada/src/main/java/com/xinda/scada/mapper/ScadaMapper.java index 9c2ea70..c6964c9 100644 --- a/xinda-scada/src/main/java/com/xinda/scada/mapper/ScadaMapper.java +++ b/xinda-scada/src/main/java/com/xinda/scada/mapper/ScadaMapper.java @@ -59,6 +59,7 @@ public interface ScadaMapper */ public int deleteScadaById(Long id); + public int deleteScadaByGuid(String guid); /** * 批量删除组态中心 * @@ -96,4 +97,20 @@ public interface ScadaMapper * @return java.util.List */ List listEventLogHistory(EventLog eventLog); + + String selectGuidBySceneModelId(Long sceneModelId); + + String selectGuidByProductId(Long productId); + + void updateProductGuid(@Param("productId") Long productId, @Param("guid") String guid); + + void updateSceneModelGuid( @Param("sceneModelId") Long sceneModelId, @Param("guid") String guid); + + void deleteProductByGuids(List guids); + + void deleteSceneModelByGuids(List guids); + + Long selectProductByGuid(String guid); + + Long selectSceneModelByGuid(String guid); } diff --git a/xinda-scada/src/main/java/com/xinda/scada/service/IScadaService.java b/xinda-scada/src/main/java/com/xinda/scada/service/IScadaService.java index 3d04620..256e658 100644 --- a/xinda-scada/src/main/java/com/xinda/scada/service/IScadaService.java +++ b/xinda-scada/src/main/java/com/xinda/scada/service/IScadaService.java @@ -3,19 +3,17 @@ package com.xinda.scada.service; import com.xinda.common.core.domain.AjaxResult; import com.xinda.scada.domain.Scada; import com.xinda.scada.domain.ScadaGallery; -import com.xinda.scada.vo.FavoritesVO; -import com.xinda.scada.vo.ScadaHistoryModelVO; -import com.xinda.scada.vo.ScadaStatisticVO; -import com.xinda.scada.vo.ThingsModelHistoryParam; +import com.xinda.scada.vo.*; import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; import java.util.List; import java.util.Map; /** * 组态中心Service接口 * - * @author kerwincui + * @author kerwincuiIScadaService * @date 2023-11-10 */ public interface IScadaService @@ -26,7 +24,7 @@ public interface IScadaService * @param id 组态中心主键 * @return 组态中心 */ - public Scada selectScadaById(Long id); + public ScadaVO selectScadaById(Long id); /** * 查询组态中心列表 @@ -39,18 +37,20 @@ public interface IScadaService /** * 新增组态中心 * - * @param scada 组态中心 + * @param scadaVO 组态中心 * @return 结果 */ + public AjaxResult insertScada(ScadaVO scadaVO); + public AjaxResult insertScada(Scada scada); /** * 修改组态中心 * - * @param scada 组态中心 + * @param scadaVO 组态中心 * @return 结果 */ - public int updateScada(Scada scada); + public int updateScada(ScadaVO scadaVO); /** * 批量删除组态中心 @@ -68,6 +68,8 @@ public interface IScadaService */ public int deleteScadaById(Long id); + public int deleteScadaByGuid(String guid); + /** * 根据guid获取组态详情 * @param guid 组态id @@ -120,4 +122,8 @@ public interface IScadaService * @return com.xinda.common.core.domain.AjaxResult */ ScadaStatisticVO selectStatistic(); + + List listScadaVO(Scada scadaQuery); + + AjaxResult importJson(MultipartFile file, String guid) throws IOException; } diff --git a/xinda-scada/src/main/java/com/xinda/scada/service/impl/ScadaServiceImpl.java b/xinda-scada/src/main/java/com/xinda/scada/service/impl/ScadaServiceImpl.java index cc20525..728c8a8 100644 --- a/xinda-scada/src/main/java/com/xinda/scada/service/impl/ScadaServiceImpl.java +++ b/xinda-scada/src/main/java/com/xinda/scada/service/impl/ScadaServiceImpl.java @@ -1,12 +1,17 @@ package com.xinda.scada.service.impl; +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.xinda.common.config.RuoYiConfig; +import com.xinda.common.constant.HttpStatus; import com.xinda.common.core.domain.AjaxResult; import com.xinda.common.core.domain.entity.SysRole; import com.xinda.common.core.domain.entity.SysUser; import com.xinda.common.core.domain.model.LoginUser; import com.xinda.common.core.redis.RedisCache; +import com.xinda.common.exception.ServiceException; import com.xinda.common.utils.DateUtils; +import com.xinda.common.utils.MessageUtils; import com.xinda.common.utils.StringUtils; import com.xinda.common.utils.bean.BeanUtils; import com.xinda.common.utils.file.FileUploadUtils; @@ -15,8 +20,11 @@ import com.xinda.iot.domain.EventLog; import com.xinda.iot.domain.FunctionLog; import com.xinda.iot.model.HistoryModel; import com.xinda.iot.service.IDeviceLogService; +import com.xinda.scada.convert.ScadaConvert; import com.xinda.scada.domain.Scada; +import com.xinda.scada.domain.ScadaDeviceBind; import com.xinda.scada.domain.ScadaGallery; +import com.xinda.scada.enums.ScadaTypeEnum; import com.xinda.scada.mapper.ScadaDeviceBindMapper; import com.xinda.scada.mapper.ScadaGalleryMapper; import com.xinda.scada.mapper.ScadaMapper; @@ -27,6 +35,8 @@ import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.io.IOException; +import java.io.InputStream; import java.util.*; import java.util.stream.Collectors; @@ -59,9 +69,21 @@ public class ScadaServiceImpl implements IScadaService * @return 组态中心 */ @Override - public Scada selectScadaById(Long id) + public ScadaVO selectScadaById(Long id) { - return scadaMapper.selectScadaById(id); + Scada scada = scadaMapper.selectScadaById(id); + if (Objects.isNull(scada)) { + return null; + } + ScadaVO scadaVO = ScadaConvert.INSTANCE.convertScadaVO(scada); + if (ScadaTypeEnum.PRODUCT_TEMPLATE.getType().equals(scada.getType())) { + Long productId = scadaMapper.selectProductByGuid(scada.getGuid()); + scadaVO.setProductId(productId); + } else if (ScadaTypeEnum.SCENE_MODEL.getType().equals(scada.getType())) { + Long sceneModelId = scadaMapper.selectSceneModelByGuid(scada.getGuid()); + scadaVO.setSceneModelId(sceneModelId); + } + return scadaVO; } /** @@ -79,32 +101,126 @@ public class ScadaServiceImpl implements IScadaService /** * 新增组态中心 * - * @param scada 组态中心 + * @param scadaVO 组态中心 * @return 结果 */ @Override - public AjaxResult insertScada(Scada scada) + public AjaxResult insertScada(ScadaVO scadaVO) { +// scadaVO.setPageName("综合测试GKB-29813组态"); +// scadaVO.setProductId(219L); +// scadaVO.setType(1); LoginUser loginUser = getLoginUser(); if (loginUser == null) { - return AjaxResult.error("请登录后重试!"); + return AjaxResult.error(MessageUtils.message("scada.please.login")); + } + if (ScadaTypeEnum.PRODUCT_TEMPLATE.getType().equals(scadaVO.getType())) { + String guid = scadaMapper.selectGuidByProductId(scadaVO.getProductId()); + if (StringUtils.isNotEmpty(guid)){ + return AjaxResult.warn(MessageUtils.message("scada.product.has.relate.please.select.again")); + } + } + if (ScadaTypeEnum.SCENE_MODEL.getType().equals(scadaVO.getType())) { + String guid = scadaMapper.selectGuidBySceneModelId(scadaVO.getSceneModelId()); + if (StringUtils.isNotEmpty(guid)){ + return AjaxResult.warn(MessageUtils.message("scada.scene.has.relate.please.select.again")); + } + } + // 多租户版本使用 + SysUser user = getLoginUser().getUser(); + if (null != user.getDeptId()) { + scadaVO.setTenantId(user.getDept().getDeptUserId()); + scadaVO.setTenantName(user.getDept().getDeptUserName()); + } else { + scadaVO.setTenantId(user.getUserId()); + scadaVO.setTenantName(user.getUserName()); + } + scadaVO.setCreateBy(loginUser.getUserId().toString()); + UUID uuid = UUID.randomUUID(); + scadaVO.setGuid(uuid.toString()); + Scada scada = ScadaConvert.INSTANCE.convertScada(scadaVO); + int result = scadaMapper.insertScada(scada); + if (result >0){ + if (ScadaTypeEnum.PRODUCT_TEMPLATE.getType().equals(scadaVO.getType())) { + scadaMapper.updateProductGuid(scadaVO.getProductId(), uuid.toString()); + } + if (ScadaTypeEnum.SCENE_MODEL.getType().equals(scadaVO.getType())) { + scadaMapper.updateSceneModelGuid(scadaVO.getSceneModelId(), uuid.toString()); + } + return AjaxResult.success(uuid.toString()); + }else { + return AjaxResult.error(); + } + } + + @Override + public AjaxResult insertScada(Scada scada){ + + LoginUser loginUser = getLoginUser(); + if (loginUser == null) { + return AjaxResult.error(MessageUtils.message("scada.please.login")); + } + // 多租户版本使用 + SysUser user = getLoginUser().getUser(); + if (null != user.getDeptId()) { + scada.setTenantId(user.getDept().getDeptUserId()); + scada.setTenantName(user.getDept().getDeptUserName()); + } else { + scada.setTenantId(user.getUserId()); + scada.setTenantName(user.getUserName()); } scada.setCreateBy(loginUser.getUserId().toString()); - UUID uuid = UUID.randomUUID(); - scada.setGuid(uuid.toString()); - return scadaMapper.insertScada(scada) > 0 ? AjaxResult.success() : AjaxResult.error(); + int result = scadaMapper.insertScada(scada); + if (result >0){ + return AjaxResult.success(scada.getGuid()); + }else { + return AjaxResult.error(); + } } + /** + * 查询组态页面列表 + * + * @param scada 组态页面 + * @return 组态页面 + */ + @Override + public List listScadaVO(Scada scada) { + List scadaList = scadaMapper.selectScadaList(scada); + return ScadaConvert.INSTANCE.convertScadaVOList(scadaList); + } + + /** * 修改组态中心 * - * @param scada 组态中心 + * @param scadaVO 组态中心 * @return 结果 */ @Override - public int updateScada(Scada scada) + public int updateScada(ScadaVO scadaVO) { - scada.setUpdateTime(DateUtils.getNowDate()); + if (ScadaTypeEnum.PRODUCT_TEMPLATE.getType().equals(scadaVO.getType()) && null != scadaVO.getProductId()) { + String guid = scadaMapper.selectGuidByProductId(scadaVO.getProductId()); + if (StringUtils.isNotEmpty(guid) && !guid.equals(scadaVO.getGuid())){ + throw new ServiceException(MessageUtils.message("scada.product.has.relate.please.select.again"), HttpStatus.WARN); + } + if (StringUtils.isEmpty(guid)) { + scadaMapper.deleteProductByGuids(Collections.singletonList(scadaVO.getGuid())); + scadaMapper.updateProductGuid(scadaVO.getProductId(), scadaVO.getGuid()); + } + } + if (ScadaTypeEnum.SCENE_MODEL.getType().equals(scadaVO.getType()) && null != scadaVO.getSceneModelId()) { + String guid = scadaMapper.selectGuidBySceneModelId(scadaVO.getSceneModelId()); + if (StringUtils.isNotEmpty(guid) && !guid.equals(scadaVO.getGuid())){ + throw new ServiceException(MessageUtils.message("scada.scene.has.relate.please.select.again"), HttpStatus.WARN); + } + if (StringUtils.isEmpty(guid)) { + scadaMapper.deleteSceneModelByGuids(Collections.singletonList(scadaVO.getGuid())); + scadaMapper.updateSceneModelGuid(scadaVO.getSceneModelId(), scadaVO.getGuid()); + } + } + Scada scada = ScadaConvert.INSTANCE.convertScada(scadaVO); return scadaMapper.updateScada(scada); } @@ -132,6 +248,11 @@ public class ScadaServiceImpl implements IScadaService return scadaMapper.deleteScadaById(id); } + @Override + public int deleteScadaByGuid(String guid) { + return scadaMapper.deleteScadaByGuid(guid); + } + /** * 根据guid获取组态详情 * @param guid 组态id @@ -301,4 +422,60 @@ public class ScadaServiceImpl implements IScadaService } return statistic; } + + @Override + public AjaxResult importJson(MultipartFile file, String guid) throws IOException { + InputStream inputStream = file.getInputStream(); + if(file.isEmpty()){ + return AjaxResult.error(MessageUtils.message("scada.invalid.profile")); + } + if(file.getOriginalFilename().indexOf("json")==-1){ + return AjaxResult.error(MessageUtils.message("scada.invalid.profile")); + } + Scada scada = new Scada(); + try { + scada = JSON.parseObject(inputStream, Scada.class); + }catch (Exception e){ + return AjaxResult.error(MessageUtils.message("scada.invalid.profile")); + }finally { + inputStream.close(); + } + Scada oldScada = new Scada(); + if (StringUtils.isNotEmpty(guid)) { + Scada queryScada = new Scada(); + queryScada.setGuid(guid); + List scadaList = scadaMapper.selectScadaList(queryScada); + if (CollectionUtils.isNotEmpty(scadaList)) { + oldScada = scadaList.get(0); + } + } + String importGuid = scada.getGuid(); + Long tenantId = scada.getTenantId(); + oldScada.setScadaData(scada.getScadaData()); + int i = scadaMapper.updateScada(oldScada); + if (i <= 0) { + return AjaxResult.error(MessageUtils.message("import.fail")); + } + if (!tenantId.equals(oldScada.getTenantId())) { + return AjaxResult.success(MessageUtils.message("scada.import.success.need.replace.variable")); + } + if (StringUtils.isNotEmpty(importGuid) && ScadaTypeEnum.PUBLIC.getType().equals(oldScada.getType()) + && ScadaTypeEnum.PUBLIC.getType().equals(scada.getType())) { + List guidList = Arrays.asList(guid, importGuid); + List scadaDeviceBinds = scadaDeviceBindMapper.selectScadaDeviceBindListByIds(guidList); + if (CollectionUtils.isNotEmpty(scadaDeviceBinds)) { + List serialNumbers = scadaDeviceBinds.stream().filter(d -> guid.equals(d.getScadaGuid())).map(ScadaDeviceBind::getSerialNumber).collect(Collectors.toCollection(ArrayList::new)); + List importSerialNumbers = scadaDeviceBinds.stream().filter(d -> importGuid.equals(d.getScadaGuid())).map(ScadaDeviceBind::getSerialNumber).collect(Collectors.toCollection(ArrayList::new)); + importSerialNumbers.removeAll(serialNumbers); + for (String importSerialNumber : importSerialNumbers) { + ScadaDeviceBind scadaDeviceBind = new ScadaDeviceBind(); + scadaDeviceBind.setScadaGuid(guid); + scadaDeviceBind.setSerialNumber(importSerialNumber); + scadaDeviceBindMapper.insertScadaDeviceBind(scadaDeviceBind); + } + } + return AjaxResult.success(MessageUtils.message("import.success")); + } + return AjaxResult.success(MessageUtils.message("scada.import.success.need.replace.variable")); + } } diff --git a/xinda-scada/src/main/java/com/xinda/scada/vo/ScadaVO.java b/xinda-scada/src/main/java/com/xinda/scada/vo/ScadaVO.java new file mode 100644 index 0000000..bbc6e9c --- /dev/null +++ b/xinda-scada/src/main/java/com/xinda/scada/vo/ScadaVO.java @@ -0,0 +1,162 @@ +package com.xinda.scada.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.xinda.common.annotation.Excel; +import com.xinda.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Setter; + +import java.io.Serializable; +import java.util.*; + + +/** + * 组态页面对象 scada + * + * @author zhuangpeng.li + * @date 2024-12-04 + */ + +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "ScadaVO", description = "组态页面 scada") +@Data +public class ScadaVO extends BaseEntity { + + /** id唯一标识 */ + @Excel(name = "id唯一标识") + @ApiModelProperty("id唯一标识") + private Long id; + + /** 组态id */ + @Excel(name = "组态id") + @ApiModelProperty("组态id") + private String guid; + + /** 组态信息 */ + @Excel(name = "组态信息") + @ApiModelProperty("组态信息") + private String scadaData; + + /** 设备编号 */ + @Excel(name = "设备编号") + @ApiModelProperty("设备编号") + private String serialNumbers; + + /** 设备名称 */ + @Excel(name = "设备名称") + @ApiModelProperty("设备名称") + private String deviceName; + + /** 是否主界面 */ + @Excel(name = "是否主界面") + @ApiModelProperty("是否主界面") + private Integer isMainPage; + + /** 页面名称 */ + @Excel(name = "页面名称") + @ApiModelProperty("页面名称") + private String pageName; + + /** 页面大小 */ + @Excel(name = "页面大小") + @ApiModelProperty("页面大小") + private String pageResolution; + + /** 是否分享 */ + @Excel(name = "是否分享") + @ApiModelProperty("是否分享") + private Integer isShare; + + /** 分享链接 */ + @Excel(name = "分享链接") + @ApiModelProperty("分享链接") + private String shareUrl; + + /** 分享密码 */ + @Excel(name = "分享密码") + @ApiModelProperty("分享密码") + private String sharePass; + + /** 页面图片 */ + @Excel(name = "页面图片") + @ApiModelProperty("页面图片") + private String pageImage; + + /** 租户id */ + @Excel(name = "租户id") + @ApiModelProperty("租户id") + private Long tenantId; + + /** 租户名称 */ + @Excel(name = "租户名称") + @ApiModelProperty("租户名称") + private String tenantName; + + /** 创建人 */ + @Excel(name = "创建人") + @ApiModelProperty("创建人") + private String createBy; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("创建时间") + @Excel(name = "创建时间") + private Date createTime; + + /** 更新人 */ + @Excel(name = "更新人") + @ApiModelProperty("更新人") + private String updateBy; + + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("更新时间") + @Excel(name = "更新时间") + private Date updateTime; + + /** 逻辑删除标识 */ + @Excel(name = "逻辑删除标识") + @ApiModelProperty("逻辑删除标识") + private Integer delFlag; + + /** 备注 */ + @Excel(name = "备注") + @ApiModelProperty("备注") + private String remark; + + /** 组态类型 1- 模板组态 2- 场景组态 3-公共组态 */ + @Excel(name = "组态类型 1- 模板组态 2- 场景组态 3-公共组态") + @ApiModelProperty("组态类型 1- 模板组态 2- 场景组态 3-公共组态") + private Integer type; + + /** 分享短链接 */ + @Excel(name = "分享短链接") + @ApiModelProperty("分享短链接") + private String shareShortUrl; + + /** + * 绑定的产品id + */ + private Long productId; + + /** + * 场景id + */ + private Long sceneModelId; + + private List bindDeviceList = new ArrayList<>(); + + private String base64; + + /** + * 设备编号 + */ + private String serialNumber; + +} diff --git a/xinda-scada/src/main/resources/mapper/ScadaDeviceBindMapper.xml b/xinda-scada/src/main/resources/mapper/ScadaDeviceBindMapper.xml index 044bbae..0025e35 100644 --- a/xinda-scada/src/main/resources/mapper/ScadaDeviceBindMapper.xml +++ b/xinda-scada/src/main/resources/mapper/ScadaDeviceBindMapper.xml @@ -22,6 +22,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + select product_id + from iot_product + where guid = #{guid} + and del_flag = '0' + + + + + update scada_device_bind diff --git a/xinda-scada/src/main/resources/mapper/ScadaMapper.xml b/xinda-scada/src/main/resources/mapper/ScadaMapper.xml index 2269951..4c1b021 100644 --- a/xinda-scada/src/main/resources/mapper/ScadaMapper.xml +++ b/xinda-scada/src/main/resources/mapper/ScadaMapper.xml @@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -24,28 +25,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select id, guid, scada_data, serial_numbers, device_name, is_main_page, page_name, page_resolution, is_share, share_url, share_pass, page_image, tenant_id, tenant_name, create_by, create_time, update_by, update_time, del_flag from scada + select id, guid, scada_data, serial_numbers, device_name, is_main_page, page_name, page_resolution, is_share, share_url, share_pass, page_image, dept_id,tenant_id, tenant_name, create_by, create_time, update_by, update_time, del_flag, type from scada @@ -74,6 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and u.user_id = #{userId} and d.tenant_id = #{tenantId} + ) as deviceCount, @@ -216,6 +225,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" share_url, share_pass, page_image, + dept_id, tenant_id, tenant_name, create_by, @@ -224,6 +234,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_time, del_flag, remark, + type, #{guid}, @@ -237,6 +248,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{shareUrl}, #{sharePass}, #{pageImage}, + #{deptId}, #{tenantId}, #{tenantName}, #{createBy}, @@ -245,6 +257,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateTime}, #{delFlag}, #{remark}, + #{type}, @@ -262,6 +275,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" share_url = #{shareUrl}, share_pass = #{sharePass}, page_image = #{pageImage}, + dept_id = #{deptId}, tenant_id = #{tenantId}, tenant_name = #{tenantName}, create_by = #{createBy}, @@ -270,6 +284,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_time = #{updateTime}, del_flag = #{delFlag}, remark = #{remark}, + type = #{type}, where id = #{id} @@ -278,10 +293,79 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" delete from scada where id = #{id} + + delete from scada where guid = #{guid} + + delete from scada where id in #{id} + + + + + + + + + + + + + update iot_product + set guid = #{guid} + where product_id = #{productId} + + + + update scene_model + set guid = #{guid} + where scene_model_id = #{sceneModelId} + + + + update scene_model + set guid = null + where guid in + + #{guid} + + + + + update iot_product + set guid = null + where guid in + + #{guid} + + diff --git a/xinda-server/mqtt-broker/src/main/java/com/xinda/mqtt/handler/MqttPublish.java b/xinda-server/mqtt-broker/src/main/java/com/xinda/mqtt/handler/MqttPublish.java index 83a2331..2cf4333 100644 --- a/xinda-server/mqtt-broker/src/main/java/com/xinda/mqtt/handler/MqttPublish.java +++ b/xinda-server/mqtt-broker/src/main/java/com/xinda/mqtt/handler/MqttPublish.java @@ -136,6 +136,7 @@ public class MqttPublish implements MqttHandler { reportBo.setReportType(1); } // 规则引擎脚本处理,完成后返回结果 +// MsgContext context = ruleProcess.processRuleScript(topicsUtils.parseSerialNumber(topicName), 1, topicName, new String(source)); MsgContext context; if (topicName.startsWith(TopicType.PROPERTY_XINDA_DEV.getTopicSuffix())) { context = ruleProcess.processNoRuleScript(topicsUtils.parseNewSerialNumber(topicName), 1, topicName, new String(source)); diff --git a/xinda-server/mqtt-broker/src/main/java/com/xinda/mqtt/service/impl/MqttMessagePublishImpl.java b/xinda-server/mqtt-broker/src/main/java/com/xinda/mqtt/service/impl/MqttMessagePublishImpl.java index a01533e..6e68588 100644 --- a/xinda-server/mqtt-broker/src/main/java/com/xinda/mqtt/service/impl/MqttMessagePublishImpl.java +++ b/xinda-server/mqtt-broker/src/main/java/com/xinda/mqtt/service/impl/MqttMessagePublishImpl.java @@ -136,7 +136,8 @@ public class MqttMessagePublishImpl implements IMqttMessagePublish { switch (serverType) { case MQTT: // 规则引擎脚本处理,完成后返回结果 - MsgContext context; +// MsgContext context = ruleProcess.processRuleScript(serialNumber, 2, backBo.getTopicName(), new String(backBo.getMessage())); + MsgContext context; if (backBo.getTopicName().startsWith(TopicType.PROPERTY_XINDA_DEV.getTopicSuffix())) { context = ruleProcess.processNoRuleScript(serialNumber, 2, backBo.getTopicName(), new String(backBo.getMessage())); }else{ diff --git a/xinda-server/sip-server/src/main/java/com/xinda/sip/service/impl/SipDeviceChannelServiceImpl.java b/xinda-server/sip-server/src/main/java/com/xinda/sip/service/impl/SipDeviceChannelServiceImpl.java index 73a9355..4e5a87c 100644 --- a/xinda-server/sip-server/src/main/java/com/xinda/sip/service/impl/SipDeviceChannelServiceImpl.java +++ b/xinda-server/sip-server/src/main/java/com/xinda/sip/service/impl/SipDeviceChannelServiceImpl.java @@ -1,5 +1,6 @@ package com.xinda.sip.service.impl; +import com.xinda.common.core.domain.entity.SysRole; import com.xinda.common.core.domain.entity.SysUser; import com.xinda.common.core.redis.RedisCache; import com.xinda.common.core.redis.RedisKeyBuilder; @@ -109,7 +110,7 @@ public class SipDeviceChannelServiceImpl implements ISipDeviceChannelService { public List selectSipDeviceChannelList(SipDeviceChannel sipDeviceChannel) { SysUser user = getLoginUser().getUser(); // List roles=user.getRoles(); - // 租户 +//// 租户 // if(roles.stream().anyMatch(a->a.getRoleKey().equals("tenant"))){ // sipDeviceChannel.setTenantId(user.getUserId()); // } @@ -183,9 +184,10 @@ public class SipDeviceChannelServiceImpl implements ISipDeviceChannelService { @Override public int insertSipDeviceChannel(SipDeviceChannel sipDeviceChannel) { + SysUser sysUser = getLoginUser().getUser(); Product product = productService.getProductBySerialNumber(sipDeviceChannel.getDeviceSipId()); if (product != null) { - sipDeviceChannel.setTenantId(product.getTenantId()); + sipDeviceChannel.setTenantId(sysUser.getDept().getDeptUserId()); sipDeviceChannel.setTenantName(product.getTenantName()); sipDeviceChannel.setProductId(product.getProductId()); sipDeviceChannel.setProductName(product.getProductName()); diff --git a/xinda-server/sip-server/src/main/resources/mapper/SipDeviceChannelMapper.xml b/xinda-server/sip-server/src/main/resources/mapper/SipDeviceChannelMapper.xml index 1b3c788..7356a48 100644 --- a/xinda-server/sip-server/src/main/resources/mapper/SipDeviceChannelMapper.xml +++ b/xinda-server/sip-server/src/main/resources/mapper/SipDeviceChannelMapper.xml @@ -136,7 +136,7 @@ from sip_device_channel s left join iot_sip_relation d on s.channel_sip_id = d.channel_id - and s.tenant_id = #{tenantId} + and s.tenant_id = #{tenantId} and s.tenant_name like concat('%', #{tenantName}, '%') and s.product_id = #{productId} and s.product_name like concat('%', #{productName},'%') diff --git a/xinda-service/xinda-iot-service/pom.xml b/xinda-service/xinda-iot-service/pom.xml index f32827b..b900da2 100644 --- a/xinda-service/xinda-iot-service/pom.xml +++ b/xinda-service/xinda-iot-service/pom.xml @@ -161,7 +161,6 @@ commons-jexl3 3.2.1 - diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/domain/Alert.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/domain/Alert.java index cb255de..2444590 100644 --- a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/domain/Alert.java +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/domain/Alert.java @@ -52,6 +52,8 @@ public class Alert extends BaseEntity { @Excel(name = "通知方式") private String notify; + private String serialNumber; + private List scenes; private List notifyTemplateList; @@ -59,6 +61,16 @@ public class Alert extends BaseEntity { /** 租户id */ private Long tenantId; + private Long deptId; + + public Long getDeptId() { + return deptId; + } + + public void setDeptId(Long deptId) { + this.deptId = deptId; + } + public Long getTenantId() { return tenantId; } @@ -75,6 +87,14 @@ public class Alert extends BaseEntity { this.tenantName = tenantName; } + public String getSerialNumber() { + return serialNumber; + } + + public void setSerialNumber(String serialNumber) { + this.serialNumber = serialNumber; + } + /** 租户名称 */ private String tenantName; diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/domain/CamDevice.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/domain/CamDevice.java new file mode 100644 index 0000000..9b7f25a --- /dev/null +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/domain/CamDevice.java @@ -0,0 +1,37 @@ +package com.xinda.iot.domain; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import com.xinda.common.annotation.Excel; +import com.xinda.common.core.domain.BaseEntity; + +/** + * 监控设备关联对象 iot_sip_device + * + * @author ledo + * @date 2025-04-04 + */ +@ApiModel(value = "CamDevice",description = "监控设备关联 iot_sip_device") +@Data +public class CamDevice extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 主键id */ + private Long id; + + /** 监控id */ + @Excel(name = "监控id") + @ApiModelProperty("监控id") + private Long sipId; + + /** 设备id */ + @Excel(name = "设备id") + @ApiModelProperty("设备id") + private Long deviceId; + + /** 逻辑删除标识 */ + private Integer delFlag; + +} diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/domain/Device.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/domain/Device.java index 0b3e8de..978af9d 100644 --- a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/domain/Device.java +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/domain/Device.java @@ -173,6 +173,19 @@ public class Device extends BaseEntity { @ApiModelProperty("定位方式(1=ip自动定位,2=设备定位,3=自定义)") private Integer locationWay; + private Integer icWay; + private String iccid; + private String volt; + private String sd; + private String pd; + private String imei; + @ApiModelProperty("监控设备ID") + private Long gwId; + + /** 监控设备名称 */ + + @ApiModelProperty("监控设备名称") + private String gwName; /** * 设备摘要 **/ @@ -244,6 +257,12 @@ public class Device extends BaseEntity { private List deptIds; + private Long mDeviceId; + + private List sipList; + + private List camDeviceList; + public static long getSerialVersionUID() { return serialVersionUID; diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/domain/Doc.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/domain/Doc.java new file mode 100644 index 0000000..012dcf3 --- /dev/null +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/domain/Doc.java @@ -0,0 +1,53 @@ +package com.xinda.iot.domain; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.xinda.common.annotation.Excel; +import com.xinda.common.core.domain.BaseEntity; + +/** + * 档案管理对象 iot_doc + * + * @author leo + * @date 2025-04-04 + */ +@ApiModel(value = "Doc",description = "档案管理 iot_doc") +@Data +public class Doc extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** id唯一标识 */ + private Long id; + + /** 机构id */ + @Excel(name = "机构id") + @ApiModelProperty("机构id") + private Long deptId; + + /** 机构名称 */ + @Excel(name = "机构名称") + @ApiModelProperty("机构名称") + private String deptName; + + /** 文件名称 */ + @Excel(name = "文件名称") + @ApiModelProperty("文件名称") + private String fileName; + + /** 资源请求路径 */ + @Excel(name = "资源请求路径") + @ApiModelProperty("资源请求路径") + private String resourceUrl; + + /** 租户id */ + private Long tenantId; + + /** 租户名称 */ + @Excel(name = "租户名称") + @ApiModelProperty("租户名称") + private String tenantName; + +} diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/AlertMapper.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/AlertMapper.java index 3478021..48f467e 100644 --- a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/AlertMapper.java +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/AlertMapper.java @@ -43,6 +43,8 @@ public interface AlertMapper */ public List selectScenesByAlertId(Long alertId); + public int deleteSceneByAlertId(Long alertId); + /** * 新增设备告警 * diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/CamDeviceMapper.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/CamDeviceMapper.java new file mode 100644 index 0000000..5075a79 --- /dev/null +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/CamDeviceMapper.java @@ -0,0 +1,63 @@ +package com.xinda.iot.mapper; + +import java.util.List; +import com.xinda.iot.domain.CamDevice; + +/** + * 监控设备关联Mapper接口 + * + * @author ledo + * @date 2025-04-04 + */ +public interface CamDeviceMapper +{ + /** + * 查询监控设备关联 + * + * @param id 监控设备关联主键 + * @return 监控设备关联 + */ + public CamDevice selectCamDeviceById(Long id); + + /** + * 查询监控设备关联列表 + * + * @param camDevice 监控设备关联 + * @return 监控设备关联集合 + */ + public List selectCamDeviceList(CamDevice camDevice); + + /** + * 新增监控设备关联 + * + * @param camDevice 监控设备关联 + * @return 结果 + */ + public int insertCamDevice(CamDevice camDevice); + + /** + * 修改监控设备关联 + * + * @param camDevice 监控设备关联 + * @return 结果 + */ + public int updateCamDevice(CamDevice camDevice); + + /** + * 删除监控设备关联 + * + * @param id 监控设备关联主键 + * @return 结果 + */ + public int deleteCamDeviceById(Long id); + + /** + * 批量删除监控设备关联 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCamDeviceByIds(Long[] ids); + + public int deleteCamDeviceBySipId(Long deviceId); +} diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/DeviceMapper.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/DeviceMapper.java index 1736b2d..42a9023 100644 --- a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/DeviceMapper.java +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/DeviceMapper.java @@ -126,6 +126,7 @@ public interface DeviceMapper */ public List selectDeviceGShortList(Device device); public List selectDeviceShortList(Device device); + List selectDeviceShortGwList(Device device); /** * 查询所有设备简短列表 * @@ -364,4 +365,10 @@ public interface DeviceMapper List listDeviceGroupByGroupIds(List groupIds); void deleteDeviceBygroupId(); + + List selectDeviceShortTreeList(Device device); + + List selectCamDeviceListByDeviceId(Long deviceId); + + } diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/DocMapper.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/DocMapper.java new file mode 100644 index 0000000..9d48a83 --- /dev/null +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/DocMapper.java @@ -0,0 +1,61 @@ +package com.xinda.iot.mapper; + +import java.util.List; +import com.xinda.iot.domain.Doc; + +/** + * 档案管理Mapper接口 + * + * @author leo + * @date 2025-04-04 + */ +public interface DocMapper +{ + /** + * 查询档案管理 + * + * @param id 档案管理主键 + * @return 档案管理 + */ + public Doc selectDocById(Long id); + + /** + * 查询档案管理列表 + * + * @param doc 档案管理 + * @return 档案管理集合 + */ + public List selectDocList(Doc doc); + + /** + * 新增档案管理 + * + * @param doc 档案管理 + * @return 结果 + */ + public int insertDoc(Doc doc); + + /** + * 修改档案管理 + * + * @param doc 档案管理 + * @return 结果 + */ + public int updateDoc(Doc doc); + + /** + * 删除档案管理 + * + * @param id 档案管理主键 + * @return 结果 + */ + public int deleteDocById(Long id); + + /** + * 批量删除档案管理 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDocByIds(Long[] ids); +} diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/ProductMapper.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/ProductMapper.java index 50033a8..9d09577 100644 --- a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/ProductMapper.java +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/mapper/ProductMapper.java @@ -189,4 +189,6 @@ public interface ProductMapper * @return: java.util.List */ List selectProductListByProductIds(@Param("productIdList") List productIdList); + + Long selectScadaIdByGuid(String guid); } diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/model/DeviceAllShortOutput.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/model/DeviceAllShortOutput.java index 03ae8a7..3253f61 100644 --- a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/model/DeviceAllShortOutput.java +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/model/DeviceAllShortOutput.java @@ -45,6 +45,14 @@ public class DeviceAllShortOutput /** wifi信号强度(信号极好4格[-55— 0],信号好3格[-70— -55],信号一般2格[-85— -70],信号差1格[-100— -85]) */ private Integer rssi; + private Integer icWay; + private String iccid; + private String volt; + + private String sd; + private String pd; + private String imei; + /** 激活时间 */ @JsonFormat(pattern = "yyyy-MM-dd") private Date activeTime; @@ -217,4 +225,51 @@ public class DeviceAllShortOutput return activeTime; } + public Integer getIcWay() { + return icWay; + } + + public void setIcWay(Integer icWay) { + this.icWay = icWay; + } + + public String getIccid() { + return iccid; + } + + public void setIccid(String iccid) { + this.iccid = iccid; + } + + public String getVolt() { + return volt; + } + + public void setVolt(String volt) { + this.volt = volt; + } + + public String getSd() { + return sd; + } + + public void setSd(String sd) { + this.sd = sd; + } + + public String getPd() { + return pd; + } + + public void setPd(String pd) { + this.pd = pd; + } + + public String getImei() { + return imei; + } + + public void setImei(String imei) { + this.imei = imei; + } } diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/model/DeviceShortOutput.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/model/DeviceShortOutput.java index ae87e64..8617c2f 100644 --- a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/model/DeviceShortOutput.java +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/model/DeviceShortOutput.java @@ -1,5 +1,6 @@ package com.xinda.iot.model; +import com.xinda.iot.domain.Device; import com.xinda.iot.model.ThingsModels.ThingsModelValueItem; import com.fasterxml.jackson.annotation.JsonFormat; import com.xinda.common.annotation.Excel; @@ -79,6 +80,13 @@ public class DeviceShortOutput @Excel(name = "wifi信号强度") private Integer rssi; + private Integer icWay; + private String iccid; + private String volt; + private String sd; + private String pd; + private String imei; + @Excel(name = "物模型") private String thingsModelValue; @@ -140,6 +148,15 @@ public class DeviceShortOutput */ private String agenciesName; + private List sipList; + + public List getSipList() { + return sipList; + } + + public void setSipList(List sipList) { + this.sipList = sipList; + } public String getGuid() { return guid; @@ -430,4 +447,75 @@ public class DeviceShortOutput return activeTime; } + public Integer getIcWay() { + return icWay; + } + + public void setIcWay(Integer icWay) { + this.icWay = icWay; + } + + public String getIccid() { + return iccid; + } + + public void setIccid(String iccid) { + this.iccid = iccid; + } + + public String getVolt() { + return volt; + } + + public void setVolt(String volt) { + this.volt = volt; + } + + public String getSd() { + return sd; + } + + public void setSd(String sd) { + this.sd = sd; + } + + public String getPd() { + return pd; + } + + public void setPd(String pd) { + this.pd = pd; + } + + public String getImei() { + return imei; + } + + public void setImei(String imei) { + this.imei = imei; + } + + public Long getGroupId() { + return groupId; + } + + public void setGroupId(Long groupId) { + this.groupId = groupId; + } + + public Long getAgenciesId() { + return agenciesId; + } + + public void setAgenciesId(Long agenciesId) { + this.agenciesId = agenciesId; + } + + public String getAgenciesName() { + return agenciesName; + } + + public void setAgenciesName(String agenciesName) { + this.agenciesName = agenciesName; + } } diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/model/ImportCategoryModelInput.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/model/ImportCategoryModelInput.java new file mode 100644 index 0000000..012edd5 --- /dev/null +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/model/ImportCategoryModelInput.java @@ -0,0 +1,43 @@ +package com.xinda.iot.model; + +/** + * 导入产品物模型的输入对象 + * + * @author kerwincui + * @date 2021-12-16 + */ +public class ImportCategoryModelInput +{ + /** 产品ID */ + private Long productId; + + /** 产品名称 */ + private String productName; + + /** 通用物模型ID集合 */ + private Long categoryId; + + public Long getProductId() { + return productId; + } + + public void setProductId(Long productId) { + this.productId = productId; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public Long getCategoryId() { + return categoryId; + } + + public void setCategoryId(Long categoryId) { + this.categoryId = categoryId; + } +} diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IAlertLogService.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IAlertLogService.java index 36a9520..4538b15 100644 --- a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IAlertLogService.java +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IAlertLogService.java @@ -38,6 +38,7 @@ public interface IAlertLogService * @return 设备告警集合 */ public Long selectAlertLogListCount(AlertLog alertLog); + public Long selectSceneAlertLogListCount(AlertLog alertLog); public List selectDeviceAlertCount(); public DeviceAlertCount selectDeviceAlertCountBySN(String serialNumber); @@ -98,4 +99,6 @@ public interface IAlertLogService * @return com.xinda.iot.model.AlertCountVO */ List countAlertLevel(DataCenterParam dataCenterParam); + + List selectAlertLogSnList(AlertLog alertLog); } diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IAlertService.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IAlertService.java index 8dc8f00..8e9f830 100644 --- a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IAlertService.java +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IAlertService.java @@ -106,4 +106,6 @@ public interface IAlertService * @return 设备告警集合 */ public List listByAlertIds(Long sceneId); + + int insertCfgAlert(Alert alert); } diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/ICamDeviceService.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/ICamDeviceService.java new file mode 100644 index 0000000..95378b0 --- /dev/null +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/ICamDeviceService.java @@ -0,0 +1,62 @@ +package com.xinda.iot.service; + +import java.util.List; +import com.xinda.iot.domain.CamDevice; + +/** + * 监控设备关联Service接口 + * + * @author ledo + * @date 2025-04-04 + */ +public interface ICamDeviceService +{ + /** + * 查询监控设备关联 + * + * @param id 监控设备关联主键 + * @return 监控设备关联 + */ + public CamDevice selectCamDeviceById(Long id); + + /** + * 查询监控设备关联列表 + * + * @param camDevice 监控设备关联 + * @return 监控设备关联集合 + */ + public List selectCamDeviceList(CamDevice camDevice); + + + /** + * 新增监控设备关联 + * + * @param camDevice 监控设备关联 + * @return 结果 + */ + public int insertCamDevice(CamDevice camDevice); + + /** + * 修改监控设备关联 + * + * @param camDevice 监控设备关联 + * @return 结果 + */ + public int updateCamDevice(CamDevice camDevice); + + /** + * 批量删除监控设备关联 + * + * @param ids 需要删除的监控设备关联主键集合 + * @return 结果 + */ + public int deleteCamDeviceByIds(Long[] ids); + + /** + * 删除监控设备关联信息 + * + * @param id 监控设备关联主键 + * @return 结果 + */ + public int deleteCamDeviceById(Long id); +} diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IDeviceService.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IDeviceService.java index 086824e..2a12c62 100644 --- a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IDeviceService.java +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IDeviceService.java @@ -125,6 +125,8 @@ public interface IDeviceService */ public List selectDeviceShortList(Device device); + public List selectDeviceShortGwList(Device device); + /** * 新增设备 * @@ -338,4 +340,9 @@ public interface IDeviceService */ List listDeviceGroupByGroupIds(List groupIds); + List selectDeviceShortTreeList(Device device); + + List selectCamDeviceListByDeviceId(Long deviceId); + + } diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IDocService.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IDocService.java new file mode 100644 index 0000000..12361cd --- /dev/null +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/IDocService.java @@ -0,0 +1,65 @@ +package com.xinda.iot.service; + +import java.util.List; + +import com.xinda.common.core.domain.AjaxResult; +import com.xinda.iot.domain.Doc; +import org.springframework.web.multipart.MultipartFile; + +/** + * 档案管理Service接口 + * + * @author leo + * @date 2025-04-04 + */ +public interface IDocService +{ + /** + * 查询档案管理 + * + * @param id 档案管理主键 + * @return 档案管理 + */ + public Doc selectDocById(Long id); + + /** + * 查询档案管理列表 + * + * @param doc 档案管理 + * @return 档案管理集合 + */ + public List selectDocList(Doc doc); + + /** + * 新增档案管理 + * + * @param doc 档案管理 + * @return 结果 + */ + public int insertDoc(Doc doc); + + /** + * 修改档案管理 + * + * @param doc 档案管理 + * @return 结果 + */ + public int updateDoc(Doc doc); + + /** + * 批量删除档案管理 + * + * @param ids 需要删除的档案管理主键集合 + * @return 结果 + */ + public int deleteDocByIds(Long[] ids); + + /** + * 删除档案管理信息 + * + * @param id 档案管理主键 + * @return 结果 + */ + public int deleteDocById(Long id); + +} diff --git a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/ISceneService.java b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/ISceneService.java index faa9b41..9310b62 100644 --- a/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/ISceneService.java +++ b/xinda-service/xinda-iot-service/src/main/java/com/xinda/iot/service/ISceneService.java @@ -4,6 +4,9 @@ import java.util.List; import java.util.Set; import com.xinda.iot.domain.Scene; +import com.xinda.iot.domain.SceneDevice; +import com.xinda.iot.domain.SceneScript; +import com.xinda.iot.domain.Script; import com.xinda.iot.model.SceneTerminalUserVO; /** @@ -79,4 +82,7 @@ public interface ISceneService * @return java.util.List */ List selectTerminalUserBySceneIds(Set sceneIdSet); + void dynamicBuildRule(List