|
@@ -2,6 +2,8 @@ package com.sysu.admin.api.crop;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.mysql.jdbc.StringUtils;
|
|
|
+import com.sysu.admin.api.interceptor.LogAspect;
|
|
|
+import com.sysu.admin.api.valid.ApiReqValid;
|
|
|
import com.sysu.admin.controller.crop.CropLand;
|
|
|
import com.sysu.admin.controller.crop.CropLandService;
|
|
|
import com.sysu.admin.controller.crop.CropPoint;
|
|
@@ -14,6 +16,7 @@ import com.sysu.admin.support.system.config.SConfigService;
|
|
|
import com.sysu.admin.utils.shape.GeoCastUtil;
|
|
|
import com.xiesx.fastboot.base.result.BaseResult;
|
|
|
import com.xiesx.fastboot.base.result.R;
|
|
|
+import com.xiesx.fastboot.core.token.handle.CurrentToken;
|
|
|
import com.xiesx.fastboot.utils.CopyUtils;
|
|
|
import org.apache.commons.codec.binary.Base64;
|
|
|
import org.opengis.referencing.FactoryException;
|
|
@@ -50,7 +53,6 @@ public class ApiCropController extends BaseComponent {
|
|
|
vo.setMeter(5000);
|
|
|
}
|
|
|
List<CropPoint> cropPoints = cityLandService.findByBuffer(vo.getPoint(), vo.getMeter());
|
|
|
-
|
|
|
return R.succ(cropPoints);
|
|
|
}
|
|
|
|
|
@@ -86,26 +88,33 @@ public class ApiCropController extends BaseComponent {
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/list")
|
|
|
+ @LogAspect
|
|
|
public BaseResult list(@RequestBody String data){
|
|
|
CropVo vo = JSON.parseObject(data, CropVo.class);
|
|
|
- List<CropLand> cityLandList = null;
|
|
|
- cityLandList = cityLandService.findIdAndNameByExecutor(testId);
|
|
|
+ super.validate(vo, ApiReqValid.TokenCheckValid.class);
|
|
|
+ CurrentToken currentToken = CurrentToken.getCurrentToken(vo.getToken());
|
|
|
+ List<CropLand> cityLandList = cityLandService.findIdAndNameByExecutor(Long.valueOf(currentToken.getUserId()));
|
|
|
return R.succ(cityLandList);
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/updateStatus")
|
|
|
public BaseResult updateStatus(@RequestBody String data){
|
|
|
CropVo vo = JSON.parseObject(data, CropVo.class);
|
|
|
- cityLandService.updateStatus(vo.getId(),vo.getStatus());
|
|
|
+ super.validate(vo, ApiReqValid.TokenCheckValid.class);
|
|
|
+ CurrentToken currentToken = CurrentToken.getCurrentToken(vo.getToken());
|
|
|
+ cityLandService.updateStatus(vo.getId(),vo.getStatus(), Long.parseLong(currentToken.getUserId()));
|
|
|
return R.succ();
|
|
|
}
|
|
|
|
|
|
@PostMapping("/uploadData")
|
|
|
+ @LogAspect
|
|
|
public BaseResult uploadData(@RequestBody String json){
|
|
|
CropVo vo = JSON.parseObject(json, CropVo.class);
|
|
|
+ super.validate(vo, ApiReqValid.TokenCheckValid.class);
|
|
|
+ CurrentToken currentToken = CurrentToken.getCurrentToken(vo.getToken());
|
|
|
CropLand bean = cityLandService.findOne(vo.getId());
|
|
|
BeanUtils.copyProperties(vo, bean, CopyUtils.nullNames(vo));
|
|
|
- bean.setExecutor(testId);
|
|
|
+ bean.setExecutor(Long.parseLong(currentToken.getUserId()));
|
|
|
bean.setUpdateDate(new Date());
|
|
|
cityLandService.saveCropAndImages(bean);
|
|
|
return R.succ();
|