|
|
|
@ -128,11 +128,13 @@ public class BsEfficiencyTaskController extends BladeController { |
|
|
|
if (task.getStatus() == null || task.getStatus() != BsEfficiencyTaskEnum.STATUS_PENDING_APPROVAL.getCode()) { |
|
|
|
if (task.getStatus() == null || task.getStatus() != BsEfficiencyTaskEnum.STATUS_PENDING_APPROVAL.getCode()) { |
|
|
|
R.fail("当前绩效任务不能审批"); |
|
|
|
R.fail("当前绩效任务不能审批"); |
|
|
|
} |
|
|
|
} |
|
|
|
BsEfficiencyTaskEntity upd = new BsEfficiencyTaskEntity(); |
|
|
|
LambdaUpdateWrapper<BsEfficiencyTaskEntity> wrapper = new LambdaUpdateWrapper<>(); |
|
|
|
upd.setId(bsEfficiencyTask.getId()); |
|
|
|
wrapper.eq(BsEfficiencyTaskEntity::getId, bsEfficiencyTask.getId()) |
|
|
|
upd.setStatus(BsEfficiencyTaskEnum.STATUS_REJECTED.getCode()); |
|
|
|
.set(BsEfficiencyTaskEntity::getAttachId, null) |
|
|
|
upd.setRemark(bsEfficiencyTask.getRemark()); |
|
|
|
.set(BsEfficiencyTaskEntity::getReportTime, null) |
|
|
|
return R.status(bsEfficiencyTaskService.saveOrUpdate(upd)); |
|
|
|
.set(BsEfficiencyTaskEntity::getRemark, bsEfficiencyTask.getRemark()) |
|
|
|
|
|
|
|
.set(BsEfficiencyTaskEntity::getStatus, BsEfficiencyTaskEnum.STATUS_REJECTED.getCode()); |
|
|
|
|
|
|
|
return R.status(bsEfficiencyTaskService.update(null, wrapper)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -161,6 +163,7 @@ public class BsEfficiencyTaskController extends BladeController { |
|
|
|
upd.setId(bsEfficiencyTask.getId()); |
|
|
|
upd.setId(bsEfficiencyTask.getId()); |
|
|
|
upd.setAttachId(bsEfficiencyTask.getAttachId()); |
|
|
|
upd.setAttachId(bsEfficiencyTask.getAttachId()); |
|
|
|
upd.setStatus(BsEfficiencyTaskEnum.STATUS_FINISHED.getCode()); |
|
|
|
upd.setStatus(BsEfficiencyTaskEnum.STATUS_FINISHED.getCode()); |
|
|
|
|
|
|
|
upd.setReportTime(new Date()); |
|
|
|
return R.status(bsEfficiencyTaskService.saveOrUpdate(upd)); |
|
|
|
return R.status(bsEfficiencyTaskService.saveOrUpdate(upd)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -187,6 +190,7 @@ public class BsEfficiencyTaskController extends BladeController { |
|
|
|
LambdaUpdateWrapper<BsEfficiencyTaskEntity> wrapper = new LambdaUpdateWrapper<>(); |
|
|
|
LambdaUpdateWrapper<BsEfficiencyTaskEntity> wrapper = new LambdaUpdateWrapper<>(); |
|
|
|
wrapper.eq(BsEfficiencyTaskEntity::getId, bsEfficiencyTask.getId()) |
|
|
|
wrapper.eq(BsEfficiencyTaskEntity::getId, bsEfficiencyTask.getId()) |
|
|
|
.set(BsEfficiencyTaskEntity::getAttachId, null) |
|
|
|
.set(BsEfficiencyTaskEntity::getAttachId, null) |
|
|
|
|
|
|
|
.set(BsEfficiencyTaskEntity::getReportTime, null) |
|
|
|
.set(BsEfficiencyTaskEntity::getStatus, BsEfficiencyTaskEnum.STATUS_IN_PROGRESS.getCode()); |
|
|
|
.set(BsEfficiencyTaskEntity::getStatus, BsEfficiencyTaskEnum.STATUS_IN_PROGRESS.getCode()); |
|
|
|
return R.status(bsEfficiencyTaskService.update(null, wrapper)); |
|
|
|
return R.status(bsEfficiencyTaskService.update(null, wrapper)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -247,53 +251,47 @@ public class BsEfficiencyTaskController extends BladeController { |
|
|
|
return checkR; |
|
|
|
return checkR; |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
List<LinkedHashMap<String, Object>> mapList = EasyExcelUtil.read(file); |
|
|
|
Map<String, Object> readResult = EasyExcelUtil.read(file); |
|
|
|
List<LinkedHashMap<String, Object>> tableDataList = new ArrayList<>(); |
|
|
|
List<LinkedHashMap<String, Object>> mapList = (List<LinkedHashMap<String, Object>>) readResult.get("data"); |
|
|
|
|
|
|
|
Map<Integer, String> excelHeadMap = (Map<Integer, String>) readResult.get("head"); |
|
|
|
|
|
|
|
List<String> excelParamNames = excelHeadMap.entrySet().stream() |
|
|
|
|
|
|
|
.sorted(Map.Entry.comparingByKey()) |
|
|
|
|
|
|
|
.map(Map.Entry::getValue) |
|
|
|
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
if (excelParamNames.size() != paramNames.size()) { |
|
|
|
|
|
|
|
return R.fail("上传文件与模板不一致!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Set<String> paramSet = new HashSet<>(paramNames); |
|
|
|
|
|
|
|
Set<String> excelParamSet = new HashSet<>(excelParamNames); |
|
|
|
|
|
|
|
if (!paramSet.equals(excelParamSet)) { |
|
|
|
|
|
|
|
return R.fail("上传文件与模板不一致!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int num = 1; |
|
|
|
|
|
|
|
LinkedHashMap<String, String> headMap = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
for (String key : excelParamNames) { |
|
|
|
|
|
|
|
if (this.EMPLOYEE_CODE.equals(key)) { |
|
|
|
|
|
|
|
headMap.put(this.EMPLOYEE_CODE, "employeeCode"); |
|
|
|
|
|
|
|
} else if (this.EMPLOYEE_NAME.equals(key)) { |
|
|
|
|
|
|
|
headMap.put(this.EMPLOYEE_NAME, "employeeName"); |
|
|
|
|
|
|
|
} else if (this.TOTAL_SCORE.equals(key)) { |
|
|
|
|
|
|
|
headMap.put(this.TOTAL_SCORE, "totalScore"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
headMap.put(key, "temp" + num); |
|
|
|
|
|
|
|
num++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
List<LinkedHashMap<String, Object>> tableColumnList = new ArrayList<>(); |
|
|
|
List<LinkedHashMap<String, Object>> tableColumnList = new ArrayList<>(); |
|
|
|
|
|
|
|
for (Map.Entry<String, String> entry : headMap.entrySet()) { |
|
|
|
|
|
|
|
LinkedHashMap<String, Object> tableColumn = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
tableColumn.put("label", entry.getKey()); |
|
|
|
|
|
|
|
tableColumn.put("prop", entry.getValue()); |
|
|
|
|
|
|
|
tableColumnList.add(tableColumn); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<LinkedHashMap<String, Object>> tableDataList = new ArrayList<>(); |
|
|
|
if (!CollectionUtils.isEmpty(mapList)) { |
|
|
|
if (!CollectionUtils.isEmpty(mapList)) { |
|
|
|
LinkedHashMap<String, Object> firstMap = mapList.get(0); |
|
|
|
|
|
|
|
int num = 1; |
|
|
|
|
|
|
|
LinkedHashMap<String, String> headMap = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
for (String key : firstMap.keySet()) { |
|
|
|
|
|
|
|
if (this.EMPLOYEE_CODE.equals(key)) { |
|
|
|
|
|
|
|
headMap.put(this.EMPLOYEE_CODE, "employeeCode"); |
|
|
|
|
|
|
|
} else if (this.EMPLOYEE_NAME.equals(key)) { |
|
|
|
|
|
|
|
headMap.put(this.EMPLOYEE_NAME, "employeeName"); |
|
|
|
|
|
|
|
} else if (this.TOTAL_SCORE.equals(key)) { |
|
|
|
|
|
|
|
headMap.put(this.TOTAL_SCORE, "totalScore"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
headMap.put(key, "temp" + num); |
|
|
|
|
|
|
|
num++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<String> missingFields = new ArrayList<>(); |
|
|
|
|
|
|
|
for (String requiredField : paramNames) { |
|
|
|
|
|
|
|
if (!headMap.containsKey(requiredField)) { |
|
|
|
|
|
|
|
missingFields.add(requiredField); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 如果有缺失字段
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(missingFields)) { |
|
|
|
|
|
|
|
return R.fail("上传文件与模板不一致!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (Map.Entry<String, String> entry : headMap.entrySet()) { |
|
|
|
|
|
|
|
String excelHeadName = entry.getKey(); |
|
|
|
|
|
|
|
if (!paramNames.contains(excelHeadName)) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
LinkedHashMap<String, Object> tableColumn = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
tableColumn.put("label", entry.getKey()); |
|
|
|
|
|
|
|
tableColumn.put("prop", entry.getValue()); |
|
|
|
|
|
|
|
tableColumnList.add(tableColumn); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (LinkedHashMap<String, Object> map : mapList) { |
|
|
|
for (LinkedHashMap<String, Object> map : mapList) { |
|
|
|
LinkedHashMap<String, Object> tableData = new LinkedHashMap<>(); |
|
|
|
LinkedHashMap<String, Object> tableData = new LinkedHashMap<>(); |
|
|
|
for (Map.Entry<String, String> entry : headMap.entrySet()) { |
|
|
|
for (Map.Entry<String, String> entry : headMap.entrySet()) { |
|
|
|
String excelHeadName = entry.getKey(); |
|
|
|
|
|
|
|
if (!paramNames.contains(excelHeadName)) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
tableData.put(entry.getValue(), map.get(entry.getKey())); |
|
|
|
tableData.put(entry.getValue(), map.get(entry.getKey())); |
|
|
|
} |
|
|
|
} |
|
|
|
R<UserInfo> userInfoResult = userClient.userInfoByCode((String) tableData.get("employeeCode")); |
|
|
|
R<UserInfo> userInfoResult = userClient.userInfoByCode((String) tableData.get("employeeCode")); |
|
|
|
@ -304,9 +302,9 @@ public class BsEfficiencyTaskController extends BladeController { |
|
|
|
} |
|
|
|
} |
|
|
|
tableDataList.add(tableData); |
|
|
|
tableDataList.add(tableData); |
|
|
|
} |
|
|
|
} |
|
|
|
resultMap.put("tableColumn", tableColumnList); |
|
|
|
|
|
|
|
resultMap.put("tableData", tableDataList); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
resultMap.put("tableColumn", tableColumnList); |
|
|
|
|
|
|
|
resultMap.put("tableData", tableDataList); |
|
|
|
return R.data(resultMap); |
|
|
|
return R.data(resultMap); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -398,6 +396,7 @@ public class BsEfficiencyTaskController extends BladeController { |
|
|
|
upd.setId(bsEfficiencyTask.getId()); |
|
|
|
upd.setId(bsEfficiencyTask.getId()); |
|
|
|
upd.setAttachId(bsEfficiencyTask.getAttachId()); |
|
|
|
upd.setAttachId(bsEfficiencyTask.getAttachId()); |
|
|
|
upd.setStatus(BsEfficiencyTaskEnum.STATUS_PENDING_APPROVAL.getCode()); |
|
|
|
upd.setStatus(BsEfficiencyTaskEnum.STATUS_PENDING_APPROVAL.getCode()); |
|
|
|
|
|
|
|
upd.setReportTime(new Date()); |
|
|
|
return R.status(bsEfficiencyTaskService.saveOrUpdate(upd)); |
|
|
|
return R.status(bsEfficiencyTaskService.saveOrUpdate(upd)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|