package iLend.reback.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import iLend.reback.bean.*;
import iLend.util.DBUtil1;
public class BorrowDao {
//更新 表数据
public int updateRs(int id,String backtime,String picname) {
Connection conn = DBUtil1.getConnectDb();
String sql = "update ilend_borrow set realBackTime='"+backtime+"'"
+ " ,oPic='"+picname+"', rs=0 where oNumber="+id;
PreparedStatement stm = null;
int f=0;
System.out.println(sql);
try {
stm=conn.prepareStatement(sql);
f=stm.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return f;
}
public int updateRS(int id) {
// TODO Auto-generated method stub
Connection conn = DBUtil1.getConnectDb();
String sql = "update ilend_borrow set rs=1 where oNumber="+id;
PreparedStatement stm = null;
int f=0;
System.out.println(sql);
try {
stm=conn.prepareStatement(sql);
f=stm.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return f;
}
public GoodsBean detailGoods(String gNumber) {
// TODO Auto-generated method stub
Connection conn = DBUtil1.getConnectDb();
String sql = "select * from iLend_goods where gNumber="+gNumber;
PreparedStatement stm = null;
ResultSet rs = null;
GoodsBean tag = null;
try {
stm = conn.prepareStatement(sql);
rs = stm.executeQuery();
if(rs.next()){
tag = new GoodsBean();
tag.setgNumber(rs.getString("gNumber"));
tag.setgType(rs.getString("gType"));
tag.setgCondition(rs.getString("gCondition"));
tag.setgState(rs.getString("gState"));
tag.setgIn(rs.getString("gDepartment"));
tag.setgPic(rs.getString("gPic"));
tag.setgRemark(rs.getString("gRemark"));
tag.setPc(rs.getString("gDepartment"));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
DBUtil1.CloseDB(rs, stm, conn);
}
return tag;
}
public List<GoodsBean> getGoods() {
// TODO Auto-generated method stub
List<GoodsBean> ls=new ArrayList<GoodsBean>();
Connection conn = DBUtil1.getConnectDb();
String sql = "select * from iLend_goods";
PreparedStatement stm = null;
ResultSet rs = null;
GoodsBean tag = null;
try {
stm = conn.prepareStatement(sql);
rs = stm.executeQuery();
while(rs.next()){
tag = new GoodsBean();
tag.setgNumber(rs.getString("gNumber"));
tag.setgType(rs.getString("gType"));
tag.setgCondition(rs.getString("gCondition"));
tag.setgState(rs.getString("gState"));
tag.setgIn(rs.getString("gDepartment"));
tag.setgPic(rs.getString("gPic"));
tag.setgRemark(rs.getString("gRemark"));
tag.setPc(rs.getString("gDepartment"));
ls.add(tag);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
DBUtil1.CloseDB(rs, stm, conn);
}
return ls;
}
//获得top
public List<Top> getTop(String ustu){
List<Top> ls=new ArrayList<>();
List<Borrow> ab = this.getAllBorrows();
Top t=null;
Borrow b=null;
List<GoodsBean> GS = getGoods();
//先找出所有的good
for(int i=0;i<GS.size();i++) {
t=new Top();
int fs=0;
GoodsBean s= GS.get(i);
for(int j=0;j<ab.size();j++) {
b=ab.get(j);
if(s.getgNumber().equals(b.getgNumber())) {
fs++;
}
}
t.setName(s.getgType());
t.setOut(s.getPc());
t.setCs(fs);
ls.add(t);
}
//然后一个一个匹配
//对数字进行排列
Integer[] af=new Integer[ls.size()];
for(int ii=0;ii<ls.size();ii++) {
af[ii]=ls.get(ii).getCs();
}
Comparator<Integer> cmp = new Comparator<Integer>() {
public int compare(Integer i1, Integer i2) {
return i2-i1;
}
};
Arrays.sort(af, cmp);
int[] gd=new int[ls.size()];
int d=0;
ArrayList<Integer> rd=new ArrayList<>();
for(int i=0;i<af.length;i++) {
int s=af[i];
//都要找到这个对应的值
boolean w=true;
for(int f=0;f<ls.size();f++) {
w=true;
for(int e=0;e<rd.size();e++) {
if(f==rd.get(e)) {
w=false;
}
}
if(w) {
int g=ls.get(f).getCs();
if(s==g) {
gd[d]=f;
rd.add(f);
break;
}
}
}
d++;
}
List<Top> lss=new ArrayList<>();
for(int fg=0;fg<ls.size();fg++) {
Top t2 = ls.get(af[fg]);
t2.setCs(ls.get(gd[fg]).getCs());
lss.add(fg, t2);
}
/*
HashSet<String> f=new HashSet<String>();
//借用
List<Borrow> a = this.getAllBorrowsBystuNumber(ustu);
for(int i=0;i<a.size();i++) {
b=a.get(i);
String n = b.getgNumber();
f.add(n);
}
for (String obj: f) {
t=new Top();
int fs=0;
for(int i=0;i<a.size();i++) {
String n = b.getgNumber();
if(obj.equals(n)) {
fs++;
}
}
//查看good
GoodsBean d = detailGoods(obj);
t.setName(d.getgType());
t.setOut(d.getPc());
t.setCs(fs);
ls.add(t);
}*/
return lss;
}
//查找所有的
public List<Borrow> getAllBorrows(){
List<Borrow> ls=new ArrayList<>();
Borrow b=null;
Connection conn = DBUtil1.getConnectDb();
String sql = "select * from ilend_borrow ";
PreparedStatement stm = null;
ResultSet rs = null;
try {
stm = conn.prepareStatement(sql);
rs = stm.executeQuery();
while(rs.next()){
int oNumber = rs.getInt(1);
String stuNumber = rs.getString(2);
int int1 = rs.getInt(3);
String string = rs.getString(4);
String string2 = rs.getString(5);
String string3 = rs.getString(6);
String string4 = rs.getString(7);
String string5 = rs.getString(8);
String string6 = rs.getString(9);
String string7 = rs.getString(10);
String string8 = rs.getString(11);
int int2 = rs.getInt(12);
String string9 = rs.getString(13);
String pic = rs.getString(14);
//是否超时 g 为归还时间2018-10-09 j为借还时间2018-10-09
//j=string6 g=string7
int d=Utils.getOdate(string7, string6);
boolean a =true;
if(d==0) {
a=false;
}
String rs2 = rs.getString(16);
b=new Borrow(oNumber+"",stuNumber,int1+"",
string,string2,string3,string4
,string5,string6,string7,string8,int2+"",
string9,pic,d,a,rs2
);
ls.add(b);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
DBUtil1.CloseDB(rs, stm, conn);
}
return ls;
}
/**
* 管理员使用
*/
//查找未归还的订单
public List<Borrow> getAllBorrowing(){
List<Borrow> a = this.getAllBorrows();
List<Borrow> ls=new ArrayList<>();
for(int i=0;i<a.size();i++) {
Borrow b =a.get(i);
if(b.getRealBackTime()==null) {
//没有归还时间说明还没有还,那么就是在借状态中
//搜索对应的name属性
ls.add(b);
}
}
return ls;
}
/**
* 管理员中心
*/
public AdminBorrow getAdminBorrow() {
List<Borrow> a = this.getAllBorrows();
AdminBorrow u =new AdminBorrow();
u.setAbNumber(a.size());//统计多少件
//统计归还了多少件
int abing=0;
int ad=0;//统计正在申请归还的物品件数
for(int i=0;i<a.size();i++) {
Borrow b =a.get(i);
if(b.getRealBackTime()!=null) {
//没有归还时间说明还没有还,那么就是在借状态中
abing++;
if("0".equals(b.getRs())) {
//申请归还状态
ad++;
}
}
}
u.setRNumber(abing);
u.setSRNumber(ad);
return u;
}
//获
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
1.环境与现状:在21世纪这个互联网时代,各式各样的数据管理平台层出不穷。而在大学,有些手续却并没有数据化。当社团或部门举行活动或摆摊宣传的时候,需要桌子、帐篷等物资,这时就需要物资借用负责人向各学院办公室提出请求,借用物资。而学生们往往通过打电话、发短信等形式向学院办公室借用,办公室负责人需确认数量、时间、地点,下发批条(需学院盖章),社团负责人又需和办公室负责人联系取物、还物等,手续繁复。 2.系统质量:我们的物资借用系统是一个全新的、目前暂时无人涉及的新系统。物资借用系统可以使流程简化、方便双方使用。学院办公室可以通过该系统直接显示余量、地址、联系方式等信息,社团和部门可以直接通过该系统找到所需物资,通过网上确认之后直接借用,形成具有电子章的电子批条。该系统还可以通过社团或部门的借用情况对其进行信用评分。物资借用系统可直接应用到学院及社团部门,方便物资监管,实现高效借用。因此我们可以把握住现在这个还未实现的新领域,创造一个方便学生的新系统。 3.弱势:我们目前面临潜在性威胁如学校可能会实现的系统以及个别学生会不愿意使用等情况。 Javaweb项目
资源推荐
资源详情
资源评论
收起资源包目录
物资借用管理信息系统源代码 (374个子文件)
BorrowDao.class 13KB
ApplicationDao.class 7KB
GoodsDao.class 7KB
AddGoodsServlet.class 7KB
CreditDao.class 7KB
HistoryDao.class 6KB
Returngood.class 5KB
GoodsDao.class 5KB
RepairDao.class 5KB
ad_UpdateServlet.class 4KB
RegistServlet.class 4KB
Borrow.class 4KB
BorrowDao.class 4KB
UserDao.class 4KB
UpdateServlet.class 4KB
UserDao.class 4KB
CreditRecordDao.class 4KB
UserDao.class 3KB
CollectionDao.class 3KB
ad_ChangePasskeyServlet.class 3KB
ChangePasskeyServlet.class 3KB
LoginServlet.class 3KB
UserDao.class 3KB
BorrowBean.class 3KB
VerifyCode.class 3KB
ApplicationBean.class 3KB
HistoryServlet.class 2KB
ad_FeedbackServlet.class 2KB
FeedbackServlet.class 2KB
SearchTot.class 2KB
HistoryBean.class 2KB
GetBorrowInfoServlet.class 2KB
DamageServlet.class 2KB
CreditBean.class 2KB
HistoryDetailServlet.class 2KB
DetailServlet.class 2KB
CollectionServlet.class 2KB
UsingServlet.class 2KB
EditGoodsServlet.class 2KB
GoodsBean.class 2KB
EditRepairServlet.class 2KB
PageBean.class 2KB
FeedbackDao.class 2KB
ManageGoodsServlet.class 2KB
CreditInquireServlet.class 2KB
SearchBorrowM.class 2KB
RepairServlet.class 2KB
StuInquireServlet1.class 2KB
StuInquireServlet.class 2KB
SearchHis.class 2KB
adminReturn.class 2KB
GoodsInquireServlet.class 2KB
UserBean.class 2KB
GoodsBean.class 2KB
CheckServlet.class 2KB
DeleteUserServlet.class 2KB
DBUtil1.class 2KB
DBUtil.class 2KB
UserBean.class 2KB
DafenServlet.class 2KB
AddRepairServlet.class 2KB
DeletecollectionServlet.class 2KB
XiugaiServlet1.class 2KB
XiugaiServlet.class 2KB
ad_DafenServlet.class 2KB
CancelBorrowServlet.class 2KB
CollectionBean.class 1KB
DeleteGoodsServlet.class 1KB
LogoutServlet.class 1KB
VerifyCodeServlet.class 1KB
CreditRecordBean.class 1KB
GetCreditInfoServlet.class 1KB
RepairBean.class 1KB
SeeoReasonServlet.class 1KB
AddGoodsServlet$1.class 1KB
Utils.class 1KB
UserBorrow.class 1KB
BorrowDao$1.class 980B
FeedbackBean.class 941B
AdminBorrow.class 926B
Top.class 892B
.classpath 834B
org.eclipse.wst.common.component 450B
org.eclipse.wst.jsdt.ui.superType.container 49B
bootstrap.min.css 165KB
bootstrap.css 138KB
ready.css 117KB
ready.min.css 111KB
style.css 42KB
font-awesome.css 34KB
datepicker-dev.css 5KB
datepicker.css 4KB
datepicker.css 4KB
datepicker.css 3KB
demo.css 2KB
WdatePicker.css 192B
line-awesome.eot 110KB
fontawesome-webfont.eot 75KB
glyphicons-halflings-regular.eot 20KB
img.gif 2KB
共 374 条
- 1
- 2
- 3
- 4
资源评论
成都定制通软件
- 粉丝: 1
- 资源: 27
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功