Skip to content

Commit

Permalink
linjiale merge (yerunjie#3)
Browse files Browse the repository at this point in the history
* js

commit

* zhujian

* accept

* fuck

* 12.10

* login

* participant

* web, a half

* tmp

* web finished

* solve an error

* doc

* merge ssd pic

* shuffle

* 12.13

* debug

* debug over

* design doc

* test doc

* read.md

* Update README.md

* diedai3

* cc.md for stress test

* ???

* s

* a

* aaaa

* reference
  • Loading branch information
linjiale authored and yerunjie committed Jan 21, 2018
1 parent 15aaf80 commit 162863e
Show file tree
Hide file tree
Showing 98 changed files with 1,111 additions and 31,318 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ dist/
nbdist/
.nb-gradle/
src/main/webapp/WEB-INF/

.DS_Store
388 changes: 387 additions & 1 deletion README.md

Large diffs are not rendered by default.

Binary file added doc/README.docx
Binary file not shown.
Binary file added doc/README.pdf
Binary file not shown.
Binary file added doc/pic/aapdesign.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/app_index.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/app_login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/app_me.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/app_task.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/database.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/function.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/organization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/participate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/person_list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/query_task.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/recommand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/set.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/shzyzw0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/shzyzw1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/ssd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/ssd1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/ssd2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/ssd3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/sys.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/test_repair.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/test_res1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/test_res2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/test_res3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/tfimg/go1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/pic/tfimg/go2.png
Binary file added doc/pic/tfimg/go3.png
Binary file added doc/pic/tfimg/login1.png
Binary file added doc/pic/tfimg/shv1.png
Binary file added doc/pic/tfimg/world1.png
Binary file added doc/pic/tfimg/world2.png
Binary file added doc/pic/web_main.png
Binary file added doc/pic/web_pics.png
14 changes: 6 additions & 8 deletions src/main/java/com/yqbd/controller/BaseController.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
package com.yqbd.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ResourceLoader;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import javax.servlet.http.HttpSession;

/**
Expand All @@ -30,4 +22,10 @@ public int getCurrentCompanyId(){
int companyId = (int)session.getAttribute("companyId");
return companyId;
}

public int getTaskId(){
HttpSession session = request.getSession();
int taskId = (int)session.getAttribute("taskId");
return taskId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public BaseJson companyLogin(@RequestParam("companyAccount") String companyAccou
}

@RequestMapping(value = "/getAllCompanies")
public BaseJson getAllCompanies() {
public BaseJson getAllCompanies() {
BaseJson baseJson = new BaseJson();
List<CompanyInfo> companyInfoList = companyInfoMapper.getAllCompanies();
baseJson.setObj(companyInfoList.stream().map(this::parse).collect(Collectors.toList()));
Expand Down
76 changes: 72 additions & 4 deletions src/main/java/com/yqbd/controller/api/TaskController.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.yqbd.controller.BaseController;
import com.yqbd.mapper.*;
import com.yqbd.model.*;
import org.apache.tomcat.jni.User;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
Expand Down Expand Up @@ -56,6 +57,15 @@ public BaseJson getAllTypes() {
public BaseJson getAllTasks() {
BaseJson baseJson = new BaseJson();
List<Task> tasks = taskMapper.selectAllTasks();
Collections.shuffle(tasks);
baseJson.setObj(Lists.transform(tasks, this::parse));
return baseJson;
}

@RequestMapping(value = "/getAcceptTasks")
public BaseJson getAcceptTasks(@RequestParam("userId") int userId) {
BaseJson baseJson = new BaseJson();
List<Task> tasks = taskMapper.getAcceptTasks(userId);
baseJson.setObj(Lists.transform(tasks, this::parse));
return baseJson;
}
Expand Down Expand Up @@ -125,15 +135,15 @@ private SearchType parse(Map.Entry<String, List<Type>> entry) {
return tmp;
}

@RequestMapping(value = "/publishTasks")
@RequestMapping(value = "/getTakenTask")
public BaseJson getMyPublishedTask(@RequestParam("userId") int userId) {
System.out.println("getMyPublishedTask");
BaseJson baseJson = new BaseJson();
List<Task> tasks = taskMapper.getPublishedTasksByUserId(userId);
baseJson.setObj(tasks);
List<Task> tasks = taskMapper.getTakenTasksByUserId(userId);
baseJson.setObj(Lists.transform(tasks, this::parse));
return baseJson;
}


@RequestMapping(value = "/takenTasks")
public BaseJson getMyTaken(@RequestParam("userId") int userId) {
System.out.println("getMyTaken");
Expand Down Expand Up @@ -170,6 +180,7 @@ public void cancelPublishedTask(@RequestParam("taskId") int taskId) {
System.out.println("task" + taskId + "已删除");
}


@RequestMapping(value = "/getSearch")
public BaseJson getSearch(@RequestParam("map") String map) {
System.out.println(map);
Expand Down Expand Up @@ -313,6 +324,7 @@ public BaseJson isCollected(@RequestParam("taskId") int taskId, @RequestParam("u
UserCollectKey userTake = userCollectMapper.selectByPrimaryKey(userTakeKey);
BaseBean baseBean = new BaseBean(Objects.nonNull(userTake));
baseJson.setObj(baseBean);
baseJson.setReturnCode("1.0.C.0");
return baseJson;
}

Expand All @@ -330,9 +342,63 @@ public BaseJson collect(@RequestParam("taskId") int taskId, @RequestParam("userI
}
BaseBean baseBean = new BaseBean(Objects.isNull(userTake));
baseJson.setObj(baseBean);
baseJson.setReturnCode("1.0.C.0");
return baseJson;
}


@RequestMapping(value = "/isTake")
public BaseJson isTake(@RequestParam("taskId") int taskId, @RequestParam("userId") int userId) {
BaseJson baseJson = new BaseJson();
UserTakeKey userTakeKey = new UserTakeKey();
userTakeKey.setUserId(userId);
userTakeKey.setTaskId(taskId);
UserTake userTake = userTakeMapper.selectByPrimaryKey(userTakeKey);
BaseBean baseBean = new BaseBean(Objects.nonNull(userTake));
baseJson.setObj(baseBean);
baseJson.setReturnCode("1.0.T.0");
return baseJson;
}


@RequestMapping(value = "/take")
public BaseJson take(@RequestParam("taskId") int taskId, @RequestParam("userId") int userId) {
BaseJson baseJson = new BaseJson();
UserTakeKey userTakeKey = new UserTakeKey();
userTakeKey.setUserId(userId);
userTakeKey.setTaskId(taskId);
UserTake userTake = userTakeMapper.selectByPrimaryKey(userTakeKey);
if (Objects.nonNull(userTake)) {
userTakeMapper.deleteByPrimaryKey(userTakeKey);
} else {
userTakeMapper.insertUserTake(userTakeKey);
}
BaseBean baseBean = new BaseBean(Objects.isNull(userTake));
baseJson.setObj(baseBean);
baseJson.setReturnCode("1.0.T.0");
return baseJson;
}

@RequestMapping(value="/showParticipant")
public BaseJson showParticipant(@RequestParam("taskId") int taskId){
BaseJson baseJson = new BaseJson();
BaseBean baseBean = new BaseBean();
baseBean.setSingleResult(String.valueOf("taskId"));
baseJson.setObj(baseBean);
HttpSession session = request.getSession();
session.setAttribute("taskId", taskId);
return baseJson;

}

@RequestMapping(value="/getParticipant")
public BaseJson getParticipant(@RequestParam("taskId") int taskId){
BaseJson baseJson = new BaseJson();
BaseBean baseBean = new BaseBean();
List<UserInfoBean> userInfoList = taskMapper.getParticipant(taskId);
baseJson.setObj(userInfoList);
return baseJson;
}
private TaskBean parse(Task task) {
TaskBean taskBean = new TaskBean();
BeanUtils.copyProperties(task, taskBean);
Expand All @@ -349,4 +415,6 @@ private TypeBean parse(Type type) {
BeanUtils.copyProperties(type, result);
return result;
}


}
1 change: 0 additions & 1 deletion src/main/java/com/yqbd/controller/api/UserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public BaseJson login(@RequestParam("accountNumber") String accountNumber, @Requ
public BaseJson register(@RequestParam("accountNumber") String accountNumber, @RequestParam("userPassword") String userPassword,
@RequestParam("realName") String realName){
BaseJson baseJson = new BaseJson();

UserInfo userInfo = new UserInfo();
userInfo.setAccountNumber(accountNumber);
userInfo.setPassword(userPassword);
Expand Down
33 changes: 33 additions & 0 deletions src/main/java/com/yqbd/controller/web/WebCompanyController.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package com.yqbd.controller.web;

import com.yqbd.beans.BaseJson;
import com.yqbd.controller.BaseController;
import com.yqbd.mapper.CompanyInfoMapper;
import com.yqbd.mapper.TaskMapper;
import com.yqbd.model.CompanyInfo;
import com.yqbd.model.Task;
import com.yqbd.model.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -96,6 +101,7 @@ public String tableComplete(Map<String, Object> model) {
return "table_complete";
}


@RequestMapping(value = "/typography")
public String typography(Map<String, Object> model) {
int companyId = getCurrentCompanyId();
Expand Down Expand Up @@ -147,4 +153,31 @@ public String postTask(Map<String, Object> model) {
model.put("company_name", companyName);
return "post_task";
}


@RequestMapping(value = "/showParticipant")
public String showParticipant(Map<String, Object> model){

int companyId = getCurrentCompanyId();
CompanyInfo companyInfo = companyInfoMapper.selectByPrimaryKey(companyId);
String companyName = companyInfo.getCompanyName();
model.put("company_name", companyName);
int taskId = getTaskId();
List<UserInfo> userInfoList=taskMapper.selectParticipant(taskId);

model.put("userInfoList", userInfoList);
return "participant";
}

@RequestMapping(value = "/setTask", method = RequestMethod.POST)
public BaseJson setTask(@RequestParam("taskId") String taskId) {
BaseJson baseJson = new BaseJson();
int result = Integer.valueOf(taskId);
baseJson.setReturnCode("3.0");
baseJson.setErrorMessage("成功");
HttpSession session = request.getSession();
session.setAttribute("taskId", result);
return baseJson;
}

}
29 changes: 23 additions & 6 deletions src/main/java/com/yqbd/mapper/TaskMapper.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.yqbd.mapper;

import com.yqbd.beans.UserInfoBean;
import com.yqbd.model.Task;
import com.yqbd.model.UserInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;
Expand Down Expand Up @@ -108,12 +110,6 @@ public interface TaskMapper {
int updateByPrimaryKey(Task record);


@Select({
" select * from task where user_id = #{userId,jdbcType=INTEGER}"
})
@ResultType(Task.class)
List<Task> getPublishedTasksByUserId(Integer userId);

@Select({
" select * from task where task_id in (SELECT task_id from user_take WHERE user_id= #{userId,jdbcType=INTEGER})"
})
Expand Down Expand Up @@ -143,9 +139,30 @@ public interface TaskMapper {
@ResultType(Task.class)
List<Task> getCollectedTasks(Integer userId);


@Select({
"select * from task where task_id in (select task_id from user_take where user_id = #{userId})"
})
@ResultType(Task.class)
List<Task> getAcceptTasks(Integer userId);


@Select({
"select * from task where company_id = #{companyId}"
})
@ResultType(Task.class)
List<Task> getCompanyTasks(Integer companyId);

@Select({
"select * from user_info where user_id in (select user_id from user_take where task_id = #{taskId})"
})
@ResultType(UserInfo.class)
List<UserInfo> selectParticipant(Integer taskId);


@Select({
"select * from user_info where user_id in (select user_id from user_take where task_id = #{taskId})"
})
@ResultType(UserInfoBean.class)
List<UserInfoBean> getParticipant(Integer taskId);
}
20 changes: 15 additions & 5 deletions src/main/java/com/yqbd/mapper/UserTakeMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

import com.yqbd.model.UserTake;
import com.yqbd.model.UserTakeKey;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.*;

public interface UserTakeMapper {
@Delete({
Expand All @@ -16,6 +12,18 @@ public interface UserTakeMapper {
})
int deleteByPrimaryKey(UserTakeKey key);


@Insert({
"insert into user_take (task_id, user_id, ",
"status, publisher_comment_id, ",
"receiver_comment_id)",
"values (#{taskId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, ",
"0, 0, ",
"0)"
})
int insertUserTake(UserTakeKey record);


@Insert({
"insert into user_take (task_id, user_id, ",
"status, publisher_comment_id, ",
Expand Down Expand Up @@ -49,4 +57,6 @@ public interface UserTakeMapper {
"and user_id = #{userId,jdbcType=INTEGER}"
})
int updateByPrimaryKey(UserTake record);


}
Loading

0 comments on commit 162863e

Please sign in to comment.