Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4b2d363e85
@ -0,0 +1,7 @@
|
||||
package com.codesdream.ase.component.json.request;
|
||||
|
||||
public class UserLeaveRequest {
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.codesdream.ase.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.codesdream.ase.component.datamanager.JSONParameter;
|
||||
import com.codesdream.ase.component.json.request.UserLeaveRequest;
|
||||
import com.codesdream.ase.component.json.respond.FailedSONRespond;
|
||||
import com.codesdream.ase.component.json.respond.JSONBaseRespondObject;
|
||||
import com.codesdream.ase.component.permission.ASEUsernameEncoder;
|
||||
import com.codesdream.ase.service.LeavesService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
/**
|
||||
* 登录界面控制器类
|
||||
*/
|
||||
@Slf4j
|
||||
@Controller
|
||||
public class LeavesController {
|
||||
|
||||
@Resource
|
||||
private JSONParameter jsonParameter;
|
||||
|
||||
@Resource
|
||||
private LeavesService leavesService;
|
||||
|
||||
@Resource
|
||||
private ASEUsernameEncoder usernameEncoder;
|
||||
|
||||
@RequestMapping(value = "/")
|
||||
String printLeave(Model model) {
|
||||
return "Leave";
|
||||
}
|
||||
|
||||
//提交请假申请
|
||||
@RequestMapping(value = "/Leave/check", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
String requestLeave(HttpServletRequest request){
|
||||
|
||||
// 检查是否为JSON
|
||||
Optional<JSONObject> json = jsonParameter.getJSONByRequest(request);
|
||||
if(!json.isPresent()) return jsonParameter.getJSONString(new FailedSONRespond());
|
||||
|
||||
|
||||
UserLeaveRequest LeaveChecker = json.get().toJavaObject(UserLeaveRequest.class);
|
||||
// 检查类型
|
||||
|
||||
}
|
||||
//列出某辅导员待审核名单
|
||||
|
||||
//列出某人
|
||||
|
||||
}
|
@ -6,7 +6,7 @@ import java.util.*;
|
||||
import javax.persistence.*;
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "leaves_archive")
|
||||
@Table(name = "leave")
|
||||
public class Leave {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@ -17,15 +17,25 @@ public class Leave {
|
||||
//审批人容器
|
||||
@ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
|
||||
private Set <User> userTo;
|
||||
//请假原因
|
||||
@Column
|
||||
private String reasonToLeave;
|
||||
|
||||
|
||||
//请假类型 病假,事假等
|
||||
@Column(name = "type", nullable = false)
|
||||
private String type;
|
||||
//批准状态
|
||||
@Column(name = "Authentication", nullable = false)
|
||||
private Boolean Authentication;
|
||||
private String Authentication;
|
||||
|
||||
//审核备注
|
||||
@Column
|
||||
private String Comment;
|
||||
//开始时间
|
||||
@Column(nullable = false)
|
||||
private Date startTime;
|
||||
|
||||
@Column(nullable = false)
|
||||
private Date endTime;
|
||||
//申请时间
|
||||
|
@ -1,7 +0,0 @@
|
||||
package com.codesdream.ase.model.leaves;
|
||||
/**
|
||||
请假信息的管理系统
|
||||
*/
|
||||
public class LeavesSystem {
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.codesdream.ase.repository.leaves;
|
||||
import com.codesdream.ase.model.activity.Report;
|
||||
import com.codesdream.ase.model.leaves.Leave;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface LeaveRepository extends CrudRepository<Leave, Integer>{
|
||||
|
||||
Optional<Leave> findByTitle(String title) ;
|
||||
Optional<Leave> findByCreator(String creatorName);
|
||||
}
|
31
src/main/java/com/codesdream/ase/service/ILeavesService.java
Normal file
31
src/main/java/com/codesdream/ase/service/ILeavesService.java
Normal file
@ -0,0 +1,31 @@
|
||||
package com.codesdream.ase.service;
|
||||
|
||||
import com.codesdream.ase.model.leaves.Leave;
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ILeavesService {
|
||||
//通过标题查找活动
|
||||
Optional<Leave> findLeaveByTitle(String title);
|
||||
|
||||
//通过创建人姓名查找活动
|
||||
Optional<Leave> findLeaveByCreator(String creatorName);
|
||||
|
||||
//活动
|
||||
Leave save(Leave leave);
|
||||
|
||||
|
||||
//请假删除
|
||||
void delete(Leave Leave);
|
||||
|
||||
//请假信息更新
|
||||
Leave update(Leave Leave);
|
||||
|
||||
//创建请假条目
|
||||
Leave createLeave(Leave Leave);
|
||||
|
||||
//查询主要负责的活动
|
||||
//Leave findActivitiesInTheCharge(User user);
|
||||
|
||||
}
|
53
src/main/java/com/codesdream/ase/service/LeavesService.java
Normal file
53
src/main/java/com/codesdream/ase/service/LeavesService.java
Normal file
@ -0,0 +1,53 @@
|
||||
package com.codesdream.ase.service;
|
||||
|
||||
import com.codesdream.ase.model.leaves.Leave;
|
||||
import com.codesdream.ase.repository.leaves.LeaveRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class LeavesService implements ILeavesService {
|
||||
|
||||
@Resource
|
||||
private LeaveRepository leaveRepository;
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<Leave> findLeaveByTitle(String title) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Leave> findLeaveByCreator(String creatorName) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Leave save(Leave leave) {
|
||||
return leaveRepository.save(leave);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void delete(Leave leave) {
|
||||
leaveRepository.delete(leave);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Leave update(Leave leave) {
|
||||
return leaveRepository.save(leave);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Leave createLeave(Leave leave) {
|
||||
return leaveRepository.save(leave);
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public Leave findActivitiesInTheCharge(User user) {
|
||||
|
||||
}*/
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user