diff --git a/inventory-dao/src/main/java/com/rzyc/bean/risk/RkSourcesDto.java b/inventory-dao/src/main/java/com/rzyc/bean/risk/RkSourcesDto.java new file mode 100644 index 0000000..cc7e680 --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/bean/risk/RkSourcesDto.java @@ -0,0 +1,311 @@ +package com.rzyc.bean.risk; + +import com.rzyc.enums.FlowQueryStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; + +@ApiModel("企业风险源信息") +public class RkSourcesDto { + /** + * id + */ + @ApiModelProperty("id 空表示添加,有表示修改") + private String sourceId; + + /** + * 企业id + */ + @ApiModelProperty(value = "企业id",required = true) + @NotNull(message = "企业id不能为空") + private String enterpriseId; + + @ApiModelProperty("企业名称") + private String entName; + + /** + * 场所位置 + */ + @ApiModelProperty("场所位置") + private String palce; + + /** + * 风险源id + */ + @ApiModelProperty("风险源id") + private String rkSourceId; + + /** + * 风险类型id + */ + @ApiModelProperty("风险类型id") + private String typeId; + + /** + * 其他伤害类 + */ + @ApiModelProperty("其他伤害类") + private String hurtTypeId; + + /** + * 是否涉及有害气体 + */ + @ApiModelProperty("是否涉及有害气体") + private Integer isHarmfulGas; + + + /** + * 是否对周围有影响 + */ + @ApiModelProperty("是否对周围有影响") + private Integer isInfluential; + + /** + * 风险源描述 + */ + @ApiModelProperty("风险源描述") + private String details; + + /** + * 涉及人员数量 + */ + @ApiModelProperty("涉及人员数量") + private Integer personnelNum; + + /** + * 设备设施总价值 + */ + @ApiModelProperty("设备设施总价值") + private Integer price; + + /** + * 可能性 + */ + @ApiModelProperty("可能性") + private Integer possibility; + + /** + * 后果严重性 + */ + @ApiModelProperty("后果严重性") + private Integer seriousness; + + @ApiModelProperty("风险等级") + private Integer riskgrade; + + /** + * 工程技术 + */ + @ApiModelProperty("工程技术") + private String engineering; + + /** + * 管理措施 + */ + @ApiModelProperty("管理措施") + private String measures; + /** + * 是否受控 + */ + @ApiModelProperty("是否受控") + private Integer controlled; + + /** + * 页数 + */ + @ApiModelProperty(value = "页数",required = true) + @NotNull(message = "页数不能为空") + private Integer page; + + /** + * 条数 + */ + @ApiModelProperty(value = "条数",required = true) + @NotNull(message = "条数不能为空") + private Integer pageSize; + + @ApiModelProperty("数据状态") + private FlowQueryStatus status; + + @ApiModelProperty("查询条件") + private String codition; + + public String getCodition() { + return codition; + } + + public void setCodition(String codition) { + this.codition = codition; + } + + public Integer getRiskgrade() { + return riskgrade; + } + + public void setRiskgrade(Integer riskgrade) { + this.riskgrade = riskgrade; + } + + public FlowQueryStatus getStatus() { + return status; + } + + public void setStatus(FlowQueryStatus status) { + this.status = status; + } + + public Integer getPage() { + return page; + } + + public void setPage(Integer page) { + this.page = page; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public String getEntName() { + return entName; + } + + public void setEntName(String entName) { + this.entName = entName; + } + + public String getSourceId() { + return sourceId; + } + + public void setSourceId(String sourceId) { + this.sourceId = sourceId; + } + + public String getEnterpriseId() { + return enterpriseId; + } + + public void setEnterpriseId(String enterpriseId) { + this.enterpriseId = enterpriseId; + } + + public String getPalce() { + return palce; + } + + public void setPalce(String palce) { + this.palce = palce; + } + + public String getRkSourceId() { + return rkSourceId; + } + + public void setRkSourceId(String rkSourceId) { + this.rkSourceId = rkSourceId; + } + + public String getTypeId() { + return typeId; + } + + public void setTypeId(String typeId) { + this.typeId = typeId; + } + + public String getHurtTypeId() { + return hurtTypeId; + } + + public void setHurtTypeId(String hurtTypeId) { + this.hurtTypeId = hurtTypeId; + } + + public Integer getIsHarmfulGas() { + return isHarmfulGas; + } + + public void setIsHarmfulGas(Integer isHarmfulGas) { + this.isHarmfulGas = isHarmfulGas; + } + + public Integer getIsInfluential() { + return isInfluential; + } + + public void setIsInfluential(Integer isInfluential) { + this.isInfluential = isInfluential; + } + + public String getDetails() { + return details; + } + + public void setDetails(String details) { + this.details = details; + } + + public Integer getPersonnelNum() { + return personnelNum; + } + + public void setPersonnelNum(Integer personnelNum) { + this.personnelNum = personnelNum; + } + + public Integer getPrice() { + return price; + } + + public void setPrice(Integer price) { + this.price = price; + } + + public Integer getPossibility() { + return possibility; + } + + public void setPossibility(Integer possibility) { + this.possibility = possibility; + } + + public Integer getSeriousness() { + return seriousness; + } + + public void setSeriousness(Integer seriousness) { + this.seriousness = seriousness; + } + + public String getEngineering() { + return engineering; + } + + public void setEngineering(String engineering) { + this.engineering = engineering; + } + + public String getMeasures() { + return measures; + } + + public void setMeasures(String measures) { + this.measures = measures; + } + + public Integer getControlled() { + return controlled; + } + + public void setControlled(Integer controlled) { + this.controlled = controlled; + } + + private static final long serialVersionUID = 1L; +} diff --git a/inventory-dao/src/main/java/com/rzyc/enums/FlowQueryStatus.java b/inventory-dao/src/main/java/com/rzyc/enums/FlowQueryStatus.java new file mode 100644 index 0000000..10cc0d9 --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/enums/FlowQueryStatus.java @@ -0,0 +1,65 @@ +package com.rzyc.enums; + + + +import java.util.*; + +/** + * 流程查询状态 + * @Author wj + * @Date 2020/10/23 9:34 + **/ +public enum FlowQueryStatus { + + /** 草稿 */ + PENDING("草稿"), + + /** 处理中 */ + APPROVING("处理中"), + + /** 待处理 */ + WAIT_APPROVE("待处理"), + + /** 处理过 */ + HAS_APPROVE("处理过"), + + /** 已完成 */ + FINISHED("已完成"); + + + public String getValue(){ + return this.name(); + } + + private final String title; + + public String getTitle() { + return title; + } + + private FlowQueryStatus(String title) { + this.title = title; + } + + + public static List> toList() { + List> list = new ArrayList<>(); + for (FlowQueryStatus e : values()) { + Map map = new HashMap<>(); + map.put("name", e.name()); + map.put("title", e.getTitle()); + list.add(map); + } + return list; + } + + public static Map toMap() { + Map map = new LinkedHashMap<>(); + for (FlowQueryStatus e : values()) { + map.put(e.name(), e.toString()); + } + return map; + } + + +} diff --git a/inventory-ent/src/main/java/com/rzyc/controller/PcCheckController.java b/inventory-ent/src/main/java/com/rzyc/controller/PcCheckController.java new file mode 100644 index 0000000..65c2b87 --- /dev/null +++ b/inventory-ent/src/main/java/com/rzyc/controller/PcCheckController.java @@ -0,0 +1,57 @@ +package com.rzyc.controller; + +import com.common.utils.model.Code; +import com.common.utils.model.Message; +import com.common.utils.model.SingleResult; +import com.rzyc.model.check.BookEntCheck; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.stereotype.Controller; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +/** + * @author dong + * @date 2022-09-28 15:30 + * @Version V1.0 + */ +@Api(tags = "PC企业检查和隐患") +@CrossOrigin("*") +@RequestMapping("pcCheck") +@Controller +@Validated +public class PcCheckController extends BaseController{ + + /** + * 检查记录详细 + * */ + @ApiOperation(value = "检查记录详细", notes = "检查记录详细") + @GetMapping("/getCompanyCheckDetail") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "检查id", required = true, dataType = "string"), + }) + @ResponseBody + public SingleResult getCompanyCheckDetail(String id)throws Exception { + SingleResult singleResult = new SingleResult(); + BookEntCheck bookEntCheck = bookEntCheckMapper.selectCheckDetail(id); + if (null != bookEntCheck){ + + + //处理数据,第二个参数是给小程序用的判断isSign + handleCheckDetail(bookEntCheck,"simProgram"); + + singleResult.setData(bookEntCheck); + singleResult.setMessage(Message.SUCCESS); + singleResult.setCode(Code.SUCCESS.getCode()); + }else { + singleResult.setMessage(Message.ERROR); + singleResult.setCode(Code.ERROR.getCode()); + } + return singleResult; + } +} diff --git a/inventory-ent/src/main/java/com/rzyc/controller/RiskController.java b/inventory-ent/src/main/java/com/rzyc/controller/RiskController.java index 9199dc2..81b8ba5 100644 --- a/inventory-ent/src/main/java/com/rzyc/controller/RiskController.java +++ b/inventory-ent/src/main/java/com/rzyc/controller/RiskController.java @@ -1,25 +1,29 @@ package com.rzyc.controller; import com.common.utils.StringUtils; -import com.common.utils.model.SingleResult; -import com.rzyc.bean.risk.SourcesAddDto; -import com.rzyc.bean.risk.SourcesDelDto; +import com.common.utils.TypeConversion; +import com.common.utils.model.*; +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; +import com.rzyc.advice.LoginAuth; +import com.rzyc.bean.risk.*; import com.rzyc.enums.DelState; import com.rzyc.enums.ResourceRiskLevel; +import com.rzyc.model.RkRiskType; import com.rzyc.model.RkSources; import com.rzyc.model.ent.SysEnterprise; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.commons.beanutils.BeanUtils; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.CrossOrigin; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -158,4 +162,145 @@ public class RiskController extends BaseController { } return result; } + + /** + * 重大危险源类型 + * + * @version v1.0 + * @author dong + * @date 2022/8/2 9:44 + */ + @ApiOperation(value = "类型 1、风险源类型 2、事故类型", notes = "类型 1、风险源类型 2、事故类型") + @GetMapping("/riskType/{type}") + @ApiImplicitParam(name = "type", value = "类型 1、风险源类型 2、事故类型", required = true) + public MultiResult riskType(@PathVariable Integer type) throws Exception { + MultiResult result = new MultiResult<>(); + List riskTypes = rkRiskTypeMapper.findByClassId(type); + result.setData(riskTypes); + return result; + } + + /** + * 企业重大危险源分页 + * + * @version v1.0 + * @author dong + * @date 2022/8/2 11:49 + */ + @ApiOperation(value = "企业重大危险源分页", notes = "企业重大危险源分页") + @GetMapping("/sourcesEntPage") + public SingleResult> sourcesEntPage(@Valid SourcesPageDto sourcesPageDto) throws Exception { + SingleResult> result = new SingleResult<>(); + String condition = TypeConversion.getCondition(sourcesPageDto.getCondition()); + PageHelper.startPage(sourcesPageDto.getPage(), sourcesPageDto.getPageSize()); + Page page = (Page) rkSourcesMapper.sourcesList(condition, sourcesPageDto.getEnterpriseId(), sourcesPageDto.getRiskGrade()); + Pager pager = new Pager<>(); + getDatePage(pager, page); + result.setData(pager); + return result; + } + + /** + * 需要标记的危险源列表 + * + * @version v1.0 + * @author dong + * @date 2022/8/2 13:33 + */ + @ApiOperation(value = "需要标记的危险源列表", notes = "需要标记的危险源列表") + @GetMapping("/sourcesNeedSign/{enterpriseId}") + public MultiResult sourcesNeedSign(@PathVariable String enterpriseId) throws Exception { + MultiResult result = new MultiResult<>(); + List sources = rkSourcesMapper.findByIndex(enterpriseId); + result.setData(sources); + return result; + } + + /** + * 已经标记的危险源列表 + * + * @version v1.0 + * @author dong + * @date 2022/8/2 13:33 + */ + @ApiOperation(value = "已经标记的危险源列表", notes = "已经标记的危险源列表") + @GetMapping("/sourcesSigned/{enterpriseId}") + @ApiImplicitParams({ + @ApiImplicitParam(name = "enterpriseId", value = "企业id"), + @ApiImplicitParam(name = "documentId", value = "文件id") + }) + public MultiResult sourcesSigned(@PathVariable String enterpriseId, String documentId) throws Exception { + MultiResult result = new MultiResult<>(); + List sources = rkSourcesMapper.signedSource(enterpriseId, documentId); + result.setData(sources); + return result; + } + + /** + * 危险源标记 + * + * @version v1.0 + * @author dong + * @date 2022/8/2 13:33 + */ + @ApiOperation(value = "危险源标记", notes = "危险源标记") + @PostMapping("/sourcesSign") + public SingleResult sourcesSign(@Valid SourcesSignDto sourcesSignDto) throws Exception { + SingleResult result = new SingleResult<>(); + RkSources sources = new RkSources(); + BeanUtils.copyProperties(sources, sourcesSignDto); + rkSourcesMapper.updateById(sources); + return result; + } + + + /** + * 删除危险源标记 + * + * @version v1.0 + * @author dong + * @date 2022/8/2 13:33 + */ + @ApiOperation(value = "删除危险源标记", notes = "删除危险源标记") + @PostMapping("/sourcesSignDel/{sourceId}") + @ApiImplicitParam(name = "sourceId", value = "危险源id", required = true) + public SingleResult sourcesSignDel(@PathVariable String sourceId) throws Exception { + SingleResult result = new SingleResult<>(); + rkSourcesMapper.changeIndex(sourceId); + return result; + } + + + /** + * 危险源详情 + * + * @version v1.0 + * @author dong + * @date 2022/8/2 13:33 + */ + @ApiOperation(value = "危险源详情", notes = "危险源详情") + @PostMapping("/sourcesDetail/{sourceId}") + @ApiImplicitParam(name = "sourceId", value = "危险源id", required = true) + public SingleResult sourcesDetail(@PathVariable String sourceId) throws Exception { + SingleResult result = new SingleResult<>(); + RkSources sources = rkSourcesMapper.selectById(sourceId); + + if (null != sources) { + + //风险源分类 + RkRiskType riskType = rkRiskTypeMapper.selectById(sources.getSourceId()); + if (null != riskType) { + sources.setSourceName(riskType.getName()); + } + + //事故类型 + RkRiskType rkRiskType = rkRiskTypeMapper.selectById(sources.getTypeId()); + if (null != rkRiskType) { + sources.setTypeName(rkRiskType.getName()); + } + } + + result.setData(sources); + return result; + } }