| | |
| | | @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){ |
| | |
| | | @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){ |
| | |
| | | @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){ |
| | |
| | | |
| | | |
| | | @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 |
| | |
| | | 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("条码格式不正确"); |
| | | } |
| | |
| | | @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") |
| | |
| | | @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){ |
| | |
| | | @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 |
| | |
| | | @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){ |
| | |
| | | |
| | | |
| | | @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 |
| | |
| | | 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)); |
| | | } |
| | | |
| | | |
| | |
| | | @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 = "危化品使用记录导出") |
| | |
| | | @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){ |
| | |
| | | |
| | | @ApiOperation(value = "未处理预警数量") |
| | | @GetMapping("/warningCount") |
| | | public CommonResult warningCount(){ |
| | | return CommonResult.success(warningService.selectWarningCount()); |
| | | public CommonResult warningCount(Long companyId){ |
| | | return CommonResult.success(warningService.selectWarningCount(companyId)); |
| | | } |
| | | |
| | | @RepeatSubmit |
| | |
| | | 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 |
| | | # 从库数据源 |
| | |
| | | database: 1 |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | password: |
| | | password: akj78avauba789a |
| | | |
| | | |
| | | # mybatis-plus相关配置 |
| | |
| | | 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; |
| | | |
| | |
| | | { |
| | | SYSTEM_USER(0, "系统用户"), |
| | | COMPANY_USER(1, "企业级用户"), |
| | | NORMAL_USER(2, "普通用户"); |
| | | NORMAL_USER(2, "普通用户"), |
| | | CHECK_USER(3,"监管部门"); |
| | | |
| | | private final Integer code; |
| | | private final String info; |
| | |
| | | { |
| | | 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("登录用户公司信息缺失"); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | |
| | | @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; |
| | |
| | | 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; |
| | |
| | | @Setter |
| | | @Accessors(chain = true) |
| | | @TableName("sys_config") |
| | | @ApiModel(value = "SysConfig对象", description = "系统配置表") |
| | | @ApiModel(value = "SysConfig对象", description = "企业配置表") |
| | | @JsonInclude(NON_NULL) |
| | | public class SysConfig extends BaseEntity { |
| | | |
| | |
| | | @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; |
| | |
| | | * @return |
| | | */ |
| | | Integer selectWarningCount(Long companyId); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<HzHazmatFlow> selectAllHazmatFlowByCode(String code); |
| | | List<HzHazmatFlow> selectAllHazmatFlowByCode(String code,Long companyId); |
| | | |
| | | /** |
| | | * 根据用户分页查询所有流向 |
| | |
| | | * @param hazmatId |
| | | * @return |
| | | */ |
| | | List<HzHazmatFlow> getAllHazmatFlowByHazmatId(Long hazmatId); |
| | | List<HzHazmatFlow> getAllHazmatFlowByHazmatId(Long hazmatId,Long companyId); |
| | | } |
| | |
| | | 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> |
| | |
| | | |
| | | /** |
| | | * 根据条件按仓库和危化品基础数据汇总数据 |
| | | * |
| | | * @param hzHazmat |
| | | * @return |
| | | */ |
| | |
| | | * @param entryId |
| | | * @return |
| | | */ |
| | | CommonPage selectProductListByEntryId(Long entryId); |
| | | CommonPage selectProductListByEntryId(Long entryId,Long companyId); |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<HzProductFlow> selectAllProductFlowByCode(String code); |
| | | List<HzProductFlow> selectAllProductFlowByCode(String code, Long companyId); |
| | | |
| | | /** |
| | | * 根据当前用户分页查询流向 |
| | |
| | | * @param productId |
| | | * @return |
| | | */ |
| | | List<HzProductFlow> getAllProductFlowByProductId(Long productId); |
| | | List<HzProductFlow> getAllProductFlowByProductId(Long productId,Long companyId); |
| | | } |
| | |
| | | * 一周入库统计 |
| | | * @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); |
| | | |
| | | /** |
| | | * 分页统计危化品使用数量 |
| | |
| | | * @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; |
| | | } |
| | |
| | | * 获取未处理预警数量 |
| | | * @return |
| | | */ |
| | | Integer selectWarningCount(); |
| | | Integer selectWarningCount(Long companyId); |
| | | } |
| | |
| | | @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(); |
| | |
| | | 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(); |
| | |
| | | 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("无权限操作其他企业数据"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | @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(); |
| | |
| | | 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; |
| | |
| | | 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> |
| | |
| | | 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(); |
| | |
| | | } |
| | | |
| | | @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("危化品条码数据不存在"); |
| | | } |
| | |
| | | } |
| | | |
| | | @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("危化品数据不存在"); |
| | |
| | | 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("无权限操作其他企业数据"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | } |
| | | 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(); |
| | |
| | | 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()) { |
| | |
| | | @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(); |
| | |
| | | @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(); |
| | |
| | | } |
| | | |
| | | @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(); |
| | |
| | | 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("无权限操作其他企业数据"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | 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(); |
| | |
| | | } |
| | | |
| | | @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("成品条码数据不存在"); |
| | | } |
| | |
| | | } |
| | | |
| | | @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("成品数据不存在"); |
| | |
| | | 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("无权限操作其他企业数据"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | 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(); |
| | |
| | | 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()) { |
| | |
| | | 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); |
| | |
| | | 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) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<HzEntryRecordVO> useEverydayStatic() { |
| | | public List<HzEntryRecordVO> useEverydayStatic(Long companyId) { |
| | | SysUser currentUser= SecurityUtils.getLoginUser().getUser(); |
| | | checkUserAllowed(currentUser); |
| | | Date currentDate=new Date(); |
| | |
| | | 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)); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<HzHazmatUseVO> maxUseStatic() { |
| | | public List<HzHazmatUseVO> maxUseStatic(Long companyId) { |
| | | SysUser currentUser= SecurityUtils.getLoginUser().getUser(); |
| | | checkUserAllowed(currentUser); |
| | | |
| | |
| | | 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()); |
| | |
| | | } |
| | | |
| | | @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))); |
| | |
| | | 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))); |
| | |
| | | |
| | | |
| | | @Override |
| | | public CommonPage useStatic(String startTime, String endTime) { |
| | | public CommonPage useStatic(String startTime, String endTime,Long companyId) { |
| | | SysUser currentUser= SecurityUtils.getLoginUser().getUser(); |
| | | checkUserAllowed(currentUser); |
| | | |
| | |
| | | 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()); |
| | |
| | | @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(); |
| | |
| | | } |
| | | |
| | | @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()); |
| | | } |
| | | } |
| | |
| | | @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); |
| | |
| | | } |
| | | |
| | | 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)){ |
| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | |
| | | @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); |
| | | } |
| | |
| | | </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" /> |
| | |
| | | <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 |
| | |
| | | <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> |
| | |
| | | </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> |
| | | |
| | | |
| | |
| | | </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> |
| | | |
| | |
| | | <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" /> |
| | |
| | | </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> |