Browse Source

add:添加信息采集

zoie 2 months ago
parent
commit
6664ca09f2

+ 2 - 7
conf/app.conf

@@ -10,12 +10,7 @@ copyrequestbody = true
 NatsServer_Url = "127.0.0.1:43422"
 NatsForbidden = true
 
-# Mysql
-# MysqlServer_UrlPort = "47.111.15.17:3306"
-# MysqlServer_Database = "cold_verify"
-# MysqlServer_Username = "cold_verify"
-# MysqlServer_Password = "kzFbKseJm5GFpPFS"
-MysqlServer_UrlPort = "127.0.0.1:40306"
+MysqlServer_UrlPort = "192.168.11.77:3306"
 MysqlServer_Database = "coldverify"
 MysqlServer_Username = "coldverify"
 MysqlServer_Password = "Bd3d34yJ7aibiEi!"
@@ -24,7 +19,7 @@ MysqlServer_MaxOpenConnections = 200
 
 
 # Redis
-Redis_address = "127.0.0.1:43379"
+Redis_address = "192.168.11.77:6379"
 Redis_password = ""
 Redis_dbNum = "2"
 

+ 32 - 0
conf/app_prod.conf

@@ -0,0 +1,32 @@
+appname = ColdVerify_server6300
+HTTPPort = 6300
+runmode = dev
+Graceful = true
+EnableDocs = true
+copyrequestbody = true
+
+
+# Nats
+NatsServer_Url = "127.0.0.1:43422"
+NatsForbidden = true
+
+MysqlServer_UrlPort = "127.0.0.1:40306"
+MysqlServer_Database = "coldverify"
+MysqlServer_Username = "coldverify"
+MysqlServer_Password = "Bd3d34yJ7aibiEi!"
+MysqlServer_MaxIdleConnections = 100
+MysqlServer_MaxOpenConnections = 200
+
+
+# Redis
+Redis_address = "127.0.0.1:43379"
+Redis_password = ""
+Redis_dbNum = "2"
+
+
+
+# 静态资源
+Qiniu_AccessKey = "-8ezB_d-8-eUFTMvhOGbGzgeQRPeKQnaQ3DBcUxo"
+Qiniu_SecretKey = "KFhkYxTAJ2ZPN3ZS3euTsfWk8-C92rKgkhAMkDRN"
+Qiniu_BUCKET = "bzdcoldverify"
+Oss = "https://bzdcoldverifyoss.baozhida.cn"

+ 37 - 1
controllers/Task.go

@@ -7,6 +7,7 @@ import (
 	"ColdVerify_server/logs"
 	"ColdVerify_server/models/Account"
 	"ColdVerify_server/models/Device"
+	"ColdVerify_server/models/InfoCollection"
 	"ColdVerify_server/models/System"
 	"ColdVerify_server/models/Task"
 	"fmt"
@@ -50,6 +51,16 @@ func (c *TaskController) List() {
 	T_company := c.GetString("T_company") // 公司名称
 	T_uuid := c.GetString("T_uuid")
 
+	T_scheme := c.GetString("T_scheme")                     // 实施方案 负责人UUID
+	T_collection := c.GetString("T_collection")             // 数据采集 负责人UUID
+	T_reporting := c.GetString("T_reporting")               // 报告编写 负责人UUID
+	T_delivery := c.GetString("T_delivery")                 // 交付审核 负责人UUID
+	T_scheme_state := c.GetString("T_scheme_state")         // 实施方案 状态 0 未完成 1 已完成
+	T_collection_state := c.GetString("T_collection_state") // 数据采集 状态 0 未完成 1 数据来源已完成 2 处理中 3 已采集-无数据 4-数据编辑已完成
+	T_reporting_state := c.GetString("T_reporting_state")   // 报告编写 状态 0 未完成 1 已完成
+	T_delivery_state := c.GetString("T_delivery_state")     // 交付审核 状态 0 未完成 1 已完成 2 处理中
+	T_marking_state := c.GetString("T_marking_state")       // 验证标识 状态 0 未完成 1 已完成
+
 	UserMap := Account.UserListToMap(Account.Read_User_List_ALL_1())
 	AdminMap := Account.AdminListToMap(Account.Read_Admin_List_ALL_1())
 
@@ -64,7 +75,9 @@ func (c *TaskController) List() {
 	}
 
 	var cnt int
-	List, cnt := Task.Read_Task_List(T_uuid, T_admin, T_name, T_company_list, UserMap, AdminMap, page, page_z)
+	List, cnt := Task.Read_Task_List(T_uuid, T_admin, T_name, T_scheme, T_collection, T_reporting, T_delivery,
+		T_scheme_state, T_collection_state, T_reporting_state, T_delivery_state, T_marking_state,
+		T_company_list, UserMap, AdminMap, page, page_z)
 
 	page_size := math.Ceil(float64(cnt) / float64(page_z))
 	r_jsons.List = List
@@ -163,6 +176,7 @@ func (c *TaskController) Add() {
 	}
 	System.Add_UserLogs_T(User_r.T_uuid, "分类管理", "添加", dc)
 
+	T_InfoCollection_id := c.GetString("T_InfoCollection_id") // 信息采集id
 	T_name := c.GetString("T_name")
 	T_uuid := c.GetString("T_uuid") // 用户uuid
 	T_VerifyTemplate_class := c.GetString("T_VerifyTemplate_class")
@@ -174,6 +188,7 @@ func (c *TaskController) Add() {
 	T_delivery := c.GetString("T_delivery")
 
 	var_ := Task.Task{
+		T_InfoCollection_id:    T_InfoCollection_id,
 		T_class:                int(T_class_id),
 		T_uuid:                 T_uuid,
 		T_name:                 T_name,
@@ -187,6 +202,19 @@ func (c *TaskController) Add() {
 		T_Show:                 1,
 		T_State:                1,
 	}
+	// TODO 修改信息采集状态为已接收
+	r, is := InfoCollection.Read_InfoCollection(T_InfoCollection_id)
+	if !is {
+		c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取信息采集失败!"}
+		c.ServeJSON()
+		return
+	}
+	r.T_status = 3 // 已接收
+	if !InfoCollection.Update_InfoCollection(r, "T_status") {
+		c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改信息采集状态失败!"}
+		c.ServeJSON()
+		return
+	}
 
 	T_task_id, is := Task.Add_Task(var_)
 	if !is {
@@ -356,6 +384,7 @@ func (c *TaskController) Up() {
 	T_pdf2 := c.GetString("T_pdf2")
 	T_doc3 := c.GetString("T_doc3")
 	T_pdf3 := c.GetString("T_pdf3")
+	T_pdf4 := c.GetString("T_pdf4")                                           // 验证标识
 	T_VerifyDeviceDataStartTime := c.GetString("T_VerifyDeviceDataStartTime") // 验证设备数据开始时间
 	T_VerifyDeviceDataEndTime := c.GetString("T_VerifyDeviceDataEndTime")     // 验证设备数据开始时间
 	T_BindDeviceDataStartTime := c.GetString("T_BindDeviceDataStartTime")     // 绑定设备数据开始时间
@@ -445,6 +474,13 @@ func (c *TaskController) Up() {
 		r.T_pdf3 = T_pdf3
 		clos = append(clos, "T_pdf3")
 	}
+	// 验证标识内容T_pdf4 ,上传后将 当前任务 验证标识 标志 为 1
+	if len(T_pdf4) > 0 {
+		r.T_pdf4 = T_pdf4
+		clos = append(clos, "T_pdf4")
+		r.T_marking_state = 1
+		clos = append(clos, "T_marking_state")
+	}
 
 	if len(T_VerifyDeviceDataStartTime) > 0 {
 		r.T_VerifyDeviceDataStartTime = T_VerifyDeviceDataStartTime

+ 9 - 1
controllers/VerifyTemplate.go

@@ -112,6 +112,8 @@ func (c *VerifyTemplateController) Up() {
 	T_scheme := c.GetString("T_scheme")
 	T_reporting := c.GetString("T_reporting")
 	T_inspect := c.GetString("T_inspect")
+	T_marking := c.GetString("T_marking")
+	T_cover := c.GetString("T_cover")
 
 	r, is := VerifyTemplate.Read_VerifyTemplate(T_VerifyTemplate_id)
 	if !is {
@@ -134,12 +136,18 @@ func (c *VerifyTemplateController) Up() {
 	if len(T_inspect) > 0 {
 		r.T_inspect = T_inspect
 	}
+	if len(T_marking) > 0 {
+		r.T_marking = T_marking
+	}
+	if len(T_cover) > 0 {
+		r.T_cover = T_cover
+	}
 	if T_sort_err == nil {
 		r.T_sort = T_sort
 	}
 
 	// .......
-	if !VerifyTemplate.Update_VerifyTemplate(r, "T_name", "T_sort", "T_scheme", "T_reporting", "T_inspect") {
+	if !VerifyTemplate.Update_VerifyTemplate(r, "T_name", "T_sort", "T_scheme", "T_reporting", "T_inspect", "T_marking", "T_cover") {
 		c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改失败!"}
 		c.ServeJSON()
 		return

+ 2 - 1
controllers/infoCollection.go

@@ -110,7 +110,7 @@ func (c *InfoCollectionController) Get() {
 	T_InfoCollection_id := c.GetString("T_InfoCollection_id")
 	r, is := InfoCollection.Read_InfoCollection(T_InfoCollection_id)
 	if !is {
-		c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id 错误!"}
+		c.Data["json"] = lib.JSONS{Code: 202, Msg: "获取信息采集失败!"}
 		c.ServeJSON()
 		return
 	}
@@ -143,6 +143,7 @@ func (c *InfoCollectionController) Add() {
 		T_InfoTemplate_id:    T_InfoTemplate_id,
 		T_status:             1,
 		T_State:              1,
+		T_submit_uuid:        User_r.T_uuid,
 	}
 
 	T_InfoCollection_id, err := InfoCollection.Add_InfoCollection(var_)

+ 8 - 3
models/InfoCollection/InfoCollection.go

@@ -20,10 +20,11 @@ type InfoCollection struct {
 	T_InfoCollection_id  string `orm:"size(256);null"`     // 信息采集ID
 	T_uuid               string `orm:"size(256);null"`     // 用户 UUID
 	T_name               string `orm:"size(256);null"`     // 标题
-	T_InfoTemplate_class string `orm:"size(256);null"`     // 模板id
+	T_InfoTemplate_class string `orm:"size(256);null"`     // 模板分类
 	T_InfoTemplate_id    string `orm:"size(256);null"`     // 模板id
-	T_status             int    `orm:"size(2);default(0)"` // 状态 1 待提交
-	T_State              int    `orm:"size(2);default(1)"` // 0 删除   1 正常
+	T_status             int    `orm:"size(2);default(0)"` // 状态 1 待提交 2 已提交 3 已接收 4 已回款
+	T_State              int    `orm:"size(2);default(1)"` // 0 删除  1 正常
+	T_submit_uuid        string `orm:"size(256);null"`     // 提交人 UUID
 
 	CreateTime time.Time `orm:"column(create_time);type(timestamp);null;auto_now_add"` //auto_now_add 第一次保存时才设置时间
 	UpdateTime time.Time `orm:"column(update_time);type(timestamp);null;auto_now"`     //auto_now 每次 model 保存时都会对时间自动更新
@@ -39,6 +40,8 @@ type InfoCollection_R struct {
 	T_InfoTemplate_id    string // 模板id
 	T_status             int    // 状态
 	T_State              int    // 0 删除   1 正常
+	T_submit_uuid        string // 提交人uuid
+	T_submit_uuid_name   string // 提交人姓名
 	CreateTime           string
 	UpdateTime           string
 }
@@ -76,6 +79,8 @@ func InfoCollectionToInfoCollection_R(T InfoCollection, adminMap map[string]stri
 	T_r.T_status = T.T_status
 	T_r.T_State = T.T_State
 	T_r.T_uuid_name = adminMap[T.T_uuid]
+	T_r.T_submit_uuid = T.T_submit_uuid
+	T_r.T_submit_uuid_name = adminMap[T.T_submit_uuid]
 
 	T_r.UpdateTime = T.UpdateTime.Format("2006-01-02 15:04:05")
 	T_r.CreateTime = T.CreateTime.Format("2006-01-02 15:04:05")

+ 39 - 1
models/Task/Task.go

@@ -17,6 +17,7 @@ import (
 type Task struct {
 	Id                     int    `orm:"column(ID);size(11);auto;pk"`
 	T_class                int    `orm:"size(200);default(0)"` // 分类id
+	T_InfoCollection_id    string `orm:"size(256);null"`       // 信息采集ID
 	T_task_id              string `orm:"size(256);null"`       // 任务ID
 	T_uuid                 string `orm:"size(256);null"`       // 用户 UUID
 	T_name                 string `orm:"size(256);null"`       // 标题
@@ -31,6 +32,7 @@ type Task struct {
 	T_collection_state     int    `orm:"size(2);default(0)"`   // 数据采集 状态 0 未完成 1 数据来源已完成 2 处理中 3 已采集-无数据 4-数据编辑已完成
 	T_reporting_state      int    `orm:"size(2);default(0)"`   // 报告编写 状态 0 未完成 1 已完成
 	T_delivery_state       int    `orm:"size(2);default(0)"`   // 交付审核 状态 0 未完成 1 已完成 2 处理中
+	T_marking_state        int    `orm:"size(2);default(0)"`   // 验证标识 状态 0 未完成 1 已完成
 
 	T_VerifyDeviceDataStartTime string `orm:"size(256);null"` // 验证设备数据开始时间
 	T_VerifyDeviceDataEndTime   string `orm:"size(256);null"` // 验证设备数据开始时间
@@ -43,6 +45,7 @@ type Task struct {
 	T_pdf2 string `orm:"type(text);null"` // 报告
 	T_doc3 string `orm:"type(text);null"` // 证书
 	T_pdf3 string `orm:"type(text);null"` // 证书
+	T_pdf4 string `orm:"type(text);null"` // 验证标识
 
 	T_Show  int `orm:"size(2);default(1)"`   // 0 隐藏   1 公开
 	T_Visit int `orm:"size(200);default(0)"` // 浏览量
@@ -58,6 +61,7 @@ type Task struct {
 }
 
 type Task_R struct {
+	T_InfoCollection_id         string    // 信息采集id
 	T_task_id                   string    // id
 	T_name                      string    // 标题
 	T_doc1                      string    // 封面
@@ -84,6 +88,7 @@ type Task_R struct {
 type Task_ struct {
 	Id                          int
 	T_class                     int       // 分类ID
+	T_InfoCollection_id         string    // 信息采集ID
 	T_task_id                   string    // 任务ID
 	T_uuid                      string    // 用户 UUID
 	T_user_name                 string    // 用户 UUID
@@ -142,6 +147,7 @@ func init() {
 
 // -------------------------------------------------------------
 func TaskToTask_R(T Task) (T_r Task_R) {
+	T_r.T_InfoCollection_id = T.T_InfoCollection_id
 	T_r.T_task_id = T.T_task_id
 	T_r.T_name = T.T_name
 	T_r.T_doc1 = T.T_doc1
@@ -172,6 +178,7 @@ func TaskToTask_R(T Task) (T_r Task_R) {
 func TaskToTask_(T Task, userMap, adminMap map[string]string) (T_ Task_) {
 	T_.Id = T.Id
 	T_.T_class = T.T_class
+	T_.T_InfoCollection_id = T.T_InfoCollection_id
 	T_.T_task_id = T.T_task_id
 	T_.T_uuid = T.T_uuid
 	T_.T_user_name = userMap[T.T_uuid]
@@ -430,7 +437,9 @@ func Read_UserTask_List(T_uuid string, T_name string, userMap, adminMap map[stri
 }
 
 // 获取任务列表
-func Read_Task_List(T_uuid, T_admin string, T_name string, T_company_list []string, userMap, adminMap map[string]string, page int, page_z int) ([]Task_, int) {
+func Read_Task_List(T_uuid, T_admin string, T_name string, T_scheme, T_collection, T_reporting, T_delivery,
+	T_scheme_state, T_collection_state, T_reporting_state, T_delivery_state, T_marking_state string,
+	T_company_list []string, userMap, adminMap map[string]string, page int, page_z int) ([]Task_, int) {
 
 	o := orm.NewOrm()
 
@@ -456,6 +465,35 @@ func Read_Task_List(T_uuid, T_admin string, T_name string, T_company_list []stri
 		cond1 = cond1.And("T_uuid__in", T_company_list)
 	}
 
+	if len(T_scheme) > 0 {
+		cond1 = cond1.And("T_scheme", T_scheme)
+	}
+	if len(T_collection) > 0 {
+		cond1 = cond1.And("T_collection", T_collection)
+	}
+	if len(T_reporting) > 0 {
+		cond1 = cond1.And("T_reporting", T_reporting)
+	}
+	if len(T_delivery) > 0 {
+		cond1 = cond1.And("T_delivery", T_delivery)
+	}
+
+	if len(T_scheme_state) > 0 {
+		cond1 = cond1.And("T_scheme_state", T_scheme_state)
+	}
+	if len(T_collection_state) > 0 {
+		cond1 = cond1.And("T_collection_state", T_collection_state)
+	}
+	if len(T_reporting_state) > 0 {
+		cond1 = cond1.And("T_reporting_state", T_reporting_state)
+	}
+	if len(T_delivery_state) > 0 {
+		cond1 = cond1.And("T_delivery_state", T_delivery_state)
+	}
+	if len(T_marking_state) > 0 {
+		cond1 = cond1.And("T_marking_state", T_marking_state)
+	}
+
 	qs.Limit(page_z, offset).SetCond((*orm2.Condition)(cond1)).OrderBy("-Id").All(&r)
 	cnt, _ := qs.SetCond((*orm2.Condition)(cond1)).Count()
 

+ 7 - 0
models/VerifyTemplate/VerifyTemplate.go

@@ -20,7 +20,9 @@ type VerifyTemplate struct {
 
 	T_scheme    string `orm:"size(256);null"` // 方案模板
 	T_reporting string `orm:"size(256);null"` // 报告模板
+	T_marking   string `orm:"size(256);null"` // 标识模板
 	T_inspect   string `orm:"size(256);null"` // 自检
+	T_cover     string `orm:"size(256);null"` // 封面
 
 	CreateTime time.Time `orm:"column(create_time);type(timestamp);null;auto_now_add"` //auto_now_add 第一次保存时才设置时间
 	UpdateTime time.Time `orm:"column(update_time);type(timestamp);null;auto_now"`     //auto_now 每次 model 保存时都会对时间自动更新
@@ -34,6 +36,9 @@ type VerifyTemplate_R struct {
 	T_scheme    string // 方案模板
 	T_reporting string // 报告模板
 	T_inspect   string // 自检
+	T_marking   string // 标识模板
+	T_cover     string // 封面
+
 }
 
 func (t *VerifyTemplate) TableName() string {
@@ -55,6 +60,8 @@ func VerifyTemplateToVerifyTemplate_R(T VerifyTemplate) (T_r VerifyTemplate_R) {
 	T_r.T_scheme = T.T_scheme
 	T_r.T_reporting = T.T_reporting
 	T_r.T_inspect = T.T_inspect
+	T_r.T_marking = T.T_marking
+	T_r.T_cover = T.T_cover
 
 	return T_r
 }