作者 yangfu
... ... @@ -122,7 +122,7 @@ spec:
- name: SUPLUS_SALE_APP
value: "http://suplus-sale-app-gateway-test.fjmaimaimai.com"
- name: ALLIED_CREATION_REPORTING_SYSTEM
value: "https://allied-creation-reporting-system-dev.fjmaimaimai.com"
value: "http://allied-creation-reporting-system-dev.fjmaimaimai.com"
# - name: REDIS_HOST
# valueFrom:
# configMapKeyRef:
... ...
... ... @@ -26,6 +26,7 @@ func (dto *DepartmentUsersDto) LoadDto(dataType int, subDepartment *allied_creat
if dataType == 1 {
for i := range userSearch.Users {
user := userSearch.Users[i]
user.UserInfo.UserCode = user.UserCode
dto.Users = append(dto.Users, map[string]interface{}{
"userId": user.UserId,
"userInfo": user.UserInfo,
... ...
package query
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/cost_structured"
)
type CostDailyFillingAbnormalLogQuery struct {
*cost_structured.SearchDailyFillingAbnormalLogRequest
//操作人
Operator domain.Operator `json:"-"`
SelectedField []string `json:"selectedField"`
}
... ...
... ... @@ -3,6 +3,7 @@ package service
import (
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/cost_structured"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
... ... @@ -137,3 +138,15 @@ func (srv ExcelDataService) ExportWorkshopAttendanceStatics(cmd *query.Manufactu
}
return ExportWorkshopAttendanceStaticsData{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
}
// ExportDailyFillingAbnormalLog 导出每日 填报异常日志记录
func (srv ExcelDataService) ExportDailyFillingAbnormalLog(cmd *query.CostDailyFillingAbnormalLogQuery) (ExportDailyFillingAbnormalLog, error) {
creationUserGateway := cost_structured.NewHttpLibCostStructured(cmd.Operator)
cmd.PageNumber = 1
cmd.PageSize = 10000
result, err := creationUserGateway.SearchDailyFillingAbnormalLog(*cmd.SearchDailyFillingAbnormalLogRequest)
if err != nil {
return ExportDailyFillingAbnormalLog{}, fmt.Errorf("获取每日填报异常日志记录数据失败:%w", err)
}
return ExportDailyFillingAbnormalLog{SourceData: result.Grid.List, SelectedField: cmd.SelectedField}, nil
}
... ...
... ... @@ -271,6 +271,15 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
{EnName: "benchmark", CnName: "标杆值"},
{EnName: "highest", CnName: "历史最高值"},
{EnName: "yesterdayActual", CnName: "昨日实际值"},
{EnName: "desiredValue", CnName: "主干-理想值"},
{EnName: "indicatedValue", CnName: "主干-考核值"},
{EnName: "factoryPriceDesiredValue", CnName: "树桩-出厂价-理想值"},
{EnName: "factoryPriceIndicatedValue", CnName: "树桩-出厂价-考核值"},
{EnName: "factoryPriceActualValue", CnName: "树桩-出厂价-现状值"},
{EnName: "costPriceDesiredValue", CnName: "树桩-成本-理想值"},
{EnName: "costPriceIndicatedValue", CnName: "树桩-成本-考核值"},
{EnName: "costPriceActualValue", CnName: "树桩-成本-现状值"},
}
var buf bytes.Buffer
tee := io.TeeReader(importDataCommand.Reader, &buf)
... ... @@ -381,6 +390,15 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm
Highest: strings.TrimSpace(v["highest"]),
YesterdayActual: strings.TrimSpace(v["yesterdayActual"]),
Types: importCostCommand.Types,
DesiredValue: strings.TrimSpace(v["desiredValue"]),
IndicatedValue: strings.TrimSpace(v["indicatedValue"]),
FactoryPriceDesiredValue: strings.TrimSpace(v["factoryPriceDesiredValue"]),
FactoryPriceIndicatedValue: strings.TrimSpace(v["factoryPriceIndicatedValue"]),
FactoryPriceActualValue: strings.TrimSpace(v["factoryPriceActualValue"]),
CostPriceDesiredValue: strings.TrimSpace(v["costPriceDesiredValue"]),
CostPriceIndicatedValue: strings.TrimSpace(v["costPriceIndicatedValue"]),
CostPriceActualValue: strings.TrimSpace(v["costPriceActualValue"]),
}
if len(ossFile) > 0 {
item.Urls = ossFile
... ... @@ -458,7 +476,7 @@ func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.Import
domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743214_rNHm6ZBXZaC5xKTrsE7M4h45MY6n6Ff3.xlsx",
domain.ImportProducts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220120/object/1642670543_cbraNKjNPHcbN6RNBYQBrwhC7BXGbDWp.xlsx",
domain.ImportDevices: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20220126/object/1643184320_hT6sY5BKHmBa4TynfSGSCGyZ2KTTtzkj.xlsx",
domain.ImportCosts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/test/20220318/object/1647587204_B5azRmr2TB73jRKWsnFyDe4yxXJWnrDT.xlsx",
domain.ImportCosts: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/opportunity/dev_online/20220526/object/1653555125_NGNbjmKpxCyks5CwztFsfj2dBNWerks5.xlsx",
}
var url string
var ok bool
... ...
package service
import (
"github.com/linmadan/egglib-go/utils/excel"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/cost_structured"
)
//ExportDailyFillingAbnormalLog 导出每日 填报异常日志记录
type ExportDailyFillingAbnormalLog struct {
SourceData []cost_structured.DailyFillingAbnormalLogItem
SelectedField []string
}
var _ excel.ExcelMaker = (*ExportWorkshopAttendanceStaticsData)(nil)
func (data ExportDailyFillingAbnormalLog) AllFields() []DataFieldOptions {
return []DataFieldOptions{
{EnName: "abnormalTypeDescription", CnName: "异常类型"},
{EnName: "projectTypeDescription", CnName: "项目分类"},
{EnName: "projectName", CnName: "项目名称"},
{EnName: "itemName", CnName: "细项名称"},
{EnName: "userName", CnName: "负责人"},
{EnName: "actualValue", CnName: "现状值"},
{EnName: "targetValue", CnName: "目标值"},
{EnName: "remark", CnName: "填报说明"},
{EnName: "createdAt", CnName: "异常日期"},
}
}
func (data ExportDailyFillingAbnormalLog) DataFieldList() []excel.DataField {
fields := []excel.DataField{}
allFields := data.AllFields()
for _, value2 := range allFields {
if len(data.SelectedField) == 0 || value2.IsDefault {
fields = append(fields, excel.DataField{EnName: value2.EnName, CnName: value2.CnName})
continue
}
for _, value3 := range data.SelectedField {
if value2.EnName == value3 {
fields = append(fields, excel.DataField{EnName: value2.EnName, CnName: value2.CnName})
}
}
}
return fields
}
func (data ExportDailyFillingAbnormalLog) CellValue(index int, enName string) (value interface{}) {
if index > data.DataListLen() {
return ""
}
switch enName {
case "abnormalTypeDescription":
return data.SourceData[index].AbnormalTypeDescription
case "projectTypeDescription":
return data.SourceData[index].ProjectTypeDescription
case "projectName":
return data.SourceData[index].ProjectName
case "itemName":
return data.SourceData[index].ItemName
case "userName":
return data.SourceData[index].UserName
case "actualValue":
return data.SourceData[index].ActualValue
case "targetValue":
return data.SourceData[index].TargetValue
case "remark":
return data.SourceData[index].Remark
case "createdAt":
return data.SourceData[index].CreatedAt
}
return nil
}
func (data ExportDailyFillingAbnormalLog) DataListLen() int {
return len(data.SourceData)
}
func (data ExportDailyFillingAbnormalLog) TableTitle() []string {
return nil
}
... ...
... ... @@ -65,6 +65,35 @@ type CostManagemant struct {
Types int `json:"types"`
// 昨日实际值
YesterdayActual string `json:"yesterdayActual"`
// 出厂价-理想值
FactoryPriceDesiredValue string `json:"factoryPriceDesiredValue"`
// 成本-理想值
CostPriceDesiredValue string `json:"costPriceDesiredValue"`
// 毛利-理想值
ProfitPriceDesiredValue string `json:"profitPriceDesiredValue"`
// 毛利率-理想值
ProfitProportionDesiredValue string `json:"profitProportionDesiredValue"`
// 出厂价-考核值
FactoryPriceIndicatedValue string `json:"factoryPriceIndicatedValue"`
// 成本-考核值
CostPriceIndicatedValue string `json:"costPriceIndicatedValue"`
// 毛利-考核值
ProfitPriceIndicatedValue string `json:"profitPriceIndicatedValue"`
// 毛利率-考核值
ProfitProportionIndicatedValue string `json:"profitProportionIndicatedValue"`
// 出厂价-现状值
FactoryPriceActualValue string `json:"factoryPriceActualValue"`
// 成本-现状值
CostPriceActualValue string `json:"costPriceActualValue"`
// 毛利-现状值
ProfitPriceActualValue string `json:"profitPriceActualValue"`
// 毛利率-现状值
ProfitProportionActualValue string `json:"profitProportionActualValue"`
// 理想值
DesiredValue string `json:"desiredValue"`
// 考核值
IndicatedValue string `json:"indicatedValue"`
}
type NodeType struct {
... ... @@ -109,4 +138,4 @@ func GetTargetPeriod(targetPeriod string) int {
return 0
}
return -1
}
\ No newline at end of file
}
... ...
... ... @@ -91,6 +91,9 @@ const (
ExportManufactureEmployeeAttendanceStatics = "ExportManufactureEmployeeAttendanceStatics"
// 车间工时
ExportManufactureWorkshopAttendanceStatics = "ExportManufactureWorkshopAttendanceStatics"
// 成本结构化 - 每日填报异常日志
ExportCostStructuredDailyFillingAbnormalLog = "ExportCostStructuredDailyFillingAbnormalLog"
)
const (
... ...
package cost_structured
import "fmt"
type (
SearchDailyFillingAbnormalLogRequest struct {
//页码
PageNumber int64 `json:"pageNumber" valid:"Required"`
//每页显示数目
PageSize int64 `json:"pageSize" valid:"Required"`
// 1:填报异常 2.结果异常
AbnormalType int `cname:"1:填报异常 2.结果异常" json:"abnormalType"`
// 项目分类 风险|成本
ProjectType int `cname:"项目分类 风险|成本" json:"projectType,omitempty"`
// 项目id
ProjectId int64 `cname:"项目id" json:"projectId,string,omitempty"`
// 细项名称
ItemName string `cname:"细项名称" json:"itemName,omitempty"`
// 负责人名称
PrincipalName string `cname:"负责人名称" json:"principalName,omitempty"`
//开始时间
BeginTime string `json:"beginTime,omitempty"`
//结束时间
EndTime string `json:"endTime,omitempty"`
}
SearchDailyFillingAbnormalLogResponse struct {
Grid struct {
List []DailyFillingAbnormalLogItem `json:"list"`
Total int `json:"total"`
} `json:"grid"`
}
DailyFillingAbnormalLogItem struct {
DailyFillingAbnormalLogID int `json:"dailyFillingAbnormalLogId"`
AbnormalType int `json:"abnormalType"`
ProjectType int `json:"projectType"`
ProjectID int64 `json:"projectId"`
CostManagementID int64 `json:"costManagementId"`
UserName string `json:"userName"`
ProjectName string `json:"projectName"`
ItemName string `json:"itemName"`
TargetValue string `json:"targetValue"`
ActualValue string `json:"actualValue"`
Remark string `json:"remark"`
CreatedAt string `json:"createdAt"`
AbnormalTypeDescription string `json:"abnormalTypeDescription"`
ProjectTypeDescription string `json:"projectTypeDescription"`
}
)
//SearchEmployeeAttendanceStatics 搜索员工工时统计
func (gateway HttpLibCostStructured) SearchDailyFillingAbnormalLog(param SearchDailyFillingAbnormalLogRequest) (*SearchDailyFillingAbnormalLogResponse, error) {
url := fmt.Sprintf("%s%s", gateway.BaseUrl(), "/daily-filling-abnormal-logs/search")
method := "post"
var data SearchDailyFillingAbnormalLogResponse
err := gateway.FastDoRequest(url, method, param, &data)
return &data, err
}
... ...
... ... @@ -72,7 +72,7 @@ func init() {
web.InsertFilter("/v1/cost/*", web.BeforeRouter, middleware.CheckAccessToken())
web.InsertFilter("/v1/cost/*", web.BeforeRouter, middleware.RedirectInternalService("/v1/cost", cost_structured.NewHttpLibCostStructured(domain.Operator{})))
web.InsertFilter("/v1/chart-editor/*", web.BeforeRouter, middleware.CheckAccessToken())
web.InsertFilter("/v1/chart-editor/*", web.BeforeRouter, middleware.RedirectInternalService("/chart-editor", chart_editor.NewHttpLibAlliedChartEditor(domain.Operator{})))
web.InsertFilter("/v1/chart-editor/*", web.BeforeRouter, middleware.RedirectInternalService("/v1/chart-editor", chart_editor.NewHttpLibAlliedChartEditor(domain.Operator{})))
}
func AllowCors() func(ctx *context.Context) {
... ...
... ... @@ -187,14 +187,14 @@ func (controller *ExcelDataController) FileImport() {
func defaultImport(controller *ExcelDataController) {
var (
data interface{}
err error
r io.Reader
ext string
data interface{}
err error
r io.Reader
ext string
fileName string
)
excelService := service.NewExcelDataService(nil)
r, ext,fileName, err = controller.GetFileWithExt()
r, ext, fileName, err = controller.GetFileWithExt()
if err != nil {
controller.Response(nil, err)
return
... ... @@ -217,7 +217,7 @@ func defaultImport(controller *ExcelDataController) {
case domain.ImportDevices:
data, err = excelService.ImportDevice(cmd)
case domain.ImportCosts:
data,err = excelService.ImportCost(cmd)
data, err = excelService.ImportCost(cmd)
default:
err = fmt.Errorf("导入不存在 Code:%v", cmd.Code)
}
... ... @@ -300,6 +300,13 @@ func fileExport(controller *ExcelDataController, code string) {
companyUserListQuery.Operator = exportDataCommand.Operator
data, err = excelService.ExportWorkshopAttendanceStatics(companyUserListQuery)
filename = "导出车间工时汇总"
case domain.ExportCostStructuredDailyFillingAbnormalLog:
query := &query.CostDailyFillingAbnormalLogQuery{}
controllers.Must(exportDataCommand.UnmarshalQuery(query))
query.Operator = exportDataCommand.Operator
data, err = excelService.ExportDailyFillingAbnormalLog(query)
filename = "异常记录"
default:
err = fmt.Errorf("export type :%v not exists", exportDataCommand.Code)
}
... ... @@ -355,6 +362,10 @@ func (controller *ExcelDataController) ExportManufactureWorkshopAttendanceStatic
fileExport(controller, domain.ExportManufactureWorkshopAttendanceStatics)
}
func (controller *ExcelDataController) ExportCostStructuredDailyFillingAbnormalLog() {
fileExport(controller, domain.ExportCostStructuredDailyFillingAbnormalLog)
}
//GetExcelDataFields 获取导出excel数据的可选字段
func (controller *ExcelDataController) GetExcelDataFields() {
code := controller.GetString(":code")
... ...
... ... @@ -7,6 +7,7 @@ import (
"github.com/beego/beego/v2/server/web"
"github.com/beego/beego/v2/server/web/context"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
"io/ioutil"
"net/http"
"strings"
... ... @@ -39,7 +40,7 @@ func RedirectInternalService(prefix string, svr internalService) web.FilterFunc
method := strings.ToLower(ctx.Request.Method)
url := strings.Replace(ctx.Request.RequestURI, prefix, "", 1)
req := svr.CreateRequest(svr.BaseUrl()+url, method)
log.Logger.Debug(method + " 请求url:" + svr.BaseUrl() + url)
// 传递当前登录信息(可配置)
loginToken, ok := FormCtxLoginToken(ctx)
if ok && loginToken.CompanyId > 0 && loginToken.OrgId > 0 {
... ... @@ -52,7 +53,6 @@ func RedirectInternalService(prefix string, svr internalService) web.FilterFunc
}
req.Header("orgIds", fmt.Sprintf("%v", strings.Join(orgIdList, ",")))
}
req.Body(ctx.Input.RequestBody)
response, err := req.Response()
if err != nil {
... ...
... ... @@ -15,6 +15,8 @@ func init() {
web.Router("/v1/web/excel/export/manufacture-employee-attendance-statics", &web_client.ExcelDataController{}, "Post:ExportManufactureEmployeeAttendanceStatics")
web.Router("/v1/web/excel/export/manufacture-workshop-attendance-statics", &web_client.ExcelDataController{}, "Post:ExportManufactureWorkshopAttendanceStatics")
web.Router("/v1/web/excel/export/cost-structured-daily-filling-abnormal-log", &web_client.ExcelDataController{}, "Post:ExportCostStructuredDailyFillingAbnormalLog")
web.Router("/v1/web/excel/import/dividends-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsOrder")
web.Router("/v1/web/excel/import/dividends-returned-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsReturnedOrder")
... ...