diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java index d7c17ce9..ad35d7df 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java @@ -35,8 +35,8 @@ public class WsMaInfoController extends BaseController { @ApiOperation(value = "查询所有机具信息列表") @SysLog(title = "机具信息列表查询", businessType = OperaType.QUERY, logType = 1, module = "机具管理->查询") @GetMapping("/list") - public AjaxResult getAll() { - List list = service.getAll(); + public AjaxResult getAll(WsMaInfo info) { + List list = service.getAll(info); return AjaxResult.success(list); } @@ -85,4 +85,13 @@ public class WsMaInfoController extends BaseController { return service.getSupplier(); } + + @ApiOperation(value = "获取出厂厂家") + @SysLog(title = "获取出厂厂家", businessType = OperaType.DELETE, logType = 1, module = "获取出厂厂家") + @PostMapping("/updateCheckTime") + public AjaxResult updateCheckTime(@RequestBody WsMaInfo info) { + return service.updateCheckTime(info.getId()); + } + + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java index c0951875..8b59e46c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java @@ -30,7 +30,7 @@ public interface WsMaInfoMapper { * * @return 机具信息列表 */ - List selectAll(); + List selectAll(WsMaInfo info); /** * 插入一条新的机具记录 diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/WsMaInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/WsMaInfoService.java index 10ec9ecb..1c283e2c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/WsMaInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/WsMaInfoService.java @@ -29,7 +29,7 @@ public interface WsMaInfoService { * * @return 机具列表(List) */ - List getAll(); + List getAll(WsMaInfo info); /** * 新增一条机具记录 @@ -77,4 +77,12 @@ public interface WsMaInfoService { * @return 出厂厂家集合 */ AjaxResult getSupplier(); + + + /** + * 更新时间 + * + * @return 条数 + */ + AjaxResult updateCheckTime(Integer id); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java index b2a83364..22516054 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java @@ -62,8 +62,8 @@ public class WsMaInfoServiceImpl implements WsMaInfoService { * @return List 数据集合,由 Controller 封装为 AjaxResult */ @Override - public List getAll() { - return mapper.selectAll(); + public List getAll(WsMaInfo info) { + return mapper.selectAll(info); } /** @@ -178,4 +178,21 @@ public class WsMaInfoServiceImpl implements WsMaInfoService { return AjaxResult.error(""); } } + + /** + * 更新时间 + * + * @param id + * @return 条数 + */ + @Override + public AjaxResult updateCheckTime(Integer id) { + try { + int i = mapper.updateCheckTime(id); + return i > 0 ? AjaxResult.success("更新成功") : AjaxResult.error("更新失败"); + } catch (Exception e) { + log.error(e.getMessage()); + return AjaxResult.error("更新失败"); + } + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/controller/ExpectationsController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/controller/ExpectationsController.java new file mode 100644 index 00000000..f72e5653 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/controller/ExpectationsController.java @@ -0,0 +1,51 @@ +package com.bonus.material.expectations.controller; + +import cn.hutool.core.convert.Convert; +import com.bonus.common.biz.config.ListPagingUtil; +import com.bonus.common.core.utils.ServletUtils; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.expectations.domain.ExpectationsEntity; +import com.bonus.material.expectations.service.ExpectationsService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +@Api(tags = "检验预警") +@RestController +@RequestMapping("/expectations") +public class ExpectationsController { + @Resource + private ExpectationsService expectationsService; + + /** + * 查询现场维修列表 + */ + @ApiOperation(value = "查询检验预警列表") + @GetMapping("/list") + public AjaxResult list(ExpectationsEntity entity) { + Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); + List expectationsList = expectationsService.getExpectationsList(entity); + return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, expectationsList)); + } + + @ApiOperation(value = "查询检验预警数量") + @PostMapping("/getCountExpectations") + public AjaxResult getCountExpectations(@RequestBody ExpectationsEntity entity) { + return expectationsService.getCountExpectations(entity); + } + + + @ApiOperation(value = "查询检验预警列表") + @GetMapping("/listDetails") + public AjaxResult getListDetails(ExpectationsEntity entity) { + Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1); + Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10); + List expectationsList = expectationsService.getListDetails(entity); + return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, expectationsList)); + } + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/domain/ExpectationsEntity.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/domain/ExpectationsEntity.java new file mode 100644 index 00000000..d167bf65 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/domain/ExpectationsEntity.java @@ -0,0 +1,78 @@ +package com.bonus.material.expectations.domain; + +import io.swagger.models.auth.In; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ExpectationsEntity { + + /** + * 主键ID,自增或唯一标识该记录。 + */ + private Integer id; + + /** + * 单位名称。 + * 仅在 status = "in_use" 时有效,表示设备所属单位。 + * 在“在库”状态下可以为 null。 + */ + private String unit; + + /** + * 工程名称。 + * 仅在 status = "in_use" 时有效,表示设备所属工程项目。 + * 在“在库”状态下可以为 null。 + */ + private String project; + + /** + * 设备类型名称,如“吊装设备”、“电动工具”等。 + * 用于对设备进行分类统计。 + */ + private Integer typeId; + private Integer agreementId; + private String typeName; + + /** + * 设备规格或型号编号,用于区分同类设备的不同规格。 + */ + private String specCode; + + /** + * 超期数量,指超过下次检验日期的设备数量。 + * 这部分设备需要立即检修或停用。 + */ + private int expiredCount; + + /** + * 临期数量,指距离下次检验日期小于30天的设备数量。 + * 这部分设备需提醒安排检验计划。 + */ + private int aboutToExpireCount; + + /** + * 超期类别 + */ + private String status; + /** + * 使用状态 + */ + private String useStatus; + /** + * 数量 + */ + private Integer count; + + private String maIds; + + private String keyWord; + + private String maCode; + + private String nextCheckTime; + +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/mapper/ExpectationsMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/mapper/ExpectationsMapper.java new file mode 100644 index 00000000..6f719fe9 --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/mapper/ExpectationsMapper.java @@ -0,0 +1,30 @@ +package com.bonus.material.expectations.mapper; + +import com.bonus.material.expectations.domain.ExpectationsEntity; +import org.apache.ibatis.annotations.MapKey; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@Mapper +public interface ExpectationsMapper { + /** + * 在库,在用列表 + * + * @param entity 条件 + * @return 集合 + */ + List getExpectationsList(ExpectationsEntity entity); + + + /** + * 获取数量 + */ + @MapKey("name") + Map getCountExpectations(ExpectationsEntity entity); + + + List getListDetails(ExpectationsEntity entity); +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/service/ExpectationsService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/service/ExpectationsService.java new file mode 100644 index 00000000..e208382f --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/service/ExpectationsService.java @@ -0,0 +1,27 @@ +package com.bonus.material.expectations.service; + +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.expectations.domain.ExpectationsEntity; +import org.apache.ibatis.annotations.MapKey; + +import java.util.List; +import java.util.Map; +import java.util.Objects; + +public interface ExpectationsService { + + /** + * 在库,在用列表 + * + * @param entity 条件 + * @return 集合 + */ + List getExpectationsList(ExpectationsEntity entity); + + /** + * 获取数量 + */ + AjaxResult getCountExpectations(ExpectationsEntity entity); + + List getListDetails(ExpectationsEntity entity); +} diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/service/impl/ExpectationsServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/service/impl/ExpectationsServiceImpl.java new file mode 100644 index 00000000..8910922c --- /dev/null +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/expectations/service/impl/ExpectationsServiceImpl.java @@ -0,0 +1,72 @@ +package com.bonus.material.expectations.service.impl; + +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.expectations.domain.ExpectationsEntity; +import com.bonus.material.expectations.mapper.ExpectationsMapper; +import com.bonus.material.expectations.service.ExpectationsService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@Slf4j +@Service +public class ExpectationsServiceImpl implements ExpectationsService { + + @Resource + private ExpectationsMapper mapper; + + /** + * 在库,在用列表 + * + * @param entity 条件 + * @return 集合 + */ + @Override + public List getExpectationsList(ExpectationsEntity entity) { + try { + List expectationsList = mapper.getExpectationsList(entity); + return ObjectUtils.isNotEmpty(expectationsList) ? expectationsList : Collections.emptyList(); + } catch (Exception e) { + log.error(e.getMessage()); + return Collections.emptyList(); + } + + } + + /** + * 获取数量 + * + * @param entity + */ + @Override + public AjaxResult getCountExpectations(ExpectationsEntity entity) { + try { + Map countExpectations = mapper.getCountExpectations(entity); + return ObjectUtils.isNotEmpty(countExpectations) ? AjaxResult.success(countExpectations) : AjaxResult.error(); + }catch (Exception e) { + log.error(e.getMessage()); + return AjaxResult.error(); + } + } + + /** + * @param entity + * @return + */ + @Override + public List getListDetails(ExpectationsEntity entity) { + try { + List expectationsList = mapper.getListDetails(entity); + return ObjectUtils.isNotEmpty(expectationsList) ? expectationsList : Collections.emptyList(); + } catch (Exception e) { + log.error(e.getMessage()); + return Collections.emptyList(); + } + } +} diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml index 11d5d448..76d67d01 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml @@ -29,10 +29,7 @@ WHERE id = #{id} - + + + + + + + + + +