Commit ba0f59fa by Joneq

清除已统计分数

parent f1c04cba
......@@ -42,6 +42,17 @@ const (
//计算逾期金额率:延期支付时间超过平均账期的金额/收款总额:
func (d *dao) BankDongMain(ctx context.Context,project_id int,erp_company_code string) (r []map[string]interface{},err error) {
execSql := "truncate `lie_scores` "
row,err := d.db_bank.Exec(ctx,execSql)
if err != nil {
logic.CheckErr(err)
}else{
affectNum,_ := row.RowsAffected()
fmt.Println(affectNum)
}
panic(123)
var (
weight float64 //权重
month_six string //拼接6个月字符串,sql用
......
......@@ -60,20 +60,26 @@ func (d *dao) InsertScores(ctx context.Context,score model.Scores) (insertId int
//增加或者修改记录(动态模型专用)
func (d *dao) InsertScores2(ctx context.Context,score model.Scores,month_six_zi int64) (insertId int64,err error) {
//defer d.db.Close()
var(
exitId int
exitId int64
execSql string
affectNum int64
rows *sql.Rows
)
//ss := fmt.Sprintf("select id from lie_scores where `type` = %d and project_pid = %d and project_id = %d and com_credits_id = %d limit 0,1", score.Type,score.ProjectPid,score.ProjectId,score.ComCreditsId)
//print(ss)
err = d.db.QueryRow(ctx,"select id from lie_scores where `type` = ? and project_pid = ? and project_id = ? and com_credits_id = ? and month= ? limit 0,1", score.Type,score.ProjectPid,score.ProjectId,score.ComCreditsId,month_six_zi).Scan(&exitId)
if err != nil {
//fmt.Print(err)
//sql := fmt.Sprintf("select id from lie_scores where `type` = %d and project_pid = %d and project_id = %d and com_credits_id = %d and month= %d limit 0,1", score.Type,score.ProjectPid,score.ProjectId,score.ComCreditsId,month_six_zi);
//fmt.Print("查询失败:"+sql)
//os.Exit(1)
rows,err = d.db.Query(ctx,"select id from lie_scores where `type` = ? and project_pid = ? and project_id = ? and com_credits_id = ? and month= ? limit 0,1", score.Type,score.ProjectPid,score.ProjectId,score.ComCreditsId,month_six_zi)
defer rows.Close()
logic.CheckErr(err)
twoMap,err := GetAllParam(rows)
exitId = 0
for _,v:=range twoMap{
exitId = logic.StringTurnInt64(v["id"])
break
}
if exitId == 0 {
......@@ -108,20 +114,27 @@ func (d *dao) InsertScores2(ctx context.Context,score model.Scores,month_six_zi
func (d *dao) InsertBankScores(ctx context.Context,score model.Scores,month_six_zi int64) (insertId int64,err error) {
//defer d.db.Close()
var(
exitId int
exitId int64
execSql string
affectNum int64
rows *sql.Rows
)
//ss := fmt.Sprintf("select id from lie_scores where `type` = %d and project_pid = %d and project_id = %d and com_credits_id = %d limit 0,1", score.Type,score.ProjectPid,score.ProjectId,score.ComCreditsId)
//print(ss)
err = d.db_bank.QueryRow(ctx,"select id from lie_scores where `type` = ? and project_pid = ? and project_id = ? and com_credits_id = ? and month= ? limit 0,1", score.Type,score.ProjectPid,score.ProjectId,score.ComCreditsId,month_six_zi).Scan(&exitId)
if err != nil {
//fmt.Print(err)
//sql := fmt.Sprintf("select id from lie_scores where `type` = %d and project_pid = %d and project_id = %d and com_credits_id = %d and month= %d limit 0,1", score.Type,score.ProjectPid,score.ProjectId,score.ComCreditsId,month_six_zi);
//fmt.Print("查询失败:"+sql)
//os.Exit(1)
rows,err = d.db_bank.Query(ctx,"select id from lie_scores where `type` = ? and project_pid = ? and project_id = ? and com_credits_id = ? and month= ? limit 0,1", score.Type,score.ProjectPid,score.ProjectId,score.ComCreditsId,month_six_zi)
defer rows.Close()
logic.CheckErr(err)
twoMap,err := GetAllParam(rows)
exitId = 0
for _,v:=range twoMap{
exitId = logic.StringTurnInt64(v["id"])
break
}
if exitId == 0 {
execSql = "INSERT INTO `lie_scores` (`type`, `project_pid`, `project_id`, `total_score`, `current_score`, `weight`, `final_score`, `com_credits_id`, `create_time`,`current_rate`,`month`,`remark`)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?)"
row,err := d.db_bank.Exec(ctx,execSql,score.Type,score.ProjectPid,score.ProjectId,score.TotalScore,score.CurrentScore,score.Weight,score.FinalScore,score.ComCreditsId,time.Now().Unix(),score.Current_rate,score.Month,score.Remark)
......
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