Просмотр исходного кода

Merge branch 'develop' of http://code.dashoo.cn/chengjian/opms_backend into develop

Cheng Jian 3 лет назад
Родитель
Сommit
8477ab3e70
40 измененных файлов с 3999 добавлено и 869 удалено
  1. 360 5
      doc/订单全流程管理平台.pdma.json
  2. 36 0
      opms_parent/app/dao/contract/ctr_contract_dynamics.go
  3. 438 0
      opms_parent/app/dao/contract/internal/ctr_contract_dynamics.go
  4. 37 7
      opms_parent/app/dao/plat/internal/plat_task.go
  5. 446 0
      opms_parent/app/dao/plat/internal/plat_task_handle.go
  6. 36 0
      opms_parent/app/dao/plat/plat_task_handle.go
  7. 23 0
      opms_parent/app/handler/contract/ctr_contract.go
  8. 17 0
      opms_parent/app/handler/contract/ctr_contract_collection_plan.go
  9. 0 0
      opms_parent/app/handler/contract/ctr_contract_invoice.go
  10. 13 16
      opms_parent/app/handler/cust/contant.go
  11. 114 117
      opms_parent/app/handler/cust/customer.go
  12. 20 0
      opms_parent/app/handler/plat/task.go
  13. 5 5
      opms_parent/app/model/contract/ctr_contract_collection.go
  14. 11 5
      opms_parent/app/model/contract/ctr_contract_collection_plan.go
  15. 25 0
      opms_parent/app/model/contract/ctr_contract_dynamics.go
  16. 30 29
      opms_parent/app/model/contract/ctr_contract_invoice.go
  17. 28 0
      opms_parent/app/model/contract/internal/ctr_contract_dynamics.go
  18. 11 4
      opms_parent/app/model/cust/cust_customer.go
  19. 13 3
      opms_parent/app/model/plat/internal/plat_task.go
  20. 31 0
      opms_parent/app/model/plat/internal/plat_task_handle.go
  21. 15 0
      opms_parent/app/model/plat/plat_task.go
  22. 14 0
      opms_parent/app/model/plat/plat_task_handle.go
  23. 124 0
      opms_parent/app/service/contract/ctr_contract.go
  24. 32 8
      opms_parent/app/service/contract/ctr_contract_append.go
  25. 44 26
      opms_parent/app/service/contract/ctr_contract_collection.go
  26. 53 15
      opms_parent/app/service/contract/ctr_contract_collection_plan.go
  27. 321 0
      opms_parent/app/service/contract/ctr_contract_invoice.go
  28. 0 212
      opms_parent/app/service/contract/ctr_contract_invoice.go.bak
  29. 289 274
      opms_parent/app/service/cust/cust_customer.go
  30. 20 24
      opms_parent/app/service/cust/cust_customer_contact.go
  31. 2 3
      opms_parent/app/service/plat/plat_followup.go
  32. 1 2
      opms_parent/app/service/plat/plat_followup_comment.go
  33. 205 24
      opms_parent/app/service/plat/plat_task.go
  34. 1 2
      opms_parent/app/service/plat/plat_task_comment.go
  35. 1 2
      opms_parent/app/service/plat/plat_task_progress.go
  36. 4 0
      opms_parent/main.go
  37. BIN
      opms_parent/opms_parent
  38. 21 2
      opms_parent/schema/contract.sql
  39. 1 1
      opms_parent/swaggerui/index.html
  40. 1157 83
      opms_parent/swaggerui/swagger.yml

+ 360 - 5
doc/订单全流程管理平台.pdma.json

@@ -2,9 +2,9 @@
   "name": "订单全流程管理平台",
   "describe": "订单全流程管理平台",
   "avatar": "",
-  "version": "4.2.2",
-  "createdTime": "2023-1-6 11:43:05",
-  "updatedTime": "2023-1-6 11:43:05",
+  "version": "4.1.1",
+  "createdTime": "2022-12-6 07:35:33",
+  "updatedTime": "2023-1-9 17:45:35",
   "dbConns": [],
   "profile": {
     "default": {
@@ -7093,7 +7093,7 @@
         },
         {
           "defKey": "appro_status",
-          "defName": "审核状态",
+          "defName": "审核状态 10 未通过 20 已通过",
           "comment": "",
           "type": "",
           "len": "",
@@ -13987,6 +13987,360 @@
       ],
       "correlations": [],
       "indexes": []
+    },
+    {
+      "id": "E5C3DA58-7436-45A1-87DE-284D7A724914",
+      "env": {
+        "base": {
+          "nameSpace": "",
+          "codeRoot": ""
+        }
+      },
+      "defKey": "ctr_contract_dynamics",
+      "defName": "合同动态",
+      "comment": "",
+      "properties": {
+        "partitioned by": "(date string)",
+        "row format delimited": "",
+        "fields terminated by ','": "",
+        "collection items terminated by '-'": "",
+        "map keys terminated by ':'": "",
+        "store as textfile;": ""
+      },
+      "nameTemplate": "{defKey}[{defName}]",
+      "headers": [
+        {
+          "refKey": "hideInGraph",
+          "hideInGraph": true
+        },
+        {
+          "refKey": "defKey",
+          "hideInGraph": false
+        },
+        {
+          "refKey": "defName",
+          "hideInGraph": false
+        },
+        {
+          "refKey": "primaryKey",
+          "hideInGraph": false
+        },
+        {
+          "refKey": "notNull",
+          "hideInGraph": true
+        },
+        {
+          "refKey": "autoIncrement",
+          "hideInGraph": true
+        },
+        {
+          "refKey": "domain",
+          "hideInGraph": true
+        },
+        {
+          "refKey": "type",
+          "hideInGraph": false
+        },
+        {
+          "refKey": "len",
+          "hideInGraph": false
+        },
+        {
+          "refKey": "scale",
+          "hideInGraph": false
+        },
+        {
+          "refKey": "comment",
+          "hideInGraph": true
+        },
+        {
+          "refKey": "refDict",
+          "hideInGraph": true
+        },
+        {
+          "refKey": "defaultValue",
+          "hideInGraph": true
+        },
+        {
+          "refKey": "isStandard",
+          "hideInGraph": false
+        },
+        {
+          "refKey": "uiHint",
+          "hideInGraph": true
+        },
+        {
+          "refKey": "extProps",
+          "hideInGraph": true
+        }
+      ],
+      "fields": [
+        {
+          "defKey": "id",
+          "defName": "主键",
+          "comment": "",
+          "type": "",
+          "len": "",
+          "scale": "",
+          "primaryKey": true,
+          "notNull": true,
+          "autoIncrement": true,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "refDict": "",
+          "extProps": {},
+          "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E",
+          "id": "C3445EE8-F606-4A60-8BB5-FB813C4E849D"
+        },
+        {
+          "defKey": "contract_id",
+          "defName": "合同ID",
+          "comment": "",
+          "type": "",
+          "len": "",
+          "scale": "",
+          "primaryKey": false,
+          "notNull": true,
+          "autoIncrement": false,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "refDict": "",
+          "extProps": {},
+          "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E",
+          "id": "2246B3FD-1EB8-4524-BD45-5B933E92B99A"
+        },
+        {
+          "defKey": "opn_people_id",
+          "defName": "操作人ID",
+          "comment": "",
+          "type": "",
+          "len": "",
+          "scale": "",
+          "primaryKey": false,
+          "notNull": true,
+          "autoIncrement": false,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "refDict": "",
+          "extProps": {},
+          "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E",
+          "id": "D0700CB7-BEB1-4CFE-9E34-D7642B436A7B"
+        },
+        {
+          "defKey": "opn_people",
+          "defName": "操作人",
+          "comment": "",
+          "type": "",
+          "len": "",
+          "scale": "",
+          "primaryKey": false,
+          "notNull": true,
+          "autoIncrement": false,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "refDict": "",
+          "extProps": {},
+          "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6",
+          "id": "ED9F8436-05B2-445D-9FD8-536126DA5D45"
+        },
+        {
+          "defKey": "opn_date",
+          "defName": "操作日期",
+          "comment": "",
+          "type": "DATETIME",
+          "len": "",
+          "scale": "",
+          "primaryKey": false,
+          "notNull": true,
+          "autoIncrement": false,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "refDict": "",
+          "extProps": {},
+          "domain": "",
+          "id": "8D11CF9A-62FF-4A57-BEF6-D5E0B8073356"
+        },
+        {
+          "defKey": "opn_type",
+          "defName": "操作类型",
+          "comment": "",
+          "type": "",
+          "len": "",
+          "scale": "",
+          "primaryKey": false,
+          "notNull": true,
+          "autoIncrement": false,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "refDict": "",
+          "extProps": {},
+          "domain": "73FD2BAD-2358-4336-B96D-45DC897BD792",
+          "id": "F614873B-9C5A-404A-BA30-D2DCCC26BEB5"
+        },
+        {
+          "defKey": "opn_content",
+          "defName": "操作内容",
+          "comment": "",
+          "type": "",
+          "len": "",
+          "scale": "",
+          "primaryKey": false,
+          "notNull": false,
+          "autoIncrement": false,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "refDict": "",
+          "extProps": {},
+          "domain": "3E948CEC-3070-472C-AF92-F3CA11EC9D15",
+          "id": "5B1BAD05-DFB0-41AE-8C6A-A246C7C4F8EC"
+        },
+        {
+          "defKey": "remark",
+          "defName": "备注",
+          "comment": "",
+          "type": "",
+          "len": "",
+          "scale": "",
+          "primaryKey": false,
+          "notNull": false,
+          "autoIncrement": false,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "domain": "3E948CEC-3070-472C-AF92-F3CA11EC9D15",
+          "refDict": "",
+          "extProps": {},
+          "notes": {},
+          "id": "7880B3FA-ACAC-401C-AB1C-3304FE48E53B"
+        },
+        {
+          "defKey": "created_by",
+          "defName": "创建者",
+          "comment": "",
+          "type": "",
+          "len": "",
+          "scale": "",
+          "primaryKey": false,
+          "notNull": true,
+          "autoIncrement": false,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
+          "refDict": "",
+          "extProps": {},
+          "notes": {},
+          "id": "EAEFDA42-550C-4EB5-9D32-03B446763F92"
+        },
+        {
+          "defKey": "created_name",
+          "defName": "创建人",
+          "comment": "",
+          "type": "VARCHAR",
+          "len": "",
+          "scale": "",
+          "primaryKey": false,
+          "notNull": true,
+          "autoIncrement": false,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6",
+          "refDict": "",
+          "extProps": {},
+          "notes": {},
+          "id": "0B43210A-6ACE-45F6-8026-53256207CE0F"
+        },
+        {
+          "defKey": "created_time",
+          "defName": "创建时间",
+          "comment": "",
+          "type": "DATETIME",
+          "len": "",
+          "scale": "",
+          "primaryKey": false,
+          "notNull": true,
+          "autoIncrement": false,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "domain": "7CFFA0D3-6A93-4DDC-BC10-DF21211064DC",
+          "refDict": "",
+          "extProps": {},
+          "notes": {},
+          "id": "48B9A20C-F60E-412A-A359-D0EDD27BB98D"
+        },
+        {
+          "defKey": "updated_by",
+          "defName": "更新者",
+          "comment": "",
+          "type": "",
+          "len": "",
+          "scale": "",
+          "primaryKey": false,
+          "notNull": false,
+          "autoIncrement": false,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
+          "refDict": "",
+          "extProps": {},
+          "notes": {},
+          "id": "E73FC6F3-A402-44BA-A9A0-1D753B4FBB3D"
+        },
+        {
+          "defKey": "updated_name",
+          "defName": "更新人",
+          "comment": "",
+          "type": "VARCHAR",
+          "len": "",
+          "scale": "",
+          "primaryKey": false,
+          "notNull": false,
+          "autoIncrement": false,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6",
+          "refDict": "",
+          "extProps": {},
+          "notes": {},
+          "id": "A274F906-05A2-4E08-A019-A48F99EFEE6A"
+        },
+        {
+          "defKey": "updated_time",
+          "defName": "更新时间",
+          "comment": "",
+          "type": "DATETIME",
+          "len": "",
+          "scale": "",
+          "primaryKey": false,
+          "notNull": false,
+          "autoIncrement": false,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "domain": "7CFFA0D3-6A93-4DDC-BC10-DF21211064DC",
+          "refDict": "",
+          "extProps": {},
+          "notes": {},
+          "id": "BBC9ED1D-34F6-48ED-BF8B-8BB2812092D3"
+        },
+        {
+          "defKey": "deleted_time",
+          "defName": "删除时间",
+          "comment": "",
+          "type": "DATETIME",
+          "len": "",
+          "scale": "",
+          "primaryKey": false,
+          "notNull": false,
+          "autoIncrement": false,
+          "defaultValue": "",
+          "hideInGraph": false,
+          "domain": "7CFFA0D3-6A93-4DDC-BC10-DF21211064DC",
+          "refDict": "",
+          "extProps": {},
+          "notes": {},
+          "id": "2E27E5A6-D66D-4ACC-B0C3-B38D1CCAA7DC"
+        }
+      ],
+      "correlations": [],
+      "indexes": []
     }
   ],
   "views": [],
@@ -14402,7 +14756,8 @@
         "6511F53F-57C6-4726-BA34-8C68EA8ECDA2",
         "403821BB-46D8-4AED-BAEF-E2BEF3C0EB60",
         "6C39B414-5E3A-4D0F-958F-19EDF97EA619",
-        "D01F5FE5-2704-464B-9268-9E4A22838D63"
+        "D01F5FE5-2704-464B-9268-9E4A22838D63",
+        "E5C3DA58-7436-45A1-87DE-284D7A724914"
       ],
       "refViews": [],
       "refDiagrams": [],

+ 36 - 0
opms_parent/app/dao/contract/ctr_contract_dynamics.go

@@ -0,0 +1,36 @@
+// ============================================================================
+// This is auto-generated by gf cli tool only once. Fill this file as you wish.
+// ============================================================================
+
+package dao
+
+import (
+	"dashoo.cn/micro/app/dao/contract/internal"
+)
+
+// ctrContractDynamicsDao is the manager for logic model data accessing
+// and custom defined data operations functions management. You can define
+// methods on it to extend its functionality as you wish.
+type ctrContractDynamicsDao struct {
+	internal.CtrContractDynamicsDao
+}
+
+var (
+	// CtrContractDynamics is globally public accessible object for table ctr_contract_dynamics operations.
+	CtrContractDynamics = ctrContractDynamicsDao{
+		internal.CtrContractDynamics,
+	}
+)
+
+type CtrContractDynamicsDao struct {
+	internal.CtrContractDynamicsDao
+}
+
+func NewCtrContractDynamicsDao(tenant string) *CtrContractDynamicsDao {
+	dao := internal.NewCtrContractDynamicsDao(tenant)
+	return &CtrContractDynamicsDao{
+		dao,
+	}
+}
+
+// Fill with you ideas below.

+ 438 - 0
opms_parent/app/dao/contract/internal/ctr_contract_dynamics.go

@@ -0,0 +1,438 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"database/sql"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/frame/gmvc"
+	"time"
+
+	model "dashoo.cn/micro/app/model/contract"
+)
+
+// CtrContractDynamicsDao is the manager for logic model data accessing
+// and custom defined data operations functions management.
+type CtrContractDynamicsDao struct {
+	gmvc.M
+	DB      gdb.DB
+	Table   string
+	Columns ctrContractDynamicsColumns
+}
+
+// CtrContractDynamicsColumns defines and stores column names for table ctr_contract_dynamics.
+type ctrContractDynamicsColumns struct {
+	Id          string // 主键
+	ContractId  string // 合同ID
+	OpnPeopleId string // 操作人ID
+	OpnPeople   string // 操作人
+	OpnDate     string // 操作日期
+	OpnType     string // 操作类型
+	OpnContent  string // 操作内容
+	Remark      string // 备注
+	CreatedBy   string // 创建者
+	CreatedName string // 创建人
+	CreatedTime string // 创建时间
+	UpdatedBy   string // 更新者
+	UpdatedName string // 更新人
+	UpdatedTime string // 更新时间
+	DeletedTime string // 删除时间
+}
+
+var (
+	// CtrContractDynamics is globally public accessible object for table ctr_contract_dynamics operations.
+	CtrContractDynamics = CtrContractDynamicsDao{
+		M:     g.DB("default").Model("ctr_contract_dynamics").Safe(),
+		DB:    g.DB("default"),
+		Table: "ctr_contract_dynamics",
+		Columns: ctrContractDynamicsColumns{
+			Id:          "id",
+			ContractId:  "contract_id",
+			OpnPeopleId: "opn_people_id",
+			OpnPeople:   "opn_people",
+			OpnDate:     "opn_date",
+			OpnType:     "opn_type",
+			OpnContent:  "opn_content",
+			Remark:      "remark",
+			CreatedBy:   "created_by",
+			CreatedName: "created_name",
+			CreatedTime: "created_time",
+			UpdatedBy:   "updated_by",
+			UpdatedName: "updated_name",
+			UpdatedTime: "updated_time",
+			DeletedTime: "deleted_time",
+		},
+	}
+)
+
+func NewCtrContractDynamicsDao(tenant string) CtrContractDynamicsDao {
+	var dao CtrContractDynamicsDao
+	dao = CtrContractDynamicsDao{
+		M:     g.DB(tenant).Model("ctr_contract_dynamics").Safe(),
+		DB:    g.DB(tenant),
+		Table: "ctr_contract_dynamics",
+		Columns: ctrContractDynamicsColumns{
+			Id:          "id",
+			ContractId:  "contract_id",
+			OpnPeopleId: "opn_people_id",
+			OpnPeople:   "opn_people",
+			OpnDate:     "opn_date",
+			OpnType:     "opn_type",
+			OpnContent:  "opn_content",
+			Remark:      "remark",
+			CreatedBy:   "created_by",
+			CreatedName: "created_name",
+			CreatedTime: "created_time",
+			UpdatedBy:   "updated_by",
+			UpdatedName: "updated_name",
+			UpdatedTime: "updated_time",
+			DeletedTime: "deleted_time",
+		},
+	}
+	return dao
+}
+
+// Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
+// of current DB object and with given context in it.
+// Note that this returned DB object can be used only once, so do not assign it to
+// a global or package variable for long using.
+func (d *CtrContractDynamicsDao) Ctx(ctx context.Context) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Ctx(ctx)}
+}
+
+// As sets an alias name for current table.
+func (d *CtrContractDynamicsDao) As(as string) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.As(as)}
+}
+
+// TX sets the transaction for current operation.
+func (d *CtrContractDynamicsDao) TX(tx *gdb.TX) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.TX(tx)}
+}
+
+// Master marks the following operation on master node.
+func (d *CtrContractDynamicsDao) Master() *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Master()}
+}
+
+// Slave marks the following operation on slave node.
+// Note that it makes sense only if there's any slave node configured.
+func (d *CtrContractDynamicsDao) Slave() *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Slave()}
+}
+
+// Args sets custom arguments for model operation.
+func (d *CtrContractDynamicsDao) Args(args ...interface{}) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Args(args...)}
+}
+
+// LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *CtrContractDynamicsDao) LeftJoin(table ...string) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.LeftJoin(table...)}
+}
+
+// RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *CtrContractDynamicsDao) RightJoin(table ...string) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.RightJoin(table...)}
+}
+
+// InnerJoin does "INNER JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *CtrContractDynamicsDao) InnerJoin(table ...string) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.InnerJoin(table...)}
+}
+
+// Fields sets the operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *CtrContractDynamicsDao) Fields(fieldNamesOrMapStruct ...interface{}) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Fields(fieldNamesOrMapStruct...)}
+}
+
+// FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *CtrContractDynamicsDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
+}
+
+// Option sets the extra operation option for the model.
+func (d *CtrContractDynamicsDao) Option(option int) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Option(option)}
+}
+
+// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
+// the data and where attributes for empty values.
+func (d *CtrContractDynamicsDao) OmitEmpty() *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.OmitEmpty()}
+}
+
+// Filter marks filtering the fields which does not exist in the fields of the operated table.
+func (d *CtrContractDynamicsDao) Filter() *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Filter()}
+}
+
+// Where sets the condition statement for the model. The parameter <where> can be type of
+// string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
+// multiple conditions will be joined into where statement using "AND".
+// Eg:
+// Where("uid=10000")
+// Where("uid", 10000)
+// Where("money>? AND name like ?", 99999, "vip_%")
+// Where("uid", 1).Where("name", "john")
+// Where("status IN (?)", g.Slice{1,2,3})
+// Where("age IN(?,?)", 18, 50)
+// Where(User{ Id : 1, UserName : "john"})
+func (d *CtrContractDynamicsDao) Where(where interface{}, args ...interface{}) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Where(where, args...)}
+}
+
+// WherePri does the same logic as M.Where except that if the parameter <where>
+// is a single condition like int/string/float/slice, it treats the condition as the primary
+// key value. That is, if primary key is "id" and given <where> parameter as "123", the
+// WherePri function treats the condition as "id=123", but M.Where treats the condition
+// as string "123".
+func (d *CtrContractDynamicsDao) WherePri(where interface{}, args ...interface{}) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.WherePri(where, args...)}
+}
+
+// And adds "AND" condition to the where statement.
+func (d *CtrContractDynamicsDao) And(where interface{}, args ...interface{}) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.And(where, args...)}
+}
+
+// Or adds "OR" condition to the where statement.
+func (d *CtrContractDynamicsDao) Or(where interface{}, args ...interface{}) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Or(where, args...)}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (d *CtrContractDynamicsDao) Group(groupBy string) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Group(groupBy)}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (d *CtrContractDynamicsDao) Order(orderBy ...string) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Order(orderBy...)}
+}
+
+// Limit sets the "LIMIT" statement for the model.
+// The parameter <limit> can be either one or two number, if passed two number is passed,
+// it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
+// statement.
+func (d *CtrContractDynamicsDao) Limit(limit ...int) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Limit(limit...)}
+}
+
+// Offset sets the "OFFSET" statement for the model.
+// It only makes sense for some databases like SQLServer, PostgreSQL, etc.
+func (d *CtrContractDynamicsDao) Offset(offset int) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Offset(offset)}
+}
+
+// Page sets the paging number for the model.
+// The parameter <page> is started from 1 for paging.
+// Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
+func (d *CtrContractDynamicsDao) Page(page, limit int) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Page(page, limit)}
+}
+
+// Batch sets the batch operation number for the model.
+func (d *CtrContractDynamicsDao) Batch(batch int) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Batch(batch)}
+}
+
+// Cache sets the cache feature for the model. It caches the result of the sql, which means
+// if there's another same sql request, it just reads and returns the result from cache, it
+// but not committed and executed into the database.
+//
+// If the parameter <duration> < 0, which means it clear the cache with given <name>.
+// If the parameter <duration> = 0, which means it never expires.
+// If the parameter <duration> > 0, which means it expires after <duration>.
+//
+// The optional parameter <name> is used to bind a name to the cache, which means you can later
+// control the cache like changing the <duration> or clearing the cache with specified <name>.
+//
+// Note that, the cache feature is disabled if the model is operating on a transaction.
+func (d *CtrContractDynamicsDao) Cache(duration time.Duration, name ...string) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Cache(duration, name...)}
+}
+
+// Data sets the operation data for the model.
+// The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
+// Eg:
+// Data("uid=10000")
+// Data("uid", 10000)
+// Data(g.Map{"uid": 10000, "name":"john"})
+// Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
+func (d *CtrContractDynamicsDao) Data(data ...interface{}) *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Data(data...)}
+}
+
+// All does "SELECT FROM ..." statement for the model.
+// It retrieves the records from table and returns the result as []*model.CtrContractDynamics.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *CtrContractDynamicsDao) All(where ...interface{}) ([]*model.CtrContractDynamics, error) {
+	all, err := d.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.CtrContractDynamics
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// One retrieves one record from table and returns the result as *model.CtrContractDynamics.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *CtrContractDynamicsDao) One(where ...interface{}) (*model.CtrContractDynamics, error) {
+	one, err := d.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.CtrContractDynamics
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindOne retrieves and returns a single Record by M.WherePri and M.One.
+// Also see M.WherePri and M.One.
+func (d *CtrContractDynamicsDao) FindOne(where ...interface{}) (*model.CtrContractDynamics, error) {
+	one, err := d.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.CtrContractDynamics
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindAll retrieves and returns Result by by M.WherePri and M.All.
+// Also see M.WherePri and M.All.
+func (d *CtrContractDynamicsDao) FindAll(where ...interface{}) ([]*model.CtrContractDynamics, error) {
+	all, err := d.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.CtrContractDynamics
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// Struct retrieves one record from table and converts it into given struct.
+// The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
+// it can create the struct internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not nil.
+//
+// Eg:
+// user := new(User)
+// err  := dao.User.Where("id", 1).Struct(user)
+//
+// user := (*User)(nil)
+// err  := dao.User.Where("id", 1).Struct(&user)
+func (d *CtrContractDynamicsDao) Struct(pointer interface{}, where ...interface{}) error {
+	return d.M.Struct(pointer, where...)
+}
+
+// Structs retrieves records from table and converts them into given struct slice.
+// The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
+// slice internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not empty.
+//
+// Eg:
+// users := ([]User)(nil)
+// err   := dao.User.Structs(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Structs(&users)
+func (d *CtrContractDynamicsDao) Structs(pointer interface{}, where ...interface{}) error {
+	return d.M.Structs(pointer, where...)
+}
+
+// Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
+// It calls function Struct if <pointer> is type of *struct/**struct.
+// It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
+//
+// Eg:
+// user  := new(User)
+// err   := dao.User.Where("id", 1).Scan(user)
+//
+// user  := (*User)(nil)
+// err   := dao.User.Where("id", 1).Scan(&user)
+//
+// users := ([]User)(nil)
+// err   := dao.User.Scan(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Scan(&users)
+func (d *CtrContractDynamicsDao) Scan(pointer interface{}, where ...interface{}) error {
+	return d.M.Scan(pointer, where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (d *CtrContractDynamicsDao) Chunk(limit int, callback func(entities []*model.CtrContractDynamics, err error) bool) {
+	d.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*model.CtrContractDynamics
+		err = result.Structs(&entities)
+		if err == sql.ErrNoRows {
+			return false
+		}
+		return callback(entities, err)
+	})
+}
+
+// LockUpdate sets the lock for update for current operation.
+func (d *CtrContractDynamicsDao) LockUpdate() *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.LockUpdate()}
+}
+
+// LockShared sets the lock in share mode for current operation.
+func (d *CtrContractDynamicsDao) LockShared() *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.LockShared()}
+}
+
+// Unscoped enables/disables the soft deleting feature.
+func (d *CtrContractDynamicsDao) Unscoped() *CtrContractDynamicsDao {
+	return &CtrContractDynamicsDao{M: d.M.Unscoped()}
+}

