Commit 5db22179 by liuyang

2024-05-24 审批保养删除提示修改和设备点检删除提示修改

parent 79527944
......@@ -80,16 +80,15 @@ public class ServiceHGSB003 extends ServiceEPBase {
Map<?, ?> map = eiBlock.getRow(i);
hgsb003.fromMap(map);
hgsb003.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hgsb003.getStatus().equals(CommonConstant.PlanStatus.UN_PLAN)){
throw new PlatException("维保申请审批完成,无法删除");
}
DaoUtils.update(HGSB003.DELETE_FLAG, hgsb003.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
......@@ -149,11 +148,7 @@ public class ServiceHGSB003 extends ServiceEPBase {
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
......@@ -172,11 +167,7 @@ public class ServiceHGSB003 extends ServiceEPBase {
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
LogUtils.setDetailMsg(inInfo, e, "上传失败");
}
return inInfo;
}
......
......@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.sb.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
......@@ -85,16 +86,22 @@ public class ServiceHGSB004 extends ServiceEPBase {
String str = "设备点检已审批完成,无法删除!";
throw new PlatException(str);
}
Map map1 = new HashMap<>();
map1.put(HGSB002.FIELD_COMPANY_CODE,hgsb004.getCompanyCode());
map1.put(HGSB002.FIELD_PLAN_CODE,hgsb004.getPlanCode());
map1.put(HGSB002.FIELD_PLAN_START_DATE,hgsb004.getPlanStartDate());
map1.put(HGSB002.FIELD_PLAN_END_DATE,hgsb004.getPlanEndDate());
List<HGSB002> list = DaoBase.getInstance().query(HGSB002.QUERY, map1);
for (HGSB002 hgsb002 : list){
hgsb002.setTaskStatus(0);
DaoUtils.update(HGSB002.UPDATE, hgsb002);
}
DaoUtils.update(HGSB004.DELETE_FLAG, hgsb004.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
......@@ -155,11 +162,7 @@ public class ServiceHGSB004 extends ServiceEPBase {
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
......
......@@ -4,8 +4,11 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.sb.domain.HGSB002;
import com.baosight.hggp.hg.sb.domain.HGSB002A;
import com.baosight.hggp.hg.sb.domain.HGSB004;
import com.baosight.hggp.hg.sb.domain.HGSB004A;
import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.ErrorCodeUtils;
import com.baosight.hggp.util.LogUtils;
......@@ -55,6 +58,11 @@ public class ServiceHGSB004A extends ServiceEPBase {
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
Long parentId = Long.valueOf(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSB002A.FIELD_PARENT_ID));
HGSB004 hgsb004 = HGSBTools.Hgsb004.getId(parentId);
if (hgsb004.getCheckStatus().equals(CommonConstant.PlanStatus.UN_PLAN)){
throw new PlatException("设备点检审批完成,无法删除");
}
HGSB004A hgsb004a = new HGSB004A();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
......@@ -66,11 +74,7 @@ public class ServiceHGSB004A extends ServiceEPBase {
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
......@@ -126,11 +130,7 @@ public class ServiceHGSB004A extends ServiceEPBase {
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
LogUtils.setDetailMsg(inInfo, e, "上传失败");
}
return inInfo;
}
......
......@@ -23,7 +23,9 @@ import java.util.*;
*/
public class HGSBTools {
/*查询当前用户是否拥有全部权限*/
/**
* 查询当前用户是否拥有全部权限
*/
public static Boolean getRoleDataAuth(){
boolean onlyPeople = false;
// 当前用户所有角色
......@@ -37,7 +39,8 @@ public class HGSBTools {
return onlyPeople;
}
/*查询用户所属公司
/**
* 查询用户所属公司
*/
public static Map<String, Object> getUserCompany(){
Map<String, Object> orgMap = new HashMap();
......@@ -55,7 +58,8 @@ public class HGSBTools {
return orgMap;
}
/*查询用户所属公司用户
/**
* 查询用户所属公司用户
*/
public static List<String> getOrgId(){
Map<String, Object> orgMap = new HashMap();
......@@ -97,6 +101,11 @@ public class HGSBTools {
return results.get(0);
}
public static List<HGSB002> getList(Map queryMap) {
List<HGSB002> results = DaoBase.getInstance().query(HGSB002.QUERY, queryMap);
return results;
}
/**
* 查询设备计划详情
*
......@@ -122,6 +131,21 @@ public class HGSBTools {
/**
* 查询
*
* @param id
*/
public static HGSB004 getId(Long id) {
AssertUtils.isNull(id, "设备点检不能为空");
Map queryMap = new HashMap();
queryMap.put(HGSB004.FIELD_ID, id);
queryMap.put(HGSB004.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
List<HGSB004> results = DaoBase.getInstance().query(HGSB004.QUERY, queryMap);
AssertUtils.isEmpty(results, "设备点检不存在");
return results.get(0);
}
/**
* 查询
*
* @param hgsb004
*/
public static List<HGSB004> get(HGSB004 hgsb004) {
......@@ -129,5 +153,19 @@ public class HGSBTools {
List<HGSB004> results = DaoBase.getInstance().query(HGSB004.QUERY, hgsb004);
return results;
}
/**
* 查询设备点检详情
*
* @param parentId
*/
public static List<HGSB004A> getDetails(Long parentId) {
AssertUtils.isNull(parentId, "设备点检不能为空");
Map queryMap = new HashMap();
queryMap.put(HGSB004A.FIELD_PARENT_ID, parentId);
queryMap.put(HGSB004A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
List<HGSB004A> results = DaoBase.getInstance().query(HGSB004A.QUERY, queryMap);
return results;
}
}
}
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