除险加固台账
parent
1b7f1429f1
commit
f1422a2c76
2
ruoyi
2
ruoyi
|
|
@ -1 +1 @@
|
||||||
Subproject commit 96443a2e8120e40b58b4a2949505ae9ac8344990
|
Subproject commit d456ff189647e16ffaaa170738d785eeee1253c0
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.gunshi.project.xyt.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gunshi.core.result.R;
|
||||||
|
import com.gunshi.db.dto.PageSo;
|
||||||
|
import com.gunshi.project.xyt.model.SafetyReinforcement;
|
||||||
|
import com.gunshi.project.xyt.service.SafetyReinforcementService;
|
||||||
|
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.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
/**
|
||||||
|
* 描述: 除险加固台账
|
||||||
|
* author: xusan
|
||||||
|
* date: 2024-08-22 11:27:44
|
||||||
|
*/
|
||||||
|
@Tag(name = "除险加固台账")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value="/safety/reinforcement")
|
||||||
|
public class SafetyReinforcementController extends AbstractCommonFileController{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SafetyReinforcementService service;
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "新增")
|
||||||
|
@PostMapping("/insert")
|
||||||
|
public R<SafetyReinforcement> insert(@Validated(Insert.class) @RequestBody SafetyReinforcement dto) {
|
||||||
|
return R.ok(service.saveData(dto));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "修改")
|
||||||
|
@PostMapping("/update")
|
||||||
|
public R<SafetyReinforcement> update(@Validated(Update.class) @RequestBody SafetyReinforcement dto) {
|
||||||
|
return R.ok(service.updateData(dto));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除")
|
||||||
|
@GetMapping("/del/{id}")
|
||||||
|
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||||
|
return R.ok(service.delData(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "分页")
|
||||||
|
@PostMapping("/page")
|
||||||
|
public R<Page<SafetyReinforcement>> page(@RequestBody PageSo page) {
|
||||||
|
return R.ok(service.pageQuery(page));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getGroupId() {
|
||||||
|
return "safetyReinforcement";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.gunshi.project.xyt.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.gunshi.project.xyt.model.SafetyReinforcement;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述: 除险加固台账
|
||||||
|
* author: xusan
|
||||||
|
* date: 2024-08-22 11:27:44
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SafetyReinforcementMapper extends BaseMapper<SafetyReinforcement> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
package com.gunshi.project.xyt.model;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import com.gunshi.core.dateformat.DateFormatString;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.Update;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述: 除险加固台账
|
||||||
|
* author: xusan
|
||||||
|
* date: 2024-08-22 11:27:43
|
||||||
|
*/
|
||||||
|
@Schema(description="除险加固台账")
|
||||||
|
@Data
|
||||||
|
@TableName("public.safety_reinforcement")
|
||||||
|
public class SafetyReinforcement implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value="id", type= IdType.AUTO)
|
||||||
|
@Schema(description="主键")
|
||||||
|
@NotNull(message = "主键不能为空",groups = {Update.class})
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织方式(1地方自行组织 2中央规划)
|
||||||
|
*/
|
||||||
|
@TableField(value="organization_way")
|
||||||
|
@Schema(description="组织方式(1地方自行组织 2中央规划)")
|
||||||
|
@NotNull(message = "主键不能为空",groups = {Insert.class,Update.class})
|
||||||
|
private Integer organizationWay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工程状态(1施工中 2已完工)
|
||||||
|
*/
|
||||||
|
@TableField(value="project_status")
|
||||||
|
@Schema(description="工程状态(1施工中 2已完工)")
|
||||||
|
@NotNull(message = "工程状态不能为空",groups = {Insert.class,Update.class})
|
||||||
|
private Integer projectStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开工日期
|
||||||
|
*/
|
||||||
|
@TableField(value="start_date")
|
||||||
|
@Schema(description="开工日期")
|
||||||
|
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD, timezone = "GMT+8")
|
||||||
|
private Date startDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 竣工日期
|
||||||
|
*/
|
||||||
|
@TableField(value="finish_date")
|
||||||
|
@Schema(description="竣工日期")
|
||||||
|
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD, timezone = "GMT+8")
|
||||||
|
private Date finishDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投运日期
|
||||||
|
*/
|
||||||
|
@TableField(value="operation_date")
|
||||||
|
@Schema(description="投运日期")
|
||||||
|
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD, timezone = "GMT+8")
|
||||||
|
private Date operationDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总投资(万元)
|
||||||
|
*/
|
||||||
|
@TableField(value="total_investment")
|
||||||
|
@Schema(description="总投资(万元)")
|
||||||
|
private BigDecimal totalInvestment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设计单位
|
||||||
|
*/
|
||||||
|
@TableField(value="design_org")
|
||||||
|
@Schema(description="设计单位")
|
||||||
|
@Size(max = 100,message = "设计单位最大长度要小于 100")
|
||||||
|
private String designOrg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 施工单位
|
||||||
|
*/
|
||||||
|
@TableField(value="construct_org")
|
||||||
|
@Schema(description="施工单位")
|
||||||
|
@Size(max = 100,message = "施工单位最大长度要小于 100")
|
||||||
|
private String constructOrg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监理单位
|
||||||
|
*/
|
||||||
|
@TableField(value="control_org")
|
||||||
|
@Schema(description="监理单位")
|
||||||
|
@Size(max = 100,message = "监理单位最大长度要小于 100")
|
||||||
|
private String controlOrg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主要建设内容
|
||||||
|
*/
|
||||||
|
@TableField(value="construct_content")
|
||||||
|
@Schema(description="主要建设内容")
|
||||||
|
@Size(max = 500,message = "主要建设内容最大长度要小于 500")
|
||||||
|
private String constructContent;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Schema(description = "文件集合")
|
||||||
|
private List<FileAssociations> files;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -62,7 +62,6 @@ public class SafetyHazardInvestService extends ServiceImpl<SafetyHazardInvestMap
|
||||||
|
|
||||||
public SafetyHazardInvest saveData(SafetyHazardInvest dto) {
|
public SafetyHazardInvest saveData(SafetyHazardInvest dto) {
|
||||||
dto.setId(IdWorker.getId());
|
dto.setId(IdWorker.getId());
|
||||||
//todo 获取当前登录人为上报人
|
|
||||||
boolean result = this.save(dto);
|
boolean result = this.save(dto);
|
||||||
if (result) {
|
if (result) {
|
||||||
fileService.saveFile(dto.getFiles(), getGroupId(), String.valueOf(dto.getId()));
|
fileService.saveFile(dto.getFiles(), getGroupId(), String.valueOf(dto.getId()));
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
package com.gunshi.project.xyt.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gunshi.db.dto.PageSo;
|
||||||
|
import com.gunshi.project.xyt.mapper.SafetyReinforcementMapper;
|
||||||
|
import com.gunshi.project.xyt.model.SafetyReinforcement;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述: 除险加固台账
|
||||||
|
* author: xusan
|
||||||
|
* date: 2024-08-22 11:27:44
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class SafetyReinforcementService extends ServiceImpl<SafetyReinforcementMapper, SafetyReinforcement>
|
||||||
|
{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FileAssociationsService fileService;
|
||||||
|
|
||||||
|
public Page<SafetyReinforcement> pageQuery(PageSo page) {
|
||||||
|
LambdaQueryWrapper<SafetyReinforcement> query = Wrappers.lambdaQuery();
|
||||||
|
query.orderByDesc(SafetyReinforcement::getStartDate);
|
||||||
|
Page<SafetyReinforcement> res = this.page(page.toPage(), query);
|
||||||
|
if (res.getRecords() != null) {
|
||||||
|
fillAttach(res.getRecords());
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillAttach(List<SafetyReinforcement> ret) {
|
||||||
|
for (SafetyReinforcement record : ret) {
|
||||||
|
record.setFiles(fileService.getFiles(getGroupId(), record.getId().toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupId() {
|
||||||
|
return "safetyReinforcement";
|
||||||
|
}
|
||||||
|
|
||||||
|
public SafetyReinforcement saveData(SafetyReinforcement dto) {
|
||||||
|
dto.setId(IdWorker.getId());
|
||||||
|
boolean result = this.save(dto);
|
||||||
|
if (result) {
|
||||||
|
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getId().toString());
|
||||||
|
}
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SafetyReinforcement updateData(SafetyReinforcement dto) {
|
||||||
|
if (Objects.isNull(this.getById(dto.getId()))) {
|
||||||
|
throw new IllegalArgumentException("当前数据不存在");
|
||||||
|
}
|
||||||
|
boolean result = this.updateById(dto);
|
||||||
|
if (result) {
|
||||||
|
fileService.saveFile(dto.getFiles(), getGroupId(), dto.getId().toString());
|
||||||
|
}
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean delData(Serializable id) {
|
||||||
|
if (Objects.isNull(this.getById(id))) {
|
||||||
|
throw new IllegalArgumentException("当前数据不存在");
|
||||||
|
}
|
||||||
|
boolean data = this.removeById(id);
|
||||||
|
if (data) {
|
||||||
|
fileService.deleteFile(getGroupId(), id.toString());
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue