|
@@ -1,19 +1,31 @@
|
|
package com.gis.web.controller;
|
|
package com.gis.web.controller;
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
import com.gis.common.util.Result;
|
|
import com.gis.common.util.Result;
|
|
import com.gis.domain.dto.GoodsPageDto;
|
|
import com.gis.domain.dto.GoodsPageDto;
|
|
|
|
+import com.gis.domain.dto.MaterialDto;
|
|
import com.gis.domain.po.GoodsEntity;
|
|
import com.gis.domain.po.GoodsEntity;
|
|
|
|
+import com.gis.domain.po.MaterialEntity;
|
|
import com.gis.domain.po.ZoneEntity;
|
|
import com.gis.domain.po.ZoneEntity;
|
|
import com.gis.service.GoodsService;
|
|
import com.gis.service.GoodsService;
|
|
|
|
+import com.gis.service.MaterialService;
|
|
import com.gis.service.ZoneService;
|
|
import com.gis.service.ZoneService;
|
|
|
|
+import com.gis.service.aop.WebControllerLog;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
+
|
|
|
|
+import javax.validation.Valid;
|
|
|
|
+import java.util.Date;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Created by owen on 2021/5/18 0018 14:50
|
|
* Created by owen on 2021/5/18 0018 14:50
|
|
*/
|
|
*/
|
|
|
|
+@Slf4j
|
|
@Api(tags = "展示页")
|
|
@Api(tags = "展示页")
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("api/web")
|
|
@RequestMapping("api/web")
|
|
@@ -25,6 +37,9 @@ public class WebController {
|
|
@Autowired
|
|
@Autowired
|
|
private GoodsService goodsService;
|
|
private GoodsService goodsService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ MaterialService materialService;
|
|
|
|
+
|
|
@ApiOperation("展区列表")
|
|
@ApiOperation("展区列表")
|
|
@GetMapping("zoneList")
|
|
@GetMapping("zoneList")
|
|
public Result<ZoneEntity> list() {
|
|
public Result<ZoneEntity> list() {
|
|
@@ -36,4 +51,32 @@ public class WebController {
|
|
public Result<GoodsEntity> list(@RequestBody GoodsPageDto param) {
|
|
public Result<GoodsEntity> list(@RequestBody GoodsPageDto param) {
|
|
return goodsService.search(param);
|
|
return goodsService.search(param);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @WebControllerLog(description = "展示页-史料上传", addDb = true)
|
|
|
|
+ @ApiOperation(value = "史料-上传", notes = "把上传文件都放到code目录里")
|
|
|
|
+ @PostMapping("material/upload/{code}")
|
|
|
|
+ public Result materialUpload(MultipartFile file, @PathVariable String code) {
|
|
|
|
+ return materialService.materialUpload(file, code);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "史料-获取上传码")
|
|
|
|
+ @GetMapping("material/getCode")
|
|
|
|
+ public Result materialGetCode() {
|
|
|
|
+ Object code = DateUtil.format(new Date(), "yyyyMMdd_HHmmssSSS");
|
|
|
|
+ log.info("返回码:{}", code);
|
|
|
|
+ return Result.success(code);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @WebControllerLog(description = "展示页-史料保存", addDb = true)
|
|
|
|
+ @ApiOperation(value = "史料-保存", notes = "把上传文件都放到code目录里")
|
|
|
|
+ @PostMapping("material/save")
|
|
|
|
+ public Result materialSave(@Valid @RequestBody MaterialDto param) {
|
|
|
|
+ MaterialEntity entity = new MaterialEntity();
|
|
|
|
+ BeanUtils.copyProperties(param, entity);
|
|
|
|
+ materialService.save(entity);
|
|
|
|
+ return Result.success();
|
|
|
|
+ }
|
|
}
|
|
}
|