package com.sar.elec.service.impl.equipment;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.struts.upload.FormFile;
import com.sar.elec.dao.SarDeviceXJDAO;
import com.sar.elec.domain.SarDevice;
import com.sar.elec.domain.SarFileUpload;
import com.sar.elec.domain.SarOverhaulRecord;
import com.sar.elec.domain.SarUser;
import com.sar.elec.exception.business.BusinessException;
import com.sar.elec.service.equipment.SarDeviceXJManage;
import com.sar.elec.service.impl.BaseService;
import com.sar.elec.util.Constants;
import com.sar.elec.util.PageInfo;
import com.sar.elec.util.StringHelper;
import com.sar.elec.util.UploadBean;
import com.sar.elec.webapp.form.equipment.AddDeviceJForm;
import com.sar.elec.webapp.form.equipment.AddDeviceXForm;
import com.sar.elec.webapp.form.equipment.ChangePageDeviceJForm;
import com.sar.elec.webapp.form.equipment.ChangePageDeviceXForm;
import com.sar.elec.webapp.form.equipment.MoreUpdateDeviceJForm;
import com.sar.elec.webapp.form.equipment.MoreUpdateDeviceXForm;
import com.sar.elec.webapp.form.equipment.SearchDeviceJBean;
import com.sar.elec.webapp.form.equipment.SearchDeviceJForm;
import com.sar.elec.webapp.form.equipment.SearchDeviceXBean;
import com.sar.elec.webapp.form.equipment.SearchDeviceXForm;
import com.sar.elec.webapp.form.equipment.ShowDeviceXJBean;
import com.sar.elec.webapp.form.equipment.TypeDeviceXForm;
import com.sar.elec.webapp.form.equipment.UploadForm;
public class SarDeviceXJManageImpl extends BaseService implements
SarDeviceXJManage {
private SarDeviceXJDAO sarDeviceXJDao;
public void setSarDeviceXJDao(SarDeviceXJDAO sarDeviceXJDao) {
this.sarDeviceXJDao = sarDeviceXJDao;
}
// add by liu on 2007-06-05 start
public String getJctIdByDevId(String devId)
{
String jctId = sarDeviceXJDao.getJctIdByDevId(devId);
return jctId;
}
// add by liu on 2007-06-05 end
// add by liu on 2007-06-05 start
public String getJctIdDdlNameByDdlCode(String jctId)
{
String jctIdDdlName = sarDeviceXJDao.getJctIdDdlNameByDdlCode(jctId);
return jctIdDdlName;
}
// add by liu on 2007-06-05 end
/**
* 数据字典
*
* @param HttpServletRequest
* request
* @return List null
*/
public List getSystemDLL(HttpServletRequest request)
throws BusinessException {
String operstr=(String)request.getSession().getAttribute("GLOBAL_RIGHTS");
List listTS=new ArrayList();
if(!operstr.contains("o")){ //如果不包含这个权限
listTS = sarDeviceXJDao.getSystemDLL("所属单位",(String)request.getSession().getAttribute("GLOBAL_USER_JCTID"));
}else{
listTS = sarDeviceXJDao.getSystemDLL("所属单位");
}
List list = sarDeviceXJDao.getSystemDLL("设备类型");
List listZT = sarDeviceXJDao.getSystemDLL("设备状态");
HttpSession session = request.getSession();
if (list == null) {
throw new BusinessException(Constants.ERRORMSG_NULLDATAERROR);
}
if (listTS == null) {
throw new BusinessException(Constants.ERRORMSG_NULLDATAERROR);
}
if (listZT == null) {
throw new BusinessException(Constants.ERRORMSG_NULLDATAERROR);
}
session.setAttribute("DT", list);
session.setAttribute("TS", listTS);
session.setAttribute("ZT", listZT);
return null;
}
/**
* 删除[设备校准记录]
*
* @param SarOverhaulRecord
* sarOverhaulRecord
*/
public void delDeviceX(SarOverhaulRecord sarOverhaulRecord)
throws BusinessException {
// dao.removeObject(SarDevicePlan.class,sarDevice.getDevPlanId());
if (sarOverhaulRecord.getSeqId() == null
|| sarOverhaulRecord.getSeqId().equals("")) {
throw new BusinessException(Constants.ERRORMSG_NULLDATAERROR);
}
/*
SarOverhaulRecord sor = (SarOverhaulRecord) dao.getObject(
SarOverhaulRecord.class, sarOverhaulRecord.getSeqId());
*/
//add by shijiandong on 2007-4-28 start 目的:查询所有此设备的检修记录
SarOverhaulRecord sor=new SarOverhaulRecord();
sor.setDevId(sarOverhaulRecord.getDevId());
sor.setIsAdjust("0");
List list=sarDeviceXJDao.getObjectsByExample(sor);
//add by shijiandong on 2007-4-28 end
if (sor == null) {
throw new BusinessException(Constants.ERRORMSG_NULLDATAERROR);
}
/*
sor.setIsDelete("1");
dao.saveOrUpdateObject(sor);
*/
//add by shijiandong on 2007-4-28 start 目的:批量删除
sarDeviceXJDao.deleteList(list);
//add by shijiandong on 2007-4-28 end
SarDevice sarDevice = (SarDevice) dao.getObject(SarDevice.class,
sarOverhaulRecord.getDevId());
sarDevice.setApstate("0");
dao.saveOrUpdateObject(sarDevice);
}
/**
* 批量添加[设备校准记录]
*
* @param MoreUpdateDeviceXForm
* moreUpdateDeviceXForm
* @param HttpServletRequest
* request
*/
public void saveMoreUpdateDeviceX(MoreUpdateDeviceXForm moreUpdateDeviceXForm,
HttpServletRequest request) throws BusinessException {
List devIdList = StringHelper.split(moreUpdateDeviceXForm.getDevId(),",");
HttpSession session = request.getSession();
Date date = new Date();
SarUser sarUser = (SarUser) session.getAttribute(Constants.GLOBAL_USER);
if (sarUser == null) {
throw new BusinessException(Constants.ERRORMSG_NULLDATAERROR);
}
if (devIdList == null) {
throw new BusinessException(Constants.ERRORMSG_NULLDATAERROR);
}
/*List sorlist=new ArrayList();*/
List sdlist=new ArrayList();
SarOverhaulRecord sor = null;
Iterator iterator = devIdList.iterator();
while (iterator.hasNext()) {
String str = (String) iterator.next();
sor = new SarOverhaulRecord();
sor.setDevId(str);
sor.setIsAdjust("0");
sor.setRecord(moreUpdateDeviceXForm.getRecord());
sor.setComment(moreUpdateDeviceXForm.getComment());
sor.setCreateDate(date);
sor.setLastDate(date);
sor.setCreateEmpId(sarUser.getUserId());
sor.setLastEmpId(sarUser.getUserId());
sor.setIsDelete("0");
sor.setStartDate(StringHelper.converStringToDate(moreUpdateDeviceXForm.getStartDate()+ " 00:00:00"));
if (moreUpdateDeviceXForm.getIsHaving().equals("1")) {
sor.setIsHaving("1");
} else {
sor.setIsHaving("0");
}
// 自动取得校准日期+周期
if (str == null || str.equals("")) {
throw new BusinessException(Constants.ERRORMSG_NULLDATAERROR);
}
SarDevice SD = (SarDevice) dao.getObject(SarDevice.class, str);
if (SD == null) {
throw new BusinessException(Constants.ERRORMSG_NULLDATAERROR);
}
int margin = 0;
Calendar calendar = null;
calendar = Calendar.getInstance();
calendar.setTime(StringHelper.converStringToDate(moreUpdateDeviceXForm.getStartDate()+ " 00:00:00"));
if (SD.getApunit().equals("年")) {
margin = Integer.parseInt(SD.getAdjustPeriod());
int year = calendar.get(Calendar.YEAR);
calendar.set(Calendar.YEAR, year + margin);
} else {
margin = Integer.parseInt(SD.getAdjustPeriod());
int month = calendar.get(Calendar.MONTH);
calendar.set(Calendar.MONTH, month + margin);
}
// getTime()方法是取得当前的日期,其返回值是一个java.util.Date类的对象
Date date1 = calendar.getTime();
sor.setEndDate(date1);
// 自动取得校准日期+周期
/*sorlist.add(sor);*/
// add by shijiandong on 2007-4-28 start 目的:在添加新记录之前。将该设备的所有记录改为历史记录(isDelete=1)
SarOverhaulRecord updateSors=new SarOverhaulRecord();
updateSors.setDevId(str);
updateSors.setIsAdjust("0");
List sorList=dao.getObjectsByExample(updateSors);
List updateSorList=new ArrayList();
if (sorList.size()>0) {
Iterator iter=sorList.iterator();
while (iter.hasNext()) {
SarOverhaulRecord updateSor = (SarOverhaulRecord) iter.next();
updateS
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
国家电网设备资源管理系统.zip_jsp_sqlserver_国家电网_国家电网系统_电网管理系统 (901个子文件)
testSar.bak 4.95MB
SarDeviceXJManageImpl.class 33KB
SarProjectPlanManageImpl.class 22KB
DeviceXJAction.class 21KB
ProjectPlanAction.class 20KB
SarProjectManageImpl.class 15KB
SarDeviceManageImpl.class 14KB
SarDevicePlanManageImpl.class 14KB
BuildProjAction.class 13KB
SarProjectLayoutManageImpl.class 13KB
RepairInfoAction.class 12KB
SarEngineeingPlanManageImpl.class 12KB
SarEngineeingManageImpl.class 11KB
SarProjectLayoutDAOHib$1.class 10KB
SarProjectPlanDAOHib$4.class 9KB
SarProjectDAOHib$12.class 9KB
StationInfoAction.class 9KB
JctBuildAction.class 9KB
SystemManageImpl.class 9KB
RunInfoImpl.class 9KB
LayoutProjAction.class 9KB
SarProjectPlanDAOHib$5.class 9KB
SarProjectPlanDAOHib.class 8KB
DeviceAction.class 8KB
SarProjectDAOHib$1.class 8KB
MD5keyBean.class 8KB
SarDevice.class 8KB
UploadBean.class 8KB
GenerateSqlFromExcel.class 8KB
UserManageAction.class 7KB
SarProjectDAOHib.class 7KB
SarDevicePlan.class 7KB
RepairInfoImpl.class 7KB
DevicePlanAction.class 7KB
BaseAction.class 7KB
SarProjectLayoutDAOHib$2.class 7KB
SarProjectDAOHib$2.class 6KB
ExcelImportDAOHib.class 6KB
RunInfoAction.class 6KB
StationManageImpl.class 6KB
SarProjectPlan.class 6KB
SarProjectLayoutDAOHib.class 6KB
SaveDeviceForm.class 6KB
JctBuildManageImpl.class 6KB
ExcelImportDAOHib$3.class 6KB
SarDevicePlanDAOHib$3.class 6KB
SaveDevicePlanForm.class 6KB
BaseDAOHibernate.class 6KB
SarDeviceXJDAOHib.class 6KB
EngineeingPlanAction.class 6KB
SarProjectLayout.class 6KB
SarProjectDAOHib$3.class 5KB
SarProjectDAOHib$10.class 5KB
InfAndPaperManageAction.class 5KB
UploadAction.class 5KB
ExcelImportDAOHib$2.class 5KB
ConvertUtil.class 5KB
SarProjectDAOHib$11.class 5KB
StringHelper.class 5KB
SarUser.class 5KB
InfAndPaperManageImpl.class 5KB
SarProject.class 5KB
PlanReaultForm.class 5KB
DevicePlanBean.class 5KB
SarEngineeringDAOHib.class 5KB
SarJctBuild.class 5KB
SarSubEngineering.class 5KB
SarProjectPlanAddForm.class 5KB
SarProjectLayoutAddOrUpdataForm.class 5KB
SarStationBug.class 5KB
ExcelImportDAOHib$7.class 5KB
SystemManageAction.class 5KB
SarEngineeringPlanDAOHib$5.class 4KB
SarEngineeringPlanDAOHib$6.class 4KB
SarStation.class 4KB
SarSubEngineeringPlanHistory.class 4KB
InvestJinDuForm.class 4KB
FindResultForm.class 4KB
SarStationDAOHib.class 4KB
SarEngineeringPlanDAOHib.class 4KB
SarUserForm.class 4KB
LoginManagerImpl.class 4KB
BuildResultForm.class 4KB
PageInfo.class 4KB
SarOverhaulRecord.class 4KB
RepairInfoForm.class 4KB
RunInfoForm.class 4KB
SarSubEngineeringPlan.class 4KB
SarDevicePlanDAOHib.class 4KB
SarAntenna.class 4KB
SarStationRunDAOHib.class 4KB
LoginAction.class 4KB
ExcelFileGenerator.class 4KB
SarStationRunDAOHib$4.class 4KB
DateUtil.class 4KB
ChangePageForm.class 4KB
JctBuildForm.class 4KB
BuildEngineAction.class 4KB
SarDeviceXJDAOHib$4.class 4KB
SarDeviceXJDAOHib$1.class 4KB
共 901 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
资源评论
- m0_464807872023-02-26感谢资源主分享的资源解决了我当下的问题,非常有用的资源。
weixin_42651887
- 粉丝: 75
- 资源: 1万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功