作者 tangxvhui

更新

... ... @@ -30,3 +30,4 @@ swagger.yaml
*.log
lastupdate.tmp
allied-creation-manufacture
main_local.go
... ...
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch file",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "./main.go",
"buildFlags": "--tags=local"
}
]
}
\ No newline at end of file
... ...
//go:build !local
// +build !local
package main
import (
"fmt"
"time"
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/crontab"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/constant"
... ... @@ -9,7 +14,6 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/mqtt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/task"
"time"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/constant"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg"
... ...
... ... @@ -2,8 +2,6 @@ package dto
type RewardStandardInfo struct {
Id int `json:"id"` //奖惩标准id
CompanyId int `json:"companyId"` //企业id
OrgId int `json:"orgId"` //组织ID
WorkshopId int `json:"workshopId"` //车间id
WorkshopName string `json:"workshopName"` //
LineId int `json:"lineId"` //生产线ID
... ...
... ... @@ -12,6 +12,6 @@ type RewardStandardList struct {
TargetType int `json:"targetType"` //指标类别 1:产效 2:合格率 3:安全事故 4:质量事故 5:异物次数
TargetTypeName string `json:"targetTypeName"` //指标类别
TargeReward string `json:"targeReward"` //描述功劳指标
TargeFault string `json:"targeVal2"` //描述过失指标
TargeFault string `json:"targeFault"` //描述过失指标
}
... ...
... ... @@ -98,6 +98,8 @@ func (srv RewardStandardService) SaveRewardStandard(operateInfo *domain.OperateI
rewardStandardData.ProductLine = productLineData.SimpleProductLine()
rewardStandardData.Workshop = workShopData.SimpleWorkshop()
rewardStandardData.Remark = param.Remark
rewardStandardData.CompanyId = operateInfo.CompanyId
rewardStandardData.OrgId = operateInfo.OrgId
err = rewardStandardData.UpdateTarge(
param.TargetType,
param.TargeVal1,
... ... @@ -114,7 +116,8 @@ func (srv RewardStandardService) SaveRewardStandard(operateInfo *domain.OperateI
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return nil, nil
param.Id = rewardStandardData.Id
return param, nil
}
//GetRewardStandard 根据id获取奖惩标准数据
... ... @@ -224,7 +227,7 @@ func (srv RewardStandardService) ListRewardStandard(param *query.ListRewardStand
if param.PageSize > 0 {
condition["limit"] = param.PageSize
}
offset := param.PageSize * (param.PageSize - 1)
offset := param.PageSize * (param.PageNumber - 1)
if offset > 0 {
condition["offset"] = offset
}
... ...
... ... @@ -3,10 +3,11 @@ package pg
import (
"context"
"fmt"
"github.com/beego/beego/v2/core/logs"
"log"
"reflect"
"github.com/beego/beego/v2/core/logs"
"github.com/go-pg/pg/v10"
"github.com/go-pg/pg/v10/orm"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/constant"
... ... @@ -50,6 +51,7 @@ func init() {
(*models.WorkshopPlanCompletionRecord)(nil),
(*models.ProductMaterialGroup)(nil),
(*models.ProductMaterial)(nil),
(*models.RewardStandard)(nil),
} {
err := DB.Model(model).CreateTable(&orm.CreateTableOptions{
Temp: false,
... ...
... ... @@ -9,8 +9,10 @@ import (
//RewardStandard 奖惩标准
type RewardStandard struct {
tableName string `pg:"manufacture.reward_standard,alias:reward_standard"`
Id int `pg:"pk:id"` //奖惩标准 id
Workshop domain.SimpleWorkshop //车间id
Id int `pg:"pk:id"` //奖惩标准 id
CompanyId int `comment:"企业id"` // 企业id
OrgId int `comment:"组织ID"` // 组织ID
Workshop domain.SimpleWorkshop //车间
ProductLine domain.SimpleProductLine //生产线
ProductSection domain.ProductSection //工段
Remark string //备注
... ...
... ... @@ -50,6 +50,8 @@ func (repo *RewardStandardRepository) Save(param *domain.RewardStandard) (*domai
CreatedAt: param.CreatedAt,
UpdatedAt: param.UpdatedAt,
DeletedAt: param.DeletedAt,
CompanyId: param.CompanyId,
OrgId: param.OrgId,
}
tx := repo.transactionContext.PgTx
if param.Id == 0 {
... ... @@ -117,13 +119,13 @@ func (repo *RewardStandardRepository) Find(queryOptions map[string]interface{})
query.Offset(v)
}
if v, ok := queryOptions["workshopId"]; ok {
query.Where("work_shop->>'workshopId'='?'", v)
query.Where("workshop->>'workshopId'='?'", v)
}
if v, ok := queryOptions["lineId"]; ok {
query.Where("product_line->>lineId='?'", v)
query.Where("product_line->>'lineId'='?'", v)
}
if v, ok := queryOptions["sectionId"]; ok {
query.Where("product_section->>sectionId='?'", v)
query.Where("product_section->>'sectionId'='?'", v)
}
if v, ok := queryOptions["targetType"]; ok {
... ... @@ -168,5 +170,7 @@ func (repo *RewardStandardRepository) TransformToDomain(param *models.RewardStan
CreatedAt: param.CreatedAt,
UpdatedAt: param.UpdatedAt,
DeletedAt: param.DeletedAt,
CompanyId: param.CompanyId,
OrgId: param.OrgId,
}
}
... ...
package beego
import (
"github.com/beego/beego/v2/server/web"
"github.com/linmadan/egglib-go/web/beego/filters"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/constant"
"net/http"
"net/http/pprof"
"os"
"strconv"
"github.com/beego/beego/v2/server/web"
"github.com/linmadan/egglib-go/web/beego/filters"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/constant"
. "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/log"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego/routers"
)
... ... @@ -30,7 +31,7 @@ func init() {
}
}
//https支持
web.BConfig.Listen.EnableHTTPS = true
web.BConfig.Listen.EnableHTTPS = false
web.BConfig.Listen.HTTPSPort = 443
//进程内监控
... ...
... ... @@ -26,6 +26,8 @@ func (c RewardStandardController) UpdateRewardStandard() {
srv := service.NewRewardStandardService(nil)
createCommand := &command.SaveRewardStandardCommand{}
Must(c.Unmarshal(createCommand))
id, _ := c.GetInt(":id")
createCommand.Id = id
operater := ParseOperateInfo(c.BaseController)
data, err := srv.SaveRewardStandard(operater, createCommand)
c.Response(data, err)
... ...