|
|
@@ -726,9 +726,6 @@ func (this *OilContractSumScoreController) DocExport() {
|
|
|
datamap["Year"] = model.Year
|
|
|
datamap["Department"] = model.Unit
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
fileName := "承包商年度评价表和综合年度评价表.docx"
|
|
|
Url := utils.Cfg.MustValue("workflow", "contractSumScoreUrl")
|
|
|
|
|
|
@@ -742,6 +739,126 @@ func (this *OilContractSumScoreController) DocExport() {
|
|
|
this.Data["json"] = &datainfo
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
+// @Title 从数据录入数据导出到Excel文档
|
|
|
+// @Description 数据存入Excel
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /exportexcel [get]
|
|
|
+func (this *OilContractSumScoreController) ExcelExport(){
|
|
|
+ //获取分页信息
|
|
|
+ where := " 1=1 "
|
|
|
+ orderby := "score.Id"
|
|
|
+ asc := false
|
|
|
+ Order := this.GetString("Order")
|
|
|
+ Prop := this.GetString("Prop")
|
|
|
+ if Order != "" && Prop != "" {
|
|
|
+ orderby = Prop
|
|
|
+ if Order == "asc" {
|
|
|
+ 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 + "%'"
|
|
|
+ }
|
|
|
+ if SupplierName != "" {
|
|
|
+ where = where + " and score.SupplierName like '%" + SupplierName + "%'"
|
|
|
+ }
|
|
|
+ if ContractClass != "" {
|
|
|
+ where = where + " and score.ContractClass like '%" + ContractClass + "%'"
|
|
|
+ }
|
|
|
+ if Year != "" {
|
|
|
+ where = where + " and score.Year like '%" + Year + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ 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 CreateBy != "" {
|
|
|
+ where = where + " and score.CreateBy like '%" + CreateBy + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if ModifiedOn != "" {
|
|
|
+ where = where + " and score.ModifiedOn like '%" + ModifiedOn + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ if ModifiedUserId != "" {
|
|
|
+ where = where + " and score.ModifiedUserId like '%" + ModifiedUserId + "%'"
|
|
|
+ }
|
|
|
+
|
|
|
+ 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' "
|
|
|
+
|
|
|
+ //超级管理员和有查看所有数据权限的用户不加条件
|
|
|
+ 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 + " )"
|
|
|
+ }
|
|
|
+
|
|
|
+ svc := contractSumScore.GetOilContractSumScoreService(utils.DBE)
|
|
|
+ var list []contractSumScore.OilContractSumScoreVo
|
|
|
+ svc.GetMyEntitiesWithOrderBytbl(orderby, asc, &list, where)
|
|
|
+
|
|
|
+ var Url string
|
|
|
+ var fileName string
|
|
|
+ fileName = ""
|
|
|
+ Url = ""
|
|
|
+ if ContractClass == "03" {
|
|
|
+ fileName = "服务商年度评价表.xlsx"
|
|
|
+ Url = utils.Cfg.MustValue("workflow", "ServiceSumScoreUrl")
|
|
|
+ } else if ContractClass == "01"{
|
|
|
+ fileName = "供应商年度评价表.xlsx"
|
|
|
+ Url = utils.Cfg.MustValue("workflow", "GoodsSumScoreUrl")
|
|
|
+ }
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+
|
|
|
+ var datamap = make(map[string]interface{})
|
|
|
+ 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()
|
|
|
+}
|
|
|
|
|
|
// @Title 添加
|
|
|
// @Description 专业科室保存评价
|