LogManageAction.java 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. package com.minpay.huicai.personmanage.action;
  2. import com.minpay.common.bean.User;
  3. import com.minpay.common.format.IFormatService;
  4. import com.minpay.db.table.mapper.ImLogMapper;
  5. import com.minpay.db.table.model.ImLog;
  6. import com.minpay.db.table.own.mapper.UserMapper;
  7. import com.mysql.jdbc.StringUtils;
  8. import com.startup.minpay.frame.business.IMINAction;
  9. import com.startup.minpay.frame.business.MINHttpServletRequestContext;
  10. import com.startup.minpay.frame.business.res.MINActionResult;
  11. import com.startup.minpay.frame.constant.IMINBusinessConstant;
  12. import com.startup.minpay.frame.exception.MINBusinessException;
  13. import com.startup.minpay.frame.jdbc.MINRowBounds;
  14. import com.startup.minpay.frame.service.base.IMINDataBaseService;
  15. import com.startup.minpay.frame.service.base.Service;
  16. import com.startup.minpay.frame.session.MINSession;
  17. import com.startup.minpay.frame.target.MINAction;
  18. import com.startup.minpay.frame.target.MINComponent;
  19. import com.startup.minpay.frame.target.MINParam;
  20. import com.startup.minpay.util.Str;
  21. import java.util.HashMap;
  22. import java.util.List;
  23. import java.util.Map;
  24. /**
  25. * 日志查询
  26. * @author xbh
  27. *
  28. */
  29. @MINComponent
  30. public class LogManageAction implements IMINAction {
  31. public final static String QUERY_LOGS = "queryLogs";
  32. public final static String DELETE_LOGS = "deleteLogs";
  33. /**
  34. * 查询操作员
  35. * @param session
  36. * @param page
  37. * @param limit
  38. * @param roleid
  39. * @param branchid
  40. * @param agent
  41. * @param school
  42. * @param name
  43. * @param logonname
  44. * @param stt
  45. * @param fapRequest
  46. * @return
  47. * @throws MINBusinessException
  48. */
  49. @MINAction(value = QUERY_LOGS)
  50. public MINActionResult userQuery(
  51. MINSession session,
  52. @MINParam(key = "page", defaultValue = "1") int page,
  53. @MINParam(key = "limit", defaultValue = "3") int limit,
  54. @MINParam(key = "roleid") String roleid,
  55. @MINParam(key = "branchid") String branchid,
  56. @MINParam(key = "agent") String agent,
  57. @MINParam(key = "date") String date,
  58. @MINParam(key = "school") String school,
  59. @MINParam(key = "name") String name,
  60. @MINParam(key = "logonname") String logonname,
  61. @MINParam(key = "stt") String stt,
  62. @MINParam(key = "desc") String desc,
  63. MINHttpServletRequestContext fapRequest
  64. ) throws MINBusinessException {
  65. MINActionResult res = new MINActionResult();
  66. User user = session.getUser();
  67. // 创建查询条件
  68. Map<String, String> p = new HashMap<String, String>();
  69. //设置所属机构筛选条件
  70. //String branchId = "";
  71. p.put("branchid", branchid);
  72. //p.put("date", date);
  73. if(!Str.isEmptyMaskNull(date)) {
  74. String [] datas = date.split("-");
  75. p.put("date1", datas[0].trim() + "000000");
  76. p.put("date2", datas[1].trim() + "235959");
  77. }
  78. if (!Str.isEmptyMaskNull(roleid)) {
  79. p.put("roleid", roleid);
  80. }
  81. if (!Str.isEmptyMaskNull(name)) {
  82. p.put("name", name);
  83. }
  84. if (!Str.isEmptyMaskNull(logonname)) {
  85. p.put("logonname", logonname);
  86. }
  87. if (!Str.isEmptyMaskNull(stt)) {
  88. p.put("stt", stt);
  89. }
  90. if (!Str.isEmptyMaskNull(desc)) {
  91. p.put("desc", desc);
  92. }
  93. MINRowBounds rows = new MINRowBounds(page, limit);
  94. // 查询
  95. List<Map<String, String>> ls = Service.lookup(IMINDataBaseService.class).getMybatisMapper(UserMapper.class).queryLogs(p, rows);
  96. ls = Service.lookup(IFormatService.class).formatDateTime(ls, "logdatetime");
  97. // 设置返回值
  98. res.set(IMINBusinessConstant.F_PAGING_LAY, ls);
  99. String ro = String.valueOf(rows.getCount());
  100. res.set(IMINBusinessConstant.F_PAGING_COUNT, ro);
  101. return res;
  102. }
  103. @MINAction(value = DELETE_LOGS)
  104. public MINActionResult deleteLogs(
  105. MINSession session,
  106. @MINParam(key = "id") String id,
  107. MINHttpServletRequestContext fapRequest
  108. ) throws MINBusinessException {
  109. if(StringUtils.isNullOrEmpty(id)){
  110. throw new MINBusinessException("请求数据异常!");
  111. }
  112. MINActionResult res = new MINActionResult();
  113. User user = session.getUser();
  114. ImLog imLog = new ImLog();
  115. imLog.setLogno(id);
  116. imLog.setState("1");
  117. // 查询
  118. Service.lookup(IMINDataBaseService.class).getMybatisMapper(ImLogMapper.class).updateByPrimaryKeySelective(imLog);
  119. // 设置返回值
  120. return res;
  121. }
  122. }