Browse Source

查询feedback数据到feedback_history 去重之后

李莎 2 years ago
commit
5fa27cb112
10 changed files with 662 additions and 0 deletions
  1. 9 0
      Dockerfile
  2. 137 0
      MyUtils/DateUtils.py
  3. 18 0
      MyUtils/Dingtalk.py
  4. 42 0
      MyUtils/HttpUtil.py
  5. 53 0
      MyUtils/MetadataWebUtil.py
  6. 114 0
      MyUtils/MysqlUtils.py
  7. 104 0
      MyUtils/ZillionUtil.py
  8. 10 0
      config.json
  9. 3 0
      requirements.txt
  10. 172 0
      start.py

+ 9 - 0
Dockerfile

@@ -0,0 +1,9 @@
+FROM python:3.7.15-slim
+
+
+WORKDIR ./feedback_duplicate_data
+ADD . .
+
+RUN  pip install -r requirements.txt
+
+CMD ["python", "-u","./start.py"]

+ 137 - 0
MyUtils/DateUtils.py

@@ -0,0 +1,137 @@
+import datetime
+from dateutil.relativedelta import relativedelta
+from dateutil import rrule
+
+YYmmddHHMMSS = "%Y%m%d%H%M%S"
+YYmmdd = "%Y%m%d"
+YYmm = "%Y%m"
+# 根据开始月份结束月份获取所有月份
+def get_each_month(start_month, end_month):
+    if str(start_month).count('-') != 1 or str(end_month).count('-') != 1:
+        print("Parameter Error: Pls input a string such as '2019-01'")
+        return []
+    if int(str(start_month).split('-')[1]) > 12 or int(str(end_month).split('-')[1]) > 12:
+        print('Parameter Error: Pls input correct month range such as between 1 to 12')
+        return []
+    if int(str(start_month).split('-')[1]) == 0 or int(str(end_month).split('-')[1]) == 13:
+        print('Parameter Error: Pls input correct month range such as between 1 to 12')
+        return []
+    start = datetime.datetime.strptime(start_month, "%Y-%m")
+    end = datetime.datetime.strptime(end_month, "%Y-%m")
+    month_count = rrule.rrule(rrule.MONTHLY, dtstart=start, until=end).count()  # 计算总月份数
+    if end < start:
+        print("Parameter Error: Pls input right date range,start_month can't latter than end_month")
+        return []
+    else:
+        list_month = []
+        year = int(str(start)[:7].split('-')[0])  # 截取起始年份
+        for m in range(month_count):  # 利用range函数填充结果列表
+            month = int(str(start)[:7].split('-')[1])  # 截取起始月份,写在for循环里,作为每次迭代的累加基数
+            month = month + m
+            if month > 12:
+                if month % 12 > 0:
+                    month = month % 12  # 计算结果大于12,取余数
+                    if month == 1:
+                        year += 1  # 只需在1月份的时候对年份加1,注意year的初始化在for循环外
+                else:
+                    month = 12
+            if len(str(month)) == 1:
+                list_month.append(str(year) + '-0' + str(month))
+            else:
+                list_month.append(str(year) + '-' + str(month))
+        return list_month
+
+
+# 转换格式,去掉"-",%Y%m
+def get_eachmonth(start_month, end_month):
+    startmonth = start_month[0:4] + "-" + start_month[4:6]
+    endmonth = end_month[0:4] + "-" + end_month[4:6]
+    months = get_each_month(startmonth, endmonth)
+    list_month = [i[0:4] + i[5:7] for i in months]
+    return list_month
+
+
+def get_month(starttime, endtime):
+    months = []
+    starttime = datetime.datetime.strptime(starttime, YYmmddHHMMSS)
+    endtime = datetime.datetime.strptime(endtime, YYmmddHHMMSS)
+    while starttime <= endtime:
+        start = starttime.strftime("%Y%m")
+        if start not in months:
+            months.append(start)
+        starttime = starttime + datetime.timedelta(days=1)
+    return months
+
+def get_month_range(starttime, endtime):
+    months = []
+    starttime = datetime.datetime.strptime(starttime[0:8], YYmmdd)
+    endtime = datetime.datetime.strptime(endtime[0:8], YYmmdd)
+    while starttime < endtime:
+        start = starttime.strftime(YYmmddHHMMSS)
+        endMonth = datetime.datetime.strptime(start[0:6], YYmm) + relativedelta(months=+1)
+
+        end = endMonth.strftime(YYmmddHHMMSS)
+        if endtime <= endMonth:
+            end = endtime.strftime(YYmmddHHMMSS)
+        starttime = endMonth
+        months.append([start, end])
+    return months
+
+
+
+def get_month1(starttime, endtime):
+    months = []
+    startyear = int(starttime[0:4])
+    startmonth = int(starttime[4:6])
+    endyear = int(endtime[0:4])
+    endmonth = int(endtime[4:6])
+    while startyear != endyear or startmonth != endmonth:
+        startyearstr = str(startyear)
+        startmonthstr = str(startmonth)
+        if startmonth < 10:
+            startmonthstr = "0" + str(startmonth)
+        months.append(startyearstr + startmonthstr)
+        startmonth += 1
+        if startmonth == 13:
+            startyear += 1
+            startmonth = 1
+    months.append(endtime[0:6])
+    return months
+
+#根据开始结束时间获取最大区间为1天的时间区间
+# def get_day(starttime,endtime):
+#     times = []
+#     starttime = datetime.datetime.strptime(starttime, YYmmddHHMMSS)
+#     endtime = datetime.datetime.strptime(endtime, YYmmddHHMMSS)
+#     while starttime < endtime:
+#         start = starttime.strftime(YYmmddHHMMSS)
+#         starttime_delta = starttime + datetime.timedelta(days=1)
+#         end = starttime_delta.strftime(YYmmddHHMMSS)
+#         if str(starttime)[0:7]<str(starttime_delta)[0:7] :
+#             end = starttime_delta.strftime("%Y%m") +"01000000"
+#             starttime = datetime.datetime.strptime(end, YYmmddHHMMSS)
+#             times.append([start, end])
+#             continue
+#         if starttime >= starttime_delta:
+#             end = starttime_delta.strftime(YYmmddHHMMSS)
+#         starttime = starttime + datetime.timedelta(days=1)
+#         times.append([start,end])
+#     return times
+#根据开始结束时间获取最大区间为1天的时间区间
+def get_day(starttime,endtime):
+    times = []
+    starttime = datetime.datetime.strptime(starttime, YYmmddHHMMSS)
+    endtime = datetime.datetime.strptime(endtime, YYmmddHHMMSS)
+    while starttime < endtime:
+        start = starttime.strftime(YYmmddHHMMSS)
+        stratDay = datetime.datetime.strptime(start[0:8],YYmmdd)
+        starttime_delta = stratDay + datetime.timedelta(days=1)
+        end = starttime_delta.strftime(YYmmddHHMMSS)
+        if endtime <= starttime_delta:
+            end = endtime.strftime(YYmmddHHMMSS)
+        starttime = stratDay + datetime.timedelta(days=1)
+        times.append([start,end])
+    return times
+
+if __name__ == '__main__':
+    print(get_day("20220101000000", "20220201000000"))

