|
|
@@ -9,11 +9,11 @@ import (
|
|
|
model "dashoo.cn/micro/app/model/proj"
|
|
|
workflowModel "dashoo.cn/micro/app/model/workflow"
|
|
|
workflowService "dashoo.cn/micro/app/service/workflow"
|
|
|
+ "dashoo.cn/opms_libary/plugin/dingtalk"
|
|
|
|
|
|
"dashoo.cn/micro/app/service"
|
|
|
"dashoo.cn/opms_libary/multipart"
|
|
|
"dashoo.cn/opms_libary/myerrors"
|
|
|
- "dashoo.cn/opms_libary/plugin/dingtalk"
|
|
|
"dashoo.cn/opms_libary/plugin/dingtalk/message"
|
|
|
"dashoo.cn/opms_libary/plugin/dingtalk/workflow"
|
|
|
"dashoo.cn/opms_libary/utils"
|
|
|
@@ -193,28 +193,33 @@ func (p *businessService) Create(req *model.AddProjBusinessReq) (err error) {
|
|
|
return err
|
|
|
}
|
|
|
// 初始化项目信息
|
|
|
- businessData := new(model.ProjBusiness)
|
|
|
- if err = gconv.Struct(req, businessData); err != nil {
|
|
|
+ business := new(model.ProjBusiness)
|
|
|
+ if err = gconv.Struct(req, business); err != nil {
|
|
|
return
|
|
|
}
|
|
|
- businessData.NboCode = nboCode
|
|
|
- //businessData.NboStatus = StatusOK
|
|
|
- businessData.NboType = StatusC
|
|
|
- businessData.ApproStatus = ApprovalNotSubmit
|
|
|
- businessData.EstTransPrice = totalPrice
|
|
|
- businessData.CustProvinceId = customer.CustProvinceId
|
|
|
- businessData.CustProvince = customer.CustProvince
|
|
|
- businessData.CustCityId = customer.CustCityId
|
|
|
- businessData.CustCity = customer.CustCity
|
|
|
- businessData.CustRegionId = customer.CustRegionId
|
|
|
- businessData.CustRegion = customer.CustRegion
|
|
|
- businessData.DeptId = p.GetCxtUserDeptId()
|
|
|
- service.SetCreatedInfo(businessData, p.GetCxtUserId(), p.GetCxtUserName())
|
|
|
- businessData.FilingTime = businessData.CreatedTime
|
|
|
+ business.NboCode = nboCode
|
|
|
+ //business.NboStatus = StatusOK
|
|
|
+ business.NboType = StatusC
|
|
|
+ business.ApproStatus = ApprovalWaiting
|
|
|
+ business.EstTransPrice = totalPrice
|
|
|
+ business.CustProvinceId = customer.CustProvinceId
|
|
|
+ business.CustProvince = customer.CustProvince
|
|
|
+ business.CustCityId = customer.CustCityId
|
|
|
+ business.CustCity = customer.CustCity
|
|
|
+ business.CustRegionId = customer.CustRegionId
|
|
|
+ business.CustRegion = customer.CustRegion
|
|
|
+ business.DeptId = p.GetCxtUserDeptId()
|
|
|
+ service.SetCreatedInfo(business, p.GetCxtUserId(), p.GetCxtUserName())
|
|
|
+ business.FilingTime = business.CreatedTime
|
|
|
+
|
|
|
+ productLine, _ := service.GetDictLabelByTypeAndValue(p.Ctx, "sys_product_line", business.ProductLine)
|
|
|
+ nboSource, _ := service.GetDictLabelByTypeAndValue(p.Ctx, "proj_nbo_source", business.NboSource)
|
|
|
+ salesModel, _ := service.GetDictLabelByTypeAndValue(p.Ctx, "proj_sales_model", business.SalesModel)
|
|
|
+
|
|
|
// 事务
|
|
|
err = p.Dao.Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
|
|
|
// 添加项目
|
|
|
- lastId, err := p.Dao.TX(tx).InsertAndGetId(businessData)
|
|
|
+ lastId, err := p.Dao.TX(tx).InsertAndGetId(business)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
@@ -238,15 +243,118 @@ func (p *businessService) Create(req *model.AddProjBusinessReq) (err error) {
|
|
|
dynamics := model.ProjBusinessDynamics{
|
|
|
BusId: int(lastId),
|
|
|
OpnType: OpnCreate,
|
|
|
- Remark: businessData.Remark,
|
|
|
+ Remark: business.Remark,
|
|
|
+ }
|
|
|
+ _, err = p.CreateProjBusinessDynamics(tx, dynamics, business)
|
|
|
+ // 审批流
|
|
|
+ workflowSrv, _ := workflowService.NewFlowService(p.Ctx)
|
|
|
+ // OMS项目转移 审批
|
|
|
+ bizCode := business.NboCode + ":" + gconv.String(lastId)
|
|
|
+ _, err = workflowSrv.StartProcessInstance(bizCode, workflowModel.ProjectCreate, "", &workflow.StartProcessInstanceRequest{
|
|
|
+ ProcessCode: &BusinessCreateRequestProcessCode,
|
|
|
+ FormComponentValues: []*workflow.StartProcessInstanceRequestFormComponentValues{
|
|
|
+ {
|
|
|
+ Id: utils.String("TextField-K2AD4O5B"),
|
|
|
+ Name: utils.String("项目编码"),
|
|
|
+ Value: utils.String(business.NboCode),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ Id: utils.String("TextField_BDLSECETVSG0"),
|
|
|
+ Name: utils.String("项目名称"),
|
|
|
+ Value: utils.String(business.NboName),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ Id: utils.String("DDSelectField_213JKZA1OUO00"),
|
|
|
+ Name: utils.String("产品线"),
|
|
|
+ Value: utils.String(productLine),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ Id: utils.String("TextField_1J9BJMOZ18F40"),
|
|
|
+ Name: utils.String("客户名称"),
|
|
|
+ Value: utils.String(business.CustName),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ Id: utils.String("TextField_VZ64Y44LXFK0"),
|
|
|
+ Name: utils.String("主要联系人"),
|
|
|
+ Value: utils.String(business.ContactName),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ Id: utils.String("DDSelectField_6CQD451D3800"),
|
|
|
+ Name: utils.String("项目来源"),
|
|
|
+ Value: utils.String(nboSource),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ Id: utils.String("TextField_AEUWH63LJ0O0"),
|
|
|
+ Name: utils.String("销售工程师"),
|
|
|
+ Value: utils.String(business.SaleName),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ Id: utils.String("DDSelectField_34QSUGHO2SO0"),
|
|
|
+ Name: utils.String("销售模式"),
|
|
|
+ Value: utils.String(salesModel),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ Id: utils.String("TextField_1PWK6WHMGITC0"),
|
|
|
+ Name: utils.String("经销商/代理商"),
|
|
|
+ Value: utils.String(business.DistributorName),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ Id: utils.String("DDSelectField_5R11VVM6GI00"),
|
|
|
+ Name: utils.String("是否为大项目"),
|
|
|
+ Value: utils.String(yesOrNoType[business.IsBig]),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ Id: utils.String("TextareaField_1GEL8JJL3H5S0"),
|
|
|
+ Name: utils.String("备注"),
|
|
|
+ Value: utils.String(business.Remark),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ })
|
|
|
+ if err != nil {
|
|
|
+ g.Log().Error(err)
|
|
|
+ return err
|
|
|
}
|
|
|
- _, err = p.CreateProjBusinessDynamics(tx, dynamics, businessData)
|
|
|
return err
|
|
|
})
|
|
|
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// BusinessCreatedNotify 项目创建 审批结果通知
|
|
|
+func (p *businessService) BusinessCreatedNotify(flow *workflowModel.PlatWorkflow, msg *message.MixMessage) error {
|
|
|
+ business, err := p.checkDingTalkNotify(flow, msg)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ var data = g.Map{}
|
|
|
+ if msg.ProcessType == "terminate" {
|
|
|
+ data[p.Dao.C.ApproStatus] = ApprovalReturn
|
|
|
+ }
|
|
|
+ if msg.ProcessType == "finish" && msg.Result == "refuse" {
|
|
|
+ data[p.Dao.C.ApproStatus] = ApprovalRejection
|
|
|
+ }
|
|
|
+ if msg.ProcessType == "finish" && msg.Result == "agree" {
|
|
|
+ data[p.Dao.C.ApproStatus] = ApprovalOK
|
|
|
+ }
|
|
|
+
|
|
|
+ // 项目修改
|
|
|
+ _, err = p.Dao.WherePri(business.Id).FieldsEx(service.UpdateFieldEx...).Data(data).Update()
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ // 添加项目动态
|
|
|
+ dynamics := model.ProjBusinessDynamics{
|
|
|
+ BusId: business.Id,
|
|
|
+ OpnType: OpnCreatedApproval,
|
|
|
+ }
|
|
|
+ _, err = p.CreateProjBusinessDynamics(nil, dynamics, data)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ return err
|
|
|
+}
|
|
|
+
|
|
|
// setProductInfo 设置产品信息
|
|
|
func (p *businessService) setProductInfo(busId int, productInfo []model.BusinessProduct) (total float64, products []*model.ProjBusinessProduct, err error) {
|
|
|
products = make([]*model.ProjBusinessProduct, len(productInfo))
|
|
|
@@ -358,6 +466,9 @@ func (p *businessService) BusinessTransfer(req *model.BusinessTransferReq) error
|
|
|
opnContent["saleId"] = req.UserId
|
|
|
opnContent["saleName"] = req.UserName
|
|
|
opnContent["remark"] = req.Remark
|
|
|
+
|
|
|
+ productLine, _ := service.GetDictLabelByTypeAndValue(p.Ctx, "sys_product_line", business.ProductLine)
|
|
|
+
|
|
|
// 审批流
|
|
|
workflowSrv, _ := workflowService.NewFlowService(p.Ctx)
|
|
|
err = p.Dao.Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
|
|
|
@@ -408,6 +519,11 @@ func (p *businessService) BusinessTransfer(req *model.BusinessTransferReq) error
|
|
|
Name: utils.String("所在市"),
|
|
|
Value: utils.String(business.CustCity),
|
|
|
},
|
|
|
+ {
|
|
|
+ Id: utils.String("DDSelectField_6OMVO1JV0980"),
|
|
|
+ Name: utils.String("产品线"),
|
|
|
+ Value: utils.String(productLine),
|
|
|
+ },
|
|
|
{
|
|
|
Id: utils.String("TextField_1E1WOYGKRTDS0"),
|
|
|
Name: utils.String("项目级别"),
|
|
|
@@ -513,7 +629,7 @@ func (p *businessService) BusinessGradation(busId int, nboType, busType string)
|
|
|
}
|
|
|
|
|
|
// BusinessUpgrade 项目升级
|
|
|
-func (p *businessService) BusinessUpgrade(req *model.BusinessUpgradeReq, args *multipart.MultipartFile) error {
|
|
|
+func (p *businessService) BusinessUpgrade(req *model.BusinessUpgradeReq, fileMap map[string]*multipart.FileHeader) error {
|
|
|
business, err := p.BusinessGradation(req.Id, req.NboType, "up")
|
|
|
if err != nil {
|
|
|
return err
|
|
|
@@ -544,7 +660,7 @@ func (p *businessService) BusinessUpgrade(req *model.BusinessUpgradeReq, args *m
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
- err = p.BusUpgradeDingEvent(business, req, args)
|
|
|
+ err = p.BusUpgradeDingEvent(business, req, fileMap)
|
|
|
return err
|
|
|
})
|
|
|
return err
|
|
|
@@ -572,11 +688,13 @@ func (p *businessService) getBusDingUpgradeType(dbNboType, reqNboType string) st
|
|
|
}
|
|
|
|
|
|
// BusUpgradeDingEvent 项目升级钉钉审批流调用
|
|
|
-func (p *businessService) BusUpgradeDingEvent(business *model.ProjBusiness, req *model.BusinessUpgradeReq, args *multipart.MultipartFile) error {
|
|
|
+func (p *businessService) BusUpgradeDingEvent(business *model.ProjBusiness, req *model.BusinessUpgradeReq, fileMap map[string]*multipart.FileHeader) error {
|
|
|
upgradeType := p.getBusDingUpgradeType(business.NboType, req.NboType)
|
|
|
if upgradeType == "" {
|
|
|
return myerrors.TipsError("错误的升级类型")
|
|
|
}
|
|
|
+ productLine, _ := service.GetDictLabelByTypeAndValue(p.Ctx, "sys_product_line", business.ProductLine)
|
|
|
+
|
|
|
// 审批流
|
|
|
workflowSrv, _ := workflowService.NewFlowService(p.Ctx)
|
|
|
// OMS项目升级 审批
|
|
|
@@ -598,6 +716,11 @@ func (p *businessService) BusUpgradeDingEvent(business *model.ProjBusiness, req
|
|
|
Name: utils.String("项目名称"),
|
|
|
Value: utils.String(business.NboName),
|
|
|
},
|
|
|
+ {
|
|
|
+ Id: utils.String("DDSelectField_1MJU37HGJX4W0"),
|
|
|
+ Name: utils.String("产品线"),
|
|
|
+ Value: utils.String(productLine),
|
|
|
+ },
|
|
|
{
|
|
|
Id: utils.String("DDSelectField_VSA3U380ZK00"),
|
|
|
Name: utils.String("升级类型"),
|
|
|
@@ -622,6 +745,20 @@ func (p *businessService) BusUpgradeDingEvent(business *model.ProjBusiness, req
|
|
|
}
|
|
|
|
|
|
case StatusB:
|
|
|
+ quotationFile := make([]contractModel.DingFileInfo, 0)
|
|
|
+ if len(fileMap) > 0 {
|
|
|
+ for k, files := range fileMap {
|
|
|
+ // 报价单
|
|
|
+ if k == "quotationFile" {
|
|
|
+ if quotationFile, err = p.txCreateBusinessDingTalkFile(business, k, files); err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(quotationFile) == 0 {
|
|
|
+ return myerrors.TipsError("请上传报价单文件")
|
|
|
+ }
|
|
|
processCode := &BusinessUpgradeBRequestProcessCode
|
|
|
dingReq = &workflow.StartProcessInstanceRequest{
|
|
|
ProcessCode: processCode,
|
|
|
@@ -636,6 +773,11 @@ func (p *businessService) BusUpgradeDingEvent(business *model.ProjBusiness, req
|
|
|
Name: utils.String("项目名称"),
|
|
|
Value: utils.String(business.NboName),
|
|
|
},
|
|
|
+ {
|
|
|
+ Id: utils.String("DDSelectField_213JKZA1OUO00"),
|
|
|
+ Name: utils.String("产品线"),
|
|
|
+ Value: utils.String(productLine),
|
|
|
+ },
|
|
|
{
|
|
|
Id: utils.String("DDSelectField_VSA3U380ZK00"),
|
|
|
Name: utils.String("升级类型"),
|
|
|
@@ -681,6 +823,11 @@ func (p *businessService) BusUpgradeDingEvent(business *model.ProjBusiness, req
|
|
|
Name: utils.String("是否我司参数"),
|
|
|
Value: utils.String(gconv.String(yesOrNoType[req.IsAdoptDashoo])),
|
|
|
},
|
|
|
+ {
|
|
|
+ Id: utils.String("DDAttachment_KZPWZJS9GHO0"),
|
|
|
+ Name: utils.String("上传报价单"),
|
|
|
+ Value: utils.String(gconv.String(quotationFile)),
|
|
|
+ },
|
|
|
{
|
|
|
Id: utils.String("TextareaField_1GEL8JJL3H5S0"),
|
|
|
Name: utils.String("备注"),
|
|
|
@@ -690,25 +837,27 @@ func (p *businessService) BusUpgradeDingEvent(business *model.ProjBusiness, req
|
|
|
}
|
|
|
|
|
|
case StatusA:
|
|
|
- var file []contractModel.DingFileInfo
|
|
|
- if args != nil {
|
|
|
- resp, err := dingtalk.Client.GetStorage().UploadFile(service.DingTalkSpaceId, p.GetCxtUserDingtalkId(), args.FileName, args.File.Name())
|
|
|
- if err != nil {
|
|
|
- return fmt.Errorf("钉钉上传文件异常 %s", err.Error())
|
|
|
- }
|
|
|
- g.Log().Info("项目转A类提交大数参数文件", resp)
|
|
|
- file = []contractModel.DingFileInfo{{
|
|
|
- SpaceId: resp.Dentry.SpaceId,
|
|
|
- FileId: resp.Dentry.Id,
|
|
|
- FileName: resp.Dentry.Name,
|
|
|
- FileSize: resp.Dentry.Size,
|
|
|
- FileType: resp.Dentry.Extension,
|
|
|
- }}
|
|
|
- err = p.txCreateBusinessFile(business.Id, file)
|
|
|
- if err != nil {
|
|
|
- return err
|
|
|
+ var dashooParamFile []contractModel.DingFileInfo
|
|
|
+ var quotationFile []contractModel.DingFileInfo
|
|
|
+ if len(fileMap) > 0 {
|
|
|
+ for k, files := range fileMap {
|
|
|
+ // 报价单
|
|
|
+ if k == "quotationFile" {
|
|
|
+ if quotationFile, err = p.txCreateBusinessDingTalkFile(business, k, files); err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 大数参数文件
|
|
|
+ if k == "dashooParamFile" {
|
|
|
+ if dashooParamFile, err = p.txCreateBusinessDingTalkFile(business, k, files); err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ if len(quotationFile) == 0 {
|
|
|
+ return myerrors.TipsError("请上传报价单文件")
|
|
|
+ }
|
|
|
processCode := &BusinessUpgradeARequestProcessCode
|
|
|
dingReq = &workflow.StartProcessInstanceRequest{
|
|
|
ProcessCode: processCode,
|
|
|
@@ -723,6 +872,11 @@ func (p *businessService) BusUpgradeDingEvent(business *model.ProjBusiness, req
|
|
|
Name: utils.String("项目名称"),
|
|
|
Value: utils.String(business.NboName),
|
|
|
},
|
|
|
+ {
|
|
|
+ Id: utils.String("DDSelectField_L4CSUVLU1NK"),
|
|
|
+ Name: utils.String("产品线"),
|
|
|
+ Value: utils.String(productLine),
|
|
|
+ },
|
|
|
{
|
|
|
Id: utils.String("DDSelectField_VSA3U380ZK00"),
|
|
|
Name: utils.String("升级类型"),
|
|
|
@@ -771,7 +925,12 @@ func (p *businessService) BusUpgradeDingEvent(business *model.ProjBusiness, req
|
|
|
{
|
|
|
Id: utils.String("DDAttachment_11Q7DBRKE6HC0"),
|
|
|
Name: utils.String("附件"),
|
|
|
- Value: utils.String(gconv.String(file)),
|
|
|
+ Value: utils.String(gconv.String(dashooParamFile)),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ Id: utils.String("DDAttachment_19Y01ZRBFWXS0"),
|
|
|
+ Name: utils.String("上传报价单"),
|
|
|
+ Value: utils.String(gconv.String(quotationFile)),
|
|
|
},
|
|
|
{
|
|
|
Id: utils.String("TextareaField_1GEL8JJL3H5S0"),
|
|
|
@@ -792,14 +951,46 @@ func (p *businessService) BusUpgradeDingEvent(business *model.ProjBusiness, req
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+// 项目上传文件至钉钉
|
|
|
+func (p *businessService) txCreateBusinessDingTalkFile(business *model.ProjBusiness, fileType string, file *multipart.FileHeader) ([]contractModel.DingFileInfo, error) {
|
|
|
+ dingTalkFiles := make([]contractModel.DingFileInfo, 0)
|
|
|
+ //for _, file := range files {
|
|
|
+ resp, err := dingtalk.Client.GetStorage().UploadFile(service.DingTalkSpaceId, p.GetCxtUserDingtalkId(), file.FileName, file.File.Name())
|
|
|
+ if err != nil {
|
|
|
+ g.Log().Error(err)
|
|
|
+ return nil, myerrors.TipsError("钉钉上传文件异常")
|
|
|
+ }
|
|
|
+ typ := "项目转" + nboType[business.NboType] + "类"
|
|
|
+ if fileType == "quotationFile" {
|
|
|
+ typ += "上传报价单文件"
|
|
|
+ }
|
|
|
+ if fileType == "dashooParamFile" {
|
|
|
+ typ += "上传大数技术参数文件"
|
|
|
+ }
|
|
|
+ g.Log().Info(typ, resp)
|
|
|
+ dingTalkFiles = append(dingTalkFiles, contractModel.DingFileInfo{
|
|
|
+ SpaceId: resp.Dentry.SpaceId,
|
|
|
+ FileId: resp.Dentry.Id,
|
|
|
+ FileName: resp.Dentry.Name,
|
|
|
+ FileSize: resp.Dentry.Size,
|
|
|
+ FileType: resp.Dentry.Extension,
|
|
|
+ })
|
|
|
+ //}
|
|
|
+ err = p.txCreateBusinessFile(business.Id, typ, dingTalkFiles)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return dingTalkFiles, nil
|
|
|
+}
|
|
|
+
|
|
|
// 采用大数参数文件记录
|
|
|
-func (p *businessService) txCreateBusinessFile(busId int, files []contractModel.DingFileInfo) error {
|
|
|
+func (p *businessService) txCreateBusinessFile(busId int, fileSource string, files []contractModel.DingFileInfo) error {
|
|
|
dataList := make([]*model.ProjBusinessFile, 0)
|
|
|
for _, v := range files {
|
|
|
data := new(model.ProjBusinessFile)
|
|
|
data.BusId = busId
|
|
|
data.FileName = v.FileName
|
|
|
- data.FileSource = "项目转为A类采用大数参数文件"
|
|
|
+ data.FileSource = fileSource
|
|
|
data.FileSize = gconv.String(v.FileSize)
|
|
|
data.FileUrl = strings.Join([]string{"dingtalk", v.SpaceId, v.FileId}, ":")
|
|
|
service.SetCreatedInfo(data, p.GetCxtUserId(), p.GetCxtUserName())
|
|
|
@@ -899,6 +1090,8 @@ func (p *businessService) BusinessDowngrade(req *model.BusinessDowngradeReq) err
|
|
|
opnContent["approStatus"] = ApprovalWaiting
|
|
|
service.SetUpdatedInfo(opnContent, p.GetCxtUserId(), p.GetCxtUserName())
|
|
|
|
|
|
+ productLine, _ := service.GetDictLabelByTypeAndValue(p.Ctx, "sys_product_line", business.ProductLine)
|
|
|
+
|
|
|
// 审批流
|
|
|
workflowSrv, _ := workflowService.NewFlowService(p.Ctx)
|
|
|
err = p.Dao.Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
|
|
|
@@ -952,6 +1145,11 @@ func (p *businessService) BusinessDowngrade(req *model.BusinessDowngradeReq) err
|
|
|
Name: utils.String("降级类型"),
|
|
|
Value: utils.String(downgradeType),
|
|
|
},
|
|
|
+ {
|
|
|
+ Id: utils.String("DDSelectField_1UCNHJ0P8C5C0"),
|
|
|
+ Name: utils.String("产品线"),
|
|
|
+ Value: utils.String(productLine),
|
|
|
+ },
|
|
|
{
|
|
|
Id: utils.String("TextField_X4D3QGARU7K0"),
|
|
|
Name: utils.String("支持内容"),
|
|
|
@@ -1130,6 +1328,9 @@ func (p *businessService) ConvertToReserve(req *model.BusinessToReserveReq) erro
|
|
|
if business == nil {
|
|
|
return myerrors.TipsError("项目已提交审批任务,无法重复提交。")
|
|
|
}
|
|
|
+
|
|
|
+ productLine, _ := service.GetDictLabelByTypeAndValue(p.Ctx, "sys_product_line", business.ProductLine)
|
|
|
+
|
|
|
// 审批流
|
|
|
workflowSrv, _ := workflowService.NewFlowService(p.Ctx)
|
|
|
err = p.Dao.Transaction(context.TODO(), func(ctx context.Context, tx *gdb.TX) error {
|
|
|
@@ -1181,6 +1382,11 @@ func (p *businessService) ConvertToReserve(req *model.BusinessToReserveReq) erro
|
|
|
Name: utils.String("项目级别"),
|
|
|
Value: utils.String(convertToReserveType[business.NboType]),
|
|
|
},
|
|
|
+ {
|
|
|
+ Id: utils.String("DDSelectField_1UVBB1LZHIJK0"),
|
|
|
+ Name: utils.String("产品线"),
|
|
|
+ Value: utils.String(productLine),
|
|
|
+ },
|
|
|
{
|
|
|
Id: utils.String("TextField_1NDD3TY8KJB40"),
|
|
|
Name: utils.String("销售工程师"),
|
|
|
@@ -1242,12 +1448,12 @@ func (p *businessService) ConvertToReserveNotify(flow *workflowModel.PlatWorkflo
|
|
|
func (p *businessService) checkDingTalkNotify(flow *workflowModel.PlatWorkflow, msg *message.MixMessage) (*model.ProjBusiness, error) {
|
|
|
bizCode := strings.Split(flow.BizCode, ":")
|
|
|
if len(bizCode) != 2 {
|
|
|
- return nil, fmt.Errorf("项目转储备审批 bizCode 不合法:%s Id: %d", flow.BizCode, flow.Id)
|
|
|
+ return nil, fmt.Errorf("项目审批 bizCode 不合法:%s Id: %d", flow.BizCode, flow.Id)
|
|
|
}
|
|
|
nboCode := bizCode[0]
|
|
|
busId, err := strconv.Atoi(bizCode[1])
|
|
|
if err != nil {
|
|
|
- return nil, fmt.Errorf("项目转储备审批 bizCode 不合法:%s Id: %d", flow.BizCode, flow.Id)
|
|
|
+ return nil, fmt.Errorf("项目审批 bizCode 不合法:%s Id: %d", flow.BizCode, flow.Id)
|
|
|
}
|
|
|
if msg.ProcessType != "finish" && msg.ProcessType != "terminate" {
|
|
|
return nil, fmt.Errorf("无法识别的 ProcessType :%s", msg.ProcessType)
|