81041
2018-12-12 3bd99de902072d5c0ee55262403676eb50dcaa31
修改基站申请
5个文件已修改
200 ■■■■ 已修改文件
gx_tieta/src/com/fgkj/actions/Battinf_applyAction.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java 96 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/src/com/fgkj/dao/impl/User_infImpl.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/src/com/fgkj/dto/Battinf_apply.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/src/com/fgkj/services/Battinf_applyService.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/src/com/fgkj/actions/Battinf_applyAction.java
@@ -24,6 +24,20 @@
        result=tojson(model);
        return SUCCESS;
    }
    //申请人再我的申请页面的修改操作
    public String updatePro(){
        List<Battinf_apply> list=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken<List<Battinf_apply>>(){}.getType() );
        ServiceModel model=service.updatePro(list);
        result=tojson(model);
        return SUCCESS;
    }
    //我的申请中取消申请多条
    public String del(){
        List<Battinf_apply> list=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken<List<Battinf_apply>>(){}.getType() );
        ServiceModel model=service.del(list);
        result=tojson(model);
        return SUCCESS;
    }
     //添加申请
    public String add(){
        List<Battinf_apply> list=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken<List<Battinf_apply>>(){}.getType() );
gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java
@@ -41,8 +41,8 @@
        if(list!=null && list.size()>0){
            for (int i = 0; i < list.size(); i++) {
                Battinf_apply bapply=list.get(i);
                int uid=((User_inf)ActionUtil.getUser()).getUId();
                bapply.setApply_uid(uid);
                /*int uid=((User_inf)ActionUtil.getUser()).getUId();
                bapply.setApply_uid(uid);*/
                BattInf binf=bapply.getBinf();
                //验证新添加的机房是否存在
                List listS=(new BattInfImpl()).judgeBatt(binf);
@@ -67,11 +67,11 @@
                }
                maxb++;
                sql_str.add(sql);
                {
                /*{
                    String msg=((User_inf)ActionUtil.getUser()).getUId()+"申请添加"+binf.getStationName()+"机房"+binf.getBattGroupId()+"电池组的信息";
                    User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg);
                    listU.add(ulog);
                 }
                 }*/
            }
        }
        Boolean bl=false;
@@ -81,7 +81,7 @@
        }else{
            return false;
        }
        (new User_logService()).addPro(listU);//将用户的操作记录下来
        //(new User_logService()).addPro(listU);//将用户的操作记录下来
        
        return bl;
    }
