From ef343ae751cdd7b39fde497183b2e6a2c6493cdd Mon Sep 17 00:00:00 2001 From: liukewei Date: Fri, 8 Dec 2023 17:41:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ehs/EhsEnterpriseController.java | 111 +++++ .../common/utils/file/FileUploadUtils.java | 4 +- .../ehsEnterprise/domain/EhsEnterprise.java | 81 +++ .../mapper/EhsEnterpriseMapper.java | 29 ++ .../service/IEhsEnterpriseService.java | 31 ++ .../impl/EhsEnterpriseServiceImpl.java | 74 +++ .../domain/EhsNoticeMessage.java | 5 +- .../mapper/ehs/EhsEnterpriseMapper.xml | 64 +++ .../mapper/ehs/EhsNoticeMessageMapper.xml | 5 +- ruoyi-ui/src/api/ehs/ehsEnterprise.js | 44 ++ .../src/views/ehs/ehsEnterprise/index.vue | 467 ++++++++++++++++++ .../src/views/ehs/ehsNoticeMessage/index.vue | 17 +- .../views/ehs/ehsNoticeMessage/indexDept.vue | 8 +- ruoyi-ui/src/views/ehs/ehsRisk/index.vue | 2 +- ruoyi-ui/vue.config.js | 2 +- 15 files changed, 929 insertions(+), 15 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsEnterpriseController.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/domain/EhsEnterprise.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/mapper/EhsEnterpriseMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/service/IEhsEnterpriseService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/service/impl/EhsEnterpriseServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/ehs/EhsEnterpriseMapper.xml create mode 100644 ruoyi-ui/src/api/ehs/ehsEnterprise.js create mode 100644 ruoyi-ui/src/views/ehs/ehsEnterprise/index.vue diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsEnterpriseController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsEnterpriseController.java new file mode 100644 index 0000000..0781827 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsEnterpriseController.java @@ -0,0 +1,111 @@ +package com.ruoyi.web.controller.ehs; + +import java.util.List; +import java.util.Arrays; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.ehsEnterprise.domain.EhsEnterprise; +import com.ruoyi.ehsEnterprise.service.IEhsEnterpriseService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 企业基本信息Controller + * + * @author ruoyi + * @date 2023-12-08 + */ +@Api(tags="企业基本信息管理") +@RestController +@RequestMapping("/ehsEnterprise/ehsEnterprise") +public class EhsEnterpriseController extends BaseController +{ + @Autowired + private IEhsEnterpriseService ehsEnterpriseService; + +/** + * 查询企业基本信息列表 + */ +@PreAuthorize("@ss.hasPermi('ehsEnterprise:ehsEnterprise:list')") +@GetMapping("/list") + public TableDataInfo list(EhsEnterprise ehsEnterprise) + { + startPage(); + List list = ehsEnterpriseService.selectEhsEnterpriseList(ehsEnterprise); + return getDataTable(list); + } + + /** + * 导出企业基本信息列表 + */ + @PreAuthorize("@ss.hasPermi('ehsEnterprise:ehsEnterprise:export')") + @Log(title = "企业基本信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, EhsEnterprise ehsEnterprise) + { + List list = ehsEnterpriseService.selectEhsEnterpriseList(ehsEnterprise); + ExcelUtil util = new ExcelUtil(EhsEnterprise.class); + util.exportExcel(response, list, "企业基本信息数据"); + } + + /** + * 获取企业基本信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('ehsEnterprise:ehsEnterprise:query')") + @GetMapping(value = "/{enterpriseId}") + public AjaxResult getInfo(@PathVariable("enterpriseId") Long enterpriseId) + { + return success(ehsEnterpriseService.selectEhsEnterpriseByEnterpriseId(enterpriseId)); + } + + /** + * 新增企业基本信息 + */ + @ApiOperation("新增企业基本信息") + @PreAuthorize("@ss.hasPermi('ehsEnterprise:ehsEnterprise:add')") + @Log(title = "企业基本信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody EhsEnterprise ehsEnterprise) + { + return toAjax(ehsEnterpriseService.save(ehsEnterprise)); + } + + /** + * 修改企业基本信息 + */ + @ApiOperation("修改企业基本信息") + @PreAuthorize("@ss.hasPermi('ehsEnterprise:ehsEnterprise:edit')") + @Log(title = "企业基本信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody EhsEnterprise ehsEnterprise) + { + return toAjax(ehsEnterpriseService.updateById(ehsEnterprise)); + } + + /** + * 删除企业基本信息 + */ + @ApiOperation("删除企业基本信息") + @PreAuthorize("@ss.hasPermi('ehsEnterprise:ehsEnterprise:remove')") + @Log(title = "企业基本信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{enterpriseIds}") + public AjaxResult remove(@PathVariable Long[] enterpriseIds) + { + return toAjax(ehsEnterpriseService.removeByIds(Arrays.asList(enterpriseIds))); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index d9f2b13..c831bf1 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -107,8 +107,8 @@ public class FileUploadUtils { throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); } - - assertAllowed(file, allowedExtension); + //验证扩展名和文件大小 + //assertAllowed(file, allowedExtension); String fileName = extractFilename(file); diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/domain/EhsEnterprise.java b/ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/domain/EhsEnterprise.java new file mode 100644 index 0000000..f2f29f2 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/domain/EhsEnterprise.java @@ -0,0 +1,81 @@ +package com.ruoyi.ehsEnterprise.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 企业基本信息对象 ehs_enterprise + * + * @author ruoyi + * @date 2023-12-08 + */ +@Data +@ToString +@NoArgsConstructor +@Accessors(chain = true) +@TableName("ehs_enterprise") +public class EhsEnterprise extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** */ + @TableId(type= IdType.AUTO) + private Long enterpriseId; + + /** 社会信用代码 */ + @Excel(name = "社会信用代码") + private String enterpriseCode; + + /** 名称 */ + @Excel(name = "名称") + private String enterpriseName; + + /** 行业 */ + @Excel(name = "行业") + private String enterpriseType; + + /** 生产经营地址 */ + @Excel(name = "生产经营地址") + private String enterpriseAddr; + + /** 企业负责人 */ + @Excel(name = "企业负责人") + private String enterpriseLeader; + + /** 企业负责人电话 */ + @Excel(name = "企业负责人电话") + private String leaderTel; + + /** 注册资本 */ + @Excel(name = "注册资本") + private String registeredCapital; + + /** 营业执照核定的经营范围 */ + @Excel(name = "营业执照核定的经营范围") + private String businessScope; + + /** 企业实际从事的经营项目 */ + @Excel(name = "企业实际从事的经营项目") + private String businessProjects; + + /** 企业现状(0停业、1正常经营) */ + @Excel(name = "企业现状", readConverterExp = "0=停业、1正常经营") + private String enterpriseStatus; + + /** 分管安全副职姓名 */ + @Excel(name = "分管安全副职姓名") + private String safetyManagerName; + + /** 分管安全副职电话 */ + @Excel(name = "分管安全副职电话") + private String safetyManagerTel; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/mapper/EhsEnterpriseMapper.java b/ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/mapper/EhsEnterpriseMapper.java new file mode 100644 index 0000000..d1910a1 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/mapper/EhsEnterpriseMapper.java @@ -0,0 +1,29 @@ +package com.ruoyi.ehsEnterprise.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.ehsEnterprise.domain.EhsEnterprise; +import java.util.List; + +/** + * 企业基本信息Mapper接口 + * + * @author ruoyi + * @date 2023-12-08 + */ +public interface EhsEnterpriseMapper extends BaseMapper { + /** + * 查询企业基本信息 + * + * @param enterpriseId 企业基本信息主键 + * @return 企业基本信息 + */ + public EhsEnterprise selectEhsEnterpriseByEnterpriseId(Long enterpriseId); + + /** + * 查询企业基本信息列表 + * + * @param ehsEnterprise 企业基本信息 + * @return 企业基本信息集合 + */ + public List selectEhsEnterpriseList(EhsEnterprise ehsEnterprise); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/service/IEhsEnterpriseService.java b/ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/service/IEhsEnterpriseService.java new file mode 100644 index 0000000..e880e85 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/service/IEhsEnterpriseService.java @@ -0,0 +1,31 @@ +package com.ruoyi.ehsEnterprise.service; + +import java.util.List; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.ehsEnterprise.domain.EhsEnterprise; + +/** + * 企业基本信息Service接口 + * + * @author ruoyi + * @date 2023-12-08 + */ +public interface IEhsEnterpriseService extends IService { + + /** + * 查询企业基本信息 + * + * @param enterpriseId 企业基本信息主键 + * @return 企业基本信息 + */ + public EhsEnterprise selectEhsEnterpriseByEnterpriseId(Long enterpriseId); + + /** + * 查询企业基本信息列表 + * + * @param ehsEnterprise 企业基本信息 + * @return 企业基本信息集合 + */ + public List selectEhsEnterpriseList(EhsEnterprise ehsEnterprise); + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/service/impl/EhsEnterpriseServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/service/impl/EhsEnterpriseServiceImpl.java new file mode 100644 index 0000000..b999156 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsEnterprise/service/impl/EhsEnterpriseServiceImpl.java @@ -0,0 +1,74 @@ +package com.ruoyi.ehsEnterprise.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import com.ruoyi.common.utils.StringUtils; +import java.util.List; +import java.util.Map; +import com.ruoyi.ehsEnterprise.mapper.EhsEnterpriseMapper; +import com.ruoyi.ehsEnterprise.domain.EhsEnterprise; +import com.ruoyi.ehsEnterprise.service.IEhsEnterpriseService; + +/** + * 企业基本信息Service业务层处理 + * + * @author ruoyi + * @date 2023-12-08 + */ +@Service +public class EhsEnterpriseServiceImpl extends ServiceImpl implements IEhsEnterpriseService { + + @Autowired + private EhsEnterpriseMapper ehsEnterpriseMapper; + + /** + * 查询企业基本信息 + * + * @param enterpriseId 企业基本信息主键 + * @return 企业基本信息 + */ + @Override + public EhsEnterprise selectEhsEnterpriseByEnterpriseId(Long enterpriseId) + { + return ehsEnterpriseMapper.selectEhsEnterpriseByEnterpriseId(enterpriseId); + } + + /** + * 查询企业基本信息列表 + * + * @param ehsEnterprise 企业基本信息 + * @return 企业基本信息 + */ + @Override + public List selectEhsEnterpriseList(EhsEnterprise ehsEnterprise) + { + return ehsEnterpriseMapper.selectEhsEnterpriseList(ehsEnterprise); + } + + + private LambdaQueryWrapper buildQueryWrapper(EhsEnterprise query) { + Map params = query.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.like(StringUtils.isNotBlank(query.getEnterpriseCode()), EhsEnterprise::getEnterpriseCode, query.getEnterpriseCode()); + lqw.like(StringUtils.isNotBlank(query.getEnterpriseName()), EhsEnterprise::getEnterpriseName, query.getEnterpriseName()); + lqw.eq(StringUtils.isNotBlank(query.getEnterpriseType()), EhsEnterprise::getEnterpriseType, query.getEnterpriseType()); + lqw.like(StringUtils.isNotBlank(query.getEnterpriseAddr()), EhsEnterprise::getEnterpriseAddr, query.getEnterpriseAddr()); + lqw.like(StringUtils.isNotBlank(query.getEnterpriseLeader()), EhsEnterprise::getEnterpriseLeader, query.getEnterpriseLeader()); + lqw.like(StringUtils.isNotBlank(query.getLeaderTel()), EhsEnterprise::getLeaderTel, query.getLeaderTel()); + lqw.like(StringUtils.isNotBlank(query.getRegisteredCapital()), EhsEnterprise::getRegisteredCapital, query.getRegisteredCapital()); + lqw.like(StringUtils.isNotBlank(query.getBusinessScope()), EhsEnterprise::getBusinessScope, query.getBusinessScope()); + lqw.like(StringUtils.isNotBlank(query.getBusinessProjects()), EhsEnterprise::getBusinessProjects, query.getBusinessProjects()); + lqw.eq(StringUtils.isNotBlank(query.getEnterpriseStatus()), EhsEnterprise::getEnterpriseStatus, query.getEnterpriseStatus()); + lqw.like(StringUtils.isNotBlank(query.getSafetyManagerName()), EhsEnterprise::getSafetyManagerName, query.getSafetyManagerName()); + lqw.like(StringUtils.isNotBlank(query.getSafetyManagerTel()), EhsEnterprise::getSafetyManagerTel, query.getSafetyManagerTel()); + lqw.orderByDesc(EhsEnterprise::getCreateTime); + lqw.eq(query.getDeptId() != null, EhsEnterprise::getDeptId, query.getDeptId()); + lqw.eq(query.getCreateUserId() != null, EhsEnterprise::getCreateUserId, query.getCreateUserId()); + lqw.eq(query.getUpdateUserId() != null, EhsEnterprise::getUpdateUserId, query.getUpdateUserId()); + return lqw; + } + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsNoticeMessage/domain/EhsNoticeMessage.java b/ruoyi-system/src/main/java/com/ruoyi/ehsNoticeMessage/domain/EhsNoticeMessage.java index 24bb376..898fdc0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/ehsNoticeMessage/domain/EhsNoticeMessage.java +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsNoticeMessage/domain/EhsNoticeMessage.java @@ -40,8 +40,11 @@ public class EhsNoticeMessage extends BaseEntity /** 文件下载列表 */ @Excel(name = "文件下载列表") + @TableField(exist = false) private String fileName; - + /** 临时任务的下载模板 */ + @Excel(name = "下载模板") + private String fileTempName; /** 1:未发布 2:已发布 */ @Excel(name = "0:未发布 1:已发布") private String status; diff --git a/ruoyi-system/src/main/resources/mapper/ehs/EhsEnterpriseMapper.xml b/ruoyi-system/src/main/resources/mapper/ehs/EhsEnterpriseMapper.xml new file mode 100644 index 0000000..f45f844 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/ehs/EhsEnterpriseMapper.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select enterprise_id, enterprise_code, enterprise_name, enterprise_type, enterprise_addr, Enterprise_leader, leader_tel, registered_capital, business_scope, business_projects, enterprise_status, safety_manager_name, safety_manager_tel, create_by, create_time, update_by, update_time, remark, dept_id, create_user_id, update_user_id from ehs_enterprise + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/ehs/EhsNoticeMessageMapper.xml b/ruoyi-system/src/main/resources/mapper/ehs/EhsNoticeMessageMapper.xml index f3cab22..a04d1ed 100644 --- a/ruoyi-system/src/main/resources/mapper/ehs/EhsNoticeMessageMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/ehs/EhsNoticeMessageMapper.xml @@ -9,6 +9,7 @@ + @@ -33,12 +34,12 @@ - select notice_message_id, title, display_content, file_name, status, read_dept_id, mesg_type, dept_list, all_dept, create_dept_id, create_by, create_time, update_by, update_time, remark, dept_id, create_user_id, update_user_id from ehs_notice_message + select notice_message_id, title, display_content, file_temp_name, status, read_dept_id, mesg_type, dept_list, all_dept, create_dept_id, create_by, create_time, update_by, update_time, remark, dept_id, create_user_id, update_user_id from ehs_notice_message