+ 18 - 0
MyUtils/Dingtalk.py

@@ -0,0 +1,18 @@
+from  dingtalkchatbot.chatbot import DingtalkChatbot
+
+def send_message_mobiles(message,dingtalk,mobiles):
+    webhook = dingtalk
+    xiaoding = DingtalkChatbot(webhook)
+    xiaoding.send_text(msg=message,at_mobiles=[mobiles],is_auto_at=False)
+    return
+
+def send_message(message,dingtalk):
+    webhook = dingtalk
+    xiaoding = DingtalkChatbot(webhook)
+    xiaoding.send_text(msg=message)
+    return
+def send_message_markdown(title,text,dingtalk):
+    webhook = dingtalk
+    xiaoding = DingtalkChatbot(webhook)
+    xiaoding.send_markdown(title=title,text=text)
+    return

+ 42 - 0
MyUtils/HttpUtil.py

@@ -0,0 +1,42 @@
+# coding=utf-8
+import sys
+
+if (sys.version_info.major == 3):
+    from urllib import parse
+    import urllib.request as urllib2
+else:
+    import urllib2
+
+
+class HttpUtil(object):
+    #post方法获取数据  application/json
+    @staticmethod
+    def post(url, postData):  #
+        req = urllib2.Request(url, data=postData.encode('utf-8'),
+                              headers={'Content-Type': 'application/json;charset=UTF-8'})
+        res = urllib2.urlopen(req, timeout=60).read().decode("utf-8")
+        return res
+
+    #post方法获取数据  application/x-www-form-urlencoded
+    @staticmethod
+    def postText(url, postData):
+        req = urllib2.Request(url, data=postData.encode('utf-8'),
+                              headers={'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'})
+        res = urllib2.urlopen(req, timeout=60).read().decode("utf-8")
+        return res
+
+    #get方法获取数据  text/xml
+    @staticmethod
+    def get(url, getData, isquote):
+        if isquote:
+            getData = parse.quote(getData)
+        req = urllib2.Request((url + getData), headers={'Content-Type': 'text/xml;charset=UTF-8'})
+        res = urllib2.urlopen(req, timeout=60)
+        req = res.read()
+        return req.decode()
+
+
+# if __name__ == '__main__':
+    # httputil = HttpUtil()
+    # httputil.postText()
+    # HttpUtil.postText()

