Beispiel #1
0
    def satisfaction_survey(self, request, pk=None, *args, **kwargs):
        """
        满意度调查
        :param request:
        :param pk:
        :return:
        """
        data = self.request.data

        satisfaction_level = data.get("satisfaction_level")
        customer_feedback = data.get("customer_feedback")
        invest_start = data.get("invest_start")
        invest_end = data.get("invest_end")
        enclosure = data.get("enclosure")

        log_id = OpenStationViewSet.create_base_log(request, pk, "培训管理", 3)
        matter_log = MatterLog()
        matter_log.status_change(pk, log_id, 12)

        matter = Matter.objects.get(pk=pk)
        matter.satisfaction_level = satisfaction_level
        matter.customer_feedback = customer_feedback
        matter.invest_start = invest_start
        matter.invest_end = invest_end
        matter.matter_status = 12
        matter.save()
        if enclosure != []:
            # 新增附件
            SimpleMatterViewsets.create_attachment(enclosure, "满意度调查", 1, pk)

        return Response({"info": "满意度调查添加成功"}, status=status.HTTP_200_OK)
Beispiel #2
0
    def termination_training(self, request, pk=None, *args, **kwargs):
        """
        终止培训
        :param request:
        :param pk:
        :param args:
        :param kwargs:
        :return:
        """
        data = self.request.data
        verify = self.verify_teacher(request, pk)
        if verify == 0 and request.user.is_superuser is False:
            return Response({"error": "该问题的培训老师不是您,无权操作!"}, status=status.HTTP_400_BAD_REQUEST)
        # 终止原因
        termination_reason = data.get("termination_reason")
        # 上传附件返回的数据
        enclosure = data.get("enclosure")
        # 改动记录
        log_id = OpenStationViewSet.create_base_log(request, pk, "培训管理", 3)
        mat_log = MatterLog()
        mat_log.status_change(pk, log_id, 7)

        matter = Matter.objects.get(pk=pk)
        matter.termination_reason = termination_reason
        matter.matter_status = 7
        matter.save()
        if enclosure != []:
            SimpleMatterViewsets.create_attachment(enclosure, "客户终止培训", 1, pk)
        return Response({"info": "客户终止培训成功"}, status=status.HTTP_200_OK)
Beispiel #3
0
    def handover_issues(self, request, pk=None, *args, **kwargs):
        """
        遗留问题交接
        :param request:
        :param pk:
        :return:
        """
        verify = self.verify_teacher(request, pk)
        if verify == 0 and request.user.is_superuser is False:
            return Response({"error": "该问题的培训老师不是您,无权操作!"}, status=status.HTTP_400_BAD_REQUEST)
        data = self.request.data
        dealing_person = data.get("dealing_person")
        problem_description = data.get("problem_description")
        enclosure = data.get("enclosure")

        dealing_person = self.get_user(dealing_person)
        log_id = OpenStationViewSet.create_base_log(request, pk, "培训管理", 3)
        matter_log = MatterLog()
        matter_log.status_change(pk, log_id, 9)

        matter = Matter.objects.get(pk=pk)
        matter.dealing_person = dealing_person
        matter.problem_description = problem_description
        matter.matter_status = 9
        matter.save()
        if enclosure != []:
            SimpleMatterViewsets.create_attachment(enclosure, "遗留问题交接", 1, pk)

        return Response({"info": "遗留问题交接完成"}, status=status.HTTP_200_OK)
Beispiel #4
0
    def create_train(self, request):
        data = request.data
        # 企业id
        company_pk = data.get("company_pk")
        # 问题类型
        matter_type = data.get("matter_type")
        # 经办人
        # responsible = data.get("responsible")
        # 问题名称
        matter_name = data.get("matter_name")
        # 培训方式
        training_method = data.get("training_method")
        # 客户状态描述
        description_customer = data.get("description_customer")
        # 已上线模块
        online_module = data.get("online_module")
        # 未上线模块
        unonline_module = data.get("unonline_module")
        # 培训联系人
        training_contact = data.get("training_contact")
        # 培训联系人电话
        training_contactnum = data.get("training_contactnum")
        # 培训联系人QQ
        training_contactqq = data.get("training_contactqq")
        # 培训联系人职位
        training_position = data.get("training_position")

        # company_matter = CompanyInfo.objects.get(pk=company_pk)
        # 获取当前登录用户
        responsibler = request.user

        train_dict = {
            "matter_type": matter_type,
            "responsible": responsibler,
            "matter_name": matter_name,
            "training_method": training_method,
            "description_customer": description_customer,
            "online_module": online_module,
            "unonline_module": unonline_module,
            "training_contact": training_contact,
            "training_contactnum": training_contactnum,
            "training_contactqq": training_contactqq,
            "training_position": training_position,
            "matter_status": 1,
            "company_matter": company_pk
        }
        ret = Matter.objects.create(**train_dict)
        # 改动记录
        ret = str(ret)
        log_id = OpenStationViewSet.create_base_log(request, ret, "培训管理", 3)
        ma_log = MatterLog()
        ma_log.create_log(log_id,'创建问题', '创建问题')
        return Response(data={"info": "问题创建成功"}, status=status.HTTP_200_OK)