+ 37 - 7
opms_parent/app/dao/plat/internal/plat_task.go

@@ -28,19 +28,29 @@ type platTaskColumns struct {
 	Id               string // 主键
 	TaskTitle        string // 任务标题
 	TaskType         string // 任务类型
-	TaskStatus       string // 任务状态(10进行中20关闭
+	TaskStatus       string // 任务状态(10发起  20进行中   30流程完成
 	IsOverdue        string // 是否超期(10否20是)
 	TaskStartDate    string // 任务开始时间
 	TaskEndDate      string // 任务结束时间
 	TaskDesc         string // 任务说明
-	SupervisorUserId string // 督办人
-	WatchUserId      string // 监办人
 	MainUserId       string // 负责人ID
 	OwnerUserId      string // 团队成员ID
 	TaskLabel        string // 任务标签,号拼接
+	SupervisorUserId string // 督办人ID
+	WatchUserId      string // 监办人ID
 	TargetId         string // 关联对象ID
 	TargetType       string // 关联对象类型(10客户,20项目,30合同,40回款)
 	TargetName       string // 关联对象
+	ApproverId       string // 审批人ID
+	ApproDate        string // 审批时间
+	ApproStatus      string // 审批结果
+	ApproDesc        string // 审批说明
+	EvaluatorId      string // 评价人ID
+	EvaluateDate     string // 评价时间
+	EvaluateStatus   string // 评价结果
+	EvaluateDesc     string // 评价说明
+	ReceiveDate      string // 接收时间
+	ActualCloseDate  string // 实际完成时间
 	Remark           string // 备注
 	CreatedBy        string // 创建者
 	CreatedName      string // 创建人
@@ -66,14 +76,24 @@ var (
 			TaskStartDate:    "task_start_date",
 			TaskEndDate:      "task_end_date",
 			TaskDesc:         "task_desc",
-			SupervisorUserId: "supervisor_user_id",
-			WatchUserId:      "watch_user_id",
 			MainUserId:       "main_user_id",
 			OwnerUserId:      "owner_user_id",
 			TaskLabel:        "task_label",
+			SupervisorUserId: "supervisor_user_id",
+			WatchUserId:      "watch_user_id",
 			TargetId:         "target_id",
 			TargetType:       "target_type",
 			TargetName:       "target_name",
+			ApproverId:       "approver_id",
+			ApproDate:        "appro_date",
+			ApproStatus:      "appro_status",
+			ApproDesc:        "appro_desc",
+			EvaluatorId:      "evaluator_id",
+			EvaluateDate:     "evaluate_date",
+			EvaluateStatus:   "evaluate_status",
+			EvaluateDesc:     "evaluate_desc",
+			ReceiveDate:      "receive_date",
+			ActualCloseDate:  "actual_close_date",
 			Remark:           "remark",
 			CreatedBy:        "created_by",
 			CreatedName:      "created_name",
@@ -101,14 +121,24 @@ func NewPlatTaskDao(tenant string) PlatTaskDao {
 			TaskStartDate:    "task_start_date",
 			TaskEndDate:      "task_end_date",
 			TaskDesc:         "task_desc",
-			SupervisorUserId: "supervisor_user_id",
-			WatchUserId:      "watch_user_id",
 			MainUserId:       "main_user_id",
 			OwnerUserId:      "owner_user_id",
 			TaskLabel:        "task_label",
+			SupervisorUserId: "supervisor_user_id",
+			WatchUserId:      "watch_user_id",
 			TargetId:         "target_id",
 			TargetType:       "target_type",
 			TargetName:       "target_name",
+			ApproverId:       "approver_id",
+			ApproDate:        "appro_date",
+			ApproStatus:      "appro_status",
+			ApproDesc:        "appro_desc",
+			EvaluatorId:      "evaluator_id",
+			EvaluateDate:     "evaluate_date",
+			EvaluateStatus:   "evaluate_status",
+			EvaluateDesc:     "evaluate_desc",
+			ReceiveDate:      "receive_date",
+			ActualCloseDate:  "actual_close_date",
 			Remark:           "remark",
 			CreatedBy:        "created_by",
 			CreatedName:      "created_name",

+ 446 - 0
opms_parent/app/dao/plat/internal/plat_task_handle.go

@@ -0,0 +1,446 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"dashoo.cn/micro/app/model/plat"
+	"database/sql"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/frame/gmvc"
+	"time"
+)
+
+// PlatTaskHandleDao is the manager for logic model data accessing
+// and custom defined data operations functions management.
+type PlatTaskHandleDao struct {
+	gmvc.M
+	DB      gdb.DB
+	Table   string
+	Columns platTaskHandleColumns
+}
+
+// PlatTaskHandleColumns defines and stores column names for table plat_task_handle.
+type platTaskHandleColumns struct {
+	ID           string // 主键
+	TaskId       string // 任务ID
+	TaskStatus   string // 任务状态(10打开20关闭)
+	Step         string // 步骤号
+	MainUserId   string // 处理人ID
+	OwnerUserId  string // 团队成员ID
+	HandleUserId string // 处理人ID
+	HandleDate   string // 处理时间
+	HandleStatus string // 处理结果(10接收20提交30审批通过40审批退回)
+	HandleDesc   string // 处理说明
+	Remark       string // 备注
+	CreatedBy    string // 创建者
+	CreatedName  string // 创建人
+	CreatedTime  string // 创建时间
+	UpdatedBy    string // 更新者
+	UpdatedName  string // 更新人
+	UpdatedTime  string // 更新时间
+	DeletedTime  string // 删除时间
+}
+
+var (
+	// PlatTaskHandle is globally public accessible object for table plat_task_handle operations.
+	PlatTaskHandle = PlatTaskHandleDao{
+		M:     g.DB("default").Model("plat_task_handle").Safe(),
+		DB:    g.DB("default"),
+		Table: "plat_task_handle",
+		Columns: platTaskHandleColumns{
+			ID:           "ID",
+			TaskId:       "task_id",
+			TaskStatus:   "task_status",
+			Step:         "step",
+			MainUserId:   "main_user_id",
+			OwnerUserId:  "owner_user_id",
+			HandleUserId: "handle_user_id",
+			HandleDate:   "handle_date",
+			HandleStatus: "handle_status",
+			HandleDesc:   "handle_desc",
+			Remark:       "remark",
+			CreatedBy:    "created_by",
+			CreatedName:  "created_name",
+			CreatedTime:  "created_time",
+			UpdatedBy:    "updated_by",
+			UpdatedName:  "updated_name",
+			UpdatedTime:  "updated_time",
+			DeletedTime:  "deleted_time",
+		},
+	}
+)
+
+func NewPlatTaskHandleDao(tenant string) PlatTaskHandleDao {
+	var dao PlatTaskHandleDao
+	dao = PlatTaskHandleDao{
+		M:     g.DB(tenant).Model("plat_task_handle").Safe(),
+		DB:    g.DB(tenant),
+		Table: "plat_task_handle",
+		Columns: platTaskHandleColumns{
+			ID:           "ID",
+			TaskId:       "task_id",
+			TaskStatus:   "task_status",
+			Step:         "step",
+			MainUserId:   "main_user_id",
+			OwnerUserId:  "owner_user_id",
+			HandleUserId: "handle_user_id",
+			HandleDate:   "handle_date",
+			HandleStatus: "handle_status",
+			HandleDesc:   "handle_desc",
+			Remark:       "remark",
+			CreatedBy:    "created_by",
+			CreatedName:  "created_name",
+			CreatedTime:  "created_time",
+			UpdatedBy:    "updated_by",
+			UpdatedName:  "updated_name",
+			UpdatedTime:  "updated_time",
+			DeletedTime:  "deleted_time",
+		},
+	}
+	return dao
+}
+
+// Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
+// of current DB object and with given context in it.
+// Note that this returned DB object can be used only once, so do not assign it to
+// a global or package variable for long using.
+func (d *PlatTaskHandleDao) Ctx(ctx context.Context) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Ctx(ctx)}
+}
+
+// As sets an alias name for current table.
+func (d *PlatTaskHandleDao) As(as string) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.As(as)}
+}
+
+// TX sets the transaction for current operation.
+func (d *PlatTaskHandleDao) TX(tx *gdb.TX) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.TX(tx)}
+}
+
+// Master marks the following operation on master node.
+func (d *PlatTaskHandleDao) Master() *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Master()}
+}
+
+// Slave marks the following operation on slave node.
+// Note that it makes sense only if there's any slave node configured.
+func (d *PlatTaskHandleDao) Slave() *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Slave()}
+}
+
+// Args sets custom arguments for model operation.
+func (d *PlatTaskHandleDao) Args(args ...interface{}) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Args(args...)}
+}
+
+// LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *PlatTaskHandleDao) LeftJoin(table ...string) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.LeftJoin(table...)}
+}
+
+// RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *PlatTaskHandleDao) RightJoin(table ...string) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.RightJoin(table...)}
+}
+
+// InnerJoin does "INNER JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *PlatTaskHandleDao) InnerJoin(table ...string) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.InnerJoin(table...)}
+}
+
+// Fields sets the operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *PlatTaskHandleDao) Fields(fieldNamesOrMapStruct ...interface{}) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Fields(fieldNamesOrMapStruct...)}
+}
+
+// FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *PlatTaskHandleDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
+}
+
+// Option sets the extra operation option for the model.
+func (d *PlatTaskHandleDao) Option(option int) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Option(option)}
+}
+
+// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
+// the data and where attributes for empty values.
+func (d *PlatTaskHandleDao) OmitEmpty() *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.OmitEmpty()}
+}
+
+// Filter marks filtering the fields which does not exist in the fields of the operated table.
+func (d *PlatTaskHandleDao) Filter() *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Filter()}
+}
+
+// Where sets the condition statement for the model. The parameter <where> can be type of
+// string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
+// multiple conditions will be joined into where statement using "AND".
+// Eg:
+// Where("uid=10000")
+// Where("uid", 10000)
+// Where("money>? AND name like ?", 99999, "vip_%")
+// Where("uid", 1).Where("name", "john")
+// Where("status IN (?)", g.Slice{1,2,3})
+// Where("age IN(?,?)", 18, 50)
+// Where(User{ Id : 1, UserName : "john"})
+func (d *PlatTaskHandleDao) Where(where interface{}, args ...interface{}) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Where(where, args...)}
+}
+
+// WherePri does the same logic as M.Where except that if the parameter <where>
+// is a single condition like int/string/float/slice, it treats the condition as the primary
+// key value. That is, if primary key is "id" and given <where> parameter as "123", the
+// WherePri function treats the condition as "id=123", but M.Where treats the condition
+// as string "123".
+func (d *PlatTaskHandleDao) WherePri(where interface{}, args ...interface{}) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.WherePri(where, args...)}
+}
+
+// And adds "AND" condition to the where statement.
+func (d *PlatTaskHandleDao) And(where interface{}, args ...interface{}) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.And(where, args...)}
+}
+
+// Or adds "OR" condition to the where statement.
+func (d *PlatTaskHandleDao) Or(where interface{}, args ...interface{}) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Or(where, args...)}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (d *PlatTaskHandleDao) Group(groupBy string) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Group(groupBy)}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (d *PlatTaskHandleDao) Order(orderBy ...string) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Order(orderBy...)}
+}
+
+// Limit sets the "LIMIT" statement for the model.
+// The parameter <limit> can be either one or two number, if passed two number is passed,
+// it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
+// statement.
+func (d *PlatTaskHandleDao) Limit(limit ...int) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Limit(limit...)}
+}
+
+// Offset sets the "OFFSET" statement for the model.
+// It only makes sense for some databases like SQLServer, PostgreSQL, etc.
+func (d *PlatTaskHandleDao) Offset(offset int) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Offset(offset)}
+}
+
+// Page sets the paging number for the model.
+// The parameter <page> is started from 1 for paging.
+// Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
+func (d *PlatTaskHandleDao) Page(page, limit int) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Page(page, limit)}
+}
+
+// Batch sets the batch operation number for the model.
+func (d *PlatTaskHandleDao) Batch(batch int) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Batch(batch)}
+}
+
+// Cache sets the cache feature for the model. It caches the result of the sql, which means
+// if there's another same sql request, it just reads and returns the result from cache, it
+// but not committed and executed into the database.
+//
+// If the parameter <duration> < 0, which means it clear the cache with given <name>.
+// If the parameter <duration> = 0, which means it never expires.
+// If the parameter <duration> > 0, which means it expires after <duration>.
+//
+// The optional parameter <name> is used to bind a name to the cache, which means you can later
+// control the cache like changing the <duration> or clearing the cache with specified <name>.
+//
+// Note that, the cache feature is disabled if the model is operating on a transaction.
+func (d *PlatTaskHandleDao) Cache(duration time.Duration, name ...string) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Cache(duration, name...)}
+}
+
+// Data sets the operation data for the model.
+// The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
+// Eg:
+// Data("uid=10000")
+// Data("uid", 10000)
+// Data(g.Map{"uid": 10000, "name":"john"})
+// Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
+func (d *PlatTaskHandleDao) Data(data ...interface{}) *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Data(data...)}
+}
+
+// All does "SELECT FROM ..." statement for the model.
+// It retrieves the records from table and returns the result as []*model.PlatTaskHandle.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *PlatTaskHandleDao) All(where ...interface{}) ([]*plat.PlatTaskHandle, error) {
+	all, err := d.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*plat.PlatTaskHandle
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// One retrieves one record from table and returns the result as *model.PlatTaskHandle.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *PlatTaskHandleDao) One(where ...interface{}) (*plat.PlatTaskHandle, error) {
+	one, err := d.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *plat.PlatTaskHandle
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindOne retrieves and returns a single Record by M.WherePri and M.One.
+// Also see M.WherePri and M.One.
+func (d *PlatTaskHandleDao) FindOne(where ...interface{}) (*plat.PlatTaskHandle, error) {
+	one, err := d.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *plat.PlatTaskHandle
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindAll retrieves and returns Result by by M.WherePri and M.All.
+// Also see M.WherePri and M.All.
+func (d *PlatTaskHandleDao) FindAll(where ...interface{}) ([]*plat.PlatTaskHandle, error) {
+	all, err := d.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*plat.PlatTaskHandle
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// Struct retrieves one record from table and converts it into given struct.
+// The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
+// it can create the struct internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not nil.
+//
+// Eg:
+// user := new(User)
+// err  := dao.User.Where("id", 1).Struct(user)
+//
+// user := (*User)(nil)
+// err  := dao.User.Where("id", 1).Struct(&user)
+func (d *PlatTaskHandleDao) Struct(pointer interface{}, where ...interface{}) error {
+	return d.M.Struct(pointer, where...)
+}
+
+// Structs retrieves records from table and converts them into given struct slice.
+// The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
+// slice internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not empty.
+//
+// Eg:
+// users := ([]User)(nil)
+// err   := dao.User.Structs(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Structs(&users)
+func (d *PlatTaskHandleDao) Structs(pointer interface{}, where ...interface{}) error {
+	return d.M.Structs(pointer, where...)
+}
+
+// Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
+// It calls function Struct if <pointer> is type of *struct/**struct.
+// It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
+//
+// Eg:
+// user  := new(User)
+// err   := dao.User.Where("id", 1).Scan(user)
+//
+// user  := (*User)(nil)
+// err   := dao.User.Where("id", 1).Scan(&user)
+//
+// users := ([]User)(nil)
+// err   := dao.User.Scan(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Scan(&users)
+func (d *PlatTaskHandleDao) Scan(pointer interface{}, where ...interface{}) error {
+	return d.M.Scan(pointer, where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (d *PlatTaskHandleDao) Chunk(limit int, callback func(entities []*plat.PlatTaskHandle, err error) bool) {
+	d.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*plat.PlatTaskHandle
+		err = result.Structs(&entities)
+		if err == sql.ErrNoRows {
+			return false
+		}
+		return callback(entities, err)
+	})
+}
+
+// LockUpdate sets the lock for update for current operation.
+func (d *PlatTaskHandleDao) LockUpdate() *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.LockUpdate()}
+}
+
+// LockShared sets the lock in share mode for current operation.
+func (d *PlatTaskHandleDao) LockShared() *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.LockShared()}
+}
+
+// Unscoped enables/disables the soft deleting feature.
+func (d *PlatTaskHandleDao) Unscoped() *PlatTaskHandleDao {
+	return &PlatTaskHandleDao{M: d.M.Unscoped()}
+}

+ 36 - 0
opms_parent/app/dao/plat/plat_task_handle.go

@@ -0,0 +1,36 @@
+// ============================================================================
+// This is auto-generated by gf cli tool only once. Fill this file as you wish.
+// ============================================================================
+
+package plat
+
+import (
+	internal2 "dashoo.cn/micro/app/dao/plat/internal"
+)
+
+// platTaskHandleDao is the manager for logic model data accessing
+// and custom defined data operations functions management. You can define
+// methods on it to extend its functionality as you wish.
+type platTaskHandleDao struct {
+	internal2.PlatTaskHandleDao
+}
+
+var (
+	// PlatTaskHandle is globally public accessible object for table plat_task_handle operations.
+	PlatTaskHandle = platTaskHandleDao{
+		internal2.PlatTaskHandle,
+	}
+)
+
+type PlatTaskHandleDao struct {
+	internal2.PlatTaskHandleDao
+}
+
+func NewPlatTaskHandleDao(tenant string) *PlatTaskHandleDao {
+	dao := internal2.NewPlatTaskHandleDao(tenant)
+	return &PlatTaskHandleDao{
+		dao,
+	}
+}
+
+// Fill with you ideas below.

+ 23 - 0
opms_parent/app/handler/contract/ctr_contract.go

@@ -52,6 +52,29 @@ func (c *CtrContract) List(ctx context.Context, req *model.CtrContractListReq, r
 	return nil
 }
 
