作者 陈志颖

test:导入

... ... @@ -410,8 +410,8 @@ func (statisticsService *StatisticsService) ContributionsWealthRanking(contribut
}
if contributionsWealthRankingQuery.RankingType == 1 { // 返回总榜
contributionsWealthRankingQuery.StartTime = time.Date(1971, time.Month(1), 1, 0, 0, 0, 0, time.Now().Location())
contributionsWealthRankingQuery.EndTime = time.Now()
contributionsWealthRankingQuery.StartTime = time.Date(1971, time.Month(1), 1, 0, 0, 0, 0, time.Local)
contributionsWealthRankingQuery.EndTime = time.Now().Local()
} else if contributionsWealthRankingQuery.RankingType == 2 { // 返回年榜
// 获取公司最新年榜
var listIntervalRepository domain.ListIntervalRepository
... ...
... ... @@ -319,7 +319,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
queryWealth = queryWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money")
queryWealth = queryWealth.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking")
queryWealth = queryWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3, 6}))
queryWealth = queryWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3}))
queryWealth = queryWealth.Where(`e.status = ?`, 1) // 离职员工过滤
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
queryWealth = queryWealth.Where("e.company_id = ?", companyId)
... ...
... ... @@ -394,26 +394,28 @@ func (controller *SuMoneyController) ExchangeCashListRanking() {
// 导入兑换素币清单
func (controller *SuMoneyController) ImportExchangeList () {
cashPoolService := service.NewCashPoolService(nil)
//importExchangeCashListCommand := &command.ImportExchangeCashListCommand{}
//json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), importExchangeCashListCommand)
//fmt.Printf("命令:%+v\n", importExchangeCashListCommand.Where)
//fmt.Print(controller.GetString("where"), "\n")
where := controller.GetString("where")
//typeOf := reflect.TypeOf(where)
//if reflect.TypeOf(where) == Type.String() {
// jsonMap := make(map[string]interface{})
// _ := json.Unmarshal([]byte(where), &jsonMap)
// fmt.Printf("%+v\n", jsonMap)
//}
//fmt.Print(reflect.TypeOf(where), "\n")
importExchangeCashListCommand := &command.ImportExchangeCashListCommand{}
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), importExchangeCashListCommand)
//where := controller.GetString("where")
file, h, _ := controller.GetFile("file")
jsonMap := make(map[string]interface{})
err := json.Unmarshal([]byte(where), &jsonMap)
//if reflect.TypeOf(where).Kind() == reflect.TypeOf(jsonMap).Kind() { // 传入json
// jsonMap = map[string]interface{}{
// "activityId": where.(map[string]interface{})["activityId"],
// "uid": where["uid"],
// }
//} else { // 传入json string
// _ := json.Unmarshal([]byte(where), &jsonMap)
//}
fmt.Printf("%+v\n", jsonMap)
tmp, _ := strconv.ParseInt(jsonMap["activityId"].(string), 10, 64 )
fmt.Print(tmp, "\n")
// 错误信息返回
... ... @@ -490,13 +492,23 @@ func (controller *SuMoneyController) ImportExchangeList () {
//fmt.Print(len(rows), "\n")
//if personNameMatch, ok := where.(map[string]interface{})["personNameMatch"]; ok && (personNameMatch != "") {
// query = query.Where(`exchange_cash_person_list.employee_name LIKE ?`, fmt.Sprintf("%%%s%%", personNameMatch.(string)))
//}
//if activityId, ok := where.(map[string]interface{})["activityId"]; ok && activityId != "" {
// float, _ := strconv.ParseFloat(activityId.(string),64)
// query = query.Where("exchange_cash_person_list.activity_id = ?", float)
//}
for i, row := range rows {
//fmt.Printf("Row Number:%d, Row: %+v\n, Row Length: %d\n", i, row, len(row))
if i > 2 && len(row) > 1 {
// 创建兑换清单命令
createExchangeCashPersonCommand := &command.CreateExchangeCashPersonCommand{}
createExchangeCashPersonCommand.ExchangeCashActivityId, _ = strconv.ParseInt(jsonMap["activityId"].(string), 10, 64 )
createExchangeCashPersonCommand.Operator = int64(jsonMap["uid"].(float64))
//createExchangeCashPersonCommand.ExchangeCashActivityId, _ = strconv.ParseInt(jsonMap["activityId"].(string), 10, 64 )
createExchangeCashPersonCommand.ExchangeCashActivityId, _ = strconv.ParseInt(interface{}(importExchangeCashListCommand.Where).(map[string]interface{})["activityId"].(string), 10, 64)
//createExchangeCashPersonCommand.Operator = int64(jsonMap["uid"].(float64))
createExchangeCashPersonCommand.Operator = int64(interface{}(importExchangeCashListCommand.Where).(map[string]interface{})["uid"].(float64))
createExchangeCashPersonCommand.PersonName = row[0]
createExchangeCashPersonCommand.PersonAccount = row[1]
r2, _ := strconv.ParseFloat(row[2], 64)
... ...