作者 陈志颖

fix confict

不能预览此文件类型
@@ -4,7 +4,9 @@ import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/d @@ -4,7 +4,9 @@ import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/d
4 4
5 type CooperationProjectsDto struct { 5 type CooperationProjectsDto struct {
6 *domain.CooperationProject 6 *domain.CooperationProject
7 - CooperationMode *CooperationMode `json:"cooperationMode"` 7 + //CooperationMode *CooperationMode `json:"cooperationMode"`
  8 + // 可以去除勾选的共创项目承接对象列表
  9 + UndertakerTypesUncheckedAvailable []int32 `json:"undertakerTypesUncheckedAvailable"`
8 } 10 }
9 11
10 type CooperationMode struct { 12 type CooperationMode struct {
@@ -16,11 +18,13 @@ type CooperationMode struct { @@ -16,11 +18,13 @@ type CooperationMode struct {
16 CooperationModeName string `json:"cooperationModeName"` 18 CooperationModeName string `json:"cooperationModeName"`
17 } 19 }
18 20
19 -func (dto *CooperationProjectsDto) LoadDto(project *domain.CooperationProject, mode *domain.CooperationMode) { 21 +func (dto *CooperationProjectsDto) LoadDto(project *domain.CooperationProject, mode *domain.CooperationMode, undertakerTypesUncheckedAvailable []int32) error {
20 dto.CooperationProject = project 22 dto.CooperationProject = project
21 - dto.CooperationMode = &CooperationMode{  
22 - CooperationModeId: mode.CooperationModeId,  
23 - CooperationModeName: mode.CooperationModeName,  
24 - CooperationModeNumber: mode.CooperationModeNumber,  
25 - } 23 + dto.UndertakerTypesUncheckedAvailable = undertakerTypesUncheckedAvailable
  24 + //dto.CooperationMode = &CooperationMode{
  25 + // CooperationModeId: mode.CooperationModeId,
  26 + // CooperationModeName: mode.CooperationModeName,
  27 + // CooperationModeNumber: mode.CooperationModeNumber,
  28 + //}
  29 + return nil
26 } 30 }
@@ -5,10 +5,12 @@ import ( @@ -5,10 +5,12 @@ import (
5 "github.com/linmadan/egglib-go/core/application" 5 "github.com/linmadan/egglib-go/core/application"
6 "github.com/linmadan/egglib-go/utils/tool_funs" 6 "github.com/linmadan/egglib-go/utils/tool_funs"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/command" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/command"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/dto"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/query" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/cooperationProject/query"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/factory"
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" 11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service" 12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service"
  13 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao"
12 "strconv" 14 "strconv"
13 "time" 15 "time"
14 ) 16 )
@@ -134,8 +136,31 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro @@ -134,8 +136,31 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
134 if cooperationMode == nil { 136 if cooperationMode == nil {
135 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createCooperationProjectCommand.CooperationModeNumber)) 137 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createCooperationProjectCommand.CooperationModeNumber))
136 } else { 138 } else {
  139 + // 共创项目DAO初始化
  140 + var cooperationProjectDao *dao.CooperationProjectDao
  141 + if value, err := factory.CreateCooperationProjectDao(map[string]interface{}{
  142 + "transactionContext": transactionContext,
  143 + }); err != nil {
  144 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  145 + } else {
  146 + cooperationProjectDao = value
  147 + }
  148 + // 生成共创项目编号
  149 + projectNumber, err2 := cooperationProjectDao.GenerateProjectNumber()
  150 + if err2 != nil {
  151 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  152 + }
  153 + // 校验共创项目编号是否唯一
  154 + numberAvailable, _ := cooperationProjectDao.CheckProjectNumberAvailable(map[string]interface{}{
  155 + "companyId": createCooperationProjectCommand.CompanyId,
  156 + "orgId": createCooperationProjectCommand.OrgId,
  157 + "cooperationProjectNumber": projectNumber,
  158 + })
  159 + if !numberAvailable {
  160 + return nil, application.ThrowError(application.TRANSACTION_ERROR, "共创项目编码已存在")
  161 + }
137 newCooperationProject := &domain.CooperationProject{ 162 newCooperationProject := &domain.CooperationProject{
138 - CooperationProjectNumber: fmt.Sprintf("%v", time.Now().UnixNano()), //TODO:项目编码生成 163 + CooperationProjectNumber: projectNumber,
139 CooperationProjectName: createCooperationProjectCommand.CooperationProjectName, 164 CooperationProjectName: createCooperationProjectCommand.CooperationProjectName,
140 CooperationProjectUndertakerTypes: createCooperationProjectCommand.CooperationProjectUndertakerTypes, 165 CooperationProjectUndertakerTypes: createCooperationProjectCommand.CooperationProjectUndertakerTypes,
141 CooperationProjectSponsor: sponsor, 166 CooperationProjectSponsor: sponsor,
@@ -203,6 +228,27 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec @@ -203,6 +228,27 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec
203 if cooperationProject == nil { 228 if cooperationProject == nil {
204 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getCooperationProjectQuery.CooperationProjectId, 10))) 229 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getCooperationProjectQuery.CooperationProjectId, 10)))
205 } else { 230 } else {
  231 + // 共创项目DAO初始化
  232 + var cooperationProjectDao *dao.CooperationProjectDao
  233 + if value, err := factory.CreateCooperationProjectDao(map[string]interface{}{
  234 + "transactionContext": transactionContext,
  235 + }); err != nil {
  236 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  237 + } else {
  238 + cooperationProjectDao = value
  239 + }
  240 + //TODO 获取可删除的承接对象类型
  241 + undertakerTypesUncheckedAvailable, err := cooperationProjectDao.CheckUndertakerTypesUncheckedAvailable(map[string]interface{}{
  242 + "cooperationProjectNumber": cooperationProject.CooperationProjectNumber,
  243 + "cooperationProjectUndertakerTypes": cooperationProject.CooperationProjectUndertakerTypes,
  244 + })
  245 + if err != nil {
  246 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  247 + }
  248 + cooperationProjectDto := &dto.CooperationProjectsDto{}
  249 + if err := cooperationProjectDto.LoadDto(cooperationProject, nil, undertakerTypesUncheckedAvailable); err != nil {
  250 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  251 + }
206 if err := transactionContext.CommitTransaction(); err != nil { 252 if err := transactionContext.CommitTransaction(); err != nil {
207 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 253 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
208 } 254 }
@@ -12,3 +12,35 @@ func CreateCooperationModeDao(options map[string]interface{}) (*dao.CooperationM @@ -12,3 +12,35 @@ func CreateCooperationModeDao(options map[string]interface{}) (*dao.CooperationM
12 } 12 }
13 return dao.NewCooperationModeDao(transactionContext) 13 return dao.NewCooperationModeDao(transactionContext)
14 } 14 }
  15 +
  16 +func CreateCooperationProjectDao(options map[string]interface{}) (*dao.CooperationProjectDao, error) {
  17 + var transactionContext *pg.TransactionContext
  18 + if value, ok := options["transactionContext"]; ok {
  19 + transactionContext = value.(*pg.TransactionContext)
  20 + }
  21 + return dao.NewCooperationProjectDao(transactionContext)
  22 +}
  23 +
  24 +func CreateCooperationContractDao(options map[string]interface{}) (*dao.CooperationContractDao, error) {
  25 + var transactionContext *pg.TransactionContext
  26 + if value, ok := options["transactionContext"]; ok {
  27 + transactionContext = value.(*pg.TransactionContext)
  28 + }
  29 + return dao.NewCooperationContractDao(transactionContext)
  30 +}
  31 +
  32 +func CreateDividendsOrderDao(options map[string]interface{}) (*dao.DividendsOrderDao, error) {
  33 + var transactionContext *pg.TransactionContext
  34 + if value, ok := options["transactionContext"]; ok {
  35 + transactionContext = value.(*pg.TransactionContext)
  36 + }
  37 + return dao.NewDividendsOrderDao(transactionContext)
  38 +}
  39 +
  40 +func CreateDividendsReturnedOrderDao(options map[string]interface{}) (*dao.DividendsReturnedOrderDao, error) {
  41 + var transactionContext *pg.TransactionContext
  42 + if value, ok := options["transactionContext"]; ok {
  43 + transactionContext = value.(*pg.TransactionContext)
  44 + }
  45 + return dao.NewDividendsReturnedOrderDao(transactionContext)
  46 +}
