新增数据录入
This commit is contained in:
		
							parent
							
								
									8331a6423a
								
							
						
					
					
						commit
						063c13e47d
					
				| @ -71,7 +71,11 @@ public interface SpringSecurityConstant { | |||||||
|             "/scrProduction/driQuery", |             "/scrProduction/driQuery", | ||||||
|             "/scrSecurity/driQuery", |             "/scrSecurity/driQuery", | ||||||
|             "/scrProduction/driQhQuery", |             "/scrProduction/driQhQuery", | ||||||
|             "/scrProduction/driMaterQuery" |             "/scrProduction/driMaterQuery", | ||||||
|  |             "/scrHideData/list", | ||||||
|  |             "/scrMeterData/list", | ||||||
|  |             "/scrRiskData/list", | ||||||
|  |             "/scrWorkTask/list" | ||||||
| 
 | 
 | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -57,7 +57,6 @@ public class ScrFactoryHeatController { | |||||||
|      * @author zhangyn |      * @author zhangyn | ||||||
|      * @date 2025-09-10 10:02:57 |      * @date 2025-09-10 10:02:57 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrFactoryHeat/page") |     @GetMapping("/scrFactoryHeat/page") | ||||||
|     @BusinessLog(title = "分厂炉号对应关系_查询", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "分厂炉号对应关系_查询", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData page(ScrFactoryHeatParam scrFactoryHeatParam) { |     public ResponseData page(ScrFactoryHeatParam scrFactoryHeatParam) { | ||||||
| @ -70,7 +69,6 @@ public class ScrFactoryHeatController { | |||||||
|      * @author zhangyn |      * @author zhangyn | ||||||
|      * @date 2025-09-10 10:02:57 |      * @date 2025-09-10 10:02:57 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrFactoryHeat/add") |     @PostMapping("/scrFactoryHeat/add") | ||||||
|     @BusinessLog(title = "分厂炉号对应关系_增加", opType = LogAnnotionOpTypeEnum.ADD) |     @BusinessLog(title = "分厂炉号对应关系_增加", opType = LogAnnotionOpTypeEnum.ADD) | ||||||
|     public ResponseData add(@RequestBody @Validated(ScrFactoryHeatParam.add.class) ScrFactoryHeatParam scrFactoryHeatParam) { |     public ResponseData add(@RequestBody @Validated(ScrFactoryHeatParam.add.class) ScrFactoryHeatParam scrFactoryHeatParam) { | ||||||
| @ -84,7 +82,6 @@ public class ScrFactoryHeatController { | |||||||
|      * @author zhangyn |      * @author zhangyn | ||||||
|      * @date 2025-09-10 10:02:57 |      * @date 2025-09-10 10:02:57 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrFactoryHeat/delete") |     @PostMapping("/scrFactoryHeat/delete") | ||||||
|     @BusinessLog(title = "分厂炉号对应关系_删除", opType = LogAnnotionOpTypeEnum.DELETE) |     @BusinessLog(title = "分厂炉号对应关系_删除", opType = LogAnnotionOpTypeEnum.DELETE) | ||||||
|     public ResponseData delete(@RequestBody @Validated(ScrFactoryHeatParam.delete.class) List<ScrFactoryHeatParam> scrFactoryHeatParamList) { |     public ResponseData delete(@RequestBody @Validated(ScrFactoryHeatParam.delete.class) List<ScrFactoryHeatParam> scrFactoryHeatParamList) { | ||||||
| @ -98,7 +95,6 @@ public class ScrFactoryHeatController { | |||||||
|      * @author zhangyn |      * @author zhangyn | ||||||
|      * @date 2025-09-10 10:02:57 |      * @date 2025-09-10 10:02:57 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrFactoryHeat/edit") |     @PostMapping("/scrFactoryHeat/edit") | ||||||
|     @BusinessLog(title = "分厂炉号对应关系_编辑", opType = LogAnnotionOpTypeEnum.EDIT) |     @BusinessLog(title = "分厂炉号对应关系_编辑", opType = LogAnnotionOpTypeEnum.EDIT) | ||||||
|     public ResponseData edit(@RequestBody @Validated(ScrFactoryHeatParam.edit.class) ScrFactoryHeatParam scrFactoryHeatParam) { |     public ResponseData edit(@RequestBody @Validated(ScrFactoryHeatParam.edit.class) ScrFactoryHeatParam scrFactoryHeatParam) { | ||||||
| @ -112,7 +108,6 @@ public class ScrFactoryHeatController { | |||||||
|      * @author zhangyn |      * @author zhangyn | ||||||
|      * @date 2025-09-10 10:02:57 |      * @date 2025-09-10 10:02:57 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrFactoryHeat/detail") |     @GetMapping("/scrFactoryHeat/detail") | ||||||
|     @BusinessLog(title = "分厂炉号对应关系_查看", opType = LogAnnotionOpTypeEnum.DETAIL) |     @BusinessLog(title = "分厂炉号对应关系_查看", opType = LogAnnotionOpTypeEnum.DETAIL) | ||||||
|     public ResponseData detail(@Validated(ScrFactoryHeatParam.detail.class) ScrFactoryHeatParam scrFactoryHeatParam) { |     public ResponseData detail(@Validated(ScrFactoryHeatParam.detail.class) ScrFactoryHeatParam scrFactoryHeatParam) { | ||||||
| @ -125,7 +120,6 @@ public class ScrFactoryHeatController { | |||||||
|      * @author zhangyn |      * @author zhangyn | ||||||
|      * @date 2025-09-10 10:02:57 |      * @date 2025-09-10 10:02:57 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrFactoryHeat/list") |     @GetMapping("/scrFactoryHeat/list") | ||||||
|     @BusinessLog(title = "分厂炉号对应关系_列表", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "分厂炉号对应关系_列表", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData list(ScrFactoryHeatParam scrFactoryHeatParam) { |     public ResponseData list(ScrFactoryHeatParam scrFactoryHeatParam) { | ||||||
| @ -138,7 +132,7 @@ public class ScrFactoryHeatController { | |||||||
|      * @author zhangyn |      * @author zhangyn | ||||||
|      * @date 2025-09-10 10:02:57 |      * @date 2025-09-10 10:02:57 | ||||||
|      */ |      */ | ||||||
|     @Permission | //    @Permission | ||||||
|     @GetMapping("/scrFactoryHeat/export") |     @GetMapping("/scrFactoryHeat/export") | ||||||
|     @BusinessLog(title = "分厂炉号对应关系_导出", opType = LogAnnotionOpTypeEnum.EXPORT) |     @BusinessLog(title = "分厂炉号对应关系_导出", opType = LogAnnotionOpTypeEnum.EXPORT) | ||||||
|     public void export(ScrFactoryHeatParam scrFactoryHeatParam) { |     public void export(ScrFactoryHeatParam scrFactoryHeatParam) { | ||||||
|  | |||||||
| @ -41,7 +41,8 @@ public enum ScrFactoryHeatExceptionEnum implements AbstractBaseExceptionEnum { | |||||||
|     /** |     /** | ||||||
|      * 数据不存在 |      * 数据不存在 | ||||||
|      */ |      */ | ||||||
|     NOT_EXIST(1, "此数据不存在"); |     NOT_EXIST(1, "此数据不存在"), | ||||||
|  |     EXIST(2, "此数据已存在"); | ||||||
| 
 | 
 | ||||||
|     private final Integer code; |     private final Integer code; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -43,7 +43,12 @@ import vip.xiaonuo.modular.scrfactoryheat.param.ScrFactoryHeatParam; | |||||||
| import vip.xiaonuo.modular.scrfactoryheat.service.ScrFactoryHeatService; | import vip.xiaonuo.modular.scrfactoryheat.service.ScrFactoryHeatService; | ||||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||||
|  | import vip.xiaonuo.modular.scrhidedata.entity.ScrHideData; | ||||||
|  | import vip.xiaonuo.modular.scrhidedata.enums.ScrHideDataExceptionEnum; | ||||||
|  | import vip.xiaonuo.modular.scrhidedata.param.ScrHideDataParam; | ||||||
|  | 
 | ||||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||||
|  | import java.time.LocalDate; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -79,11 +84,26 @@ public class ScrFactoryHeatServiceImpl extends ServiceImpl<ScrFactoryHeatMapper, | |||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void add(ScrFactoryHeatParam scrFactoryHeatParam) { |     public void add(ScrFactoryHeatParam scrFactoryHeatParam) { | ||||||
|  |         checkParam(scrFactoryHeatParam, false); | ||||||
|         ScrFactoryHeat scrFactoryHeat = new ScrFactoryHeat(); |         ScrFactoryHeat scrFactoryHeat = new ScrFactoryHeat(); | ||||||
|         BeanUtil.copyProperties(scrFactoryHeatParam, scrFactoryHeat); |         BeanUtil.copyProperties(scrFactoryHeatParam, scrFactoryHeat); | ||||||
|         this.save(scrFactoryHeat); |         this.save(scrFactoryHeat); | ||||||
|     } |     } | ||||||
| 
 |     private void checkParam(ScrFactoryHeatParam scrFactoryHeatParam, boolean isExcludeSelf) { | ||||||
|  |         Long id = scrFactoryHeatParam.getId(); | ||||||
|  |         LambdaQueryWrapper<ScrFactoryHeat> queryWrapper = new LambdaQueryWrapper<>(); | ||||||
|  |         queryWrapper.eq(ScrFactoryHeat::getBranchPlant, scrFactoryHeatParam.getBranchPlant()); | ||||||
|  |         queryWrapper.eq(ScrFactoryHeat::getFurnaceNumber, scrFactoryHeatParam.getFurnaceNumber()); | ||||||
|  |         //是否排除自己,如果是则查询条件排除自己id | ||||||
|  |         if (isExcludeSelf) { | ||||||
|  |             queryWrapper.ne(ScrFactoryHeat::getId, id); | ||||||
|  |         } | ||||||
|  |         int countByAccount = this.count(queryWrapper); | ||||||
|  |         //大于等于1个则表示重复 | ||||||
|  |         if (countByAccount >= 1) { | ||||||
|  |             throw new ServiceException(ScrFactoryHeatExceptionEnum.EXIST); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|     @Transactional(rollbackFor = Exception.class) |     @Transactional(rollbackFor = Exception.class) | ||||||
|     @Override |     @Override | ||||||
|     public void delete(List<ScrFactoryHeatParam> scrFactoryHeatParamList) { |     public void delete(List<ScrFactoryHeatParam> scrFactoryHeatParamList) { | ||||||
| @ -95,6 +115,7 @@ public class ScrFactoryHeatServiceImpl extends ServiceImpl<ScrFactoryHeatMapper, | |||||||
|     @Transactional(rollbackFor = Exception.class) |     @Transactional(rollbackFor = Exception.class) | ||||||
|     @Override |     @Override | ||||||
|     public void edit(ScrFactoryHeatParam scrFactoryHeatParam) { |     public void edit(ScrFactoryHeatParam scrFactoryHeatParam) { | ||||||
|  |         checkParam(scrFactoryHeatParam, true); | ||||||
|         ScrFactoryHeat scrFactoryHeat = this.queryScrFactoryHeat(scrFactoryHeatParam); |         ScrFactoryHeat scrFactoryHeat = this.queryScrFactoryHeat(scrFactoryHeatParam); | ||||||
|         BeanUtil.copyProperties(scrFactoryHeatParam, scrFactoryHeat); |         BeanUtil.copyProperties(scrFactoryHeatParam, scrFactoryHeat); | ||||||
|         this.updateById(scrFactoryHeat); |         this.updateById(scrFactoryHeat); | ||||||
|  | |||||||
| @ -57,7 +57,6 @@ public class ScrHideDataController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:15:20 |      * @date 2025-10-13 17:15:20 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrHideData/page") |     @GetMapping("/scrHideData/page") | ||||||
|     @BusinessLog(title = "隐患整改_查询", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "隐患整改_查询", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData page(ScrHideDataParam scrHideDataParam) { |     public ResponseData page(ScrHideDataParam scrHideDataParam) { | ||||||
| @ -70,7 +69,6 @@ public class ScrHideDataController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:15:20 |      * @date 2025-10-13 17:15:20 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrHideData/add") |     @PostMapping("/scrHideData/add") | ||||||
|     @BusinessLog(title = "隐患整改_增加", opType = LogAnnotionOpTypeEnum.ADD) |     @BusinessLog(title = "隐患整改_增加", opType = LogAnnotionOpTypeEnum.ADD) | ||||||
|     public ResponseData add(@RequestBody @Validated(ScrHideDataParam.add.class) ScrHideDataParam scrHideDataParam) { |     public ResponseData add(@RequestBody @Validated(ScrHideDataParam.add.class) ScrHideDataParam scrHideDataParam) { | ||||||
| @ -84,7 +82,6 @@ public class ScrHideDataController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:15:20 |      * @date 2025-10-13 17:15:20 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrHideData/delete") |     @PostMapping("/scrHideData/delete") | ||||||
|     @BusinessLog(title = "隐患整改_删除", opType = LogAnnotionOpTypeEnum.DELETE) |     @BusinessLog(title = "隐患整改_删除", opType = LogAnnotionOpTypeEnum.DELETE) | ||||||
|     public ResponseData delete(@RequestBody @Validated(ScrHideDataParam.delete.class) List<ScrHideDataParam> scrHideDataParamList) { |     public ResponseData delete(@RequestBody @Validated(ScrHideDataParam.delete.class) List<ScrHideDataParam> scrHideDataParamList) { | ||||||
| @ -98,7 +95,6 @@ public class ScrHideDataController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:15:20 |      * @date 2025-10-13 17:15:20 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrHideData/edit") |     @PostMapping("/scrHideData/edit") | ||||||
|     @BusinessLog(title = "隐患整改_编辑", opType = LogAnnotionOpTypeEnum.EDIT) |     @BusinessLog(title = "隐患整改_编辑", opType = LogAnnotionOpTypeEnum.EDIT) | ||||||
|     public ResponseData edit(@RequestBody @Validated(ScrHideDataParam.edit.class) ScrHideDataParam scrHideDataParam) { |     public ResponseData edit(@RequestBody @Validated(ScrHideDataParam.edit.class) ScrHideDataParam scrHideDataParam) { | ||||||
| @ -112,7 +108,6 @@ public class ScrHideDataController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:15:20 |      * @date 2025-10-13 17:15:20 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrHideData/detail") |     @GetMapping("/scrHideData/detail") | ||||||
|     @BusinessLog(title = "隐患整改_查看", opType = LogAnnotionOpTypeEnum.DETAIL) |     @BusinessLog(title = "隐患整改_查看", opType = LogAnnotionOpTypeEnum.DETAIL) | ||||||
|     public ResponseData detail(@Validated(ScrHideDataParam.detail.class) ScrHideDataParam scrHideDataParam) { |     public ResponseData detail(@Validated(ScrHideDataParam.detail.class) ScrHideDataParam scrHideDataParam) { | ||||||
| @ -125,7 +120,6 @@ public class ScrHideDataController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:15:20 |      * @date 2025-10-13 17:15:20 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrHideData/list") |     @GetMapping("/scrHideData/list") | ||||||
|     @BusinessLog(title = "隐患整改_列表", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "隐患整改_列表", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData list(ScrHideDataParam scrHideDataParam) { |     public ResponseData list(ScrHideDataParam scrHideDataParam) { | ||||||
| @ -138,7 +132,6 @@ public class ScrHideDataController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:15:20 |      * @date 2025-10-13 17:15:20 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrHideData/export") |     @GetMapping("/scrHideData/export") | ||||||
|     @BusinessLog(title = "隐患整改_导出", opType = LogAnnotionOpTypeEnum.EXPORT) |     @BusinessLog(title = "隐患整改_导出", opType = LogAnnotionOpTypeEnum.EXPORT) | ||||||
|     public void export(ScrHideDataParam scrHideDataParam) { |     public void export(ScrHideDataParam scrHideDataParam) { | ||||||
|  | |||||||
| @ -49,17 +49,10 @@ public class ScrHideData extends BaseEntity { | |||||||
|     private Long id; |     private Long id; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 年份 |      * 日期 | ||||||
|      */ |      */ | ||||||
|     @Excel(name = "年份") |     @Excel(name = "日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20) | ||||||
|     private Integer year; |     private Date happenTime; | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * 月份 |  | ||||||
|      */ |  | ||||||
|     @Excel(name = "月份") |  | ||||||
|     private Integer month; |  | ||||||
| 
 |  | ||||||
|     /** |     /** | ||||||
|      * 隐患数量 |      * 隐患数量 | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -41,7 +41,11 @@ public enum ScrHideDataExceptionEnum implements AbstractBaseExceptionEnum { | |||||||
|     /** |     /** | ||||||
|      * 数据不存在 |      * 数据不存在 | ||||||
|      */ |      */ | ||||||
|     NOT_EXIST(1, "此数据不存在"); |     NOT_EXIST(1, "此数据不存在"), | ||||||
|  |     /** | ||||||
|  |      * 数据已存在 | ||||||
|  |      */ | ||||||
|  |     HAPPEN_TIME_REPEAT(2, "该日期数据已存在,请重新选择"); | ||||||
| 
 | 
 | ||||||
|     private final Integer code; |     private final Integer code; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -46,16 +46,10 @@ public class ScrHideDataParam extends BaseParam { | |||||||
|     private Long id; |     private Long id; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 年份 |      * 日期 | ||||||
|      */ |      */ | ||||||
|     @NotNull(message = "年份不能为空,请检查year参数", groups = {add.class, edit.class}) |     @NotNull(message = "日期不能为空,请检查happenTime参数", groups = {add.class, edit.class}) | ||||||
|     private Integer year; |     private String happenTime; | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * 月份 |  | ||||||
|      */ |  | ||||||
|     @NotNull(message = "月份不能为空,请检查month参数", groups = {add.class, edit.class}) |  | ||||||
|     private Integer month; |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 隐患数量 |      * 隐患数量 | ||||||
| @ -74,5 +68,6 @@ public class ScrHideDataParam extends BaseParam { | |||||||
|      */ |      */ | ||||||
|     @NotNull(message = "未整改不能为空,请检查wzg参数", groups = {add.class, edit.class}) |     @NotNull(message = "未整改不能为空,请检查wzg参数", groups = {add.class, edit.class}) | ||||||
|     private Integer wzg; |     private Integer wzg; | ||||||
| 
 |     private Integer year; | ||||||
|  |     private Integer month; | ||||||
| } | } | ||||||
|  | |||||||
| @ -43,7 +43,12 @@ import vip.xiaonuo.modular.scrhidedata.param.ScrHideDataParam; | |||||||
| import vip.xiaonuo.modular.scrhidedata.service.ScrHideDataService; | import vip.xiaonuo.modular.scrhidedata.service.ScrHideDataService; | ||||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||||
|  | import vip.xiaonuo.modular.scrproduction.entity.ScrProduction; | ||||||
|  | import vip.xiaonuo.sys.modular.user.entity.SysUser; | ||||||
|  | import vip.xiaonuo.sys.modular.user.enums.SysUserExceptionEnum; | ||||||
|  | 
 | ||||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||||
|  | import java.time.LocalDate; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -59,14 +64,11 @@ public class ScrHideDataServiceImpl extends ServiceImpl<ScrHideDataMapper, ScrHi | |||||||
|     public PageResult<ScrHideData> page(ScrHideDataParam scrHideDataParam) { |     public PageResult<ScrHideData> page(ScrHideDataParam scrHideDataParam) { | ||||||
|         QueryWrapper<ScrHideData> queryWrapper = new QueryWrapper<>(); |         QueryWrapper<ScrHideData> queryWrapper = new QueryWrapper<>(); | ||||||
|         if (ObjectUtil.isNotNull(scrHideDataParam)) { |         if (ObjectUtil.isNotNull(scrHideDataParam)) { | ||||||
| 
 |             // 根据日期 查询 | ||||||
|             // 根据年份 查询 |             if (ObjectUtil.isNotEmpty(scrHideDataParam.getHappenTime())) { | ||||||
|             if (ObjectUtil.isNotEmpty(scrHideDataParam.getYear())) { |                 LocalDate happenTime = LocalDate.parse(scrHideDataParam.getHappenTime()); | ||||||
|                 queryWrapper.lambda().eq(ScrHideData::getYear, scrHideDataParam.getYear()); |                 queryWrapper.apply("YEAR(happen_time) = {0}", happenTime.getYear()); | ||||||
|             } |                 queryWrapper.apply("MONTH(happen_time) = {0}", happenTime.getMonthValue()); | ||||||
|             // 根据月份 查询 |  | ||||||
|             if (ObjectUtil.isNotEmpty(scrHideDataParam.getMonth())) { |  | ||||||
|                 queryWrapper.lambda().eq(ScrHideData::getMonth, scrHideDataParam.getMonth()); |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); |         return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); | ||||||
| @ -74,16 +76,43 @@ public class ScrHideDataServiceImpl extends ServiceImpl<ScrHideDataMapper, ScrHi | |||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public List<ScrHideData> list(ScrHideDataParam scrHideDataParam) { |     public List<ScrHideData> list(ScrHideDataParam scrHideDataParam) { | ||||||
|         return this.list(); |         QueryWrapper<ScrHideData> queryWrapper = new QueryWrapper<>(); | ||||||
|  |         if (ObjectUtil.isNotNull(scrHideDataParam)) { | ||||||
|  |             if (ObjectUtil.isNotEmpty(scrHideDataParam.getYear()) && ObjectUtil.isNotEmpty(scrHideDataParam.getMonth())) { | ||||||
|  |                 queryWrapper.apply("YEAR(happen_time) = {0}", scrHideDataParam.getYear()); | ||||||
|  |                 queryWrapper.apply("Month(happen_time) = {0}", scrHideDataParam.getMonth()); | ||||||
|  |             } else if (ObjectUtil.isNotEmpty(scrHideDataParam.getYear())) { | ||||||
|  |                 queryWrapper.apply("YEAR(happen_time) = {0}", scrHideDataParam.getYear()); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return this.list(queryWrapper); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void add(ScrHideDataParam scrHideDataParam) { |     public void add(ScrHideDataParam scrHideDataParam) { | ||||||
|  |         checkParam(scrHideDataParam, false); | ||||||
|         ScrHideData scrHideData = new ScrHideData(); |         ScrHideData scrHideData = new ScrHideData(); | ||||||
|         BeanUtil.copyProperties(scrHideDataParam, scrHideData); |         BeanUtil.copyProperties(scrHideDataParam, scrHideData); | ||||||
|         this.save(scrHideData); |         this.save(scrHideData); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     private void checkParam(ScrHideDataParam scrHideDataParam, boolean isExcludeSelf) { | ||||||
|  |         Long id = scrHideDataParam.getId(); | ||||||
|  |         LocalDate happenTime = LocalDate.parse(scrHideDataParam.getHappenTime()); | ||||||
|  |         LambdaQueryWrapper<ScrHideData> queryWrapper = new LambdaQueryWrapper<>(); | ||||||
|  |         queryWrapper.apply("YEAR(happen_time) = {0}", happenTime.getYear()); | ||||||
|  |         queryWrapper.apply("MONTH(happen_time) = {0}", happenTime.getMonthValue()); | ||||||
|  |         //是否排除自己,如果是则查询条件排除自己id | ||||||
|  |         if (isExcludeSelf) { | ||||||
|  |             queryWrapper.ne(ScrHideData::getId, id); | ||||||
|  |         } | ||||||
|  |         int countByAccount = this.count(queryWrapper); | ||||||
|  |         //大于等于1个则表示重复 | ||||||
|  |         if (countByAccount >= 1) { | ||||||
|  |             throw new ServiceException(ScrHideDataExceptionEnum.HAPPEN_TIME_REPEAT); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     @Transactional(rollbackFor = Exception.class) |     @Transactional(rollbackFor = Exception.class) | ||||||
|     @Override |     @Override | ||||||
|     public void delete(List<ScrHideDataParam> scrHideDataParamList) { |     public void delete(List<ScrHideDataParam> scrHideDataParamList) { | ||||||
| @ -95,6 +124,7 @@ public class ScrHideDataServiceImpl extends ServiceImpl<ScrHideDataMapper, ScrHi | |||||||
|     @Transactional(rollbackFor = Exception.class) |     @Transactional(rollbackFor = Exception.class) | ||||||
|     @Override |     @Override | ||||||
|     public void edit(ScrHideDataParam scrHideDataParam) { |     public void edit(ScrHideDataParam scrHideDataParam) { | ||||||
|  |         checkParam(scrHideDataParam, true); | ||||||
|         ScrHideData scrHideData = this.queryScrHideData(scrHideDataParam); |         ScrHideData scrHideData = this.queryScrHideData(scrHideDataParam); | ||||||
|         BeanUtil.copyProperties(scrHideDataParam, scrHideData); |         BeanUtil.copyProperties(scrHideDataParam, scrHideData); | ||||||
|         this.updateById(scrHideData); |         this.updateById(scrHideData); | ||||||
|  | |||||||
| @ -57,7 +57,6 @@ public class ScrMeterDataController { | |||||||
|      * @author 2 |      * @author 2 | ||||||
|      * @date 2025-10-13 17:55:42 |      * @date 2025-10-13 17:55:42 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrMeterData/page") |     @GetMapping("/scrMeterData/page") | ||||||
|     @BusinessLog(title = "电表_查询", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "电表_查询", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData page(ScrMeterDataParam scrMeterDataParam) { |     public ResponseData page(ScrMeterDataParam scrMeterDataParam) { | ||||||
| @ -70,7 +69,6 @@ public class ScrMeterDataController { | |||||||
|      * @author 2 |      * @author 2 | ||||||
|      * @date 2025-10-13 17:55:42 |      * @date 2025-10-13 17:55:42 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrMeterData/add") |     @PostMapping("/scrMeterData/add") | ||||||
|     @BusinessLog(title = "电表_增加", opType = LogAnnotionOpTypeEnum.ADD) |     @BusinessLog(title = "电表_增加", opType = LogAnnotionOpTypeEnum.ADD) | ||||||
|     public ResponseData add(@RequestBody @Validated(ScrMeterDataParam.add.class) ScrMeterDataParam scrMeterDataParam) { |     public ResponseData add(@RequestBody @Validated(ScrMeterDataParam.add.class) ScrMeterDataParam scrMeterDataParam) { | ||||||
| @ -84,7 +82,6 @@ public class ScrMeterDataController { | |||||||
|      * @author 2 |      * @author 2 | ||||||
|      * @date 2025-10-13 17:55:42 |      * @date 2025-10-13 17:55:42 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrMeterData/delete") |     @PostMapping("/scrMeterData/delete") | ||||||
|     @BusinessLog(title = "电表_删除", opType = LogAnnotionOpTypeEnum.DELETE) |     @BusinessLog(title = "电表_删除", opType = LogAnnotionOpTypeEnum.DELETE) | ||||||
|     public ResponseData delete(@RequestBody @Validated(ScrMeterDataParam.delete.class) List<ScrMeterDataParam> scrMeterDataParamList) { |     public ResponseData delete(@RequestBody @Validated(ScrMeterDataParam.delete.class) List<ScrMeterDataParam> scrMeterDataParamList) { | ||||||
| @ -98,7 +95,6 @@ public class ScrMeterDataController { | |||||||
|      * @author 2 |      * @author 2 | ||||||
|      * @date 2025-10-13 17:55:42 |      * @date 2025-10-13 17:55:42 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrMeterData/edit") |     @PostMapping("/scrMeterData/edit") | ||||||
|     @BusinessLog(title = "电表_编辑", opType = LogAnnotionOpTypeEnum.EDIT) |     @BusinessLog(title = "电表_编辑", opType = LogAnnotionOpTypeEnum.EDIT) | ||||||
|     public ResponseData edit(@RequestBody @Validated(ScrMeterDataParam.edit.class) ScrMeterDataParam scrMeterDataParam) { |     public ResponseData edit(@RequestBody @Validated(ScrMeterDataParam.edit.class) ScrMeterDataParam scrMeterDataParam) { | ||||||
| @ -112,7 +108,6 @@ public class ScrMeterDataController { | |||||||
|      * @author 2 |      * @author 2 | ||||||
|      * @date 2025-10-13 17:55:42 |      * @date 2025-10-13 17:55:42 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrMeterData/detail") |     @GetMapping("/scrMeterData/detail") | ||||||
|     @BusinessLog(title = "电表_查看", opType = LogAnnotionOpTypeEnum.DETAIL) |     @BusinessLog(title = "电表_查看", opType = LogAnnotionOpTypeEnum.DETAIL) | ||||||
|     public ResponseData detail(@Validated(ScrMeterDataParam.detail.class) ScrMeterDataParam scrMeterDataParam) { |     public ResponseData detail(@Validated(ScrMeterDataParam.detail.class) ScrMeterDataParam scrMeterDataParam) { | ||||||
| @ -125,7 +120,6 @@ public class ScrMeterDataController { | |||||||
|      * @author 2 |      * @author 2 | ||||||
|      * @date 2025-10-13 17:55:42 |      * @date 2025-10-13 17:55:42 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrMeterData/list") |     @GetMapping("/scrMeterData/list") | ||||||
|     @BusinessLog(title = "电表_列表", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "电表_列表", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData list(ScrMeterDataParam scrMeterDataParam) { |     public ResponseData list(ScrMeterDataParam scrMeterDataParam) { | ||||||
| @ -138,7 +132,6 @@ public class ScrMeterDataController { | |||||||
|      * @author 2 |      * @author 2 | ||||||
|      * @date 2025-10-13 17:55:42 |      * @date 2025-10-13 17:55:42 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrMeterData/export") |     @GetMapping("/scrMeterData/export") | ||||||
|     @BusinessLog(title = "电表_导出", opType = LogAnnotionOpTypeEnum.EXPORT) |     @BusinessLog(title = "电表_导出", opType = LogAnnotionOpTypeEnum.EXPORT) | ||||||
|     public void export(ScrMeterDataParam scrMeterDataParam) { |     public void export(ScrMeterDataParam scrMeterDataParam) { | ||||||
|  | |||||||
| @ -57,16 +57,10 @@ public class ScrMeterData extends BaseEntity { | |||||||
|     private String name; |     private String name; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 年份 |      * 日期 | ||||||
|      */ |      */ | ||||||
|     @Excel(name = "年份") |     @Excel(name = "日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20) | ||||||
|     private Integer year; |     private Date happenTime; | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * 月份 |  | ||||||
|      */ |  | ||||||
|     @Excel(name = "月份") |  | ||||||
|     private Integer month; |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 累计电量 |      * 累计电量 | ||||||
|  | |||||||
| @ -54,16 +54,10 @@ public class ScrMeterDataParam extends BaseParam { | |||||||
|     private String name; |     private String name; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 年份 |      * 日期 | ||||||
|      */ |      */ | ||||||
|     @NotNull(message = "年份不能为空,请检查year参数", groups = {add.class, edit.class}) |     @NotNull(message = "日期不能为空,请检查happenTime参数", groups = {add.class, edit.class}) | ||||||
|     private Integer year; |     private String happenTime; | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * 月份 |  | ||||||
|      */ |  | ||||||
|     @NotNull(message = "月份不能为空,请检查month参数", groups = {add.class, edit.class}) |  | ||||||
|     private Integer month; |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 累计电量 |      * 累计电量 | ||||||
| @ -76,5 +70,6 @@ public class ScrMeterDataParam extends BaseParam { | |||||||
|      */ |      */ | ||||||
|     @NotNull(message = "平均功率不能为空,请检查avgPower参数", groups = {add.class, edit.class}) |     @NotNull(message = "平均功率不能为空,请检查avgPower参数", groups = {add.class, edit.class}) | ||||||
|     private BigDecimal avgPower; |     private BigDecimal avgPower; | ||||||
| 
 |     private Integer year; | ||||||
|  |     private Integer month; | ||||||
| } | } | ||||||
|  | |||||||
| @ -36,6 +36,9 @@ import vip.xiaonuo.core.exception.ServiceException; | |||||||
| import vip.xiaonuo.core.factory.PageFactory; | import vip.xiaonuo.core.factory.PageFactory; | ||||||
| import vip.xiaonuo.core.pojo.page.PageResult; | import vip.xiaonuo.core.pojo.page.PageResult; | ||||||
| import vip.xiaonuo.core.util.PoiUtil; | 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.param.ScrHideDataParam; | ||||||
| import vip.xiaonuo.modular.scrmeterdata.entity.ScrMeterData; | import vip.xiaonuo.modular.scrmeterdata.entity.ScrMeterData; | ||||||
| import vip.xiaonuo.modular.scrmeterdata.enums.ScrMeterDataExceptionEnum; | import vip.xiaonuo.modular.scrmeterdata.enums.ScrMeterDataExceptionEnum; | ||||||
| import vip.xiaonuo.modular.scrmeterdata.mapper.ScrMeterDataMapper; | import vip.xiaonuo.modular.scrmeterdata.mapper.ScrMeterDataMapper; | ||||||
| @ -44,6 +47,7 @@ import vip.xiaonuo.modular.scrmeterdata.service.ScrMeterDataService; | |||||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||||
|  | import java.time.LocalDate; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -64,13 +68,11 @@ public class ScrMeterDataServiceImpl extends ServiceImpl<ScrMeterDataMapper, Scr | |||||||
|             if (ObjectUtil.isNotEmpty(scrMeterDataParam.getName())) { |             if (ObjectUtil.isNotEmpty(scrMeterDataParam.getName())) { | ||||||
|                 queryWrapper.lambda().like(ScrMeterData::getName, scrMeterDataParam.getName()); |                 queryWrapper.lambda().like(ScrMeterData::getName, scrMeterDataParam.getName()); | ||||||
|             } |             } | ||||||
|             // 根据年份 查询 |             // 根据日期 查询 | ||||||
|             if (ObjectUtil.isNotEmpty(scrMeterDataParam.getYear())) { |             if (ObjectUtil.isNotEmpty(scrMeterDataParam.getHappenTime())) { | ||||||
|                 queryWrapper.lambda().eq(ScrMeterData::getYear, scrMeterDataParam.getYear()); |                 LocalDate happenTime = LocalDate.parse(scrMeterDataParam.getHappenTime()); | ||||||
|             } |                 queryWrapper.apply("YEAR(happen_time) = {0}", happenTime.getYear()); | ||||||
|             // 根据月份 查询 |                 queryWrapper.apply("MONTH(happen_time) = {0}", happenTime.getMonthValue()); | ||||||
|             if (ObjectUtil.isNotEmpty(scrMeterDataParam.getMonth())) { |  | ||||||
|                 queryWrapper.lambda().eq(ScrMeterData::getMonth, scrMeterDataParam.getMonth()); |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); |         return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); | ||||||
| @ -78,16 +80,48 @@ public class ScrMeterDataServiceImpl extends ServiceImpl<ScrMeterDataMapper, Scr | |||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public List<ScrMeterData> list(ScrMeterDataParam scrMeterDataParam) { |     public List<ScrMeterData> list(ScrMeterDataParam scrMeterDataParam) { | ||||||
|         return this.list(); |         QueryWrapper<ScrMeterData> queryWrapper = new QueryWrapper<>(); | ||||||
|  |         if (ObjectUtil.isNotNull(scrMeterDataParam)) { | ||||||
|  | 
 | ||||||
|  |             // 根据电表 查询 | ||||||
|  |             if (ObjectUtil.isNotEmpty(scrMeterDataParam.getName())) { | ||||||
|  |                 queryWrapper.lambda().like(ScrMeterData::getName, scrMeterDataParam.getName()); | ||||||
|  |             } | ||||||
|  |             if (ObjectUtil.isNotEmpty(scrMeterDataParam.getYear()) && ObjectUtil.isNotEmpty(scrMeterDataParam.getMonth())) { | ||||||
|  |                 queryWrapper.apply("YEAR(happen_time) = {0}", scrMeterDataParam.getYear()); | ||||||
|  |                 queryWrapper.apply("Month(happen_time) = {0}", scrMeterDataParam.getMonth()); | ||||||
|  |             } else if (ObjectUtil.isNotEmpty(scrMeterDataParam.getYear())) { | ||||||
|  |                 queryWrapper.apply("YEAR(happen_time) = {0}", scrMeterDataParam.getYear()); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return this.list(queryWrapper); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void add(ScrMeterDataParam scrMeterDataParam) { |     public void add(ScrMeterDataParam scrMeterDataParam) { | ||||||
|  |         checkParam(scrMeterDataParam, false); | ||||||
|         ScrMeterData scrMeterData = new ScrMeterData(); |         ScrMeterData scrMeterData = new ScrMeterData(); | ||||||
|         BeanUtil.copyProperties(scrMeterDataParam, scrMeterData); |         BeanUtil.copyProperties(scrMeterDataParam, scrMeterData); | ||||||
|         this.save(scrMeterData); |         this.save(scrMeterData); | ||||||
|     } |     } | ||||||
| 
 |     private void checkParam(ScrMeterDataParam scrMeterDataParam, boolean isExcludeSelf) { | ||||||
|  |         Long id = scrMeterDataParam.getId(); | ||||||
|  |         String name = scrMeterDataParam.getName(); | ||||||
|  |         LocalDate happenTime = LocalDate.parse(scrMeterDataParam.getHappenTime()); | ||||||
|  |         LambdaQueryWrapper<ScrMeterData> queryWrapper = new LambdaQueryWrapper<>(); | ||||||
|  |         queryWrapper.eq(ScrMeterData::getName, name); | ||||||
|  |         queryWrapper.apply("YEAR(happen_time) = {0}", happenTime.getYear()); | ||||||
|  |         queryWrapper.apply("MONTH(happen_time) = {0}", happenTime.getMonthValue()); | ||||||
|  |         //是否排除自己,如果是则查询条件排除自己id | ||||||
|  |         if (isExcludeSelf) { | ||||||
|  |             queryWrapper.ne(ScrMeterData::getId, id); | ||||||
|  |         } | ||||||
|  |         int countByAccount = this.count(queryWrapper); | ||||||
|  |         //大于等于1个则表示重复 | ||||||
|  |         if (countByAccount >= 1) { | ||||||
|  |             throw new ServiceException(ScrHideDataExceptionEnum.HAPPEN_TIME_REPEAT); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|     @Transactional(rollbackFor = Exception.class) |     @Transactional(rollbackFor = Exception.class) | ||||||
|     @Override |     @Override | ||||||
|     public void delete(List<ScrMeterDataParam> scrMeterDataParamList) { |     public void delete(List<ScrMeterDataParam> scrMeterDataParamList) { | ||||||
| @ -99,6 +133,7 @@ public class ScrMeterDataServiceImpl extends ServiceImpl<ScrMeterDataMapper, Scr | |||||||
|     @Transactional(rollbackFor = Exception.class) |     @Transactional(rollbackFor = Exception.class) | ||||||
|     @Override |     @Override | ||||||
|     public void edit(ScrMeterDataParam scrMeterDataParam) { |     public void edit(ScrMeterDataParam scrMeterDataParam) { | ||||||
|  |         checkParam(scrMeterDataParam, true); | ||||||
|         ScrMeterData scrMeterData = this.queryScrMeterData(scrMeterDataParam); |         ScrMeterData scrMeterData = this.queryScrMeterData(scrMeterDataParam); | ||||||
|         BeanUtil.copyProperties(scrMeterDataParam, scrMeterData); |         BeanUtil.copyProperties(scrMeterDataParam, scrMeterData); | ||||||
|         this.updateById(scrMeterData); |         this.updateById(scrMeterData); | ||||||
|  | |||||||
| @ -57,7 +57,6 @@ public class ScrProductionController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:01 |      * @date 2025-09-10 10:03:01 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrProduction/page") |     @GetMapping("/scrProduction/page") | ||||||
|     @BusinessLog(title = "产量_查询", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "产量_查询", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData page(ScrProductionParam scrProductionParam) { |     public ResponseData page(ScrProductionParam scrProductionParam) { | ||||||
| @ -70,7 +69,6 @@ public class ScrProductionController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:01 |      * @date 2025-09-10 10:03:01 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrProduction/add") |     @PostMapping("/scrProduction/add") | ||||||
|     @BusinessLog(title = "产量_增加", opType = LogAnnotionOpTypeEnum.ADD) |     @BusinessLog(title = "产量_增加", opType = LogAnnotionOpTypeEnum.ADD) | ||||||
|     public ResponseData add(@RequestBody @Validated(ScrProductionParam.add.class) ScrProductionParam scrProductionParam) { |     public ResponseData add(@RequestBody @Validated(ScrProductionParam.add.class) ScrProductionParam scrProductionParam) { | ||||||
| @ -84,7 +82,6 @@ public class ScrProductionController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:01 |      * @date 2025-09-10 10:03:01 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrProduction/delete") |     @PostMapping("/scrProduction/delete") | ||||||
|     @BusinessLog(title = "产量_删除", opType = LogAnnotionOpTypeEnum.DELETE) |     @BusinessLog(title = "产量_删除", opType = LogAnnotionOpTypeEnum.DELETE) | ||||||
|     public ResponseData delete(@RequestBody @Validated(ScrProductionParam.delete.class) List<ScrProductionParam> scrProductionParamList) { |     public ResponseData delete(@RequestBody @Validated(ScrProductionParam.delete.class) List<ScrProductionParam> scrProductionParamList) { | ||||||
| @ -98,7 +95,6 @@ public class ScrProductionController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:01 |      * @date 2025-09-10 10:03:01 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrProduction/edit") |     @PostMapping("/scrProduction/edit") | ||||||
|     @BusinessLog(title = "产量_编辑", opType = LogAnnotionOpTypeEnum.EDIT) |     @BusinessLog(title = "产量_编辑", opType = LogAnnotionOpTypeEnum.EDIT) | ||||||
|     public ResponseData edit(@RequestBody @Validated(ScrProductionParam.edit.class) ScrProductionParam scrProductionParam) { |     public ResponseData edit(@RequestBody @Validated(ScrProductionParam.edit.class) ScrProductionParam scrProductionParam) { | ||||||
| @ -112,7 +108,6 @@ public class ScrProductionController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:01 |      * @date 2025-09-10 10:03:01 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrProduction/detail") |     @GetMapping("/scrProduction/detail") | ||||||
|     @BusinessLog(title = "产量_查看", opType = LogAnnotionOpTypeEnum.DETAIL) |     @BusinessLog(title = "产量_查看", opType = LogAnnotionOpTypeEnum.DETAIL) | ||||||
|     public ResponseData detail(@Validated(ScrProductionParam.detail.class) ScrProductionParam scrProductionParam) { |     public ResponseData detail(@Validated(ScrProductionParam.detail.class) ScrProductionParam scrProductionParam) { | ||||||
| @ -125,7 +120,6 @@ public class ScrProductionController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:01 |      * @date 2025-09-10 10:03:01 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrProduction/list") |     @GetMapping("/scrProduction/list") | ||||||
|     @BusinessLog(title = "产量_列表", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "产量_列表", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData list(ScrProductionParam scrProductionParam) { |     public ResponseData list(ScrProductionParam scrProductionParam) { | ||||||
| @ -138,7 +132,6 @@ public class ScrProductionController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:01 |      * @date 2025-09-10 10:03:01 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrProduction/export") |     @GetMapping("/scrProduction/export") | ||||||
|     @BusinessLog(title = "产量_导出", opType = LogAnnotionOpTypeEnum.EXPORT) |     @BusinessLog(title = "产量_导出", opType = LogAnnotionOpTypeEnum.EXPORT) | ||||||
|     public void export(ScrProductionParam scrProductionParam) { |     public void export(ScrProductionParam scrProductionParam) { | ||||||
|  | |||||||
| @ -57,7 +57,6 @@ public class ScrRawMaterialsController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:02 |      * @date 2025-09-10 10:03:02 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrRawMaterials/page") |     @GetMapping("/scrRawMaterials/page") | ||||||
|     @BusinessLog(title = "原材料_查询", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "原材料_查询", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData page(ScrRawMaterialsParam scrRawMaterialsParam) { |     public ResponseData page(ScrRawMaterialsParam scrRawMaterialsParam) { | ||||||
| @ -70,7 +69,6 @@ public class ScrRawMaterialsController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:02 |      * @date 2025-09-10 10:03:02 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrRawMaterials/add") |     @PostMapping("/scrRawMaterials/add") | ||||||
|     @BusinessLog(title = "原材料_增加", opType = LogAnnotionOpTypeEnum.ADD) |     @BusinessLog(title = "原材料_增加", opType = LogAnnotionOpTypeEnum.ADD) | ||||||
|     public ResponseData add(@RequestBody @Validated(ScrRawMaterialsParam.add.class) ScrRawMaterialsParam scrRawMaterialsParam) { |     public ResponseData add(@RequestBody @Validated(ScrRawMaterialsParam.add.class) ScrRawMaterialsParam scrRawMaterialsParam) { | ||||||
| @ -84,7 +82,6 @@ public class ScrRawMaterialsController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:02 |      * @date 2025-09-10 10:03:02 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrRawMaterials/delete") |     @PostMapping("/scrRawMaterials/delete") | ||||||
|     @BusinessLog(title = "原材料_删除", opType = LogAnnotionOpTypeEnum.DELETE) |     @BusinessLog(title = "原材料_删除", opType = LogAnnotionOpTypeEnum.DELETE) | ||||||
|     public ResponseData delete(@RequestBody @Validated(ScrRawMaterialsParam.delete.class) List<ScrRawMaterialsParam> scrRawMaterialsParamList) { |     public ResponseData delete(@RequestBody @Validated(ScrRawMaterialsParam.delete.class) List<ScrRawMaterialsParam> scrRawMaterialsParamList) { | ||||||
| @ -98,7 +95,6 @@ public class ScrRawMaterialsController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:02 |      * @date 2025-09-10 10:03:02 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrRawMaterials/edit") |     @PostMapping("/scrRawMaterials/edit") | ||||||
|     @BusinessLog(title = "原材料_编辑", opType = LogAnnotionOpTypeEnum.EDIT) |     @BusinessLog(title = "原材料_编辑", opType = LogAnnotionOpTypeEnum.EDIT) | ||||||
|     public ResponseData edit(@RequestBody @Validated(ScrRawMaterialsParam.edit.class) ScrRawMaterialsParam scrRawMaterialsParam) { |     public ResponseData edit(@RequestBody @Validated(ScrRawMaterialsParam.edit.class) ScrRawMaterialsParam scrRawMaterialsParam) { | ||||||
| @ -112,7 +108,6 @@ public class ScrRawMaterialsController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:02 |      * @date 2025-09-10 10:03:02 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrRawMaterials/detail") |     @GetMapping("/scrRawMaterials/detail") | ||||||
|     @BusinessLog(title = "原材料_查看", opType = LogAnnotionOpTypeEnum.DETAIL) |     @BusinessLog(title = "原材料_查看", opType = LogAnnotionOpTypeEnum.DETAIL) | ||||||
|     public ResponseData detail(@Validated(ScrRawMaterialsParam.detail.class) ScrRawMaterialsParam scrRawMaterialsParam) { |     public ResponseData detail(@Validated(ScrRawMaterialsParam.detail.class) ScrRawMaterialsParam scrRawMaterialsParam) { | ||||||
| @ -125,7 +120,6 @@ public class ScrRawMaterialsController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:02 |      * @date 2025-09-10 10:03:02 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrRawMaterials/list") |     @GetMapping("/scrRawMaterials/list") | ||||||
|     @BusinessLog(title = "原材料_列表", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "原材料_列表", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData list(ScrRawMaterialsParam scrRawMaterialsParam) { |     public ResponseData list(ScrRawMaterialsParam scrRawMaterialsParam) { | ||||||
| @ -138,7 +132,6 @@ public class ScrRawMaterialsController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:02 |      * @date 2025-09-10 10:03:02 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrRawMaterials/export") |     @GetMapping("/scrRawMaterials/export") | ||||||
|     @BusinessLog(title = "原材料_导出", opType = LogAnnotionOpTypeEnum.EXPORT) |     @BusinessLog(title = "原材料_导出", opType = LogAnnotionOpTypeEnum.EXPORT) | ||||||
|     public void export(ScrRawMaterialsParam scrRawMaterialsParam) { |     public void export(ScrRawMaterialsParam scrRawMaterialsParam) { | ||||||
|  | |||||||
| @ -57,7 +57,6 @@ public class ScrRiskDataController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:08:52 |      * @date 2025-10-13 17:08:52 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrRiskData/page") |     @GetMapping("/scrRiskData/page") | ||||||
|     @BusinessLog(title = "风险排查_查询", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "风险排查_查询", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData page(ScrRiskDataParam scrRiskDataParam) { |     public ResponseData page(ScrRiskDataParam scrRiskDataParam) { | ||||||
| @ -70,7 +69,6 @@ public class ScrRiskDataController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:08:52 |      * @date 2025-10-13 17:08:52 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrRiskData/add") |     @PostMapping("/scrRiskData/add") | ||||||
|     @BusinessLog(title = "风险排查_增加", opType = LogAnnotionOpTypeEnum.ADD) |     @BusinessLog(title = "风险排查_增加", opType = LogAnnotionOpTypeEnum.ADD) | ||||||
|     public ResponseData add(@RequestBody @Validated(ScrRiskDataParam.add.class) ScrRiskDataParam scrRiskDataParam) { |     public ResponseData add(@RequestBody @Validated(ScrRiskDataParam.add.class) ScrRiskDataParam scrRiskDataParam) { | ||||||
| @ -84,7 +82,6 @@ public class ScrRiskDataController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:08:52 |      * @date 2025-10-13 17:08:52 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrRiskData/delete") |     @PostMapping("/scrRiskData/delete") | ||||||
|     @BusinessLog(title = "风险排查_删除", opType = LogAnnotionOpTypeEnum.DELETE) |     @BusinessLog(title = "风险排查_删除", opType = LogAnnotionOpTypeEnum.DELETE) | ||||||
|     public ResponseData delete(@RequestBody @Validated(ScrRiskDataParam.delete.class) List<ScrRiskDataParam> scrRiskDataParamList) { |     public ResponseData delete(@RequestBody @Validated(ScrRiskDataParam.delete.class) List<ScrRiskDataParam> scrRiskDataParamList) { | ||||||
| @ -98,7 +95,7 @@ public class ScrRiskDataController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:08:52 |      * @date 2025-10-13 17:08:52 | ||||||
|      */ |      */ | ||||||
|     @Permission | 
 | ||||||
|     @PostMapping("/scrRiskData/edit") |     @PostMapping("/scrRiskData/edit") | ||||||
|     @BusinessLog(title = "风险排查_编辑", opType = LogAnnotionOpTypeEnum.EDIT) |     @BusinessLog(title = "风险排查_编辑", opType = LogAnnotionOpTypeEnum.EDIT) | ||||||
|     public ResponseData edit(@RequestBody @Validated(ScrRiskDataParam.edit.class) ScrRiskDataParam scrRiskDataParam) { |     public ResponseData edit(@RequestBody @Validated(ScrRiskDataParam.edit.class) ScrRiskDataParam scrRiskDataParam) { | ||||||
| @ -112,7 +109,6 @@ public class ScrRiskDataController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:08:52 |      * @date 2025-10-13 17:08:52 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrRiskData/detail") |     @GetMapping("/scrRiskData/detail") | ||||||
|     @BusinessLog(title = "风险排查_查看", opType = LogAnnotionOpTypeEnum.DETAIL) |     @BusinessLog(title = "风险排查_查看", opType = LogAnnotionOpTypeEnum.DETAIL) | ||||||
|     public ResponseData detail(@Validated(ScrRiskDataParam.detail.class) ScrRiskDataParam scrRiskDataParam) { |     public ResponseData detail(@Validated(ScrRiskDataParam.detail.class) ScrRiskDataParam scrRiskDataParam) { | ||||||
| @ -125,7 +121,6 @@ public class ScrRiskDataController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:08:52 |      * @date 2025-10-13 17:08:52 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrRiskData/list") |     @GetMapping("/scrRiskData/list") | ||||||
|     @BusinessLog(title = "风险排查_列表", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "风险排查_列表", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData list(ScrRiskDataParam scrRiskDataParam) { |     public ResponseData list(ScrRiskDataParam scrRiskDataParam) { | ||||||
| @ -138,7 +133,6 @@ public class ScrRiskDataController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:08:52 |      * @date 2025-10-13 17:08:52 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrRiskData/export") |     @GetMapping("/scrRiskData/export") | ||||||
|     @BusinessLog(title = "风险排查_导出", opType = LogAnnotionOpTypeEnum.EXPORT) |     @BusinessLog(title = "风险排查_导出", opType = LogAnnotionOpTypeEnum.EXPORT) | ||||||
|     public void export(ScrRiskDataParam scrRiskDataParam) { |     public void export(ScrRiskDataParam scrRiskDataParam) { | ||||||
|  | |||||||
| @ -49,16 +49,10 @@ public class ScrRiskData extends BaseEntity { | |||||||
|     private Long id; |     private Long id; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 年份 |      * 日期 | ||||||
|      */ |      */ | ||||||
|     @Excel(name = "年份") |     @Excel(name = "日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20) | ||||||
|     private Integer year; |     private Date happenTime; | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * 月份 |  | ||||||
|      */ |  | ||||||
|     @Excel(name = "月份") |  | ||||||
|     private Integer month; |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 已排查 |      * 已排查 | ||||||
|  | |||||||
| @ -46,16 +46,10 @@ public class ScrRiskDataParam extends BaseParam { | |||||||
|     private Long id; |     private Long id; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 年份 |      * 日期 | ||||||
|      */ |      */ | ||||||
|     @NotNull(message = "年份不能为空,请检查year参数", groups = {add.class, edit.class}) |     @NotNull(message = "日期不能为空,请检查happenTime参数", groups = {add.class, edit.class}) | ||||||
|     private Integer year; |     private String happenTime; | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * 月份 |  | ||||||
|      */ |  | ||||||
|     @NotNull(message = "月份不能为空,请检查month参数", groups = {add.class, edit.class}) |  | ||||||
|     private Integer month; |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 已排查 |      * 已排查 | ||||||
| @ -74,5 +68,6 @@ public class ScrRiskDataParam extends BaseParam { | |||||||
|      */ |      */ | ||||||
|     @NotNull(message = "超期未排查不能为空,请检查cqwpc参数", groups = {add.class, edit.class}) |     @NotNull(message = "超期未排查不能为空,请检查cqwpc参数", groups = {add.class, edit.class}) | ||||||
|     private Integer cqwpc; |     private Integer cqwpc; | ||||||
| 
 |     private Integer year; | ||||||
|  |     private Integer month; | ||||||
| } | } | ||||||
|  | |||||||
| @ -36,6 +36,9 @@ import vip.xiaonuo.core.exception.ServiceException; | |||||||
| import vip.xiaonuo.core.factory.PageFactory; | import vip.xiaonuo.core.factory.PageFactory; | ||||||
| import vip.xiaonuo.core.pojo.page.PageResult; | import vip.xiaonuo.core.pojo.page.PageResult; | ||||||
| import vip.xiaonuo.core.util.PoiUtil; | import vip.xiaonuo.core.util.PoiUtil; | ||||||
|  | import vip.xiaonuo.modular.scrhidedata.enums.ScrHideDataExceptionEnum; | ||||||
|  | import vip.xiaonuo.modular.scrmeterdata.entity.ScrMeterData; | ||||||
|  | import vip.xiaonuo.modular.scrmeterdata.param.ScrMeterDataParam; | ||||||
| import vip.xiaonuo.modular.scrriskdata.entity.ScrRiskData; | import vip.xiaonuo.modular.scrriskdata.entity.ScrRiskData; | ||||||
| import vip.xiaonuo.modular.scrriskdata.enums.ScrRiskDataExceptionEnum; | import vip.xiaonuo.modular.scrriskdata.enums.ScrRiskDataExceptionEnum; | ||||||
| import vip.xiaonuo.modular.scrriskdata.mapper.ScrRiskDataMapper; | import vip.xiaonuo.modular.scrriskdata.mapper.ScrRiskDataMapper; | ||||||
| @ -44,6 +47,7 @@ import vip.xiaonuo.modular.scrriskdata.service.ScrRiskDataService; | |||||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||||
|  | import java.time.LocalDate; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -60,13 +64,11 @@ public class ScrRiskDataServiceImpl extends ServiceImpl<ScrRiskDataMapper, ScrRi | |||||||
|         QueryWrapper<ScrRiskData> queryWrapper = new QueryWrapper<>(); |         QueryWrapper<ScrRiskData> queryWrapper = new QueryWrapper<>(); | ||||||
|         if (ObjectUtil.isNotNull(scrRiskDataParam)) { |         if (ObjectUtil.isNotNull(scrRiskDataParam)) { | ||||||
| 
 | 
 | ||||||
|             // 根据年份 查询 |             // 根据日期 查询 | ||||||
|             if (ObjectUtil.isNotEmpty(scrRiskDataParam.getYear())) { |             if (ObjectUtil.isNotEmpty(scrRiskDataParam.getHappenTime())) { | ||||||
|                 queryWrapper.lambda().eq(ScrRiskData::getYear, scrRiskDataParam.getYear()); |                 LocalDate happenTime = LocalDate.parse(scrRiskDataParam.getHappenTime()); | ||||||
|             } |                 queryWrapper.apply("YEAR(happen_time) = {0}", happenTime.getYear()); | ||||||
|             // 根据月份 查询 |                 queryWrapper.apply("MONTH(happen_time) = {0}", happenTime.getMonthValue()); | ||||||
|             if (ObjectUtil.isNotEmpty(scrRiskDataParam.getMonth())) { |  | ||||||
|                 queryWrapper.lambda().eq(ScrRiskData::getMonth, scrRiskDataParam.getMonth()); |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); |         return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); | ||||||
| @ -74,16 +76,42 @@ public class ScrRiskDataServiceImpl extends ServiceImpl<ScrRiskDataMapper, ScrRi | |||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public List<ScrRiskData> list(ScrRiskDataParam scrRiskDataParam) { |     public List<ScrRiskData> list(ScrRiskDataParam scrRiskDataParam) { | ||||||
|         return this.list(); |         QueryWrapper<ScrRiskData> queryWrapper = new QueryWrapper<>(); | ||||||
|  |         if (ObjectUtil.isNotNull(scrRiskDataParam)) { | ||||||
|  | 
 | ||||||
|  |             if (ObjectUtil.isNotEmpty(scrRiskDataParam.getYear()) && ObjectUtil.isNotEmpty(scrRiskDataParam.getMonth())) { | ||||||
|  |                 queryWrapper.apply("YEAR(happen_time) = {0}", scrRiskDataParam.getYear()); | ||||||
|  |                 queryWrapper.apply("Month(happen_time) = {0}", scrRiskDataParam.getMonth()); | ||||||
|  |             } else if (ObjectUtil.isNotEmpty(scrRiskDataParam.getYear())) { | ||||||
|  |                 queryWrapper.apply("YEAR(happen_time) = {0}", scrRiskDataParam.getYear()); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return this.list(queryWrapper); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void add(ScrRiskDataParam scrRiskDataParam) { |     public void add(ScrRiskDataParam scrRiskDataParam) { | ||||||
|  |         checkParam(scrRiskDataParam, false); | ||||||
|         ScrRiskData scrRiskData = new ScrRiskData(); |         ScrRiskData scrRiskData = new ScrRiskData(); | ||||||
|         BeanUtil.copyProperties(scrRiskDataParam, scrRiskData); |         BeanUtil.copyProperties(scrRiskDataParam, scrRiskData); | ||||||
|         this.save(scrRiskData); |         this.save(scrRiskData); | ||||||
|     } |     } | ||||||
| 
 |     private void checkParam(ScrRiskDataParam scrRiskDataParam, boolean isExcludeSelf) { | ||||||
|  |         Long id = scrRiskDataParam.getId(); | ||||||
|  |         LocalDate happenTime = LocalDate.parse(scrRiskDataParam.getHappenTime()); | ||||||
|  |         LambdaQueryWrapper<ScrRiskData> queryWrapper = new LambdaQueryWrapper<>(); | ||||||
|  |         queryWrapper.apply("YEAR(happen_time) = {0}", happenTime.getYear()); | ||||||
|  |         queryWrapper.apply("MONTH(happen_time) = {0}", happenTime.getMonthValue()); | ||||||
|  |         //是否排除自己,如果是则查询条件排除自己id | ||||||
|  |         if (isExcludeSelf) { | ||||||
|  |             queryWrapper.ne(ScrRiskData::getId, id); | ||||||
|  |         } | ||||||
|  |         int countByAccount = this.count(queryWrapper); | ||||||
|  |         //大于等于1个则表示重复 | ||||||
|  |         if (countByAccount >= 1) { | ||||||
|  |             throw new ServiceException(ScrHideDataExceptionEnum.HAPPEN_TIME_REPEAT); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|     @Transactional(rollbackFor = Exception.class) |     @Transactional(rollbackFor = Exception.class) | ||||||
|     @Override |     @Override | ||||||
|     public void delete(List<ScrRiskDataParam> scrRiskDataParamList) { |     public void delete(List<ScrRiskDataParam> scrRiskDataParamList) { | ||||||
| @ -95,6 +123,7 @@ public class ScrRiskDataServiceImpl extends ServiceImpl<ScrRiskDataMapper, ScrRi | |||||||
|     @Transactional(rollbackFor = Exception.class) |     @Transactional(rollbackFor = Exception.class) | ||||||
|     @Override |     @Override | ||||||
|     public void edit(ScrRiskDataParam scrRiskDataParam) { |     public void edit(ScrRiskDataParam scrRiskDataParam) { | ||||||
|  |         checkParam(scrRiskDataParam, true); | ||||||
|         ScrRiskData scrRiskData = this.queryScrRiskData(scrRiskDataParam); |         ScrRiskData scrRiskData = this.queryScrRiskData(scrRiskDataParam); | ||||||
|         BeanUtil.copyProperties(scrRiskDataParam, scrRiskData); |         BeanUtil.copyProperties(scrRiskDataParam, scrRiskData); | ||||||
|         this.updateById(scrRiskData); |         this.updateById(scrRiskData); | ||||||
|  | |||||||
| @ -58,7 +58,6 @@ public class ScrSecurityController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:04 |      * @date 2025-09-10 10:03:04 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrSecurity/page") |     @GetMapping("/scrSecurity/page") | ||||||
|     @BusinessLog(title = "安全异常事件_查询", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "安全异常事件_查询", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData page(ScrSecurityParam scrSecurityParam) { |     public ResponseData page(ScrSecurityParam scrSecurityParam) { | ||||||
| @ -71,7 +70,6 @@ public class ScrSecurityController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:04 |      * @date 2025-09-10 10:03:04 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrSecurity/add") |     @PostMapping("/scrSecurity/add") | ||||||
|     @BusinessLog(title = "安全异常事件_增加", opType = LogAnnotionOpTypeEnum.ADD) |     @BusinessLog(title = "安全异常事件_增加", opType = LogAnnotionOpTypeEnum.ADD) | ||||||
|     public ResponseData add(@RequestBody @Validated(ScrSecurityParam.add.class) ScrSecurityParam scrSecurityParam) { |     public ResponseData add(@RequestBody @Validated(ScrSecurityParam.add.class) ScrSecurityParam scrSecurityParam) { | ||||||
| @ -85,7 +83,6 @@ public class ScrSecurityController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:04 |      * @date 2025-09-10 10:03:04 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrSecurity/delete") |     @PostMapping("/scrSecurity/delete") | ||||||
|     @BusinessLog(title = "安全异常事件_删除", opType = LogAnnotionOpTypeEnum.DELETE) |     @BusinessLog(title = "安全异常事件_删除", opType = LogAnnotionOpTypeEnum.DELETE) | ||||||
|     public ResponseData delete(@RequestBody @Validated(ScrSecurityParam.delete.class) List<ScrSecurityParam> scrSecurityParamList) { |     public ResponseData delete(@RequestBody @Validated(ScrSecurityParam.delete.class) List<ScrSecurityParam> scrSecurityParamList) { | ||||||
| @ -99,7 +96,6 @@ public class ScrSecurityController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:04 |      * @date 2025-09-10 10:03:04 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrSecurity/edit") |     @PostMapping("/scrSecurity/edit") | ||||||
|     @BusinessLog(title = "安全异常事件_编辑", opType = LogAnnotionOpTypeEnum.EDIT) |     @BusinessLog(title = "安全异常事件_编辑", opType = LogAnnotionOpTypeEnum.EDIT) | ||||||
|     public ResponseData edit(@RequestBody @Validated(ScrSecurityParam.edit.class) ScrSecurityParam scrSecurityParam) { |     public ResponseData edit(@RequestBody @Validated(ScrSecurityParam.edit.class) ScrSecurityParam scrSecurityParam) { | ||||||
| @ -113,7 +109,6 @@ public class ScrSecurityController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:04 |      * @date 2025-09-10 10:03:04 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrSecurity/detail") |     @GetMapping("/scrSecurity/detail") | ||||||
|     @BusinessLog(title = "安全异常事件_查看", opType = LogAnnotionOpTypeEnum.DETAIL) |     @BusinessLog(title = "安全异常事件_查看", opType = LogAnnotionOpTypeEnum.DETAIL) | ||||||
|     public ResponseData detail(@Validated(ScrSecurityParam.detail.class) ScrSecurityParam scrSecurityParam) { |     public ResponseData detail(@Validated(ScrSecurityParam.detail.class) ScrSecurityParam scrSecurityParam) { | ||||||
| @ -126,7 +121,6 @@ public class ScrSecurityController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:04 |      * @date 2025-09-10 10:03:04 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrSecurity/list") |     @GetMapping("/scrSecurity/list") | ||||||
|     @BusinessLog(title = "安全异常事件_列表", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "安全异常事件_列表", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData list(ScrSecurityParam scrSecurityParam) { |     public ResponseData list(ScrSecurityParam scrSecurityParam) { | ||||||
| @ -139,7 +133,6 @@ public class ScrSecurityController { | |||||||
|      * @author zyn |      * @author zyn | ||||||
|      * @date 2025-09-10 10:03:04 |      * @date 2025-09-10 10:03:04 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrSecurity/export") |     @GetMapping("/scrSecurity/export") | ||||||
|     @BusinessLog(title = "安全异常事件_导出", opType = LogAnnotionOpTypeEnum.EXPORT) |     @BusinessLog(title = "安全异常事件_导出", opType = LogAnnotionOpTypeEnum.EXPORT) | ||||||
|     public void export(ScrSecurityParam scrSecurityParam) { |     public void export(ScrSecurityParam scrSecurityParam) { | ||||||
|  | |||||||
| @ -63,7 +63,7 @@ public class ScrSecurityServiceImpl extends ServiceImpl<ScrSecurityMapper, ScrSe | |||||||
| 
 | 
 | ||||||
|             // 根据发生时间 查询 |             // 根据发生时间 查询 | ||||||
|             if (ObjectUtil.isNotEmpty(scrSecurityParam.getHappenTime())) { |             if (ObjectUtil.isNotEmpty(scrSecurityParam.getHappenTime())) { | ||||||
|                 queryWrapper.lambda().eq(ScrSecurity::getHappenTime, scrSecurityParam.getHappenTime()); |                 queryWrapper.apply("DATE(happen_time) = {0}", scrSecurityParam.getHappenTime()); | ||||||
|             } |             } | ||||||
|             // 根据事件类型 查询 |             // 根据事件类型 查询 | ||||||
|             if (ObjectUtil.isNotEmpty(scrSecurityParam.getEventType())) { |             if (ObjectUtil.isNotEmpty(scrSecurityParam.getEventType())) { | ||||||
|  | |||||||
| @ -57,7 +57,6 @@ public class ScrWorkTaskController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:49:44 |      * @date 2025-10-13 17:49:44 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrWorkTask/page") |     @GetMapping("/scrWorkTask/page") | ||||||
|     @BusinessLog(title = "作业票_查询", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "作业票_查询", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData page(ScrWorkTaskParam scrWorkTaskParam) { |     public ResponseData page(ScrWorkTaskParam scrWorkTaskParam) { | ||||||
| @ -70,7 +69,6 @@ public class ScrWorkTaskController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:49:44 |      * @date 2025-10-13 17:49:44 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrWorkTask/add") |     @PostMapping("/scrWorkTask/add") | ||||||
|     @BusinessLog(title = "作业票_增加", opType = LogAnnotionOpTypeEnum.ADD) |     @BusinessLog(title = "作业票_增加", opType = LogAnnotionOpTypeEnum.ADD) | ||||||
|     public ResponseData add(@RequestBody @Validated(ScrWorkTaskParam.add.class) ScrWorkTaskParam scrWorkTaskParam) { |     public ResponseData add(@RequestBody @Validated(ScrWorkTaskParam.add.class) ScrWorkTaskParam scrWorkTaskParam) { | ||||||
| @ -84,7 +82,6 @@ public class ScrWorkTaskController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:49:44 |      * @date 2025-10-13 17:49:44 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrWorkTask/delete") |     @PostMapping("/scrWorkTask/delete") | ||||||
|     @BusinessLog(title = "作业票_删除", opType = LogAnnotionOpTypeEnum.DELETE) |     @BusinessLog(title = "作业票_删除", opType = LogAnnotionOpTypeEnum.DELETE) | ||||||
|     public ResponseData delete(@RequestBody @Validated(ScrWorkTaskParam.delete.class) List<ScrWorkTaskParam> scrWorkTaskParamList) { |     public ResponseData delete(@RequestBody @Validated(ScrWorkTaskParam.delete.class) List<ScrWorkTaskParam> scrWorkTaskParamList) { | ||||||
| @ -98,7 +95,6 @@ public class ScrWorkTaskController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:49:44 |      * @date 2025-10-13 17:49:44 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @PostMapping("/scrWorkTask/edit") |     @PostMapping("/scrWorkTask/edit") | ||||||
|     @BusinessLog(title = "作业票_编辑", opType = LogAnnotionOpTypeEnum.EDIT) |     @BusinessLog(title = "作业票_编辑", opType = LogAnnotionOpTypeEnum.EDIT) | ||||||
|     public ResponseData edit(@RequestBody @Validated(ScrWorkTaskParam.edit.class) ScrWorkTaskParam scrWorkTaskParam) { |     public ResponseData edit(@RequestBody @Validated(ScrWorkTaskParam.edit.class) ScrWorkTaskParam scrWorkTaskParam) { | ||||||
| @ -112,7 +108,6 @@ public class ScrWorkTaskController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:49:44 |      * @date 2025-10-13 17:49:44 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrWorkTask/detail") |     @GetMapping("/scrWorkTask/detail") | ||||||
|     @BusinessLog(title = "作业票_查看", opType = LogAnnotionOpTypeEnum.DETAIL) |     @BusinessLog(title = "作业票_查看", opType = LogAnnotionOpTypeEnum.DETAIL) | ||||||
|     public ResponseData detail(@Validated(ScrWorkTaskParam.detail.class) ScrWorkTaskParam scrWorkTaskParam) { |     public ResponseData detail(@Validated(ScrWorkTaskParam.detail.class) ScrWorkTaskParam scrWorkTaskParam) { | ||||||
| @ -125,7 +120,6 @@ public class ScrWorkTaskController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:49:44 |      * @date 2025-10-13 17:49:44 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrWorkTask/list") |     @GetMapping("/scrWorkTask/list") | ||||||
|     @BusinessLog(title = "作业票_列表", opType = LogAnnotionOpTypeEnum.QUERY) |     @BusinessLog(title = "作业票_列表", opType = LogAnnotionOpTypeEnum.QUERY) | ||||||
|     public ResponseData list(ScrWorkTaskParam scrWorkTaskParam) { |     public ResponseData list(ScrWorkTaskParam scrWorkTaskParam) { | ||||||
| @ -138,7 +132,6 @@ public class ScrWorkTaskController { | |||||||
|      * @author 1 |      * @author 1 | ||||||
|      * @date 2025-10-13 17:49:44 |      * @date 2025-10-13 17:49:44 | ||||||
|      */ |      */ | ||||||
|     @Permission |  | ||||||
|     @GetMapping("/scrWorkTask/export") |     @GetMapping("/scrWorkTask/export") | ||||||
|     @BusinessLog(title = "作业票_导出", opType = LogAnnotionOpTypeEnum.EXPORT) |     @BusinessLog(title = "作业票_导出", opType = LogAnnotionOpTypeEnum.EXPORT) | ||||||
|     public void export(ScrWorkTaskParam scrWorkTaskParam) { |     public void export(ScrWorkTaskParam scrWorkTaskParam) { | ||||||
|  | |||||||
| @ -55,16 +55,10 @@ public class ScrWorkTask extends BaseEntity { | |||||||
|     private String name; |     private String name; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 年 |      * 日期 | ||||||
|      */ |      */ | ||||||
|     @Excel(name = "年") |     @Excel(name = "日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20) | ||||||
|     private Integer year; |     private Date happenTime; | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * 月份 |  | ||||||
|      */ |  | ||||||
|     @Excel(name = "月份") |  | ||||||
|     private Integer month; |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 数量 |      * 数量 | ||||||
|  | |||||||
| @ -52,21 +52,16 @@ public class ScrWorkTaskParam extends BaseParam { | |||||||
|     private String name; |     private String name; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 年 |      * 日期 | ||||||
|      */ |      */ | ||||||
|     @NotNull(message = "年不能为空,请检查year参数", groups = {add.class, edit.class}) |     @NotNull(message = "日期不能为空,请检查happenTime参数", groups = {add.class, edit.class}) | ||||||
|     private Integer year; |     private String happenTime; | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * 月份 |  | ||||||
|      */ |  | ||||||
|     @NotNull(message = "月份不能为空,请检查month参数", groups = {add.class, edit.class}) |  | ||||||
|     private Integer month; |  | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 数量 |      * 数量 | ||||||
|      */ |      */ | ||||||
|     @NotNull(message = "数量不能为空,请检查totalNum参数", groups = {add.class, edit.class}) |     @NotNull(message = "数量不能为空,请检查totalNum参数", groups = {add.class, edit.class}) | ||||||
|     private Integer totalNum; |     private Integer totalNum; | ||||||
| 
 |     private Integer year; | ||||||
|  |     private Integer month; | ||||||
| } | } | ||||||
|  | |||||||
| @ -36,6 +36,9 @@ import vip.xiaonuo.core.exception.ServiceException; | |||||||
| import vip.xiaonuo.core.factory.PageFactory; | import vip.xiaonuo.core.factory.PageFactory; | ||||||
| import vip.xiaonuo.core.pojo.page.PageResult; | import vip.xiaonuo.core.pojo.page.PageResult; | ||||||
| import vip.xiaonuo.core.util.PoiUtil; | import vip.xiaonuo.core.util.PoiUtil; | ||||||
|  | import vip.xiaonuo.modular.scrhidedata.enums.ScrHideDataExceptionEnum; | ||||||
|  | import vip.xiaonuo.modular.scrmeterdata.entity.ScrMeterData; | ||||||
|  | import vip.xiaonuo.modular.scrmeterdata.param.ScrMeterDataParam; | ||||||
| import vip.xiaonuo.modular.scrworktask.entity.ScrWorkTask; | import vip.xiaonuo.modular.scrworktask.entity.ScrWorkTask; | ||||||
| import vip.xiaonuo.modular.scrworktask.enums.ScrWorkTaskExceptionEnum; | import vip.xiaonuo.modular.scrworktask.enums.ScrWorkTaskExceptionEnum; | ||||||
| import vip.xiaonuo.modular.scrworktask.mapper.ScrWorkTaskMapper; | import vip.xiaonuo.modular.scrworktask.mapper.ScrWorkTaskMapper; | ||||||
| @ -44,6 +47,7 @@ import vip.xiaonuo.modular.scrworktask.service.ScrWorkTaskService; | |||||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||||
|  | import java.time.LocalDate; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -64,13 +68,11 @@ public class ScrWorkTaskServiceImpl extends ServiceImpl<ScrWorkTaskMapper, ScrWo | |||||||
|             if (ObjectUtil.isNotEmpty(scrWorkTaskParam.getName())) { |             if (ObjectUtil.isNotEmpty(scrWorkTaskParam.getName())) { | ||||||
|                 queryWrapper.lambda().eq(ScrWorkTask::getName, scrWorkTaskParam.getName()); |                 queryWrapper.lambda().eq(ScrWorkTask::getName, scrWorkTaskParam.getName()); | ||||||
|             } |             } | ||||||
|             // 根据年 查询 |             // 根据日期 查询 | ||||||
|             if (ObjectUtil.isNotEmpty(scrWorkTaskParam.getYear())) { |             if (ObjectUtil.isNotEmpty(scrWorkTaskParam.getHappenTime())) { | ||||||
|                 queryWrapper.lambda().eq(ScrWorkTask::getYear, scrWorkTaskParam.getYear()); |                 LocalDate happenTime = LocalDate.parse(scrWorkTaskParam.getHappenTime()); | ||||||
|             } |                 queryWrapper.apply("YEAR(happen_time) = {0}", happenTime.getYear()); | ||||||
|             // 根据月份 查询 |                 queryWrapper.apply("MONTH(happen_time) = {0}", happenTime.getMonthValue()); | ||||||
|             if (ObjectUtil.isNotEmpty(scrWorkTaskParam.getMonth())) { |  | ||||||
|                 queryWrapper.lambda().eq(ScrWorkTask::getMonth, scrWorkTaskParam.getMonth()); |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); |         return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); | ||||||
| @ -78,16 +80,48 @@ public class ScrWorkTaskServiceImpl extends ServiceImpl<ScrWorkTaskMapper, ScrWo | |||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public List<ScrWorkTask> list(ScrWorkTaskParam scrWorkTaskParam) { |     public List<ScrWorkTask> list(ScrWorkTaskParam scrWorkTaskParam) { | ||||||
|         return this.list(); |         QueryWrapper<ScrWorkTask> 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()) && ObjectUtil.isNotEmpty(scrWorkTaskParam.getMonth())) { | ||||||
|  |                 queryWrapper.apply("YEAR(happen_time) = {0}", scrWorkTaskParam.getYear()); | ||||||
|  |                 queryWrapper.apply("Month(happen_time) = {0}", scrWorkTaskParam.getMonth()); | ||||||
|  |             } else if (ObjectUtil.isNotEmpty(scrWorkTaskParam.getYear())) { | ||||||
|  |                 queryWrapper.apply("YEAR(happen_time) = {0}", scrWorkTaskParam.getYear()); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return this.list(queryWrapper); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void add(ScrWorkTaskParam scrWorkTaskParam) { |     public void add(ScrWorkTaskParam scrWorkTaskParam) { | ||||||
|  |         checkParam(scrWorkTaskParam, false); | ||||||
|         ScrWorkTask scrWorkTask = new ScrWorkTask(); |         ScrWorkTask scrWorkTask = new ScrWorkTask(); | ||||||
|         BeanUtil.copyProperties(scrWorkTaskParam, scrWorkTask); |         BeanUtil.copyProperties(scrWorkTaskParam, scrWorkTask); | ||||||
|         this.save(scrWorkTask); |         this.save(scrWorkTask); | ||||||
|     } |     } | ||||||
| 
 |     private void checkParam(ScrWorkTaskParam scrWorkTaskParam, boolean isExcludeSelf) { | ||||||
|  |         Long id = scrWorkTaskParam.getId(); | ||||||
|  |         String name = scrWorkTaskParam.getName(); | ||||||
|  |         LocalDate happenTime = LocalDate.parse(scrWorkTaskParam.getHappenTime()); | ||||||
|  |         LambdaQueryWrapper<ScrWorkTask> queryWrapper = new LambdaQueryWrapper<>(); | ||||||
|  |         queryWrapper.eq(ScrWorkTask::getName, name); | ||||||
|  |         queryWrapper.apply("YEAR(happen_time) = {0}", happenTime.getYear()); | ||||||
|  |         queryWrapper.apply("MONTH(happen_time) = {0}", happenTime.getMonthValue()); | ||||||
|  |         //是否排除自己,如果是则查询条件排除自己id | ||||||
|  |         if (isExcludeSelf) { | ||||||
|  |             queryWrapper.ne(ScrWorkTask::getId, id); | ||||||
|  |         } | ||||||
|  |         int countByAccount = this.count(queryWrapper); | ||||||
|  |         //大于等于1个则表示重复 | ||||||
|  |         if (countByAccount >= 1) { | ||||||
|  |             throw new ServiceException(ScrHideDataExceptionEnum.HAPPEN_TIME_REPEAT); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|     @Transactional(rollbackFor = Exception.class) |     @Transactional(rollbackFor = Exception.class) | ||||||
|     @Override |     @Override | ||||||
|     public void delete(List<ScrWorkTaskParam> scrWorkTaskParamList) { |     public void delete(List<ScrWorkTaskParam> scrWorkTaskParamList) { | ||||||
| @ -99,6 +133,7 @@ public class ScrWorkTaskServiceImpl extends ServiceImpl<ScrWorkTaskMapper, ScrWo | |||||||
|     @Transactional(rollbackFor = Exception.class) |     @Transactional(rollbackFor = Exception.class) | ||||||
|     @Override |     @Override | ||||||
|     public void edit(ScrWorkTaskParam scrWorkTaskParam) { |     public void edit(ScrWorkTaskParam scrWorkTaskParam) { | ||||||
|  |         checkParam(scrWorkTaskParam, true); | ||||||
|         ScrWorkTask scrWorkTask = this.queryScrWorkTask(scrWorkTaskParam); |         ScrWorkTask scrWorkTask = this.queryScrWorkTask(scrWorkTaskParam); | ||||||
|         BeanUtil.copyProperties(scrWorkTaskParam, scrWorkTask); |         BeanUtil.copyProperties(scrWorkTaskParam, scrWorkTask); | ||||||
|         this.updateById(scrWorkTask); |         this.updateById(scrWorkTask); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 zhangyanan
						zhangyanan