24b5b215713e0cf977f98a88db1161a667804b9f.svn-base 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package cn.com.goldenwater.dcproj.controller.other;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.service.BisInspStatService;
  5. import cn.com.goldenwater.id.util.UuidUtil;
  6. import io.swagger.annotations.Api;
  7. import io.swagger.annotations.ApiOperation;
  8. import io.swagger.annotations.ApiParam;
  9. import org.apache.commons.lang.StringUtils;
  10. import org.slf4j.Logger;
  11. import org.slf4j.LoggerFactory;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.*;
  14. import java.io.IOException;
  15. import java.util.HashMap;
  16. import java.util.Map;
  17. /**
  18. * @author lhc
  19. * @date 2019-10-16
  20. */
  21. @Api(value = "督查工作内容统计", tags = "督查工作内容统计")
  22. @RestController
  23. @RequestMapping("/bis/insp/stat")
  24. public class BisInspStatController extends BaseController {
  25. private Logger logger = LoggerFactory.getLogger(getClass());
  26. @Autowired
  27. private BisInspStatService bisInspStatService;
  28. @ApiOperation(value = "根据开始和结束时间获取统计数据,返回生成的WORD的存放路径")
  29. @RequestMapping(value = "getDocByTm/{stTm}/{enTm}", method = RequestMethod.GET)
  30. public BaseResponse<String> getDocByTm(
  31. @ApiParam(name = "stTm", value = "stTm", required = true) @PathVariable String stTm,
  32. @ApiParam(name = "enTm", value = "enTm", required = true) @PathVariable String enTm,
  33. @ApiParam(name = "ifCasePblm", value = "ifCasePblm", required = true) String ifCasePblm) throws IOException {
  34. //获取Header里的用户id
  35. String fileName = UuidUtil.uuid() + ".doc";
  36. Map<String, Object> map = new HashMap<>(2);
  37. map.put("persId", getCurrentPersId());
  38. map.put("ifCasePblm", ifCasePblm);
  39. String filePath = bisInspStatService.getDocByTm(fileName, stTm, enTm, map, getCurrentOrgId());
  40. return buildSuccessResponse(filePath);
  41. }
  42. @ApiOperation(value = "根据开始和结束时间获取统计数据,返回生成的WORD的存放路径")
  43. @RequestMapping(value = "getRsvrDocByTm/{month}", method = RequestMethod.GET)
  44. public BaseResponse<String> getRsvrDocByTm(
  45. @ApiParam(name = "month", value = "month", required = true) @PathVariable String month,
  46. @ApiParam(name = "persId", value = "persId", required = true) @RequestParam String persId) throws IOException {
  47. if (StringUtils.isBlank(month) || !month.contains("-")) {
  48. return buildFailResponse("please check date");
  49. }
  50. //获取Header里的用户id
  51. String fileName = UuidUtil.uuid() + ".doc";
  52. String filePath = bisInspStatService.getRsvrDocByTm(fileName, month, persId, getCurrentOrgId());
  53. return buildSuccessResponse(filePath);
  54. }
  55. }