Pārlūkot izejas kodu

后端: 某单位待评价合同数量

baichengfei 4 gadi atpakaļ
vecāks
revīzija
6184ca252e

+ 32 - 17
src/dashoo.cn/backend/api/controllers/oilcontract/contract.go

@@ -504,14 +504,14 @@ func (this *OilContractController) ImportExcel() {
 			var con1 contract.OilContract
 			lineNo := strconv.Itoa(i + 1)
 			fmt.Println(lineNo)
-			svc.GetEntityByWhere(OilContractName, "ContractNo = '" + sheet.Rows[i].Cells[0].String() + "'", &con1)
+			svc.GetEntityByWhere(OilContractName, "ContractNo = '"+sheet.Rows[i].Cells[0].String()+"'", &con1)
 			if con1.Id > 0 {
 				con1.ContractName = sheet.Rows[i].Cells[1].String()
 				con1.Amount = sheet.Rows[i].Cells[2].String()
 				con1.ClassName = sheet.Rows[i].Cells[3].String()
 				con1.ContractSonClass = sheet.Rows[i].Cells[4].String()
 				con1.SmallClass = sheet.Rows[i].Cells[5].String()
-				con1.SignedDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[6].Value), time.Local)
+				con1.SignedDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[6].Value), time.Local)
 				con1.Number = sheet.Rows[i].Cells[9].String()
 				con1.ChooseWay = sheet.Rows[i].Cells[10].String()
 				con1.ContractMark = sheet.Rows[i].Cells[11].String()
@@ -538,14 +538,14 @@ func (this *OilContractController) ImportExcel() {
 				con1.SingUnit = sheet.Rows[i].Cells[22].String()
 				con1.Place = sheet.Rows[i].Cells[23].String()
 
-				con1.StartDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[24].Value), time.Local)
-				con1.EndDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[25].Value), time.Local)
+				con1.StartDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[24].Value), time.Local)
+				con1.EndDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[25].Value), time.Local)
 				con1.DisputeResolution = sheet.Rows[i].Cells[26].String()
 				con1.Remark = sheet.Rows[i].Cells[27].String()
 				if con1.ProjectOwner != sheet.Rows[i].Cells[28].String() {
 					con1.ProjectOwner = con1.ProjectOwner + "," + sheet.Rows[i].Cells[28].String()
 				}
-				con1.SubmitDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[29].Value), time.Local)
+				con1.SubmitDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[29].Value), time.Local)
 				con1.SealName = sheet.Rows[i].Cells[30].String()
 				con1.PoNumber = sheet.Rows[i].Cells[31].String()
 				con1.ImportStatus = 0
@@ -560,17 +560,17 @@ func (this *OilContractController) ImportExcel() {
 			con.ContractSonClass = sheet.Rows[i].Cells[4].String()
 			con.SmallClass = sheet.Rows[i].Cells[5].String()
 			//con.SignedDate = convertToFormatDay(sheet.Rows[i].Cells[6].Value)
-			con.SignedDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[6].Value), time.Local)
+			con.SignedDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[6].Value), time.Local)
 			con.ImportSecondUnit = sheet.Rows[i].Cells[7].String()
 
 			con.ImportSupplierName = sheet.Rows[i].Cells[8].String()
 			var supp supplier.OilSupplier
-			svc.GetEntityByWhere(OilSupplierName, "SupplierName = '" + con.ImportSupplierName + "'", &supp)
+			svc.GetEntityByWhere(OilSupplierName, "SupplierName = '"+con.ImportSupplierName+"'", &supp)
 			if supp.Id > 0 {
 				con.SupplierId = supp.Id
 			}
 			var org organize.Base_Organize
-			svc.GetEntityByWhere("Base_Organize", "FullName = '" + sheet.Rows[i].Cells[7].String() + "'", &org)
+			svc.GetEntityByWhere("Base_Organize", "FullName = '"+sheet.Rows[i].Cells[7].String()+"'", &org)
 			if org.Id > 0 {
 				con.SecondUnit = org.Id
 			}
@@ -600,12 +600,12 @@ func (this *OilContractController) ImportExcel() {
 			con.SingUnit = sheet.Rows[i].Cells[22].String()
 			con.Place = sheet.Rows[i].Cells[23].String()
 
-			con.StartDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[24].Value), time.Local)
-			con.EndDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[25].Value), time.Local)
+			con.StartDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[24].Value), time.Local)
+			con.EndDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[25].Value), time.Local)
 			con.DisputeResolution = sheet.Rows[i].Cells[26].String()
 			con.Remark = sheet.Rows[i].Cells[27].String()
 			con.ProjectOwner = sheet.Rows[i].Cells[28].String()
-			con.SubmitDate,_ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[29].Value), time.Local)
+			con.SubmitDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[29].Value), time.Local)
 			con.SealName = sheet.Rows[i].Cells[30].String()
 			con.PoNumber = sheet.Rows[i].Cells[31].String()
 			con.ImportStatus = 0
@@ -863,8 +863,8 @@ func (this *OilContractController) AddEntity() {
 
 	if err == nil {
 		if model.IsYear == 1 {
-			svc.GetEntityByWhere(OilContractName, "ContractNo = '" + model.ContractNo + "'", &model)
-			svc.GetEntityByWhere("OilContractMoney", "Year = '" + time.Now().Format("2006") + "' and ContractId = " + strconv.Itoa(model.Id), &model1)
+			svc.GetEntityByWhere(OilContractName, "ContractNo = '"+model.ContractNo+"'", &model)
+			svc.GetEntityByWhere("OilContractMoney", "Year = '"+time.Now().Format("2006")+"' and ContractId = "+strconv.Itoa(model.Id), &model1)
 			model1.ContractId = model.Id
 			model1.Money = model.IsYearMoney
 			model1.Year = time.Now().Format("2006")
@@ -1065,7 +1065,7 @@ func (this *OilContractController) UpdateEntity() {
 	err := svc.UpdateEntityBytbl(OilContractName, id, &model, cols)
 	if err == nil {
 		if model.IsYear == 1 && model.IsYearMoney != "" {
-			svc.GetEntityByWhere("OilContractMoney", "Year = '" + time.Now().Format("2006") + "' and ContractId = " + id, &model1)
+			svc.GetEntityByWhere("OilContractMoney", "Year = '"+time.Now().Format("2006")+"' and ContractId = "+id, &model1)
 			if model1.Id > 0 {
 				model1.Money = model.IsYearMoney
 				model1.ModifiedOn = time.Now()
@@ -1073,7 +1073,7 @@ func (this *OilContractController) UpdateEntity() {
 				model1.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
 				svc.UpdateEntityBytbl("OilContractMoney", model1.Id, &model1, []string{"Money"})
 			} else {
-				model1.ContractId,_ = strconv.Atoi(id)
+				model1.ContractId, _ = strconv.Atoi(id)
 				model1.Money = model.IsYearMoney
 				model1.Year = time.Now().Format("2006")
 				model1.CreateOn = time.Now()
@@ -1158,10 +1158,25 @@ func (this *OilContractController) CountMoney() {
 		return
 	}
 
-
 	var model contract.OilContractMoney
 	svc := contract.GetOilContractService(utils.DBE)
-	svc.GetSum(&model, "Year != '" + time.Now().Format("2006")  + "'")
+	svc.GetSum(&model, "Year != '"+time.Now().Format("2006")+"'")
 	this.Data["json"] = &model
 	this.ServeJSON()
 }
+
+// @Title 获取列表
+// @Description get user by token
+// @Success 200 {object} []oilcontract.OilContract
+// @router /need-eva-list [get]
+func (this *OilContractController) GetNeedEvaList() {
+	var list []contract.OilContract
+	sql := ` select a.* from OilContract a left join OilContractReview b on b.ContractId=a.Id where a.SecondUnit=` + strconv.Itoa(this.User.UnitId) + ` and (b.Status=0 or b.Status=NULL)  `
+	utils.DBE.Sql(sql).Find(&list)
+
+	var dataInfo DataInfo
+	dataInfo.Items = list
+	dataInfo.CurrentItemCount = int64(len(list))
+	this.Data["json"] = &dataInfo
+	this.ServeJSON()
+}