Beispiel #5
0
    def create(self, request, *args, **kwargs):
        """
        产品配置创建
        :param request:
        :return:
        """
        data = request.data
        # 子站点
        children_station = data.get("children_station")
        # 客户库id
        khk_id = data.get("khk_id")
        # 工单主题
        workorder_theme = data.get("workorder_theme")
        # 所属模块
        subordinatemodule = data.get("subordinatemodule")
        # 功能名称
        func_name = data.get("func_name")
        # 功能选项值
        func_value = data.get("func_value")
        # 描述
        describe = data.get("describe")
        # 附件
        enclosure = data.get("enclosure")

        # 获取开站id
        open_id = OpenStationManage.objects.get(company_info=khk_id).id

        product_dict = {
            "children_station": children_station,
            "open_id": open_id,
            "workorder_theme": workorder_theme,
            "subordinatemodule": subordinatemodule,
            "func_name": func_name,
            "func_value": func_value,
            "describe": describe,
            "product_stautus": 3,
            "khk_id": khk_id
        }

        ret = ProductConfig.objects.create(**product_dict)
        # 改动记录
        log_id = OpenStationViewSet.create_base_log(request, ret.id, "产品配置管理",
                                                    3)
        ma_log = MatterLog()
        ma_log.create_log(log_id, '创建产品配置', '创建产品配置')
        if enclosure != [] or enclosure != '[]':
            SimpleMatterViewsets.create_attachment(enclosure, "新增产品配置", 2,
                                                   ret.id)
        return Response({"info": "产品配置创建成功"}, status=status.HTTP_200_OK)
Beispiel #6
0
    def set_pending(self, request, pk=None, *args, **kwargs):
        """
        状态挂起
        :param request:
        :param pk:
        :return:
        """
        verify = self.verify_teacher(request, pk)
        # 改动记录
        log_id = OpenStationViewSet.create_base_log(request, pk, "培训管理", 3)
        mat_log = MatterLog()
        mat_log.status_change(pk, log_id, 6)
        if verify == 0 and request.user.is_superuser is False:
            return Response({"error": "该问题的培训老师不是您,无权操作!"}, status=status.HTTP_400_BAD_REQUEST)
        ret = Matter.objects.filter(pk=pk).update(matter_status=6)

        return Response({"info": "培训已挂起"}, status=status.HTTP_200_OK)
Beispiel #7
0
    def personnel_allocation(self, request, pk=None, *args, **kwargs):
        """
        调查人员分配
        :param request:
        :param pk:
        :return:
        """
        data = self.request.data
        investigador = data.get("investigador")
        # 获取用户实例
        investigador = self.get_user(investigador)
        log_id = OpenStationViewSet.create_base_log(request, pk, "培训管理", 3)
        matter_log = MatterLog()
        matter_log.status_change(pk, log_id, 11)

        matter = Matter.objects.get(pk=pk)
        matter.investigador = investigador
        matter.matter_status = 11
        matter.save()

        return Response({"info": "调查人员分配成功"}, status=status.HTTP_200_OK)
Beispiel #8
0
    def identification_issues(self, request, pk=None, *args, **kwargs):
        """
        遗留问题确认
        :param request:
        :param pk:
        :return:
        """
        dealing_person = Matter.objects.get(pk=pk).dealing_person
        if dealing_person != request.user and request.user.is_superuser is False:
            return Response({"error": "您不是该问题的处理人,无权操作!"}, status=status.HTTP_400_BAD_REQUEST)
        data = self.request.data
        problem_description = data.get("problem_description")
        enclosure = data.get("enclosure")
        log_id = OpenStationViewSet.create_base_log(request, pk, "培训管理", 3)
        matter_log = MatterLog()
        matter_log.status_change(pk, log_id, 10)
        matter_log.matter_describe(pk, log_id, problem_description)

        matter = Matter.objects.get(pk=pk)
        matter.problem_description = problem_description
        matter.matter_status = 10
        matter.save()
        if enclosure != []:
            atta = Attachment.objects.create(enclosure=enclosure, step_atta="遗留问题确认", atta_matter=matter)

        return Response({"info": "遗留问题确认成功"}, status=status.HTTP_200_OK)
