危化品全生命周期管理后端
“djh”
2025-04-21 437f8e2b89a18363a1073fdbb3ab99bcd840a757
危化品新版修改
已修改38个文件
已删除1个文件
3480 ■■■■■ 文件已修改
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzHazmatController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzHazmatFlowController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzProductController.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzProductEntryRecordController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzProductFlowController.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzStatisticController.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzWarningController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-admin/src/main/resources/application-dev.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-admin/src/main/resources/db/migration/V20250306002_add_cupboard.sql 3059 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-common/src/main/java/com/gkhy/hazmat/common/domain/entity/SysUser.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-common/src/main/java/com/gkhy/hazmat/common/enums/UserTypeEnum.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-framework/src/main/java/com/gkhy/hazmat/framework/web/service/UserDetailServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/SysCompany.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/SysConfig.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzWarningMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzHazmatFlowService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzHazmatService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzProductEntryRecordService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzProductFlowService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzStatisticService.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzWarningService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzEntryRecordServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatBasicServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatFlowServiceImpl.java 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatServiceImpl.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductBasicServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductEntryRecordServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductFlowServiceImpl.java 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductServiceImpl.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzStatisticServiceImpl.java 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzWarningServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/SysDeptServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/SysUserServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/TaBooWarningServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/resources/mapper/system/HzEntryRecordMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/resources/mapper/system/HzHazmatMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/resources/mapper/system/HzWarningMapper.xml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/resources/mapper/system/SysCompanyMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-system/src/main/resources/mapper/system/SysConfigMapper.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzHazmatController.java
@@ -33,7 +33,8 @@
            @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
            @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"),
            @ApiImplicitParam(paramType = "query", name = "warehouseId", dataType = "long", required = true, value = "仓库id"),
            @ApiImplicitParam(paramType = "query", name = "basicId", dataType = "long", required = true, value = "危化品基础数据id")
            @ApiImplicitParam(paramType = "query", name = "basicId", dataType = "long", required = true, value = "危化品基础数据id"),
            @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "long", required = false, value = "公司ID")
    })
    @GetMapping("/list")
    public CommonResult list(HzHazmat hazmat){
@@ -46,7 +47,8 @@
            @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
            @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"),
            @ApiImplicitParam(paramType = "query", name = "warehouseId", dataType = "long", required = true, value = "仓库id"),
            @ApiImplicitParam(paramType = "query", name = "basicId", dataType = "long", required = true, value = "危化品基础数据id")
            @ApiImplicitParam(paramType = "query", name = "basicId", dataType = "long", required = true, value = "危化品基础数据id"),
            @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "long", required = false, value = "公司id"),
    })
    @GetMapping("/hazmatCollect")
    public CommonResult hazmatCollect(HzHazmat hazmat){
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzHazmatFlowController.java
@@ -35,7 +35,9 @@
    @ApiOperation(value = "流向列表(分页)")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
            @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10")
            @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"),
            @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "long", required = false, value = "公司id"),
    })
    @GetMapping("/list")
    public CommonResult list(HzHazmatFlow hazmatFlow){
@@ -51,9 +53,14 @@
    @ApiOperation(value = "根据危化品id查询危化品所有流向")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "hazmatId", dataType = "long", required = false, value = "公司id"),
            @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "long", required = false, value = "公司id"),
    })
    @GetMapping(value = { "/getAllHazmatFlowByHazmatId" })
    public CommonResult getAllHazmatFlowByHazmatId(Long hazmatId){
        return CommonResult.success(hazmatFlowService.getAllHazmatFlowByHazmatId(hazmatId));
    public CommonResult getAllHazmatFlowByHazmatId(Long hazmatId,Long companyId){
        return CommonResult.success(hazmatFlowService.getAllHazmatFlowByHazmatId(hazmatId,companyId));
    }
    @RepeatSubmit
@@ -64,14 +71,14 @@
        return CommonResult.success(hazmatFlowService.deleteHazmatFlowById(hazmatFlowId));
    }
    @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common')")
    @PreAuthorize("hasAnyAuthority('hazmat:manage:company','hazmat:manage:common','hazmat:manage:system')")
    @ApiOperation(value = "根据条码code查询危化品所有流向")
    @GetMapping(value = { "/getHazmatFlowByCode" })
    public CommonResult getAllHazmatFlowByCode(@RequestParam(required = true) String  code){
    public CommonResult getAllHazmatFlowByCode(@RequestParam(required = true) String  code,@RequestParam("companyId") Long companyId){
        if(code.startsWith(CodePrexEnum.MATERIAL.getCode())){
            return CommonResult.success(hazmatFlowService.selectAllHazmatFlowByCode(code));
            return CommonResult.success(hazmatFlowService.selectAllHazmatFlowByCode(code,companyId));
        }else if(code.startsWith(CodePrexEnum.GOOD.getCode())){
            return CommonResult.success(productFlowService.selectAllProductFlowByCode(code));
            return CommonResult.success(productFlowService.selectAllProductFlowByCode(code,companyId));
        }else{
            return CommonResult.failed("条码格式不正确");
        }
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzProductController.java
@@ -33,7 +33,8 @@
            @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
            @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"),
            @ApiImplicitParam(paramType = "query", name = "warehouseId", dataType = "long", required = true, value = "仓库id"),
            @ApiImplicitParam(paramType = "query", name = "basicId", dataType = "long", required = true, value = "成品基础数据id")
            @ApiImplicitParam(paramType = "query", name = "basicId", dataType = "long", required = true, value = "成品基础数据id"),
            @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "long", required = false, value = "企业ID")
    })
    @GetMapping("/list")
