elf 4 months ago
parent 929de8d73a
commit 9dcfc06ab4

@ -2,6 +2,7 @@ package h5
import ( import (
"encoding/json" "encoding/json"
"fmt"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"insure/dto/request" "insure/dto/request"
"insure/e" "insure/e"
@ -52,7 +53,7 @@ func GetSignUrl(c *gin.Context) (result.Data, error) {
param := signer.SignParam{} param := signer.SignParam{}
param.Url = order.Applicant.SignUrl param.Url = order.Applicant.SignUrl
param.UploadUrl = global.Config.Server.Domain + "/suixing/upload-signed-file" param.UploadUrl = global.Config.Server.Domain + "/api/suixing/upload-signed-file"
param.IsView = "0" param.IsView = "0"
param.IsAutoClose = "0" param.IsAutoClose = "0"
param.IsEdit = "1" param.IsEdit = "1"
@ -89,6 +90,18 @@ func GetOrderPayUrl(c *gin.Context) (result.Data, error) {
return result.Data{"payUrl": order.PayUrl, "status": order.Status}, nil return result.Data{"payUrl": order.PayUrl, "status": order.Status}, nil
} }
func GetOrderStatus(c *gin.Context) (result.Data, error) {
token := c.DefaultQuery("token", "")
if token == "" {
return nil, e.NewError("缺少参数")
}
order, err := service.OrderService.GetOrderByToken(token)
if err != nil {
return nil, err
}
return result.Data{"status": order.Status}, nil
}
func PostToZking(c *gin.Context) (result.Data, error) { func PostToZking(c *gin.Context) (result.Data, error) {
orderNo := c.DefaultQuery("order_no", "") orderNo := c.DefaultQuery("order_no", "")
if orderNo == "" { if orderNo == "" {
@ -121,6 +134,22 @@ func UpdateApplicant(c *gin.Context) (result.Data, error) {
return result.Data{}, nil return result.Data{}, nil
} }
func UpdateInvoice(c *gin.Context) (result.Data, error) {
req := request.UpdateInvoiceRequest{}
err := c.ShouldBind(&req)
if err != nil {
return nil, e.NewError("参数错误")
}
_, err = service.OrderService.UpdateInvoice(req)
if err != nil {
return nil, e.NewError("保存错误")
}
return result.Data{}, nil
}
func UploadSignFile(c *gin.Context) (result.Data, error) { func UploadSignFile(c *gin.Context) (result.Data, error) {
token := c.DefaultPostForm("token", "") token := c.DefaultPostForm("token", "")
if token == "" { if token == "" {
@ -141,3 +170,26 @@ func UploadSignFile(c *gin.Context) (result.Data, error) {
return result.Data{}, nil return result.Data{}, nil
} }
func GenerateSignFile(c *gin.Context) (result.Data, error) {
token := c.DefaultPostForm("token", "")
if token == "" {
return nil, e.NewError("缺少参数")
}
order, err := service.OrderService.GetOrderByToken(token)
if err != nil {
return nil, err
}
signUrl, err := service.PdfService.Generate(order)
fmt.Println(signUrl)
fmt.Println(err)
if err != nil {
return nil, err
}
global.DB.Model(&model.Applicant{}).Where("order_no", order.OrderNo).UpdateColumn("sign_url", signUrl)
global.DB.Model(&model.Order{}).Where("order_no", order.OrderNo).UpdateColumns(model.Order{Status: "generated"})
return result.Data{}, nil
}

@ -1,25 +1,20 @@
package main package main
import ( import (
"encoding/json"
"flag" "flag"
"fmt"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/jung-kurt/gofpdf"
"github.com/tidwall/gjson"
"insure/global" "insure/global"
"insure/initialize" "insure/initialize"
"insure/router" "insure/router"
"strconv"
) )
func main() { func main() {
initial() initial()
//testVerify()
//runServer() //runServer()
//gen3()
runServerInWindows() runServerInWindows()
//jsonum1() //order, _ := service.OrderService.GetOrderByOrderNo("2024070111083101")
//service.PdfService.Generate(order)
//fmt.Println(utils.AmountToUpper(11089.11))
} }
func initial() { func initial() {
@ -47,682 +42,8 @@ func initial() {
} }
}*/ }*/
type CommonParam struct {
AppID string `json:"appid" form:"appid"`
RequestID string `json:"requestid" form:"requestid"`
Timestamp string `json:"timestamp" form:"timestamp"`
Version string `json:"version" form:"version"`
Sign string `json:"sign" form:"sign"`
Data string `json:"data" form:"data"`
}
func jsonum() {
var param map[string]interface{}
str := "{\"requestid\":\"2c5db07a2ace41dea1ddf894f2bae1fe\",\"appid\":\"zijin\",\"timestamp\":\"1719193514\",\"version\":\"1.0.0\",\"sign\":\"3ffff2e00610b3bc46d818c0b2fbd7ce7236b839\",\"data\":{\"user\":{\"unitname\":\"湖南弘湘建设工程管理有限公司\",\"insurances_start\":\"\",\"username\":\"投标企业4\",\"server_amount\":\"200.000\",\"bank_name\":\"中国建设银行\",\"userid\":\"5987c1944b0931216ce8526f\",\"beiandiqu_code\":\"x00004\",\"unitid\":\"5993a8144b09311cacb51e12\",\"bank_card_num\":\"6217001820001592123\",\"buinessNo\":[],\"mobile\":\"15605914788\",\"bank_user_name\":\"湖南弘湘建设工程管理有限公司\",\"fileList\":[],\"guarantee_type\":\"0\",\"rate\":\"\",\"policy_period_type\":\"\",\"unit_qual\":\"\",\"insurances_end\":\"\"},\"project\":{\"amount\":\"300000.00\",\"bulid_price\":\"3424257\",\"plan_date\":\"108日历天\",\"district\":\"350100\",\"city\":\"350100\",\"valid_period\":\"23\",\"name\":\"住建-测试项目\",\"province\":\"350000\",\"bulid_place\":\"23412\",\"tender_notice_url\":\"http://192.168.118.171:7702/views/pages/entp-view.html?type=tp&tpId=66027a207109b83d96aa86eb&flag=false&foId=66027a207109b83d96aa86eb\",\"createtime\":\"2024-03-26 15:41:37\",\"tender_project_type\":\"A99\",\"bzj_etime\":\"2027-06-18 11:12:03\",\"bd_name\":\"标段1\",\"start_date\":\"2027-06-15 11:12:03\",\"bzj_stime\":\"2024-06-18 11:12:03\",\"tender_file_url\":\"https://filetest.enjoy5191.com:15064/File/GetQiniuContent?appId=test_ebid_szj&key=%E4%BD%8F%E5%BB%BA-%E5%8D%8E%E5%AE%89%E4%BF%9D%E9%99%A9%E4%BF%9D%E6%B6%B5%E6%B5%81%E7%A8%8B%E9%AA%8C%E8%AF%81-RNM20240326_%E6%8B%9B%E6%A0%87%E6%96%87%E4%BB%B6_20240326154137.zip\",\"tender_file_url_md5\":\"d72fa88274c9449252a172afe832124e\",\"bdid\":\"42370bf371e74bb984aef56718520a81\",\"premium\":\"300.00000\",\"project_approval_no\":\"234234\",\"tpid\":\"345\"},\"applicant\":{\"applicant_name\":\"湖南弘湘建设工程管理有限公司\",\"city\":\"福州\",\"license_files\":[\"https://filetest.enjoy5191.com:15064/file/getcontent/6115d42094ce671bd8ff8e4f.png\"],\"province\":\"福建\",\"com_tel_num\":\"18888888866\",\"address\":\"高新科技园创业大厦25楼随行软件有限公司星网锐捷66\",\"legal_name\":\"法定代表人姓名166\",\"credit_vld\":\"2023-09-01\",\"credit_code\":\"91350206M00019WY2P\",\"com_tel_area\":\"\",\"legal_num\":\"62040320240328205X\",\"email\":\"743203624@qq.com\",\"bzj_way\":\"BAOXIAN_BAOHAN\",\"contact_mobile\":\"15605914788\",\"district\":\"闽候\",\"contact_name\":\"李一一\"},\"assured\":{\"assured_name\":\"345\",\"agency\":\"345\",\"district\":\"\",\"city\":\"-\",\"province\":\"\",\"com_tel_num\":\"1323423423\",\"address\":\"12312\",\"credit_vld\":\"\",\"credit_code\":\"123123123\",\"com_tel_area\":\"\",\"tender_bank_account\":\"-\",\"tender_bank_openbank\":\"-\",\"contact_mobile\":\"1323423423\",\"contact_name\":\"23234\",\"tender_account_name\":\"-\"}}}"
err := json.Unmarshal([]byte(str), &param)
if err != nil {
fmt.Println(err.Error())
}
s, err := json.Marshal(param)
fmt.Println(string(s))
}
func jsonum1() {
//var param map[string]interface{}
str := "{\"requestid\":\"2c5db07a2ace41dea1ddf894f2bae1fe\",\"appid\":\"zijin\",\"timestamp\":\"1719193514\",\"version\":\"1.0.0\",\"sign\":\"3ffff2e00610b3bc46d818c0b2fbd7ce7236b839\",\"data\":{\"user\":{\"unitname\":\"湖南弘湘建设工程管理有限公司\",\"insurances_start\":\"\",\"username\":\"投标企业4\",\"server_amount\":\"200.000\",\"bank_name\":\"中国建设银行\",\"userid\":\"5987c1944b0931216ce8526f\",\"beiandiqu_code\":\"x00004\",\"unitid\":\"5993a8144b09311cacb51e12\",\"bank_card_num\":\"6217001820001592123\",\"buinessNo\":[],\"mobile\":\"15605914788\",\"bank_user_name\":\"湖南弘湘建设工程管理有限公司\",\"fileList\":[],\"guarantee_type\":\"0\",\"rate\":\"\",\"policy_period_type\":\"\",\"unit_qual\":\"\",\"insurances_end\":\"\"},\"project\":{\"amount\":\"300000.00\",\"bulid_price\":\"3424257\",\"plan_date\":\"108日历天\",\"district\":\"350100\",\"city\":\"350100\",\"valid_period\":\"23\",\"name\":\"住建-测试项目\",\"province\":\"350000\",\"bulid_place\":\"23412\",\"tender_notice_url\":\"http://192.168.118.171:7702/views/pages/entp-view.html?type=tp&tpId=66027a207109b83d96aa86eb&flag=false&foId=66027a207109b83d96aa86eb\",\"createtime\":\"2024-03-26 15:41:37\",\"tender_project_type\":\"A99\",\"bzj_etime\":\"2027-06-18 11:12:03\",\"bd_name\":\"标段1\",\"start_date\":\"2027-06-15 11:12:03\",\"bzj_stime\":\"2024-06-18 11:12:03\",\"tender_file_url\":\"https://filetest.enjoy5191.com:15064/File/GetQiniuContent?appId=test_ebid_szj&key=%E4%BD%8F%E5%BB%BA-%E5%8D%8E%E5%AE%89%E4%BF%9D%E9%99%A9%E4%BF%9D%E6%B6%B5%E6%B5%81%E7%A8%8B%E9%AA%8C%E8%AF%81-RNM20240326_%E6%8B%9B%E6%A0%87%E6%96%87%E4%BB%B6_20240326154137.zip\",\"tender_file_url_md5\":\"d72fa88274c9449252a172afe832124e\",\"bdid\":\"42370bf371e74bb984aef56718520a81\",\"premium\":\"300.00000\",\"project_approval_no\":\"234234\",\"tpid\":\"345\"},\"applicant\":{\"applicant_name\":\"湖南弘湘建设工程管理有限公司\",\"city\":\"福州\",\"license_files\":[\"https://filetest.enjoy5191.com:15064/file/getcontent/6115d42094ce671bd8ff8e4f.png\"],\"province\":\"福建\",\"com_tel_num\":\"18888888866\",\"address\":\"高新科技园创业大厦25楼随行软件有限公司星网锐捷66\",\"legal_name\":\"法定代表人姓名166\",\"credit_vld\":\"2023-09-01\",\"credit_code\":\"91350206M00019WY2P\",\"com_tel_area\":\"\",\"legal_num\":\"62040320240328205X\",\"email\":\"743203624@qq.com\",\"bzj_way\":\"BAOXIAN_BAOHAN\",\"contact_mobile\":\"15605914788\",\"district\":\"闽候\",\"contact_name\":\"李一一\"},\"assured\":{\"assured_name\":\"345\",\"agency\":\"345\",\"district\":\"\",\"city\":\"-\",\"province\":\"\",\"com_tel_num\":\"1323423423\",\"address\":\"12312\",\"credit_vld\":\"\",\"credit_code\":\"123123123\",\"com_tel_area\":\"\",\"tender_bank_account\":\"-\",\"tender_bank_openbank\":\"-\",\"contact_mobile\":\"1323423423\",\"contact_name\":\"23234\",\"tender_account_name\":\"-\"}}}"
val := gjson.Get(str, "data")
fmt.Println(val.String())
}
func runServerInWindows() { func runServerInWindows() {
r := gin.Default() r := gin.Default()
router.Initial(r) router.Initial(r)
r.Run(":" + global.Config.Server.Port) r.Run(":" + global.Config.Server.Port)
} }
func gen() {
pdf := gofpdf.New("P", "mm", "A4", "") // 210mm x 297mm
pdf.AddPage()
for fontSize := 4; fontSize < 40; fontSize += 10 {
pdf.SetFont("Arial", "S", float64(fontSize))
pdf.SetXY(0, float64(fontSize))
pdf.Cell(40, 10, "Hello World")
}
err := pdf.OutputFileAndClose("./test.pdf")
if err != nil {
fmt.Println(err)
}
}
func strDelimit(str string, sepstr string, sepcount int) string {
pos := len(str) - sepcount
for pos > 0 {
str = str[:pos] + sepstr + str[pos:]
pos = pos - sepcount
}
return str
}
func gen1() {
pdf := gofpdf.New("P", "mm", "A4", "")
type countryType struct {
nameStr, capitalStr, areaStr, popStr string
}
countryList := make([]countryType, 0, 8)
header := []string{"Country", "Capital", "Area (sq km)", "Pop. (thousands)"}
for i := 0; i < 8; i++ {
countryList = append(countryList, countryType{
nameStr: "name" + strconv.Itoa(i),
capitalStr: "capital" + strconv.Itoa(i),
areaStr: "area" + strconv.Itoa(i),
popStr: "pop" + strconv.Itoa(i),
})
}
// Simple table
basicTable := func() {
left := (210.0 - 4*40) / 2
pdf.SetX(left)
for _, str := range header {
pdf.CellFormat(40, 7, str, "1", 0, "", false, 0, "")
}
pdf.Ln(-1)
for _, c := range countryList {
pdf.SetX(left)
pdf.CellFormat(40, 6, c.nameStr, "1", 0, "", false, 0, "")
pdf.CellFormat(40, 6, c.capitalStr, "1", 0, "", false, 0, "")
pdf.CellFormat(40, 6, c.areaStr, "1", 0, "", false, 0, "")
pdf.CellFormat(40, 6, c.popStr, "1", 0, "", false, 0, "")
pdf.Ln(-1)
}
}
// Better table
improvedTable := func() {
// Column widths
w := []float64{40.0, 35.0, 40.0, 45.0}
wSum := 0.0
for _, v := range w {
wSum += v
}
left := (210 - wSum) / 2
// Header
pdf.SetX(left)
for j, str := range header {
pdf.CellFormat(w[j], 7, str, "1", 0, "C", false, 0, "")
}
pdf.Ln(-1)
// Data
for _, c := range countryList {
pdf.SetX(left)
pdf.CellFormat(w[0], 6, c.nameStr, "LR", 0, "", false, 0, "")
pdf.CellFormat(w[1], 6, c.capitalStr, "LR", 0, "", false, 0, "")
pdf.CellFormat(w[2], 6, strDelimit(c.areaStr, ",", 3),
"LR", 0, "R", false, 0, "")
pdf.CellFormat(w[3], 6, strDelimit(c.popStr, ",", 3),
"LR", 0, "R", false, 0, "")
pdf.Ln(-1)
}
pdf.SetX(left)
pdf.CellFormat(wSum, 0, "", "T", 0, "", false, 0, "")
}
// Colored table
fancyTable := func() {
// Colors, line width and bold font
pdf.SetFillColor(255, 0, 0)
pdf.SetTextColor(255, 255, 255)
pdf.SetDrawColor(128, 0, 0)
pdf.SetLineWidth(.3)
pdf.SetFont("", "B", 0)
// Header
w := []float64{40, 35, 40, 45}
wSum := 0.0
for _, v := range w {
wSum += v
}
left := (210 - wSum) / 2
pdf.SetX(left)
for j, str := range header {
pdf.CellFormat(w[j], 7, str, "1", 0, "C", true, 0, "")
}
pdf.Ln(-1)
// Color and font restoration
pdf.SetFillColor(224, 235, 255)
pdf.SetTextColor(0, 0, 0)
pdf.SetFont("", "", 0)
// Data
fill := false
for _, c := range countryList {
pdf.SetX(left)
pdf.CellFormat(w[0], 6, c.nameStr, "LR", 0, "", fill, 0, "")
pdf.CellFormat(w[1], 6, c.capitalStr, "LR", 0, "", fill, 0, "")
pdf.CellFormat(w[2], 6, strDelimit(c.areaStr, ",", 3),
"LR", 0, "R", fill, 0, "")
pdf.CellFormat(w[3], 6, strDelimit(c.popStr, ",", 3),
"LR", 0, "R", fill, 0, "")
pdf.Ln(-1)
fill = !fill
}
pdf.SetX(left)
pdf.CellFormat(wSum, 0, "", "T", 0, "", false, 0, "")
}
pdf.AddPage()
pdf.AddUTF8Font("SIMFANG", "", "./SIMFANG.TTF")
pdf.SetFont("SIMFANG", "", float64(12))
pdf.SetXY(0, float64(40))
imgFileStr := "./static/assets/img/zking_logo.png"
infoPtr := pdf.RegisterImage(imgFileStr, "")
imgWd, imgHt := infoPtr.Extent()
pdf.Image(imgFileStr, 0, 0, imgWd, imgHt, false, "", 0, "")
pdf.Cell(40, 10, `注意:请认准阅读所附条款,尤其是黑体部分内容`)
pdf.Ln(-1)
pdf.SetFontSize(20)
pdf.Cell(40, 10, "投标保证保险投保单")
pdf.Ln(-1)
pdf.SetFontSize(10)
pdf.Cell(40, 10, "在您填写本投保单前,请仔细阅读《紫金财产保险股份有限公司投标保证保险条款》 ,特别注意条款中有")
pdf.Ln(5)
pdf.Cell(40, 10, "关保险责任、 免除保险人责任和投保人、被保险人义务的规定, 同时听取本公司就条款所做的说明,")
pdf.Ln(5)
pdf.Cell(40, 10, "并可就 其中内容要求本公司做出解释。在您已充分理解保险条款后,请您如实填写本投保单并签章确认。")
pdf.Ln(5)
pdf.CellFormat(30, 30, "投保人(投标人)", "1", 0, "", false, 0, "")
pdf.CellFormat(40, 6, "法人名称/自然人姓名", "1", 0, "", false, 0, "")
pdf.CellFormat(60, 6, "", "1", 0, "", false, 0, "")
pdf.Ln(-1)
pdf.SetX(40)
pdf.CellFormat(40, 6, "证件类型", "1", 0, "", false, 0, "")
pdf.CellFormat(40, 6, "", "1", 0, "", false, 0, "")
pdf.CellFormat(40, 6, "证件号码", "1", 0, "", false, 0, "")
//pdf.MultiCell(40, 6, "证件号码", "1", "", false)
pdf.CellFormat(40, 6, "", "1", 0, "", false, 0, "")
pdf.Ln(-1)
pdf.SetX(40)
pdf.CellFormat(40, 18, "法人性质", "1", 0, "", false, 0, "")
//pdf.MultiCell(40, 6, "□国有 ☑集体 □民营 □私营 □外资 □合资 □其他", "1", "", false)
pdf.CellFormat(40, 18, "□国有 ☑集体 □民营 □私营 □外资 □合资 □其他", "1", 0, "", false, 0, "")
pdf.CellFormat(40, 18, "法人资质", "1", 0, "", false, 0, "")
pdf.CellFormat(40, 18, "□特级 ☑一级 □二级 □三级", "1", 0, "", false, 0, "")
//pdf.MultiCell(40, 6, "□特级 ☑一级 □二级 □三级", "1", "", false)
pdf.Ln(5)
pdf.Ellipse(30, 15, 20, 10, 0, "D")
pdf.Ln(10)
pdf.SetFont("Arial", "", 14)
basicTable()
pdf.AddPage()
improvedTable()
pdf.AddPage()
fancyTable()
err := pdf.OutputFileAndClose("./test2.pdf")
if err != nil {
fmt.Println(err)
}
}
func gen2() {
const (
thin = 0.2
thick = 3.0
)
pdf := gofpdf.New("", "", "", "")
pdf.SetFont("Helvetica", "", 12)
pdf.SetFillColor(200, 200, 220)
pdf.AddPage()
y := 15.0
pdf.Text(10, y, "Circles")
pdf.SetFillColor(200, 200, 220)
pdf.SetLineWidth(thin)
pdf.Circle(20, y+15, 10, "D")
pdf.Circle(45, y+15, 10, "F")
pdf.Circle(70, y+15, 10, "FD")
pdf.SetLineWidth(thick)
pdf.Circle(95, y+15, 10, "FD")
pdf.SetLineWidth(thin)
y += 40.0
pdf.Text(10, y, "Ellipses")
pdf.SetFillColor(220, 200, 200)
pdf.Ellipse(30, y+15, 20, 10, 0, "D")
pdf.Ellipse(75, y+15, 20, 10, 0, "F")
pdf.Ellipse(120, y+15, 20, 10, 0, "FD")
pdf.SetLineWidth(thick)
pdf.Ellipse(165, y+15, 20, 10, 0, "FD")
pdf.SetLineWidth(thin)
y += 40.0
pdf.Text(10, y, "Curves (quadratic)")
pdf.SetFillColor(220, 220, 200)
pdf.Curve(10, y+30, 15, y-20, 40, y+30, "D")
pdf.Curve(45, y+30, 50, y-20, 75, y+30, "F")
pdf.Curve(80, y+30, 85, y-20, 110, y+30, "FD")
pdf.SetLineWidth(thick)
pdf.Curve(115, y+30, 120, y-20, 145, y+30, "FD")
pdf.SetLineCapStyle("round")
pdf.Curve(150, y+30, 155, y-20, 180, y+30, "FD")
pdf.SetLineWidth(thin)
pdf.SetLineCapStyle("butt")
y += 40.0
pdf.Text(10, y, "Curves (cubic)")
pdf.SetFillColor(220, 200, 220)
pdf.CurveBezierCubic(10, y+30, 15, y-20, 10, y+30, 40, y+30, "D")
pdf.CurveBezierCubic(45, y+30, 50, y-20, 45, y+30, 75, y+30, "F")
pdf.CurveBezierCubic(80, y+30, 85, y-20, 80, y+30, 110, y+30, "FD")
pdf.SetLineWidth(thick)
pdf.CurveBezierCubic(115, y+30, 120, y-20, 115, y+30, 145, y+30, "FD")
pdf.SetLineCapStyle("round")
pdf.CurveBezierCubic(150, y+30, 155, y-20, 150, y+30, 180, y+30, "FD")
pdf.SetLineWidth(thin)
pdf.SetLineCapStyle("butt")
y += 40.0
pdf.Text(10, y, "Arcs")
pdf.SetFillColor(200, 220, 220)
pdf.SetLineWidth(thick)
pdf.Arc(45, y+35, 20, 10, 0, 0, 180, "FD")
pdf.SetLineWidth(thin)
pdf.Arc(45, y+35, 25, 15, 0, 90, 270, "D")
pdf.SetLineWidth(thick)
pdf.Arc(45, y+35, 30, 20, 0, 0, 360, "D")
pdf.SetLineCapStyle("round")
pdf.Arc(135, y+35, 20, 10, 135, 0, 180, "FD")
pdf.SetLineWidth(thin)
pdf.Arc(135, y+35, 25, 15, 135, 90, 270, "D")
pdf.SetLineWidth(thick)
pdf.Arc(135, y+35, 30, 20, 135, 0, 360, "D")
pdf.SetLineWidth(thin)
pdf.SetLineCapStyle("butt")
x1 := 10.0
y1 := 10.0
w1 := 5.0
h1 := 5.0
// 绘制复选框
pdf.Rect(x1, y1, w1, h1, "D") // 边框
pdf.Rect(x1+1, y+1, w1-2, h1-2, "DF")
err := pdf.OutputFileAndClose("./test3.pdf")
if err != nil {
fmt.Println(err)
}
}
type pdfTable struct {
pdf *gofpdf.Fpdf
columnYList []float64
style string // 风格 F仅填充 D仅边框 或者DF两个都要
alignStr string // 对其方式 LCR为水平的左、中、右TMBA为垂直的上、中、下、基准线
fontH float64 // 字体高度
cells []pdfCell //
x float64
y float64
}
type point struct {
x float64
y float64
}
type pdfCell struct {
w float64 // 宽度
h float64 // 行高
txtStr string // 文本
lines int // 判断文本会占几行
x float64
y float64
}
func (s *pdfTable) addRows(style string, alignStr string, cells ...pdfCell) {
s.style = style
s.alignStr = alignStr
_, s.fontH = s.pdf.GetFontSize()
// 记录需要的最高行高
x := s.x
y := s.y
fmt.Println(x, y)
for column, cell := range cells {
y = s.columnYList[column]
if y <= 0 {
y = s.y
}
lines := s.pdf.SplitText(cell.txtStr, cell.w)
//h := float64(len(lines)) * cell.h
cell.lines = len(lines)
fmt.Println(x, y, len(lines), lines)
cell.x = x
cell.y = y
x = x + cell.w
y = y + cell.h
s.columnYList[column] = y
s.cells = append(s.cells, cell)
}
s.write()
}
func (s *pdfTable) write() {
// 手动记录并移动坐标
for _, c := range s.cells {
usedH := float64(c.lines) * s.fontH
margin := (c.h - usedH) / 2.0
s.pdf.Rect(c.x, c.y, c.w, c.h, s.style)
s.pdf.SetXY(c.x, c.y+margin) // 保持单元格内的文字有边距
s.pdf.MultiCell(c.w, s.fontH, c.txtStr, "", s.alignStr, false)
}
// 重置变量
s.cells = nil
}
func gen3() {
pdf := gofpdf.New("P", "mm", "A4", "")
pdf.AddPage()
pdf.AddUTF8Font("simsong", "", "./simsong.ttf")
pdf.SetFont("simsong", "", float64(10))
imgFileStr := "./static/assets/img/zking_logo.png"
infoPtr := pdf.RegisterImage(imgFileStr, "")
imgWd, imgHt := infoPtr.Extent()
pdf.Image(imgFileStr, 0, 0, imgWd, imgHt, false, "", 0, "")
pdf.Cell(40, 10, `注意:请认准阅读所附条款,尤其是黑体部分内容`)
pdf.Ln(-1)
pdf.SetFontSize(20)
pdf.Cell(40, 10, "投标保证保险投保单")
pdf.Ln(-1)
pdf.SetFontSize(10)
pdf.Cell(40, 10, "在您填写本投保单前,请仔细阅读《紫金财产保险股份有限公司投标保证保险条款》 ,特别注意条款中有")
pdf.Ln(5)
pdf.Cell(40, 10, "关保险责任、 免除保险人责任和投保人、被保险人义务的规定, 同时听取本公司就条款所做的说明,")
pdf.Ln(5)
pdf.Cell(40, 10, "并可就其中内容要求本公司做出解释。在您已充分理解保险条款后,请您如实填写本投保单并签章确认。")
pdf.Ln(-1)
pdf.HTMLBasicNew()
genTable(pdf)
pdf.Ln(-1)
pdf.Cell(40, 10, "投保人声明:贵公司已向本人交付并详细介绍了《紫金财产保险股份有限公司投标保证保险条款》的内容, 特 别是对保险合同中免除保险人责任的条款和投保人、被保险人义务的内容做了明确说明,本人已知悉其涵义, 同意投保并以此投保单作为订立保险合同的依据。")
pdf.Ln(-1)
pdf.Cell(40, 10, "投保人签章: 年 月 日")
pdf.Ln(-1)
pdf.AddPage()
pdf.Cell(40, 10, "紫金财产保险股份有限公司")
pdf.Ln(-1)
pdf.Cell(40, 10, "投标保证保险(2021 版)条款")
pdf.Ln(-1)
pdf.Cell(40, 10, "注册编号:C00013731412021102203263")
pdf.Ln(-1)
pdf.Cell(40, 10, "备案号:(紫金保险)(备-保证保险)【2022】(主) 001 号")
pdf.Ln(-1)
pdf.Cell(40, 10, "关保险责任、 免除保险人责任和投保人、被保险人义务的规定, 同时听取本公司就条款所做的说明,")
pdf.Ln(-1)
pdf.Ln(-1)
pdf.Ln(-1)
pdf.Cell(40, 10, "总则")
pdf.Ln(-1)
pdf.MultiCell(100, 6, "第一条 本保险合同由保险条款、投保单、保险单、保险凭证、批单和特别约定组成。凡涉及本保险合同的约定,均应采取书面形式。", "0", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "第二条 本保险合同的投保人是指响应招标人特定或不特定邀请、参加投标竞争的法人或其他组织,即投标人。", "0", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "第三条 本保险合同的被保险人是指在招标投标活动中以择优选择中标人为目的提出 招标项目进行招标的法人或其他组织,即招标人。", "0", "", false)
pdf.Ln(-1)
pdf.Cell(40, 10, "总则")
pdf.Ln(-1)
pdf.MultiCell(40, 6, "第四条 在保险期间内,投保人在投标过程中因存在如下情形导致其根据《中华人民共 和国招标投标法》及《中华人民共和国招标投标法实施条例》的相关规定或招标文件的约定 须向被保险人承担经济赔偿责任的,被保险人可向保险人提出索赔,保险人依据本保险合同 的约定,在保险金额范围内承担赔偿责任:\n", "0", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(一)投标截止后投保人未经被保险人同意撤销投标文件;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(二)投保人与其他投标人互相串通;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(三)投保人以他人名义投标或以其他方式弄虚作假,骗取中标;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(四)投保人无正当理由在接到中标通知书后未在相关法律法规或招标文件要求的时限 内签订合同;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(五)投保人违反招标文件或者在参加投标活动中存在其他实质性违反诚实信用原则的 行为。", "1", "", false)
pdf.Ln(-1)
pdf.Cell(40, 10, "责任免除")
pdf.Ln(-1)
pdf.Cell(40, 10, "第五条 如出现下列任一情形,保险人不承担保险责任:")
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(一)投保人与被保险人签订的合同经人民法院或仲裁机构认定不成立、不生效、无 效、被撤销、被解除的;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(二)投保人与被保险人互相串通,为投保人谋取中标;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(三)被保险人未按招标文件的要求履行相关义务的;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(四)投保人和被保险人未经保险人同意更改招标文件内容,损害保险人利益的;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(五)投保人与被保险人订立的协议或合同背离招标文件及中标人投标文件实质性内容;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(六)被保险人及其代表的故意行为、犯罪行为;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(七)所有投标被否决,被保险人重新招标的;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(八)被保险人同意投保人在投标截止日后撤销投标文件。", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "第六条 下列原因造成的损失和费用,保险人不负责赔偿:", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(一)战争、敌对行为、军事行为、武装冲突、罢工、骚乱、暴动、恐怖活动;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(二)核辐射、核爆炸、核污染及其他放射性污染;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(三)大气污染、土地污染、水污染及其他各种污染;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(四)行政行为或司法行为;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(五)洪水、台风、地震、海啸等自然灾害。", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "第七条 下列损失和费用,保险人不负责赔偿:", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(一)被保险人根据招标文件的要求应承担的责任,以及为收集、确认、证明投保人 造成损失所产生的任何费用;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(二)被保险人与投保人就招标投标活动产生纠纷所致的任何法律费用,包括但不限 于诉讼或仲裁费、财产保全或证据保全费、强制执行费、评估费、拍卖费、鉴定费、律师 费、差旅费、调查取证费等;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(三)本保险合同载明的免赔额,或根据本保险合同载明的免赔率计算的免赔额;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(四)被保险人以外的任何第三方的损失;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(五)各类间接损失;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(六)罚款、罚金及惩罚性赔偿;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(七)因不可归责于投保人而导致的被保险人的损失;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(八)本保险合同中载明的免赔额,或按本保险合同中载明的免赔率计算的免赔额;", "1", "", false)
pdf.Ln(-1)
pdf.MultiCell(40, 6, "(九)其他不属于本保险责任范围内的损失、费用和责任。;", "1", "", false)
pdf.Ln(-1)
pdf.Cell(40, 10, "责任免除")
err := pdf.OutputFileAndClose("./test4.pdf")
if err != nil {
fmt.Println(err)
}
}
func genTable(pdf *gofpdf.Fpdf) {
x, y := pdf.GetXY()
fmt.Println(x)
fmt.Println(y)
myPdf := pdfTable{pdf: pdf}
myPdf.x = x
myPdf.y = y
myPdf.columnYList = make([]float64, 5)
width, _ := pdf.GetPageSize() // 页面宽度
left, _, right, _ := pdf.GetMargins() // 左右边距
usable := width - left - right // 可用的页面宽度
_, h := pdf.GetFontSize() // 字体高度
tableH := h + 2 // 行高 多出2mm的边距
tableWidth := usable / 5 // 每个单元个的宽度
pdf.SetFillColor(233, 233, 233)
// 表头
myPdf.addRows("", "CM", []pdfCell{
{w: 20, h: 7 * tableH, txtStr: "投保人(投标人)"},
{w: 50, h: tableH, txtStr: "法人名称/自然人姓名"},
{w: 3 * tableWidth, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "CM", []pdfCell{
{w: 20, h: 0, txtStr: ""},
{w: 50, h: tableH, txtStr: "证件类型"},
{w: tableWidth, h: tableH, txtStr: ""},
{w: tableWidth, h: tableH, txtStr: "证件号码"},
{w: tableWidth, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: 20, h: 0, txtStr: ""},
{w: 50, h: 3 * tableH, txtStr: "法人性质"},
{w: tableWidth, h: 3 * tableH, txtStr: "□国有 ☑集体 □民营 □私营 □外资 □合资 □其他"},
{w: tableWidth, h: 3 * tableH, txtStr: "法人资质"},
{w: tableWidth, h: 3 * tableH, txtStr: "□特级 ☑一级 □二级 □三级"},
}...)
myPdf.addRows("", "CM", []pdfCell{
{w: 20, h: 0, txtStr: ""},
{w: 50, h: tableH, txtStr: "联系人"},
{w: tableWidth, h: tableH, txtStr: ""},
{w: tableWidth, h: tableH, txtStr: "联系电话"},
{w: tableWidth, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "CM", []pdfCell{
{w: 20, h: 0, txtStr: ""},
{w: 50, h: tableH, txtStr: "地址"},
{w: 3 * tableWidth, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "CM", []pdfCell{
{w: 20, h: 5 * tableH, txtStr: "被保险人(招标人)"},
{w: 50, h: tableH, txtStr: "法人名称/自然人姓名"},
{w: 3 * tableWidth, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "CM", []pdfCell{
{w: 20, h: 0, txtStr: ""},
{w: 50, h: tableH, txtStr: "证件类型"},
{w: tableWidth, h: tableH, txtStr: ""},
{w: tableWidth, h: tableH, txtStr: "证件号码"},
{w: tableWidth, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "CM", []pdfCell{
{w: 20, h: 0, txtStr: ""},
{w: 50, h: tableH, txtStr: "招标文件编号"},
{w: 3 * tableWidth, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "CM", []pdfCell{
{w: 20, h: 0, txtStr: ""},
{w: 50, h: tableH, txtStr: "联系人"},
{w: tableWidth, h: tableH, txtStr: ""},
{w: tableWidth, h: tableH, txtStr: "联系电话"},
{w: tableWidth, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "CM", []pdfCell{
{w: 20, h: 0, txtStr: ""},
{w: 50, h: tableH, txtStr: "地址"},
{w: 3 * tableWidth, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "CM", []pdfCell{
{w: 20, h: 3 * tableH, txtStr: "投标项目"},
{w: 50, h: tableH, txtStr: "项目名称"},
{w: tableWidth, h: tableH, txtStr: ""},
{w: tableWidth, h: tableH, txtStr: "立项文件号"},
{w: tableWidth, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "CM", []pdfCell{
{w: 20, h: 0, txtStr: ""},
{w: 50, h: tableH, txtStr: "项目性质"},
{w: 3 * tableWidth, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: 20, h: 0, txtStr: ""},
{w: 50, h: tableH, txtStr: "项目预计金额"},
{w: 3 * tableWidth, h: tableH, txtStr: "(人民币)大写: 小写:"},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: 70, h: tableH, txtStr: "保险金额"},
{w: 0, h: tableH, txtStr: ""},
{w: 3 * tableWidth, h: tableH, txtStr: "(人民币)大写: 小写:"},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: 70, h: tableH, txtStr: "保险费"},
{w: 0, h: tableH, txtStr: ""},
{w: 3 * tableWidth, h: tableH, txtStr: "(人民币)大写: 小写:"},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: 70, h: tableH, txtStr: "绝对免赔额/免赔率"},
{w: 0, h: tableH, txtStr: ""},
{w: 3 * tableWidth, h: tableH, txtStr: " /"},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: 70, h: 16 * tableH, txtStr: "特别约定"},
{w: 0, h: 16 * tableH, txtStr: ""},
{w: 3 * tableWidth, h: 16 * tableH, txtStr: "1、本保单为见索即付保单本保单发生保险事故由保险人先行赔付后享有对 投保人的代位求偿权。2、本保单项下本保险在投标有效期到期后28日(含)内或被保 险人延长投标有效期后到期日后28日(含)内保持有效,延长投标有效期无需通知本保险 人,但任何索赔要求应在投标有效期内送达我方。保险失效后由平台将本保单交投标人 退回我司注销。3、兹承诺在收到被保险人书面通知说明下列中的任何一条时保 证在10日内无条件给付给被保险人金额为不超过保险金额的款项。1)投保人在投标有效 期内撤销或修改其投标文件的2)投保人在中标后,非因不可抗力原因放弃中标、无正 当理由不与招标人订立合同、在签订合同时向招标人提出附加条件、或者不按招标文件 要求提交履约担保金的3)投标人的投标文件存在《福建省住房和城乡建设厅关于施工 招标项目电子投标文件置同认定与处理的指导意见》 (闽建筑[2018]29号)规定的雷同情 形之一4)投标人中标后因违法行为导致中标被依法确认无效的5) 法律、法规规定 的其他没收投标保险金情形。4、我单位在收到招标人索赔申请后10日内无条件给予先 行支付预赔款,赔付流程将根据我单位向宁德市公共资源交易中心提供的《金融机构理 赔流程标准》执行。本保险项下所有权利和义务均受中华人民共和国法律管辖和制约。 查验保函网址:http://www.zking.com/dzbdxzcx.jhtml\n尊敬的客户您可以通过电话95312、公司柜面或登陆公司网站\nwww.zking.com查询您的保单信息、状态以及理赔情况。如您对查询结果有异议 请及时致电本公司。\n无其他特别约定"},
{w: 0, h: 16 * tableH, txtStr: ""},
{w: 0, h: 16 * tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: 70, h: tableH, txtStr: "保险合同争议解决方式"},
{w: 0, h: tableH, txtStr: ""},
{w: 3 * tableWidth, h: tableH, txtStr: "诉讼"},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: 70, h: tableH, txtStr: "司法管辖"},
{w: 0, h: tableH, txtStr: ""},
{w: 3 * tableWidth, h: tableH, txtStr: "中华人民共和国管辖(港澳台除外)"},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: 70, h: 5 * tableH, txtStr: "偿付能力信息"},
{w: 0, h: 5 * tableH, txtStr: ""},
{w: 3 * tableWidth, h: 5 * tableH, txtStr: "我公司最近季度的综合偿付能力充足率和风险综合评级结果告知如下:\n1、我公司2024年1季度综合偿付能力充足率:339.97%, 已达到政府监管要 求。\n2、我公司2024年1季度核心偿付能力充足率:262.64%, 已达到政府监管要 求。\n3、我公司2023年4季度风险综合评级:AAA级。"},
{w: 0, h: 5 * tableH, txtStr: ""},
{w: 0, h: 5 * tableH, txtStr: ""},
}...)
}

@ -1,11 +1,13 @@
package request package request
type UpdateApplicantRequest struct { type UpdateApplicantRequest struct {
Token string `form:"token"` Token string `form:"token"`
ApplicantName string `form:"applicantName"` ApplicantName string `form:"applicantName"`
CreditCode string `form:"creditCode"` CreditCode string `form:"creditCode"`
ContactName string `form:"contactName"` ContactName string `form:"contactName"`
ContactMobile string `form:"contactMobile"` ContactMobile string `form:"contactMobile"`
BankName string `form:"bankName"` BankName string `form:"bankName"`
BankCardNum string `form:"bankCardNum"` BankCardNum string `form:"bankCardNum"`
InvoiceAcceptEmail string `form:"invoiceAcceptEmail"`
InvoiceType string `form:"invoiceType"`
} }

@ -0,0 +1,7 @@
package request
type UpdateInvoiceRequest struct {
Token string `form:"token"`
Header string `form:"header"`
TaxNumber string `form:"taxNumber"`
}

BIN
insure

Binary file not shown.

@ -6,28 +6,30 @@ import (
) )
type Applicant struct { type Applicant struct {
ID int ID int
OrderNo string OrderNo string
ApplicantName string ApplicantName string
CreditVld string CreditVld string
CreditCode string CreditCode string
ContactName string ContactName string
ContactMobile string ContactMobile string
ComTelArea string ComTelArea string
Province string Province string
City string City string
District string District string
Address string Address string
Email string Email string
LegalName string LegalName string
LegalNum string LegalNum string
ComTelNum string ComTelNum string
LicenseFiles string LicenseFiles string
SignUrl string InvoiceAcceptEmail string
SignedUrl string InvoiceType string
Order *Order `gorm:"foreignKey:OrderNo;references:OrderNo"` SignUrl string
CreatedAt time.Time SignedUrl string
UpdatedAt time.Time `json:"-"` Order *Order `gorm:"foreignKey:OrderNo;references:OrderNo"`
CreatedAt time.Time
UpdatedAt time.Time `json:"-"`
} }
func (Applicant) TableName() string { func (Applicant) TableName() string {

@ -0,0 +1,33 @@
package model
import (
"encoding/json"
"time"
)
type Invoice struct {
ID int
OrderNo string
Header string
TaxNumber string
Order *Order `gorm:"foreignKey:OrderNo;references:OrderNo"`
CreatedAt time.Time
UpdatedAt time.Time `json:"-"`
}
func (Invoice) TableName() string {
return "invoice"
}
func (a Invoice) MarshalJSON() ([]byte, error) {
type Alias Invoice
return json.Marshal(&struct {
CreatedAt string
UpdatedAt string
*Alias
}{
CreatedAt: a.CreatedAt.Format("2006-01-02 15:04:05"),
UpdatedAt: a.UpdatedAt.Format("2006-01-02 15:04:05"),
Alias: (*Alias)(&a),
})
}

@ -18,6 +18,7 @@ type Order struct {
Applicant *Applicant `gorm:"foreignKey:OrderNo;references:OrderNo"` Applicant *Applicant `gorm:"foreignKey:OrderNo;references:OrderNo"`
Assured *Assured `gorm:"foreignKey:OrderNo;references:OrderNo"` Assured *Assured `gorm:"foreignKey:OrderNo;references:OrderNo"`
OrderResult *OrderResult `gorm:"foreignKey:OrderNo;references:OrderNo"` OrderResult *OrderResult `gorm:"foreignKey:OrderNo;references:OrderNo"`
Invoice *Invoice `gorm:"foreignKey:OrderNo;references:OrderNo"`
CreatedAt time.Time CreatedAt time.Time
UpdatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"`
} }

@ -13,6 +13,9 @@ func webRouteInit(r *gin.Engine) {
webGroup.Match([]string{"GET", "OPTIONS"}, "/get-order-result", result.Json(h5.GetOrderResult)) webGroup.Match([]string{"GET", "OPTIONS"}, "/get-order-result", result.Json(h5.GetOrderResult))
webGroup.Match([]string{"GET", "OPTIONS"}, "/post-to-zking", result.Json(h5.PostToZking)) webGroup.Match([]string{"GET", "OPTIONS"}, "/post-to-zking", result.Json(h5.PostToZking))
webGroup.Match([]string{"POST", "OPTIONS"}, "/update-applicant", result.Json(h5.UpdateApplicant)) webGroup.Match([]string{"POST", "OPTIONS"}, "/update-applicant", result.Json(h5.UpdateApplicant))
webGroup.Match([]string{"POST", "OPTIONS"}, "/update-invoice", result.Json(h5.UpdateInvoice))
webGroup.Match([]string{"POST", "OPTIONS"}, "/upload-sign-file", result.Json(h5.UploadSignFile)) webGroup.Match([]string{"POST", "OPTIONS"}, "/upload-sign-file", result.Json(h5.UploadSignFile))
webGroup.Match([]string{"GET", "OPTIONS"}, "/get-order-pay-url", result.Json(h5.GetOrderPayUrl)) webGroup.Match([]string{"GET", "OPTIONS"}, "/get-order-pay-url", result.Json(h5.GetOrderPayUrl))
webGroup.Match([]string{"GET", "OPTIONS"}, "/get-order-status", result.Json(h5.GetOrderStatus))
webGroup.Match([]string{"POST", "OPTIONS"}, "/generate-sign-file", result.Json(h5.GenerateSignFile))
} }

@ -181,6 +181,7 @@ func (s *orderService) GetOrderByToken(token string) (*model.Order, error) {
Preload("Project"). Preload("Project").
Preload("Applicant"). Preload("Applicant").
Preload("Assured"). Preload("Assured").
Preload("Invoice").
Where("token", token). Where("token", token).
First(&order). First(&order).
Error Error
@ -201,6 +202,7 @@ func (s *orderService) GetOrderByOrderNo(orderNo string) (*model.Order, error) {
Preload("Project"). Preload("Project").
Preload("Applicant"). Preload("Applicant").
Preload("Assured"). Preload("Assured").
Preload("Invoice").
Where("order_no", orderNo). Where("order_no", orderNo).
First(&order). First(&order).
Error Error
@ -221,6 +223,7 @@ func (s *orderService) GetOrderByOrderSn(orderSn string) (*model.Order, error) {
Preload("Project"). Preload("Project").
Preload("Applicant"). Preload("Applicant").
Preload("Assured"). Preload("Assured").
Preload("Invoice").
Where("order_sn", orderSn). Where("order_sn", orderSn).
First(&order). First(&order).
Error Error
@ -751,6 +754,8 @@ func (s *orderService) UpdateApplicant(req request.UpdateApplicantRequest) (*mod
applicant.ContactMobile = req.ContactMobile applicant.ContactMobile = req.ContactMobile
applicant.CreditCode = req.CreditCode applicant.CreditCode = req.CreditCode
applicant.ApplicantName = req.ApplicantName applicant.ApplicantName = req.ApplicantName
applicant.InvoiceType = req.InvoiceType
applicant.InvoiceAcceptEmail = req.InvoiceAcceptEmail
err = global.DB.Save(&applicant).Error err = global.DB.Save(&applicant).Error
if err != nil { if err != nil {
return nil, err return nil, err
@ -762,6 +767,29 @@ func (s *orderService) UpdateApplicant(req request.UpdateApplicantRequest) (*mod
return order, nil return order, nil
} }
func (s *orderService) UpdateInvoice(req request.UpdateInvoiceRequest) (*model.Order, error) {
order, err := s.GetOrderByToken(req.Token)
if err != nil {
return nil, err
}
invoice := order.Invoice
if invoice == nil {
invoice = &model.Invoice{}
}
invoice.OrderNo = order.OrderNo
invoice.Header = req.Header
invoice.TaxNumber = req.TaxNumber
err = global.DB.Save(&invoice).Error
if err != nil {
return nil, err
}
order.Invoice = invoice
return order, nil
}
func (s *orderService) UpdateOrderAfterPostToInsure(orderNo, payUrl string, orderSn string) { func (s *orderService) UpdateOrderAfterPostToInsure(orderNo, payUrl string, orderSn string) {
global.DB.Model(&model.Order{}).Where("order_no", orderNo).UpdateColumns(model.Order{Status: "submitted", PayUrl: payUrl, OrderSn: orderSn}) global.DB.Model(&model.Order{}).Where("order_no", orderNo).UpdateColumns(model.Order{Status: "submitted", PayUrl: payUrl, OrderSn: orderSn})
} }

@ -0,0 +1,765 @@
package service
import (
"fmt"
"github.com/jung-kurt/gofpdf"
"insure/global"
"insure/model"
"insure/utils"
"math"
"os"
"strconv"
"time"
)
var PdfService = pdfService{}
type pdfService struct {
}
func (pdfService) Generate(order *model.Order) (string, error) {
rootPath := "."
if global.Config.Server.RootPath != "" {
rootPath = global.Config.Server.RootPath
}
pdf := gofpdf.New("P", "mm", "A4", "")
pdf.AddPage()
pdf.AddUTF8Font("simsong", "BI", rootPath+"/static/assets/font/simsong.ttf")
pdf.SetFont("simsong", "BI", float64(10))
imgFileStr := rootPath + "/static/assets/img/zking_logo.png"
fmt.Println("imgFileStr", imgFileStr)
fmt.Println("fileExists", fileExists(imgFileStr))
//infoPtr := pdf.RegisterImage(imgFileStr, "")
//imgWd, imgHt := infoPtr.Extent()
imgWd := 106.89
imgHt := 11.99
fmt.Println("img:", imgWd, imgHt)
pdf.Image(imgFileStr, 15, 20, imgWd*0.7, imgHt*0.7, false, "", 0, "")
pdf.SetXY(120, 17)
pdf.MultiCell(50, 6, "注意:请认准阅读所附条款,尤其是黑体部分内容", "", "", false)
pdf.Line(14, 33, 193, 33)
pdf.Ln(10)
pdf.SetFontSize(18)
pdf.SetX(75)
pdf.Cell(40, 10, "投标保证保险投保单")
pdf.Ln(-1)
pdf.SetFontSize(10)
pdf.SetX(18)
pdf.Cell(40, 10, "在您填写本投保单前,请仔细阅读《紫金财产保险股份有限公司投标保证保险条款》,特别注意条款中有关保险责")
pdf.Ln(5)
pdf.Cell(40, 10, "任、 免除保险人责任和投保人、被保险人义务的规定,同时听取本公司就条款所做的说明,并可就其中内容要求本公司")
pdf.Ln(5)
pdf.Cell(40, 10, "做出解释。在您已充分理解保险条款后,请您如实填写本投保单并签章确认。")
pdf.Ln(-1)
genTable(pdf, order)
pdf.AddPage()
genTable1(pdf)
signTime := time.Now().Format("2006年01月02日")
pdf.Ln(-1)
pdf.SetY(40)
pdf.Cell(40, 10, "投保人声明:贵公司已向本人交付并详细介绍了《紫金财产保险股份有限公司投标保证保险条款》的内容,特别是对")
pdf.Ln(5)
pdf.Cell(40, 10, "保险合同中免除保险人责任的条款和投保人、被保险人义务的内容做了明确说明,本人已知悉其涵义,同意投保并以")
pdf.Ln(5)
pdf.Cell(40, 10, "此投保单作为订立保险合同的依据。")
pdf.Ln(-1)
pdf.SetX(130)
pdf.Cell(40, 10, "投保人签章: "+signTime)
pdf.Ln(-1)
pdf.AddPage()
pdf.SetFontSize(14)
pdf.SetXY(75, 40)
pdf.Cell(40, 10, "紫金财产保险股份有限公司")
pdf.Ln(-1)
pdf.SetX(75)
pdf.Cell(40, 10, "投标保证保险(2021 版)条款")
pdf.Ln(-1)
pdf.SetX(65)
pdf.Cell(40, 10, "注册编号:C00013731412021102203263")
pdf.Ln(-1)
pdf.SetX(48)
pdf.Cell(40, 10, "备案号:(紫金保险)(备-保证保险)【2022】(主) 001 号")
pdf.Ln(-1)
pageWidth := 185.0
pdf.Ln(-1)
pdf.Ln(-1)
pdf.SetX(95)
pdf.Cell(40, 10, "总则")
pdf.SetFontSize(10)
pdf.Ln(-1)
pdf.MultiCell(pageWidth, 6, " 第一条 本保险合同由保险条款、投保单、保险单、保险凭证、批单和特别约定组成。凡涉及本保险合同的约定,均应采取书面形式。", "0", "", false)
pdf.Ln(-1)
pdf.MultiCell(pageWidth, 6, " 第二条 本保险合同的投保人是指响应招标人特定或不特定邀请、参加投标竞争的法人或其他组织,即投标人。", "0", "", false)
pdf.Ln(-1)
pdf.MultiCell(pageWidth, 6, " 第三条 本保险合同的被保险人是指在招标投标活动中以择优选择中标人为目的提出 招标项目进行招标的法人或其他组织,即招标人。", "0", "", false)
pdf.Ln(-1)
pdf.SetX(90)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "保险责任")
pdf.Ln(-1)
pdf.SetFontSize(10)
pdf.MultiCell(pageWidth, 6, " 第四条 在保险期间内,投保人在投标过程中因存在如下情形导致其根据《中华人民共 和国招标投标法》及《中华人民共和国招标投标法实施条例》的相关规定或招标文件的约定 须向被保险人承担经济赔偿责任的,被保险人可向保险人提出索赔,保险人依据本保险合同 的约定,在保险金额范围内承担赔偿责任:\n", "0", "", false)
pdf.Ln(-1)
subLineLeft := 20.0
subLineWidth := 185.0
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(一) 投标截止后投保人未经被保险人同意撤销投标文件;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(二) 投保人与其他投标人互相串通;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(三) 投保人以他人名义投标或以其他方式弄虚作假,骗取中标;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(四) 投保人无正当理由在接到中标通知书后未在相关法律法规或招标文件要求的时限内签订合同;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(五) 投保人违反招标文件或者在参加投标活动中存在其他实质性违反诚实信用原则的行为。", "", "", false)
pdf.Ln(-1)
pdf.SetX(90)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "责任免除")
pdf.Ln(-1)
pdf.SetFontSize(10)
pdf.Cell(pageWidth, 10, " 第五条 如出现下列任一情形,保险人不承担保险责任:")
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(一) 投保人与被保险人签订的合同经人民法院或仲裁机构认定不成立、不生效、无 效、被撤销、被解除的;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(二) 投保人与被保险人互相串通,为投保人谋取中标;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(三) 被保险人未按招标文件的要求履行相关义务的;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(四) 投保人和被保险人未经保险人同意更改招标文件内容,损害保险人利益的;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(五) 投保人与被保险人订立的协议或合同背离招标文件及中标人投标文件实质性内容;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(六) 被保险人及其代表的故意行为、犯罪行为;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(七) 所有投标被否决,被保险人重新招标的;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(八) 被保险人同意投保人在投标截止日后撤销投标文件。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(pageWidth, 6, " 第六条 下列原因造成的损失和费用,保险人不负责赔偿:", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(一) 战争、敌对行为、军事行为、武装冲突、罢工、骚乱、暴动、恐怖活动;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(二) 核辐射、核爆炸、核污染及其他放射性污染;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(三) 大气污染、土地污染、水污染及其他各种污染;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(四) 行政行为或司法行为;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(五) 洪水、台风、地震、海啸等自然灾害。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(pageWidth, 6, " 第七条 下列损失和费用,保险人不负责赔偿:", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(一) 被保险人根据招标文件的要求应承担的责任,以及为收集、确认、证明投保人 造成损失所产生的任何费用;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(二) 被保险人与投保人就招标投标活动产生纠纷所致的任何法律费用,包括但不限 于诉讼或仲裁费、财产保全或证据保全费、强制执行费、评估费、拍卖费、鉴定费、律师 费、差旅费、调查取证费等;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(三) 本保险合同载明的免赔额,或根据本保险合同载明的免赔率计算的免赔额;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(四) 被保险人以外的任何第三方的损失;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(五) 各类间接损失;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(六) 罚款、罚金及惩罚性赔偿;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(七) 因不可归责于投保人而导致的被保险人的损失;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(八) 本保险合同中载明的免赔额,或按本保险合同中载明的免赔率计算的免赔额;", "", "", false)
pdf.Ln(-1)
pdf.SetX(subLineLeft)
pdf.MultiCell(subLineWidth, 6, "(九) 其他不属于本保险责任范围内的损失、费用和责任。;", "", "", false)
pdf.Ln(-1)
pdf.SetX(90)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "责任免除")
pdf.SetFontSize(10)
pdf.Ln(-1)
pdf.SetX(80)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "保险金额和免赔率(额)")
pdf.SetFontSize(10)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第八条 保险金额是保险人承担赔偿责任的最高限额。本保险合同的保险金额以招标投 标文件中投标保证金的相关要求为基础,通过投保人与保险人协商确定保险金额,并在保险 合同中载明。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第九条 免赔率(额)指被保险人在保险事故中自行承担损失金额的部分。每次保险 事故免赔率(额)由投保人与保险人在签订保险合同时协商确定,并在保险合同中载明。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 保险合同中同时载明了免赔额和免赔率的,免赔金额以免赔额和按照免赔率计算的金 额中的高者为准。", "", "", false)
pdf.Ln(-1)
pdf.SetX(90)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "保险期间")
pdf.SetFontSize(10)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第十条 本保险合同保险期间自投标截止次日起或保险单载明的保险起期之日起(二者 以后发生者为准),至中标人与被保险人签订合同之日止或保险单载明的保险止期之日止(二 者以先发生者为准)。本保险合同保险期间最长不得超过 12 个月。", "", "", false)
pdf.Ln(-1)
pdf.SetX(90)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "保险费")
pdf.SetFontSize(10)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第十一条 本保险合同的保险费由保险人根据投保人企业资质等级、招标项目类型、保\n险金额等因素确定并在保险单上载明其金额。", "", "", false)
pdf.Ln(-1)
pdf.SetX(90)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "保险人义务")
pdf.SetFontSize(10)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第十二条 订立本保险合同时,采用保险人提供的格式条款的,保险人向投保人提供的 投保单应当附格式条款,保险人应当向投保人说明本保险合同的内容,对本保险合同中免除 保险人责任的条款,保险人在订立保险合同时应当在投保单、保险单或者其他保险凭证上做 出足以引起投保人注意的提示,并对该条款内容以书面形式或者口头形式向投保人做出明确 说明;未作提示或者明确说明的,该条款不产生效力。\n", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第十三条 本保险合同成立后,保险人应当及时向投保人签发保险单或其他保险凭证。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第十四条 保险人按照本保险合同的约定,认为被保险人提供的有关索赔的证明和资料\n不完整的应当及时一次性通知投保人、被保险人补充。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第十五条 保险人收到被保险人的赔偿保险金的请求后,应当及时作出是否属于保险责 任的核定;情形复杂的,应当在三十日内作出核定,但本保险合同另有约定的除外。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 保险人应当将核定结果通知被保险人;对属于保险责任的,在与被保险人达成赔偿保险 金的协议后十日内,履行赔偿保险金义务。本保险合同对赔偿保险金的期限有约定的,保险 人应当按照约定履行赔偿保险金的义务。保险人依照前款约定做出核定后,对不属于保险责 任的,应当自做出核定之日起三日内向被保险人发出拒绝赔偿保险金通知书,并说明理由。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第十六条 保险人自收到赔偿保险金的请求和有关证明、资料之日起六十日内,对其赔 偿保险金的数额不能确定的,应当根据已有证明和资料可以确定的数额先予支付;保险人最 终确定赔偿的数额后,应当支付相应差额。", "", "", false)
pdf.Ln(-1)
pdf.SetX(90)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "投保人、被保险人义务")
pdf.SetFontSize(10)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第十七条 订立本保险合同,保险人就投保风险的情况以及投保人、被保险人的有关情\n况提出询问的投保人应当如实告知。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 投保人故意或者因重大过失未履行前款规定的如实告知义务,足以影响保险人决定是 否同意承保或者提高保险费率的,保险人有权解除合同。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 前款规定的合同解除权,自保险人知道有解除事由之日起,超过三十日不行使而消灭。 自合同成立之日起超过二年的,保险人不得解除合同;发生保险事故的,保险人应当承担赔 偿或者给付保险金的责任。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 保险人在合同订立时已经知道投保人未如实告知的情况的,保险人不得解除合同;发生 保险事故的,保险人应当承担赔偿或者给付保险金的责任。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第十八条 除本保险合同另有约定外,投保人应当在本保险合同成立时一次性交清本保 险合同约定的全部保险费,投保人未按约定交付保险费,保险合同不生效;对于保险费交 付前发生的保险事故,保险人不承担赔偿责任。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第十九条 申请投保时,投保人应如实填写投保单,提供保险人要求的必要证明资料, 并接受保险人对其资质进行审查。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第二十条 投保人有义务配合保险人的资质审查工作,在保险人审查期间,投保人应当 配合保险人或由保险人雇佣的审计人员或者其他独立第三方对其提供的信息和文件进行准 确的核查。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第二十一条 在保险期间内,被保险人应及时检查并协助保险人了解招标工作进行情况, 被保险人如发现投保人存在违约风险,或有任何其他可能导致本保险合同风险显著增加的情 况,被保险人应在其能力范围内采取一切合理且必要的措施降低或消除上述风险,并应按照 本保险合同约定及时通知保险人。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第二十二条 保险事故发生后,被保险人应及时做好记录,并及时书面通知保险人。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第二十三条 知道保险事故发生后:", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " (一) 被保险人应该尽力采取必要、合理的措施,防止或减少损失,否则,对因此扩大 的损失,保险人不负责赔偿;", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " (二) 投保人、被保险人应及时通知保险人,并书面说明事故发生的原因、经过、损失 情况和处理情况;故意或者因重大过失未及时通知,致使保险事故的性质、原因、损失程 度等难以确定的,保险人对无法确定的部分,不承担赔偿责任,但保险人通过其他途径已 经及时知道或者应当及时知道保险事故发生的除外;对涉及违法、犯罪的,投保人或被保险 人应立即向公安机关报案。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " (三)被保险人应完整保留其项目招标投标过程中的相关文件和资料,允许并协助保险 人对事故进行调查。对于妨碍保险人进行事故调查导致无法确定事故原因或核实损失情况 的,保险人对无法确定或核实的部分不承担赔偿责任。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第二十四条 被保险人提出索赔申请时,应向保险人提供下列书面证明和资料:", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " (一)索赔申请书;", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " (二)保险单正本;", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " (三)招标文件;", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " (四)投保人的投标文件及相关文件;", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " (五)与招标投标项目有关的文件资料,分情形具体包括:", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 1.投标截止后投保人未经被保险人同意撤销投标文件的,须提供投保人的撤销申请或相 关证明;", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 2.投保人与其他投标人互相串通的,须提供相互串通的证明;", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 3.投保人以他人名义投标或以其他方式弄虚作假,骗取中标的,须提供冒名投标或其他 弄虚作假行为的证明;", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 4.投保人无正当理由在接到中标通知书后未在相关法律法规或招标文件要求的时限内 签订合同的,须提供中标通知书及被保险人就签订合同时限内未与投保人签订合同的声明;", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " (六)投保人、被保险人所能提供的与确认保险事故的性质、原因、损失程度等有关的 其他证明和资料;", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " (七)保险人要求的作为请求赔偿依据的合理有效的其他证明材料。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 被保险人未履行前款约定的索赔材料提供义务,导致保险人无法核实损失情况的,保 险人对无法核实的部分不承担赔偿责任。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 2.投保人与其他投标人互相串通的,须提供相互串通的证明;", "", "", false)
pdf.Ln(-1)
pdf.SetX(90)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "赔偿处理")
pdf.SetFontSize(10)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第二十五条 被保险人向保险人提出索赔申请前,应按招标文件的相关要求向投保人启动索赔程序。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第二十六条 保险事故发生后,保险人对于被保险人无法通过向投保人索赔获得补偿的 合理损失,在扣减本保险合同载明的免赔额或按免赔率计算的金额后进行赔偿,但最高不 超过本保险合同载明的保险金额。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第二十七条 发生保险事故时,如果被保险人的损失在有相同保障的其他保险合同项 下也能够获得赔偿,则本保险人按照本保险合同的保险金额与其他保险合同及保险合同相 应的保险金额的总和比例承担赔偿责任。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 应由其他保险人承担的赔偿金额,本保险人不负责垫付。若被保险人未如实告知导致 保险人多支付赔偿金的,保险人有权向被保险人追回多支付的部分。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第二十八条 发生保险责任范围内的损失,保险人自向被保险人赔偿保险金之日起, 在赔偿金额范围内代为行使被保险人对投保人或其担保人(如有)请求赔偿的权利。被保 险人应当向保险人提供必要的文件和所知道的有关情况,积极协助保险人向投保人或其担 保人(如有)进行追偿。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 被保险人已经从投保人或其担保人(如有)处取得赔偿的,保险人赔偿保险金时,可 以相应扣减被保险人已从投保人或其担保人(如有)处取得的赔偿金额。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第二十九条 保险事故发生后,在保险人未赔偿保险金之前,被保险人放弃对投保人 或其担保人(如有)请求赔偿的权利,保险人不承担赔偿责任;保险人向被保险人赔偿保 险金后,被保险人未经保险人同意放弃对投保人或其担保人(如有)请求赔偿的权利的, 该行为无效;由于被保险人故意或者因重大过失致使保险人不能行使代位请求赔偿的权利 的,保险人可以扣减或者要求返还相应的保险金。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第三十条 未发生保险事故,被保险人谎称发生了保险事故,向保险人提出赔偿请求 的,保险人有权解除保险合同,并不退还保险费。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 投保人、被保险人故意制造保险事故的,保险人有权解除保险合同,不承担赔偿责任, 不退还保险费。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 保险事故发生后,投保人、被保险人以伪造、变造的有关证明、资料或者其他证据, 编造虚假的事故原因或夸大损失程度的,保险人对其虚报的部分不承担赔偿责任。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 投保人、被保险人有前三款规定行为之一,致使保险人支付保险金或者支出费用的, 应当退回或赔偿。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第三十一条 保险人受理报案、向被保险人提供建议等行为,均不构成保险人对赔偿 责任的承诺。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 被保险人向保险人请求赔偿保险金的诉讼时效期间为二年,自其知道或应当知道保险事 故发生之日起计算。", "", "", false)
pdf.Ln(-1)
pdf.SetX(90)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "合同终止")
pdf.SetFontSize(10)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第三十二条 当发生下列情形之一时(以最先发生者为准),本保险合同终止:", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 1、保险单载明的保险期间届满;", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 2、投保人未中标;", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 3、保险人根据本保险合同支付的保险赔偿总金额已经达到保险单所载明的保险金额。", "", "", false)
pdf.Ln(-1)
pdf.SetX(90)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "争议处理和法律适用")
pdf.SetFontSize(10)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第三十三条 因履行本保险合同发生的争议,由当事人协商解决。协商不成的,提交保 险合同载明的仲裁机构仲裁;保险合同未载明仲裁机构并且争议发生后双方就仲裁机构未达 成仲裁协议的,当事人均有权向中华人民共和国人民法院起诉。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 本保险合同争议处理适用中华人民共和国法律(不包括港、澳、台地区法律)。", "", "", false)
pdf.Ln(-1)
pdf.SetX(90)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "其他事项")
pdf.SetFontSize(10)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第三十四条 本保险合同保险责任开始后,未经被保险人同意,投保人不得解除本保险合同。在保险期间内,经被保险人同意解除保险合同的,保险人在解除保险合同时的有效保 险金额内,按日比例退还未满期部分的保险费。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第三十五条 保险责任开始前,投保人要求解除保险合同的,应当向保险人支付相当于 保险费 5%的手续费,保险人应当退还保险费。", "", "", false)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 本保险合同争议处理适用中华人民共和国法律(不包括港、澳、台地区法律)。", "", "", false)
pdf.Ln(-1)
pdf.AddPage()
pdf.SetFontSize(10)
pdf.SetXY(75, 40)
pdf.Cell(40, 10, "紫金财产保险股份有限公司")
pdf.Ln(-1)
pdf.SetX(75)
pdf.Cell(40, 10, "附加先行赔偿及追偿保险条款")
pdf.Ln(-1)
pdf.SetX(65)
pdf.Cell(40, 10, "注册编号:C00013731422020121500662")
pdf.Ln(-1)
pdf.SetX(48)
pdf.Cell(40, 10, "备案号:(紫金保险)(备-保证保险)【2021】(附) 005 号")
pdf.Ln(-1)
pdf.Ln(-1)
pdf.SetX(90)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "总则")
pdf.SetFontSize(10)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第一条 在投保保证保险(以下简称“主险”)的基础上,投保人可以投保本附加险。主 险合同效力终止,本附加险效力亦同时终止;主险合同无效,本附加险合同亦无效。本附加 险合同未约定事项,以主险合同为准;主险合同与本附加险合同相抵触之处,以本附加险合 同为准。凡涉及本附加险合同的约定,均应采用书面形式。", "", "", false)
pdf.Ln(-1)
pdf.SetX(90)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "赔偿处理")
pdf.SetFontSize(10)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第二条 在保险期间内,发生主险合同约定的保险责任,在被保险人向保险人以书面形 式提出赔偿要求后,保险人在保险金额内向被保险人先行赔偿,不以被保险人向投保人或其 担保人启动诉讼或仲裁索赔程序为前提。", "", "", false)
pdf.Ln(-1)
pdf.SetX(90)
pdf.SetFontSize(14)
pdf.Cell(40, 10, "追偿")
pdf.SetFontSize(10)
pdf.Ln(-1)
pdf.MultiCell(subLineWidth, 6, " 第三条 自保险人向被保险人赔偿保险金之日起,保险人在赔偿金额范围内代位行使被 保险人对投保人或其担保人(如有)请求追偿的权利,被保险人应当向保险人提供必要的文 件和所知道的有关情况,积极协助保险人向投保人或其担保人(如有)进行追偿。被保险人 已经从投保人或其担保人(如有)处取得赔偿的,保险人赔偿保险金时,应相应扣减被保险 人已从投保人或其担保人(如有)处取得的赔偿金额。", "", "", false)
pdf.Ln(-1)
date := time.Now().Format("20060102")
filePath := date + "/" + utils.Md5(order.OrderNo+strconv.Itoa(int(time.Now().UnixMicro()))+utils.GenerateRandomString(10)) + ".pdf"
uploadPath := "."
if global.Config.Server.RootPath != "" {
uploadPath = global.Config.Server.RootPath
}
uploadDir := uploadPath + "/static/uploads/" + date
err := makeDir(uploadDir)
if err != nil {
return "", err
}
dest := uploadPath + "/static/uploads/" + filePath
err = pdf.OutputFileAndClose(dest)
if err != nil {
return "", err
}
return global.Config.Server.Domain + "/uploads/" + filePath, err
}
func makeDir(dirPath string) error {
if _, err := os.Stat(dirPath); os.IsNotExist(err) {
err := os.Mkdir(dirPath, os.ModePerm)
if err != nil {
return err
}
}
return nil
}
type pdfTable struct {
pdf *gofpdf.Fpdf
columnYList []float64
style string // 风格 F仅填充 D仅边框 或者DF两个都要
alignStr string // 对其方式 LCR为水平的左、中、右TMBA为垂直的上、中、下、基准线
fontH float64 // 字体高度
cells []pdfCell //
x float64
y float64
}
type pdfCell struct {
w float64 // 宽度
h float64 // 行高
txtStr string // 文本
lines int // 判断文本会占几行
alignStr string // 对其方式 LCR为水平的左、中、右TMBA为垂直的上、中、下、基准线
x float64
y float64
}
func (s *pdfTable) addRows(style string, alignStr string, cells ...pdfCell) {
s.style = style
s.alignStr = alignStr
_, s.fontH = s.pdf.GetFontSize()
// 记录需要的最高行高
x := s.x
y := s.y
//fmt.Println(x, y)
for column, cell := range cells {
y = s.columnYList[column]
if y <= 0 {
y = s.y
}
fmt.Println(cell)
fmt.Println(cell.txtStr, cell.w)
lines := s.pdf.SplitText(cell.txtStr, cell.w)
//h := float64(len(lines)) * cell.h
cell.lines = len(lines)
//fmt.Println(x, y, len(lines), lines)
cell.x = x
cell.y = y
x = x + cell.w
y = y + cell.h
s.columnYList[column] = y
s.cells = append(s.cells, cell)
}
s.write()
}
func (s *pdfTable) write() {
// 手动记录并移动坐标
for _, c := range s.cells {
alignStr := c.alignStr
if alignStr == "" {
alignStr = s.alignStr
}
usedH := float64(c.lines) * s.fontH
margin := (c.h - usedH) / 2.0
s.pdf.Rect(c.x, c.y, c.w, c.h, s.style)
s.pdf.SetXY(c.x, c.y+margin) // 保持单元格内的文字有边距
s.pdf.MultiCell(c.w, s.fontH, c.txtStr, "", alignStr, false)
}
// 重置变量
s.cells = nil
}
func genTable(pdf *gofpdf.Fpdf, order *model.Order) {
x, y := pdf.GetXY()
myPdf := pdfTable{pdf: pdf}
myPdf.x = x
myPdf.y = y
myPdf.columnYList = make([]float64, 5)
width, _ := pdf.GetPageSize() // 页面宽度
left, _, right, _ := pdf.GetMargins() // 左右边距
usable := width - left - right // 可用的页面宽度
_, h := pdf.GetFontSize() // 字体高度
tableH := h + 2 // 行高 多出2mm的边距
pdf.SetFillColor(233, 233, 233)
// 表头
fmt.Println("usable", usable)
col1Width := 15.0
col2Width := 38.0
col3Width := 59.0
col4Width := 18.0
col5Width := 59.0
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width, h: 7 * tableH, txtStr: "投保人(投标人)"},
{w: col2Width, h: tableH, txtStr: "法人名称/自然人姓名"},
{w: col3Width + col4Width + col5Width, h: tableH, txtStr: order.Applicant.ApplicantName, alignStr: "CM"},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width, h: 0, txtStr: ""},
{w: col2Width, h: tableH, txtStr: "证件类型"},
{w: col3Width, h: tableH, txtStr: "营业执照", alignStr: "CM"},
{w: col4Width, h: tableH, txtStr: "证件号码"},
{w: col5Width, h: tableH, txtStr: order.Applicant.CreditCode, alignStr: "CM"},
}...)
pdf.Rect(x+54.2, y+13.2, 3, 3, "D")
pdf.Rect(x+66.8, y+13.2, 3, 3, "D")
pdf.Rect(x+79.2, y+13.2, 3, 3, "D")
pdf.Rect(x+91.3, y+13.2, 3, 3, "D")
pdf.Rect(x+54.2, y+16.7, 3, 3, "D")
pdf.Rect(x+66.8, y+16.7, 3, 3, "D")
pdf.Rect(x+79.2, y+16.7, 3, 3, "D")
pdf.Rect(x+131, y+15, 3, 3, "D")
pdf.Rect(x+143.6, y+15, 3, 3, "D")
pdf.Rect(x+156.0, y+15, 3, 3, "D")
pdf.Rect(x+168.3, y+15, 3, 3, "D")
//✔
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width, h: 0, txtStr: ""},
{w: col2Width, h: 2 * tableH, txtStr: "法人性质"},
{w: col3Width, h: 2 * tableH, txtStr: " 国有 集体 民营 私营\n 外资 合资 其他"},
{w: col4Width, h: 2 * tableH, txtStr: "法人资质"},
{w: col5Width, h: 2 * tableH, txtStr: " 特级 一级 二级 三级"},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width, h: 0, txtStr: ""},
{w: col2Width, h: tableH, txtStr: "联系人"},
{w: col3Width, h: tableH, txtStr: order.Applicant.ContactName, alignStr: "CM"},
{w: col4Width, h: tableH, txtStr: "联系电话"},
{w: col5Width, h: tableH, txtStr: order.Applicant.ContactMobile, alignStr: "CM"},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width, h: 0, txtStr: ""},
{w: col2Width, h: 2 * tableH, txtStr: "地址"},
{w: col3Width + col4Width + col5Width, h: 2 * tableH, txtStr: order.Applicant.Province + order.Applicant.City + order.Applicant.District + order.Applicant.Address},
{w: 0, h: 2 * tableH, txtStr: ""},
{w: 0, h: 2 * tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width, h: 6 * tableH, txtStr: "被保险人(招标人)"},
{w: col2Width, h: tableH, txtStr: "法人名称/自然人姓名"},
{w: col3Width + col4Width + col5Width, h: tableH, txtStr: order.Assured.AssuredName, alignStr: "CM"},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width, h: 0, txtStr: ""},
{w: col2Width, h: tableH, txtStr: "证件类型"},
{w: col3Width, h: tableH, txtStr: "营业执照", alignStr: "CM"},
{w: col4Width, h: tableH, txtStr: "证件号码"},
{w: col5Width, h: tableH, txtStr: order.Assured.CreditCode, alignStr: "CM"},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width, h: 0, txtStr: ""},
{w: col2Width, h: tableH, txtStr: "招标文件编号"},
{w: col3Width + col4Width + col5Width, h: tableH, txtStr: order.Project.TpID, alignStr: "CM"},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width, h: 0, txtStr: ""},
{w: col2Width, h: tableH, txtStr: "联系人"},
{w: col3Width, h: tableH, txtStr: order.Assured.ContactName, alignStr: "CM"},
{w: col4Width, h: tableH, txtStr: "联系电话"},
{w: col5Width, h: tableH, txtStr: order.Assured.ContactMobile, alignStr: "CM"},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width, h: 0, txtStr: ""},
{w: col2Width, h: 2 * tableH, txtStr: "地址"},
{w: col3Width + col4Width + col5Width, h: 2 * tableH, txtStr: order.Assured.Province + order.Assured.City + order.Assured.District + order.Assured.Address},
{w: 0, h: 2 * tableH, txtStr: ""},
{w: 0, h: 2 * tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width, h: 3 * tableH, txtStr: "投标项目"},
{w: col2Width, h: tableH, txtStr: "项目名称"},
{w: col3Width, h: tableH, txtStr: order.Project.Name, alignStr: "CM"},
{w: col4Width, h: tableH, txtStr: "立项文件号"},
{w: col5Width, h: tableH, txtStr: order.Project.ProjectApprovalNo, alignStr: "CM"},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width, h: 0, txtStr: ""},
{w: col2Width, h: tableH, txtStr: "项目性质"},
{w: col3Width + col4Width + col5Width, h: tableH, txtStr: order.Project.TenderProjectType, alignStr: "CM"},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width, h: 0, txtStr: ""},
{w: col2Width, h: tableH, txtStr: "项目预计金额"},
{w: col3Width + col4Width + col5Width, h: tableH, txtStr: "(人民币)大写: 小写:"},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
projectAmountStr := order.Project.Amount
projectAmount, _ := strconv.ParseFloat(projectAmountStr, 64)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width + col2Width, h: tableH, txtStr: "保险金额"},
{w: 0, h: tableH, txtStr: ""},
{w: col3Width + col4Width + col5Width, h: tableH, txtStr: "(人民币)大写:" + utils.AmountToUpper(projectAmount) + " 小写:" + projectAmountStr},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
insureAmount := math.Round(projectAmount * 0.003)
if insureAmount < 200 {
insureAmount = 200.00
}
insureAmountStr := fmt.Sprintf("%.2f", insureAmount)
insureAmount, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", insureAmount), 64)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width + col2Width, h: tableH, txtStr: "保险费"},
{w: 0, h: tableH, txtStr: ""},
{w: col3Width + col4Width + col5Width, h: tableH, txtStr: "(人民币)大写:" + utils.AmountToUpper(insureAmount) + " 小写:" + insureAmountStr},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width + col2Width, h: tableH, txtStr: "绝对免赔额/免赔率"},
{w: 0, h: tableH, txtStr: ""},
{w: col3Width + col4Width + col5Width, h: tableH, txtStr: " / "},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width + col2Width, h: tableH, txtStr: "保险区间"},
{w: 0, h: tableH, txtStr: ""},
{w: col3Width + col4Width + col5Width, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width + col2Width, h: 14 * tableH, txtStr: "特别约定"},
{w: 0, h: 14 * tableH, txtStr: ""},
{w: col3Width + col4Width + col5Width, h: 14 * tableH, txtStr: "1、本保单为见索即付保单本保单发生保险事故由保险人先行赔付后享有对 投保人的代位求偿权。2、本保单项下本保险在投标有效期到期后28日(含)内或被保 险人延长投标有效期后到期日后28日(含)内保持有效,延长投标有效期无需通知本保险 人,但任何索赔要求应在投标有效期内送达我方。保险失效后由平台将本保单交投标人 退回我司注销。3、兹承诺在收到被保险人书面通知说明下列中的任何一条时保 证在10日内无条件给付给被保险人金额为不超过保险金额的款项。1)投保人在投标有效 期内撤销或修改其投标文件的2)投保人在中标后,非因不可抗力原因放弃中标、无正 当理由不与招标人订立合同、在签订合同时向招标人提出附加条件、或者不按招标文件 要求提交履约担保金的3)投标人的投标文件存在《福建省住房和城乡建设厅关于施工 招标项目电子投标文件置同认定与处理的指导意见》 (闽建筑[2018]29号)规定的雷同情 形之一4)投标人中标后因违法行为导致中标被依法确认无效的5) 法律、法规规定 的其他没收投标保险金情形。4、我单位在收到招标人索赔申请后10日内无条件给予先 行支付预赔款,赔付流程将根据我单位向宁德市公共资源交易中心提供的《金融机构理 赔流程标准》执行。本保险项下所有权利和义务均受中华人民共和国法律管辖和制约。 查验保函网址:http://www.zking.com/dzbdxzcx.jhtml\n尊敬的客户您可以通过电话95312、公司柜面或登陆公司网站\nwww.zking.com查询您的保单信息、状态以及理赔情况。如您对查询结果有异议 请及时致电本公司。\n无其他特别约定"},
{w: 0, h: 14 * tableH, txtStr: ""},
{w: 0, h: 14 * tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width + col2Width, h: tableH, txtStr: "保险合同争议解决方式"},
{w: 0, h: tableH, txtStr: ""},
{w: col3Width + col4Width + col5Width, h: tableH, txtStr: "诉讼"},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width + col2Width, h: tableH, txtStr: "司法管辖"},
{w: 0, h: tableH, txtStr: ""},
{w: col3Width + col4Width + col5Width, h: tableH, txtStr: "中华人民共和国管辖(港澳台除外)"},
{w: 0, h: tableH, txtStr: ""},
{w: 0, h: tableH, txtStr: ""},
}...)
}
func genTable1(pdf *gofpdf.Fpdf) {
x, y := pdf.GetXY()
myPdf := pdfTable{pdf: pdf}
myPdf.x = x
myPdf.y = y
myPdf.columnYList = make([]float64, 5)
width, _ := pdf.GetPageSize() // 页面宽度
left, _, right, _ := pdf.GetMargins() // 左右边距
usable := width - left - right // 可用的页面宽度
_, h := pdf.GetFontSize() // 字体高度
tableH := h + 2 // 行高 多出2mm的边距
//tableWidth := usable / 5 // 每个单元个的宽度
pdf.SetFillColor(233, 233, 233)
fmt.Println(usable)
col1Width := 15.0
col2Width := 38.0
col3Width := 59.0
col4Width := 18.0
col5Width := 59.0
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width + col2Width, h: 5 * tableH, txtStr: "偿付能力信息"},
{w: 0, h: 5 * tableH, txtStr: ""},
{w: col3Width + col4Width + col5Width, h: 5 * tableH, txtStr: "我公司最近季度的综合偿付能力充足率和风险综合评级结果告知如下:1、我公司2024年1季度综合偿付能力充足率:339.97%, 已达到政府监管要 求。\n2、我公司2024年1季度核心偿付能力充足率:262.64%, 已达到政府监管要 求。\n3、我公司2023年4季度风险综合评级:AAA级。"},
{w: 0, h: 5 * tableH, txtStr: ""},
{w: 0, h: 5 * tableH, txtStr: ""},
}...)
}
func fileExists(filePath string) bool {
_, err := os.Stat(filePath)
if err != nil {
if os.IsNotExist(err) {
return false
}
}
return true
}

