|
@@ -84,8 +84,12 @@ object REqInSpBaseService: RService<REqInSpBase>(SMybatisDao(REqInSpBase::class.
|
|
|
|
|
|
/** 发送消息 */
|
|
|
// messageHandler.sendMessage(jsonObject.toString())
|
|
|
- /** 发送消息 */
|
|
|
- rabbitMqService.sendRel(Opt.projectId!!, "EquipinSpace","11",rEqInSpBase.equipId!!,rEqInSpBase.spaceId!!)
|
|
|
+ try {
|
|
|
+ /** 发送消息 */
|
|
|
+ rabbitMqService.sendRel(Opt.projectId!!, "EquipinSpace","11",rEqInSpBase.equipId!!,rEqInSpBase.spaceId!!)
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
}
|
|
|
} catch (e: Exception) {
|
|
|
e.printStackTrace()
|
|
@@ -106,6 +110,7 @@ object REqInSpBaseService: RService<REqInSpBase>(SMybatisDao(REqInSpBase::class.
|
|
|
*/
|
|
|
fun deletes(type: String, rEqInSpBaseList: ArrayList<REqInSpBase>): SBaseResponse {
|
|
|
return try {
|
|
|
+
|
|
|
val projectId = SPageContext.getHeader("projectId")
|
|
|
val list= ArrayList<REq2Sp>()
|
|
|
for (rEqInSpBase in rEqInSpBaseList){
|
|
@@ -116,9 +121,18 @@ object REqInSpBaseService: RService<REqInSpBase>(SMybatisDao(REqInSpBase::class.
|
|
|
rEq2Sp.zoneType = type
|
|
|
rEq2Sp.type = "eq2sp_in"
|
|
|
list.add(rEq2Sp)
|
|
|
+ val delete = REq2SpService.delete(rEq2Sp)
|
|
|
+ if (delete) {
|
|
|
+ try {
|
|
|
+ /** 发送消息 */
|
|
|
+ rabbitMqService.sendRel(Opt.projectId!!, "EquipinSpace","12",rEq2Sp.id1!!,rEq2Sp.id2!!)
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- REq2SpService.deleteByKeysList(list)
|
|
|
-
|
|
|
+// REq2SpService.deleteByKeysList(list)
|
|
|
+ SBaseResponse(SResponseType.success)
|
|
|
} catch (e: Exception) {
|
|
|
e.printStackTrace()
|
|
|
return SBaseResponse(SResponseType.failure, e.message!!)
|
|
@@ -130,103 +144,103 @@ object REqInSpBaseService: RService<REqInSpBase>(SMybatisDao(REqInSpBase::class.
|
|
|
*
|
|
|
* @param rEqInSpBaseList 设备和业务空间关系的对象列表
|
|
|
*/
|
|
|
- fun createEq(rEqInSpBaseList: REqInSpBaseList): SCreateResponse<REqInSpBase> {
|
|
|
- return try {
|
|
|
- /** 成功集合 */
|
|
|
- val successList = ArrayList<Any>()
|
|
|
- /** 失败集合 */
|
|
|
- val failureList = ArrayList<Any>()
|
|
|
- REq2SpService.delete("id1 = '${rEqInSpBaseList.equipId}'")
|
|
|
- for (spaceId in rEqInSpBaseList.spaceIdList!!){
|
|
|
- val rEqInSpBase = REqInSpBase()
|
|
|
- rEqInSpBase.equipId = rEqInSpBaseList.equipId
|
|
|
- rEqInSpBase.spaceId = spaceId
|
|
|
- rEqInSpBase.projectId = Opt.projectId
|
|
|
- val replace = replace(rEqInSpBase)
|
|
|
- if (replace){
|
|
|
- successList.add(spaceId)
|
|
|
- }else{
|
|
|
- failureList.add(rEqInSpBase)
|
|
|
- }
|
|
|
- }
|
|
|
- if (successList.size>0){
|
|
|
- val jsonObject = JSONObject()
|
|
|
- jsonObject.put("type", "13")
|
|
|
- jsonObject.put("projectId", Opt.projectId)
|
|
|
- jsonObject.put("id", rEqInSpBaseList.equipId)
|
|
|
- jsonObject.put("obj_type", "EquipinSpace")
|
|
|
- jsonObject.put("linkId",successList.toJson())
|
|
|
-
|
|
|
- /** 发送消息 */
|
|
|
-// RService.messageHandler.sendMessage(jsonObject.toString())
|
|
|
- /** 发送消息 */
|
|
|
- rabbitMqService.sendRel(Opt.projectId!!, "EquipinSpace","13",rEqInSpBaseList.equipId!!,successList.toJson()!!)
|
|
|
- val sCreateResponse = SCreateResponse<REqInSpBase>(SResponseType.success)
|
|
|
- if (failureList.size>0){
|
|
|
- sCreateResponse.message ="失败对象:"+failureList.toJson()
|
|
|
- }
|
|
|
- sCreateResponse
|
|
|
- }else{
|
|
|
- SCreateResponse(SResponseType.failure)
|
|
|
- }
|
|
|
- } catch (e: Exception) {
|
|
|
- e.printStackTrace()
|
|
|
- SCreateResponse(SResponseType.failure,e.message.toString())
|
|
|
- }
|
|
|
- } // Function createEq()
|
|
|
+// fun createEq(rEqInSpBaseList: REqInSpBaseList): SCreateResponse<REqInSpBase> {
|
|
|
+// return try {
|
|
|
+// /** 成功集合 */
|
|
|
+// val successList = ArrayList<Any>()
|
|
|
+// /** 失败集合 */
|
|
|
+// val failureList = ArrayList<Any>()
|
|
|
+// REq2SpService.delete("id1 = '${rEqInSpBaseList.equipId}'")
|
|
|
+// for (spaceId in rEqInSpBaseList.spaceIdList!!){
|
|
|
+// val rEqInSpBase = REqInSpBase()
|
|
|
+// rEqInSpBase.equipId = rEqInSpBaseList.equipId
|
|
|
+// rEqInSpBase.spaceId = spaceId
|
|
|
+// rEqInSpBase.projectId = Opt.projectId
|
|
|
+// val replace = replace(rEqInSpBase)
|
|
|
+// if (replace){
|
|
|
+// successList.add(spaceId)
|
|
|
+// }else{
|
|
|
+// failureList.add(rEqInSpBase)
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (successList.size>0){
|
|
|
+// val jsonObject = JSONObject()
|
|
|
+// jsonObject.put("type", "13")
|
|
|
+// jsonObject.put("projectId", Opt.projectId)
|
|
|
+// jsonObject.put("id", rEqInSpBaseList.equipId)
|
|
|
+// jsonObject.put("obj_type", "EquipinSpace")
|
|
|
+// jsonObject.put("linkId",successList.toJson())
|
|
|
+//
|
|
|
+// /** 发送消息 */
|
|
|
+//// RService.messageHandler.sendMessage(jsonObject.toString())
|
|
|
+// /** 发送消息 */
|
|
|
+// rabbitMqService.sendRel(Opt.projectId!!, "EquipinSpace","13",rEqInSpBaseList.equipId!!,successList.toJson()!!)
|
|
|
+// val sCreateResponse = SCreateResponse<REqInSpBase>(SResponseType.success)
|
|
|
+// if (failureList.size>0){
|
|
|
+// sCreateResponse.message ="失败对象:"+failureList.toJson()
|
|
|
+// }
|
|
|
+// sCreateResponse
|
|
|
+// }else{
|
|
|
+// SCreateResponse(SResponseType.failure)
|
|
|
+// }
|
|
|
+// } catch (e: Exception) {
|
|
|
+// e.printStackTrace()
|
|
|
+// SCreateResponse(SResponseType.failure,e.message.toString())
|
|
|
+// }
|
|
|
+// } // Function createEq()
|
|
|
|
|
|
/**
|
|
|
* 创建所在业务空间的设备关系
|
|
|
*
|
|
|
* @param rEqInSpBaseList 设备和业务空间关系的对象列表
|
|
|
*/
|
|
|
- fun createsSp(rEqInSpBaseList: RSpInEqBaseList): SCreateResponse<REqInSpBase> {
|
|
|
- return try {
|
|
|
- /** 成功集合 */
|
|
|
- val successList = ArrayList<Any>()
|
|
|
- /** 失败集合 */
|
|
|
- val failureList = ArrayList<Any>()
|
|
|
- REq2SpService.delete("id2 = '${rEqInSpBaseList.spaceId}'")
|
|
|
- for (equipId in rEqInSpBaseList.equipIdList!!){
|
|
|
- val rEqInSpBase = REqInSpBase()
|
|
|
- rEqInSpBase.spaceId = rEqInSpBaseList.spaceId
|
|
|
- rEqInSpBase.equipId = equipId
|
|
|
- rEqInSpBase.projectId = Opt.projectId
|
|
|
- val replace = replace(rEqInSpBase)
|
|
|
- if (replace){
|
|
|
- successList.add(equipId)
|
|
|
- }else{
|
|
|
- failureList.add(rEqInSpBase)
|
|
|
- }
|
|
|
- }
|
|
|
- if (successList.size>0){
|
|
|
- val jsonObject = JSONObject()
|
|
|
- jsonObject.put("type", "13")
|
|
|
- jsonObject.put("projectId", Opt.projectId)
|
|
|
- jsonObject.put("id", rEqInSpBaseList.spaceId)
|
|
|
- jsonObject.put("obj_type", "EquipinSpace")
|
|
|
- jsonObject.put("linkId",successList.toJson())
|
|
|
-
|
|
|
- /** 发送消息 */
|
|
|
-// RService.messageHandler.sendMessage(jsonObject.toString())
|
|
|
- /** 发送消息 */
|
|
|
- rabbitMqService.sendRel(Opt.projectId!!, "EquipinSpace","13",rEqInSpBaseList.spaceId!!,successList.toJson()!!)
|
|
|
- if (failureList.size>0){
|
|
|
- val sCreateResponse = SCreateResponse<REqInSpBase>(SResponseType.success)
|
|
|
- sCreateResponse.message ="失败对象:"+failureList.toJson()
|
|
|
- sCreateResponse
|
|
|
- }else{
|
|
|
- val sCreateResponse = SCreateResponse<REqInSpBase>(SResponseType.success)
|
|
|
- sCreateResponse
|
|
|
- }
|
|
|
- }else{
|
|
|
- SCreateResponse(SResponseType.failure)
|
|
|
- }
|
|
|
- } catch (e:Exception){
|
|
|
- e.printStackTrace()
|
|
|
- SCreateResponse(SResponseType.failure,e.message.toString())
|
|
|
- }
|
|
|
- } // Function createsSp()
|
|
|
+// fun createsSp(rEqInSpBaseList: RSpInEqBaseList): SCreateResponse<REqInSpBase> {
|
|
|
+// return try {
|
|
|
+// /** 成功集合 */
|
|
|
+// val successList = ArrayList<Any>()
|
|
|
+// /** 失败集合 */
|
|
|
+// val failureList = ArrayList<Any>()
|
|
|
+// REq2SpService.delete("id2 = '${rEqInSpBaseList.spaceId}'")
|
|
|
+// for (equipId in rEqInSpBaseList.equipIdList!!){
|
|
|
+// val rEqInSpBase = REqInSpBase()
|
|
|
+// rEqInSpBase.spaceId = rEqInSpBaseList.spaceId
|
|
|
+// rEqInSpBase.equipId = equipId
|
|
|
+// rEqInSpBase.projectId = Opt.projectId
|
|
|
+// val replace = replace(rEqInSpBase)
|
|
|
+// if (replace){
|
|
|
+// successList.add(equipId)
|
|
|
+// }else{
|
|
|
+// failureList.add(rEqInSpBase)
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (successList.size>0){
|
|
|
+// val jsonObject = JSONObject()
|
|
|
+// jsonObject.put("type", "13")
|
|
|
+// jsonObject.put("projectId", Opt.projectId)
|
|
|
+// jsonObject.put("id", rEqInSpBaseList.spaceId)
|
|
|
+// jsonObject.put("obj_type", "EquipinSpace")
|
|
|
+// jsonObject.put("linkId",successList.toJson())
|
|
|
+//
|
|
|
+// /** 发送消息 */
|
|
|
+//// RService.messageHandler.sendMessage(jsonObject.toString())
|
|
|
+// /** 发送消息 */
|
|
|
+// rabbitMqService.sendRel(Opt.projectId!!, "EquipinSpace","13",rEqInSpBaseList.spaceId!!,successList.toJson()!!)
|
|
|
+// if (failureList.size>0){
|
|
|
+// val sCreateResponse = SCreateResponse<REqInSpBase>(SResponseType.success)
|
|
|
+// sCreateResponse.message ="失败对象:"+failureList.toJson()
|
|
|
+// sCreateResponse
|
|
|
+// }else{
|
|
|
+// val sCreateResponse = SCreateResponse<REqInSpBase>(SResponseType.success)
|
|
|
+// sCreateResponse
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// SCreateResponse(SResponseType.failure)
|
|
|
+// }
|
|
|
+// } catch (e:Exception){
|
|
|
+// e.printStackTrace()
|
|
|
+// SCreateResponse(SResponseType.failure,e.message.toString())
|
|
|
+// }
|
|
|
+// } // Function createsSp()
|
|
|
|
|
|
/**
|
|
|
* 创建所在业务空间的设备关系
|
|
@@ -255,6 +269,12 @@ object REqInSpBaseService: RService<REqInSpBase>(SMybatisDao(REqInSpBase::class.
|
|
|
val replace = rEq2SpService.replace(rEq2Sp)
|
|
|
if (replace){
|
|
|
successList.add(rEq2Sp.id1!!)
|
|
|
+ try {
|
|
|
+ /** 发送消息 */
|
|
|
+ rabbitMqService.sendRel(Opt.projectId!!, "EquipinSpace","11",rEq2Sp.id1!!,rEq2Sp.id2!!)
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
}else{
|
|
|
failureList.add(rEq2Sp)
|
|
|
}
|
|
@@ -269,7 +289,7 @@ object REqInSpBaseService: RService<REqInSpBase>(SMybatisDao(REqInSpBase::class.
|
|
|
jsonObject.put("linkId",successList.toJson())
|
|
|
/** 发送消息 */
|
|
|
// messageHandler.sendMessage(jsonObject.toString())
|
|
|
- rabbitMqService.sendRel(Opt.projectId!!, "EquipinSpace","14",rEqInSpBaseList.spaceId!!,successList.toJson()!!)
|
|
|
+// rabbitMqService.sendRel(Opt.projectId!!, "EquipinSpace","14",rEqInSpBaseList.spaceId!!,successList.toJson()!!)
|
|
|
if (failureList.size>0){
|
|
|
val sCreateResponse = SCreateResponse<RSpInEqBaseList>(SResponseType.success)
|
|
|
sCreateResponse.message ="失败对象:"+failureList.toJson()
|