Commit f2dfe881 authored by ZhangRunSong's avatar ZhangRunSong
parents ca0925f2 12af672d
...@@ -45,7 +45,18 @@ public class FyglDailyReimbursementController extends BaseController ...@@ -45,7 +45,18 @@ public class FyglDailyReimbursementController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
//获取所有项目名字和id
//根据当前用户角色id,查询所有项目关联的项目-最新
@GetMapping("/getProjectListByUserId")
public AjaxResult getProjectListByUserId()
{
List<FyglDailyReimbursementDTO> projectList = fyglDailyReimbursementService.getProjectListByUserId();
return AjaxResult.success(projectList);
}
//获取所有项目名字和id,用于搜索
@GetMapping("/projectList") @GetMapping("/projectList")
@Anonymous @Anonymous
public AjaxResult projectList() public AjaxResult projectList()
......
...@@ -2,16 +2,12 @@ package com.ruoyi.controller; ...@@ -2,16 +2,12 @@ package com.ruoyi.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.domain.dto.EmployeeBalanceDTO;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
...@@ -33,6 +29,8 @@ public class LeaveApplicationController extends BaseController ...@@ -33,6 +29,8 @@ public class LeaveApplicationController extends BaseController
{ {
@Autowired @Autowired
private ILeaveApplicationService leaveApplicationService; private ILeaveApplicationService leaveApplicationService;
@Autowired
private SpringUtils springUtils;
/** /**
* 查询请假申请列表 * 查询请假申请列表
...@@ -101,4 +99,43 @@ public class LeaveApplicationController extends BaseController ...@@ -101,4 +99,43 @@ public class LeaveApplicationController extends BaseController
{ {
return toAjax(leaveApplicationService.deleteLeaveApplicationByIds(ids)); return toAjax(leaveApplicationService.deleteLeaveApplicationByIds(ids));
} }
/**
* 根据用户ID查询可抵扣的加班时长
* @param userId
* @return
*/
@GetMapping("/deductionOvertimeHours")
public EmployeeBalanceDTO selectDeductionOvertimeHoursByUserId(@RequestParam Long userId) {
return leaveApplicationService.selectDeductionOvertimeHoursByUserId(userId);
}
/**
* 更新员工的加班小时数余额
* @param dto 包含加班小时数余额和员工ID的DTO对象
* @return 更新结果
*/
@Log(title = "请假申请", businessType = BusinessType.UPDATE)
@PutMapping("/updateOvertimeHoursBalance")
public AjaxResult updateOvertimeHoursBalance(@RequestBody EmployeeBalanceDTO dto) {
System.out.println("前端接受的加班小时数余额信息:"+dto);
return toAjax(leaveApplicationService.updateOvertimeHoursBalance(dto));
}
@GetMapping("/project-managers")
public List<String> getProjectManagers() {
return leaveApplicationService.selectProjectManagers();
}
/**
* 获取总经理的nick_name
*/
@GetMapping("/general-manager")
public AjaxResult getGeneralManagerNickName() {
String generalManagerNickName = leaveApplicationService.selectGeneralManagerNickName();
return AjaxResult.success(generalManagerNickName);
}
} }
package com.ruoyi.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 员工余额对象 employee_balance
*
* @author hht
* @date 2025-03-06
*/
public class EmployeeBalance extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 唯一标识每条记录
*/
private Long id;
/**
* 员工ID(关联到员工表)
*/
private Long employeeId;
/**
* 年假余额
*/
private BigDecimal annualLeaveBalance;
/**
* 加班时长余额
*/
private BigDecimal overtimeHoursBalance;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdAt;
/**
* 更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updatedAt;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getEmployeeId() {
return employeeId;
}
public void setEmployeeId(Long employeeId) {
this.employeeId = employeeId;
}
public BigDecimal getAnnualLeaveBalance() {
return annualLeaveBalance;
}
public void setAnnualLeaveBalance(BigDecimal annualLeaveBalance) {
this.annualLeaveBalance = annualLeaveBalance;
}
public BigDecimal getOvertimeHoursBalance() {
return overtimeHoursBalance;
}
public void setOvertimeHoursBalance(BigDecimal overtimeHoursBalance) {
this.overtimeHoursBalance = overtimeHoursBalance;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("employeeId", getEmployeeId())
.append("annualLeaveBalance", getAnnualLeaveBalance())
.append("overtimeHoursBalance", getOvertimeHoursBalance())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.toString();
}
}
...@@ -29,6 +29,14 @@ public class LeaveApplication extends BaseEntity { ...@@ -29,6 +29,14 @@ public class LeaveApplication extends BaseEntity {
@Excel(name = "请假单号") @Excel(name = "请假单号")
private String leaveId; private String leaveId;
/**
* 用户ID
*/
private Long userId;
/** /**
* 申请日期 * 申请日期
*/ */
...@@ -73,14 +81,18 @@ public class LeaveApplication extends BaseEntity { ...@@ -73,14 +81,18 @@ public class LeaveApplication extends BaseEntity {
@Excel(name = "请假结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm") @Excel(name = "请假结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm")
private Date endTime; private Date endTime;
/** /**
* 请假时长 * 请假时长
*/ */
@Excel(name = "请假时长") @Excel(name = "请假时长")
private BigDecimal leavetimeHours; private BigDecimal leavetimeHours;
/**
* 扣减加班时长
*/
@Excel(name = "抵扣加班时长")
private BigDecimal deductionOvertimeHours;
/** /**
* 请假天数 * 请假天数
*/ */
...@@ -90,7 +102,6 @@ public class LeaveApplication extends BaseEntity { ...@@ -90,7 +102,6 @@ public class LeaveApplication extends BaseEntity {
/** /**
* 合计请假天数 * 合计请假天数
*/ */
@Excel(name = "合计请假天数")
private BigDecimal totalLeaveDays; private BigDecimal totalLeaveDays;
/** /**
...@@ -106,18 +117,10 @@ public class LeaveApplication extends BaseEntity { ...@@ -106,18 +117,10 @@ public class LeaveApplication extends BaseEntity {
private String proof; private String proof;
/** /**
* 审批状态 * 审批状态(0代表待审批,1代表审批中,2代表已通过,3代表已驳回)
*/ */
@Excel(name = "审批状态") @Excel(name = "审批状态", readConverterExp = "0=待审批,1=审批中,2=已通过,3=不通过")
private String status; private String approvalStatus;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
/** /**
* 创建时间 * 创建时间
...@@ -149,6 +152,10 @@ public class LeaveApplication extends BaseEntity { ...@@ -149,6 +152,10 @@ public class LeaveApplication extends BaseEntity {
return leaveId; return leaveId;
} }
public Long getUserId() {return userId;}
public void setUserId(Long userId) {this.userId = userId;}
public void setRequestDate(Date requestDate) { public void setRequestDate(Date requestDate) {
this.requestDate = requestDate; this.requestDate = requestDate;
} }
...@@ -199,6 +206,10 @@ public class LeaveApplication extends BaseEntity { ...@@ -199,6 +206,10 @@ public class LeaveApplication extends BaseEntity {
return leavetimeHours; return leavetimeHours;
} }
public BigDecimal getDeductionOvertimeHours() {return deductionOvertimeHours;}
public void setDeductionOvertimeHours(BigDecimal deductionOvertimeHours) {this.deductionOvertimeHours = deductionOvertimeHours;}
public void setLeaveDaysSubtotal(BigDecimal leaveDaysSubtotal) { public void setLeaveDaysSubtotal(BigDecimal leaveDaysSubtotal) {
this.leaveDaysSubtotal = leaveDaysSubtotal; this.leaveDaysSubtotal = leaveDaysSubtotal;
} }
...@@ -239,6 +250,10 @@ public class LeaveApplication extends BaseEntity { ...@@ -239,6 +250,10 @@ public class LeaveApplication extends BaseEntity {
public void setFirstApprover(String firstApprover) {this.firstApprover = firstApprover;} public void setFirstApprover(String firstApprover) {this.firstApprover = firstApprover;}
public String getApprovalStatus() {return approvalStatus;}
public void setApprovalStatus(String approvalStatus) {this.approvalStatus = approvalStatus;}
public void setCreatedTime(Date createdTime) { public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime; this.createdTime = createdTime;
...@@ -261,17 +276,19 @@ public class LeaveApplication extends BaseEntity { ...@@ -261,17 +276,19 @@ public class LeaveApplication extends BaseEntity {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("leaveId", getLeaveId()) .append("leaveId", getLeaveId())
.append("userId", getUserId())
.append("requestDate", getRequestDate()) .append("requestDate", getRequestDate())
.append("leaveType", getLeaveType()) .append("leaveType", getLeaveType())
.append("uname", getUname()) .append("uname", getUname())
.append("startTime", getStartTime()) .append("startTime", getStartTime())
.append("endTime", getEndTime()) .append("endTime", getEndTime())
.append("leavetimeHours", getLeavetimeHours()) .append("leavetimeHours", getLeavetimeHours())
.append("deductionOvertimeHours", getDeductionOvertimeHours())
.append("leaveDaysSubtotal", getLeaveDaysSubtotal()) .append("leaveDaysSubtotal", getLeaveDaysSubtotal())
.append("totalLeaveDays", getTotalLeaveDays()) .append("totalLeaveDays", getTotalLeaveDays())
.append("reason", getReason()) .append("reason", getReason())
.append("proof", getProof()) .append("proof", getProof())
.append("status", getStatus()) .append("approvalStatus", getApprovalStatus())
.append("createdTime", getCreatedTime()) .append("createdTime", getCreatedTime())
.append("updatedTime", getUpdatedTime()) .append("updatedTime", getUpdatedTime())
.append("firstApprover",getFirstApprover()) .append("firstApprover",getFirstApprover())
......
...@@ -23,6 +23,13 @@ public class OvertimeApplication extends BaseEntity { ...@@ -23,6 +23,13 @@ public class OvertimeApplication extends BaseEntity {
*/ */
private Long id; private Long id;
/**
* 员工ID
*/
private Long employeeId;
/** /**
* 加班单号 * 加班单号
*/ */
...@@ -58,9 +65,9 @@ public class OvertimeApplication extends BaseEntity { ...@@ -58,9 +65,9 @@ public class OvertimeApplication extends BaseEntity {
/** /**
* 加班总天数 * 个人加班总时长
*/ */
private BigDecimal totalOvertimeDays; private BigDecimal totalOvertimeHours;
...@@ -99,6 +106,9 @@ public class OvertimeApplication extends BaseEntity { ...@@ -99,6 +106,9 @@ public class OvertimeApplication extends BaseEntity {
public Long getId() { public Long getId() {
return id; return id;
} }
public Long getEmployeeId() {return employeeId;}
public void setEmployeeId(Long employeeId) {this.employeeId = employeeId;}
public void setOvertimeId(String overtimeId) { public void setOvertimeId(String overtimeId) {
this.overtimeId = overtimeId; this.overtimeId = overtimeId;
...@@ -142,15 +152,9 @@ public class OvertimeApplication extends BaseEntity { ...@@ -142,15 +152,9 @@ public class OvertimeApplication extends BaseEntity {
return overtimeHours; return overtimeHours;
} }
public BigDecimal getTotalOvertimeHours() {return totalOvertimeHours;}
public void setTotalOvertimeDays(BigDecimal totalOvertimeDays) { public void setTotalOvertimeHours(BigDecimal totalOvertimeHours) {this.totalOvertimeHours = totalOvertimeHours;}
this.totalOvertimeDays = totalOvertimeDays;
}
public BigDecimal getTotalOvertimeDays() {
return totalOvertimeDays;
}
public String getDivisionLeader() {return divisionLeader;} public String getDivisionLeader() {return divisionLeader;}
...@@ -184,12 +188,13 @@ public class OvertimeApplication extends BaseEntity { ...@@ -184,12 +188,13 @@ public class OvertimeApplication extends BaseEntity {
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("employeeId", getEmployeeId())
.append("overtimeId", getOvertimeId()) .append("overtimeId", getOvertimeId())
.append("uname", getUname()) .append("uname", getUname())
.append("requestDate", getRequestDate()) .append("requestDate", getRequestDate())
.append("yearMonth", getYearMonth()) .append("yearMonth", getYearMonth())
.append("overtimeHours", getOvertimeHours()) .append("overtimeHours", getOvertimeHours())
.append("totalOvertimeDays", getTotalOvertimeDays()) .append("totalOvertimeHours", getTotalOvertimeHours())
.append("project", getProject()) .append("project", getProject())
.append("projectLeader", getProjectLeader()) .append("projectLeader", getProjectLeader())
.append("divisionLeader", getDivisionLeader()) .append("divisionLeader", getDivisionLeader())
......
package com.ruoyi.domain.dto;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class EmployeeBalanceDTO {
private BigDecimal overtimeHoursBalance;
private BigDecimal annualLeaveBalance;
private Long employeeId;
}
...@@ -8,6 +8,7 @@ import java.util.List; ...@@ -8,6 +8,7 @@ import java.util.List;
@Data @Data
public class FyglDailyReimbursementDTO { public class FyglDailyReimbursementDTO {
private Long id; private Long id;
private Integer projectId;
private String projectName; private String projectName;
//项目负责人 //项目负责人
private String projectUserName; private String projectUserName;
......
...@@ -16,6 +16,7 @@ public class OvertimeApplicationBatchDTO { ...@@ -16,6 +16,7 @@ public class OvertimeApplicationBatchDTO {
private String project; private String project;
private String divisionLeader; private String divisionLeader;
private String projectLeader;
// 员工的加班列表 // 员工的加班列表
private List<OvertimeDetail> employees; private List<OvertimeDetail> employees;
......
...@@ -29,6 +29,9 @@ public class FyglDailyReimbursementVo extends BaseEntity { ...@@ -29,6 +29,9 @@ public class FyglDailyReimbursementVo extends BaseEntity {
//附件 //附件
private String accessory; private String accessory;
//项目id
private Integer projectId;
//删除标志 0未删除1已删除 //删除标志 0未删除1已删除
private Integer delFlag; private Integer delFlag;
......
...@@ -21,4 +21,6 @@ public class ProjectEmployeeInfoVo { ...@@ -21,4 +21,6 @@ public class ProjectEmployeeInfoVo {
private String employeeName; private String employeeName;
} }
package com.ruoyi.mapper;
import com.ruoyi.domain.EmployeeBalance;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
public interface EmployeeBalanceMapper {
/**
* 检查员工是否已有加班记录
*/
EmployeeBalance selectEmployeeBalanceByEmployeeId(@Param("employeeId") Long employeeId);
/**
* 插入员工余额记录
*/
int insertEmployeeBalance(EmployeeBalance employeeBalance);
/**
* 更新员工余额记录
*/
int updateEmployeeBalance(@Param("employeeId") Long employeeId, @Param("overtimeHoursBalance") BigDecimal overtimeHoursBalance);
}
...@@ -28,6 +28,8 @@ public interface FyglDailyReimbursementMapper ...@@ -28,6 +28,8 @@ public interface FyglDailyReimbursementMapper
//根据rid删除所有数据 //根据rid删除所有数据
int delDataByRid(Long rid); int delDataByRid(Long rid);
List<FyglDailyReimbursementDTO> getProjectListByUserId(Long userId);
public List<FyglDailyReimbursementDetailitemListDTO> selectFyglDailyReimbursementItemListById(@Param("rid") Long rid); public List<FyglDailyReimbursementDetailitemListDTO> selectFyglDailyReimbursementItemListById(@Param("rid") Long rid);
// 查找日常报销每个项目的所有报销 // 查找日常报销每个项目的所有报销
public List<FyglDailyReimbursementTableItemDTO> getItemList(FyglDailyReimbursementVo fyglDailyReimbursementVO); public List<FyglDailyReimbursementTableItemDTO> getItemList(FyglDailyReimbursementVo fyglDailyReimbursementVO);
......
...@@ -2,6 +2,9 @@ package com.ruoyi.mapper; ...@@ -2,6 +2,9 @@ package com.ruoyi.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.domain.LeaveApplication; import com.ruoyi.domain.LeaveApplication;
import com.ruoyi.domain.dto.EmployeeBalanceDTO;
import io.lettuce.core.dynamic.annotation.Param;
import java.util.Map;
/** /**
* 请假申请Mapper接口 * 请假申请Mapper接口
...@@ -58,4 +61,33 @@ public interface LeaveApplicationMapper ...@@ -58,4 +61,33 @@ public interface LeaveApplicationMapper
* @return 结果 * @return 结果
*/ */
public int deleteLeaveApplicationByIds(Long[] ids); public int deleteLeaveApplicationByIds(Long[] ids);
/**
* 根据用户id查询请假总时长
* @param userId
* @return
*/
EmployeeBalanceDTO selectDeductionOvertimeHoursByUserId(@Param("userId") Long userId);
/**
* 更新员工的加班总时长
* @param dto 包含overtimeHoursBalance和employeeId的对象
* @return 更新结果
*/
int updateOvertimeHoursBalance(EmployeeBalanceDTO dto);
/**
* 查询项目经理
* @return
*/
List<String> selectProjectManagers();
/**
* 获取总经理的nick_name
* @return 总经理的nick_name
*/
String selectGeneralManagerNickName();
} }
...@@ -60,6 +60,9 @@ public interface OvertimeApplicationMapper ...@@ -60,6 +60,9 @@ public interface OvertimeApplicationMapper
*/ */
public int deleteOvertimeApplicationByIds(Long[] ids); public int deleteOvertimeApplicationByIds(Long[] ids);
//批量添加加班申请 //批量添加加班申请
public int insertOvertimeApplicationBatch(OvertimeApplicationBatchDTO batchRequest); public int insertOvertimeApplicationBatch(OvertimeApplicationBatchDTO batchRequest);
//根据用户昵称获取用户id
public Long getUserIdByNickName(String nickName);
} }
...@@ -64,4 +64,6 @@ public interface IFyglDailyReimbursementService ...@@ -64,4 +64,6 @@ public interface IFyglDailyReimbursementService
* @return 结果 * @return 结果
*/ */
public int deleteFyglDailyReimbursementById(Long id); public int deleteFyglDailyReimbursementById(Long id);
List<FyglDailyReimbursementDTO> getProjectListByUserId();
} }
package com.ruoyi.service; package com.ruoyi.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.ruoyi.domain.LeaveApplication; import com.ruoyi.domain.LeaveApplication;
import com.ruoyi.domain.dto.EmployeeBalanceDTO;
import io.lettuce.core.dynamic.annotation.Param;
/** /**
* 请假申请Service接口 * 请假申请Service接口
...@@ -58,4 +62,17 @@ public interface ILeaveApplicationService ...@@ -58,4 +62,17 @@ public interface ILeaveApplicationService
* @return 结果 * @return 结果
*/ */
public int deleteLeaveApplicationById(Long id); public int deleteLeaveApplicationById(Long id);
//根据用户id查询该用户已扣除的加班小时数
EmployeeBalanceDTO selectDeductionOvertimeHoursByUserId(@Param("userId") Long userId);
//更新用户加班总时长
int updateOvertimeHoursBalance(EmployeeBalanceDTO dto);
//查询项目经理列表
List<String> selectProjectManagers();
//查询总经理
String selectGeneralManagerNickName();
} }
package com.ruoyi.service; package com.ruoyi.service;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import com.ruoyi.domain.OvertimeApplication; import com.ruoyi.domain.OvertimeApplication;
import com.ruoyi.domain.dto.OvertimeApplicationBatchDTO; import com.ruoyi.domain.dto.OvertimeApplicationBatchDTO;
import io.lettuce.core.dynamic.annotation.Param;
/** /**
* 加班申请Service接口 * 加班申请Service接口
...@@ -28,6 +30,13 @@ public interface IOvertimeApplicationService ...@@ -28,6 +30,13 @@ public interface IOvertimeApplicationService
*/ */
public List<OvertimeApplication> selectOvertimeApplicationList(OvertimeApplication overtimeApplication); public List<OvertimeApplication> selectOvertimeApplicationList(OvertimeApplication overtimeApplication);
/**
* 根据昵称查询用户id
*
* @param nickName 用户昵称
* @return 用户id
*/
public Long getUserIdByNickName(String nickName);
/** /**
* 新增加班申请 * 新增加班申请
* *
...@@ -62,4 +71,6 @@ public interface IOvertimeApplicationService ...@@ -62,4 +71,6 @@ public interface IOvertimeApplicationService
//批量添加加班申请 //批量添加加班申请
public int insertOvertimeApplicationBatch(OvertimeApplicationBatchDTO batchRequest); public int insertOvertimeApplicationBatch(OvertimeApplicationBatchDTO batchRequest);
} }
...@@ -105,7 +105,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen ...@@ -105,7 +105,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen
//先插入最外层表 //先插入最外层表
int i1 = fyglDailyReimbursementMapper.insertFyglDailyReimbursement(fyglDailyReimbursement); // int i1 = fyglDailyReimbursementMapper.insertFyglDailyReimbursement(fyglDailyReimbursement);
//第二层表 //第二层表
fyglDailyReimbursement.setStatus(2); fyglDailyReimbursement.setStatus(2);
fyglDailyReimbursement.setRegistrationTime(DateUtils.getNowDate()); fyglDailyReimbursement.setRegistrationTime(DateUtils.getNowDate());
...@@ -119,7 +119,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen ...@@ -119,7 +119,7 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen
} }
System.out.println("插入对象fyglDailyReimbursement = " + fyglDailyReimbursement); System.out.println("插入对象fyglDailyReimbursement = " + fyglDailyReimbursement);
return i1; return i2;
} }
@Override @Override
...@@ -178,4 +178,22 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen ...@@ -178,4 +178,22 @@ public class FyglDailyReimbursementServiceImpl implements IFyglDailyReimbursemen
{ {
return fyglDailyReimbursementMapper.deleteFyglDailyReimbursementById(id); return fyglDailyReimbursementMapper.deleteFyglDailyReimbursementById(id);
} }
@Override
public List<FyglDailyReimbursementDTO> getProjectListByUserId() {
List<FyglDailyReimbursementDTO> projectListByUserId = fyglDailyReimbursementMapper.getProjectListByUserId(SecurityUtils.getUserId());
System.out.println("结果 = " + projectListByUserId);
for(FyglDailyReimbursementDTO item:projectListByUserId){
Integer passNumber = 0;
Integer notPassNumber = 0;
FyglDailyReimbursementVo fyglDailyReimbursementVo = new FyglDailyReimbursementVo();
fyglDailyReimbursementVo.setProjectId(item.getProjectId());
List<FyglDailyReimbursementTableItemDTO> itemList = fyglDailyReimbursementMapper.getItemList(fyglDailyReimbursementVo);
item.setTableItemList(itemList);
}
return projectListByUserId;
}
} }
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import java.util.Date; import java.math.BigDecimal;
import java.util.List; import java.util.*;
import java.util.Random;
import com.ruoyi.domain.dto.EmployeeBalanceDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.mapper.LeaveApplicationMapper; import com.ruoyi.mapper.LeaveApplicationMapper;
...@@ -106,4 +106,40 @@ public class LeaveApplicationServiceImpl implements ILeaveApplicationService ...@@ -106,4 +106,40 @@ public class LeaveApplicationServiceImpl implements ILeaveApplicationService
{ {
return leaveApplicationMapper.deleteLeaveApplicationById(id); return leaveApplicationMapper.deleteLeaveApplicationById(id);
} }
/**
* 根据用户ID查询总的的加班小时数
* @param userId
* @return
*/
@Override
public EmployeeBalanceDTO selectDeductionOvertimeHoursByUserId(Long userId) {
return leaveApplicationMapper.selectDeductionOvertimeHoursByUserId(userId);
}
/**
* 更新员工的加班小时数余额
* @param dto 包含加班小时数余额和员工ID的DTO对象
* @return 更新结果
*/
@Override
public int updateOvertimeHoursBalance(EmployeeBalanceDTO dto) {
return leaveApplicationMapper.updateOvertimeHoursBalance(dto);
}
/**
* 查询项目经理列表
* @return
*/
@Override
public List<String> selectProjectManagers() {
return leaveApplicationMapper.selectProjectManagers();
}
@Override
public String selectGeneralManagerNickName(){
return leaveApplicationMapper.selectGeneralManagerNickName();
}
} }
package com.ruoyi.service.impl; package com.ruoyi.service.impl;
import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import com.ruoyi.domain.EmployeeBalance;
import com.ruoyi.domain.dto.OvertimeApplicationBatchDTO; import com.ruoyi.domain.dto.OvertimeApplicationBatchDTO;
import com.ruoyi.mapper.EmployeeBalanceMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.mapper.OvertimeApplicationMapper; import com.ruoyi.mapper.OvertimeApplicationMapper;
...@@ -22,6 +25,9 @@ public class OvertimeApplicationServiceImpl implements IOvertimeApplicationServi ...@@ -22,6 +25,9 @@ public class OvertimeApplicationServiceImpl implements IOvertimeApplicationServi
{ {
@Autowired @Autowired
private OvertimeApplicationMapper overtimeApplicationMapper; private OvertimeApplicationMapper overtimeApplicationMapper;
@Autowired
private EmployeeBalanceMapper employeeBalanceMapper;
/** /**
* 查询加班申请 * 查询加班申请
...@@ -47,6 +53,11 @@ public class OvertimeApplicationServiceImpl implements IOvertimeApplicationServi ...@@ -47,6 +53,11 @@ public class OvertimeApplicationServiceImpl implements IOvertimeApplicationServi
return overtimeApplicationMapper.selectOvertimeApplicationList(overtimeApplication); return overtimeApplicationMapper.selectOvertimeApplicationList(overtimeApplication);
} }
@Override
public Long getUserIdByNickName(String nickName) {
return overtimeApplicationMapper.getUserIdByNickName(nickName);
}
/** /**
* 新增加班申请 * 新增加班申请
* *
...@@ -69,6 +80,38 @@ public class OvertimeApplicationServiceImpl implements IOvertimeApplicationServi ...@@ -69,6 +80,38 @@ public class OvertimeApplicationServiceImpl implements IOvertimeApplicationServi
String randomNum = Integer.toHexString(random.nextInt(10000)).substring(0, 2); String randomNum = Integer.toHexString(random.nextInt(10000)).substring(0, 2);
return randomNum + timestamp; return randomNum + timestamp;
} }
// 插入员工余额
private void updateOrInsertEmployeeBalance(Long employeeId, BigDecimal overtimeHours) {
if (employeeId == null) {
throw new IllegalArgumentException("employeeId cannot be null");
}
EmployeeBalance employeeBalance = employeeBalanceMapper.selectEmployeeBalanceByEmployeeId(employeeId);
if (employeeBalance == null) {
// 如果没有记录,则插入新记录
EmployeeBalance newEmployeeBalance = new EmployeeBalance();
newEmployeeBalance.setEmployeeId(employeeId);
newEmployeeBalance.setOvertimeHoursBalance(overtimeHours);
employeeBalanceMapper.insertEmployeeBalance(newEmployeeBalance);
} else {
// 如果已有记录,则更新记录
employeeBalanceMapper.updateEmployeeBalance(employeeId, overtimeHours);
}
}
// 更新员工余额
private void updateEmployeeBalance(Long employeeId, BigDecimal difference) {
EmployeeBalance employeeBalance = employeeBalanceMapper.selectEmployeeBalanceByEmployeeId(employeeId);
if (employeeBalance == null) {
// 如果没有记录,则插入新记录
EmployeeBalance newEmployeeBalance = new EmployeeBalance();
newEmployeeBalance.setEmployeeId(employeeId);
newEmployeeBalance.setOvertimeHoursBalance(difference);
employeeBalanceMapper.insertEmployeeBalance(newEmployeeBalance);
} else {
// 如果已有记录,则更新记录
employeeBalanceMapper.updateEmployeeBalance(employeeId, difference);
}
}
...@@ -81,6 +124,24 @@ public class OvertimeApplicationServiceImpl implements IOvertimeApplicationServi ...@@ -81,6 +124,24 @@ public class OvertimeApplicationServiceImpl implements IOvertimeApplicationServi
@Override @Override
public int updateOvertimeApplication(OvertimeApplication overtimeApplication) public int updateOvertimeApplication(OvertimeApplication overtimeApplication)
{ {
System.out.println("我是修改的加班申请数据"+ overtimeApplication );
// 获取原始加班申请记录
OvertimeApplication originalApplication = selectOvertimeApplicationById(overtimeApplication.getId());
System.out.println("我是原始的加班申请数据" + originalApplication );
if (originalApplication == null) {
throw new RuntimeException("加班申请记录不存在,ID: " + overtimeApplication.getId());
}
// 计算加班时长的变化
BigDecimal originalOvertimeHours = new BigDecimal(originalApplication.getOvertimeHours());
BigDecimal newOvertimeHours = new BigDecimal(overtimeApplication.getOvertimeHours());
BigDecimal difference = newOvertimeHours.subtract(originalOvertimeHours);
// 更新员工余额
updateEmployeeBalance(originalApplication.getEmployeeId(), difference);
// 更新加班申请记录
return overtimeApplicationMapper.updateOvertimeApplication(overtimeApplication); return overtimeApplicationMapper.updateOvertimeApplication(overtimeApplication);
} }
...@@ -109,6 +170,12 @@ public class OvertimeApplicationServiceImpl implements IOvertimeApplicationServi ...@@ -109,6 +170,12 @@ public class OvertimeApplicationServiceImpl implements IOvertimeApplicationServi
} }
/**
* 批量新增加班申请
*
* @param batchRequest 加班申请
* @return 结果
*/
@Override @Override
public int insertOvertimeApplicationBatch(OvertimeApplicationBatchDTO batchRequest) public int insertOvertimeApplicationBatch(OvertimeApplicationBatchDTO batchRequest)
{ {
...@@ -123,16 +190,22 @@ public class OvertimeApplicationServiceImpl implements IOvertimeApplicationServi ...@@ -123,16 +190,22 @@ public class OvertimeApplicationServiceImpl implements IOvertimeApplicationServi
// 公共字段 // 公共字段
entity.setProject(batchRequest.getProject()); entity.setProject(batchRequest.getProject());
entity.setDivisionLeader(batchRequest.getDivisionLeader()); entity.setDivisionLeader(batchRequest.getDivisionLeader());
entity.setProjectLeader(batchRequest.getProjectLeader());
// 单条记录字段 // 单条记录字段
long userId = overtimeApplicationMapper.getUserIdByNickName(detail.getUname());
entity.setEmployeeId(userId);
entity.setUname(detail.getUname()); entity.setUname(detail.getUname());
entity.setOvertimeHours(detail.getOvertimeHours()); entity.setOvertimeHours(detail.getOvertimeHours());
entity.setRequestDate(detail.getRequestDate()); entity.setRequestDate(detail.getRequestDate());
// 设置归属月份为上个月的月份 // 设置归属月份为上个月的月份
entity.setYearMonth(yearMonth); entity.setYearMonth(yearMonth);
// 生成加班单号 // 生成加班单号
entity.setOvertimeId(generateLeaveId()); entity.setOvertimeId(generateLeaveId());
// 其他字段,如 createdTime, updatedTime 等 // 其他字段,如 createdTime, updatedTime 等
entity.setCreatedTime(new Date()); entity.setCreatedTime(new Date());
// 更新或插入员工余额
updateOrInsertEmployeeBalance(userId, new BigDecimal(detail.getOvertimeHours()));
list.add(entity); list.add(entity);
} }
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.mapper.EmployeeBalanceMapper">
<select id="selectEmployeeBalanceByEmployeeId" resultType="com.ruoyi.domain.EmployeeBalance">
SELECT id, employee_id, annual_leave_balance, overtime_hours_balance, created_at, updated_at
FROM employee_balance
WHERE employee_id = #{employeeId}
</select>
<insert id="insertEmployeeBalance">
INSERT INTO employee_balance (employee_id, overtime_hours_balance)
VALUES (#{employeeId}, #{overtimeHoursBalance})
</insert>
<update id="updateEmployeeBalance">
UPDATE employee_balance
SET overtime_hours_balance = overtime_hours_balance + #{overtimeHoursBalance}
WHERE employee_id = #{employeeId}
</update>
</mapper>
...@@ -7,27 +7,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -7,27 +7,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="LeaveApplication" id="LeaveApplicationResult"> <resultMap type="LeaveApplication" id="LeaveApplicationResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="leaveId" column="leave_id" /> <result property="leaveId" column="leave_id" />
<result property="userId" column="user_id" />
<result property="requestDate" column="request_date" /> <result property="requestDate" column="request_date" />
<result property="leaveType" column="leave_type" /> <result property="leaveType" column="leave_type" />
<result property="uname" column="uname" /> <result property="uname" column="uname" />
<result property="firstApprover" column="first_approver"/> <result property="firstApprover" column="first_approver"/>
<result property="secondApprover" column="second_approver"/> <result property="secondApprover" column="second_approver"/>
<result property="department" column="department" />
<result property="startTime" column="start_time" /> <result property="startTime" column="start_time" />
<result property="endTime" column="end_time" /> <result property="endTime" column="end_time" />
<result property="scope" column="scope" />
<result property="leavetimeHours" column="leavetime_hours" /> <result property="leavetimeHours" column="leavetime_hours" />
<result property="deductionOvertimeHours" column="deduction_overtime_hours" />
<result property="leaveDaysSubtotal" column="leave_days_subtotal" /> <result property="leaveDaysSubtotal" column="leave_days_subtotal" />
<result property="totalLeaveDays" column="total_leave_days" /> <result property="totalLeaveDays" column="total_leave_days" />
<result property="reason" column="reason" /> <result property="reason" column="reason" />
<result property="proof" column="proof" /> <result property="proof" column="proof"/>
<result property="approvalStatus" column="approval_status" />
<result property="createdTime" column="created_time" /> <result property="createdTime" column="created_time" />
<result property="updatedTime" column="updated_time" /> <result property="updatedTime" column="updated_time" />
</resultMap> </resultMap>
<sql id="selectLeaveApplicationVo"> <sql id="selectLeaveApplicationVo">
select id, leave_id, request_date, leave_type, uname,first_approver, second_approver, start_time, end_time, leavetime_hours, leave_days_subtotal, total_leave_days, reason, proof, created_time, updated_time from leave_application select id, leave_id,user_id, request_date, leave_type, uname,first_approver, second_approver, start_time, end_time, leavetime_hours,deduction_overtime_hours, leave_days_subtotal, total_leave_days, reason, proof,approval_status, created_time, updated_time from leave_application
</sql> </sql>
<select id="selectLeaveApplicationList" parameterType="LeaveApplication" resultMap="LeaveApplicationResult"> <select id="selectLeaveApplicationList" parameterType="LeaveApplication" resultMap="LeaveApplicationResult">
...@@ -35,18 +36,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -35,18 +36,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
<if test="id != null "> and id = #{id}</if> <if test="id != null "> and id = #{id}</if>
<if test="leaveId != null and leaveId != ''"> and leave_id = #{leaveId}</if> <if test="leaveId != null and leaveId != ''"> and leave_id = #{leaveId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="requestDate != null "> and request_date = #{requestDate}</if> <if test="requestDate != null "> and request_date = #{requestDate}</if>
<if test="leaveType != null and leaveType != ''"> and leave_type = #{leaveType}</if> <if test="leaveType != null and leaveType != ''"> and leave_type = #{leaveType}</if>
<if test="uname != null and uname != ''"> and uname like concat('%', #{uname}, '%')</if> <if test="uname != null and uname != ''"> and uname like concat('%', #{uname}, '%')</if>
<if test="startTime != null "> and start_time = #{startTime}</if> <if test="startTime != null "> and start_time = #{startTime}</if>
<if test="endTime != null "> and end_time = #{endTime}</if> <if test="endTime != null "> and end_time = #{endTime}</if>
<if test="leavetimeHours != null "> and leavetime_hours = #{leavetimeHours}</if> <if test="leavetimeHours != null "> and leavetime_hours = #{leavetimeHours}</if>
<if test="deductionOvertimeHours != null "> and deduction_overtime_hours = #{deductionOvertimeHours}</if>
<if test="leaveDaysSubtotal != null "> and leave_days_subtotal = #{leaveDaysSubtotal}</if> <if test="leaveDaysSubtotal != null "> and leave_days_subtotal = #{leaveDaysSubtotal}</if>
<if test="totalLeaveDays != null "> and total_leave_days = #{totalLeaveDays}</if> <if test="totalLeaveDays != null "> and total_leave_days = #{totalLeaveDays}</if>
<if test="reason != null and reason != ''"> and reason = #{reason}</if> <if test="reason != null and reason != ''"> and reason = #{reason}</if>
<if test="proof != null and proof != ''"> and proof = #{proof}</if> <if test="proof != null and proof != ''"> and proof = #{proof}</if>
<if test="firstApprover != null and firstApprover != ''"> and first_approver = #{firstApprover}</if> <if test="firstApprover != null and firstApprover != ''"> and first_approver = #{firstApprover}</if>
<if test="secondApprover != null and secondApprover != ''"> and second_approver = #{secondApprover}</if> <if test="secondApprover != null and secondApprover != ''"> and second_approver = #{secondApprover}</if>
<if test="approvalStatus != null and approvalStatus != ''"> and approval_status = #{approvalStatus}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if> <if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if> <if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
</where> </where>
...@@ -62,41 +66,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -62,41 +66,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into leave_application insert into leave_application
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="leaveId != null">leave_id,</if> <if test="leaveId != null">leave_id,</if>
<if test="userId != null">user_id,</if>
<if test="requestDate != null">request_date,</if> <if test="requestDate != null">request_date,</if>
<if test="leaveType != null and leaveType != ''">leave_type,</if> <if test="leaveType != null and leaveType != ''">leave_type,</if>
<if test="uname != null">uname,</if> <if test="uname != null">uname,</if>
<if test="firstApprover != null">first_approver,</if> <if test="firstApprover != null">first_approver,</if>
<if test="secondApprover != null">second_approver,</if> <if test="secondApprover != null">second_approver,</if>
<if test="department != null">department,</if>
<if test="startTime != null">start_time,</if> <if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if> <if test="endTime != null">end_time,</if>
<if test="scope != null">scope,</if>
<if test="leavetimeHours != null">leavetime_hours,</if> <if test="leavetimeHours != null">leavetime_hours,</if>
<if test="deductionOvertimeHours != null">deduction_overtime_hours,</if>
<if test="leaveDaysSubtotal != null">leave_days_subtotal,</if> <if test="leaveDaysSubtotal != null">leave_days_subtotal,</if>
<if test="totalLeaveDays != null">total_leave_days,</if> <if test="totalLeaveDays != null">total_leave_days,</if>
<if test="reason != null and reason != ''">reason,</if> <if test="reason != null and reason != ''">reason,</if>
<if test="proof != null">proof,</if> <if test="proof != null">proof,</if>
<if test="status != null">status,</if> <if test="approvalStatus != null">approval_status,</if>
<if test="createdTime != null">created_time,</if> <if test="createdTime != null">created_time,</if>
<if test="updatedTime != null">updated_time,</if> <if test="updatedTime != null">updated_time,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="leaveId != null">#{leaveId},</if> <if test="leaveId != null">#{leaveId},</if>
<if test="userId != null">#{userId},</if>
<if test="requestDate != null">#{requestDate},</if> <if test="requestDate != null">#{requestDate},</if>
<if test="leaveType != null and leaveType != ''">#{leaveType},</if> <if test="leaveType != null and leaveType != ''">#{leaveType},</if>
<if test="uname != null">#{uname},</if> <if test="uname != null">#{uname},</if>
<if test="firstApprover != null">#{firstApprover},</if> <if test="firstApprover != null">#{firstApprover},</if>
<if test="secondApprover != null">#{secondApprover},</if> <if test="secondApprover != null">#{secondApprover},</if>
<if test="department != null">#{department},</if>
<if test="startTime != null">#{startTime},</if> <if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if> <if test="endTime != null">#{endTime},</if>
<if test="scope != null">#{scope},</if>
<if test="leavetimeHours != null">#{leavetimeHours},</if> <if test="leavetimeHours != null">#{leavetimeHours},</if>
<if test="deductionOvertimeHours != null">#{deductionOvertimeHours},</if>
<if test="leaveDaysSubtotal != null">#{leaveDaysSubtotal},</if> <if test="leaveDaysSubtotal != null">#{leaveDaysSubtotal},</if>
<if test="totalLeaveDays != null">#{totalLeaveDays},</if> <if test="totalLeaveDays != null">#{totalLeaveDays},</if>
<if test="reason != null and reason != ''">#{reason},</if> <if test="reason != null and reason != ''">#{reason},</if>
<if test="proof != null">#{proof},</if> <if test="proof != null">#{proof},</if>
<if test="status != null">#{status},</if> <if test="approvalStatus != null">#{approvalStatus},</if>
<if test="createdTime != null">#{createdTime},</if> <if test="createdTime != null">#{createdTime},</if>
<if test="updatedTime != null">#{updatedTime},</if> <if test="updatedTime != null">#{updatedTime},</if>
</trim> </trim>
...@@ -106,20 +110,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -106,20 +110,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update leave_application update leave_application
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="leaveId != null">leave_id = #{leaveId},</if> <if test="leaveId != null">leave_id = #{leaveId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="requestDate != null">request_date = #{requestDate},</if> <if test="requestDate != null">request_date = #{requestDate},</if>
<if test="leaveType != null and leaveType != ''">leave_type = #{leaveType},</if> <if test="leaveType != null and leaveType != ''">leave_type = #{leaveType},</if>
<if test="uname != null">uname = #{uname},</if> <if test="uname != null">uname = #{uname},</if>
<if test="firstApprover != null">first_approver = #{firstApprover},</if> <if test="firstApprover != null">first_approver = #{firstApprover},</if>
<if test="secondApprover != null">second_approver = #{secondApprover},</if> <if test="secondApprover != null">second_approver = #{secondApprover},</if>
<if test="department != null">department = #{department},</if>
<if test="startTime != null">start_time = #{startTime},</if> <if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if> <if test="endTime != null">end_time = #{endTime},</if>
<if test="scope != null">scope = #{scope},</if>
<if test="leavetimeHours != null">leavetime_hours = #{leavetimeHours},</if> <if test="leavetimeHours != null">leavetime_hours = #{leavetimeHours},</if>
<if test="deductionOvertimeHours != null">deduction_overtime_hours = #{deductionOvertimeHours},</if>
<if test="leaveDaysSubtotal != null">leave_days_subtotal = #{leaveDaysSubtotal},</if> <if test="leaveDaysSubtotal != null">leave_days_subtotal = #{leaveDaysSubtotal},</if>
<if test="totalLeaveDays != null">total_leave_days = #{totalLeaveDays},</if> <if test="totalLeaveDays != null">total_leave_days = #{totalLeaveDays},</if>
<if test="reason != null and reason != ''">reason = #{reason},</if> <if test="reason != null and reason != ''">reason = #{reason},</if>
<if test="proof != null">proof = #{proof},</if> <if test="proof != null">proof = #{proof},</if>
<if test="approvalStatus != null">approval_status = #{approvalStatus},</if>
<if test="createdTime != null">created_time = #{createdTime},</if> <if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if> <if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim> </trim>
...@@ -136,4 +141,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -136,4 +141,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="selectDeductionOvertimeHoursByUserId" parameterType="Long" resultType="com.ruoyi.domain.dto.EmployeeBalanceDTO">
SELECT
overtime_hours_balance AS overtimeHoursBalance,
annual_leave_balance AS annualLeaveBalance
FROM employee_balance
WHERE employee_id = #{userId}
</select>
<update id="updateOvertimeHoursBalance" parameterType="com.ruoyi.domain.dto.EmployeeBalanceDTO">
UPDATE employee_balance
<trim prefix="SET" suffixOverrides=",">
<if test="overtimeHoursBalance != null">
overtime_hours_balance = #{overtimeHoursBalance},
</if>
<if test="annualLeaveBalance != null">
annual_leave_balance = #{annualLeaveBalance},
</if>
</trim>
WHERE employee_id = #{employeeId}
</update>
<select id="selectProjectManagers" resultType="String">
SELECT su.nick_name
FROM sys_user su
JOIN sys_user_role sur ON su.user_id = sur.user_id
WHERE sur.role_id = 100;
</select>
<select id="selectGeneralManagerNickName" resultType="String">
SELECT su.nick_name
FROM sys_user su
JOIN sys_user_role sur ON su.user_id = sur.user_id
WHERE sur.role_id = 102;
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -7,11 +7,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -7,11 +7,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="OvertimeApplication" id="OvertimeApplicationResult"> <resultMap type="OvertimeApplication" id="OvertimeApplicationResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="overtimeId" column="overtime_id" /> <result property="overtimeId" column="overtime_id" />
<result property="employeeId" column="employee_id" />
<result property="uname" column="uname" /> <result property="uname" column="uname" />
<result property="requestDate" column="request_date" /> <result property="requestDate" column="request_date" />
<result property="yearMonth" column="year_month" /> <result property="yearMonth" column="year_month" />
<result property="overtimeHours" column="overtime_hours" /> <result property="overtimeHours" column="overtime_hours" />
<result property="totalOvertimeDays" column="total_overtime_days" /> <result property="totalOvertimeHours" column="total_overtime_hours" />
<result property="project" column="project" /> <result property="project" column="project" />
<result property="projectLeader" column="project_leader" /> <result property="projectLeader" column="project_leader" />
<result property="divisionLeader" column="division_leader" /> <result property="divisionLeader" column="division_leader" />
...@@ -20,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -20,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectOvertimeApplicationVo"> <sql id="selectOvertimeApplicationVo">
select id, overtime_id, uname, request_date, `year_month`, overtime_hours, total_overtime_days, project, project_leader, division_leader, created_time, updated_time from overtime_application select id, overtime_id,employee_id, uname, request_date, `year_month`, overtime_hours,total_overtime_hours, project, project_leader, division_leader, created_time, updated_time from overtime_application
</sql> </sql>
<select id="selectOvertimeApplicationList" parameterType="OvertimeApplication" resultMap="OvertimeApplicationResult"> <select id="selectOvertimeApplicationList" parameterType="OvertimeApplication" resultMap="OvertimeApplicationResult">
...@@ -44,24 +45,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -44,24 +45,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into overtime_application insert into overtime_application
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="overtimeId != null and overtimeId != ''">overtime_id,</if> <if test="overtimeId != null and overtimeId != ''">overtime_id,</if>
<if test="employeeId != null and employeeId != ''">employee_id,</if>
<if test="uname != null and uname != ''">uname,</if> <if test="uname != null and uname != ''">uname,</if>
<if test="requestDate != null">request_date,</if> <if test="requestDate != null">request_date,</if>
<if test="yearMonth != null">`year_month`,</if> <if test="yearMonth != null">`year_month`,</if>
<if test="overtimeHours != null">overtime_hours,</if> <if test="overtimeHours != null">overtime_hours,</if>
<if test="totalOvertimeHours != null">total_overtime_hours,</if>
<if test="project != null">project,</if> <if test="project != null">project,</if>
<if test="projectLeader != null">project_leader,</if> <if test="projectLeader != null">project_leader,</if>
<if test="divisionLeader != null">division_leader,</if> <if test="divisionLeader != null">division_leader,</if>
<if test="totalOvertimeDays != null">total_overtime_days,</if>
<if test="createdTime != null">created_time,</if> <if test="createdTime != null">created_time,</if>
<if test="updatedTime != null">updated_time,</if> <if test="updatedTime != null">updated_time,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="overtimeId != null and overtimeId != ''">#{overtimeId},</if> <if test="overtimeId != null and overtimeId != ''">#{overtimeId},</if>
<if test="employeeId != null and employeeId != ''">#{employeeId},</if>
<if test="uname != null and uname != ''">#{uname},</if> <if test="uname != null and uname != ''">#{uname},</if>
<if test="requestDate != null">#{requestDate},</if> <if test="requestDate != null">#{requestDate},</if>
<if test="yearMonth != null">#{yearMonth},</if> <if test="yearMonth != null">#{yearMonth},</if>
<if test="overtimeHours != null">#{overtimeHours},</if> <if test="overtimeHours != null">#{overtimeHours},</if>
<if test="totalOvertimeHours != null">#{totalOvertimeHours},</if>
<if test="project != null">#{project},</if> <if test="project != null">#{project},</if>
<if test="projectLeader != null">#{projectLeader},</if> <if test="projectLeader != null">#{projectLeader},</if>
<if test="divisionLeader != null">#{divisionLeader},</if> <if test="divisionLeader != null">#{divisionLeader},</if>
...@@ -74,10 +78,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -74,10 +78,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update overtime_application update overtime_application
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="overtimeId != null and overtimeId != ''">overtime_id = #{overtimeId},</if> <if test="overtimeId != null and overtimeId != ''">overtime_id = #{overtimeId},</if>
<if test="employeeId != null and employeeId != ''">employee_id = #{employeeId},</if>
<if test="uname != null and uname != ''">uname = #{uname},</if> <if test="uname != null and uname != ''">uname = #{uname},</if>
<if test="requestDate != null">request_date = #{requestDate},</if> <if test="requestDate != null">request_date = #{requestDate},</if>
<if test="yearMonth != null">`year_month` = #{yearMonth},</if> <if test="yearMonth != null">`year_month` = #{yearMonth},</if>
<if test="overtimeHours != null">overtime_hours = #{overtimeHours},</if> <if test="overtimeHours != null">overtime_hours = #{overtimeHours},</if>
<if test="totalOvertimeHours != null">total_overtime_hours = #{totalOvertimeHours},</if>
<if test="project != null">project = #{project},</if> <if test="project != null">project = #{project},</if>
<if test="projectLeader != null">project_leader = #{projectLeader},</if> <if test="projectLeader != null">project_leader = #{projectLeader},</if>
<if test="divisionLeader != null">division_leader = #{divisionLeader},</if> <if test="divisionLeader != null">division_leader = #{divisionLeader},</if>
...@@ -97,4 +103,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -97,4 +103,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="getUserIdByNickName" resultType="java.lang.Long">
SELECT user_id
FROM sys_user
WHERE nick_name = #{nickName}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
sys_user su1 ON pm.department_leader_id = su1.user_id sys_user su1 ON pm.department_leader_id = su1.user_id
JOIN JOIN
sys_user su2 ON pm.project_manager_id = su2.user_id sys_user su2 ON pm.project_manager_id = su2.user_id
JOIN LEFT JOIN
sys_user_project sup ON pm.id = sup.project_id sys_user_project sup ON pm.id = sup.project_id
JOIN LEFT JOIN
sys_user su3 ON sup.user_id = su3.user_id sys_user su3 ON sup.user_id = su3.user_id
WHERE WHERE
su2.nick_name = #{projectManagerNickName} su2.nick_name = #{projectManagerNickName}
......
...@@ -110,7 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -110,7 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND p.id = r2.project_id AND p.id = r2.project_id
</select> </select>
<select id="getItemList" parameterType="Long" resultType="com.ruoyi.domain.dto.FyglDailyReimbursementTableItemDTO"> <select id="getItemList" resultType="com.ruoyi.domain.dto.FyglDailyReimbursementTableItemDTO">
SELECT SELECT
r.id, r.id,
r.registration_time as registrationTime, r.registration_time as registrationTime,
...@@ -123,7 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -123,7 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
fygl_daily_rembursement_relevancy_r r fygl_daily_rembursement_relevancy_r r
LEFT JOIN fygl_daily_reimbursement_relevancy re ON re.rid = r.id LEFT JOIN fygl_daily_reimbursement_relevancy re ON re.rid = r.id
<where> <where>
r.did = #{id} r.project_id= #{projectId}
<if test="status != null and status != ''"> and r.status = #{status}</if> <if test="status != null and status != ''"> and r.status = #{status}</if>
<if test="reimbursement != null and reimbursement != ''">and r.reimbursement = #{reimbursement}</if> <if test="reimbursement != null and reimbursement != ''">and r.reimbursement = #{reimbursement}</if>
</where> </where>
...@@ -157,6 +157,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -157,6 +157,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select p.project_number as projectNumber,p.project_status as projectStatus,p.project_type as projectType,u.user_name as userName,u2.user_name as projectManager from project_manage p,sys_user u,sys_user u2 where p.id = #{pid} and u.user_id = p.department_leader_id and u2.user_id = p.project_manager_id select p.project_number as projectNumber,p.project_status as projectStatus,p.project_type as projectType,u.user_name as userName,u2.user_name as projectManager from project_manage p,sys_user u,sys_user u2 where p.id = #{pid} and u.user_id = p.department_leader_id and u2.user_id = p.project_manager_id
</select> </select>
<select id="getProjectListByUserId" resultMap="FyglDailyReimbursementDTOResult">
SELECT
p.id as projectId,
p.project_name,
p.start_date,
p.end_date,
u1.nick_name AS department_leader_name,
u2.nick_name AS project_manager_name
FROM
project_manage p
LEFT JOIN sys_user u1 ON u1.user_id = p.department_leader_id
LEFT JOIN sys_user u2 ON u2.user_id = p.project_manager_id
where p.id in (select project_id from project_member where user_id = #{id})
</select>
<insert id="insertFyglDailyReimbursement" parameterType="com.ruoyi.domain.FyglDailyReimbursement" useGeneratedKeys="true" keyProperty="did"> <insert id="insertFyglDailyReimbursement" parameterType="com.ruoyi.domain.FyglDailyReimbursement" useGeneratedKeys="true" keyProperty="did">
insert into fygl_daily_reimbursement insert into fygl_daily_reimbursement
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
...@@ -179,7 +196,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -179,7 +196,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertFyglDailyReimbursement2" parameterType="com.ruoyi.domain.FyglDailyReimbursement" useGeneratedKeys="true" keyProperty="rid"> <insert id="insertFyglDailyReimbursement2" parameterType="com.ruoyi.domain.FyglDailyReimbursement" useGeneratedKeys="true" keyProperty="rid">
insert into fygl_daily_rembursement_relevancy_r insert into fygl_daily_rembursement_relevancy_r
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="did != null">did,</if> <if test="projectId != null">project_id,</if>
<if test="status != null">`status`,</if> <if test="status != null">`status`,</if>
<if test="accessory != null">accessory,</if> <if test="accessory != null">accessory,</if>
<if test="serialNumber != null">serial_number,</if> <if test="serialNumber != null">serial_number,</if>
...@@ -187,7 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -187,7 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="reimbursement != null">reimbursement</if> <if test="reimbursement != null">reimbursement</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="did != null">#{did},</if> <if test="projectId != null">#{projectId},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="accessory != null">#{accessory},</if> <if test="accessory != null">#{accessory},</if>
<if test="serialNumber != null">#{serialNumber},</if> <if test="serialNumber != null">#{serialNumber},</if>
......
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