package com.lf.server.controller.show;
|
|
import com.lf.server.annotation.SysLog;
|
import com.lf.server.controller.all.BaseQueryController;
|
import com.lf.server.entity.all.ResponseMsg;
|
import com.lf.server.entity.all.StaticData;
|
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.StringHelper;
|
import com.lf.server.service.all.BaseUploadService;
|
import com.lf.server.service.show.InquiryService;
|
import com.lf.server.service.sys.TokenService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
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;
|
|
/**
|
* 查询
|
* @author WWW
|
*/
|
@Api(tags = "综合展示\\查询")
|
@RestController
|
@RequestMapping("/inquiry")
|
public class InquiryController extends BaseQueryController {
|
@Autowired
|
TokenService tokenService;
|
|
@Autowired
|
BaseUploadService baseUploadService;
|
|
@Autowired
|
InquiryService inquiryService;
|
|
@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 = baseUploadService.uploadData(null, null, false, req, res);
|
if (list == null || list.size() < StaticData.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, null);
|
}
|
}
|
}
|