Example #1
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        response["data"] = date_kits.get_now_day_str()

        operation = self.get_argument("operation")
        issues_id = self.get_argument("issues_id")
        prepare_score = self.get_argument("prepare_score")
        novel_score = self.get_argument("novel_score")
        report_score = self.get_argument("report_score")

        logging.info(
            "operation:%s, issues_id:%s,prepare_score:%s,novel_score:%s,report_score:%s"
            % (operation, issues_id, prepare_score, novel_score, report_score))

        if operation == "evaluate":
            ret, message = self.__evaluate_by_issues_id(
                issues_id, prepare_score, novel_score, report_score)
            if ret is True:
                response["status"] = True
                response["message"] = "评价成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = message
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
Example #2
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        operation = self.get_argument("operation")
        organizer_name = self.get_argument("organizer_name")
        organizer_id = self.get_argument("organizer_id")
        organizer_date = self.get_argument("time_date")

        logging.info(" organizer_id: " + organizer_id + " organizer_name: "
                     + organizer_name + " organizer_date:" + organizer_date)

        if operation == "assign":
            ret = self.__assign_organizer_by_name(organizer_name, organizer_id, organizer_date)
            if ret is True:
                response["status"] = True
                response["message"] = "指定成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "指定失败!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))

            return
Example #3
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        response["data"] = date_kits.get_now_day_str()

        operation = self.get_argument("operation")
        #  present = self.get_argument("present")
        present_id = self.get_argument("present_id")

        user_name = self.get_current_user()

        if operation == "exchange":
            ret = self.__exchange_apply_by_user_name(user_name, present_id)
            if ret is True:
                response["status"] = True
                response["message"] = "申请成功!"
                response["data"] = date_kits.get_now_day_str()
                opt = "apply a exchange, username: "******"status"] = False
                response["message"] = "积分兑换失败"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
Example #4
0
        def wrapper(self, *args, **kwargs):
            logging.info("[decorator]:post authorization")
            response = {"status": True, "data": "", "message": "failed"}
            date_kits = DateToolKits()
            response["data"] = date_kits.get_now_day_str()
            response["status"] = False
            response["message"] = "无权限操作!"

            #  1、判断是否有登录,没有登录
            if self.session["authorized"] is None or self.session[
                    "authorized"] is False:
                self.write(json.dumps(response))
                return

            # 2、只有管理员有权限的页面只需判断管理员权限即可
            if admin_only is True:
                logging.info("[decorator]:admin only is true")
                if self.session["admin"] is None or self.session[
                        "admin"] is False:
                    self.write(json.dumps(response))
                    logging.warning("[decorator]:current user is No admin")
                    return

            #  3、其他页面需要判断管理权限或者组织者权限
            if self.session["admin"] is None or self.session["admin"] is False:
                if self.session["organizer"] is None or self.session[
                        "organizer"] is False:
                    self.write(json.dumps(response))
                    logging.warning(
                        "[decorator]:current user is No admin or organizer")
                    return

            return method(self, *args, **kwargs)
Example #5
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        response["data"] = date_kits.get_now_day_str()

        operation = self.get_argument("operation")
        topic_user = self.get_argument("topic_user")
        topic_name = self.get_argument("topic_name")
        topic_brief = self.get_argument("topic_brief")
        topic_date = self.get_argument("topic_date")
        topic_id = self.get_argument("issues_id")
        issues_type = self.get_argument("issues_type", "designate")
        if operation == "add":
            ret = self.__add_topics(topic_user, topic_name, topic_brief,
                                    topic_date, issues_type)
            if ret is True:
                response["status"] = True
                response["message"] = "新增成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "当前议题已存在"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        if operation == "delete":
            ret = self.__delete_topic_by_id(topic_id)
            if ret is True:
                response["status"] = True
                response["message"] = "删除成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "当前积分规则不支持"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        if operation == "modify":
            ret = self.__modify_topic_by_id(topic_id, topic_user, topic_name,
                                            topic_brief, topic_date)
            if ret is True:
                response["status"] = True
                response["message"] = "修改成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "当前议题已存在"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
Example #6
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        operation = self.get_argument("operation")
        user_name = self.get_argument("user_name")
        leave_id = self.get_argument("leave_id", 0)
        leave_date = self.get_argument("leave_date", "none")

        logging.info(
            "operation:%s , user_name: %s, leave_id:%s leave_date: %s" %
            (operation, user_name, leave_id, leave_date))

        if operation == "absent_apply":
            logging.info(leave_date)
            time_diff = date_kits.cac_time_diff_with_current_by_str(leave_date)
            logging.info("time diff:" + str(time_diff))
            valid_time = date_kits.check_time_is_ok(leave_date)

            if valid_time is False:
                response["status"] = False
                response["message"] = "选择时间不能早已当前时间!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                logging.info("time out of range")
                return

            ret = self.__leave_apply_by_id(user_name, leave_id, leave_date)

            if ret is True:
                response["status"] = True
                response["message"] = "申请成功!"
                response["data"] = date_kits.get_now_day_str()
                opt = "apply a absent, username: "******"status"] = False
                response["message"] = "申请失败!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))

            return
Example #7
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        user_name = self.get_argument("user_name")
        old_pass_word = self.get_argument("old_password")
        new_pass_word = self.get_argument("new_password")
        confirm = self.get_argument("confirm")
        logging.info(
            "user_name:%s old_pass_word:%s new_pass_word:%s confirm:%s" %
            (user_name, old_pass_word, new_pass_word, confirm))
        if new_pass_word != confirm:
            response["status"] = False
            response["message"] = "两次输入的密码不一致!"
            response["data"] = date_kits.get_now_day_str()
            self.write(json.dumps(response))
            return

        if new_pass_word == old_pass_word:
            response["status"] = False
            response["message"] = "新密码不能等于老密码!"
            response["data"] = date_kits.get_now_day_str()
            self.write(json.dumps(response))
            return

        ret = self.__modify_passwd_by_user_name(user_name, old_pass_word,
                                                new_pass_word)
        if ret is True:
            response["status"] = True
            response["message"] = "修改密码成功!"
            response["data"] = date_kits.get_now_day_str()
            opt = "modify password by " + user_name
            self.record_operation_history(user_name, opt)
            self.write(json.dumps(response))
        else:
            response["status"] = False
            response["message"] = "修改密码失败!"
            response["data"] = date_kits.get_now_day_str()
            self.write(json.dumps(response))

        return
Example #8
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        response["data"] = date_kits.get_now_day_str()

        operation = self.get_argument("operation")
        topic_name = self.get_argument("topic_name")
        topic_brief = self.get_argument("topic_brief")
        topic_date = self.get_argument("topic_date")
        user_name = self.get_current_user()

        logging.info(topic_date)
        time_diff = date_kits.cac_time_diff_with_current_by_str(topic_date)
        logging.info("time diff:" + str(time_diff))
        valid_time = date_kits.check_time_is_ok(topic_date)

        if valid_time is False:
            response["status"] = False
            response["message"] = "选择时间不能早已当前时间!"
            response["data"] = date_kits.get_now_day_str()
            self.write(json.dumps(response))
            return

        if operation == "apply_issues":
            ret = self.__add_topics(user_name, topic_name, topic_brief, topic_date)
            if ret is True:
                response["status"] = True
                response["message"] = "新增成功!"
                response["data"] = date_kits.get_now_day_str()
                opt = "apply a issues, title: " + topic_name
                self.record_operation_history(user_name, opt)
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "当前议题已存在"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
Example #9
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()

        operation = self.get_argument("operation")
        serial_number = self.get_argument("serial_number")
        user_name = self.get_current_user()
        if operation == "delete_history":
            ret = self.__delete_history_opinions_by_serial_number(
                serial_number)
            if ret is True:
                response["status"] = True
                response["message"] = "删除问题记录成功"
                response["data"] = date_kits.get_now_day_str()
                opt = "delete feedback history: " + serial_number
                self.record_operation_history(user_name, opt)
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "删除问题记录失败"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
Example #10
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        response["data"] = date_kits.get_now_day_str()

        operation = self.get_argument("operation")
        issues_id = self.get_argument("issues_id")
        logging.info("operation:" + operation + " issues_id:" + issues_id)

        if operation == "evaluate_finish":
            ret = self.__finish_issues_evaluation(issues_id)
            if ret is True:
                response["status"] = True
                response["message"] = "结束评价成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "结束评价失败"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
Example #11
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()

        operation = self.get_argument("operation")
        serial_number = self.get_argument("serial_number")
        resolved_status = self.get_argument("resolved_status")
        solution_methods = self.get_argument("solution_methods")

        if operation == "resolved":
            ret = self.__update_opinions_by_serial_number(
                serial_number, resolved_status, solution_methods)
            if ret is True:
                response["status"] = True
                response["message"] = "更新问题状态失败"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "更新问题状态成功"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
