Commit 445c079a authored by co_dengxiongwen's avatar co_dengxiongwen

接口调整

parent 86d54a50
...@@ -64,7 +64,9 @@ public class WebSocket { ...@@ -64,7 +64,9 @@ public class WebSocket {
for (WebSocket webSocket : webSockets) { for (WebSocket webSocket : webSockets) {
System.out.println("【websocket消息】广播消息:" + message); System.out.println("【websocket消息】广播消息:" + message);
try { try {
webSocket.session.getAsyncRemote().sendText(message); synchronized (webSocket.session) {
webSocket.session.getAsyncRemote().sendText(message);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -10,8 +10,10 @@ import com.devplatform.admin.config.WebSocket; ...@@ -10,8 +10,10 @@ import com.devplatform.admin.config.WebSocket;
import com.devplatform.admin.modules.eq.bean.TimedTask; import com.devplatform.admin.modules.eq.bean.TimedTask;
import com.devplatform.admin.modules.eq.service.EquipmentService; import com.devplatform.admin.modules.eq.service.EquipmentService;
import com.devplatform.admin.modules.eq.service.TimedTaskService; import com.devplatform.admin.modules.eq.service.TimedTaskService;
import com.devplatform.admin.modules.liresource.bean.LiResource;
import com.devplatform.admin.modules.liresource.bean.LiStation; import com.devplatform.admin.modules.liresource.bean.LiStation;
import com.devplatform.admin.modules.liresource.model.LiResourceModel; import com.devplatform.admin.modules.liresource.model.LiResourceModel;
import com.devplatform.admin.modules.liresource.service.LiResourceService;
import com.devplatform.admin.modules.liresource.service.LiStationService; import com.devplatform.admin.modules.liresource.service.LiStationService;
import com.devplatform.admin.modules.sys.bean.SysSystemParams; import com.devplatform.admin.modules.sys.bean.SysSystemParams;
import com.devplatform.admin.modules.sys.bean.SysSystemRunningTime; import com.devplatform.admin.modules.sys.bean.SysSystemRunningTime;
...@@ -313,6 +315,9 @@ public class EquipmentController extends AbstractController { ...@@ -313,6 +315,9 @@ public class EquipmentController extends AbstractController {
@ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String") @ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String")
@PostMapping("/checkModel") @PostMapping("/checkModel")
public R checkModel(Integer type,Integer status) { public R checkModel(Integer type,Integer status) {
// 控制资源点启停
checkModelOnOrOff(type, status);
SysSystemParams sysSystemParams = sysSystemParamsService.getById(Constants.STRING_1); SysSystemParams sysSystemParams = sysSystemParamsService.getById(Constants.STRING_1);
if(type == Constants.INT_1){ if(type == Constants.INT_1){
sysSystemParams.setSun(status); sysSystemParams.setSun(status);
...@@ -333,9 +338,6 @@ public class EquipmentController extends AbstractController { ...@@ -333,9 +338,6 @@ public class EquipmentController extends AbstractController {
Map<String,Object> list = equipmentService.getList(); Map<String,Object> list = equipmentService.getList();
webSocket.sendAllMessage(JSONObject.toJSONString(list)); webSocket.sendAllMessage(JSONObject.toJSONString(list));
// 控制资源点启停
checkModelOnOrOff(type, status);
return R.ok(); return R.ok();
} }
...@@ -374,17 +376,19 @@ public class EquipmentController extends AbstractController { ...@@ -374,17 +376,19 @@ public class EquipmentController extends AbstractController {
} }
/** /**
* 根据选择人工模式,来控制资源点启停 * 根据选择人工模式,来控制资源点启停
* @param type 1=供暖模式,2=机械通风,3=自然通风 * @param type 1=供暖模式,2=机械通风,3=自然通风
* @param status 1=开启,2=关闭 * @param status 1=开启,2=关闭
*/ */
private void checkModelOnOrOff(Integer type, Integer status) { private void checkModelOnOrOff(Integer type, Integer status) {
List<LiResource> list = new ArrayList(); List<LiResource> list = new ArrayList<LiResource>();
// 查询所有模式匹配的资源点 // 查询所有模式匹配的资源点
// list = liResourceService. list = liResourceService.queryListByParam(type.toString());
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
LiResourceModel model = new LiResourceModel(); LiResourceModel model = new LiResourceModel();
model.setStatus(status); model.setId(list.get(i).getId());
model.setStatus(status==1?1:0);
model.setActionName(list.get(i).getName() + (status==1?"开启":"关闭"));
//操作类型,1=开关 //操作类型,1=开关
model.setActionType(1); model.setActionType(1);
onOrOff(model); onOrOff(model);
......
...@@ -18,46 +18,53 @@ import java.util.List; ...@@ -18,46 +18,53 @@ import java.util.List;
@Repository @Repository
public interface LiResourceDao extends MyBaseMapper<LiResource> { public interface LiResourceDao extends MyBaseMapper<LiResource> {
/** /**
* 查询资源点数量 * 查询资源点数量
* @param model * @param model
* @return * @return
*/ */
Integer queryPageByCount(LiResourceModel model); Integer queryPageByCount(LiResourceModel model);
/** /**
* 查询资源点数据 * 查询资源点数据
* @param model * @param model
* @return * @return
*/ */
List<LiResource> queryPageByList(LiResourceModel model); List<LiResource> queryPageByList(LiResourceModel model);
/** /**
* 查询资源点树信息 * 查询资源点树信息
* @param model * @param model
* @return * @return
*/ */
List<LiResource> getTreeList(LiResourceModel model); List<LiResource> getTreeList(LiResourceModel model);
/** /**
* 根据id查询资源点信息 * 根据id查询资源点信息
* @param id * @param id
* @param stationId * @param stationId
* @return * @return
*/ */
LiResource getBeanById(@Param("id") String id, @Param("stationId") String stationId); LiResource getBeanById(@Param("id") String id, @Param("stationId") String stationId);
/** /**
* 查询图层中资源点的数量 * 查询图层中资源点的数量
* @param tierId * @param tierId
* @return * @return
*/ */
Integer queryCountByTierId(String tierId); Integer queryCountByTierId(String tierId);
/** /**
* 根据资源点编码查询资源点 * 根据资源点编码查询资源点
* @param code * @param code
* @return * @return
*/ */
LiResource queryByCode(String code); LiResource queryByCode(String code);
/**
* 查询人工模式下的所有资源点
* @param modeTypes
* @return
*/
List<LiResource> queryListByParam(String modeTypes);
} }
...@@ -53,4 +53,12 @@ public interface LiResourceService extends MyBaseService<LiResource> { ...@@ -53,4 +53,12 @@ public interface LiResourceService extends MyBaseService<LiResource> {
* @return 资源点详情 * @return 资源点详情
*/ */
LiResource queryByCode(String code); LiResource queryByCode(String code);
/**
* 查询人工模式下的所有资源点
*
* @param modeTypes
* @return
*/
List<LiResource> queryListByParam(String modeTypes);
} }
...@@ -46,4 +46,9 @@ public class LiResourceServiceImpl extends MyBaseServiceImpl<LiResourceDao, LiRe ...@@ -46,4 +46,9 @@ public class LiResourceServiceImpl extends MyBaseServiceImpl<LiResourceDao, LiRe
return baseMapper.queryByCode(code); return baseMapper.queryByCode(code);
} }
@Override
public List<LiResource> queryListByParam(String modeTypes) {
return baseMapper.queryListByParam(modeTypes);
}
} }
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
where deleted = 0 and tier_id = #{tierId} where deleted = 0 and tier_id = #{tierId}
</select> </select>
<select id="queryByCode" resultType="com.devplatform.admin.modules.liresource.bean.LiResource"> <select id="queryByCode" resultType="com.devplatform.admin.modules.liresource.bean.LiResource">
select lr.id,lr.name,lr.code,sd.name as 'type',lr.address_code,lr.port,lr.username,lr.password,lr.deploy_location,lr.line_name,lr.station_name select lr.id,lr.name,lr.code,sd.name as 'type',lr.address_code,lr.port,lr.username,lr.password,lr.deploy_location,lr.station_name
sd2.name as brandName sd2.name as brandName
from li_resource lr from li_resource lr
left join sys_dictionary sd on lr.`type` = sd.id and lr.station_id = sd.station_id left join sys_dictionary sd on lr.`type` = sd.id and lr.station_id = sd.station_id
...@@ -244,6 +244,11 @@ ...@@ -244,6 +244,11 @@
where lr.deleted = 0 and sd.deleted = 0 and lr.code = #{code} where lr.deleted = 0 and sd.deleted = 0 and lr.code = #{code}
limit 0,1 limit 0,1
</select> </select>
<select id="queryListByParam" resultType="com.devplatform.admin.modules.liresource.bean.LiResource">
select lr.id,lr.name,lr.type
from li_resource lr
where lr.deleted = 0 and FIND_IN_SET(#{modeTypes},lr.mode_types)
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment