|
@@ -158,6 +158,23 @@ func ManageRouters() {
|
158
|
158
|
|
159
|
159
|
beego.Router("/api/manage/getregistgoodinforlist", &MachineApiController{}, "Get:GetRegistGoodInforList")
|
160
|
160
|
beego.Router("/api/manage/getregistnumber", &MachineApiController{}, "Get:GetRegistNumber")
|
|
161
|
+
|
|
162
|
+ beego.Router("/api/manage/savesetairdisinfect", &MachineApiController{}, "Get:SaveSetAirDisInfect")
|
|
163
|
+ beego.Router("/api/manage/getsetairinfectbyid", &MachineApiController{}, "Get:GetSetAirInfectById")
|
|
164
|
+ beego.Router("/api/manage/savenewairwaydisinfect", &MachineApiController{}, "Post:SaveNewAirWayDisinfect")
|
|
165
|
+ beego.Router("/api/manage/getnewairwaydisinfectlist", &MachineApiController{}, "Get:GetNewAirWayDisinfectList")
|
|
166
|
+ beego.Router("/api/manage/getairdisinfectwaylongtime", &MachineApiController{}, "Get:GetAirDisinfectWayLongTime")
|
|
167
|
+ beego.Router("/api/manage/getnewairwaydisinfectbyidlist", &MachineApiController{}, "Get:GetNewAirWayDisinfectByIdList")
|
|
168
|
+ beego.Router("/api/manage/updatenewairwaydisinfect", &MachineApiController{}, "Post:UpdateNewAirWayDisInfect")
|
|
169
|
+ beego.Router("/api/manage/deletenewairwaydisinfect", &MachineApiController{}, "Get:DeleteNewAirWayDisinfect")
|
|
170
|
+
|
|
171
|
+ beego.Router("/api/manage/setobjectdisinfect", &MachineApiController{}, "Get:SaveSetObjectDisinfect")
|
|
172
|
+ beego.Router("/api/manage/getobjectwaydisinfect", &MachineApiController{}, "Get:GetObjectWayDisinect")
|
|
173
|
+ beego.Router("/api/manage/saveobjectwaytabledisinfect", &MachineApiController{}, "Post:SaveObjectWayTableDisinfect")
|
|
174
|
+ beego.Router("/api/manage/getobjcettabledisinfectwaylist", &MachineApiController{}, "Get:GetObjectAbleDisInfectWayList")
|
|
175
|
+ beego.Router("/api/manage/getobjecttabledisinfectwaybylist", &MachineApiController{}, "Get:GetObjectAbledDisInfectWayById")
|
|
176
|
+ beego.Router("/api/manage/updateobjectwaytabledisinfect", &MachineApiController{}, "Post:UpdateObjectWayAbleDisinfect")
|
|
177
|
+ beego.Router("/api/manage/deleteobjecttablewaydisinfect", &MachineApiController{}, "Get:DeleteObjectAbleWayDisinfect")
|
161
|
178
|
}
|
162
|
179
|
|
163
|
180
|
func (this *MachineApiController) SaveManageInfo() {
|
|
@@ -5714,3 +5731,650 @@ func (this *MachineApiController) GetRegistNumber() {
|
5714
|
5731
|
})
|
5715
|
5732
|
return
|
5716
|
5733
|
}
|
|
5734
|
+
|
|
5735
|
+func (this *MachineApiController) SaveSetAirDisInfect() {
|
|
5736
|
+
|
|
5737
|
+ air_way, _ := this.GetInt64("air_way")
|
|
5738
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
5739
|
+
|
|
5740
|
+ airdisinfect, _ := service.GetAirDisInfectSetting(orgId)
|
|
5741
|
+
|
|
5742
|
+ airSetting := models.XtDeviceAirSetting{
|
|
5743
|
+ ID: airdisinfect.ID,
|
|
5744
|
+ AirWay: air_way,
|
|
5745
|
+ UserOrgId: orgId,
|
|
5746
|
+ Ctime: time.Now().Unix(),
|
|
5747
|
+ Status: 1,
|
|
5748
|
+ Mtime: time.Now().Unix(),
|
|
5749
|
+ }
|
|
5750
|
+
|
|
5751
|
+ err := service.SaveSetAirDisInfect(airSetting)
|
|
5752
|
+
|
|
5753
|
+ if err != nil {
|
|
5754
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
|
|
5755
|
+ return
|
|
5756
|
+ }
|
|
5757
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
5758
|
+ "airSetting": airSetting,
|
|
5759
|
+ })
|
|
5760
|
+ return
|
|
5761
|
+
|
|
5762
|
+}
|
|
5763
|
+
|
|
5764
|
+func (this *MachineApiController) GetSetAirInfectById() {
|
|
5765
|
+
|
|
5766
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
5767
|
+
|
|
5768
|
+ airset, _ := service.GetAirDisInfectSetting(orgId)
|
|
5769
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
5770
|
+ "airset": airset,
|
|
5771
|
+ })
|
|
5772
|
+ return
|
|
5773
|
+
|
|
5774
|
+}
|
|
5775
|
+
|
|
5776
|
+func (this *MachineApiController) SaveNewAirWayDisinfect() {
|
|
5777
|
+
|
|
5778
|
+ timeLayout := "2006-01-02"
|
|
5779
|
+ loc, _ := time.LoadLocation("Local")
|
|
5780
|
+ dataBody := make(map[string]interface{}, 0)
|
|
5781
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
5782
|
+ fmt.Println("err", err)
|
|
5783
|
+ record_date := dataBody["record_date"].(string)
|
|
5784
|
+ recorddate, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
5785
|
+ recorddateunix := recorddate.Unix()
|
|
5786
|
+
|
|
5787
|
+ first_disinfection_water := dataBody["first_disinfection_water"].(string)
|
|
5788
|
+ first_disinfection_methods := dataBody["first_disinfection_methods"].(string)
|
|
5789
|
+ first_disinfection_time := dataBody["first_disinfection_time"].(string)
|
|
5790
|
+
|
|
5791
|
+ first_start_time := dataBody["first_start_time"].(string)
|
|
5792
|
+
|
|
5793
|
+ if len(first_start_time) == 0 {
|
|
5794
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5795
|
+ return
|
|
5796
|
+ }
|
|
5797
|
+ firstStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_start_time)
|
|
5798
|
+
|
|
5799
|
+ first_end_time := dataBody["first_end_time"].(string)
|
|
5800
|
+
|
|
5801
|
+ if len(first_end_time) == 0 {
|
|
5802
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5803
|
+ return
|
|
5804
|
+ }
|
|
5805
|
+ firstEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_end_time)
|
|
5806
|
+
|
|
5807
|
+ first_total_time := dataBody["first_total_time"].(string)
|
|
5808
|
+
|
|
5809
|
+ first_is_check := int64(dataBody["first_is_check"].(float64))
|
|
5810
|
+
|
|
5811
|
+ first_modifications := int64(dataBody["first_modifications"].(float64))
|
|
5812
|
+
|
|
5813
|
+ first_creator := int64(dataBody["first_creator"].(float64))
|
|
5814
|
+
|
|
5815
|
+ last_start_time := dataBody["last_start_time"].(string)
|
|
5816
|
+
|
|
5817
|
+ if len(last_start_time) == 0 {
|
|
5818
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5819
|
+ return
|
|
5820
|
+ }
|
|
5821
|
+ lastStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_start_time)
|
|
5822
|
+
|
|
5823
|
+ last_end_time := dataBody["last_end_time"].(string)
|
|
5824
|
+
|
|
5825
|
+ if len(last_end_time) == 0 {
|
|
5826
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5827
|
+ return
|
|
5828
|
+ }
|
|
5829
|
+ lastEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_end_time)
|
|
5830
|
+
|
|
5831
|
+ last_total_time := dataBody["last_total_time"].(string)
|
|
5832
|
+
|
|
5833
|
+ last_is_check := int64(dataBody["last_is_check"].(float64))
|
|
5834
|
+
|
|
5835
|
+ last_modifications := int64(dataBody["last_modifications"].(float64))
|
|
5836
|
+
|
|
5837
|
+ last_creator := int64(dataBody["last_creator"].(float64))
|
|
5838
|
+
|
|
5839
|
+ department := dataBody["department"].(string)
|
|
5840
|
+
|
|
5841
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
5842
|
+ disinfect := models.XtNewAriDisinfectWay{
|
|
5843
|
+ UserOrgId: orgId,
|
|
5844
|
+ RecordDate: recorddateunix,
|
|
5845
|
+ FirstDisinfectionWater: first_disinfection_water,
|
|
5846
|
+ FirstDisinfectionMethods: first_disinfection_methods,
|
|
5847
|
+ FirstDisinfectionTime: first_disinfection_time,
|
|
5848
|
+ FirstStartTime: firstStartTime.Unix(),
|
|
5849
|
+ FirstEndTime: firstEndTime.Unix(),
|
|
5850
|
+ FirstTotalTime: first_total_time,
|
|
5851
|
+ FirstIsCheck: first_is_check,
|
|
5852
|
+ FirstModifications: first_modifications,
|
|
5853
|
+ FirstCreator: first_creator,
|
|
5854
|
+ LastStartTime: lastStartTime.Unix(),
|
|
5855
|
+ LastEndTime: lastEndTime.Unix(),
|
|
5856
|
+ LastTotalTime: last_total_time,
|
|
5857
|
+ LastIsCheck: last_is_check,
|
|
5858
|
+ LastModifications: last_modifications,
|
|
5859
|
+ LastCreator: last_creator,
|
|
5860
|
+ Ctime: time.Now().Unix(),
|
|
5861
|
+ Mtime: time.Now().Unix(),
|
|
5862
|
+ Status: 1,
|
|
5863
|
+ Department: department,
|
|
5864
|
+ }
|
|
5865
|
+
|
|
5866
|
+ err = service.CreateNewAirWayDisinfectOne(disinfect)
|
|
5867
|
+
|
|
5868
|
+ if err != nil {
|
|
5869
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
|
|
5870
|
+ return
|
|
5871
|
+ }
|
|
5872
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
5873
|
+ "disinfect": disinfect,
|
|
5874
|
+ })
|
|
5875
|
+}
|
|
5876
|
+
|
|
5877
|
+func (this *MachineApiController) GetNewAirWayDisinfectList() {
|
|
5878
|
+
|
|
5879
|
+ timeLayout := "2006-01-02"
|
|
5880
|
+ loc, _ := time.LoadLocation("Local")
|
|
5881
|
+ start_time := this.GetString("start_time")
|
|
5882
|
+ end_time := this.GetString("end_time")
|
|
5883
|
+ limit, _ := this.GetInt64("limit")
|
|
5884
|
+ page, _ := this.GetInt64("page")
|
|
5885
|
+ var startTime int64
|
|
5886
|
+ if len(start_time) > 0 {
|
|
5887
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
5888
|
+ if err != nil {
|
|
5889
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5890
|
+ return
|
|
5891
|
+ }
|
|
5892
|
+ startTime = theTime.Unix()
|
|
5893
|
+ }
|
|
5894
|
+ var endTime int64
|
|
5895
|
+ if len(end_time) > 0 {
|
|
5896
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
5897
|
+ if err != nil {
|
|
5898
|
+ utils.ErrorLog(err.Error())
|
|
5899
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5900
|
+ return
|
|
5901
|
+ }
|
|
5902
|
+ endTime = theTime.Unix()
|
|
5903
|
+ }
|
|
5904
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
5905
|
+ list, total, err := service.GetNewAirWayDisinfectList(limit, page, startTime, endTime, orgId)
|
|
5906
|
+ if err != nil {
|
|
5907
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
|
|
5908
|
+ return
|
|
5909
|
+ }
|
|
5910
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
5911
|
+ "list": list,
|
|
5912
|
+ "total": total,
|
|
5913
|
+ })
|
|
5914
|
+}
|
|
5915
|
+
|
|
5916
|
+func (this *MachineApiController) GetAirDisinfectWayLongTime() {
|
|
5917
|
+
|
|
5918
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
5919
|
+
|
|
5920
|
+ department := this.GetString("department")
|
|
5921
|
+ list, err := service.GetAirDisinfectWayLongTime(orgId, department)
|
|
5922
|
+
|
|
5923
|
+ if err != nil {
|
|
5924
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
|
|
5925
|
+ return
|
|
5926
|
+ }
|
|
5927
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
5928
|
+ "list": list,
|
|
5929
|
+ })
|
|
5930
|
+}
|
|
5931
|
+
|
|
5932
|
+func (this *MachineApiController) GetNewAirWayDisinfectByIdList() {
|
|
5933
|
+
|
|
5934
|
+ id, _ := this.GetInt64("id")
|
|
5935
|
+ list, err := service.GetNewAirWayDisinfectByIdList(id)
|
|
5936
|
+ if err != nil {
|
|
5937
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
|
|
5938
|
+ return
|
|
5939
|
+ }
|
|
5940
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
5941
|
+ "list": list,
|
|
5942
|
+ })
|
|
5943
|
+}
|
|
5944
|
+
|
|
5945
|
+func (this *MachineApiController) UpdateNewAirWayDisInfect() {
|
|
5946
|
+
|
|
5947
|
+ timeLayout := "2006-01-02"
|
|
5948
|
+ loc, _ := time.LoadLocation("Local")
|
|
5949
|
+ dataBody := make(map[string]interface{}, 0)
|
|
5950
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
5951
|
+ fmt.Println("err", err)
|
|
5952
|
+
|
|
5953
|
+ id := int64(dataBody["id"].(float64))
|
|
5954
|
+ record_date := dataBody["record_date"].(string)
|
|
5955
|
+ recorddate, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
5956
|
+ recorddateunix := recorddate.Unix()
|
|
5957
|
+
|
|
5958
|
+ first_disinfection_water := dataBody["first_disinfection_water"].(string)
|
|
5959
|
+ first_disinfection_methods := dataBody["first_disinfection_methods"].(string)
|
|
5960
|
+ first_disinfection_time := dataBody["first_disinfection_time"].(string)
|
|
5961
|
+
|
|
5962
|
+ first_start_time := dataBody["first_start_time"].(string)
|
|
5963
|
+
|
|
5964
|
+ if len(first_start_time) == 0 {
|
|
5965
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5966
|
+ return
|
|
5967
|
+ }
|
|
5968
|
+ firstStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_start_time)
|
|
5969
|
+
|
|
5970
|
+ first_end_time := dataBody["first_end_time"].(string)
|
|
5971
|
+
|
|
5972
|
+ if len(first_end_time) == 0 {
|
|
5973
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5974
|
+ return
|
|
5975
|
+ }
|
|
5976
|
+ firstEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_end_time)
|
|
5977
|
+
|
|
5978
|
+ first_total_time := dataBody["first_total_time"].(string)
|
|
5979
|
+
|
|
5980
|
+ first_is_check := int64(dataBody["first_is_check"].(float64))
|
|
5981
|
+
|
|
5982
|
+ first_modifications := int64(dataBody["first_modifications"].(float64))
|
|
5983
|
+
|
|
5984
|
+ first_creator := int64(dataBody["first_creator"].(float64))
|
|
5985
|
+
|
|
5986
|
+ last_start_time := dataBody["last_start_time"].(string)
|
|
5987
|
+
|
|
5988
|
+ if len(last_start_time) == 0 {
|
|
5989
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5990
|
+ return
|
|
5991
|
+ }
|
|
5992
|
+ lastStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_start_time)
|
|
5993
|
+
|
|
5994
|
+ last_end_time := dataBody["last_end_time"].(string)
|
|
5995
|
+
|
|
5996
|
+ if len(last_end_time) == 0 {
|
|
5997
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
5998
|
+ return
|
|
5999
|
+ }
|
|
6000
|
+ lastEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_end_time)
|
|
6001
|
+
|
|
6002
|
+ last_total_time := dataBody["last_total_time"].(string)
|
|
6003
|
+
|
|
6004
|
+ last_is_check := int64(dataBody["last_is_check"].(float64))
|
|
6005
|
+
|
|
6006
|
+ last_modifications := int64(dataBody["last_modifications"].(float64))
|
|
6007
|
+
|
|
6008
|
+ last_creator := int64(dataBody["last_creator"].(float64))
|
|
6009
|
+
|
|
6010
|
+ department := dataBody["department"].(string)
|
|
6011
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
6012
|
+ disinfect := models.XtNewAriDisinfectWay{
|
|
6013
|
+ ID: id,
|
|
6014
|
+ UserOrgId: orgId,
|
|
6015
|
+ RecordDate: recorddateunix,
|
|
6016
|
+ FirstDisinfectionWater: first_disinfection_water,
|
|
6017
|
+ FirstDisinfectionMethods: first_disinfection_methods,
|
|
6018
|
+ FirstDisinfectionTime: first_disinfection_time,
|
|
6019
|
+ FirstStartTime: firstStartTime.Unix(),
|
|
6020
|
+ FirstEndTime: firstEndTime.Unix(),
|
|
6021
|
+ FirstTotalTime: first_total_time,
|
|
6022
|
+ FirstIsCheck: first_is_check,
|
|
6023
|
+ FirstModifications: first_modifications,
|
|
6024
|
+ FirstCreator: first_creator,
|
|
6025
|
+ LastStartTime: lastStartTime.Unix(),
|
|
6026
|
+ LastEndTime: lastEndTime.Unix(),
|
|
6027
|
+ LastTotalTime: last_total_time,
|
|
6028
|
+ LastIsCheck: last_is_check,
|
|
6029
|
+ LastModifications: last_modifications,
|
|
6030
|
+ LastCreator: last_creator,
|
|
6031
|
+ Ctime: time.Now().Unix(),
|
|
6032
|
+ Mtime: time.Now().Unix(),
|
|
6033
|
+ Status: 1,
|
|
6034
|
+ Department: department,
|
|
6035
|
+ }
|
|
6036
|
+
|
|
6037
|
+ err = service.CreateNewAirWayDisinfect(disinfect)
|
|
6038
|
+ if err != nil {
|
|
6039
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
|
|
6040
|
+ return
|
|
6041
|
+ }
|
|
6042
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
6043
|
+ "disinfect": disinfect,
|
|
6044
|
+ })
|
|
6045
|
+}
|
|
6046
|
+
|
|
6047
|
+func (this *MachineApiController) DeleteNewAirWayDisinfect() {
|
|
6048
|
+
|
|
6049
|
+ id, _ := this.GetInt64("id")
|
|
6050
|
+ err := service.DeleteNewAirWayDisinfect(id)
|
|
6051
|
+ if err != nil {
|
|
6052
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
|
|
6053
|
+ return
|
|
6054
|
+ }
|
|
6055
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
6056
|
+ "msg": "ok",
|
|
6057
|
+ })
|
|
6058
|
+ return
|
|
6059
|
+}
|
|
6060
|
+
|
|
6061
|
+func (this *MachineApiController) SaveSetObjectDisinfect() {
|
|
6062
|
+
|
|
6063
|
+ air_way, _ := this.GetInt64("air_way")
|
|
6064
|
+
|
|
6065
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
6066
|
+
|
|
6067
|
+ disinfect, _ := service.GetObjectTableDisinfect(orgId)
|
|
6068
|
+
|
|
6069
|
+ objctSet := models.XtDeviceObjctSet{
|
|
6070
|
+ ID: disinfect.ID,
|
|
6071
|
+ UserOrgId: orgId,
|
|
6072
|
+ Status: 1,
|
|
6073
|
+ AirWay: air_way,
|
|
6074
|
+ Ctime: time.Now().Unix(),
|
|
6075
|
+ Mtime: time.Now().Unix(),
|
|
6076
|
+ }
|
|
6077
|
+
|
|
6078
|
+ err := service.SaveSetObjectDisinfect(objctSet)
|
|
6079
|
+ if err != nil {
|
|
6080
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
|
|
6081
|
+ return
|
|
6082
|
+ }
|
|
6083
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
6084
|
+ "objctSet": objctSet,
|
|
6085
|
+ })
|
|
6086
|
+ return
|
|
6087
|
+}
|
|
6088
|
+
|
|
6089
|
+func (this *MachineApiController) GetObjectWayDisinect() {
|
|
6090
|
+
|
|
6091
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
6092
|
+
|
|
6093
|
+ disinfect, _ := service.GetObjectTableDisinfect(orgId)
|
|
6094
|
+
|
|
6095
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
6096
|
+ "disinfect": disinfect,
|
|
6097
|
+ })
|
|
6098
|
+ return
|
|
6099
|
+}
|
|
6100
|
+
|
|
6101
|
+func (this *MachineApiController) SaveObjectWayTableDisinfect() {
|
|
6102
|
+
|
|
6103
|
+ timeLayout := "2006-01-02"
|
|
6104
|
+ loc, _ := time.LoadLocation("Local")
|
|
6105
|
+ dataBody := make(map[string]interface{}, 0)
|
|
6106
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
6107
|
+ fmt.Println("err", err)
|
|
6108
|
+ record_date := dataBody["record_date"].(string)
|
|
6109
|
+ recorddate, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
6110
|
+ recorddateunix := recorddate.Unix()
|
|
6111
|
+
|
|
6112
|
+ first_disinfection_water := dataBody["first_disinfection_water"].(string)
|
|
6113
|
+ first_disinfection_methods := dataBody["first_disinfection_methods"].(string)
|
|
6114
|
+ first_disinfection_time := dataBody["first_disinfection_time"].(string)
|
|
6115
|
+
|
|
6116
|
+ first_start_time := dataBody["first_start_time"].(string)
|
|
6117
|
+
|
|
6118
|
+ var firstStartTimeUnix int64
|
|
6119
|
+ if len(first_start_time) > 0 {
|
|
6120
|
+ firstStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_start_time)
|
|
6121
|
+ firstStartTimeUnix = firstStartTime.Unix()
|
|
6122
|
+ }
|
|
6123
|
+
|
|
6124
|
+ var firstEndTimeUnix int64
|
|
6125
|
+ first_end_time := dataBody["first_end_time"].(string)
|
|
6126
|
+
|
|
6127
|
+ if len(first_end_time) > 0 {
|
|
6128
|
+ firstEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_end_time)
|
|
6129
|
+ firstEndTimeUnix = firstEndTime.Unix()
|
|
6130
|
+ }
|
|
6131
|
+
|
|
6132
|
+ first_total_time := dataBody["first_total_time"].(string)
|
|
6133
|
+
|
|
6134
|
+ first_is_check := int64(dataBody["first_is_check"].(float64))
|
|
6135
|
+
|
|
6136
|
+ first_modifications := int64(dataBody["first_modifications"].(float64))
|
|
6137
|
+
|
|
6138
|
+ first_creator := int64(dataBody["first_creator"].(float64))
|
|
6139
|
+
|
|
6140
|
+ last_disinfection_water := dataBody["last_disinfection_water"].(string)
|
|
6141
|
+ last_disinfection_methods := dataBody["last_disinfection_methods"].(string)
|
|
6142
|
+ last_disinfection_time := dataBody["last_disinfection_time"].(string)
|
|
6143
|
+ last_start_time := dataBody["last_start_time"].(string)
|
|
6144
|
+ var lastStartTimeUnix int64
|
|
6145
|
+ if len(last_start_time) > 0 {
|
|
6146
|
+ lastStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_start_time)
|
|
6147
|
+ lastStartTimeUnix = lastStartTime.Unix()
|
|
6148
|
+ }
|
|
6149
|
+
|
|
6150
|
+ last_end_time := dataBody["last_end_time"].(string)
|
|
6151
|
+
|
|
6152
|
+ var lastEndTimeUnix int64
|
|
6153
|
+ if len(last_end_time) > 0 {
|
|
6154
|
+ lastEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_end_time)
|
|
6155
|
+ lastEndTimeUnix = lastEndTime.Unix()
|
|
6156
|
+ }
|
|
6157
|
+
|
|
6158
|
+ last_total_time := dataBody["last_total_time"].(string)
|
|
6159
|
+
|
|
6160
|
+ last_is_check := int64(dataBody["last_is_check"].(float64))
|
|
6161
|
+
|
|
6162
|
+ last_modifications := int64(dataBody["last_modifications"].(float64))
|
|
6163
|
+
|
|
6164
|
+ last_creator := int64(dataBody["last_creator"].(float64))
|
|
6165
|
+
|
|
6166
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
6167
|
+
|
|
6168
|
+ department := dataBody["department"].(string)
|
|
6169
|
+ objectDisinfect := models.XtNewObjectDisinfectWay{
|
|
6170
|
+ UserOrgId: orgId,
|
|
6171
|
+ RecordDate: recorddateunix,
|
|
6172
|
+ FirstDisinfectionWater: first_disinfection_water,
|
|
6173
|
+ FirstDisinfectionMethods: first_disinfection_methods,
|
|
6174
|
+ FirstDisinfectionTime: first_disinfection_time,
|
|
6175
|
+ FirstStartTime: firstStartTimeUnix,
|
|
6176
|
+ FirstEndTime: firstEndTimeUnix,
|
|
6177
|
+ FirstTotalTime: first_total_time,
|
|
6178
|
+ FirstIsCheck: first_is_check,
|
|
6179
|
+ FirstModifications: first_modifications,
|
|
6180
|
+ FirstCreator: first_creator,
|
|
6181
|
+ LastStartTime: lastStartTimeUnix,
|
|
6182
|
+ LastEndTime: lastEndTimeUnix,
|
|
6183
|
+ LastTotalTime: last_total_time,
|
|
6184
|
+ LastIsCheck: last_is_check,
|
|
6185
|
+ LastModifications: last_modifications,
|
|
6186
|
+ LastCreator: last_creator,
|
|
6187
|
+ Ctime: time.Now().Unix(),
|
|
6188
|
+ Mtime: 0,
|
|
6189
|
+ Status: 1,
|
|
6190
|
+ LastDisinfectionWater: last_disinfection_water,
|
|
6191
|
+ LastDisinfectionMethods: last_disinfection_methods,
|
|
6192
|
+ LastDisinfectionTime: last_disinfection_time,
|
|
6193
|
+ Department: department,
|
|
6194
|
+ }
|
|
6195
|
+
|
|
6196
|
+ err = service.CreateNewObjectWayDisInfect(objectDisinfect)
|
|
6197
|
+
|
|
6198
|
+ if err != nil {
|
|
6199
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
|
|
6200
|
+ return
|
|
6201
|
+ }
|
|
6202
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
6203
|
+ "objectDisinfect": objectDisinfect,
|
|
6204
|
+ })
|
|
6205
|
+}
|
|
6206
|
+
|
|
6207
|
+func (this *MachineApiController) GetObjectAbleDisInfectWayList() {
|
|
6208
|
+
|
|
6209
|
+ timeLayout := "2006-01-02"
|
|
6210
|
+ loc, _ := time.LoadLocation("Local")
|
|
6211
|
+ start_time := this.GetString("start_time")
|
|
6212
|
+ end_time := this.GetString("end_time")
|
|
6213
|
+ limit, _ := this.GetInt64("limit")
|
|
6214
|
+ page, _ := this.GetInt64("page")
|
|
6215
|
+ var startTime int64
|
|
6216
|
+ if len(start_time) > 0 {
|
|
6217
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
6218
|
+ if err != nil {
|
|
6219
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
6220
|
+ return
|
|
6221
|
+ }
|
|
6222
|
+ startTime = theTime.Unix()
|
|
6223
|
+ }
|
|
6224
|
+ var endTime int64
|
|
6225
|
+ if len(end_time) > 0 {
|
|
6226
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
6227
|
+ if err != nil {
|
|
6228
|
+ utils.ErrorLog(err.Error())
|
|
6229
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
6230
|
+ return
|
|
6231
|
+ }
|
|
6232
|
+ endTime = theTime.Unix()
|
|
6233
|
+ }
|
|
6234
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
6235
|
+ list, total, err := service.GetObjectAbleDisInfectWayList(limit, page, startTime, endTime, orgId)
|
|
6236
|
+
|
|
6237
|
+ if err != nil {
|
|
6238
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
|
|
6239
|
+ return
|
|
6240
|
+ }
|
|
6241
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
6242
|
+ "list": list,
|
|
6243
|
+ "total": total,
|
|
6244
|
+ })
|
|
6245
|
+}
|
|
6246
|
+
|
|
6247
|
+func (this *MachineApiController) GetObjectAbledDisInfectWayById() {
|
|
6248
|
+
|
|
6249
|
+ id, _ := this.GetInt64("id")
|
|
6250
|
+ list, err := service.GetObjectAbledDisInfectWayById(id)
|
|
6251
|
+ if err != nil {
|
|
6252
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
|
|
6253
|
+ return
|
|
6254
|
+ }
|
|
6255
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
6256
|
+ "list": list,
|
|
6257
|
+ })
|
|
6258
|
+}
|
|
6259
|
+
|
|
6260
|
+func (this *MachineApiController) UpdateObjectWayAbleDisinfect() {
|
|
6261
|
+
|
|
6262
|
+ timeLayout := "2006-01-02"
|
|
6263
|
+ loc, _ := time.LoadLocation("Local")
|
|
6264
|
+ dataBody := make(map[string]interface{}, 0)
|
|
6265
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
6266
|
+ fmt.Println("err", err)
|
|
6267
|
+ record_date := dataBody["record_date"].(string)
|
|
6268
|
+ recorddate, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
6269
|
+ recorddateunix := recorddate.Unix()
|
|
6270
|
+
|
|
6271
|
+ first_disinfection_water := dataBody["first_disinfection_water"].(string)
|
|
6272
|
+ first_disinfection_methods := dataBody["first_disinfection_methods"].(string)
|
|
6273
|
+ first_disinfection_time := dataBody["first_disinfection_time"].(string)
|
|
6274
|
+
|
|
6275
|
+ first_start_time := dataBody["first_start_time"].(string)
|
|
6276
|
+
|
|
6277
|
+ var firstStartTimeUnix int64
|
|
6278
|
+ if len(first_start_time) > 0 {
|
|
6279
|
+ firstStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_start_time)
|
|
6280
|
+ firstStartTimeUnix = firstStartTime.Unix()
|
|
6281
|
+ }
|
|
6282
|
+
|
|
6283
|
+ var firstEndTimeUnix int64
|
|
6284
|
+ first_end_time := dataBody["first_end_time"].(string)
|
|
6285
|
+
|
|
6286
|
+ if len(first_end_time) > 0 {
|
|
6287
|
+ firstEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", first_end_time)
|
|
6288
|
+ firstEndTimeUnix = firstEndTime.Unix()
|
|
6289
|
+ }
|
|
6290
|
+
|
|
6291
|
+ first_total_time := dataBody["first_total_time"].(string)
|
|
6292
|
+
|
|
6293
|
+ first_is_check := int64(dataBody["first_is_check"].(float64))
|
|
6294
|
+
|
|
6295
|
+ first_modifications := int64(dataBody["first_modifications"].(float64))
|
|
6296
|
+
|
|
6297
|
+ first_creator := int64(dataBody["first_creator"].(float64))
|
|
6298
|
+
|
|
6299
|
+ last_disinfection_water := dataBody["last_disinfection_water"].(string)
|
|
6300
|
+ last_disinfection_methods := dataBody["last_disinfection_methods"].(string)
|
|
6301
|
+ last_disinfection_time := dataBody["last_disinfection_time"].(string)
|
|
6302
|
+ last_start_time := dataBody["last_start_time"].(string)
|
|
6303
|
+ var lastStartTimeUnix int64
|
|
6304
|
+ if len(last_start_time) > 0 {
|
|
6305
|
+ lastStartTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_start_time)
|
|
6306
|
+ lastStartTimeUnix = lastStartTime.Unix()
|
|
6307
|
+ }
|
|
6308
|
+
|
|
6309
|
+ last_end_time := dataBody["last_end_time"].(string)
|
|
6310
|
+
|
|
6311
|
+ var lastEndTimeUnix int64
|
|
6312
|
+ if len(last_end_time) > 0 {
|
|
6313
|
+ lastEndTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", last_end_time)
|
|
6314
|
+ lastEndTimeUnix = lastEndTime.Unix()
|
|
6315
|
+ }
|
|
6316
|
+
|
|
6317
|
+ last_total_time := dataBody["last_total_time"].(string)
|
|
6318
|
+
|
|
6319
|
+ last_is_check := int64(dataBody["last_is_check"].(float64))
|
|
6320
|
+
|
|
6321
|
+ last_modifications := int64(dataBody["last_modifications"].(float64))
|
|
6322
|
+
|
|
6323
|
+ last_creator := int64(dataBody["last_creator"].(float64))
|
|
6324
|
+
|
|
6325
|
+ id := int64(dataBody["id"].(float64))
|
|
6326
|
+
|
|
6327
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
6328
|
+
|
|
6329
|
+ department := dataBody["department"].(string)
|
|
6330
|
+ objectDisinfect := models.XtNewObjectDisinfectWay{
|
|
6331
|
+ ID: id,
|
|
6332
|
+ UserOrgId: orgId,
|
|
6333
|
+ RecordDate: recorddateunix,
|
|
6334
|
+ FirstDisinfectionWater: first_disinfection_water,
|
|
6335
|
+ FirstDisinfectionMethods: first_disinfection_methods,
|
|
6336
|
+ FirstDisinfectionTime: first_disinfection_time,
|
|
6337
|
+ FirstStartTime: firstStartTimeUnix,
|
|
6338
|
+ FirstEndTime: firstEndTimeUnix,
|
|
6339
|
+ FirstTotalTime: first_total_time,
|
|
6340
|
+ FirstIsCheck: first_is_check,
|
|
6341
|
+ FirstModifications: first_modifications,
|
|
6342
|
+ FirstCreator: first_creator,
|
|
6343
|
+ LastStartTime: lastStartTimeUnix,
|
|
6344
|
+ LastEndTime: lastEndTimeUnix,
|
|
6345
|
+ LastTotalTime: last_total_time,
|
|
6346
|
+ LastIsCheck: last_is_check,
|
|
6347
|
+ LastModifications: last_modifications,
|
|
6348
|
+ LastCreator: last_creator,
|
|
6349
|
+ Ctime: time.Now().Unix(),
|
|
6350
|
+ Mtime: 0,
|
|
6351
|
+ Status: 1,
|
|
6352
|
+ LastDisinfectionWater: last_disinfection_water,
|
|
6353
|
+ LastDisinfectionMethods: last_disinfection_methods,
|
|
6354
|
+ LastDisinfectionTime: last_disinfection_time,
|
|
6355
|
+ Department: department,
|
|
6356
|
+ }
|
|
6357
|
+ err = service.SaveobjectDisinfect(objectDisinfect)
|
|
6358
|
+ if err != nil {
|
|
6359
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
|
|
6360
|
+ return
|
|
6361
|
+ }
|
|
6362
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
6363
|
+ "objectDisinfect": objectDisinfect,
|
|
6364
|
+ })
|
|
6365
|
+}
|
|
6366
|
+
|
|
6367
|
+func (this *MachineApiController) DeleteObjectAbleWayDisinfect() {
|
|
6368
|
+
|
|
6369
|
+ id, _ := this.GetInt64("id")
|
|
6370
|
+ err := service.DeleteObjectAbleWayDisinfect(id)
|
|
6371
|
+
|
|
6372
|
+ if err != nil {
|
|
6373
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
|
|
6374
|
+ return
|
|
6375
|
+ }
|
|
6376
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
6377
|
+ "msg": "ok",
|
|
6378
|
+ })
|
|
6379
|
+ return
|
|
6380
|
+}
|