水库月核定生态流量批量修改,水库责任体系新增修改
parent
93da634afc
commit
418c45624c
|
|
@ -1,13 +1,17 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.file.model.FileDescriptor;
|
||||
import com.gunshi.project.xyt.entity.vo.HomeIaCBsnssinfoVo;
|
||||
import com.gunshi.project.xyt.model.FileAssociations;
|
||||
import com.gunshi.project.xyt.model.IaCBsnssinfo;
|
||||
import com.gunshi.project.xyt.service.FileAssociationsService;
|
||||
import com.gunshi.project.xyt.service.IaCBsnssinfoService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
|
@ -15,6 +19,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
|
@ -105,8 +110,42 @@ public class IaCBsnssinfoController extends AbstractCommonFileController{
|
|||
return R.ok(list);
|
||||
}
|
||||
|
||||
@Operation(summary = "上传相关图片文件")
|
||||
@PostMapping(path = "/setImgFile", consumes = "multipart/form-data")
|
||||
public R setImgFile(@Parameter(description = "文件") @RequestPart("files") MultipartFile[] files) throws Exception {
|
||||
|
||||
for (MultipartFile file : files) {
|
||||
|
||||
String fileName = file.getOriginalFilename();
|
||||
String eicd = fileName.split("\\.")[0];
|
||||
|
||||
FileDescriptor fd = new FileDescriptor();
|
||||
fd.setBusinessType(getBusinessType());
|
||||
fd.setGroupId(getGroupId());
|
||||
fd.setUserId(1L);
|
||||
fd.setAccessGroup(getService().getAccessGroup());
|
||||
fd.setFilePath(generateFilePath(getProperty().getAppCode(), getBusinessType(), 1L, getGroupId(), fileName));
|
||||
fd.setFileName(fileName);
|
||||
fd.setFileLength(file.getSize());
|
||||
|
||||
getService().upload(fd, file.getInputStream());
|
||||
|
||||
FileAssociations fileAssociations = new FileAssociations();
|
||||
fileAssociations.setFileId(fd.getFileId());
|
||||
|
||||
fileService.saveFile(Lists.newArrayList(fileAssociations), getGroupId(), eicd);
|
||||
}
|
||||
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "iaCBsnssinfo";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -18,6 +18,7 @@ import java.time.LocalDateTime;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 描述: 水库月核定生态流量表
|
||||
|
|
@ -51,6 +52,16 @@ public class ResMonthEcoFlowController {
|
|||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "批量修改")
|
||||
@PostMapping("/updates")
|
||||
public R<Boolean> updates(@Validated(Update.class) @RequestBody List<ResMonthEcoFlow> dto) {
|
||||
|
||||
dto = dto.stream().map(x -> x.setModitime(new Date())).collect(Collectors.toList());
|
||||
boolean result = service.updateBatchById(dto);
|
||||
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.entity.so.ResCodeSo;
|
||||
import com.gunshi.project.xyt.model.ResSafePersonB;
|
||||
|
|
@ -42,6 +43,7 @@ public class ResSafePersonBController {
|
|||
throw new RuntimeException("当前水库不存在");
|
||||
}
|
||||
dto.setModitime(new Date());
|
||||
dto.setId(IdWorker.getId());
|
||||
boolean result = service.save(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import jakarta.validation.constraints.NotBlank;
|
|||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -27,6 +28,7 @@ import java.util.Date;
|
|||
@Schema(description="水库月核定生态流量表")
|
||||
@Data
|
||||
@TableName("public.res_month_eco_flow")
|
||||
@Accessors(chain = true) // chain = true 实现链式调用
|
||||
public class ResMonthEcoFlow implements Serializable {
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue