Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
a7ac9fe580
16 changed files with 589 additions and 52 deletions
  1. +30
    -1
      app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go
  2. +1
    -0
      app/admin/hdl/enterprise_manage/hdl_enterprise.go
  3. +270
    -13
      app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go
  4. +14
    -0
      app/admin/hdl/hdl_user.go
  5. +58
    -4
      app/admin/md/md_enterprise_manage.go
  6. +1
    -0
      app/admin/md/md_user.go
  7. +7
    -0
      app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go
  8. +63
    -4
      app/admin/svc/enterprise_manage/svc_enterprise_manage.go
  9. +8
    -1
      app/admin/svc/enterprise_manage/svc_self_support_for_school.go
  10. +3
    -1
      app/admin/svc/svc_user.go
  11. +0
    -14
      app/customer/hdl/hdl_user.go
  12. +15
    -13
      app/customer/md/md_curl_smart_pay.go
  13. +89
    -0
      app/db/db_self_support_for_user_face_info.go.go
  14. +15
    -0
      app/db/model/self_support_for_user_consume_limit.go
  15. +13
    -0
      app/enum/enum_user_identity.go
  16. +2
    -1
      app/router/admin_router.go

+ 30
- 1
app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go View File

@@ -114,6 +114,20 @@ func CentralKitchenForSchoolStudentList(c *gin.Context) {
"value": "admission_type_by_grade",
},
},
"user_identity_cert_type_list": []map[string]interface{}{
{
"name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForIdCard),
"value": enum.UserIdentityCertTypeForIdCard,
},
{
"name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForStudentId),
"value": enum.UserIdentityCertTypeForStudentId,
},
//{
// "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport),
// "value": enum.UserIdentityCertTypeForPassport,
//},
},
}, nil)
return
}
@@ -147,6 +161,20 @@ func CentralKitchenForSchoolTeacherList(c *gin.Context) {
e.OutSuc(c, map[string]interface{}{
"list": resp,
"total": total,
"user_identity_cert_type_list": []map[string]interface{}{
{
"name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForIdCard),
"value": enum.UserIdentityCertTypeForIdCard,
},
{
"name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForStudentId),
"value": enum.UserIdentityCertTypeForStudentId,
},
//{
// "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport),
// "value": enum.UserIdentityCertTypeForPassport,
//},
},
}, nil)
return
}
@@ -173,7 +201,8 @@ func CentralKitchenForSchoolTeacherUpdate(c *gin.Context) {
}
userIdentity.IdNo = req.IdNo
userIdentity.Name = req.Name
_, err = userIdentityDb.UserIdentityUpdate(req.UserIdentityId, userIdentity, "id_no", "name")
userIdentity.CertType = req.CertType
_, err = userIdentityDb.UserIdentityUpdate(req.UserIdentityId, userIdentity, "id_no", "name", "cert_type")
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return


+ 1
- 0
app/admin/hdl/enterprise_manage/hdl_enterprise.go View File

@@ -122,6 +122,7 @@ func UserIdentityList(c *gin.Context) {
return
}
}

e.OutSuc(c, resp, nil)
return
}

+ 270
- 13
app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go View File

@@ -187,6 +187,20 @@ func SelfSupportForSchoolTeacherList(c *gin.Context) {
"value": 2,
},
},
"user_identity_cert_type_list": []map[string]interface{}{
{
"name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForIdCard),
"value": enum.UserIdentityCertTypeForIdCard,
},
{
"name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForStudentId),
"value": enum.UserIdentityCertTypeForStudentId,
},
//{
// "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport),
// "value": enum.UserIdentityCertTypeForPassport,
//},
},
}, nil)
return
}
@@ -213,7 +227,8 @@ func SelfSupportForSchoolTeacherUpdate(c *gin.Context) {
}
userIdentity.IdNo = req.IdNo
userIdentity.Name = req.Name
_, err = userIdentityDb.UserIdentityUpdate(req.UserIdentityId, userIdentity, "id_no", "name")
userIdentity.CertType = req.CertType
_, err = userIdentityDb.UserIdentityUpdate(req.UserIdentityId, userIdentity, "id_no", "name", "cert_type")
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
@@ -686,7 +701,7 @@ func SelfSupportForSchoolAddTeacher(c *gin.Context) {
//1、查找当前身份是否已存在
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, enum.UserIdentityCertTypeForIdCard)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, req.CertType)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
@@ -702,7 +717,7 @@ func SelfSupportForSchoolAddTeacher(c *gin.Context) {
Uid: 0,
Name: req.Name,
IdNo: req.IdNo,
CertType: enum.UserIdentityCertTypeForIdCard,
CertType: req.CertType,
Kind: enum.UserIdentityKindForCommon,
Identity: enum.UserIdentityForSelfSupportForTeacher,
EnterpriseId: req.EnterpriseId,
@@ -1074,7 +1089,7 @@ func SelfSupportForSchoolOrdList(c *gin.Context) {
}

func SelfSupportForSchoolConsumeLimit(c *gin.Context) {
var req md.SelfSupportForSchoolOrdListReq
var req []*md.SelfSupportForSchoolConsumeLimitReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
@@ -1082,26 +1097,268 @@ func SelfSupportForSchoolConsumeLimit(c *gin.Context) {
e.OutErr(c, err1.Code, err1.Error())
return
}
enterpriseId := utils.StrToInt(c.DefaultQuery("enterprise_id", ""))
enterpriseDb := db.EnterpriseDb{}
enterpriseDb.Set()
enterprise, err := enterpriseDb.GetEnterprise(enterpriseId)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if enterprise == nil {
e.OutErr(c, e.ERR_NO_DATA, "未查询到对应校企记录")
return
}
selfSupportForSchoolInfoDb := db.SelfSupportForSchoolInfoDb{}
selfSupportForSchoolInfoDb.Set(enterpriseId)
selfSupportForSchoolInfo, err := selfSupportForSchoolInfoDb.GetSelfSupportForSchoolInfo()
if err != nil {
return
}
if selfSupportForSchoolInfo == nil {
e.OutErr(c, e.ERR, "当前学校暂未完成《一脸通行入驻》")
return
}

resp, total, err := svc2.SelfSupportForSchoolOrdList(req)
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
userIdentityDb := db.UserIdentityDb{}
var data md2.CurlAlipayPlanetEcocampusApiRosterConsumeLimit
var mm []*model.SelfSupportForUserConsumeLimit
var userIdentityIds []int
now := time.Now()
for _, v := range req {
selfSupportForUserFaceInfoDb.Set(v.UserIdentityId)
userIdentityDb.Set(0)
faceInfo, err := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if faceInfo == nil {
e.OutErr(c, e.ERR_NO_DATA, "用户【"+utils.IntToStr(v.UserIdentityId)+"】身份未查询到一脸通行相关数据")
return
}
identity, err := userIdentityDb.GetUserIdentity(v.UserIdentityId)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if identity == nil {
e.OutErr(c, e.ERR_NO_DATA, "用户【"+utils.IntToStr(v.UserIdentityId)+"】身份未查询到")
return
}

data.SchoolCode = selfSupportForSchoolInfo.SchoolCode
data.ConsumeLimitSyncInfo = append(data.ConsumeLimitSyncInfo, md2.ConsumeLimitSyncInfo{
FaceUid: faceInfo.UserId,
OutRosterCode: utils.IntToStr(v.UserIdentityId),
RosterName: identity.Name,
DailyConsumeLimit: v.DailyConsumeLimit,
DailyConsumeLimitSwitch: v.DailyConsumeLimitSwitch,
SingleConsumeLimit: v.SingleConsumeLimit,
SingleConsumeLimitSwitch: v.SingleConsumeLimitSwitch,
DailyConsumeNumber: v.DailyConsumeNumber,
DailyConsumeNumberSwitch: v.DailyConsumeNumberSwitch,
})
mm = append(mm, &model.SelfSupportForUserConsumeLimit{
EnterpriseId: enterpriseId,
UserIdentityId: v.UserIdentityId,
DailyConsumeLimit: v.DailyConsumeLimit,
DailyConsumeLimitSwitch: v.DailyConsumeLimitSwitch,
SingleConsumeLimit: v.SingleConsumeLimit,
SingleConsumeLimitSwitch: v.SingleConsumeLimitSwitch,
DailyConsumeNumber: v.DailyConsumeNumber,
DailyConsumeNumberSwitch: v.DailyConsumeNumberSwitch,
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
})
userIdentityIds = append(userIdentityIds, v.UserIdentityId)
}

err, resp := svc.CurlAlipayPlanetEcocampusApiRosterConsumeLimit(data)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}

//TODO::记录到表中
_, err = db.Db.In("user_identity_id", userIdentityIds).Delete(model.SelfSupportForUserConsumeLimit{})
if err != nil {
return
}
selfSupportForUserConsumeLimitDb := db.SelfSupportForUserConsumeLimitDb{}
selfSupportForUserConsumeLimitDb.Set(0)
_, err = selfSupportForUserConsumeLimitDb.BatchAdd(mm)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}

e.OutSuc(c, resp, nil)
return
}

func SelfSupportForSchoolConsumeLimitList(c *gin.Context) {
var req md.SelfSupportForSchoolConsumeLimitListReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}

var classWithUserIdentityIdsOne []int
var classWithUserIdentityIdsTwo []int
classWithUserDb := db.ClassWithUserDb{}
classWithUserDb.Set()
if req.ClassId != 0 {
classWithUsers, err2 := classWithUserDb.FindUserIdentity(req.ClassId)
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}

for _, v := range *classWithUsers {
classWithUserIdentityIdsOne = append(classWithUserIdentityIdsOne, v.UserIdentityId)
}
}
if req.GradeId != 0 {
classDb := db.ClassDb{}
classDb.Set(req.GradeId)
classes, err3 := classDb.FindClass()
if err3 != nil {
e.OutErr(c, e.ERR, err3.Error())
return
}
var classesId []int
for _, v := range *classes {
classesId = append(classesId, v.Id)
}
classWithUsers, err4 := classWithUserDb.FindUserIdentity(classesId)
if err4 != nil {
e.OutErr(c, e.ERR, err4.Error())
return
}
for _, v := range *classWithUsers {
classWithUserIdentityIdsTwo = append(classWithUserIdentityIdsTwo, v.UserIdentityId)
}
}
sess := db.Db.Where("user_identity.enterprise_id =?", req.EnterpriseId).
Desc("self_support_for_user_consume_limit.id")
if req.IsTeacher != 0 {
if req.IsTeacher == 1 {
sess.And("user_identity.identity =?", enum.UserIdentityForCentralKitchenForTeacher)
}
if req.IsTeacher == 2 {
sess.And("user_identity.identity !=?", enum.UserIdentityForCentralKitchenForTeacher)
}
}
if req.DailyConsumeLimit != "" {
sess.And("self_support_for_user_consume_limit.daily_consume_limit = ?", req.DailyConsumeLimit)
}
if req.DailyConsumeLimitSwitch != "" {
sess.And("self_support_for_user_consume_limit.daily_consume_limit_switch = ?", req.DailyConsumeLimitSwitch)
}
if req.SingleConsumeLimit != "" {
sess.And("self_support_for_user_consume_limit.single_consume_limit = ?", req.SingleConsumeLimit)
}
if req.SingleConsumeLimitSwitch != "" {
sess.And("self_support_for_user_consume_limit.single_consume_limit_switch = ?", req.SingleConsumeLimitSwitch)
}
if req.DailyConsumeNumber != "" {
sess.And("self_support_for_user_consume_limit.daily_consume_number = ?", req.DailyConsumeNumber)
}
if req.DailyConsumeNumberSwitch != "" {
sess.And("self_support_for_user_consume_limit.daily_consume_number_switch = ?", req.DailyConsumeNumberSwitch)
}
if req.Name != "" {
sess.And("user_identity.name like ?", "%"+req.Name+"%")
}
if req.Phone != "" {
sess.And("user.phone like ?", "%"+req.Phone+"%")
}
if len(classWithUserIdentityIdsOne) > 0 {
sess.In("user_identity.id", classWithUserIdentityIdsOne)
}
if len(classWithUserIdentityIdsTwo) > 0 {
sess.In("user_identity.id", classWithUserIdentityIdsTwo)
}

var m []*db.SelfSupportForUserConsumeLimitWithUserIdentity
count, err := sess.
Join("LEFT", "self_support_for_user_consume_limit", "user_identity.id = self_support_for_user_consume_limit.user_identity_id").
Join("LEFT", "user", "user.id = user_identity.uid").
Join("LEFT", "class_with_user", "class_with_user.user_identity_id = user_identity.id").
Join("LEFT", "class", "class_with_user.class_id = class.id").
Join("LEFT", "grade", "class.grade_id = grade.id").
Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

var list []md.SelfSupportForSchoolConsumeLimitListResp
for _, v := range m {
var dailyConsumeLimitSwitch, singleConsumeLimitSwitch, dailyConsumeNumberSwitch = "off", "off", "off"
if v.SelfSupportForUserConsumeLimit.DailyConsumeLimitSwitch != "" {
dailyConsumeLimitSwitch = v.SelfSupportForUserConsumeLimit.DailyConsumeLimitSwitch
}
if v.SelfSupportForUserConsumeLimit.SingleConsumeLimitSwitch != "" {
singleConsumeLimitSwitch = v.SelfSupportForUserConsumeLimit.SingleConsumeLimitSwitch
}
if v.SelfSupportForUserConsumeLimit.DailyConsumeNumberSwitch != "" {
dailyConsumeNumberSwitch = v.SelfSupportForUserConsumeLimit.DailyConsumeNumberSwitch
}

list = append(list, md.SelfSupportForSchoolConsumeLimitListResp{
Name: v.UserIdentity.Name,
GradeId: v.Grade.Id,
GradeName: v.Grade.Name,
ClassId: v.Class.Id,
ClassName: v.Class.Name,
Phone: v.User.Phone,
DailyConsumeLimit: v.SelfSupportForUserConsumeLimit.DailyConsumeLimit,
DailyConsumeLimitSwitch: dailyConsumeLimitSwitch,
SingleConsumeLimit: v.SelfSupportForUserConsumeLimit.SingleConsumeLimit,
SingleConsumeLimitSwitch: singleConsumeLimitSwitch,
DailyConsumeNumber: v.SelfSupportForUserConsumeLimit.DailyConsumeNumber,
DailyConsumeNumberSwitch: dailyConsumeNumberSwitch,
})
}
e.OutSuc(c, map[string]interface{}{
"list": resp,
"total": total,
"enterprise_kind_list": md.EnterpriseKindForSchool,
"order_status_list": []map[string]interface{}{
"list": list,
"daily_consume_limit_switch_list": []map[string]string{
{
"name": enum.SelfSupportForSchoolOrdOrderStatus.String(enum.SelfSupportForSchoolOrdOrderStatusForWait),
"value": enum.SelfSupportForSchoolOrdOrderStatusForWait,
"name": "开启",
"value": "on",
},
{
"name": enum.SelfSupportForSchoolOrdOrderStatus.String(enum.SelfSupportForSchoolOrdOrderStatusForSuccess),
"value": enum.SelfSupportForSchoolOrdOrderStatusForSuccess,
"name": "关闭",
"value": "off",
},
},
"single_consume_limit_switch_list": []map[string]string{
{
"name": "开启",
"value": "on",
},
{
"name": "关闭",
"value": "off",
},
},
"daily_consume_number_switch_list": []map[string]string{
{
"name": "开启",
"value": "on",
},
{
"name": "关闭",
"value": "off",
},
},
"total": count,
}, nil)
return
}


+ 14
- 0
app/admin/hdl/hdl_user.go View File

@@ -77,6 +77,20 @@ func UserList(c *gin.Context) {
"value": enum.EnterpriseKindByNursingHome,
},
},
"user_identity_cert_type_list": []map[string]interface{}{
{
"name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForIdCard),
"value": enum.UserIdentityCertTypeForIdCard,
},
{
"name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForStudentId),
"value": enum.UserIdentityCertTypeForStudentId,
},
//{
// "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport),
// "value": enum.UserIdentityCertTypeForPassport,
//},
},
}, nil)
return
}


+ 58
- 4
app/admin/md/md_enterprise_manage.go View File

@@ -24,6 +24,7 @@ type EnterpriseUserListByCentralKitchenForSchoolStruct struct {
Id int `json:"id" label:"身份id"`
EnterpriseId int `json:"enterprise_id" label:"企业id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
SchoolName string `json:"school_name" label:"学校名"`
Name string `json:"name" label:"姓名"`
Grade string `json:"grade" label:"年级"`
@@ -34,9 +35,10 @@ type EnterpriseUserListByCentralKitchenForSchoolStruct struct {
}

type EnterpriseUserListByCentralKitchenForSchoolResp struct {
List []EnterpriseUserListByCentralKitchenForSchoolStruct `json:"list"`
Total int64 `json:"total"`
UserIdentityKindList interface{} `json:"user_identity_kind_list"`
List []EnterpriseUserListByCentralKitchenForSchoolStruct `json:"list"`
Total int64 `json:"total"`
UserIdentityKindList interface{} `json:"user_identity_kind_list"`
UserIdentityCertTypeList interface{} `json:"user_identity_cert_type_list"`
}

type CentralKitchenForSchoolUserUpdateReq struct {
@@ -47,6 +49,7 @@ type CentralKitchenForSchoolUserUpdateReq struct {
BindUserIdentities []struct {
UserIdentityId int `json:"user_identity_id" label:"用户身份id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
Name string `json:"name" label:"姓名"`
GradeId int `json:"grade_id" label:"年级"`
ClassId int `json:"class_id" label:"班级"`
@@ -61,6 +64,7 @@ type CentralKitchenForSchoolUserUpdateReqV2 struct {
EnterpriseId int `json:"enterprise_id" label:"企业id"`
UserIdentityId int `json:"user_identity_id" label:"用户身份id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
Name string `json:"name" label:"姓名"`
GradeId int `json:"grade_id" label:"年级"`
ClassId int `json:"class_id" label:"班级"`
@@ -93,6 +97,7 @@ type CentralKitchenForSchoolTeacherListReq struct {

type CentralKitchenForSchoolStudentListResp struct {
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
ParentPhone string `json:"parent_phone" label:"家长电话"`
Name string `json:"name" label:"姓名"`
Grade string `json:"grade" label:"年级"`
@@ -113,6 +118,7 @@ type CentralKitchenForSchoolTeacherUpdateReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
UserIdentityId int `json:"user_identity_id" binding:"required" label:"用户身份id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
Name string `json:"name" label:"姓名"`
}

@@ -300,6 +306,7 @@ type SelfSupportForSchoolUserUpdateReq struct {
BindUserIdentities []struct {
UserIdentityId int `json:"user_identity_id" label:"用户身份id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
Name string `json:"name" label:"姓名"`
GradeId int `json:"grade_id" label:"年级"`
ClassId int `json:"class_id" label:"班级"`
@@ -323,7 +330,8 @@ type SelfSupportForSchoolStudentListReq struct {
}

type SelfSupportForSchoolStudentListResp struct {
IdNo string `json:"id_no" label:"身份证号"`
IdNo string `json:"id_no" label:"证件号"`
CertType int `json:"cert_type" label:"证件类型"`
ParentPhone string `json:"parent_phone" label:"家长电话"`
Name string `json:"name" label:"姓名"`
Grade string `json:"grade" label:"年级"`
@@ -347,6 +355,7 @@ type SelfSupportForSchoolTeacherListReq struct {
type SelfSupportForSchoolTeacherListResp struct {
UserIdentityId int `json:"user_identity_id" label:"用户身份id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
Phone string `json:"parent_phone" label:"电话"`
Name string `json:"name" label:"姓名"`
CollectFaceType int `json:"collect_face_type" label:"采集人脸方式(1:个采 2:集采) "`
@@ -389,6 +398,7 @@ type SelfSupportForSchoolTeacherUpdateReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
UserIdentityId int `json:"user_identity_id" binding:"required" label:"用户身份id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
Name string `json:"name" label:"姓名"`
CollectFaceType int `json:"collect_face_type" label:"采集人脸方式(1:个采 2:集采)"`
}
@@ -409,6 +419,7 @@ type SelfSupportForSchoolWorkerListReq struct {
type SelfSupportForSchoolWorkerListResp struct {
UserIdentityId int `json:"user_identity_id" label:"用户身份id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
Phone string `json:"parent_phone" label:"电话"`
Name string `json:"name" label:"姓名"`
CreateAt string `json:"create_at" label:"创建时间"`
@@ -466,6 +477,7 @@ type SelfSupportForSchoolAddTeacherReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Name string `json:"name" label:"名称"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
}

type SelfSupportForSchoolOrdListReq struct {
@@ -484,6 +496,48 @@ type SelfSupportForSchoolOrdListReq struct {
IsTeacher int `json:"is_teacher" label:"是否教师"`
}

type SelfSupportForSchoolConsumeLimitReq struct {
UserIdentityId int `json:"user_identity_id" label:"用户身份id"`
DailyConsumeLimit string `json:"daily_consume_limit" label:"单日金额上限"`
DailyConsumeLimitSwitch string `json:"daily_consume_limit_switch" label:"单日金额上限 功能开关"`
SingleConsumeLimit string `json:"single_consume_limit" label:"单笔金额上限"`
SingleConsumeLimitSwitch string `json:"single_consume_limit_switch" label:"单笔金额上限 功能开关"`
DailyConsumeNumber string `json:"daily_consume_number" label:"单日笔数上限"`
DailyConsumeNumberSwitch string `json:"daily_consume_number_switch" label:"单日笔数上限 功能开关"`
}

type SelfSupportForSchoolConsumeLimitListReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Limit int `json:"limit" binding:"required"`
Page int `json:"page" binding:"required"`
Name string `json:"name" label:"姓名"`
GradeId int `json:"grade_id" label:"年级id"`
ClassId int `json:"class_id" label:"班级id"`
Phone string `json:"phone" label:"用户电话"`
DailyConsumeLimit string `json:"daily_consume_limit" label:"单日金额上限"`
DailyConsumeLimitSwitch string `json:"daily_consume_limit_switch" label:"单日金额上限 功能开关"`
SingleConsumeLimit string `json:"single_consume_limit" label:"单笔金额上限"`
SingleConsumeLimitSwitch string `json:"single_consume_limit_switch" label:"单笔金额上限 功能开关"`
DailyConsumeNumber string `json:"daily_consume_number" label:"单日笔数上限"`
DailyConsumeNumberSwitch string `json:"daily_consume_number_switch" label:"单日笔数上限 功能开关"`
IsTeacher int `json:"is_teacher" label:"是否教师"`
}

type SelfSupportForSchoolConsumeLimitListResp struct {
Name string `json:"name" label:"姓名"`
GradeId int `json:"grade_id" label:"年级id"`
GradeName string `json:"grade_name" label:"年级名称"`
ClassId int `json:"class_id" label:"班级id"`
ClassName string `json:"class_name" label:"班级名称"`
Phone string `json:"phone" label:"用户电话"`
DailyConsumeLimit string `json:"daily_consume_limit" label:"单日金额上限"`
DailyConsumeLimitSwitch string `json:"daily_consume_limit_switch" label:"单日金额上限 功能开关"`
SingleConsumeLimit string `json:"single_consume_limit" label:"单笔金额上限"`
SingleConsumeLimitSwitch string `json:"single_consume_limit_switch" label:"单笔金额上限 功能开关"`
DailyConsumeNumber string `json:"daily_consume_number" label:"单日笔数上限"`
DailyConsumeNumberSwitch string `json:"daily_consume_number_switch" label:"单日笔数上限 功能开关"`
}

type SelfSupportForSchoolArrearsOrdListReq struct {
EnterpriseId int `json:"enterprise_id" label:"企业id"`
EnterpriseKind int `json:"enterprise_kind" label:"企业类型"`


+ 1
- 0
app/admin/md/md_user.go View File

@@ -22,6 +22,7 @@ type UserList struct {
BindUserIdentity []struct {
Id int `json:"id" label:"id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
Name string `json:"name" label:"姓名"`
EnterpriseName string `json:"enterprise_name" label:"企业名"`
EnterpriseKind int32 `json:"enterprise_kind" label:"企业类型"`


+ 7
- 0
app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go View File

@@ -51,6 +51,7 @@ func CentralKitchenForSchoolUserUpdate(req md.CentralKitchenForSchoolUserUpdateR
Uid: req.Uid,
Name: v.Name,
IdNo: v.IdNo,
CertType: v.CertType,
Kind: enum2.UserIdentityKindForCommon,
Identity: enum2.UserIdentityForCentralKitchenForTeacher,
EnterpriseId: req.EnterpriseId,
@@ -70,6 +71,7 @@ func CentralKitchenForSchoolUserUpdate(req md.CentralKitchenForSchoolUserUpdateR
Uid: req.Uid,
Name: v.Name,
IdNo: v.IdNo,
CertType: v.CertType,
Kind: enum2.UserIdentityKindForCommon,
Identity: enum2.UserIdentityForCentralKitchenForStudent,
EnterpriseId: req.EnterpriseId,
@@ -107,6 +109,7 @@ func CentralKitchenForSchoolUserUpdate(req md.CentralKitchenForSchoolUserUpdateR
return errors.New("未查询到对应的身份信息记录")
}
identity.IdNo = v.IdNo
identity.CertType = v.CertType
identity.Name = v.Name
if v.ClassId == -1 {
//TODO::为老师身份
@@ -185,6 +188,7 @@ func CentralKitchenForSchoolUserUpdateV2(req md.CentralKitchenForSchoolUserUpdat
Uid: req.Uid,
Name: v.Name,
IdNo: v.IdNo,
CertType: v.CertType,
Kind: enum2.UserIdentityKindForCommon,
Identity: enum2.UserIdentityForCentralKitchenForTeacher,
EnterpriseId: v.EnterpriseId,
@@ -204,6 +208,7 @@ func CentralKitchenForSchoolUserUpdateV2(req md.CentralKitchenForSchoolUserUpdat
Uid: req.Uid,
Name: v.Name,
IdNo: v.IdNo,
CertType: v.CertType,
Kind: enum2.UserIdentityKindForCommon,
Identity: enum2.UserIdentityForCentralKitchenForStudent,
EnterpriseId: v.EnterpriseId,
@@ -242,6 +247,7 @@ func CentralKitchenForSchoolUserUpdateV2(req md.CentralKitchenForSchoolUserUpdat
}
identity.EnterpriseId = v.EnterpriseId
identity.IdNo = v.IdNo
identity.CertType = v.CertType
identity.Name = v.Name
if v.ClassId == -1 {
//TODO::为老师身份
@@ -393,6 +399,7 @@ func CentralKitchenForSchoolStudentList(req md.CentralKitchenForSchoolStudentLis
for _, v := range m {
resp = append(resp, md.CentralKitchenForSchoolStudentListResp{
IdNo: v.UserIdentity.IdNo,
CertType: v.UserIdentity.CertType,
ParentPhone: v.User.Phone,
Name: v.UserIdentity.Name,
Grade: v.Grade.Name,


+ 63
- 4
app/admin/svc/enterprise_manage/svc_enterprise_manage.go View File

@@ -71,13 +71,14 @@ func EnterpriseUserListByCentralKitchenForSchool(req md.EnterpriseUserListReq) (
Id int `json:"id" label:"身份id"`
EnterpriseId int `json:"enterprise_id" label:"企业id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
SchoolName string `json:"school_name" label:"学校名"`
Name string `json:"name" label:"姓名"`
Grade string `json:"grade" label:"年级"`
GradeId int `json:"grade_id" label:"年级id"`
Class string `json:"class" label:"班级"`
ClassId int `json:"class_id" label:"班级id"`
}{Id: v1.Id, EnterpriseId: v1.EnterpriseId, IdNo: v1.IdNo, SchoolName: "教师", Name: v1.Name, Grade: "教师", Class: "教师", GradeId: -1, ClassId: -1})
}{Id: v1.Id, EnterpriseId: v1.EnterpriseId, IdNo: v1.IdNo, CertType: v1.CertType, SchoolName: "教师", Name: v1.Name, Grade: "教师", Class: "教师", GradeId: -1, ClassId: -1})
temp.IsTeacher = 1
} else {
data, err2 := classWithUserDb.GetInfoByUserIdentityId(v1.Id)
@@ -91,17 +92,59 @@ func EnterpriseUserListByCentralKitchenForSchool(req md.EnterpriseUserListReq) (
Id int `json:"id" label:"身份id"`
EnterpriseId int `json:"enterprise_id" label:"企业id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
SchoolName string `json:"school_name" label:"学校名"`
Name string `json:"name" label:"姓名"`
Grade string `json:"grade" label:"年级"`
GradeId int `json:"grade_id" label:"年级id"`
Class string `json:"class" label:"班级"`
ClassId int `json:"class_id" label:"班级id"`
}{Id: v1.Id, EnterpriseId: v1.EnterpriseId, IdNo: data.UserIdentity.IdNo, SchoolName: data.Enterprise.Name, Name: data.UserIdentity.Name, Grade: data.Grade.Name, Class: data.Class.Name, GradeId: data.Grade.Id, ClassId: data.Class.Id})
}{Id: v1.Id, EnterpriseId: v1.EnterpriseId, IdNo: data.UserIdentity.IdNo, CertType: data.UserIdentity.CertType, SchoolName: data.Enterprise.Name, Name: data.UserIdentity.Name, Grade: data.Grade.Name, Class: data.Class.Name, GradeId: data.Grade.Id, ClassId: data.Class.Id})
}
}
resp.List = append(resp.List, temp)
}

resp.UserIdentityKindList = []map[string]interface{}{
{
"name": enum2.UserIdentity.String(enum2.UserIdentityForCentralKitchenForStudent),
"value": enum2.UserIdentityForCentralKitchenForStudent,
},
{
"name": enum2.UserIdentity.String(enum2.UserIdentityForCentralKitchenForTeacher),
"value": enum2.UserIdentityForCentralKitchenForTeacher,
},
{
"name": enum2.UserIdentity.String(enum2.UserIdentityForCentralKitchenForWorker),
"value": enum2.UserIdentityForCentralKitchenForWorker,
},
{
"name": enum2.UserIdentity.String(enum2.UserIdentityForSelfSupportForStudent),
"value": enum2.UserIdentityForSelfSupportForStudent,
},
{
"name": enum2.UserIdentity.String(enum2.UserIdentityForSelfSupportForTeacher),
"value": enum2.UserIdentityForSelfSupportForTeacher,
},
{
"name": enum2.UserIdentity.String(enum2.UserIdentityForSelfSupportForWorker),
"value": enum2.UserIdentityForSelfSupportForWorker,
},
}
resp.UserIdentityCertTypeList = []map[string]interface{}{
{
"name": enum2.UserIdentityCertType.String(enum2.UserIdentityCertTypeForIdCard),
"value": enum2.UserIdentityCertTypeForIdCard,
},
{
"name": enum2.UserIdentityCertType.String(enum2.UserIdentityCertTypeForStudentId),
"value": enum2.UserIdentityCertTypeForStudentId,
},
//{
// "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport),
// "value": enum.UserIdentityCertTypeForPassport,
//},
}
return
}

@@ -217,13 +260,14 @@ func EnterpriseUserListByCentralKitchenForSchoolV2(req md.EnterpriseUserListReq)
Id int `json:"id" label:"身份id"`
EnterpriseId int `json:"enterprise_id" label:"企业id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
SchoolName string `json:"school_name" label:"学校名"`
Name string `json:"name" label:"姓名"`
Grade string `json:"grade" label:"年级"`
GradeId int `json:"grade_id" label:"年级id"`
Class string `json:"class" label:"班级"`
ClassId int `json:"class_id" label:"班级id"`
}{Id: v1.UserIdentity.Id, EnterpriseId: v1.UserIdentity.EnterpriseId, IdNo: v1.IdNo, SchoolName: v1.Enterprise.Name, Name: v1.UserIdentity.Name, Grade: "教师", Class: "教师", GradeId: -1, ClassId: -1})
}{Id: v1.UserIdentity.Id, EnterpriseId: v1.UserIdentity.EnterpriseId, IdNo: v1.IdNo, CertType: v1.CertType, SchoolName: v1.Enterprise.Name, Name: v1.UserIdentity.Name, Grade: "教师", Class: "教师", GradeId: -1, ClassId: -1})
temp.IsTeacher = 1
}
if v1.Identity == enum2.UserIdentityForCentralKitchenForStudent {
@@ -231,13 +275,14 @@ func EnterpriseUserListByCentralKitchenForSchoolV2(req md.EnterpriseUserListReq)
Id int `json:"id" label:"身份id"`
EnterpriseId int `json:"enterprise_id" label:"企业id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
SchoolName string `json:"school_name" label:"学校名"`
Name string `json:"name" label:"姓名"`
Grade string `json:"grade" label:"年级"`
GradeId int `json:"grade_id" label:"年级id"`
Class string `json:"class" label:"班级"`
ClassId int `json:"class_id" label:"班级id"`
}{Id: v1.UserIdentity.Id, EnterpriseId: v1.UserIdentity.EnterpriseId, IdNo: v1.UserIdentity.IdNo, SchoolName: v1.Enterprise.Name, Name: v1.UserIdentity.Name, Grade: v1.Grade.Name, Class: v1.Class.Name, GradeId: v1.Grade.Id, ClassId: v1.Class.Id})
}{Id: v1.UserIdentity.Id, EnterpriseId: v1.UserIdentity.EnterpriseId, IdNo: v1.UserIdentity.IdNo, CertType: v1.UserIdentity.CertType, SchoolName: v1.Enterprise.Name, Name: v1.UserIdentity.Name, Grade: v1.Grade.Name, Class: v1.Class.Name, GradeId: v1.Grade.Id, ClassId: v1.Class.Id})
}
}
resp.List = append(resp.List, temp)
@@ -268,6 +313,20 @@ func EnterpriseUserListByCentralKitchenForSchoolV2(req md.EnterpriseUserListReq)
"value": enum2.UserIdentityForSelfSupportForWorker,
},
}
resp.UserIdentityCertTypeList = []map[string]interface{}{
{
"name": enum2.UserIdentityCertType.String(enum2.UserIdentityCertTypeForIdCard),
"value": enum2.UserIdentityCertTypeForIdCard,
},
{
"name": enum2.UserIdentityCertType.String(enum2.UserIdentityCertTypeForStudentId),
"value": enum2.UserIdentityCertTypeForStudentId,
},
//{
// "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport),
// "value": enum.UserIdentityCertTypeForPassport,
//},
}
return
}



+ 8
- 1
app/admin/svc/enterprise_manage/svc_self_support_for_school.go View File

@@ -59,6 +59,7 @@ func SelfSupportForSchoolUserUpdate(req md.SelfSupportForSchoolUserUpdateReq) (e
Uid: req.Uid,
Name: v.Name,
IdNo: v.IdNo,
CertType: v.CertType,
Kind: enum2.UserIdentityKindForCommon,
Identity: enum2.UserIdentityForSelfSupportForTeacher,
EnterpriseId: req.EnterpriseId,
@@ -80,6 +81,7 @@ func SelfSupportForSchoolUserUpdate(req md.SelfSupportForSchoolUserUpdateReq) (e
Uid: req.Uid,
Name: v.Name,
IdNo: v.IdNo,
CertType: v.CertType,
Kind: enum2.UserIdentityKindForWorker,
Identity: enum2.UserIdentityForSelfSupportForWorker,
EnterpriseId: req.EnterpriseId,
@@ -99,6 +101,7 @@ func SelfSupportForSchoolUserUpdate(req md.SelfSupportForSchoolUserUpdateReq) (e
Uid: req.Uid,
Name: v.Name,
IdNo: v.IdNo,
CertType: v.CertType,
Kind: enum2.UserIdentityKindForCommon,
Identity: enum2.UserIdentityForSelfSupportForStudent,
EnterpriseId: req.EnterpriseId,
@@ -156,6 +159,7 @@ func SelfSupportForSchoolUserUpdate(req md.SelfSupportForSchoolUserUpdateReq) (e
return errors.New("未查询到对应的身份信息记录")
}
identity.IdNo = v.IdNo
identity.CertType = v.CertType
identity.Name = v.Name
if v.ClassId == -1 {
//TODO::为老师身份
@@ -175,7 +179,7 @@ func SelfSupportForSchoolUserUpdate(req md.SelfSupportForSchoolUserUpdateReq) (e
return err3
}
}
_, err3 := userIdentityDb.UserIdentityUpdateBySession(session, v.UserIdentityId, identity, "id_no", "name", "identity")
_, err3 := userIdentityDb.UserIdentityUpdateBySession(session, v.UserIdentityId, identity, "id_no", "cert_type", "name", "identity")
if err3 != nil {
_ = session.Rollback()
return err3
@@ -297,6 +301,7 @@ func SelfSupportForSchoolStudentList(req md.SelfSupportForSchoolStudentListReq)
for _, v := range m {
resp = append(resp, md.SelfSupportForSchoolStudentListResp{
IdNo: v.UserIdentity.IdNo,
CertType: v.UserIdentity.CertType,
ParentPhone: v.User.Phone,
Name: v.UserIdentity.Name,
Grade: v.Grade.Name,
@@ -345,6 +350,7 @@ func SelfSupportForSchoolTeacherList(req md.SelfSupportForSchoolTeacherListReq)
resp = append(resp, md.SelfSupportForSchoolTeacherListResp{
UserIdentityId: v.UserIdentity.Id,
IdNo: v.UserIdentity.IdNo,
CertType: v.UserIdentity.CertType,
Phone: v.User.Phone,
Name: v.UserIdentity.Name,
CollectFaceType: v.SelfSupportForUserFaceInfo.CollectFaceType,
@@ -497,6 +503,7 @@ func SelfSupportForSchoolWorkerList(req md.SelfSupportForSchoolWorkerListReq) (r
resp = append(resp, md.SelfSupportForSchoolWorkerListResp{
UserIdentityId: v.UserIdentity.Id,
IdNo: v.UserIdentity.IdNo,
CertType: v.UserIdentity.CertType,
Phone: v.User.Phone,
Name: v.UserIdentity.Name,
CreateAt: v.UserIdentity.CreateAt,


+ 3
- 1
app/admin/svc/svc_user.go View File

@@ -50,11 +50,12 @@ func UserList(req md.UserListReq) (resp md.UserListResp, err error) {
temp.BindUserIdentity = append(temp.BindUserIdentity, struct {
Id int `json:"id" label:"id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型"`
Name string `json:"name" label:"姓名"`
EnterpriseName string `json:"enterprise_name" label:"企业名"`
EnterpriseKind int32 `json:"enterprise_kind" label:"企业类型"`
Kind int `json:"kind" label:"身份类型"`
}{Id: v1.UserIdentity.Id, IdNo: v1.UserIdentity.IdNo, Name: v1.UserIdentity.Name, EnterpriseName: v1.Enterprise.Name, EnterpriseKind: v1.Enterprise.Kind, Kind: v1.UserIdentity.Kind})
}{Id: v1.UserIdentity.Id, IdNo: v1.UserIdentity.IdNo, CertType: v1.UserIdentity.CertType, Name: v1.UserIdentity.Name, EnterpriseName: v1.Enterprise.Name, EnterpriseKind: v1.Enterprise.Kind, Kind: v1.UserIdentity.Kind})
}
resp.List = append(resp.List, temp)
}
@@ -86,6 +87,7 @@ func UserUpdate(req md.UserList) (err error) {
}
identity.Name = v.Name
identity.IdNo = v.IdNo
identity.CertType = v.CertType
_, err2 := userIdentityDb.UserIdentityUpdate(identity.Id, identity, "name", "id_no")
if err2 != nil {
err = err2


+ 0
- 14
app/customer/hdl/hdl_user.go View File

@@ -166,20 +166,6 @@ func UserInfo(c *gin.Context) {
"value": enum.UserIdentityForSelfSupportForWorker,
},
},
"user_identity_cert_type_list": []map[string]interface{}{
{
"name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForIdCard),
"value": enum.UserIdentityCertTypeForIdCard,
},
{
"name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForStudentId),
"value": enum.UserIdentityCertTypeForStudentId,
},
//{
// "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport),
// "value": enum.UserIdentityCertTypeForPassport,
//},
},
}, nil)
return
}

+ 15
- 13
app/customer/md/md_curl_smart_pay.go View File

@@ -152,17 +152,19 @@ type CurlAlipayPlanetEcocampusApiDebtCancel struct {
}

type CurlAlipayPlanetEcocampusApiRosterConsumeLimit struct {
ConsumeLimitSyncInfo struct {
FaceUid string `json:"face_uid" label:"学生刷脸编号"`
OutRosterCode string `json:"out_roster_code" label:"外部花名册编号"`
RosterName string `json:"roster_name" label:"花名册名称"`
DailyConsumeLimit string `json:"daily_consume_limit" label:"单日金额上限"`
DailyConsumeLimitSwitch string `json:"daily_consume_limit_switch" label:"单日金额上限 功能开关"`
SingleConsumeLimit string `json:"single_consume_limit" label:"单笔金额上限"`
SingleConsumeLimitSwitch string `json:"single_consume_limit_switch" label:"单笔金额上限 功能开关"`
DailyConsumeNumber string `json:"daily_consume_number" label:"单日笔数上限"`
DailyConsumeNumberSwitch string `json:"daily_consume_number_switch" label:"单日笔数上限 功能开关"`
} `json:"consume_limit_sync_info" label:"外部订单号"`
SchoolCode string `json:"school_code" label:"学校内标"`
SchoolName string `json:"school_name" label:"学校名称"`
ConsumeLimitSyncInfo []ConsumeLimitSyncInfo `json:"consume_limit_sync_info" label:"外部订单号"`
SchoolCode string `json:"school_code" label:"学校内标"`
SchoolName string `json:"school_name" label:"学校名称"`
}

type ConsumeLimitSyncInfo struct {
FaceUid string `json:"face_uid" label:"学生刷脸编号"`
OutRosterCode string `json:"out_roster_code" label:"外部花名册编号"`
RosterName string `json:"roster_name" label:"花名册名称"`
DailyConsumeLimit string `json:"daily_consume_limit" label:"单日金额上限"`
DailyConsumeLimitSwitch string `json:"daily_consume_limit_switch" label:"单日金额上限 功能开关"`
SingleConsumeLimit string `json:"single_consume_limit" label:"单笔金额上限"`
SingleConsumeLimitSwitch string `json:"single_consume_limit_switch" label:"单笔金额上限 功能开关"`
DailyConsumeNumber string `json:"daily_consume_number" label:"单日笔数上限"`
DailyConsumeNumberSwitch string `json:"daily_consume_number_switch" label:"单日笔数上限 功能开关"`
}

+ 89
- 0
app/db/db_self_support_for_user_face_info.go.go View File

@@ -0,0 +1,89 @@
package db

import (
"applet/app/db/model"
"applet/app/utils/logx"
"reflect"
"xorm.io/xorm"
)

type SelfSupportForUserConsumeLimitDb struct {
Db *xorm.Engine `json:"db"`
UserIdentityId int `json:"user_identity_id"`
}

func (selfSupportForUserConsumeLimitDb *SelfSupportForUserConsumeLimitDb) Set(userIdentityId int) { // set方法
selfSupportForUserConsumeLimitDb.Db = Db
selfSupportForUserConsumeLimitDb.UserIdentityId = userIdentityId
}

func (selfSupportForUserConsumeLimitDb *SelfSupportForUserConsumeLimitDb) GetSelfSupportForUserConsumeLimit() (m *model.SelfSupportForUserConsumeLimit, err error) {
m = new(model.SelfSupportForUserConsumeLimit)
has, err := selfSupportForUserConsumeLimitDb.Db.Where("user_identity_id =?", selfSupportForUserConsumeLimitDb.UserIdentityId).Get(m)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (selfSupportForUserConsumeLimitDb *SelfSupportForUserConsumeLimitDb) FindSelfSupportForUserConsumeLimit(limit, start int) (*[]model.SelfSupportForUserConsumeLimit, error) {
var m []model.SelfSupportForUserConsumeLimit
if limit == 0 || start == 0 {
if err := selfSupportForUserConsumeLimitDb.Db.Desc("id").Find(&m); err != nil {
return nil, logx.Error(err)
}
} else {
if err := selfSupportForUserConsumeLimitDb.Db.Desc("id").Limit(limit, start).Find(m); err != nil {
return nil, logx.Error(err)
}
}
return &m, nil
}

func (selfSupportForUserConsumeLimitDb *SelfSupportForUserConsumeLimitDb) SelfSupportForUserConsumeLimitInsert(m *model.SelfSupportForUserConsumeLimit) (int, error) {
_, err := selfSupportForUserConsumeLimitDb.Db.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (selfSupportForUserConsumeLimitDb *SelfSupportForUserConsumeLimitDb) SelfSupportForUserConsumeLimitUpdate(m *model.SelfSupportForUserConsumeLimit, columns ...string) (int64, error) {
affected, err := selfSupportForUserConsumeLimitDb.Db.Where("id =?", m.Id).Cols(columns...).Update(m)
if err != nil {
return 0, err
}
return affected, nil
}

func (selfSupportForUserConsumeLimitDb *SelfSupportForUserConsumeLimitDb) SelfSupportForUserConsumeLimitDelete(id interface{}) (int64, error) {
if reflect.TypeOf(id).Kind() == reflect.Slice {
return Db.In("id", id).Delete(model.SelfSupportForUserConsumeLimit{})
} else {
return Db.Where("id = ?", id).Delete(model.SelfSupportForUserConsumeLimit{})
}
}

func (selfSupportForUserConsumeLimitDb *SelfSupportForUserConsumeLimitDb) BatchAdd(mm []*model.SelfSupportForUserConsumeLimit) (int64, error) {
affected, err := selfSupportForUserConsumeLimitDb.Db.Insert(mm)
if err != nil {
return 0, err
}
return affected, nil
}

type SelfSupportForUserConsumeLimitWithUserIdentity struct {
model.UserIdentity `xorm:"extends"`
model.SelfSupportForUserConsumeLimit `xorm:"extends"`
model.User `xorm:"extends"`
model.ClassWithUser `xorm:"extends"`
model.Class `xorm:"extends"`
model.Grade `xorm:"extends"`
}

func (SelfSupportForUserConsumeLimitWithUserIdentity) TableName() string {
return "user_identity"
}

+ 15
- 0
app/db/model/self_support_for_user_consume_limit.go View File

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

type SelfSupportForUserConsumeLimit 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)"`
DailyConsumeLimit string `json:"daily_consume_limit" xorm:"not null default '' comment('单日金额上限') CHAR(50)"`
DailyConsumeLimitSwitch string `json:"daily_consume_limit_switch" xorm:"not null default '' comment('单日金额上限 功能开关') CHAR(50)"`
SingleConsumeLimit string `json:"single_consume_limit" xorm:"not null default '' comment('单笔金额上限') CHAR(50)"`
SingleConsumeLimitSwitch string `json:"single_consume_limit_switch" xorm:"not null default '' comment('单日金额上限 功能开关') CHAR(50)"`
DailyConsumeNumber string `json:"daily_consume_number" xorm:"not null default '' comment('单日笔数上限') CHAR(50)"`
DailyConsumeNumberSwitch string `json:"daily_consume_number_switch" xorm:"not null default '' comment('单日笔数上限 功能开关') CHAR(50)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

+ 13
- 0
app/enum/enum_user_identity.go View File

@@ -89,3 +89,16 @@ func (gt UserIdentityCertType) String() string {
return "未知"
}
}

func (gt UserIdentityCertType) Format() string {
switch gt {
case UserIdentityCertTypeForIdCard:
return "1"
case UserIdentityCertTypeForStudentId:
return "X"
case UserIdentityCertTypeForPassport:
return "Y"
default:
return ""
}
}

+ 2
- 1
app/router/admin_router.go View File

@@ -221,7 +221,8 @@ func rEnterpriseManage(r *gin.RouterGroup) {
r.GET("/selfSupportForSchool/downloadTemplateExcel", hdl.SelfSupportForSchoolDownloadTemplateExcel) //"自营-学校"下载表格模板
r.POST("/selfSupportForSchool/ordList", hdl.SelfSupportForSchoolOrdList) //"自营-学校"订单列表
r.Any("/selfSupportForSchool/ordListExport", hdl.SelfSupportForSchoolOrdListExport) //"自营-学校"订单列表-导出
r.Any("/selfSupportForSchool/consumeLimit", hdl.SelfSupportForSchoolConsumeLimit) //"自营-学校"消费限制
r.POST("/selfSupportForSchool/consumeLimit", hdl.SelfSupportForSchoolConsumeLimit) //"自营-学校"消费限制-编辑
r.POST("/selfSupportForSchool/consumeLimitList", hdl.SelfSupportForSchoolConsumeLimitList) //"自营-学校"消费限制-列表
r.POST("/selfSupportForSchool/arrearsOrdList", hdl.SelfSupportForSchoolArrearsOrdList) //"自营-学校"订单欠费列表
r.POST("/selfSupportForSchool/blackList", hdl.SelfSupportForSchoolBlackList) //"自营-学校"黑名单列表
r.POST("/selfSupportForSchool/arrearsOrdDebtRepay", hdl.SelfSupportForSchoolArrearsOrdDebtRepay) //"自营-学校"订单欠费催缴


Loading…
Cancel
Save