提交 17134b35 authored 作者: gongwenjie's avatar gongwenjie

Merge branch 'master' of git.yfzx.zjtys.com.cn:zjm/notes2.0

# Conflicts: # notes-attendance/src/main/java/com/zjty/tynotes/attendance/controller/AttendanceController.java
上级 a8e2ef12
......@@ -18,7 +18,9 @@ public interface ApprovalInformationDao extends MongoRepository<ApprovalInformat
List<ApprovalInformation> findAllByStatusIn(List<String> statusList);
ApprovalInformation findAllByUserIdAndLeaveStartTimeBeforeAndLeaveEndTimeAfterAndApprovalTypeIn(String userId, Date startTime,Date endTime,List<String> type);
ApprovalInformation findAllByUserIdAndLeaveStartTimeLessThanEqualAndLeaveEndTimeGreaterThanEqualAndApprovalTypeIn(String userId, Date startTime ,Date endTime,List<String> type);
ApprovalInformation findAllByUserIdAndLeaveStartTimeBeforeAndLeaveEndTimeBetweenAndApprovalTypeIn(String userId, Date startTime,Date startTime1,Date endTime,List<String> type);
......
......@@ -57,11 +57,11 @@ public class ApprovalInformation {
private String approvalLevel;
@ApiModelProperty(value = "请假开始时间",example = "2020-03-20 09:00:00")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date leaveStartTime;
@ApiModelProperty(value = "请假结束时间",example = "2020-03-21 09:00:00")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date leaveEndTime;
@ApiModelProperty(value = "一级审批是否通过",example = "0/1")
......
......@@ -16,7 +16,6 @@ import java.util.Date;
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "个人考勤信息", description = "个人考勤信息")
@Document(collection = "ding_attendance")
public class AttendanceDetails {
......@@ -86,4 +85,11 @@ public class AttendanceDetails {
@ApiModelProperty(value = "时间",example = "2020-03-22 09:00:00")
Date date;
public AttendanceDetails() {
workOverHours = 0;
outSideBusinessDay = 0f;
outWorkDay = 0f;
sickLeaveDay = 0f;
}
}
......@@ -183,17 +183,18 @@ public class CardTask {
String format1 = sdf2.format(parse);
Date date1 = sdf4.parse(format1);
ApprovalInformation approvalInformation = approvalInformationDao.findAllByUserIdAndLeaveStartTimeBeforeAndLeaveEndTimeAfterAndApprovalTypeIn(user.getId(), date, date1,type1);
compute(approvalInformation,attendanceDetails,user.getId(),date,date1,type1);
ApprovalInformation approvalInformation1 = approvalInformationDao.findAllByUserIdAndLeaveStartTimeBeforeAndLeaveEndTimeAfterAndApprovalTypeIn(user.getId(), date, date1,type2);
compute(approvalInformation1,attendanceDetails,user.getId(),date,date1,type2);
ApprovalInformation approvalInformation2 = approvalInformationDao.findAllByUserIdAndLeaveStartTimeBeforeAndLeaveEndTimeAfterAndApprovalTypeIn(user.getId(), date, date1,type3);
compute(approvalInformation2,attendanceDetails,user.getId(),date,date1,type3);
System.out.println(date);
System.out.println(date1);
List<ApprovalInformation> all = approvalInformationDao.findAll();
System.out.println("startTime"+all.get(0).getLeaveStartTime()+"\n"+"endTime"+all.get(0).getLeaveEndTime());
ApprovalInformation approvalInformation = approvalInformationDao.findAllByUserIdAndLeaveStartTimeLessThanEqualAndLeaveEndTimeGreaterThanEqualAndApprovalTypeIn(user.getId(), date, date1,type1);
List<ApprovalInformation> compute = compute(approvalInformation, attendanceDetails, user.getId(), date, date1, type1);
ApprovalInformation approvalInformation1 = approvalInformationDao.findAllByUserIdAndLeaveStartTimeLessThanEqualAndLeaveEndTimeGreaterThanEqualAndApprovalTypeIn(user.getId(), date,date1,type2);
List<ApprovalInformation> compute1 = compute(approvalInformation1, attendanceDetails, user.getId(), date, date1, type2);
ApprovalInformation approvalInformation2 = approvalInformationDao.findAllByUserIdAndLeaveStartTimeLessThanEqualAndLeaveEndTimeGreaterThanEqualAndApprovalTypeIn(user.getId(), date,date1,type3);
List<ApprovalInformation> compute2 = compute(approvalInformation2, attendanceDetails, user.getId(), date, date1, type3);
attendanceDetails.setUserId(user.getId());
System.out.println(approvalInformation);
System.out.println(approvalInformation1);
System.out.println(approvalInformation2);
if(cardResults1!=null){
List<CardResult> cardResults = new ArrayList<>();
cardResults1.forEach(cardResult -> {
......@@ -211,13 +212,15 @@ public class CardTask {
attendanceDetails.setLessCard(0);
}else if(cardResults.size()==1){
attendanceDetails.setLessCard(1);
if(approvalInformation == null && approvalInformation1==null&&approvalInformation2==null){
if(approvalInformation == null && approvalInformation1==null&&approvalInformation2==null
&&compute==null&&compute1==null&&compute2==null){
attendanceDetails.setIsAbsenteeismDay(0);
attendanceDetails.setAbsenteeismDay(0.5f);
}
}else{
attendanceDetails.setLessCard(2);
if(approvalInformation == null && approvalInformation1==null&&approvalInformation2==null){
if(approvalInformation == null && approvalInformation1==null&&approvalInformation2==null
&&compute==null&&compute1==null&&compute2==null){
attendanceDetails.setIsAbsenteeismDay(0);
attendanceDetails.setAbsenteeismDay(1f);
}
......@@ -256,7 +259,9 @@ public class CardTask {
* @param date2
* @param types
*/
private void compute(ApprovalInformation approvalInformation,AttendanceDetails attendanceDetails,String userId,Date date1,Date date2,List<String> types){
private List<ApprovalInformation> compute(ApprovalInformation approvalInformation,AttendanceDetails attendanceDetails,String userId,Date date1,Date date2,List<String> types){
List<ApprovalInformation> approvalInformationList = new ArrayList<>();
if(types.contains("公出")){
if(approvalInformation!=null){
attendanceDetails.setIsOutSideBusinessDay(0);
attendanceDetails.setOutSideBusinessDay(1f);
......@@ -266,14 +271,59 @@ public class CardTask {
if(approvalInformation1!=null){
attendanceDetails.setIsOutSideBusinessDay(0);
attendanceDetails.setOutSideBusinessDay(0.5f);
approvalInformationList.add(approvalInformation1);
}
if(approvalInformation2!=null){
attendanceDetails.setIsOutSideBusinessDay(0);
if(attendanceDetails.getOutSideBusinessDay()!=null){
attendanceDetails.setOutSideBusinessDay(attendanceDetails.getOutSideBusinessDay()+0.5f);
}
approvalInformationList.add(approvalInformation2);
}
}
}else if(types.contains("出差")){
if(approvalInformation!=null){
attendanceDetails.setIsOutWorkDay(0);
attendanceDetails.setOutWorkDay(1f);
}else{
ApprovalInformation approvalInformation1 = approvalInformationDao.findAllByUserIdAndLeaveStartTimeBeforeAndLeaveEndTimeBetweenAndApprovalTypeIn(userId, date1, date1,date2,types);
ApprovalInformation approvalInformation2 = approvalInformationDao.findAllByUserIdAndLeaveStartTimeBetweenAndLeaveEndTimeAfterAndApprovalTypeIn(userId, date1, date2,date2,types);
if(approvalInformation1!=null){
attendanceDetails.setIsOutWorkDay(0);
attendanceDetails.setOutWorkDay(0.5f);
approvalInformationList.add(approvalInformation1);
}
if(approvalInformation2!=null){
attendanceDetails.setIsOutWorkDay(0);
if(attendanceDetails.getOutWorkDay()!=null){
attendanceDetails.setOutWorkDay(attendanceDetails.getOutSideBusinessDay()+0.5f);
}
approvalInformationList.add(approvalInformation2);
}
}
}else if(types.contains("事假") || types.contains("病假") || types.contains("调休")){
if(approvalInformation!=null){
attendanceDetails.setIsSickLeaveDay(0);
attendanceDetails.setSickLeaveDay(1f);
}else{
ApprovalInformation approvalInformation1 = approvalInformationDao.findAllByUserIdAndLeaveStartTimeBeforeAndLeaveEndTimeBetweenAndApprovalTypeIn(userId, date1, date1,date2,types);
ApprovalInformation approvalInformation2 = approvalInformationDao.findAllByUserIdAndLeaveStartTimeBetweenAndLeaveEndTimeAfterAndApprovalTypeIn(userId, date1, date2,date2,types);
if(approvalInformation1!=null){
attendanceDetails.setIsSickLeaveDay(0);
attendanceDetails.setSickLeaveDay(0.5f);
approvalInformationList.add(approvalInformation1);
}
if(approvalInformation2!=null){
attendanceDetails.setIsSickLeaveDay(0);
if(attendanceDetails.getSickLeaveDay()!=null){
attendanceDetails.setSickLeaveDay(attendanceDetails.getSickLeaveDay()+0.5f);
}
approvalInformationList.add(approvalInformation2);
}
}
}
return approvalInformationList;
}
/**
......
......@@ -115,6 +115,14 @@ public class UserController {
return ok(iUserService.findUserList(id,authoryName));
}
@ApiOperation(value = "查询具有发布权限的人,也就是可选的审核者", response = User.class)
@GetMapping("/findPublishUsers")
public ResponseEntity findPublishUsers() {
String authoryName = "发布任务";
List<User> userList = iUserService.findPublishUsers(authoryName);
return ok(userList);
}
@ApiOperation(value = "密码加密", response = User.class)
@GetMapping("/encryPas")
public ResponseEntity encryPas() {
......
......@@ -28,4 +28,7 @@ public interface AuthorityDao extends MongoRepository<Authority, String> {
void deleteAllByNameIn(List<String> name);
List<Authority> findAllByNameIn(List<String> name);
Authority findByName(String authorityName);
}
......@@ -18,4 +18,6 @@ public interface RoleAuthorityDao extends MongoRepository<RoleAuthority,String>
List<RoleAuthority> findAllByRoleIdIn(List<String> roleIds);
List<RoleAuthority> findAllByRoleId(String roleId);
List<RoleAuthority> findAllByAuthorityId(String authorityId);
}
......@@ -170,4 +170,11 @@ public interface IUserService {
* @return
*/
JobLeads findJobLeads(String executorId);
/**
* 查询所有具有发布任务权限的人
* @param authoryName
* @return
*/
List<User> findPublishUsers(String authoryName);
}
......@@ -769,6 +769,37 @@ public class UserServiceImpl implements IUserService {
return jobLeads;
}
@Override
public List<User> findPublishUsers(String authoryName) {
List<User> userList = new ArrayList<>();
Authority authority = authorityDao.findByName(authoryName);
String id = authority.getId();
List<RoleAuthority> roleAuthorities = roleAuthorityDao.findAllByAuthorityId(id);
if(roleAuthorities!=null){
List<String> roleIds = new ArrayList<>();
List<String> userIds = new ArrayList<>();
roleAuthorities.forEach(roleAuthority -> {
roleIds.add(roleAuthority.getRoleId());
});
List<UserRole> userRoles = userRoleDao.findAllByRoleIdIn(roleIds);
if(userRoles!=null){
userRoles.forEach(userRole -> {
String userId = userRole.getUserId();
if(!userIds.contains(userId)){
userIds.add(userId);
}
});
}
userIds.forEach(userId -> {
User user = findUserById(userId);
userList.add(user);
});
}
return userList;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论