不能预览此文件类型
  1 +package dao
  2 +
  3 +import (
  4 + "fmt"
  5 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
  8 + "time"
  9 +)
  10 +
  11 +type CooperationContractDao struct {
  12 + transactionContext *pgTransaction.TransactionContext
  13 +}
  14 +
  15 +// GenerateContractNumber 生成共创合约编号
  16 +func (dao *CooperationContractDao) GenerateContractNumber() (string, error) {
  17 + tx := dao.transactionContext.PgTx
  18 + var cooperationContractModels []*models.CooperationContract
  19 + query := tx.Model(&cooperationContractModels)
  20 + currentTime := time.Now()
  21 + todayZeroTime := utils.GetZeroTime(currentTime)
  22 + nextDayZeroTime := utils.GetNextDayZeroTime(currentTime)
  23 + query.Where("cooperation_contract.created_at >= ?", todayZeroTime)
  24 + query.Where("cooperation_contract.created_at < ?", nextDayZeroTime)
  25 + if count, err := query.AllWithDeleted().SelectAndCount(); err != nil {
  26 + return "", err
  27 + } else {
  28 + countStr := fmt.Sprintf("%03d", count+1)
  29 + timestamp := currentTime.Unix()
  30 + timeNow := time.Unix(timestamp, 0)
  31 + timeString := timeNow.Format("20060102")
  32 + timeString = timeString[2:len(timeString)]
  33 + contractNumber := "HY" + timeString + "#" + countStr
  34 + return contractNumber, nil
  35 + }
  36 +}
  37 +
  38 +// CheckContractNumberAvailable 检验合约编号唯一性
  39 +func (dao *CooperationContractDao) CheckContractNumberAvailable(queryOptions map[string]interface{}) (bool, error) {
  40 + tx := dao.transactionContext.PgTx
  41 + var cooperationContractModels []*models.CooperationContract
  42 + query := tx.Model(&cooperationContractModels)
  43 + if cooperationContractNumber, ok := queryOptions["cooperationContractNumber"]; ok && cooperationContractNumber != "" {
  44 + query = query.Where("cooperation_contract_number = ?", cooperationContractNumber)
  45 + }
  46 + if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
  47 + query = query.Where(`cooperation_contract.company @> '{"companyId":"?"}'`, companyId)
  48 + }
  49 + if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
  50 + query = query.Where(`cooperation_contract.org @> '{"orgId":"?"}'`, orgId)
  51 + }
  52 + ok, err := query.Exists()
  53 + return !ok, err
  54 +}
  55 +
  56 +func NewCooperationContractDao(transactionContext *pgTransaction.TransactionContext) (*CooperationContractDao, error) {
  57 + if transactionContext == nil {
  58 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  59 + } else {
  60 + return &CooperationContractDao{
  61 + transactionContext: transactionContext,
  62 + }, nil
  63 + }
  64 +}
  1 +package dao
  2 +
  3 +import (
  4 + "fmt"
  5 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
  8 + "time"
  9 +)
  10 +
  11 +type CooperationProjectDao struct {
  12 + transactionContext *pgTransaction.TransactionContext
  13 +}
  14 +
  15 +// GenerateProjectNumber 生成共创项目编码
  16 +func (dao *CooperationProjectDao) GenerateProjectNumber() (string, error) {
  17 + tx := dao.transactionContext.PgTx
  18 + var cooperationProjectModels []*models.CooperationProject
  19 + query := tx.Model(&cooperationProjectModels)
  20 + currentTime := time.Now()
  21 + todayZeroTime := utils.GetZeroTime(currentTime)
  22 + nextDayZeroTime := utils.GetNextDayZeroTime(currentTime)
  23 + query.Where("cooperation_project.created_at >= ?", todayZeroTime)
  24 + query.Where("cooperation_project.created_at < ?", nextDayZeroTime)
  25 + if count, err := query.AllWithDeleted().SelectAndCount(); err != nil {
  26 + return "", err
  27 + } else {
  28 + countStr := fmt.Sprintf("%03d", count+1)
  29 + timestamp := currentTime.Unix()
  30 + timeNow := time.Unix(timestamp, 0)
  31 + timeString := timeNow.Format("20060102")
  32 + timeString = timeString[2:len(timeString)]
  33 + contractNumber := "XM" + timeString + "#" + countStr
  34 + return contractNumber, nil
  35 + }
  36 +}
  37 +
  38 +// CheckUndertakerTypesUncheckedAvailable TODO 校验项目承接对象是否可以删除
  39 +func (dao *CooperationProjectDao) CheckUndertakerTypesUncheckedAvailable(queryOptions map[string]interface{}) ([]int32, error) {
  40 + return []int32{}, nil
  41 +}
  42 +
  43 +// CheckProjectNumberAvailable 校验项目编号唯一性
  44 +func (dao *CooperationProjectDao) CheckProjectNumberAvailable(queryOptions map[string]interface{}) (bool, error) {
  45 + tx := dao.transactionContext.PgTx
  46 + var cooperationProjectModels []*models.CooperationProject
  47 + query := tx.Model(&cooperationProjectModels)
  48 + if cooperationProjectNumber, ok := queryOptions["cooperationProjectNumber"]; ok && cooperationProjectNumber != "" {
  49 + query = query.Where("cooperation_project_number = ?", cooperationProjectNumber)
  50 + }
  51 + if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
  52 + query = query.Where(`cooperation_project.company @> '{"companyId":"?"}'`, companyId)
  53 + }
  54 + if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
  55 + query = query.Where(`cooperation_project.org @> '{"orgId":"?"}'`, orgId)
  56 + }
  57 + ok, err := query.Exists()
  58 + return !ok, err
  59 +}
  60 +
  61 +func NewCooperationProjectDao(transactionContext *pgTransaction.TransactionContext) (*CooperationProjectDao, error) {
  62 + if transactionContext == nil {
  63 + return nil, fmt.Errorf("transactionContext参数不能为nil")
  64 + } else {
  65 + return &CooperationProjectDao{
  66 + transactionContext: transactionContext,
  67 + }, nil
  68 + }
  69 +}
  1 +package dao
  2 +
  3 +import (
  4 + "fmt"
  5 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
  8 + "time"
  9 +)
  10 +
  11 +type DividendsOrderDao struct {
  12 + transactionContext *pgTransaction.TransactionContext
  13 +}
  14 +
  15 +// GenerateDividendsOrderNumber 生成分红订单号
  16 +func (dao *DividendsOrderDao) GenerateDividendsOrderNumber() (string, error) {
  17 + tx := dao.transactionContext.PgTx
  18 + var dividendsOrderModels []*models.DividendsOrder
  19 + query := tx.Model(&dividendsOrderModels)
  20 + currentTime := time.Now()
  21 + todayZeroTime := utils.GetZeroTime(currentTime)
  22 + nextDayZeroTime := utils.GetNextDayZeroTime(currentTime)
  23 + query.Where("dividends_order.created_at >= ?", todayZeroTime)
  24 + query.Where("dividends_order.created_at < ?", nextDayZeroTime)
  25 + if count, err := query.AllWithDeleted().SelectAndCount(); err != nil {
  26 + return "", err
  27 + } else {
  28 + countStr := fmt.Sprintf("%03d", count+1)
  29 + timestamp := currentTime.Unix()
  30 + timeNow := time.Unix(timestamp, 0)
  31 + timeString := timeNow.Format("20060102")
  32 + timeString = timeString[2:len(timeString)]
  33 + dividendsOrderNumber := "SL" + timeString + "#" + countStr
  34 + return dividendsOrderNumber, nil
  35 + }
  36 +}
  37 +
  38 +func NewDividendsOrderDao(transactionContext *pgTransaction.TransactionContext) (*DividendsOrderDao, error) {
  39 + if transactionContext == nil {
  40 + return nil, fmt.Errorf("transactionContext参数不能未")
  41 + } else {
  42 + return &DividendsOrderDao{
  43 + transactionContext: transactionContext,
  44 + }, nil
  45 + }
  46 +}
  1 +package dao
  2 +
  3 +import (
  4 + "fmt"
  5 + pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
  8 + "time"
  9 +)
  10 +
  11 +type DividendsReturnedOrderDao struct {
  12 + transactionContext *pgTransaction.TransactionContext
  13 +}
  14 +
  15 +// GenerateDividendsReturnedOrderNumber 生成分红退货单号
  16 +func (dao *DividendsReturnedOrderDao) GenerateDividendsReturnedOrderNumber() (string, error) {
  17 + tx := dao.transactionContext.PgTx
  18 + var dividendsReturnedOrderModels []*models.DividendsReturnedOrder
  19 + query := tx.Model(&dividendsReturnedOrderModels)
  20 + currentTime := time.Now()
  21 + todayZeroTime := utils.GetZeroTime(currentTime)
  22 + nextDayZeroTime := utils.GetNextDayZeroTime(currentTime)
  23 + query.Where("dividends_returned_order.created_at >= ?", todayZeroTime)
  24 + query.Where("dividends_returned_order.created_at < ?", nextDayZeroTime)
  25 + if count, err := query.AllWithDeleted().SelectAndCount(); err != nil {
  26 + return "", err
  27 + } else {
  28 + countStr := fmt.Sprintf("%03d", count+1)
  29 + timestamp := currentTime.Unix()
  30 + timeNow := time.Unix(timestamp, 0)
  31 + timeString := timeNow.Format("20060102")
  32 + timeString = timeString[2:len(timeString)]
  33 + dividendsReturnedOrderNumber := "RE" + timeString + "#" + countStr
  34 + return dividendsReturnedOrderNumber, nil
  35 + }
  36 +}
  37 +
  38 +func NewDividendsReturnedOrderDao(transactionContext *pgTransaction.TransactionContext) (*DividendsReturnedOrderDao, error) {
  39 + if transactionContext == nil {
  40 + return nil, fmt.Errorf("transactionContext参数不能未")
  41 + } else {
  42 + return &DividendsReturnedOrderDao{
  43 + transactionContext: transactionContext,
  44 + }, nil
  45 + }
  46 +}
  1 +package utils
  2 +
  3 +import (
  4 + "fmt"
  5 + "strconv"
  6 + "time"
  7 +)
  8 +
  9 +func GetDayBegin() time.Time {
  10 + t := time.Now()
  11 + today, _ := time.Parse("2006-01-02", t.Format("2006-01-02"))
  12 + return today
  13 +}
  14 +
  15 +func GetDayEnd() time.Time {
  16 + t := GetDayBegin()
  17 + nextDay := t.AddDate(0, 0, 1)
  18 + return nextDay
  19 +}
  20 +
  21 +//获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。
  22 +func GetFirstDateOfMonth(d time.Time) time.Time {
  23 + d = d.AddDate(0, 0, -d.Day()+1)
  24 + return GetZeroTime(d)
  25 +}
  26 +
  27 +//获取传入的时间所在月份的最后一天,即某月最后一天的23:59:59。如传入time.Now(), 返回当前月份的最后一天的23:59:59。
  28 +func GetNextMonthFirstDay(d time.Time) time.Time {
  29 + d = GetFirstDateOfMonth(d).AddDate(0, 1, 0)
  30 + return GetZeroTime(d)
  31 +}
  32 +
  33 +//获取某一天的0点时间
  34 +func GetZeroTime(d time.Time) time.Time {
  35 + return time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, time.Local)
  36 +}
  37 +
  38 +//获取某一天的23点59分59秒
  39 +func GetNextDayZeroTime(d time.Time) time.Time {
  40 + return time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, 1)
  41 +}
  42 +
  43 +// TransformTimestampToTime 根据13位时间戳返回日期时间格式时间
  44 +func TransformTimestampToTime(timeStamp int64) time.Time {
  45 + t := strconv.FormatInt(timeStamp, 10)
  46 + tIpartStr := t[0:10]
  47 + //tDecpartStr := t[10:13]
  48 + ipart, _ := strconv.ParseInt(tIpartStr, 10, 64)
  49 + //decpart, _ := strconv.ParseInt(tDecpartStr, 10, 64)
  50 + myTime := time.Unix(ipart, 0)
  51 + fmt.Println(myTime)
  52 + return time.Date(myTime.Year(), myTime.Month(), myTime.Day(), myTime.Hour(), myTime.Minute(), myTime.Second(), 0, time.Local)
  53 +}