Commit 7cb2b4dc by wancheng

Merge remote-tracking branch 'origin/dev' into dev

parents e7881cc8 a46c445a
...@@ -11,33 +11,37 @@ import com.baosight.hpjx.hp.sb.domain.HPSB002; ...@@ -11,33 +11,37 @@ import com.baosight.hpjx.hp.sb.domain.HPSB002;
import com.baosight.hpjx.hp.sb.domain.HPSB00A; import com.baosight.hpjx.hp.sb.domain.HPSB00A;
import com.baosight.hpjx.util.StringUtils; import com.baosight.hpjx.util.StringUtils;
import com.baosight.hpjx.xml.XmlUtils; import com.baosight.hpjx.xml.XmlUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Controller @Controller
@CrossOrigin @CrossOrigin
@RequestMapping({"/log/information"}) @RequestMapping({"/log"})
public class LogInformationController extends ServiceBase { public class LogInformationController {
@RequestMapping({"/analysis"}) @RequestMapping(value ="/information", method = RequestMethod.POST)
public String logAnalysis(@PathVariable HPSB00A hpsb00A) { public String logAnalysis(@RequestBody HPSB00A hpsb00A) {
HPSB002 hpsb002 = new HPSB002(); HPSB002 hpsb002 = new HPSB002();
HPSB001 hpsb001 = new HPSB001(); HPSB001 hpsb001 = new HPSB001();
List<HPSB002> hpsb002List = new ArrayList<>();
List<HPSB001> hpsb001List = new ArrayList<>();
EiInfo outInfo = new EiInfo();
//TODO 根据TYPE来判断内容属于哪一种,然后再进行解析 //TODO 根据TYPE来判断内容属于哪一种,然后再进行解析
//TODO TYPE = STARUS_TYPE --- 设备状态 //TODO TYPE = STARUS_TYPE --- 设备状态
//TODO TYPE = TIME_TYPE --- 开机时间 //TODO TYPE = TIME_TYPE --- 开机时间
//TODO TYPE = WARNING_TYPE --- 报警内容 //TODO TYPE = WARNING_TYPE --- 报警内容
String equipmentType = hpsb00A.getEquipmentType(); String equipmentType = hpsb00A.getEquipmentType();
if (StringUtils.isEmpty(equipmentType)) { if (StringUtils.isNotEmpty(equipmentType)) {
if (equipmentType.equals(HPConstants.STARUS_TYPE)) { if (equipmentType.equals(HPConstants.STARUS_TYPE)) {
//解析设备状态 //解析设备状态
List<CutterbarStatus> cutterbarStatusList = XmlUtils.readXml(hpsb00A.getDataContent(), CutterbarStatus.class); List<CutterbarStatus> cutterbarStatusList = XmlUtils.readXml(hpsb00A.getDataContent(), CutterbarStatus.class);
...@@ -45,8 +49,12 @@ public class LogInformationController extends ServiceBase { ...@@ -45,8 +49,12 @@ public class LogInformationController extends ServiceBase {
hpsb002.setEquipmentCode(hpsb00A.getEquipmentCode()); hpsb002.setEquipmentCode(hpsb00A.getEquipmentCode());
hpsb002.setEquipmentType(hpsb00A.getEquipmentType()); hpsb002.setEquipmentType(hpsb00A.getEquipmentType());
hpsb002.setLogValue(cutterbarStatusList.get(0).getStatus().toString()); hpsb002.setLogValue(cutterbarStatusList.get(0).getStatus().toString());
DaoUtils.insert("HPSB002.insert", hpsb002); hpsb002List.add(hpsb002);
return "设备日志记录成功"; outInfo.addBlock(EiConstant.resultBlock).setRows(hpsb002List);
outInfo.set(EiConstant.serviceName, "HPSB002");
outInfo.set(EiConstant.methodName,"insert");
outInfo = XLocalManager.call(outInfo);
return outInfo.getMsg();
} }
if (equipmentType.equals(HPConstants.TIME_TYPE)) { if (equipmentType.equals(HPConstants.TIME_TYPE)) {
//解析开机时间 //解析开机时间
...@@ -55,8 +63,12 @@ public class LogInformationController extends ServiceBase { ...@@ -55,8 +63,12 @@ public class LogInformationController extends ServiceBase {
hpsb002.setEquipmentCode(hpsb00A.getEquipmentCode()); hpsb002.setEquipmentCode(hpsb00A.getEquipmentCode());
hpsb002.setEquipmentType(hpsb00A.getEquipmentType()); hpsb002.setEquipmentType(hpsb00A.getEquipmentType());
hpsb002.setLogValue(cutterbarTimeList.get(0).getTime()); hpsb002.setLogValue(cutterbarTimeList.get(0).getTime());
DaoUtils.insert("HPSB002.insert", hpsb002); hpsb002List.add(hpsb002);
return "设备日志记录成功"; outInfo.addBlock(EiConstant.resultBlock).setRows(hpsb002List);
outInfo.set(EiConstant.serviceName, "HPSB002");
outInfo.set(EiConstant.methodName,"insert");
outInfo = XLocalManager.call(outInfo);
return outInfo.getMsg();
} }
if (equipmentType.equals(HPConstants.WARNING_TYPE)) { if (equipmentType.equals(HPConstants.WARNING_TYPE)) {
//解析报警内容 //解析报警内容
...@@ -74,8 +86,12 @@ public class LogInformationController extends ServiceBase { ...@@ -74,8 +86,12 @@ public class LogInformationController extends ServiceBase {
hpsb001.setFileName(cutterbarWarning.getFileName()); hpsb001.setFileName(cutterbarWarning.getFileName());
hpsb001.setEquipmentCode(hpsb00A.getEquipmentCode()); hpsb001.setEquipmentCode(hpsb00A.getEquipmentCode());
hpsb001.setEquipmentType(hpsb00A.getEquipmentType()); hpsb001.setEquipmentType(hpsb00A.getEquipmentType());
DaoUtils.insert("HPSB001.insert", hpsb001); hpsb001List.add(hpsb001);
return "设备异常日志记录成功"; outInfo.addBlock(EiConstant.resultBlock).setRows(hpsb001List);
outInfo.set(EiConstant.serviceName, "HPSB001");
outInfo.set(EiConstant.methodName,"insert");
outInfo = XLocalManager.call(outInfo);
return outInfo.getMsg();
} }
} }
return "未解析到日志类型"; return "未解析到日志类型";
......
...@@ -78,6 +78,7 @@ public class ServiceHPSB002 extends ServiceBase { ...@@ -78,6 +78,7 @@ public class ServiceHPSB002 extends ServiceBase {
return query(inInfo); return query(inInfo);
} }
/** /**
* 修改操作. * 修改操作.
*/ */
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="主键id" hidden="true"/> <EF:EFColumn ename="id" cname="主键id" hidden="true"/>
<EF:EFColumn ename="createdName" cname="操作人" enable="false" readonly="true" width="150" align="center"/> <EF:EFColumn ename="createdBy" cname="操作人" enable="false" readonly="true" width="150" align="center"/>
<EF:EFColumn ename="errorCode" cname="异常编码" enable="false" readonly="true" width="100" align="center"/> <EF:EFColumn ename="errorCode" cname="异常编码" enable="false" readonly="true" width="100" align="center"/>
<EF:EFColumn ename="programNo" cname="程序号" enable="false" readonly="true" width="80" align="center"/> <EF:EFColumn ename="programNo" cname="程序号" enable="false" readonly="true" width="80" align="center"/>
<EF:EFColumn ename="equipmentType" cname="设备状态" enable="false" readonly="true" width="100" align="center"/> <EF:EFColumn ename="equipmentType" cname="设备状态" enable="false" readonly="true" width="100" align="center"/>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="主键id" hidden="true"/> <EF:EFColumn ename="id" cname="主键id" hidden="true"/>
<EF:EFColumn ename="createdName" cname="操作人" enable="false" readonly="true" width="150" align="center"/> <EF:EFColumn ename="createdBy" cname="操作人" enable="false" readonly="true" width="150" align="center"/>
<EF:EFColumn ename="equipmentType" cname="设备状态" enable="false" readonly="true" width="100" align="center"/> <EF:EFColumn ename="equipmentType" cname="设备状态" enable="false" readonly="true" width="100" align="center"/>
<EF:EFColumn ename="equipmentCode" cname="设备编码" enable="false" readonly="true" width="100" align="center"/> <EF:EFColumn ename="equipmentCode" cname="设备编码" enable="false" readonly="true" width="100" align="center"/>
<EF:EFColumn ename="logValue" cname="数据内容" enable="false" readonly="true" width="100" align="center"/> <EF:EFColumn ename="logValue" cname="数据内容" enable="false" readonly="true" width="100" align="center"/>
......
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