作者 Your Name

Merge branch 'test'

... ... @@ -30,7 +30,7 @@ func (attendanceService *AttendanceService) WorkshopWorkTimeRecordStatics(cmd *c
log.Logger.Error(err.Error())
return nil, err
}
//TODO 添加功过统计
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ...
... ... @@ -131,6 +131,9 @@ func (productRecordService *ProductRecordService) SaveProductCapacities(operateI
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "保存员工生产记录失败"+err.Error())
}
if param.SaveAndApprove {
_ = domainService.SendProductRecordStaticsJob(epRecord)
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ... @@ -332,6 +335,7 @@ func (productRecordService *ProductRecordService) ApproveProductCapacities(opera
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "保存数据错误,"+err.Error())
}
_ = domainService.SendProductRecordStaticsJob(recordData)
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ... @@ -661,6 +665,9 @@ func (productRecordService *ProductRecordService) CreateProductCapacities(operat
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "保存员工生产记录失败"+err.Error())
}
if param.SaveAndApprove {
_ = domainService.SendProductRecordStaticsJob(epRecord)
}
productRecordIds = append(productRecordIds, epRecord.ProductRecordId)
}
if err := transactionContext.CommitTransaction(); err != nil {
... ...
package service
import (
"time"
"github.com/linmadan/egglib-go/core/application"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/dao"
)
//功过看板 展示(员工)
// RewardSummaryPublicNoticeDay 功过看板 日榜
func (srv ProductTroubleService) RewardSummaryPublicNoticeDay() (map[string]interface{}, error) {
func (srv ProductTroubleService) RewardSummaryPublicNoticeDay(operateInfo *domain.OperateInfo) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -22,7 +25,8 @@ func (srv ProductTroubleService) RewardSummaryPublicNoticeDay() (map[string]inte
transactionContext.RollbackTransaction()
}()
rewardSumaryDao, _ := dao.NewRewardSumaryDao(transactionContext.(*pgTransaction.TransactionContext))
sumaryData, err := rewardSumaryDao.SeachRewardSummaryDay(23, 487, "2022-10-29")
nowTime := time.Now().Format("2006-01-02")
sumaryData, err := rewardSumaryDao.SeachRewardSummaryDay(operateInfo.CompanyId, operateInfo.OrgId, nowTime)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ... @@ -31,14 +35,14 @@ func (srv ProductTroubleService) RewardSummaryPublicNoticeDay() (map[string]inte
}
result := map[string]interface{}{
"list": sumaryData,
"recordDay": "2022-10-29",
"recordDay": nowTime,
}
return result, nil
}
// RewardSummaryPublicNoticeYield 功过看板 产效
func (srv ProductTroubleService) RewardSummaryPublicNoticeYield() (map[string]interface{}, error) {
func (srv ProductTroubleService) RewardSummaryPublicNoticeYield(operateInfo *domain.OperateInfo) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
... ... @@ -51,7 +55,8 @@ func (srv ProductTroubleService) RewardSummaryPublicNoticeYield() (map[string]in
transactionContext.RollbackTransaction()
}()
rewardSumaryDao, _ := dao.NewRewardSumaryDao(transactionContext.(*pgTransaction.TransactionContext))
sumaryData, err := rewardSumaryDao.SeachRewardSummaryYield(23, 487, "2022-10-29")
nowTime := time.Now().Format("2006-01-02")
sumaryData, err := rewardSumaryDao.SeachRewardSummaryYield(operateInfo.CompanyId, operateInfo.OrgId, nowTime)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ... @@ -67,7 +72,7 @@ func (srv ProductTroubleService) RewardSummaryPublicNoticeYield() (map[string]in
}
// RewardSummaryPublicNoticeUpToStandard 功过看板 合格率
func (srv ProductTroubleService) RewardSummaryPublicNoticeUpToStandard() (map[string]interface{}, error) {
func (srv ProductTroubleService) RewardSummaryPublicNoticeUpToStandard(operateInfo *domain.OperateInfo) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
... ... @@ -80,7 +85,8 @@ func (srv ProductTroubleService) RewardSummaryPublicNoticeUpToStandard() (map[st
transactionContext.RollbackTransaction()
}()
rewardSumaryDao, _ := dao.NewRewardSumaryDao(transactionContext.(*pgTransaction.TransactionContext))
sumaryData, err := rewardSumaryDao.SeachRewardUpToStandard(23, 487, "2022-10-29")
nowTime := time.Now().Format("2006-01-02")
sumaryData, err := rewardSumaryDao.SeachRewardUpToStandard(operateInfo.CompanyId, operateInfo.OrgId, nowTime)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ... @@ -95,7 +101,7 @@ func (srv ProductTroubleService) RewardSummaryPublicNoticeUpToStandard() (map[st
}
// RewardSummaryPublicNoticeDay 功过看板 异常
func (srv ProductTroubleService) RewardSummaryPublicNoticeAccident() (map[string]interface{}, error) {
func (srv ProductTroubleService) RewardSummaryPublicNoticeAccident(operateInfo *domain.OperateInfo) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
... ... @@ -108,7 +114,8 @@ func (srv ProductTroubleService) RewardSummaryPublicNoticeAccident() (map[string
transactionContext.RollbackTransaction()
}()
rewardSumaryDao, _ := dao.NewRewardSumaryDao(transactionContext.(*pgTransaction.TransactionContext))
sumaryData, err := rewardSumaryDao.SeachRewardAccident(23, 487, "2022-10-29")
nowTime := time.Now().Format("2006-01-02")
sumaryData, err := rewardSumaryDao.SeachRewardAccident(operateInfo.CompanyId, operateInfo.OrgId, nowTime)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ... @@ -122,8 +129,7 @@ func (srv ProductTroubleService) RewardSummaryPublicNoticeAccident() (map[string
}
// RewardSummaryPublicNoticeDay 功过看板 月榜
func (srv ProductTroubleService) RewardSummaryPublicNoticeMonth() (map[string]interface{}, error) {
func (srv ProductTroubleService) RewardSummaryPublicNoticeMonth(operateInfo *domain.OperateInfo) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -135,7 +141,8 @@ func (srv ProductTroubleService) RewardSummaryPublicNoticeMonth() (map[string]in
transactionContext.RollbackTransaction()
}()
rewardSumaryDao, _ := dao.NewRewardSumaryDao(transactionContext.(*pgTransaction.TransactionContext))
sumaryData, err := rewardSumaryDao.SeachRewardSummaryMonth(23, 487, "2022-10")
nowTime := time.Now().Format("2006-01")
sumaryData, err := rewardSumaryDao.SeachRewardSummaryMonth(operateInfo.CompanyId, operateInfo.OrgId, nowTime)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ...
... ... @@ -134,7 +134,7 @@ func (c *PGRewardSummaryStaticService) CreateRewardSummaryByEmployeeProductRecor
"sectionId": param.WorkStation.SectionId,
"workshopId": param.WorkStation.WorkshopId,
"workerId": param.ProductWorker.UserId,
"recordDateStr": param.CreatedAt.Format("200-01-02"),
"recordDateStr": param.CreatedAt.Format("2006-01-02"),
}
_, summaryList, err := rewardSummaryRepo.Find(condtion)
... ...
... ... @@ -137,6 +137,10 @@ func (repo *RewardSummaryRepository) Find(queryOptions map[string]interface{}) (
if v, ok := queryOptions["recordDateStr"]; ok {
query.Where("record_date_str=?", v)
}
//用户id
if v, ok := queryOptions["workerId"]; ok {
query.Where(`worker->>'userId'='?'`, v)
}
cnt, err := query.SelectAndCount()
if err != nil {
return 0, nil, err
... ...
... ... @@ -87,34 +87,39 @@ func (c *ProductTroubleController) ListRewardSummary() {
// 功过看板 日榜
func (c *ProductTroubleController) RewardSummaryPublicNoticeDay() {
srv := service.NewProductTroubleService(nil)
data, err := srv.RewardSummaryPublicNoticeDay()
operater := ParseOperateInfo(c.BaseController)
data, err := srv.RewardSummaryPublicNoticeDay(operater)
c.Response(data, err)
}
// 功过看板 产效
func (c *ProductTroubleController) RewardSummaryPublicNoticeYield() {
srv := service.NewProductTroubleService(nil)
data, err := srv.RewardSummaryPublicNoticeYield()
operater := ParseOperateInfo(c.BaseController)
data, err := srv.RewardSummaryPublicNoticeYield(operater)
c.Response(data, err)
}
// 功过看板 合格率
func (c *ProductTroubleController) RewardSummaryPublicNoticeUpToStandard() {
srv := service.NewProductTroubleService(nil)
data, err := srv.RewardSummaryPublicNoticeUpToStandard()
operater := ParseOperateInfo(c.BaseController)
data, err := srv.RewardSummaryPublicNoticeUpToStandard(operater)
c.Response(data, err)
}
// 功过看板 异常
func (c *ProductTroubleController) RewardSummaryPublicNoticeAccident() {
srv := service.NewProductTroubleService(nil)
data, err := srv.RewardSummaryPublicNoticeAccident()
operater := ParseOperateInfo(c.BaseController)
data, err := srv.RewardSummaryPublicNoticeAccident(operater)
c.Response(data, err)
}
// 功过看板 月榜
func (c *ProductTroubleController) RewardSummaryPublicNoticeMonth() {
srv := service.NewProductTroubleService(nil)
data, err := srv.RewardSummaryPublicNoticeMonth()
operater := ParseOperateInfo(c.BaseController)
data, err := srv.RewardSummaryPublicNoticeMonth(operater)
c.Response(data, err)
}
... ...