@@ -46,7 +47,9 @@
            @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
            @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"),
            @ApiImplicitParam(paramType = "query", name = "warehouseId", dataType = "long", required = true, value = "仓库id"),
            @ApiImplicitParam(paramType = "query", name = "basicId", dataType = "long", required = true, value = "成品基础数据id")
            @ApiImplicitParam(paramType = "query", name = "basicId", dataType = "long", required = true, value = "成品基础数据id"),
            @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "long", required = false, value = "公司id"),
    })
    @GetMapping("/productCollect")
    public CommonResult productCollect(HzProduct product){
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzProductEntryRecordController.java
@@ -44,11 +44,12 @@
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
            @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"),
            @ApiImplicitParam(paramType = "query", name = "entryId", dataType = "long", required = true, value = "入库id")
            @ApiImplicitParam(paramType = "query", name = "entryId", dataType = "long", required = true, value = "入库id"),
            @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "long", required = false, value = "公司ID")
    })
    @GetMapping("/productlist")
    public CommonResult productlist(Long entryId){
        return CommonResult.success(entryRecordService.selectProductListByEntryId(entryId));
    public CommonResult productlist(Long entryId,Long companyId){
        return CommonResult.success(entryRecordService.selectProductListByEntryId(entryId,companyId));
    }
    @RepeatSubmit
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzProductFlowController.java
@@ -31,7 +31,9 @@
    @ApiOperation(value = "流向列表(分页)")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
            @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10")
            @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"),
            @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "long", required = false, value = "公司id"),
    })
    @GetMapping("/list")
    public CommonResult list(HzProductFlow productFlow){
@@ -40,9 +42,13 @@
    @ApiOperation(value = "根据成品id查询危化品所有流向")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "productId", dataType = "long", required = false, value = "产品ID"),
            @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "long", required = false, value = "公司id"),
    })
    @GetMapping(value = { "/getAllProductFlowByProductId" })
    public CommonResult getAllProductFlowByProductId(Long productId){
        return CommonResult.success(productFlowService.getAllProductFlowByProductId(productId));
    public CommonResult getAllProductFlowByProductId(Long productId,Long companyId){
        return CommonResult.success(productFlowService.getAllProductFlowByProductId(productId,companyId));
    }
    @RepeatSubmit
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzStatisticController.java
@@ -33,27 +33,39 @@
    private HzStatisticService statisticService;
    @ApiOperation(value = "30天入库数量统计")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query",name = "companyId",dataType ="long",required = false,value = "公司id")
    })
    @GetMapping("/entryStatistic")
    public CommonResult entryStatistic() {
        return CommonResult.success(statisticService.entryStatic());
    public CommonResult entryStatistic(Long companyId) {
        return CommonResult.success(statisticService.entryStatic(companyId));
    }
    @ApiOperation(value = "一周使用数量统计")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query",name = "companyId",dataType ="long",required = false,value = "公司id")
    })
    @GetMapping("/useStatistic")
    public CommonResult useStatistic() {
        return CommonResult.success(statisticService.useEverydayStatic());
    public CommonResult useStatistic(Long companyId) {
        return CommonResult.success(statisticService.useEverydayStatic(companyId));
    }
    @ApiOperation(value = "一周使用频繁的危化品数量统计")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query",name = "companyId",dataType ="long",required = false,value = "公司id")
    })
    @GetMapping("/maxUseStatistic")
    public CommonResult maxUseStatistic() {
        return CommonResult.success(statisticService.maxUseStatic());
    public CommonResult maxUseStatistic(Long companyId) {
        return CommonResult.success(statisticService.maxUseStatic(companyId));
    }
    @ApiOperation(value = "首页数据统计")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query",name = "companyId",dataType ="long",required = false,value = "公司id")
    })
    @GetMapping("/homeDataStatistic")
    public CommonResult homeDataStatistic() {
        return CommonResult.success(statisticService.homeDataStatistic());
    public CommonResult homeDataStatistic(Long companyId) {
        return CommonResult.success(statisticService.homeDataStatistic(companyId));
    }
@@ -63,11 +75,12 @@
            @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
            @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"),
            @ApiImplicitParam(paramType = "query", name = "startTime", dataType = "string", required = false, value = "开始时间,格式xxxx-xx-xx 00:00:00"),
            @ApiImplicitParam(paramType = "query", name = "endTime", dataType = "string", required = false, value = "结束时间,格式xxxx-xx-xx 23:59:59")
            @ApiImplicitParam(paramType = "query", name = "endTime", dataType = "string", required = false, value = "结束时间,格式xxxx-xx-xx 23:59:59"),
            @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "long", required = false, value = "企业id")
    })
    @GetMapping("/hazmatUseStatistic")
    public CommonResult hazmatUseStatistic(String startTime,String endTime) {
        return CommonResult.success(statisticService.useStatic(startTime,endTime));
    public CommonResult hazmatUseStatistic(String startTime,String endTime,Long companyId) {
        return CommonResult.success(statisticService.useStatic(startTime,endTime,companyId));
    }
    @ApiOperation(value = "危化品使用记录导出")
hazmat-admin/src/main/java/com/gkhy/hazmat/admin/controller/web/HzWarningController.java
@@ -32,7 +32,8 @@
    @ApiOperation(value = "预警列表(分页)")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
            @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10")
            @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"),
            @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "long", required = false, value = "公司id")
    })
    @GetMapping("/list")
    public CommonResult list(HzWarning warning){
@@ -41,8 +42,8 @@
    @ApiOperation(value = "未处理预警数量")
    @GetMapping("/warningCount")
    public CommonResult warningCount(){
        return CommonResult.success(warningService.selectWarningCount());
    public CommonResult warningCount(Long companyId){
        return CommonResult.success(warningService.selectWarningCount(companyId));
    }
    @RepeatSubmit
hazmat-admin/src/main/resources/application-dev.yml
@@ -5,7 +5,7 @@
    druid:
      # 主库数据源
      master:
        url: jdbc:mysql://192.168.2.16:7006/hazmat_manage?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&allowMultiQueries=true
        url: jdbc:mysql://192.168.2.29:7006/hazmat_manage?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&allowMultiQueries=true
        username: root
        password: 2farwL3yPXfbH2AP
      # 从库数据源
@@ -44,7 +44,7 @@
    database: 1
    host: 127.0.0.1
    port: 6379
    password:
    password: akj78avauba789a
# mybatis-plus相关配置
hazmat-admin/src/main/resources/db/migration/V20250306002_add_cupboard.sql
文件已删除
hazmat-common/src/main/java/com/gkhy/hazmat/common/domain/entity/SysUser.java
@@ -50,7 +50,7 @@
    private String name;
    @NotNull(message = "用户类型不能为空")
    @ApiModelProperty(value = "用户类型(0系统用户,1企业级用户,2普通用户,默认0)",required = true)
    @ApiModelProperty(value = "用户类型(0系统用户,1企业级用户,2普通用户,3监管部门,默认0)",required = true)
    @TableField("user_type")
    private Integer userType;
hazmat-common/src/main/java/com/gkhy/hazmat/common/enums/UserTypeEnum.java
@@ -8,7 +8,8 @@
{
    SYSTEM_USER(0, "系统用户"),
    COMPANY_USER(1, "企业级用户"),
    NORMAL_USER(2, "普通用户");
    NORMAL_USER(2, "普通用户"),
    CHECK_USER(3,"监管部门");
    private final Integer code;
    private final String info;
hazmat-framework/src/main/java/com/gkhy/hazmat/framework/web/service/UserDetailServiceImpl.java
@@ -47,7 +47,7 @@
        {
            log.info("登录用户:{} 已被停用.", username);
            throw new ApiException("登录用户已被停用");
        }else if(!UserTypeEnum.SYSTEM_USER.getCode().equals(user.getUserType())&&user.getCompanyId()==null){
        }else if(!UserTypeEnum.SYSTEM_USER.getCode().equals(user.getUserType())&&!UserTypeEnum.CHECK_USER.getCode().equals(user.getUserType())&&user.getCompanyId()==null){
            log.info("登录用户:{} 公司信息缺失.", username);
            throw new ApiException("登录用户公司信息缺失");
        }
@@ -58,6 +58,8 @@
            authorities.add(new SimpleGrantedAuthority("hazmat:manage:company"));
        }else if(UserTypeEnum.NORMAL_USER.getCode().equals(user.getUserType())){
            authorities.add(new SimpleGrantedAuthority("hazmat:manage:common"));
        }else if (UserTypeEnum.CHECK_USER.getCode().equals(user.getUserType())){
            authorities.add(new SimpleGrantedAuthority("hazmat:manage:system"));
        }
        return new LoginUserDetails(user,authorities);
    }
hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/SysCompany.java
@@ -11,6 +11,7 @@
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
@@ -59,6 +60,11 @@
    @TableField("phone")
    private String phone;
    @NotNull(message = "企业类型不能为空")
    @ApiModelProperty("企业类型为 0研发类 1生产类  2中试类")
    @TableField("type")
    private Integer type;
    @ApiModelProperty("删除标志,0未删除,1删除,默认0")
    @TableField("del_flag")
    private Integer delFlag;
hazmat-system/src/main/java/com/gkhy/hazmat/system/domain/SysConfig.java
@@ -12,6 +12,7 @@
import lombok.Setter;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
@@ -28,7 +29,7 @@
@Setter
@Accessors(chain = true)
@TableName("sys_config")
@ApiModel(value = "SysConfig对象", description = "系统配置表")
@ApiModel(value = "SysConfig对象", description = "企业配置表")
@JsonInclude(NON_NULL)
public class SysConfig extends BaseEntity {
@@ -52,6 +53,16 @@
    @TableField("company_id")
    private Long companyId;
    @NotBlank(message = "公司经度不能为空")
    @ApiModelProperty("公司经度")
    @TableField("longitude")
    private String longitude;
    @NotBlank(message = "公司纬度不能为空")
    @ApiModelProperty("公司纬度")
    @TableField("latitude")
    private String latitude;
    @ApiModelProperty("公司名称")
    @TableField(exist = false)
    private String companyName;
hazmat-system/src/main/java/com/gkhy/hazmat/system/mapper/HzWarningMapper.java
@@ -37,4 +37,7 @@
     * @return
     */
    Integer selectWarningCount(Long companyId);
}
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzHazmatFlowService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.gkhy.hazmat.common.api.CommonPage;
import com.gkhy.hazmat.system.domain.HzHazmatFlow;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -62,7 +63,7 @@
     * @param code
     * @return
     */
    List<HzHazmatFlow> selectAllHazmatFlowByCode(String code);
    List<HzHazmatFlow> selectAllHazmatFlowByCode(String code,Long companyId);
    /**
     * 根据用户分页查询所有流向
@@ -75,5 +76,5 @@
     * @param hazmatId
     * @return
     */
    List<HzHazmatFlow> getAllHazmatFlowByHazmatId(Long hazmatId);
    List<HzHazmatFlow> getAllHazmatFlowByHazmatId(Long hazmatId,Long companyId);
}
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzHazmatService.java
@@ -1,8 +1,10 @@
package com.gkhy.hazmat.system.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gkhy.hazmat.common.api.CommonPage;
import com.gkhy.hazmat.system.domain.HzHazmat;
import com.gkhy.hazmat.system.domain.vo.HzHazmatWarehouseVO;
/**
 * <p>
@@ -24,6 +26,7 @@
    /**
     * 根据条件按仓库和危化品基础数据汇总数据
     *
     * @param hzHazmat
     * @return
     */
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzProductEntryRecordService.java
@@ -66,5 +66,5 @@
     * @param entryId
     * @return
     */
    CommonPage selectProductListByEntryId(Long entryId);
    CommonPage selectProductListByEntryId(Long entryId,Long companyId);
}
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzProductFlowService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.gkhy.hazmat.common.api.CommonPage;
import com.gkhy.hazmat.system.domain.HzProductFlow;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -58,7 +59,7 @@
     * @param code
     * @return
     */
    List<HzProductFlow> selectAllProductFlowByCode(String code);
    List<HzProductFlow> selectAllProductFlowByCode(String code, Long companyId);
    /**
     * 根据当前用户分页查询流向
@@ -71,5 +72,5 @@
     * @param productId
     * @return
     */
    List<HzProductFlow> getAllProductFlowByProductId(Long productId);
    List<HzProductFlow> getAllProductFlowByProductId(Long productId,Long companyId);
}
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzStatisticService.java
@@ -18,25 +18,25 @@
     * 一周入库统计
     * @return
     */
    public List<HzEntryRecordVO> entryStatic();
    public List<HzEntryRecordVO> entryStatic(Long companyId);
    /**
     * 一周领用统计
     * @return
     */
    public List<HzEntryRecordVO> useEverydayStatic();
    public List<HzEntryRecordVO> useEverydayStatic(Long companyId);
    /**
     * 一周领用最多的危化品(最多前10个)
     * @return
     */
    public List<HzHazmatUseVO> maxUseStatic();
    public List<HzHazmatUseVO> maxUseStatic(Long companyId);
    /**
     * 首页数据统计
     * @return
     */
    HzHomeDataVO homeDataStatistic();
    HzHomeDataVO homeDataStatistic(Long companyId);
    /**
     * 分页统计危化品使用数量
@@ -44,7 +44,7 @@
     * @param endTime
     * @return
     */
    CommonPage useStatic(String startTime, String endTime);
    CommonPage useStatic(String startTime, String endTime,Long companyId);
    void importBaiscUse(HttpServletResponse response, String startTime, String endTime) throws IOException;
}
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/HzWarningService.java
@@ -51,5 +51,5 @@
     * 获取未处理预警数量
     * @return
     */
    Integer selectWarningCount();
    Integer selectWarningCount(Long companyId);
}
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzEntryRecordServiceImpl.java
@@ -66,7 +66,7 @@
    @Override
    public CommonPage selectEntryRecordList(HzEntryRecord entryRecord) {
        SysUser currentUser = SecurityUtils.getLoginUser().getUser();
        if (!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())) {
        if (!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) && !currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())) {
            entryRecord.setCompanyId(currentUser.getCompanyId());
        }
        PageUtils.startPage();
