⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 assettypemgr.java

📁 oa 源码
💻 JAVA
字号:
package com.redmoon.oa.asset;import cn.js.fan.util.*;import com.redmoon.oa.pvg.Privilege;import cn.js.fan.util.ErrMsgException;import javax.servlet.http.*;import org.apache.log4j.Logger;public class AssetTypeMgr {    Logger logger = Logger.getLogger(AssetTypeMgr.class.getName());    public AssetTypeMgr() {    }    public boolean create(HttpServletRequest request) throws ErrMsgException {        Privilege privilege = new Privilege();                        boolean re = true;        String errmsg = "";        String name = ParamUtil.get(request, "name");        String depreciationRate = ParamUtil.get(request, "depreciationRate");        String depreciationYears = ParamUtil.get(request, "depreciationYears");        String abstracts = ParamUtil.get(request, "abstracts");        if (name.equals(""))            errmsg += "名称不能为空!\\n";        if (StrUtil.toDouble(depreciationRate) > 1)            errmsg += "折旧率必须是小于1的小数!\\n";        if (!StrUtil.isNumeric(depreciationYears)) {                errmsg += "折旧年限输入错误!\\n";        }        if (!errmsg.equals(""))            throw new ErrMsgException(errmsg);        AssetTypeDb atd = new AssetTypeDb();        if (atd.isExist(name))            throw new ErrMsgException("该类别已存在!");        else {            atd.setName(name);            atd.setAbstracts(abstracts);            atd.setDepreciationRate(depreciationRate);            atd.setDepreciationYears(Integer.parseInt(depreciationYears));            re = atd.create();        }        return re;    }    public AssetTypeDb getAssetTypeDb(int id) {        AssetTypeDb atd = new AssetTypeDb();        return atd.getAssetTypeDb(id);    }    public boolean del(HttpServletRequest request) throws ErrMsgException {        int id = ParamUtil.getInt(request, "id");        AssetTypeDb atd = getAssetTypeDb(id);        if (atd == null || !atd.isLoaded())            throw new ErrMsgException("该项已不存在!");        AssetDb adb = new AssetDb();        if (adb.hasAssetOfType(id)) {                        throw new ErrMsgException("该类别下面已有资产,必需删除后才能执行此操作!");        }        return atd.del();    }    public boolean modify(HttpServletRequest request) throws ErrMsgException {        Privilege privilege = new Privilege();                        boolean re = true;        String errmsg = "";        int id = ParamUtil.getInt(request, "id");        String name = ParamUtil.get(request, "name");        String depreciationRate = ParamUtil.get(request, "depreciationRate");        int depreciationYears = ParamUtil.getInt(request, "depreciationYears");        String abstracts = ParamUtil.get(request, "abstracts");        if (name.equals(""))            errmsg += "名称不能为空!\\n";        if (StrUtil.toDouble(depreciationRate) > 1)            errmsg += "折旧率必须是小于1的小数!\\n";        if (!errmsg.equals(""))            throw new ErrMsgException(errmsg);        AssetTypeDb atd = getAssetTypeDb(id);        atd.setName(name);        atd.setAbstracts(abstracts);        atd.setDepreciationRate(depreciationRate);        atd.setDepreciationYears(depreciationYears);        re = atd.save();        return re;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -