From 8f1532e976b28bf9e1ec84dbe84249a1c1a30870 Mon Sep 17 00:00:00 2001 From: zhangyanan Date: Wed, 10 Sep 2025 18:50:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/consts/SpringSecurityConstant.java | 6 + .../controller/ScrFactoryHeatController.java | 148 ++++++ .../scrfactoryheat/entity/ScrFactoryHeat.java | 63 +++ .../enums/ScrFactoryHeatExceptionEnum.java | 64 +++ .../mapper/ScrFactoryHeatMapper.java | 37 ++ .../mapper/mapping/ScrFactoryHeatMapper.xml | 5 + .../param/ScrFactoryHeatParam.java | 60 +++ .../service/ScrFactoryHeatService.java | 97 ++++ .../impl/ScrFactoryHeatServiceImpl.java | 128 +++++ .../controller/ScrProductionController.java | 163 ++++++ .../scrproduction/entity/ScrProduction.java | 111 ++++ .../enums/ScrProductionExceptionEnum.java | 64 +++ .../mapper/ScrProductionMapper.java | 37 ++ .../mapper/mapping/ScrProductionMapper.xml | 13 + .../param/ScrProductionDriParam.java | 59 +++ .../param/ScrProductionMaterParam.java | 59 +++ .../param/ScrProductionParam.java | 111 ++++ .../service/ScrProductionService.java | 104 ++++ .../impl/ScrProductionServiceImpl.java | 487 ++++++++++++++++++ .../controller/ScrRawMaterialsController.java | 148 ++++++ .../entity/ScrRawMaterials.java | 76 +++ .../enums/ScrRawMaterialsExceptionEnum.java | 64 +++ .../mapper/ScrRawMaterialsMapper.java | 37 ++ .../mapper/mapping/ScrRawMaterialsMapper.xml | 5 + .../param/ScrRawMaterialsParam.java | 73 +++ .../service/ScrRawMaterialsService.java | 97 ++++ .../impl/ScrRawMaterialsServiceImpl.java | 136 +++++ .../controller/ScrSecurityController.java | 154 ++++++ .../scrsecurity/entity/ScrSecurity.java | 87 ++++ .../enums/ScrSecurityExceptionEnum.java | 64 +++ .../scrsecurity/mapper/ScrSecurityMapper.java | 37 ++ .../mapper/mapping/ScrSecurityMapper.xml | 5 + .../scrsecurity/param/ScrSecurityParam.java | 87 ++++ .../service/ScrSecurityService.java | 98 ++++ .../service/impl/ScrSecurityServiceImpl.java | 185 +++++++ 35 files changed, 3169 insertions(+) create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/controller/ScrFactoryHeatController.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/entity/ScrFactoryHeat.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/enums/ScrFactoryHeatExceptionEnum.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/mapper/ScrFactoryHeatMapper.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/mapper/mapping/ScrFactoryHeatMapper.xml create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/param/ScrFactoryHeatParam.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/service/ScrFactoryHeatService.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/service/impl/ScrFactoryHeatServiceImpl.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/controller/ScrProductionController.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/entity/ScrProduction.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/enums/ScrProductionExceptionEnum.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/mapper/ScrProductionMapper.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/mapper/mapping/ScrProductionMapper.xml create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/param/ScrProductionDriParam.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/param/ScrProductionMaterParam.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/param/ScrProductionParam.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/service/ScrProductionService.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/service/impl/ScrProductionServiceImpl.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/controller/ScrRawMaterialsController.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/entity/ScrRawMaterials.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/enums/ScrRawMaterialsExceptionEnum.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/mapper/ScrRawMaterialsMapper.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/mapper/mapping/ScrRawMaterialsMapper.xml create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/param/ScrRawMaterialsParam.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/service/ScrRawMaterialsService.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/service/impl/ScrRawMaterialsServiceImpl.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/controller/ScrSecurityController.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/entity/ScrSecurity.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/enums/ScrSecurityExceptionEnum.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/mapper/ScrSecurityMapper.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/mapper/mapping/ScrSecurityMapper.xml create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/param/ScrSecurityParam.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/service/ScrSecurityService.java create mode 100644 snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/service/impl/ScrSecurityServiceImpl.java diff --git a/snowy-base/snowy-core/src/main/java/vip/xiaonuo/core/consts/SpringSecurityConstant.java b/snowy-base/snowy-core/src/main/java/vip/xiaonuo/core/consts/SpringSecurityConstant.java index e9fcf2e..670d499 100644 --- a/snowy-base/snowy-core/src/main/java/vip/xiaonuo/core/consts/SpringSecurityConstant.java +++ b/snowy-base/snowy-core/src/main/java/vip/xiaonuo/core/consts/SpringSecurityConstant.java @@ -67,6 +67,12 @@ public interface SpringSecurityConstant { "/captcha/**", "/getCaptchaOpen", + //大屏的 + "/scrProduction/driQuery", + "/scrSecurity/driQuery", + "/scrProduction/driQhQuery", + "/scrProduction/driMaterQuery" + }; } diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/controller/ScrFactoryHeatController.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/controller/ScrFactoryHeatController.java new file mode 100644 index 0000000..945d87a --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/controller/ScrFactoryHeatController.java @@ -0,0 +1,148 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrfactoryheat.controller; + +import vip.xiaonuo.core.annotion.BusinessLog; +import vip.xiaonuo.core.annotion.Permission; +import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum; +import vip.xiaonuo.core.pojo.response.ResponseData; +import vip.xiaonuo.core.pojo.response.SuccessResponseData; +import vip.xiaonuo.modular.scrfactoryheat.param.ScrFactoryHeatParam; +import vip.xiaonuo.modular.scrfactoryheat.service.ScrFactoryHeatService; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import javax.annotation.Resource; +import java.util.List; + +/** + * 分厂炉号对应关系控制器 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ +@RestController +public class ScrFactoryHeatController { + + @Resource + private ScrFactoryHeatService scrFactoryHeatService; + + /** + * 查询分厂炉号对应关系 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + @Permission + @GetMapping("/scrFactoryHeat/page") + @BusinessLog(title = "分厂炉号对应关系_查询", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData page(ScrFactoryHeatParam scrFactoryHeatParam) { + return new SuccessResponseData(scrFactoryHeatService.page(scrFactoryHeatParam)); + } + + /** + * 添加分厂炉号对应关系 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + @Permission + @PostMapping("/scrFactoryHeat/add") + @BusinessLog(title = "分厂炉号对应关系_增加", opType = LogAnnotionOpTypeEnum.ADD) + public ResponseData add(@RequestBody @Validated(ScrFactoryHeatParam.add.class) ScrFactoryHeatParam scrFactoryHeatParam) { + scrFactoryHeatService.add(scrFactoryHeatParam); + return new SuccessResponseData(); + } + + /** + * 删除分厂炉号对应关系,可批量删除 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + @Permission + @PostMapping("/scrFactoryHeat/delete") + @BusinessLog(title = "分厂炉号对应关系_删除", opType = LogAnnotionOpTypeEnum.DELETE) + public ResponseData delete(@RequestBody @Validated(ScrFactoryHeatParam.delete.class) List scrFactoryHeatParamList) { + scrFactoryHeatService.delete(scrFactoryHeatParamList); + return new SuccessResponseData(); + } + + /** + * 编辑分厂炉号对应关系 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + @Permission + @PostMapping("/scrFactoryHeat/edit") + @BusinessLog(title = "分厂炉号对应关系_编辑", opType = LogAnnotionOpTypeEnum.EDIT) + public ResponseData edit(@RequestBody @Validated(ScrFactoryHeatParam.edit.class) ScrFactoryHeatParam scrFactoryHeatParam) { + scrFactoryHeatService.edit(scrFactoryHeatParam); + return new SuccessResponseData(); + } + + /** + * 查看分厂炉号对应关系 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + @Permission + @GetMapping("/scrFactoryHeat/detail") + @BusinessLog(title = "分厂炉号对应关系_查看", opType = LogAnnotionOpTypeEnum.DETAIL) + public ResponseData detail(@Validated(ScrFactoryHeatParam.detail.class) ScrFactoryHeatParam scrFactoryHeatParam) { + return new SuccessResponseData(scrFactoryHeatService.detail(scrFactoryHeatParam)); + } + + /** + * 分厂炉号对应关系列表 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + @Permission + @GetMapping("/scrFactoryHeat/list") + @BusinessLog(title = "分厂炉号对应关系_列表", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData list(ScrFactoryHeatParam scrFactoryHeatParam) { + return new SuccessResponseData(scrFactoryHeatService.list(scrFactoryHeatParam)); + } + + /** + * 导出系统用户 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + @Permission + @GetMapping("/scrFactoryHeat/export") + @BusinessLog(title = "分厂炉号对应关系_导出", opType = LogAnnotionOpTypeEnum.EXPORT) + public void export(ScrFactoryHeatParam scrFactoryHeatParam) { + scrFactoryHeatService.export(scrFactoryHeatParam); + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/entity/ScrFactoryHeat.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/entity/ScrFactoryHeat.java new file mode 100644 index 0000000..daca1a7 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/entity/ScrFactoryHeat.java @@ -0,0 +1,63 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrfactoryheat.entity; + +import com.baomidou.mybatisplus.annotation.*; +import vip.xiaonuo.core.pojo.base.entity.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.*; +import cn.afterturn.easypoi.excel.annotation.Excel; + +/** + * 分厂炉号对应关系 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("scr_factory_heat") +public class ScrFactoryHeat extends BaseEntity { + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + + /** + * 分厂 + */ + @Excel(name = "分厂") + private String branchPlant; + + /** + * 炉号 + */ + @Excel(name = "炉号") + private String furnaceNumber; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/enums/ScrFactoryHeatExceptionEnum.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/enums/ScrFactoryHeatExceptionEnum.java new file mode 100644 index 0000000..fde7cc7 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/enums/ScrFactoryHeatExceptionEnum.java @@ -0,0 +1,64 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrfactoryheat.enums; + +import vip.xiaonuo.core.annotion.ExpEnumType; +import vip.xiaonuo.core.exception.enums.abs.AbstractBaseExceptionEnum; +import vip.xiaonuo.core.factory.ExpEnumCodeFactory; +import vip.xiaonuo.sys.core.consts.SysExpEnumConstant; + +/** + * 分厂炉号对应关系 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ +@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE) +public enum ScrFactoryHeatExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 数据不存在 + */ + NOT_EXIST(1, "此数据不存在"); + + private final Integer code; + + private final String message; + ScrFactoryHeatExceptionEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + + @Override + public Integer getCode() { + return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code); + } + + @Override + public String getMessage() { + return message; + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/mapper/ScrFactoryHeatMapper.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/mapper/ScrFactoryHeatMapper.java new file mode 100644 index 0000000..4396c7b --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/mapper/ScrFactoryHeatMapper.java @@ -0,0 +1,37 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrfactoryheat.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import vip.xiaonuo.modular.scrfactoryheat.entity.ScrFactoryHeat; + +/** + * 分厂炉号对应关系 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ +public interface ScrFactoryHeatMapper extends BaseMapper { +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/mapper/mapping/ScrFactoryHeatMapper.xml b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/mapper/mapping/ScrFactoryHeatMapper.xml new file mode 100644 index 0000000..d3be350 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/mapper/mapping/ScrFactoryHeatMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/param/ScrFactoryHeatParam.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/param/ScrFactoryHeatParam.java new file mode 100644 index 0000000..12a97b7 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/param/ScrFactoryHeatParam.java @@ -0,0 +1,60 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrfactoryheat.param; + +import vip.xiaonuo.core.pojo.base.param.BaseParam; +import lombok.Data; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.NotBlank; +import java.util.*; + +/** +* 分厂炉号对应关系参数类 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 +*/ +@Data +public class ScrFactoryHeatParam extends BaseParam { + + /** + * 主键 + */ + @NotNull(message = "主键不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class}) + private Long id; + + /** + * 分厂 + */ + @NotBlank(message = "分厂不能为空,请检查branchPlant参数", groups = {add.class, edit.class}) + private String branchPlant; + + /** + * 炉号 + */ + @NotBlank(message = "炉号不能为空,请检查furnaceNumber参数", groups = {add.class, edit.class}) + private String furnaceNumber; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/service/ScrFactoryHeatService.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/service/ScrFactoryHeatService.java new file mode 100644 index 0000000..98d3920 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/service/ScrFactoryHeatService.java @@ -0,0 +1,97 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrfactoryheat.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import vip.xiaonuo.core.pojo.page.PageResult; +import vip.xiaonuo.modular.scrfactoryheat.entity.ScrFactoryHeat; +import vip.xiaonuo.modular.scrfactoryheat.param.ScrFactoryHeatParam; +import java.util.List; + +/** + * 分厂炉号对应关系service接口 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ +public interface ScrFactoryHeatService extends IService { + + /** + * 查询分厂炉号对应关系 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + PageResult page(ScrFactoryHeatParam scrFactoryHeatParam); + + /** + * 分厂炉号对应关系列表 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + List list(ScrFactoryHeatParam scrFactoryHeatParam); + + /** + * 添加分厂炉号对应关系 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + void add(ScrFactoryHeatParam scrFactoryHeatParam); + + /** + * 删除分厂炉号对应关系 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + void delete(List scrFactoryHeatParamList); + + /** + * 编辑分厂炉号对应关系 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + void edit(ScrFactoryHeatParam scrFactoryHeatParam); + + /** + * 查看分厂炉号对应关系 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + ScrFactoryHeat detail(ScrFactoryHeatParam scrFactoryHeatParam); + + /** + * 导出分厂炉号对应关系 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + void export(ScrFactoryHeatParam scrFactoryHeatParam); + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/service/impl/ScrFactoryHeatServiceImpl.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/service/impl/ScrFactoryHeatServiceImpl.java new file mode 100644 index 0000000..ff4bd1f --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrfactoryheat/service/impl/ScrFactoryHeatServiceImpl.java @@ -0,0 +1,128 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrfactoryheat.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import vip.xiaonuo.core.consts.CommonConstant; +import vip.xiaonuo.core.enums.CommonStatusEnum; +import vip.xiaonuo.core.exception.ServiceException; +import vip.xiaonuo.core.factory.PageFactory; +import vip.xiaonuo.core.pojo.page.PageResult; +import vip.xiaonuo.core.util.PoiUtil; +import vip.xiaonuo.modular.scrfactoryheat.entity.ScrFactoryHeat; +import vip.xiaonuo.modular.scrfactoryheat.enums.ScrFactoryHeatExceptionEnum; +import vip.xiaonuo.modular.scrfactoryheat.mapper.ScrFactoryHeatMapper; +import vip.xiaonuo.modular.scrfactoryheat.param.ScrFactoryHeatParam; +import vip.xiaonuo.modular.scrfactoryheat.service.ScrFactoryHeatService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import java.util.List; + +/** + * 分厂炉号对应关系service接口实现类 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ +@Service +public class ScrFactoryHeatServiceImpl extends ServiceImpl implements ScrFactoryHeatService { + + @Override + public PageResult page(ScrFactoryHeatParam scrFactoryHeatParam) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (ObjectUtil.isNotNull(scrFactoryHeatParam)) { + + // 根据分厂 查询 + if (ObjectUtil.isNotEmpty(scrFactoryHeatParam.getBranchPlant())) { + queryWrapper.lambda().eq(ScrFactoryHeat::getBranchPlant, scrFactoryHeatParam.getBranchPlant()); + } + // 根据炉号 查询 + if (ObjectUtil.isNotEmpty(scrFactoryHeatParam.getFurnaceNumber())) { + queryWrapper.lambda().eq(ScrFactoryHeat::getFurnaceNumber, scrFactoryHeatParam.getFurnaceNumber()); + } + } + return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); + } + + @Override + public List list(ScrFactoryHeatParam scrFactoryHeatParam) { + return this.list(); + } + + @Override + public void add(ScrFactoryHeatParam scrFactoryHeatParam) { + ScrFactoryHeat scrFactoryHeat = new ScrFactoryHeat(); + BeanUtil.copyProperties(scrFactoryHeatParam, scrFactoryHeat); + this.save(scrFactoryHeat); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(List scrFactoryHeatParamList) { + scrFactoryHeatParamList.forEach(scrFactoryHeatParam -> { + this.removeById(scrFactoryHeatParam.getId()); + }); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void edit(ScrFactoryHeatParam scrFactoryHeatParam) { + ScrFactoryHeat scrFactoryHeat = this.queryScrFactoryHeat(scrFactoryHeatParam); + BeanUtil.copyProperties(scrFactoryHeatParam, scrFactoryHeat); + this.updateById(scrFactoryHeat); + } + + @Override + public ScrFactoryHeat detail(ScrFactoryHeatParam scrFactoryHeatParam) { + return this.queryScrFactoryHeat(scrFactoryHeatParam); + } + + /** + * 获取分厂炉号对应关系 + * + * @author zhangyn + * @date 2025-09-10 10:02:57 + */ + private ScrFactoryHeat queryScrFactoryHeat(ScrFactoryHeatParam scrFactoryHeatParam) { + ScrFactoryHeat scrFactoryHeat = this.getById(scrFactoryHeatParam.getId()); + if (ObjectUtil.isNull(scrFactoryHeat)) { + throw new ServiceException(ScrFactoryHeatExceptionEnum.NOT_EXIST); + } + return scrFactoryHeat; + } + + @Override + public void export(ScrFactoryHeatParam scrFactoryHeatParam) { + List list = this.list(scrFactoryHeatParam); + PoiUtil.exportExcelWithStream("SnowyScrFactoryHeat.xls", ScrFactoryHeat.class, list); + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/controller/ScrProductionController.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/controller/ScrProductionController.java new file mode 100644 index 0000000..14fb42b --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/controller/ScrProductionController.java @@ -0,0 +1,163 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrproduction.controller; + +import vip.xiaonuo.core.annotion.BusinessLog; +import vip.xiaonuo.core.annotion.Permission; +import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum; +import vip.xiaonuo.core.pojo.response.ResponseData; +import vip.xiaonuo.core.pojo.response.SuccessResponseData; +import vip.xiaonuo.modular.scrproduction.param.ScrProductionParam; +import vip.xiaonuo.modular.scrproduction.service.ScrProductionService; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import javax.annotation.Resource; +import java.util.List; + +/** + * 产量控制器 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ +@RestController +public class ScrProductionController { + + @Resource + private ScrProductionService scrProductionService; + + /** + * 查询产量 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + @Permission + @GetMapping("/scrProduction/page") + @BusinessLog(title = "产量_查询", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData page(ScrProductionParam scrProductionParam) { + return new SuccessResponseData(scrProductionService.page(scrProductionParam)); + } + + /** + * 添加产量 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + @Permission + @PostMapping("/scrProduction/add") + @BusinessLog(title = "产量_增加", opType = LogAnnotionOpTypeEnum.ADD) + public ResponseData add(@RequestBody @Validated(ScrProductionParam.add.class) ScrProductionParam scrProductionParam) { + scrProductionService.add(scrProductionParam); + return new SuccessResponseData(); + } + + /** + * 删除产量,可批量删除 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + @Permission + @PostMapping("/scrProduction/delete") + @BusinessLog(title = "产量_删除", opType = LogAnnotionOpTypeEnum.DELETE) + public ResponseData delete(@RequestBody @Validated(ScrProductionParam.delete.class) List scrProductionParamList) { + scrProductionService.delete(scrProductionParamList); + return new SuccessResponseData(); + } + + /** + * 编辑产量 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + @Permission + @PostMapping("/scrProduction/edit") + @BusinessLog(title = "产量_编辑", opType = LogAnnotionOpTypeEnum.EDIT) + public ResponseData edit(@RequestBody @Validated(ScrProductionParam.edit.class) ScrProductionParam scrProductionParam) { + scrProductionService.edit(scrProductionParam); + return new SuccessResponseData(); + } + + /** + * 查看产量 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + @Permission + @GetMapping("/scrProduction/detail") + @BusinessLog(title = "产量_查看", opType = LogAnnotionOpTypeEnum.DETAIL) + public ResponseData detail(@Validated(ScrProductionParam.detail.class) ScrProductionParam scrProductionParam) { + return new SuccessResponseData(scrProductionService.detail(scrProductionParam)); + } + + /** + * 产量列表 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + @Permission + @GetMapping("/scrProduction/list") + @BusinessLog(title = "产量_列表", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData list(ScrProductionParam scrProductionParam) { + return new SuccessResponseData(scrProductionService.list(scrProductionParam)); + } + + /** + * 导出系统用户 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + @Permission + @GetMapping("/scrProduction/export") + @BusinessLog(title = "产量_导出", opType = LogAnnotionOpTypeEnum.EXPORT) + public void export(ScrProductionParam scrProductionParam) { + scrProductionService.export(scrProductionParam); + } + + @GetMapping("/scrProduction/driQuery") + @BusinessLog(title = "产量_大屏查询", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData driQuery(ScrProductionParam scrProductionParam) { + return new SuccessResponseData(scrProductionService.driQuery(scrProductionParam)); + } + @GetMapping("/scrProduction/driMaterQuery") + @BusinessLog(title = "原材料产量和耗电量_大屏查询", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData driMaterQuery(ScrProductionParam scrProductionParam) { + return new SuccessResponseData(scrProductionService.driMaterQuery(scrProductionParam)); + } + @GetMapping("/scrProduction/driQhQuery") + @BusinessLog(title = "各炉号产量_大屏查询", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData driQhQuery(ScrProductionParam scrProductionParam) { + return new SuccessResponseData(scrProductionService.driQhQuery(scrProductionParam)); + } +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/entity/ScrProduction.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/entity/ScrProduction.java new file mode 100644 index 0000000..929b539 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/entity/ScrProduction.java @@ -0,0 +1,111 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrproduction.entity; + +import com.baomidou.mybatisplus.annotation.*; +import vip.xiaonuo.core.pojo.base.entity.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.*; +import cn.afterturn.easypoi.excel.annotation.Excel; +import vip.xiaonuo.core.pojo.base.param.BaseParam; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.math.BigDecimal; + +/** + * 产量 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("scr_production") +public class ScrProduction extends BaseEntity { + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + + /** + * 日期 + */ + @Excel(name = "日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20) + private Date productionDay; + + /** + * 炉号 + */ + @Excel(name = "炉号") + private String furnaceNumber; + + /** + * 产品 + */ + @Excel(name = "产品") + private String product; + + /** + * 产量 + */ + @Excel(name = "产量") + private BigDecimal production; + + /** + * 回收率 + */ + @Excel(name = "回收率") + private BigDecimal passRate; + /** + * 扣铁粉渣用量 + */ + @Excel(name = "扣铁粉渣用量") + private BigDecimal conts; + /** + * 耗电量 + */ + @Excel(name = "耗电量") + private BigDecimal power; + /** + * 渣Mn + */ + @Excel(name = "渣Mn") + private BigDecimal slagMn; + /** + * 炉编号 + */ + @Excel(name = "炉编号") + private String furnaceCode; + /** + * 单耗 + */ + @Excel(name = "单耗") + private BigDecimal units; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/enums/ScrProductionExceptionEnum.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/enums/ScrProductionExceptionEnum.java new file mode 100644 index 0000000..6aceb8c --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/enums/ScrProductionExceptionEnum.java @@ -0,0 +1,64 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrproduction.enums; + +import vip.xiaonuo.core.annotion.ExpEnumType; +import vip.xiaonuo.core.exception.enums.abs.AbstractBaseExceptionEnum; +import vip.xiaonuo.core.factory.ExpEnumCodeFactory; +import vip.xiaonuo.sys.core.consts.SysExpEnumConstant; + +/** + * 产量 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ +@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE) +public enum ScrProductionExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 数据不存在 + */ + NOT_EXIST(1, "此数据不存在"); + + private final Integer code; + + private final String message; + ScrProductionExceptionEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + + @Override + public Integer getCode() { + return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code); + } + + @Override + public String getMessage() { + return message; + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/mapper/ScrProductionMapper.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/mapper/ScrProductionMapper.java new file mode 100644 index 0000000..4d003f9 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/mapper/ScrProductionMapper.java @@ -0,0 +1,37 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrproduction.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import vip.xiaonuo.modular.scrproduction.entity.ScrProduction; + +/** + * 产量 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ +public interface ScrProductionMapper extends BaseMapper { +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/mapper/mapping/ScrProductionMapper.xml b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/mapper/mapping/ScrProductionMapper.xml new file mode 100644 index 0000000..31d88ce --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/mapper/mapping/ScrProductionMapper.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/param/ScrProductionDriParam.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/param/ScrProductionDriParam.java new file mode 100644 index 0000000..43b59ec --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/param/ScrProductionDriParam.java @@ -0,0 +1,59 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrproduction.param; + +import lombok.Data; +import vip.xiaonuo.core.pojo.base.param.BaseParam; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.List; + +/** +* 产量参数类 + * + * @author zyn + * @date 2025-09-10 10:03:01 +*/ +@Data +public class ScrProductionDriParam { + /** + * 累计产量 + */ + + private BigDecimal production; + + /** + * 回收率 + */ + private BigDecimal passRate; + + /** + * 单耗 + */ + private BigDecimal units; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/param/ScrProductionMaterParam.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/param/ScrProductionMaterParam.java new file mode 100644 index 0000000..8ba4ddb --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/param/ScrProductionMaterParam.java @@ -0,0 +1,59 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrproduction.param; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** +* 产量参数类 + * + * @author zyn + * @date 2025-09-10 10:03:01 +*/ +@Data +public class ScrProductionMaterParam { + /** + * 名称 + */ + + private String title; + + /** + * 用量 + */ + private BigDecimal consumption; + + /** + * 耗电量 + */ + private BigDecimal power; + /** + * 各原料 + */ + private List list; +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/param/ScrProductionParam.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/param/ScrProductionParam.java new file mode 100644 index 0000000..88994df --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/param/ScrProductionParam.java @@ -0,0 +1,111 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrproduction.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import vip.xiaonuo.core.pojo.base.param.BaseParam; +import lombok.Data; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.NotBlank; +import java.util.*; +import java.math.BigDecimal; +import java.math.BigDecimal; + +/** +* 产量参数类 + * + * @author zyn + * @date 2025-09-10 10:03:01 +*/ +@Data +public class ScrProductionParam extends BaseParam { + + /** + * 主键 + */ + @NotNull(message = "主键不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class}) + private Long id; + + /** + * 日期 + */ + @NotNull(message = "日期不能为空,请检查productionDay参数", groups = {add.class, edit.class}) + private String productionDay; + + /** + * 炉号 + */ + @NotBlank(message = "炉号不能为空,请检查furnaceNumber参数", groups = {add.class, edit.class}) + private String furnaceNumber; + + /** + * 产品 + */ + @NotBlank(message = "产品不能为空,请检查product参数", groups = {add.class, edit.class}) + private String product; + + /** + * 产量 + */ + @NotNull(message = "产量不能为空,请检查production参数", groups = {add.class, edit.class}) + private BigDecimal production; + + /** + * 回收率 + */ + @NotNull(message = "合格率不能为空,请检查passRate参数", groups = {add.class, edit.class}) + private BigDecimal passRate; + + /** + * 回收率 + */ + @NotNull(message = "扣铁粉渣用量不能为空,请检查conts参数", groups = {add.class, edit.class}) + private BigDecimal conts; + /** + * 耗电量 + */ + @NotNull(message = "耗电量不能为空,请检查power参数", groups = {add.class, edit.class}) + private BigDecimal power; + /** + * 渣Mn + */ + @NotNull(message = "渣Mn不能为空,请检查slagMn参数", groups = {add.class, edit.class}) + private BigDecimal slagMn; + /** + * 炉编号 + */ + @NotNull(message = "炉编号不能为空,请检查furnaceCode参数", groups = {add.class, edit.class}) + private String furnaceCode; + + /** + * 单耗 + */ + @NotNull(message = "单耗不能为空,请检查units参数", groups = {add.class, edit.class}) + private BigDecimal units; +private Integer year; +private Integer month; +private Date startDate; +private Date endDate; +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/service/ScrProductionService.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/service/ScrProductionService.java new file mode 100644 index 0000000..700f2db --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/service/ScrProductionService.java @@ -0,0 +1,104 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrproduction.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import vip.xiaonuo.core.pojo.page.PageResult; +import vip.xiaonuo.modular.scrproduction.entity.ScrProduction; +import vip.xiaonuo.modular.scrproduction.param.ScrProductionParam; +import vip.xiaonuo.modular.scrproduction.param.ScrProductionDriParam; +import vip.xiaonuo.modular.scrproduction.param.ScrProductionMaterParam; +import java.util.List; + +/** + * 产量service接口 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ +public interface ScrProductionService extends IService { + + /** + * 查询产量 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + PageResult page(ScrProductionParam scrProductionParam); + + /** + * 产量列表 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + List list(ScrProductionParam scrProductionParam); + + /** + * 添加产量 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + void add(ScrProductionParam scrProductionParam); + + /** + * 删除产量 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + void delete(List scrProductionParamList); + + /** + * 编辑产量 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + void edit(ScrProductionParam scrProductionParam); + + /** + * 查看产量 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + ScrProduction detail(ScrProductionParam scrProductionParam); + + /** + * 导出产量 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + void export(ScrProductionParam scrProductionParam); + + ScrProductionDriParam driQuery(ScrProductionParam scrProductionParam); + + List driQhQuery(ScrProductionParam scrProductionParam); + + List driMaterQuery(ScrProductionParam scrProductionParam); +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/service/impl/ScrProductionServiceImpl.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/service/impl/ScrProductionServiceImpl.java new file mode 100644 index 0000000..7e98a68 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/service/impl/ScrProductionServiceImpl.java @@ -0,0 +1,487 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrproduction.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import vip.xiaonuo.core.exception.ServiceException; +import vip.xiaonuo.core.factory.PageFactory; +import vip.xiaonuo.core.pojo.page.PageResult; +import vip.xiaonuo.core.util.PoiUtil; +import vip.xiaonuo.modular.scrproduction.entity.ScrProduction; +import vip.xiaonuo.modular.scrproduction.enums.ScrProductionExceptionEnum; +import vip.xiaonuo.modular.scrproduction.mapper.ScrProductionMapper; +import vip.xiaonuo.modular.scrproduction.param.ScrProductionDriParam; +import vip.xiaonuo.modular.scrproduction.param.ScrProductionMaterParam; +import vip.xiaonuo.modular.scrproduction.param.ScrProductionParam; +import vip.xiaonuo.modular.scrproduction.service.ScrProductionService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import vip.xiaonuo.modular.scrrawmaterials.entity.ScrRawMaterials; +import vip.xiaonuo.modular.scrrawmaterials.service.ScrRawMaterialsService; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDate; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 产量service接口实现类 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ +@Service +public class ScrProductionServiceImpl extends ServiceImpl implements ScrProductionService { + @Resource + private ScrRawMaterialsService scrRawMaterialsService; + @Override + public PageResult page(ScrProductionParam scrProductionParam) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (ObjectUtil.isNotNull(scrProductionParam)) { + + // 根据日期 查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getProductionDay())) { + queryWrapper.lambda().eq(ScrProduction::getProductionDay, scrProductionParam.getProductionDay()); + } + // 根据炉号 查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getFurnaceNumber())) { + queryWrapper.lambda().eq(ScrProduction::getFurnaceNumber, scrProductionParam.getFurnaceNumber()); + } + // 根据产品 查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getProduct())) { + queryWrapper.lambda().eq(ScrProduction::getProduct, scrProductionParam.getProduct()); + } + // 根据产量 查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getProduction())) { + queryWrapper.lambda().eq(ScrProduction::getProduction, scrProductionParam.getProduction()); + } + // 根据合格率 查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getPassRate())) { + queryWrapper.lambda().eq(ScrProduction::getPassRate, scrProductionParam.getPassRate()); + } + } + return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); + } + + @Override + public List list(ScrProductionParam scrProductionParam) { + return this.list(); + } + + @Override + public void add(ScrProductionParam scrProductionParam) { + ScrProduction scrProduction = new ScrProduction(); + BeanUtil.copyProperties(scrProductionParam, scrProduction); + this.save(scrProduction); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(List scrProductionParamList) { + scrProductionParamList.forEach(scrProductionParam -> { + this.removeById(scrProductionParam.getId()); + }); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void edit(ScrProductionParam scrProductionParam) { + ScrProduction scrProduction = this.queryScrProduction(scrProductionParam); + BeanUtil.copyProperties(scrProductionParam, scrProduction); + this.updateById(scrProduction); + } + + @Override + public ScrProduction detail(ScrProductionParam scrProductionParam) { + return this.queryScrProduction(scrProductionParam); + } + + /** + * 获取产量 + * + * @author zyn + * @date 2025-09-10 10:03:01 + */ + private ScrProduction queryScrProduction(ScrProductionParam scrProductionParam) { + ScrProduction scrProduction = this.getById(scrProductionParam.getId()); + if (ObjectUtil.isNull(scrProduction)) { + throw new ServiceException(ScrProductionExceptionEnum.NOT_EXIST); + } + return scrProduction; + } + + @Override + public void export(ScrProductionParam scrProductionParam) { + List list = this.list(scrProductionParam); + PoiUtil.exportExcelWithStream("SnowyScrProduction.xls", ScrProduction.class, list); + } + + @Override + public ScrProductionDriParam driQuery(ScrProductionParam scrProductionParam) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (ObjectUtil.isNotNull(scrProductionParam)) { + // 按指定日期查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getProductionDay())) { + LocalDate targetDate = LocalDate.parse(scrProductionParam.getProductionDay()); + queryWrapper.lambda().eq(ScrProduction::getProductionDay, targetDate); + } + + // 按月份查询(如果有年份和月份参数) + if (ObjectUtil.isNotEmpty(scrProductionParam.getYear()) && ObjectUtil.isNotEmpty(scrProductionParam.getMonth())) { + Integer year = scrProductionParam.getYear(); + Integer month = scrProductionParam.getMonth(); + + LocalDate startDate = LocalDate.of(year, month, 1); + LocalDate endDate = startDate.withDayOfMonth(startDate.lengthOfMonth()); + + queryWrapper.lambda() + .ge(ScrProduction::getProductionDay, startDate) + .le(ScrProduction::getProductionDay, endDate); + } + + // 按年份查询(只有年份参数,没有月份参数) + else if (ObjectUtil.isNotEmpty(scrProductionParam.getYear())) { + Integer year = scrProductionParam.getYear(); + + LocalDate startDate = LocalDate.of(year, 1, 1); + LocalDate endDate = LocalDate.of(year, 12, 31); + + queryWrapper.lambda() + .ge(ScrProduction::getProductionDay, startDate) + .le(ScrProduction::getProductionDay, endDate); + } + + // 按日期范围查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getStartDate()) && ObjectUtil.isNotEmpty(scrProductionParam.getEndDate())) { + queryWrapper.lambda() + .ge(ScrProduction::getProductionDay, scrProductionParam.getStartDate()) + .le(ScrProduction::getProductionDay, scrProductionParam.getEndDate()); + } + + // 其他可能的过滤条件 + if (ObjectUtil.isNotEmpty(scrProductionParam.getFurnaceNumber())) { + queryWrapper.lambda().eq(ScrProduction::getFurnaceNumber, scrProductionParam.getFurnaceNumber()); + } + + if (ObjectUtil.isNotEmpty(scrProductionParam.getProduct())) { + queryWrapper.lambda().eq(ScrProduction::getProduct, scrProductionParam.getProduct()); + } + } + + // 查询符合条件的所有产量记录 + List productions = this.list(queryWrapper); +// 计算单耗 + BigDecimal units = productions.stream() + .map(ScrProduction::getUnits) + .filter(ObjectUtil::isNotEmpty) + .reduce(BigDecimal.ZERO, BigDecimal::add); + // 计算总产量 + BigDecimal totalProduction = productions.stream() + .map(ScrProduction::getProduction) + .filter(ObjectUtil::isNotEmpty) + .reduce(BigDecimal.ZERO, BigDecimal::add); + + // 计算平均合格率 + BigDecimal avgPassRate =null; + if (!productions.isEmpty()) { + List validPassRates = productions.stream() + .map(ScrProduction::getPassRate) + .filter(ObjectUtil::isNotEmpty) + .collect(Collectors.toList()); + + if (!validPassRates.isEmpty()) { + BigDecimal sumPassRate = validPassRates.stream() + .reduce(BigDecimal.ZERO, BigDecimal::add); + avgPassRate = sumPassRate.divide(BigDecimal.valueOf(validPassRates.size()), 4, RoundingMode.HALF_UP); + } + } + + // 创建返回对象 + ScrProductionDriParam result = new ScrProductionDriParam(); + result.setProduction(totalProduction); + result.setPassRate(avgPassRate); + result.setUnits(units); + + return result; + } + + @Override + public List driQhQuery(ScrProductionParam scrProductionParam) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + + if (ObjectUtil.isNotNull(scrProductionParam)) { + // 按指定日期查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getProductionDay())) { + queryWrapper.lambda().eq(ScrProduction::getProductionDay, scrProductionParam.getProductionDay()); + } + + // 按年月查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getYear()) && ObjectUtil.isNotEmpty(scrProductionParam.getMonth())) { + Integer year = scrProductionParam.getYear(); + Integer month = scrProductionParam.getMonth(); + + LocalDate startDate = LocalDate.of(year, month, 1); + LocalDate endDate = startDate.withDayOfMonth(startDate.lengthOfMonth()); + + queryWrapper.lambda() + .ge(ScrProduction::getProductionDay, startDate) + .le(ScrProduction::getProductionDay, endDate); + } + // 按年度查询 + else if (ObjectUtil.isNotEmpty(scrProductionParam.getYear())) { + Integer year = scrProductionParam.getYear(); + + LocalDate startDate = LocalDate.of(year, 1, 1); + LocalDate endDate = LocalDate.of(year, 12, 31); + + queryWrapper.lambda() + .ge(ScrProduction::getProductionDay, startDate) + .le(ScrProduction::getProductionDay, endDate); + } + + // 按日期范围查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getStartDate()) && ObjectUtil.isNotEmpty(scrProductionParam.getEndDate())) { + queryWrapper.lambda() + .ge(ScrProduction::getProductionDay, scrProductionParam.getStartDate()) + .le(ScrProduction::getProductionDay, scrProductionParam.getEndDate()); + } + + // 按产品查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getProduct())) { + queryWrapper.lambda().eq(ScrProduction::getProduct, scrProductionParam.getProduct()); + } + } + + // 查询原始数据 + List productions = this.list(queryWrapper); + + // 按炉号分组并聚合产量 + return productions.stream() + .collect(Collectors.groupingBy(ScrProduction::getFurnaceNumber)) + .entrySet() + .stream() + .map(entry -> { + String furnaceNumber = entry.getKey(); + List furnaceProductions = entry.getValue(); + + // 创建聚合记录 + ScrProduction aggregated = new ScrProduction(); + aggregated.setFurnaceNumber(furnaceNumber); + + // 聚合产量(只聚合产量) + BigDecimal totalProduction = furnaceProductions.stream() + .map(ScrProduction::getProduction) + .filter(ObjectUtil::isNotEmpty) + .reduce(BigDecimal.ZERO, BigDecimal::add); + aggregated.setProduction(totalProduction); + + return aggregated; + }) + .collect(Collectors.toList()); + } + + @Override + public List driMaterQuery(ScrProductionParam scrProductionParam) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + + if (ObjectUtil.isNotNull(scrProductionParam)) { + // 按指定日期查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getProductionDay())) { + queryWrapper.lambda().eq(ScrProduction::getProductionDay, scrProductionParam.getProductionDay()); + } + + // 按年月查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getYear()) && ObjectUtil.isNotEmpty(scrProductionParam.getMonth())) { + Integer year = scrProductionParam.getYear(); + Integer month = scrProductionParam.getMonth(); + + LocalDate startDate = LocalDate.of(year, month, 1); + LocalDate endDate = startDate.withDayOfMonth(startDate.lengthOfMonth()); + + queryWrapper.lambda() + .ge(ScrProduction::getProductionDay, startDate) + .le(ScrProduction::getProductionDay, endDate); + } + // 按年度查询 + else if (ObjectUtil.isNotEmpty(scrProductionParam.getYear())) { + Integer year = scrProductionParam.getYear(); + + LocalDate startDate = LocalDate.of(year, 1, 1); + LocalDate endDate = LocalDate.of(year, 12, 31); + + queryWrapper.lambda() + .ge(ScrProduction::getProductionDay, startDate) + .le(ScrProduction::getProductionDay, endDate); + } + + // 按日期范围查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getStartDate()) && ObjectUtil.isNotEmpty(scrProductionParam.getEndDate())) { + queryWrapper.lambda() + .ge(ScrProduction::getProductionDay, scrProductionParam.getStartDate()) + .le(ScrProduction::getProductionDay, scrProductionParam.getEndDate()); + } + + // 按炉号查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getFurnaceNumber())) { + queryWrapper.lambda().eq(ScrProduction::getFurnaceNumber, scrProductionParam.getFurnaceNumber()); + } + } + + // 添加产品过滤条件:只查询硅锰、铬铁、硅铁 + queryWrapper.lambda().in(ScrProduction::getProduct, "硅锰", "铬铁", "硅铁"); + + // 查询产量数据 + List productions = this.list(queryWrapper); + + // 获取涉及的炉号列表 + List furnaceNumbers = productions.stream() + .map(ScrProduction::getFurnaceNumber) + .distinct() + .collect(Collectors.toList()); + + // 如果没有炉号数据,直接返回空列表 + if (furnaceNumbers.isEmpty()) { + return Collections.emptyList(); + } + + // 查询原材料用量数据 + QueryWrapper rawMaterialsQueryWrapper = new QueryWrapper<>(); + rawMaterialsQueryWrapper.lambda().in(ScrRawMaterials::getFurnaceNumber, furnaceNumbers); + + // 添加时间条件到原材料查询 + if (ObjectUtil.isNotNull(scrProductionParam)) { + // 按指定日期查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getProductionDay())) { + rawMaterialsQueryWrapper.lambda().eq(ScrRawMaterials::getConsumptionDay, scrProductionParam.getProductionDay()); + } + + // 按年月查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getYear()) && ObjectUtil.isNotEmpty(scrProductionParam.getMonth())) { + Integer year = scrProductionParam.getYear(); + Integer month = scrProductionParam.getMonth(); + + LocalDate startDate = LocalDate.of(year, month, 1); + LocalDate endDate = startDate.withDayOfMonth(startDate.lengthOfMonth()); + + rawMaterialsQueryWrapper.lambda() + .ge(ScrRawMaterials::getConsumptionDay, startDate) + .le(ScrRawMaterials::getConsumptionDay, endDate); + } + // 按年度查询 + else if (ObjectUtil.isNotEmpty(scrProductionParam.getYear())) { + Integer year = scrProductionParam.getYear(); + + LocalDate startDate = LocalDate.of(year, 1, 1); + LocalDate endDate = LocalDate.of(year, 12, 31); + + rawMaterialsQueryWrapper.lambda() + .ge(ScrRawMaterials::getConsumptionDay, startDate) + .le(ScrRawMaterials::getConsumptionDay, endDate); + } + + // 按日期范围查询 + if (ObjectUtil.isNotEmpty(scrProductionParam.getStartDate()) && ObjectUtil.isNotEmpty(scrProductionParam.getEndDate())) { + rawMaterialsQueryWrapper.lambda() + .ge(ScrRawMaterials::getConsumptionDay, scrProductionParam.getStartDate()) + .le(ScrRawMaterials::getConsumptionDay, scrProductionParam.getEndDate()); + } + } + + List rawMaterialsList = scrRawMaterialsService.list(rawMaterialsQueryWrapper); + + // 按产品分组并聚合数据,保持炉号对应关系 + return productions.stream() + .collect(Collectors.groupingBy(ScrProduction::getProduct)) + .entrySet() + .stream() + .map(entry -> { + String product = entry.getKey(); + List productProductions = entry.getValue(); + + // 创建产品参数对象 + ScrProductionMaterParam productParam = new ScrProductionMaterParam(); + productParam.setTitle(product); + + // 聚合该产品的总产量 + BigDecimal totalProduction = productProductions.stream() + .map(ScrProduction::getProduction) + .filter(ObjectUtil::isNotEmpty) + .reduce(BigDecimal.ZERO, BigDecimal::add); + productParam.setPower(totalProduction); // 使用power字段存储总产量 + + // 获取该产品涉及的炉号 + List productFurnaceNumbers = productProductions.stream() + .map(ScrProduction::getFurnaceNumber) + .distinct() + .collect(Collectors.toList()); + + // 筛选出该产品涉及的原材料数据 + List productRawMaterials = rawMaterialsList.stream() + .filter(material -> productFurnaceNumbers.contains(material.getFurnaceNumber())) + .collect(Collectors.toList()); + + // 计算该产品涉及炉号的原材料总用量 + BigDecimal totalConsumption = productRawMaterials.stream() + .map(ScrRawMaterials::getConsumption) + .filter(ObjectUtil::isNotEmpty) + .reduce(BigDecimal.ZERO, BigDecimal::add); + productParam.setConsumption(totalConsumption); + + // 按原材料名称分组并聚合用量,确保只包含该产品的炉号数据 + List materialList = productRawMaterials.stream() + .collect(Collectors.groupingBy(ScrRawMaterials::getRawMaterials)) + .entrySet() + .stream() + .map(materialEntry -> { + String rawMaterialName = materialEntry.getKey(); + List materials = materialEntry.getValue(); + + ScrProductionMaterParam materialParam = new ScrProductionMaterParam(); + materialParam.setTitle(rawMaterialName); + + // 计算该原材料的总用量(仅该产品的炉号) + BigDecimal materialConsumption = materials.stream() + .map(ScrRawMaterials::getConsumption) + .filter(ObjectUtil::isNotEmpty) + .reduce(BigDecimal.ZERO, BigDecimal::add); + materialParam.setConsumption(materialConsumption); + + return materialParam; + }) + .collect(Collectors.toList()); + + productParam.setList(materialList); + return productParam; + }) + .collect(Collectors.toList()); + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/controller/ScrRawMaterialsController.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/controller/ScrRawMaterialsController.java new file mode 100644 index 0000000..eb6e8c8 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/controller/ScrRawMaterialsController.java @@ -0,0 +1,148 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrrawmaterials.controller; + +import vip.xiaonuo.core.annotion.BusinessLog; +import vip.xiaonuo.core.annotion.Permission; +import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum; +import vip.xiaonuo.core.pojo.response.ResponseData; +import vip.xiaonuo.core.pojo.response.SuccessResponseData; +import vip.xiaonuo.modular.scrrawmaterials.param.ScrRawMaterialsParam; +import vip.xiaonuo.modular.scrrawmaterials.service.ScrRawMaterialsService; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import javax.annotation.Resource; +import java.util.List; + +/** + * 原材料控制器 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ +@RestController +public class ScrRawMaterialsController { + + @Resource + private ScrRawMaterialsService scrRawMaterialsService; + + /** + * 查询原材料 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + @Permission + @GetMapping("/scrRawMaterials/page") + @BusinessLog(title = "原材料_查询", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData page(ScrRawMaterialsParam scrRawMaterialsParam) { + return new SuccessResponseData(scrRawMaterialsService.page(scrRawMaterialsParam)); + } + + /** + * 添加原材料 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + @Permission + @PostMapping("/scrRawMaterials/add") + @BusinessLog(title = "原材料_增加", opType = LogAnnotionOpTypeEnum.ADD) + public ResponseData add(@RequestBody @Validated(ScrRawMaterialsParam.add.class) ScrRawMaterialsParam scrRawMaterialsParam) { + scrRawMaterialsService.add(scrRawMaterialsParam); + return new SuccessResponseData(); + } + + /** + * 删除原材料,可批量删除 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + @Permission + @PostMapping("/scrRawMaterials/delete") + @BusinessLog(title = "原材料_删除", opType = LogAnnotionOpTypeEnum.DELETE) + public ResponseData delete(@RequestBody @Validated(ScrRawMaterialsParam.delete.class) List scrRawMaterialsParamList) { + scrRawMaterialsService.delete(scrRawMaterialsParamList); + return new SuccessResponseData(); + } + + /** + * 编辑原材料 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + @Permission + @PostMapping("/scrRawMaterials/edit") + @BusinessLog(title = "原材料_编辑", opType = LogAnnotionOpTypeEnum.EDIT) + public ResponseData edit(@RequestBody @Validated(ScrRawMaterialsParam.edit.class) ScrRawMaterialsParam scrRawMaterialsParam) { + scrRawMaterialsService.edit(scrRawMaterialsParam); + return new SuccessResponseData(); + } + + /** + * 查看原材料 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + @Permission + @GetMapping("/scrRawMaterials/detail") + @BusinessLog(title = "原材料_查看", opType = LogAnnotionOpTypeEnum.DETAIL) + public ResponseData detail(@Validated(ScrRawMaterialsParam.detail.class) ScrRawMaterialsParam scrRawMaterialsParam) { + return new SuccessResponseData(scrRawMaterialsService.detail(scrRawMaterialsParam)); + } + + /** + * 原材料列表 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + @Permission + @GetMapping("/scrRawMaterials/list") + @BusinessLog(title = "原材料_列表", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData list(ScrRawMaterialsParam scrRawMaterialsParam) { + return new SuccessResponseData(scrRawMaterialsService.list(scrRawMaterialsParam)); + } + + /** + * 导出系统用户 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + @Permission + @GetMapping("/scrRawMaterials/export") + @BusinessLog(title = "原材料_导出", opType = LogAnnotionOpTypeEnum.EXPORT) + public void export(ScrRawMaterialsParam scrRawMaterialsParam) { + scrRawMaterialsService.export(scrRawMaterialsParam); + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/entity/ScrRawMaterials.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/entity/ScrRawMaterials.java new file mode 100644 index 0000000..ec3dd21 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/entity/ScrRawMaterials.java @@ -0,0 +1,76 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrrawmaterials.entity; + +import com.baomidou.mybatisplus.annotation.*; +import vip.xiaonuo.core.pojo.base.entity.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.*; +import cn.afterturn.easypoi.excel.annotation.Excel; +import java.math.BigDecimal; + +/** + * 原材料 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("scr_raw_materials") +public class ScrRawMaterials extends BaseEntity { + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + + /** + * 日期 + */ + @Excel(name = "日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20) + private Date consumptionDay; + + /** + * 炉号 + */ + @Excel(name = "炉号") + private String furnaceNumber; + + /** + * 原材料 + */ + @Excel(name = "原材料") + private String rawMaterials; + + /** + * 用量 + */ + @Excel(name = "用量") + private BigDecimal consumption; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/enums/ScrRawMaterialsExceptionEnum.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/enums/ScrRawMaterialsExceptionEnum.java new file mode 100644 index 0000000..6d23f36 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/enums/ScrRawMaterialsExceptionEnum.java @@ -0,0 +1,64 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrrawmaterials.enums; + +import vip.xiaonuo.core.annotion.ExpEnumType; +import vip.xiaonuo.core.exception.enums.abs.AbstractBaseExceptionEnum; +import vip.xiaonuo.core.factory.ExpEnumCodeFactory; +import vip.xiaonuo.sys.core.consts.SysExpEnumConstant; + +/** + * 原材料 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ +@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE) +public enum ScrRawMaterialsExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 数据不存在 + */ + NOT_EXIST(1, "此数据不存在"); + + private final Integer code; + + private final String message; + ScrRawMaterialsExceptionEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + + @Override + public Integer getCode() { + return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code); + } + + @Override + public String getMessage() { + return message; + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/mapper/ScrRawMaterialsMapper.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/mapper/ScrRawMaterialsMapper.java new file mode 100644 index 0000000..4731b53 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/mapper/ScrRawMaterialsMapper.java @@ -0,0 +1,37 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrrawmaterials.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import vip.xiaonuo.modular.scrrawmaterials.entity.ScrRawMaterials; + +/** + * 原材料 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ +public interface ScrRawMaterialsMapper extends BaseMapper { +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/mapper/mapping/ScrRawMaterialsMapper.xml b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/mapper/mapping/ScrRawMaterialsMapper.xml new file mode 100644 index 0000000..8758ccb --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/mapper/mapping/ScrRawMaterialsMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/param/ScrRawMaterialsParam.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/param/ScrRawMaterialsParam.java new file mode 100644 index 0000000..532dce1 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/param/ScrRawMaterialsParam.java @@ -0,0 +1,73 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrrawmaterials.param; + +import vip.xiaonuo.core.pojo.base.param.BaseParam; +import lombok.Data; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.NotBlank; +import java.util.*; +import java.math.BigDecimal; + +/** +* 原材料参数类 + * + * @author zyn + * @date 2025-09-10 10:03:02 +*/ +@Data +public class ScrRawMaterialsParam extends BaseParam { + + /** + * 主键 + */ + @NotNull(message = "主键不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class}) + private Long id; + + /** + * 日期 + */ + @NotNull(message = "日期不能为空,请检查consumptionDay参数", groups = {add.class, edit.class}) + private String consumptionDay; + + /** + * 炉号 + */ + @NotBlank(message = "炉号不能为空,请检查furnaceNumber参数", groups = {add.class, edit.class}) + private String furnaceNumber; + + /** + * 原材料 + */ + @NotBlank(message = "原材料不能为空,请检查rawMaterials参数", groups = {add.class, edit.class}) + private String rawMaterials; + + /** + * 用量 + */ + @NotNull(message = "用量不能为空,请检查consumption参数", groups = {add.class, edit.class}) + private BigDecimal consumption; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/service/ScrRawMaterialsService.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/service/ScrRawMaterialsService.java new file mode 100644 index 0000000..531c0e5 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/service/ScrRawMaterialsService.java @@ -0,0 +1,97 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrrawmaterials.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import vip.xiaonuo.core.pojo.page.PageResult; +import vip.xiaonuo.modular.scrrawmaterials.entity.ScrRawMaterials; +import vip.xiaonuo.modular.scrrawmaterials.param.ScrRawMaterialsParam; +import java.util.List; + +/** + * 原材料service接口 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ +public interface ScrRawMaterialsService extends IService { + + /** + * 查询原材料 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + PageResult page(ScrRawMaterialsParam scrRawMaterialsParam); + + /** + * 原材料列表 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + List list(ScrRawMaterialsParam scrRawMaterialsParam); + + /** + * 添加原材料 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + void add(ScrRawMaterialsParam scrRawMaterialsParam); + + /** + * 删除原材料 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + void delete(List scrRawMaterialsParamList); + + /** + * 编辑原材料 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + void edit(ScrRawMaterialsParam scrRawMaterialsParam); + + /** + * 查看原材料 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + ScrRawMaterials detail(ScrRawMaterialsParam scrRawMaterialsParam); + + /** + * 导出原材料 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + void export(ScrRawMaterialsParam scrRawMaterialsParam); + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/service/impl/ScrRawMaterialsServiceImpl.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/service/impl/ScrRawMaterialsServiceImpl.java new file mode 100644 index 0000000..e5c1224 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrrawmaterials/service/impl/ScrRawMaterialsServiceImpl.java @@ -0,0 +1,136 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrrawmaterials.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import vip.xiaonuo.core.consts.CommonConstant; +import vip.xiaonuo.core.enums.CommonStatusEnum; +import vip.xiaonuo.core.exception.ServiceException; +import vip.xiaonuo.core.factory.PageFactory; +import vip.xiaonuo.core.pojo.page.PageResult; +import vip.xiaonuo.core.util.PoiUtil; +import vip.xiaonuo.modular.scrrawmaterials.entity.ScrRawMaterials; +import vip.xiaonuo.modular.scrrawmaterials.enums.ScrRawMaterialsExceptionEnum; +import vip.xiaonuo.modular.scrrawmaterials.mapper.ScrRawMaterialsMapper; +import vip.xiaonuo.modular.scrrawmaterials.param.ScrRawMaterialsParam; +import vip.xiaonuo.modular.scrrawmaterials.service.ScrRawMaterialsService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import java.util.List; + +/** + * 原材料service接口实现类 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ +@Service +public class ScrRawMaterialsServiceImpl extends ServiceImpl implements ScrRawMaterialsService { + + @Override + public PageResult page(ScrRawMaterialsParam scrRawMaterialsParam) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (ObjectUtil.isNotNull(scrRawMaterialsParam)) { + + // 根据日期 查询 + if (ObjectUtil.isNotEmpty(scrRawMaterialsParam.getConsumptionDay())) { + queryWrapper.lambda().eq(ScrRawMaterials::getConsumptionDay, scrRawMaterialsParam.getConsumptionDay()); + } + // 根据炉号 查询 + if (ObjectUtil.isNotEmpty(scrRawMaterialsParam.getFurnaceNumber())) { + queryWrapper.lambda().eq(ScrRawMaterials::getFurnaceNumber, scrRawMaterialsParam.getFurnaceNumber()); + } + // 根据原材料 查询 + if (ObjectUtil.isNotEmpty(scrRawMaterialsParam.getRawMaterials())) { + queryWrapper.lambda().eq(ScrRawMaterials::getRawMaterials, scrRawMaterialsParam.getRawMaterials()); + } + // 根据用量 查询 + if (ObjectUtil.isNotEmpty(scrRawMaterialsParam.getConsumption())) { + queryWrapper.lambda().eq(ScrRawMaterials::getConsumption, scrRawMaterialsParam.getConsumption()); + } + } + return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); + } + + @Override + public List list(ScrRawMaterialsParam scrRawMaterialsParam) { + return this.list(); + } + + @Override + public void add(ScrRawMaterialsParam scrRawMaterialsParam) { + ScrRawMaterials scrRawMaterials = new ScrRawMaterials(); + BeanUtil.copyProperties(scrRawMaterialsParam, scrRawMaterials); + this.save(scrRawMaterials); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(List scrRawMaterialsParamList) { + scrRawMaterialsParamList.forEach(scrRawMaterialsParam -> { + this.removeById(scrRawMaterialsParam.getId()); + }); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void edit(ScrRawMaterialsParam scrRawMaterialsParam) { + ScrRawMaterials scrRawMaterials = this.queryScrRawMaterials(scrRawMaterialsParam); + BeanUtil.copyProperties(scrRawMaterialsParam, scrRawMaterials); + this.updateById(scrRawMaterials); + } + + @Override + public ScrRawMaterials detail(ScrRawMaterialsParam scrRawMaterialsParam) { + return this.queryScrRawMaterials(scrRawMaterialsParam); + } + + /** + * 获取原材料 + * + * @author zyn + * @date 2025-09-10 10:03:02 + */ + private ScrRawMaterials queryScrRawMaterials(ScrRawMaterialsParam scrRawMaterialsParam) { + ScrRawMaterials scrRawMaterials = this.getById(scrRawMaterialsParam.getId()); + if (ObjectUtil.isNull(scrRawMaterials)) { + throw new ServiceException(ScrRawMaterialsExceptionEnum.NOT_EXIST); + } + return scrRawMaterials; + } + + @Override + public void export(ScrRawMaterialsParam scrRawMaterialsParam) { + List list = this.list(scrRawMaterialsParam); + PoiUtil.exportExcelWithStream("SnowyScrRawMaterials.xls", ScrRawMaterials.class, list); + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/controller/ScrSecurityController.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/controller/ScrSecurityController.java new file mode 100644 index 0000000..f513442 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/controller/ScrSecurityController.java @@ -0,0 +1,154 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrsecurity.controller; + +import vip.xiaonuo.core.annotion.BusinessLog; +import vip.xiaonuo.core.annotion.Permission; +import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum; +import vip.xiaonuo.core.pojo.response.ResponseData; +import vip.xiaonuo.core.pojo.response.SuccessResponseData; +import vip.xiaonuo.modular.scrproduction.param.ScrProductionParam; +import vip.xiaonuo.modular.scrsecurity.param.ScrSecurityParam; +import vip.xiaonuo.modular.scrsecurity.service.ScrSecurityService; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import javax.annotation.Resource; +import java.util.List; + +/** + * 安全异常事件控制器 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ +@RestController +public class ScrSecurityController { + + @Resource + private ScrSecurityService scrSecurityService; + + /** + * 查询安全异常事件 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + @Permission + @GetMapping("/scrSecurity/page") + @BusinessLog(title = "安全异常事件_查询", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData page(ScrSecurityParam scrSecurityParam) { + return new SuccessResponseData(scrSecurityService.page(scrSecurityParam)); + } + + /** + * 添加安全异常事件 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + @Permission + @PostMapping("/scrSecurity/add") + @BusinessLog(title = "安全异常事件_增加", opType = LogAnnotionOpTypeEnum.ADD) + public ResponseData add(@RequestBody @Validated(ScrSecurityParam.add.class) ScrSecurityParam scrSecurityParam) { + scrSecurityService.add(scrSecurityParam); + return new SuccessResponseData(); + } + + /** + * 删除安全异常事件,可批量删除 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + @Permission + @PostMapping("/scrSecurity/delete") + @BusinessLog(title = "安全异常事件_删除", opType = LogAnnotionOpTypeEnum.DELETE) + public ResponseData delete(@RequestBody @Validated(ScrSecurityParam.delete.class) List scrSecurityParamList) { + scrSecurityService.delete(scrSecurityParamList); + return new SuccessResponseData(); + } + + /** + * 编辑安全异常事件 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + @Permission + @PostMapping("/scrSecurity/edit") + @BusinessLog(title = "安全异常事件_编辑", opType = LogAnnotionOpTypeEnum.EDIT) + public ResponseData edit(@RequestBody @Validated(ScrSecurityParam.edit.class) ScrSecurityParam scrSecurityParam) { + scrSecurityService.edit(scrSecurityParam); + return new SuccessResponseData(); + } + + /** + * 查看安全异常事件 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + @Permission + @GetMapping("/scrSecurity/detail") + @BusinessLog(title = "安全异常事件_查看", opType = LogAnnotionOpTypeEnum.DETAIL) + public ResponseData detail(@Validated(ScrSecurityParam.detail.class) ScrSecurityParam scrSecurityParam) { + return new SuccessResponseData(scrSecurityService.detail(scrSecurityParam)); + } + + /** + * 安全异常事件列表 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + @Permission + @GetMapping("/scrSecurity/list") + @BusinessLog(title = "安全异常事件_列表", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData list(ScrSecurityParam scrSecurityParam) { + return new SuccessResponseData(scrSecurityService.list(scrSecurityParam)); + } + + /** + * 导出系统用户 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + @Permission + @GetMapping("/scrSecurity/export") + @BusinessLog(title = "安全异常事件_导出", opType = LogAnnotionOpTypeEnum.EXPORT) + public void export(ScrSecurityParam scrSecurityParam) { + scrSecurityService.export(scrSecurityParam); + } + + @GetMapping("/scrSecurity/driQuery") + @BusinessLog(title = "安全异常事件_大屏查询", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData driQuery(ScrSecurityParam scrSecurityParam) { + return new SuccessResponseData(scrSecurityService.driQuery(scrSecurityParam)); + } +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/entity/ScrSecurity.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/entity/ScrSecurity.java new file mode 100644 index 0000000..b2cfe2d --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/entity/ScrSecurity.java @@ -0,0 +1,87 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrsecurity.entity; + +import com.baomidou.mybatisplus.annotation.*; +import vip.xiaonuo.core.pojo.base.entity.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.*; +import cn.afterturn.easypoi.excel.annotation.Excel; + +/** + * 安全异常事件 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("scr_security") +public class ScrSecurity extends BaseEntity { + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + + /** + * 发生时间 + */ + @Excel(name = "发生时间", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20) + private Date happenTime; + + /** + * 事件类型 + */ + @Excel(name = "事件类型") + private String eventType; + + /** + * 标题 + */ + @Excel(name = "标题") + private String title; + + /** + * 内容 + */ + @Excel(name = "内容") + private String content; + + /** + * 应对处理 + */ + @Excel(name = "应对处理") + private String cope; + + /** + * 责任主体 + */ + @Excel(name = "责任主体") + private String responsible; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/enums/ScrSecurityExceptionEnum.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/enums/ScrSecurityExceptionEnum.java new file mode 100644 index 0000000..821549c --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/enums/ScrSecurityExceptionEnum.java @@ -0,0 +1,64 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrsecurity.enums; + +import vip.xiaonuo.core.annotion.ExpEnumType; +import vip.xiaonuo.core.exception.enums.abs.AbstractBaseExceptionEnum; +import vip.xiaonuo.core.factory.ExpEnumCodeFactory; +import vip.xiaonuo.sys.core.consts.SysExpEnumConstant; + +/** + * 安全异常事件 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ +@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE) +public enum ScrSecurityExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 数据不存在 + */ + NOT_EXIST(1, "此数据不存在"); + + private final Integer code; + + private final String message; + ScrSecurityExceptionEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + + @Override + public Integer getCode() { + return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code); + } + + @Override + public String getMessage() { + return message; + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/mapper/ScrSecurityMapper.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/mapper/ScrSecurityMapper.java new file mode 100644 index 0000000..b19ddff --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/mapper/ScrSecurityMapper.java @@ -0,0 +1,37 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrsecurity.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import vip.xiaonuo.modular.scrsecurity.entity.ScrSecurity; + +/** + * 安全异常事件 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ +public interface ScrSecurityMapper extends BaseMapper { +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/mapper/mapping/ScrSecurityMapper.xml b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/mapper/mapping/ScrSecurityMapper.xml new file mode 100644 index 0000000..39aa31e --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/mapper/mapping/ScrSecurityMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/param/ScrSecurityParam.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/param/ScrSecurityParam.java new file mode 100644 index 0000000..3c25f3d --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/param/ScrSecurityParam.java @@ -0,0 +1,87 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrsecurity.param; + +import vip.xiaonuo.core.pojo.base.param.BaseParam; +import lombok.Data; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.NotBlank; +import java.util.*; + +/** +* 安全异常事件参数类 + * + * @author zyn + * @date 2025-09-10 10:03:04 +*/ +@Data +public class ScrSecurityParam extends BaseParam { + + /** + * 主键 + */ + @NotNull(message = "主键不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class}) + private Long id; + + /** + * 发生时间 + */ + @NotNull(message = "发生时间不能为空,请检查happenTime参数", groups = {add.class, edit.class}) + private String happenTime; + + /** + * 事件类型 + */ + @NotBlank(message = "事件类型不能为空,请检查eventType参数", groups = {add.class, edit.class}) + private String eventType; + + /** + * 标题 + */ + @NotBlank(message = "标题不能为空,请检查title参数", groups = {add.class, edit.class}) + private String title; + + /** + * 内容 + */ + @NotBlank(message = "内容不能为空,请检查content参数", groups = {add.class, edit.class}) + private String content; + + /** + * 应对处理 + */ + @NotBlank(message = "应对处理不能为空,请检查cope参数", groups = {add.class, edit.class}) + private String cope; + + /** + * 责任主体 + */ + @NotBlank(message = "责任主体不能为空,请检查responsible参数", groups = {add.class, edit.class}) + private String responsible; + private Integer year; + private Integer month; + private Date startDate; + private Date endDate; +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/service/ScrSecurityService.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/service/ScrSecurityService.java new file mode 100644 index 0000000..b9fc150 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/service/ScrSecurityService.java @@ -0,0 +1,98 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrsecurity.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import vip.xiaonuo.core.pojo.page.PageResult; +import vip.xiaonuo.modular.scrsecurity.entity.ScrSecurity; +import vip.xiaonuo.modular.scrsecurity.param.ScrSecurityParam; +import java.util.List; + +/** + * 安全异常事件service接口 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ +public interface ScrSecurityService extends IService { + + /** + * 查询安全异常事件 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + PageResult page(ScrSecurityParam scrSecurityParam); + + /** + * 安全异常事件列表 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + List list(ScrSecurityParam scrSecurityParam); + + /** + * 添加安全异常事件 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + void add(ScrSecurityParam scrSecurityParam); + + /** + * 删除安全异常事件 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + void delete(List scrSecurityParamList); + + /** + * 编辑安全异常事件 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + void edit(ScrSecurityParam scrSecurityParam); + + /** + * 查看安全异常事件 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + ScrSecurity detail(ScrSecurityParam scrSecurityParam); + + /** + * 导出安全异常事件 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + void export(ScrSecurityParam scrSecurityParam); + + List driQuery(ScrSecurityParam scrSecurityParam); +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/service/impl/ScrSecurityServiceImpl.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/service/impl/ScrSecurityServiceImpl.java new file mode 100644 index 0000000..9e2abc2 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrsecurity/service/impl/ScrSecurityServiceImpl.java @@ -0,0 +1,185 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.scrsecurity.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import vip.xiaonuo.core.consts.CommonConstant; +import vip.xiaonuo.core.enums.CommonStatusEnum; +import vip.xiaonuo.core.exception.ServiceException; +import vip.xiaonuo.core.factory.PageFactory; +import vip.xiaonuo.core.pojo.page.PageResult; +import vip.xiaonuo.core.util.PoiUtil; +import vip.xiaonuo.modular.scrsecurity.entity.ScrSecurity; +import vip.xiaonuo.modular.scrsecurity.enums.ScrSecurityExceptionEnum; +import vip.xiaonuo.modular.scrsecurity.mapper.ScrSecurityMapper; +import vip.xiaonuo.modular.scrsecurity.param.ScrSecurityParam; +import vip.xiaonuo.modular.scrsecurity.service.ScrSecurityService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; + +/** + * 安全异常事件service接口实现类 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ +@Service +public class ScrSecurityServiceImpl extends ServiceImpl implements ScrSecurityService { + + @Override + public PageResult page(ScrSecurityParam scrSecurityParam) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (ObjectUtil.isNotNull(scrSecurityParam)) { + + // 根据发生时间 查询 + if (ObjectUtil.isNotEmpty(scrSecurityParam.getHappenTime())) { + queryWrapper.lambda().eq(ScrSecurity::getHappenTime, scrSecurityParam.getHappenTime()); + } + // 根据事件类型 查询 + if (ObjectUtil.isNotEmpty(scrSecurityParam.getEventType())) { + queryWrapper.lambda().eq(ScrSecurity::getEventType, scrSecurityParam.getEventType()); + } + // 根据标题 查询 + if (ObjectUtil.isNotEmpty(scrSecurityParam.getTitle())) { + queryWrapper.lambda().eq(ScrSecurity::getTitle, scrSecurityParam.getTitle()); + } + // 根据内容 查询 + if (ObjectUtil.isNotEmpty(scrSecurityParam.getContent())) { + queryWrapper.lambda().eq(ScrSecurity::getContent, scrSecurityParam.getContent()); + } + // 根据应对处理 查询 + if (ObjectUtil.isNotEmpty(scrSecurityParam.getCope())) { + queryWrapper.lambda().eq(ScrSecurity::getCope, scrSecurityParam.getCope()); + } + // 根据责任主体 查询 + if (ObjectUtil.isNotEmpty(scrSecurityParam.getResponsible())) { + queryWrapper.lambda().eq(ScrSecurity::getResponsible, scrSecurityParam.getResponsible()); + } + } + return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); + } + + @Override + public List list(ScrSecurityParam scrSecurityParam) { + return this.list(); + } + + @Override + public void add(ScrSecurityParam scrSecurityParam) { + ScrSecurity scrSecurity = new ScrSecurity(); + BeanUtil.copyProperties(scrSecurityParam, scrSecurity); + this.save(scrSecurity); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(List scrSecurityParamList) { + scrSecurityParamList.forEach(scrSecurityParam -> { + this.removeById(scrSecurityParam.getId()); + }); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void edit(ScrSecurityParam scrSecurityParam) { + ScrSecurity scrSecurity = this.queryScrSecurity(scrSecurityParam); + BeanUtil.copyProperties(scrSecurityParam, scrSecurity); + this.updateById(scrSecurity); + } + + @Override + public ScrSecurity detail(ScrSecurityParam scrSecurityParam) { + return this.queryScrSecurity(scrSecurityParam); + } + + /** + * 获取安全异常事件 + * + * @author zyn + * @date 2025-09-10 10:03:04 + */ + private ScrSecurity queryScrSecurity(ScrSecurityParam scrSecurityParam) { + ScrSecurity scrSecurity = this.getById(scrSecurityParam.getId()); + if (ObjectUtil.isNull(scrSecurity)) { + throw new ServiceException(ScrSecurityExceptionEnum.NOT_EXIST); + } + return scrSecurity; + } + + @Override + public void export(ScrSecurityParam scrSecurityParam) { + List list = this.list(scrSecurityParam); + PoiUtil.exportExcelWithStream("SnowyScrSecurity.xls", ScrSecurity.class, list); + } + + @Override + public List driQuery(ScrSecurityParam scrSecurityParam) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + + if (ObjectUtil.isNotNull(scrSecurityParam)) { + // 根据发生时间精确查询 + if (ObjectUtil.isNotEmpty(scrSecurityParam.getHappenTime())) { + queryWrapper.apply("DATE(happen_time) = {0}", scrSecurityParam.getHappenTime()); + } + + + // 根据年份查询 + if (ObjectUtil.isNotEmpty(scrSecurityParam.getYear())) { + // 使用数据库函数提取年份进行比较 + queryWrapper.apply("YEAR(happen_time) = {0}", scrSecurityParam.getYear()); + } + + // 根据年月查询 + if (ObjectUtil.isNotEmpty(scrSecurityParam.getYear()) && + ObjectUtil.isNotEmpty(scrSecurityParam.getMonth())) { + queryWrapper.apply("YEAR(happen_time) = {0} AND MONTH(happen_time) = {1}", + scrSecurityParam.getYear(), scrSecurityParam.getMonth()); + } + + // 根据日期范围查询 + if (ObjectUtil.isNotEmpty(scrSecurityParam.getStartDate()) && + ObjectUtil.isNotEmpty(scrSecurityParam.getEndDate())) { + queryWrapper.between(ScrSecurity::getHappenTime, + scrSecurityParam.getStartDate(), scrSecurityParam.getEndDate()); + } + + // 其他查询条件保持不变 + if (ObjectUtil.isNotEmpty(scrSecurityParam.getEventType())) { + queryWrapper.eq(ScrSecurity::getEventType, scrSecurityParam.getEventType()); + } + } + queryWrapper.orderByDesc(ScrSecurity::getHappenTime); + return this.list(queryWrapper); + } + +}