Compare commits

...

4 Commits
main ... dev

Author SHA1 Message Date
zhangyanan
a2cdaf630f 添加培训 2025-10-17 20:24:51 +08:00
zhangyanan
5d05277e3c 添加字段 2025-10-17 16:05:13 +08:00
zhangyanan
063c13e47d 新增数据录入 2025-10-14 17:43:39 +08:00
8331a6423a Merge pull request 'main' (#1) from main into dev
Reviewed-on: #1
2025-10-13 18:20:55 +08:00
41 changed files with 1601 additions and 176 deletions

View File

@ -71,7 +71,13 @@ public interface SpringSecurityConstant {
"/scrProduction/driQuery",
"/scrSecurity/driQuery",
"/scrProduction/driQhQuery",
"/scrProduction/driMaterQuery"
"/scrProduction/driMaterQuery",
"/scrHideData/list",
"/scrMeterData/list",
"/scrRiskData/list",
"/scrWorkTask/list",
"/scrTrainData/list",
"/scrTrainSche/list"
};

View File

@ -57,7 +57,6 @@ public class ScrFactoryHeatController {
* @author zhangyn
* @date 2025-09-10 10:02:57
*/
@Permission
@GetMapping("/scrFactoryHeat/page")
@BusinessLog(title = "分厂炉号对应关系_查询", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData page(ScrFactoryHeatParam scrFactoryHeatParam) {
@ -70,7 +69,6 @@ public class ScrFactoryHeatController {
* @author zhangyn
* @date 2025-09-10 10:02:57
*/
@Permission
@PostMapping("/scrFactoryHeat/add")
@BusinessLog(title = "分厂炉号对应关系_增加", opType = LogAnnotionOpTypeEnum.ADD)
public ResponseData add(@RequestBody @Validated(ScrFactoryHeatParam.add.class) ScrFactoryHeatParam scrFactoryHeatParam) {
@ -84,7 +82,6 @@ public class ScrFactoryHeatController {
* @author zhangyn
* @date 2025-09-10 10:02:57
*/
@Permission
@PostMapping("/scrFactoryHeat/delete")
@BusinessLog(title = "分厂炉号对应关系_删除", opType = LogAnnotionOpTypeEnum.DELETE)
public ResponseData delete(@RequestBody @Validated(ScrFactoryHeatParam.delete.class) List<ScrFactoryHeatParam> scrFactoryHeatParamList) {
@ -98,7 +95,6 @@ public class ScrFactoryHeatController {
* @author zhangyn
* @date 2025-09-10 10:02:57
*/
@Permission
@PostMapping("/scrFactoryHeat/edit")
@BusinessLog(title = "分厂炉号对应关系_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
public ResponseData edit(@RequestBody @Validated(ScrFactoryHeatParam.edit.class) ScrFactoryHeatParam scrFactoryHeatParam) {
@ -112,7 +108,6 @@ public class ScrFactoryHeatController {
* @author zhangyn
* @date 2025-09-10 10:02:57
*/
@Permission
@GetMapping("/scrFactoryHeat/detail")
@BusinessLog(title = "分厂炉号对应关系_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
public ResponseData detail(@Validated(ScrFactoryHeatParam.detail.class) ScrFactoryHeatParam scrFactoryHeatParam) {
@ -125,7 +120,6 @@ public class ScrFactoryHeatController {
* @author zhangyn
* @date 2025-09-10 10:02:57
*/
@Permission
@GetMapping("/scrFactoryHeat/list")
@BusinessLog(title = "分厂炉号对应关系_列表", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData list(ScrFactoryHeatParam scrFactoryHeatParam) {
@ -138,7 +132,7 @@ public class ScrFactoryHeatController {
* @author zhangyn
* @date 2025-09-10 10:02:57
*/
@Permission
// @Permission
@GetMapping("/scrFactoryHeat/export")
@BusinessLog(title = "分厂炉号对应关系_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
public void export(ScrFactoryHeatParam scrFactoryHeatParam) {

View File

@ -41,7 +41,8 @@ public enum ScrFactoryHeatExceptionEnum implements AbstractBaseExceptionEnum {
/**
* 数据不存在
*/
NOT_EXIST(1, "此数据不存在");
NOT_EXIST(1, "此数据不存在"),
EXIST(2, "此数据已存在");
private final Integer code;

View File

@ -43,7 +43,12 @@ import vip.xiaonuo.modular.scrfactoryheat.param.ScrFactoryHeatParam;
import vip.xiaonuo.modular.scrfactoryheat.service.ScrFactoryHeatService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import 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 java.time.LocalDate;
import java.util.List;
/**
@ -79,11 +84,26 @@ public class ScrFactoryHeatServiceImpl extends ServiceImpl<ScrFactoryHeatMapper,
@Override
public void add(ScrFactoryHeatParam scrFactoryHeatParam) {
checkParam(scrFactoryHeatParam, false);
ScrFactoryHeat scrFactoryHeat = new ScrFactoryHeat();
BeanUtil.copyProperties(scrFactoryHeatParam, 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)
@Override
public void delete(List<ScrFactoryHeatParam> scrFactoryHeatParamList) {
@ -95,6 +115,7 @@ public class ScrFactoryHeatServiceImpl extends ServiceImpl<ScrFactoryHeatMapper,
@Transactional(rollbackFor = Exception.class)
@Override
public void edit(ScrFactoryHeatParam scrFactoryHeatParam) {
checkParam(scrFactoryHeatParam, true);
ScrFactoryHeat scrFactoryHeat = this.queryScrFactoryHeat(scrFactoryHeatParam);
BeanUtil.copyProperties(scrFactoryHeatParam, scrFactoryHeat);
this.updateById(scrFactoryHeat);

View File

@ -57,7 +57,6 @@ public class ScrHideDataController {
* @author 1
* @date 2025-10-13 17:15:20
*/
@Permission
@GetMapping("/scrHideData/page")
@BusinessLog(title = "隐患整改_查询", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData page(ScrHideDataParam scrHideDataParam) {
@ -70,7 +69,6 @@ public class ScrHideDataController {
* @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) {
@ -84,7 +82,6 @@ public class ScrHideDataController {
* @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<ScrHideDataParam> scrHideDataParamList) {
@ -98,7 +95,6 @@ public class ScrHideDataController {
* @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) {
@ -112,7 +108,6 @@ public class ScrHideDataController {
* @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) {
@ -125,7 +120,6 @@ public class ScrHideDataController {
* @author 1
* @date 2025-10-13 17:15:20
*/
@Permission
@GetMapping("/scrHideData/list")
@BusinessLog(title = "隐患整改_列表", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData list(ScrHideDataParam scrHideDataParam) {
@ -138,7 +132,6 @@ public class ScrHideDataController {
* @author 1
* @date 2025-10-13 17:15:20
*/
@Permission
@GetMapping("/scrHideData/export")
@BusinessLog(title = "隐患整改_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
public void export(ScrHideDataParam scrHideDataParam) {

View File

@ -49,17 +49,10 @@ public class ScrHideData extends BaseEntity {
private Long id;
/**
* 年份
* 日期
*/
@Excel(name = "年份")
private Integer year;
/**
* 月份
*/
@Excel(name = "月份")
private Integer month;
@Excel(name = "日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
private Date happenTime;
/**
* 隐患数量
*/
@ -78,4 +71,9 @@ public class ScrHideData extends BaseEntity {
@Excel(name = "未整改")
private Integer wzg;
/**
* 施工地点
*/
@Excel(name = "施工地点")
private String workPlace;
}

View File

@ -41,7 +41,11 @@ public enum ScrHideDataExceptionEnum implements AbstractBaseExceptionEnum {
/**
* 数据不存在
*/
NOT_EXIST(1, "此数据不存在");
NOT_EXIST(1, "此数据不存在"),
/**
* 数据已存在
*/
HAPPEN_TIME_REPEAT(2, "该日期数据已存在,请重新选择");
private final Integer code;

View File

@ -46,16 +46,10 @@ public class ScrHideDataParam extends BaseParam {
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 = "日期不能为空请检查happenTime参数", groups = {add.class, edit.class})
private String happenTime;
/**
* 隐患数量
@ -75,4 +69,12 @@ public class ScrHideDataParam extends BaseParam {
@NotNull(message = "未整改不能为空请检查wzg参数", groups = {add.class, edit.class})
private Integer wzg;
/**
* 施工地点
*/
@NotBlank(message = "施工地点不能为空请检查workPlace参数", groups = {add.class, edit.class})
private String workPlace;
private Integer year;
private Integer month;
}

View File

@ -43,7 +43,13 @@ 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 vip.xiaonuo.modular.scrproduction.entity.ScrProduction;
import vip.xiaonuo.modular.scrworktask.entity.ScrWorkTask;
import vip.xiaonuo.sys.modular.user.entity.SysUser;
import vip.xiaonuo.sys.modular.user.enums.SysUserExceptionEnum;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
/**
@ -59,14 +65,14 @@ public class ScrHideDataServiceImpl extends ServiceImpl<ScrHideDataMapper, ScrHi
public PageResult<ScrHideData> page(ScrHideDataParam scrHideDataParam) {
QueryWrapper<ScrHideData> queryWrapper = new QueryWrapper<>();
if (ObjectUtil.isNotNull(scrHideDataParam)) {
// 根据年份 查询
if (ObjectUtil.isNotEmpty(scrHideDataParam.getYear())) {
queryWrapper.lambda().eq(ScrHideData::getYear, scrHideDataParam.getYear());
// 根据日期 查询
if (ObjectUtil.isNotEmpty(scrHideDataParam.getHappenTime())) {
LocalDate happenTime = LocalDate.parse(scrHideDataParam.getHappenTime());
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());
if (ObjectUtil.isNotEmpty(scrHideDataParam.getWorkPlace())) {
queryWrapper.lambda().eq(ScrHideData::getWorkPlace, scrHideDataParam.getWorkPlace());
}
}
return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
@ -74,16 +80,44 @@ public class ScrHideDataServiceImpl extends ServiceImpl<ScrHideDataMapper, ScrHi
@Override
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
public void add(ScrHideDataParam scrHideDataParam) {
checkParam(scrHideDataParam, false);
ScrHideData scrHideData = new ScrHideData();
BeanUtil.copyProperties(scrHideDataParam, 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());
queryWrapper.eq(ScrHideData::getWorkPlace, scrHideDataParam.getWorkPlace());
//是否排除自己如果是则查询条件排除自己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)
@Override
public void delete(List<ScrHideDataParam> scrHideDataParamList) {
@ -95,6 +129,7 @@ public class ScrHideDataServiceImpl extends ServiceImpl<ScrHideDataMapper, ScrHi
@Transactional(rollbackFor = Exception.class)
@Override
public void edit(ScrHideDataParam scrHideDataParam) {
checkParam(scrHideDataParam, true);
ScrHideData scrHideData = this.queryScrHideData(scrHideDataParam);
BeanUtil.copyProperties(scrHideDataParam, scrHideData);
this.updateById(scrHideData);
@ -122,7 +157,7 @@ public class ScrHideDataServiceImpl extends ServiceImpl<ScrHideDataMapper, ScrHi
@Override
public void export(ScrHideDataParam scrHideDataParam) {
List<ScrHideData> list = this.list(scrHideDataParam);
PoiUtil.exportExcelWithStream("SnowyScrHideData.xls", ScrHideData.class, list);
PoiUtil.exportExcelWithStream("隐患排查治理.xls", ScrHideData.class, list);
}
}

View File

@ -57,7 +57,6 @@ public class ScrMeterDataController {
* @author 2
* @date 2025-10-13 17:55:42
*/
@Permission
@GetMapping("/scrMeterData/page")
@BusinessLog(title = "电表_查询", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData page(ScrMeterDataParam scrMeterDataParam) {
@ -70,7 +69,6 @@ public class ScrMeterDataController {
* @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) {
@ -84,7 +82,6 @@ public class ScrMeterDataController {
* @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<ScrMeterDataParam> scrMeterDataParamList) {
@ -98,7 +95,6 @@ public class ScrMeterDataController {
* @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) {
@ -112,7 +108,6 @@ public class ScrMeterDataController {
* @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) {
@ -125,7 +120,6 @@ public class ScrMeterDataController {
* @author 2
* @date 2025-10-13 17:55:42
*/
@Permission
@GetMapping("/scrMeterData/list")
@BusinessLog(title = "电表_列表", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData list(ScrMeterDataParam scrMeterDataParam) {
@ -138,7 +132,6 @@ public class ScrMeterDataController {
* @author 2
* @date 2025-10-13 17:55:42
*/
@Permission
@GetMapping("/scrMeterData/export")
@BusinessLog(title = "电表_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
public void export(ScrMeterDataParam scrMeterDataParam) {

View File

@ -57,16 +57,10 @@ public class ScrMeterData extends BaseEntity {
private String name;
/**
* 年份
* 日期
*/
@Excel(name = "年份")
private Integer year;
/**
* 月份
*/
@Excel(name = "月份")
private Integer month;
@Excel(name = "日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
private Date happenTime;
/**
* 累计电量

View File

@ -54,16 +54,10 @@ public class ScrMeterDataParam extends BaseParam {
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 = "日期不能为空请检查happenTime参数", groups = {add.class, edit.class})
private String happenTime;
/**
* 累计电量
@ -76,5 +70,6 @@ public class ScrMeterDataParam extends BaseParam {
*/
@NotNull(message = "平均功率不能为空请检查avgPower参数", groups = {add.class, edit.class})
private BigDecimal avgPower;
private Integer year;
private Integer month;
}

View File

@ -36,6 +36,9 @@ 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.param.ScrHideDataParam;
import vip.xiaonuo.modular.scrmeterdata.entity.ScrMeterData;
import vip.xiaonuo.modular.scrmeterdata.enums.ScrMeterDataExceptionEnum;
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.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
/**
@ -64,13 +68,11 @@ public class ScrMeterDataServiceImpl extends ServiceImpl<ScrMeterDataMapper, Scr
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());
// 根据日期 查询
if (ObjectUtil.isNotEmpty(scrMeterDataParam.getHappenTime())) {
LocalDate happenTime = LocalDate.parse(scrMeterDataParam.getHappenTime());
queryWrapper.apply("YEAR(happen_time) = {0}", happenTime.getYear());
queryWrapper.apply("MONTH(happen_time) = {0}", happenTime.getMonthValue());
}
}
return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
@ -78,16 +80,48 @@ public class ScrMeterDataServiceImpl extends ServiceImpl<ScrMeterDataMapper, Scr
@Override
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
public void add(ScrMeterDataParam scrMeterDataParam) {
checkParam(scrMeterDataParam, false);
ScrMeterData scrMeterData = new ScrMeterData();
BeanUtil.copyProperties(scrMeterDataParam, 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)
@Override
public void delete(List<ScrMeterDataParam> scrMeterDataParamList) {
@ -99,6 +133,7 @@ public class ScrMeterDataServiceImpl extends ServiceImpl<ScrMeterDataMapper, Scr
@Transactional(rollbackFor = Exception.class)
@Override
public void edit(ScrMeterDataParam scrMeterDataParam) {
checkParam(scrMeterDataParam, true);
ScrMeterData scrMeterData = this.queryScrMeterData(scrMeterDataParam);
BeanUtil.copyProperties(scrMeterDataParam, scrMeterData);
this.updateById(scrMeterData);

View File

@ -57,7 +57,6 @@ public class ScrProductionController {
* @author zyn
* @date 2025-09-10 10:03:01
*/
@Permission
@GetMapping("/scrProduction/page")
@BusinessLog(title = "产量_查询", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData page(ScrProductionParam scrProductionParam) {
@ -70,7 +69,6 @@ public class ScrProductionController {
* @author zyn
* @date 2025-09-10 10:03:01
*/
@Permission
@PostMapping("/scrProduction/add")
@BusinessLog(title = "产量_增加", opType = LogAnnotionOpTypeEnum.ADD)
public ResponseData add(@RequestBody @Validated(ScrProductionParam.add.class) ScrProductionParam scrProductionParam) {
@ -84,7 +82,6 @@ public class ScrProductionController {
* @author zyn
* @date 2025-09-10 10:03:01
*/
@Permission
@PostMapping("/scrProduction/delete")
@BusinessLog(title = "产量_删除", opType = LogAnnotionOpTypeEnum.DELETE)
public ResponseData delete(@RequestBody @Validated(ScrProductionParam.delete.class) List<ScrProductionParam> scrProductionParamList) {
@ -98,7 +95,6 @@ public class ScrProductionController {
* @author zyn
* @date 2025-09-10 10:03:01
*/
@Permission
@PostMapping("/scrProduction/edit")
@BusinessLog(title = "产量_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
public ResponseData edit(@RequestBody @Validated(ScrProductionParam.edit.class) ScrProductionParam scrProductionParam) {
@ -112,7 +108,6 @@ public class ScrProductionController {
* @author zyn
* @date 2025-09-10 10:03:01
*/
@Permission
@GetMapping("/scrProduction/detail")
@BusinessLog(title = "产量_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
public ResponseData detail(@Validated(ScrProductionParam.detail.class) ScrProductionParam scrProductionParam) {
@ -125,7 +120,6 @@ public class ScrProductionController {
* @author zyn
* @date 2025-09-10 10:03:01
*/
@Permission
@GetMapping("/scrProduction/list")
@BusinessLog(title = "产量_列表", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData list(ScrProductionParam scrProductionParam) {
@ -138,7 +132,6 @@ public class ScrProductionController {
* @author zyn
* @date 2025-09-10 10:03:01
*/
@Permission
@GetMapping("/scrProduction/export")
@BusinessLog(title = "产量_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
public void export(ScrProductionParam scrProductionParam) {

View File

@ -57,7 +57,6 @@ public class ScrRawMaterialsController {
* @author zyn
* @date 2025-09-10 10:03:02
*/
@Permission
@GetMapping("/scrRawMaterials/page")
@BusinessLog(title = "原材料_查询", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData page(ScrRawMaterialsParam scrRawMaterialsParam) {
@ -70,7 +69,6 @@ public class ScrRawMaterialsController {
* @author zyn
* @date 2025-09-10 10:03:02
*/
@Permission
@PostMapping("/scrRawMaterials/add")
@BusinessLog(title = "原材料_增加", opType = LogAnnotionOpTypeEnum.ADD)
public ResponseData add(@RequestBody @Validated(ScrRawMaterialsParam.add.class) ScrRawMaterialsParam scrRawMaterialsParam) {
@ -84,7 +82,6 @@ public class ScrRawMaterialsController {
* @author zyn
* @date 2025-09-10 10:03:02
*/
@Permission
@PostMapping("/scrRawMaterials/delete")
@BusinessLog(title = "原材料_删除", opType = LogAnnotionOpTypeEnum.DELETE)
public ResponseData delete(@RequestBody @Validated(ScrRawMaterialsParam.delete.class) List<ScrRawMaterialsParam> scrRawMaterialsParamList) {
@ -98,7 +95,6 @@ public class ScrRawMaterialsController {
* @author zyn
* @date 2025-09-10 10:03:02
*/
@Permission
@PostMapping("/scrRawMaterials/edit")
@BusinessLog(title = "原材料_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
public ResponseData edit(@RequestBody @Validated(ScrRawMaterialsParam.edit.class) ScrRawMaterialsParam scrRawMaterialsParam) {
@ -112,7 +108,6 @@ public class ScrRawMaterialsController {
* @author zyn
* @date 2025-09-10 10:03:02
*/
@Permission
@GetMapping("/scrRawMaterials/detail")
@BusinessLog(title = "原材料_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
public ResponseData detail(@Validated(ScrRawMaterialsParam.detail.class) ScrRawMaterialsParam scrRawMaterialsParam) {
@ -125,7 +120,6 @@ public class ScrRawMaterialsController {
* @author zyn
* @date 2025-09-10 10:03:02
*/
@Permission
@GetMapping("/scrRawMaterials/list")
@BusinessLog(title = "原材料_列表", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData list(ScrRawMaterialsParam scrRawMaterialsParam) {
@ -138,7 +132,6 @@ public class ScrRawMaterialsController {
* @author zyn
* @date 2025-09-10 10:03:02
*/
@Permission
@GetMapping("/scrRawMaterials/export")
@BusinessLog(title = "原材料_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
public void export(ScrRawMaterialsParam scrRawMaterialsParam) {

View File

@ -57,7 +57,6 @@ public class ScrRiskDataController {
* @author 1
* @date 2025-10-13 17:08:52
*/
@Permission
@GetMapping("/scrRiskData/page")
@BusinessLog(title = "风险排查_查询", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData page(ScrRiskDataParam scrRiskDataParam) {
@ -70,7 +69,6 @@ public class ScrRiskDataController {
* @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) {
@ -84,7 +82,6 @@ public class ScrRiskDataController {
* @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<ScrRiskDataParam> scrRiskDataParamList) {
@ -98,7 +95,7 @@ public class ScrRiskDataController {
* @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) {
@ -112,7 +109,6 @@ public class ScrRiskDataController {
* @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) {
@ -125,7 +121,6 @@ public class ScrRiskDataController {
* @author 1
* @date 2025-10-13 17:08:52
*/
@Permission
@GetMapping("/scrRiskData/list")
@BusinessLog(title = "风险排查_列表", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData list(ScrRiskDataParam scrRiskDataParam) {
@ -138,7 +133,6 @@ public class ScrRiskDataController {
* @author 1
* @date 2025-10-13 17:08:52
*/
@Permission
@GetMapping("/scrRiskData/export")
@BusinessLog(title = "风险排查_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
public void export(ScrRiskDataParam scrRiskDataParam) {

View File

@ -49,16 +49,10 @@ public class ScrRiskData extends BaseEntity {
private Long id;
/**
* 年份
* 日期
*/
@Excel(name = "年份")
private Integer year;
/**
* 月份
*/
@Excel(name = "月份")
private Integer month;
@Excel(name = "日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
private Date happenTime;
/**
* 已排查

View File

@ -46,16 +46,10 @@ public class ScrRiskDataParam extends BaseParam {
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 = "日期不能为空请检查happenTime参数", groups = {add.class, edit.class})
private String happenTime;
/**
* 已排查
@ -74,5 +68,6 @@ public class ScrRiskDataParam extends BaseParam {
*/
@NotNull(message = "超期未排查不能为空请检查cqwpc参数", groups = {add.class, edit.class})
private Integer cqwpc;
private Integer year;
private Integer month;
}

View File

@ -36,6 +36,9 @@ 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.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.enums.ScrRiskDataExceptionEnum;
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.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
/**
@ -60,13 +64,11 @@ public class ScrRiskDataServiceImpl extends ServiceImpl<ScrRiskDataMapper, ScrRi
QueryWrapper<ScrRiskData> 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());
// 根据日期 查询
if (ObjectUtil.isNotEmpty(scrRiskDataParam.getHappenTime())) {
LocalDate happenTime = LocalDate.parse(scrRiskDataParam.getHappenTime());
queryWrapper.apply("YEAR(happen_time) = {0}", happenTime.getYear());
queryWrapper.apply("MONTH(happen_time) = {0}", happenTime.getMonthValue());
}
}
return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
@ -74,16 +76,42 @@ public class ScrRiskDataServiceImpl extends ServiceImpl<ScrRiskDataMapper, ScrRi
@Override
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
public void add(ScrRiskDataParam scrRiskDataParam) {
checkParam(scrRiskDataParam, false);
ScrRiskData scrRiskData = new ScrRiskData();
BeanUtil.copyProperties(scrRiskDataParam, 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)
@Override
public void delete(List<ScrRiskDataParam> scrRiskDataParamList) {
@ -95,6 +123,7 @@ public class ScrRiskDataServiceImpl extends ServiceImpl<ScrRiskDataMapper, ScrRi
@Transactional(rollbackFor = Exception.class)
@Override
public void edit(ScrRiskDataParam scrRiskDataParam) {
checkParam(scrRiskDataParam, true);
ScrRiskData scrRiskData = this.queryScrRiskData(scrRiskDataParam);
BeanUtil.copyProperties(scrRiskDataParam, scrRiskData);
this.updateById(scrRiskData);

View File

@ -58,7 +58,6 @@ public class ScrSecurityController {
* @author zyn
* @date 2025-09-10 10:03:04
*/
@Permission
@GetMapping("/scrSecurity/page")
@BusinessLog(title = "安全异常事件_查询", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData page(ScrSecurityParam scrSecurityParam) {
@ -71,7 +70,6 @@ public class ScrSecurityController {
* @author zyn
* @date 2025-09-10 10:03:04
*/
@Permission
@PostMapping("/scrSecurity/add")
@BusinessLog(title = "安全异常事件_增加", opType = LogAnnotionOpTypeEnum.ADD)
public ResponseData add(@RequestBody @Validated(ScrSecurityParam.add.class) ScrSecurityParam scrSecurityParam) {
@ -85,7 +83,6 @@ public class ScrSecurityController {
* @author zyn
* @date 2025-09-10 10:03:04
*/
@Permission
@PostMapping("/scrSecurity/delete")
@BusinessLog(title = "安全异常事件_删除", opType = LogAnnotionOpTypeEnum.DELETE)
public ResponseData delete(@RequestBody @Validated(ScrSecurityParam.delete.class) List<ScrSecurityParam> scrSecurityParamList) {
@ -99,7 +96,6 @@ public class ScrSecurityController {
* @author zyn
* @date 2025-09-10 10:03:04
*/
@Permission
@PostMapping("/scrSecurity/edit")
@BusinessLog(title = "安全异常事件_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
public ResponseData edit(@RequestBody @Validated(ScrSecurityParam.edit.class) ScrSecurityParam scrSecurityParam) {
@ -113,7 +109,6 @@ public class ScrSecurityController {
* @author zyn
* @date 2025-09-10 10:03:04
*/
@Permission
@GetMapping("/scrSecurity/detail")
@BusinessLog(title = "安全异常事件_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
public ResponseData detail(@Validated(ScrSecurityParam.detail.class) ScrSecurityParam scrSecurityParam) {
@ -126,7 +121,6 @@ public class ScrSecurityController {
* @author zyn
* @date 2025-09-10 10:03:04
*/
@Permission
@GetMapping("/scrSecurity/list")
@BusinessLog(title = "安全异常事件_列表", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData list(ScrSecurityParam scrSecurityParam) {
@ -139,7 +133,6 @@ public class ScrSecurityController {
* @author zyn
* @date 2025-09-10 10:03:04
*/
@Permission
@GetMapping("/scrSecurity/export")
@BusinessLog(title = "安全异常事件_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
public void export(ScrSecurityParam scrSecurityParam) {

View File

@ -63,7 +63,7 @@ public class ScrSecurityServiceImpl extends ServiceImpl<ScrSecurityMapper, ScrSe
// 根据发生时间 查询
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())) {

View File

@ -0,0 +1,141 @@
/*
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.scrtraindata.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.scrtraindata.param.ScrTrainDataParam;
import vip.xiaonuo.modular.scrtraindata.service.ScrTrainDataService;
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-17 19:55:20
*/
@RestController
public class ScrTrainDataController {
@Resource
private ScrTrainDataService scrTrainDataService;
/**
* 查询培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@GetMapping("/scrTrainData/page")
@BusinessLog(title = "培训_查询", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData page(ScrTrainDataParam scrTrainDataParam) {
return new SuccessResponseData(scrTrainDataService.page(scrTrainDataParam));
}
/**
* 添加培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@PostMapping("/scrTrainData/add")
@BusinessLog(title = "培训_增加", opType = LogAnnotionOpTypeEnum.ADD)
public ResponseData add(@RequestBody @Validated(ScrTrainDataParam.add.class) ScrTrainDataParam scrTrainDataParam) {
scrTrainDataService.add(scrTrainDataParam);
return new SuccessResponseData();
}
/**
* 删除培训可批量删除
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@PostMapping("/scrTrainData/delete")
@BusinessLog(title = "培训_删除", opType = LogAnnotionOpTypeEnum.DELETE)
public ResponseData delete(@RequestBody @Validated(ScrTrainDataParam.delete.class) List<ScrTrainDataParam> scrTrainDataParamList) {
scrTrainDataService.delete(scrTrainDataParamList);
return new SuccessResponseData();
}
/**
* 编辑培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@PostMapping("/scrTrainData/edit")
@BusinessLog(title = "培训_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
public ResponseData edit(@RequestBody @Validated(ScrTrainDataParam.edit.class) ScrTrainDataParam scrTrainDataParam) {
scrTrainDataService.edit(scrTrainDataParam);
return new SuccessResponseData();
}
/**
* 查看培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@GetMapping("/scrTrainData/detail")
@BusinessLog(title = "培训_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
public ResponseData detail(@Validated(ScrTrainDataParam.detail.class) ScrTrainDataParam scrTrainDataParam) {
return new SuccessResponseData(scrTrainDataService.detail(scrTrainDataParam));
}
/**
* 培训列表
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@GetMapping("/scrTrainData/list")
@BusinessLog(title = "培训_列表", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData list(ScrTrainDataParam scrTrainDataParam) {
return new SuccessResponseData(scrTrainDataService.list(scrTrainDataParam));
}
/**
* 导出系统用户
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@GetMapping("/scrTrainData/export")
@BusinessLog(title = "培训_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
public void export(ScrTrainDataParam scrTrainDataParam) {
scrTrainDataService.export(scrTrainDataParam);
}
}

View File

@ -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.scrtraindata.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-17 19:55:20
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("scr_train_data")
public class ScrTrainData extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 培训类型
*/
@Excel(name = "培训类型")
private String type;
/**
* 数量
*/
@Excel(name = "数量")
private Integer num;
/**
* 内部还是外部
*/
@Excel(name = "内部还是外部")
private Integer nborwb;
/**
* 日期
*/
@Excel(name = "日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
private Date happenTime;
/**
* 部门
*/
@Excel(name = "部门")
private String workPlace;
}

View File

@ -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.scrtraindata.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-17 19:55:20
*/
@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
public enum ScrTrainDataExceptionEnum implements AbstractBaseExceptionEnum {
/**
* 数据不存在
*/
NOT_EXIST(1, "此数据不存在");
private final Integer code;
private final String message;
ScrTrainDataExceptionEnum(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;
}
}

View File

@ -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.scrtraindata.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import vip.xiaonuo.modular.scrtraindata.entity.ScrTrainData;
/**
* 培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
public interface ScrTrainDataMapper extends BaseMapper<ScrTrainData> {
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="vip.xiaonuo.modular.scrtraindata.mapper.ScrTrainDataMapper">
</mapper>

View File

@ -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.scrtraindata.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-17 19:55:20
*/
@Data
public class ScrTrainDataParam extends BaseParam {
/**
* 主键
*/
@NotNull(message = "主键不能为空请检查id参数", groups = {edit.class, delete.class, detail.class})
private Long id;
/**
* 培训类型
*/
@NotBlank(message = "培训类型不能为空请检查type参数", groups = {add.class, edit.class})
private String type;
/**
* 数量
*/
@NotNull(message = "数量不能为空请检查num参数", groups = {add.class, edit.class})
private Integer num;
/**
* 内部还是外部
*/
@NotNull(message = "内部还是外部不能为空请检查nborwb参数", groups = {add.class, edit.class})
private Integer nborwb;
/**
* 日期
*/
@NotNull(message = "日期不能为空请检查happenTime参数", groups = {add.class, edit.class})
private String happenTime;
/**
* 部门
*/
@NotBlank(message = "部门不能为空请检查workPlace参数", groups = {add.class, edit.class})
private String workPlace;
private Integer year;
private Integer month;
}

View File

@ -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.scrtraindata.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.modular.scrtraindata.entity.ScrTrainData;
import vip.xiaonuo.modular.scrtraindata.param.ScrTrainDataParam;
import java.util.List;
/**
* 培训service接口
*
* @author 1
* @date 2025-10-17 19:55:20
*/
public interface ScrTrainDataService extends IService<ScrTrainData> {
/**
* 查询培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
PageResult<ScrTrainData> page(ScrTrainDataParam scrTrainDataParam);
/**
* 培训列表
*
* @author 1
* @date 2025-10-17 19:55:20
*/
List<ScrTrainData> list(ScrTrainDataParam scrTrainDataParam);
/**
* 添加培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
void add(ScrTrainDataParam scrTrainDataParam);
/**
* 删除培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
void delete(List<ScrTrainDataParam> scrTrainDataParamList);
/**
* 编辑培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
void edit(ScrTrainDataParam scrTrainDataParam);
/**
* 查看培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
ScrTrainData detail(ScrTrainDataParam scrTrainDataParam);
/**
* 导出培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
void export(ScrTrainDataParam scrTrainDataParam);
}

View File

@ -0,0 +1,155 @@
/*
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.scrtraindata.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.scrtraindata.entity.ScrTrainData;
import vip.xiaonuo.modular.scrtraindata.enums.ScrTrainDataExceptionEnum;
import vip.xiaonuo.modular.scrtraindata.mapper.ScrTrainDataMapper;
import vip.xiaonuo.modular.scrtraindata.param.ScrTrainDataParam;
import vip.xiaonuo.modular.scrtraindata.service.ScrTrainDataService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
/**
* 培训service接口实现类
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@Service
public class ScrTrainDataServiceImpl extends ServiceImpl<ScrTrainDataMapper, ScrTrainData> implements ScrTrainDataService {
@Override
public PageResult<ScrTrainData> page(ScrTrainDataParam scrTrainDataParam) {
QueryWrapper<ScrTrainData> queryWrapper = new QueryWrapper<>();
if (ObjectUtil.isNotNull(scrTrainDataParam)) {
// 根据培训类型 查询
if (ObjectUtil.isNotEmpty(scrTrainDataParam.getType())) {
queryWrapper.lambda().like(ScrTrainData::getType, scrTrainDataParam.getType());
}
// 根据数量 查询
if (ObjectUtil.isNotEmpty(scrTrainDataParam.getNum())) {
queryWrapper.lambda().eq(ScrTrainData::getNum, scrTrainDataParam.getNum());
}
// 根据日期 查询
if (ObjectUtil.isNotEmpty(scrTrainDataParam.getHappenTime())) {
LocalDate happenTime = LocalDate.parse(scrTrainDataParam.getHappenTime());
queryWrapper.apply("YEAR(happen_time) = {0}", happenTime.getYear());
queryWrapper.apply("MONTH(happen_time) = {0}", happenTime.getMonthValue());
}
// 根据部门 查询
if (ObjectUtil.isNotEmpty(scrTrainDataParam.getWorkPlace())) {
queryWrapper.lambda().like(ScrTrainData::getWorkPlace, scrTrainDataParam.getWorkPlace());
}
}
return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
}
@Override
public List<ScrTrainData> list(ScrTrainDataParam scrTrainDataParam) {
QueryWrapper<ScrTrainData> queryWrapper = new QueryWrapper<>();
if (ObjectUtil.isNotNull(scrTrainDataParam)) {
if (ObjectUtil.isNotEmpty(scrTrainDataParam.getType())) {
queryWrapper.lambda().eq(ScrTrainData::getType, scrTrainDataParam.getType());
}
if (ObjectUtil.isNotEmpty(scrTrainDataParam.getWorkPlace())) {
queryWrapper.lambda().eq(ScrTrainData::getWorkPlace, scrTrainDataParam.getWorkPlace());
}
if (ObjectUtil.isNotEmpty(scrTrainDataParam.getYear()) && ObjectUtil.isNotEmpty(scrTrainDataParam.getMonth())) {
queryWrapper.apply("YEAR(happen_time) = {0}", scrTrainDataParam.getYear());
queryWrapper.apply("Month(happen_time) = {0}", scrTrainDataParam.getMonth());
} else if (ObjectUtil.isNotEmpty(scrTrainDataParam.getYear())) {
queryWrapper.apply("YEAR(happen_time) = {0}", scrTrainDataParam.getYear());
}
}
return this.list(queryWrapper);
}
@Override
public void add(ScrTrainDataParam scrTrainDataParam) {
ScrTrainData scrTrainData = new ScrTrainData();
BeanUtil.copyProperties(scrTrainDataParam, scrTrainData);
this.save(scrTrainData);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void delete(List<ScrTrainDataParam> scrTrainDataParamList) {
scrTrainDataParamList.forEach(scrTrainDataParam -> {
this.removeById(scrTrainDataParam.getId());
});
}
@Transactional(rollbackFor = Exception.class)
@Override
public void edit(ScrTrainDataParam scrTrainDataParam) {
ScrTrainData scrTrainData = this.queryScrTrainData(scrTrainDataParam);
BeanUtil.copyProperties(scrTrainDataParam, scrTrainData);
this.updateById(scrTrainData);
}
@Override
public ScrTrainData detail(ScrTrainDataParam scrTrainDataParam) {
return this.queryScrTrainData(scrTrainDataParam);
}
/**
* 获取培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
private ScrTrainData queryScrTrainData(ScrTrainDataParam scrTrainDataParam) {
ScrTrainData scrTrainData = this.getById(scrTrainDataParam.getId());
if (ObjectUtil.isNull(scrTrainData)) {
throw new ServiceException(ScrTrainDataExceptionEnum.NOT_EXIST);
}
return scrTrainData;
}
@Override
public void export(ScrTrainDataParam scrTrainDataParam) {
List<ScrTrainData> list = this.list(scrTrainDataParam);
PoiUtil.exportExcelWithStream("SnowyScrTrainData.xls", ScrTrainData.class, list);
}
}

View File

@ -0,0 +1,141 @@
/*
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.scrtrainsche.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.scrtrainsche.param.ScrTrainScheParam;
import vip.xiaonuo.modular.scrtrainsche.service.ScrTrainScheService;
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-17 20:13:05
*/
@RestController
public class ScrTrainScheController {
@Resource
private ScrTrainScheService scrTrainScheService;
/**
* 查询培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@GetMapping("/scrTrainSche/page")
@BusinessLog(title = "培训安排_查询", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData page(ScrTrainScheParam scrTrainScheParam) {
return new SuccessResponseData(scrTrainScheService.page(scrTrainScheParam));
}
/**
* 添加培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@PostMapping("/scrTrainSche/add")
@BusinessLog(title = "培训安排_增加", opType = LogAnnotionOpTypeEnum.ADD)
public ResponseData add(@RequestBody @Validated(ScrTrainScheParam.add.class) ScrTrainScheParam scrTrainScheParam) {
scrTrainScheService.add(scrTrainScheParam);
return new SuccessResponseData();
}
/**
* 删除培训安排可批量删除
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@PostMapping("/scrTrainSche/delete")
@BusinessLog(title = "培训安排_删除", opType = LogAnnotionOpTypeEnum.DELETE)
public ResponseData delete(@RequestBody @Validated(ScrTrainScheParam.delete.class) List<ScrTrainScheParam> scrTrainScheParamList) {
scrTrainScheService.delete(scrTrainScheParamList);
return new SuccessResponseData();
}
/**
* 编辑培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@PostMapping("/scrTrainSche/edit")
@BusinessLog(title = "培训安排_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
public ResponseData edit(@RequestBody @Validated(ScrTrainScheParam.edit.class) ScrTrainScheParam scrTrainScheParam) {
scrTrainScheService.edit(scrTrainScheParam);
return new SuccessResponseData();
}
/**
* 查看培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@GetMapping("/scrTrainSche/detail")
@BusinessLog(title = "培训安排_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
public ResponseData detail(@Validated(ScrTrainScheParam.detail.class) ScrTrainScheParam scrTrainScheParam) {
return new SuccessResponseData(scrTrainScheService.detail(scrTrainScheParam));
}
/**
* 培训安排列表
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@GetMapping("/scrTrainSche/list")
@BusinessLog(title = "培训安排_列表", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData list(ScrTrainScheParam scrTrainScheParam) {
return new SuccessResponseData(scrTrainScheService.list(scrTrainScheParam));
}
/**
* 导出系统用户
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@GetMapping("/scrTrainSche/export")
@BusinessLog(title = "培训安排_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
public void export(ScrTrainScheParam scrTrainScheParam) {
scrTrainScheService.export(scrTrainScheParam);
}
}

View File

@ -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.scrtrainsche.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-17 20:13:05
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("scr_train_sche")
public class ScrTrainSche extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 培训计划
*/
@Excel(name = "培训计划")
private String name;
/**
* 线上培训
*/
@Excel(name = "线上培训")
private String uppx;
/**
* 线下培训
*/
@Excel(name = "线下培训")
private String downpx;
/**
* 日期
*/
@Excel(name = "日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
private Date happenTime;
/**
* 在线考试
*/
@Excel(name = "在线考试")
private String workPlace;
}

View File

@ -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.scrtrainsche.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-17 20:13:05
*/
@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
public enum ScrTrainScheExceptionEnum implements AbstractBaseExceptionEnum {
/**
* 数据不存在
*/
NOT_EXIST(1, "此数据不存在");
private final Integer code;
private final String message;
ScrTrainScheExceptionEnum(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;
}
}

View File

@ -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.scrtrainsche.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import vip.xiaonuo.modular.scrtrainsche.entity.ScrTrainSche;
/**
* 培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
public interface ScrTrainScheMapper extends BaseMapper<ScrTrainSche> {
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="vip.xiaonuo.modular.scrtrainsche.mapper.ScrTrainScheMapper">
</mapper>

View File

@ -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.scrtrainsche.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-17 20:13:05
*/
@Data
public class ScrTrainScheParam 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;
/**
* 线上培训
*/
@NotBlank(message = "线上培训不能为空请检查uppx参数", groups = {add.class, edit.class})
private String uppx;
/**
* 线下培训
*/
@NotBlank(message = "线下培训不能为空请检查downpx参数", groups = {add.class, edit.class})
private String downpx;
/**
* 日期
*/
@NotNull(message = "日期不能为空请检查happenTime参数", groups = {add.class, edit.class})
private String happenTime;
/**
* 在线考试
*/
@NotBlank(message = "在线考试不能为空请检查workPlace参数", groups = {add.class, edit.class})
private String workPlace;
private Integer year;
private Integer month;
}

View File

@ -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.scrtrainsche.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.modular.scrtrainsche.entity.ScrTrainSche;
import vip.xiaonuo.modular.scrtrainsche.param.ScrTrainScheParam;
import java.util.List;
/**
* 培训安排service接口
*
* @author 1
* @date 2025-10-17 20:13:05
*/
public interface ScrTrainScheService extends IService<ScrTrainSche> {
/**
* 查询培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
PageResult<ScrTrainSche> page(ScrTrainScheParam scrTrainScheParam);
/**
* 培训安排列表
*
* @author 1
* @date 2025-10-17 20:13:05
*/
List<ScrTrainSche> list(ScrTrainScheParam scrTrainScheParam);
/**
* 添加培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
void add(ScrTrainScheParam scrTrainScheParam);
/**
* 删除培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
void delete(List<ScrTrainScheParam> scrTrainScheParamList);
/**
* 编辑培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
void edit(ScrTrainScheParam scrTrainScheParam);
/**
* 查看培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
ScrTrainSche detail(ScrTrainScheParam scrTrainScheParam);
/**
* 导出培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
void export(ScrTrainScheParam scrTrainScheParam);
}

View File

@ -0,0 +1,141 @@
/*
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.scrtrainsche.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.scrtrainsche.entity.ScrTrainSche;
import vip.xiaonuo.modular.scrtrainsche.enums.ScrTrainScheExceptionEnum;
import vip.xiaonuo.modular.scrtrainsche.mapper.ScrTrainScheMapper;
import vip.xiaonuo.modular.scrtrainsche.param.ScrTrainScheParam;
import vip.xiaonuo.modular.scrtrainsche.service.ScrTrainScheService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
/**
* 培训安排service接口实现类
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@Service
public class ScrTrainScheServiceImpl extends ServiceImpl<ScrTrainScheMapper, ScrTrainSche> implements ScrTrainScheService {
@Override
public PageResult<ScrTrainSche> page(ScrTrainScheParam scrTrainScheParam) {
QueryWrapper<ScrTrainSche> queryWrapper = new QueryWrapper<>();
if (ObjectUtil.isNotNull(scrTrainScheParam)) {
// 根据培训计划 查询
if (ObjectUtil.isNotEmpty(scrTrainScheParam.getName())) {
queryWrapper.lambda().like(ScrTrainSche::getName, scrTrainScheParam.getName());
}
// 根据日期 查询
if (ObjectUtil.isNotEmpty(scrTrainScheParam.getHappenTime())) {
LocalDate happenTime = LocalDate.parse(scrTrainScheParam.getHappenTime());
queryWrapper.apply("YEAR(happen_time) = {0}", happenTime.getYear());
queryWrapper.apply("MONTH(happen_time) = {0}", happenTime.getMonthValue());
}
}
return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
}
@Override
public List<ScrTrainSche> list(ScrTrainScheParam scrTrainScheParam) {
QueryWrapper<ScrTrainSche> queryWrapper = new QueryWrapper<>();
if (ObjectUtil.isNotNull(scrTrainScheParam)) {
if (ObjectUtil.isNotEmpty(scrTrainScheParam.getYear()) && ObjectUtil.isNotEmpty(scrTrainScheParam.getMonth())) {
queryWrapper.apply("YEAR(happen_time) = {0}", scrTrainScheParam.getYear());
queryWrapper.apply("Month(happen_time) = {0}", scrTrainScheParam.getMonth());
} else if (ObjectUtil.isNotEmpty(scrTrainScheParam.getYear())) {
queryWrapper.apply("YEAR(happen_time) = {0}", scrTrainScheParam.getYear());
}
}
return this.list(queryWrapper);
}
@Override
public void add(ScrTrainScheParam scrTrainScheParam) {
ScrTrainSche scrTrainSche = new ScrTrainSche();
BeanUtil.copyProperties(scrTrainScheParam, scrTrainSche);
this.save(scrTrainSche);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void delete(List<ScrTrainScheParam> scrTrainScheParamList) {
scrTrainScheParamList.forEach(scrTrainScheParam -> {
this.removeById(scrTrainScheParam.getId());
});
}
@Transactional(rollbackFor = Exception.class)
@Override
public void edit(ScrTrainScheParam scrTrainScheParam) {
ScrTrainSche scrTrainSche = this.queryScrTrainSche(scrTrainScheParam);
BeanUtil.copyProperties(scrTrainScheParam, scrTrainSche);
this.updateById(scrTrainSche);
}
@Override
public ScrTrainSche detail(ScrTrainScheParam scrTrainScheParam) {
return this.queryScrTrainSche(scrTrainScheParam);
}
/**
* 获取培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
private ScrTrainSche queryScrTrainSche(ScrTrainScheParam scrTrainScheParam) {
ScrTrainSche scrTrainSche = this.getById(scrTrainScheParam.getId());
if (ObjectUtil.isNull(scrTrainSche)) {
throw new ServiceException(ScrTrainScheExceptionEnum.NOT_EXIST);
}
return scrTrainSche;
}
@Override
public void export(ScrTrainScheParam scrTrainScheParam) {
List<ScrTrainSche> list = this.list(scrTrainScheParam);
PoiUtil.exportExcelWithStream("SnowyScrTrainSche.xls", ScrTrainSche.class, list);
}
}

View File

@ -57,7 +57,6 @@ public class ScrWorkTaskController {
* @author 1
* @date 2025-10-13 17:49:44
*/
@Permission
@GetMapping("/scrWorkTask/page")
@BusinessLog(title = "作业票_查询", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData page(ScrWorkTaskParam scrWorkTaskParam) {
@ -70,7 +69,6 @@ public class ScrWorkTaskController {
* @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) {
@ -84,7 +82,6 @@ public class ScrWorkTaskController {
* @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<ScrWorkTaskParam> scrWorkTaskParamList) {
@ -98,7 +95,6 @@ public class ScrWorkTaskController {
* @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) {
@ -112,7 +108,6 @@ public class ScrWorkTaskController {
* @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) {
@ -125,7 +120,6 @@ public class ScrWorkTaskController {
* @author 1
* @date 2025-10-13 17:49:44
*/
@Permission
@GetMapping("/scrWorkTask/list")
@BusinessLog(title = "作业票_列表", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData list(ScrWorkTaskParam scrWorkTaskParam) {
@ -138,7 +132,6 @@ public class ScrWorkTaskController {
* @author 1
* @date 2025-10-13 17:49:44
*/
@Permission
@GetMapping("/scrWorkTask/export")
@BusinessLog(title = "作业票_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
public void export(ScrWorkTaskParam scrWorkTaskParam) {

View File

@ -49,22 +49,16 @@ public class ScrWorkTask extends BaseEntity {
private Long id;
/**
* 8大作业票
* 作业票
*/
@Excel(name = "8大作业票")
@Excel(name = "作业票")
private String name;
/**
*
* 日期
*/
@Excel(name = "")
private Integer year;
/**
* 月份
*/
@Excel(name = "月份")
private Integer month;
@Excel(name = "日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
private Date happenTime;
/**
* 数量
@ -72,4 +66,15 @@ public class ScrWorkTask extends BaseEntity {
@Excel(name = "数量")
private Integer totalNum;
/**
* 施工地点
*/
@Excel(name = "施工地点")
private String workPlace;
/**
* 级别
*/
@Excel(name = "级别")
private String level;
}

View File

@ -24,6 +24,7 @@ Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意
*/
package vip.xiaonuo.modular.scrworktask.param;
import cn.afterturn.easypoi.excel.annotation.Excel;
import vip.xiaonuo.core.pojo.base.param.BaseParam;
import lombok.Data;
import javax.validation.constraints.NotNull;
@ -46,22 +47,16 @@ public class ScrWorkTaskParam extends BaseParam {
private Long id;
/**
* 8大作业票
* 作业票
*/
@NotBlank(message = "8大作业票不能为空请检查name参数", groups = {add.class, edit.class})
@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 = "日期不能为空请检查happenTime参数", groups = {add.class, edit.class})
private String happenTime;
/**
* 数量
@ -69,4 +64,19 @@ public class ScrWorkTaskParam extends BaseParam {
@NotNull(message = "数量不能为空请检查totalNum参数", groups = {add.class, edit.class})
private Integer totalNum;
/**
* 施工地点
*/
@NotBlank(message = "施工地点不能为空请检查workPlace参数", groups = {add.class, edit.class})
private String workPlace;
/**
* 级别
*/
@NotBlank(message = "级别不能为空请检查level参数", groups = {add.class, edit.class})
@Excel(name = "级别")
private String level;
private Integer year;
private Integer month;
}

View File

@ -36,6 +36,9 @@ 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.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.enums.ScrWorkTaskExceptionEnum;
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.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
/**
@ -64,13 +68,17 @@ public class ScrWorkTaskServiceImpl extends ServiceImpl<ScrWorkTaskMapper, ScrWo
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.getHappenTime())) {
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());
if (ObjectUtil.isNotEmpty(scrWorkTaskParam.getWorkPlace())) {
queryWrapper.lambda().eq(ScrWorkTask::getWorkPlace, scrWorkTaskParam.getWorkPlace());
}
if (ObjectUtil.isNotEmpty(scrWorkTaskParam.getLevel())) {
queryWrapper.lambda().eq(ScrWorkTask::getLevel, scrWorkTaskParam.getLevel());
}
}
return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
@ -78,16 +86,56 @@ public class ScrWorkTaskServiceImpl extends ServiceImpl<ScrWorkTaskMapper, ScrWo
@Override
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());
}
if (ObjectUtil.isNotEmpty(scrWorkTaskParam.getWorkPlace())) {
queryWrapper.lambda().eq(ScrWorkTask::getWorkPlace, scrWorkTaskParam.getWorkPlace());
}
if (ObjectUtil.isNotEmpty(scrWorkTaskParam.getLevel())) {
queryWrapper.lambda().eq(ScrWorkTask::getLevel, scrWorkTaskParam.getLevel());
}
}
return this.list(queryWrapper);
}
@Override
public void add(ScrWorkTaskParam scrWorkTaskParam) {
checkParam(scrWorkTaskParam, false);
ScrWorkTask scrWorkTask = new ScrWorkTask();
BeanUtil.copyProperties(scrWorkTaskParam, 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());
queryWrapper.eq(ScrWorkTask::getWorkPlace, scrWorkTaskParam.getWorkPlace());
queryWrapper.eq(ScrWorkTask::getLevel, scrWorkTaskParam.getLevel());
//是否排除自己如果是则查询条件排除自己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)
@Override
public void delete(List<ScrWorkTaskParam> scrWorkTaskParamList) {
@ -99,6 +147,7 @@ public class ScrWorkTaskServiceImpl extends ServiceImpl<ScrWorkTaskMapper, ScrWo
@Transactional(rollbackFor = Exception.class)
@Override
public void edit(ScrWorkTaskParam scrWorkTaskParam) {
checkParam(scrWorkTaskParam, true);
ScrWorkTask scrWorkTask = this.queryScrWorkTask(scrWorkTaskParam);
BeanUtil.copyProperties(scrWorkTaskParam, scrWorkTask);
this.updateById(scrWorkTask);
@ -126,7 +175,7 @@ public class ScrWorkTaskServiceImpl extends ServiceImpl<ScrWorkTaskMapper, ScrWo
@Override
public void export(ScrWorkTaskParam scrWorkTaskParam) {
List<ScrWorkTask> list = this.list(scrWorkTaskParam);
PoiUtil.exportExcelWithStream("SnowyScrWorkTask.xls", ScrWorkTask.class, list);
PoiUtil.exportExcelWithStream("作业票.xls", ScrWorkTask.class, list);
}
}