@@ -311,8 +311,12 @@
            throw new ApiException("入库信息不存在");
        }
        checkUserAllowed(entryRecord,currentUser);
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(entryRecord.getCompanyId());
        }else {
            //设置分表id
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        }
        PageUtils.startPage();
        List<HzHazmat> hazmatList = hazmatMapper.selectHazmatList(new HzHazmat().setEntryId(entryId));
        IdTableNameHandler.removeCurrentId();
@@ -324,8 +328,10 @@
            throw new ApiException("管理员不能操作");
        }
        if(entryRecord!=null){
            if(!Objects.equals(user.getCompanyId(), entryRecord.getCompanyId())){
                throw new ApiException("无权限操作其他企业数据");
            if (!user.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
                if(!Objects.equals(user.getCompanyId(), entryRecord.getCompanyId())){
                    throw new ApiException("无权限操作其他企业数据");
                }
            }
        }
    }
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatBasicServiceImpl.java
@@ -50,7 +50,7 @@
    @Override
    public CommonPage selectHazmatBasicList(HzHazmatBasic hazmatBasic) {
        SysUser currentUser = SecurityUtils.getLoginUser().getUser();
        if (!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())) {
        if (!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) && !currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())) {
            hazmatBasic.setCompanyId(currentUser.getCompanyId());
        }
        PageUtils.startPage();
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatFlowServiceImpl.java
@@ -1,5 +1,7 @@
package com.gkhy.hazmat.system.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.hazmat.common.api.CommonPage;
import com.gkhy.hazmat.common.config.IdTableNameHandler;
@@ -17,8 +19,10 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
 * <p>
