Commit 1582f881 by huangchengyi

1.0

parent aea3f4cb
Showing with 19 additions and 4 deletions
......@@ -29,6 +29,13 @@ const (
_sql5 = "select sum(final_score) sum_dong_score from lie_scores where type=2 and com_credits_id=%d and month in(%s)"; //总计动态信用分
_sql6 = "select * from lie_basic_month where erp_company_code='%s' and month in(%s)" //获取详情
_sql7 = "SELECT ((t.my_rate+1)/(t.plat_rate+1))-1 as delay_rate FROM " +
"( " +
"SELECT " +
" (SELECT sum(delay_amount)/sum(receive_amount) from lie_basic_month where erp_company_code = '%s' and MONTH in (%s)) my_rate, " +
" (SELECT sum(delay_amount)/sum(receive_amount) from lie_basic_month where MONTH in (%s)) plat_rate " +
")t "
)
/*
......@@ -40,7 +47,6 @@ func (d *dao) DongRate(ctx context.Context,y map[string]string,modelItems []map[
score_one float64 =0; //对应梯度分数
s1,s2 string //拼接六个月月份字符串
)
sqla := fmt.Sprintf(_sql4,y["erp_company_code"],month_six)
c1,_ := d.QueryOne(ctx,1,sqla)
......@@ -69,17 +75,26 @@ func (d *dao) DongRate(ctx context.Context,y map[string]string,modelItems []map[
case 43: //9 退货率 : 退货总金额/出库总金额(下单总金额) PS退货总金额金额为负数的订单
s1 = c1["return_amount"]
s2 = c1["unload_amount"]
case 44: //近6个月逾期变化率
sql7 := fmt.Sprintf(_sql7,y["erp_company_code"],month_six,month_six)
c3,_ := d.QueryOne(ctx,1,sql7)
if c3["delay_rate"] == "" {
c3["delay_rate"] = "0"
}
ladder_rate = logic.MyFloat64(c3["delay_rate"]);
remark = c3["delay_rate"]
case 48: // 账期使用倍数统计
last_month := time.Now().Format("2006")+time.Now().AddDate(0, -1, 0).Format("01")
sql6 := fmt.Sprintf(_sql4,y["erp_company_code"],last_month)
c3,_ := d.QueryOne(ctx,1,sql6)
if c3["period_use_times_six"] == "" {
logic.LogWrite("账期使用倍数为空:"+y["erp_company_code"],"dong_error",1)
return
c3["period_use_times_six"] = "0" ;
}
ladder_rate = logic.MyFloat64(c3["period_use_times_six"]); //六个月的账期使用倍数
remark = c3["period_use_times_six"]
}
if project_id != 48 {
if project_id != 48 && project_id != 44{
if s1 == "" || s2 == "" {
logic.LogWrite("没有订单数据跳过:"+y["erp_company_code"],"dong_error",1)
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment