|
|
@@ -188,87 +188,6 @@ public class FmsBlockController extends BaseController
|
|
|
return success(fmsBlockResVo);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 新增地块
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('fms:block:add')")
|
|
|
- @Log(title = "地块", businessType = BusinessType.INSERT)
|
|
|
- @PostMapping("/add")
|
|
|
- public AjaxResult add(@RequestBody @Valid FmsBlock fmsBlock) {
|
|
|
- FmsLand fmsLand = fmsLandService.selectFmsLandByLandId(fmsBlock.getLandId(), SecurityUtils.getTid());
|
|
|
- if (fmsLand == null) {
|
|
|
- return AjaxResult.error(ErrorCode.INVALID_PARAMETER.getCode());
|
|
|
- }
|
|
|
- /* 判断同一基地下地块名称是否重复 */
|
|
|
- FmsBlock reqVo = new FmsBlock();
|
|
|
- reqVo.setLandId(fmsBlock.getLandId());
|
|
|
- reqVo.setBlockNameEq(fmsBlock.getBlockName());
|
|
|
- List<FmsBlock> list = fmsBlockService.selectFmsBlockList(reqVo);
|
|
|
- if (!list.isEmpty()) {
|
|
|
- return AjaxResult.error(ErrorCode.FMS_BLOCK_EXIST.getCode(), ErrorCode.FMS_BLOCK_EXIST.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- return fmsBlockService.insertFmsBlock(fmsBlock, fmsLand);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 修改地块
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('fms:block:edit')")
|
|
|
- @Log(title = "地块", businessType = BusinessType.UPDATE)
|
|
|
- @PutMapping("/edit")
|
|
|
- public AjaxResult edit(@RequestBody @Valid FmsBlock fmsBlock) {
|
|
|
- FmsLand fmsLand = fmsLandService.selectFmsLandByLandId(fmsBlock.getLandId(), SecurityUtils.getTid());
|
|
|
- if (fmsLand == null) {
|
|
|
- return AjaxResult.error(ErrorCode.INVALID_PARAMETER.getCode());
|
|
|
- }
|
|
|
-
|
|
|
- /* 判断同一基地下地块名称是否重复 */
|
|
|
- FmsBlock fmsBlock1 = fmsBlockService.selectFmsBlockByBlockId(fmsBlock.getBlockId(), SecurityUtils.getTid());
|
|
|
- if (!fmsBlock1.getBlockName().equals(fmsBlock.getBlockName())) {
|
|
|
- FmsBlock reqVo = new FmsBlock();
|
|
|
- reqVo.setLandId(fmsBlock.getLandId());
|
|
|
- reqVo.setBlockNameEq(fmsBlock.getBlockName());
|
|
|
- List<FmsBlock> list = fmsBlockService.selectFmsBlockList(reqVo);
|
|
|
- if (!list.isEmpty()) {
|
|
|
- return AjaxResult.error(ErrorCode.FMS_BLOCK_EXIST.getCode(), ErrorCode.FMS_BLOCK_EXIST.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return fmsBlockService.updateFmsBlock(fmsBlock, fmsLand);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除地块
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('fms:block:delete')")
|
|
|
- @Log(title = "地块", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/delete")
|
|
|
- public AjaxResult remove(@RequestParam("blockIds") String[] blockIds) {
|
|
|
- for (int i = 0; i < blockIds.length; i++) {
|
|
|
- int count = fmsBlockMapper.selectValidDataNumber(blockIds[i], SecurityUtils.getTid());
|
|
|
- if (count > 0) {
|
|
|
- return AjaxResult.error(ErrorCode.DEL_CURNODE_ERROR.getCode(), ErrorCode.DEL_CURNODE_ERROR.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
- return fmsBlockService.deleteFmsBlockByBlockIds(blockIds, SecurityUtils.getTid());
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 地块图片上传
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('fms:block:preview:upload')")
|
|
|
- @Log(title = "地块图片上传", businessType = BusinessType.UPDATE)
|
|
|
- @PostMapping("/preview/upload")
|
|
|
- public AjaxResult uploadBlockPreview(MultipartFile file) throws Exception
|
|
|
- {
|
|
|
- if (!file.isEmpty())
|
|
|
- {
|
|
|
- SysRes sysRes = resManager.uploadRes( ResConstants.BizType.BLOCK, ResConstants.mediaType.IMG,"", file,getLoginUser());
|
|
|
- return success(sysRes);
|
|
|
- }
|
|
|
- return error(ErrorCode.UPLOAD_FAIL.getCode());
|
|
|
- }
|
|
|
|
|
|
@PostMapping("/bind/user")
|
|
|
public AjaxResult bindUser(@Valid @RequestBody FmsBlockBindUserReqVo fmsBlockBindUserReqVo){
|