@@ -126,10 +126,65 @@
        return bl;
        
    }
    public boolean del(Object obj) {
        // TODO Auto-generated method stub
    //申请人再我的申请页面的修改操作
    public boolean updatePro(Object obj){
        List<Battinf_apply> list=(List<Battinf_apply>) obj;
        List<User_log> listU=new ArrayList<User_log>();//存放user_log
        ArrayList<String> sql_str=new ArrayList();
        if(list!=null&&list.size()>0){
            for (int i = 0; i < list.size(); i++) {
                Battinf_apply bapply=list.get(i);
                bapply.setConfrim_uid(((User_inf)ActionUtil.getUser()).getUId());
                BattInf binf=bapply.getBinf();
                String sql_update_apply= "update db_battinf.tb_battinf_apply set StationName='"+binf.getStationName()+"',StationName1='"+binf.getStationName1()+"',StationName2='"+binf.getStationName2()+"',StationName3='"+binf.getStationName3()+"',StationName4='"+binf.getStationName4()+"',StationName5='"+binf.getStationName5()+"',StationIp='"+binf.getStationIp()+"',"
                        + "FBSDeviceName='"+binf.getFBSDeviceName()+"',GroupIndexInFBSDevice="+binf.getGroupIndexInFBSDevice()+",BattGroupNum="+binf.getBattGroupNum()+",BattGroupName='"+binf.getBattGroupName()+"',FloatVolLevel="+binf.getFloatVolLevel()+",OfflineVolLevel="+binf.getOfflineVolLevel()+",BattFloatCurrent="+binf.getBattFloatCurrent()+"," +
                          "MonCount="+binf.getMonCount()+",MonCapStd="+binf.getMonCapStd()+",monVolStd="+binf.getMonVolStd()+",monResStd="+binf.getMonResStd()+",MonSerStd="+binf.getMonSerStd()+",MonVolLowToAvg="+binf.getMonVolLowToAvg()+",BattProducer='"+binf.getBattProducer()+"',BattModel='"+binf.getBattModel()+"',BattProductDate='"+DAOHelper.sdf.format(binf.getBattProductDate())+"',BattInUseDate='"+DAOHelper.sdf.format(binf.getBattInUseDate())+"', "
                         +" Load_curr="+binf.getLoad_curr()+",install_user='"+binf.getInstall_user()+"',DisCurrMax="+binf.getDisCurrMax()+",station_phone='"+binf.getStation_phone()+"  where num="+bapply.getNum();
                sql_str.add(sql_update_apply);
                {
                    String msg="修改"+binf.getStationName()+"机房"+binf.getBattGroupId()+"电池组的信息";
                    User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
                    listU.add(ulog);
                 }
            }
        }
        Boolean bl=false;
        boolean en=BattinfGroupFactory.backup_battinf();
        if(en){
            bl=DAOHelper.makeManualCommit(DBUtil.getConn(), sql_str);
        }else{
        return false;
        }
        (new User_logService()).addPro(listU);//将用户的操作记录下来
        return bl;
    }
    //我的申请中取消申请多条
    public boolean del(Object obj) {
        List<Battinf_apply> list=(List<Battinf_apply>) obj;
        List<User_log> listU=new ArrayList<User_log>();//存放user_log
        ArrayList<String> sql_str=new ArrayList();
        if(list!=null&&list.size()>0){
            for (int i = 0; i < list.size(); i++) {
                Battinf_apply bapply=list.get(i);
                BattInf binf=bapply.getBinf();
                String sql_del_apply=" delete from  db_battinf.tb_battinf_apply where num="+bapply.getNum();
                sql_str.add(sql_del_apply);
                {
                    String msg="取消"+binf.getStationName()+"机房"+binf.getBattGroupId()+"电池组的申请";
                    User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
                    listU.add(ulog);
                 }
            }
        }
        Boolean bl=false;
        boolean en=BattinfGroupFactory.backup_battinf();
        if(en){
            bl=DAOHelper.makeManualCommit(DBUtil.getConn(), sql_str);
        }else{
            return false;
        }
        (new User_logService()).addPro(listU);//将用户的操作记录下来
        return bl;
    }
    
    public List searchAll() {
@@ -156,7 +211,9 @@
                        Battinf_apply apply=new Battinf_apply();
                        apply.setNum(rs.getInt("num"));
                        apply.setApply_uid(rs.getInt("apply_uid"));
                        apply.setApply_name((new User_infImpl()).changeUidToUname(apply.getApply_uid()));
                        apply.setConfrim_uid(rs.getInt("confrim_uid"));
                        apply.setConfirm_name((new User_infImpl()).changeUidToUname(apply.getConfrim_uid()));
                        apply.setApply_en(rs.getInt("apply_en"));
                        apply.setApply_date(rs.getTimestamp("apply_date"));
                        apply.setApply_note(rs.getString("apply_note"));
@@ -314,7 +371,7 @@
                 ",FBSDeviceName,GroupIndexInFBSDevice,battgroupId,BattGroupNum,BattGroupName,FloatVolLevel,OfflineVolLevel,BattFloatCurrent" +
                 ",MonCount,MonCapStd,monVolStd,monResStd,MonSerStd,MonVolLowToAvg,BattProducer,BattModel,BattProductDate,BattInUseDate,Load_curr,install_user,DisCurrMax,station_phone " +
                " from db_battinf.tb_battinf_apply " +
                " where apply_en=?  and apply_uid=? " +
                " where apply_en=?  and apply_uid=? order by apply_date desc " +
                " limit ?,? ";
        List<Battinf_apply> list=DAOHelper.executeQueryLimit(sql, conn, new Object[]{bapply.getApply_en(),bapply.getNum(),(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() {
            
@@ -325,7 +382,9 @@
                        Battinf_apply apply=new Battinf_apply();
                        apply.setNum(rs.getInt("num"));
                        apply.setApply_uid(rs.getInt("apply_uid"));
                        apply.setApply_name((new User_infImpl()).changeUidToUname(apply.getApply_uid()));
                        apply.setConfrim_uid(rs.getInt("confrim_uid"));
                        apply.setConfirm_name((new User_infImpl()).changeUidToUname(apply.getConfrim_uid()));
                        apply.setApply_en(rs.getInt("apply_en"));
                        apply.setApply_date(rs.getTimestamp("apply_date"));
                        apply.setApply_note(rs.getString("apply_note"));
@@ -382,10 +441,11 @@
        int number=LimitNumberFactory.GetLimtitNumber(conn, numberSql);
        //System.out.println("number: "+number);
        if(list!=null&&list.size()>0){
            list.get(list.size()-1).setNum(number);
            list.get(list.size()-1).setApply_note(String.valueOf(number));
        }
        return list;
    }
    public static void main(String[] args) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date1 = sdf.parse("2000-01-01 00:00:00");
@@ -398,10 +458,10 @@
        
        BattInf binf=new BattInf();
        binf.setStationName1("湖北省");
        binf.setStationName2("武汉市");
        binf.setStationName3("荆门市");
        binf.setStationName2("荆门市");
        binf.setStationName3("测试设备机房2");
        binf.setStationName4("BTS设备");
        binf.setStationName5("钟祥");
        binf.setStationName5("沙洋县");
        binf.setStationId("4011100");
        binf.setStationIp("");
        binf.setFBSDeviceId(910001000);
@@ -424,7 +484,7 @@
        binf.setMonVolLowToAvg(0.05f ); 
        binf.setLoad_curr(15f); 
        binf.setDisCurrMax(39.5f);
        binf.setStation_phone("12345678912");
        binf.setStation_phone("98765432198");
        binf.setBattProducer("");
        binf.setBattModel(""); 
        binf.setBattProductDate(ActionUtil.getSimpDate(date1));
@@ -436,12 +496,12 @@
        page.setPageSize(10);
        binf.setPage(page);
        bapply.setBinf(binf);
        List list=bimpl.serchByCondition(page);
        System.out.println(list.size());
        /*List list=new ArrayList();
        /*List list=bimpl.serchByCondition(page);
        System.out.println(list.size());*/
        List list=new ArrayList();
        list.add(bapply);
        boolean bl=bimpl.add(list);
        System.err.println(bl);*/
        System.err.println(bl);
        /*int dev_id=BattinfGroupFactory.searchmaxdev_id();
        System.out.println(dev_id);
        int station_id=BattinfGroupFactory.searchStationId();
gx_tieta/src/com/fgkj/dao/impl/User_infImpl.java
@@ -289,6 +289,35 @@
        return list;
    }    
    
    //根据uId查用户姓名
    public String changeUidToUname(Object obj) {
        int uid=(Integer) obj;
        String sql = "select distinct uName from db_user.tb_user_inf where uId=? limit 1";
        List list = DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{uid},new CallBack() {
                        public List getResults(ResultSet rs) {
                            List list=new ArrayList();
                                try {
                                    while(rs.next()){
                                        String uname="";
                                        if(rs.getString("uname")!=null){
                                            uname=rs.getString("uname");
                                            list.add(uname);
                                        }
                                    }
                                } catch (SQLException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                }
                                return list;
                        }
                    });
        String uname="";
        if(list!=null&&list.size()>0){
            uname=(String) list.get(list.size()-1);
        }
        return uname;
    }
    //查询所有uid在字符串objs中的所有用户名,并且用,连接多个用户名
    public List searchUnams(Object objs){        
        String sql = "SELECT GROUP_CONCAT(DISTINCT(uname))as unames from db_user.tb_user_inf where locate(uid,?);";
gx_tieta/src/com/fgkj/dto/Battinf_apply.java
@@ -6,7 +6,9 @@
public class Battinf_apply implements Serializable{
     private int num;
     private int apply_uid;
     private String apply_name;
     private int confrim_uid;
     private String confirm_name;
     private Date apply_date;
     private int apply_en;
     private String apply_note;
@@ -53,12 +55,27 @@
    public void setBinf(BattInf binf) {
        this.binf = binf;
    }
    public String getApply_name() {
        return apply_name;
    }
    public void setApply_name(String apply_name) {
        this.apply_name = apply_name;
    }
    public String getConfirm_name() {
        return confirm_name;
    }
    public void setConfirm_name(String confirm_name) {
        this.confirm_name = confirm_name;
    }
    @Override
    public String toString() {
        return "Battinf_apply [num=" + num + ", apply_uid=" + apply_uid
                + ", confrim_uid=" + confrim_uid + ", apply_date=" + apply_date
                + ", apply_en=" + apply_en + ", apply_note=" + apply_note
                + ", binf=" + binf + "]";
                + ", apply_name=" + apply_name + ", confrim_uid=" + confrim_uid
                + ", confirm_name=" + confirm_name + ", apply_date="
                + apply_date + ", apply_en=" + apply_en + ", apply_note="
                + apply_note + ", binf=" + binf + "]";
    }
     
}
gx_tieta/src/com/fgkj/services/Battinf_applyService.java
@@ -4,6 +4,7 @@
import com.fgkj.dao.BaseDAO;
import com.fgkj.dao.BaseDAOFactory;
import com.fgkj.dao.impl.Battinf_applyImpl;
import com.fgkj.dto.ServiceModel;
public class Battinf_applyService {
@@ -20,23 +21,46 @@
        boolean bl=dao.update(obj);
        if(bl){
            model.setCode(1);
            model.setMsg("确认成功!");
            model.setMsg("申请成功!");
        }else{
            model.setCode(0);
            model.setMsg("确实失败!");
            model.setMsg("申请失败!");
        }
        return model;
    }
     //添加申请
    public ServiceModel add(Object obj){
        boolean bl=dao.add(obj);
    //申请人再我的申请页面的修改操作
    public ServiceModel updatePro(Object obj){
        boolean bl=((Battinf_applyImpl)dao).updatePro(obj);
        if(bl){
            model.setCode(1);
            model.setMsg("修改成功!");
        }else{
            model.setCode(0);
            model.setMsg("修改失败!");
        }
        return model;
    }
    //我的申请中取消申请多条
    public ServiceModel del(Object obj){
        boolean bl=dao.del(obj);
        if(bl){
            model.setCode(1);
            model.setMsg("确认成功!");
        }else{
            model.setCode(0);
            model.setMsg("确实失败!");
            model.setMsg("确认失败!");
        }
        return model;
    }
     //添加申请
    public ServiceModel add(Object obj){
        boolean bl=dao.add(obj);
        if(bl){
            model.setCode(1);
            model.setMsg("添加成功!");
        }else{
            model.setCode(0);
            model.setMsg("添加失败!");
        }
        return model;
    }