现场维修
This commit is contained in:
parent
108d3c7d95
commit
787d2c2bb0
|
|
@ -35,8 +35,8 @@ public class WsMaInfoController extends BaseController {
|
||||||
@ApiOperation(value = "查询所有机具信息列表")
|
@ApiOperation(value = "查询所有机具信息列表")
|
||||||
@SysLog(title = "机具信息列表查询", businessType = OperaType.QUERY, logType = 1, module = "机具管理->查询")
|
@SysLog(title = "机具信息列表查询", businessType = OperaType.QUERY, logType = 1, module = "机具管理->查询")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult getAll() {
|
public AjaxResult getAll(WsMaInfo info) {
|
||||||
List<WsMaInfo> list = service.getAll();
|
List<WsMaInfo> list = service.getAll(info);
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,4 +85,13 @@ public class WsMaInfoController extends BaseController {
|
||||||
return service.getSupplier();
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public interface WsMaInfoMapper {
|
||||||
*
|
*
|
||||||
* @return 机具信息列表
|
* @return 机具信息列表
|
||||||
*/
|
*/
|
||||||
List<WsMaInfo> selectAll();
|
List<WsMaInfo> selectAll(WsMaInfo info);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入一条新的机具记录
|
* 插入一条新的机具记录
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ public interface WsMaInfoService {
|
||||||
*
|
*
|
||||||
* @return 机具列表(List<WsMaInfo>)
|
* @return 机具列表(List<WsMaInfo>)
|
||||||
*/
|
*/
|
||||||
List<WsMaInfo> getAll();
|
List<WsMaInfo> getAll(WsMaInfo info);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增一条机具记录
|
* 新增一条机具记录
|
||||||
|
|
@ -77,4 +77,12 @@ public interface WsMaInfoService {
|
||||||
* @return 出厂厂家集合
|
* @return 出厂厂家集合
|
||||||
*/
|
*/
|
||||||
AjaxResult getSupplier();
|
AjaxResult getSupplier();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*
|
||||||
|
* @return 条数
|
||||||
|
*/
|
||||||
|
AjaxResult updateCheckTime(Integer id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ public class WsMaInfoServiceImpl implements WsMaInfoService {
|
||||||
* @return List<WsMaInfo> 数据集合,由 Controller 封装为 AjaxResult
|
* @return List<WsMaInfo> 数据集合,由 Controller 封装为 AjaxResult
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<WsMaInfo> getAll() {
|
public List<WsMaInfo> getAll(WsMaInfo info) {
|
||||||
return mapper.selectAll();
|
return mapper.selectAll(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -178,4 +178,21 @@ public class WsMaInfoServiceImpl implements WsMaInfoService {
|
||||||
return AjaxResult.error("");
|
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("更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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<ExpectationsEntity> 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<ExpectationsEntity> expectationsList = expectationsService.getListDetails(entity);
|
||||||
|
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, expectationsList));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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<ExpectationsEntity> getExpectationsList(ExpectationsEntity entity);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数量
|
||||||
|
*/
|
||||||
|
@MapKey("name")
|
||||||
|
Map<String, Objects> getCountExpectations(ExpectationsEntity entity);
|
||||||
|
|
||||||
|
|
||||||
|
List<ExpectationsEntity> getListDetails(ExpectationsEntity entity);
|
||||||
|
}
|
||||||
|
|
@ -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<ExpectationsEntity> getExpectationsList(ExpectationsEntity entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数量
|
||||||
|
*/
|
||||||
|
AjaxResult getCountExpectations(ExpectationsEntity entity);
|
||||||
|
|
||||||
|
List<ExpectationsEntity> getListDetails(ExpectationsEntity entity);
|
||||||
|
}
|
||||||
|
|
@ -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<ExpectationsEntity> getExpectationsList(ExpectationsEntity entity) {
|
||||||
|
try {
|
||||||
|
List<ExpectationsEntity> 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<String, Objects> 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<ExpectationsEntity> getListDetails(ExpectationsEntity entity) {
|
||||||
|
try {
|
||||||
|
List<ExpectationsEntity> expectationsList = mapper.getListDetails(entity);
|
||||||
|
return ObjectUtils.isNotEmpty(expectationsList) ? expectationsList : Collections.emptyList();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -29,10 +29,7 @@
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAll" resultMap="BaseResultMap">
|
|
||||||
SELECT *
|
|
||||||
FROM ws_ma_info
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getMaTypeData" resultType="java.util.Map">
|
<select id="getMaTypeData" resultType="java.util.Map">
|
||||||
SELECT type_id AS id,
|
SELECT type_id AS id,
|
||||||
|
|
@ -63,6 +60,15 @@
|
||||||
AND ma_code = #{maCode}
|
AND ma_code = #{maCode}
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectAll" resultMap="BaseResultMap" resultType="com.bonus.material.codeCollection.domain.WsMaInfo">
|
||||||
|
SELECT *
|
||||||
|
FROM ws_ma_info
|
||||||
|
<where>
|
||||||
|
<if test="maCode != null">
|
||||||
|
ma_code like concat('%', #{maCode}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<insert id="insert" parameterType="com.bonus.material.codeCollection.domain.WsMaInfo" useGeneratedKeys="true"
|
<insert id="insert" parameterType="com.bonus.material.codeCollection.domain.WsMaInfo" useGeneratedKeys="true"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
<?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.bonus.material.expectations.mapper.ExpectationsMapper">
|
||||||
|
|
||||||
|
<select id="getExpectationsList" resultType="com.bonus.material.expectations.domain.ExpectationsEntity">
|
||||||
|
SELECT
|
||||||
|
CASE
|
||||||
|
WHEN mm.ma_status = '2' THEN bu.unit_name
|
||||||
|
ELSE NULL
|
||||||
|
END AS unit,
|
||||||
|
CASE
|
||||||
|
WHEN mm.ma_status = '2' THEN bp.pro_name
|
||||||
|
ELSE NULL
|
||||||
|
END AS project,
|
||||||
|
mm.type_id AS typeId,
|
||||||
|
sai.agreement_id AS agreementId,
|
||||||
|
mt2.type_name AS typeName,
|
||||||
|
mt1.type_name AS specCode,
|
||||||
|
COUNT(*) AS count,
|
||||||
|
GROUP_CONCAT(mm.ma_id ORDER BY mm.ma_id SEPARATOR ',') AS maIds,
|
||||||
|
CASE
|
||||||
|
WHEN mm.next_check_time < CURDATE() THEN 'expired'
|
||||||
|
ELSE 'about_to_expire'
|
||||||
|
END AS status
|
||||||
|
FROM ma_machine mm
|
||||||
|
LEFT JOIN ma_type mt1 ON mm.type_id = mt1.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
|
||||||
|
LEFT JOIN slt_agreement_info sai ON sai.ma_id = mm.ma_id
|
||||||
|
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
|
||||||
|
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
||||||
|
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||||
|
WHERE
|
||||||
|
mm.ma_status = #{useStatus}
|
||||||
|
AND (
|
||||||
|
mm.next_check_time < CURDATE()
|
||||||
|
OR mm.next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY)
|
||||||
|
)
|
||||||
|
<if test="keyWord != null and keyWord != ''">
|
||||||
|
AND (
|
||||||
|
bu.unit_name LIKE CONCAT('%', #{keyWord}, '%') OR
|
||||||
|
bp.pro_name LIKE CONCAT('%', #{keyWord}, '%') OR
|
||||||
|
mt2.type_name LIKE CONCAT('%', #{keyWord}, '%') OR
|
||||||
|
mt1.type_name LIKE CONCAT('%', #{keyWord}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
unit,
|
||||||
|
project,
|
||||||
|
mt2.type_name,
|
||||||
|
mt1.type_name,
|
||||||
|
status
|
||||||
|
ORDER BY
|
||||||
|
status,
|
||||||
|
unit,
|
||||||
|
project
|
||||||
|
</select>
|
||||||
|
<select id="getCountExpectations" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
CASE
|
||||||
|
WHEN next_check_time < CURDATE() THEN 'expired'
|
||||||
|
WHEN next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY) THEN 'aboutToExpire'
|
||||||
|
END AS name,
|
||||||
|
COUNT(*) AS count
|
||||||
|
FROM ma_machine
|
||||||
|
WHERE ma_status = #{useStatus}
|
||||||
|
AND next_check_time < DATE_ADD(CURDATE(), INTERVAL 30 DAY)
|
||||||
|
GROUP BY name;
|
||||||
|
</select>
|
||||||
|
<select id="getListDetails" resultType="com.bonus.material.expectations.domain.ExpectationsEntity">
|
||||||
|
SELECT
|
||||||
|
mt2.type_name AS typeName,
|
||||||
|
mt1.type_name AS specCode,
|
||||||
|
mm.ma_code AS maCode,
|
||||||
|
mm.next_check_time AS nextCheckTime
|
||||||
|
FROM
|
||||||
|
ma_machine mm
|
||||||
|
LEFT JOIN ma_type mt1 ON mm.type_id = mt1.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt1.parent_id = mt2.type_id
|
||||||
|
LEFT JOIN slt_agreement_info sai ON sai.ma_id = mm.ma_id
|
||||||
|
WHERE
|
||||||
|
<choose>
|
||||||
|
<when test="useStatus == 2">
|
||||||
|
sai.agreement_id = #{agreementId}
|
||||||
|
AND sai.type_id = #{typeId}
|
||||||
|
</when>
|
||||||
|
<when test="useStatus == 1">
|
||||||
|
mm.type_id = #{typeId}
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue