Pārlūkot izejas kodu

update

add_mode
DengBiao pirms 1 gada
vecāks
revīzija
a64c964ccf
13 mainītis faili ar 139 papildinājumiem un 16 dzēšanām
  1. +5
    -0
      app/admin/hdl/enterprise_manage/hdl_enterprise.go
  2. +22
    -8
      app/admin/hdl/hdl_enterprise.go
  3. +2
    -2
      app/admin/md/md_app_redis_key.go
  4. +15
    -0
      app/admin/md/md_self_support_for_school.go
  5. +2
    -1
      app/admin/svc/enterprise_manage/svc_self_support_for_school.go
  6. +49
    -0
      app/admin/svc/svc_self_support_for_school.go
  7. +1
    -0
      app/customer/hdl/hdl_user_identity.go
  8. +1
    -1
      app/customer/hdl/self_support_for_school/hdl_faceCollection.go
  9. +4
    -3
      app/customer/svc/svc_curl_smart_pay.go
  10. +8
    -0
      app/db/db_class.go
  11. +2
    -1
      app/db/db_permission_group.go
  12. +27
    -0
      app/db/db_self_support_for_user_face_info.go
  13. +1
    -0
      app/db/model/self_support_for_user_face_info.go

+ 5
- 0
app/admin/hdl/enterprise_manage/hdl_enterprise.go Parādīt failu

@@ -37,6 +37,11 @@ func EnterpriseManageInfo(c *gin.Context) {
case enum.EnterprisePvdByCentralKitchenForFactory:
break
case enum.EnterprisePvdBySelfSupportForSchool:
err, resp = svc.SelfSupportForSchoolInfo(utils.StrToInt(enterpriseId))
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
break
case enum.EnterprisePvdBySelfSupportForFactory:
break


+ 22
- 8
app/admin/hdl/hdl_enterprise.go Parādīt failu

@@ -98,16 +98,30 @@ func SchoolBelowGrade(c *gin.Context) {

func SchoolGradeBelowClass(c *gin.Context) {
gradeId := c.DefaultQuery("grade_id", "")
enterpriseId := c.DefaultQuery("enterprise_id", "")
classDb := db.ClassDb{}
classDb.Set(utils.StrToInt(gradeId))
classList, err := classDb.FindClass()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return

if gradeId != "" {
classDb.Set(utils.StrToInt(gradeId))
classList, err := classDb.FindClass()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
e.OutSuc(c, map[string]interface{}{
"list": classList,
}, nil)
} else {
classDb.Set(0)
classList, err := classDb.FindClassByEnterprise(enterpriseId)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
e.OutSuc(c, map[string]interface{}{
"list": classList,
}, nil)
}
e.OutSuc(c, map[string]interface{}{
"list": classList,
}, nil)
return
}



+ 2
- 2
app/admin/md/md_app_redis_key.go Parādīt failu

@@ -7,6 +7,6 @@ const (
AdminRolePermissionKey = "%s:smart_canteen_admin_role_permission:%s" // 占位符:ip, admin:id
AdminRolePermissionCacheTime = 3600 * 24 * 0.5
CfgCacheTime = 86400
AppCfgCacheKey = "one_item_one_code:%s" // 占位符: key的第一个字母
WxOfficialAccountCacheKey = "wx_official_account" // 占位符: key的第一个字母
AppCfgCacheKey = "smart_canteen:%s" // 占位符: key的第一个字母
WxOfficialAccountCacheKey = "wx_official_account" // 占位符: key的第一个字母
)

+ 15
- 0
app/admin/md/md_self_support_for_school.go Parādīt failu

@@ -0,0 +1,15 @@
package md

type SelfSupportForSchoolInfoResp struct {
Name string `json:"name" label:"名称"`
Memo string `json:"memo" label:"备注"`
Kind string `json:"kind" label:"种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂)"`
State string `json:"state" label:"状态(1:正常 2:冻结)"`
TeacherNum int64 `json:"teacher_num" label:"教师数量"`
StudentNum int64 `json:"student_num" label:"学生数量"`
ClassNum int64 `json:"class_num" label:"班级数量"`
ConcentrateSchoolFacePassNum int64 `json:"concentrate_school_face_pass_num" label:"集采数量"`
SingleSchoolFacePassNum int64 `json:"single_school_face_pass_num" label:"个采数量"`
SchoolFacePassNum int64 `json:"school_face_pass_num" label:"校园一脸通行开通数量"`
SchoolFacePaymentNum int64 `json:"school_face_payment_num" label:"校园一脸通行刷脸支付开通数量"`
}

+ 2
- 1
app/admin/svc/enterprise_manage/svc_self_support_for_school.go Parādīt failu

@@ -122,6 +122,7 @@ func SelfSupportForSchoolUserUpdate(req md.SelfSupportForSchoolUserUpdateReq) (e

selfSupportForUserFaceInfoDb.Set(insertId)
_, err = selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoInsert(&model.SelfSupportForUserFaceInfo{
EnterpriseId: req.EnterpriseId,
UserIdentityId: insertId,
CollectFaceType: 1, //默认个采
SchoolCode: selfSupportForSchoolInfo.SchoolCode,
@@ -414,7 +415,7 @@ func SelfSupportForSchoolStudentDelete(req md.SelfSupportForSchoolStudentDeleteR
}

//3、删除 self_support_for_user_face_info
_, err = db.Db.In("user_identity_id =?", req.UserIdentityIds).Delete(model.SelfSupportForUserFaceInfo{})
_, err = db.Db.In("user_identity_id", req.UserIdentityIds).Delete(model.SelfSupportForUserFaceInfo{})
if err != nil {
return
}


+ 49
- 0
app/admin/svc/svc_self_support_for_school.go Parādīt failu

@@ -0,0 +1,49 @@
package svc

import (
"applet/app/admin/md"
"applet/app/db"
"applet/app/enum"
)

func SelfSupportForSchoolInfo(enterpriseId int) (err error, resp md.SelfSupportForSchoolInfoResp) {
//1、查询`enterprise`
enterpriseDb := db.EnterpriseDb{}
enterpriseDb.Set()
enterprise, err := enterpriseDb.GetEnterprise(enterpriseId)
if err != nil {
return
}
resp.Name = enterprise.Name
resp.Memo = enterprise.Memo
resp.Kind = enum.EnterprisePvd(enterprise.Kind).String()
resp.State = enum.EnterpriseState(enterprise.State).String()

//2、统计 "教师"、 "学生"、 "班级" 数量
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
resp.StudentNum, err = userIdentityDb.CountUserIdentityForEnterprise(enterpriseId, enum.UserIdentityForCentralKitchenForStudent)
if err != nil {
return
}
resp.TeacherNum, err = userIdentityDb.CountUserIdentityForEnterprise(enterpriseId, enum.UserIdentityForCentralKitchenForTeacher)
if err != nil {
return
}
classDb := db.ClassDb{}
classDb.Set(0)
resp.ClassNum, err = classDb.CountClassForEnterprise(enterpriseId)
if err != nil {
return
}

//3、统计 用户人脸信息
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
selfSupportForUserFaceInfoDb.Set(0)
resp.SchoolFacePassNum, _ = selfSupportForUserFaceInfoDb.CountSchoolFacePassStatus(enterpriseId, "open")
resp.SchoolFacePaymentNum, _ = selfSupportForUserFaceInfoDb.CountSchoolFacePaymentStatus(enterpriseId, "open")
resp.SingleSchoolFacePassNum, _ = selfSupportForUserFaceInfoDb.CountCollectFaceType(enterpriseId, 1)
resp.ConcentrateSchoolFacePassNum, _ = selfSupportForUserFaceInfoDb.CountCollectFaceType(enterpriseId, 1)

return
}

+ 1
- 0
app/customer/hdl/hdl_user_identity.go Parādīt failu

@@ -216,6 +216,7 @@ func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) {
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
selfSupportForUserFaceInfoDb.Set(insertAffected)
_, err2 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoInsert(&model.SelfSupportForUserFaceInfo{
EnterpriseId: req.EnterpriseId,
UserIdentityId: insertAffected,
CollectFaceType: 1,
SchoolCode: selfSupportForSchoolInfo.SchoolCode,


+ 1
- 1
app/customer/hdl/self_support_for_school/hdl_faceCollection.go Parādīt failu

@@ -50,7 +50,7 @@ func EducateSceneTokenQuery(c *gin.Context) {
StudentName: identity.Name,
OutUserId: utils.IntToStr(identity.Id),
SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode,
}, identity.Id, userToken)
}, identity, userToken)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return


+ 4
- 3
app/customer/svc/svc_curl_smart_pay.go Parādīt failu

@@ -165,7 +165,7 @@ func CurlAlipayTradeRefund(args md.CurlAlipayTradeRefundReq) (err error, resp in
return nil, result.Data
}

func CurlEducateSceneTokenQuery(args md.CurlEducateSceneTokenReq, userIdentityId int, userToken string) (err error, resp interface{}) {
func CurlEducateSceneTokenQuery(args md.CurlEducateSceneTokenReq, userIdentity *model.UserIdentity, userToken string) (err error, resp interface{}) {
utils.FilePutContents("CurlEducateSceneTokenQuery", utils.SerializeStr(map[string]interface{}{
"args": args,
}))
@@ -247,7 +247,7 @@ func CurlEducateSceneTokenQuery(args md.CurlEducateSceneTokenReq, userIdentityId
}
// 更新/新增 `self_support_for_user_facel_info`
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
selfSupportForUserFaceInfoDb.Set(userIdentityId)
selfSupportForUserFaceInfoDb.Set(userIdentity.Id)
info, err := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo()
if err != nil {
return
@@ -259,7 +259,8 @@ func CurlEducateSceneTokenQuery(args md.CurlEducateSceneTokenReq, userIdentityId

if info == nil {
info = &model.SelfSupportForUserFaceInfo{
UserIdentityId: userIdentityId,
EnterpriseId: userIdentity.EnterpriseId,
UserIdentityId: userIdentity.Id,
CollectFaceType: 1,
SchoolCode: res["school_code"],
SchoolStdCode: res["school_std_code"],


+ 8
- 0
app/db/db_class.go Parādīt failu

@@ -31,6 +31,14 @@ func (classDb *ClassDb) FindClass() (*[]model.Class, error) {
return &m, nil
}

func (classDb *ClassDb) FindClassByEnterprise(enterpriseId interface{}) (*[]model.Class, error) {
var m []model.Class
if err := classDb.Db.Desc("id").Where("enterprise_id =?", enterpriseId).Find(&m); err != nil {
return nil, logx.Error(err)
}
return &m, nil
}

func (classDb *ClassDb) ClassDeleteBySession(id interface{}) (int64, error) {
if reflect.TypeOf(id).Kind() == reflect.Slice {
return classDb.Db.In("id", id).Delete(model.Class{})


+ 2
- 1
app/db/db_permission_group.go Parādīt failu

@@ -1,6 +1,7 @@
package db

import (
"applet/app/admin/enum"
"applet/app/db/model"
"applet/app/utils/logx"
"xorm.io/xorm"
@@ -16,7 +17,7 @@ func (permissionGroupDb *PermissionGroupDb) Set() { // set方法

func (permissionGroupDb *PermissionGroupDb) FindPermissionGroup() (*[]model.PermissionGroup, error) {
var m []model.PermissionGroup
if err := permissionGroupDb.Db.Asc("id").Find(&m); err != nil {
if err := permissionGroupDb.Db.Where("state = ?", enum.PermissionGroupStateForNormal).Asc("id").Find(&m); err != nil {
return nil, logx.Error(err)
}
return &m, nil


+ 27
- 0
app/db/db_self_support_for_user_face_info.go Parādīt failu

@@ -79,6 +79,33 @@ func (selfSupportForUserFaceInfoDb *SelfSupportForUserFaceInfoDb) SelfSupportFor
}
}

func (selfSupportForUserFaceInfoDb *SelfSupportForUserFaceInfoDb) CountSchoolFacePassStatus(enterpriseId int, status string) (total int64, err error) {
var m model.SelfSupportForUserFaceInfo
total, err = selfSupportForUserFaceInfoDb.Db.Where("enterprise_id =? AND school_face_pass_status =?", enterpriseId, status).Count(&m)
if err != nil {
return
}
return
}

func (selfSupportForUserFaceInfoDb *SelfSupportForUserFaceInfoDb) CountSchoolFacePaymentStatus(enterpriseId int, status string) (total int64, err error) {
var m model.SelfSupportForUserFaceInfo
total, err = selfSupportForUserFaceInfoDb.Db.Where("enterprise_id =? AND concentrate_school_face_pass_status =?", enterpriseId, status).Count(&m)
if err != nil {
return
}
return
}

func (selfSupportForUserFaceInfoDb *SelfSupportForUserFaceInfoDb) CountCollectFaceType(enterpriseId, collectFaceType int) (total int64, err error) {
var m model.SelfSupportForUserFaceInfo
total, err = selfSupportForUserFaceInfoDb.Db.Where("enterprise_id =? AND collect_face_type =?", enterpriseId, collectFaceType).Count(&m)
if err != nil {
return
}
return
}

type SelfSupportForUserFaceInfoWithUserIdentity struct {
model.SelfSupportForUserFaceInfo `xorm:"extends"`
model.UserIdentity `xorm:"extends"`


+ 1
- 0
app/db/model/self_support_for_user_face_info.go Parādīt failu

@@ -2,6 +2,7 @@ package model

type SelfSupportForUserFaceInfo struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
EnterpriseId int `json:"enterprise_id" xorm:"not null default 0 comment('单位id') INT(11)"`
UserIdentityId int `json:"user_identity_id" xorm:"not null default 0 comment('用户身份id') INT(11)"`
CollectFaceType int `json:"collect_face_type" xorm:"not null default 1 comment('采集人脸方式(1:个采 2:集采)') TINYINT(1)"`
SchoolCode string `json:"school_code" xorm:"not null default '' comment('学校内标') VARCHAR(255)"`


Notiek ielāde…
Atcelt
Saglabāt