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/scrhidedata/controller/ScrHideDataController.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/controller/ScrHideDataController.java new file mode 100644 index 0000000..f13c623 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/controller/ScrHideDataController.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.scrhidedata.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.scrhidedata.param.ScrHideDataParam; +import vip.xiaonuo.modular.scrhidedata.service.ScrHideDataService; +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 1 + * @date 2025-10-13 17:15:20 + */ +@RestController +public class ScrHideDataController { + + @Resource + private ScrHideDataService scrHideDataService; + + /** + * 查询隐患整改 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + @Permission + @GetMapping("/scrHideData/page") + @BusinessLog(title = "隐患整改_查询", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData page(ScrHideDataParam scrHideDataParam) { + return new SuccessResponseData(scrHideDataService.page(scrHideDataParam)); + } + + /** + * 添加隐患整改 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + @Permission + @PostMapping("/scrHideData/add") + @BusinessLog(title = "隐患整改_增加", opType = LogAnnotionOpTypeEnum.ADD) + public ResponseData add(@RequestBody @Validated(ScrHideDataParam.add.class) ScrHideDataParam scrHideDataParam) { + scrHideDataService.add(scrHideDataParam); + return new SuccessResponseData(); + } + + /** + * 删除隐患整改,可批量删除 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + @Permission + @PostMapping("/scrHideData/delete") + @BusinessLog(title = "隐患整改_删除", opType = LogAnnotionOpTypeEnum.DELETE) + public ResponseData delete(@RequestBody @Validated(ScrHideDataParam.delete.class) List scrHideDataParamList) { + scrHideDataService.delete(scrHideDataParamList); + return new SuccessResponseData(); + } + + /** + * 编辑隐患整改 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + @Permission + @PostMapping("/scrHideData/edit") + @BusinessLog(title = "隐患整改_编辑", opType = LogAnnotionOpTypeEnum.EDIT) + public ResponseData edit(@RequestBody @Validated(ScrHideDataParam.edit.class) ScrHideDataParam scrHideDataParam) { + scrHideDataService.edit(scrHideDataParam); + return new SuccessResponseData(); + } + + /** + * 查看隐患整改 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + @Permission + @GetMapping("/scrHideData/detail") + @BusinessLog(title = "隐患整改_查看", opType = LogAnnotionOpTypeEnum.DETAIL) + public ResponseData detail(@Validated(ScrHideDataParam.detail.class) ScrHideDataParam scrHideDataParam) { + return new SuccessResponseData(scrHideDataService.detail(scrHideDataParam)); + } + + /** + * 隐患整改列表 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + @Permission + @GetMapping("/scrHideData/list") + @BusinessLog(title = "隐患整改_列表", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData list(ScrHideDataParam scrHideDataParam) { + return new SuccessResponseData(scrHideDataService.list(scrHideDataParam)); + } + + /** + * 导出系统用户 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + @Permission + @GetMapping("/scrHideData/export") + @BusinessLog(title = "隐患整改_导出", opType = LogAnnotionOpTypeEnum.EXPORT) + public void export(ScrHideDataParam scrHideDataParam) { + scrHideDataService.export(scrHideDataParam); + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/entity/ScrHideData.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/entity/ScrHideData.java new file mode 100644 index 0000000..48333ba --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/entity/ScrHideData.java @@ -0,0 +1,81 @@ +/* +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.scrhidedata.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 1 + * @date 2025-10-13 17:15:20 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("scr_hide_data") +public class ScrHideData extends BaseEntity { + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + + /** + * 年份 + */ + @Excel(name = "年份") + private Integer year; + + /** + * 月份 + */ + @Excel(name = "月份") + private Integer month; + + /** + * 隐患数量 + */ + @Excel(name = "隐患数量") + private Integer yhsl; + + /** + * 已整改 + */ + @Excel(name = "已整改") + private Integer yzg; + + /** + * 未整改 + */ + @Excel(name = "未整改") + private Integer wzg; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/enums/ScrHideDataExceptionEnum.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/enums/ScrHideDataExceptionEnum.java new file mode 100644 index 0000000..da9fd88 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/enums/ScrHideDataExceptionEnum.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.scrhidedata.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 1 + * @date 2025-10-13 17:15:20 + */ +@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE) +public enum ScrHideDataExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 数据不存在 + */ + NOT_EXIST(1, "此数据不存在"); + + private final Integer code; + + private final String message; + ScrHideDataExceptionEnum(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/scrhidedata/mapper/ScrHideDataMapper.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/mapper/ScrHideDataMapper.java new file mode 100644 index 0000000..7c7269c --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/mapper/ScrHideDataMapper.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.scrhidedata.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import vip.xiaonuo.modular.scrhidedata.entity.ScrHideData; + +/** + * 隐患整改 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ +public interface ScrHideDataMapper extends BaseMapper { +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/mapper/mapping/ScrHideDataMapper.xml b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/mapper/mapping/ScrHideDataMapper.xml new file mode 100644 index 0000000..e2f1ef4 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/mapper/mapping/ScrHideDataMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/param/ScrHideDataParam.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/param/ScrHideDataParam.java new file mode 100644 index 0000000..2712512 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/param/ScrHideDataParam.java @@ -0,0 +1,78 @@ +/* +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.scrhidedata.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 1 + * @date 2025-10-13 17:15:20 +*/ +@Data +public class ScrHideDataParam extends BaseParam { + + /** + * 主键 + */ + @NotNull(message = "主键不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class}) + private Long id; + + /** + * 年份 + */ + @NotNull(message = "年份不能为空,请检查year参数", groups = {add.class, edit.class}) + private Integer year; + + /** + * 月份 + */ + @NotNull(message = "月份不能为空,请检查month参数", groups = {add.class, edit.class}) + private Integer month; + + /** + * 隐患数量 + */ + @NotNull(message = "隐患数量不能为空,请检查yhsl参数", groups = {add.class, edit.class}) + private Integer yhsl; + + /** + * 已整改 + */ + @NotNull(message = "已整改不能为空,请检查yzg参数", groups = {add.class, edit.class}) + private Integer yzg; + + /** + * 未整改 + */ + @NotNull(message = "未整改不能为空,请检查wzg参数", groups = {add.class, edit.class}) + private Integer wzg; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/service/ScrHideDataService.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/service/ScrHideDataService.java new file mode 100644 index 0000000..7fb3ea9 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/service/ScrHideDataService.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.scrhidedata.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import vip.xiaonuo.core.pojo.page.PageResult; +import vip.xiaonuo.modular.scrhidedata.entity.ScrHideData; +import vip.xiaonuo.modular.scrhidedata.param.ScrHideDataParam; +import java.util.List; + +/** + * 隐患整改service接口 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ +public interface ScrHideDataService extends IService { + + /** + * 查询隐患整改 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + PageResult page(ScrHideDataParam scrHideDataParam); + + /** + * 隐患整改列表 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + List list(ScrHideDataParam scrHideDataParam); + + /** + * 添加隐患整改 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + void add(ScrHideDataParam scrHideDataParam); + + /** + * 删除隐患整改 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + void delete(List scrHideDataParamList); + + /** + * 编辑隐患整改 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + void edit(ScrHideDataParam scrHideDataParam); + + /** + * 查看隐患整改 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + ScrHideData detail(ScrHideDataParam scrHideDataParam); + + /** + * 导出隐患整改 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + void export(ScrHideDataParam scrHideDataParam); + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/service/impl/ScrHideDataServiceImpl.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/service/impl/ScrHideDataServiceImpl.java new file mode 100644 index 0000000..ac71eb3 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrhidedata/service/impl/ScrHideDataServiceImpl.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.scrhidedata.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.scrhidedata.entity.ScrHideData; +import vip.xiaonuo.modular.scrhidedata.enums.ScrHideDataExceptionEnum; +import vip.xiaonuo.modular.scrhidedata.mapper.ScrHideDataMapper; +import vip.xiaonuo.modular.scrhidedata.param.ScrHideDataParam; +import vip.xiaonuo.modular.scrhidedata.service.ScrHideDataService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import java.util.List; + +/** + * 隐患整改service接口实现类 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ +@Service +public class ScrHideDataServiceImpl extends ServiceImpl implements ScrHideDataService { + + @Override + public PageResult page(ScrHideDataParam scrHideDataParam) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (ObjectUtil.isNotNull(scrHideDataParam)) { + + // 根据年份 查询 + if (ObjectUtil.isNotEmpty(scrHideDataParam.getYear())) { + queryWrapper.lambda().eq(ScrHideData::getYear, scrHideDataParam.getYear()); + } + // 根据月份 查询 + if (ObjectUtil.isNotEmpty(scrHideDataParam.getMonth())) { + queryWrapper.lambda().eq(ScrHideData::getMonth, scrHideDataParam.getMonth()); + } + } + return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); + } + + @Override + public List list(ScrHideDataParam scrHideDataParam) { + return this.list(); + } + + @Override + public void add(ScrHideDataParam scrHideDataParam) { + ScrHideData scrHideData = new ScrHideData(); + BeanUtil.copyProperties(scrHideDataParam, scrHideData); + this.save(scrHideData); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(List scrHideDataParamList) { + scrHideDataParamList.forEach(scrHideDataParam -> { + this.removeById(scrHideDataParam.getId()); + }); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void edit(ScrHideDataParam scrHideDataParam) { + ScrHideData scrHideData = this.queryScrHideData(scrHideDataParam); + BeanUtil.copyProperties(scrHideDataParam, scrHideData); + this.updateById(scrHideData); + } + + @Override + public ScrHideData detail(ScrHideDataParam scrHideDataParam) { + return this.queryScrHideData(scrHideDataParam); + } + + /** + * 获取隐患整改 + * + * @author 1 + * @date 2025-10-13 17:15:20 + */ + private ScrHideData queryScrHideData(ScrHideDataParam scrHideDataParam) { + ScrHideData scrHideData = this.getById(scrHideDataParam.getId()); + if (ObjectUtil.isNull(scrHideData)) { + throw new ServiceException(ScrHideDataExceptionEnum.NOT_EXIST); + } + return scrHideData; + } + + @Override + public void export(ScrHideDataParam scrHideDataParam) { + List list = this.list(scrHideDataParam); + PoiUtil.exportExcelWithStream("SnowyScrHideData.xls", ScrHideData.class, list); + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/controller/ScrMeterDataController.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/controller/ScrMeterDataController.java new file mode 100644 index 0000000..bc3b342 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/controller/ScrMeterDataController.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.scrmeterdata.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.scrmeterdata.param.ScrMeterDataParam; +import vip.xiaonuo.modular.scrmeterdata.service.ScrMeterDataService; +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 2 + * @date 2025-10-13 17:55:42 + */ +@RestController +public class ScrMeterDataController { + + @Resource + private ScrMeterDataService scrMeterDataService; + + /** + * 查询电表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + @Permission + @GetMapping("/scrMeterData/page") + @BusinessLog(title = "电表_查询", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData page(ScrMeterDataParam scrMeterDataParam) { + return new SuccessResponseData(scrMeterDataService.page(scrMeterDataParam)); + } + + /** + * 添加电表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + @Permission + @PostMapping("/scrMeterData/add") + @BusinessLog(title = "电表_增加", opType = LogAnnotionOpTypeEnum.ADD) + public ResponseData add(@RequestBody @Validated(ScrMeterDataParam.add.class) ScrMeterDataParam scrMeterDataParam) { + scrMeterDataService.add(scrMeterDataParam); + return new SuccessResponseData(); + } + + /** + * 删除电表,可批量删除 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + @Permission + @PostMapping("/scrMeterData/delete") + @BusinessLog(title = "电表_删除", opType = LogAnnotionOpTypeEnum.DELETE) + public ResponseData delete(@RequestBody @Validated(ScrMeterDataParam.delete.class) List scrMeterDataParamList) { + scrMeterDataService.delete(scrMeterDataParamList); + return new SuccessResponseData(); + } + + /** + * 编辑电表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + @Permission + @PostMapping("/scrMeterData/edit") + @BusinessLog(title = "电表_编辑", opType = LogAnnotionOpTypeEnum.EDIT) + public ResponseData edit(@RequestBody @Validated(ScrMeterDataParam.edit.class) ScrMeterDataParam scrMeterDataParam) { + scrMeterDataService.edit(scrMeterDataParam); + return new SuccessResponseData(); + } + + /** + * 查看电表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + @Permission + @GetMapping("/scrMeterData/detail") + @BusinessLog(title = "电表_查看", opType = LogAnnotionOpTypeEnum.DETAIL) + public ResponseData detail(@Validated(ScrMeterDataParam.detail.class) ScrMeterDataParam scrMeterDataParam) { + return new SuccessResponseData(scrMeterDataService.detail(scrMeterDataParam)); + } + + /** + * 电表列表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + @Permission + @GetMapping("/scrMeterData/list") + @BusinessLog(title = "电表_列表", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData list(ScrMeterDataParam scrMeterDataParam) { + return new SuccessResponseData(scrMeterDataService.list(scrMeterDataParam)); + } + + /** + * 导出系统用户 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + @Permission + @GetMapping("/scrMeterData/export") + @BusinessLog(title = "电表_导出", opType = LogAnnotionOpTypeEnum.EXPORT) + public void export(ScrMeterDataParam scrMeterDataParam) { + scrMeterDataService.export(scrMeterDataParam); + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/entity/ScrMeterData.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/entity/ScrMeterData.java new file mode 100644 index 0000000..96d46cf --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/entity/ScrMeterData.java @@ -0,0 +1,83 @@ +/* +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.scrmeterdata.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; +import java.math.BigDecimal; + +/** + * 电表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("scr_meter_data") +public class ScrMeterData extends BaseEntity { + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + + /** + * 电表 + */ + @Excel(name = "电表") + private String name; + + /** + * 年份 + */ + @Excel(name = "年份") + private Integer year; + + /** + * 月份 + */ + @Excel(name = "月份") + private Integer month; + + /** + * 累计电量 + */ + @Excel(name = "累计电量") + private BigDecimal totalEcnum; + + /** + * 平均功率 + */ + @Excel(name = "平均功率") + private BigDecimal avgPower; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/enums/ScrMeterDataExceptionEnum.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/enums/ScrMeterDataExceptionEnum.java new file mode 100644 index 0000000..cf03537 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/enums/ScrMeterDataExceptionEnum.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.scrmeterdata.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 2 + * @date 2025-10-13 17:55:42 + */ +@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE) +public enum ScrMeterDataExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 数据不存在 + */ + NOT_EXIST(1, "此数据不存在"); + + private final Integer code; + + private final String message; + ScrMeterDataExceptionEnum(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/scrmeterdata/mapper/ScrMeterDataMapper.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/mapper/ScrMeterDataMapper.java new file mode 100644 index 0000000..4c51479 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/mapper/ScrMeterDataMapper.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.scrmeterdata.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import vip.xiaonuo.modular.scrmeterdata.entity.ScrMeterData; + +/** + * 电表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ +public interface ScrMeterDataMapper extends BaseMapper { +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/mapper/mapping/ScrMeterDataMapper.xml b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/mapper/mapping/ScrMeterDataMapper.xml new file mode 100644 index 0000000..01502f9 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/mapper/mapping/ScrMeterDataMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/param/ScrMeterDataParam.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/param/ScrMeterDataParam.java new file mode 100644 index 0000000..ff362b1 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/param/ScrMeterDataParam.java @@ -0,0 +1,80 @@ +/* +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.scrmeterdata.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; +import java.math.BigDecimal; + +/** +* 电表参数类 + * + * @author 2 + * @date 2025-10-13 17:55:42 +*/ +@Data +public class ScrMeterDataParam extends BaseParam { + + /** + * 主键 + */ + @NotNull(message = "主键不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class}) + private Long id; + + /** + * 电表 + */ + @NotBlank(message = "电表不能为空,请检查name参数", groups = {add.class, edit.class}) + private String name; + + /** + * 年份 + */ + @NotNull(message = "年份不能为空,请检查year参数", groups = {add.class, edit.class}) + private Integer year; + + /** + * 月份 + */ + @NotNull(message = "月份不能为空,请检查month参数", groups = {add.class, edit.class}) + private Integer month; + + /** + * 累计电量 + */ + @NotNull(message = "累计电量不能为空,请检查totalEcnum参数", groups = {add.class, edit.class}) + private BigDecimal totalEcnum; + + /** + * 平均功率 + */ + @NotNull(message = "平均功率不能为空,请检查avgPower参数", groups = {add.class, edit.class}) + private BigDecimal avgPower; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/service/ScrMeterDataService.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/service/ScrMeterDataService.java new file mode 100644 index 0000000..3feaa5a --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/service/ScrMeterDataService.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.scrmeterdata.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import vip.xiaonuo.core.pojo.page.PageResult; +import vip.xiaonuo.modular.scrmeterdata.entity.ScrMeterData; +import vip.xiaonuo.modular.scrmeterdata.param.ScrMeterDataParam; +import java.util.List; + +/** + * 电表service接口 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ +public interface ScrMeterDataService extends IService { + + /** + * 查询电表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + PageResult page(ScrMeterDataParam scrMeterDataParam); + + /** + * 电表列表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + List list(ScrMeterDataParam scrMeterDataParam); + + /** + * 添加电表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + void add(ScrMeterDataParam scrMeterDataParam); + + /** + * 删除电表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + void delete(List scrMeterDataParamList); + + /** + * 编辑电表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + void edit(ScrMeterDataParam scrMeterDataParam); + + /** + * 查看电表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + ScrMeterData detail(ScrMeterDataParam scrMeterDataParam); + + /** + * 导出电表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + void export(ScrMeterDataParam scrMeterDataParam); + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/service/impl/ScrMeterDataServiceImpl.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/service/impl/ScrMeterDataServiceImpl.java new file mode 100644 index 0000000..413b8d6 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrmeterdata/service/impl/ScrMeterDataServiceImpl.java @@ -0,0 +1,132 @@ +/* +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.scrmeterdata.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.scrmeterdata.entity.ScrMeterData; +import vip.xiaonuo.modular.scrmeterdata.enums.ScrMeterDataExceptionEnum; +import vip.xiaonuo.modular.scrmeterdata.mapper.ScrMeterDataMapper; +import vip.xiaonuo.modular.scrmeterdata.param.ScrMeterDataParam; +import vip.xiaonuo.modular.scrmeterdata.service.ScrMeterDataService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import java.util.List; + +/** + * 电表service接口实现类 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ +@Service +public class ScrMeterDataServiceImpl extends ServiceImpl implements ScrMeterDataService { + + @Override + public PageResult page(ScrMeterDataParam scrMeterDataParam) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (ObjectUtil.isNotNull(scrMeterDataParam)) { + + // 根据电表 查询 + if (ObjectUtil.isNotEmpty(scrMeterDataParam.getName())) { + queryWrapper.lambda().like(ScrMeterData::getName, scrMeterDataParam.getName()); + } + // 根据年份 查询 + if (ObjectUtil.isNotEmpty(scrMeterDataParam.getYear())) { + queryWrapper.lambda().eq(ScrMeterData::getYear, scrMeterDataParam.getYear()); + } + // 根据月份 查询 + if (ObjectUtil.isNotEmpty(scrMeterDataParam.getMonth())) { + queryWrapper.lambda().eq(ScrMeterData::getMonth, scrMeterDataParam.getMonth()); + } + } + return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); + } + + @Override + public List list(ScrMeterDataParam scrMeterDataParam) { + return this.list(); + } + + @Override + public void add(ScrMeterDataParam scrMeterDataParam) { + ScrMeterData scrMeterData = new ScrMeterData(); + BeanUtil.copyProperties(scrMeterDataParam, scrMeterData); + this.save(scrMeterData); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(List scrMeterDataParamList) { + scrMeterDataParamList.forEach(scrMeterDataParam -> { + this.removeById(scrMeterDataParam.getId()); + }); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void edit(ScrMeterDataParam scrMeterDataParam) { + ScrMeterData scrMeterData = this.queryScrMeterData(scrMeterDataParam); + BeanUtil.copyProperties(scrMeterDataParam, scrMeterData); + this.updateById(scrMeterData); + } + + @Override + public ScrMeterData detail(ScrMeterDataParam scrMeterDataParam) { + return this.queryScrMeterData(scrMeterDataParam); + } + + /** + * 获取电表 + * + * @author 2 + * @date 2025-10-13 17:55:42 + */ + private ScrMeterData queryScrMeterData(ScrMeterDataParam scrMeterDataParam) { + ScrMeterData scrMeterData = this.getById(scrMeterDataParam.getId()); + if (ObjectUtil.isNull(scrMeterData)) { + throw new ServiceException(ScrMeterDataExceptionEnum.NOT_EXIST); + } + return scrMeterData; + } + + @Override + public void export(ScrMeterDataParam scrMeterDataParam) { + List list = this.list(scrMeterDataParam); + PoiUtil.exportExcelWithStream("SnowyScrMeterData.xls", ScrMeterData.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..f95aa4a --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/mapper/mapping/ScrProductionMapper.xml @@ -0,0 +1,5 @@ + + + + + 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..b525c31 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrproduction/service/impl/ScrProductionServiceImpl.java @@ -0,0 +1,396 @@ +/* +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<>(); + buildDateQueryConditions(queryWrapper, scrProductionParam); + + // 查询符合条件的所有产量记录 + 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 = BigDecimal.valueOf(0); + 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<>(); + + buildDateQueryConditions(queryWrapper, scrProductionParam); + + // 查询原始数据 + 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<>(); + + buildDateQueryConditions(queryWrapper, scrProductionParam); + + // 添加产品过滤条件:只查询硅锰、铬铁、硅铁 + 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::getPower) + .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()); + } +/** + * 构建产量查询的通用日期条件 + * + * @param queryWrapper 查询构造器 + * @param scrProductionParam 查询参数 + */ +private void buildDateQueryConditions(QueryWrapper queryWrapper, ScrProductionParam 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()); + } +} + +} 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/scrriskdata/controller/ScrRiskDataController.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/controller/ScrRiskDataController.java new file mode 100644 index 0000000..b11c130 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/controller/ScrRiskDataController.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.scrriskdata.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.scrriskdata.param.ScrRiskDataParam; +import vip.xiaonuo.modular.scrriskdata.service.ScrRiskDataService; +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 1 + * @date 2025-10-13 17:08:52 + */ +@RestController +public class ScrRiskDataController { + + @Resource + private ScrRiskDataService scrRiskDataService; + + /** + * 查询风险排查 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + @Permission + @GetMapping("/scrRiskData/page") + @BusinessLog(title = "风险排查_查询", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData page(ScrRiskDataParam scrRiskDataParam) { + return new SuccessResponseData(scrRiskDataService.page(scrRiskDataParam)); + } + + /** + * 添加风险排查 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + @Permission + @PostMapping("/scrRiskData/add") + @BusinessLog(title = "风险排查_增加", opType = LogAnnotionOpTypeEnum.ADD) + public ResponseData add(@RequestBody @Validated(ScrRiskDataParam.add.class) ScrRiskDataParam scrRiskDataParam) { + scrRiskDataService.add(scrRiskDataParam); + return new SuccessResponseData(); + } + + /** + * 删除风险排查,可批量删除 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + @Permission + @PostMapping("/scrRiskData/delete") + @BusinessLog(title = "风险排查_删除", opType = LogAnnotionOpTypeEnum.DELETE) + public ResponseData delete(@RequestBody @Validated(ScrRiskDataParam.delete.class) List scrRiskDataParamList) { + scrRiskDataService.delete(scrRiskDataParamList); + return new SuccessResponseData(); + } + + /** + * 编辑风险排查 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + @Permission + @PostMapping("/scrRiskData/edit") + @BusinessLog(title = "风险排查_编辑", opType = LogAnnotionOpTypeEnum.EDIT) + public ResponseData edit(@RequestBody @Validated(ScrRiskDataParam.edit.class) ScrRiskDataParam scrRiskDataParam) { + scrRiskDataService.edit(scrRiskDataParam); + return new SuccessResponseData(); + } + + /** + * 查看风险排查 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + @Permission + @GetMapping("/scrRiskData/detail") + @BusinessLog(title = "风险排查_查看", opType = LogAnnotionOpTypeEnum.DETAIL) + public ResponseData detail(@Validated(ScrRiskDataParam.detail.class) ScrRiskDataParam scrRiskDataParam) { + return new SuccessResponseData(scrRiskDataService.detail(scrRiskDataParam)); + } + + /** + * 风险排查列表 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + @Permission + @GetMapping("/scrRiskData/list") + @BusinessLog(title = "风险排查_列表", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData list(ScrRiskDataParam scrRiskDataParam) { + return new SuccessResponseData(scrRiskDataService.list(scrRiskDataParam)); + } + + /** + * 导出系统用户 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + @Permission + @GetMapping("/scrRiskData/export") + @BusinessLog(title = "风险排查_导出", opType = LogAnnotionOpTypeEnum.EXPORT) + public void export(ScrRiskDataParam scrRiskDataParam) { + scrRiskDataService.export(scrRiskDataParam); + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/entity/ScrRiskData.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/entity/ScrRiskData.java new file mode 100644 index 0000000..b7c048a --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/entity/ScrRiskData.java @@ -0,0 +1,81 @@ +/* +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.scrriskdata.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 1 + * @date 2025-10-13 17:08:52 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("scr_risk_data") +public class ScrRiskData extends BaseEntity { + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + + /** + * 年份 + */ + @Excel(name = "年份") + private Integer year; + + /** + * 月份 + */ + @Excel(name = "月份") + private Integer month; + + /** + * 已排查 + */ + @Excel(name = "已排查") + private Integer ypc; + + /** + * 未排查 + */ + @Excel(name = "未排查") + private Integer wpc; + + /** + * 超期未排查 + */ + @Excel(name = "超期未排查") + private Integer cqwpc; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/enums/ScrRiskDataExceptionEnum.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/enums/ScrRiskDataExceptionEnum.java new file mode 100644 index 0000000..07abe41 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/enums/ScrRiskDataExceptionEnum.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.scrriskdata.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 1 + * @date 2025-10-13 17:08:52 + */ +@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE) +public enum ScrRiskDataExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 数据不存在 + */ + NOT_EXIST(1, "此数据不存在"); + + private final Integer code; + + private final String message; + ScrRiskDataExceptionEnum(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/scrriskdata/mapper/ScrRiskDataMapper.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/mapper/ScrRiskDataMapper.java new file mode 100644 index 0000000..8d746ef --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/mapper/ScrRiskDataMapper.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.scrriskdata.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import vip.xiaonuo.modular.scrriskdata.entity.ScrRiskData; + +/** + * 风险排查 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ +public interface ScrRiskDataMapper extends BaseMapper { +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/mapper/mapping/ScrRiskDataMapper.xml b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/mapper/mapping/ScrRiskDataMapper.xml new file mode 100644 index 0000000..f06ed32 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/mapper/mapping/ScrRiskDataMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/param/ScrRiskDataParam.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/param/ScrRiskDataParam.java new file mode 100644 index 0000000..3ef645d --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/param/ScrRiskDataParam.java @@ -0,0 +1,78 @@ +/* +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.scrriskdata.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 1 + * @date 2025-10-13 17:08:52 +*/ +@Data +public class ScrRiskDataParam extends BaseParam { + + /** + * 主键 + */ + @NotNull(message = "主键不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class}) + private Long id; + + /** + * 年份 + */ + @NotNull(message = "年份不能为空,请检查year参数", groups = {add.class, edit.class}) + private Integer year; + + /** + * 月份 + */ + @NotNull(message = "月份不能为空,请检查month参数", groups = {add.class, edit.class}) + private Integer month; + + /** + * 已排查 + */ + @NotNull(message = "已排查不能为空,请检查ypc参数", groups = {add.class, edit.class}) + private Integer ypc; + + /** + * 未排查 + */ + @NotNull(message = "未排查不能为空,请检查wpc参数", groups = {add.class, edit.class}) + private Integer wpc; + + /** + * 超期未排查 + */ + @NotNull(message = "超期未排查不能为空,请检查cqwpc参数", groups = {add.class, edit.class}) + private Integer cqwpc; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/service/ScrRiskDataService.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/service/ScrRiskDataService.java new file mode 100644 index 0000000..359ac08 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/service/ScrRiskDataService.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.scrriskdata.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import vip.xiaonuo.core.pojo.page.PageResult; +import vip.xiaonuo.modular.scrriskdata.entity.ScrRiskData; +import vip.xiaonuo.modular.scrriskdata.param.ScrRiskDataParam; +import java.util.List; + +/** + * 风险排查service接口 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ +public interface ScrRiskDataService extends IService { + + /** + * 查询风险排查 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + PageResult page(ScrRiskDataParam scrRiskDataParam); + + /** + * 风险排查列表 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + List list(ScrRiskDataParam scrRiskDataParam); + + /** + * 添加风险排查 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + void add(ScrRiskDataParam scrRiskDataParam); + + /** + * 删除风险排查 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + void delete(List scrRiskDataParamList); + + /** + * 编辑风险排查 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + void edit(ScrRiskDataParam scrRiskDataParam); + + /** + * 查看风险排查 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + ScrRiskData detail(ScrRiskDataParam scrRiskDataParam); + + /** + * 导出风险排查 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + void export(ScrRiskDataParam scrRiskDataParam); + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/service/impl/ScrRiskDataServiceImpl.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/service/impl/ScrRiskDataServiceImpl.java new file mode 100644 index 0000000..8363549 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrriskdata/service/impl/ScrRiskDataServiceImpl.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.scrriskdata.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.scrriskdata.entity.ScrRiskData; +import vip.xiaonuo.modular.scrriskdata.enums.ScrRiskDataExceptionEnum; +import vip.xiaonuo.modular.scrriskdata.mapper.ScrRiskDataMapper; +import vip.xiaonuo.modular.scrriskdata.param.ScrRiskDataParam; +import vip.xiaonuo.modular.scrriskdata.service.ScrRiskDataService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import java.util.List; + +/** + * 风险排查service接口实现类 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ +@Service +public class ScrRiskDataServiceImpl extends ServiceImpl implements ScrRiskDataService { + + @Override + public PageResult page(ScrRiskDataParam scrRiskDataParam) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (ObjectUtil.isNotNull(scrRiskDataParam)) { + + // 根据年份 查询 + if (ObjectUtil.isNotEmpty(scrRiskDataParam.getYear())) { + queryWrapper.lambda().eq(ScrRiskData::getYear, scrRiskDataParam.getYear()); + } + // 根据月份 查询 + if (ObjectUtil.isNotEmpty(scrRiskDataParam.getMonth())) { + queryWrapper.lambda().eq(ScrRiskData::getMonth, scrRiskDataParam.getMonth()); + } + } + return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); + } + + @Override + public List list(ScrRiskDataParam scrRiskDataParam) { + return this.list(); + } + + @Override + public void add(ScrRiskDataParam scrRiskDataParam) { + ScrRiskData scrRiskData = new ScrRiskData(); + BeanUtil.copyProperties(scrRiskDataParam, scrRiskData); + this.save(scrRiskData); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(List scrRiskDataParamList) { + scrRiskDataParamList.forEach(scrRiskDataParam -> { + this.removeById(scrRiskDataParam.getId()); + }); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void edit(ScrRiskDataParam scrRiskDataParam) { + ScrRiskData scrRiskData = this.queryScrRiskData(scrRiskDataParam); + BeanUtil.copyProperties(scrRiskDataParam, scrRiskData); + this.updateById(scrRiskData); + } + + @Override + public ScrRiskData detail(ScrRiskDataParam scrRiskDataParam) { + return this.queryScrRiskData(scrRiskDataParam); + } + + /** + * 获取风险排查 + * + * @author 1 + * @date 2025-10-13 17:08:52 + */ + private ScrRiskData queryScrRiskData(ScrRiskDataParam scrRiskDataParam) { + ScrRiskData scrRiskData = this.getById(scrRiskDataParam.getId()); + if (ObjectUtil.isNull(scrRiskData)) { + throw new ServiceException(ScrRiskDataExceptionEnum.NOT_EXIST); + } + return scrRiskData; + } + + @Override + public void export(ScrRiskDataParam scrRiskDataParam) { + List list = this.list(scrRiskDataParam); + PoiUtil.exportExcelWithStream("SnowyScrRiskData.xls", ScrRiskData.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); + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/controller/ScrWorkTaskController.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/controller/ScrWorkTaskController.java new file mode 100644 index 0000000..0ab5521 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/controller/ScrWorkTaskController.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.scrworktask.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.scrworktask.param.ScrWorkTaskParam; +import vip.xiaonuo.modular.scrworktask.service.ScrWorkTaskService; +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 1 + * @date 2025-10-13 17:49:44 + */ +@RestController +public class ScrWorkTaskController { + + @Resource + private ScrWorkTaskService scrWorkTaskService; + + /** + * 查询作业票 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + @Permission + @GetMapping("/scrWorkTask/page") + @BusinessLog(title = "作业票_查询", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData page(ScrWorkTaskParam scrWorkTaskParam) { + return new SuccessResponseData(scrWorkTaskService.page(scrWorkTaskParam)); + } + + /** + * 添加作业票 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + @Permission + @PostMapping("/scrWorkTask/add") + @BusinessLog(title = "作业票_增加", opType = LogAnnotionOpTypeEnum.ADD) + public ResponseData add(@RequestBody @Validated(ScrWorkTaskParam.add.class) ScrWorkTaskParam scrWorkTaskParam) { + scrWorkTaskService.add(scrWorkTaskParam); + return new SuccessResponseData(); + } + + /** + * 删除作业票,可批量删除 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + @Permission + @PostMapping("/scrWorkTask/delete") + @BusinessLog(title = "作业票_删除", opType = LogAnnotionOpTypeEnum.DELETE) + public ResponseData delete(@RequestBody @Validated(ScrWorkTaskParam.delete.class) List scrWorkTaskParamList) { + scrWorkTaskService.delete(scrWorkTaskParamList); + return new SuccessResponseData(); + } + + /** + * 编辑作业票 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + @Permission + @PostMapping("/scrWorkTask/edit") + @BusinessLog(title = "作业票_编辑", opType = LogAnnotionOpTypeEnum.EDIT) + public ResponseData edit(@RequestBody @Validated(ScrWorkTaskParam.edit.class) ScrWorkTaskParam scrWorkTaskParam) { + scrWorkTaskService.edit(scrWorkTaskParam); + return new SuccessResponseData(); + } + + /** + * 查看作业票 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + @Permission + @GetMapping("/scrWorkTask/detail") + @BusinessLog(title = "作业票_查看", opType = LogAnnotionOpTypeEnum.DETAIL) + public ResponseData detail(@Validated(ScrWorkTaskParam.detail.class) ScrWorkTaskParam scrWorkTaskParam) { + return new SuccessResponseData(scrWorkTaskService.detail(scrWorkTaskParam)); + } + + /** + * 作业票列表 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + @Permission + @GetMapping("/scrWorkTask/list") + @BusinessLog(title = "作业票_列表", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData list(ScrWorkTaskParam scrWorkTaskParam) { + return new SuccessResponseData(scrWorkTaskService.list(scrWorkTaskParam)); + } + + /** + * 导出系统用户 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + @Permission + @GetMapping("/scrWorkTask/export") + @BusinessLog(title = "作业票_导出", opType = LogAnnotionOpTypeEnum.EXPORT) + public void export(ScrWorkTaskParam scrWorkTaskParam) { + scrWorkTaskService.export(scrWorkTaskParam); + } + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/entity/ScrWorkTask.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/entity/ScrWorkTask.java new file mode 100644 index 0000000..63d96cc --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/entity/ScrWorkTask.java @@ -0,0 +1,75 @@ +/* +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.scrworktask.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 1 + * @date 2025-10-13 17:49:44 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("scr_work_task") +public class ScrWorkTask extends BaseEntity { + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + + /** + * 8大作业票 + */ + @Excel(name = "8大作业票") + private String name; + + /** + * 年 + */ + @Excel(name = "年") + private Integer year; + + /** + * 月份 + */ + @Excel(name = "月份") + private Integer month; + + /** + * 数量 + */ + @Excel(name = "数量") + private Integer totalNum; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/enums/ScrWorkTaskExceptionEnum.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/enums/ScrWorkTaskExceptionEnum.java new file mode 100644 index 0000000..436814f --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/enums/ScrWorkTaskExceptionEnum.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.scrworktask.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 1 + * @date 2025-10-13 17:49:44 + */ +@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE) +public enum ScrWorkTaskExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 数据不存在 + */ + NOT_EXIST(1, "此数据不存在"); + + private final Integer code; + + private final String message; + ScrWorkTaskExceptionEnum(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/scrworktask/mapper/ScrWorkTaskMapper.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/mapper/ScrWorkTaskMapper.java new file mode 100644 index 0000000..a834016 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/mapper/ScrWorkTaskMapper.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.scrworktask.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import vip.xiaonuo.modular.scrworktask.entity.ScrWorkTask; + +/** + * 作业票 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ +public interface ScrWorkTaskMapper extends BaseMapper { +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/mapper/mapping/ScrWorkTaskMapper.xml b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/mapper/mapping/ScrWorkTaskMapper.xml new file mode 100644 index 0000000..16c375c --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/mapper/mapping/ScrWorkTaskMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/param/ScrWorkTaskParam.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/param/ScrWorkTaskParam.java new file mode 100644 index 0000000..c914378 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/param/ScrWorkTaskParam.java @@ -0,0 +1,72 @@ +/* +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.scrworktask.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 1 + * @date 2025-10-13 17:49:44 +*/ +@Data +public class ScrWorkTaskParam extends BaseParam { + + /** + * 主键 + */ + @NotNull(message = "主键不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class}) + private Long id; + + /** + * 8大作业票 + */ + @NotBlank(message = "8大作业票不能为空,请检查name参数", groups = {add.class, edit.class}) + private String name; + + /** + * 年 + */ + @NotNull(message = "年不能为空,请检查year参数", groups = {add.class, edit.class}) + private Integer year; + + /** + * 月份 + */ + @NotNull(message = "月份不能为空,请检查month参数", groups = {add.class, edit.class}) + private Integer month; + + /** + * 数量 + */ + @NotNull(message = "数量不能为空,请检查totalNum参数", groups = {add.class, edit.class}) + private Integer totalNum; + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/service/ScrWorkTaskService.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/service/ScrWorkTaskService.java new file mode 100644 index 0000000..138a1d9 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/service/ScrWorkTaskService.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.scrworktask.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import vip.xiaonuo.core.pojo.page.PageResult; +import vip.xiaonuo.modular.scrworktask.entity.ScrWorkTask; +import vip.xiaonuo.modular.scrworktask.param.ScrWorkTaskParam; +import java.util.List; + +/** + * 作业票service接口 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ +public interface ScrWorkTaskService extends IService { + + /** + * 查询作业票 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + PageResult page(ScrWorkTaskParam scrWorkTaskParam); + + /** + * 作业票列表 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + List list(ScrWorkTaskParam scrWorkTaskParam); + + /** + * 添加作业票 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + void add(ScrWorkTaskParam scrWorkTaskParam); + + /** + * 删除作业票 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + void delete(List scrWorkTaskParamList); + + /** + * 编辑作业票 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + void edit(ScrWorkTaskParam scrWorkTaskParam); + + /** + * 查看作业票 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + ScrWorkTask detail(ScrWorkTaskParam scrWorkTaskParam); + + /** + * 导出作业票 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + void export(ScrWorkTaskParam scrWorkTaskParam); + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/service/impl/ScrWorkTaskServiceImpl.java b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/service/impl/ScrWorkTaskServiceImpl.java new file mode 100644 index 0000000..a2eff3e --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/scrworktask/service/impl/ScrWorkTaskServiceImpl.java @@ -0,0 +1,132 @@ +/* +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.scrworktask.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.scrworktask.entity.ScrWorkTask; +import vip.xiaonuo.modular.scrworktask.enums.ScrWorkTaskExceptionEnum; +import vip.xiaonuo.modular.scrworktask.mapper.ScrWorkTaskMapper; +import vip.xiaonuo.modular.scrworktask.param.ScrWorkTaskParam; +import vip.xiaonuo.modular.scrworktask.service.ScrWorkTaskService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import java.util.List; + +/** + * 作业票service接口实现类 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ +@Service +public class ScrWorkTaskServiceImpl extends ServiceImpl implements ScrWorkTaskService { + + @Override + public PageResult page(ScrWorkTaskParam scrWorkTaskParam) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (ObjectUtil.isNotNull(scrWorkTaskParam)) { + + // 根据8大作业票 查询 + if (ObjectUtil.isNotEmpty(scrWorkTaskParam.getName())) { + queryWrapper.lambda().eq(ScrWorkTask::getName, scrWorkTaskParam.getName()); + } + // 根据年 查询 + if (ObjectUtil.isNotEmpty(scrWorkTaskParam.getYear())) { + queryWrapper.lambda().eq(ScrWorkTask::getYear, scrWorkTaskParam.getYear()); + } + // 根据月份 查询 + if (ObjectUtil.isNotEmpty(scrWorkTaskParam.getMonth())) { + queryWrapper.lambda().eq(ScrWorkTask::getMonth, scrWorkTaskParam.getMonth()); + } + } + return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); + } + + @Override + public List list(ScrWorkTaskParam scrWorkTaskParam) { + return this.list(); + } + + @Override + public void add(ScrWorkTaskParam scrWorkTaskParam) { + ScrWorkTask scrWorkTask = new ScrWorkTask(); + BeanUtil.copyProperties(scrWorkTaskParam, scrWorkTask); + this.save(scrWorkTask); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(List scrWorkTaskParamList) { + scrWorkTaskParamList.forEach(scrWorkTaskParam -> { + this.removeById(scrWorkTaskParam.getId()); + }); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void edit(ScrWorkTaskParam scrWorkTaskParam) { + ScrWorkTask scrWorkTask = this.queryScrWorkTask(scrWorkTaskParam); + BeanUtil.copyProperties(scrWorkTaskParam, scrWorkTask); + this.updateById(scrWorkTask); + } + + @Override + public ScrWorkTask detail(ScrWorkTaskParam scrWorkTaskParam) { + return this.queryScrWorkTask(scrWorkTaskParam); + } + + /** + * 获取作业票 + * + * @author 1 + * @date 2025-10-13 17:49:44 + */ + private ScrWorkTask queryScrWorkTask(ScrWorkTaskParam scrWorkTaskParam) { + ScrWorkTask scrWorkTask = this.getById(scrWorkTaskParam.getId()); + if (ObjectUtil.isNull(scrWorkTask)) { + throw new ServiceException(ScrWorkTaskExceptionEnum.NOT_EXIST); + } + return scrWorkTask; + } + + @Override + public void export(ScrWorkTaskParam scrWorkTaskParam) { + List list = this.list(scrWorkTaskParam); + PoiUtil.exportExcelWithStream("SnowyScrWorkTask.xls", ScrWorkTask.class, list); + } + +}