|
@@ -887,6 +887,8 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
return projectTaskMapper.getAllProjectMonth(companyId);
|
|
return projectTaskMapper.getAllProjectMonth(companyId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
private void pushDurationAndProportion(List<Map<String, Object>> listData) {
|
|
private void pushDurationAndProportion(List<Map<String, Object>> listData) {
|
|
|
for (Map<String, Object> map : listData) {
|
|
for (Map<String, Object> map : listData) {
|
|
|
BigDecimal projectDuration = new BigDecimal(0);
|
|
BigDecimal projectDuration = new BigDecimal(0);
|
|
@@ -964,7 +966,108 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
map.put("data", new ArrayList<>(list));
|
|
map.put("data", new ArrayList<>(list));
|
|
|
listData.add(map);
|
|
listData.add(map);
|
|
|
}
|
|
}
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String importClockData(List<Map<Integer,String >> list) {
|
|
|
|
|
+ List<UserClockDataBo> userClockDataBos = clockDataToList(list);
|
|
|
|
|
+ StringBuilder res = new StringBuilder();
|
|
|
|
|
+ Long companyId = deptService.selectCompanyByDeptId();
|
|
|
|
|
+
|
|
|
|
|
+ for (UserClockDataBo userClockDataBo : userClockDataBos) {
|
|
|
|
|
+ SysUser sysUser=null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ sysUser = sysUserMapper.selectByNikeName(userClockDataBo.getUsername(), companyId);
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ res.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]查询异常,可能存在重名。");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (sysUser==null){
|
|
|
|
|
+ res.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]不存在。");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ List<UserClockDataDetailsBo> list1 = userClockDataBo.getList();
|
|
|
|
|
+ for (UserClockDataDetailsBo e : list1) {
|
|
|
|
|
+ String dateStr=DateUtils.LocalDateToStr(e.getDate());
|
|
|
|
|
+ List<ProjectStaffRecord> projectStaffRecords = projectStaffRecordMapper.selectByAidAndTime(sysUser.getUserId(), dateStr, dateStr + " 23:59:59");
|
|
|
|
|
+ if (projectStaffRecords==null|| projectStaffRecords.isEmpty()){
|
|
|
|
|
+ res.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]日期[").append(dateStr).append("]不存在。");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ for (ProjectStaffRecord psr : projectStaffRecords) {
|
|
|
|
|
+ ProjectStaffRecord update =new ProjectStaffRecord();
|
|
|
|
|
+ update.setId(psr.getId());
|
|
|
|
|
+ update.setCheckDuration(e.getDuration().doubleValue());
|
|
|
|
|
+ projectStaffRecordMapper.updateByPrimaryKeySelective(update);
|
|
|
|
|
+ res.append("<br/>").append("员工[").append(userClockDataBo.getUsername()).append("]日期[").append(dateStr).append("]修改成功。");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ return res.toString();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
+ public List<UserClockDataBo> clockDataToList(List<Map<Integer,String >> list) {
|
|
|
|
|
+ List<UserClockDataBo> listData = new ArrayList<>();
|
|
|
|
|
+ String title;
|
|
|
|
|
+ String title2;
|
|
|
|
|
+ //第一行标题
|
|
|
|
|
+ title = list.get(0).get(0);
|
|
|
|
|
+ System.out.println(title);
|
|
|
|
|
+ String[] split = title.split(" ");
|
|
|
|
|
+ String date =split[split.length - 1];
|
|
|
|
|
+ System.out.println(date);
|
|
|
|
|
+
|
|
|
|
|
+ //第二号生成信息
|
|
|
|
|
+ title2 = list.get(1).get(0);
|
|
|
|
|
+ System.out.println(title2);
|
|
|
|
|
+ //标题
|
|
|
|
|
+ List<String> title3 = new ArrayList<>(list.get(3).values());
|
|
|
|
|
+ title3 = title3.subList(36, title3.size() - 1);
|
|
|
|
|
+ System.out.println(title3);
|
|
|
|
|
+ //最大标签
|
|
|
|
|
+ int size = title3.size();
|
|
|
|
|
+ for (int i = 4; i < list.size() ; i++) {
|
|
|
|
|
+ Map map = list.get(i);
|
|
|
|
|
+ String name = (String) map.get(0);
|
|
|
|
|
+ List<String> list1 = new ArrayList<>();
|
|
|
|
|
+ List list2 = new ArrayList<>(map.values());
|
|
|
|
|
+ list2 = list2.subList(36, list2.size() - 1);
|
|
|
|
|
+ UserClockDataBo userClockDataBo = new UserClockDataBo();
|
|
|
|
|
+ userClockDataBo.setUsername(name);
|
|
|
|
|
+ List<UserClockDataDetailsBo> ul = new ArrayList<>();
|
|
|
|
|
+ int index = 0;
|
|
|
|
|
+ int day = 0;
|
|
|
|
|
+ for (Object o : list2) {
|
|
|
|
|
+ UserClockDataDetailsBo userClockDataDetailsBo = new UserClockDataDetailsBo();
|
|
|
|
|
+ String str = o.toString();
|
|
|
|
|
+ userClockDataDetailsBo.setDuration(new BigDecimal(str));
|
|
|
|
|
+ String s = title3.get(index);
|
|
|
|
|
+ userClockDataDetailsBo.setDateStr(s);
|
|
|
|
|
+ LocalDate localDate = LocalDate.parse(date);
|
|
|
|
|
+ if (s.equals("六")||s.equals("日")){
|
|
|
|
|
+ day++;
|
|
|
|
|
+ LocalDate localDate1 = localDate.withDayOfMonth(day);
|
|
|
|
|
+ userClockDataDetailsBo.setDate(localDate1);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ day=Integer.parseInt(s);
|
|
|
|
|
+ LocalDate localDate1 = localDate.withDayOfMonth(day);
|
|
|
|
|
+ userClockDataDetailsBo.setDate(localDate1);
|
|
|
|
|
+ }
|
|
|
|
|
+ ul.add(userClockDataDetailsBo);
|
|
|
|
|
+ if (list2.size() == index + 1){
|
|
|
|
|
+ index=0;
|
|
|
|
|
+ }else {
|
|
|
|
|
+ index++;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ userClockDataBo.setList(ul);
|
|
|
|
|
+ listData.add(userClockDataBo);
|
|
|
|
|
+ }
|
|
|
|
|
+ return listData;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|