| | |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.data.DictEntity; |
| | | import com.lf.server.entity.show.ExportEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.service.data.DownloadService; |
| | | import com.lf.server.service.show.ExportService; |
| | | import com.lf.server.service.sys.TokenService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @RestController |
| | | @RequestMapping("/export") |
| | | public class ExportController extends BaseController { |
| | | @Autowired |
| | | ExportService exportService; |
| | | |
| | | @Autowired |
| | | TokenService tokenService; |
| | | |
| | | @Autowired |
| | | DownloadService downloadService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询") |
| | | @ApiImplicitParams({ |
| | |
| | | } |
| | | } |
| | | |
| | | public ResponseMsg<String> upload() { |
| | | @SysLog() |
| | | @ApiOperation(value = "新建出图") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "在线制图实体类", dataType = "ExportEntity", paramType = "body") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/insertMap", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<String> insertMap(@RequestBody ExportEntity entity, HttpServletRequest req) { |
| | | try { |
| | | if (entity == null || |
| | | StringHelper.isEmpty(entity.getLayers()) || |
| | | StringHelper.isEmpty(entity.getToken()) || |
| | | (entity.getXmin() == 0 && entity.getYmin() == 0 && entity.getXmax() == 0 && entity.getYmax() == 0)) { |
| | | return fail("参数不完整"); |
| | | } |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | | return fail("用户未登录"); |
| | | } |
| | | |
| | | return success(null); |
| | | String str = exportService.post(entity); |
| | | if (StringHelper.isNull(str)) { |
| | | return fail("出图失败"); |
| | | } |
| | | |
| | | // |
| | | |
| | | return success(str); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex.getMessage()); |
| | | } |
| | | } |
| | | } |