@@ -37,9 +41,14 @@
    public CommonPage selectHazmatFlowList(HzHazmatFlow hazmatFlow) {
        SysUser currentUser = SecurityUtils.getLoginUser().getUser();
        checkUserAllowed(null,currentUser);
        hazmatFlow.setCompanyId(currentUser.getCompanyId());
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(hazmatFlow.getCompanyId());
        }else {
            hazmatFlow.setCompanyId(currentUser.getCompanyId());
            //设置分表id
            //todo
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        }
        PageUtils.startPage();
        List<HzHazmatFlow> flowList = baseMapper.selectHazmatFlowList(hazmatFlow);
        IdTableNameHandler.removeCurrentId();
@@ -109,15 +118,19 @@
    }
    @Override
    public List<HzHazmatFlow> selectAllHazmatFlowByCode(String code) {
    public List<HzHazmatFlow> selectAllHazmatFlowByCode(String code,Long companyId) {
        SysUser currentUser=SecurityUtils.getLoginUser().getUser();
        checkUserAllowed(null,currentUser);
        if(!code.startsWith(CodePrexEnum.MATERIAL.getCode())){
            throw new ApiException("条码格式不正确");
        }
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        HzHazmat hazmat=hazmatMapper.selectHazmatByCode(code,currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(companyId);
        }else {
            //设置分表id
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        }
        HzHazmat hazmat=hazmatMapper.selectHazmatByCode(code,currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())?companyId:currentUser.getCompanyId());
        if(hazmat==null){
            throw new ApiException("危化品条码数据不存在");
        }
@@ -142,11 +155,15 @@
    }
    @Override
    public List<HzHazmatFlow> getAllHazmatFlowByHazmatId(Long hazmatId) {
    public List<HzHazmatFlow> getAllHazmatFlowByHazmatId(Long hazmatId,Long companyId) {
        SysUser currentUser=SecurityUtils.getLoginUser().getUser();
        checkUserAllowed(null,currentUser);
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(companyId);
        }else {
            //设置分表id
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        }
        HzHazmat hazmat=hazmatMapper.selectById(hazmatId);
        if(hazmat==null){
            throw new ApiException("危化品数据不存在");
@@ -162,8 +179,10 @@
            throw new ApiException("管理员不能操作");
        }
        if(hazmatFlow!=null){
            if(!Objects.equals(user.getCompanyId(), hazmatFlow.getCompanyId())){
                throw new ApiException("无权限操作其他企业数据");
            if (!user.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
                if(!Objects.equals(user.getCompanyId(), hazmatFlow.getCompanyId())){
                    throw new ApiException("无权限操作其他企业数据");
                }
            }
        }
    }
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatServiceImpl.java
@@ -1,7 +1,10 @@
package com.gkhy.hazmat.system.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.gkhy.hazmat.common.api.CommonPage;
import com.gkhy.hazmat.common.config.IdTableNameHandler;
import com.gkhy.hazmat.common.domain.entity.SysUser;
@@ -21,6 +24,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -54,9 +58,13 @@
        }
        SysUser currentUser = SecurityUtils.getLoginUser().getUser();
        checkUserAllowed(null,currentUser);
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        hzHazmat.setCompanyId(currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(hzHazmat.getCompanyId());
        }else {
            //设置分表id
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
            hzHazmat.setCompanyId(currentUser.getCompanyId());
        }
        PageUtils.startPage();
        List<HzHazmat> hazmatList = baseMapper.selectHazmatList(hzHazmat);
        IdTableNameHandler.removeCurrentId();