Example #12
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        response["data"] = date_kits.get_now_day_str()

        operation = self.get_argument("operation")
        issues_id = self.get_argument("issues_id")

        logging.info("operation:%s, issues_id:%s" % (operation, issues_id))

        interested = False
        if operation == "interested":
            interested = True
        elif operation == "uninterested":
            interested = False
        else:
            response["status"] = False
            response["message"] = "异常失败!"
            response["data"] = date_kits.get_now_day_str()
            self.write(json.dumps(response))
            return

        user_name = self.get_current_user()
        ret, message = self.__mark_interested_by_issues_id(
            issues_id, interested, user_name)
        if ret is True:
            response["status"] = True
            response["message"] = "反馈成功!"
            response["data"] = date_kits.get_now_day_str()
            self.write(json.dumps(response))
            return
        else:
            response["status"] = False
            response["message"] = message
            response["data"] = date_kits.get_now_day_str()
            self.write(json.dumps(response))
            return
Example #13
0
    def wrapper(self, *args, **kwargs):
        logging.info("[decorator]:post authorization")
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        response["data"] = date_kits.get_now_day_str()
        response["status"] = False
        response["message"] = "请先登录!"

        #  1、判断是否有登录,没有登录
        if self.session["authorized"] is None or self.session[
                "authorized"] is False:
            self.write(json.dumps(response))
            return

        return method(self, *args, **kwargs)
Example #14
0
    def __update_opinions_by_serial_number(self, serial_number, status,
                                           solution):
        opinions = self.db.query(FeedBackModule).filter(
            FeedBackModule.serial_number == serial_number).first()
        if opinions is None:
            return False

        date = DateToolKits()

        self.db.query(FeedBackModule).filter(
            FeedBackModule.serial_number == serial_number).update({
                FeedBackModule.status:
                status,
                FeedBackModule.solution_methods:
                solution,
                FeedBackModule.resolved_date:
                date.get_now_day_str(),
                FeedBackModule.resolved_user_name:
                self.get_current_user()
            })
        self.db.commit()
        logging.info("update feedback status ok")
        return True
Example #15
0
    def post(self):

        operation = "none"
        feedback_title = "none"
        feedback_details = "none"
        serial_number = "0"

        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        operation = self.get_argument("operation")

        if operation == "feedback":
            feedback_title = self.get_argument("feedback_title", "none")
            feedback_details = self.get_argument("feedback_details", "none")
            logging.info(
                "operation:%s , feedback_title: %s, feedback_details:%s" %
                (operation, feedback_title, feedback_details))

        else:
            serial_number = self.get_argument("serial_number", "0")
            logging.info("operation:%s , serial_number:%s" %
                         (operation, serial_number))

        if operation == "feedback":
            ret = self.__feedback_process(feedback_title, feedback_details)
            if ret is True:
                response["status"] = True
                response["message"] = "反馈成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "反馈失败!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))

            return

        if operation == "succeed":
            ret = self.__feedback_regression_succeed_process(serial_number)
            if ret is True:
                response["status"] = True
                response["message"] = "提交成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "提交失败!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))

            return

        if operation == "failure":
            ret = self.__feedback_regression_failure_process(serial_number)
            if ret is True:
                response["status"] = True
                response["message"] = "提交成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "提交失败!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))

            return
