You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

727 lines
32 KiB
Go

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package main
import (
"encoding/json"
"flag"
"fmt"
"github.com/gin-gonic/gin"
"github.com/jung-kurt/gofpdf"
"github.com/tidwall/gjson"
"insure/global"
"insure/initialize"
"insure/router"
"strconv"
)
func main() {
initial()
//testVerify()
//runServer()
//gen3()
runServerInWindows()
//jsonum1()
}
func initial() {
var configFilePath string
flag.StringVar(&configFilePath, "config", "./conf/config.yaml", "配置文件")
flag.Parse()
global.Config = initialize.InitConfig(configFilePath)
global.DB = initialize.InitDB(global.Config)
global.Redis = initialize.InitRedis(global.Config)
}
/*func runServer() {
r := gin.Default()
s := &http.Server{
Addr: ":8080",
Handler: r,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
MaxHeaderBytes: 1 << 20,
}
router.Initial(r)
err := endless.ListenAndServe(":"+global.Config.Server.Port, s.Handler)
if err != nil {
panic(err)
}
}*/
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() {
r := gin.Default()
router.Initial(r)
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("SIMFANG", "", "./SIMFANG.TTF")
pdf.SetFont("SIMFANG", "", 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)
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: ""},
}...)
}