Beispiel #9
0
    def trainning(self, request, pk=None, *args, **kwargs):
        """
        培训
        :param request:
        :param pk:
        :return:
        """
        verify = self.verify_teacher(request, pk)
        if verify == 0 and request.user.is_superuser is False:
            return Response({"error": "该问题的培训老师不是您,无权操作!"}, status=status.HTTP_400_BAD_REQUEST)
        data = self.request.data

        training_model = data.get("training_model")
        start_time = data.get("start_time")
        end_time = data.get("end_time")
        # 是否有遗留问题
        legacy_issue = data.get("legacy_issue")
        enclosure = data.get("enclosure")
        # 改动记录
        log_id = OpenStationViewSet.create_base_log(request, pk, "培训管理", 3)
        matter_log = MatterLog()
        matter_log.status_change(pk, log_id, 8)
        matter_log.date_change(pk, log_id, start_time, end_time)

        matter = Matter.objects.get(pk=pk)
        matter.training_model = training_model
        matter.start_time = start_time
        matter.end_time = end_time
        matter.legacy_issue = legacy_issue
        matter.matter_status = 8
        matter.save()
        if enclosure != []:
            SimpleMatterViewsets.create_attachment(enclosure, "培训", 1, pk)
        return Response({"info": "培训完成"}, status=status.HTTP_200_OK)
Beispiel #10
0
    def determine_scheduling(self, request, pk=None, *args, **kwargs):
        """
        确定排期
        :param request:
        :param pk:
        :return:
        """
        verify = self.verify_teacher(request, pk)
        if verify == 0 and request.user.is_superuser is False:
            return Response({"error": "该问题的培训老师不是您,无权操作!"}, status=status.HTTP_400_BAD_REQUEST)
        data = self.request.data

        start_time = data.get("start_time")
        end_time = data.get("end_time")
        # 改动记录
        log_id = OpenStationViewSet.create_base_log(request, pk, "培训管理", 3)
        matter_log = MatterLog()
        matter_log.status_change(pk, log_id, 4)
        matter_log.date_change(pk, log_id, start_time, end_time)

        matter = Matter.objects.get(pk=pk)
        matter.start_time = start_time
        matter.end_time = end_time
        matter.matter_status = 4
        matter.save()
        return Response({"info": "确定排期成功"}, status=status.HTTP_200_OK)
Beispiel #11
0
    def distribution_lecturer(self, request, pk=None, *args, **kwargs):
        """
        分配讲师
        :param request:
        :param pk:
        :return:
        """
        data = self.request.data

        instructors = data.get("training_instructors")
        enclosure = data.get("enclosure")

        training_instructors = self.get_user(instructors)
        # 变更记录
        log_id = OpenStationViewSet.create_base_log(request, pk, "培训管理", 3)
        mat_log = MatterLog()
        # 记录老师变更
        mat_log.teacher_change(pk, log_id, instructors)
        # 记录状态变更
        mat_log.status_change(pk, log_id, 2)

        matter = Matter.objects.get(pk=pk)
        matter.training_instructors = training_instructors
        matter.matter_status = 2

        matter.save()
        if enclosure != []:
            SimpleMatterViewsets.create_attachment(enclosure,"分配讲师", 1, pk)
        return Response({"info": "讲师分配成功"}, status=status.HTTP_200_OK)
Beispiel #12
0
    def communication_requirements(self, request, pk=None, *args, **kwargs):
        """
        创建沟通需求
        :param request:
        :param pk:
        :return:
        """
        verify = self.verify_teacher(request, pk)
        if verify == 0 and request.user.is_superuser is False:
            return Response({"error": "该问题的培训老师不是您,无权操作!"}, status=status.HTTP_400_BAD_REQUEST)

        data = self.request.data
        instructors = data.get("training_instructors")
        # 培训联系人
        training_contact = data.get("training_contact")
        # 培训联系人电话
        training_contactnum = data.get("training_contactnum")
        # 培训联系人QQ
        training_contactqq = data.get("training_contactqq")
        # 培训联系人职位
        training_position = data.get("training_position")
        # 客户培训需求
        customer_training_needs = data.get("customer_training_needs")
        # 沟通方式
        communication_way = data.get("communication_way")
        # 最终培训方式
        final_training_method = data.get("final_training_method")
        # 培训预计开始时间
        start_time = data.get("start_time")
        # 培训预计结束时间
        end_time = data.get("end_time")
        # 未培训原因
        untrained_cause = data.get("untrained_cause")

        training_instructors = self.get_user(instructors)
        # 改动记录
        log_id = OpenStationViewSet.create_base_log(request, pk, "培训管理", 3)
        mat_log = MatterLog()
        mat_log.train_contact(pk, data, log_id)
        mat_log.status_change(pk, log_id, 4)

        matter = Matter.objects.get(pk=pk)
        matter.training_instructors = training_instructors
        matter.training_contact = training_contact
        matter.training_contactnum = training_contactnum
        matter.training_contactqq = training_contactqq
        matter.training_position = training_position
        matter.customer_training_needs = customer_training_needs
        matter.communication_way = communication_way
        matter.final_training_method = final_training_method
        if start_time != '':
            matter.start_time = str_to_date(start_time)
        if end_time != '':
            matter.end_time = str_to_date(end_time)
        matter.untrained_cause = untrained_cause
        matter.matter_status = 4
        matter.save()

        return Response({"info": "沟通培训需求创建成功"}, status=status.HTTP_200_OK)