@@ -67,9 +75,14 @@
    public CommonPage selectHazmatGroupWarehouse(HzHazmat hzHazmat) {
        SysUser currentUser = SecurityUtils.getLoginUser().getUser();
        checkUserAllowed(null,currentUser);
        hzHazmat.setCompanyId(currentUser.getCompanyId());
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(hzHazmat.getCompanyId());
        }else {
            hzHazmat.setCompanyId(currentUser.getCompanyId());
            //设置分表id
            //todo
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        }
        PageUtils.startPage();
        List<HzHazmatWarehouseVO> hazmatList = baseMapper.selectHazmatGroupWareHouse(hzHazmat);
        if(!hazmatList.isEmpty()) {
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductBasicServiceImpl.java
@@ -50,7 +50,7 @@
    @Override
    public CommonPage selectProductBasicList(HzProductBasic productBasic) {
        SysUser currentUser = SecurityUtils.getLoginUser().getUser();
        if (!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())) {
        if (!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) && !currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())) {
            productBasic.setCompanyId(currentUser.getCompanyId());
        }
        PageUtils.startPage();
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductEntryRecordServiceImpl.java
@@ -56,7 +56,7 @@
    @Override
    public CommonPage selectEntryRecordList(HzProductEntryRecord entryRecord) {
        SysUser currentUser = SecurityUtils.getLoginUser().getUser();
        if (!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())) {
        if (!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())&&!currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())) {
            entryRecord.setCompanyId(currentUser.getCompanyId());
        }
        PageUtils.startPage();