+func (c *CtrContract) DynamicsList(ctx context.Context, req *model.CtrContractDynamicsListReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("CtrContract.DynamicsList request %#v ", *req)
+	s, err := service.NewCtrContractService(ctx)
+	if err != nil {
+		return err
+	}
+	total, ent, err := s.DynamicsList(ctx, req)
+	_, err, code, msg := myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+	if ent == nil {
+		ent = []*model.CtrContract{}
+	}
+	rsp.Code = code
+	rsp.Msg = msg
+	rsp.Data = map[string]interface{}{
+		"total": total,
+		"list":  ent,
+	}
+	return nil
+}
+
 func (c *CtrContract) Add(ctx context.Context, req *model.CtrContractAddReq, rsp *comm_def.CommonMsg) error {
 	g.Log().Infof("CtrContract.Add request %#v ", *req)
 	s, err := service.NewCtrContractService(ctx)

+ 17 - 0
opms_parent/app/handler/contract/ctr_contract_collection_plan.go

@@ -12,6 +12,23 @@ import (
 
 type CtrContractCollectionPlan struct{}
 
+func (c *CtrContractCollectionPlan) Get(ctx context.Context, req *model.IdRequiredReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("CtrContractCollectionPlan.Get request %#v ", *req)
+	s, err := service.NewCtrContractCollectionPlanService(ctx)
+	if err != nil {
+		return err
+	}
+	ent, err := s.Get(ctx, req.Id)
+	_, err, code, msg := myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+	rsp.Code = code
+	rsp.Msg = msg
+	rsp.Data = ent
+	return nil
+}
+
 func (c *CtrContractCollectionPlan) List(ctx context.Context, req *model.CtrContractCollectionPlanListReq, rsp *comm_def.CommonMsg) error {
 	g.Log().Infof("CtrContractCollectionPlan.List request %#v ", *req)
 	s, err := service.NewCtrContractCollectionPlanService(ctx)

+ 0 - 0
opms_parent/app/handler/contract/ctr_contract_invoice.go.bak → opms_parent/app/handler/contract/ctr_contract_invoice.go


+ 13 - 16
opms_parent/app/handler/cust/contant.go

@@ -30,18 +30,19 @@ func (c *CustomerContantHeader) Create(ctx context.Context, req *model.CustCusto
 	}
 	contactService, err := server.NewCustomerContactService(ctx)
 	if err != nil {
-		g.Log().Error(err)
-		return err
+		return myerrors.New("系统异常,请重新尝试", err)
+
 	}
 	err = contactService.Create(req)
-	var Ids []int64
-	Ids = append(Ids, gconv.Int64(req.CustId))
-	c.WriteCustLog(ctx, ContantCreate, Ids, req)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
 		g.Log().Error(err)
 		return err
 	}
+	var Ids []int64
+	Ids = append(Ids, gconv.Int64(req.CustId))
+	c.WriteCustLog(ctx, ContantCreate, Ids, req)
+
 	return nil
 }
 
@@ -52,8 +53,7 @@ func (c *CustomerContantHeader) UpdateById(ctx context.Context, req *model.Updat
 	}
 	customerServer, err := server.NewCustomerContactService(ctx)
 	if err != nil {
-		g.Log().Error(err)
-		return gerror.New("系统异常,请重新尝试")
+		return myerrors.New("系统异常,请重新尝试", err)
 	}
 
 	err = customerServer.UpdateById(req)
@@ -75,13 +75,12 @@ func (c *CustomerContantHeader) GetList(ctx context.Context, req *model.ContactS
 	}
 	customerServer, err := server.NewCustomerContactService(ctx)
 	if err != nil {
-		g.Log().Error(err)
-		return gerror.New("系统异常,请重新尝试")
+		return myerrors.New("系统异常,请重新尝试", err)
 	}
 	list, err := customerServer.GetList(req.CustId)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
-		g.Log().Error(err)
+
 		return err
 	}
 	rsp.Data = g.Map{"list": list}
@@ -95,18 +94,16 @@ func (c *CustomerContantHeader) DeleteById(ctx context.Context, req *model.DelCu
 	}
 	customerServer, err := server.NewCustomerContactService(ctx)
 	if err != nil {
-		g.Log().Error(err)
-		return gerror.New("系统异常,请重新尝试")
+		return myerrors.New("系统异常,请重新尝试", err)
 	}
 	err = customerServer.DeleteById(req.Id)
-	var Ids []int64
-	Ids = append(Ids, gconv.Int64(req.CustId))
-	c.WriteCustLog(ctx, ContantDeleteById, Ids, req)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
-		g.Log().Error(err)
 		return err
 	}
+	var Ids []int64
+	Ids = append(Ids, gconv.Int64(req.CustId))
+	c.WriteCustLog(ctx, ContantDeleteById, Ids, req)
 	return nil
 }
 

+ 114 - 117
opms_parent/app/handler/cust/customer.go

@@ -30,91 +30,142 @@ const (
 	Receive          = "领取"
 )
 
-//公海列表
-func (c *CustomerHeader) PublicGetList(ctx context.Context, req *model.CustCustomerSearchReq, rsp *comm_def.CommonMsg) error {
+//创建客户
+func (c *CustomerHeader) Create(ctx context.Context, req *model.CustomerAddSeq, rsp *comm_def.CommonMsg) error {
+	g.Log().Info("客户名称", req.CustName)
+	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
+		return err
+	}
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
-		g.Log().Error(err)
+		return myerrors.New("系统异常,请重新尝试", err)
+
+	}
+	id, err := customerServer.Create(req)
+	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
+	if err != nil {
 		return err
 	}
 
-	req.IsPublic = noCustomer
-	g.Log().Info("publicGetlist", req)
+	var Ids []int64
+	Ids = append(Ids, gconv.Int64(id))
 
-	total, list, err := customerServer.GetList(req)
+	//创建客户
+	c.WriteCustLog(ctx, Creates, Ids, req)
+	rsp.Data = g.Map{"lastId": id}
+	return nil
+}
+
+//修改客户
+func (c *CustomerHeader) UpdateById(ctx context.Context, req *model.UpdateCustomer, rsp *comm_def.CommonMsg) error {
+	customerServer, err := server.NewCustomerService(ctx)
+	if err != nil {
+
+		return myerrors.New("系统异常,请重新尝试", err)
+	}
+	err = customerServer.UpdateById(req)
+	var Ids []int64
+	Ids = append(Ids, gconv.Int64(req.Id))
+	c.WriteCustLog(ctx, UpdateById, Ids, req)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
-		g.Log().Error(err)
 		return err
 	}
-	rsp.Data = g.Map{"list": list, "total": total}
 	return nil
-
 }
 
-//客户列表
-func (c *CustomerHeader) GetList(ctx context.Context, req *model.CustCustomerSearchReq, rsp *comm_def.CommonMsg) error {
+//客户详情
+func (c *CustomerHeader) GetEntityById(ctx context.Context, req *comm_def.IdsReq, rsp *comm_def.CommonMsg) error {
+	if len(req.Ids) == 0 {
+		return myerrors.NewMsgError(nil, "参数有误")
+	}
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
-		g.Log().Error(err)
+		return myerrors.New("系统异常,请重新尝试", err)
+	}
+	list, err := customerServer.GetEntityById(req.Ids)
+	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
+	if err != nil {
 		return err
 	}
-	total, list, err := customerServer.GetList(req)
+	rsp.Data = g.Map{"list": list}
+	return nil
+}
 
+//删除客户
+func (c *CustomerHeader) DeleteById(ctx context.Context, req *model.DelCustomer, rsp *comm_def.CommonMsg) error {
+	if req.Id == 0 {
+		return myerrors.NewMsgError(nil, "参数有误")
+	}
+	customerServer, err := server.NewCustomerService(ctx)
+	if err != nil {
+		return myerrors.New("系统异常,请重新尝试", err)
+	}
+	err = customerServer.DeleteById(req.Id)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
-		g.Log().Error(err)
 		return err
 	}
-	rsp.Data = g.Map{"list": list, "total": total}
+	var Ids []int64
+	Ids = append(Ids, gconv.Int64(req.Id))
+	//删除客户
+	c.WriteCustLog(ctx, DeleteById, Ids, req)
 	return nil
-
 }
 
-//创建客户
-func (c *CustomerHeader) Create(ctx context.Context, req *model.Customer, rsp *comm_def.CommonMsg) error {
-	g.Log().Info("客户名称", req.CustName)
+//判断客户名称是否存在  bool
+func (c *CustomerHeader) GetCustNameIsExist(ctx context.Context, req *model.CustName, rsp *comm_def.CommonMsg) error {
 	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
 		return err
 	}
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
-		g.Log().Error(err)
-		return err
+		return myerrors.New("系统异常,请重新尝试", err)
 	}
-	id, err := customerServer.Create(req)
-	
-	var Ids []int64
-	Ids = append(Ids, gconv.Int64(id))
+	exist, err := customerServer.GetCustNameIsExist(req.CustName)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
-		g.Log().Error(err)
 		return err
 	}
-	//创建客户
-	c.WriteCustLog(ctx, Creates, Ids, req)
-	rsp.Data = g.Map{"lastId": id}
+	rsp.Data = g.Map{"list": exist}
 	return nil
 }
 
-//客户详情
-func (c *CustomerHeader) GetEntityById(ctx context.Context, req *comm_def.IdsReq, rsp *comm_def.CommonMsg) error {
-	if len(req.Ids) == 0 {
-		return gerror.New("参数有误!")
+//公海列表
+func (c *CustomerHeader) PublicGetList(ctx context.Context, req *model.CustCustomerSearchReq, rsp *comm_def.CommonMsg) error {
+	customerServer, err := server.NewCustomerService(ctx)
+	if err != nil {
+
+		return myerrors.New("系统异常,请重新尝试", err)
+	}
+
+	req.IsPublic = noCustomer
+
+	total, list, err := customerServer.GetList(req)
+	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
+	if err != nil {
+
+		return err
 	}
+	rsp.Data = g.Map{"list": list, "total": total}
+	return nil
+
+}
+
+//客户列表
+func (c *CustomerHeader) GetList(ctx context.Context, req *model.CustCustomerSearchReq, rsp *comm_def.CommonMsg) error {
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
-		g.Log().Error(err)
-		return gerror.New("系统异常,请重新尝试")
+		return myerrors.New("系统异常,请重新尝试", err)
 	}
-	list, err := customerServer.GetEntityById(req.Ids)
+	total, list, err := customerServer.GetList(req)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
-		g.Log().Error(err)
 		return err
 	}
-	rsp.Data = g.Map{"list": list}
+	rsp.Data = g.Map{"list": list, "total": total}
 	return nil
+
 }
 
 //转移客户
@@ -124,83 +175,46 @@ func (c *CustomerHeader) UpdateBytransfer(ctx context.Context, req *model.Distri
 	}
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
-		g.Log().Error(err)
-		return gerror.New("系统异常,请重新尝试")
+		return myerrors.New("系统异常,请重新尝试", err)
 	}
 	err = customerServer.UpdateBytransfer(req)
+	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
-		return gerror.New("转移失败")
-
+		return err
 	}
 	var Ids []int64
 	Ids = append(Ids, gconv.Int64(req.Ids))
 	//转移客户
 	c.WriteCustLog(ctx, UpdateBytransfer, Ids, req)
-	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
-	if err != nil {
-		g.Log().Error(err)
-		return err
-	}
 	return nil
 }
 
 //分配客户
 func (c *CustomerHeader) DistriCustomer(ctx context.Context, req *model.DistriCustomer, rsp *comm_def.CommonMsg) error {
 	if len(req.Ids) == 0 || req.SalesId == 0 {
-		return gerror.New("参数有误!")
+		return myerrors.NewMsgError(nil, "参数有误")
 	}
-	g.Log().Info("DistriCustomer", req.Ids)
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
-		g.Log().Error(err)
-		return gerror.New("系统异常,请重新尝试")
+
+		return myerrors.New("系统异常,请重新尝试", err)
 	}
 	err = customerServer.DistriCustomer(req)
+	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
 		return err
 	}
 	var behavior string
 	if req.Receive == "" {
 		behavior = DistriCustomer
-		//c.WriteCustLog(ctx, DistriCustomer, req.Ids, req)
 	} else {
 		behavior = Receive
 	}
 	c.WriteCustLog(ctx, behavior, req.Ids, req)
-	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
-	if err != nil {
-		g.Log().Error(err)
-		return err
-	}
-
 	return nil
 
 }
 
-//删除客户
-func (c *CustomerHeader) DeleteById(ctx context.Context, req *model.DelCustomer, rsp *comm_def.CommonMsg) error {
-	if req.Id == 0 {
-		return gerror.New("参数有误!")
-	}
-	customerServer, err := server.NewCustomerService(ctx)
-	if err != nil {
-		g.Log().Error(err)
-		return gerror.New("系统异常,请重新尝试")
-	}
-	err = customerServer.DeleteById(req.Id)
-	var Ids []int64
-	Ids = append(Ids, gconv.Int64(req.Id))
-	//删除客户
-	c.WriteCustLog(ctx, DeleteById, Ids, req)
-
-	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
-	if err != nil {
-		g.Log().Error(err)
-		return err
-	}
-	return nil
-}
-
 //移入公海
 func (c *CustomerHeader) MoveToPubic(ctx context.Context, req *model.MoveToPubicRep, rsp *comm_def.CommonMsg) error {
 	if len(req.Ids) == 0 {
@@ -208,8 +222,8 @@ func (c *CustomerHeader) MoveToPubic(ctx context.Context, req *model.MoveToPubic
 	}
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
-		g.Log().Error(err)
-		return gerror.New("系统异常,请重新尝试")
+
+		return myerrors.New("系统异常,请重新尝试", err)
 	}
 
 	err = customerServer.MoveToPubic(req.Ids)
@@ -229,14 +243,11 @@ func (c *CustomerHeader) MoveToPubic(ctx context.Context, req *model.MoveToPubic
 func (c *CustomerHeader) DynamicsList(ctx context.Context, req *model.CustomerDynameicsReq, rsp *comm_def.CommonMsg) error {
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
-
-		g.Log().Error(err)
-		return err
+		return myerrors.New("系统异常,请重新尝试", err)
 	}
 	total, list, err := customerServer.DynamicsList(req)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
-		g.Log().Error(err)
 		return err
 	}
 	rsp.Data = g.Map{"list": list, "total": total}
@@ -247,8 +258,8 @@ func (c *CustomerHeader) DynamicsList(ctx context.Context, req *model.CustomerDy
 func (c *CustomerHeader) Mergecustomer(ctx context.Context, req *model.MergecustomerRep, rsp *comm_def.CommonMsg) error {
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
-		g.Log().Error(err)
-		return err
+		return myerrors.New("系统异常,请重新尝试", err)
+
 	}
 	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
 		return err
@@ -258,29 +269,10 @@ func (c *CustomerHeader) Mergecustomer(ctx context.Context, req *model.Mergecust
 	Ids = append(Ids, gconv.Int64(req.Id))
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
-		g.Log().Error(err)
-		return err
-	}
-	c.WriteCustLog(ctx, Mergecustomer, Ids, req)
-	return nil
-}
 
-//修改客户
-func (c *CustomerHeader) UpdateById(ctx context.Context, req *model.UpdateCustomer, rsp *comm_def.CommonMsg) error {
-	customerServer, err := server.NewCustomerService(ctx)
-	if err != nil {
-		g.Log().Error(err)
-		return gerror.New("系统异常,请重新尝试")
-	}
-	err = customerServer.UpdateById(req)
-	var Ids []int64
-	Ids = append(Ids, gconv.Int64(req.Id))
-	c.WriteCustLog(ctx, UpdateById, Ids, req)
-	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
-	if err != nil {
-		g.Log().Error(err)
 		return err
 	}
+	c.WriteCustLog(ctx, Mergecustomer, Ids, req)
 	return nil
 }
 
@@ -291,11 +283,14 @@ func (c *CustomerHeader) CustAbstract(ctx context.Context, req *comm_def.IdReq,
 	}
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
-		g.Log().Error(err)
-		return gerror.New("系统异常,请重新尝试")
+
+		return myerrors.New("系统异常,请重新尝试", err)
 	}
 	list, err := customerServer.CustAbstract(req.Id)
-	g.Log().Info("CustAbstract", list)
+	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
 	rsp.Data = g.Map{"list": list}
 	return nil
 }
@@ -312,13 +307,15 @@ func (c *CustomerHeader) WriteCustLog(ctx context.Context, custType string, cust
 
 //导出
 func (c *CustomerHeader) DeriveList(ctx context.Context, req *model.CustCustomerExport, rsp *comm_def.CommonMsg) error {
-
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
-		g.Log().Error(err)
-		return gerror.New("系统异常,请重新尝试")
+		return myerrors.New("系统异常,请重新尝试", err)
+	} //Export
+	buffer, err := customerServer.Export(req)
+	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
+	if err != nil {
+		return err
 	}
-	buffer, _ := customerServer.Derive(req)
 	rsp.Data = g.Map{"list": buffer}
 	return nil
 }

+ 20 - 0
opms_parent/app/handler/plat/task.go

@@ -53,6 +53,26 @@ func (h *TaskHandler) Create(ctx context.Context, req *model.AddPlatTaskReq, rsp
 	return nil
 }
 
