| | |
| | | // 查询某天出差总时长
|
| | | @Query(value = "SELECT COALESCE(SUM(travel_duration), 0) FROM attendance_business_travel WHERE user_id = ?2 AND approval_status IN ('business_approve_status_reviewed', 'business_approve_status_agree') AND id != ?3 AND travel_start_time LIKE CONCAT(?1, '%')", nativeQuery = true)
|
| | | BigDecimal countTravelDuration(String date, Long userId, Long id);
|
| | |
|
| | | // 查询某项目出差总时长
|
| | | @Query(value = "SELECT COALESCE(SUM(travel_duration), 0) FROM attendance_business_travel WHERE project_id = ?1 AND approval_status = 'business_approve_status_agree'", nativeQuery = true)
|
| | | BigDecimal countProjectTravelDuration(Long projectId);
|
| | | } |
| | |
| | | import lombok.Data;
|
| | | import me.zhengjie.base.BaseDTO;
|
| | | import me.zhengjie.modules.approval.service.dto.ApproveEventDto;
|
| | | import me.zhengjie.modules.project.service.dto.ProjectDto;
|
| | |
|
| | | import java.sql.Timestamp;
|
| | | import java.io.Serializable;
|
| | |
| | |
|
| | | /** 企微最新审批变化记录 */
|
| | | private ApproveEventDto event;
|
| | |
|
| | | /** 关联项目信息 */
|
| | | private ProjectDto project;
|
| | | } |
| | |
| | | |
| | | @Query(type = Query.Type.EQUAL) |
| | | private String wecomSpNo; |
| | | |
| | | /* 精确 */ |
| | | @Query(type = Query.Type.EQUAL) |
| | | private Long projectId; |
| | | } |
| | |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.service.mapstruct.ProjectMapper; |
| | | import me.zhengjie.modules.quartz.service.impl.WeComServiceImpl; |
| | | import me.zhengjie.modules.system.domain.DictDetail; |
| | | import me.zhengjie.modules.system.domain.Role; |
| | |
| | | private final TemplateControlFieldService templateControlFieldService; |
| | | private final AttendanceService attendanceService; |
| | | private final ProjectRepository projectRepository; |
| | | private final ProjectMapper projectMapper; |
| | | |
| | | @Override |
| | | public Map<String, Object> queryAll(AttendanceBusinessTravelQueryCriteria criteria, Pageable pageable) { |
| | |
| | | User appUser = userRepository.findById(attendanceBusinessTravelDto.getApprovalUserId()).orElseGet(User::new); |
| | | attendanceBusinessTravelDto.setAppUserName(appUser.getNickName()); |
| | | |
| | | // 查询关联项目信息 |
| | | if (ObjectUtils.isNotEmpty(attendanceBusinessTravel.getProjectId())) { |
| | | attendanceBusinessTravelDto.setProject(projectMapper.toDto(projectRepository.findById(attendanceBusinessTravel.getProjectId()).orElseGet(Project::new))); |
| | | } |
| | | |
| | | // 查询企微最新审批变化记录 |
| | | if (ObjectUtils.isNotEmpty(attendanceBusinessTravel.getWecomEventId())) { |
| | | ApproveEvent event = approveEventRepository.findById(attendanceBusinessTravel.getWecomEventId()).orElseGet(ApproveEvent::new); |
| | |
| | | |
| | | List<AttendanceBusinessTravelDto> attendanceBusinessTravelList = attendanceBusinessTravelMapper.toDto(attendanceBusinessTravelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); |
| | | attendanceBusinessTravelList.forEach(attendanceBusinessTravelDto -> { |
| | | //查询用户信息 |
| | | // 查询用户信息 |
| | | UserDto user = userService.findById(attendanceBusinessTravelDto.getUserId()); |
| | | attendanceBusinessTravelDto.setUserName(user.getNickName()); |
| | | //查询审批用户名 |
| | | // 查询审批用户名 |
| | | UserDto appUser = userService.findById(attendanceBusinessTravelDto.getApprovalUserId()); |
| | | attendanceBusinessTravelDto.setAppUserName(appUser.getNickName()); |
| | | // 查询关联项目信息 |
| | | if (ObjectUtils.isNotEmpty(attendanceBusinessTravelDto.getProjectId())) { |
| | | attendanceBusinessTravelDto.setProject(projectMapper.toDto(projectRepository.findById(attendanceBusinessTravelDto.getProjectId()).orElseGet(Project::new))); |
| | | } |
| | | }); |
| | | return attendanceBusinessTravelList; |
| | | } |
| | |
| | | map.put("出差原因", attendanceBusinessTravel.getTravelReason()); |
| | | map.put("出发城市", attendanceBusinessTravel.getDepartureCity()); |
| | | map.put("到达城市", attendanceBusinessTravel.getArrivalCity()); |
| | | map.put("关联项目", attendanceBusinessTravel.getProject() != null ? attendanceBusinessTravel.getProject().getName() : ""); |
| | | map.put("出差分类", attendanceBusinessTravel.getCategory() != null ? bussCategoryMap.get(attendanceBusinessTravel.getCategory()) : ""); |
| | | map.put("审批状态", attendanceBusinessTravel.getApprovalStatus() != null ? bussStatusMap.get(attendanceBusinessTravel.getApprovalStatus()) : ""); |
| | | map.put("审批说明", attendanceBusinessTravel.getApprovalDescription()); |
| | |
| | | private String liableUserName; |
| | | |
| | | private boolean flag; |
| | | |
| | | /** 项目出差总天数 */ |
| | | private BigDecimal totalTravelDuration; |
| | | } |
| | |
| | |
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import me.zhengjie.exception.BadRequestException;
|
| | | import me.zhengjie.modules.attendance.repository.AttendanceBusinessTravelRepository;
|
| | | import me.zhengjie.modules.constant.Constant;
|
| | | import me.zhengjie.modules.contract.repository.ContractProjectRepository;
|
| | | import me.zhengjie.modules.cost.repository.CostRepository;
|
| | |
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import java.io.IOException;
|
| | | import java.math.BigDecimal;
|
| | | import java.math.RoundingMode;
|
| | | import java.sql.Timestamp;
|
| | | import java.text.ParseException;
|
| | | 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;
|
| | |
| | | private final ProjectPerformanceDetailRepository projectPerformanceDetailRepository;
|
| | | private final CostRepository costRepository;
|
| | | private final ContractProjectRepository contractProjectRepository;
|
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository;
|
| | | private final SysGoalSettingService sysGoalSettingService;
|
| | | private final WeComServiceImpl weComService;
|
| | |
|
| | |
| | | projectDto.setActualLaborCost(actualCost);
|
| | | // 项目二次处理
|
| | | projectDto = customHandle(projectDto);
|
| | |
|
| | | // 项目出差总天数
|
| | | projectDto.setTotalTravelDuration(attendanceBusinessTravelRepository.countProjectTravelDuration(project.getId()));
|
| | |
|
| | | // 返回处理好的Dto
|
| | | return projectDto;
|
| | | }
|
| | |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select |
| | | v-model="query.projectId" |
| | | filterable |
| | | clearable |
| | | placeholder="关联项目" |
| | | style="width: 185px;" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | > |
| | | <el-option v-for="item in projects" :key="item.id" :label="item.name" :value="item.id" /> |
| | | </el-select> |
| | | <el-date-picker |
| | | v-model="query.travelStartTime" |
| | | type="date" |
| | |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="project.name" |
| | | label="关联项目" |
| | | width="80" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | prop="category" |
| | | label="出差分类" |
| | | width="80" |
| | |
| | | updateBy: null, |
| | | updateTime: null, |
| | | wecomSpNo: null, |
| | | event: null |
| | | event: null, |
| | | project: null |
| | | } |
| | | export default { |
| | | name: 'AttendanceBusinessTravel', |
| | |
| | | {{ scope.row.completedTaskTime }} / {{ scope.row.divideTaskTime }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="totalTravelDuration" label="出差总工时" width="100" /> |
| | | <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"> |
| | |
| | | import constant from '@/utils/constant' |
| | | import { downloadFile } from '@/utils/index' |
| | | |
| | | const defaultForm = { id: null, name: null, projectTypeId: null, projectDistinguish: null, companyId: null, requirement: null, unitCurrency: null, performanceObjectives: null, quotationPrice: null, performancePrice: null, contractPrice: null, contractPrePrice: null, projectPrice: null, liableUserId: null, liableUserIdList: [], planStartDate: null, planEndDate: null, projectStatus: null, approveStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, name: null, projectTypeId: null, projectDistinguish: null, companyId: null, requirement: null, unitCurrency: null, performanceObjectives: null, quotationPrice: null, performancePrice: null, contractPrice: null, contractPrePrice: null, projectPrice: null, liableUserId: null, liableUserIdList: [], planStartDate: null, planEndDate: null, projectStatus: null, approveStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, totalTravelDuration: null } |
| | | export default { |
| | | name: 'Project', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | |
| | | }).catch(e => { |
| | | that.$message.error(e.message) |
| | | }).finally(() => { |
| | | that.downloadProgressLoading = false; |
| | | that.downloadProgressLoading = false |
| | | }) |
| | | } |
| | | } |