Переглянути джерело

feat: 调整质量巡检相关字段命令

lanjianrong 4 роки тому
батько
коміт
87613cf138

+ 0 - 2
dao/annex_dao.go

@@ -31,14 +31,12 @@ func NewAnnexDao(engine *xorm.Engine) *AnnexDao {
 func (d *AnnexDao) GetList(dataType int, dataId int, pageNo int, pageSize int) ([]viewmodels.AnnexListView, int64) {
 	dataList := make([]viewmodels.AnnexListView, 0)
 	start := (pageNo - 1) * pageSize
-	// fmt.Println("start", start, "pageSize", pageSize)
 	total, err := d.engine.Table("`cm_annex` as f").
 		Select("f.`id`, f.`account_id`, f.`create_time`, f.`name` as file_name, f.`oss_url` as file_path, a.`name` as account_name").
 		Join("LEFT", "`cm_project_account` as a", "a.id = f.account_id").
 		Where("f.data_id = ? and f.data_type = ?", dataId, dataType).
 		Limit(pageSize, start).
 		FindAndCount(&dataList)
-	// fmt.Println("total", total)
 	if err != nil {
 		return dataList, 0
 	}

+ 0 - 56
dao/safe_file_dao.go

@@ -1,56 +0,0 @@
-/*
- * @description: 安全巡检数据库操作相关
- * @Author: LanJianRong
- * @Date: 2020-11-20
- * @FilePath: \construction_management\dao\safe_dao.go
- */
-
-package dao
-
-import (
-	"github.com/go-xorm/xorm"
-	"go.mod/models"
-)
-
-// 数据库操作引擎
-type SafeFileDao struct {
-	engine *xorm.Engine
-}
-
-// 获得一个DAO对象
-func NewSafeFileDao(engine *xorm.Engine) *SafeFileDao {
-	return &SafeFileDao{
-		engine: engine,
-	}
-}
-
-// 通过safe_id获得数据
-func (d *SafeFileDao) GetListBySid(id int) []models.CmSafeFile {
-	dataList := make([]models.CmSafeFile, 0)
-	err := d.engine.
-		Asc("create_time").
-		Sql("select f.`create_time`, f.`file_name`, f.`file_path`, a.`name`from `cm_safe_file` as f, `cm_project_acount` as a where f.`uid` = a.`id` and f.`safe_id` = ?", id).
-		Find(&dataList)
-	if err != nil {
-		return dataList
-	}
-	return dataList
-}
-
-// 获取总数
-func (d *SafeFileDao) GetCount(id int) int64 {
-	file := models.CmSafeFile{}
-	total, err := d.engine.
-		Where("safe_id=?", id).
-		Count(file)
-	if err != nil {
-		return 0
-	}
-	return total
-}
-
-// 批量插入数据
-func (d *SafeFileDao) InsertByList(data []models.CmSafeFile) error {
-	_, err := d.engine.Insert(data)
-	return err
-}

+ 0 - 1
services/quality_service.go

@@ -96,7 +96,6 @@ func (s *qualityService) Del(id int) error {
 func (s *qualityService) GetDetail(id int, pid int) viewmodels.QualityDetail {
 
 	qualityData := s.daoQuality.FindById(id)
-	// fmt.Println(safeData)
 	qualityId, _ := comm.AesEncrypt(strconv.Itoa(qualityData.Id), conf.SignSecret)
 	bid, _ := comm.AesEncrypt(strconv.Itoa(qualityData.BidsectionId), conf.SignSecret)
 	uid, _ := comm.AesEncrypt(strconv.Itoa(qualityData.Uid), conf.SignSecret)

+ 3 - 1
services/rule_service.go

@@ -27,6 +27,7 @@ type RuleService interface {
 type ruleService struct {
 	daoRule       *dao.RuleDao
 	daoSafe       *dao.SafeDao
+	daoQuality    *dao.QualityDao
 	daoContract   *dao.ContractDao
 	validAutoPath string
 }
@@ -37,6 +38,7 @@ func NewRuleService() RuleService {
 		validAutoPath: "/api/rule/auto",
 		daoRule:       dao.NewRuleDao(datasource.InstanceDbMaster()),
 		daoSafe:       dao.NewSafeDao(datasource.InstanceDbMaster()),
+		daoQuality:    dao.NewQualityDao(datasource.InstanceDbMaster()),
 		daoContract:   dao.NewContractDao(datasource.InstanceDbMaster()),
 	}
 }
@@ -119,7 +121,7 @@ func (s *ruleService) AutoCode(bid int, pid int, codeType string) (string, error
 		var code viewmodels.RuleCode
 		err := json.Unmarshal([]byte(rule.QualityRule), &code)
 		if err == nil {
-			total, err := s.daoSafe.CountRuleCode(bid)
+			total, err := s.daoQuality.CountRuleCode(bid)
 			value := reflect.ValueOf(code)
 			for i := 0; i < value.NumField(); i++ {
 				b := fmt.Sprint(value.Field(i))

+ 7 - 7
web/api/quality_audit_api.go

@@ -23,12 +23,12 @@ type QualityAuditApi struct {
 }
 
 // @Summary 开始审批
-// @Tags 安全巡检-审批
+// @Tags 质量巡检-审批
 // @Description 开始审批
 // @Accept  json
 // @Produce  json
 // @Security ApiKeyAuth
-// @Param   quality_id     body    string     true        "安全巡检id"
+// @Param   quality_id     body    string     true        "质量巡检id"
 // @Param   bidsection_id     body    string     true        "标段id"
 // @Param   auditors     body    array     true        "审核组"
 // @Param   reAuditors     body    array     true        "复查组"
@@ -90,7 +90,7 @@ func (c *QualityAuditApi) PostStart() {
 }
 
 // @Summary 关闭审批流程
-// @Tags 安全巡检-审批
+// @Tags 质量巡检-审批
 // @Description 直接停止审批流程
 // @Accept  json
 // @Produce  json
@@ -113,7 +113,7 @@ func (c *QualityAuditApi) PostClose() {
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": "ReadJSON转换异常,请检查参数"})
 		return
 	}
-	// 3.获取安全巡检记录id
+	// 3.获取质量巡检记录id
 	qualityId, err := utils.GetDecryptId(qualityAuditData.QualityId)
 	if err != nil {
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": "ReadJSON转换异常,请检查参数"})
@@ -139,7 +139,7 @@ func (c *QualityAuditApi) PostClose() {
 }
 
 // @Summary 审批退回
-// @Tags 安全巡检-审批
+// @Tags 质量巡检-审批
 // @Description
 // @Accept  json
 // @Produce  json
@@ -169,7 +169,7 @@ func (c *QualityAuditApi) PostBack() {
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
 		return
 	}
-	// 4.获取安全巡检记录id、回滚的审批流程id
+	// 4.获取质量巡检记录id、回滚的审批流程id
 	qualityId, err := utils.GetDecryptId(qualityAuditData.QualityId)
 	if err != nil {
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": "ReadJSON转换异常,请检查参数"})
@@ -203,7 +203,7 @@ func (c *QualityAuditApi) PostBack() {
 }
 
 // @Summary 审批通过
-// @Tags 安全巡检-审批
+// @Tags 质量巡检-审批
 // @Description
 // @Accept  json
 // @Produce  json