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

设备管理 完成

parent 09781204
...@@ -8,6 +8,7 @@ import cn.wise.sc.cement.business.model.PageQuery; ...@@ -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.query.*;
import cn.wise.sc.cement.business.model.vo.TeamVo; import cn.wise.sc.cement.business.model.vo.TeamVo;
import cn.wise.sc.cement.business.service.IEquipmentService; 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.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -59,7 +60,18 @@ public class EquipmentController { ...@@ -59,7 +60,18 @@ public class EquipmentController {
return BaseResponse.errorMsg("失败!"); 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 = { @ApiImplicitParams(value = {
@ApiImplicitParam(name = "equipmentId", value = "设备表id", paramType = "query", dataType = "Integer") @ApiImplicitParam(name = "equipmentId", value = "设备表id", paramType = "query", dataType = "Integer")
}) })
...@@ -68,7 +80,7 @@ public class EquipmentController { ...@@ -68,7 +80,7 @@ public class EquipmentController {
try { try {
return equipmentService.getTestPage(pageQuery, equipmentId); return equipmentService.getTestPage(pageQuery, equipmentId);
} catch (Exception e) { } catch (Exception e) {
log.debug("设备检定分页列表{}", e); log.debug("设备检定历史{}", e);
} }
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
...@@ -93,8 +105,6 @@ public class EquipmentController { ...@@ -93,8 +105,6 @@ public class EquipmentController {
} }
} }
@ApiOperation(value = "新增设备") @ApiOperation(value = "新增设备")
@PostMapping("/create") @PostMapping("/create")
public BaseResponse create(@RequestBody EquipmentQuery query) { public BaseResponse create(@RequestBody EquipmentQuery query) {
...@@ -132,7 +142,9 @@ public class EquipmentController { ...@@ -132,7 +142,9 @@ public class EquipmentController {
@GetMapping("/getList") @GetMapping("/getList")
public BaseResponse getList(){ public BaseResponse getList(){
try { 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); return BaseResponse.okData(list);
}catch (Exception e){ }catch (Exception e){
log.debug("设备列表{}",e); log.debug("设备列表{}",e);
...@@ -152,16 +164,7 @@ public class EquipmentController { ...@@ -152,16 +164,7 @@ public class EquipmentController {
return BaseResponse.errorMsg("失败!"); 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 { ...@@ -191,12 +194,12 @@ public class EquipmentController {
@ApiOperation(value = "设备故障维修登记分页列表") @ApiOperation(value = "设备故障维修登记分页列表")
@ApiImplicitParams(value = { @ApiImplicitParams(value = {
@ApiImplicitParam(name = "equipmentId", value = "设备表id", paramType = "query", dataType = "Integer") @ApiImplicitParam(name = "name", value = "设备名称", paramType = "query", dataType = "String")
}) })
@GetMapping("/getTroubleshootingPage") @GetMapping("/getTroubleshootingPage")
public BaseResponse getTroubleshootingPage(PageQuery pageQuery, Integer equipmentId) { public BaseResponse getTroubleshootingPage(PageQuery pageQuery, String name) {
try { try {
return equipmentService.getTroubleshootingPage(pageQuery, equipmentId); return equipmentService.getTroubleshootingPage(pageQuery, name);
} catch (Exception e) { } catch (Exception e) {
log.debug("设备故障维修登记分页列表{}", e); log.debug("设备故障维修登记分页列表{}", e);
} }
...@@ -205,9 +208,9 @@ public class EquipmentController { ...@@ -205,9 +208,9 @@ public class EquipmentController {
@ApiOperation("设备维修列表导出") @ApiOperation("设备维修列表导出")
@PostMapping("/exportTroubleshooting") @PostMapping("/exportTroubleshooting")
public void exportTroubleshooting(Integer equipmentIde, String fileName, HttpServletResponse response) { public void exportTroubleshooting( String name, String fileName, HttpServletResponse response) {
try { try {
equipmentService.exportTroubleshooting(equipmentIde, fileName, response); equipmentService.exportTroubleshooting(name, fileName, response);
} catch (Exception e) { } catch (Exception e) {
log.debug("设备维修列表导出{}", e); log.debug("设备维修列表导出{}", e);
} }
......
...@@ -50,6 +50,15 @@ public class EquipmentTest implements Serializable { ...@@ -50,6 +50,15 @@ public class EquipmentTest implements Serializable {
@ApiModelProperty("实施结果") @ApiModelProperty("实施结果")
private String tryResult; private String tryResult;
@ApiModelProperty("附件地址")
private String enclosureUrl;
@ApiModelProperty("文件名")
private String alias;
@ApiModelProperty("扩展名")
private String extName;
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
<mapper namespace="cn.wise.sc.cement.business.mapper.EquipmentTroubleshootingMapper"> <mapper namespace="cn.wise.sc.cement.business.mapper.EquipmentTroubleshootingMapper">
<sql id="where"> <sql id="where">
<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> </where>
</sql> </sql>
......
...@@ -52,8 +52,13 @@ public class EquipmentTestVo { ...@@ -52,8 +52,13 @@ public class EquipmentTestVo {
@ApiModelProperty("校核附件") @ApiModelProperty("校核附件")
private String enclosure; private String enclosure;
@ApiModelProperty("校核附件信息") @ApiModelProperty("文件名")
private List<EnclosureQuery> enclosureQueryList; private String alias;
@ApiModelProperty("扩展名")
private String extName;
@ApiModelProperty("路径")
private String enclosureUrl;
} }
...@@ -40,9 +40,9 @@ public interface IEquipmentService extends IService<Equipment> { ...@@ -40,9 +40,9 @@ public interface IEquipmentService extends IService<Equipment> {
BaseResponse<String> troubleshooting(EquipmentTroubleshootingQuery query); 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); BaseResponse<EquipmentTroubleshootingVo> getTroubleshootingDetail(Integer id);
......
...@@ -9,6 +9,7 @@ import cn.wise.sc.cement.business.model.vo.*; ...@@ -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.IEquipmentService;
import cn.wise.sc.cement.business.service.ISysUserService; import cn.wise.sc.cement.business.service.ISysUserService;
import cn.wise.sc.cement.business.util.ExcelUtil; 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
...@@ -224,8 +225,6 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -224,8 +225,6 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
} }
/** /**
* 设备检定 保存设备检定表信息和附件表信息,附件表的entity_type为3 * 设备检定 保存设备检定表信息和附件表信息,附件表的entity_type为3
* @param query (不传id为添加记录,传id为修改记录) * @param query (不传id为添加记录,传id为修改记录)
...@@ -246,6 +245,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -246,6 +245,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
EquipmentTest equipmentTest = new EquipmentTest(); EquipmentTest equipmentTest = new EquipmentTest();
BeanUtils.copyProperties(query, equipmentTest); BeanUtils.copyProperties(query, equipmentTest);
equipmentTest.setUserId(userService.getLoginUser().getId()) equipmentTest.setUserId(userService.getLoginUser().getId())
.setEnclosureUrl(enclosureQuery.getEnclosureUrl())
.setAlias(enclosureQuery.getAlias())
.setExtName(enclosureQuery.getExtName())
.setCreateTime(LocalDateTime.now()); .setCreateTime(LocalDateTime.now());
testMapper.insert(equipmentTest); testMapper.insert(equipmentTest);
equipment.setTestDate(equipmentTest.getTestDate()); equipment.setTestDate(equipmentTest.getTestDate());
...@@ -256,13 +258,6 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -256,13 +258,6 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
equipment.setAlias(enclosureQuery.getAlias()); equipment.setAlias(enclosureQuery.getAlias());
equipment.setExtName(enclosureQuery.getExtName()); equipment.setExtName(enclosureQuery.getExtName());
equipmentMapper.updateById(equipment); 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("检定完成"); return BaseResponse.okData("检定完成");
} }
...@@ -278,24 +273,6 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -278,24 +273,6 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
params.put("equipmentId", equipmentId); params.put("equipmentId", equipmentId);
Page<EquipmentTestVo> page = new Page<>(pageQuery.getPageNo(), pageQuery.getPageSize()); Page<EquipmentTestVo> page = new Page<>(pageQuery.getPageNo(), pageQuery.getPageSize());
IPage<EquipmentTestVo> pages = testMapper.getPage(page,params); 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); return BaseResponse.okData(pages);
} }
...@@ -321,7 +298,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -321,7 +298,7 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
.setExtName(entityEnclosure.getExtName()); .setExtName(entityEnclosure.getExtName());
enclosureQueryList.add(enclosureQuery); enclosureQueryList.add(enclosureQuery);
} }
equipmentTestVo.setEnclosureQueryList(enclosureQueryList);
return BaseResponse.okData(equipmentTestVo); return BaseResponse.okData(equipmentTestVo);
} }
...@@ -359,13 +336,14 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -359,13 +336,14 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
/** /**
* 设备故障维修登记分页查询 * 设备故障维修登记分页查询
* @param pageQuery * @param pageQuery
* @param equipmentId * @param name
* @return * @return
*/ */
@Override @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<>(); Map<String, Object> params = new HashMap<>();
params.put("equipmentId", equipmentId); params.put("equipmentId", name);
Page<EquipmentTroubleshootingVo> page = new Page<>(pageQuery.getPageNo(), pageQuery.getPageSize()); Page<EquipmentTroubleshootingVo> page = new Page<>(pageQuery.getPageNo(), pageQuery.getPageSize());
IPage<EquipmentTroubleshootingVo> pages = troubleshootingMapper.getPage(page,params); IPage<EquipmentTroubleshootingVo> pages = troubleshootingMapper.getPage(page,params);
return BaseResponse.okData(pages); return BaseResponse.okData(pages);
...@@ -373,14 +351,14 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -373,14 +351,14 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
/** /**
* 设备维修列表导出 * 设备维修列表导出
* @param equipmentId * @param name
* @param fileName * @param fileName
* @param response * @param response
*/ */
@Override @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<>(); Map<String, Object> params = new HashMap<>();
params.put("equipmentId", equipmentId); params.put("name", name);
List<Map<String, Object>> list= troubleshootingMapper.exportList(params); List<Map<String, Object>> list= troubleshootingMapper.exportList(params);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
Map<String, Object> map = list.get(0); Map<String, Object> map = list.get(0);
...@@ -440,7 +418,12 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -440,7 +418,12 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
if(equipmentVo == null){ if(equipmentVo == null){
return BaseResponse.errorMsg("信息错误!"); 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(); EquipmentScrap equipmentScrap = new EquipmentScrap();
BeanUtils.copyProperties(query, equipmentScrap); BeanUtils.copyProperties(query, equipmentScrap);
if(query.getId() == null){ 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