作者 yangfu

企业修改、省市列表获取

... ... @@ -6,6 +6,7 @@ import (
"github.com/linmadan/egglib-go/log/logrus"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/area"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/redis"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log"
... ... @@ -30,6 +31,7 @@ func main() {
log.Logger.AddHook(bw)
goqueue.SetUp()
area.SetUp()
log.Logger.Info("server start!")
web.Run()
... ...
... ... @@ -2,6 +2,7 @@ package command
import (
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain"
"reflect"
"strings"
... ... @@ -21,6 +22,15 @@ type CompanySignUpCommand struct {
IndustryCategory string `cname:"所属行业" json:"industryCategory" valid:"Required"`
// 密码
Password string `cname:"密码" json:"password" valid:"Required"`
// 法人
LegalPerson string `cname:"法人" json:"legalPerson" valid:"Required"`
// 社会信用代码
SocialCreditCode string `cname:"社会信用代码" json:"socialCreditCode" valid:"Required"`
// 营业执照所在地
BusinessLicenseAddress domain.BusinessLicenseAddress `cname:"营业执照所在地" json:"businessLicenseAddress" valid:"Required"`
// 营业执照-附件
BusinessLicenseAttachments []domain.Attachment `cname:"营业执照-附件" json:"businessLicenseAttachments" valid:"Required"`
}
func (companySignUpCommand *CompanySignUpCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -45,6 +45,12 @@ func (authService *AuthService) CompanySignUp(companySignUpCommand *command.Comp
Address: "",
IndustryCategory: companySignUpCommand.IndustryCategory,
RegisteredTime: time.Now(),
Legal: domain.Legal{
LegalPerson: companySignUpCommand.LegalPerson,
SocialCreditCode: companySignUpCommand.SocialCreditCode,
BusinessLicenseAddress: companySignUpCommand.BusinessLicenseAddress,
BusinessLicenseAttachments: companySignUpCommand.BusinessLicenseAttachments,
},
}
userInfo := &domain.UserInfo{
UserName: companySignUpCommand.Contacts,
... ...
package command
import (
"fmt"
"reflect"
"strings"
"github.com/beego/beego/v2/core/validation"
)
type AuditCompanyCommand struct {
// 企业id
CompanyId int64 `cname:"企业id" json:"companyId,string" valid:"Required"`
// 审核状态
Status int `cname:"审核状态" json:"status" valid:"Required"`
// 备注
Remark string `cname:"备注" json:"remark" valid:"Required"`
}
func (updateCompanyCommand *AuditCompanyCommand) Valid(validation *validation.Validation) {
//validation.SetError("CustomValid", "未实现的自定义认证")
}
func (updateCompanyCommand *AuditCompanyCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(updateCompanyCommand)
if err != nil {
return err
}
if !b {
elem := reflect.TypeOf(updateCompanyCommand).Elem()
for _, validErr := range valid.Errors {
field, isExist := elem.FieldByName(validErr.Field)
if isExist {
return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1))
} else {
return fmt.Errorf(validErr.Message)
}
}
}
return nil
}
... ...
package command
import (
"fmt"
"reflect"
"strings"
"github.com/beego/beego/v2/core/validation"
)
type EnableCompanyCommand struct {
// 企业id
CompanyId int64 `cname:"企业id" json:"companyId,string" valid:"Required"`
// 审核状态
Status int `cname:"审核状态" json:"status" valid:"Required"`
}
func (updateCompanyCommand *EnableCompanyCommand) Valid(validation *validation.Validation) {
//validation.SetError("CustomValid", "未实现的自定义认证")
}
func (updateCompanyCommand *EnableCompanyCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(updateCompanyCommand)
if err != nil {
return err
}
if !b {
elem := reflect.TypeOf(updateCompanyCommand).Elem()
for _, validErr := range valid.Errors {
field, isExist := elem.FieldByName(validErr.Field)
if isExist {
return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1))
} else {
return fmt.Errorf(validErr.Message)
}
}
}
return nil
}
... ...
... ... @@ -10,9 +10,13 @@ import (
type ListCompanyQuery struct {
// 查询偏离量
Offset int `cname:"查询偏离量" json:"offset" valid:"Required"`
Offset int `cname:"查询偏离量" json:"offset,omitempty"`
// 查询限制
Limit int `cname:"查询限制" json:"limit" valid:"Required"`
Limit int `cname:"查询限制" json:"limit,omitempty"`
// 状态
Status int `cname:"状态" json:"status,omitempty"`
// 企业名称
CompanyName string `cname:"企业名称" json:"companyName,omitempty"`
}
func (listCompanyQuery *ListCompanyQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -10,6 +10,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/common"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/utils"
"strconv"
)
... ... @@ -113,7 +114,7 @@ func (companyService *CompanyService) ListCompany(listCompanyQuery *query.ListCo
} else {
companyRepository = value
}
if count, companys, err := companyRepository.Find(tool_funs.SimpleStructToMap(listCompanyQuery)); err != nil {
if count, companys, err := companyRepository.Find(utils.ObjectToMap(listCompanyQuery)); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if err := transactionContext.CommitTransaction(); err != nil {
... ... @@ -279,6 +280,92 @@ func (companyService *CompanyService) UpdateCompany(updateCompanyCommand *comman
}
}
// 审核企业
func (companyService *CompanyService) AuditCompany(cmd *command.AuditCompanyCommand) (interface{}, error) {
if err := cmd.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
}()
var companyRepository domain.CompanyRepository
if value, err := factory.CreateCompanyRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
companyRepository = value
}
company, err := companyRepository.FindOne(map[string]interface{}{"companyId": cmd.CompanyId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if company == nil {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(cmd.CompanyId)))
}
if err := company.Audit(cmd.Status, cmd.Remark); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
if company, err := companyRepository.Save(company); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return company, nil
}
}
// 禁用启用企业
func (companyService *CompanyService) EnableCompany(cmd *command.EnableCompanyCommand) (interface{}, error) {
if err := cmd.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
}()
var companyRepository domain.CompanyRepository
if value, err := factory.CreateCompanyRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
companyRepository = value
}
company, err := companyRepository.FindOne(map[string]interface{}{"companyId": cmd.CompanyId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if company == nil {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(cmd.CompanyId)))
}
if err := company.Enable(cmd.Status); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
if company, err := companyRepository.Save(company); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return company, nil
}
}
// 更新自定义菜单
func (companyService *CompanyService) UpdateCompanyCustomizeMenus(updateCompanyCustomizeMenusCommand *command.UpdateCompanyCustomizeMenusCommand) (interface{}, error) {
if err := updateCompanyCustomizeMenusCommand.ValidateCommand(); err != nil {
... ...
... ... @@ -41,6 +41,8 @@ type ListUserQuery struct {
EnableStatus int `cname:"状态(1:启用 2:禁用 3:注销)" json:"enableStatus,omitempty"`
// 状态(1:启用 2:禁用 3:注销)
InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"`
// 在企业范围内
InCompanyIds []int64 `cname:"在企业范围内" json:"inCompanyIds,omitempty"`
}
func (listUserQuery *ListUserQuery) Valid(validation *validation.Validation) {
... ...
package domain
// Attachment 附件对象
type Attachment struct {
// 附件文件类型,jpg,pdf
FileType string `json:"fileType"`
// 附件名称
Name string `json:"name"`
// 附件地址
Url string `json:"url"`
// 附件文件大小,保存KB单位
FileSize int64 `json:"fileSize"`
}
... ...
... ... @@ -6,11 +6,12 @@ import (
"time"
)
// 公司状态状态 1:已注册 2:待认证 3:已认证
// 公司状态状态 1:已注册 2:已通过 3:已拒绝 4:禁用
const (
CompanyRegistered = iota + 1
CompanyUnauthenticated
CompanyAuthenticated
CompanyUnauthenticated
CompanyUnAvailable
)
// 企业信息 (base)
... ... @@ -21,7 +22,7 @@ type Company struct {
CompanyConfig *CompanyConfig `json:"companyConfig"`
// 企业基本信息
CompanyInfo *CompanyInfo `json:"companyInfo"`
// 公司状态 1:已注册 2:待认证 3:已认证
// 公司状态 1:已注册(待审核) 2:已通过 3:已拒绝
Status int `json:"status"`
// 创建时间
CreatedAt time.Time `json:"createdAt"`
... ... @@ -102,6 +103,36 @@ func (company *Company) ToCompanyVisible() *CompanyVisible {
}
}
// 公司审核
func (company *Company) Audit(status int, remark string) error {
if company.Status != CompanyRegistered {
return fmt.Errorf("公司已审核")
}
if !(status == CompanyAuthenticated || status == CompanyUnauthenticated) {
return fmt.Errorf("审核状态有误")
}
company.Status = status
company.CompanyInfo.Remark = remark
company.Update(map[string]interface{}{})
return nil
}
// 公司启用禁用
func (company *Company) Enable(status int) error {
if company.Status == CompanyRegistered {
return fmt.Errorf("公司待审核")
}
if company.Status == status {
return nil
}
if !(status == CompanyAuthenticated || status == CompanyUnAvailable) {
return fmt.Errorf("状态有误 2:启用 4:禁用")
}
company.Status = status
company.Update(map[string]interface{}{})
return nil
}
/***** 2.缓存模块 *****/
func (company *Company) CacheKeyFunc() string {
... ...
... ... @@ -14,10 +14,29 @@ type CompanyInfo struct {
Address string `json:"address,omitempty"`
// 所属行业
IndustryCategory string `json:"industryCategory,omitempty"`
// 联系人
//Contacts string `json:"contacts"`
// 注册时间
RegisteredTime time.Time `json:"registeredTime,omitempty"`
// 状态 1:已注册 2:待认证 3:已认证
//Status int `json:"status"`
// 法律相关
Legal Legal `json:"legal"`
// 备注信息(审核时使用)
Remark string `json:"备注"`
}
// 法律相关
type Legal struct {
// 法人
LegalPerson string `json:"legalPerson"`
// 社会信用代码
SocialCreditCode string `json:"socialCreditCode"`
// 营业执照所在地
BusinessLicenseAddress BusinessLicenseAddress `json:"businessLicenseAddress"`
// 营业执照-附件
BusinessLicenseAttachments []Attachment `json:"businessLicenseAttachments"`
}
// 营业执照所在地
type BusinessLicenseAddress struct {
Province string `json:"province"`
City string `json:"city"`
Address string `json:"address"`
}
... ...
... ... @@ -43,8 +43,9 @@ type UserBase struct {
}
type Favorite struct {
OrgItems []int64 `json:"orgItems"`
Referer string `json:"referer"`
OrgItems []int64 `json:"orgItems"`
Referer string `json:"referer"`
LastLogInAt int64 `json:"lastLogInAt"`
}
type UserBaseRepository interface {
... ... @@ -263,6 +264,17 @@ func (userBase *UserBase) removeFavorite(items []int64, code int64) ([]int64, er
return newItems, nil
}
// LastLogIn 更新最后一次登录时间
//
// t 时间
func (userBase *UserBase) LastLogIn(t time.Time) error {
if userBase.Favorite == nil {
userBase.Favorite = NewFavorite()
}
userBase.Favorite.LastLogInAt = t.Unix()
return nil
}
/***** 2.缓存模块 *****/
func (m *UserBase) CacheKeyFunc() string {
... ...
package area
import (
_ "embed"
"encoding/json"
)
type ProvinceCity struct {
Provinces []*Province
Cities []*City
ProvincesCity map[string][]*City
}
func (p *ProvinceCity) LoadProvincesCity(provinces []*Province, cities []*City) {
p.Provinces = provinces
p.Cities = cities
for i := range provinces {
p.ProvincesCity[provinces[i].Province] = make([]*City, 0)
}
for i := range cities {
if _, ok := p.ProvincesCity[cities[i].Province]; ok {
p.ProvincesCity[cities[i].Province] = append(p.ProvincesCity[cities[i].Province], cities[i])
}
}
}
var DefaultProvinceCity *ProvinceCity
// data source :https://github.com/uiwjs/province-city-china/tree/gh-pages
//go:embed city.json
var city []byte
//go:embed province.json
var province []byte
func SetUp() {
DefaultProvinceCity = &ProvinceCity{
Provinces: make([]*Province, 0),
Cities: make([]*City, 0),
ProvincesCity: make(map[string][]*City),
}
var cities []*City = make([]*City, 0)
var provinces []*Province = make([]*Province, 0)
err := json.Unmarshal(city, &cities)
if err != nil {
panic(err)
}
err = json.Unmarshal(province, &provinces)
if err != nil {
panic(err)
}
DefaultProvinceCity.LoadProvincesCity(provinces, cities)
}
/*
eg:
{
"code": "130100",
"name": "石家庄市",
"province": "13",
"city": "01"
}
*/
type City struct {
Code string `json:"code"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
}
/*
eg:
{
"code": "110000",
"name": "北京市",
"province": "11"
}
*/
type Province struct {
Code string `json:"code"`
Name string `json:"name"`
Province string `json:"province"`
}
func Provinces() []*Province {
return DefaultProvinceCity.Provinces
}
func Cities() []*City {
return DefaultProvinceCity.Cities
}
func ProvinceCities(provinceCode string) []*City {
if v, ok := DefaultProvinceCity.ProvincesCity[provinceCode]; ok {
return v
}
return []*City{}
}
... ...
[
{
"code": "130100",
"name": "石家庄市",
"province": "13",
"city": "01"
},
{
"code": "130200",
"name": "唐山市",
"province": "13",
"city": "02"
},
{
"code": "130300",
"name": "秦皇岛市",
"province": "13",
"city": "03"
},
{
"code": "130400",
"name": "邯郸市",
"province": "13",
"city": "04"
},
{
"code": "130500",
"name": "邢台市",
"province": "13",
"city": "05"
},
{
"code": "130600",
"name": "保定市",
"province": "13",
"city": "06"
},
{
"code": "130700",
"name": "张家口市",
"province": "13",
"city": "07"
},
{
"code": "130800",
"name": "承德市",
"province": "13",
"city": "08"
},
{
"code": "130900",
"name": "沧州市",
"province": "13",
"city": "09"
},
{
"code": "131000",
"name": "廊坊市",
"province": "13",
"city": "10"
},
{
"code": "131100",
"name": "衡水市",
"province": "13",
"city": "11"
},
{
"code": "140100",
"name": "太原市",
"province": "14",
"city": "01"
},
{
"code": "140200",
"name": "大同市",
"province": "14",
"city": "02"
},
{
"code": "140300",
"name": "阳泉市",
"province": "14",
"city": "03"
},
{
"code": "140400",
"name": "长治市",
"province": "14",
"city": "04"
},
{
"code": "140500",
"name": "晋城市",
"province": "14",
"city": "05"
},
{
"code": "140600",
"name": "朔州市",
"province": "14",
"city": "06"
},
{
"code": "140700",
"name": "晋中市",
"province": "14",
"city": "07"
},
{
"code": "140800",
"name": "运城市",
"province": "14",
"city": "08"
},
{
"code": "140900",
"name": "忻州市",
"province": "14",
"city": "09"
},
{
"code": "141000",
"name": "临汾市",
"province": "14",
"city": "10"
},
{
"code": "141100",
"name": "吕梁市",
"province": "14",
"city": "11"
},
{
"code": "150100",
"name": "呼和浩特市",
"province": "15",
"city": "01"
},
{
"code": "150200",
"name": "包头市",
"province": "15",
"city": "02"
},
{
"code": "150300",
"name": "乌海市",
"province": "15",
"city": "03"
},
{
"code": "150400",
"name": "赤峰市",
"province": "15",
"city": "04"
},
{
"code": "150500",
"name": "通辽市",
"province": "15",
"city": "05"
},
{
"code": "150600",
"name": "鄂尔多斯市",
"province": "15",
"city": "06"
},
{
"code": "150700",
"name": "呼伦贝尔市",
"province": "15",
"city": "07"
},
{
"code": "150800",
"name": "巴彦淖尔市",
"province": "15",
"city": "08"
},
{
"code": "150900",
"name": "乌兰察布市",
"province": "15",
"city": "09"
},
{
"code": "152200",
"name": "兴安盟",
"province": "15",
"city": "22"
},
{
"code": "152500",
"name": "锡林郭勒盟",
"province": "15",
"city": "25"
},
{
"code": "152900",
"name": "阿拉善盟",
"province": "15",
"city": "29"
},
{
"code": "210100",
"name": "沈阳市",
"province": "21",
"city": "01"
},
{
"code": "210200",
"name": "大连市",
"province": "21",
"city": "02"
},
{
"code": "210300",
"name": "鞍山市",
"province": "21",
"city": "03"
},
{
"code": "210400",
"name": "抚顺市",
"province": "21",
"city": "04"
},
{
"code": "210500",
"name": "本溪市",
"province": "21",
"city": "05"
},
{
"code": "210600",
"name": "丹东市",
"province": "21",
"city": "06"
},
{
"code": "210700",
"name": "锦州市",
"province": "21",
"city": "07"
},
{
"code": "210800",
"name": "营口市",
"province": "21",
"city": "08"
},
{
"code": "210900",
"name": "阜新市",
"province": "21",
"city": "09"
},
{
"code": "211000",
"name": "辽阳市",
"province": "21",
"city": "10"
},
{
"code": "211100",
"name": "盘锦市",
"province": "21",
"city": "11"
},
{
"code": "211200",
"name": "铁岭市",
"province": "21",
"city": "12"
},
{
"code": "211300",
"name": "朝阳市",
"province": "21",
"city": "13"
},
{
"code": "211400",
"name": "葫芦岛市",
"province": "21",
"city": "14"
},
{
"code": "220100",
"name": "长春市",
"province": "22",
"city": "01"
},
{
"code": "220200",
"name": "吉林市",
"province": "22",
"city": "02"
},
{
"code": "220300",
"name": "四平市",
"province": "22",
"city": "03"
},
{
"code": "220400",
"name": "辽源市",
"province": "22",
"city": "04"
},
{
"code": "220500",
"name": "通化市",
"province": "22",
"city": "05"
},
{
"code": "220600",
"name": "白山市",
"province": "22",
"city": "06"
},
{
"code": "220700",
"name": "松原市",
"province": "22",
"city": "07"
},
{
"code": "220800",
"name": "白城市",
"province": "22",
"city": "08"
},
{
"code": "222400",
"name": "延边朝鲜族自治州",
"province": "22",
"city": "24"
},
{
"code": "230100",
"name": "哈尔滨市",
"province": "23",
"city": "01"
},
{
"code": "230200",
"name": "齐齐哈尔市",
"province": "23",
"city": "02"
},
{
"code": "230300",
"name": "鸡西市",
"province": "23",
"city": "03"
},
{
"code": "230400",
"name": "鹤岗市",
"province": "23",
"city": "04"
},
{
"code": "230500",
"name": "双鸭山市",
"province": "23",
"city": "05"
},
{
"code": "230600",
"name": "大庆市",
"province": "23",
"city": "06"
},
{
"code": "230700",
"name": "伊春市",
"province": "23",
"city": "07"
},
{
"code": "230800",
"name": "佳木斯市",
"province": "23",
"city": "08"
},
{
"code": "230900",
"name": "七台河市",
"province": "23",
"city": "09"
},
{
"code": "231000",
"name": "牡丹江市",
"province": "23",
"city": "10"
},
{
"code": "231100",
"name": "黑河市",
"province": "23",
"city": "11"
},
{
"code": "231200",
"name": "绥化市",
"province": "23",
"city": "12"
},
{
"code": "232700",
"name": "大兴安岭地区",
"province": "23",
"city": "27"
},
{
"code": "320100",
"name": "南京市",
"province": "32",
"city": "01"
},
{
"code": "320200",
"name": "无锡市",
"province": "32",
"city": "02"
},
{
"code": "320300",
"name": "徐州市",
"province": "32",
"city": "03"
},
{
"code": "320400",
"name": "常州市",
"province": "32",
"city": "04"
},
{
"code": "320500",
"name": "苏州市",
"province": "32",
"city": "05"
},
{
"code": "320600",
"name": "南通市",
"province": "32",
"city": "06"
},
{
"code": "320700",
"name": "连云港市",
"province": "32",
"city": "07"
},
{
"code": "320800",
"name": "淮安市",
"province": "32",
"city": "08"
},
{
"code": "320900",
"name": "盐城市",
"province": "32",
"city": "09"
},
{
"code": "321000",
"name": "扬州市",
"province": "32",
"city": "10"
},
{
"code": "321100",
"name": "镇江市",
"province": "32",
"city": "11"
},
{
"code": "321200",
"name": "泰州市",
"province": "32",
"city": "12"
},
{
"code": "321300",
"name": "宿迁市",
"province": "32",
"city": "13"
},
{
"code": "330100",
"name": "杭州市",
"province": "33",
"city": "01"
},
{
"code": "330200",
"name": "宁波市",
"province": "33",
"city": "02"
},
{
"code": "330300",
"name": "温州市",
"province": "33",
"city": "03"
},
{
"code": "330400",
"name": "嘉兴市",
"province": "33",
"city": "04"
},
{
"code": "330500",
"name": "湖州市",
"province": "33",
"city": "05"
},
{
"code": "330600",
"name": "绍兴市",
"province": "33",
"city": "06"
},
{
"code": "330700",
"name": "金华市",
"province": "33",
"city": "07"
},
{
"code": "330800",
"name": "衢州市",
"province": "33",
"city": "08"
},
{
"code": "330900",
"name": "舟山市",
"province": "33",
"city": "09"
},
{
"code": "331000",
"name": "台州市",
"province": "33",
"city": "10"
},
{
"code": "331100",
"name": "丽水市",
"province": "33",
"city": "11"
},
{
"code": "340100",
"name": "合肥市",
"province": "34",
"city": "01"
},
{
"code": "340200",
"name": "芜湖市",
"province": "34",
"city": "02"
},
{
"code": "340300",
"name": "蚌埠市",
"province": "34",
"city": "03"
},
{
"code": "340400",
"name": "淮南市",
"province": "34",
"city": "04"
},
{
"code": "340500",
"name": "马鞍山市",
"province": "34",
"city": "05"
},
{
"code": "340600",
"name": "淮北市",
"province": "34",
"city": "06"
},
{
"code": "340700",
"name": "铜陵市",
"province": "34",
"city": "07"
},
{
"code": "340800",
"name": "安庆市",
"province": "34",
"city": "08"
},
{
"code": "341000",
"name": "黄山市",
"province": "34",
"city": "10"
},
{
"code": "341100",
"name": "滁州市",
"province": "34",
"city": "11"
},
{
"code": "341200",
"name": "阜阳市",
"province": "34",
"city": "12"
},
{
"code": "341300",
"name": "宿州市",
"province": "34",
"city": "13"
},
{
"code": "341500",
"name": "六安市",
"province": "34",
"city": "15"
},
{
"code": "341600",
"name": "亳州市",
"province": "34",
"city": "16"
},
{
"code": "341700",
"name": "池州市",
"province": "34",
"city": "17"
},
{
"code": "341800",
"name": "宣城市",
"province": "34",
"city": "18"
},
{
"code": "350100",
"name": "福州市",
"province": "35",
"city": "01"
},
{
"code": "350200",
"name": "厦门市",
"province": "35",
"city": "02"
},
{
"code": "350300",
"name": "莆田市",
"province": "35",
"city": "03"
},
{
"code": "350400",
"name": "三明市",
"province": "35",
"city": "04"
},
{
"code": "350500",
"name": "泉州市",
"province": "35",
"city": "05"
},
{
"code": "350600",
"name": "漳州市",
"province": "35",
"city": "06"
},
{
"code": "350700",
"name": "南平市",
"province": "35",
"city": "07"
},
{
"code": "350800",
"name": "龙岩市",
"province": "35",
"city": "08"
},
{
"code": "350900",
"name": "宁德市",
"province": "35",
"city": "09"
},
{
"code": "360100",
"name": "南昌市",
"province": "36",
"city": "01"
},
{
"code": "360200",
"name": "景德镇市",
"province": "36",
"city": "02"
},
{
"code": "360300",
"name": "萍乡市",
"province": "36",
"city": "03"
},
{
"code": "360400",
"name": "九江市",
"province": "36",
"city": "04"
},
{
"code": "360500",
"name": "新余市",
"province": "36",
"city": "05"
},
{
"code": "360600",
"name": "鹰潭市",
"province": "36",
"city": "06"
},
{
"code": "360700",
"name": "赣州市",
"province": "36",
"city": "07"
},
{
"code": "360800",
"name": "吉安市",
"province": "36",
"city": "08"
},
{
"code": "360900",
"name": "宜春市",
"province": "36",
"city": "09"
},
{
"code": "361000",
"name": "抚州市",
"province": "36",
"city": "10"
},
{
"code": "361100",
"name": "上饶市",
"province": "36",
"city": "11"
},
{
"code": "370100",
"name": "济南市",
"province": "37",
"city": "01"
},
{
"code": "370200",
"name": "青岛市",
"province": "37",
"city": "02"
},
{
"code": "370300",
"name": "淄博市",
"province": "37",
"city": "03"
},
{
"code": "370400",
"name": "枣庄市",
"province": "37",
"city": "04"
},
{
"code": "370500",
"name": "东营市",
"province": "37",
"city": "05"
},
{
"code": "370600",
"name": "烟台市",
"province": "37",
"city": "06"
},
{
"code": "370700",
"name": "潍坊市",
"province": "37",
"city": "07"
},
{
"code": "370800",
"name": "济宁市",
"province": "37",
"city": "08"
},
{
"code": "370900",
"name": "泰安市",
"province": "37",
"city": "09"
},
{
"code": "371000",
"name": "威海市",
"province": "37",
"city": "10"
},
{
"code": "371100",
"name": "日照市",
"province": "37",
"city": "11"
},
{
"code": "371300",
"name": "临沂市",
"province": "37",
"city": "13"
},
{
"code": "371400",
"name": "德州市",
"province": "37",
"city": "14"
},
{
"code": "371500",
"name": "聊城市",
"province": "37",
"city": "15"
},
{
"code": "371600",
"name": "滨州市",
"province": "37",
"city": "16"
},
{
"code": "371700",
"name": "菏泽市",
"province": "37",
"city": "17"
},
{
"code": "410100",
"name": "郑州市",
"province": "41",
"city": "01"
},
{
"code": "410200",
"name": "开封市",
"province": "41",
"city": "02"
},
{
"code": "410300",
"name": "洛阳市",
"province": "41",
"city": "03"
},
{
"code": "410400",
"name": "平顶山市",
"province": "41",
"city": "04"
},
{
"code": "410500",
"name": "安阳市",
"province": "41",
"city": "05"
},
{
"code": "410600",
"name": "鹤壁市",
"province": "41",
"city": "06"
},
{
"code": "410700",
"name": "新乡市",
"province": "41",
"city": "07"
},
{
"code": "410800",
"name": "焦作市",
"province": "41",
"city": "08"
},
{
"code": "410900",
"name": "濮阳市",
"province": "41",
"city": "09"
},
{
"code": "411000",
"name": "许昌市",
"province": "41",
"city": "10"
},
{
"code": "411100",
"name": "漯河市",
"province": "41",
"city": "11"
},
{
"code": "411200",
"name": "三门峡市",
"province": "41",
"city": "12"
},
{
"code": "411300",
"name": "南阳市",
"province": "41",
"city": "13"
},
{
"code": "411400",
"name": "商丘市",
"province": "41",
"city": "14"
},
{
"code": "411500",
"name": "信阳市",
"province": "41",
"city": "15"
},
{
"code": "411600",
"name": "周口市",
"province": "41",
"city": "16"
},
{
"code": "411700",
"name": "驻马店市",
"province": "41",
"city": "17"
},
{
"code": "420100",
"name": "武汉市",
"province": "42",
"city": "01"
},
{
"code": "420200",
"name": "黄石市",
"province": "42",
"city": "02"
},
{
"code": "420300",
"name": "十堰市",
"province": "42",
"city": "03"
},
{
"code": "420500",
"name": "宜昌市",
"province": "42",
"city": "05"
},
{
"code": "420600",
"name": "襄阳市",
"province": "42",
"city": "06"
},
{
"code": "420700",
"name": "鄂州市",
"province": "42",
"city": "07"
},
{
"code": "420800",
"name": "荆门市",
"province": "42",
"city": "08"
},
{
"code": "420900",
"name": "孝感市",
"province": "42",
"city": "09"
},
{
"code": "421000",
"name": "荆州市",
"province": "42",
"city": "10"
},
{
"code": "421100",
"name": "黄冈市",
"province": "42",
"city": "11"
},
{
"code": "421200",
"name": "咸宁市",
"province": "42",
"city": "12"
},
{
"code": "421300",
"name": "随州市",
"province": "42",
"city": "13"
},
{
"code": "422800",
"name": "恩施土家族苗族自治州",
"province": "42",
"city": "28"
},
{
"code": "430100",
"name": "长沙市",
"province": "43",
"city": "01"
},
{
"code": "430200",
"name": "株洲市",
"province": "43",
"city": "02"
},
{
"code": "430300",
"name": "湘潭市",
"province": "43",
"city": "03"
},
{
"code": "430400",
"name": "衡阳市",
"province": "43",
"city": "04"
},
{
"code": "430500",
"name": "邵阳市",
"province": "43",
"city": "05"
},
{
"code": "430600",
"name": "岳阳市",
"province": "43",
"city": "06"
},
{
"code": "430700",
"name": "常德市",
"province": "43",
"city": "07"
},
{
"code": "430800",
"name": "张家界市",
"province": "43",
"city": "08"
},
{
"code": "430900",
"name": "益阳市",
"province": "43",
"city": "09"
},
{
"code": "431000",
"name": "郴州市",
"province": "43",
"city": "10"
},
{
"code": "431100",
"name": "永州市",
"province": "43",
"city": "11"
},
{
"code": "431200",
"name": "怀化市",
"province": "43",
"city": "12"
},
{
"code": "431300",
"name": "娄底市",
"province": "43",
"city": "13"
},
{
"code": "433100",
"name": "湘西土家族苗族自治州",
"province": "43",
"city": "31"
},
{
"code": "440100",
"name": "广州市",
"province": "44",
"city": "01"
},
{
"code": "440200",
"name": "韶关市",
"province": "44",
"city": "02"
},
{
"code": "440300",
"name": "深圳市",
"province": "44",
"city": "03"
},
{
"code": "440400",
"name": "珠海市",
"province": "44",
"city": "04"
},
{
"code": "440500",
"name": "汕头市",
"province": "44",
"city": "05"
},
{
"code": "440600",
"name": "佛山市",
"province": "44",
"city": "06"
},
{
"code": "440700",
"name": "江门市",
"province": "44",
"city": "07"
},
{
"code": "440800",
"name": "湛江市",
"province": "44",
"city": "08"
},
{
"code": "440900",
"name": "茂名市",
"province": "44",
"city": "09"
},
{
"code": "441200",
"name": "肇庆市",
"province": "44",
"city": "12"
},
{
"code": "441300",
"name": "惠州市",
"province": "44",
"city": "13"
},
{
"code": "441400",
"name": "梅州市",
"province": "44",
"city": "14"
},
{
"code": "441500",
"name": "汕尾市",
"province": "44",
"city": "15"
},
{
"code": "441600",
"name": "河源市",
"province": "44",
"city": "16"
},
{
"code": "441700",
"name": "阳江市",
"province": "44",
"city": "17"
},
{
"code": "441800",
"name": "清远市",
"province": "44",
"city": "18"
},
{
"code": "441900",
"name": "东莞市",
"province": "44",
"city": "19"
},
{
"code": "442000",
"name": "中山市",
"province": "44",
"city": "20"
},
{
"code": "445100",
"name": "潮州市",
"province": "44",
"city": "51"
},
{
"code": "445200",
"name": "揭阳市",
"province": "44",
"city": "52"
},
{
"code": "445300",
"name": "云浮市",
"province": "44",
"city": "53"
},
{
"code": "450100",
"name": "南宁市",
"province": "45",
"city": "01"
},
{
"code": "450200",
"name": "柳州市",
"province": "45",
"city": "02"
},
{
"code": "450300",
"name": "桂林市",
"province": "45",
"city": "03"
},
{
"code": "450400",
"name": "梧州市",
"province": "45",
"city": "04"
},
{
"code": "450500",
"name": "北海市",
"province": "45",
"city": "05"
},
{
"code": "450600",
"name": "防城港市",
"province": "45",
"city": "06"
},
{
"code": "450700",
"name": "钦州市",
"province": "45",
"city": "07"
},
{
"code": "450800",
"name": "贵港市",
"province": "45",
"city": "08"
},
{
"code": "450900",
"name": "玉林市",
"province": "45",
"city": "09"
},
{
"code": "451000",
"name": "百色市",
"province": "45",
"city": "10"
},
{
"code": "451100",
"name": "贺州市",
"province": "45",
"city": "11"
},
{
"code": "451200",
"name": "河池市",
"province": "45",
"city": "12"
},
{
"code": "451300",
"name": "来宾市",
"province": "45",
"city": "13"
},
{
"code": "451400",
"name": "崇左市",
"province": "45",
"city": "14"
},
{
"code": "460100",
"name": "海口市",
"province": "46",
"city": "01"
},
{
"code": "460200",
"name": "三亚市",
"province": "46",
"city": "02"
},
{
"code": "460300",
"name": "三沙市",
"province": "46",
"city": "03"
},
{
"code": "460400",
"name": "儋州市",
"province": "46",
"city": "04"
},
{
"code": "510100",
"name": "成都市",
"province": "51",
"city": "01"
},
{
"code": "510300",
"name": "自贡市",
"province": "51",
"city": "03"
},
{
"code": "510400",
"name": "攀枝花市",
"province": "51",
"city": "04"
},
{
"code": "510500",
"name": "泸州市",
"province": "51",
"city": "05"
},
{
"code": "510600",
"name": "德阳市",
"province": "51",
"city": "06"
},
{
"code": "510700",
"name": "绵阳市",
"province": "51",
"city": "07"
},
{
"code": "510800",
"name": "广元市",
"province": "51",
"city": "08"
},
{
"code": "510900",
"name": "遂宁市",
"province": "51",
"city": "09"
},
{
"code": "511000",
"name": "内江市",
"province": "51",
"city": "10"
},
{
"code": "511100",
"name": "乐山市",
"province": "51",
"city": "11"
},
{
"code": "511300",
"name": "南充市",
"province": "51",
"city": "13"
},
{
"code": "511400",
"name": "眉山市",
"province": "51",
"city": "14"
},
{
"code": "511500",
"name": "宜宾市",
"province": "51",
"city": "15"
},
{
"code": "511600",
"name": "广安市",
"province": "51",
"city": "16"
},
{
"code": "511700",
"name": "达州市",
"province": "51",
"city": "17"
},
{
"code": "511800",
"name": "雅安市",
"province": "51",
"city": "18"
},
{
"code": "511900",
"name": "巴中市",
"province": "51",
"city": "19"
},
{
"code": "512000",
"name": "资阳市",
"province": "51",
"city": "20"
},
{
"code": "513200",
"name": "阿坝藏族羌族自治州",
"province": "51",
"city": "32"
},
{
"code": "513300",
"name": "甘孜藏族自治州",
"province": "51",
"city": "33"
},
{
"code": "513400",
"name": "凉山彝族自治州",
"province": "51",
"city": "34"
},
{
"code": "520100",
"name": "贵阳市",
"province": "52",
"city": "01"
},
{
"code": "520200",
"name": "六盘水市",
"province": "52",
"city": "02"
},
{
"code": "520300",
"name": "遵义市",
"province": "52",
"city": "03"
},
{
"code": "520400",
"name": "安顺市",
"province": "52",
"city": "04"
},
{
"code": "520500",
"name": "毕节市",
"province": "52",
"city": "05"
},
{
"code": "520600",
"name": "铜仁市",
"province": "52",
"city": "06"
},
{
"code": "522300",
"name": "黔西南布依族苗族自治州",
"province": "52",
"city": "23"
},
{
"code": "522600",
"name": "黔东南苗族侗族自治州",
"province": "52",
"city": "26"
},
{
"code": "522700",
"name": "黔南布依族苗族自治州",
"province": "52",
"city": "27"
},
{
"code": "530100",
"name": "昆明市",
"province": "53",
"city": "01"
},
{
"code": "530300",
"name": "曲靖市",
"province": "53",
"city": "03"
},
{
"code": "530400",
"name": "玉溪市",
"province": "53",
"city": "04"
},
{
"code": "530500",
"name": "保山市",
"province": "53",
"city": "05"
},
{
"code": "530600",
"name": "昭通市",
"province": "53",
"city": "06"
},
{
"code": "530700",
"name": "丽江市",
"province": "53",
"city": "07"
},
{
"code": "530800",
"name": "普洱市",
"province": "53",
"city": "08"
},
{
"code": "530900",
"name": "临沧市",
"province": "53",
"city": "09"
},
{
"code": "532300",
"name": "楚雄彝族自治州",
"province": "53",
"city": "23"
},
{
"code": "532500",
"name": "红河哈尼族彝族自治州",
"province": "53",
"city": "25"
},
{
"code": "532600",
"name": "文山壮族苗族自治州",
"province": "53",
"city": "26"
},
{
"code": "532800",
"name": "西双版纳傣族自治州",
"province": "53",
"city": "28"
},
{
"code": "532900",
"name": "大理白族自治州",
"province": "53",
"city": "29"
},
{
"code": "533100",
"name": "德宏傣族景颇族自治州",
"province": "53",
"city": "31"
},
{
"code": "533300",
"name": "怒江傈僳族自治州",
"province": "53",
"city": "33"
},
{
"code": "533400",
"name": "迪庆藏族自治州",
"province": "53",
"city": "34"
},
{
"code": "540100",
"name": "拉萨市",
"province": "54",
"city": "01"
},
{
"code": "540200",
"name": "日喀则市",
"province": "54",
"city": "02"
},
{
"code": "540300",
"name": "昌都市",
"province": "54",
"city": "03"
},
{
"code": "540400",
"name": "林芝市",
"province": "54",
"city": "04"
},
{
"code": "540500",
"name": "山南市",
"province": "54",
"city": "05"
},
{
"code": "540600",
"name": "那曲市",
"province": "54",
"city": "06"
},
{
"code": "542500",
"name": "阿里地区",
"province": "54",
"city": "25"
},
{
"code": "610100",
"name": "西安市",
"province": "61",
"city": "01"
},
{
"code": "610200",
"name": "铜川市",
"province": "61",
"city": "02"
},
{
"code": "610300",
"name": "宝鸡市",
"province": "61",
"city": "03"
},
{
"code": "610400",
"name": "咸阳市",
"province": "61",
"city": "04"
},
{
"code": "610500",
"name": "渭南市",
"province": "61",
"city": "05"
},
{
"code": "610600",
"name": "延安市",
"province": "61",
"city": "06"
},
{
"code": "610700",
"name": "汉中市",
"province": "61",
"city": "07"
},
{
"code": "610800",
"name": "榆林市",
"province": "61",
"city": "08"
},
{
"code": "610900",
"name": "安康市",
"province": "61",
"city": "09"
},
{
"code": "611000",
"name": "商洛市",
"province": "61",
"city": "10"
},
{
"code": "620100",
"name": "兰州市",
"province": "62",
"city": "01"
},
{
"code": "620200",
"name": "嘉峪关市",
"province": "62",
"city": "02"
},
{
"code": "620300",
"name": "金昌市",
"province": "62",
"city": "03"
},
{
"code": "620400",
"name": "白银市",
"province": "62",
"city": "04"
},
{
"code": "620500",
"name": "天水市",
"province": "62",
"city": "05"
},
{
"code": "620600",
"name": "武威市",
"province": "62",
"city": "06"
},
{
"code": "620700",
"name": "张掖市",
"province": "62",
"city": "07"
},
{
"code": "620800",
"name": "平凉市",
"province": "62",
"city": "08"
},
{
"code": "620900",
"name": "酒泉市",
"province": "62",
"city": "09"
},
{
"code": "621000",
"name": "庆阳市",
"province": "62",
"city": "10"
},
{
"code": "621100",
"name": "定西市",
"province": "62",
"city": "11"
},
{
"code": "621200",
"name": "陇南市",
"province": "62",
"city": "12"
},
{
"code": "622900",
"name": "临夏回族自治州",
"province": "62",
"city": "29"
},
{
"code": "623000",
"name": "甘南藏族自治州",
"province": "62",
"city": "30"
},
{
"code": "630100",
"name": "西宁市",
"province": "63",
"city": "01"
},
{
"code": "630200",
"name": "海东市",
"province": "63",
"city": "02"
},
{
"code": "632200",
"name": "海北藏族自治州",
"province": "63",
"city": "22"
},
{
"code": "632300",
"name": "黄南藏族自治州",
"province": "63",
"city": "23"
},
{
"code": "632500",
"name": "海南藏族自治州",
"province": "63",
"city": "25"
},
{
"code": "632600",
"name": "果洛藏族自治州",
"province": "63",
"city": "26"
},
{
"code": "632700",
"name": "玉树藏族自治州",
"province": "63",
"city": "27"
},
{
"code": "632800",
"name": "海西蒙古族藏族自治州",
"province": "63",
"city": "28"
},
{
"code": "640100",
"name": "银川市",
"province": "64",
"city": "01"
},
{
"code": "640200",
"name": "石嘴山市",
"province": "64",
"city": "02"
},
{
"code": "640300",
"name": "吴忠市",
"province": "64",
"city": "03"
},
{
"code": "640400",
"name": "固原市",
"province": "64",
"city": "04"
},
{
"code": "640500",
"name": "中卫市",
"province": "64",
"city": "05"
},
{
"code": "650100",
"name": "乌鲁木齐市",
"province": "65",
"city": "01"
},
{
"code": "650200",
"name": "克拉玛依市",
"province": "65",
"city": "02"
},
{
"code": "650400",
"name": "吐鲁番市",
"province": "65",
"city": "04"
},
{
"code": "650500",
"name": "哈密市",
"province": "65",
"city": "05"
},
{
"code": "652300",
"name": "昌吉回族自治州",
"province": "65",
"city": "23"
},
{
"code": "652700",
"name": "博尔塔拉蒙古自治州",
"province": "65",
"city": "27"
},
{
"code": "652800",
"name": "巴音郭楞蒙古自治州",
"province": "65",
"city": "28"
},
{
"code": "652900",
"name": "阿克苏地区",
"province": "65",
"city": "29"
},
{
"code": "653000",
"name": "克孜勒苏柯尔克孜自治州",
"province": "65",
"city": "30"
},
{
"code": "653100",
"name": "喀什地区",
"province": "65",
"city": "31"
},
{
"code": "653200",
"name": "和田地区",
"province": "65",
"city": "32"
},
{
"code": "654000",
"name": "伊犁哈萨克自治州",
"province": "65",
"city": "40"
},
{
"code": "654200",
"name": "塔城地区",
"province": "65",
"city": "42"
},
{
"code": "654300",
"name": "阿勒泰地区",
"province": "65",
"city": "43"
},
{
"code": "429000",
"name": "省直辖县级行政区划",
"province": "42",
"city": "90"
}
]
\ No newline at end of file
... ...
[
{
"code": "110000",
"name": "北京市",
"province": "11"
},
{
"code": "120000",
"name": "天津市",
"province": "12"
},
{
"code": "130000",
"name": "河北省",
"province": "13"
},
{
"code": "140000",
"name": "山西省",
"province": "14"
},
{
"code": "150000",
"name": "内蒙古自治区",
"province": "15"
},
{
"code": "210000",
"name": "辽宁省",
"province": "21"
},
{
"code": "220000",
"name": "吉林省",
"province": "22"
},
{
"code": "230000",
"name": "黑龙江省",
"province": "23"
},
{
"code": "310000",
"name": "上海市",
"province": "31"
},
{
"code": "320000",
"name": "江苏省",
"province": "32"
},
{
"code": "330000",
"name": "浙江省",
"province": "33"
},
{
"code": "340000",
"name": "安徽省",
"province": "34"
},
{
"code": "350000",
"name": "福建省",
"province": "35"
},
{
"code": "360000",
"name": "江西省",
"province": "36"
},
{
"code": "370000",
"name": "山东省",
"province": "37"
},
{
"code": "410000",
"name": "河南省",
"province": "41"
},
{
"code": "420000",
"name": "湖北省",
"province": "42"
},
{
"code": "430000",
"name": "湖南省",
"province": "43"
},
{
"code": "440000",
"name": "广东省",
"province": "44"
},
{
"code": "450000",
"name": "广西壮族自治区",
"province": "45"
},
{
"code": "460000",
"name": "海南省",
"province": "46"
},
{
"code": "500000",
"name": "重庆市",
"province": "50"
},
{
"code": "510000",
"name": "四川省",
"province": "51"
},
{
"code": "520000",
"name": "贵州省",
"province": "52"
},
{
"code": "530000",
"name": "云南省",
"province": "53"
},
{
"code": "540000",
"name": "西藏自治区",
"province": "54"
},
{
"code": "610000",
"name": "陕西省",
"province": "61"
},
{
"code": "620000",
"name": "甘肃省",
"province": "62"
},
{
"code": "630000",
"name": "青海省",
"province": "63"
},
{
"code": "640000",
"name": "宁夏回族自治区",
"province": "64"
},
{
"code": "650000",
"name": "新疆维吾尔自治区",
"province": "65"
},
{
"code": "710000",
"name": "台湾省",
"province": "71"
},
{
"code": "810000",
"name": "香港特别行政区",
"province": "81"
},
{
"code": "820000",
"name": "澳门特别行政区",
"province": "82"
}
]
\ No newline at end of file
... ...
... ... @@ -7,6 +7,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/im"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/repository"
"time"
)
// PgImService 网易云信IM服务
... ... @@ -53,6 +54,7 @@ func (ptr *PgImService) InitOrUpdateUserIMInfo(userId int64, flag int) (*domain.
userBase.Im.CsAccountId = fmt.Sprintf("%v", getRandomCustomerAccount(userId))
}
userBase.Im.ImToken = checkImResponse.ImToken
userBase.LastLogIn(time.Now())
if userBase, err = userBaseRepository.Save(userBase); err != nil {
}
... ...
... ... @@ -13,8 +13,8 @@ type Company struct {
CompanyConfig *domain.CompanyConfig `comment:"企业配置信息"`
// 企业基本信息
CompanyInfo *domain.CompanyInfo `comment:"企业基本信息"`
// 公司状态 1:已注册 2:待认证 3:已认证
Status int `comment:"公司状态 1:已注册 2:待认证 3:已认证"`
// 公司状态 1:已注册(待审核) 2:已通过 3:已拒绝
Status int `comment:"公司状态 1:已注册(待审核) 2:已通过 3:已拒绝"`
// 创建时间
CreatedAt time.Time `comment:"创建时间"`
// 更新时间
... ...
... ... @@ -150,6 +150,10 @@ func (repository *CompanyRepository) Find(queryOptions map[string]interface{}) (
companys := make([]*domain.Company, 0)
query := sqlbuilder.BuildQuery(tx.Model(&companyModels), queryOptions)
query.SetOffsetAndLimit(20)
query.SetWhereByQueryOption("status =?", "status")
if v, ok := queryOptions["companyName"]; ok && len(v.(string)) > 0 {
query.Where("company_info->>'companyName' like ?", fmt.Sprintf("%%%v%%", v))
}
query.SetOrderDirect("company_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, companys, err
... ...
... ... @@ -201,6 +201,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int
if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int64)) > 0 {
query.Where(`organization_id in (?)`, pg.In(v))
}
if v, ok := queryOptions["inCompanyIds"]; ok && len(v.([]int64)) > 0 {
query.Where(`company_id in (?)`, pg.In(v))
}
query.SetWhereByQueryOption("user_base_id=?", "userBaseId")
query.SetWhereByQueryOption("(user_type & ?)>0", "userType")
query.SetWhereByQueryOption("enable_status=?", "enableStatus")
... ...
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/area"
)
type AreaController struct {
beego.BaseController
}
func (controller *AreaController) ProvinceList() {
data := area.Provinces()
controller.Response(map[string]interface{}{
"provinces": data,
}, nil)
}
func (controller *AreaController) ProvinceCities() {
code := controller.GetString(":code")
data := area.ProvinceCities(code)
controller.Response(map[string]interface{}{
"cities": data,
}, nil)
}
... ...
... ... @@ -29,6 +29,26 @@ func (controller *CompanyController) UpdateCompany() {
controller.Response(data, err)
}
func (controller *CompanyController) AuditCompany() {
companyService := service.NewCompanyService(nil)
updateCompanyCommand := &command.AuditCompanyCommand{}
controller.Unmarshal(updateCompanyCommand)
companyId, _ := controller.GetInt64(":companyId")
updateCompanyCommand.CompanyId = companyId
data, err := companyService.AuditCompany(updateCompanyCommand)
controller.Response(data, err)
}
func (controller *CompanyController) EnableCompany() {
companyService := service.NewCompanyService(nil)
updateCompanyCommand := &command.EnableCompanyCommand{}
controller.Unmarshal(updateCompanyCommand)
companyId, _ := controller.GetInt64(":companyId")
updateCompanyCommand.CompanyId = companyId
data, err := companyService.EnableCompany(updateCompanyCommand)
controller.Response(data, err)
}
func (controller *CompanyController) GetCompany() {
companyService := service.NewCompanyService(nil)
getCompanyQuery := &query.GetCompanyQuery{}
... ... @@ -51,6 +71,7 @@ func (controller *CompanyController) RemoveCompany() {
func (controller *CompanyController) ListCompany() {
companyService := service.NewCompanyService(nil)
listCompanyQuery := &query.ListCompanyQuery{}
controller.Unmarshal(listCompanyQuery)
data, err := companyService.ListCompany(listCompanyQuery)
controller.Response(data, err)
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/port/beego/controllers"
)
func init() {
web.Router("/area/province", &controllers.AreaController{}, "Get:ProvinceList")
web.Router("/area/province/:code/cities", &controllers.AreaController{}, "Get:ProvinceCities")
}
... ...
... ... @@ -14,6 +14,9 @@ func init() {
web.Router("/company/:companyId/customize-menus/", &controllers.CompanyController{}, "Get:ListCompanyCustomizeMenus")
web.Router("/company/:companyId/customize-menus", &controllers.CompanyController{}, "Put:UpdateCompanyCustomizeMenus")
web.Router("/company/:companyId/audit", &controllers.CompanyController{}, "Post:AuditCompany")
web.Router("/company/:companyId/enable", &controllers.CompanyController{}, "Post:EnableCompany")
// 适配web
//web.Router("/v1/web/menus/search", &controllers.CompanyController{}, "Post:SearchCompanyCustomizeMenus")
//web.Router("/v1/web/menus", &controllers.CompanyController{}, "Put:AdapterUpdateCompanyCustomizeMenus")
... ...