作者 yangfu
@@ -180,7 +180,7 @@ func (srv CooperationApplicationsService) CooperationApplicationsOneclickApprova @@ -180,7 +180,7 @@ func (srv CooperationApplicationsService) CooperationApplicationsOneclickApprova
180 auditCommand.Operator) 180 auditCommand.Operator)
181 _, err := creationCooperationGateway.CooperationApplicationsOneclickApproval( 181 _, err := creationCooperationGateway.CooperationApplicationsOneclickApproval(
182 allied_creation_cooperation.ReqCooperationApplicationOneclickApproval{ 182 allied_creation_cooperation.ReqCooperationApplicationOneclickApproval{
183 - CooperationApplicationDescription: auditCommand.CooperationApplicationVerifyDescription, 183 + CooperationApplicationVerifyDescription: auditCommand.CooperationApplicationVerifyDescription,
184 Action: auditCommand.CooperationApplicationStatus, 184 Action: auditCommand.CooperationApplicationStatus,
185 Code: "a1-2", 185 Code: "a1-2",
186 }) 186 })
  1 +package dto
  2 +
  3 +import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
  4 +
  5 +type ContractChangeLogItem struct {
  6 + CooperationContractNumber string `json:"cooperationContractNumber"`
  7 + CreatedAt string `json:"createdAt"`
  8 + IncentivesRule string `json:"incentivesRule"`
  9 + IncentivesRuleDetail string `json:"incentivesRuleDetail"`
  10 + Operation string `json:"operation"`
  11 + OperationType int `json:"operationType"`
  12 + Undertakers string `json:"undertakers"`
  13 + UpdatedAt string `json:"updatedAt"`
  14 +}
  15 +
  16 +func ToContractChangeLogList(param *allied_creation_cooperation.DataContractChangeLogsSearch) []ContractChangeLogItem {
  17 + listData := []ContractChangeLogItem{}
  18 + for _, v := range param.Grid.List {
  19 + item := ContractChangeLogItem{
  20 + CooperationContractNumber: v.CooperationContractNumber,
  21 + CreatedAt: v.CreatedAt.Format("2006-01-02 15:04:05"),
  22 + IncentivesRule: v.IncentivesRule,
  23 + IncentivesRuleDetail: v.IncentivesRuleDetail,
  24 + Operation: v.Operator.UserName,
  25 + OperationType: int(v.OperationType),
  26 + Undertakers: v.Undertakers,
  27 + UpdatedAt: v.UpdatedAt.Format("2006-01-02 15:04:05"),
  28 + }
  29 + listData = append(listData, item)
  30 + }
  31 + return listData
  32 +}
