first commit
This commit is contained in:
524
src/com/sipai/controller/alarm/AlarmPointController.java
Normal file
524
src/com/sipai/controller/alarm/AlarmPointController.java
Normal file
@ -0,0 +1,524 @@
|
||||
package com.sipai.controller.alarm;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.sipai.entity.alarm.AlarmMoldCodeEnum;
|
||||
import com.sipai.entity.alarm.AlarmSubscribe;
|
||||
import com.sipai.entity.scada.MPoint;
|
||||
import com.sipai.entity.user.ProcessSection;
|
||||
import com.sipai.service.alarm.AlarmSubscribeService;
|
||||
import com.sipai.service.scada.MPointService;
|
||||
import com.sipai.service.scada.ProAlarmService;
|
||||
import com.sipai.service.user.ProcessSectionService;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sipai.entity.alarm.AlarmInformation;
|
||||
import com.sipai.entity.alarm.AlarmPoint;
|
||||
import com.sipai.entity.base.Result;
|
||||
import com.sipai.entity.user.User;
|
||||
import com.sipai.service.alarm.AlarmInformationService;
|
||||
import com.sipai.service.alarm.AlarmPointService;
|
||||
import com.sipai.service.user.UnitService;
|
||||
import com.sipai.tools.CommUtil;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/alarm/alarmPoint")
|
||||
public class AlarmPointController {
|
||||
@Resource
|
||||
private AlarmPointService alarmPointService;
|
||||
@Resource
|
||||
private AlarmInformationService alarmInformationService;
|
||||
@Resource
|
||||
private MPointService mPointService;
|
||||
@Resource
|
||||
private AlarmSubscribeService alarmSubscribeService;
|
||||
@Resource
|
||||
private ProAlarmService proAlarmService;
|
||||
@Resource
|
||||
private ProcessSectionService processSectionService;
|
||||
|
||||
@RequestMapping("/showist.do")
|
||||
public String showAlarmPointlist(HttpServletRequest request, Model model) {
|
||||
|
||||
return "/alarm/alarmPointList";
|
||||
}
|
||||
|
||||
@RequestMapping("/showistForSubscribe.do")
|
||||
public String showistForSubscribe(HttpServletRequest request, Model model) {
|
||||
List<AlarmInformation> alarmInformations = this.alarmInformationService.selectListByWhere(" where unit_id='" + request.getParameter("unitId") + "' order by code");
|
||||
JSONArray jsondata = new JSONArray();
|
||||
for (AlarmInformation alarmInformations2 : alarmInformations) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", alarmInformations2.getCode());
|
||||
jsonObject.put("text", alarmInformations2.getName());
|
||||
jsondata.add(jsonObject);
|
||||
}
|
||||
model.addAttribute("alarmInformationJson", jsondata.toString());
|
||||
return "/alarm/alarmPointListForSubscribe";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/getlist.do")
|
||||
public ModelAndView getlist(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "page") Integer page,
|
||||
@RequestParam(value = "rows") Integer rows,
|
||||
@RequestParam(value = "sort", required = false) String sort,
|
||||
@RequestParam(value = "order", required = false) String order) {
|
||||
//User cu=(User)request.getSession().getAttribute("cu");
|
||||
if (sort == null) {
|
||||
sort = " alarm_point ";
|
||||
}
|
||||
if (order == null) {
|
||||
order = " asc ";
|
||||
}
|
||||
String orderstr = " order by " + sort + " " + order;
|
||||
|
||||
String wherestr = "where 1=1 ";
|
||||
|
||||
if (request.getParameter("unitId") != null && request.getParameter("unitId").length() > 0) {
|
||||
wherestr += " and unit_id='" + request.getParameter("unitId") + "' ";
|
||||
}
|
||||
String searchName = request.getParameter("search_name");
|
||||
if (request.getParameter("informationCode") != null && request.getParameter("informationCode").length() > 0) {
|
||||
wherestr += " and information_code='" + request.getParameter("informationCode") + "' ";
|
||||
}
|
||||
|
||||
PageHelper.startPage(page, rows);
|
||||
List<AlarmPoint> list = new ArrayList<>();
|
||||
try {
|
||||
list = this.alarmPointService.selectListByWhere(wherestr + orderstr, searchName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
PageInfo<AlarmPoint> pi = new PageInfo<AlarmPoint>(list);
|
||||
JSONArray json = JSONArray.fromObject(list);
|
||||
|
||||
String result = "{\"total\":" + pi.getTotal() + ",\"rows\":" + json + "}";
|
||||
// System.out.println(result);
|
||||
model.addAttribute("result", result);
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
@RequestMapping("/getlistForSubscribePersonal.do")
|
||||
public ModelAndView getlistForSubscribePersonal(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "page") Integer page,
|
||||
@RequestParam(value = "rows") Integer rows,
|
||||
@RequestParam(value = "sort", required = false) String sort,
|
||||
@RequestParam(value = "order", required = false) String order) {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
if (sort == null) {
|
||||
sort = " mold_code ";
|
||||
}
|
||||
if (order == null) {
|
||||
order = " asc ";
|
||||
}
|
||||
String orderstr = " order by " + sort + " " + order;
|
||||
|
||||
String wherestr = " where s.unit_id='" + request.getParameter("unitId") + "' and userid='" + cu.getId() + "' " +
|
||||
" and i.mold_code='" + request.getParameter("moldCode") + "' and i.level_code='" + request.getParameter("levelCode") + "' ";
|
||||
|
||||
PageHelper.startPage(page, rows);
|
||||
List<AlarmSubscribe> list = this.alarmSubscribeService.selectLeftOuterListByWhere(wherestr + orderstr);
|
||||
|
||||
PageInfo<AlarmSubscribe> pi = new PageInfo<AlarmSubscribe>(list);
|
||||
JSONArray json = JSONArray.fromObject(list);
|
||||
|
||||
String result = "{\"total\":" + pi.getTotal() + ",\"rows\":" + json + "}";
|
||||
// System.out.println(result);
|
||||
model.addAttribute("result", result);
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
@RequestMapping("/getlistForSubscribePersonalAdd.do")
|
||||
public ModelAndView getlistForSubscribePersonalAdd(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "page") Integer page,
|
||||
@RequestParam(value = "rows") Integer rows,
|
||||
@RequestParam(value = "sort", required = false) String sort,
|
||||
@RequestParam(value = "order", required = false) String order) {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
if (sort == null) {
|
||||
sort = " alarm_point ";
|
||||
}
|
||||
if (order == null) {
|
||||
order = " asc ";
|
||||
}
|
||||
String orderstr = " order by " + sort + " " + order;
|
||||
|
||||
String wherestr = " where 1=1 and (alarm_receivers not like '%" + cu.getId() + "%' or alarm_receivers is null) ";
|
||||
|
||||
if (request.getParameter("unitId") != null && request.getParameter("unitId").length() > 0) {
|
||||
wherestr += " and p.unit_id='" + request.getParameter("unitId") + "' ";
|
||||
}
|
||||
String searchName = request.getParameter("search_name");
|
||||
if (request.getParameter("informationCode") != null && request.getParameter("informationCode").length() > 0) {
|
||||
wherestr += " and information_code='" + request.getParameter("informationCode") + "' ";
|
||||
}
|
||||
if (request.getParameter("alarmMoldCode") != null && request.getParameter("alarmMoldCode").length() > 0) {
|
||||
wherestr += " and information_code like '%" + request.getParameter("alarmMoldCode") + "%' ";
|
||||
}
|
||||
if (request.getParameter("alarmLevelsCode") != null && request.getParameter("alarmLevelsCode").length() > 0) {
|
||||
wherestr += " and information_code like '%" + request.getParameter("alarmLevelsCode") + "%' ";
|
||||
}
|
||||
|
||||
List<AlarmSubscribe> alarmSubscribeList = this.alarmSubscribeService.selectListByWhere(" where unit_id='" + request.getParameter("unitId") + "' and userid='" + cu.getId() + "' ");
|
||||
String alarmPointIds = "";
|
||||
if (alarmSubscribeList != null && alarmSubscribeList.size() > 0) {
|
||||
for (int i = 0; i < alarmSubscribeList.size(); i++) {
|
||||
alarmPointIds += alarmSubscribeList.get(i).getAlarmPointId() + ",";
|
||||
}
|
||||
}
|
||||
if (!alarmPointIds.equals("")) {
|
||||
alarmPointIds = alarmPointIds.replace(",", "','");
|
||||
wherestr += " and p.id not in ('" + alarmPointIds + "') ";
|
||||
}
|
||||
|
||||
PageHelper.startPage(page, rows);
|
||||
List<AlarmPoint> list = this.alarmPointService.selectListJoinInformationByWhere(wherestr + orderstr);
|
||||
|
||||
PageInfo<AlarmPoint> pi = new PageInfo<AlarmPoint>(list);
|
||||
JSONArray json = JSONArray.fromObject(list);
|
||||
|
||||
String result = "{\"total\":" + pi.getTotal() + ",\"rows\":" + json + "}";
|
||||
// System.out.println(result);
|
||||
model.addAttribute("result", result);
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
@RequestMapping("/getlistForSubscribeSys.do")
|
||||
public ModelAndView getlistForSubscribeSys(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "page") Integer page,
|
||||
@RequestParam(value = "rows") Integer rows,
|
||||
@RequestParam(value = "sort", required = false) String sort,
|
||||
@RequestParam(value = "order", required = false) String order) {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
if (sort == null) {
|
||||
sort = " alarm_point ";
|
||||
}
|
||||
if (order == null) {
|
||||
order = " asc ";
|
||||
}
|
||||
String orderstr = " order by " + sort + " " + order;
|
||||
|
||||
String wherestr = " where 1=1 ";
|
||||
|
||||
if (request.getParameter("unitId") != null && request.getParameter("unitId").length() > 0) {
|
||||
wherestr += " and p.unit_id='" + request.getParameter("unitId") + "' ";
|
||||
}
|
||||
String searchName = request.getParameter("search_name");
|
||||
if (request.getParameter("informationCode") != null && request.getParameter("informationCode").length() > 0) {
|
||||
wherestr += " and information_code='" + request.getParameter("informationCode") + "' ";
|
||||
}
|
||||
|
||||
PageHelper.startPage(page, rows);
|
||||
List<AlarmPoint> list = this.alarmPointService.selectListJoinInformationByWhere(wherestr + orderstr);
|
||||
|
||||
PageInfo<AlarmPoint> pi = new PageInfo<AlarmPoint>(list);
|
||||
JSONArray json = JSONArray.fromObject(list);
|
||||
|
||||
String result = "{\"total\":" + pi.getTotal() + ",\"rows\":" + json + "}";
|
||||
// System.out.println(result);
|
||||
model.addAttribute("result", result);
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
@RequestMapping("/doMPointadd.do")
|
||||
public String doMPointadd(HttpServletRequest request, Model model) {
|
||||
List<AlarmInformation> alarmInformations = this.alarmInformationService.selectListByWhere(" where unit_id='" + request.getParameter("unitId") + "' order by code");
|
||||
JSONArray jsondata = new JSONArray();
|
||||
for (AlarmInformation alarmInformations2 : alarmInformations) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", alarmInformations2.getCode());
|
||||
jsonObject.put("text", alarmInformations2.getName());
|
||||
jsondata.add(jsonObject);
|
||||
}
|
||||
model.addAttribute("alarmInformationJson", jsondata.toString());
|
||||
|
||||
return "alarm/alarmPointAddForMPoint";
|
||||
}
|
||||
|
||||
@RequestMapping("/doMPointedit.do")
|
||||
public String doMPointedit(HttpServletRequest request, Model model) throws IOException {
|
||||
String id = request.getParameter("id");
|
||||
AlarmPoint alarmPoint = this.alarmPointService.selectById(id);
|
||||
model.addAttribute("alarmPoint", alarmPoint);
|
||||
|
||||
List<AlarmInformation> alarmInformations = this.alarmInformationService.selectListByWhere(" where unit_id='" + request.getParameter("unitId") + "' order by code");
|
||||
JSONArray jsondata = new JSONArray();
|
||||
for (AlarmInformation alarmInformations2 : alarmInformations) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", alarmInformations2.getCode());
|
||||
jsonObject.put("text", alarmInformations2.getName());
|
||||
jsondata.add(jsonObject);
|
||||
}
|
||||
model.addAttribute("alarmInformationJson", jsondata.toString());
|
||||
String alarmConfigType = new CommUtil().getProperties("mqtt.properties", "alarmConfigType");
|
||||
model.addAttribute("alarmConfigType", alarmConfigType);
|
||||
return "alarm/alarmPointEditForMPoint";
|
||||
}
|
||||
|
||||
@RequestMapping("/addOwnPoint.do")
|
||||
public String addOwnPoint(HttpServletRequest request, Model model) {
|
||||
List<AlarmInformation> alarmInformations = this.alarmInformationService.selectListByWhere(" where unit_id='" + request.getParameter("unitId") + "' order by code");
|
||||
JSONArray jsondata = new JSONArray();
|
||||
for (AlarmInformation alarmInformations2 : alarmInformations) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", alarmInformations2.getCode());
|
||||
jsonObject.put("text", alarmInformations2.getName());
|
||||
jsondata.add(jsonObject);
|
||||
}
|
||||
model.addAttribute("alarmInformationJson", jsondata.toString());
|
||||
return "alarm/alarmPointEditForOwnPoint";
|
||||
}
|
||||
|
||||
@RequestMapping("/dosave.do")
|
||||
public String dosave(HttpServletRequest request, Model model,
|
||||
@ModelAttribute AlarmPoint alarmPoint) {
|
||||
Result result = new Result();
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
String id = CommUtil.getUUID();
|
||||
alarmPoint.setId(id);
|
||||
int code = this.alarmPointService.save(alarmPoint);
|
||||
|
||||
if (code == Result.SUCCESS) {
|
||||
result = Result.success(code);
|
||||
} else {
|
||||
result = Result.failed("新增失败");
|
||||
}
|
||||
model.addAttribute("result", CommUtil.toJson(result));
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/doMPointSaves.do")
|
||||
public String doMPointSaves(HttpServletRequest request, Model model) {
|
||||
Result result = new Result();
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
int code = 0;
|
||||
|
||||
String unitId = request.getParameter("unitId");
|
||||
String[] idss = request.getParameter("ids").split(",");
|
||||
String informationCode = request.getParameter("informationCode");
|
||||
for (String ids : idss) {
|
||||
AlarmPoint alarmPoint = new AlarmPoint();
|
||||
alarmPoint.setId(CommUtil.getUUID());
|
||||
alarmPoint.setInsdt(CommUtil.nowDate());
|
||||
alarmPoint.setInsuser(cu.getId());
|
||||
alarmPoint.setUpdatetime(CommUtil.nowDate());
|
||||
alarmPoint.setUpdater(cu.getId());
|
||||
alarmPoint.setAlarmPoint(ids);
|
||||
alarmPoint.setInformationCode(informationCode);
|
||||
alarmPoint.setUnitId(unitId);
|
||||
alarmPoint.setType(request.getParameter("type"));
|
||||
code += this.alarmPointService.save(alarmPoint);
|
||||
}
|
||||
|
||||
if (code == Result.SUCCESS) {
|
||||
result = Result.success(code);
|
||||
} else {
|
||||
result = Result.failed("新增失败");
|
||||
}
|
||||
model.addAttribute("result", CommUtil.toJson(result));
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/doupdate.do")
|
||||
public String doupdate(HttpServletRequest request, Model model,
|
||||
@ModelAttribute AlarmPoint alarmPoint) {
|
||||
Result result = new Result();
|
||||
|
||||
int code = this.alarmPointService.update(alarmPoint);
|
||||
if (alarmPoint.getInformationCode().contains(AlarmMoldCodeEnum.LimitValue_Pro.getKey())) {
|
||||
MPoint mPoint = this.mPointService.selectById(alarmPoint.getUnitId(), alarmPoint.getAlarmPoint());
|
||||
if (request.getParameter("lalarmmin") != null && !request.getParameter("alarmmax").equals("")) {
|
||||
mPoint.setAlarmmax(new BigDecimal(request.getParameter("alarmmax")));
|
||||
this.mPointService.update2(alarmPoint.getUnitId(), mPoint);
|
||||
} else {
|
||||
this.mPointService.updateAlarmmax(alarmPoint.getUnitId(), mPoint.getMpointcode());
|
||||
// mPoint.setAlarmmax(null);
|
||||
}
|
||||
if (request.getParameter("lalarmmin") != null && !request.getParameter("alarmmin").equals("")) {
|
||||
mPoint.setAlarmmin(new BigDecimal(request.getParameter("alarmmin")));
|
||||
this.mPointService.update2(alarmPoint.getUnitId(), mPoint);
|
||||
} else {
|
||||
this.mPointService.updateAlarmmin(alarmPoint.getUnitId(), mPoint.getMpointcode());
|
||||
// mPoint.setAlarmmin(null);
|
||||
}
|
||||
if (request.getParameter("lalarmmin") != null && !request.getParameter("halarmmax").equals("")) {
|
||||
mPoint.setHalarmmax(new BigDecimal(request.getParameter("halarmmax")));
|
||||
this.mPointService.update2(alarmPoint.getUnitId(), mPoint);
|
||||
} else {
|
||||
this.mPointService.updateHalarmmax(alarmPoint.getUnitId(), mPoint.getMpointcode());
|
||||
// mPoint.setHalarmmax(null);
|
||||
}
|
||||
if (request.getParameter("lalarmmin") != null && !request.getParameter("lalarmmin").equals("")) {
|
||||
mPoint.setLalarmmin(new BigDecimal(request.getParameter("lalarmmin")));
|
||||
this.mPointService.update2(alarmPoint.getUnitId(), mPoint);
|
||||
} else {
|
||||
this.mPointService.updateLalarmmin(alarmPoint.getUnitId(), mPoint.getMpointcode());
|
||||
// mPoint.setLalarmmin(null);
|
||||
}
|
||||
// this.mPointService.update2(alarmPoint.getUnitId(),mPoint);
|
||||
}
|
||||
|
||||
if (code == Result.SUCCESS) {
|
||||
result = Result.success(code);
|
||||
} else {
|
||||
result = Result.failed("更新失败");
|
||||
}
|
||||
model.addAttribute("result", CommUtil.toJson(result));
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/dodelete.do")
|
||||
public String dodelete(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "id") String id) {
|
||||
this.alarmSubscribeService.deleteByWhere("where alarm_point_id in ('" + id + "')");
|
||||
int code = this.alarmPointService.deleteById(id);
|
||||
Result result = new Result();
|
||||
if (code == Result.SUCCESS) {
|
||||
result = Result.success(code);
|
||||
} else {
|
||||
result = Result.failed("删除失败");
|
||||
}
|
||||
model.addAttribute("result", CommUtil.toJson(result));
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/dodeletes.do")
|
||||
public String dodeletes(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "ids") String ids) {
|
||||
ids = ids.replace(",", "','");
|
||||
this.alarmSubscribeService.deleteByWhere("where alarm_point_id in ('" + ids + "')");
|
||||
int result = this.alarmPointService.deleteByWhere("where id in ('" + ids + "')");
|
||||
model.addAttribute("result", result);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/alarmRecover.do")
|
||||
public ModelAndView alarmRecover(HttpServletRequest request, Model model) {
|
||||
String bizid = request.getParameter("bizid");
|
||||
String pointId = request.getParameter("pointId");
|
||||
String alarmTime = request.getParameter("alarmTime");
|
||||
String recoverValue = request.getParameter("recoverValue");
|
||||
|
||||
int code = this.alarmPointService.alarmRecover(bizid, pointId, alarmTime, recoverValue);
|
||||
|
||||
Result result = new Result();
|
||||
if (code == Result.SUCCESS) {
|
||||
result = Result.success(code);
|
||||
} else {
|
||||
result = Result.failed("操作失败");
|
||||
}
|
||||
model.addAttribute("result", CommUtil.toJson(result));
|
||||
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/insertAlarm.do")
|
||||
public String insertAlarm(HttpServletRequest request, Model model) {
|
||||
String alarmType = request.getParameter("alarmType");
|
||||
String pointId = request.getParameter("pointId");
|
||||
String pointName = request.getParameter("pointName");
|
||||
String unitId = request.getParameter("unitId");
|
||||
String levelType = request.getParameter("levelType");
|
||||
String describe = request.getParameter("describe");
|
||||
String nowValue = request.getParameter("nowValue");
|
||||
String prSectionCode = request.getParameter("prSectionCode");
|
||||
|
||||
String prSectionName = "";
|
||||
List<ProcessSection> prSection = this.processSectionService.selectListByWhere(" where code='" + prSectionCode + "' and unit_id='" + unitId + "' ");
|
||||
if (prSection != null && prSection.size() > 0) {
|
||||
prSectionName = prSection.get(0).getName();
|
||||
}
|
||||
|
||||
int result = this.alarmPointService.insertAlarm(unitId, request, alarmType, pointId, pointName, CommUtil.nowDate(), levelType, describe, nowValue, prSectionCode, prSectionName);
|
||||
model.addAttribute("result", result);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/insertAlarmForApp.do")
|
||||
public String insertAlarmForApp(HttpServletRequest request, Model model) {
|
||||
String alarmType = request.getParameter("alarmType");
|
||||
String pointId = request.getParameter("pointId");
|
||||
String pointName = request.getParameter("pointName");
|
||||
String unitId = request.getParameter("unitId");
|
||||
String levelType = request.getParameter("levelType");
|
||||
String describe = request.getParameter("describe");
|
||||
String nowValue = request.getParameter("nowValue");
|
||||
String prSectionCode = request.getParameter("prSectionCode");
|
||||
|
||||
String prSectionName = "";
|
||||
List<ProcessSection> prSection = this.processSectionService.selectListByWhere(" where code='" + prSectionCode + "' and unit_id='" + unitId + "' ");
|
||||
if (prSection != null && prSection.size() > 0) {
|
||||
prSectionName = prSection.get(0).getName();
|
||||
}
|
||||
|
||||
String nowTime = CommUtil.nowDate();
|
||||
int result = this.alarmPointService.insertAlarm(unitId, request, alarmType, pointId, pointName, nowTime, levelType, describe, nowValue, prSectionCode, prSectionName);
|
||||
|
||||
JSONObject j = new JSONObject();
|
||||
j.put("result", result);
|
||||
j.put("pointId", pointId);
|
||||
j.put("nowTime", nowTime);
|
||||
|
||||
model.addAttribute("result", j);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/externalSysAlarm.do")
|
||||
public String externalSysAlarm(HttpServletRequest request, Model model) {
|
||||
String alarmType = request.getParameter("alarmType");
|
||||
String pointId = request.getParameter("pointId");
|
||||
String pointName = request.getParameter("pointName");
|
||||
String unitId = request.getParameter("unitId");
|
||||
String levelType = request.getParameter("levelType");
|
||||
String describe = request.getParameter("describe");
|
||||
String nowValue = request.getParameter("nowValue");
|
||||
String prSectionCode = request.getParameter("prSectionCode");
|
||||
|
||||
String prSectionName = "";
|
||||
if (prSectionCode != null && !prSectionCode.equals("")) {
|
||||
List<ProcessSection> prSection = this.processSectionService.selectListByWhere(" where code='" + prSectionCode + "' and unit_id='" + unitId + "' ");
|
||||
if (prSection != null && prSection.size() > 0) {
|
||||
prSectionName = prSection.get(0).getName();
|
||||
}
|
||||
}
|
||||
|
||||
int result = this.alarmPointService.insertAlarm(unitId, null, alarmType, pointId, pointName, CommUtil.nowDate(), levelType, describe, nowValue, prSectionCode, prSectionName);
|
||||
model.addAttribute("result", result);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/externalSysAlarmRecover.do")
|
||||
public ModelAndView externalSysAlarmRecover(HttpServletRequest request, Model model) {
|
||||
String unitId = request.getParameter("unitId");
|
||||
String pointId = request.getParameter("pointId");
|
||||
String recoverValue = request.getParameter("recoverValue");
|
||||
|
||||
int code = this.alarmPointService.alarmRecover2(unitId, pointId, recoverValue);
|
||||
|
||||
model.addAttribute("result", code);
|
||||
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user