| | |
| | | import com.lf.server.aspect.SysLog; |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.ctrl.ShpRecordEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.AesHelper; |
| | | import com.lf.server.helper.ClassHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.mapper.all.GeomBaseMapper; |
| | | import com.lf.server.service.data.UploaderService; |
| | | import com.lf.server.service.show.InquiryService; |
| | | 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 javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @RestController |
| | | @RequestMapping("/inquiry") |
| | | public class InquiryController extends BaseController { |
| | | private final static int FOUR = 4; |
| | | |
| | | @Autowired |
| | | TokenService tokenService; |
| | | |
| | | @Autowired |
| | | UploaderService uploaderService; |
| | | |
| | | @Autowired |
| | | InquiryService inquiryService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询记录数") |
| | | @ApiImplicitParams({ |
| | |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "上传Shp文件读取第一条记录的WKT") |
| | | @ResponseBody |
| | | @PostMapping(value = "/uploadShp") |
| | | public ResponseMsg<ShpRecordEntity> uploadShp(HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | | return fail("用户未登录", null); |
| | | } |
| | | |
| | | List<MetaFileEntity> list = uploaderService.uploadData(null, ue, req, res); |
| | | if (list.size() < FOUR) { |
| | | return fail("没有找到已上传的数据或不完整", null); |
| | | } |
| | | |
| | | ShpRecordEntity sr = inquiryService.readShpFirstRecord(list); |
| | | if (sr != null && !StringHelper.isEmpty(sr.getWkt())) { |
| | | sr.setWkt(AesHelper.encrypt(sr.getWkt())); |
| | | } |
| | | |
| | | return success(sr); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | } |