瀏覽代碼

'优化'

master
daixiantong 4 年之前
父節點
當前提交
d1ffd4d8e7
共有 4 個文件被更改,包括 59 次插入13 次删除
  1. +7
    -1
      src/main/java/com/taauav/admin/controller/TauvWaterSpectrumController.java
  2. +7
    -0
      src/main/java/com/taauav/admin/service/ITauvWaterSpectrumService.java
  3. +39
    -6
      src/main/java/com/taauav/admin/service/impl/TauvWaterSpectrumServiceImpl.java
  4. +6
    -6
      src/main/java/com/taauav/front/service/impl/UserWaterSpectrumServiceImpl.java

+ 7
- 1
src/main/java/com/taauav/admin/controller/TauvWaterSpectrumController.java 查看文件

@@ -3,9 +3,11 @@ package com.taauav.admin.controller;
import com.taauav.admin.controller.BaseController;
import com.taauav.admin.dto.TauvWaterSpectrumDTO;
import com.taauav.common.bean.Response;
import com.taauav.common.util.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.taauav.common.core.mps.BaseQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import com.taauav.admin.entity.TauvWaterSpectrum;
import com.taauav.admin.service.ITauvWaterSpectrumService;
@@ -26,6 +28,8 @@ public class TauvWaterSpectrumController extends BaseController {

@Autowired
private Response response;
@Value("${server.UPLOAD_URL}")
private String uploadUrl;

/**
* 查询多光谱图列表
@@ -42,7 +46,9 @@ public class TauvWaterSpectrumController extends BaseController {
@RequiresPermissions("spectrum:detail")
@GetMapping("/detail")
public Response getInfo(@RequestParam("id") Integer id) {
return response.success(tauvWaterSpectrumService.getInfo(id));
TauvWaterSpectrum waterSpectrum = tauvWaterSpectrumService.getInfo(id);
waterSpectrum = tauvWaterSpectrumService.getDetailData(waterSpectrum);
return response.success(waterSpectrum);
}

/**

+ 7
- 0
src/main/java/com/taauav/admin/service/ITauvWaterSpectrumService.java 查看文件

@@ -43,4 +43,11 @@ public interface ITauvWaterSpectrumService extends IBaseService<TauvWaterSpectru
* @return
*/
Response dropSpectrum(String ids);

/**
* 处理数据
* @param waterSpectrum
* @return
*/
TauvWaterSpectrum getDetailData(TauvWaterSpectrum waterSpectrum);
}

+ 39
- 6
src/main/java/com/taauav/admin/service/impl/TauvWaterSpectrumServiceImpl.java 查看文件

@@ -66,6 +66,11 @@ public class TauvWaterSpectrumServiceImpl extends BaseServiceImpl<TauvWaterSpect
}
IPage page = new Page(query.getPage(), query.getPageSize());
IPage<TauvWaterSpectrum> list = baseMapper.selectPage(page, wrapper);
if (list.getRecords() != null && list.getRecords().size() > 0) {
for (TauvWaterSpectrum item : list.getRecords()) {
item = getDetailData(item);
}
}
return response.success(list);
}

@@ -120,22 +125,22 @@ public class TauvWaterSpectrumServiceImpl extends BaseServiceImpl<TauvWaterSpect
public Response editSpectrum(TauvWaterSpectrum waterSpectrum) {
// 处理图片路径
if (StringUtils.isNotEmpty(waterSpectrum.getCodPic()) && waterSpectrum.getCodPic().contains(uploadFolder)) {
waterSpectrum.setCodPic(waterSpectrum.getCodPic().replace(uploadFolder, uploadUrl));
waterSpectrum.setCodPic(waterSpectrum.getCodPic().replace(uploadFolder, ""));
}
if (StringUtils.isNotEmpty(waterSpectrum.getNh3nPic()) && waterSpectrum.getNh3nPic().contains(uploadFolder)) {
waterSpectrum.setNh3nPic(waterSpectrum.getNh3nPic().replace(uploadFolder, uploadUrl));
waterSpectrum.setNh3nPic(waterSpectrum.getNh3nPic().replace(uploadFolder, ""));
}
if (StringUtils.isNotEmpty(waterSpectrum.getTpPic()) && waterSpectrum.getTpPic().contains(uploadFolder)) {
waterSpectrum.setTpPic(waterSpectrum.getTpPic().replace(uploadFolder, uploadUrl));
waterSpectrum.setTpPic(waterSpectrum.getTpPic().replace(uploadFolder, ""));
}
if (StringUtils.isNotEmpty(waterSpectrum.getTnPic()) && waterSpectrum.getTnPic().contains(uploadFolder)) {
waterSpectrum.setTnPic(waterSpectrum.getTnPic().replace(uploadFolder, uploadUrl));
waterSpectrum.setTnPic(waterSpectrum.getTnPic().replace(uploadFolder, ""));
}
if (StringUtils.isNotEmpty(waterSpectrum.getDoPic()) && waterSpectrum.getDoPic().contains(uploadFolder)) {
waterSpectrum.setDoPic(waterSpectrum.getDoPic().replace(uploadFolder, uploadUrl));
waterSpectrum.setDoPic(waterSpectrum.getDoPic().replace(uploadFolder, ""));
}
if (StringUtils.isNotEmpty(waterSpectrum.getTubPic()) && waterSpectrum.getTubPic().contains(uploadFolder)) {
waterSpectrum.setTubPic(waterSpectrum.getTubPic().replace(uploadFolder, uploadUrl));
waterSpectrum.setTubPic(waterSpectrum.getTubPic().replace(uploadFolder, ""));
}
Boolean res = updateById(waterSpectrum);
if (!res) {
@@ -153,4 +158,32 @@ public class TauvWaterSpectrumServiceImpl extends BaseServiceImpl<TauvWaterSpect
update(wrapper);
return response.success("删除成功");
}

/**
* 处理图片路径
* @param waterSpectrum
* @return
*/
@Override
public TauvWaterSpectrum getDetailData(TauvWaterSpectrum waterSpectrum) {
if (StringUtils.isNotEmpty(waterSpectrum.getCodPic()) && !waterSpectrum.getCodPic().contains("http")) {
waterSpectrum.setCodPic(uploadUrl + waterSpectrum.getCodPic());
}
if (StringUtils.isNotEmpty(waterSpectrum.getNh3nPic()) && !waterSpectrum.getNh3nPic().contains("http")) {
waterSpectrum.setNh3nPic(uploadUrl + waterSpectrum.getNh3nPic());
}
if (StringUtils.isNotEmpty(waterSpectrum.getTpPic()) && !waterSpectrum.getTpPic().contains("http")) {
waterSpectrum.setTpPic(uploadUrl + waterSpectrum.getTpPic());
}
if (StringUtils.isNotEmpty(waterSpectrum.getTnPic()) && !waterSpectrum.getTnPic().contains("http")) {
waterSpectrum.setTnPic(uploadUrl + waterSpectrum.getTnPic());
}
if (StringUtils.isNotEmpty(waterSpectrum.getDoPic()) && !waterSpectrum.getDoPic().contains("http")) {
waterSpectrum.setDoPic(uploadUrl + waterSpectrum.getDoPic());
}
if (StringUtils.isNotEmpty(waterSpectrum.getTubPic()) && !waterSpectrum.getTubPic().contains("http")) {
waterSpectrum.setTubPic(uploadUrl + waterSpectrum.getTubPic());
}
return waterSpectrum;
}
}

+ 6
- 6
src/main/java/com/taauav/front/service/impl/UserWaterSpectrumServiceImpl.java 查看文件

@@ -123,17 +123,17 @@ public class UserWaterSpectrumServiceImpl extends BaseServiceImpl<UserWaterSpect
String spectrumUrl = "";
if (spectrum != null) {
if (!StringUtils.isEmpty(spectrum.getCodPic())) {
spectrumUrl = spectrum.getCodPic();
spectrumUrl = !spectrum.getCodPic().contains("http") ? uploadUrl + spectrum.getCodPic() : spectrum.getCodPic();
} else if (!StringUtils.isEmpty(spectrum.getNh3nPic())) {
spectrumUrl = spectrum.getNh3nPic();
spectrumUrl = !spectrum.getNh3nPic().contains("http") ? uploadUrl + spectrum.getNh3nPic() : spectrum.getNh3nPic();
} else if (!StringUtils.isEmpty(spectrum.getTpPic())) {
spectrumUrl = spectrum.getTpPic();
spectrumUrl = !spectrum.getTpPic().contains("http") ? uploadUrl + spectrum.getTpPic() : spectrum.getTpPic();
} else if (!StringUtils.isEmpty(spectrum.getTnPic())) {
spectrumUrl = spectrum.getTnPic();
spectrumUrl = !spectrum.getTnPic().contains("http") ? uploadUrl + spectrum.getTnPic() : spectrum.getTnPic();
} else if (!StringUtils.isEmpty(spectrum.getDoPic())) {
spectrumUrl = spectrum.getDoPic();
spectrumUrl = !spectrum.getDoPic().contains("http") ? uploadUrl + spectrum.getDoPic() : spectrum.getDoPic();
} else if (!StringUtils.isEmpty(spectrum.getTubPic())) {
spectrumUrl = spectrum.getTubPic();
spectrumUrl = !spectrum.getTubPic().contains("http") ? uploadUrl + spectrum.getTubPic() : spectrum.getTubPic();
}
indexDriver.setSpectrumUrl(spectrumUrl);
indexDriver.setLeftLatitude(spectrum.getLeftLatitude());

Loading…
取消
儲存