作者 陈志颖

feat:增加员工贡献值和财富值计算

@@ -6,7 +6,7 @@ import ( @@ -6,7 +6,7 @@ import (
6 ) 6 )
7 7
8 type ListListIntervalQuery struct { 8 type ListListIntervalQuery struct {
9 - CompanyId int64 `json:"companyId"` // 公司id 9 + CompanyId int `json:"companyId"` // 公司id
10 Offset int `json:"offset,omitempty"` // 查询偏离量 10 Offset int `json:"offset,omitempty"` // 查询偏离量
11 Limit int `json:"limit,omitempty"` // 查询限制 11 Limit int `json:"limit,omitempty"` // 查询限制
12 } 12 }
@@ -82,7 +82,7 @@ func (listIntervalService *ListIntervalService) ListListInterval(listListInterva @@ -82,7 +82,7 @@ func (listIntervalService *ListIntervalService) ListListInterval(listListInterva
82 } 82 }
83 return map[string]interface{}{ 83 return map[string]interface{}{
84 "count": count, 84 "count": count,
85 - "taskNatures": listIntervals, 85 + "listIntervals": listIntervals,
86 }, nil 86 }, nil
87 } 87 }
88 } 88 }
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 + "github.com/astaxie/beego/validation"
  6 +)
  7 +
  8 +type EmployeesContributionsStatisticsCommand struct {
  9 + CompanyId int `json:"companyId" valid:"Required"` // 公司id
  10 +}
  11 +
  12 +func (employeesContributionsStatisticsCommand *EmployeesContributionsStatisticsCommand) ValidateCommand() error {
  13 + valid := validation.Validation{}
  14 + b, err := valid.Valid(employeesContributionsStatisticsCommand)
  15 + if err != nil {
  16 + return err
  17 + }
  18 + if !b {
  19 + for _, validErr := range valid.Errors {
  20 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  21 + }
  22 + }
  23 + return nil
  24 +}
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/astaxie/beego/validation"
  7 +)
  8 +
  9 +type EmployeesSuMoneyStatisticsCommand struct {
  10 + CompanyId int `json:"companyId" valid:"Required"` // 公司id
  11 +}
  12 +
  13 +func (employeesSuMoneyStatisticsCommand *EmployeesSuMoneyStatisticsCommand) ValidateCommand() error {
  14 + valid := validation.Validation{}
  15 + b, err := valid.Valid(employeesSuMoneyStatisticsCommand)
  16 + if err != nil {
  17 + return err
  18 + }
  19 + if !b {
  20 + for _, validErr := range valid.Errors {
  21 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  22 + }
  23 + }
  24 + return nil
  25 +}
@@ -160,7 +160,6 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone @@ -160,7 +160,6 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone
160 defer func() { 160 defer func() {
161 transactionContext.RollbackTransaction() 161 transactionContext.RollbackTransaction()
162 }() 162 }()
163 -  
164 var employeeDao *dao.EmployeeDao 163 var employeeDao *dao.EmployeeDao
165 if value, err := factory.CreateEmployeeDao(map[string]interface{}{ 164 if value, err := factory.CreateEmployeeDao(map[string]interface{}{
166 "transactionContext": transactionContext, 165 "transactionContext": transactionContext,
@@ -169,8 +168,6 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone @@ -169,8 +168,6 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone
169 } else { 168 } else {
170 employeeDao = value 169 employeeDao = value
171 } 170 }
172 -  
173 - // 企业员工资源库  
174 var employeeRepository domain.EmployeeRepository 171 var employeeRepository domain.EmployeeRepository
175 if value, err := factory.CreateEmployeeRepository(map[string]interface{}{ 172 if value, err := factory.CreateEmployeeRepository(map[string]interface{}{
176 "transactionContext": transactionContext, 173 "transactionContext": transactionContext,
@@ -179,8 +176,6 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone @@ -179,8 +176,6 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone
179 } else { 176 } else {
180 employeeRepository = value 177 employeeRepository = value
181 } 178 }
182 -  
183 - // 判断企业员工是否有效  
184 employee, err := employeeRepository.FindOne(map[string]interface{}{ 179 employee, err := employeeRepository.FindOne(map[string]interface{}{
185 "uid": personSuMoneyStatisticsCommand.Uid, 180 "uid": personSuMoneyStatisticsCommand.Uid,
186 }) 181 })
@@ -190,8 +185,6 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone @@ -190,8 +185,6 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone
190 if employee == nil { 185 if employee == nil {
191 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的企业员工") 186 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的企业员工")
192 } 187 }
193 -  
194 - // 计算个人素币  
195 if personSuMoneyStatistics, err := employeeDao.CalculatePersonSuMoney(personSuMoneyStatisticsCommand.Uid); err != nil { 188 if personSuMoneyStatistics, err := employeeDao.CalculatePersonSuMoney(personSuMoneyStatisticsCommand.Uid); err != nil {
196 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 189 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
197 } else { 190 } else {
@@ -203,7 +196,6 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone @@ -203,7 +196,6 @@ func (statisticsService *StatisticsService) PersonSuMoneyStatistics(personSuMone
203 } 196 }
204 } 197 }
205 198
206 -// TODO 系统素币统计  
207 func (statisticsService *StatisticsService) SystemSuMoneyStatistics(systemSuMoneyStatisticsCommand *command.SystemSuMoneyStatisticsCommand) (interface{}, error) { 199 func (statisticsService *StatisticsService) SystemSuMoneyStatistics(systemSuMoneyStatisticsCommand *command.SystemSuMoneyStatisticsCommand) (interface{}, error) {
208 if err := systemSuMoneyStatisticsCommand.ValidateCommand(); err != nil { 200 if err := systemSuMoneyStatisticsCommand.ValidateCommand(); err != nil {
209 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 201 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
@@ -219,15 +211,6 @@ func (statisticsService *StatisticsService) SystemSuMoneyStatistics(systemSuMone @@ -219,15 +211,6 @@ func (statisticsService *StatisticsService) SystemSuMoneyStatistics(systemSuMone
219 transactionContext.RollbackTransaction() 211 transactionContext.RollbackTransaction()
220 }() 212 }()
221 213
222 - //var cashPoolDao *dao.CashPoolDao  
223 - //if value, err := factory.CreateCashPoolDao(map[string]interface{}{  
224 - // "transactionContext": transactionContext,  
225 - //}); err != nil {  
226 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
227 - //} else {  
228 - // cashPoolDao = value  
229 - //}  
230 -  
231 var employeeDao *dao.EmployeeDao 214 var employeeDao *dao.EmployeeDao
232 if value, err := factory.CreateEmployeeDao(map[string]interface{}{ 215 if value, err := factory.CreateEmployeeDao(map[string]interface{}{
233 "transactionContext": transactionContext, 216 "transactionContext": transactionContext,
@@ -237,15 +220,6 @@ func (statisticsService *StatisticsService) SystemSuMoneyStatistics(systemSuMone @@ -237,15 +220,6 @@ func (statisticsService *StatisticsService) SystemSuMoneyStatistics(systemSuMone
237 employeeDao = value 220 employeeDao = value
238 } 221 }
239 222
240 - //var employeeRepository domain.EmployeeRepository  
241 - //if value, err := factory.CreateEmployeeRepository(map[string]interface{}{  
242 - // "transactionContext": transactionContext,  
243 - //}); err != nil {  
244 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
245 - //} else {  
246 - // employeeRepository = value  
247 - //}  
248 -  
249 if systemSuMoneyStatistics, err := employeeDao.CalculateSystemSuMoney(systemSuMoneyStatisticsCommand.CompanyId); err != nil { 223 if systemSuMoneyStatistics, err := employeeDao.CalculateSystemSuMoney(systemSuMoneyStatisticsCommand.CompanyId); err != nil {
250 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 224 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
251 } else { 225 } else {
@@ -256,7 +230,6 @@ func (statisticsService *StatisticsService) SystemSuMoneyStatistics(systemSuMone @@ -256,7 +230,6 @@ func (statisticsService *StatisticsService) SystemSuMoneyStatistics(systemSuMone
256 } 230 }
257 } 231 }
258 232
259 -// TODO 系统现金统计  
260 func (statisticsService *StatisticsService) SystemCashStatistics(systemCashStatisticsCommand *command.SystemCashStatisticsCommand) (interface{}, error) { 233 func (statisticsService *StatisticsService) SystemCashStatistics(systemCashStatisticsCommand *command.SystemCashStatisticsCommand) (interface{}, error) {
261 if err := systemCashStatisticsCommand.ValidateCommand(); err != nil { 234 if err := systemCashStatisticsCommand.ValidateCommand(); err != nil {
262 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 235 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
@@ -272,15 +245,6 @@ func (statisticsService *StatisticsService) SystemCashStatistics(systemCashStati @@ -272,15 +245,6 @@ func (statisticsService *StatisticsService) SystemCashStatistics(systemCashStati
272 transactionContext.RollbackTransaction() 245 transactionContext.RollbackTransaction()
273 }() 246 }()
274 247
275 - //var cashPoolDao *dao.CashPoolDao  
276 - //if value, err := factory.CreateCashPoolDao(map[string]interface{}{  
277 - // "transactionContext": transactionContext,  
278 - //}); err != nil {  
279 - // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
280 - //} else {  
281 - // cashPoolDao = value  
282 - //}  
283 -  
284 var employeeDao *dao.EmployeeDao 248 var employeeDao *dao.EmployeeDao
285 if value, err := factory.CreateEmployeeDao(map[string]interface{}{ 249 if value, err := factory.CreateEmployeeDao(map[string]interface{}{
286 "transactionContext": transactionContext, 250 "transactionContext": transactionContext,
@@ -300,6 +264,19 @@ func (statisticsService *StatisticsService) SystemCashStatistics(systemCashStati @@ -300,6 +264,19 @@ func (statisticsService *StatisticsService) SystemCashStatistics(systemCashStati
300 } 264 }
301 } 265 }
302 266
  267 +// TODO 员工素币值统计
  268 +func (statisticsService *StatisticsService) EmployeesSuMoneyStatistics(employeesSuMoneyStatisticsCommand *command.EmployeesSuMoneyStatisticsCommand) (interface{}, error) {
  269 +
  270 + return nil ,nil
  271 +}
  272 +
  273 +// TODO 员工贡献值统计
  274 +func (statisticsService *StatisticsService) EmployeesContributionsStatistics(employeesContributionsStatisticsCommand *command.EmployeesContributionsStatisticsCommand) (interface{}, error) {
  275 +
  276 + return nil, nil
  277 +}
  278 +
  279 +
303 func NewStatisticsService(options map[string]interface{}) *StatisticsService { 280 func NewStatisticsService(options map[string]interface{}) *StatisticsService {
304 newStatisticsService := &StatisticsService{} 281 newStatisticsService := &StatisticsService{}
305 return newStatisticsService 282 return newStatisticsService
@@ -114,20 +114,20 @@ func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{ @@ -114,20 +114,20 @@ func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{
114 }, nil 114 }, nil
115 } 115 }
116 116
117 -// TODO 计算系统素币 117 +// 计算系统素币
118 func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string] interface{}, error) { 118 func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string] interface{}, error) {
119 var systemUnExchangeSuMoney float64 119 var systemUnExchangeSuMoney float64
120 var systemExchangedSuMoney float64 120 var systemExchangedSuMoney float64
121 tx := dao.transactionContext.PgTx 121 tx := dao.transactionContext.PgTx
122 suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord) 122 suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
123 - if err := tx.Model(suMoneyTransactionRecordModel).Join("JOIN employees AS employee ON employee.uid = employee.uid"). 123 + if err := tx.Model(suMoneyTransactionRecordModel).Join("JOIN employees AS e ON e.uid = (su_money_transaction_records.employee->>'uid')::bigint").
124 ColumnExpr("sum(su_money_transaction_record.current_su_money) AS system_unExchange_su_money"). 124 ColumnExpr("sum(su_money_transaction_record.current_su_money) AS system_unExchange_su_money").
125 Where("employee.company_id = ?", companyId). 125 Where("employee.company_id = ?", companyId).
126 Where(`su_money_transaction_record.record_type = ?`, 5). 126 Where(`su_money_transaction_record.record_type = ?`, 5).
127 Select(&systemUnExchangeSuMoney); err != nil { 127 Select(&systemUnExchangeSuMoney); err != nil {
128 return nil, err 128 return nil, err
129 } 129 }
130 - if err := tx.Model(suMoneyTransactionRecordModel).Join("JOIN employees AS employee ON employee.uid = employee.uid"). 130 + if err := tx.Model(suMoneyTransactionRecordModel).Join("JOIN employees AS e ON e.uid = (su_money_transaction_records.employee->>'uid')::bigint").
131 ColumnExpr("sum(su_money_transaction_record.su_money) AS system_changed_su_money"). 131 ColumnExpr("sum(su_money_transaction_record.su_money) AS system_changed_su_money").
132 Where("employee.company_id = ?", companyId). 132 Where("employee.company_id = ?", companyId).
133 Where(`su_money_transaction_record.record_type = ?`, 5). 133 Where(`su_money_transaction_record.record_type = ?`, 5).
@@ -140,7 +140,7 @@ func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string] int @@ -140,7 +140,7 @@ func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string] int
140 },nil 140 },nil
141 } 141 }
142 142
143 -// TODO 计算系统现金 143 +// 计算系统现金
144 func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interface{}, error) { 144 func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interface{}, error) {
145 var ( 145 var (
146 systemUnExchangeCash float64 146 systemUnExchangeCash float64
@@ -148,7 +148,7 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf @@ -148,7 +148,7 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf
148 ) 148 )
149 tx := dao.transactionContext.PgTx 149 tx := dao.transactionContext.PgTx
150 suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord) 150 suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
151 - if err := tx.Model(suMoneyTransactionRecordModel).Join("JOIN employees AS employee ON employee.uid = employee.uid"). 151 + if err := tx.Model(suMoneyTransactionRecordModel).Join("JOIN employees AS e ON e.uid = (su_money_transaction_records.employee->>'uid')::bigint").
152 ColumnExpr("sum(su_money_transaction_record.cash) AS system_exchanged_cash"). 152 ColumnExpr("sum(su_money_transaction_record.cash) AS system_exchanged_cash").
153 Where("employee.company_id = ?", companyId). 153 Where("employee.company_id = ?", companyId).
154 Where(`su_money_transaction_record.record_type = ?`, 5). 154 Where(`su_money_transaction_record.record_type = ?`, 5).
@@ -158,7 +158,10 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf @@ -158,7 +158,10 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf
158 158
159 cashPool := new(models.CashPool) 159 cashPool := new(models.CashPool)
160 if err := tx.Model(cashPool). 160 if err := tx.Model(cashPool).
  161 + Column("un_exchange_cash").
161 Where("cash_pool.company_id = ?", companyId). 162 Where("cash_pool.company_id = ?", companyId).
  163 + Order("id DSC").
  164 + Limit(1).
162 Select(&systemUnExchangeCash) ; err != nil { 165 Select(&systemUnExchangeCash) ; err != nil {
163 return nil, err 166 return nil, err
164 } 167 }
@@ -198,6 +201,52 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction @@ -198,6 +201,52 @@ func (dao *EmployeeDao) CalculateSuMoneyTransactionRecord(uid int64, transaction
198 }, nil 201 }, nil
199 } 202 }
200 203
  204 +func (dao *EmployeeDao) CalculateEmployeesSuMoney(companyId int) (map[string]interface{}, error) {
  205 + tx := dao.transactionContext.PgTx
  206 + var res []struct {
  207 + EmployeesSuMoney float64
  208 + Employee domain.Employee
  209 + }
  210 + suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
  211 + if err := tx.Model(suMoneyTransactionRecordModel).Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint").
  212 + Column("su_money_transaction_record.employee, (su_money_transaction_record.employee->>'employeeName')::text,").
  213 + ColumnExpr("sum(su_money_transaction_record.current_su_money) AS employee_su_money").
  214 + Where(`e.company_id = ?`, companyId).
  215 + Where(`e.status = ?`, 1).
  216 + Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})).
  217 + Group("su_money_transaction_record.employee").
  218 + Order("employee_su_money DESC").
  219 + Select(&res); err != nil {
  220 + return nil, err
  221 + }
  222 + return map[string]interface{}{
  223 + "employeesSuMoney": res,
  224 + }, nil
  225 +}
  226 +
  227 +func (dao *EmployeeDao) CalculateEmployeesContributions(companyId int) (map[string]interface{}, error) {
  228 + tx := dao.transactionContext.PgTx
  229 + var ret []struct {
  230 + EmployeesContributions float64
  231 + Employee domain.Employee
  232 + }
  233 + suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
  234 + if err := tx.Model(suMoneyTransactionRecordModel).Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint").
  235 + Column("su_money_transaction_record.employee").
  236 + ColumnExpr("sum(s.current_su_money) AS employees_contributions").
  237 + Where(`e.company_id = ?`, companyId).
  238 + Where(`su_money_transaction_record.record_type = ?`, 2).
  239 + Where(`e.status = ?`, 1).
  240 + Group("su_money_transaction_record.employee").
  241 + Order("employees_contributions DESC").
  242 + Select(&ret); err != nil {
  243 + return nil, err
  244 + }
  245 + return map[string]interface{}{
  246 + "employeesContributions": ret,
  247 + }, nil
  248 +}
  249 +
201 func NewEmployeeDao(transactionContext *pgTransaction.TransactionContext) (*EmployeeDao, error) { 250 func NewEmployeeDao(transactionContext *pgTransaction.TransactionContext) (*EmployeeDao, error) {
202 if transactionContext == nil { 251 if transactionContext == nil {
203 return nil, fmt.Errorf("transactionContext参数不能为nil") 252 return nil, fmt.Errorf("transactionContext参数不能为nil")
@@ -39,6 +39,7 @@ func init() { @@ -39,6 +39,7 @@ func init() {
39 (*models.CashPool)(nil), 39 (*models.CashPool)(nil),
40 (*models.ExchangeCashActivity)(nil), 40 (*models.ExchangeCashActivity)(nil),
41 (*models.ExchangeCashPersonList)(nil), 41 (*models.ExchangeCashPersonList)(nil),
  42 + (*models.ListInterval)(nil),
42 } { 43 } {
43 err := DB.CreateTable(model, &orm.CreateTableOptions{ 44 err := DB.CreateTable(model, &orm.CreateTableOptions{
44 Temp: false, 45 Temp: false,
@@ -18,7 +18,7 @@ func (repository *ListIntervalRepository) Save(listInterval *domain.ListInterval @@ -18,7 +18,7 @@ func (repository *ListIntervalRepository) Save(listInterval *domain.ListInterval
18 if _, err := tx.QueryOne( 18 if _, err := tx.QueryOne(
19 pg.Scan(&listInterval.ListIntervalId, &listInterval.CompanyId, &listInterval.IntervalStartTime, &listInterval.IntervalEndTime), 19 pg.Scan(&listInterval.ListIntervalId, &listInterval.CompanyId, &listInterval.IntervalStartTime, &listInterval.IntervalEndTime),
20 "INSERT INTO list_intervals (list_interval_start_time, list_interval_end_time, company_id) VALUES (?, ?, ?) RETURNING id, company_id, list_interval_start_time, list_interval_end_time", 20 "INSERT INTO list_intervals (list_interval_start_time, list_interval_end_time, company_id) VALUES (?, ?, ?) RETURNING id, company_id, list_interval_start_time, list_interval_end_time",
21 - listInterval.ListIntervalId, listInterval.CompanyId, listInterval.IntervalStartTime, listInterval.IntervalEndTime); err != nil { 21 + listInterval.IntervalStartTime, listInterval.IntervalEndTime, listInterval.CompanyId); err != nil {
22 return listInterval, err 22 return listInterval, err
23 } 23 }
24 } else { 24 } else {
@@ -101,3 +101,8 @@ func (controller *EmployeeController) ListEmployee() { @@ -101,3 +101,8 @@ func (controller *EmployeeController) ListEmployee() {
101 controller.Data["json"] = response 101 controller.Data["json"] = response
102 controller.ServeJSON() 102 controller.ServeJSON()
103 } 103 }
  104 +
  105 +// TODO 导出员工素币情况列表,选择导出(ids)
  106 +func (controller *EmployeeController) ExportSuMoney() {
  107 +
  108 +}
@@ -68,7 +68,7 @@ func (controller *ListIntervalController) GetListInterval() { @@ -68,7 +68,7 @@ func (controller *ListIntervalController) GetListInterval() {
68 func (controller *ListIntervalController) ListListInterval() { 68 func (controller *ListIntervalController) ListListInterval() {
69 listIntervalService := service.NewListIntervalService(nil) 69 listIntervalService := service.NewListIntervalService(nil)
70 listListIntervalQuery := &query.ListListIntervalQuery{} 70 listListIntervalQuery := &query.ListListIntervalQuery{}
71 - companyId, _ := controller.GetInt64(":companyID") 71 + companyId, _ := controller.GetInt("companyId")
72 listListIntervalQuery.CompanyId = companyId 72 listListIntervalQuery.CompanyId = companyId
73 offset, _ := controller.GetInt("offset") 73 offset, _ := controller.GetInt("offset")
74 listListIntervalQuery.Offset = offset 74 listListIntervalQuery.Offset = offset
@@ -101,4 +101,34 @@ func (controller *StatisticsController) SystemCashStatistics() { @@ -101,4 +101,34 @@ func (controller *StatisticsController) SystemCashStatistics() {
101 } 101 }
102 controller.Data["json"] = response 102 controller.Data["json"] = response
103 controller.ServeJSON() 103 controller.ServeJSON()
  104 +}
  105 +
  106 +func (controller *StatisticsController) EmployeesSuMoneyStatistics() {
  107 + statisticsService := service.NewStatisticsService(nil)
  108 + employeesSuMoneyStatisticsCommand := &command.EmployeesSuMoneyStatisticsCommand{}
  109 + json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), employeesSuMoneyStatisticsCommand)
  110 + data, err := statisticsService.EmployeesSuMoneyStatistics(employeesSuMoneyStatisticsCommand)
  111 + var response utils.JsonResponse
  112 + if err != nil {
  113 + response = utils.ResponseError(controller.Ctx, err)
  114 + } else {
  115 + response = utils.ResponseData(controller.Ctx, data)
  116 + }
  117 + controller.Data["json"] = response
  118 + controller.ServeJSON()
  119 +}
  120 +
  121 +func (controller *StatisticsController) EmployeesContributionsStatistics() {
  122 + statisticsService := service.NewStatisticsService(nil)
  123 + employeesContributionsStatisticsCommand := &command.EmployeesContributionsStatisticsCommand{}
  124 + json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), employeesContributionsStatisticsCommand)
  125 + data, err := statisticsService.EmployeesContributionsStatistics(employeesContributionsStatisticsCommand)
  126 + var response utils.JsonResponse
  127 + if err != nil {
  128 + response = utils.ResponseError(controller.Ctx, err)
  129 + } else {
  130 + response = utils.ResponseData(controller.Ctx, data)
  131 + }
  132 + controller.Data["json"] = response
  133 + controller.ServeJSON()
104 } 134 }
@@ -362,4 +362,14 @@ func (controller *SuMoneyController) ImportExchangeList () { @@ -362,4 +362,14 @@ func (controller *SuMoneyController) ImportExchangeList () {
362 response = utils.ResponseData(controller.Ctx, ret) 362 response = utils.ResponseData(controller.Ctx, ret)
363 controller.Data["json"] = response 363 controller.Data["json"] = response
364 controller.ServeJSON() 364 controller.ServeJSON()
  365 +}
  366 +
  367 +// TODO 导出素币兑换清单,选择导出(ids)
  368 +func (controller *SuMoneyController) ExportExchangeList() {
  369 +
  370 +}
  371 +
  372 +// TODO 导出素币流水记录,选择导出(ids)
  373 +func (controller *SuMoneyController) ExportSuMoneyTransactionRecord() {
  374 +
365 } 375 }
@@ -11,4 +11,5 @@ func init() { @@ -11,4 +11,5 @@ func init() {
11 beego.Router("/employees/:uid", &controllers.EmployeeController{}, "Get:GetEmployee") 11 beego.Router("/employees/:uid", &controllers.EmployeeController{}, "Get:GetEmployee")
12 beego.Router("/employees/:uid", &controllers.EmployeeController{}, "Delete:RemoveEmployee") 12 beego.Router("/employees/:uid", &controllers.EmployeeController{}, "Delete:RemoveEmployee")
13 beego.Router("/employees/", &controllers.EmployeeController{}, "Get:ListEmployee") 13 beego.Router("/employees/", &controllers.EmployeeController{}, "Get:ListEmployee")
  14 + beego.Router("/employees/export", &controllers.EmployeeController{}, "Post:ExportSuMoney") // 导出员工素币情况列表
14 } 15 }
@@ -12,4 +12,6 @@ func init() { @@ -12,4 +12,6 @@ func init() {
12 beego.Router("/statistics/person-notification", &controllers.StatisticsController{}, "Post:PersonNotificationStatistics") 12 beego.Router("/statistics/person-notification", &controllers.StatisticsController{}, "Post:PersonNotificationStatistics")
13 beego.Router("/statistics/system-su-money", &controllers.StatisticsController{}, "Post:SystemSuMoneyStatistics") // 系统素币统计 13 beego.Router("/statistics/system-su-money", &controllers.StatisticsController{}, "Post:SystemSuMoneyStatistics") // 系统素币统计
14 beego.Router("/statistics/system-cash", &controllers.StatisticsController{}, "Post:SystemCashStatistics") // 系统现金统计 14 beego.Router("/statistics/system-cash", &controllers.StatisticsController{}, "Post:SystemCashStatistics") // 系统现金统计
  15 + beego.Router("/statistics/employees-su-money", &controllers.StatisticsController{}, "Post:EmployeesSuMoneyStatistics") // 员工财富值统计
  16 + beego.Router("/statistics/employees-contributions", &controllers.StatisticsController{}, "Post:EmployeesContributionsStatistics") // 员工贡献值统计
15 } 17 }
@@ -12,6 +12,7 @@ func init() { @@ -12,6 +12,7 @@ func init() {
12 beego.Router("/su-money/exchange", &controllers.SuMoneyController{}, "Post:ExchangeSuMoney") // 兑换素币 12 beego.Router("/su-money/exchange", &controllers.SuMoneyController{}, "Post:ExchangeSuMoney") // 兑换素币
13 beego.Router("/su-money/search-su-money-transaction-record", &controllers.SuMoneyController{}, "Post:SearchSuMoneyTransactionRecord") // 搜索素币事务记录 13 beego.Router("/su-money/search-su-money-transaction-record", &controllers.SuMoneyController{}, "Post:SearchSuMoneyTransactionRecord") // 搜索素币事务记录
14 beego.Router("/su-money/su-money-transaction-record-statistics", &controllers.SuMoneyController{}, "Post:SuMoneyTransactionRecordStatistics") // 返回素币事务记录统计 14 beego.Router("/su-money/su-money-transaction-record-statistics", &controllers.SuMoneyController{}, "Post:SuMoneyTransactionRecordStatistics") // 返回素币事务记录统计
  15 + beego.Router("/su-money/su-money-transaction-records/export", &controllers.SuMoneyController{}, "Post:ExportSuMoneyTransactionRecord") // 导出素币事务记录
15 16
16 /**********************************************现金池*******************************************/ 17 /**********************************************现金池*******************************************/
17 beego.Router("/cash-pool/input", &controllers.SuMoneyController{}, "Post:CashInput") // 现金池投入 18 beego.Router("/cash-pool/input", &controllers.SuMoneyController{}, "Post:CashInput") // 现金池投入
@@ -31,4 +32,5 @@ func init() { @@ -31,4 +32,5 @@ func init() {
31 beego.Router("/cash-pool/activity/exchange-list/:listId", &controllers.SuMoneyController{}, "Put:UpdateExchangeList") // 编辑素币兑换清单 32 beego.Router("/cash-pool/activity/exchange-list/:listId", &controllers.SuMoneyController{}, "Put:UpdateExchangeList") // 编辑素币兑换清单
32 beego.Router("/cash-pool/activity/exchange-list/:listId", &controllers.SuMoneyController{}, "Delete:RemoveExchangeCashPerson") // 删除素币兑换清单 33 beego.Router("/cash-pool/activity/exchange-list/:listId", &controllers.SuMoneyController{}, "Delete:RemoveExchangeCashPerson") // 删除素币兑换清单
33 beego.Router("/cash-pool/activity/exchange-list/import", &controllers.SuMoneyController{}, "Post:ImportExchangeList") // 导入素币兑换清单 34 beego.Router("/cash-pool/activity/exchange-list/import", &controllers.SuMoneyController{}, "Post:ImportExchangeList") // 导入素币兑换清单
  35 + beego.Router("/cash-pool/activity/exchange-list/export", &controllers.SuMoneyController{}, "Post:ExportExchangeList") // 导出素币兑换清单
34 } 36 }