Prechádzať zdrojové kódy

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

zhouyy 2 týždňov pred
rodič
commit
954d4b41f3

+ 3 - 4
fhKeeper/formulahousekeeper/collectdata/src/main/java/com/management/collectdata/controller/DataCollectController.java

@@ -478,11 +478,10 @@ public class DataCollectController {
     @RequestMapping("/getBusinessTripDataList")
     public List<BusinessTrip> getBusinessTripDataList(@RequestBody PageBO pageBO) {
         String sqlQuery = "select id,emp_no,emp_name,reason,begin_date,end_date,c_departure_place_city " +
-                " ,c_destination_place_city,trip_day,c_ccxm_no " +
+                " ,c_destination_place_city,trip_day,c_ccxm_name " +
                 " from att_business_trip_order abto " +
                 " where abto.audit_status = 3 and abto.is_delete = 0 and abto.create_date >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) order by id limit ?,? ";
 
-        SimpleDateFormat sdfAll = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         SimpleDateFormat sdfYmd = new SimpleDateFormat("yyyy-MM-dd");
         List<BusinessTrip> resList = new ArrayList<>();
         try (Connection connection = mysqlDataSource.getConnection()) {
@@ -494,7 +493,7 @@ public class DataCollectController {
             try (ResultSet resultSet = queryStmt.executeQuery()) {
                 while (resultSet.next()) {
                     BusinessTrip businessTrip = new BusinessTrip();
-                    businessTrip.setCCcxmNo(resultSet.getString("c_ccxm_no"));
+                    businessTrip.setCCcxmNo(resultSet.getString("c_ccxm_name"));
                     businessTrip.setCompanyId(companyId);
                     businessTrip.setWay(4);
                     businessTrip.setOwnerId(resultSet.getString("emp_no"));
@@ -506,7 +505,7 @@ public class DataCollectController {
                     businessTrip.setCityFrom(resultSet.getString("c_departure_place_city"));
                     businessTrip.setCityTo(resultSet.getString("c_destination_place_city"));
                     businessTrip.setDayCount(null==resultSet.getBigDecimal("trip_day")?null:resultSet.getBigDecimal("trip_day").setScale(0,RoundingMode.HALF_UP).intValue());
-                    businessTrip.setIndate(LocalDateTime.now());
+//                    businessTrip.setIndate(LocalDateTime.now());
                     businessTrip.setProcinstId(resultSet.getString("id"));
 
                     resList.add(businessTrip);

+ 23 - 10
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/tasks/taskCalendar.vue

@@ -41,21 +41,21 @@ const calendarOptions = ref<any>({
   plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin],
   locale: zhCnLocale,
   initialView: currentView.value,
-  slotMinTime: '06:00:00',  // 最早显示时间
-  slotMaxTime: '22:00:00',  // 最晚显示时间
-  slotDuration: '01:00:00', // 一个小时一格(timeGrid生效)
+  slotMinTime: '06:00:00',
+  slotMaxTime: '22:00:00',
+  slotDuration: '01:00:00',
   events: [],
-  headerToolbar: {  // 自定义头部
-    left: 'today,prev,next',  // 左侧按钮:上一页,下一页,今天
+  headerToolbar: {  
+    left: 'today,prev,next',
     center: 'title',
-    right: 'dayGridMonth,timeGridWeek,timeGridDay'  // 右侧显示视图切换按钮
+    right: 'dayGridMonth,timeGridWeek,timeGridDay'
   },
   slotLabelContent: (arg: any) => {
     const hour = arg.date.getHours()
     const meridiem = hour < 12 ? '上午' : '下午'
     return `${meridiem} ${hour} 时`
   },
-  datesSet: (arg: any) => { // 📌 每次切换视图或日期都会触发
+  datesSet: (arg: any) => {
     const { startStr = '', endStr = '' } = arg
     if (startStr && endStr) {
       dateForm.value = {
@@ -64,7 +64,7 @@ const calendarOptions = ref<any>({
       }
       getTaskCalendar()
     }
-  }
+  },
 })
 
 // 重新渲染表格数据
@@ -77,10 +77,13 @@ function renderTableData() {
         start: item.startDate,
         end: item.endDate,
         title: item.taskName,
+        backgroundColor: item.status == 1 ? item.color : ['#909399', '#075985', '#67C23A', '#F56C6C'][item.status],
+        borderColor:  item.status == 1 ? item.color : ['#909399', '#075985', '#67C23A', '#F56C6C'][item.status],
         // backgroundColor: ['#909399', '#075985', '#67C23A', '#F56C6C'][item.status],
         // borderColor: ['#909399', '#075985', '#67C23A', '#F56C6C'][item.status]
-        backgroundColor: ['#a6a9b0', '#3a7fc1', '#7fbf72', '#e28c8c'][item.status],
-        borderColor: ['#a6a9b0', '#3a7fc1', '#7fbf72', '#e28c8c'][item.status],
+
+        // backgroundColor: ['#a6a9b0', '#3a7fc1', '#7fbf72', '#e28c8c'][item.status],
+        // borderColor: ['#a6a9b0', '#3a7fc1', '#7fbf72', '#e28c8c'][item.status],
       }
     })
   }
@@ -130,5 +133,15 @@ defineExpose({
     white-space: normal !important;
     word-break: break-word;
   }
+
+  :deep(.fc-event-main) {
+    font-size: 20px;
+    text-align: center;
+  }
+
+  :deep(.fc-daygrid-day-events) {
+    font-size: 20px;
+    text-align: center;
+  }
 }
 </style> 

+ 2 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/BusinessTrip.java

@@ -127,8 +127,8 @@ public class BusinessTrip extends Model<BusinessTrip> {
      * 申请时间
      */
     @TableField("indate")
-    @DateTimeFormat(pattern = "yyyy-MM-dd")
-    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime indate;
 
     /**

+ 5 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -5333,7 +5333,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                             if (WorkDayCalculateUtils.isWorkDay(workDate)) {
                                 Map<String, Object> leaveMap = new HashMap<>();
                                 leaveMap.put("createDate", leaveDateStr);
-                                leaveMap.put("workingTime", MessageUtils.message("leave.leave")+leave.getTimeHours()+"h");
+                                if(leave.getTimeHours() >= timeType.getAllday()){
+                                    leaveMap.put("workingTime", MessageUtils.message("leave.leaveOfDay"));
+                                } else {
+                                    leaveMap.put("workingTime", MessageUtils.message("leave.leave")+leave.getTimeHours()+"h");
+                                }
                                 worktimeList.add(leaveMap);
                             }
                         }

+ 56 - 14
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/DataCollectTask.java

@@ -1,5 +1,6 @@
 package com.management.platform.task;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.entity.*;
@@ -583,6 +584,9 @@ public class DataCollectTask {
                             }
                             if(!CollectionUtils.isEmpty(toAddList)){
                                 for (Project project : toAddList) {
+                                    //以项目编码前五为作为分类名称
+                                    String categoryName = project.getProjectCode().substring(0,5);
+                                    project.setCategoryName(categoryName);
                                     ProjectCategory category = projectCategoryMapper.selectOne(new LambdaQueryWrapper<ProjectCategory>()
                                             .eq(ProjectCategory::getCompanyId, specialCompanyId)
                                             .eq(ProjectCategory::getName, project.getCategoryName())
@@ -702,7 +706,7 @@ public class DataCollectTask {
     }
 
     @Scheduled(cron = "0 0 3 * * ?")
-//@Scheduled(cron = "0 20 17 * * ?")
+//@Scheduled(cron = "0 57 9 * * ?")
     @Async
     public void businessTripTask(){
         if(isDev){return;}
@@ -723,6 +727,7 @@ public class DataCollectTask {
             } else {
                 System.out.println("请求失败,状态码: " + sumResponse.getStatusCode());
             }
+            System.out.println("出差数据:"+totalNum);
             if(totalNum > 0){
                 int pageSize = 1000;
                 int offset = 0;
@@ -756,35 +761,72 @@ public class DataCollectTask {
                             List<BusinessTrip> realDataList = dataList.stream().filter(t -> StringUtils.isNotBlank(t.getOwnerId())).collect(Collectors.toList());
                             if(!CollectionUtils.isEmpty(realDataList)){
                                 List<String> collect = realDataList.stream().map(BusinessTrip::getProcinstId).distinct().collect(Collectors.toList());
-                                List<String> existIds = businessTripMapper.getExistIds(collect,specialCompanyId);
-                                if(!CollectionUtils.isEmpty(existIds)){
-                                    toUpdateList.addAll(realDataList.stream().filter(t -> existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
-                                    toAddList.addAll(realDataList.stream().filter(t -> !existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
-                                }else{
-                                    toAddList.addAll(realDataList);
+                                List<BusinessTrip> existBTripList = businessTripMapper.selectList(new QueryWrapper<BusinessTrip>().in("procinst_id", collect));
+                                for (BusinessTrip businessTrip : realDataList) {
+                                    if (existBTripList.stream().anyMatch(t -> t.getProcinstId().equals(businessTrip.getProcinstId()))) {
+                                        businessTrip.setId(existBTripList.stream().filter(t -> t.getProcinstId().equals(businessTrip.getProcinstId())).findFirst().get().getId());
+                                        toUpdateList.add(businessTrip);
+                                    } else {
+                                        toAddList.add(businessTrip);
+                                    }
                                 }
+//                                if(existBTripList.size() > 0){
+//                                    toUpdateList.addAll(realDataList.stream().filter(t -> existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
+//                                    toAddList.addAll(realDataList.stream().filter(t -> !existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
+//                                }else{
+//                                    toAddList.addAll(realDataList);
+//                                }
                                 if(!CollectionUtils.isEmpty(toAddList)){
 //                                businessTripMapper.batchInsert(toAddList);
                                     for (BusinessTrip businessTrip : toAddList) {
                                         businessTripMapper.insert(businessTrip);
-                                        BustripProject bustripProject = new BustripProject();
-                                        bustripProject.setBustripId(businessTrip.getId());
-                                        Project project = projectCodeMap.get(businessTrip.getCCcxmNo());
-                                        bustripProject.setProjectId(null == project?null:project.getId());
-                                        bustripProject.setStartDate(businessTrip.getStartDate());
-                                        bustripProject.setEndDate(businessTrip.getEndDate());
-                                        bustripProjectMapper.insert(bustripProject);
+                                        if (!StringUtils.isEmpty(businessTrip.getCCcxmNo())) {
+                                            String[] split = businessTrip.getCCcxmNo().split(",");
+                                            for (String s : split) {
+                                                Project project = projectCodeMap.get(s);
+                                                if (project != null) {
+                                                    BustripProject bustripProject = new BustripProject();
+                                                    bustripProject.setBustripId(businessTrip.getId());
+                                                    bustripProject.setProjectId(project.getId());
+                                                    bustripProject.setStartDate(businessTrip.getStartDate());
+                                                    bustripProject.setEndDate(businessTrip.getEndDate());
+                                                    bustripProjectMapper.insert(bustripProject);
+                                                }
+                                            }
+                                        }
                                     }
                                 }
                                 if(!CollectionUtils.isEmpty(toUpdateList)){
                                     for (BusinessTrip tmp : toUpdateList) {
                                         businessTripMapper.updateById(tmp);
+                                        //检查出差项目
+                                        if (!StringUtils.isEmpty(tmp.getCCcxmNo())) {
+                                            String[] split = tmp.getCCcxmNo().split(",");
+                                            for (String s : split) {
+                                                Project project = projectCodeMap.get(s);
+                                                if (project != null) {
+                                                    //查找是否已经存在
+                                                    BustripProject existBustripProject = bustripProjectMapper.selectOne(
+                                                            new LambdaQueryWrapper<BustripProject>().eq(BustripProject::getBustripId, tmp.getId()).eq(BustripProject::getProjectId, project.getId()).between(BustripProject::getStartDate, tmp.getStartDate(), tmp.getEndDate()));
+                                                    if (existBustripProject == null) {
+                                                        BustripProject bustripProject = new BustripProject();
+                                                        bustripProject.setBustripId(tmp.getId());
+                                                        bustripProject.setProjectId(project.getId());
+                                                        bustripProject.setStartDate(tmp.getStartDate());
+                                                        bustripProject.setEndDate(tmp.getEndDate());
+                                                        bustripProjectMapper.insert(bustripProject);
+                                                    }
+                                                }
+                                            }
+                                        }
                                     }
                                 }
                             }
 
                             toUpdateList.clear();
                             toAddList.clear();
+                        } else {
+                            System.out.println("出差数据为空");
                         }
 
                     }