From 6df541459477d7c6fb4d63f82c3558c975ddc19e Mon Sep 17 00:00:00 2001 From: songhuangfeng123 <shf18767906695@163.com> Date: 星期四, 14 七月 2022 14:41:29 +0800 Subject: [PATCH] 应急物资检查 --- emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/repository/EmergencySuppliesInspectInfoRepository.java | 26 + emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectInfo.java | 111 +++++ emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/req/EmergencySuppliesInspectUserReqDTO.java | 43 + emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencyDrillPlanServiceImpl.java | 4 emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/enums/EmergencyResultCodes.java | 5 emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/query/EmergencySuppliesInspectQuery.java | 14 emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectInfoDetailDO.java | 61 ++ emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/EmergencySuppliesInspectService.java | 24 + emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/EmergencySuppliesInspectUserInfoService.java | 19 emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencySuppliesInspectPageRespDTO.java | 59 ++ emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencySuppliesInspectDetailRespDTO.java | 71 +++ emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/repository/EmergencySuppliesInspectUserInfoRepository.java | 22 + emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectUserInfo.java | 101 ++++ emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/impl/EmergencySuppliesInspectUserInfoServiceImpl.java | 40 + emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/controller/EmergencySuppliesInspectController.java | 66 +++ emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/req/EmergencySuppliesInspectReqDTO.java | 58 ++ emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/EmergencySuppliesInspectInfoService.java | 24 + emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/query/db/EmergencySuppliesInspectDBQuery.java | 14 emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencySuppliesInspectServiceImpl.java | 222 ++++++++++ emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/impl/EmergencySuppliesInspectInfoServiceImpl.java | 48 ++ emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencySuppliesInspectUserRespDTO.java | 44 ++ emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencySuppliesInspectUserInfoMapper.xml | 52 ++ emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectInfoPageDO.java | 61 ++ emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectUserInfoDO.java | 51 ++ emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencySuppliesInspectInfoMapper.xml | 73 +++ 25 files changed, 1,311 insertions(+), 2 deletions(-) diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/controller/EmergencySuppliesInspectController.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/controller/EmergencySuppliesInspectController.java new file mode 100644 index 0000000..07ccce4 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/controller/EmergencySuppliesInspectController.java @@ -0,0 +1,66 @@ +package com.gkhy.safePlatform.emergency.controller; + +import com.gkhy.safePlatform.commons.query.PageQuery; +import com.gkhy.safePlatform.commons.utils.PageUtils; +import com.gkhy.safePlatform.commons.vo.ResultVO; +import com.gkhy.safePlatform.emergency.model.dto.req.EmergencySuppliesInspectReqDTO; +import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencySuppliesInspectDetailRespDTO; +import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencySuppliesInspectPageRespDTO; +import com.gkhy.safePlatform.emergency.query.EmergencySuppliesInspectQuery; +import com.gkhy.safePlatform.emergency.service.EmergencySuppliesInspectService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.security.Principal; +import java.util.List; + +@RestController +@RequestMapping("/emergencySuppliesInspect") +public class EmergencySuppliesInspectController { + + @Autowired + private EmergencySuppliesInspectService emergencySuppliesInspectService; + + /** + * 应急物资检查列表 + */ + @RequestMapping(value = "/page/list" ,method = RequestMethod.POST) + private ResultVO<List<EmergencySuppliesInspectPageRespDTO>> list (@RequestBody PageQuery<EmergencySuppliesInspectQuery> pageQuery){ + PageUtils.checkCheck(pageQuery.getPageIndex(), pageQuery.getPageSize()); + return emergencySuppliesInspectService.selectEmergencySuppliesInspectList(pageQuery); + } + + /** + * 应急物资检查新增 + */ + @RequestMapping(value = "/add",method = RequestMethod.POST) + public ResultVO addEmergencySuppliesInspect(Principal principal, @RequestBody EmergencySuppliesInspectReqDTO emergencySuppliesInspectReqDTO) { + String uid = principal.getName(); + return emergencySuppliesInspectService.addEmergencySuppliesInspect(Long.valueOf(uid), emergencySuppliesInspectReqDTO); + } + + /** + * 应急物资检查详情 + */ + @RequestMapping(value = "/info/{id}",method = RequestMethod.GET) + public ResultVO<EmergencySuppliesInspectDetailRespDTO> getEmergencySuppliesInspectById(@PathVariable("id")Long id){ + return emergencySuppliesInspectService.getEmergencySuppliesInspectById(id); + } + + /** + * 应急物资检查修改 + */ + @RequestMapping(value = "/update",method = RequestMethod.POST) + public ResultVO updateEmergencySuppliesInspect(Principal principal, @RequestBody EmergencySuppliesInspectReqDTO emergencySuppliesInspectReqDTO) { + String uid = principal.getName(); + return emergencySuppliesInspectService.updateEmergencySuppliesInspect(Long.valueOf(uid), emergencySuppliesInspectReqDTO); + } + + /** + * 应急物资检查删除/批量删除 + */ + @RequestMapping(value = "/batchDelete/{ids}",method = RequestMethod.GET) + public ResultVO batchDeleteEmergencySuppliesInspect(@PathVariable("ids")String ids){ + return emergencySuppliesInspectService.batchDeleteEmergencySuppliesInspect(ids); + } +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectInfo.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectInfo.java new file mode 100644 index 0000000..37d9659 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectInfo.java @@ -0,0 +1,111 @@ +package com.gkhy.safePlatform.emergency.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.Date; + +@TableName("emergency_supplies_inspect") +public class EmergencySuppliesInspectInfo { + + @TableId(type = IdType.AUTO) + private Long id; + private Boolean delFlag; + private Date gmtCreate; + private Date gmtModitify; + private Long createUid; + private Long updateUid; + + private Long suppliesId; + private String inspectResult; + private Date inspectTime; + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Boolean getDelFlag() { + return delFlag; + } + + public void setDelFlag(Boolean delFlag) { + this.delFlag = delFlag; + } + + public Date getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public Date getGmtModitify() { + return gmtModitify; + } + + public void setGmtModitify(Date gmtModitify) { + this.gmtModitify = gmtModitify; + } + + public Long getCreateUid() { + return createUid; + } + + public void setCreateUid(Long createUid) { + this.createUid = createUid; + } + + public Long getUpdateUid() { + return updateUid; + } + + public void setUpdateUid(Long updateUid) { + this.updateUid = updateUid; + } + + public Long getSuppliesId() { + return suppliesId; + } + + public void setSuppliesId(Long suppliesId) { + this.suppliesId = suppliesId; + } + + public String getInspectResult() { + return inspectResult; + } + + public void setInspectResult(String inspectResult) { + this.inspectResult = inspectResult; + } + + public Date getInspectTime() { + return inspectTime; + } + + public void setInspectTime(Date inspectTime) { + this.inspectTime = inspectTime; + } + + @Override + public String toString() { + return "EmergencySuppliesInspectInfo{" + + "id=" + id + + ", delFlag=" + delFlag + + ", gmtCreate=" + gmtCreate + + ", gmtModitify=" + gmtModitify + + ", createUid=" + createUid + + ", updateUid=" + updateUid + + ", suppliesId=" + suppliesId + + ", inspectResult='" + inspectResult + '\'' + + ", inspectTime=" + inspectTime + + '}'; + } +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectInfoDetailDO.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectInfoDetailDO.java new file mode 100644 index 0000000..bbe7396 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectInfoDetailDO.java @@ -0,0 +1,61 @@ +package com.gkhy.safePlatform.emergency.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.Date; + +@TableName("emergency_supplies_inspect") +public class EmergencySuppliesInspectInfoDetailDO { + + @TableId(type = IdType.AUTO) + private Long id; + + private Long suppliesId; + private String inspectResult; + private Date inspectTime; + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getSuppliesId() { + return suppliesId; + } + + public void setSuppliesId(Long suppliesId) { + this.suppliesId = suppliesId; + } + + public String getInspectResult() { + return inspectResult; + } + + public void setInspectResult(String inspectResult) { + this.inspectResult = inspectResult; + } + + public Date getInspectTime() { + return inspectTime; + } + + public void setInspectTime(Date inspectTime) { + this.inspectTime = inspectTime; + } + + @Override + public String toString() { + return "EmergencySuppliesInspectInfo{" + + "id=" + id + + ", suppliesId=" + suppliesId + + ", inspectResult='" + inspectResult + '\'' + + ", inspectTime=" + inspectTime + + '}'; + } +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectInfoPageDO.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectInfoPageDO.java new file mode 100644 index 0000000..4d5b50b --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectInfoPageDO.java @@ -0,0 +1,61 @@ +package com.gkhy.safePlatform.emergency.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.Date; + +@TableName("emergency_supplies_inspect") +public class EmergencySuppliesInspectInfoPageDO { + + @TableId(type = IdType.AUTO) + private Long id; + + private Long suppliesId; + private String inspectResult; + private Date inspectTime; + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getSuppliesId() { + return suppliesId; + } + + public void setSuppliesId(Long suppliesId) { + this.suppliesId = suppliesId; + } + + public String getInspectResult() { + return inspectResult; + } + + public void setInspectResult(String inspectResult) { + this.inspectResult = inspectResult; + } + + public Date getInspectTime() { + return inspectTime; + } + + public void setInspectTime(Date inspectTime) { + this.inspectTime = inspectTime; + } + + @Override + public String toString() { + return "EmergencySuppliesInspectInfo{" + + "id=" + id + + ", suppliesId=" + suppliesId + + ", inspectResult='" + inspectResult + '\'' + + ", inspectTime=" + inspectTime + + '}'; + } +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectUserInfo.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectUserInfo.java new file mode 100644 index 0000000..b6de476 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectUserInfo.java @@ -0,0 +1,101 @@ +package com.gkhy.safePlatform.emergency.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.Date; + +@TableName("emergency_supplies_inspect") +public class EmergencySuppliesInspectUserInfo { + + @TableId(type = IdType.AUTO) + private Long id; + private Boolean delFlag; + private Date gmtCreate; + private Date gmtModitify; + private Long createUid; + private Long updateUid; + + private Long inspectId; + private Long userUid; + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Boolean getDelFlag() { + return delFlag; + } + + public void setDelFlag(Boolean delFlag) { + this.delFlag = delFlag; + } + + public Date getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public Date getGmtModitify() { + return gmtModitify; + } + + public void setGmtModitify(Date gmtModitify) { + this.gmtModitify = gmtModitify; + } + + public Long getCreateUid() { + return createUid; + } + + public void setCreateUid(Long createUid) { + this.createUid = createUid; + } + + public Long getUpdateUid() { + return updateUid; + } + + public void setUpdateUid(Long updateUid) { + this.updateUid = updateUid; + } + + public Long getInspectId() { + return inspectId; + } + + public void setInspectId(Long inspectId) { + this.inspectId = inspectId; + } + + public Long getUserUid() { + return userUid; + } + + public void setUserUid(Long userUid) { + this.userUid = userUid; + } + + @Override + public String toString() { + return "EmergencySuppliesInspectUserInfo{" + + "id=" + id + + ", delFlag=" + delFlag + + ", gmtCreate=" + gmtCreate + + ", gmtModitify=" + gmtModitify + + ", createUid=" + createUid + + ", updateUid=" + updateUid + + ", inspectId=" + inspectId + + ", userUid='" + userUid + '\'' + + '}'; + } +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectUserInfoDO.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectUserInfoDO.java new file mode 100644 index 0000000..adc5c98 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/entity/EmergencySuppliesInspectUserInfoDO.java @@ -0,0 +1,51 @@ +package com.gkhy.safePlatform.emergency.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.Date; + +@TableName("emergency_supplies_inspect") +public class EmergencySuppliesInspectUserInfoDO { + + @TableId(type = IdType.AUTO) + private Long id; + + private Long inspectId; + private Long userUid; + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getInspectId() { + return inspectId; + } + + public void setInspectId(Long inspectId) { + this.inspectId = inspectId; + } + + public Long getUserUid() { + return userUid; + } + + public void setUserUid(Long userUid) { + this.userUid = userUid; + } + + @Override + public String toString() { + return "EmergencySuppliesInspectUserInfo{" + + "id=" + id + + ", inspectId=" + inspectId + + ", userUid='" + userUid + '\'' + + '}'; + } +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/enums/EmergencyResultCodes.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/enums/EmergencyResultCodes.java index dbffa12..e4202f4 100644 --- a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/enums/EmergencyResultCodes.java +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/enums/EmergencyResultCodes.java @@ -52,6 +52,11 @@ SUPPLIES_NOT_EXIST("S1002" , "应急物资不存在"), + SUPPLIES_INSPECT_NULL("S1003" , "应急物资检查不可为空"), + + SUPPLIES_INSPECT_NOT_EXIST("S1004" , "应急物资检查不存在"), + + ERROR("A3000", "未知错误"); private String code; diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/req/EmergencySuppliesInspectReqDTO.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/req/EmergencySuppliesInspectReqDTO.java new file mode 100644 index 0000000..ab4a3d1 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/req/EmergencySuppliesInspectReqDTO.java @@ -0,0 +1,58 @@ +package com.gkhy.safePlatform.emergency.model.dto.req; + + + +import java.util.Date; +import java.util.List; + +public class EmergencySuppliesInspectReqDTO { + + private Long id; + + private Long suppliesId; + private String inspectResult; + private Date inspectTime; + + private List<EmergencySuppliesInspectUserReqDTO> userList; + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getSuppliesId() { + return suppliesId; + } + + public void setSuppliesId(Long suppliesId) { + this.suppliesId = suppliesId; + } + + public String getInspectResult() { + return inspectResult; + } + + public void setInspectResult(String inspectResult) { + this.inspectResult = inspectResult; + } + + public Date getInspectTime() { + return inspectTime; + } + + public void setInspectTime(Date inspectTime) { + this.inspectTime = inspectTime; + } + + public List<EmergencySuppliesInspectUserReqDTO> getUserList() { + return userList; + } + + public void setUserList(List<EmergencySuppliesInspectUserReqDTO> userList) { + this.userList = userList; + } +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/req/EmergencySuppliesInspectUserReqDTO.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/req/EmergencySuppliesInspectUserReqDTO.java new file mode 100644 index 0000000..1506da0 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/req/EmergencySuppliesInspectUserReqDTO.java @@ -0,0 +1,43 @@ +package com.gkhy.safePlatform.emergency.model.dto.req; + + +public class EmergencySuppliesInspectUserReqDTO { + + private Long id; + + private Long inspectId; + private Long userUid; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getInspectId() { + return inspectId; + } + + public void setInspectId(Long inspectId) { + this.inspectId = inspectId; + } + + public Long getUserUid() { + return userUid; + } + + public void setUserUid(Long userUid) { + this.userUid = userUid; + } + + @Override + public String toString() { + return "EmergencySuppliesInspectUserReqDTO{" + + "id=" + id + + ", inspectId=" + inspectId + + ", userUid=" + userUid + + '}'; + } +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencySuppliesInspectDetailRespDTO.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencySuppliesInspectDetailRespDTO.java new file mode 100644 index 0000000..d87a04c --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencySuppliesInspectDetailRespDTO.java @@ -0,0 +1,71 @@ +package com.gkhy.safePlatform.emergency.model.dto.resp; + + + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.util.Date; +import java.util.List; + +public class EmergencySuppliesInspectDetailRespDTO { + + private Long id; + + private Long suppliesId; + private String inspectResult; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date inspectTime; + + private List<EmergencySuppliesInspectUserRespDTO> userList; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getSuppliesId() { + return suppliesId; + } + + public void setSuppliesId(Long suppliesId) { + this.suppliesId = suppliesId; + } + + public String getInspectResult() { + return inspectResult; + } + + public void setInspectResult(String inspectResult) { + this.inspectResult = inspectResult; + } + + public Date getInspectTime() { + return inspectTime; + } + + public void setInspectTime(Date inspectTime) { + this.inspectTime = inspectTime; + } + + public List<EmergencySuppliesInspectUserRespDTO> getUserList() { + return userList; + } + + public void setUserList(List<EmergencySuppliesInspectUserRespDTO> userList) { + this.userList = userList; + } + + @Override + public String toString() { + return "EmergencySuppliesInspectDetailRespDTO{" + + "id=" + id + + ", suppliesId=" + suppliesId + + ", inspectResult='" + inspectResult + '\'' + + ", inspectTime=" + inspectTime + + ", userList=" + userList + + '}'; + } +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencySuppliesInspectPageRespDTO.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencySuppliesInspectPageRespDTO.java new file mode 100644 index 0000000..ed6da8f --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencySuppliesInspectPageRespDTO.java @@ -0,0 +1,59 @@ +package com.gkhy.safePlatform.emergency.model.dto.resp; + + + +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.util.Date; + +public class EmergencySuppliesInspectPageRespDTO { + + private Long id; + + private Long suppliesId; + private String inspectResult; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date inspectTime; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getSuppliesId() { + return suppliesId; + } + + public void setSuppliesId(Long suppliesId) { + this.suppliesId = suppliesId; + } + + public String getInspectResult() { + return inspectResult; + } + + public void setInspectResult(String inspectResult) { + this.inspectResult = inspectResult; + } + + public Date getInspectTime() { + return inspectTime; + } + + public void setInspectTime(Date inspectTime) { + this.inspectTime = inspectTime; + } + + @Override + public String toString() { + return "EmergencySuppliesInspectPageRespDTO{" + + "id=" + id + + ", suppliesId=" + suppliesId + + ", inspectResult='" + inspectResult + '\'' + + ", inspectTime=" + inspectTime + + '}'; + } +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencySuppliesInspectUserRespDTO.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencySuppliesInspectUserRespDTO.java new file mode 100644 index 0000000..a964788 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencySuppliesInspectUserRespDTO.java @@ -0,0 +1,44 @@ +package com.gkhy.safePlatform.emergency.model.dto.resp; + +import java.util.Date; + +public class EmergencySuppliesInspectUserRespDTO { + + private Long id; + + private Long inspectId; + private Long userUid; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getInspectId() { + return inspectId; + } + + public void setInspectId(Long inspectId) { + this.inspectId = inspectId; + } + + public Long getUserUid() { + return userUid; + } + + public void setUserUid(Long userUid) { + this.userUid = userUid; + } + + @Override + public String toString() { + return "EmergencySuppliesInspectUserRespDTO{" + + "id=" + id + + ", inspectId=" + inspectId + + ", userUid=" + userUid + + '}'; + } +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/query/EmergencySuppliesInspectQuery.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/query/EmergencySuppliesInspectQuery.java new file mode 100644 index 0000000..f50e583 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/query/EmergencySuppliesInspectQuery.java @@ -0,0 +1,14 @@ +package com.gkhy.safePlatform.emergency.query; + +public class EmergencySuppliesInspectQuery { + + private Long suppliesId ; + + public Long getSuppliesId() { + return suppliesId; + } + + public void setSuppliesId(Long suppliesId) { + this.suppliesId = suppliesId; + } +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/query/db/EmergencySuppliesInspectDBQuery.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/query/db/EmergencySuppliesInspectDBQuery.java new file mode 100644 index 0000000..ad21e99 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/query/db/EmergencySuppliesInspectDBQuery.java @@ -0,0 +1,14 @@ +package com.gkhy.safePlatform.emergency.query.db; + +public class EmergencySuppliesInspectDBQuery { + + private Long suppliesId ; + + public Long getSuppliesId() { + return suppliesId; + } + + public void setSuppliesId(Long suppliesId) { + this.suppliesId = suppliesId; + } +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/repository/EmergencySuppliesInspectInfoRepository.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/repository/EmergencySuppliesInspectInfoRepository.java new file mode 100644 index 0000000..5c104d5 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/repository/EmergencySuppliesInspectInfoRepository.java @@ -0,0 +1,26 @@ +package com.gkhy.safePlatform.emergency.repository; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectInfo; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectInfoDetailDO; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectInfoPageDO; +import com.gkhy.safePlatform.emergency.query.db.EmergencySuppliesInspectDBQuery; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface EmergencySuppliesInspectInfoRepository extends BaseMapper<EmergencySuppliesInspectInfo> { + + List<EmergencySuppliesInspectInfoPageDO> selectEmergencySuppliesInspectList(Page<EmergencySuppliesInspectInfoPageDO> page, @Param("query") EmergencySuppliesInspectDBQuery emergencySuppliesInspectDBQuery); + + void addEmergencySuppliesInspect(EmergencySuppliesInspectInfo emergencySuppliesInspectInfo); + + EmergencySuppliesInspectInfoDetailDO selectEmergencySuppliesInspectById(@Param("id") Long id); + + void updateEmergencySuppliesInspect(EmergencySuppliesInspectInfo emergencySuppliesInspectInfo); + + void deleteEmergencySuppliesInspect(@Param("id") Long id); +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/repository/EmergencySuppliesInspectUserInfoRepository.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/repository/EmergencySuppliesInspectUserInfoRepository.java new file mode 100644 index 0000000..63d65bd --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/repository/EmergencySuppliesInspectUserInfoRepository.java @@ -0,0 +1,22 @@ +package com.gkhy.safePlatform.emergency.repository; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectUserInfo; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectUserInfoDO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + + +@Repository +public interface EmergencySuppliesInspectUserInfoRepository extends BaseMapper<EmergencySuppliesInspectUserInfo> { + + void addEmergencySuppliesInspectUser(EmergencySuppliesInspectUserInfo emergencySuppliesInspectUserInfo); + + List<EmergencySuppliesInspectUserInfoDO> selectEmergencySuppliesInspectUserBySuppliesInspectId(@Param("suppliesInspectId") Long suppliesInspectId); + + void deleteEmergencySuppliesInspectUserByIds(List<Long> ids); + + void deleteEmergencySuppliesInspectUserBySuppliesInspectId(@Param("suppliesInspectId") Long suppliesInspectId); +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/EmergencySuppliesInspectService.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/EmergencySuppliesInspectService.java new file mode 100644 index 0000000..0b6d08a --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/EmergencySuppliesInspectService.java @@ -0,0 +1,24 @@ +package com.gkhy.safePlatform.emergency.service; + +import com.gkhy.safePlatform.commons.query.PageQuery; +import com.gkhy.safePlatform.commons.vo.ResultVO; +import com.gkhy.safePlatform.commons.vo.SearchResultVO; +import com.gkhy.safePlatform.emergency.model.dto.req.EmergencySuppliesInspectReqDTO; +import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencySuppliesInspectDetailRespDTO; +import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencySuppliesInspectPageRespDTO; +import com.gkhy.safePlatform.emergency.query.EmergencySuppliesInspectQuery; + +import java.util.List; + +public interface EmergencySuppliesInspectService { + + SearchResultVO<List<EmergencySuppliesInspectPageRespDTO>> selectEmergencySuppliesInspectList(PageQuery<EmergencySuppliesInspectQuery> query); + + ResultVO addEmergencySuppliesInspect(Long uid, EmergencySuppliesInspectReqDTO emergencySuppliesInspectReqDTO); + + ResultVO<EmergencySuppliesInspectDetailRespDTO> getEmergencySuppliesInspectById(Long id); + + ResultVO updateEmergencySuppliesInspect(Long uid, EmergencySuppliesInspectReqDTO emergencySuppliesInspectReqDTO); + + ResultVO batchDeleteEmergencySuppliesInspect(String ids); +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/EmergencySuppliesInspectInfoService.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/EmergencySuppliesInspectInfoService.java new file mode 100644 index 0000000..1d3fc39 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/EmergencySuppliesInspectInfoService.java @@ -0,0 +1,24 @@ +package com.gkhy.safePlatform.emergency.service.baseService; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectInfo; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectInfoDetailDO; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectInfoPageDO; +import com.gkhy.safePlatform.emergency.query.db.EmergencySuppliesInspectDBQuery; + +import java.util.List; + + +public interface EmergencySuppliesInspectInfoService extends IService<EmergencySuppliesInspectInfo> { + + List<EmergencySuppliesInspectInfoPageDO> selectEmergencySuppliesInspectList(Page<EmergencySuppliesInspectInfoPageDO> page, EmergencySuppliesInspectDBQuery emergencySuppliesInspectDBQuery); + + void addEmergencySuppliesInspect(EmergencySuppliesInspectInfo emergencySuppliesInspectInfo); + + EmergencySuppliesInspectInfoDetailDO selectEmergencySuppliesInspectById(Long id); + + void updateEmergencySuppliesInspect(EmergencySuppliesInspectInfo emergencySuppliesInspectInfo); + + void deleteEmergencySuppliesInspect(Long SuppliesInspectId); +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/EmergencySuppliesInspectUserInfoService.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/EmergencySuppliesInspectUserInfoService.java new file mode 100644 index 0000000..c5c2575 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/EmergencySuppliesInspectUserInfoService.java @@ -0,0 +1,19 @@ +package com.gkhy.safePlatform.emergency.service.baseService; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectUserInfo; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectUserInfoDO; + +import java.util.List; + + +public interface EmergencySuppliesInspectUserInfoService extends IService<EmergencySuppliesInspectUserInfo> { + + void addEmergencySuppliesInspectUser(EmergencySuppliesInspectUserInfo emergencySuppliesInspectUserInfo); + + List<EmergencySuppliesInspectUserInfoDO> selectEmergencySuppliesInspectUserBySuppliesInspectId(Long id); + + void deleteEmergencySuppliesInspectUserByIds(List<Long> deleteList); + + void deleteEmergencySuppliesInspectUserBySuppliesInspectId(Long suppliesInspectId); +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/impl/EmergencySuppliesInspectInfoServiceImpl.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/impl/EmergencySuppliesInspectInfoServiceImpl.java new file mode 100644 index 0000000..d7eec24 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/impl/EmergencySuppliesInspectInfoServiceImpl.java @@ -0,0 +1,48 @@ +package com.gkhy.safePlatform.emergency.service.baseService.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectInfo; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectInfoDetailDO; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectInfoPageDO; +import com.gkhy.safePlatform.emergency.query.db.EmergencySuppliesInspectDBQuery; +import com.gkhy.safePlatform.emergency.repository.EmergencySuppliesInspectInfoRepository; +import com.gkhy.safePlatform.emergency.service.baseService.EmergencySuppliesInspectInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service("emergencySuppliesInspectInfoService") +public class EmergencySuppliesInspectInfoServiceImpl extends ServiceImpl<EmergencySuppliesInspectInfoRepository, EmergencySuppliesInspectInfo> implements EmergencySuppliesInspectInfoService { + + @Autowired + private EmergencySuppliesInspectInfoRepository emergencySuppliesInspectInfoRepository; + + @Override + public List<EmergencySuppliesInspectInfoPageDO> selectEmergencySuppliesInspectList(Page<EmergencySuppliesInspectInfoPageDO> page, EmergencySuppliesInspectDBQuery emergencySuppliesInspectDBQuery) { + return emergencySuppliesInspectInfoRepository.selectEmergencySuppliesInspectList(page,emergencySuppliesInspectDBQuery); + } + + @Override + public void addEmergencySuppliesInspect(EmergencySuppliesInspectInfo emergencySuppliesInspectInfo) { + emergencySuppliesInspectInfoRepository.addEmergencySuppliesInspect(emergencySuppliesInspectInfo); + } + + @Override + public EmergencySuppliesInspectInfoDetailDO selectEmergencySuppliesInspectById(Long id) { + return emergencySuppliesInspectInfoRepository.selectEmergencySuppliesInspectById(id); + } + + @Override + public void updateEmergencySuppliesInspect(EmergencySuppliesInspectInfo emergencySuppliesInspectInfo) { + emergencySuppliesInspectInfoRepository.updateEmergencySuppliesInspect(emergencySuppliesInspectInfo); + } + + @Override + public void deleteEmergencySuppliesInspect(Long SuppliesInspectId) { + emergencySuppliesInspectInfoRepository.deleteEmergencySuppliesInspect(SuppliesInspectId); + } + + +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/impl/EmergencySuppliesInspectUserInfoServiceImpl.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/impl/EmergencySuppliesInspectUserInfoServiceImpl.java new file mode 100644 index 0000000..cbc1204 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/impl/EmergencySuppliesInspectUserInfoServiceImpl.java @@ -0,0 +1,40 @@ +package com.gkhy.safePlatform.emergency.service.baseService.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectUserInfo; +import com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectUserInfoDO; +import com.gkhy.safePlatform.emergency.repository.EmergencySuppliesInspectUserInfoRepository; +import com.gkhy.safePlatform.emergency.service.baseService.EmergencySuppliesInspectUserInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service("emergencySuppliesInspectUserInfoService") +public class EmergencySuppliesInspectUserInfoServiceImpl extends ServiceImpl<EmergencySuppliesInspectUserInfoRepository, EmergencySuppliesInspectUserInfo> implements EmergencySuppliesInspectUserInfoService { + + @Autowired + private EmergencySuppliesInspectUserInfoRepository emergencySuppliesInspectUserInfoRepository; + + + @Override + public void addEmergencySuppliesInspectUser(EmergencySuppliesInspectUserInfo emergencySuppliesInspectUserInfo) { + emergencySuppliesInspectUserInfoRepository.addEmergencySuppliesInspectUser(emergencySuppliesInspectUserInfo); + } + + @Override + public List<EmergencySuppliesInspectUserInfoDO> selectEmergencySuppliesInspectUserBySuppliesInspectId(Long id) { + return emergencySuppliesInspectUserInfoRepository.selectEmergencySuppliesInspectUserBySuppliesInspectId(id); + } + + @Override + public void deleteEmergencySuppliesInspectUserByIds(List<Long> ids) { + emergencySuppliesInspectUserInfoRepository.deleteEmergencySuppliesInspectUserByIds(ids); + } + + @Override + public void deleteEmergencySuppliesInspectUserBySuppliesInspectId(Long suppliesInspectId) { + emergencySuppliesInspectUserInfoRepository.deleteEmergencySuppliesInspectUserBySuppliesInspectId(suppliesInspectId); + } + +} diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencyDrillPlanServiceImpl.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencyDrillPlanServiceImpl.java index 10e38dc..5c26672 100644 --- a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencyDrillPlanServiceImpl.java +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencyDrillPlanServiceImpl.java @@ -170,7 +170,7 @@ if (!CollectionUtils.isEmpty(emergencyDrillPlanReqDTO.getFileList())) { updateEmergencyDrillPlanFile(uid, emergencyDrillPlanInfo.getId(), nowDate, emergencyDrillPlanReqDTO.getFileList()); } - // 更新急演练计划应急队伍表 + // 更新急演练计划应急人员表 if (!CollectionUtils.isEmpty(emergencyDrillPlanReqDTO.getUserList())) { updateEmergencyDrillPlanUser(uid, emergencyDrillPlanInfo.getId(), nowDate, emergencyDrillPlanReqDTO.getUserList()); } @@ -284,7 +284,7 @@ emergencyDrillPlanInfoService.deleteEmergencyDrillPlan(DrillPlanId); //删除附件 emergencyDrillPlanFileInfoService.deleteEmergencyDrillPlanFileByDrillPlanId(DrillPlanId); - //删除应急队伍 + //删除人员 emergencyDrillPlanUserInfoService.deleteEmergencyDrillPlanUserByDrillPlanId(DrillPlanId); } } diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencySuppliesInspectServiceImpl.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencySuppliesInspectServiceImpl.java new file mode 100644 index 0000000..5ad5ab6 --- /dev/null +++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencySuppliesInspectServiceImpl.java @@ -0,0 +1,222 @@ +package com.gkhy.safePlatform.emergency.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.gkhy.safePlatform.commons.enums.ResultCodes; +import com.gkhy.safePlatform.commons.query.PageQuery; +import com.gkhy.safePlatform.commons.utils.BeanCopyUtils; +import com.gkhy.safePlatform.commons.utils.StringUtils; +import com.gkhy.safePlatform.commons.vo.ResultVO; +import com.gkhy.safePlatform.commons.vo.SearchResultVO; +import com.gkhy.safePlatform.emergency.entity.*; +import com.gkhy.safePlatform.emergency.enums.EmergencyResultCodes; +import com.gkhy.safePlatform.emergency.excepiton.EmergencyException; +import com.gkhy.safePlatform.emergency.model.dto.req.EmergencySuppliesInspectReqDTO; +import com.gkhy.safePlatform.emergency.model.dto.req.EmergencySuppliesInspectUserReqDTO; +import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencySuppliesInspectDetailRespDTO; +import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencySuppliesInspectPageRespDTO; +import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencySuppliesInspectUserRespDTO; +import com.gkhy.safePlatform.emergency.query.EmergencySuppliesInspectQuery; +import com.gkhy.safePlatform.emergency.query.db.EmergencySuppliesInspectDBQuery; +import com.gkhy.safePlatform.emergency.service.EmergencySuppliesInspectService; +import com.gkhy.safePlatform.emergency.service.baseService.EmergencySuppliesInfoService; +import com.gkhy.safePlatform.emergency.service.baseService.EmergencySuppliesInspectInfoService; +import com.gkhy.safePlatform.emergency.service.baseService.EmergencySuppliesInspectUserInfoService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Service("emergencySuppliesInspectService") +public class EmergencySuppliesInspectServiceImpl implements EmergencySuppliesInspectService { + + @Autowired + private EmergencySuppliesInspectInfoService emergencySuppliesInspectInfoService; + + @Autowired + private EmergencySuppliesInspectUserInfoService emergencySuppliesInspectUserInfoService; + + @Autowired + private EmergencySuppliesInfoService emergencySuppliesInfoService; + + + @Override + public SearchResultVO<List<EmergencySuppliesInspectPageRespDTO>> selectEmergencySuppliesInspectList(PageQuery<EmergencySuppliesInspectQuery> query) { + Long pageIndex = query.getPageIndex(); + Long pageSize = query.getPageSize(); + Page<EmergencySuppliesInspectInfoPageDO> page = new Page<>(pageIndex, pageSize); + + EmergencySuppliesInspectDBQuery emergencySuppliesInspectDBQuery = new EmergencySuppliesInspectDBQuery(); + if (query.getSearchParams() != null) { + BeanUtils.copyProperties(query.getSearchParams(), emergencySuppliesInspectDBQuery); + } + List<EmergencySuppliesInspectInfoPageDO> emergencySuppliesInspectListDoInfoList = emergencySuppliesInspectInfoService.selectEmergencySuppliesInspectList(page,emergencySuppliesInspectDBQuery); + List<EmergencySuppliesInspectPageRespDTO> respList = BeanCopyUtils.copyBeanList(emergencySuppliesInspectListDoInfoList, EmergencySuppliesInspectPageRespDTO.class); + + return new SearchResultVO<>( + true, + pageIndex, + pageSize, + page.getTotal(), + respList, + ResultCodes.OK + ); + } + + @Override + public ResultVO addEmergencySuppliesInspect(Long uid, EmergencySuppliesInspectReqDTO emergencySuppliesInspectReqDTO) { + Long suppliesId = emergencySuppliesInspectReqDTO.getSuppliesId(); + + if (suppliesId==null){ + throw new EmergencyException(EmergencyResultCodes.SUPPLIES_NULL); + }else{ + EmergencySuppliesInfoDetailDO emergencySuppliesInfoDetailDO = emergencySuppliesInfoService.selectEmergencySuppliesById(suppliesId); + if (emergencySuppliesInfoDetailDO==null){ + throw new EmergencyException(EmergencyResultCodes.SUPPLIES_NOT_EXIST); + }else{ + Date nowDate = new Date(); + // 新增应急物资检查 + EmergencySuppliesInspectInfo emergencySuppliesInspectInfo = new EmergencySuppliesInspectInfo(); + BeanUtils.copyProperties(emergencySuppliesInspectReqDTO,emergencySuppliesInspectInfo); + emergencySuppliesInspectInfo.setDelFlag(false); + emergencySuppliesInspectInfo.setCreateUid(uid); + emergencySuppliesInspectInfo.setGmtCreate(nowDate); + emergencySuppliesInspectInfoService.addEmergencySuppliesInspect(emergencySuppliesInspectInfo); + + // 新增急演练计划应急人员表 + if (!CollectionUtils.isEmpty(emergencySuppliesInspectReqDTO.getUserList())) { + addEmergencySuppliesInspectUser(uid, emergencySuppliesInspectInfo.getId(), nowDate, emergencySuppliesInspectReqDTO.getUserList()); + } + return new ResultVO<>(ResultCodes.OK); + } + } + } + + private void addEmergencySuppliesInspectUser(Long uid, Long inspectId, Date nowDate, List<EmergencySuppliesInspectUserReqDTO> userList) { + List<EmergencySuppliesInspectUserInfo> emergencySuppliesInspectUserInfoList = BeanCopyUtils.copyBeanList(userList, EmergencySuppliesInspectUserInfo.class); + emergencySuppliesInspectUserInfoList.forEach(EmergencySuppliesInspectUserInfo -> { + EmergencySuppliesInspectUserInfo.setDelFlag(false); + EmergencySuppliesInspectUserInfo.setCreateUid(uid); + EmergencySuppliesInspectUserInfo.setGmtCreate(nowDate); + EmergencySuppliesInspectUserInfo.setInspectId(inspectId); + }); + for (EmergencySuppliesInspectUserInfo emergencySuppliesInspectUserInfo : emergencySuppliesInspectUserInfoList) { + emergencySuppliesInspectUserInfoService.addEmergencySuppliesInspectUser(emergencySuppliesInspectUserInfo); + } + } + + + @Override + public ResultVO<EmergencySuppliesInspectDetailRespDTO> getEmergencySuppliesInspectById(Long id) { + EmergencySuppliesInspectDetailRespDTO emergencySuppliesInspectDetailRespDTO = new EmergencySuppliesInspectDetailRespDTO(); + // 查询是否存在 + EmergencySuppliesInspectInfoDetailDO emergencySuppliesInspectInfoDetailDO = emergencySuppliesInspectInfoService.selectEmergencySuppliesInspectById(id); + if (emergencySuppliesInspectInfoDetailDO==null){ + throw new EmergencyException(EmergencyResultCodes.SUPPLIES_INSPECT_NOT_EXIST); + }else{ + BeanUtils.copyProperties(emergencySuppliesInspectInfoDetailDO,emergencySuppliesInspectDetailRespDTO); + + // 查找对应的人员表 + List<EmergencySuppliesInspectUserInfoDO> emergencySuppliesInspectUserInfoDOList = emergencySuppliesInspectUserInfoService.selectEmergencySuppliesInspectUserBySuppliesInspectId(id); + if (!CollectionUtils.isEmpty(emergencySuppliesInspectUserInfoDOList)) { + List<EmergencySuppliesInspectUserRespDTO> emergencySuppliesInspectUserRespDTOList = BeanCopyUtils.copyBeanList(emergencySuppliesInspectUserInfoDOList, EmergencySuppliesInspectUserRespDTO.class); + emergencySuppliesInspectDetailRespDTO.setUserList(emergencySuppliesInspectUserRespDTOList); + } + + return new ResultVO<>(ResultCodes.OK,emergencySuppliesInspectDetailRespDTO); + } + } + + @Override + public ResultVO updateEmergencySuppliesInspect(Long uid, EmergencySuppliesInspectReqDTO emergencySuppliesInspectReqDTO) { + Date nowDate = new Date(); + // 查询是否存在 + EmergencySuppliesInspectInfoDetailDO emergencySuppliesInspectInfoDetailDO = emergencySuppliesInspectInfoService.selectEmergencySuppliesInspectById(emergencySuppliesInspectReqDTO.getId()); + if (emergencySuppliesInspectInfoDetailDO==null){ + throw new EmergencyException(EmergencyResultCodes.SUPPLIES_INSPECT_NOT_EXIST); + }else{ + EmergencySuppliesInspectInfo emergencySuppliesInspectInfo = new EmergencySuppliesInspectInfo(); + BeanUtils.copyProperties(emergencySuppliesInspectReqDTO,emergencySuppliesInspectInfo); + emergencySuppliesInspectInfo.setUpdateUid(uid); + emergencySuppliesInspectInfo.setGmtModitify(nowDate); + emergencySuppliesInspectInfoService.updateEmergencySuppliesInspect(emergencySuppliesInspectInfo); + + // 更新急演练计划应急人员表 + if (!CollectionUtils.isEmpty(emergencySuppliesInspectReqDTO.getUserList())) { + updateEmergencySuppliesInspectUser(uid, emergencySuppliesInspectInfo.getId(), nowDate, emergencySuppliesInspectReqDTO.getUserList()); + } + return new ResultVO<>(ResultCodes.OK); + } + } + + private void updateEmergencySuppliesInspectUser(Long uid, Long suppliesInspectId, Date + nowDate, List<EmergencySuppliesInspectUserReqDTO> UserReqDTOList) { + List<EmergencySuppliesInspectUserInfoDO> emergencySuppliesInspectUserInfoDOList = emergencySuppliesInspectUserInfoService.selectEmergencySuppliesInspectUserBySuppliesInspectId(suppliesInspectId); + List<Long> oldIdsList = emergencySuppliesInspectUserInfoDOList.stream().map(EmergencySuppliesInspectUserInfoDO::getId).collect(Collectors.toList()); + List<Long> newIdsList = new ArrayList<>(); + + //新增的区域集合 + List<EmergencySuppliesInspectUserInfo> addList = new ArrayList<>(); + //删除的区域集合(id) + List<Long> deleteList = new ArrayList<>(); + for (EmergencySuppliesInspectUserReqDTO emergencySuppliesInspectUserReqDTO : UserReqDTOList) { + //如果不存在id则表示页面新增的附件 + if (emergencySuppliesInspectUserReqDTO.getId() == null) { + EmergencySuppliesInspectUserInfo emergencySuppliesInspectUserInfo = new EmergencySuppliesInspectUserInfo(); + BeanUtils.copyProperties(emergencySuppliesInspectUserReqDTO, emergencySuppliesInspectUserInfo); + emergencySuppliesInspectUserInfo.setDelFlag(false); + emergencySuppliesInspectUserInfo.setGmtCreate(nowDate); + emergencySuppliesInspectUserInfo.setCreateUid(uid); + emergencySuppliesInspectUserInfo.setInspectId(suppliesInspectId); + addList.add(emergencySuppliesInspectUserInfo); + } + //如果存在id则判断页面是否删除 + else { + newIdsList.add(emergencySuppliesInspectUserReqDTO.getId()); + } + } + for (Long oldId : oldIdsList) { + if (!newIdsList.contains(oldId)) { + deleteList.add(oldId); + } + } + if (!CollectionUtils.isEmpty(addList)) { + for (EmergencySuppliesInspectUserInfo emergencySuppliesInspectUserInfo : addList) { + emergencySuppliesInspectUserInfoService.addEmergencySuppliesInspectUser(emergencySuppliesInspectUserInfo); + } + } + if (!CollectionUtils.isEmpty(deleteList)) { + emergencySuppliesInspectUserInfoService.deleteEmergencySuppliesInspectUserByIds(deleteList); + } + } + + @Override + public ResultVO batchDeleteEmergencySuppliesInspect(String ids) { + if (StringUtils.isBlank(ids)) { + throw new EmergencyException(EmergencyResultCodes.SUPPLIES_INSPECT_NULL); + } else { + String[] idArr = ids.split(","); + for (String id : idArr) { + deleteEmergencySuppliesInspect(Long.valueOf(id)); + } + return new ResultVO(ResultCodes.OK); + } + } + + private void deleteEmergencySuppliesInspect(Long id) { + //查询是否存在 + EmergencySuppliesInspectInfoDetailDO emergencySuppliesInspectInfoDetailDO = emergencySuppliesInspectInfoService.selectEmergencySuppliesInspectById(id); + if (emergencySuppliesInspectInfoDetailDO==null){ + throw new EmergencyException(EmergencyResultCodes.SUPPLIES_INSPECT_NOT_EXIST); + }else{ + Long suppliesInspectId = emergencySuppliesInspectInfoDetailDO.getId(); + emergencySuppliesInspectInfoService.deleteEmergencySuppliesInspect(suppliesInspectId); + //删除人员 + emergencySuppliesInspectUserInfoService.deleteEmergencySuppliesInspectUserBySuppliesInspectId(suppliesInspectId); + } + } +} diff --git a/emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencySuppliesInspectInfoMapper.xml b/emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencySuppliesInspectInfoMapper.xml new file mode 100644 index 0000000..e8d07fb --- /dev/null +++ b/emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencySuppliesInspectInfoMapper.xml @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.gkhy.safePlatform.emergency.repository.EmergencySuppliesInspectInfoRepository"> + + <resultMap type="com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectInfoPageDO" id="emergencySuppliesInspectInfoPageDOResult"> + <id column="id" property="id" jdbcType="BIGINT"/> + <result column="supplies_id" property="suppliesId"/> + <result column="inspect_result" property="inspectResult"/> + <result column="inspect_time" property="inspectTime"/> + </resultMap> + + <select id="selectEmergencySuppliesInspectList" resultMap="emergencySuppliesInspectInfoPageDOResult"> + select id,`supplies_id`,`inspect_result`,`inspect_time` from emergency_supplies_inspect where del_flag = 0 + <if test="query.suppliesId != null and query.suppliesId != ''">and `supplies_id` = #{query.suppliesId}</if> + </select> + + <insert id="addEmergencySuppliesInspect" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectInfo" + keyProperty="id" useGeneratedKeys="true"> + insert into emergency_supplies_inspect + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null ">id,</if> + <if test="delFlag != null ">del_flag,</if> + <if test="gmtCreate != null ">gmt_create,</if> + <if test="gmtModitify != null ">gmt_moditify,</if> + <if test="createUid != null ">create_uid,</if> + <if test="updateUid != null ">update_uid,</if> + <if test="suppliesId != null ">supplies_id,</if> + <if test="inspectResult != null and inspectResult != ''">`inspect_result`,</if> + <if test="inspectTime != null ">inspect_time,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null ">#{id},</if> + <if test="delFlag != null ">#{delFlag},</if> + <if test="gmtCreate != null ">#{gmtCreate},</if> + <if test="gmtModitify != null ">#{gmtModitify},</if> + <if test="createUid != null ">#{createUid},</if> + <if test="updateUid != null ">#{updateUid},</if> + <if test="suppliesId != null ">#{suppliesId},</if> + <if test="inspectResult != null and inspectResult != ''">#{inspectResult},</if> + <if test="inspectTime != null ">#{inspectTime},</if> + </trim> + </insert> + + + <resultMap type="com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectInfoDetailDO" id="emergencySuppliesInspectInfoDetailDOResult"> + <id column="id" property="id" jdbcType="BIGINT"/> + <result column="supplies_id" property="suppliesId"/> + <result column="inspect_result" property="inspectResult"/> + <result column="inspect_time" property="inspectTime"/> + </resultMap> + + <select id="selectEmergencySuppliesInspectById" resultMap="emergencySuppliesInspectInfoDetailDOResult"> + select id,`supplies_id`,`inspect_result`,`inspect_time` from emergency_supplies_inspect where del_flag = 0 and id = #{id} + </select> + + <update id="updateEmergencySuppliesInspect" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectInfo"> + update emergency_supplies_inspect + <trim prefix="SET" suffixOverrides=","> + <if test="gmtModitify != null ">gmt_moditify = #{gmtModitify},</if> + <if test="updateUid != null ">update_uid = #{updateUid},</if> + <if test="suppliesId != null ">supplies_id = #{suppliesId},</if> + <if test="inspectResult != null and inspectResult != ''">`inspect_result` = #{inspectResult},</if> + <if test="inspectTime != null ">inspect_time = #{inspectTime},</if> + </trim> + where id = #{id} + </update> + + <update id="deleteEmergencySuppliesInspect"> + update emergency_supplies_inspect set del_flag = 1 where id = #{id} + </update> +</mapper> diff --git a/emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencySuppliesInspectUserInfoMapper.xml b/emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencySuppliesInspectUserInfoMapper.xml new file mode 100644 index 0000000..a632cb8 --- /dev/null +++ b/emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencySuppliesInspectUserInfoMapper.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.gkhy.safePlatform.emergency.repository.EmergencySuppliesInspectUserInfoRepository"> + + <insert id="addEmergencySuppliesInspectUser"> + insert into emergency_supplies_inspect_user + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null ">id,</if> + <if test="delFlag != null ">del_flag,</if> + <if test="gmtCreate != null ">gmt_create,</if> + <if test="gmtModitify != null ">gmt_moditify,</if> + <if test="createUid != null ">create_uid,</if> + <if test="updateUid != null ">update_uid,</if> + <if test="inspectId != null ">inspect_id,</if> + <if test="userUid != null ">user_uid,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null ">#{id},</if> + <if test="delFlag != null ">#{delFlag},</if> + <if test="gmtCreate != null ">#{gmtCreate},</if> + <if test="gmtModitify != null ">#{gmtModitify},</if> + <if test="createUid != null ">#{createUid},</if> + <if test="updateUid != null ">#{updateUid},</if> + <if test="inspectId != null ">#{inspectId},</if> + <if test="userUid != null ">#{userUid},</if> + </trim> + </insert> + + <resultMap type="com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInspectUserInfoDO" id="emergencySuppliesInspectUserInfoDOResult"> + <id column="id" property="id" jdbcType="BIGINT"/> + <result column="inspect_id" property="inspectId" /> + <result column="user_uid" property="userUid" /> + </resultMap> + + <select id="selectEmergencySuppliesInspectUserBySuppliesInspectId" resultMap="emergencySuppliesInspectUserInfoDOResult"> + select id,`inspect_id`,`user_uid` from emergency_supplies_inspect_user where del_flag = 0 and inspect_id = #{suppliesInspectId} + </select> + + <update id = "deleteEmergencySuppliesInspectUserByIds" > + update emergency_supplies_inspect_user set del_flag = 1 where id in + <foreach item="id" collection="ids" open="(" separator="," close=")"> + #{id} + </foreach> + </update> + + <update id="deleteEmergencySuppliesInspectUserBySuppliesInspectId"> + update emergency_supplies_inspect_user set del_flag = 1 where inspect_id = #{suppliesInspectId} + </update> + +</mapper> -- Gitblit v1.9.2