From 3bd99de902072d5c0ee55262403676eb50dcaa31 Mon Sep 17 00:00:00 2001 From: 81041 <81041@192.168.10.16> Date: 星期三, 12 十二月 2018 14:14:44 +0800 Subject: [PATCH] 修改基站申请 --- gx_tieta/src/com/fgkj/actions/Battinf_applyAction.java | 14 +++ gx_tieta/src/com/fgkj/dto/Battinf_apply.java | 23 +++++ gx_tieta/src/com/fgkj/services/Battinf_applyService.java | 38 +++++++- gx_tieta/src/com/fgkj/dao/impl/User_infImpl.java | 29 +++++++ gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java | 98 +++++++++++++++++++---- 5 files changed, 173 insertions(+), 29 deletions(-) diff --git a/gx_tieta/src/com/fgkj/actions/Battinf_applyAction.java b/gx_tieta/src/com/fgkj/actions/Battinf_applyAction.java index eb9ba94..9dbf043 100644 --- a/gx_tieta/src/com/fgkj/actions/Battinf_applyAction.java +++ b/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() ); diff --git a/gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java b/gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java index 1725859..360bd40 100644 --- a/gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java +++ b/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 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) { - // TODO Auto-generated method stub - return false; + 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,11 +441,12 @@ 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 { + + 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"); Date date2 = sdf.parse("2020-01-01 23:59:59"); @@ -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(); diff --git a/gx_tieta/src/com/fgkj/dao/impl/User_infImpl.java b/gx_tieta/src/com/fgkj/dao/impl/User_infImpl.java index a42c68d..37fbf77 100644 --- a/gx_tieta/src/com/fgkj/dao/impl/User_infImpl.java +++ b/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; + } //鏌ヨ鎵�鏈塽id鍦ㄥ瓧绗︿覆objs涓殑鎵�鏈夌敤鎴峰悕,骞朵笖鐢紝杩炴帴澶氫釜鐢ㄦ埛鍚� public List searchUnams(Object objs){ String sql = "SELECT GROUP_CONCAT(DISTINCT(uname))as unames from db_user.tb_user_inf where locate(uid,?);"; diff --git a/gx_tieta/src/com/fgkj/dto/Battinf_apply.java b/gx_tieta/src/com/fgkj/dto/Battinf_apply.java index acc61b7..25bf2dc 100644 --- a/gx_tieta/src/com/fgkj/dto/Battinf_apply.java +++ b/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 + "]"; } + } diff --git a/gx_tieta/src/com/fgkj/services/Battinf_applyService.java b/gx_tieta/src/com/fgkj/services/Battinf_applyService.java index 49d197c..72ea088 100644 --- a/gx_tieta/src/com/fgkj/services/Battinf_applyService.java +++ b/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; } -- Gitblit v1.9.1