|
|
|
@ -193,6 +193,26 @@ func (s *orderService) GetOrderByToken(token string) (*model.Order, error) {
|
|
|
|
|
return &order, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *orderService) GetOrderByOrderSn(orderSn string) (*model.Order, error) {
|
|
|
|
|
order := model.Order{}
|
|
|
|
|
err := global.DB.
|
|
|
|
|
Preload("User").
|
|
|
|
|
Preload("Project").
|
|
|
|
|
Preload("Applicant").
|
|
|
|
|
Preload("Assured").
|
|
|
|
|
Where("order_sn", orderSn).
|
|
|
|
|
First(&order).
|
|
|
|
|
Error
|
|
|
|
|
if err != nil {
|
|
|
|
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
|
|
|
return nil, e.NewError("记录不存在")
|
|
|
|
|
} else {
|
|
|
|
|
return nil, e.NewError("数据异常")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return &order, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *orderService) AddSignLog(orderSn string, param signer.UploadParam) (*model.SignLog, error) {
|
|
|
|
|
var err error
|
|
|
|
|
isUploadPdf := 1
|
|
|
|
@ -503,7 +523,16 @@ func (orderService) buildOrdersExcel(orders []model.Order, sheet string, f *exce
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (orderService) SaveOrderResult(data zking.PushCallbackData) (*model.OrderResult, error) {
|
|
|
|
|
func (s *orderService) SaveOrderResult(data zking.PushCallbackData) (*model.OrderResult, error) {
|
|
|
|
|
if data.OrderSn == "" {
|
|
|
|
|
return nil, e.NewError("参数错误")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_, err := s.GetOrderByOrderSn(data.OrderSn)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
orderResult := model.OrderResult{}
|
|
|
|
|
orderResult.OrderSn = data.OrderSn
|
|
|
|
|
orderResult.PolicyNo = data.PolicyNo
|
|
|
|
@ -520,7 +549,7 @@ func (orderService) SaveOrderResult(data zking.PushCallbackData) (*model.OrderRe
|
|
|
|
|
orderResult.MinPremium = data.MinPremium
|
|
|
|
|
orderResult.Rate = data.Rate
|
|
|
|
|
orderResult.ServiceAmount = data.ServiceAmount
|
|
|
|
|
err := global.DB.Save(&orderResult).Error
|
|
|
|
|
err = global.DB.Save(&orderResult).Error
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|