Binary file not shown.

@ -3,7 +3,9 @@ package utils
import ( import (
"context" "context"
"insure/global" "insure/global"
"log"
"math/rand" "math/rand"
"regexp"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -29,3 +31,48 @@ func GenerateRandomString(length int) string {
} }
return string(result) return string(result)
} }
func AmountToUpper(num float64) string {
strNum := strconv.FormatFloat(num*100, 'f', 0, 64)
sliceUnit := []string{"仟", "佰", "拾", "亿", "仟", "佰", "拾", "万", "仟", "佰", "拾", "元", "角", "分"}
s := sliceUnit[len(sliceUnit)-len(strNum) : len(sliceUnit)]
upperDigitUnit := map[string]string{"0": "零", "1": "壹", "2": "贰", "3": "叁", "4": "肆", "5": "伍", "6": "陆", "7": "柒", "8": "捌", "9": "玖"}
str := ""
for k, v := range strNum[:] {
str = str + upperDigitUnit[string(v)] + s[k]
}
reg, err := regexp.Compile(`零角零分$`)
str = reg.ReplaceAllString(str, "整")
reg, err = regexp.Compile(`零角`)
str = reg.ReplaceAllString(str, "零")
reg, err = regexp.Compile(`零分$`)
str = reg.ReplaceAllString(str, "整")
reg, err = regexp.Compile(`零[仟佰拾]`)
str = reg.ReplaceAllString(str, "零")
reg, err = regexp.Compile(`{2,}`)
str = reg.ReplaceAllString(str, "零")
reg, err = regexp.Compile(`零亿`)
str = reg.ReplaceAllString(str, "亿")
reg, err = regexp.Compile(`零万`)
str = reg.ReplaceAllString(str, "万")
reg, err = regexp.Compile(`零*元`)
str = reg.ReplaceAllString(str, "元")
reg, err = regexp.Compile(`亿零{0, 3}万`)
str = reg.ReplaceAllString(str, "^元")
reg, err = regexp.Compile(`零元`)
str = reg.ReplaceAllString(str, "零")
if err != nil {
log.Fatal(err)
}
return str
}

Loading…
Cancel
Save