123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139 |
- package v1
- import (
- "fmt"
- "git.getensh.com/common/gopkgs/logger"
- "git.getensh.com/common/gopkgs/tasker/httptasker"
- "git.getensh.com/common/gopkgs/util"
- "github.com/gin-gonic/gin"
- "github.com/tealeg/xlsx"
- "go.uber.org/zap"
- "google.golang.org/grpc/status"
- "net/http"
- "os"
- "path"
- "property-system-gateway/errors"
- param_v1 "property-system-gateway/param/v1"
- "property-system-gateway/parser"
- "property-system-gateway/pb"
- "property-system-gateway/pb/v1"
- "property-system-gateway/utils"
- "strconv"
- "strings"
- "time"
- )
- //
- // @Summary 添加楼栋管家
- // @Description 添加楼栋管家
- // @Tags 楼栋管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param body body v1.BuildingAddManagerBody true " "
- // @Success 200 {object} v1.BuildingAddManagerResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/manager [post]
- func (c *Controller) BuildingAddManager(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.BuildingAddManagerRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.BuildingAddManagerBody)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.BuildingAddManagerResponse{}
- rpcReq := &v1.BuildingAddManagerRequest{
- GardenId: tokenInfo.GardenId,
- BuildingId: req.BuildingId,
- ManagerUid: req.ManagerUid,
- }
- _, err = pb.Garden.BuildingAddManager(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.BuildingAddManager"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 删除楼栋管家
- // @Description 删除楼栋管家
- // @Tags 楼栋管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param id query int true "经纪人与楼栋的关系id"
- // @Success 200 {object} v1.BuildingDelManagerResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/manager [delete]
- func (c *Controller) BuildingDelManager(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.BuildingDelManagerRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, &req.BuildingDelManagerQuery, nil)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.BuildingDelManagerResponse{}
- rpcReq := &v1.BuildingDelManagerRequest{
- GardenId: tokenInfo.GardenId,
- Id: req.Id,
- }
- _, err = pb.Garden.BuildingDelManager(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.BuildingDelManager"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 楼栋管家列表
- // @Description 楼栋管家列表
- // @Tags 楼栋管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param building_id query int true "楼栋id"
- // @Success 200 {object} v1.BuildingManagerListResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/manager [get]
- func (c *Controller) BuildingManagerList(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.BuildingManagerListRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, &req.BuildingManagerListQuery, nil)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.BuildingManagerListResponse{}
- rpcReq := &v1.BuildingManagerListRequest{
- GardenId: tokenInfo.GardenId,
- BuildingId: req.BuildingId,
- }
- rpcRsp, err := pb.Garden.BuildingManagerList(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.BuildingManagerList"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- if rpcRsp.List == nil {
- rpcRsp.List = make([]*v1.BuildingManagerItem, 0)
- }
- resp.Data = *rpcRsp
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 添加楼栋
- // @Description 添加楼栋
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param body body v1.BuildingAddBody true "信息"
- // @Success 200 {object} v1.BuildingAddResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/building [post]
- func (c *Controller) BuildingAdd(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.BuildingAddRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.BuildingAddBody)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.BuildingAddResponse{}
- rpcReq := &v1.BuildingAddRequest{
- GardenId: tokenInfo.GardenId,
- BuildingNumber: req.BuildingNumber,
- BuildingName: req.BuildingName,
- BuildingArea: req.BuildingArea,
- BuildingUsedArea: req.BuildingUsedArea,
- Comment: req.Comment,
- }
- rpcRsp, err := pb.Garden.BuildingAdd(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.BuildingAdd"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- resp.Data = *rpcRsp
- ctx.JSON(http.StatusOK, resp)
- logReq := OperationLogRequest{
- Module: ModuleGarden,
- Action: ActionGardenAddBuilding,
- Origin: nil,
- Target: req.BuildingAddBody,
- UserName: tokenInfo.UserName,
- Uid: tokenInfo.Uid,
- Cid: tokenInfo.Cid,
- GardenId: tokenInfo.GardenId,
- }
- go OperationLogAdd(&logReq)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 更改楼栋
- // @Description 更改楼栋
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param body body v1.BuildingUpdateBody true "信息"
- // @Success 200 {object} v1.BuildingUpdateResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/building [put]
- func (c *Controller) BuildingUpdate(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.BuildingUpdateRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.BuildingUpdateBody)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.BuildingUpdateResponse{}
- rpcReq := &v1.BuildingUpdateRequest{
- GardenId: tokenInfo.GardenId,
- BuildingNumber: req.BuildingNumber,
- BuildingName: req.BuildingName,
- BuildingArea: req.BuildingArea,
- BuildingUsedArea: req.BuildingUsedArea,
- Comment: req.Comment,
- Id: req.Id,
- }
- rpcRsp, err := pb.Garden.BuildingUpdate(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.BuildingUpdate"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- ctx.JSON(http.StatusOK, resp)
- logReq := OperationLogRequest{
- Module: ModuleGarden,
- Action: ActionGardenUpdateBuilding,
- Origin: rpcRsp.Origin,
- Target: req.BuildingUpdateBody,
- UserName: tokenInfo.UserName,
- Uid: tokenInfo.Uid,
- Cid: tokenInfo.Cid,
- GardenId: tokenInfo.GardenId,
- }
- go OperationLogAdd(&logReq)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 删除楼栋
- // @Description 删除楼栋
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param id query int true "id"
- // @Success 200 {object} v1.BuildingDelResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/building [delete]
- func (c *Controller) BuildingDel(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.BuildingDelRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, &req.BuildingDelQuery, nil)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.BuildingDelResponse{}
- rpcReq := &v1.BuildingDelRequest{
- GardenId: tokenInfo.GardenId,
- Id: req.Id,
- }
- rpcRsp, err := pb.Garden.BuildingDel(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.BuildingDel"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- ctx.JSON(http.StatusOK, resp)
- logReq := OperationLogRequest{
- Module: ModuleGarden,
- Action: ActionGardenDelBuilding,
- Origin: rpcRsp.Origin,
- Target: nil,
- UserName: tokenInfo.UserName,
- Uid: tokenInfo.Uid,
- Cid: tokenInfo.Cid,
- GardenId: tokenInfo.GardenId,
- }
- go OperationLogAdd(&logReq)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 楼栋列表
- // @Description 楼栋列表
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param page query int false " "
- // @Param page_size query int false " "
- // @Param building_number query string false "楼栋编号"
- // @Success 200 {object} v1.BuildingListResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/building [get]
- func (c *Controller) BuildingList(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.BuildingListRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, &req.BuildingListQuery, nil)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.BuildingListResponse{}
- rpcReq := &v1.BuildingListRequest{
- GardenId: tokenInfo.GardenId,
- BuildingNumber: req.BuildingNumber,
- Page: req.Page,
- PageSize: req.PageSize,
- }
- rpcRsp, err := pb.Garden.BuildingList(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.BuildingList"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- if rpcRsp.List == nil {
- rpcRsp.List = make([]*v1.BuildingItem, 0)
- }
- resp.Data = *rpcRsp
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 添加单元
- // @Description 添加单元
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param body body v1.UnitAddBody true "信息"
- // @Success 200 {object} v1.UnitAddResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/unit [post]
- func (c *Controller) UnitAdd(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.UnitAddRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.UnitAddBody)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.UnitAddResponse{}
- rpcReq := &v1.UnitAddRequest{
- GardenId: tokenInfo.GardenId,
- UnitNumber: req.UnitNumber,
- UnitName: req.UnitName,
- UnitLayers: req.UnitLayers,
- BuildingId: req.BuildingId,
- HasLift: req.HasLift,
- }
- rpcRsp, err := pb.Garden.UnitAdd(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.UnitAdd"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- resp.Data = *rpcRsp
- ctx.JSON(http.StatusOK, resp)
- logReq := OperationLogRequest{
- Module: ModuleGarden,
- Action: ActionGardenAddUnit,
- Origin: nil,
- Target: req.UnitAddBody,
- UserName: tokenInfo.UserName,
- Uid: tokenInfo.Uid,
- Cid: tokenInfo.Cid,
- GardenId: tokenInfo.GardenId,
- }
- go OperationLogAdd(&logReq)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 更改单元
- // @Description 更改单元
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param body body v1.UnitUpdateBody true "信息"
- // @Success 200 {object} v1.UnitUpdateResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/unit [put]
- func (c *Controller) UnitUpdate(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.UnitUpdateRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.UnitUpdateBody)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.UnitUpdateResponse{}
- rpcReq := &v1.UnitUpdateRequest{
- GardenId: tokenInfo.GardenId,
- UnitNumber: req.UnitNumber,
- UnitName: req.UnitName,
- UnitLayers: req.UnitLayers,
- BuildingId: req.BuildingId,
- HasLift: req.HasLift,
- Id: req.Id,
- }
- rpcRsp, err := pb.Garden.UnitUpdate(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.UnitUpdate"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- ctx.JSON(http.StatusOK, resp)
- logReq := OperationLogRequest{
- Module: ModuleGarden,
- Action: ActionGardenUpdateUnit,
- Origin: rpcRsp.Origin,
- Target: req.UnitUpdateBody,
- UserName: tokenInfo.UserName,
- Uid: tokenInfo.Uid,
- Cid: tokenInfo.Cid,
- GardenId: tokenInfo.GardenId,
- }
- go OperationLogAdd(&logReq)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 删除单元
- // @Description 删除单元
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param id query int true "id"
- // @Success 200 {object} v1.UnitDelResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/unit [delete]
- func (c *Controller) UnitDel(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.UnitDelRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, &req.UnitDelQuery, nil)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.UnitDelResponse{}
- rpcReq := &v1.UnitDelRequest{
- GardenId: tokenInfo.GardenId,
- Id: req.Id,
- }
- rpcRsp, err := pb.Garden.UnitDel(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.UnitDel"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- ctx.JSON(http.StatusOK, resp)
- logReq := OperationLogRequest{
- Module: ModuleGarden,
- Action: ActionGardenDelUnit,
- Origin: rpcRsp.Origin,
- Target: nil,
- UserName: tokenInfo.UserName,
- Uid: tokenInfo.Uid,
- Cid: tokenInfo.Cid,
- GardenId: tokenInfo.GardenId,
- }
- go OperationLogAdd(&logReq)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 单元列表
- // @Description 单元列表
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param page query int false " "
- // @Param page_size query int false " "
- // @Param unit_number query int false "单元编号"
- // @Param building_id query int false "楼栋id"
- // @Success 200 {object} v1.UnitListResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/unit [get]
- func (c *Controller) UnitList(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.UnitListRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, &req.UnitListQuery, nil)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.UnitListResponse{}
- rpcReq := &v1.UnitListRequest{
- GardenId: tokenInfo.GardenId,
- UnitNumber: req.UnitNumber,
- BuildingId: req.BuildingId,
- Page: req.Page,
- PageSize: req.PageSize,
- }
- rpcRsp, err := pb.Garden.UnitList(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.UnitList"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- if rpcRsp.List == nil {
- rpcRsp.List = make([]*v1.UnitItem, 0)
- }
- resp.Data = *rpcRsp
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 添加房屋
- // @Description 添加房屋
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param body body v1.HouseAddBody true "信息"
- // @Success 200 {object} v1.HouseAddResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/house [post]
- func (c *Controller) HouseAdd(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.HouseAddRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.HouseAddBody)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.HouseAddResponse{}
- rpcReq := &v1.HouseAddRequest{
- GardenId: tokenInfo.GardenId,
- UnitId: req.UnitId,
- HouseNumber: req.HouseNumber,
- HouseType: req.HouseType,
- HouseUsedArea: req.HouseUsedArea,
- HouseArea: req.HouseArea,
- Layer: req.Layer,
- RoomCount: req.RoomCount,
- HallCount: req.HallCount,
- BuildingId: req.BuildingId,
- }
- rpcRsp, err := pb.Garden.HouseAdd(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.HouseAdd"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- resp.Data = *rpcRsp
- ctx.JSON(http.StatusOK, resp)
- logReq := OperationLogRequest{
- Module: ModuleGarden,
- Action: ActionGardenAddHouse,
- Origin: nil,
- Target: req.HouseAddBody,
- UserName: tokenInfo.UserName,
- Uid: tokenInfo.Uid,
- Cid: tokenInfo.Cid,
- GardenId: tokenInfo.GardenId,
- }
- go OperationLogAdd(&logReq)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 更改房屋
- // @Description 更改房屋
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param body body v1.HouseUpdateBody true "信息"
- // @Success 200 {object} v1.HouseUpdateResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/house [put]
- func (c *Controller) HouseUpdate(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.HouseUpdateRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.HouseUpdateBody)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.HouseUpdateResponse{}
- rpcReq := &v1.HouseUpdateRequest{
- GardenId: tokenInfo.GardenId,
- UnitId: req.UnitId,
- HouseNumber: req.HouseNumber,
- HouseType: req.HouseType,
- HouseUsedArea: req.HouseUsedArea,
- HouseArea: req.HouseArea,
- Layer: req.Layer,
- RoomCount: req.RoomCount,
- HallCount: req.HallCount,
- Id: req.Id,
- }
- rpcRsp, err := pb.Garden.HouseUpdate(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.HouseUpdate"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- ctx.JSON(http.StatusOK, resp)
- logReq := OperationLogRequest{
- Module: ModuleGarden,
- Action: ActionGardenUpdateHouse,
- Origin: rpcRsp.Origin,
- Target: req.HouseUpdateBody,
- UserName: tokenInfo.UserName,
- Uid: tokenInfo.Uid,
- Cid: tokenInfo.Cid,
- GardenId: tokenInfo.GardenId,
- }
- go OperationLogAdd(&logReq)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 删除房屋
- // @Description 删除房屋
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param id query int true "id"
- // @Success 200 {object} v1.HouseDelResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/house [delete]
- func (c *Controller) HouseDel(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.HouseDelRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, &req.HouseDelQuery, nil)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.HouseDelResponse{}
- rpcReq := &v1.HouseDelRequest{
- GardenId: tokenInfo.GardenId,
- Id: req.Id,
- }
- rpcRsp, err := pb.Garden.HouseDel(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.HouseDel"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- ctx.JSON(http.StatusOK, resp)
- logReq := OperationLogRequest{
- Module: ModuleGarden,
- Action: ActionGardenDelHouse,
- Origin: rpcRsp.Origin,
- Target: nil,
- UserName: tokenInfo.UserName,
- Uid: tokenInfo.Uid,
- Cid: tokenInfo.Cid,
- GardenId: tokenInfo.GardenId,
- }
- go OperationLogAdd(&logReq)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- func handleHouseName(ctx *gin.Context, houseName string, tokenInfo utils.TokenInfo) (int64, int64, string, bool, error) {
- array := strings.Split(houseName, "-")
- if len(array) != 3 && len(array) != 1 {
- return 0, 0, "", false, status.Error(10003, "总房号格式错误")
- }
- // 纯房号
- if len(array) == 1 {
- return 0, 0, array[0], false, nil
- }
- // 先找楼栋
- rpcReq := &v1.BuildingListRequest{
- GardenId: tokenInfo.GardenId,
- BuildingNumber: array[0],
- Page: -1,
- PageSize: -1,
- }
- rpcRsp, err := pb.Garden.BuildingList(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(rpcReq)
- logger.Error("func",
- zap.String("call", "pb.Garden.BuildingList"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return 0, 0, "", false, errors.ErrorTransForm(err)
- }
- if len(rpcRsp.List) == 0 {
- return 0, 0, "", true, nil
- }
- // 再找单元
- buildingId := rpcRsp.List[0].Id
- unitNumber, _ := strconv.Atoi(array[1])
- mReq := &v1.UnitListRequest{
- GardenId: tokenInfo.GardenId,
- BuildingId: buildingId,
- UnitNumber: int64(unitNumber),
- Page: -1,
- PageSize: -1,
- }
- mRsp, err := pb.Garden.UnitList(ctx, mReq)
- if err != nil {
- s, _ := json.MarshalToString(mReq)
- logger.Error("func",
- zap.String("call", "pb.Garden.UnitList"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return 0, 0, "", false, errors.ErrorTransForm(err)
- }
- if len(mRsp.List) == 0 {
- return 0, 0, "", true, nil
- }
- return buildingId, mRsp.List[0].Id, array[2], false, nil
- }
- //
- // @Summary 房屋列表
- // @Description 房屋列表
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param page query int false " "
- // @Param page_size query int false " "
- // @Param house_number query int false "门牌号906"
- // @Param house_name query int false "总房号 1-2-906"
- // @Param building_id query int false "楼栋id"
- // @Param unit_id query int false "单元id"
- // @Param household_uid query int false "住户uid"
- // @Param house_type query int false "房屋类型 1 住宅 2 商铺 3 办公"
- // @Param house_rent query bool false "是否用于房屋租赁 true 是 false 否"
- // @Success 200 {object} v1.HouseListResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/house [get]
- func (c *Controller) HouseList(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.HouseListRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, &req.HouseListQuery, nil)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- resp := param_v1.HouseListResponse{}
- resp.Data = v1.HouseListReply{
- Page: 1,
- Total: 0,
- List: make([]*v1.HouseItem, 0),
- }
- if req.HouseName != "" {
- shouldReturn := false
- var err error
- req.BuildingId, req.UnitId, req.HouseNumber, shouldReturn, err = handleHouseName(ctx, req.HouseName, tokenInfo)
- if err != nil {
- return err
- }
- if shouldReturn {
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- }
- // 响应数据
- rpcReq := &v1.HouseListRequest{
- GardenId: tokenInfo.GardenId,
- HouseNumber: req.HouseNumber,
- HouseType: req.HouseType,
- BuildingId: req.BuildingId,
- UnitId: req.UnitId,
- Page: req.Page,
- PageSize: req.PageSize,
- Uid: req.HouseholdUid,
- HouseRent: req.HouseRent,
- }
- rpcRsp, err := pb.Garden.HouseList(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.HouseList"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- if rpcRsp.List == nil {
- rpcRsp.List = make([]*v1.HouseItem, 0)
- }
- resp.Data = *rpcRsp
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- /*
- //
- // @Summary 批量添加
- // @Description 批量添加
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param body body v1.BatchHouseAddBody true "信息"
- // @Success 200 {object} v1.HouseAddResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/batch [post]
- func (c *Controller) BatchHouseAdd(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.BatchHouseAddRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.BatchHouseAddBody)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.BatchHouseAddResponse{}
- rpcReq := &v1.BatchHouseAddRequest{
- GardenId:tokenInfo.GardenId,
- }
- rpcReq.Buildings = make([]*v1.BatchBuildingItem, len(req.Buildings))
- for i, _ := range req.Buildings {
- rpcReq.Buildings[i] = &req.Buildings[i]
- }
- rpcReq.Units = make([]*v1.BatchUnitItem, len(req.Units))
- for i, _ := range req.Units {
- rpcReq.Units[i] = &req.Units[i]
- }
- rpcReq.Houses = make([]*v1.BatchHouseItem, len(req.Houses))
- for i, _ := range req.Houses {
- rpcReq.Houses[i] = &req.Houses[i]
- }
- _, err = pb.Garden.BatchHouseAdd(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.BatchHouseAdd"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- */
- var HouseTypeM = map[string]int{
- "住宅": 1,
- "商铺": 2,
- "办公": 3,
- }
- func parseHouseImportContent(fileName string) ([]*v1.BatchHouseItem, error) {
- f, err := xlsx.OpenFile(fileName)
- if err != nil {
- return nil, status.Error(10003, "xlsx 打开失败")
- }
- if len(f.Sheets) == 0 {
- return nil, status.Error(10003, "参数文件没有sheet")
- }
- sheet := f.Sheets[0]
- if len(sheet.Rows) == 0 {
- return nil, status.Error(10003, "文件为空")
- }
- if len(sheet.Rows) > 1005 {
- return nil, status.Error(10003, "单次导入不能超过一千条记录, 请分批导入")
- }
- list := []*v1.BatchHouseItem{}
- for i, row := range sheet.Rows {
- if len(row.Cells) < 9 {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i)+"列数错误,请使用模板")
- }
- if i == 0 {
- if row.Cells[0].Value != "楼栋编号" ||
- row.Cells[1].Value != "单元编号" ||
- row.Cells[2].Value != "房屋号" ||
- row.Cells[3].Value != "房屋建筑面积" ||
- row.Cells[4].Value != "房屋使用面积" ||
- row.Cells[5].Value != "楼层" ||
- //row.Cells[6].Value != "房屋类型" ||
- !strings.Contains(row.Cells[6].Value, "房屋类型") ||
- row.Cells[7].Value != "几室" ||
- row.Cells[8].Value != "几厅" {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"标题错误,请使用模板")
- }
- continue
- }
- buidingNumber := strings.TrimSpace(row.Cells[0].Value)
- unitNumberStr := strings.TrimSpace(row.Cells[1].Value)
- houseNumber := strings.TrimSpace(row.Cells[2].Value)
- houseAreaStr := strings.TrimSpace(row.Cells[3].Value)
- houseUsedAreaStr := strings.TrimSpace(row.Cells[4].Value)
- houseLevelStr := strings.TrimSpace(row.Cells[5].Value)
- houseTypeStr := strings.TrimSpace(row.Cells[6].Value)
- roomStr := strings.TrimSpace(row.Cells[7].Value)
- hallStr := strings.TrimSpace(row.Cells[8].Value)
- if buidingNumber == "" && unitNumberStr == "" &&
- houseNumber == "" && houseAreaStr == "" &&
- houseUsedAreaStr == "" && houseLevelStr == "" &&
- houseTypeStr == "" && roomStr == "" && hallStr == "" {
- continue
- }
- if buidingNumber == "" || unitNumberStr == "" ||
- houseNumber == "" || houseAreaStr == "" ||
- houseUsedAreaStr == "" || houseLevelStr == "" ||
- houseTypeStr == "" && roomStr == "" && hallStr == "" {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"参数不能为空")
- }
- unitNumber, err := strconv.Atoi(unitNumberStr)
- if err != nil {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"单元格式错误")
- }
- houseArea, err := strconv.ParseFloat(houseAreaStr, 64)
- if err != nil {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"房屋建筑面积格式错误")
- }
- houseUsedArea, err := strconv.ParseFloat(houseUsedAreaStr, 64)
- if err != nil {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"房屋使用面积面积格式错误")
- }
- houseLevel, err := strconv.Atoi(houseLevelStr)
- if err != nil {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"楼层格式错误")
- }
- roomCount, err := strconv.Atoi(roomStr)
- if err != nil {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"几室格式错误")
- }
- hallCount, err := strconv.Atoi(hallStr)
- if err != nil {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"几厅格式错误")
- }
- houseType := HouseTypeM[houseTypeStr]
- if houseType == 0 {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"不支持的房屋类型,房屋类型只支持住宅、公寓、商铺")
- }
- item := &v1.BatchHouseItem{
- BuildingNumber: buidingNumber,
- UnitNumber: int64(unitNumber),
- HouseNumber: houseNumber,
- HouseArea: houseArea,
- HouseUsedArea: houseUsedArea,
- HouseType: int64(houseType),
- Layer: int64(houseLevel),
- RoomCount: int64(roomCount),
- HallCount: int64(hallCount),
- }
- list = append(list, item)
- }
- return list, nil
- }
- func parseUnitImportContent(fileName string) ([]*v1.BatchUnitItem, error) {
- f, err := xlsx.OpenFile(fileName)
- if err != nil {
- return nil, status.Error(10003, "xlsx 打开失败")
- }
- if len(f.Sheets) == 0 {
- return nil, status.Error(10003, "参数文件没有sheet")
- }
- sheet := f.Sheets[0]
- if len(sheet.Rows) == 0 {
- return nil, status.Error(10003, "文件为空")
- }
- if len(sheet.Rows) > 1005 {
- return nil, status.Error(10003, "单次导入不能超过一千条记录, 请分批导入")
- }
- list := []*v1.BatchUnitItem{}
- for i, row := range sheet.Rows {
- if len(row.Cells) < 5 {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i)+"列数错误,请使用模板")
- }
- if i == 0 {
- if row.Cells[0].Value != "楼栋编号" ||
- row.Cells[1].Value != "单元编号" ||
- row.Cells[2].Value != "单元名称" ||
- row.Cells[3].Value != "层数" ||
- row.Cells[4].Value != "是否有电梯" {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"标题错误,请使用模板")
- }
- continue
- }
- buidingNumber := strings.TrimSpace(row.Cells[0].Value)
- unitNumberStr := strings.TrimSpace(row.Cells[1].Value)
- unitName := strings.TrimSpace(row.Cells[2].Value)
- layersStr := strings.TrimSpace(row.Cells[3].Value)
- hasLiftStr := strings.TrimSpace(row.Cells[4].Value)
- if buidingNumber == "" && unitNumberStr == "" &&
- unitName == "" && layersStr == "" &&
- hasLiftStr == "" {
- continue
- }
- if buidingNumber == "" || unitNumberStr == "" ||
- unitName == "" || layersStr == "" ||
- hasLiftStr == "" {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"参数不能为空")
- }
- unitNumber, err := strconv.Atoi(unitNumberStr)
- if err != nil {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"单元格式错误")
- }
- layers, err := strconv.Atoi(layersStr)
- if err != nil {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"层数格式错误")
- }
- hasLift := true
- if hasLiftStr == "否" {
- hasLift = false
- } else if hasLiftStr != "是" {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"是否有电梯格式错误")
- }
- item := &v1.BatchUnitItem{
- BuildingNumber: buidingNumber,
- UnitNumber: int64(unitNumber),
- UnitLayers: int64(layers),
- UnitName: unitName,
- HasLift: hasLift,
- }
- list = append(list, item)
- }
- return list, nil
- }
- func parseBuildingImportContent(fileName string) ([]*v1.BatchBuildingItem, error) {
- f, err := xlsx.OpenFile(fileName)
- if err != nil {
- return nil, status.Error(10003, "xlsx 打开失败")
- }
- if len(f.Sheets) == 0 {
- return nil, status.Error(10003, "参数文件没有sheet")
- }
- sheet := f.Sheets[0]
- if len(sheet.Rows) == 0 {
- return nil, status.Error(10003, "文件为空")
- }
- if len(sheet.Rows) > 1005 {
- return nil, status.Error(10003, "单次导入不能超过一千条记录, 请分批导入")
- }
- list := []*v1.BatchBuildingItem{}
- for i, row := range sheet.Rows {
- if len(row.Cells) < 4 {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i)+"列数错误,请使用模板")
- }
- if i == 0 {
- if row.Cells[0].Value != "楼栋编号" ||
- row.Cells[1].Value != "楼栋名称" ||
- row.Cells[2].Value != "楼栋建筑面积" ||
- row.Cells[3].Value != "楼栋使用面积" {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"标题错误,请使用模板")
- }
- continue
- }
- buidingNumber := strings.TrimSpace(row.Cells[0].Value)
- buildingName := strings.TrimSpace(row.Cells[1].Value)
- buildingAreaStr := strings.TrimSpace(row.Cells[2].Value)
- buildingUsedAreaStr := strings.TrimSpace(row.Cells[3].Value)
- if buidingNumber == "" && buildingName == "" {
- continue
- }
- if buidingNumber == "" || buildingName == "" {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"参数不能为空")
- }
- buildingArea, err := strconv.ParseFloat(buildingAreaStr, 64)
- if err != nil && buildingAreaStr != "" {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"楼栋面积格式错误")
- }
- buildingUsedArea, err := strconv.ParseFloat(buildingUsedAreaStr, 64)
- if err != nil && buildingUsedAreaStr != "" {
- return nil, status.Error(10003, fmt.Sprintf("第%d行", i+1)+"楼栋使用面积格式错误")
- }
- item := &v1.BatchBuildingItem{
- BuildingNumber: buidingNumber,
- BuildingName: buildingName,
- BuildingArea: buildingArea,
- BuildingUsedArea: buildingUsedArea,
- }
- list = append(list, item)
- }
- return list, nil
- }
- //
- // @Summary 房屋导入
- // @Description 房屋导入
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param file formData file true "file"
- // @Success 200 {object} v1.BatchHouseAddResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/house/import [post]
- func (c Controller) HouseImport(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.BatchHouseAddRequest{}
- newFile := ""
- var tokenInfo utils.TokenInfo
- parseParamTask := func() error {
- var err error
- tokenInfo, err = utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- file, err := ctx.FormFile("file")
- if err != nil {
- return errors.SystemError
- }
- if file.Size > 10*1024*1024 {
- return status.Error(10003, "文件过大")
- }
- ext := path.Ext(file.Filename)
- if ext != ".xlsx" {
- return status.Error(10003, "仅支持xlsx文件格式")
- }
- newFile = fmt.Sprintf("power-%s-%d-%d.xlsx", file.Filename, tokenInfo.Uid, time.Now().UnixNano())
- err = ctx.SaveUploadedFile(file, newFile)
- if err != nil {
- logger.Error("func",
- zap.String("call", "ctx.SaveUploadedFile"),
- zap.String("error", err.Error()))
- return status.Error(10003, "保存文件失败")
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- list, err := parseHouseImportContent(newFile)
- if err != nil {
- os.Remove(newFile)
- return err
- }
- os.Remove(newFile)
- if len(list) == 0 {
- return nil
- }
- // 响应数据
- resp := param_v1.BatchHouseAddResponse{}
- rpcReq := &v1.BatchHouseAddRequest{
- GardenId: tokenInfo.GardenId,
- Houses: list,
- }
- _, err = pb.Garden.BatchHouseAdd(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "Garden.BatchHouseAdd"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 单元导入
- // @Description 单元导入
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param file formData file true "file"
- // @Success 200 {object} v1.BatchHouseAddResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/unit/import [post]
- func (c Controller) UnitImport(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.BatchHouseAddRequest{}
- newFile := ""
- var tokenInfo utils.TokenInfo
- parseParamTask := func() error {
- var err error
- tokenInfo, err = utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- file, err := ctx.FormFile("file")
- if err != nil {
- return errors.SystemError
- }
- if file.Size > 10*1024*1024 {
- return status.Error(10003, "文件过大")
- }
- ext := path.Ext(file.Filename)
- if ext != ".xlsx" {
- return status.Error(10003, "仅支持xlsx文件格式")
- }
- newFile = fmt.Sprintf("power-%s-%d-%d.xlsx", file.Filename, tokenInfo.Uid, time.Now().UnixNano())
- err = ctx.SaveUploadedFile(file, newFile)
- if err != nil {
- logger.Error("func",
- zap.String("call", "ctx.SaveUploadedFile"),
- zap.String("error", err.Error()))
- return status.Error(10003, "保存文件失败")
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- list, err := parseUnitImportContent(newFile)
- if err != nil {
- os.Remove(newFile)
- return err
- }
- os.Remove(newFile)
- if len(list) == 0 {
- return nil
- }
- // 响应数据
- resp := param_v1.BatchHouseAddResponse{}
- rpcReq := &v1.BatchHouseAddRequest{
- GardenId: tokenInfo.GardenId,
- Units: list,
- }
- _, err = pb.Garden.BatchHouseAdd(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "Garden.BatchHouseAdd"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 楼栋导入
- // @Description 楼栋导入
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Param file formData file true "file"
- // @Success 200 {object} v1.BatchHouseAddResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/building/import [post]
- func (c Controller) BuildingImport(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.BatchHouseAddRequest{}
- newFile := ""
- var tokenInfo utils.TokenInfo
- parseParamTask := func() error {
- var err error
- tokenInfo, err = utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- file, err := ctx.FormFile("file")
- if err != nil {
- return errors.SystemError
- }
- if file.Size > 10*1024*1024 {
- return status.Error(10003, "文件过大")
- }
- ext := path.Ext(file.Filename)
- if ext != ".xlsx" {
- return status.Error(10003, "仅支持xlsx文件格式")
- }
- newFile = fmt.Sprintf("power-%s-%d-%d.xlsx", file.Filename, tokenInfo.Uid, time.Now().UnixNano())
- err = ctx.SaveUploadedFile(file, newFile)
- if err != nil {
- logger.Error("func",
- zap.String("call", "ctx.SaveUploadedFile"),
- zap.String("error", err.Error()))
- return status.Error(10003, "保存文件失败")
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- list, err := parseBuildingImportContent(newFile)
- if err != nil {
- os.Remove(newFile)
- return err
- }
- os.Remove(newFile)
- if len(list) == 0 {
- return nil
- }
- // 响应数据
- resp := param_v1.BatchHouseAddResponse{}
- rpcReq := &v1.BatchHouseAddRequest{
- GardenId: tokenInfo.GardenId,
- Buildings: list,
- }
- _, err = pb.Garden.BatchHouseAdd(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "Garden.BatchHouseAdd"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 小区信息
- // @Description 小区信息
- // @Tags 小区
- // @Accept json
- // @Produce json
- // @Param token header string true " "
- // @Success 200 {object} v1.GardenInfoResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/garden [get]
- func (c *Controller) GardenInfo(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.GardenInfoRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, nil, nil)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.GardenInfoResponse{}
- rpcReq := &v1.GardenInfosRequest{
- Ids: []int64{tokenInfo.GardenId},
- }
- rpcRsp, err := pb.System.GardenInfos(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "Garden.GardenInfos"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- if rpcRsp.List == nil {
- return errors.ErrRecordNotFound
- }
- for i, v := range rpcRsp.List {
- if len(v.WaterType) == 0 {
- rpcRsp.List[i].WaterType = []int32{}
- }
- if len(v.ElectricType) == 0 {
- rpcRsp.List[i].ElectricType = []int32{}
- }
- if len(v.GardenPics) == 0 {
- rpcRsp.List[i].GardenPics = []string{}
- }
- }
- resp.Data = *rpcRsp.List[0]
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 修改小区普通信息
- // @Description 修改小区普通信息
- // @Tags 小区
- // @Accept json
- // @Produce json
- // @Param token header string true " "
- // @Param body body v1.GardenUpdateBody true "小区信息"
- // @Success 200 {object} v1.GardenUpdateResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/garden [put]
- func (c *Controller) GardenUpdate(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.GardenUpdateRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.GardenUpdateBody)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.GardenUpdateResponse{}
- rpcReq := &v1.GardenUpdateRequest{
- //Province: req.Province,
- //ProvinceCode: req.ProvinceCode,
- //City: req.City,
- //CityCode: req.CityCode,
- //Area: req.Area,
- //AreaCode: req.AreaCode,
- //Street: req.Street,
- //StreetCode: req.StreetCode,
- //Committee: req.Committee,
- //CommitteeCode: req.CommitteeCode,
- PropertyPerson: req.PropertyPerson,
- PropertyPhone: req.PropertyPhone,
- //GardenName: req.GardenName,
- GardenAddr: req.GardenAddr,
- Cid: tokenInfo.Cid,
- Id: tokenInfo.GardenId,
- GardenPic: req.GardenPic,
- GardenDesc: req.GardenDesc,
- Lnt: req.Lnt,
- Lat: req.Lat,
- GardenPics: req.GardenPics,
- BuildingStart: req.BuildingStart,
- BuildingEnd: req.BuildingEnd,
- PropertyFeeStart: req.PropertyFeeStart,
- PropertyFeeEnd: req.PropertyFeeEnd,
- GasFeeStart: req.GasFeeStart,
- GasFeeEnd: req.GasFeeEnd,
- BuildingArea: req.BuildingArea,
- BuildingCompany: req.BuildingCompany,
- CoveredArea: req.CoveredArea,
- GreenPercent: req.GreenPercent,
- AreaPercent: req.AreaPercent,
- SpaceInfo: req.SpaceInfo,
- SpaceTotal: req.SpaceTotal,
- HouseTotal: req.HouseTotal,
- BuildingType: req.BuildingType,
- WaterType: req.WaterType,
- ElectricType: req.ElectricType,
- AvgPrice: req.AvgPrice,
- }
- _, err = pb.System.GardenUpdate(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.GardenUpdate"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 申请修改小区关键信息
- // @Description 申请修改小区关键信息
- // @Tags 小区
- // @Accept json
- // @Produce json
- // @Param token header string true " "
- // @Param body body v1.GardenKeyInfoChangeBody true "小区信息"
- // @Success 200 {object} v1.GardenKeyInfoChangeResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/garden/key_info [put]
- func (c *Controller) GardenKeyInfoChange(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.GardenKeyInfoChangeRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.GardenKeyInfoChangeBody)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.GardenKeyInfoChangeResponse{}
- rpcReq := &v1.GardenKeyInfoChangeRequest{
- Province: req.Province,
- ProvinceCode: req.ProvinceCode,
- City: req.City,
- CityCode: req.CityCode,
- Area: req.Area,
- AreaCode: req.AreaCode,
- Street: req.Street,
- StreetCode: req.StreetCode,
- Committee: req.Committee,
- CommitteeCode: req.CommitteeCode,
- Cid: tokenInfo.Cid,
- Id: tokenInfo.GardenId,
- GardenName: req.GardenName,
- }
- _, err = pb.System.GardenKeyInfoChange(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.GardenKeyInfoChange"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 小区关键信息申请列表
- // @Description 小区关键信息申请列表
- // @Tags 小区
- // @Accept json
- // @Produce json
- // @Param token header string true " "
- // @Param page query int false " "
- // @Param page_size query int false " "
- // @Param status query int false "0不过率 1 待审核 2 审核通过 3 未通过 "
- // @Success 200 {object} v1.GardenKeyInfoChangeListResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/garden/key_info [get]
- func (c *Controller) GardenKeyInfoChangeList(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.GardenKeyInfoChangeListRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, &req.GardenKeyInfoChangeListQuery, nil)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- tokenInfo, err := utils.GetSubjectValue(ctx)
- if err != nil {
- return err
- }
- // 响应数据
- resp := param_v1.GardenKeyInfoChangeListResponse{}
- rpcReq := &v1.GardenKeyInfoChangeListRequest{
- Cid: tokenInfo.Cid,
- GardenId: tokenInfo.GardenId,
- Status: req.Status,
- Page: req.Page,
- PageSize: req.PageSize,
- }
- rpcRsp, err := pb.System.GardenKeyInfoChangeList(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "pb.Garden.GardenKeyInfoChangeList"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- if rpcRsp.List == nil {
- rpcRsp.List = make([]*v1.GardenKeyInfoData, 0)
- }
- resp.Data = *rpcRsp
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 获取单元模板
- // @Description 获取单元模板
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Success 200 {object} v1.TemplateResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/unit/template [get]
- func (c *Controller) UnitTemplate(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.TemplateRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, nil, nil)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- // 响应数据
- resp := param_v1.TemplateResponse{}
- resp.Data.Url = parser.Conf.Oss.UnitTempUrl
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 获取楼盘模板
- // @Description 获取楼盘模板
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Success 200 {object} v1.TemplateResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/building/template [get]
- func (c *Controller) BuildingTemplate(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.TemplateRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, nil, nil)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- // 响应数据
- resp := param_v1.TemplateResponse{}
- resp.Data.Url = parser.Conf.Oss.BuildingTempUrl
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
- //
- // @Summary 获取房屋模板
- // @Description 获取房屋模板
- // @Tags 楼盘管理
- // @Accept json
- // @Produce json
- // @Param token header string true "token"
- // @Success 200 {object} v1.TemplateResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/buildings/house/template [get]
- func (c *Controller) HouseTemplate(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.TemplateRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, &req.Header, nil, nil, nil)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- // 响应数据
- resp := param_v1.TemplateResponse{}
- resp.Data.Url = parser.Conf.Oss.HouseTempUrl
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
|