处理审核失败的情况
This commit is contained in:
parent
12c5379d78
commit
b314fb22f6
@ -1288,86 +1288,89 @@ func (r *UserDoctorService) PutMulti(doctorId int64, req requests.PutMulti) (boo
|
||||
return false, errors.New("科室错误")
|
||||
}
|
||||
|
||||
if userCaCert == nil {
|
||||
// 申请云证书
|
||||
cloudCertRequestData := &ca.AddCloudCertRequest{
|
||||
EntityId: strconv.FormatInt(userDoctor.UserId, 10),
|
||||
EntityType: "Personal",
|
||||
PersonalPhone: user.Mobile,
|
||||
PersonalName: userDoctorInfo.CardName,
|
||||
PersonalIdNumber: userDoctorInfo.CardNum,
|
||||
OrgName: "",
|
||||
OrgNumber: "",
|
||||
Pin: strconv.FormatInt(userDoctor.UserId, 10),
|
||||
OrgDept: hospitalDepartment.DepartmentName, // // 卫生证书:医院部门
|
||||
Province: "四川省",
|
||||
Locality: "成都市",
|
||||
AuthType: "实人认证",
|
||||
AuthTime: strconv.FormatInt(time.Now().Unix(), 10),
|
||||
AuthResult: "认证通过",
|
||||
AuthNoticeType: "数字证书申请告知",
|
||||
}
|
||||
// 处理审核拒绝的情况
|
||||
if req.MultiPointStatus == 1 {
|
||||
if userCaCert == nil {
|
||||
// 申请云证书
|
||||
cloudCertRequestData := &ca.AddCloudCertRequest{
|
||||
EntityId: strconv.FormatInt(userDoctor.UserId, 10),
|
||||
EntityType: "Personal",
|
||||
PersonalPhone: user.Mobile,
|
||||
PersonalName: userDoctorInfo.CardName,
|
||||
PersonalIdNumber: userDoctorInfo.CardNum,
|
||||
OrgName: "",
|
||||
OrgNumber: "",
|
||||
Pin: strconv.FormatInt(userDoctor.UserId, 10),
|
||||
OrgDept: hospitalDepartment.DepartmentName, // // 卫生证书:医院部门
|
||||
Province: "四川省",
|
||||
Locality: "成都市",
|
||||
AuthType: "实人认证",
|
||||
AuthTime: strconv.FormatInt(time.Now().Unix(), 10),
|
||||
AuthResult: "认证通过",
|
||||
AuthNoticeType: "数字证书申请告知",
|
||||
}
|
||||
|
||||
cloudCertResponse, err := ca.AddCloudCert(cloudCertRequestData)
|
||||
if err != nil || cloudCertResponse == nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
cloudCertResponse, err := ca.AddCloudCert(cloudCertRequestData)
|
||||
if err != nil || cloudCertResponse == nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 新增ca监管证书表
|
||||
userCaCert := &model.UserCaCert{
|
||||
UserId: &userDoctor.UserId,
|
||||
IsSystem: 0,
|
||||
Type: 1,
|
||||
CertBase64: cloudCertResponse.CertBase64,
|
||||
CertChainP7: cloudCertResponse.CertP7,
|
||||
CertSerialNumber: cloudCertResponse.CertSerialnumber,
|
||||
CaPin: strconv.FormatInt(userDoctor.UserId, 10),
|
||||
IsSignConfig: 0,
|
||||
SignConfig: "",
|
||||
}
|
||||
// 新增ca监管证书表
|
||||
userCaCert := &model.UserCaCert{
|
||||
UserId: &userDoctor.UserId,
|
||||
IsSystem: 0,
|
||||
Type: 1,
|
||||
CertBase64: cloudCertResponse.CertBase64,
|
||||
CertChainP7: cloudCertResponse.CertP7,
|
||||
CertSerialNumber: cloudCertResponse.CertSerialnumber,
|
||||
CaPin: strconv.FormatInt(userDoctor.UserId, 10),
|
||||
IsSignConfig: 0,
|
||||
SignConfig: "",
|
||||
}
|
||||
|
||||
userCaCert, err = userCaCertDao.AddUserCaCert(tx, userCaCert)
|
||||
if err != nil || userCaCert == nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
} else {
|
||||
// 修改云证书
|
||||
cloudCertRequestData := &ca.EditCloudCertRequestData{
|
||||
EntityId: strconv.FormatInt(userDoctor.UserId, 10),
|
||||
EntityType: "Personal",
|
||||
PersonalPhone: user.Mobile,
|
||||
PersonalName: userDoctorInfo.CardName,
|
||||
PersonalIdNumber: userDoctorInfo.CardNum,
|
||||
OrgName: "",
|
||||
OrgNumber: "",
|
||||
Pin: strconv.FormatInt(userDoctor.UserId, 10),
|
||||
OrgDept: hospitalDepartment.DepartmentName, // // 卫生证书:医院部门
|
||||
Province: "四川省",
|
||||
Locality: "成都市",
|
||||
AuthType: "实人认证",
|
||||
AuthTime: strconv.FormatInt(time.Now().Unix(), 10),
|
||||
AuthResult: "认证通过",
|
||||
AuthNoticeType: "数字证书变更告知",
|
||||
}
|
||||
userCaCert, err = userCaCertDao.AddUserCaCert(tx, userCaCert)
|
||||
if err != nil || userCaCert == nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
} else {
|
||||
// 修改云证书
|
||||
cloudCertRequestData := &ca.EditCloudCertRequestData{
|
||||
EntityId: strconv.FormatInt(userDoctor.UserId, 10),
|
||||
EntityType: "Personal",
|
||||
PersonalPhone: user.Mobile,
|
||||
PersonalName: userDoctorInfo.CardName,
|
||||
PersonalIdNumber: userDoctorInfo.CardNum,
|
||||
OrgName: "",
|
||||
OrgNumber: "",
|
||||
Pin: strconv.FormatInt(userDoctor.UserId, 10),
|
||||
OrgDept: hospitalDepartment.DepartmentName, // // 卫生证书:医院部门
|
||||
Province: "四川省",
|
||||
Locality: "成都市",
|
||||
AuthType: "实人认证",
|
||||
AuthTime: strconv.FormatInt(time.Now().Unix(), 10),
|
||||
AuthResult: "认证通过",
|
||||
AuthNoticeType: "数字证书变更告知",
|
||||
}
|
||||
|
||||
cloudCertResponse, err := ca.EditCloudCert(cloudCertRequestData)
|
||||
if err != nil || cloudCertResponse == nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
cloudCertResponse, err := ca.EditCloudCert(cloudCertRequestData)
|
||||
if err != nil || cloudCertResponse == nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 修改ca监管证书表
|
||||
userCaCertDao := dao.UserCaCert{}
|
||||
data := make(map[string]interface{})
|
||||
data["cert_base64"] = cloudCertResponse.CertBase64
|
||||
data["cert_chain_p7"] = cloudCertResponse.CertP7
|
||||
data["cert_serial_number"] = cloudCertResponse.CertSerialnumber
|
||||
err = userCaCertDao.EditUserCaCertById(tx, userCaCert.CertId, data)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New("审核失败")
|
||||
// 修改ca监管证书表
|
||||
userCaCertDao := dao.UserCaCert{}
|
||||
data := make(map[string]interface{})
|
||||
data["cert_base64"] = cloudCertResponse.CertBase64
|
||||
data["cert_chain_p7"] = cloudCertResponse.CertP7
|
||||
data["cert_serial_number"] = cloudCertResponse.CertSerialnumber
|
||||
err = userCaCertDao.EditUserCaCertById(tx, userCaCert.CertId, data)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New("审核失败")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user