Example #16
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        operation = self.get_argument("operation")
        user_name = self.get_argument("user_name")
        uid = self.get_argument("id")
        user_role = self.get_argument("role")

        logging.info("operation:%s , user_name: %s, role:%s id: %s" %
                     (operation, user_name, user_role, uid))

        if uid.isdigit() is False:
            response["status"] = False
            response["message"] = "id只支持数字!"
            response["data"] = date_kits.get_now_day_str()
            self.write(json.dumps(response))
            return

        str_tmp = uid.encode("ascii")
        user_id = int(str_tmp)

        auth = self.__auth_check_by_user_name(self.session["user_name"])

        if auth is False:
            response["status"] = False
            response["message"] = "您无权限操作!"
            response["data"] = date_kits.get_now_day_str()
            self.write(json.dumps(response))

            return

        if operation == "delete":
            ret = self.__delete_user_by_name(user_name)

            if ret is True:
                response["status"] = True
                response["message"] = "删除成功!"
                response["data"] = date_kits.get_now_day_str()
                opt = "delete user"
                self.record_operation_history(user_name, opt)
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "删除失败!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))

            self.__delete_point_by_name(user_name)
            return

        if operation == "modify":
            ret = self.__modify_user_info_by_id(user_id, user_name, user_role)
            if ret is True:
                response["status"] = True
                response["message"] = "修改成功!"
                response["data"] = date_kits.get_now_day_str()
                opt = "modify user role to " + user_role
                self.record_operation_history(user_name, opt)
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "修改失败!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))

            return

        if operation == "add":
            ret = self.__add_user(user_name, user_role)
            if ret is True:
                response["status"] = True
                response["message"] = "新增成功!"
                response["data"] = date_kits.get_now_day_str()
                opt = "add  user"
                self.record_operation_history(user_name, opt)
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "当前用户已存在"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        if operation == "show_pwd":
            ret, pass_word = self.__show_user_pass_word(user_name)
            if ret is True:
                response["status"] = True
                response["message"] = pass_word
                response["data"] = date_kits.get_now_day_str()
                opt = "show user password"
                self.record_operation_history(user_name, opt)
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = pass_word
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
Example #17
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        response["data"] = date_kits.get_now_day_str()
        rule_name = "none"
        rule_id = 0
        need_score = 0
        exchange_min_score = 0
        exchange_id = 0
        user_name = "none"
        operation = self.get_argument("operation")

        if operation == "exchange_reject" or operation == "exchange_confirm":
            exchange_id = self.get_argument("exchange_id")
            user_name = self.get_argument("user_name")
        else:
            rule_name = self.get_argument("rule_name")
            rule_id = self.get_argument("id")
            need_score = self.get_argument("need_score")
            exchange_min_score = self.get_argument("exchange_min_score")
            logging.info(" rule_name:" + rule_name + " rule_id:" + rule_id +
                         " need_score:" + need_score + " exchange_min_score:" +
                         exchange_min_score)

        if operation == "add":
            ret = self.__add_exchange_rule(rule_name, need_score,
                                           exchange_min_score)
            if ret is True:
                response["status"] = True
                response["message"] = "新增成功!"
                response["data"] = date_kits.get_now_day_str()
                opt = "add exchange rule: " + rule_name
                self.record_operation_history(self.session["user_name"], opt)
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "当前积分规则已存在"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        if operation == "delete":
            ret = self.__delete_rule_by_id(rule_id)
            if ret is True:
                response["status"] = True
                response["message"] = "删除成功!"
                response["data"] = date_kits.get_now_day_str()

                opt = "delete exchange rule"
                self.record_operation_history(self.session["user_name"], opt)
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "当前积分规则不支持"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        if operation == "modify":
            ret = self.__modify_rule_by_id(rule_id, need_score,
                                           exchange_min_score)
            if ret is True:
                response["status"] = True
                response["message"] = "删除成功!"
                response["data"] = date_kits.get_now_day_str()
                opt = "modify exchange rule"
                self.record_operation_history(self.session["user_name"], opt)
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "当前用户已存在"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        if operation == "exchange_confirm":
            ret = self.__exchange_item_confirm(exchange_id, user_name)
            if ret is True:
                response["status"] = True
                response["message"] = "兑换成功!"
                response["data"] = date_kits.get_now_day_str()
                opt = "confirm exchanged,id:" + exchange_id
                self.record_operation_history(user_name, opt)
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "兑换失败"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        if operation == "exchange_reject":
            ret = self.__exchange_item_reject(exchange_id)
            if ret is True:
                response["status"] = True
                response["message"] = "取消兑换成功!"
                response["data"] = date_kits.get_now_day_str()
                opt = "reject exchanged,id:" + exchange_id
                self.record_operation_history(user_name, opt)
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "取消兑换失败"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
Example #18
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()

        operation = self.get_argument("operation")
        issues_id = self.get_argument("issues_id")
        keynote_user_name = self.get_argument("keynote_user_name")
        meeting_room = self.get_argument("meeting_room")
        meeting_date = self.get_argument("meeting_date")
        issues_title = self.get_argument("issues_title")
        logging.info("issues_id: " + issues_id)
        if operation == "modify":
            ret = self.__modify_meeting_info_by_issues_id(
                issues_id, meeting_room, meeting_date)
            if ret is True:
                response["status"] = True
                response["message"] = "修改成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "修改失败!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))

            return

        if operation == "add":
            ret = self.__add_meeting_info(issues_id, keynote_user_name,
                                          meeting_room, meeting_date,
                                          issues_title)
            if ret is True:
                response["status"] = True
                response["message"] = "修改成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "修改失败!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))

            return

        if operation == "del":
            ret = self.__delete_meeting_info_by_id(issues_id)
            if ret is True:
                response["status"] = True
                response["message"] = "删除当前会议成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "删除当前会议失败!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))

            return

        if operation == "set_current":
            ret = self.__set_meeting_to_current(issues_id)
            if ret is True:
                response["status"] = True
                response["message"] = "设置为当前议题成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "设置当前议题失败!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))

            return

        if operation == "issues_finish":
            ret = self.__finish_current_meeting(issues_id)
            if ret is True:
                response["status"] = True
                response["message"] = "结束当前会议成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "结束当前会议失败!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))

            return

        if operation == "issues_cancel":
            ret = self.__cancel_current_meeting(issues_id)
            if ret is True:
                response["status"] = True
                response["message"] = "取消当前会议成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
            else:
                response["status"] = False
                response["message"] = "取消当前会议失败!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))

            return
