|
|
@@ -1,6 +1,7 @@
|
|
|
package oilcontract
|
|
|
|
|
|
import (
|
|
|
+ "dashoo.cn/backend/api/business/oilcontract/contract"
|
|
|
"dashoo.cn/backend/api/business/oilcontract/contractSumScoreItems"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/supplier"
|
|
|
"dashoo.cn/business2/permission"
|
|
|
@@ -729,71 +730,114 @@ func (this *OilContractSumScoreController) UpdateEntity() {
|
|
|
}
|
|
|
|
|
|
// @Title 从数据录入数据导出到word文档
|
|
|
-// @Description 数据存入word
|
|
|
+// @Description 数据存入word1
|
|
|
// @Success 200 {object} controllers.Request
|
|
|
// @router /exportword/:id [get]
|
|
|
func (this *OilContractSumScoreController) DocExport() {
|
|
|
- Id := this.Ctx.Input.Param(":id")
|
|
|
- var errinfo ErrorInfo
|
|
|
- if Id == "" {
|
|
|
- errinfo.Message = "操作失败!请求信息不完整"
|
|
|
- errinfo.Code = -2
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- return
|
|
|
+
|
|
|
+ where := " 1=1"
|
|
|
+ SupplierId := this.Ctx.Input.Param(":id")
|
|
|
+ ContractClass := this.GetString("ContractClass", "02")
|
|
|
+ Result2 := this.GetString("Result2")
|
|
|
+
|
|
|
+ if SupplierId != "" {
|
|
|
+ where = where + " and contract.SupplierId = " + SupplierId
|
|
|
+ }
|
|
|
+ if ContractClass != "" {
|
|
|
+ where = where + " and contract.ContractClass = '" + ContractClass + "'"
|
|
|
}
|
|
|
|
|
|
- svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+ // 今年的汇总
|
|
|
+ year := strconv.Itoa(time.Now().Year())
|
|
|
+ month := "01"
|
|
|
+ day := "01"
|
|
|
+ where = where + " and review.CreateOn>='" + year + "-" + month + "-" + day + "' "
|
|
|
+
|
|
|
+ //if CreateOn != "" {
|
|
|
+ // dates := strings.Split(CreateOn, ",")
|
|
|
+ // if len(dates) == 2 {
|
|
|
+ // minDate := dates[0]
|
|
|
+ // maxDate := dates[1]
|
|
|
+ // where = where + " and review.CreateOn>='" + minDate + "' and review.CreateOn<='" + maxDate + "'"
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+
|
|
|
+ // 审核通过的参与核算
|
|
|
+ where = where + " and review.Status='8' "
|
|
|
|
|
|
- var model contractSumScore.OilContractSumScore
|
|
|
svc := contractSumScore.GetOilContractSumScoreService(utils.DBE)
|
|
|
- svc.GetEntityByIdBytbl(OilContractSumScoreName, Id, &model)
|
|
|
+ var list contractSumScore.OilContractComputeSumScoreVo
|
|
|
+ svc.GetComputeEntity(&list, where)
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
|
|
|
var supplierModel supplier.OilSupplier
|
|
|
supplierSvc := supplier.GetOilSupplierService(utils.DBE)
|
|
|
- supplierSvc.GetEntityByIdBytbl(OilSupplierName, model.SupplierId, &supplierModel)
|
|
|
+ supplierSvc.GetEntityById (SupplierId, &supplierModel)
|
|
|
+
|
|
|
+ var model contractSumScore.OilContractSumScore
|
|
|
+ //svc.GetEntity(&model, "SupplierId = " + supplierModel.Id)
|
|
|
|
|
|
var supplierCertModel suppliercert.OilSupplierCert
|
|
|
suppliercertSvc := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
- suppliercertSvc.GetEntityByIdBytbl(OilSupplierCertName, model.SupplierId, &supplierCertModel)
|
|
|
+ suppliercertSvc.GetEntityByIdBytbl(OilSupplierCertName, supplierModel.Id, &supplierCertModel)
|
|
|
|
|
|
- var item contractSumScoreItems.OilContractSumScoreItems
|
|
|
- itemSvc := contractSumScoreItems.GetOilContractSumScoreItemsService(utils.DBE)
|
|
|
- where := " 1=1 AND SumScoreId= '" + utils.ToStr(model.Id) + "' AND Category = '0' "
|
|
|
- itemSvc.GetEntityByWhere(OilContractSumScoreItemsName, where, &item)
|
|
|
+ var item []contractSumScoreItems.OilContractSumScoreItems
|
|
|
+ var con contract.OilContract
|
|
|
+ svc.GetComputeEntity1(&item, "contract.SupplierId = " + SupplierId)
|
|
|
+ //itemSvc := contractSumScoreItems.GetOilContractSumScoreItemsService(utils.DBE)
|
|
|
+ //where1 := " 1=1 AND SumScoreId= '" + utils.ToStr(model.Id) + "' AND Category = '0' "
|
|
|
+ //itemSvc.GetEntityByWhere(OilContractSumScoreItemsName, where1, &item)
|
|
|
+ total := svc.GetCount( "SupplierId = " + SupplierId)
|
|
|
+ svc.GetSum(&con,"SupplierId = " + SupplierId + " and PlanFinishDate >= '"+ year + "-01-01" + "' and PlanFinishDate <= '"+ year + "-12-31'")
|
|
|
|
|
|
datamap := structToMapDemo(model)
|
|
|
+ datamap["SupplierName"] = supplierModel.SupplierName
|
|
|
datamap["AccessCardNo"] = supplierCertModel.AccessCardNo
|
|
|
datamap["ContactName"] = supplierModel.ContactName
|
|
|
datamap["Mobile"] = supplierModel.Mobile
|
|
|
- datamap["Result1"] = item.Result2
|
|
|
- datamap["Result2"] = item.Result1
|
|
|
-
|
|
|
- datamap["SumScore1"] = item.SumScore1
|
|
|
- datamap["Content1"] = item.Content1
|
|
|
- datamap["SumScore2"] = item.SumScore2
|
|
|
- datamap["Content2"] = item.Content2
|
|
|
- datamap["SumScore3"] = item.SumScore3
|
|
|
- datamap["Content3"] = item.Content3
|
|
|
- datamap["SumScore4"] = item.SumScore4
|
|
|
- datamap["Content4"] = item.Content4
|
|
|
- datamap["SumScore5"] = item.SumScore5
|
|
|
- datamap["Content5"] = item.Content5
|
|
|
- datamap["SumScore6"] = item.SumScore6
|
|
|
- datamap["Content6"] = item.Content6
|
|
|
- datamap["SumScore7"] = item.SumScore7
|
|
|
- datamap["Content7"] = item.Content7
|
|
|
- datamap["SumScore8"] = item.SumScore8
|
|
|
- datamap["Content8"] = item.Content8
|
|
|
-
|
|
|
- datamap["B1"] = item.B1
|
|
|
- datamap["B2"] = item.B2
|
|
|
- datamap["B3"] = item.B3
|
|
|
- datamap["B4"] = item.B4
|
|
|
- datamap["B5"] = item.B5
|
|
|
- datamap["B6"] = item.B6
|
|
|
- datamap["B7"] = item.B7
|
|
|
- datamap["B8"] = item.B8
|
|
|
+ datamap["Result1"] = Result2
|
|
|
+ if list.Evaluate == "1" {
|
|
|
+ datamap["Result2"] = "优秀"
|
|
|
+ } else if list.Evaluate == "2" {
|
|
|
+ datamap["Result2"] = "合格"
|
|
|
+ } else if list.Evaluate == "3" {
|
|
|
+ datamap["Result2"] = "不合格"
|
|
|
+ } else {
|
|
|
+ datamap["Result2"] = "观察使用"
|
|
|
+ }
|
|
|
+ datamap["SumScore"] = list.Score
|
|
|
+ datamap["SumScore1"] = list.Score1
|
|
|
+ datamap["Count"] = total
|
|
|
+ Amount := 10000.00
|
|
|
+ if con.Amount != "" {
|
|
|
+ Amount ,_ = strconv.ParseFloat(con.Amount, 64)
|
|
|
+ }
|
|
|
+ datamap["Money"] = Amount/10000
|
|
|
+ datamap["Content1"] = strings.TrimLeft(item[0].Content1, ",")
|
|
|
+ datamap["SumScore2"] = list.Score2
|
|
|
+ datamap["Content2"] = strings.TrimLeft(item[1].Content1, ",")
|
|
|
+ datamap["SumScore3"] = list.Score3
|
|
|
+ datamap["Content3"] = strings.TrimLeft(item[2].Content1, ",")
|
|
|
+ datamap["SumScore4"] = list.Score4
|
|
|
+ datamap["Content4"] = strings.TrimLeft(item[3].Content1, ",")
|
|
|
+ datamap["SumScore5"] = list.Score5
|
|
|
+ datamap["Content5"] = strings.TrimLeft(item[4].Content1, ",")
|
|
|
+ datamap["SumScore6"] = list.Score6
|
|
|
+ datamap["Content6"] = strings.TrimLeft(item[5].Content1, ",")
|
|
|
+ datamap["SumScore7"] = list.Score7
|
|
|
+ datamap["Content7"] = strings.TrimLeft(item[6].Content1, ",")
|
|
|
+ datamap["SumScore8"] = list.Score8
|
|
|
+ datamap["Content8"] = strings.TrimLeft(item[7].Content1, ",")
|
|
|
+
|
|
|
+ datamap["B1"] = list.B1
|
|
|
+ datamap["B2"] = list.B2
|
|
|
+ datamap["B3"] = list.B3
|
|
|
+ datamap["B4"] = list.B4
|
|
|
+ datamap["B5"] = list.B5
|
|
|
+ datamap["B6"] = list.B6
|
|
|
+ datamap["B7"] = list.B7
|
|
|
+ datamap["B8"] = list.B8
|
|
|
|
|
|
datamap["Year"] = model.Year
|
|
|
datamap["Department"] = model.Unit
|
|
|
@@ -802,11 +846,11 @@ func (this *OilContractSumScoreController) DocExport() {
|
|
|
datamap["CreateDate"] = t.Format("2006年01月02日")
|
|
|
datamap["Creater"] = this.User.Realname
|
|
|
|
|
|
- if item.Conclusion == 1 {
|
|
|
+ if list.Evaluate == "1" {
|
|
|
datamap["Conclusion"] = "☑优秀 □合格 □观察使用 □不合格"
|
|
|
- } else if item.Conclusion == 2 {
|
|
|
+ } else if list.Evaluate == "2" {
|
|
|
datamap["Conclusion"] = "□优秀 ☑合格 □观察使用 □不合格"
|
|
|
- } else if item.Conclusion == 3 {
|
|
|
+ } else if list.Evaluate == "3" {
|
|
|
datamap["Conclusion"] = "□优秀 □合格 □观察使用 ☑不合格"
|
|
|
} else {
|
|
|
datamap["Conclusion"] = "□优秀 □合格 ☑观察使用 □不合格"
|
|
|
@@ -819,11 +863,20 @@ func (this *OilContractSumScoreController) DocExport() {
|
|
|
retDocUrl := svcActiviti.FillWordTemplate(datamap, Url, fileName)
|
|
|
//retDocUrl := svcActiviti.FillWordWatermarkTemplate(datamap, Url, fileName, model.SupplierName)
|
|
|
var datainfo ErrorDataInfo
|
|
|
- datainfo.Code = 0
|
|
|
- datainfo.Item = retDocUrl
|
|
|
- datainfo.Message = "导出成功"
|
|
|
- this.Data["json"] = &datainfo
|
|
|
- this.ServeJSON()
|
|
|
+ if retDocUrl != "" {
|
|
|
+ datainfo.Code = 0
|
|
|
+ datainfo.Item = retDocUrl
|
|
|
+ datainfo.Message = "导出成功"
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+ } else {
|
|
|
+ datainfo.Code = -1
|
|
|
+ datainfo.Item = retDocUrl
|
|
|
+ datainfo.Message = "导出失败"
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// @Title 从数据录入数据导出到Excel文档
|