@@ -236,15 +236,19 @@
    }
    @Override
    public CommonPage selectProductListByEntryId(Long entryId) {
    public CommonPage selectProductListByEntryId(Long entryId,Long companyId) {
        SysUser currentUser = SecurityUtils.getLoginUser().getUser();
        HzProductEntryRecord entryRecord=getById(entryId);
        if(entryRecord==null){
            throw new ApiException("入库信息不存在");
        }
        checkUserAllowed(entryRecord,currentUser);
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(companyId);
        }else {
            //设置分表id
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        }
        PageUtils.startPage();
        List<HzProduct> productList = productMapper.selectProductList(new HzProduct().setEntryId(entryId));
        IdTableNameHandler.removeCurrentId();
@@ -257,8 +261,10 @@
            throw new ApiException("管理员不能操作");
        }
        if(entryRecord!=null){
            if(!Objects.equals(user.getCompanyId(), entryRecord.getCompanyId())){
                throw new ApiException("无权限操作其他企业数据");
            if (!user.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
                if(!Objects.equals(user.getCompanyId(), entryRecord.getCompanyId())){
                    throw new ApiException("无权限操作其他企业数据");
                }
            }
        }
    }
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductFlowServiceImpl.java
@@ -37,9 +37,14 @@
    public CommonPage selectProductFlowList(HzProductFlow productFlow) {
        SysUser currentUser = SecurityUtils.getLoginUser().getUser();
        checkUserAllowed(null,currentUser);
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        productFlow.setCompanyId(currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(productFlow.getCompanyId());
        }else {
            //设置分表id
            //todo
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
            productFlow.setCompanyId(currentUser.getCompanyId());
        }
        PageUtils.startPage();
        List<HzProductFlow> flowList = baseMapper.selectProductFlowList(productFlow);
        IdTableNameHandler.removeCurrentId();
@@ -92,15 +97,20 @@
    }
    @Override
    public List<HzProductFlow> selectAllProductFlowByCode(String code) {
    public List<HzProductFlow> selectAllProductFlowByCode(String code,Long companyId) {
        SysUser currentUser=SecurityUtils.getLoginUser().getUser();
        checkUserAllowed(null,currentUser);
        if(!code.startsWith(CodePrexEnum.GOOD.getCode())){
            throw new ApiException("条码格式不正确");
        }
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        HzProduct product=productMapper.selectProductByCode(code,currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(companyId);
        }else {
            //设置分表id
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        }
        HzProduct product=productMapper.selectProductByCode(code,currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())?companyId:currentUser.getCompanyId());
        if(product==null){
            throw new ApiException("成品条码数据不存在");
        }
@@ -125,11 +135,15 @@
    }
    @Override
    public List<HzProductFlow> getAllProductFlowByProductId(Long productId) {
    public List<HzProductFlow> getAllProductFlowByProductId(Long productId,Long companyId) {
        SysUser currentUser=SecurityUtils.getLoginUser().getUser();
        checkUserAllowed(null,currentUser);
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(companyId);
        }else {
            //设置分表id
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        }
        HzProduct product=productMapper.selectById(productId);
        if(product==null){
            throw new ApiException("成品数据不存在");
@@ -145,8 +159,10 @@
            throw new ApiException("管理员不能操作");
        }
        if(productFlow!=null){
            if(!Objects.equals(user.getCompanyId(), productFlow.getCompanyId())){
                throw new ApiException("无权限操作其他企业数据");
            if (!user.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())) {
                if (!Objects.equals(user.getCompanyId(), productFlow.getCompanyId())) {
                    throw new ApiException("无权限操作其他企业数据");
                }
            }
        }
    }
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductServiceImpl.java
@@ -51,9 +51,13 @@
        }
        SysUser currentUser = SecurityUtils.getLoginUser().getUser();
        checkUserAllowed(null,currentUser);
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        product.setCompanyId(currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(product.getCompanyId());
        }else {
            //设置分表id
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
            product.setCompanyId(currentUser.getCompanyId());
        }
        PageUtils.startPage();
        List<HzProduct> productList = baseMapper.selectProductList(product);
        IdTableNameHandler.removeCurrentId();
