Compare commits

...

2 Commits

Author SHA1 Message Date
elf 1738b5b5cf y 4 months ago
elf 5b48365e4b yh 4 months ago

@ -51,6 +51,10 @@ func GetSignUrl(c *gin.Context) (result.Data, error) {
return nil, err
}
if order.Applicant.SignUrl == "" {
return nil, e.NewError("签章文件未生成")
}
param := signer.SignParam{}
param.Url = order.Applicant.SignUrl
param.UploadUrl = global.Config.Server.Domain + "/api/suixing/upload-signed-file"
@ -193,3 +197,15 @@ func GenerateSignFile(c *gin.Context) (result.Data, error) {
return result.Data{}, nil
}
func GetPayInfo(c *gin.Context) (result.Data, error) {
token := c.DefaultQuery("token", "")
if token == "" {
return nil, e.NewError("缺少参数")
}
payInfo, err := service.OrderService.GetPayInfo(token)
if err != nil {
return nil, err
}
return result.Data{"PayInfo": payInfo}, nil
}

@ -23,6 +23,21 @@ func GetOrders(c *gin.Context) (result.Data, error) {
return data, nil
}
func GetOrder(c *gin.Context) (result.Data, error) {
orderNo := c.DefaultQuery("orderNo", "")
if orderNo == "" {
return nil, e.NewError("参数错误")
}
order, err := service.OrderService.GetOrderByOrderNo(orderNo)
if err != nil {
return nil, err
}
data := result.Data{
"order": order,
}
return data, nil
}
func DownloadOrders(c *gin.Context) {
var req request.OrderQueryRequest
_ = c.ShouldBindQuery(&req)

@ -0,0 +1,23 @@
package response
type PayInfoResponse struct {
OrderSn string
OrderCreateTime string
PayAmount string
ProductName string
Remark string
Payee Payee
Payer Payer
}
type Payer struct {
BankName string
BankCardNum string
BankUserName string
}
type Payee struct {
BankName string
BankCardNum string
BankUserName string
}

BIN
insure

Binary file not shown.

@ -0,0 +1,49 @@
server {
listen 80;
server_name fjtb.bj-eib.com;
client_max_body_size 20M;
location /api/ {
proxy_pass http://127.0.0.1:9090/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}
location /admin/ {
proxy_pass http://127.0.0.1:8088/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}
location /uploads {
root /var/www/insure/static;
}
location / {
root /var/www/insure-html;
try_files $uri $uri/ /index.html;
}
location ~ /\. {
deny all;
}
}
server {
listen 8088;
server_name localhost;
root /var/www/insure-admin-html;
location /admin/ {
index index.html;
}
location ~ /\. {
deny all;
}
}

@ -0,0 +1,10 @@
[program:insure]
;directory=/var/www/insure
command=/var/www/insure/insure --config=/var/www/insure/conf/config.yaml
user=www
autostart=true
autorestart=true
startsecs=1
startretries=3
stderr_logfile=/var/www/insure/runtime/stderr.log
stdout_logfile=/var/www/insure/runtime/stdout.log

@ -1,96 +1,82 @@
CREATE TABLE `order` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`request_id` varchar(20) NOT NULL DEFAULT '' COMMENT '请求ID',
`order_sn` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `udx_ordersn` (`order_sn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单表';
/*
Navicat Premium Data Transfer
CREATE TABLE `user` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`order_sn` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`user_id` varchar(50) NOT NULL DEFAULT '' COMMENT '投保人(当前登录用户)ID',
`mobile` varchar(50) NOT NULL DEFAULT '' COMMENT '投保人(当前登录用户)手机号',
`username` varchar(50) NOT NULL DEFAULT '' COMMENT '投保人(当前登录用户)用户名',
`unitid` varchar(50) NOT NULL DEFAULT '' COMMENT '投保人(当前登录用户)单位ID',
`unitname` varchar(50) NOT NULL DEFAULT '' COMMENT '投保人(当前登录用户)企业名称',
`beiandiqu_code` varchar(50) NOT NULL DEFAULT '' COMMENT '备案地区编码',
`bank_name` varchar(100) NOT NULL DEFAULT '' COMMENT '投保企业基本户开户行',
`bank_card_name` varchar(100) NOT NULL DEFAULT '' COMMENT '投保企业基本户银行卡号',
`bank_user_name` varchar(100) NOT NULL DEFAULT '' COMMENT '投保企业基本户名称',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `udx_ordersn` (`order_sn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表';
Source Server : elf-new
Source Server Type : MySQL
Source Server Version : 80032 (8.0.32)
Source Host : 124.223.222.61:3306
Source Schema : insure
Target Server Type : MySQL
Target Server Version : 80032 (8.0.32)
File Encoding : 65001
Date: 11/07/2024 02:03:28
*/
CREATE TABLE `projects` (
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for admins
-- ----------------------------
DROP TABLE IF EXISTS `admins`;
CREATE TABLE `admins` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`order_sn` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`name` varchar(500) NOT NULL DEFAULT '' COMMENT '项目名称',
`tpid` varchar(50) NOT NULL DEFAULT '' COMMENT '招标项目编号',
`bdid` varchar(50) NOT NULL DEFAULT '' COMMENT '标段包编号',
`bd_name` varchar(50) NOT NULL DEFAULT '' COMMENT '标段包名称',
`start_date` datetime default null COMMENT '开标时间',
`amount` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '保证金金额',
`province` varchar(50) NOT NULL DEFAULT '' COMMENT '省编码',
`city` varchar(50) NOT NULL DEFAULT '' COMMENT '市编码',
`district` varchar(50) NOT NULL DEFAULT '' COMMENT '区编码',
`bzj_etime` datetime default null COMMENT '保证金缴纳截止时间',
`create_time` datetime default null COMMENT '项目发布时间',
`plan_date` varchar(50) NOT NULL DEFAULT '' COMMENT '计划工期',
`build_price` varchar(50) NOT NULL DEFAULT '' COMMENT '项目预计造价',
`build_place` varchar(800) NOT NULL DEFAULT '' COMMENT '项目建设地点',
`tender_project_type` varchar(50) NOT NULL DEFAULT '' COMMENT '招标项目类别',
`valid_period` varchar(50) NOT NULL DEFAULT '' COMMENT '投标有效期',
`tender_notice_url` varchar(500) NOT NULL DEFAULT '' COMMENT '招标公告地址',
`tender_file_url` varchar(500) NOT NULL DEFAULT '' COMMENT '招标文件下载地址',
`tender_file_url_md5` varchar(32) NOT NULL DEFAULT '' COMMENT '招标文件md5值',
`project_approval_no` varchar(50) NOT NULL DEFAULT '' COMMENT '项目审批文号',
`username` varchar(20) NOT NULL COMMENT '手机号',
`nickname` varchar(32) NOT NULL DEFAULT '' COMMENT '昵称',
`password_hash` varchar(64) NOT NULL COMMENT '登录密码',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '账号状体1启用',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `udx_ordersn` (`order_sn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='项目表';
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='管理员表';
-- ----------------------------
-- Table structure for applicant
-- ----------------------------
DROP TABLE IF EXISTS `applicant`;
CREATE TABLE `applicant` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`order_sn` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`order_no` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`applicant_name` varchar(100) NOT NULL DEFAULT '' COMMENT '姓名或企业名称',
`credit_code` varchar(100) NOT NULL DEFAULT '' COMMENT '身份证号码或统一社会信用代码',
`credit_vld` date DEFAULT null COMMENT '证件有效期',
`credit_vld` varchar(20) NOT NULL DEFAULT '' COMMENT '证件有效期',
`contact_name` varchar(100) NOT NULL DEFAULT '' COMMENT '联系人',
`contact_mobile` varchar(50) default null COMMENT '联系手机',
`com_tel_area` varchar(50) default null COMMENT '公司联系电话区号',
`contact_mobile` varchar(50) DEFAULT NULL COMMENT '联系手机',
`com_tel_area` varchar(50) DEFAULT NULL COMMENT '公司联系电话区号',
`province` varchar(50) NOT NULL DEFAULT '' COMMENT '省编码',
`city` varchar(50) NOT NULL DEFAULT '' COMMENT '市编码',
`district` varchar(50) NOT NULL DEFAULT '' COMMENT '区编码',
`address` varchar(200) NOT NULL DEFAULT '' COMMENT '详细地址',
`email` varchar(50) NOT NULL DEFAULT '' COMMENT '邮箱',
`legal_name` datetime default null COMMENT '投保企业法人姓名',
`legal_name` varchar(50) NOT NULL DEFAULT '' COMMENT '投保企业法人姓名',
`legal_num` varchar(50) NOT NULL DEFAULT '' COMMENT '投保企业法人证件号',
`com_tel_num` varchar(50) NOT NULL DEFAULT '' COMMENT '投保企业法人联系方式',
`license_files` varchar(1000) NOT NULL DEFAULT '' COMMENT '营业执照',
`invoice_type` varchar(20) NOT NULL DEFAULT '' COMMENT '发票类型',
`invoice_accept_email` varchar(100) NOT NULL DEFAULT '' COMMENT '发票接收邮箱',
`sign_url` varchar(500) NOT NULL DEFAULT '' COMMENT '签章文件下载地址',
`signed_url` varchar(500) NOT NULL DEFAULT '' COMMENT '已签章文件下载地址',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `udx_ordersn` (`order_sn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='投标人';
UNIQUE KEY `udx_ordersn` (`order_no`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='投标人';
-- ----------------------------
-- Table structure for assured
-- ----------------------------
DROP TABLE IF EXISTS `assured`;
CREATE TABLE `assured` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`order_sn` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`order_no` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`assured_name` varchar(500) NOT NULL DEFAULT '' COMMENT '招标人名称',
`credit_code` varchar(100) NOT NULL DEFAULT '' COMMENT '身份证号码或统一社会信用代码',
`credit_vld` date DEFAULT null COMMENT '证件有效期',
`credit_vld` varchar(20) NOT NULL DEFAULT '' COMMENT '证件有效期',
`contact_name` varchar(100) NOT NULL DEFAULT '' COMMENT '联系人',
`contact_mobile` varchar(50) default null COMMENT '联系手机',
`com_tel_area` varchar(50) default null COMMENT '公司联系电话区号',
`contact_mobile` varchar(50) DEFAULT NULL COMMENT '联系手机',
`com_tel_area` varchar(50) DEFAULT NULL COMMENT '公司联系电话区号',
`province` varchar(50) NOT NULL DEFAULT '' COMMENT '省编码',
`city` varchar(50) NOT NULL DEFAULT '' COMMENT '市编码',
`district` varchar(50) NOT NULL DEFAULT '' COMMENT '区编码',
@ -103,31 +89,54 @@ CREATE TABLE `assured` (
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `udx_ordersn` (`order_sn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='招标人';
UNIQUE KEY `udx_ordersn` (`order_no`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='招标人';
CREATE TABLE `sign_log` (
-- ----------------------------
-- Table structure for invoice
-- ----------------------------
DROP TABLE IF EXISTS `invoice`;
CREATE TABLE `invoice` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`order_sn` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`is_upload_pdf` tinyint(1) NOT NULL DEFAULT 0,
`file_info` varchar(500) NOT NULL DEFAULT '' COMMENT '文件信息',
`pc_info` varchar(500) NOT NULL DEFAULT '' COMMENT 'pc信息',
`ca_info` varchar(500) NOT NULL DEFAULT '' COMMENT '签章信息',
`sign_url` varchar(500) NOT NULL DEFAULT '' COMMENT '签章文件下载地址',
`params` varchar(500) NOT NULL DEFAULT '' COMMENT '参数',
`order_no` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`header` varchar(255) NOT NULL DEFAULT '' COMMENT '发票抬头',
`tax_number` varchar(50) NOT NULL DEFAULT '' COMMENT '税号',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后更新时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_ordersn` (`order_sn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='签章日志';
UNIQUE KEY `udx_orderno` (`order_no`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='发票信息';
-- ----------------------------
-- Table structure for order
-- ----------------------------
DROP TABLE IF EXISTS `order`;
CREATE TABLE `order` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`order_no` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`order_sn` varchar(32) NOT NULL DEFAULT '' COMMENT '订单编号',
`request_id` varchar(20) NOT NULL DEFAULT '' COMMENT '请求ID',
`token` varchar(32) NOT NULL DEFAULT '' COMMENT 'Token',
`status` varchar(20) NOT NULL DEFAULT '' COMMENT '状态',
`pay_url` varchar(500) NOT NULL DEFAULT '' COMMENT '支付url',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `udx_ordersn` (`order_no`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='订单表';
-- ----------------------------
-- Table structure for order_result
-- ----------------------------
DROP TABLE IF EXISTS `order_result`;
CREATE TABLE `order_result` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`order_sn` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`order_no` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`order_sn` varchar(32) NOT NULL DEFAULT '' COMMENT '订单编号',
`policy_no` varchar(50) NOT NULL DEFAULT '' COMMENT '保单号',
`min_premium` varchar(12) NOT NULL DEFAULT '' COMMENT '最低保费,单位元',
`rate` varchar(12) NOT NULL DEFAULT '' COMMENT '费率,千分制',
`status` varchar(4) NOT NULL DEFAULT '' COMMENT '状态',
`rate` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '费率,千分制',
`status` varchar(4) NOT NULL DEFAULT '0' COMMENT '状态',
`service_amount` varchar(12) NOT NULL DEFAULT '' COMMENT '保费金额',
`gurantee_link` varchar(500) NOT NULL DEFAULT '' COMMENT '已生效的保函下载地址',
`gurantee_link_md5` varchar(32) NOT NULL DEFAULT '' COMMENT '已生效的保函文件的md5',
@ -141,5 +150,81 @@ CREATE TABLE `order_result` (
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `udx_ordersn` (`order_sn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='保单结果';
UNIQUE KEY `udx_ordersn` (`order_no`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='保单结果';
-- ----------------------------
-- Table structure for project
-- ----------------------------
DROP TABLE IF EXISTS `project`;
CREATE TABLE `project` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`order_no` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`name` varchar(500) NOT NULL DEFAULT '' COMMENT '项目名称',
`tp_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '招标项目编号',
`bd_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '标段包编号',
`bd_name` varchar(50) NOT NULL DEFAULT '' COMMENT '标段包名称',
`start_date` varchar(50) NOT NULL DEFAULT '' COMMENT '开标时间',
`amount` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '保证金金额',
`province` varchar(50) NOT NULL DEFAULT '' COMMENT '省编码',
`city` varchar(50) NOT NULL DEFAULT '' COMMENT '市编码',
`district` varchar(50) NOT NULL DEFAULT '' COMMENT '区编码',
`bzj_etime` varchar(50) NOT NULL DEFAULT '' COMMENT '保证金缴纳截止时间',
`create_time` varchar(50) NOT NULL DEFAULT '' COMMENT '项目发布时间',
`plan_date` varchar(50) NOT NULL DEFAULT '' COMMENT '计划工期',
`build_price` varchar(50) NOT NULL DEFAULT '' COMMENT '项目预计造价',
`build_place` varchar(800) NOT NULL DEFAULT '' COMMENT '项目建设地点',
`tender_project_type` varchar(50) NOT NULL DEFAULT '' COMMENT '招标项目类别',
`valid_period` varchar(50) NOT NULL DEFAULT '' COMMENT '投标有效期',
`tender_notice_url` varchar(500) NOT NULL DEFAULT '' COMMENT '招标公告地址',
`tender_file_url` varchar(500) NOT NULL DEFAULT '' COMMENT '招标文件下载地址',
`tender_file_url_md5` varchar(32) NOT NULL DEFAULT '' COMMENT '招标文件md5值',
`project_approval_no` varchar(50) NOT NULL DEFAULT '' COMMENT '项目审批文号',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `udx_ordersn` (`order_no`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='项目表';
-- ----------------------------
-- Table structure for sign_log
-- ----------------------------
DROP TABLE IF EXISTS `sign_log`;
CREATE TABLE `sign_log` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`order_no` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`is_upload_pdf` tinyint(1) NOT NULL DEFAULT '0',
`file_info` varchar(500) NOT NULL DEFAULT '' COMMENT '文件信息',
`pc_info` varchar(500) NOT NULL DEFAULT '' COMMENT 'pc信息',
`ca_info` varchar(500) NOT NULL DEFAULT '' COMMENT '签章信息',
`sign_url` varchar(500) NOT NULL DEFAULT '' COMMENT '签章文件下载地址',
`params` varchar(500) NOT NULL DEFAULT '' COMMENT '参数',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后更新时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_ordersn` (`order_no`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='签章日志';
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`order_no` varchar(20) NOT NULL DEFAULT '' COMMENT '订单编号',
`user_id` varchar(50) NOT NULL DEFAULT '' COMMENT '投保人(当前登录用户)ID',
`mobile` varchar(50) NOT NULL DEFAULT '' COMMENT '投保人(当前登录用户)手机号',
`username` varchar(50) NOT NULL DEFAULT '' COMMENT '投保人(当前登录用户)用户名',
`unit_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '投保人(当前登录用户)单位ID',
`unit_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '投保人(当前登录用户)企业名称',
`beiandiqu_code` varchar(50) NOT NULL DEFAULT '' COMMENT '备案地区编码',
`bank_name` varchar(100) NOT NULL DEFAULT '' COMMENT '投保企业基本户开户行',
`bank_card_num` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '投保企业基本户银行卡号',
`bank_user_name` varchar(100) NOT NULL DEFAULT '' COMMENT '投保企业基本户名称',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后更新时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `udx_ordersn` (`order_no`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户表';
SET FOREIGN_KEY_CHECKS = 1;

@ -14,6 +14,7 @@ type Project struct {
BdName string
StartDate string
Amount string
InsureAmount string
Province string
City string
District string

@ -0,0 +1,13 @@
user www;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
include extra/*.conf;
}

@ -19,6 +19,7 @@ func adminRouteInit(r *gin.Engine) {
authGroup.Match([]string{"POST", "OPTIONS"}, "/logout", result.Json(manage.Logout))
authGroup.Match([]string{"POST", "OPTIONS"}, "/add-admin", result.Json(manage.AddAdmin))
authGroup.Match([]string{"GET", "OPTIONS"}, "/get-orders", result.Json(manage.GetOrders))
authGroup.Match([]string{"GET", "OPTIONS"}, "/get-order", result.Json(manage.GetOrder))
authGroup.Match([]string{"GET", "OPTIONS"}, "/download-orders", manage.DownloadOrders)
}
}

@ -17,5 +17,6 @@ func webRouteInit(r *gin.Engine) {
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-status", result.Json(h5.GetOrderStatus))
webGroup.Match([]string{"GET", "OPTIONS"}, "/get-pay-info", result.Json(h5.GetPayInfo))
webGroup.Match([]string{"POST", "OPTIONS"}, "/generate-sign-file", result.Json(h5.GenerateSignFile))
}

@ -3,11 +3,13 @@ package service
import (
"encoding/json"
"errors"
"fmt"
"github.com/gin-gonic/gin"
"github.com/xuri/excelize/v2"
"gorm.io/gorm"
"insure/dto/request"
"insure/dto/request/manage"
"insure/dto/response"
"insure/e"
"insure/global"
"insure/model"
@ -16,6 +18,7 @@ import (
"insure/third_party/zking"
"insure/utils"
"insure/utils/excel"
"math"
"net/http"
"strconv"
"strings"
@ -90,6 +93,14 @@ func (s *orderService) saveUser(orderNo string, user suixing.User) (*model.User,
}
func (s *orderService) saveProject(orderNo string, project suixing.Project) (*model.Project, error) {
projectAmount, _ := strconv.ParseFloat(project.Amount, 64)
insureAmount := math.Round(projectAmount * 0.003)
if insureAmount < 200 {
insureAmount = 200.00
}
insureAmountStr := fmt.Sprintf("%.2f", insureAmount)
p := model.Project{}
p.OrderNo = orderNo
p.Name = project.Name
@ -98,6 +109,7 @@ func (s *orderService) saveProject(orderNo string, project suixing.Project) (*mo
p.BdName = project.BdName
p.StartDate = project.StartDate
p.Amount = project.Amount
p.InsureAmount = insureAmountStr
p.Province = project.Province
p.City = project.City
p.District = project.District
@ -203,6 +215,7 @@ func (s *orderService) GetOrderByOrderNo(orderNo string) (*model.Order, error) {
Preload("Applicant").
Preload("Assured").
Preload("Invoice").
Preload("OrderResult").
Where("order_no", orderNo).
First(&order).
Error
@ -545,6 +558,7 @@ func (s *orderService) GetOrders(req manage.OrderQueryRequest) ([]model.Order, i
Preload("Project").
Preload("Applicant").
Preload("Assured").
Preload("OrderResult").
Order("id desc").Offset(offset).Limit(req.PageSize).Find(&orders)
tx.Model(&model.Order{}).Count(&total)
return orders, total
@ -793,3 +807,31 @@ func (s *orderService) UpdateInvoice(req request.UpdateInvoiceRequest) (*model.O
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})
}
func (s *orderService) GetPayInfo(token string) (*response.PayInfoResponse, error) {
order, err := s.GetOrderByToken(token)
if err != nil {
return nil, err
}
if order.Status != "submitted" {
return nil, e.NewError("订单状态异常")
}
payInfo := response.PayInfoResponse{
PayAmount: order.Project.InsureAmount,
OrderSn: order.OrderSn,
OrderCreateTime: order.CreatedAt.Format("2006-01-02 15:04:05"),
ProductName: "投标保证保险",
Remark: "",
Payee: response.Payee{
BankName: "中国工商银行福州下渡支行",
BankCardNum: "1402024519601002227",
BankUserName: "紫金财产保险股份有限公司福建分公司",
},
Payer: response.Payer{
BankName: order.User.BankName,
BankCardNum: order.User.BankCardNum,
BankUserName: order.User.BankUserName,
},
}
return &payInfo, nil
}

@ -6,7 +6,6 @@ import (
"insure/global"
"insure/model"
"insure/utils"
"math"
"os"
"strconv"
"time"
@ -667,12 +666,8 @@ func genTable(pdf *gofpdf.Fpdf, order *model.Order) {
{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)
insureAmountStr := order.Project.InsureAmount
insureAmount, _ := strconv.ParseFloat(insureAmountStr, 64)
myPdf.addRows("", "LM", []pdfCell{
{w: col1Width + col2Width, h: tableH, txtStr: "保险费"},
{w: 0, h: tableH, txtStr: ""},

Binary file not shown.
Loading…
Cancel
Save