zj
2025-02-17 76bc979b654c23be393c9c46c9e3099cdd3785ec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package project.web.admin.monitor.user;
 
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
 
import kernel.exception.BusinessException;
import kernel.web.Page;
import kernel.web.PageActionSupport;
import project.Constants;
import project.log.AdminLogService;
 
/**
 * 账变记录
 */
@Controller
public class AdminMoneyLogController extends PageActionSupport {
 
    private Logger logger = LoggerFactory.getLogger(AdminMoneyLogController.class);
    
    @Autowired
    private AdminLogService adminLogService;
    
    private final String action = "normal/adminMoneyLogAction!";
 
    /**
     * 获取 账变记录 列表
     */
    @RequestMapping(action + "list.action")
    public ModelAndView list(HttpServletRequest request) {
        String log_para = request.getParameter("log_para");
        String rolename_para = request.getParameter("rolename_para");
        String start_time = request.getParameter("start_time");
        String end_time = request.getParameter("end_time");
        String name_para = request.getParameter("name_para");
 
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("moneylog_list");
        
        int pageNo = 1;
        int pageSize = 30;
        Page page = null;
        try {
            pageNo = this.checkAndSetPageNo(request.getParameter("pageNo"));
 
            String loginPartyId = this.getLoginPartyId();
            page = this.adminLogService.pagedQueryMoneyLog(pageNo, pageSize, log_para, name_para,
                    loginPartyId, rolename_para, start_time, end_time);
 
            List<Map<String, Object>> list = (List<Map<String, Object>>) page.getElements();
            for (int i = 0; i < list.size(); i++) {
                Map<String, Object> map = list.get(i);
                map.put("amount", new BigDecimal(map.get("amount").toString()).toPlainString());
                map.put("amount_before", new BigDecimal(map.get("amount_before").toString()).toPlainString());
                map.put("amount_after", new BigDecimal(map.get("amount_after").toString()).toPlainString());
                
                if (null == map.get("rolename")) {
                    map.put("roleNameDesc", "");
                } else {
                    String roleName = map.get("rolename").toString();
                    map.put("roleNameDesc", Constants.ROLE_MAP.containsKey(roleName) ? Constants.ROLE_MAP.get(roleName) : roleName);
                }
            }
            
        } catch (BusinessException e) {
            this.error = e.getMessage();
            modelAndView.addObject("error", this.error);
            return modelAndView;
        } catch (Throwable t) {
            logger.error(" error ", t);
            this.error = ("[ERROR] " + t.getMessage());
            modelAndView.addObject("error", this.error);
            return modelAndView;
        }
        
        modelAndView.addObject("pageNo", pageNo);
        modelAndView.addObject("pageSize", pageSize);
        modelAndView.addObject("page", page);
        modelAndView.addObject("log_para", log_para);
        modelAndView.addObject("rolename_para", rolename_para);
        modelAndView.addObject("start_time", start_time);
        modelAndView.addObject("end_time", end_time);
        modelAndView.addObject("name_para", name_para);
        return modelAndView;
    }
 
}