|
|
@@ -5,6 +5,7 @@ import (
|
|
|
"dashoo.cn/backend/api/business/oilcontract/contractSumScoreItems"
|
|
|
"dashoo.cn/backend/api/business/oilcontract/evaluationItems"
|
|
|
"dashoo.cn/backend/api/business/oilsupplier/supplier"
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/supplierfile"
|
|
|
baseparameter "dashoo.cn/business/parameter"
|
|
|
"dashoo.cn/business2/permission"
|
|
|
"fmt"
|
|
|
@@ -144,7 +145,10 @@ func (this *OilContractSumScoreController) GetComputeEntityList() {
|
|
|
//获取分页信息
|
|
|
page := this.GetPageInfoForm()
|
|
|
where := " 1=1 "
|
|
|
+ where3 := ""
|
|
|
having := " 1=1 "
|
|
|
+ reviewWhere := " "
|
|
|
+ supplierWhere := " "
|
|
|
orderby := "contract.SupplierId"
|
|
|
asc := false
|
|
|
Order := this.GetString("Order")
|
|
|
@@ -164,12 +168,19 @@ func (this *OilContractSumScoreController) GetComputeEntityList() {
|
|
|
|
|
|
if SupplierName != "" {
|
|
|
where = where + " and contract.SupplierName like '%" + SupplierName + "%'"
|
|
|
+ supplierWhere = supplierWhere + " and s.SupplierName like '%" + SupplierName + "%'"
|
|
|
}
|
|
|
if ScoreType == "2" {
|
|
|
where = where + " and review.IsBusiness=0 "
|
|
|
+ reviewWhere = reviewWhere + " and review.IsBusiness=0 "
|
|
|
}
|
|
|
+
|
|
|
+ // 审核通过的参与核算
|
|
|
+ reviewWhere = reviewWhere + " and review.Status='8' "
|
|
|
if ContractClass != "" {
|
|
|
+ where3 = where3 + " and contract.ContractClass = '" + ContractClass + "'"
|
|
|
where = where + " and contract.ContractClass = '" + ContractClass + "'"
|
|
|
+ supplierWhere = supplierWhere + " and c.SupplierTypeCode = '" + ContractClass + "'"
|
|
|
}
|
|
|
|
|
|
// 优秀、合格分数值从配置中取
|
|
|
@@ -204,6 +215,7 @@ func (this *OilContractSumScoreController) GetComputeEntityList() {
|
|
|
month := "01"
|
|
|
day := "01"
|
|
|
where = where + " and review.CreateOn>='" + year + "-" + month + "-" + day + "' and review.CreateOn <= '" + year + "-12-31 23:59:59' "
|
|
|
+ reviewWhere = reviewWhere + " and review.CreateOn>='" + year + "-" + month + "-" + day + "' and review.CreateOn <= '" + year + "-12-31 23:59:59' "
|
|
|
|
|
|
//if CreateOn != "" {
|
|
|
// dates := strings.Split(CreateOn, ",")
|
|
|
@@ -219,22 +231,12 @@ func (this *OilContractSumScoreController) GetComputeEntityList() {
|
|
|
|
|
|
svc := contractSumScore.GetOilContractSumScoreService(utils.DBE)
|
|
|
var list []contractSumScore.OilContractComputeSumScoreVo
|
|
|
- total := svc.GetPagingComputeEntitiesWithOrderBytbl(page.CurrentPage, page.Size, orderby, asc, &list, where, having, ScoreType)
|
|
|
-
|
|
|
- //if ContractClass == "02" {
|
|
|
- // for index, item := range list {
|
|
|
- // where1 := where + " and contract.SupplierId = " + strconv.Itoa(item.SupplierId)
|
|
|
- // var list1 []contractSumScore.OilContractSumScoreResult
|
|
|
- // svc.GetSumListEntitiesWithOrderBytbl(&list1, where1)
|
|
|
- // if len(list1) > 0 {
|
|
|
- // for _, value := range list1 {
|
|
|
- // if value.Result2 == "0" {
|
|
|
- // list[index].Result = "0"
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- //}
|
|
|
+ var total int64
|
|
|
+ if ContractClass == "02" {
|
|
|
+ total = svc.GetPagingComputeEntitiesWithOrderBytbl3(page.CurrentPage, page.Size, orderby, asc, &list, where3, having, ScoreType, reviewWhere, supplierWhere)
|
|
|
+ } else {
|
|
|
+ total = svc.GetPagingComputeEntitiesWithOrderBytbl(page.CurrentPage, page.Size, orderby, asc, &list, where, having, ScoreType)
|
|
|
+ }
|
|
|
var datainfo DataInfo
|
|
|
datainfo.Items = list
|
|
|
datainfo.CurrentItemCount = total
|
|
|
@@ -1111,6 +1113,131 @@ func (this *OilContractSumScoreController) ExcelExport() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 定时任务
|
|
|
+func (this *OilContractSumScoreController) SaveBasicConditionScore() {
|
|
|
+ var certList []suppliercert.OilSupplierCert
|
|
|
+ certSvc := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
+ certSvc.GetEntitysByWhere(OilSupplierCertName, "InFlag = '1' or InFlag = '2'", &certList)
|
|
|
+ for _, item := range certList {
|
|
|
+ item.BasicConditionScore = this.GetBasicConditionScore(item.SupplierId, item.SupplierTypeCode)
|
|
|
+ certSvc.UpdateEntityBytbl(OilSupplierCertName, item.Id, &item, []string{"BasicConditionScore"})
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func (this *OilContractSumScoreController) GetBasicConditionScore(supplierId int, contractClass string) (normalScore int) {
|
|
|
+ supplierSvc := supplier.GetOilSupplierService(utils.DBE)
|
|
|
+ var supplierModel supplier.OilSupplier
|
|
|
+ contractSvc := contract.GetOilContractService(utils.DBE)
|
|
|
+ supplierSvc.GetEntityByIdBytbl(OilSupplierName, supplierId, &supplierModel)
|
|
|
+ regCapital := supplierModel.RegCapital * 10000 // 注册资金
|
|
|
+ operType := supplierModel.OperType // 类型
|
|
|
+ legalPerson := supplierModel.LegalPerson // 法人
|
|
|
+
|
|
|
+ var certModel suppliercert.OilSupplierCert
|
|
|
+ certSvc := suppliercert.GetOilSupplierCertService(utils.DBE)
|
|
|
+ certSql := "SupplierId = " + strconv.Itoa(supplierId) + " and SupplierTypeCode = " + contractClass + " and InFlag = '1' and ApplyTime > now()"
|
|
|
+ certSvc.GetEntityByWhere(OilSupplierCertName, certSql, &certModel)
|
|
|
+
|
|
|
+ var fileList []supplierfile.OilSupplierFile
|
|
|
+ // 过期的file
|
|
|
+ fileSql := "SupplierId = " + strconv.Itoa(supplierId) + " and EffectDate < now()"
|
|
|
+ certSvc.GetEntitysByWhere(OilSupplierFileName, fileSql, &fileList)
|
|
|
+
|
|
|
+ normalScore = 0
|
|
|
+ if contractClass == "01" {
|
|
|
+ // 供方是否具有独立法人资格,《市场管理信息系统》中供方名称与营业执照是否一致,保持一致且持续有效得5分,否则为0分。
|
|
|
+ fileTotal := contractSvc.GetFileCountByName("营业执照", supplierId, "01")
|
|
|
+ if fileTotal > 0 && legalPerson != "" {
|
|
|
+ normalScore += 5
|
|
|
+ }
|
|
|
+
|
|
|
+ // 制造商5分,代理商3分,贸易商1分。
|
|
|
+ if operType == "制造商" {
|
|
|
+ normalScore += 5
|
|
|
+ } else if operType == "代理商" {
|
|
|
+ normalScore += 3
|
|
|
+ } else if operType == "贸易商" {
|
|
|
+ normalScore += 1
|
|
|
+ }
|
|
|
+
|
|
|
+ // 注册资金在1亿元及以上得5分,小于1亿元且大于5000万元得4分,5000万元及以下且大于1000万元得3分,1000万元及以下且大于500万元得2分,500万元及以下得1分
|
|
|
+ if regCapital >= 100000000 {
|
|
|
+ normalScore += 5
|
|
|
+ } else if regCapital < 100000000 && regCapital > 50000000 {
|
|
|
+ normalScore += 4
|
|
|
+ } else if regCapital <= 50000000 && regCapital > 10000000 {
|
|
|
+ normalScore += 3
|
|
|
+ } else if regCapital <= 10000000 && regCapital > 5000000 {
|
|
|
+ normalScore += 2
|
|
|
+ } else if regCapital <= 5000000 {
|
|
|
+ normalScore += 1
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如期办理大港油田公司供方年审、及时更新相关资质信息,系统准入状态有效的得5分,否则为0分。
|
|
|
+ if certModel.Id > 0 && len(fileList) == 0 {
|
|
|
+ normalScore += 5
|
|
|
+ }
|
|
|
+
|
|
|
+ // 具备质量管理体系认证证书且持续有效得5分,认证证书过期或无认证证书得0分
|
|
|
+ fileTotal1 := contractSvc.GetFileCountByName("质量管理体系认证证书", supplierId, "01")
|
|
|
+ if fileTotal1 > 0 {
|
|
|
+ normalScore += 5
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if contractClass == "02" || contractClass == "03" {
|
|
|
+ // 供方名称与营业执照保持一致且持续有效得5分,否则为0分。
|
|
|
+ fileTotal := contractSvc.GetFileCountByName("营业执照", supplierId, contractClass)
|
|
|
+ if fileTotal > 0 && legalPerson != "" {
|
|
|
+ normalScore += 5
|
|
|
+ }
|
|
|
+
|
|
|
+ // 注册资金在1亿元及以上得5分,小于1亿元且大于5000万元得4分,5000万元及以下且大于1000万元得3分,1000万元及以下且大于500万元得2分,500万元及以下得1分
|
|
|
+ if regCapital >= 100000000 {
|
|
|
+ normalScore += 5
|
|
|
+ } else if regCapital < 100000000 && regCapital > 50000000 {
|
|
|
+ normalScore += 4
|
|
|
+ } else if regCapital <= 50000000 && regCapital > 10000000 {
|
|
|
+ normalScore += 3
|
|
|
+ } else if regCapital <= 10000000 && regCapital > 5000000 {
|
|
|
+ normalScore += 2
|
|
|
+ } else if regCapital <= 5000000 {
|
|
|
+ normalScore += 1
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如期办理大港油田公司供方年审、及时更新相关资质信息,系统准入状态有效的得5分,否则为0分。
|
|
|
+ if certModel.Id > 0 && len(fileList) == 0 {
|
|
|
+ normalScore += 5
|
|
|
+ }
|
|
|
+
|
|
|
+ // 质量、环境、职业健康安全管理体系认证通过且持续有效得5分,其中一个证书失效扣1分,两个证书失效扣2分,三个证书全部失效及无以上三个证书供方得0分
|
|
|
+ fileTotal1 := contractSvc.GetFileCountByName("环境管理体系认证证书", supplierId, contractClass)
|
|
|
+ fileTotal2 := contractSvc.GetFileCountByName("质量管理体系认证证书", supplierId, contractClass)
|
|
|
+ fileTotal3 := contractSvc.GetFileCountByName("职业健康安全管理体系认证证书", supplierId, contractClass)
|
|
|
+ if fileTotal1 == 0 && fileTotal2 == 0 && fileTotal3 == 0 {
|
|
|
+ normalScore += 0
|
|
|
+ } else {
|
|
|
+ score := 5
|
|
|
+ if fileTotal1 < 0 {
|
|
|
+ score-=1
|
|
|
+ }
|
|
|
+ if fileTotal2 < 0 {
|
|
|
+ score-=1
|
|
|
+ }
|
|
|
+ if fileTotal3 < 0 {
|
|
|
+ score-=1
|
|
|
+ }
|
|
|
+ normalScore += score
|
|
|
+ }
|
|
|
+
|
|
|
+ // 按要求办理大港油田公司安全资质审查得5分,否则为0分。
|
|
|
+ fileTotal4 := contractSvc.GetFileCountByName("安全资质审查", supplierId, contractClass)
|
|
|
+ if fileTotal4 > 0 {
|
|
|
+ normalScore += 5
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return normalScore
|
|
|
+}
|
|
|
+
|
|
|
// @Title 添加
|
|
|
// @Description 专业科室保存评价
|
|
|
// @Param body body contractSumScore.OilContractSumScore
|