Commit 7ab9f3ae by 杨林龙

处理八月份审计数据

1 parent 6aac896d
Showing 1 changed file with 38 additions and 7 deletions
......@@ -89,6 +89,22 @@ def deal_data(startTime, endTime):
handle_return_device("渠道", data=2021, devType=6)
# 将新增的数据拷贝到生成环境同步的表中
def copyNewDataToProTable():
bizConn = MySQL(g_pro_biz_dbcfg)
updateSql = f"""
insert into dj_device_details (channel,sn,device_type,delivery_time,delivery_merchant,active_time,
active_merchant,pk_name,pk_period,settle_merchant,settle_order,settle_time,pk_price,hw_price,install_price,hw_cost,
install_cost)
SELECT channel,sn,device_type,delivery_time,delivery_merchant,active_time,
active_merchant,pk_name,pk_period,settle_merchant,settle_order,settle_time,pk_price,hw_price,install_price,hw_cost,
install_cost from dj_2021_settle_details where settle_time >= '{startTime}';
"""
print("copyNewDataToProTable updateSql==" + updateSql)
if not bizConn.update(updateSql):
logger.error("copyNewDataToProTable fail, sql=%s", updateSql)
def active():
# 记录仪渠道激活
# active_direct_record_device()
......@@ -138,31 +154,43 @@ def rollback(startTime, endTime):
print("updateSql05==" + updateSql05)
sqlList.append(updateSql05)
# updateSql06 = """
# updateSql06 = f"""
# truncate TABLE dj_2023_settle_details;
# """
# print("updateSql06==" + updateSql06)
# sqlList.append(updateSql06)
# updateSql07 = """
# updateSql07 = f"""
# truncate TABLE dj_2023_settle_details_record;
# """
# print("updateSql07==" + updateSql07)
# sqlList.append(updateSql07)
# updateSql08 = """
# updateSql08 = f"""
# truncate TABLE dj_2023_settle_details_return;
# """
# print("updateSql08==" + updateSql08)
# sqlList.append(updateSql08)
# updateSql09 = """
# updateSql09 = f"""
# truncate TABLE dj_2023_settlment_order;
# """
# print("updateSql09==" + updateSql09)
# sqlList.append(updateSql09)
# updateSql10 = """
# updateSql10 = f"""
# truncate TABLE dj_2023_settlment_order_finance;
# """
# print("updateSql10==" + updateSql10)
# sqlList.append(updateSql10)
# 删除同步到生产库中的表数据
updateSql11 = f"""
DELETE FROM dj_device_details WHERE settle_time >= '{startTime}';
"""
print("updateSql11==" + updateSql11)
sqlList.append(updateSql11)
if not bizConn.updateList(sqlList):
logger.error("handle_return_device fail, sql=%s", ",".join(sqlList))
......@@ -195,8 +223,8 @@ def pre_deal(startTime, endTime):
if __name__ == "__main__":
startTime = "2023-07-01"
endTime = "2023-08-01"
startTime = "2023-08-01"
endTime = "2023-09-01"
# 将财务和商务表导入到数据库
# runScript()
# pre_deal(startTime, endTime)
......@@ -209,4 +237,7 @@ if __name__ == "__main__":
# 回滚数据
# rollback(startTime, endTime)
# 将新增的数据拷贝到生成环境同步的表中
# copyNewDataToProTable(startTime)
print("end===")
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!