Commit 445c079a authored by co_dengxiongwen's avatar co_dengxiongwen

接口调整

parent 86d54a50
......@@ -64,7 +64,9 @@ public class WebSocket {
for (WebSocket webSocket : webSockets) {
System.out.println("【websocket消息】广播消息:" + message);
try {
synchronized (webSocket.session) {
webSocket.session.getAsyncRemote().sendText(message);
}
} catch (Exception e) {
e.printStackTrace();
}
......
......@@ -10,8 +10,10 @@ import com.devplatform.admin.config.WebSocket;
import com.devplatform.admin.modules.eq.bean.TimedTask;
import com.devplatform.admin.modules.eq.service.EquipmentService;
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.model.LiResourceModel;
import com.devplatform.admin.modules.liresource.service.LiResourceService;
import com.devplatform.admin.modules.liresource.service.LiStationService;
import com.devplatform.admin.modules.sys.bean.SysSystemParams;
import com.devplatform.admin.modules.sys.bean.SysSystemRunningTime;
......@@ -313,6 +315,9 @@ public class EquipmentController extends AbstractController {
@ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String")
@PostMapping("/checkModel")
public R checkModel(Integer type,Integer status) {
// 控制资源点启停
checkModelOnOrOff(type, status);
SysSystemParams sysSystemParams = sysSystemParamsService.getById(Constants.STRING_1);
if(type == Constants.INT_1){
sysSystemParams.setSun(status);
......@@ -333,9 +338,6 @@ public class EquipmentController extends AbstractController {
Map<String,Object> list = equipmentService.getList();
webSocket.sendAllMessage(JSONObject.toJSONString(list));
// 控制资源点启停
checkModelOnOrOff(type, status);
return R.ok();
}
......@@ -374,17 +376,19 @@ public class EquipmentController extends AbstractController {
}
/**
* 根据选择人工模式,来控制资源点启停
* 根据选择人工模式,来控制资源点启停
* @param type 1=供暖模式,2=机械通风,3=自然通风
* @param status 1=开启,2=关闭
*/
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++) {
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=开关
model.setActionType(1);
onOrOff(model);
......
......@@ -60,4 +60,11 @@ public interface LiResourceDao extends MyBaseMapper<LiResource> {
* @return
*/
LiResource queryByCode(String code);
/**
* 查询人工模式下的所有资源点
* @param modeTypes
* @return
*/
List<LiResource> queryListByParam(String modeTypes);
}
......@@ -53,4 +53,12 @@ public interface LiResourceService extends MyBaseService<LiResource> {
* @return 资源点详情
*/
LiResource queryByCode(String code);
/**
* 查询人工模式下的所有资源点
*
* @param modeTypes
* @return
*/
List<LiResource> queryListByParam(String modeTypes);
}
......@@ -46,4 +46,9 @@ public class LiResourceServiceImpl extends MyBaseServiceImpl<LiResourceDao, LiRe
return baseMapper.queryByCode(code);
}
@Override
public List<LiResource> queryListByParam(String modeTypes) {
return baseMapper.queryListByParam(modeTypes);
}
}
......@@ -236,7 +236,7 @@
where deleted = 0 and tier_id = #{tierId}
</select>
<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
from li_resource lr
left join sys_dictionary sd on lr.`type` = sd.id and lr.station_id = sd.station_id
......@@ -244,6 +244,11 @@
where lr.deleted = 0 and sd.deleted = 0 and lr.code = #{code}
limit 0,1
</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>
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