enhance(meter):调整对于表计类型的解析。

This commit is contained in:
徐涛 2023-06-13 10:59:49 +08:00
parent 7bac667c2a
commit 6f0edc54bf
3 changed files with 20 additions and 2 deletions

View File

@ -1,5 +1,9 @@
package model
import (
"strings"
)
const (
ELECTRICITY_CATE_TWO_PART int16 = iota
ELECTRICITY_CATE_UNITARY_PV
@ -15,8 +19,22 @@ const (
METER_INSTALLATION_TENEMENT int16 = iota
METER_INSTALLATION_PARK
METER_INSTALLATION_POOLING
METER_INSTALLATION_UNDEFINED = 99
)
func ParseMeterInstallationType(s string) int16 {
switch {
case strings.Contains(s, "商户"):
return METER_INSTALLATION_TENEMENT
case strings.Contains(s, "公共"):
return METER_INSTALLATION_PARK
case strings.Contains(s, "楼道"):
return METER_INSTALLATION_POOLING
default:
return METER_INSTALLATION_UNDEFINED
}
}
const (
PRICING_POLICY_CONSUMPTION int16 = iota
PRICING_POLICY_ALL

View File

@ -81,7 +81,7 @@ type PooledMeterDetailCompound struct {
type MeterImportRow struct {
Code string `json:"code" excel:"code"`
Address *string `json:"address" excel:"address"`
MeterType int16 `json:"meterType" excel:"meterType"`
MeterType *string `json:"meterType" excel:"meterType"`
Building *string `json:"building" excel:"building"`
OnFloor *string `json:"onFloor" excel:"onFloor"`
Area decimal.NullDecimal `json:"area" excel:"area"`

View File

@ -208,7 +208,7 @@ func (ms _MeterService) BatchImportMeters(pid string, file *multipart.FileHeader
return vo.MeterCreationForm{
Code: element.Code,
Address: element.Address,
MeterType: element.MeterType,
MeterType: model.ParseMeterInstallationType(*element.MeterType),
Ratio: element.Ratio,
Seq: element.Seq,
Enabled: true,