1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- package service
- import (
- "app.yhyue.com/moapp/jybase/common"
- MC "bp.jydev.jianyu360.cn/CRM/application/api/common"
- "errors"
- "log"
- "strings"
- "time"
- )
- type EntService struct {
- }
- const (
- Date_Full_Layout = "2006-01-02 15:04:05"
- Date_Short_Layout = "2006-01-02"
- )
- func (in *EntService) EntInfo(entName string) (map[string]interface{}, error) {
- entinfo, _ := MC.MgoEnt.FindOneByField("qyxy_std", map[string]interface{}{"company_name": entName}, map[string]interface{}{
- "company_type": 1, //公司类型
- //"issue_date": 1, //核准日期
- "operation_startdate": 1, //营业期限开始
- "operation_enddate": 1, //营业期限结束
- //"authority": 1, //登记机关
- "credit_no": 1, //统一社会信用代码
- "tax_code": 1, //纳税人识别码
- "capital": 1, //注册资本
- "establish_date": 1, //成立日期
- "company_status": 1, //经营状态
- "employee_no": 1, //员工规模
- "company_address": 1, //注册地
- "business_scope": 1, //经营范围
- "company_code": 1, //工商注册号
- "org_code": 1, //组织机构代码
- //"stock_realcapital": 1, //实缴资本
- "legal_person": 1, //法人姓名
- "company_phone": 1, //公司电话
- })
- if entinfo == nil || len(*entinfo) == 0 {
- log.Println()
- return nil, errors.New("未查询到企业相关信息")
- }
- rData := map[string]interface{}{
- "type": (*entinfo)["company_type"],
- "status": (*entinfo)["company_status"],
- "creditNo": (*entinfo)["credit_no"],
- "taxCode": (*entinfo)["tax_code"],
- "capital": (*entinfo)["capital"],
- "employeeNo": (*entinfo)["employee_no"],
- "address": (*entinfo)["company_address"],
- "scope": (*entinfo)["business_scope"],
- "company_code": (*entinfo)["company_code"],
- "org_code": (*entinfo)["org_code"],
- "operStart": paseDateToint64(common.ObjToString((*entinfo)["operation_startdate"])),
- "operEnd": paseDateToint64(common.ObjToString((*entinfo)["operation_enddate"])),
- "establish": paseDateToint64(common.ObjToString((*entinfo)["establish_date"])),
- "legal": (*entinfo)["legal_person"],
- "phone": (*entinfo)["company_phone"],
- "entName": (*entinfo)["company_name"],
- }
- return rData, nil
- }
- func paseDateToint64(dateStr string) (timeStamp int64) {
- timeStamp = -1
- if dateStr == "" {
- return
- }
- if thisTime, err := time.Parse(Date_Short_Layout, dateStr); err == nil {
- timeStamp = thisTime.Unix()
- }
- //企业变更部分信息时间格式2017-04-18 00:00:00.0
- if len(strings.Split(dateStr, " ")) == 2 {
- if thisTime, err := time.Parse(Date_Full_Layout, dateStr); err == nil {
- timeStamp = thisTime.Unix()
- }
- }
- return
- }
|