+ 53 - 0
MyUtils/MetadataWebUtil.py

@@ -0,0 +1,53 @@
+import json
+from MyUtils.HttpUtil import *
+
+
+class MetadataWebUtil(object):
+    def __init__(self, url):
+        self.url = url
+
+    def get_hbase(self, params):
+        params = json.dumps(params)
+        word = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.persagy.com/" xmlns:ent="http://entity.persagy.com">' \
+               '<soapenv:Header/>' \
+               '<soapenv:Body><ser:Query>' \
+               '<arg0>%s</arg0>' \
+               '</ser:Query></soapenv:Body></soapenv:Envelope>' % (params)
+        res = HttpUtil.post(self.url, word)
+        res = res.split("<return>")[1].split("</return>")[0]
+        res = json.loads(res.replace("&#xd;", ""))
+        return res
+
+    def database_list(self):
+        params = {
+            "QueryType": "database_list"
+        }
+        res = self.get_hbase(params)
+        return res["Content"]
+
+    def table_list(self, database):
+        params = {
+            "QueryType": "table_list_strict",
+            "Database": database
+        }
+        table_list_strict = self.get_hbase(params)["Content"]
+        params = {
+            "QueryType": "table_list",
+            "Database": database
+        }
+        table_list = self.get_hbase(params)["Content"]
+        table_list = [i for i in table_list if i not in table_list_strict]
+        tables = {}
+        for table in table_list_strict:
+            childs = []
+            for i in table_list:
+                if i.startswith(table + "_"):
+                    try:
+                        word = i[len(table + "_"):]
+                        if len(word) == 4 or len(word) == 6:
+                            word = int(word)
+                            childs.append(i)
+                    except:
+                        pass
+            tables[table] = childs
+        return tables

+ 114 - 0
MyUtils/MysqlUtils.py

@@ -0,0 +1,114 @@
+import pymysql
+from dbutils.pooled_db import PooledDB
+
+
+class MysqlUtils():
+    # 连接池对象
+    __pool = None
+    def __init__(self,**config):
+        self.host = config["host"]
+        self.port = int(config["port"])
+        self.user = config["user"]
+        self.passwd = config["passwd"]
+        self.database = None
+        if "database" in config:
+            self.database = config["database"]
+        self.pool = self.get_conn()
+        # self.pool = None
+
+    def get_conn(self):
+        if MysqlUtils.__pool is None:
+            __pool = PooledDB(pymysql, mincached=1, maxcached=5, maxconnections=5,
+                              host=self.host, port=self.port, user=self.user, passwd=self.passwd,
+                              database=self.database,
+                               use_unicode=True, blocking=False, charset="utf8")
+            self.pool = __pool
+            return __pool
+
+
+    def query(self,sql):
+        con = None
+        cur = None
+        try:
+            con = self.pool.connection()
+            cur = con.cursor()
+            count = cur.execute(sql)
+            if count >= 0:
+                result = cur.fetchall()
+                result = [[j.decode() if isinstance(j, bytes) else j for j in i] for i in result]
+                # print(result)
+            else:
+                result = False
+            return result
+        except Exception as e:
+            print(e)
+        finally:
+            if cur:
+                cur.close()
+            if con:
+                con.close()
+
+
+    def update(self,sql):
+        con = None
+        cur = None
+        try:
+            con = self.pool.connection()
+            cur = con.cursor()
+            cur.execute(sql)
+            con.commit()
+        except Exception as e:
+            con.rollback()  # 事务回滚
+            print(e)
+        finally:
+            if cur:
+                cur.close()
+            if con:
+                con.close()
+
+    def update_mult(self,sql1,sql2,sql3):
+        con = None
+        cur = None
+        try:
+            con = self.pool.connection()
+            cur = con.cursor()
+            cur.execute(sql1)
+            con.commit()
+            cur.execute(sql2)
+            con.commit()
+            cur.execute(sql3)
+            con.commit()
+        except Exception as e:
+            con.rollback()  # 事务回滚
+            print(e)
+        finally:
+            if cur:
+                cur.close()
+            if con:
+                con.close()
+
+    def update_two(self,sql1,sql2):
+        con = None
+        cur = None
+        try:
+            con = self.pool.connection()
+            cur = con.cursor()
+            cur.execute(sql1)
+            con.commit()
+            cur.execute(sql2)
+            con.commit()
+        except Exception as e:
+            con.rollback()  # 事务回滚
+            print(e)
+        finally:
+            if cur:
+                cur.close()
+            if con:
+                con.close()
+
+
+
+
+    def close(self):
+        if MysqlUtils.__pool:
+            MysqlUtils.__pool.close()

+ 104 - 0
MyUtils/ZillionUtil.py

@@ -0,0 +1,104 @@
+from MyUtils.MetadataWebUtil import MetadataWebUtil
+
+
+class ZillionUtil():
+    def __init__(self, url):
+        self.metadata = MetadataWebUtil(url)
+
+    ##列出所有数据库
+    def database_list(self):
+        param = {
+            "QueryType": "database_list"
+        }
+        databases = self.metadata.get_hbase(param)
+        return databases["Content"]
+
+        # TODO  其他zillion语句
+
+    ##列出所有数据库下的表(不包含分表)
+    def table_list_strict(self,table):
+        param = {
+            	"QueryType":"table_list_strict",
+	            "Database":table
+        }
+        databases = self.metadata.get_hbase(param)
+        return databases["Content"]
+
+
+    ##列出所有数据库
+    # def query(self, database, table, Criteria):
+    #     param = {
+    #         "QueryType": "select",
+    #         "Database": database,
+    #         "Datatable": table,
+    #         "Criteria": Criteria
+    #     }
+    #     print(param)
+    #     databases = self.metadata.get_hbase(param)
+    #     return databases["Content"]
+
+    def select(self, database, table, Criteria):
+        param = {
+            "QueryType": "select",
+            "Database": database,
+            "Datatable": table,
+            "Criteria": Criteria
+        }
+        databases = self.metadata.get_hbase(param)
+        return databases["Content"]
+
+    def table_key(self, database, table):
+        param = {
+            "QueryType": "table_detail",
+            "Database": database,
+            "Datatable": table
+        }
+        databases = self.metadata.get_hbase(param)
+        key = databases["Content"]["Key"]
+        return key
+
+
+
+    def select_count(self, database, table, Criteria):
+        param = {
+            "QueryType": "select_count",
+            "Database": database,
+            "Datatable": table,
+            "Criteria": Criteria
+        }
+        databases = self.metadata.get_hbase(param)
+        return databases["Count"]
+
+    def query_data(self, sql):
+        databases = self.metadata.get_hbase(sql)
+        return databases["Content"]
+
+    def insert(self,database,table,InsertObject):
+        param = {
+            "QueryType": "batch_insert",
+            "Database": database,
+            "Datatable": table,
+            "InsertObjects": InsertObject
+        }
+        databases = self.metadata.get_hbase(param)
+        return databases["Count"]
+
+    def remove(self,database,table,key):
+        param = {
+            "QueryType": "remove",
+            "Database": database,
+            "Datatable": table,
+            "Key": key
+        }
+        databases = self.metadata.get_hbase(param)
+        return databases["Count"]
+
+    def put(self,database,table,InsertObject):
+        param = {
+            "QueryType": "batch_put",
+            "Database": database,
+            "Datatable": table,
+            "InsertObjects": InsertObject
+        }
+        databases = self.metadata.get_hbase(param)
+        return databases["Result"]

+ 10 - 0
config.json

@@ -0,0 +1,10 @@
+{
+  "mysql": {
+    "host": "192.168.100.29",
+    "port": 3306,
+    "user": "root",
+    "passwd": "Persagy_29",
+    "database": "test"
+  },
+  "sleep": 3600
+}

+ 3 - 0
requirements.txt

@@ -0,0 +1,3 @@
+pymysql==1.0.2
+pytz==2021.1
+dbutils==2.0.2

+ 172 - 0
start.py

@@ -0,0 +1,172 @@
+from MyUtils.MysqlUtils import MysqlUtils
+from MyUtils.ZillionUtil import ZillionUtil
+from MyUtils.Dingtalk import send_message_markdown
+from MyUtils.DateUtils import get_day
+import datetime
+import pytz
+import json,pymysql
+import time
+import os
+
+SELETE_SQL = "SELECT " \
+             "t.project_id, " \
+             "t.object_id," \
+             "t.source_type," \
+             "t.user_id," \
+             "t.user_phone," \
+             "t.user_name," \
+             "t.value_type," \
+             "t.item_id," \
+             "t.create_time," \
+             "COUNT(*) " \
+            "FROM %s.feedback t WHERE " \
+             "t.create_time >= '%s' AND t.create_time < '%s' GROUP BY " \
+             "t.project_id, " \
+             "t.object_id," \
+             "t.source_type," \
+             "t.user_id," \
+             "t.user_phone," \
+             "t.user_name," \
+             "t.value_type," \
+             "t.item_id," \
+             "t.create_time" \
+             " HAVING COUNT(*) > 1"
+
+SELECT_ID_SQL = "SELECT t.id FROM %s.feedback t WHERE " \
+                "t.project_id='%s' and t.object_id='%s' and t.source_type='%s' and t.user_id='%s' and t.user_phone='%s' and t.user_name='%s' and t.value_type='%s' and t.item_id='%s' and t.create_time='%s'"
+INSERT_ID_DATA_SQL = "INSERT INTO %s.feedback_history (" \
+                     "id,project_id,object_id,source_type,user_id,user_phone,user_name," \
+                     "value_type,item_id,`value`,create_time,next_open_time,model,duration_type," \
+                     "custom_plan,curr_temp,nick_name, `result`,exe_result,fb_temp,`remark`) " \
+                     "SELECT * FROM %s.feedback WHERE id = '%s'"
+
+UPDATE_ID_SQL = "update %s.feedback_history set duplicate_data = '%s' where id = '%s'"
+
+SELECT_DATA_SQL = "SELECT * FROM %s.feedback t WHERE " \
+                  "t.create_time >= '%s' AND t.create_time < '%s' " \
+                  "GROUP BY t.project_id,t.object_id,t.source_type,t.user_id,t.user_phone,t.user_name,t.`value`,t.item_id,t.create_time " \
+                  "HAVING COUNT(*) =1"
+
+INSERT_DADA_SQL = "INSERT INTO %s.feedback_history (" \
+                     "id,project_id,object_id,source_type,user_id,user_phone,user_name," \
+                     "value_type,item_id,`value`,create_time,next_open_time,model,duration_type," \
+                     "custom_plan,curr_temp,nick_name, `result`,exe_result,fb_temp,`remark`,duplicate_data) values "
+
+DELETE_DUPLICATE_SQL = "delete from %s.feedback where id ='%s'"
+DELETE_DUPLICATE_MULT_SQL = "delete from %s.feedback where id in (select * from (SELECT id FROM %s.feedback t WHERE t.create_time >= '%s' AND t.create_time < '%s' GROUP BY t.project_id,t.object_id,t.source_type,t.user_id,t.user_phone,t.user_name,t.`value`,t.item_id,t.create_time HAVING  COUNT(*) = 1) s)"
+
+def datetime_now():
+    # datetime_now = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
+    #容器时间
+    # tz = pytz.timezone('Asia/Shanghai')  # 东八区
+    datetime_now = datetime.datetime.fromtimestamp(int(time.time()),
+                                    pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d %H:%M:%S')
+    return datetime_now
+
+def None_data(data):
+    if data == None:
+        data = "NULL"
+    return data
+
+with open("config.json", "r") as f:
+    data = json.load(f)
+    mysql = data["mysql"]
+    my_database = mysql["database"]
+    sleep = data["sleep"]
+
+# mysql = {
+#     "host": os.getenv("host"),
+#     "port": int(os.getenv("port")),
+#     "user": os.getenv("user"),
+#     "passwd": os.getenv("passwd"),
+#     "database": os.getenv("database")
+# }
+# database = os.getenv("database")
+# sleep = os.getenv("sleep")
+
+
+# #连接mysql
+MysqlUtil = MysqlUtils(**mysql)
+starttime = '20230101000000'
+endtime = '20230201000000'
+day_range = get_day(starttime,endtime)
+
+
+
+for day in day_range:
+    sqls = []
+    create_time_start,create_time_end = day[0],day[1]
+    #获取重复数据
+    data_infos = MysqlUtil.query(SELETE_SQL%(my_database,create_time_start,create_time_end))
+    duplicate_data = 'Y'
+    if data_infos:
+        for data in data_infos:
+            project_id = data[0]
+            object_id = data[1]
+            source_type = data[2]
+            user_id = data[3]
+            user_phone = data[4]
+            user_name = data[5]
+            value_type = data[6]
+            item_id = data[7]
+            create_time = data[8]
+            create_time = datetime.datetime.strftime(create_time,"%Y-%m-%d %H:%M:%S")
+            data_infos_id =MysqlUtil.query(SELECT_ID_SQL%(my_database,project_id,object_id,source_type,user_id,user_phone,user_name,value_type,item_id,create_time))
+            #获取重复数据的id
+            if data_infos_id:
+                for data_id in data_infos_id:
+                    print("%s 插入数据%s,标签为%s"%(datetime_now(),data_id[0],duplicate_data))
+                    # #将重复数据插入到history表中
+                    sql1 = INSERT_ID_DATA_SQL%(my_database,my_database,data_id[0])
+                    # #打重复的标签”Y“
+                    sql2 = UPDATE_ID_SQL%(my_database,duplicate_data,data_id[0])
+                    # 删除feedback重复数据
+                    sql3 = DELETE_DUPLICATE_SQL%(my_database,data_id[0])
+                    MysqlUtil.update_mult(sql1,sql2,sql3)
+    else:
+        print("%s 时间段%s至%s没有重复数据"%(datetime_now(),create_time_start,create_time_end))
+    #获取没有重复的数据
+    data_all_infos = MysqlUtil.query(SELECT_DATA_SQL%(my_database,create_time_start,create_time_end))
+    duplicate_data_N = 'N'
+    if data_all_infos:
+        for d in data_all_infos:
+            id = d[0]
+            project_id = d[1]
+            object_id = d[2]
+            source_type = d[3]
+            user_id = d[4]
+            user_phone = d[5]
+            user_name = d[6]
+            value_type = d[7]
+            item_id = None_data(d[8])
+            value = None_data(d[9])
+            create_time = d[10]
+            next_open_time = d[11]
+            model = d[12]
+            duration_type = None_data(d[13])
+            custom_plan = d[14]
+            curr_temp = d[15]
+            nick_name = d[16]
+            result = None_data(d[17])
+            exe_result = d[18]
+            exe_result = None_data(exe_result)
+            fb_temp = None_data(d[19])
+            remark = d[20]
+            print("%s 查询数据%s,标签为%s"%(datetime_now(),id,duplicate_data_N))
+            sql = "('%s','%s','%s','%s','%s','%s','%s','%s',%s,%s,'%s','%s','%s',%s,'%s','%s','%s',%s,'%s',%s,'%s','%s')"%(id,project_id,object_id,source_type,user_id,user_phone,user_name,value_type,item_id,value,create_time,next_open_time,model,duration_type,custom_plan,curr_temp,nick_name,result,exe_result,fb_temp,remark,duplicate_data_N)
+            sqls.append(sql)
+    else:
+        print("%s 时间段%s至%s没有查到数据"%(datetime_now(),create_time_start,create_time_end))
+    if sqls:
+        print("%s 批量插入无重复数据到feedback_history表"%datetime_now())
+        for i in range(0, len(sqls), 1000):
+            sqlranges = sqls[i:i + 1000]
+            sqlranges = INSERT_DADA_SQL%(my_database) + ",".join(sqlranges)
+            #删除feedback里的数据
+            sql_1 = DELETE_DUPLICATE_MULT_SQL%(my_database,my_database,create_time_start,create_time_end)
+            MysqlUtil.update_two(sqlranges,sql_1)
+
+MysqlUtil.close()
+
+
+