|
@@ -0,0 +1,108 @@
|
|
|
+package com.huaxu.controller;
|
|
|
+
|
|
|
+import com.huaxu.common.FileUploadUtil;
|
|
|
+import com.huaxu.model.AjaxMessage;
|
|
|
+import com.huaxu.model.LoginUser;
|
|
|
+import com.huaxu.model.ResultStatus;
|
|
|
+import com.huaxu.util.UserUtil;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
+
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Date;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import com.huaxu.entity.ComdisplayMapEntity;
|
|
|
+import com.huaxu.service.ComdisplayMapService;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 综合展示图片页面控制器
|
|
|
+ * @author wyy
|
|
|
+ * @date 2021-02-24 09:23
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/comdismap")
|
|
|
+@Api(tags = "综合展示--图片")
|
|
|
+public class ComdisplayMapController{
|
|
|
+ @Autowired
|
|
|
+ private ComdisplayMapService comdisplayMapService;
|
|
|
+ @Value("${SMS.sys_config_path}")
|
|
|
+ private String baseDir;
|
|
|
+ /**
|
|
|
+ * 新增
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "综合展示图片")
|
|
|
+ @RequestMapping(value = "addComDisImage", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxMessage<String> addUserPhoto(@ApiParam(value = "综合展示图片", required = true) @RequestParam("avatarfile") MultipartFile file) {
|
|
|
+ String avatar = "";
|
|
|
+ if (!file.isEmpty()) {
|
|
|
+ try {
|
|
|
+ avatar = FileUploadUtil.uploadWeb(baseDir, file);
|
|
|
+ } catch (IOException e) {
|
|
|
+ return new AjaxMessage<>(ResultStatus.ERROR, e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, avatar);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/findMap", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ @ApiOperation(value = "查询地图路径")
|
|
|
+ public AjaxMessage<ComdisplayMapEntity> findMap() {
|
|
|
+ LoginUser currentUser = UserUtil.getCurrentUser();
|
|
|
+ ComdisplayMapEntity comdisplayMap = new ComdisplayMapEntity();
|
|
|
+ comdisplayMap.setTenantId(currentUser.getTenantId());
|
|
|
+ List<ComdisplayMapEntity> result = comdisplayMapService.findList(comdisplayMap);
|
|
|
+ if(result.size()>0)
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, result.get(0));
|
|
|
+ else
|
|
|
+ return new AjaxMessage<>(ResultStatus.OBJECT_ERROR);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 新增
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ @ApiOperation(value = "保存或修改")
|
|
|
+ public AjaxMessage<Integer> save(@ApiParam(value = "地图信息", required = true) @RequestBody ComdisplayMapEntity comdisplayMap) {
|
|
|
+ LoginUser currentUser = UserUtil.getCurrentUser();
|
|
|
+ comdisplayMap.setStatus(1);
|
|
|
+ comdisplayMap.setTenantId(currentUser.getTenantId());
|
|
|
+ int result = comdisplayMapService.saveOrUpdate(comdisplayMap) ? 1 : 0;
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改保存综合展示图片
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "单个编辑")
|
|
|
+ @RequestMapping(value = "/edit", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxMessage<Integer> editComdisplayMap(@ApiParam(value = "地图信息", required = true) @RequestBody ComdisplayMapEntity comdisplayMap) {
|
|
|
+ int result = comdisplayMapService.updateComdisplayMapById(comdisplayMap) ? 1 : 0;
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "批量删除")
|
|
|
+ @RequestMapping(value = "/deleteByIds", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxMessage<Integer> del(@ApiParam(value = "IDS", required = true) @RequestBody Long[] ids) {
|
|
|
+ int result = comdisplayMapService.delComdisplayMapByIds(ids) ? 1 : 0;
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, result);
|
|
|
+ }
|
|
|
+}
|