| | |
| | | } |
| | | |
| | | |
| | | |
| | | private void generatorStaffTask(InspectionPlanDto tmpInspectionPlanDto, TaskDto taskDto, CommunityDto communityDto, |
| | | InspectionPlanStaffDto tmpInspectionPlanStaffDto, List<InspectionTaskPo> inspectionTaskPos, |
| | | List<InspectionTaskDetailPo> inspectionTaskDetailPos) { |
| | |
| | | switch (inspectionPlanPeriod) { |
| | | case InspectionPlanDto.INSPECTION_PLAN_PERIOD_DAY: |
| | | hasCondition = hasGeneratorTaskConditionByDay(tmpInspectionPlanDto, taskDto, communityDto, tmpInspectionPlanStaffDto, inspectionTaskPos, inspectionTaskDetailPos); |
| | | break; |
| | | break; |
| | | case InspectionPlanDto.INSPECTION_PLAN_PERIOD_WEEK: |
| | | hasCondition = hasGeneratorTaskConditionByWeek(tmpInspectionPlanDto, taskDto, communityDto, tmpInspectionPlanStaffDto, inspectionTaskPos, inspectionTaskDetailPos); |
| | | break; |
| | |
| | | String[] months = tmpInspectionPlanDto.getInspectionMonth().split(","); |
| | | |
| | | Calendar today = Calendar.getInstance(); |
| | | int month = today.get(Calendar.MONTH)+1; |
| | | if(!Arrays.asList(months).contains(month+"")){ |
| | | int month = today.get(Calendar.MONTH) + 1; |
| | | if (!Arrays.asList(months).contains(month + "")) { |
| | | return false; |
| | | } |
| | | String[] days = tmpInspectionPlanDto.getInspectionDay().split(","); |
| | | int day = today.get(Calendar.DAY_OF_MONTH); |
| | | if(!Arrays.asList(days).contains(day+"")){ |
| | | if (!Arrays.asList(days).contains(day + "")) { |
| | | return false; |
| | | } |
| | | |
| | |
| | | |
| | | int beforeTime = Integer.parseInt(tmpInspectionPlanDto.getBeforeTime()); |
| | | |
| | | String planTime = DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_B) + " "+tmpInspectionPlanDto.getStartTime()+":00"; |
| | | String planTime = DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_B) + " " + tmpInspectionPlanDto.getStartTime(); |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(DateUtil.getDateFromStringA(planTime)); |
| | | calendar.add(Calendar.MINUTE,beforeTime*(-1)); |
| | | if(DateUtil.getCurrentDate().before(calendar.getTime())){ // 还没到生成任务时间 |
| | | calendar.add(Calendar.MINUTE, beforeTime * (-1)); |
| | | if (DateUtil.getCurrentDate().before(calendar.getTime())) { // 还没到生成任务时间 |
| | | return false; |
| | | } |
| | | |
| | |
| | | scheduleClassesStaffDto.setToday(DateUtil.getDateFromStringA(planTime)); |
| | | scheduleClassesStaffDto = scheduleClassesStaffV1InnerServiceSMOImpl.staffIsWork(scheduleClassesStaffDto); |
| | | |
| | | if(!scheduleClassesStaffDto.isWork()){//根据排班员工 休息 |
| | | if (!scheduleClassesStaffDto.isWork()) {//根据排班员工 休息 |
| | | return false; |
| | | |
| | | } |
| | |
| | | return true; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 每周 |
| | | * |
| | |
| | | * @param communityDto |
| | | */ |
| | | private boolean hasGeneratorTaskConditionByWeek(InspectionPlanDto tmpInspectionPlanDto, TaskDto taskDto, CommunityDto communityDto, |
| | | InspectionPlanStaffDto tmpInspectionPlanStaffDto, List<InspectionTaskPo> inspectionTaskPos, |
| | | List<InspectionTaskDetailPo> inspectionTaskDetailPos) { |
| | | InspectionPlanStaffDto tmpInspectionPlanStaffDto, List<InspectionTaskPo> inspectionTaskPos, |
| | | List<InspectionTaskDetailPo> inspectionTaskDetailPos) { |
| | | |
| | | // 检查 今日是否 需要 生成巡检任务 |
| | | String[] workday = tmpInspectionPlanDto.getInspectionWorkday().split(","); |
| | |
| | | day = 7; |
| | | } |
| | | } |
| | | if(!Arrays.asList(workday).contains(day+"")){ |
| | | if (!Arrays.asList(workday).contains(day + "")) { |
| | | return false; |
| | | } |
| | | |
| | | //当前时间是否 到了 巡检任务前30分钟 |
| | | int beforeTime = Integer.parseInt(tmpInspectionPlanDto.getBeforeTime()); |
| | | |
| | | String planTime = DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_B)+" "+tmpInspectionPlanDto.getStartTime()+":00"; |
| | | String planTime = DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_B) + " " + tmpInspectionPlanDto.getStartTime() + ":00"; |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(DateUtil.getDateFromStringA(planTime)); |
| | | calendar.add(Calendar.MINUTE,beforeTime*(-1)); |
| | | if(DateUtil.getCurrentDate().before(calendar.getTime())){ // 还没到生成任务时间 |
| | | calendar.add(Calendar.MINUTE, beforeTime * (-1)); |
| | | if (DateUtil.getCurrentDate().before(calendar.getTime())) { // 还没到生成任务时间 |
| | | return false; |
| | | } |
| | | |
| | |
| | | scheduleClassesStaffDto.setToday(DateUtil.getDateFromStringA(planTime)); |
| | | scheduleClassesStaffDto = scheduleClassesStaffV1InnerServiceSMOImpl.staffIsWork(scheduleClassesStaffDto); |
| | | |
| | | if(!scheduleClassesStaffDto.isWork()){//根据排班员工 休息 |
| | | if (!scheduleClassesStaffDto.isWork()) {//根据排班员工 休息 |
| | | return false; |
| | | |
| | | } |
| | | |
| | | InspectionTaskDto inspectionTaskDto = new InspectionTaskDto(); |
| | | inspectionTaskDto.setCommunityId(tmpInspectionPlanDto.getCommunityId()); |
| | | //inspectionTaskDto.setInspectionPlanId(tmpInspectionPlanDto.getInspectionPlanId()); |
| | | //inspectionTaskDto.setInspectionPlanId(tmpInspectionPlanDto.getInspectionPlanId()); |
| | | //这里修改为用原始 巡检人查 以防 做了 转单 |
| | | inspectionTaskDto.setInspectionPlanId(tmpInspectionPlanDto.getInspectionPlanId()); |
| | | inspectionTaskDto.setOriginalPlanUserId(tmpInspectionPlanStaffDto.getStaffId()); |