+// Handle 督办任务处理
+func (h *TaskHandler) Handle(ctx context.Context, req *model.HandleReq, rsp *comm_def.CommonMsg) error {
+	// 参数校验
+	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
+		return err
+	}
+	taskService, err := server.NewTaskService(ctx)
+	if err != nil {
+		g.Log().Error(err)
+		return err
+	}
+	err = taskService.Handle(req)
+	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
+	if err != nil {
+		g.Log().Error(err)
+		return err
+	}
+	return nil
+}
+
 // ChangeStatus 修改任务状态
 func (h *TaskHandler) ChangeStatus(ctx context.Context, req *model.ChangeStatusReq, rsp *comm_def.CommonMsg) error {
 	// 参数校验

+ 5 - 5
opms_parent/app/model/contract/ctr_contract_collection.go

@@ -25,7 +25,7 @@ type CtrContractCollectionListReq struct {
 	// CollectionDatetime *gtime.Time `json:"collectionDatetime"` // 回款日期
 	// CollectionAmount   float64     `json:"collectionAmount"`   // 回款金额
 	CollectionType string `json:"collectionType"` // 回款方式
-	// ApproStatus        string      `json:"approStatus"`        // 审核状态 10 未回款 20 已回款
+	ApproStatus    string `json:"approStatus"`    // 审核状态 10 未回款 20 已回款
 	// ContractAmount     float64     `json:"contractAmount"`     // 合同金额
 }
 
@@ -38,17 +38,17 @@ type CtrContractCollectionAddReq struct {
 	CollectionDatetime *gtime.Time `json:"collectionDatetime"` // 回款日期
 	CollectionAmount   float64     `json:"collectionAmount"`   // 回款金额
 	CollectionType     string      `json:"collectionType"`     // 回款方式
-	ApproStatus        string      `json:"approStatus"`        // 审核状态 10 未回款 20 已回款
+	// ApproStatus        string      `json:"approStatus"`        // 审核状态 10 未回款 20 已回款
 	// ContractAmount     float64     `json:"contractAmount"`     // 合同金额
 	Remark string `json:"remark"` // 备注
 }
 
 type CtrContractCollectionUpdateReq struct {
-	Id     int `json:"id" v:"required#请输入Id"`
-	PlanId int `json:"planId"` // 合同回款计划
+	Id int `json:"id" v:"required#请输入Id"`
+	// PlanId int `json:"planId"` // 合同回款计划
 	// CustId             int         `json:"custId"`             // 关联客户
 	// CustName           string      `json:"custName"`           // 客户名称
-	ContractId int `json:"contractId"` // 关联合同
+	// ContractId int `json:"contractId"` // 关联合同
 	// ContractCode       string      `json:"contractCode"`       // 合同编号
 	CollectionDatetime *gtime.Time `json:"collectionDatetime"` // 回款日期
 	CollectionAmount   *float64    `json:"collectionAmount"`   // 回款金额

+ 11 - 5
opms_parent/app/model/contract/ctr_contract_collection_plan.go

@@ -14,6 +14,12 @@ import (
 type CtrContractCollectionPlan internal.CtrContractCollectionPlan
 
 // Fill with you ideas below.
+
+type CtrContractCollectionPlanGetRsp struct {
+	CtrContractCollectionPlan
+	Collection []*CtrContractCollection `json:"collection"`
+}
+
 type CtrContractCollectionPlanListReq struct {
 	request.PageReq
 	SearchText     string `json:"searchText"`     // 合同编号,客户名称
@@ -34,11 +40,11 @@ type CtrContractCollectionPlanAddReq struct {
 	ContractId int `json:"contractId"` // 关联合同
 	// ContractCode   string      `json:"contractCode"`   // 合同编号
 	// ContractStatus string      `json:"contractStatus"` // 回款状态(10待回款20部分回款30全部回款)
-	PlanAmount     float64     `json:"planAmount"`     // 计划回款金额
-	PlanDatetime   *gtime.Time `json:"planDatetime"`   // 计划回款日期
-	CashedAmount   float64     `json:"cashedAmount"`   // 实际回款金额
-	CashedDatetime *gtime.Time `json:"cashedDatetime"` // 实际回款日期
-	Remark         string      `json:"remark"`         // 备注
+	PlanAmount   float64     `json:"planAmount"`   // 计划回款金额
+	PlanDatetime *gtime.Time `json:"planDatetime"` // 计划回款日期
+	// CashedAmount   float64     `json:"cashedAmount"`   // 实际回款金额
+	// CashedDatetime *gtime.Time `json:"cashedDatetime"` // 实际回款日期
+	Remark string `json:"remark"` // 备注
 }
 
 type CtrContractCollectionPlanUpdateReq struct {

+ 25 - 0
opms_parent/app/model/contract/ctr_contract_dynamics.go

@@ -0,0 +1,25 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. Fill this file as you wish.
+// ==========================================================================
+
+package contract
+
+import (
+	"dashoo.cn/micro/app/model/contract/internal"
+	"dashoo.cn/opms_libary/request"
+)
+
+// CtrContractDynamics is the golang structure for table ctr_contract_dynamics.
+type CtrContractDynamics internal.CtrContractDynamics
+
+// Fill with you ideas below.
+type CtrContractDynamicsListReq struct {
+	request.PageReq
+	SearchText  string `json:"searchText"`  // 操作人,操作内容
+	ContractId  int    `json:"contractId"`  // 合同ID
+	OpnPeopleId int    `json:"opnPeopleId"` // 操作人ID
+	OpnPeople   string `json:"opnPeople"`   // 操作人
+	// OpnDate     *gtime.Time `json:"opnDate"`     // 操作日期
+	OpnType string `json:"opnType"` // 操作类型
+	// OpnContent string `json:"opnContent"` // 操作内容
+}

+ 30 - 29
opms_parent/app/model/contract/ctr_contract_invoice.go

@@ -16,30 +16,31 @@ type CtrContractInvoice internal.CtrContractInvoice
 // Fill with you ideas below.
 type CtrContractInvoiceListReq struct {
 	request.PageReq
-	CustId            int         `json:"custId"`            // 关联客户
-	CustName          string      `json:"custName"`          // 客户名称
-	ContractId        int         `json:"contractId"`        // 关联合同
-	ContractCode      string      `json:"contractCode"`      // 合同编号
-	ContractAmount    float64     `json:"contractAmount"`    // 合同金额
-	InvoiceAmount     float64     `json:"invoiceAmount"`     // 开票金额
-	InvoiceDate       *gtime.Time `json:"invoiceDate"`       // 开票日期
-	InvoiceType       string      `json:"invoiceType"`       // 开票类型
-	ApproStatus       string      `json:"approStatus"`       // 审核状态
-	InvoiceCode       string      `json:"invoiceCode"`       // 发票号码
-	ActualInvoiceDate *gtime.Time `json:"actualInvoiceDate"` // 实际开票日期
-	CourierCode       string      `json:"courierCode"`       // 快递单号
+	SearchText   string `json:"searchText"`   // 合同编号,客户名称
+	CustId       int    `json:"custId"`       // 关联客户
+	CustName     string `json:"custName"`     // 客户名称
+	ContractId   int    `json:"contractId"`   // 关联合同
+	ContractCode string `json:"contractCode"` // 合同编号
+	// ContractAmount    float64     `json:"contractAmount"`    // 合同金额
+	// InvoiceAmount     float64     `json:"invoiceAmount"`     // 开票金额
+	// InvoiceDate       *gtime.Time `json:"invoiceDate"`       // 开票日期
+	InvoiceType string `json:"invoiceType"` // 开票类型
+	ApproStatus string `json:"approStatus"` // 审核状态 10 未通过 20 已通过
+	InvoiceCode string `json:"invoiceCode"` // 发票号码
+	// ActualInvoiceDate *gtime.Time `json:"actualInvoiceDate"` // 实际开票日期
+	CourierCode string `json:"courierCode"` // 快递单号
 }
 
 type CtrContractInvoiceAddReq struct {
-	CustId            int         `json:"custId"`            // 关联客户
-	CustName          string      `json:"custName"`          // 客户名称
-	ContractId        int         `json:"contractId"`        // 关联合同
-	ContractCode      string      `json:"contractCode"`      // 合同编号
-	ContractAmount    float64     `json:"contractAmount"`    // 合同金额
-	InvoiceAmount     float64     `json:"invoiceAmount"`     // 开票金额
-	InvoiceDate       *gtime.Time `json:"invoiceDate"`       // 开票日期
-	InvoiceType       string      `json:"invoiceType"`       // 开票类型
-	ApproStatus       string      `json:"approStatus"`       // 审核状态
+	// CustId            int         `json:"custId"`            // 关联客户
+	// CustName          string      `json:"custName"`          // 客户名称
+	ContractId int `json:"contractId"` // 关联合同
+	// ContractCode      string      `json:"contractCode"`      // 合同编号
+	// ContractAmount    float64     `json:"contractAmount"`    // 合同金额
+	InvoiceAmount float64     `json:"invoiceAmount"` // 开票金额
+	InvoiceDate   *gtime.Time `json:"invoiceDate"`   // 开票日期
+	InvoiceType   string      `json:"invoiceType"`   // 开票类型
+	// ApproStatus       string      `json:"approStatus"`       // 审核状态 10 未通过 20 已通过
 	InvoiceCode       string      `json:"invoiceCode"`       // 发票号码
 	ActualInvoiceDate *gtime.Time `json:"actualInvoiceDate"` // 实际开票日期
 	CourierCode       string      `json:"courierCode"`       // 快递单号
@@ -47,16 +48,16 @@ type CtrContractInvoiceAddReq struct {
 }
 
 type CtrContractInvoiceUpdateReq struct {
-	Id                int         `json:"id" v:"required#请输入Id"`
-	CustId            int         `json:"custId"`            // 关联客户
-	CustName          string      `json:"custName"`          // 客户名称
-	ContractId        int         `json:"contractId"`        // 关联合同
-	ContractCode      string      `json:"contractCode"`      // 合同编号
-	ContractAmount    float64     `json:"contractAmount"`    // 合同金额
-	InvoiceAmount     float64     `json:"invoiceAmount"`     // 开票金额
+	Id int `json:"id" v:"required#请输入Id"`
+	// CustId            int         `json:"custId"`            // 关联客户
+	// CustName          string      `json:"custName"`          // 客户名称
+	// ContractId        int         `json:"contractId"`        // 关联合同
+	// ContractCode      string      `json:"contractCode"`      // 合同编号
+	// ContractAmount    float64     `json:"contractAmount"`    // 合同金额
+	InvoiceAmount     *float64    `json:"invoiceAmount"`     // 开票金额
 	InvoiceDate       *gtime.Time `json:"invoiceDate"`       // 开票日期
 	InvoiceType       string      `json:"invoiceType"`       // 开票类型
-	ApproStatus       string      `json:"approStatus"`       // 审核状态
+	ApproStatus       string      `json:"approStatus"`       // 审核状态 10 未通过 20 已通过
 	InvoiceCode       string      `json:"invoiceCode"`       // 发票号码
 	ActualInvoiceDate *gtime.Time `json:"actualInvoiceDate"` // 实际开票日期
 	CourierCode       string      `json:"courierCode"`       // 快递单号

+ 28 - 0
opms_parent/app/model/contract/internal/ctr_contract_dynamics.go

@@ -0,0 +1,28 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"github.com/gogf/gf/os/gtime"
+)
+
+// CtrContractDynamics is the golang structure for table ctr_contract_dynamics.
+type CtrContractDynamics struct {
+	Id          int         `orm:"id,primary"    json:"id"`          // 主键
+	ContractId  int         `orm:"contract_id"   json:"contractId"`  // 合同ID
+	OpnPeopleId int         `orm:"opn_people_id" json:"opnPeopleId"` // 操作人ID
+	OpnPeople   string      `orm:"opn_people"    json:"opnPeople"`   // 操作人
+	OpnDate     *gtime.Time `orm:"opn_date"      json:"opnDate"`     // 操作日期
+	OpnType     string      `orm:"opn_type"      json:"opnType"`     // 操作类型
+	OpnContent  string      `orm:"opn_content"   json:"opnContent"`  // 操作内容
+	Remark      string      `orm:"remark"        json:"remark"`      // 备注
+	CreatedBy   int         `orm:"created_by"    json:"createdBy"`   // 创建者
+	CreatedName string      `orm:"created_name"  json:"createdName"` // 创建人
+	CreatedTime *gtime.Time `orm:"created_time"  json:"createdTime"` // 创建时间
+	UpdatedBy   int         `orm:"updated_by"    json:"updatedBy"`   // 更新者
+	UpdatedName string      `orm:"updated_name"  json:"updatedName"` // 更新人
+	UpdatedTime *gtime.Time `orm:"updated_time"  json:"updatedTime"` // 更新时间
+	DeletedTime *gtime.Time `orm:"deleted_time"  json:"deletedTime"` // 删除时间
+}

+ 11 - 4
opms_parent/app/model/cust/cust_customer.go

@@ -24,6 +24,7 @@ type CustCustomerSearchReq struct {
 	CustLevel    string `json:"custLevel"`
 	TargetType   string `json:"targetType,omitempty"`
 	FollowUpDate string `json:"followUpDate,omitempty"`
+	Remark       string `json:"remark"`
 	request.PageReq
 }
 
@@ -43,12 +44,12 @@ type CustExport struct {
 
 // 添加客户信息表
 type AddCustCustomerReq struct {
-	Cust *Customer
+	Cust *CustomerAddSeq
 	Info *Information
 }
 
 // 单表添加客户信息表
-type Customer struct {
+type CustomerAddSeq struct {
 	CustName     string      `p:"custName"        json:"custName"   v:"required#客户名称不能为空"`
 	AbbrName     string      `p:"abbrName"        json:"abbrName"   `                         // 助计名
 	CustLocation string      `p:"custLocation"    json:"custLocation"    `                    // 所在地区
@@ -90,6 +91,7 @@ type CustList struct {
 	CreatedTime  string `orm:"created_time"   json:"createdTime"`  // 创建时间
 	SalesId      int    `orm:"sales_id"   json:"salesId"`          //
 	SalesName    string `orm:"sales_name"   json:"salesName"`      //
+	Remark       string `orm:"remark"   json:"remark"`
 	//Follow       *Follow     `json:"follow"`
 }
 
@@ -137,7 +139,7 @@ type DelCustomerContact struct {
 //合并客户参数
 type MergecustomerRep struct {
 	Id int `json:"id"` //目标Id
-	*Customer
+	*CustomerAddSeq
 	//*CustCustomerContactSeq
 	*AddCustomerBelong
 	ChooseId []int64 `json:"chooseId,omitempty"` //被合并的客户id
@@ -146,7 +148,7 @@ type MergecustomerRep struct {
 //修改客户
 type UpdateCustomer struct {
 	Id int `json:"id,omitempty"` //客户id
-	*Customer
+	*CustomerAddSeq
 }
 
 //移入公海
@@ -154,3 +156,8 @@ type MoveToPubicRep struct {
 	Ids    []int64 `json:"ids,omitempty"`
 	Remark string  `json:"remark,omitempty"`
 }
+
+//客户名称
+type CustName struct {
+	CustName string `json:"custName"` // 客户名称
+}

+ 13 - 3
opms_parent/app/model/plat/internal/plat_task.go

@@ -13,19 +13,29 @@ type PlatTask struct {
 	Id               int         `orm:"id,primary"         json:"id"`               // 主键
 	TaskTitle        string      `orm:"task_title"         json:"taskTitle"`        // 任务标题
 	TaskType         string      `orm:"task_type"          json:"taskType"`         // 任务类型
-	TaskStatus       string      `orm:"task_status"        json:"taskStatus"`       // 任务状态(10进行中20关闭
+	TaskStatus       string      `orm:"task_status"        json:"taskStatus"`       // 任务状态(10发起  20进行中   30流程完成
 	IsOverdue        string      `orm:"is_overdue"         json:"isOverdue"`        // 是否超期(10否20是)
 	TaskStartDate    *gtime.Time `orm:"task_start_date"    json:"taskStartDate"`    // 任务开始时间
 	TaskEndDate      *gtime.Time `orm:"task_end_date"      json:"taskEndDate"`      // 任务结束时间
 	TaskDesc         string      `orm:"task_desc"          json:"taskDesc"`         // 任务说明
-	SupervisorUserId int         `orm:"supervisor_user_id" json:"supervisorUserId"` // 督办人
-	WatchUserId      int         `orm:"watch_user_id"      json:"watchUserId"`      // 监办人
 	MainUserId       int         `orm:"main_user_id"       json:"mainUserId"`       // 负责人ID
 	OwnerUserId      string      `orm:"owner_user_id"      json:"ownerUserId"`      // 团队成员ID
 	TaskLabel        string      `orm:"task_label"         json:"taskLabel"`        // 任务标签,号拼接
+	SupervisorUserId int         `orm:"supervisor_user_id" json:"supervisorUserId"` // 督办人ID
+	WatchUserId      int         `orm:"watch_user_id"      json:"watchUserId"`      // 监办人ID
 	TargetId         int         `orm:"target_id"          json:"targetId"`         // 关联对象ID
 	TargetType       string      `orm:"target_type"        json:"targetType"`       // 关联对象类型(10客户,20项目,30合同,40回款)
 	TargetName       string      `orm:"target_name"        json:"targetName"`       // 关联对象
+	ApproverId       int         `orm:"approver_id"        json:"approverId"`       // 审批人ID
+	ApproDate        *gtime.Time `orm:"appro_date"         json:"approDate"`        // 审批时间
+	ApproStatus      string      `orm:"appro_status"       json:"approStatus"`      // 审批结果
+	ApproDesc        string      `orm:"appro_desc"         json:"approDesc"`        // 审批说明
+	EvaluatorId      int         `orm:"evaluator_id"       json:"evaluatorId"`      // 评价人ID
+	EvaluateDate     *gtime.Time `orm:"evaluate_date"      json:"evaluateDate"`     // 评价时间
+	EvaluateStatus   string      `orm:"evaluate_status"    json:"evaluateStatus"`   // 评价结果
+	EvaluateDesc     string      `orm:"evaluate_desc"      json:"evaluateDesc"`     // 评价说明
+	ReceiveDate      *gtime.Time `orm:"receive_date"       json:"receiveDate"`      // 接收时间
+	ActualCloseDate  *gtime.Time `orm:"actual_close_date"  json:"actualCloseDate"`  // 实际完成时间
 	Remark           string      `orm:"remark"             json:"remark"`           // 备注
 	CreatedBy        int         `orm:"created_by"         json:"createdBy"`        // 创建者
 	CreatedName      string      `orm:"created_name"       json:"createdName"`      // 创建人

+ 31 - 0
opms_parent/app/model/plat/internal/plat_task_handle.go

@@ -0,0 +1,31 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"github.com/gogf/gf/os/gtime"
+)
+
+// PlatTaskHandle is the golang structure for table plat_task_handle.
+type PlatTaskHandle struct {
+	ID           int         `orm:"ID,primary"     json:"iD"`           // 主键
+	TaskId       int         `orm:"task_id"        json:"taskId"`       // 任务ID
+	TaskStatus   string      `orm:"task_status"    json:"taskStatus"`   // 任务状态(10打开20关闭)
+	Step         int         `orm:"step"           json:"step"`         // 步骤号
+	MainUserId   int         `orm:"main_user_id"   json:"mainUserId"`   // 处理人ID
+	OwnerUserId  string      `orm:"owner_user_id"  json:"ownerUserId"`  // 团队成员ID
+	HandleUserId int         `orm:"handle_user_id" json:"handleUserId"` // 处理人ID
+	HandleDate   *gtime.Time `orm:"handle_date"    json:"handleDate"`   // 处理时间
+	HandleStatus string      `orm:"handle_status"  json:"handleStatus"` // 处理结果(10接收20提交30审批通过40审批退回)
+	HandleDesc   string      `orm:"handle_desc"    json:"handleDesc"`   // 处理说明
+	Remark       string      `orm:"remark"         json:"remark"`       // 备注
+	CreatedBy    int         `orm:"created_by"     json:"createdBy"`    // 创建者
+	CreatedName  string      `orm:"created_name"   json:"createdName"`  // 创建人
+	CreatedTime  *gtime.Time `orm:"created_time"   json:"createdTime"`  // 创建时间
+	UpdatedBy    int         `orm:"updated_by"     json:"updatedBy"`    // 更新者
+	UpdatedName  string      `orm:"updated_name"   json:"updatedName"`  // 更新人
+	UpdatedTime  *gtime.Time `orm:"updated_time"   json:"updatedTime"`  // 更新时间
+	DeletedTime  *gtime.Time `orm:"deleted_time"   json:"deletedTime"`  // 删除时间
+}

+ 15 - 0
opms_parent/app/model/plat/plat_task.go

@@ -15,6 +15,11 @@ type PlatTask internal2.PlatTask
 
 // Fill with you ideas below.
 
+type PlatTaskEx struct {
+	internal2.PlatTask
+	Step         int         `orm:"step"           json:"step"`         // 步骤号
+}
+
 // 查询
 type SearchPlatTaskReq struct {
 	TaskTitle  string `json:"taskTitle"`
@@ -26,6 +31,7 @@ type SearchPlatTaskReq struct {
 	TargetType string `json:"targetType"`
 	MySelf     string `json:"mySelf"`
 	IsMain     string `json:"isMain"`
+	OperateType     string `json:"operateType"`
 	request.PageReq
 }
 
@@ -74,3 +80,12 @@ type ExportReq struct {
 type ExportContent struct {
 	Content []byte `json:"content"` // 导出数据流
 }
+
+// 督办处理接口
+type HandleReq struct {
+	TaskId       int    				`json:"taskId|min:1"  v:"required#任务Id不能为空|任务Id不能为空"`
+	Step         int    				`json:"step"    v:"required|min:10#步骤不能为空|步骤不能为空"` // 步骤号(10接收  15暂存  20提交  30审批(督办人)  40评价(监办人))
+	HandleStatus string 				`json:"handleStatus"  v:"required#处理结果不能为空"`
+	HandleDesc   string  				`json:"handleDesc"`
+	ProgressList []*PlatTaskProgress    `json:"progressList"`
+}

+ 14 - 0
opms_parent/app/model/plat/plat_task_handle.go

@@ -0,0 +1,14 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. Fill this file as you wish.
+// ==========================================================================
+
+package plat
+
+import (
+	internal2 "dashoo.cn/micro/app/model/plat/internal"
+)
+
+// PlatTaskHandle is the golang structure for table plat_task_handle.
+type PlatTaskHandle internal2.PlatTaskHandle
+
+// Fill with you ideas below.

+ 124 - 0
opms_parent/app/service/contract/ctr_contract.go

@@ -3,6 +3,7 @@ package service
 import (
 	"context"
 	"database/sql"
+	"encoding/json"
 	"fmt"
 
 	basedao "dashoo.cn/micro/app/dao/base"
@@ -28,6 +29,7 @@ type CtrContractService struct {
 	UserDao         *sysdao.SysUserDao
 	CtrProductDao   *dao.CtrContractProductDao
 	ProductDao      *basedao.BaseProductDao
+	DynamicsDao     *dao.CtrContractDynamicsDao
 
 	Tenant   string
 	userInfo request.UserInfo
@@ -50,6 +52,7 @@ func NewCtrContractService(ctx context.Context) (*CtrContractService, error) {
 		UserDao:         sysdao.NewSysUserDao(tenant),
 		CtrProductDao:   dao.NewCtrContractProductDao(tenant),
 		ProductDao:      basedao.NewBaseProductDao(tenant),
+		DynamicsDao:     dao.NewCtrContractDynamicsDao(tenant),
 		Tenant:          tenant,
 		userInfo:        userInfo,
 	}, nil
@@ -76,6 +79,63 @@ func (s CtrContractService) Get(ctx context.Context, id int) (*model.CtrContract
 	}, nil
 }
 
+func (s CtrContractService) DynamicsList(ctx context.Context, req *model.CtrContractDynamicsListReq) (int, interface{}, error) {
+	dao := &s.DynamicsDao.CtrContractDynamicsDao
+	if req.SearchText != "" {
+		likestr := fmt.Sprintf("%%%s%%", req.SearchText)
+		dao = dao.Where("(opn_people LIKE ? || opn_content LIKE ?)", likestr, likestr)
+	}
+	if req.ContractId != 0 {
+		dao = dao.Where("contract_id = ?", req.ContractId)
+	}
+	if req.OpnPeopleId != 0 {
+		dao = dao.Where("opn_people_id = ?", req.OpnPeopleId)
+	}
+	if req.OpnPeople != "" {
+		likestr := fmt.Sprintf("%%%s%%", req.OpnPeople)
+		dao = dao.Where("opn_people like ?", likestr)
+	}
+	if req.OpnType != "" {
+		dao = dao.Where("opn_type = ?", req.OpnType)
+	}
+	// if req.OpnContent != "" {
+	// 	likestr := fmt.Sprintf("%%%s%%", req.OpnContent)
+	// 	dao = dao.Where("opn_content like ?", likestr)
+	// }
+	if req.BeginTime != "" {
+		dao = dao.Where("created_time > ?", req.BeginTime)
+	}
+	if req.EndTime != "" {
+		dao = dao.Where("created_time < ?", req.EndTime)
+	}
+
+	total, err := dao.Count()
+	if err != nil {
+		return 0, nil, err
+	}
+	if req.PageNum != 0 {
+		dao = dao.Page(req.GetPage())
+	}
+	orderby := "created_time desc"
+	if req.OrderBy != "" {
+		orderby = req.OrderBy
+	}
+	dao = dao.Order(orderby)
+
+	ents := []*model.CtrContractDynamics{}
+	err = dao.Structs(&ents)
+	if err != nil && err != sql.ErrNoRows {
+		return 0, nil, err
+	}
+
+	ret := map[string][]*model.CtrContractDynamics{}
+	for _, ent := range ents {
+		date := ent.OpnDate.Format("Y-m-d")
+		ret[date] = append(ret[date], ent)
+	}
+	return total, ret, err
+}
+
 func (s CtrContractService) List(ctx context.Context, req *model.CtrContractListReq) (int, []*model.CtrContract, error) {
 	dao := &s.Dao.CtrContractDao
 	if req.SearchText != "" {
@@ -216,6 +276,29 @@ func (s CtrContractService) BindProduct(tx *gdb.TX, id int, product []model.CtrA
 	return nil
 }
 
+func (s CtrContractService) AddDynamicsByCurrentUser(tx *gdb.TX, contractId int, opnType string, content map[string]interface{}) error {
+	contentByte, err := json.Marshal(content)
+	if err != nil {
+		return err
+	}
+	_, err = tx.InsertAndGetId("ctr_contract_dynamics", model.CtrContractDynamics{
+		ContractId:  contractId,
+		OpnPeopleId: s.userInfo.Id,
+		OpnPeople:   s.userInfo.NickName,
+		OpnDate:     gtime.Now(),
+		OpnType:     opnType,
+		OpnContent:  string(contentByte),
+		Remark:      "",
+		CreatedBy:   s.userInfo.Id,
+		CreatedName: s.userInfo.NickName,
+		CreatedTime: gtime.Now(),
+		UpdatedBy:   s.userInfo.Id,
+		UpdatedName: s.userInfo.NickName,
+		UpdatedTime: gtime.Now(),
+	})
+	return err
+}
+
 func (s CtrContractService) Add(ctx context.Context, req *model.CtrContractAddReq) (int, error) {
 	validErr := gvalid.CheckStruct(ctx, req, nil)
 	if validErr != nil {
@@ -288,6 +371,10 @@ func (s CtrContractService) Add(ctx context.Context, req *model.CtrContractAddRe
 		if err != nil {
 			return err
 		}
+		err = s.AddDynamicsByCurrentUser(tx, int(ctrid), "创建合同", map[string]interface{}{})
+		if err != nil {
+			return err
+		}
 		id = int(ctrid)
 		return nil
 	})
@@ -443,6 +530,17 @@ func (s CtrContractService) Transfer(ctx context.Context, req *model.CtrContract
 		if err != nil {
 			return err
 		}
+		err = s.AddDynamicsByCurrentUser(tx, req.Id, "转移合同", map[string]interface{}{
+			"toInchargeId":     req.InchargeId,
+			"toInchargeName":   req.InchargeName,
+			"fromInchargeId":   ent.InchargeId,
+			"fromInchargeName": ent.InchargeName,
+			"operatedId":       s.userInfo.Id,
+			"operatedName":     s.userInfo.NickName,
+		})
+		if err != nil {
+			return err
+		}
 		return nil
 	})
 	if txerr != nil {
@@ -451,6 +549,32 @@ func (s CtrContractService) Transfer(ctx context.Context, req *model.CtrContract
 	return nil
 }
 
+func (s CtrContractService) UpdateInvoiceAmount(tx *gdb.TX, id int) error {
+	ctr := model.CtrContract{}
+	err := tx.GetStruct(&ctr, "select * from ctr_contract where id = ?", id)
+	if err == sql.ErrNoRows {
+		return myerrors.NewMsgError(err, fmt.Sprintf("合同不存在 %d", id))
+	}
+	if err != nil {
+		return err
+	}
+
+	v, err := tx.GetValue("select sum(invoice_amount) from ctr_contract_invoice where contract_id=? and appro_status='20' and deleted_time is null", id)
+	if err != nil {
+		return err
+	}
+	amount := v.Float64()
+
+	_, err = tx.Update("ctr_contract",
+		map[string]interface{}{
+			"invoice_amount": amount,
+		}, "id = ?", id)
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
 func (s CtrContractService) UpdateCollectedAmount(tx *gdb.TX, id int) error {
 	ctr := model.CtrContract{}
 	err := tx.GetStruct(&ctr, "select * from ctr_contract where id = ?", id)

+ 32 - 8
opms_parent/app/service/contract/ctr_contract_append.go

@@ -2,14 +2,16 @@ package service
 
 import (
 	"context"
-	dao "dashoo.cn/micro/app/dao/contract"
-	model "dashoo.cn/micro/app/model/contract"
 	"database/sql"
 	"fmt"
 
+	dao "dashoo.cn/micro/app/dao/contract"
+	model "dashoo.cn/micro/app/model/contract"
+
 	"dashoo.cn/opms_libary/micro_srv"
 	"dashoo.cn/opms_libary/myerrors"
 	"dashoo.cn/opms_libary/request"
+	"github.com/gogf/gf/database/gdb"
 	"github.com/gogf/gf/os/gtime"
 	"github.com/gogf/gf/util/gvalid"
 )
@@ -17,6 +19,7 @@ import (
 type CtrContractAppendService struct {
 	Dao         *dao.CtrContractAppendDao
 	ContractDao *dao.CtrContractDao
+	ctrSrv      *CtrContractService
 	Tenant      string
 	userInfo    request.UserInfo
 }
@@ -31,9 +34,14 @@ func NewCtrContractAppendService(ctx context.Context) (*CtrContractAppendService
 	if err != nil {
 		return nil, fmt.Errorf("获取用户信息异常:%s", err.Error())
 	}
+	ctrSrv, err := NewCtrContractService(ctx)
+	if err != nil {
+		return nil, err
+	}
 	return &CtrContractAppendService{
 		Dao:         dao.NewCtrContractAppendDao(tenant),
 		ContractDao: dao.NewCtrContractDao(tenant),
+		ctrSrv:      ctrSrv,
 		Tenant:      tenant,
 		userInfo:    userInfo,
 	}, nil
@@ -90,7 +98,7 @@ func (s CtrContractAppendService) Add(ctx context.Context, req *model.CtrContrac
 		return 0, myerrors.NewMsgError(nil, fmt.Sprintf("合同不存在: %d", req.ContractId))
 	}
 
-	id, err := s.Dao.InsertAndGetId(model.CtrContractAppend{
+	contractAppend := model.CtrContractAppend{
 		ContractId:  req.ContractId,
 		FileName:    req.FileName,
 		FileType:    req.FileType,
@@ -103,11 +111,27 @@ func (s CtrContractAppendService) Add(ctx context.Context, req *model.CtrContrac
 		UpdatedName: s.userInfo.NickName,
 		UpdatedTime: gtime.Now(),
 		DeletedTime: gtime.Now(),
-	})
-	if err != nil {
-		return 0, err
 	}
-	return int(id), err
+
+	var id int
+	txerr := s.Dao.DB.Transaction(ctx, func(ctx context.Context, tx *gdb.TX) error {
+		appendId, err := tx.InsertAndGetId("ctr_contract_append", contractAppend)
+		if err != nil {
+			return err
+		}
+		err = s.ctrSrv.AddDynamicsByCurrentUser(tx, int(req.ContractId), "创建合同附件", map[string]interface{}{
+			"id":       appendId,
+			"fileName": contractAppend.FileName,
+			"fileType": contractAppend.FileType,
+			"fileUrl":  contractAppend.FileUrl,
+		})
+		if err != nil {
+			return err
+		}
+		id = int(appendId)
+		return nil
+	})
+	return id, txerr
 }
 
 func (s CtrContractAppendService) Update(ctx context.Context, req *model.CtrContractAppendUpdateReq) error {
@@ -121,7 +145,7 @@ func (s CtrContractAppendService) Update(ctx context.Context, req *model.CtrCont
 		return err
 	}
 	if ent == nil {
-		return myerrors.NewMsgError(nil, fmt.Sprintf("文档不存在: %d", req.Id))
+		return myerrors.NewMsgError(nil, fmt.Sprintf("合同附件不存在: %d", req.Id))
 	}
 
 	if req.ContractId != 0 {

+ 44 - 26
opms_parent/app/service/contract/ctr_contract_collection.go

@@ -80,6 +80,9 @@ func (s CtrContractCollectionService) List(ctx context.Context, req *model.CtrCo
 	if req.CollectionType != "" {
 		dao = dao.Where("collection_type = ?", req.CollectionType)
 	}
+	if req.ApproStatus != "" {
+		dao = dao.Where("appro_status = ?", req.ApproStatus)
+	}
 	if req.BeginTime != "" {
 		dao = dao.Where("created_time > ?", req.BeginTime)
 	}
@@ -122,7 +125,7 @@ func (s CtrContractCollectionService) Add(ctx context.Context, req *model.CtrCon
 		return 0, myerrors.NewMsgError(nil, fmt.Sprintf("合同:%d 不存在", req.ContractId))
 	}
 
-	id, err := s.Dao.InsertAndGetId(model.CtrContractCollection{
+	ent := model.CtrContractCollection{
 		PlanId:             req.PlanId,
 		CustId:             c.CustId,
 		CustName:           c.CustName,
@@ -131,7 +134,7 @@ func (s CtrContractCollectionService) Add(ctx context.Context, req *model.CtrCon
 		CollectionDatetime: req.CollectionDatetime,
 		CollectionAmount:   req.CollectionAmount,
 		CollectionType:     req.CollectionType,
-		ApproStatus:        req.ApproStatus,
+		ApproStatus:        "10",
 		ContractAmount:     c.ContractAmount,
 		Remark:             req.Remark,
 		CreatedBy:          s.userInfo.Id,
@@ -141,11 +144,26 @@ func (s CtrContractCollectionService) Add(ctx context.Context, req *model.CtrCon
 		UpdatedName:        s.userInfo.NickName,
 		UpdatedTime:        gtime.Now(),
 		DeletedTime:        gtime.Now(),
-	})
-	if err != nil {
-		return 0, err
 	}
-	return int(id), err
+	var id int
+	txerr := s.Dao.DB.Transaction(ctx, func(ctx context.Context, tx *gdb.TX) error {
+		collectionId, err := tx.InsertAndGetId("ctr_contract_collection", ent)
+		if err != nil {
+			return err
+		}
+		err = s.ctrSrv.AddDynamicsByCurrentUser(tx, req.ContractId, "创建回款", map[string]interface{}{
+			"id":                 collectionId,
+			"collectionDatetime": req.CollectionDatetime,
+			"collectionAmount":   req.CollectionAmount,
+			"collectionType":     req.CollectionType,
+		})
+		if err != nil {
+			return err
+		}
+		id = int(collectionId)
+		return nil
+	})
+	return id, txerr
 }
 
 func (s CtrContractCollectionService) UpdateAmount(tx *gdb.TX, id int) error {
@@ -181,28 +199,28 @@ func (s CtrContractCollectionService) Update(ctx context.Context, req *model.Ctr
 		return myerrors.NewMsgError(nil, fmt.Sprintf("回款:%d 不存在", req.Id))
 	}
 
-	var c *model.CtrContract
-	if req.ContractId != 0 {
-		c, err = s.ContractDao.Where("id = ?", req.ContractId).One()
-		if err != nil {
-			return err
-		}
-		if c == nil {
-			return myerrors.NewMsgError(nil, fmt.Sprintf("合同:%d 不存在", req.ContractId))
-		}
-	}
+	// var c *model.CtrContract
+	// if req.ContractId != 0 {
+	// 	c, err = s.ContractDao.Where("id = ?", req.ContractId).One()
+	// 	if err != nil {
+	// 		return err
+	// 	}
+	// 	if c == nil {
+	// 		return myerrors.NewMsgError(nil, fmt.Sprintf("合同:%d 不存在", req.ContractId))
+	// 	}
+	// }
 
 	toupdate := map[string]interface{}{}
-	if req.PlanId != 0 {
-		toupdate["plan_id"] = req.PlanId
-	}
-	if req.ContractId != 0 {
-		toupdate["cust_id"] = c.CustId
-		toupdate["cust_name"] = c.CustName
-		toupdate["contract_id"] = req.ContractId
-		toupdate["contract_code"] = c.ContractCode
-		toupdate["contract_amount"] = c.ContractAmount
-	}
+	// if req.PlanId != 0 {
+	// 	toupdate["plan_id"] = req.PlanId
+	// }
+	// if req.ContractId != 0 {
+	// 	toupdate["cust_id"] = c.CustId
+	// 	toupdate["cust_name"] = c.CustName
+	// 	toupdate["contract_id"] = req.ContractId
+	// 	toupdate["contract_code"] = c.ContractCode
+	// 	toupdate["contract_amount"] = c.ContractAmount
+	// }
 	if req.CollectionDatetime != nil {
 		toupdate["collection_datetime"] = req.CollectionDatetime
 	}

+ 53 - 15
opms_parent/app/service/contract/ctr_contract_collection_plan.go

@@ -17,9 +17,10 @@ import (
 )
 
 type CtrContractCollectionPlanService struct {
-	Dao         *dao.CtrContractCollectionPlanDao
-	ContractDao *dao.CtrContractDao
-	ctrSrv      *CtrContractService
+	Dao           *dao.CtrContractCollectionPlanDao
+	CollectionDao *dao.CtrContractCollectionDao
+	ContractDao   *dao.CtrContractDao
+	ctrSrv        *CtrContractService
 
 	Tenant   string
 	userInfo request.UserInfo
@@ -40,11 +41,33 @@ func NewCtrContractCollectionPlanService(ctx context.Context) (*CtrContractColle
 		return nil, err
 	}
 	return &CtrContractCollectionPlanService{
-		Dao:         dao.NewCtrContractCollectionPlanDao(tenant),
-		ContractDao: dao.NewCtrContractDao(tenant),
-		ctrSrv:      ctrSrv,
-		Tenant:      tenant,
-		userInfo:    userInfo,
+		Dao:           dao.NewCtrContractCollectionPlanDao(tenant),
+		ContractDao:   dao.NewCtrContractDao(tenant),
+		CollectionDao: dao.NewCtrContractCollectionDao(tenant),
+		ctrSrv:        ctrSrv,
+		Tenant:        tenant,
+		userInfo:      userInfo,
+	}, nil
+}
+
+func (s CtrContractCollectionPlanService) Get(ctx context.Context, id int) (*model.CtrContractCollectionPlanGetRsp, error) {
+	ent, err := s.Dao.Where("Id = ?", id).One()
+	if err != nil {
+		return nil, err
+	}
+	if ent == nil {
+		return nil, myerrors.NewMsgError(nil, "回款计划不存在")
+	}
+	c, err := s.CollectionDao.Where("plan_id = ?", id).All()
+	if err != nil {
+		return nil, err
+	}
+	if c == nil {
+		c = []*model.CtrContractCollection{}
+	}
+	return &model.CtrContractCollectionPlanGetRsp{
+		CtrContractCollectionPlan: *ent,
+		Collection:                c,
 	}, nil
 }
 
@@ -113,7 +136,7 @@ func (s CtrContractCollectionPlanService) Add(ctx context.Context, req *model.Ct
 		return 0, myerrors.NewMsgError(nil, fmt.Sprintf("合同:%d 不存在", req.ContractId))
 	}
 
-	id, err := s.Dao.InsertAndGetId(model.CtrContractCollectionPlan{
+	ent := model.CtrContractCollectionPlan{
 		CustId:         c.CustId,
 		CustName:       c.CustName,
 		ContractId:     req.ContractId,
@@ -121,8 +144,8 @@ func (s CtrContractCollectionPlanService) Add(ctx context.Context, req *model.Ct
 		ContractStatus: "10",
 		PlanAmount:     req.PlanAmount,
 		PlanDatetime:   req.PlanDatetime,
-		CashedAmount:   req.CashedAmount,
-		CashedDatetime: req.CashedDatetime,
+		CashedAmount:   0,
+		CashedDatetime: nil,
 		Remark:         req.Remark,
 		CreatedBy:      s.userInfo.Id,
 		CreatedName:    s.userInfo.NickName,
@@ -131,11 +154,26 @@ func (s CtrContractCollectionPlanService) Add(ctx context.Context, req *model.Ct
 		UpdatedName:    s.userInfo.NickName,
 		UpdatedTime:    gtime.Now(),
 		DeletedTime:    gtime.Now(),
-	})
-	if err != nil {
-		return 0, err
 	}
-	return int(id), err
+
+	var id int
+	txerr := s.Dao.DB.Transaction(ctx, func(ctx context.Context, tx *gdb.TX) error {
+		planid, err := tx.InsertAndGetId("ctr_contract_collection_plan", ent)
+		if err != nil {
+			return err
+		}
+		err = s.ctrSrv.AddDynamicsByCurrentUser(tx, req.ContractId, "创建回款计划", map[string]interface{}{
+			"id":           planid,
+			"planAmount":   req.PlanAmount,
+			"planDatetime": req.PlanDatetime,
+		})
+		if err != nil {
+			return err
+		}
+		id = int(planid)
+		return nil
+	})
+	return id, txerr
 }
 
 func (s CtrContractCollectionPlanService) Update(ctx context.Context, req *model.CtrContractCollectionPlanUpdateReq) error {

+ 321 - 0
opms_parent/app/service/contract/ctr_contract_invoice.go

@@ -0,0 +1,321 @@
+package service
+
+import (
+	"context"
+	"database/sql"
+	"fmt"
+
+	dao "dashoo.cn/micro/app/dao/contract"
+	model "dashoo.cn/micro/app/model/contract"
+
+	"dashoo.cn/opms_libary/micro_srv"
+	"dashoo.cn/opms_libary/myerrors"
+	"dashoo.cn/opms_libary/request"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/os/gtime"
+	"github.com/gogf/gf/util/gvalid"
+)
+
+type CtrContractInvoiceService struct {
+	Dao         *dao.CtrContractInvoiceDao
+	ContractDao *dao.CtrContractDao
+	ctrSrv      *CtrContractService
+	Tenant      string
+	userInfo    request.UserInfo
+}
+
+func NewCtrContractInvoiceService(ctx context.Context) (*CtrContractInvoiceService, error) {
+	tenant, err := micro_srv.GetTenant(ctx)
+	if err != nil {
+		return nil, fmt.Errorf("获取组合码异常:%s", err.Error())
+	}
+	// 获取用户信息
+	userInfo, err := micro_srv.GetUserInfo(ctx)
+	if err != nil {
+		return nil, fmt.Errorf("获取用户信息异常:%s", err.Error())
+	}
+	ctrSrv, err := NewCtrContractService(ctx)
+	if err != nil {
+		return nil, err
+	}
+	return &CtrContractInvoiceService{
+		Dao:         dao.NewCtrContractInvoiceDao(tenant),
+		ContractDao: dao.NewCtrContractDao(tenant),
+		ctrSrv:      ctrSrv,
+		Tenant:      tenant,
+		userInfo:    userInfo,
+	}, nil
+}
+
+func (s CtrContractInvoiceService) List(ctx context.Context, req *model.CtrContractInvoiceListReq) (int, []*model.CtrContractInvoice, error) {
+	dao := &s.Dao.CtrContractInvoiceDao
+	if req.SearchText != "" {
+		likestr := fmt.Sprintf("%%%s%%", req.SearchText)
+		dao = dao.Where("(cust_name LIKE ? || contract_code LIKE ?)", likestr, likestr)
+	}
+	if req.CustId != 0 {
+		dao = dao.Where("cust_id = ?", req.CustId)
+	}
+	if req.CustName != "" {
+		likestr := fmt.Sprintf("%%%s%%", req.CustName)
+		dao = dao.Where("cust_name like ?", likestr)
+	}
+	if req.ContractId != 0 {
+		dao = dao.Where("contract_id = ?", req.ContractId)
+	}
+	if req.ContractCode != "" {
+		likestr := fmt.Sprintf("%%%s%%", req.ContractCode)
+		dao = dao.Where("contract_code like ?", likestr)
+	}
+	if req.InvoiceType != "" {
+		dao = dao.Where("invoice_type = ?", req.InvoiceType)
+	}
+	if req.ApproStatus != "" {
+		dao = dao.Where("appro_status = ?", req.ApproStatus)
+	}
+	if req.InvoiceCode != "" {
+		dao = dao.Where("invoice_code = ?", req.InvoiceCode)
+	}
+	if req.CourierCode != "" {
+		dao = dao.Where("courier_code = ?", req.CourierCode)
+	}
+
+	if req.BeginTime != "" {
+		dao = dao.Where("created_time > ?", req.BeginTime)
+	}
+	if req.EndTime != "" {
+		dao = dao.Where("created_time < ?", req.EndTime)
+	}
+
+	total, err := dao.Count()
+	if err != nil {
+		return 0, nil, err
+	}
+	if req.PageNum != 0 {
+		dao = dao.Page(req.GetPage())
+	}
+	orderby := "created_time desc"
+	if req.OrderBy != "" {
+		orderby = req.OrderBy
+	}
+	dao = dao.Order(orderby)
+
+	ents := []*model.CtrContractInvoice{}
+	err = dao.Structs(&ents)
+	if err != nil && err != sql.ErrNoRows {
+		return 0, nil, err
+	}
+	return total, ents, err
+}
+
+func (s CtrContractInvoiceService) Add(ctx context.Context, req *model.CtrContractInvoiceAddReq) (int, error) {
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return 0, myerrors.NewMsgError(nil, validErr.Current().Error())
+	}
+
+	c, err := s.ContractDao.Where("id = ?", req.ContractId).One()
+	if err != nil {
+		return 0, err
+	}
+	if c == nil {
+		return 0, myerrors.NewMsgError(nil, fmt.Sprintf("合同:%d 不存在", req.ContractId))
+	}
+
+	if req.InvoiceCode != "" {
+		ent, err := s.Dao.Where("invoice_code = ?", req.InvoiceCode).One()
+		if err != nil {
+			return 0, err
+		}
+		if ent != nil {
+			return 0, myerrors.NewMsgError(nil, fmt.Sprintf("发票号码:%s 已存在", req.InvoiceCode))
+		}
+	}
+	if req.CourierCode != "" {
+		ent, err := s.Dao.Where("courier_code = ?", req.CourierCode).One()
+		if err != nil {
+			return 0, err
+		}
+		if ent != nil {
+			return 0, myerrors.NewMsgError(nil, fmt.Sprintf("快递单号:%s 已存在", req.CourierCode))
+		}
+	}
+
+	ent := model.CtrContractInvoice{
+		CustId:            c.CustId,
+		CustName:          c.CustName,
+		ContractId:        req.ContractId,
+		ContractCode:      c.ContractCode,
+		ContractAmount:    c.ContractAmount,
+		InvoiceAmount:     req.InvoiceAmount,
+		InvoiceDate:       req.InvoiceDate,
+		InvoiceType:       req.InvoiceType,
+		ApproStatus:       "10",
+		InvoiceCode:       req.InvoiceCode,
+		ActualInvoiceDate: req.ActualInvoiceDate,
+		CourierCode:       req.CourierCode,
+		Remark:            req.Remark,
+		CreatedBy:         int(s.userInfo.Id),
+		CreatedName:       s.userInfo.NickName,
+		CreatedTime:       gtime.Now(),
+		UpdatedBy:         int(s.userInfo.Id),
+		UpdatedName:       s.userInfo.NickName,
+		UpdatedTime:       gtime.Now(),
+		DeletedTime:       gtime.Now(),
+	}
+	var id int
+	txerr := s.Dao.DB.Transaction(ctx, func(ctx context.Context, tx *gdb.TX) error {
+		invoiceId, err := tx.InsertAndGetId("ctr_contract_invoice", ent)
+		if err != nil {
+			return err
+		}
+		err = s.ctrSrv.AddDynamicsByCurrentUser(tx, req.ContractId, "创建发票", map[string]interface{}{
+			"id":                invoiceId,
+			"invoiceAmount":     req.InvoiceAmount,
+			"invoiceDate":       req.InvoiceDate,
+			"invoiceType":       req.InvoiceType,
+			"invoiceCode":       req.InvoiceCode,
+			"actualInvoiceDate": req.ActualInvoiceDate,
+			"courierCode":       req.CourierCode,
+		})
+		if err != nil {
+			return err
+		}
+		id = int(invoiceId)
+		return nil
+	})
+	return id, txerr
+}
+
+func (s CtrContractInvoiceService) Update(ctx context.Context, req *model.CtrContractInvoiceUpdateReq) error {
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return myerrors.NewMsgError(nil, validErr.Current().Error())
+	}
+
+	ent, err := s.Dao.Where("id = ?", req.Id).One()
+	if err != nil {
+		return err
+	}
+	if ent == nil {
+		return myerrors.NewMsgError(nil, fmt.Sprintf("发票不存在: %d", req.Id))
+	}
+
+	if req.InvoiceCode != "" {
+		exist, err := s.Dao.Where("invoice_code = ?", req.InvoiceCode).One()
+		if err != nil {
+			return err
+		}
+		if exist != nil && exist.Id != req.Id {
+			return myerrors.NewMsgError(nil, fmt.Sprintf("发票号码: %s 已存在", req.InvoiceCode))
+		}
+	}
+	if req.CourierCode != "" {
+		exist, err := s.Dao.Where("courier_code = ?", req.CourierCode).One()
+		if err != nil {
+			return err
+		}
+		if exist != nil && exist.Id != req.Id {
+			return myerrors.NewMsgError(nil, fmt.Sprintf("快递单号: %s 已存在", req.CourierCode))
+		}
+	}
+
+	toupdate := map[string]interface{}{}
+	// if req.CustId != 0 {
+	// 	toupdate["cust_id"] = req.CustId
+	// }
+	// if req.CustName != 0 {
+	// 	toupdate["cust_name"] = req.CustName
+	// }
+	// if req.ContractId != 0 {
+	// 	toupdate["contract_id"] = req.ContractId
+	// }
+	// if req.ContractCode != 0 {
+	// 	toupdate["contract_code"] = req.ContractCode
+	// }
+	// if req.ContractAmount != 0 {
+	// 	toupdate["contract_amount"] = req.ContractAmount
+	// }
+	if req.InvoiceAmount != nil {
+		toupdate["invoice_amount"] = *req.InvoiceAmount
+	}
+	if req.InvoiceDate != nil {
+		toupdate["invoice_date"] = req.InvoiceDate
+	}
+	if req.InvoiceType != "" {
+		toupdate["invoice_type"] = req.InvoiceType
+	}
+	if req.ApproStatus != "" {
+		toupdate["appro_status"] = req.ApproStatus
+	}
+	if req.InvoiceCode != "" {
+		toupdate["invoice_code"] = req.InvoiceCode
+	}
+	if req.ActualInvoiceDate != nil {
+		toupdate["actual_invoice_date"] = req.ActualInvoiceDate
+	}
+	if req.CourierCode != "" {
+		toupdate["courier_code"] = req.CourierCode
+	}
+	if req.Remark != nil {
+		toupdate["remark"] = *req.Remark
+	}
+	if len(toupdate) != 0 {
+		toupdate["updated_by"] = int(s.userInfo.Id)
+		toupdate["updated_name"] = s.userInfo.NickName
+		toupdate["updated_time"] = gtime.Now()
+
+		txerr := s.Dao.DB.Transaction(ctx, func(ctx context.Context, tx *gdb.TX) error {
+			_, err = tx.Update("ctr_contract_invoice", toupdate, "id= ?", req.Id)
+			if err != nil {
+				return err
+			}
+			if req.InvoiceAmount != nil || req.ApproStatus != "" {
+				err = s.ctrSrv.UpdateInvoiceAmount(tx, ent.ContractId)
+				if err != nil {
+					return err
+				}
+			}
+			return nil
+		})
+		if txerr != nil {
+			return txerr
+		}
+	}
+	return nil
+}
+
+func (s CtrContractInvoiceService) Delete(ctx context.Context, id []int) error {
+	if len(id) == 0 {
+		return nil
+	}
+	return s.Dao.DB.Transaction(ctx, func(ctx context.Context, tx *gdb.TX) error {
+		contractId := map[int]bool{}
+		for _, i := range id {
+			ent := model.CtrContractInvoice{}
+			err := tx.GetStruct(&ent, "select * from ctr_contract_invoice where id = ?", i)
+			if err == sql.ErrNoRows {
+				continue
+			}
+			if err != nil {
+				return err
+			}
+			if ent.ApproStatus != "20" {
+				continue
+			}
+			contractId[ent.ContractId] = true
+		}
+
+		_, err := tx.Delete("ctr_contract_invoice", "id in (?)", id)
+		if err != nil {
+			return err
+		}
+		for cid := range contractId {
+			err = s.ctrSrv.UpdateInvoiceAmount(tx, cid)
+			if err != nil {
+				return err
+			}
+		}
+		return nil
+	})
+}

+ 0 - 212
opms_parent/app/service/contract/ctr_contract_invoice.go.bak

@@ -1,212 +0,0 @@
-package service
-
-import (
-	"context"
-	dao "dashoo.cn/micro/app/dao/contract"
-	model "dashoo.cn/micro/app/model/contract"
-	"database/sql"
-	"fmt"
-
-	"dashoo.cn/opms_libary/micro_srv"
-	"dashoo.cn/opms_libary/myerrors"
-	"dashoo.cn/opms_libary/request"
-	"github.com/gogf/gf/os/gtime"
-	"github.com/gogf/gf/util/gvalid"
-)
-
-type CtrContractInvoiceService struct {
-	Dao      *dao.CtrContractInvoiceDao
-	Tenant   string
-	userInfo request.UserInfo
-}
-
-func NewCtrContractInvoiceService(ctx context.Context) (*CtrContractInvoiceService, error) {
-	tenant, err := micro_srv.GetTenant(ctx)
-	if err != nil {
-		return nil, fmt.Errorf("获取组合码异常:%s", err.Error())
-	}
-	// 获取用户信息
-	userInfo, err := micro_srv.GetUserInfo(ctx)
-	if err != nil {
-		return nil, fmt.Errorf("获取用户信息异常:%s", err.Error())
-	}
-	return &CtrContractInvoiceService{
-		Dao:      dao.NewCtrContractInvoiceDao(tenant),
-		Tenant:   tenant,
-		userInfo: userInfo,
-	}, nil
-}
-
-func (s CtrContractInvoiceService) List(ctx context.Context, req *model.CtrContractInvoiceListReq) (int, []*model.CtrContractInvoice, error) {
-	dao := &s.Dao.CtrContractInvoiceDao
-	if req.SearchText != "" {
-		likestr := fmt.Sprintf("%%%s%%", req.SearchText)
-		dao = dao.Where("(doc_code LIKE ? || doc_name LIKE ?)", likestr, likestr)
-	}
-	if req.DocType != "" {
-		dao = dao.Where("doc_type = ?", req.DocType)
-	}
-
-	total, err := dao.Count()
-	if err != nil {
-		return 0, nil, err
-	}
-
-	if req.Page != nil {
-		if req.Page.Current == 0 {
-			req.Page.Current = 1
-		}
-		if req.Page.Size == 0 {
-			req.Page.Size = 10
-		}
-		dao = dao.Page(req.Page.Current, req.Page.Size)
-	}
-	if req.OrderBy == nil {
-		req.OrderBy = &model.OrderBy{}
-	}
-	if req.OrderBy.Value == "" {
-		req.OrderBy.Value = "created_time"
-		req.OrderBy.Type = "desc"
-	}
-	if req.OrderBy != nil && req.OrderBy.Value != "" {
-		order := "asc"
-		if req.OrderBy.Type == "desc" {
-			order = "desc"
-		}
-		dao = dao.Order(req.OrderBy.Value, order)
-	}
-
-	ents := []*model.CtrContractInvoice{}
-	err = dao.Structs(&ents)
-	if err != nil && err != sql.ErrNoRows {
-		return 0, nil, err
-	}
-	return total, ents, err
-}
-
-func (s CtrContractInvoiceService) Add(ctx context.Context, req *model.CtrContractInvoiceAddReq) (int, error) {
-	validErr := gvalid.CheckStruct(ctx, req, nil)
-	if validErr != nil {
-		return 0, myerrors.NewMsgError(nil, validErr.Current().Error())
-	}
-
-	t, err := s.Dao.Where("doc_code = ?", req.DocCode).One()
-	if err != nil {
-		return 0, err
-	}
-	if t != nil {
-		return 0, myerrors.NewMsgError(nil, fmt.Sprintf("文档编码:%s 已存在", req.DocCode))
-	}
-
-	id, err := s.Dao.InsertAndGetId(model.CtrContractInvoice{
-		CustId:            req.CustId,
-		CustName:          req.CustName,
-		ContractId:        req.ContractId,
-		ContractCode:      req.ContractCode,
-		ContractAmount:    req.ContractAmount,
-		InvoiceAmount:     req.InvoiceAmount,
-		InvoiceDate:       req.InvoiceDate,
-		InvoiceType:       req.InvoiceType,
-		ApproStatus:       req.ApproStatus,
-		InvoiceCode:       req.InvoiceCode,
-		ActualInvoiceDate: req.ActualInvoiceDate,
-		CourierCode:       req.CourierCode,
-		Remark:            req.Remark,
-		CreatedBy:         int(s.userInfo.Id),
-		CreatedName:       s.userInfo.NickName,
-		CreatedTime:       gtime.Now(),
-		UpdatedBy:         int(s.userInfo.Id),
-		UpdatedName:       s.userInfo.NickName,
-		UpdatedTime:       gtime.Now(),
-		DeletedTime:       gtime.Now(),
-	})
-	if err != nil {
-		return 0, err
-	}
-	return int(id), err
-}
-
-func (s CtrContractInvoiceService) Update(ctx context.Context, req *model.CtrContractInvoiceUpdateReq) error {
-	validErr := gvalid.CheckStruct(ctx, req, nil)
-	if validErr != nil {
-		return myerrors.NewMsgError(nil, validErr.Current().Error())
-	}
-
-	ent, err := s.Dao.Where("id = ?", req.Id).One()
-	if err != nil {
-		return err
-	}
-	if ent == nil {
-		return myerrors.NewMsgError(nil, fmt.Sprintf("文档不存在: %d", req.Id))
-	}
-
-	if req.DocCode != "" {
-		exist, err := s.Dao.Where("doc_code = ?", req.DocCode).One()
-		if err != nil {
-			return err
-		}
-		if exist != nil && exist.Id != req.Id {
-			return myerrors.NewMsgError(nil, fmt.Sprintf("文档编码: %s 已存在", req.DocCode))
-		}
-	}
-
-	dao := &s.Dao.CtrContractInvoiceDao
-	toupdate := map[string]interface{}{}
-	if req.CustId != 0 {
-		toupdate["cust_id"] = req.CustId
-	}
-	if req.CustName != 0 {
-		toupdate["cust_name"] = req.CustName
-	}
-	if req.ContractId != 0 {
-		toupdate["contract_id"] = req.ContractId
-	}
-	if req.ContractCode != 0 {
-		toupdate["contract_code"] = req.ContractCode
-	}
-	if req.ContractAmount != 0 {
-		toupdate["contract_amount"] = req.ContractAmount
-	}
-	if req.InvoiceAmount != 0 {
-		toupdate["invoice_amount"] = req.InvoiceAmount
-	}
-	if req.InvoiceDate != 0 {
-		toupdate["invoice_date"] = req.InvoiceDate
-	}
-	if req.InvoiceType != 0 {
-		toupdate["invoice_type"] = req.InvoiceType
-	}
-	if req.ApproStatus != 0 {
-		toupdate["appro_status"] = req.ApproStatus
-	}
-	if req.InvoiceCode != 0 {
-		toupdate["invoice_code"] = req.InvoiceCode
-	}
-	if req.ActualInvoiceDate != 0 {
-		toupdate["actual_invoice_date"] = req.ActualInvoiceDate
-	}
-	if req.CourierCode != 0 {
-		toupdate["courier_code"] = req.CourierCode
-	}
-	if req.Remark != nil {
-		toupdate["remark"] = *req.Remark
-	}
-	if len(toupdate) != 0 {
-		toupdate["updated_by"] = int(s.userInfo.Id)
-		toupdate["updated_name"] = s.userInfo.NickName
-		toupdate["updated_time"] = gtime.Now()
-		_, err = dao.Where("Id", req.Id).Data(toupdate).Update()
-		if err != nil {
-			return err
-		}
-	}
-	return nil
-}
-
-func (s CtrContractInvoiceService) Delete(ctx context.Context, id []int) error {
-	if len(id) == 0 {
-		return nil
-	}
-	_, err := s.Dao.Where("Id  IN (?)", id).Delete()
-	return err
-}

+ 289 - 274
opms_parent/app/service/cust/cust_customer.go

@@ -5,8 +5,8 @@ import (
 	"context"
 	"math"
 	"strconv"
-	"time"
 
+	"dashoo.cn/opms_libary/myerrors"
 	"github.com/360EntSecGroup-Skylar/excelize"
 	"github.com/gogf/gf/errors/gerror"
 	"github.com/gogf/gf/frame/g"
@@ -57,139 +57,146 @@ func NewCustomerService(ctx context.Context) (svc *CustomerService, err error) {
 	return svc, nil
 }
 
-//导出数据
-func (c *CustomerService) Derive(req *model.CustCustomerExport) (content *model.CustExport, err error) {
-	var con model.CustExport
-	total, data, err := c.GetList(&req.CustCustomerSearchReq)
+//创建客户
+func (c *CustomerService) Create(req *model.CustomerAddSeq) (insertId int64, err error) {
+	cusTomer := new(model.CustCustomer)
+	count, err := c.Dao.Where(g.Map{"cust_name": req.CustName}).Count()
 	if err != nil {
+		err = myerrors.New("Sql执行异常", err)
 		return
 	}
-	f := excelize.NewFile()
-	index := f.NewSheet("Sheet1")
-	for index, item := range req.Columns {
-		sheetPosition := service.Div(index+1) + "1"
-		f.SetCellValue("Sheet1", sheetPosition, item)
-	}
-	if total > 0 {
-
-		for ck, item := range data {
-			for index, v := range req.Columns {
-				// "CustCode":客户编码
-				if v == "客户编码" {
-					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustCode)
-				}
-				if v == "客户名称" {
-					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustName)
-				}
-				if v == "助记名" {
-					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.AbbrName)
-				}
-				if v == "助记名" {
-					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.AbbrName)
-				}
-				if v == "所在地区" {
-					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustLocation)
-				}
-				if v == "客户行业" {
-					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustIndustry)
-				}
-				if v == "客户级别" {
-					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustLevel)
-				}
-				if v == "客户状态" {
-					var CustStatus string
-					CustStatus = "正常"
-					if item.CustStatus != "10" {
-						CustStatus = "异常"
-					}
-					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), CustStatus)
-				}
-				if v == "最后跟进时间" {
-					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.FollowUpDate)
-				}
-				if v == "创建时间" {
-					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CreatedTime)
-				}
-			}
-
-		}
-
-	}
-	f.SetActiveSheet(index)
-
-	var buffer *bytes.Buffer
-	buffer, _ = f.WriteToBuffer()
-	con.Content = buffer.Bytes()
-
-	return &con, err
-}
-
-//创建客户
-func (c *CustomerService) Create(req *model.Customer) (insertId int64, err error) {
-	cusTomer := new(model.CustCustomer)
-	g.Log().Info(err)
-	Model := c.Dao.M
-	record, err := Model.Where(g.Map{"cust_name": req.CustName}).One()
-	g.Log().Info("recordE", record.IsEmpty())
-	if err != nil || !record.IsEmpty() {
-		err = gerror.New("该客户信息已存在,不可重复添加")
+	if count > 0 {
+		err = myerrors.NewMsgError(nil, "该客户信息已存在,不可重复添加")
 		return
 	}
-	g.Log().Info("recordreq----", req.CustSource)
+
 	if err = gconv.Struct(req, cusTomer); err != nil {
 		return
 	}
 	service.SetCreatedInfo(cusTomer, c.GetCxtUserId(), c.GetCxtUserName())
-	cusTomer.CustCode = strconv.Itoa(int(gtime.Timestamp()))
+	cusTomer.CustCode = "CT" + strconv.Itoa(int(gtime.Timestamp()))
 	cusTomer.CustStatus = "10"
-	Roles := c.GetCxtUserRoles()
-	roles := false
-	for _, v := range Roles {
+
+	roles := c.GetCxtUserRoles()
+	isSales := false
+	for _, v := range roles {
 		if v == "Sales" { // 销售角色
-			roles = true
+			isSales = true
 		}
 	}
 	// 销售角色
-	if roles {
+	if isSales {
 		cusTomer.IsPublic = noPublic
 		cusTomer.SalesId = c.GetCxtUserId()
 		cusTomer.SalesName = c.GetCxtUserName()
-		lastId, err := Model.InsertAndGetId(cusTomer)
-		if err != nil && lastId > 0 {
-			belongData := new(model.CustCustomerBelong)
-			service.SetCreatedInfo(belongData, c.GetCxtUserId(), c.GetCxtUserName())
-			belongData.CustId = int(lastId)
-			belongData.SaleName = c.GetCxtUserName()
-			belongData.OpnType = AllocaTion
-			belongData.OpnPeople = c.GetCxtUserName()
-			belongData.OpnDatetime = gtime.Now()
-			_, err := c.BelongDao.InsertAndGetId(belongData)
+		insertId, err = c.Dao.InsertAndGetId(cusTomer)
+		if err != nil {
+			return
+		}
+		c.CreateContact(int(insertId))
+
+	} else {
+		cusTomer.IsPublic = isPublic
+		insertId, err = c.Dao.InsertAndGetId(cusTomer)
+		if err != nil {
+			err = gerror.New("创建失败")
+			return
+		}
+	}
+	return
+}
+func (c *CustomerService) CreateContact(cust_id int) (err error) {
+
+	belongData := new(model.CustCustomerBelong)
+	service.SetCreatedInfo(belongData, c.GetCxtUserId(), c.GetCxtUserName())
+	belongData.CustId = cust_id
+	belongData.SaleName = c.GetCxtUserName()
+	belongData.OpnType = AllocaTion
+	belongData.OpnPeople = c.GetCxtUserName()
+	belongData.OpnDatetime = gtime.Now()
+	_, err = c.BelongDao.InsertAndGetId(belongData)
+	if err != nil {
+
+		return
+	}
+	return
+}
+
+//删除客户
+func (c *CustomerService) DeleteById(id int) error {
+	Model := c.Dao
+	ContactModel := c.ContactDao //联系人
+	BelongModel := c.BelongDao
+	//regionDetail := new(model.CustCustomer)
+	customerCount, err := Model.Where(c.Dao.Columns.Id, id).Count()
+	if err != nil {
+		return myerrors.New(" 删除客户 DeleteById Sql执行异常", err)
+	}
+	if customerCount == 0 {
+		err = myerrors.NewMsgError(nil, "客户信息不存在")
+		return err
+	}
+
+	//删除客户表
+	_, err = Model.Where(c.Dao.Columns.Id, id).Delete()
+	if err == nil {
+		_, err = ContactModel.Where(c.ContactDao.Columns.CustId, id).Delete()
+		if err == nil {
+			_, err = BelongModel.Where(c.BelongDao.Columns.CustId, id).Delete()
 			if err != nil {
-				g.Log().Error(err)
-				err = gerror.New("创建失败")
+				return myerrors.New(" 删除客户 BelongModel Sql执行异常", err)
 
 			}
+		} else {
+			return myerrors.New(" 删除客户 ContactModel Sql执行异常", err)
+
 		}
+	} else {
 
+		return myerrors.New(" 删除客户 ColumnsModel Sql执行异常", err)
 	}
-	cusTomer.IsPublic = isPublic
+	return nil
+}
 
-	res, err := Model.Insert(cusTomer)
+//修改客户
+func (c *CustomerService) UpdateById(req *model.UpdateCustomer) (err error) {
+	db := c.Dao.M
+	count, err := db.Where(c.Dao.Columns.Id, req.Id).Count()
 	if err != nil {
-		g.Log().Error(err)
-		err = gerror.New("创建失败")
+		err = myerrors.New(" UpdateById Sql执行异常", err)
+		return
+	}
+	if count == 0 {
+		err = myerrors.NewMsgError(nil, "用户信息不存在")
+		return
+	}
+	countNums, err := db.Where(c.Dao.Columns.CustName+" = ", req.CustName).Where(c.Dao.Columns.Id+" not in (?)", req.Id).Count()
+	if err != nil {
+		err = myerrors.New("  Sql执行异常", err)
+		return
+	}
+	if countNums > 0 {
+		err = myerrors.NewMsgError(nil, "客户名称已存在")
+		return
+	}
+
+	CustomertData := new(model.CustomerAddSeq)
+	if err = gconv.Struct(req, CustomertData); err != nil {
+		return
+	}
+	service.SetUpdatedInfo(CustomertData, c.GetCxtUserId(), c.GetCxtUserName())
+	_, err = db.FieldsEx(c.Dao.Columns.CreatedTime, c.Dao.Columns.CreatedBy, c.Dao.Columns.CreatedName, c.Dao.Columns.Id, c.Dao.Columns.CustCode, c.Dao.Columns.SalesName, c.Dao.Columns.SalesId).
+		WherePri(c.Dao.Columns.Id, req.Id).Update(CustomertData)
+	if err != nil {
+		err = myerrors.New("修改用户信息失败", err)
 		return
 	}
-	insertId, _ = res.LastInsertId()
 	return
 }
 
 //客户列表列表
 func (c *CustomerService) GetList(req *model.CustCustomerSearchReq) (total int, customerList []*model.CustList, err error) {
-
-	g.Log().Info("serverS", req)
 	Model := c.Dao.M
-	//Model = Model.Where(c.Dao.Columns.DeletedTime + " is null")
 	if req.TargetType == "" {
 		if !req.IsPublic {
 
@@ -213,7 +220,7 @@ func (c *CustomerService) GetList(req *model.CustCustomerSearchReq) (total int,
 	}
 	//客户级别
 	if req.CustLevel != "" {
-		g.Log().Info("level", req.CustLevel)
+
 		Model = Model.Where(c.Dao.Columns.CustLevel, req.CustLevel)
 	}
 	//
@@ -222,15 +229,16 @@ func (c *CustomerService) GetList(req *model.CustCustomerSearchReq) (total int,
 	}
 	total, err = Model.Count()
 	if err != nil {
-		g.Log().Error(err)
-		err = gerror.New("获取总行数失败")
+		err = myerrors.New("获取总行数失败", err)
+
 		return
 	}
-	if req.PageNum == 0 {
-		req.PageNum = 1
-	}
 
 	err = Model.Page(req.GetPage()).Order("id desc").Scan(&customerList)
+	if err != nil {
+		err = myerrors.New("获取列表失败", err)
+		return
+	}
 	for _, v := range customerList {
 		times := gconv.String(v.CreatedTime)
 		v.FollowUpDate = gstr.SubStr(v.FollowUpDate, 0, 16)
@@ -239,76 +247,20 @@ func (c *CustomerService) GetList(req *model.CustCustomerSearchReq) (total int,
 	return
 }
 
-//删除客户
-func (c *CustomerService) DeleteById(id int) error {
+//移入公海
+func (c *CustomerService) MoveToPubic(ids []int64) (err error) {
 	Model := c.Dao
-	ContactModel := c.ContactDao //联系人
-	BelongModel := c.BelongDao
-	regionDetail := new(model.CustCustomer)
-	err := Model.Where(c.Dao.Columns.Id, id).Scan(&regionDetail)
-	//g.Log().Info("DeleteByIds", one)
+	columnsCount, err := Model.Fields(c.Dao.Columns.CreatedTime).Where(c.Dao.Columns.Id+" in (?) ", ids).Count()
 	if err != nil {
-		g.Log().Error(err)
-		err = gerror.New("没有要删除的数据")
-		return err
-	}
 
-	//删除客户表
-	_, err = Model.Where(c.Dao.Columns.Id, id).Delete()
-	if err == nil {
-		_, err = ContactModel.Where(c.ContactDao.Columns.CustId, id).Delete()
-		if err == nil {
-			_, err = BelongModel.Where(c.BelongDao.Columns.CustId, id).Delete()
-			if err != nil {
-				err = gerror.New("删除数据失败")
-				return err
-			}
-		} else {
-			err = gerror.New("删除数据失败")
-			return err
-		}
-	} else {
-		g.Log().Error(err)
-		err = gerror.New("删除数据失败")
-		return err
-	}
-	return nil
-}
-
-//修改客户
-func (c *CustomerService) UpdateById(req *model.UpdateCustomer) (err error) {
-	db := c.Dao.M
-	record, err := db.FindOne(c.Dao.Columns.Id, req.Id)
-	if err != nil || record.IsEmpty() {
-		err = gerror.New("该数据不存在")
-		return err
-	}
-	CustomertData := new(model.Customer)
-	if err = gconv.Struct(req, CustomertData); err != nil {
+		err = myerrors.New("MoveToPubic Sql 执行异常", err)
 		return
 	}
-	service.SetUpdatedInfo(CustomertData, c.GetCxtUserId(), c.GetCxtUserName())
-	_, err = db.FieldsEx(c.Dao.Columns.CreatedTime, c.Dao.Columns.CreatedBy, c.Dao.Columns.CreatedName, c.Dao.Columns.Id, c.Dao.Columns.CustCode, c.Dao.Columns.SalesName, c.Dao.Columns.SalesId).
-		WherePri(c.Dao.Columns.Id, req.Id).Update(CustomertData)
-
-	if err != nil {
-		g.Log().Error(err)
-		err = gerror.New("修改用户信息失败")
+	if columnsCount == 0 {
+		err = myerrors.NewMsgError(nil, "没有要移除的数据")
 		return
 	}
-	return
-}
 
-//移入公海
-func (c *CustomerService) MoveToPubic(ids []int64) error {
-	Model := c.Dao.M
-	//Cust := new(model.CustCustomer)
-	list, err := Model.Fields(c.Dao.Columns.CreatedTime).Where(c.Dao.Columns.Id+" in (?) ", ids).All()
-	if err != nil || list.Len() <= 0 {
-		g.Log().Error(err)
-		err = gerror.New("没有要移除的数据")
-		return err
-	}
 	_, err = Model.Data(g.Map{
 		"is_public":    isPublic,
 		"sales_id":     0,
@@ -322,117 +274,107 @@ func (c *CustomerService) MoveToPubic(ids []int64) error {
 	}).Where(c.ContactDao.Columns.Id+" in (?)", ids).Update()
 
 	if err != nil {
-		g.Log().Error(err)
-		err = gerror.New("移入公海失败")
-		return err
+		err = myerrors.New("MoveToPubic updateSql 执行异常", err)
+		return
 	}
 	return nil
 }
 
 //分配客户
-func (c *CustomerService) DistriCustomer(req *model.DistriCustomer) error {
+func (c *CustomerService) DistriCustomer(req *model.DistriCustomer) (err error) {
 	custModel := c.Dao
-	rep, err := custModel.Where(cust.CustCustomer.Columns.Id+" in (?)  ", req.Ids).Where(cust.CustCustomer.Columns.IsPublic, isPublic).All()
-
-	g.Log().Info("fdasfsa", len(rep))
-	if err != nil || len(rep) == 0 {
-		err = gerror.New("该数据不存在")
-		return err
+	customerData, err := custModel.Where(cust.CustCustomer.Columns.Id+" in (?)  ", req.Ids).All()
+	if err != nil {
+		err = myerrors.New("DistriCustomer Sql执行异常", err)
+		return
+	}
+	if len(customerData) == 0 {
+		err = myerrors.NewMsgError(nil, "无可分配客户")
+		return
 	}
-	//cust := new(model.CustCustomer)
 	var custMap = make(map[int]string)
-	for _, v := range rep {
+	for _, v := range customerData {
 		custMap[v.Id] = v.SalesName
 	}
-	g.Log().Info("fadfadsfaf", custMap)
 	for _, v := range req.Ids {
 		g.Log().Info("req.Ids", v)
 		if custMap[gconv.Int(v)] != "" {
-			err = gerror.New("ID" + gconv.String(v) + "已被认领")
-			return err
+			err = myerrors.NewMsgError(nil, "ID"+gconv.String(v)+"已被认领")
+			return
 		}
 	}
-	err = c.updateCustomer(req.Ids, req.SalesId, req.SalesName)
-	if err != nil {
-		err = gerror.New("可配客户失败")
-		return err
-
-	}
+	c.updateCustomer(req.Ids, req.SalesId, req.SalesName)
+	//if err != nil {
+	//	err = myerrors.New("DistriCustomer update Sql执行异常", err)
+	//	return
+	//
+	//}
 	if req.Receive != "" {
 		req.Receive = Receive
 	} else {
 		req.Receive = AllocaTion
 	}
 
-	err = c.Createbelong(rep, req)
-	g.Log().Info("errr", req)
-
-	if err != nil {
-		err = gerror.New("分配客户失败")
-		return err
-	}
-	return nil
+	c.Createbelong(customerData, req)
+	return
 }
 
 //客户详情
 func (c *CustomerService) GetEntityById(ids []int64) (entityInfo []*model.CustList, err error) {
-	Model := c.Dao.M //
-	//FollowModel := c.FollowDao.M
-
+	Model := c.Dao //
 	err = Model.Where(cust.CustCustomer.Columns.Id+" in (?)", ids).Scan(&entityInfo)
+	if err != nil {
+		return nil, myerrors.New("获取用户数据失败", err)
+
+	}
 	for _, v := range entityInfo {
 		v.FollowUpDate = gstr.SubStr(v.FollowUpDate, 0, 16)
 		v.CreatedTime = gstr.SubStr(v.CreatedTime, 0, 16)
 	}
-	if err != nil {
-		g.Log().Error(err)
-		return nil, gerror.New("获取用户数据失败")
 
+	return
+}
+
+//获取客户名称
+func (c *CustomerService) GetCustNameIsExist(name string) (exist bool, err error) {
+	Model := c.Dao //
+	count, err := Model.Where(cust.CustCustomer.Columns.CustName, name).Count()
+	if err != nil {
+		err = myerrors.New("获取用户名称是否存在 GetCustName Sql执行异常", err)
+		return
+	}
+	exist = false
+	if count > 0 {
+		exist = true
 	}
+
 	return
 }
 
 //客户摘要
 func (c *CustomerService) CustAbstract(id int64) (followInfo *model.Follow, err error) {
-	custModel := c.Dao.M //
-	Model := c.FollowDao.M
-
+	custModel := c.Dao //
+	Model := c.FollowDao
 	count, err := Model.Where(c.FollowDao.Columns.CustId, id).Count()
-	g.Log().Info("count", count)
 	if err != nil {
-		g.Log().Error(err)
-		gerror.New("获取用户数据失败")
-		return
+		return nil, myerrors.New(" CustAbstract Sql执行异常", err)
 	}
-
 	followInfo = new(model.Follow)
 	followInfo.FollowCount = count
-	//
-	find, err := custModel.Fields(c.Dao.Columns.FollowUpDate).Where(c.Dao.Columns.Id, id).FindOne()
-	g.Log().Info("find", find)
-
+	followTime, err := custModel.Fields(c.Dao.Columns.FollowUpDate, c.Dao.Columns.CreatedTime).FindOne(id)
 	if err != nil {
-		g.Log().Error(err)
-		gerror.New("获取用户数据失败")
-		return
-	}
-
-	findOne := find.Map()
-	if findOne["follow_up_date"] == "" {
-		followInfo.NotFollowDay = 0
+		err = myerrors.New("CustAbstract Sql执行错误", err)
 		return
 	}
-	upDate := gconv.String(findOne["follow_up_date"])
-	follow_up, err1 := time.Parse(TIME_LAYOUT, upDate)
 	now := gtime.Now()
-	follow_next, err2 := time.Parse(TIME_LAYOUT, gconv.String(now))
-	if err1 != nil || err2 != nil {
-		followInfo.NotFollowDay = 0
-		return
+	var hours float64
+	if followTime.FollowUpDate == nil {
+		poor := now.Sub(gtime.New(followTime.CreatedTime))
+		hours = float64(poor.Hours() / 24)
+	} else {
+		poor := now.Sub(gtime.New(followTime.FollowUpDate))
+		hours = float64(poor.Hours() / 24)
 	}
-	poor := follow_next.Sub(follow_up)
-	g.Log().Info("xxxxfdsaf", follow_up)
-	hours := float64(poor.Hours() / 24)
 	if hours < 0 {
 		followInfo.NotFollowDay = 0
 	} else {
@@ -444,22 +386,22 @@ func (c *CustomerService) CustAbstract(id int64) (followInfo *model.Follow, err
 //转移客户
 func (c *CustomerService) UpdateBytransfer(req *model.DistriCustomer) (err error) {
 	custModel := c.Dao
-	rep, err := custModel.Fields("sales_id,sales_name,id").Where(cust.CustCustomer.Columns.Id+" in (?)", req.Ids).All()
-	if err != nil || len(rep) == 0 {
-		err = gerror.New("该数据不存在")
+	data, err := custModel.Fields("sales_id,sales_name,id").Where(cust.CustCustomer.Columns.Id+" in (?)", req.Ids).All()
+	if err != nil {
+		err = myerrors.New("Sql执行异常", err)
+		return err
+	}
+
+	if len(data) == 0 {
+		err = myerrors.New("该数据不存在", err)
 		return
 	}
 	err = c.updateCustomer(req.Ids, req.SalesId, req.SalesName)
 	if err != nil {
-		err = gerror.New("转移客户失败")
 		return
 	}
-
-	err = c.Createbelong(rep, req)
-
-	g.Log().Info("err", err)
+	err = c.Createbelong(data, req)
 	if err != nil {
-		err = gerror.New("转移客户失败")
 		return
 	}
 	return
@@ -479,8 +421,7 @@ func (c *CustomerService) updateCustomer(ids []int64, salesId int64, salesName s
 	}).Where(cust.CustCustomer.Columns.Id+" in (?)", ids).Update()
 
 	if err != nil {
-		g.Log().Error(err)
-		err = gerror.New("变更失败")
+		err = myerrors.New("updateCustomer 变更Sql执行失败", err)
 		return err
 	}
 	return nil
@@ -488,10 +429,9 @@ func (c *CustomerService) updateCustomer(ids []int64, salesId int64, salesName s
 
 //客户操作日志
 func (c *CustomerService) OperationLog(ctx context.Context, ids []int64, req *model.AddCustomerDynameicsReq) (err error) {
-	g.Log("fdasfsa", gconv.String(ctx))
 	cusDynameics := new(model.CustCustomerDynamics)
 	if err = gconv.Struct(req, cusDynameics); err != nil {
-		g.Log().Info("error", err)
+		err = myerrors.NewMsgError(nil, "操作日志验证结构体失败")
 		return
 	}
 	Model := c.DynamicsDao.M
@@ -513,10 +453,13 @@ func (c *CustomerService) OperationLog(ctx context.Context, ids []int64, req *mo
 		contact["opn_content"] = req.OpnContent
 		maps = append(maps, contact)
 	}
-	_, err = Model.Insert(maps)
+	lastId, err := Model.InsertAndGetId(maps)
 	if err != nil {
-		g.Log().Error(err)
-		err = gerror.New("创建失败")
+		err = myerrors.New("OperationLog Sql执行失败", err)
+		return
+	}
+	if lastId == 0 {
+		err = myerrors.New("客户操作日志失败", err)
 		return
 	}
 	return
@@ -524,11 +467,10 @@ func (c *CustomerService) OperationLog(ctx context.Context, ids []int64, req *mo
 
 //客户动态
 func (c *CustomerService) DynamicsList(req *model.CustomerDynameicsReq) (total int, result []interface{}, err error) {
-	Model := c.DynamicsDao.M
-	total, err = Model.Fields().Count()
+	Model := c.DynamicsDao
+	total, err = Model.Where("cust_id = ", req.CustId).Count()
 	if err != nil {
-		g.Log().Error(err)
-		err = gerror.New("获取总行数失败")
+		err = myerrors.New("DynamicsList Sql执行异常", err)
 		return
 	}
 	//if req.PageNum == 0 {
@@ -549,10 +491,7 @@ func (c *CustomerService) DynamicsList(req *model.CustomerDynameicsReq) (total i
 		})
 
 	}
-
-	g.Log().Info("DynamicsList----", dynamicsList)
 	result = append(result, dynamicsList)
-	g.Log().Info("Dy---", result)
 	return
 }
 
@@ -562,18 +501,23 @@ func (c *CustomerService) Mergecustomer(req *model.MergecustomerRep) (err error)
 	//ContactModel := c.ContactDao.M
 	BelongDao := c.BelongDao
 	//当前目标客户是否存在
-	FindOne, err := Model.Where(c.Dao.Columns.DeletedTime+" is  null").Where(c.Dao.Columns.Id, req.Id).FindOne()
-	if err != nil || FindOne.IsEmpty() {
-		err = gerror.New("该数据不存在")
+	customerCount, err := Model.Where(c.Dao.Columns.Id, req.Id).Count()
+	if err != nil {
+		err = myerrors.New("Mergecustomer 合并客户 Sql执行异常", err)
+		return
+	}
+	if customerCount == 0 {
+		err = myerrors.NewMsgError(nil, "该客户不存在")
 		return
 	}
 	ContactModel := c.ContactDao
 	_, err = ContactModel.Where(c.ContactDao.Columns.CustId+" in (?)", req.ChooseId).WhereOr(c.ContactDao.Columns.CustId, req.Id).Delete()
 	if err != nil {
-		err = gerror.New("合并联系人失败")
+		err = myerrors.New("Mergecustomer 合并联系人 Sql执行异常", err)
 		return
+
 	}
-	CustomertData := new(model.Customer)
+	CustomertData := new(model.CustomerAddSeq)
 	if err = gconv.Struct(req, CustomertData); err != nil {
 		return
 	}
@@ -582,15 +526,19 @@ func (c *CustomerService) Mergecustomer(req *model.MergecustomerRep) (err error)
 		c.Dao.Columns.CreatedName, c.Dao.Columns.Id,
 		c.Dao.Columns.CustCode).WherePri(c.Dao.Columns.Id, req.Id).Update(CustomertData)
 	if err != nil {
-		err = gerror.New("合并失败")
+		err = myerrors.New("Mergecustomer 合并客户 update Sql执行异常", err)
 		return
 	}
 	//删除被合并的客户信息
-	Model.Where(c.Dao.Columns.Id+" in (?)", req.ChooseId).Delete()
+	_, err = Model.Where(c.Dao.Columns.Id+" in (?)", req.ChooseId).Delete()
+	if err != nil {
+		err = myerrors.New("Mergecustomer 删除被合并的客户信息 Sql执行异常", err)
+		return
+	}
 	//删除 所选客户销售联系人
 	_, err = BelongDao.Where(c.BelongDao.Columns.CustId+" in (?)", req.ChooseId).WhereOr(c.BelongDao.Columns.CustId, req.Id).Delete()
 	if err != nil {
-		err = gerror.New("合并失败")
+		err = myerrors.New("Mergecustomer 删除所选客户销售联系人 Sql执行异常", err)
 		return
 	}
 
@@ -601,26 +549,22 @@ func (c *CustomerService) Mergecustomer(req *model.MergecustomerRep) (err error)
 	req.AddCustomerBelong.OpnPeople = c.GetCxtUserName()
 	req.AddCustomerBelong.OpnDatetime = gtime.Now()
 	req.AddCustomerBelong.SaleName = req.SalesName
-	err = belongService.Create(req.AddCustomerBelong)
-	if err != nil {
-		err = gerror.New("合并失败")
-		return
-	}
+	belongService.Create(req.AddCustomerBelong)
 	return
 }
 
 //联系人(合并)
 func (c *CustomerService) Createcontact(id int, Ids []int64, req *model.CustCustomerContactSeq) (err error) {
-	ContactModel := c.ContactDao.M
+	ContactModel := c.ContactDao
 	_, err = ContactModel.Where(c.ContactDao.Columns.CustId+" in (?)", Ids).WhereOr(c.ContactDao.Columns.CustId, id).Delete()
 	if err != nil {
-		err = gerror.New("合并联系人失败")
+		err = myerrors.New("Createcontact  合并删除联系人 Sql执行异常", err)
 		return
 	}
 	contactService := c.ContanctServer //new(CustomercontactService)
 	err = contactService.Create(req)
 	if err != nil {
-		err = gerror.New("合并联系人失败")
+		err = myerrors.New("Createcontact  合并删除并创建联系人 Sql执行异常", err)
 		return
 	}
 	return
@@ -646,11 +590,82 @@ func (c *CustomerService) Createbelong(rep []*model.CustCustomer, req *model.Dis
 		belong.CreatedBy = c.GetCxtUserId()
 		belongData = append(belongData, belong)
 	}
-	_, err = belongModel.Insert(belongData)
+	lastId, err := belongModel.InsertAndGetId(belongData)
 	g.Log().Info("belong", belongData)
 	if err != nil {
-		err = gerror.New("插入失败")
+		err = myerrors.New("Createbelong Sql执行异常", err)
+		return err
+	}
+	if lastId == 0 {
+		err = myerrors.New("Createbelong 插入", err)
 		return err
 	}
 	return
 }
+
+//导出数据
+func (c *CustomerService) Export(req *model.CustCustomerExport) (content *model.CustExport, err error) {
+	var con model.CustExport
+	total, data, err := c.GetList(&req.CustCustomerSearchReq)
+	if err != nil {
+		return
+	}
+	f := excelize.NewFile()
+	index := f.NewSheet("Sheet1")
+	for index, item := range req.Columns {
+		sheetPosition := service.Div(index+1) + "1"
+		f.SetCellValue("Sheet1", sheetPosition, item)
+	}
+	if total > 0 {
+
+		for ck, item := range data {
+			for index, v := range req.Columns {
+				// "CustCode":客户编码
+				if v == "客户编码" {
+					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustCode)
+				}
+				if v == "客户名称" {
+					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustName)
+				}
+				if v == "助记名" {
+					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.AbbrName)
+				}
+				if v == "助记名" {
+					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.AbbrName)
+				}
+				if v == "所在地区" {
+					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustLocation)
+				}
+				if v == "客户行业" {
+					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustIndustry)
+				}
+				if v == "客户级别" {
+					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustLevel)
+				}
+				if v == "客户状态" {
+					var CustStatus string
+					CustStatus = "正常"
+					if item.CustStatus != "10" {
+						CustStatus = "异常"
+					}
+					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), CustStatus)
+				}
+				if v == "最后跟进时间" {
+					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.FollowUpDate)
+				}
+				if v == "创建时间" {
+					f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CreatedTime)
+				}
+			}
+
+		}
+
+	}
+	f.SetActiveSheet(index)
+
+	var buffer *bytes.Buffer
+	buffer, _ = f.WriteToBuffer()
+	con.Content = buffer.Bytes()
+
+	return &con, err
+}

+ 20 - 24
opms_parent/app/service/cust/cust_customer_contact.go

@@ -2,10 +2,8 @@ package cust
 
 import (
 	"context"
-	"fmt"
 
-	"github.com/gogf/gf/errors/gerror"
-	"github.com/gogf/gf/frame/g"
+	"dashoo.cn/opms_libary/myerrors"
 	"github.com/gogf/gf/util/gconv"
 
 	"dashoo.cn/micro/app/dao/cust"
@@ -35,28 +33,30 @@ func NewCustomerContactService(ctx context.Context) (svc *CustomercontactService
 func (c *CustomercontactService) Create(req *model.CustCustomerContactSeq) (err error) {
 	contact := new(model.CustCustomerContact)
 	if err = gconv.Struct(req, contact); err != nil {
-		g.Log().Info("error", err)
+		err = myerrors.NewMsgError(nil, "添加联系人 验证失败")
 		return
 	}
 	service.SetCreatedInfo(contact, c.GetCxtUserId(), c.GetCxtUserName())
-	Model := c.Dao.M
-	res, err := Model.Insert(contact)
+	Model := c.Dao
+	_, err = Model.Insert(contact)
 	if err != nil {
+		err = myerrors.New("添加联系人,Create Sql执行异常", err)
 		return
 	}
-
-	InsertId, _ := res.LastInsertId()
-	fmt.Println(InsertId)
 	return
 }
 
 //修改联系人
 func (c *CustomercontactService) UpdateById(req *model.UpdateCustCustomerContactSeq) (err error) {
 	Model := c.Dao.M
-	record, err := Model.FindOne("Id", req.Id)
-	if err != nil || record.IsEmpty() {
-		err = gerror.New("该数据不存在")
-		return err
+	contactCount, err := Model.Count("Id", req.Id)
+	if err != nil {
+		err = myerrors.New("修改联系人,FindOne Sql执行异常", err)
+		return
+	}
+	if contactCount == 0 {
+		err = myerrors.NewMsgError(nil, "修改联系人信息不存在")
+		return
 	}
 	CustomertData := new(model.CustCustomerContact)
 	if err = gconv.Struct(req, CustomertData); err != nil {
@@ -67,8 +67,7 @@ func (c *CustomercontactService) UpdateById(req *model.UpdateCustCustomerContact
 		WherePri(c.Dao.Columns.Id, req.Id).Update(CustomertData)
 
 	if err != nil {
-		g.Log().Error(err)
-		err = gerror.New("修改用户信息失败")
+		err = myerrors.New("修改联系人,UpdateById Sql执行异常", err)
 		return
 	}
 	return
@@ -76,27 +75,24 @@ func (c *CustomercontactService) UpdateById(req *model.UpdateCustCustomerContact
 
 //获取联系人信息
 func (c *CustomercontactService) GetList(CustId int) (Info []*model.CustCustomerContactInfo, err error) {
-	Model := c.Dao.M
+	Model := c.Dao
 	err = Model.Where(c.Dao.Columns.CustId, CustId).Where(c.Dao.Columns.DeletedTime + " is null").Scan(&Info)
 	if err != nil {
-		g.Log().Error(err)
-		err = gerror.New("获取联系人信息失败")
+		err = myerrors.New("获取联系人信息,GetList Sql执行异常", err)
 		return
+
 	}
 	return
 }
 
 //删除联系人
 func (c *CustomercontactService) DeleteById(id int) error {
-	Model := c.Dao.M
-
-	//deleteTime := gtime.Now()
+	Model := c.Dao
 	// 删除客户联系人表
 	_, err := Model.Where(c.Dao.Columns.Id, id).Delete()
+
 	if err != nil {
-		g.Log().Error(err)
-		err = gerror.New("删除数据失败")
-		return err
+		return myerrors.New("删除联系人,DeleteById Sql执行异常", err)
 	}
 	return nil
 }

+ 2 - 3
opms_parent/app/service/plat/plat_followup.go

@@ -55,7 +55,7 @@ func (s *followupService) GetList(req *model.SearchPlatFollowupReq) (total int,
 		return
 	}
 
-	err = followupModel.Page(req.PageNum, req.PageSize).Order("follow_date DESC").Scan(&followupList)
+	err = followupModel.Page(req.GetPage()).Order("follow_date DESC").Scan(&followupList)
 	return
 }
 
@@ -70,8 +70,7 @@ func (s *followupService) Create(req *model.AddPlatFollowupReq) (err error) {
 	service.SetCreatedInfo(platFollowup, s.GetCxtUserId(), s.GetCxtUserName())
 	// 填充更新信息
 	//service.SetUpdatedInfo(platFollowup, s.GetCxtUserId(), s.GetCxtUserName())
-	Model := s.Dao.M
-	res, err := Model.Insert(platFollowup)
+	res, err := s.Dao.Insert(platFollowup)
 	if err != nil {
 		return
 	}

+ 1 - 2
opms_parent/app/service/plat/plat_followup_comment.go

@@ -56,8 +56,7 @@ func (s *followupCommentService) Create(req *model.AddPlatFollowupCommentReq) (e
 	service.SetCreatedInfo(platFollowupComment, s.GetCxtUserId(), s.GetCxtUserName())
 	// 填充更新信息
 	//service.SetUpdatedInfo(platFollowupComment, s.GetCxtUserId(), s.GetCxtUserName())
-	Model := s.Dao.M
-	_, err = Model.Insert(platFollowupComment)
+	_, err = s.Dao.Insert(platFollowupComment)
 	if err != nil {
 		return
 	}

+ 205 - 24
opms_parent/app/service/plat/plat_task.go

@@ -32,35 +32,44 @@ func NewTaskService(ctx context.Context) (svc *taskService, err error) {
 }
 
 // 任务信息列表
-func (s *taskService) GetList(req *model.SearchPlatTaskReq) (total int, TaskList []*model.PlatTask, err error) {
-	TaskModel := s.Dao.M
+func (s *taskService) GetList(req *model.SearchPlatTaskReq) (total int, TaskList []*model.PlatTaskEx, err error) {
+	TaskModel := s.Dao.InnerJoin("plat_task_handle", "plat_task_handle.task_id=plat_task.id")
 	if req.TaskTitle != "" {
-		TaskModel = TaskModel.Where("task_title LIKE ?", "%"+req.TaskTitle+"%")
+		TaskModel = TaskModel.Where("plat_task.task_title LIKE ?", "%"+req.TaskTitle+"%")
 	}
 	if req.TaskType != "" {
-		TaskModel = TaskModel.Where("task_type", req.TaskType)
+		TaskModel = TaskModel.Where("plat_task.task_type", req.TaskType)
 	}
 	if req.TaskStatus != "" {
-		TaskModel = TaskModel.Where("task_status", req.TaskStatus)
+		TaskModel = TaskModel.Where("plat_task.task_status", req.TaskStatus)
 	}
 	if req.IsOverdue != "" {
-		TaskModel = TaskModel.Where("is_overdue", req.IsOverdue)
+		TaskModel = TaskModel.Where("plat_task.is_overdue", req.IsOverdue)
 	}
 	if req.MainUserId != "" {
-		TaskModel = TaskModel.Where("main_user_id", req.MainUserId)
+		TaskModel = TaskModel.Where("plat_task.main_user_id", req.MainUserId)
 	}
 	if req.TargetId != "" {
-		TaskModel = TaskModel.Where("target_id", req.TargetId)
+		TaskModel = TaskModel.Where("plat_task.target_id", req.TargetId)
 	}
 	if req.TargetType != "" {
-		TaskModel = TaskModel.Where("target_type", req.TargetType)
+		TaskModel = TaskModel.Where("plat_task.target_type", req.TargetType)
 	}
 	if req.MySelf == "1" {
-		TaskModel = TaskModel.Where("created_by", s.GetCxtUserId())
+		TaskModel = TaskModel.Where("plat_task.created_by", s.GetCxtUserId())
 	}
 	if req.IsMain == "1" {
-		TaskModel = TaskModel.Where("main_user_id", s.GetCxtUserId())
+		TaskModel = TaskModel.Where("plat_task.main_user_id", s.GetCxtUserId())
 	}
+	if req.OperateType == "1" {
+		TaskModel = TaskModel.Where(fmt.Sprintf("plat_task_handle.task_status='10' AND (plat_task_handle.main_user_id=%v OR FIND_IN_SET(%v, plat_task_handle.owner_user_id))", s.GetCxtUserId(), s.GetCxtUserId()))
+	} else if req.OperateType == "2" {
+		TaskModel = TaskModel.Where("plat_task.created_by", s.GetCxtUserId())
+	} else if req.OperateType == "3" {
+		TaskModel = TaskModel.Where(fmt.Sprintf("plat_task_handle.task_status='20' AND plat_task_handle.handle_user_id=%v", s.GetCxtUserId()))
+	}
+	TaskModel.Group("plat_task.id")
+
 	total, err = TaskModel.Count()
 	if err != nil {
 		g.Log().Error(err)
@@ -68,7 +77,7 @@ func (s *taskService) GetList(req *model.SearchPlatTaskReq) (total int, TaskList
 		return
 	}
 
-	err = TaskModel.Page(req.PageNum, req.PageSize).Order("created_time DESC").Scan(&TaskList)
+	err = TaskModel.Page(req.GetPage()).Order("plat_task.created_time DESC").Fields("plat_task.*,plat_task_handle.step").Scan(&TaskList)
 	return
 }
 
@@ -172,17 +181,11 @@ func (s *taskService) Export(req *model.ExportReq) (content *model.ExportContent
 func (s *taskService) Statistics(req *model.SearchPlatTaskReq) (*model.TaskNumberCount, error) {
 	var result model.TaskNumberCount
 	// 统计数量
-	err := s.Dao.M.Fields(fmt.Sprintf("SUM(main_user_id='%v' AND task_status='10') ToDoNumber, SUM(main_user_id='%v' AND task_status='20') CompletedNumber, SUM(created_by='%v') CreateNumber", s.GetCxtUserId(), s.GetCxtUserId(), s.GetCxtUserId())).Scan(&result)
+	count, err := s.Dao.InnerJoin("plat_task_handle", "plat_task.Id=plat_task_handle.task_id").Where(fmt.Sprintf("plat_task_handle.task_status='10' AND (plat_task_handle.main_user_id=%v OR FIND_IN_SET(%v, plat_task_handle.owner_user_id))", s.GetCxtUserId(), s.GetCxtUserId())).Group("plat_task.Id").Count()
 	if err != nil {
-		if err == sql.ErrNoRows {
-			result.CompletedNumber = 0
-			result.CreateNumber = 0
-			result.ToDoNumber = 0
-			return &result, nil
-		} else {
-			return nil, err
-		}
+		return nil, err
 	}
+	result.ToDoNumber = count
 
 	return &result, nil
 }
@@ -201,13 +204,19 @@ func (s *taskService) Create(req *model.AddPlatTaskReq) (err error) {
 	service.SetCreatedInfo(platTask, s.GetCxtUserId(), s.GetCxtUserName())
 	// 填充更新信息
 	//service.SetUpdatedInfo(platTask, s.GetCxtUserId(), s.GetCxtUserName())
-	Model := s.Dao.M
-	res, err := Model.Insert(platTask)
+	res, err := s.Dao.Insert(platTask)
 	if err != nil {
 		return
 	}
-	// 流程日志
+	// 创建操作任务
 	id, _ := res.LastInsertId()
+	platTask.Id = int(id)
+	nextHandle := createNextTaskHandel(s, platTask, 10)
+	_, err = s.Dao.DB.Model("plat_task_handle").Insert(nextHandle)
+	if err != nil {
+		return
+	}
+	// 流程日志
 	err = CreateTaskLog(s, nil, int(id), s.GetCxtUserId(), s.GetCxtUserName(), "创建督办", "创建督办成功", "")
 
 	return
@@ -258,6 +267,154 @@ func (s *taskService) ChangeStatus(req *model.ChangeStatusReq) (err error) {
 	return
 }
 
+//步骤号(10接收  15暂存  20提交  30审批(督办人)  40评价(监办人))
+// 督办任务处理
+func (s *taskService) Handle(req *model.HandleReq) (err error) {
+	// 步骤号(10接收  15暂存  20提交  30审批(督办人)  40评价(监办人))
+	logNodeName := ""
+	logDesc := ""
+	var taskHandle model.PlatTaskHandle
+	err = s.Dao.DB.Model("plat_task_handle").Where(fmt.Sprintf("task_id='%v' AND step=%v AND task_status='10' AND (main_user_id=%v OR FIND_IN_SET(%v, owner_user_id))", req.Step, req.TaskId, s.GetCxtUserId(), s.GetCxtUserId())).Scan(&taskHandle)
+	if err != nil {
+		if err == sql.ErrNoRows {
+			return fmt.Errorf("数据不匹配,刷新数据重试")
+		}
+		return err
+	}
+	now := gtime.Now()
+	// 数据暂存,不做任何流程修改
+	if req.Step == 15 {
+		// 暂存
+		logNodeName = "暂存"
+		logDesc = s.GetCxtUserName() + "暂存进展信息"
+		// 1 标记删除旧的进展数据
+		_, err = s.Dao.DB.Model("plat_task_progress").Update(fmt.Sprintf("deleted_time='%v'", now.Format("Y-m-d H:i:s")), fmt.Sprintf("task_id='%v'", req.TaskId))
+		if err != nil {
+			return err
+		}
+		// 2 保存新的数据
+		_, err = s.Dao.DB.Model("plat_task_progress").Save(req.ProgressList)
+		if err != nil {
+			return err
+		}
+	} else {
+		var nextHandle = new (model.PlatTaskHandle)
+		task, err := s.Dao.Where("id", req.TaskId).FindOne()
+		if err != nil {
+			return err
+		}
+		// 构造更新数据
+		handleData := g.Map{
+			"task_status":      "20",
+			"handle_user_id":   s.GetCxtUserId(),
+			"handle_date":   	now.Format("Y-m-d H:i:s"),
+			"handle_status":    req.HandleStatus,
+			"handle_desc":      req.HandleDesc,
+			"updated_by":       s.GetCxtUserId(),
+			"updated_name":     s.GetCxtUserName(),
+			"updated_time":     now.Format("Y-m-d H:i:s"),
+		}
+		taskData := g.Map{
+			"updated_by":      s.GetCxtUserId(),
+			"updated_name":    s.GetCxtUserName(),
+			"updated_time":    now.Format("Y-m-d H:i:s"),
+		}
+		// 督办任务接收
+		if req.Step == 10 {
+			// 接收任务
+			taskData["task_status"] = "20"
+			taskData["receive_date"] = now.Format("Y-m-d H:i:s")
+			nextHandle = createNextTaskHandel(s, task, 20)
+			logNodeName = "接收"
+			logDesc = s.GetCxtUserName() + "接收督办任务"
+		} else if req.Step == 20 {
+			// 提交数据
+			nextHandle = createNextTaskHandel(s, task, 30)
+			logNodeName = "提交"
+			logDesc = s.GetCxtUserName() + "提交督办任务"
+			// 更新进展数据
+			for index, progress := range req.ProgressList {
+				// 填充创建信息
+				if progress.CreatedBy == 0 {
+					service.SetCreatedInfo(req.ProgressList[index], s.GetCxtUserId(), s.GetCxtUserName())
+				}
+				//	填充更新信息
+				service.SetUpdatedInfo(req.ProgressList[index], s.GetCxtUserId(), s.GetCxtUserName())
+			}
+			// 保存督办进展
+			// 1 标记删除旧的进展数据
+			_, err = s.Dao.DB.Model("plat_task_progress").Update(fmt.Sprintf("deleted_time='%v'", now.Format("Y-m-d H:i:s")), fmt.Sprintf("task_id='%v'", req.TaskId))
+			if err != nil {
+				return err
+			}
+			// 2 保存新的数据
+			_, err = s.Dao.DB.Model("plat_task_progress").Save(req.ProgressList)
+			if err != nil {
+				return err
+			}
+
+		} else if req.Step == 30 {
+			// 督办人审批
+			taskData["approver_id"] = s.GetCxtUserId()
+			taskData["appro_date"] = now.Format("Y-m-d H:i:s")
+			taskData["appro_status"] = req.HandleStatus
+			taskData["appro_desc"] = req.HandleDesc
+			logNodeName = "审批"
+			if req.HandleStatus == "审批通过" {
+				logDesc = s.GetCxtUserName() + "审批通过"
+				nextHandle = createNextTaskHandel(s, task, 40)
+			} else if req.HandleStatus == "审批退回" {
+				logDesc = s.GetCxtUserName() + "审批退回"
+				nextHandle = createNextTaskHandel(s, task, 20)
+			}
+		} else if req.Step == 40 {
+			// 监办人评价
+			taskData["evaluator_id"] = s.GetCxtUserId()
+			taskData["evaluate_date"] = now.Format("Y-m-d H:i:s")
+			taskData["evaluate_status"] = req.HandleStatus
+			taskData["evaluate_desc"] = req.HandleDesc
+			logNodeName = "评价"
+			if req.HandleStatus == "审批通过" {
+				// 监办人评价,审批通过,任务结束
+				logDesc = s.GetCxtUserName() + "审批通过"
+				nextHandle = nil
+				taskData["actual_close_date"] = now.Format("Y-m-d H:i:s")
+				taskData["task_status"] = "30"
+			} else if req.HandleStatus == "审批退回" {
+				logDesc = s.GetCxtUserName() + "审批通过"
+				nextHandle = createNextTaskHandel(s, task, 20)
+			}
+		}
+
+		// 更新数据
+		// 更新督办任务数据
+		_, err = s.Dao.Update(taskData, fmt.Sprintf("id='%v'", req.TaskId))
+		if err != nil {
+			return err
+		}
+		// 更新任务数据
+		_, err = s.Dao.DB.Model("plat_task_handle").Update(handleData, fmt.Sprintf("ID='%v'", taskHandle.ID))
+		if err != nil {
+			return err
+		}
+		// 创建下一条任务
+		if nextHandle != nil {
+			_, err = s.Dao.DB.Model("plat_task_handle").Save(nextHandle)
+			if err != nil {
+				return err
+			}
+		}
+	}
+
+	// 流程日志
+	err = CreateTaskLog(s, nil, req.TaskId, s.GetCxtUserId(), s.GetCxtUserName(), logNodeName, logDesc, "")
+	if err != nil {
+		return err
+	}
+
+	return fmt.Errorf("未知步骤,无法操作")
+}
+
 // 任务日志创建方法
 func CreateTaskLog(s1 *taskService, s2 *taskProgressService, taskId, userId int, userName, nodeName, desc, remark string) (err error) {
 	var log model.PlatTaskLog
@@ -301,3 +458,27 @@ func CreateTaskLog(s1 *taskService, s2 *taskProgressService, taskId, userId int,
 
 	return err
 }
+
+// 创建个人的督办任务(其中,暂存不会生成个人任务,不会改变任何东西,只会新增一条日志)
+func createNextTaskHandel(s *taskService, task *model.PlatTask, step int) *model.PlatTaskHandle {
+	// 步骤号(10接收  15暂存  20提交  30审批(督办人)  40评价(监办人))
+	var personTask model.PlatTaskHandle
+	personTask.TaskId = task.Id
+	personTask.TaskStatus = "10"
+	personTask.Step = step
+	// 督办任务为发起时
+	if step == 10 {
+		personTask.MainUserId = task.MainUserId
+		personTask.OwnerUserId = task.OwnerUserId
+	} else if step == 20 {
+		// 提交给督办人审批
+		personTask.MainUserId = task.SupervisorUserId
+	} else if step == 30 {
+		// 提交给监办人评价
+		personTask.MainUserId = task.WatchUserId
+	}
+	// 填充创建信息
+	service.SetCreatedInfo(&personTask, s.GetCxtUserId(), s.GetCxtUserName())
+
+	return &personTask
+}

+ 1 - 2
opms_parent/app/service/plat/plat_task_comment.go

@@ -56,8 +56,7 @@ func (s *taskCommentService) Create(req *model.AddPlatTaskCommentReq) (err error
 	service.SetCreatedInfo(platTaskComment, s.GetCxtUserId(), s.GetCxtUserName())
 	// 填充更新信息
 	//service.SetUpdatedInfo(platTaskComment, s.GetCxtUserId(), s.GetCxtUserName())
-	Model := s.Dao.M
-	_, err = Model.Insert(platTaskComment)
+	_, err = s.Dao.Insert(platTaskComment)
 	if err != nil {
 		return
 	}

+ 1 - 2
opms_parent/app/service/plat/plat_task_progress.go

@@ -53,8 +53,7 @@ func (s *taskProgressService) Create(req *model.AddPlatTaskProgressReq) (err err
 	service.SetCreatedInfo(platTaskProgress, s.GetCxtUserId(), s.GetCxtUserName())
 	// 填充更新信息
 	//service.SetUpdatedInfo(platTaskProgress, s.GetCxtUserId(), s.GetCxtUserName())
-	Model := s.Dao.M
-	_, err = Model.Insert(platTaskProgress)
+	_, err = s.Dao.Insert(platTaskProgress)
 	if err != nil {
 		return
 	}

+ 4 - 0
opms_parent/main.go

@@ -44,6 +44,10 @@ func main() {
 	s.RegisterName("BusinessFile", new(projHandler.BusinessFileHandler), "")
 	s.RegisterName("BusinessTeam", new(projHandler.BusinessTeamHandler), "")
 	s.RegisterName("CtrContract", new(contract.CtrContract), "")
+	s.RegisterName("CtrContractCollectionPlan", new(contract.CtrContractCollectionPlan), "")
+	s.RegisterName("CtrContractCollection", new(contract.CtrContractCollection), "")
+	s.RegisterName("CtrContractAppend", new(contract.CtrContractAppend), "")
+	s.RegisterName("CtrContractInvoice", new(contract.CtrContractInvoice), "")
 
 	// 注册服务对象
 	//s.RegisterName("Auth", new(handler.Auth), "")

BIN
opms_parent/opms_parent


+ 21 - 2
opms_parent/schema/contract.sql

@@ -98,7 +98,7 @@ CREATE TABLE `ctr_contract_invoice` (
     `invoice_amount` decimal(24, 6) NOT NULL COMMENT '开票金额',
     `invoice_date` datetime NOT NULL COMMENT '开票日期',
     `invoice_type` varchar(4) DEFAULT NULL COMMENT '开票类型',
-    `appro_status` varchar(4) DEFAULT NULL COMMENT '审核状态',
+    `appro_status` varchar(4) DEFAULT NULL COMMENT '审核状态 10 未通过 20 已通过',
     `invoice_code` varchar(32) DEFAULT NULL COMMENT '发票号码',
     `actual_invoice_date` datetime DEFAULT NULL COMMENT '实际开票日期',
     `courier_code` varchar(32) DEFAULT NULL COMMENT '快递单号',
@@ -133,7 +133,25 @@ CREATE TABLE `ctr_contract_product` (
     `updated_time` datetime DEFAULT NULL COMMENT '更新时间',
     `deleted_time` datetime DEFAULT NULL COMMENT '删除时间',
     PRIMARY KEY (`id`)
-) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '合同产品信息'
+) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '合同产品信息';
+CREATE TABLE `ctr_contract_dynamics` (
+    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+    `contract_id` int(11) NOT NULL COMMENT '合同ID',
+    `opn_people_id` int(11) NOT NULL COMMENT '操作人ID',
+    `opn_people` varchar(90) NOT NULL COMMENT '操作人',
+    `opn_date` datetime NOT NULL COMMENT '操作日期',
+    `opn_type` varchar(10) NOT NULL COMMENT '操作类型',
+    `opn_content` text DEFAULT NULL COMMENT '操作内容',
+    `remark` text DEFAULT NULL COMMENT '备注',
+    `created_by` int(11) NOT NULL COMMENT '创建者',
+    `created_name` varchar(90) NOT NULL COMMENT '创建人',
+    `created_time` datetime NOT NULL COMMENT '创建时间',
+    `updated_by` int(11) DEFAULT NULL COMMENT '更新者',
+    `updated_name` varchar(90) DEFAULT NULL COMMENT '更新人',
+    `updated_time` datetime DEFAULT NULL COMMENT '更新时间',
+    `deleted_time` datetime DEFAULT NULL COMMENT '删除时间',
+    PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='合同动态';
 
 
 -- ctr_contract                 合同信息
@@ -142,3 +160,4 @@ CREATE TABLE `ctr_contract_product` (
 -- ctr_contract_collection_plan 合同回款计划
 -- ctr_contract_invoice         合同发票信息
 -- ctr_contract_product         合同产品信息
+-- ctr_contract_dynamics        合同动态

+ 1 - 1
opms_parent/swaggerui/index.html

@@ -68,7 +68,7 @@
           let token = req.headers.Authorization
           if (!token) {
             // token = "Bearer ajg7o1Dts1JrKCm6VtgyuuaYbUIiirXxI5+6WzYnC7gWl+43NdKq6LbWxU1zWhsBaL0A/CIkBoefM0vuu6h4ZA=="
-            token = "Bearer XHPbgFL1HqGOuYvMihA4oPtWy0wLKFF3i20ah/rev5/3QeP7ztdVCmO3x0LljVl1"
+            token = "Bearer 5a9R22RiKGsqBigUbLyd6xpdKYbMJdTw9Aowx8cmbm2qH1V5W3xxR4gNAic8PuG/"
             // token = "Bearer EyQWHd05nop+PL71oABt/1i0zoXd7bym1bFMWMXorORLmyDuyowEDoiKq8DhP2lbZo9XTSMe31d0Q7RRnkDNLA=="
             // token = "Bearer 7XrzVhU+ibTV/77q7h0ETY+bEWy4r4g9wteUr/43vNadbuWG5y8wucSmeU0BRd/1"
           }

Разница между файлами не показана из-за своего большого размера
+ 1157 - 83
opms_parent/swaggerui/swagger.yml


Некоторые файлы не были показаны из-за большого количества измененных файлов