Beispiel #13
0
    def reject(self, request, pk=None, *args, **kwargs):
        """
        驳回
        :param request:
        :param pk:
        :param args:
        :param kwargs:
        :return:
        """
        data = self.request.data
        dismiss_reason = data.get("dismiss_reason")
        # 状态变更记录
        log_id = OpenStationViewSet.create_base_log(request, pk, "培训管理", 3)
        matter_log = MatterLog()
        matter_log.status_change(pk, log_id, 3)
        matter_log.reject_change(pk, dismiss_reason, log_id)

        matter = Matter.objects.get(pk=pk)
        matter.matter_status = 3
        matter.save()
        reject = Reject.objects.create(dismiss_reason=dismiss_reason, correlation_id=pk, reject_type=1)

        return Response({"info": "驳回成功"}, status=status.HTTP_200_OK)
Beispiel #14
0
    def training_prepare(self, request, pk=None, *args, **kwargs):
        """
        培训准备
        :param request:
        :param pk:
        :return:
        """
        verify = self.verify_teacher(request, pk)
        if verify == 0 and request.user.is_superuser is False:
            return Response({"error": "该问题的培训老师不是您,无权操作!"}, status=status.HTTP_400_BAD_REQUEST)
        data = self.request.data

        instructors = data.get("training_instructors")
        enclosure = data.get("enclosure")
        start_time = data.get("start_time")
        end_time = data.get("end_time")

        training_instructors = self.get_user(instructors)
        # 改动记录
        log_id = OpenStationViewSet.create_base_log(request, pk, "培训管理", 3)
        matter_log = MatterLog()
        matter_log.status_change(pk, log_id, 5)
        matter_log.date_change(pk, log_id, start_time, end_time)

        matter = Matter.objects.get(pk=pk)
        matter.training_instructors = training_instructors
        matter.start_time = start_time
        matter.end_time = end_time
        matter.matter_status = 5
        matter.save()

        if enclosure != []:
            # 保存附件
            SimpleMatterViewsets.create_attachment(enclosure, "培训准备", 1, pk)

        return Response({"info": "培训准备完成"}, status=status.HTTP_200_OK)
Beispiel #15
0
    def put_train(self, request, pk=None, *args, **kwargs):
        """
        问题修改成功
        :param request:
        :param pk:
        :return:
        """
        matter_responsible = Matter.objects.get(pk=pk).responsible
        if request.user != matter_responsible and request.user.is_superuser is False:
            return Response({"error": "您不是该问题的经办人,无法操作"}, status=status.HTTP_400_BAD_REQUEST)
        data = self.request.data

        # 改动记录
        log_id = OpenStationViewSet.create_base_log(request, pk, "培训管理", 3)
        ma_log = MatterLog()
        ma_log.apply_again(pk, data, log_id)
        ma_log.status_change(pk, log_id, 1)

        # 问题类型key-value 位置交换
        type_dict = dict(MATTER_TYPE)
        type_dict = {v: k for k, v in type_dict.items()}

        # 问题类型
        matter_type = data.get("matter_type")
        # 问题名称
        matter_name = data.get("matter_name")
        # 培训方式
        training_method = data.get("training_method")
        # 客户状态描述
        description_customer = data.get("description_customer")
        # 已上线模块
        online_module = data.get("online_module")
        # 未上线模块
        unonline_module = data.get("unonline_module")
        # 培训联系人
        training_contact = data.get("training_contact")
        # 培训联系人电话
        training_contactnum = data.get("training_contactnum")
        # 培训联系人QQ
        training_contactqq = data.get("training_contactqq")
        # 培训联系人职位
        training_position = data.get("training_position")
        # 培训方式key-value 位置交换
        method_dict = dict(TRAINING_METTART_METHOD)
        method_dict = {v: k for k, v in method_dict.items()}

        matter = Matter.objects.get(pk=pk)
        matter.matter_type = type_dict.get(matter_type)
        matter.matter_name = matter_name
        matter.training_method = method_dict.get(training_method)
        matter.description_customer = description_customer
        matter.online_module = online_module
        matter.unonline_module = unonline_module
        matter.training_contact = training_contact
        matter.training_contactnum = training_contactnum
        matter.training_contactqq = training_contactqq
        matter.training_position = training_position
        matter.matter_status = 1
        matter.save()

        return Response({"info": "信息修改成功"}, status=status.HTTP_200_OK)