LoggerController.java 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package com.fuzamei.controller;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import org.slf4j.Logger;
  5. import org.slf4j.LoggerFactory;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Component;
  8. import org.springframework.stereotype.Controller;
  9. import org.springframework.web.bind.annotation.PathVariable;
  10. import org.springframework.web.bind.annotation.RequestBody;
  11. import org.springframework.web.bind.annotation.RequestMapping;
  12. import org.springframework.web.bind.annotation.RequestMethod;
  13. import org.springframework.web.bind.annotation.ResponseBody;
  14. import org.springframework.web.bind.annotation.RestController;
  15. import com.fuzamei.po.LogAct;
  16. import com.fuzamei.po.LogCapital;
  17. import com.fuzamei.service.LoggerService;
  18. import com.fuzamei.util.ActionReturnUtil;
  19. import com.fuzamei.vo.LogActVo;
  20. import com.fuzamei.vo.LogCapitalVo;
  21. import com.fuzamei.vo.LogMarketVo;
  22. @Controller
  23. @RequestMapping("/logger")
  24. @Component
  25. public class LoggerController {
  26. private final Logger logger = LoggerFactory.getLogger(this.getClass());
  27. @Autowired
  28. private LoggerService loggerService;
  29. /**
  30. * 根据企业id查询该企业的操作日志
  31. * @param enterpriseId
  32. * @return
  33. */
  34. @RequestMapping(value ="/findLogActById",method = RequestMethod.GET)
  35. @ResponseBody //返回非html数据格式的数据,例如json、xml等,使用前需要在配置文件中添加"配置转换器"
  36. public ActionReturnUtil findLogActById(Integer enterpriseId)
  37. {
  38. //int intEnterpriseId = Integer.parseInt(enterpriseId);
  39. List<LogActVo> resultList = loggerService.getLogActList(enterpriseId);
  40. //判断resultList是否为空
  41. if(resultList == null) {
  42. return ActionReturnUtil.returnError("400"); //返回错误信息
  43. } else {
  44. return ActionReturnUtil.returnSuccessWithData(resultList);//返回查询结果信息
  45. }
  46. }
  47. /**
  48. * 根据企业id查询资金流水日志
  49. * @param enterpriseId
  50. * @return
  51. */
  52. @RequestMapping(value = "/findLogCapitalById",method = RequestMethod.GET)
  53. @ResponseBody
  54. public ActionReturnUtil findLogCapitalById(String enterpriseId)
  55. {
  56. int intEnterpriseId = Integer.parseInt(enterpriseId);
  57. List<LogCapitalVo> resultlist =loggerService.getLogCapitalList(intEnterpriseId);
  58. if(resultlist == null) {
  59. return ActionReturnUtil.returnError("400");
  60. } else {
  61. return ActionReturnUtil.returnSuccessWithData(resultlist);
  62. }
  63. }
  64. /**
  65. * 根据市场id查询市场票据详细信息
  66. * @param id
  67. * @return
  68. */
  69. @RequestMapping(value = "/getMarketInfo",method = RequestMethod.GET)
  70. @ResponseBody
  71. public ActionReturnUtil getMarketInfo(Integer id)
  72. {
  73. LogMarketVo logMarketVo = new LogMarketVo();
  74. logMarketVo = loggerService.getMarketInfo(id);
  75. if(logMarketVo == null) {
  76. return ActionReturnUtil.returnError("400");
  77. } else {
  78. System.out.println(ActionReturnUtil.returnSuccessWithData(logMarketVo));
  79. return ActionReturnUtil.returnSuccessWithData(logMarketVo);
  80. }
  81. }
  82. }