caipin hace 4 años
padre
commit
0557e2a6e3

+ 4 - 2
comm/functions.go

@@ -120,7 +120,8 @@ func MakeFolderContract(Data []*viewmodels.FolderContract, node *viewmodels.Fold
 			qualityTotalRectification = safeTotalRectification + v.QualityRectification
 			qualityTotalRectificationIn = safeTotalRectificationIn + v.QualityRectificationIn
 		}
-		node.ContractsIncome = fmt.Sprintf("%.2f", totalIncome)
+
+		node.ContractsIncome = fmt.Sprintf("%G", totalIncome)
 		node.Contracts = totalContractNumber
 		// 汇款进度
 		quotient := totalReturn / totalIncome
@@ -129,7 +130,8 @@ func MakeFolderContract(Data []*viewmodels.FolderContract, node *viewmodels.Fold
 		}
 		node.ContractsIncomeProgress = fmt.Sprintf("%.0f", (quotient)*100) + "%"
 		// 支出相关
-		node.ContractsPay = fmt.Sprintf("%.2f", totalPay)
+		// node.ContractsPay =  fmt.Sprintf("%.2f", totalPay)
+		node.ContractsPay = fmt.Sprintf("%G", totalPay)
 		quotient = totalPaid / totalPay
 		if math.IsNaN(quotient) {
 			quotient = 0

+ 2 - 2
dao/quality_dao.go

@@ -163,8 +163,8 @@ func (d *QualityDao) GetTypeYear(bidsectionId int, year int) []viewmodels.Qualit
 
 	datalist := make([]viewmodels.QualitySurveyList, 0)
 	_ = d.engine.Table("`cm_approver` as cs").
-		Select("cs.data_id as id, cs.`create_time`, s.`inspection_detail`, cs.status, pa.`name` as `audit_name`").
-		Where("cs.bidsection_id = ? and data_type=2 and cs.create_time>='"+startYear+"' and cs.create_time<='"+endYear+"' ", bidsectionId).
+		Select("cs.data_id as id, cs.`update_time`, s.`inspection_detail`, cs.status, pa.`name` as `audit_name`").
+		Where("cs.bidsection_id = ? and status=1 and progress=1 and data_type=2 and cs.update_time>='"+startYear+"' and cs.update_time<='"+endYear+"' ", bidsectionId).
 		Join("left", "cm_quality as s", "s.id = cs.data_id").
 		Join("left", "cm_project_account as pa", "pa.id = cs.uid").
 		Desc("id").

+ 2 - 2
dao/safe_dao.go

@@ -162,8 +162,8 @@ func (d *SafeDao) GetTypeYear(bidsectionId int, year int) []viewmodels.SafeSurve
 
 	datalist := make([]viewmodels.SafeSurveyList, 0)
 	_ = d.engine.Table("`cm_approver` as cs").
-		Select("cs.data_id as id, cs.`create_time`, s.`inspection_detail`, cs.status, pa.`name` as `audit_name`").
-		Where("cs.bidsection_id = ? and data_type=1 and cs.create_time>='"+startYear+"' and cs.create_time<='"+endYear+"' ", bidsectionId).
+		Select("cs.data_id as id, cs.`update_time`, s.`inspection_detail`, cs.status, pa.`name` as `audit_name`").
+		Where("cs.bidsection_id = ? and status=1 and progress=1 and data_type=1 and cs.update_time>='"+startYear+"' and cs.update_time<='"+endYear+"' ", bidsectionId).
 		Join("left", "cm_safe as s", "s.id = cs.data_id").
 		Join("left", "cm_project_account as pa", "pa.id = cs.audit_id").
 		Desc("id").

+ 1 - 1
models/cm_approver.go

@@ -5,7 +5,7 @@ import (
 )
 
 type CmApprover struct {
-	Id           int       `xorm:"not null pk comment('自增ID') INT(11)"`
+	Id           int       `xorm:"not null pk autoincr comment('自增ID') INT(11)"`
 	ProjectId    int       `xorm:"comment('项目ID') INT(11)"`
 	BidsectionId int       `xorm:"comment('标段id') INT(11)"`
 	DataType     int       `xorm:"not null comment('数据类型(1安全2质量)') TINYINT(1)"`

+ 1 - 1
services/quality_service.go

@@ -240,7 +240,7 @@ func (s *qualityService) GetSurvey(projectId int, bidsectionId int) map[string]i
 			rectifyedTotal++
 		}
 
-		index := item.CreateTime.Format(conf.SysTimeformMonth)
+		index := item.UpdateTime.Format(conf.SysTimeformMonth)
 		submitData[index] = submitData[index] + 1
 
 		if item.Status == 4 {

+ 1 - 1
services/safe_service.go

@@ -273,7 +273,7 @@ func (s *safeService) GetSurvey(projectId int, bidsectionId int) map[string]inte
 		// 		// }
 		// 	}
 		// }
-		index := item.CreateTime.Format(conf.SysTimeformMonth)
+		index := item.UpdateTime.Format(conf.SysTimeformMonth)
 		submitData[index] = submitData[index] + 1
 		// if item.Status == 0 {
 		// 	submitData[item.CreateTime.Format(conf.SysTimeformMonth)] = submitData[item.CreateTime.Format(conf.SysTimeformMonth)] + 1

+ 11 - 4
services/tree_service.go

@@ -216,8 +216,12 @@ func (s *treeService) GetAllContract(projectId int, account *models.CmProjectAcc
 			folder.BidsectionId = bidsectionId
 			// 合同数据
 			folder.Contracts = data.Contracts
-			folder.ContractsIncome = data.ContractsIncome
-			folder.ContractsReturned = data.ContractsReturned
+
+			contractsIncome, _ := strconv.ParseFloat(data.ContractsIncome, 64)
+			contractsReturned, _ := strconv.ParseFloat(data.ContractsReturned, 64)
+
+			folder.ContractsIncome = fmt.Sprintf("%G", contractsIncome)
+			folder.ContractsReturned = fmt.Sprintf("%G", contractsReturned)
 			// 汇款进度
 			ContractsIncome, err := strconv.ParseFloat(data.ContractsIncome, 64)
 			if err != nil {
@@ -231,8 +235,11 @@ func (s *treeService) GetAllContract(projectId int, account *models.CmProjectAcc
 				folder.ContractsIncomeProgress = fmt.Sprintf("%.0f", (ContractsReturned/ContractsIncome)*100) + "%"
 			}
 
-			folder.ContractsPay = data.ContractsPay
-			folder.ContractsPaid = data.ContractsPaid
+			contractsPay, _ := strconv.ParseFloat(data.ContractsPay, 64)
+			contractsPaid, _ := strconv.ParseFloat(data.ContractsPaid, 64)
+
+			folder.ContractsPay = fmt.Sprintf("%G", contractsPay)
+			folder.ContractsPaid = fmt.Sprintf("%G", contractsPaid)
 			// 支付进度
 			ContractsPay, err := strconv.ParseFloat(data.ContractsPay, 64)
 			if err != nil {

+ 1 - 1
web/viewmodels/quality.go

@@ -44,7 +44,7 @@ type QualityList struct {
 
 type QualitySurveyList struct {
 	Id               string    `form:"id" json:"id" `
-	CreateTime       time.Time `form:"createTime" json:"createTime"`
+	UpdateTime       time.Time `form:"updateTime" json:"updateTime"`
 	InspectionDetail string    `form:"inspectionDetail" json:"inspectionDetail"`
 	Status           int       `form:"status" json:"status"`
 	AuditName        string    `form:"auditName" json:"auditName"`

+ 1 - 1
web/viewmodels/safe.go

@@ -44,7 +44,7 @@ type SafeList struct {
 
 type SafeSurveyList struct {
 	Id               string    `form:"id" json:"id" `
-	CreateTime       time.Time `form:"createTime" json:"createTime"`
+	UpdateTime       time.Time `form:"updateTime" json:"updateTime"`
 	InspectionDetail string    `form:"inspectionDetail" json:"inspectionDetail"`
 	Status           int       `form:"status" json:"status"`
 	AuditName        string    `form:"auditName" json:"auditName"`