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/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/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); + } + +}