15 changed files with 818 additions and 0 deletions
@ -0,0 +1,25 @@ |
|||
package com.kms.yxgh.base.enums; |
|||
|
|||
import lombok.Getter; |
|||
|
|||
/** |
|||
* 监督检查工程状态 |
|||
* @author hry |
|||
* @date 2024/3/4 18:57 |
|||
*/ |
|||
@Getter |
|||
public enum SuperviseEngineeringStatus { |
|||
|
|||
DRAFT("保存", "0"), |
|||
SUBMIT("提交", "1"), |
|||
; |
|||
|
|||
private final String value; |
|||
private final String name; |
|||
|
|||
SuperviseEngineeringStatus(String name, String value) { |
|||
this.name = name; |
|||
this.value = value; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.kms.yxgh.base.enums; |
|||
|
|||
import lombok.Getter; |
|||
|
|||
/** |
|||
* 监督检查问题等级状态 |
|||
* @author hry |
|||
* @date 2024/3/2 16:54 |
|||
*/ |
|||
@Getter |
|||
public enum SuperviseProblemLevelStatus { |
|||
|
|||
SAME("一般", "0"), |
|||
HEAVY("较重", "1"), |
|||
SERIOUS("严重", "2"), |
|||
; |
|||
|
|||
private final String value; |
|||
private final String name; |
|||
|
|||
SuperviseProblemLevelStatus(String name, String value) { |
|||
this.name = name; |
|||
this.value = value; |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.kms.yxgh.base.enums; |
|||
|
|||
import lombok.Getter; |
|||
|
|||
/** |
|||
* 监督检查问题状态 |
|||
* @author hry |
|||
* @date 2024/3/2 16:54 |
|||
*/ |
|||
@Getter |
|||
public enum SuperviseProblemStatus { |
|||
|
|||
DISTRIBUTE("下发", "0"), |
|||
HANDLE("处理", "1"), |
|||
CONFIRM("确认", "2"), |
|||
FINISH("完成", "3") |
|||
; |
|||
|
|||
private final String value; |
|||
private final String name; |
|||
|
|||
SuperviseProblemStatus(String name, String value) { |
|||
this.name = name; |
|||
this.value = value; |
|||
} |
|||
} |
@ -0,0 +1,177 @@ |
|||
package com.kms.yxgh.sz.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.kms.yxgh.base.Response; |
|||
import com.kms.yxgh.sz.domain.SzSuperviseWay; |
|||
import com.kms.yxgh.sz.dto.SzSuperviseWayProjectDto; |
|||
import com.kms.yxgh.sz.dto.SzSuperviseWayProjectItemDto; |
|||
import com.kms.yxgh.sz.dto.SzSuperviseWayDto; |
|||
import com.kms.yxgh.sz.dto.SzSuperviseWayOtherDto; |
|||
import com.kms.yxgh.sz.service.SzSuperviseWayService; |
|||
import com.shuili.common.annotation.Log; |
|||
import com.shuili.common.core.controller.BaseController; |
|||
import com.shuili.common.core.domain.SearchParam; |
|||
import com.shuili.common.enums.BusinessType; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.AllArgsConstructor; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 水闸监督检查办法 |
|||
* @author hry |
|||
* @date 2024/2/29 14:44 |
|||
*/ |
|||
@RestController |
|||
@AllArgsConstructor |
|||
@RequestMapping("/run/sz/superviseWay") |
|||
@Api(tags = "水闸监督检查办法") |
|||
public class SzSuperviseWayController extends BaseController { |
|||
|
|||
private final SzSuperviseWayService superviseWayService; |
|||
|
|||
/** |
|||
* 查询水闸监督检查办法列表 |
|||
*/ |
|||
@PostMapping("/list") |
|||
@ApiOperation("水闸监督检查办法列表") |
|||
public IPage<SzSuperviseWay> list(@RequestBody SearchParam<SzSuperviseWay> sp) { |
|||
return superviseWayService.selectPage(sp); |
|||
} |
|||
|
|||
/** |
|||
* 查询水闸监督检查办法详细信息 |
|||
*/ |
|||
@ApiOperation("水闸监督检查办法详细信息") |
|||
@GetMapping(value = "/{id}") |
|||
public Response<SzSuperviseWayDto> getInfo(@PathVariable("id") String id) { |
|||
return Response.ok(superviseWayService.getDetailById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增或修改 水闸监督检查办法 |
|||
*/ |
|||
@Log(title = "水闸监督检查办法新增或修改", businessType = BusinessType.INSERT) |
|||
@PostMapping |
|||
@ApiOperation("水闸监督检查办法新增或修改") |
|||
public Response<SzSuperviseWayDto> addOrModify(@RequestBody SzSuperviseWayDto superviseWayDto) { |
|||
return Response.ok(superviseWayService.addOrModify(superviseWayDto)); |
|||
} |
|||
|
|||
/** |
|||
* 复制水闸监督检查办法 |
|||
*/ |
|||
@ApiOperation("水闸监督检查办法复制") |
|||
@Log(title = "水闸监督检查办法复制", businessType = BusinessType.INSERT) |
|||
@PostMapping("/copy/{id}") |
|||
public Response<Boolean> copyInfo(@PathVariable String id) throws IOException { |
|||
return Response.ok(superviseWayService.copyInfo(id)); |
|||
} |
|||
|
|||
/** |
|||
* 根据监督检查办法id查询检查办法项目列表 |
|||
*/ |
|||
@GetMapping("/dataList/{id}") |
|||
@ApiOperation("查询检查办法项目列表") |
|||
public Response<List<SzSuperviseWayProjectDto>> dataList(@PathVariable("id") String jcId) { |
|||
return Response.ok(superviseWayService.listData(jcId)); |
|||
} |
|||
|
|||
/** |
|||
* 获取启用的水闸监督检查办法 |
|||
*/ |
|||
@GetMapping("/enable") |
|||
@ApiOperation("查询启用的水闸监督检查办法") |
|||
public Response<SzSuperviseWayOtherDto> enableData() { |
|||
return Response.ok(superviseWayService.getEnableSuperviseWay()); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 查询水闸监督检查项目 |
|||
*/ |
|||
@ApiOperation("水闸监督检查项目") |
|||
@GetMapping(value = "/data/{id}") |
|||
public Response<SzSuperviseWayProjectDto> getDataById(@PathVariable String id) { |
|||
return Response.ok(superviseWayService.getDataById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增水闸监督检查项目 |
|||
*/ |
|||
@ApiOperation("水闸监督检查办法项目新增") |
|||
@Log(title = "水闸监督检查办法项目新增", businessType = BusinessType.INSERT) |
|||
@PostMapping("/data/add") |
|||
public Response<SzSuperviseWayProjectDto> addData(@RequestBody SzSuperviseWayProjectDto dataDto) { |
|||
return Response.ok(superviseWayService.addData(dataDto)); |
|||
} |
|||
|
|||
/** |
|||
* 修改水闸监督检查项目 |
|||
*/ |
|||
@ApiOperation("水闸监督检查项目修改") |
|||
@Log(title = "水闸监督检查项目修改", businessType = BusinessType.UPDATE) |
|||
@PutMapping("/data/update") |
|||
public Response<SzSuperviseWayProjectDto> updateData(@RequestBody SzSuperviseWayProjectDto dto) { |
|||
return Response.ok(superviseWayService.updateData(dto)); |
|||
} |
|||
|
|||
/** |
|||
* 删除水闸监督检查项目 |
|||
*/ |
|||
@ApiOperation("水闸监督检查项目删除") |
|||
@Log(title = "水闸监督检查项目删除", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/data/{id}") |
|||
public Response<Boolean> removeByDataId(@PathVariable String id) { |
|||
return Response.ok(superviseWayService.deleteByDataId(id)); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 查询水闸监督检查项目内容列表 |
|||
*/ |
|||
@ApiOperation("水闸监督检查项目内容列表") |
|||
@PostMapping(value = "/dataItemList") |
|||
public Response<List<SzSuperviseWayProjectItemDto>> getDataItemList(@RequestBody SzSuperviseWayProjectItemDto dto) { |
|||
return Response.ok(superviseWayService.getDataItemList(dto)); |
|||
} |
|||
|
|||
/** |
|||
* 新增水闸监督检查项目内容 |
|||
*/ |
|||
@Log(title = "水闸监督检查项目内容新增", businessType = BusinessType.INSERT) |
|||
@PostMapping("/dataItem/add") |
|||
@ApiOperation("水闸监督检查项目内容新增") |
|||
public Response<SzSuperviseWayProjectItemDto> dataItemSave(@RequestBody SzSuperviseWayProjectItemDto dto) { |
|||
return Response.ok(superviseWayService.addDataItem(dto)); |
|||
} |
|||
|
|||
/** |
|||
* 修改水闸监督检查项目内容 |
|||
*/ |
|||
@ApiOperation("水闸监督检查项目内容修改") |
|||
@Log(title = "水闸监督检查项目内容修改", businessType = BusinessType.UPDATE) |
|||
@PutMapping("/dataItem/update") |
|||
public Response<SzSuperviseWayProjectItemDto> dataItemUpdate(@RequestBody SzSuperviseWayProjectItemDto dto) { |
|||
return Response.ok(superviseWayService.editDataItem(dto)); |
|||
} |
|||
|
|||
/** |
|||
* 删除水闸监督检查项目内容 |
|||
*/ |
|||
@ApiOperation("水闸监督检查项目内容删除") |
|||
@Log(title = "水闸监督检查项目内容删除", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/dataItem/{id}") |
|||
public Response<Boolean> remove(@PathVariable String id) { |
|||
return Response.ok(superviseWayService.deleteByDataItemId(id)); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.kms.yxgh.sz.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.kms.yxgh.base.SyBaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 水闸监督检查办法对象 bs_sgc_sz_jdjcbf |
|||
* @author hry |
|||
* @date 2024/2/29 13:57 |
|||
*/ |
|||
@TableName("bs_sgc_sz_jdjcbf") |
|||
@Data |
|||
@ApiModel("水闸监督检查办法") |
|||
public class SzSuperviseWay extends SyBaseEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
@ApiModelProperty("名称") |
|||
private String name; |
|||
|
|||
/** |
|||
* 状态 (0启用 1停用) |
|||
*/ |
|||
@ApiModelProperty(value = "状态") |
|||
private String status; |
|||
|
|||
/** |
|||
* 监督检查办法文件 |
|||
*/ |
|||
@ApiModelProperty(value = "监督检查办法文件") |
|||
private String superviseCheckWay; |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
package com.kms.yxgh.sz.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.kms.yxgh.base.SyBaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 水闸监督检查办法项目对象 bs_sgc_sz_jdjcbfxm |
|||
* @author hry |
|||
* @date 2024/2/29 13:57 |
|||
*/ |
|||
@TableName("bs_sgc_sz_jdjcbfxm") |
|||
@Data |
|||
@ApiModel("水闸监督检查办法项目") |
|||
public class SzSuperviseWayProject extends SyBaseEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
@ApiModelProperty("名称") |
|||
private String name; |
|||
|
|||
/** |
|||
* 监督检查办法ID |
|||
*/ |
|||
@ApiModelProperty("监督检查办法ID") |
|||
private String wayId; |
|||
|
|||
} |
@ -0,0 +1,52 @@ |
|||
package com.kms.yxgh.sz.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.kms.yxgh.base.SyBaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 水闸监督检查办法项目内容对象 bs_sgc_sz_jdjcbfxmnr |
|||
* @author hry |
|||
* @date 2024/2/29 13:57 |
|||
*/ |
|||
@TableName("bs_sgc_sz_jdjcbfxmnr") |
|||
@Data |
|||
@ApiModel("水闸监督检查办法项目内容") |
|||
public class SzSuperviseWayProjectItem extends SyBaseEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 监督检查办法项目ID |
|||
*/ |
|||
@ApiModelProperty("监督检查办法项目ID") |
|||
private String projectId; |
|||
|
|||
/** |
|||
* 检查内容 |
|||
*/ |
|||
@ApiModelProperty("检查内容") |
|||
private String content; |
|||
|
|||
/** |
|||
* 一般问题等级 |
|||
*/ |
|||
@ApiModelProperty("一般问题等级") |
|||
private String sameGrade; |
|||
|
|||
/** |
|||
* 较重问题等级 |
|||
*/ |
|||
@ApiModelProperty("较重问题等级") |
|||
private String heavyGrade; |
|||
|
|||
/** |
|||
* 严重问题等级 |
|||
*/ |
|||
@ApiModelProperty("严重问题等级") |
|||
private String seriousGrade; |
|||
|
|||
|
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.kms.yxgh.sz.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 水闸监督检查办法DTO对象 |
|||
* @author hry |
|||
* @date 2024/2/29 15:10 |
|||
*/ |
|||
@Data |
|||
@ApiModel("水闸监督检查办法") |
|||
public class SzSuperviseWayDto { |
|||
|
|||
@ApiModelProperty("主键") |
|||
private String id; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
@ApiModelProperty("名称") |
|||
private String name; |
|||
|
|||
/** |
|||
* 状态 (0启用 1停用) |
|||
*/ |
|||
@ApiModelProperty(value = "状态 (0启用 1停用)") |
|||
private String status; |
|||
|
|||
/** |
|||
* 监督检查办法文件 |
|||
*/ |
|||
@ApiModelProperty(value = "监督检查办法文件") |
|||
private String superviseCheckWay; |
|||
|
|||
} |
@ -0,0 +1,35 @@ |
|||
package com.kms.yxgh.sz.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author hry |
|||
* @date 2024/3/1 16:50 |
|||
*/ |
|||
@Data |
|||
@ApiModel("水闸监督检查办法Dto") |
|||
public class SzSuperviseWayOtherDto { |
|||
|
|||
/** |
|||
* 水闸监督检查办法id |
|||
*/ |
|||
@ApiModelProperty("水闸监督检查办法id") |
|||
private String id; |
|||
|
|||
/** |
|||
* 水闸监督检查办法名称 |
|||
*/ |
|||
@ApiModelProperty("水闸监督检查办法名称") |
|||
private String name; |
|||
|
|||
/** |
|||
* 水闸监督检查办法数据项内容列表 |
|||
*/ |
|||
@ApiModelProperty("水闸监督检查办法数据项内容列表") |
|||
private List<SzSuperviseWayProjectItemDto> itemList; |
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.kms.yxgh.sz.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 水闸监督检查办法项目TO对象 |
|||
* @author hry |
|||
* @date 2024/2/29 16:05 |
|||
*/ |
|||
@Data |
|||
@ApiModel("水闸监督检查办法项目") |
|||
public class SzSuperviseWayProjectDto { |
|||
|
|||
@ApiModelProperty("主键") |
|||
private String id; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
@ApiModelProperty("名称") |
|||
private String name; |
|||
|
|||
/** |
|||
* 监督检查办法ID |
|||
*/ |
|||
@ApiModelProperty("监督检查办法ID") |
|||
private String wayId; |
|||
} |
@ -0,0 +1,56 @@ |
|||
package com.kms.yxgh.sz.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 水闸监督检查办法项目内容DTO对象 |
|||
* @author hry |
|||
* @date 2024/2/29 13:57 |
|||
*/ |
|||
@Data |
|||
@ApiModel("水闸监督检查办法项目内容") |
|||
public class SzSuperviseWayProjectItemDto { |
|||
|
|||
@ApiModelProperty("主键") |
|||
private String id; |
|||
|
|||
/** |
|||
* 监督检查办法项目名称 |
|||
*/ |
|||
@ApiModelProperty("监督检查办法项目名称") |
|||
private String projectName; |
|||
|
|||
/** |
|||
* 监督检查办法项目ID |
|||
*/ |
|||
@ApiModelProperty("监督检查办法项目ID") |
|||
private String projectId; |
|||
|
|||
/** |
|||
* 检查内容 |
|||
*/ |
|||
@ApiModelProperty("检查内容") |
|||
private String content; |
|||
|
|||
/** |
|||
* 一般问题等级 |
|||
*/ |
|||
@ApiModelProperty("一般问题等级") |
|||
private String sameGrade; |
|||
|
|||
/** |
|||
* 较重问题等级 |
|||
*/ |
|||
@ApiModelProperty("较重问题等级") |
|||
private String heavyGrade; |
|||
|
|||
/** |
|||
* 严重问题等级 |
|||
*/ |
|||
@ApiModelProperty("严重问题等级") |
|||
private String seriousGrade; |
|||
|
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.kms.yxgh.sz.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.kms.yxgh.sz.domain.SzSuperviseWay; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
/** |
|||
* 水闸监督检查办法Mapper接口 |
|||
* |
|||
* @author hry |
|||
* @date 2024/2/29 14:44 |
|||
*/ |
|||
@Repository |
|||
public interface SzSuperviseWayMapper extends BaseMapper<SzSuperviseWay> { |
|||
|
|||
|
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.kms.yxgh.sz.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.kms.yxgh.sz.domain.SzSuperviseWayProjectItem; |
|||
import com.kms.yxgh.sz.dto.SzSuperviseWayProjectItemDto; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 水闸监督检查项目内容Mapper接口 |
|||
* |
|||
* @author hry |
|||
* @date 2024/2/29 14:44 |
|||
*/ |
|||
@Repository |
|||
public interface SzSuperviseWayProjectItemMapper extends BaseMapper<SzSuperviseWayProjectItem> { |
|||
/** |
|||
* 查询项目及内容列表 |
|||
* @param dto |
|||
* @return |
|||
*/ |
|||
@Select("<script>" + |
|||
"SELECT xm.name as projectName, nr.project_id as projectId, nr.id, nr.content, nr.same_grade as sameGrade, nr.heavy_grade as heavyGrade, nr.serious_grade as seriousGrade " + |
|||
"FROM bs_sgc_sz_jdjcbfxm xm " + |
|||
"LEFT JOIN bs_sgc_sz_jdjcbfxmnr nr ON xm.id = nr.project_id" + |
|||
"WHERE 1=1 " + |
|||
"<if test='dto.projectId != null and dto.projectId != \"\"'>" + |
|||
"AND xm.id = #{dto.projectId} " + |
|||
"</if>" + |
|||
"<if test='dto.id != null and dto.id != \"\"'>" + |
|||
"AND nr.id = #{dto.id} " + |
|||
"</if>" + |
|||
"ORDER BY xm.create_time DESC" + |
|||
"</script>") |
|||
List<SzSuperviseWayProjectItemDto> selectItemList(@Param("dto") SzSuperviseWayProjectItemDto dto); |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.kms.yxgh.sz.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.kms.yxgh.sz.domain.SzSuperviseWayProject; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
/** |
|||
* 水闸监督检查项目Mapper接口 |
|||
* |
|||
* @author hry |
|||
* @date 2024/2/29 14:44 |
|||
*/ |
|||
@Repository |
|||
public interface SzSuperviseWayProjectMapper extends BaseMapper<SzSuperviseWayProject> { |
|||
|
|||
|
|||
} |
@ -0,0 +1,207 @@ |
|||
package com.kms.yxgh.sz.service; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import com.kms.framework.config.ServerConfig; |
|||
import com.kms.yxgh.base.DfException; |
|||
import com.kms.yxgh.sz.domain.SzSuperviseWay; |
|||
import com.kms.yxgh.sz.domain.SzSuperviseWayProject; |
|||
import com.kms.yxgh.sz.domain.SzSuperviseWayProjectItem; |
|||
import com.kms.yxgh.sz.dto.SzSuperviseWayDto; |
|||
import com.kms.yxgh.sz.dto.SzSuperviseWayOtherDto; |
|||
import com.kms.yxgh.sz.dto.SzSuperviseWayProjectDto; |
|||
import com.kms.yxgh.sz.dto.SzSuperviseWayProjectItemDto; |
|||
import com.kms.yxgh.sz.mapper.SzSuperviseWayMapper; |
|||
import com.kms.yxgh.sz.mapper.SzSuperviseWayProjectItemMapper; |
|||
import com.kms.yxgh.sz.mapper.SzSuperviseWayProjectMapper; |
|||
import com.kms.yxgh.util.BeanCopyUtils; |
|||
import com.shuili.common.config.ShuiliConfig; |
|||
import com.shuili.common.core.domain.AjaxResult; |
|||
import com.shuili.common.core.service.BaseService; |
|||
import com.shuili.common.utils.FastDfsUtil; |
|||
import com.shuili.common.utils.FileUploadUtils; |
|||
import com.shuili.common.utils.file.FileUtils; |
|||
import lombok.AllArgsConstructor; |
|||
import org.apache.commons.fileupload.FileItem; |
|||
import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
|||
import org.apache.commons.io.IOUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
import org.springframework.web.multipart.commons.CommonsMultipartFile; |
|||
|
|||
import java.io.*; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 水闸监督检查办法实现类 |
|||
* |
|||
* @author hry |
|||
* @date 2024/2/29 14:46 |
|||
*/ |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class SzSuperviseWayService extends BaseService<SzSuperviseWayMapper, SzSuperviseWay> { |
|||
|
|||
private final SzSuperviseWayProjectMapper wayProjectService; |
|||
private final SzSuperviseWayProjectItemMapper projectItemMapper; |
|||
private final ServerConfig serverConfig; |
|||
private final FastDfsUtil fastDfsUtil; |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public SzSuperviseWayDto addOrModify(SzSuperviseWayDto dto) { |
|||
if (ObjectUtil.isNotNull(dto.getId()) && !exist(dto.getId())) { |
|||
throw new DfException("源数据不存在,请确认id值是否正确"); |
|||
} |
|||
SzSuperviseWay superviseWay = BeanCopyUtils.copy(dto, SzSuperviseWay.class); |
|||
this.saveOrUpdate(superviseWay); |
|||
return BeanCopyUtils.copy(superviseWay, SzSuperviseWayDto.class); |
|||
} |
|||
|
|||
public SzSuperviseWayDto getDetailById(String id) { |
|||
SzSuperviseWay superviseWay = this.getById(id); |
|||
return BeanCopyUtils.copy(superviseWay, SzSuperviseWayDto.class); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Boolean copyInfo(String id) throws IOException { |
|||
// 1.1 查询监督检查办法对象
|
|||
SzSuperviseWay superviseWay = this.getById(id); |
|||
SzSuperviseWay superviseWayNew = BeanCopyUtils.copy(superviseWay, SzSuperviseWay.class); |
|||
|
|||
// todo 1.2 复制文件
|
|||
|
|||
// 1.3 查询水闸监督检查办法项目
|
|||
List<SzSuperviseWayProjectDto> projectList = listData(superviseWay.getId()); |
|||
if (projectList.isEmpty()){ |
|||
return true; |
|||
} |
|||
List<SzSuperviseWayProject> list = BeanCopyUtils.copyList(projectList, SzSuperviseWayProject.class); |
|||
list.forEach(v->{ |
|||
List<SzSuperviseWayProjectItem> listItem = projectItemMapper.selectList( |
|||
Wrappers.<SzSuperviseWayProjectItem>lambdaQuery().eq(SzSuperviseWayProjectItem::getProjectId, v.getId())); |
|||
|
|||
// 新增项目
|
|||
v.setId(null); |
|||
v.setWayId(superviseWayNew.getId()); |
|||
wayProjectService.insert(v); |
|||
|
|||
// 1.4 新增水闸监督检查办法项目内容
|
|||
if(!listItem.isEmpty()){ |
|||
listItem.forEach(val->{ |
|||
val.setId(null); |
|||
val.setProjectId(v.getId()); |
|||
projectItemMapper.insert(val); |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
|
|||
private boolean exist(String id) { |
|||
Wrapper<SzSuperviseWay> wp = Wrappers.<SzSuperviseWay>lambdaQuery() |
|||
.eq(SzSuperviseWay::getId, id); |
|||
return this.getBaseMapper().selectCount(wp) > 0; |
|||
} |
|||
|
|||
|
|||
public SzSuperviseWayProjectDto getDataById(String dataId) { |
|||
SzSuperviseWayProject superviseWayData = wayProjectService.selectById(dataId); |
|||
return BeanCopyUtils.copy(superviseWayData, SzSuperviseWayProjectDto.class); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public SzSuperviseWayProjectDto addData(SzSuperviseWayProjectDto dataDto) { |
|||
SzSuperviseWayProject superviseWayData = BeanCopyUtils.copy(dataDto, SzSuperviseWayProject.class); |
|||
wayProjectService.insert(BeanCopyUtils.copy(dataDto, superviseWayData)); |
|||
return BeanCopyUtils.copy(superviseWayData, SzSuperviseWayProjectDto.class); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public SzSuperviseWayProjectDto updateData(SzSuperviseWayProjectDto dataDto) { |
|||
SzSuperviseWayProject dataEntity = BeanCopyUtils.copy(dataDto, SzSuperviseWayProject.class); |
|||
wayProjectService.updateById(dataEntity); |
|||
return dataDto; |
|||
} |
|||
|
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public boolean deleteByDataId(String id) { |
|||
wayProjectService.deleteById(id); |
|||
return true; |
|||
} |
|||
|
|||
public List<SzSuperviseWayProjectDto> listData(String wayId) { |
|||
List<SzSuperviseWayProject> list = wayProjectService.selectList( |
|||
Wrappers.<SzSuperviseWayProject>lambdaQuery().eq(SzSuperviseWayProject::getWayId, wayId)); |
|||
return BeanCopyUtils.copyList(list, SzSuperviseWayProjectDto.class); |
|||
} |
|||
|
|||
public List<SzSuperviseWayProjectItemDto> getDataItemList(SzSuperviseWayProjectItemDto dto) { |
|||
// 条件查询监督检查项目内容信息
|
|||
LambdaQueryWrapper<SzSuperviseWayProjectItem> queryWrapper = new LambdaQueryWrapper<>(); |
|||
if (StringUtils.isNotBlank(dto.getProjectId())) { |
|||
queryWrapper.eq(SzSuperviseWayProjectItem::getProjectId, dto.getProjectId()); |
|||
} |
|||
if (StringUtils.isNotBlank(dto.getContent())) { |
|||
queryWrapper.like(SzSuperviseWayProjectItem::getContent, dto.getContent()); |
|||
} |
|||
List<SzSuperviseWayProjectItem> listData = projectItemMapper.selectList(queryWrapper); |
|||
return listData.stream().map(item -> BeanCopyUtils.copy(item, SzSuperviseWayProjectItemDto.class)).collect(Collectors.toList()); |
|||
} |
|||
|
|||
public SzSuperviseWayProjectItemDto getDataItemById(String id) { |
|||
SzSuperviseWayProjectItem projectItem = projectItemMapper.selectById(id); |
|||
return BeanCopyUtils.copy(projectItem, SzSuperviseWayProjectItemDto.class); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public SzSuperviseWayProjectItemDto addDataItem(SzSuperviseWayProjectItemDto dto) { |
|||
SzSuperviseWayProjectItem itemEntity = BeanCopyUtils.copy(dto, SzSuperviseWayProjectItem.class); |
|||
projectItemMapper.insert(itemEntity); |
|||
return BeanCopyUtils.copy(itemEntity, SzSuperviseWayProjectItemDto.class); |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public SzSuperviseWayProjectItemDto editDataItem(SzSuperviseWayProjectItemDto dto) { |
|||
SzSuperviseWayProjectItem itemEntity = BeanCopyUtils.copy(dto, SzSuperviseWayProjectItem.class); |
|||
projectItemMapper.updateById(itemEntity); |
|||
return dto; |
|||
} |
|||
|
|||
@Transactional(rollbackFor = Exception.class) |
|||
public boolean deleteByDataItemId(String id) { |
|||
projectItemMapper.deleteById(id); |
|||
return true; |
|||
} |
|||
|
|||
|
|||
public SzSuperviseWayOtherDto getEnableSuperviseWay() { |
|||
SzSuperviseWayOtherDto superviseWayOtherDto = new SzSuperviseWayOtherDto(); |
|||
// 1.1 查询启用的水闸监督检查办法
|
|||
SzSuperviseWay enable = this.getOne(Wrappers.<SzSuperviseWay>lambdaQuery().eq(SzSuperviseWay::getStatus, "0")); |
|||
if (enable == null) { |
|||
return superviseWayOtherDto; |
|||
} |
|||
superviseWayOtherDto.setId(enable.getId()); |
|||
superviseWayOtherDto.setName(enable.getName()); |
|||
// 1.2 查询关联的水闸监督检查办法项目
|
|||
List<String> ids = listData(enable.getId()).stream().map(SzSuperviseWayProjectDto::getId).collect(Collectors.toList()); |
|||
if (!ids.isEmpty()) { |
|||
// 1.3 查询项目内容
|
|||
Wrapper<SzSuperviseWayProjectItem> wp = Wrappers.<SzSuperviseWayProjectItem>lambdaQuery().in(SzSuperviseWayProjectItem::getProjectId, ids); |
|||
superviseWayOtherDto.setItemList(projectItemMapper.selectList(wp) |
|||
.stream() |
|||
.map(item -> BeanCopyUtils.copy(item, SzSuperviseWayProjectItemDto.class)) |
|||
.collect(Collectors.toList())); |
|||
} |
|||
return superviseWayOtherDto; |
|||
} |
|||
} |
Loading…
Reference in new issue