DengBiao преди 1 година
родител
ревизия
d41524ef18
променени са 49 файла, в които са добавени 1842 реда и са изтрити 326 реда
  1. +34
    -3
      app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go
  2. +25
    -32
      app/admin/hdl/enterprise_manage/hdl_enterprise.go
  3. +359
    -11
      app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go
  4. +18
    -4
      app/admin/hdl/hdl_data_statistics.go
  5. +20
    -39
      app/admin/hdl/hdl_enterprise.go
  6. +4
    -4
      app/admin/hdl/hdl_home_page.go
  7. +25
    -3
      app/admin/hdl/hdl_set_center.go
  8. +24
    -10
      app/admin/hdl/hdl_user.go
  9. +2
    -0
      app/admin/md/md_central_kitchen_for_school.go
  10. +3
    -0
      app/admin/md/md_central_kitchen_for_school_export_records.go
  11. +60
    -4
      app/admin/md/md_enterprise.go
  12. +114
    -52
      app/admin/md/md_enterprise_manage.go
  13. +0
    -3
      app/admin/md/md_enterprise_v2.go
  14. +2
    -0
      app/admin/md/md_self_support_for_school.go
  15. +5
    -2
      app/admin/md/md_set_center.go
  16. +1
    -0
      app/admin/md/md_user.go
  17. +15
    -0
      app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go
  18. +63
    -4
      app/admin/svc/enterprise_manage/svc_enterprise_manage.go
  19. +17
    -3
      app/admin/svc/enterprise_manage/svc_self_support_for_school.go
  20. +3
    -1
      app/admin/svc/svc_central_kitchen_for_school.go
  21. +484
    -21
      app/admin/svc/svc_data_statisstics.go
  22. +6
    -0
      app/admin/svc/svc_enterprise.go
  23. +1
    -1
      app/admin/svc/svc_nursing_home.go
  24. +3
    -1
      app/admin/svc/svc_self_support_for_school.go
  25. +3
    -1
      app/admin/svc/svc_user.go
  26. +38
    -24
      app/customer/hdl/hdl_enterprise.go
  27. +63
    -0
      app/customer/hdl/hdl_login.go
  28. +77
    -69
      app/customer/hdl/hdl_user.go
  29. +10
    -2
      app/customer/hdl/hdl_user_identity.go
  30. +30
    -0
      app/customer/hdl/self_support_for_school/hdl_faceCollection.go
  31. +20
    -0
      app/customer/md/md_curl_smart_pay.go
  32. +1
    -0
      app/customer/md/md_user_identity.go
  33. +20
    -6
      app/customer/svc/order/svc_central_kitchen_for_school_order.go
  34. +33
    -3
      app/customer/svc/svc_curl_smart_pay.go
  35. +5
    -1
      app/customer/svc/svc_enterprise.go
  36. +40
    -2
      app/db/db_central_kitchen_for_school_user_with_day.go
  37. +9
    -0
      app/db/db_self_support_for_school_ord.go
  38. +89
    -0
      app/db/db_self_support_for_user_face_info.go.go
  39. +2
    -2
      app/db/db_user_identity.go
  40. +2
    -1
      app/db/model/enterprise.go
  41. +1
    -0
      app/db/model/self_support_for_school_info.go
  42. +15
    -0
      app/db/model/self_support_for_user_consume_limit.go
  43. +1
    -0
      app/db/model/user_identity.go
  44. +51
    -12
      app/enum/enum_enterprise.go
  45. +34
    -0
      app/enum/enum_user_identity.go
  46. +6
    -2
      app/router/admin_router.go
  47. +4
    -3
      app/router/customer_router.go
  48. Двоични данни
     
  49. Двоични данни
     

+ 34
- 3
app/admin/hdl/enterprise_manage/hdl_central_kitchen_for_school.go Целия файл

@@ -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
@@ -795,8 +824,9 @@ func CentralKitchenForSchoolOrdList(c *gin.Context) {
return
}
e.OutSuc(c, map[string]interface{}{
"list": resp,
"total": total,
"list": resp,
"total": total,
"enterprise_kind_list": md.EnterpriseKindForSchool,
"kind_list": []map[string]string{
{
"name": "按学期购买",
@@ -917,6 +947,7 @@ func CentralKitchenForSchoolReserveList(c *gin.Context) {
"value": enum.CentralKitchenForSchoolUserWithDayKindForDinner,
},
},
"enterprise_kind_list": md.EnterpriseKindForSchool,
}, nil)
return
}


+ 25
- 32
app/admin/hdl/enterprise_manage/hdl_enterprise.go Целия файл

@@ -25,56 +25,53 @@ func EnterpriseManageInfo(c *gin.Context) {
e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
return
}

var resp interface{}
switch enterprise.Kind {
case enum.EnterprisePvdByCentralKitchenForSchool:
//判断校企类型
if enterprise.Pvd == enum.EnterprisePvdForOnlinePayment && enterprise.Mode == enum.EnterpriseModeForSchool {
err, resp = svc.CentralKitchenForSchoolInfo(utils.StrToInt(enterpriseId))
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
break
case enum.EnterprisePvdByCentralKitchenForFactory:
break
case enum.EnterprisePvdBySelfSupportForSchool:
}
if enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && enterprise.Mode == enum.EnterpriseModeForSchool {
err, resp = svc.SelfSupportForSchoolInfo(utils.StrToInt(enterpriseId))
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
break
case enum.EnterprisePvdBySelfSupportForFactory:
break
case enum.EnterprisePvdByNursingHome:
}
if enterprise.Kind == enum.EnterpriseKindByNursingHome {
err, resp = svc.NursingHomeInfo(utils.StrToInt(enterpriseId))
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
break
}

e.OutSuc(c, map[string]interface{}{
"info": resp,
"kind": []map[string]interface{}{
{
"name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForSchool).String(),
"value": enum.EnterprisePvdByCentralKitchenForSchool,
"name": enum.EnterpriseKind(enum.EnterpriseKindByCentralKitchenForSchool).String(),
"value": enum.EnterpriseKindByCentralKitchenForSchool,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForFactory).String(),
"value": enum.EnterprisePvdByCentralKitchenForFactory,
"name": enum.EnterpriseKind(enum.EnterpriseKindByCentralKitchenForFactory).String(),
"value": enum.EnterpriseKindByCentralKitchenForFactory,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForSchool).String(),
"value": enum.EnterprisePvdBySelfSupportForSchool,
"name": enum.EnterpriseKind(enum.EnterpriseKindBySelfSupportForSchool).String(),
"value": enum.EnterpriseKindBySelfSupportForSchool,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForFactory).String(),
"value": enum.EnterprisePvdBySelfSupportForFactory,
"name": enum.EnterpriseKind(enum.EnterpriseKindBySelfSupportForFactory).String(),
"value": enum.EnterpriseKindBySelfSupportForFactory,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdByNursingHome).String(),
"value": enum.EnterprisePvdByNursingHome,
"name": enum.EnterpriseKind(enum.EnterpriseKindByNursingHome).String(),
"value": enum.EnterpriseKindByNursingHome,
},
},
}, nil)
@@ -103,33 +100,29 @@ func UserIdentityList(c *gin.Context) {
}

var resp interface{}
switch enterprise.Kind {
case enum.EnterprisePvdByCentralKitchenForSchool:
//判断校企类型
if enterprise.Pvd == enum.EnterprisePvdForOnlinePayment && enterprise.Mode == enum.EnterpriseModeForSchool {
resp, err = svc2.EnterpriseUserListByCentralKitchenForSchool(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
break
case enum.EnterprisePvdByCentralKitchenForFactory:
break
case enum.EnterprisePvdBySelfSupportForSchool:
}
if enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && enterprise.Mode == enum.EnterpriseModeForSchool {
resp, err = svc2.EnterpriseUserListByCentralKitchenForSchool(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
break
case enum.EnterprisePvdBySelfSupportForFactory:
break
case enum.EnterprisePvdByNursingHome:
}
if enterprise.Kind == enum.EnterpriseKindByNursingHome {
resp, err = svc2.EnterpriseUserListByNursingHome(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
break
}

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

+ 359
- 11
app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go Целия файл

@@ -3,6 +3,7 @@ package hdl
import (
"applet/app/admin/lib/validate"
"applet/app/admin/md"
svc3 "applet/app/admin/svc"
svc2 "applet/app/admin/svc/enterprise_manage"
md2 "applet/app/customer/md"
"applet/app/customer/svc"
@@ -130,6 +131,20 @@ func SelfSupportForSchoolStudentList(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
}
@@ -173,6 +188,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
}
@@ -199,7 +228,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
@@ -620,7 +650,7 @@ func SelfSupportForSchoolAddWorker(c *gin.Context) {
//1、查找当前身份是否已存在
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, enum.UserIdentityCertTypeForIdCard)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
@@ -636,6 +666,7 @@ func SelfSupportForSchoolAddWorker(c *gin.Context) {
Uid: 0,
Name: req.Name,
IdNo: req.IdNo,
CertType: enum.UserIdentityCertTypeForIdCard,
Kind: enum.UserIdentityKindForWorker,
Identity: enum.UserIdentityForSelfSupportForWorker,
EnterpriseId: req.EnterpriseId,
@@ -671,7 +702,7 @@ func SelfSupportForSchoolAddTeacher(c *gin.Context) {
//1、查找当前身份是否已存在
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, req.CertType)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
@@ -687,6 +718,7 @@ func SelfSupportForSchoolAddTeacher(c *gin.Context) {
Uid: 0,
Name: req.Name,
IdNo: req.IdNo,
CertType: req.CertType,
Kind: enum.UserIdentityKindForCommon,
Identity: enum.UserIdentityForSelfSupportForTeacher,
EnterpriseId: req.EnterpriseId,
@@ -769,7 +801,7 @@ func SelfSupportForSchoolAddStudent(c *gin.Context) {
//1、查找当前身份是否已存在
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, req.CertType)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
@@ -785,6 +817,7 @@ func SelfSupportForSchoolAddStudent(c *gin.Context) {
Uid: 0,
Name: req.Name,
IdNo: req.IdNo,
CertType: req.CertType,
Kind: enum.UserIdentityKindForCommon,
Identity: enum.UserIdentityForSelfSupportForStudent,
EnterpriseId: req.EnterpriseId,
@@ -900,7 +933,7 @@ func SelfSupportForSchoolImportTeacher(c *gin.Context) {
//1、查找当前身份是否已存在
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(enterpriseId, idNo)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(enterpriseId, idNo, enum.UserIdentityCertTypeForIdCard)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
@@ -915,6 +948,7 @@ func SelfSupportForSchoolImportTeacher(c *gin.Context) {
Uid: 0,
Name: name,
IdNo: idNo,
CertType: enum.UserIdentityCertTypeForIdCard,
Kind: enum.UserIdentityKindForCommon,
Identity: enum.UserIdentityForSelfSupportForTeacher,
EnterpriseId: enterpriseId,
@@ -1038,8 +1072,9 @@ func SelfSupportForSchoolOrdList(c *gin.Context) {
return
}
e.OutSuc(c, map[string]interface{}{
"list": resp,
"total": total,
"list": resp,
"total": total,
"enterprise_kind_list": md.EnterpriseKindForSchool,
"order_status_list": []map[string]interface{}{
{
"name": enum.SelfSupportForSchoolOrdOrderStatus.String(enum.SelfSupportForSchoolOrdOrderStatusForWait),
@@ -1054,6 +1089,286 @@ func SelfSupportForSchoolOrdList(c *gin.Context) {
return
}

func SelfSupportForSchoolConsumeLimit(c *gin.Context) {
var req []*md.SelfSupportForSchoolConsumeLimitReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
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
}

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.SchoolName = selfSupportForSchoolInfo.SchoolName
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)
fmt.Println(">>>>>>>>>>>>>>>>>!!!<<<<<<<<<<<<<<<<", data, err)

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{
UserIdentityId: v.UserIdentity.Id,
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": list,
"enterprise_kind_list": md.EnterpriseKindForSchool,
"daily_consume_limit_switch_list": []map[string]string{
{
"name": "开启",
"value": "ON",
},
{
"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
}

func SelfSupportForSchoolOrdListExport(c *gin.Context) {
var req md.SelfSupportForSchoolOrdListReq
err := c.ShouldBindJSON(&req)
@@ -1070,20 +1385,38 @@ func SelfSupportForSchoolOrdListExport(c *gin.Context) {
return
}

titleList := []string{"订单编号", "支付交易号", "家长电话", "就餐人姓名", "学校名称", "年级", "班级", "总金额", "支付状态", "就餐时间", "设备编号", "消费档口"}
titleList := []string{"订单编号", "支付交易号", "家长电话", "就餐人姓名", "学校名称", "年级", "班级", "总金额", "支付状态", "就餐时间", "就餐类型", "设备编号", "消费档口"}
xlsx := excelize.NewFile()
xlsx.SetSheetRow("Sheet1", "A1", &titleList)
style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
xlsx.SetCellStyle("Sheet1", "A1", "M1", style)
xlsx.SetColWidth("Sheet1", "A", "B", 35)
xlsx.SetColWidth("Sheet1", "C", "E", 15)
xlsx.SetColWidth("Sheet1", "F", "I", 10)
xlsx.SetColWidth("Sheet1", "J", "K", 20)
xlsx.SetColWidth("Sheet1", "L", "L", 25)
xlsx.SetColWidth("Sheet1", "M", "M", 15)
//表头被第一行用了,只能从第二行开始
j := 2
var totalAmount = 0.00
for _, v := range resp {
stateName := "支付成功"
if v.OrderStatus == 1 {
stateName = "待支付"
}
xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{v.OutTradeNo, v.TradeNo, v.Phone, v.Name, v.EnterpriseName, v.Class, v.Grade, v.TotalPrice, stateName, v.FaceTime, v.DeviceSn, v.ShopName})
totalAmount += utils.StrToFloat64(v.TotalPrice)
mealZh := svc3.JudgeSelfSupportForMealTime(v.FaceTime)
xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{v.OutTradeNo, v.TradeNo, v.Phone, v.Name, v.EnterpriseName, v.Class, v.Grade, utils.StrToFloat64(v.TotalPrice),
stateName, v.FaceTime, mealZh, v.DeviceSn, v.ShopName})
j++
}

xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{"总计:", "-", "-", "-", "-", "-", "-", totalAmount, "-", "-", "-", "-", "-"})

c.Header("Content-Type", "application/octet-stream")
c.Header("Content-Disposition", "attachment; filename="+"消费记录"+".xlsx")
c.Header("Content-Transfer-Encoding", "binary")
@@ -1108,8 +1441,9 @@ func SelfSupportForSchoolArrearsOrdList(c *gin.Context) {
return
}
e.OutSuc(c, map[string]interface{}{
"list": resp,
"total": total,
"list": resp,
"enterprise_kind_list": md.EnterpriseKindForSchool,
"total": total,
}, nil)
return
}
@@ -1131,6 +1465,10 @@ func SelfSupportForSchoolBlackList(c *gin.Context) {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if info == nil {
e.OutErr(c, e.ERR, "当前学校暂未完成《一脸通行入驻》")
return
}

err, resp := svc.CurlAlipayPlanetEcocampusApiRosterPageQueryBlackList(md2.CurlAlipayPlanetEcocampusApiRosterPageQueryBlackList{
SchoolCode: info.SchoolCode,
@@ -1222,6 +1560,15 @@ func SelfSupportForSchoolEducateSceneKidsClose(c *gin.Context) {

sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
var certType string
switch identity.CertType {
case enum.UserIdentityCertTypeForIdCard:
certType = "1"
case enum.UserIdentityCertTypeForStudentId:
certType = "X"
case enum.UserIdentityCertTypeForPassport:
certType = "A"
}
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey)
err, info := svc.CurlEducateSceneKidsClose(md2.CurlEducateSceneKidsCloseReq{
Config: struct {
@@ -1233,6 +1580,7 @@ func SelfSupportForSchoolEducateSceneKidsClose(c *gin.Context) {
AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey],
AliPublicKey: sysCfg[enum.OpenAppletPublicKey],
},
CertType: certType,
CertNo: identity.IdNo,
SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode,
ParentUid: selfSupportForUserFaceInfo.ParentUserId,


+ 18
- 4
app/admin/hdl/hdl_data_statistics.go Целия файл

@@ -35,8 +35,9 @@ func CentralKitchenForSchoolDataStatisticsList(c *gin.Context) {
}

e.OutSuc(c, map[string]interface{}{
"list": list,
"total": total,
"list": list,
"total": total,
"enterprise_kind_list": md.EnterpriseKindForSchool,
"kind": []map[string]interface{}{
{
"name": "订单列表",
@@ -74,6 +75,10 @@ func CentralKitchenForSchoolDataStatisticsList(c *gin.Context) {
"name": "数据对比",
"value": 9,
},
{
"name": "就餐数据统计表",
"value": 10,
},
},
}, nil)
return
@@ -279,8 +284,9 @@ func SelfSupportForSchoolDataStatisticsList(c *gin.Context) {
}

e.OutSuc(c, map[string]interface{}{
"list": list,
"total": total,
"list": list,
"total": total,
"enterprise_kind_list": md.EnterpriseKindForSchool,
"kind": []map[string]interface{}{
{
"name": "教师消费统计表",
@@ -290,6 +296,14 @@ func SelfSupportForSchoolDataStatisticsList(c *gin.Context) {
"name": "商家分餐数据统计表",
"value": 2,
},
{
"name": "学校就餐数据统计表",
"value": 3,
},
{
"name": "设备就餐数据统计表",
"value": 4,
},
},
}, nil)
return


+ 20
- 39
app/admin/hdl/hdl_enterprise.go Целия файл

@@ -50,26 +50,15 @@ func EnterpriseList(c *gin.Context) {
"value": enum.EnterpriseStateForFreeze,
},
},
"kind": []map[string]interface{}{
"kind_by_mode": md.EnterpriseKindByMode,
"pvd": []map[string]interface{}{
{
"name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForSchool).String(),
"value": enum.EnterprisePvdByCentralKitchenForSchool,
"name": enum.EnterprisePvd(enum.EnterprisePvdForOnlinePayment).String(),
"value": enum.EnterprisePvdForOnlinePayment,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForFactory).String(),
"value": enum.EnterprisePvdByCentralKitchenForFactory,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForSchool).String(),
"value": enum.EnterprisePvdBySelfSupportForSchool,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForFactory).String(),
"value": enum.EnterprisePvdBySelfSupportForFactory,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdByNursingHome).String(),
"value": enum.EnterprisePvdByNursingHome,
"name": enum.EnterprisePvd(enum.EnterprisePvdForFaceScanPayment).String(),
"value": enum.EnterprisePvdForFaceScanPayment,
},
},
}, nil)
@@ -85,7 +74,8 @@ func Detail(c *gin.Context) {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if enterprise.Kind == enum.EnterprisePvdBySelfSupportForSchool {

if enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && enterprise.Mode == enum.EnterpriseModeForSchool {
detail, err := svc.EnterpriseDetailV2(utils.StrToInt(enterpriseId))
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
@@ -94,6 +84,7 @@ func Detail(c *gin.Context) {
e.OutSuc(c, detail, nil)
return
}

detail, err := svc.EnterpriseDetail(utils.StrToInt(enterpriseId))
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
@@ -201,13 +192,14 @@ func EnterpriseAdd(c *gin.Context) {
enterpriseDb := db.EnterpriseDb{}
enterpriseDb.Set()
now := time.Now()
var pvd = 2
if req.Kind == enum.EnterprisePvdByCentralKitchenForSchool || req.Kind == enum.EnterprisePvdByCentralKitchenForFactory {
pvd = 1
}
//var pvd = 2
//if req.Kind == enum.EnterpriseKindByCentralKitchenForSchool || req.Kind == enum.EnterpriseKindByCentralKitchenForFactory {
// pvd = 1
//}
enterprise := model.Enterprise{
Name: req.Name,
Pvd: int32(pvd),
Pvd: req.Pvd,
Mode: req.Mode,
Kind: req.Kind,
CompanyId: req.CompanyId,
State: enum2.CompanyStateForNormal,
@@ -220,7 +212,7 @@ func EnterpriseAdd(c *gin.Context) {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if req.Kind == enum.EnterprisePvdByCentralKitchenForSchool {
if req.Pvd == enum.EnterprisePvdForOnlinePayment && req.Mode == enum.EnterpriseModeForSchool {
//新增 `central_kitchen_for_school_set` && `central_kitchen_for_school_with_spec`
centralKitchenForSchoolSetDb := db.CentralKitchenForSchoolSetDb{}
centralKitchenForSchoolSetDb.Set(enterpriseId)
@@ -254,7 +246,8 @@ func EnterpriseAdd(c *gin.Context) {
UpdateAt: now.Format("2006-01-02 15:04:05"),
})
}
if req.Kind == enum.EnterprisePvdByNursingHome {

if req.Kind == enum.EnterpriseKindByNursingHome {
//新增 `nursing_home_set` && `nursing_home_with_spec`
nursingHomeSetDb := db.NursingHomeSetDb{}
nursingHomeSetDb.Set(enterpriseId)
@@ -325,19 +318,13 @@ func CentralKitchenForSchoolUpdate(c *gin.Context) {
e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
return
}
var pvd = 2
if req.Kind == enum.EnterprisePvdByCentralKitchenForSchool || req.Kind == enum.EnterprisePvdByCentralKitchenForFactory || req.Kind == enum.EnterprisePvdByNursingHome {
pvd = 1
}

now := time.Now()
enterprise.Name = req.Name
enterprise.Memo = req.Memo
enterprise.Pvd = int32(pvd)
enterprise.Kind = req.Kind
enterprise.CompanyId = req.CompanyId
enterprise.UpdateAt = now.Format("2006-01-02 15:04:05")
_, err = enterpriseDb.EnterpriseUpdate(enterprise, "name", "memo", "pvd", "kind", "company_id", "update_at")
_, err = enterpriseDb.EnterpriseUpdate(enterprise, "name", "memo", "company_id", "update_at")
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
@@ -513,19 +500,13 @@ func SelfSupportForSchoolUpdate(c *gin.Context) {
e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
return
}
var pvd = 2
if req.Kind == enum.EnterprisePvdByCentralKitchenForSchool || req.Kind == enum.EnterprisePvdByCentralKitchenForFactory || req.Kind == enum.EnterprisePvdByNursingHome {
pvd = 1
}

now := time.Now()
enterprise.Name = req.Name
enterprise.Memo = req.Memo
enterprise.Pvd = int32(pvd)
enterprise.Kind = req.Kind
enterprise.CompanyId = req.CompanyId
enterprise.UpdateAt = now.Format("2006-01-02 15:04:05")
_, err = enterpriseDb.EnterpriseUpdate(enterprise, "name", "memo", "pvd", "kind", "company_id", "update_at")
_, err = enterpriseDb.EnterpriseUpdate(enterprise, "name", "memo", "company_id", "update_at")
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return


+ 4
- 4
app/admin/hdl/hdl_home_page.go Целия файл

@@ -49,16 +49,16 @@ func HomePageIndex(c *gin.Context) {
var totalCentralKitchenForSchoolNums, totalCentralKitchenForFactoryNums, totalSelfSupportForSchoolNums, totalSelfSupportForFactoryNums int
if mapArr3 != nil {
for _, v := range mapArr3 {
if v["kind"] == utils.IntToStr(enum.EnterprisePvdByCentralKitchenForSchool) {
if v["kind"] == utils.IntToStr(enum.EnterpriseKindByCentralKitchenForSchool) {
totalCentralKitchenForSchoolNums = utils.StrToInt(v["total"])
}
if v["kind"] == utils.IntToStr(enum.EnterprisePvdByCentralKitchenForFactory) {
if v["kind"] == utils.IntToStr(enum.EnterpriseKindByCentralKitchenForFactory) {
totalCentralKitchenForFactoryNums = utils.StrToInt(v["total"])
}
if v["kind"] == utils.IntToStr(enum.EnterprisePvdBySelfSupportForSchool) {
if v["kind"] == utils.IntToStr(enum.EnterpriseKindBySelfSupportForSchool) {
totalSelfSupportForSchoolNums = utils.StrToInt(v["total"])
}
if v["kind"] == utils.IntToStr(enum.EnterprisePvdBySelfSupportForFactory) {
if v["kind"] == utils.IntToStr(enum.EnterpriseKindBySelfSupportForFactory) {
totalSelfSupportForFactoryNums = utils.StrToInt(v["total"])
}
}


+ 25
- 3
app/admin/hdl/hdl_set_center.go Целия файл

@@ -23,17 +23,39 @@ func SetCenter(c *gin.Context) {
sysCfgDb.SysCfgUpdate(enum.AdministratorContactInfo, req.AdministratorContactInfo)
sysCfgDb.SysCfgUpdate(enum.CentralKitchenForSchoolReserveMealTime, req.CentralKitchenForSchoolReserveMealTime)
sysCfgDb.SysCfgUpdate(enum.CentralKitchenForSchoolCancelMealTime, req.CentralKitchenForSchoolCancelMealTime)
e.OutSuc(c, "success", nil)
return
}

func GetCenter(c *gin.Context) {
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
res := sysCfgDb.SysCfgFindWithDb(enum.AdministratorContactInfo, enum.CentralKitchenForSchoolReserveMealTime, enum.CentralKitchenForSchoolCancelMealTime)
e.OutSuc(c, res, nil)
return
}

func SetForNursingHome(c *gin.Context) {
var req md.SetCenterReqForNursingHome
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfgDb.SysCfgUpdate(enum.NursingHomeReserveMealTime, req.NursingHomeReserveMealTime)
sysCfgDb.SysCfgUpdate(enum.NursingHomeCancelMealTime, req.NursingHomeCancelMealTime)
e.OutSuc(c, "success", nil)
return
}

func GetCenter(c *gin.Context) {
func GetForNursingHome(c *gin.Context) {
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
res := sysCfgDb.SysCfgFindWithDb(enum.AdministratorContactInfo, enum.CentralKitchenForSchoolReserveMealTime, enum.CentralKitchenForSchoolCancelMealTime,
enum.NursingHomeReserveMealTime, enum.NursingHomeCancelMealTime)
res := sysCfgDb.SysCfgFindWithDb(enum.NursingHomeReserveMealTime, enum.NursingHomeCancelMealTime)
e.OutSuc(c, res, nil)
return
}

+ 24
- 10
app/admin/hdl/hdl_user.go Целия файл

@@ -57,26 +57,40 @@ func UserList(c *gin.Context) {
},
"enterprise_kind_list": []map[string]interface{}{
{
"name": enum.EnterprisePvd.String(enum.EnterprisePvdByCentralKitchenForSchool),
"value": enum.EnterprisePvdByCentralKitchenForSchool,
"name": enum.EnterpriseKind.String(enum.EnterpriseKindByCentralKitchenForSchool),
"value": enum.EnterpriseKindByCentralKitchenForSchool,
},
{
"name": enum.EnterprisePvd.String(enum.EnterprisePvdByCentralKitchenForFactory),
"value": enum.EnterprisePvdByCentralKitchenForFactory,
"name": enum.EnterpriseKind.String(enum.EnterpriseKindByCentralKitchenForFactory),
"value": enum.EnterpriseKindByCentralKitchenForFactory,
},
{
"name": enum.EnterprisePvd.String(enum.EnterprisePvdBySelfSupportForSchool),
"value": enum.EnterprisePvdBySelfSupportForSchool,
"name": enum.EnterpriseKind.String(enum.EnterpriseKindBySelfSupportForSchool),
"value": enum.EnterpriseKindBySelfSupportForSchool,
},
{
"name": enum.EnterprisePvd.String(enum.EnterprisePvdBySelfSupportForFactory),
"value": enum.EnterprisePvdBySelfSupportForFactory,
"name": enum.EnterpriseKind.String(enum.EnterpriseKindBySelfSupportForFactory),
"value": enum.EnterpriseKindBySelfSupportForFactory,
},
{
"name": enum.EnterprisePvd.String(enum.EnterprisePvdByNursingHome),
"value": enum.EnterprisePvdByNursingHome,
"name": enum.EnterpriseKind.String(enum.EnterpriseKindByNursingHome),
"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
}


+ 2
- 0
app/admin/md/md_central_kitchen_for_school.go Целия файл

@@ -3,6 +3,8 @@ package md
type CentralKitchenForSchoolInfoResp struct {
Name string `json:"name" label:"名称"`
Memo string `json:"memo" label:"备注"`
Mode string `json:"mode" label:"模式"`
Pvd string `json:"pvd" label:"场景"`
Kind string `json:"kind" label:"种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂)"`
State string `json:"state" label:"状态(1:正常 2:冻结)"`
IsOpenTeacherReportMeal int `json:"is_open_teacher_report_meal" label:"教师报餐(1:开启 2:关闭)"`


+ 3
- 0
app/admin/md/md_central_kitchen_for_school_export_records.go Целия файл

@@ -10,6 +10,7 @@ type CentralKitchenForSchoolExportRecordsListReq struct {

type CentralKitchenForSchoolDataStatisticsExportReq struct {
Kinds []int `json:"kinds" binding:"required" label:"导出类型"`
EnterPriseKind int `json:"enterprise_kind" binding:"required" label:"校企类型"`
StartDate string `json:"start_date" binding:"required" label:"起始时间"`
EndDate string `json:"end_date" binding:"required" label:"截止时间"`
MealKindList []int `json:"meal_kind_list" label:"就餐类型(1:早餐 2:午餐 3:晚餐)"`
@@ -22,6 +23,7 @@ type CentralKitchenForSchoolDataStatisticsContrastReq struct {
Date2 []string `json:"date_2" binding:"required" label:"截止时间"`
MealKindList []int `json:"meal_kind_list" label:"就餐类型(1:早餐 2:午餐 3:晚餐)"`
EnterpriseId int `json:"enterprise_id" label:"校企id"`
EnterPriseKind int `json:"enterprise_kind" binding:"required" label:"校企类型"`
EnterpriseName string `json:"enterprise_name" label:"校企名称"`
}

@@ -55,4 +57,5 @@ type SelfSupportForSchoolDataStatisticsExportReq struct {
EndDate string `json:"end_date" binding:"required" label:"截止时间"`
EnterpriseId int `json:"enterprise_id" label:"校企id"`
EnterpriseName string `json:"enterprise_name" label:"校企名称"`
EnterPriseKind int `json:"enterprise_kind" binding:"required" label:"校企类型"`
}

+ 60
- 4
app/admin/md/md_enterprise.go Целия файл

@@ -1,10 +1,14 @@
package md

import "applet/app/db/model"
import (
"applet/app/db/model"
"applet/app/enum"
)

type EnterpriseAddReq struct {
Name string `json:"name" binding:"required" label:"名称"`
Pvd int32 `json:"pvd" label:"场景"`
Pvd int32 `json:"pvd" label:"消费场景"`
Mode int32 `json:"mode" label:"模式(1:学校 2:工厂 3:养老院)"`
Kind int32 `json:"kind" binding:"required" label:"种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂 5:养老院)"`
CompanyId int `json:"company_id" binding:"required" label:"所属公司id"`
Memo string `json:"memo" label:"备注"`
@@ -13,8 +17,6 @@ type EnterpriseAddReq struct {
type CentralKitchenForSchoolUpdateReq struct {
Id int `json:"id" binding:"required" label:"企业id"`
Name string `json:"name" binding:"required" label:"名称"`
Pvd int32 `json:"pvd" label:"场景"`
Kind int32 `json:"kind" binding:"required" label:"种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂 5:养老院)"`
CompanyId int `json:"company_id" binding:"required" label:"所属公司id"`
Memo string `json:"memo" label:"备注"`
State int32 `json:"state" label:"状态"`
@@ -46,6 +48,8 @@ type EnterpriseListReq struct {
Page int `json:"page" `
Name string `json:"name" label:"名称"`
Kind int `json:"kind" label:"种类"`
Pvd int `json:"pvd" label:"场景"`
Mode int `json:"mode" label:"模式"`
}

type EnterpriseDetailResp struct {
@@ -123,3 +127,55 @@ type CentralKitchenForSchoolStudentAdmissionByClass struct {
GradeId int `json:"grade_id" binding:"required" label:"年级id"`
ClassIds []int `json:"class_ids" label:"班级id"`
}

var EnterpriseKindByMode = []map[string]interface{}{
{
"name": enum.EnterpriseMode(enum.EnterpriseModeForSchool).String(),
"value": enum.EnterpriseModeForSchool,
"kind_list": []map[string]interface{}{
{
"name": enum.EnterpriseKind(enum.EnterpriseKindByCentralKitchenForSchool).String(),
"value": enum.EnterpriseKindByCentralKitchenForSchool,
},
{
"name": enum.EnterpriseKind(enum.EnterpriseKindBySelfSupportForSchool).String(),
"value": enum.EnterpriseKindBySelfSupportForSchool,
},
},
},
{
"name": enum.EnterpriseMode(enum.EnterpriseModeForFactory).String(),
"value": enum.EnterpriseModeForFactory,
"kind_list": []map[string]interface{}{
{
"name": enum.EnterpriseKind(enum.EnterpriseKindByCentralKitchenForFactory).String(),
"value": enum.EnterpriseKindByCentralKitchenForFactory,
},
{
"name": enum.EnterpriseKind(enum.EnterpriseKindBySelfSupportForFactory).String(),
"value": enum.EnterpriseKindBySelfSupportForFactory,
},
},
},
{
"name": enum.EnterpriseMode(enum.EnterpriseModeForNursingHome).String(),
"value": enum.EnterpriseModeForNursingHome,
"kind_list": []map[string]interface{}{
{
"name": enum.EnterpriseKind(enum.EnterpriseKindByNursingHome).String(),
"value": enum.EnterpriseKindByNursingHome,
},
},
},
}

var EnterpriseKindForSchool = []map[string]interface{}{
{
"name": enum.EnterpriseKind.String(enum.EnterpriseKindByCentralKitchenForSchool),
"value": enum.EnterpriseKindByCentralKitchenForSchool,
},
{
"name": enum.EnterpriseKind.String(enum.EnterpriseKindBySelfSupportForSchool),
"value": enum.EnterpriseKindBySelfSupportForSchool,
},
}

+ 114
- 52
app/admin/md/md_enterprise_manage.go Целия файл

@@ -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:"姓名"`
}

@@ -230,34 +236,36 @@ type CentralKitchenForSchoolOrdListResp struct {
}

type CentralKitchenForSchoolOrdListReq struct {
EnterpriseId int `json:"enterprise_id" label:"企业id"`
IsTeacher int `json:"is_teacher" label:"是否教师"`
Limit int `json:"limit" binding:"required"`
Page int `json:"page" binding:"required"`
Name string `json:"name" label:"姓名"`
OutTradeNo string `json:"out_trade_no" label:"订单号"`
Kind int `json:"kind" label:"预定类型"`
Sate int `json:"state" label:"支付状态"`
OrdSate int `json:"ord_state" label:"订单状态"`
GradeId int `json:"grade_id" label:"年级id"`
ClassId int `json:"class_id" label:"班级id"`
Phone string `json:"phone" label:"家长联系电话"`
StartDate string `json:"start_date" label:"开始时间"`
EndDate string `json:"end_date" label:"截止时间"`
EnterpriseId int `json:"enterprise_id" label:"企业id"`
IsTeacher int `json:"is_teacher" label:"是否教师"`
Limit int `json:"limit" binding:"required"`
Page int `json:"page" binding:"required"`
Name string `json:"name" label:"姓名"`
OutTradeNo string `json:"out_trade_no" label:"订单号"`
Kind int `json:"kind" label:"预定类型"`
EnterPriseKind int `json:"enterprise_kind" label:"校企类型"`
Sate int `json:"state" label:"支付状态"`
OrdSate int `json:"ord_state" label:"订单状态"`
GradeId int `json:"grade_id" label:"年级id"`
ClassId int `json:"class_id" label:"班级id"`
Phone string `json:"phone" label:"家长联系电话"`
StartDate string `json:"start_date" label:"开始时间"`
EndDate string `json:"end_date" label:"截止时间"`
}

type CentralKitchenForSchoolReserveListReq struct {
EnterpriseId int `json:"enterprise_id" label:"企业id"`
Limit int `json:"limit" binding:"required"`
Page int `json:"page" binding:"required"`
Name string `json:"name" label:"姓名"`
OutTradeNo string `json:"out_trade_no" label:"订单号"`
Kind int `json:"kind" label:"预定类型"`
GradeId int `json:"grade_id" label:"年级id"`
ClassId int `json:"class_id" label:"班级id"`
Phone string `json:"phone" label:"家长联系电话"`
StartDate string `json:"start_date" label:"开始时间"`
EndDate string `json:"end_date" label:"截止时间"`
EnterpriseId int `json:"enterprise_id" label:"企业id"`
Limit int `json:"limit" binding:"required"`
Page int `json:"page" binding:"required"`
Name string `json:"name" label:"姓名"`
OutTradeNo string `json:"out_trade_no" label:"订单号"`
Kind int `json:"kind" label:"预定类型"`
EnterPriseKind int `json:"enterprise_kind" label:"校企类型"`
GradeId int `json:"grade_id" label:"年级id"`
ClassId int `json:"class_id" label:"班级id"`
Phone string `json:"phone" label:"家长联系电话"`
StartDate string `json:"start_date" label:"开始时间"`
EndDate string `json:"end_date" label:"截止时间"`
}

type CentralKitchenForSchoolReserveUpdateStudentReq struct {
@@ -298,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:"班级"`
@@ -321,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:"年级"`
@@ -345,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:集采) "`
@@ -356,6 +367,7 @@ type SelfSupportForSchoolStudentUpdateReq 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:"证件类型(1:身份证 2:学工号 3:护照)"`
Name string `json:"name" label:"姓名"`
GradeId int `json:"grade_id" label:"年级id"`
ClassId int `json:"class_id" label:"班级id"`
@@ -365,6 +377,7 @@ type SelfSupportForSchoolStudentUpdateReq struct {
type SelfSupportForSchoolStudentAddReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
IdNo string `json:"id_no" label:"身份证号"`
CertType int `json:"cert_type" label:"证件类型(1:身份证 2:学工号 3:护照)"`
Name string `json:"name" label:"姓名"`
GradeId int `json:"grade_id" label:"年级id"`
ClassId int `json:"class_id" label:"班级id"`
@@ -386,6 +399,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:集采)"`
}
@@ -406,6 +420,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:"创建时间"`
@@ -463,35 +478,82 @@ 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 {
EnterpriseId int `json:"enterprise_id" label:"企业id"`
Limit int `json:"limit" binding:"required"`
Page int `json:"page" binding:"required"`
Name string `json:"name" label:"姓名"`
Phone string `json:"phone" label:"用户电话"`
OutTradeNo string `json:"out_trade_no" label:"订单号"`
OrderStatus int `json:"order_status" label:"订单状态"`
GradeId int `json:"grade_id" label:"年级id"`
ClassId int `json:"class_id" label:"班级id"`
StartDate string `json:"start_date" label:"刷脸-开始时间"`
EndDate string `json:"end_date" label:"刷脸-截止时间"`
IsTeacher int `json:"is_teacher" label:"是否教师"`
EnterpriseId int `json:"enterprise_id" label:"企业id"`
EnterpriseKind int `json:"enterprise_kind" label:"校企类型"`
Limit int `json:"limit" binding:"required"`
Page int `json:"page" binding:"required"`
Name string `json:"name" label:"姓名"`
Phone string `json:"phone" label:"用户电话"`
OutTradeNo string `json:"out_trade_no" label:"订单号"`
OrderStatus int `json:"order_status" label:"订单状态"`
GradeId int `json:"grade_id" label:"年级id"`
ClassId int `json:"class_id" label:"班级id"`
StartDate string `json:"start_date" label:"刷脸-开始时间"`
EndDate string `json:"end_date" label:"刷脸-截止时间"`
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"`
EnterpriseKind int `json:"enterprise_kind" label:"企业类型"`
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 {
UserIdentityId int `json:"user_identity_id" label:"用户身份id"`
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"`
Limit int `json:"limit" binding:"required"`
Page int `json:"page" binding:"required"`
Name string `json:"name" label:"姓名"`
Phone string `json:"phone" label:"用户电话"`
OutTradeNo string `json:"out_trade_no" label:"订单号"`
GradeId int `json:"grade_id" label:"年级id"`
ClassId int `json:"class_id" label:"班级id"`
StartDate string `json:"start_date" label:"刷脸-开始时间"`
EndDate string `json:"end_date" label:"刷脸-截止时间"`
IsTeacher int `json:"is_teacher" label:"是否教师"`
EnterpriseId int `json:"enterprise_id" label:"企业id"`
EnterpriseKind int `json:"enterprise_kind" label:"企业类型"`
Limit int `json:"limit" binding:"required"`
Page int `json:"page" binding:"required"`
Name string `json:"name" label:"姓名"`
Phone string `json:"phone" label:"用户电话"`
OutTradeNo string `json:"out_trade_no" label:"订单号"`
GradeId int `json:"grade_id" label:"年级id"`
ClassId int `json:"class_id" label:"班级id"`
StartDate string `json:"start_date" label:"刷脸-开始时间"`
EndDate string `json:"end_date" label:"刷脸-截止时间"`
IsTeacher int `json:"is_teacher" label:"是否教师"`
}

type SelfSupportForSchoolBlackListReq struct {


+ 0
- 3
app/admin/md/md_enterprise_v2.go Целия файл

@@ -15,11 +15,8 @@ type GradeListStructV2 struct {
type SelfSupportForSchoolUpdateReq struct {
Id int `json:"id" binding:"required" label:"企业id"`
Name string `json:"name" binding:"required" label:"名称"`
Pvd int32 `json:"pvd" label:"场景"`
Kind int32 `json:"kind" binding:"required" label:"种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂 5:养老院)"`
CompanyId int `json:"company_id" binding:"required" label:"所属公司id"`
Memo string `json:"memo" label:"备注"`
State int32 `json:"state" label:"状态"`
GradeList []struct {
Id int `json:"id" label:"年级id"`
Name string `json:"name" label:"名称"`


+ 2
- 0
app/admin/md/md_self_support_for_school.go Целия файл

@@ -3,6 +3,8 @@ package md
type SelfSupportForSchoolInfoResp struct {
Name string `json:"name" label:"名称"`
Memo string `json:"memo" label:"备注"`
Mode string `json:"mode" label:"模式"`
Pvd string `json:"pvd" label:"场景"`
Kind string `json:"kind" label:"种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂)"`
State string `json:"state" label:"状态(1:正常 2:冻结)"`
TeacherNum int64 `json:"teacher_num" label:"教师数量"`


+ 5
- 2
app/admin/md/md_set_center.go Целия файл

@@ -4,6 +4,9 @@ type SetCenterReq struct {
AdministratorContactInfo string `json:"administrator_contact_info" binding:"required" label:"管理员联系方式"`
CentralKitchenForSchoolReserveMealTime string `json:"central_kitchen_for_school_reserve_meal_time" binding:"required" label:"央厨预定用餐时间"`
CentralKitchenForSchoolCancelMealTime string `json:"central_kitchen_for_school_cancel_meal_time" binding:"required" label:"央厨取消用餐时间"`
NursingHomeReserveMealTime string `json:"nursing_home_reserve_meal_time" binding:"required" label:"养老院预定用餐时间"`
NursingHomeCancelMealTime string `json:"nursing_home_cancel_meal_time" binding:"required" label:"养老院消用餐时间"`
}

type SetCenterReqForNursingHome struct {
NursingHomeReserveMealTime string `json:"nursing_home_reserve_meal_time" binding:"required" label:"养老院预定用餐时间"`
NursingHomeCancelMealTime string `json:"nursing_home_cancel_meal_time" binding:"required" label:"养老院消用餐时间"`
}

+ 1
- 0
app/admin/md/md_user.go Целия файл

@@ -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:"企业类型"`


+ 15
- 0
app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go Целия файл

@@ -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,
@@ -659,6 +666,10 @@ func CentralKitchenForSchoolOrdList(req md.CentralKitchenForSchoolOrdListReq) (r
sess.And("user.phone like ?", "%"+req.Phone+"%")
}

if req.EnterPriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterPriseKind)
}

if len(classWithUserIdentityIdsOne) > 0 {
sess.In("user_identity.id", classWithUserIdentityIdsOne)
}
@@ -798,6 +809,10 @@ func CentralKitchenForSchoolReserveList(req md.CentralKitchenForSchoolReserveLis
if len(months) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.reserve_month", months)
}
if req.EnterPriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterPriseKind)
}

var m []*db.CentralKitchenForSchoolPackageOrdForReserveWithUserIdentity
count, err = sess.
Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no").


+ 63
- 4
app/admin/svc/enterprise_manage/svc_enterprise_manage.go Целия файл

@@ -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
}



+ 17
- 3
app/admin/svc/enterprise_manage/svc_self_support_for_school.go Целия файл

@@ -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,
@@ -371,8 +377,9 @@ func SelfSupportForSchoolStudentUpdate(req md.SelfSupportForSchoolStudentUpdateR
return errors.New("未查询到对应记录")
}
userIdentity.IdNo = req.IdNo
userIdentity.CertType = req.CertType
userIdentity.Name = req.Name
_, err = userIdentityDb.UserIdentityUpdate(req.UserIdentityId, userIdentity, "id_no", "name")
_, err = userIdentityDb.UserIdentityUpdate(req.UserIdentityId, userIdentity, "id_no", "name", "cert_type")
if err != nil {
return
}
@@ -497,6 +504,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,
@@ -582,6 +590,9 @@ func SelfSupportForSchoolOrdList(req md.SelfSupportForSchoolOrdListReq) (resp []
if req.OutTradeNo != "" {
sess.And("self_support_for_school_ord.out_order_no like ?", "%"+req.OutTradeNo+"%")
}
if req.EnterpriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterpriseKind)
}
if req.IsTeacher != 0 {
if req.IsTeacher == 1 {
sess.And("user_identity.identity =?", enum2.UserIdentityForCentralKitchenForTeacher)
@@ -832,6 +843,9 @@ func SelfSupportForSchoolArrearsOrdList(req md.SelfSupportForSchoolArrearsOrdLis
if req.OutTradeNo != "" {
sess.And("self_support_for_school_ord.out_order_no like ?", "%"+req.OutTradeNo+"%")
}
if req.EnterpriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterpriseKind)
}

if req.Name != "" {
sess.And("user_identity.name like ?", "%"+req.Name+"%")
@@ -849,7 +863,7 @@ func SelfSupportForSchoolArrearsOrdList(req md.SelfSupportForSchoolArrearsOrdLis
var m []*db.SelfSupportForSchoolOrdWithUserIdentity
count, err = sess.
Join("LEFT", "user_identity", "self_support_for_school_ord.user_identity_id = user_identity.id").
Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id").
Join("LEFT", "enterprise", "enterprise.id = self_support_for_school_ord.enterprise_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").


+ 3
- 1
app/admin/svc/svc_central_kitchen_for_school.go Целия файл

@@ -16,7 +16,9 @@ func CentralKitchenForSchoolInfo(enterpriseId int) (err error, resp md.CentralKi
}
resp.Name = enterprise.Name
resp.Memo = enterprise.Memo
resp.Kind = enum.EnterprisePvd(enterprise.Kind).String()
resp.Mode = enum.EnterpriseMode(enterprise.Mode).String()
resp.Pvd = enum.EnterprisePvd(enterprise.Pvd).String()
resp.Kind = enum.EnterpriseKind(enterprise.Kind).String()
resp.State = enum.EnterpriseState(enterprise.State).String()

//2、查询`central_kitchen_for_school_with_spec`


+ 484
- 21
app/admin/svc/svc_data_statisstics.go Целия файл

@@ -240,6 +240,10 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta
if req.EndDate != "" {
sess.And("self_support_for_school_ord.face_time <= ?", req.EndDate)
}
if req.EnterPriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterPriseKind)
}

sess.And("user_identity.identity = ?", enum.UserIdentityForSelfSupportForTeacher) //只查询老师
_, err := sess.
Join("LEFT", "user_identity", "self_support_for_school_ord.user_identity_id = user_identity.id").
@@ -333,6 +337,9 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta
if req.EndDate != "" {
sess.And("self_support_for_school_ord.face_time <= ?", req.EndDate)
}
if req.EnterPriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterPriseKind)
}
_, err = sess.
Join("LEFT", "user_identity", "self_support_for_school_ord.user_identity_id = user_identity.id").
Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id").
@@ -380,6 +387,9 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta
xlsx.CopySheet(1, sheetIndex)
j := 4 //表头前三行被占用了,只能从第四行开始
for kk, vv := range v {
if kk == "" {
kk = k
}
xlsx.SetSheetRow(k, "A"+strconv.Itoa(j), &[]interface{}{kk,
vv["早餐"]["num"], vv["早餐"]["amount"],
vv["午餐"]["num"], vv["午餐"]["amount"],
@@ -395,6 +405,336 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta
//将文件保存至服务器
xlsx.SaveAs("./static" + downloadPath)
break
case 3:
//就餐数据统计表
xlsx, _ := excelize.OpenFile("./static/template/自营学校(就餐数据统计表).xlsx")
fileName = "就餐数据统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx"
downloadPath = "/export/self_support_for_school/" + fileName

//查询出所有的设备
//var deviceList []*model.Device
//err := db.Db.Where("enterprise_id != 0").Find(&deviceList)
//if err != nil {
// logx.Error(err)
// println("<<<<SelfSupportForSchoolDataStatisticsExport2>>>>>1111Error:::", err.Error())
// return
//}
//var deviceListMapping = map[string]model.Device{}
//for _, v := range deviceList {
// deviceListMapping[v.DeviceSn] = *v
//}

var m []*db.SelfSupportForSchoolOrdWithUserIdentity
sess := db.Db.Desc("self_support_for_school_ord.id")
if req.EnterpriseId != 0 {
sess.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId)
}
if req.StartDate != "" {
sess.And("self_support_for_school_ord.face_time >= ?", req.StartDate)
}
if req.EndDate != "" {
sess.And("self_support_for_school_ord.face_time <= ?", req.EndDate)
}
if req.EnterPriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterPriseKind)
}
_, err := sess.
Join("LEFT", "user_identity", "self_support_for_school_ord.user_identity_id = user_identity.id").
Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_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").
FindAndCount(&m)
if err != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
}

//整合数据
var data = map[string]map[string]map[string]map[string]float64{}

date1, err := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local)
if err != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
}
date2, err := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local)
if err != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
}
diffDays := int(date2.Sub(date1).Hours() / 24)
var dates []string
for i := 0; i <= diffDays; i++ {
date := date1.AddDate(0, 0, i)
shopName := date.Format("2006-01-02")
dates = append(dates, shopName)
for _, vv := range m {
tmpDate, err1 := time.ParseInLocation("2006-01-02 15:04:05", vv.SelfSupportForSchoolOrd.FaceTime, time.Local)
if err1 != nil {
logx.Error(err1)
println("<<<<SelfSupportForSchoolDataStatisticsExport3>>>>>Error:::", err1.Error())
return
}
fmt.Println(tmpDate.Format("2006-01-02"))
if shopName == tmpDate.Format("2006-01-02") {
if data[vv.Enterprise.Name] == nil {
data[vv.Enterprise.Name] = make(map[string]map[string]map[string]float64)
}
if data[vv.Enterprise.Name][shopName] == nil {
data[vv.Enterprise.Name][shopName] = make(map[string]map[string]float64)
}
mealZh := JudgeSelfSupportForMealTime(vv.SelfSupportForSchoolOrd.FaceTime)
if data[vv.Enterprise.Name][shopName][mealZh] == nil {
data[vv.Enterprise.Name][shopName][mealZh] = make(map[string]float64)
}
if data[vv.Enterprise.Name][shopName]["合计"] == nil {
data[vv.Enterprise.Name][shopName]["合计"] = make(map[string]float64)
}
data[vv.Enterprise.Name][shopName][mealZh]["num"]++
data[vv.Enterprise.Name][shopName][mealZh]["amount"] += utils.StrToFloat64(vv.SelfSupportForSchoolOrd.TradeAmount)
data[vv.Enterprise.Name][shopName]["合计"]["num"]++
data[vv.Enterprise.Name][shopName]["合计"]["amount"] += utils.StrToFloat64(vv.SelfSupportForSchoolOrd.TradeAmount)
}
}
}

xlsx.SetSheetRow("", "A1", &titleList)
sheetIndex := 2 //第一个表是模板表
for k, v := range data {
if k == "" {
k = "未知"
}
xlsx.NewSheet(k) //1、新建表格
xlsx.CopySheet(1, sheetIndex)
j := 4 //表头前三行被占用了,只能从第四行开始
for _, date := range dates {
for kk, vv := range v {
if date == kk {
xlsx.SetSheetRow(k, "A"+strconv.Itoa(j), &[]interface{}{kk,
vv["早餐"]["num"], vv["早餐"]["amount"],
vv["午餐"]["num"], vv["午餐"]["amount"],
vv["晚餐"]["num"], vv["晚餐"]["amount"],
vv["夜宵"]["num"], vv["夜宵"]["amount"],
vv["合计"]["num"], vv["合计"]["amount"],
})
j++
}
sheetIndex++
}
}
}
xlsx.DeleteSheet("template") //删除模板表
//将文件保存至服务器
xlsx.SaveAs("./static" + downloadPath)
break
case 4:
//设备就餐数据统计表
fileName = "设备就餐数据统计_" + utils.Int64ToStr(now.UnixMilli()) + ".zip"
downloadPath = "/export/self_support_for_school/" + fileName

//查询出所有的设备
var deviceList []*model.Device
if req.EnterpriseId != 0 {
err := db.Db.Where("enterprise_id != 0").Find(&deviceList)
if err != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport4>>>>>1111Error:::", err.Error())
return
}
} else {
err := db.Db.Where("enterprise_id = ?", req.EnterpriseId).Find(&deviceList)
if err != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport4>>>>>1111Error:::", err.Error())
return
}
}

date1, err := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local)
if err != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport4>>>>>Error:::", err.Error())
return
}
date2, err := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local)
if err != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport4>>>>>Error:::", err.Error())
return
}
diffDays := int(date2.Sub(date1).Hours() / 24)

var deviceListMapping = map[string]model.Device{}
//整合数据
var data = map[string]map[string]map[string]map[string]float64{}
var xlsFileName, xlsDownloadPath []string
for _, v := range deviceList {
deviceListMapping[v.DeviceSn] = *v
var m []*db.SelfSupportForSchoolOrdWithUserIdentityV2
sess := db.Db.Where("device_sn = ?", v.DeviceSn).Desc("self_support_for_school_ord.id")
if req.EnterpriseId != 0 {
sess.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId)
}
if req.StartDate != "" {
sess.And("self_support_for_school_ord.face_time >= ?", req.StartDate)
}
if req.EndDate != "" {
sess.And("self_support_for_school_ord.face_time <= ?", req.EndDate)
}
_, err = sess.Join("LEFT", "enterprise", "self_support_for_school_ord.enterprise_id = enterprise.id").FindAndCount(&m)
if err != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport4>>>>>Error:::", err.Error())
return
}
for _, vv := range m {
tmpTime, err1 := time.ParseInLocation("2006-01-02 15:04:05", vv.SelfSupportForSchoolOrd.FaceTime, time.Local)
if err1 != nil {
logx.Error(err1)
println("<<<<SelfSupportForSchoolDataStatisticsExport4>>>>>Error:::", err1.Error())
return
}
tmpDate := tmpTime.Format("2006-01-02")
if data[vv.Enterprise.Name] == nil {
data[vv.Enterprise.Name] = make(map[string]map[string]map[string]float64)
}
if data[vv.Enterprise.Name][v.Name] == nil {
data[vv.Enterprise.Name][v.Name] = make(map[string]map[string]float64)
}
if data[vv.Enterprise.Name][v.Name][tmpDate] == nil {
data[vv.Enterprise.Name][v.Name][tmpDate] = make(map[string]float64)
}
data[vv.Enterprise.Name][v.Name][tmpDate]["num"]++
data[vv.Enterprise.Name][v.Name][tmpDate]["amount"] += utils.StrToFloat64(vv.SelfSupportForSchoolOrd.TradeAmount)
}
}

for k1, v := range data {
tmpFileName := k1 + "设备就餐数据统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx"
tmpDownloadPath := "./static/export/self_support_for_school/" + tmpFileName
xlsx := excelize.NewFile()

var totalData = map[string]map[string]float64{}
for k2, vv := range v {
var sumNum, sumAmount = float64(0), float64(0)
xlsx.NewSheet(k2)
titleList = []string{" 设 备 分 餐 数 据 统 计 表 "}
xlsx.SetSheetRow(k2, "A1", &titleList)
titleList = []string{"日 期", "消费笔数", "消费金额"}
xlsx.SetSheetRow(k2, "A2", &titleList)
style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`)
if err != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport4>>>>>Error:::", err.Error())
panic(err)
}
xlsx.MergeCell(k2, "A1", "C1") //合并单元格
xlsx.SetCellStyle(k2, "A1", "C1", style)
xlsx.SetColWidth(k2, "A", "C", 20)
j := 3 //表头前两行用了,只能从第三行开始

for i := 0; i <= diffDays; i++ {
date := date1.AddDate(0, 0, i).Format("2006-01-02")
if vv[date] != nil {
xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{date, vv[date]["num"], vv[date]["amount"]})
sumNum += vv[date]["num"]
sumAmount += vv[date]["amount"]
} else {
xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{date, 0, 0})
}
j++
}

xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{
"合计", sumNum, sumAmount})
if totalData[k2] == nil {
totalData[k2] = map[string]float64{}
}
totalData[k2]["num"] = sumNum
totalData[k2]["amount"] = sumAmount
}

xlsx.NewSheet("Sheet1")
titleList = []string{" 设 备 分 餐 数 据 统 计 表 "}
xlsx.SetSheetRow("Sheet1", "A1", &titleList)
titleList = []string{"名 称", "消费笔数", "消费金额"}
xlsx.SetSheetRow("Sheet1", "A2", &titleList)
style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`)
if err != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport4>>>>>Error:::", err.Error())
panic(err)
}
xlsx.MergeCell("Sheet1", "A1", "C1") //合并单元格
xlsx.SetCellStyle("Sheet1", "A1", "C1", style)
xlsx.SetColWidth("Sheet1", "A", "C", 20)
j := 3 //表头前两行用了,只能从第三行开始
for key, val := range totalData {
xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{key, val["num"], val["amount"]})
j++
}

//xlsx.DeleteSheet("Sheet1") //TODO::只能放这里删除
//将文件保存至服务器
err1 := xlsx.SaveAs(tmpDownloadPath)
if err1 != nil {
logx.Error(err1)
println("<<<<SelfSupportForSchoolDataStatisticsExport4>>>>>Error:::", err1.Error())
panic(err1)
}

xlsDownloadPath = append(xlsDownloadPath, tmpDownloadPath)
xlsFileName = append(xlsFileName, tmpFileName)
}

archive, err := os.Create("./static" + downloadPath) //第一步,创建 zip 文件
if err != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport4>>>>>Error:::", err.Error())
panic(err)
}
defer archive.Close()

zipWriter := zip.NewWriter(archive) //第二步,创建一个新的 *Writer 对象
for k, v := range xlsDownloadPath {
w, err1 := zipWriter.Create("设备就餐数据统计/" + xlsFileName[k]) //向 zip 文件中添加一个文件,返回一个待压缩的文件内容应写入的 Writer
if err1 != nil {
logx.Error(err1)
println("<<<<SelfSupportForSchoolDataStatisticsExport4>>>>>Error:::", err1.Error())
panic(err1)
}

f, err1 := os.Open(v) //打开待压缩的文件
if err1 != nil {
logx.Error(err1)
println("<<<<CentralKitchenForSchoolDataStatisticsExport7>>>>>Error:::", err1.Error())
panic(err1)
}

if _, err1 = io.Copy(w, f); err != nil {
logx.Error(err1)
println("<<<<CentralKitchenForSchoolDataStatisticsExport7>>>>>Error:::", err1.Error())
panic(err1)
}
if err1 != nil {
logx.Error(err1)
println("<<<<CentralKitchenForSchoolDataStatisticsExport7>>>>>Error:::", err1.Error())
panic(err1)
}
f.Close()
os.RemoveAll(v) //TODO::移除源文件
}

zipWriter.Close() // 第四步,关闭 zip writer,将所有数据写入指向基础 zip 文件的数据流
if err != nil {
panic(err)
}
break
}

//新增数据
@@ -437,6 +777,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if req.EndDate != "" {
sess.And("central_kitchen_for_school_package_ord.create_at <= ?", req.EndDate)
}
if req.EnterPriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterPriseKind)
}
var m []*db.CentralKitchenForSchoolPackageOrdWithUserIdentity
_, err := sess.
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
@@ -563,6 +906,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if len(req.MealKindList) > 0 {
sess.In("central_kitchen_for_school_user_with_day.kind", req.MealKindList)
}
if req.EnterPriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterPriseKind)
}
var m []*db.CentralKitchenForSchoolUserRefundDayWithData
_, err := sess.
Join("LEFT", "central_kitchen_for_school_user_with_day", "central_kitchen_for_school_user_refund_day.records_id = central_kitchen_for_school_user_with_day.id").
@@ -669,6 +1015,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if len(req.MealKindList) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList)
}
if req.EnterPriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterPriseKind)
}
_, err := sess.
Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no").
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
@@ -875,6 +1224,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if len(req.MealKindList) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList)
}
if req.EnterPriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterPriseKind)
}
_, err := sess.
Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no").
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
@@ -1072,6 +1424,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if len(req.MealKindList) > 0 {
sess.In("central_kitchen_for_school_user_with_day.kind", req.MealKindList)
}
if req.EnterPriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterPriseKind)
}
var m []*db.CentralKitchenForSchoolUserRefundDayWithData
_, err := sess.
Join("LEFT", "central_kitchen_for_school_user_with_day", "central_kitchen_for_school_user_refund_day.records_id = central_kitchen_for_school_user_with_day.id").
@@ -1226,6 +1581,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
//查找数据
var m []model.Enterprise
sess := db.Db.Desc("id")
if req.EnterPriseKind != 0 {
sess.And("kind = ?", req.EnterPriseKind)
}
if req.EnterpriseId != 0 {
sess.And("id = ?", req.EnterpriseId)
}
@@ -1313,6 +1671,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if req.EndDate != "" {
sess.And("central_kitchen_for_school_package_ord.create_at <= ?", req.EndDate)
}
if req.EnterPriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterPriseKind)
}
var m []*db.CentralKitchenForSchoolPackageOrdWithUserIdentity
_, err := sess.
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
@@ -1516,6 +1877,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if len(req.MealKindList) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList)
}
if req.EnterPriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterPriseKind)
}
_, err := sess.
Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no").
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
@@ -1543,29 +1907,36 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
return
}

count1, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, enum.CentralKitchenForSchoolUserWithDayKindForBreakfast, enum.CentralKitchenForSchoolUserWithDayStateForCancel)
if err2 != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
}
count2, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, enum.CentralKitchenForSchoolUserWithDayKindForLunch, enum.CentralKitchenForSchoolUserWithDayStateForCancel)
if err2 != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
}
count3, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, enum.CentralKitchenForSchoolUserWithDayKindForDinner, enum.CentralKitchenForSchoolUserWithDayStateForCancel)
if err2 != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
for _, value := range req.MealKindList {
if value == enum.CentralKitchenForSchoolUserWithDayKindForBreakfast {
count1, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, req.StartDate, req.EndDate, enum.CentralKitchenForSchoolUserWithDayKindForBreakfast, enum.CentralKitchenForSchoolUserWithDayStateForCancel)
if err2 != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
}
list[v.Enterprise.Name][enum.CentralKitchenForSchoolUserWithDayKind(enum.CentralKitchenForSchoolUserWithDayKindForBreakfast).String()] += count1
}
if value == enum.CentralKitchenForSchoolUserWithDayKindForLunch {
count2, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, req.StartDate, req.EndDate, enum.CentralKitchenForSchoolUserWithDayKindForLunch, enum.CentralKitchenForSchoolUserWithDayStateForCancel)
if err2 != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
}
list[v.Enterprise.Name][enum.CentralKitchenForSchoolUserWithDayKind(enum.CentralKitchenForSchoolUserWithDayKindForLunch).String()] += count2
}
if value == enum.CentralKitchenForSchoolUserWithDayKindForDinner {
count3, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, req.StartDate, req.EndDate, enum.CentralKitchenForSchoolUserWithDayKindForDinner, enum.CentralKitchenForSchoolUserWithDayStateForCancel)
if err2 != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
}
list[v.Enterprise.Name][enum.CentralKitchenForSchoolUserWithDayKind(enum.CentralKitchenForSchoolUserWithDayKindForDinner).String()] += count3
}
}

list[v.Enterprise.Name]["count"] += count
list[v.Enterprise.Name][enum.CentralKitchenForSchoolUserWithDayKind(enum.CentralKitchenForSchoolUserWithDayKindForBreakfast).String()] += count1
list[v.Enterprise.Name][enum.CentralKitchenForSchoolUserWithDayKind(enum.CentralKitchenForSchoolUserWithDayKindForLunch).String()] += count2
list[v.Enterprise.Name][enum.CentralKitchenForSchoolUserWithDayKind(enum.CentralKitchenForSchoolUserWithDayKindForDinner).String()] += count3
time.Sleep(20 * time.Millisecond) // 20毫秒
}

@@ -1610,6 +1981,94 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
//将文件保存至服务器
xlsx.SaveAs("./static" + downloadPath)
break
case 10:
//就餐数据统计表
sTime, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local)
eTime, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local)
xls, _ := excelize.OpenFile("./static/template/央厨学校(就餐数据统计表).xlsx")
fileName = "【" + sTime.Format("2006-01-02") + "~" + eTime.Format("2006-01-02") + "】就餐数据统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx"
downloadPath = "/export/central_kitchen_for_school/" + fileName

var list = map[string]map[string]map[string]float64{}
var dates []string

if req.StartDate != "" {
centralKitchenForSchoolUserWithDayDb := db.CentralKitchenForSchoolUserWithDayDb{}
centralKitchenForSchoolUserWithDayDb.Set(0)
diffDays := int(eTime.Sub(sTime).Hours() / 24)
for i := 0; i <= diffDays; i++ {
date := sTime.AddDate(0, 0, i)
dateName := date.Format("2006-01-02")
dates = append(dates, dateName)
for _, vv := range req.MealKindList {
tmpSum, err := centralKitchenForSchoolUserWithDayDb.SumCentralKitchenForSchoolUserWithDayByKind(req.EnterpriseId, dateName, dateName, vv, enum.CentralKitchenForSchoolUserWithDayStateForCancel)
if err != nil {
logx.Error(err)
println("<<<<CentralKitchenForSchoolDataStatisticsExport9>>>>>Error:::", err.Error())
panic(err)
}
tmpCount, err := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByKind(req.EnterpriseId, dateName, dateName, vv, enum.CentralKitchenForSchoolUserWithDayStateForCancel)
if err != nil {
logx.Error(err)
println("<<<<CentralKitchenForSchoolDataStatisticsExport9>>>>>Error:::", err.Error())
panic(err)
}
if list[dateName] == nil {
list[dateName] = map[string]map[string]float64{}
}
if list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()] == nil {
list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()] = map[string]float64{}
}
if list[dateName]["合计"] == nil {
list[dateName]["合计"] = make(map[string]float64)
}

list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()]["sum"] = tmpSum
list[dateName][enum.CentralKitchenForSchoolUserWithDayKind(vv).String()]["count"] = float64(tmpCount)
list[dateName]["合计"]["sum"] += tmpSum
list[dateName]["合计"]["count"] += float64(tmpCount)
}
}
}

//xls.SetSheetRow("", "A1", &titleList)
//sheetIndex := 2 //第一个表是模板表
//xls.NewSheet("sheet1") //1、新建表格
//xls.CopySheet(1, sheetIndex)
j := 4 //表头前三"早餐"行被占用了,只能从第四行开始
var totalMap = map[string]float64{}
for _, date := range dates {
for kk, v := range list {
if date == kk {
xls.SetSheetRow("template", "A"+strconv.Itoa(j), &[]interface{}{kk,
v["早餐"]["count"], v["早餐"]["sum"],
v["午餐"]["count"], v["午餐"]["sum"],
v["晚餐"]["count"], v["晚餐"]["sum"],
v["合计"]["count"], v["合计"]["sum"],
})
totalMap["breakfast_count"] += v["早餐"]["count"]
totalMap["breakfast_sum"] += v["早餐"]["sum"]
totalMap["lunch_count"] += v["午餐"]["count"]
totalMap["lunch_sum"] += v["午餐"]["sum"]
totalMap["dinner_count"] += v["晚餐"]["count"]
totalMap["dinner_sum"] += v["晚餐"]["sum"]
totalMap["total_count"] += v["合计"]["count"]
totalMap["total_sum"] += v["合计"]["sum"]
j++
}
}
}
//xls.DeleteSheet("template") //删除模板表

xls.SetSheetRow("template", "A"+strconv.Itoa(j), &[]interface{}{"总计",
totalMap["breakfast_count"], totalMap["breakfast_sum"],
totalMap["lunch_count"], totalMap["lunch_sum"],
totalMap["dinner_count"], totalMap["dinner_sum"],
totalMap["total_count"], totalMap["total_sum"],
})
//将文件保存至服务器
xls.SaveAs("./static" + downloadPath)
break
}

//新增数据
@@ -1653,6 +2112,10 @@ func CentralKitchenForSchoolDataStatisticsContrast(req md.CentralKitchenForSchoo
if len(req.MealKindList) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList)
}
if req.EnterPriseKind != 0 {
sess.And("enterprise.kind = ?", req.EnterPriseKind)
}

_, err := sess.
Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no").
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").


+ 6
- 0
app/admin/svc/svc_enterprise.go Целия файл

@@ -32,6 +32,12 @@ func EnterpriseList(admin model.Admin, req md.EnterpriseListReq) (m []model.Ente
if req.Kind != 0 {
sess.And("kind = ?", req.Kind)
}
if req.Pvd != 0 {
sess.And("pvd = ?", req.Pvd)
}
if req.Mode != 0 {
sess.And("mode = ?", req.Mode)
}
total, err = sess.FindAndCount(&m)
if err != nil {
return


+ 1
- 1
app/admin/svc/svc_nursing_home.go Целия файл

@@ -16,7 +16,7 @@ func NursingHomeInfo(enterpriseId int) (err error, resp md.NursingHomeInfoResp)
}
resp.Name = enterprise.Name
resp.Memo = enterprise.Memo
resp.Kind = enum.EnterprisePvd(enterprise.Kind).String()
resp.Kind = enum.EnterpriseKind(enterprise.Kind).String()
resp.State = enum.EnterpriseState(enterprise.State).String()

//2、查询`nursing_home_with_spec`


+ 3
- 1
app/admin/svc/svc_self_support_for_school.go Целия файл

@@ -16,7 +16,9 @@ func SelfSupportForSchoolInfo(enterpriseId int) (err error, resp md.SelfSupportF
}
resp.Name = enterprise.Name
resp.Memo = enterprise.Memo
resp.Kind = enum.EnterprisePvd(enterprise.Kind).String()
resp.Kind = enum.EnterpriseKind(enterprise.Kind).String()
resp.Mode = enum.EnterpriseMode(enterprise.Mode).String()
resp.Pvd = enum.EnterprisePvd(enterprise.Pvd).String()
resp.State = enum.EnterpriseState(enterprise.State).String()

//2、统计 "教师"、 "学生"、 "班级" 数量


+ 3
- 1
app/admin/svc/svc_user.go Целия файл

@@ -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


+ 38
- 24
app/customer/hdl/hdl_enterprise.go Целия файл

@@ -26,7 +26,9 @@ func EnterpriseList(c *gin.Context) {
if req.Page == 0 {
req.Page = 10
}
enterprises, total, err := svc.EnterpriseList(req)

platform := c.GetHeader("platform")
enterprises, total, err := svc.EnterpriseList(req, platform)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
@@ -37,20 +39,20 @@ func EnterpriseList(c *gin.Context) {
"total": total,
"kind": []map[string]interface{}{
{
"name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForSchool).String(),
"value": enum.EnterprisePvdByCentralKitchenForSchool,
"name": enum.EnterpriseKind(enum.EnterpriseKindByCentralKitchenForSchool).String(),
"value": enum.EnterpriseKindByCentralKitchenForSchool,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForFactory).String(),
"value": enum.EnterprisePvdByCentralKitchenForFactory,
"name": enum.EnterpriseKind(enum.EnterpriseKindByCentralKitchenForFactory).String(),
"value": enum.EnterpriseKindByCentralKitchenForFactory,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForSchool).String(),
"value": enum.EnterprisePvdBySelfSupportForSchool,
"name": enum.EnterpriseKind(enum.EnterpriseKindBySelfSupportForSchool).String(),
"value": enum.EnterpriseKindBySelfSupportForSchool,
},
{
"name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForFactory).String(),
"value": enum.EnterprisePvdBySelfSupportForFactory,
"name": enum.EnterpriseKind(enum.EnterpriseKindBySelfSupportForFactory).String(),
"value": enum.EnterpriseKindBySelfSupportForFactory,
},
},
}, nil)
@@ -73,21 +75,19 @@ func EnterpriseInfo(c *gin.Context) {

var resp interface{}
//判断单位类型
switch enterprise.Kind {
case enum.EnterprisePvdByCentralKitchenForSchool:
if enterprise.Pvd == enum.EnterprisePvdForOnlinePayment && enterprise.Mode == enum.EnterpriseModeForSchool {
err, resp = svc.CentralKitchenForSchoolInfo(enterpriseId)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
break
case enum.EnterprisePvdByNursingHome:
}
if enterprise.Kind == enum.EnterpriseKindByNursingHome {
err, resp = svc.NursingHomePackageInfo(enterpriseId)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
break
}

sysCfgDb := db.SysCfgDb{}
@@ -98,25 +98,39 @@ func EnterpriseInfo(c *gin.Context) {
"set_center": res,
"enterprise_kind_list": []map[string]interface{}{
{
"name": enum.EnterprisePvd.String(enum.EnterprisePvdByCentralKitchenForSchool),
"value": enum.EnterprisePvdByCentralKitchenForSchool,
"name": enum.EnterpriseKind.String(enum.EnterpriseKindByCentralKitchenForSchool),
"value": enum.EnterpriseKindByCentralKitchenForSchool,
},
{
"name": enum.EnterpriseKind.String(enum.EnterpriseKindByCentralKitchenForFactory),
"value": enum.EnterpriseKindByCentralKitchenForFactory,
},
{
"name": enum.EnterprisePvd.String(enum.EnterprisePvdByCentralKitchenForFactory),
"value": enum.EnterprisePvdByCentralKitchenForFactory,
"name": enum.EnterpriseKind.String(enum.EnterpriseKindBySelfSupportForSchool),
"value": enum.EnterpriseKindBySelfSupportForSchool,
},
{
"name": enum.EnterprisePvd.String(enum.EnterprisePvdBySelfSupportForSchool),
"value": enum.EnterprisePvdBySelfSupportForSchool,
"name": enum.EnterpriseKind.String(enum.EnterpriseKindBySelfSupportForFactory),
"value": enum.EnterpriseKindBySelfSupportForFactory,
},
{
"name": enum.EnterprisePvd.String(enum.EnterprisePvdBySelfSupportForFactory),
"value": enum.EnterprisePvdBySelfSupportForFactory,
"name": enum.EnterpriseKind.String(enum.EnterpriseKindByNursingHome),
"value": enum.EnterpriseKindByNursingHome,
},
},
"user_identity_cert_type_list": []map[string]interface{}{
{
"name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForIdCard),
"value": enum.UserIdentityCertTypeForIdCard,
},
{
"name": enum.EnterprisePvd.String(enum.EnterprisePvdByNursingHome),
"value": enum.EnterprisePvdByNursingHome,
"name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForStudentId),
"value": enum.UserIdentityCertTypeForStudentId,
},
//{
// "name": enum.UserIdentityCertType.String(enum.UserIdentityCertTypeForPassport),
// "value": enum.UserIdentityCertTypeForPassport,
//},
},
}, nil)
return


+ 63
- 0
app/customer/hdl/hdl_login.go Целия файл

@@ -265,3 +265,66 @@ func Register(c *gin.Context) {
}, nil)
return
}

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

// 编译正则表达式
pattern := `^1[3456789]\d{9}$`
r := regexp.MustCompile(pattern)

// 验证手机号码
if !r.MatchString(req.Phone) {
e.OutErr(c, e.ERR, "非法手机号")
return
}

now := time.Now()
userDb := db.UserDb{}
userDb.Set()
user, err := userDb.GetUserByPhone(req.Phone)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err)
return
}
if user == nil {
e.OutErr(c, e.ERR_NO_DATA, "未查詢到相應賬戶記錄!")
return
} else {
user.UpdateAt = now.Format("2006-01-02 15:04:05")
if req.Nickname != "" {
user.Nickname = req.Nickname
}
if req.Avatar != "" {
user.Avatar = req.Avatar
}

if req.UserId != "" {
//支付宝
user.UserId = req.UserId
} else {
//微信
user.OpenId = req.OpenId
user.UnionId = req.UnionId
}
updateAffected, err1 := userDb.UpdateUser(user)
if err1 != nil {
e.OutErr(c, e.ERR_DB_ORM, err1)
return
}
if updateAffected <= 0 {
e.OutErr(c, e.ERR_DB_ORM, "更新用户数据失败")
return
}
}

e.OutSuc(c, "success", nil)
return
}

+ 77
- 69
app/customer/hdl/hdl_user.go Целия файл

@@ -8,6 +8,7 @@ import (
"applet/app/e"
"applet/app/enum"
"applet/app/utils"
"fmt"
"github.com/gin-gonic/gin"
"time"
)
@@ -48,87 +49,94 @@ func UserInfo(c *gin.Context) {
}

now := time.Now()
if v.UserIdentity.Identity == enum.UserIdentityForSelfSupportForStudent || v.UserIdentity.Identity == enum.UserIdentityForSelfSupportForTeacher {
//TODO:: 自营-学生 or 自营-教职员工
sMDate := utils.GetFirstDateOfMonth(now).Format("2006-01-02 15:04:05")
eMDate := utils.GetLastDateOfMonth(now).Format("2006-01-02 15:04:05")
sTDate, eTDate := utils.GetDateTimeRangeStr("today")
monthStatistic, err2 := svc2.SupportUserIdentityOrderStatistic(v.UserIdentity.Id, sMDate, eMDate)
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}
dayStatistic, err2 := svc2.SupportUserIdentityOrderStatistic(v.UserIdentity.Id, sTDate, eTDate)
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}
tmp["month_statistic"] = monthStatistic
tmp["day_statistic"] = dayStatistic

//统计是否存在欠费
arrearsStatistic, err2 := svc2.SupportUserIdentityOrderStatisticForArrears(v.UserIdentity.Id)
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}
tmp["arrears_statistic"] = arrearsStatistic

//查询支付宝扣款账户
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
selfSupportForUserFaceInfoDb.Set(v.UserIdentity.Id)
info, err2 := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo()
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
if v.Enterprise.Pvd == enum.EnterprisePvdForFaceScanPayment && v.Enterprise.Mode == enum.EnterpriseModeForSchool {
fmt.Println(">>>>>platform:::", c.GetHeader("platform"))
if c.GetHeader("platform") == "wx_applet" {
//TODO::微信小程序直接过滤
continue
}

if info == nil {
selfSupportForSchoolInfoDb := db.SelfSupportForSchoolInfoDb{}
selfSupportForSchoolInfoDb.Set(v.UserIdentity.EnterpriseId)
selfSupportForSchoolInfo, err1 := selfSupportForSchoolInfoDb.GetSelfSupportForSchoolInfo()
if err1 != nil {
if v.UserIdentity.Identity == enum.UserIdentityForSelfSupportForWorker {
//TODO::自营-工作人员
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
selfSupportForUserFaceInfoDb.Set(0)
tmp["school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountSchoolFacePassStatus(v.EnterpriseId, "open")
tmp["school_face_payment_num"], _ = selfSupportForUserFaceInfoDb.CountSchoolFacePaymentStatus(v.EnterpriseId, "open")
tmp["concentrate_school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountCollectFaceType(v.EnterpriseId, 2)
tmp["single_school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountCollectFaceType(v.EnterpriseId, 1)
} else {
//TODO:: 自营-学生 or 自营-教职员工
sMDate := utils.GetFirstDateOfMonth(now).Format("2006-01-02 15:04:05")
eMDate := utils.GetLastDateOfMonth(now).Format("2006-01-02 15:04:05")
sTDate, eTDate := utils.GetDateTimeRangeStr("today")
monthStatistic, err2 := svc2.SupportUserIdentityOrderStatistic(v.UserIdentity.Id, sMDate, eMDate)
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}
if selfSupportForSchoolInfo == nil {
e.OutErr(c, e.ERR, "当前学校暂未完成《一脸通行入驻》")
dayStatistic, err2 := svc2.SupportUserIdentityOrderStatistic(v.UserIdentity.Id, sTDate, eTDate)
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}
tmp["month_statistic"] = monthStatistic
tmp["day_statistic"] = dayStatistic

info = &model.SelfSupportForUserFaceInfo{
EnterpriseId: v.UserIdentity.EnterpriseId,
UserIdentityId: v.UserIdentity.Id,
CollectFaceType: 1, //默认个采
SchoolCode: selfSupportForSchoolInfo.SchoolCode,
SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode,
ParentUserId: "",
ParentLogonId: "",
UserId: "",
SchoolFacePassStatus: "CLOSE",
SchoolFacePaymentStatus: "CLOSE",
ConcentrateSchoolFacePassStatus: 1,
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
//统计是否存在欠费
arrearsStatistic, err2 := svc2.SupportUserIdentityOrderStatisticForArrears(v.UserIdentity.Id)
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}
_, err3 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoInsert(info)
if err3 != nil {
e.OutErr(c, e.ERR, err3.Error())
tmp["arrears_statistic"] = arrearsStatistic

//查询支付宝扣款账户
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
selfSupportForUserFaceInfoDb.Set(v.UserIdentity.Id)
info, err2 := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo()
if err2 != nil {
e.OutErr(c, e.ERR, err2.Error())
return
}

if info == nil {
selfSupportForSchoolInfoDb := db.SelfSupportForSchoolInfoDb{}
selfSupportForSchoolInfoDb.Set(v.UserIdentity.EnterpriseId)
selfSupportForSchoolInfo, err1 := selfSupportForSchoolInfoDb.GetSelfSupportForSchoolInfo()
if err1 != nil {
return
}
if selfSupportForSchoolInfo == nil {
e.OutErr(c, e.ERR, "当前学校暂未完成《一脸通行入驻》")
return
}

info = &model.SelfSupportForUserFaceInfo{
EnterpriseId: v.UserIdentity.EnterpriseId,
UserIdentityId: v.UserIdentity.Id,
CollectFaceType: 1, //默认个采
SchoolCode: selfSupportForSchoolInfo.SchoolCode,
SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode,
ParentUserId: "",
ParentLogonId: "",
UserId: "",
SchoolFacePassStatus: "CLOSE",
SchoolFacePaymentStatus: "CLOSE",
ConcentrateSchoolFacePassStatus: 1,
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
}
_, err3 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoInsert(info)
if err3 != nil {
e.OutErr(c, e.ERR, err3.Error())
return
}
}
tmp["parent_logon_id"] = info.ParentLogonId
tmp["collect_face_type"] = info.CollectFaceType
tmp["concentrate_school_face_pass_status"] = info.ConcentrateSchoolFacePassStatus
}
tmp["parent_logon_id"] = info.ParentLogonId
tmp["collect_face_type"] = info.CollectFaceType
tmp["concentrate_school_face_pass_status"] = info.ConcentrateSchoolFacePassStatus
}

if v.UserIdentity.Identity == enum.UserIdentityForSelfSupportForWorker {
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
selfSupportForUserFaceInfoDb.Set(0)
tmp["school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountSchoolFacePassStatus(v.EnterpriseId, "open")
tmp["school_face_payment_num"], _ = selfSupportForUserFaceInfoDb.CountSchoolFacePaymentStatus(v.EnterpriseId, "open")
tmp["concentrate_school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountCollectFaceType(v.EnterpriseId, 2)
tmp["single_school_face_pass_num"], _ = selfSupportForUserFaceInfoDb.CountCollectFaceType(v.EnterpriseId, 1)
}
identityList = append(identityList, tmp)
}



+ 10
- 2
app/customer/hdl/hdl_user_identity.go Целия файл

@@ -44,6 +44,7 @@ func SaveCentralKitchenForSchoolUserIdentity(c *gin.Context) {
Uid: user.Id,
Name: req.Name,
IdNo: req.IdNo,
CertType: enum.UserIdentityCertTypeForIdCard,
Kind: enum.UserIdentityKindForCommon,
Identity: identity,
EnterpriseId: req.EnterpriseId,
@@ -136,9 +137,15 @@ func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) {
now := time.Now()
var identity = enum.UserIdentityForSelfSupportForStudent
var kind = enum.UserIdentityKindForCommon

if req.CertType == 0 {
req.CertType = enum.UserIdentityCertTypeForIdCard
}

if req.Kind == enum.UserIdentityKindForWorker {
kind = enum.UserIdentityKindForWorker
identity = enum.UserIdentityForSelfSupportForWorker
req.CertType = enum.UserIdentityCertTypeForIdCard
} else {
if req.IsTeacher {
identity = enum.UserIdentityForCentralKitchenForTeacher
@@ -148,7 +155,7 @@ func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) {
//1、判断当前身份是否已绑定
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(user.Id)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, req.CertType)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
@@ -164,6 +171,7 @@ func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) {
Uid: user.Id,
Name: req.Name,
IdNo: req.IdNo,
CertType: req.CertType,
Kind: kind,
Identity: identity,
EnterpriseId: req.EnterpriseId,
@@ -294,7 +302,7 @@ func SaveNursingHomeUserIdentity(c *gin.Context) {
//1、判断当前身份是否已绑定
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(user.Id)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, enum.UserIdentityCertTypeForIdCard)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return


+ 30
- 0
app/customer/hdl/self_support_for_school/hdl_faceCollection.go Целия файл

@@ -36,6 +36,15 @@ func EducateSceneTokenQuery(c *gin.Context) {
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey)
var certType string
switch identity.CertType {
case enum.UserIdentityCertTypeForIdCard:
certType = "1"
case enum.UserIdentityCertTypeForStudentId:
certType = "X"
case enum.UserIdentityCertTypeForPassport:
certType = "A"
}
err, info := svc.CurlEducateSceneTokenQuery(md.CurlEducateSceneTokenReq{
Config: struct {
AliAppId string `json:"ali_app_id" label:"支付宝开放平台-小程序-appid"`
@@ -46,6 +55,7 @@ func EducateSceneTokenQuery(c *gin.Context) {
AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey],
AliPublicKey: sysCfg[enum.OpenAppletPublicKey],
},
CertType: certType,
CertNo: identity.IdNo,
StudentName: identity.Name,
OutUserId: utils.IntToStr(identity.Id),
@@ -84,6 +94,15 @@ func EducateSceneTokenCreateForApplet(c *gin.Context) {
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey)
var certType string
switch identity.CertType {
case enum.UserIdentityCertTypeForIdCard:
certType = "1"
case enum.UserIdentityCertTypeForStudentId:
certType = "X"
case enum.UserIdentityCertTypeForPassport:
certType = "A"
}
err, info := svc.CurlEducateSceneTokenCreateForApplet(md.CurlEducateSceneTokenReq{
Config: struct {
AliAppId string `json:"ali_app_id" label:"支付宝开放平台-小程序-appid"`
@@ -94,6 +113,7 @@ func EducateSceneTokenCreateForApplet(c *gin.Context) {
AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey],
AliPublicKey: sysCfg[enum.OpenAppletPublicKey],
},
CertType: certType,
CertNo: identity.IdNo,
StudentName: identity.Name,
OutUserId: utils.IntToStr(identity.Id),
@@ -195,6 +215,15 @@ func EducateSceneTokenCreateForConcentratedCollectApplet(c *gin.Context) {
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey)
var certType string
switch identity.CertType {
case enum.UserIdentityCertTypeForIdCard:
certType = "1"
case enum.UserIdentityCertTypeForStudentId:
certType = "X"
case enum.UserIdentityCertTypeForPassport:
certType = "A"
}
err, info := svc.CurlEducateSceneTokenCreateForConcentratedCollectApplet(md.CurlEducateSceneTokenReq{
Config: struct {
AliAppId string `json:"ali_app_id" label:"支付宝开放平台-小程序-appid"`
@@ -205,6 +234,7 @@ func EducateSceneTokenCreateForConcentratedCollectApplet(c *gin.Context) {
AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey],
AliPublicKey: sysCfg[enum.OpenAppletPublicKey],
},
CertType: certType,
CertNo: identity.IdNo,
StudentName: identity.Name,
OutUserId: utils.IntToStr(identity.Id),


+ 20
- 0
app/customer/md/md_curl_smart_pay.go Целия файл

@@ -74,6 +74,7 @@ type CurlEducateSceneTokenReq struct {
AliPrivateKey string `json:"ali_private_key" label:"支付宝开放平台-小程序-应用私钥"`
AliPublicKey string `json:"ali_public_key" label:"支付宝开放平台-小程序-支付宝公钥"`
} `json:"config" label:"配置信息"`
CertType string `json:"cert_type" label:"证件类型"`
CertNo string `json:"cert_no" label:"身份证号码"`
StudentName string `json:"student_name" label:"姓名"`
OutUserId string `json:"out_user_id" label:"服务商内部用户唯一ID,用于与支付宝用户 ID 进行关联"`
@@ -87,6 +88,7 @@ type CurlEducateSceneKidsCloseReq struct {
AliPrivateKey string `json:"ali_private_key" label:"支付宝开放平台-小程序-应用私钥"`
AliPublicKey string `json:"ali_public_key" label:"支付宝开放平台-小程序-支付宝公钥"`
} `json:"config" label:"配置信息"`
CertType string `json:"cert_type" label:"证件类型"`
CertNo string `json:"cert_no" label:"身份证号码"`
UserId string `json:"user_id" label:"刷脸用户的UID"`
ParentUid string `json:"parent_uid" label:"开通一脸通行的支付宝UID,如果是家长为学生代开通,则为家长的UID"`
@@ -148,3 +150,21 @@ type CurlAlipayPlanetEcocampusApiDebtCancel struct {
OutOrderNo string `json:"out_order_no" label:"外部订单号"`
MerchantCode string `json:"merchant_code" label:"商户编号"`
}

type CurlAlipayPlanetEcocampusApiRosterConsumeLimit struct {
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:"单日笔数上限 功能开关"`
}

+ 1
- 0
app/customer/md/md_user_identity.go Целия файл

@@ -23,6 +23,7 @@ type SaveSelfSupportForSchoolUserIdentityReq struct {
IsTeacher bool `json:"is_teacher" label:"是否教师"`
Name string `json:"name" binding:"required" label:"姓名"`
IdNo string `json:"id_no" binding:"required" label:"身份证号码"`
CertType int `json:"cert_type" label:"证件类型(1:身份证 2:学工号 3:护照)"`
GradeId int `json:"grade_id" label:"年级id"`
ClassId int `json:"class_id" label:"班级id"`
}


+ 20
- 6
app/customer/svc/order/svc_central_kitchen_for_school_order.go Целия файл

@@ -14,8 +14,10 @@ import (
)

func OrderList(req md.CentralKitchenForSchoolOrderListReq, platform string) (m []model.CentralKitchenForSchoolPackageOrd, total int64, err error) {
sess := db.Db.Desc("id").Where("user_identity_id =?", req.UserIdentityId).
And("create_at >= ? And create_at <= ?", req.StartDate, req.EndDate).Limit(req.Limit, (req.Page-1)*req.Limit)
sess := db.Db.Desc("id").Where("user_identity_id =?", req.UserIdentityId).Limit(req.Limit, (req.Page-1)*req.Limit)
if req.StartDate != "" && req.EndDate != "" {
sess.And("create_at >= ? And create_at <= ?", req.StartDate, req.EndDate)
}
sess.And("ord_state = ?", req.OrdState)
if req.OrdState == enum.CentralKitchenForSchoolPackageOrdOrdStateForWait {
if platform == "alipay_applet" {
@@ -35,16 +37,28 @@ func OrderList(req md.CentralKitchenForSchoolOrderListReq, platform string) (m [

func OrderStatistic(req md.CentralKitchenForSchoolOrderListReq, platform string) (total float64, err error) {
var sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+
"user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState)

"user_identity_id = '%d' and ord_state = '%d'", req.UserIdentityId, req.OrdState)
if req.StartDate != "" && req.EndDate != "" {
sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+
"user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState)
}
if req.OrdState == enum.CentralKitchenForSchoolPackageOrdOrdStateForWait {
if platform == "alipay_applet" {
sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+
"user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForAli)
"user_identity_id = '%d' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.OrdState, enum2.PayWayForAli)

if req.StartDate != "" && req.EndDate != "" {
sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+
"user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForAli)
}
}
if platform == "wx_applet" {
sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+
"user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForWx)
"user_identity_id = '%d' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.OrdState, enum2.PayWayForWx)
if req.StartDate != "" && req.EndDate != "" {
sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+
"user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForWx)
}
}
}



+ 33
- 3
app/customer/svc/svc_curl_smart_pay.go Целия файл

@@ -183,7 +183,7 @@ func CurlEducateSceneTokenQuery(args md.CurlEducateSceneTokenReq, userIdentity *
"school_std_code": args.SchoolStdCode,
"student_name": args.StudentName,
"out_user_id": args.OutUserId,
"cert_type": "1",
"cert_type": args.CertType,
"sub_code": "SCHOOL_FACE_PASS_QUERY",
}), nil)
if err1 != nil {
@@ -422,7 +422,7 @@ func CurlEducateSceneTokenCreateForApplet(args md.CurlEducateSceneTokenReq) (err
"school_std_code": args.SchoolStdCode,
"student_name": args.StudentName,
"out_user_id": args.OutUserId,
"cert_type": "1",
"cert_type": args.CertType,
"sub_code": "SCHOOL_FACE_PASS_NAVIGATE",
}), nil)
if err != nil {
@@ -467,7 +467,7 @@ func CurlEducateSceneTokenCreateForConcentratedCollectApplet(args md.CurlEducate
"school_std_code": args.SchoolStdCode,
"student_name": args.StudentName,
"out_user_id": args.OutUserId,
"cert_type": "1",
"cert_type": args.CertType,
"sub_code": "SCHOOL_PAYMENT_REMOTE_OPEN_ACCOUNT",
"operator_user_id": args.OperatorUserId, //采集人员的支付宝会员标识。(当sub_code为SCHOOL_PAYMENT_REMOTE_OPEN_ACCOUNT时,当前参数必选)
}), nil)
@@ -703,3 +703,33 @@ func CurlAlipayPlanetEcocampusApiDebtCancel(args md.CurlAlipayPlanetEcocampusApi
}
return nil, result.Data
}

func CurlAlipayPlanetEcocampusApiRosterConsumeLimit(args md.CurlAlipayPlanetEcocampusApiRosterConsumeLimit) (err error, resp interface{}) {
url := cfg.SmartCanteenPay + "/alipay/bPass/alipayPlanetEcocampusApiRosterConsumeLimit"
utils.FilePutContents("CurlAlipayPlanetEcocampusApiRosterConsumeLimit", utils.SerializeStr(map[string]interface{}{
"args": args,
}))
bytes, err := utils.CurlPost(url, utils.Serialize(args), nil)
if err != nil {
return
}
var result struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
utils.FilePutContents("CurlAlipayPlanetEcocampusApiRosterConsumeLimit", utils.SerializeStr(result))
err = json.Unmarshal(bytes, &result)
if err != nil {
return
}
if result.Code != 0 {
if result.Msg != "" {
err = errors.New(result.Msg)
return
}
err = errors.New("请求智慧餐厅支付 异常/失败")
return
}
return nil, result.Data
}

+ 5
- 1
app/customer/svc/svc_enterprise.go Целия файл

@@ -4,10 +4,14 @@ import (
"applet/app/customer/md"
"applet/app/db"
"applet/app/db/model"
"applet/app/enum"
)

func EnterpriseList(req md.EnterpriseListReq) (m []model.Enterprise, total int64, err error) {
func EnterpriseList(req md.EnterpriseListReq, platform string) (m []model.Enterprise, total int64, err error) {
eg := db.Db.Where("1=1")
if platform == "wx_applet" {
eg.And("pvd != ? ", enum.EnterprisePvdForFaceScanPayment).Or("pvd = ? and mode !=?", enum.EnterprisePvdForFaceScanPayment, enum.EnterpriseModeForSchool)
}
if req.Name != "" {
eg.And("name like ?", "%"+req.Name+"%")
}


+ 40
- 2
app/db/db_central_kitchen_for_school_user_with_day.go Целия файл

@@ -91,12 +91,50 @@ func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb
return count, nil
}

func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(ordNo string, kind, state int) (count int64, err error) {
func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDayByOrdNoAndKind(ordNo, startDate, endDate string, kind, state int) (count int64, err error) {
var m model.CentralKitchenForSchoolUserWithDay
count, err = centralKitchenForSchoolUserWithDayDb.Db.Where("ord_no =?", ordNo).And("kind =?", kind).And("state !=?", state).Count(&m)
sDate, _ := time.ParseInLocation("2006-01-02 15:04:05", startDate, time.Local)
eDate, _ := time.ParseInLocation("2006-01-02 15:04:05", endDate, time.Local)

count, err = centralKitchenForSchoolUserWithDayDb.Db.Where("ord_no =?", ordNo).And("kind =?", kind).
And("date >= ?", sDate.Format("2006-01-02")).And("date <= ?", eDate.Format("2006-01-02")).
And("state !=?", state).
Count(&m)
return count, nil
}

func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) SumCentralKitchenForSchoolUserWithDayByKind(enterpriseId int, startDate, endDate string, kind, state int) (sum float64, err error) {
var m model.CentralKitchenForSchoolUserWithDay
if enterpriseId != 0 {
sum, err = centralKitchenForSchoolUserWithDayDb.Db.Where("kind =?", kind).
And("date >= ?", startDate).And("date <= ?", endDate).And("enterprise_id =?", enterpriseId).
And("state !=?", state).
Sum(&m, "amount")
} else {
sum, err = centralKitchenForSchoolUserWithDayDb.Db.Where("kind =?", kind).
And("date >= ?", startDate).And("date <= ?", endDate).
And("state !=?", state).
Sum(&m, "amount")
}
return sum, nil
}

func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDayByKind(enterpriseId int, startDate, endDate string, kind, state int) (sum int64, err error) {
var m model.CentralKitchenForSchoolUserWithDay
if enterpriseId != 0 {
sum, err = centralKitchenForSchoolUserWithDayDb.Db.Where("kind =?", kind).
And("date >= ?", startDate).And("date <= ?", endDate).And("enterprise_id =?", enterpriseId).
And("state !=?", state).
Count(&m)
} else {
sum, err = centralKitchenForSchoolUserWithDayDb.Db.Where("kind =?", kind).
And("date >= ?", startDate).And("date <= ?", endDate).
And("state !=?", state).
Count(&m)
}
return sum, nil
}

func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDay(ordNo, startDate, endDate string, kind int) (count int64, err error) {
var m model.CentralKitchenForSchoolUserWithDay
count, err = centralKitchenForSchoolUserWithDayDb.Db.Where("ord_no =?", ordNo).


+ 9
- 0
app/db/db_self_support_for_school_ord.go Целия файл

@@ -106,3 +106,12 @@ type SelfSupportForSchoolOrdWithUserIdentity struct {
func (SelfSupportForSchoolOrdWithUserIdentity) TableName() string {
return "self_support_for_school_ord"
}

type SelfSupportForSchoolOrdWithUserIdentityV2 struct {
model.SelfSupportForSchoolOrd `xorm:"extends"`
model.Enterprise `xorm:"extends"`
}

func (SelfSupportForSchoolOrdWithUserIdentityV2) TableName() string {
return "self_support_for_school_ord"
}

+ 89
- 0
app/db/db_self_support_for_user_face_info.go.go Целия файл

@@ -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"
}

+ 2
- 2
app/db/db_user_identity.go Целия файл

@@ -30,9 +30,9 @@ func (userIdentityDb *UserIdentityDb) GetUserIdentity(id int) (m *model.UserIden
return m, nil
}

func (userIdentityDb *UserIdentityDb) UserIdentityExist(enterpriseId int, idNo string) (m *model.UserIdentity, err error) {
func (userIdentityDb *UserIdentityDb) UserIdentityExist(enterpriseId int, idNo string, certType int) (m *model.UserIdentity, err error) {
m = new(model.UserIdentity)
has, err := userIdentityDb.Db.Where("enterprise_id =?", enterpriseId).And("id_no =?", idNo).Get(m)
has, err := userIdentityDb.Db.Where("enterprise_id =?", enterpriseId).And("id_no =?", idNo).And("cert_type =?", certType).Get(m)
if err != nil {
return nil, logx.Error(err)
}


+ 2
- 1
app/db/model/enterprise.go Целия файл

@@ -3,7 +3,8 @@ package model
type Enterprise struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"`
Pvd int32 `json:"pvd" xorm:"not null default 1 comment('场景(1:央厨配送 2:自营食堂)') TINYINT(1)"`
Pvd int32 `json:"pvd" xorm:"not null default 1 comment('消费场景(1:在线支付 2:刷脸支付)') TINYINT(1)"`
Mode int32 `json:"mode" xorm:"not null default 1 comment('模式(1:学校 2:工厂 3:养老院)') TINYINT(1)"`
Kind int32 `json:"kind" xorm:"not null default 1 comment('种类(1:央厨-学校 2:央厨-工厂 3:自营-学校 4:自营-工厂 5:养老院)') TINYINT(1)"`
CompanyId int `json:"company_id" xorm:"not null default 0 comment('所属公司id') INT(11)"`
State int32 `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"`


+ 1
- 0
app/db/model/self_support_for_school_info.go Целия файл

@@ -6,6 +6,7 @@ type SelfSupportForSchoolInfo struct {
SchoolCode string `json:"school_code" xorm:"not null default '' comment('学校内标') VARCHAR(255)"`
SchoolStdCode string `json:"school_std_code" xorm:"not null default '' comment('学校外标') VARCHAR(255)"`
GroupKey string `json:"group_key" xorm:"not null default '' comment('学校人脸库ID') VARCHAR(255)"`
SchoolName string `json:"school_name" xorm:"not null default '' VARCHAR(255)"`
Memo string `json:"memo" xorm:"not null default '' VARCHAR(255)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`


+ 15
- 0
app/db/model/self_support_for_user_consume_limit.go Целия файл

@@ -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"`
}

+ 1
- 0
app/db/model/user_identity.go Целия файл

@@ -7,6 +7,7 @@ type UserIdentity struct {
IdNo string `json:"id_no" xorm:"not null default '' comment('身份证号码') VARCHAR(255)"`
Kind int `json:"kind" xorm:"not null default 1 comment('类型(1:普通用户 2:工作人员)') TINYINT(1)"`
Identity int `json:"identity" xorm:"not null default 1 comment('身份类型(1:央厨-学生 2:央厨-教职员工 3:央厨-工作人员 4:自营-学生 5:自营-教职员工 6:自营-工作人员 7:养老院-普通用户)') TINYINT(1)"`
CertType int `json:"cert_type" xorm:"not null default 1 comment('证件类型(1:身份证 2:学工号 3:护照)') TINYINT(1)"`
EnterpriseId int `json:"enterprise_id" xorm:"not null default 0 comment('所属单位id') INT(11)"`
State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注信息') VARCHAR(244)"`


+ 51
- 12
app/enum/enum_enterprise.go Целия файл

@@ -18,27 +18,66 @@ func (gt EnterpriseState) String() string {
}
}

type EnterprisePvd int32
type EnterpriseKind int32

const (
EnterprisePvdByCentralKitchenForSchool = 1
EnterprisePvdByCentralKitchenForFactory = 2
EnterprisePvdBySelfSupportForSchool = 3
EnterprisePvdBySelfSupportForFactory = 4
EnterprisePvdByNursingHome = 5
EnterpriseKindByCentralKitchenForSchool = 1
EnterpriseKindByCentralKitchenForFactory = 2
EnterpriseKindBySelfSupportForSchool = 3
EnterpriseKindBySelfSupportForFactory = 4
EnterpriseKindByNursingHome = 5
)

func (gt EnterprisePvd) String() string {
func (gt EnterpriseKind) String() string {
switch gt {
case EnterprisePvdByCentralKitchenForSchool:
case EnterpriseKindByCentralKitchenForSchool:
return "央厨-学校"
case EnterprisePvdByCentralKitchenForFactory:
case EnterpriseKindByCentralKitchenForFactory:
return "央厨-工厂"
case EnterprisePvdBySelfSupportForSchool:
case EnterpriseKindBySelfSupportForSchool:
return "自营-学校"
case EnterprisePvdBySelfSupportForFactory:
case EnterpriseKindBySelfSupportForFactory:
return "自营-工厂"
case EnterprisePvdByNursingHome:
case EnterpriseKindByNursingHome:
return "养老院"
default:
return "未知"
}
}

type EnterprisePvd int32

const (
EnterprisePvdForOnlinePayment = 1
EnterprisePvdForFaceScanPayment = 2
)

func (gt EnterprisePvd) String() string {
switch gt {
case EnterprisePvdForOnlinePayment:
return "在线支付"
case EnterprisePvdForFaceScanPayment:
return "刷脸支付"
default:
return "未知"
}
}

type EnterpriseMode int32

const (
EnterpriseModeForSchool = 1
EnterpriseModeForFactory = 2
EnterpriseModeForNursingHome = 3
)

func (gt EnterpriseMode) String() string {
switch gt {
case EnterpriseModeForSchool:
return "学校"
case EnterpriseModeForFactory:
return "工厂"
case EnterpriseModeForNursingHome:
return "养老院"
default:
return "未知"


+ 34
- 0
app/enum/enum_user_identity.go Целия файл

@@ -68,3 +68,37 @@ func (gt UserIdentityState) String() string {
return "未知"
}
}

type UserIdentityCertType int32

const (
UserIdentityCertTypeForIdCard = 1
UserIdentityCertTypeForStudentId = 2
UserIdentityCertTypeForPassport = 3
)

func (gt UserIdentityCertType) String() string {
switch gt {
case UserIdentityCertTypeForIdCard:
return "身份证"
case UserIdentityCertTypeForStudentId:
return "学工号"
case UserIdentityCertTypeForPassport:
return "护照"
default:
return "未知"
}
}

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

+ 6
- 2
app/router/admin_router.go Целия файл

@@ -77,8 +77,10 @@ func rOss(r *gin.RouterGroup) {
}

func rSetCenter(r *gin.RouterGroup) {
r.GET("/get", hdl2.GetCenter) // 设置中心-获取
r.POST("/set", hdl2.SetCenter) // 设置中心-设置
r.GET("/get", hdl2.GetCenter) // 设置中心-在线支付(学校)获取
r.POST("/set", hdl2.SetCenter) // 设置中心-在线支付(学校)设置
r.GET("/getForNursingHome", hdl2.GetForNursingHome) // 设置中心-在线支付(养老院)获取
r.POST("/setForNursingHome", hdl2.SetForNursingHome) // 设置中心-在线支付(养老院)设置
}

func rAuditCenter(r *gin.RouterGroup) {
@@ -219,6 +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.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) //"自营-学校"订单欠费催缴


+ 4
- 3
app/router/customer_router.go Целия файл

@@ -35,9 +35,10 @@ func CustomerInit(r *gin.RouterGroup) {
r.POST("/register", hdl.Register)
r.POST("/aesDecrypt", hdl.AesDecrypt) //TODO::专门给解密支付宝手机号
r.POST("/systemOauthToken", hdl.SystemOauthToken)
r.GET("/getSysCfg", hdl.GetSysCfg) //获取基础配置
r.Use(mw.Auth) //检测登录状态
r.GET("/userInfo", hdl.UserInfo) //用户信息
r.GET("/getSysCfg", hdl.GetSysCfg) //获取基础配置
r.Use(mw.Auth) //检测登录状态
r.GET("/userInfo", hdl.UserInfo) //用户信息
r.POST("/updateUserInfo", hdl.UpdateUser) //修改用户信息

r.Group("/enterprise")
{


Двоични данни
Целия файл


Двоични данни
Целия файл


Зареждане…
Отказ
Запис