Commit 554e11c2 by liuyang

2024-04-23 设备日志和设备异常优化

parent ad6bc893
...@@ -2,10 +2,16 @@ package com.baosight.hpjx.hp.ds.service; ...@@ -2,10 +2,16 @@ package com.baosight.hpjx.hp.ds.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.hp.ds.domain.HPDS001; import com.baosight.hpjx.hp.ds.domain.HPDS001;
import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.HashMap;
/** /**
* Title: 历史数据清理 <br> * Title: 历史数据清理 <br>
* @author LiuYang * @author LiuYang
...@@ -21,6 +27,16 @@ public class ServiceHPDS001 extends ServiceEPBase { ...@@ -21,6 +27,16 @@ public class ServiceHPDS001 extends ServiceEPBase {
@OperationLogAnnotation(operModul = "系统操作日志", operType = "删除", operDesc = "删除6个月之前的历史数据") @OperationLogAnnotation(operModul = "系统操作日志", operType = "删除", operDesc = "删除6个月之前的历史数据")
public EiInfo deleteHistory(EiInfo inInfo) { public EiInfo deleteHistory(EiInfo inInfo) {
return super.delete(inInfo,"HPDS001.deleteHistory"); try {
this.dao.delete("HPDS001.deleteHistory",new HashMap<>());
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(0), I18nMessages.getText("label.delete", "删除")});
}catch (PlatException e){
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,0,e);
logError("删除失败", e.getMessage());
}
return inInfo;
} }
} }
...@@ -7,11 +7,13 @@ import com.baosight.hpjx.core.security.UserSessionUtils; ...@@ -7,11 +7,13 @@ import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.sb.domain.HPSB001; import com.baosight.hpjx.hp.sb.domain.HPSB001;
import com.baosight.hpjx.hp.sc.domain.HPSC001; import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
...@@ -145,7 +147,17 @@ public class ServiceHPSB001 extends ServiceBase { ...@@ -145,7 +147,17 @@ public class ServiceHPSB001 extends ServiceBase {
*/ */
@OperationLogAnnotation(operModul = "设备异常日志", operType = "删除", operDesc = "删除30天之前的历史数据") @OperationLogAnnotation(operModul = "设备异常日志", operType = "删除", operDesc = "删除30天之前的历史数据")
public EiInfo deleteHistory(EiInfo inInfo) { public EiInfo deleteHistory(EiInfo inInfo) {
return super.delete(inInfo,"HPSB001.deleteByCreatedTime"); try {
this.dao.delete("HPSB001.deleteByCreatedTime",new HashMap<>());
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(0), I18nMessages.getText("label.delete", "删除")});
}catch (PlatException e){
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,0,e);
logError("删除失败", e.getMessage());
}
return inInfo;
} }
} }
...@@ -3,15 +3,18 @@ package com.baosight.hpjx.hp.sb.service; ...@@ -3,15 +3,18 @@ package com.baosight.hpjx.hp.sb.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.sb.domain.HPSB002; import com.baosight.hpjx.hp.sb.domain.HPSB002;
import com.baosight.hpjx.util.ErrorCodeUtils;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
...@@ -140,7 +143,17 @@ public class ServiceHPSB002 extends ServiceBase { ...@@ -140,7 +143,17 @@ public class ServiceHPSB002 extends ServiceBase {
*/ */
@OperationLogAnnotation(operModul = "设备日志", operType = "删除", operDesc = "删除30天之前的历史数据") @OperationLogAnnotation(operModul = "设备日志", operType = "删除", operDesc = "删除30天之前的历史数据")
public EiInfo deleteHistory(EiInfo inInfo) { public EiInfo deleteHistory(EiInfo inInfo) {
return super.delete(inInfo,"HPSB002.deleteByCreatedTime"); try {
this.dao.delete("HPSB002.deleteByCreatedTime",new HashMap<>());
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(0), I18nMessages.getText("label.delete", "删除")});
}catch (PlatException e){
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,0,e);
logError("删除失败", e.getMessage());
}
return inInfo;
} }
} }
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