package com.fuzamei.controller; import java.util.ArrayList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import com.fuzamei.po.LogAct; import com.fuzamei.po.LogCapital; import com.fuzamei.service.LoggerService; import com.fuzamei.util.ActionReturnUtil; import com.fuzamei.vo.LogActVo; import com.fuzamei.vo.LogCapitalVo; import com.fuzamei.vo.LogMarketVo; @Controller @RequestMapping("/logger") @Component public class LoggerController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private LoggerService loggerService; /** * 根据企业id查询该企业的操作日志 * @param enterpriseId * @return */ @RequestMapping(value ="/findLogActById",method = RequestMethod.GET) @ResponseBody //返回非html数据格式的数据,例如json、xml等,使用前需要在配置文件中添加"配置转换器" public ActionReturnUtil findLogActById(Integer enterpriseId) { //int intEnterpriseId = Integer.parseInt(enterpriseId); List resultList = loggerService.getLogActList(enterpriseId); //判断resultList是否为空 if(resultList == null) { return ActionReturnUtil.returnError("400"); //返回错误信息 } else { return ActionReturnUtil.returnSuccessWithData(resultList);//返回查询结果信息 } } /** * 根据企业id查询资金流水日志 * @param enterpriseId * @return */ @RequestMapping(value = "/findLogCapitalById",method = RequestMethod.GET) @ResponseBody public ActionReturnUtil findLogCapitalById(String enterpriseId) { int intEnterpriseId = Integer.parseInt(enterpriseId); List resultlist =loggerService.getLogCapitalList(intEnterpriseId); if(resultlist == null) { return ActionReturnUtil.returnError("400"); } else { return ActionReturnUtil.returnSuccessWithData(resultlist); } } /** * 根据市场id查询市场票据详细信息 * @param id * @return */ @RequestMapping(value = "/getMarketInfo",method = RequestMethod.GET) @ResponseBody public ActionReturnUtil getMarketInfo(Integer id) { LogMarketVo logMarketVo = new LogMarketVo(); logMarketVo = loggerService.getMarketInfo(id); if(logMarketVo == null) { return ActionReturnUtil.returnError("400"); } else { System.out.println(ActionReturnUtil.returnSuccessWithData(logMarketVo)); return ActionReturnUtil.returnSuccessWithData(logMarketVo); } } }