Merge branch 'master' of http://192.168.1.110:5678/r/pms-upgrade into yaozc
4 files added
18 files modified
17 files renamed
3 files deleted
| | |
| | | // 获取当月补卡状态为未审核和已同意的补卡总条数 |
| | | @Query(value = "SELECT COUNT(*) FROM `attendance_cardreplacement` WHERE user_id = ? and card_replacement_time like %?% and approval_status in('card_approve_status_reviewed','card_approve_status_agree')",nativeQuery = true) |
| | | Integer count(Long userId, String baseDate); |
| | | |
| | | //根据userId和补卡时间查询已通过的补卡记录 |
| | | @Query(value = "SELECT * from attendance_cardreplacement WHERE user_id = ? and card_replacement_time = ? and approval_status = 'card_approve_status_agree'",nativeQuery = true) |
| | | AttendanceCardreplacement findByUserIdAndTime(Long userId, Timestamp checkTime); |
| | | } |
| | |
| | | for(SysConfigHoliday sysConfigHoliday : sysConfigHolidayList){ |
| | | if(sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_WEEKDAY)){ |
| | | //工作日 |
| | | isWork.add(sysConfigHoliday.getHolidayDate().toString()); |
| | | isWork.add(sysConfigHoliday.getHolidayDate().toString().substring(0,10)); |
| | | }else{ |
| | | holiday.add(sysConfigHoliday.getHolidayDate().toString()); |
| | | holiday.add(sysConfigHoliday.getHolidayDate().toString().substring(0,10)); |
| | | } |
| | | } |
| | | // 循环添加开始时间到结束时间的每一天 |
| | |
| | | for(SysConfigHoliday sysConfigHoliday : sysConfigHolidayList){ |
| | | if(sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_WEEKDAY)){ |
| | | //工作日 |
| | | isWork.add(sysConfigHoliday.getHolidayDate().toString()); |
| | | isWork.add(sysConfigHoliday.getHolidayDate().toString().substring(0,10)); |
| | | }else{ |
| | | holiday.add(sysConfigHoliday.getHolidayDate().toString()); |
| | | holiday.add(sysConfigHoliday.getHolidayDate().toString().substring(0,10)); |
| | | } |
| | | } |
| | | // 循环添加开始时间到结束时间的每一天 |
| | |
| | | for(SysConfigHoliday sysConfigHoliday : sysConfigHolidayList){ |
| | | if(sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_WEEKDAY)){ |
| | | //工作日 |
| | | isWork.add(sysConfigHoliday.getHolidayDate().toString()); |
| | | isWork.add(sysConfigHoliday.getHolidayDate().toString().substring(0,10)); |
| | | }else{ |
| | | holiday.add(sysConfigHoliday.getHolidayDate().toString()); |
| | | holiday.add(sysConfigHoliday.getHolidayDate().toString().substring(0,10)); |
| | | } |
| | | } |
| | | // 循环添加开始时间到结束时间的每一天 |
| | |
| | | for(SysConfigHoliday sysConfigHoliday : sysConfigHolidayList){ |
| | | if(sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_WEEKDAY)){ |
| | | //工作日 |
| | | isWork.add(sysConfigHoliday.getHolidayDate().toString()); |
| | | isWork.add(sysConfigHoliday.getHolidayDate().toString().substring(0,10)); |
| | | }else{ |
| | | holiday.add(sysConfigHoliday.getHolidayDate().toString()); |
| | | holiday.add(sysConfigHoliday.getHolidayDate().toString().substring(0,10)); |
| | | } |
| | | } |
| | | // 循环添加开始时间到结束时间的每一天 |
| | |
| | | for(SysConfigHoliday sysConfigHoliday : sysConfigHolidayList){ |
| | | if(sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_WEEKDAY)){ |
| | | //工作日 |
| | | isWork.add(sysConfigHoliday.getHolidayDate().toString()); |
| | | isWork.add(sysConfigHoliday.getHolidayDate().toString().substring(0,10)); |
| | | }else{ |
| | | holiday.add(sysConfigHoliday.getHolidayDate().toString()); |
| | | holiday.add(sysConfigHoliday.getHolidayDate().toString().substring(0,10)); |
| | | } |
| | | } |
| | | // 循环添加开始时间到结束时间的每一天 |
| | |
| | | for(SysConfigHoliday sysConfigHoliday : sysConfigHolidayList){ |
| | | if(sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_WEEKDAY)){ |
| | | //工作日 |
| | | isWork.add(sysConfigHoliday.getHolidayDate().toString()); |
| | | isWork.add(sysConfigHoliday.getHolidayDate().toString().substring(0,10)); |
| | | }else{ |
| | | holiday.add(sysConfigHoliday.getHolidayDate().toString()); |
| | | holiday.add(sysConfigHoliday.getHolidayDate().toString().substring(0,10)); |
| | | } |
| | | } |
| | | // 循环添加开始时间到结束时间的每一天 |
| | |
| | | for(SysConfigHoliday sysConfigHoliday : sysConfigHolidayList){ |
| | | if(sysConfigHoliday.getDateType().equals(Constant.DATE_TYPE_WEEKDAY)){ |
| | | //工作日 |
| | | isWork.add(sysConfigHoliday.getHolidayDate().toString()); |
| | | isWork.add(sysConfigHoliday.getHolidayDate().toString().substring(0,10)); |
| | | }else{ |
| | | holiday.add(sysConfigHoliday.getHolidayDate().toString()); |
| | | holiday.add(sysConfigHoliday.getHolidayDate().toString().substring(0,10)); |
| | | } |
| | | } |
| | | Long chronoUnit = ChronoUnit.DAYS.between(calculate.getStart().toLocalDate(), calculate.getEnd().toLocalDate()); |
| | |
| | | /** 任务合计 */ |
| | | private Double totalTaskTime; |
| | | |
| | | /** 任务合计(实际) */ |
| | | private Double actualTaskTime; |
| | | |
| | | /** 成本合计 */ |
| | | private BigDecimal totalLaborCost; |
| | | |
| | | /** 成本合计(实际) */ |
| | | private BigDecimal actualLaborCost; |
| | | |
| | | /** 责任人ID */ |
| | | private Long liableUserId; |
| | | |
| | |
| | | package me.zhengjie.modules.project.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.Map.Entry; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import me.zhengjie.modules.project.service.ProjectCostService; |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import me.zhengjie.modules.task.domain.TaskInterface; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private final ProjectCostRepository projectCostRepository; |
| | | private final TaskRepository taskRepository; |
| | | private final TaskDaliyRepository taskDaliyRepository; |
| | | private final ProjectCostService projectCostService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectQueryCriteria criteria, Pageable pageable) { |
| | |
| | | // 负责人名称 |
| | | projectDto.setLiableUserName(user.getNickName()); |
| | | } |
| | | |
| | | ProjectTaskSummary projectTaskSummary = projectTaskRepository.findSummaryByProjectId(project.getId()); |
| | | projectDto.setTaskStartDate(projectTaskSummary.getTaskStartDate()); |
| | | projectDto.setTaskEndDate(projectTaskSummary.getTaskEndDate()); |
| | |
| | | ProjectCostSummary projectCostSummary = projectCostRepository.findSummaryByProjectId(project.getId()); |
| | | projectDto.setTotalLaborCost(projectCostSummary.getTotalLaborCost()); |
| | | |
| | | // 查询项目的任务数据 |
| | | TaskInterface taskInterface = taskRepository.collectByProjectId(project.getId()); |
| | | projectDto.setActualTaskTime(taskInterface.getPlanHours()); |
| | | |
| | | // 根据日期和项目ID取得日报信息 |
| | | List<TaskDailyInterface> taskDailyInterfaceList = taskDaliyRepository.collectByProjectIdGroupByUserIdAndFillDate(project.getId()); |
| | | Map<Long, List<TaskDailyInterface>> collectMap = taskDailyInterfaceList.stream().collect(Collectors.groupingBy(TaskDailyInterface::getUserId)); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // 实际消耗成本 |
| | | BigDecimal actualCost = BigDecimal.valueOf(0.0); |
| | | for (Entry<Long, List<TaskDailyInterface>> entry : collectMap.entrySet()) { |
| | | List<TaskDailyInterface> taskDaliyListSub = entry.getValue(); |
| | | // 最小日期 |
| | | TaskDailyInterface taskDaliyFirst = taskDaliyListSub.stream().min(Comparator.comparing(taskDaliy -> taskDaliy.getFillDate())).get(); |
| | | // 最大日期 |
| | | TaskDailyInterface taskDaliyLast = taskDaliyListSub.stream().max(Comparator.comparing(taskDaliy -> taskDaliy.getFillDate())).get(); |
| | | Map<String, Double> costHourMap = new HashMap<String, Double>(); |
| | | taskDaliyListSub.forEach(taskDaliy -> { |
| | | costHourMap.put(sdf.format(taskDaliy.getFillDate()), taskDaliy.getConsumedHours()); |
| | | }); |
| | | // 根据员工成本单金算出当前工作的成本 |
| | | actualCost = actualCost.add(projectCostService.calcUserCostByDate(entry.getKey(), new Timestamp(taskDaliyFirst.getFillDate().getTime()), new Timestamp(taskDaliyLast.getFillDate().getTime()), costHourMap)); |
| | | } |
| | | // 实际消耗成本 |
| | | projectDto.setActualLaborCost(actualCost); |
| | | |
| | | // 返回处理好的Dto |
| | | return projectDto; |
| | | } |
| | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.attendance.domain.Attendance; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceBusinessTravel; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceGoOut; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceLeave; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceBusinessTravelRepository; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceGoOutRepository; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceLeaveRepository; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceRepository; |
| | | import me.zhengjie.modules.attendance.domain.*; |
| | | import me.zhengjie.modules.attendance.repository.*; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.quartz.service.dto.OapiDingTalkAccessToken; |
| | |
| | | private final AttendanceLeaveRepository attendanceLeaveRepository; |
| | | |
| | | private final SysRosteringRepository sysRosteringRepository; |
| | | |
| | | private final AttendanceCardreplacementRepository attendanceCardreplacementRepository; |
| | | |
| | | /** |
| | | * 凌晨0点执行,新增用户考勤信息 |
| | |
| | | // 考勤记录 |
| | | attendance.setUserId(user.getId()); |
| | | attendance.setAttendanceDate(Timestamp.valueOf(ObjectUtils.isEmpty(attendDate) ? strTodayDate + " 00:00:00" : strAttendDate + " 00:00:00")); |
| | | attendance.setStartClockResults(Constant.ATTENDANCE_STATE_WAITFOR); |
| | | attendance.setEndClockResults(Constant.ATTENDANCE_STATE_WAITFOR); |
| | | attendance.setStartClockResults((ObjectUtil.isNotEmpty(attendance.getStartClockResults()) && attendance.getStartClockResults().equals(Constant.ATTENDANCE_STATE_NORMAL)) ? attendance.getStartClockResults() : Constant.ATTENDANCE_STATE_WAITFOR); |
| | | attendance.setEndClockResults((ObjectUtil.isNotEmpty(attendance.getEndClockResults()) && attendance.getEndClockResults().equals(Constant.ATTENDANCE_STATE_NORMAL)) ? attendance.getEndClockResults() : Constant.ATTENDANCE_STATE_WAITFOR); |
| | | // 考勤日期类是否是周末、节假日、工作日 |
| | | if (sysConfigHoliday == null && (calAttendDay.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calAttendDay.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)) { |
| | | // 考勤记录:日期类型-双休 |
| | |
| | | } |
| | | // 早打卡 |
| | | if ("OnDuty".equals(oapiDingTalkRecordResult.getCheckType())) { |
| | | // 调用验证状态方法 |
| | | Boolean flag = getCardSupplement(attendance.getUserId(),attendance.getStartClockResults(),attendance.getActualWorkStartTime()); |
| | | // 考勤记录 |
| | | attendance.setStartClockResults(ObjectUtil.isEmpty(oapiDingTalkRecordResult.getUserCheckTime()) ? Constant.ATTENDANCE_STATE_NOTSIGNED : checkResult(user.getSysRostering(), oapiDingTalkRecordResult.getUserCheckTime(), 1)); |
| | | attendance.setStartLocationResults(setLocationResults(oapiDingTalkRecordResult.getLocationResult())); |
| | | attendance.setActualWorkStartTime(oapiDingTalkRecordResult.getUserCheckTime()); |
| | | attendance.setStartClockResults(flag == true ? attendance.getStartClockResults() : (ObjectUtil.isEmpty(oapiDingTalkRecordResult.getUserCheckTime()) ? Constant.ATTENDANCE_STATE_NOTSIGNED : checkResult(user.getSysRostering(), oapiDingTalkRecordResult.getUserCheckTime(), 1))); |
| | | attendance.setStartLocationResults(flag == true ? attendance.getStartLocationResults() : setLocationResults(oapiDingTalkRecordResult.getLocationResult())); |
| | | attendance.setActualWorkStartTime(flag == true ? attendance.getActualWorkStartTime() : oapiDingTalkRecordResult.getUserCheckTime()); |
| | | } |
| | | // 晚打卡 |
| | | if ("OffDuty".equals(oapiDingTalkRecordResult.getCheckType())) { |
| | | // 调用验证状态方法 |
| | | Boolean flag = getCardSupplement(attendance.getUserId(),attendance.getEndClockResults(),attendance.getActualWorkEndTime()); |
| | | // 考勤记录 |
| | | attendance.setEndClockResults(ObjectUtil.isEmpty(oapiDingTalkRecordResult.getUserCheckTime()) ? Constant.ATTENDANCE_STATE_NOTSIGNED : checkResult(user.getSysRostering(), oapiDingTalkRecordResult.getUserCheckTime(), 2)); |
| | | attendance.setEndLocationResults(setLocationResults(oapiDingTalkRecordResult.getLocationResult())); |
| | | attendance.setActualWorkEndTime(oapiDingTalkRecordResult.getUserCheckTime()); |
| | | attendance.setEndClockResults(flag == true ? attendance.getEndClockResults() : (ObjectUtil.isEmpty(oapiDingTalkRecordResult.getUserCheckTime()) ? Constant.ATTENDANCE_STATE_NOTSIGNED : checkResult(user.getSysRostering(), oapiDingTalkRecordResult.getUserCheckTime(), 2))); |
| | | attendance.setEndLocationResults(flag == true ? attendance.getEndLocationResults() : setLocationResults(oapiDingTalkRecordResult.getLocationResult())); |
| | | attendance.setActualWorkEndTime(flag == true ? attendance.getActualWorkEndTime() : oapiDingTalkRecordResult.getUserCheckTime()); |
| | | } |
| | | } |
| | | // 修改考勤打卡状态 |
| | |
| | | } |
| | | // 早打卡 |
| | | if ("OnDuty".equals(oapiDingTalkRecordResult.getCheckType())) { |
| | | // 调用验证状态方法 |
| | | Boolean flag = getCardSupplement(attendance.getUserId(),attendance.getStartClockResults(),attendance.getActualWorkStartTime()); |
| | | // 考勤记录 |
| | | attendance.setStartClockResults(ObjectUtil.isEmpty(oapiDingTalkRecordResult.getUserCheckTime()) ? Constant.ATTENDANCE_STATE_NOTSIGNED : checkResult(user.getSysRostering(), oapiDingTalkRecordResult.getUserCheckTime(), 1)); |
| | | attendance.setStartLocationResults(setLocationResults(oapiDingTalkRecordResult.getLocationResult())); |
| | | attendance.setActualWorkStartTime(oapiDingTalkRecordResult.getUserCheckTime()); |
| | | attendance.setStartClockResults(flag == true ? attendance.getStartClockResults() : (ObjectUtil.isEmpty(oapiDingTalkRecordResult.getUserCheckTime()) ? Constant.ATTENDANCE_STATE_NOTSIGNED : checkResult(user.getSysRostering(), oapiDingTalkRecordResult.getUserCheckTime(), 1))); |
| | | attendance.setStartLocationResults(flag == true ? attendance.getStartLocationResults() : setLocationResults(oapiDingTalkRecordResult.getLocationResult())); |
| | | attendance.setActualWorkStartTime(flag == true ? attendance.getActualWorkStartTime() : oapiDingTalkRecordResult.getUserCheckTime()); |
| | | } |
| | | // 晚打卡 |
| | | if ("OffDuty".equals(oapiDingTalkRecordResult.getCheckType())) { |
| | | // 调用验证状态方法 |
| | | Boolean flag = getCardSupplement(attendance.getUserId(),attendance.getEndClockResults(),attendance.getActualWorkEndTime()); |
| | | // 考勤记录 |
| | | attendance.setEndClockResults(ObjectUtil.isEmpty(oapiDingTalkRecordResult.getUserCheckTime()) ? Constant.ATTENDANCE_STATE_NOTSIGNED : checkResult(user.getSysRostering(), oapiDingTalkRecordResult.getUserCheckTime(), 2)); |
| | | attendance.setEndLocationResults(setLocationResults(oapiDingTalkRecordResult.getLocationResult())); |
| | | attendance.setActualWorkEndTime(oapiDingTalkRecordResult.getUserCheckTime()); |
| | | attendance.setEndClockResults(flag == true ? attendance.getEndClockResults() : (ObjectUtil.isEmpty(oapiDingTalkRecordResult.getUserCheckTime()) ? Constant.ATTENDANCE_STATE_NOTSIGNED : checkResult(user.getSysRostering(), oapiDingTalkRecordResult.getUserCheckTime(), 2))); |
| | | attendance.setEndLocationResults(flag == true ? attendance.getEndLocationResults() : setLocationResults(oapiDingTalkRecordResult.getLocationResult())); |
| | | attendance.setActualWorkEndTime(flag == true ? attendance.getActualWorkEndTime() : oapiDingTalkRecordResult.getUserCheckTime()); |
| | | } |
| | | } |
| | | // 修改考勤打卡状态 |
| | |
| | | return duration; |
| | | } |
| | | |
| | | /** |
| | | * 验证是否有通过的补卡记录 |
| | | * @param userId |
| | | * @param st |
| | | * @param checkTime |
| | | * @return |
| | | */ |
| | | public Boolean getCardSupplement(Long userId,String st,Timestamp checkTime){ |
| | | if(ObjectUtils.isNotEmpty(checkTime)){ |
| | | // 查询补卡记录 |
| | | AttendanceCardreplacement attendanceCardreplacement = attendanceCardreplacementRepository.findByUserIdAndTime(userId,checkTime); |
| | | if(ObjectUtils.isNotEmpty(attendanceCardreplacement) && st.equals(Constant.ATTENDANCE_STATE_NORMAL)){ |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.quartz.task; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.system.domain.Role; |
| | | import me.zhengjie.modules.system.domain.SysConfigProportion; |
| | | import me.zhengjie.modules.system.domain.SysUserContract; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.SysConfigProportionRepository; |
| | | import me.zhengjie.modules.system.repository.SysUserContractRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.*; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 合同是否到期提醒 |
| | | * @author 魏传栋 |
| | | * @date 2023-01-10 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ContractMethod { |
| | | |
| | | private final SysConfigProportionRepository sysConfigProportionRepository; |
| | | private final SysUserContractRepository sysUserContractRepository; |
| | | private final UserRepository userRepository; |
| | | private final OpaiDingTalkService opaiDingTalkService; |
| | | |
| | | // 合同到期提醒 |
| | | public void contractRemind() throws Exception { |
| | | // 今天日期 |
| | | Date today = new Date(); |
| | | // 钉钉Id |
| | | List<String> dingDingList = new ArrayList<>(); |
| | | // 查询用户 |
| | | List<User> userList = userRepository.findAll(); |
| | | for(User user : userList){ |
| | | // 获取用户角色 |
| | | Role role = user.getRoles().iterator().next(); |
| | | // 高级别 |
| | | if(Long.valueOf(role.getLevel()).equals(Constant.ROLE_LEVEL_SUPER) || Long.valueOf(role.getLevel()).equals(Constant.ROLE_LEVEL_GENERAL)){ |
| | | if(ObjectUtil.isNotEmpty(user.getDingding())){ |
| | | dingDingList.add(user.getDingding()); |
| | | } |
| | | } |
| | | } |
| | | // 查询配置表的合同到期提醒数值 |
| | | SysConfigProportion sysConfigProportion = sysConfigProportionRepository.findByTitle("个人合同到期提醒"); |
| | | |
| | | // 查询合同 |
| | | List<SysUserContract> sysUserContractList = sysUserContractRepository.findAll(); |
| | | for(SysUserContract sysUserContract : sysUserContractList){ |
| | | // 当合同结束时间大于今天 |
| | | if(sysUserContract.getContractEndTime().compareTo(today) > 0){ |
| | | // 查询合同即将到期的员工 |
| | | User user1 = userRepository.findById(sysUserContract.getUserId()).orElseGet(User::new); |
| | | // date转LocalDateTime |
| | | Instant instant = today.toInstant(); |
| | | ZoneId zoneId = ZoneId.systemDefault(); |
| | | LocalDateTime todayLocalDateTime = instant.atZone(zoneId).toLocalDateTime(); |
| | | // 今天到合同结束时间的差值 |
| | | Long chronoUnit = ChronoUnit.DAYS.between(todayLocalDateTime.toLocalDate(), sysUserContract.getContractEndTime().toLocalDateTime().toLocalDate()); |
| | | Integer count = 0; |
| | | for (Integer i = 0; i <= chronoUnit; i++) { |
| | | count++; |
| | | } |
| | | // 相差天数等于配置表的数值时给高级别用户发钉钉信息 |
| | | if(Double.valueOf(count).equals(sysConfigProportion.getProportion())){ |
| | | opaiDingTalkService.sendNotice(dingDingList, "合同将到期提醒", "### 合同将到期提示 \n >" + |
| | | " \n 所属员工:" + user1.getNickName() + |
| | | " \n 合同名称: " + sysUserContract.getContractName() + |
| | | " \n 合同到期时间: " + sysUserContract.getContractEndTime().toString().substring(0,10) + |
| | | " \n 所属员工合同即将到期,请登录PMS系统查看。", "card"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SystemSetting.java |
| | |
| | | import me.zhengjie.base.BaseEntity; |
| | | |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.*; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="system_setting") |
| | | public class SystemSetting extends BaseEntity implements Serializable { |
| | | @Table(name="sys_user_company") |
| | | public class SysUserCompany extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | |
| | | @ApiModelProperty(value = "值") |
| | | private String value; |
| | | |
| | | public void copy(SystemSetting source){ |
| | | public void copy(SysUserCompany source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/SysContract.java |
| | |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="sys_contract") |
| | | public class SysContract extends BaseEntity implements Serializable { |
| | | @Table(name="sys_user_contract") |
| | | public class SysUserContract extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | |
| | | @ApiModelProperty(value = "公司id") |
| | | private Long companyId; |
| | | |
| | | public void copy(SysContract source){ |
| | | @Column(name = "`remarks`") |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | public void copy(SysUserContract source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SystemSettingRepository.java |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.SystemSetting; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | import java.sql.Timestamp; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | **/ |
| | | public interface SystemSettingRepository extends JpaRepository<SystemSetting, Long>, JpaSpecificationExecutor<SystemSetting> { |
| | | public interface SysUserCompanyRepository extends JpaRepository<SysUserCompany, Long>, JpaSpecificationExecutor<SysUserCompany> { |
| | | |
| | | /** |
| | | * 根据value查询公司(导出用) |
| | | * @return |
| | | */ |
| | | @Query |
| | | SystemSetting findByValue(String value); |
| | | SysUserCompany findByValue(String value); |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/SysContractRepository.java |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysContract; |
| | | import me.zhengjie.modules.system.domain.SysUserContract; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | |
| | | * @author wcd |
| | | * @date 2023-01-31 |
| | | **/ |
| | | public interface SysContractRepository extends JpaRepository<SysContract, Long>, JpaSpecificationExecutor<SysContract> { |
| | | public interface SysUserContractRepository extends JpaRepository<SysUserContract, Long>, JpaSpecificationExecutor<SysUserContract> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.SysUserCompanyService; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "公司管理管理") |
| | | @RequestMapping("/api/sysUserCompany") |
| | | public class SysUserCompanyController { |
| | | |
| | | private final SysUserCompanyService sysUserCompanyService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('sysUserCompany:download')") |
| | | public void exportSystemSetting(HttpServletResponse response, SysUserCompanyQueryCriteria criteria) throws IOException { |
| | | sysUserCompanyService.download(sysUserCompanyService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询公司管理") |
| | | @ApiOperation("查询公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:list')") |
| | | public ResponseEntity<Object> querySystemSetting(SysUserCompanyQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(sysUserCompanyService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询公司管理") |
| | | @ApiOperation("查询公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:list')") |
| | | public ResponseEntity<Object> querySystemSetting(SysUserCompanyQueryCriteria criteria){ |
| | | return new ResponseEntity<>(sysUserCompanyService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增公司管理") |
| | | @ApiOperation("新增公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:add')") |
| | | public ResponseEntity<Object> createSystemSetting(@Validated @RequestBody SysUserCompany resources){ |
| | | return new ResponseEntity<>(sysUserCompanyService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改公司管理") |
| | | @ApiOperation("修改公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:edit')") |
| | | public ResponseEntity<Object> updateSystemSetting(@Validated @RequestBody SysUserCompany resources){ |
| | | sysUserCompanyService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除公司管理") |
| | | @ApiOperation("删除公司管理") |
| | | @PreAuthorize("@el.check('sysUserCompany:del')") |
| | | public ResponseEntity<Object> deleteSystemSetting(@RequestBody Long[] ids) { |
| | | sysUserCompanyService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @PostMapping(value = "/getCompName") |
| | | @Log("选择用户改变公司") |
| | | @ApiOperation("选择用户改变公司") |
| | | public ResponseEntity<Object> getCompName(@Validated @RequestBody SysUserCompanyDto resources){ |
| | | return new ResponseEntity<>(sysUserCompanyService.getCompName(resources), HttpStatus.OK); |
| | | } |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysContractController.java |
| | |
| | | package me.zhengjie.modules.system.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.system.domain.SysContract; |
| | | import me.zhengjie.modules.system.service.SysContractService; |
| | | import me.zhengjie.modules.system.service.dto.SysContractQueryCriteria; |
| | | import me.zhengjie.modules.system.domain.SysUserContract; |
| | | import me.zhengjie.modules.system.service.SysUserContractService; |
| | | import me.zhengjie.modules.system.service.dto.SysUserContractQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "合同部分管理") |
| | | @RequestMapping("/api/sysContract") |
| | | public class SysContractController { |
| | | @RequestMapping("/api/sysUserContract") |
| | | public class SysUserContractController { |
| | | |
| | | private final SysContractService sysContractService; |
| | | private final SysUserContractService sysUserContractService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('sysContract:list')") |
| | | public void exportSysContract(HttpServletResponse response, SysContractQueryCriteria criteria) throws IOException { |
| | | sysContractService.download(sysContractService.queryAll(criteria), response); |
| | | @PreAuthorize("@el.check('sysUserContract:download')") |
| | | public void exportSysContract(HttpServletResponse response, SysUserContractQueryCriteria criteria) throws IOException { |
| | | sysUserContractService.download(sysUserContractService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询合同部分") |
| | | @ApiOperation("查询合同部分") |
| | | @PreAuthorize("@el.check('sysContract:list')") |
| | | public ResponseEntity<Object> querySysContract(SysContractQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(sysContractService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | @PreAuthorize("@el.check('sysUserContract:list')") |
| | | public ResponseEntity<Object> querySysContract(SysUserContractQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(sysUserContractService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询合同部分") |
| | | @ApiOperation("查询合同部分") |
| | | @PreAuthorize("@el.check('sysContract:list')") |
| | | public ResponseEntity<Object> querySysContract(SysContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(sysContractService.queryAll(criteria),HttpStatus.OK); |
| | | @PreAuthorize("@el.check('sysUserContract:list')") |
| | | public ResponseEntity<Object> querySysContract(SysUserContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(sysUserContractService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增合同部分") |
| | | @ApiOperation("新增合同部分") |
| | | @PreAuthorize("@el.check('sysContract:add')") |
| | | public ResponseEntity<Object> createSysContract(@Validated @RequestBody SysContract resources){ |
| | | return new ResponseEntity<>(sysContractService.create(resources),HttpStatus.CREATED); |
| | | @PreAuthorize("@el.check('sysUserContract:add')") |
| | | public ResponseEntity<Object> createSysContract(@Validated @RequestBody SysUserContract resources){ |
| | | return new ResponseEntity<>(sysUserContractService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改合同部分") |
| | | @ApiOperation("修改合同部分") |
| | | @PreAuthorize("@el.check('sysContract:edit')") |
| | | public ResponseEntity<Object> updateSysContract(@Validated @RequestBody SysContract resources){ |
| | | sysContractService.update(resources); |
| | | @PreAuthorize("@el.check('sysUserContract:edit')") |
| | | public ResponseEntity<Object> updateSysContract(@Validated @RequestBody SysUserContract resources){ |
| | | sysUserContractService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除合同部分") |
| | | @ApiOperation("删除合同部分") |
| | | @PreAuthorize("@el.check('sysContract:del')") |
| | | @PreAuthorize("@el.check('sysUserContract:del')") |
| | | public ResponseEntity<Object> deleteSysContract(@RequestBody Long[] ids) { |
| | | sysContractService.deleteAll(ids); |
| | | sysUserContractService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SystemSettingService.java |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.service; |
| | | |
| | | import me.zhengjie.modules.system.domain.SystemSetting; |
| | | import me.zhengjie.modules.system.service.dto.SystemSettingDto; |
| | | import me.zhengjie.modules.system.service.dto.SystemSettingQueryCriteria; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | **/ |
| | | public interface SystemSettingService { |
| | | public interface SysUserCompanyService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(SystemSettingQueryCriteria criteria, Pageable pageable); |
| | | Map<String,Object> queryAll(SysUserCompanyQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<SystemSettingDto> |
| | | */ |
| | | List<SystemSettingDto> queryAll(SystemSettingQueryCriteria criteria); |
| | | List<SysUserCompanyDto> queryAll(SysUserCompanyQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return SystemSettingDto |
| | | */ |
| | | SystemSettingDto findById(Long id); |
| | | SysUserCompanyDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return SystemSettingDto |
| | | */ |
| | | SystemSettingDto create(SystemSetting resources); |
| | | SysUserCompanyDto create(SysUserCompany resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(SystemSetting resources); |
| | | void update(SysUserCompany resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SystemSettingDto> all, HttpServletResponse response) throws IOException; |
| | | void download(List<SysUserCompanyDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | SystemSetting getCompName(SystemSettingDto resources); |
| | | SysUserCompany getCompName(SysUserCompanyDto resources); |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/SysContractService.java |
| | |
| | | */ |
| | | package me.zhengjie.modules.system.service; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysContract; |
| | | import me.zhengjie.modules.system.service.dto.SysContractDto; |
| | | import me.zhengjie.modules.system.service.dto.SysContractQueryCriteria; |
| | | import me.zhengjie.modules.system.domain.SysUserContract; |
| | | import me.zhengjie.modules.system.service.dto.SysUserContractDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserContractQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | |
| | | * @author wcd |
| | | * @date 2023-01-31 |
| | | **/ |
| | | public interface SysContractService { |
| | | public interface SysUserContractService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(SysContractQueryCriteria criteria, Pageable pageable); |
| | | Map<String,Object> queryAll(SysUserContractQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<SysContractDto> |
| | | */ |
| | | List<SysContractDto> queryAll(SysContractQueryCriteria criteria); |
| | | List<SysUserContractDto> queryAll(SysUserContractQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return SysContractDto |
| | | */ |
| | | SysContractDto findById(Long id); |
| | | SysUserContractDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return SysContractDto |
| | | */ |
| | | SysContractDto create(SysContract resources); |
| | | SysUserContractDto create(SysUserContract resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(SysContract resources); |
| | | void update(SysUserContract resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<SysContractDto> all, HttpServletResponse response) throws IOException; |
| | | void download(List<SysUserContractDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SystemSettingDto.java |
| | |
| | | * @date 2023-01-30 |
| | | **/ |
| | | @Data |
| | | public class SystemSettingDto extends BaseDTO implements Serializable { |
| | | public class SysUserCompanyDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SystemSettingQueryCriteria.java |
| | |
| | | * @date 2023-01-30 |
| | | **/ |
| | | @Data |
| | | public class SystemSettingQueryCriteria{ |
| | | public class SysUserCompanyQueryCriteria { |
| | | |
| | | @Query(type = Query.Type.INNER_LIKE) |
| | | private String label; |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysContractDto.java |
| | |
| | | * @date 2023-01-31 |
| | | **/ |
| | | @Data |
| | | public class SysContractDto extends BaseDTO implements Serializable { |
| | | public class SysUserContractDto extends BaseDTO implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | |
| | | |
| | | /** 用户名称 */ |
| | | private String userName; |
| | | |
| | | /** 备注 */ |
| | | private String remarks; |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/SysContractQueryCriteria.java |
| | |
| | | * @date 2023-01-31 |
| | | **/ |
| | | @Data |
| | | public class SysContractQueryCriteria{ |
| | | public class SysUserContractQueryCriteria { |
| | | |
| | | //用户查询 |
| | | @Query |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.impl; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import me.zhengjie.modules.system.service.mapstruct.SysUserCompanyMapper; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.system.repository.SysUserCompanyRepository; |
| | | import me.zhengjie.modules.system.service.SysUserCompanyService; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyQueryCriteria; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author wcd |
| | | * @date 2023-01-30 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class SysUserCompanyServiceImpl implements SysUserCompanyService { |
| | | |
| | | private final SysUserCompanyRepository sysUserCompanyRepository; |
| | | private final SysUserCompanyMapper sysUserCompanyMapper; |
| | | private final UserRepository userRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(SysUserCompanyQueryCriteria criteria, Pageable pageable){ |
| | | Page<SysUserCompany> page = sysUserCompanyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(sysUserCompanyMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysUserCompanyDto> queryAll(SysUserCompanyQueryCriteria criteria){ |
| | | return sysUserCompanyMapper.toDto(sysUserCompanyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public SysUserCompanyDto findById(Long id) { |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findById(id).orElseGet(SysUserCompany::new); |
| | | ValidationUtil.isNull(sysUserCompany.getId(),"SystemSetting","id",id); |
| | | return sysUserCompanyMapper.toDto(sysUserCompany); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysUserCompanyDto create(SysUserCompany resources) { |
| | | return sysUserCompanyMapper.toDto(sysUserCompanyRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(SysUserCompany resources) { |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findById(resources.getId()).orElseGet(SysUserCompany::new); |
| | | ValidationUtil.isNull( sysUserCompany.getId(),"SystemSetting","id",resources.getId()); |
| | | sysUserCompany.copy(resources); |
| | | sysUserCompanyRepository.save(sysUserCompany); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | sysUserCompanyRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<SysUserCompanyDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (SysUserCompanyDto systemSetting : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("标签", systemSetting.getLabel()); |
| | | map.put("值", systemSetting.getValue()); |
| | | map.put("描述", systemSetting.getDescription()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | /** |
| | | * 选择用户改变公司 |
| | | * @param resources |
| | | * @return |
| | | */ |
| | | @Override |
| | | public SysUserCompany getCompName(SysUserCompanyDto resources) { |
| | | // 查询用户表 |
| | | User user = userRepository.findById(Long.valueOf(resources.getUserId())).orElseGet(User::new); |
| | | // 查询公司表 |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findByValue(user.getCompany()); |
| | | return sysUserCompany; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.system.service.impl; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.domain.SysUserContract; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.SysUserCompanyRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.dto.SysUserContractDto; |
| | | import me.zhengjie.modules.system.service.mapstruct.SysUserContractMapper; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.system.repository.SysUserContractRepository; |
| | | import me.zhengjie.modules.system.service.SysUserContractService; |
| | | import me.zhengjie.modules.system.service.dto.SysUserContractQueryCriteria; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author wcd |
| | | * @date 2023-01-31 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class SysUserUserContractServiceImpl implements SysUserContractService { |
| | | |
| | | private final SysUserContractRepository sysUserContractRepository; |
| | | private final SysUserContractMapper sysUserContractMapper; |
| | | private final UserRepository userRepository; |
| | | private final SysUserCompanyRepository sysUserCompanyRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(SysUserContractQueryCriteria criteria, Pageable pageable){ |
| | | Page<SysUserContract> page = sysUserContractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | //将实体转换为Dto(重写) |
| | | Function<SysUserContract, SysUserContractDto> func = new Function<SysUserContract, SysUserContractDto>(){ |
| | | |
| | | @Override |
| | | public SysUserContractDto apply(SysUserContract attendance) { |
| | | // 将实体类转换成DTO |
| | | SysUserContractDto sysUserContractDto = sysUserContractMapper.toDto(attendance); |
| | | //查询用户信息 |
| | | User user = userRepository.findById(sysUserContractDto.getUserId()).orElseGet(User::new); |
| | | sysUserContractDto.setUserName(user.getNickName()); |
| | | //查询公司信息 |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findById(sysUserContractDto.getCompanyId()).orElseGet(SysUserCompany::new); |
| | | sysUserContractDto.setCompName(sysUserCompany.getLabel()); |
| | | return sysUserContractDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysUserContractDto> queryAll(SysUserContractQueryCriteria criteria){ |
| | | return sysUserContractMapper.toDto(sysUserContractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public SysUserContractDto findById(Long id) { |
| | | SysUserContract sysUserContract = sysUserContractRepository.findById(id).orElseGet(SysUserContract::new); |
| | | ValidationUtil.isNull(sysUserContract.getId(),"SysContract","id",id); |
| | | return sysUserContractMapper.toDto(sysUserContract); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysUserContractDto create(SysUserContract resources) { |
| | | return sysUserContractMapper.toDto(sysUserContractRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(SysUserContract resources) { |
| | | SysUserContract sysUserContract = sysUserContractRepository.findById(resources.getId()).orElseGet(SysUserContract::new); |
| | | ValidationUtil.isNull( sysUserContract.getId(),"SysContract","id",resources.getId()); |
| | | sysUserContract.copy(resources); |
| | | sysUserContractRepository.save(sysUserContract); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | sysUserContractRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<SysUserContractDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (SysUserContractDto sysContract : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | User user = userRepository.findById(sysContract.getUserId()).orElseGet(User::new); |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findById(sysContract.getCompanyId()).orElseGet(SysUserCompany::new); |
| | | map.put("所属员工", user.getNickName()); |
| | | map.put("合同名称", sysContract.getContractName()); |
| | | map.put("合同开始时间", sysContract.getContractStartTime()); |
| | | map.put("合同结束时间", sysContract.getContractEndTime()); |
| | | map.put("公司", sysUserCompany.getLabel()); |
| | | map.put("创建者", sysContract.getCreateBy()); |
| | | map.put("创建时间", sysContract.getCreateTime()); |
| | | map.put("更新者", sysContract.getUpdateBy()); |
| | | map.put("更新时间", sysContract.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| | |
| | | import me.zhengjie.modules.system.repository.*; |
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.system.service.dto.*; |
| | | import me.zhengjie.modules.system.service.mapstruct.SysUserLevelWageMapper; |
| | | import me.zhengjie.modules.system.service.mapstruct.UserLoginMapper; |
| | | import me.zhengjie.modules.system.service.mapstruct.UserMapper; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository; |
| | | private final AttendanceGoOutRepository attendanceGoOutRepository; |
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository; |
| | | private final SystemSettingRepository systemSettingRepository; |
| | | private final SysUserCompanyRepository sysUserCompanyRepository; |
| | | |
| | | @Override |
| | | public Object queryAll(UserQueryCriteria criteria, Pageable pageable) { |
| | |
| | | for (UserDto userDTO : queryAll) { |
| | | List<String> roles = userDTO.getRoles().stream().map(RoleSmallDto::getName).collect(Collectors.toList()); |
| | | String levelName = userDTO.getLevelId() != null ? sysLevelRepository.findById(userDTO.getLevelId()).orElseGet(SysLevel::new).getName() : ""; |
| | | SystemSetting systemSetting = systemSettingRepository.findByValue(userDTO.getCompany()); |
| | | SysUserCompany sysUserCompany = sysUserCompanyRepository.findByValue(userDTO.getCompany()); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("用户名", userDTO.getUsername()); |
| | | map.put("角色", roles); |
| | |
| | | map.put("钉钉号", userDTO.getDingding()); |
| | | map.put("排班", userDTO.getSysRostering().getName()); |
| | | map.put("级别", levelName); |
| | | map.put("所属公司", systemSetting == null ? "" : systemSetting.getLabel()); |
| | | map.put("所属公司", sysUserCompany == null ? "" : sysUserCompany.getLabel()); |
| | | map.put("状态", userDTO.getEnabled() ? "启用" : "禁用"); |
| | | map.put("手机号码", userDTO.getPhone()); |
| | | map.put("修改密码的时间", userDTO.getPwdResetTime()); |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SystemSettingMapper.java |
| | |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SystemSetting; |
| | | import me.zhengjie.modules.system.service.dto.SystemSettingDto; |
| | | import me.zhengjie.modules.system.domain.SysUserCompany; |
| | | import me.zhengjie.modules.system.service.dto.SysUserCompanyDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | |
| | | * @date 2023-01-30 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SystemSettingMapper extends BaseMapper<SystemSettingDto, SystemSetting> { |
| | | public interface SysUserCompanyMapper extends BaseMapper<SysUserCompanyDto, SysUserCompany> { |
| | | |
| | | } |
| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/SysContractMapper.java |
| | |
| | | package me.zhengjie.modules.system.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.system.domain.SysContract; |
| | | import me.zhengjie.modules.system.service.dto.SysContractDto; |
| | | import me.zhengjie.modules.system.domain.SysUserContract; |
| | | import me.zhengjie.modules.system.service.dto.SysUserContractDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | |
| | | * @date 2023-01-31 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface SysContractMapper extends BaseMapper<SysContractDto, SysContract> { |
| | | public interface SysUserContractMapper extends BaseMapper<SysUserContractDto, SysUserContract> { |
| | | |
| | | } |
| | |
| | | List<TaskDailyInterface> collectByProjectIdAndFillDateLessThanGroupByUserIdAndFillDate(Long projectId, Timestamp fillDate); |
| | | |
| | | /** |
| | | * 根据项目ID查询任务日报信息 |
| | | * @param projectId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT user_id AS userId, fill_date AS fillDate, COALESCE(SUM(consumed_hours), 0) AS consumedHours FROM task_daliy WHERE project_id = ?1 GROUP BY user_id, fill_date", nativeQuery = true) |
| | | List<TaskDailyInterface> collectByProjectIdGroupByUserIdAndFillDate(Long projectId); |
| | | |
| | | /** |
| | | * 根据项目ID、任务ID查询 |
| | | * @param projectId |
| | | * @param taskId |
| | |
| | | public ResponseEntity<Object> queryCompletedWork(TaskDaliyQueryCriteria criteria){ |
| | | return new ResponseEntity<>(taskDaliyService.queryCompletedWork(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/taskTotalConsumedHours") |
| | | @Log("查询任务的总消耗工时") |
| | | @ApiOperation("查询任务的总消耗工时") |
| | | @PreAuthorize("@el.check('taskDaliy:list')") |
| | | public ResponseEntity<Object> queryTaskTotalConsumedHours(TaskDaliyQueryCriteria criteria){ |
| | | return new ResponseEntity<>(taskDaliyService.queryTaskTotalConsumedHours(criteria),HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | * @return List<TaskDaliyDto> |
| | | */ |
| | | Double queryCompletedWork(TaskDaliyQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 查询任务的总消耗工时 |
| | | * @param criteria 条件参数 |
| | | * @return List<TaskDaliyDto> |
| | | */ |
| | | Double queryTaskTotalConsumedHours(TaskDaliyQueryCriteria criteria); |
| | | } |
| | |
| | | import me.zhengjie.modules.system.service.RoleService; |
| | | import me.zhengjie.modules.system.service.dto.RoleSmallDto; |
| | | import me.zhengjie.modules.task.domain.Task; |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import me.zhengjie.modules.task.domain.TaskUser; |
| | | import me.zhengjie.modules.task.repository.TaskRepository; |
| | |
| | | // 日历类 |
| | | return cal; |
| | | } |
| | | |
| | | @Override |
| | | public Double queryTaskTotalConsumedHours(TaskDaliyQueryCriteria criteria) { |
| | | // 根据项目ID、任务ID、用户ID查询总消耗工时、总消耗工作量、最大任务进度 |
| | | TaskDailyInterface taskDailyInterface = taskDaliyRepository.findSumConsumedHoursAndSumConsumedWorkloadAndMaxTaskProgressByProjectIdAndTaskIdAndUserId(criteria.getProjectId(), criteria.getTaskId(), criteria.getUserId()); |
| | | // 返回 |
| | | return taskDailyInterface.getConsumedHours(); |
| | | } |
| | | } |
| File was renamed from eladmin-web-master/src/api/system/systemSetting.js |
| | |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/systemSetting/all', |
| | | url: 'api/sysUserCompany/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/systemSetting', |
| | | url: 'api/sysUserCompany', |
| | | method: 'post', |
| | | data |
| | | }) |
| | |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/systemSetting/', |
| | | url: 'api/sysUserCompany/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/systemSetting', |
| | | url: 'api/sysUserCompany', |
| | | method: 'put', |
| | | data |
| | | }) |
| | |
| | | |
| | | export function getCompName(data) { |
| | | return request({ |
| | | url: 'api/systemSetting/getCompName', |
| | | url: 'api/sysUserCompany/getCompName', |
| | | method: 'post', |
| | | data |
| | | }) |
| File was renamed from eladmin-web-master/src/api/system/sysContract.js |
| | |
| | | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/sysContract/all', |
| | | url: 'api/sysUserContract/all', |
| | | method: 'get', |
| | | params |
| | | }) |
| | |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/sysContract', |
| | | url: 'api/sysUserContract', |
| | | method: 'post', |
| | | data |
| | | }) |
| | |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/sysContract/', |
| | | url: 'api/sysUserContract/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/sysContract', |
| | | url: 'api/sysUserContract', |
| | | method: 'put', |
| | | data |
| | | }) |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del, completedWork, complianceWork } |
| | | export function taskTotalConsumedHours(params) { |
| | | return request({ |
| | | url: 'api/taskDaliy/taskTotalConsumedHours', |
| | | method: 'get', |
| | | params |
| | | }) |
| | | } |
| | | |
| | | export default { getAll, add, edit, del, completedWork, complianceWork, taskTotalConsumedHours } |
| | |
| | | <div class="dashboard-editor-container"> |
| | | <panel-group :user-info="userInfo" @handleSetLineChartData="handleSetLineChartData" /> |
| | | <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;"> |
| | | <FullCalendar ref="fullCalendar" :options="calendarOptions" class="eventDeal-wrap" /> |
| | | <FullCalendar ref="fullCalendar" :options="calendarOptions" /> |
| | | </el-row> |
| | | </div> |
| | | </div> |
| | |
| | | import moment from 'moment' |
| | | |
| | | const lineChartData = { |
| | | newVisitis: { |
| | | expectedData: [100, 120, 161, 134, 105, 160, 165], |
| | | actualData: [120, 82, 91, 154, 162, 140, 145] |
| | | }, |
| | | messages: { |
| | | expectedData: [200, 192, 120, 144, 160, 130, 140], |
| | | actualData: [180, 160, 151, 106, 145, 150, 130] |
| | | }, |
| | | purchases: { |
| | | expectedData: [80, 100, 121, 104, 105, 90, 100], |
| | | actualData: [120, 90, 100, 138, 142, 130, 130] |
| | | }, |
| | | shoppings: { |
| | | expectedData: [130, 140, 141, 142, 145, 150, 160], |
| | | actualData: [120, 82, 91, 154, 162, 140, 130] |
| | | } |
| | | // newVisitis: { |
| | | // expectedData: [100, 120, 161, 134, 105, 160, 165], |
| | | // actualData: [120, 82, 91, 154, 162, 140, 145] |
| | | // }, |
| | | // messages: { |
| | | // expectedData: [200, 192, 120, 144, 160, 130, 140], |
| | | // actualData: [180, 160, 151, 106, 145, 150, 130] |
| | | // }, |
| | | // purchases: { |
| | | // expectedData: [80, 100, 121, 104, 105, 90, 100], |
| | | // actualData: [120, 90, 100, 138, 142, 130, 130] |
| | | // }, |
| | | // shoppings: { |
| | | // expectedData: [130, 140, 141, 142, 145, 150, 160], |
| | | // actualData: [120, 82, 91, 154, 162, 140, 130] |
| | | // } |
| | | } |
| | | |
| | | export default { |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | lineChartData: lineChartData.newVisitis, |
| | | // lineChartData: lineChartData.newVisitis, |
| | | calendarOptions: { |
| | | // 引入的插件 |
| | | plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin], |
| | |
| | | locale: 'zh-ch', |
| | | firstDay: '1', |
| | | weekNumberCalculation: 'ISO', |
| | | eventCOlor: '#3d8eec', |
| | | eventColor: '#3d8eec', |
| | | timeGridEventMinHeight: '20', |
| | | aspectRatio: '1.5', |
| | | displayEventTime: false, |
| | |
| | | // 获取打卡信息 |
| | | getUserCalendarInfo(month) { |
| | | crudUser.getUserCalendarInfo(month).then(res => { |
| | | console.log('res', res) |
| | | this.calendarOptions.events = res.map(function(obj) { |
| | | obj.start = obj.date |
| | | // obj.start = obj.date |
| | | obj.color = obj.isOk ? 'green' : 'red' |
| | | obj.date1 = obj.date |
| | | // obj.date1 = obj.date |
| | | return obj |
| | | }) |
| | | setTimeout(() => { |
| | | console.log(this.calendarOptions.events) |
| | | }, 1000) |
| | | }).catch(() => { |
| | | this.calendarOptions.events = [] |
| | | }) |
| | |
| | | } |
| | | </script> |
| | | |
| | | <style rel="stylesheet/scss" lang="scss" scoped> |
| | | .dashboard-editor-container { |
| | | padding: 32px; |
| | | background-color: rgb(240, 242, 245); |
| | | position: relative; |
| | | // <style rel="stylesheet/scss" lang="scss" scoped> |
| | | // .dashboard-editor-container { |
| | | // padding: 32px; |
| | | // background-color: rgb(240, 242, 245); |
| | | // position: relative; |
| | | |
| | | .github-corner { |
| | | position: absolute; |
| | | top: 0; |
| | | border: 0; |
| | | right: 0; |
| | | } |
| | | // .github-corner { |
| | | // position: absolute; |
| | | // top: 0; |
| | | // border: 0; |
| | | // right: 0; |
| | | // } |
| | | |
| | | .chart-wrapper { |
| | | background: #fff; |
| | | padding: 16px 16px 0; |
| | | margin-bottom: 32px; |
| | | } |
| | | } |
| | | // .chart-wrapper { |
| | | // background: #fff; |
| | | // padding: 16px 16px 0; |
| | | // margin-bottom: 32px; |
| | | // } |
| | | // } |
| | | |
| | | @media (max-width:1024px) { |
| | | .chart-wrapper { |
| | | padding: 8px; |
| | | } |
| | | } |
| | | </style> |
| | | // @media (max-width:1024px) { |
| | | // .chart-wrapper { |
| | | // padding: 8px; |
| | | // } |
| | | // } |
| | | // </style> |
| | |
| | | {{ scope.row.contractPrice != null && scope.row.contractPrice != '' ? crud.toMoney(scope.row.contractPrice) : '' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="totalTaskTime" label="任务总工时" width="100" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="totalTaskTime" label="计划任务总工时" width="110" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="actualTaskTime" label="实际任务总工时" width="110" /> |
| | | <el-table-column v-if="checkPer([permission.master])" label="报价"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="quotationPrice" label="单金" width="100"> |
| | | <template slot-scope="scope"> |
| | |
| | | <el-tag>{{ dict.label[standardUnitCurrency][scope.row.unitCurrency] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" label="总金额" width="100"> |
| | | <el-table-column :show-overflow-tooltip="true" label="计划总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.quotationPrice * scope.row.totalTaskTime / 160) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" label="实际总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.quotationPrice * scope.row.actualTaskTime / 160) }} |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | |
| | | <el-table-column :show-overflow-tooltip="true" label="币种" width="100"> |
| | | <el-tag>{{ dict.label[standardUnitCurrency][standardUnitCurrencyRenminbi] }}</el-tag> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" label="总金额" width="100"> |
| | | <el-table-column :show-overflow-tooltip="true" label="计划总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.performancePrice * scope.row.totalTaskTime / 160) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" label="实际总金额" width="100"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toMoney(scope.row.performancePrice * scope.row.actualTaskTime / 160) }} |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="totalLaborCost" label="项目总成本" width="100"> |
| | | <el-table-column :show-overflow-tooltip="true" prop="totalLaborCost" label="计划项目总成本" width="110"> |
| | | <template slot-scope="scope"> |
| | | <span :style="{ color: scope.row.performancePrice * scope.row.totalTaskTime < scope.row.totalLaborCost ? 'red' : '' }"> |
| | | {{ crud.toMoney(scope.row.totalLaborCost) }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="actualLaborCost" label="实际项目总成本" width="110"> |
| | | <template slot-scope="scope"> |
| | | <span :style="{ color: scope.row.performancePrice * scope.row.actualTaskTime < scope.row.actualLaborCost ? 'red' : '' }"> |
| | | {{ crud.toMoney(scope.row.actualLaborCost) }} |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="liableUserName" label="责任人" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.liableUserName != null && scope.row.liableUserName != ''"> |
| | |
| | | import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect' |
| | | import crudRostering from '@/api/system/rostering' |
| | | import crudLevel from '@/api/system/level' |
| | | import crudSystemSetting from '@/api/system/systemSetting' |
| | | import crudSysUserCompany from '@/api/system/sysUserCompany' |
| | | let userRoles = [] |
| | | let userJobs = [] |
| | | const defaultForm = { id: null, username: null, nickName: null, gender: '男', email: null, enabled: 'false', roles: [], jobs: [], dept: { id: null }, phone: null, birthday: null, address: null, dingding: null, sysRostering: { id: null }, levelId: null } |
| | |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 查询配置参数 |
| | | crudSystemSetting.getAll().then(res => { |
| | | crudSysUserCompany.getAll().then(res => { |
| | | // 公司列表 |
| | | this.companyList = res |
| | | }) |
| | |
| | | // 去合同部分 |
| | | toContract() { |
| | | // 跳转页面 |
| | | this.$router.push({ path: '/system/sysContract' }) |
| | | this.$router.push({ path: '/system/sysUserContract' }) |
| | | } |
| | | } |
| | | } |
| File was renamed from eladmin-web-master/src/views/system/company/index.vue |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="description" label="描述" /> |
| | | <el-table-column prop="createTime" label="创建日期" /> |
| | | <el-table-column v-if="checkPer(['admin','systemSetting:edit','systemSetting:del'])" label="操作" width="150px" align="center"> |
| | | <el-table-column v-if="checkPer(['admin','sysUserCompany:edit','sysUserCompany:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import crudSystemSetting from '@/api/system/systemSetting' |
| | | import crudSysUserCompany from '@/api/system/sysUserCompany' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | |
| | | |
| | | const defaultForm = { id: null, name: null, description: null, label: null, value: null, createBy: null, updateBy: null, createTime: null, updateTime: null } |
| | | export default { |
| | | name: 'SystemSetting', |
| | | name: 'SysUserCompany', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '公司管理', url: 'api/systemSetting', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSystemSetting }}) |
| | | return CRUD({ title: '公司管理', url: 'api/sysUserCompany', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysUserCompany }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'systemSetting:add'], |
| | | edit: ['admin', 'systemSetting:edit'], |
| | | del: ['admin', 'systemSetting:del'], |
| | | download: ['admin', 'systemSetting:download'] |
| | | add: ['admin', 'sysUserCompany:add'], |
| | | edit: ['admin', 'sysUserCompany:edit'], |
| | | del: ['admin', 'sysUserCompany:del'], |
| | | download: ['admin', 'sysUserCompany:download'] |
| | | }, |
| | | rules: { |
| | | label: [ |
| File was renamed from eladmin-web-master/src/views/system/contract/index.vue |
| | |
| | | <el-form-item label="开始时间" prop="contractStartTime"> |
| | | <el-date-picker |
| | | v-model="form.contractStartTime" |
| | | type="datetime" |
| | | type="date" |
| | | placeholder="选择日期时间" |
| | | style="width: 370px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | |
| | | <el-form-item label="结束时间" prop="contractEndTime"> |
| | | <el-date-picker |
| | | v-model="form.contractEndTime" |
| | | type="datetime" |
| | | type="date" |
| | | placeholder="选择日期时间" |
| | | style="width: 370px;" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | :picker-options="{ |
| | | disabledDate(time) { |
| | |
| | | }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="公司" prop="companyId"> |
| | | <el-form-item label="所属公司" prop="companyId"> |
| | | <el-select v-model="form.companyId" style="width: 370px" clearable> |
| | | <el-option v-for="item in companyList" :key="item.id" :label="item.label" :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="备注" prop="remarks"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 370px;" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | <el-tag>{{ scope.row.userName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="contractName" label="合同名称" show-overflow-tooltip> |
| | | <el-table-column prop="contractName" label="合同名称" show-overflow-tooltip /> |
| | | <el-table-column prop="contractStartTime" label="合同开始时间" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.contractName }}</el-tag> |
| | | {{ crud.toDate(scope.row.contractStartTime) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="contractStartTime" label="合同开始时间" show-overflow-tooltip /> |
| | | <el-table-column prop="contractEndTime" label="合同结束时间" show-overflow-tooltip /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="companyId" label="公司"> |
| | | <el-table-column prop="contractEndTime" label="合同结束时间" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.contractEndTime) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="companyId" label="所属公司"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.compName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remarks" label="备注" show-overflow-tooltip /> |
| | | <el-table-column prop="createTime" label="创建时间" show-overflow-tooltip /> |
| | | <el-table-column v-if="checkPer(['admin','sysContract:edit','sysContract:del'])" label="操作" width="150px" align="center"> |
| | | <el-table-column v-if="checkPer(['admin','sysUserContract:edit','sysUserContract:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import crudSysContract from '@/api/system/sysContract' |
| | | import crudSysContract from '@/api/system/sysUserContract' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import crudSystemSetting from '@/api/system/systemSetting' |
| | | import crudSysUserCompany from '@/api/system/sysUserCompany' |
| | | import crudUser from '@/api/system/user' |
| | | |
| | | const defaultForm = { id: null, userId: null, contractName: null, contractStartTime: null, contractEndTime: null, companyId: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, userId: null, contractName: null, contractStartTime: null, contractEndTime: null, companyId: null, createBy: null, createTime: null, updateBy: null, updateTime: null, remarks: null } |
| | | export default { |
| | | name: 'SysContract', |
| | | name: 'SysUserContract', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '合同部分', url: 'api/sysContract', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysContract }}) |
| | | return CRUD({ title: '合同部分', url: 'api/sysUserContract', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSysContract }}) |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'sysContract:add'], |
| | | edit: ['admin', 'sysContract:edit'], |
| | | del: ['admin', 'sysContract:del'], |
| | | download: ['admin', 'sysContract:download'] |
| | | add: ['admin', 'sysUserContract:add'], |
| | | edit: ['admin', 'sysUserContract:edit'], |
| | | del: ['admin', 'sysUserContract:del'], |
| | | download: ['admin', 'sysUserContract:download'] |
| | | }, |
| | | rules: { |
| | | userId: [ |
| | |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getUsers() |
| | | // 查询配置参数 |
| | | crudSystemSetting.getAll().then(res => { |
| | | crudSysUserCompany.getAll().then(res => { |
| | | // 公司列表 |
| | | this.companyList = res |
| | | }) |
| | |
| | | var form = JSON.stringify({ |
| | | 'userId': data |
| | | }) |
| | | crudSystemSetting.getCompName(form).then(res => { |
| | | crudSysUserCompany.getCompName(form).then(res => { |
| | | this.form.companyId = res.label |
| | | }) |
| | | } else { |
| | |
| | | <template slot="append">小时</template> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | 已消耗工时:{{ form.alreadyConsumedHours }} / 任务工时:{{ form.taskHours }} |
| | | </el-form-item> |
| | | <el-form-item label="消耗工作量" prop="consumedWorkload"> |
| | | <el-input v-model="form.consumedWorkload" style="width: 340px;" :disabled="disabledFlagBySettlement" /> |
| | | </el-form-item> |
| | | <el-form-item label="消耗工作量单位" prop="consumedWorkloadUnit"> |
| | | <el-form-item label="消耗工作量单位"> |
| | | {{ dict.label[standardWorkloadUnit][form.consumedWorkloadUnit] }} |
| | | </el-form-item> |
| | | <el-form-item label="任务进度" prop="taskProgress"> |
| | |
| | | import crudUser from '@/api/system/user' |
| | | import crudProject from '@/api/project/project' |
| | | import crudTask from '@/api/task/task' |
| | | import crudTaskUser from '@/api/task/taskUser' |
| | | |
| | | const defaultForm = { id: null, projectId: null, taskId: null, userId: null, fillDate: null, consumedHours: null, consumedWorkload: null, taskProgress: null, settlementStatus: constant.SETTLEMENT_STATUS_UNSETTLED, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, projectId: null, taskId: null, userId: null, fillDate: null, consumedHours: null, alreadyConsumedHours: 0, taskHours: 0, consumedWorkload: null, consumedWorkloadUnit: null, taskProgress: null, settlementStatus: constant.SETTLEMENT_STATUS_UNSETTLED, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'TaskDaliy', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | |
| | | }, |
| | | // 钩子:新建 - 之前 |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | // 表单赋值 |
| | | this.form.consumedWorkloadUnit = null |
| | | // 判断用户最大角色级别是否是角色级别:超级管理员或角色级别:总经理 |
| | | if (this.userRolesLevelMin !== this.roleLevelSuper && this.userRolesLevelMin !== this.roleLevelGeneral) { |
| | | // 表单赋值 |
| | |
| | | if (this.formTasks[i].id === this.form.taskId) { |
| | | // 表单赋值 |
| | | this.form.consumedWorkloadUnit = this.formTasks[i].planWorkloadUnit |
| | | return |
| | | break |
| | | } |
| | | // 判断循环是否结束 |
| | | if (i === this.formTasks.length - 1) { |
| | |
| | | this.form.consumedWorkloadUnit = null |
| | | } |
| | | } |
| | | // 查询任务的总消耗工时 |
| | | crudTaskDaliy.taskTotalConsumedHours({ userId: this.form.userId, projectId: this.form.projectId, taskId: this.form.taskId }).then(res => { |
| | | // 表单赋值 |
| | | this.form.alreadyConsumedHours = res |
| | | }) |
| | | // 查询任务分配 |
| | | crudTaskUser.getAll({ userId: this.form.userId, projectId: this.form.projectId, taskId: this.form.taskId }).then(res => { |
| | | // 表单赋值 |
| | | this.form.taskHours = res[0].taskHours |
| | | }) |
| | | } |
| | | } |
| | | } |