package cn.com.goldenwater.dcproj.controller.other; import cn.com.goldenwater.core.web.BaseController; import cn.com.goldenwater.core.web.BaseResponse; import cn.com.goldenwater.dcproj.service.BisInspStatService; import cn.com.goldenwater.id.util.UuidUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.io.IOException; import java.util.HashMap; import java.util.Map; /** * @author lhc * @date 2019-10-16 */ @Api(value = "督查工作内容统计", tags = "督查工作内容统计") @RestController @RequestMapping("/bis/insp/stat") public class BisInspStatController extends BaseController { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private BisInspStatService bisInspStatService; @ApiOperation(value = "根据开始和结束时间获取统计数据,返回生成的WORD的存放路径") @RequestMapping(value = "getDocByTm/{stTm}/{enTm}", method = RequestMethod.GET) public BaseResponse getDocByTm( @ApiParam(name = "stTm", value = "stTm", required = true) @PathVariable String stTm, @ApiParam(name = "enTm", value = "enTm", required = true) @PathVariable String enTm, @ApiParam(name = "ifCasePblm", value = "ifCasePblm", required = true) String ifCasePblm) throws IOException { //获取Header里的用户id String fileName = UuidUtil.uuid() + ".doc"; Map map = new HashMap<>(2); map.put("persId", getCurrentPersId()); map.put("ifCasePblm", ifCasePblm); String filePath = bisInspStatService.getDocByTm(fileName, stTm, enTm, map, getCurrentOrgId()); return buildSuccessResponse(filePath); } @ApiOperation(value = "根据开始和结束时间获取统计数据,返回生成的WORD的存放路径") @RequestMapping(value = "getRsvrDocByTm/{month}", method = RequestMethod.GET) public BaseResponse getRsvrDocByTm( @ApiParam(name = "month", value = "month", required = true) @PathVariable String month, @ApiParam(name = "persId", value = "persId", required = true) @RequestParam String persId) throws IOException { if (StringUtils.isBlank(month) || !month.contains("-")) { return buildFailResponse("please check date"); } //获取Header里的用户id String fileName = UuidUtil.uuid() + ".doc"; String filePath = bisInspStatService.getRsvrDocByTm(fileName, month, persId, getCurrentOrgId()); return buildSuccessResponse(filePath); } }