Example #19
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        operation = self.get_argument("operation")
        user_name = self.get_argument("user_name", "unknown")
        absent_id = self.get_argument("absent_id", -1)

        logging.info("operation:%s , user_name: %s" % (operation, user_name))

        if operation == "leave_accept":
            flags = self.__check_date_time_is_valid()
            if flags is False:
                response["status"] = False
                response["message"] = "时间未到,不允许签到!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

            ret = self.__set_attendance_leave_accept_by_user_name(user_name)
            if ret is True:
                response["status"] = True
                response["message"] = "处理成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "签到失败"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        if operation == "leave_reject":
            flags = self.__check_date_time_is_valid()
            if flags is False:
                response["status"] = False
                response["message"] = "时间未到,不允许签到!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

            ret = self.__set_attendance_leave_reject_by_user_name(user_name)
            if ret is True:
                response["status"] = True
                response["message"] = "处理成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "签到失败"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        if operation == "sign":
            flags = self.__check_date_time_is_valid()
            if flags is False:
                response["status"] = False
                response["message"] = "时间未到,不允许签到!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

            ret = self.__attendance_sign_by_user_name(user_name)
            if ret is True:
                response["status"] = True
                response["message"] = "处理成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "签到失败"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        if operation == "absent":
            flags = self.__check_date_time_is_valid()
            if flags is False:
                response["status"] = False
                response["message"] = "时间未到,不允许签到!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

            ret = self.__set_attendance_absent_by_user_name(user_name, absent_id)
            if ret is True:
                response["status"] = True
                response["message"] = "处理成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "签到失败"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        if operation == "start_sign":
            ret = self.__start_attendance_sign()
            if ret is True:
                response["status"] = True
                response["message"] = "处理成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "签到失败"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        if operation == "reset_sign_table":
            ret = self.__reset_attendance_sign_tables()
            if ret is True:
                response["status"] = True
                response["message"] = "复位签到表成功!"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "复位签到表失败"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        response["status"] = False
        response["message"] = "找不到对应的操作!"
        response["data"] = date_kits.get_now_day_str()
        self.write(json.dumps(response))

        return
Example #20
0
    def post(self):
        response = {"status": True, "data": "", "message": "failed"}
        date_kits = DateToolKits()
        response["data"] = date_kits.get_now_day_str()

        operation = self.get_argument("operation")
        deduct_name = self.get_argument("deduct_name")
        deduct_id = self.get_argument("id")
        deduct_points = self.get_argument("deduct_points")
        str_subtraction = self.get_argument("subtraction")

        subtraction = True
        if str_subtraction == "false":
            subtraction = False

        if operation == "add":
            ret = self.__add_deduct(deduct_name, deduct_points, subtraction)
            if ret is True:
                response["status"] = True
                response["message"] = "新增成功!"
                response["data"] = date_kits.get_now_day_str()
                opt = "add credits rule: " + deduct_name
                self.record_operation_history(self.session["user_name"], opt)
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "当前积分规则已存在"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        if operation == "delete":
            ret = self.__delete_deduct_by_id(deduct_id)
            if ret is True:
                response["status"] = True
                response["message"] = "删除成功!"
                response["data"] = date_kits.get_now_day_str()
                opt = "delete credits rule: " + deduct_name
                self.record_operation_history(self.session["user_name"], opt)
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "当前积分规则不支持"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return

        if operation == "modify":
            ret = self.__modify_deduct_by_id(deduct_id, deduct_points)
            if ret is True:
                response["status"] = True
                response["message"] = "删除成功!"
                response["data"] = date_kits.get_now_day_str()
                opt = "modify credits rule"
                self.record_operation_history(self.session["user_name"], opt)
                self.write(json.dumps(response))
                return
            else:
                response["status"] = False
                response["message"] = "当前用户已存在"
                response["data"] = date_kits.get_now_day_str()
                self.write(json.dumps(response))
                return