更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -15,20 +15,10 @@ import (
|
||||
"server/pkg/identity"
|
||||
)
|
||||
|
||||
// =============================================================
|
||||
// CRM 招投标管理 - 投标方(Bid)
|
||||
// =============================================================
|
||||
//
|
||||
// 状态机:0草稿 -> 1立项审批中 -> 2投标中 -> 3已开标 -> (4中标 | 5落标) -> (6已转合同 | 7已归档)
|
||||
// 关联:商机(1)/项目(2)/独立(0) -> 中标 -> 合同/项目
|
||||
// =============================================================
|
||||
|
||||
// BackendCrmBiddingBidController 投标方
|
||||
type BackendCrmBiddingBidController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// bidPayload 创建/更新请求体
|
||||
type bidPayload struct {
|
||||
BidNo string `json:"bid_no"`
|
||||
Title string `json:"title"`
|
||||
@@ -60,7 +50,6 @@ type bidPayload struct {
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
// List GET /backend/crm/bidding/bid/list
|
||||
func (c *BackendCrmBiddingBidController) List() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -121,7 +110,6 @@ func (c *BackendCrmBiddingBidController) List() {
|
||||
})
|
||||
}
|
||||
|
||||
// Detail GET /backend/crm/bidding/bid/detail/:id
|
||||
func (c *BackendCrmBiddingBidController) Detail() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -149,7 +137,6 @@ func (c *BackendCrmBiddingBidController) Detail() {
|
||||
pipelineOk(&c.Controller, row)
|
||||
}
|
||||
|
||||
// Create POST /backend/crm/bidding/bid
|
||||
func (c *BackendCrmBiddingBidController) Create() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -210,7 +197,6 @@ func (c *BackendCrmBiddingBidController) Create() {
|
||||
UpdateTime: now,
|
||||
}
|
||||
|
||||
// 唯一性校验:同租户内不允许重复创建同名投标
|
||||
if crmNameDuplicated(new(models.TenantCrmBiddingBid), tenantID, "title", row.Title) {
|
||||
pipelineErr(&c.Controller, 409, 409, "该投标标题已存在")
|
||||
return
|
||||
@@ -225,7 +211,6 @@ func (c *BackendCrmBiddingBidController) Create() {
|
||||
pipelineOk(&c.Controller, map[string]interface{}{"id": id})
|
||||
}
|
||||
|
||||
// Update PUT /backend/crm/bidding/bid/:id
|
||||
func (c *BackendCrmBiddingBidController) Update() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -310,7 +295,6 @@ func (c *BackendCrmBiddingBidController) Update() {
|
||||
pipelineOk(&c.Controller, map[string]interface{}{"id": row.ID})
|
||||
}
|
||||
|
||||
// Delete DELETE /backend/crm/bidding/bid/:id
|
||||
func (c *BackendCrmBiddingBidController) Delete() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -354,7 +338,6 @@ func (c *BackendCrmBiddingBidController) Delete() {
|
||||
pipelineOk(&c.Controller, nil)
|
||||
}
|
||||
|
||||
// ConvertContract POST /backend/crm/bidding/bid/:id/contract 中标转合同
|
||||
func (c *BackendCrmBiddingBidController) ConvertContract() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -407,7 +390,7 @@ func (c *BackendCrmBiddingBidController) ConvertContract() {
|
||||
}
|
||||
category := strings.TrimSpace(p.ContractCategory)
|
||||
if category == "" {
|
||||
category = "2" // 默认:服务类
|
||||
category = "2"
|
||||
}
|
||||
now := time.Now()
|
||||
bidIDVal := bid.ID
|
||||
@@ -417,9 +400,9 @@ func (c *BackendCrmBiddingBidController) ConvertContract() {
|
||||
ContractNo: strings.TrimSpace(p.ContractNo),
|
||||
ContractName: contractName,
|
||||
ContractCategory: category,
|
||||
OurRole: 2, // 我方为乙方
|
||||
OurRole: 2,
|
||||
PartyCount: 2,
|
||||
ProjectID: bid.ProjectID, // 中标项目关联
|
||||
ProjectID: bid.ProjectID,
|
||||
ProjectName: bid.ProjectName,
|
||||
OwnerUserID: bid.OwnerUserID,
|
||||
OwnerUserName: bid.OwnerUserName,
|
||||
@@ -437,7 +420,6 @@ func (c *BackendCrmBiddingBidController) ConvertContract() {
|
||||
return
|
||||
}
|
||||
|
||||
// 更新投标状态:状态置6已转合同,存 contract_id,加锁
|
||||
cid := uint64(contractID)
|
||||
bid.ContractID = &cid
|
||||
bid.Status = 6
|
||||
@@ -455,7 +437,6 @@ func (c *BackendCrmBiddingBidController) ConvertContract() {
|
||||
pipelineOk(&c.Controller, map[string]interface{}{"contract_id": contractID})
|
||||
}
|
||||
|
||||
// ConvertProject POST /backend/crm/bidding/bid/:id/project 中标转项目
|
||||
func (c *BackendCrmBiddingBidController) ConvertProject() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -518,7 +499,7 @@ func (c *BackendCrmBiddingBidController) ConvertProject() {
|
||||
TenantID: tenantID,
|
||||
ProjectName: projectName,
|
||||
ProjectNo: strings.TrimSpace(p.ProjectNo),
|
||||
ProjectType: 1, // 单一项目
|
||||
ProjectType: 1,
|
||||
BusinessID: bid.BusinessID,
|
||||
CustomerID: bid.CustomerID,
|
||||
CustomerName: bid.CustomerName,
|
||||
@@ -558,7 +539,6 @@ func (c *BackendCrmBiddingBidController) ConvertProject() {
|
||||
pipelineOk(&c.Controller, map[string]interface{}{"project_id": projID})
|
||||
}
|
||||
|
||||
// SubmitResult POST /backend/crm/bidding/bid/:id/result 提交开标结果
|
||||
func (c *BackendCrmBiddingBidController) SubmitResult() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -625,17 +605,16 @@ func (c *BackendCrmBiddingBidController) SubmitResult() {
|
||||
return
|
||||
}
|
||||
|
||||
// 同步投标主表状态/得分
|
||||
bid.WinStatus = p.ResultType
|
||||
bid.WinDate = parsePipelineDateTime(p.AnnounceDate)
|
||||
bid.Status = 3 // 已开标
|
||||
bid.Status = 3
|
||||
bid.TotalScore = p.TotalScore
|
||||
bid.OurRanking = p.OurRanking
|
||||
bid.CompetitorCount = p.CompetitorCount
|
||||
if p.ResultType == 1 {
|
||||
bid.Status = 4 // 中标
|
||||
bid.Status = 4
|
||||
} else if p.ResultType == 2 {
|
||||
bid.Status = 5 // 落标
|
||||
bid.Status = 5
|
||||
}
|
||||
bid.UpdateTime = now
|
||||
if _, err := models.Orm.Update(&bid, "win_status", "win_date", "status", "total_score", "our_ranking", "competitor_count", "update_time"); err != nil {
|
||||
@@ -649,7 +628,6 @@ func (c *BackendCrmBiddingBidController) SubmitResult() {
|
||||
pipelineOk(&c.Controller, map[string]interface{}{"id": resultID})
|
||||
}
|
||||
|
||||
// FromBusiness POST /backend/crm/bidding/bid/from-business 从商机创建投标
|
||||
func (c *BackendCrmBiddingBidController) FromBusiness() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -706,7 +684,7 @@ func (c *BackendCrmBiddingBidController) FromBusiness() {
|
||||
Title: title,
|
||||
BidType: firstNonEmpty(p.BidType, "1"),
|
||||
Status: 0,
|
||||
SourceType: 1, // 1=商机
|
||||
SourceType: 1,
|
||||
SourceID: &bizID,
|
||||
BusinessID: &bizID,
|
||||
BusinessName: biz.BusinessName,
|
||||
@@ -742,7 +720,6 @@ func (c *BackendCrmBiddingBidController) FromBusiness() {
|
||||
pipelineOk(&c.Controller, map[string]interface{}{"id": id, "business": biz})
|
||||
}
|
||||
|
||||
// FromProject POST /backend/crm/bidding/bid/from-project 从项目创建投标
|
||||
func (c *BackendCrmBiddingBidController) FromProject() {
|
||||
claims, err := pipelineClaims(&c.Controller)
|
||||
if err != nil {
|
||||
@@ -792,12 +769,12 @@ func (c *BackendCrmBiddingBidController) FromProject() {
|
||||
Title: title,
|
||||
BidType: firstNonEmpty(p.BidType, "1"),
|
||||
Status: 0,
|
||||
SourceType: 2, // 2=项目
|
||||
SourceType: 2,
|
||||
SourceID: &projID,
|
||||
ProjectID: &projID,
|
||||
ProjectName: proj.ProjectName,
|
||||
BusinessID: proj.BusinessID,
|
||||
BusinessName: "", // 需要回查商机名(不阻塞,简化处理)
|
||||
BusinessName: "",
|
||||
CustomerID: proj.CustomerID,
|
||||
CustomerName: proj.CustomerName,
|
||||
BidAmount: p.BidAmount,
|
||||
@@ -827,11 +804,6 @@ func (c *BackendCrmBiddingBidController) FromProject() {
|
||||
pipelineOk(&c.Controller, map[string]interface{}{"id": id, "project": proj})
|
||||
}
|
||||
|
||||
// =====================================================================
|
||||
// 辅助函数
|
||||
// =====================================================================
|
||||
|
||||
// nilOrID 当 id>0 时返回指针,否则返回 nil
|
||||
func nilOrID(id uint64) *uint64 {
|
||||
if id == 0 {
|
||||
return nil
|
||||
@@ -840,7 +812,6 @@ func nilOrID(id uint64) *uint64 {
|
||||
return &v
|
||||
}
|
||||
|
||||
// resultTypeText 投标结果文本
|
||||
func resultTypeText(t int8) string {
|
||||
switch t {
|
||||
case 1:
|
||||
|
||||
Reference in new issue
Block a user