Commit b77a3c79 by shj

数据库备份;数据库查询接口;优化说明文件;

parent d32a44a4
CREATE TABLE budgetmanagementsystem.budgets
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
userid int(11) DEFAULT '0' COMMENT '用户id',
filename varchar(50) COMMENT '预算文件名称'
);
CREATE TABLE budgetmanagementsystem.conference
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100) COMMENT '名称(会议内容)',
price double COMMENT '会议标准费用',
comment text,
experts int(11) COMMENT '需要专家人数',
people int(11) DEFAULT '0' COMMENT '参会人数'
);
INSERT INTO budgetmanagementsystem.conference (id, name, price, comment, experts, people) VALUES (1, '项目启动会', 200, null, 3, 0);
INSERT INTO budgetmanagementsystem.conference (id, name, price, comment, experts, people) VALUES (2, '中期', 200, null, 3, 0);
INSERT INTO budgetmanagementsystem.conference (id, name, price, comment, experts, people) VALUES (3, '预验收', 200, null, 3, 0);
INSERT INTO budgetmanagementsystem.conference (id, name, price, comment, experts, people) VALUES (4, '验收', 200, null, 2, 0);
INSERT INTO budgetmanagementsystem.conference (id, name, price, comment, experts, people) VALUES (5, '学术会议', 5000, null, 0, 0);
INSERT INTO budgetmanagementsystem.conference (id, name, price, comment, experts, people) VALUES (9, '技术交流会', 700, null, 0, 0);
CREATE TABLE budgetmanagementsystem.consultation
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100) COMMENT '专家信息(职称等)',
price double COMMENT '咨询费',
comment text
);
INSERT INTO budgetmanagementsystem.consultation (id, name, price, comment) VALUES (1, '其他专家', 1000, null);
INSERT INTO budgetmanagementsystem.consultation (id, name, price, comment) VALUES (6, '中级专家', 1500, null);
INSERT INTO budgetmanagementsystem.consultation (id, name, price, comment) VALUES (7, '高级专家', 2400, null);
CREATE TABLE budgetmanagementsystem.equipment
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100) COMMENT '型号规格',
price double,
type varchar(50) COMMENT '子类别',
img varchar(100) COMMENT '图片url',
comment text COMMENT '备注'
);
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (104, '存储服务器', 98000, '存储服务器', '', 'Intel Xeon E5-2600 v4处理器,2颗,48核,96线程;128G内存;80T硬盘');
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (105, '计算服务器', 30000, '计算服务器', null, 'Intel Xeon Skylake-W-2133处理器;32F内存;256GNVMe固态,2T硬盘');
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (106, '深度学习工作站', 20000, '深度学习工作站', null, '英特尔(Intel)2.5G十四核Xeon处理器,64G ddr4 2133内存,英伟达(Nvidia)Quadro 16G显卡,Radeon Pro Vega 64 图形处理器,2T 机械硬盘');
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (107, '移动工作站', 20000, '移动工作站', null, '第九代 Intel Core i5 处理器,16GB 2666MHz DDR4 内存,2TB 固态硬盘,Radeon Pro 580X 图形处理器 (配备 8GB GDDR5 显存)');
CREATE TABLE budgetmanagementsystem.internationalcommunication
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100),
price double,
comment text,
accommodation double,
food double,
traffic double COMMENT '市内交通(公杂费)'
);
INSERT INTO budgetmanagementsystem.internationalcommunication (id, name, price, comment, accommodation, food, traffic) VALUES (1, '澳大利亚', 24000, null, 1100, 380, 310);
INSERT INTO budgetmanagementsystem.internationalcommunication (id, name, price, comment, accommodation, food, traffic) VALUES (2, '北卡莱罗纳', 21000, null, null, null, null);
INSERT INTO budgetmanagementsystem.internationalcommunication (id, name, price, comment, accommodation, food, traffic) VALUES (4, '东京', 0, null, 1200, 630, 310);
INSERT INTO budgetmanagementsystem.internationalcommunication (id, name, price, comment, accommodation, food, traffic) VALUES (5, '莫斯科', 0, null, 2000, 310, 280);
INSERT INTO budgetmanagementsystem.internationalcommunication (id, name, price, comment, accommodation, food, traffic) VALUES (6, '法国巴黎', 0, null, 1200, 460, 300);
INSERT INTO budgetmanagementsystem.internationalcommunication (id, name, price, comment, accommodation, food, traffic) VALUES (7, '美国华盛顿', 0, null, 1400, 380, 310);
INSERT INTO budgetmanagementsystem.internationalcommunication (id, name, price, comment, accommodation, food, traffic) VALUES (8, '美国纽约', 0, null, 1700, 380, 310);
INSERT INTO budgetmanagementsystem.internationalcommunication (id, name, price, comment, accommodation, food, traffic) VALUES (10, '东京', 0, null, 1200, 630, 310);
INSERT INTO budgetmanagementsystem.internationalcommunication (id, name, price, comment, accommodation, food, traffic) VALUES (11, '法国巴黎', 0, null, 1200, 460, 300);
CREATE TABLE budgetmanagementsystem.labour
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100) COMMENT '名目(本硕博专)',
price double COMMENT '单价(人月)',
priority int(11) COMMENT '优先级',
comment text
);
INSERT INTO budgetmanagementsystem.labour (id, name, price, priority, comment) VALUES (1, '博士生', 2200, 2, null);
INSERT INTO budgetmanagementsystem.labour (id, name, price, priority, comment) VALUES (2, '硕士生', 1760, 3, null);
INSERT INTO budgetmanagementsystem.labour (id, name, price, priority, comment) VALUES (3, '专职', 8000, 1, null);
CREATE TABLE budgetmanagementsystem.material
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100) COMMENT '名称/规格',
price double COMMENT '单价',
type varchar(50) COMMENT '类型',
img varchar(100) COMMENT '图片链接',
comment text COMMENT '备注'
);
INSERT INTO budgetmanagementsystem.material (id, name, price, type, img, comment) VALUES (1, '硬盘', 2000, null, null, null);
INSERT INTO budgetmanagementsystem.material (id, name, price, type, img, comment) VALUES (2, '加密移动硬盘', 3000, null, null, null);
INSERT INTO budgetmanagementsystem.material (id, name, price, type, img, comment) VALUES (11, '服务器内存', 4000, null, null, null);
CREATE TABLE budgetmanagementsystem.power
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100),
price double,
comment text
);
CREATE TABLE budgetmanagementsystem.property
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100) COMMENT '名称名目',
price double,
comment text
);
INSERT INTO budgetmanagementsystem.property (id, name, price, comment) VALUES (1, '著作权', 2000, null);
INSERT INTO budgetmanagementsystem.property (id, name, price, comment) VALUES (2, '知识产权', 5000, null);
INSERT INTO budgetmanagementsystem.property (id, name, price, comment) VALUES (3, '广西省电子地图数据', 10000, null);
INSERT INTO budgetmanagementsystem.property (id, name, price, comment) VALUES (4, '广西省货车 UGC 数据', 10000, null);
INSERT INTO budgetmanagementsystem.property (id, name, price, comment) VALUES (5, '广西省物流 UGC 数据', 10000, null);
INSERT INTO budgetmanagementsystem.property (id, name, price, comment) VALUES (6, '论文发表费', 4000, null);
INSERT INTO budgetmanagementsystem.property (id, name, price, comment) VALUES (7, '广西省交通流量视频数据', 10000, null);
CREATE TABLE budgetmanagementsystem.ruleEquipment
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
min_val int(11) DEFAULT '0',
max_val int(11) DEFAULT '100000'
);
CREATE TABLE budgetmanagementsystem.testandprocess
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100) COMMENT '名称、内容',
price double COMMENT '单价',
comment text COMMENT '备注'
);
INSERT INTO budgetmanagementsystem.testandprocess (id, name, price, comment) VALUES (1, '测试化验加工费', 150000, null);
INSERT INTO budgetmanagementsystem.testandprocess (id, name, price, comment) VALUES (2, '数据清洗服务', 50000, null);
INSERT INTO budgetmanagementsystem.testandprocess (id, name, price, comment) VALUES (3, '云服务器租用', 100000, null);
CREATE TABLE budgetmanagementsystem.travel
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(50) COMMENT '目的地',
price double COMMENT '往返价格',
food double COMMENT '伙食标准',
traffic double COMMENT '交通标准',
accommodation double COMMENT '住宿标准',
comment text COMMENT '备注'
);
INSERT INTO budgetmanagementsystem.travel (id, name, price, food, traffic, accommodation, comment) VALUES (1, '上海', 2000, 100, 80, 500, null);
INSERT INTO budgetmanagementsystem.travel (id, name, price, food, traffic, accommodation, comment) VALUES (2, '南宁', 2000, 100, 80, 350, null);
INSERT INTO budgetmanagementsystem.travel (id, name, price, food, traffic, accommodation, comment) VALUES (3, '桂林', 2000, 100, 80, 350, null);
INSERT INTO budgetmanagementsystem.travel (id, name, price, food, traffic, accommodation, comment) VALUES (4, '北海', 2000, 100, 80, 350, null);
INSERT INTO budgetmanagementsystem.travel (id, name, price, food, traffic, accommodation, comment) VALUES (7, '天津', 2000, 100, 80, 380, null);
INSERT INTO budgetmanagementsystem.travel (id, name, price, food, traffic, accommodation, comment) VALUES (8, '深圳', 2000, 100, 80, 450, null);
INSERT INTO budgetmanagementsystem.travel (id, name, price, food, traffic, accommodation, comment) VALUES (9, '重庆', 2000, 100, 80, 370, null);
INSERT INTO budgetmanagementsystem.travel (id, name, price, food, traffic, accommodation, comment) VALUES (10, '西安', 2000, 100, 80, 350, null);
CREATE TABLE budgetmanagementsystem.user
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(50) DEFAULT 'username' COMMENT '用户名',
password varchar(20) DEFAULT 'password' COMMENT '密码'
);
INSERT INTO budgetmanagementsystem.user (id, name, password) VALUES (1, '1', '1');
INSERT INTO budgetmanagementsystem.user (id, name, password) VALUES (2, '2', '2');
INSERT INTO budgetmanagementsystem.user (id, name, password) VALUES (3, '222', '222');
INSERT INTO budgetmanagementsystem.user (id, name, password) VALUES (4, '333', '333');
INSERT INTO budgetmanagementsystem.user (id, name, password) VALUES (5, 'zhangsan', 'zhangsan');
INSERT INTO budgetmanagementsystem.user (id, name, password) VALUES (6, '444', '444');
INSERT INTO budgetmanagementsystem.user (id, name, password) VALUES (7, 'xxx', 'xxx');
INSERT INTO budgetmanagementsystem.user (id, name, password) VALUES (9, '44444', '44444');
INSERT INTO budgetmanagementsystem.user (id, name, password) VALUES (10, 'aaa', 'aaa');
CREATE TABLE budgetmanagementsystem.user_budget
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
userid int(11) NOT NULL,
budgetid mediumtext NOT NULL,
budgetname varchar(100)
);
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (13, 1, '1557585969465', null);
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (15, 4, '1557653424704', null);
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (16, 4, '1557658609291', null);
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (23, 5, '1557681943936', null);
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (24, 5, '1557681978320', null);
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (26, 3, '1557682461267', null);
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (27, 3, '1557682473376', null);
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (29, 9, '1557717529246', null);
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (46, 10, '1557738195161', null);
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (47, 10, '1557743667619', null);
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (117, 6, '1558767921165', 'new');
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (118, 6, '1558768627117', '预算');
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (120, 7, '1558802034440', 'new');
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (121, 6, '1558945964051', 'new');
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (122, 1, '1558966651041', 'HP Z8 G4(Z3Z16AV-SC001)');
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (123, 7, '1558969830804', '预算');
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (126, 7, '1558979419134', 'HP Z8 G4(Z3Z16AV-SC001)');
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (127, 7, '1559005935872', '基于群体智能的城市交通数据开放共享技术研发');
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (128, 1, '1559127952477', 'new');
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (129, 6, '1559131224917', 'ee');
INSERT INTO budgetmanagementsystem.user_budget (id, userid, budgetid, budgetname) VALUES (131, 6, '1559132140099', '预算');
CREATE TABLE budgetmanagementsystem.workstation
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
spec varchar(100) COMMENT '型号规格',
price double COMMENT '单价(万)',
img varchar(100) COMMENT '图片url'
);
CREATE UNIQUE INDEX workstation_spec_uindex ON budgetmanagementsystem.workstation (spec);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (35, '戴尔Precision T5820(Xeon W-2123/64GB/512GB+4TB/P2000)', 23700, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (36, 'UltraLAB P490(14664-MAX)', 60000, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (37, 'HP Z4 G4(1JP11AV-SC001)', 17000, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (38, 'Wiseteam CP265 C33128-SAEK12', 149900, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (39, '凌炫Pt8040(E221T-ECEP6)', 499900, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (40, '联想ThinkStation P520c(Xeon W-2123/16GB/256GB+1TB/P2000)', 14400, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (41, '戴尔Precision T7920塔式系列(P7920T-S4110NLCN01)', 24300, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (42, 'UltraLAB Alpha720(425256-SB28TD)', 275000, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (43, 'UltraLAB H490(14664-M5TCX)', 47000, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (44, 'UltraLAB EX620(23496-M528TC)', 140000, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (45, '戴尔Precision 7530系列(Promo-M7530I78750-Online1)', 18600, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (46, '戴尔Precision 5530系列(Promo-M5530I58300-Online1)', 9999, null);
\ No newline at end of file
......@@ -161,6 +161,12 @@
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>com.hierynomus</groupId>
<artifactId>sshj</artifactId>
<version>0.27.0</version>
</dependency>
</dependencies>
......
......@@ -9,7 +9,8 @@
select * from internationalcommunication where id=#{id}
</select>
<insert id="insertInternational">
insert into budgetmanagementsystem.internationalcommunication(name,price) values (#{name},#{price})
insert into budgetmanagementsystem.internationalcommunication(name,price,accommodation,food,traffic)
values (#{name},#{price},#{accommodation},#{food},#{traffic})
</insert>
<update id="updateInternational">
update budgetmanagementsystem.internationalcommunication set name=#{name},price=#{price} where id=#{id}
......
......@@ -482,17 +482,25 @@ public class BudgetHandler {
for (Equipment item : keySet) {
if(item.equals(equipment)){
item.setPrice(equipment.getPrice());
item.setType(equipment.getType());
item.setComment(equipment.getComment());
}
}
//更新value
equipments.put(equipment, nums);
} else if(curd.equals(0))
{
equipments.put(equipment, nums);
else {
equipmentDao.insertEquipment(equipment);
}
else if(curd.equals(3)){
Equipment add = equipmentDao.selectByName(equipment.getName());
equipments.remove(add);
equipments.put(add,nums);
System.out.println("add form database:"+add.getComment());
}else if(curd.equals(4)){
equipmentDao.deleteEquipment(equipment);
System.out.println("delete form database:"+equipment.getName());
}
}
serializeBudget(budget, getFilePath(sessionID));
......@@ -618,8 +626,11 @@ public class BudgetHandler {
{
items.remove(internationalCommunication);
items.put(internationalCommunication, nums);
} else
} else if(curd.equals(0))
{
items.put(internationalCommunication, nums);
internationalCommunicationDao.insertInternational(internationalCommunication);
}
}
afterUpdate(budget);
serializeBudget(budget, getFilePath(sessionID));
......@@ -855,6 +866,36 @@ public class BudgetHandler {
}
@RequestMapping("/Modify/Others")
public void modifyOthers(Integer mode, Others others, Integer nums, Integer curd, HttpServletRequest request, HttpServletResponse response) throws IOException {
System.out.println("/Modify/Others");
if (nums < 0) return;
String sessionID = getSessionID(request.getCookies());
Budget budget = retrieveBudget(sessionID);
if (budget == null) {
response.sendError(444, "budget not exists");
return;
}
Map<Others, Integer> items = null;
items = budget.getOthers();
if (curd.equals(0)) {
items.put(others, nums);
} else if (curd.equals(1)) {
items.remove(others);
} else {
items.remove(others);
items.put(others, nums);
}
afterUpdate(budget);
serializeBudget(budget, getFilePath(sessionID));
}
/**
* 预算修改的善后工作
*
......
......@@ -35,6 +35,8 @@ public class DatabaseQueryHandler {
JSONObject obj=new JSONObject();
obj.put("id",item.getId());
obj.put("name",item.getName());
obj.put("type",item.getType());
obj.put("comment",item.getComment());
obj.put("price",item.getPrice());
obj.put("nums",0);
list.add(obj);
......
......@@ -233,6 +233,8 @@ public class DetailHandler {
JSONObject obj=new JSONObject();
obj.put("id",item.getId());
obj.put("name",item.getName());
obj.put("type",item.getType());
obj.put("comment",item.getComment());
obj.put("price",item.getPrice());
obj.put("nums",equipments.get(item));
list.add(obj);
......@@ -543,4 +545,35 @@ public class DetailHandler {
e.printStackTrace();
}
}
@RequestMapping("/Others")
public void showOthers(HttpServletRequest request, HttpServletResponse response)
{
try {
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
PrintWriter writer = response.getWriter();
JSONObject object=new JSONObject();
String sessionID = BudgetHandler.getSessionID(request.getCookies());
Budget budget = BudgetHandler.retrieveBudget(sessionID);
if(budget==null) {
response.getWriter().write("indirect list error");
return;
}
Map<Others, Integer> others = budget.getOthers();
List<JSONObject> list=new LinkedList<>();
for (Others item : others.keySet()) {
JSONObject obj=new JSONObject();
obj.put("id",item.getId());
obj.put("name",item.getName());
obj.put("price",item.getPrice());
obj.put("nums",others.get(item));
list.add(obj);
}
object.put("data",list);
writer.write(object.toJSONString());
} catch (IOException e) {
e.printStackTrace();
}
}
}
......@@ -22,9 +22,9 @@ public class CheckService implements ICheckService {
if (material == null || material.getName() == null) {
return 201;
}
if (material.computeUnitPrice() >= 10000) {
/*if (material.computeUnitPrice() >= 10000) {
return 202;
}
}*/
return isValid;
}
......
......@@ -44,7 +44,7 @@ public class BudgetExportUtil {
StringBuilder line = new StringBuilder();
line.append("(").append(i).append(")");
line.append(equipment.getType())
line.append(equipment.getName())
.append(num).append("台,每台")
.append(price).append("元,共计")
.append(num * price).append("元");
......@@ -113,6 +113,35 @@ public class BudgetExportUtil {
run.addTab();
run.setText("测试化验加工费:"+detailService.sumTestAndProcess(budget.getTestAndProcesses())+"万元。【具体用途自行填写】");
Map<TestAndProcess, Integer> testAndProcesses = budget.getTestAndProcesses();
i = 0;
for (TestAndProcess item : testAndProcesses.keySet()) {
i++;
int num = testAndProcesses.get(item);
double price = item.getPrice();
paragraph = document.createParagraph();
run = paragraph.createRun();
run.addTab();
StringBuilder line = new StringBuilder();
line.append("(").append(i).append(")");
line.append(item.getName())
.append(num).append("次,每次")
.append(price).append("元,共计")
.append(num * price).append("元");
run.setText(line.toString());
line = new StringBuilder();
line.append("用途:【自行填写】,购买")
.append(num).append("服务,")
.append("单价").append(price).append("元,共需").append(num * price).append("元。");
paragraph = document.createParagraph();
run = paragraph.createRun();
run.addTab();
run.setText(line.toString());
}
//燃料动力费
paragraph = document.createParagraph();
......
......@@ -142,8 +142,8 @@
<td>{{budget.labour.sum}}</td>
</tr>
<tr>
<td>咨询费</td>
<td>{{budget.consultation.sum}}</td>
<td>咨询费</td>
<td>{{budget.consultation.sum}}</td>
</tr>
<tr>
<td>其他费用</td>
......@@ -193,7 +193,7 @@
<li><a href="#property" data-toggle="tab" onclick="propertyVue.showlist()">出版/文献/信息传播/知识产权事务费</a></li>
<li><a href="#labour" data-toggle="tab" onclick="labourVue.showlist()">劳务费</a></li>
<li><a href="#consultation" data-toggle="tab" onclick="consultationVue.showlist()">咨询费</a></li>
<li><a href="#others" data-toggle="tab">其他费用</a></li>
<li><a href="#others" data-toggle="tab" onclick="othersVue.showlist()">其他费用</a></li>
<li><a href="#indirect" data-toggle="tab" onclick="indirectVue.showlist()">间接费用</a></li>
</ul>
......@@ -216,11 +216,13 @@
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="equipment">
<table class="table table-hover">
<table class="table table-hover text-nowrap">
<thead>
<tr>
<th hidden>编号</th>
<th>名称</th>
<th>分类</th>
<th>描述</th>
<th>单价</th>
<th>数量</th>
<th>操作</th>
......@@ -230,6 +232,8 @@
<tbody id="equipment-table">
<tr v-for="item in items">
<td><input type="text" readonly v-model="item.name" class="form-control"></td>
<td><input type="text" v-model="item.type" class="form-control"></td>
<td><input type="text" v-model="item.comment" class="form-control"></td>
<td><input type="number" v-model="item.price" class="form-control"></td>
<td><input type="number" v-model="item.nums" class="form-control"></td>
<td>
......@@ -239,11 +243,12 @@
</tr>
<tr class="success">
<td><input type="text" v-model="sample.name" class="form-control"></td>
<td><input type="text" v-model="sample.type" class="form-control"></td>
<td><input type="text" v-model="sample.comment" class="form-control"></td>
<td><input type="number" v-model="sample.price" class="form-control"></td>
<td><input type="number" v-model="sample.nums" class="form-control"></td>
<td>
<button class="btn btn-success" @click="add(sample)">添加到本费用</button>
<button class="btn btn-success" @click="addToDatabase(sample)">添加到数据库</button>
<button class="btn btn-success" @click="add(sample)">添加</button>
</td>
</tr>
<tr class="info" v-if="database.length>0">
......@@ -254,6 +259,8 @@
</option>
</select>
</td>
<td><input type="text" v-model="database[selectedIndex].type" class="form-control"></td>
<td><input type="text" v-model="database[selectedIndex].comment" class="form-control"></td>
<td>
<input type="number" v-model="database[selectedIndex].price" class="form-control">
</td>
......@@ -261,6 +268,8 @@
<td>
<button class="btn btn-success" @click="addFromDatabase(database[selectedIndex])">添加
</button>
<button class="btn btn-danger" @click="deleteFromDatabase(database[selectedIndex])">删除
</button>
</td>
</tr>
</tbody>
......@@ -684,7 +693,57 @@
</div>
<div class="tab-pane fade" id="others">
<table class="table table-hover">
<thead>
<tr>
<th hidden>编号</th>
<th>名称</th>
<th>费用标准</th>
<th>次数</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="item in items" v-bind:title="item.name">
<td><input type="text" readonly v-model="item.name" class="form-control"></td>
<%--<td><input type="number" v-model="item.price"></td>--%>
<td><input type="number" v-model="item.price" class="form-control"></td>
<td><input type="number" v-model="item.nums" class="form-control"></td>
<td>
<button class="btn btn-success" @click="update(item)">确认</button>
<button class="btn btn-danger" @click="del(item)">删除</button>
</td>
</tr>
<tr class="success">
<td><input type="text" v-model="sample.name" class="form-control"></td>
<td><input type="number" v-model="sample.price" class="form-control"></td>
<td><input type="number" v-model="sample.nums" class="form-control"></td>
<td>
<button class="btn btn-success" @click="add(sample)">添加到本费用</button>
<button class="btn btn-success" @click="addToDatabase(sample)">添加到数据库</button>
</td>
</tr>
<tr class="info" v-if="database.length>0">
<td>
<select v-model="selectedIndex" class="form-control">
<option v-for="(record,i) in database" :value="i">
{{record.name}}
</option>
</select>
</td>
<td>
<input type="number" v-model="database[selectedIndex].price" class="form-control">
</td>
<td><input type="number" v-model="database[selectedIndex].nums" class="form-control"></td>
<td>
<button class="btn btn-success" @click="addFromDatabase(database[selectedIndex])">添加
</button>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tab-pane fade" id="indirect">
......@@ -743,19 +802,19 @@
}
var sidenavVue=new Vue({
el:"#mySidenav",
data:{
budget:{}
var sidenavVue = new Vue({
el: "#mySidenav",
data: {
budget: {}
}
});
var equipmentVue = new Vue({
el: "#equipment",
data: {
sample: {name: "sample", price: 0, nums: 0},
sample: {id:0,name: "sample", price: 0, nums: 0, type: "", comment: ""},
items: [],
database: [{name: "sample", price: 0, nums: 0}],
database: [{name: "sample", price: 0, nums: 0, type: "", comment: ""}],
selectedIndex: 0
},
methods: {
......@@ -763,7 +822,8 @@
this.doUpdate(item, 2);
},
del: function (item) {
this.doUpdate(item, 1);
if (confirm("确认删除?"))
this.doUpdate(item, 1);
},
add: function (item) {
this.doUpdate(item, 0);
......@@ -771,6 +831,9 @@
addFromDatabase: function (item) {
this.doUpdate(item, 3);
},
deleteFromDatabase: function (item) {
this.doUpdate(item, 4);
},
showlist: function () {
this.$http.get("${pageContext.request.contextPath}/Budget/Detail/Equipment").then(
function (data) {
......@@ -804,7 +867,10 @@
doUpdate: function (item, curd) {
this.$http.post("${pageContext.request.contextPath}/Budget/Modify/Equipment",
{
id:item.id,
name: item.name,
type: item.type,
comment: item.comment,
price: item.price,
nums: item.nums,
curd: curd
......@@ -833,7 +899,7 @@
this.doUpdate(item, 2);
},
del: function (item) {
this.doUpdate(item, 1);
if (confirm("确认删除?")) this.doUpdate(item, 1);
},
add: function (item) {
this.doUpdate(item, 0);
......@@ -879,7 +945,7 @@
this.doUpdate(item, 2);
},
del: function (item) {
this.doUpdate(item, 1);
if (confirm("确认删除?")) this.doUpdate(item, 1);
},
add: function (item) {
this.doUpdate(item, 0);
......@@ -927,7 +993,7 @@
this.doUpdate(item, 2);
},
del: function (item) {
this.doUpdate(item, 1);
if (confirm("确认删除?")) this.doUpdate(item, 1);
},
add: function (item) {
this.doUpdate(item, 0);
......@@ -1014,7 +1080,7 @@
this.doUpdate(item, 2);
},
del: function (item) {
this.doUpdate(item, 1);
if (confirm("确认删除?")) this.doUpdate(item, 1);
},
add: function (item) {
this.doUpdate(item, 0);
......@@ -1061,7 +1127,7 @@
this.doUpdate(item, 2);
},
del: function (item) {
this.doUpdate(item, 1);
if (confirm("确认删除?")) this.doUpdate(item, 1);
},
add: function (item) {
this.doUpdate(item, 0);
......@@ -1129,7 +1195,7 @@
this.doUpdate(item, 2);
},
del: function (item) {
this.doUpdate(item, 1);
if (confirm("确认删除?")) this.doUpdate(item, 1);
},
add: function (item) {
this.doUpdate(item, 0);
......@@ -1174,7 +1240,7 @@
this.doUpdate(item, 2);
},
del: function (item) {
this.doUpdate(item, 1);
if (confirm("确认删除?")) this.doUpdate(item, 1);
},
add: function (item) {
this.doUpdate(item, 0);
......@@ -1226,7 +1292,7 @@
this.doUpdate(item, 2);
},
del: function (item) {
this.doUpdate(item, 1);
if (confirm("确认删除?")) this.doUpdate(item, 1);
},
add: function (item) {
item.nums = 1;
......@@ -1295,7 +1361,7 @@
this.doUpdate(item, 2);
},
del: function (item) {
this.doUpdate(item, 1);
if (confirm("确认删除?")) this.doUpdate(item, 1);
},
add: function (item) {
this.doUpdate(item, 0);
......@@ -1349,6 +1415,78 @@
}
});
var othersVue = new Vue({
el: "#others",
data: {
sample: {name: "sample", price: 0, nums: 0},
items: [],
database: [{name: "sample", price: 0, nums: 0}],
selectedIndex: 0
},
methods: {
update: function (item) {
this.doUpdate(item, 2);
},
del: function (item) {
if (confirm("确认删除?")) this.doUpdate(item, 1);
},
add: function (item) {
this.doUpdate(item, 0);
},
addFromDatabase: function (item) {
this.doUpdate(item, 3);
},
showlist: function () {
this.$http.get("${pageContext.request.contextPath}/Budget/Detail/Others").then(
function (data) {
this.items = data.body.data;
console.log("showlist");
updateBudgetPage("others");
this.showDatabase();
}, function (error) {
console.log(error)
}
);
},
showDatabase: function () {
this.$http.get("${pageContext.request.contextPath}/Database/Query/Others").then(
function (data) {
var tmp = data.body.data;
for (var i = 0; i < tmp.length; i++) {
if (inItems(tmp[i], this.items)) {
console.log("inItems:true, " + tmp[i].name);
tmp.splice(i, 1);
i--;
}
}
this.database = tmp;
console.log("show database");
}, function (error) {
console.log(error)
}
)
},
doUpdate: function (item, curd) {
this.$http.post("${pageContext.request.contextPath}/Budget/Modify/Others",
{
name: item.name,
price: item.price,
nums: item.nums,
curd: curd
},
{emulateJSON: true}
).then(function (value) {
this.showlist();
}, function (error) {
alert(error.bodyText);
this.showlist()
});
}
},
created: function () {
}
});
/**
* 更新差值
......@@ -1360,7 +1498,7 @@
type: "post",
dataType: "json",
success: function (data) {
sidenavVue.budget=data;
sidenavVue.budget = data;
var over = "预算超出:";
var under = "预算不足,再来";
var equal = "凑够啦!";
......
......@@ -2,6 +2,11 @@ import beans.Budget;
import beans.Conference;
import beans.Equipment;
import beans.Item;
import handlers.BudgetHandler;
import net.schmizz.sshj.SSHClient;
import net.schmizz.sshj.sftp.SFTPClient;
import net.schmizz.sshj.xfer.FileSystemFile;
import org.jsoup.select.Evaluator;
import org.junit.Test;
import java.io.*;
......@@ -496,4 +501,29 @@ public class MyTest implements Serializable {
System.out.println(e1.equals(c1));
System.out.println(e1.equals(e2));
}
@Test
public void directoryTest() throws ClassNotFoundException {
System.out.println();
System.getProperty("user.home");
}
@Test
public void SFTPTestUp() throws IOException {
final SSHClient ssh = new SSHClient();
ssh.loadKnownHosts(new File("‪C:\\Users\\Song\\.ssh\\known_hosts"));
ssh.connect("47.92.3.69");
try {
ssh.authPublickey("root");
final String src = "‪F:\\Workspace\\BudgetManagementSystem\\pom.xml";
final SFTPClient sftp = ssh.newSFTPClient();
try {
sftp.put(new FileSystemFile(src), "/tmp");
} finally {
sftp.close();
}
} finally {
ssh.disconnect();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment