From 1c25524f12918b63af745a79f59d0e94f1ec6d3c Mon Sep 17 00:00:00 2001
From: 81041 <81041@192.168.10.16>
Date: 星期二, 11 十二月 2018 15:25:44 +0800
Subject: [PATCH] 修改
---
gx_tieta/src/com/fgkj/dao/BattinfGroupFactory.java | 24 ++++-
gx_tieta/src/com/fgkj/actions/Battinf_applyAction.java | 18 ++++
gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java | 2
gx_tieta/src/com/fgkj/services/Battinf_applyService.java | 26 ++++++
gx_tieta/src/com/fgkj/dao/impl/Batt_rtstateDAOImpl.java | 2
gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java | 164 ++++++++++++++++++++++++++++++++++++++---
6 files changed, 215 insertions(+), 21 deletions(-)
diff --git a/gx_tieta/src/com/fgkj/actions/Battinf_applyAction.java b/gx_tieta/src/com/fgkj/actions/Battinf_applyAction.java
index 6c63ae6..8a36312 100644
--- a/gx_tieta/src/com/fgkj/actions/Battinf_applyAction.java
+++ b/gx_tieta/src/com/fgkj/actions/Battinf_applyAction.java
@@ -5,6 +5,7 @@
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Battinf_apply;
import com.fgkj.dto.ServiceModel;
+import com.fgkj.dto.User_inf;
import com.fgkj.services.Battinf_applyService;
import com.google.gson.reflect.TypeToken;
@@ -29,7 +30,22 @@
result=tojson(model);
return SUCCESS;
}
-
+ //鏌ヨ鍑烘墍鏈夐渶瑕佺‘璁ょ殑鐢宠
+ public String serchByCondition(){
+ Battinf_apply bapply=ActionUtil.getGson().fromJson(json, Battinf_apply.class);
+ ServiceModel model=service.serchByCondition(bapply);
+ result=tojson(model);
+ return SUCCESS;
+ }
+ //鏌ヨ鍑哄鏍稿畬鐨勭敵璇峰拰寰呭鏍哥殑鐢宠
+ public String serchByInfo(){
+ Battinf_apply bapply=ActionUtil.getGson().fromJson(json, Battinf_apply.class);
+ User_inf uinf=(User_inf) getUser();
+ bapply.setNum(uinf.getUId());
+ ServiceModel model=service.serchByInfo(bapply);
+ result=tojson(model);
+ return SUCCESS;
+ }
public String getResult() {
diff --git a/gx_tieta/src/com/fgkj/dao/BattinfGroupFactory.java b/gx_tieta/src/com/fgkj/dao/BattinfGroupFactory.java
index 20e7edf..87a204a 100644
--- a/gx_tieta/src/com/fgkj/dao/BattinfGroupFactory.java
+++ b/gx_tieta/src/com/fgkj/dao/BattinfGroupFactory.java
@@ -109,15 +109,27 @@
}
//鏌ヨ褰撳墠鏈�澶х殑鐢垫睜缁刬d
public static int searchMaxBattgroupId(){
- int BattgroupId_max=(new Batt_rtstateDAOImpl()).searchMaxBattgroupId();//褰撳墠鍐呭瓨涓渶澶х殑鐢垫睜缁刬d
- int BattgroupId_next=BattgroupId_max+1;
- return BattgroupId_next;
+ int battgroupid=0;
+ int BattgroupId_inf=(new Batt_rtstateDAOImpl()).searchMaxBattgroupId();//褰撳墠鍐呭瓨涓渶澶х殑鐢垫睜缁刬d
+ int BattgroupId_apply=(new Battinf_applyImpl()).searchMaxBattgroupId_apply();//褰撳墠鍐呭瓨涓渶澶х殑鐢垫睜缁刬d
+ if(BattgroupId_inf>=BattgroupId_apply){
+ battgroupid=BattgroupId_inf+1;
+ }else{
+ battgroupid=BattgroupId_apply+1;
+ }
+ return battgroupid;
}
//鏌ヨ褰撳墠鏈�澶х殑stationid
public static int searchStationId(){
- int station_max=(new BattInfImpl()).searchMaxId();//褰撳墠鏈�澶х殑stationid
- int station_next=station_max+1;
- return station_next;
+ int stationid=0;
+ int stationid_inf=(new BattInfImpl()).searchMaxId();//褰撳墠鏈�澶х殑stationid
+ int stationid_apply=(new Battinf_applyImpl()).searchMaxId_apply();//褰撳墠鏈�澶х殑stationid
+ if(stationid_inf>=stationid_apply){
+ stationid=stationid_inf+1;
+ }else{
+ stationid=stationid_apply+1;
+ }
+ return stationid;
}
//鏌ヨ褰撳墠鏈�澶х殑dev_id
public static int searchmaxdev_id(){
diff --git a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
index 5b0a86b..1fad757 100644
--- a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
+++ b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
@@ -382,7 +382,7 @@
}
//娣诲姞鐢垫睜缁勬椂鏌ヨ鍑烘渶澶х殑鏈烘埧id鍜岀數姹犵粍id
public int searchMaxId(){
- String sql="SELECT GREATEST((select max(StationId) from db_battinf.tb_battinf) ,(select max(StationId) from db_battinf.tb_battinf_apply)) as id";
+ String sql="select max(StationId) as id from db_battinf.tb_battinf limit 1";
List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), null, new CallBack() {
public List getResults(ResultSet rs) {
diff --git a/gx_tieta/src/com/fgkj/dao/impl/Batt_rtstateDAOImpl.java b/gx_tieta/src/com/fgkj/dao/impl/Batt_rtstateDAOImpl.java
index a63fb42..a969e45 100644
--- a/gx_tieta/src/com/fgkj/dao/impl/Batt_rtstateDAOImpl.java
+++ b/gx_tieta/src/com/fgkj/dao/impl/Batt_rtstateDAOImpl.java
@@ -752,7 +752,7 @@
//鏌ヨ鍑哄綋鍓嶅瓨鍦ㄥ唴瀛樹腑鏈�澶х殑鐢垫睜缁刬d(寰堥噸瑕�**********)
public int searchMaxBattgroupId(){
- String sql=" SELECT GREATEST((select max(battgroupId) from db_battinf.tb_battinf) ,(select max(battgroupId) from db_battinf.tb_battinf_apply)) as id limit 1";
+ String sql=" select max(battgroupId) as id from db_battinf.tb_battinf limit 1";
List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), null, new CallBack() {
public List getResults(ResultSet rs) {
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 5074c64..1ea140c 100644
--- a/gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java
+++ b/gx_tieta/src/com/fgkj/dao/impl/Battinf_applyImpl.java
@@ -138,18 +138,16 @@
}
//鏌ヨ鍑烘墍鏈夐渶瑕佺‘璁ょ殑鐢宠
public List serchByCondition(Object obj) {
- Battinf_apply bapply=(Battinf_apply) obj;
- BattInf b=bapply.getBinf();
- Page page=b.getPage();
+ Page page=(Page) obj;
Connection conn=DBUtil.getConn();
String numberSql=" SELECT FOUND_ROWS() number";
String sql=" select SQL_CALC_FOUND_ROWS distinct num,apply_uid,confrim_uid,apply_date,apply_en,apply_note,StationId,StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationIp,FbsDeviceId,FbsDeviceIp_YM,FbsDeviceIp_WG,FbsDeviceIp"+
",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=0 and stationName1 like ? and stationName2 like ? and stationId like ? and stationName5 like ? " +
+ " where apply_en=0 " +
" limit ?,? ";
- List<Battinf_apply> list=DAOHelper.executeQueryLimit(sql, conn, new Object[]{"%"+b.getStationName1()+"%","%"+b.getStationName2()+"%","%"+b.getStationId()+"%","%"+b.getStationName5()+"%",(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() {
+ List<Battinf_apply> list=DAOHelper.executeQueryLimit(sql, conn, new Object[]{(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() {
public List getResults(ResultSet rs) {
List list=new ArrayList();
@@ -229,8 +227,9 @@
try {
while(rs.next()){
int dev_id=0;
- if(rs.getString("id")!=null){}
- dev_id=rs.getInt("id");
+ if(rs.getString("id")!=null){
+ dev_id=rs.getInt("id");
+ }
list.add(dev_id);
}
} catch (SQLException e) {
@@ -246,9 +245,146 @@
}
return dev_id;
}
+ //鏌ヨ鍑哄綋鍓嶅瓨鍦ㄥ唴瀛樹腑鏈�澶х殑stationid寰堥噸瑕�**********)
+ public int searchMaxId_apply(){
+ String sql="select max(StationId) as id from db_battinf.tb_battinf_apply limit 1";
+ List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), null, new CallBack() {
+
+ public List getResults(ResultSet rs) {
+ List list=new ArrayList();
+ try {
+
+ while(rs.next()){
+ int id=0;
+ if(rs.getString("id") != null){
+ id=Integer.parseInt(rs.getString("id"));
+ }
+ list.add(id);
+ }
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return list;
+ }
+ });
+ int stationid=0;
+ if(list!=null&&list.size()>0){
+ stationid=(Integer) list.get(list.size()-1);
+ }
+ return stationid;
+ }
+ //鏌ヨ鍑哄綋鍓嶅瓨鍦ㄥ唴瀛樹腑鏈�澶х殑鐢垫睜缁勭殑id(寰堥噸瑕�**********)
+ public int searchMaxBattgroupId_apply(){
+ String sql=" select max(battgroupId) as id from db_battinf.tb_battinf_apply limit 1";
+ List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), null, new CallBack() {
+
+ public List getResults(ResultSet rs) {
+ List list=new ArrayList();
+ try {
+ while(rs.next()){
+ int battgroupid=0;
+ if(rs.getString("id")!=null){
+ battgroupid=rs.getInt("id");
+ }
+ list.add(battgroupid);
+ }
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return list;
+ }
+ });
+ int battgroupid=0;
+ if(list!=null&&list.size()>0){
+ battgroupid=(Integer) list.get(list.size()-1);
+ }
+ return battgroupid;
+ }
+
+ //鏌ヨ鍑哄鏍稿畬鐨勭敵璇峰拰寰呭鏍哥殑鐢宠
public List serchByInfo(Object obj) {
- // TODO Auto-generated method stub
- return null;
+ Battinf_apply bapply=(Battinf_apply) obj;
+ BattInf b=bapply.getBinf();
+ Page page=b.getPage();
+ Connection conn=DBUtil.getConn();
+ String numberSql=" SELECT FOUND_ROWS() number";
+ String sql=" select SQL_CALC_FOUND_ROWS distinct num,apply_uid,confrim_uid,apply_date,apply_en,apply_note,StationId,StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationIp,FbsDeviceId,FbsDeviceIp_YM,FbsDeviceIp_WG,FbsDeviceIp"+
+ ",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=? " +
+ " 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() {
+
+ public List getResults(ResultSet rs) {
+ List list=new ArrayList();
+ try {
+ while(rs.next()){
+ Battinf_apply apply=new Battinf_apply();
+ apply.setNum(rs.getInt("num"));
+ apply.setApply_uid(rs.getInt("apply_uid"));
+ apply.setConfrim_uid(rs.getInt("confrim_uid"));
+ apply.setApply_en(rs.getInt("apply_en"));
+ apply.setApply_date(rs.getTimestamp("apply_date"));
+ apply.setApply_note(rs.getString("apply_note"));
+
+ BattInf binf=new BattInf();
+ binf.setStationId(rs.getString("stationId"));
+ binf.setStationName(rs.getString("stationName"));
+ binf.setStationName1(rs.getString("stationName1"));
+ binf.setStationName2(rs.getString("stationName2"));
+ binf.setStationName3(rs.getString("stationName3"));
+ binf.setStationName4(rs.getString("stationName4"));
+ binf.setStationName5(rs.getString("stationName5"));
+ binf.setStationIp(rs.getString("stationIp"));
+ binf.setFBSDeviceId(rs.getInt("fBSDeviceId"));
+
+ binf.setFbsDeviceIp(rs.getString("fbsDeviceIp"));
+ binf.setFbsDeviceIp_YM(rs.getString("fbsDeviceIp_YM"));
+ binf.setFbsDeviceIp_WG(rs.getString("fbsDeviceIp_WG"));
+ binf.setFBSDeviceName(rs.getString("fBSDeviceName"));
+ binf.setGroupIndexInFBSDevice(rs.getInt("groupIndexInFBSDevice"));
+ binf.setBattGroupId(rs.getInt("battGroupId"));
+ binf.setBattGroupNum(rs.getInt("battGroupNum"));
+ binf.setBattGroupName(rs.getString("battGroupName"));
+ binf.setFloatVolLevel(rs.getFloat("floatVolLevel"));
+ binf.setOfflineVolLevel(rs.getFloat("offlineVolLevel"));
+ binf.setBattFloatCurrent(rs.getFloat("battFloatCurrent"));
+ binf.setMonCount(rs.getInt("monCount"));
+ binf.setMonCapStd(rs.getFloat("monCapStd"));
+ binf.setMonVolStd(rs.getFloat("monVolStd"));
+ binf.setMonResStd(rs.getFloat("monResStd"));
+ binf.setMonSerStd(rs.getFloat("monSerStd"));
+ binf.setMonVolLowToAvg(rs.getFloat("monVolLowToAvg"));
+ binf.setBattProducer(rs.getString("battProducer"));
+ binf.setBattModel(rs.getString("battModel"));
+ binf.setBattProductDate(rs.getDate("battProductDate"));
+ binf.setBattInUseDate(rs.getDate("battInUseDate"));
+ binf.setLoad_curr(rs.getFloat("load_curr"));
+ binf.setInstall_user(rs.getString("install_user"));
+ binf.setDisCurrMax(rs.getFloat("disCurrMax"));
+ binf.setStation_phone(rs.getString("station_phone"));
+
+ apply.setBinf(binf);
+ list.add(apply);
+
+ }
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return list;
+ }
+ });
+ //鍘绘帀limit鏉′欢鍚庣殑鎬绘暟
+ int number=LimitNumberFactory.GetLimtitNumber(conn, numberSql);
+ //System.out.println("number: "+number);
+ if(list!=null&&list.size()>0){
+ list.get(list.size()-1).setNum(number);
+ }
+ return list;
}
public static void main(String[] args) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -302,11 +438,15 @@
bapply.setBinf(binf);
/*List list=bimpl.serchByCondition(bapply);
System.out.println(list.size());*/
- /*List list=new ArrayList();
+ List list=new ArrayList();
list.add(bapply);
boolean bl=bimpl.add(list);
- System.err.println(bl);*/
- int dev_id=BattinfGroupFactory.searchmaxdev_id();
+ System.err.println(bl);
+ /*int dev_id=BattinfGroupFactory.searchmaxdev_id();
System.out.println(dev_id);
+ int station_id=BattinfGroupFactory.searchStationId();
+ System.out.println(station_id);
+ int battgroup_id=BattinfGroupFactory.searchMaxBattgroupId();
+ System.out.println(battgroup_id);*/
}
}
diff --git a/gx_tieta/src/com/fgkj/services/Battinf_applyService.java b/gx_tieta/src/com/fgkj/services/Battinf_applyService.java
index f174cb7..49d197c 100644
--- a/gx_tieta/src/com/fgkj/services/Battinf_applyService.java
+++ b/gx_tieta/src/com/fgkj/services/Battinf_applyService.java
@@ -40,4 +40,30 @@
}
return model;
}
+ //鏌ヨ鍑哄鏍稿畬鐨勭敵璇峰拰寰呭鏍哥殑鐢宠
+ public ServiceModel serchByInfo(Object obj){
+ List list=dao.serchByInfo(obj);
+ if(list!=null&&list.size()>0){
+ model.setCode(1);
+ model.setData(list);
+ model.setMsg("鏌ヨ鎴愬姛!");
+ }else{
+ model.setCode(0);
+ model.setMsg("鏌ヨ澶辫触!");
+ }
+ return model;
+ }
+ //鏌ヨ鍑烘墍鏈夐渶瑕佺‘璁ょ殑鐢宠
+ public ServiceModel serchByCondition(Object obj){
+ List list=dao.serchByCondition(obj);
+ if(list!=null&&list.size()>0){
+ model.setCode(1);
+ model.setData(list);
+ model.setMsg("鏌ヨ鎴愬姛!");
+ }else{
+ model.setCode(0);
+ model.setMsg("鏌ヨ澶辫触!");
+ }
+ return model;
+ }
}
--
Gitblit v1.9.1