Commit 7c153b78 authored by 竹天卫's avatar 竹天卫

设备管理 完成

parent 09781204
......@@ -8,6 +8,7 @@ import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.*;
import cn.wise.sc.cement.business.model.vo.TeamVo;
import cn.wise.sc.cement.business.service.IEquipmentService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
......@@ -59,7 +60,18 @@ public class EquipmentController {
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "设备检定附件分页列表")
@ApiOperation(value = "检定设备")
@PostMapping("/test")
public BaseResponse test(@RequestBody EquipmentTestQuery query) {
try {
return equipmentService.test(query);
}catch (Exception e) {
log.debug("检定设备{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "设备检定历史")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "equipmentId", value = "设备表id", paramType = "query", dataType = "Integer")
})
......@@ -68,7 +80,7 @@ public class EquipmentController {
try {
return equipmentService.getTestPage(pageQuery, equipmentId);
} catch (Exception e) {
log.debug("设备检定分页列表{}", e);
log.debug("设备检定历史{}", e);
}
return BaseResponse.errorMsg("失败!");
}
......@@ -93,8 +105,6 @@ public class EquipmentController {
}
}
@ApiOperation(value = "新增设备")
@PostMapping("/create")
public BaseResponse create(@RequestBody EquipmentQuery query) {
......@@ -132,7 +142,9 @@ public class EquipmentController {
@GetMapping("/getList")
public BaseResponse getList(){
try {
List<Equipment> list = equipmentService.list();
QueryWrapper<Equipment> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status", 1);
List<Equipment> list = equipmentService.list(queryWrapper);
return BaseResponse.okData(list);
}catch (Exception e){
log.debug("设备列表{}",e);
......@@ -152,16 +164,7 @@ public class EquipmentController {
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "检定设备")
@PostMapping("/test")
public BaseResponse test(@RequestBody EquipmentTestQuery query) {
try {
return equipmentService.test(query);
}catch (Exception e) {
log.debug("检定设备{}",e);
}
return BaseResponse.errorMsg("失败!");
}
/*
......@@ -191,12 +194,12 @@ public class EquipmentController {
@ApiOperation(value = "设备故障维修登记分页列表")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "equipmentId", value = "设备表id", paramType = "query", dataType = "Integer")
@ApiImplicitParam(name = "name", value = "设备名称", paramType = "query", dataType = "String")
})
@GetMapping("/getTroubleshootingPage")
public BaseResponse getTroubleshootingPage(PageQuery pageQuery, Integer equipmentId) {
public BaseResponse getTroubleshootingPage(PageQuery pageQuery, String name) {
try {
return equipmentService.getTroubleshootingPage(pageQuery, equipmentId);
return equipmentService.getTroubleshootingPage(pageQuery, name);
} catch (Exception e) {
log.debug("设备故障维修登记分页列表{}", e);
}
......@@ -205,9 +208,9 @@ public class EquipmentController {
@ApiOperation("设备维修列表导出")
@PostMapping("/exportTroubleshooting")
public void exportTroubleshooting(Integer equipmentIde, String fileName, HttpServletResponse response) {
public void exportTroubleshooting( String name, String fileName, HttpServletResponse response) {
try {
equipmentService.exportTroubleshooting(equipmentIde, fileName, response);
equipmentService.exportTroubleshooting(name, fileName, response);
} catch (Exception e) {
log.debug("设备维修列表导出{}", e);
}
......
......@@ -50,6 +50,15 @@ public class EquipmentTest implements Serializable {
@ApiModelProperty("实施结果")
private String tryResult;
@ApiModelProperty("附件地址")
private String enclosureUrl;
@ApiModelProperty("文件名")
private String alias;
@ApiModelProperty("扩展名")
private String extName;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
......
......@@ -3,7 +3,9 @@
<mapper namespace="cn.wise.sc.cement.business.mapper.EquipmentTroubleshootingMapper">
<sql id="where">
<where>
and et.equipment_id = #{params.equipmentId}
<if test="params.name != null and params.name != ''">
and e.name like concat('%', #{params.name}, '%')
</if>
</where>
</sql>
......
......@@ -52,8 +52,13 @@ public class EquipmentTestVo {
@ApiModelProperty("校核附件")
private String enclosure;
@ApiModelProperty("校核附件信息")
private List<EnclosureQuery> enclosureQueryList;
@ApiModelProperty("文件名")
private String alias;
@ApiModelProperty("扩展名")
private String extName;
@ApiModelProperty("路径")
private String enclosureUrl;
}
......@@ -40,9 +40,9 @@ public interface IEquipmentService extends IService<Equipment> {
BaseResponse<String> troubleshooting(EquipmentTroubleshootingQuery query);
BaseResponse<IPage<EquipmentTroubleshootingVo>> getTroubleshootingPage(PageQuery pageQuery, Integer equipmentId);
BaseResponse<IPage<EquipmentTroubleshootingVo>> getTroubleshootingPage(PageQuery pageQuery, String name);
void exportTroubleshooting(Integer equipmentId, String fileName, HttpServletResponse response);
void exportTroubleshooting(String name, String fileName, HttpServletResponse response);
BaseResponse<EquipmentTroubleshootingVo> getTroubleshootingDetail(Integer id);
......
......@@ -9,6 +9,7 @@ import cn.wise.sc.cement.business.model.vo.*;
import cn.wise.sc.cement.business.service.IEquipmentService;
import cn.wise.sc.cement.business.service.ISysUserService;
import cn.wise.sc.cement.business.util.ExcelUtil;
import cn.wise.sc.cement.business.wrapper.page.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
......@@ -224,8 +225,6 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
}
/**
* 设备检定 保存设备检定表信息和附件表信息,附件表的entity_type为3
* @param query (不传id为添加记录,传id为修改记录)
......@@ -246,6 +245,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
EquipmentTest equipmentTest = new EquipmentTest();
BeanUtils.copyProperties(query, equipmentTest);
equipmentTest.setUserId(userService.getLoginUser().getId())
.setEnclosureUrl(enclosureQuery.getEnclosureUrl())
.setAlias(enclosureQuery.getAlias())
.setExtName(enclosureQuery.getExtName())
.setCreateTime(LocalDateTime.now());
testMapper.insert(equipmentTest);
equipment.setTestDate(equipmentTest.getTestDate());
......@@ -256,13 +258,6 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
equipment.setAlias(enclosureQuery.getAlias());
equipment.setExtName(enclosureQuery.getExtName());
equipmentMapper.updateById(equipment);
//保存校核附件信息
List<EnclosureQuery> enclosureQueryList = new ArrayList<>();
enclosureQueryList.add(enclosureQuery);
Boolean ref = commonService.saveEntityEnclosure(EntityEnclosure.EntityType.EQUIPMENT_TEST, equipmentTest.getId(), enclosureQueryList);
if(!ref){
return BaseResponse.errorMsg("保存保存校核附件失败!");
}
return BaseResponse.okData("检定完成");
}
......@@ -278,24 +273,6 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
params.put("equipmentId", equipmentId);
Page<EquipmentTestVo> page = new Page<>(pageQuery.getPageNo(), pageQuery.getPageSize());
IPage<EquipmentTestVo> pages = testMapper.getPage(page,params);
List<EquipmentTestVo> list = page.getRecords();
if(list != null && list.size()>0){
for(EquipmentTestVo equipmentTestVo : list){
List<EntityEnclosure> entityEnclosureList = commonService.getEnclosureList
(EntityEnclosure.EntityType.EQUIPMENT_TEST, equipmentTestVo.getId());
String enclosure = "";
if(entityEnclosureList != null && entityEnclosureList.size()>0){
for(EntityEnclosure entityEnclosure : entityEnclosureList){
String fileName = entityEnclosure.getAlias()+entityEnclosure.getExtName();
enclosure = enclosure.equals("")?fileName:enclosure+"、"+fileName;
}
}
equipmentTestVo.setEnclosure(enclosure);
}
}
return BaseResponse.okData(pages);
}
......@@ -321,7 +298,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
.setExtName(entityEnclosure.getExtName());
enclosureQueryList.add(enclosureQuery);
}
equipmentTestVo.setEnclosureQueryList(enclosureQueryList);
return BaseResponse.okData(equipmentTestVo);
}
......@@ -359,13 +336,14 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
/**
* 设备故障维修登记分页查询
* @param pageQuery
* @param equipmentId
* @param name
* @return
*/
@Override
public BaseResponse<IPage<EquipmentTroubleshootingVo>> getTroubleshootingPage(PageQuery pageQuery, Integer equipmentId) {
public BaseResponse<IPage<EquipmentTroubleshootingVo>> getTroubleshootingPage(PageQuery pageQuery,
String name) {
Map<String, Object> params = new HashMap<>();
params.put("equipmentId", equipmentId);
params.put("equipmentId", name);
Page<EquipmentTroubleshootingVo> page = new Page<>(pageQuery.getPageNo(), pageQuery.getPageSize());
IPage<EquipmentTroubleshootingVo> pages = troubleshootingMapper.getPage(page,params);
return BaseResponse.okData(pages);
......@@ -373,14 +351,14 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
/**
* 设备维修列表导出
* @param equipmentId
* @param name
* @param fileName
* @param response
*/
@Override
public void exportTroubleshooting(Integer equipmentId, String fileName, HttpServletResponse response) {
public void exportTroubleshooting(String name, String fileName, HttpServletResponse response) {
Map<String, Object> params = new HashMap<>();
params.put("equipmentId", equipmentId);
params.put("name", name);
List<Map<String, Object>> list= troubleshootingMapper.exportList(params);
if (!CollectionUtils.isEmpty(list)) {
Map<String, Object> map = list.get(0);
......@@ -440,7 +418,12 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
if(equipmentVo == null){
return BaseResponse.errorMsg("信息错误!");
}
QueryWrapper<EquipmentScrap> esWrapper = new QueryWrapper<>();
esWrapper.eq("equipment_id",equipmentVo.getId());
EquipmentScrap es = scrapMapper.selectOne(esWrapper);
if(es != null){
return BaseResponse.errorMsg("此设备已经申请报废!");
}
EquipmentScrap equipmentScrap = new EquipmentScrap();
BeanUtils.copyProperties(query, equipmentScrap);
if(query.getId() == null){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment