1.提交设备巡检计划相关代码
parent
9d42a60f66
commit
f06dc47afb
@ -0,0 +1,65 @@
|
|||||||
|
package com.glxp.api.service.inv;
|
||||||
|
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.entity.inv.DeviceInspectPlanEntity;
|
||||||
|
import com.glxp.api.req.inv.AddDeviceInspectOrderRequest;
|
||||||
|
import com.glxp.api.req.inv.FilterDeviceInspectPlanRequest;
|
||||||
|
import com.glxp.api.res.inv.DeviceInspectPlanResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备巡检计划Service
|
||||||
|
*/
|
||||||
|
public interface DeviceInspectPlanService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询巡检计划列表
|
||||||
|
*
|
||||||
|
* @param filterDeviceInspectPlanRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<DeviceInspectPlanResponse> filterList(FilterDeviceInspectPlanRequest filterDeviceInspectPlanRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加巡检计划
|
||||||
|
*
|
||||||
|
* @param addDeviceInspectOrderRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse addDeviceInspectPlan(AddDeviceInspectOrderRequest addDeviceInspectOrderRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新巡检计划
|
||||||
|
*
|
||||||
|
* @param deviceInspectPlanEntity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse updateDeviceInspectPlan(DeviceInspectPlanEntity deviceInspectPlanEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交审核
|
||||||
|
*
|
||||||
|
* @param orderId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse submitAudit(String orderId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新状态
|
||||||
|
*
|
||||||
|
* @param orderId
|
||||||
|
* @param status
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse updateStatus(String orderId, Integer status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除巡检计划
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse deletePlan(String id);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.glxp.api.service.inv;
|
||||||
|
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.entity.inv.DeviceInspectSetEntity;
|
||||||
|
import com.glxp.api.req.inv.AddDeviceInspectSetRequest;
|
||||||
|
import com.glxp.api.res.inv.DeviceInspectSetResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备巡检设置Service
|
||||||
|
*/
|
||||||
|
public interface DeviceInspectSetService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备巡检设置信息
|
||||||
|
*
|
||||||
|
* @param code 资产编号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
DeviceInspectSetResponse findInspectSet(String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备巡检设置信息
|
||||||
|
* @param deviceInspectSetEntity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse updateInspectSet(DeviceInspectSetEntity deviceInspectSetEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加设备巡检设置
|
||||||
|
* @param addDeviceInspectSetRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse addDeviceInspect(AddDeviceInspectSetRequest addDeviceInspectSetRequest);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
package com.glxp.api.service.inv.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.dao.inv.DeviceInspectPlanDao;
|
||||||
|
import com.glxp.api.entity.inv.DeviceInspectPlanEntity;
|
||||||
|
import com.glxp.api.req.inv.AddDeviceInspectOrderRequest;
|
||||||
|
import com.glxp.api.req.inv.FilterDeviceInspectPlanRequest;
|
||||||
|
import com.glxp.api.res.inv.DeviceInspectPlanResponse;
|
||||||
|
import com.glxp.api.service.auth.CustomerService;
|
||||||
|
import com.glxp.api.service.inv.DeviceInspectPlanService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class DeviceInspectPlanServiceImpl implements DeviceInspectPlanService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DeviceInspectPlanDao deviceInspectPlanDao;
|
||||||
|
@Resource
|
||||||
|
private CustomerService customerService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceInspectPlanResponse> filterList(FilterDeviceInspectPlanRequest filterDeviceInspectPlanRequest) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse addDeviceInspectPlan(AddDeviceInspectOrderRequest addDeviceInspectOrderRequest) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse updateDeviceInspectPlan(DeviceInspectPlanEntity deviceInspectPlanEntity) {
|
||||||
|
DeviceInspectPlanEntity deviceInspectPlan = deviceInspectPlanDao.selectById(deviceInspectPlanEntity.getId());
|
||||||
|
BeanUtil.copyProperties(deviceInspectPlanEntity, deviceInspectPlan, "createTime", "createUser");
|
||||||
|
deviceInspectPlan.setUpdateTime(new Date());
|
||||||
|
deviceInspectPlanDao.updateById(deviceInspectPlan);
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse submitAudit(String orderId) {
|
||||||
|
if (StrUtil.isBlank(orderId)) {
|
||||||
|
return ResultVOUtils.paramVerifyFail();
|
||||||
|
}
|
||||||
|
DeviceInspectPlanEntity deviceInspectPlanEntity = deviceInspectPlanDao.selectByOrderId(orderId);
|
||||||
|
deviceInspectPlanEntity.setStatus(1);
|
||||||
|
deviceInspectPlanEntity.setUpdateTime(new Date());
|
||||||
|
deviceInspectPlanDao.updateById(deviceInspectPlanEntity);
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse updateStatus(String orderId, Integer status) {
|
||||||
|
if (StrUtil.isBlank(orderId) || null == status) {
|
||||||
|
return ResultVOUtils.paramVerifyFail();
|
||||||
|
}
|
||||||
|
DeviceInspectPlanEntity deviceInspectPlanEntity = deviceInspectPlanDao.selectByOrderId(orderId);
|
||||||
|
deviceInspectPlanEntity.setStatus(status);
|
||||||
|
deviceInspectPlanEntity.setUpdateTime(new Date());
|
||||||
|
if (status == 2) {
|
||||||
|
//TODO 审核通过后生成设备维保单
|
||||||
|
//审核通过
|
||||||
|
deviceInspectPlanEntity.setAuditTime(new Date());
|
||||||
|
deviceInspectPlanEntity.setAuditUser(customerService.getUserIdStr());
|
||||||
|
}
|
||||||
|
deviceInspectPlanDao.updateById(deviceInspectPlanEntity);
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse deletePlan(String id) {
|
||||||
|
if (StrUtil.isBlank(id)) {
|
||||||
|
return ResultVOUtils.paramVerifyFail();
|
||||||
|
}
|
||||||
|
deviceInspectPlanDao.deleteById(id);
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
package com.glxp.api.service.inv.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.dao.inv.DeptDeviceDetailDao;
|
||||||
|
import com.glxp.api.dao.inv.DeviceInspectSetDao;
|
||||||
|
import com.glxp.api.entity.inv.DeptDeviceDetailEntity;
|
||||||
|
import com.glxp.api.entity.inv.DeviceInspectSetEntity;
|
||||||
|
import com.glxp.api.req.inv.AddDeviceInspectSetRequest;
|
||||||
|
import com.glxp.api.res.inv.DeviceInspectSetResponse;
|
||||||
|
import com.glxp.api.service.inv.DeviceInspectSetService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class DeviceInspectSetServiceImpl implements DeviceInspectSetService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DeviceInspectSetDao deviceInspectSetDao;
|
||||||
|
@Resource
|
||||||
|
private DeptDeviceDetailDao deptDeviceDetailDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceInspectSetResponse findInspectSet(String code) {
|
||||||
|
if (StrUtil.isBlank(code)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return deviceInspectSetDao.selectInspectSet(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse updateInspectSet(DeviceInspectSetEntity deviceInspectSetEntity) {
|
||||||
|
DeviceInspectSetEntity inspectSetEntity = deviceInspectSetDao.selectById(deviceInspectSetEntity.getId());
|
||||||
|
BeanUtil.copyProperties(deviceInspectSetEntity, inspectSetEntity, "createUser", "createTime");
|
||||||
|
inspectSetEntity.setUpdateTime(new Date());
|
||||||
|
deviceInspectSetDao.updateById(inspectSetEntity);
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse addDeviceInspect(AddDeviceInspectSetRequest addDeviceInspectSetRequest) {
|
||||||
|
if (null == addDeviceInspectSetRequest || StrUtil.isBlank(addDeviceInspectSetRequest.getCode())) {
|
||||||
|
return ResultVOUtils.paramVerifyFail();
|
||||||
|
}
|
||||||
|
Long count = deptDeviceDetailDao.selectCount(new QueryWrapper<DeptDeviceDetailEntity>().eq("code", addDeviceInspectSetRequest.getCode()));
|
||||||
|
if (count == 0) {
|
||||||
|
return ResultVOUtils.paramVerifyFail("此设备不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceInspectSetEntity deviceInspectSetEntity = new DeviceInspectSetEntity();
|
||||||
|
BeanUtil.copyProperties(addDeviceInspectSetRequest, deviceInspectSetEntity);
|
||||||
|
deviceInspectSetEntity.setStatus(1);
|
||||||
|
deviceInspectSetEntity.setCreateTime(new Date());
|
||||||
|
deviceInspectSetEntity.setUpdateTime(new Date());
|
||||||
|
deviceInspectSetDao.insert(deviceInspectSetEntity);
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
}
|
@ -1,25 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.glxp.api.dao.inv.DeviceInspectPlanDao">
|
<mapper namespace="com.glxp.api.dao.inv.DeviceInspectPlanDao">
|
||||||
<resultMap id="BaseResultMap" type="com.glxp.api.entity.inv.DeviceInspectPlanEntity">
|
<select id="selectByOrderId" resultType="com.glxp.api.entity.inv.DeviceInspectPlanEntity">
|
||||||
<!--@mbg.generated-->
|
select *
|
||||||
<!--@Table device_inspect_plan-->
|
from device_inspect_plan
|
||||||
<id column="id" jdbcType="INTEGER" property="id" />
|
where orderId = #{orderId}
|
||||||
<result column="deptCode" jdbcType="VARCHAR" property="deptCode" />
|
</select>
|
||||||
<result column="invCode" jdbcType="VARCHAR" property="invCode" />
|
|
||||||
<result column="code" jdbcType="VARCHAR" property="code" />
|
|
||||||
<result column="level" jdbcType="TINYINT" property="level" />
|
|
||||||
<result column="status" jdbcType="TINYINT" property="status" />
|
|
||||||
<result column="createUser" jdbcType="VARCHAR" property="createUser" />
|
|
||||||
<result column="auditUser" jdbcType="VARCHAR" property="auditUser" />
|
|
||||||
<result column="createTime" jdbcType="TIMESTAMP" property="createTime" />
|
|
||||||
<result column="auditTime" jdbcType="TIMESTAMP" property="auditTime" />
|
|
||||||
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
|
|
||||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
|
||||||
</resultMap>
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
id, deptCode, invCode, code, `level`, `status`, `createUser`, auditUser, createTime,
|
|
||||||
auditTime, updateTime, remark
|
|
||||||
</sql>
|
|
||||||
</mapper>
|
</mapper>
|
@ -1,20 +1,21 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.glxp.api.dao.inv.DeviceInspectSetDao">
|
<mapper namespace="com.glxp.api.dao.inv.DeviceInspectSetDao">
|
||||||
<resultMap id="BaseResultMap" type="com.glxp.api.entity.inv.DeviceInspectSetEntity">
|
<select id="selectInspectSet" resultType="com.glxp.api.res.inv.DeviceInspectSetResponse">
|
||||||
<!--@mbg.generated-->
|
select t.code,
|
||||||
<!--@Table device_inspect_set-->
|
t.frequency,
|
||||||
<id column="id" jdbcType="INTEGER" property="id" />
|
t.frequency,
|
||||||
<result column="code" jdbcType="VARCHAR" property="code" />
|
t.frequencyUnit,
|
||||||
<result column="frequency" jdbcType="VARCHAR" property="frequency" />
|
t.remark,
|
||||||
<result column="frequencyUnit" jdbcType="TINYINT" property="frequencyUnit" />
|
d.deviceName,
|
||||||
<result column="status" jdbcType="TINYINT" property="status" />
|
(select name from auth_dept where code = d.deptCode) deptName,
|
||||||
<result column="createTime" jdbcType="TIMESTAMP" property="createTime" />
|
(select name from auth_warehouse where code = d.invCode) invName
|
||||||
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
|
from device_inspect_set t
|
||||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
left join dept_device_detail d on t.code = d.code
|
||||||
</resultMap>
|
<where>
|
||||||
<sql id="Base_Column_List">
|
<if test="code != null and code != ''">
|
||||||
<!--@mbg.generated-->
|
t.code = #{code}
|
||||||
id, code, frequency, frequencyUnit, `status`, createTime, updateTime, remark
|
</if>
|
||||||
</sql>
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue