|
|
|
@ -400,11 +400,15 @@ func (s *orderService) PostToZking(orderNo string) (*zking.Result, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *orderService) SaveClaim(param suixing.ClaimParam) (*model.Claim, error) {
|
|
|
|
|
claim := model.Claim{}
|
|
|
|
|
err := global.DB.Where("policy_no", param.Data.PolicyNo).First(&claim).Error
|
|
|
|
|
if err != nil && !e.Is(err, gorm.ErrRecordNotFound) {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
fileList, err := json.Marshal(param.Data.FileList)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
claim := model.Claim{}
|
|
|
|
|
claim.PolicyNo = param.Data.PolicyNo
|
|
|
|
|
claim.BankName = param.Data.BankName
|
|
|
|
|
claim.AccountName = param.Data.AccountName
|
|
|
|
@ -460,11 +464,15 @@ func (s *orderService) ZkingClaim(claim *model.Claim) (*zking.Result, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *orderService) SaveRevoke(param suixing.RevokeParam) (*model.Revoke, error) {
|
|
|
|
|
revoke := model.Revoke{}
|
|
|
|
|
err := global.DB.Where("policy_no", param.Data.PolicyNo).First(&revoke).Error
|
|
|
|
|
if err != nil && !e.Is(err, gorm.ErrRecordNotFound) {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
fileList, err := json.Marshal(param.Data.FileList)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
revoke := model.Revoke{}
|
|
|
|
|
revoke.PolicyNo = param.Data.PolicyNo
|
|
|
|
|
revoke.BankName = param.Data.BankName
|
|
|
|
|
revoke.AccountName = param.Data.AccountName
|
|
|
|
@ -568,65 +576,75 @@ func (s *orderService) buildQuery(req manage.OrderQueryRequest) *gorm.DB {
|
|
|
|
|
if req.OrderSn != "" {
|
|
|
|
|
tx = tx.Where("order_sn", req.OrderSn)
|
|
|
|
|
}
|
|
|
|
|
if req.OrderNo != "" {
|
|
|
|
|
tx = tx.Where("order_no", req.OrderNo)
|
|
|
|
|
}
|
|
|
|
|
if req.InsureTimeStart != "" && req.InsureTimeEnd != "" {
|
|
|
|
|
startInsureTime := req.InsureTimeStart + " 00:00:00"
|
|
|
|
|
endInsureTime := req.InsureTimeEnd + " 23:59:59"
|
|
|
|
|
var orderSns []string
|
|
|
|
|
global.DB.Model(&model.OrderResult{}).Where("created_at >= ?", startInsureTime).Where("created_at <= ?", endInsureTime).Pluck("order_sn", &orderSns)
|
|
|
|
|
tx = tx.Where("order_sn in (?)", orderSns)
|
|
|
|
|
}
|
|
|
|
|
if req.AssuredName != "" {
|
|
|
|
|
var orderSns []string
|
|
|
|
|
global.DB.Model(&model.Assured{}).Where("assured_name", req.AssuredName).Pluck("order_sn", &orderSns)
|
|
|
|
|
tx = tx.Where("order_sn", orderSns)
|
|
|
|
|
tx = tx.Where("order_sn in (?)", orderSns)
|
|
|
|
|
}
|
|
|
|
|
if req.AssuredCreditCode != "" {
|
|
|
|
|
var orderSns []string
|
|
|
|
|
global.DB.Model(&model.Assured{}).Where("credit_code", req.AssuredCreditCode).Pluck("order_sn", &orderSns)
|
|
|
|
|
tx = tx.Where("order_sn", orderSns)
|
|
|
|
|
tx = tx.Where("order_sn in (?)", orderSns)
|
|
|
|
|
}
|
|
|
|
|
if req.AssuredContactName != "" {
|
|
|
|
|
var orderSns []string
|
|
|
|
|
global.DB.Model(&model.Assured{}).Where("contact_name", req.AssuredContactName).Pluck("order_sn", &orderSns)
|
|
|
|
|
tx = tx.Where("order_sn", orderSns)
|
|
|
|
|
tx = tx.Where("order_sn in (?)", orderSns)
|
|
|
|
|
}
|
|
|
|
|
if req.AssuredContactMobile != "" {
|
|
|
|
|
var orderSns []string
|
|
|
|
|
global.DB.Model(&model.Assured{}).Where("contact_mobile", req.AssuredContactMobile).Pluck("order_sn", &orderSns)
|
|
|
|
|
tx = tx.Where("order_sn", orderSns)
|
|
|
|
|
tx = tx.Where("order_sn in (?)", orderSns)
|
|
|
|
|
}
|
|
|
|
|
if req.ProjectName != "" {
|
|
|
|
|
var orderSns []string
|
|
|
|
|
global.DB.Model(&model.Project{}).Where("name", req.ProjectName).Pluck("order_sn", &orderSns)
|
|
|
|
|
tx = tx.Where("order_sn", orderSns)
|
|
|
|
|
tx = tx.Where("order_sn in (?)", orderSns)
|
|
|
|
|
}
|
|
|
|
|
if req.TpId != "" {
|
|
|
|
|
var orderSns []string
|
|
|
|
|
global.DB.Model(&model.Project{}).Where("tp_id", req.TpId).Pluck("order_sn", &orderSns)
|
|
|
|
|
tx = tx.Where("order_sn", orderSns)
|
|
|
|
|
tx = tx.Where("order_sn in (?)", orderSns)
|
|
|
|
|
}
|
|
|
|
|
if req.ApplicantName != "" {
|
|
|
|
|
var orderSns []string
|
|
|
|
|
global.DB.Model(&model.Applicant{}).Where("applicant_name", req.ApplicantName).Pluck("order_sn", &orderSns)
|
|
|
|
|
tx = tx.Where("order_sn", orderSns)
|
|
|
|
|
tx = tx.Where("order_sn in (?)", orderSns)
|
|
|
|
|
}
|
|
|
|
|
if req.ApplicantName != "" {
|
|
|
|
|
var orderSns []string
|
|
|
|
|
global.DB.Model(&model.Applicant{}).Where("applicant_name", req.ApplicantName).Pluck("order_sn", &orderSns)
|
|
|
|
|
tx = tx.Where("order_sn", orderSns)
|
|
|
|
|
tx = tx.Where("order_sn in (?)", orderSns)
|
|
|
|
|
}
|
|
|
|
|
if req.AssuredCreditCode != "" {
|
|
|
|
|
var orderSns []string
|
|
|
|
|
global.DB.Model(&model.Applicant{}).Where("credit_code", req.AssuredCreditCode).Pluck("order_sn", &orderSns)
|
|
|
|
|
tx = tx.Where("order_sn", orderSns)
|
|
|
|
|
tx = tx.Where("order_sn in (?)", orderSns)
|
|
|
|
|
}
|
|
|
|
|
if req.AssuredContactName != "" {
|
|
|
|
|
var orderSns []string
|
|
|
|
|
global.DB.Model(&model.Applicant{}).Where("contact_name", req.AssuredContactName).Pluck("order_sn", &orderSns)
|
|
|
|
|
tx = tx.Where("order_sn", orderSns)
|
|
|
|
|
tx = tx.Where("order_sn in (?)", orderSns)
|
|
|
|
|
}
|
|
|
|
|
if req.AssuredContactMobile != "" {
|
|
|
|
|
var orderSns []string
|
|
|
|
|
global.DB.Model(&model.Applicant{}).Where("contact_mobile", req.AssuredContactMobile).Pluck("order_sn", &orderSns)
|
|
|
|
|
tx = tx.Where("order_sn", orderSns)
|
|
|
|
|
tx = tx.Where("order_sn in (?)", orderSns)
|
|
|
|
|
}
|
|
|
|
|
if req.PolicyNo != "" {
|
|
|
|
|
var orderSns []string
|
|
|
|
|
global.DB.Model(&model.OrderResult{}).Where("policy_no", req.PolicyNo).Pluck("order_sn", &orderSns)
|
|
|
|
|
tx = tx.Where("order_sn", orderSns)
|
|
|
|
|
tx = tx.Where("order_sn in (?)", orderSns)
|
|
|
|
|
}
|
|
|
|
|
return tx
|
|
|
|
|
}
|
|
|
|
@ -637,7 +655,7 @@ func (s *orderService) GenerateOrdersExcel(req manage.OrderQueryRequest) *exceli
|
|
|
|
|
tx := s.buildQuery(req)
|
|
|
|
|
|
|
|
|
|
f := excel.NewFile()
|
|
|
|
|
headers := []string{"订单号", "项目编号", "项目名称", "招标人名称", "招标联系人", "招标人身份证", "招标联系手机", "投标人名称", "投标联系人", "投标人身份证", "投标联系手机", "保单号", "下单时间"}
|
|
|
|
|
headers := []string{"订单号", "项目订单编号", "项目来源", "招标项目编号", "项目名称", "保险公司", "保险产品", "保/批单号", "招标人", "投标人", "出函时间", "起保时间", "保函天数", "保费", "保额", "保单状态"}
|
|
|
|
|
excel.SetSimpleHeaders(headers, "Sheet1", f)
|
|
|
|
|
for {
|
|
|
|
|
orders := make([]model.Order, pageSize)
|
|
|
|
@ -661,22 +679,27 @@ func (orderService) buildOrdersExcel(orders []model.Order, sheet string, f *exce
|
|
|
|
|
for _, order := range orders {
|
|
|
|
|
col := 0
|
|
|
|
|
policyNo := ""
|
|
|
|
|
policyCreatedAt := ""
|
|
|
|
|
if order.OrderResult != nil {
|
|
|
|
|
policyNo = order.OrderResult.PolicyNo
|
|
|
|
|
policyCreatedAt = order.OrderResult.CreatedAt.Format(time.DateTime)
|
|
|
|
|
}
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.OrderNo)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.OrderSn)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), "易交易电子信息交易中心")
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.Project.TpID)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.Project.Name)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), "紫金财产保险股份有限公司福建分公司")
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), "投标保证保险")
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), policyNo)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.Assured.AssuredName)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.Assured.ContactName)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.Assured.CreditCode)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.Assured.ContactMobile)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.Applicant.ApplicantName)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.Applicant.ContactName)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.Applicant.CreditCode)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.Applicant.ContactMobile)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), policyNo)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.CreatedAt.Format(time.DateTime))
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), policyCreatedAt)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.Project.StartDate)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), "180天")
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.Project.InsureAmount)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.Project.Amount)
|
|
|
|
|
f.SetCellValue(sheet, excel.CellKey(row, &col), order.GetStatusText())
|
|
|
|
|
row++
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|