@@ -206,9 +210,14 @@
    public CommonPage selectProductGroupWarehouse(HzProduct product) {
        SysUser currentUser = SecurityUtils.getLoginUser().getUser();
        checkUserAllowed(null,currentUser);
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        product.setCompanyId(currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(product.getCompanyId());
        }else {
            //设置分表id
            //todo
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
            product.setCompanyId(currentUser.getCompanyId());
        }
        PageUtils.startPage();
        List<HzProductWarehouseVO> productList = baseMapper.selectProductGroupWareHouse(product);
        if(!productList.isEmpty()) {
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzStatisticServiceImpl.java
@@ -51,7 +51,7 @@
    private HzWarningMapper warningMapper;
    @Override
    public List<HzEntryRecordVO> entryStatic() {
    public List<HzEntryRecordVO> entryStatic(Long companyId) {
        SysUser currentUser= SecurityUtils.getLoginUser().getUser();
        Date currentDate=new Date();
        DateTime endTime = DateUtil.endOfDay(currentDate);
@@ -68,7 +68,8 @@
            dayEntryRecordList.add(entryRecordVO);
            startTime=DateUtil.offsetDay(startTime,1);
        }
        List<HzEntryRecordVO> entryRecordVOList= entryRecordMapper.entryCountStatic(startDate, endDate,currentUser.getCompanyId());
        //todo
        List<HzEntryRecordVO> entryRecordVOList= entryRecordMapper.entryCountStatic(startDate, endDate,currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode()) ? companyId:currentUser.getCompanyId());
        if(!entryRecordVOList.isEmpty()) {
            Map<String, HzEntryRecordVO> resMap = entryRecordVOList.stream().collect(Collectors.toMap(item -> item.getMonth()+"_"+item.getDay(), item -> item));
            for (HzEntryRecordVO er : dayEntryRecordList) {
@@ -83,7 +84,7 @@
    }
    @Override
    public List<HzEntryRecordVO> useEverydayStatic() {
    public List<HzEntryRecordVO> useEverydayStatic(Long companyId) {
        SysUser currentUser= SecurityUtils.getLoginUser().getUser();
        checkUserAllowed(currentUser);
        Date currentDate=new Date();
@@ -100,9 +101,14 @@
            dayEntryRecordList.add(entryRecordVO);
            startTime=DateUtil.offsetDay(startTime,1);
        }
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        List<HzEntryRecordVO> entryRecordVOList= hazmatMapper.useCountEverydayStatic(startDate, endDate,currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(companyId);
        }else {
            //设置分表id
            //todo
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        }
        List<HzEntryRecordVO> entryRecordVOList= hazmatMapper.useCountEverydayStatic(startDate, endDate,currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode()) ? companyId:currentUser.getCompanyId());
        IdTableNameHandler.removeCurrentId();
        if(!entryRecordVOList.isEmpty()) {
            Map<String, HzEntryRecordVO> resMap = entryRecordVOList.stream().collect(Collectors.toMap(item -> item.getDay(), item -> item));
@@ -117,7 +123,7 @@
    }
    @Override
    public List<HzHazmatUseVO> maxUseStatic() {
    public List<HzHazmatUseVO> maxUseStatic(Long companyId) {
        SysUser currentUser= SecurityUtils.getLoginUser().getUser();
        checkUserAllowed(currentUser);
@@ -126,9 +132,14 @@
        DateTime startTime = DateUtil.beginOfDay(DateUtil.offsetDay(currentDate, -6));
        String startDate= DateUtil.format(startTime, DatePattern.NORM_DATETIME_FORMAT);
        String endDate=DateUtil.format(endTime,DatePattern.NORM_DATETIME_FORMAT);
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        List<HzHazmatUseVO> hazmatUseVOList= hazmatMapper.maxUseCountStatic(startDate, endDate,currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(companyId);
        }else {
            //设置分表id
            //todo
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        }
        List<HzHazmatUseVO> hazmatUseVOList= hazmatMapper.maxUseCountStatic(startDate, endDate,currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode()) ? companyId:currentUser.getCompanyId());
        IdTableNameHandler.removeCurrentId();
        if(!hazmatUseVOList.isEmpty()) {
            List<Long> basicIds = hazmatUseVOList.stream().map(HzHazmatUseVO::getBasicId).collect(Collectors.toList());
@@ -145,10 +156,15 @@
    }
    @Override
    public HzHomeDataVO homeDataStatistic() {
    public HzHomeDataVO homeDataStatistic(Long companyid) {
        SysUser currentUser=SecurityUtils.getLoginUser().getUser();
        checkUserAllowed(currentUser);
        Long companyId=currentUser.getCompanyId();
        Long companyId= null;
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            companyId = companyid;
        }else {
           companyId = currentUser.getCompanyId();
        }
        Integer warehouseCount= Math.toIntExact(warehouseMapper.selectCount(Wrappers.<HzWarehouse>lambdaQuery()
                .eq(true, HzWarehouse::getDelFlag, 0)
                .eq(companyId!=null,HzWarehouse::getCompanyId,companyId)));
@@ -156,7 +172,8 @@
        stateList.add(HazmatStatusEnum.USED.getCode());
        stateList.add(HazmatStatusEnum.DISCARD.getCode());
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        //todo
        IdTableNameHandler.setCurrentId(companyId);
        Integer hazmatCount= Math.toIntExact(hazmatMapper.selectCount(Wrappers.<HzHazmat>lambdaQuery()
                .notIn(true, HzHazmat::getState, stateList)
                .eq(companyId!=null,HzHazmat::getCompanyId,companyId)));
@@ -178,7 +195,7 @@
    @Override
    public CommonPage useStatic(String startTime, String endTime) {
    public CommonPage useStatic(String startTime, String endTime,Long companyId) {
        SysUser currentUser= SecurityUtils.getLoginUser().getUser();
        checkUserAllowed(currentUser);
@@ -201,10 +218,16 @@
                throw new ApiException("只能查询90天以内数据");
            }
        }
        //设置分表id
        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            IdTableNameHandler.setCurrentId(companyId);
        }else {
            //设置分表id
            //todo
            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
        }
        PageUtils.startPage();
        List<HzHazmatUseVO> hazmatUseVOList= hazmatMapper.useCountStatic(startDate, endDate,currentUser.getCompanyId());
        List<HzHazmatUseVO> hazmatUseVOList= hazmatMapper.useCountStatic(startDate, endDate,currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode()) ? companyId:currentUser.getCompanyId());
        IdTableNameHandler.removeCurrentId();
        if(!hazmatUseVOList.isEmpty()) {
            List<Long> basicIds = hazmatUseVOList.stream().map(HzHazmatUseVO::getBasicId).collect(Collectors.toList());
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzWarningServiceImpl.java
@@ -29,7 +29,7 @@
    @Override
    public CommonPage selectWarningList(HzWarning warning) {
        SysUser currentUser= SecurityUtils.getLoginUser().getUser();
        if(!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())){
        if(!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) && !currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            warning.setCompanyId(currentUser.getCompanyId());
        }
        PageUtils.startPage();
@@ -85,11 +85,14 @@
    }
    @Override
    public Integer selectWarningCount() {
    public Integer selectWarningCount(Long companyId) {
        SysUser currentUser=SecurityUtils.getLoginUser().getUser();
        if(currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())){
            throw new ApiException("管理员不能操作");
        }
        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            return baseMapper.selectWarningCount(companyId);
        }
        return baseMapper.selectWarningCount(currentUser.getCompanyId());
    }
}
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/SysDeptServiceImpl.java
@@ -36,7 +36,7 @@
    @Override
    public List<SysDept> selectDeptTreeList(SysDept dept) {
        SysUser currentUser=SecurityUtils.getLoginUser().getUser();
        if(!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())){
        if(!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) && !currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            dept.setCompanyId(currentUser.getCompanyId());
        }
        List<SysDept>  deptList=selectDeptList(dept);
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/SysUserServiceImpl.java
@@ -129,7 +129,7 @@
    }
    public void checkRequestData(SysUser user){
        if(!user.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())&&user.getCompanyId()==null){
        if(!(user.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) || user.getUserType().equals(UserTypeEnum.CHECK_USER.getCode()) )&&user.getCompanyId()==null){
            throw new ApiException("所属公司不能为空");
        }
        if(!checkUsernameUnique(user)){
@@ -193,8 +193,8 @@
        Integer currentUserType=currentUser.getUserType();
        Integer userType=user.getUserType();
        if(currentUserType.equals(UserTypeEnum.SYSTEM_USER.getCode())){
            if(!userType.equals(UserTypeEnum.COMPANY_USER.getCode())&&!userType.equals(UserTypeEnum.SYSTEM_USER.getCode())){
                throw new ApiException("管理员只能操管理员和企业级用户");
            if(!userType.equals(UserTypeEnum.COMPANY_USER.getCode())&&!userType.equals(UserTypeEnum.SYSTEM_USER.getCode())&&!userType.equals(UserTypeEnum.CHECK_USER.getCode())){
                throw new ApiException("管理员只能操作管理员和企业级用户");
            }
        }else if(user.getId()!=null&& user.getId().equals(currentUser.getId())){
            return;
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/TaBooWarningServiceImpl.java
@@ -61,7 +61,9 @@
    public CommonPage selectHzTabooWarningPageList(HzTabooWarning hzTabooWarning) {
        PageUtils.startPage();
        SysUser currentUser=SecurityUtils.getLoginUser().getUser();
        hzTabooWarning.setCompanyId(currentUser.getCompanyId());
        if (!currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            hzTabooWarning.setCompanyId(currentUser.getCompanyId());
        }
        List<HzTabooWarning> hzTabooWarnings = baseMapper.selectHzTabooWarningList(hzTabooWarning);
        return CommonPage.restPage(hzTabooWarnings);
    }
@@ -69,7 +71,9 @@
    @Override
    public List<HzTabooWarning> selectHzTabooWarningList(HzTabooWarning tabooWarning) {
        SysUser currentUser=SecurityUtils.getLoginUser().getUser();
        tabooWarning.setCompanyId(currentUser.getCompanyId());
        if (!currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
            tabooWarning.setCompanyId(currentUser.getCompanyId());
        }
        tabooWarning.setState(0);
        return baseMapper.selectHzTabooWarningList(tabooWarning);
    }
hazmat-system/src/main/resources/mapper/system/HzEntryRecordMapper.xml
@@ -26,7 +26,7 @@
    </resultMap>
    <resultMap type="com.gkhy.hazmat.system.domain.HzHazmatBasic" id="hazmatBasicResult">
        <result property="id"       column="basic_id"       />
        <result property="id"       column="basic_idd"       />
        <result property="name"    column="basic_name"    />
        <result property="cas"     column="basic_cas"     />
        <result property="minPackage"  column="basic_min_package"  />
@@ -55,7 +55,7 @@
    <sql id="selectEntryRecordVo">
        select a.id, a.warehouse_id,a.cupboard_id, a.num,a.batch_no,a.state,a.basic_id,a.company_id,a.start_code,a.end_code,a.code_prex,a.version, a.create_by,
               a.create_time, a.update_by, a.update_time, a.remark,
               b.id as basic_id,b.name as basic_name,b.cas as basic_cas,b.hazmat_type as basic_hazmat_type,b.hazmat_character as basic_hazmat_character,
               b.id as basic_idd,b.name as basic_name,b.cas as basic_cas,b.hazmat_type as basic_hazmat_type,b.hazmat_character as basic_hazmat_character,
               b.supplier as basic_supplier,b.manufacturer as basic_manufacturer,b.metering as basic_metering,b.unit as basic_unit,b.product_sn,b.min_package as basic_min_package,b.max_entry,
               c.id as warehouse_id,c.name as warehouse_name,d.id as cupboard_id,d.cupboard_name
        from hz_entry_record a
hazmat-system/src/main/resources/mapper/system/HzHazmatMapper.xml
@@ -100,7 +100,7 @@
            <if test="params.productSn != null and params.productSn != ''">
                AND b.product_sn =#{params.productSn}
            </if>
            and a.del_flag=0
            and a.del_flag=0 and b.del_flag = 0
        </where>
        group by a.basic_id,a.warehouse_id, a.cupboard_id
    </select>
hazmat-system/src/main/resources/mapper/system/HzWarningMapper.xml
@@ -63,7 +63,10 @@
    </select>
    <select id="selectWarningCount" resultType="java.lang.Integer" parameterType="java.lang.Long">
        select count(1) from hz_warning where company_id=#{companyId} and state=0
        select count(1) from hz_warning where  state=0
        <if test="companyId != null">
            and company_id=#{companyId}
        </if>
    </select>
hazmat-system/src/main/resources/mapper/system/SysCompanyMapper.xml
@@ -19,7 +19,7 @@
    </resultMap>
    <sql id="selectCompanyVo">
        select id, name, credit_code, major,code, phone,version, create_by, create_time, update_by, update_time, remark
        select id, name, credit_code, major,code, phone,type,version, create_by, create_time, update_by, update_time, remark
        from sys_company
    </sql>
hazmat-system/src/main/resources/mapper/system/SysConfigMapper.xml
@@ -7,6 +7,8 @@
        <result property="logoPath"    column="logo_path"    />
        <result property="useProd"     column="use_prod"     />
        <result property="companyId"   column="company_id"   />
        <result property="longitude"  column="longitude"/>
        <result property="latitude"  column="latitude"/>
        <result property="createBy"      column="create_by"      />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"      column="update_by"      />
@@ -15,7 +17,7 @@
    </resultMap>
    <sql id="selectConfigVo">
        select a.id, a.logo_path, a.use_prod, a.company_id, a.create_by, a.create_time, a.update_by, a.update_time,b.name as company_name
        select a.id, a.logo_path, a.use_prod, a.company_id,a.longitude,a.latitude, a.create_by, a.create_time, a.update_by, a.update_time,b.name as company_name
        from sys_config a
        left join sys_company b on b.id=a.company_id
    </sql>