📄 officeopmgr.java
字号:
package com.redmoon.oa.officeequip;import cn.js.fan.util.*;import cn.js.fan.util.ErrMsgException;import javax.servlet.http.*;import org.apache.log4j.Logger;import com.redmoon.oa.person.UserDb;public class OfficeOpMgr { Logger logger = Logger.getLogger(OfficeOpMgr.class.getName()); public OfficeOpMgr() { } public boolean create(HttpServletRequest request) throws ErrMsgException { boolean re = true; int type; String person = "", opDate = "", remark = "", officeId = "", count = ""; officeId = ParamUtil.get(request, "equipId"); if (!StrUtil.isNumeric(officeId)) { throw new ErrMsgException("用品名称不能为空!"); } person = ParamUtil.get(request, "person"); UserDb ud = new UserDb(); ud = ud.getUserDb(person); count = ParamUtil.get(request, "storageCount"); if (!StrUtil.isNumeric(count)) { throw new ErrMsgException("数量不能为空!"); } opDate = ParamUtil.get(request, "opDate"); remark = ParamUtil.get(request, "abstracts"); if (ud == null || !ud.isLoaded()) { throw new ErrMsgException("用户" + person + "不存在!"); } OfficeOpDb office = new OfficeOpDb(); type = ParamUtil.getInt(request, "type"); office.setOfficeId(Integer.parseInt(officeId)); office.setCount(Integer.parseInt(count)); office.setType(type); java.util.Date d = null; try { d = DateUtil.parse(opDate, "yyyy-MM-dd"); } catch (Exception e) { logger.error("create:" + e.getMessage()); } office.setOpDate(d); office.setPerson(person); office.setRemark(remark); re = office.create(); return re; } public OfficeOpDb getOfficeOpDb(int id) { OfficeOpDb addr = new OfficeOpDb(); return addr.getOfficeOpDb(id); } public boolean del(HttpServletRequest request) throws ErrMsgException { boolean re = true; String strids = ParamUtil.get(request, "ids"); String[] ids = strids.split(","); int id; for (int i = 0; i < ids.length; i++) { id = Integer.parseInt(ids[i]); OfficeOpDb od = getOfficeOpDb(id); re = od.del(); } return re; } public boolean returnOfficeEquip(HttpServletRequest request) throws ErrMsgException { boolean re = true; String returnDate = ""; int officeId = ParamUtil.getInt(request, "id"); returnDate = ParamUtil.get(request, "endDate"); OfficeOpDb ood = new OfficeOpDb(); ood = ood.getOfficeOpDb(officeId); ood.setType(2); java.util.Date d = null; try { d = DateUtil.parse(returnDate, "yyyy-MM-dd"); } catch (Exception e) { logger.error("returnOfficeEquip:" + e.getMessage()); } ood.setReturnDate(d); re = ood.save(); return re; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -