|
|
@@ -832,8 +832,10 @@ func (this *OilContractSumScoreController) DocExport() {
|
|
|
// @router /exportexcel [get]
|
|
|
func (this *OilContractSumScoreController) ExcelExport() {
|
|
|
//获取分页信息
|
|
|
- where := " 1=1 "
|
|
|
- orderby := "score.Id"
|
|
|
+ page := this.GetPageInfoForm()
|
|
|
+ where := " 1=1 "
|
|
|
+ having := " 1=1 "
|
|
|
+ orderby := "contract.SupplierId"
|
|
|
asc := false
|
|
|
Order := this.GetString("Order")
|
|
|
Prop := this.GetString("Prop")
|
|
|
@@ -843,84 +845,57 @@ func (this *OilContractSumScoreController) ExcelExport() {
|
|
|
asc = true
|
|
|
}
|
|
|
}
|
|
|
- Id := this.GetString("Id")
|
|
|
- SupplierId := this.GetString("SupplierId")
|
|
|
- ContractClass := this.GetString("ContractClass")
|
|
|
SupplierName := this.GetString("SupplierName")
|
|
|
- Year := this.GetString("Year")
|
|
|
- Status := this.GetString("Status")
|
|
|
- CreateOn := this.GetString("CreateOn")
|
|
|
- CreateUserId := this.GetString("CreateUserId")
|
|
|
- CreateBy := this.GetString("CreateBy")
|
|
|
- ModifiedOn := this.GetString("ModifiedOn")
|
|
|
- ModifiedUserId := this.GetString("ModifiedUserId")
|
|
|
- ModifiedBy := this.GetString("ModifiedBy")
|
|
|
- if Id != "" {
|
|
|
- where = where + " and score.Id like '%" + Id + "%'"
|
|
|
- }
|
|
|
- if SupplierId != "" {
|
|
|
- where = where + " and score.SupplierId like '%" + SupplierId + "%'"
|
|
|
- }
|
|
|
+ //CreateOn := this.GetString("CreateOn")
|
|
|
+ ContractClass := this.GetString("ContractClass", "01")
|
|
|
+ Evaluate := this.GetString("Evaluate", "")
|
|
|
+
|
|
|
if SupplierName != "" {
|
|
|
- where = where + " and score.SupplierName like '%" + SupplierName + "%'"
|
|
|
+ where = where + " and contract.SupplierName like '%" + SupplierName + "%'"
|
|
|
}
|
|
|
if ContractClass != "" {
|
|
|
- where = where + " and score.ContractClass like '%" + ContractClass + "%'"
|
|
|
- }
|
|
|
- if Year != "" {
|
|
|
- where = where + " and score.Year like '%" + Year + "%'"
|
|
|
+ where = where + " and contract.ContractClass = '" + ContractClass + "'"
|
|
|
}
|
|
|
|
|
|
- if Status != "" {
|
|
|
- where = where + " and score.Status = '" + Status + "'"
|
|
|
- }
|
|
|
- //if CreateOn != "" {
|
|
|
- // where = where + " and CreateOn like '%" + CreateOn + "%'"
|
|
|
- //}
|
|
|
|
|
|
- if CreateUserId != "" {
|
|
|
- where = where + " and score.CreateUserId like '%" + CreateUserId + "%'"
|
|
|
- }
|
|
|
+ if Evaluate == "1" { // 优秀
|
|
|
|
|
|
- if CreateBy != "" {
|
|
|
- where = where + " and score.CreateBy like '%" + CreateBy + "%'"
|
|
|
+ } else if Evaluate == "2" { // 合格
|
|
|
+ having = "ROUND(sum(case when items.ParentId = 0 AND items.Type = 1 then items.Score else 0 end)/sum(case when items.SequenceNo in ('1') AND items.Type = 1 then 1 else 0 end),2) <80"
|
|
|
+ } else if Evaluate == "3" { // 不合格
|
|
|
+ having = "ROUND(sum(case when items.ParentId = 0 AND items.Type = 1 then items.Score else 0 end)/sum(case when items.SequenceNo in ('1') AND items.Type = 1 then 1 else 0 end),2) <60"
|
|
|
}
|
|
|
+ // 今年的汇总
|
|
|
+ year := strconv.Itoa(time.Now().Year())
|
|
|
+ month := "01"
|
|
|
+ day := "01"
|
|
|
+ where = where + " and review.CreateOn>='" + year + "-" + month + "-" + day + "' "
|
|
|
|
|
|
- if ModifiedOn != "" {
|
|
|
- where = where + " and score.ModifiedOn like '%" + ModifiedOn + "%'"
|
|
|
- }
|
|
|
+ //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 + "'"
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
- if ModifiedUserId != "" {
|
|
|
- where = where + " and score.ModifiedUserId like '%" + ModifiedUserId + "%'"
|
|
|
- }
|
|
|
+ // 审核通过的参与核算
|
|
|
+ where = where + " and review.Status='8' "
|
|
|
|
|
|
- if ModifiedBy != "" {
|
|
|
- where = where + " and score.ModifiedBy like '%" + ModifiedBy + "%'"
|
|
|
- }
|
|
|
- if CreateOn != "" {
|
|
|
- dates := strings.Split(CreateOn, ",")
|
|
|
- if len(dates) == 2 {
|
|
|
- minDate := dates[0]
|
|
|
- maxDate := dates[1]
|
|
|
- where = where + " and score.CreateOn>='" + minDate + "' and score.CreateOn<='" + maxDate + "'"
|
|
|
- }
|
|
|
- }
|
|
|
- where = where + " and items.Category = '0' "
|
|
|
+ svc := contractSumScore.GetOilContractSumScoreService(utils.DBE)
|
|
|
+ var list []contractSumScore.OilContractComputeSumScoreVo
|
|
|
+ svc.GetPagingComputeEntitiesWithOrderBytbl(page.CurrentPage, page.Size, orderby, asc, &list, where,having)
|
|
|
|
|
|
- //超级管理员和有查看所有数据权限的用户不加条件
|
|
|
- svcPerm := permission.GetPermissionService(utils.DBE)
|
|
|
- isauth := svcPerm.IsAuthorized(this.User.Id, "oil_contract.SumStore.AllRecord")
|
|
|
- if !isauth {
|
|
|
- // 权限过滤 自己创建的评价 ,同二级部门创建的评价 ,企管法规处能看
|
|
|
- where = where + " and ( score.CreateUserId = '" + this.User.Id + "' "
|
|
|
- where = where + " or score.UnitId = '" + strconv.Itoa(this.User.UnitId) + "' "
|
|
|
- where = where + " )"
|
|
|
+ var datainfo ErrorDataInfo
|
|
|
+ if len(list) == 0 {
|
|
|
+ datainfo.Code = -1
|
|
|
+ datainfo.Item = ""
|
|
|
+ datainfo.Message = "没有数据可导出"
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
}
|
|
|
|
|
|
- svc := contractSumScore.GetOilContractSumScoreService(utils.DBE)
|
|
|
- var list []contractSumScore.OilContractSumScoreVo
|
|
|
- svc.GetMyEntitiesWithOrderBytbl(orderby, asc, &list, where)
|
|
|
-
|
|
|
var Url string
|
|
|
var fileName string
|
|
|
fileName = ""
|
|
|
@@ -939,12 +914,19 @@ func (this *OilContractSumScoreController) ExcelExport() {
|
|
|
datamap["data"] = list
|
|
|
|
|
|
retDocUrl := svcActiviti.FillExcel(datamap, ContractClass, Url, fileName)
|
|
|
- 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 添加
|