Merge branch 'wcd-2411-update' into wcd
| | |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | | import org.springframework.security.core.userdetails.UserDetailsService; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | |
| | | |
| | | return finalSet; |
| | | } |
| | | |
| | | /** |
| | | * 校验权限 |
| | | * @param permissions |
| | | * @return |
| | | */ |
| | | public static Boolean checkPermissions(String ...permissions) { |
| | | // 获取当前用户的所有权限 |
| | | List<String> elPermissions = getCurrentUser().getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList()); |
| | | // 判断当前用户的所有权限是否包含校验的权限 |
| | | return Arrays.stream(permissions).anyMatch(elPermissions::contains); |
| | | } |
| | | } |
| | |
| | | public void download(List<AttendanceDto> all, HttpServletResponse response) throws IOException {
|
| | | List<Map<String, Object>> list = new ArrayList<>();
|
| | | for (AttendanceDto attendance : all) {
|
| | | String startLocationResults = attendance.getStartLocationResults() != null ? dictDetailRepository.findByDictNameAndValue("location_results", attendance.getStartLocationResults()).getLabel() : "";
|
| | | String startClockResults = attendance.getStartClockResults() != null ? dictDetailRepository.findByDictNameAndValue("attendance_state", attendance.getStartClockResults()).getLabel() : "";
|
| | | String endLocationResults = attendance.getEndLocationResults() != null ? dictDetailRepository.findByDictNameAndValue("location_results", attendance.getEndLocationResults()).getLabel() : "";
|
| | | String endClockResults = attendance.getEndClockResults() != null ? dictDetailRepository.findByDictNameAndValue("attendance_state", attendance.getEndClockResults()).getLabel() : "";
|
| | | String dateType = attendance.getDateType() != null ? dictDetailRepository.findByDictNameAndValue("date_type", attendance.getDateType()).getLabel() : "";
|
| | | String startLocationResults = StringUtils.isNotBlank(attendance.getStartLocationResults()) ? dictDetailRepository.findByDictNameAndValue("location_results", attendance.getStartLocationResults()).getLabel() : "";
|
| | | String startClockResults = StringUtils.isNotBlank(attendance.getStartClockResults()) ? dictDetailRepository.findByDictNameAndValue("attendance_state", attendance.getStartClockResults()).getLabel() : "";
|
| | | String endLocationResults = StringUtils.isNotBlank(attendance.getEndLocationResults()) ? dictDetailRepository.findByDictNameAndValue("location_results", attendance.getEndLocationResults()).getLabel() : "";
|
| | | String endClockResults = StringUtils.isNotBlank(attendance.getEndClockResults()) ? dictDetailRepository.findByDictNameAndValue("attendance_state", attendance.getEndClockResults()).getLabel() : "";
|
| | | String dateType = StringUtils.isNotBlank(attendance.getDateType()) ? dictDetailRepository.findByDictNameAndValue("date_type", attendance.getDateType()).getLabel() : "";
|
| | | Map<String,Object> map = new LinkedHashMap<>();
|
| | | map.put("员工", attendance.getUserName());
|
| | | map.put("考勤日期", attendance.getAttendanceDate());
|
| | |
| | | // 个人报告 |
| | | UserQueryCriteria userQueryCriteria = new UserQueryCriteria(); |
| | | userQueryCriteria.setEnabled(true); |
| | | userQueryCriteria.setLoginEnabled(true); |
| | | userQueryCriteria.setWeComIdNotNull(true); |
| | | userQueryCriteria.getDeptIds().add(7L); |
| | | // 先查找是否存在子节点 |
| | |
| | | |
| | | @Query(propName = "levelId", type = Query.Type.IN) |
| | | private List<Long> levelIds; |
| | | |
| | | @Query |
| | | private Boolean loginEnabled; |
| | | } |
| | |
| | | private String projectName; |
| | | private String taskName; |
| | | private String taskId; |
| | | |
| | | /* ----------------额外统计---------------- */ |
| | | // 累计工时 |
| | | private Double accumulateHours; |
| | | } |
| | |
| | | import org.springframework.cache.annotation.CacheEvict; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.aggregation.Aggregation; |
| | | import org.springframework.data.mongodb.core.aggregation.AggregationResults; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | List<TaskDaliyMongo> daliyMongoList = mongoTemplate.find(query.with(pageable), TaskDaliyMongo.class); |
| | | List<TaskDaliyMongoDto> resultList = new ArrayList<>(); |
| | | daliyMongoList.sort((o1, o2) -> o2.getFillDate().compareTo(o1.getFillDate())); |
| | | // 校验【业务组长】权限 |
| | | Boolean businessLeaderFlag = SecurityUtils.checkPermissions("task:businessLeader"); |
| | | |
| | | for (TaskDaliyMongo taskDaliyMongo : daliyMongoList) { |
| | | TaskDaliyMongoDto dto = new TaskDaliyMongoDto(); |
| | | dto.setId(taskDaliyMongo.getId()); |
| | |
| | | dto.setSettlementStatus(taskDaliyMongo.getSettlementStatus()); |
| | | dto.setRemarks(taskDaliyMongo.getRemarks()); |
| | | dto.setTaskUserMongo(taskDaliyMongo.getTaskUserMongo()); |
| | | // 统计累计工时:仅支持业务组长 |
| | | if (businessLeaderFlag) { |
| | | Aggregation customerAgg = Aggregation.newAggregation( |
| | | Aggregation.match(Criteria.where("taskUserMongo").is(taskDaliyMongo.getTaskUserMongo()).and("fillDate").lte(taskDaliyMongo.getFillDate())), |
| | | Aggregation.project("consumedHours"), |
| | | Aggregation.group().sum("consumedHours").as("consumedHours") |
| | | ); |
| | | AggregationResults<Map> aggregate = mongoTemplate.aggregate(customerAgg, TaskDaliyMongo.class, Map.class); |
| | | dto.setAccumulateHours(Optional.ofNullable(aggregate.getMappedResults()).map(mr -> mr.get(0)).map(m -> Double.valueOf(m.getOrDefault("consumedHours", 0.00).toString())).orElse(0.00)); |
| | | } |
| | | resultList.add(dto); |
| | | } |
| | | return PageUtil.toPage(resultList, count); |
| | |
| | | export function getAll(params) { |
| | | return request({ |
| | | url: 'api/project/all' + '?' + qs.stringify(params, { indices: false }), |
| | | method: 'get', |
| | | params |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | |
| | | placeholder="员工" |
| | | :show-all-levels="false" |
| | | :collapse-tags="true" |
| | | @change="changeUserList" |
| | | class="cascader-item" |
| | | @change="changeUserList" |
| | | /> |
| | | <el-select v-model="query.projectId" filterable clearable placeholder="所属项目" :loading="loadingProject" style="width: 185px; margin-top: 6px;" class="filter-item" @change="queryProjectChange" @clear="clearQueryTasks"> |
| | | <el-option |
| | |
| | | <el-input v-model="query.name" filterable clearable placeholder="任务名称" style="width: 185px; margin-top: 6px;" class="filter-item" /> |
| | | |
| | | <rrOperation :crud="crud" /> |
| | | |
| | | <div style="color: red;">*检索条件【所属项目】仅包含状态为【进行中】的项目</div> |
| | | </div> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" :summary-method="getSummaries" show-summary @selection-change="crud.selectionChangeHandler"> |
| | |
| | | {{ scope.row.taskProgress }}% |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['task:businessLeader'])" :show-overflow-tooltip="true" prop="taskUserMongo.taskHours" label="计划工时" min-width="80px" /> |
| | | <el-table-column v-if="checkPer(['task:businessLeader'])" :show-overflow-tooltip="true" prop="accumulateHours" label="累计工时" min-width="80px" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="settlementStatus" min-width="80px" label="绩效类型"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.taskUserMongo.performanceType === "1" ? "绩效" : "非绩效" }}</el-tag> |
| | |
| | | import crudTaskDaliy from '@/api/task/taskDaliy' |
| | | 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 { mapGetters } from 'vuex' |
| | | import constant from '@/utils/constant' |
| | |
| | | const defaultForm = { id: null, projectId: null, taskId: null, taskName: null, taskMongoId: null, taskUserMongo: {}, userId: null, fillDate: null, consumedHours: null, todayFixedHours: 0, todayAttendanceHours: 0, 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: 'OtherDaliy', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | components: { pagination, rrOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | dicts: [constant.STANDARD_WORKLOAD_UNIT, constant.SETTLEMENT_STATUS], |
| | | cruds() { |
| | |
| | | options: [], |
| | | selectedValue: [], |
| | | |
| | | props: { multiple: true }, |
| | | props: { multiple: true } |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | ]) |
| | | }, |
| | | mounted() { |
| | | this.getUser(); |
| | | this.getQueryProject(); |
| | | this.getUser() |
| | | this.getQueryProject() |
| | | }, |
| | | methods: { |
| | | changeUserList(e) { |
| | |
| | | getQueryProject() { |
| | | this.loadingProject = true |
| | | this.queryProjects = [] |
| | | // 获取项目 |
| | | crudProject.getAll({projectStatusIn: 'project_status_not_started', projectStatusIn: 'project_status_under_way'}).then(res => { |
| | | // 获取项目(liableUserId传''用于占位) |
| | | crudProject.getAll({ projectStatusIn: ['project_status_under_way'], liableUserId: this.checkPer(['task:businessLeader']) ? '' : null }).then(res => { |
| | | // 检索项目列表 |
| | | this.queryProjects = res |
| | | this.loadingProject = false |
| | |
| | | }, |
| | | // 表格工时汇总 |
| | | getSummaries(param) { |
| | | const { columns, data } = param; |
| | | const sums = []; |
| | | sums[0] = '合计'; |
| | | const { columns, data } = param |
| | | const sums = [] |
| | | sums[0] = '合计' |
| | | columns.forEach((column, index) => { |
| | | if(column.property === 'consumedHours') { |
| | | const values = data.map(item => Number(item[column.property])); |
| | | if (column.property === 'consumedHours') { |
| | | const values = data.map(item => Number(item[column.property])) |
| | | if (!values.every(value => isNaN(value))) { |
| | | sums[index] = values.reduce((prev, curr) => { |
| | | const value = Number(curr); |
| | | if (!isNaN(value)) { |
| | | return prev + curr; |
| | | } else { |
| | | return prev; |
| | | } |
| | | }, 0); |
| | | sums[index] += ' 小时'; |
| | | const value = Number(curr) |
| | | if (!isNaN(value)) { |
| | | return prev + curr |
| | | } else { |
| | | return prev |
| | | } |
| | | }, 0) |
| | | sums[index] += ' 小时' |
| | | } else { |
| | | sums[index] = ''; |
| | | sums[index] = '' |
| | | } |
| | | } |
| | | }); |
| | | return sums; |
| | | }) |
| | | return sums |
| | | } |
| | | } |
| | | } |