1 package service 1 package service
2 2
3 import ( 3 import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/contractChangeLog/dto"
4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/contractChangeLog/query" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/contractChangeLog/query"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
6 ) 7 )
@@ -12,7 +13,7 @@ func NewContractChangeLogService(options map[string]interface{}) *ContractChange @@ -12,7 +13,7 @@ func NewContractChangeLogService(options map[string]interface{}) *ContractChange
12 return newContractChangeLogService 13 return newContractChangeLogService
13 } 14 }
14 15
15 -func (srv ContractChangeLogService) ContractChangeLogSearch(queryParam *query.ListContractChangeLogQuery) (interface{}, error) { 16 +func (srv ContractChangeLogService) ContractChangeLogSearch(queryParam *query.ListContractChangeLogQuery) (int, interface{}, error) {
16 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(queryParam.Operator) 17 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(queryParam.Operator)
17 result, err := creationCooperationGateway.CooperationContractChangeLogsSearch(allied_creation_cooperation.ReqContractChangeLogsSearch{ 18 result, err := creationCooperationGateway.CooperationContractChangeLogsSearch(allied_creation_cooperation.ReqContractChangeLogsSearch{
18 PageNumber: queryParam.PageNumber, 19 PageNumber: queryParam.PageNumber,
@@ -20,5 +21,6 @@ func (srv ContractChangeLogService) ContractChangeLogSearch(queryParam *query.Li @@ -20,5 +21,6 @@ func (srv ContractChangeLogService) ContractChangeLogSearch(queryParam *query.Li
20 CooperationContractNumber: queryParam.CooperationContractNumber, 21 CooperationContractNumber: queryParam.CooperationContractNumber,
21 OperationType: queryParam.OperationType, 22 OperationType: queryParam.OperationType,
22 }) 23 })
23 - return result, err 24 + listData := dto.ToContractChangeLogList(result)
  25 + return result.Grid.Total, listData, err
24 } 26 }
@@ -66,6 +66,7 @@ func (cooperationModeService *CooperationModeService) ListCooperationMode(listCo @@ -66,6 +66,7 @@ func (cooperationModeService *CooperationModeService) ListCooperationMode(listCo
66 OrganizationName: listCooperationModeQuery.OrganizationName, 66 OrganizationName: listCooperationModeQuery.OrganizationName,
67 CompanyId: listCooperationModeQuery.Operator.CompanyId, 67 CompanyId: listCooperationModeQuery.Operator.CompanyId,
68 UserId: 0, 68 UserId: 0,
  69 + OrgIds: listCooperationModeQuery.Operator.OrgIds,
69 OrgId: 0, 70 OrgId: 0,
70 UserBaseId: 0, 71 UserBaseId: 0,
71 }) 72 })
@@ -7,5 +7,5 @@ import ( @@ -7,5 +7,5 @@ import (
7 type CooperationProjectSelectorQuery struct { 7 type CooperationProjectSelectorQuery struct {
8 //操作人 8 //操作人
9 Operator domain.Operator `json:"-"` 9 Operator domain.Operator `json:"-"`
10 - MatchCooperationProjectNumber string `json:"matchCooperationProjectNumber"` //匹配项目编号 10 + MatchCooperationProjectNumber string `json:"matchCooperationProjectNumber"` //匹配项目编号 matchCooperationProjectNumber
11 } 11 }
@@ -102,6 +102,7 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje @@ -102,6 +102,7 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje
102 //项目名 102 //项目名
103 CooperationProjectName: listCooperationProjectQuery.CooperationProjectName, 103 CooperationProjectName: listCooperationProjectQuery.CooperationProjectName,
104 CompanyId: listCooperationProjectQuery.Operator.CompanyId, 104 CompanyId: listCooperationProjectQuery.Operator.CompanyId,
  105 + OrgIds: listCooperationProjectQuery.Operator.OrgIds,
105 }) 106 })
106 if err != nil { 107 if err != nil {
107 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 108 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -146,16 +147,11 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro @@ -146,16 +147,11 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
146 func (cooperationProjectService *CooperationProjectService) ListCooperationProjectSelector(listCooperationProjectQuery *query.CooperationProjectSelectorQuery) (int64, interface{}, error) { 147 func (cooperationProjectService *CooperationProjectService) ListCooperationProjectSelector(listCooperationProjectQuery *query.CooperationProjectSelectorQuery) (int64, interface{}, error) {
147 148
148 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationProjectQuery.Operator) 149 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationProjectQuery.Operator)
149 - orgIds := []string{}  
150 - for _, v := range listCooperationProjectQuery.Operator.OrgIds {  
151 - idStr := strconv.Itoa(int(v))  
152 - orgIds = append(orgIds, idStr)  
153 - }  
154 result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ 150 result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
155 PageSize: 999, 151 PageSize: 999,
156 CooperationProjectNumber: listCooperationProjectQuery.MatchCooperationProjectNumber, 152 CooperationProjectNumber: listCooperationProjectQuery.MatchCooperationProjectNumber,
157 CompanyId: listCooperationProjectQuery.Operator.CompanyId, 153 CompanyId: listCooperationProjectQuery.Operator.CompanyId,
158 - OrgIds: orgIds, 154 + OrgIds: listCooperationProjectQuery.Operator.OrgIds,
159 }) 155 })
160 if err != nil { 156 if err != nil {
161 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 157 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -223,7 +223,7 @@ type ( @@ -223,7 +223,7 @@ type (
223 //共创申请一键审核 223 //共创申请一键审核
224 type ( 224 type (
225 ReqCooperationApplicationOneclickApproval struct { 225 ReqCooperationApplicationOneclickApproval struct {
226 - CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //审核描述 226 + CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"` //审核描述
227 Action int `json:"action"` //审核动作,1同意,2拒绝 227 Action int `json:"action"` //审核动作,1同意,2拒绝
228 Code string `cname:"菜单编码" json:"code" valid:"Required"` 228 Code string `cname:"菜单编码" json:"code" valid:"Required"`
229 } 229 }
@@ -165,6 +165,7 @@ type ( @@ -165,6 +165,7 @@ type (
165 OrgId int64 `json:"orgId"` 165 OrgId int64 `json:"orgId"`
166 UserId int64 `json:"userId"` 166 UserId int64 `json:"userId"`
167 UserBaseId int64 `json:"userBaseId"` 167 UserBaseId int64 `json:"userBaseId"`
  168 + OrgIds []int64 `json:"orgIds"`
168 //模式编码列表 169 //模式编码列表
169 CooperationModeNumbers []string `cname:"模式编码列表" json:"cooperationModeNumbers,omitempty"` 170 CooperationModeNumbers []string `cname:"模式编码列表" json:"cooperationModeNumbers,omitempty"`
170 } 171 }
@@ -158,7 +158,7 @@ type ( @@ -158,7 +158,7 @@ type (
158 Status int `json:"status"` 158 Status int `json:"status"`
159 // 组织机构ID 159 // 组织机构ID
160 OrgId int64 `cname:"组织机构ID" json:"orgId"` 160 OrgId int64 `cname:"组织机构ID" json:"orgId"`
161 - OrgIds []string `json:"orgIds"` 161 + OrgIds []int64 `json:"orgIds"`
162 CompanyId int64 `json:"companyId"` 162 CompanyId int64 `json:"companyId"`
163 CooperationProjectNumber string `json:"cooperationProjectNumber"` 163 CooperationProjectNumber string `json:"cooperationProjectNumber"`
164 //OffsetLimitFlag bool `json:"offsetLimitFlag"` 164 //OffsetLimitFlag bool `json:"offsetLimitFlag"`
@@ -20,6 +20,6 @@ func (controller *ContractChangeLogController) ContractChangeLogSearch() { @@ -20,6 +20,6 @@ func (controller *ContractChangeLogController) ContractChangeLogSearch() {
20 return 20 return
21 } 21 }
22 listContractChangeLogQuery.Operator = controller.GetOperator() 22 listContractChangeLogQuery.Operator = controller.GetOperator()
23 - data, err := cooperationContractService.ContractChangeLogSearch(listContractChangeLogQuery)  
24 - controller.Response(data, err) 23 + cnt, listData, err := cooperationContractService.ContractChangeLogSearch(listContractChangeLogQuery)
  24 + controller.ReturnPageListData(int64(cnt), listData, err, listContractChangeLogQuery.PageNumber)
25 } 25 }
1 package web_client 1 package web_client
2 2
3 import ( 3 import (
4 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command" 4 + "errors"
5 "path/filepath" 5 "path/filepath"
  6 + "strings"
  7 +
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command"
6 9
7 "github.com/beego/beego/v2/server/web/context" 10 "github.com/beego/beego/v2/server/web/context"
8 "github.com/linmadan/egglib-go/utils/excel" 11 "github.com/linmadan/egglib-go/utils/excel"
@@ -29,6 +32,17 @@ func (controller *ExcelDataController) responseExcelByFile(ctx *context.Context, @@ -29,6 +32,17 @@ func (controller *ExcelDataController) responseExcelByFile(ctx *context.Context,
29 return nil 32 return nil
30 } 33 }
31 34
  35 +func (controller *ExcelDataController) fieldValueAllEmpty(param map[string]string) bool {
  36 + isAllEmpty := true
  37 + for _, v := range param {
  38 + value := strings.TrimSpace(v)
  39 + if len(value) > 0 {
  40 + isAllEmpty = false
  41 + }
  42 + }
  43 + return isAllEmpty
  44 +}
  45 +
32 //导出公司用户 46 //导出公司用户
33 func (controller ExcelDataController) ExportCompanyUser() { 47 func (controller ExcelDataController) ExportCompanyUser() {
34 excelService := service.NewExcelDataService(nil) 48 excelService := service.NewExcelDataService(nil)
@@ -91,12 +105,14 @@ func (controller ExcelDataController) ImportDividendsOrder() { @@ -91,12 +105,14 @@ func (controller ExcelDataController) ImportDividendsOrder() {
91 controller.Response(nil, err) 105 controller.Response(nil, err)
92 return 106 return
93 } 107 }
94 - if filepath.Ext(fileHeader.Filename) == "" { 108 + if filepath.Ext(fileHeader.Filename) != ".xlsx" {
95 //TODO 判断文件类型 109 //TODO 判断文件类型
96 log.Logger.Error("获取到的文件:" + fileHeader.Filename) 110 log.Logger.Error("获取到的文件:" + fileHeader.Filename)
  111 + controller.Response(nil, errors.New("上传到的文件类型错误"))
  112 + return
97 } 113 }
98 excelImport := excel.NewExcelImport() 114 excelImport := excel.NewExcelImport()
99 - excelImport.RowBegin = 3 //第三行开始读取 115 + excelImport.RowBegin = 2 //第2行开始读取
100 excelImport.DataFields = []excel.DataField{ 116 excelImport.DataFields = []excel.DataField{
101 {EnName: "OriginalOrderNum", CnName: "*来源单号"}, 117 {EnName: "OriginalOrderNum", CnName: "*来源单号"},
102 {EnName: "DividendsCustomerName", CnName: "*客户名称"}, 118 {EnName: "DividendsCustomerName", CnName: "*客户名称"},
@@ -117,17 +133,21 @@ func (controller ExcelDataController) ImportDividendsOrder() { @@ -117,17 +133,21 @@ func (controller ExcelDataController) ImportDividendsOrder() {
117 //订单数据 133 //订单数据
118 var returnedOrderData []allied_creation_cooperation.ImportDividendsOrderData 134 var returnedOrderData []allied_creation_cooperation.ImportDividendsOrderData
119 for _, v := range excelData { 135 for _, v := range excelData {
  136 + if allEmpty := controller.fieldValueAllEmpty(v); allEmpty {
  137 + //以全字段空跳过
  138 + continue
  139 + }
120 //TODO 按需转化 140 //TODO 按需转化
121 item := allied_creation_cooperation.ImportDividendsOrderData{ 141 item := allied_creation_cooperation.ImportDividendsOrderData{
122 - OriginalOrderNum: v["OriginalOrderNum"],  
123 - DividendsCustomerName: v["DividendsCustomerName"],  
124 - OrderGoodName: v["OrderGoodName"],  
125 - OrderTime: v["OrderTime"],  
126 - RegionName: v["RegionName"],  
127 - OrderGoodQuantity: v["OrderGoodQuantity"],  
128 - OrderGoodPrice: v["OrderGoodPrice"],  
129 - Expense: v["Expense"],  
130 - CooperationContractNumber: v["CooperationContractNumber"], 142 + OriginalOrderNum: strings.TrimSpace(v["OriginalOrderNum"]),
  143 + DividendsCustomerName: strings.TrimSpace(v["DividendsCustomerName"]),
  144 + OrderGoodName: strings.TrimSpace(v["OrderGoodName"]),
  145 + OrderTime: strings.TrimSpace(v["OrderTime"]),
  146 + RegionName: strings.TrimSpace(v["RegionName"]),
  147 + OrderGoodQuantity: strings.TrimSpace(v["OrderGoodQuantity"]),
  148 + OrderGoodPrice: strings.TrimSpace(v["OrderGoodPrice"]),
  149 + Expense: strings.TrimSpace(v["Expense"]),
  150 + CooperationContractNumber: strings.TrimSpace(v["CooperationContractNumber"]),
131 } 151 }
132 returnedOrderData = append(returnedOrderData, item) 152 returnedOrderData = append(returnedOrderData, item)
133 } 153 }
@@ -150,12 +170,14 @@ func (controller ExcelDataController) ImportDividendsReturnedOrder() { @@ -150,12 +170,14 @@ func (controller ExcelDataController) ImportDividendsReturnedOrder() {
150 controller.Response(nil, err) 170 controller.Response(nil, err)
151 return 171 return
152 } 172 }
153 - if filepath.Ext(fileHeader.Filename) == "" { 173 + if filepath.Ext(fileHeader.Filename) != ".xlsx" {
154 //TODO 判断文件类型 174 //TODO 判断文件类型
155 - log.Logger.Error("获取到的文件:" + fileHeader.Filename) 175 + log.Logger.Error("获取到的文件:" + filepath.Ext(fileHeader.Filename))
  176 + controller.Response(nil, errors.New("上传的文件类型错误"))
  177 + return
156 } 178 }
157 excelImport := excel.NewExcelImport() 179 excelImport := excel.NewExcelImport()
158 - excelImport.RowBegin = 3 //第三行开始读取 180 + excelImport.RowBegin = 2 //第2行表头开始读取
159 excelImport.DataFields = []excel.DataField{ 181 excelImport.DataFields = []excel.DataField{
160 {EnName: "OriginalOrderNum", CnName: "*来源单号"}, 182 {EnName: "OriginalOrderNum", CnName: "*来源单号"},
161 {EnName: "DividendsReturnedCustomerName", CnName: "*客户名称"}, 183 {EnName: "DividendsReturnedCustomerName", CnName: "*客户名称"},
@@ -176,17 +198,21 @@ func (controller ExcelDataController) ImportDividendsReturnedOrder() { @@ -176,17 +198,21 @@ func (controller ExcelDataController) ImportDividendsReturnedOrder() {
176 //退货单数据 198 //退货单数据
177 returnedOrderData := []allied_creation_cooperation.ImportDividendsReturnedOrderData{} 199 returnedOrderData := []allied_creation_cooperation.ImportDividendsReturnedOrderData{}
178 for _, v := range excelData { 200 for _, v := range excelData {
  201 + if allEmpty := controller.fieldValueAllEmpty(v); allEmpty {
  202 + //以全字段空跳过
  203 + continue
  204 + }
179 //TODO 按需转化 205 //TODO 按需转化
180 item := allied_creation_cooperation.ImportDividendsReturnedOrderData{ 206 item := allied_creation_cooperation.ImportDividendsReturnedOrderData{
181 - OriginalOrderNum: v["OriginalOrderNum"],  
182 - DividendsReturnedCustomerName: v["DividendsReturnedCustomerName"],  
183 - OrderGoodName: v["OrderGoodName"],  
184 - DividendsReturnedDate: v["DividendsReturnedDate"],  
185 - OrderTime: v["OrderTime"],  
186 - RegionName: v["RegionName"],  
187 - OrderGoodQuantity: v["OrderGoodQuantity"],  
188 - OrderGoodPrice: v["OrderGoodPrice"],  
189 - CooperationContractNumber: v["CooperationContractNumber"], 207 + OriginalOrderNum: strings.TrimSpace(v["OriginalOrderNum"]),
  208 + DividendsReturnedCustomerName: strings.TrimSpace(v["DividendsReturnedCustomerName"]),
  209 + OrderGoodName: strings.TrimSpace(v["OrderGoodName"]),
  210 + DividendsReturnedDate: strings.TrimSpace(v["DividendsReturnedDate"]),
  211 + OrderTime: strings.TrimSpace(v["OrderTime"]),
  212 + RegionName: strings.TrimSpace(v["RegionName"]),
  213 + OrderGoodQuantity: strings.TrimSpace(v["OrderGoodQuantity"]),
  214 + OrderGoodPrice: strings.TrimSpace(v["OrderGoodPrice"]),
  215 + CooperationContractNumber: strings.TrimSpace(v["CooperationContractNumber"]),
190 } 216 }
191 returnedOrderData = append(returnedOrderData, item) 217 returnedOrderData = append(returnedOrderData, item)
192 } 218 }
@@ -6,5 +6,5 @@ import ( @@ -6,5 +6,5 @@ import (
6 ) 6 )
7 7
8 func init() { 8 func init() {
9 - web.Router("/v1/web/contract-change-logs/search", &web_client.ContractChangeLogController{}, "Put:ContractChangeLogSearch") 9 + web.Router("/v1/web/contract-change-logs/search", &web_client.ContractChangeLogController{}, "Post:ContractChangeLogSearch")
10 } 10 }