浏览代码

年度汇总分基本代码

baichengfei 5 年之前
父节点
当前提交
924f007484

+ 1 - 0
src/dashoo.cn/backend/api/business/oilcontract/contractEvaluationItems/contractEvaluationItems.go

@@ -7,6 +7,7 @@ import (
 type OilContractEvaluationItems struct {
 	Id             int       `json:"Id" xorm:"not null pk autoincr comment('ID') INT(11) 'Id'"`
 	ContractId     int       `json:"ContractId" xorm:"default 0 comment('合同表ID') INT(11) 'ContractId'"`
+	ContractWorkId int       `json:"ContractId" xorm:"default 0 comment('ReviewWork表ID') INT(11) 'ContractWorkId'"`
 	ParentId       int       `json:"ParentId" xorm:"not null default 0 comment('上级节点ID') INT(11) 'ParentId'"`
 	SequenceNo     string    `json:"SequenceNo" xorm:"default '0' comment('序号') VARCHAR(50) 'SequenceNo'"`
 	Content        string    `json:"content" xorm:"comment('评价内容') VARCHAR(1000) 'content'"`

+ 20 - 0
src/dashoo.cn/backend/api/business/oilcontract/contractSumScore/contractSumScore.go

@@ -0,0 +1,20 @@
+package contractSumScore
+
+import (
+	"time"
+)
+
+type OilContractSumScore struct {
+	Id               int       `json:"Id" xorm:"not null pk autoincr comment('ID') INT(11) 'Id'"`
+	Contractid       int       `json:"ContractId" xorm:"not null default 0 comment('合同表ID') INT(11) 'ContractId'"`
+	Normalsumscore   string    `json:"NormalSumScore" xorm:"default 0.00 comment('标准分值') DECIMAL(11,2) 'NormalSumScore'"`
+	Sumscore         string    `json:"SumScore" xorm:"default 0.00 comment('实际分值') DECIMAL(11,2) 'SumScore'"`
+	Conclusionreason string    `json:"ConclusionReason" xorm:"comment('不合格原因') VARCHAR(255) 'ConclusionReason'"`
+	Conclusion       int       `json:"Conclusion" xorm:"default 0 comment('0不合格,1观察使用,2合格,3优秀') INT(11) 'Conclusion'"`
+	CreateOn       	 time.Time `json:"CreateOn" xorm:"DATETIME 'CreateOn'"`
+	CreateUserId     int       `json:"CreateUserId" xorm:"INT(11) 'CreateUserId'"`
+	CreateBy         string    `json:"CreateBy" xorm:"VARCHAR(50) 'CreateBy'"`
+	ModifiedOn       time.Time `json:"ModifiedOn" xorm:"DATETIME 'ModifiedOn'"`
+	ModifiedUserId   int       `json:"ModifiedUserId" xorm:"INT(11) 'ModifiedUserId'"`
+	ModifiedBy       string    `json:"ModifiedBy" xorm:"VARCHAR(50) 'ModifiedBy'"`
+}

+ 16 - 0
src/dashoo.cn/backend/api/business/oilcontract/contractSumScore/contractSumScoreService.go

@@ -0,0 +1,16 @@
+package contractSumScore
+
+import (
+	. "dashoo.cn/backend/api/mydb"
+	"github.com/go-xorm/xorm"
+)
+
+type OilContractSumScoreService struct {
+	MyServiceBase
+}
+
+func GetOilContractSumScoreService(xormEngine *xorm.Engine) *OilContractSumScoreService {
+	s := new(OilContractSumScoreService)
+	s.DBE = xormEngine
+	return s
+}

+ 1 - 0
src/dashoo.cn/backend/api/controllers/base.go

@@ -292,6 +292,7 @@ var (
 	OilContractReviewWorkFlowName            string = "OilContractReviewWorkFlow"  //合同审核工作流
 	OilEvaluationItemsName                   string = "OilEvaluationItems"         //业绩评价项目
 	OilContractOffGradeName					 string = "OilContractOffGrade"        //业绩评价不合格原因
+	OilContractSumScoreName                  string = "OilContractSumScore"        //年度汇总评分
 )
 
 //分页信息及数据

+ 2 - 0
src/dashoo.cn/backend/api/controllers/oilcontract/contractEvaluationItems.go

@@ -208,6 +208,8 @@ func (this *OilContractEvaluationItemsController) UpdateEntity() {
 
 		"ContractId",
 
+		"ContractWorkId",
+
 		"ParentId",
 
 		"SequenceNo",

+ 0 - 1
src/dashoo.cn/backend/api/controllers/oilcontract/contractReviewWorkFlow.go

@@ -7,7 +7,6 @@ import (
 	"time"
 
 	"dashoo.cn/backend/api/business/baseUser"
-	_ "dashoo.cn/backend/api/business/OilContract/contractReviewWorkFlow"
 	//	"dashoo.cn/backend/api/business/items"
 	. "dashoo.cn/backend/api/controllers"
 	"dashoo.cn/business2/userRole"

+ 305 - 0
src/dashoo.cn/backend/api/controllers/oilcontract/contractSumScore.go

@@ -0,0 +1,305 @@
+package oilcontract
+
+import (
+	"encoding/json"
+	"strings"
+	"time"
+
+	"dashoo.cn/backend/api/business/baseUser"
+	//	"dashoo.cn/backend/api/business/items"
+	"dashoo.cn/backend/api/business/oilcontract/contractSumScore"
+	. "dashoo.cn/backend/api/controllers"
+	"dashoo.cn/business2/userRole"
+	"dashoo.cn/utils"
+)
+
+type OilContractSumScoreController struct {
+	BaseController
+}
+
+// @Title 获取列表
+// @Description get user by token
+// @Success 200 {object} []contractSumScore.OilContractSumScore
+// @router /list [get]
+func (this *OilContractSumScoreController) GetEntityList() {
+
+	//获取分页信息
+	page := this.GetPageInfoForm()
+	where := " 1=1 "
+	orderby := "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")
+	ContractId := this.GetString("ContractId")
+	NormalSumScore := this.GetString("NormalSumScore")
+	SumScore := this.GetString("SumScore")
+	ConclusionReason := this.GetString("ConclusionReason")
+	Conclusion := this.GetString("Conclusion")
+	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 Id like '%" + Id + "%'"
+	}
+
+
+	if ContractId != "" {
+		where = where + " and ContractId like '%" + ContractId + "%'"
+	}
+
+
+	if NormalSumScore != "" {
+		where = where + " and NormalSumScore like '%" + NormalSumScore + "%'"
+	}
+
+
+	if SumScore != "" {
+		where = where + " and SumScore like '%" + SumScore + "%'"
+	}
+
+
+	if ConclusionReason != "" {
+		where = where + " and ConclusionReason like '%" + ConclusionReason + "%'"
+	}
+
+
+	if Conclusion != "" {
+		where = where + " and Conclusion like '%" + Conclusion + "%'"
+	}
+
+
+	if CreateOn != "" {
+		where = where + " and CreateOn like '%" + CreateOn + "%'"
+	}
+
+
+	if CreateUserId != "" {
+		where = where + " and CreateUserId like '%" + CreateUserId + "%'"
+	}
+
+
+	if CreateBy != "" {
+		where = where + " and CreateBy like '%" + CreateBy + "%'"
+	}
+
+
+	if ModifiedOn != "" {
+		where = where + " and ModifiedOn like '%" + ModifiedOn + "%'"
+	}
+
+
+	if ModifiedUserId != "" {
+		where = where + " and ModifiedUserId like '%" + ModifiedUserId + "%'"
+	}
+
+
+	if ModifiedBy != "" {
+		where = where + " and ModifiedBy like '%" + ModifiedBy + "%'"
+	}
+
+
+	if CreateOn != "" {
+		dates := strings.Split(CreateOn, ",")
+		if len(dates) == 2 {
+			minDate := dates[0]
+			maxDate := dates[1]
+			where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
+		}
+	}
+
+	svc := contractSumScore.GetOilContractSumScoreService(utils.DBE)
+	var list []contractSumScore.OilContractSumScore
+	total := svc.GetPagingEntitiesWithOrderBytbl(this.User.AccCode, page.CurrentPage, page.Size, orderby, asc, &list, where)
+	var datainfo DataInfo
+	datainfo.Items = list
+	datainfo.CurrentItemCount = total
+	datainfo.PageIndex = page.CurrentPage
+	datainfo.ItemsPerPage = page.Size
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}
+
+// @Title 获取字典列表
+// @Description get user by token
+// @Success 200 {object} map[string]interface{}
+// @router /dictlist [get]
+func (this *OilContractSumScoreController) GetDictList() {
+	dictList := make(map[string]interface{})
+	//dictSvc := items.GetItemsService(utils.DBE)
+	userSvc := baseUser.GetBaseUserService(utils.DBE)
+	//customerSvc := svccustomer.GetCustomerService(utils.DBE)
+	//dictList["WellNo"] = dictSvc.GetKeyValueItems("WellNo", this.User.AccCode)
+	var userEntity userRole.Base_User
+	userSvc.GetEntityById(this.User.Id, &userEntity)
+	dictList["Supervisers"] = userSvc.GetUserListByDepartmentId(this.User.AccCode, userEntity.Departmentid)
+
+	//var dictCustomer []svccustomer.Customer
+	//customerSvc.GetEntitysByWhere(this.User.AccCode + CustomerName, "", &dictCustomer)
+	//dictList["EntrustCorp"] = &dictCustomer
+
+	var datainfo DataInfo
+	datainfo.Items = dictList
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}
+
+// @Title 获取实体
+// @Description 获取实体
+// @Success 200 {object} contractSumScore.OilContractSumScore
+// @router /get/:id [get]
+func (this *OilContractSumScoreController) GetEntity() {
+	Id := this.Ctx.Input.Param(":id")
+
+	var model contractSumScore.OilContractSumScore
+	svc := contractSumScore.GetOilContractSumScoreService(utils.DBE)
+	svc.GetEntityByIdBytbl(this.User.AccCode+OilContractSumScoreName, Id, &model)
+
+	this.Data["json"] = &model
+	this.ServeJSON()
+}
+
+// @Title 添加
+// @Description 新增
+// @Param 	body body contractSumScore.OilContractSumScore
+// @Success	200	{object} controllers.Request
+// @router /add [post]
+func (this *OilContractSumScoreController) AddEntity() {
+	var model contractSumScore.OilContractSumScore
+	var jsonBlob = this.Ctx.Input.RequestBody
+	svc := contractSumScore.GetOilContractSumScoreService(utils.DBE)
+
+	json.Unmarshal(jsonBlob, &model)
+	model.CreateOn = time.Now()
+	model.CreateBy = this.User.Realname
+	model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+
+	_, err := svc.InsertEntityBytbl(this.User.AccCode+OilContractSumScoreName, &model)
+
+	var errinfo ErrorDataInfo
+	if err == nil {
+		//新增
+		errinfo.Message = "添加成功!"
+		errinfo.Code = 0
+		errinfo.Item = model.Id
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "添加失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
+// @Title 修改实体
+// @Description 修改实体
+// @Param 	body body contractSumScore.OilContractSumScore
+// @Success	200	{object} controllers.Request
+// @router /update/:id [post]
+func (this *OilContractSumScoreController) UpdateEntity() {
+	id := this.Ctx.Input.Param(":id")
+	var errinfo ErrorInfo
+	if id == "" {
+		errinfo.Message = "操作失败!请求信息不完整"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+
+	var model contractSumScore.OilContractSumScore
+	svc := contractSumScore.GetOilContractSumScoreService(utils.DBE)
+
+	var jsonBlob = this.Ctx.Input.RequestBody
+	json.Unmarshal(jsonBlob, &model)
+	model.ModifiedOn = time.Now()
+	model.ModifiedBy = this.User.Realname
+	model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
+
+	cols := []string{
+
+		"Id",
+
+		"ContractId",
+
+		"NormalSumScore",
+
+		"SumScore",
+
+		"ConclusionReason",
+
+		"Conclusion",
+
+		"CreateOn",
+
+		"CreateUserId",
+
+		"CreateBy",
+
+		"ModifiedOn",
+
+		"ModifiedUserId",
+
+		"ModifiedBy",
+
+
+	}
+	err := svc.UpdateEntityBytbl(this.User.AccCode+OilContractSumScoreName, id, &model, cols)
+	if err == nil {
+		errinfo.Message = "修改成功!"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "修改失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
+// @Title 删除单条信息
+// @Description
+// @Success 200 {object} ErrorInfo
+// @Failure 403 :id 为空
+// @router /delete/:Id [delete]
+func (this *OilContractSumScoreController) DeleteEntity() {
+	Id := this.Ctx.Input.Param(":Id")
+	var errinfo ErrorInfo
+	if Id == "" {
+		errinfo.Message = "操作失败!请求信息不完整"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+	var model contractSumScore.OilContractSumScore
+	var entityempty contractSumScore.OilContractSumScore
+	svc := contractSumScore.GetOilContractSumScoreService(utils.DBE)
+	opdesc := "删除-" + Id
+	err := svc.DeleteOperationAndWriteLogBytbl(this.User.AccCode+OilContractSumScoreName, BaseOperationLogName, Id, &model, &entityempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "钻井日报")
+	if err == nil {
+		errinfo.Message = "删除成功"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
+