liwen
10 months ago
19 changed files with 574 additions and 318 deletions
@ -0,0 +1,43 @@ |
|||||||
|
package com.hnac.hzims.safeproduct.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.core.mp.base.BaseEntity; |
||||||
|
|
||||||
|
import javax.validation.constraints.Size; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
@TableName("hzims_device_inspection") |
||||||
|
@ApiModel(value = "特种设备检验记录实体类") |
||||||
|
public class SpecialDeviceInspectionEntity extends BaseEntity { |
||||||
|
|
||||||
|
@ApiModelProperty("设备id") |
||||||
|
private Long deviceId; |
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd") |
||||||
|
@ApiModelProperty("检验时间") |
||||||
|
private Date inspectionTime; |
||||||
|
|
||||||
|
@Size(max = 255, message = "检验地点长度不能超过255") |
||||||
|
@ApiModelProperty("检验地点") |
||||||
|
private String location; |
||||||
|
|
||||||
|
@Size(max = 1000, message = "检验照片长度不能超过1000") |
||||||
|
@ApiModelProperty("检验照片") |
||||||
|
private String imgPath; |
||||||
|
|
||||||
|
@TableField(exist = false) |
||||||
|
@ApiModelProperty("下次检验时间") |
||||||
|
private Date nextInspectionTime; |
||||||
|
|
||||||
|
@TableField(exist = false) |
||||||
|
@ApiModelProperty("上次检验时间") |
||||||
|
private Date lastInspectionTime; |
||||||
|
} |
@ -1,76 +0,0 @@ |
|||||||
package com.hnac.hzims.safeproduct.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
||||||
import com.hnac.hzims.common.utils.Condition; |
|
||||||
import com.hnac.hzims.safeproduct.entity.DeviceEntity; |
|
||||||
import com.hnac.hzims.safeproduct.service.IDeviceService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiImplicitParam; |
|
||||||
import io.swagger.annotations.ApiImplicitParams; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import lombok.AllArgsConstructor; |
|
||||||
import org.springblade.core.boot.ctrl.BladeController; |
|
||||||
import org.springblade.core.mp.support.Query; |
|
||||||
import org.springblade.core.tool.api.R; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
import springfox.documentation.annotations.ApiIgnore; |
|
||||||
|
|
||||||
import javax.validation.Valid; |
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
/** |
|
||||||
* 特种设备管理接口类 |
|
||||||
* |
|
||||||
* @author liwen |
|
||||||
* @date 2024-01-12 |
|
||||||
*/ |
|
||||||
@RequestMapping("/device") |
|
||||||
@AllArgsConstructor |
|
||||||
@RestController |
|
||||||
@Api(value = "特种设备", tags = "特种设备接口") |
|
||||||
public class DeviceController extends BladeController { |
|
||||||
|
|
||||||
private final IDeviceService deviceService; |
|
||||||
|
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增") |
|
||||||
@ApiOperationSupport(order = 1) |
|
||||||
public R save(@Valid @RequestBody DeviceEntity deviceEntity) { |
|
||||||
return R.status(deviceService.save(deviceEntity)); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/update") |
|
||||||
@ApiOperation(value = "修改") |
|
||||||
@ApiOperationSupport(order = 2) |
|
||||||
public R update(@Valid @RequestBody DeviceEntity deviceEntity) { |
|
||||||
return R.status(deviceService.updateById(deviceEntity)); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/remove") |
|
||||||
@ApiOperation(value = "删除") |
|
||||||
@ApiOperationSupport(order = 3) |
|
||||||
public R remove(@RequestParam Long id) { |
|
||||||
return R.status(deviceService.removeById(id)); |
|
||||||
} |
|
||||||
|
|
||||||
@GetMapping("/detail") |
|
||||||
@ApiOperation(value = "详情") |
|
||||||
@ApiOperationSupport(order = 4) |
|
||||||
public R<DeviceEntity> detail(@RequestParam Long id) { |
|
||||||
return R.data(deviceService.getById(id)); |
|
||||||
} |
|
||||||
|
|
||||||
@GetMapping("/page") |
|
||||||
@ApiImplicitParams({ |
|
||||||
@ApiImplicitParam(name = "name", value = "设备名称", dataType = "query", paramType = "string"), |
|
||||||
@ApiImplicitParam(name = "deviceStatus", value = "设备状态", dataType = "query", paramType = "string") |
|
||||||
}) |
|
||||||
@ApiOperation(value = "分页") |
|
||||||
@ApiOperationSupport(order = 5) |
|
||||||
public R<IPage<DeviceEntity>> page(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { |
|
||||||
IPage<DeviceEntity> page = deviceService.page(Condition.getPage(query), Condition.getQueryWrapper(param, DeviceEntity.class) |
|
||||||
.lambda().orderByDesc(DeviceEntity::getCreateTime)); |
|
||||||
return R.data(page); |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,121 @@ |
|||||||
|
package com.hnac.hzims.safeproduct.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import com.hnac.hzims.common.utils.Condition; |
||||||
|
import com.hnac.hzims.safeproduct.entity.SpecialDeviceEntity; |
||||||
|
import com.hnac.hzims.safeproduct.entity.SpecialDeviceInspectionEntity; |
||||||
|
import com.hnac.hzims.safeproduct.service.ISpecialDeviceInspectionService; |
||||||
|
import com.hnac.hzims.safeproduct.service.ISpecialDeviceService; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiImplicitParam; |
||||||
|
import io.swagger.annotations.ApiImplicitParams; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.springblade.core.boot.ctrl.BladeController; |
||||||
|
import org.springblade.core.mp.support.Query; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
import springfox.documentation.annotations.ApiIgnore; |
||||||
|
|
||||||
|
import javax.validation.Valid; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 特种设备管理接口类 |
||||||
|
* |
||||||
|
* @author liwen |
||||||
|
* @date 2024-01-12 |
||||||
|
*/ |
||||||
|
@RequestMapping("/specialDevice") |
||||||
|
@AllArgsConstructor |
||||||
|
@RestController |
||||||
|
@Api(value = "特种设备", tags = "特种设备接口") |
||||||
|
public class SpecialDeviceController extends BladeController { |
||||||
|
|
||||||
|
private final ISpecialDeviceService specialDeviceService; |
||||||
|
|
||||||
|
private final ISpecialDeviceInspectionService specialDeviceInspectionService; |
||||||
|
|
||||||
|
@PostMapping("/save") |
||||||
|
@ApiOperation(value = "新增设备") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
public R save(@Valid @RequestBody SpecialDeviceEntity specialDeviceEntity) { |
||||||
|
return R.status(specialDeviceService.save(specialDeviceEntity)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("/update") |
||||||
|
@ApiOperation(value = "修改设备") |
||||||
|
@ApiOperationSupport(order = 2) |
||||||
|
public R update(@Valid @RequestBody SpecialDeviceEntity specialDeviceEntity) { |
||||||
|
return R.status(specialDeviceService.updateById(specialDeviceEntity)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("/remove") |
||||||
|
@ApiOperation(value = "删除设备") |
||||||
|
@ApiOperationSupport(order = 3) |
||||||
|
public R remove(@RequestParam Long id) { |
||||||
|
return R.status(specialDeviceService.removeById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/detail") |
||||||
|
@ApiOperation(value = "设备详情") |
||||||
|
@ApiOperationSupport(order = 4) |
||||||
|
public R<SpecialDeviceEntity> detail(@RequestParam Long id) { |
||||||
|
return R.data(specialDeviceService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/page") |
||||||
|
@ApiImplicitParams({ |
||||||
|
@ApiImplicitParam(name = "name", value = "设备名称", dataType = "query", paramType = "string"), |
||||||
|
@ApiImplicitParam(name = "deviceStatus", value = "设备状态", dataType = "query", paramType = "string") |
||||||
|
}) |
||||||
|
@ApiOperation(value = "设备分页") |
||||||
|
@ApiOperationSupport(order = 5) |
||||||
|
public R<IPage<SpecialDeviceEntity>> page(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { |
||||||
|
IPage<SpecialDeviceEntity> page = specialDeviceService.page(Condition.getPage(query), Condition.getQueryWrapper(param, SpecialDeviceEntity.class) |
||||||
|
.lambda().orderByDesc(SpecialDeviceEntity::getCreateTime)); |
||||||
|
return R.data(page); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("/saveInspection") |
||||||
|
@ApiOperation(value = "新增设备检验记录") |
||||||
|
@ApiOperationSupport(order = 6) |
||||||
|
public R saveInspection(@Valid @RequestBody SpecialDeviceInspectionEntity specialDeviceInspectionEntity) { |
||||||
|
return R.status(specialDeviceInspectionService.saveInspection(specialDeviceInspectionEntity)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("/updateInspection") |
||||||
|
@ApiOperation(value = "修改设备检验记录") |
||||||
|
@ApiOperationSupport(order = 7) |
||||||
|
public R updateInspection(@Valid @RequestBody SpecialDeviceInspectionEntity specialDeviceInspectionEntity) { |
||||||
|
return R.status(specialDeviceInspectionService.updateInspection(specialDeviceInspectionEntity)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("/removeInspection") |
||||||
|
@ApiOperation(value = "删除设备检验记录") |
||||||
|
@ApiOperationSupport(order = 8) |
||||||
|
public R removeInspection(@RequestParam Long id) { |
||||||
|
return R.status(specialDeviceInspectionService.removeById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/inspectionDetail") |
||||||
|
@ApiOperation(value = "设备检验记录详情") |
||||||
|
@ApiOperationSupport(order = 9) |
||||||
|
public R<SpecialDeviceInspectionEntity> inspectionDetail(@RequestParam Long id) { |
||||||
|
return R.data(specialDeviceInspectionService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/inspectionPage") |
||||||
|
@ApiImplicitParams({ |
||||||
|
@ApiImplicitParam(name = "deviceId", value = "设备id", dataType = "query", paramType = "string"), |
||||||
|
@ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "query", paramType = "string"), |
||||||
|
@ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "query", paramType = "string") |
||||||
|
}) |
||||||
|
@ApiOperation(value = "设备检验记录分页") |
||||||
|
@ApiOperationSupport(order = 10) |
||||||
|
public R<IPage<SpecialDeviceInspectionEntity>> inspectionPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { |
||||||
|
IPage<SpecialDeviceInspectionEntity> page = specialDeviceInspectionService.getInspectionPage(param, query); |
||||||
|
return R.data(page); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package com.hnac.hzims.safeproduct.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.hnac.hzims.safeproduct.entity.SpecialDeviceInspectionEntity; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 特种设备检验记录Mapper类 |
||||||
|
* |
||||||
|
* @author liwen |
||||||
|
* @date 2024-01-22 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface SpecialDeviceInspectionMapper extends BaseMapper<SpecialDeviceInspectionEntity> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 设备检验记录分页 |
||||||
|
* @param param 入参 |
||||||
|
* @param page 分页类 |
||||||
|
* @return 设备检验记录数据 |
||||||
|
*/ |
||||||
|
IPage<SpecialDeviceInspectionEntity> getInspectionPage(IPage<SpecialDeviceInspectionEntity> page, Map<String, Object> param); |
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
<?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="com.hnac.hzims.safeproduct.mapper.SpecialDeviceInspectionMapper"> |
||||||
|
|
||||||
|
<select id="getInspectionPage" resultType="com.hnac.hzims.safeproduct.entity.SpecialDeviceInspectionEntity"> |
||||||
|
SELECT |
||||||
|
* |
||||||
|
FROM |
||||||
|
hzims_device_inspection |
||||||
|
WHERE |
||||||
|
is_deleted = 0 |
||||||
|
<if test="param.deviceId != null and param.deviceId != ''"> |
||||||
|
AND device_id = #{param.deviceId} |
||||||
|
</if> |
||||||
|
<if test="param.startTime != null and param.startTime != ''"> |
||||||
|
AND inspectionTime >= #{param.startTime} |
||||||
|
</if> |
||||||
|
<if test="param.endTime != null and param.endTime != ''"> |
||||||
|
AND inspectionTime <= #{param.endTime} |
||||||
|
</if> |
||||||
|
ORDER BY |
||||||
|
create_time DESC |
||||||
|
</select> |
||||||
|
</mapper> |
@ -1,4 +1,4 @@ |
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
<mapper namespace="com.hnac.hzims.safeproduct.mapper.DeviceMapper"> |
<mapper namespace="com.hnac.hzims.safeproduct.mapper.SpecialDeviceMapper"> |
||||||
|
|
||||||
</mapper> |
</mapper> |
@ -0,0 +1,39 @@ |
|||||||
|
package com.hnac.hzims.safeproduct.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import com.hnac.hzims.safeproduct.entity.SpecialDeviceInspectionEntity; |
||||||
|
import org.springblade.core.mp.support.Query; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 特种设备检验记录服务类 |
||||||
|
* |
||||||
|
* @author liwen |
||||||
|
* @date 2024-01-22 |
||||||
|
*/ |
||||||
|
public interface ISpecialDeviceInspectionService extends IService<SpecialDeviceInspectionEntity> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增设备检验记录 |
||||||
|
* @param specialDeviceInspectionEntity 特种设备检验记录实体类 |
||||||
|
* @return true-成功,false-失败 |
||||||
|
*/ |
||||||
|
boolean saveInspection(SpecialDeviceInspectionEntity specialDeviceInspectionEntity); |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改设备检验记录 |
||||||
|
* @param specialDeviceInspectionEntity 特种设备检验记录实体类 |
||||||
|
* @return true-成功,false-失败 |
||||||
|
*/ |
||||||
|
boolean updateInspection(SpecialDeviceInspectionEntity specialDeviceInspectionEntity); |
||||||
|
|
||||||
|
/** |
||||||
|
* 设备检验记录分页 |
||||||
|
* @param param 入参 |
||||||
|
* @param query 分页类 |
||||||
|
* @return 设备检验记录数据 |
||||||
|
*/ |
||||||
|
IPage<SpecialDeviceInspectionEntity> getInspectionPage(Map<String, Object> param, Query query); |
||||||
|
} |
@ -1,33 +0,0 @@ |
|||||||
package com.hnac.hzims.safeproduct.service.impl; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
||||||
import com.hnac.hzims.safeproduct.entity.DeviceEntity; |
|
||||||
import com.hnac.hzims.safeproduct.enums.DeviceStatusEnum; |
|
||||||
import com.hnac.hzims.safeproduct.mapper.DeviceMapper; |
|
||||||
import com.hnac.hzims.safeproduct.service.IDeviceService; |
|
||||||
import org.springframework.stereotype.Service; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* 特种设备服务实现类 |
|
||||||
* |
|
||||||
* @author liwen |
|
||||||
* @date 2024-01-12 |
|
||||||
*/ |
|
||||||
@Service |
|
||||||
public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, DeviceEntity> implements IDeviceService { |
|
||||||
|
|
||||||
/** |
|
||||||
* 查找时间范围内的过期设备 |
|
||||||
*/ |
|
||||||
@Override |
|
||||||
public List<DeviceEntity> getExpiredDeviceByTime(String startTime, String endTime) { |
|
||||||
QueryWrapper<DeviceEntity> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.lambda().eq(DeviceEntity::getDeviceStatus, DeviceStatusEnum.NORMAL.getValue()) |
|
||||||
.ge(DeviceEntity::getInspectionNextTime, startTime) |
|
||||||
.le(DeviceEntity::getInspectionNextTime, endTime); |
|
||||||
return this.list(queryWrapper); |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,79 @@ |
|||||||
|
package com.hnac.hzims.safeproduct.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import com.hnac.hzims.safeproduct.entity.SpecialDeviceEntity; |
||||||
|
import com.hnac.hzims.safeproduct.entity.SpecialDeviceInspectionEntity; |
||||||
|
import com.hnac.hzims.safeproduct.enums.DeviceStatusEnum; |
||||||
|
import com.hnac.hzims.safeproduct.mapper.SpecialDeviceInspectionMapper; |
||||||
|
import com.hnac.hzims.safeproduct.service.ISpecialDeviceInspectionService; |
||||||
|
import com.hnac.hzims.safeproduct.service.ISpecialDeviceService; |
||||||
|
import org.springblade.core.mp.support.Query; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
import org.springframework.transaction.annotation.Transactional; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 特种设备检验记录服务实现类 |
||||||
|
* |
||||||
|
* @author liwen |
||||||
|
* @date 2024-01-22 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class SpecialDeviceInspectionServiceImpl extends ServiceImpl<SpecialDeviceInspectionMapper, SpecialDeviceInspectionEntity> implements ISpecialDeviceInspectionService { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
ISpecialDeviceService deviceService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增设备检验记录 |
||||||
|
*/ |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
@Override |
||||||
|
public boolean saveInspection(SpecialDeviceInspectionEntity specialDeviceInspectionEntity) { |
||||||
|
boolean save = this.save(specialDeviceInspectionEntity); |
||||||
|
if (save) { |
||||||
|
SpecialDeviceEntity specialDeviceEntity = deviceService.getById(specialDeviceInspectionEntity.getDeviceId()); |
||||||
|
if (specialDeviceEntity != null) { |
||||||
|
specialDeviceEntity.setInspectionLastTime(specialDeviceInspectionEntity.getLastInspectionTime()); |
||||||
|
specialDeviceEntity.setInspectionCurrentTime(specialDeviceInspectionEntity.getInspectionTime()); |
||||||
|
specialDeviceEntity.setInspectionNextTime(specialDeviceInspectionEntity.getNextInspectionTime()); |
||||||
|
specialDeviceEntity.setDeviceStatus(DeviceStatusEnum.NORMAL.getValue()); |
||||||
|
return deviceService.updateById(specialDeviceEntity); |
||||||
|
} |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改设备检验记录 |
||||||
|
*/ |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
@Override |
||||||
|
public boolean updateInspection(SpecialDeviceInspectionEntity specialDeviceInspectionEntity) { |
||||||
|
boolean update = this.updateById(specialDeviceInspectionEntity); |
||||||
|
if (update) { |
||||||
|
SpecialDeviceEntity specialDeviceEntity = deviceService.getById(specialDeviceInspectionEntity.getDeviceId()); |
||||||
|
if (specialDeviceEntity != null) { |
||||||
|
specialDeviceEntity.setInspectionLastTime(specialDeviceInspectionEntity.getLastInspectionTime()); |
||||||
|
specialDeviceEntity.setInspectionCurrentTime(specialDeviceInspectionEntity.getInspectionTime()); |
||||||
|
specialDeviceEntity.setInspectionNextTime(specialDeviceInspectionEntity.getNextInspectionTime()); |
||||||
|
return deviceService.updateById(specialDeviceEntity); |
||||||
|
} |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 设备检验记录分页 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public IPage<SpecialDeviceInspectionEntity> getInspectionPage(Map<String, Object> param, Query query) { |
||||||
|
IPage<SpecialDeviceInspectionEntity> page = new Page<>(query.getCurrent(), query.getSize()); |
||||||
|
return baseMapper.getInspectionPage(page, param); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,33 @@ |
|||||||
|
package com.hnac.hzims.safeproduct.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import com.hnac.hzims.safeproduct.entity.SpecialDeviceEntity; |
||||||
|
import com.hnac.hzims.safeproduct.enums.DeviceStatusEnum; |
||||||
|
import com.hnac.hzims.safeproduct.mapper.SpecialDeviceMapper; |
||||||
|
import com.hnac.hzims.safeproduct.service.ISpecialDeviceService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 特种设备服务实现类 |
||||||
|
* |
||||||
|
* @author liwen |
||||||
|
* @date 2024-01-12 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class SpecialDeviceServiceImpl extends ServiceImpl<SpecialDeviceMapper, SpecialDeviceEntity> implements ISpecialDeviceService { |
||||||
|
|
||||||
|
/** |
||||||
|
* 查找时间范围内的过期设备 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public List<SpecialDeviceEntity> getExpiredDeviceByTime(String startTime, String endTime) { |
||||||
|
QueryWrapper<SpecialDeviceEntity> queryWrapper = new QueryWrapper<>(); |
||||||
|
queryWrapper.lambda().eq(SpecialDeviceEntity::getDeviceStatus, DeviceStatusEnum.NORMAL.getValue()) |
||||||
|
.ge(SpecialDeviceEntity::getInspectionNextTime, startTime) |
||||||
|
.le(SpecialDeviceEntity::getInspectionNextTime, endTime); |
||||||
|
return this.list(queryWrapper); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue